Your IP : 18.117.73.46


Current Path : /home/bitrix/ext_www/klimatlend.ua/bitrix/js/calendar/
Upload File :
Current File : /home/bitrix/ext_www/klimatlend.ua/bitrix/js/calendar/cal-dialogs.min.js

JCEC.prototype.ShowAddEventDialog=function(e){var t=this;if(this.bReadOnly)return;if(!this.CheckSectionsCount())return alert(EC_MESS.NoCalendarsAlert);var i=this.oAddEventDialog;var o=BX(this.id+"-bitrix24-limit");if(!i){i=new BX.PopupWindow("BXCAddEvent"+this.id,null,{overlay:{opacity:10},autoHide:true,closeByEsc:true,zIndex:0,offsetLeft:0,offsetTop:0,draggable:true,bindOnResize:false,titleBar:EC_MESS.NewEvent,closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-window",buttons:o?[new BX.PopupWindowButton({text:EC_MESS.Close,events:{click:function(){t.CloseAddEventDialog(true)}}})]:[new BX.PopupWindowButton({text:EC_MESS.Edit,title:EC_MESS.GoExtTitle,events:{click:function(){t.OpenExFromSimple()}}}),new BX.PopupWindowButton({text:EC_MESS.Add,className:"popup-window-button-accept",events:{click:function(){var e=BX.date.convertBitrixFormat(i.CAL.selectTime?BX.message("FORMAT_DATETIME"):BX.message("FORMAT_DATE")),o=i.CAL.Params.from,n=i.CAL.Params.to,a={name:i.CAL.DOM.Name.value,desc:"",calendar:i.CAL.DOM.SectSelect.value,date_from:BX.date.format(e,o.getTime()/1e3),date_to:BX.date.format(e,n.getTime()/1e3),default_tz:i.CAL.DOM.DefTimezone.value,skip_time:i.CAL.selectTime?"N":"Y"};if(i.CAL.DOM.Accessibility)a.accessibility=i.CAL.DOM.Accessibility.value;t.Event.Save(a);if(!t.arConfig.userTimezoneName){t.arConfig.userTimezoneName=i.CAL.DOM.DefTimezone.value}t.CloseAddEventDialog(true)}}}),new BX.PopupWindowButtonLink({text:EC_MESS.Close,className:"popup-window-button-link-cancel",events:{click:function(){t.CloseAddEventDialog(true)}}})],content:BX("bxec_add_ed_"+this.id),events:{}});i.CAL={DOM:{Name:BX(this.id+"_add_ed_name"),PeriodText:BX(this.id+"_add_ed_per_text"),SectSelect:BX(this.id+"_add_ed_calend_sel"),Warn:BX(this.id+"_add_sect_sel_warn"),DefTimezone:BX("event-simple-tz-def"+this.id),DefTimezoneWrap:BX("event-simple-tz-def-wrap"+this.id)}};this.oAddEventDialog=i;if(!o){new BX.CHint({parent:BX("event-tz-simple-def-tip"+this.id),hint:EC_MESS.eventTzDefHint});if(this.bIntranet&&(this.Personal()||this.type!="user")){i.CAL.DOM.Accessibility=BX(this.id+"_add_ed_acc");if(i.CAL.DOM.Accessibility&&BX.browser.IsIE())i.CAL.DOM.Accessibility.style.width="250px"}i.CAL.DOM.SectSelect.onchange=function(){t.SaveLastSection(this.value);i.CAL.DOM.Warn.style.display=t.oActiveSections[i.CAL.DOM.SectSelect.value]?"none":"block"}}BX.addCustomEvent(i,"onPopupClose",BX.proxy(this.CloseAddEventDialog,this))}if(o){i.show();return}var n,a,s,l,r,c,d="",C="";i.CAL.DOM.Name.value="";this.BuildSectionSelect(i.CAL.DOM.SectSelect,this.GetLastSection());i.CAL.DOM.Warn.style.display=t.oActiveSections[i.CAL.DOM.SectSelect.value]?"none":"block";i.CAL.DOM.DefTimezoneWrap.style.display="none";i.CAL.selectTime=this.selectTimeMode&&(!this.selectDaysMode&&!this.selectDayTMode);if(this.selectDaysMode){var p=parseInt(this.selectDaysStartObj.id.substr(9)),u=parseInt(this.selectDaysEndObj.id.substr(9));if(p>u){l=u;u=p;p=l}n=this.activeDateDays[p];a=this.activeDateDays[u]}else if(this.selectTimeMode){s=this.curTimeSelection;n=new Date(s.sDay.year,s.sDay.month,s.sDay.date,s.sHour,s.sMin);a=new Date(s.eDay.year,s.eDay.month,s.eDay.date,s.eHour,s.eMin);if(n.getTime()>a.getTime()){l=n;n=a;a=l}if(this.arConfig.userTimezoneName){i.CAL.DOM.DefTimezoneWrap.style.display="none";i.CAL.DOM.DefTimezone.value=this.arConfig.userTimezoneName}else{i.CAL.DOM.DefTimezoneWrap.style.display="";i.CAL.DOM.DefTimezone.value=this.arConfig.userTimezoneDefault||""}}else if(this.selectDayTMode){r=this.curDayTSelection;n=new Date(r.sDay.year,r.sDay.month,r.sDay.date);a=new Date(r.eDay.year,r.eDay.month,r.eDay.date)}else return;var D=this.ConvertDayIndex(n.getDay()),E=this.ConvertDayIndex(a.getDay());if(n.getTime()==a.getTime()){c=this.days[D][0]+" "+bxFormatDate(n.getDate(),n.getMonth()+1,n.getFullYear())}else{var h=n.getDate(),f=n.getMonth()+1,v=n.getFullYear(),S=n.getHours(),A=n.getMinutes(),_=a.getDate(),L=a.getMonth()+1,g=a.getFullYear(),m=a.getHours(),M=a.getMinutes(),b=!(S==m&&S==0&&A==M&&A==0);if(b){d=this.FormatTimeByNum(S,A);C=this.FormatTimeByNum(m,M)}if(f==L&&v==g&&h==_&&b)c=this.days[D][0]+" "+bxFormatDate(h,f,v)+", "+d+" &mdash; "+C;else c=this.days[D][0]+" "+bxFormatDate(h,f,v)+" "+d+" &mdash; "+this.days[E][0]+" "+bxFormatDate(_,L,g)+" "+C}i.CAL.DOM.PeriodText.innerHTML=c;i.CAL.Params={from:n,to:a,time_f:d||"",time_t:C||""};setTimeout(function(){BX.focus(i.CAL.DOM.Name)},500);if(this.bIntranet&&(this.Personal()||this.type!="user"))i.CAL.DOM.Accessibility.value="busy";var B=this.GetAddDialogPosition();if(B){i.popupContainer.style.top=B.top+"px";i.popupContainer.style.left=B.left+"px"}i.show()};JCEC.prototype.OpenExFromSimple=function(e){this.CloseAddEventDialog(true);if(!e)return this.ShowEditEventPopup({bExFromSimple:true});var t=this.oAddEventDialog,i=this.oEditEventDialog.oController,o=t.CAL.Params.from,n=t.CAL.Params.to;i._FromDateValue=i.pFromDate.value=bxFormatDate(o.getDate(),o.getMonth()+1,o.getFullYear());i.pToDate.value=bxFormatDate(n.getDate(),n.getMonth()+1,n.getFullYear());var a=!!(t.CAL.Params.time_f||t.CAL.Params.time_t);i.pFullDay.checked=!a;if(a){i._FromTimeValue=i.pFromTime.value=t.CAL.Params.time_f;i.pToTime.value=t.CAL.Params.time_t||""}else{if(i.pFromDate.value==i.pToDate.value){var s=this.ParseDate(BX.util.trim(i.pFromDate.value)+" "+BX.util.trim(i.pFromTime.value),true);if(s){var l=new Date(s.getTime()+36e5);i.pToDate.value=this.FormatDate(l);i.pToTime.value=this.FormatTime(l)}}else{i.pToTime.value=i.pFromTime.value}}i.FullDay(false,a);if(!this.arConfig.userTimezoneName&&t.CAL.DOM.DefTimezone.value){i.pDefTimezone.value=t.CAL.DOM.DefTimezone.value}i.pName.value=t.CAL.DOM.Name.value;if(this.bIntranet&&i.pAccessibility&&t.CAL.DOM.Accessibility)i.pAccessibility.value=t.CAL.DOM.Accessibility.value;if(t.CAL.DOM.SectSelect.value){i.pSectSelect.value=t.CAL.DOM.SectSelect.value;if(i.pSectSelect.onchange)i.pSectSelect.onchange()}};JCEC.prototype.CloseAddEventDialog=function(e){if(!this.oAddEventDialog)return;switch(this.activeTabId){case"month":this.DeSelectDays();break;case"week":this.DeSelectTime(this.activeTabId);this.DeSelectDaysT();break;case"day":break}if(e===true)this.oAddEventDialog.close()};JCEC.prototype.GetAddDialogPosition=function(){if(this.activeTabId=="month"){var e=this.arSelectedDays[this.bInvertedDaysSelection?0:this.arSelectedDays.length-1];if(!e)return false;var t=BX.pos(e);t.top+=parseInt(this.dayCellHeight/2)+20;t.left+=parseInt(this.dayCellWidth/2)+20;t.right=t.left;t.bottom=t.top;t=BX.align(t,360,180);return t}else{return false}};JCEC.prototype.CreateEditEventPopup=function(e){var t=this,i=BX.create("DIV");var o=new BX.PopupWindow("BXCEditEvent"+this.id,null,{overlay:{opacity:10},autoHide:false,closeByEsc:true,zIndex:-100,offsetLeft:0,offsetTop:0,draggable:true,titleBar:EC_MESS.NewEvent,contentColor:"white",contentNoPaddings:true,closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-tabed bxc-popup-window",buttons:[new BX.PopupWindowButton({text:EC_MESS.Delete,id:this.id+"ed-del-button",events:{click:function(){if(t.Event.Delete(o.CAL.oEvent))t.CloseEditEventDialog(true)}}}),new BX.PopupWindowButton({text:EC_MESS.Save,id:this.id+"ed-save-button",className:"popup-window-button-accept",events:{click:function(){t.oEditEventDialog.oController.SaveForm({callback:function(){t.CloseEditEventDialog(true)}})}}}),new BX.PopupWindowButtonLink({text:EC_MESS.Close,className:"popup-window-button-link-cancel",events:{click:function(){t.CloseEditEventDialog(true)}}})],content:i,events:{}});BX.addCustomEvent(o,"onPopupClose",BX.proxy(this.CloseEditEventDialog,this));o.CAL={DOM:{content:i,Title:o.titleBar.firstChild,DelBut:BX(this.id+"ed-del-button"),SaveBut:BX(this.id+"ed-save-button")}};BX.addClass(o.CAL.DOM.Title,"bxce-dialog-title");this.oEditEventDialog=o};JCEC.prototype.ShowEditEventPopup=function(e){if(!this.oEditEventDialog)this.CreateEditEventPopup();if(this.showDialogRequest||this.oEditEventDialog.bShowed)return;if(window.LHEPostForm&&window.LHEPostForm.unsetHandler&&LHEPostForm.getHandler(this.id+"_event_editor")){window.LHEPostForm.unsetHandler(this.id+"_event_editor")}if(!e)e={};var t=this,i,o=this.oEditEventDialog;o.bExFromSimple=!!e.bExFromSimple;o.CAL.oEvent=e.oEvent||{};i=o.CAL.oEvent&&o.CAL.oEvent.ID?o.CAL.oEvent.ID:0;if(i){o.CAL.DOM.DelBut.style.display="";o.CAL.DOM.Title.innerHTML=EC_MESS.EditEvent}else{o.CAL.DOM.DelBut.style.display="none";o.CAL.DOM.Title.innerHTML=EC_MESS.NewEvent}this.showDialogRequest=true;BX.ajax.get(this.actionUrl,this.GetReqData("get_edit_event_dialog",{event_id:i,js_id:this.id}),function(e){if(t.showDialogRequest){BX.removeClass(o.popupContainer.firstChild,"bxc-popup-window-loader");t.showDialogRequest=false;o.CAL.DOM.content.innerHTML=BX.util.trim(e)}});BX.addClass(o.popupContainer.firstChild,"bxc-popup-window-loader");o.CAL.DOM.content.innerHTML='<div class="bxec-popup" style="width: 750px; height: 300px;"><div class="bxce-popup-loader"><div class="bxce-loader-curtain"></div></div></div>';t.oEditEventDialog.show();var n=0;function a(){o.CAL.DOM.pTabs=BX(t.id+"_edit_tabs");n++;if(!o.CAL.DOM.pTabs){if(n<10)return setTimeout(a,100);else return}if(!o.CAL.DOM.pTabs){if(!BX(t.id+"-bitrix24-limit")){t.oEditEventDialog.close();t.Event.ReloadAll()}else{o.CAL.DOM.DelBut.style.display="none";o.CAL.DOM.SaveBut.style.display="none"}n=0;return}t.ChargePopupTabs(o,t.id+"ed-tab-");if(window.__ATTENDEES_ACC)o.CAL.oEvent["~ATTENDEES"]=window.__ATTENDEES_ACC;o.oController=new EditEventPopupController({form:document.forms.event_edit_form,oEC:t,oEvent:o.CAL.oEvent,id:t.id,editorContId:"bx_cal_editor_cont_"+t.id,LHEJsObjName:"pLHEEvDesc",LHEId:"LHEEvDesc",WDControllerCID:window.__UPLOAD_WEBDAV_ELEMENT_CID,arFiles:window.__UPLOAD_WEBDAV_ELEMENT_VALUE,Title:o.CAL.DOM.Title,userTimezoneName:t.arConfig.userTimezoneName,userTimezoneDefault:t.arConfig.userTimezoneDefault});if(window.editEventDestinationFormName){BxEditEventGridSetLinkName(window.editEventDestinationFormName);BX.bind(BX("event-grid-dest-input"),"keyup",BxEditEventGridSearch);BX.bind(BX("event-grid-dest-input"),"keydown",BxEditEventGridSearchBefore);BX.bind(BX("event-grid-dest-add-link"),"click",function(e){BX.SocNetLogDestination.openDialog(editEventDestinationFormName);BX.PreventDefault(e)});BX.bind(BX("event-grid-dest-cont"),"click",function(e){BX.SocNetLogDestination.openDialog(editEventDestinationFormName);BX.PreventDefault(e)})}BX.removeCustomEvent("onAjaxSuccessFinish",a);if(o.bExFromSimple)t.OpenExFromSimple(true)}BX.addCustomEvent("onAjaxSuccessFinish",a)};JCEC.prototype.CloseEditEventDialog=function(e){if(this.oEditEventDialog){if(e===true){if(this.oEditEventDialog.oController&&this.oEditEventDialog.oController.Location&&this.oEditEventDialog.oController.Location.oPopup)this.oEditEventDialog.oController.Location.oPopup.destroy();this.oEditEventDialog.close()}if(this.oEditEventDialog.oController)this.oEditEventDialog.oController.DestroyDestinationControls();this.showDialogRequest=false;this.OnResize()}};JCEC.prototype.CreateViewEventPopup=function(){var e=this,t=BX.create("DIV"),i=new BX.PopupWindow("BXCViewEvent"+this.id,null,{overlay:{opacity:10},autoHide:false,closeByEsc:true,zIndex:-100,offsetLeft:0,offsetTop:0,draggable:true,titleBar:EC_MESS.ViewingEvent,contentColor:"white",contentNoPaddings:true,closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-tabed bxc-popup-window",buttons:[new BX.PopupWindowButton({text:EC_MESS.Delete,id:this.id+"_viewev_del_but",events:{click:function(){if(e.Event.Delete(i.CAL.oEvent))e.CloseViewDialog(true)}}}),new BX.PopupWindowButton({text:EC_MESS.Edit,id:this.id+"_viewev_edit_but",events:{click:function(){e.ShowEditEventPopup({oEvent:i.CAL.oEvent});e.CloseViewDialog(true)}}}),new BX.PopupWindowButton({text:EC_MESS.Close,className:"popup-window-button-accept",events:{click:function(){e.CloseViewDialog(true)}}})],content:t,events:{}});BX.addCustomEvent(i,"onPopupClose",BX.proxy(this.CloseViewDialog,this));i.CAL={DOM:{content:t,TITLE:i.titleBar.firstChild,delBut:BX(this.id+"_viewev_del_but"),editBut:BX(this.id+"_viewev_edit_but")}};BX.addClass(i.CAL.DOM.TITLE,"bxce-dialog-title");BX.bind(i.CAL.DOM.content,"click",function(t){var o=t.target||t.srcElement;if(o&&o.parentNode){var n=o.getAttribute("data-bx-more-users");if(!!n){var a=BX(n);if(a)BX.addClass(a,"bx-cal-view-att-cont-full");return}var s=o.getAttribute("data-bx-set-status")||o.parentNode.getAttribute("data-bx-set-status");if(!!s){if(e.Event.SetMeetingStatus(s=="Y")){i.close()}return BX.PreventDefault(t||window.event)}}});this.oViewEventDialog=i};JCEC.prototype.ShowViewEventPopup=function(e){if(!this.oViewEventDialog)this.CreateViewEventPopup();var t=this,i=this.oViewEventDialog,o=e.ID;BX.addCustomEvent("OnUCFeedChanged",BX.proxy(function(){this.AdjustOverlay(this.oViewEventDialog)},this));if(i.adjustInterval)clearInterval(i.adjustInterval);i.adjustInterval=setInterval(function(){t.AdjustOverlay(i,false)},1e3);i.CAL.DOM.delBut.style.display="none";i.CAL.DOM.editBut.style.display="none";BX.addClass(i.popupContainer.firstChild,"bxc-popup-window-loader");i.CAL.DOM.content.innerHTML='<div class="bxec-popup" style="width: 700px; height: 200px;"><div class="bxce-popup-loader"><div class="bxce-loader-curtain"></div></div></div>';t.oViewEventDialog.show();var n=0,a=0;i.CAL.oEvent=e;BX.ajax.get(this.actionUrl,this.GetReqData("get_view_event_dialog",{event_id:o,js_id:this.id,section_name:this.oSections[e.SECT_ID]?this.oSections[e.SECT_ID].NAME:"",date_from:e.DATE_FROM,date_from_offset:e.TZ_OFFSET_FROM}),s);function s(a){i.CAL.DOM.content.innerHTML=a;i.CAL.DOM.pTabs=BX(t.id+"_viewev_tabs");n++;if(!i.CAL.DOM.pTabs&&n<10)return setTimeout(function(){s(a)},100);if(!i.CAL.DOM.pTabs){if(!BX(t.id+"-bitrix24-limit")){t.oViewEventDialog.close();t.Event.ReloadAll()}n=0;return}t.ChargePopupTabs(i,t.id+"view-tab-");BX.removeClass(i.popupContainer.firstChild,"bxc-popup-window-loader");i.CAL.DOM.TITLE.innerHTML=EC_MESS.ViewingEvent+": "+BX.util.htmlspecialchars(e.NAME);if(e.PRIVATE_EVENT&&!t.Personal()){i.CAL.DOM.delBut.style.display="none";i.CAL.DOM.editBut.style.display="none"}else if(t.bIntranet&&t.Event.IsHost(e)&&t.Event.CanDo(e,"edit")){i.CAL.DOM.delBut.style.display="";i.CAL.DOM.editBut.style.display=""}else if(t.bIntranet&&t.Event.IsAttendee(e)){i.CAL.DOM.delBut.style.display="none";i.CAL.DOM.editBut.style.display="none"}else{if(t.Event.CanDo(e,"edit")){i.CAL.DOM.delBut.style.display="";i.CAL.DOM.editBut.style.display=""}else{i.CAL.DOM.delBut.style.display="none";i.CAL.DOM.editBut.style.display="none"}}i.CAL.DOM.pViewTzHint=BX("bxec-view-tz-hint"+t.id);if(i.CAL.DOM.pViewTzHint){new BX.CHint({parent:i.CAL.DOM.pViewTzHint,hint:i.CAL.DOM.pViewTzHint.getAttribute("data-bx-hint")})}BX.viewElementBind("bx-cal-view-files-"+t.id+o,{showTitle:true},function(e){return BX.type.isElementNode(e)&&(e.getAttribute("data-bx-viewer")||e.getAttribute("data-bx-image"))});i.CAL.DOM.commentWrap=BX(t.id+"comments-cont");l(i.CAL.DOM.commentWrap.querySelector(".feed-com-avatar img"))}function l(e){a++;if(e){var o=parseInt(BX.style(e,"width"));if(o>90&&a<20){return setTimeout(function(){l(e)},100)}}t.comAni=new BX.easing({duration:200,start:{opacity:0},finish:{opacity:100},transition:BX.easing.makeEaseOut(BX.easing.transitions.quart),step:function(e){i.CAL.DOM.commentWrap.style.opacity=e.opacity/100},complete:BX.proxy(function(){i.CAL.DOM.commentWrap.style.opacity=null;t.comAni=null},this)});t.comAni.animate()}};JCEC.prototype.AdjustOverlay=function(e,t){if(t===false){if(e&&e.overlay&&e.resizeOverlay){e.resizeOverlay()}}else{setTimeout(function(){if(e&&e.overlay&&e.resizeOverlay)e.resizeOverlay()},200)}};JCEC.prototype.CloseViewDialog=function(e){BX.removeCustomEvent("OnUCFeedChanged",BX.proxy(function(){this.AdjustOverlay(this.oViewEventDialog)},this));if(this.oViewEventDialog.adjustInterval)this.oViewEventDialog.adjustInterval=clearInterval(this.oViewEventDialog.adjustInterval);if(e===true)this.oViewEventDialog.close();this.OnResize()};JCEC.prototype.CreateSectDialog=function(){var e=this;var t=new BX.PopupWindow("BXCSection"+this.id,null,{overlay:{opacity:10},autoHide:false,closeByEsc:true,zIndex:-100,offsetLeft:0,offsetTop:0,draggable:true,titleBar:EC_MESS.NewCalenTitle,closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-tabed bxc-popup-window",contentColor:"white",contentNoPaddings:true,buttons:[new BX.PopupWindowButton({text:EC_MESS.googleHide,id:this.id+"_bxec_cal_hide_but",events:{click:function(){e.HideCalDavSection(t.CAL.oSect);e.Event.ReloadAll();e.CloseSectDialog(true)}}}),new BX.PopupWindowButton({text:EC_MESS.DelSect,id:this.id+"_bxec_cal_del_but",events:{click:function(){if(e.DeleteSection(t.CAL.oSect))e.CloseSectDialog(true)}}}),new BX.PopupWindowButton({text:EC_MESS.Save,className:"popup-window-button-accept",events:{click:function(){if(e.SaveSection()){e.CloseSectDialog(true)}}}}),new BX.PopupWindowButtonLink({text:EC_MESS.Close,className:"popup-window-button-link-cancel",events:{click:function(){e.CloseSectDialog(true)}}})],content:BX("bxec_sect_d_"+this.id),events:{}});BX.addCustomEvent(t,"onPopupClose",BX.proxy(this.CloseSectDialog,this));t.CAL={DOM:{Title:t.titleBar.firstChild,pTabs:BX(this.id+"_editsect_tabs"),Name:BX(this.id+"_edcal_name"),Desc:BX(this.id+"_edcal_desc"),ExpAllow:BX(this.id+"_bxec_cal_exp_allow"),delBut:BX(this.id+"_bxec_cal_del_but"),hideBut:BX(this.id+"_bxec_cal_hide_but")}};BX.addClass(t.CAL.DOM.Title,"bxce-dialog-title");t.CAL.Access=new ECCalendarAccess({bind:"calendar_section",GetAccessName:BX.proxy(this.GetAccessName,this),pCont:BX(this.id+"access-values-cont"),pLink:BX(this.id+"access-link")});t.CAL.ColorControl=this.InitColorDialogControl("sect",function(e,i){t.CAL.Color=e;t.CAL.TextColor=i});if(this.arConfig.bExchange&&this.Personal())t.CAL.DOM.Exch=BX(this.id+"_bxec_cal_exch");this.ChargePopupTabs(t,this.id+"sect-tab-");this.oSectDialog=t;if(this.bSuperpose&&this.Personal()){t.CAL.DOM.add2SPCont=BX(this.id+"_bxec_cal_add2sp_cont");t.CAL.DOM.add2SP=BX(this.id+"_bxec_cal_add2sp")}t.CAL.DOM.ExpAllow.onclick=function(){e._AllowCalendarExportHandler(this.checked)}};JCEC.prototype.ShowSectionDialog=function(e){if(!this.oSectDialog)this.CreateSectDialog();var t=this.oSectDialog;t.show();this.SetPopupTab(0,t);if(!e){e={PERM:{access:true,add:true,edit:true,edit_section:true,view_full:true,view_time:true,view_title:true}};t.CAL.bNew=true;t.CAL.DOM.Title.innerHTML=EC_MESS.NewCalenTitle;t.CAL.DOM.delBut.style.display="none";t.CAL.DOM.hideBut.style.display="none";e.COLOR=this.GetFreeDialogColor();t.CAL.DOM.ExpAllow.checked=true;this._AllowCalendarExportHandler(true);if(t.CAL.DOM.ExpSet)t.CAL.DOM.ExpSet.value="all";if(this.bSuperpose&&this.Personal()){t.CAL.DOM.add2SP.checked=true;t.CAL.DOM.add2SPCont.style.display=BX.browser.IsIE()?"inline":"table-row"}if(this.arConfig.bExchange&&this.Personal()){t.CAL.DOM.Exch.disabled=false;t.CAL.DOM.Exch.checked=true}e.ACCESS=this.new_section_access}else{if(this.arConfig.bExchange&&this.Personal()){t.CAL.DOM.Exch.checked=!!e.IS_EXCHANGE;t.CAL.DOM.Exch.disabled=true}t.CAL.bNew=false;t.CAL.DOM.Title.innerHTML=EC_MESS.EditCalenTitle;t.CAL.DOM.delBut.style.display="";t.CAL.DOM.hideBut.style.display="none";if(e.CAL_DAV_CAL&&e.CAL_DAV_CON){t.CAL.DOM.delBut.style.display="none";t.CAL.DOM.hideBut.style.display=""}if(!e.COLOR)e.COLOR=this.arConfig.arCalColors[0];t.CAL.DOM.ExpAllow.checked=e.EXPORT||false;this._AllowCalendarExportHandler(e.EXPORT);if(e.EXPORT)t.CAL.DOM.ExpSet.value=e.EXPORT_SET||"all";if(this.bSuperpose&&this.Personal())t.CAL.DOM.add2SPCont.style.display="none"}t.CAL.ColorControl.Set(e.COLOR,e.TEXT_COLOR);this.ShowPopupTab(t.CAL.Tabs[1],e.PERM.access);if(e.PERM.access){if(this.type=="user"&&this.Personal()&&e.ACCESS["U"+this.ownerId])delete e.ACCESS["U"+this.ownerId];else if(this.type=="group"&&e.ACCESS["SG"+this.ownerId+"_A"])delete e.ACCESS["SG"+this.ownerId+"_A"];t.CAL.Access.SetSelected(e.ACCESS)}t.CAL.oSect=e;this.bEditCalDialogOver=false;t.CAL.DOM.Name.value=e.NAME||"";t.CAL.DOM.Desc.value=e.DESCRIPTION||"";BX.focus(t.CAL.DOM.Name)};JCEC.prototype.CloseSectDialog=function(e){if(e===true)this.oSectDialog.close()};JCEC.prototype._AllowCalendarExportHandler=function(e){if(!this.oSectDialog.CAL.DOM.ExpDiv)this.oSectDialog.CAL.DOM.ExpDiv=BX(this.id+"_bxec_calen_exp_div");if(!this.oSectDialog.CAL.DOM.ExpSet&&e)this.oSectDialog.CAL.DOM.ExpSet=BX(this.id+"_bxec_calen_exp_set");this.oSectDialog.CAL.DOM.ExpDiv.style.display=e?"block":"none"};JCEC.prototype.CreateExportDialog=function(){var e=this;var t=new BX.PopupWindow("BXCExportDialog"+this.id,null,{overlay:{opacity:10},autoHide:false,closeByEsc:true,zIndex:-100,offsetLeft:0,offsetTop:0,draggable:true,titleBar:" ",closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-window",buttons:[new BX.PopupWindowButton({text:EC_MESS.Close,className:"popup-window-button-accept",events:{click:function(){e.CloseExportDialog(true)}}})],content:BX("bxec_excal_"+this.id)});BX.addCustomEvent(t,"onPopupClose",BX.proxy(this.CloseExportDialog,this));t.CAL={DOM:{Title:t.titleBar.firstChild,Link:BX(this.id+"_excal_link"),NoticeLink:BX(this.id+"_excal_link_outlook"),Text:BX(this.id+"_excal_text"),Warn:BX(this.id+"_excal_warning")}};t.CAL.DOM.NoticeLink.onclick=function(){this.parentNode.className=""};this.oExportDialog=t};JCEC.prototype.ShowExportDialog=function(e){if(e&&e.EXPORT&&!e.EXPORT.ALLOW)return;if(!this.oExportDialog)this.CreateExportDialog();var t=this.oExportDialog;t.show();t.CAL.DOM.NoticeLink.parentNode.className="bxec-excal-notice-hide";t.CAL.DOM.Warn.className="bxec-export-warning-hidden";var i=this.path;i+=i.indexOf("?")>=0?"&":"?";if(e){t.CAL.DOM.Title.innerHTML=EC_MESS.ExpDialTitle;t.CAL.DOM.Text.innerHTML=EC_MESS.ExpText;i+="action=export"+e.EXPORT.LINK}var o="webcal"+i.substr(i.indexOf("://"));t.CAL.DOM.Link.onclick=function(e){window.location.href=o;BX.PreventDefault(e)};t.CAL.DOM.Link.href=i;t.CAL.DOM.Link.innerHTML=i;BX.ajax.get(i+"&check=Y","",function(e){setTimeout(function(){BX.closeWait(t.CAL.DOM.Title);if(!e||e.length<=0||e.toUpperCase().indexOf("BEGIN:VCALENDAR")==-1)t.CAL.DOM.Warn.className="bxec-export-warning"},300)})};JCEC.prototype.CloseExportDialog=function(e){if(e===true)this.oExportDialog.close()};JCEC.prototype.CreateSuperposeDialog=function(){var e=this;var t=new BX.PopupWindow("BXCSuperpose"+this.id,null,{overlay:{opacity:10},autoHide:false,closeByEsc:true,zIndex:-100,offsetLeft:0,offsetTop:0,draggable:true,titleBar:EC_MESS.SPCalendars,closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-window",buttons:[new BX.PopupWindowButton({text:EC_MESS.Save,className:"popup-window-button-accept",events:{click:function(){e.SPD_SaveSuperposed();e.CloseSuperposeDialog(true)}}}),new BX.PopupWindowButtonLink({text:EC_MESS.Close,className:"popup-window-button-link-cancel",events:{click:function(){e.CloseSuperposeDialog(true)}}})],content:BX("bxec_superpose_"+this.id),events:{}});BX.addCustomEvent(t,"onPopupClose",BX.proxy(this.CloseSuperposeDialog,this));t.CAL={DOM:{UserCntInner:BX("bxec_sp_type_user_cont_"+this.id),GroupCnt:BX("bxec_sp_type_group_"+this.id),GroupCntInner:BX("bxec_sp_type_group_cont_"+this.id),CommonCnt:BX("bxec_sp_type_common_"+this.id),DelAllUsersLink:BX("bxec_sp_dell_all_sp_"+this.id),UserSearchCont:BX(this.id+"_sp_user_search_input_cont"),NotFoundNotice:BX(this.id+"_sp_user_nf_notice"),arCat:{}},arSect:{},arGroups:{},arCals:{},curTrackedUsers:{}};BX.addCustomEvent(window,"onUserSelectorOnChange",function(e){t.CAL.curTrackedUsers=e});t.CAL.DOM.AddUsersLinkCont=BX(this.id+"_user_control_link_sp");t.CAL.DOM.AddUsersLinkCont.onclick=function(i){if(BX.PopupMenu&&BX.PopupMenu.currentItem)BX.PopupMenu.currentItem.popupWindow.close();if(!i)i=window.event;if(!t.CAL.DOM.SelectUserPopup){t.CAL.DOM.SelectUserPopup=BX.PopupWindowManager.create("bxc-user-popup-sp",t.CAL.DOM.AddUsersLinkCont,{offsetTop:1,autoHide:true,closeByEsc:true,content:BX("BXCalUserSelectSP_selector_content"),className:"bxc-popup-user-select",buttons:[new BX.PopupWindowButton({text:EC_MESS.Add,events:{click:function(){t.CAL.DOM.SelectUserPopup.close();var i=[],o;for(o in t.CAL.curTrackedUsers)if(t.CAL.curTrackedUsers[o]&&o>0&&parseInt(o)==o)i.push(o);e.Request({postData:e.GetReqData("spcal_user_cals",{users:i}),errorText:EC_MESS.CalenSaveErr,handler:function(i){if(i){if(i.sections){if(!e.arSPSections)e.arSPSections=[];e.SPD_BuildSections(e.arSPSections.concat(i.sections),true);for(var o=0;o<e.arSections.length;o++){if(e.arSections[o].ID&&t.CAL.arSect[e.arSections[o].ID])t.CAL.arSect[e.arSections[o].ID].pCh.checked=!!e.arSections[o].SUPERPOSED}}else{e.oSupDialog.CAL.DOM.NotFoundNotice.style.visibility="visible";setTimeout(function(){e.oSupDialog.CAL.DOM.NotFoundNotice.style.visibility="hidden"},4e3)}return true}return false}})}}}),new BX.PopupWindowButtonLink({text:EC_MESS.Close,className:"popup-window-button-link-cancel",events:{click:function(){t.CAL.DOM.SelectUserPopup.close()}}})]})}t.CAL.curTrackedUsers={};t.CAL.DOM.SelectUserPopup.show();BX.PreventDefault(i)};this.oSupDialog=t};JCEC.prototype.SPD_BuildSections=function(e,t){var i=this,o=this.oSupDialog,n,a,s,l,r,c,d,C,p,u;BX.cleanNode(o.CAL.DOM.UserCntInner);BX.cleanNode(o.CAL.DOM.GroupCntInner);BX.cleanNode(o.CAL.DOM.CommonCnt);if(!this.arSPSections)this.arSPSections=[];for(l in e){r=e[l];if(!r.ID)return;if(r.CAL_TYPE=="user"){c=o.CAL.DOM.UserCntInner}else if(r.CAL_TYPE=="group"){c=o.CAL.DOM.GroupCntInner;o.CAL.DOM.GroupCnt.style.display="block"}else{c=o.CAL.DOM.CommonCnt;o.CAL.DOM.CommonCnt.style.display="block"}C=r.CAL_TYPE+r.OWNER_ID;if(!o.CAL.DOM.arCat[C]||!BX.isNodeInDom(o.CAL.DOM.arCat[C].pCat)){if(r.CAL_TYPE=="user"||r.CAL_TYPE=="group")p=r.OWNER_NAME;else p=r.TYPE_NAME;n=c.appendChild(BX.create("DIV",{props:{className:"bxc-spd-cat"}}));a=n.appendChild(BX.create("DIV",{props:{className:"bxc-spd-cat-title"},html:'<span class="bxc-spd-cat-plus"></span><span class="bxc-spd-cat-title-inner">'+BX.util.htmlspecialchars(p)+"</span>"}));pCatSections=n.appendChild(BX.create("DIV",{props:{className:"bxc-spd-cat-sections"}}));a.onclick=function(){BX.toggleClass(this.parentNode,"bxc-spd-cat-collapsed")};if(r.CAL_TYPE=="user"&&r.OWNER_ID!=this.userId){a.appendChild(BX.create("A",{props:{href:"javascript:void(0);",className:"bxc-spd-del-cat",title:EC_MESS.DeleteDynSPGroupTitle},text:EC_MESS.DeleteDynSPGroup,events:{click:function(e){i.SPD_DelTrackingUser(this.getAttribute("bx-data"),this);return BX.PreventDefault(e)}}})).setAttribute("bx-data",r.OWNER_ID)}o.CAL.DOM.arCat[C]={pCat:n,pTitle:a,pSections:pCatSections}}u=this.id+"spd-sect"+r.ID;d=BX.create("DIV",{props:{className:"bxc-spd-sect-cont"}});s=d.appendChild(BX.create("SPAN",{props:{className:"bxc-spd-sect-check"}})).appendChild(BX.create("INPUT",{props:{type:"checkbox",id:u}}));pLabel=d.appendChild(BX.create("SPAN",{props:{className:"bxc-spd-sect-label"},html:'<label for="'+u+'"><span>'+BX.util.htmlspecialchars(r.NAME)+"</span></label>"}));o.CAL.DOM.arCat[C].pSections.appendChild(d);o.CAL.arSect[r.ID]={pCh:s,pItem:d,oSect:r};if(t){var D=false;for(l in this.arSPSections){if(this.arSPSections.hasOwnProperty(l)){if(this.arSPSections[l].CAL_TYPE==r.CAL_TYPE&&this.arSPSections[l].OWNER_ID==r.OWNER_ID){D=true;break}}}if(!D)this.arSPSections.push(r)}}};JCEC.prototype.SPD_SaveSuperposed=function(){var e,t;for(e in this.oSupDialog.CAL.arSect){t=this.oSupDialog.CAL.arSect[e];if(t.pCh.checked){if(this.arSectionsInd[e]&&this.arSections[this.arSectionsInd[e]]){this.arSections[this.arSectionsInd[e]].SUPERPOSED=true}else if(!this.arSectionsInd[e]){t.oSect.SUPERPOSED=true;this.arSections.push(t.oSect);this.arSectionsInd[t.oSect.ID]=this.arSections.length-1}}else{if(this.arSectionsInd[e]&&this.arSections[this.arSectionsInd[e]]){this.arSections[this.arSectionsInd[e]].SUPERPOSED=false}}}this.SetSuperposed()};JCEC.prototype.SPD_DelTrackingUser=function(e,t){var i=BX.findParent(t,{className:"bxc-spd-cat"});if(i)i.parentNode.removeChild(i);var o,n;for(o in this.oSupDialog.CAL.arSect){if(this.oSupDialog.CAL.arSect.hasOwnProperty(o)){n=this.oSupDialog.CAL.arSect[o];if(n&&n.oSect&&n.oSect.CAL_TYPE=="user"&&n.oSect.OWNER_ID==e)n.pCh.checked=false}}var a=[];for(o in this.arSPSections){if(this.arSPSections.hasOwnProperty(o)){n=this.arSPSections[o];if(n.CAL_TYPE!="user"||n.OWNER_ID!=e)a.push(n)}}this.arSPSections=a;this.SPD_SaveSuperposed();this.Request({postData:this.GetReqData("spcal_del_user",{userId:parseInt(e)}),handler:function(e){if(e)return true}})};JCEC.prototype.ShowSuperposeDialog=function(){var e=this;if(!this.arSPSections){return this.Request({getData:e.GetReqData("get_superposed"),handler:function(t){if(t){e.arSPSections=t.sections||[];return e.ShowSuperposeDialog()}return false}})}if(!this.oSupDialog)this.CreateSuperposeDialog();if(this.arSPSections)this.SPD_BuildSections(this.arSPSections,false);var t=this.oSupDialog;t.show();for(var i=0;i<this.arSections.length;i++){if(this.arSections[i].ID&&t.CAL.arSect[this.arSections[i].ID])t.CAL.arSect[this.arSections[i].ID].pCh.checked=!!this.arSections[i].SUPERPOSED}};JCEC.prototype.CloseSuperposeDialog=function(e){this.arSPSections=null;if(e===true)this.oSupDialog.close()};JCEC.prototype.BuildSectionSelect=function(e,t){e.options.length=0;var i,o,n,a;e.parentNode.className="bxec-cal-sel-cel";for(i=0;i<this.arSections.length;i++){n=this.arSections[i];if(n.PERM.edit_section&&this.IsCurrentViewSect(n)&&n.ACTIVE!=="N"){a=t==n.ID;o=new Option(n.NAME,n.ID,a,a);e.options.add(o);if(!BX.browser.IsIE())o.style.backgroundColor=n.COLOR}}if(e.options.length<=0)e.parentNode.className="bxec-cal-sel-cel-empty"};JCEC.prototype.IsCurrentViewSect=function(e){return e.CAL_TYPE==this.type&&e.OWNER_ID==this.ownerId};JCEC.prototype.CreateSetDialog=function(){var e=this;var t=new BX.PopupWindow("BXCSettings"+this.id,null,{overlay:{opacity:10},autoHide:false,closeByEsc:true,zIndex:-100,offsetLeft:0,offsetTop:0,draggable:true,titleBar:this.PERM.access?EC_MESS.Settings:EC_MESS.UserSettings,closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-tabed bxc-popup-window",contentColor:"white",contentNoPaddings:true,buttons:[new BX.PopupWindowButton({text:EC_MESS.Save,className:"popup-window-button-accept",events:{click:function(){e.CloseSetDialog(true);e.SaveSettings()}}}),new BX.PopupWindowButtonLink({text:EC_MESS.Close,className:"popup-window-button-link-cancel",events:{click:function(){e.CloseSetDialog(true)}}})],content:BX("bxec_uset_"+this.id)});BX.addCustomEvent(t,"onPopupClose",BX.proxy(this.CloseSetDialog,this));t.CAL={inPersonal:this.type=="user"&&this.ownerId==this.userId,DOM:{pTabs:BX(this.id+"_set_tabs"),ShowMuted:BX(this.id+"_show_muted"),denyBusyInvitation:BX(this.id+"_deny_busy_invitation")}};if(t.CAL.inPersonal){t.CAL.DOM.SectSelect=BX(this.id+"_set_sect_sel");t.CAL.DOM.Blink=BX(this.id+"_uset_blink");t.CAL.DOM.ShowDeclined=BX(this.id+"_show_declined");t.CAL.DOM.TimezoneSelect=BX(this.id+"_set_tz_sel")}if(this.PERM.access){t.CAL.Access=new ECCalendarAccess({bind:"calendar_type",GetAccessName:BX.proxy(this.GetAccessName,this),pCont:BX(this.id+"type-access-values-cont"),pLink:BX(this.id+"type-access-link")});t.CAL.DOM.WorkTimeStart=BX(this.id+"work_time_start");t.CAL.DOM.WorkTimeEnd=BX(this.id+"work_time_end");t.CAL.DOM.WeekHolidays=BX(this.id+"week_holidays");t.CAL.DOM.YearHolidays=BX(this.id+"year_holidays");t.CAL.DOM.YearWorkdays=BX(this.id+"year_workdays");t.CAL.DOM.WeekStart=BX(this.id+"week_start")}if(this.bSuperpose){t.CAL.DOM.ManageSuperpose=BX(this.id+"-set-manage-sp");t.CAL.DOM.ManageSuperpose.onclick=function(){e.ShowSuperposeDialog()}}t.CAL.DOM.ManageCalDav=BX(this.id+"_manage_caldav");if(t.CAL.DOM.ManageCalDav)t.CAL.DOM.ManageCalDav.onclick=function(){e.ShowExternalDialog()};t.CAL.DOM.UsetClearAll=BX(this.id+"_uset_clear");if(t.CAL.DOM.UsetClearAll)t.CAL.DOM.UsetClearAll.onclick=function(){if(confirm(EC_MESS.ClearUserSetConf)){e.CloseSetDialog(true);e.ClearPersonalSettings()}};this.ChargePopupTabs(t,this.id+"set-tab-");if(!this.PERM.access&&t.CAL.DOM.pTabs)t.CAL.DOM.pTabs.style.display="none";this.oSetDialog=t};JCEC.prototype.ShowSetDialog=function(e){
if(!this.oSetDialog)this.CreateSetDialog();var t=this.oSetDialog;t.show();if(!e||typeof e!="object")e={};this.SetPopupTab(e.tabId||0,t);if(t.CAL.inPersonal){t.CAL.DOM.SectSelect.options.length=0;var i,o,n,a=!this.userSettings.meetSection;t.CAL.DOM.SectSelect.options.add(new Option(" - "+EC_MESS.FirstInList+" - ",0,a,a));for(i=0;i<this.arSections.length;i++){n=this.arSections[i];if(n.CAL_TYPE=="user"&&n.OWNER_ID==this.userId&&n.ACTIVE!=="N"){a=this.userSettings.meetSection==n.ID;o=new Option(n.NAME,n.ID,a,a);o.style.backgroundColor=n.COLOR;t.CAL.DOM.SectSelect.options.add(o)}}t.CAL.DOM.Blink.checked=!!this.userSettings.blink;t.CAL.DOM.ShowDeclined.checked=!!this.userSettings.showDeclined}if(t.CAL.DOM.TimezoneSelect){t.CAL.DOM.TimezoneSelect.value=this.arConfig.userTimezoneName||""}t.CAL.DOM.ShowMuted.checked=!!this.userSettings.showMuted;if(t.CAL.DOM.denyBusyInvitation)t.CAL.DOM.denyBusyInvitation.checked=!!this.userSettings.denyBusyInvitation;if(this.PERM.access){t.CAL.Access.SetSelected(this.typeAccess);t.CAL.DOM.WorkTimeStart.value=this.settings.work_time_start;t.CAL.DOM.WorkTimeEnd.value=this.settings.work_time_end;for(i=0;i<t.CAL.DOM.WeekHolidays.options.length;i++){t.CAL.DOM.WeekHolidays.options[i].selected=BX.util.in_array(t.CAL.DOM.WeekHolidays.options[i].value,this.settings.week_holidays)}t.CAL.DOM.YearHolidays.value=this.settings.year_holidays;t.CAL.DOM.YearWorkdays.value=this.settings.year_workdays;t.CAL.DOM.WeekStart.value=this.settings.week_start}};JCEC.prototype.CloseSetDialog=function(e){if(e===true)this.oSetDialog.close()};JCEC.prototype.CreateExternalDialog=function(){var e=this;var t=new BX.PopupWindow("BXCExternalDialog"+this.id,null,{overlay:{opacity:10},autoHide:false,closeByEsc:true,zIndex:-95,offsetLeft:0,offsetTop:0,draggable:true,titleBar:EC_MESS.CalDavDialogTitle,closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-window bxc-popup-window-white",contentColor:"white",contentNoPaddings:true,buttons:[new BX.PopupWindowButton({text:EC_MESS.AddCalDav,events:{click:function(){var i=t.CAL.arConnections.length;t.CAL.arConnections.push({bNew:true,name:EC_MESS.NewExCalendar,link:"",user_name:""});e.ExternalCalDialogDisplayConnection(t.CAL.arConnections[i],i);e.ExternalCalDialogEditConnection(i)}}}),new BX.PopupWindowButton({text:EC_MESS.Save,className:"popup-window-button-accept",events:{click:function(){if(t.CAL.bLockClosing)return alert(EC_MESS.CalDavConWait);if(t.CAL.curEditedConInd!==false&&t.CAL.arConnections[t.CAL.curEditedConInd])e.ExternalCalDialogSaveConnectionData(t.CAL.curEditedConInd);e.arConnections=t.CAL.arConnections;t.CAL.bLockClosing=true;e.SaveCalDavConnections(function(i){t.CAL.bLockClosing=false;if(i){e.CloseExternalDialog(true);window.location=window.location}},function(){t.CAL.bLockClosing=false})}}}),new BX.PopupWindowButtonLink({text:EC_MESS.Close,className:"popup-window-button-link-cancel",events:{click:function(){e.CloseExternalDialog(true)}}})],content:BX("bxec_cdav_"+this.id)});BX.addCustomEvent(t,"onPopupClose",BX.proxy(this.CloseExternalDialog,this));t.CAL={DOM:{List:BX(this.id+"_bxec_dav_list"),EditConDiv:BX(this.id+"_bxec_dav_new"),EditName:BX(this.id+"_bxec_dav_name"),EditLink:BX(this.id+"_bxec_dav_link"),UserName:BX(this.id+"_bxec_dav_username"),Pass:BX(this.id+"_bxec_dav_password"),UserNameCont:BX(this.id+"_bxec_dav_username_cont"),PassCont:BX(this.id+"_bxec_dav_password_cont"),SectionsCont:BX(this.id+"_bxec_dav_sections_cont"),Sections:BX(this.id+"_bxec_dav_sections")}};this.oExternalDialog=t};JCEC.prototype.ShowExternalDialog=function(){if(!this.oExternalDialog)this.CreateExternalDialog();var e=this.oExternalDialog,t;e.show();e.CAL.curEditedConInd=false;BX.cleanNode(e.CAL.DOM.List);e.CAL.arConnections=BX.clone(this.arConnections);for(t=0;t<this.arConnections.length;t++){this.ExternalCalDialogDisplayConnection(e.CAL.arConnections[t],t)}if(this.arConnections.length==0){t=e.CAL.arConnections.length;e.CAL.arConnections.push({bNew:true,name:EC_MESS.NewExCalendar,link:"",user_name:""});this.ExternalCalDialogDisplayConnection(e.CAL.arConnections[t],t);this.ExternalCalDialogEditConnection(t)}else{this.ExternalCalDialogEditConnection(0)}};JCEC.prototype.CloseExternalDialog=function(e){if(e===true)this.oExternalDialog.close()};JCEC.prototype.ExternalCalDialogEditConnection=function(e){var t=this.oExternalDialog,i=t.CAL.arConnections[e];for(var o in t.CAL.arConnections){if(t.CAL.arConnections[o]&&o!=e&&BX.hasClass(t.CAL.arConnections[o].pConDiv,"bxec-dav-item-edited")){if(t.CAL.DOM.EditConDiv.parentNode==t.CAL.arConnections[o].pConDiv)this.ExternalCalDialogSaveConnectionData(o);BX.removeClass(t.CAL.arConnections[o].pConDiv,"bxec-dav-item-edited")}}if(i.del||t.CAL.curEditedConInd===e)return;if(t.CAL.curEditedConInd!==false&&t.CAL.arConnections[t.CAL.curEditedConInd]){this.ExternalCalDialogSaveConnectionData(t.CAL.curEditedConInd);BX.removeClass(t.CAL.arConnections[t.CAL.curEditedConInd].pConDiv,"bxec-dav-item-edited")}if(i.account_type=="caldav_google_oauth"){t.CAL.DOM.UserNameCont.style.display="none";t.CAL.DOM.PassCont.style.display="none";t.CAL.DOM.SectionsCont.style.display="";t.CAL.DOM.EditName.disabled="disabled";t.CAL.DOM.EditLink.disabled="disabled"}else{t.CAL.DOM.EditName.disabled="";t.CAL.DOM.EditLink.disabled="";t.CAL.DOM.UserNameCont.style.display="";t.CAL.DOM.PassCont.style.display=""}t.CAL.curEditedConInd=e;t.CAL.DOM.EditName.value=i.name;t.CAL.DOM.EditLink.value=i.link;t.CAL.DOM.UserName.value=i.user_name;i.sections={};BX.cleanNode(t.CAL.DOM.Sections);var n,a,s,l;for(n=0;n<this.arSections.length;n++){if(this.arSections[n]&&this.arSections[n].CAL_DAV_CON==i.id){a=this.arSections[n].ID;s=t.CAL.DOM.Sections.appendChild(BX.create("DIV",{props:{className:"bxec-dav-sect"}}));i.sections[a]=s.appendChild(BX.create("SPAN",{props:{className:"bxec-dav-sect-check"}})).appendChild(BX.create("INPUT",{props:{type:"checkbox",id:a,checked:this.arSections[n].ACTIVE=="Y"}}));s.appendChild(BX.create("SPAN",{props:{className:"bxc-spd-sect-label"},html:'<label for="'+a+'"><span>'+BX.util.htmlspecialchars(this.arSections[n].NAME)+"</span></label>"}))}}if(i.account_type!=="caldav_google_oauth"){if(i.id>0)this.ExD_CheckPass();else t.CAL.DOM.Pass.value="";setTimeout(function(){BX.focus(t.CAL.DOM.EditLink)},100);t.CAL.DOM.EditName.onkeyup=t.CAL.DOM.EditName.onfocus=t.CAL.DOM.EditName.onblur=function(){if(t.CAL.changeNameTimeout)clearTimeout(t.CAL.changeNameTimeout);t.CAL.changeNameTimeout=setTimeout(function(){if(t.CAL.curEditedConInd!==false&&t.CAL.arConnections[t.CAL.curEditedConInd]){var e=t.CAL.DOM.EditName.value;if(e.length>25)e=e.substr(0,23)+"...";t.CAL.arConnections[t.CAL.curEditedConInd].pText.innerHTML=BX.util.htmlspecialchars(e);t.CAL.arConnections[t.CAL.curEditedConInd].pText.title=t.CAL.DOM.EditName.value}},50)}}i.pConDiv.appendChild(t.CAL.DOM.EditConDiv);BX.addClass(i.pConDiv,"bxec-dav-item-edited")};JCEC.prototype.ExternalCalDialogDisplayConnection=function(e,t){var i=this,o=this.oExternalDialog,n=o.CAL.DOM.List.appendChild(BX.create("DIV",{props:{id:"bxec_dav_con_"+t,className:"bxec-dav-item"+(t%2==0?"":" bxec-dav-item-1")}})),a=n.appendChild(BX.create("DIV",{props:{className:"bxec-dav-item-name"}})),s=a.appendChild(BX.create("IMG",{props:{src:"/bitrix/images/1.gif",className:"bxec-dav-item-status"}})),l=a.appendChild(BX.create("SPAN",{text:e.name})),r=a.appendChild(BX.create("SPAN",{text:""})),c=a.appendChild(BX.create("A",{props:{href:"javascript: void(0);",className:"bxec-dav-edit"},text:EC_MESS.CalDavEdit})),d=a.appendChild(BX.create("A",{props:{href:"javascript: void(0);",className:"bxec-dav-col"},text:EC_MESS.CalDavCollapse})),C=a.appendChild(BX.create("A",{props:{href:"javascript: void(0);",className:"bxec-dav-del"},text:EC_MESS.CalDavDel})),p=a.appendChild(BX.create("A",{props:{href:"javascript: void(0);",className:"bxec-dav-rest"},text:EC_MESS.CalDavRestore})),u=a.appendChild(BX.create("DIV",{props:{className:"bxec-dav-del-cal"},children:[BX.create("LABEL",{props:{htmlFor:"bxec_dav_con_del_cal_"+t},text:EC_MESS.DelConCalendars})]})),D=u.appendChild(BX.create("INPUT",{props:{type:"checkbox",id:"bxec_dav_con_del_cal_"+t,checked:true}}));if(e.id>0){var E="bxec-dav-item-status",h;if(e.last_result.indexOf("[200]")>=0){E+=" bxec-dav-ok";h=EC_MESS.SyncOk+". "+EC_MESS.SyncDate+": "+e.sync_date}else{E+=" bxec-dav-error";h=EC_MESS.SyncError+": "+e.last_result+". "+EC_MESS.SyncDate+": "+e.sync_date}s.className=E;s.title=h;var f,v=0;for(f=0;f<this.arSections.length;f++){if(this.arSections[f]&&this.arSections[f].CAL_DAV_CON==e.id)v++}r.innerHTML=" ("+v+")";o.CAL.DOM.SectionsCont.style.display=""}else{o.CAL.DOM.SectionsCont.style.display="none"}n.onmouseover=function(){BX.addClass(this,"bxec-dav-item-over")};n.onmouseout=function(){BX.removeClass(this,"bxec-dav-item-over")};n.onclick=function(){t=parseInt(this.id.substr("bxec_dav_con_".length));i.ExternalCalDialogEditConnection(t)};d.onclick=function(e){var t=parseInt(this.parentNode.parentNode.id.substr("bxec_dav_con_".length));if(o.CAL.arConnections[t]){i.ExternalCalDialogSaveConnectionData(t);BX.removeClass(o.CAL.arConnections[t].pConDiv,"bxec-dav-item-edited");i.oExternalDialog.curEditedConInd=false}return BX.PreventDefault(e)};C.onclick=function(e){var t=parseInt(this.parentNode.parentNode.id.substr("bxec_dav_con_".length));if(o.CAL.arConnections[t]){o.CAL.arConnections[t].del=true;BX.removeClass(o.CAL.arConnections[t].pConDiv,"bxec-dav-item-edited");BX.addClass(o.CAL.arConnections[t].pConDiv,"bxec-dav-item-deleted");i.ExternalCalDialogSaveConnectionData(t);i.oExternalDialog.curEditedConInd=false}return BX.PreventDefault(e)};p.onclick=function(e){var t=parseInt(this.parentNode.parentNode.id.substr("bxec_dav_con_".length));if(o.CAL.arConnections[t]){o.CAL.arConnections[t].del=false;BX.removeClass(o.CAL.arConnections[t].pConDiv,"bxec-dav-item-deleted")}return BX.PreventDefault(e)};c.onclick=function(e){var t=parseInt(this.parentNode.parentNode.id.substr("bxec_dav_con_".length));i.ExternalCalDialogEditConnection(t);return BX.PreventDefault(e)};e.pConDiv=n;e.pText=l;e.pDelCalendars=D};JCEC.prototype.ExternalCalDialogSaveConnectionData=function(e){var t=this.oExternalDialog,i=t.CAL.arConnections[e];i.name=t.CAL.DOM.EditName.value;i.link=t.CAL.DOM.EditLink.value;i.user_name=t.CAL.DOM.UserName.value;i.pass="bxec_not_modify_pass";if(t.CAL.DOM.Pass.type.toLowerCase()=="password"&&t.CAL.DOM.Pass.title!=EC_MESS.CalDavNoChange)i.pass=t.CAL.DOM.Pass.value};JCEC.prototype.ExD_CheckPass=function(){var e=this.oExternalDialog;if(!BX.browser.IsIE()){e.CAL.DOM.Pass.type="text";e.CAL.DOM.Pass.value=EC_MESS.CalDavNoChange}else{e.CAL.DOM.Pass.value=""}e.CAL.DOM.Pass.title=EC_MESS.CalDavNoChange;e.CAL.DOM.Pass.className="bxec-dav-no-change";e.CAL.DOM.Pass.onfocus=e.CAL.DOM.Pass.onmousedown=function(){if(!BX.browser.IsIE())this.type="password";this.value="";this.title="";this.className="";this.onfocus=this.onmousedown=null;BX.focus(this)}};JCEC.prototype.CreateMobileSyncDialog=function(){var e=this;var t=new BX.PopupWindow("BXCMobileHelp"+this.id,null,{overlay:{opacity:10},autoHide:false,closeByEsc:true,zIndex:-100,offsetLeft:0,offsetTop:0,draggable:true,titleBar:" ",closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-window",buttons:[new BX.PopupWindowButton({text:EC_MESS.Close,className:"popup-window-button-accept",events:{click:function(){e.CloseMobileSyncDialog(true)}}})],content:BX("bxec_mobile_"+this.id)});BX.addCustomEvent(t,"onPopupClose",BX.proxy(this.CloseMobileSyncDialog,this));t.CAL={DOM:{title:t.titleBar.firstChild,iPhoneSyncInfo:BX("bxec-sync-iphone-"+this.id),macosxSyncInfo:BX("bxec-sync-mac-"+this.id),androidSyncInfo:BX("bxec-sync-android-"+this.id)}};this.oMobileDialog=t};JCEC.prototype.ShowMobileSyncDialog=function(e,t){t="all";if(!this.oMobileDialog)this.CreateMobileSyncDialog();var i=this.oMobileDialog;i.show();i.CAL.DOM.iPhoneSyncInfo.style.display="none";i.CAL.DOM.macosxSyncInfo.style.display="none";i.CAL.DOM.androidSyncInfo.style.display="none";var o=[],n;if(e=="iphone"){i.CAL.DOM.title.innerHTML=EC_MESS.SyncTitleIphone;i.CAL.DOM.iPhoneSyncInfo.style.display="block";o=o.concat(BX.findChildren(i.CAL.DOM.iPhoneSyncInfo,{tagName:"SPAN",className:"bxec-link"},true));for(n=0;n<o.length;n++)if(o[n]&&o[n].nodeName){o[n].innerHTML=this.arConfig.caldav_link_all}}else if(e=="macosx"){i.CAL.DOM.title.innerHTML=EC_MESS.SyncTitleMacOSX;i.CAL.DOM.macosxSyncInfo.style.display="block";o=BX.findChildren(i.CAL.DOM.macosxSyncInfo,{tagName:"SPAN",className:"bxec-link"},true);for(n=0;n<o.length;n++){if(o[n]&&o[n].nodeName){o[n].innerHTML=this.arConfig.caldav_link_all.replace(/^https?:\/\//gi,"")}}}else if(e=="android"){i.CAL.DOM.title.innerHTML=EC_MESS.SyncTitleAndroid;i.CAL.DOM.androidSyncInfo.style.display="block"}i.CAL.calendarId=t;if(e=="iphone"||e=="macosx"){o=o.concat(BX.findChildren(i.CAL.DOM.iPhoneAllCont,{tagName:"SPAN",className:"bxec-link"},true));for(n=0;n<o.length;n++)if(o[n]&&o[n].nodeName)o[n].innerHTML=this.arConfig.caldav_link_all}};JCEC.prototype.CloseMobileSyncDialog=function(e){if(e===true)this.oMobileDialog.close()};JCEC.prototype.ChargePopupTabs=function(e,t){if(!e||!e.CAL||!e.CAL.DOM||!e.CAL.DOM.pTabs)return;e.CAL.Tabs=[];e.CAL.activeTab=false;var i,o=this;for(var n in e.CAL.DOM.pTabs.childNodes){i=e.CAL.DOM.pTabs.childNodes[n];if(i.nodeType=="1"&&i.className&&i.className.indexOf("popup-window-tab")!=-1){e.CAL.Tabs.push({tab:i,cont:BX(i.id+"-cont"),showed:i.style.display!="none"});i.onclick=function(){o.SetPopupTab(parseInt(this.id.substr(t.length)),e)}}}};JCEC.prototype.ShowPopupTab=function(e,t){e.tab.style.display=t?"":"none";e.cont.style.display=t?"":"none";e.showed=!!t};JCEC.prototype.SetPopupTab=function(e,t){var i,o,n=t.CAL.Tabs;if(isNaN(parseInt(e))||parseInt(e)!==e){for(i in n){if(n.hasOwnProperty(i)&&n[i].tab.id==e){e=i;break}}}e=parseInt(e);if(n&&t.CAL.activeTab!==e&&!n[e].bDisabled){for(i in n){if(n.hasOwnProperty(i)){o=n[i];if(!o||!o.cont)continue;if(i==e){BX.addClass(o.cont,"popup-window-tab-content-selected");BX.addClass(o.tab,"popup-window-tab-selected")}else{BX.removeClass(o.cont,"popup-window-tab-content-selected");BX.removeClass(o.tab,"popup-window-tab-selected")}BX.onCustomEvent(o,"OnSetTab",[o,i==e])}}t.CAL.activeTab=e;this.AdjustOverlay(t)}};JCEC.prototype.InitColorDialogControl=function(e,t){var i=this,o=this.id+"-"+e,n=BX(o+"-color-cont"),a=BX(o+"-color-inp"),s=BX(o+"-text-color-inp");function l(e,o,n){if(!o||n&&(o=="#FFFFFF"||o=="#000000"))o=i.ColorIsDark(e)?"#FFFFFF":"#000000";try{a.value=e;a.style.backgroundColor=e;a.style.color=o}catch(s){e=this.arConfig.arCalColors[0];a.style.color="#000000"}if(t&&typeof t=="function")t(e,o)}n.onclick=function(e){if(!e)e=window.event;var t=e.target||e.srcElement;if(t&&t.nodeName&&t.nodeName.toLowerCase()=="a"){var n=parseInt(t.id.substr((o+"-color-").length),10);if(i.arConfig.arCalColors[n])l(i.arConfig.arCalColors[n])}};a.onblur=a.onkeyup=function(){l(this.value)};a.onclick=function(){i.ColorPicker.Open({pWnd:this,key:e,id:o+"-bg",onSelect:function(e){l(e,a.style.color,true)}})};s.onclick=function(){i.ColorPicker.Open({pWnd:this,key:e,id:o+"-text",onSelect:function(e){l(a.value,e,false)}})};return{Set:l}};JCEC.prototype.ShowConfirmDeleteDialog=function(e){var t=this;var i=this.oConfirmDeleteDialog;if(i){i.destroy()}var o=BX.create("DIV");i=new BX.PopupWindow("BXCConfirmDelete"+this.id,null,{overlay:{opacity:10},autoHide:true,closeByEsc:true,zIndex:0,offsetLeft:0,offsetTop:0,draggable:true,bindOnResize:false,titleBar:EC_MESS.EC_DEL_REC_EVENT,closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-window",buttons:[new BX.PopupWindowButtonLink({text:EC_MESS.Close,className:"popup-window-button-link-cancel",events:{click:function(){if(t.oConfirmDeleteDialog){t.oConfirmDeleteDialog.close()}}}})],content:o,events:{}});i.CAL={butThis:new BX.PopupWindowButton({text:EC_MESS.EC_REC_EV_ONLY_THIS_EVENT,events:{click:function(){if(t.Event.IsRecursive(e)){t.Event.ExcludeRecursionDate(e,e.DATE_FROM)}else if(e.RECURRENCE_ID){t.Event.Delete(e,true,{recursionMode:"this"})}if(t.oConfirmDeleteDialog){t.oConfirmDeleteDialog.close()}}}}),butNext:new BX.PopupWindowButton({text:EC_MESS.EC_REC_EV_NEXT,events:{click:function(){if(t.Event.IsRecursive(e)&&e.DT_FROM_TS===Math.floor(t.ParseDate(e["~DATE_FROM"]).getTime()/1e3)*1e3&&!e.RECURRENCE_ID){t.Event.DeleteAllReccurent(e,true)}else{t.Event.CutOffRecursiveEvent(e,e.DATE_FROM)}if(t.oConfirmDeleteDialog){t.oConfirmDeleteDialog.close()}if(t.oEditEventDialog){t.oEditEventDialog.close()}}}}),butAll:new BX.PopupWindowButton({text:EC_MESS.EC_REC_EV_ALL,events:{click:function(){t.Event.DeleteAllReccurent(e,true);if(t.oConfirmDeleteDialog){t.oConfirmDeleteDialog.close()}if(t.oEditEventDialog){t.oEditEventDialog.close()}}}}),DOM:{content:o}};o.appendChild(i.CAL.butThis.buttonNode);o.appendChild(i.CAL.butNext.buttonNode);o.appendChild(i.CAL.butAll.buttonNode);this.oConfirmDeleteDialog=i;i.show()};JCEC.prototype.ShowConfirmEditDialog=function(e,t){var i=this;var o=this.oConfirmEditDialog;if(o){o.destroy()}var n=BX.create("DIV");o=new BX.PopupWindow("BXCConfirmEdit"+this.id,null,{overlay:{opacity:10},autoHide:true,closeByEsc:true,zIndex:0,offsetLeft:0,offsetTop:0,draggable:true,bindOnResize:false,titleBar:EC_MESS.EC_EDIT_REC_EVENT,closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-window",buttons:[new BX.PopupWindowButtonLink({text:EC_MESS.Close,className:"popup-window-button-link-cancel",events:{click:function(){if(i.oConfirmEditDialog){i.oConfirmEditDialog.close()}}}})],content:n,events:{}});o.CAL={butThis:new BX.PopupWindowButton({text:EC_MESS.EC_REC_EV_ONLY_THIS_EVENT,events:{click:function(){t.params.recurentEventEditMode="this";i.oEditEventDialog.oController.SaveForm(t.params,true);if(i.oConfirmEditDialog){i.oConfirmEditDialog.close()}if(i.oEditEventDialog){i.oEditEventDialog.close()}}}}),butNext:new BX.PopupWindowButton({text:EC_MESS.EC_REC_EV_NEXT,events:{click:function(){t.params.recurentEventEditMode="next";if(i.oEditEventDialog.oController.Reinvite&&o.CAL.DOM.reiviteInp){i.oEditEventDialog.oController.Reinvite.checked=o.CAL.DOM.reiviteInp.checked}i.oEditEventDialog.oController.SaveForm(t.params,true);if(i.oConfirmEditDialog){i.oConfirmEditDialog.close()}if(i.oEditEventDialog){i.oEditEventDialog.close()}}}}),butAll:new BX.PopupWindowButton({text:EC_MESS.EC_REC_EV_ALL,events:{click:function(){t.params.recurentEventEditMode="all";i.oEditEventDialog.oController.SaveForm(t.params,true);if(i.oConfirmEditDialog){i.oConfirmEditDialog.close()}if(i.oEditEventDialog){i.oEditEventDialog.close()}}}}),DOM:{content:n}};n.appendChild(o.CAL.butThis.buttonNode);n.appendChild(o.CAL.butNext.buttonNode);n.appendChild(o.CAL.butAll.buttonNode);if(e.IS_MEETING&&e.MEETING){o.CAL.DOM.reiviteCont=n.appendChild(BX.create("DIV",{props:{className:"bxec-row-reinvite"}}));o.CAL.DOM.reiviteInp=o.CAL.DOM.reiviteCont.appendChild(BX.create("INPUT",{props:{type:"checkbox",value:"Y",name:"confirm_meeting_reinvite",checked:this.oEditEventDialog.oController.Reinvite.checked,id:"reinvite-inp"+this.id}}));o.CAL.DOM.reiviteCont.appendChild(BX.create("LABEL",{attrs:{"for":"reinvite-inp"+this.id},text:EC_MESS.EC_REINVITE}))}this.oConfirmEditDialog=o;o.show()};JCEC.prototype.ShowConfirmDeclineDialog=function(e,t){var i=this;var o=this.oConfirmDeclineDialog;if(o){o.destroy()}var n=BX.create("DIV");o=new BX.PopupWindow("BXCConfirmDecline"+this.id,null,{overlay:{opacity:10},autoHide:true,closeByEsc:true,zIndex:0,offsetLeft:0,offsetTop:0,draggable:true,bindOnResize:false,titleBar:EC_MESS.EC_DECLINE_REC_EVENT,closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-window",buttons:[new BX.PopupWindowButtonLink({text:EC_MESS.Close,className:"popup-window-button-link-cancel",events:{click:function(){if(i.oConfirmDeclineDialog){i.oConfirmDeclineDialog.close()}}}})],content:n,events:{}});o.CAL={butThis:new BX.PopupWindowButton({text:EC_MESS.EC_D_REC_EV_ONLY_THIS_EVENT,events:{click:function(){i.Event.SetMeetingStatus(false,{confirmed:true,reccurentMode:"this",currentDateFrom:i.oViewEventDialog.CAL.oEvent.DATE_FROM});if(i.oConfirmDeclineDialog){i.oConfirmDeclineDialog.close()}if(i.oViewEventDialog){i.oViewEventDialog.close()}}}}),butNext:new BX.PopupWindowButton({text:EC_MESS.EC_D_REC_EV_NEXT,events:{click:function(){i.Event.SetMeetingStatus(false,{confirmed:true,reccurentMode:"next",currentDateFrom:i.oViewEventDialog.CAL.oEvent.DATE_FROM});if(i.oConfirmDeclineDialog){i.oConfirmDeclineDialog.close()}if(i.oViewEventDialog){i.oViewEventDialog.close()}}}}),butAll:new BX.PopupWindowButton({text:EC_MESS.EC_D_REC_EV_ALL,events:{click:function(){i.Event.SetMeetingStatus(false,{confirmed:true,reccurentMode:"all",currentDateFrom:i.oViewEventDialog.CAL.oEvent.DATE_FROM});if(i.oConfirmDeclineDialog){i.oConfirmDeclineDialog.close()}if(i.oViewEventDialog){i.oViewEventDialog.close()}}}}),DOM:{content:n}};n.appendChild(o.CAL.butThis.buttonNode);n.appendChild(o.CAL.butNext.buttonNode);n.appendChild(o.CAL.butAll.buttonNode);this.oConfirmDeclineDialog=o;o.show()};
//# sourceMappingURL=cal-dialogs.map.js