mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
fix handling for "No filter" (blank) favorite for attributes and views managed on server-side
This commit is contained in:
parent
4d8a7d58a1
commit
ba6e9129e7
@ -1080,6 +1080,13 @@ app.classes.calendar = AppJS.extend(
|
|||||||
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) || jQuery.isEmptyObject(state.state||state.filter) ? 'blank' : state.name.replace(/[^A-Za-z0-9-_]/g, '_');
|
||||||
|
}
|
||||||
|
menuaction = 'calendar.calendar_uilist.listview';
|
||||||
|
state.state.ajax = 'true';
|
||||||
// check if we already use et2 / are in listview
|
// check if we already use et2 / are in listview
|
||||||
if (this.et2 || etemplate2 && etemplate2.getByApplication('calendar'))
|
if (this.et2 || etemplate2 && etemplate2.getByApplication('calendar'))
|
||||||
{
|
{
|
||||||
@ -1099,9 +1106,34 @@ app.classes.calendar = AppJS.extend(
|
|||||||
if (state.state[attr] != current_state[attr])
|
if (state.state[attr] != current_state[attr])
|
||||||
{
|
{
|
||||||
need_redirect = true;
|
need_redirect = true;
|
||||||
|
// reset of attributes managed on server-side
|
||||||
|
if (state.state.favorite === 'blank')
|
||||||
|
{
|
||||||
|
switch(attr)
|
||||||
|
{
|
||||||
|
case 'cat_id':
|
||||||
|
state.state.cat_id = 0;
|
||||||
|
break;
|
||||||
|
case 'owner':
|
||||||
|
state.state.owner = egw.user('account_id');
|
||||||
|
break;
|
||||||
|
case 'filter':
|
||||||
|
state.state.filter = 'default';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'view':
|
||||||
|
// "No filter" (blank) favorite: if not in listview --> stay in that view
|
||||||
|
if (state.state.favorite === 'blank' && current_state.view != 'listview')
|
||||||
|
{
|
||||||
|
menuaction = 'calendar.calendar_uiviews.index';
|
||||||
|
delete state.state.ajax;
|
||||||
|
need_redirect = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!need_redirect)
|
if (!need_redirect)
|
||||||
@ -1109,13 +1141,6 @@ app.classes.calendar = AppJS.extend(
|
|||||||
return this._super.apply(this, [state]);
|
return this._super.apply(this, [state]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
menuaction = 'calendar.calendar_uilist.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) || jQuery.isEmptyObject(state.state||state.filter) ? 'blank' : state.name.replace(/[^A-Za-z0-9-_]/g, '_');
|
|
||||||
}
|
|
||||||
state.state.ajax = 'true';
|
|
||||||
}
|
}
|
||||||
// setting internal state now, that linkHandler does not intercept switching from listview to any old view
|
// setting internal state now, that linkHandler does not intercept switching from listview to any old view
|
||||||
this.state = state;
|
this.state = state;
|
||||||
|
Loading…
Reference in New Issue
Block a user