403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/calendar/new/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/calendar/new/calendar-controls.min.js
(function(t){function e(t){this.id=t.id||"bx-select-input-"+Math.round(Math.random()*1e6);this.values=t.values||false;this.input=t.input;this.defaultValue=t.defaultValue||"";this.openTitle=t.openTitle||"";this.className=t.className||"";this.currentValue=t.value;this.currentValueIndex=t.valueIndex;this.onChangeCallback=t.onChangeCallback||null;this.zIndex=t.zIndex||1200;this.disabled=t.disabled;if(this.onChangeCallback){BX.bind(this.input,"change",this.onChangeCallback);BX.bind(this.input,"keyup",this.onChangeCallback)}if(this.currentValueIndex!==undefined&&this.values[this.currentValueIndex]){this.input.value=this.values[this.currentValueIndex].label}this.curInd=false;if(this.values){BX.bind(this.input,"click",BX.proxy(this.onClick,this));BX.bind(this.input,"focus",BX.proxy(this.onFocus,this));BX.bind(this.input,"blur",BX.proxy(this.onBlur,this));BX.bind(this.input,"keyup",BX.proxy(this.onKeyup,this))}}e.prototype={showPopup:function(){if(this.shown||this.disabled)return;var t=0,e=0,i=[],n,s=this;for(n=0;n<this.values.length;n++){if(this.values[n].delimiter){i.push(this.values[n])}else{if(this.currentValue&&this.values[n]&&this.values[n].value==this.currentValue.value){t=e}i.push({id:this.values[n].value,text:this.values[n].label,onclick:this.values[n].callback||function(t,e){return function(){s.input.value=e;s.popupMenu.close();s.onChange()}}(this.values[n].value,this.values[n].labelRaw||this.values[n].label)});e++}}this.popupMenu=BX.PopupMenu.create(this.id,this.input,i,{closeByEsc:true,autoHide:true,zIndex:this.zIndex,offsetTop:0,offsetLeft:0});this.popupMenu.popupWindow.setWidth(this.input.offsetWidth-2);var o=this.popupMenu.layout.menuContainer;BX.addClass(this.popupMenu.layout.menuContainer,"calendar-select-popup");this.popupMenu.show();var r=this.popupMenu.menuItems[t];if(r&&r.layout){o.scrollTop=r.layout.item.offsetTop-r.layout.item.offsetHeight}BX.addCustomEvent(this.popupMenu.popupWindow,"onPopupClose",(function(){BX.PopupMenu.destroy(s.id);s.shown=false;s.popupMenu=null}));this.input.select();this.shown=true},closePopup:function(){BX.PopupMenu.destroy(this.id);this.popupMenu=null;this.shown=false},onFocus:function(){setTimeout(BX.delegate((function(){if(!this.shown){this.showPopup()}}),this),200)},onClick:function(){if(this.shown){this.closePopup()}else{this.showPopup()}},onBlur:function(){setTimeout(BX.delegate(this.closePopup,this),200)},onKeyup:function(){setTimeout(BX.delegate(this.closePopup,this),50)},onChange:function(){var t=this.input.value;BX.onCustomEvent(this,"onSelectInputChanged",[this,t]);if(BX.type.isFunction(this.onChangeCallback)){this.onChangeCallback({value:t})}},destroy:function(){if(this.onChangeCallback){BX.unbind(this.input,"change",this.onChangeCallback);BX.unbind(this.input,"keyup",this.onChangeCallback)}BX.unbind(this.input,"click",BX.proxy(this.onClick,this));BX.unbind(this.input,"focus",BX.proxy(this.onFocus,this));BX.unbind(this.input,"blur",BX.proxy(this.onBlur,this));BX.unbind(this.input,"keyup",BX.proxy(this.onKeyup,this));if(this.popupMenu)this.popupMenu.close();BX.PopupMenu.destroy(this.id);this.popupMenu=null;this.shown=false}};function i(t,e){this.calendar=t;this.outerWrap=e.wrap;this.created=false}i.prototype={show:function(){if(!this.created){this.smallCalendar=new BX.JCCalendar;this.smallCalendar.month_popup_classname="calendar-navi-month-popup";this.smallCalendar.year_popup_classname="calendar-navi-year-popup";this.smallCalendar.Show({node:this.outerWrap,callback_after:BX.proxy(this.changeDate,this),bTime:false});this.outerWrap.appendChild(this.smallCalendar.DIV);this.smallCalendar.popup.close();this.created=true;this.paintTodayElement();BX.addCustomEvent(this.calendar,"changeViewRange",BX.proxy(this.setDate,this))}this.outerWrap.style.display=""},hide:function(){this.outerWrap.style.display="none"},changeDate:function(t){if(t&&this.calendar.getView()){this.calendar.getView().adjustViewRangeToDate(t)}},paintTodayElement:function(){var t=new Date;t.setHours(0,0,0,0);var e=parseInt(t.getTimezoneOffset());var i=t.getTime();if(e!==0){i-=e*60*1e3}var n=document.querySelector('[data-date="'+i+'"]');if(BX.Type.isDomNode(n)){BX.Dom.addClass(n,"bx-calendar-today-date")}},setDate:function(t){if(t&&this.smallCalendar.value&&this.calendar.util.getDayCode(this.smallCalendar.value)!=this.calendar.util.getDayCode(t)){t.setHours(12,0);this.smallCalendar.SetValue(t)}}};function n(t){this.calendar=t;this.undoList=[];this.redoList=[];this.eventDragAndDrop=new BX.Calendar.Ui.Tools.EventDragAndDrop(this.getDateByPos.bind(this),this.getPosByDate.bind(this),this.getEvents.bind(this));this.resizeDragAndDrop=new BX.Calendar.Ui.Tools.ResizeDragAndDrop(this.getDateByPos.bind(this),this.getPosByDate.bind(this))}n.prototype={getPosByDate:function(t){const e={h:t.getHours(),m:t.getMinutes()};return this.offset+this.calendar.getView().getPosByTime(e)},getDateByPos:function(t){const e=this.calendar.getView().getTimeByPos(t-this.offset,5);const i=new Date(this.currentState.entry.from.getTime());i.setHours(e.h,e.m,0,0);return i},getEvents:function(){return this.calendar.getView().getEvents(this.currentState.day)},undo:function(){this.manageHistory(this.undoList,this.redoList)},redo:function(){this.manageHistory(this.redoList,this.undoList)},manageHistory(t,e){if(t.length===0){return}e.push(this.getEntryState(this.currentState.entry));this.currentState.entry=t.pop();this.saveEntry({from:this.currentState.entry.from,to:this.currentState.entry.to},true)},pushToHistory(t){const e=this.undoList[this.undoList.length-1];if(this.undoList.length>0&&e.from.getTime()===t.from.getTime()&&e.to.getTime()===t.to.getTime()){this.undoList[this.undoList.length-1]=t}else{this.undoList.push(t)}},getEntryState:function(t){const e={uid:t.uid,from:new Date(t.from.getTime()),to:new Date(t.to.getTime()),data:{DT_LENGTH:t.data.DT_LENGTH},startDayCode:new Date(t.from.getTime()),endDayCode:new Date(t.to.getTime())};const i=t.isRecursive?t.isRecursive():false;if(i){const i=t.uid.split("|")[0];const n=t.uid.split("|")[1];e.data.RELATIONS={COMMENT_XML_ID:"EVENT_"+i+"_"+n}}return e},reset:function(){jsDD.Reset()},registerDay:function(t){const e=t.node;const i=t.date;jsDD.registerDest(e);e.onbxdestdragfinish=()=>{BX.removeClass(e,"calendar-grid-drag-select")};e.onbxdestdraghover=()=>{if(!this.currentState||!this.draggedNode){return}const t=this.currentState.entry.to.getTime()-this.currentState.entry.from.getTime();this.currentState.entry.from.setFullYear(i.getFullYear(),i.getMonth(),i.getDate());this.currentState.entry.to.setTime(this.currentState.entry.from.getTime()+t);BX.addClass(e,"calendar-grid-drag-select")};e.onbxdestdraghout=()=>{BX.removeClass(e,"calendar-grid-drag-select")}},registerTimelineDay:function(t){const e=t.node;const i=t.date;jsDD.registerDest(e);e.onbxdestdraghover=BX.delegate((function(){if(this.draggedNode){const t=BX.pos(e).left;if(Math.abs(t-parseInt(this.draggedNode.style.left))>30){if(this.currentState.day){this.currentState.day=this.calendar.getView().getDayByCode(e.getAttribute("data-bx-calendar-timeline-day"));this.currentState.entry.from.setFullYear(i.getFullYear(),i.getMonth(),i.getDate());this.currentState.entry.to.setFullYear(i.getFullYear(),i.getMonth(),i.getDate())}this.draggedNode.style.left=BX.pos(e).left+2+"px"}this.currentState.dayNode=e;BX.addClass(e,"calendar-timeline-drag-select")}}),this);e.onbxdestdraghout=BX.delegate((function(){if(this.draggedNode){BX.removeClass(e,"calendar-timeline-drag-select")}}),this)},registerEntry:function(t,e){var i=false;if(this.calendar.isExternalMode()){i=e.entry&&e.entry.data&&e.entry.data.ALLOW_DRAGDROP}else{i=this.calendar.entryController.canDo(e.entry,"edit")&&!e.entry.isLocation()&&!e.entry.isOpenEvent()}jsDD.registerObject(t);t.onbxdragstart=BX.delegate((function(){this.cancelDragAndDrop=false;if(!t.parentNode){const e="data-bx-calendar-entry";const i=t.getAttribute(e);t=document.querySelector(`[${e}="${i}"]`)}if(!i||this.isRecursiveEntryMoved(e.entry)){this.cancelDragAndDrop=true;this.draggedNode=false;this.shake(t);if(e.entry.isSharingEvent()){this.showCantDragSharedEventPopup(t)}return}this.currentState=e;this.draggedNode=document.body.appendChild(t.cloneNode(true));t.style.opacity="0.3";BX.addClass(this.draggedNode,"calendar-entry-drag-mode");BX.removeClass(this.draggedNode,"calendar-event-line-start-yesterday");BX.removeClass(this.draggedNode,"calendar-event-line-finish-tomorrow");BX.removeClass(this.draggedNode,"calendar-event-block-wrap-past");if(this.isDayWeek()){if(this.draggedNode.querySelector(".calendar-event-line-time")){this.draggedNode.querySelector(".calendar-event-line-time").remove()}if(this.draggedNode.querySelector(".calendar-event-line-expired-time")){this.draggedNode.querySelector(".calendar-event-line-expired-time").remove()}if(this.draggedNode.querySelector(".calendar-event-line-dot")){this.draggedNode.querySelector(".calendar-event-line-dot").remove()}}this.calendar.getView().setDraggedEntry(this.currentState.entry);if(this.isDayWeek()){this.draggedNode.style.left=BX.pos(t).left+"px";let e=this.currentState.entry.to.getTime()-this.currentState.entry.from.getTime();if(this.currentState.entry.isFullDay()||e>this.calendar.util.dayLength){e+=this.calendar.util.dayLength;const t=e===0?1:Math.ceil(e/(1e3*3600*24));this.draggedNode.style.width=this.calendar.getView().getDayWidth()*t+"px"}else{this.draggedNode.style.width=this.calendar.getView().getDayWidth()-5+"px"}this.offset=BX.pos(this.calendar.getView().timeLinesCont).top;this.currentState.bottomBasePos=BX.pos(this.calendar.getView().bottomOffHours).bottom-2}else{let t=this.currentState.entry.to.getTime()-this.currentState.entry.from.getTime();if(this.currentState.entry.isFullDay()){t+=this.calendar.util.dayLength}const e=t===0?1:Math.ceil(t/(1e3*3600*24));this.draggedNode.style.width=this.calendar.getView().getDayWidth()*e+"px"}var n=this.currentState.entry,s=n.getLengthInDays(),o=this.draggedNode.querySelector(".calendar-event-line-inner-container"),r=this.draggedNode.querySelector(".calendar-event-line-inner");this.startDuration=n.to.getTime()-n.from.getTime();this.startDurationHint=this.getDurationHint(n.from,n.to);if(this.calendar.getView().getDayByCode){this.currentState.day=this.calendar.getView().getDayByCode(this.calendar.util.getDayCode(n.from))}if(s>1){var a=this.draggedNode.querySelector(".calendar-event-line-text");if(a){a.innerHTML='<span class="calendar-event-line-days-count">('+BX.message("EC_DAY_LENGTH").replace("#COUNT#",s)+")</span> "+a.innerHTML}}if(o){if(n.isFullDay()){o.style.backgroundColor=this.calendar.util.hexToRgba(n.color,.7);o.style.borderColor=this.calendar.util.hexToRgba(n.color,.7)}else{if(n.isLongWithTime()){o.style.borderColor=this.calendar.util.hexToRgba(n.color,.7)}}}if(r){r.style.maxWidth=""}if(this.calendar.getView().allEventsPopup){this.calendar.getView().allEventsPopup.close()}this.pushToHistory(this.getEntryState(n));this.isDragging=true;if(this.isDayWeek()){this.eventDragAndDrop.onDragStart(n.to.getTime()-n.from.getTime())}}),this);if(!i){return}t.onbxdrag=BX.delegate((function(t,e){if(!this.draggedNode||this.cancelDragAndDrop){return}e-=7;e=this.getPositionAfterScroll(t,e);this.dragEntry(t,e)}),this);t.onbxdragstop=()=>{if(this.cancelDragAndDrop){return}this.redoList=[];if(this.isDayWeek()){this.saveEntry({from:this.eventDragAndDrop.getFinalFrom(),to:this.eventDragAndDrop.getFinalTo()});this.stopWindowScroll();this.stopContainerScroll()}else{if(!this.currentState){return}this.saveEntry({from:this.currentState.entry.from,to:this.currentState.entry.to})}};if(e.part.params.resizerNodeTop){this.registerResizer(e.part.params.resizerNodeTop,e,true)}if(e.part.params.resizerNodeBottom){this.registerResizer(e.part.params.resizerNodeBottom,e,false)}},getPositionAfterScroll:function(t,e){e=this.getPositionAfterBottomScroll(t,e);e=this.getPositionAfterTopScroll(t,e);if(this.doesViewportContainDraggedNode(e)){this.stopWindowScroll()}if(this.doesContainerContainDraggedNode(e)){this.stopContainerScroll()}return e},getPositionAfterTopScroll:function(e,i){const n=this.calendar.getView().gridWrap;const s=BX.pos(n).top;const o=t.scrollY;if(i<o&&o>s){this.scrollSpeed=this.getSpeed(i,o);i=o;this.setWindowTopScrollInterval(e,i)}if(i<=s){this.scrollSpeed=this.getSpeed(i,s);i=s;if(i<s&&o>s){i=o}this.setContainerTopScrollInterval(e,i)}return i},getPositionAfterBottomScroll:function(e,i){const n=this.calendar.getView().gridWrap;const s=BX.pos(n).bottom-this.draggedNode.offsetHeight;const o=t.innerHeight+t.scrollY-this.draggedNode.offsetHeight;if(i>o&&o<s){this.scrollSpeed=this.getSpeed(i,o);i=o;this.setWindowBottomScrollInterval(e,i)}if(i>=s){this.scrollSpeed=this.getSpeed(i,s);i=s;if(i>o&&o<s){i=o}this.setContainerBottomScrollInterval(e,i)}return i},getSpeed:function(t,e){return Math.floor(Math.log(1+Math.abs(t-e)))+1},setWindowTopScrollInterval:function(t,e){this.setWindowScrollInterval(t,e,this.setContainerTopScrollInterval.bind(this),-1)},setWindowBottomScrollInterval:function(t,e){this.setWindowScrollInterval(t,e,this.setContainerBottomScrollInterval.bind(this),1)},setWindowScrollInterval:function(t,e,i,n){if(!this.windowScrollInterval){this.windowScrollInterval=setInterval((()=>{e+=this.scrollSpeed*n;document.documentElement.scrollTop+=this.scrollSpeed*n;this.dragEntry(t,e);if(!this.doesContainerContainDraggedNode(e)){this.stopWindowScroll(e);i(t,e)}}),13)}},setContainerTopScrollInterval:function(t,e){this.setContainerScrollInterval(t,e,this.getScrollTop,-1)},setContainerBottomScrollInterval:function(t,e){this.setContainerScrollInterval(t,e,this.getScrollBottom,1)},getScrollTop:function(t){return t.scrollTop},getScrollBottom:function(t){return parseInt(t.scrollHeight-t.clientHeight-t.scrollTop)},setContainerScrollInterval:function(t,e,i,n){if(!this.containerScrollInterval){const s=this.calendar.getView().gridWrap;this.containerScrollInterval=setInterval((()=>{this.scrollSpeed=Math.min(this.scrollSpeed,i(s));this.offset-=this.scrollSpeed*n;s.scrollTop+=this.scrollSpeed*n;this.dragEntry(t,e);if(i(s)===0){this.stopContainerScroll()}}),13)}},doesViewportContainDraggedNode:function(e){const i=t.scrollY;const n=t.innerHeight+t.scrollY-this.draggedNode.offsetHeight;return e>i&&e<n},doesContainerContainDraggedNode:function(t){const e=this.calendar.getView().gridWrap;const i=BX.pos(e).top;const n=BX.pos(e).bottom-this.draggedNode.offsetHeight;return t>i&&t<n},stopWindowScroll:function(){clearInterval(this.windowScrollInterval);this.windowScrollInterval=false},stopContainerScroll:function(){clearInterval(this.containerScrollInterval);this.containerScrollInterval=false},dragEntry:function(t,e){if(this.isDayWeek()){this.dragWeekDayEntry(e)}else{this.dragMonthEntry(t,e)}},dragWeekDayEntry:function(t){const e=this.calendar.getView();const i=this.currentState.entry;const n=this.draggedNode.offsetHeight;let s=t;if(s<this.offset){s=this.offset;this.shake(this.draggedNode)}if(s+n>this.currentState.bottomBasePos){s=this.currentState.bottomBasePos-n;this.shake(this.draggedNode)}let o=e.getTimeByPos(s-this.offset,5);this.setStartTime(i,o);const r=this.eventDragAndDrop.getDragBoundary(s);if(r.wasMagnetized){this.draggedNode.style.transition="left .2s, top .05s, height .1s"}else{this.draggedNode.style.transition="left .2s, height .1s"}e.updateCompactness(this.draggedNode);this.setBoundaryTimeToTimeNode(r,this.draggedNode);this.draggedNode.style.top=r.position+"px";this.draggedNode.style.height=r.size+"px";const a=r.to.getTime()-r.from.getTime();if(this.previousDuration>a){if(a>=20*60*1e3){this.displayDurationChanged()}this.showDurationChangedPopup(r.from,r.to);this.durationChangedTimeout=setTimeout(this.hideDurationChanged.bind(this),1600)}if(this.previousDuration<a||a===this.startDuration){this.closeEntryDragPopup();this.hideDurationChanged()}this.previousDuration=a},displayDurationChanged:function(){BX.addClass(this.draggedNode,"duration-changed");this.durationNode.style.display="";if(this.draggedNode.querySelector(".calendar-event-block-time")){this.draggedNode.querySelector(".calendar-event-block-time").style.display="none"}if(this.draggedNode.querySelector(".calendar-event-block-text")){this.draggedNode.querySelector(".calendar-event-block-text").style.display="none"}},hideDurationChanged:function(){BX.removeClass(this.draggedNode,"duration-changed");clearTimeout(this.durationChangedTimeout);this.durationNode.style.display="none";if(this.draggedNode.querySelector(".calendar-event-block-time")){this.draggedNode.querySelector(".calendar-event-block-time").style.display=""}if(this.draggedNode.querySelector(".calendar-event-block-text")){this.draggedNode.querySelector(".calendar-event-block-text").style.display=""}this.calendar.getView().updateCompactness(this.draggedNode)},showDurationChangedPopup:function(t,e){const i=BX.Loc.getMessage("CALENDAR_EVENT_DURATION_CHANGE_NEW").replace("#DURATION#",this.getDurationHint(t,e));this.showEntryDragPopup(this.draggedNode,i)},showCantDragSharedEventPopup:function(t){const e=BX.message("EC_CALENDAR_CANT_DRAG_SHARED_EVENT");this.showEntryDragPopup(t,e)},showEntryDragPopup:function(t,e){this.closeEntryDragPopup();this.showEntryDragPopupTimeout=setTimeout((()=>{this.entryDragPopup=this.getEntryDragPopup(t,e);if(this.entryDragPopup){this.entryDragPopup.show()}}),200)},getEntryDragPopup:function(e,i){if(!e||e.offsetHeight===0){return null}const{popupWidth:n,popupHeight:s}=this.getEntryDragPopupSize(e,i);const o=10;let r,a,l;if(this.isDay()){r=0;a=-e.offsetHeight-s-o;l="bottom";if(e.getBoundingClientRect().top-s-o<0){a=o;l="top"}}else{a=-e.offsetHeight/2-s/2;r=e.offsetWidth+o;l="left";if(e.getBoundingClientRect().right+n+o>t.innerWidth){r=-n-o;l="right"}}const d=this.createHintPopup(e,i,r,a,l);d.popupContainer.style.cursor="pointer";d.popupContainer.style.whiteSpace="nowrap";d.popupContainer.addEventListener("click",(()=>{if(d){d.destroy()}}));setTimeout((()=>{if(d){d.destroy()}}),3e3);return d},closeEntryDragPopup:function(){clearTimeout(this.showEntryDragPopupTimeout);if(this.entryDragPopup){this.entryDragPopup.destroy()}},getEntryDragPopupSize:function(t,e){const i=this.createHintPopup(t,e,0,0,"right");i.show();const n=i.popupContainer.offsetWidth;const s=i.popupContainer.offsetHeight;i.destroy();return{popupWidth:n,popupHeight:s}},createHintPopup:function(t,e,i,n,s){const o=s==="bottom"||s==="top";const r=new BX.PopupWindow("ui-hint-popup-"+ +new Date,t,{darkMode:true,className:"calendar-entry-drag-popup",content:e,offsetLeft:i,offsetTop:n,angle:o?false:{position:s}});if(r.angle){r.angle.element.style.top="3px"}BX.addCustomEvent(this.calendar,"afterSetView",(()=>{r.destroy()}));if(o){r.subscribe("onAfterShow",(()=>{r.setAngle({offset:0,position:s})}))}return r},dragMonthEntry:function(t,e){this.draggedNode.style.top=e-3+"px";this.draggedNode.style.left=t-20+"px"},setStartTime:function(t,e){t.from.setHours(e.h,e.m);t.to=new Date(t.from.getTime()+(t.data.DT_LENGTH-(t.fullDay?1:0))*1e3);if(this.calendar.util.getDayCode(t.from)!==this.calendar.util.getDayCode(t.to)&&t.to.getHours()===0&&t.to.getMinutes()===0){t.to=new Date(t.to.getTime()-1e3)}},shake:function(t){BX.addClass(t,"calendar-entry-shake-mode");if(this.shakeTimeout){clearTimeout(this.shakeTimeout)}this.shakeTimeout=setTimeout((()=>{BX.removeClass(t,"calendar-entry-shake-mode")}),400)},registerResizer:function(e,i,n=false){e.setAttribute("data-bx-entry-resizer","Y");e.onbxdragstart=e=>{if(this.isRecursiveEntryMoved(i.entry)){this.cancelDragAndDrop=true;this.draggedNode=false;this.shake(i.entry.parts[0].params.wrapNode);return}e=e||t.event;let s=i.entry;if(i.part.params.wrapNode.offsetHeight===0){s=this.getRealEntry(s)}this.currentState={entry:s,startY:e.clientY+BX.GetWindowSize().scrollTop};this.resizedNode=s.parts[0].params.wrapNode;this.pushToHistory(this.getEntryState(s));this.calendar.getView().setResizedEntry(this.currentState.entry);this.offset=0;const o=parseInt(t.getComputedStyle(this.resizedNode).getPropertyValue("min-height"));this.resizeDragAndDrop.onDragStart(s,o,n);this.isDragging=true};jsDD.registerObject(e);e.onbxdrag=(t,e)=>{if(this.cancelDragAndDrop){return}if(this.currentState&&this.calendar.util.type!=="location"){this.resizeWeekDayEntry(e-this.currentState.startY)}};e.onbxdragstop=()=>{if(this.cancelDragAndDrop){this.cancelDragAndDrop=false;return}this.redoList=[];this.currentState.entry.from=this.resizeDragAndDrop.getFinalFrom();this.currentState.entry.to=this.resizeDragAndDrop.getFinalTo();this.saveEntry({from:this.resizeDragAndDrop.getFinalFrom(),to:this.resizeDragAndDrop.getFinalTo()})}},resizeWeekDayEntry:function(t){document.body.style.cursor="ns-resize";const e=this.resizeDragAndDrop.getDragBoundary(t);this.setBoundaryTimeToTimeNode(e,this.resizedNode);this.resizedNode.style.height=e.size+"px";this.resizedNode.style.top=e.position+"px";this.calendar.getView().updateCompactness(this.resizedNode)},saveEntry:function(t,e=false){if(!this.currentState){return}const i=this.getRealEntry(this.currentState.entry);this.setTimeIntervalToEntry(i,t);this.calendar.getView().setDraggedEntry(null);if(this.calendar.getView().setResizedEntry){this.calendar.getView().setResizedEntry(null)}this.calendar.getView().displayEntries();if(e||this.hasEventBeenMoved()){this.calendar.entryController.moveEventToNewDate(i,i.from,i.to).then((t=>{if(t){this.showEntryDraggedNotification()}}))}else{this.undoList.pop()}i.data.DATE_FROM=this.calendar.util.formatDateTime(t.from);i.data.DATE_TO=this.calendar.util.formatDateTime(t.to);if(this.currentState.dayNode){BX.removeClass(this.currentState.dayNode,"calendar-timeline-drag-select")}setTimeout((()=>this.isDragging=false),10);BX.remove(this.draggedNode)},setTimeIntervalToEntry:function(t,e){if(e){t.from=new Date(e.from.getTime());t.to=new Date(e.to.getTime());t.data.DT_LENGTH=(e.to.getTime()-e.from.getTime())/1e3;if(t.fullDay){t.data.DT_LENGTH+=86400}t.startDayCode=e.from;t.endDayCode=e.to}},getRealEntry:function(t){if(this.calendar.getView().getRealEntry){return this.calendar.getView().getRealEntry(t)}for(const e of this.calendar.getView().entries){if(e.uid===t.uid){return e}}return null},showEntryDraggedNotification:function(){if(this.redoList.length>0){return}BX.Calendar.Util.showNotification(BX.Loc.getMessage("CALENDAR_SAVE_EVENT_NOTIFICATION"),[{title:BX.Loc.getMessage("CALENDAR_EVENT_DO_CANCEL"),events:{click:(t,e)=>{const i=this.undoList[this.undoList.length-1];if(this.isRecursiveEntryMoved(this.getRealEntry(i))){return}this.undo();e.close()}}}])},isRecursiveEntryMoved:function(t){return t&&t.isRecursive()&&this.calendar.entryController.findMovedEntryById(t.uid)},setBoundaryTimeToTimeNode:function(t,e){const i=e.querySelector(".calendar-event-block-time");if(i){i.innerHTML=this.formatTimePeriod(t.from,t.to)}if(!this.durationNode||!e.querySelector(".calendar-event-block-duration")){this.durationNode=BX.create("DIV");this.durationNode.className="calendar-event-block-duration";this.durationNode.style.display="none";if(i){i.after(this.durationNode)}}this.durationNode.innerHTML=this.startDurationHint+" &rarr; "+this.getDurationHint(t.from,t.to)},hasEventBeenMoved:function(){const t=this.undoList[this.undoList.length-1];return t.from.getTime()!==this.currentState.entry.from.getTime()||t.to.getTime()!==this.currentState.entry.to.getTime()},isDayWeek:function(){return this.isDay()||this.isWeek()},isDay:function(){return this.calendar.currentViewName==="day"},isWeek:function(){return this.calendar.currentViewName==="week"},formatTimePeriod:function(t,e){return this.calendar.util.formatTime(t)+" &ndash; "+this.calendar.util.formatTime(e)+" ("+this.getDurationHint(t,e)+")"},getDurationHint:function(t,e){const i=e.getTime()-t.getTime();const n=Math.floor(i/(1e3*60));const s=Math.floor(n/60);const o=n%60;let r=`${o} ${BX.message("EC_MINUTE_SHORT")}`;if(s>0){r=`${s} ${BX.message("EC_HOUR_SHORT")}`;if(o>0){r+=` ${o} ${BX.message("EC_MINUTE_SHORT")}`}}return r}};function s(t){this.id=t.id||"section-select-"+Math.round(Math.random()*1e6);this.sectionList=t.sectionList;this.sectionGroupList=t.sectionGroupList;this.selectCallback=t.selectCallback;this.openPopupCallback=t.openPopupCallback;this.closePopupCallback=t.closePopupCallback;this.getCurrentSection=t.getCurrentSection;this.zIndex=t.zIndex||1200;this.mode=t.mode;this.DOM={outerWrap:t.outerWrap};this.init()}s.prototype={init:function(){this.DOM.select=this.DOM.outerWrap.appendChild(BX.create("DIV",{props:{className:"calendar-field calendar-field-select"+(this.mode==="compact"?" calendar-field-tiny":"")},events:{click:BX.delegate(this.openPopup,this)}}));this.DOM.innerValue=this.DOM.select.appendChild(BX.create("DIV",{props:{className:"calendar-field-select-icon"},style:{backgroundColor:this.getCurrentColor()}}));if(this.mode==="full"){this.DOM.selectInnerText=this.DOM.select.appendChild(BX.create("SPAN",{text:this.getCurrentTitle()}))}},openPopup:function(){if(this.sectionMenu&&this.sectionMenu.popupWindow&&this.sectionMenu.popupWindow.isShown()){return this.sectionMenu.close()}let t=[];if(BX.type.isArray(this.sectionGroupList)){this.sectionGroupList.forEach((function(e){let i;if(e.belongsToView){i=this.sectionList.filter((function(t){return t.belongsToView()}))}else if(e.type==="user"){i=this.sectionList.filter((function(t){return t.type==="user"&&t.ownerId===e.ownerId}))}else if(e.type==="company"){i=this.sectionList.filter((function(t){return t.type==="company_calendar"||t.type==="calendar_company"||t.type===e.type}))}else{i=this.sectionList.filter((function(t){return t.type===e.type}))}if(i.length>0){t.push(new BX.Main.Popup.MenuItem({text:e.title,delimiter:true}));for(let e=0;e<i.length;e++){t.push(this.getMenuItem(i[e]))}}}),this)}else{for(let e=0;e<this.sectionList.length;e++){t.push(this.getMenuItem(this.sectionList[e]))}}this.sectionMenu=BX.PopupMenu.create(this.id,this.DOM.select,t,{closeByEsc:true,autoHide:true,zIndex:this.zIndex,offsetTop:0,offsetLeft:this.mode==="compact"?40:0,angle:this.mode==="compact"});this.sectionMenu.popupWindow.contentContainer.style.overflow="auto";this.sectionMenu.popupWindow.contentContainer.style.maxHeight="400px";if(this.mode==="full"){this.sectionMenu.popupWindow.setWidth(this.DOM.select.offsetWidth-2);this.sectionMenu.popupWindow.contentContainer.style.overflowX="hidden"}this.sectionMenu.show();for(let t=0;t<this.sectionMenu.menuItems.length;t++){if(this.sectionMenu.menuItems[t].layout.item){const e=this.sectionMenu.menuItems[t].layout.item.querySelector(".menu-popup-item-icon");if(e){e.style.backgroundColor=this.sectionMenu.menuItems[t].color}}}BX.addClass(this.DOM.select,"active");if(BX.type.isFunction(this.openPopupCallback)){this.openPopupCallback(this)}BX.addCustomEvent(this.sectionMenu.popupWindow,"onPopupClose",BX.delegate((function(){if(BX.type.isFunction(this.openPopupCallback)){this.closePopupCallback()}BX.removeClass(this.DOM.select,"active");BX.PopupMenu.destroy(this.id);this.sectionMenu=null}),this))},getCurrentColor:function(){return(this.getCurrentSection()||{}).color||false},getCurrentTitle:function(){return(this.getCurrentSection()||{}).name||""},getPopup:function(){return this.sectionMenu},getMenuItem:function(t){var e=this;return{text:BX.util.htmlspecialchars(t.name),color:t.color,className:"calendar-add-popup-section-menu-item",onclick:function(t){return function(){e.DOM.innerValue.style.backgroundColor=t.color;if(e.DOM.selectInnerText){e.DOM.selectInnerText.innerHTML=BX.util.htmlspecialchars(t.name)}if(BX.type.isFunction(e.selectCallback)){e.selectCallback(t)}e.sectionMenu.close()}}(t)}}};if(t.BXEventCalendar){t.BXEventCalendar.SelectInput=e;t.BXEventCalendar.NavigationCalendar=i;t.BXEventCalendar.DragDrop=n;t.BXEventCalendar.SectionSelector=s}else{BX.addCustomEvent(t,"onBXEventCalendarInit",(function(){t.BXEventCalendar.SelectInput=e;t.BXEventCalendar.NavigationCalendar=i;t.BXEventCalendar.DragDrop=n;t.BXEventCalendar.SectionSelector=s}))}})(window);
//# sourceMappingURL=calendar-controls.map.js

Youez - 2016 - github.com/yon3zu
LinuXploit