summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgnhb <gnoahb@gmail.com>2010-05-02 16:39:08 +0700
committergnhb <gnoahb@gmail.com>2010-05-02 16:39:08 +0700
commitde77ffdb1e62343a9483c7ab2cdf594ad6dc482d (patch)
tree8badb1e4a86813c6ecca1775f85707279e173bb1
parent6fcc9db6a274d78c63b53601ecf9d38eab637101 (diff)
downloadpfsense-de77ffdb1e62343a9483c7ab2cdf594ad6dc482d.zip
pfsense-de77ffdb1e62343a9483c7ab2cdf594ad6dc482d.tar.gz
Code to save data on a per port(bandwidth, mtu, mru, etc.) basis is working.
-rw-r--r--usr/local/www/interfaces_mlppp_edit.php39
-rw-r--r--usr/local/www/javascript/interfaces_mlppp_edit/interfaces_mlppp_edit.js39
2 files changed, 36 insertions, 42 deletions
diff --git a/usr/local/www/interfaces_mlppp_edit.php b/usr/local/www/interfaces_mlppp_edit.php
index 732a31a..0653569 100644
--- a/usr/local/www/interfaces_mlppp_edit.php
+++ b/usr/local/www/interfaces_mlppp_edit.php
@@ -100,9 +100,9 @@ if (isset($id) && $a_ppps[$id]) {
$pconfig['idletimeout'] = $a_ppps[$id]['idletimeout'];
$pconfig['uptime'] = $a_ppps[$id]['uptime'];
$pconfig['descr'] = $a_ppps[$id]['descr'];
- $pconfig['bandwidth'] = $a_ppps[$id]['bandwidth'];
- $pconfig['mtu'] = $a_ppps[$id]['mtu'];
- $pconfig['mru'] = $a_ppps[$id]['mru'];
+ $pconfig['bandwidth'] = explode(",",$a_ppps[$id]['bandwidth']);
+ $pconfig['mtu'] = explode(",",$a_ppps[$id]['mtu']);
+ $pconfig['mru'] = explode(",",$a_ppps[$id]['mru']);
$pconfig['mrru'] = $a_ppps[$id]['mrru'];
if (isset($a_ppps[$id]['shortseq']))
$pconfig['shortseq'] = true;
@@ -505,7 +505,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
<tr name="interface" id="interface" >
<td width="22%" valign="top" class="vncellreq">Link interface(s)</td>
<td width="78%" class="vtable">
- <select valign="top" name="interfaces[]" multiple="true" class="formselect" size="4" onChange="create_change_fields(this.value, 'link_fields');">
+ <select valign="top" name="interfaces[]" multiple="true" class="formselect" size="4" onChange="show_hide_linkfields();">
<option></option>
</select>
<a href='#' onClick='javascript:clear_selected("interfaces[]");'>Click here</a> to clear selection(s).
@@ -524,18 +524,23 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
$serial = glob("/dev/cua*");
$modems = glob("/dev/modem*");
$serialports = array_merge($serial, $modems);
+ $serport_count = 0;
foreach ($serialports as $port) {
if(preg_match("/\.(lock|init)$/", $port))
continue;
+ $serport_count++;
echo $port.",".trim($port);
if (in_array($port,$selected_ports))
echo ",1|";
else
echo ",|";
}
+ echo $serport_count;
?></td>
<td id="ports"><?php
+ $port_count = 0;
foreach ($portlist as $ifn => $ifinfo){
+ $port_count++;
//if (is_jumbo_capable($ifn)) {
echo htmlspecialchars($ifn . " (" . $ifinfo['mac'] . ")") . ",{$ifn}";
//echo "\"{$ifn}\"";
@@ -544,6 +549,9 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
else
echo ",|";
}
+ echo $port_count;
+ if ($serport_count > $port_count)
+ $port_count=$serport_count;
?></td>
</tr>
<tr>
@@ -810,40 +818,37 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
<br/> <span class="vexpl">Protocol field compression. This option saves one byte per frame for most frames.</span>
</td>
</tr>
- <tr style="display:none" >
- <td id="bandwidths"><?=htmlspecialchars($pconfig['bandwidth']);?></td>
- <td id="mtu"><?=htmlspecialchars($pconfig['mtu']);?></td>
- <td id="mru"><?=htmlspecialchars($pconfig['mru']);?></td>
- </tr>
- <tr style="display:none" id="link_fields">
- <td width="22%" valign="top" class="vncell"> Link Parameters</td>
+ <?php for($i=0; $i < $port_count; $i++) : ?>
+ <tr style="display:none" id="link<?=$i;?>">
+ <td width="22%" valign="top" id="linklabel<?=$i;?>" class="vncell"> Link Parameters</td>
<td class="vtable">
<table name="link_parameters" border="0" cellpadding="6" cellspacing="0">
<tr>
- <td width="22%" valign="top" name="bandwidth_label" class="vncell"> Bandwidth</td>
+ <td width="22%" valign="top" id="bandwidth<?=$i;?>" class="vncell"> Bandwidth</td>
<td width="78%" class="vtable">
- <br/><input name="bandwidth[]" type="text" class="formfld unknown" size="40" >
+ <br/><input name="bandwidth[]" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['bandwidth'][$i]);?>">
<br/> <span class="vexpl">Set Bandwidth for each link ONLY when links have different bandwidths.</span>
</td>
</tr>
<tr>
- <td width="22%" valign="top" name="mtu_label" class="vncell"> MTU</td>
+ <td width="22%" valign="top" id="mtu<?=$i;?>" class="vncell"> MTU</td>
<td width="78%" class="vtable">
- <input name="mtu[]" type="text" class="formfld unknown" size="6">
+ <input name="mtu[]" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mtu'][$i]);?>">
<br> <span class="vexpl">Set MTU for each link if links have different bandwidths, otherwise, mtu will default to 1492.</span>
</td>
</tr>
<tr>
- <td width="22%" valign="top" name="mru_label" class="vncell"> MRU</td>
+ <td width="22%" valign="top" id="mru<?=$i;?>" class="vncell"> MRU</td>
<td width="78%" class="vtable">
- <input name="mru[]" type="text" class="formfld unknown" size="6">
+ <input name="mru[]" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mru'][$i]);?>">
<br> <span class="vexpl">Set MRU for each link if links have different bandwidths, otherwise, mru will default to 1492.</span>
</td>
</tr>
</table
</td>
</tr>
+ <?php endfor; ?>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
diff --git a/usr/local/www/javascript/interfaces_mlppp_edit/interfaces_mlppp_edit.js b/usr/local/www/javascript/interfaces_mlppp_edit/interfaces_mlppp_edit.js
index 1c60191..a63bde0 100644
--- a/usr/local/www/javascript/interfaces_mlppp_edit/interfaces_mlppp_edit.js
+++ b/usr/local/www/javascript/interfaces_mlppp_edit/interfaces_mlppp_edit.js
@@ -6,10 +6,14 @@ function update_select_list(new_options, select_list){
var option = option_array[j].split(",");
var selected = Boolean(parseInt(option[2]));
select_list.options[j] = new Option(option[0], option[1], false, selected);
- //this line for testing and debugging
+ var linklabel = "linklabel" + j.toString();
+ var label_text = $(linklabel).innerHTML;
+ $(linklabel).innerHTML = label_text + " (" + option[1] + ")";
+ //for testing and debugging
//select_list.options[option_array.length-1+j] = new Option(option[2].toString() +" "+ selected.toString());
+ //select_list.options[option_array.length-1+j] = new Option("Link Label: " + linklabel + " Label Text:" + label_text);
}
- create_change_fields("","link_fields");
+ show_hide_linkfields();
}
function clear_selected(list_name){
@@ -17,33 +21,18 @@ function clear_selected(list_name){
for(var j=0; j < select_list.options.length; j++){
select_list.options[j].selected = 0;
}
-
- create_change_fields();
-
}
-function create_change_fields(port, fields_template){
-
- // First check if "port" has an associated row already created. If so, hide it.
+function show_hide_linkfields(){
var select_list = document.iform["interfaces[]"].options;
- var row_id = port + "_params";
- var row = $(fields_template).innerHTML;
- var rows_count = $('interfacetable').rows.length;
- if (port == null)
- for(var j=0; j < select_list.length-1; j++){
- var row_id = select_list[j].value + "_params";
- $('interfacetable').insertRow(rows_count -1);
- $('interfacetable').rows[rows_count -1].id = row_id;
- $(row_id).innerHTML = row;
+ for(var j=0; j < select_list.length; j++){
+ var linklabel = "link" + j.toString();
if (select_list[j].selected){
- $(other_row).show();
- } else {
- $(row_id).hide();
+ $(linklabel).show();
+ continue;
}
- name = $('interfacetable').rows[rows_count -1].cells[0].innerHTML;
- $('interfacetable').rows[rows_count -1].cells[0].innerHTML = name + " (" + port + ")" + " " + row_id;
+ $(linklabel).hide();
}
- }
}
@@ -83,8 +72,8 @@ function updateType(t){
$(t).show();
}
-function show_more_settings(obj,element_id) {
- if (obj.checked)
+function show_more_settings(checkbox_obj,element_id) {
+ if (checkbox_obj.checked)
$(element_id).show();
else
$(element_id).hide();
OpenPOWER on IntegriCloud