Author: ralfbecker
New Revision: 55208
URL: http://svn.stylite.de/viewvc/egroupware?rev=55208&view=rev
Log:
fixing scope of “use strict”, so we do not need to remove it when concatinating our scripts like we do now with minjs, also enabled “use strict” for calendar/js/app.js and fixed a reference error found by it
Added:
trunk/calendar/js/app.min.js (with props)
trunk/calendar/js/app.min.js.map
Modified:
trunk/calendar/js/app.js
trunk/calendar/js/et2_widget_daycol.js
trunk/calendar/js/et2_widget_event.js
trunk/calendar/js/et2_widget_owner.js
trunk/calendar/js/et2_widget_planner.js
trunk/calendar/js/et2_widget_planner_row.js
trunk/calendar/js/et2_widget_timegrid.js
trunk/calendar/js/et2_widget_view.js
— trunk/calendar/js/app.js (original)
+++ trunk/calendar/js/app.js Tue Mar 1 17:27:45 2016
@@ -40,7 +40,7 @@
*
-
@augments AppJS
/
-app.classes.calendar = AppJS.extend(
+app.classes.calendar = (function(){ “use strict”; return AppJS.extend(
{
/*
- application name
@@ -2060,7 +2060,7 @@
// caching keys, otherwise they’ll fetch & cache consolidated
if(state.state.view == ‘day’ && state.state.owner.length < parseInt(this.egw.preference(‘day_consolidate’,‘calendar’)))
{
@@ -2748,7 +2748,7 @@
this._queries_in_progress.splice(idx,1);
}
//console.log(data);
@@ -3501,7 +3501,7 @@
return d;
}
}
-});
+});}).call(this);
jQuery.extend(app.classes.calendar,{
— trunk/calendar/js/app.min.js (added)
+++ trunk/calendar/js/app.min.js Tue Mar 1 17:27:45 2016
@@ -1,0 +1,9 @@
+/! build Tue Mar 01 2016 17:22:26 /
+
+function et2_event_action_object_impl(widget,node){var aoi=new et2_action_object_impl(widget,node);return aoi.doSetState=function(_state,_outerCall){},aoi}var et2_calendar_owner=function(){“use strict”;return et2_taglist_email.extend({attributes:{autocomplete_url:{default:“calendar_owner_etemplate_widget::ajax_owner”},autocomplete_params:{name:“Autocomplete parameters”,type:“any”,default:{},description:“Extra parameters passed to autocomplete URL. It should be a stringified JSON object.”},allowFreeEntries:{default:!1,ignore:!0},select_options:{type:“any”,name:“Select options”,default:{},description:“Internally used to hold the select options.”}},lib_options:{autoSelect:!1,groupBy:“app”,minChars:2,selectFirst:!0,toggleOnClick:!0},doLoadingFinished:function(){this._super.apply(this,arguments);var widget=this;return this._oldValue=this.taglist.getValue(),this.$taglist.on(“focus”,function(){widget.taglist.expand()}).on(“load expand”,function(){window.setTimeout(function(){widget&&widge
t.div&&widget.div.find(".ms-res-item-active").removeClass(“ms-res-item-active”)},1)}),!0},getValue:function(){return null==this.taglist?null:this.taglist.getValue()}})}.call(this);et2_register_widget(et2_calendar_owner,[“calendar-owner”]);var et2_calendar_view=function(){“use strict”;return et2_valueWidget.extend({createNamespace:!0,attributes:{owner:{name:“Owner”,type:“any”,default:[egw.user(“account_id”)],description:“Account ID number of the calendar owner, if not the current user”},start_date:{name:“Start date”,type:“any”},end_date:{name:“End date”,type:“any”}},init:function(){this._super.apply(this,arguments),this.date_helper=et2_createWidget(“date-time”,{},null),this.date_helper.loadingFinished(),this.loader=$j(’’),this.update_timer=null},destroy:function(){this._super.apply(this,arguments),this.date_helper.destroy(),this.date_helper=null,this.update_timer&&window.clearTimeout(this.update_timer)},doLoadingFinishe
d:function(){this.super.apply(this,arguments),this.loader.hide(0).prependTo(this.div),this.options.owner&&this.set_owner(this.options.owner)},invalidate:function(trigger_event){},get_start_date:function(){return new Date(this.options.start_date)},get_end_date:function(){return new Date(this.options.end_date)},set_start_date:function(new_date){new_date&&null!==new_date||(new_date=new Date),“object”==typeof new_date||“string”==typeof new_date&&new_date.length>8?this.date_helper.set_value(new_date):“string”==typeof new_date&&(this.date_helper.set_year(new_date.substring(0,4)),this.date_helper.set_month(new_date.substring(4,6)),this.date_helper.set_date(new_date.substring(6,8)));var old_date=this.options.start_date;this.options.start_date=new Date(this.date_helper.getValue()),old_date!==this.options.start_date&&this.isAttached()&&this.invalidate(!0)},set_end_date:function(new_date){new_date&&null!==new_date||(new_date=new Date),“object”==typeof new_date||“string”==typeof new_date&&new
date.length>8?this.date_helper.set_value(new_date):“string”==typeof new_date&&(this.date_helper.set_year(new_date.substring(0,4)),this.date_helper.set_month(new_date.substring(4,6)),this.date_helper.set_date(new_date.substring(6,8)));var old_date=this.options.end_date;this.options.end_date=new Date(this.date_helper.getValue()),old_date!==this.options.end_date&&this.isAttached()&&this.invalidate(!0)},set_owner:function(_owner){var old=this.options.owner;“0”==_owner&&(_owner=[egw.user(“account_id”)]),_owner=jQuery.isArray(_owner)?jQuery.extend([],_owner):“string”==typeof _owner?_owner.split(","):[_owner],this.options.owner=_owner,old!==this.options.owner&&this.isAttached()&&this.invalidate(!0)},set_value:function(events){return"object"!=typeof events?!1:((events.length&&events.length>0||!jQuery.isEmptyObject(events))&&this.set_disabled(!1),events.id&&(this.set_id(events.id),delete events.id),events.start_date&&(this.set_start_date(events.start_date),delete events.start_date),events.en
d_date&&(this.set_end_date(events.end_date),delete events.end_date),events.owner&&(this.set_owner(events.owner),delete events.owner),this.value=events||{},void(this.update_timer||window.setTimeout(jQuery.proxy(function(){this.loader.hide()},this),100)))},get_owner_name:function(user){if(0===parseInt(user)&&(user=egw.user(“account_id”)),isNaN(user)){var application=“home-accounts”;switch(user[0]){case"c":application=“addressbook”;break;case"r":application=“resources”}user=egw.link_title(application,user.match(/\d+/)[0],function(){},this)}else{user=parseInt(user);for(var accounts=egw.accounts(“both”),j=0;j<accounts.length;j++)if(accounts[j].value===user){user=accounts[j].label;break}}return user},get_event_info:function(dom_node){var event_node=$j(dom_node).closest("[data-id]",this.div)[0],day_node=$j(event_node).closest("[data-date]",this.div)[0],result=jQuery.extend({event_node:event_node,day_node:day_node},event_node?event_node.dataset:{},day_node?day_node.dataset:{});if(event_no
de&&event_node.id){var widget_id=event_node.id||"";widget_id=widget_id.split("event"),widget_id.shift(),result.widget_id="event"+widget_id.join("")}return result}})}.call(this);jQuery.extend(et2_calendar_view,{is_consolidated:function(owners,view){return!(owners.length>1&&(“day”===view&&owners.length<parseInt(egw.preference(“day_consolidate”,“calendar”))||“week”===view&&owners.length<parseInt(egw.preference(“week_consolidate”,“calendar”))))},holiday_cache:{},get_holidays:function(widget,year){if(!egw.window.et2_calendar_view)return{};var cache=egw.window.et2_calendar_view.holiday_cache[year];return"undefined"==typeof cache&&(egw.window.et2_calendar_view.holiday_cache[year]=egw.json(“calendar_timegrid_etemplate_widget::ajax_get_holidays”,[year]).sendRequest(!0)),cache=egw.window.et2_calendar_view.holiday_cache[year],“function”==typeof cache.done?(cache.done(jQuery.proxy(function(response){egw.window.et2_calendar_view.holiday_cache[this.year]=response.response[0].data||void 0,egw.wi
ndow.setTimeout(jQuery.proxy(function(){“undefined”==typeof this.widget.free&&this.widget.day_class_holiday()},this),1)},{widget:widget,year:year})),{}):cache}});var et2_calendar_event=function(){“use strict”;return et2_valueWidget.extend([et2_IDetachedDOM],{attributes:{value:{type:“any”,default:et2_no_init},onclick:{description:“JS code which is executed when the element is clicked. If no handler is provided, or the handler returns true and the event is not read-only, the event will be opened according to calendar settings.”}},init:function(){this._super.apply(this,arguments);var event=this;this.div=$j(document.createElement(“div”)).addClass(“calendar_calEvent”).addClass(this.options.class).css(“width”,this.options.width).on(“mouseenter”,function(){return event._tooltipElem?void window.setTimeout(function(){$j(“body .egw_tooltip”).css(“border”,“none”).on(“mouseenter”,function(){event.div.off(“mouseleave.tooltip”),$j(“body.egw_tooltip”).remove(),$j(“body”).append(this),$j(this).stop
(!0).fadeTo(400,1).on(“mouseleave”,function(){$j(this).fadeOut(“400”,function(){$j(this).remove(),event.set_statustext(event._tooltip())})})})},105):(event.set_statustext(event._tooltip()),event.div.trigger(“mouseenter”))}),this.title=$j(document.createElement(“div”)).addClass(“calendar_calEventHeader”).appendTo(this.div),this.body=$j(document.createElement(“div”)).addClass(“calendar_calEventBody”).appendTo(this.div),this.icons=$j(document.createElement(“div”)).addClass(“calendar_calEventIcons”).appendTo(this.title),this.setDOMNode(this.div[0])},doLoadingFinished:function(){return this._super.apply(this,arguments),this.options.value&&this.options.value.row_id&&egw.dataRegisterUID(“calendar::”+this.options.value.row_id,this._UID_callback,this,this.getInstanceManager().execId,this.id),!0},destroy:function(){if(this._super.apply(this,arguments),this._actionObject&&(this._actionObject.remove(),this._actionObject=null),this.div.off(),this.title.remove(),this.title=null,this.body.remove()
,this.body=null,this.icons=null,this.div.remove(),this.div=null,$j(“body.egw_tooltip”).remove(),this.options.value){var old_app_id=this.options.value.row_id;egw.dataUnregisterUID(“calendar::”+old_app_id,!1,this)}},set_value:function(_value){if(this.options.value){var old_id=this.options.value.row_id;_value&&_value.row_id&&old_id===_value.row_id||egw.dataUnregisterUID(“calendar::”+old_id,!1,this)}this.options.value=_value;var id=this.options.value.row_id;old_id&&old_id===id||egw.dataRegisterUID(“calendar::”+id,this._UID_callback,this,this.getInstanceManager().execId,this.id),_value&&!egw.dataHasUID(“calendar::”+id)&&egw.dataStoreUID(“calendar::”+id,_value)},_UID_callback:function(event){return event&&this._values_check(event),this._sameday_check(event)?(this.options.value=jQuery.extend({},event),this._parent.options.date&&(this.options.value.date=this._parent.options.date),this._parent.position_event(this),void(this._parent&&this._update())):void this.free()},update:function(){var e
vent=this.options.value,id=event.row_id?event.row_id:event.id+(event.recur_type?":"+event.recur_date:""),formatted_start=event.start.toJSON();this.set_id("event"+id),this._actionObject&&(this._actionObject.id=“calendar::”+id);for(var action_parent=this;null!=action_parent&&!action_parent.options.actions&&!action_parent.instanceOf(et2_container);)action_parent=action_parent.getParent();try{this._link_actions(action_parent.options.actions||{})}catch(e){}var im=this.getInstanceManager();et2_selectbox.cat_options({type:“select-cat”,getInstanceManager:function(){return im}},{application:event.app||“calendar”}),egw.includeCSS("/phpgwapi/categories.php?app="+event.app),this.div.has(this.title).length||this.div.empty().append(this.title).append(this.body),this.div.droppable(“option”,“greedy”,!1).attr(“data-full_day”,event.whole_day).attr(“data-id”,event.id).attr(“data-app”,event.app||“calendar”).attr(“data-app_id”,event.app_id).attr(“data-start”,formatted_start).attr(“data-owner”,event.ow
ner).attr(“data-recur_type”,event.recur_type).attr(“data-resize”,event.whole_day?“WD”:""+(event.recur_type?“S”:"")).removeClass(function(index,css){return(css.match(/(^|\s)cat\S+/g)||[]).join(" “)}).removeClass(function(index,css){return(css.match(/calendar_calEvent\S+/g)||[]).join(” “)}).removeClass(“calendar_calEventSmall”).addClass(event.class).toggleClass(“calendar_calEventPrivate”,“undefined”!=typeof event.private&&event.private),this.options.class=event.class;var status_class=this.status_class();if(event.category&&“0”!=event.category)for(var cats=event.category.split(","),i=0;i<cats.length;i++)this.div.addClass("cat”+cats[i]);this.div.toggleClass(“calendar_calEventUnknown”,event.participants[egw.user(“account_id”)]?“U”===event.participants[egw.user(“account_id”)][0]:!1),this.div.addClass(status_class),this.title.toggle(!event.whole_day_on_top),this.body.toggleClass(“calendar_calEventBodySmall”,event.whole_day_on_top||!1);var title=event.is_private?egw.lang(“private”):event.
title;if(this.title.html(’’+this._get_timespan(event)+"
").append(’’+title+""),jQuery.Color(“rgba(0,0,0,0)”).toRgbaString()!=jQuery.Color(this.div,“background-color”).toRgbaString()&&this.div.css(“border-color”,“calendar_calEventAllAccepted”===status_class?this.div.css(“background-color”):""),this.icons.appendTo(this.title).html(this._icons()),event.whole_day_on_top)this.body.html(title);else{var start_time=jQuery.datepicker.formatTime(“12”===egw.preference(“timeformat”)?“h:mmtt”:“HH:mm”,{hour:event.start_m/60,minute:event.start_m%60,seconds:0,timezone:0},{ampm:“12”===egw.preference(“timeformat”)}).trim();this.body.html(’’+title+"").append(’’+start_time+""),this.options.value.description.trim()&&this.body.append(""+this.options.value.description+"
")}this.set_statustext(""),this._parent.div.is(":visible
")&&this._small_size()},_small_size:function(){if(!this.options.value.whole_day_on_top){this.div.removeClass(“calendar_calEventSmall”),this.body.css(“height”,“auto”);var line_height=parseFloat(this.div.css(“line-height”)),visible_lines=Math.floor(this.div.innerHeight()/line_height);this.title.height()||(visible_lines=Math.floor(egw.getHiddenDimensions(this.div).h/egw.getHiddenDimensions(this.title).h)),visible_lines=Math.max(1,visible_lines),this.div.toggleClass(“calendar_calEventSmall”,4>visible_lines),this.div.attr(“data-visible_lines”,visible_lines),this.body.height()>this.div.height()-this.title.height()&&visible_lines>=4?this.body.css(“height”,Math.floor((visible_lines-1)line_height-this.title.height())+“px”):this.body.css(“height”,"")}},_status_class:function(){var status_class=“calendar_calEventAllAccepted”;for(var id in this.options.value.participants){var status=this.options.value.participants[id];switch(status=et2_calendar_event.split_status(status)){case"A":case"":break;
case"U":return status_class=“calendar_calEventSomeUnknown”;default:status_class=“calendar_calEventAllAnswered”}}return status_class},_tooltip:function(){if(!this.div)return"";var border=this.div.css(“borderTopColor”),bg_color=this.div.css(“background-color”),header_color=this.title.css(“color”),timespan=this._get_timespan(this.options.value);this._parent.date_helper.set_value(this.options.value.start.valueOf?new Date(this.options.value.start):this.options.value.start);var start=this._parent.date_helper.input_date.val();this._parent.date_helper.set_value(this.options.value.end.valueOf?new Date(this.options.value.end):this.options.value.end);var end=this._parent.date_helper.input_date.val(),times=this.options.value.multiday?’’+this.egw().lang(“Start”)+":"+start+’’+this.egw().lang(“End”)+":"+end:’’+this.egw().lang(“Time”)+":"+timespan,cat_label="";if(this.
options.value.category){var cat=et2_createWidget(“select-cat”,{readonly:!0},this);cat.set_value(this.options.value.category),cat_label=this.options.value.category.indexOf(",")<=0?cat.span.text():[],“string”!=typeof cat_label&&(cat.span.children().each(function(){cat_label.push($j(this).text())}),cat_label=cat_label.join(", “)),cat.destroy()}return’<div class=“calendar_calEventTooltip ‘+this._status_class()+’” style=“border-color: '+border+”; background-color: “+bg_color+’;”>’+timespan+”"+this.icons[0].outerHTML+’
’+this.options.value.title+"
"+this.options.value.description+’
’+times+"
"+(this.options.value.location?’
’+this.egw().lang(“Location”)+":"+this.options.value.location+"
":"")+(cat_label?’
’+this.egw().lang(“Category”)+":"+cat_label+"
":"")+’
’+this.egw().lang(“Participants”)+":
"+(this.options.value.parts?this.options.value.parts.replace("\n","
"):"")+"
"},_icons:function(){var icons=[];if(this.options.value.is_private)icons.push(’<img src="’+this.egw().image(“private”,“calendar”)+’"/>’);else{“calendar”!==this.options.value.app&&icons.push(’<img src="’+this.egw().image(“navbar”,this.options.value.app)+’" title="’+this.egw().lang(this.options.value.app)+’"/>’),3==this.options.value.priority&&icons.push(’<img src="’+this.egw().image(“high”,“calendar”)+’" title="’+this.egw().lang(“high priority”)+’"/>’),“0”==this.options.value.public&&icons.push(’<img src="’+this.egw().image(“private”,“calendar”)+’"/>’),this.options.value.recur_type&&icons.push(’<img src="’+this.egw().image(“recur”,“calendar”)+’" title="’+this.egw().lang(“recurring event”)+’"/>’);var single=’<
img src="’+this.egw().image(“single”,“calendar”)+’" title=""/>’,multiple=’<img src="’+this.egw().image(“users”,“calendar”)+’" title=""/>’;for(var uid in this.options.value.participants){if(1==Object.keys(this.options.value.participants).length&&!isNaN(uid)){icons.push(single);break}isNaN(uid)||-1!==icons.indexOf(multiple)||icons.push(multiple)}this.options.value.non_blocking&&icons.push(’<img src="’+this.egw().image(“nonblocking”,“calendar”)+’" title="’+this.egw().lang(“non blocking”)+’"/>’),!this.options.value.alarm||jQuery.isEmptyObject(this.options.value.alarm)||this.options.value.is_private||icons.push(’<img src="’+this.egw().image(“alarm”,“calendar”)+’" title="’+this.egw().lang(“alarm”)+’"/>’),this.options.value.participants[egw.user(“account_id”)]&&“U”==this.options.value.participants[egw.user(“account_id”)][0]&&icons.push(’<img src="’+this.egw().image(“needs-action”,“calendar”)+’" title="’+this.egw().lang(“Needs action”)+’"/>’)}return icons},_get_timespan:function(event){var
timespan="";if(0===event.start_m&&event.end_m>=1439)timespan=event.end_m>1440?jQuery.datepicker.formatTime(“12”===egw.preference(“timeformat”)?“h:mmtt”:“HH:mm”,{hour:event.start_m/60,minute:event.start_m%60,seconds:0,timezone:0},{ampm:“12”===egw.preference(“timeformat”)}).trim()+" - “+jQuery.datepicker.formatTime(“12”===egw.preference(“timeformat”)?“h:mmtt”:“HH:mm”,{hour:event.end_m/60,minute:event.end_m%60,seconds:0,timezone:0},{ampm:“12”===egw.preference(“timeformat”)}).trim():egw.lang(“Whole day”);else{var duration=event.multiday?(event.end-event.start)/6e4:event.end_m-event.start_m;1439===event.end_m&&++duration,duration=Math.floor(duration/60)+this.egw().lang(“h”)+(duration%60?duration%60:”"),timespan=jQuery.datepicker.formatTime(“12”===egw.preference(“timeformat”)?“h:mmtt”:“HH:mm”,{hour:event.start_m/60,minute:event.start_m%60,seconds:0,timezone:0},{ampm:“12”===egw.preference(“timeformat”)}).trim(),timespan+=" “+duration}return timespan},_values_check:function(event){event.id&
&(event.id=”"+event.id),“object”!=typeof event.start&&(this._parent.date_helper.set_value(event.start),event.start=new Date(this._parent.date_helper.getValue())),“object”!=typeof event.end&&(this._parent.date_helper.set_value(event.end),event.end=new Date(this._parent.date_helper.getValue())),“undefined”==typeof event.start_m&&(event.start_m=60event.start.getUTCHours()+event.start.getUTCMinutes(),event.end_m=60event.end.getUTCHours()+event.end.getUTCMinutes()),“undefined”==typeof event.multiday&&(event.multiday=event.start.getUTCFullYear()!==event.end.getUTCFullYear()||event.start.getUTCMonth()!==event.end.getUTCMonth()||event.start.getUTCDate()!=event.end.getUTCDate()),event.start.getUTCHours()||event.start.getUTCMinutes()||23!=event.end.getUTCHours()||59!=event.end.getUTCMinutes()||(event.whole_day_on_top=event.non_blocking&&“0”!=event.non_blocking)},_sameday_check:function(event){if(!this._parent||null===event)return!1;var owner_match=!0;if(event.participants&&this._parent.opti
ons.owner){var parent_owner=“object”!=typeof this._parent.options.owner?[this._parent.options.owner]:this._parent.options.owner;owner_match=!1;for(var length=parent_owner.length,i=0;length>i;i++)parseInt(parent_owner[i])<0&&egw.accountData(parent_owner[i],“account_id”,!0,function(members){parent_owner=parent_owner.concat(Object.keys(members))});for(var id in event.participants)if(this._parent.options.owner==id||parent_owner.indexOf&&parent_owner.indexOf(id)>=0){owner_match=!0;break}owner_match||(owner_match=this._parent.options.owner==event.owner||parent_owner.indexOf&&parent_owner.indexOf(event.owner)>=0)}if(owner_match&&this.options.value.date&&event.date==this.options.value.date)return!0;var event_start=new Date(event.start),event_end=new Date(event.end);if(owner_match&&this._parent.date>=event_start&&this._parent.date<=event_end)return!0;this._actionObject&&(this._actionObject.clear(),this._actionObject.unregisterActions(),this._actionObject=null);var new_cache_id=app.classes.ca
lendar._daywise_cache_id(event.date,this._parent.options.owner),new_daywise=egw.dataGetUIDdata(new_cache_id);new_daywise=new_daywise&&new_daywise.data?new_daywise.data:[];var old_cache_id=!1;if(this.options.value&&this.options.value.date&&(old_cache_id=app.classes.calendar._daywise_cache_id(this.options.value.date,this._parent.options.owner)),new_cache_id!=old_cache_id){var old_daywise=egw.dataGetUIDdata(old_cache_id);old_daywise=old_daywise&&old_daywise.data?old_daywise.data:[],old_daywise.splice(old_daywise.indexOf(this.options.value.id),1),egw.dataStoreUID(old_cache_id,old_daywise),new_daywise.indexOf(event.id)<0&&new_daywise.push(event.id),null!==new_daywise.data&&egw.dataStoreUID(new_cache_id,new_daywise)}return!1},attachToDOM:function(){this._super.apply(this,arguments),this.onclick||$j(this.node).off(“click”)},click:function(_ev){var result=!0;if(“function”==typeof this.onclick){var args=Array.prototype.slice.call(arguments);-1==args.indexOf(this)&&args.splice(1,0,this),resul
t=this.onclick.apply(this,args)}return result},recur_prompt:function(callback,extra_data){et2_calendar_event.recur_prompt(this.options.value,callback,extra_data)},series_split_prompt:function(callback){et2_calendar_event.series_split_prompt(this.options.value,this.options.value.recur_date,callback)},_link_actions:function(actions){if(!this._actionObject){var objectManager=this.getParent().getParent()._actionObject||egw_getAppObjectManager(!0).getObjectById(this._parent._parent._parent.id)||egw_getAppObjectManager(!0);this._actionObject=objectManager.getObjectById(“calendar::”+this.options.value.row_id)}null==this._actionObject?this._actionObject=objectManager.insertObject(!1,new egwActionObject(“calendar::”+this.options.value.row_id,objectManager,new et2_event_action_object_impl(this,this.getDOMNode()),this._actionManager||objectManager.manager.getActionById(“calendar::”+this.options.value.row_id)||objectManager.manager)):this._actionObject.setAOI(new et2_event_action_object_impl(th
is,this.getDOMNode())),this._actionObject.clear(),this._actionObject.unregisterActions();var action_links=this._get_action_links(actions);action_links.push(“egw_link_drag”),action_links.push(“egw_link_drop”),this._actionObject.updateActionLinks(action_links)},getDetachedAttributes:function(_attrs){},getDetachedNodes:function(){return[this.getDOMNode()]},setDetachedAttributes:function(_nodes,_values){}})}.call(this);et2_register_widget(et2_calendar_event,[“calendar-event”]),et2_calendar_event.recur_prompt=function(event_data,callback,extra_data){var edit_id=event_data.app_id,edit_date=event_data.start,egw=this.egw?“function”==typeof this.egw?this.egw():this.egw:(window.opener||window).egw,that=this,extra_params=extra_data&&“object”==typeof extra_data?extra_data:{};if(extra_params.date=edit_date.toJSON?edit_date.toJSON():edit_date,“function”!=typeof callback&&(callback=function(_button_id){switch(_button_id){case"exception":extra_params.exception=“1”,egw.open(edit_id,event_data.app||“
calendar”,“edit”,extra_params);break;case"series":case"single":egw.open(edit_id,event_data.app||“calendar”,“edit”,extra_params);break;case"cancel":}}),parseInt(event_data.recur_type)){var buttons=[{text:egw.lang(“Edit exception”),id:“exception”,class:“ui-priority-primary”,default:!0},{text:egw.lang(“Edit series”),id:“series”},{text:egw.lang(“Cancel”),id:“cancel”}];et2_dialog.show_dialog(function(button_id){callback.call(that,button_id,event_data)},(event_data.is_private?egw.lang(“private”):event_data.title)+"\n"+egw.lang(“Do you want to edit this event as an exception or the whole series?”),egw.lang(“This event is part of a series”),{},buttons,et2_dialog.QUESTION_MESSAGE)}else callback.call(this,“single”,event_data)},et2_calendar_event.series_split_prompt=function(event_data,instance_date,callback){var egw=this.egw?“function”==typeof this.egw?this.egw():this.egw:(window.opener||window).egw,that=this;“string”==typeof instance_date&&(instance_date=new Date(instance_date));var tempDate
=new Date,today=new Date(tempDate.getFullYear(),tempDate.getMonth(),tempDate.getDate(),tempDate.getHours(),-tempDate.getTimezoneOffset(),tempDate.getSeconds()),termination_date=today>instance_date?egw.lang(“today”):date(egw.preference(“dateformat”),instance_date);parseInt(event_data.recur_type)&&et2_dialog.show_dialog(function(button_id){callback.call(that,button_id,event_data)},(event_data.is_private?egw.lang(“private”):event_data.title)+"\n"+egw.lang(“Do you really want to change the start of this series? If you do, the original series will be terminated as of %1 and a new series for the future reflecting your changes will be created.”,termination_date),egw.lang(“This event is part of a series”),{},et2_dialog.BUTTONS_OK_CANCEL,et2_dialog.WARNING_MESSAGE)},et2_calendar_event.drag_helper=function(event,ui){ui.helper.width(ui.width())},et2_calendar_event.split_status=function(status,quantity,role){quantity=1,role=“REQ-PARTICIPANT”;var matches=null;return"string"==typeof status&&statu
s.length>1&&(matches=status.match(/^.([0-9])(.)$/gi)),matches?(parseInt(matches[1])>0&&(quantity=parseInt(matches[1])),matches[2]&&(role=matches[2]),status=status[0]):status===!0&&(status=“U”),status};var et2_calendar_daycol=function(){“use strict”;return et2_valueWidget.extend([et2_IDetachedDOM,et2_IResizeable],{attributes:{date:{name:“Date”,type:“any”,description:“What date is this daycol for. YYYYMMDD or Date”,default:et2_no_init},owner:{name:“Owner”,type:“any”,default:et2_no_init,description:“Account ID number of the calendar owner, if not the current user”},display_birthday_as_event:{name:“Birthdays”,type:“boolean”,default:!1,description:“Display birthdays as events”},display_holiday_as_event:{name:“Holidays”,type:“boolean”,default:!1,description:“Display holidays as events”}},init:function(){this._super.apply(this,arguments),this.div=$j(document.createElement(“div”)).addClass(“calendar_calDayCol”).css(“width”,this.options.width).css(“left”,this.options.left),this.header=$j(
document.createElement(“div”)).addClass(“calendar_calDayColHeader”).css(“width”,this.options.width).css(“left”,this.options.left),this.title=$j(document.createElement(“div”)).appendTo(this.header),this.all_day=$j(document.createElement(“div”)).addClass(“calendar_calDayColAllDay”).appendTo(this.header),this.event_wrapper=$j(document.createElement(“div”)).addClass(“event_wrapper”).appendTo(this.div),this.setDOMNode(this.div[0]),this.date_helper=et2_createWidget(“date-time”,{},null),this.date_helper.loadingFinished(),this.display_settings={wd_start:540,wd_end:1020,granularity:30,rowsToDisplay:10,rowHeight:20,titleHeight:2},this.registeredUID=null},doLoadingFinished:function(){if(this._super.apply(this,arguments),this._parent&&this._parent.options.owner&&this.set_owner(this._parent.options.owner),""===this.title.text()&&this.options.date&&this._parent&&this._parent.instanceOf(et2_calendar_timegrid)){var date=this.options.date;this.options.date="",this.set_date(date)}},destroy:function()
{this._super.apply(this,arguments),this.div.off(),this.header.off().remove(),this.title.off(),this.div=null,this.header=null,this.title=null,this.date_helper.destroy(),this.date_helper=null,egw.dataUnregisterUID(this.registeredUID,!1,this)},getDOMNode:function(sender){return sender&&sender!==this?sender.instanceOf&&sender.instanceOf(et2_calendar_event)?0===this.display_settings.granularity?this.event_wrapper[0]:sender.options.value.whole_day_on_top||sender.options.value.whole_day&&sender.options.value.non_blocking===!0?this.all_day[0]:this.div[0]:void 0:this.div[0]},_draw:function(){if($j(".calendar_calAddEvent",this.div).remove(),this._parent&&this._parent.instanceOf(et2_calendar_timegrid)){this.display_settings.wd_start=60this._parent.options.day_start,this.display_settings.wd_end=60this._parent.options.day_end,this.display_settings.granularity=this._parent.options.granularity;for(var header=this._parent.dayHeader.children(),idx=0,siblings=this._parent.getDOMNode(this).childNode
s;idx<siblings.length&&siblings[idx]!=this.getDOMNode();)idx++;0==idx?this._parent.dayHeader.prepend(this.header):header.length&&header.eq(Math.min(header.length,idx)-1).after(this.header)}this.div.attr(“data-date”,this.options.date)},set_date:function(_date,events,force_redraw){if(“undefined”!=typeof events&&events||(events=!1),“undefined”!=typeof force_redraw&&force_redraw||(force_redraw=!1),!this._parent||!this._parent.date_helper)return egw.debug(“warn”,‘Day col widget "’+this.id+’" is missing its parent.’),!1;“object”==typeof _date?this._parent.date_helper.set_value(_date):“string”==typeof _date&&this._parent.date_helper.set_value(_date.substring(0,4)+"-"+_date.substring(4,6)+"-"+_date.substring(6,8)+“T00:00:00Z”),this.date=new Date(this._parent.date_helper.getValue());var new_date=""+this._parent.date_helper.get_year()+sprintf("%02d",this._parent.date_helper.get_month())+sprintf("%02d",this._parent.date_helper.get_date());if(!this.options.label){var formatDate=new Date(this.da
te.valueOf()+60this.date.getTimezoneOffset()1e3),date_string=1===this._parent._children.length?app.calendar.date.long_date(formatDate,!1,!1,!0):jQuery.datepicker.formatDate(“DD dd”,formatDate);this.title.text(date_string)}if(this.title.attr(“data-date”,new_date),this.header.attr(“data-date”,new_date).attr(“data-whole_day”,!0),new_date!==this.options.date||this.display_settings.granularity!==this._parent.options.granularity||force_redraw){var cache_id=app.classes.calendar._daywise_cache_id(new_date,this.options.owner);if(this.options.date&&this.registeredUID&&cache_id!==this.registeredUID)for(egw.dataUnregisterUID(this.registeredUID,!1,this);this._children.length>0;){var node=this._children[this._children.length-1];this.removeChild(node),node.free()}this.options.date=new_date,this.day_class_holiday(),this._draw(),this.registeredUID!==cache_id&&(this.registeredUID=cache_id,egw.dataRegisterUID(this.registeredUID,this._data_callback,this,this.getInstanceManager().execId,this.id))}},se
t_owner:function(_owner){if(this.title.attr(“data-owner”,_owner),this.header.attr(“data-owner”,_owner),_owner!==this.options.owner&&(“object”!=typeof _owner&&“object”!=typeof this.options.owner||_owner.toString()!=this.options.owner.toString())){this.options.owner=“object”!=typeof _owner?[_owner]:_owner;var cache_id=app.classes.calendar._daywise_cache_id(this.options.date,_owner);this.options.date&&this.registeredUID&&cache_id!==this.registeredUID&&egw.dataUnregisterUID(this.registeredUID,!1,this),this.registeredUID!==cache_id&&(this.registeredUID=cache_id,egw.dataRegisterUID(this.registeredUID,this._data_callback,this,this.getInstanceManager().execId,this.id))}},set_class:function(classnames){this.header.removeClass(this.class),this._super.apply(this,arguments),this.header.addClass(classnames)},_data_callback:function(event_ids){var events=[];null!=event_ids&&“undefined”!=typeof event_ids.length||(event_ids=[]);for(var i=0;i<event_ids.length;i++){var event=egw.dataGetUIDdata(“calen
dar::”+event_ids[i]);event=event&&event.data||!1,event&&event.date&&(event.date===this.options.date||new Date(event.start)<=this.date)&&events.push(event)}this._parent.disabled||this._update_events(events)},set_label:function(label){this.options.label=label,this.title.text(label),this.title.toggleClass(“et2_clickable et2_link”,""===label)},set_left:function(left){this.div&&this.div.css(“left”,left)},set_width:function(width){this.options.width=width,this.div&&(this.div.outerWidth(this.options.width),this.header.outerWidth(this.options.width))},day_class_holiday:function(){this.title.removeClass(“calendar_calToday calendar_calBirthday calendar_calHoliday”).addClass(“et2_clickable et2_link”),this.title.attr(“data-holiday”,"");var today=new Date;today.setUTCMinutes(today.getUTCMinutes()-today.getTimezoneOffset()),this.title.toggleClass(“calendar_calToday”,this.options.date===""+today.getUTCFullYear()+sprintf("%02d",today.getUTCMonth()+1)+sprintf("%02d",today.getUTCDate()));var holidays
=et2_calendar_view.get_holidays(this,this.options.date.substring(0,4)),holiday_list=[];if(holidays&&holidays[this.options.date]){
+holidays=holidays[this.options.date];for(var i=0;i<holidays.length;i++)“undefined”!=typeof holidays[i].birthyear?(this.title.addClass(“calendar_calBirthday”),this.options.display_birthday_as_event||holiday_list.push(holidays[i].name)):(this.title.addClass(“calendar_calHoliday”),this.title.attr(“data-holiday”,holidays[i].name),this.options.display_holiday_as_event||holiday_list.push(holidays[i].name))}this.title.attr(“title”,holiday_list.join(","))},_update_events:function(_events){for(var events=_events||this.getArrayMgr(“content”).getEntry(this.options.date)||[];this._children.length>0;){var node=this._children[this.children.length-1];this.removeChild(node),node.free()}events.sort(function(a,b){var start=new Date(a.start)-new Date(b.start),end=new Date(a.end)-new Date(b.end);return a.whole_day&&b.whole_day?a.app_id-b.app_id:a.whole_day||b.whole_day?a.whole_day?-1:1:start?start:end});for(var c=0;c<events.length;c++)var event=et2_createWidget(“calendar-event”,{id:"event"+events[c].
id,value:events[c]},this);for(var c=0;c<events.length&&c<this.children.length;c++){var event=this.getWidgetById("event"+events[c].id);event&&this.isInTree()&&event.doLoadingFinished()}this._out_of_view()},_out_of_view:function(){function isHidden(elem){var docViewTop=timegrid.scrolling.scrollTop(),docViewBottom=docViewTop+(0===this.display_settings.granularity?this.event_wrapper.height():timegrid.scrolling.height()),elemTop=elem.position().top,elemBottom=elemTop+elem.outerHeight(!0);if(docViewBottom>=elemBottom&&elemTop>=docViewTop)return!1;var visible={hidden:elemTop>docViewTop?“bottom”:“top”,completely:!1};return visible.completely=“top”==visible.hidden?docViewTop>elemBottom:elemTop>docViewBottom,visible}this.header.children(".hiddenEventBefore").remove(),this.div.children(".hiddenEventAfter").remove(),this.event_wrapper.css(“overflow”,“visible”),this.all_day.removeClass(“overflown”),$j(".calendar_calEventBody",this.div).css({“padding-top”:"",“margin-top”:""});var timegrid=this.
_parent;0===this.display_settings.granularity&&this._children.length&&($j(“div.calendar_calEvent”,this.div).show(0),Math.ceil(this.div.height()/this._children[0].div.height())>this._children.length)||(this.all_day.toggleClass(“overflown”,this.all_day[0].scrollHeight-this.all_day.height()>5),this.iterateOver(function(event){if(!this.display_settings.granularity||event.options&&event.options.value&&!event.options.value.whole_day_on_top){event.title.css({top:"",“background-color”:""}),event.body.css({“padding-top”:"",“margin-top”:""});var hidden=isHidden.call(this,event.div),day=this;if(hidden)if(“top”!==hidden.hidden||hidden.completely)0===this.display_settings.granularity&&hidden?(0==$j(".hiddenEventAfter",this.div).length&&this.event_wrapper.css(“overflow”,“hidden”),this._hidden_indicator(event,!1,function(){app.calendar.update_state({view:“day”,date:day.date})}),event.div.hide(0)):hidden.completely&&this._hidden_indicator(event,“top”==hidden.hidden,!1);else{var title_height=event.t
itle.outerHeight();event.title.css({top:timegrid.scrolling.scrollTop()-event.div.position().top,“background-color”:“transparent”}),event.body.css({“padding-top”:timegrid.scrolling.scrollTop()-event.div.position().top+title_height,“margin-top”:-title_height})}}},this,et2_calendar_event))},_hidden_indicator:function(event,top,onclick){var indicator="",day=this,timegrid=this._parent,fixed_height=timegrid.div.hasClass(“calendar_calTimeGridFixed”);if(top)0===$j(".hiddenEventBefore",this.header).length?(indicator=$j(’’).appendTo(this.header).attr(“data-hidden_count”,1),fixed_height||indicator.text(event.options.value.title).on(“click”,“function”==typeof onclick?onclick:function(){return $j(".calendar_calEvent",day.div).first()[0].scrollIntoView(),!1})):(indicator=$j(".hiddenEventBefore",this.header),indicator.attr(“data-hidden_count”,parseInt(indicator.attr(“data-hidden_count”))+1),fixed_height||indicator.text(day.egw().lang("%1 event(s) %2",indicator.
attr(“data-hidden_count”),"")));else{indicator=$j(".hiddenEventAfter",this.div),0===indicator.length&&(indicator=$j(’’).attr(“data-hidden_count”,0).appendTo(this.div),fixed_height?indicator.on(“mouseover”,function(){indicator.css({height:1.2indicator.attr(“data-hidden_count”)+“em”,“margin-top”:-(1.2indicator.attr(“data-hidden_count”))+“em”})}).on(“mouseout”,function(){indicator.css({height:"",“margin-top”:""})}):indicator.on(“click”,“function”==typeof onclick?onclick:function(){return $j(".calendar_calEvent",day.div).last()[0].scrollIntoView(!1),day._out_of_view(),!1}));var count=parseInt(indicator.attr(“data-hidden_count”))+1;indicator.attr(“data-hidden_count”,count),0===this.display_settings.granularity?(indicator.append(event.div.clone()),indicator.attr(“data-hidden_label”,day.egw().lang("%1 event(s) %2",indicator.attr(“data-hidden_count”),""))):fixed_height||indicator.text(day.egw().lang("%1 event(s) %2",indicator.attr(“data-hidden_count”),"
")),indicator.css(“top”,timegrid.scrolling.height()+timegrid.scrolling.scrollTop()-indicator.innerHeight())}if(fixed_height&&indicator.append(""+event.options.value.title+"
"),""!==indicator){var color=jQuery.Color(event.div.css(“background-color”)).toString()!==jQuery.Color(“white”).toString()?event.div.css(“background-color”):event.div.css(“border-bottom-color”);“rgba(0, 0, 0, 0)”!==color&&indicator.css(“border-color”,color)}},_spread_events:function(){if(!this.date)return[];var day_start=this.date.valueOf()/1e3,dst_check=new Date(this.date);dst_check.setUTCHours(12);var daylight_diff=day_start+43200-dst_check.valueOf()/1e3;daylight_diff&&(day_start-=daylight_diff);var eventCols=[],col_ends=[];this._children.sort(function(a,b){var start=new Date(a.options.value.start)-new Date(b.options.value.start),end=new Date(a.options.value.end)-new Date(b.options.value.end);if(a.options.value.whole_day&&b.options.value.whole
_day){var duration=new Date(b.options.value.end)-new Date(b.options.value.start)-(new Date(a.options.value.end)-new Date(a.options.value.start));return duration?duration:a.options.value.app_id-b.options.value.app_id}return a.options.value.whole_day||b.options.value.whole_day?a.options.value.whole_day?-1:1:start?start:end});for(var i=0;i<this._children.length;i++){var event=this._children[i].options.value||!1;if(event)if(event.date&&event.date!=this.options.date&&(new Date(event.start)>=this.date||new Date(event.end)<=this.date))this._children[i].destroy(),this.removeChild(this._children[i]);else{var c=0;if(event.multiday=!1,“object”!=typeof event.start&&(event.start=new Date(event.start)),“object”!=typeof event.end&&(event.end=new Date(event.end)),event.start_m=parseInt((event.start.valueOf()/1e3-day_start)/60),event.start_m<0&&(event.start_m=0,event.multiday=!0),event.end_m=parseInt((event.end.valueOf()/1e3-day_start)/60),event.end_m>=1440&&(event.end_m=1439,event.multiday=!0),even
t.start.getUTCHours()||event.start.getUTCMinutes()||23!=event.end.getUTCHours()||59!=event.end.getUTCMinutes()||(event.whole_day_on_top=event.non_blocking&&“0”!=event.non_blocking),!event.whole_day_on_top){for(c=0;event.start_m<col_ends[c];++c);col_ends[c]=event.end_m}“undefined”==typeof eventCols[c]&&(eventCols[c]=[]),eventCols[c].push(this._children[i])}}return eventCols},position_event:function(event){if(this.div.is(":visible"))for(var columns=this._spread_events(),c=0;c<columns.length;c++){var left=Math.ceil(5+150/(parseFloat(this.options.width)||100)),right=2;1!==columns.length&&(right=c?2:30,left+=c(100-left)/columns.length);for(var i=0;(columns[c].indexOf(event)>=0||!event)&&i<columns[c].length;i++){var top=0,height=0;if(0!==this.display_settings.granularity){if(columns[c][i].options.value.whole_day_on_top)this.all_day.has(columns[c][i].div).length||(columns[c][i].div.css(“top”,""),columns[c][i].div.css(“height”,""),columns[c][i].div.css(“left”,""),columns[c][i].div.css(“rig
ht”,""),columns[c][i].body.css(“padding-top”,""),columns[c][i].div.appendTo(this.all_day),this._parent.resizeTimes());else if(this.all_day.has(columns[c][i].div).length&&(columns[c][i].div.appendTo(this.event_wrapper),this._parent.resizeTimes()),top=this._time_to_position(columns[c][i].options.value.start_m),height=this._time_to_position(columns[c][i].options.value.end_m)-top,event&&columns[c].indexOf(event)>=0||!event){if(columns[c][i].div.css(“top”,top+"%"),columns[c][i].div.css(“height”,height+"%"),columns[c][i].div.is(":visible")){var border_diff=columns[c][i].div.outerHeight()-columns[c][i].div.height();columns[c][i].div.css(“height”,columns[c][i].div.height()-border_diff)}columns[c][i].div.css(“left”,left.toFixed(1)+"%"),columns[c][i].div.css(“right”,right.toFixed(1)+"%"),columns[c][i].div.css(“z-index”,parseInt(20)+c),columns[c][i]._small_size()}}else this.all_day.has(columns[c][i].div).length&&columns[c][i].div.prependTo(this.event_wrapper),columns[c][i].div.css(“top”,""),co
lumns[c][i].div.css(“height”,""),columns[c][i].div.css(“left”,""),columns[c][i].div.css(“right”,""),columns[c][i].body.css(“padding-top”,"")}if(event&&columns[c].indexOf(event)>=0)return}},_time_to_position:function(time){var pos=0;return pos=time/60/24*100,pos=pos.toFixed(1)},attachToDOM:function(){this._super.apply(this,arguments),this.onclick||$j(this.node).off(“click”),$j(this.node).on(“click.et2_daycol”,".calendar_calDayColHeader,.calendar_calAddEvent",jQuery.proxy(this.click,this))},click:function(_ev){if(this.title.is(_ev.target))return app.calendar.update_state({view:“day”,date:this.date.toJSON()}),!1;if($j(_ev.target).hasClass(“calendar_calAddEvent”)&&!_ev.target.dataset.whole_day){var options={date:_ev.target.dataset.date||this.options.date,hour:_ev.target.dataset.hour||this._parent.options.day_start,minute:_ev.target.dataset.minute||0};return this.options.owner!=app.calendar.state.owner&&(options.owner=this.options.owner),this.egw().open(null,“calendar”,“add”,options,"_bl
ank"),!1}if(this.header.has(_ev.target).length&&!$j(".hiddenEventBefore",this.header).has(_ev.target)||this.header.is(_ev.target)){var end=this.date.getFullYear()+"-"+(this.date.getUTCMonth()+1)+"-"+this.date.getUTCDate()+“T23:59”;return this.egw().open(null,“calendar”,“add”,{start:this.date.toJSON(),end:end,non_blocking:!0},"_blank"),!1}},getDetachedAttributes:function(_attrs){},getDetachedNodes:function(){return[this.getDOMNode()]},setDetachedAttributes:function(_nodes,_values){},resize:function(){this.disabled||!this.div.is(":visible")||this._parent.disabled||(this.display_settings.granularity!==this._parent.options.granularity&&this._draw(),this.position_event(),this._out_of_view())}})}.call(this);et2_register_widget(et2_calendar_daycol,[“calendar-daycol”]);var et2_calendar_timegrid=function(){“use strict”;return et2_calendar_view.extend([et2_IDetachedDOM,et2_IResizeable],{createNamespace:!0,attributes:{value:{type:“any”,description:“An array of events, indexed by date (Ymd form
at).”},day_start:{name:“Day start time”,type:“string”,default:parseInt(egw.preference(“workdaystarts”,“calendar”))||9,description:“Work day start time. If unset, this will default to the current user’s preference”},day_end:{name:“Day end time”,type:“string”,default:parseInt(egw.preference(“workdayends”,“calendar”))||17,description:“Work day end time. If unset, this will default to the current user’s preference”},show_weekend:{name:“Weekends”,type:“boolean”,default:5!=egw.preference(“days_in_weekview”,“calendar”),description:“Display weekends. The date range should still include them for proper scrolling, but they just won’t be shown.”},granularity:{name:“Granularity”,type:“integer”,default:parseInt(egw.preference(“interval”,“calendar”))||30,description:“How many minutes per row, or 0 to display events as a list”},onchange:{name:“onchange”,type:“js”,default:et2_no_init,description:“JS code which is executed when the date range changes.”},onevent_change:{name:“onevent_change”,type:
“js”,default:et2_no_init,description:“JS code which is executed when an event changes.”},height:{default:“100%”}},init:function(){this._super.apply(this,arguments),this.div=$j(document.createElement(“div”)).addClass(“calendar_calTimeGrid”).addClass(“calendar_TimeGridNoLabel”),this.gridHeader=$j(document.createElement(“div”)).addClass(“calendar_calGridHeader”).appendTo(this.div),this.dayHeader=$j(document.createElement(“div”)).appendTo(this.gridHeader),this.scrolling=$j(document.createElement(“div”)).addClass(“calendar_calTimeGridScroll”).appendTo(this.div).append(’<div class="calendar_calTimeLabe