MODx.page.UpdateWebLink=function(A){A=A||{};Ext.applyIf(A,{url:MODx.config.connectors_url+"resource/index.php",which_editor:"none",formpanel:"modx-panel-resource",id:"modx-page-update-resource",actions:{"new":MODx.action["resource/create"],edit:MODx.action["resource/update"],preview:MODx.action["resource/preview"],cancel:MODx.action.welcome},components:[{xtype:"modx-panel-weblink",renderTo:"modx-panel-weblink-div",resource:A.resource,record:A.record||{},publish_document:A.publish_document,access_permissions:A.access_permissions}],loadStay:true,buttons:this.getButtons(A)});MODx.page.UpdateWebLink.superclass.constructor.call(this,A);};Ext.extend(MODx.page.UpdateWebLink,MODx.Component,{preview:function(){window.open(this.config.preview_url);return false;},duplicate:function(A,B){MODx.msg.confirm({text:_("resource_duplicate_confirm"),url:MODx.config.connectors_url+"resource/index.php",params:{action:"duplicate",id:this.config.resource},listeners:{success:{fn:function(C){location.href="?a="+MODx.action["resource/update"]+"&id="+C.object.id;},scope:this}}});},cancel:function(B,C){var A=Ext.getCmp(this.config.formpanel);if(A&&A.isDirty()){Ext.Msg.confirm(_("warning"),_("resource_cancel_dirty_confirm"),function(D){if(D=="yes"){MODx.releaseLock(MODx.request.id);MODx.sleep(400);location.href="?a="+MODx.action.welcome;}},this);}else{MODx.releaseLock(MODx.request.id);location.href="?a="+MODx.action.welcome;}},getButtons:function(A){var B=[];if(A.canSave==1){B.push({process:"update",text:_("save"),method:"remote",checkDirty:true,keys:[{key:MODx.config.keymap_save||"s",alt:true,ctrl:true}]});B.push("-");}if(A.canCreate==1){B.push({process:"duplicate",text:_("duplicate"),handler:this.duplicate,scope:this});B.push("-");}B.push({process:"preview",text:_("preview"),handler:this.preview,scope:this});B.push("-");B.push({process:"cancel",text:_("cancel"),handler:this.cancel,scope:this});B.push("-");B.push({text:_("help_ex"),handler:MODx.loadHelpPane});return B;}});Ext.reg("modx-page-weblink-update",MODx.page.UpdateWebLink);