diff --git a/static/plugin_dbui/CHANGELOG b/static/plugin_dbui/CHANGELOG index 0b9f03ebc5ea8dc6ff44d5286167abb8f032660f..1b3c14d086fce6182bc3485eab7270284cfdcda2 100644 --- a/static/plugin_dbui/CHANGELOG +++ b/static/plugin_dbui/CHANGELOG @@ -1,6 +1,8 @@ --------------------------------- CHANGE LOG ---------------------------------- HEAD + - Fix a bug in App.BasePanelWithSelector for IE + - Javascript is almost compliant with JSLINT 0.4.10.2 (Mar 2013) - DirectSvc exceptions are logged in the web2py ticket system. diff --git a/static/plugin_dbui/src/base.js b/static/plugin_dbui/src/base.js index e325c853d7bb715ea05e29f89cac65193380bd5e..d82f9f07106ab9a77373017444e4fa129afacabb 100644 --- a/static/plugin_dbui/src/base.js +++ b/static/plugin_dbui/src/base.js @@ -1,8 +1,8 @@ /** * appbase.js - * + * * Constants and elementary functions to built an application - * + * */ Ext.namespace('App'); @@ -38,85 +38,85 @@ App.encodeField = function (table, field) { /** * Helper function returning an App.data.Store identifies by its id. * If the store does not exit it is created and register in the store manager. - * - * NOTE: The storeId is defined by the server. - * The syntax of the storeId is "nameStore". - * If the store does not exist, its configuration is extract from + * + * NOTE: The storeId is defined by the server. + * The syntax of the storeId is "nameStore". + * If the store does not exist, its configuration is extract from * the application constant App.storeCfgs.Then it is created and registered. - * + * * In the current frame work, this function allows to associated a unique store * to a database table and that widget share the same store. - * + * * @param {String} storeId */ App.getStore = function (storeId) { - + var cfg, store, table; - + store = Ext.StoreMgr.lookup(storeId); - + if (!store && !Ext.isString(storeId)) { throw new Error('Fail to instanciate the store: "' + storeId + '"'); - } + } if (!store && Ext.isString(storeId)) { - + cfg = App.storeCfgs[storeId]; - + switch (cfg.xtype) { - case 'arraystore': - store = new Ext.data.ArrayStore(cfg); - break; - - case 'directstore': - store = new Ext.data.DirectStore(cfg); - break; - - case 'jsonstore': - store = new Ext.data.JsonStore(cfg); - break; - - case 'store': - store = new Ext.data.Store(cfg); - break; - - case 'xdirectstore': - store = new App.data.DirectStore(cfg); - break; - - case 'xmlstore': - store = new Ext.data.XmlStore(cfg); - break; - - default: - throw new Error('Fail to instanciate the object: "' + cfg.xtype + '"'); - break; + case 'arraystore': + store = new Ext.data.ArrayStore(cfg); + break; + + case 'directstore': + store = new Ext.data.DirectStore(cfg); + break; + + case 'jsonstore': + store = new Ext.data.JsonStore(cfg); + break; + + case 'store': + store = new Ext.data.Store(cfg); + break; + + case 'xdirectstore': + store = new App.data.DirectStore(cfg); + break; + + case 'xmlstore': + store = new Ext.data.XmlStore(cfg); + break; + + default: + throw new Error('Fail to instanciate the object: "' + cfg.xtype + '"'); + break; } } return store; }; /** - * Helper function returning the name of the database table + * Helper function returning the name of the database table * associated to the store. works with store configured using the * Dbui.getJsonStore method. * @param {App.data.DirectStore} store */ App.getTableName = function (store) { - return store.baseParams.tableName; + return store.baseParams.tableName; }; /** - * Helper function to determine if a plugin is present + * Helper function to determine if a plugin is present * in the plugins list of a component - * @param {Ext.Component} + * @param {Ext.Component} * @param {String} ptype the ptype of the plugin */ App.isPlugin = function (component, ptype) { - var i, + var i, plugin; if (!component.hasOwnProperty('plugins')) { @@ -130,10 +130,10 @@ App.isPlugin = function (component, ptype) { if (plugin === ptype) { return true; } - + if ((typeof (plugin) === 'object') && (plugin.ptype === ptype)) { return true; - } + } } return false; }; diff --git a/static/plugin_dbui/src/buttondownload.js b/static/plugin_dbui/src/buttondownload.js index 3fee52d2083096ba47998703c5ea38f1301ea547..628a285ffa62f9fa6017a070ec26cca1ee3038cc 100644 --- a/static/plugin_dbui/src/buttondownload.js +++ b/static/plugin_dbui/src/buttondownload.js @@ -1,6 +1,6 @@ /** * A button to download file from the server - * + * * @extends Ext.Button * @version * @@ -11,41 +11,41 @@ Ext.namespace('App'); App.ButtonDownload = Ext.extend(Ext.Button, { /** - * @cfg{String} url pointing to the server controller + * @cfg{String} url pointing to the server controller * which will return the file - */ + */ url: undefined, - + /** - * private method requests by the component model of ExtJS - */ + * private method requests by the component model of ExtJS + */ initComponent: function () { - + // initialize the underlying class App.ButtonDownload.superclass.initComponent.call(this); - + // download when the button is pressed this.on('click', this.onDownload, this); }, - + /** * Handler to download the file * The scope is the button. - * + * * NOTE: this method add and iframe at the end of the DOM document * the source of the iframe is the url pointing on the server conroller. * The latter returun a document which is automatically loaded. - * + * * Method suggested on the sencha forum: * www.sencha.com/forum/showthread.php?26471-Download-File-on%28-click-%29 */ onDownload: function (button, event) { - + // remove existing iframe try { Ext.destroy(Ext.get('downloadIframe')); } catch (err) {} - + // create a fresh iframe Ext.DomHelper.append(document.body, { tag: 'iframe', @@ -56,7 +56,7 @@ App.ButtonDownload = Ext.extend(Ext.Button, { css: 'display:none;visibility:hidden;height:0px;', src: this.url }); - } + } }); Ext.reg('xbuttondownload', App.ButtonDownload); diff --git a/static/plugin_dbui/src/combobox.js b/static/plugin_dbui/src/combobox.js index f5fb3bd188b3c74ee6133db1e2646b8473db50c8..6ca93a8abe2cc1abe0476f01d02d5d896cdf6f2a 100644 --- a/static/plugin_dbui/src/combobox.js +++ b/static/plugin_dbui/src/combobox.js @@ -1,9 +1,9 @@ /** - * The ComboBox is an Ext.form.ComboBox with an App.data.DirectStore. - * + * The ComboBox is an Ext.form.ComboBox with an App.data.DirectStore. + * * The type of this component is xcombobox. - * - * @extends Ext.form.ComboBox + * + * @extends Ext.form.ComboBox * @version * */ @@ -20,15 +20,15 @@ App.form.ComboBox = Ext.extend(Ext.form.ComboBox, { selectOnFocus: true, triggerAction: 'all', typeAhead: true, - + /** * private method require by the ExtJs component model - */ + */ initComponent: function () { // defined the empty text from the field label if (this.fieldLabel && !this.emptyText) { - this.emptyText = "Select a " + this.fieldLabel + " ..."; + this.emptyText = "Select a " + this.fieldLabel + " ..."; } // link the combobox to the data store @@ -39,9 +39,9 @@ App.form.ComboBox = Ext.extend(Ext.form.ComboBox, { // load the store if not yet done if (this.store.getCount() === 0) { - this.store.load(); + this.store.load(); } - + // Set the default value when the comboBox is not yet expend this.store.on('load', function () { this.setValue(this.initialConfig.value); diff --git a/static/plugin_dbui/src/form.js b/static/plugin_dbui/src/form.js index 2aa8f8c8a157ac9fd837b259574db726ca8c6719..e10098620701641acef9997dbd94ba62d114b1f8 100644 --- a/static/plugin_dbui/src/form.js +++ b/static/plugin_dbui/src/form.js @@ -189,55 +189,55 @@ App.form.FormPanel = Ext.extend(Ext.form.FormPanel, { switch (type) { - // invalid response from the server, HTTP 400, 500 - // inform the user - case 'response': - Ext.Msg.alert('Error...', 'Internal server error.'); - break; + // invalid response from the server, HTTP 400, 500 + // inform the user + case 'response': + Ext.Msg.alert('Error...', 'Internal server error.'); + break; - // valid answer from the server, HTTP 200 - // something went wrong in the server validation process, ... - case 'remote': + // valid answer from the server, HTTP 200 + // something went wrong in the server validation process, ... + case 'remote': - // mark fields invalid - for (fieldName in response.errors) { - if (response.errors.hasOwnProperty(fieldName)) { - field = form.findField(fieldName); - field.markInvalid(response.errors[fieldName]); + // mark fields invalid + for (fieldName in response.errors) { + if (response.errors.hasOwnProperty(fieldName)) { + field = form.findField(fieldName); + field.markInvalid(response.errors[fieldName]); - msg += response.errors[fieldName]; - msg += '<br>'; - } + msg += response.errors[fieldName]; + msg += '<br>'; } + } - // Keep the store in synchronization with the database - // remove the new records from the store - records = arg; - - switch (action) { - case 'create': - for (i=0; i < records.length; i += 1) { - this.store.remove(records[i]); - } + // Keep the store in synchronization with the database + // remove the new records from the store + records = arg; - msg += 'The new record(s) is removed from the internal storage.<br>'; - break; + switch (action) { + case 'create': + for (i = 0; i < records.length; i += 1) { + this.store.remove(records[i]); + } - case 'update': - for (i=0; i < records.length; i += 1) { - records[i].reject(); - } + msg += 'The new record(s) is removed from the internal storage.<br>'; + break; - msg += 'The update record(s) is revert to its original values.<br>'; - break; + case 'update': + for (i = 0; i < records.length; i += 1) { + records[i].reject(); } - msg += 'The database is not modified.'; + msg += 'The update record(s) is revert to its original values.<br>'; + break; + } + + msg += 'The database is not modified.'; - // inform the user - Ext.Msg.alert(action + ' failed...', msg); + // inform the user + Ext.Msg.alert(action + ' failed...', msg); - break; + break; } }, @@ -339,31 +339,31 @@ App.form.FormPanel = Ext.extend(Ext.form.FormPanel, { switch (field.getXType()) { - // We convert the date object according to a string defined - // by the Ext.form.DateField property format. - // NOTE: by default in the json encoding, the date object - // is converted as string using iso format YYYY-MM-DDTHH:MM:SS. - // However, the string expected by the database depends on - // the date type: date, datetime or time. The format of the - // Ext.form.DateField, used by the interface, is defined in the - // property format. - - case 'datefield': - if (Ext.isDate(value)) { - value = value.format(field.format); - } - break; - - // For foreign key, the record contains the valueField - // as well as the displayField. The default action update - // the valueField but note the display field. - // The next lines append the displayField - - case 'xcombobox': - combo = field; - rec = combo.findRecord(combo.valueField, combo.getValue()); - record.set(combo.displayField, rec.get(combo.displayField)); - break; + // We convert the date object according to a string defined + // by the Ext.form.DateField property format. + // NOTE: by default in the json encoding, the date object + // is converted as string using iso format YYYY-MM-DDTHH:MM:SS. + // However, the string expected by the database depends on + // the date type: date, datetime or time. The format of the + // Ext.form.DateField, used by the interface, is defined in the + // property format. + + case 'datefield': + if (Ext.isDate(value)) { + value = value.format(field.format); + } + break; + + // For foreign key, the record contains the valueField + // as well as the displayField. The default action update + // the valueField but note the display field. + // The next lines append the displayField + + case 'xcombobox': + combo = field; + rec = combo.findRecord(combo.valueField, combo.getValue()); + record.set(combo.displayField, rec.get(combo.displayField)); + break; } record.set(field.getName(), value); diff --git a/static/plugin_dbui/src/grid.js b/static/plugin_dbui/src/grid.js index 59250ef664ca4cf59f3f7a23088e7ee1abf25e4e..c74cc41b5fbe206462a26e41f1ff1b0266306a0e 100644 --- a/static/plugin_dbui/src/grid.js +++ b/static/plugin_dbui/src/grid.js @@ -2,12 +2,12 @@ * The Grid class is Ext.grid.GridPanel with a Ext.PagingToolbar * Many functionality can be added through grid plugins like * App.grid.RowEditor, .... - * + * * The type of this component is xgrid. - * + * * @extends Ext.gridPanel * @version - * + * */ Ext.namespace('App.grid'); @@ -17,38 +17,38 @@ App.grid.Grid = Ext.extend(Ext.grid.GridPanel, { /** * @cfg nRows integer * Default number of rows display in the grid. - * This parameter is only use when running with a paging plugin. + * This parameter is only use when running with a paging plugin. */ nRows: 10, - + /** * @event resetgrid - * Can be used to reset underlying plugin when the reset + * Can be used to reset underlying plugin when the reset * method is triggered */ /** * private attributes used by plugins */ - rowEditor: null, + rowEditor: null, /** * Constructor - * + * * NOTE: * Required in ExtJS 3.4 convert rownumberer xtype * into an Ext.grid.RowNumberer. Not needed in ExtJS 4 - * + * */ constructor: function (config) { - var first_column = config.columns[0]; - - if ('xtype' in first_column && first_column.xtype === 'rownumberer') { - config.columns[0] = new Ext.grid.RowNumberer(); - } - - Ext.apply(this, config); - App.grid.Grid.superclass.constructor.call(this); + var first_column = config.columns[0]; + + if ('xtype' in first_column && first_column.xtype === 'rownumberer') { + config.columns[0] = new Ext.grid.RowNumberer(); + } + + Ext.apply(this, config); + App.grid.Grid.superclass.constructor.call(this); }, /** * private method requests by the component model of ExtJS @@ -62,7 +62,7 @@ App.grid.Grid = Ext.extend(Ext.grid.GridPanel, { this.bbar = new Ext.Toolbar(); // initialise the underlying class. DON'T MOVE - App.grid.Grid.superclass.initComponent.call(this); + App.grid.Grid.superclass.initComponent.call(this); // load the store if not yet done // if the grid paging is used load only the first 10 rows @@ -70,23 +70,22 @@ App.grid.Grid = Ext.extend(Ext.grid.GridPanel, { if (App.isPlugin(this, 'pGridPaging')) { this.store.load({params: {start: 0, limit: this.nRows}}); } else { - this.store.load(); + this.store.load(); } } }, /** * reset the grid - * The store is load with fresh data and the event 'resetgrid' is emitted. + * The store is load with fresh data and the event 'resetgrid' is emitted. * Paging and slider plugin might be reset using the 'resetgrid' event. * GridFilter object can be also reset using the same mechanism. - * + * * The scope is the grid - * + * */ reset: function () { - var action, - i; + var action; // private function to emit the resetgrid event function fireReset() { diff --git a/static/plugin_dbui/src/gridfilter.js b/static/plugin_dbui/src/gridfilter.js index 29c1c1b0fac76a64817b0ba3c236c1a23fd428de..00fb8cb08be794f9300f2349b7539432065d52f1 100644 --- a/static/plugin_dbui/src/gridfilter.js +++ b/static/plugin_dbui/src/gridfilter.js @@ -1,9 +1,9 @@ /** * The GridFilter class - * + * * Associate to grid, it contains all the logic to filter the content of a grid * according to the value define in the form. - * + * * @version * */ @@ -15,9 +15,9 @@ App.grid.GridFilter = Ext.extend(Ext.form.FieldSet, { /** * Private * Dictionary with where clause related to the filter resquest - */ + */ filterConditions: {}, - + /** * Private * Reference to the paging toolBar @@ -25,47 +25,47 @@ App.grid.GridFilter = Ext.extend(Ext.form.FieldSet, { pagingToolbar: null, /** - * Private + * Private * Reference to the grid store */ store: null, - + /** * Predefined setting - * - * NOTE: + * + * NOTE: * the enableKeyEvents is mandatory for Ext.form.TextField */ defaults: { anchor: '99%', enableKeyEvents: true }, - + /** * private method requests by the component model of ExtJS */ initComponent: function () { - var field, - fields, + var field, + fields, i; - + // initialise the underlying class. App.grid.GridFilter.superclass.initComponent.call(this); - + // associate handlers to fields fields = this.findByType('field'); for (i = 0; i < fields.length; i += 1) { field = fields[i]; - + // catch a change of value for comboBox if (field.xtype === 'xcombobox') { field.on('select', this.onChange, this); - + // catch a change of date } else if (field.xtype === 'datefield') { field.on('select', this.onChange, this); - + // catch the key pressed enter for other fields // wait that user finish to type to run the handler } else { @@ -73,25 +73,22 @@ App.grid.GridFilter = Ext.extend(Ext.form.FieldSet, { } } }, - + /** * Bind the grid filter to the grid * @param {Ext.grid.GridPanel} grid */ bind: function (grid) { - var baseParams, - i; - this.store = grid.getStore(); - + // paging toolbar ? if (App.isPlugin(grid, 'pGridPaging')) { this.pagingToolbar = grid.getBottomToolbar(); } - + // reset filter when receiving resetgrid event - // The main user case is when the pGridExpertMenu is triggered + // The main user case is when the pGridExpertMenu is triggered // to reset the grid. In that case, the filter avec to be reset too. grid.on('resetgrid', this.reset, this); }, @@ -100,7 +97,7 @@ App.grid.GridFilter = Ext.extend(Ext.form.FieldSet, { * Handler to catch a change in field value and to filter the store */ onChange: function (field) { - + // setup the filter conditions this.setupCondition(field); @@ -112,25 +109,25 @@ App.grid.GridFilter = Ext.extend(Ext.form.FieldSet, { * Handler to reset the filter and the store content */ onReset: function () { - + // reset field values and filter conditions this.reset(); - + // restore initial where condition of the store - this.store.restoreWhere(); + this.store.restoreWhere(); // update the store this.updateStore(); }, - + /** * Reset the filter conditions */ reset: function () { - + var fields = this.findByType('field'), i; - + // reset the field values for (i = 0; i < fields.length; i += 1) { fields[i].reset(); @@ -146,64 +143,64 @@ App.grid.GridFilter = Ext.extend(Ext.form.FieldSet, { */ setupCondition: function (field) { - var conditions = [], - i, - k, - value, + var conditions = [], + i, + k, + value, where; - + // get the field value value = field.getValue(); - + // handle date using the proper format if (field.xtype === 'datefield') { if (value instanceof Date) { value = value.format(field.format); } else { - return; + return; } } - + // update the condition dictionary where = field.name + " " + field.filterOperator + " '" + value + "'"; - + if (value === '') { delete this.filterConditions[field.name]; } else { this.filterConditions[field.name] = where; } - + // build the complete where clause if (this.store.initialWhere) { for (i = 0; i < this.store.initialWhere.length; i += 1) { conditions.push(this.store.initialWhere[i]); } } - + for (k in this.filterConditions) { if (this.filterConditions.hasOwnProperty(k)) { conditions.push(this.filterConditions[k]); } } - + // push new condition in the where clause of the store this.store.baseParams.where = conditions; }, - + /** * private * Helper function to load the store applying filter conditions */ updateStore: function () { - + var bbar = this.pagingToolbar, nRows, slider; - + if (bbar) { nRows = bbar.pageSize; slider = bbar.findByType('slider')[0]; - + this.store.load({params: {start: 0, limit: nRows}, callback: function() { bbar.moveFirst(); slider.setMaxValue(this.store.getTotalCount()); @@ -213,7 +210,7 @@ App.grid.GridFilter = Ext.extend(Ext.form.FieldSet, { } else { this.store.load(); - } + } } }); diff --git a/static/plugin_dbui/src/gridwithfilter.js b/static/plugin_dbui/src/gridwithfilter.js index c6bc7985366cc88772da6995ac2d127b155d236e..4a42cdfad958886865e784bad1f631fefa646a7b 100644 --- a/static/plugin_dbui/src/gridwithfilter.js +++ b/static/plugin_dbui/src/gridwithfilter.js @@ -1,10 +1,10 @@ /** * A border layout with a grid and its filter * The type of this component is xgridwithfilter. - * + * * @extends Ext.Panel * @version - * + * */ Ext.namespace('App.grid'); @@ -17,7 +17,7 @@ App.grid.GridWithFilter = Ext.extend(App.BasePanelWithSelector, { // collpase the grid filter panel this.items[1].collapsed = true; - + App.grid.GridWithFilter.superclass.initComponent.call(this); // bind the filter to the grid diff --git a/static/plugin_dbui/src/jsonstore.js b/static/plugin_dbui/src/jsonstore.js index cf18283b6aa6ef8260fa653c814bc73ea9fb1941..17243dfeb30719b2be27e6252702aeea30cb887b 100644 --- a/static/plugin_dbui/src/jsonstore.js +++ b/static/plugin_dbui/src/jsonstore.js @@ -1,17 +1,17 @@ /** * A JsonStore to read/write in the database using the EXt.Direct protocol. * Design to work with the class DbSvc on the server side. - * + * * This class is an Ext.dat.DirectStore with an Ext.data.JsonWriter. - * - * Defaults configuration parameters of the writer are defined in the - * constructor. Changing them might break the decoding running on the + * + * Defaults configuration parameters of the writer are defined in the + * constructor. Changing them might break the decoding running on the * server-side and break the behavior of the grid widget. - * + * * The default API associated to this store is defined in the constructor - * + * * The type of this component is xdirectstore. - * + * * @extends Ext.data.DirectStore * @version * * @@ -19,7 +19,7 @@ Ext.namespace('App.data'); App.data.DirectStore = Ext.extend(Ext.data.DirectStore, { - + /** * @cfg(Boolean) encode JsonWiter property, by default false * Changing this option might break the decoding running on the server-side @@ -44,23 +44,23 @@ App.data.DirectStore = Ext.extend(Ext.data.DirectStore, { /** * private parameter - * List of the where condition at startup. + * List of the where condition at startup. * It is a copy of the baseParams.where which can be modified by filter. * The intialWhere configuration parameter can be used reseting filter */ - initialWhere: undefined, + initialWhere: undefined, /** * constructor */ constructor: function (config) { - - var cfg, + + var cfg, cfgWrt, i; - // configuration option with default value for - // the Ext.data.JsonWriter. Changing these options might break + // configuration option with default value for + // the Ext.data.JsonWriter. Changing these options might break // the decoding running on the server side. cfg = Ext.apply({}, { encode: false, @@ -81,60 +81,60 @@ App.data.DirectStore = Ext.extend(Ext.data.DirectStore, { // setup the writer if (!Ext.isDefined(cfg.writer)) { cfgWrt = Ext.copyTo({}, cfg, 'encode, listful, writeAllFields'); - cfg.writer = new Ext.data.JsonWriter(cfgWrt); + cfg.writer = new Ext.data.JsonWriter(cfgWrt); } // keep a copy of the initial where condition if ('where' in cfg.baseParams) { cfg.initialWhere = []; - for (i = 0; i < cfg.baseParams.where.length; i += 1) { + for (i = 0; i < cfg.baseParams.where.length; i += 1) { cfg.initialWhere.push(cfg.baseParams.where[i]); } } - + // instantiate the store App.data.DirectStore.superclass.constructor.call(this, cfg); - // update the total number of records + // update the total number of records this.on('write', this.onWrite); }, - + /** * Handler to update the total number of records after a write action * @param {Object} store * @param {Object} action */ onWrite: function (store, action) { - + switch (action) { case 'create': store.totalLength += 1; break; - + case 'destroy': store.totalLength -= 1; break; } }, - + /** * Restore the where conditions to the original values. * Useful to remove remote filter condition. */ restoreWhere: function () { - + var i; - + if ('where' in this.baseParams) { - + if (this.initialWhere) { this.baseParams.where = []; for (i = 0; i < this.initialWhere.length; i += 1) { this.baseParams.where.push(this.initialWhere[i]); } - + } else { - delete this.baseParams.where; + delete this.baseParams.where; } } } diff --git a/static/plugin_dbui/src/linkedcombobox.js b/static/plugin_dbui/src/linkedcombobox.js index 61933663b2b496276259d7e8a9f81f969013f3d8..d3fc68be8db3e34277662183ef428e1e377488fd 100644 --- a/static/plugin_dbui/src/linkedcombobox.js +++ b/static/plugin_dbui/src/linkedcombobox.js @@ -1,33 +1,33 @@ /** * Linked combobox has been designed to solve the case when the values of - * a combobox depends on the select value of another combobox. - * - * The design is based on a master and a slave combobox which are + * a combobox depends on the select value of another combobox. + * + * The design is based on a master and a slave combobox which are * linked to a common store. - * - * The master is a standard combobox showing the values used to filter - * the common store. Values are unique and never change. + * + * The master is a standard combobox showing the values used to filter + * the common store. Values are unique and never change. * The properties role, store, displayField and valueField have to be defined. - * + * * A slave is a standard combobox. * The properties store, displayField and valueField have to be defined. * The store identifier should be the same for the master and the slave. - * + * * Several masters and slaves can be attached to a single store. - * - * @extends Ext.form.ComboBox + * + * @extends Ext.form.ComboBox * */ Ext.namespace('App.form'); App.form.LinkedComboBox = Ext.extend(Ext.form.ComboBox, { - + /** - * @cfg {String] role role of the combobox either master of slave. + * @cfg {String] role role of the combobox either master of slave. * The default is slave - */ + */ role: 'slave', - + /** * private properties * {Ext.data.Store} masterStore the common store shared by the master and slaves @@ -36,41 +36,41 @@ App.form.LinkedComboBox = Ext.extend(Ext.form.ComboBox, { /** * private method require by the ExtJS component model - */ + */ initComponent: function () { // common configuration this.triggerAction = 'all'; - + // prepare the stores for the master role if (this.role === 'master') { - + this.masterStore = App.getStore(this.store); - + this.mode = 'local'; this.store = new Ext.data.ArrayStore({ fields: [this.displayField, this.valueField] }); - this.masterStore.restoreWhere() + this.masterStore.restoreWhere(); this.masterStore.load({ - callback: this.loadMasterData, + callback: this.loadMasterData, scope: this - }); + }); } - + // prepare the store for the slave role if (this.role === 'slave') { this.store = App.getStore(this.store); - + if (!this.store.getTotalCount()) { - this.store.on('load', this.initSlave, this, {single: true}); + this.store.on('load', this.initSlave, this, {single: true}); } else { this.initSlave(); } } - + // construct the underlying class. DON'T MOVE App.form.LinkedComboBox.superclass.initComponent.call(this); @@ -78,7 +78,7 @@ App.form.LinkedComboBox = Ext.extend(Ext.form.ComboBox, { // when a value is selected in the master combobox if (this.role === 'master') { this.on('select', this.filterMasterStore, this); - + // logic to update the content of a slave // when a value is selected in the master combobox } else if (this.role === 'slave') { @@ -89,7 +89,7 @@ App.form.LinkedComboBox = Ext.extend(Ext.form.ComboBox, { /** * Helper method to filter the master store * with the current value of the combobox - * + * * @param {Ext.form.combobox} combo * @param {Ext.data.Record} record * @param {Integer} index @@ -97,12 +97,12 @@ App.form.LinkedComboBox = Ext.extend(Ext.form.ComboBox, { filterMasterStore: function (combo, record, index) { this.masterStore.filter(this.valueField, combo.getValue()); }, - + /** * Private method to initialise the slave combobox * A slave is disable at startup. - * - */ + * + */ initSlave: function () { // Reset and disable the combobox. @@ -115,25 +115,25 @@ App.form.LinkedComboBox = Ext.extend(Ext.form.ComboBox, { // on the slave combobox and then it works !!! // // In some case a window on the top left appears with - // the content of the combobox. + // the content of the combobox. // The line combo.hasFocus is a protection against this case. // - + function initialise(combo) { combo.onTriggerClick(); combo.hasFocus = false; combo.collapse(); combo.reset(); - combo.disable(); - } - + combo.disable(); + } + if (this.role !== 'slave') { return; } if (this.rendered) { initialise(this); - + } else { this.on('render', function (combo) { initialise(combo); @@ -160,7 +160,7 @@ App.form.LinkedComboBox = Ext.extend(Ext.form.ComboBox, { data.push([key, record.get(this.valueField)]); } } - + this.store.loadData(data); this.fireEvent('masterready'); }, @@ -174,7 +174,7 @@ App.form.LinkedComboBox = Ext.extend(Ext.form.ComboBox, { var value = this.store.getAt(0).get(this.valueField); this.setValue(value); this.enable(); - } + } }); Ext.reg('xlinkedcombobox', App.form.LinkedComboBox); diff --git a/static/plugin_dbui/src/panelwithurlselector.js b/static/plugin_dbui/src/panelwithurlselector.js index 298c4257d4af1775583fa7e7d68449eec356f956..d93ded3b41f5492a4ecca79f03fc8c7b1fba5582 100644 --- a/static/plugin_dbui/src/panelwithurlselector.js +++ b/static/plugin_dbui/src/panelwithurlselector.js @@ -3,40 +3,40 @@ * The selector display a list of fields organized in fieldset. * There values define the URL parameters. The main panel displays * the URL content. - * + * * Configuration for the main panel and the selelctor are set via * the option panelCfg and selectorCgf. - * + * * The URL display in the main panel is defined by the baseUrl option. * It can be modified dynamicaly by extracting the name of the * controller, function and/or extension from the selector fields. * The options ctrlField, extField and funcField associated field - * used to determine the value. + * used to determine the value. * - * Mathematical symbols will be interpreted, if the javascript library + * Mathematical symbols will be interpreted, if the javascript library * mathjax is load. Use the isMathJax property. - * + * * The type of this component is xpanelwithurlselector. - * + * * @extends App.PanelWithSelector * @version - * + * */ Ext.namespace('App'); App.PanelWithUrlSelector = Ext.extend(App.BasePanelWithSelector, { - + /** * @param {String} baseurl well form url, i.e http://blabla */ baseUrl: null, - + /** * @param {String} ctrFiedl name of the field defining the controller * When define the url become baseUrl/ctrlFieldValue */ ctrlField: null, - + /** * @param {String} extFiedl name of the field defining the extension * When define the url become baseUrl.extFieldValue @@ -48,25 +48,25 @@ App.PanelWithUrlSelector = Ext.extend(App.BasePanelWithSelector, { * When define the url become baseUrl/funcFieldValue */ funcField: null, - + /** * @param {Boolean} isMathJax True is the mathjax library is installed */ isMathJax: false, - + /** * @param {Number} Timeout timeout for the Ajax request in second */ timeout: 30, - + /** * Private attributes for internationalization */ textLoad: 'Loading...', - + /** * Require by the ExtJS model - */ + */ initComponent: function () { App.PanelWithUrlSelector.superclass.initComponent.call(this); @@ -80,7 +80,7 @@ App.PanelWithUrlSelector = Ext.extend(App.BasePanelWithSelector, { * handler to build the URL and to load it in the panel */ onGo: function() { - + var fields, i, mainPanel = this.getComponent('mainPanel'), @@ -93,25 +93,25 @@ App.PanelWithUrlSelector = Ext.extend(App.BasePanelWithSelector, { // activate the auto scrolling mainPanel.setAutoScroll(true); - + // extract basic parameters fields = selector.findByType('field'); for (i = 0; i < fields.length; i += 1) { - if(fields[i].getName() === this.ctrlField) { + if (fields[i].getName() === this.ctrlField) { urlCtrl = fields[i].getValue(); - + } else if (fields[i].getName() === this.extField) { urlExt = fields[i].getValue(); } else if (fields[i].getName() === this.funcField) { urlFunc = fields[i].getValue(); - + } else { - params[fields[i].getName()] = fields[i].getValue(); + params[fields[i].getName()] = fields[i].getValue(); } } - // extract parameters embedded in composite fields + // extract parameters embedded in composite fields fields = this.findByType('compositefield'); for (i = 0; i < fields.length; i += 1) { fields[i].items.eachKey(function(key, subfield) { @@ -131,23 +131,23 @@ App.PanelWithUrlSelector = Ext.extend(App.BasePanelWithSelector, { if (urlExt !== null) { url = url + '.' + urlExt; } - - // load url in the main panel + + // load url in the main panel mainPanel.load({ callback: this.onLoad, params: params, scope: this, text: this.textLoad, url: url, - timeout: this.timeout - }); + timeout: this.timeout + }); }, /** * Handler call when the web page is load in the panel. - * It is useful 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. * @param {Ext.Element} el the element being update * @param {boolean} success true for succes false for failure @@ -159,13 +159,13 @@ App.PanelWithUrlSelector = Ext.extend(App.BasePanelWithSelector, { var panelWithSelector = this; // errors detection - if(success === false) { + if (success === false) { el.updateManager.abort(); el.update(response.responseText); } - + // post processing - if(panelWithSelector.isMathJax) { + if (panelWithSelector.isMathJax) { MathJax.Hub.PreProcess(); MathJax.Hub.Process(); } @@ -175,12 +175,12 @@ App.PanelWithUrlSelector = Ext.extend(App.BasePanelWithSelector, { * Handler to reset the selector */ onReset: function () { - - var fields, + + var fields, i, selector = this.getComponent('selectorPanel'); - + fields = selector.findByType('field'); for (i = 0; i < fields.length; i += 1) { fields[i].reset(); diff --git a/static/plugin_dbui/src/pformtooltip.js b/static/plugin_dbui/src/pformtooltip.js index fd68a30b81dc71b68ee41807d9b4b30870af385a..962a2ac8d4cc59f0dcecfb49102f94b467162bda 100644 --- a/static/plugin_dbui/src/pformtooltip.js +++ b/static/plugin_dbui/src/pformtooltip.js @@ -1,14 +1,14 @@ /** * The form tooltip plugin - * + * * Acitvate tooltip associated to each field. * Can be used with Ext.form.FormPanel, Ext.form.Fieldset, .... * it used a dedicated Field configuration option: tipText. - * + * * The ptype of this component is pFormToolTip. - * + * * @version - * + * */ Ext.namespace('App.form'); @@ -19,12 +19,12 @@ App.form.ToolTip = Ext.extend(Object, { * Private parameter identifying the type of plugin */ ptype: 'pFormToolTip', - + /** * Plugin initialization */ init: function (basicform) { - + var form = basicform; function createToolTip(c) { @@ -35,8 +35,8 @@ App.form.ToolTip = Ext.extend(Object, { anchor: 'bottom', trackMouse: false, html: Ext.util.Format.htmlEncode(c.tipText) - }); - } + }); + } if (basicform instanceof Ext.form.FormPanel) { form = basicform.getForm(); diff --git a/static/plugin_dbui/src/pgridexpertmenu.js b/static/plugin_dbui/src/pgridexpertmenu.js index f24492d5d6665a4d5e7a15ac6cd80bb9266c0952..2ea70f297d201b47a3ee2c5e4274080829994f37 100644 --- a/static/plugin_dbui/src/pgridexpertmenu.js +++ b/static/plugin_dbui/src/pgridexpertmenu.js @@ -1,7 +1,7 @@ /** * The grid expert menu plugin for toolbar * The ptype of this component is pGridExpertMenu. - * + * */ Ext.namespace('App.grid'); @@ -17,21 +17,21 @@ App.grid.ExpertMenu = Ext.extend(Object, { */ textExport: 'Export to CSV file', textReset: 'Reset', - + /** * Plugin initialisation */ - init: function(grid){ + init: function(grid) { var bbar = grid.getBottomToolbar(), menu; - + menu = new Ext.Toolbar.SplitButton({ - menu:{ + menu: { items: [{ listeners: {click: this.onReset, scope: grid}, text: this.textReset - + }, { href: App.csvUrl + '?tableName=' + App.getTableName(grid.store), text: this.textExport @@ -39,12 +39,12 @@ App.grid.ExpertMenu = Ext.extend(Object, { } }); - bbar.add('->', menu); + bbar.add('->', menu); }, - + /** * Handler to reset grid, its filters and its paging options - */ + */ onReset: function () { var grid = this; grid.reset(); diff --git a/static/plugin_dbui/src/pgridmathjax.js b/static/plugin_dbui/src/pgridmathjax.js index 101f2c7cc383ddcdd68fa591887788c11d2265dc..cf81631278c2e77c0acf9831a8dd9c4f9d75358b 100644 --- a/static/plugin_dbui/src/pgridmathjax.js +++ b/static/plugin_dbui/src/pgridmathjax.js @@ -2,25 +2,25 @@ * Plugin to render mathematics formula embedded in grid content. * The processing is performed by MathJax. * The MathJax library is loaded by the framework - * + * * @version * */ Ext.namespace('App.grid'); - + App.grid.MathJax = Ext.extend(Object, { init: function (grid) { function processMath(gridView) { var domEl = Ext.getDom(gridView.el); - MathJax.Hub.Queue(["Typeset",MathJax.Hub, domEl]); + MathJax.Hub.Queue(["Typeset", MathJax.Hub, domEl]); } - + grid.getView().on('refresh', processMath, grid); grid.store.on('write', processMath, grid); } }); - + Ext.preg('pGridMathJax', App.grid.MathJax); diff --git a/static/plugin_dbui/src/pgridpaging.js b/static/plugin_dbui/src/pgridpaging.js index 34fb7329079a7edf8b2de4886c814784c52fe779..f77a6210fea10a572816e9fde5fb1eca864326d1 100644 --- a/static/plugin_dbui/src/pgridpaging.js +++ b/static/plugin_dbui/src/pgridpaging.js @@ -1,13 +1,13 @@ /** * The paging bottom bar plugin * The ptype of this component is pGridPaging. - * - * + * + * * NOTE: the number of row load in the grid at the first time * is defined by the grid when loading the store. - * + * * @version - * + * */ Ext.namespace('App.grid'); @@ -22,14 +22,14 @@ App.grid.Paging = Ext.extend(Object, { * Private attribute for internationalisation */ textSlider: 'Rows per page', - + /** * Plugin initialisation */ init: function (grid) { var bbar; - + // create the paging bar bbar = new Ext.PagingToolbar({store: grid.store}); @@ -37,9 +37,9 @@ App.grid.Paging = Ext.extend(Object, { grid.bottomToolbar = bbar; // add slider - bbar.add( + bbar.add( '-', - this.textSlider, + this.textSlider, { xtype: 'slider', plugins: new Ext.slider.Tip(), @@ -49,31 +49,32 @@ App.grid.Paging = Ext.extend(Object, { }, minValue: 1, width: 100 - }, '-' - ); - + }, + '-' + ); + // Initialise the parameters of the paging and slider widgets. // Depends on the status of the store. // Initialisation is only performed once. if (grid.store.getTotalCount() > 0) { - + this.onInit.call(grid, grid.store); - + } else { - + grid.store.on('load', this.onInit, grid, {single: true}); - + } - + // update the slider parameter after a write action // which destroy and create records grid.store.on('write', this.onWrite, grid); - + // reset paging and slide parameter on a grid reset grid.on('resetgrid', this.onReset, grid); - + }, - + /** * Handler to change the number of rows per page * the scope is the bottom tool bar @@ -83,41 +84,42 @@ App.grid.Paging = Ext.extend(Object, { bbar.pageSize = newValue; bbar.moveFirst(); }, - + /** * Handler to initialise the number of rows per page and the number of page * the scope is the grid */ onInit: function (store, records, options) { - var bbar, + var bbar, grid = this, - nRecords=store.getTotalCount(), - nRows = store.getCount(), + nRecords = store.getTotalCount(), + nRows = store.getCount(), slider; bbar = grid.getBottomToolbar(); bbar.pageSize = nRows; bbar.moveFirst(); - + slider = bbar.findByType('slider')[0]; slider.setMaxValue(nRecords); slider.setValue(nRows); }, - + /** * Handler to reset the paging parameters - * The scope is the grid + * The scope is the grid */ onReset: function() { var bbar, - grid = this; + grid = this, + slider; bbar = grid.getBottomToolbar(); bbar.pageSize = grid.nRows; bbar.moveFirst(); - - slider = bbar.findByType('slider')[0]; + + slider = bbar.findByType('slider')[0]; slider.setMaxValue(grid.store.getTotalCount()); slider.setValue(grid.nRows); @@ -128,18 +130,18 @@ App.grid.Paging = Ext.extend(Object, { * The scope is the bottom grid */ onWrite: function () { - + var bbar, grid = this, slider; bbar = grid.getBottomToolbar(); bbar.pageSize = grid.store.getCount(); - + slider = bbar.findByType('slider')[0]; slider.setMaxValue(grid.store.getTotalCount()); slider.setValue(grid.store.getCount()); - + } }); diff --git a/static/plugin_dbui/src/pgridroweditorbase.js b/static/plugin_dbui/src/pgridroweditorbase.js index bddaf7419ac575e76e81c6bfdafd9bea4f210597..c3985316b0baf204757ce98e279c976b8337ff92 100644 --- a/static/plugin_dbui/src/pgridroweditorbase.js +++ b/static/plugin_dbui/src/pgridroweditorbase.js @@ -1,16 +1,16 @@ /** * The grid row editor plugin * The gridRowEditor is a window containing a formPanel. - * It exposes series of handlers to delete, duplicate, update, view the + * It exposes series of handlers to delete, duplicate, update, view the * selected row of the grid, as well as to create new row. * * This plugin limit the number of selected row to one. - * + * * The ptype of this component is pgridroweditor. - * + * * @extends Ext.Window * @version - * + * */ Ext.namespace('App.grid'); @@ -33,7 +33,7 @@ App.grid.RowEditor = Ext.extend(Ext.Window, { editTitle: "Update the record...", viewTitle: "View the record...", textMsg: 'Select a row please', - + /** * pre-defined configuration options for the window */ @@ -52,23 +52,23 @@ App.grid.RowEditor = Ext.extend(Ext.Window, { init: function (grid) { var table; - + this.grid = grid; // The grid keeps track of the editor // since it can be shared between different plugins this.grid.rowEditor = this; - + // The user can only select one row of the grid this.grid.selModel = new Ext.grid.RowSelectionModel({ singleSelect: true }); - + // Add a listener to hide the window when the transaction is successful // or when the transaction failed this.grid.store.on('write', this.onWrite, this); this.grid.store.on('exception', this.onException, this); - + // get the formPanel configuration and instantiate the object table = App.getTableName(this.grid.store); Dbui.getForm(table, this.addFormPanel, this); @@ -82,14 +82,14 @@ App.grid.RowEditor = Ext.extend(Ext.Window, { */ addFormPanel: function (provider, response) { var formCfg = response.result; - + // instantiate the form this.formPanel = new App.form.FormPanel(formCfg); this.add(this.formPanel); // add a listeners to catch the store exception - this.grid.store.on('exception', - this.formPanel.onStoreException, + this.grid.store.on('exception', + this.formPanel.onStoreException, this.formPanel); }, /** @@ -110,7 +110,7 @@ App.grid.RowEditor = Ext.extend(Ext.Window, { return record; }, - + /** * Handler to add a new row. * The scope use by the handler is the plugin object. @@ -176,7 +176,7 @@ App.grid.RowEditor = Ext.extend(Ext.Window, { onException: function () { this.hide(); }, - + /** * Handler to view the selected row in the form. * The scope use by the handler is the plugin object. @@ -189,7 +189,7 @@ App.grid.RowEditor = Ext.extend(Ext.Window, { this.formPanel.setAction('view', record); this.setTitle(this.viewTitle); - this.show(); + this.show(); }, /** @@ -203,7 +203,7 @@ App.grid.RowEditor = Ext.extend(Ext.Window, { */ onWrite: function (store, action, result, transaction, record) { this.hide(); - } + } }); Ext.preg('pGridRowEditor', App.grid.RowEditor); diff --git a/static/plugin_dbui/src/pgridroweditorconfirmdelete.js b/static/plugin_dbui/src/pgridroweditorconfirmdelete.js index 9638f8cc03d464793f5093a7e4f7099f4f43f630..b9690845d5457685a082d92049f19caf1ea3ec90 100644 --- a/static/plugin_dbui/src/pgridroweditorconfirmdelete.js +++ b/static/plugin_dbui/src/pgridroweditorconfirmdelete.js @@ -1,12 +1,12 @@ /** * Extend the grid row editor plugin by adding confirmation on delete. * Have a look to App.grid.RowEditor for more information. - * + * * The ptype of this component is pGridRowEditorConfirmDelete. - * + * * @extends App.grid.RowEditor * @version - * + * */ Ext.namespace('App.grid'); @@ -22,7 +22,7 @@ App.grid.RowEditorConfirmDelete = Ext.extend(App.grid.RowEditor, { * Private attributes for internationalization */ confirmMsg: 'Do you really want to delete this item?', - + /** * Handler to delete the selected row with confirmation @@ -34,11 +34,11 @@ App.grid.RowEditorConfirmDelete = Ext.extend(App.grid.RowEditor, { var record = this.getSelected(); if (!record) {return; } - Ext.Msg.confirm(this.deleteTitle, this.confirmMsg, function(rep){ + Ext.Msg.confirm(this.deleteTitle, this.confirmMsg, function(rep) { if (rep === 'yes') { this.formPanel.setAction('destroy', record); this.setTitle(this.deleteTitle); - this.formPanel.doAction(); + this.formPanel.doAction(); } }, this); } diff --git a/static/plugin_dbui/src/pgridroweditorcontextmenu.js b/static/plugin_dbui/src/pgridroweditorcontextmenu.js index 1e8f4ada2f04f5ea31882557db57dd3c15bc8637..899a673e66390b12fbd199d602a85163bd86f778 100644 --- a/static/plugin_dbui/src/pgridroweditorcontextmenu.js +++ b/static/plugin_dbui/src/pgridroweditorcontextmenu.js @@ -3,14 +3,14 @@ * * Display the context menu when the user right click on a row. * The content of the menu allows to manipulate the App.grid.RowEditor - * + * * Requires the App.grid.GridRowEditor plugin. - * + * * The ptype of this component is pGridRowEditorContextMenu. - * + * * @extends Object * @version - * + * */ Ext.namespace('App.grid'); @@ -31,16 +31,16 @@ App.grid.RowEditorContextMenu = Ext.extend(Object, { textDuplicate: 'Duplicate', textUpdate: 'Update', textView: 'View', - + /** * Plugin initialization * @param {Object} grid */ init: function (grid) { - + var menu = new Ext.menu.Menu(); - - // protection + + // protection if (!grid.rowEditor) { throw new Error('no grid row editor !!!'); } @@ -48,7 +48,7 @@ App.grid.RowEditorContextMenu = Ext.extend(Object, { grid.addListener('containercontextmenu', this.onContainerContextMenu, menu); grid.addListener('headercontextmenu', this.onHeaderContextMenu, menu); grid.addListener('rowcontextmenu', this.onRowContextMenu, menu); - + menu.add({ text: this.textAdd, iconCls: 'xaction-create', @@ -76,16 +76,16 @@ App.grid.RowEditorContextMenu = Ext.extend(Object, { scope: grid.rowEditor }); }, - + /** * Prvate handler displaying the row context menu in an empty grid */ onContainerContextMenu: function (grid, event) { var menu = this; - + event.stopEvent(); menu.showAt(event.getXY()); - + }, /** * Private handler displaying the context menu in the header @@ -99,11 +99,11 @@ App.grid.RowEditorContextMenu = Ext.extend(Object, { * The scope use by the handler is the menu object. */ onRowContextMenu: function (grid, rowIndex, event) { - + var menu = this; - + event.stopEvent(); - grid.selModel.selectRow(rowIndex); + grid.selModel.selectRow(rowIndex); menu.showAt(event.getXY()); } diff --git a/static/plugin_dbui/src/pgridroweditordblclick.js b/static/plugin_dbui/src/pgridroweditordblclick.js index 9c10168b167b29549f012688d88c98474611234c..ac28e4e5cf677c92ed401e025a0b27944fa67cc4 100644 --- a/static/plugin_dbui/src/pgridroweditordblclick.js +++ b/static/plugin_dbui/src/pgridroweditordblclick.js @@ -2,14 +2,14 @@ * The row editor doble click plugin * * Launch the update action when the user double click on a row. - * + * * Requires the App.grid.GridRowEditor plugin. - * + * * The ptype of this component is pGridRowEditorDblClick. - * + * * @extends Object * @version - * + * */ Ext.namespace('App.grid'); @@ -20,18 +20,18 @@ App.grid.RowEditorDblClick = Ext.extend(Object, { * Private attribute identifying the type of plugin */ ptype: 'pGridRowEditorDblClick', - + /** * Plugin initialization * @param {Object} grid */ - init: function(grid){ - - // protection + init: function(grid) { + + // protection if (!grid.rowEditor) { throw new Error('no grid row editor !!!'); } - + grid.addListener('rowdblclick', grid.rowEditor.onEditRow, grid.rowEditor); } }); diff --git a/static/plugin_dbui/src/pgridroweditortoolbar.js b/static/plugin_dbui/src/pgridroweditortoolbar.js index 83d456c6da366cb80eb874a02dc99347866eb290..581b6c9155fd24f609883226b95d21e690b0aa9c 100644 --- a/static/plugin_dbui/src/pgridroweditortoolbar.js +++ b/static/plugin_dbui/src/pgridroweditortoolbar.js @@ -1,11 +1,11 @@ /** * Add a toolbar with buttons to manipulate the App.grid.RowEditor. * Requires the App.grid.GridRowEditor plugin. - * + * * The ptype of this component is pGridRowEditorToolbar. - * + * * @version - * + * */ Ext.namespace('App.grid'); @@ -15,7 +15,7 @@ App.grid.RowEditorToolbar = Ext.extend(Object, { * Private parameter identifying the type of plugin */ ptype: 'pGridRowEditorToolbar', - + /** * Plugin intiaisation * @param {Object} grid @@ -23,14 +23,14 @@ App.grid.RowEditorToolbar = Ext.extend(Object, { init: function (grid) { var toolbar; - - // protection + + // protection if (!grid.rowEditor) { throw new Error('no grid row editor !!!'); } - + toolbar = grid.getTopToolbar(); - + toolbar.add([{ text: 'Add', iconCls: 'silk-add', diff --git a/static/plugin_dbui/src/ppanelmathjax.js b/static/plugin_dbui/src/ppanelmathjax.js index 7aadcb7e6dc69dab81f7d861c391dc752d2bc9dd..9af99215eb8590e0f3903469cad575cb7b966a99 100644 --- a/static/plugin_dbui/src/ppanelmathjax.js +++ b/static/plugin_dbui/src/ppanelmathjax.js @@ -2,13 +2,13 @@ * Plugin to render mathematics formula embedded in HTML content. * The processing is performed by MathJax. * The MathJax library is loaded by the framework - * + * * @version * */ Ext.namespace('App.panel'); - + App.panel.MathJax = Ext.extend(Object, { init: function (panel) { @@ -21,9 +21,9 @@ App.panel.MathJax = Ext.extend(Object, { /** * Handler to activates the MathJax processing * when the html content of the panel is loaded. - * + * * @param {Ext.Panel} panel - */ + */ onPanelRender: function (panel) { var updater = panel.body.getUpdater(); updater.on('update', this.onProcess); @@ -31,13 +31,13 @@ App.panel.MathJax = Ext.extend(Object, { /** * Handler to run the mathJax processing - * @param {Ext.Element} el - * @param {Object} o the response object + * @param {Ext.Element} el + * @param {Object} o the response object */ onProcess: function (e, o) { MathJax.Hub.PreProcess(); MathJax.Hub.Process(); } }); - + Ext.preg('pPanelMathJax', App.panel.MathJax); diff --git a/static/plugin_dbui/src/pregexp.js b/static/plugin_dbui/src/pregexp.js index 899abe38cf175f84fdae19eb6a20155087045283..a65767dbdb91189c05070b9d88981a0588a3889b 100644 --- a/static/plugin_dbui/src/pregexp.js +++ b/static/plugin_dbui/src/pregexp.js @@ -1,13 +1,13 @@ /** * The pRegExp plugin - * - * Plugin to replace a string defining a regular expression + * + * Plugin to replace a string defining a regular expression * by a regular expression object. - * + * * Can be used with any component using the property regex. - * + * * The ptype is pRegEx. - * + * */ Ext.namespace('App'); @@ -15,8 +15,8 @@ Ext.namespace('App'); App.PRegExp = Ext.extend(Object, { init: function (component) { - - if (component.regex && typeof(component.regex) === "string") { + + if (component.regex && typeof (component.regex) === "string") { component.regex = new RegExp(component.regex); } } diff --git a/static/plugin_dbui/src/pviewportlogin.js b/static/plugin_dbui/src/pviewportlogin.js index 2000ae52506f84b6295d690d244565315fa5c481..9b33944b92fdfda8e60597ddaf9c6a4545a7758f 100644 --- a/static/plugin_dbui/src/pviewportlogin.js +++ b/static/plugin_dbui/src/pviewportlogin.js @@ -1,14 +1,14 @@ /** * Plugin to add login capabilities to the viewport * The ptype of this component is pViewportLogin. - * + * * The URL: * login → /application/admin * Change pwd → /application/default/user/change_password * Logout → /application/default/user/logout * @extends Object * @version - * + * */ Ext.namespace('App'); @@ -27,42 +27,42 @@ App.ViewportLogin = Ext.extend(Object, { textLogin: "Login...", textLogout: "Logout", textSignIn: "Sign in", - - + + /** * Plugin initialization * @param {Object} viewport */ - init: function(viewport){ + init: function(viewport) { - var inhibit_login=false, - inhibit_logout=true, + var inhibit_login = false, + inhibit_logout = true, menu, - tbar=viewport.getComponent('topBar'); - + tbar = viewport.getComponent('topBar'); + if (viewport.logged) { inhibit_login = true; inhibit_logout = false; } - + menu = new Ext.Toolbar.SplitButton({ text: this.textSignIn, - menu:{ + menu: { items: [{ disabled: inhibit_login, - href: "/"+App.name+"/admin", + href: "/" + App.name + "/admin", text: this.textLogin - + }, '-', { disabled: inhibit_logout, - href: "/"+App.name+"/default/user/change_password", + href: "/" + App.name + "/default/user/change_password", text: this.textChangePwd - + }, '-', { disabled: inhibit_logout, - href: "/"+App.name+"/default/user/logout", + href: "/" + App.name + "/default/user/logout", text: this.textLogout - + }] } }); diff --git a/static/plugin_dbui/src/viewport.js b/static/plugin_dbui/src/viewport.js index e6913aabdff8ea7a3f5a2adb25d5c840f4150dcf..50873faf5f2cf241af6e1e1279eb5adf01476494 100644 --- a/static/plugin_dbui/src/viewport.js +++ b/static/plugin_dbui/src/viewport.js @@ -1,11 +1,11 @@ /** * The Viewport for the application. - * + * * The type of this component is xviewport. - * + * * @extends Ext.Viexport * @version - * + * */ Ext.namespace('App'); @@ -15,20 +15,20 @@ App.Viewport = Ext.extend(Ext.Viewport, { * @cfg {boolean} logged true when the user pass the login procedure */ logged: false, - + /** * private shortcuts */ tabPanel: null, treePanel: null, - + /** - * constructor + * constructor * @param {Object} config */ constructor: function (config) { - var cgf, + var cfg, loader, root, treePanel, @@ -47,7 +47,7 @@ App.Viewport = Ext.extend(Ext.Viewport, { // define nodes loader loader = new Ext.tree.TreeLoader({ directFn: Dbui.getTree - }); + }); // predefined configuration of the view port cfg = { @@ -90,17 +90,17 @@ App.Viewport = Ext.extend(Ext.Viewport, { // apply the user configuration if any Ext.apply(this, cfg); - + // instanciate the viewport App.Viewport.superclass.constructor.call(this); - + // define shortcuts this.tabPanel = this.getComponent('tabPanel'); this.treePanel = this.getComponent('treePanel'); - + // Add handler to create tab and their widget this.treePanel.on('click', this.onCreateTab, this); - + // disable contextmenu in the treepanel this.treePanel.on('contextmenu', function (node, event) { event.stopEvent(); @@ -110,12 +110,12 @@ App.Viewport = Ext.extend(Ext.Viewport, { /** * Handler to create / activate a tab * The scope is the viewport - * + * * @param {Object} node * @param {Object} event */ - onCreateTab: function(node, event){ - + onCreateTab: function(node, event) { + var cfg, parent = node.parentNode, panel, @@ -123,15 +123,15 @@ App.Viewport = Ext.extend(Ext.Viewport, { viewport = this, wdgcfg = node.attributes.cfg, wdgtype = node.attributes.cfg.xtype; - + // protection - if(!node.isLeaf()){ + if (!node.isLeaf()) { return; - } + } // unique tab identifier tabId = node.attributes.text + '/' + wdgtype; - + // activate an existing tab if (this.tabPanel.getComponent(tabId)) { this.tabPanel.setActiveTab(tabId); @@ -145,17 +145,17 @@ App.Viewport = Ext.extend(Ext.Viewport, { itemId: tabId, title: parent.attributes.text + " " + node.attributes.text }; - - // embed single panel in the tab panel + + // embed single panel in the tab panel // other widget as children - if( wdgtype === 'panel') { + if (wdgtype === 'panel') { delete wdgcfg.xtype; Ext.apply(cfg, wdgcfg); - + } else { cfg.items = [node.attributes.cfg]; } - + // create a new tab and activate it panel = this.tabPanel.add(cfg); this.tabPanel.setActiveTab(tabId);