From 45d5dec2d9415b1df47c7250ab43c706a58d335a Mon Sep 17 00:00:00 2001 From: Renaud Le Gac <renaud.legac@free.fr> Date: Wed, 15 Feb 2012 22:09:20 +0100 Subject: [PATCH] Minor polishing --- controllers/plugin_dbui.py | 67 +++++++++--------------------------- views/plugin_dbui/debug.html | 50 --------------------------- views/plugin_dbui/index.html | 2 -- 3 files changed, 17 insertions(+), 102 deletions(-) delete mode 100644 views/plugin_dbui/debug.html diff --git a/controllers/plugin_dbui.py b/controllers/plugin_dbui.py index 29645428..8c8baaf3 100644 --- a/controllers/plugin_dbui.py +++ b/controllers/plugin_dbui.py @@ -7,17 +7,13 @@ configuration Author: R. Le Gac - $Id$ """ -__version__ = "$Revision$" - - import os -SCRIPT = """ +API = """ Ext.namespace('App'); App.csvUrl = '/%s/plugin_dbui/csv'; App.name = '%s'; @@ -84,26 +80,12 @@ def debug(): http://localhost:8000/myapp/plugin_dbui/debug http://localhost:8000/myapp/plugin_dbui/debug?script=foo - PUBLIC PARAMETERS WHICH CAN BE SET VIA THE PLUGINMANAGER - - script_path - The relative path where scripts are located. - By default static/plugin_dbui/scripts - - user_src_path - the relative path to a directory containing additional - javascript source code for user application classes and plugins. - By default static/src - - - OPTIONS + URL OPTIONS - script foo + script run the javascript foo in the framework defined by the plugin. - The scripts are stored in the directory application/static/script - by default the javascript application/static/plugin_dbui/main.js - is launched. - + The scripts are stored in the directory defined by the plugin + configuration app_js_dir. """ # check the presence of the ExtJS and MathJax plugins @@ -131,7 +113,6 @@ def debug(): # return the plugin configuration parameter as well as the response return dict(plugin=plugin) - def get_api(): """Controller returning the javascript API definition. @@ -164,46 +145,32 @@ def get_api(): # fill the javascript template app = request.application - script = SCRIPT % (app, - app, - app, - json.dumps(di), - json.dumps(storeCfgs)) + script = API % (app, + app, + app, + json.dumps(di), + json.dumps(storeCfgs)) # return the response as a javascript response.headers['Content-Type'] = 'text/javascript' return script - - + + def index(): """Default Controller to run the plugin - Load compressed version of the ExtJS and user libraries. + Load compressed version of all libraries. EXAMPLES http://localhost:8000/myapp/plugin_dbui http://localhost:8000/myapp/plugin_dbui?script=foo + URL OPTIONS - PUBLIC PARAMETERS WHICH CAN BE SET VIA THE PLUGINMANAGER - - script_path - The relative path where scripts are located. - By default static/plugin_dbui/scripts - - user_libmin - The relative path to the file containing the additional - javascript library for user application classes and plugins. - It is the minified version of the source code. - - - OPTIONS - - script foo + script run the javascript foo in the framework defined by the plugin. - The scripts are stored in the directory application/static/script - by default the javascript application/static/plugin_dbui/main.js - is launched. + The scripts are stored in the directory defined by the plugin + configuration app_js_dir. """ dbui = local_import('plugin_dbui') diff --git a/views/plugin_dbui/debug.html b/views/plugin_dbui/debug.html deleted file mode 100644 index 573eca8a..00000000 --- a/views/plugin_dbui/debug.html +++ /dev/null @@ -1,50 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> -<html> - <head> - <!-- $Id$ --> - - <meta http-equiv="content-type" content="text/html; charset=utf-8" /> - <meta name="author" lang="en" content="{{=response.author}}" /> - <meta name="keywords" content="{{=response.keywords}}" /> - <meta name="description" content="{{=response.description}}" /> - - <title>{{=request.application}}</title> - - <!-- mathjax library --> - <script type="text/x-mathjax-config"> - MathJax.Hub.Config({ - extensions: ["tex2jax.js"], - jax: ["input/TeX", "output/HTML-CSS"], - tex2jax: { - inlineMath: [ ['$','$'], ["\\(","\\)"] ], - displayMath: [ ['$$','$$'], ["\\[","\\]"] ], - processEscapes: true - }, - "HTML-CSS": { availableFonts: ["TeX"] } - }); - </script> - <script type="text/javascript" src="{{=pmathjax}}/MathJax.js"></script> - - <!-- extjs css --> - <link rel="stylesheet" type="text/css" href="{{=pextjs}}/resources/css/ext-all.css"/> - <link rel="stylesheet" type="text/css" href="/{{=request.application}}/static/plugin_dbui/resources/css/kde-oxygen.css"/> - - - <!-- extjs javascript library --> - <script type="text/javascript" src="{{=pextjs}}/adapter/ext/ext-base-debug.js"></script> - <script type="text/javascript" src="{{=pextjs}}/ext-all-debug.js"></script> - <script type="text/javascript" src="{{=pextjs}}/src/locale/ext-lang-{{=lg}}.js"></script> - - <!-- dbui api --> - <script type="text/javascript" src="/{{=request.application}}/plugin_dbui/get_api"></script> - - <!-- dbui + user javascript source code and main script--> - {{for el in response.files:}} - <script type="text/javascript" src="{{=el}}"></script>{{pass}} - <script type="text/javascript" src="/{{=request.application}}/static/plugin_dbui/locale/app-lang-{{=lg}}.js"></script> - - </head> - <body> - <div id='appmain'></div> - </body> -</html> diff --git a/views/plugin_dbui/index.html b/views/plugin_dbui/index.html index da411951..c8d79413 100644 --- a/views/plugin_dbui/index.html +++ b/views/plugin_dbui/index.html @@ -1,8 +1,6 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> - <!-- $Id$ --> - <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="author" lang="en" content="{{=response.author}}" /> <meta name="keywords" content="{{=response.keywords}}" /> -- GitLab