[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.43.2.2
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.preferences.inc.php,1.43.2.2.2.6,1.43.2.2.2.7 |
Date: |
Mon, 19 May 2003 19:04:39 -0400 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv27322
Modified Files:
Tag: Version-0_9_16-branch
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.43.2.2.2.6
retrieving revision 1.43.2.2.2.7
diff -C2 -r1.43.2.2.2.6 -r1.43.2.2.2.7
*** class.preferences.inc.php 17 May 2003 20:36:37 -0000 1.43.2.2.2.6
--- class.preferences.inc.php 19 May 2003 23:04:36 -0000 1.43.2.2.2.7
***************
*** 305,314 ****
@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;
--- 305,316 ----
@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;
***************
*** 316,320 ****
}
! $this->user[$app_name][$var] =
$this->data[$app_name][$var] = $value;
reset($this->data);
return $this->data;
--- 318,345 ----
}
! 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;
***************
*** 327,345 ****
@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);
--- 352,401 ----
@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.43.2.2.2.6,1.43.2.2.2.7,
Ralf Becker <address@hidden> <=