AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 18.117.184.115
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/calendar/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/bitrix/www/bitrix/js/calendar/cal-core.min.js
function JCEC(e){this.arConfig=e;top.BXCRES={};this.dayLength=864e5;this.id=e.id;this.pCalCnt=BX(this.id+"_bxcal");this.dragDrop=new ECDragDropControl({calendar:this});this.arEvents=[];this.arAttendees={};this.arSections=e.sections;this.type=e.type;this.bSuperpose=e.bSuperpose||false;this.bTasks=e.bTasks||false;this.userId=e.userId;this.userName=e.userName;this.ownerId=e.ownerId||false;this.sectionControlsDOMId=e.sectionControlsDOMId;this.PERM=e.perm;this.permEx=e.permEx;this.settings=e.settings;this.userSettings=e.userSettings;this.pathToUser=e.pathToUser;this.bIntranet=!!e.bIntranet;this.allowMeetings=!!e.bSocNet&&this.bIntranet;this.allowReminders=!!e.bSocNet&&this.bIntranet;this.days=e.days;this.bReadOnly=!!e.readOnly;this.bAnonym=!!e.bAnonym;this.startupEvent=e.startupEvent;this.accessColors=e.accessColors;this.initMonth=e.init_month;this.initYear=e.init_year;this.weekHolidays=e.week_holidays;this.yearHolidays=e.year_holidays;this.yearWorkdays=e.year_workdays;this.new_section_access=e.new_section_access||{};this.bExtranet=!!e.bExtranet;this.Colors=e.arCalColors;this.bAMPM=e.bAMPM;this.bWideDate=e.bWideDate;this.weekStart=e.week_start;this.weekDays=e.week_days;this.lastSection=e.lastSection;this.requests={};this.DATE_FORMAT=BX.date.convertBitrixFormat(BX.message("FORMAT_DATE"));this.DATETIME_FORMAT=BX.date.convertBitrixFormat(BX.message("FORMAT_DATETIME"));if(this.DATETIME_FORMAT.substr(0,this.DATE_FORMAT.length)==this.DATE_FORMAT)this.TIME_FORMAT=BX.util.trim(this.DATETIME_FORMAT.substr(this.DATE_FORMAT.length));else this.TIME_FORMAT=BX.date.convertBitrixFormat(this.bAMPM?"H:MI:SS T":"HH:MI:SS");this.TIME_FORMAT_SHORT=this.TIME_FORMAT.replace(":s","");this.bCalDAV=!!e.bCalDAV;if(this.bCalDAV)this.arConnections=e.connections;this.arSectionsInd={};this.oActiveSections={};this.dayHeight=100;this.darkColor="#E6E6E6";this.brightColor="#000000";this.arMenuItems={};this.arNames={};this.HandleAccessNames(e.accessNames);var t,i,s,n;this.activeSectionsCount=0;for(t in this.arSections){if(this.arSections.hasOwnProperty(t)){n=this.arSections[t];if(n.EXPORT&&!n.EXPORT.ALLOW)n.EXPORT=false;if(!n.TEXT_COLOR)n.TEXT_COLOR="";i=n.ID;if(this.bCalDAV&&n.CAL_DAV_CAL&&n.CAL_DAV_CON&&this.arConnections&&this.arConnections.length>0){for(s in this.arConnections){if(this.arConnections.hasOwnProperty(s)&&this.arConnections[s].id==n.CAL_DAV_CON){n["~CAL_DAV_LAST_SYNC"]=this.arConnections[s].last_result;break}}}this.arSectionsInd[i]=t;if(n.ACTIVE!=="N")this.oActiveSections[i]=true;if(n.ACTIVE!=="N"&&this.IsCurrentViewSect(n))this.activeSectionsCount++;if(!this.lastSection&&n.PERM&&n.PERM.add&&n.ACTIVE!=="N")this.lastSection=parseInt(i)}}this.bOnunload=false;this.actionUrl=e.page;this.path=e.path;this.bUser=this.type=="user";this.meetingRooms=e.meetingRooms||[];this.allowResMeeting=!!e.allowResMeeting;this.bUseMR=this.bIntranet&&this.allowResMeeting&&this.meetingRooms.length>0;if(this.bTasks){this.taskBgColor="#F5B39A";this.taskTextColor="#000000";BX.addCustomEvent("onCalendarPopupTaskAdded",BX.delegate(this.OnTaskChanged,this));BX.addCustomEvent("onCalendarPopupTaskChanged",BX.delegate(this.OnTaskChanged,this));BX.addCustomEvent("onCalendarPopupTaskDeleted",BX.delegate(this.OnTaskKilled,this));this.oActiveSections.tasks=true}for(t in e.hiddenSections){if(e.hiddenSections.hasOwnProperty(t)){this.oActiveSections[e.hiddenSections[t]]=false}}this.typeAccess=this.PERM.access?e.TYPE_ACCESS||{}:null;this.Init()}JCEC.prototype={Init:function(){this.DaysTitleCont=BX(this.id+"_days_title");this.DaysGridCont=BX(this.id+"_days_grid");DenyDragEx(this.DaysGridCont);this.maxEventCount=3;this.activeDateDays={};this._bScelTableSixRows=false;this.oDate=new Date;this.currentDate={date:this.oDate.getDate(),day:this.ConvertDayIndex(this.oDate.getDay()),month:this.oDate.getMonth(),year:this.oDate.getFullYear()};this.activeDate=BX.clone(this.currentDate);if(this.initMonth&&this.initYear){this.activeDate.month=this.initMonth-1;this.activeDate.year=this.initYear}this.activeDate.week=this.GetWeekByDate(this.activeDate);this.arLoadedMonth={};this.arLoadedMonth[this.activeDate.month+"."+this.activeDate.year]=true;this.arLoadedEventsId={};this.arLoadedParentId={};this.Event=new window.JSECEvent(this);this.arConfig.attendees=[];this.HandleEvents(this.arConfig.events,this.arConfig.attendees);var e,t=this;this.selectDaysMode=false;this.selectDaysStartObj=false;this.selectDaysEndObj=false;this.curTimeSelection={};this.curDayTSelection={};this.week_holidays={};for(e=0;e<this.weekHolidays.length;e++)this.week_holidays[this.weekHolidays[e]]=true;this.year_holidays={};for(e in this.yearHolidays)this.year_holidays[this.yearHolidays[e]]=true;this.year_workdays={};for(e in this.yearWorkdays)this.year_workdays[this.yearWorkdays[e]]=true;window.onbeforeunload=function(){t.bOnunload=true};BX.addCustomEvent("onPopupClose",BX.proxy(this._OnPopupCloseHandler,this));this.BuildSectionBlock();this.Selector=new ECMonthSelector(this);this.ColorPicker=new ECColorPicker({});this.BuildButtonsCont();this.pCalCnt.className="bxcal";this.InitTabControl();setTimeout(function(){BX.bind(window,"resize",BX.proxy(t.OnResize,t))},200);if(this.arConfig.syncInfo&&typeof this.arConfig.syncInfo==="object")new ECSyncPannel(this);if(this.arConfig.showNewEventDialog&&!this.bReadOnly)setTimeout(function(){t.ShowEditEventPopup({bChooseMR:t.arConfig.bChooseMR})},1e3)},InitTabControl:function(){this.Tabs={};this.InitTab({id:"month",tabContId:this.id+"_tab_month",bodyContId:this.id+"_scel_table_month"});this.InitTab({id:"week",tabContId:this.id+"_tab_week",bodyContId:this.id+"_scel_table_week",daysCount:7});this.InitTab({id:"day",tabContId:this.id+"_tab_day",bodyContId:this.id+"_scel_table_day",daysCount:1});this.SetTab(this.userSettings.tabId,true)},InitTab:function(e){var t=BX(e.tabContId);if(!t)return;var i=this;t.onclick=function(){i.SetTab(e.id)};this.Tabs[e.id]={id:e.id,pTabCont:t,bodyContId:e.bodyContId,daysCount:e.daysCount||false,needRefresh:false,setActiveDate:false}},SetTab:function(e,t,i){var s=this,n=this.Tabs[e];if(e==this.activeTabId)return;var a=this.activeTabId,o="";if(!n.bLoaded||t){n.pBodyCont=BX(n.bodyContId);BX.bind(n.pBodyCont,"click",BX.proxy(this.EventClick,this));DenyDragEx(n.pBodyCont)}if(this.activeTabId){BX.removeClass(this.Tabs[this.activeTabId].pTabCont,"bxec-tab-div-act");this.Tabs[this.activeTabId].pBodyCont.style.display="none"}BX.addClass(n.pTabCont,"bxec-tab-div-act");this.activeTabId=e;this.Selector.ChangeMode(e);if(!n.bLoaded||t){var r=this.activeDate,l=this.currentDate,h,c,d,u;if(r.month&&r.month!=l.month||r.year&&r.year!=l.year){h=1;c=0;d=r.month;u=r.year}else{var f=a=="day"&&r?r:l;c=this.GetWeekByDate(f);h=f.date;d=f.month;u=f.year}switch(e){case"month":setTimeout(BX.delegate(this.BuildDaysTitle,this),0);this.SetMonth(d,u);break;case"week":this.BuildWeekDaysTable();this.SetWeek(c,d,u);break;case"day":this.BuildSingleDayTable();if(!i||i.bSetDay!==false)this.SetDay(h,d,u);break}n.bLoaded=true}else if(!i||i.bSetDay!==false){if(a=="day"&&e=="week")n.setActiveDate=true;if(n.needRefresh){if(e=="month")this.DisplayEventsMonth(true);else setTimeout(function(){s.ReBuildEvents(e)},20)}else if(n.setActiveDate){switch(e){case"month":this.SetMonth(this.activeDate.month,this.activeDate.year);break;case"week":this.SetWeek(this.GetWeekByDate(this.activeDate),this.activeDate.month,this.activeDate.year);break;case"day":this.SetDay(1,this.activeDate.month,this.activeDate.year);break}}}if(this.startupEvent&&!this.startupEvent.viewed)this.ShowStartUpEvent();n.needRefresh=false;n.setActiveDate=false;this.Selector.Show(e);n.pBodyCont.style.display=o;n.bLoaded=true;if(this._bScelTableSixRows){if(this.activeTabId=="month")BX.addClass(this.pCalCnt,"BXECSceleton-six-rows");else BX.removeClass(this.pCalCnt,"BXECSceleton-six-rows")}if(!t)BX.userOptions.save("calendar","user_settings","tabId",e)},GetWeekByDate:function(e){var t=new Date;t.setFullYear(e.year,e.month,1);var i=this.GetWeekDayByInd(t.getDay());var s=this.GetWeekDayOffset(i)-1;var n=e.date+s;var a=Math.floor(n/7);return a},SetTabNeedRefresh:function(e,t){var i,s;for(i in this.Tabs){s=this.Tabs[i];if(typeof s!="object"||s.id==e)continue;if(!t&&s.needRefresh===false)s.needRefresh=true;else if(t&&s.setActiveDate===false)s.setActiveDate=true}},BuildButtonsCont:function(){this.ButtonsCont=BX(this.id+"_buttons_cont");var e=false,t=this;if(!this.bReadOnly){var i=this.ButtonsCont.appendChild(BX.create("SPAN",{props:{className:"bxec-add-but",title:EC_MESS.AddNewEvent}})),s=i.appendChild(BX.create("I")),n=i.appendChild(BX.create("SPAN",{props:{},html:EC_MESS.Add})),a=i.appendChild(BX.create("A",{props:{href:"javascript: void(0);",className:"bxec-add-more"}}));e=true;s.onclick=n.onclick=BX.proxy(this.ShowEditEventPopup,this);var o=[];o.push({text:EC_MESS.Event,title:EC_MESS.AddNewEvent,className:"bxec-menu-add-event",onclick:function(){t.ClosePopupMenu();t.ShowEditEventPopup()}});if(this.bTasks){o.push({text:EC_MESS.NewTask,title:EC_MESS.NewTaskTitle,className:"bxec-menu-add-task",onclick:function(){t.ClosePopupMenu();t.Event.Edit({bTasks:true})}})}if(this.type=="user"&&this.userId==this.ownerId||this.permEx.section_edit){o.push({text:EC_MESS.NewSect,title:EC_MESS.NewSectTitle,className:"bxec-menu-add-sect",onclick:function(){t.ClosePopupMenu();t.ShowSectionDialog()}})}if(this.bCalDAV&&this.type=="user"&&this.userId==this.ownerId){o.push({text:EC_MESS.NewExtSect,title:EC_MESS.NewExtSectTitle,className:"bxec-menu-add-sect-ex",onclick:function(){t.ClosePopupMenu();t.ShowExternalDialog({})}})}a.onclick=function(){BX.PopupMenu.show("bxec_add_menu"+t.id,a,o,{events:{onPopupClose:function(){BX.removeClass(this.bindElement,"bxec-add-more-over")}},offsetLeft:-(i.offsetWidth-15)});BX.addClass(a,"bxec-add-more-over")}}if(!this.bAnonym){if(e)this.ButtonsCont.appendChild(BX.create("SPAN",{props:{className:"bxec-but-sep"}}));this.ButtonsCont.appendChild(BX.create("SPAN",{props:{className:"bxec-settings-but",title:EC_MESS.Settings},events:{click:BX.proxy(this.ShowSetDialog,this)}}))}this.accessSettingsWrap=BX(this.id+"-access-settings-wrap");if(this.accessSettingsWrap&&this.type!=="group"&&this.type!=="user"&&!this.bAnonym){var t=this;this.accessSettingsWrap.style.display="block";this.accessSettingsLink=BX(this.id+"-access-settings");if(this.PERM.access){BX.bind(this.accessSettingsLink,"click",function(){t.ShowSetDialog({tabId:t.id+"set-tab-2"})})}else{new BX.CHint({parent:this.accessSettingsLink,hint:EC_MESS.accessSettingsWarn});BX.bind(this.accessSettingsLink,"click",function(){alert(EC_MESS.accessSettingsWarn)})}}},ClosePopupMenu:function(){if(BX.PopupMenu&&BX.PopupMenu.currentItem&&BX.PopupMenu.currentItem.popupWindow)BX.PopupMenu.currentItem.popupWindow.close()},SetView:function(e){if(!bxInt(e.week)&&e.week!==0)e.week=this.activeDate.week;if(!bxInt(e.date))e.date=this.activeDate.date;switch(this.activeTabId){case"month":return this.SetMonth(e.month,e.year);case"week":return this.SetWeek(e.week,e.month,e.year);case"day":return this.SetDay(e.date||1,e.month,e.year)}},SetMonth:function(e,t){if(!this.arLoadedMonth[e+"."+t]){return this.LoadEvents(e,t)}var i=this.activeDate.month!=e||this.activeDate.year!=t;this.activeDate.month=e;this.activeDate.year=t;if(!this.activeDate.week)this.activeDate.week=0;if(i)this.SetTabNeedRefresh("month",true);this.Selector.OnChange(t,e);this.BuildDaysGrid(e,t)},BuildDaysTitle:function(){var e,t,i=this.DaysTitleCont.offsetWidth/7;i=Math.round(i*10)/10;for(e=0;e<7;e++){t=this.DaysTitleCont.childNodes[e];t.style.width=i+"px";if(e==6)t.style.width=Math.abs(i-2)+"px"}this.DaysTitleCont.style.visibility="visible"},BuildDaysGrid:function(e,t){BX.cleanNode(this.DaysGridCont);var i=new Date;i.setFullYear(t,e,1);this.dragDrop.Reset();this.activeDateDays=[];this.activeDateObjDays=[];this.arWeeks=[];this.oDaysGridTable=BX.create("TABLE",{props:{className:"bxec-days-grid-table",cellPadding:0,cellSpacing:0}});if(this.GetWeekStart()!=this.GetWeekDayByInd(i.getDay()))this.BuildPrevMonthDays(this.GetWeekDayByInd(i.getDay()),e,t);var s;while(i.getMonth()==e){s=i.getDate();this.BuildDayCell(s,this.GetWeekDayByInd(i.getDay()),true,e,t);i.setDate(s+1)}this.BuildNextMonthDays(this.GetWeekDayByInd(i.getDay()),e,t);this.DaysGridCont.appendChild(this.oDaysGridTable);var n=this.oDaysGridTable.rows.length;if(n==6&&!this._bScelTableSixRows){this._bScelTableSixRows=true;BX.addClass(this.pCalCnt,"BXECSceleton-six-rows")}else if(this.pCalCnt&&this._bScelTableSixRows&&n<6){this._bScelTableSixRows=false;BX.removeClass(this.pCalCnt,"BXECSceleton-six-rows")}this.BuildEventHolder()},BuildPrevMonthDays:function(e,t,i){var s,n=this.GetWeekDayOffset(e),a=new Date;a.setFullYear(i,t,1);a.setDate(a.getDate()-n);for(s=0;s<n;s++){this.BuildDayCell(a.getDate(),this.GetWeekDayByInd(a.getDay()),false,a.getMonth(),a.getFullYear());a.setDate(a.getDate()+1)}},BuildNextMonthDays:function(e,t,i){if(this.GetWeekStart()!=e){var s,n=this.GetWeekDayOffset(e);var a=new Date;a.setFullYear(i,t+1,1);for(s=n;s<7;s++){this.BuildDayCell(a.getDate(),this.GetWeekDayByInd(a.getDay()),false,a.getMonth(),a.getFullYear());a.setDate(a.getDate()+1)}}},BuildDayCell:function(e,t,i,s,n){var a,o,r=this;if(this.GetWeekStart()==t)this._curRow=this.oDaysGridTable.insertRow(-1);var l=this.activeDateDays.length;var h=(this.week_holidays[{MO:0,TU:1,WE:2,TH:3,FR:4,SA:5,SU:6}[t]]||this.year_holidays[e+"."+s])&&!this.year_workdays[e+"."+s];o="bxec-day";if(!i&&!h)o+=" bxec-day-past";else if(!i)o+=" bxec-day-past-hol";else if(h)o+=" bxec-holiday";if(e==this.currentDate.date&&s==this.currentDate.month&&n==this.currentDate.year)o+=" bxec-current-day";a=this._curRow.insertCell(-1);a.id="bxec_ind_"+l;a.className=o;var c=a.appendChild(BX.create("DIV",{props:{className:"bxc-day"},style:{height:this.dayHeight+"px"}})),d=c.appendChild(BX.create("DIV",{props:{className:"bxc-day-title"}})),u=d.appendChild(BX.create("A",{props:{href:"javascript:void(0)",className:"bxc-day-link",title:EC_MESS.GoToDay,id:"bxec-day-lnk-"+l},html:e}));this.dragDrop.RegisterDay(c);u.onmousedown=function(e){return BX.PreventDefault(e)};u.onclick=function(e){var t=r.activeDateDays[this.id.substr("bxec-day-lnk-".length)];r.SetTab("day",false,{bSetDay:false});r.SetDay(t.getDate(),t.getMonth(),t.getFullYear());return BX.PreventDefault(e)};if(this.GetWeekDayOffset(t)==6)a.style.borderRight="0px";if(!this.bReadOnly){a.onmouseover=function(){r.oDayOnMouseOver(this)};a.onmousedown=function(){r.oDayOnMouseDown(this)};a.onmouseup=function(){r.oDayOnMouseUp(this)}}this.activeDateDays.push(new Date(n,s,e));this.activeDateObjDays.push({pDiv:a,pDayCont:c,arEvents:{begining:[],all:[]}})},oDayOnMouseOver:function(e){if(this.selectDaysMode){this.selectDaysEndObj=e;this.SelectDays()}},oDayOnMouseDown:function(e){this.selectDaysMode=true;this.selectDaysStartObj=this.selectDaysEndObj=e;if(e.className.indexOf("bxec-day-selected")==-1)return this.SelectDays();this.selectDaysMode=false;this.DeSelectDays();this.CloseAddEventDialog()},oDayOnMouseUp:function(e){if(!this.selectDaysMode)return;this.selectDaysEndObj=e;this.SelectDays();this.ShowAddEventDialog();this.selectDaysMode=false},oDayOnDoubleClick:function(e){},oDayOnContextMenu:function(e){},RefreshEventsOnWeeks:function(e){for(var t=0,i=e.length;t<i;t++)this.RefreshEventsOnWeek(e[t])},RefreshEventsOnWeek:function(e){var t=e*7,i=(e+1)*7,s,n,a,o,r,l,h,c,d=[],u=0;for(r=0;r<this.maxEventCount;r++)d[r]=0;for(n=t;n<i;n++){s=this.activeDateObjDays[n];if(!s)continue;s.arEvents.hidden=[];o=s.arEvents.begining;c=[];if(o.length>0){o.sort(function(e,t){if(t.daysCount==e.daysCount&&e.daysCount==1)return e.oEvent.DT_FROM_TS-t.oEvent.DT_FROM_TS;return t.daysCount-e.daysCount});e:for(a=0;a<o.length;a++){l=o[a];if(!l)continue;if(!this.arEvents[l.oEvent.ind]){s.arEvents.begining=o=BX.util.deleteFromArray(o,a);l=o[a];if(!l)continue}for(r=0;r<this.maxEventCount;r++){if(d[r]-u<=0){d[r]=u+l.daysCount;this.ShowEventOnLevel(l.oEvent.oParts[l.partInd],r,e);continue e}}c[l.oEvent.ID]=true;s.arEvents.hidden.push(l)}}h=s.arEvents.all;for(var f=0;f<h.length;f++){l=h[f];if(!l||c[l.oEvent.ID])continue;if(!this.arEvents[l.oEvent.ind]){s.arEvents.all=h=BX.util.deleteFromArray(h,f);l=h[f];if(!l)continue}if(l.oEvent.oParts&&l.partInd!=undefined&&l.oEvent.oParts[l.partInd]&&l.oEvent.oParts[l.partInd].style.display=="none")s.arEvents.hidden.push(l)}this.ShowMoreEventsSelect(s);u++}},ShowEventOnLevel:function(e,t,i){if(!this.arWeeks[i])this.arWeeks[i]={top:parseInt(this.oDaysGridTable.rows[i].cells[0].offsetTop)+22};var s=this.arWeeks[i].top+t*18;e.style.display="block";e.style.top=s+"px"},ShowMoreEventsSelect:function(e){var t=e.arEvents.hidden;if(t.length<=0){if(e.pMoreDiv)e.pMoreDiv.style.display="none";return}if(!e.pMoreDiv)e.pMoreDiv=e.pDayCont.appendChild(BX.create("DIV",{props:{className:"bxc-day-more"}}));var i=this,s,n,a,o=[];for(s=0;s<t.length;s++){n=t[s];a=n.oEvent.oParts[n.partInd];a.style.display="none";if(!n.oEvent.pMoreDivs)n.oEvent.pMoreDivs=[];n.oEvent.pMoreDivs.push(e.pMoreDiv);o.push({pDiv:a,oEvent:n.oEvent})}BX.adjust(e.pMoreDiv,{style:{display:"block"},html:EC_MESS.MoreEvents+" ("+o.length+" "+EC_MESS.Item+")"});e.pMoreDiv.onmousedown=function(e){if(!e)e=window.event;BX.PreventDefault(e)};e.pMoreDiv.onclick=function(){i.ShowMoreEventsWin({Events:o,id:e.pDiv.id,pDay:e.pDiv,pSelect:e.pMoreDiv})}},SelectDays:function(){if(!this.arSelectedDays)this.arSelectedDays=[];this.bInvertedDaysSelection=false;if(this.arSelectedDays.length>0)this.DeSelectDays();if(!this.selectDaysStartObj||!this.selectDaysEndObj)return;var e=this.GetDayIndexByElement(this.selectDaysStartObj),t=this.GetDayIndexByElement(this.selectDaysEndObj),i,s,n;if(e>t){n=t;t=e;e=n;this.bInvertedDaysSelection=true}for(s=e;s<=t;s++){i=this.activeDateObjDays[s];if(!i||!i.pDiv)continue;BX.addClass(i.pDiv,"bxec-day-selected");this.arSelectedDays.push(i.pDiv)}},GetDayIndexByElement:function(e){return parseInt(e.id.substr(9))},GetDayByIndex:function(e){return this.activeDateObjDays[e]},DeSelectDays:function(){if(!this.arSelectedDays)return;var e,t;for(e=0,t=this.arSelectedDays.length;e<t;e++)BX.removeClass(this.arSelectedDays[e],"bxec-day-selected");this.arSelectedDays=[]},DisplayError:function(e,t){var i=this;setTimeout(function(){if(!i.bOnunload){alert(e||"[Event Calendar] Error!");if(t)BX.reload()}},200)},BuildSectionBlock:function(){this.oSections={};var e=this.sectionControlsDOMId&&(this.pSidebar=BX(this.sectionControlsDOMId));this.pSectCont=BX(this.id+"_sect_cont");if(!this.pSectCont)return;if(e){if(this.pSidebar.firstChild)this.pSidebar.insertBefore(this.pSectCont,this.pSidebar.firstChild);else this.pSidebar.appendChild(this.pSectCont);BX.addClass(this.pSectCont,"bxec-sect-cont-side")}else{BX.addClass(this.pSectCont,"bxec-sect-cont-top")}var t=this;if(this.arSections.length<1&&this.bReadOnly){this.pSectCont.style.display="none";return}this.pSectCont.style.display="block";this.pOwnerSectCont=BX(this.id+"sections");if(this.pOwnerSectCont){this.pOwnerSectCont.onmouseover=function(){if(t._sect_over_timeout){clearInterval(t._sect_over_timeout)}BX.addClass(t.pOwnerSectCont,"bxec-hover")};this.pOwnerSectCont.onmouseout=function(){t._sect_over_timeout=setTimeout(function(){BX.removeClass(t.pOwnerSectCont,"bxec-hover")},100)}}this.pOwnerSectBlock=BX(this.id+"sections-cont");if(!this.pOwnerSectBlock)return;BX.cleanNode(this.pOwnerSectBlock);this.pOwnerSectBlock.style.display="";this.pSPSectCont=BX(this.id+"sp-sections");if(this.bSuperpose){this.pSPSectCont.onmouseover=function(){if(t._sect_over_timeout){clearInterval(t._sect_over_timeout)}BX.addClass(t.pSPSectCont,"bxec-hover")};this.pSPSectCont.onmouseout=function(){t._sect_over_timeout=setTimeout(function(){BX.removeClass(t.pSPSectCont,"bxec-hover")},100)};this.pSpSectBlock=BX(this.id+"sp-sections-cont");var i=BX(this.id+"-manage-superpose");i.onclick=function(){t.ShowSuperposeDialog()}}this.BuildSectionElements();var s=BX(this.id+"-add-section");if(this.Personal()||this.permEx.section_edit){if(s)s.onclick=function(){t.ShowSectionDialog()}}else{if(s)BX.cleanNode(s,true)}},BuildSectionElements:function(){var e=false,t=false,i,s;for(i=0;i<this.arSections.length;i++){s=this.arSections[i];if(!s.DOM)s.DOM={};if(s.ACTIVE!=="N"){if(!this.bSuperpose||s.CAL_TYPE==this.type&&s.OWNER_ID==this.ownerId){if(s.DOM.pEl)this.BuildSectionMenu(s.ID);else this.BuildSectionElement(s,this.oActiveSections[s.ID]);if(!e)e=true}if(this.bSuperpose&&!this.bAnonym){if(s.SUPERPOSED){if(s.DOM.pSPEl)this.BuildSectionMenu(s.ID,true);else this.BuildSectionElement(s,this.oActiveSections[s.ID],true)}else if(!s.SUPERPOSED&&s.DOM.pSPEl){if(s.DOM.pSPEl.parentNode)s.DOM.pSPEl.parentNode.removeChild(s.DOM.pSPEl);var n="bxec-sect-sp-"+s.ID;if(this.arMenuItems[n]){if(BX.PopupMenu.Data[n]){BX.PopupMenu.Data[n].popupWindow.destroy();BX.PopupMenu.Data[n]=false}this.arMenuItems[n]=null;delete this.arMenuItems[n]}s.DOM.pSPEl=s.DOM.pSPWrap=s.DOM.pSPText=null;delete s.DOM.pSPEl;delete s.DOM.pSPWrap;delete s.DOM.pSPText}if(s.SUPERPOSED&&!t)t=true}}}if(this.bTasks&&!this.oSections["tasks"]){e=true;this.BuildSectionElement({ID:"tasks",CAL_TYPE:"user",COLOR:this.taskBgColor,CREATED_BY:this.userId,DESCRIPTION:EC_MESS.MyTasks,DOM:{},NAME:EC_MESS.MyTasks,OWNER_ID:this.userId,PERM:{},SORT:100,SUPERPOSED:false,TEXT_COLOR:this.taskTextColor},this.oActiveSections.tasks)}if(this.pSPSectCont)this.pSPSectCont.style.display=t?"":"none";this.pOwnerSectCont.style.display=e?"":"none";return true},BuildSectionElement:function(e,t,i){i=!!i;if(!e.DOM)e.DOM={};var s=this.bCalDAV&&e.CAL_DAV_CAL&&e.CAL_DAV_CON&&e["~CAL_DAV_LAST_SYNC"],n=this.bTasks&&e.ID=="tasks",a=this.pOwnerSectBlock;if(i){a=this.pSpSectBlock}else{if(n){a=BX(this.id+"tasks-sections-cont")}else{if(!this.pSectSubCont)this.pSectSubCont=this.pOwnerSectBlock.appendChild(BX.create("DIV"));a=this.pSectSubCont}}e.bDark=this.ColorIsDark(e.COLOR);var o=this,r=[],l="bxec-sect-"+(i?"sp-":"")+e.ID,h=a.appendChild(BX.create("DIV",{props:{id:"el-"+l,className:"bxec-sect-el"}})),c=h.appendChild(BX.create("DIV",{props:{className:"bxec-sect-el-wrap"+(n?" bxec-task-el-wrap":"")}}));c.appendChild(BX.create("SPAN",{props:{className:"bxec-spr bxec-checkbox"}}));if(n)c.appendChild(BX.create("SPAN",{props:{className:"bxec-spr bxec-tasks-sect"}}));if(s){if(e["~CAL_DAV_LAST_SYNC"].indexOf("[200]")>=0)e.DOM.pStatus=c.appendChild(BX.create("SPAN",{props:{className:"bxec-spr bxec-cal-dav-google"}}));else e.DOM.pStatus=c.appendChild(BX.create("SPAN",{props:{className:"bxec-spr bxec-cal-dav-google-fail",title:EC_MESS.SyncError+": "+e["~CAL_DAV_LAST_SYNC"]}}))}var d=c.appendChild(BX.create("DIV",{text:e.NAME,props:{className:"bxc-sect-text-wrap"}})),u=h.appendChild(BX.create("A",{props:{id:l,href:"javascript: void(0);",className:"bxec-spr bxec-sect-menu",hidefocus:true}}));u.onclick=function(e){o.ShowCPopup(this.id,this);return BX.PreventDefault(e)};if(i){e.DOM.pSPEl=h;e.DOM.pSPWrap=c;e.DOM.pSPText=d}else{e.DOM.pEl=h;e.DOM.pWrap=c;e.DOM.pText=d}h.onclick=function(){o.ShowCalendar(e,this.className.indexOf("bxec-sect-el-checked")==-1)};this.oSections[e["ID"]]=e;this.oActiveSections[e["ID"]]=t;this.BuildSectionMenu(e["ID"],i);this.ShowCalendar(e,t,true)},BuildSectionMenu:function(sectionId,bSuperpose){var el=this.oSections[sectionId];if(!el||this.bTasks&&el.ID=="tasks")return false;if(!el.PERM)el.PERM={};var _this=this,menu=[],isGoogle=el.CAL_DAV_CAL&&el.CAL_DAV_CON,isFirstExchange=this.arConfig.bExchange&&el.IS_EXCHANGE&&el.DAV_EXCH_CAL=="calendar_"+el.OWNER_ID,pEl=bSuperpose?el.DOM.pSPEl:el.DOM.pEl,menuId="bxec-sect-"+(bSuperpose?"sp-":"")+el.ID;if(BX.PopupMenu.Data[menuId]&&BX.PopupMenu.Data[menuId].popupWindow){BX.PopupMenu.Data[menuId].popupWindow.destroy();BX.PopupMenu.Data[menuId]=false}if(el.LINK){menu.push({text:EC_MESS.OpenCalendar,href:el.LINK,className:"bxec-menu-sect-add2sp"})}if(el.PERM.edit_section&&this.permEx.section_edit&&!bSuperpose){menu.push({text:EC_MESS.Edit,title:EC_MESS.EditCalendarTitle,className:"bxec-menu-sect-edit",onclick:function(){_this.CloseCPopup();_this.ShowSectionDialog(el)}})}if(!el.SUPERPOSED){menu.push({text:EC_MESS.CalAdd2SP,title:EC_MESS.CalAdd2SPTitle,className:"bxec-menu-sect-add2sp",onclick:function(){_this.CloseCPopup();_this.SetSuperposed(el,true)}})}else if(el.SUPERPOSED){menu.push({text:EC_MESS.CalHide,title:EC_MESS.CalHideTitle,className:"bxec-menu-sect-del-from-sp",onclick:function(){_this.CloseCPopup();_this.SetSuperposed(el,false)}})}if(el.OUTLOOK_JS&&!isGoogle&&!BX.browser.IsMac()){menu.push({text:EC_MESS.ConnectToOutlook,title:EC_MESS.ConnectToOutlookTitle,className:"bxec-menu-sect-outlook",onclick:function(){_this.CloseCPopup();if(!window.jsOutlookUtils)BX.loadScript("/bitrix/js/calendar/outlook.js",function(){try{eval(el.OUTLOOK_JS)}catch(e){}});else try{eval(el.OUTLOOK_JS)}catch(e){}}})}if(el.EXPORT&&el.EXPORT.ALLOW){menu.push({text:EC_MESS.Export,title:EC_MESS.ExportTitle,className:"bxec-menu-sect-export",onclick:function(){_this.CloseCPopup();_this.ShowExportDialog(el)}})}if(el.PERM.edit_section&&this.permEx.section_edit&&!isGoogle&&!bSuperpose&&!isFirstExchange){menu.push({text:EC_MESS.Delete,title:EC_MESS.DelCalendarTitle,className:"bxec-menu-sect-del",onclick:function(){_this.CloseCPopup();_this.DeleteSection(el)}})}if(el.PERM.edit_section&&isGoogle&&!bSuperpose){menu.push({text:EC_MESS.Refresh,className:"bxec-menu-sect-edit",onclick:function(){_this.CloseCPopup();_this.bSyncGoogle=true;_this.Event.ReloadAll()}});menu.push({text:EC_MESS.Adjust,title:EC_MESS.CalDavDialogTitle,className:"bxec-menu-sect-edit",onclick:function(){_this.CloseCPopup();_this.ShowExternalDialog({})}});menu.push({text:EC_MESS.googleHide,className:"bxec-menu-sect-del",onclick:function(){_this.CloseCPopup();_this.HideCalDavSection(el);_this.Event.ReloadAll()}})}this.arMenuItems[menuId]=menu;if(menu.length>0){pEl.onmouseover=function(){if(_this["_sect_el_over_timeout"+this.id]){clearInterval(_this["_sect_el_over_timeout"+this.id])}BX.addClass(pEl,"bxec-sect-el-hover")};pEl.onmouseout=function(){_this["_sect_el_over_timeout"+this.id]=setTimeout(function(){BX.removeClass(pEl,"bxec-sect-el-hover")},100)}}else{pEl.onmouseover=BX.False;pEl.onmouseout=BX.False}},ShowCPopup:function(e,t){if(this.arMenuItems[e]){BX.PopupMenu.show(e,t,this.arMenuItems[e],{events:{onPopupClose:function(){BX.removeClass(this.bindElement,"bxec-menu-over")}}});BX.addClass(t,"bxec-menu-over")}},CloseCPopup:function(){BX.PopupMenu.currentItem.popupWindow.close()},ColorIsDark:function(e){if(!e)return false;if(e.charAt(0)=="#")e=e.substring(1,7);var t=parseInt(e.substring(0,2),16),i=parseInt(e.substring(2,4),16),s=parseInt(e.substring(4,6),16),n=(t*.8+i+s*.2)/510*100;return n<50},AppendCalendarHint:function(e,t){if(e.oHint&&e.oHint.Destroy)e.oHint.Destroy();var i;if(t&&e.SP_PARAMS)i="<b>"+e.SP_PARAMS.GROUP_TITLE+" > "+e.SP_PARAMS.NAME+" > "+e.NAME+"</b>";else i="<b>"+e.NAME+"</b>";var s=e.DESCRIPTION.length,n=350;if(s>0){if(s<n)i+="<br>"+e.DESCRIPTION;else i+="<br>"+e.DESCRIPTION.substr(0,n)+"..."}e.oHint=new BX.CHintSimple({parent:e._pElement,hint:i})},ShowCalendar:function(e,t,i){if(!e)return;if(t){if(e.DOM.pEl){e.DOM.pEl.style.backgroundColor=e.COLOR;BX.addClass(e.DOM.pEl,"bxec-sect-el-checked")}var s=e.TEXT_COLOR;if(!s)s=e.bDark?this.darkColor:this.brightColor;if(e.DOM.pText)e.DOM.pText.style.color=s;if(e.DOM.pSPEl){BX.addClass(e.DOM.pSPEl,"bxec-sect-el-checked");e.DOM.pSPEl.style.backgroundColor=e.COLOR}if(e.DOM.pSPText)e.DOM.pSPText.style.color=s}else{if(e.DOM.pEl){BX.removeClass(e.DOM.pEl,"bxec-sect-el-checked");e.DOM.pEl.style.backgroundColor="transparent"}if(e.DOM.pText)e.DOM.pText.style.color="#484848";if(e.DOM.pSPEl){BX.removeClass(e.DOM.pSPEl,"bxec-sect-el-checked");e.DOM.pSPEl.style.backgroundColor="transparent"}if(e.DOM.pSPText)e.DOM.pSPText.style.color="#484848"}this.oActiveSections[e.ID]=e.bShowed=!!t;if(!i){this.SetTabNeedRefresh(this.activeTabId);this.Event.ReloadAll()}},SaveSection:function(){var e=this.oSectDialog,t=e.CAL.oSect;e.CAL.DOM.Name.value=BX.util.trim(e.CAL.DOM.Name.value);if(e.CAL.DOM.Name.value==""){alert(EC_MESS.CalenNameErr);this.bEditCalDialogOver=true;return false}var i=this.GetReqData("section_edit",{name:e.CAL.DOM.Name.value,desc:e.CAL.DOM.Desc.value,color:e.CAL.Color,text_color:e.CAL.TextColor});if(e.CAL.Access)i.access=e.CAL.Access.GetValues();if(t.ID)i.id=bxInt(t.ID);if(e.CAL.DOM.Exch)i.is_exchange=e.CAL.DOM.Exch.checked?"Y":"N";if(e.CAL.DOM.ExpAllow.checked){i["export"]="Y";i.exp_set=e.CAL.DOM.ExpSet?e.CAL.DOM.ExpSet.value:"all"}var s=this;this.Request({postData:i,errorText:EC_MESS.CalenSaveErr,handler:function(e){if(e&&e.calendar&&e.calendar.ID){if(e.accessNames)s.HandleAccessNames(e.accessNames);s.SaveSectionClientSide(e.calendar);return true}return false}});return true},SaveSectionClientSide:function(e){if(e.EXPORT&&!e.EXPORT.ALLOW)e.EXPORT=false;this.arSPSections=null;if(typeof this.arSectionsInd[e.ID]=="undefined"){this.arSections.push(e);this.arSectionsInd[e.ID]=this.arSections.length-1;this.BuildSectionElement(e,true);this.SaveLastSection(e.ID);if(this.bSuperpose&&this.oSectDialog.CAL.DOM.add2SP)this.SetSuperposed(e,!this.oSectDialog||this.oSectDialog.CAL.DOM.add2SP.checked)}else{var t,i=this.arSections[this.arSectionsInd[e.ID]],s=i.COLOR,n=i.TEXT_COLOR,a=!i||e.COLOR!=s||e.TEXT_COLOR!=n;if(!i)return;for(t in e){if(e.hasOwnProperty(t))i[t]=e[t]}i.DOM.pText.innerHTML=BX.util.htmlspecialchars(i.NAME);if(i.DOM.pSPText)i.DOM.pSPText.innerHTML=BX.util.htmlspecialchars(i.NAME);i.bDark=this.ColorIsDark(i.COLOR);this.BuildSectionMenu(e.ID);if(i.DOM.pSPEl)this.BuildSectionMenu(e.ID,true);if(a)this.UpdateSectionColor(i,s,n);this.ShowCalendar(i,i.bShowed,true)}},HideCalDavSection:function(e){if(e.ID&&confirm(EC_MESS.googleHideConfirm)){var t=this;this.Request({getData:this.GetReqData("section_caldav_hide",{id:e.ID}),handler:function(i){if(i.refreshView)BX.reload();return i.result?t.DeleteSectionClientSide(e):false}})}},DeleteSection:function(e){if(!e.ID||!confirm(EC_MESS.DelCalendarConfirm))return false;var t=this;this.Request({getData:this.GetReqData("section_delete",{id:e.ID}),errorText:EC_MESS.DelCalendarErr,handler:function(i){return i.result?t.DeleteSectionClientSide(e):false}});return true},DeleteSectionClientSide:function(e){BX.cleanNode(e.DOM.pEl,true);if(e.DOM.pSPEl)BX.cleanNode(e.DOM.pSPEl,true);var t;for(t=0;t<this.arSections.length;t++){if(this.arSections[t].ID==e.ID){this.arSections=BX.util.deleteFromArray(this.arSections,t);break}}this.arSPSections=null;delete this.oActiveSections[e.ID];delete this.oSections[e.ID];this.Event.ReloadAll()},UpdateSectionColor:function(e,t,i){if(!e)return;var s=e.COLOR,n=e.TEXT_COLOR?e.TEXT_COLOR:e.bDark?this.darkColor:this.brightColor;e.DOM.pEl.style.backgroundColor=s;e.DOM.pText.style.color=n;var a,o,r=[["oTLParts","week"],["oTLParts","day"],["oDaysT","week"],["oDaysT","day"]],l,h=this.arEvents.length,c,d,u,f,p;for(l=0;l<h;l++){c=this.arEvents[l];if(!c)continue;a=!c.displayColor||!t||c.displayColor===t;o=!c.displayTextColor||!i||c.displayTextColor===i;if(c.SECT_ID!=e.ID||!a&&!o)continue;u=c.oParts.length;for(d=0;d<u;d++){if(a)c.oParts[d].style.backgroundColor=s;if(o)c.oParts[d].style.color=n}u=r.length;for(d=0;d<u;d++){if(c[r[d][0]]&&c[r[d][0]][r[d][1]]){p=c[r[d][0]][r[d][1]];if(typeof p=="object"&&p.nodeType){if(a)p.style.backgroundColor=s;if(o)p.style.color=n}else{for(f=0;f<p.length;f++){if(a)p[f].style.backgroundColor=s;if(o)p[f].style.color=n}}}}if(a)c.displayColor=s}},ShowAllCalendars:function(e,t){var i=t?this.arSPCalendarsShow:this.arSections;var s,n=i.length;for(s=0;s<n;s++){el=i[s];this.ShowCalendar(el,e,true,!t)}this.Event.ReloadAll()},CheckCalBarGlobChecker:function(e,t){var i=t?"CalBarGlobCheckerSP":"CalBarGlobChecker";if(e=="none"){this[i].pWnd.className="bxec-cal-bar-none";this[i].pWnd.title=""}else if(e){this[i].flag=false;this[i].pWnd.className="bxec-iconkit bxec-cal-bar-check";this[i].pWnd.title=EC_MESS.DeSelectAll}else{this[i].flag=true;this[i].pWnd.className="bxec-iconkit bxec-cal-bar-uncheck";this[i].pWnd.title=EC_MESS.SelectAll}},SetSuperposed:function(e,t){
if(e)e.SUPERPOSED=!!t;var i=this,s,n=[];for(s=0;s<this.arSections.length;s++){if(this.arSections[s].SUPERPOSED)n.push(parseInt(this.arSections[s].ID))}this.Request({getData:this.GetReqData("set_superposed",{sect:n,trackedUser:e&&e.CAL_TYPE=="user"?e.OWNER_ID:0}),errorText:EC_MESS.AppendSPCalendarErr,handler:function(e){if(e.result){if(!i.bSuperpose)return BX.reload();return i.BuildSectionElements()}return false}})},GetCenterWindowPos:function(e,t){if(!e)e=400;if(!t)t=300;var i=BX.GetWindowSize(document);var s=bxInt(bxInt(i.scrollTop)+(i.innerHeight-t)/2-30);var n=bxInt(bxInt(i.scrollLeft)+(i.innerWidth-e)/2-30);return{top:s,left:n}},ShowStartUpEvent:function(){var e=this,t,i,s=false;for(i=0;i<this.arEvents.length;i++){t=this.arEvents[i];if(this.startupEvent.ID==t.ID||this.startupEvent.PARENT_ID==t.PARENT_ID&&t["~TYPE"]!="tasks"){if(this.startupEvent.EDIT){setTimeout(function(){e.Event.Edit({oEvent:t})},1e3);break}else{if(!s)s=t;if(this.startupEvent.RRULE&&this.startupEvent["~CURRENT_DATE"]&&this.FormatDate(BX.parseDate(t.DATE_FROM))==this.startupEvent["~CURRENT_DATE"]){s=t;break}}}}if(s){setTimeout(function(){e.Event.View(s)},1e3)}this.startupEvent.viewed=true},SaveSettings:function(){var e=this.oSetDialog;if(e.CAL.inPersonal){this.userSettings.blink=e.CAL.DOM.Blink.checked?1:0;this.userSettings.showDeclined=e.CAL.DOM.ShowDeclined.checked?1:0;this.userSettings.meetSection=e.CAL.DOM.SectSelect.value}this.userSettings.showMuted=e.CAL.DOM.ShowMuted.checked?1:0;this.userSettings.denyBusyInvitation=e.CAL.DOM.denyBusyInvitation.checked?1:0;if(e.CAL.DOM.TimezoneSelect)this.arConfig.userTimezoneName=e.CAL.DOM.TimezoneSelect.value;var t=this.GetReqData("save_settings",{user_settings:this.userSettings,user_timezone_name:this.arConfig.userTimezoneName});if(this.PERM.access){t.type_access=e.CAL.Access.GetValues();e.CAL.Access.SetSelected(this.typeAccess);this.settings.work_time_start=e.CAL.DOM.WorkTimeStart.value;this.settings.work_time_end=e.CAL.DOM.WorkTimeEnd.value;this.settings.week_holidays=[];for(var i=0,s=e.CAL.DOM.WeekHolidays.options.length;i<s;i++)if(e.CAL.DOM.WeekHolidays.options[i].selected)this.settings.week_holidays.push(e.CAL.DOM.WeekHolidays.options[i].value);this.settings.year_holidays=e.CAL.DOM.YearHolidays.value;this.settings.year_workdays=e.CAL.DOM.YearWorkdays.value;t.settings=this.settings}this.Request({postData:t,handler:function(){BX.reload()}})},ClearPersonalSettings:function(){this.Request({postData:this.GetReqData("save_settings",{clear_all:1}),handler:function(){BX.reload()}})},GetUserHref:function(e){return this.pathToUser.replace(/#user_id#/gi,e)},GetUserProfileLink:function(e,t,i,s,n){var a;if(i.type=="ext"){a="";if(i.email)a=BX.util.htmlspecialchars(i.email);else if(i.name)a=BX.util.htmlspecialchars(i.name);return a}else{var o=this.arConfig.pathToUser.toLowerCase();o=o.replace("#user_id#",e);s=s?' class="'+s+'"':"";if(!t)return o;a=BX.util.htmlspecialchars(i.name);if(n)a+=' <span style="font-weight: normal !important;">('+EC_MESS.Host+")</span>";return"<a"+s+' href="'+o+'" target="_blank" title="'+EC_MESS.UserProfile+": "+BX.util.htmlspecialchars(i.name)+'" >'+a+"</a>"}},Day:function(e){return this.days[{MO:0,TU:1,WE:2,TH:3,FR:4,SA:5,SU:6}[e]]},GetWeekDayByInd:function(e){return["SU","MO","TU","WE","TH","FR","SA"][e]},ConvertDayIndex:function(e){if(e==0)return 6;return e-1},Request:function(e){if(!e.url)e.url=this.actionUrl;if(e.bIter!==false)e.bIter=true;if(!e.postData&&!e.getData)e.getData=this.GetReqData();var t;if(!e.errorText)t=false;var i=e.getData?e.getData.reqId:e.postData.reqId;e.reqId=i;var s=this,n=0,a;if(e.handler){a=function(t){var a=function(){if(s.requests[i].status!=="canceled"){var o=t.toLowerCase().indexOf("bx_event_calendar_action_error");if(!t||t.length<=0||o!=-1){var r="";if(o>=0){var l=o+"BX_EVENT_CALENDAR_ACTION_ERROR:".length,h=t.indexOf("-->",l);r=t.substr(l,h-l)}if(e.onerror&&typeof e.onerror=="function")e.onerror();return s.DisplayError(r||e.errorText||"")}s.requests[i].status="complete";var c=e.handler(s.GetRequestRes(i),t);if(c===false&&++n<20&&e.bIter)setTimeout(a,5);else s.ClearRequestRes(i)}};setTimeout(a,50)}}else{a=BX.DoNothing()}this.requests[e.reqId]={status:"sent",xhr:e.postData?BX.ajax.post(e.url,e.postData,a):BX.ajax.get(e.url,e.getData,a)};return e},GetReqData:function(e,t){if(!t)t={};if(e)t.action=e;t.sessid=BX.bitrix_sessid();t.bx_event_calendar_request="Y";t.reqId=Math.round(Math.random()*1e6);return t},CancelRequest:function(e){if(this.requests[e]&&this.requests[e].status=="sent")this.requests[e].status="canceled"},GetRequestRes:function(e){if(top.BXCRES&&typeof top.BXCRES[e]!="undefined")return top.BXCRES[e];return{}},ClearRequestRes:function(e){if(top.BXCRES){top.BXCRES[e]=null;delete top.BXCRES[e]}},ExtendUserSearchInput:function(){if(!window.SonetTCJsUtils)return;var e=this;if(!SonetTCJsUtils.EC__GetRealPos)SonetTCJsUtils.EC__GetRealPos=SonetTCJsUtils.GetRealPos;SonetTCJsUtils.GetRealPos=function(t){var i=SonetTCJsUtils.EC__GetRealPos(t);if(e.oSuperposeDialog&&e.oSuperposeDialog.bShow){scrollTop=e.oSuperposeDialog.oCont.scrollTop;i.top=bxInt(i.top)-scrollTop;i.bottom=bxInt(i.bottom)-scrollTop}return i}},ParseLocation:function(e,t){if(!e)e="";var i={mrid:false,mrevid:false,str:e};if(e.length>5&&e.substr(0,5)=="ECMR_"){var s=e.split("_");if(s.length>=2){if(!isNaN(parseInt(s[1]))&&parseInt(s[1])>0)i.mrid=parseInt(s[1]);if(!isNaN(parseInt(s[2]))&&parseInt(s[2])>0)i.mrevid=parseInt(s[2])}}if(i.mrid&&t===true){for(var n=0,a=this.meetingRooms.length;n<a;n++){if(this.meetingRooms[n].ID==i.mrid){i.mrind=n;i.MR=this.meetingRooms[n];break}}}return i},OnResize:function(e){if(this._resizeTimeout)this._resizeTimeout=clearTimeout(this._resizeTimeout);var t=this;if(e!==false){this._resizeTimeout=setTimeout(function(){t.OnResize(false)},e||200)}else{switch(this.activeTabId){case"month":setTimeout(BX.delegate(this.BuildDaysTitle,this),100);break;case"week":case"day":this.ResizeTabTitle(this.Tabs[this.activeTabId]);break}this.bJustRedraw=true;this.SetView({month:this.activeDate.month,year:this.activeDate.year});setTimeout(function(){t.bJustRedraw=false},500)}},_OnPopupCloseHandler:function(e){if(e&&e.popupContainer&&e.popupContainer.id&&e.popupContainer.id.indexOf("timeman")!==-1){this.OnResize()}BX.removeCustomEvent("onPopupClose",BX.proxy(this._OnPopupCloseHandler,this))},CreateStrut:function(e){return BX.create("DIV",{style:{width:e+"px",height:"1px"}})},CheckMouseInCont:function(e,t,i){var s=BX.pos(e),n=BX.GetWindowScrollPos(),a=t.clientX+n.scrollLeft,o=t.clientY+n.scrollTop;if(typeof i=="undefined")i=0;return a>=s.left-i&&a<=s.right+i&&o<=s.bottom+i&&o>=s.top-i},SaveCalDavConnections:function(e,t){var i=[],s,n;for(s=0;s<this.arConnections.length;s++){n=this.arConnections[s];var a={};for(var o in n.sections){if(!n.sections.hasOwnProperty(o))continue;a[o]=n.sections[o].checked?"Y":"N"}i.push({id:n.id||0,name:n.name,link:n.link,user_name:n.user_name,pass:typeof n.pass=="undefined"?"bxec_not_modify_pass":n.pass,del:n.del?"Y":"N",del_calendars:n.pDelCalendars.checked?"Y":"N",sections:a})}this.Request({postData:this.GetReqData("connections_edit",{connections:i}),handler:function(){setTimeout(function(){if(e&&typeof e=="function")e(true)},100)},onerror:function(){if(t&&typeof t=="function")t()}});return true},IsDavCalendar:function(e){return this.oSections[e]&&(this.oSections[e].IS_EXCHANGE||this.oSections[e].CAL_DAV_CON)},Section:function(e){var t={};if(this.arSectionsInd[e]&&this.arSections[this.arSectionsInd[e]])t=this.arSections[this.arSectionsInd[e]];return t},CanDo:function(e,t){var i=this.Section(t);return i.ID&&i.PERM[e]},DefaultAction:function(e){if(typeof e=="undefined"&&!this.bDoDefault){this.bDoDefault=true;return false}if(e===false)this.bDoDefault=false;return true},OnTaskChanged:function(){if(!this.oActiveSections["tasks"])return this.ShowCalendar(this.oSections["tasks"],true);this.Event.ReloadAll()},OnTaskKilled:function(e){for(var t=0,i=this.arEvents.length;t<i;t++){if(this.arEvents[t]["~TYPE"]=="tasks"&&this.arEvents[t].ID==e){this.Event.UnDisplay(this.arEvents[t]);break}}},HandleAccessNames:function(e){for(var t in e){if(e.hasOwnProperty(t))this.arNames[t]=e[t]}},GetAccessName:function(e){return this.arNames[e]||e},GetMeetingSection:function(){if(this.userSettings.meetSection&&this.oSections[this.userSettings.meetSection]&&this.oSections[this.userSettings.meetSection].ACTIVE!=="N"){return this.userSettings.meetSection}return this.arSections[0]["ID"]},CheckMeetingRoom:function(e,t){this.Request({postData:this.GetReqData("check_meeting_room",e),handler:function(e){if(e){if(t&&typeof t=="function")t(e.check);return true}}})},AddGroupMembers:function(){var e=this,t={};this.Request({postData:this.GetReqData("get_group_members",t),handler:function(t){if(t){if(t.users)BX.onCustomEvent(e,"onGetGroupMembers",[t.users]);return true}}})},ItsYou:function(e){if(e==this.userId)return'<span class="bxc-it-is-you"> ('+EC_MESS.ItIsYou+")</span>";return""},Personal:function(){return this.type=="user"&&this.ownerId==this.userId},GetFreeDialogColor:function(){var e=this.Colors[0],t,i={},s;for(t in this.Colors)i[this.Colors[t]]=true;for(t in this.arSections){s=this.arSections[t].COLOR;if(i[s])i[s]=false}for(t in i){if(i[t]){e=t;break}}return e},FormatDate:function(e){return BX.date.format(this.DATE_FORMAT,e.getTime()/1e3)},FormatTime:function(e,t){return BX.date.format(t===true?this.TIME_FORMAT:this.TIME_FORMAT_SHORT,e.getTime()/1e3)},FormatDateTime:function(e){return BX.date.format(this.DATETIME_FORMAT,e.getTime()/1e3)},ParseDate:function(e,t){var i=false;var s=BX.message("FORMAT_DATETIME");e=BX.util.trim(e);if(t!==false)s=s.replace(":SS","");if(BX.type.isNotEmptyString(e)){var n="";for(l=1;l<=12;l++){n=n+"|"+BX.message("MON_"+l)}var a=new RegExp("([0-9]+|[a-z]+"+n+")","ig");var o=e.match(a),r=BX.message("FORMAT_DATE").match(/(DD|MI|MMMM|MM|M|YYYY)/gi),l,h,c=[],d=[],u={};if(!o)return null;if(o.length>r.length){r=s.match(/(DD|MI|MMMM|MM|M|YYYY|HH|H|SS|TT|T|GG|G)/gi)}for(l=0,h=o.length;l<h;l++){if(BX.util.trim(o[l])!=""){c[c.length]=o[l]}}for(l=0,h=r.length;l<h;l++){if(BX.util.trim(r[l])!=""){d[d.length]=r[l]}}var f=BX.util.array_search("MMMM",d);if(f>0){c[f]=BX.getNumMonth(c[f]);d[f]="MM"}else{f=BX.util.array_search("M",d);if(f>0){c[f]=BX.getNumMonth(c[f]);d[f]="MM"}}for(l=0,h=d.length;l<h;l++){var p=d[l].toUpperCase();u[p]=p=="T"||p=="TT"?c[l]:parseInt(c[l],10)}if(u["DD"]>0&&u["MM"]>0&&u["YYYY"]>0){var v=new Date;if(i){v.setUTCDate(1);v.setUTCFullYear(u["YYYY"]);v.setUTCMonth(u["MM"]-1);v.setUTCDate(u["DD"]);v.setUTCHours(0,0,0)}else{v.setDate(1);v.setFullYear(u["YYYY"]);v.setMonth(u["MM"]-1);v.setDate(u["DD"]);v.setHours(0,0,0)}if((!isNaN(u["HH"])||!isNaN(u["GG"])||!isNaN(u["H"])||!isNaN(u["G"]))&&!isNaN(u["MI"])){if(!isNaN(u["H"])||!isNaN(u["G"])){var C=(u["T"]||u["TT"]||"am").toUpperCase()=="PM";var D=parseInt(u["H"]||u["G"]||0,10);if(C){u["HH"]=D+(D==12?0:12)}else{u["HH"]=D<12?D:0}}else{u["HH"]=parseInt(u["HH"]||u["GG"]||0,10)}if(isNaN(u["SS"]))u["SS"]=0;if(i){v.setUTCHours(u["HH"],u["MI"],u["SS"])}else{v.setHours(u["HH"],u["MI"],u["SS"])}}return v}}return null},FormatTimeByNum:function(e,t){var i="";if(t==undefined)t="00";else{t=parseInt(t,10);if(isNaN(t))t="00";else{if(t>59)t=59;t=t<10?"0"+t.toString():t.toString()}}e=parseInt(e,10);if(e>24)e=24;if(isNaN(e))e=0;if(this.bAMPM){var s="am";if(e==0){e=12}else if(e==12){s="pm"}else if(e>12){s="pm";e-=12}i=e.toString()+":"+t.toString()+" "+s}else{i=(e<10?"0":"")+e.toString()+":"+t.toString()}return i},ParseTime:function(e){var t,i,s;e=BX.util.trim(e);e=e.toLowerCase();if(this.bAMPM){var n="pm";if(e.indexOf("am")!=-1)n="am";e=e.replace(/[^\d:]/gi,"");s=e.split(":");t=parseInt(s[0]||0,10);i=parseInt(s[1]||0,10);if(t==12){if(n=="am")t=0;else t=12}else if(t!=0){if(n=="pm"&&t<12){t+=12}}}else{s=e.split(":");t=s[0]||0;i=s[1]||0;if(t.toString().length>2)t=parseInt(t.toString().substr(0,2));i=parseInt(i)}if(isNaN(t)||t>24)t=0;if(isNaN(i)||i>60)i=0;return{h:t,m:i}},CheckType:function(e,t){return this.type==e&&this.ownerId==t},CheckSectionsCount:function(){var e;for(e=0;e<this.arSections.length;e++){if(this.arSections[e].PERM.edit_section&&this.IsCurrentViewSect(this.arSections[e]))return true}return false},GetWeekStart:function(){return this.weekStart},GetWeekDayOffset:function(e){if(!this.weekDayOffsetIndex){this.weekDayOffsetIndex={};for(var t=0;t<this.weekDays.length;t++)this.weekDayOffsetIndex[this.weekDays[t][2]]=t}return this.weekDayOffsetIndex[e]},SaveLastSection:function(e){this.lastSection=parseInt(e);BX.userOptions.save("calendar","last_section",this.type+"_"+this.ownerId,this.lastSection)},GetLastSection:function(){return this.lastSection}};window.bxInt=function(e){return parseInt(e,10)};window.bxIntEx=function(e){e=parseInt(e,10);if(isNaN(e))e=0;return e};window.bxSpCh=function(e){if(!e)return"";e=e.replace(/script_>/g,"script>");e=e.replace(/&/g,"&amp;");e=e.replace(/"/g,"&quot;");e=e.replace(/</g,"&lt;");e=e.replace(/>/g,"&gt;");return e};window.bxSpChBack=function(e){if(!e)return"";e=e.replace(/&lt;/g,"<");e=e.replace(/&gt;/g,">");e=e.replace(/&quot;/g,'"');e=e.replace(/&amp;/g,"&");e=e.replace(/script_>/g,"script>");return e};window.EnterAndNotTextArea=function(e,t){if(e.keyCode==13){var i=e.target||e.srcElement;if(i&&i.nodeName&&i.nodeName.toLowerCase()!="textarea"&&i.id.indexOf(t)==-1){BX.PreventDefault(e);return true}}return false};function bxGetDateFromTS(e,t){var i=new Date(e);if(!t){var s=i.getHours()||0,n=i.getMinutes()||0;i={date:i.getDate(),month:i.getMonth()+1,year:i.getFullYear(),bTime:!!(s||n),oDate:i};if(i.bTime){i.hour=s;i.min=n}}return i}window.bxFormatDate=function(e,t,i){var s=BX.message("FORMAT_DATE");s=s.replace(/YY(YY)?/gi,i);s=s.replace(/MMMM/gi,BX.message("MONTH_"+Number(t)));s=s.replace(/MM/gi,zeroInt(t));s=s.replace(/M/gi,BX.message("MON_"+Number(t)));s=s.replace(/DD/gi,zeroInt(e));return s};window.zeroInt=function(e){e=bxInt(e);if(isNaN(e))e=0;return e<10?"0"+e.toString():e.toString()};window.DenyDragEx=function(e){e.style.MozUserSelect="none";e.ondrag=BX.False;e.ondragstart=BX.False;e.onselectstart=BX.False};JCEC.prototype.GetCurrentSections=function(){var e,t=[],i=[],s=[];for(e in this.oActiveSections){if(this.oActiveSections.hasOwnProperty(e)){if(e!="tasks"){e=parseInt(e);if(e<0||isNaN(e))continue}if(this.oActiveSections[e]){if(this.arSectionsInd[e]&&this.arSections[this.arSectionsInd[e]]&&this.arSections[this.arSectionsInd[e]].SUPERPOSED)t.push(e);else i.push(e)}else{s.push(e)}}}return{superposed:t,active:i,hidden:s}};JCEC.prototype.LoadEvents=function(e,t,s){if(e==undefined)e=this.activeDate.month;if(t==undefined)t=this.activeDate.year;if(s==undefined)s={};var n,a,o=this,r=this.GetCurrentSections();var l=this.Request({getData:this.GetReqData("load_events",{month:parseInt(e,10)+1,year:t,usecl:"Y",active_sect:r.active,hidden_sect:r.hidden,sup_sect:r.superposed,cal_dav_data_sync:this.bSyncGoogle?"Y":"N"}),errorText:EC_MESS.LoadEventsErr,handler:function(h){if(o.loadEventsLastRequestId){if(o.loadEventsLastRequestId==l.reqId){o.loadEventsLastRequestId=false}else{o.CancelRequest(o.loadEventsLastRequestId)}}var c=o.GetCurrentSections();if(!o.CompareArrays(r.superposed,c.superposed)||!o.CompareArrays(r.active,c.active)||!o.CompareArrays(r.hidden,c.hidden)){return}if(o.bCalDAV&&o.bSyncGoogle&&h.connections&&h.connections.length>0){o.arConnections=h.connections;for(a in o.arSections){if(o.arSections.hasOwnProperty(a)){n=o.arSections[a];if(n.CAL_DAV_CAL&&n.CAL_DAV_CON&&n.DOM.pStatus){for(i in o.arConnections){if(o.arConnections.hasOwnProperty(i)&&o.arConnections[i].id==n.CAL_DAV_CON){n["~CAL_DAV_LAST_SYNC"]=o.arConnections[i].last_result;if(n["~CAL_DAV_LAST_SYNC"].indexOf("[200]")>=0){n.DOM.pStatus.className="bxec-spr bxec-cal-dav-google";n.DOM.pStatus.title=""}else{n.DOM.pStatus.className="bxec-spr bxec-cal-dav-google-fail";n.DOM.pStatus.title=EC_MESS.SyncError+": "+el["~CAL_DAV_LAST_SYNC"]}break}}}}}}o.bSyncGoogle=false;o.HandleLoadedEvents({events:h.events,attendees:h.attendees,month:e,year:t,Params:s})}});this.loadEventsLastRequestId=l.reqId};JCEC.prototype.HandleLoadedEvents=function(e){this.HandleEvents(e.events,e.attendees);this.arLoadedMonth[e.month+"."+e.year]=true;if(!e.Params)e.Params={};if(isNaN(bxInt(e.Params.month)))e.Params.month=e.month;if(isNaN(bxInt(e.Params.year)))e.Params.year=e.year;this.SetView(e.Params)};JCEC.prototype.HandleEvents=function(e,t){var i,s,n,a,o;if(e&&e.length){for(i=0;i<e.length;i++){s=this.Event.PreHandle(e[i]);a=this.Event.SmartId(s);if(!s.ID)continue;if(this.arLoadedEventsId[a])continue;this.arEvents.push(s);this.arLoadedEventsId[a]=true}}if(t){for(i in t){o=parseInt(i,10);n=t[i];if(!isNaN(o)&&n&&n.length)this.arAttendees[o]=n}}};JCEC.prototype.HandleAccessibility=function(e){var t,i;if(e){for(i in e){if(e.hasOwnProperty(i)&&e[i].length>0){for(t=0;t<e[i].length;t++){e[i][t]=this.Event.PreHandle(e[i][t])}}}}return e};JCEC.prototype.FilterAccessibility=function(e,t,i){return e};JCEC.prototype.BuildEventHolder=function(){if(this.EventHolderCont){BX.cleanNode(this.EventHolderCont,true);this.EventHolderCont=null}this.EventHolderCont=this.DaysGridCont.appendChild(BX.create("DIV",{props:{className:"bxec-event-holder"}}));var e=this;var t=this.oDaysGridTable.rows[0].cells[0];setTimeout(function(){e.arCellCoords={};for(var i=0;i<7;i++){e.arCellCoords[i]={left:bxInt(e.oDaysGridTable.rows[0].cells[i].offsetLeft),width:bxInt(e.oDaysGridTable.rows[0].cells[i].offsetWidth)}}e.dayCellHeight=parseInt(t.offsetHeight);e.dayCellWidth=parseInt(t.offsetWidth);e.DisplayEventsMonth()},10)};JCEC.prototype.EventClick=function(e){if(!e)e=window.event;var t,i,s,n,a=e.target||e.srcElement;while(a){if(a.getAttribute){t=parseInt(a.getAttribute("data-bx-event-ind"));i=a.getAttribute("data-bx-event-action");if(i)s=i;if(!isNaN(t)&&this.arEvents[t]){n=this.arEvents[t];if(!s||s=="view"){this.Event.View(n)}else if(s=="edit"){this.Event.Edit({oEvent:n})}else if(s=="del"){if(this.Event.IsAttendee(n)&&!this.Event.IsHost(n)){if(n.MEETING_STATUS!="N"){this.Event.SetMeetingStatus(false,{eventId:bxInt(n.ID),comment:""})}}else if(n["~TYPE"]!="tasks"){this.Event.Delete(n)}}if(this.MoreEventsWin)this.MoreEventsWin.close();break}}a=a.parentNode}};JCEC.prototype.DisplayEventsMonth=function(e){var t;if(e||this.bJustRedraw){BX.cleanNode(this.EventHolderCont);for(t=0;t<this.activeDateObjDays.length;t++)this.activeDateObjDays[t].arEvents={begining:[],all:[]}}else{this.activeFirst=this.activeDateDays[0].getTime();this.activeLast=this.activeDateDays[this.activeDateDays.length-1].getTime()}for(t=0;t<this.arEvents.length;t++){if(this.arEvents[t])this.HandleEventMonth(this.arEvents[t],t)}this.RefreshEventsOnWeeks([0,1,2,3,4,5])};JCEC.prototype.HandleEventMonth=function(e,t,i){var s,n,a,o;e=this.HandleEventCommon(e,t);if(!e)return;e.oParts=[];e.oWeeks=[];if(!i){s=bxGetDateFromTS(e.DT_FROM_TS);n=bxGetDateFromTS(e.DT_TO_TS);if(s.bTime&&!n.bTime)n=bxGetDateFromTS(e.DT_TO_TS-60*60*24);s={date:s.date,month:s.month-1,year:s.year};n={date:n.date,month:n.month-1,year:n.year};a=new Date(s.year,s.month,s.date).getTime();o=new Date(n.year,n.month,n.date).getTime()}else{s=i.d_from;n=i.d_to;a=i._d_from;o=i._d_to}if(a>o||o<this.activeFirst||a>this.activeLast)return;var r={real_from:s,real_to:n,from:a,to:o,real_from_t:a,real_to_t:o};if(a<this.activeFirst&&o<this.activeLast){r.from=this.activeFirst}else if(a>this.activeFirst&&o>this.activeLast){r.to=this.activeLast}else if(a<this.activeFirst&&o>this.activeLast){r.from=this.activeFirst;r.to=this.activeLast}e.display=true;var l=e.DT_TO_TS+(e.DT_SKIP_TIME=="Y"?this.dayLength:3e5)<(new Date).getTime();e.bMuted=this.userSettings.showMuted&&l;this.DisplayEvent_M(r,e);if(!l)this.Event.Blink(e,true,true)};JCEC.prototype.HandleEventCommon=function(e,t){if((!this.userSettings.showDeclined||e.CREATED_BY!==this.userId)&&e.MEETING_STATUS=="N"&&(!this.startupEvent||this.startupEvent&&this.startupEvent.ID!=e.ID))return false;if(!e.oParts)e.oParts=[];if(!e.oWeeks)e.oWeeks=[];e.ind=t;e=this.Event.SetColor(e);return e};JCEC.prototype.DisplayEvent_M=function(e,t){var i,s,n,a,o={partDaysCount:0},r=false,l=false;for(s=0,n=this.activeDateDays.length;s<n;s++){i=this.activeDateDays[s];a=this.GetWeekDayOffset(this.GetWeekDayByInd(i.getDay()));if(i.getTime()==e.from){r=true;o={left:this.arCellCoords[a].left+1,arInit:e,dayIndex:s,partDaysCount:0}}o.partDaysCount++;if(!r)continue;this.activeDateObjDays[s].arEvents.all.push({oEvent:t,partInd:t.oParts.length,daysCount:o.partDaysCount});if(a==6){l=i.getTime()==e.to;o.width=this.arCellCoords[a].left+this.arCellCoords[a].width-o.left-3;o.bEnd=l&&e.to==e.real_to_t;this.BuildEventDiv(o,t);if(l)break}if(!l&&a==0&&i.getTime()!=e.from)o={left:this.arCellCoords[0].left+1,arInit:e,dayIndex:s,partDaysCount:1};if(i.getTime()==e.to){l=true;o.width=this.arCellCoords[a].left+this.arCellCoords[a].width-o.left-3;o.bEnd=true;this.BuildEventDiv(o,t);break}}};JCEC.prototype.BuildEventDiv=function(e,t){if(parseInt(e.width)<=0)return;var i,s,n;this.activeDateObjDays[e.dayIndex].arEvents.begining.push({oEvent:t,partInd:t.oParts.length,daysCount:e.partDaysCount});var a=this.Event.IsTask(t),o=this.Event.IsCrm(t);var r="bxec-event";if(t.bMuted)r+=" bxec-event-muted";i=BX.create("DIV",{props:{className:r},style:{left:e.left+"px",width:bxInt(e.width)+"px",minWidth:bxInt(e.width)+"px",display:"none",backgroundColor:t.displayColor,color:t.displayTextColor}});s=i.appendChild(BX.create("TABLE"));n=s.insertRow(-1);var l=this;if(t.oParts.length>0||e.arInit.real_from_t<e.arInit.from)BX.adjust(n.insertCell(-1),{props:{className:"bxec-event-ar"},html:"<i></i>"});var h,c=this.Event.IsMeeting(t),d=this.Event.GetQuestIcon(t),u=n.insertCell(-1),f="";if(c)f='<i class="bxc-e-meeting"></i>';if(a)f='<i class="bxc-e-task"></i>';if(o&&!a)f='<i class="bxc-e-crm"></i>';u.innerHTML='<div class="bxec-event-title">'+f+'<span class="bxec-event-label"'+this.Event.GetLabelStyle(t)+">"+d+BX.util.htmlspecialchars(t.NAME)+"</span></div>";this.Event.BuildActions({cont:u,oEvent:t,evCont:i});if(!e.bEnd)BX.adjust(n.insertCell(-1),{props:{className:"bxec-event-ar"},html:"<b></b>"});i.onmouseover=function(){l.HighlightEvent_M(t,this)};i.onmouseout=function(){l.HighlightEvent_M(t,this,true)};i.ondblclick=function(){l.Event.View(t)};i.setAttribute("data-bx-event-ind",t.ind);this.dragDrop.RegisterEvent(i,t,"month");t.oWeeks.push({dayIndex:e.dayIndex,bEnd:e.bEnd});t.oParts.push(i);if((e.dayIndex+1)%7==0){h=bxInt(e.width)}else{h=(8-(e.dayIndex+1)%7)*(bxInt(e.width)-1)}if(h>this.DaysTitleCont.offsetWidth)h=this.DaysTitleCont.offsetWidth-10;u.firstChild.style.maxWidth=h+"px";this.EventHolderCont.appendChild(i)};JCEC.prototype.HighlightEvent_M=function(e,t,i){if(!e||!e.oParts||e.oParts.length==0)return;var s,n,a=i?BX.removeClass:BX.addClass;for(s=0,n=e.oParts.length;s<n;s++)a(e.oParts[s],"bxec-event-over");if(t)a(t,"bxec-event-over");if(e.pMoreDivs)for(s=0,n=e.pMoreDivs.length;s<n;s++)a(e.pMoreDivs[s],"bxec-event-over")};JCEC.prototype.GetEventWeeks=function(e){var t,i,s=[],n,a;for(n=0,a=e.oParts.length;n<a;n++){t=e.oWeeks[n].dayIndex;for(i=0;i<6;i++){if(t>=i*7&&t<(i+1)*7){s.push(i);break}}}return s};JCEC.prototype.BuildWeekEventHolder=function(){if(this._bBETimeOut)clearTimeout(this._bBETimeOut);var e=this;this._bBETimeOut=setTimeout(function(){var t=e.Tabs[e.activeTabId||e.userSettings.tabId];if(!t.pEventHolder)t.pEventHolder=t.pBodyCont.querySelector(".bxec-day-t-event-holder");if(e.bJustRedraw)e.ReBuildEvents(t.id);else e.DisplayWeekEvents(t)},0)};JCEC.prototype.DisplayWeekEvents=function(e){BX.cleanNode(e.pEventHolder);for(var t=0,i=this.arEvents.length;t<i;t++)if(this.arEvents[t])this.HandleWeekEvent({Tab:e,Event:this.arEvents[t],ind:t});this.RefreshEventsInDayT(e);this.ArrangeEventsInTL(e)};JCEC.prototype.ReBuildEvents=function(e){var t=this.Tabs[e],i=t.pTimelineCont,s,n,a,o;BX.cleanNode(t.pEventHolder);for(n=0;n<t.daysCount;n++){o=t.arDays[n];o.TLine={};o.Events={begining:[],hidden:[],all:[]};o.EventsCount=0}a=i.childNodes.length;n=0;while(n<a){s=i.childNodes[n];if(s.className.toString().indexOf("bxec-tl-event")==-1){n++;continue}i.removeChild(s);a=i.childNodes.length}this.DisplayWeekEvents(t)};JCEC.prototype.HandleWeekEvent=function(e){var t=this.HandleEventCommon(e.Event,e.ind);if(!t)return;if(!t.oDaysT)t.oDaysT={};if(!t.oTLParts)t.oTLParts={};t.oTLParts[e.Tab.id]=[];var i=t.DT_FROM_TS,s=t.DT_TO_TS,n=bxGetDateFromTS(i),a=bxGetDateFromTS(s);if(s<e.Tab.activeFirst||i>e.Tab.activeLast)return;if(t.DT_SKIP_TIME!="Y"&&s==e.Tab.activeFirst&&s!==i)return;if(n.bTime&&!a.bTime)s-=1e3;var o={real_from:n,real_to:a,from:i,to:s,real_from_t:i,real_to_t:s};if(i<e.Tab.activeFirst&&s<=e.Tab.activeLast){o.from=e.Tab.activeFirst}else if(i>=e.Tab.activeFirst&&s>e.Tab.activeLast){o.to=e.Tab.activeLast}else if(i<e.Tab.activeFirst&&s>e.Tab.activeLast){o.from=e.Tab.activeFirst;o.to=e.Tab.activeLast}t.display=true;var r=t.DT_TO_TS+(t.DT_SKIP_TIME=="Y"?this.dayLength:3e5)<(new Date).getTime();t.bMuted=this.userSettings.showMuted&&r;if(e.Event.DT_SKIP_TIME=="Y")this.DisplayEvent_DT(o,t,e.Tab);else this.DisplayEventOnTimeline(o,t,e.Tab);if(!r)this.Event.Blink(t,true,true)};JCEC.prototype.DisplayEvent_DT=function(e,t,i){var s=this,n=false,a=this.ConvertDayIndex(new Date(e.from).getDay()),o=this.ConvertDayIndex(new Date(e.to).getDay()),r={oEvent:t,daysCount:o-a+1},l,h,d=this.Event.IsTask(t),u=this.Event.IsCrm(t),f="",p,v;for(p=0;p<i.daysCount;p++){v=i.arDays[p];if(v.day==a){l=v;h=v;n=true;v.Events.begining.push(r)}if(!n)continue;v.Events.all.push(r);v.EventsCount++;if(v.day==o){h=v;break}}if(l&&h){var C=bxInt(l.pWnd.offsetLeft)+2,D=bxInt(h.pWnd.offsetLeft)+bxInt(h.pWnd.offsetWidth),E=D-C-5,S=BX.create("DIV",{props:{className:"bxec-event"},style:{left:C.toString()+"px",width:E.toString()+"px",backgroundColor:t.displayColor,color:t.displayTextColor}}),y=S.appendChild(BX.create("TABLE")),b=y.insertRow(-1);t.oDaysT[i.id]=S;S.setAttribute("data-bx-event-ind",t.ind);if(t.bMuted)BX.addClass(S,"bxec-event-muted");if(e.real_from_t<e.from){c=b.insertCell(-1);c.innerHTML='<img class="bxec-iconkit" src="/bitrix/images/1.gif">';c.className="bxec-event-ar-l"}if(this.Event.IsMeeting(t))f='<i class="bxc-e-meeting"></i>';if(d)f='<i class="bxc-e-task"></i>';if(u&&!d)f='<i class="bxc-e-crm"></i>';var m=this.Event.GetQuestIcon(t),T=b.insertCell(-1);T.innerHTML='<div class="bxec-event-title">'+f+'<span class="bxec-event-label"'+this.Event.GetLabelStyle(t)+">"+m+BX.util.htmlspecialchars(t.NAME)+"</span></div>";this.Event.BuildActions({cont:T,oEvent:t,evCont:S});S.onmouseover=function(){s.HighlightEvent_DT(this)};S.onmouseout=function(){s.HighlightEvent_DT(this,true)};S.ondblclick=function(){s.Event.View(t)};this.dragDrop.RegisterEvent(S,t,"week_title");if(i.pEventHolder)i.pEventHolder.appendChild(S)}};JCEC.prototype.DisplayEventOnTimeline=function(e,t,i){if(e.from==e.to){e.to+=60*1e3}var s=false,n=new Date(e.from),a=new Date(e.to),o=this.ConvertDayIndex(n.getDay()),r=this.ConvertDayIndex(a.getDay()),l=n.getHours()||0,h=n.getMinutes()||0,c=a.getHours(),d=a.getMinutes(),u,f,p,v;if(parseInt(t.DT_LENGTH)>0){if(!a){c=23;d=59}else if(e.from==e.to){if(d==59){c++;d=0}else{d++}}else{if(d==0&&c==0){if(r>o){r--;c=23;d=59}else{d=1}}else if(d==0&&c>0){c--;d=59}else if(d>1){d--}}}for(p=0;p<i.daysCount;p++){v=i.arDays[p];if(v.day==o){u=v;f=v;s=true}if(!s)continue;if(v.day==r){f=v;break}}if(u&&f){this._SetTimeEvent(u,l,h,{oEvent:t,bStart:true,arInit:e});this._SetTimeEvent(f,c,d,{oEvent:t,bStart:false,arInit:e})}};JCEC.prototype._SetTimeEvent=function(e,t,i,s){if(!e.TLine)e.TLine={};t=bxInt(t);i=bxInt(i);if(!e.TLine[t])e.TLine[t]={};if(!e.TLine[t][i])e.TLine[t][i]=[];e.TLine[t][i].push(s)};JCEC.prototype.HighlightEvent_DT=function(e,t){var i=t?BX.removeClass:BX.addClass;i(e,"bxec-event-over")};JCEC.prototype.RefreshEventsInDayT=function(e){var t=[],i=0,s=3,a,o,r,l,h,c,d,u,f;for(l=0;l<s;l++)t[l]=0;for(o=0;o<e.daysCount;o++){a=e.arDays[o];r=a.Events.begining;n=r.length;u=[];if(n>0){r.sort(function(e,t){return t.daysCount-e.daysCount});e:for(k=0;k<n;k++){h=r[k];if(!h)continue;if(!this.arEvents[h.oEvent.ind]){a.Events.begining=r=BX.util.deleteFromArray(r,k);h=r[k];if(!h)continue}for(l=0;l<s;l++){if(t[l]-i<=0){t[l]=i+h.daysCount;f=21+l*18;h.oEvent.oDaysT[e.id].style.top=(21+l*18).toString()+"px";continue e}}u[h.oEvent.ID]=true;a.Events.hidden.push(h)}}c=a.Events.all;for(var p=0,v=c.length;p<v;p++){h=c[p];if(!h||u[h.oEvent.ID])continue;if(!this.arEvents[h.oEvent.ind]){a.Events.all=c=BX.util.deleteFromArray(c,p);h=c[p];if(!h)continue}d=h.oEvent.oDaysT[e.id].style.display;if(d&&d.toLowerCase()=="none")a.Events.hidden.push(h)}this.ShowMoreEventsSelectWeek(a,e.id);i++}};JCEC.prototype.ShowMoreEventsSelectWeek=function(e,t){var i=this,s=e.Events.hidden,n=s.length,a=[],o=e.pMoreEvents.firstChild,r,l,h;if(n<=0){o.style.display="none";return}for(r=0;r<n;r++){l=s[r];h=l.oEvent.oDaysT[t];h.style.display="none";a.push({pDiv:h,oEvent:l.oEvent})}o.style.display="block";o.innerHTML=EC_MESS.MoreEvents+" ("+n+" "+EC_MESS.Item+")";o.onmousedown=function(e){if(!e)e=window.event;BX.PreventDefault(e)};o.onclick=function(){i.ShowMoreEventsWin({Events:a,id:"day_t_"+t+e.day,pDay:e.pWnd,mode:"day_t",pSelect:o})}};JCEC.prototype.ArrangeEventsInTL=function(e){try{var t=false,i,s,n,a,o,r=0,l,h,c,d,u,f,p={},v=0,C,D,E,S;for(D=0;D<e.daysCount;D++){C=e.arDays[D];h=[];if(v>0){if(!C.TLine)C.TLine={};for(o in p){if(p[o]&&typeof p[o]=="object"&&p[o].oEvent){if(!C.TLine["0"])C.TLine["0"]={};if(!C.TLine["0"]["0"])C.TLine["0"]["0"]=[];C.TLine["0"]["0"].push({oEvent:p[o].oEvent,bStart:true,dontClose:false,arInit:p[o].arInit})}}}if(!t&&!C.TLine)continue;f=true;if(C.TLine){for(i=0;i<=23;i++){if(!C.TLine[i]&&i!=23)continue;for(s=0;s<60;s++){E=C.TLine[i]&&C.TLine[i][s]?C.TLine[i][s]:false;if(i==23&&s==59){if(E===false)E=[];for(o in p){if(p[o]&&typeof p[o]=="object"&&p[o].oEvent){E.push({oEvent:p[o].oEvent,bStart:false,dontClose:true,arInit:p[o].arInit})}}}if(!E)continue;for(n=0;n<E.length;n++){S=E[n];if(S.bStart){p[S.oEvent.ID]=S;v++;if(f)h.push([]);c=h[h.length-1];u=false;f=false;if(c.length>1){for(M=0,I=c.length;M<I;M++){d=c[M];if(!d.bFilled){u=M;break}}}l={bFilled:true,evId:S.oEvent.ID,h_f:i,m_f:s};if(u!==false){l.arEvents=c[u].arEvents;c[u]=l}else{c.push(l)}}else{f=true;if(!S.dontClose){p[S.oEvent.ID]=false;v--}for(M=0;M<c.length;M++){d=c[M];if(d.bFilled&&d.evId==S.oEvent.ID){d.bFilled=false;a=this.BuildEventDiv_TL({Tab:e,dayInd:D,from:{h:d.h_f,m:d.m_f},to:{h:i,m:s},oEvent:S.oEvent,arInit:S.arInit,lastPart:!S.dontClose});if(!d.arEvents)d.arEvents=[a];else d.arEvents.push(a)}if(d.bFilled&&f)f=false}}}}}}var y=e.pTimelineTable.rows[0].cells[D+1],b,m,T,g,_,M,I,x,B,O=y.offsetWidth-15;for(m=0,T=h.length;m<T;m++){b=h[m];g=b.length;_=Math.round((O-g)/g);for(M=0;M<b.length;M++){d=b[M];if(M==0){x=_;r=bxInt(d.arEvents[0].style.left);I=false}else{r+=_+1;I=r;if(M==b.length-1)x=O-(_+1)*(b.length-1)-1;else x=_}for(n=0;n<d.arEvents.length;n++){B=d.arEvents[n];B.style.width=x+"px";B.style.minWidth=x+"px";if(I!==false)B.style.left=I+"px"}}}}}catch(n){}};JCEC.prototype.BuildEventDiv_TL=function(e){var t=this,i=e.oEvent,s=this.Event.IsTask(i),n=this.Event.IsCrm(i),a=e.from.m,o=e.to.m,r="",l=Math.floor((e.from.h+a/60)*2),h=Math.floor((e.to.h+o/60)*2),c=e.Tab.pTimelineTable.rows[l].cells[this.__ConvertCellIndex(l,e.dayInd+1,true)],d=e.Tab.pTimelineTable.rows[h].cells[this.__ConvertCellIndex(h,e.dayInd+1,true)],u=bxInt(c.offsetTop)+1,f=bxInt(d.offsetTop)-1,p=bxInt(c.offsetLeft)+2,v=BX.create("DIV",{props:{className:"bxec-tl-event"+(i.bMuted?" bxec-event-muted":"")},style:{left:p+"px",backgroundColor:i.displayColor,color:i.displayTextColor},events:{mouseover:function(s){t.HighlightEvent_TL(i,this,false,e.Tab.id,s||window.event)},mouseout:function(s){t.HighlightEvent_TL(i,this,true,e.Tab.id,s||window.event)},dblclick:function(){t.Event.View(i)}}});v.setAttribute("data-bx-event-ind",i.ind);v.setAttribute("data-bx-original-width","");v.setAttribute("data-bx-original-height","");i._eventViewed=false;i._contentSpan=false;if(this.Event.IsMeeting(i))r='<i class="bxc-e-meeting"></i>';

if(s)r='<i class="bxc-e-task"></i>';if(n&&!s)r='<i class="bxc-e-crm"></i>';var C=e.arInit.real_from,D=e.arInit.real_to,E=this.Event.GetQuestIcon(i),S=r+E+"<u "+this.Event.GetLabelStyle(i)+">"+BX.util.htmlspecialchars(i.NAME)+"</u><br />",y=this.FormatTimeByNum(C.hour,C.min),b=this.FormatTimeByNum(D.hour,D.min);if(a!=30&&a!=0)u+=Math.round((a>30?a-30:a)*40/60)-1;if(o!=30&&o!=0)f+=Math.round((o>30?o-30:o)*40/60)+2;var m=f-u;if(m<=17)m=17;v.style.top=u+"px";v.style.height=m+"px";if(C.year==D.year&&C.month==D.month&&C.date==D.date)S+=y+" &mdash; "+b;else S+=bxFormatDate(C.date,C.month,C.year)+" "+y+" &mdash; "+bxFormatDate(D.date,D.month,D.year)+" "+b;v.appendChild(BX.create("DIV",{children:[BX.create("SPAN",{props:{className:"bxec-cnt-sp"},html:S})]}));this.Event.BuildActions({cont:v,oEvent:i,evCont:v,bTimeline:true});if(e.lastPart){var T=v.appendChild(BX.create("DIV",{props:{className:"bxec-tl-event-resizer-cnt"}}));this.dragDrop.RegisterTimelineEventResizer(T,v,i,e.Tab.id)}e.Tab.pTimelineCont.appendChild(v);if(!i.oTLParts[e.Tab.id])i.oTLParts[e.Tab.id]=[];i.oTLParts[e.Tab.id].push(v);this.dragDrop.RegisterTimelineEvent(v,i,e.Tab.id);return v};JCEC.prototype.HighlightEvent_TL=function(e,t,i,s,n){var a=this;var o=t.getAttribute("data-bx-original-width");var r=t.getAttribute("data-bx-original-height");if(!i&&!e._eventViewed){if(this._highlightIntKeypWnd==t&&this._highlightInt)return;if(this._highlightInt)clearInterval(this._highlightInt);if(!o){o=parseInt(t.style.width);t.setAttribute("data-bx-original-width",o)}if(!r){r=parseInt(t.style.height);t.setAttribute("data-bx-original-height",r)}e._contentSpan=BX.findChild(t,{className:"bxec-cnt-sp"},true);var l=0,h=o,c=parseInt(e._contentSpan.offsetWidth)+20,d=r,u=parseInt(e._contentSpan.offsetHeight)+30;if(c<=60)c=60;if(u<=55)u=55;if(c-h>0||u-d>0){this._highlightIntKeypWnd=t;this._highlightInt=setInterval(function(){var i=c-h<=0,s=u-d<=0;if(i&&s){e._eventViewed=true;return clearInterval(a._highlightInt)}l+=12;if(!i){h+=l;if(h>c)h=c+2;t.style.width=h+"px"}if(!s){d+=l;if(d>u)d=u+2;t.style.height=d+"px"}},5)}}else{if(this.CheckMouseInCont(t,n,-2))return true;this._highlightIntKeypWnd=false;if(this._highlightInt)clearInterval(this._highlightInt);this._highlightInt=false;if(o){t.style.width=o+"px";e._eventViewed=false}if(r){t.style.height=r+"px";e._eventViewed=false}}if(i){BX.removeClass(t,"bxec-tl-ev-hlt");BX.removeClass(t,"bxec-tl-ev-hlt-s")}else{BX.addClass(t,"bxec-tl-ev-hlt")}if(e.oTLParts&&e.oTLParts[s]){var f=e.oTLParts[s],p=f.length,v,C,D;for(v=0;v<p;v++){if(f[v]==t)continue;if(i){BX.removeClass(f[v],"bxec-tl-ev-hlt");BX.removeClass(f[v],"bxec-tl-ev-hlt-s");C=f[v].getAttribute("data-bx-original-width");D=f[v].getAttribute("data-bx-original-height");if(C)f[v].style.width=C+"px";if(D)f[v].style.height=D+"px"}else{BX.addClass(f[v],"bxec-tl-ev-hlt-s")}}}};JCEC.prototype.ShowMoreEventsWin=function(e){var t=this;if(this.MoreEventsWin){this.MoreEventsWin.close();this.MoreEventsWin.destroy();this.MoreEventsWin=null;return}this.MoreEventsWin=BX.PopupWindowManager.create(this.id+"bxc-month-sel"+e.id,e.pSelect,{autoHide:true,closeByEsc:true,offsetTop:-1,offsetLeft:1,lightShadow:true,content:BX.create("DIV",{props:{id:"bxc-more-"+this.id+e.id,className:"bxec-more-event-popup"}})});BX.addCustomEvent(this.MoreEventsWin,"onPopupClose",function(){if(t.MoreEventsWin&&t.MoreEventsWin.destroy)t.MoreEventsWin.destroy()});var i=BX("bxc-more-"+this.id+e.id),s,n,a;BX.bind(i,"click",BX.proxy(this.EventClick,this));i.innerHTML="";for(a=0;a<e.Events.length;a++){n=e.Events[a].pDiv;s=n.cloneNode(true);BX.addClass(s,"bxec-event-static");s.onmouseover=n.onmouseover;s.onmouseout=n.onmouseout;s.ondblclick=n.ondblclick;i.appendChild(s);this.dragDrop.RegisterEvent(s,e.Events[a].oEvent,"month")}this.MoreEventsWin.show(true)};JCEC.prototype.GetUsableDateTime=function(e,t){var i=(t||10)*60*1e3;e=Math.ceil(e/i)*i;return new Date(e)};JCEC.prototype.CompareArrays=function(e,t){var s=true;if(e.length!==t.length){s=false}else{for(i=0;i<e.length;i++){if(e[i]!==t[i]){s=false;break}}}return s};
//# sourceMappingURL=cal-core.map.js

Anon7 - 2022
AnonSec Team