From de77ffdb1e62343a9483c7ab2cdf594ad6dc482d Mon Sep 17 00:00:00 2001 From: gnhb Date: Sun, 2 May 2010 16:39:08 +0700 Subject: Code to save data on a per port(bandwidth, mtu, mru, etc.) basis is working. --- usr/local/www/interfaces_mlppp_edit.php | 39 ++++++++++++---------- .../interfaces_mlppp_edit/interfaces_mlppp_edit.js | 39 ++++++++-------------- 2 files changed, 36 insertions(+), 42 deletions(-) (limited to 'usr') 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" Link interface(s) - Click here 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; ?> $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; ?> @@ -810,40 +818,37 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
Protocol field compression. This option saves one byte per frame for most frames. - - - - - - - Link Parameters + + + Link Parameters - + - + - +
Bandwidth Bandwidth -
+

Set Bandwidth for each link ONLY when links have different bandwidths.
MTU MTU - +
Set MTU for each link if links have different bandwidths, otherwise, mtu will default to 1492.
MRU MRU - +
Set MRU for each link if links have different bandwidths, otherwise, mru will default to 1492.
+   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(); -- cgit v1.1