From 587f46f452adedea658188cfd111a35bf5041af6 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 7 Jan 2016 10:49:59 +0545 Subject: Rationalize add and delete buttons for limiter GUI RELENG_2_2 This has annoyed me in the past. I noticed it in 2.3-BETA just now and went to look on a 2.2.6 system and realized it is an issue there also. 1) When you click to add a new limiter or new queue, then the "Add new queue" button is displayed down the bottom. That is dumb - you are already adding and actually you need to enter the data and save first before adding something else. 2) When you are adding something (like in (1)) the Delete button is displayed. That is also dumb - there is nothing to delete until you have press save to add it! 3) When clicking on a Limiter at the top of the tree, the Delete button syas "Delete this queue", but it is the top level limiter that is being edited and could be deleted, The $_GET/$_POST that happens sends "pipe" and "queue" both with the name of the top-level limiter. So in the end $queue always exists. So we only want the text "Delete this queue" if $queue exists and the queue name is NOT the same as the pipe name. I am submitting this for RELENG_2_2 because I wanted to sort that out anyway to understand what was wrong and how it should behave. Then I can look at 2.3-BETA and make it work nicely there... --- usr/local/www/firewall_shaper_vinterface.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/usr/local/www/firewall_shaper_vinterface.php b/usr/local/www/firewall_shaper_vinterface.php index 0930af1..75bc0e0 100644 --- a/usr/local/www/firewall_shaper_vinterface.php +++ b/usr/local/www/firewall_shaper_vinterface.php @@ -317,7 +317,7 @@ $output_form .= gettext("Queue Actions"); $output_form .= ""; $output_form .= ""; -if ($can_add || $addnewaltq) { +if ($can_add && ($action != "add")) { $output_form .= ""; $output_form .= ""; } -$output_form .= "GetQname(); +if ($action != "add") { + $output_form .= "GetQname(); + } + $output_form .= "&action=delete\">"; + $output_form .= ""; + else + $output_form .= " value=\"" . gettext("Delete Limiter") ."\" />"; + $output_form .= ""; } -$output_form .= "&action=delete\">"; -$output_form .= ""; -else - $output_form .= " value=\"" . gettext("Delete Limiter") ."\" />"; -$output_form .= ""; $output_form .= ""; $output_form .= ""; } -- cgit v1.1