panel.plugins.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. VersionX.panel.Plugins = function(config) {
  2. config = config || {};
  3. Ext.apply(config,{
  4. id: 'versionx-panel-plugins',
  5. border: false,
  6. forceLayout: true,
  7. width: '98%',
  8. items: [{
  9. layout: 'column',
  10. border: false,
  11. items: [{
  12. columnWidth:.5,
  13. layout: 'form',
  14. border: false,
  15. items: [{
  16. xtype: (VersionX.inVersion) ? 'hidden' : 'textfield', //'versionx-combo-plugins',
  17. fieldLabel: _('plugin'),
  18. name: 'fltr_plugin',
  19. width: '95%',
  20. id: 'plugin-f-plugin',
  21. value: (VersionX.inVersion) ? MODx.request.id : ''
  22. },{
  23. xtype: 'modx-combo-user',
  24. fieldLabel: _('user'),
  25. name: 'fltr_user',
  26. hiddenName: 'fltr_user',
  27. anchor: '1',
  28. id: 'plugin-f-user'
  29. },{
  30. xtype: 'datefield',
  31. fieldLabel: _('versionx.filter.datefrom'),
  32. name: 'fltr_from',
  33. anchor: '1',
  34. id: 'plugin-f-from'
  35. }]
  36. },{
  37. columnWidth:.5,
  38. layout: 'form',
  39. border: false,
  40. items: [{
  41. xtype: (VersionX.inVersion) ? 'hidden' : 'modx-combo-category',
  42. fieldLabel: _('category'),
  43. name: 'fltr_category',
  44. anchor: '1',
  45. id: 'plugin-f-category'
  46. },{
  47. fieldLabel: '',
  48. style: 'height: 36px !important',
  49. border: false
  50. },{
  51. xtype: 'datefield',
  52. fieldLabel: _('versionx.filter.dateuntil'),
  53. name: 'fltr_until',
  54. anchor: '1',
  55. id: 'plugin-f-until'
  56. }]
  57. }]
  58. },{
  59. layout: 'column',
  60. padding: '10px 0 0 0',
  61. border: false,
  62. defaults: {
  63. border: false
  64. },
  65. items: [{
  66. width: 90,
  67. items: [{
  68. border: false,
  69. html: ' '
  70. }]
  71. },{
  72. items: [{
  73. xtype: 'button',
  74. cls: 'primary-button',
  75. handler: this.doFilter,
  76. text: _('versionx.filter',{what: _('plugins')})
  77. }]
  78. },{
  79. items: [{
  80. xtype: 'button',
  81. handler: this.resetFilter,
  82. text: _('versionx.filter.reset')
  83. }]
  84. },{
  85. columnWidth: 1,
  86. items: [{
  87. html: ' ',
  88. border: false
  89. }]
  90. }]
  91. }],
  92. listeners: {
  93. 'success': function () {}
  94. }
  95. });
  96. VersionX.panel.Plugins.superclass.constructor.call(this,config);
  97. };
  98. Ext.extend(VersionX.panel.Plugins,MODx.Panel,{
  99. doFilter: function() {
  100. var g = Ext.getCmp('versionx-grid-plugins');
  101. if (g) {
  102. g.baseParams['plugin'] = Ext.getCmp('plugin-f-plugin').getValue();
  103. g.baseParams['category'] = Ext.getCmp('plugin-f-category').getValue();
  104. g.baseParams['user'] = Ext.getCmp('plugin-f-user').getValue();
  105. g.baseParams['from'] = Ext.getCmp('plugin-f-from').getValue();
  106. g.baseParams['until'] = Ext.getCmp('plugin-f-until').getValue();
  107. g.getBottomToolbar().changePage(1);
  108. g.refresh();
  109. }
  110. },
  111. resetFilter: function() {
  112. var g = Ext.getCmp('versionx-grid-plugins');
  113. g.baseParams['plugin'] = (VersionX.inVersion) ? MODx.request.id : '';
  114. g.baseParams['category'] = '';
  115. g.baseParams['user'] = '';
  116. g.baseParams['from'] = '';
  117. g.baseParams['until'] = '';
  118. g.getBottomToolbar().changePage(1);
  119. g.refresh();
  120. Ext.getCmp('plugin-f-plugin').reset();
  121. Ext.getCmp('plugin-f-category').reset();
  122. Ext.getCmp('plugin-f-user').reset();
  123. Ext.getCmp('plugin-f-from').reset();
  124. Ext.getCmp('plugin-f-until').reset();
  125. }
  126. });
  127. Ext.reg('versionx-panel-plugins',VersionX.panel.Plugins);