Push updated preferences to client so favorites don't re-appear / disappear

This commit is contained in:
Nathan Gray 2013-03-18 20:55:47 +00:00
parent 562ffe972f
commit 0e89b309e3

View File

@ -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]);
}