diff --git a/controllers/plugin_dbui.py b/controllers/plugin_dbui.py index 155b7e9d160237bdcacc5d7f60968929d6bb657a..955001c0ddbdcf6e7ed7480c9149fb0330d34a6c 100644 --- a/controllers/plugin_dbui.py +++ b/controllers/plugin_dbui.py @@ -36,7 +36,7 @@ def index(): Load the javascript librairy for the plugin. Define view. - PARAMETERS WHICH CAN BE SET VIA THE PLUGINMANAGER + PUBLIC PARAMETERS WHICH CAN BE SET VIA THE PLUGINMANAGER page_view The page view call by the plugin @@ -49,7 +49,12 @@ def index(): with_grid_filter Add the javascript librairy for gridFilter - + PRIVATE PARAMETERS + + combined_fields + field_sets + wizards + OPTIONS debug @@ -68,10 +73,13 @@ def index(): """ # define plugin parameters and their default value - plugins = PluginManager('dbui', + plugins = PluginManager('dbui', + combined_fields=None, + field_sets=None, page_view='plugin_dbui.html', script_path='static/plugin_dbui/scripts', - with_grid_filter=False) + with_grid_filter=False, + wizards=None) # paths base = os.path.join(os.path.sep, request.application) diff --git a/modules/plugin_dbui/__init__.py b/modules/plugin_dbui/__init__.py index 134995f4f4a21447005c0faff2f7ae70b50e981c..24ae1fbfcf15fdd5da9c7d62ff8e4ff0933cd66a 100644 --- a/modules/plugin_dbui/__init__.py +++ b/modules/plugin_dbui/__init__.py @@ -4,3 +4,6 @@ from cfgsvc import CfgSvc from dbsvc import DbSvc +from tools import (define_combined_field, + define_field_set, + define_wizard) diff --git a/modules/plugin_dbui/tools.py b/modules/plugin_dbui/tools.py new file mode 100644 index 0000000000000000000000000000000000000000..d5950db2d3f4cf2508a186f986d386e652a9afc8 --- /dev/null +++ b/modules/plugin_dbui/tools.py @@ -0,0 +1,51 @@ +""" $Id$ + Author: R. Le Gac +""" + +__version__ = "$Revision$" + +from gluon.tools import PluginManager + + +def define_combined_field(): + """ Helper tool to define combined fields in form. + + """ + plugins = PluginManager() + plugins.dbui.combined_fields = {} + + +def define_field_set(title, table, fields, **extjs): + """ Helper tool to define fieldSet in form. + title + title of the fieldset + + table + name of the table + + fields + list of field name belonging to the table + + extjs + Ext JS configuration parameters + See the documentation of Ext.form.FieldSet + + """ + plugins = PluginManager() + plugins.dbui.field_sets = {} + + if table not in plugins.dbui.field_sets: + plugins.dbui.field_sets[table] = [] + + di = {'title': title, 'fields': fields} + di.update(**extjs) + + plugins.dbui.field_sets[table].append(di) + + +def define_wizard(): + """ Helper tool to define wizard in form. + + """ + plugins = PluginManager() + plugins.dbui.wizards = {}