From 0e89b309e30567d2fcd17eadd3a9bd886aaefb73 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 18 Mar 2013 20:55:47 +0000 Subject: [PATCH] Push updated preferences to client so favorites don't re-appear / disappear --- .../inc/class.etemplate_widget_nextmatch.inc.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php index f2807a2753..6ea1149744 100644 --- a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php +++ b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php @@ -922,6 +922,12 @@ class etemplate_widget_nextmatch extends etemplate_widget $result = $prefs->add($app,$pref_name,$filters,$type); $prefs->save_repository(false,$type); + // Update preferences client side, or it could disappear + $pref = $GLOBALS['egw']->preferences->read_repository(false); + $pref = $pref[$app]; + if(!$pref) $pref = Array(); + egw_json_response::get()->script('window.egw.set_preferences('.json_encode($pref).', "'.$app.'");'); + egw_json_response::get()->data(isset($result[$app][$pref_name])); return isset($result[$app][$pref_name]); } @@ -930,6 +936,12 @@ class etemplate_widget_nextmatch extends etemplate_widget $result = $prefs->delete($app,$pref_name, $type); $prefs->save_repository(false,$type); + // Update preferences client side, or it could come back + $pref = $GLOBALS['egw']->preferences->read_repository(false); + $pref = $pref[$app]; + if(!$pref) $pref = Array(); + egw_json_response::get()->script('window.egw.set_preferences('.json_encode($pref).', "'.$app.'");'); + egw_json_response::get()->data(!isset($result[$app][$pref_name])); return !isset($result[$app][$pref_name]); }