Fix empty meeting request display in mail, caused by default handling in et2_ready

This commit is contained in:
Ralf Becker 2015-07-15 13:16:31 +00:00
parent 7f01ef37ed
commit 7c141d1c65

View File

@ -20,7 +20,7 @@
*
* Calendar has multiple different views of the same data. All the templates
* for the different view are loaded at the start, then the view objects
* in app.classes.calendar.views are used to manage the different views.
* in app.classes.calendar.views are used to manage the different views.
* update_state() is used to change the state between the different views.
*
* The event widgets and the nextmatch get the data from egw.data.
@ -120,7 +120,7 @@ app.classes.calendar = AppJS.extend(
$j(_et2.DOMContainer).hide();
this._setup_sidebox_filters();
break;
case 'calendar.edit':
if (typeof content.data['conflicts'] == 'undefined')
{
@ -152,6 +152,8 @@ app.classes.calendar = AppJS.extend(
break;
case 'home.legacy':
break;
case 'calendar.meeting':
break;
case 'calendar.list':
this.filter_change();
// Fall through
@ -161,7 +163,7 @@ app.classes.calendar = AppJS.extend(
// Record the templates for the views so we can switch between them
for(var view in app.classes.calendar.views)
{
var index = app.classes.calendar.views[view].etemplates.indexOf(_name)
var index = app.classes.calendar.views[view].etemplates.indexOf(_name);
if(index > -1)
{
app.classes.calendar.views[view].etemplates[index] = _et2;
@ -169,7 +171,7 @@ app.classes.calendar = AppJS.extend(
$j(_et2.DOMContainer).one('clear',jQuery.proxy(function() {
this.view[index] = _name;
},{view: app.classes.calendar.views[view], index: index, name: _name}));
if(this.state.view === view)
{
hidden = false;
@ -177,7 +179,7 @@ app.classes.calendar = AppJS.extend(
}
app.classes.calendar.views[view].etemplates.forEach(function(et) {all_loaded = all_loaded && typeof et !== 'string';});
}
// Start hidden, except for current view
if(hidden)
{
@ -340,7 +342,7 @@ app.classes.calendar = AppJS.extend(
// Put owners into row IDs
app.classes.calendar.views[state.view].etemplates[0].widgetContainer.iterateOver(function(widget) {
widget.div.parents('tr').attr('data-owner',widget.options.owner);
},this,et2_calendar_timegrid)
},this,et2_calendar_timegrid);
},
stop: function ()
{
@ -405,12 +407,12 @@ app.classes.calendar = AppJS.extend(
start = new Date(app.calendar.state.first);
end = new Date(app.calendar.state.last);
// Get the number of days
delta = (Math.round(Math.max(1,end - start)/(24*3600*1000)))*24*3600*1000
delta = (Math.round(Math.max(1,end - start)/(24*3600*1000)))*24*3600*1000;
// Adjust
start = new Date(start.valueOf() + (delta * direction ));
end = new Date(end.valueOf() + (delta * direction));
}
app.calendar.update_state({date:app.calendar.date.toString(start)});
return false;
@ -478,9 +480,9 @@ app.classes.calendar = AppJS.extend(
},
/**
* Handler for changes generated by internal user interactions, like
* Handler for changes generated by internal user interactions, like
* drag & drop inside calendar and resize.
*
*
* @param {Event} event
* @param {et2_calendar_event} widget Widget for the event
* @param {string} dialog_button - 'single', 'series', or 'exception', based on the user's answer
@ -790,7 +792,7 @@ app.classes.calendar = AppJS.extend(
}
return true;
},
/**
* Handles to select freetime, and replace the selected one on Start,
* and End date&time in edit calendar entry popup.
@ -850,7 +852,7 @@ app.classes.calendar = AppJS.extend(
/**
* Application links from non-list events
*
*
* @param {egwAction} _action
* @param {egwActionObject[]} _events
*/
@ -1144,11 +1146,11 @@ app.classes.calendar = AppJS.extend(
/**
* Change only part of the current state.
*
*
* The passed state options (filters) are merged with the current state, so
* this is the one that should be used for most calls, as setState() requires
* the complete state.
*
*
* @param {Object} _set New settings
*/
update_state: function(_set)
@ -1215,7 +1217,7 @@ app.classes.calendar = AppJS.extend(
// Don't store first and last
delete state.first;
delete state.last;
return state;
},
@ -1260,7 +1262,7 @@ app.classes.calendar = AppJS.extend(
{
$j(this.sidebox_et2.getInstanceManager().DOMContainer).hide();
}
// Check for a supported client-side view
if(app.classes.calendar.views[state.state.view] &&
// Check that the view is instanciated
@ -1271,7 +1273,7 @@ app.classes.calendar = AppJS.extend(
// We set a flag to ignore changes from the sidebox which would
// cause infinite loops.
this.state_update_in_progress = true;
var view = app.classes.calendar.views[state.state.view];
// Sanitize owner
@ -1395,8 +1397,8 @@ app.classes.calendar = AppJS.extend(
}
}
// Include first & last dates in state, mostly for server side processing
if(state.state.first && state.state.first.toJSON) state.state.first = state.state.first.toJSON()
if(state.state.last && state.state.last.toJSON) state.state.last = state.state.last.toJSON()
if(state.state.first && state.state.first.toJSON) state.state.first = state.state.first.toJSON();
if(state.state.last && state.state.last.toJSON) state.state.last = state.state.last.toJSON();
// Show the templates for the current view
for(var i = 0; i < view.etemplates.length; i++)
@ -1418,7 +1420,7 @@ app.classes.calendar = AppJS.extend(
this.egw.jsonq('calendar_uiviews::ajax_get_todos', [state.state.date, state.state.owner[0]], function(data) {
this.getWidgetById('label').set_value(data.label||'');
this.getWidgetById('todos').set_value(data.todos||'');
},view.etemplates[1].widgetContainer)
},view.etemplates[1].widgetContainer);
}
}
else
@ -1430,7 +1432,7 @@ app.classes.calendar = AppJS.extend(
var formatDate = new Date(this.state.date);
formatDate = new Date(formatDate.valueOf() + formatDate.getTimezoneOffset() * 60 * 1000);
egw_app_header(view.header(state.state),'calendar');
if(state.state.view === 'listview')
{
state.state.startdate = state.state.date;
@ -1441,7 +1443,7 @@ app.classes.calendar = AppJS.extend(
/* Update re-orderable calendars */
this._sortable();
/* Update sidebox widgets to show current value*/
this.sidebox_et2.iterateOver(function(widget) {
if(widget.id == 'view')
@ -1575,9 +1577,9 @@ app.classes.calendar = AppJS.extend(
/**
* Check to see if any of the selected is an event widget
* Used to separate grid actions from event actions
*
* @param {egwAction} _egw
* @param {egwActioObject[]} _widget
*
* @param {egwAction} _action
* @param {egwActioObject[]} _selected
* @returns {boolean} Is any of the selected an event widget
*/
is_event: function(_action, _selected)
@ -1593,11 +1595,11 @@ app.classes.calendar = AppJS.extend(
// Also check classes, usually indicating permission
if(_action.data && _action.data.enableClass)
{
is_widget = is_widget && ($j( _selected[i].iface.getDOMNode()).hasClass(_action.data.enableClass))
is_widget = is_widget && ($j( _selected[i].iface.getDOMNode()).hasClass(_action.data.enableClass));
}
if(_action.data && _action.data.disableClass)
{
is_widget = is_widget && !($j( _selected[i].iface.getDOMNode()).hasClass(_action.data.disableClass))
is_widget = is_widget && !($j( _selected[i].iface.getDOMNode()).hasClass(_action.data.disableClass));
}
}
@ -1748,12 +1750,12 @@ app.classes.calendar = AppJS.extend(
if(date)
{
date.input_date.datepicker("option", {
showButtonPanel: false,
showButtonPanel: false
// TODO: We could include tooltips for holidays
})
});
}
// Show / Hide weekends based on preference of weekends should be shown
egw.css('#'+date.input_date.attr('id') + ' .ui-datepicker-week-end',
egw.css('#'+date.input_date.attr('id') + ' .ui-datepicker-week-end',
egw.preference('days_in_weekview', 'calendar') === "5" ? 'display: none;' : 'display: table-cell;'
);
@ -1772,7 +1774,7 @@ app.classes.calendar = AppJS.extend(
// Set to week view
app.calendar.update_state({view: 'week', date: date.getValue()});
});
},
View: {
// List of etemplates to show for this view
@ -1907,7 +1909,7 @@ jQuery.extend(app.classes.calendar,{
// Always 7 days, we just turn weekends on or off
d.setUTCHours(24*7-1);
return d;
},
}
}),
month: app.classes.calendar.prototype.View.extend({
header: function(state)
@ -1917,19 +1919,19 @@ jQuery.extend(app.classes.calendar,{
return egw.lang('Month view') + ':' + egw.lang(date('F',formatDate)) + ' ' + date('Y',formatDate);
},
start_date: function(state) {
var d = app.calendar.View.start_date.call(this,state)
var d = app.calendar.View.start_date.call(this,state);
d.setUTCDate(1);
state.date = app.calendar.date.toString(d);
return app.calendar.date.start_of_week(d);
},
end_date: function(state) {
var d = app.calendar.View.end_date.call(this,state)
var d = app.calendar.View.end_date.call(this,state);
d = new Date(d.getFullYear(),d.getUTCMonth() + 1, 0);
var week_start = app.calendar.date.start_of_week(d);
if(week_start < d) week_start.setUTCHours(24*7);
week_start.setUTCHours(week_start.getUTCHours()-1);
return week_start;
},
}
}),
planner: app.classes.calendar.prototype.View.extend({