diff --git a/controllers/plugin_dbui.py b/controllers/plugin_dbui.py index bd6dd8387fc9c2e06ecd723015e04c43a310c0a6..7d8d20686ff85de015206cdccf24895207d8fc7f 100644 --- a/controllers/plugin_dbui.py +++ b/controllers/plugin_dbui.py @@ -291,5 +291,16 @@ def versions(): """Return the versions of the different part of the code. """ + import json 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)) diff --git a/languages/fr-fr.py b/languages/fr-fr.py index 19d25af439be0cd8cdd21cc44547998cf37d2828..6c7270f4f25f89149722e9953c8c306f9c4a0a95 100644 --- a/languages/fr-fr.py +++ b/languages/fr-fr.py @@ -102,6 +102,7 @@ '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...': 'sélectionner...', +'Software versions': 'Versions des logiciels', 'Speaker': 'Orateur', 'Start date': 'Date de début', 'Store': 'Store', @@ -118,8 +119,8 @@ 'undefined': 'indéfini', 'unknown': 'unknown', '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', 'versions': 'versions', 'Volume': 'Volume', 'year': 'année', diff --git a/models/widgets_viewport.py b/models/widgets_viewport.py index cfcc93936d0b88d74a354a6142b268c8ea74e970..a7c53d8d020228ad94357ea12391b3a819c29dfd 100644 --- a/models/widgets_viewport.py +++ b/models/widgets_viewport.py @@ -50,6 +50,7 @@ gridNode.add_children(db.tables, func=to_grid) loader = dict(ajaxOptions=dict(disableCaching=False), autoLoad=True, renderer='html', + scripts=True, url=URL('plugin_dbui', 'versions')) aboutLeaf = Panel(autoLoad=URL('plugin_dbui', 'about'), autoScroll=True) diff --git a/modules/plugin_dbui/helper.py b/modules/plugin_dbui/helper.py index 537dafc891d87e719bc47ac3472d005923e142b2..05998987fa2e8201bcb92caa3962fda05e08e935 100644 --- a/modules/plugin_dbui/helper.py +++ b/modules/plugin_dbui/helper.py @@ -545,14 +545,9 @@ def get_store_id(name): def get_versions(): """Get the versions of the application and plugins. - @rtype: dict - @return: - - C{ace} the version of the plugin ace - - 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 + @rtype: list of tuple + @return: each tuple contains the name of the software + and its version identifier. """ server_path, client_path = get_reference_paths() @@ -633,12 +628,15 @@ def get_versions(): os.chdir(ref_path) - return dict(ace=ace, - dbui=dbui, - extjs=extjs, - mathjax=mathjax, - myapp=myapp, - web2py=web2py) + # prepare the output + li = [("web2py", web2py), + ("dbui", dbui), + ("extjs", extjs), + ("mathjax", mathjax), + ("ace", ace), + (current.request.application, myapp)] + + return li def get_where_query(table): diff --git a/static/plugin_dbui/CHANGELOG b/static/plugin_dbui/CHANGELOG index 34f0e1be25cf0fc82f87ba0e3862ae7b4160b410..0abca4b10b939f1f5e28735432db51dc4d45f75b 100644 --- a/static/plugin_dbui/CHANGELOG +++ b/static/plugin_dbui/CHANGELOG @@ -2,6 +2,9 @@ HEAD + - Use inline script and Ext.grid.Panel to display software versions. + - Migrate to HTML5 sysntax. + 0.6.1.6 (Jul 2014) - Add protection to avoid Direct transaction with null TableId identifier It happens from time to time when the proxy is not yet ready. diff --git a/views/plugin_dbui/versions.html b/views/plugin_dbui/versions.html index e58be39b02c3668f67400792a8526043c5477fa9..8a61bb619a29e4c784bbb8f39a5e989aa0bf4875 100644 --- a/views/plugin_dbui/versions.html +++ b/views/plugin_dbui/versions.html @@ -1,14 +1,66 @@ {{ - title = 'Software versions' - response.write(P(title, _class="dbui-p dbui-small-cap dbui-large")) - - table = TABLE(TR(TD("web2py", _class="dbui-td"), TD(web2py, _class="dbui-td")), - TR(TD("dbui", _class="dbui-td"), TD(dbui, _class="dbui-td")), - TR(TD("extjs", _class="dbui-td"), TD(extjs, _class="dbui-td")), - TR(TD("mathjax", _class="dbui-td"), TD(mathjax, _class="dbui-td")), - TR(TD("ace", _class="dbui-td"), TD(ace, _class="dbui-td")), - TR(TD(request.application, _class="dbui-td"), TD(myapp, _class="dbui-td")), - _style="margin-left:6%") - - response.write(P(table)) -}} \ No newline at end of file + #-------------------------------------------------------------------------- + # + # The python controller return cfg_store, the configuration of + # the Ext.data.Array + # + # prepare the data + # - build unique DIV identifier + # - Title and DIV block + # + #-------------------------------------------------------------------------- + + # + # unique identifier for the DIV block associated to the grid + # + 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>