Commit d4c760c1 authored by mcramer's avatar mcramer
Browse files

Implemented optional custom login name for mailboxes.

parent 03b74b91
......@@ -4,4 +4,5 @@ $wb["email_txt"] = 'Email';
$wb["autoresponder_txt"] = 'Autoresponder';
$wb["add_new_record_txt"] = 'Add new Mailbox';
$wb["name_txt"] = 'Realname';
$wb["login_txt"] = 'Login';
?>
\ No newline at end of file
......@@ -47,14 +47,23 @@ $liste["auth"] = "yes";
* Suchfelder
*****************************************************/
$liste["item"][] = array( 'field' => "email",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "email",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "login",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "name",
'datatype' => "VARCHAR",
......
......@@ -75,7 +75,7 @@ class page_action extends tform_actions {
$app->tpl->setVar("email_local_part",$email_parts[0]);
// Getting Domains of the user
$sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
$sql = "SELECT domain, server_id FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
$domains = $app->db->queryAllRecords($sql);
$domain_select = '';
if(is_array($domains)) {
......@@ -114,6 +114,14 @@ class page_action extends tform_actions {
$app->tpl->setVar("ar_active", '');
}
$app->uses('getconf');
$mail_config = $app->getconf->get_global_config('mail');
if($mail_config["enable_custom_login"] == "y") {
$app->tpl->setVar("enable_custom_login", 1);
} else {
$app->tpl->setVar("enable_custom_login", 0);
}
parent::onShowEnd();
}
......@@ -165,6 +173,9 @@ class page_action extends tform_actions {
} // end if user is not admin
$app->uses('getconf');
$mail_config = $app->getconf->get_server_config($domain["server_id"],'mail');
//* compose the email field
if(isset($_POST["email_local_part"]) && isset($_POST["email_domain"])) {
$this->dataRecord["email"] = strtolower($_POST["email_local_part"]."@".$_POST["email_domain"]);
......@@ -179,8 +190,6 @@ class page_action extends tform_actions {
if($this->dataRecord["quota"] != -1) $this->dataRecord["quota"] = $this->dataRecord["quota"] * 1024 * 1024;
// setting Maildir, Homedir, UID and GID
$app->uses('getconf');
$mail_config = $app->getconf->get_server_config($domain["server_id"],'mail');
$maildir = str_replace("[domain]",$domain["domain"],$mail_config["maildir_path"]);
$maildir = str_replace("[localpart]",strtolower($_POST["email_local_part"]),$maildir);
$this->dataRecord["maildir"] = $maildir;
......@@ -195,6 +204,13 @@ class page_action extends tform_actions {
}
$sys_config = $app->getconf->get_global_config('mail');
if($sys_config["enable_custom_login"] == "y") {
if(!isset($_POST["login"])) $this->dataRecord["login"] = $this->dataRecord["email"];
elseif(strpos($_POST["login"], '@') !== false && $_POST["login"] != $this->dataRecord["email"]) $app->tform->errorMessage .= $app->tform->lng("error_login_email_txt")."<br>";
} else {
$this->dataRecord["login"] = $this->dataRecord["email"];
}
//* if autoresponder checkbox not selected, do not save dates
if (!isset($_POST['autoresponder']) && array_key_exists('autoresponder_start_date', $_POST)) {
$this->dataRecord['autoresponder_start_date'] = array_map(create_function('$item','return 0;'), $this->dataRecord['autoresponder_start_date']);
......
......@@ -31,6 +31,12 @@ class list_action extends listform_actions {
} else {
$app->tpl->setVar('mailboxlist_webmail_link',0);
}
if($global_config["enable_custom_login"] == "y") {
$app->tpl->setVar("enable_custom_login", 1);
} else {
$app->tpl->setVar("enable_custom_login", 0);
}
parent::onShow();
}
......
......@@ -19,13 +19,15 @@
<thead>
<tr>
<th class="tbl_col_email" scope="col"><tmpl_var name="email_txt"></th>
<th class="tbl_col_name" scope="col"><tmpl_var name="name_txt"></th>
<tmpl_if name="enable_custom_login"><th class="tbl_col_login" scope="col"><tmpl_var name="login_txt"></th></tmpl_if>
<th class="tbl_col_name" scope="col"><tmpl_var name="name_txt"></th>
<th class="tbl_col_autoresponder" scope="col"><tmpl_var name="autoresponder_txt"></th>
<th class="tbl_col_buttons" scope="col">&nbsp;</th>
</tr>
<tr>
<td class="tbl_col_email"><input type="text" name="search_email" value="{tmpl_var name='search_email'}" /></td>
<td class="tbl_col_name"><input type="text" name="search_name" value="{tmpl_var name='search_name'}" /></td>
<tmpl_if name="enable_custom_login"><td class="tbl_col_login"><input type="text" name="search_login" value="{tmpl_var name='search_login'}" /></td></tmpl_if>
<td class="tbl_col_autoresponder"><input type="text" name="search_autoresponder" value="{tmpl_var name='search_autoresponder'}" /></td>
<td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','mail/mail_user_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
</tr>
......@@ -34,6 +36,7 @@
<tmpl_loop name="records">
<tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
<td class="tbl_col_email"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="email"}</a></td>
<tmpl_if name="enable_custom_login"><td class="tbl_col_login"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="login"}</a></td></tmpl_if>
<td class="tbl_col_name"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="name"}</a></td>
<td class="tbl_col_autoresponder"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="autoresponder"}</a></td>
<td class="tbl_col_buttons">
......@@ -48,7 +51,7 @@
<tfoot>
<tr>
<td class="tbl_footer tbl_paging" colspan="4"><tmpl_var name="paging"></td>
<td class="tbl_footer tbl_paging" colspan="<tmpl_if name="enable_custom_login">5<tmpl_else>4</tmpl_if>"><tmpl_var name="paging"></td>
</tr>
</tfoot>
</table>
......
......@@ -17,6 +17,10 @@
<label for="email_domain" class="blockLabel formLengthEmailDomain">{tmpl_var name='domain_txt'}<select name="email_domain" id="email_domain" class="selectInput">{tmpl_var name='email_domain'}</select></label>
</div>
</div>
<tmpl_if name="enable_custom_login"><div class="ctrlHolder">
<label for="login">{tmpl_var name='login_txt'}</label>
<input type="text" id="login" name="login" size="20" value="{tmpl_var name='login'}" class="textInput" /></label>
</div></tmpl_if>
<div class="ctrlHolder">
<label for="password">{tmpl_var name='password_txt'}</label>
<input name="password" id="password" value="{tmpl_var name='password'}" size="30" maxlength="255" type="password" class="textInput" onkeyup="pass_check(this.value)" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment