Your IP : 3.147.58.83
(function(e){e.JSECEvent=function(e){this.oEC=e};JSECEvent.prototype={Get:function(e){for(i=0,l=this.oEC.arEvents.length;i<l;i++)if(this.oEC.arEvents[i].ID==e)return this.oEC.arEvents[i]},IsMeeting:function(e){return this.oEC.allowMeetings&&e&&!!e.IS_MEETING},Attendees:function(e){var t={};if(e&&e.ID&&this.oEC.arAttendees[e.ID])t=this.oEC.arAttendees[e.ID];return t},View:function(t){if(t)this.oEC.HighlightEvent_M(t,false,true);this.oEC.DefaultAction();BX.onCustomEvent(this.oEC,"onBeforeCalendarEventView",[this.oEC,t]);if(this.oEC.DefaultAction()){if(t["~TYPE"]=="tasks"&&e.taskIFramePopup&&t.ID>0)taskIFramePopup.view(parseInt(t.ID));else this.oEC.ShowViewEventPopup(t);BX.onCustomEvent(this.oEC,"onAfterCalendarEventView",[this.oEC,t])}},Edit:function(t){if(t.oEvent)this.oEC.HighlightEvent_M(t.oEvent,false,true);this.oEC.DefaultAction();BX.onCustomEvent(this.oEC,"onBeforeCalendarEventEdit",[this.oEC,t]);if(this.oEC.DefaultAction()){if((!t.oEvent&&t.bTasks||t.oEvent&&t.oEvent["~TYPE"]=="tasks"&&t.oEvent.ID>0)&&e.taskIFramePopup){if(t.oEvent)taskIFramePopup.edit(parseInt(t.oEvent.ID));else taskIFramePopup.add()}else this.oEC.ShowEditEventPopup(t);BX.onCustomEvent(this.oEC,"onAfterCalendarEventView",[this.oEC,t])}},DeleteAllReccurent:function(e,t){if(this.IsRecursive(e)||e.RECURRENCE_ID){var i,s={},n,o=[];for(n=0;n<this.oEC.arEvents.length;n++){i=this.oEC.arEvents[n];if(i.ID!=e.ID&&i.RECURRENCE_ID!=e.ID&&i.ID!=e.RECURRENCE_ID&&(i.RECURRENCE_ID!=e.RECURRENCE_ID||!i.RECURRENCE_ID)){s[this.SmartId(i)]=true;o.push(i)}else{this.Blink(this.oEC.arEvents[n],false)}}this.oEC.arEvents=o;this.oEC.arLoadedEventsId=s}this.Display();return this.Delete(e,t,{recursionMode:"all"})},Delete:function(e,t,i){if(e)this.oEC.HighlightEvent_M(e,false,true);if(!i)i={};if(!e||!e.ID)return false;this.oEC.DefaultAction();BX.onCustomEvent(this.oEC,"onBeforeCalendarEventDelete",[this.oEC,e]);if(this.oEC.DefaultAction()){if(e["~TYPE"]=="tasks"){}else{if((this.IsRecursive(e)||e.RECURRENCE_ID)&&!t){this.oEC.ShowConfirmDeleteDialog(e);return false}else{t=!!t;if(this.IsAttendee(e)&&!this.IsHost(e)){t=true;if(!confirm(EC_MESS.DeclineConfirm))return false}if(this.IsHost(e)&&!t){t=true;if(!confirm(EC_MESS.DelMeetingConfirm))return false}if((!e.IS_MEETING||this.IsHost(e))&&!t){if(!confirm(EC_MESS.DelEventConfirm))return false}var s=this;if(this.IsAttendee(e)&&!this.IsHost(e)){return this.SetMeetingStatus(true,{eventId:bxInt(e.ID),comment:""})}else{this.oEC.Request({postData:this.oEC.GetReqData("delete",{id:bxInt(e.ID),name:e.NAME,calendar:bxInt(e.SECT_ID),rec_mode:i.recursionMode||false}),errorText:EC_MESS.DelEventError,handler:function(t){if(t){s.UnDisplay(e)}}})}BX.onCustomEvent(this.oEC,"onAfterCalendarEventDelete",[this.oEC])}}}return true},SetColor:function(e){var t,i=this,s=e.SECT_ID,n,o;function a(e){var t={};if(i.oEC.arSectionsInd[e]&&i.oEC.arSections[i.oEC.arSectionsInd[e]])t=i.oEC.arSections[i.oEC.arSectionsInd[e]];if(!t.TEXT_COLOR&&t.COLOR)t.TEXT_COLOR=i.oEC.ColorIsDark(t.COLOR)?"#FFFFFF":"#000000";return t}if(e["~TYPE"]=="tasks"){n=this.oEC.taskBgColor;o=this.oEC.taskTextColor}else{if(e.USER_MEETING&&!this.IsHost(e)){n=e.USER_MEETING.COLOR;o=e.USER_MEETING.TEXT_COLOR;if(!n)n=e.COLOR;if(!o)o=e.TEXT_COLOR;if(!n){t=a(s);if(t.COLOR){n=this.oEC.oSections[s].COLOR;o=this.oEC.oSections[s].TEXT_COLOR}}if((!n||!o)&&this.oEC.arSections.length){s=this.oEC.GetMeetingSection();t=a(s);if(s){if(!n&&t.COLOR)n=t.COLOR;if(!o&&t.TEXT_COLOR)o=t.TEXT_COLOR}}}else if(s){n=e.COLOR;o=e.TEXT_COLOR;t=a(s);if(!n&&t.COLOR)n=t.COLOR;if(!o&&t.TEXT_COLOR)o=t.TEXT_COLOR}}if(!n)n="#CEE669";e.displayColor=n;e.bDark=this.oEC.ColorIsDark(n);if(!o)o=e.bDark?"#FFFFFF":"#000000";e.displayTextColor=o;return e},SaveUserFields:function(e,t){if(e&&e.event_id&&t>0){e.event_id.value=parseInt(t);var i=this.oEC.GetReqData("").reqId;var s=this;if(e.reqId)e.reqId.value=i;BX.ajax.submit(e,function(){var e=top.BXCRES[i];if(e&&e["refresh"])s.ReloadAll(false)})}},GetQuestIcon:function(e){if(!this.IsBlinked(e))return"";return'<b title="'+EC_MESS.NotConfirmed+'" class="bxec-stat-q">?</b>'},IsTask:function(e){return e["~TYPE"]=="tasks"},IsHost:function(e,t){if(!t)t=this.oEC.userId;return e.IS_MEETING&&(e.MEETING_STATUS=="H"||e.ID==e.PARENT_ID&&t==e.MEETING_HOST)},IsAttendee:function(e,t){if(!t)t=this.oEC.userId;if(e.IS_MEETING){return true}return false},IsCrm:function(e){return e.UF_CRM_CAL_EVENT&&e.UF_CRM_CAL_EVENT!=""},IsBlinked:function(e){return e.IS_MEETING&&e.MEETING_STATUS=="Q"},IsRecursive:function(e){return!!e.RRULE},Blink:function(e,t,i){if(e&&e.display&&e.OWNER_ID==this.oEC.userId){if(i)t=this.IsBlinked(e);if(e._blinkInterval)e._blinkInterval=!!clearInterval(e._blinkInterval);if(t&&this.oEC.userSettings.blink){var s=this;e._blinkInterval=setInterval(function(){s.BlinkInterval(e)},600)}else if(!t){var n,o="bxec-event-blink";if(e.oParts){for(n=0;n<e.oParts.length;n++){if(e.oParts[n])BX.removeClass(e.oParts[n],o)}}if(e.oDaysT){if(e.oDaysT.week)BX.removeClass(e.oDaysT.week,o);if(e.oDaysT.day)BX.removeClass(e.oDaysT.day,o)}if(e.oTLParts){if(e.oTLParts.week){for(n=0;n<e.oTLParts.week.length;n++){if(e.oTLParts.week[n])BX.removeClass(e.oTLParts.week[n],o)}}if(e.oTLParts.day){for(n=0;n<e.oTLParts.day.length;n++){if(e.oTLParts.day[n])BX.removeClass(e.oTLParts.day[n],o)}}}}}},BlinkInterval:function(e){if(!this.oEC.userSettings.blink)return this.Blink(e,false,false);var t,i,s="bxec-event-blink",n=this.oEC.activeTabId;if(n=="month"){if(e.oParts){i=e.oParts.length;for(t=0;t<i;t++)if(e.oParts[t])BX.toggleClass(e.oParts[t],s)}}else{if(e.oDaysT&&e.oTLParts){if(e.oDaysT[n])BX.toggleClass(e.oDaysT[n],s);if(e.oTLParts[n]){i=e.oTLParts[n].length;for(t=0;t<i;t++)if(e.oTLParts[n][t])BX.toggleClass(e.oTLParts[n][t],s)}}}},SetMeetingStatus:function(e,t){var i={},s,n=t&&t.eventId?t.eventId:0;if(typeof t=="undefined")t={};if(!n&&this.oEC.oViewEventDialog){i=this.oEC.oViewEventDialog.CAL.oEvent;n=i.ID}s=parseInt(t.parentId||i.PARENT_ID);if(!t.eventId)t.eventId=n;if(!e&&!t.confirmed){if(this.IsRecursive(i)){this.oEC.ShowConfirmDeclineDialog(i);return false}else if(!confirm(EC_MESS.DeclineConfirm)){return false}}var o=this;this.oEC.Request({postData:this.oEC.GetReqData("set_meeting_status",{event_id:parseInt(t.eventId),parent_id:s,status:e?"Y":"N",reccurent_mode:t.reccurentMode||false,current_date_from:t.currentDateFrom||false}),handler:function(s){if(s){if(!o.oEC.userSettings.showDeclined&&!o.IsHost(i)&&!e&&!t.reccurentMode){o.UnDisplay(o.Get(t.eventId))}if(e||t.reccurentMode){o.ReloadAll(false)}}return true}});return true},SmartId:function(e){var t=e.PARENT_ID||e.ID;if(this.IsRecursive(e))t+="|"+e.DT_FROM_TS;if(e["~TYPE"]=="tasks")t+="|"+"task";return t},ReloadAll:function(e){if(this._reloadTimeout)clearTimeout(this._reloadTimeout);var t=this;this.oEC.arLoadedEventsId={};this.oEC.arLoadedParentId={};this.oEC.arLoadedMonth={};this.oEC.arEvents=[];this.oEC.SetTabNeedRefresh("month",true);this.oEC.SetTabNeedRefresh("week",true);this.oEC.SetTabNeedRefresh("day",true);if(e===false)this.oEC.LoadEvents();else this._reloadTimeout=setTimeout(function(){t.oEC.LoadEvents()},600)},Save:function(e){var t=parseInt(this.oEC.activeDate.month,10),i=this.oEC.activeDate.year;var s=this.oEC.GetReqData("edit_event",{id:e.id||0,name:e.name,desc:e.desc||"",date_from:e.date_from,date_to:e.date_to,default_tz:e.default_tz,sections:[e.calendar],location:e.location||{OLD:"",NEW:"",CHANGED:""},month:t+1,year:i,skip_time:e.skip_time||"N"});this.oEC.arLoadedMonth={};if(e.RRULE&&e.RRULE)s.rrule=e.RRULE;if(e.remind)s.remind=[{type:e.remind_type,count:e.remind_count}];if(this.oEC.allowMeetings){s.is_meeting=e.isMeeting||"";if(e.isMeeting){s.meeting=e.meeting||{};if(e.guests)s.guest=e.guests.length>0?e.guests:[0]}}s.color=e.color||"";s.text_color=e.text_color||"";if(e.accessibility)s.accessibility=e.accessibility;if(e.importance)s.importance=e.importance;if(e.private_event)s.private_event=e.private_event;var n=this;this.oEC.Request({postData:s,errorText:EC_MESS.EventSaveError,handler:function(s){if(s.id&&e.UFForm)n.SaveUserFields(e.UFForm,s.id);if(s.eventIds&&s.eventIds.length>0){for(var o=0;o<s.eventIds.length;o++){n.UnDisplay(s.eventIds[o],false)}}n.oEC.HandleEvents(s.events,s.attendees);n.oEC.arLoadedMonth[t+"."+i]=true;n.Display();return true}})},Display:function(){this.oEC.SetTabNeedRefresh(this.oEC.activeTabId);if(this.oEC.activeTabId=="month"){this.oEC.DisplayEventsMonth(true)}else{this.oEC.DeSelectTime(this.oEC.activeTabId);this.oEC.ReBuildEvents(this.oEC.activeTabId)}},UnDisplay:function(e,t){var i;if(typeof e=="object"&&e.ID)i=e.ID;else if(e>0)i=e;var s,n={},o,a=[];for(o=0;o<this.oEC.arEvents.length;o++){s=this.oEC.arEvents[o];if(s&&(s.ID!=i||s["~TYPE"]=="tasks")){n[this.SmartId(s)]=true;a.push(s)}else this.Blink(this.oEC.arEvents[o],false)}this.oEC.arEvents=a;this.oEC.arLoadedEventsId=n;if(t!==false)this.Display()},SetMeetingParams:function(e){var t=this.oEC.oEditEventDialog;var i=this.oEC.GetReqData("set_meeting_params",{event_id:t.CAL.oEvent.ID,accessibility:t.CAL.DOM.Accessibility.value});if(this.oEC.allowReminders&&t.CAL.DOM.RemCheck.checked){var s=t.CAL.DOM.RemCount.value||"";s=s.replace(/,/g,".");s=s.replace(/[^\d|\.]/g,"");i.remind=[{type:t.CAL.DOM.RemType.value,count:s}]}this.oEC.Request({postData:i,handler:function(e){t.CAL.oEvent.USER_MEETING.REMIND=i.remind||[];t.CAL.oEvent.USER_MEETING.ACCESSIBILITY=i.accessibility}});if(e.callback&&typeof e.callback=="function")e.callback()},CanDo:function(e,t,i){if(!e)return false;if(!i)i=this.oEC.userId;if(t=="edit"||t=="delete"){if(this.bReadOnly)return false;if(!e["IS_MEETING"]&&e.MEETING&&e.MEETING.ORGANIZER)return false;if(e.SECT_ID){var s=this.oEC.oSections[e.SECT_ID];if(s){if(s.SUPERPOSED&&(s.OWNER_ID!=this.oEC.ownerId||s.CAL_TYPE!=this.oEC.type)){return false}if(s.CAL_DAV_CAL&&s.CAL_DAV_CAL.indexOf("@virtual/events/")!==-1){return false}if(s.PERM)return!!s.PERM.edit}}}return false},BuildActions:function(e){var t,i=e.oEvent,s=i["~TYPE"]=="tasks",n=0,o=BX.create("DIV",{props:{className:"bxec-event-actions"}}),a=o.appendChild(BX.create("DIV",{props:{className:e.bTimeline?"bxec-icon-cont-tl":"bxec-icon-cont"}}));if((!this.IsMeeting(i)||this.IsMeeting(i)&&this.IsHost(i))&&(this.CanDo(i,"edit")||s&&i.CAN_EDIT)&&(!i.PRIVATE_EVENT||this.oEC.Personal())){t=a.appendChild(BX.create("I",{props:{className:"bxec-event-but bxec-ev-edit-icon",title:s?EC_MESS.TaskEdit:EC_MESS.EditEvent}}));t.setAttribute("data-bx-event-action","edit");n++;if(this.IsAttendee(i)&&!this.IsHost(i)){if(i.MEETING_STATUS!="N"){t=a.appendChild(BX.create("I",{props:{className:"bxec-event-but bxec-ev-del-icon",title:EC_MESS.DelEncounter}}));t.setAttribute("data-bx-event-action","del");n++}}else if(!s){t=a.appendChild(BX.create("I",{props:{className:"bxec-event-but bxec-ev-del-icon",title:EC_MESS.DelEvent}}));t.setAttribute("data-bx-event-action","del");n++}}if(n!=2){a.style.height="18px";a.style.width=18*n+"px";a.style.left="-"+18*n+"px"}e.cont.appendChild(o)},GetLabelStyle:function(e){var t="",i=e.IMPORTANCE;if(i&&i!="normal")t=' style="'+(i=="high"?"font-weight: bold;":"color: #535353;")+'"';return t},PreHandle:function(e){if(e.DATE_FROM&&e.DATE_TO){e.dateFrom=BX.parseDate(e.DATE_FROM);e.dateTo=BX.parseDate(e.DATE_TO);if(e.dateFrom&&e.dateTo){e.DT_FROM_TS=Math.floor(e.dateFrom.getTime()/1e3)*1e3;e.DT_TO_TS=Math.floor(e.dateTo.getTime()/1e3)*1e3;if(e.DT_SKIP_TIME!=="Y"){e.DT_FROM_TS-=(e["~USER_OFFSET_FROM"]||0)*1e3;e.DT_TO_TS-=(e["~USER_OFFSET_TO"]||0)*1e3}}}return e},CutOffRecursiveEvent:function(e,t){var i=this;var s=Math.floor(this.oEC.ParseDate(t).getTime()/1e3)*1e3;t=this.oEC.FormatDate(new Date(s-this.oEC.dayLength));if(e.RRULE){e.RRULE.UNTIL=t;e.RRULE["~UNTIL"]=t}var n,o={},a,r=[];if(this.IsRecursive(e)){for(a=0;a<this.oEC.arEvents.length;a++){n=this.oEC.arEvents[a];if(n&&(n.ID!==e.ID||n.DT_FROM_TS<s||n["~TYPE"]=="tasks")){o[this.SmartId(n)]=true;r.push(n)}else{this.Blink(this.oEC.arEvents[a],false)}}this.oEC.arEvents=r;this.oEC.arLoadedEventsId=o}else{for(a=0;a<this.oEC.arEvents.length;a++){n=this.oEC.arEvents[a];if(n&&(n.ID!==e.ID||n.DT_FROM_TS<s||n["~TYPE"]=="tasks")){o[this.SmartId(n)]=true;r.push(n)}else{this.Blink(this.oEC.arEvents[a],false)}}this.oEC.arEvents=r;this.oEC.arLoadedEventsId=o}this.oEC.Request({postData:this.oEC.GetReqData("change_recurcive_event_until",{event_id:parseInt(e.ID),until_date:t}),handler:function(){i.ReloadAll(false);return true}});this.Display()},ExcludeRecursionDate:function(e,t){var i=this;var s=Math.floor(this.oEC.ParseDate(t).getTime()/1e3)*1e3;var n,o={},a,r=[];for(a=0;a<this.oEC.arEvents.length;a++){n=this.oEC.arEvents[a];if(n&&(n.ID!==e.ID||n.DT_FROM_TS!=s||n["~TYPE"]=="tasks")){o[this.SmartId(n)]=true;r.push(n)}else{this.Blink(this.oEC.arEvents[a],false)}}this.oEC.arEvents=r;this.oEC.arLoadedEventsId=o;this.oEC.Request({postData:this.oEC.GetReqData("exclude_recursion_date",{event_id:parseInt(e.ID),exclude_date:t}),handler:function(){i.ReloadAll(false);return true}});this.Display()}}})(window);
//# sourceMappingURL=cal-events.map.js