Your IP : 172.28.240.42


Current Path : /var/www/html/clients/e-nkama.ru/e-nkama_bitrix/bitrix/js/calendar/
Upload File :
Current File : /var/www/html/clients/e-nkama.ru/e-nkama_bitrix/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;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:{content:BX.create("span",{html:EC_MESS.NewEvent})},closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-window",buttons:[new BX.PopupWindowButton({text:EC_MESS.GoExt,title:EC_MESS.GoExtTitle,className:"bxec-popup-link-icon bxec-popup-add-ex webform-small-button-transparent",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,s={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)s.accessibility=i.CAL.DOM.Accessibility.value;t.Event.Save(s);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)}};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"}this.oAddEventDialog=i;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))}var o,n,s,a,l,r,c="",d="";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 C=parseInt(this.selectDaysStartObj.id.substr(9)),p=parseInt(this.selectDaysEndObj.id.substr(9));if(C>p){a=p;p=C;C=a}o=this.activeDateDaysAr[C];n=this.activeDateDaysAr[p]}else if(this.selectTimeMode){s=this.curTimeSelection;o=new Date(s.sDay.year,s.sDay.month,s.sDay.date,s.sHour,s.sMin);n=new Date(s.eDay.year,s.eDay.month,s.eDay.date,s.eHour,s.eMin);if(o.getTime()>n.getTime()){a=o;o=n;n=a}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){l=this.curDayTSelection;o=new Date(l.sDay.year,l.sDay.month,l.sDay.date);n=new Date(l.eDay.year,l.eDay.month,l.eDay.date)}else return;var u=this.ConvertDayIndex(o.getDay()),h=this.ConvertDayIndex(n.getDay());if(o.getTime()==n.getTime()){r=this.days[u][0]+" "+bxFormatDate(o.getDate(),o.getMonth()+1,o.getFullYear())}else{var D=o.getDate(),E=o.getMonth()+1,v=o.getFullYear(),A=o.getHours(),f=o.getMinutes(),S=n.getDate(),L=n.getMonth()+1,_=n.getFullYear(),b=n.getHours(),m=n.getMinutes(),M=!(A==b&&A==0&&f==m&&f==0);if(M){c=this.FormatTimeByNum(A,f);d=this.FormatTimeByNum(b,m)}if(E==L&&v==_&&D==S&&M)r=this.days[u][0]+" "+bxFormatDate(D,E,v)+", "+c+" &mdash; "+d;else r=this.days[u][0]+" "+bxFormatDate(D,E,v)+" "+c+" &mdash; "+this.days[h][0]+" "+bxFormatDate(S,L,_)+" "+d}i.CAL.DOM.PeriodText.innerHTML=r;i.CAL.Params={from:o,to:n,time_f:c||"",time_t:d||""};setTimeout(function(){BX.focus(i.CAL.DOM.Name)},500);if(this.bIntranet&&(this.Personal()||this.type!="user"))i.CAL.DOM.Accessibility.value="busy";var x=this.GetAddDialogPosition();if(x){i.popupContainer.style.top=x.top+"px";i.popupContainer.style.left=x.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 s=!!(t.CAL.Params.time_f||t.CAL.Params.time_t);i.pFullDay.checked=!s;if(s){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 a=this.ParseDate(BX.util.trim(i.pFromDate.value)+" "+BX.util.trim(i.pFromTime.value),true);if(a){var l=new Date(a.getTime()+36e5);i.pToDate.value=this.FormatDate(l);i.pToTime.value=this.FormatTime(l)}}else{i.pToTime.value=i.pFromTime.value}}i.FullDay(false,s);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"),o=BX.create("span",{props:{className:"bxce-dialog-title"},html:EC_MESS.NewEvent});var n=new BX.PopupWindow("BXCEditEvent"+this.id,null,{overlay:{opacity:10},autoHide:false,closeByEsc:true,zIndex:-100,offsetLeft:0,offsetTop:0,draggable:true,titleBar:{content:o},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",className:"bxec-popup-link-icon bxec-popup-del-ex",events:{click:function(){if(t.Event.Delete(n.CAL.oEvent))t.CloseEditEventDialog(true)}}}),new BX.PopupWindowButton({text:EC_MESS.Save,className:"popup-window-button-accept",events:{click:function(){if(t.oEditEventDialog.CAL.bMeetingStyleFields){t.Event.SetMeetingParams({callback:function(){t.CloseEditEventDialog(true)},bLocationChecked:false})}else{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(n,"onPopupClose",BX.proxy(this.CloseEditEventDialog,this));n.CAL={DOM:{content:i,Title:o,DelBut:BX(this.id+"ed-del-button")}};this.oEditEventDialog=n};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=e.bExFromSimple,n=this.oEditEventDialog;n.CAL.oEvent=e.oEvent||{};i=n.CAL.oEvent&&n.CAL.oEvent.ID?n.CAL.oEvent.ID:0;if(i){n.CAL.DOM.DelBut.style.display="";n.CAL.DOM.Title.innerHTML=EC_MESS.EditEvent}else{n.CAL.DOM.DelBut.style.display="none";n.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){BX.removeClass(n.popupContainer.firstChild,"bxc-popup-window-loader");t.showDialogRequest=false;n.CAL.DOM.content.innerHTML=BX.util.trim(e)});BX.addClass(n.popupContainer.firstChild,"bxc-popup-window-loader");n.CAL.DOM.content.innerHTML='<div class="bxec-popup" style="width: 610px; height: 300px;"><div class="bxce-popup-loader"><div class="bxce-loader-curtain"></div></div></div>';if(!e.bRunPlanner)t.oEditEventDialog.show();var s=0;function a(){n.CAL.DOM.pTabs=BX(t.id+"_edit_tabs");s++;if(!n.CAL.DOM.pTabs&&s<10)return setTimeout(a,100);if(!n.CAL.DOM.pTabs){t.oEditEventDialog.close();t.Event.ReloadAll();s=0;return}t.ChargePopupTabs(n,t.id+"ed-tab-");if(window.__ATTENDEES_ACC)n.CAL.oEvent["~ATTENDEES"]=window.__ATTENDEES_ACC;n.oController=new EditEventPopupController({form:document.forms.event_edit_form,oEC:t,oEvent:n.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:n.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(e.bRunPlanner)t.RunPlanner({curEventId:false,attendees:[{id:t.userId,name:t.userName}]});if(o)t.OpenExFromSimple(true)}BX.addCustomEvent("onAjaxSuccessFinish",a)};JCEC.prototype.SetEditingMeetingFields=function(e){e=!!e;var t=this.oEditEventDialog;if(t.CAL.bMeetingStyleFields!=e){t.CAL.bMeetingStyleFields=e;if(e){BX.addClass(t.CAL.Tabs[0].cont,"bxc-meeting-edit-dis");t.CAL.DOM.pTabs.style.display=e?"none":"";t.CAL.Tabs[0].cont.appendChild(t.CAL.DOM.RemindCnt)}else{BX.removeClass(t.CAL.Tabs[0].cont,"bxc-meeting-edit-dis");t.CAL.DOM.pTabs.style.display="";t.CAL.Tabs[3].cont.insertBefore(t.CAL.DOM.RemindCnt,t.CAL.Tabs[3].cont.firstChild)}}};JCEC.prototype.CloseEditEventDialog=function(e){if(this.oEditEventDialog){if(e===true){if(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()}};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:{content:BX.create("span",{props:{className:"bxec-popup-title",id:this.id+"_viewev_title"},html:EC_MESS.ViewingEvent})},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",className:"bxec-popup-link-icon bxec-popup-del-ev",events:{click:function(){if(e.Event.Delete(i.CAL.oEvent))e.CloseViewDialog(true)}}}),new BX.PopupWindowButton({text:EC_MESS.Edit,className:"bxec-popup-link-icon bxec-popup-ed-ev",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:BX(this.id+"_viewev_title"),delBut:BX(this.id+"_viewev_del_but"),editBut:BX(this.id+"_viewev_edit_but")}};BX.bind(i.CAL.DOM.content,"click",function(t){var o=t.target||t.srcElement;var n=o.getAttribute("data-bx-more-users");if(!!n){var s=BX(n);if(s)BX.addClass(s,"bx-cal-view-att-cont-full");return}var a=o.getAttribute("data-bx-set-status")||o.parentNode.getAttribute("data-bx-set-status");if(!!a){e.Event.SetMeetingStatus(a=="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();cnt=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}),n);function n(s){i.CAL.DOM.content.innerHTML=s;i.CAL.DOM.pTabs=BX(t.id+"_viewev_tabs");cnt++;if(!i.CAL.DOM.pTabs&&cnt<10)return setTimeout(function(){n(s)},100);if(!i.CAL.DOM.pTabs){t.oViewEventDialog.close();t.Event.ReloadAll();cnt=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"))})}};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()};JCEC.prototype.CreateSectDialog=function(){var e=BX.create("span",{html:EC_MESS.NewCalenTitle}),t=this;var i=new BX.PopupWindow("BXCSection"+this.id,null,{overlay:{opacity:10},autoHide:false,closeByEsc:true,zIndex:-100,offsetLeft:0,offsetTop:0,draggable:true,titleBar:{content:e},closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-tabed bxc-popup-window",buttons:[new BX.PopupWindowButton({text:EC_MESS.DelSect,id:this.id+"_bxec_cal_del_but",className:"bxec-popup-link-icon bxec-popup-del-ex",events:{click:function(){if(t.DeleteSection(i.CAL.oSect))t.CloseSectDialog(true)}}}),new BX.PopupWindowButton({text:EC_MESS.Save,className:"popup-window-button-accept",events:{click:function(){if(t.SaveSection()){t.CloseSectDialog(true)}}}}),new BX.PopupWindowButtonLink({text:EC_MESS.Close,className:"popup-window-button-link-cancel",events:{click:function(){t.CloseSectDialog(true)}}})],content:BX("bxec_sect_d_"+this.id),events:{}});BX.addCustomEvent(i,"onPopupClose",BX.proxy(this.CloseSectDialog,this));i.CAL={DOM:{Title:e,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")}};i.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")});i.CAL.ColorControl=this.InitColorDialogControl("sect",function(e,t){i.CAL.Color=e;i.CAL.TextColor=t});if(this.arConfig.bExchange&&this.Personal())i.CAL.DOM.Exch=BX(this.id+"_bxec_cal_exch");this.ChargePopupTabs(i,this.id+"sect-tab-");this.oSectDialog=i;if(this.bSuperpose&&this.Personal()){i.CAL.DOM.add2SPCont=BX(this.id+"_bxec_cal_add2sp_cont");i.CAL.DOM.add2SP=BX(this.id+"_bxec_cal_add2sp")}i.CAL.DOM.ExpAllow.onclick=function(){t._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";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="";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;var i=this;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=BX.create("span");var i=new BX.PopupWindow("BXCExportDialog"+this.id,null,{overlay:{opacity:10},autoHide:false,closeByEsc:true,zIndex:-100,offsetLeft:0,offsetTop:0,draggable:true,titleBar:{content:t},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(i,"onPopupClose",BX.proxy(this.CloseExportDialog,this));i.CAL={DOM:{Title:t,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")}};i.CAL.DOM.NoticeLink.onclick=function(){this.parentNode.className=""};this.oExportDialog=i};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:{content:BX.create("span",{html: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,s,a,l,r,c,d,C,p;BX.cleanNode(o.CAL.DOM.UserCntInner);BX.cleanNode(o.CAL.DOM.GroupCntInner);BX.cleanNode(o.CAL.DOM.CommonCnt);if(!this.arSPSections)this.arSPSections=[];for(a in e){l=e[a];if(!l.ID)return;if(l.CAL_TYPE=="user"){r=o.CAL.DOM.UserCntInner}else if(l.CAL_TYPE=="group"){r=o.CAL.DOM.GroupCntInner;o.CAL.DOM.GroupCnt.style.display="block"}else{r=o.CAL.DOM.CommonCnt;o.CAL.DOM.CommonCnt.style.display="block"}d=l.CAL_TYPE+l.OWNER_ID;if(!o.CAL.DOM.arCat[d]||!BX.isNodeInDom(o.CAL.DOM.arCat[d].pCat)){if(l.CAL_TYPE=="user"||l.CAL_TYPE=="group")C=l.OWNER_NAME;else C=l.TYPE_NAME;n=r.appendChild(BX.create("DIV",{props:{className:"bxc-spd-cat"}}));s=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(C)+"</span>"}));pCatSections=n.appendChild(BX.create("DIV",{props:{className:"bxc-spd-cat-sections"}}));s.onclick=function(){BX.toggleClass(this.parentNode,"bxc-spd-cat-collapsed")};if(l.CAL_TYPE=="user"&&l.OWNER_ID!=this.userId){s.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",l.OWNER_ID)}o.CAL.DOM.arCat[d]={pCat:n,pTitle:s,pSections:pCatSections}}p=this.id+"spd-sect"+l.ID;c=BX.create("DIV",{props:{className:"bxc-spd-sect-cont"}});pCh=c.appendChild(BX.create("SPAN",{props:{className:"bxc-spd-sect-check"}})).appendChild(BX.create("INPUT",{props:{type:"checkbox",id:p}}));pLabel=c.appendChild(BX.create("SPAN",{props:{className:"bxc-spd-sect-label"},html:'<label for="'+p+'"><span>'+BX.util.htmlspecialchars(l.NAME)+"</span></label>"}));o.CAL.DOM.arCat[d].pSections.appendChild(c);o.CAL.arSect[l.ID]={pCh:pCh,pItem:c,oSect:l};if(t){var a,u=false;for(a in this.arSPSections){if(this.arSPSections.hasOwnProperty(a)){if(this.arSPSections[a].CAL_TYPE==l.CAL_TYPE&&this.arSPSections[a].OWNER_ID==l.OWNER_ID){u=true;break}}}if(!u)this.arSPSections.push(l)}}};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 s=[];for(o in this.arSPSections){if(this.arSPSections.hasOwnProperty(o)){n=this.arSPSections[o];if(n.CAL_TYPE!="user"||n.OWNER_ID!=e)s.push(n)}}this.arSPSections=s;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,o=o=this.arSections.length;i<o;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,s;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)){s=t==n.ID;o=new Option(n.NAME,n.ID,s,s);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:{content:BX.create("span",{props:{className:"bxec-popup-title",id:this.id+"_viewev_title"},html:this.PERM.access?EC_MESS.Settings:EC_MESS.UserSettings})},closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-tabed bxc-popup-window",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")}};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.ShowBanner=BX(this.id+"_show_banner");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(){if(!this.oSetDialog)this.CreateSetDialog();var e=this.oSetDialog;e.show();this.SetPopupTab(0,e);if(e.CAL.inPersonal){e.CAL.DOM.SectSelect.options.length=0;var t,i=this.arSections.length,o,n,s=!this.userSettings.meetSection;e.CAL.DOM.SectSelect.options.add(new Option(" - "+EC_MESS.FirstInList+" - ",0,s,s));for(t=0;t<i;t++){n=this.arSections[t];if(n.CAL_TYPE=="user"&&n.OWNER_ID==this.userId){s=this.userSettings.meetSection==n.ID;o=new Option(n.NAME,n.ID,s,s);

o.style.backgroundColor=n.COLOR;e.CAL.DOM.SectSelect.options.add(o)}}e.CAL.DOM.Blink.checked=!!this.userSettings.blink;e.CAL.DOM.ShowBanner.checked=!!this.userSettings.showBanner;e.CAL.DOM.ShowDeclined.checked=!!this.userSettings.showDeclined}if(e.CAL.DOM.TimezoneSelect)e.CAL.DOM.TimezoneSelect.value=this.arConfig.userTimezoneName||"";e.CAL.DOM.ShowMuted.checked=!!this.userSettings.showMuted;if(this.PERM.access){e.CAL.Access.SetSelected(this.typeAccess);e.CAL.DOM.WorkTimeStart.value=this.settings.work_time_start;e.CAL.DOM.WorkTimeEnd.value=this.settings.work_time_end;for(var t=0,i=e.CAL.DOM.WeekHolidays.options.length;t<i;t++)e.CAL.DOM.WeekHolidays.options[t].selected=BX.util.in_array(e.CAL.DOM.WeekHolidays.options[t].value,this.settings.week_holidays);e.CAL.DOM.YearHolidays.value=this.settings.year_holidays;e.CAL.DOM.YearWorkdays.value=this.settings.year_workdays;e.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:{content:BX.create("span",{html:EC_MESS.CalDavDialogTitle})},closeIcon:{right:"12px",top:"10px"},className:"bxc-popup-window",buttons:[new BX.PopupWindowButton({text:EC_MESS.AddCalDav,className:"bxec-popup-link-icon bxec-popup-add-ex webform-small-button-transparent",events:{click:function(){var i=t.CAL.arConnections.length;t.CAL.arConnections.push({bNew:true,name:EC_MESS.NewExCalendar,link:"",user_name:""});e.ExD_DisplayConnection(t.CAL.arConnections[i],i);e.ExD_EditConnection(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.ExD_SaveConnectionData(t.CAL.curEditedConInd);e.arConnections=t.CAL.arConnections;t.CAL.bLockClosing=true;e.SaveConnections(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")}};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.ExD_DisplayConnection(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.ExD_DisplayConnection(e.CAL.arConnections[t],t);this.ExD_EditConnection(t)}else if(this.arConnections.length==1){this.ExD_EditConnection(0)}};JCEC.prototype.CloseExternalDialog=function(e){if(e===true)this.oExternalDialog.close()};JCEC.prototype.ExD_EditConnection=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.ExD_SaveConnectionData(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.ExD_SaveConnectionData(t.CAL.curEditedConInd);BX.removeClass(t.CAL.arConnections[t.CAL.curEditedConInd].pConDiv,"bxec-dav-item-edited")}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;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.ExD_DisplayConnection=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")}})),s=n.appendChild(BX.create("DIV",{props:{className:"bxec-dav-item-name"}})),a=s.appendChild(BX.create("IMG",{props:{src:"/bitrix/images/1.gif",className:"bxec-dav-item-status"}})),l=s.appendChild(BX.create("SPAN",{text:e.name})),r=s.appendChild(BX.create("SPAN",{text:""})),c=s.appendChild(BX.create("A",{props:{href:"javascript: void(0);",className:"bxec-dav-edit"},text:EC_MESS.CalDavEdit})),d=s.appendChild(BX.create("A",{props:{href:"javascript: void(0);",className:"bxec-dav-col"},text:EC_MESS.CalDavCollapse})),C=s.appendChild(BX.create("A",{props:{href:"javascript: void(0);",className:"bxec-dav-del"},text:EC_MESS.CalDavDel})),p=s.appendChild(BX.create("A",{props:{href:"javascript: void(0);",className:"bxec-dav-rest"},text:EC_MESS.CalDavRestore})),u=s.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})]})),h=u.appendChild(BX.create("INPUT",{props:{type:"checkbox",id:"bxec_dav_con_del_cal_"+t,checked:true}}));if(e.id>0){var D="bxec-dav-item-status",E;if(e.last_result.indexOf("[200]")>=0){D+=" bxec-dav-ok";E=EC_MESS.SyncOk+". "+EC_MESS.SyncDate+": "+e.sync_date}else{D+=" bxec-dav-error";E=EC_MESS.SyncError+": "+e.last_result+". "+EC_MESS.SyncDate+": "+e.sync_date}a.className=D;a.title=E;var v,A=this.arSections.length,f=0;for(v=0;v<A;v++)if(this.arSections[v]&&this.arSections[v].CAL_DAV_CON==e.id)f++;r.innerHTML=" ("+f+")"}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.ExD_EditConnection(t)};d.onclick=function(e){var t=parseInt(this.parentNode.parentNode.id.substr("bxec_dav_con_".length));if(o.CAL.arConnections[t]){i.ExD_SaveConnectionData(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.ExD_SaveConnectionData(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));if(o.CAL.arConnections[t]){for(var n in o.CAL.arConnections){if(o.CAL.arConnections[n]&&n!=t&&BX.hasClass(o.CAL.arConnections[n].pConDiv,"bxec-dav-item-edited")){if(o.CAL.DOM.EditConDiv.parentNode==o.CAL.arConnections[n].pConDiv)i.ExD_SaveConnectionData(n);BX.removeClass(o.CAL.arConnections[n].pConDiv,"bxec-dav-item-edited")}}var s=o.CAL.arConnections[t];BX.addClass(s.pConDiv,"bxec-dav-item-edited");s.pConDiv.appendChild(o.CAL.DOM.EditConDiv);i.oExternalDialog.curEditedConInd=true;o.CAL.DOM.EditName.value=s.name;o.CAL.DOM.EditLink.value=s.link;o.CAL.DOM.UserName.value=s.user_name;if(s.id>0)i.ExD_CheckPass();else o.CAL.DOM.Pass.value=""}return BX.PreventDefault(e)};e.pConDiv=n;e.pText=l;e.pDelCalendars=h};JCEC.prototype.ExD_SaveConnectionData=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.CreateMobileHelpDialog=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:{content:BX.create("span",{html:EC_MESS.MobileHelpTitle})},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.CloseMobileHelpDialog(true)}}})],content:BX("bxec_mobile_"+this.id)});BX.addCustomEvent(t,"onPopupClose",BX.proxy(this.CloseMobileHelpDialog,this));t.CAL={DOM:{iPhoneLink:BX("bxec_mob_link_iphone_"+this.id),macLink:BX("bxec_mob_link_mac_"+this.id),birdLink:BX("bxec_mob_link_bird_"+this.id),iPhoneAllCont:BX("bxec_mobile_iphone_all"+this.id),iPhoneOneCont:BX("bxec_mobile_iphone_one"+this.id),macCont:BX("bxec_mobile_mac_cont"+this.id),birdAllCont:BX("bxec_mobile_sunbird_all"+this.id),birdOneCont:BX("bxec_mobile_sunbird_one"+this.id)}};t.CAL.DOM.iPhoneLink.onclick=function(){if(t.CAL.calendarId=="all"){if(t.CAL.biPhoneAllOpened){t.CAL.DOM.iPhoneAllCont.style.display="none";BX.addClass(this,"bxec-link-hidden")}else{t.CAL.DOM.iPhoneAllCont.style.display="block";BX.removeClass(this,"bxec-link-hidden")}t.CAL.biPhoneAllOpened=!t.CAL.biPhoneAllOpened}else{if(t.CAL.biPhoneOneOpened){t.CAL.DOM.iPhoneOneCont.style.display="none";BX.addClass(this,"bxec-link-hidden")}else{t.CAL.DOM.iPhoneOneCont.style.display="block";BX.removeClass(this,"bxec-link-hidden")}t.CAL.biPhoneOneOpened=!t.CAL.biPhoneOneOpened}};t.CAL.DOM.macLink.onclick=function(){if(t.CAL.bMacOpened){t.CAL.DOM.macCont.style.display="none";BX.addClass(this,"bxec-link-hidden")}else{t.CAL.DOM.macCont.style.display="block";BX.removeClass(this,"bxec-link-hidden")}t.CAL.bMacOpened=!t.CAL.bMacOpened};t.CAL.DOM.birdLink.onclick=function(){if(t.CAL.calendarId=="all"){if(t.CAL.bbirdAllOpened){t.CAL.DOM.birdAllCont.style.display="none";BX.addClass(this,"bxec-link-hidden")}else{t.CAL.DOM.birdAllCont.style.display="block";BX.removeClass(this,"bxec-link-hidden")}t.CAL.bbirdAllOpened=!t.CAL.bbirdAllOpened}else{if(t.CAL.bbirdOneOpened){t.CAL.DOM.birdOneCont.style.display="none";BX.addClass(this,"bxec-link-hidden")}else{t.CAL.DOM.birdOneCont.style.display="block";BX.removeClass(this,"bxec-link-hidden")}t.CAL.bbirdOneOpened=!t.CAL.bbirdOneOpened}};this.oMobileDialog=t};JCEC.prototype.ShowMobileHelpDialog=function(e){if(!this.oMobileDialog)this.CreateMobileHelpDialog();var t=this.oMobileDialog;t.show();t.CAL.calendarId=e;t.CAL.DOM.iPhoneAllCont.style.display="none";t.CAL.DOM.iPhoneOneCont.style.display="none";t.CAL.DOM.birdAllCont.style.display="none";t.CAL.DOM.birdOneCont.style.display="none";t.CAL.DOM.macCont.style.display="none";BX.addClass(t.CAL.DOM.birdLink,"bxec-link-hidden");BX.addClass(t.CAL.DOM.iPhoneLink,"bxec-link-hidden");BX.addClass(t.CAL.DOM.macLink,"bxec-link-hidden");var i=[],o;if(e=="all"){i=i.concat(BX.findChildren(t.CAL.DOM.iPhoneAllCont,{tagName:"SPAN",className:"bxec-link"},true));i=i.concat(BX.findChildren(t.CAL.DOM.birdAllCont,{tagName:"SPAN",className:"bxec-link"},true));for(o=0;o<i.length;o++)if(i[o]&&i[o].nodeName)i[o].innerHTML=this.arConfig.caldav_link_all}else{i=i.concat(BX.findChildren(t.CAL.DOM.iPhoneOneCont,{tagName:"SPAN",className:"bxec-link"},true));i=i.concat(BX.findChildren(t.CAL.DOM.birdOneCont,{tagName:"SPAN",className:"bxec-link"},true));for(o=0;o<i.length;o++){if(i[o]&&i[o].nodeName){i[o].innerHTML=BX.util.htmlspecialchars(this.arConfig.caldav_link_one.replace("#CALENDAR_ID#",e))}}}i=BX.findChildren(t.CAL.DOM.macCont,{tagName:"SPAN",className:"bxec-link"},true);for(o=0;o<i.length;o++){if(i[o]&&i[o].nodeName){i[o].innerHTML=this.arConfig.caldav_link_all.replace(/^https?:\/\//gi,"")}}};JCEC.prototype.CloseMobileHelpDialog=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,n;for(var s in e.CAL.DOM.pTabs.childNodes){i=e.CAL.DOM.pTabs.childNodes[s];if(i.nodeType=="1"&&i.className&&i.className.indexOf("bxec-d-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(n&&t.CAL.activeTab!==e&&!n[e].bDisabled){for(i in n){o=n[i];if(!o||!o.cont)continue;if(i==e){o.cont.style.display="block";BX.addClass(o.tab,"bxec-d-tab-act")}else{o.cont.style.display="none";BX.removeClass(o.tab,"bxec-d-tab-act")}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"),s=BX(o+"-color-inp"),a=BX(o+"-text-color-inp");function l(e,o,n){if(!o||n&&(o=="#FFFFFF"||o=="#000000"))o=i.ColorIsDark(e)?"#FFFFFF":"#000000";try{s.value=e;s.style.backgroundColor=e;s.style.color=o}catch(a){e=this.arConfig.arCalColors[0];s.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])}};s.onblur=s.onkeyup=function(){l(this.value)};s.onclick=function(){i.ColorPicker.Open({pWnd:this,key:e,id:o+"-bg",onSelect:function(e){l(e,s.style.color,true)}})};a.onclick=function(){i.ColorPicker.Open({pWnd:this,key:e,id:o+"-text",onSelect:function(e){l(s.value,e,false)}})};return{Set:l}};
//# sourceMappingURL=cal-dialogs.map.js