get calendar favorites working for list-view (eg. changing owner)

This commit is contained in:
Ralf Becker 2013-12-12 03:42:08 +00:00
parent 2bb7b7565c
commit 1dc6964754
2 changed files with 16 additions and 6 deletions

View File

@ -272,7 +272,16 @@ class calendar_ui
// only look at _REQUEST, if we are in the calendar (prefs and admin show our sidebox menu too!)
if (is_null($set_states))
{
$set_states = substr($_GET['menuaction'],0,9) == 'calendar.' ? $_REQUEST : array();
// ajax-exec call has get-parameter in some json
if (isset($_REQUEST['json_data']) && ($json_data = json_decode($_REQUEST['json_data'], true)) &&
!empty($json_data['request']['parameters'][0]))
{
parse_str(substr($json_data['request']['parameters'][0], 10), $set_states); // cut off "/index.php?"
}
else
{
$set_states = substr($_GET['menuaction'],0,9) == 'calendar.' ? $_REQUEST : array();
}
}
if (!$states['date'] && $states['year'] && $states['month'] && $states['day'])
{
@ -561,7 +570,7 @@ class calendar_ui
'icon' => false
)
));
$n = 0; // index for file-array
$planner_days_for_view = false;

View File

@ -34,7 +34,7 @@ app.classes.calendar = AppJS.extend(
{
// call parent
this._super.apply(this, arguments);
// make calendar object available, even if not running in top window, as sidebox does
if (window.top !== window && typeof window.top.app.calendar == 'undefined')
{
@ -547,20 +547,21 @@ app.classes.calendar = AppJS.extend(
if (typeof state.state != 'undefined' && state.state.view == 'undefined' || state.state.view == 'listview')
{
menuaction = 'calendar.calendar_uilist.listview';
state.state.ajax = 'true';
if (state.name)
{
state.state = {favorite: state.name.replace(/[^A-Za-z0-9-_]/g, '_')};
state.state.favorite = state.name.replace(/[^A-Za-z0-9-_]/g, '_');
}
}
var query = jQuery.extend({menuaction: menuaction},state.state||{});
// prepend an owner 0, to reset all owners and not just set given resource type
if(typeof query.owner != 'undefined')
{
query.owner = '0,'+ query.owner;
}
this.egw.open_link(this.egw.link('/',query), 'calendar');
this.egw.open_link(this.egw.link('/index.php',query), 'calendar');
// Stop the normal bubbling if this is called on click
return false;