[A-Za-z0-9]+)_(?P.+)/', $vars['type'], $graphtype); $type = basename($graphtype['type']); $subtype = basename($graphtype['subtype']); $id = $vars['id']; if (is_numeric($vars['device'])) { $device = device_by_id_cache($vars['device']); } elseif (!empty($vars['device'])) { $device = device_by_name($vars['device']); } if (is_file("includes/html/graphs/".$type."/auth.inc.php")) { require "includes/html/graphs/".$type."/auth.inc.php"; } if (!$auth) { require 'includes/html/error-no-perm.inc.php'; } else { if (Config::has("graph_types.$type.$subtype.descr")) { $title .= " :: " . Config::get("graph_types.$type.$subtype.descr"); } elseif ($type == "device" && $subtype == "collectd") { $title .= " :: " . nicecase($subtype) . " :: " . $vars['c_plugin']; if (isset($vars['c_plugin_instance'])) { $title .= " - " . $vars['c_plugin_instance']; } $title .= " - " . $vars['c_type']; if (isset($vars['c_type_instance'])) { $title .= " - " . $vars['c_type_instance']; } } else { $title .= " :: " . nicecase($subtype); } $graph_array = $vars; $graph_array['height'] = "60"; $graph_array['width'] = $thumb_width; $graph_array['legend'] = "no"; $graph_array['to'] = Config::get('time.now'); print_optionbar_start(); echo $title; // FIXME allow switching between types for sensor and wireless also restrict types to ones that have data if ($type != 'sensor') { echo '
'; echo csrf_field(); echo "
'; } print_optionbar_end(); $thumb_array = Config::get('graphs.row.normal'); echo ''; foreach ($thumb_array as $period => $text) { $graph_array['from'] = Config::get("time.$period"); $link_array = $vars; $link_array['from'] = $graph_array['from']; $link_array['to'] = $graph_array['to']; $link_array['page'] = "graphs"; $link = generate_url($link_array); echo(''); } echo('
'); echo(''.$text.'
'); echo(''); echo generate_lazy_graph_tag($graph_array); echo(''); echo('
'); $graph_array = $vars; $graph_array['height'] = Config::get('webui.min_graph_height'); $graph_array['width'] = $graph_width; if ($screen_width = Session::get('screen_width')) { if ($screen_width > 800) { $graph_array['width'] = ($screen_width - ($screen_width /10)); } else { $graph_array['width'] = ($screen_width - ($screen_width /4)); } } if ($screen_height = Session::get('screen_height')) { if ($screen_height > 960) { $graph_array['height'] = ($screen_height - ($screen_height /2)); } else { $graph_array['height'] = max($graph_array['height'], ($screen_height - ($screen_height /1.5))); } } echo("
"); include_once 'includes/html/print-date-selector.inc.php'; echo ('
'); echo('
'); if ($vars['legend'] == "no") { echo(generate_link("Show Legend", $vars, array('page' => "graphs", 'legend' => null))); } else { echo(generate_link("Hide Legend", $vars, array('page' => "graphs", 'legend' => "no"))); } // FIXME : do this properly # if ($type == "port" && $subtype == "bits") # { echo(' | '); if ($vars['previous'] == "yes") { echo(generate_link("Hide Previous", $vars, array('page' => "graphs", 'previous' => null))); } else { echo(generate_link("Show Previous", $vars, array('page' => "graphs", 'previous' => "yes"))); } # } echo(' | '); if ($vars['showcommand'] == "yes") { echo(generate_link("Hide RRD Command", $vars, array('page' => "graphs", 'showcommand' => null))); } else { echo(generate_link("Show RRD Command", $vars, array('page' => "graphs", 'showcommand' => "yes"))); } if ($vars['type'] == 'port_bits') { echo ' | To show trend, set to future date'; } echo('
'); echo generate_graph_js_state($graph_array); echo('
'); if (Config::get('webui.dynamic_graphs', false) === true) { echo generate_dynamic_graph_js($graph_array); echo generate_dynamic_graph_tag($graph_array); } else { echo generate_lazy_graph_tag($graph_array); } echo("
"); if (Config::has('graph_descr.' . $vars['type'])) { print_optionbar_start(); echo('
'); echo(Config::get('graph_descr.' . $vars['type'])); print_optionbar_end(); } if ($vars['showcommand']) { $_GET = $graph_array; $command_only = 1; require 'includes/html/graphs/graph.inc.php'; } }