diff --git a/controllers/plugin_dbui.py b/controllers/plugin_dbui.py index c8d6c72ffc60233b917aefe8162a8a69963b5da7..a1b8e60c519bdc5b1118064e2bdcc77a0b0c228c 100644 --- a/controllers/plugin_dbui.py +++ b/controllers/plugin_dbui.py @@ -86,7 +86,7 @@ def debug(): script run the javascript foo in the framework 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 @@ -94,12 +94,12 @@ def debug(): plugin = plugins.dbui # 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')) # 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.app_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, ext='.js')) # main script which can be defined in many different ways pscript = dbui.get_script_path(plugin) @@ -115,8 +115,9 @@ def debug(): return dict(plugin=plugin) -def get_api(): - """Controller returning the javascript API definition. +def dbui_conf(): + """Controller returning the javascript script configuring + the plugin dbui: application name, store definition,... """ from gluon.contrib import simplejson as json @@ -172,22 +173,31 @@ def index(): script run the javascript foo in the framework 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') plugin = plugins.dbui - # plugin and application css files - response.files.extend(dbui.get_file_paths(plugin.base_css, ext='.css')) + # css files + 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')) - # compressed version of the plugin javascript libraries - response.files.extend(dbui.get_file_paths(plugin.base_libmin, ext='.js')) - - # compressed version of the application javascript library + # compressed version of the javascript libraries + response.files.extend(dbui.get_file_paths(plugin.mathjax_libmin, ext='.js')) + response.files.extend(dbui.get_file_paths(plugin.extjs_libmin, ext='.js')) + response.files.extend(dbui.get_file_paths(plugin.dbui_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 pscript = dbui.get_script_path(plugin) response.files.append(pscript) diff --git a/models/db.py b/models/db.py index b327249cffb5e87efcac352feee8df803b2f8f4c..d986801e459a1281865bbc94ff63daac971e3dab 100644 --- a/models/db.py +++ b/models/db.py @@ -15,9 +15,9 @@ from gluon.tools import PluginManager # #------------------------------------------------------------------------------- plugins = PluginManager() -#plugins.dbui.app_css = None # relative path, i.e static/myapp.css or dir -#plugins.dbui.app_js_dir = None # relative directory static/src -#plugins.dbui.app_libmin = None # relative path static/myapp-min.js or dir +#plugins.dbui.app_css = None # relative path, i.e static/myapp.css or dir or list +#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 or list #plugins.dbui.app_script = None # relative path static/myapp.js plugins.dbui.app_script_dir = 'static/scripts' # relative directory static/scripts diff --git a/models/plugin_dbui.py b/models/plugin_dbui.py index 7c27a738eca5d44df74c7c9f55b030042ec78a5d..88312fe8fa3d1d5e022e43338bc9865ced8e64bb 100644 --- a/models/plugin_dbui.py +++ b/models/plugin_dbui.py @@ -17,24 +17,38 @@ dbui = local_import('plugin_dbui') # to a file (static/myapp.css) or to a directory (static/css) except app_script # 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. +# 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', - app_css=None, # relative path static/myapp.css or dir - app_js_dir=None, # relative directory static/src + app_css=None, # relative path static/myapp.css or dir or list + 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_script=None, # relative path static/myapp.js app_script_dir=None, # relative directory static/scripts - base_css='static/plugin_dbui/resources/css/kde-oxygen.css', - base_js_dir='static/plugin_dbui/src', - base_lg=dbui.get_language(), - base_libmin='static/plugin_dbui/dbui-min.js', - base_pdbui=dbui.get_plugin_path('plugin_dbui'), - base_pextjs=dbui.get_plugin_path('plugin_extjs'), - base_pmathjax=dbui.get_plugin_path('plugin_mathjax'), - base_script='static/plugin_dbui/main.js', + dbui_conf=URL(c='plugin_dbui', f='dbui_conf'), + dbui_css='static/plugin_dbui/resources/css/kde-oxygen.css', + dbui_js='static/plugin_dbui/src', + dbui_lg='static/plugin_dbui/locale/app-lang-%s.js' % lg, + dbui_libmin='static/plugin_dbui/dbui-min.js', + dbui_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_forms={}, diff --git a/modules/plugin_dbui/helper.py b/modules/plugin_dbui/helper.py index 11219fa5ad6d6facd35e0bea4f29df89f62620f3..dcf90254f05135f4f420916fe3ae292a171e2a9a 100644 --- a/modules/plugin_dbui/helper.py +++ b/modules/plugin_dbui/helper.py @@ -278,7 +278,7 @@ def get_script_path(plugin): return os.path.join(client_path, plugin.app_script) # 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): diff --git a/static/plugin_dbui/CHANGELOG b/static/plugin_dbui/CHANGELOG index b0a4400b081231866b3aaa9f5e4343e05566b739..54e61a17ce1fce73d8158d8811b49780d20c3725 100644 --- a/static/plugin_dbui/CHANGELOG +++ b/static/plugin_dbui/CHANGELOG @@ -8,6 +8,8 @@ HEAD of configurators mapping ExtJS components while the second one contained functions translating DAL object into ExtJS configurator. - 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) - Consolidation version diff --git a/views/plugin_dbui/index.html b/views/plugin_dbui/index.html index 9e6b95bc9830e910c0b96129f03bea00447fe913..fe9058bb92266a015010c7ccd9fa9683a405f139 100644 --- a/views/plugin_dbui/index.html +++ b/views/plugin_dbui/index.html @@ -21,24 +21,11 @@ "HTML-CSS": { availableFonts: ["TeX"] } }); </script> - <script type="text/javascript" src="{{=plugin.base_pmathjax}}/MathJax.js"></script> - - <!-- extjs + dbui + application css --> - <link rel="stylesheet" type="text/css" href="{{=plugin.base_pextjs}}/resources/css/ext-all.css"/> - {{for el in response.files:}}{{if el.endswith('.css'):}}<link rel="stylesheet" type="text/css" href="{{=el}}"/>{{else: continue}}{{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> - + {{for el in response.files: + if el.endswith('.css'):}}<link rel="stylesheet" type="text/css" href="{{=el}}"/> + {{else:}}<script type="text/javascript" src="{{=el}}"></script> + {{pass + pass}} </head> <body> <div id='appmain'></div>