diff options
Diffstat (limited to '')
| -rw-r--r-- | detail.php | 10 | ||||
| -rw-r--r-- | host.php | 9 | ||||
| -rw-r--r-- | inc/html.inc.php | 35 |
3 files changed, 28 insertions, 26 deletions
| @@ -21,12 +21,7 @@ $width = GET('x'); | |||
| 21 | $heigth = GET('y'); | 21 | $heigth = GET('y'); |
| 22 | $seconds = GET('s'); | 22 | $seconds = GET('s'); |
| 23 | 23 | ||
| 24 | if (!$plugin) { | 24 | $selected_plugins = !$plugin ? $CONFIG['overview'] : array($plugin); |
| 25 | $selected_plugins = $CONFIG['overview']; | ||
| 26 | } | ||
| 27 | else { | ||
| 28 | $selected_plugins = array($plugin); | ||
| 29 | } | ||
| 30 | 25 | ||
| 31 | html_start(); | 26 | html_start(); |
| 32 | 27 | ||
| @@ -39,8 +34,7 @@ if(!$plugins) { | |||
| 39 | return false; | 34 | return false; |
| 40 | } | 35 | } |
| 41 | 36 | ||
| 42 | plugins_list($host, $CONFIG['overview'], $plugins, $selected_plugins); | 37 | plugins_list($host, $selected_plugins); |
| 43 | |||
| 44 | 38 | ||
| 45 | echo '<div class="graphs">'; | 39 | echo '<div class="graphs">'; |
| 46 | plugin_header($host, $plugin); | 40 | plugin_header($host, $plugin); |
| @@ -7,12 +7,7 @@ require_once 'inc/collectd.inc.php'; | |||
| 7 | $host = validate_get(GET('h'), 'host'); | 7 | $host = validate_get(GET('h'), 'host'); |
| 8 | $plugin = validate_get(GET('p'), 'plugin'); | 8 | $plugin = validate_get(GET('p'), 'plugin'); |
| 9 | 9 | ||
| 10 | if (!$plugin) { | 10 | $selected_plugins = !$plugin ? $CONFIG['overview'] : array($plugin); |
| 11 | $selected_plugins = $CONFIG['overview']; | ||
| 12 | } | ||
| 13 | else { | ||
| 14 | $selected_plugins = array($plugin); | ||
| 15 | } | ||
| 16 | 11 | ||
| 17 | html_start(); | 12 | html_start(); |
| 18 | 13 | ||
| @@ -25,7 +20,7 @@ if(!$plugins) { | |||
| 25 | return false; | 20 | return false; |
| 26 | } | 21 | } |
| 27 | 22 | ||
| 28 | plugins_list($host, $CONFIG['overview'], $plugins, $selected_plugins); | 23 | plugins_list($host, $selected_plugins); |
| 29 | 24 | ||
| 30 | echo '<div class="graphs">'; | 25 | echo '<div class="graphs">'; |
| 31 | foreach ($selected_plugins as $selected_plugin) { | 26 | foreach ($selected_plugins as $selected_plugin) { |
diff --git a/inc/html.inc.php b/inc/html.inc.php index fd32b38..a9e6a94 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php | |||
| @@ -63,29 +63,42 @@ function plugin_header($host, $plugin) { | |||
| 63 | return printf("<h3><a href='%shost.php?h=%s&p=%s'>%s</a></h3>\n", $CONFIG['weburl'], $host, $plugin, $plugin); | 63 | return printf("<h3><a href='%shost.php?h=%s&p=%s'>%s</a></h3>\n", $CONFIG['weburl'], $host, $plugin, $plugin); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | function plugins_list($host, $overview_plugins, $other_plugins, $selected_plugins = array()) { | 66 | function plugins_list($host, $selected_plugins = array()) { |
| 67 | global $CONFIG; | 67 | global $CONFIG; |
| 68 | 68 | ||
| 69 | $plugins = collectd_plugins($host); | ||
| 70 | |||
| 69 | echo '<div class="plugins">'; | 71 | echo '<div class="plugins">'; |
| 70 | echo '<h3>Plugins</h3>'; | 72 | echo '<h3>Plugins</h3>'; |
| 71 | echo '<ul>'; | 73 | echo '<ul>'; |
| 72 | 74 | ||
| 73 | $selected = selected_overview($selected_plugins); | 75 | printf("<li><a %s href='%shost.php?h=%s'>overview</a></li>\n", |
| 74 | printf("<li><a %s href='%shost.php?h=%s'>%s</a></li>\n", $selected, $CONFIG['weburl'], $host, 'overview'); | 76 | selected_overview($selected_plugins), |
| 77 | $CONFIG['weburl'], | ||
| 78 | $host | ||
| 79 | ); | ||
| 75 | 80 | ||
| 76 | # first the ones defined as ordered | 81 | # first the ones defined as ordered |
| 77 | foreach($overview_plugins as $plugin) { | 82 | foreach($CONFIG['overview'] as $plugin) { |
| 78 | if (in_array($plugin, $other_plugins)) { | 83 | if (in_array($plugin, $plugins)) { |
| 79 | $selected = selected_plugin($plugin, $selected_plugins); | 84 | printf("<li><a %s href='%shost.php?h=%s&p=%s'>%4\$s</a></li>\n", |
| 80 | printf("<li><a %s href='%shost.php?h=%s&p=%s'>%s</a></li>\n", $selected, $CONFIG['weburl'], $host, $plugin, $plugin); | 85 | selected_plugin($plugin, $selected_plugins), |
| 86 | $CONFIG['weburl'], | ||
| 87 | $host, | ||
| 88 | $plugin | ||
| 89 | ); | ||
| 81 | } | 90 | } |
| 82 | } | 91 | } |
| 83 | 92 | ||
| 84 | # other plugins | 93 | # other plugins |
| 85 | foreach($other_plugins as $plugin) { | 94 | foreach($plugins as $plugin) { |
| 86 | if (!in_array($plugin, $overview_plugins)) { | 95 | if (!in_array($plugin, $CONFIG['overview'])) { |
| 87 | $selected = selected_plugin($plugin, $selected_plugins); | 96 | printf("<li><a %s href='%shost.php?h=%s&p=%s'>%4\$s</a></li>\n", |
| 88 | printf("<li><a %s href='%shost.php?h=%s&p=%s'>%s</a></li>\n", $selected, $CONFIG['weburl'], $host, $plugin, $plugin); | 97 | selected_plugin($plugin, $selected_plugins), |
| 98 | $CONFIG['weburl'], | ||
| 99 | $host, | ||
| 100 | $plugin | ||
| 101 | ); | ||
| 89 | } | 102 | } |
| 90 | } | 103 | } |
| 91 | 104 | ||
