diff options
Diffstat (limited to 'config/haproxy-devel/pkg')
-rw-r--r-- | config/haproxy-devel/pkg/haproxy.inc | 2 | ||||
-rw-r--r-- | config/haproxy-devel/pkg/haproxy_htmllist.inc | 24 |
2 files changed, 21 insertions, 5 deletions
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); |