Commit ef6a48d4d9e73dea7c0104117e0526777c44199b
Exists in
master
and in
10 other branches
Merge branch 'FER_7862' into amdadev
Showing
5 changed files
with
95 additions
and
22 deletions
Show diff stats
@@ -0,0 +1,29 @@ | @@ -0,0 +1,29 @@ | ||
1 | +<p> | ||
2 | +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 "<b><i>Clear Filters</i></b>" button at top right of the grid which will erase all filters applied on screen.<br/> | ||
3 | +</p> | ||
4 | +<p> | ||
5 | +The mechanism is the same for integer and double type columns.<br/> | ||
6 | +Once in the filter menu you will see three boxes you are able to fill: | ||
7 | +<ul> | ||
8 | + <li><b><i> '>'</i></b> box: returns on screen intervals where the values of the filtered column are higher than the number filled in the box.</li> | ||
9 | + <li><b><i> '<'</i></b> box: returns on screen intervals where the values of the filtered column are lower than the number filled in the box.</li> | ||
10 | + <li><b><i> '='</i></b> box: returns on screen intervals where the values of the filtered column are the same than the number filled in the box.</li> | ||
11 | +</ul> | ||
12 | +</p> | ||
13 | + | ||
14 | +<p> | ||
15 | +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 | ||
16 | +</p> | ||
17 | + | ||
18 | +<p> | ||
19 | +For the date filter, the boxes are self-explanatory: | ||
20 | +<ul> | ||
21 | + <li><b><i> 'before'</i></b> box: returns on screen intervals where the values of the filtered column are before than the date filled in the box.</li> | ||
22 | + <li><b><i> 'after'</i></b> box: returns on screen intervals where the values of the filtered column are after than the date filled in the box.</li> | ||
23 | + <li><b><i> 'on'</i></b> box: returns on screen intervals where the values of the filtered column are the same than the date filled in the box.</li> | ||
24 | +</ul> | ||
25 | +</p> | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + |
js/app/views/CatalogUI.js
@@ -17,6 +17,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -17,6 +17,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
17 | 'Ext.ux.grid.filter.DateFilter', | 17 | 'Ext.ux.grid.filter.DateFilter', |
18 | 'Ext.ux.grid.filter.NumericFilter', | 18 | 'Ext.ux.grid.filter.NumericFilter', |
19 | 'Ext.ux.grid.filter.StringFilter', | 19 | 'Ext.ux.grid.filter.StringFilter', |
20 | + 'amdaUI.CustomFilters', | ||
20 | 'amdaUI.OperationsTT', | 21 | 'amdaUI.OperationsTT', |
21 | 'amdaUI.DescriptionField', | 22 | 'amdaUI.DescriptionField', |
22 | 'Ext.grid.plugin.BufferedRenderer', | 23 | 'Ext.grid.plugin.BufferedRenderer', |
@@ -377,7 +378,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -377,7 +378,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
377 | updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '1'); | 378 | updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '1'); |
378 | } | 379 | } |
379 | }, | 380 | }, |
380 | - filter: {type: 'numeric'} | 381 | + filter: {type: 'customnumericfilter'} |
381 | }, | 382 | }, |
382 | { | 383 | { |
383 | xtype: 'gridcolumn', | 384 | xtype: 'gridcolumn', |
@@ -397,7 +398,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -397,7 +398,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
397 | updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '2'); | 398 | updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '2'); |
398 | } | 399 | } |
399 | }, | 400 | }, |
400 | - filter: {type: 'numeric'} | 401 | + filter: {type: 'customnumericfilter'} |
401 | }, | 402 | }, |
402 | { | 403 | { |
403 | xtype: 'gridcolumn', | 404 | xtype: 'gridcolumn', |
@@ -417,7 +418,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -417,7 +418,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
417 | updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '3'); | 418 | updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '3'); |
418 | } | 419 | } |
419 | }, | 420 | }, |
420 | - filter: {type: 'numeric'} | 421 | + filter: {type: 'customnumericfilter'} |
421 | }, | 422 | }, |
422 | { | 423 | { |
423 | xtype: 'gridcolumn', | 424 | xtype: 'gridcolumn', |
@@ -437,7 +438,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -437,7 +438,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
437 | updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '4'); | 438 | updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '4'); |
438 | } | 439 | } |
439 | }, | 440 | }, |
440 | - filter: {type: 'numeric'} | 441 | + filter: {type: 'customnumericfilter'} |
441 | } | 442 | } |
442 | ]; | 443 | ]; |
443 | var pramColumnWidth = 120 * (1 - 0.7 * (1 - 1 / result.parameters.length)); | 444 | var pramColumnWidth = 120 * (1 - 0.7 * (1 - 1 / result.parameters.length)); |
@@ -462,7 +463,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -462,7 +463,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
462 | xtype: 'gridcolumn', | 463 | xtype: 'gridcolumn', |
463 | width: pramColumnWidth * parseInt(obj.size), | 464 | width: pramColumnWidth * parseInt(obj.size), |
464 | editor: 'textfield', | 465 | editor: 'textfield', |
465 | - filter: {type: 'numeric', menuItemCfgs: {decimalPrecision: 10}}, | 466 | + filter: {type: 'customnumericfilter', menuItemCfgs: {decimalPrecision: 10}}, |
466 | renderer :function(value){ | 467 | renderer :function(value){ |
467 | return (value == "NAN") ? "nan": value; | 468 | return (value == "NAN") ? "nan": value; |
468 | }, | 469 | }, |
@@ -488,7 +489,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -488,7 +489,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
488 | hideTrigger: true, | 489 | hideTrigger: true, |
489 | format: 'Y-m-d\\TH:i:s.u' | 490 | format: 'Y-m-d\\TH:i:s.u' |
490 | }, | 491 | }, |
491 | - filter: {type: 'date', dateFormat: 'Y-m-d'}, | 492 | + filter: {type: 'customdatefilter', dateFormat: 'Y-m-d'}, |
492 | renderer: function (value) { | 493 | renderer: function (value) { |
493 | if (value != null) { | 494 | if (value != null) { |
494 | if (Ext.isDate(value)) { | 495 | if (Ext.isDate(value)) { |
@@ -510,14 +511,14 @@ Ext.define('amdaUI.CatalogUI', { | @@ -510,14 +511,14 @@ Ext.define('amdaUI.CatalogUI', { | ||
510 | xtype: 'gridcolumn', | 511 | xtype: 'gridcolumn', |
511 | width: pramColumnWidth * parseInt(obj.size), | 512 | width: pramColumnWidth * parseInt(obj.size), |
512 | editor: 'textfield', | 513 | editor: 'textfield', |
514 | + filter: {type: 'customstringfilter'}, | ||
513 | renderer :function(value){ | 515 | renderer :function(value){ |
514 | var renderedVal = value; | 516 | var renderedVal = value; |
515 | if(value.toLowerCase().startsWith("http://") ||value.toLowerCase().startsWith("https://")) { | 517 | if(value.toLowerCase().startsWith("http://") ||value.toLowerCase().startsWith("https://")) { |
516 | renderedVal = '<a href="' + value + '" target="_blank">' + value +'</a>'; | 518 | renderedVal = '<a href="' + value + '" target="_blank">' + value +'</a>'; |
517 | } | 519 | } |
518 | return renderedVal; | 520 | return renderedVal; |
519 | - }, | ||
520 | - filter: {type: 'string'} | 521 | + } |
521 | }); | 522 | }); |
522 | break; | 523 | break; |
523 | case 3: //int | 524 | case 3: //int |
@@ -528,7 +529,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -528,7 +529,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
528 | xtype: 'gridcolumn', | 529 | xtype: 'gridcolumn', |
529 | width: pramColumnWidth * parseInt(obj.size), | 530 | width: pramColumnWidth * parseInt(obj.size), |
530 | editor: 'textfield', | 531 | editor: 'textfield', |
531 | - filter: {type: 'numeric'} | 532 | + filter: {type: 'customnumericfilter'} |
532 | }); | 533 | }); |
533 | break; | 534 | break; |
534 | default: | 535 | default: |
@@ -539,7 +540,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -539,7 +540,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
539 | xtype: 'gridcolumn', | 540 | xtype: 'gridcolumn', |
540 | width: pramColumnWidth * parseInt(obj.size), | 541 | width: pramColumnWidth * parseInt(obj.size), |
541 | editor: 'textfield', | 542 | editor: 'textfield', |
542 | - filter: {type: 'string'} | 543 | + filter: {type: 'customstringfilter'} |
543 | }); | 544 | }); |
544 | } | 545 | } |
545 | fieldsConfig.push(field); | 546 | fieldsConfig.push(field); |
@@ -1041,6 +1042,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -1041,6 +1042,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
1041 | 1042 | ||
1042 | init: function (config) | 1043 | init: function (config) |
1043 | { | 1044 | { |
1045 | + amdaUI.CustomFilters.init(); | ||
1044 | var me = this; | 1046 | var me = this; |
1045 | this.object = config.object; | 1047 | this.object = config.object; |
1046 | this.fieldName = new Ext.form.field.Text({ | 1048 | this.fieldName = new Ext.form.field.Text({ |
@@ -0,0 +1,40 @@ | @@ -0,0 +1,40 @@ | ||
1 | +// File: CustomFilters.js | ||
2 | + | ||
3 | +Ext.define('amdaUI.CustomFilters', { | ||
4 | + singleton: true, // Ensure only one instance is created | ||
5 | + | ||
6 | + init: function () { | ||
7 | + this.initCustomFilter('Numeric', 'NumericFilter', 'numericfilter'); | ||
8 | + this.initCustomFilter('Date', 'DateFilter', 'datefilter'); | ||
9 | + this.initCustomFilter('String', 'StringFilter', 'stringfilter'); | ||
10 | + }, | ||
11 | + | ||
12 | + initCustomFilter: function (filterName, filterClass, aliasSuffix) { | ||
13 | + Ext.define('amdaUI.Custom' + filterName + 'Filter', { | ||
14 | + extend: 'Ext.ux.grid.filter.' + filterClass, | ||
15 | + alias: 'gridfilter.custom' + aliasSuffix, | ||
16 | + | ||
17 | + helpTitle: 'Help on ' + filterName + ' filter', | ||
18 | + helpFile: 'catalogTTFilterHelp', | ||
19 | + | ||
20 | + init: function () { | ||
21 | + var me = this; | ||
22 | + this.callParent(); // Ensure parent initialization | ||
23 | + | ||
24 | + // Add custom help menu item | ||
25 | + this.menu.add(Ext.create('Ext.menu.Item', { | ||
26 | + text: 'Help on filters', | ||
27 | + iconCls: 'icon-help', | ||
28 | + listeners: { | ||
29 | + click: function (item, e, eOpts) { | ||
30 | + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function (module) { | ||
31 | + module.createWindow(me.helpFile, me.helpTitle); | ||
32 | + }); | ||
33 | + } | ||
34 | + } | ||
35 | + })); | ||
36 | + } | ||
37 | + }); | ||
38 | + } | ||
39 | +}); | ||
40 | + |
js/app/views/TimeTableUI.js
@@ -16,6 +16,7 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -16,6 +16,7 @@ Ext.define('amdaUI.TimeTableUI', { | ||
16 | 'Ext.ux.grid.FiltersFeature', | 16 | 'Ext.ux.grid.FiltersFeature', |
17 | 'Ext.ux.grid.filter.DateFilter', | 17 | 'Ext.ux.grid.filter.DateFilter', |
18 | 'Ext.ux.grid.filter.NumericFilter', | 18 | 'Ext.ux.grid.filter.NumericFilter', |
19 | + 'amdaUI.CustomFilters', | ||
19 | 'amdaUI.OperationsTT', | 20 | 'amdaUI.OperationsTT', |
20 | 'amdaUI.StatisticalPlug', | 21 | 'amdaUI.StatisticalPlug', |
21 | 'amdaUI.DescriptionField', | 22 | 'amdaUI.DescriptionField', |
@@ -399,6 +400,7 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -399,6 +400,7 @@ Ext.define('amdaUI.TimeTableUI', { | ||
399 | 400 | ||
400 | init: function (config) | 401 | init: function (config) |
401 | { | 402 | { |
403 | + amdaUI.CustomFilters.init(); | ||
402 | this.object = config.object; | 404 | this.object = config.object; |
403 | 405 | ||
404 | this.fieldName = new Ext.form.field.Text({ | 406 | this.fieldName = new Ext.form.field.Text({ |
@@ -508,12 +510,12 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -508,12 +510,12 @@ Ext.define('amdaUI.TimeTableUI', { | ||
508 | encode: true, // json encode the filter query | 510 | encode: true, // json encode the filter query |
509 | local: false, // defaults to false (remote filte | 511 | local: false, // defaults to false (remote filte |
510 | filters: [ | 512 | filters: [ |
511 | - {type: 'numeric', dataIndex: 'durationDay'}, | ||
512 | - {type: 'numeric', dataIndex: 'durationHour'}, | ||
513 | - {type: 'numeric', dataIndex: 'durationMin'}, | ||
514 | - {type: 'numeric', dataIndex: 'durationSec'}, | ||
515 | - {type: 'date', dataIndex: 'start', dateFormat: 'c'}, | ||
516 | - {type: 'date', dataIndex: 'stop', dateFormat: 'c'} | 513 | + {type: 'customnumericfilter', dataIndex: 'durationDay'}, |
514 | + {type: 'customnumericfilter', dataIndex: 'durationHour'}, | ||
515 | + {type: 'customnumericfilter', dataIndex: 'durationMin'}, | ||
516 | + {type: 'customnumericfilter', dataIndex: 'durationSec'}, | ||
517 | + {type: 'customdatefilter', dataIndex: 'start', dateFormat: 'c'}, | ||
518 | + {type: 'customdatefilter', dataIndex: 'stop', dateFormat: 'c'} | ||
517 | ] | 519 | ] |
518 | }; | 520 | }; |
519 | var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', { | 521 | var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', { |
php/classes/CatalogCacheFilterObject.php
@@ -47,9 +47,9 @@ class CatalogCacheFilterPartObject extends TimeTableCacheFilterPartObject | @@ -47,9 +47,9 @@ class CatalogCacheFilterPartObject extends TimeTableCacheFilterPartObject | ||
47 | $param_value = floatval($params[$this->paramId]); | 47 | $param_value = floatval($params[$this->paramId]); |
48 | switch ($this->op) { | 48 | switch ($this->op) { |
49 | case self::$OPERATION_LT : | 49 | case self::$OPERATION_LT : |
50 | - return ($param_value < $this->value); | ||
51 | - case self::$OPERATION_GT : | ||
52 | return ($param_value > $this->value); | 50 | return ($param_value > $this->value); |
51 | + case self::$OPERATION_GT : | ||
52 | + return ($param_value < $this->value); | ||
53 | case self::$OPERATION_EQ : | 53 | case self::$OPERATION_EQ : |
54 | return ($param_value != $this->value); | 54 | return ($param_value != $this->value); |
55 | default : | 55 | default : |
@@ -62,9 +62,9 @@ class CatalogCacheFilterPartObject extends TimeTableCacheFilterPartObject | @@ -62,9 +62,9 @@ class CatalogCacheFilterPartObject extends TimeTableCacheFilterPartObject | ||
62 | $param_value = intval($params[$this->paramId]); | 62 | $param_value = intval($params[$this->paramId]); |
63 | switch ($this->op) { | 63 | switch ($this->op) { |
64 | case self::$OPERATION_LT : | 64 | case self::$OPERATION_LT : |
65 | - return ($param_value < $this->value); | ||
66 | - case self::$OPERATION_GT : | ||
67 | return ($param_value > $this->value); | 65 | return ($param_value > $this->value); |
66 | + case self::$OPERATION_GT : | ||
67 | + return ($param_value < $this->value); | ||
68 | case self::$OPERATION_EQ : | 68 | case self::$OPERATION_EQ : |
69 | return (!(($param_value >= $this->value) && ($param_value <= $this->value+86400))); | 69 | return (!(($param_value >= $this->value) && ($param_value <= $this->value+86400))); |
70 | default : | 70 | default : |
@@ -84,9 +84,9 @@ class CatalogCacheFilterPartObject extends TimeTableCacheFilterPartObject | @@ -84,9 +84,9 @@ class CatalogCacheFilterPartObject extends TimeTableCacheFilterPartObject | ||
84 | $param_value = intval($params[$this->paramId]); | 84 | $param_value = intval($params[$this->paramId]); |
85 | switch ($this->op) { | 85 | switch ($this->op) { |
86 | case self::$OPERATION_LT : | 86 | case self::$OPERATION_LT : |
87 | - return ($param_value < $this->value); | ||
88 | - case self::$OPERATION_GT : | ||
89 | return ($param_value > $this->value); | 87 | return ($param_value > $this->value); |
88 | + case self::$OPERATION_GT : | ||
89 | + return ($param_value < $this->value); | ||
90 | case self::$OPERATION_EQ : | 90 | case self::$OPERATION_EQ : |
91 | return ($param_value != $this->value); | 91 | return ($param_value != $this->value); |
92 | default : | 92 | default : |