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