[ Index ]
 

Code source de eGroupWare 1.2.106-2

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

title

Body

[fermer]

/admin/inc/ -> class.uildap_mgr.inc.php (source)

   1  <?php
   2      /***************************************************************************\
   3      * EGroupWare - LDAPManager                                                  *
   4      * http://www.egroupware.org                                                 *
   5      * Written by : Andreas Krause (ak703@users.sourceforge.net                  *
   6      * based on EmailAdmin by Lars Kneschke [lkneschke@egroupware.org]           *
   7      * -------------------------------------------------                         *
   8      * This program is free software; you can redistribute it and/or modify it   *
   9      * under the terms of the GNU General Public License as published by the     *
  10      * Free Software Foundation; either version 2 of the License, or (at your    *
  11      * option) any later version.                                                *
  12      \***************************************************************************/
  13  
  14      class uildap_mgr
  15      {
  16  
  17          var $public_functions = array
  18          (
  19              'editUserData' => True,
  20              'saveUserData' => True
  21          );
  22  
  23  		function uildap_mgr()
  24          {
  25              $this->t =& CreateObject('phpgwapi.Template',EGW_APP_TPL);
  26              $this->boldapmgr =& CreateObject('admin.boldap_mgr');
  27          }
  28  
  29  		function display_app_header()
  30          {
  31              $GLOBALS['egw']->common->egw_header();
  32              echo parse_navbar();
  33          }
  34  
  35  		function editUserData($_useCache='0')
  36          {
  37              $accountID = $_GET['account_id'];
  38              $GLOBALS['account_id'] = $accountID;
  39  
  40              $this->display_app_header();
  41  
  42              $this->translate();
  43  
  44              $this->t->set_file(array('editUserData' => 'account_form_ldapdata.tpl'));
  45              $this->t->set_block('editUserData','form','form');
  46              $this->t->set_block('editUserData','link_row','link_row');
  47              $this->t->set_var('th_bg',$GLOBALS['egw_info']['theme']['th_bg']);
  48              $this->t->set_var('tr_color1',$GLOBALS['egw_info']['theme']['row_on']);
  49              $this->t->set_var('tr_color2',$GLOBALS['egw_info']['theme']['row_off']);
  50  
  51              $this->t->set_var('lang_email_config',lang('edit email settings'));
  52              $this->t->set_var('lang_emailAddress',lang('email address'));
  53              $this->t->set_var('lang_emailaccount_active',lang('email account active'));
  54              $this->t->set_var('lang_mailAlternateAddress',lang('alternate email address'));
  55              $this->t->set_var('lang_mailForwardingAddress',lang('forward emails to'));
  56              $this->t->set_var('lang_forward_also_to',lang('forward also to'));
  57              $this->t->set_var('lang_button',lang('save'));
  58              $this->t->set_var('lang_deliver_extern',lang('deliver extern'));
  59              $this->t->set_var('lang_edit_email_settings',lang('edit email settings'));
  60              $this->t->set_var('lang_ready',lang('Done'));
  61              $this->t->set_var('link_back',$GLOBALS['egw']->link('/admin/accounts.php'));
  62              $this->t->set_var('info_icon',EGW_IMAGES_DIR.'/info.gif');
  63  
  64              $linkData = array
  65              (
  66                  'menuaction' => 'admin.uildap_mgr.saveUserData',
  67                  'account_id' => $accountID
  68              );
  69              $this->t->set_var('form_action', $GLOBALS['egw']->link('/index.php',$linkData));
  70  
  71              // only when we show a existing user
  72              if($userData = $this->boldapmgr->getUserData($accountID, $_useCache))
  73              {
  74                  echo '<br><br><br>';
  75                  if ($userData['mailAlternateAddress'] != '')
  76                  {
  77                      $options_mailAlternateAddress = '<select size="6" name="mailAlternateAddress">' . "\n";
  78                      for ($i=0;$i < count($userData['mailAlternateAddress']); $i++)
  79                      {
  80                          $options_mailAlternateAddress .= '<option value="' . $i. '">' .
  81                              $userData['mailAlternateAddress'][$i].
  82                              "</option>\n";
  83                      }
  84                      $options_mailAlternateAddress .= "</select>\n";
  85                  }
  86                  else
  87                  {
  88                      $options_mailAlternateAddress = lang('no alternate email address');
  89                  }
  90  
  91                  $this->t->set_var('mail',$userData['mail']);
  92                  //$this->t->set_var('mailAlternateAddress',''); could be deleted?
  93  
  94                  if ($userData['mailForwardingAddress'] == '')
  95                  {
  96                      $this->t->set_var('mailForwardingAddress',$userData['mail']);
  97                  }
  98                  else
  99                  {
 100                      $this->t->set_var('mailForwardingAddress',$userData['mailForwardingAddress']);
 101                  }
 102  
 103                  $this->t->set_var('options_mailAlternateAddress',$options_mailAlternateAddress);
 104  
 105                  $this->t->set_var('uid',rawurlencode($_accountData['dn']));
 106                  if ($userData['accountStatus'] == 'active')
 107                  {
 108                      $this->t->set_var('account_checked','checked');
 109                  }
 110                  if ($userData['deliveryMode'] == 'forwardOnly')
 111                  {
 112                      $this->t->set_var('forwardOnly_checked','checked');
 113                  }
 114                  if ($_accountData['deliverExtern'] == 'active')
 115                  {
 116                      $this->t->set_var('deliver_checked','checked');
 117                  }
 118              }
 119              else
 120              {
 121                  $this->t->set_var('mail','');
 122                  $this->t->set_var('mailAlternateAddress','');
 123                  $this->t->set_var('mailForwardingAddress','');
 124                  $this->t->set_var('options_mailAlternateAddress',lang('no alternate email address'));
 125                  $this->t->set_var('account_checked','');
 126                  $this->t->set_var('forwardOnly_checked','');
 127              }
 128  
 129              // create the menu on the left, if needed
 130              $menuClass =& CreateObject('admin.uimenuclass');
 131              $this->t->set_var('rows',$menuClass->createHTMLCode('edit_user'));
 132  
 133              $this->t->pparse('out','form');
 134          }
 135  
 136  		function saveUserData()
 137          {
 138              if($_POST['accountStatus'] == 'on')
 139              {
 140                  $accountStatus = 'active';
 141              }
 142              if($_POST['forwardOnly'] == 'on')
 143              {
 144                  $deliveryMode = 'forwardOnly';
 145              }
 146  
 147              $formData = array
 148              (
 149                  'mail'                            => $_POST['mail'],
 150                  'mailAlternateAddress'            => $_POST['mailAlternateAddress'],
 151                  'mailForwardingAddress'            => $_POST['mailForwardingAddress'],
 152                  'add_mailAlternateAddress'        => $_POST['mailAlternateAddressInput'],
 153                  'remove_mailAlternateAddress'    => $_POST['mailAlternateAddress'],
 154                  'accountStatus'                    => $accountStatus,
 155                  'deliveryMode'                    => $deliveryMode
 156              );
 157  
 158              //echo "<br><br>DebugArray in uiuserdata";
 159              // echo _debug_array($formData);
 160  
 161              if($_POST['add_mailAlternateAddress']) $bo_action='add_mailAlternateAddress';
 162              if($_POST['remove_mailAlternateAddress']) $bo_action='remove_mailAlternateAddress';
 163              if($_POST['save']) $bo_action='save';
 164  
 165              if (!$_POST['mail'] == '')    //attribute 'mail'is not allowed to be empty
 166              {
 167  // error generator necessary!!
 168                  $this->boldapmgr->saveUserData($_GET['account_id'], $formData, $bo_action);
 169              }
 170              if ($bo_action == 'save')
 171              {
 172                  // read date fresh from ldap storage
 173                  $this->editUserData();
 174              }
 175              else
 176              {
 177                  // use cached data
 178                  $this->editUserData('1');
 179              }
 180          }
 181  
 182  		function translate()
 183          {
 184              $this->t->set_var('th_bg',$GLOBALS['egw_info']['theme']['th_bg']);
 185  
 186              $this->t->set_var('lang_add',lang('add'));
 187              $this->t->set_var('lang_done',lang('Done'));
 188              $this->t->set_var('lang_remove',lang('remove'));
 189              $this->t->set_var('lang_remove',lang('remove'));
 190              $this->t->set_var('lang_advanced_options',lang('advanced options'));
 191              $this->t->set_var('lang_qmaildotmode',lang('qmaildotmode'));
 192              $this->t->set_var('lang_default',lang('default'));
 193              $this->t->set_var('lang_quota_settings',lang('quota settings'));
 194              $this->t->set_var('lang_quotainmbyte',lang('quota size in MByte'));
 195              $this->t->set_var('lang_inmbyte',lang('in MByte'));
 196              $this->t->set_var('lang_0forunlimited',lang('leave empty for no quota'));
 197              $this->t->set_var('lang_forward_only',lang('forward only'));
 198              $this->t->set_var('lang_mailAliases',lang('Aliases'));
 199              $this->t->set_var('lang_info_mailAliases',lang('Attribute mailAlternateAddress explained'));
 200              $this->t->set_var('lang_masterEmailAddress',lang('Main Email-Address'));
 201              $this->t->set_var('lang_info_masterEmailAddress',lang('Attribute mail explained'));
 202              $this->t->set_var('lang_RouteMailsTo',lang('Route all Mails to'));
 203              $this->t->set_var('lang_info_RouteMailsTo',lang('Attribute mailForwardingAddress explained'));
 204              $this->t->set_var('lang_info_AccountActive',lang('Attribute accountstatus explained'));
 205              $this->t->set_var('lang_info_UsageHints',lang('Explanation of LDAPMAN'));
 206          }
 207      }
 208  ?>


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