cellspacing=0 border=0 bgcolor="#" width="100%"> tag after ending the box */ function html_end_box($trailing_br = true) { ?>
">Add 
"; } ?> tag before the start of the table */ function html_graph_start_box($cellpadding = 3, $leading_br = true) { if ($leading_br == true) { print "
\n"; } print "\n"; } /* html_graph_end_box - draws the end of an HTML graph view box */ function html_graph_end_box() { print "
"; } /* html_graph_area - draws an area the contains full sized graphs @arg $graph_array - the array to contains graph information. for each graph in the array, the following two keys must exist $arr[0]["local_graph_id"] // graph id $arr[0]["title_cache"] // graph title @arg $no_graphs_message - display this message if no graphs are found in $graph_array @arg $extra_url_args - extra arguments to append to the url @arg $header - html to use as a header */ function html_graph_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") { $i = 0; if (sizeof($graph_array) > 0) { if ($header != "") { print $header; } foreach ($graph_array as $graph) { ?>
<?php print $graph["title_cache"];?> Zoom Graph
$no_graphs_message"; } } } /* html_graph_thumbnail_area - draws an area the contains thumbnail sized graphs @arg $graph_array - the array to contains graph information. for each graph in the array, the following two keys must exist $arr[0]["local_graph_id"] // graph id $arr[0]["title_cache"] // graph title @arg $no_graphs_message - display this message if no graphs are found in $graph_array @arg $extra_url_args - extra arguments to append to the url @arg $header - html to use as a header */ function html_graph_thumbnail_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") { $i = 0; $k = 0; if (sizeof($graph_array) > 0) { if ($header != "") { print $header; } print ""; foreach ($graph_array as $graph) { ?>
<?php print $graph["title_cache"];?> Zoom Graph
"; } } print ""; }else{ if ($no_graphs_message != "") { print "$no_graphs_message"; } } } /* html_nav_bar - draws a navigation bar which includes previous/next links as well as current page information @arg $background_color - the background color of this navigation bar row @arg $colspan - the colspan for the entire row @arg $current_page - the current page in the navigation system @arg $rows_per_page - the number of rows that are displayed on a single page @arg $total_rows - the total number of rows in the navigation system @arg $nav_url - the url to use when presenting users with previous/next links. the variable will be substituted with the correct page number if included */ function html_nav_bar($background_color, $colspan, $current_page, $rows_per_page, $total_rows, $nav_url) { ?>
<< 1) { print ""; } print "Previous"; if ($current_page > 1) { print ""; } ?> Showing Rows to of ", ($current_page+1), $nav_url) . "'>"; } print "Next"; if (($current_page * $rows_per_page) < $total_rows) { print ""; } ?> >>
\n"; for ($i=0; $i" . $header_items[$i] . "\n"; } print "\n"; } /* html_header_checkbox - draws a header row with a 'select all' checkbox in the last cell suitable for display inside of a box element @arg $header_items - an array containing a list of items to be included in the header @arg $form_action - the url to post the 'select all' form to */ function html_header_checkbox($header_items, $form_action = "") { global $colors; /* default to the 'current' file */ if ($form_action == "") { $form_action = basename($_SERVER["PHP_SELF"]); } print "\n"; for ($i=0; $i" . $header_items[$i] . "\n"; } print "\n
\n"; print "\n"; } /* create_list - draws the items for an html dropdown given an array of data @arg $form_data - an array containing data for this dropdown. it can be formatted in one of two ways: $array["id"] = "value"; -- or -- $array[0]["id"] = 43; $array[0]["name"] = "Red"; @arg $column_display - used to indentify the key to be used for display data. this is only applicable if the array is formatted using the second method above @arg $column_id - used to indentify the key to be used for id data. this is only applicable if the array is formatted using the second method above @arg $form_previous_value - the current value of this form element */ function html_create_list($form_data, $column_display, $column_id, $form_previous_value) { if (empty($column_display)) { foreach (array_keys($form_data) as $id) { print '\n"; } }else{ if (sizeof($form_data) > 0) { foreach ($form_data as $row) { print "\n"; }else{ print ">" . title_trim(null_out_substitutions($row[$column_display]), 75) . "\n"; } } } } } /* draw_graph_items_list - draws a nicely formatted list of graph items for display on an edit form @arg $item_list - an array representing the list of graph items. this array should come directly from the output of db_fetch_assoc() @arg $filename - the filename to use when referencing any external url @arg $url_data - any extra GET url information to pass on when referencing any external url @arg $disable_controls - whether to hide all edit/delete functionality on this form */ function draw_graph_items_list($item_list, $filename, $url_data, $disable_controls) { global $colors, $config; include($config["include_path"] . "/config_arrays.php"); print ""; DrawMatrixHeaderItem("Graph Item",$colors["header_text"],1); DrawMatrixHeaderItem("Data Source",$colors["header_text"],1); DrawMatrixHeaderItem("Graph Item Type",$colors["header_text"],1); DrawMatrixHeaderItem("CF Type",$colors["header_text"],1); DrawMatrixHeaderItem("Item Color",$colors["header_text"],4); print ""; $group_counter = 0; $_graph_type_name = ""; $i = 0; $alternate_color_1 = $colors["alternate"]; $alternate_color_2 = $colors["alternate"]; if (sizeof($item_list) > 0) { foreach ($item_list as $item) { /* graph grouping display logic */ $this_row_style = ""; $use_custom_row_color = false; $hard_return = ""; if ($graph_item_types{$item["graph_type_id"]} != "GPRINT") { $this_row_style = "font-weight: bold;"; $use_custom_row_color = true; if ($group_counter % 2 == 0) { $alternate_color_1 = "EEEEEE"; $alternate_color_2 = "EEEEEE"; $custom_row_color = "D5D5D5"; }else{ $alternate_color_1 = $colors["alternate"]; $alternate_color_2 = $colors["alternate"]; $custom_row_color = "D2D6E7"; } $group_counter++; } $_graph_type_name = $graph_item_types{$item["graph_type_id"]}; /* alternating row color */ if ($use_custom_row_color == false) { form_alternate_row_color($alternate_color_1,$alternate_color_2,$i); }else{ print ""; } print ""; if ($disable_controls == false) { print ""; } print "Item # " . ($i+1) . ""; if ($disable_controls == false) { print ""; } print "\n"; if (empty($item["data_source_name"])) { $item["data_source_name"] = "No Task"; } switch (true) { case ereg("(AREA|STACK|GPRINT|LINE[123])", $_graph_type_name): $matrix_title = "(" . $item["data_source_name"] . "): " . $item["text_format"]; break; case ereg("(HRULE|VRULE)", $_graph_type_name): $matrix_title = "HRULE: " . $item["value"]; break; case ereg("(COMMENT)", $_graph_type_name): $matrix_title = "COMMENT: " . $item["text_format"]; break; } if ($item["hard_return"] == "on") { $hard_return = "<HR>"; } print "" . htmlspecialchars($matrix_title) . $hard_return . "\n"; print "" . $graph_item_types{$item["graph_type_id"]} . "\n"; print "" . $consolidation_functions{$item["consolidation_function_id"]} . "\n"; print " \n"; print "" . $item["hex"] . "\n"; if ($disable_controls == false) { print "Move Down Move Up\n"; print "Delete\n"; } print ""; $i++; } }else{ print "No Items"; } } /* draw_menu - draws the cacti menu for display in the console */ function draw_menu() { global $colors, $config, $user_auth_realms, $user_auth_realm_filenames; include($config["include_path"] . "/config_arrays.php"); /* list all realms that this user has access to */ if (read_config_option("global_auth") == "on") { $user_realms = db_fetch_assoc("select realm_id from user_auth_realm where user_id=" . $_SESSION["sess_user_id"]); $user_realms = array_rekey($user_realms, "realm_id", "realm_id"); }else{ $user_realms = $user_auth_realms; } print "\n"; /* loop through each header */ while (list($header_name, $header_array) = each($menu)) { /* pass 1: see if we are allowed to view any children */ $show_header_items = false; while (list($item_url, $item_title) = each($header_array)) { $current_realm_id = (isset($user_auth_realm_filenames{basename($item_url)}) ? $user_auth_realm_filenames{basename($item_url)} : 0); if ((isset($user_realms[$current_realm_id])) || (!isset($user_auth_realm_filenames{basename($item_url)}))) { $show_header_items = true; } } reset($header_array); if ($show_header_items == true) { print "\n"; } /* pass 2: loop through each top level item and render it */ while (list($item_url, $item_title) = each($header_array)) { $current_realm_id = (isset($user_auth_realm_filenames{basename($item_url)}) ? $user_auth_realm_filenames{basename($item_url)} : 0); /* if this item is an array, then it contains sub-items. if not, is just the title string and needs to be displayed */ if (is_array($item_title)) { $i = 0; if ((isset($user_realms[$current_realm_id])) || (!isset($user_auth_realm_filenames{basename($item_url)}))) { /* if the current page exists in the sub-items array, draw each sub-item */ if (array_key_exists(basename($_SERVER["PHP_SELF"]), $item_title) == true) { $draw_sub_items = true; }else{ $draw_sub_items = false; } while (list($item_sub_url, $item_sub_title) = each($item_title)) { /* indent sub-items */ if ($i > 0) { $prepend_string = "--- "; }else{ $prepend_string = ""; } /* do not put a line between each sub-item */ if (($i == 0) || ($draw_sub_items == false)) { $background = "images/menu_line.gif"; }else{ $background = ""; } /* draw all of the sub-items as selected for ui grouping reasons. we can use the 'bold' or 'not bold' to distinguish which sub-item is actually selected */ if ((basename($_SERVER["PHP_SELF"]) == basename($item_sub_url)) || ($draw_sub_items)) { $td_class = "textMenuItemSelected"; }else{ $td_class = "textMenuItem"; } /* always draw the first item (parent), only draw the children if we are viewing a page that is contained in the sub-items array */ if (($i == 0) || ($draw_sub_items)) { if (basename($_SERVER["PHP_SELF"]) == basename($item_sub_url)) { print "\n"; }else{ print "\n"; } } $i++; } } }else{ if ((isset($user_realms[$current_realm_id])) || (!isset($user_auth_realm_filenames{basename($item_url)}))) { /* draw normal (non sub-item) menu item */ if (basename($_SERVER["PHP_SELF"]) == basename($item_url)) { print "\n"; }else{ print "\n"; } } } } } print "\n"; print '
$header_name
$prepend_string$item_sub_title
$prepend_string$item_sub_title
$item_title
$item_title
'; } /* draw_actions_dropdown - draws a table the allows the user to select an action to perform on one or more data elements @arg $actions_array - an array that contains a list of possible actions. this array should be compatible with the form_dropdown() function */ function draw_actions_dropdown($actions_array) { ?>
  Choose an action: