diff options
author | Phil Davis <phil.davis@inf.org> | 2016-01-07 11:12:41 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2016-01-07 11:12:41 +0545 |
commit | e0a30a51662dac54296a50c076b051042a3eda00 (patch) | |
tree | 75c4d28487db6a1aab21c4d3d256f574a0af0b36 /src/usr/local/www/firewall_shaper_vinterface.php | |
parent | 24c16d618ea9f61a07b016808915706c9d2da7f5 (diff) | |
download | pfsense-e0a30a51662dac54296a50c076b051042a3eda00.zip pfsense-e0a30a51662dac54296a50c076b051042a3eda00.tar.gz |
Rationalize add and delete buttons for limiter GUI
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 pressed save to add it!
3) When clicking on a Limiter at the top of the tree, the Delete button says "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.
Note: These issues are also in 2.2.6 - see https://github.com/pfsense/pfsense/pull/2362 for the changes to fix in RELENG_2_2.
Diffstat (limited to 'src/usr/local/www/firewall_shaper_vinterface.php')
-rw-r--r-- | src/usr/local/www/firewall_shaper_vinterface.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/usr/local/www/firewall_shaper_vinterface.php b/src/usr/local/www/firewall_shaper_vinterface.php index 41f5c32..91f830a 100644 --- a/src/usr/local/www/firewall_shaper_vinterface.php +++ b/src/usr/local/www/firewall_shaper_vinterface.php @@ -434,7 +434,7 @@ if ($dfltmsg) { } else { // Add global buttons if (!$dontshow || $newqueue) { - if ($can_add || $addnewaltq) { + if ($can_add && ($action != "add")) { if ($queue) { $url = 'firewall_shaper_vinterface.php?pipe=' . $pipe . '&queue=' . $queue->GetQname() . '&action=add'; } else { @@ -448,17 +448,19 @@ if ($dfltmsg) { ))->removeClass('btn-default')->addClass('btn-success'); } - if ($queue) { - $url = 'firewall_shaper_vinterface.php?pipe='. $pipe . '&queue=' . $queue->GetQname() . '&action=delete'; - } else { - $url = 'firewall_shaper_vinterface.php?pipe='. $pipe . '&action=delete'; - } + if ($action != "add") { + if ($queue) { + $url = 'firewall_shaper_vinterface.php?pipe='. $pipe . '&queue=' . $queue->GetQname() . '&action=delete'; + } else { + $url = 'firewall_shaper_vinterface.php?pipe='. $pipe . '&action=delete'; + } - $sform->addGlobal(new Form_Button( - 'delete', - $queue ? 'Delete this queue':'Delete', - $url - ))->removeClass('btn-default')->addClass('btn-danger'); + $sform->addGlobal(new Form_Button( + 'delete', + ($queue && ($qname != $pipe)) ? 'Delete this queue':'Delete Limiter', + $url + ))->removeClass('btn-default')->addClass('btn-danger'); + } } // Print the form |