diff options
-rw-r--r-- | config/haproxy-devel/haproxy.xml | 2 | ||||
-rw-r--r-- | config/haproxy-devel/pkg/haproxy.inc | 2 | ||||
-rw-r--r-- | config/haproxy-devel/pkg/haproxy_htmllist.inc | 24 | ||||
-rw-r--r-- | config/haproxy-devel/www/haproxy_listeners_edit.php | 25 | ||||
-rw-r--r-- | pkg_config.10.xml | 2 | ||||
-rw-r--r-- | pkg_config.8.xml | 2 | ||||
-rw-r--r-- | pkg_config.8.xml.amd64 | 2 |
7 files changed, 47 insertions, 12 deletions
diff --git a/config/haproxy-devel/haproxy.xml b/config/haproxy-devel/haproxy.xml index a096b850..07dc53d1 100644 --- a/config/haproxy-devel/haproxy.xml +++ b/config/haproxy-devel/haproxy.xml @@ -42,7 +42,7 @@ ]]> </copyright> <name>haproxy</name> - <version>0.35</version> + <version>0.36</version> <title>HAProxy</title> <aftersaveredirect>/pkg_edit.php?xml=haproxy_pools.php</aftersaveredirect> <include_file>/usr/local/pkg/haproxy.inc</include_file> diff --git a/config/haproxy-devel/pkg/haproxy.inc b/config/haproxy-devel/pkg/haproxy.inc index 8dce42ee..c8a225a3 100644 --- a/config/haproxy-devel/pkg/haproxy.inc +++ b/config/haproxy-devel/pkg/haproxy.inc @@ -253,7 +253,7 @@ $a_action["use_server"] = array('name' => "Use Server", 'mode' => '', 'syntax' = 'server' => array('name'=>"server",'columnheader'=>"Server",'type'=>"select",'size'=>"50",'mask'=>'server') )); // -$a_action["custom"] = array('name' => "Custom", 'mode' => '', +$a_action["custom"] = array('name' => "Custom", 'mode' => '', 'syntax' => '{customaction}', 'fields' => array( array('name'=>"customaction",'columnheader'=>"Custom action",'type'=>"textbox",'size'=>"50",'mask'=>'freetext') )); diff --git a/config/haproxy-devel/pkg/haproxy_htmllist.inc b/config/haproxy-devel/pkg/haproxy_htmllist.inc index 7eaad023..d5386fcd 100644 --- a/config/haproxy-devel/pkg/haproxy_htmllist.inc +++ b/config/haproxy-devel/pkg/haproxy_htmllist.inc @@ -42,8 +42,8 @@ class HaproxyHtmlList <tableId>_field_changed(tableId, rowNr, fieldId, field) */ - private $tablename = ""; - private $fields = array(); + public $tablename = ""; + public $fields = array(); public $editmode = false; public $fields_details = null; public $keyfield = ""; @@ -269,7 +269,13 @@ class HaproxyHtmlList foreach($itemdetails as $item) { $itemname = $item['name']; $itemvalue = $value[$itemname]; - //TODO don't filter empty items, filter context un-related items through customizable function.. + if ($this->fields_details_showfieldfunction != null) { + // filter context un-related items through customizable function. + $fn = &$this->fields_details_showfieldfunction; + if ($fn($this, $itemname, $value) == false) { + continue; + } + } else if (empty($itemvalue)) { continue; } @@ -488,7 +494,10 @@ function haproxy_htmllist_js(){ subtr.appendChild(subtd); subtd = d.createElement("td"); subtd.setAttribute("class","vncell"); - subtd.innerHTML = field['description'] + "<br/>" + fieldhtml; + if (field['description']) { + fieldhtml = field['description'] + "<br/>" + fieldhtml; + } + subtd.innerHTML = fieldhtml; subtr.appendChild(subtd); table.appendChild(subtr); } @@ -539,6 +548,13 @@ function haproxy_htmllist_js(){ if (typeof fn === 'function'){ fn(tableId, totalrows); } + + // show/hide conditional fields if applicable using a custom function. + javascript_event = tableId + "_listitem_change"; + var fn = window[javascript_event]; + if (typeof fn === 'function'){ + fn(tableId, "toggle_details", totalrows, null); + } } function editRow(num) { var trview = document.getElementById('tr_view_' + num); diff --git a/config/haproxy-devel/www/haproxy_listeners_edit.php b/config/haproxy-devel/www/haproxy_listeners_edit.php index f26341b2..8c37332e 100644 --- a/config/haproxy-devel/www/haproxy_listeners_edit.php +++ b/config/haproxy-devel/www/haproxy_listeners_edit.php @@ -251,14 +251,33 @@ function customdrawcell_actions($object, $item, $itemvalue, $editable, $itemname $htmllist_extaddr = new HaproxyHtmlList("table_extaddr", $fields_externalAddress); $htmllist_extaddr->editmode = true; +function fields_details_showfieldfunction($items, $action, $itemname) { + if (is_array($items[$action]) && is_array($items[$action]['fields'])) { + foreach($items[$action]['fields'] as $item) { + if ($action . "" . $item['name'] == $itemname) { + return true; + } + } + } + return false; +} +function fields_acls_details_showfieldfunction($htmltable, $itemname, $values) { + $items = $htmltable->fields[1]['items']; + $action = $values['expression']; + return fields_details_showfieldfunction($items, $action, $itemname); +} $htmllist_acls = new HaproxyHtmlList("table_acls", $fields_aclSelectionList); $htmllist_acls->fields_details = $fields_acl_details; -//$htmllist_acls->editmode = true; +$htmllist_acls->fields_details_showfieldfunction = fields_acls_details_showfieldfunction; +function fields_actions_details_showfieldfunction($htmltable, $itemname, $values) { + $items = $htmltable->fields[0]['items']; + $action = $values['action']; + return fields_details_showfieldfunction($items, $action, $itemname); +} $htmllist_actions = new HaproxyHtmlList("table_actions", $fields_actions); $htmllist_actions->fields_details = $fields_actions_details; -//$htmllist_actions->keyfield = "name"; -//$htmllist_actions->editmode = true; +$htmllist_actions->fields_details_showfieldfunction = fields_actions_details_showfieldfunction; $htmllist_sslCertificates = new HaproxyHtmlList("tbl_sslCerts", $fields_sslCertificates); $htmllist_caCertificates = new HaproxyHtmlList("tbl_caCerts", $fields_caCertificates ); diff --git a/pkg_config.10.xml b/pkg_config.10.xml index 980a529d..59d8f2d8 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -172,7 +172,7 @@ </descr> <website>http://haproxy.1wt.eu/</website> <category>Services</category> - <version>0.35</version> + <version>0.36</version> <status>RELEASE</status> <required_version>2.2</required_version> <config_file>https://packages.pfsense.org/packages/config/haproxy-devel/haproxy.xml</config_file> diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 398d172b..3993da14 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -177,7 +177,7 @@ Supports ACLs for smart backend switching.]]></descr> <website>http://haproxy.1wt.eu/</website> <category>Services</category> - <version>1.5.3 pkg v 0.35</version> + <version>1.5.3 pkg v 0.36</version> <status>Release</status> <required_version>2.1</required_version> <config_file>https://packages.pfsense.org/packages/config/haproxy-devel/haproxy.xml</config_file> diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index 80d9d879..3031cd11 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -177,7 +177,7 @@ Supports ACLs for smart backend switching.]]></descr> <website>http://haproxy.1wt.eu/</website> <category>Services</category> - <version>1.5.3 pkg v 0.35</version> + <version>1.5.3 pkg v 0.36</version> <status>Release</status> <required_version>2.1</required_version> <config_file>https://packages.pfsense.org/packages/config/haproxy-devel/haproxy.xml</config_file> |