mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
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.
This commit is contained in:
parent
2e814e0d69
commit
b63f2e8b29
@ -601,17 +601,32 @@ function install_package_xml($pkg) {
|
||||
update_output_window($static_output);
|
||||
if(is_array($pkg_config['menu'])) {
|
||||
foreach($pkg_config['menu'] as $menu) {
|
||||
if(is_array($config['installedpackages']['menu'])) {
|
||||
foreach($config['installedpackages']['menu'] as $amenu) {
|
||||
if($amenu['name'] == $menu['name']) continue 2;
|
||||
}
|
||||
}
|
||||
if(is_array($config['installedpackages']['menu']))
|
||||
foreach($config['installedpackages']['menu'] as $amenu)
|
||||
if($amenu['name'] == $menu['name'])
|
||||
continue 2;
|
||||
$config['installedpackages']['menu'][] = $menu;
|
||||
}
|
||||
}
|
||||
$static_output .= "done.\n";
|
||||
update_output_window($static_output);
|
||||
}
|
||||
/* integrated tab items */
|
||||
if($pkg_config['tabs'] != "") {
|
||||
$static_output .= "\tIntegrated Tab items... ";
|
||||
update_output_window($static_output);
|
||||
if(is_array($pkg_config['tabs']['tab'])) {
|
||||
foreach($pkg_config['tabs']['tab'] as $tab) {
|
||||
if(is_array($config['installedpackages']['tab']))
|
||||
foreach($config['installedpackages']['tab'] as $atab)
|
||||
if($atab['name'] == $tab['name'])
|
||||
continue 2;
|
||||
$config['installedpackages']['tab'][] = $tab;
|
||||
}
|
||||
}
|
||||
$static_output .= "done.\n";
|
||||
update_output_window($static_output);
|
||||
}
|
||||
/* services */
|
||||
if($pkg_config['service'] != "") {
|
||||
$static_output .= "\tServices... ";
|
||||
@ -734,20 +749,34 @@ function delete_package_xml($pkg) {
|
||||
update_output_window($static_output);
|
||||
/* parse package configuration */
|
||||
$packages = &$config['installedpackages']['package'];
|
||||
$menus = &$config['installedpackages']['menu'];
|
||||
$tabs =& $config['installedpackages']['tab'];
|
||||
$menus =& $config['installedpackages']['menu'];
|
||||
$services = &$config['installedpackages']['service'];
|
||||
if(file_exists("/usr/local/pkg/" . $packages[$pkgid]['configurationfile'])) {
|
||||
$pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $packages[$pkgid]['configurationfile'], "packagegui");
|
||||
/* remove tab items */
|
||||
if(is_array($pkg_config['tabs'])) {
|
||||
$static_output .= "\tMenu items... ";
|
||||
update_output_window($static_output);
|
||||
foreach($tabs as $tab)
|
||||
$insttabs[] = $tab['name'];
|
||||
foreach($pkg_config['tabs']['tab'] as $tab)
|
||||
foreach($insttabs as $key => $insttab)
|
||||
if($insttab == $tab['name'])
|
||||
unset($tabs[$key]);
|
||||
$static_output .= "done.\n";
|
||||
update_output_window($static_output);
|
||||
}
|
||||
/* remove menu items */
|
||||
if(is_array($pkg_config['menu'])) {
|
||||
$static_output .= "\tMenu items... ";
|
||||
update_output_window($static_output);
|
||||
foreach($menus as $menu) $instmenus[] = $menu['name'];
|
||||
foreach($pkg_config['menu'] as $menu) {
|
||||
foreach($instmenus as $key => $instmenu) {
|
||||
if($instmenu == $menu['name']) unset($menus[$key]);
|
||||
}
|
||||
}
|
||||
foreach($menus as $menu)
|
||||
$instmenus[] = $menu['name'];
|
||||
foreach($pkg_config['menu'] as $menu)
|
||||
foreach($instmenus as $key => $instmenu)
|
||||
if($instmenu == $menu['name'])
|
||||
unset($menus[$key]);
|
||||
$static_output .= "done.\n";
|
||||
update_output_window($static_output);
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ function listtags() {
|
||||
"dyndns earlyshellcmd element encryption-algorithm-option field ".
|
||||
"fieldname hash-algorithm-option gateway_item gateway_group gif gre ".
|
||||
"group hosts member interface_array item key lagg lbaction lbpool ".
|
||||
"lbprotocol member menu mobilekey monitor_type mount ntpserver onetoone ".
|
||||
"lbprotocol member menu tab mobilekey monitor_type mount ntpserver onetoone ".
|
||||
"openvpn-server openvpn-client openvpn-csc " .
|
||||
"option ppp package passthrumac phase1 phase2 priv proxyarpnet queue ".
|
||||
"pages pipe route row rule schedule service servernat servers ".
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@ -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);
|
||||
?>
|
||||
</ul>
|
||||
|
||||
@ -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);
|
||||
?>
|
||||
</ul>
|
||||
|
||||
@ -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);
|
||||
?>
|
||||
</ul>
|
||||
@ -486,7 +487,7 @@ function netbios_change() {
|
||||
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" class="listtopic">General information</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="22%" valign="top" class="vncellreq">Disabled</td>
|
||||
<td width="78%" class="vtable">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user