Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
w2pext
plugin_dbui
Commits
23008829
Commit
23008829
authored
Nov 30, 2016
by
LE GAC Renaud
Browse files
Add configuration parameters to dbui for about, documentation and license.
parent
b55ea6a8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
337 additions
and
111 deletions
+337
-111
controllers/plugin_dbui.py
controllers/plugin_dbui.py
+17
-9
models/common_settings.py
models/common_settings.py
+10
-1
models/widgets_viewport.py
models/widgets_viewport.py
+2
-1
modules/plugin_dbui/dbui.py
modules/plugin_dbui/dbui.py
+127
-28
views/plugin_dbui/documentations_list.html
views/plugin_dbui/documentations_list.html
+181
-72
No files found.
controllers/plugin_dbui.py
View file @
23008829
...
...
@@ -184,20 +184,26 @@ def documentations_table():
trJS
=
T
(
"Javascript API"
)
trPy
=
T
(
"Python API"
)
# documentation of the application
apath
,
lpath
=
get_reference_paths
()
path_exists
=
lambda
x
:
x
and
os
.
path
.
exists
(
os
.
path
.
join
(
apath
,
x
))
f
=
lambda
x
:
x
.
replace
(
"static/"
,
""
)
# documentation of the application
userdoc
=
""
if
os
.
path
.
exists
(
os
.
path
.
join
(
apath
,
'static/docs/database.png'
)):
userdoc
=
a
%
(
URL
(
'static'
,
'docs/database.png'
),
T
(
"Data base scheme"
))
path_db_schema
=
plugin
.
app_db_schema
if
path_exists
(
path_db_schema
):
userdoc
=
a
%
(
URL
(
'static'
,
f
(
path_db_schema
)),
T
(
"Data base scheme"
))
pydoc
=
""
if
os
.
path
.
exists
(
os
.
path
.
join
(
apath
,
'static/docs/api/index.html'
)):
pydoc
=
a
%
(
URL
(
'static'
,
'docs/api/index.html'
),
trPy
)
path_html_api
=
plugin
.
app_html_api
if
path_exists
(
path_html_api
):
pydoc
=
a
%
(
URL
(
'static'
,
f
(
path_html_api
)),
trPy
)
jsdoc
=
""
if
os
.
path
.
exists
(
os
.
path
.
join
(
apath
,
'static/docs/jsduck/index.html'
)):
jsdoc
=
a
%
(
URL
(
'static'
,
'docs/jsduck/index.html'
),
trJS
)
path_html_jsduck
=
plugin
.
app_html_jsduck
if
path_exists
(
path_html_jsduck
):
jsdoc
=
a
%
(
URL
(
'static'
,
f
(
path_html_jsduck
)),
trJS
)
# configuration of the Ext.data.Store for the documentation
cfg
=
Store
()
...
...
@@ -291,10 +297,12 @@ def documentations_list():
/user
Returns:
empty dict.
dict:
the configuration of the plugin dbui
"""
return
dict
()
plugin
=
PluginManager
(
"dbui"
).
dbui
return
dict
(
plugin
=
plugin
)
def
index
():
...
...
models/common_settings.py
View file @
23008829
...
...
@@ -6,6 +6,7 @@ import plugin_dbui as dbui
from
callbacks
import
country_delete
,
country_insert
,
country_update
from
datetime
import
datetime
from
gluon.tools
import
PluginManager
#.............................................................................
#
...
...
@@ -24,10 +25,18 @@ T.lazy = False # immediate translation
plg_dbui
=
dbui
.
Dbui
plg_dbui
.
initialise_paths
(
app_about
=
"static/plugin_dbui/ABOUT.html"
,
# app_css=None,
# app_js=None,
app_db_schema
=
None
,
app_changelog
=
"static/plugin_dbui/CHANGELOG"
,
app_git
=
"https://gitlab.in2p3.fr/w2pext/plugin_dbui.git"
,
app_html_api
=
"static/plugin_dbui/docs/api/index.html"
,
app_html_jsduck
=
"static/plugin_dbui/docs/jsduck/index.html"
,
app_html_reference
=
"static/plugin_dbui/docs/reference/index.html"
,
app_html_user
=
None
,
# app_libmin=None,
app_pdf_api
=
"static/plugin_dbui/docs/pdf/dbui_api.pdf"
,
app_pdf_reference
=
"static/plugin_dbui/docs/pdf/dbui_reference.pdf"
,
app_script
=
"static/app.js"
,
app_script_dir
=
"static/scripts"
,
# dbui_libmin="static/plugin_dbui/dbui-debug.js"
...
...
models/widgets_viewport.py
View file @
23008829
...
...
@@ -59,11 +59,12 @@ gridNode.add_children(db.tables, func=to_grid)
# HELP
#
#-------------------------------------------------------------------------------
plugin
=
PluginManager
(
"dbui"
).
dbui
loader
=
dict
(
autoLoad
=
True
,
renderer
=
'html'
,
scripts
=
False
,
url
=
URL
(
'
plugin_dbui'
,
'about'
))
url
=
URL
(
'
static'
,
plugin
.
app_about
.
replace
(
"static/"
,
""
)
))
aboutLeaf
=
\
Panel
(
loader
=
loader
,
plugins
=
[
'pPanelLoaderException'
],
autoScroll
=
True
)
...
...
modules/plugin_dbui/dbui.py
View file @
23008829
...
...
@@ -12,23 +12,43 @@ from gluon.storage import Storage
from
gluon.tools
import
PluginManager
from
helper
import
get_language
myapp
=
current
.
request
.
application
defaults
=
Storage
(
# application
app_about
=
"static/ABOUT.html"
,
app_css
=
None
,
app_changelog
=
"static/CHANGELOG"
,
app_db_schema
=
"static/docs/database.png"
,
app_debug
=
None
,
app_git
=
None
,
app_lg
=
None
,
app_license
=
None
,
app_libmin
=
None
,
app_script
=
None
,
app_script_dir
=
None
,
app_html_api
=
"static/docs/api/index.html"
,
app_html_jsduck
=
"static/docs/jsduck/index.html"
,
app_html_user
=
"static/docs/user/index.html"
,
app_html_reference
=
"static/docs/reference/index.html"
,
app_pdf_api
=
"static/docs/pdf/%s_api.pdf"
%
myapp
,
app_pdf_reference
=
"static/docs/pdf/%s_reference.pdf"
%
myapp
,
app_pdf_user
=
"static/docs/pdf/%s_user.pdf"
%
myapp
,
# dbui URL
dbui_conf
=
"/%s/plugin_dbui/dbui_conf"
,
dbui_conf_debug
=
"/%s/plugin_dbui/dbui_conf?debug"
,
dbui_conf
=
"/%s/plugin_dbui/dbui_conf"
%
myapp
,
dbui_conf_debug
=
"/%s/plugin_dbui/dbui_conf?debug"
%
myapp
,
dbui_script
=
"static/plugin_dbui/main.js"
,
# dbui documentation and license
dbui_html_api
=
"static/plugin_dbui/docs/api/index.html"
,
dbui_html_jsduck
=
"static/plugin_dbui/docs/jsduck/index.html"
,
dbui_html_reference
=
"static/plugin_dbui/docs/reference/index.html"
,
dbui_license
=
"static/plugin_dbui/LICENCE_UK.html"
,
dbui_pdf_api
=
None
,
dbui_pdf_reference
=
None
,
# paths for plugins ace, dbui, extjs and mathjax
# Warning the order of the plugins matter
# since extjs has to be called before dbui
...
...
@@ -89,56 +109,136 @@ class Dbui(object):
Args:
app_about (str):
relative path to the ABOUT file,
*e.g.* ``static/ABOUT.html``.
app_css (str or list):
R
elative path to CSS files for the application,
r
elative path to CSS files for the application,
*e.g.* ``static/myapp/ressources/css``. Default is ``None``
app_changelog (str):
relative path to the CHANGELOG,
*e.g.* ``static/CHANGELOG``.
app_db_schema (str):
relative path to the database schema,
*e.g.* ``static/docs/database.png``.
app_debug (str or list):
R
elative path to the debug version for the application library,
r
elative path to the debug version for the application library,
*e.g.* ``static/myapp/src`` or ``static/myapp/myapp-debug.js``.
Default is ``None``
app_git (str):
T
he URL of the git repository for the application,
*e.g.* https://gitlab.in2p3.fr/w2pext/plugin_dbui.git
t
he URL of the git repository for the application,
*e.g.*
``
https://gitlab.in2p3.fr/w2pext/plugin_dbui.git
``
Default is ``None``.
app_lg(str or list):
R
elative path to languages files for the application,
*e.g.* static/myapp/locale/myapp-lang-fr.js.
r
elative path to languages files for the application,
*e.g.*
``
static/myapp/locale/myapp-lang-fr.js
``
.
Default is ``None``.
app_html_api (str):
relative path to the documentation for the python api,
*e.g.* ``static/docs/api/index.html``.
The format is HTML.
app_html_jsduck (str):
relative path to the documentation for the javascript api,
*e.g.* ``static/docs/jsduck/index.html``.
The format is HTML.
app_html_reference (str):
relative path to the documentation for developers,
*e.g.* ``static/docs/reference/index.html``.
The format is HTML.
app_html_user (str):
relative path to the documentation for users,
*e.g.* ``static/docs/user/index.html``.
The format is HTML.
app_libmin (str or list):
Relative path to the minified version for the application
library, *e.g.* static/myapp-min.js.
relative path to the minified version for the application
library, *e.g.* ``static/myapp-min.js``.
app_license (str):
relative path to the license for the application.
app_pdf_api (str):
relative path to the documentation for the python api,
*e.g.* ``static/docs/pdf/myapp_api.pdf``.
The format is PDF.
app_pdf_reference (str):
relative path to the documentation for developers,
*e.g.* ``static/docs/pdf/myapp_reference.pdf``.
The format is PDF.
app_pdf_user (str):
relative path to the documentation for user,
*e.g.* ``static/docs/pdf/myapp_user.pdf``.
The format is PDF.
app_script (str):
R
elative path to the main script to run the application,
*e.g.* static/myapp.js
r
elative path to the main script to run the application,
*e.g.*
``
static/myapp.js
``.
app_script_dir (str):
R
elative path to a directory containing a collection
of JavaScript, *e.g* static/scripts.
r
elative path to a directory containing a collection
of JavaScript, *e.g*
``
static/scripts
``
.
The script named *foo* can be run via the URL:
``https://myverver/myapp?script=foo``. The default is ``None``.
dbui_conf (str):
T
he ULR returning the configuration for the User Interface.
t
he ULR returning the configuration for the User Interface.
The default is ``/myapp/plugin_dbui/dbui_conf``,
dbui_conf_debug (str):
T
he URL returning the debug version of the configuration for
t
he URL returning the debug version of the configuration for
the User Interface. The default is
``/myapp/plugin_dbui/dbui_conf?debug``.
dbui_html_api (str):
relative path to the documentation for the python api.
*e.g.* ``static/plugin_dbui/docs/api/index.html``.
The format is HTML.
dbui_html_jsduck (str):
relative path to the documentation for the javascript api,
*e.g.* ``static/plugin_dbui/docs/jsduck/index.html``.
The format is HTML.
dbui_html_reference (str):
relative path to the documentation for developers,
*e.g.* ``static/plugin_dbui/docs/reference/index.html``.
The format is HTML.
dbui_license (str):
relative path to the license for the plugin dbui,
*e.g* ``static/plugin_dbui/LICENCE_UK.html``.
dbui_pdf_api (str):
relative path to the documentation for the python api,
*e.g.* ``static/plugin_dbui/docs/pdf/dbui_api.pdf``.
The format is PDF.
dbui_pdf_reference (str):
relative path to the documentation for developers,
*e.g.* ``static/plugin_dbui/docs/pdf/dbui_reference.pdf``.
The format is PDF.
dbui_script (str):
D
efault script to run the application:
``static/plugin_dbui/main.js``.
It is recommended to use
the option ``app_script``.
d
efault script to run the application:
``static/plugin_dbui/main.js``.
It is used when
the option ``app_script``
is not defined
.
plugins_paths (dict):
Key is the name of the plugin while value is a dictionary
with 4 keys:
contains paths defining javascript libraries for plugins.
The key is the name of the plugin while the value is a
dictionary with 4 keys:
* css (str or list or None):
relative path to CSS files for plugin:
...
...
@@ -157,7 +257,12 @@ class Dbui(object):
library: ``static/plugin_key/locale/key-lang-fr.js``.
By default, plugins *ace*, *dbui*, *extjs* and *mathjax* are
configure. It is possible to add others plugins.
configure.
Note:
It is possible to register others plugins by adding them
to the plugins_paths dictionary. There libraries will be
laod properly by the controller ``plugin_dbui/index``.
"""
...
...
@@ -177,12 +282,6 @@ class Dbui(object):
paths_extjs
=
plugins_paths
[
"extjs"
]
paths_extjs
[
"lg"
]
=
paths_extjs
[
"lg"
]
%
lg
# update values depending on the application
application
=
current
.
request
.
application
plugin
.
dbui_conf
=
plugin
.
dbui_conf
%
application
plugin
.
dbui_conf_debug
=
plugin
.
dbui_conf_debug
%
application
@
staticmethod
def
initialise_ui
():
"""Initialise persistent storage for the plugin dbui.
...
...
views/plugin_dbui/documentations_list.html
View file @
23008829
{{
import os
from plugin_dbui import get_reference_paths
# alias
apath, lpath = get_reference_paths()
myapp = request.application
path_exists = lambda x: x and os.path.exists(os.path.join(apath, x))
f = lambda x: x.replace("static/", "")
rwrite = response.write
}}
<h2
class=
"dbui-h2 dbui-small-cap"
>
{{=T("Documentations")}}
</h2>
<p
class=
"dbui-p dbui-small-cap"
style=
"margin-top: 5ex"
>
1. {{=T("For users")}}
</p>
<ul>
<li
class=
"dbui-p"
>
{{=T("User guides")}} (
<a
href=
"/{{=request.application}}/static/docs/user/index.html"
target=
"_blank"
>
html
</a>
,
<a
href=
"/{{=request.application}}/static/docs/pdf/{{=request.application}}_user.pdf"
target=
"_blank"
>
pdf
</a>
)
</li>
<li
class=
"dbui-p"
>
<a
href=
"/{{=request.application}}/static/docs/database.png"
target=
"_blank"
>
{{=T("Database schema")}}
</a>
</li>
<li
class=
"dbui-p"
>
<a
href=
"/{{=request.application}}/static/CHANGELOG"
target=
"_blank"
>
Change Log
</a>
</li>
{{
#.....................................................................
#
# user guide
#
a1, a2 = None, None
path_html_user = plugin.app_html_user
if path_exists(path_html_user):
a1 = A("html",
callback=URL("static", f(path_html_user)),
_target="_blank")
pass
path_pdf_user = plugin.app_pdf_user
if path_exists(path_pdf_user):
a2 = A("pdf",
callback=URL("static", f(path_pdf_user)),
_target="_blank")
pass
if a1 is not None and a2 is not None:
rwrite(LI(T("User guides)", "(", a1, a2, ")", _class="dbui-p")))
elif a1 is not None:
rwrite(LI(T("User guides)", "(", a1, ")", _class="dbui-p")))
pass
#.....................................................................
#
# database schema
#
path_db_schema = plugin.app_db_schema
if path_exists(path_db_schema):
a = A(T("Database schema"),
callback=URL("static", f(path_db_schema)),
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
pass
#.....................................................................
#
# changelog
#
path_changelog = plugin.app_changelog
if path_exists(path_changelog):
a = A("CHANGELOG",
callback=URL("static", f(path_changelog)),
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
pass
}}
</ul>
...
...
@@ -32,62 +83,120 @@
2. {{=T("For developpers")}}
</p>
<ul>
<li
class=
"dbui-p"
>
<a
href=
"/{{=request.application}}/static/docs/api/index.html"
target=
"_blank"
>
{{=request.application}} python API
</a>
</li>
<li
class=
"dbui-p"
>
<a
href=
"/{{=request.application}}/static/docs/jsduck/index.html"
target=
"_blank"
>
{{=request.application}} javascript API
</a>
</li>
{{
#.....................................................................
#
# Python API
#
path_html_api = plugin.app_html_api
if path_exists(path_html_api):
a = A("%s Python API" % myapp,
callback=URL("static", f(path_html_api)),
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
pass
#.....................................................................
#
# JavaScript API
#
path_html_jsduck = plugin.app_html_jsduck
if path_exists(path_html_jsduck):
a = A("%s JavaScript API" % myapp,
callback=URL("static", f(path_html_jsduck)),
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
pass
}}
</ul>
<ul>
<li
class=
"dbui-p"
>
<a
href=
"https://marprod.in2p3.fr/plugin_dbui_book"
target=
"_blank"
>
plugin_dbui reference manual
</a>
</li>
<li
class=
"dbui-p"
>
<a
href=
"/{{=request.application}}/static/plugin_dbui/docs/api/index.html"
target=
"_blank"
>
plugin_dbui python API
</a>
</li>
<li
class=
"dbui-p"
>
<a
href=
"/{{=request.application}}/static/plugin_dbui/docs/jsduck/index.html"
target=
"_blank"
>
plugin_dbui javascript API
</a>
</li>
{{
#.....................................................................
#
# dbui reference manual (python)
#
a = A("plugin_dbui reference manual",
_href="https://marprod.in2p3.fr/plugin_dbui_book",
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
#.....................................................................
#
# dbui python api
#
path_dbui_api = plugin.dbui_html_api
if path_exists(path_dbui_api):
a = A("plugin_dbui Python API",
callback=URL("static", f(path_dbui_api)),
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
pass
#.....................................................................
#
# dbui JavaScript api
#
path_dbui_jsduck = plugin.dbui_html_jsduck
if path_exists(path_dbui_jsduck):
a = A("plugin_dbui JavaScript API",
callback=URL("static", f(path_dbui_jsduck)),
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
pass
}}
</ul>
<ul>
<li
class=
"dbui-p"
>
<a
href=
"http://web2py.com/book"
target=
"_blank"
>
Web2py reference manual
</a>
</li>
<li
class=
"dbui-p"
>
<a
href=
"http://docs.sencha.com/extjs/6.2.0/classic/Ext.html"
target=
"_blank"
>
Ext JS 6.2.0 javasript API
</a>
</li>
<li
class=
"dbui-p"
>
<a
href=
"http://pandas.pydata.org/pandas-docs/stable/"
target=
"_blank"
>
Pandas data analysis toolkit
</a>
</li>
{{
#.....................................................................
#
# web2py reference manual (Python)
#
a = A("Web2py reference manual",
_href="http://web2py.com/book",
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
#.....................................................................
#
# ExtJS API (JavaScript)
#
a = A("Ext JS 6.2.0 JavaScript API",
_href="http://docs.sencha.com/extjs/6.2.0/classic/Ext.html",
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
#.....................................................................
#
# Pandas (Python)
#
a = A("Pandas data analysis toolkit",
_href="http://pandas.pydata.org/pandas-docs/stable/",
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
}}
</ul>
<ul>
{{
#.....................................................................
#
# Sphinx (Python)
#
a = A("Sphinx documentation generator",
_href="http://sphinx-doc.org/",
_target="_blank")
<li
class=
"dbui-p"
>
<a
href=
"http://sphinx-doc.org/"
target=
"_blank"
>
Sphinx documentation generator
</a>
</li>
rwrite(LI(a, _class="dbui-p"))
}}
</ul>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment