[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: phpgwapi/inc class.preferences.inc.php,1.53,1.54
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.preferences.inc.php,1.53,1.54 |
Date: |
Mon, 19 May 2003 19:05:34 -0400 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv27552
Modified Files:
class.preferences.inc.php
Log Message:
modified add and delete to set / unset default and forced prefs too
Index: class.preferences.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.preferences.inc.php,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -r1.53 -r1.54
*** class.preferences.inc.php 17 May 2003 20:37:51 -0000 1.53
--- class.preferences.inc.php 19 May 2003 23:05:32 -0000 1.54
***************
*** 309,318 ****
@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;
--- 309,320 ----
@param $var name of preference to be stored
@param $value value of the preference
! @param $type of preference to set: forced, default, user
! @note the effective prefs ($this->data) are updated to reflect
the change
! @returns the new effective prefs (even when forced or default
prefs are set !)
*/
! function add($app_name,$var,$value = '##undef##',$type='user')
{
//echo "<p>add('$app_name','$var','$value')</p>\n";
! if ($value == '##undef##')
{
global $$var;
***************
*** 320,324 ****
}
! $this->user[$app_name][$var] =
$this->data[$app_name][$var] = $value;
reset($this->data);
return $this->data;
--- 322,349 ----
}
! switch ($type)
! {
! case 'forced':
! $this->data[$app_name][$var] =
$this->forced[$app_name][$var] = $value;
! break;
!
! case 'default':
! $this->default[$app_name][$var] =
$value;
! if
((!isset($this->forced[$app_name][$var]) || $this->forced[$app_name][$var] ===
'') &&
!
(!isset($this->user[$app_name][$var]) || $this->user[$app_name][$var] === ''))
! {
! $this->data[$app_name][$var] =
$value;
! }
! break;
!
! case user:
! default:
! $this->user[$app_name][$var] = $value;
! if
(!isset($this->forced[$app_name][$var]) || $this->forced[$app_name][$var] ===
'')
! {
! $this->data[$app_name][$var] =
$value;
! }
! break;
! }
reset($this->data);
return $this->data;
***************
*** 331,349 ****
@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);
--- 356,405 ----
@param $app_name name of app
@param $var variable to be deleted
! @param $type of preference to set: forced, default, user
! @note the effektive prefs ($this->data) are updated to reflect
the change
! @returns the new effective prefs (even when forced or default
prefs are deleted!)
*/
! function delete($app_name, $var = False,$type = 'user')
{
//echo "<p>delete('$app_name','$var')</p>\n";
! $set_via = array(
! 'forced' => array('user','default'),
! 'default' => array('forced','user'),
! 'user' => array('forced','default')
! );
! if (!isset($set_via[$type]))
{
! $type = 'user';
! }
! if ($all = (is_string($var) && $var == ''))
! {
! unset($this->$type[$app_name]);
unset($this->data[$app_name]);
}
else
{
+ unset($this->$type[$app_name][$var]);
unset($this->data[$app_name][$var]);
! }
! // set the effectiv pref again if needed
! //
! foreach ($set_via[$type] as $set_from)
! {
! if ($all)
! {
! if (isset($this->$set_from[$app_name]))
! {
! $this->data[$app_name] =
$this->$set_from[$app_name];
! break;
! }
! }
! else
! {
! if
(isset($this->$set_from[$app_name][$var]) && $this->$set_from[$app_name][$var]
!== '')
! {
! $this->data[$app_name][$var] =
$this->$set_from[$app_name][$var];
! break;
! }
! }
}
reset ($this->data);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: phpgwapi/inc class.preferences.inc.php,1.53,1.54,
Ralf Becker <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: calendar/setup phpgw_de.lang,1.12.2.13.2.4,1.12.2.13.2.5 phpgw_en.lang,1.13.2.20.2.4,1.13.2.20.2.5
- Next by Date:
[Phpgroupware-cvs] CVS: phpgwapi/setup phpgw_de.lang,1.24.2.10.2.5,1.24.2.10.2.6 phpgw_en.lang,1.38.2.14.2.9,1.38.2.14.2.10
- Previous by thread:
[Phpgroupware-cvs] CVS: calendar/setup phpgw_de.lang,1.12.2.13.2.4,1.12.2.13.2.5 phpgw_en.lang,1.13.2.20.2.4,1.13.2.20.2.5
- Next by thread:
[Phpgroupware-cvs] CVS: phpgwapi/setup phpgw_de.lang,1.24.2.10.2.5,1.24.2.10.2.6 phpgw_en.lang,1.38.2.14.2.9,1.38.2.14.2.10
- Index(es):