From ea946240c9a5a11d337b7afcc8590870bc18cd84 Mon Sep 17 00:00:00 2001 From: xian310 Date: Fri, 21 Dec 2012 19:59:39 +0100 Subject: replace the ajax expand system by a navigation menu Signed-off-by: Pim van den Berg --- inc/html.inc.php | 59 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 12 deletions(-) (limited to 'inc') diff --git a/inc/html.inc.php b/inc/html.inc.php index 2e71488..f0390ce 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php @@ -13,7 +13,7 @@ function html_start() { $path = htmlentities(breadcrumbs()); echo << + @@ -58,20 +58,55 @@ function html_end() { EOT; } -function plugin_header($host, $plugin, $status) { - global $CONFIG; +function plugin_header($host, $plugin) { + return printf("

%s

\n", $CONFIG['weburl'], $host, $plugin, $plugin); +} + +function plugins_list($host, $overview_plugins, $other_plugins, $selected_plugins = array()) { + echo '
'; + echo '

Plugins

'; + echo '
    '; + + $selected = selected_overview($selected_plugins); + printf("
  • %s
  • \n", $selected, $CONFIG['weburl'], $host, 'overview'); + + # first the ones defined as ordered + foreach($overview_plugins as $plugin) { + $selected = selected_plugin($plugin, $selected_plugins); + printf("
  • %s
  • \n", $selected, $CONFIG['weburl'], $host, $plugin, $plugin); + } + + # other plugins + foreach($other_plugins as $plugin) { + if (!in_array($plugin, $overview_plugins)) { + $selected = selected_plugin($plugin, $selected_plugins); + printf("
  • %s
  • \n", $selected, $CONFIG['weburl'], $host, $plugin, $plugin); + } + } + + echo '
'; + echo '
'; +} + +function selected_overview($selected_plugins) { + if (count($selected_plugins) > 1) { + return 'class="selected"'; + } + return ''; +} - if ($status == 1) { - $f = 'get'; - $i = 'plus'; - $a = '+'; - } else { - $f = 'rm'; - $i = 'minus'; - $a = '-'; +function selected_plugin($plugin, $selected_plugins) { + if (in_array($plugin, $selected_plugins)) { + return 'class="selected"'; } + return ''; +} - return printf("

\"[%s]\" %s

\n", $f, $host, $plugin, $CONFIG['weburl'], $i, $a, $plugin); +function selected_timerange($value1, $value2) { + if ($value1 == $value2) { + return 'class="selected"'; + } + return ''; } function host_summary($hosts) { -- cgit v1.1