From 79498c5ae5ae1475af6a5e0d9b19d1594315afb1 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Fri, 6 Dec 2013 18:24:29 +0000 Subject: [PATCH] non-et2 Favorites work in progress Can now save & restore state. Still some UI needed, not fully integrated with et2 favorites. --- calendar/js/app.js | 12 ++++++++++-- phpgwapi/inc/class.egw_framework.inc.php | 2 +- phpgwapi/js/jsapi/app_base.js | 9 +++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/calendar/js/app.js b/calendar/js/app.js index 51eb1c588b..e3bfa61021 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -518,8 +518,16 @@ app.classes.calendar = AppJS.extend( */ setState: function(state) { + // State should be an object, not a string, but we'll parse + if(typeof state == "string") + { + if(state.indexOf('{') != -1 || state =='null') + { + state = JSON.parse(state); + } + } // requested state is a listview and we are currently in a list-view - if (state.view == 'listview' && view.name && this.et2 && this.et2.getWidgetById('nm')) + if (state.state.view == 'listview' && state.name && this.et2 && this.et2.getWidgetById('nm')) { return this._super.apply(this, arguments); // call default implementation } @@ -528,7 +536,7 @@ app.classes.calendar = AppJS.extend( var menuaction = 'calendar.calendar_uiviews.index'; if (typeof state.view == 'undefined' || state.view == 'listview') { - menuaction = 'calendar.calendar_uilist.index'; + menuaction = 'calendar.calendar_uilist.listview'; if (state.name) { state = {favorite: state.name.replace(/[^A-Za-z0-9-_]/g, '_')}; diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index f7a2b9d924..3ffb77b1c7 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -1808,7 +1808,7 @@ $LAB.setOptions({AlwaysPreserveOrder:true,BasePath:"'.$GLOBALS['egw_info']['serv if(!$registry) $registry = egw_link::get_registry($app,'index'); foreach($filters as $name => $filter) { - $href = "javascript:app.$app.setState(" . json_encode($filter['filter']) . ');'; + $href = "javascript:app.$app.setState(" . json_encode($filter) . ');'; $html .= "