include addressbook preferences in user.php, as some et2 widgets need this prefs and we dont want to block until they are loaded

This commit is contained in:
Ralf Becker 2014-02-11 12:48:20 +00:00
parent d0b72178f7
commit a4c1c5ad72
2 changed files with 7 additions and 11 deletions

View File

@ -2013,13 +2013,10 @@ abstract class egw_framework
'filter' => $filters
);
$result = $prefs->add($app,$pref_name,$filters,$type);
$prefs->save_repository(false,$type);
$pref = $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()->call('egw.set_preferences', (array)$pref[$app], $app);
egw_json_response::get()->data(isset($result[$app][$pref_name]));
return isset($result[$app][$pref_name]);
@ -2027,13 +2024,10 @@ abstract class egw_framework
else if ($action == "delete")
{
$result = $prefs->delete($app,$pref_name, $type);
$prefs->save_repository(false,$type);
$pref = $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()->call('egw.set_preferences', (array)$pref[$app], $app);
egw_json_response::get()->data(!isset($result[$app][$pref_name]));
return !isset($result[$app][$pref_name]);

View File

@ -26,8 +26,9 @@ include '../header.inc.php';
// use an etag over config and link-registry
$preferences = json_encode($GLOBALS['egw_info']['user']['preferences']['common']);
$ab_preferences = json_encode($GLOBALS['egw_info']['user']['preferences']['addressbook']);
$user = $GLOBALS['egw']->accounts->json($GLOBALS['egw_info']['user']['account_id']);
$etag = '"'.md5($preferences.$user).'"';
$etag = '"'.md5($preferences.$ab_preferences.$user).'"';
// headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header
egw_session::cache_control(86400); // cache for 1 day
@ -42,6 +43,7 @@ if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $
}
$content = 'egw.set_preferences('.$preferences.", 'common');\n";
$content .= 'egw.set_preferences('.$ab_preferences.", 'addressbook');\n";
$content .= 'egw.set_user('.$user.");\n";
// we run our own gzip compression, to set a correct Content-Length of the encoded content