From fbb98523ff6d3fd8633ee00e799a17c6fcaf49ea Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Fri, 4 Mar 2016 17:25:23 +0100 Subject: [PATCH] (legacy) zapp load_balancer_maintable.inc --- src/etc/inc/load_balancer_maintable.inc | 166 ----------------------- src/www/load_balancer_pool.php | 1 - src/www/load_balancer_virtual_server.php | 1 - 3 files changed, 168 deletions(-) delete mode 100644 src/etc/inc/load_balancer_maintable.inc diff --git a/src/etc/inc/load_balancer_maintable.inc b/src/etc/inc/load_balancer_maintable.inc deleted file mode 100644 index 13bfbb889..000000000 --- a/src/etc/inc/load_balancer_maintable.inc +++ /dev/null @@ -1,166 +0,0 @@ -. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ - -class MainTable { - private $headers = array(); -// private $columns = array(); - private $columns = 0; - private $rows = 0; - private $content = array(); - private $edit_uri = ''; - private $my_uri = ''; - private $buttons = array('move' => false, 'edit' => false, 'del' => false, 'dup' => false); - - function add_column($header, $cname, $width) { -// $this->column[] = array('header' => $header, 'cname' => $cname, 'width' => $width) - $this->headers[] = $header; - $this->cname[] = $cname; - $this->width[] = $width; - $this->columns++; - } - - function add_content_array($rows) { - foreach($rows as $row) { - $this->content[] = $row; - $this->rows++; - } - } - function add_button($name) { - if (isset($this->buttons[$name])) { - $this->buttons[$name] = true; - } - } - function edit_uri($uri) { - $this->edit_uri = $uri; - } - - function my_uri($uri) { - $this->my_uri = $uri; - } - - function display() { - echo "\n"; - echo "\n"; - echo " \n"; - echo $this->display_header(); - echo " \n"; - echo " \n"; - echo $this->display_rows(); - echo " \n"; - echo " \n"; - echo $this->display_footer(); - echo " \n"; - echo "
\n"; - echo "\n"; - } - - private function display_header() - { - echo "\n"; - for ($col = 0; $col < $this->columns - 1; $col++) { - echo " width[$col]}%\" class=\"listhdrr\">{$this->headers[$col]}\n"; - } - echo " width[$this->columns - 1]}%\" class=\"listhdr\">{$this->headers[$this->columns - 1]}\n"; - echo " \n"; - - echo " \n"; - echo "\n"; - - } - private function display_rows() - { - $cur_row = 0; - foreach ($this->content as $row) { - echo "\n"; - for ($col = 0; $col < $this->columns - 1; $col++) { - if ($col == 0) { - $cl = 'listlr'; - } else { - $cl = 'listr'; - } - echo " edit_uri}?id={$cur_row}'\">\n"; - if (is_array($row[$this->cname[$col]])) { - foreach ($row[$this->cname[$col]] as $data) { - echo " {$data}
\n"; - } - } else { - echo " " . $row[$this->cname[$col]] . "\n"; - } - echo " \n"; - } - echo " edit_uri}?id={$cur_row}'\">\n"; - echo " {$row[$this->cname[$this->columns - 1]]}\n"; - echo " \n"; - echo " \n"; - $this->display_buttons($cur_row); - echo " \n"; - echo "\n"; - - $cur_row++; - } - } - private function display_footer() { } - private function display_buttons($row) - { - if ($this->buttons['move']) - echo $this->display_button('move', $row); - if ($this->buttons['edit']) - echo $this->display_button('edit', $row); - - if ($this->buttons['del']) - echo $this->display_button('del', $row); - if ($this->buttons['dup']) - echo $this->display_button('dup', $row); - } - private function display_button($button, $row) - { - switch ($button) { - case "move": { - echo ""; - break; - } - case "edit": { - echo "edit_uri}?id={$row}\" class=\"btn btn-default btn-xs\">"; - break; - } - case "del": { - echo "my_uri}?act=del&id={$row}\" onclick=\"return confirm('".gettext('Do you really want to delete this entry?')."')\" class=\"btn btn-default btn-xs\">"; - break; - } - case "dup": { - echo "edit_uri}?act=dup&id={$row}\" class=\"btn btn-default btn-xs\" title=\"".gettext('Duplicate entry')."\" />"; - break; - } - } - - } - -} - -?> diff --git a/src/www/load_balancer_pool.php b/src/www/load_balancer_pool.php index 6af481449..817d6c27a 100644 --- a/src/www/load_balancer_pool.php +++ b/src/www/load_balancer_pool.php @@ -29,7 +29,6 @@ require_once("guiconfig.inc"); require_once("filter.inc"); -require_once("load_balancer_maintable.inc"); require_once("services.inc"); require_once("vslb.inc"); require_once("interfaces.inc"); diff --git a/src/www/load_balancer_virtual_server.php b/src/www/load_balancer_virtual_server.php index 7453fe9bb..f21ed5fbb 100644 --- a/src/www/load_balancer_virtual_server.php +++ b/src/www/load_balancer_virtual_server.php @@ -30,7 +30,6 @@ require_once("guiconfig.inc"); require_once("filter.inc"); require_once("vslb.inc"); -require_once("load_balancer_maintable.inc"); require_once("services.inc"); require_once("interfaces.inc");