From 3fbe9036f49c5e219324858aaf446de9437ca642 Mon Sep 17 00:00:00 2001 From: thompsa Date: Wed, 10 Feb 2010 11:17:25 +1300 Subject: Add plus icon next to current entries on all the pages (listener/server pool pages, as well as the entries in ACL's and adding servers) which is a "add a new rule based on this one". --- config/haproxy-dev/haproxy_listeners.php | 3 +- config/haproxy-dev/haproxy_listeners_edit.php | 79 +++++++++++++++++++++---- config/haproxy-dev/haproxy_pool_edit.php | 84 +++++++++++++++++++++++---- config/haproxy-dev/haproxy_pools.php | 3 +- 4 files changed, 147 insertions(+), 22 deletions(-) (limited to 'config/haproxy-dev') diff --git a/config/haproxy-dev/haproxy_listeners.php b/config/haproxy-dev/haproxy_listeners.php index f66b51bf..ef67108b 100755 --- a/config/haproxy-dev/haproxy_listeners.php +++ b/config/haproxy-dev/haproxy_listeners.php @@ -147,13 +147,14 @@ include("head.inc"); + - + diff --git a/config/haproxy-dev/haproxy_listeners_edit.php b/config/haproxy-dev/haproxy_listeners_edit.php index 8d948dd9..fc665ea9 100755 --- a/config/haproxy-dev/haproxy_listeners_edit.php +++ b/config/haproxy-dev/haproxy_listeners_edit.php @@ -58,6 +58,9 @@ if (isset($_POST['id'])) else $id = $_GET['id']; +if (isset($_GET['dup'])) + $id = $_GET['dup']; + if (isset($id) && $a_backend[$id]) { $pconfig['name'] = $a_backend[$id]['name']; $pconfig['desc'] = $a_backend[$id]['desc']; @@ -90,6 +93,9 @@ if (isset($id) && $a_backend[$id]) { } +if (isset($_GET['dup'])) + unset($id); + $changedesc = "Services: HAProxy: Listener"; $changecount = 0; @@ -267,6 +273,8 @@ include("head.inc"); var addRowTo = (function() { return (function (tableId) { var d, tbody, tr, td, bgc, i, ii, j; + var btable, btbody, btr, btd; + d = document; tbody = d.getElementById(tableId).getElementsByTagName("tbody").item(0); tr = d.createElement("tr"); @@ -274,25 +282,68 @@ include("head.inc"); for (i = 0; i < field_counter_js; i++) { td = d.createElement("td"); if(rowtype[i] == 'textbox') { - td.innerHTML=" "; + td.innerHTML=" "; } else if(rowtype[i] == 'select') { - td.innerHTML=" "; + td.innerHTML=" "; } else { - td.innerHTML=" "; + td.innerHTML=" "; } tr.appendChild(td); } - td = d.createElement("td"); - td.rowSpan = "1"; - td.className = "list"; - td.innerHTML = ''; + td = d.createElement("td"); + td.rowSpan = "1"; + td.setAttribute("class","list"); + + // Recreate the button table. + btable = document.createElement("table"); + btable.setAttribute("border", "0"); + btable.setAttribute("cellspacing", "0"); + btable.setAttribute("cellpadding", "1"); + btbody = document.createElement("tbody"); + btr = document.createElement("tr"); + btd = document.createElement("td"); + btd.setAttribute("valign", "middle"); + btd.innerHTML = ''; + btr.appendChild(btd); + btd = document.createElement("td"); + btd.setAttribute("valign", "middle"); + btd.innerHTML = '"; + btr.appendChild(btd); + btbody.appendChild(btr); + btable.appendChild(btbody); + + td.appendChild(btable); tr.appendChild(td); tbody.appendChild(tr); }); })(); + function dupRow(rowId, tableId) { + var dupEl; + var newEl; + + addRowTo(tableId); + for (i = 0; i < field_counter_js; i++) { + dupEl = document.getElementById(rowname[i] + rowId); + newEl = document.getElementById(rowname[i] + totalrows); + if (dupEl && newEl) + newEl.value = dupEl.value; + } + } + function removeRow(el) { var cel; + // Break out of one table first + while (el && el.nodeName.toLowerCase() != "table") + el = el.parentNode; while (el && el.nodeName.toLowerCase() != "tr") el = el.parentNode; @@ -471,7 +522,7 @@ include("head.inc"); foreach ($a_acl as $acl) { ?> - + - - + + - + + + + - + + "; + td.innerHTML=" "; } else if(rowtype[i] == 'select') { - td.innerHTML=" "; + td.innerHTML=" "; } else { - td.innerHTML=" "; + td.innerHTML=" "; } td.setAttribute("class","vtable"); tr.appendChild(td); @@ -380,14 +410,48 @@ var addRowTo = (function() { td.rowSpan = "1"; td.setAttribute("class","list"); - td.innerHTML = ''; + // Recreate the button table. + btable = document.createElement("table"); + btable.setAttribute("border", "0"); + btable.setAttribute("cellspacing", "0"); + btable.setAttribute("cellpadding", "1"); + btbody = document.createElement("tbody"); + btr = document.createElement("tr"); + btd = document.createElement("td"); + btd.setAttribute("valign", "middle"); + btd.innerHTML = ''; + btr.appendChild(btd); + btd = document.createElement("td"); + btd.setAttribute("valign", "middle"); + btd.innerHTML = '"; + btr.appendChild(btd); + btbody.appendChild(btr); + btable.appendChild(btbody); + + td.appendChild(btable); tr.appendChild(td); tbody.appendChild(tr); }); })(); +function dupRow(rowId, tableId) { + var dupEl; + var newEl; + + addRowTo(tableId); + for (i = 0; i < field_counter_js; i++) { + dupEl = document.getElementById(rowname[i] + rowId); + newEl = document.getElementById(rowname[i] + totalrows); + if (dupEl && newEl) + newEl.value = dupEl.value; + } +} + function removeRow(el) { var cel; + // Break out of one table first + while (el && el.nodeName.toLowerCase() != "table") + el = el.parentNode; while (el && el.nodeName.toLowerCase() != "tr") el = el.parentNode; diff --git a/config/haproxy-dev/haproxy_pools.php b/config/haproxy-dev/haproxy_pools.php index 61e85273..78a1fdff 100755 --- a/config/haproxy-dev/haproxy_pools.php +++ b/config/haproxy-dev/haproxy_pools.php @@ -141,13 +141,14 @@ include("head.inc"); +
+ + +
+ + + +
+
+ + +
+ + + +
+
- + -- cgit v1.2.3