%PDF- %PDF-
Direktori : /home/bitrix/www/bitrix/components/bitrix/calendar.livefeed.view/templates/.default/ |
Current File : /home/bitrix/www/bitrix/components/bitrix/calendar.livefeed.view/templates/.default/script.min.js |
(function(e){e.ViewEventManager=function(e){this.id=e.id;this.config=e;this.userId=BX.message("sonetLCurrentUserID");this.viewEventUrl=this.config.viewEventUrlTemplate;this.viewEventUrl=this.viewEventUrl.replace(/#user_id#/gi,this.userId);this.viewEventUrl=this.viewEventUrl.replace(/#event_id#/gi,this.config.eventId);if(this.config.EVENT.DATE_FROM&&this.config.EVENT.RRULE){this.viewEventUrl+="&EVENT_DATE="+BX.formatDate(BX.parseDate(this.config.EVENT.DATE_FROM),BX.message("FORMAT_DATE"))}BX.ready(BX.proxy(this.Init,this))};e.ViewEventManager.prototype={Init:function(){this.pViewIconLink=BX("feed-event-view-icon-link-"+this.id);this.pViewLink=BX("feed-event-view-link-"+this.id);this.pViewLink.href=this.pViewIconLink.href=this.viewEventUrl;this.pFrom=BX("feed-event-view-from-"+this.id);var e=this.config.EVENT;if(e.DATE_FROM&&e.DATE_TO){e.dateFrom=BX.parseDate(e.DATE_FROM);e.dateTo=BX.parseDate(e.DATE_TO);e.DT_FROM_TS=e.dateFrom.getTime();e.DT_TO_TS=e.dateTo.getTime();if(e.DT_SKIP_TIME!=="Y"){e.DT_FROM_TS-=e["~USER_OFFSET_FROM"]*1e3;e.DT_TO_TS-=e["~USER_OFFSET_TO"]*1e3}this.pFrom.innerHTML=this.GetFromHtml(e.DT_FROM_TS,e.DT_SKIP_TIME)}else{this.pFrom.innerHTML=this.GetFromHtml(BX.date.getBrowserTimestamp(e.DT_FROM_TS),e.DT_SKIP_TIME)}var t=BX("feed-event-tz-hint-"+this.id);if(t){new BX.CHint({parent:t,hint:t.getAttribute("data-bx-hint")})}this.InitPopups();var i=null;if(e.IS_MEETING&&this.config.attendees[this.userId]){i=this.config.attendees[this.userId].STATUS;this.ShowUserStatus(i);BX.viewElementBind("bx-feed-cal-view-files-"+this.id,{showTitle:true},function(e){return BX.type.isElementNode(e)&&(e.getAttribute("data-bx-viewer")||e.getAttribute("data-bx-image"))})}else{this.ShowUserStatus(false)}},InitPopups:function(){var e=this;var t=Math.round(Math.random()*1e5);this.pMoreAttLinkY=BX("feed-event-more-att-link-y-"+this.id);this.pMoreAttLinkN=BX("feed-event-more-att-link-n-"+this.id);this.pMoreAttPopupContY=BX("feed-event-more-attendees-y-"+this.id);this.pMoreAttPopupContN=BX("feed-event-more-attendees-n-"+this.id);if(this.pMoreAttLinkY&&this.pMoreAttPopupContY){this.pMoreAttLinkY.onclick=function(){if(e.popupNotifyMoreY){e.popupNotifyMoreY.destroy()}e.popupNotifyMoreY=new BX.PopupWindow("bx_event_attendees_window_y_"+e.id+"_"+t,e.pMoreAttLinkY,{zIndex:100,lightShadow:true,offsetTop:-2,offsetLeft:3,autoHide:true,closeByEsc:true,bindOptions:{position:"top"},content:e.pMoreAttPopupContY});e.popupNotifyMoreY.setAngle({});e.popupNotifyMoreY.show();e.pMoreAttPopupContY.style.display="block"}}if(this.pMoreAttLinkN&&this.pMoreAttPopupContN){this.pMoreAttLinkN.onclick=function(){if(e.popupNotifyMoreN){e.popupNotifyMoreN.destroy()}e.popupNotifyMoreN=new BX.PopupWindow("bx_event_attendees_window_n_"+e.id+"_"+t,e.pMoreAttLinkN,{zIndex:100,lightShadow:true,offsetTop:-2,offsetLeft:3,autoHide:true,closeByEsc:true,bindOptions:{position:"top"},content:e.pMoreAttPopupContN});e.popupNotifyMoreN.setAngle({});e.popupNotifyMoreN.show();e.pMoreAttPopupContN.style.display="block"}}},ShowAttendees:function(e,t,i){t.style.display=e.length>0?"":"none";if(!t||e.length<=0)return;var n=t.cells[1],o,s=0,p,a=this.config.AVATAR_SIZE,r=e.length<=this.config.ATTENDEES_SHOWN_COUNT_MAX,d="",c="";for(o=0;o<e.length;o++){p=e[o];s++;if(!r&&s>this.config.ATTENDEES_SHOWN_COUNT){d+='<a href="'+p.URL+'" target="_blank" class="bxcal-att-popup-img bxcal-att-popup-att-full">'+'<span class="bxcal-att-popup-avatar">'+(p.AVATAR_SRC?'<img src="'+p.AVATAR_SRC+'" width="'+a+'" height="'+a+'" class="bxcal-att-popup-img-not-empty" />':"")+"</span>"+'<span class="bxcal-att-popup-name">'+BX.util.htmlspecialchars(p.DISPLAY_NAME)+"</span>"+"</a>"}else{c+='<a title="'+BX.util.htmlspecialchars(p.DISPLAY_NAME)+'" href="'+p.URL+'" target="_blank" class="bxcal-att-popup-img">'+'<span class="bxcal-att-popup-avatar">'+(p.AVATAR_SRC?'<img src="'+p.AVATAR_SRC+'" width="'+a+'" height="'+a+'" class="bxcal-att-popup-img-not-empty" />':"")+"</span>"+"</a>"}}n.innerHTML=c;if(!r&&i.MORE_MESSAGE){var l=i.prefix;n.appendChild(BX.create("SPAN",{props:{id:"feed-event-more-att-link-"+l+"-"+this.id,className:"bxcal-more-attendees"},text:i.MORE_MESSAGE}));n.appendChild(BX.create("DIV",{props:{id:"feed-event-more-attendees-"+l+"-"+this.id,className:"bxcal-more-attendees-popup"},style:{display:"none"},html:d}))}},ShowUserStatus:function(e){var t=this,i=BX("feed-event-invite-controls-"+this.id);if(e&&e!="H"){var n=Math.round(Math.random()*1e5);i.className="feed-cal-view-inv-controls"+" feed-cal-view-inv-controls-"+e.toLowerCase();if(e=="Y"){var o=BX("feed-event-stat-link-y-"+this.id);o.onclick=function(){if(!t.popupAccepted){t.popupAccepted=new BX.PopupWindow("bx_event_change_win_y_"+t.id+"_"+n,o,{zIndex:200,lightShadow:true,offsetTop:-5,offsetLeft:(o.offsetWidth||100)+10,autoHide:true,closeByEsc:true,bindOptions:{position:"top"},content:BX("feed-event-stat-link-popup-y-"+t.id)});t.popupAccepted.setAngle({})}t.popupAccepted.show()};if(t.config.EVENT.RRULE||t.config.EVENT.RECURRENCE_ID){BX("feed-rec-decline-"+this.id).style.display="block";BX("feed-event-decline-2-"+this.id).style.display="none";BX("feed-rec-decline-this-"+this.id).onclick=function(){t.Decline("this")};BX("feed-rec-decline-next-"+this.id).onclick=function(){t.Decline("next")};BX("feed-rec-decline-all-"+this.id).onclick=function(){t.Decline("all")}}else{BX("feed-event-decline-2-"+this.id).style.display="";BX("feed-event-decline-2-"+this.id).onclick=BX.proxy(this.Decline,this);BX("feed-rec-decline-"+this.id).style.display="none"}}else if(e=="N"){var s=BX("feed-event-stat-link-n-"+this.id);s.onclick=function(){if(!t.popupDeclined){t.popupDeclined=new BX.PopupWindow("bx_event_change_win_n_"+t.id+"_"+n,s,{zIndex:200,lightShadow:true,offsetTop:-5,offsetLeft:(s.offsetWidth||100)+10,autoHide:true,closeByEsc:true,bindOptions:{position:"top"},content:BX("feed-event-stat-link-popup-n-"+t.id)});t.popupDeclined.setAngle({})}t.popupDeclined.show()};BX("feed-event-accept-2-"+this.id).onclick=BX.proxy(this.Accept,this)}else{BX("feed-event-accept-"+this.id).onclick=BX.proxy(this.Accept,this);BX("feed-event-decline-"+this.id).onclick=BX.proxy(this.Decline,this)}}else{i.style.display="none"}},SetStatus:function(t,i){var n=this;if(this.popupDeclined)this.popupDeclined.close();if(this.popupAccepted)this.popupAccepted.close();BX.ajax.get(this.config.actionUrl,{event_feed_action:t,sessid:BX.bitrix_sessid(),event_id:this.config.eventId,parent_id:this.config.EVENT.PARENT_ID||false,ajax_params:this.config.AJAX_PARAMS,reccurent_mode:i||false,current_date_from:this.config.EVENT.DATE_FROM},function(i){setTimeout(function(){if(i.indexOf("#EVENT_FEED_RESULT_OK#")!==-1&&n.config.EVENT.IS_MEETING){n.ShowUserStatus(t=="accept"?"Y":"N");if(e.ViewEventManager.requestResult){n.ShowAttendees(e.ViewEventManager.requestResult["ACCEPTED_ATTENDEES"],BX("feed-event-accepted-row-"+n.id),e.ViewEventManager.requestResult["ACCEPTED_PARAMS"]);n.ShowAttendees(e.ViewEventManager.requestResult["DECLINED_ATTENDEES"],BX("feed-event-declined-row-"+n.id),e.ViewEventManager.requestResult["DECLIINED_PARAMS"])}n.InitPopups()}},150)})},Accept:function(){return this.SetStatus("accept")},Decline:function(e){return this.SetStatus("decline",e)},DeleteEvent:function(){if(!this.config.eventId||!confirm(this.config.EC_JS_DEL_EVENT_CONFIRM))return false;BX.ajax.get(this.config.actionUrl,{event_feed_action:"delete_event",sessid:BX.bitrix_sessid(),event_id:this.config.eventId},function(e){if(e.indexOf("#EVENT_FEED_RESULT_OK#")!==-1)BX.reload()})},GetFromHtml:function(e,t){var i=new Date(e),n=BX.date.convertBitrixFormat(BX.message("FORMAT_DATE")),o=BX.message("FORMAT_DATETIME"),s=BX.util.trim(o.replace(BX.message("FORMAT_DATE"),"")),p;if(s==n)o="HH:MI";else o=s.replace(/:SS/gi,"");o=BX.date.convertBitrixFormat(o);if(t=="Y"){p=BX.date.format([["today","today"],["tommorow","tommorow"],["yesterday","yesterday"],["",n]],i)}else{p=BX.date.format([["today","today"],["tommorow","tommorow"],["yesterday","yesterday"],["",n]],i);p+=", "+BX.date.format(o,i)}return p}}})(window);