diff --git a/controllers/plugin_dbui.py b/controllers/plugin_dbui.py index b32852a54439db9081e102520814e489b053862b..5d80816cc8b4051457a97d11176b29e09fff707f 100644 --- a/controllers/plugin_dbui.py +++ b/controllers/plugin_dbui.py @@ -45,6 +45,20 @@ def index(): 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 + + 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. + + If the library exits it is loaded otherwise the source + code is loaded. When the debug flag is activate the source + code is always loaded. PRIVATE PARAMETERS @@ -128,7 +142,25 @@ def index(): li.sort() response.files.extend(li) - + + # minified version of the user library + if not debug and plugins.dbui.user_libmin: + if os.path.exists(os.path.join(server_path, plugins.dbui.user_libmin)): + response.files.append(os.path.join(base, plugins.dbui.user_libmin)) + + # user source code -- respect alphabetic order + else: + li = [] + appdir = os.path.join(base, plugins.dbui.user_src_path) + svcdir = os.path.join(server_path, plugins.dbui.user_src_path) + if os.path.exists(svcdir): + for file in os.listdir(svcdir): + if file.endswith(".js"): + li.append(os.path.join(appdir, file)) + + li.sort() + response.files.extend(li) + # main application script response.files.append(os.path.join(base, plugins.dbui.script_path, script)) diff --git a/models/plugin_dbui.py b/models/plugin_dbui.py index 5c4cc15140c06b7d074a3fa442d04639d3685903..ff7cfd4f6e6c360d4c77cb49e02a4584f3882b90 100644 --- a/models/plugin_dbui.py +++ b/models/plugin_dbui.py @@ -12,7 +12,9 @@ plugins = PluginManager('dbui', grid_modifiers={}, viewport_modifiers=Storage(hidden_tables=[]), page_view='plugin_dbui.html', - script_path='static/plugin_dbui/scripts') + script_path='static/plugin_dbui/scripts', + user_src_path='static/src', + user_libmin=None) # Start common services dbSvc = dbui.DbSvc(db)