diff options
author | PiBa-NL <pba_2k3@yahoo.com> | 2015-12-23 23:23:12 +0100 |
---|---|---|
committer | PiBa-NL <pba_2k3@yahoo.com> | 2015-12-23 23:23:12 +0100 |
commit | 5317a20269bd39459ca22737a35e494ca972bf88 (patch) | |
tree | 2afbdf9c22ae598779dd3211fb551a4a63513896 /config/haproxy-devel | |
parent | 3bd905893f4eeb15485783e49a8ea2af14b31f4e (diff) | |
download | pfsense-packages-5317a20269bd39459ca22737a35e494ca972bf88.tar.gz pfsense-packages-5317a20269bd39459ca22737a35e494ca972bf88.tar.bz2 pfsense-packages-5317a20269bd39459ca22737a35e494ca972bf88.zip |
haproxy-devel, small fixes for showing/hiding acl fields not applicable, fix custom action, pkg v0.36
Diffstat (limited to 'config/haproxy-devel')
-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 |
4 files changed, 44 insertions, 9 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 ); |