Commit 2a0359b5 authored by Renaud Le Gac's avatar Renaud Le Gac
Browse files

Improve API for the PanelWithUrlSelector configurator.

parent 6d085619
......@@ -192,7 +192,8 @@ cfg = dbui.to_urlPanel(URL(c="reports", f="report_1"))
reportNode.add_child(T('report_1'), cfg)
form_items = cvtSvc.to_form_items(dummy.foo1)
cfg = dbui.to_panelWithUrlSelector(URL(c="reports", f="report_2"), form_items)
cfg = dbui.to_panelWithUrlSelector(form_items,
baseUrl=URL(c="reports", f="report_2"))
reportNode.add_child(T('report_2'), cfg)
viewportModifier = dbui.ViewportModifier()
......
......@@ -9,30 +9,47 @@ from gluon import current
from helper import is_mathjax
def to_panelWithUrlSelector(baseUrl,
formItems,
def to_panelWithUrlSelector(formItems,
application=None,
baseUrl=None,
controller=None,
ctrlField=None,
title='Configure'):
"""Return the configuration dictionary for an App.PanelWithUrlSelector.
the main panel displays the URL content while the selector panel shows
a form allowing to change the URL setting.
application and controller
The web2py way of defining the URL: /application/controller.
If the application is not defined the URL is:
/current application/controller.
These keyword arguments make sense when using the ctrlField.
See also baseUrl.
baseUrl
well-formed URL string, i.e http://blabla
Well-formed URL string, i.e http://blabla
See also application and controller
ctrlField
name of the form field defining the controller
Name of the form field defining the controller
When define the URL become http://blabla/ctrlFieldValue
formItems
a list of configuration dictionary defining the
A list of configuration dictionary defining the
widget embedded in the form
title
title of the box surrounding form widgets
Title of the box surrounding form widgets
"""
cfg = {'baseUrl': baseUrl,
url = baseUrl
if not url:
if application:
url = '/%s/%s' % (application, controller)
else:
url = '/%s/%s' % (current.request.application, controller)
cfg = {'baseUrl': url,
'ctrlField': ctrlField,
'panelCfg': None,
'selectorCfg':None,
......
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