//>>built define("pd/widgets/SaveDialog",["dojo/_base/declare","bux/dialogs/FileDialog","dojo/_base/array"],function(_1,_2,_3){var _4=_1("pd/widgets/FileDialog",[_2],{createSpecialLocationsUiElements:function(_5){if(!_5){this.onCancel();return;}this._topLevelNodes=_5;for(var i=_5.length-1;i>=0;i--){this._addSpecialLocationFromTreeView(_5[i]);}this.onSpecialLocationsClick("myFolders");this._locationSelector.dropDown=this._locationSelector.createMenu();this._locationSelector.startup();},_addSpecialLocationFromTreeView:function(_6){this.inherited(arguments);var _7=_6.i.bux$uiclass;var _8=this._leftSectionSpecialLocations.domNode.childNodes;var _9=_8[_8.length-1];if(_7=="publicFolders"){pd.setSupplementId(_9,"PUBLISH_DIALOG_PUBLIC_FOLDERS");}else{if(_7=="myFolders"){pd.setSupplementId(_9,"PUBLISH_DIALOG_MY_FOLDERS");}}},onNewFolderButtonClick:function(){this.inherited(arguments);if(this.simplePromptDialog){var _a=this.simplePromptDialog.textField;pd.setSupplementId(_a.domNode,"PUBLISH_DIALOG_NEW_FOLDER_NAME_INPUT");pd.setSupplementId(_a.oDlgBtns[0].domNode,"PUBLISH_DIALOG_NEW_FOLDER_OK_BUTTON");pd.setSupplementId(_a.oDlgBtns[1].domNode,"PUBLISH_DIALOG_NEW_FOLDER_CANCEL_BUTTON");}},_newFolderErrHandler:function(_b,_c){var _d=BUXMSG.FDG.IDS_FDG_NEW_FOLDER_ERROR_DESC;var _e=(_c.message&&(_c.message.indexOf("CM-REQ-4024")>=0||_c.message.indexOf("BUX-ACM-1507")>=0))||_c.status==409;if(_e){_d=dojo.string.substitute(BUXMSG.FDG.IDS_FDG_NEW_FOLDER_ALREADY_EXISTS_ERROR,[bux.Bidi.enforceTextDir(_b)]);}else{this.simplePromptDialog.destroyRecursive();delete this.simplePromptDialog;}return pd.messageBox(pd.statics.MB_ERROR,BUXMSG.FDG.IDS_FDG_NEW_FOLDER_ERROR,_d,_c.message);}});var _f=_1("pd/widgets/SaveDialog",[bux.dialogs.SaveDialog,_4],{constructor:function(_10){this.inherited(arguments);this.pdDefaultName=_10.pdDefaultName;var _11=["refresh","createNewFolder"];dojo.mixin(bux.IWidgetUtils,{getIWidgetById:function(){return {iScope:{isOperationAllowed:function(_12){return _3.indexOf(_11,_12)!=-1;}}};}});},checkAndEnableMainAction:function(_13){var _14=this._objectNameField.get("value");if(bux.Bidi.getTextDir()){if(!_13&&dojo.isIE){this._objectNameField.focusNode.style.overflowX="visible";}if(!_13||!_13.keyCode||bux.Bidi.doesKeyImpactsDir(_13.keyCode)){bux.Bidi.setInputDirByValue(this._objectNameField.domNode,_14);}}var _15=(((this.oCurrentPath&&(this.oCurrentPath.bux$uiclass=="myFolders"||this.oCurrentPath.bux$uiclass=="publicFolders"))||(_13&&bux.CMHelper.hasPermissions(_13.cm$permissions,"WT&")&&this._getCurrentNodeFromView()))&&(_14&&dojo.trim(_14).length>0?true:false));if(this._aButtonObjects&&this._aButtonObjects[0]){this._aButtonObjects[0].set("disabled",!_15);}this._bCanExecuteAction=_15;return _15;},onMainAction:function(){if(this.saveAsHandler){var _16=this._objectNameField.get("value");if(-1!=_16.indexOf("'")&&-1!=_16.indexOf("\"")){bux.messageBox(bux.MB_ERROR,BUXMSG.CDG.IDS_CDG_SAVE_CHANGE_NAME_TITLE,dojo.string.substitute(BUXMSG.EDG.IDS_EDG_ERROR_MIXED_USE_QUOTES,[bux.Bidi.enforceTextDir(_16)]));return;}var _17=this._getCurrentNodeFromView();var _18=null;if(_17){var _19=_17.getItem();if(_19&&_19.cm$objectClass!="folder"&&_19.cm$objectClass!="package"){_18=_17.getParent();}else{_18=_17;}}var _1a=this.saveAsHandler;var _1b=null;var _1c=this.callBackFunction;if(_16&&_18&&this.getCurrentTreeView().getNodeLink(_18,"up")){_1b=this.getCurrentTreeView().getNodeLink(_18,"self");}else{if((this.oCurrentPath.bux$uiclass=="myFolders"||this.oCurrentPath.bux$uiclass=="publicFolders")&&_16){var _1d=dojox.json.query("?rel='self'",this.oCurrentPath.link);_1b=_1d[0].href;}}var _1e={"i":this._getCurrentSelectedContainer()};if(_1b){if(this.treeView){this.treeView.clearTree();}if(this.listView){this.listView.clearTree();}this.hide();setTimeout(function(){_1a(_16,_1b,_1c,_1e);},10);}else{window.alert(BUXMSG.FDG.IDS_FDG_INVALID_ARGUMENTS);}}},startup:function(){this.inherited(arguments);this._objectNameField.set("value",this.pdDefaultName);pd.setSupplementId(this.domNode,"PUBLISH_DIALOG");pd.setSupplementId(this._aButtonObjects[0].domNode,"PUBLISH_DIALOG_PUBLISH_BUTTON");pd.setSupplementId(this._aButtonObjects[1].domNode,"PUBLISH_DIALOG_CANCEL_BUTTON");pd.setSupplementId(this.newFolderButton.domNode,"PUBLISH_DIALOG_NEW_FOLDER");pd.setSupplementId(this._objectNameField.domNode,"PUBLISH_DIALOG_NAME_INPUT");}});return _f;});