systemsettings.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. if (typeof MODx.grid.SystemSettings != 'undefined') {
  2. Ext.apply(MODx.grid.SystemSettings.prototype, {
  3. filterByNamespace: function (cb, rec, ri) {
  4. var init = typeof ri == 'undefined';
  5. var ns = init ? adminToolsSettings.systemSettings.namespace : rec.data.name;
  6. var area = init ? adminToolsSettings.systemSettings.area : '';
  7. Ext.getCmp('modx-filter-namespace').setValue(ns);
  8. this.getStore().baseParams['namespace'] = ns;
  9. this.getStore().baseParams['area'] = area;
  10. this.getBottomToolbar().changePage(1);
  11. //this.refresh();
  12. var acb = Ext.getCmp('modx-filter-area');
  13. if (acb) {
  14. var s = acb.store;
  15. s.baseParams['namespace'] = ns;
  16. s.removeAll();
  17. s.load();
  18. acb.setValue(area);
  19. }
  20. if (!init) {
  21. Ext.Ajax.request({
  22. url: adminToolsSettings.config.connector_url
  23. , params: {
  24. action: 'mgr/systemsettings/savestate',
  25. namespace: ns,
  26. area: ''
  27. }
  28. , success: function (r) {
  29. var res = Ext.decode(r.responseText);
  30. adminToolsSettings.systemSettings = res.object;
  31. }
  32. , scope: this
  33. });
  34. }
  35. },
  36. filterByArea: function (cb, rec, ri) {
  37. this.getStore().baseParams['area'] = rec.data['v'];
  38. this.getBottomToolbar().changePage(1);
  39. Ext.Ajax.request({
  40. url: adminToolsSettings.config.connector_url
  41. , params: {
  42. action: 'mgr/systemsettings/savestate',
  43. namespace: adminToolsSettings.systemSettings.namespace,
  44. area: rec.data['v']
  45. }
  46. , success: function (r) {
  47. var res = Ext.decode(r.responseText);
  48. adminToolsSettings.systemSettings = res.object;
  49. }
  50. , scope: this
  51. });
  52. }
  53. });
  54. }