[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: preferences preferences.php,1.31,1.32
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: preferences preferences.php,1.31,1.32 |
Date: |
Thu, 01 May 2003 05:19:52 -0400 |
Update of /cvsroot/phpgroupware/preferences
In directory subversions:/tmp/cvs-serv20447
Modified Files:
preferences.php
Log Message:
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
Index: preferences.php
===================================================================
RCS file: /cvsroot/phpgroupware/preferences/preferences.php,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -r1.31 -r1.32
*** preferences.php 20 Apr 2003 20:43:26 -0000 1.31
--- preferences.php 1 May 2003 09:19:50 -0000 1.32
***************
*** 60,64 ****
function is_forced_value($_appname,$preference_name)
{
! if (isset($GLOBALS['gp']->data[$_appname][$preference_name]) &&
$GLOBALS['type'] != 'forced')
{
return True;
--- 60,64 ----
function is_forced_value($_appname,$preference_name)
{
! if
(isset($GLOBALS['phpgw']->preferences->forced[$_appname][$preference_name]) &&
$GLOBALS['type'] != 'forced')
{
return True;
***************
*** 110,114 ****
}
! $t->set_var('row_value',"<input
name=\"${GLOBALS[type]}[$name]\" value=\"$default\"$options>");
$t->set_var('row_name',lang($label));
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
--- 110,119 ----
}
! 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);
***************
*** 187,194 ****
{
case 'user':
! $s = '<option value="">' . lang('Select one') .
'</option>';
break;
case 'default':
! $s = '<option value="">' . lang('Select one') .
'</option>';
break;
case 'forced':
--- 192,199 ----
{
case 'user':
! $s = '<option value="">' . lang('Use default')
. '</option>';
break;
case 'default':
! $s = '<option value="">' . lang('No default') .
'</option>';
break;
case 'forced':
***************
*** 197,201 ****
}
$s .= create_option_string($default,$values);
! $t->set_var('row_value',"<select
name=\"${GLOBALS[type]}[$name]\">$s</select>");
$t->set_var('row_name',lang($label));
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
--- 202,211 ----
}
$s .= create_option_string($default,$values);
! 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);
***************
*** 219,223 ****
}
! $t->set_var('row_value',"<textarea rows=\"$rows\"
cols=\"$cols\" name=\"${GLOBALS[type]}[$name]\">$default</textarea>");
$t->set_var('row_name',lang($label));
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
--- 229,238 ----
}
! 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);
***************
*** 226,234 ****
}
! function process_array(&$_p,$array,$prefix='')
{
$_appname = check_app();
! $prefs = &$_p->data[$_appname];
if ($prefix != '')
--- 241,249 ----
}
! function process_array(&$repository,$array,$prefix='')
{
$_appname = check_app();
! $prefs = &$repository[$_appname];
if ($prefix != '')
***************
*** 240,243 ****
--- 255,260 ----
}
}
+ unset($prefs['']);
+ //echo "array:<pre>"; print_r($array); echo "</pre>\n";
while (is_array($array) && list($var,$value) = each($array))
{
***************
*** 252,256 ****
}
}
! $prefs[$var] = $value;
}
else
--- 269,273 ----
}
}
! $prefs[$var] = stripslashes($value);
}
else
***************
*** 259,272 ****
}
}
! //echo "prefix='$prefix', prefs=<pre>";
print_r($_p->data[$_appname]);
! $_p->save_repository(True);
}
- /* 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'))
--- 276,284 ----
}
}
! //echo "prefix='$prefix', prefs=<pre>";
print_r($repository[$_appname]); echo "</pre>\n";
!
$GLOBALS['phpgw']->preferences->save_repository(True,$GLOBALS['type']);
}
/* Only check this once */
if ($GLOBALS['phpgw']->acl->check('run',1,'admin'))
***************
*** 332,342 ****
$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'])
{
--- 344,347 ----
***************
*** 344,358 ****
if ($GLOBALS['type'] == 'user' || !($GLOBALS['type']))
{
!
process_array($GLOBALS['phpgw']->preferences,$user,$prefix);
}
if ($GLOBALS['type'] == 'default' && is_admin())
{
! process_array($GLOBALS['dp'], $default);
}
if ($GLOBALS['type'] == 'forced' && is_admin())
{
! process_array($GLOBALS['gp'], $forced);
}
--- 349,363 ----
if ($GLOBALS['type'] == 'user' || !($GLOBALS['type']))
{
!
process_array($GLOBALS['phpgw']->preferences->user,$user,$prefix);
}
if ($GLOBALS['type'] == 'default' && is_admin())
{
! process_array($GLOBALS['phpgw']->preferences->default,
$default);
}
if ($GLOBALS['type'] == 'forced' && is_admin())
{
! process_array($GLOBALS['phpgw']->preferences->forced,
$forced);
}
***************
*** 387,397 ****
{
case 'forced':
! $prefs = &$GLOBALS['gp']->data[check_app()];
break;
case 'default':
! $prefs = &$GLOBALS['dp']->data[check_app()];
break;
default:
! $prefs =
&$GLOBALS['phpgw']->preferences->data[check_app()];
// use prefix if given in the url, used for email
extra-accounts
if ($prefix != '')
--- 392,402 ----
{
case 'forced':
! $prefs =
&$GLOBALS['phpgw']->preferences->forced[check_app()];
break;
case 'default':
! $prefs =
&$GLOBALS['phpgw']->preferences->default[check_app()];
break;
default:
! $prefs =
&$GLOBALS['phpgw']->preferences->user[check_app()];
// use prefix if given in the url, used for email
extra-accounts
if ($prefix != '')
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: preferences preferences.php,1.31,1.32,
Ralf Becker <address@hidden> <=