0
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2024-09-19 19:22:14 +02:00

create-alias.php:

- renamed $pCreate_alias_address_text to $pCreate_alias_address_text_error
- replaced $tMessage with flash_error() / flash_info()
- changes compared to Dale's patch:
  - do not add $fAddress and $fGoto to $PALANG['pCreate_alias_goto_text_error']
    error message

templates/create-alias.tpl:
- added 4th column for error messages
- replace <h3> with <th>
- mark labels with <label>
- aligned button with input fields
- added $PALANG[pCreate_alias_help]
- 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@1104 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
Christian Boltz 2011-07-22 18:36:21 +00:00
parent 0bc0c29a77
commit 1467a959ed
2 changed files with 25 additions and 27 deletions

View File

@ -19,7 +19,6 @@
*
* Template Variables:
*
* tMessage
* tAddress
* tGoto
* tDomain
@ -45,6 +44,7 @@ else {
}
$pCreate_alias_goto_text = $PALANG['pCreate_alias_goto_text'];
$pCreate_alias_address_text_error = "";
if ($_SERVER['REQUEST_METHOD'] == "GET")
{
@ -87,7 +87,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$tAddress = escape_string ($_POST['fAddress']);
$tGoto = $fGoto;
$tDomain = $fDomain;
$pCreate_alias_address_text = $PALANG['pCreate_alias_address_text_error1'];
$pCreate_alias_address_text_error = $PALANG['pCreate_alias_address_text_error1'];
}
if(!check_alias($fDomain)) {
@ -95,7 +95,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$tAddress = escape_string ($_POST['fAddress']);
$tGoto = $fGoto;
$tDomain = $fDomain;
$pCreate_alias_address_text = $PALANG['pCreate_alias_address_text_error3'];
$pCreate_alias_address_text_error = $PALANG['pCreate_alias_address_text_error3'];
}
if(empty ($fAddress) || !check_email ($fAddress)) {
@ -103,7 +103,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$tAddress = escape_string ($_POST['fAddress']);
$tGoto = $fGoto;
$tDomain = $fDomain;
$pCreate_alias_address_text = $PALANG['pCreate_alias_address_text_error1'];
$pCreate_alias_address_text_error = $PALANG['pCreate_alias_address_text_error1'];
}
// Begin check alias email
@ -117,7 +117,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
if (empty ($goto) && !authentication_has_role('global-admin')) {
$error = 1;
$tGoto = $_POST['fGoto'];
$tMessage = $PALANG['pEdit_alias_goto_text_error1'];
flash_error($PALANG['pEdit_alias_goto_text_error1']);
}
$new_aliases = array();
@ -132,8 +132,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
if (!check_email($address)) {
$error = 1;
$tGoto = $goto;
if (!empty($tMessage)) $tMessage .= "<br />";
$tMessage .= $PALANG['pEdit_alias_goto_text_error2'] . "$address</span>";
flash_error($PALANG['pEdit_alias_goto_text_error2'] . "$address");
}
}
@ -146,7 +145,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$tAddress = escape_string ($_POST['fAddress']);
$tGoto = $fGoto;
$tDomain = $fDomain;
$pCreate_alias_goto_text = $PALANG['pCreate_alias_goto_text_error'];
flash_error($PALANG['pCreate_alias_goto_text_error']");
}
if (escape_string($_POST['fAddress']) == "*") {
@ -160,7 +159,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$tAddress = escape_string ($_POST['fAddress']);
$tGoto = $fGoto;
$tDomain = $fDomain;
$pCreate_alias_address_text = $PALANG['pCreate_alias_address_text_error2'];
$pCreate_alias_address_text_error = $PALANG['pCreate_alias_address_text_error2'];
}
if ($fActive == "on") {
@ -178,13 +177,13 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$result = db_query ("INSERT INTO $table_alias (address,goto,domain,created,modified,active) VALUES ('$fAddress','$fGoto','$fDomain',NOW(),NOW(),'$sqlActive')");
if ($result['rows'] != 1) {
$tDomain = $fDomain;
$tMessage = $PALANG['pCreate_alias_result_error'] . "<br />($fAddress -> $fGoto)<br />\n";
flash_error($PALANG['pCreate_alias_result_error'] . "<br />($fAddress -> $fGoto)<br />\n");
}
else {
db_log ($fDomain, 'create_alias', "$fAddress -> $fGoto");
$tDomain = $fDomain;
$tMessage = $PALANG['pCreate_alias_result_success'] . "<br />($fAddress -> $fGoto)<br />\n";
flash_info($PALANG['pCreate_alias_result_success'] . "<br />($fAddress -> $fGoto)<br />\n");
}
} else { # on error
$tAddress = htmlentities($_POST['fAddress']);
@ -196,9 +195,9 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$smarty->assign ('tAddress', $tAddress);
$smarty->assign ('select_options', select_options ($list_domains, array ($tDomain)), false);
$smarty->assign ('pCreate_alias_address_text', $pCreate_alias_address_text, false);
$smarty->assign ('pCreate_alias_address_text_error', $pCreate_alias_address_text_error, false);
$smarty->assign ('tGoto', $tGoto, false);
$smarty->assign ('pCreate_alias_goto_text', $pCreate_alias_goto_text);
$smarty->assign ('tMessage', $tMessage, false);
$smarty->assign ('smarty_template', 'create-alias');
$smarty->display ('index.tpl');

View File

@ -3,33 +3,32 @@
<form name="alias" method="post" action="">
<table>
<tr>
<td colspan="3"><h3>{$PALANG.pCreate_alias_welcome}</h3></td>
<th colspan="4">{$PALANG.pCreate_alias_welcome}</th>
</tr>
<tr>
<td>{$PALANG.pCreate_alias_address}</td>
<td><input class="flat" type="text" name="fAddress" value="{$tAddress}" /></td>
<td>@
<td class="label"><label>{$PALANG.pCreate_alias_address}:</label></td>
<td colspan="2"><input class="flat" type="text" name="fAddress" value="{$tAddress}" />
@
<select class="flat" name="fDomain">{$select_options}</select>
{$pCreate_alias_address_text}
</td>
<td><span class="error_msg">{$pCreate_alias_address_text_error}</span></td>
</tr>
<tr>
<td>{$PALANG.pCreate_alias_goto}:</td>
<td colspan="2"><textarea class="flat" rows="10" cols="60" name="fGoto">{$tGoto}</textarea></td>
</tr>
<tr>
<td>{$PALANG.pCreate_alias_active}:</td>
<td><input class="flat" type="checkbox" name="fActive" checked="checked"/></td>
<td class="label"><label>{$PALANG.pCreate_alias_goto}:</label></td>
<td><textarea class="flat" rows="10" cols="35" name="fGoto">{$tGoto}</textarea></td>
<td>{$PALANG.pCreate_alias_help}<br /><br />{$PALANG.pCreate_alias_catchall_text}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="{$PALANG.pCreate_alias_button}" /></td>
<td class="label"><label>{$PALANG.pCreate_alias_active}:</label></td>
<td><input class="flat" type="checkbox" name="fActive" checked="checked"/></td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="3" class="standout">{$tMessage}</td>
</tr>
<tr>
<td colspan="3" class="help_text">{$PALANG.pCreate_alias_catchall_text}</td>
<td>&nbsp;</td>
<td><input class="button" type="submit" name="submit" value="{$PALANG.pCreate_alias_button}" /></td>
<td colspan="2">&nbsp;</td>
</tr>
</table>
</form>