diff options
Diffstat (limited to 'config/haproxy-devel/pkg')
-rw-r--r-- | config/haproxy-devel/pkg/haproxy_gui.inc | 75 | ||||
-rw-r--r-- | config/haproxy-devel/pkg/haproxy_htmllist.inc | 29 |
2 files changed, 90 insertions, 14 deletions
diff --git a/config/haproxy-devel/pkg/haproxy_gui.inc b/config/haproxy-devel/pkg/haproxy_gui.inc new file mode 100644 index 00000000..5392e87a --- /dev/null +++ b/config/haproxy-devel/pkg/haproxy_gui.inc @@ -0,0 +1,75 @@ +<?php + +$haproxy_icons = array( + 'moveup' => array( + "faicon" => "fa-arrow-up", + "icon" => "icon_up.gif", + "iconsize" => 17), + 'movedown' => array( + "faicon" => "fa-arrow-down", + "icon" => "icon_down.gif", + "iconsize" => 17), + 'add' => array( + "faicon" => "fa-level-down", + "icon" => "icon_plus.gif", + "iconsize" => 17), + 'delete' => array( + "faicon" => "fa-trash", + "icon" => "icon_x.gif", + "iconsize" => 17), + 'edit' => array( + "faicon" => "fa-pencil", + "icon" => "icon_e.gif", + "iconsize" => 17), + 'clone' => array( + "faicon" => "fa-clone", + "icon" => "icon_plus.gif"), + 'acl' => array( + "faicon" => "fa-random", + "icon" => "icon_ts_rule.gif", + "iconsize" => 11), + 'cert' => array( + "faicon" => "fa-lock", + "icon" => "icon_frmfld_cert.png", + "iconsize" => 11), + 'advanced' => array( + "faicon" => "fa-cog", + "icon" => "icon_advanced.gif", + "iconsize" => 11), + 'enabled' => array( + "faicon" => "fa-check", + "icon" => "icon_pass.gif", + "iconsize" => 11), + 'disabled' => array( + "faicon" => "fa-ban", + "icon" => "icon_reject.gif", + "iconsize" => 11), + 'stats' => array( + "faicon" => "fa-tasks", + "icon" => "icon_log_s.gif", + "iconsize" => 11) +); + +global $pf_version; +$pf_version = substr(trim(file_get_contents("/etc/version")), 0, 3); + +function pf_version() { + global $pf_version; + return $pf_version; +} + +function haproxyicon($iconname, $title) { + global $g, $haproxy_icons; + $title = htmlspecialchars($title); + $title = str_replace("'", "'", $title); + + $faicon = $haproxy_icons[$iconname]["faicon"]; + if (pf_version() < "2.3") { + $icon = $haproxy_icons[$iconname]["icon"]; + $iconsize = $haproxy_icons[$iconname]["iconsize"]; + return "<img src='/themes/{$g['theme']}/images/icons/$icon' title='$title' width='$iconsize' height='$iconsize' border='0' />"; + } else { + return "<i class='fa $faicon' title='$title'></i>"; + } + +} diff --git a/config/haproxy-devel/pkg/haproxy_htmllist.inc b/config/haproxy-devel/pkg/haproxy_htmllist.inc index d5386fcd..70a53c86 100644 --- a/config/haproxy-devel/pkg/haproxy_htmllist.inc +++ b/config/haproxy-devel/pkg/haproxy_htmllist.inc @@ -33,6 +33,7 @@ require_once("config.inc"); require_once("haproxy_utils.inc"); +require_once("haproxy_gui.inc"); class HaproxyHtmlList { @@ -193,20 +194,20 @@ class HaproxyHtmlList <td class='list'> <table border='0' cellspacing='0' cellpadding='1'><tr> <td valign='middle'> - <img src='/themes/{$g['theme']}/images/icons/icon_e.gif' title='edit entry' width='17' height='17' border='0' onclick='editRow({$counter}); return false;' /> + <a onclick='editRow({$counter}); return false;'>".haproxyicon('edit','edit entry')."</a> </td> <td valign='middle'> - <img src='/themes/{$g['theme']}/images/icons/icon_x.gif' title='delete entry' width='17' height='17' border='0' onclick='deleteRow({$counter}, \"{$tablename}\"); return false;' /> + <a onclick='deleteRow({$counter}, \"{$tablename}\"); return false;'>".haproxyicon('delete','delete entry')."</a> </td> <td valign='middle'> - <img src='/themes/{$g['theme']}/images/icons/icon_plus.gif' title='duplicate entry' width='17' height='17' border='0' onclick='dupRow({$counter}, \"{$tablename}\"); return false;' /> + <a onclick='dupRow({$counter}, \"{$tablename}\"); return false;'>".haproxyicon('clone','duplicate entry')."</a> </td>"; if (empty($this->noindex)) { echo "<td valign='middle'> - <img src='/themes/{$g['theme']}/images/icons/icon_up.gif' title='move row up' width='17' height='17' border='0' onclick='moveRowUp({$counter}, \"{$tablename}\"); return false;' /> + <a onclick='moveRowUp({$counter}, \"{$tablename}\"); return false;'>".haproxyicon('moveup','move row up')."</a> </td> <td valign='middle'> - <img src='/themes/{$g['theme']}/images/icons/icon_down.gif' title='move row down' width='17' height='17' border='0' onclick='moveRowDown({$counter}, \"{$tablename}\"); return false;' /> + <a onclick='moveRowDown({$counter}, \"{$tablename}\"); return false;'>".haproxyicon('movedown','move row down')."</a> </td>"; } echo "</tr></table> @@ -232,17 +233,17 @@ class HaproxyHtmlList <table border='0' cellspacing='0' cellpadding='1'><tr> <td valign='middle'> <input name='{$tablename}_rowindex{$counter}' id='{$tablename}_rowindex{$counter}' type='hidden' value='{$counter}' /> - <img src='/themes/{$g['theme']}/images/icons/icon_x.gif' title='delete entry' width='17' height='17' border='0' onclick='deleteRow({$counter}, \"{$tablename}\"); return false;' /> + <a onclick='deleteRow({$counter}, \"{$tablename}\"); return false;' >".haproxyicon('delete','delete entry')."</a> </td> <td valign='middle'> - <img src='/themes/{$g['theme']}/images/icons/icon_plus.gif' title='duplicate entry' width='17' height='17' border='0' onclick='dupRow({$counter}, \"{$tablename}\"); return false;' /> + <a onclick='dupRow({$counter}, \"{$tablename}\"); return false;' />".haproxyicon('clone','duplicate entry')."</a> </td>"; if (empty($this->noindex)) { echo "<td valign='middle'> - <img src='/themes/{$g['theme']}/images/icons/icon_up.gif' title='move row up' width='17' height='17' border='0' onclick='moveRowUp({$counter}, \"{$tablename}\"); return false;' /> + <a onclick='moveRowUp({$counter}, \"{$tablename}\"); return false;' />".haproxyicon('moveup','move row up')."</a> </td> <td valign='middle'> - <img src='/themes/{$g['theme']}/images/icons/icon_down.gif' title='move row down' width='17' height='17' border='0' onclick='moveRowDown({$counter}, \"{$tablename}\"); return false;' /> + <a onclick='moveRowDown({$counter}, \"{$tablename}\"); return false;' />".haproxyicon('movedown','move row down')."</a> </td>"; } echo "</tr></table> @@ -328,7 +329,7 @@ class HaproxyHtmlList echo "</tbody> </table> <a onclick='javascript:addRowTo(\"{$tablename}\"); return false;' href='#'> - <img border='0' src='/themes/{$g['theme']}/images/icons/icon_plus.gif' alt='' title='add another entry' /> + ".haproxyicon('add','add another entry')." </a>"; } } @@ -445,12 +446,12 @@ function haproxy_htmllist_js(){ btd.setAttribute("valign", "middle"); btd.innerHTML = '<input name="'+tableId+'_rowindex'+totalrows+'" id="'+tableId+'_rowindex'+totalrows+'" type="hidden" value="'+totalrows+'" />' + - '<img src="/themes/' + theme + '/images/icons/icon_x.gif" title="delete entry" width="17" height="17" border="0" onclick="deleteRow(' + totalrows + ", '" + tableId + "'); return false;\" />"; + '<a onclick="deleteRow(' + totalrows + ", '" + tableId + "'); return false;\" ><?=haproxyicon('delete','delete entry')?></a>"; btr.appendChild(btd); btd = document.createElement("td"); btd.setAttribute("valign", "middle"); - btd.innerHTML = '<img src="/themes/' + theme + "/images/icons/icon_plus.gif\" title=\"duplicate entry\" width=\"17\" height=\"17\" border=\"0\" onclick=\"dupRow(" + totalrows + ", '" + tableId + "'); return false;\" />"; + btd.innerHTML = '<a onclick=\"dupRow(' + totalrows + ", '" + tableId + "'); return false;\" ><?=haproxyicon('clone','duplicate entry')?></a>"; btr.appendChild(btd); @@ -458,12 +459,12 @@ function haproxy_htmllist_js(){ if (tabledefinition && tabledefinition['keyfield'] == "") { btd = document.createElement("td"); btd.setAttribute("valign", "middle"); - btd.innerHTML = '<img src="/themes/' + theme + "/images/icons/icon_up.gif\" title=\"move entry up\" width=\"17\" height=\"17\" border=\"0\" onclick=\"moveRowUp(" + totalrows + ", '" + tableId + "'); return false;\" />"; + btd.innerHTML = '<a onclick=\"moveRowUp(' + totalrows + ", '" + tableId + "'); return false;\" ><?=haproxyicon('moveup','move row up')?></a>"; btr.appendChild(btd); btd = document.createElement("td"); btd.setAttribute("valign", "middle"); - btd.innerHTML = '<img src="/themes/' + theme + "/images/icons/icon_down.gif\" title=\"move entry down\" width=\"17\" height=\"17\" border=\"0\" onclick=\"moveRowDown(" + totalrows + ", '" + tableId + "'); return false;\" />"; + btd.innerHTML = '<a onclick=\"moveRowDown(' + totalrows + ", '" + tableId + "'); return false;\" ><?=haproxyicon('movedown','move row down')?></a>"; btr.appendChild(btd); } |