[ Index ]
 

Code source de eGroupWare 1.2.106-2

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

title

Body

[fermer]

/emailadmin/inc/ -> class.uiuserdata.inc.php (source)

   1  <?php
   2      /***************************************************************************\
   3      * eGroupWare                                                                *
   4      * http://www.egroupware.org                                                 *
   5      * http://www.linux-at-work.de                                               *
   6      * Written by : Lars Kneschke [lkneschke@linux-at-work.de]                   *
   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      /* $Id: class.uiuserdata.inc.php 19408 2005-10-14 10:10:06Z ralfbecker $ */
  14  
  15      class uiuserdata
  16      {
  17  
  18          var $public_functions = array
  19          (
  20              'editUserData'    => True,
  21              'saveUserData'    => True
  22          );
  23  
  24  		function uiuserdata()
  25          {
  26              $this->t            =& CreateObject('phpgwapi.Template',EGW_APP_TPL);
  27              $this->boemailadmin        =& CreateObject('emailadmin.bo');
  28          }
  29      
  30  		function display_app_header()
  31          {
  32              $GLOBALS['egw']->common->egw_header();
  33              echo parse_navbar();
  34          }
  35  
  36  		function editUserData($_useCache='0')
  37          {
  38              $accountID = $_GET['account_id'];            
  39              $GLOBALS['account_id'] = $accountID;
  40  
  41              $this->display_app_header();
  42  
  43              $this->translate();
  44  
  45              $this->t->set_file(array("editUserData" => "edituserdata.tpl"));
  46              $this->t->set_block('editUserData','form','form');
  47              $this->t->set_block('editUserData','link_row','link_row');
  48              $this->t->set_var("th_bg",$GLOBALS['egw_info']["theme"]["th_bg"]);
  49              $this->t->set_var("tr_color1",$GLOBALS['egw_info']["theme"]["row_on"]);
  50              $this->t->set_var("tr_color2",$GLOBALS['egw_info']["theme"]["row_off"]);
  51  
  52              $this->t->set_var("lang_email_config",lang("edit email settings"));
  53              $this->t->set_var("lang_emailAddress",lang("email address"));
  54              $this->t->set_var("lang_emailaccount_active",lang("email account active"));
  55              $this->t->set_var("lang_mailAlternateAddress",lang("alternate email address"));
  56              $this->t->set_var("lang_mailRoutingAddress",lang("forward email's to"));
  57              $this->t->set_var("lang_forward_also_to",lang("forward also to"));
  58              $this->t->set_var("lang_button",lang("save"));
  59              $this->t->set_var("lang_deliver_extern",lang("deliver extern"));
  60              $this->t->set_var("lang_deliver_extern",lang("deliver extern"));
  61              $this->t->set_var("lang_edit_email_settings",lang("edit email settings"));
  62              $this->t->set_var("lang_ready",lang("Done"));
  63              $this->t->set_var("link_back",$GLOBALS['egw']->link('/admin/accounts.php'));
  64  
  65              $linkData = array
  66              (
  67                  'menuaction'    => 'emailadmin.uiuserdata.saveUserData',
  68                  'account_id'    => $accountID
  69              );
  70              $this->t->set_var("form_action", $GLOBALS['egw']->link('/index.php',$linkData));
  71  
  72              // only when we show a existing user
  73              if($userData = $this->boemailadmin->getUserData($accountID, $_useCache))
  74              {
  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                  if ($userData['mailRoutingAddress'] != '')
  92                  {
  93                      $options_mailRoutingAddress = "<select size=\"6\" name=\"mailRoutingAddress\">\n";
  94                      for ($i=0;$i < count($userData['mailRoutingAddress']); $i++)
  95                      {
  96                          $options_mailRoutingAddress .= "<option value=\"$i\">".
  97                              $userData['mailRoutingAddress'][$i].
  98                              "</option>\n";
  99                      }
 100                      $options_mailRoutingAddress .= "</select>\n";
 101                  }
 102                  else
 103                  {
 104                      $options_mailRoutingAddress = lang('no forwarding email address');
 105                  }
 106                  
 107                  $this->t->set_var("quotaLimit",$userData["quotaLimit"]);
 108              
 109                  $this->t->set_var("mailLocalAddress",$userData["mailLocalAddress"]);
 110                  $this->t->set_var("mailAlternateAddress",'');
 111                  $this->t->set_var("mailRoutingAddress",'');
 112                  $this->t->set_var("options_mailAlternateAddress",$options_mailAlternateAddress);
 113                  $this->t->set_var("options_mailRoutingAddress",$options_mailRoutingAddress);
 114                  $this->t->set_var("selected_".$userData["qmailDotMode"],'selected');
 115                  $this->t->set_var("deliveryProgramPath",$userData["deliveryProgramPath"]);
 116                  
 117                  $this->t->set_var("uid",rawurlencode($_accountData["dn"]));
 118                  if ($userData["accountStatus"] == "active")
 119                      $this->t->set_var("account_checked","checked");
 120                  if ($userData["deliveryMode"] == "forwardOnly")
 121                      $this->t->set_var("forwardOnly_checked","checked");
 122                  if ($_accountData["deliverExtern"] == "active")
 123                      $this->t->set_var("deliver_checked","checked");
 124              }
 125              else
 126              {
 127                  $this->t->set_var("mailLocalAddress",'');
 128                  $this->t->set_var("mailAlternateAddress",'');
 129                  $this->t->set_var("mailRoutingAddress",'');
 130                  $this->t->set_var("options_mailAlternateAddress",lang('no alternate email address'));
 131                  $this->t->set_var("options_mailRoutingAddress",lang('no forwarding email address'));
 132                  $this->t->set_var("account_checked",'');
 133                  $this->t->set_var("forwardOnly_checked",'');
 134              }
 135          
 136              // create the menu on the left, if needed        
 137              $menuClass =& CreateObject('admin.uimenuclass');
 138              $this->t->set_var('rows',$menuClass->createHTMLCode('edit_user'));
 139  
 140              $this->t->pparse("out","form");
 141  
 142          }
 143          
 144  		function saveUserData()
 145          {
 146              if($_POST["accountStatus"] == "on")
 147              {
 148                  $accountStatus = "active";
 149              }
 150              if($_POST["forwardOnly"] == "on")
 151              {
 152                  $deliveryMode = "forwardOnly";
 153              }
 154  
 155              $formData = array
 156              (
 157                  'mailLocalAddress'        => $_POST["mailLocalAddress"],
 158                  'mailRoutingAddress'        => $_POST["mailRoutingAddress"],
 159                  'add_mailAlternateAddress'    => $_POST["mailAlternateAddressInput"],
 160                  'remove_mailAlternateAddress'    => $_POST["mailAlternateAddress"],
 161                  'quotaLimit'            => $_POST["quotaLimit"],
 162                  'add_mailRoutingAddress'    => $_POST["mailRoutingAddressInput"],
 163                  'remove_mailRoutingAddress'    => $_POST["mailRoutingAddress"],
 164                  
 165                  'qmailDotMode'            => $_POST["qmailDotMode"],
 166                  'deliveryProgramPath'        => $_POST["deliveryProgramPath"],
 167                  'accountStatus'            => $accountStatus,
 168                  'deliveryMode'            => $deliveryMode
 169              );
 170              
 171              if($_POST["add_mailAlternateAddress"]) $bo_action='add_mailAlternateAddress';
 172              if($_POST["remove_mailAlternateAddress"]) $bo_action='remove_mailAlternateAddress';
 173              if($_POST["add_mailRoutingAddress"]) $bo_action='add_mailRoutingAddress';
 174              if($_POST["remove_mailRoutingAddress"]) $bo_action='remove_mailRoutingAddress';
 175              if($_POST["save"]) $bo_action='save';
 176              
 177              $this->boemailadmin->saveUserData($_GET['account_id'], $formData, $bo_action);
 178  
 179              if ($bo_action == 'save')
 180              {
 181                  // read date fresh from ldap storage
 182                  $this->editUserData();
 183              }
 184              else
 185              {
 186                  // use cached data
 187                  $this->editUserData('1');
 188              }
 189          }
 190          
 191  		function translate()
 192          {
 193              $this->t->set_var('th_bg',$GLOBALS['egw_info']['theme']['th_bg']);
 194  
 195              $this->t->set_var('lang_add',lang('add'));
 196              $this->t->set_var('lang_done',lang('Done'));
 197              $this->t->set_var('lang_remove',lang('remove'));
 198              $this->t->set_var('lang_remove',lang('remove'));
 199              $this->t->set_var('lang_advanced_options',lang('advanced options'));
 200              $this->t->set_var('lang_qmaildotmode',lang('qmaildotmode'));
 201              $this->t->set_var('lang_default',lang('default'));
 202              $this->t->set_var('lang_quota_settings',lang('quota settings'));
 203              $this->t->set_var('lang_qoutainmbyte',lang('qouta size in MByte'));
 204              $this->t->set_var('lang_inmbyte',lang('in MByte'));
 205              $this->t->set_var('lang_0forunlimited',lang('leave empty for no quota'));
 206              $this->t->set_var('lang_forward_only',lang('forward only'));
 207          }
 208      }
 209  ?>


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