Your IP : 3.145.59.28


Current Path : /home/bitrix/ext_www/klimatlend.ua/bitrix/js/scale/
Upload File :
Current File : /home/bitrix/ext_www/klimatlend.ua/bitrix/js/scale/action.min.js

(function(e){if(BX.Scale.Action)return;BX.Scale.Action=function(e,t){this.id=e;this.name=t.NAME;this.userParams=t.USER_PARAMS;this.freeParams={};if(t&&t.TYPE!==undefined)this.type=t.TYPE;else this.type="ACTION";if(this.type=="CHAIN"&&t.ACTIONS!==undefined)this.actions=t.ACTIONS;else if(this.type=="MODIFYED")this.allParams=t;this.currentOperation="";this.paramsDialog=null;this.async=t.ASYNC=="Y";this.pageRefresh=t.PAGE_REFRESH=="Y";this.backupAlert=t.BACKUP_ALERT=="Y";this.timeToComplete=null;this.timeToCompleteInterval=null;this.extraDbConfirm=t.CHECK_EXTRA_DB_USER_ASK=="Y";this.skipConfirmation=false};BX.Scale.Action.prototype.getUserParams=function(){var e={};if(this.type=="CHAIN")e=this.extractUserParamsFromActions();else e=this.userParams;return e};BX.Scale.Action.prototype.extractUserParamsFromActions=function(){var e={};for(var t in this.actions){var a=BX.Scale.actionsCollection.getObject(this.actions[t]).getUserParams();for(var s in a)e[s]=a[s]}return e};BX.Scale.Action.prototype.start=function(t,a,s){var i=this;if(this.backupAlert&&!s){BX.Scale.AdminFrame.confirm(BX.message("SCALE_PANEL_JS_ADVICE_TO_BACKUP"),BX.message("SCALE_PANEL_JS_ADVICE_TO_BACKUP_TITLE"),function(){e.location.href="/bitrix/admin/dump.php?lang="+BX.message("LANGUAGE_ID")},function(){i.start(t,a,true)});return}if(this.extraDbConfirm){BX.Scale.AdminFrame.confirm(BX.message("SCALE_PANEL_JS_EXTRA_DB_CONFIRM"),BX.message("SCALE_PANEL_JS_EXTRA_DB_CONFIRM_TITLE"),function(){i.extraDbConfirm=false;i.skipConfirmation=true;i.start(t,a,true)});return}var r=this.getUserParams();var n={};this.currentOperation="start";if(a!==undefined){for(var A in a){if(r&&r[A]!==undefined)r[A].DEFAULT_VALUE=a[A];else this.freeParams[A]=a[A]}}if(r!==undefined){this.paramsDialog=new BX.Scale.ActionParamsDialog({title:this.name,userParams:r,serverHostname:t,callback:this.sendRequest,context:this});this.paramsDialog.show()}else if(!this.skipConfirmation){BX.Scale.AdminFrame.confirm(BX.message("SCALE_PANEL_JS_ACT_CONFIRM")+" "+this.name.toLowerCase()+"?",BX.message("SCALE_PANEL_JS_ACT_CONFIRM_TITLE"),BX.proxy(function(){this.sendRequest({serverHostname:t,freeParams:n})},this))}else if(this.skipConfirmation){this.skipConfirmation=false;this.sendRequest({serverHostname:t,freeParams:n})}};BX.Scale.Action.prototype.showResultDialog=function(e){var t=new BX.Scale.ActionResultDialog({actionName:this.name,result:e,pageRefresh:this.pageRefresh});t.show()};BX.Scale.Action.prototype.showAsyncDialog=function(e){BX.Scale.ActionProcessDialog.addActionProcess(this.name);BX.Scale.AdminFrame.timeIntervalId=setInterval(BX.proxy(this.checkAsyncState,this),BX.Scale.AdminFrame.timeAsyncRefresh);if(e.ACTION_RESULT&&e.ACTION_RESULT[this.id]&&e.ACTION_RESULT[this.id].OUTPUT&&e.ACTION_RESULT[this.id].OUTPUT.DATA){if(e.ACTION_RESULT[this.id].OUTPUT.DATA.message)BX.Scale.ActionProcessDialog.addActionMessage(e.ACTION_RESULT[this.id].OUTPUT.DATA.message);if(e.ACTION_RESULT[this.id].OUTPUT.DATA.params){if(e.ACTION_RESULT[this.id].OUTPUT.DATA.params.task_name){BX.Scale.AdminFrame.currentAsyncActionBID=e.ACTION_RESULT[this.id].OUTPUT.DATA.params.task_name}else{for(var t in e.ACTION_RESULT[this.id].OUTPUT.DATA.params){BX.Scale.AdminFrame.currentAsyncActionBID=t;break}}}}BX.Scale.ActionProcessDialog.pageRefresh=this.pageRefresh;BX.Scale.ActionProcessDialog.show();if(BX.Scale.AdminFrame.currentAsyncActionBID.length<=0){var a;if(e.ACTION_RESULT[this.id].ERROR.length>0)a=e.ACTION_RESULT[this.id].ERROR;else if(e.ACTION_RESULT[this.id].OUTPUT&&e.ACTION_RESULT[this.id].OUTPUT.TEXT)a=e.ACTION_RESULT[this.id].OUTPUT.TEXT;else a=BX.message("SCALE_PANEL_JS_BID_ERROR");BX.Scale.ActionProcessDialog.setActionResult(false,a)}};BX.Scale.Action.prototype.checkAsyncState=function(){if(BX.Scale.AdminFrame.currentAsyncActionBID.length<=0)return false;var t={operation:"check_state",bid:BX.Scale.AdminFrame.currentAsyncActionBID};var a={onsuccess:function(e){if(this.timeToCompleteInterval!==null){BX.Scale.AdminFrame.failureAnswersCount=0;clearInterval(this.timeToCompleteInterval);this.timeToComplete=null;BX.Scale.ActionProcessDialog.addActionMessage("",true)}if(e){BX.Scale.AdminFrame.failureAnswersCount=0;if(e.ERROR.length<=0&&e.ACTION_STATE&&e.ACTION_STATE.status){if(e.ACTION_STATE.status=="finished"){clearInterval(BX.Scale.AdminFrame.timeIntervalId);BX.Scale.ActionProcessDialog.setActionResult(true,BX.message("SCALE_PANEL_JS_ACT_EXEC_SUCCESS"));BX.Scale.AdminFrame.currentAsyncActionBID=""}else if(e.ACTION_STATE.status=="error"){clearInterval(BX.Scale.AdminFrame.timeIntervalId);var t="";if(e.ACTION_STATE.error_messages){for(var a in e.ACTION_STATE.error_messages){t+=e.ACTION_STATE.error_messages[a]+"<br>"}}BX.Scale.ActionProcessDialog.setActionResult(false,t);BX.Scale.AdminFrame.currentAsyncActionBID=""}else if(e.ACTION_STATE.status=="interrupt"){clearInterval(BX.Scale.AdminFrame.timeIntervalId);BX.Scale.ActionProcessDialog.setActionResult(false,BX.message("SCALE_PANEL_JS_ACT_EXEC_INTERRUPTED"));BX.Scale.AdminFrame.currentAsyncActionBID=""}else{if(e.ACTION_STATE.status=="running"&&e.ACTION_STATE.last_action&&e.ACTION_STATE.last_action.length>0){BX.Scale.ActionProcessDialog.addActionMessage("last operation:<br>"+e.ACTION_STATE.last_action,true)}}}else if(!e.ACTION_STATE||e.ACTION_STATE.status){clearInterval(BX.Scale.AdminFrame.timeIntervalId);BX.Scale.ActionProcessDialog.setActionResult(false)}else{clearInterval(BX.Scale.AdminFrame.timeIntervalId);BX.Scale.ActionProcessDialog.setActionResult(false,BX.message("SCALE_PANEL_JS_ERROR")+" "+e.ERROR)}}else{if(BX.Scale.AdminFrame.failureAnswersCountAllow>=BX.Scale.AdminFrame.failureAnswersCount){BX.Scale.AdminFrame.failureAnswersCount++;return}clearInterval(BX.Scale.AdminFrame.timeIntervalId);BX.Scale.ActionProcessDialog.setActionResult(false,BX.message("SCALE_PANEL_JS_ACT_EXEC_ERROR"))}},onfailure:function(t,a){var s=new Date;if(t=="processing"&&a.data&&a.data.search("SCALE_SERVER_NOT_AVAILABLE")!=-1&&(this.timeToComplete===null||s.getTime()>this.timeToComplete)){var i=this;var r=this.extractTimeToComplete(a.data);if(this.timeToComplete<r)this.timeToComplete=r;this.timeToCompleteInterval=e.setInterval(function(){var e=i.makeTimeToCompleteString(i.timeToComplete);if(e)BX.Scale.ActionProcessDialog.addActionMessage(e,true)},1e3);return}if(BX.Scale.AdminFrame.failureAnswersCountAllow>=BX.Scale.AdminFrame.failureAnswersCount){BX.Scale.AdminFrame.failureAnswersCount++;return}clearInterval(BX.Scale.AdminFrame.timeIntervalId);BX.Scale.ActionProcessDialog.setActionResult(false,BX.message("SCALE_PANEL_JS_ACT_RES_ERROR"))}};BX.Scale.Communicator.sendRequest(t,a,this,false);return true};BX.Scale.Action.prototype.sendRequest=function(e){var t={actionId:this.id,serverHostname:e.serverHostname,operation:this.currentOperation},a=this;if(e.userParams!==undefined)t.userParams=e.userParams;if(this.freeParams)t.freeParams=this.freeParams;if(this.type=="MODIFYED")t.actionParams=this.allParams;var s={onsuccess:function(e){if(e){if(e.NEED_MORE_USER_INFO){this.startModifyed(e.NEED_MORE_USER_INFO);return}if(e.ERROR.length<=0){if(this.async){a.showAsyncDialog(e)}else{if(e.ACTION_RESULT&&e.ACTION_RESULT.COPY_KEY_TO_SERVER&&e.ACTION_RESULT.COPY_KEY_TO_SERVER.RESULT=="ERROR"&&e.ACTION_RESULT.COPY_KEY_TO_SERVER.OUTPUT.DATA.message.search(/^User must change password/)!=-1){BX.Scale.AdminFrame.alert(BX.message("SCALE_PANEL_JS_PASS_MUST_BE_CHANGED"),BX.message("SCALE_PANEL_JS_WARNING"),function(){BX.Scale.actionsCollection.getObject("CHANGE_PASSWD_FIRST").start(t.serverHostname,t.userParams);BX.Scale.AdminFrame.nextActionId="NEW_SERVER_CHAIN"})}else{if(BX.Scale.AdminFrame.nextActionId!=this.id&&BX.Scale.AdminFrame.nextActionId!==null&&BX.Scale.actionsCollection.getObject(BX.Scale.AdminFrame.nextActionId)){BX.Scale.actionsCollection.getObject(BX.Scale.AdminFrame.nextActionId).start(t.serverHostname,t.userParams);BX.Scale.AdminFrame.nextActionId=null}a.showResultDialog(e)}}}else{BX.Scale.AdminFrame.alert(e.ERROR,BX.message("SCALE_PANEL_JS_ERROR"))}}else{BX.Scale.AdminFrame.alert(BX.message("SCALE_PANEL_JS_ACT_EXEC_ERROR"),BX.message("SCALE_PANEL_JS_ERROR"))}},onfailure:function(){BX.Scale.AdminFrame.alert(BX.message("SCALE_PANEL_JS_ACT_RES_ERROR"),BX.message("SCALE_PANEL_JS_ERROR"))}};BX.Scale.Communicator.sendRequest(t,s,this,true)};BX.Scale.Action.prototype.extractTimeToComplete=function(e){if(!e||typeof e!="string")return false;var t=new Date,a=e.match(/availableDateTime\s=\s(\d+)/im)[1],s=e.match(/serverNow\s=\s(\d+)/im)[1],i=a-s,r=t.getTime()+i;if(t>r)r.setTime(t.getTime()+i);return r};BX.Scale.Action.prototype.makeTimeToCompleteString=function(e){var t=new Date;if(t>e)return false;var a=e-t,s=Math.floor(a/36e5),i=Math.floor(a/6e4)-s*60,r=Math.floor(a/1e3)-s*3600-i*60;s=s<10?"0"+s:s;i=i<10?"0"+i:i;r=r<10?"0"+r:r;return BX.message("SCALE_PANEL_JS_ACT_SERVER_WILL_AVAILABLE")+"<br>"+s+" "+BX.message("SCALE_PANEL_JS_ACT_HOUR")+". "+i+" "+BX.message("SCALE_PANEL_JS_ACT_MIN")+". "+r+" "+BX.message("SCALE_PANEL_JS_ACT_SEC")+"."};BX.Scale.Action.prototype.startModifyed=function(e){delete e.ACTION_PARAMS.MODIFYERS;e.ACTION_PARAMS.TYPE="MODIFYED";var t=BX.Scale.actionsCollection.addObject(e.ACTION_ID+"_MODIF",e.ACTION_PARAMS);var a=e.HOSTNAME||false;t.start(a,{},true)}})(window);
//# sourceMappingURL=action.map.js