mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
reworked preferences (ported from .16 incl. fixes):
- not set user-prefs use the default value, default values have been used only for new accounts before - preference-table has new column preference_app - preferences got automaticaly quoted now, eg. its save to use single and double quotes as well as backslashs
This commit is contained in:
parent
f81afd60a9
commit
21d8e8fd62
@ -26,7 +26,11 @@
|
||||
/*!
|
||||
@class preferences
|
||||
@abstract preferences class used for setting application preferences
|
||||
@discussion Author: none yet
|
||||
@discussion the prefs are read into 4 arrays: \
|
||||
$data the effective prefs used everywhere in phpgw, they are merged from the other 3 arrays \
|
||||
$user the stored user prefs, only used for manipulating and storeing the user prefs \
|
||||
$default the default preferences, always used when the user has no own preference set \
|
||||
$forced forced preferences set by the admin, they take precedence over user or default prefs
|
||||
*/
|
||||
class preferences
|
||||
{
|
||||
@ -34,8 +38,14 @@
|
||||
var $account_id;
|
||||
/*! @var account_type */
|
||||
var $account_type;
|
||||
/*! @var data */
|
||||
/*! @var data effectiv user prefs, used by all apps */
|
||||
var $data = array();
|
||||
/*! @var user set user prefs for saveing (no defaults/forced prefs merged) */
|
||||
var $user = array();
|
||||
/*! @var default default prefs */
|
||||
var $default = array();
|
||||
/*! @var forced forced prefs */
|
||||
var $forced = array();
|
||||
/*! @var db */
|
||||
var $db;
|
||||
/*! @var debug_init_prefs */
|
||||
@ -62,45 +72,120 @@
|
||||
* These are the standard $this->account_id specific functions *
|
||||
\**************************************************************************/
|
||||
|
||||
/*!
|
||||
@function unquote
|
||||
@abstract unquote (stripslashes) recursivly the whole array
|
||||
@param $arr array to unquote (var-param!)
|
||||
*/
|
||||
function unquote(&$arr)
|
||||
{
|
||||
if (!is_array($arr))
|
||||
{
|
||||
$arr = stripslashes($arr);
|
||||
return;
|
||||
}
|
||||
foreach($arr as $key => $value)
|
||||
{
|
||||
if (is_array($value))
|
||||
{
|
||||
$this->unquote($arr[$key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$arr[$key] = stripslashes($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@function read_repository
|
||||
@abstract private - read preferences from the repository
|
||||
@note the function ready all 3 prefs user/default/forced and merges them to the effective ones
|
||||
@discussion private function should only be called from within this class
|
||||
*/
|
||||
function read_repository()
|
||||
{
|
||||
$this->db->query("SELECT * FROM phpgw_preferences WHERE "
|
||||
. "preference_owner='" . $this->account_id . "' OR "
|
||||
. "preference_owner='-1' ORDER BY preference_owner DESC",__LINE__,__FILE__);
|
||||
$this->db->next_record();
|
||||
$this->db->query("SELECT * FROM phpgw_preferences".
|
||||
" WHERE preference_owner IN (-1,-2,".intval($this->account_id).")",__LINE__,__FILE__);
|
||||
|
||||
$pref_info = $this->db->f('preference_value');
|
||||
$this->data = unserialize($pref_info);
|
||||
|
||||
if ($this->db->next_record())
|
||||
$this->forced = $this->default = $this->user = array();
|
||||
while($this->db->next_record())
|
||||
{
|
||||
$global_defaults = unserialize($this->db->f('preference_value'));
|
||||
|
||||
while (is_array($global_defaults) && list($appname,$values) = each($global_defaults))
|
||||
$app = $this->db->f('preference_app');
|
||||
$value = unserialize($this->db->f('preference_value'));
|
||||
$this->unquote($value);
|
||||
if (!is_array($value))
|
||||
{
|
||||
while (is_array($values) && list($var,$value) = each($values))
|
||||
$value = array();
|
||||
}
|
||||
switch($this->db->f('preference_owner'))
|
||||
{
|
||||
case -1: // forced
|
||||
if (empty($app)) // db not updated
|
||||
{
|
||||
$this->forced = $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->forced[$app] = $value;
|
||||
}
|
||||
break;
|
||||
case -2: // default
|
||||
if (empty($app)) // db not updated
|
||||
{
|
||||
$this->default = $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->default[$app] = $value;
|
||||
}
|
||||
break;
|
||||
default: // user
|
||||
if (empty($app)) // db not updated
|
||||
{
|
||||
$this->user = $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->user[$app] = $value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->data = $this->user;
|
||||
|
||||
// now use defaults if needed (user-value unset or empty)
|
||||
//
|
||||
foreach($this->default as $app => $values)
|
||||
{
|
||||
foreach($values as $var => $value)
|
||||
{
|
||||
if (!isset($this->data[$app][$var]) || $this->data[$app][$var] === '')
|
||||
{
|
||||
$this->data[$appname][$var] = $value;
|
||||
$this->data[$app][$var] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* This is to supress warnings during login */
|
||||
if (is_array($this->data))
|
||||
// now set/force forced values
|
||||
//
|
||||
foreach($this->forced as $app => $values)
|
||||
{
|
||||
reset ($this->data);
|
||||
foreach($values as $var => $value)
|
||||
{
|
||||
$this->data[$app][$var] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// This is to supress warnings durring login
|
||||
if (is_array($this->data))
|
||||
{
|
||||
reset($this->data);
|
||||
}
|
||||
if ($this->debug && substr($GLOBALS['phpgw_info']['flags']['currentapp'],0,3) != 'log') {
|
||||
echo "user<pre>"; print_r($this->user); echo "</pre>\n";
|
||||
echo "forced<pre>"; print_r($this->forced); echo "</pre>\n";
|
||||
echo "default<pre>"; print_r($this->default); echo "</pre>\n";
|
||||
echo "effectiv<pre>";print_r($this->data); echo "</pre>\n";
|
||||
}
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
@ -128,16 +213,18 @@
|
||||
@param $app_name name of the app
|
||||
@param $var name of preference to be stored
|
||||
@param $value value of the preference
|
||||
@note the function works on user and data, to be able to save the pref and to have imediate effect
|
||||
*/
|
||||
function add($app_name,$var,$value = '')
|
||||
{
|
||||
//echo "<p>add('$app_name','$var','$value')</p>\n";
|
||||
if ($value == '')
|
||||
{
|
||||
global $$var;
|
||||
$value = $$var;
|
||||
}
|
||||
|
||||
$this->data[$app_name][$var] = $value;
|
||||
$this->user[$app_name][$var] = $this->data[$app_name][$var] = $value;
|
||||
reset($this->data);
|
||||
return $this->data;
|
||||
}
|
||||
@ -148,17 +235,21 @@
|
||||
@discussion
|
||||
@param $app_name name of app
|
||||
@param $var variable to be deleted
|
||||
@note the function works on user and data, to be able to save the pref and to have imediate effect
|
||||
*/
|
||||
function delete($app_name, $var = '')
|
||||
{
|
||||
//echo "<p>delete('$app_name','$var')</p>\n";
|
||||
if (is_string($var) && $var == '')
|
||||
{
|
||||
// $this->data[$app_name] = array();
|
||||
unset($this->data[$app_name]);
|
||||
unset($this->user[$app_name]);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($this->data[$app_name][$var]);
|
||||
unset($this->user[$app_name][$var]);
|
||||
}
|
||||
reset ($this->data);
|
||||
return $this->data;
|
||||
@ -169,15 +260,27 @@
|
||||
@abstract add complex array data preference to $app_name a particular app
|
||||
@discussion Use for sublevels of prefs, such as email app's extra accounts preferences
|
||||
@param $app_name name of the app
|
||||
@param $var String to be evaled's as an ARRAY structure, name of preference to be stored
|
||||
@param $var array keys separated by '/', eg. 'ex_accounts/1'
|
||||
@param $value value of the preference
|
||||
@note the function works on user and data, to be able to save the pref and to have imediate effect
|
||||
*/
|
||||
function add_struct($app_name,$var,$value = '')
|
||||
{
|
||||
/* eval is slow and dangerous
|
||||
$code = '$this->data[$app_name]'.$var.' = $value;';
|
||||
//echo 'class.preferences: add_struct: $code: '.$code.'<br>';
|
||||
eval($code);
|
||||
//echo 'class.preferences: add_struct: $this->data[$app_name] dump:'; _debug_array($this->data[$app_name]); echo '<br>';
|
||||
*/
|
||||
$parts = explode('/',str_replace(array('][','[',']','"',"'"),array('/','','','',''),$var));
|
||||
$data = &$this->data[$app_name];
|
||||
$user = &$this->user[$app_name];
|
||||
foreach($parts as $name)
|
||||
{
|
||||
$data = &$data[$name];
|
||||
$user = &$user[$name];
|
||||
}
|
||||
$data = $user = $value;
|
||||
print_debug('class.preferences: add_struct: $this->data[$app_name] dump:', $this->data[$app_name],'api');
|
||||
reset($this->data);
|
||||
return $this->data;
|
||||
}
|
||||
@ -187,47 +290,104 @@
|
||||
@abstract delete complex array data preference from $app_name
|
||||
@discussion Use for sublevels of prefs, such as email app's extra accounts preferences
|
||||
@param $app_name name of app
|
||||
@param $var String to be evaled's as an ARRAY structure, name of preference to be deleted
|
||||
@param $var array keys separated by '/', eg. 'ex_accounts/1'
|
||||
@note the function works on user and data, to be able to save the pref and to have imediate effect
|
||||
*/
|
||||
function delete_struct($app_name, $var = '')
|
||||
{
|
||||
/* eval is slow and dangerous
|
||||
$code_1 = '$this->data[$app_name]'.$var.' = "";';
|
||||
//echo 'class.preferences: delete_struct: $code_1: '.$code_1.'<br>';
|
||||
eval($code_1);
|
||||
$code_2 = 'unset($this->data[$app_name]'.$var.');' ;
|
||||
//echo 'class.preferences: delete_struct: $code_2: '.$code_2.'<br>';
|
||||
eval($code_2);
|
||||
//echo ' * $this->data[$app_name] dump:'; _debug_array($this->data[$app_name]); echo '<br>';
|
||||
*/
|
||||
$parts = explode('/',str_replace(array('][','[',']','"',"'"),array('/','','','',''),$var));
|
||||
$last = array_pop($parts);
|
||||
$data = &$this->data[$app_name];
|
||||
$user = &$this->user[$app_name];
|
||||
foreach($parts as $name)
|
||||
{
|
||||
$data = &$data[$name];
|
||||
$user = &$user[$name];
|
||||
}
|
||||
unset($data[$last]);
|
||||
unset($user[$last]);
|
||||
print_debug('* $this->data[$app_name] dump:', $this->data[$app_name],'api');
|
||||
reset ($this->data);
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
@function save_repository
|
||||
@abstract save the the preferences to the repository
|
||||
@discussion
|
||||
@function quote
|
||||
@abstract quote (addslashes) recursivly the whole array
|
||||
@param $arr array to unquote (var-param!)
|
||||
*/
|
||||
function save_repository($update_session_info = False)
|
||||
function quote(&$arr)
|
||||
{
|
||||
$temp_data = $this->data;
|
||||
if (! $GLOBALS['phpgw']->acl->check('session_only_preferences',1,'preferences'))
|
||||
if (!is_array($arr))
|
||||
{
|
||||
$this->db->transaction_begin();
|
||||
$this->db->query("DELETE FROM phpgw_preferences WHERE preference_owner=" . intval($this->account_id),
|
||||
__LINE__,__FILE__);
|
||||
|
||||
if (floor(phpversion()) < 4)
|
||||
$arr = addslashes($arr);
|
||||
return;
|
||||
}
|
||||
foreach($arr as $key => $value)
|
||||
{
|
||||
if (is_array($value))
|
||||
{
|
||||
$pref_info = addslashes(serialize($this->data));
|
||||
$this->quote($arr[$key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pref_info = serialize($this->data);
|
||||
$arr[$key] = addslashes($value);
|
||||
}
|
||||
$this->db->query("INSERT INTO phpgw_preferences (preference_owner,preference_value) VALUES ("
|
||||
. intval($this->account_id) . ",'" . $pref_info . "')",__LINE__,__FILE__);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@function save_repository
|
||||
@abstract save the the preferences to the repository
|
||||
@syntax save_repository($update_session_info = False,$type='')
|
||||
@param $update_session_info old param, seems not to be used
|
||||
@param $type which prefs to update: user/default/forced
|
||||
@note the user prefs for saveing are in $this->user not in $this->data, which are the effectiv prefs only
|
||||
*/
|
||||
function save_repository($update_session_info = False,$type='user')
|
||||
{
|
||||
switch($type)
|
||||
{
|
||||
case 'forced':
|
||||
$account_id = -1;
|
||||
$prefs = &$this->forced;
|
||||
break;
|
||||
case 'default':
|
||||
$account_id = -2;
|
||||
$prefs = &$this->default;
|
||||
break;
|
||||
default:
|
||||
$account_id = intval($this->account_id);
|
||||
$prefs = &$this->user; // we use the user-array as data contains default values too
|
||||
break;
|
||||
}
|
||||
//echo "<p>preferences::save_repository(,$type): account_id=$account_id, prefs="; print_r($prefs); echo "</p>\n";
|
||||
|
||||
if (! $GLOBALS['phpgw']->acl->check('session_only_preferences',1,'preferences'))
|
||||
{
|
||||
$this->db->transaction_begin();
|
||||
$this->db->query("delete from phpgw_preferences where preference_owner=$account_id",
|
||||
__LINE__,__FILE__);
|
||||
|
||||
foreach($prefs as $app => $value)
|
||||
{
|
||||
if (!is_array($value)) continue;
|
||||
$this->quote($value);
|
||||
$value = $this->db->db_addslashes(serialize($value)); // this addslashes is for the database
|
||||
$app = $this->db->db_addslashes($app);
|
||||
|
||||
$this->db->query($sql = "INSERT INTO phpgw_preferences".
|
||||
" (preference_owner,preference_app,preference_value)".
|
||||
" VALUES ($account_id,'$app','$value')",__LINE__,__FILE__);
|
||||
}
|
||||
$this->db->transaction_commit();
|
||||
}
|
||||
else
|
||||
@ -236,13 +396,13 @@
|
||||
$GLOBALS['phpgw']->session->save_repositories();
|
||||
}
|
||||
|
||||
if ($GLOBALS['phpgw_info']['server']['cache_phpgw_info'] && $this->account_id == $GLOBALS['phpgw_info']['user']['account_id'])
|
||||
if (($type == 'user' || !$type) && $GLOBALS['phpgw_info']['server']['cache_phpgw_info'] && $this->account_id == $GLOBALS['phpgw_info']['user']['account_id'])
|
||||
{
|
||||
$GLOBALS['phpgw']->session->delete_cache($this->account_id);
|
||||
$GLOBALS['phpgw']->session->read_repositories(False);
|
||||
}
|
||||
|
||||
return $temp_data;
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -253,7 +413,8 @@
|
||||
*/
|
||||
function create_defaults($account_id)
|
||||
{
|
||||
$this->db->query("SELECT * FROM phpgw_preferences WHERE preference_owner='-2'",__LINE__,__FILE__);
|
||||
return; // not longer needed, as the defaults are merged in on runtime
|
||||
$this->db->query("select * from phpgw_preferences where preference_owner='-2'",__LINE__,__FILE__);
|
||||
$this->db->next_record();
|
||||
|
||||
if($this->db->f('preference_value'))
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/* Basic information about this app */
|
||||
$setup_info['phpgwapi']['name'] = 'phpgwapi';
|
||||
$setup_info['phpgwapi']['version'] = '0.9.15.010';
|
||||
$setup_info['phpgwapi']['version'] = '0.9.15.011';
|
||||
$setup_info['phpgwapi']['versions']['current_header'] = '1.23';
|
||||
$setup_info['phpgwapi']['enable'] = 3;
|
||||
$setup_info['phpgwapi']['app_order'] = 1;
|
||||
|
@ -72,10 +72,11 @@
|
||||
),
|
||||
'phpgw_preferences' => array(
|
||||
'fd' => array(
|
||||
'preference_owner' => array('type' => 'int', 'precision' => 4, 'nullable' => false),
|
||||
'preference_value' => array('type' => 'text')
|
||||
'preference_owner' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'preference_app' => array('type' => 'varchar','precision' => '25','nullable' => False),
|
||||
'preference_value' => array('type' => 'text','nullable' => False)
|
||||
),
|
||||
'pk' => array('preference_owner'),
|
||||
'pk' => array('preference_owner','preference_app'),
|
||||
'fk' => array(),
|
||||
'ix' => array(),
|
||||
'uc' => array()
|
||||
|
@ -105,12 +105,24 @@
|
||||
// 0.9.14.5xx are the development-versions of the 0.9.16 release (based on the 0.9.14 api)
|
||||
// as 0.9.15.xxx are already used in HEAD
|
||||
|
||||
// 0.9.15.001-10 are already included in 0.9.14.502
|
||||
// 0.9.15.001-9 are already included in 0.9.14.502
|
||||
|
||||
$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.010';
|
||||
return $GLOBALS['setup_info']['phpgwapi']['currentver'];
|
||||
}
|
||||
|
||||
$test[] = '0.9.14.503';
|
||||
function phpgwapi_upgrade0_9_14_503()
|
||||
{
|
||||
// 0.9.14.5xx are the development-versions of the 0.9.16 release (based on the 0.9.14 api)
|
||||
// as 0.9.15.xxx are already used in HEAD
|
||||
|
||||
// 0.9.15.001-11 are already included in 0.9.14.503
|
||||
|
||||
$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.011';
|
||||
return $GLOBALS['setup_info']['phpgwapi']['currentver'];
|
||||
}
|
||||
|
||||
$test[] = '0.9.15.001';
|
||||
function phpgwapi_upgrade0_9_15_001()
|
||||
{
|
||||
@ -292,5 +304,48 @@
|
||||
return $GLOBALS['setup_info']['phpgwapi']['currentver'];
|
||||
}
|
||||
|
||||
$test[] = '0.9.15.010';
|
||||
function phpgwapi_upgrade0_9_15_010()
|
||||
{
|
||||
$GLOBALS['phpgw_setup']->oProc->RenameTable('phpgw_preferences','old_preferences');
|
||||
|
||||
$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_preferences',array(
|
||||
'fd' => array(
|
||||
'preference_owner' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'preference_app' => array('type' => 'varchar','precision' => '25','nullable' => False),
|
||||
'preference_value' => array('type' => 'text','nullable' => False)
|
||||
),
|
||||
'pk' => array('preference_owner','preference_app'),
|
||||
'fk' => array(),
|
||||
'ix' => array(),
|
||||
'uc' => array()
|
||||
));
|
||||
$db2 = $GLOBALS['phpgw_setup']->db; // we need a 2. result-set
|
||||
$GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM old_preferences");
|
||||
while ($GLOBALS['phpgw_setup']->oProc->next_record())
|
||||
{
|
||||
$owner = intval($GLOBALS['phpgw_setup']->oProc->f('preference_owner'));
|
||||
$prefs = unserialize($GLOBALS['phpgw_setup']->oProc->f('preference_value'));
|
||||
|
||||
if (is_array($prefs))
|
||||
{
|
||||
foreach ($prefs as $app => $pref)
|
||||
{
|
||||
if (!empty($app) && count($pref))
|
||||
{
|
||||
$app = addslashes($app);
|
||||
$pref = serialize($pref);
|
||||
$db2->query("INSERT INTO phpgw_preferences".
|
||||
" (preference_owner,preference_app,preference_value)".
|
||||
" VALUES ($owner,'$app','$pref')");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$GLOBALS['phpgw_setup']->oProc->DropTable('old_preferences');
|
||||
|
||||
$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.011';
|
||||
return $GLOBALS['setup_info']['phpgwapi']['currentver'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -24,9 +24,9 @@
|
||||
}
|
||||
|
||||
create_input_box('Max matches per page','maxmatchs',
|
||||
'Any listing in phpGW will show you this number or entries or lines per page.<br>To many slow down the page display, to less will cost you the overview.',15,3);
|
||||
'Any listing in phpGW will show you this number of entries or lines per page.<br>To many slow down the page display, to less will cost you the overview.','',3);
|
||||
create_select_box('Interface/Template Selection','template_set',$_templates,
|
||||
'A template defines the layout of phpGroupWare and it contains icons vor each application.');
|
||||
'A template defines the layout of phpGroupWare and it contains icons for each application.');
|
||||
create_select_box('Theme (colors/fonts) Selection','theme',$_themes,
|
||||
'A theme defines the colors and fonts used by the template.');
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
$tz_offset[$i] = $i . ' ' . lang('hours').': ' . date($format,$t);
|
||||
}
|
||||
create_select_box('Time zone offset','tz_offset',$tz_offset,
|
||||
'How many hours are you in front or after the timezone of the server.<br>If you are in the same time zone as the server select 0 hours, else select your locale date and time.',0);
|
||||
'How many hours are you in front or after the timezone of the server.<br>If you are in the same time zone as the server select 0 hours, else select your locale date and time.');
|
||||
|
||||
$date_formats = array(
|
||||
'm/d/Y' => 'm/d/Y',
|
||||
@ -112,7 +112,7 @@
|
||||
}
|
||||
}
|
||||
create_select_box('Default application','default_app',$user_apps,
|
||||
"This is the application which will be started when you enter phpGroupWare or click on the homepage icon.<br>You can also have more than one applications showing up on the homepage, if you don't choose a specific application here (has to be configured in the preferences of each applicaton).");
|
||||
"This is the application which will be started when you enter phpGroupWare or click on the homepage icon.<br>You can also have more than one application showing up on the homepage, if you don't choose a specific application here (has to be configured in the preferences of each application).");
|
||||
|
||||
create_input_box('Currency','currency',
|
||||
'Which currency symbole or name should be used in phpGroupWare.');
|
||||
|
@ -59,7 +59,7 @@
|
||||
|
||||
function is_forced_value($_appname,$preference_name)
|
||||
{
|
||||
if (isset($GLOBALS['gp']->data[$_appname][$preference_name]) && $GLOBALS['type'] != 'forced')
|
||||
if (isset($GLOBALS['phpgw']->preferences->forced[$_appname][$preference_name]) && $GLOBALS['type'] != 'forced')
|
||||
{
|
||||
return True;
|
||||
}
|
||||
@ -109,7 +109,12 @@
|
||||
$default = $prefs[$name];
|
||||
}
|
||||
|
||||
$t->set_var('row_value',"<input name=\"${GLOBALS[type]}[$name]\" value=\"$default\"$options>");
|
||||
if ($GLOBALS['type'] == 'user')
|
||||
{
|
||||
$def_text = $GLOBALS['phpgw']->preferences->default[$_appname][$name];
|
||||
$def_text = $def_text != '' ? ' <i><font size="-1">'.lang('default').': '.$def_text.'</font></i>' : '';
|
||||
}
|
||||
$t->set_var('row_value',"<input name=\"${GLOBALS[type]}[$name]\" value=\"".htmlentities($default)."\"$options>$def_text");
|
||||
$t->set_var('row_name',lang($label));
|
||||
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
|
||||
|
||||
@ -186,17 +191,22 @@
|
||||
switch ($GLOBALS['type'])
|
||||
{
|
||||
case 'user':
|
||||
$s = '<option value="">' . lang('Select one') . '</option>';
|
||||
$s = '<option value="">' . lang('Use default') . '</option>';
|
||||
break;
|
||||
case 'default':
|
||||
$s = '<option value="">' . lang('Select one') . '</option>';
|
||||
$s = '<option value="">' . lang('No default') . '</option>';
|
||||
break;
|
||||
case 'forced':
|
||||
$s = '<option value="**NULL**">' . lang('Users choice') . '</option>';
|
||||
break;
|
||||
}
|
||||
$s .= create_option_string($default,$values);
|
||||
$t->set_var('row_value',"<select name=\"${GLOBALS[type]}[$name]\">$s</select>");
|
||||
if ($GLOBALS['type'] == 'user')
|
||||
{
|
||||
$def_text = $GLOBALS['phpgw']->preferences->default[$_appname][$name];
|
||||
$def_text = $def_text != '' ? ' <i><font size="-1">'.lang('default').': '.$values[$def_text].'</font></i>' : '';
|
||||
}
|
||||
$t->set_var('row_value',"<select name=\"${GLOBALS[type]}[$name]\">$s</select>$def_text");
|
||||
$t->set_var('row_name',lang($label));
|
||||
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
|
||||
|
||||
@ -218,18 +228,23 @@
|
||||
$default = $prefs[$name];
|
||||
}
|
||||
|
||||
$t->set_var('row_value',"<textarea rows=\"$rows\" cols=\"$cols\" name=\"${GLOBALS[type]}[$name]\">$default</textarea>");
|
||||
if ($GLOBALS['type'] == 'user')
|
||||
{
|
||||
$def_text = $GLOBALS['phpgw']->preferences->default[$_appname][$name];
|
||||
$def_text = $def_text != '' ? '<br><i><font size="-1">'.lang('default').':<br>'.$def_text.'</font></i>' : '';
|
||||
}
|
||||
$t->set_var('row_value',"<textarea rows=\"$rows\" cols=\"$cols\" name=\"${GLOBALS[type]}[$name]\">".htmlentities($default)."</textarea>$def_text");
|
||||
$t->set_var('row_name',lang($label));
|
||||
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
|
||||
|
||||
$t->fp('rows',process_help($help) ? 'help_row' : 'row',True);
|
||||
}
|
||||
|
||||
function process_array(&$_p,$array,$prefix='')
|
||||
function process_array(&$repository,$array,$prefix='')
|
||||
{
|
||||
$_appname = check_app();
|
||||
|
||||
$prefs = &$_p->data[$_appname];
|
||||
$prefs = &$repository[$_appname];
|
||||
|
||||
if ($prefix != '')
|
||||
{
|
||||
@ -239,6 +254,8 @@
|
||||
$prefs = &$prefs[$pre];
|
||||
}
|
||||
}
|
||||
unset($prefs['']);
|
||||
//echo "array:<pre>"; print_r($array); echo "</pre>\n";
|
||||
while (is_array($array) && list($var,$value) = each($array))
|
||||
{
|
||||
if (isset($value) && $value != '' && $value != '**NULL**')
|
||||
@ -251,23 +268,18 @@
|
||||
continue; // dont write empty password-fields
|
||||
}
|
||||
}
|
||||
$prefs[$var] = $value;
|
||||
$prefs[$var] = stripslashes($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($prefs[$var]);
|
||||
}
|
||||
}
|
||||
//echo "prefix='$prefix', prefs=<pre>"; print_r($_p->data[$_appname]);
|
||||
//echo "prefix='$prefix', prefs=<pre>"; print_r($repository[$_appname]); echo "</pre>\n";
|
||||
|
||||
$_p->save_repository(True);
|
||||
$GLOBALS['phpgw']->preferences->save_repository(True,$GLOBALS['type']);
|
||||
}
|
||||
|
||||
/* So we can check if the admin is allowing users to make there own choices */
|
||||
/* in life. */
|
||||
$GLOBALS['gp'] = createobject('phpgwapi.preferences',-1);
|
||||
$GLOBALS['gp']->read_repository();
|
||||
|
||||
/* Only check this once */
|
||||
if ($GLOBALS['phpgw']->acl->check('run',1,'admin'))
|
||||
{
|
||||
@ -331,29 +343,22 @@
|
||||
}
|
||||
$has_help = 0;
|
||||
|
||||
/* Only load if there working on the default preferences */
|
||||
if ($GLOBALS['type'] == 'default')
|
||||
{
|
||||
$GLOBALS['dp'] = createobject('phpgwapi.preferences',-2);
|
||||
$GLOBALS['dp']->read_repository();
|
||||
}
|
||||
|
||||
if ($_POST['submit'])
|
||||
{
|
||||
/* Don't use a switch here, we need to check some permissions durring the ifs */
|
||||
if ($GLOBALS['type'] == 'user' || !($GLOBALS['type']))
|
||||
{
|
||||
process_array($GLOBALS['phpgw']->preferences,$user,$prefix);
|
||||
process_array($GLOBALS['phpgw']->preferences->user,$user,$prefix);
|
||||
}
|
||||
|
||||
if ($GLOBALS['type'] == 'default' && is_admin())
|
||||
{
|
||||
process_array($GLOBALS['dp'], $default);
|
||||
process_array($GLOBALS['phpgw']->preferences->default, $default);
|
||||
}
|
||||
|
||||
if ($GLOBALS['type'] == 'forced' && is_admin())
|
||||
{
|
||||
process_array($GLOBALS['gp'], $forced);
|
||||
process_array($GLOBALS['phpgw']->preferences->forced, $forced);
|
||||
}
|
||||
|
||||
if (!is_admin())
|
||||
@ -386,13 +391,13 @@
|
||||
switch ($GLOBALS['type']) // set up some globals to be used by the hooks
|
||||
{
|
||||
case 'forced':
|
||||
$prefs = &$GLOBALS['gp']->data[check_app()];
|
||||
$prefs = &$GLOBALS['phpgw']->preferences->forced[check_app()];
|
||||
break;
|
||||
case 'default':
|
||||
$prefs = &$GLOBALS['dp']->data[check_app()];
|
||||
$prefs = &$GLOBALS['phpgw']->preferences->default[check_app()];
|
||||
break;
|
||||
default:
|
||||
$prefs = &$GLOBALS['phpgw']->preferences->data[check_app()];
|
||||
$prefs = &$GLOBALS['phpgw']->preferences->user[check_app()];
|
||||
// use prefix if given in the url, used for email extra-accounts
|
||||
if ($prefix != '')
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
%1 - preferences preferences de %1 - Einstellungen
|
||||
%1 hours preferences de %1 Stunden
|
||||
12 hour preferences de 12 Stunden
|
||||
24 hour preferences de 24 Stunden
|
||||
a template defines the layout of phpgroupware and it contains icons for each application. preferences de Die Benutzeroberfläche definert das Layout von phpGroupWare und enthält die Icons (Symbole) der Andwendungen.
|
||||
@ -11,6 +12,7 @@ change your profile preferences de Profil
|
||||
change your settings preferences de Einstellungen ändern
|
||||
country preferences de Land
|
||||
date format preferences de Datumsformat
|
||||
default preferences de Vorgabe
|
||||
default application preferences de Standard-Anwendung
|
||||
default preferences preferences de Voreinstellungen
|
||||
delete categories preferences de Kategorie Löschen
|
||||
@ -31,6 +33,7 @@ interface/template selection preferences de Auswahl der Benutzeroberfl
|
||||
language preferences de Sprache
|
||||
max matches per page preferences de maximale Treffer pro Seite
|
||||
max matchs per page preferences de Maximale Treffer pro Seite
|
||||
no default preferences de Keine Vorgabe
|
||||
note: this feature does *not* change your email password. this will need to be done manually. preferences de Hinweis: Diese Funktion ändert *nicht* Ihr Passwort auf dem E-Mail server. Dies müssen sie separat tun.
|
||||
please, select a new theme preferences de Bitte ein neues Schema wählen
|
||||
re-enter your password preferences de Neues Passwort wiederholen
|
||||
@ -50,6 +53,7 @@ theme (colors/fonts) selection preferences de Auswahl des Themas (Farben/Schrift
|
||||
this is the application which will be started when you enter phpgroupware or click on the homepage icon.<br>you can also have more than one application showing up on the homepage, if you don't choose a specific application here (has to be configured in the preferences of each application). preferences de Diese Anwendung wird gestartet, wenn sie phpGroupWare neu starten oder auf das Symbol der Startseite klicken. Sie können auch mehrere Anwendungen auf ihrer Startseite anzeigen, dazu wählen sie keine Anwendung aus. Welche Anwendungen dann angezeigt werden, wird in den Einstellungen der jeweiligen Anwendungen konfiguriert.
|
||||
this server is located in the %1 timezone preferences de Der Server befindet sich in der Zeitzone %1
|
||||
time format preferences de Zeitformat
|
||||
use default preferences de Vorgabe benutzen
|
||||
users choice preferences de Benutzerauswahl
|
||||
which currency symbole or name should be used in phpgroupware. preferences de Welches Währungssymbol oder Name soll in phpGroupWare verwendet werden.
|
||||
you can show the applications as icons only, icons with app-name or both. preferences de Sie können die Anwendungen als Symbol (Icon), Text oder beides anzeigen.
|
||||
|
@ -1,4 +1,5 @@
|
||||
%1 - preferences preferences en %1 - Preferences
|
||||
%1 hours preferences en %1 hours
|
||||
12 hour preferences en 12 hour
|
||||
24 hour preferences en 24 hour
|
||||
a template defines the layout of phpgroupware and it contains icons vor each application. preferences en A template defines the layout of phpGroupWare and it contains icons vor each application.
|
||||
@ -11,6 +12,7 @@ change your profile preferences en Change your profile
|
||||
change your settings preferences en Change your Settings
|
||||
country preferences en Country
|
||||
date format preferences en Date format
|
||||
default preferences en default
|
||||
default application preferences en Default application
|
||||
default preferences preferences en Default Preferences
|
||||
delete categories preferences en Delete Categories
|
||||
@ -30,6 +32,7 @@ in which country are you. this is used to set certain defaults for you. preferen
|
||||
interface/template selection preferences en Interface/Template Selection
|
||||
language preferences en Language
|
||||
max matches per page preferences en Max matches per page
|
||||
no default preferences en No default
|
||||
note: this feature does *not* change your email password. this will need to be done manually. preferences en Note: This feature does *not* change your email password. This will need to be done manually.
|
||||
please, select a new theme preferences en Please, select a new theme
|
||||
re-enter your password preferences en Re-Enter your password
|
||||
@ -48,6 +51,7 @@ theme (colors/fonts) selection preferences en Theme (colors/fonts) Selection
|
||||
this is the application which will be started when you enter phpgroupware or click on the homepage icon.<br>you can also have more than one applications showing up on the homepage, if you don't choose a specific application here (has to be configured in the preferences of each applicaton). preferences en This is the application which will be started when you enter phpGroupWare or click on the homepage icon.<br>You can also have more than one applications showing up on the homepage, if you don't choose a specific application here (has to be configured in the preferences of each applicaton).
|
||||
this server is located in the %1 timezone preferences en This server is located in the %1 timezone
|
||||
time format preferences en Time format
|
||||
use default preferences en Use default
|
||||
users choice preferences en Users choice
|
||||
which currency symbole or name should be used in phpgroupware. preferences en Which currency symbole or name should be used in phpGroupWare.
|
||||
you can show the applications as icons only, icons with app-name or both. preferences en You can show the applications as icons only, icons with app-name or both.
|
||||
|
Loading…
Reference in New Issue
Block a user