Skip to content
Snippets Groups Projects
Commit 4f7a43b9 authored by Renaud Le Gac's avatar Renaud Le Gac
Browse files

Add logic to handle NodeURL:

- Modify the cfgsvc.get_configuration to return None
- Modify the model to run a simple report
- Modify the appviewport to handle the case of a panel with an url
- Modify the controller reports/report_1 to run with the current
  database definition
parent 2fb01893
No related branches found
No related tags found
No related merge requests found
......@@ -15,11 +15,11 @@ def report_1():
# Resolve foreign key
query = db.publications.id_collaborations == db.collaborations.id
query = (query) & (db.publications.id_publishers == db.publishers.id)
query = (query) & (db.publications.id_categories_aeres == db.categories_aeres.id)
query = (query) & (db.publications.id_categories == db.categories.id)
# publication with comite de lecture
query = (query) & (db.publications.conference_title == '')
query = (query) & ((db.categories_aeres.code == 'ACL') | (db.categories_aeres.code == 'ACLN'))
query = (query) & ((db.categories.code == 'ACL') | (db.categories.code == 'ACLN'))
# Interrogate the database
rows = db(query).select(db.publications.title,
......@@ -33,13 +33,6 @@ def report_1():
db.publications.first_page,
db.publications.last_page,
db.publications.conference_title,
db.categories_aeres.code)
db.categories.code)
return {'title': 'Rapport 1', 'publis': rows}
def report_2():
""" Test jsmath on a standalone page
"""
return {}
return {'title': 'Rapport 1', 'publis': rows}
\ No newline at end of file
......@@ -35,6 +35,7 @@
'Report': 'Rapport',
'Report Numbers': 'Numéro du rapport',
'Report type': 'Type du rapport',
'Reports': 'Rapports',
'Speaker': 'Orateur',
'Start date': 'Date de début',
'Table': 'Table',
......@@ -55,6 +56,7 @@
'projects': 'projets',
'publications': 'publications',
'publishers': 'éditeur',
'report_1': 'report_1',
'reports': 'rapports',
'select publication for a given year': 'selectionne les publication pour une année',
'select publications for a given CPPM author': 'selectionne les publications pour un auteur du CPPM',
......
......@@ -21,8 +21,13 @@ gridNode = dbui.NodeDB(T('Tables'),
tables=db.tables,
widget='xgrid')
reportNode = dbui.NodeURL(T('Reports'),
leaves=['report_1'],
urls=[URL(c="reports", f="report_1")],
widget='panel')
viewportModifier = dbui.ViewportModifier()
viewportModifier.add_node(formNode, gridNode)
viewportModifier.add_node(formNode, gridNode, reportNode)
#
# add plugin to all grids
......
......@@ -505,10 +505,12 @@ class CfgSvc(BaseSvc):
if xtype in ('form', 'xform'):
return self._get_form(tablename)
if xtype in ('grid', 'xgrid', 'xgridxithfilter'):
if xtype in ('grid', 'xgrid', 'xgridwithfilter'):
return self._get_grid(tablename)
return None
def get_jsonstore(self, tablename):
"""Build the configuration object for the Ext.data.DirectJsonStore
associated to the database table tablename.
......
......@@ -111,7 +111,7 @@ class NodeURL(NodeBase):
Name of the leaf appearing in the tree are translated.
"""
def __init__(self, text, leaves=[], url=[], widget='', hidden=[], widgets={}):
def __init__(self, text, leaves=[], urls=[], widget='', hidden=[], widgets={}):
T = current.T
......@@ -137,4 +137,4 @@ class NodeURL(NodeBase):
if leaf in widgets:
wdg = widgets[leaf]
self.add_children(refName=leaf, text=tr_leaf, url=url[i], widget=wdg)
\ No newline at end of file
self.add_children(refName=leaf, text=tr_leaf, url=urls[i], widget=wdg)
\ No newline at end of file
......@@ -96,7 +96,8 @@ App.Viewport = Ext.extend(Ext.Viewport, {
*/
onCreateTab: function(node, event){
var parent = node.parentNode,
var cfg,
parent = node.parentNode,
panel,
tabId,
refName = node.attributes.refName,
......@@ -105,6 +106,7 @@ App.Viewport = Ext.extend(Ext.Viewport, {
xtype = node.attributes.widget;
function addWidget(cfg, response) {
if (cfg === null) {return;}
wdg = Ext.ComponentMgr.create(cfg)
panel.add(wdg);
panel.doLayout();
......@@ -124,17 +126,28 @@ App.Viewport = Ext.extend(Ext.Viewport, {
return;
}
// create a new tab and activate it
// the title is defined as 'Form tablename' or 'Grid tablename'
panel = this.tabPanel.add({
// tab configuration
// the title is defined as 'Form tablename', 'Grid tablename', ...
// handle the simple case of panel pointing to an url
cfg = {
itemId: tabId,
closable: true,
title: parent.attributes.text + " " + node.attributes.text
});
};
if(xtype === 'panel' && node.attributes.url) {
cfg.autoLoad = node.attributes.url
}
// create a new tab and activate it
panel = this.tabPanel.add(cfg);
this.tabPanel.setActiveTab(tabId);
// add the widget in the newly created tab
Dbui.getConfiguration(refName, xtype, addWidget);
// for complex object like form and grid request their configuration
// to the server and add the corresponding widget in the newly
// created tab
if (xtype !== 'panel') {
Dbui.getConfiguration(refName, xtype, addWidget);
}
}
});
......@@ -3,7 +3,22 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>{{=title}}</title>
<!-- mathjax library -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
processEscapes: true
},
"HTML-CSS": { availableFonts: ["TeX"] }
});
</script>
<script type="text/javascript" src="/{{=request.application}}/static/plugin_mathjax/MathJax.js"></script>
</head>
<body>
<h2>Publications avec comité de lecture</h2>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment