update.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * @class MODx.page.UpdateContext
  3. * @extends MODx.Component
  4. * @param {Object} config An object of config properties
  5. * @xtype modx-page-context-update
  6. */
  7. MODx.page.UpdateContext = function(config) {
  8. config = config || {};
  9. Ext.applyIf(config,{
  10. formpanel: 'modx-panel-context'
  11. ,actions: {
  12. 'new': 'context/create'
  13. ,edit: 'context/update'
  14. ,'delete': 'context/delete'
  15. ,cancel: 'context/view'
  16. }
  17. ,buttons: [{
  18. process: 'context/update'
  19. ,text: _('save')
  20. ,id: 'modx-abtn-save'
  21. ,cls:'primary-button'
  22. ,method: 'remote'
  23. // ,checkDirty: true
  24. ,keys: [{
  25. key: MODx.config.keymap_save || "s"
  26. ,ctrl: true
  27. }]
  28. },{
  29. text: _('duplicate')
  30. ,id: 'modx-abtn-duplicate'
  31. ,handler: this.duplicateContext
  32. ,scope: this
  33. ,hidden: !MODx.perm.new_context
  34. },{
  35. process: 'cancel'
  36. ,text: _('cancel')
  37. ,id: 'modx-abtn-cancel'
  38. ,params: {
  39. a: 'context'
  40. }
  41. },{
  42. text: _('help_ex')
  43. ,id: 'modx-abtn-help'
  44. ,handler: MODx.loadHelpPane
  45. }]
  46. ,components: [{
  47. xtype: 'modx-panel-context'
  48. ,context: MODx.request.key
  49. }]
  50. });
  51. MODx.page.UpdateContext.superclass.constructor.call(this,config);
  52. };
  53. Ext.extend(MODx.page.UpdateContext,MODx.Component, {
  54. duplicateContext: function(e) {
  55. var r = {
  56. key: MODx.request.key
  57. ,newkey: ''
  58. };
  59. var w = MODx.load({
  60. xtype: 'modx-window-context-duplicate'
  61. ,record: r
  62. ,listeners: {
  63. 'success': {fn:function() {
  64. var tree = Ext.getCmp('modx-resource-tree');
  65. if (tree) {
  66. tree.refresh();
  67. }
  68. },scope:this}
  69. }
  70. });
  71. w.show();
  72. }
  73. });
  74. Ext.reg('modx-page-context-update',MODx.page.UpdateContext);