Ejemplo n.º 1
0
function get_graph_preview_content () {
	global $colors;
	require_once(CACTI_BASE_PATH . "/include/auth/auth_constants.php");

	/* Make sure nothing is cached */
	header("Cache-Control: must-revalidate");
	header("Cache-Control: post-check=0, pre-check=0", false);
	header("Pragma: no-cache");
	header("Expires: ". gmdate("D, d M Y H:i:s", mktime(date("H"), date("i"), date("s"), date("m")-1, date("d"), date("Y")))." GMT");
	header("Last-Modified: ". gmdate("D, d M Y H:i:s")." GMT");

	$current_user = db_fetch_row("SELECT * FROM user_auth WHERE id=" . $_SESSION["sess_user_id"]);

	define("MAX_DISPLAY_PAGES", 21);

	/* ================= input validation ================= */
	input_validate_input_number(get_request_var("graphs"));
	input_validate_input_number(get_request_var_request("device_id"));
	input_validate_input_number(get_request_var_request("graph_template_id"));
	input_validate_input_number(get_request_var_request("page"));
	/* ==================================================== */

	/* clean up search string */
	if (isset($_REQUEST["filter"])) {
		$_REQUEST["filter"] = sanitize_search_string(get_request_var_request("filter"));
	}

	/* clean up search string */
	if (isset($_REQUEST["thumbnails"])) {
		$_REQUEST["thumbnails"] = sanitize_search_string(get_request_var_request("thumbnails"));
	}

	$sql_or = ""; $sql_where = ""; $sql_join = "";

	if ((read_config_option("auth_method") != 0) && (empty($current_user["show_preview"]))) {
		print "<strong><font size='+1' color='FF0000'>" . __("YOU DO NOT HAVE RIGHTS FOR PREVIEW VIEW") . "</font></strong>"; exit;
	}

	/* if the user pushed the 'clear' button */
	if (isset($_REQUEST["clear_filter"])) {
		kill_session_var("sess_graph_view_current_page");
		kill_session_var("sess_graph_view_filter");
		kill_session_var("sess_graph_view_graph_template");
		kill_session_var("sess_graph_view_device");
		kill_session_var("sess_graph_view_graphs");
		kill_session_var("sess_graph_view_thumbnails");
		kill_session_var("sess_graph_view_list_graph_list");
		kill_session_var("sess_graph_view_list_graph_add");
		kill_session_var("sess_graph_view_list_graph_remove");

		unset($_REQUEST["page"]);
		unset($_REQUEST["filter"]);
		unset($_REQUEST["device_id"]);
		unset($_REQUEST["graphs"]);
		unset($_REQUEST["thumbnails"]);
		unset($_REQUEST["graph_template_id"]);
		unset($_REQUEST["graph_list"]);
		unset($_REQUEST["graph_add"]);
		unset($_REQUEST["graph_remove"]);
	}

	/* save selected graphs into url, for backward compatibility */
	if (!empty($_REQUEST["graph_list"])) {
		foreach (explode(",",get_request_var_request("graph_list")) as $item) {
			$graph_list[$item] = 1;
		}
	}else{
		$graph_list = array();
	}

	load_current_session_value("device_id", "sess_graph_view_device", "0");
	load_current_session_value("graph_template_id", "sess_graph_view_graph_template", "0");
	load_current_session_value("filter", "sess_graph_view_filter", "");
	load_current_session_value("page", "sess_graph_view_current_page", "1");
	load_current_session_value("thumbnails", "sess_graph_view_thumbnails", CHECKED);
	load_current_session_value("graphs", "sess_graph_view_graphs", read_graph_config_option("preview_graphs_per_page"));
	load_current_session_value("graph_list", "sess_graph_view_list_graph_list", "");
	load_current_session_value("graph_add", "sess_graph_view_list_graph_add", "");
	load_current_session_value("graph_remove", "sess_graph_view_list_graph_remove", "");

	/* graph permissions */
	if (read_config_option("auth_method") != 0) {
		$sql_where = "where " . get_graph_permissions_sql($current_user["policy_graphs"], $current_user["policy_devices"], $current_user["policy_graph_templates"]);

		$sql_join = "left join device on (device.id=graph_local.device_id)
			left join graph_templates on (graph_templates.id=graph_local.graph_template_id)
			left join user_auth_perms on ((graph_templates_graph.local_graph_id=user_auth_perms.item_id and user_auth_perms.type=" . PERM_GRAPHS . " and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (device.id=user_auth_perms.item_id and user_auth_perms.type=" . PERM_DEVICES . " and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (graph_templates.id=user_auth_perms.item_id and user_auth_perms.type=" . PERM_GRAPH_TEMPLATES . " and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . "))";
	}else{
		$sql_where = "";
		$sql_join = "";
	}
	/* the user select a bunch of graphs of the 'list' view and wants them dsplayed here */
	if (isset($_REQUEST["list"])) {
		if (is_array(get_request_var_request("graph_list"))) {
			$graph_list = $_REQUEST["graph_list"];
		}

		if (!empty($_REQUEST["graph_add"])) {
			foreach (explode(",",get_request_var_request("graph_add")) as $item) {
				$graph_list[$item] = 1;
			}
		}
		/* remove items */
		if (!empty($_REQUEST["graph_remove"])) {
			foreach (explode(",",get_request_var_request("graph_remove")) as $item) {
				unset($graph_list[$item]);
			}
		}
		$_SESSION["sess_graph_view_list_graph_list"] = $graph_list;

		$i = 0;
		foreach ($graph_list as $item => $value) {
			$graph_array[$i] = $item;
			$i++;
		}

		if ((isset($graph_array)) && (sizeof($graph_array) > 0)) {
			/* build sql string including each graph the user checked */
			$sql_or = "AND " . array_to_sql_or($graph_array, "graph_templates_graph.local_graph_id");

			/* clear the filter vars so they don't affect our results */
			$_REQUEST["filter"]  = "";
			$_REQUEST["device_id"] = "0";

			/* Fix to avoid error in 'preview' after selection in 'list' : Notice: Undefined index: rra_id in C:\apache2\htdocs\cacti\graph_view.php on line 142 */
			$set_rra_id = empty($rra_id) ? read_graph_config_option("default_rra_id") : $_REQUEST["rra_id"];
		}
	}

	$sql_base = "FROM (graph_templates_graph,graph_local)
		$sql_join
		$sql_where
		" . (empty($sql_where) ? "WHERE" : "AND") . "   graph_templates_graph.local_graph_id > 0
		AND graph_templates_graph.local_graph_id=graph_local.id
		AND graph_templates_graph.title_cache like '%%" . get_request_var_request("filter") . "%%'
		" . (empty($_REQUEST["device_id"]) ? "" : " and graph_local.device_id=" . $_REQUEST["device_id"]) . "
		" . (empty($_REQUEST["graph_template_id"]) ? "" : " and graph_local.graph_template_id=" . $_REQUEST["graph_template_id"]) . "
		$sql_or";

	$total_rows = count(db_fetch_assoc("SELECT
		graph_templates_graph.local_graph_id
		$sql_base"));

	/* reset the page if you have changed some settings */
	if ($_REQUEST["graphs"] * ($_REQUEST["page"]-1) >= $total_rows) {
		$_REQUEST["page"] = "1";
	}

	$graphs = db_fetch_assoc("SELECT
		graph_templates_graph.local_graph_id,
		graph_templates_graph.title_cache,
		graph_templates_graph.image_format_id
		$sql_base
		GROUP BY graph_templates_graph.local_graph_id
		ORDER BY graph_templates_graph.title_cache
		LIMIT " . (get_request_var_request("graphs")*(get_request_var_request("page")-1)) . "," . get_request_var_request("graphs"));

	/* include graph view filter selector */
	graph_view_filter_table("preview");

	/* include time span selector */
	if (read_graph_config_option("timespan_sel") == CHECKED) {
		graph_view_timespan_selector("preview");
	}

	?>
	<script type='text/javascript'>
	<!--
	function pageChange(page) {
		strURL = '?action=ajax_preview&page=' + page;
		$.get("graph_view.php" + strURL, function (data) {
			$("#graph_content").html(data);
		});
	}
	//-->
	</script>
	<?php

	html_start_box("", "100", $colors["header"], "0", "center", "");

	print "<table cellpadding='0' cellspacing='0' style='width:100%;border:1px solid #BEBEBE;'>\n";
	/* generate page list */

	if ($total_rows > get_request_var_request("graphs")) {
		$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, $_REQUEST["graphs"], $total_rows, "pageChange");

		$nav = "\t\t\t<tr class='rowHeader'>
				<td colspan='11'>
					<table width='100%' cellspacing='0' cellpadding='0' border='0'>
						<tr>
							<td align='left' style='width:100px;' class='textHeaderDark'>";
		if ($_REQUEST["page"] > 1) { $nav .= "<strong><a class='linkOverDark' href='#' onClick='pageChange(" . ($_REQUEST["page"]-1) . ")'>&lt;&lt;&nbsp;" . __("Previous") . "</a></strong>"; }
		$nav .= "</td>\n
							<td align='center' class='textHeaderDark'>
								" . __("Showing Graphs") . ((get_request_var_request("graphs")*(get_request_var_request("page")-1))+1) . " " . __("to") . " " . ((($total_rows < get_request_var_request("graphs")) || ($total_rows < (get_request_var_request("graphs")*get_request_var_request("page")))) ? $total_rows : (get_request_var_request("graphs")*get_request_var_request("page"))) . " " . __("of") . " $total_rows [$url_page_select]
							</td>\n
							<td align='right' style='width:100px;' class='textHeaderDark'>";
		if (($_REQUEST["page"] * $_REQUEST["graphs"]) < $total_rows) { $nav .= "<strong><a class='linkOverDark' href='#' onClick='pageChange(" . ($_REQUEST["page"]+1) . ")'>" . __("Next") . "&gt;&gt;</a></strong>"; }
		$nav .= "</td>\n
						</tr>
					</table>
				</td>
			</tr>\n";
	}else{
		$nav = "<tr class='rowHeader'>
				<td colspan='11'>
					<table width='100%' cellspacing='0' cellpadding='0' border='0'>
						<tr>
							<td align='center' class='textHeaderDark'>
								" . __("Showing All Graphs") . (strlen(get_request_var_request("filter")) ? " [ " . __("Filter") . " '" . get_request_var_request("filter") . "' " . __("Applied") . " ]" : "") . "
							</td>
						</tr>
					</table>
				</td>
			</tr>\n";
	}

	print $nav;

	if (read_graph_config_option("thumbnail_section_preview") == CHECKED) {
		html_graph_thumbnail_area($graphs, "","graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end());
	}else{
		html_graph_area($graphs, "", "graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end());
	}

	print $nav;

	html_graph_end_box();
}
Ejemplo n.º 2
0
function get_graph_tree_content($tree_id, $leaf_id, $device_group_data) {
	global $current_user, $colors, $config, $graphs_per_page;

	include(CACTI_BASE_PATH . "/include/global_arrays.php");
	require(CACTI_BASE_PATH . "/include/graph_tree/graph_tree_arrays.php");
	include_once(CACTI_BASE_PATH . "/lib/data_query.php");
	include_once(CACTI_BASE_PATH . "/lib/tree.php");
	include_once(CACTI_BASE_PATH . "/lib/html_utility.php");
	include_once(CACTI_BASE_PATH . "/lib/graph/graph_view_form.php");
	define("MAX_DISPLAY_PAGES", 21);

	if (empty($tree_id)) { return; }

	$sql_where       = "";
	$sql_join        = "";
	$title           = "";
	$title_delimeter = "";
	$search_key      = "";

	$leaf      = db_fetch_row("SELECT order_key, title, device_id, device_grouping_type
					FROM graph_tree_items
					WHERE id=$leaf_id");

	$leaf_type = get_tree_item_type($leaf_id);

	/* get the "starting leaf" if the user clicked on a specific branch */
	if (!empty($leaf_id)) {
		$search_key = substr($leaf["order_key"], 0, (tree_tier($leaf["order_key"]) * CHARS_PER_TIER));
	}

	/* graph permissions */
	if (read_config_option("auth_method") != 0) {
		/* get policy information for the sql where clause */
		$sql_where = get_graph_permissions_sql($current_user["policy_graphs"], $current_user["policy_devices"], $current_user["policy_graph_templates"]);
		$sql_where = (empty($sql_where) ? "" : "AND $sql_where");
		$sql_join = "
			LEFT JOIN device ON (device.id=graph_local.device_id)
			LEFT JOIN graph_templates ON (graph_templates.id=graph_local.graph_template_id)
			LEFT JOIN user_auth_perms ON ((graph_templates_graph.local_graph_id=user_auth_perms.item_id AND user_auth_perms.type=1 AND user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (device.id=user_auth_perms.item_id and user_auth_perms.type=3 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (graph_templates.id=user_auth_perms.item_id AND user_auth_perms.type=4 AND user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . "))";
	}

	/* get information for the headers */
	if (!empty($tree_id)) { $tree_name = db_fetch_cell("SELECT name FROM graph_tree WHERE id=$tree_id"); }
	if (!empty($leaf_id)) { $leaf_name = $leaf["title"]; }
	if (!empty($leaf_id)) { $device_name = db_fetch_cell("SELECT device.description FROM (graph_tree_items,device) WHERE graph_tree_items.device_id=device.id AND graph_tree_items.id=$leaf_id"); }

	$device_group_data_array = $device_group_data;

	if ($device_group_data_array[0] == "gt") {
		$device_group_data_name = "Graph Template: " . db_fetch_cell("select name from graph_templates where id=" . $device_group_data_array[1]);
		$graph_template_id = $device_group_data_array[1];
	}elseif ($device_group_data_array[0] == "dq") {
		$device_group_data_name = "Graph Template: " . (empty($device_group_data_array[1]) ? "Non Query Based" : db_fetch_cell("select name from snmp_query where id=" . $device_group_data_array[1]));
		$data_query_id = $device_group_data_array[1];
	}elseif ($device_group_data_array[0] == "dqi") {
		$device_group_data_name = "Graph Template: " . (empty($device_group_data_array[1]) ? "Non Query Based" : db_fetch_cell("select name from snmp_query where id=" . $device_group_data_array[1])) . "-> " . (empty($device_group_data_array[2]) ? "Template Based" : get_formatted_data_query_index($leaf["device_id"], $device_group_data_array[1], $device_group_data_array[2]));
		$data_query_id = $device_group_data_array[1];
		$data_query_index = $device_group_data_array[2];
	}

	if (!empty($tree_name)) { $title .= $title_delimeter . "<strong>Tree:</strong> $tree_name"; $title_delimeter = "-> "; }
	if (!empty($leaf_name)) { $title .= $title_delimeter . "<strong.Leaf:</strong> $leaf_name"; $title_delimeter = "-> "; }
	if (!empty($device_name)) { $title .= $title_delimeter . "<strong>Host:</strong> $device_name"; $title_delimeter = "-> "; }
	if (!empty($device_group_data_name)) { $title .= $title_delimeter . " $device_group_data_name"; $title_delimeter = "-> "; }

	/* ================= input validation ================= */
	input_validate_input_number(get_request_var_request("graphs"));
	input_validate_input_number(get_request_var_request("page"));
	/* ==================================================== */

	/* if the user pushed the 'clear' button */
	if (isset($_REQUEST["clear_filter"])) {
		kill_session_var("sess_graph_view_graphs");
		kill_session_var("sess_graph_view_filter");
		kill_session_var("sess_graph_view_page");

		unset($_REQUEST["graphs"]);
		unset($_REQUEST["filter"]);
		unset($_REQUEST["page"]);

		$changed = true;
	}else{
		/* if any of the settings changed, reset the page number */
		$changed = 0;
		$changed += check_changed("graphs",          "sess_graph_view_graphs");
		$changed += check_changed("filter",          "sess_graph_view_filter");
		$changed += check_changed("action",          "sess_graph_view_action");
	}

	if (isset($_SESSION["sess_graph_view_tree_id"])) {
		if ($_SESSION["sess_graph_view_tree_id"] != $tree_id) {
			$changed += 1;
		}
	}
	$_SESSION["sess_graph_view_tree_id"] = $tree_id;

	if (isset($_SESSION["sess_graph_view_leaf_id"])) {
		if ($_SESSION["sess_graph_view_leaf_id"] != $leaf_id) {
			$changed += 1;
		}
	}
	$_SESSION["sess_graph_view_leaf_id"] = $leaf_id;

	if (isset($_SESSION["sess_graph_view_device_group_data"])) {
		if ($_SESSION["sess_graph_view_device_group_data"] != $device_group_data) {
			$changed += 1;
		}
	}
	$_SESSION["sess_graph_view_device_group_data"] = $device_group_data;

	if ($changed) {
		$_REQUEST["page"] = 1;
	}

	load_current_session_value("page",   "sess_graph_view_page",   "1");
	load_current_session_value("graphs", "sess_graph_view_graphs", read_graph_config_option("treeview_graphs_per_page"));
	load_current_session_value("filter", "sess_graph_view_filter", "");
	load_current_session_value("thumbnails", "sess_graph_view_thumbnails", (read_graph_config_option("thumbnail_section_tree_2") == CHECKED ? "true":""));

	$graph_list = array();

	if (($leaf_type == "header") || (empty($leaf_id))) {
		if (strlen(get_request_var_request("filter"))) {
			$sql_where = "AND (title_cache LIKE '%" . $_REQUEST["filter"] . "%' OR graph_templates_graph.title LIKE '%" . $_REQUEST["filter"] . "%')";
		}

		$graph_list = db_fetch_assoc("SELECT
			graph_tree_items.id,
			graph_tree_items.title,
			graph_tree_items.local_graph_id,
			graph_tree_items.rra_id,
			graph_tree_items.order_key,
			graph_templates_graph.height,
			graph_templates_graph.title_cache as title_cache,
			graph_templates_graph.image_format_id
			FROM (graph_tree_items,graph_local)
			LEFT JOIN graph_templates_graph ON (graph_tree_items.local_graph_id=graph_templates_graph.local_graph_id AND graph_tree_items.local_graph_id>0)
			$sql_join
			WHERE graph_tree_items.graph_tree_id=$tree_id
			AND graph_local.id=graph_templates_graph.local_graph_id
			AND graph_tree_items.order_key like '$search_key" . str_repeat('_', CHARS_PER_TIER) . str_repeat('0', (MAX_TREE_DEPTH * CHARS_PER_TIER) - (strlen($search_key) + CHARS_PER_TIER)) . "'
			AND graph_tree_items.local_graph_id>0
			$sql_where
			GROUP BY graph_tree_items.id
			ORDER BY graph_tree_items.order_key");
	}elseif ($leaf_type == "device") {
		/* graph template grouping */
		if ($leaf["device_grouping_type"] == TREE_DEVICE_GROUPING_GRAPH_TEMPLATE) {
			$graph_templates = db_fetch_assoc("SELECT
				graph_templates.id,
				graph_templates.name
				FROM (graph_local,graph_templates,graph_templates_graph)
				WHERE graph_local.id=graph_templates_graph.local_graph_id
				AND graph_templates_graph.graph_template_id=graph_templates.id
				AND graph_local.device_id=" . $leaf["device_id"] . "
				" . (empty($graph_template_id) ? "" : "AND graph_templates.id=$graph_template_id") . "
				GROUP BY graph_templates.id
				ORDER BY graph_templates.name");

			/* for graphs without a template */
			array_push($graph_templates, array(
				"id" => "0",
				"name" => "(No Graph Template)"
				));

			if (sizeof($graph_templates) > 0) {
				foreach ($graph_templates as $graph_template) {
					if (strlen(get_request_var_request("filter"))) {
						$sql_where = "AND (title_cache LIKE '%" . $_REQUEST["filter"] . "%')";
					}

					$graphs = db_fetch_assoc("SELECT
						graph_templates_graph.title_cache,
						graph_templates_graph.local_graph_id,
						graph_templates_graph.height,
						graph_templates_graph.image_format_id
						FROM (graph_local,graph_templates_graph)
						$sql_join
						WHERE graph_local.id=graph_templates_graph.local_graph_id
						AND graph_local.graph_template_id=" . $graph_template["id"] . "
						AND graph_local.device_id=" . $leaf["device_id"] . "
						$sql_where
						ORDER BY graph_templates_graph.title_cache");

					/* let's sort the graphs naturally */
					if (sizeof($graphs)) {
						usort($graphs, 'naturally_sort_graphs');

						foreach ($graphs as $graph) {
							$graph["graph_template_name"] = $graph_template["name"];
							array_push($graph_list, $graph);
						}
					}
				}
			}
			/* data query index grouping */
		}elseif ($leaf["device_grouping_type"] == TREE_DEVICE_GROUPING_DATA_QUERY_INDEX) {
			$data_queries = db_fetch_assoc("SELECT
				snmp_query.id,
				snmp_query.name
				FROM (graph_local,snmp_query)
				WHERE graph_local.snmp_query_id=snmp_query.id
				AND graph_local.device_id=" . $leaf["device_id"] . "
				" . (!isset($data_query_id) ? "" : "and snmp_query.id=$data_query_id") . "
				GROUP BY snmp_query.id
				ORDER BY snmp_query.name");

			/* for graphs without a data query */
			if (empty($data_query_id)) {
				array_push($data_queries, array(
					"id" => "0",
					"name" => "Non Query Based"
					));
			}

			if (sizeof($data_queries) > 0) {
				foreach ($data_queries as $data_query) {
					/* fetch a list of field names that are sorted by the preferred sort field */
					$sort_field_data = get_formatted_data_query_indexes($leaf["device_id"], $data_query["id"]);

					if (strlen(get_request_var_request("filter"))) {
						$sql_where = "AND (title_cache LIKE '%" . $_REQUEST["filter"] . "%')";
					}

					/* grab a list of all graphs for this device/data query combination */
					$graphs = db_fetch_assoc("SELECT
						graph_templates_graph.title_cache,
						graph_templates_graph.local_graph_id,
						graph_templates_graph.height,
						graph_templates_graph.image_format_id,
						graph_local.snmp_index
						FROM (graph_local, graph_templates_graph)
						$sql_join
						WHERE graph_local.id=graph_templates_graph.local_graph_id
						AND graph_local.snmp_query_id=" . $data_query["id"] . "
						AND graph_local.device_id=" . $leaf["device_id"] . "
						" . (empty($data_query_index) ? "" : "and graph_local.snmp_index='$data_query_index'") . "
						$sql_where
						GROUP BY graph_templates_graph.local_graph_id
						ORDER BY graph_templates_graph.title_cache");

					/* re-key the results on data query index */
					if (sizeof($graphs)) {
						/* let's sort the graphs naturally */
						usort($graphs, 'naturally_sort_graphs');

						foreach ($graphs as $graph) {
							$snmp_index_to_graph{$graph["snmp_index"]} = array(
								"local_graph_id"	=> $graph["local_graph_id"],
								"title_cache"		=> $graph["title_cache"],
								"image_format_id"	=> $graph["image_format_id"],
							);
							$graphs_height[$graph["local_graph_id"]] = $graph["height"];
						}
					}

					/* using the sorted data as they key; grab each snmp index from the master list */
					while (list($snmp_index, $sort_field_value) = each($sort_field_data)) {
						/* render each graph for the current data query index */
						if (isset($snmp_index_to_graph[$snmp_index])) {
							#while (list($local_graph_id, $graph_title) = each($snmp_index_to_graph[$snmp_index])) {
							foreach ($snmp_index_to_graph as $graph) {
								/* reformat the array so it's compatable with the html_graph* area functions */
								array_push($graph_list, array(
									"data_query_name"   => $data_query["name"],
									"sort_field_value" 	=> $sort_field_value,
									"local_graph_id"    => $graph["local_graph_id"],
									"title_cache"       => $graph["title_cache"],
									"image_format_id"   => $graph["image_format_id"],
									"height"            => $graphs_height[$graph["local_graph_id"]]
								));
							}
						}
					}
				}
			}
		}
	}

	$total_rows = sizeof($graph_list);

	if (read_graph_config_option("timespan_sel") == CHECKED) {
		graph_view_timespan_selector();
	}

	graph_view_search_filter();

	?>
	<script type='text/javascript'>
	<!--
	function pageChange(page) {
		strURL = '?action=ajax_tree_graphs&page=' + page;
		$.get("graph_view.php" + strURL, function (data) {
			$("#graphs").html(data);
		});
	}
	-->
	</script>
	<?php

	print "<table cellpadding='0' cellspacing='0' style='width:100%;border:1px solid #BEBEBE;'>\n";
	/* generate page list */
	if ($total_rows > get_request_var_request("graphs")) {
		$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, $_REQUEST["graphs"], $total_rows, "pageChange");

		$nav = "\t\t\t<tr class='rowHeader'>
				<td colspan='11'>
					<table width='100%' cellspacing='0' cellpadding='0' border='0'>
						<tr>
							<td align='left' style='width:100px;' class='textHeaderDark'>";
		if ($_REQUEST["page"] > 1) { $nav .= "<strong><a class='linkOverDark' href='#' onClick='pageChange(" . ($_REQUEST["page"]-1) . ")'>&lt;&lt;&nbsp;" . __("Previous") . "</a></strong>"; }
		$nav .= "</td>\n
							<td align='center' class='textHeaderDark'>
								" . __("Showing Graphs") . " " . ((get_request_var_request("graphs")*(get_request_var_request("page")-1))+1) . " " . __("to") . " " . ((($total_rows < read_graph_config_option("treeview_graphs_per_page")) || ($total_rows < (get_request_var_request("graphs")*get_request_var_request("page")))) ? $total_rows : (get_request_var_request("graphs")*get_request_var_request("page"))) . " " . __("of") . " $total_rows [$url_page_select]
							</td>\n
							<td align='right' style='width:100px;' class='textHeaderDark'>";
		if (($_REQUEST["page"] * $_REQUEST["graphs"]) < $total_rows) { $nav .= "<strong><a class='linkOverDark' href='#' onClick='pageChange(" . ($_REQUEST["page"]+1) . ")'>". __("Next") . " &gt;&gt;</a></strong>"; }
		$nav .= "</td>\n
						</tr>
					</table>
				</td>
			</tr>\n";
	}else{
		$nav = "<tr class='rowHeader'>
				<td colspan='11'>
					<table width='100%' cellspacing='0' cellpadding='0' border='0'>
						<tr>
							<td align='center' class='textHeaderDark'>
								" . __("Showing All Graphs") . (strlen(get_request_var_request("filter")) ? " [ " . __("Filter") . " '" . get_request_var_request("filter") . "' ". __("Applied") . " ]" : "") . "
							</td>
						</tr>
					</table>
				</td>
			</tr>\n";
	}

	print $nav;

	/* start graph display */
	print "\t\t\t<tr class='rowSubHeaderAlt'><td width='390' colspan='10' class='textHeaderLight'>$title</td></tr>";

	$i = $_REQUEST["graphs"] * ($_REQUEST["page"] - 1);
	$last_graph = $i + $_REQUEST["graphs"];

	$new_graph_list = array();
	while ($i < $total_rows && $i < $last_graph) {
		$new_graph_list[] = $graph_list[$i];
		$i++;
	}

	if (get_request_var_request("thumbnails") == "true") {
		html_graph_thumbnail_area($new_graph_list, "", "view_type=tree&graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end());
	}else{
		html_graph_area($new_graph_list, "", "view_type=tree&graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end());
	}

	print $nav;

	print "</table>\n";
}