diff --git a/controllers/reports.py b/controllers/reports.py index e52fc824acd4cb26adb5bff4303fad2c18e05897..9b55ae3fbd73dc810f957e202ab3c168749ffd68 100644 --- a/controllers/reports.py +++ b/controllers/reports.py @@ -22,7 +22,7 @@ def report_2(): """Return the url arguments """ - selector = Selector(db, extfield='my_format') + selector = Selector(virtdb.foo1, extfield='my_format') # user request a file with a specific format (latex,...) iframe = selector.download() diff --git a/models/widgets_viewport.py b/models/widgets_viewport.py index 43171246b9c02b2553eef4f9bb69c6d1c20806b3..c7487409f6717b810aea5cdf762cc81cf3bf2458 100755 --- a/models/widgets_viewport.py +++ b/models/widgets_viewport.py @@ -23,7 +23,8 @@ reportNode = dbui.Node(T('Reports')) node = dbui.Panel(html="salut ma poule") reportNode.add_child(T('report_1'), node) -node = dbui.to_panel_with_url_selector(virtdb.foo1, URL('reports', 'report_2')) +node = dbui.to_panelWithUrlSelector(virtdb.foo1, + baseUrl=URL('reports', 'report_2')) reportNode.add_child(T('report_2'), node) versionNode = dbui.Panel(autoLoad='/'+request.application+'/default/versions') diff --git a/modules/plugin_dbui/__init__.py b/modules/plugin_dbui/__init__.py index 2e983ed911e09dfefe1063d262d5047dbc444042..ab43acbac00611efd4414e1bee36d2a32cd97eea 100755 --- a/modules/plugin_dbui/__init__.py +++ b/modules/plugin_dbui/__init__.py @@ -10,7 +10,7 @@ from converter import (to_field, to_gridFilter, to_gridPanel, to_jsonstore, - to_panel_with_url_selector, + to_panelWithUrlSelector, to_tree, to_viewport) from dbsvc import DbSvc diff --git a/modules/plugin_dbui/converter.py b/modules/plugin_dbui/converter.py index 29d62fe723961509beb831c8e0f2bdc70b90dbe9..f47f9b6fd0776606ec507481c2aabf731a4ca376 100644 --- a/modules/plugin_dbui/converter.py +++ b/modules/plugin_dbui/converter.py @@ -586,32 +586,37 @@ def to_jsonstore(table, **kwargs): return cfg -def to_panel_with_url_selector(table, url, is_mathjax=False): - """Build the configuration for a PanelWithUrlSelector +def to_panelWithUrlSelector(table, **kwargs): + """Build the configuration for a simple PanelWithUrlSelector where the selector is a form derived from the database table. - - The selected values are send to a controller defined by the URL. + + The selected values are send to a controller defined by the baseUrl. Values are processed and results will be published in the panel. + It is mandatory to specified the baseUrl. + + The others keyword arguments are the configuration parameters + of the PanelWithUrlSelector. By default is_mathjax is False, + and panelCfg, selectorCfg, selectorCollapsible are defined. - table - gluon.dal.Table - - url - well form URL - """ + if 'baseUrl' not in kwargs: + raise BaseException('The keyword argument basseUrl is missing.') + # build the selector from the table fields = to_fields(table) selector = FieldSet(items=fields, plugins=['pFormToolTip'], title=current.T('Select')) - + # build the configuration for the PanelWithUrlSelector - cfg = PanelWithUrlSelector(baseUrl=url, - isMathJax=is_mathjax, - panelCfg=Panel(), - selectorCfg=selector, - selectorCollapsible=False) + default = dict(isMathJax=False, + panelCfg=Panel(), + selectorCfg=selector, + selectorCollapsible=False) + + default.update(kwargs) + cfg = PanelWithUrlSelector(**default) + return cfg diff --git a/views/reports/report_2.html b/views/reports/report_2.html index 5181b246584a0e17060f4960ba5c53ac63bf6e46..c082d94fc0d0aaeacbfd2e2444993f3e2e8e2813 100644 --- a/views/reports/report_2.html +++ b/views/reports/report_2.html @@ -1,3 +1,4 @@ <h3>Report_2</h3> -{{for k in test:}} - <br>{{=k}}: {{=test[k]}}{{pass}} +<hr> +{{=BEAUTIFY(test)}} +<hr> \ No newline at end of file