[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/preferences/inc/ -> class.uisettings.inc.php (source)

   1  <?php
   2      /**************************************************************************\
   3      * eGroupWare - Preferences                                                 *
   4      * http://www.egroupware.org                                                *
   5      * --------------------------------------------                             *
   6      *  This program is free software; you can redistribute it and/or modify it *
   7      *  under the terms of the GNU General Public License as published by the   *
   8      *  Free Software Foundation; either version 2 of the License, or (at your  *
   9      *  option) any later version.                                              *
  10      \**************************************************************************/
  11  
  12      /* $Id: class.uisettings.inc.php 21370 2006-04-14 18:51:02Z ralfbecker $ */
  13  
  14      class uisettings
  15      {
  16          var $public_functions = array('index' => True);
  17          var $t;
  18          var $list_shown = False;
  19          var $show_help;
  20          var $has_help;
  21          var $prefix = '';
  22  
  23  		function uisettings()
  24          {
  25              $this->bo =& CreateObject('preferences.bosettings',$_GET['appname']);
  26  
  27              if($GLOBALS['egw']->acl->check('run',1,'admin'))
  28              {
  29                  /* Don't use a global variable for this ... */
  30                  define('HAS_ADMIN_RIGHTS',1);
  31                  
  32                  if ((int) $_GET['account_id'])
  33                  {
  34                      $GLOBALS['egw']->preferences->account_id = (int) $_GET['account_id'];
  35                      $GLOBALS['egw']->preferences->read_repository();
  36                  }
  37              }
  38          }
  39  
  40      
  41          /**
  42           * add nation ACL tab to Admin >> Edit user
  43           */
  44  		function edit_user()
  45          {
  46              global $menuData;
  47      
  48              $menuData[] = array(
  49                  'description'   => 'Preferences',
  50                  'url'           => '/index.php',
  51                  'extradata'     => 'menuaction=preferences.uisettings.index&appname=preferences'
  52              );
  53          }
  54  
  55  		function index()
  56          {
  57              // make preferences called via sidebox menu of an app, to behave like a part of that app
  58              $referer = $GLOBALS['egw']->common->get_referer('/preferences/index.php');
  59              if (!preg_match('/(preferences.php|menuaction=preferences.uisettings.index)+/i',$referer))
  60              {
  61                  $this->bo->session_data['referer'] = $referer;
  62              }
  63              //echo '<p align="right">'."referer='{$this->bo->session_data['referer']}'</p>\n";
  64              if (substr($this->bo->session_data['referer'],0,strlen('/preferences')) != '/preferences')
  65              {
  66                  $GLOBALS['egw_info']['flags']['currentapp'] = $_GET['appname'];
  67              }
  68              if($_POST['cancel'])
  69              {
  70                  $GLOBALS['egw']->redirect_link($this->bo->session_data['referer']);
  71              }
  72              if (substr($_SERVER['PHP_SELF'],-15) == 'preferences.php')
  73              {
  74                  $pref_link = '/preferences/preferences.php';
  75                  $link_params = array(
  76                      'appname'    => $_GET['appname'],
  77                  );
  78              }
  79              else
  80              {
  81                  $pref_link = '/index.php';
  82                  $link_params = array(
  83                      'menuaction' => 'preferences.uisettings.index',
  84                      'appname'    => $_GET['appname'],
  85                  );
  86                  if ($this->is_admin() && (int) $_GET['account_id'])
  87                  {
  88                      $link_params['account_id'] = (int) $_GET['account_id'];
  89                  }
  90              }
  91              $user    = get_var('user',Array('POST'));
  92              $forced  = get_var('forced',Array('POST'));
  93              $default = get_var('default',Array('POST'));
  94  
  95              $this->t =& CreateObject('phpgwapi.Template',$GLOBALS['egw']->common->get_tpl_dir('preferences'));
  96              $this->t->set_file(array(
  97                  'preferences' => 'preferences.tpl'
  98              ));
  99              $this->t->set_block('preferences','list','lists');
 100              $this->t->set_block('preferences','row','rowhandle');
 101              $this->t->set_block('preferences','help_row','help_rowhandle');
 102              $this->t->set_var(array('rowhandle' => '','help_rowhandle' => '','messages' => ''));
 103  
 104              $this->prefix = get_var('prefix',array('GET'),$this->bo->session_data['appname'] == $_GET['appname'] ? $this->bo->session_data['prefix'] : '');
 105  
 106              if($this->is_admin())
 107              {
 108                  /* This is where we will keep track of our postion. */
 109                  /* Developers won't have to pass around a variable then */
 110  
 111                  $GLOBALS['type'] = get_var('type',Array('GET','POST'),$this->bo->session_data['type']);
 112  
 113                  if(empty($GLOBALS['type']))
 114                  {
 115                      $GLOBALS['type'] = 'user';
 116                  }
 117              }
 118              else
 119              {
 120                  $GLOBALS['type'] = 'user';
 121              }
 122              $this->show_help = $this->bo->session_data['show_help'] != '' && $this->bo->session_data['appname'] == $_GET['appname']
 123                  ? $this->bo->session_data['show_help']
 124                  : (int)$GLOBALS['egw_info']['user']['preferences']['common']['show_help'];
 125  
 126              if($toggle_help = get_var('toggle_help','POST'))
 127              {
 128                  $this->show_help = (int)(!$this->show_help);
 129              }
 130              $this->has_help = 0;
 131  
 132              if($_POST['save'] || $_POST['apply'])
 133              {
 134                  if ($this->bo->session_data['notifies'])    // notifies NEED the translation for the application loaded
 135                  {
 136                      $GLOBALS['egw']->translation->add_app($_GET['appname']);
 137                  }
 138                  /* Don't use a switch here, we need to check some permissions during the ifs */
 139                  if($GLOBALS['type'] == 'user' || !($GLOBALS['type']))
 140                  {
 141                      $error = $this->bo->process_array($GLOBALS['egw']->preferences->user,$user,$this->bo->session_data['notifies'],$GLOBALS['type'],$this->prefix);
 142                  }
 143  
 144                  if($GLOBALS['type'] == 'default' && $this->is_admin())
 145                  {
 146                      $error = $this->bo->process_array($GLOBALS['egw']->preferences->default, $default,$this->bo->session_data['notifies'],$GLOBALS['type']);
 147                  }
 148  
 149                  if($GLOBALS['type'] == 'forced' && $this->is_admin())
 150                  {
 151                      $error = $this->bo->process_array($GLOBALS['egw']->preferences->forced, $forced,$this->bo->session_data['notifies'],$GLOBALS['type']);
 152                  }
 153                  
 154                  if (is_array($error)) $error = false;    // process_array returns the prefs-array on success
 155  
 156                  if(!$this->is_admin() || $error)
 157                  {
 158                      $GLOBALS['egw']->redirect_link($this->bo->session_data['referer']);
 159                  }
 160  
 161                  if($GLOBALS['type'] == 'user' && $_GET['appname'] == 'preferences' && $user['show_help'] != '')
 162                  {
 163                      $this->show_help = $user['show_help'];    // use it, if admin changes his help-prefs
 164                  }
 165                  if($_POST['save'])
 166                  {
 167                      $GLOBALS['egw']->redirect_link($this->bo->session_data['referer']);
 168                  }
 169              }
 170  
 171              // save our state in the app-session
 172              $this->bo->save_session($_GET['appname'],$GLOBALS['type'],$this->show_help,$this->prefix);
 173  
 174              // changes for the admin itself, should have immediate feedback ==> redirect
 175              if(!$error && ($_POST['save'] || $_POST['apply']) && $GLOBALS['type'] == 'user' && $_GET['appname'] == 'preferences')
 176              {
 177                  $GLOBALS['egw']->redirect_link($pref_link,$link_params);
 178              }
 179  
 180              $this->t->set_var('messages',$error);
 181              $this->t->set_var('action_url',$GLOBALS['egw']->link($pref_link,$link_params));
 182              $this->t->set_var('th_bg',  $GLOBALS['egw_info']['theme']['th_bg']);
 183              $this->t->set_var('th_text',$GLOBALS['egw_info']['theme']['th_text']);
 184              $this->t->set_var('row_on', $GLOBALS['egw_info']['theme']['row_on']);
 185              $this->t->set_var('row_off',$GLOBALS['egw_info']['theme']['row_off']);
 186  
 187              $this->bo->read($this->check_app(),$this->prefix,$GLOBALS['type']);
 188              //echo "prefs=<pre>"; print_r($this->bo->prefs); echo "</pre>\n";
 189  
 190              $this->notifies = array();
 191              if(!$this->bo->call_hook($_GET['appname']))
 192              {
 193                  $this->t->set_block('preferences','form','formhandle');    // skip the form
 194                  $this->t->set_var('formhandle','');
 195  
 196                  $this->t->set_var('messages',lang('Error: There was a problem finding the preference file for %1 in %2',
 197                      $GLOBALS['egw_info']['apps'][$_GET['appname']]['title'],
 198                      EGW_SERVER_ROOT . SEP . $_GET['appname'] . SEP . 'inc' . SEP . 'hook_settings.inc.php'
 199                  ));
 200              }
 201  
 202              foreach($this->bo->settings as $key => $valarray)
 203              {
 204                  if(!$this->is_admin())
 205                  {
 206                      if($valarray['admin'])
 207                      {
 208                          continue;
 209                      }
 210                  }
 211                  switch($valarray['type'])
 212                  {
 213                      case 'section':
 214                          $this->create_section($valarray['title']);
 215                          break;
 216                      case 'subsection':
 217                          $this->create_subsection($valarray['title']);
 218                          break;
 219                      case 'input':
 220                          $this->create_input_box(
 221                              $valarray['label'],
 222                              $valarray['name'],
 223                              $valarray['help'],
 224                              $valarray['default'],
 225                              $valarray['size'],
 226                              $valarray['maxsize'],
 227                              $valarray['type'],
 228                              $valarray['run_lang']    // if run_lang is set and false $valarray['help'] is run through lang()
 229                          );
 230                          break;
 231                      case 'password':
 232                          $this->create_password_box(
 233                              $valarray['label'],
 234                              $valarray['name'],
 235                              $valarray['help'],
 236                              $valarray['size'],
 237                              $valarray['maxsize'],
 238                              $valarray['run_lang']
 239                          );
 240                          break;
 241                      case 'text':
 242                          $this->create_text_area(
 243                              $valarray['label'],
 244                              $valarray['name'],
 245                              $valarray['rows'],
 246                              $valarray['cols'],
 247                              $valarray['help'],
 248                              $valarray['default'],
 249                              $valarray['run_lang']
 250                          );
 251                          break;
 252                      case 'select':
 253                          $this->create_select_box(
 254                              $valarray['label'],
 255                              $valarray['name'],
 256                              $valarray['values'],
 257                              $valarray['help'],
 258                              $valarray['default'],
 259                              $valarray['run_lang']
 260                          );
 261                          break;
 262                      case 'check':
 263                          $this->create_check_box(
 264                              $valarray['label'],
 265                              $valarray['name'],
 266                              $valarray['help'],
 267                              $valarray['default'],
 268                              $valarray['run_lang']
 269                          );
 270                          break;
 271                      case 'notify':
 272                          $this->create_notify(
 273                              $valarray['label'],
 274                              $valarray['name'],
 275                              $valarray['rows'],
 276                              $valarray['cols'],
 277                              $valarray['help'],
 278                              $valarray['default'],
 279                              $valarray['values'],
 280                              $valarray['subst_help'],
 281                              $valarray['run_lang']
 282                          );
 283                          break;
 284                  }
 285              }
 286  
 287              $GLOBALS['egw_info']['flags']['app_header'] = ($this->is_admin() && (int) $_GET['account_id'] ?
 288                  $GLOBALS['egw']->common->grab_owner_name((int) $_GET['account_id']).': ' : '').($_GET['appname'] == 'preferences' ?
 289                  lang('Common preferences') : lang('%1 - Preferences',$GLOBALS['egw_info']['apps'][$_GET['appname']]['title']));
 290              $GLOBALS['egw']->common->egw_header();
 291              echo parse_navbar();
 292  
 293              if(count($this->notifies))    // there have been notifies in the hook, we need to save in the session
 294              {
 295                  $this->bo->save_session($_GET['appname'],$GLOBALS['type'],$this->show_help,$this->prefix,$this->notifies);
 296                  //echo "notifies="; _debug_array($this->notifies);
 297              }
 298              if($this->is_admin())
 299              {
 300                  if ((int) $_GET['account_id'])
 301                  {
 302                      echo '<table><tr valign="top"><td>'."\n".ExecMethod('admin.uimenuclass.createHTMLCode','edit_user')."\n</td>\n<td>".
 303                          '<p class="th" style="width: 100%; text-align: left; font-weight: bold; margin-top: 2px; padding: 1px;">'.
 304                          lang('Common preferences')."</p>\n";
 305                  }
 306                  $tabs[] = array(
 307                      'label' => (int) $_GET['account_id'] ? $GLOBALS['egw']->common->grab_owner_name($_GET['account_id']) : lang('Your preferences'),
 308                      'link'  => $GLOBALS['egw']->link($pref_link,$link_params+array('type'=>'user')),
 309                  );
 310                  $tabs[] = array(
 311                      'label' => lang('Default preferences'),
 312                      'link'  => $GLOBALS['egw']->link($pref_link,$link_params+array('type'=>'default')),
 313                  );
 314                  $tabs[] = array(
 315                      'label' => lang('Forced preferences'),
 316                      'link'  => $GLOBALS['egw']->link($pref_link,$link_params+array('type'=>'forced')),
 317                  );
 318  
 319                  switch($GLOBALS['type'])
 320                  {
 321                      case 'user':    $selected = 0; break;
 322                      case 'default': $selected = 1; break;
 323                      case 'forced':  $selected = 2; break;
 324                  }
 325                  $this->t->set_var('tabs',$GLOBALS['egw']->common->create_tabs($tabs,$selected));
 326              }
 327              $this->t->set_var('lang_save', lang('save'));
 328              $this->t->set_var('lang_apply', lang('apply'));
 329              $this->t->set_var('lang_cancel', lang('cancel'));
 330              $this->t->set_var('show_help',(int)$this->show_help);
 331              $this->t->set_var('help_button',$this->has_help ? '<input type="submit" name="toggle_help" value="'.
 332              ($this->show_help ? lang('help off') : lang('help')).'">' : '');
 333  
 334              if(!$this->list_shown)
 335              {
 336                  $this->show_list();
 337              }
 338              $this->t->pfp('phpgw_body','preferences');
 339  
 340              if($this->is_admin() && (int) $_GET['account_id'])
 341              {
 342                  echo "\n</td></tr></table>\n";
 343              }
 344              //echo '<pre style="text-align: left;">'; print_r($GLOBALS['egw']->preferences->data); echo "</pre>\n";
 345  
 346              $GLOBALS['egw']->common->egw_footer();
 347          }
 348  
 349          /* Make things a little easier to follow */
 350          /* Some places we will need to change this if they're in common */
 351  		function check_app()
 352          {
 353              if($_GET['appname'] == 'preferences')
 354              {
 355                  return 'common';
 356              }
 357              else
 358              {
 359                  return $_GET['appname'];
 360              }
 361          }
 362  
 363  		function is_forced_value($_appname,$preference_name)
 364          {
 365              if(isset($GLOBALS['egw']->preferences->forced[$_appname][$preference_name]) && $GLOBALS['type'] != 'forced')
 366              {
 367                  return True;
 368              }
 369              else
 370              {
 371                  return False;
 372              }
 373          }
 374  
 375  		function create_password_box($label_name,$preference_name,$help='',$size='',$max_size='',$run_lang=True)
 376          {
 377              $_appname = $this->check_app();
 378              if($this->is_forced_value($_appname,$preference_name))
 379              {
 380                  return True;
 381              }
 382              $this->create_input_box($label_name,$preference_name.
 383                  ($GLOBALS['type'] != 'user' ? '' : '][pw'),    // we need to show the default or forced pw, otherwise we are never able to reset it
 384                  $help,'',$size,$max_size,'password',$run_lang);
 385          }
 386  
 387  		function create_input_box($label,$name,$help='',$default='',$size='',$max_size='',$type='',$run_lang=True)
 388          {
 389              $charSet = $GLOBALS['egw']->translation->charset();
 390  
 391              $_appname = $this->check_app();
 392              if($this->is_forced_value($_appname,$name))
 393              {
 394                  return True;
 395              }
 396  
 397              if($type)    // used to specify password
 398              {
 399                  $options = " TYPE='$type'";
 400              }
 401              if($size)
 402              {
 403                  $options .= " SIZE='$size'";
 404              }
 405              if($maxsize)
 406              {
 407                  $options .= " MAXSIZE='$maxsize'";
 408              }
 409  
 410              if(isset($this->bo->prefs[$name]) || $GLOBALS['type'] != 'user')
 411              {
 412                  $default = $this->bo->prefs[$name];
 413              }
 414  
 415              if($GLOBALS['type'] == 'user')
 416              {
 417                  $def_text = !$GLOBALS['egw']->preferences->user[$_appname][$name] ? $GLOBALS['egw']->preferences->data[$_appname][$name] : $GLOBALS['egw']->preferences->default[$_appname][$name];
 418  
 419                  if(isset($this->notifies[$name]))    // translate the substitution names
 420                  {
 421                      $def_text = $GLOBALS['egw']->preferences->lang_notify($def_text,$this->notifies[$name]);
 422                  }
 423                  $def_text = $def_text != '' ? ' <i><font size="-1">'.lang('default').':&nbsp;'.$def_text.'</font></i>' : '';
 424              }
 425              $this->t->set_var('row_value',"<input name=\"$GLOBALS[type]}[$name]\"value=\"".
 426              @htmlspecialchars($default,ENT_COMPAT,$charSet)."\"$options>$def_text");
 427              $this->t->set_var('row_name',$run_lang !== -1 ? lang($label) : $label);
 428              $GLOBALS['egw']->nextmatchs->template_alternate_row_color($this->t);
 429  
 430              $this->t->fp('rows',$this->process_help($help,$run_lang) ? 'help_row' : 'row',True);
 431          }
 432  
 433  		function process_help($help,$run_lang=True)
 434          {
 435              if(!empty($help))
 436              {
 437                  $this->has_help = True;
 438  
 439                  if($this->show_help)
 440                  {
 441                      $this->t->set_var('help_value',is_null($run_lang) || $run_lang ? lang($help) : $help);
 442  
 443                      return True;
 444                  }
 445              }
 446              return False;
 447          }
 448  
 449  		function create_check_box($label,$name,$help='',$default='',$run_lang=True)
 450          {
 451              // checkboxes itself can't be use as they return nothing if uncheckt !!!
 452  
 453              if($GLOBALS['type'] != 'user')
 454              {
 455                  $default = '';    // no defaults for default or forced prefs
 456              }
 457              if(isset($this->bo->prefs[$name]))
 458              {
 459                  $this->bo->prefs[$name] = (int)(!!$this->bo->prefs[$name]);    // to care for '' and 'True'
 460              }
 461  
 462              return $this->create_select_box($label,$name,array(
 463                  '0' => lang('No'),
 464                  '1' => lang('Yes')
 465              ),$help,$default,$run_lang);
 466          }
 467  
 468  		function create_option_string($selected,$values)
 469          {
 470              while(is_array($values) && list($var,$value) = each($values))
 471              {
 472                  $s .= '<option value="' . $var . '"';
 473                  if("$var" == "$selected")    // the "'s are necessary to force a string-compare
 474                  {
 475                      $s .= ' selected="1"';
 476                  }
 477                  $s .= '>' . $value . '</option>';
 478              }
 479              return $s;
 480          }
 481  
 482          /* for creating different sections with a title */
 483  		function create_section($title='')
 484          {
 485              $this->t->set_var('row_value','');
 486              $this->t->set_var('row_name','<span class="prefSection">'.lang($title).'</span>');
 487              $GLOBALS['egw']->nextmatchs->template_alternate_row_color($this->t);
 488  
 489              $this->t->fp('rows',$this->process_help($help) ? 'help_row' : 'row',True);
 490          }
 491  
 492          /* for creating different sections with a title */
 493  		function create_subsection($title='')
 494          {
 495              $this->t->set_var('row_value','');
 496              $this->t->set_var('row_name','<span class="prefSubSection">'.lang($title).'</span>');
 497              $GLOBALS['egw']->nextmatchs->template_alternate_row_color($this->t);
 498  
 499              $this->t->fp('rows',$this->process_help($help) ? 'help_row' : 'row',True);
 500          }
 501  
 502  		function create_select_box($label,$name,$values,$help='',$default='',$run_lang=True)
 503          {
 504              $_appname = $this->check_app();
 505              if($this->is_forced_value($_appname,$name))
 506              {
 507                  return True;
 508              }
 509  
 510              if(isset($this->bo->prefs[$name]) || $GLOBALS['type'] != 'user')
 511              {
 512                  $default = $this->bo->prefs[$name];
 513              }
 514  
 515              switch($GLOBALS['type'])
 516              {
 517                  case 'user':
 518                      $s = '<option value="">' . lang('Use default') . '</option>';
 519                      break;
 520                  case 'default':
 521                      $s = '<option value="">' . lang('No default') . '</option>';
 522                      break;
 523                  case 'forced':
 524                      $s = '<option value="**NULL**">' . lang('Users choice') . '</option>';
 525                      break;
 526              }
 527              $s .= $this->create_option_string($default,$values);
 528              if($GLOBALS['type'] == 'user')
 529              {
 530                  $def_text = $GLOBALS['egw']->preferences->default[$_appname][$name];
 531                  $def_text = $def_text != '' ? ' <i><font size="-1">'.lang('default').':&nbsp;'.$values[$def_text].'</font></i>' : '';
 532              }
 533              $this->t->set_var('row_value',"<select name=\"$GLOBALS[type]}[$name]\">$s</select>$def_text");
 534              $this->t->set_var('row_name',$run_lang !== -1 ? lang($label) : $label);
 535              $GLOBALS['egw']->nextmatchs->template_alternate_row_color($this->t);
 536  
 537              $this->t->fp('rows',$this->process_help($help,$run_lang) ? 'help_row' : 'row',True);
 538          }
 539  
 540          /**
 541          * creates text-area or inputfield with subtitution-variables
 542          *
 543          * @param string $label untranslated label
 544          * @param string $name name of the pref
 545          * @param int $rows of the textarea or input-box ($rows==1)
 546          * @param int $cols of the textarea or input-box ($rows==1)
 547          * @param string $help='' untranslated help-text, run through lang if $run_lang != false
 548          * @param string $default='' default-value
 549          * @param array $vars2='' array with extra substitution-variables of the form key => help-text
 550          * @param boolean $subst_help=true show help about substitues
 551          * @param boolean $run_lang=true should $help help be run through lang()
 552          */
 553  		function create_notify($label,$name,$rows,$cols,$help='',$default='',$vars2='',$subst_help=True,$run_lang=True)
 554          {
 555              $vars = $GLOBALS['egw']->preferences->vars;
 556              if(is_array($vars2))
 557              {
 558                  $vars += $vars2;
 559              }
 560              $this->bo->prefs[$name] = $GLOBALS['egw']->preferences->lang_notify($this->bo->prefs[$name],$vars);
 561  
 562              $this->notifies[$name] = $vars;    // this gets saved in the app_session for re-translation
 563  
 564              $help = $help && ($run_lang || is_null($run_lang)) ? lang($help) : $help;
 565              if($subst_help || is_null($subst_help))
 566              {
 567                  $help .= '<p><b>'.lang('Substitutions and their meanings:').'</b>';
 568                  foreach($vars as $var => $var_help)
 569                  {
 570                      $lname = ($lname = lang($var)) == $var.'*' ? $var : $lname;
 571                      $help .= "<br>\n".'<b>$$'.$lname.'$$</b>: '.$var_help;
 572                  }
 573                  $help .= "</p>\n";
 574              }
 575              if($row == 1)
 576              {
 577                  $this->create_input_box($label,$name,$help,$default,$cols,'','',False);
 578              }
 579              else
 580              {
 581                  $this->create_text_area($label,$name,$rows,$cols,$help,$default,False);
 582              }
 583          }
 584  
 585  		function create_text_area($label,$name,$rows,$cols,$help='',$default='',$run_lang=True)
 586          {
 587              $charSet = $GLOBALS['egw']->translation->charset();
 588  
 589              $_appname = $this->check_app();
 590              if($this->is_forced_value($_appname,$name))
 591              {
 592                  return True;
 593              }
 594  
 595              if(isset($this->bo->prefs[$name]) || $GLOBALS['type'] != 'user')
 596              {
 597                  $default = $this->bo->prefs[$name];
 598              }
 599  
 600              if($GLOBALS['type'] == 'user')
 601              {
 602                  $def_text = !$GLOBALS['egw']->preferences->user[$_appname][$name] ? $GLOBALS['egw']->preferences->data[$_appname][$name] : $GLOBALS['egw']->preferences->default[$_appname][$name];
 603  
 604                  if(isset($this->notifies[$name]))    // translate the substitution names
 605                  {
 606                      $def_text = $GLOBALS['egw']->preferences->lang_notify($def_text,$this->notifies[$name]);
 607                  }
 608                  $def_text = $def_text != '' ? '<br><i><font size="-1"><b>'.lang('default').'</b>:<br>'.nl2br($def_text).'</font></i>' : '';
 609              }
 610              $this->t->set_var('row_value',"<textarea rows=\"$rows\" cols=\"$cols\" name=\"$GLOBALS[type]}[$name]\">".
 611              htmlentities($default,ENT_COMPAT,$charSet)."</textarea>$def_text");
 612              $this->t->set_var('row_name',lang($label));
 613              $GLOBALS['egw']->nextmatchs->template_alternate_row_color($this->t);
 614  
 615              $this->t->fp('rows',$this->process_help($help,$run_lang) ? 'help_row' : 'row',True);
 616          }
 617  
 618          /* Makes the ifs a little nicer, plus ... this will change once the ACL manager is in place */
 619          /* and is able to create less powerfull admins.  This will handle the ACL checks for that (jengo) */
 620  		function is_admin()
 621          {
 622              if(HAS_ADMIN_RIGHTS == 1 && empty($this->prefix))    // tabs only without prefix
 623              {
 624                  return True;
 625              }
 626              else
 627              {
 628                  return False;
 629              }
 630          }
 631  
 632  		function show_list($header='&nbsp;')
 633          {
 634              $this->t->set_var('list_header',$header);
 635              $this->t->parse('lists','list',$this->list_shown);
 636  
 637              $this->t->set_var('rows','');
 638              $this->list_shown = True;
 639          }
 640      }


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7