diff --git a/models/widgets.py b/models/widgets.py index 24b228544cd78d3913df150ae1c7a480fe59ce4c..b754a334cb5939feefd9653b0381ac4a728099e6 100755 --- a/models/widgets.py +++ b/models/widgets.py @@ -186,7 +186,7 @@ gridNode = dbui.Node(T('Tables'), db.tables, cfgSvc.get_grid) reportNode = dbui.Node(T('Reports'), {'report_1': URL(c="reports", f="report_1")}, - dbui.cfg_url_panel) + dbui.cfg_configurable_url_panel) viewportModifier = dbui.ViewportModifier() viewportModifier.add_node(formNode, gridNode, reportNode) diff --git a/modules/plugin_dbui/__init__.py b/modules/plugin_dbui/__init__.py index 79d7762288d154b9c30ae23ac39424d66105c3c5..957877bd3d81e21cb4a1fc915297fb9410db9a86 100755 --- a/modules/plugin_dbui/__init__.py +++ b/modules/plugin_dbui/__init__.py @@ -16,5 +16,5 @@ from helper import (get_js_files, get_script_path) from mapper import map_default, map_tabpanel from modifier import Spacer, Widget -from navtree import Node, cfg_url_panel +from navtree import Node, cfg_configurable_url_panel, cfg_url_panel from viewportmodifier import ViewportModifier \ No newline at end of file diff --git a/modules/plugin_dbui/navtree.py b/modules/plugin_dbui/navtree.py index 2421756309e64613acc8ab0b5d7d960bdc8cd520..abd805ce9df86750f6fae2531a404a8493164c84 100644 --- a/modules/plugin_dbui/navtree.py +++ b/modules/plugin_dbui/navtree.py @@ -8,27 +8,79 @@ import locale from gluon import current +def cfg_configurable_url_panel(key, value): + """ Return the configuration dictionary for a panel displaying + an url. The argument of the url can be change using a form + appearing on the right side. + + Technicaly, the configuration dictionary describe an ExtJS.Viewport + key + it the name of the leaf + + value + dictionary containing + url + its content is displayed in the panel + + form + an xxx form allowing to customize the url request + It is displaied on the right side of the panel + + """ + cfg = { + 'layout': 'border', + 'items': [{ + 'autoScroll': True, + 'defaults': {'layout': 'fit'}, + 'itemId': 'urlPanel', + 'region': 'center', + }, { + 'autoScroll': True, + 'buttons': [{ + 'text': 'Go', + }], + 'collapsible': True, + 'frame': True, + 'layout': 'form', + 'itemId': 'urlConfigurator', + 'region': 'east', + 'split': True, + 'width': 200, + }] + } + + return cfg + + def cfg_url_panel(key, url): - """Return the configuration object for an Ext.Panel - which autolad an url. + """Return the configuration dictionary for an Ext.Panel + displaying an url. + + key + it the name of the leaf + + url + its content is displayed in the panel """ - return {'autoLoad': url, 'preventBodyReset': True, 'xtype': 'panel'} + cfg = {'autoLoad': url, + 'plugins': ['pPanelMathJax'], + 'preventBodyReset': True, + 'xtype': 'panel'} + + return cfg class Node(object): """Node associating a leaf to a widget. - Leaves can be a list of database table or dicitonary - assoicating a key with an url. In the latter case leave name - are the dictionary key. - - Leaf names are translated and sorted by alphabetic order. - Some my be hidden depending on the context. + Leaf names can be a list of string or dictionary keys. + They are translated and sorted by alphabetic order. + Some of them my be hidden depending on the context. - We use a configurator to get the confgiration object of the + We use a configurator to get the configuration object of the target widget. It is a function getting the leave names, its - attributes (dictionary value) and returning a dictionary + attributes (dictionary value) and returning a dictionary. """ def __init__(self, text, leaves, configurator, hidden=[]): @@ -38,8 +90,8 @@ class Node(object): name of the node appearing in the viewport leaves - list of leaves names - or dictionary where keys define leave names + list of string or a dictionary where keys + will be used as leaf names configurator Reference to a function accepting either a leave name