Revision 0032fa52
Added by Stephen Beaver almost 10 years ago
usr/local/www/firewall_nat_out.php | ||
---|---|---|
342 | 342 |
$form->add($section); |
343 | 343 |
print($form); |
344 | 344 |
?> |
345 |
<script> |
|
346 |
|
|
347 |
// Todo: Move script to external file ? |
|
348 |
// Check the checkbox, and change the background color when clicking on a row |
|
349 |
function fr_toggle(id, prefix) { |
|
350 |
|
|
351 |
if (!prefix) |
|
352 |
prefix = 'fr'; |
|
353 |
|
|
354 |
var checkbox = document.getElementById(prefix + 'c' + id); |
|
355 |
|
|
356 |
checkbox.checked = !checkbox.checked; |
|
357 |
fr_bgcolor(id, prefix); |
|
358 |
} |
|
359 |
|
|
360 |
function fr_bgcolor(id, prefix) { |
|
361 |
if (!prefix) |
|
362 |
prefix = 'fr'; |
|
363 |
|
|
364 |
var row = document.getElementById(prefix + id); |
|
365 |
var checkbox = document.getElementById(prefix + 'c' + id); |
|
366 |
var cells = row.getElementsByTagName('td'); |
|
367 |
var cellcnt = cells.length; |
|
368 |
|
|
369 |
for (i = 0; i < cellcnt; i++) |
|
370 |
cells[i].style.backgroundColor = checkbox.checked ? "#B9DEF0" : "#FFFFFF"; // #B9DEF0 = Bootstrap "info" |
|
371 |
} |
|
372 |
</script> |
|
373 | 345 |
|
374 | 346 |
<form action="firewall_nat_out.php" method="post" name="iform"> |
375 | 347 |
<div class="panel panel-default"> |
... | ... | |
378 | 350 |
<table class="table table-striped table-hover table-condensed"> |
379 | 351 |
<thead> |
380 | 352 |
<tr> |
381 |
<th><!-- checkbox --></th> |
|
382 | 353 |
<th><!-- status --></th> |
383 | 354 |
<th><?=gettext("Interface")?></th> |
384 | 355 |
<th><?=gettext("Source")?></th> |
... | ... | |
411 | 382 |
?> |
412 | 383 |
<tr id="fr<?=$i?>"> |
413 | 384 |
<td> |
414 |
<input type="hidden" name="rule[]" value="<?=$i?>" /> |
|
415 |
<input type="checkbox" id="frc<?=$i?>" name="rule[]" value="<?=$i?>" onclick="fr_bgcolor('<?=$i?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" /> |
|
416 |
</td> |
|
417 |
|
|
418 |
<td> |
|
419 | 385 |
<?php |
420 | 386 |
if ($mode == "disabled" || $mode == "automatic"): |
421 | 387 |
?> |
422 |
<img src="/bootstrap/glyphicons/glyphicons-halflings.png" class="<?= ($iconfn == "pass") ? "icon-ok":"icon-remove"?>" |
|
423 |
title="<?=gettext("Click to toggle enabled/disabled status")?>" alt="icon" /> |
|
388 |
<i class="<?= ($iconfn == "pass") ? "icon-ok":"icon-remove"?>"title="<?=gettext("Click to toggle enabled/disabled status")?>"></i> |
|
424 | 389 |
<?php |
425 | 390 |
else: |
426 | 391 |
?> |
427 | 392 |
<a href="?act=toggle&id=<?=$i?>"> |
428 |
<img src="/bootstrap/glyphicons/glyphicons-halflings.png" class="<?= ($iconfn == "pass") ? "icon-ok":"icon-remove"?>" |
|
429 |
title="<?=gettext("Click to toggle enabled/disabled status")?>" alt="icon" /> |
|
393 |
<i class="<?= ($iconfn == "pass") ? "icon-ok":"icon-remove"?>" title="<?=gettext("Click to toggle enabled/disabled status")?>"></i> |
|
430 | 394 |
</a> |
431 | 395 |
|
432 | 396 |
<?php |
... | ... | |
434 | 398 |
?> |
435 | 399 |
</td> |
436 | 400 |
|
437 |
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>"> |
|
401 |
<td> |
|
402 |
<input type="hidden" name="rule[]" value="<?=$i?>" /> |
|
438 | 403 |
<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface']))?> |
439 | 404 |
</td> |
440 | 405 |
|
441 |
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
|
|
406 |
<td> |
|
442 | 407 |
<?php |
443 | 408 |
$natent['source']['network'] = ($natent['source']['network'] == "(self)") ? "This Firewall" : $natent['source']['network']; |
444 | 409 |
?> |
... | ... | |
459 | 424 |
?> |
460 | 425 |
</td> |
461 | 426 |
|
462 |
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
|
|
427 |
<td> |
|
463 | 428 |
<?php |
464 | 429 |
echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ; |
465 | 430 |
if (!$natent['sourceport']) |
... | ... | |
483 | 448 |
?> |
484 | 449 |
</td> |
485 | 450 |
|
486 |
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
|
|
451 |
<td> |
|
487 | 452 |
<?php |
488 | 453 |
if (isset($natent['destination']['any'])) |
489 | 454 |
echo "*"; |
... | ... | |
509 | 474 |
?> |
510 | 475 |
</td> |
511 | 476 |
|
512 |
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
|
|
477 |
<td> |
|
513 | 478 |
<?php |
514 | 479 |
echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ; |
515 | 480 |
|
... | ... | |
534 | 499 |
|
535 | 500 |
</td> |
536 | 501 |
|
537 |
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
|
|
502 |
<td> |
|
538 | 503 |
<?php |
539 | 504 |
if (isset($natent['nonat'])) |
540 | 505 |
echo '<I>NO NAT</I>'; |
... | ... | |
547 | 512 |
?> |
548 | 513 |
</td> |
549 | 514 |
|
550 |
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
|
|
515 |
<td> |
|
551 | 516 |
<?php |
552 | 517 |
if (!$natent['natport']) |
553 | 518 |
echo "*"; |
... | ... | |
556 | 521 |
?> |
557 | 522 |
</td> |
558 | 523 |
|
559 |
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
|
|
524 |
<td> |
|
560 | 525 |
<?php |
561 | 526 |
if(isset($natent['staticnatport'])) |
562 | 527 |
echo gettext("YES"); |
... | ... | |
565 | 530 |
?> |
566 | 531 |
</td> |
567 | 532 |
|
568 |
<td onclick="fr_toggle(<?=$i?>)">
|
|
533 |
<td> |
|
569 | 534 |
<?=htmlspecialchars($natent['descr'])?> |
570 | 535 |
</td> |
571 | 536 |
|
572 | 537 |
<!-- Action icons --> |
573 |
<td onclick="fr_toggle(<?=$nnats?>)" id="frd<?=$nnats?>">
|
|
538 |
<td> |
|
574 | 539 |
<a class="btn btn-xs btn-info" title="<?=gettext("Edit mapping")?>" href="firewall_nat_out_edit.php?id=<?=$i?>"><?=gettext("Edit")?></a> |
575 | 540 |
<a class="btn btn-xs btn-danger" title="<?=gettext("Delete mapping")?>" href="firewall_nat_out.php?act=del&id=<?=$i?>"><?=gettext("Del")?></a> |
576 | 541 |
<a class="btn btn-xs btn-success" title="<?=gettext("Add a new mapping based on this one")?>" href="firewall_nat_out_edit.php?dup=<?=$i?>"><?=gettext("Clone")?></a> |
... | ... | |
624 | 589 |
?> |
625 | 590 |
<tr> |
626 | 591 |
<td> |
627 |
<img src="/bootstrap/glyphicons/glyphicons-halflings.png" class="icon-ok" title="<?=gettext("automatic outbound nat")?>" alt="icon" />
|
|
592 |
<i class="icon-ok" title="<?=gettext("automatic outbound nat")?>"></i>
|
|
628 | 593 |
</td> |
629 | 594 |
<td> |
630 | 595 |
<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])); ?> |
Also available in: Unified diff
updated icons etc
Changed icon display
Removed row shading
Removed unneeded checkboxes