%PDF- %PDF-
Direktori : /home/bitrix/www/bitrix/components/bitrix/lists.element.edit/templates/.default/ |
Current File : //home/bitrix/www/bitrix/components/bitrix/lists.element.edit/templates/.default/script.min.js |
BX.namespace("BX.Lists");BX.Lists.ListsElementEditClass=function(){var t=function(t){this.randomString=t.randomString;this.urlTabBp=t.urlTabBp;this.iblockTypeId=t.iblockTypeId;this.iblockId=t.iblockId;this.elementId=t.elementId;this.socnetGroupId=t.socnetGroupId;this.sectionId=t.sectionId;this.jsClass="ListsElementEditClass_"+t.randomString;this.elementUrl=t.elementUrl;this.listAction=t.listAction;this.isConstantsTuned=t.isConstantsTuned;this.init()};t.prototype.init=function(){this.ajaxUrl="/bitrix/components/bitrix/lists.element.edit/ajax.php";this.actionButton=BX("lists-title-action");this.actionPopupItems=[];this.actionPopupObject=null;this.actionPopupId="lists-title-action";BX.bind(this.actionButton,"click",BX.delegate(this.showListAction,this));if(this.isConstantsTuned)this.setConstants()};t.prototype.showListAction=function(){if(!this.actionPopupItems.length){for(var t=0;t<this.listAction.length;t++){this.actionPopupItems.push({text:this.listAction[t].text,onclick:this.listAction[t].action})}}if(!BX.PopupMenu.getMenuById(this.actionPopupId)){var s=this.actionButton.getBoundingClientRect();this.actionPopupObject=BX.PopupMenu.create(this.actionPopupId,this.actionButton,this.actionPopupItems,{closeByEsc:true,angle:true,offsetLeft:s.width/2,events:{onPopupShow:BX.proxy(function(){BX.addClass(this.actionButton,"webform-button-active")},this),onPopupClose:BX.proxy(function(){BX.removeClass(this.actionButton,"webform-button-active")},this)}})}if(this.actionPopupObject)this.actionPopupObject.popupWindow.show()};t.prototype.completeWorkflow=function(t,s){BX.Lists.ajax({method:"POST",dataType:"json",url:BX.Lists.addToLinkParam(this.ajaxUrl,"action","completeWorkflow"),data:{workflowId:t,iblockTypeId:this.iblockTypeId,elementId:this.elementId,iblockId:this.iblockId,socnetGroupId:this.socnetGroupId,sectionId:this.sectionId,action:s},onsuccess:BX.delegate(function(t){if(t.status=="success"){BX.Lists.showModalWithStatusAction({status:"success",message:t.message});setTimeout(BX.delegate(function(){document.location.href=this.urlTabBp},this),1e3)}else{t.errors=t.errors||[{}];BX.Lists.showModalWithStatusAction({status:"error",message:t.errors.pop().message})}},this)})};t.prototype.setConstants=function(){BX.Lists.ajax({method:"POST",dataType:"json",url:BX.Lists.addToLinkParam(this.ajaxUrl,"action","isConstantsTuned"),data:{iblockTypeId:this.iblockTypeId,iblockId:this.iblockId,socnetGroupId:this.socnetGroupId,sectionId:this.sectionId},onsuccess:BX.delegate(function(t){if(t.status=="success"){if(t.admin===false){this.notifyAdmin()}else{this.fillConstants(t.templateData)}}else{t.errors=t.errors||[{}];BX.Lists.showModalWithStatusAction({status:"error",message:t.errors.pop().message})}},this)})};t.prototype.fillConstants=function(t){if(!t){return}var s="";BX.Lists.ajax({method:"POST",dataType:"html",url:BX.Lists.addToLinkParam(this.ajaxUrl,"action","fillConstants"),data:{iblockId:this.iblockId,listTemplateId:t},onsuccess:BX.delegate(function(t){s=BX.create("div",{props:{className:"lists-fill-constants-content"},html:t});var e=BX.Lists.modalWindow({modalId:"bx-lists-popup",withoutWindowManager:true,title:BX.message("CT_BLEE_BIZPROC_CONSTANTS_FILL_TITLE"),autoHide:false,overlay:false,draggable:true,contentStyle:{width:"600px",paddingTop:"10px",paddingBottom:"10px"},content:[s],events:{onPopupClose:function(){this.destroy()}},buttons:[BX.create("a",{text:BX.message("CT_BLEE_BIZPROC_SAVE_BUTTON"),props:{className:"webform-small-button webform-small-button-accept"},events:{click:BX.delegate(function(t){var i=BX.findChild(s,{tag:"FORM"},true);if(i){i.modalWindow=e;i.onsubmit(i,t)}})}}),BX.create("a",{text:BX.message("CT_BLEE_BIZPROC_CANCEL_BUTTON"),props:{className:"webform-small-button webform-button-cancel"},events:{click:BX.delegate(function(t){if(!!e)e.close()},this)}})]})},this)})};t.prototype.notifyAdmin=function(){BX.Lists.ajax({method:"POST",dataType:"json",url:BX.Lists.addToLinkParam(this.ajaxUrl,"action","getListAdmin"),data:{iblockId:this.iblockId,iblockTypeId:this.iblockTypeId,socnetGroupId:this.socnetGroupId,sectionId:this.sectionId},onsuccess:BX.delegate(function(t){if(t.status=="success"){var s=this.createHtmlNotifyAdmin(t.listAdmin);BX("lists-notify-admin-popup-content").appendChild(s);BX.Lists.modalWindow({modalId:"bx-lists-popup",title:BX.message("CT_BLEE_BIZPROC_NOTIFY_TITLE"),overlay:false,draggable:true,contentStyle:{width:"600px",paddingTop:"10px",paddingBottom:"10px"},content:[BX("lists-notify-admin-popup-content")],events:{onPopupClose:function(){BX("lists-notify-admin-popup").appendChild(BX("lists-notify-admin-popup-content"));this.destroy()}},buttons:[BX.create("a",{text:BX.message("CT_BLEE_BIZPROC_NOTIFY_ADMIN_BUTTON_CLOSE"),props:{className:"webform-small-button webform-button-cancel"},events:{click:BX.delegate(function(t){BX.PopupWindowManager.getCurrentPopup().close()},this)}})]})}else{t.errors=t.errors||[{}];BX.Lists.showModalWithStatusAction({status:"error",message:t.errors.pop().message})}},this)})};t.prototype.notify=function(t){if(!BX("lists-notify-button-"+t)){return}BX("lists-notify-button-"+t).setAttribute("onclick","");BX.Lists.ajax({method:"POST",dataType:"json",url:BX.Lists.addToLinkParam(this.ajaxUrl,"action","notifyAdmin"),data:{iblockId:this.iblockId,userId:t,iblockTypeId:this.iblockTypeId,socnetGroupId:this.socnetGroupId,sectionId:this.sectionId,elementUrl:this.elementUrl},onsuccess:BX.delegate(function(s){if(s.status=="success"){BX.Lists.removeElement(BX("lists-notify-button-"+t));BX("lists-notify-success-"+t).innerHTML=s.message}else{BX("lists-notify-button-"+t).setAttribute("onclick",'BX.Lists["'+this.jsClass+'"].notify("'+t+'");');s.errors=s.errors||[{}];BX.Lists.showModalWithStatusAction({status:"error",message:s.errors.pop().message})}},this)})};t.prototype.createHtmlNotifyAdmin=function(t){if(!t){return null}var s;s=BX.create("div",{children:[BX.create("span",{props:{className:"lists-notify-question"},children:[BX.create("span",{props:{innerHTML:"!",className:"icon"}}),BX.create("span",{props:{innerHTML:BX.message("CT_BLEE_BIZPROC_SELECT_STAFF_SET_RESPONSIBLE")}})]}),BX.create("p",{html:BX.message("CT_BLEE_BIZPROC_NOTIFY_ADMIN_TEXT_ONE")}),BX.create("p",{html:BX.message("CT_BLEE_BIZPROC_NOTIFY_ADMIN_TEXT_TWO")}),BX.create("span",{props:{className:"lists-notify-question-title"},html:BX.message("CT_BLEE_BIZPROC_NOTIFY_ADMIN_MESSAGE")})]});for(var e in t){var i;if(t[e].img){i=BX.create("img",{attrs:{src:t[e].img}})}s.appendChild(BX.create("div",{props:{className:"lists-notify-question-item"},children:[BX.create("a",{props:{className:"lists-notify-question-item-avatar"},attrs:{href:"javascript:void(0)"},children:[BX.create("span",{props:{id:"lists-notify-question-item-avatar-inner",className:"lists-notify-question-item-avatar-inner"},children:[i]})]}),BX.create("span",{props:{className:"lists-notify-question-item-info"},children:[BX.create("span",{html:t[e].name})]}),BX.create("span",{props:{id:"lists-notify-success-"+t[e].id,className:"lists-notify-success"}}),BX.create("a",{props:{id:"lists-notify-button-"+t[e].id,className:"webform-small-button lists-notify-small-button webform-small-button-blue"},attrs:{href:"javascript:void(0)",onclick:'BX.Lists["'+this.jsClass+'"].notify("'+t[e].id+'");'},html:BX.message("CT_BLEE_BIZPROC_NOTIFY_ADMIN_MESSAGE_BUTTON")})]}))}return s};t.prototype.elementDelete=function(t,s){var e=document.getElementById(t);var i=document.getElementById("action");if(e&&i){BX.Lists.modalWindow({modalId:"bx-lists-migrate-list",title:BX.message("CT_BLEE_DELETE_POPUP_TITLE"),contentClassName:"",draggable:true,contentStyle:{width:"400px",padding:"20px 20px 20px 20px"},events:{onPopupClose:function(){this.destroy()}},content:s,buttons:[BX.create("span",{text:BX.message("CT_BLEE_DELETE_POPUP_ACCEPT_BUTTON"),props:{className:"webform-small-button webform-small-button-accept"},events:{click:BX.delegate(function(){BX.PopupWindowManager.getCurrentPopup().close();i.value="delete";e.submit()},this)}}),BX.create("span",{text:BX.message("CT_BLEE_DELETE_POPUP_CANCEL_BUTTON"),props:{className:"popup-window-button popup-window-button-link popup-window-button-link-cancel"},events:{click:BX.delegate(function(){BX.PopupWindowManager.getCurrentPopup().close()},this)}})]})}};return t}();