Your IP : 3.22.130.105


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

(function(a){if(BX.Scale.ActionParamsDialog)return;BX.Scale.ActionParamsDialog=function(a){this.title=a.title;this.userParams=a.userParams;this.serverHostname=a.serverHostname;this.callback=a.callback;this.context=a.context;this.dialogWindow=null;this.params={};this.requiredParamsEmptyty={};this.startButtonId="butt_action_start";this.startButtonDisabled=false;this.confirmParams={}};BX.Scale.ActionParamsDialog.prototype.show=function(){var a=this.buildContent();BX.Scale.currentActionDialogContext=this;this.dialogWindow=new BX.CDialog({title:this.title,content:a,resizable:true,buttons:[{title:BX.message("SCALE_PANEL_JS_APD_BUT_START"),id:this.startButtonId,name:this.startButtonId,className:"adm-btn-save",action:BX.proxy(this.returnParamsValues,BX.Scale.currentActionDialogContext)},BX.CAdminDialog.btnCancel]});BX.addCustomEvent(this.dialogWindow,"onWindowClose",function(a){a.DIV.parentNode.removeChild(a.DIV)});if(!BX.Scale.isObjEmpty(this.requiredParamsEmptyty)){this.disableStartButton()}this.dialogWindow.adjustSizeEx();this.dialogWindow.Show()};BX.Scale.ActionParamsDialog.prototype.buildContent=function(){var a=BX.create("DIV"),t=BX.create("form",{props:{id:"action_params_dialog_form"}}),e=BX.create("table");for(var i in this.userParams){if(!this.userParams.hasOwnProperty(i))continue;switch(this.userParams[i].TYPE){case"STRING":case"PASSWORD":this.params[i]=new BX.Scale.ActionsParamsTypes.String(i,this.userParams[i]);if(this.userParams[i].VERIFY_TWICE=="Y"){var s={};for(var r in this.userParams[i])s[r]=this.userParams[i][r];s.NAME+=" ("+BX.message("SCALE_PANEL_JS_APD_2_CONFIRM")+")";this.confirmParams[i]=new BX.Scale.ActionsParamsTypes.String(i+"_confirm",s)}break;case"CHECKBOX":this.params[i]=new BX.Scale.ActionsParamsTypes.Checkbox(i,this.userParams[i]);break;case"DROPDOWN":this.params[i]=new BX.Scale.ActionsParamsTypes.Dropdown(i,this.userParams[i]);break;case"TEXT":this.params[i]=new BX.Scale.ActionsParamsTypes.Text(i,this.userParams[i]);break;case"FILE":this.params[i]=new BX.Scale.ActionsParamsTypes.File(i,this.userParams[i]);break;case"REMOTE_AND_LOCAL_PATH":this.params[i]=new BX.Scale.ActionsParamsTypes.RemoteAndLocalPath(i,this.userParams[i]);break}if(this.params[i])e.appendChild(this.createParamNodeRaw(this.params[i]));if(this.confirmParams[i])e.appendChild(this.createParamNodeRaw(this.confirmParams[i]))}t.appendChild(e);a.appendChild(t);BX.addCustomEvent("BXScaleActionParamKeyUp",BX.proxy(this.onParamFieldKeyUp,this));return a};BX.Scale.ActionParamsDialog.prototype.createParamNodeRaw=function(a){if(!BX.type.isElementNode(a.domNode))return false;var t=BX.create("tr"),e=BX.create("span",{props:{innerHTML:a.name+": "}});if(a.required!==undefined&&a.required=="Y"){BX.addClass(e,"adm-required-field");if(!a.defaultValue||a.defaultValue.length<=0)this.requiredParamsEmptyty[a.id]=true;else this.requiredParamsEmptyty[a.id]=false}var i=a.domNode;if(a.domNode.type=="file")i=BX.adminFormTools.modifyFile(i);var s=BX.create("td",{style:{textAlign:"right",width:"40%"}});s.appendChild(e);t.appendChild(s);s=BX.create("td",{style:{textAlign:"left",width:"60%"}});s.appendChild(i);t.appendChild(s);return t};BX.Scale.ActionParamsDialog.prototype.isAllRequiredParamsFilled=function(){var a=true;for(var t in this.requiredParamsEmptyty){if(this.requiredParamsEmptyty[t]){a=false;break}}return a};BX.Scale.ActionParamsDialog.prototype.enableStartButton=function(){this.disableStartButton(true)};BX.Scale.ActionParamsDialog.prototype.disableStartButton=function(a){var t=BX(this.startButtonId);if(t&&t.disabled!==undefined){var e=!a;t.disabled=e;this.startButtonDisabled=e}};BX.Scale.ActionParamsDialog.prototype.onParamFieldKeyUp=function(a){if(this.requiredParamsEmptyty[a.paramId]!==undefined){this.requiredParamsEmptyty[a.paramId]=a.empty;if(this.isAllRequiredParamsFilled()==this.startButtonDisabled)this.disableStartButton(this.startButtonDisabled)}this.addSitePatch(a)};BX.Scale.ActionParamsDialog.prototype.returnParamsValues=function(){var a={},t,e;for(var i in this.params){if(!this.params.hasOwnProperty(i))continue;t=this.params[i].getValue();if(this.confirmParams[i]){e=this.confirmParams[i].getValue();if(t!=e){var s=BX.message("SCALE_PANEL_JS_APD_2_NOT_CONCIDE");s=s.replace("##FIELD1##",this.params[i].name);s=s.replace("##FIELD2##",this.confirmParams[i].name);BX.Scale.AdminFrame.alert(s,BX.message("SCALE_PANEL_JS_WARNING"));return false}}a[i]=t}this.dialogWindow.Close();if(typeof this.callback=="function")this.callback.call(this.context,{userParams:a,serverHostname:this.serverHostname});return a};BX.Scale.ActionParamsDialog.prototype.addSitePatch=function(a){if(a.paramId!=="SITE_NAME")return;var t=BX("action_user_param_SITE_NAME").value;BX("action_user_param_SITE_PATH").value=t}})(window);