You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
cryptonas/plugins/plugin-interface.txt

64 lines
3.6 KiB

The following directory structure is required:
- python code: plugins/PLUGINNAME/PLUGINNAME.py (all lower case is recommended)
- language files: plugins/PLUGINNAME/lang/(en|de|??).hdf
- clearsilver templates: plugins/PLUGINNAME/*.cs
- icon (128x128px recommended): plugins/PLUGINNAME/plugin_icon.png
Python code interface:
- create a class with the same name as the plugin - it must inherit CryptoBoxPlugin
- function "doAction":
- this function will get called whenever this plugins is involved in a request
- all arguments should be optional (e.g. for displaying a form without previous input values)
- the argument "store" should be used to process a form submission (just a recommendation)
- if the processing failed for some reason (invalid input, ...), it should manually set
"Data.Warning" or "Data.Success") to a value of your choice (preferably
you may want to use messages of the namespace of your plugin
(e.g. "Data.Plugins.PLUGINNAME.WarningMessage.InvalidInput"))
- the return value should be the name of the template that should be displayed after processing
(a template file in the plugin directory takes precedence over global template files)
- the return value may also be a dictionary with the following elements:
* template: the name of the template file (mandatory)
* generator: a generator object ("yield") - its content will replace every
occurrence of "<!-- CONTENT_DUMMY -->" in the template (useful for pages that
are displayed step by step (as for formatting of filesystems))
- the return value may also be a dictionary with the following elements:
* plugin: the name of a plugin
* values: a dictionary of variables that should be defined for this plugin
- an empty (e.g. None) return value can be used to go to the default page ("disks"
or "volume_mount" (for volume plugins))
- function "getStatus":
- returns a string, that describes a state connected to this plugin (e.g. the current date and
time (for the "date" plugin))
- the class variable "pluginCapabilities" must be an array of strings (supported: "system" and
"volume")
- the class variable "pluginVisibility" may contain one or more of the following items:
menu/preferences/volume. This obviously should fit to the 'pluginCapabilities' variable.
An empty list is interpreted as a disabled plugin.
- the class variable "requestAuth" is boolean and defines, if admin authentication is necessary
for this plugin
- the class variable "rank" is an integer in the range of 0..100 - it determines the order
of plugins in listings (lower value -> higher priority)
- volume plugins contain the attribute "device" (you may trust this value - a volume plugin will
never get called with an invalid device)
- the python module which contains the plugin's class should also contain a class called
'unittests' - it should inherit WebInterfaceTestClass.WebInterfaceTestClass
Language file structure:
- the content of the language file will be added to the hdf dataset below "Lang.Plugins.PLUGINNAME"
(this avoids namespace conflicts)
- the following values _must_ be defined:
Name (a short description)
Link (the visible text for links to this plugin)
Rank (defines the order of the plugins displayed (0..100))
- all warnings, hints and success messages should be stored below WarningMessage.???
(resp. AdviceMessage or SuccessMessage)
Clearsilver template:
- should start with a "<h1>" tag (volume plugins: "h3")
- links to the plugin (e.g. in form headers) could look like the following:
<?cs call:link("PLUGINNAME",'','','','') ?>