How does the plugin system work? Documentation Added - WIP


dlandon

Recommended Posts

LOL. The included filetree.js is already modded to allow selection of file extensions, but any good ideas can be merged :)

I modded it so a text input is populated with the path only. So if you just need a path location for something and not a file selection.  You can use a '.'  filter so you only get directories and then a directory function.

Link to comment
  • Replies 195
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

There is a change in v6b12 that will affect plugins. The emhttp file structure has changed and you can no longer have a .page and a .php file.  unRAID expects the php for your page to be included in the .page file of your plugin.  The OP has more details.

 

EDIT: I have found a work around.  I have posted in the OP.

You also need an icons directory with a 16x16 image in lowercase matching the Title.  So for apcupsd your title is APC UPS so I resized the 48x48 png and renamed it apcups.png and put it in an icons directory in emhttp/plugins/apcupsd. For one of my own plugins I had to move the main 48x48 png to an images folder for it to show up in the installed plugins section.

 

Link to comment

LOL. The included filetree.js is already modded to allow selection of file extensions, but any good ideas can be merged :)

I added these two lines:

 

if(jQuery) (function($){

 

$.extend($.fn, {

fileTree: function(o, h, directory) {

// Defaults

if( !o ) var o = {};

if( o.root == undefined ) o.root = '/';

        if( o.filter == undefined) o.filter = '';

if( o.script == undefined ) o.script = 'jqueryFileTree.php';

if( o.folderEvent == undefined ) o.folderEvent = 'click';

if( o.expandSpeed == undefined ) o.expandSpeed= 500;

if( o.collapseSpeed == undefined ) o.collapseSpeed= 500;

if( o.expandEasing == undefined ) o.expandEasing = null;

if( o.collapseEasing == undefined ) o.collapseEasing = null;

if( o.multiFolder == undefined ) o.multiFolder = true;

if( o.loadMessage == undefined ) o.loadMessage = 'Loading...';

 

$(this).each( function() {

 

function showTree(c, t, f) {

$©.addClass('wait');

$(".jqueryFileTree.start").remove();

$.post(o.script, { dir: t, filter: f }, function(data) {

$©.find('.start').html('');

$©.removeClass('wait').append(data);

if( o.root == t ) $©.find('UL:hidden').show(); else $©.find('UL:hidden').slideDown({ duration: o.expandSpeed, easing: o.expandEasing });

bindTree©;

});

}

 

function bindTree(t) {

$(t).find('LI A').bind(o.folderEvent, function() {

if( $(this).parent().hasClass('directory') ) {

if( $(this).parent().hasClass('collapsed') ) {

directory($(this).attr('rel'));

// Expand

if( !o.multiFolder ) {

$(this).parent().parent().find('UL').slideUp({ duration: o.collapseSpeed, easing: o.collapseEasing });

$(this).parent().parent().find('LI.directory').removeClass('expanded').addClass('collapsed');

}...

 

And added this to my page

$('#storage_tree').fileTree({root:'/mnt/',filter:'.',script:'/plugins/dynamix.kvm.manager/classes/FileTree.php',multiFolder:false}, false, function(directory) {$('#storage_dir').val(directory);});

 

to get this

 

Screenshot.jpg.056d09f95c2488fbe4a723505dc1118d.jpg

Link to comment

There is a change in v6b12 that will affect plugins. The emhttp file structure has changed and you can no longer have a .page and a .php file.  unRAID expects the php for your page to be included in the .page file of your plugin.  The OP has more details.

 

EDIT: I have found a work around.  I have posted in the OP.

You also need an icons directory with a 16x16 image in lowercase matching the Tittle.  So for apcupsd your title is APC UPS so I resized the 48x48 png and renamed it apcups.png and put it in an icons directory in emhttp/plugins/apcupsd. For one of my own plugins I had to move the main 48x48 png to an images folder for it to show up in the installed plugins section.

 

I don't understand this.  It is not necessary for apcupsd.  I modified apcupsd so the php is included in the .page file and the image is fine in the plugins section.

Link to comment

There is a change in v6b12 that will affect plugins. The emhttp file structure has changed and you can no longer have a .page and a .php file.  unRAID expects the php for your page to be included in the .page file of your plugin.  The OP has more details.

 

EDIT: I have found a work around.  I have posted in the OP.

You also need an icons directory with a 16x16 image in lowercase matching the Tittle.  So for apcupsd your title is APC UPS so I resized the 48x48 png and renamed it apcups.png and put it in an icons directory in emhttp/plugins/apcupsd. For one of my own plugins I had to move the main 48x48 png to an images folder for it to show up in the installed plugins section.

 

I don't understand this.  It is not necessary for apcupsd.  I modified apcupsd so the php is included in the .page file and the image is fine in the plugins section.

I know. I'm not sure why my plugin's image didn't show up there. I was just pointing it out that it could go in an images directory and it would.

 

But my main point was if you don't have an 16x16 icon then there is a default icon in settings to the left of the Title instead of the apcupsd.png.  It has to be apcups.png in the icons directory to match the Title.

 

Link to comment

There is a change in v6b12 that will affect plugins. The emhttp file structure has changed and you can no longer have a .page and a .php file.  unRAID expects the php for your page to be included in the .page file of your plugin.  The OP has more details.

 

EDIT: I have found a work around.  I have posted in the OP.

You also need an icons directory with a 16x16 image in lowercase matching the Tittle.  So for apcupsd your title is APC UPS so I resized the 48x48 png and renamed it apcups.png and put it in an icons directory in emhttp/plugins/apcupsd. For one of my own plugins I had to move the main 48x48 png to an images folder for it to show up in the installed plugins section.

 

I don't understand this.  It is not necessary for apcupsd.  I modified apcupsd so the php is included in the .page file and the image is fine in the plugins section.

I know. I'm not sure why my plugin's image didn't show up there. I was just pointing it out that it could go in an images directory and it would.

 

But my main point was if you don't have an 16x16 icon then there is a default icon in settings to the left of the Title instead of the apcupsd.png.  It has to be apcups.png in the icons directory to match the Title.

 

It's actually not the title, but the name of the plugin.  In the case of apcupsd, the name is 'apcupsd' so the icon needs to be 'apcupsd.png' for the plugin manager.

 

<!DOCTYPE PLUGIN [
<!ENTITY name       "apcupsd">         <---- this one
<!ENTITY author     "seeDrs/dlandon">
<!ENTITY version    "2014.11.30">
<!ENTITY pluginURL  "https://github.com/dlandon/unraid-snap/raw/master/Apcupsd-x86_64.plg">
<!ENTITY pkgversion "3.14.12">
]>

<PLUGIN  name="&name;"
         author="&author;"
         version="&version;"
         pluginURL="&pluginURL;">

 

The application icon is specified in the 'apcupsd.page' file.

 

Menu="OtherSettings"
Icon="apcupsd.png"                      <------ application icon
Version="2014.11.30"
Author="seeDrs/dlandon"
Title="APC UPS"
---
<?PHP

 

In this case the icons are both the same, but could be different if desired.

Link to comment

There is a change in v6b12 that will affect plugins. The emhttp file structure has changed and you can no longer have a .page and a .php file.  unRAID expects the php for your page to be included in the .page file of your plugin.  The OP has more details.

 

EDIT: I have found a work around.  I have posted in the OP.

You also need an icons directory with a 16x16 image in lowercase matching the Tittle.  So for apcupsd your title is APC UPS so I resized the 48x48 png and renamed it apcups.png and put it in an icons directory in emhttp/plugins/apcupsd. For one of my own plugins I had to move the main 48x48 png to an images folder for it to show up in the installed plugins section.

 

I don't understand this.  It is not necessary for apcupsd.  I modified apcupsd so the php is included in the .page file and the image is fine in the plugins section.

I know. I'm not sure why my plugin's image didn't show up there. I was just pointing it out that it could go in an images directory and it would.

 

But my main point was if you don't have an 16x16 icon then there is a default icon in settings to the left of the Title instead of the apcupsd.png.  It has to be apcups.png in the icons directory to match the Title.

 

It's actually not the title, but the name of the plugin.  In the case of apcupsd, the name is 'apcupsd' so the icon needs to be 'apcupsd.png' for the plugin manager.

 

<!DOCTYPE PLUGIN [
<!ENTITY name       "apcupsd">         <---- this one
<!ENTITY author     "seeDrs/dlandon">
<!ENTITY version    "2014.11.30">
<!ENTITY pluginURL  "https://github.com/dlandon/unraid-snap/raw/master/Apcupsd-x86_64.plg">
<!ENTITY pkgversion "3.14.12">
]>

<PLUGIN  name="&name;"
         author="&author;"
         version="&version;"
         pluginURL="&pluginURL;">

 

The application icon is specified in the 'apcupsd.page' file.

 

Menu="OtherSettings"
Icon="apcupsd.png"                      <------ application icon
Version="2014.11.30"
Author="seeDrs/dlandon"
Title="APC UPS"
---
<?PHP

 

In this case the icons are both the same, but could be different if desired.

No I get that.  And maybe it's just if you have tabs enabled under display settings. But until I resized the apcupsd.png to 16x16 and renamed it to apcups.png and put it in an icons directory, the apcupsd settings page had a default image to the left of the title span "APC UPS"

Link to comment

It is a bit confusing, but the "Icon=<name>" refers to a 48x48 logo which resides in the "images" folder. <name> can be anything you like.

 

The small icons in the title headers (tabs) are 16x16 icons, which reside in the "icons" folder. The file names to be used are the title header without spaces and all lowercase.

 

And images/icons are in .png format ...

 

Link to comment

Sorry.  I really meant this for dmacias.  I don't see the issues you are talking about with the apcupsd plugin.

It's nothing big but this is what I was talking about.  And by adding a 16x16 icon png fixes it.

 

How did you convert it to maintain the transparent background?  I can't seem to get it.

 

Or if you don't mind, send me the one you are using.

Link to comment

Sorry.  I really meant this for dmacias.  I don't see the issues you are talking about with the apcupsd plugin.

It's nothing big but this is what I was talking about.  And by adding a 16x16 icon png fixes it.

 

How did you convert it to maintain the transparent background?  I can't seem to get it.

 

Or if you don't mind, send me the one you are using.

I just resized it with gimp in linux.  It probably doesn't have a transparent background.  I'm just using the black skin.  But I'll paste it here if it does.

 

It's hard to tell on my phone but here it is

06682fe1fe802f2a234b529d6e857d37.jpg

Link to comment

Thanks.  I struggle with these image files because Windows paint is so wimpy.  I managed to get the 16 x 16 original that has the transparent background and I've updated apcupsd.

 

Thanks for finding that for me.  I didn't even catch that was an option.  I guess the more I work with plugins, the more I learn.

Link to comment

You know there is gimp for Windows right? Not try8ng to b3 checky, just letting you know there are free options available for Windows

That's good to know.  I don't use windows much but if do I'll use gimp. That sounded like an interesting man meme. Maybe I'll make one with gimp. :)

 

Thanks.  I struggle with these image files because Windows paint is so wimpy.  I managed to get the 16 x 16 original that has the transparent background and I've updated apcupsd.

 

Thanks for finding that for me.  I didn't even catch that was an option.  I guess the more I work with plugins, the more I learn.

Yeah Gimp is like Photoshop but free.

I appreciate all your doing and I think this thread has been helpful.  My comments before weren't really to point out acpupsd problems but to add to the topic of this thread and things I've notice that have changed.  I had to spend a lot of time with css too.  I feel for phaze and some who have just started moving to unraid 6 plg format.

Link to comment

Dynamix has a status indicator you can use to show the status of your process.  Details are in the OP.

 

I would encourage you to do this to be consistent with the way dynamix shows process status.

Thanks that's very useful.  Another thing that's useful is the tabs.  I've been helping Peter with his openvpn plugins.  So instead of having everything on one page it's tabbed with settings and logs.  It could be useful for your apcupsd to show full ups status in a separate tab. Or you could have 3 tabs with a main status page, settings page and full status page.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.