2004-08-26 00:29:28 +02:00
|
|
|
<?php
|
|
|
|
/***************************************************************************\
|
|
|
|
* EGroupWare - LDAPManager *
|
|
|
|
* http://www.egroupware.org *
|
|
|
|
* Written by : Andreas Krause (ak703@users.sourceforge.net *
|
|
|
|
* based on EmailAdmin by Lars Kneschke [lkneschke@egroupware.org] *
|
|
|
|
* ------------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\***************************************************************************/
|
|
|
|
|
|
|
|
class uildap_mgr
|
|
|
|
{
|
|
|
|
|
|
|
|
var $public_functions = array
|
|
|
|
(
|
|
|
|
'editUserData' => True,
|
|
|
|
'saveUserData' => True
|
|
|
|
);
|
|
|
|
|
|
|
|
function uildap_mgr()
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$this->t =& CreateObject('phpgwapi.Template',EGW_APP_TPL);
|
|
|
|
$this->boldapmgr =& CreateObject('admin.boldap_mgr');
|
2004-08-26 00:29:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function display_app_header()
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$GLOBALS['egw']->common->egw_header();
|
2004-08-26 00:29:28 +02:00
|
|
|
echo parse_navbar();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function editUserData($_useCache='0')
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
global $phpgw, $phpgw_info, $_GET;
|
2004-08-26 00:29:28 +02:00
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$accountID = $_GET['account_id'];
|
2004-08-26 00:29:28 +02:00
|
|
|
$GLOBALS['account_id'] = $accountID;
|
|
|
|
|
|
|
|
$this->display_app_header();
|
|
|
|
|
|
|
|
$this->translate();
|
|
|
|
|
|
|
|
$this->t->set_file(array("editUserData" => "account_form_ldapdata.tpl"));
|
|
|
|
$this->t->set_block('editUserData','form','form');
|
|
|
|
$this->t->set_block('editUserData','link_row','link_row');
|
2005-10-14 19:03:16 +02:00
|
|
|
$this->t->set_var("th_bg",$GLOBALS['egw_info']["theme"]["th_bg"]);
|
|
|
|
$this->t->set_var("tr_color1",$GLOBALS['egw_info']["theme"]["row_on"]);
|
|
|
|
$this->t->set_var("tr_color2",$GLOBALS['egw_info']["theme"]["row_off"]);
|
2004-08-26 00:29:28 +02:00
|
|
|
|
|
|
|
$this->t->set_var("lang_email_config",lang("edit email settings"));
|
|
|
|
$this->t->set_var("lang_emailAddress",lang("email address"));
|
|
|
|
$this->t->set_var("lang_emailaccount_active",lang("email account active"));
|
|
|
|
$this->t->set_var("lang_mailAlternateAddress",lang("alternate email address"));
|
|
|
|
$this->t->set_var("lang_mailForwardingAddress",lang("forward email's to"));
|
|
|
|
$this->t->set_var("lang_forward_also_to",lang("forward also to"));
|
|
|
|
$this->t->set_var("lang_button",lang("save"));
|
|
|
|
$this->t->set_var("lang_deliver_extern",lang("deliver extern"));
|
|
|
|
$this->t->set_var("lang_edit_email_settings",lang("edit email settings"));
|
|
|
|
$this->t->set_var("lang_ready",lang("Done"));
|
2005-10-14 19:03:16 +02:00
|
|
|
$this->t->set_var("link_back",$GLOBALS['egw']->link('/admin/accounts.php'));
|
|
|
|
$this->t->set_var("info_icon",EGW_IMAGES_DIR.'/info.gif');
|
2004-08-26 00:29:28 +02:00
|
|
|
|
2004-08-26 23:11:25 +02:00
|
|
|
|
2004-08-26 00:29:28 +02:00
|
|
|
$linkData = array
|
|
|
|
(
|
|
|
|
'menuaction' => 'admin.uildap_mgr.saveUserData',
|
|
|
|
'account_id' => $accountID
|
|
|
|
);
|
2005-10-14 19:03:16 +02:00
|
|
|
$this->t->set_var("form_action", $GLOBALS['egw']->link('/index.php',$linkData));
|
2004-08-26 00:29:28 +02:00
|
|
|
|
|
|
|
// only when we show a existing user
|
|
|
|
if($userData = $this->boldapmgr->getUserData($accountID, $_useCache))
|
|
|
|
{
|
|
|
|
echo "<br><br><br>";
|
|
|
|
if ($userData['mailAlternateAddress'] != '')
|
|
|
|
{
|
|
|
|
$options_mailAlternateAddress = "<select size=\"6\" name=\"mailAlternateAddress\">\n";
|
|
|
|
for ($i=0;$i < count($userData['mailAlternateAddress']); $i++)
|
|
|
|
{
|
|
|
|
$options_mailAlternateAddress .= "<option value=\"".$i."\">".
|
|
|
|
$userData['mailAlternateAddress'][$i].
|
|
|
|
"</option>\n";
|
|
|
|
}
|
|
|
|
$options_mailAlternateAddress .= "</select>\n";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$options_mailAlternateAddress = lang('no alternate email address');
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->t->set_var("mail",$userData["mail"]);
|
2004-08-26 23:11:25 +02:00
|
|
|
//$this->t->set_var("mailAlternateAddress",''); could be deleted?
|
|
|
|
|
|
|
|
if ($userData["mailForwardingAddress"] == "")
|
|
|
|
{
|
|
|
|
$this->t->set_var("mailForwardingAddress",$userData["mail"]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->t->set_var("mailForwardingAddress",$userData["mailForwardingAddress"]);
|
|
|
|
}
|
|
|
|
|
2004-08-26 00:29:28 +02:00
|
|
|
$this->t->set_var("options_mailAlternateAddress",$options_mailAlternateAddress);
|
|
|
|
|
|
|
|
$this->t->set_var("uid",rawurlencode($_accountData["dn"]));
|
|
|
|
if ($userData["accountStatus"] == "active")
|
|
|
|
$this->t->set_var("account_checked","checked");
|
|
|
|
if ($userData["deliveryMode"] == "forwardOnly")
|
|
|
|
$this->t->set_var("forwardOnly_checked","checked");
|
|
|
|
if ($_accountData["deliverExtern"] == "active")
|
|
|
|
$this->t->set_var("deliver_checked","checked");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->t->set_var("mail",'');
|
|
|
|
$this->t->set_var("mailAlternateAddress",'');
|
|
|
|
$this->t->set_var("mailForwardingAddress",'');
|
|
|
|
$this->t->set_var("options_mailAlternateAddress",lang('no alternate email address'));
|
|
|
|
$this->t->set_var("account_checked",'');
|
|
|
|
$this->t->set_var("forwardOnly_checked",'');
|
|
|
|
}
|
|
|
|
|
|
|
|
// create the menu on the left, if needed
|
2005-10-14 19:03:16 +02:00
|
|
|
$menuClass =& CreateObject('admin.uimenuclass');
|
2004-08-26 00:29:28 +02:00
|
|
|
$this->t->set_var('rows',$menuClass->createHTMLCode('edit_user'));
|
|
|
|
|
|
|
|
$this->t->pparse("out","form");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function saveUserData()
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
global $_POST, $_GET;
|
2004-08-26 00:29:28 +02:00
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
if($_POST["accountStatus"] == "on")
|
2004-08-26 00:29:28 +02:00
|
|
|
{
|
|
|
|
$accountStatus = "active";
|
|
|
|
}
|
2005-10-14 19:03:16 +02:00
|
|
|
if($_POST["forwardOnly"] == "on")
|
2004-08-26 00:29:28 +02:00
|
|
|
{
|
|
|
|
$deliveryMode = "forwardOnly";
|
|
|
|
}
|
|
|
|
|
|
|
|
$formData = array
|
|
|
|
(
|
2005-10-14 19:03:16 +02:00
|
|
|
'mail' => $_POST["mail"],
|
|
|
|
'mailAlternateAddress' => $_POST["mailAlternateAddress"],
|
|
|
|
'mailForwardingAddress' => $_POST["mailForwardingAddress"],
|
|
|
|
'add_mailAlternateAddress' => $_POST["mailAlternateAddressInput"],
|
|
|
|
'remove_mailAlternateAddress' => $_POST["mailAlternateAddress"],
|
2004-08-26 00:29:28 +02:00
|
|
|
'accountStatus' => $accountStatus,
|
|
|
|
'deliveryMode' => $deliveryMode
|
|
|
|
);
|
|
|
|
|
|
|
|
//echo "<br><br>DebugArray in uiuserdata";
|
|
|
|
// echo _debug_array($formData);
|
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
if($_POST["add_mailAlternateAddress"]) $bo_action='add_mailAlternateAddress';
|
|
|
|
if($_POST["remove_mailAlternateAddress"]) $bo_action='remove_mailAlternateAddress';
|
|
|
|
if($_POST["save"]) $bo_action='save';
|
2004-08-26 00:29:28 +02:00
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
if (!$_POST["mail"]== "") //attribute 'mail'is not allowed to be empty
|
2004-08-26 23:11:25 +02:00
|
|
|
{
|
|
|
|
// error generator necessary!!
|
|
|
|
$this->boldapmgr->saveUserData($_GET['account_id'], $formData, $bo_action);
|
|
|
|
}
|
2004-08-26 00:29:28 +02:00
|
|
|
if ($bo_action == 'save')
|
|
|
|
{
|
|
|
|
// read date fresh from ldap storage
|
|
|
|
$this->editUserData();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// use cached data
|
|
|
|
$this->editUserData('1');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function translate()
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
|
2004-08-26 00:29:28 +02:00
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$this->t->set_var('th_bg',$GLOBALS['egw_info']['theme']['th_bg']);
|
2004-08-26 00:29:28 +02:00
|
|
|
|
|
|
|
$this->t->set_var('lang_add',lang('add'));
|
|
|
|
$this->t->set_var('lang_done',lang('Done'));
|
|
|
|
$this->t->set_var('lang_remove',lang('remove'));
|
|
|
|
$this->t->set_var('lang_remove',lang('remove'));
|
|
|
|
$this->t->set_var('lang_advanced_options',lang('advanced options'));
|
|
|
|
$this->t->set_var('lang_qmaildotmode',lang('qmaildotmode'));
|
|
|
|
$this->t->set_var('lang_default',lang('default'));
|
|
|
|
$this->t->set_var('lang_quota_settings',lang('quota settings'));
|
|
|
|
$this->t->set_var('lang_qoutainmbyte',lang('qouta size in MByte'));
|
|
|
|
$this->t->set_var('lang_inmbyte',lang('in MByte'));
|
|
|
|
$this->t->set_var('lang_0forunlimited',lang('leave empty for no quota'));
|
|
|
|
$this->t->set_var('lang_forward_only',lang('forward only'));
|
|
|
|
$this->t->set_var('lang_mailAliases',lang('Aliases'));
|
2004-08-26 23:11:25 +02:00
|
|
|
$this->t->set_var('lang_info_mailAliases',lang('Attribute mailAlternateAddress explained'));
|
2004-08-26 00:29:28 +02:00
|
|
|
$this->t->set_var('lang_masterEmailAddress',lang('Main Email-Address'));
|
2004-08-26 23:11:25 +02:00
|
|
|
$this->t->set_var('lang_info_masterEmailAddress',lang('Attribute mail explained'));
|
2004-08-26 00:29:28 +02:00
|
|
|
$this->t->set_var('lang_RouteMailsTo',lang('Route all Mails to'));
|
2004-08-26 23:11:25 +02:00
|
|
|
$this->t->set_var('lang_info_RouteMailsTo',lang('Attribute mailForwardingAddress explained'));
|
|
|
|
$this->t->set_var('lang_info_AccountActive',lang('Attribute accountstatus explained'));
|
|
|
|
$this->t->set_var('lang_info_UsageHints',lang('Explanation of LDAPMAN'));
|
2004-08-26 00:29:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|