Skip to content
Snippets Groups Projects
Commit 17839e03 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Redesing the version view using inline script and Ext.grid.Panel.

parent 30c26fba
No related branches found
No related tags found
No related merge requests found
...@@ -291,5 +291,16 @@ def versions(): ...@@ -291,5 +291,16 @@ def versions():
"""Return the versions of the different part of the code. """Return the versions of the different part of the code.
""" """
import json
from plugin_dbui import get_versions from plugin_dbui import get_versions
return get_versions()
# the configuration for the Ext.data.ArrayStore
cfg = dict()
cfg['fields'] = [{'name': 'code', 'type': 'string'},
{'name': 'version', 'type': 'string'}]
cfg['data'] = get_versions()
return dict(cfg_store=json.dumps(cfg))
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
'select publications with a given AERES code': 'selectionne les publications avec un code AERES', 'select publications with a given AERES code': 'selectionne les publications avec un code AERES',
'select publications with a given category code': 'select publications with a given category code', 'select publications with a given category code': 'select publications with a given category code',
'select...': 'sélectionner...', 'select...': 'sélectionner...',
'Software versions': 'Versions des logiciels',
'Speaker': 'Orateur', 'Speaker': 'Orateur',
'Start date': 'Date de début', 'Start date': 'Date de début',
'Store': 'Store', 'Store': 'Store',
...@@ -118,8 +119,8 @@ ...@@ -118,8 +119,8 @@
'undefined': 'indéfini', 'undefined': 'indéfini',
'unknown': 'unknown', 'unknown': 'unknown',
'url': 'url', 'url': 'url',
'value already in database or empty': 'La valeur existe dans la base de données ou est nulle',
'Value already in database or empty': 'La valeur existe dans la base de données ou est nulle', 'Value already in database or empty': 'La valeur existe dans la base de données ou est nulle',
'value already in database or empty': 'La valeur existe dans la base de données ou est nulle',
'versions': 'versions', 'versions': 'versions',
'Volume': 'Volume', 'Volume': 'Volume',
'year': 'année', 'year': 'année',
......
...@@ -50,6 +50,7 @@ gridNode.add_children(db.tables, func=to_grid) ...@@ -50,6 +50,7 @@ gridNode.add_children(db.tables, func=to_grid)
loader = dict(ajaxOptions=dict(disableCaching=False), loader = dict(ajaxOptions=dict(disableCaching=False),
autoLoad=True, autoLoad=True,
renderer='html', renderer='html',
scripts=True,
url=URL('plugin_dbui', 'versions')) url=URL('plugin_dbui', 'versions'))
aboutLeaf = Panel(autoLoad=URL('plugin_dbui', 'about'), autoScroll=True) aboutLeaf = Panel(autoLoad=URL('plugin_dbui', 'about'), autoScroll=True)
......
...@@ -545,14 +545,9 @@ def get_store_id(name): ...@@ -545,14 +545,9 @@ def get_store_id(name):
def get_versions(): def get_versions():
"""Get the versions of the application and plugins. """Get the versions of the application and plugins.
@rtype: dict @rtype: list of tuple
@return: @return: each tuple contains the name of the software
- C{ace} the version of the plugin ace and its version identifier.
- C{dbui} the version of the plugin dbui
- C{extjs} the version of the plugin extjs
- C{mathjax} the version of the plugin mathjax
- C{web2py} the version of the framework web2oy
- C{myapp} the version of my application
""" """
server_path, client_path = get_reference_paths() server_path, client_path = get_reference_paths()
...@@ -633,12 +628,15 @@ def get_versions(): ...@@ -633,12 +628,15 @@ def get_versions():
os.chdir(ref_path) os.chdir(ref_path)
return dict(ace=ace, # prepare the output
dbui=dbui, li = [("web2py", web2py),
extjs=extjs, ("dbui", dbui),
mathjax=mathjax, ("extjs", extjs),
myapp=myapp, ("mathjax", mathjax),
web2py=web2py) ("ace", ace),
(current.request.application, myapp)]
return li
def get_where_query(table): def get_where_query(table):
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
HEAD HEAD
- Use inline script and Ext.grid.Panel to display software versions.
- Migrate to HTML5 sysntax.
0.6.1.6 (Jul 2014) 0.6.1.6 (Jul 2014)
- Add protection to avoid Direct transaction with null TableId identifier - Add protection to avoid Direct transaction with null TableId identifier
It happens from time to time when the proxy is not yet ready. It happens from time to time when the proxy is not yet ready.
......
{{ {{
title = 'Software versions' #--------------------------------------------------------------------------
response.write(P(title, _class="dbui-p dbui-small-cap dbui-large")) #
# The python controller return cfg_store, the configuration of
table = TABLE(TR(TD("web2py", _class="dbui-td"), TD(web2py, _class="dbui-td")), # the Ext.data.Array
TR(TD("dbui", _class="dbui-td"), TD(dbui, _class="dbui-td")), #
TR(TD("extjs", _class="dbui-td"), TD(extjs, _class="dbui-td")), # prepare the data
TR(TD("mathjax", _class="dbui-td"), TD(mathjax, _class="dbui-td")), # - build unique DIV identifier
TR(TD("ace", _class="dbui-td"), TD(ace, _class="dbui-td")), # - Title and DIV block
TR(TD(request.application, _class="dbui-td"), TD(myapp, _class="dbui-td")), #
_style="margin-left:6%") #--------------------------------------------------------------------------
response.write(P(table)) #
}} # unique identifier for the DIV block associated to the grid
\ No newline at end of file #
divgrid = abs(hash(cfg_store))
#
# The title and the DIV block
#
style = ["font-size: 12px;",
"font-variant: small-caps;",
"margin-left: 20px;",
"margin-bottom: 1ex;",
"margin-top: 2ex;"]
response.write(P(T("Software versions"), _style="".join(style)))
response.write(DIV(_id="grid-%s" % divgrid))
}}
<script>
/**
* Inline javascript to instantiate and render the Ext JS grid
*
*/
//
// bind the python and javascript variables
// use the internationalization of web2py to translate grid header
// MANDATORY: escape false to convert properly the quotes
//
{{
def write(value):
return response.write("\n%s" % value, escape=False)
write("var cfgStore = %s;" % cfg_store)
}}
//
// instantiate the grids
//
var grid = Ext.create('Ext.grid.Panel', {
store: Ext.create('Ext.data.ArrayStore', cfgStore),
columns: [
{text: "Software", dataIndex: 'code', flex: 0.8},
{text: "Version", dataIndex: 'version', flex: 1.2}
],
forceFit: true,
hideHeaders: true,
padding: "10 40 20 60",
renderTo: 'grid-{{=divgrid}}',
width: 300
});
</script>
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