diff --git a/modules/plugin_dbui/navtree.py b/modules/plugin_dbui/navtree.py index ed6bfae648e4bb750f6a43eb9689ee234a5a6dff..c934fbffeb72afea21d3d577954ae4fb1b0f2f9e 100644 --- a/modules/plugin_dbui/navtree.py +++ b/modules/plugin_dbui/navtree.py @@ -11,27 +11,33 @@ def to_panelWithUrlSelector(formItems, application=None, baseUrl=None, controller=None, - ctrlField=None, + ctrlField=None, + extField=None, title='Configure'): """Return the configuration dictionary for an App.PanelWithUrlSelector. the main panel displays the URL content while the selector panel shows a form allowing to change the URL setting. application and controller - The web2py way of defining the URL: /application/controller. - If the application is not defined the URL is: - /current application/controller. - These keyword arguments make sense when using the ctrlField. - See also baseUrl. + The base URL is: /application/controller. + By default the application is the current application. + + The argument ctlField and extField allow to extend the base URL to + /application/controller/ctlField.extField baseUrl - Well-formed URL string, i.e http://blabla - See also application and controller + Another way to defined the base URL associated to the panel. + It should be a well-formed URL string, i.e http://blabla ctrlField - Name of the form field defining the controller - When define the URL become http://blabla/ctrlFieldValue + Name of the form field defining the name of the controller. + When define the URL become baseUrl/ctrlFieldValue + extField + the url become baseUrl/ctrField.extField + Useful to play with different view rendering their content in + html, json, xml, ... + formItems A list of configuration dictionary defining the widget embedded in the form @@ -49,6 +55,7 @@ def to_panelWithUrlSelector(formItems, cfg = {'baseUrl': url, 'ctrlField': ctrlField, + 'extfield': extField, 'isMathJax': is_mathjax(), 'panelCfg': None, 'selectorCfg':None, diff --git a/static/plugin_dbui/ABOUT.html b/static/plugin_dbui/ABOUT.html index 1a62957399c62be6f71d9d2ef9797f384e32a7b2..2160143e00e2b326782ab82e1aac846f2eaa6dfa 100644 --- a/static/plugin_dbui/ABOUT.html +++ b/static/plugin_dbui/ABOUT.html @@ -29,6 +29,6 @@ <h3>Licence</h3> This software is distributed under the Open Source license CeCILL. <br> - © 2010 - 2011 R. Le Gac + © 2009 - 2012 R. Le Gac </body> </html> \ No newline at end of file diff --git a/static/plugin_dbui/CHANGELOG b/static/plugin_dbui/CHANGELOG index beb9ed9153d3ea351c99b7848699336ea4a7bbbb..ec45b714f5b3b5a9fe2505edf460a4caeebb1e15 100644 --- a/static/plugin_dbui/CHANGELOG +++ b/static/plugin_dbui/CHANGELOG @@ -1,7 +1,10 @@ --------------------------------- CHANGE LOG ---------------------------------- HEAD - + - Bugs fixed + - Add the configuration parameter extField in App.PanelWithUrlSelector. + Design to manipulate different web2py views like foo.html, foo.xml, ... + 0.4.5 (Feb 2012) - Consolidation version - Polish code and documentation as well as bug fixed diff --git a/static/plugin_dbui/src/appbase.js b/static/plugin_dbui/src/appbase.js index baa2cb7c048e40f00d195469cd9ee66195518629..da02c1bb2f81878d3efb05da55359e577bde4d4c 100644 --- a/static/plugin_dbui/src/appbase.js +++ b/static/plugin_dbui/src/appbase.js @@ -20,7 +20,7 @@ Ext.namespace('App'); /** * @param {String} App.version version of the library */ -App.version = '0.4.5'; +App.version = '0.4.x'; /** * Helper function mimicking the encode_field function running on the server diff --git a/static/plugin_dbui/src/apppanelwithurlselector.js b/static/plugin_dbui/src/apppanelwithurlselector.js index 1d5c5dcf3cb25027c9d27cb4a5d8500a92ab6fae..ac80cc897d9fb065216f33b72686f391075787a6 100644 --- a/static/plugin_dbui/src/apppanelwithurlselector.js +++ b/static/plugin_dbui/src/apppanelwithurlselector.js @@ -31,6 +31,12 @@ App.PanelWithUrlSelector = Ext.extend(App.BasePanelWithSelector, { */ ctrlField: null, + /** + * @param {String} extFiedl name of the field defining the view extension + * When define the url become http://blabla/ctrlFieldValue.extField + */ + extField: null, + /** * @param {Boolean} isMathJax */ @@ -58,21 +64,27 @@ App.PanelWithUrlSelector = Ext.extend(App.BasePanelWithSelector, { */ onGo: function() { - var fields, + var ctrlFunc=null, + ctrlExt=null, + fields, i, mainPanel = this.getComponent('mainPanel'), params = {}, selector = this.getComponent('selectorPanel'), url = this.baseUrl; - // activate the autoscrolling + // activate the auto scrolling mainPanel.setAutoScroll(true); // basic fields fields = selector.findByType('field'); for (i = 0; i < fields.length; i += 1) { if(fields[i].getName() === this.ctrlField) { - url = url + '/' + fields[i].getValue(); + ctrlFunc = fields[i].getValue(); + + } else if (fields[i].getName() === this.extField) { + ctrlExt = fields[i].getValue(); + } else { params[fields[i].getName()] = fields[i].getValue(); } @@ -86,6 +98,15 @@ App.PanelWithUrlSelector = Ext.extend(App.BasePanelWithSelector, { }); } + // build the URL when only the ctrlFunc is defined + if (ctrlFunc !== null && ctrlExt === null) { + url = url + '/' + ctrlFunc; + + // build the url when both the ctrlFunc and ctrlExt are defined + } else if (ctrlFunc !== null && ctrlExt !== null) { + url = url + '/' + ctrlFunc + '.' + ctrlExt; + } + mainPanel.load({ callback: this.onLoad, params: params, @@ -98,7 +119,7 @@ App.PanelWithUrlSelector = Ext.extend(App.BasePanelWithSelector, { /** * Handler call when the web page is load in the panel. - * It is usefeul to detect HTTP error and to perform post + * It is useful to detect HTTP error and to perform post * processing (MathJax). * * Arguments ares those of the Ext.Update.update.