* Calendar: fix not working "no filter" favorite

This commit is contained in:
Ralf Becker 2015-08-27 12:03:29 +00:00
parent b55fcedaca
commit 263a5f5f2c

View File

@ -975,7 +975,7 @@ app.classes.calendar = AppJS.extend(
} }
return true; return true;
}, },
/** /**
* Handles to select freetime, and replace the selected one on Start, * Handles to select freetime, and replace the selected one on Start,
* and End date&time in edit calendar entry popup. * and End date&time in edit calendar entry popup.
@ -1078,7 +1078,7 @@ app.classes.calendar = AppJS.extend(
*/ */
cal_open: function(_action, _senders) cal_open: function(_action, _senders)
{ {
var js_integration_data = _action.parent.data.nextmatch.options.settings.js_integration_data || this.et2.getArrayMgr('content').data.nm.js_integration_data; var js_integration_data = _action.parent.data.nextmatch.options.settings.js_integration_data || this.et2.getArrayMgr('content').data.nm.js_integration_data;
var id = _senders[0].id; var id = _senders[0].id;
var matches = id.match(/^(?:calendar::)?([0-9]+):([0-9]+)$/); var matches = id.match(/^(?:calendar::)?([0-9]+):([0-9]+)$/);
@ -1294,7 +1294,7 @@ app.classes.calendar = AppJS.extend(
// Don't store first and last // Don't store first and last
delete state.first; delete state.first;
delete state.last; delete state.last;
return state; return state;
}, },
@ -1316,18 +1316,18 @@ app.classes.calendar = AppJS.extend(
} }
} }
if (jQuery.isEmptyObject(state)) state.state = {};
// old calendar state handling on server-side (incl. switching to and from listview) // old calendar state handling on server-side (incl. switching to and from listview)
var menuaction = 'calendar.calendar_uiviews.index'; var menuaction = 'calendar.calendar_uiviews.index';
if (typeof state.state != 'undefined' && (typeof state.state.view == 'undefined' || state.state.view == 'listview')) if (typeof state.state != 'undefined' && (typeof state.state.view == 'undefined' || state.state.view == 'listview'))
{ {
if (state.name) // 'blank' is the special name for no filters, send that instead of the nice translated name
{ state.state.favorite = jQuery.isEmptyObject(state.state||state.filter) ? 'blank' : state.name.replace(/[^A-Za-z0-9-_]/g, '_');
// 'blank' is the special name for no filters, send that instead of the nice translated name // set date for "No Filter" (blank) favorite to todays date
state.state.favorite = jQuery.isEmptyObject(state) || jQuery.isEmptyObject(state.state||state.filter) ? 'blank' : state.name.replace(/[^A-Za-z0-9-_]/g, '_'); if (state.state.favorite == 'blank')
// set date for "No Filter" (blank) favorite to todays date state.state.date = jQuery.datepicker.formatDate('yymmdd', new Date);
if (state.state.favorite == 'blank')
state.state.date = jQuery.datepicker.formatDate('yymmdd', new Date);
}
menuaction = 'calendar.calendar_uilist.listview'; menuaction = 'calendar.calendar_uilist.listview';
state.state.ajax = 'true'; state.state.ajax = 'true';
// check if we already use et2 / are in listview // check if we already use et2 / are in listview