Skip to content

Commit

Permalink
firewall: do not probe translations for other translated words; fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Aug 17, 2015
1 parent eddee1f commit fd3e179
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/www/firewall_nat.php
Expand Up @@ -243,7 +243,7 @@ function delete_id($id, &$array){

<?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('natconf')): ?>
<?php print_info_box_np(gettext("The NAT configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
<?php print_info_box_apply(gettext("The NAT configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
<?php endif; ?>

<section class="col-xs-12">
Expand Down
9 changes: 5 additions & 4 deletions src/www/firewall_rules.php
Expand Up @@ -388,12 +388,13 @@ function(){
<?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('filter')): ?><p>
<?php
if($_REQUEST['undodrag']) {
foreach($_REQUEST['dragtable'] as $dt)
if ($_REQUEST['undodrag']) {
foreach ($_REQUEST['dragtable'] as $dt) {
$dragtable .= "&dragtable[]={$dt}";
print_info_box_np_undo(gettext("The firewall rule configuration has been changed.<br />You must apply the changes in order for them to take effect."), "apply" , gettext("Apply changes") , "firewall_rules.php?if={$_REQUEST['if']}&dragdroporder=true&{$dragtable}");
}
print_info_box_apply_undo(gettext("The firewall rule configuration has been changed.<br />You must apply the changes in order for them to take effect."), "firewall_rules.php?if={$_REQUEST['if']}&dragdroporder=true&{$dragtable}");
} else {
print_info_box_np(gettext("The firewall rule configuration has been changed.<br />You must apply the changes in order for them to take effect."));
print_info_box_apply(gettext("The firewall rule configuration has been changed.<br />You must apply the changes in order for them to take effect."));
}
?>

Expand Down
44 changes: 30 additions & 14 deletions src/www/guiconfig.inc
Expand Up @@ -179,6 +179,28 @@ function print_input_errors($input_errors) {
echo "</ul></div></div>";
}

function print_info_box_apply($msg)
{
$value = gettext('Apply changes');
$name= 'apply';

$savebutton = '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post">';
$savebutton .= '<input name="' . $name . '" type="submit" class="btn btn-default" id="' . $name . '" value="' . $value . '" />';
if ($_POST['if']) {
$savebutton .= '<input type="hidden" name="if" value="' . htmlspecialchars($_POST['if']) . '" />';
}
$savebutton .= '</form>';

echo <<<EOFnp
<div class="col-xs-12">
<div class="alert alert-info alert-dismissible" role="alert">
{$savebutton}
<p>{$msg}</p>
</div>
</div>
EOFnp;
}

function print_info_box_np($msg, $name="apply",$value="", $showapply=false) {
if(empty($value)) {
$value = gettext("Apply changes");
Expand All @@ -205,23 +227,17 @@ EOFnp;

}

function print_info_box_np_undo($msg, $name="apply",$value="Apply changes", $undo) {
if(stristr($msg, "apply") != false || stristr($msg, "save") != false || stristr($msg, "create") != false) {

$savebutton .= "<input class=\"btn btn-default\" type=\"button\" value=\"". gettext("Undo") . "\" onclick=\"document.location='{$undo}'\" />";
$savebutton .= "<input class=\"btn btn-default\" name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\" />";

if(isset($_POST['if']))
$savebutton .= "<input type=\"hidden\" name=\"if\" value=\"" . htmlspecialchars($_POST['if']) . "\" />";
} else {
$savebutton = "<input class=\"btn btn-default\" value=\"" . gettext("Close") . "\" type=\"button\" onclick=\"$('#redboxtable').hide();\" />";
}
function print_info_box_apply_undo($msg, $undo)
{
$value = gettext('Apply changes');
$name= 'apply';

$savebutton .= "<input class=\"btn btn-default\" type=\"button\" value=\"". gettext("Undo") . "\" onclick=\"document.location='{$undo}'\" />";
$savebutton .= "<input class=\"btn btn-default\" name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\" />";

$url = $_SERVER['REQUEST_URI'];

echo <<<EOFnp
<div class="col-xs-12" id="redboxtable"><form action="{$url}" method="post">
<div class="alert alert-warning" summary="red box table">
<p>{$msg}<br /><br /></p>
Expand All @@ -232,10 +248,10 @@ function print_info_box_np_undo($msg, $name="apply",$value="Apply changes", $und
</div>
</form></div>
EOFnp;

}

function print_info_box($msg) {
function print_info_box($msg)
{
print_info_box_np($msg);
}

Expand Down

0 comments on commit fd3e179

Please sign in to comment.