Revision 0cea9a23
Added by Ermal Luçi almost 16 years ago
usr/local/www/firewall_aliases_edit.php | ||
---|---|---|
244 | 244 |
$jscriptstr = <<<EOD |
245 | 245 |
|
246 | 246 |
<script type="text/javascript"> |
247 |
|
|
248 |
var objAlias = new Array(4999); |
|
247 | 249 |
function typesel_change() { |
248 | 250 |
switch (document.iform.type.selectedIndex) { |
249 | 251 |
case 0: /* host */ |
... | ... | |
300 | 302 |
} |
301 | 303 |
} |
302 | 304 |
|
305 |
function add_alias_control() { |
|
306 |
var name = "address" + (totalrows - 1); |
|
307 |
obj = document.getElementById(name); |
|
308 |
obj.setAttribute('class', 'formfldalias'); |
|
309 |
obj.setAttribute('autocomplete', 'off'); |
|
310 |
objAlias[totalrows - 1] = new AutoSuggestControl(obj, new StateSuggestions(addressarray)); |
|
311 |
} |
|
303 | 312 |
EOD; |
304 | 313 |
|
305 | 314 |
$network_str = gettext("Network"); |
... | ... | |
374 | 383 |
|
375 | 384 |
<script type="text/javascript" src="/javascript/row_helper.js"> |
376 | 385 |
</script> |
386 |
<script type="text/javascript" src="/javascript/autosuggest.js"> |
|
387 |
</script> |
|
388 |
<script type="text/javascript" src="/javascript/suggestions.js"> |
|
389 |
</script> |
|
377 | 390 |
|
378 | 391 |
<input type='hidden' name='address_type' value='textbox' /> |
379 | 392 |
<input type='hidden' name='address_subnet_type' value='select' /> |
... | ... | |
480 | 493 |
?> |
481 | 494 |
<tr> |
482 | 495 |
<td> |
483 |
<input name="address<?php echo $tracker; ?>" type="text" class="formfld unknown" id="address<?php echo $tracker; ?>" size="30" value="<?=htmlspecialchars($address);?>" />
|
|
496 |
<input autocomplete="off" name="address<?php echo $tracker; ?>" type="text" class="formfldalias" id="address<?php echo $tracker; ?>" size="30" value="<?=htmlspecialchars($address);?>" />
|
|
484 | 497 |
</td> |
485 | 498 |
<td> |
486 | 499 |
<select name="address_subnet<?php echo $tracker; ?>" class="formselect" id="address_subnet<?php echo $tracker; ?>"> |
... | ... | |
508 | 521 |
|
509 | 522 |
</tfoot> |
510 | 523 |
</table> |
511 |
<a onclick="javascript:addRowTo('maintable'); typesel_change(); return false;" href="#">
|
|
524 |
<a onclick="javascript:addRowTo('maintable', 'formfldalias'); typesel_change(); add_alias_control(this); return false;" href="#">
|
|
512 | 525 |
<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="add another entry" /> |
513 | 526 |
</a> |
514 | 527 |
</td> |
... | ... | |
533 | 546 |
loaded = <?php echo $counter; ?>; |
534 | 547 |
typesel_change(); |
535 | 548 |
update_box_type(); |
549 |
|
|
550 |
<?php |
|
551 |
$isfirst = 0; |
|
552 |
$aliases = ""; |
|
553 |
$addrisfirst = 0; |
|
554 |
$aliasesaddr = ""; |
|
555 |
if(isset($config['aliases']['alias']) && is_array($config['aliases']['alias'])) |
|
556 |
foreach($config['aliases']['alias'] as $alias_name) { |
|
557 |
if($addrisfirst == 1) $aliasesaddr .= ","; |
|
558 |
$aliasesaddr .= "'" . $alias_name['name'] . "'"; |
|
559 |
$addrisfirst = 1; |
|
560 |
} |
|
561 |
?> |
|
562 |
|
|
563 |
var addressarray=new Array(<?php echo $aliasesaddr; ?>); |
|
564 |
var customarray=new Array(<?php echo $aliases; ?>); |
|
565 |
|
|
566 |
<?php |
|
567 |
for ($jv = 0; $jv < $counter; $jv++) |
|
568 |
echo "objAlias[{$jv}] = new AutoSuggestControl(document.getElementById(\"address{$jv}\"), new StateSuggestions(addressarray));\n"; |
|
569 |
?> |
|
570 |
|
|
571 |
|
|
536 | 572 |
</script> |
537 | 573 |
|
538 | 574 |
<?php include("fend.inc"); ?> |
Also available in: Unified diff
Add the id tag to the row helper javascript created input objects. Make the controls of aliases clearly show that they can be even alias names with autocomplete.(Loop checking is not yet implemented).