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

Redesign the documentation view using inline script and Ext.grid.Panel.

parent 17839e03
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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',
......
......@@ -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'))
......
<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>
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