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
tev
plugin_event
Commits
55f235a2
Commit
55f235a2
authored
Apr 01, 2017
by
LE GAC Renaud
Browse files
Update ui_viewport to add the node for the sources.
parent
050c63d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
30 deletions
+71
-30
controllers/plugin_event.py
controllers/plugin_event.py
+8
-0
languages/fr-fr.py
languages/fr-fr.py
+2
-0
modules/plugin_event/ui_viewport.py
modules/plugin_event/ui_viewport.py
+61
-30
No files found.
controllers/plugin_event.py
View file @
55f235a2
...
...
@@ -81,3 +81,11 @@ def metric2d():
except
(
IndexError
,
ReportException
,
TypeError
,
ValueError
):
return
CODE
(
traceback
.
format_exc
()).
xml
()
def
source
():
"""Display the content of a source via an ``Ext.grid.Panel``.
Value send by the selector are used to filter the content of the source.
"""
return
"Hello"
languages/fr-fr.py
View file @
55f235a2
...
...
@@ -27,6 +27,7 @@
'Aggregation Z'
:
'Agréger (z)'
,
'Alignments'
:
'Alignments'
,
'All columns will be configured when the field is empty'
:
'Toutes les colonnes seront configurées quand ce champ est vide'
,
'Application'
:
'Application'
,
'Are you sure you want to delete this object?'
:
'Are you sure you want to delete this object?'
,
'auth_cas'
:
'auth_cas'
,
'auth_event'
:
'auth_event'
,
...
...
@@ -311,6 +312,7 @@
'the metrics 2d'
:
'les métriques 2d'
,
'The metrics 2d'
:
'Les métriques 2d'
,
"The report id '%s' is unknown."
:
"The report id '%s' is unknown."
,
'The sources'
:
'Les sources'
,
'This email already has an account'
:
'This email already has an account'
,
'Time'
:
'Temps'
,
'Timestamp'
:
'Timestamp'
,
...
...
modules/plugin_event/ui_viewport.py
View file @
55f235a2
...
...
@@ -5,6 +5,7 @@
import
plugin_dbui
as
dbui
from
event
import
Event
from
gluon
import
current
from
gluon.html
import
URL
...
...
@@ -32,10 +33,11 @@ class ViewportUi(object):
ViewportUi
.
app_node
(
db
,
T
),
ViewportUi
.
configure_node
(
db
,
T
),
ViewportUi
.
meta_node
(
db
,
T
),
ViewportUi
.
object_node
(
db
,
T
),
ViewportUi
.
people_
object_node
(
db
,
T
),
ViewportUi
.
event_node
(
db
,
T
),
ViewportUi
.
list_node
(
db
,
T
,
selector_panel
),
ViewportUi
.
metric2d_node
(
db
,
T
,
selector_panel
)]
ViewportUi
.
metric2d_node
(
db
,
T
,
selector_panel
),
ViewportUi
.
source_node
(
db
,
T
,
selector_panel
),]
modifier
=
dbui
.
ViewportModifier
()
modifier
.
add_node
(
*
nodes
)
...
...
@@ -63,7 +65,7 @@ class ViewportUi(object):
if
"auth"
in
current
.
globalenv
:
node
=
Node
(
T
(
"
CAS
"
))
node
=
Node
(
T
(
"
Application
"
))
add_child
=
node
.
add_child
...
...
@@ -186,40 +188,36 @@ class ViewportUi(object):
return
node
@
staticmethod
def
objec
t_node
(
db
,
T
):
"""To deal with
object and people
.
def
lis
t_node
(
db
,
T
,
selector_panel
):
"""To deal with
lists
.
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
selector_panel (gluon.storage.Storage):
configuration of the selector panel.
Returns:
dbui.Node:
the configuration of a tree node.
"""
node
=
Node
(
T
(
"People and objects"
))
# NOTE
# Immediate translation is required by node.short_children
node
=
Node
(
T
(
"The lists"
))
add_child
=
node
.
add_child
add_child
(
T
(
"people"
,
lazy
=
False
),
to_grid
(
db
.
people
))
add_child
(
T
(
"people_categories"
,
lazy
=
False
),
to_grid
(
db
.
people_categories
))
add_child
(
T
(
"objects"
,
lazy
=
False
),
to_grid
(
db
.
objects
))
for
row
in
db
(
db
.
lists2
.
id
>
0
).
select
(
orderby
=
db
.
lists2
.
name
):
add_child
(
T
(
"object_categories"
,
lazy
=
False
),
to_grid
(
db
.
object_categories
))
panel
=
selector_panel
panel
.
baseUrl
=
URL
(
"plugin_event"
,
"grid"
)
panel
.
baseParams
=
{
"id_list"
:
row
.
id
}
node
.
sort_children
(
)
add_child
(
row
.
name
,
panel
)
return
node
@
staticmethod
def
list
_node
(
db
,
T
,
selector_panel
):
"""To deal with
list
s.
def
metric2d
_node
(
db
,
T
,
selector_panel
):
"""To deal with
two-dimension metric
s.
Args:
db (pyDAL.DAL): database connection
...
...
@@ -231,23 +229,55 @@ class ViewportUi(object):
dbui.Node:
the configuration of a tree node.
"""
node
=
Node
(
T
(
"The
lists
"
))
node
=
Node
(
T
(
"The
metrics 2d
"
))
add_child
=
node
.
add_child
for
row
in
db
(
db
.
lists
2
.
id
>
0
).
select
(
orderby
=
db
.
lists
2
.
name
):
for
row
in
db
(
db
.
metrics2d
2
.
id
>
0
).
select
(
orderby
=
db
.
metrics2d
2
.
name
):
panel
=
selector_panel
panel
.
baseUrl
=
URL
(
"plugin_event"
,
"
gri
d"
)
panel
.
baseParams
=
{
"id_
list
"
:
row
.
id
}
panel
.
baseUrl
=
URL
(
"plugin_event"
,
"
metric2
d"
)
panel
.
baseParams
=
{
"id_
metric2d
"
:
row
.
id
}
add_child
(
row
.
name
,
panel
)
return
node
@
staticmethod
def
metric2d_node
(
db
,
T
,
selector_panel
):
"""To deal with two-dimension metrics.
def
people_object_node
(
db
,
T
):
"""To deal with people and objects.
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
Returns:
dbui.Node:
the configuration of a tree node.
"""
node
=
Node
(
T
(
"People and objects"
))
# NOTE
# Immediate translation is required by node.short_children
add_child
=
node
.
add_child
add_child
(
T
(
"people"
,
lazy
=
False
),
to_grid
(
db
.
people
))
add_child
(
T
(
"people_categories"
,
lazy
=
False
),
to_grid
(
db
.
people_categories
))
add_child
(
T
(
"objects"
,
lazy
=
False
),
to_grid
(
db
.
objects
))
add_child
(
T
(
"object_categories"
,
lazy
=
False
),
to_grid
(
db
.
object_categories
))
node
.
sort_children
()
return
node
@
staticmethod
def
source_node
(
db
,
T
,
selector_panel
):
"""To deal with sources.
Args:
db (pyDAL.DAL): database connection
...
...
@@ -259,16 +289,17 @@ class ViewportUi(object):
dbui.Node:
the configuration of a tree node.
"""
node
=
Node
(
T
(
"The
metrics 2d
"
))
node
=
Node
(
T
(
"The
sources
"
))
add_child
=
node
.
add_child
for
row
in
db
(
db
.
metrics2d2
.
id
>
0
).
select
(
orderby
=
db
.
metrics2d2
.
name
):
for
source
in
sorted
(
Event
.
get_sources
()
):
panel
=
selector_panel
panel
.
baseUrl
=
URL
(
"plugin_event"
,
"
metric2d
"
)
panel
.
baseParams
=
{
"
id_metric2d"
:
row
.
id
}
panel
.
baseUrl
=
URL
(
"plugin_event"
,
"
source
"
)
panel
.
baseParams
=
{
"
source"
:
source
}
add_child
(
row
.
nam
e
,
panel
)
add_child
(
sourc
e
,
panel
)
return
node
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