Commit 79d3bf6a authored by tux091's avatar tux091
Browse files

Draft of the configurator cfg_configurable_url_panel and improve cfg_url_panel

parent 803578a2
......@@ -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)
......
......@@ -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
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment