AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.12.161.0
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/bitrix/www/bitrix/js/bizproc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/bitrix/www/bitrix/js/bizproc//bp_selector.min.js
(function(){var e=window.BX;e.namespace("BX.Bizproc");if(e.Bizproc.Selector)return;e.Bizproc.Selector={delimiter:"=",listenKeyCode:187,listenKey:"=",currentData:{},inputElement:null,popup:null,selectedTab:null,activitiesItemsCache:null};const t=e.Extension.getSettings("bp_selector").get("functions");const s=!t?[]:t.map((e=>({text:e.name,description:e.description,value:"{{="+e.name+"()}}"})));Object.freeze(s);e.Bizproc.Selector.initSelectors=function(t){if(!t)t=document;var s,i,a,r=t.querySelectorAll('[data-role="bp-selector-button"]');if(r){for(a=0;a<r.length;++a){i=JSON.parse(r[a].getAttribute("data-bp-selector-props"));if(typeof i!=="object")continue;s=document.getElementById(i.controlId);if(!s)continue;e.bind(s,"keydown",(function(t){e.Bizproc.Selector.onSearch(this,t)}));s.setAttribute("autocomplete","off")}}};e.Bizproc.Selector.getTabItems=function(e){var t;for(t=0;t<this.currentData.length;++t){if(this.currentData[t]["tabId"]===e)return this.currentData[t]["items"]}return[]};e.Bizproc.Selector.getActivitiesItems=function(e){if(this.activitiesItemsCache===null||e){this.activitiesItemsCache=this.getTemplateActivitiesItems([rootActivity.Serialize()],arAllActivities)}return this.activitiesItemsCache};e.Bizproc.Selector.getTemplateActivitiesItems=function(t,s){var i=[],a,r,o,l,n;for(a=0,r=t.length;a<r;++a){o=t[a].Type.toLowerCase();if(s[o])l=s[o];if(l&&l["RETURN"]){for(n in l["RETURN"]){if(!l["RETURN"].hasOwnProperty(n))continue;i.push({text:l["RETURN"][n].NAME,description:t[a].Properties.Title||l.NAME,value:"{="+t[a].Name+":"+n+"}",propertyObject:t[a].Name,propertyField:n,property:{Name:l["RETURN"][n].NAME,Type:l["RETURN"][n].TYPE,Options:l["RETURN"][n].OPTIONS||null}})}}else if(l&&e.type.isArray(l["ADDITIONAL_RESULT"])){var c=t[a]["Properties"];l["ADDITIONAL_RESULT"].forEach((function(e){if(c[e]){for(var s in c[e]){if(c[e].hasOwnProperty(s)){var r=c[e][s];i.push({text:r["Name"],description:t[a].Properties.Title||l.NAME,value:"{="+t[a].Name+":"+s+"}",propertyObject:t[a].Name,propertyField:s,property:r})}}}}),this)}if(t[a].Children&&t[a].Children.length>0){var u=this.getTemplateActivitiesItems(t[a].Children,s);for(var p=0;p<u.length;++p){i.push(u[p])}}}return i};e.Bizproc.Selector.getTabsCounters=function(){var e,t={};for(e=0;e<this.currentData.length;++e){t[this.currentData[e]["tabId"]]=this.currentData[e]["items"].length}return t};e.Bizproc.Selector.getListElement=function(){return e.findChild(this.popup.contentContainer,{className:"bp-selector-list"},true)};e.Bizproc.Selector.getSelectedItem=function(){return e.findChild(this.popup.contentContainer,{className:"bp-selector-item-selected"},true)};e.Bizproc.Selector.getTabsElements=function(){return e.findChildren(this.popup.contentContainer,{className:"bp-selector-tab"},true)};e.Bizproc.Selector.closePopup=function(){if(this.popup)this.popup.close()};e.Bizproc.Selector.insertItemValue=function(e,t){var s=this.inputElement.value.substr(0,this.inputElement.selectionEnd),i=this.inputElement.value.substr(0,s.lastIndexOf(this.delimiter)),a=e.getAttribute("data-value")+(t?this.delimiter:""),r=this.inputElement.value.substr(this.inputElement.selectionEnd),o=parseInt(e.getAttribute("data-cursor-position"));if(isNaN(o))o=a.length;if(i.substr(-1)==="{")i=i.substr(0,i.length-1);this.inputElement.value=i+a+r;this.inputElement.selectionEnd=i.length+Math.max(0,o)+1};e.Bizproc.Selector.onSearch=function(t,s){var i=this,a=true;if(t.mentionListen){if(s.keyCode==27){t.mentionListen=false;this.closePopup();return e.PreventDefault(s)}else if(s.keyCode==13&&this.popup){var r=this.getSelectedItem();if(r){this.insertItemValue(r,s.shiftKey===true);if(s.shiftKey!==true)this.closePopup()}return e.PreventDefault(s)}else if((s.keyCode==37||s.keyCode==39||s.keyCode==9)&&this.popup){this.SelectNextTab(s.keyCode==37?-1:1);return e.PreventDefault(s)}else if((s.keyCode==38||s.keyCode==40)&&this.popup){this.SelectNextItem(s.keyCode==38?-1:1);return e.PreventDefault(s)}else if(s.altKey===true||s.ctrlKey===true||s.shiftKey===true&&s.keyCode==16){}else{setTimeout(e.delegate((function(){var e=this.value.substr(0,this.selectionEnd);if(e.lastIndexOf(i.delimiter)<0){i.closePopup();return false}e=e.substr(e.lastIndexOf(i.delimiter),this.selectionEnd-e.lastIndexOf(i.delimiter));if(e.length<=0){i.closePopup();return false}e=e.substr(1);if(e.substr(0,1)==" "){i.closePopup();return false}if(i.popup)i.updatePopupContent(e)}),t),10)}}else if(s.shiftKey===false&&(s.keyCode==i.listenKeyCode||s.key===i.listenKey)){if(!t.mentionListen){setTimeout(e.delegate((function(){var t=this.value.substr(this.selectionEnd-1,1);if(t!=i.delimiter)return false;this.mentionListen=true;i.closePopup();i.popup=new e.PopupWindow("bx-bizproc-selector",this,{lightShadow:true,offsetTop:0,closeIcon:true,offsetLeft:0,autoHide:true,bindOptions:{position:"bottom"},closeByEsc:true,zIndex:200,events:{onPopupShow:function(){e.WindowManager.currently_loaded=this;this.CloseDialog=this.Close=function(){e.WindowManager.currently_loaded=null;if(i.popup!==null){var t=e.WindowManager.Get();if(t&&!t.unclosable)t.Close()}}},onPopupClose:function(){this.destroy();setTimeout((function(){e.WindowManager.currently_loaded=null}),50)},onPopupDestroy:e.delegate((function(){i.popup=null;i.activitiesItemsCache=null;this.mentionListen=false}),this)},content:e.create("DIV",{children:[i.generatePopupContent()]})});i.popup.show();i.inputElement=this}),t),100)}}if(!a)return e.PreventDefault(s)};e.Bizproc.Selector.extractMenuItem=function(t,s,i){var a=[];var r,o,l;for(r in s){if(!s.hasOwnProperty(r))continue;o="{="+i+":"+r+"}";if(i==="Document"){o="{{"+s[r].Name+"}}"}else if(i==="GlobalVar"&&window.wfGVarVisibilityNames&&e.util.object_keys(window.wfGVarVisibilityNames).length>0){l=s[r].Visibility;o="{{"+window.wfGVarVisibilityNames[l]+": "+s[r].Name+"}}"}else if(i==="GlobalConst"&&window.wfGConstVisibilityNames&&e.util.object_keys(window.wfGConstVisibilityNames).length>0){l=s[r].Visibility;o="{{"+window.wfGConstVisibilityNames[l]+": "+s[r].Name+"}}"}a.push({text:s[r].Name,value:o})}return this.filterItems(a,t)};e.Bizproc.Selector.filterItems=function(t,s){var i=[],a;s=s?s.toLowerCase():"";var r=s&&e.correctText?e.correctText(s,{replace_way:"AUTO",mixed:true}).toLowerCase():"";for(a=0;a<t.length;++a){if(!s||t[a].text.toLowerCase().indexOf(s)>=0||t[a].value.toLowerCase().indexOf(s)>=0||t[a].text.toLowerCase().indexOf(r)>=0||t[a].value.toLowerCase().indexOf(r)>=0){i.push(t[a])}}return i};e.Bizproc.Selector.updateCurrentData=function(t){var i=[];if(e.util.object_keys(arWorkflowParameters).length>0)i.push({tabName:e.message("BIZPROC_JS_BP_SELECTOR_PARAMETERS"),tabId:"parameters",items:this.extractMenuItem(t,arWorkflowParameters,"Template")});if(e.util.object_keys(arWorkflowVariables).length>0)i.push({tabName:e.message("BIZPROC_JS_BP_SELECTOR_VARIABLES"),tabId:"variables",items:this.extractMenuItem(t,arWorkflowVariables,"Variable")});if(e.util.object_keys(arWorkflowConstants).length>0)i.push({tabName:e.message("BIZPROC_JS_BP_SELECTOR_CONSTANTS"),tabId:"constants",items:this.extractMenuItem(t,arWorkflowConstants,"Constant")});if(typeof arDocumentFields!=="undefined"){i.push({tabName:e.message("BIZPROC_JS_BP_SELECTOR_DOCUMENT"),tabId:"document",items:this.extractMenuItem(t,arDocumentFields,"Document")})}var a=this.getActivitiesItems();if(a.length>0)i.push({tabName:e.message("BIZPROC_JS_BP_SELECTOR_ACTIVITIES"),tabId:"activities",items:this.filterItems(a,t)});if(window.arWorkflowGlobalConstants&&e.util.object_keys(window.arWorkflowGlobalConstants).length>0){i.push({tabName:"@"+e.message("BIZPROC_JS_BP_SELECTOR_CONSTANTS"),tabId:"gconstants",items:this.extractMenuItem(t,window.arWorkflowGlobalConstants,"GlobalConst")})}if(window.arWorkflowGlobalVariables&&e.util.object_keys(window.arWorkflowGlobalVariables).length>0){i.push({tabName:"@"+e.message("BIZPROC_JS_BP_SELECTOR_VARIABLES"),tabId:"gvariables",items:this.extractMenuItem(t,window.arWorkflowGlobalVariables,"GlobalVar")})}i.push({tabName:e.message("BIZPROC_JS_BP_SELECTOR_SYSTEM"),tabId:"system",items:this.filterItems([{text:e.message("BIZPROC_JS_BP_SELECTOR_WORKFLOW_ID"),value:"{=Workflow:ID}"},{text:e.message("BIZPROC_JS_BP_SELECTOR_TARGET_USER"),value:"{=Template:TargetUser}"},{text:e.message("BIZPROC_JS_BP_SELECTOR_USER_ID"),value:"{=User:ID}"},{text:e.message("BIZPROC_JS_BP_SELECTOR_NOW"),value:"{=System:Now}"},{text:e.message("BIZPROC_JS_BP_SELECTOR_NOW_LOCAL"),value:"{=System:NowLocal}"},{text:e.message("BIZPROC_JS_BP_SELECTOR_DATE"),value:"{=System:Date}"},{text:e.message("BIZPROC_JS_BP_SELECTOR_EOL"),value:"{=System:Eol}"},{text:e.message("BIZPROC_JS_BP_SELECTOR_HOST_URL"),value:"{=System:HostUrl}"}],t)});i.push({tabName:e.message("BIZPROC_JS_BP_SELECTOR_FUNCTIONS"),tabId:"functions",items:this.filterItems(s,t)});this.currentData=i;return i};e.Bizproc.Selector.generatePopupContent=function(t){var s=e.create("DIV",{attrs:{className:"bp-selector-popup"}});var i=e.create("UL",{attrs:{className:"bp-selector-tabs"}});var a=e.create("UL",{attrs:{className:"bp-selector-list"}});s.appendChild(i);s.appendChild(a);var r=this.updateCurrentData(t);var o,l,n=this;for(o=0;o<r.length;++o){l=e.create("LI",{attrs:{className:"bp-selector-tab"},html:r[o].tabName+' (<span class="counter-value">'+r[o].items.length+"</span>)"});l.setAttribute("data-tab-id",r[o].tabId);l.setAttribute("hidefocus","true");if(!this.selectedTab&&o===0||this.selectedTab==r[o].tabId){e.addClass(l,"selected");this.updateList(a,r[o].items)}e.bind(l,"click",(function(t){n.selectTab(this);e.focus(n.inputElement);return e.PreventDefault(t)}));i.appendChild(l)}return s};e.Bizproc.Selector.updatePopupContent=function(t){var s=this.getListElement();var i,a,r,o=this.updateCurrentData(t);var l=this.getTabsCounters();var n=this.getTabsElements();for(i=0;i<n.length;++i){a=n[i].getAttribute("data-tab-id");r=e.findChild(n[i],{className:"counter-value"});r.innerHTML=l[a]||0;if(e.hasClass(n[i],"selected")){this.updateList(s,this.getTabItems(a))}}};e.Bizproc.Selector.SelectNextTab=function(t){var s,i,a,r,o,l=this.getTabsElements();for(a=0,r=l.length;a<r;++a){s=e.hasClass(l[a],"selected");if(s&&t<0){o=a-1>=0?a-1:r-1;e.removeClass(l[a],"selected");e.addClass(l[o],"selected");i=l[o].getAttribute("data-tab-id");break}if(s&&t>0){o=a+1<=r-1?a+1:0;e.removeClass(l[a],"selected");e.addClass(l[o],"selected");i=l[o].getAttribute("data-tab-id");break}}var n=this.getListElement();this.updateList(n,this.getTabItems(i));this.selectedTab=i};e.Bizproc.Selector.selectTab=function(t){var s=this.getListElement();var i=this.getTabsElements();for(var a=0;a<i.length;++a){if(i[a]==t){e.addClass(t,"selected");this.updateList(s,this.getTabItems(t.getAttribute("data-tab-id")))}else{e.removeClass(i[a],"selected")}}this.selectedTab=t.getAttribute("data-tab-id")};e.Bizproc.Selector.SelectNextItem=function(t){var s=this.getListElement();var i,a,r,o=0,l=e.findChildren(s,{className:"bp-selector-item"},true);for(a=0,r=l.length;a<r;++a){i=e.hasClass(l[a],"bp-selector-item-selected");if(i&&t<0){o=a-1>=0?a-1:r-1;e.removeClass(l[a],"bp-selector-item-selected");e.addClass(l[o],"bp-selector-item-selected");break}if(i&&t>0){o=a+1<=r-1?a+1:0;e.removeClass(l[a],"bp-selector-item-selected");e.addClass(l[o],"bp-selector-item-selected");break}}this.fixListScroll(s,l[o])};e.Bizproc.Selector.updateList=function(t,s){e.cleanNode(t);var i,a,r,o=this;if(s.length===0){r=e.create("LI",{html:e.message("BIZPROC_JS_BP_SELECTOR_EMPTY_LIST")});e.addClass(r,"bp-selector-item-empty");t.appendChild(r)}for(i=0;i<s.length;++i){a=s[i];r=e.create("LI",{html:e.util.htmlspecialchars(a.text)+(a.description?'<span class="bp-selector-item-description"> '+e.util.htmlspecialchars(a.description)+"</span>":"")});r.setAttribute("data-value",a.value);r.setAttribute("data-cursor-position",a.value.indexOf("("));r.setAttribute("hidefocus","true");e.addClass(r,"bp-selector-item");if(i===0)e.addClass(r,"bp-selector-item-selected");e.bind(r,"click",(function(t){o.insertItemValue(this,t.shiftKey===true);if(t.shiftKey!==true)o.closePopup();e.focus(o.inputElement);return e.PreventDefault(t)}));t.appendChild(r)}t.scrollTop=0};e.Bizproc.Selector.fixListScroll=function(t,s){var i=e.pos(t);var a=e.pos(s);if(a.bottom>i.bottom||a.top<i.top){t.scrollTop+=a.bottom>i.bottom?a.bottom-i.bottom:a.top-i.top}}})();
//# sourceMappingURL=bp_selector.map.js

Anon7 - 2022
AnonSec Team