language namespace for plugins separated
plugin interface changed ("prepareForm" removed) plugins do not raise exceptions anymore first part of the partitioning plugin device-specific stuff moved to CryptoBoxTools
This commit is contained in:
parent
f2a7ceb61c
commit
de3280806f
26 changed files with 622 additions and 309 deletions
|
@ -1,36 +1,33 @@
|
|||
The following directory structure is required:
|
||||
- python code: plugins/MODULENAME/MODULENAME.py (all lower case is recommended)
|
||||
- language files: plugins/MODULENAME/lang/(en|de|??).hdf
|
||||
- clearsilver templates: plugins/MODULENAME/*.cs
|
||||
- python code: plugins/PLUGINNAME/PLUGINNAME.py (all lower case is recommended)
|
||||
- language files: plugins/PLUGINNAME/lang/(en|de|??).hdf
|
||||
- clearsilver templates: plugins/PLUGINNAME/*.cs
|
||||
|
||||
|
||||
Python code interface:
|
||||
def prepareForm(hdf, cbox):
|
||||
- here you may add some items to the hdf dataset used by the templates
|
||||
- the recommended namespace is Data.Modules.MODULENAME.???
|
||||
|
||||
def doAction(cbox, store=None, ???):
|
||||
- this function will get called whenever this module is involved in a request
|
||||
def doAction(hdf, cbox, store=None, ???):
|
||||
- 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 raise a CBPluginException (e.g. CBPluginActionError) - the error message should be the name of a warning message (maybe defined in the plugin specific language file) - e.g. "InvalidDate" for Lang.WarningMessage.InvalidDate
|
||||
- the return value should be the name of the template that should be displayed after processing (a template file in the module directory takes precedence over global template files)
|
||||
- if the processing failed for some reason (invalid input, ...), it should manually set the "Data.Warning" (resp. "Data.Error" or "Data.Success") to a value of your choice (preferably you may want to use messages of your namespace (e.g. "Plugins.PLUGINNAME.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)
|
||||
|
||||
def def getStatus(cbox):
|
||||
- returns a string, that described a state connected to this module (e.g. the current date and time (for the "date" plugin)
|
||||
- returns a string, that described a state connected to this plugin (e.g. the current date and time (for the "date" plugin)
|
||||
|
||||
|
||||
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:
|
||||
Lang.Modules.MODULENAME.Name (a short description)
|
||||
Lang.Modules.MODULENAME.Link (the visible text for links to this module)
|
||||
Lang.Modules.MODULENAME.Rank (defines the order of the plugins displayed)
|
||||
- all other elements should follow the usual structure of language files
|
||||
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, error and success messages should be stored below WarningMessage.??? (resp. ErrorMessage or SuccessMessage)
|
||||
|
||||
|
||||
Clearsilver template:
|
||||
- should start with a "<h1>" tag
|
||||
- links to the module (e.g. in form headers) could look like the following:
|
||||
<?cs call:link("module_MODULENAME",'','','','') ?>
|
||||
- links to the plugin (e.g. in form headers) could look like the following:
|
||||
<?cs call:link("plugins/PLUGINNAME",'','','','') ?>
|
||||
- a hidden input field called "store" should be used to indicate a form submission
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue