Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

haproxy-devel, change gui to bootstrap #41

Merged
merged 2 commits into from
Jan 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion net/pfSense-pkg-haproxy-devel/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# $FreeBSD$

PORTNAME= pfSense-pkg-haproxy-devel
PORTVERSION= 0.35
PORTVERSION= 0.36
CATEGORIES= net
MASTER_SITES= # empty
DISTFILES= # empty
Expand Down
11 changes: 10 additions & 1 deletion net/pfSense-pkg-haproxy-devel/files/usr/local/pkg/haproxy.inc
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,15 @@ $a_sysloglevel['notice'] = array('name' => "Notice");
$a_sysloglevel['info'] = array('name' => "Informational");
$a_sysloglevel['debug'] = array('name' => "Debugging");

global $a_facilities;
$a_facilities = array();
$facilities = array("kern", "user", "mail", "daemon", "auth", "syslog", "lpr",
"news", "uucp", "cron", "auth2", "ftp", "ntp", "audit", "alert", "cron2",
"local0", "local1", "local2", "local3", "local4", "local5", "local6", "local7");
foreach($facilities as $facility) {
$a_facilities[$facility] = array('name' => $facility);
}

global $a_filestype;
$a_filestype = array();
$a_filestype[''] = array('name' => "Errorfile");
Expand All @@ -253,7 +262,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')
));
Expand Down
14 changes: 11 additions & 3 deletions net/pfSense-pkg-haproxy-devel/files/usr/local/pkg/haproxy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -109,6 +109,14 @@
<prefix>/usr/local/www/</prefix>
<item>https://packages.pfsense.org/packages/config/haproxy-devel/www/haproxy_templates.php</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<item>https://packages.pfsense.org/packages/config/haproxy-devel/pkg/haproxy_gui.inc</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<item>https://packages.pfsense.org/packages/config/haproxy-devel/pkg/haproxy_socket.sh</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<item>https://packages.pfsense.org/packages/config/haproxy-devel/pkg/haproxy_socketinfo.inc</item>
Expand Down Expand Up @@ -143,8 +151,8 @@
<item>https://packages.pfsense.org/packages/config/haproxy-devel/pkg/haproxy_upgrade_config.inc</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/www/javascript/</prefix>
<item>https://packages.pfsense.org/packages/config/haproxy-devel/www/javascript/haproxy_geturl.js</item>
<prefix>/usr/local/www/haproxy/</prefix>
<item>https://packages.pfsense.org/packages/config/haproxy-devel/www/haproxy/haproxy_geturl.js</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/etc/inc/priv/</prefix>
Expand Down
141 changes: 141 additions & 0 deletions net/pfSense-pkg-haproxy-devel/files/usr/local/pkg/haproxy_gui.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?php
/*
haproxy_gui.inc
Copyright (C) 2016 PiBa-NL
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/

/* Include the autoloader for all the GUI display classes */
require_once("classes/autoload.inc.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),
'stop' => array(
"faicon" => "fa-stop-circle-o",
"icon" => "icon_service_stop.gif",
"iconsize" => 17),
'start' => array(
"faicon" => "fa-play-circle",
"icon" => "icon_service_start.gif",
"iconsize" => 17),
'up' => array(
"faicon" => "fa-check-circle",
"icon" => "icon_interface_up.gif",
"iconsize" => 11),
'down' => array(
"faicon" => "fa-times-circle",
"icon" => "icon_interface_down.gif",
"iconsize" => 11),
'resolvedns' => array(
"faicon" => "fa-info",
"icon" => "icon_log.gif",
"iconsize" => 11),
'help' => array(
"faicon" => "fa-info-circle",
"icon" => "icon_help.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("'", "&#39;", $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>";
}
}

class Form_Section_class extends Form_Section {
// Shortcut, adds a group for the specified input
public function addInput(Form_Input $input, $groupclass = null)
{
$group = new Form_Group($input->getTitle());
$group->add($input);
if ($groupclass) {
$group->addClass($groupclass);
}
$this->add($group);
return $input;
}
}
Loading