create-mailbox.php:

- renamed $pCreate_mailbox_*_text to $pCreate_mailbox_*_text_error
- replaced $tMessage with flash_error() / flash_info()

templates/create-mailbox.tpl:
- added 4th column for error messaegs
- replaced <h3> with <th>
- marked lables with <label>
- aligned button with input fields
- removed tMessage

This commit is part of the huge cleanup patch by Dale Blount (lnxus@SF),
https://sourceforge.net/tracker/?func=detail&atid=937966&aid=3370510&group_id=191583


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1107 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 14 years ago
parent d660270ef9
commit 7203639886

@ -17,7 +17,6 @@
* *
* Template Variables: * Template Variables:
* *
* tMessage
* tUsername * tUsername
* tName * tName
* tQuota * tQuota
@ -49,6 +48,9 @@ else {
$pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text']; $pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text'];
$pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text']; $pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text'];
$pCreate_mailbox_username_text_error = "";
$pCreate_mailbox_password_text_error = "";
$pCreate_mailbox_quota_text_error = "";
if ($_SERVER['REQUEST_METHOD'] == "GET") if ($_SERVER['REQUEST_METHOD'] == "GET")
{ {
@ -88,7 +90,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$tName = $fName; $tName = $fName;
$tQuota = $fQuota; $tQuota = $fQuota;
$tDomain = $fDomain; $tDomain = $fDomain;
$pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error1']; $pCreate_mailbox_username_text_error = $PALANG['pCreate_mailbox_username_text_error1'];
} }
if (!check_mailbox ($fDomain)) if (!check_mailbox ($fDomain))
@ -98,7 +100,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$tName = $fName; $tName = $fName;
$tQuota = $fQuota; $tQuota = $fQuota;
$tDomain = $fDomain; $tDomain = $fDomain;
$pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error3']; $pCreate_mailbox_username_text_error = $PALANG['pCreate_mailbox_username_text_error3'];
} }
if (empty ($fUsername) or !check_email ($fUsername)) if (empty ($fUsername) or !check_email ($fUsername))
@ -108,7 +110,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$tName = $fName; $tName = $fName;
$tQuota = $fQuota; $tQuota = $fQuota;
$tDomain = $fDomain; $tDomain = $fDomain;
$pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error1']; $pCreate_mailbox_username_text_error = $PALANG['pCreate_mailbox_username_text_error1'];
} }
$tPassGenerated = 0; $tPassGenerated = 0;
@ -126,7 +128,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$tName = $fName; $tName = $fName;
$tQuota = $fQuota; $tQuota = $fQuota;
$tDomain = $fDomain; $tDomain = $fDomain;
$pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text_error']; $pCreate_mailbox_password_text_error = $PALANG['pCreate_mailbox_password_text_error'];
} }
} }
@ -139,7 +141,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$tName = $fName; $tName = $fName;
$tQuota = $fQuota; $tQuota = $fQuota;
$tDomain = $fDomain; $tDomain = $fDomain;
$pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text_error']; $pCreate_mailbox_quota_text_error = $PALANG['pCreate_mailbox_quota_text_error'];
} }
} }
@ -151,7 +153,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$tName = $fName; $tName = $fName;
$tQuota = $fQuota; $tQuota = $fQuota;
$tDomain = $fDomain; $tDomain = $fDomain;
$pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error2']; $pCreate_mailbox_username_text_error = $PALANG['pCreate_mailbox_username_text_error2'];
} }
if ($error != 1) if ($error != 1)
@ -204,7 +206,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
if ($result['rows'] != 1) if ($result['rows'] != 1)
{ {
$tDomain = $fDomain; $tDomain = $fDomain;
$tMessage = $PALANG['pAlias_result_error'] . "<br />($fUsername -> $fUsername)</br />"; flash_error($PALANG['pAlias_result_error'] . "<br />($fUsername -> $fUsername)");
} }
// apparently uppercase usernames really confuse some IMAP clients. // apparently uppercase usernames really confuse some IMAP clients.
@ -218,7 +220,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
if ($result['rows'] != 1 || !mailbox_postcreation($fUsername,$fDomain,$maildir, $quota)) if ($result['rows'] != 1 || !mailbox_postcreation($fUsername,$fDomain,$maildir, $quota))
{ {
$tDomain = $fDomain; $tDomain = $fDomain;
$tMessage .= $PALANG['pCreate_mailbox_result_error'] . "<br />($fUsername)<br />"; flash_error($PALANG['pCreate_mailbox_result_error'] . "<br />($fUsername)");
db_query('ROLLBACK'); db_query('ROLLBACK');
} }
else else
@ -238,11 +240,11 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
if (!smtp_mail ($fTo, $fFrom, $fSubject, $fBody)) if (!smtp_mail ($fTo, $fFrom, $fSubject, $fBody))
{ {
$tMessage .= "<br />" . $PALANG['pSendmail_result_error'] . "<br />"; flash_error($PALANG['pSendmail_result_error']);
} }
else else
{ {
$tMessage .= "<br />" . $PALANG['pSendmail_result_success'] . "<br />"; flash_info($PALANG['pSendmail_result_success']);
} }
} }
@ -251,9 +253,9 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
if (create_mailbox_subfolders($fUsername,$fPassword)) if (create_mailbox_subfolders($fUsername,$fPassword))
{ {
$tMessage .= $PALANG['pCreate_mailbox_result_success'] . "<br />($fUsername$tShowpass)"; flash_info($PALANG['pCreate_mailbox_result_success'] . "<br />($fUsername$tShowpass)");
} else { } else {
$tMessage .= $PALANG['pCreate_mailbox_result_succes_nosubfolders'] . "<br />($fUsername$tShowpass)"; flash_info($PALANG['pCreate_mailbox_result_succes_nosubfolders'] . "<br />($fUsername$tShowpass)");
} }
} }
@ -263,11 +265,13 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$smarty->assign ('tUsername', $tUsername); $smarty->assign ('tUsername', $tUsername);
$smarty->assign ('select_options', select_options ($list_domains, array ($tDomain)), false); $smarty->assign ('select_options', select_options ($list_domains, array ($tDomain)), false);
$smarty->assign ('pCreate_mailbox_username_text', $pCreate_mailbox_username_text, false); $smarty->assign ('pCreate_mailbox_username_text', $pCreate_mailbox_username_text, false);
$smarty->assign ('pCreate_mailbox_username_text_error', $pCreate_mailbox_username_text_error, false);
$smarty->assign ('pCreate_mailbox_password_text', $pCreate_mailbox_password_text, false); $smarty->assign ('pCreate_mailbox_password_text', $pCreate_mailbox_password_text, false);
$smarty->assign ('pCreate_mailbox_password_text_error', $pCreate_mailbox_password_text_error, false);
$smarty->assign ('tName', $tName, false); $smarty->assign ('tName', $tName, false);
$smarty->assign ('tQuota', $tQuota); $smarty->assign ('tQuota', $tQuota);
$smarty->assign ('pCreate_mailbox_quota_text', $pCreate_mailbox_quota_text, false); $smarty->assign ('pCreate_mailbox_quota_text', $pCreate_mailbox_quota_text, false);
$smarty->assign ('tMessage', $tMessage, false); $smarty->assign ('pCreate_mailbox_quota_text_error', $pCreate_mailbox_quota_text_error, false);
$smarty->assign ('smarty_template', 'create-mailbox'); $smarty->assign ('smarty_template', 'create-mailbox');
$smarty->display ('index.tpl'); $smarty->display ('index.tpl');

@ -3,53 +3,56 @@
<form name="mailbox" method="post" action=""> <form name="mailbox" method="post" action="">
<table> <table>
<tr> <tr>
<td colspan="3"><h3>{$PALANG.pCreate_mailbox_welcome}</h3></td> <th colspan="4">{$PALANG.pCreate_mailbox_welcome}</th>
</tr> </tr>
<tr> <tr>
<td>{$PALANG.pCreate_mailbox_username}:</td> <td class="label"><label>{$PALANG.pCreate_mailbox_username}:</label></td>
<td><input class="flat" type="text" name="fUsername" value="{$tUsername}"/></td> <td><input class="flat" type="text" name="fUsername" value="{$tUsername}"/></td>
<td>@ <td>@
<select name="fDomain">{$select_options}</select> <select name="fDomain">{$select_options}</select>
{$pCreate_mailbox_username_text} {$pCreate_mailbox_username_text}
</td> </td>
<td><span class="error_msg">{$pCreate_mailbox_username_text_error}</span></td>
</tr> </tr>
<tr> <tr>
<td>{$PALANG.pCreate_mailbox_password}:</td> <td class="label"><label>{$PALANG.pCreate_mailbox_password}:</label></td>
<td><input class="flat" type="password" name="fPassword" /></td> <td><input class="flat" type="password" name="fPassword" /></td>
<td>{$pCreate_mailbox_password_text}</td> <td>{$pCreate_mailbox_password_text}</td>
<td><span class="error_msg">{$pCreate_mailbox_password_text_error}</span></td>
</tr> </tr>
<tr> <tr>
<td>{$PALANG.pCreate_mailbox_password2}:</td> <td class="label"><label>{$PALANG.pCreate_mailbox_password2}:</label></td>
<td><input class="flat" type="password" name="fPassword2" /></td> <td><input class="flat" type="password" name="fPassword2" /></td>
<td>&nbsp;</td> <td colspan="2">&nbsp;</td>
</tr> </tr>
<tr> <tr>
<td>{$PALANG.pCreate_mailbox_name}:</td> <td class="label"><label>{$PALANG.pCreate_mailbox_name}:</label></td>
<td><input class="flat" type="text" name="fName" value="{$tName}" /></td> <td><input class="flat" type="text" name="fName" value="{$tName}" /></td>
<td>{$PALANG.pCreate_mailbox_name_text}</td> <td>{$PALANG.pCreate_mailbox_name_text}</td>
<td>&nbsp;</td>
</tr> </tr>
{if $CONF.quota===YES} {if $CONF.quota===YES}
<tr> <tr>
<td>{$PALANG.pCreate_mailbox_quota}:</td> <td class="label"><label>{$PALANG.pCreate_mailbox_quota}:</label></td>
<td><input class="flat" type="text" name="fQuota" value="{$tQuota}" /></td> <td><input class="flat" type="text" name="fQuota" value="{$tQuota}" /></td>
<td>{$pCreate_mailbox_quota_text}</td> <td>{$pCreate_mailbox_quota_text}</td>
<td><span class="error_msg">{$pCreate_mailbox_quota_text_error}</span></td>
</tr> </tr>
{/if} {/if}
<tr> <tr>
<td>{$PALANG.pCreate_mailbox_active}:</td> <td class="label"><label>{$PALANG.pCreate_mailbox_active}:</label></td>
<td><input class="flat" type="checkbox" name="fActive" checked="checked" /></td> <td><input class="flat" type="checkbox" name="fActive" checked="checked" /></td>
<td>&nbsp;</td> <td colspan="2">&nbsp;</td>
</tr> </tr>
<tr> <tr>
<td>{$PALANG.pCreate_mailbox_mail}:</td> <td class="label"><label>{$PALANG.pCreate_mailbox_mail}:</label></td>
<td><input class="flat" type="checkbox" name="fMail" checked="checked" /></td> <td><input class="flat" type="checkbox" name="fMail" checked="checked" /></td>
<td>&nbsp;</td> <td colspan="2">&nbsp;</td>
</tr> </tr>
<tr> <tr>
<td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="{$PALANG.pCreate_mailbox_button}" /></td> <td>&nbsp;</td>
</tr> <td><input class="button" type="submit" name="submit" value="{$PALANG.pCreate_mailbox_button}" /></td>
<tr> <td colspan="2">&nbsp;</td>
<td colspan="3" class="standout">{$tMessage}</td>
</tr> </tr>
</table> </table>
</form> </form>

Loading…
Cancel
Save