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
245cc93a
Commit
245cc93a
authored
Nov 23, 2016
by
LE GAC Renaud
Browse files
Add the method Dbui.start_directSvc and remove models/plugin_dbui.py which not needed any more.
parent
c23a298e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
79 deletions
+85
-79
models/common_settings.py
models/common_settings.py
+2
-0
models/plugin_dbui.py
models/plugin_dbui.py
+0
-52
modules/plugin_dbui/dbui.py
modules/plugin_dbui/dbui.py
+83
-27
No files found.
models/common_settings.py
View file @
245cc93a
...
...
@@ -31,6 +31,8 @@ dbui.Dbui.initialise(
# dbui_libmin="static/plugin_dbui/dbui-debug.js"
)
directSvc
=
dbui
.
Dbui
.
start_directSvc
()
#.............................................................................
#
# CONSTANTS
...
...
models/plugin_dbui.py
deleted
100644 → 0
View file @
c23a298e
""" plugin_dbui
Initialize the plugin_dbui
Define persistent storage, main services
and methods available on the client side.
"""
import
plugin_dbui
as
dbui
# Start common services
dbSvc
=
dbui
.
DbSvc
()
directSvc
=
dbui
.
DirectSvc
()
# activate the debug mode
# this session variable is set by the control index or debug
dbSvc
.
debug
=
session
.
debug
directSvc
.
debug
=
session
.
debug
# register method available on the client side
@
directSvc
.
register
def
close_user_session
():
return
dbui
.
close_user_session
()
@
directSvc
.
register
def
getForm
(
tablename
):
return
dbui
.
to_formPanel
(
db
[
tablename
])
@
directSvc
.
register
def
getGrid
(
tablename
):
return
dbui
.
to_gridPanel
(
db
[
tablename
])
@
directSvc
.
register
def
create
(
data
):
return
dbSvc
.
create
(
data
)
@
directSvc
.
register
def
count
(
data
):
return
dbSvc
.
count
(
data
)
@
directSvc
.
register
def
destroy
(
data
):
return
dbSvc
.
destroy
(
data
)
@
directSvc
.
register
def
read
(
data
):
return
dbSvc
.
read
(
data
)
@
directSvc
.
register
def
update
(
data
):
return
dbSvc
.
update
(
data
)
modules/plugin_dbui/dbui.py
View file @
245cc93a
...
...
@@ -3,8 +3,10 @@
"""
import
copy
import
plugin_dbui
as
dbui
from
gluon
import
current
from
gluon.html
import
URL
from
gluon.storage
import
Storage
from
gluon.tools
import
PluginManager
...
...
@@ -23,38 +25,38 @@ defaults = Storage(
app_script_dir
=
None
,
# dbui library
dbui_conf
=
URL
(
c
=
'
plugin_dbui
'
,
f
=
'
dbui_conf
'
),
dbui_conf_debug
=
URL
(
c
=
'
plugin_dbui
'
,
f
=
'
dbui_conf
'
,
vars
=
dict
(
debug
=
""
)),
dbui_conf
=
URL
(
c
=
"
plugin_dbui
"
,
f
=
"
dbui_conf
"
),
dbui_conf_debug
=
URL
(
c
=
"
plugin_dbui
"
,
f
=
"
dbui_conf
"
,
vars
=
dict
(
debug
=
""
)),
dbui_css
=
[
'
static/plugin_dbui/resources/css/kde-oxygen.css
'
,
'
static/plugin_dbui/resources/css/dbui.css
'
],
"
static/plugin_dbui/resources/css/kde-oxygen.css
"
,
"
static/plugin_dbui/resources/css/dbui.css
"
],
dbui_debug
=
'
static/plugin_dbui/src/Dbui.js
'
,
dbui_lg
=
'
static/plugin_dbui/locale/dbui-lang-%s.js
'
,
dbui_libmin
=
'
static/plugin_dbui/dbui-min.js
'
,
dbui_script
=
'
static/plugin_dbui/main.js
'
,
dbui_debug
=
"
static/plugin_dbui/src/Dbui.js
"
,
dbui_lg
=
"
static/plugin_dbui/locale/dbui-lang-%s.js
"
,
dbui_libmin
=
"
static/plugin_dbui/dbui-min.js
"
,
dbui_script
=
"
static/plugin_dbui/main.js
"
,
# ACE library
ace_css
=
'
static/plugin_ace/css/editor.css
'
,
ace_debug
=
'
static/plugin_ace/src-noconflict/ace.js
'
,
ace_libmin
=
'
static/plugin_ace/src-min-noconflict/ace.js
'
,
ace_css
=
"
static/plugin_ace/css/editor.css
"
,
ace_debug
=
"
static/plugin_ace/src-noconflict/ace.js
"
,
ace_libmin
=
"
static/plugin_ace/src-min-noconflict/ace.js
"
,
# EXT JS library
extjs_css
=
'
static/plugin_extjs/build/classic/theme-classic/resources/theme-classic-all.css
'
,
extjs_css
=
"
static/plugin_extjs/build/classic/theme-classic/resources/theme-classic-all.css
"
,
extjs_debug
=
[
'
static/plugin_extjs/build/ext-all-debug.js
'
,
'
static/plugin_extjs/build/classic/theme-classic/theme-classic-debug.js
'
],
"
static/plugin_extjs/build/ext-all-debug.js
"
,
"
static/plugin_extjs/build/classic/theme-classic/theme-classic-debug.js
"
],
extjs_libmin
=
[
'
static/plugin_extjs/build/ext-all.js
'
,
'
static/plugin_extjs/build/classic/theme-classic/theme-classic.js
'
],
"
static/plugin_extjs/build/ext-all.js
"
,
"
static/plugin_extjs/build/classic/theme-classic/theme-classic.js
"
],
extjs_lg
=
'
static/plugin_extjs/build/classic/locale/locale-%s.js
'
,
extjs_lg
=
"
static/plugin_extjs/build/classic/locale/locale-%s.js
"
,
# MATHJAX library
mathjax_libmin
=
'
static/plugin_mathjax/MathJax.js
'
)
mathjax_libmin
=
"
static/plugin_mathjax/MathJax.js
"
)
class
Dbui
(
object
):
...
...
@@ -72,6 +74,13 @@ class Dbui(object):
The persistent storage contains the configuration of the widgets
used in the user interface.
Note:
The configuration of the plugin is persistent across the
application. It can be accessed at any time using the syntax::
from gluon.tools import PluginManager
PluginManager("dbui").dbui
Args:
app_css (str or list):
...
...
@@ -165,15 +174,6 @@ class Dbui(object):
Relative path to the minified version of the MathJax library:
``static/plugin_mathjax/MathJax.js``.
Returns:
gluons.storage.Storage:
the configuration parameters for the plugin dbui.
The configuration is persistent across the application.
It can be accessed at any time using the syntax::
from gluon.tools import PluginManager
PluginManager("dbui").dbui
"""
plugin
=
PluginManager
(
"dbui"
).
dbui
...
...
@@ -196,3 +196,59 @@ class Dbui(object):
plugin
.
static_stores
=
{}
return
plugin
@
staticmethod
def
start_directSvc
():
"""Start services to interact with the database from the
User Interface using the Ext JS Direct protocol.
Returns:
directSvc:
"""
db
=
current
.
globalenv
[
"db"
]
# Start common services
dbSvc
=
dbui
.
DbSvc
()
directSvc
=
dbui
.
DirectSvc
()
# activate the debug mode
# this session variable is set by the control index or debug
session
=
current
.
session
dbSvc
.
debug
=
session
.
debug
directSvc
.
debug
=
session
.
debug
# register method available on the client side
@
directSvc
.
register
def
close_user_session
():
return
dbui
.
close_user_session
()
@
directSvc
.
register
def
getForm
(
tablename
):
return
dbui
.
to_formPanel
(
db
[
tablename
])
@
directSvc
.
register
def
getGrid
(
tablename
):
return
dbui
.
to_gridPanel
(
db
[
tablename
])
@
directSvc
.
register
def
create
(
data
):
return
dbSvc
.
create
(
data
)
@
directSvc
.
register
def
count
(
data
):
return
dbSvc
.
count
(
data
)
@
directSvc
.
register
def
destroy
(
data
):
return
dbSvc
.
destroy
(
data
)
@
directSvc
.
register
def
read
(
data
):
return
dbSvc
.
read
(
data
)
@
directSvc
.
register
def
update
(
data
):
return
dbSvc
.
update
(
data
)
return
directSvc
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