From 392cd413c1c6269d027e2da15f466928e6715271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=E7i?= Date: Wed, 25 Nov 2009 16:59:24 +0000 Subject: Resolves #169. Show interface friendly names during the wizards. Some more cosemtics is needed in this wizard but this is a first step. --- usr/local/www/wizards/traffic_shaper_wizard.inc | 4 +- .../wizards/traffic_shaper_wizard_dedicated.inc | 180 ++++++++++---------- .../wizards/traffic_shaper_wizard_multi_all.inc | 185 ++++++++++----------- .../wizards/traffic_shaper_wizard_multi_lan.inc | 32 ++-- 4 files changed, 203 insertions(+), 198 deletions(-) (limited to 'usr/local/www/wizards') diff --git a/usr/local/www/wizards/traffic_shaper_wizard.inc b/usr/local/www/wizards/traffic_shaper_wizard.inc index 9bf9851..4ab8164 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard.inc @@ -107,7 +107,7 @@ function step2_stepbeforeformdisplay() { $field = array(); $interface_friendly = $i+1; - $field['name'] = "Setup connection speed and scheduler information for WAN #{$interface_friendly}"; + $field['name'] = "Setup connection speed and scheduler information for WAN ({$interface_friendly})"; $field['type'] = "listtopic"; $fields[] = $field; @@ -115,7 +115,7 @@ function step2_stepbeforeformdisplay() { $field['displayname'] = "Interface"; $field['name'] = "conn{$i}interface"; $field['type'] = "select"; - $field['typehint'] = "Interface of connection #{$interface_friendly}."; + $field['typehint'] = "Interface of connection ({$interface_friendly})."; $field['options']['option'] = array(); foreach ($iflist as $ifname => $ifdescr) { $opts = array(); diff --git a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc index d2a19ed..1482f52 100755 --- a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc @@ -50,14 +50,15 @@ function step2_stepbeforeformdisplay() { $numberofinterfaces = 0; $iflist = array(); - foreach ($config['interfaces'] as $if => $ifdesc) { - if (!is_altq_capable($ifdesc['if'])) - continue; - if (!isset($ifdesc['enable']) && $if != "lan" && $if != "wan") - continue; - $numberofinterfaces++; - $iflist[] = $if; - } + $iflisttmp = get_configured_interface_with_descr(); + foreach ($iflisttmp as $if => $ifdesc) { + if (!is_altq_capable(get_real_interface($if))) + continue; + if ($if == "lan") + continue; + $numberofinterfaces++; + $iflist[$if] = $ifdesc; + } $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']); if ($numberofconnections > ($numberofinterfaces/2)) { $message=gettext("You have less interfaces than number of connections!"); @@ -75,24 +76,25 @@ function step2_stepbeforeformdisplay() { write_config(); */ $fields = array(); - - $field = array(); - $field['name'] = "Setup schedulers"; - $field['type'] = "listtopic"; - $fields[] = $field; + $field = array(); + $field['name'] = "Setup schedulers"; + $field['type'] = "listtopic"; + $fields[] = $field; for ($i = 0; $i < $numberofconnections; $i++) { $field = array(); + $field['displayname'] = "Local interface"; $field['name'] = "local{$i}interface"; $field['type'] = "select"; // $field['typehint'] = "Interface of this connection."; $field['options']['option'] = array(); - foreach ($iflist as $ifname) { - $opts = array(); - $opts['name'] = $ifname; - $opts['value'] = $ifname; - $field['options']['option'][] = $opts; - } + foreach ($iflist as $ifname => $ifdescr) { + $opts = array(); + $opts['displayname'] = $ifdescr; + $opts['name'] = $ifname; + $opts['value'] = $ifname; + $field['options']['option'][] = $opts; + } $field['combinefieldsbegin'] = "true"; $field['bindstofield'] = "ezshaper->step2->local{$i}interface"; $fields[] = $field; @@ -102,40 +104,44 @@ function step2_stepbeforeformdisplay() { $field['dontdisplayname'] = "true"; $field['dontcombinecells'] = "true"; - $field['name'] = "local{$i}downloadscheduler"; - $field['type'] = "select"; - $field['typehint'] = "Queueing discipline to apply on the download of this connection."; - $field['options']['option'] = array(); - $opts = array(); - $opts['name'] = "HFSC"; - $opts['value'] = "HFSC"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['name'] = "CBQ"; - $opts['value'] = "CBQ"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['name'] = "PRIQ"; - $opts['value'] = "PRIQ"; - $field['options']['option'][] = $opts; - $field['bindstofield'] = "ezshaper->step2->local{$i}downloadscheduler"; - $fields[] = $field; - + $field['displayname'] = "Download scheduler"; + $field['name'] = "local{$i}downloadscheduler"; + $field['type'] = "select"; + $field['typehint'] = "Queueing discipline to apply on the download of this connection."; + $field['options']['option'] = array(); + $opts = array(); + $opts['name'] = "HFSC"; + $opts['value'] = "HFSC"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['name'] = "CBQ"; + $opts['value'] = "CBQ"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['name'] = "PRIQ"; + $opts['value'] = "PRIQ"; + $field['options']['option'][] = $opts; + $field['bindstofield'] = "ezshaper->step2->local{$i}downloadscheduler"; + $fields[] = $field; + $field = array(); + $field['displayname'] = "WAN Interface"; $field['name'] = "conn{$i}interface"; $field['type'] = "select"; //$field['typehint'] = "Interface of this connection."; $field['options']['option'] = array(); - foreach ($iflist as $ifname) { - $opts = array(); - $opts['name'] = $ifname; - $opts['value'] = $ifname; - $field['options']['option'][] = $opts; - } + foreach ($iflist as $ifname => $ifdescr) { + $opts = array(); + $opts['displayname'] = $ifdescr; + $opts['name'] = $ifname; + $opts['value'] = $ifname; + $field['options']['option'][] = $opts; + } $field['bindstofield'] = "ezshaper->step2->conn{$i}interface"; $field['combinefieldsbegin'] = "true"; - $fields[] = $field; + $fields[] = $field; + $field['displayname'] = "Upload scheduler"; $field['name'] = "conn{$i}uploadscheduler"; $field['combinefieldsend'] = "true"; $field['dontdisplayname'] = "true"; @@ -156,14 +162,14 @@ function step2_stepbeforeformdisplay() { $opts['value'] = "PRIQ"; $field['options']['option'][] = $opts; $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadscheduler"; - $fields[] = $field; + $fields[] = $field; $field = array(); $field['name'] = "conn{$i}upload"; $field['type'] = "input"; $field['bindstofield'] = "ezshaper->step2->conn{$i}upload"; $field['combinefieldsbegin'] = "true"; - $fields[] = $field; + $fields[] = $field; $field = array(); $field['combinefieldsend'] = "true"; @@ -171,56 +177,56 @@ function step2_stepbeforeformdisplay() { $field['dontcombinecells'] = "true"; $field['name'] = "conn{$i}uploadspeed"; $field['typehint'] = "Upload bandwidth on this connection."; - $field['type'] = "select"; - $field['options']['option'] = array(); - $opts = array(); - $opts['value'] = "Kb"; - $opts['name'] = "Kbit/s"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['value'] = "Mb"; - $opts['name'] = "Mbit/s"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['value'] = "Gb"; - $opts['name'] = "Gbit/s"; - $field['options']['option'][] = $opts; - $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadspeed"; - $fields[] = $field; + $field['type'] = "select"; + $field['options']['option'] = array(); + $opts = array(); + $opts['value'] = "Kb"; + $opts['name'] = "Kbit/s"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['value'] = "Mb"; + $opts['name'] = "Mbit/s"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['value'] = "Gb"; + $opts['name'] = "Gbit/s"; + $field['options']['option'][] = $opts; + $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadspeed"; + $fields[] = $field; $field = array(); $field['name'] = "conn{$i}download"; $field['type'] = "input"; $field['bindstofield'] = "ezshaper->step2->conn{$i}download"; $field['combinefieldsbegin'] = "true"; - $fields[] = $field; + $fields[] = $field; $field = array(); - $field['combinefieldsend'] = "true"; - $field['dontdisplayname'] = "true"; - $field['dontcombinecells'] = "true"; - $field['name'] = "conn{$i}downloadspeed"; + $field['combinefieldsend'] = "true"; + $field['dontdisplayname'] = "true"; + $field['dontcombinecells'] = "true"; + $field['name'] = "conn{$i}downloadspeed"; $field['typehint'] = "Download bandwidth on this connection."; - $field['type'] = "select"; - $field['options']['option'] = array(); - $opts = array(); - $opts['value'] = "Kb"; - $opts['name'] = "Kbit/s"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['value'] = "Mb"; - $opts['name'] = "Mbit/s"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['value'] = "Gb"; - $opts['name'] = "Gbit/s"; - $field['options']['option'][] = $opts; - $field['bindstofield'] = "ezshaper->step2->conn{$i}downloadspeed"; - $fields[] = $field; + $field['type'] = "select"; + $field['options']['option'] = array(); + $opts = array(); + $opts['value'] = "Kb"; + $opts['name'] = "Kbit/s"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['value'] = "Mb"; + $opts['name'] = "Mbit/s"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['value'] = "Gb"; + $opts['name'] = "Gbit/s"; + $field['options']['option'][] = $opts; + $field['bindstofield'] = "ezshaper->step2->conn{$i}downloadspeed"; + $fields[] = $field; } - $field = array(); - $field['name'] = "Next"; - $field['type'] = "submit"; + $field = array(); + $field['name'] = "Next"; + $field['type'] = "submit"; $fields[] = $field; } diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc index d4185be..76cd710 100755 --- a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc @@ -50,16 +50,15 @@ function step2_stepbeforeformdisplay() { $numberofinterfaces = 0; $iflist = array(); - foreach ($config['interfaces'] as $if => $ifdesc) { - if (!is_altq_capable($ifdesc['if'])) - continue; - if (!isset($ifdesc['enable']) && $if != "lan" && $if != "wan") - continue; - if ($if == "lan") - continue; - $numberofinterfaces++; - $iflist[] = $if; - } + $iflisttmp = get_configured_interface_with_descr(); + foreach ($iflisttmp as $if => $ifdesc) { + if (!is_altq_capable(get_real_interface($if))) + continue; + if ($if == "lan") + continue; + $numberofinterfaces++; + $iflist[$if] = $ifdesc; + } $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']); if ($numberofconnections > $numberofinterfaces) { $message=gettext("You have less interfaces than number of connections!"); @@ -86,10 +85,10 @@ function step2_stepbeforeformdisplay() { */ $fields = array(); - $field = array(); - $field['name'] = "Setup LAN schedulers"; - $field['type'] = "listtopic"; - $fields[] = $field; + $field = array(); + $field['name'] = "Setup LAN schedulers"; + $field['type'] = "listtopic"; + $fields[] = $field; for ($i = 0; $i < $numberoflocalinterfaces; $i++) { $field = array(); @@ -97,12 +96,13 @@ function step2_stepbeforeformdisplay() { $field['type'] = "select"; // $field['typehint'] = "Interface of this connection."; $field['options']['option'] = array(); - foreach ($iflist as $ifname) { - $opts = array(); - $opts['name'] = $ifname; - $opts['value'] = $ifname; - $field['options']['option'][] = $opts; - } + foreach ($iflist as $ifname => $ifdescr) { + $opts = array(); + $opts['displayname'] = $ifdescr; + $opts['name'] = $ifname; + $opts['value'] = $ifname; + $field['options']['option'][] = $opts; + } /* LAN is needed here */ $opts = array(); $opts['name'] = "lan"; @@ -118,31 +118,30 @@ function step2_stepbeforeformdisplay() { $field['dontdisplayname'] = "true"; $field['dontcombinecells'] = "true"; - $field['name'] = "local{$i}downloadscheduler"; - $field['type'] = "select"; - $field['typehint'] = "Queueing discipline to apply on this local interface."; - $field['options']['option'] = array(); - $opts = array(); - $opts['name'] = "HFSC"; - $opts['value'] = "HFSC"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['name'] = "CBQ"; - $opts['value'] = "CBQ"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['name'] = "PRIQ"; - $opts['value'] = "PRIQ"; - $field['options']['option'][] = $opts; - $field['bindstofield'] = "ezshaper->step2->local{$i}downloadscheduler"; - $fields[] = $field; - + $field['name'] = "local{$i}downloadscheduler"; + $field['type'] = "select"; + $field['typehint'] = "Queueing discipline to apply on this local interface."; + $field['options']['option'] = array(); + $opts = array(); + $opts['name'] = "HFSC"; + $opts['value'] = "HFSC"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['name'] = "CBQ"; + $opts['value'] = "CBQ"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['name'] = "PRIQ"; + $opts['value'] = "PRIQ"; + $field['options']['option'][] = $opts; + $field['bindstofield'] = "ezshaper->step2->local{$i}downloadscheduler"; + $fields[] = $field; } - $field = array(); - $field['name'] = "Setup connections speeds"; - $field['type'] = "listtopic"; - $fields[] = $field; + $field = array(); + $field['name'] = "Setup connections speeds"; + $field['type'] = "listtopic"; + $fields[] = $field; for ($i = 0; $i < $numberofconnections; $i++) { @@ -158,14 +157,15 @@ function step2_stepbeforeformdisplay() { $interface_real = $i+1; $field['typehint'] = "Select interface #{$interface_real} that you would like to shape"; $field['options']['option'] = array(); - foreach ($iflist as $ifname) { - $opts = array(); - $opts['name'] = $ifname; - $opts['value'] = $ifname; - $field['options']['option'][] = $opts; - } + foreach ($iflist as $ifname => $ifdescr) { + $opts = array(); + $opts['displayname'] = $ifdescr; + $opts['name'] = $ifname; + $opts['value'] = $ifname; + $field['options']['option'][] = $opts; + } $field['bindstofield'] = "ezshaper->step2->conn{$i}interface"; - $fields[] = $field; + $fields[] = $field; $field['name'] = "conn{$i}uploadscheduler"; $field['type'] = "select"; @@ -184,14 +184,14 @@ function step2_stepbeforeformdisplay() { $opts['value'] = "PRIQ"; $field['options']['option'][] = $opts; $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadscheduler"; - $fields[] = $field; + $fields[] = $field; $field = array(); $field['name'] = "conn{$i}upload"; $field['type'] = "input"; $field['bindstofield'] = "ezshaper->step2->conn{$i}upload"; $field['combinefieldsbegin'] = "true"; - $fields[] = $field; + $fields[] = $field; $field = array(); $field['combinefieldsend'] = "true"; @@ -199,58 +199,57 @@ function step2_stepbeforeformdisplay() { $field['dontcombinecells'] = "true"; $field['name'] = "conn{$i}uploadspeed"; $field['typehint'] = "Upload bandwidth on this connection."; - $field['type'] = "select"; - $field['options']['option'] = array(); - $opts = array(); - $opts['value'] = "Kb"; - $opts['name'] = "Kbit/s"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['value'] = "Mb"; - $opts['name'] = "Mbit/s"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['value'] = "Gb"; - $opts['name'] = "Gbit/s"; - $field['options']['option'][] = $opts; - $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadspeed"; - $fields[] = $field; + $field['type'] = "select"; + $field['options']['option'] = array(); + $opts = array(); + $opts['value'] = "Kb"; + $opts['name'] = "Kbit/s"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['value'] = "Mb"; + $opts['name'] = "Mbit/s"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['value'] = "Gb"; + $opts['name'] = "Gbit/s"; + $field['options']['option'][] = $opts; + $field['bindstofield'] = "ezshaper->step2->conn{$i}uploadspeed"; + $fields[] = $field; $field = array(); $field['name'] = "conn{$i}download"; $field['type'] = "input"; $field['bindstofield'] = "ezshaper->step2->conn{$i}download"; $field['combinefieldsbegin'] = "true"; - $fields[] = $field; + $fields[] = $field; $field = array(); - $field['combinefieldsend'] = "true"; - $field['dontdisplayname'] = "true"; - $field['dontcombinecells'] = "true"; - $field['name'] = "conn{$i}downloadspeed"; + $field['combinefieldsend'] = "true"; + $field['dontdisplayname'] = "true"; + $field['dontcombinecells'] = "true"; + $field['name'] = "conn{$i}downloadspeed"; $field['typehint'] = "Download bandwidth on this connection."; - $field['type'] = "select"; - $field['options']['option'] = array(); - $opts = array(); - $opts['value'] = "Kb"; - $opts['name'] = "Kbit/s"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['value'] = "Mb"; - $opts['name'] = "Mbit/s"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['value'] = "Gb"; - $opts['name'] = "Gbit/s"; - $field['options']['option'][] = $opts; - $field['bindstofield'] = "ezshaper->step2->conn{$i}downloadspeed"; - $fields[] = $field; + $field['type'] = "select"; + $field['options']['option'] = array(); + $opts = array(); + $opts['value'] = "Kb"; + $opts['name'] = "Kbit/s"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['value'] = "Mb"; + $opts['name'] = "Mbit/s"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['value'] = "Gb"; + $opts['name'] = "Gbit/s"; + $field['options']['option'][] = $opts; + $field['bindstofield'] = "ezshaper->step2->conn{$i}downloadspeed"; + $fields[] = $field; } - $field = array(); - $field['name'] = "Next"; - $field['type'] = "submit"; + $field = array(); + $field['name'] = "Next"; + $field['type'] = "submit"; $fields[] = $field; - } function step2_stepsubmitphpaction() { diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc index 23ff8cf..4fe12e3 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc @@ -49,16 +49,15 @@ function step2_stepbeforeformdisplay() { $numberofinterfaces = 0; $iflist = array(); - foreach ($config['interfaces'] as $if => $ifdesc) { - if (!is_altq_capable($ifdesc['if'])) - continue; - if (!isset($ifdesc['enable']) && $if != "lan" && $if != "wan") - continue; - if ($if == "wan") - continue; - $numberofinterfaces++; - $iflist[] = $if; - } + $iflisttmp = get_configured_interface_with_descr(); + foreach ($iflisttmp as $if => $ifdesc) { + if (!is_altq_capable(get_real_interface($if))) + continue; + if ($if == "lan") + continue; + $numberofinterfaces++; + $iflist[$if] = $ifdesc; + } $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']); if ($numberofconnections > $numberofinterfaces) { $message=gettext("You do not have {$numberofconnections} of local interfaces!"); @@ -176,12 +175,13 @@ function step2_stepbeforeformdisplay() { $field['type'] = "select"; $field['typehint'] = "Interface of this connection."; $field['options']['option'] = array(); - foreach ($iflist as $ifname) { - $opts = array(); - $opts['name'] = $ifname; - $opts['value'] = $ifname; - $field['options']['option'][] = $opts; - } + foreach ($iflist as $ifname => $ifdescr) { + $opts = array(); + $opts['displayname'] = $ifdescr; + $opts['name'] = $ifname; + $opts['value'] = $ifname; + $field['options']['option'][] = $opts; + } $field['bindstofield'] = "ezshaper->step2->conn{$i}interface"; $fields[] = $field; -- cgit v1.1