From b63f2e8b294527f2fd860899fdc2906fddb0c2f7 Mon Sep 17 00:00:00 2001 From: Matthew Grooms Date: Tue, 16 Sep 2008 17:41:22 +0000 Subject: Make it possible for pakages to insert additional tabbed pages into an existing tab group. This requires that each page in the tab group call add_package_tabs() with the tab group name before display_top_tabs() so pages can be inserted. While far from optimal, this system is really a stop-gap measure until a more intelligent menu/tab system can be implemented. Discussed with Scott on IRC. --- usr/local/www/guiconfig.inc | 31 ++++++++++++++++--------------- usr/local/www/vpn_openvpn_client.php | 1 + usr/local/www/vpn_openvpn_csc.php | 1 + usr/local/www/vpn_openvpn_server.php | 3 ++- 4 files changed, 20 insertions(+), 16 deletions(-) (limited to 'usr/local') diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index 3015ac5..20bd038 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -974,22 +974,23 @@ function echo_array($array,$return_me=false){ } } -function add_package_tab_hooks($section) { +function add_package_tabs($tabgroup, & $tab_array) { global $config, $g; - if($config['installedpackages']) { - $tab_array = array(); - foreach($config['installedpackages']['tabs'] as $tab) { - if($tab['section'] == $section) { - $tab_array_tmp = array(); - $tab_array_tmp['name'] = $tab['name']; - $tab_array_tmp['section'] = $tab['section']; - $tab_array_tmp['configfile'] = $tab['configfile']; - $tab_array_tmp['url'] = $tab['url']; - $tab_array[] = $tab_array_tmp; - } - } - return $tab_array; + + if(!is_array($config['installedpackages'])) + return; + if(!is_array($config['installedpackages']['tab'])) + return; + + foreach($config['installedpackages']['tab'] as $tab) { + if ($tab['group'] !== $group) + continue; + $tab_entry = array(); + $tab_entry[] = $tab['name']; + $tab_entry[] = false; + $tab_entry[] = $tab['url']; + $tab_array[] = $tab_entry; } } -?> \ No newline at end of file +?> diff --git a/usr/local/www/vpn_openvpn_client.php b/usr/local/www/vpn_openvpn_client.php index 724668d..d3baa72 100644 --- a/usr/local/www/vpn_openvpn_client.php +++ b/usr/local/www/vpn_openvpn_client.php @@ -310,6 +310,7 @@ function autotls_change() { $tab_array[] = array(gettext("Server"), false, "vpn_openvpn_server.php"); $tab_array[] = array(gettext("Client"), true, "vpn_openvpn_client.php"); $tab_array[] = array(gettext("Client Specific Overrides"), false, "vpn_openvpn_csc.php"); + add_package_tabs("OpenVPN", $tab_array); display_top_tabs($tab_array); ?> diff --git a/usr/local/www/vpn_openvpn_csc.php b/usr/local/www/vpn_openvpn_csc.php index 486b01d..61c3d40 100644 --- a/usr/local/www/vpn_openvpn_csc.php +++ b/usr/local/www/vpn_openvpn_csc.php @@ -289,6 +289,7 @@ function netbios_change() { $tab_array[] = array(gettext("Server"), false, "vpn_openvpn_server.php"); $tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php"); $tab_array[] = array(gettext("Client Specific Overrides"), true, "vpn_openvpn_csc.php"); + add_package_tabs("OpenVPN", $tab_array); display_top_tabs($tab_array); ?> diff --git a/usr/local/www/vpn_openvpn_server.php b/usr/local/www/vpn_openvpn_server.php index d5c5810..c56bc81 100644 --- a/usr/local/www/vpn_openvpn_server.php +++ b/usr/local/www/vpn_openvpn_server.php @@ -472,6 +472,7 @@ function netbios_change() { $tab_array[] = array(gettext("Server"), true, "vpn_openvpn_server.php"); $tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php"); $tab_array[] = array(gettext("Client Specific Overrides"), false, "vpn_openvpn_csc.php"); + add_package_tabs("OpenVPN", $tab_array); display_top_tabs($tab_array); ?> @@ -486,7 +487,7 @@ function netbios_change() { - +
General information
Disabled -- cgit v1.1