diff --git a/help/catalogTTFilterHelp b/help/catalogTTFilterHelp new file mode 100644 index 0000000..5087cf6 --- /dev/null +++ b/help/catalogTTFilterHelp @@ -0,0 +1,29 @@ +

+The filter function is an only on-screen function, nothing will be saved untill you decide to save the catalog or time table. There is also a "Clear Filters" button at top right of the grid which will erase all filters applied on screen.
+

+

+The mechanism is the same for integer and double type columns.
+Once in the filter menu you will see three boxes you are able to fill: +

+

+ +

+For the filter on a string column, there is only one box. The filter will return on screen the intervals where the value of the filtered column contains the filled string of characters +

+ +

+For the date filter, the boxes are self-explanatory: +

+

+ + + + diff --git a/js/app/views/CatalogUI.js b/js/app/views/CatalogUI.js index 21f25e2..362fb8d 100644 --- a/js/app/views/CatalogUI.js +++ b/js/app/views/CatalogUI.js @@ -17,6 +17,10 @@ Ext.define('amdaUI.CatalogUI', { 'Ext.ux.grid.filter.DateFilter', 'Ext.ux.grid.filter.NumericFilter', 'Ext.ux.grid.filter.StringFilter', + // 'amdaUI.CustomNumericFilter', + // 'amdaUI.CustomStringFilter', + // 'amdaUI.CustomDateFilter', + 'amdaUI.CustomFilters', 'amdaUI.OperationsTT', 'amdaUI.DescriptionField', 'Ext.grid.plugin.BufferedRenderer', @@ -377,7 +381,7 @@ Ext.define('amdaUI.CatalogUI', { updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '1'); } }, - filter: {type: 'numeric'} + filter: {type: 'customnumericfilter'} }, { xtype: 'gridcolumn', @@ -397,7 +401,7 @@ Ext.define('amdaUI.CatalogUI', { updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '2'); } }, - filter: {type: 'numeric'} + filter: {type: 'customnumericfilter'} }, { xtype: 'gridcolumn', @@ -417,7 +421,7 @@ Ext.define('amdaUI.CatalogUI', { updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '3'); } }, - filter: {type: 'numeric'} + filter: {type: 'customnumericfilter'} }, { xtype: 'gridcolumn', @@ -437,7 +441,7 @@ Ext.define('amdaUI.CatalogUI', { updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '4'); } }, - filter: {type: 'numeric'} + filter: {type: 'customnumericfilter'} } ]; var pramColumnWidth = 120 * (1 - 0.7 * (1 - 1 / result.parameters.length)); @@ -462,7 +466,7 @@ Ext.define('amdaUI.CatalogUI', { xtype: 'gridcolumn', width: pramColumnWidth * parseInt(obj.size), editor: 'textfield', - filter: {type: 'numeric', menuItemCfgs: {decimalPrecision: 10}}, + filter: {type: 'customnumericfilter', menuItemCfgs: {decimalPrecision: 10}}, renderer :function(value){ return (value == "NAN") ? "nan": value; }, @@ -488,7 +492,7 @@ Ext.define('amdaUI.CatalogUI', { hideTrigger: true, format: 'Y-m-d\\TH:i:s.u' }, - filter: {type: 'date', dateFormat: 'Y-m-d'}, + filter: {type: 'customdatefilter', dateFormat: 'Y-m-d'}, renderer: function (value) { if (value != null) { if (Ext.isDate(value)) { @@ -510,14 +514,14 @@ Ext.define('amdaUI.CatalogUI', { xtype: 'gridcolumn', width: pramColumnWidth * parseInt(obj.size), editor: 'textfield', + filter: {type: 'customstringfilter'}, renderer :function(value){ var renderedVal = value; if(value.toLowerCase().startsWith("http://") ||value.toLowerCase().startsWith("https://")) { renderedVal = '' + value +''; } return renderedVal; - }, - filter: {type: 'string'} + } }); break; case 3: //int @@ -528,7 +532,7 @@ Ext.define('amdaUI.CatalogUI', { xtype: 'gridcolumn', width: pramColumnWidth * parseInt(obj.size), editor: 'textfield', - filter: {type: 'numeric'} + filter: {type: 'customnumericfilter'} }); break; default: @@ -539,7 +543,7 @@ Ext.define('amdaUI.CatalogUI', { xtype: 'gridcolumn', width: pramColumnWidth * parseInt(obj.size), editor: 'textfield', - filter: {type: 'string'} + filter: {type: 'customstringfilter'} }); } fieldsConfig.push(field); @@ -1041,6 +1045,7 @@ Ext.define('amdaUI.CatalogUI', { init: function (config) { + amdaUI.CustomFilters.init(); var me = this; this.object = config.object; this.fieldName = new Ext.form.field.Text({ diff --git a/js/app/views/CustomFilters.js b/js/app/views/CustomFilters.js new file mode 100644 index 0000000..d895692 --- /dev/null +++ b/js/app/views/CustomFilters.js @@ -0,0 +1,40 @@ +// File: CustomFilters.js + +Ext.define('amdaUI.CustomFilters', { + singleton: true, // Ensure only one instance is created + + init: function () { + this.initCustomFilter('Numeric', 'NumericFilter', 'numericfilter'); + this.initCustomFilter('Date', 'DateFilter', 'datefilter'); + this.initCustomFilter('String', 'StringFilter', 'stringfilter'); + }, + + initCustomFilter: function (filterName, filterClass, aliasSuffix) { + Ext.define('amdaUI.Custom' + filterName + 'Filter', { + extend: 'Ext.ux.grid.filter.' + filterClass, + alias: 'gridfilter.custom' + aliasSuffix, + + helpTitle: 'Help on ' + filterName + ' filter', + helpFile: 'catalogTTFilterHelp', + + init: function () { + var me = this; + this.callParent(); // Ensure parent initialization + + // Add custom help menu item + this.menu.add(Ext.create('Ext.menu.Item', { + text: 'Help on filters', + iconCls: 'icon-help', + listeners: { + click: function (item, e, eOpts) { + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function (module) { + module.createWindow(me.helpFile, me.helpTitle); + }); + } + } + })); + } + }); + } +}); + diff --git a/php/classes/CatalogCacheFilterObject.php b/php/classes/CatalogCacheFilterObject.php index c30a899..fc4a285 100644 --- a/php/classes/CatalogCacheFilterObject.php +++ b/php/classes/CatalogCacheFilterObject.php @@ -47,9 +47,9 @@ class CatalogCacheFilterPartObject extends TimeTableCacheFilterPartObject $param_value = floatval($params[$this->paramId]); switch ($this->op) { case self::$OPERATION_LT : - return ($param_value < $this->value); - case self::$OPERATION_GT : return ($param_value > $this->value); + case self::$OPERATION_GT : + return ($param_value < $this->value); case self::$OPERATION_EQ : return ($param_value != $this->value); default : @@ -62,9 +62,9 @@ class CatalogCacheFilterPartObject extends TimeTableCacheFilterPartObject $param_value = intval($params[$this->paramId]); switch ($this->op) { case self::$OPERATION_LT : - return ($param_value < $this->value); - case self::$OPERATION_GT : return ($param_value > $this->value); + case self::$OPERATION_GT : + return ($param_value < $this->value); case self::$OPERATION_EQ : return (!(($param_value >= $this->value) && ($param_value <= $this->value+86400))); default : @@ -84,9 +84,9 @@ class CatalogCacheFilterPartObject extends TimeTableCacheFilterPartObject $param_value = intval($params[$this->paramId]); switch ($this->op) { case self::$OPERATION_LT : - return ($param_value < $this->value); - case self::$OPERATION_GT : return ($param_value > $this->value); + case self::$OPERATION_GT : + return ($param_value < $this->value); case self::$OPERATION_EQ : return ($param_value != $this->value); default : -- libgit2 0.21.2