Project

General

Profile

« Previous | Next » 

Revision 00d3bab7

Added by Scott Ullrich over 20 years ago

Move the alias selection screen to the dropdown menu that includes all network or alias, etc.

View differences:

usr/local/www/firewall_rules_edit.php
337 337
<script language="JavaScript">
338 338
<!--
339 339
var portsenabled = 1;
340

  
340
var goingtofire = 1;
341 341
function ext_change() {
342 342
	if ((document.iform.srcbeginport.selectedIndex == 0) && portsenabled) {
343 343
		document.iform.srcbeginport_cust.disabled = 0;
......
377 377
	}
378 378
}
379 379

  
380
function typesel_change() {
380
function typesel_change(dstype) {
381
	if(goingtofire != 0) return;
382
	goingtofire = 1;
381 383
	switch (document.iform.srctype.selectedIndex) {
382 384
		case 1:	/* single */
383 385
			document.iform.src.disabled = 0;
......
412 414
			document.iform.dstmask.disabled = 1;
413 415
			break;
414 416
	}
417
	if(dstype == "src") {
418
		var selected = document.iform.srctype.selectedIndex;
419
		var selectedtext = document.iform.srctype.options[selected].value;
420
		document.iform.src.value = selectedtext;
421
		document.iform.srctype.options[1].selected = true;
422
	} else {
423
		var selected = document.iform.dsttype.selectedIndex;
424
		var selectedtext = document.iform.dsttype.options[selected].value;
425
		document.iform.dst.value = selectedtext;
426
		document.iform.dsttype.options[1].selected = true;
427
	}
428
	goingtofire = 0;
415 429
}
416 430

  
417 431
function proto_change() {
......
436 450
function dst_rep_change() {
437 451
	document.iform.dstendport.selectedIndex = document.iform.dstbeginport.selectedIndex;
438 452
}
439
function assignaliastofield(dst, dstsrc, dstype) {
440
	dst.value = dstsrc.value;
441
	dstsrc.value = "";
442
	if(dstype == 'src') {
443
		this.iform.srctype.selectedIndex = 1;
444
		this.iform.src.disabled = 0;
445
	} else {
446
		this.iform.dsttype.selectedIndex = 1;
447
		this.iform.dst.disabled = 0;
448
	}
449

  
450
}
451 453
//-->
452 454
</script>
453 455
</head>
......
553 555
                    <table border="0" cellspacing="0" cellpadding="0">
554 556
                      <tr>
555 557
                        <td>Type:&nbsp;&nbsp;</td>
556
                        <td><select name="srctype" class="formfld" onChange="typesel_change()">
558
                        <td><select id="srctype" name="srctype" class="formfld" onChange="typesel_change('src');">
557 559
							<?php $sel = is_specialnet($pconfig['src']); ?>
558 560
                            <option value="any" <?php if ($pconfig['src'] == "any") { echo "selected"; } ?>>
559 561
                            any</option>
......
569 571
                            <option value="opt<?=$i;?>" <?php if ($pconfig['src'] == "opt" . $i) { echo "selected"; } ?>>
570 572
                            <?=htmlspecialchars($config['interfaces']['opt' . $i]['descr']);?> subnet</option>
571 573
							<?php endfor; ?>
574
				<?php
575
				foreach ($config['aliases']['alias'] as $alias) {
576
					echo "<option value=\"" . $alias['name'] . "\">alias:" . $alias['name'] . "</option>\n";
577
				}
578
				?>
572 579
                          </select></td>
573 580
                      </tr>
574 581
                      <tr>
575 582
                        <td>Address:&nbsp;&nbsp;</td>
576 583
                        <td><input name="src" type="text" class="formfldalias" id="src" size="20" value="<?php if (!is_specialnet($pconfig['src'])) echo htmlspecialchars($pconfig['src']);?>">
577 584
                        /
578
						<select name="srcmask" class="formfld" id="srcmask">
579
						<?php for ($i = 31; $i > 0; $i--): ?>
580
						<option value="<?=$i;?>" <?php if ($i == $pconfig['srcmask']) echo "selected"; ?>><?=$i;?></option>
581
						<?php endfor; ?>
582
						</select>
583

  
584
						 <select name="assignaliasa" id="assignaliasa" onChange="assignaliastofield(src, this, 'src');"><option></option>
585
						<?php
586
						foreach ($config['aliases']['alias'] as $alias) {
587
							echo "<option value=\"" . $alias['name'] . "\">" . $alias['name'] . "</option>\n";
588
						}
589
						?>
590
						</select>
591
						</td>
592
					  </tr>
585
				<select name="srcmask" class="formfld" id="srcmask">
586
				<?php for ($i = 31; $i > 0; $i--): ?>
587
				<option value="<?=$i;?>" <?php if ($i == $pconfig['srcmask']) echo "selected"; ?>><?=$i;?></option>
588
				<?php endfor; ?>
589
				</select>
590
				</td>
591
			  </tr>
593 592
                    </table></td>
594 593
                </tr>
595 594
                <tr>
......
642 641
                    <table border="0" cellspacing="0" cellpadding="0">
643 642
                      <tr>
644 643
                        <td>Type:&nbsp;&nbsp;</td>
645
                        <td><select name="dsttype" class="formfld" onChange="typesel_change()">
644
                        <td><select id="dsttype" name="dsttype" class="formfld" onChange="typesel_change('dst');">
646 645
                            <?php $sel = is_specialnet($pconfig['dst']); ?>
647 646
                            <option value="any" <?php if ($pconfig['dst'] == "any") { echo "selected"; } ?>>
648 647
                            any</option>
......
658 657
                            <option value="opt<?=$i;?>" <?php if ($pconfig['dst'] == "opt" . $i) { echo "selected"; } ?>>
659 658
                            <?=htmlspecialchars($config['interfaces']['opt' . $i]['descr']);?> subnet</option>
660 659
							<?php endfor; ?>
660
				<?php
661
				foreach ($config['aliases']['alias'] as $alias) {
662
					echo "<option value=\"" . $alias['name'] . "\">alias:" . $alias['name'] . "</option>\n";
663
				}
664
				?>
661 665
                          </select></td>
662 666
                      </tr>
663 667
                      <tr>
664 668
                        <td>Address:&nbsp;&nbsp;</td>
665 669
                        <td><input name="dst" type="text" class="formfldalias" id="dst" size="20" value="<?php if (!is_specialnet($pconfig['dst'])) echo htmlspecialchars($pconfig['dst']);?>">
666 670
                          /
667
                          <select name="dstmask" class="formfld" id="dstmask">
668
						<?php for ($i = 31; $i > 0; $i--): ?>
669
						<option value="<?=$i;?>" <?php if ($i == $pconfig['dstmask']) echo "selected"; ?>><?=$i;?></option>
670
						<?php endfor; ?>
671
						</select>  <select name="assignaliasb" id="assignaliasb" onChange="assignaliastofield(dst, this, 'dst');"><option></option>
672
						<?php
673
						foreach ($config['aliases']['alias'] as $alias) {
674
							echo "<option value=\"" . $alias['name'] . "\">" . $alias['name'] . "</option>\n";
675
						}
676
						?>
677
						</select></td>
671
                          <select name="dstmask" class="formfld" id="dstmask";>
672
				<?php for ($i = 31; $i > 0; $i--): ?>
673
				<option value="<?=$i;?>" <?php if ($i == $pconfig['dstmask']) echo "selected"; ?>><?=$i;?></option>
674
				<?php endfor; ?>
675
				</select>
676
			</td>
678 677
                      </tr>
679 678
                    </table></td>
680 679
                </tr>
......
783 782
ext_change();
784 783
typesel_change();
785 784
proto_change();
785
goingtofire = 0;
786 786
//-->
787 787
</script>
788 788
<?php include("fend.inc"); ?>

Also available in: Unified diff