mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
get preferences working again
This commit is contained in:
parent
ca8cf03ff2
commit
eb10db6e3f
@ -43,30 +43,23 @@
|
||||
$this->xmlrpc = @is_object($GLOBALS['server']) && $GLOBALS['server']->last_method;
|
||||
$this->session_data = $GLOBALS['egw']->session->appsession('session_data','preferences');
|
||||
|
||||
if($appname)
|
||||
{
|
||||
$this->call_hook($appname);
|
||||
}
|
||||
$this->appname = $appname;
|
||||
}
|
||||
|
||||
function save_session($appname,$type,$show_help,$prefix)
|
||||
function save_session($appname,$type,$show_help,$prefix,$notifies='')
|
||||
{
|
||||
$GLOBALS['egw']->session->appsession('session_data','preferences',array(
|
||||
'type' => $type, // save our state in the app-session
|
||||
'show_help' => $show_help,
|
||||
'prefix' => $prefix,
|
||||
'appname' => $appname // we use this to reset prefix on appname-change
|
||||
'appname' => $appname, // we use this to reset prefix on appname-change
|
||||
'notifies' => $notifies,
|
||||
));
|
||||
}
|
||||
|
||||
function call_hook($appname)
|
||||
{
|
||||
$this->appname = $appname;
|
||||
if(!$GLOBALS['egw']->hooks->single('settings',$this->appname))
|
||||
{
|
||||
return False;
|
||||
}
|
||||
$this->settings = array_merge($this->settings,$GLOBALS['settings']);
|
||||
|
||||
$GLOBALS['egw']->translation->add_app($this->appname);
|
||||
if($this->appname != 'preferences')
|
||||
@ -74,6 +67,12 @@
|
||||
$GLOBALS['egw']->translation->add_app('preferences'); // we need the prefs translations too
|
||||
}
|
||||
|
||||
if(!$GLOBALS['egw']->hooks->single('settings',$this->appname))
|
||||
{
|
||||
return False;
|
||||
}
|
||||
$this->settings = array_merge($this->settings,$GLOBALS['settings']);
|
||||
|
||||
/* Remove ui-only settings */
|
||||
if($this->xmlrpc)
|
||||
{
|
||||
@ -165,11 +164,11 @@
|
||||
continue; // dont write empty password-fields
|
||||
}
|
||||
}
|
||||
$prefs[$var] = stripslashes($value);
|
||||
$prefs[$var] = get_magic_quotes_gpc() ? stripslashes($value) : $value;
|
||||
|
||||
if($notifies[$var]) // need to translate the key-words back
|
||||
if($this->session_data['notifies'][$var]) // need to translate the key-words back
|
||||
{
|
||||
$prefs[$var] = $GLOBALS['egw']->preferences->lang_notify($prefs[$var],$notifies[$var],True);
|
||||
$prefs[$var] = $GLOBALS['egw']->preferences->lang_notify($prefs[$var],$this->session_data['notifies'][$var],True);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
function uisettings()
|
||||
{
|
||||
$this->bo =& CreateObject('preferences.bosettings');
|
||||
$this->bo =& CreateObject('preferences.bosettings',$_GET['appname']);
|
||||
|
||||
if($GLOBALS['egw']->acl->check('run',1,'admin'))
|
||||
{
|
||||
@ -149,7 +149,7 @@
|
||||
{
|
||||
if($valarray['admin'])
|
||||
{
|
||||
next;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
switch($valarray['type'])
|
||||
@ -230,13 +230,7 @@
|
||||
// TODO - what is the purpose of this?
|
||||
if(count($notifies)) // there have been notifies in the hook, we need to save in the session
|
||||
{
|
||||
$this->bo->save_session(
|
||||
$GLOBALS['type'], // save our state in the app-session
|
||||
$this->show_help,
|
||||
$this->prefix,
|
||||
$_GET['appname'], // we use this to reset prefix on appname-change
|
||||
$notifies
|
||||
);
|
||||
$this->bo->save_session($_GET['appname'],$GLOBALS['type'],$this->show_help,$this->prefix,$notifies);
|
||||
//_debug_array($notifies);
|
||||
}
|
||||
if($this->is_admin())
|
||||
@ -404,7 +398,7 @@
|
||||
$s .= '<option value="' . $var . '"';
|
||||
if("$var" == "$selected") // the "'s are necessary to force a string-compare
|
||||
{
|
||||
$s .= ' selected';
|
||||
$s .= ' selected="1"';
|
||||
}
|
||||
$s .= '>' . $value . '</option>';
|
||||
}
|
||||
@ -490,8 +484,8 @@
|
||||
|
||||
$notifies[$name] = $vars; // this gets saved in the app_session for re-translation
|
||||
|
||||
$help = $help && $run_lang ? lang($help) : $help;
|
||||
if($subst_help)
|
||||
$help = $help && ($run_lang || is_null($run_lang)) ? lang($help) : $help;
|
||||
if($subst_help || is_null($subst_help))
|
||||
{
|
||||
$help .= '<p><b>'.lang('Substitutions and their meanings:').'</b>';
|
||||
foreach($vars as $var => $var_help)
|
||||
|
@ -70,9 +70,9 @@
|
||||
$sbox = createobject('phpgwapi.sbox');
|
||||
$langs = $GLOBALS['egw']->translation->get_installed_langs();
|
||||
|
||||
foreach($GLOBALS['egw_info']['user']['apps'] as $app)
|
||||
$user_apps = array();
|
||||
foreach($GLOBALS['egw_info']['user']['apps'] as $app => $data)
|
||||
{
|
||||
$app = $app[0];
|
||||
if($GLOBALS['egw_info']['apps'][$app]['status'] != 2 && $app)
|
||||
{
|
||||
$user_apps[$app] = $GLOBALS['egw_info']['apps'][$app]['title'] ? $GLOBALS['egw_info']['apps'][$app]['title'] : lang($app);
|
||||
|
Loading…
Reference in New Issue
Block a user