Commit 8046f4eece3dfeb2415bbe208c869c3d21f7766e

Authored by Erdogan Furkan
1 parent 8da1cb76

#7862-Done

help/catalogTTFilterHelp 0 → 100644
... ... @@ -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,10 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
17 17 'Ext.ux.grid.filter.DateFilter',
18 18 'Ext.ux.grid.filter.NumericFilter',
19 19 'Ext.ux.grid.filter.StringFilter',
  20 + // 'amdaUI.CustomNumericFilter',
  21 + // 'amdaUI.CustomStringFilter',
  22 + // 'amdaUI.CustomDateFilter',
  23 + 'amdaUI.CustomFilters',
20 24 'amdaUI.OperationsTT',
21 25 'amdaUI.DescriptionField',
22 26 'Ext.grid.plugin.BufferedRenderer',
... ... @@ -377,7 +381,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
377 381 updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '1');
378 382 }
379 383 },
380   - filter: {type: 'numeric'}
  384 + filter: {type: 'customnumericfilter'}
381 385 },
382 386 {
383 387 xtype: 'gridcolumn',
... ... @@ -397,7 +401,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
397 401 updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '2');
398 402 }
399 403 },
400   - filter: {type: 'numeric'}
  404 + filter: {type: 'customnumericfilter'}
401 405 },
402 406 {
403 407 xtype: 'gridcolumn',
... ... @@ -417,7 +421,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
417 421 updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '3');
418 422 }
419 423 },
420   - filter: {type: 'numeric'}
  424 + filter: {type: 'customnumericfilter'}
421 425 },
422 426 {
423 427 xtype: 'gridcolumn',
... ... @@ -437,7 +441,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
437 441 updateDurationColumnsVisibility(this.ownerCt.getGridColumns(), amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '4');
438 442 }
439 443 },
440   - filter: {type: 'numeric'}
  444 + filter: {type: 'customnumericfilter'}
441 445 }
442 446 ];
443 447 var pramColumnWidth = 120 * (1 - 0.7 * (1 - 1 / result.parameters.length));
... ... @@ -462,7 +466,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
462 466 xtype: 'gridcolumn',
463 467 width: pramColumnWidth * parseInt(obj.size),
464 468 editor: 'textfield',
465   - filter: {type: 'numeric', menuItemCfgs: {decimalPrecision: 10}},
  469 + filter: {type: 'customnumericfilter', menuItemCfgs: {decimalPrecision: 10}},
466 470 renderer :function(value){
467 471 return (value == "NAN") ? "nan": value;
468 472 },
... ... @@ -488,7 +492,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
488 492 hideTrigger: true,
489 493 format: 'Y-m-d\\TH:i:s.u'
490 494 },
491   - filter: {type: 'date', dateFormat: 'Y-m-d'},
  495 + filter: {type: 'customdatefilter', dateFormat: 'Y-m-d'},
492 496 renderer: function (value) {
493 497 if (value != null) {
494 498 if (Ext.isDate(value)) {
... ... @@ -510,14 +514,14 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
510 514 xtype: 'gridcolumn',
511 515 width: pramColumnWidth * parseInt(obj.size),
512 516 editor: 'textfield',
  517 + filter: {type: 'customstringfilter'},
513 518 renderer :function(value){
514 519 var renderedVal = value;
515 520 if(value.toLowerCase().startsWith("http://") ||value.toLowerCase().startsWith("https://")) {
516 521 renderedVal = '<a href="' + value + '" target="_blank">' + value +'</a>';
517 522 }
518 523 return renderedVal;
519   - },
520   - filter: {type: 'string'}
  524 + }
521 525 });
522 526 break;
523 527 case 3: //int
... ... @@ -528,7 +532,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
528 532 xtype: 'gridcolumn',
529 533 width: pramColumnWidth * parseInt(obj.size),
530 534 editor: 'textfield',
531   - filter: {type: 'numeric'}
  535 + filter: {type: 'customnumericfilter'}
532 536 });
533 537 break;
534 538 default:
... ... @@ -539,7 +543,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
539 543 xtype: 'gridcolumn',
540 544 width: pramColumnWidth * parseInt(obj.size),
541 545 editor: 'textfield',
542   - filter: {type: 'string'}
  546 + filter: {type: 'customstringfilter'}
543 547 });
544 548 }
545 549 fieldsConfig.push(field);
... ... @@ -1041,6 +1045,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
1041 1045  
1042 1046 init: function (config)
1043 1047 {
  1048 + amdaUI.CustomFilters.init();
1044 1049 var me = this;
1045 1050 this.object = config.object;
1046 1051 this.fieldName = new Ext.form.field.Text({
... ...
js/app/views/CustomFilters.js 0 → 100644
... ... @@ -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 +
... ...
php/classes/CatalogCacheFilterObject.php
... ... @@ -47,9 +47,9 @@ class CatalogCacheFilterPartObject extends TimeTableCacheFilterPartObject
47 47 $param_value = floatval($params[$this->paramId]);
48 48 switch ($this->op) {
49 49 case self::$OPERATION_LT :
50   - return ($param_value < $this->value);
51   - case self::$OPERATION_GT :
52 50 return ($param_value > $this->value);
  51 + case self::$OPERATION_GT :
  52 + return ($param_value < $this->value);
53 53 case self::$OPERATION_EQ :
54 54 return ($param_value != $this->value);
55 55 default :
... ... @@ -62,9 +62,9 @@ class CatalogCacheFilterPartObject extends TimeTableCacheFilterPartObject
62 62 $param_value = intval($params[$this->paramId]);
63 63 switch ($this->op) {
64 64 case self::$OPERATION_LT :
65   - return ($param_value < $this->value);
66   - case self::$OPERATION_GT :
67 65 return ($param_value > $this->value);
  66 + case self::$OPERATION_GT :
  67 + return ($param_value < $this->value);
68 68 case self::$OPERATION_EQ :
69 69 return (!(($param_value >= $this->value) && ($param_value <= $this->value+86400)));
70 70 default :
... ... @@ -84,9 +84,9 @@ class CatalogCacheFilterPartObject extends TimeTableCacheFilterPartObject
84 84 $param_value = intval($params[$this->paramId]);
85 85 switch ($this->op) {
86 86 case self::$OPERATION_LT :
87   - return ($param_value < $this->value);
88   - case self::$OPERATION_GT :
89 87 return ($param_value > $this->value);
  88 + case self::$OPERATION_GT :
  89 + return ($param_value < $this->value);
90 90 case self::$OPERATION_EQ :
91 91 return ($param_value != $this->value);
92 92 default :
... ...