Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
w2pext
plugin_dbui
Commits
79d3bf6a
Commit
79d3bf6a
authored
Dec 16, 2011
by
tux091
Browse files
Draft of the configurator cfg_configurable_url_panel and improve cfg_url_panel
parent
803578a2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
15 deletions
+67
-15
models/widgets.py
models/widgets.py
+1
-1
modules/plugin_dbui/__init__.py
modules/plugin_dbui/__init__.py
+1
-1
modules/plugin_dbui/navtree.py
modules/plugin_dbui/navtree.py
+65
-13
No files found.
models/widgets.py
View file @
79d3bf6a
...
...
@@ -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
)
...
...
modules/plugin_dbui/__init__.py
View file @
79d3bf6a
...
...
@@ -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
modules/plugin_dbui/navtree.py
View file @
79d3bf6a
...
...
@@ -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 conf
g
iration object of the
We use a configurator to get the confi
gu
ration 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 name
s
or dictionary where keys define
lea
ve
names
list of
string or a dictionary where key
s
will be used as
lea
f
names
configurator
Reference to a function accepting either a leave name
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment