diff --git a/controllers/plugin_dbui.py b/controllers/plugin_dbui.py index 7d8d20686ff85de015206cdccf24895207d8fc7f..e022f9304f24ba8497332b914f06c2305eaa0079 100644 --- a/controllers/plugin_dbui.py +++ b/controllers/plugin_dbui.py @@ -10,6 +10,7 @@ """ +import json import os @@ -217,16 +218,91 @@ def debug(): def documentations(): - di = {} + """Return the Ext.data.Array configuration for the documentation + and for the source code. + + """ + from plugin_dbui import get_reference_paths + + # alias + a = '<a href="%s" target="_blank">%s</a>' + + trDev = T("Documentation for developers") + trJS = T("Javascript API") + trPy = T("Python API") + + # documentation of the application + apath, lpath = get_reference_paths() + + userdoc = "" + if os.path.exists(os.path.join(apath, 'static/docs/database.png')): + userdoc = a % (URL('static', 'docs/database.png'), T("Data base scheme")) + + pydoc = "" + if os.path.exists(os.path.join(apath, 'static/docs/epydoc/index.html')): + pydoc = a % (URL('static', 'docs/epydoc/index.html'), trPy) + + jsdoc = "" + if os.path.exists(os.path.join(apath, 'static/docs/jsduck/index.html')): + jsdoc = a % (URL('static', 'docs/jsduck/index.html'), trJS) + + # configuration of the Ext.data.Array for the documentation + cfg = dict() + + cfg['fields'] = [{'name': 'code', 'type': 'string'}, + {'name': 'developer', 'type': 'string'}, + {'name': 'python', 'type': 'string'}, + {'name': 'javascript', 'type': 'string'}] + + r1 = (request.application, userdoc, pydoc, jsdoc) + + r2 = (a % ("https://marprod.in2p3.fr/plugin_dbui_book", "plugin_dbui"), + a % ("https://marprod.in2p3.fr/plugin_dbui_book/default/chapter/29", trDev), + a % (URL('static', 'plugin_dbui/docs/epydoc/index.html'), trPy), + a % (URL('static', 'plugin_dbui/docs/jsduck/index.html'), trJS)) + + r3 = (a % ("http://web2py.com/", "Web2py"), + a % ("http://web2py.com/book", trDev), + a % ("http://www.web2py.com/examples/static/epydoc/index.html", trPy), + "") + + r4 = (a % ("http://www.sencha.com/products/extjs/", "Ext JS"), + "", + "", + a % ("http://docs.sencha.com/extjs/4.2.1/", trJS)) + + r5 = (a % ("http://www.mathjax.org/", "MathJax"), + "", + "", + a % ("http://docs.mathjax.org/", trJS)) + + r6 = (a % ("http://ace.c9.io/#nav=about", "Ace"), + "", + "", + a % ("http://ace.c9.io/#nav=api", trJS)) + + cfg['data'] = [r1, r2, r3, r4, r5, r6] + + cfg_doc = json.dumps(cfg) + + # configuration of the Ext.data.Array for the source code + cfg = dict() + cfg['fields'] = [{'name': 'code', 'type': 'string'}, + {'name': 'source', 'type': 'string'}] - di["app"] = request.application - di["app_name"] = request.application.replace('_', ' ') - di["epydoc_dbui"] = URL('static', 'plugin_dbui/docs/epydoc/index.html') - di["epydoc_application"] = URL('static', 'docs/epydoc/index.html') - di["jsduck_dbui"] = URL('static', 'plugin_dbui/docs/jsduck/index.html') - di["png_db"] = URL('static', 'docs/database.png') + r1 = (request.application, "<em>git clone http://marwww.in2p3.fr/~legac/wap/git/%s.git</em>" % request.application) + r2 = ("plugin_dbui", "<em>git clone http://marwww.in2p3.fr/~legac/wap/git/web2py_plugin_dbui.git</em>") + r3 = ("Web2py", "<em>git clone git://github.com/web2py/web2py.git</em>") + r4 = ("Ext JS", + "<em>Download from the Ext JS web site.</em><br>" + "<em>In the local directory: %s/static/plugin_extjs/src</em>" % request.application) + r5 = ("MathJax", "<em>git clone http://github.com/mathjax/MathJax</em>") + r6 = ("Ace", "<em>git clone git://github.com/ajaxorg/ace.git</em>") + + cfg['data'] = [r1, r2, r3, r4, r5, r6] + cfg_src = json.dumps(cfg) - return di + return dict(cfg_doc=cfg_doc, cfg_src=cfg_src) def index(): @@ -291,7 +367,6 @@ def versions(): """Return the versions of the different part of the code. """ - import json from plugin_dbui import get_versions # the configuration for the Ext.data.ArrayStore diff --git a/languages/fr-fr.py b/languages/fr-fr.py index 6c7270f4f25f89149722e9953c8c306f9c4a0a95..573df569ad3aac9a73d1403a65c8e10b810ee0b8 100644 --- a/languages/fr-fr.py +++ b/languages/fr-fr.py @@ -19,10 +19,12 @@ 'Controller': 'Controller', 'countries': 'pays', 'Country': 'Pays', +'Data base scheme': 'Schéma de la base de données', 'Dates': 'Dates', 'Definition': 'Définition', 'dev': 'dev', 'Dictionary': 'Dictionary', +'Documentation for developers': 'Documentation pour développeurs', 'documentations': 'documentations', 'Doi': 'Doi', 'domain': 'domaine', @@ -56,6 +58,7 @@ 'Id': 'Id', 'install': 'installé', 'invalid json': 'invalid json', +'Javascript API': 'Javascript API', 'Json': 'Json', 'Last Page': 'Dernière Page', 'List': 'List', @@ -81,6 +84,7 @@ 'publications': 'publications', 'Publisher': 'Éditeur', 'publishers': 'éditeur', +'Python API': 'Python API', 'Python Code': 'Python Code', 'Ratio': 'Ratio', 'Report': 'Rapport', diff --git a/models/widgets_viewport.py b/models/widgets_viewport.py index a7c53d8d020228ad94357ea12391b3a819c29dfd..59d5df857c16c1461a0428800b8f3683e750e8b0 100644 --- a/models/widgets_viewport.py +++ b/models/widgets_viewport.py @@ -47,14 +47,21 @@ gridNode.add_children(db.tables, func=to_grid) # HELP # #------------------------------------------------------------------------------- -loader = dict(ajaxOptions=dict(disableCaching=False), - autoLoad=True, + +aboutLeaf = Panel(autoLoad=URL('plugin_dbui', 'about'), autoScroll=True) + +loader = dict(autoLoad=True, + renderer='html', + scripts=True, + url=URL('plugin_dbui', 'documentations')) + +docLeaf = Panel(loader=loader, plugins=['pPanelLoaderException'], autoScroll=True) + +loader = dict(autoLoad=True, renderer='html', scripts=True, url=URL('plugin_dbui', 'versions')) -aboutLeaf = Panel(autoLoad=URL('plugin_dbui', 'about'), autoScroll=True) -docLeaf = Panel(autoLoad=URL('plugin_dbui', 'documentations'), autoScroll=True) versionLeaf = Panel(loader=loader, plugins=['pPanelLoaderException']) helpNode = Node(T('Help')) diff --git a/views/plugin_dbui/documentations.html b/views/plugin_dbui/documentations.html index ef7b1514f84c3eb9e4f7b019a278a00d8be6f58c..de14e2cf3b26b98c461d0a01031da647385d2ae5 100644 --- a/views/plugin_dbui/documentations.html +++ b/views/plugin_dbui/documentations.html @@ -1,179 +1,97 @@ -<html> -<head> - <meta charset="UTF-8"> -</head> -<body> -<h2 class="dbui-h2 dbui-small-cap">Documentations</h2> +{{ + #-------------------------------------------------------------------------- + # + # The python controller return cfg_doc, and cfg_src the configuration for + # the Ext.data.Array + # + # - build unique DIV identifier + # + #-------------------------------------------------------------------------- + + # + # unique identifier for the DIV block associated to the grid + # + divdoc = id(cfg_doc) + divsrc = id(cfg_src) -<table border="0" style="margin-left: 6%"> - <tr> - <td class="dbui-td"> - {{=app_name}} - </td> - <td class="dbui-td"> - <a href="{{=png_db}}" target="_blank"> - Schéma de la base de données - </a> - </td> - <td class="dbui-td"> - <a href="{{=epydoc_application}}" target="_blank"> - python API - </a> - </td> - <td class="dbui-td"></td> - </tr> - <tr> - <td class="dbui-td"> - <a href="https://marprod.in2p3.fr/plugin_dbui_book" target="_blank"> - plugin dbui - </a> - </td> - <td class="dbui-td"> - <a href="https://marprod.in2p3.fr/plugin_dbui_book/default/chapter/29" target="_blank"> - documentation développeurs - </a> - </td> - <td class="dbui-td"> - <a href="{{=epydoc_dbui}}" target="_blank"> - python API - </a> - </td> - <td class="dbui-td"> - <a href="{{=jsduck_dbui}}" target="_blank"> - javascript API - </a> - </td> - </tr> - <tr> - <td class="dbui-td"> - <a href="http://web2py.com/" target="_blank"> - Web2py - </a> - </td> - <td class="dbui-td"> - <a href="http://web2py.com/book" target="_blank"> - documentation développeurs - </a> - </td> - <td class="dbui-td"> - <a href="http://www.web2py.com/examples/static/epydoc/index.html" target="_blank"> - python API - </a> - </td> - <td class="dbui-td"></td> - </tr> - <tr> - <td class="dbui-td"> - <a href="http://www.sencha.com/products/extjs/" target="_blank"> - Ext JS - </a> - </td> - <td class="dbui-td"></td> - <td class="dbui-td"></td> - <td class="dbui-td"> - <a href="http://docs.sencha.com/extjs/4.2.1/" target="_blank"> - javascript API - </a> - </td> - </tr> - <tr> - <td class="dbui-td"> - <a href="http://www.mathjax.org/" target="_blank"> - MathJax - </a> - </td> - <td class="dbui-td"></td> - <td class="dbui-td"></td> - <td class="dbui-td"> - <a href="http://docs.mathjax.org/" target="_blank"> - Javascript API - </a> - </td> - </tr> - <tr> - <td class="dbui-td"> - <a href="http://ace.c9.io/#nav=about" target="_blank"> - Ace - </a> - </td> - <td class="dbui-td"></td> - <td class="dbui-td"></td> - <td class="dbui-td"> - <a href="http://ace.c9.io/#nav=api" target="_blank"> - Javascript API - </a> - </td> - </tr> -</table> +}} +<h2 class="dbui-h2 dbui-small-cap">Documentations</h2> +<div id="grid-{{=divdoc}}"></div> <h2 class="dbui-h2 dbui-small-cap">Code source</h2> +<div id="grid-{{=divsrc}}"></div> -<table border="0" style="margin-left: 6%"> - <tr> - <td class="dbui-td"> - {{=app_name}} - </td> - <td class="dbui-td"> - <em>git clone http://marwww.in2p3.fr/~legac/wap/git/{{=app}}.git</em> - </td> - </tr> - <tr> - <td class="dbui-td"> - plugin dbui - </td> - <td class="dbui-td"> - <em>git clone http://marwww.in2p3.fr/~legac/wap/git/web2py_plugin_dbui.git</em> - </td> - </tr> - <tr> - <td class="dbui-td"> - Web2py - </td> - <td class="dbui-td"> - <em>git clone git://github.com/web2py/web2py.git</em> - </td> - </tr> - <tr> - <td class="dbui-td"> - Ext JS - </td> - <td class="dbui-td"> - A télécharger à partir de leur site web.<br> - Disponible dans le répertoire - <em>{{=app}}/static/plugin_extjs/src</em> - </td> - </tr> - <tr> - <td class="dbui-td"> - MathJax - </td> - <td class="dbui-td"> - <em>git clone http://github.com/mathjax/MathJax</em> - </td> - </tr> - <tr> - <td class="dbui-td"> - Ace - </td> - <td class="dbui-td"> - <em>git clone git://github.com/ajaxorg/ace.git</em> - </td> - </tr> -</table> <h2 class="dbui-h2 dbui-small-cap">Binnaires pour web2py</h2> -<p class="dbui-p"> -Les logiciels tierce -<span class="dbui-small-cap">ACE</span>, -<span class="dbui-small-cap">Ext JS</span>, -<span class="dbui-small-cap">MathJax</span>, -<span class="dbui-small-cap">Plugin dbui</span>, -sont construits sous la forme de plugins qui peuvent être chargés dans -le serveur webpy. -Des versions cohérentes sont disponible en utilisant -le gestionnaire de version <a href="http://git-scm.com/" target="_blank">git</a> : -<em>git clone http://marwww.in2p3.fr/~legac/wap/git/plugin_dbui_build.git</em>. -</p> +<div style="width: 570px; padding: 0 20 0 20;"> + <p class="dbui-p"> + Les logiciels tierce + <span class="dbui-small-cap">ACE</span>, + <span class="dbui-small-cap">Ext JS</span>, + <span class="dbui-small-cap">MathJax</span>, + <span class="dbui-small-cap">Plugin dbui</span>, + sont construits sous la forme de plugins qui peuvent être chargés dans + le serveur webpy. + + Des versions cohérentes sont disponible en utilisant + le gestionnaire de version <a href="http://git-scm.com/" target="_blank">git</a> : + <em>git clone http://marwww.in2p3.fr/~legac/wap/git/plugin_dbui_build.git</em>. + </p> +</div> +<script> + + /** + * Inline javascript to instantiate and render the Ext JS grids + * + */ + + // + // 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 cfgDoc = %s," % cfg_doc) + write(" cfgSrc = %s;" % cfg_src) + + }} + + // + // instantiate the grids for the documentation + // + var grid = Ext.create('Ext.grid.Panel', { + store: Ext.create('Ext.data.ArrayStore', cfgDoc), + columns: [ + {text: "code", dataIndex: 'code', width:80}, + {text: "developer", dataIndex: 'developer', flex: 1.8}, + {text: "python", dataIndex: 'python', flex: 1}, + {text: "javascript", dataIndex: 'javascript', flex: 1} + ], + forceFit: true, + hideHeaders: true, + padding: "0 40 0 40", + width: 570, + renderTo: 'grid-{{=divdoc}}' + }); + + // + // instantiate the grids for source code + // + var grid = Ext.create('Ext.grid.Panel', { + store: Ext.create('Ext.data.ArrayStore', cfgSrc), + columns: [ + {text: "code", dataIndex: 'code', width: 80}, + {text: "source", dataIndex: 'source', flex: 2} + ], + forceFit: true, + hideHeaders: true, + padding: "0 40 0 40", + width: 570, + renderTo: 'grid-{{=divsrc}}' + }); -</body> +</script>