Skip to content
Snippets Groups Projects
Commit 693a39c5 authored by legac's avatar legac
Browse files

redesign the parameters of the plugin as well as the related index view.

Rename the action get_api as dbui_conf.
parent 7b4ac96e
No related branches found
No related tags found
No related merge requests found
...@@ -86,7 +86,7 @@ def debug(): ...@@ -86,7 +86,7 @@ def debug():
script script
run the javascript foo in the framework defined by the plugin. run the javascript foo in the framework defined by the plugin.
The scripts are stored in the directory defined by the plugin The scripts are stored in the directory defined by the plugin
configuration app_js_dir. configuration app_script_dir.
""" """
# check the presence of the ExtJS and MathJax plugins # check the presence of the ExtJS and MathJax plugins
...@@ -94,12 +94,12 @@ def debug(): ...@@ -94,12 +94,12 @@ def debug():
plugin = plugins.dbui plugin = plugins.dbui
# plugin and application css files # plugin and application css files
response.files.extend(dbui.get_file_paths(plugin.base_css, ext='.css')) response.files.extend(dbui.get_file_paths(plugin.dbui_css, ext='.css'))
response.files.extend(dbui.get_file_paths(plugin.app_css, ext='.css')) response.files.extend(dbui.get_file_paths(plugin.app_css, ext='.css'))
# plugin and application javascript source code # plugin and application javascript source code
response.files.extend(dbui.get_file_paths(plugin.base_js_dir, ext='.js')) response.files.extend(dbui.get_file_paths(plugin.dbui_js, ext='.js'))
response.files.extend(dbui.get_file_paths(plugin.app_js_dir, ext='.js')) response.files.extend(dbui.get_file_paths(plugin.app_js, ext='.js'))
# main script which can be defined in many different ways # main script which can be defined in many different ways
pscript = dbui.get_script_path(plugin) pscript = dbui.get_script_path(plugin)
...@@ -115,8 +115,9 @@ def debug(): ...@@ -115,8 +115,9 @@ def debug():
return dict(plugin=plugin) return dict(plugin=plugin)
def get_api(): def dbui_conf():
"""Controller returning the javascript API definition. """Controller returning the javascript script configuring
the plugin dbui: application name, store definition,...
""" """
from gluon.contrib import simplejson as json from gluon.contrib import simplejson as json
...@@ -172,22 +173,31 @@ def index(): ...@@ -172,22 +173,31 @@ def index():
script script
run the javascript foo in the framework defined by the plugin. run the javascript foo in the framework defined by the plugin.
The scripts are stored in the directory defined by the plugin The scripts are stored in the directory defined by the plugin
configuration app_js_dir. configuration app_script_dir.
""" """
dbui = local_import('plugin_dbui') dbui = local_import('plugin_dbui')
plugin = plugins.dbui plugin = plugins.dbui
# plugin and application css files # css files
response.files.extend(dbui.get_file_paths(plugin.base_css, ext='.css')) response.files.extend(dbui.get_file_paths(plugin.extjs_css, ext='.css'))
response.files.extend(dbui.get_file_paths(plugin.dbui_css, ext='.css'))
response.files.extend(dbui.get_file_paths(plugin.app_css, ext='.css')) response.files.extend(dbui.get_file_paths(plugin.app_css, ext='.css'))
# compressed version of the plugin javascript libraries # compressed version of the javascript libraries
response.files.extend(dbui.get_file_paths(plugin.base_libmin, ext='.js')) response.files.extend(dbui.get_file_paths(plugin.mathjax_libmin, ext='.js'))
response.files.extend(dbui.get_file_paths(plugin.extjs_libmin, ext='.js'))
# compressed version of the application javascript library response.files.extend(dbui.get_file_paths(plugin.dbui_libmin, ext='.js'))
response.files.extend(dbui.get_file_paths(plugin.app_libmin, ext='.js')) response.files.extend(dbui.get_file_paths(plugin.app_libmin, ext='.js'))
# language files
response.files.extend(dbui.get_file_paths(plugin.extjs_lg, ext='.js'))
response.files.extend(dbui.get_file_paths(plugin.dbui_lg, ext='.js'))
response.files.extend(dbui.get_file_paths(plugin.app_lg, ext='.js'))
# URL for dbui configuration script
response.files.append(plugin.dbui_conf)
# main script which can be defined in many different ways # main script which can be defined in many different ways
pscript = dbui.get_script_path(plugin) pscript = dbui.get_script_path(plugin)
response.files.append(pscript) response.files.append(pscript)
......
...@@ -15,9 +15,9 @@ from gluon.tools import PluginManager ...@@ -15,9 +15,9 @@ from gluon.tools import PluginManager
# #
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
plugins = PluginManager() plugins = PluginManager()
#plugins.dbui.app_css = None # relative path, i.e static/myapp.css or dir #plugins.dbui.app_css = None # relative path, i.e static/myapp.css or dir or list
#plugins.dbui.app_js_dir = None # relative directory static/src #plugins.dbui.app_js = None # relative path static/src/my.js or dir or list
#plugins.dbui.app_libmin = None # relative path static/myapp-min.js or dir #plugins.dbui.app_libmin = None # relative path static/myapp-min.js or dir or list
#plugins.dbui.app_script = None # relative path static/myapp.js #plugins.dbui.app_script = None # relative path static/myapp.js
plugins.dbui.app_script_dir = 'static/scripts' # relative directory static/scripts plugins.dbui.app_script_dir = 'static/scripts' # relative directory static/scripts
......
...@@ -17,24 +17,38 @@ dbui = local_import('plugin_dbui') ...@@ -17,24 +17,38 @@ dbui = local_import('plugin_dbui')
# to a file (static/myapp.css) or to a directory (static/css) except app_script # to a file (static/myapp.css) or to a directory (static/css) except app_script
# and base_script which should point to a file. # and base_script which should point to a file.
# #
# Default values for the plugin parameters
# All these parameters should be defined in the applications model. # All these parameters should be defined in the applications model.
# Applications value must be define in the application model
# Most of them can be either a relative path static/..., or a dir path
# or a list of paths
# #
lg = dbui.get_language()
plugins = PluginManager('dbui', plugins = PluginManager('dbui',
app_css=None, # relative path static/myapp.css or dir app_css=None, # relative path static/myapp.css or dir or list
app_js_dir=None, # relative directory static/src app_js=None, # relative path static/src/my.js or dir or list
app_lg=None, # relative path or dir or list
app_libmin=None, # relative path static/myapp-min.js or dir app_libmin=None, # relative path static/myapp-min.js or dir
app_script=None, # relative path static/myapp.js app_script=None, # relative path static/myapp.js
app_script_dir=None, # relative directory static/scripts app_script_dir=None, # relative directory static/scripts
base_css='static/plugin_dbui/resources/css/kde-oxygen.css', dbui_conf=URL(c='plugin_dbui', f='dbui_conf'),
base_js_dir='static/plugin_dbui/src', dbui_css='static/plugin_dbui/resources/css/kde-oxygen.css',
base_lg=dbui.get_language(), dbui_js='static/plugin_dbui/src',
base_libmin='static/plugin_dbui/dbui-min.js', dbui_lg='static/plugin_dbui/locale/app-lang-%s.js' % lg,
base_pdbui=dbui.get_plugin_path('plugin_dbui'), dbui_libmin='static/plugin_dbui/dbui-min.js',
base_pextjs=dbui.get_plugin_path('plugin_extjs'), dbui_script='static/plugin_dbui/main.js',
base_pmathjax=dbui.get_plugin_path('plugin_mathjax'),
base_script='static/plugin_dbui/main.js', extjs_css='static/plugin_extjs/resources/css/ext-all.css',
extjs_js=['static/plugin_extjs/adapter/ext/ext-base.js',
'static/plugin_extjs/ext-all-debug-w-comments.js'],
extjs_libmin=['static/plugin_extjs/adapter/ext/ext-base.js',
'static/plugin_extjs/ext-all.js'],
extjs_lg='static/plugin_extjs/src/locale/ext-lang-%s.js' % lg,
mathjax_libmin='static/plugin_mathjax/MathJax.js',
modifier_fields={}, modifier_fields={},
modifier_forms={}, modifier_forms={},
......
...@@ -278,7 +278,7 @@ def get_script_path(plugin): ...@@ -278,7 +278,7 @@ def get_script_path(plugin):
return os.path.join(client_path, plugin.app_script) return os.path.join(client_path, plugin.app_script)
# default script for the plugin # default script for the plugin
return os.path.join(client_path, plugin.base_script) return os.path.join(client_path, plugin.dbui_script)
def get_where_query(table): def get_where_query(table):
......
...@@ -8,6 +8,8 @@ HEAD ...@@ -8,6 +8,8 @@ HEAD
of configurators mapping ExtJS components while the second one contained of configurators mapping ExtJS components while the second one contained
functions translating DAL object into ExtJS configurator. functions translating DAL object into ExtJS configurator.
- Add a reset button in the paging toolbar for grid. - Add a reset button in the paging toolbar for grid.
- Redesign the plugin parameters and the related index view.
- Add a mechanism to extract report as latex of pdf files.
0.4.5 (Feb 2012) 0.4.5 (Feb 2012)
- Consolidation version - Consolidation version
......
...@@ -21,24 +21,11 @@ ...@@ -21,24 +21,11 @@
"HTML-CSS": { availableFonts: ["TeX"] } "HTML-CSS": { availableFonts: ["TeX"] }
}); });
</script> </script>
<script type="text/javascript" src="{{=plugin.base_pmathjax}}/MathJax.js"></script> {{for el in response.files:
if el.endswith('.css'):}}<link rel="stylesheet" type="text/css" href="{{=el}}"/>
<!-- extjs + dbui + application css --> {{else:}}<script type="text/javascript" src="{{=el}}"></script>
<link rel="stylesheet" type="text/css" href="{{=plugin.base_pextjs}}/resources/css/ext-all.css"/> {{pass
{{for el in response.files:}}{{if el.endswith('.css'):}}<link rel="stylesheet" type="text/css" href="{{=el}}"/>{{else: continue}}{{pass}} pass}}
{{pass}}
<!-- extjs javascript library -->
<script type="text/javascript" src="{{=plugin.base_pextjs}}/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="{{=plugin.base_pextjs}}/ext-all.js"></script>
<script type="text/javascript" src="{{=plugin.base_pextjs}}/src/locale/ext-lang-{{=plugin.base_lg}}.js"></script>
<!-- dbui + user javascript library and main script -->
<script type="text/javascript" src="/{{=request.application}}/plugin_dbui/get_api"></script>
{{for el in response.files:}}{{if el.endswith('.js'):}}<script type="text/javascript" src="{{=el}}"></script>{{pass}}
{{pass}}
<script type="text/javascript" src="{{=plugin.base_pdbui}}/locale/app-lang-{{=plugin.base_lg}}.js"></script>
</head> </head>
<body> <body>
<div id='appmain'></div> <div id='appmain'></div>
......
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