?> </td> <td width="1"> <input type="text" name="filter" size="20" value="<?php print $_REQUEST["filter"]; ?> "> </td> <td> <input type="image" src="<?php print html_get_theme_images_path('button_go.gif'); ?> " alt="<?php echo _('Go'); ?> " border="0" align="absmiddle"> <input type="image" src="<?php print html_get_theme_images_path('button_clear.gif'); ?> " name="clear" alt="<?php echo _('Clear'); ?> " border="0" align="absmiddle"> </td> </tr> </table> </td> <input type='hidden' name='page' value='1'> </form> </tr>
function form_save_button($cancel_url, $button_name = "", $force_type = "") { global $colors; if (empty($force_type)) { if (!isset($_GET["id"])) { $img = "button_create.gif"; $alt = "Create"; }else{ $img = "button_save.gif"; $alt = "Save"; } }elseif ($force_type == "save") { $img = "button_save.gif"; $alt = "Save"; }elseif ($force_type == "create") { $img = "button_create.gif"; $alt = "Create"; } ?> <table align='center' width='98%' cellpadding="3"> <tr> <td style="border: 1px solid gray; background-color: #ffffff;" align="right"> <a href='<?php echo $cancel_url;?>'><img src='<?php echo html_get_theme_images_path("button_cancel2.gif");?>' alt='<?php echo _("Cancel");?>' align='absmiddle' border='0'></a> <input type='image'<?php echo ($button_name == "" ? "" : " name='$button_name'");?> src='<?php echo html_get_theme_images_path($img);?>' alt='<?php echo $alt;?>' align='absmiddle'> </td> </tr> </table> <input type='hidden' name='action' value='save'> </form> <?php }
function draw_actions_dropdown($actions_array, $padding = 6, $percent_width = 98, $action_variable = true) { ?> <table align='center' width='<?php echo $percent_width;?>%' cellspacing="0" cellpadding="0"> <tr> <td width='1' valign='middle' style='padding: <?php echo $padding;?>px;'> <img src='<?php print html_get_theme_images_path("arrow.gif");?>' alt='' align='absmiddle'> </td> <td align='right'> Choose an action: <?php form_dropdown("drp_action",$actions_array,"","","1","","");?> </td> <td width='1' align='right' style='padding: <?php echo $padding;?>px;'> <input type='image' src='<?php print html_get_theme_images_path("button_go.gif");?>' name='action_button' alt='Go'> </td> </tr> </table> <?php if ($action_variable == true) { echo "<input type='hidden' name='action' value='actions'>\n"; } }
function graphs() { global $colors; /* use the first host in the list as the default */ if (!isset($_SESSION["sess_graphs_new_host_id"]) && empty($_REQUEST["host_id"])) { $_REQUEST["host_id"] = db_fetch_cell("select id from host order by description,hostname limit 1"); } /* remember these search fields in session vars so we don't have to keep passing them around */ if (isset($_REQUEST["host_id"])) { $_SESSION["sess_graphs_new_host_id"] = $_REQUEST["host_id"]; } else { $_REQUEST["host_id"] = $_SESSION["sess_graphs_new_host_id"]; } $host = db_fetch_row("select id,description,hostname,host_template_id from host where id=" . $_REQUEST["host_id"]); ?> <table width="98%" align="center"> <form name="form_graph_id"> <tr> <td class="textInfo" colspan="2"> <?php print $host["description"]; ?> (<?php print $host["hostname"]; ?> ) </td> <td align="right" class="textInfo" style="color: #aaaaaa;"> <?php if (!empty($host["host_template_id"])) { print db_fetch_cell("select name from host_template where id=" . $host["host_template_id"]); } ?> </td> </tr> <tr> <td> </td> </tr> <tr> <td class="textArea" style="padding: 3px;" width="300" nowrap> <?php echo _("Create new graphs for the following host:"); ?> </td> <td class="textInfo" rowspan="2" valign="top"> <span style="color: #c16921;">*</span><a href="devices.php?action=edit&id=<?php print $_REQUEST["host_id"]; ?> "><?php echo _("Edit this Host"); ?> </a><br> <span style="color: #c16921;">*</span><a href="devices.php?action=edit"><?php echo _("Create New Host"); ?> </a> </td> </tr> <td> <select name="cbo_graph_id" onChange="window.location=document.form_graph_id.cbo_graph_id.options[document.form_graph_id.cbo_graph_id.selectedIndex].value"> <?php $hosts = db_fetch_assoc("select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname"); if (sizeof($hosts) > 0) { foreach ($hosts as $item) { print "<option value='graphs_new.php?host_id=" . $item["id"] . "'"; if ($_REQUEST["host_id"] == $item["id"]) { print " selected"; } print ">" . $item["name"] . "</option>\n"; } } ?> </select> </td> </tr> </form> </table> <br> <form name="chk" method="post" action="graphs_new.php"> <?php $total_rows = sizeof(db_fetch_assoc("select graph_template_id from host_graph where host_id=" . $_REQUEST["host_id"])); /* we give users the option to turn off the javascript features for data queries with lots of rows */ if (read_config_option("max_data_query_javascript_rows") >= $total_rows) { $use_javascript = true; } else { $use_javascript = false; } /* ==================== Box: Graph Templates ==================== */ html_start_box("<strong>" . _("Graph Templates") . "</strong>", "98%", $colors["header_background"], "3", "center", ""); print "\t<tr bgcolor='#" . $colors["header_panel"] . "'>\n\t\t\t<td class='textSubHeaderDark'>" . _("Name") . "</td>\n\t\t\t<td width='1%' align='center' bgcolor='#819bc0' style='" . get_checkbox_style() . "'><input type='checkbox' style='margin: 0px;' name='all_cg' title='" . _("Select All") . "' onClick='SelectAll(\"cg\",this.checked);gt_update_selection_indicators();'></td>\n\n\t\t</tr>\n"; $ht_graph_templates = db_fetch_assoc("select\n\t\tgraph_template.id,\n\t\tgraph_template.template_name\n\t\tfrom host_graph,graph_template\n\t\twhere host_graph.graph_template_id=graph_template.id\n\t\tand host_graph.host_id = " . $_REQUEST["host_id"] . "\n\t\torder by graph_template.template_name"); $ht_created_graph_templates = db_fetch_assoc("select\n\t\tgraph.graph_template_id\n\t\tfrom graph,host_graph\n\t\twhere graph.graph_template_id=host_graph.graph_template_id\n\t\tand graph.host_id = " . $host["id"] . "\n\t\tgroup by graph.graph_template_id"); print "<script type='text/javascript'>\nvar gt_created_graphs = new Array()\n</script>\n"; if (sizeof($ht_created_graph_templates) > 0 && $use_javascript == true) { print "<script type='text/javascript'>\n<!--\n"; print "var gt_created_graphs = new Array("; $cg_ctr = 0; foreach ($ht_created_graph_templates as $item) { print ($cg_ctr > 0 ? "," : "") . "'" . $item["graph_template_id"] . "'"; $cg_ctr++; } print ")\n"; print "//-->\n</script>\n"; } /* create a row for each graph template associated with the host template */ $i = 0; if (sizeof($ht_graph_templates) > 0) { foreach ($ht_graph_templates as $item) { $query_row = $item["id"]; print "<tr id='gt_line{$query_row}' bgcolor='#" . ($i % 2 == 0 ? $colors["form_alternate1"] : $colors["form_alternate2"]) . "'>"; $i++; print "\t\t<td" . ($use_javascript == true ? " onClick='gt_select_line(" . $item["id"] . ");'" : "") . "><span id='gt_text{$query_row}" . "_0'>\n\t\t\t\t\t\t<span id='gt_text{$query_row}" . "_0'><strong>" . _("Create:") . "</strong> " . $item["template_name"] . "</span>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td align='right'>\n\t\t\t\t\t\t<input type='checkbox' name='cg_{$query_row}' id='cg_{$query_row}'" . ($use_javascript == true ? " onClick='gt_update_selection_indicators();'" : "") . ">\n\t\t\t\t\t</td>\n\t\t\t\t</tr>"; } } else { print "<tr><td bgcolor='#" . $colors["form_alternate1"] . "' colspan=7><em>" . _("No graph templates specified for this host template.") . "</em></td></tr>"; } if ($use_javascript == true) { print "<script type='text/javascript'>gt_update_deps(1);</script>\n"; } $available_graph_templates = db_fetch_assoc("SELECT\n\t\tgraph_template.id,\n\t\tgraph_template.template_name as name\n\t\tFROM snmp_query_graph RIGHT JOIN graph_template\n\t\tON (snmp_query_graph.graph_template_id = graph_template.id)\n\t\tWHERE (((snmp_query_graph.name) Is Null))\n\t\tORDER BY graph_template.template_name"); /* create a row at the bottom that lets the user create any graph they choose */ print "\t<tr bgcolor='#" . ($i % 2 == 0 ? $colors["form_alternate1"] : $colors["form_alternate2"]) . "'>\n\t\t\t<td colspan='2' width='60' nowrap>\n\t\t\t\t<strong>Create:</strong> "; form_dropdown("cg_g", $available_graph_templates, "name", "id", "", "(" . _("Select a graph type to create") . ")", "", "font-size: 10px;"); print "\t\t</td>\n\t\t</tr>"; html_end_box(); /* get a list of all data queries that are assigned to this device */ $data_queries = api_data_query_device_assigned_list($host["id"]); echo "<script type='text/javascript'>\nvar created_graphs = new Array()\n</script>\n"; if (sizeof($data_queries) > 0) { foreach ($data_queries as $data_query) { /* we give users the option to turn off the javascript features for data queries with lots of rows */ if (read_config_option("max_data_query_javascript_rows") >= api_data_query_cache_num_rows_get($data_query["id"], $host["id"])) { $use_javascript = true; } else { $use_javascript = false; } /* get a list of all graph templates that reference this data query */ $attached_graph_templates = api_data_query_attached_graphs_list($data_query["id"]); /* build a javascript array that keeps tracks of which graphs have already been created */ if (sizeof($attached_graph_templates) > 0 && $use_javascript == true) { echo "<script type='text/javascript'>\n<!--\n"; foreach ($attached_graph_templates as $graph_template) { /* get a list of all data query indexes that have been created as graphs using this graph template */ $created_graphs = api_data_query_graphed_indexes_list($graph_template["id"], $host["id"]); echo "created_graphs[" . $graph_template["id"] . "] = new Array("; $cg_ctr = 0; if (sizeof($created_graphs) > 0) { foreach ($created_graphs as $created_graph) { echo ($cg_ctr > 0 ? "," : "") . "'" . encode_data_query_index($created_graph["data_query_index"]) . "'"; $cg_ctr++; } } echo ")\n"; } echo "//-->\n</script>\n"; } $data_query_indexes = array(); $data_query_field_names = array(); $data_query_field_desc = array(); $num_visible_columns = 0; $data_query_fields = api_data_query_field_list($data_query["id"], DATA_QUERY_FIELD_TYPE_INPUT); /* retrieve a list of values for each data query field from the cache */ if (sizeof($data_query_fields) > 0) { foreach ($data_query_fields as $field) { $cache_data = api_data_query_cache_field_get($data_query["id"], $host["id"], $field["name"]); /* be sure to ignore the fields which contain no data */ if (sizeof($cache_data) > 0) { foreach ($cache_data as $row) { $data_query_data[$row["index_value"]][$field["name"]] = $row["field_value"]; if (!in_array($row["index_value"], $data_query_indexes, true)) { $data_query_indexes[] = $row["index_value"]; } } /* always make sure that the index field is the first column */ if ($data_query["index_field_id"] == $field["id"] && sizeof($data_query_field_names) > 0) { $data_query_field_names[] = $data_query_field_names[0]; $data_query_field_names[0] = $field["name"]; } else { $data_query_field_names[] = $field["name"]; } /* keep a hash of field name->desc mappings for the row headings */ $data_query_field_desc[$field["name"]] = $field["name_desc"]; $num_visible_columns++; } } } /* if the user specified a prefered sort order; sort the list of indexes before displaying them */ if ($data_query["index_order_type"] == DATA_QUERY_INDEX_SORT_TYPE_ALPHABETIC) { usort($data_query_indexes, "usort_alphabetic"); } else { if ($data_query["index_order_type"] == DATA_QUERY_INDEX_SORT_TYPE_NATURAL) { usort($data_query_indexes, "usort_natural"); } else { if ($data_query["index_order_type"] == DATA_QUERY_INDEX_SORT_TYPE_NUMERIC) { usort($data_query_indexes, "usort_numeric"); } } } ?> <table width='98%' style='background-color: #<?php echo $colors["form_alternate2"]; ?> ; border: 1px solid #<?php echo $colors["header_background"]; ?> ;' align='center' cellpadding='3' cellspacing='0'> <tr> <td bgcolor='#<?php echo $colors["header_background"]; ?> ' colspan='<?php echo sizeof($data_query_field_names) + 1; ?> '> <table cellspacing='0' cellpadding='0' width='100%' > <tr> <td class='textHeaderDark'> <strong><?php echo _("Data Query"); ?> </strong> [<?php echo $data_query["name"]; ?> ] </td> <td align='right' nowrap> <a href='graphs_new.php?action=query_reload&id=<?php echo $data_query["id"]; ?> &host_id=<?php echo $host["id"]; ?> '><img src='<?php echo html_get_theme_images_path("reload_icon_small.gif"); ?> ' alt='<?php echo _("Reload Associated Query"); ?> ' border='0' align='absmiddle'></a> </td> </tr> </table> </td> </tr> <?php if (sizeof($attached_graph_templates) == 0) { echo "<tr bgcolor='#" . $colors["form_alternate1"] . "'><td>" . _("This data query is not being used by any graph templates. You must create at least one graph template that references to a data template using this data query.") . "</td></tr>\n"; } else { if (sizeof($data_query_field_names) == 0) { echo "<tr bgcolor='#" . $colors["form_alternate1"] . "'><td>" . _("This data query returned 0 rows, perhaps there was a problem executing this data query. You can") . " <a href='devices.php?action=query_verbose&id=" . $data_query["id"] . "&host_id=" . $host["id"] . "'>" . _("run this data query in debug mode</a> to get more information.") . "</td></tr>\n"; } else { echo "<tr bgcolor='#" . $colors["header_panel_background"] . "'>\n"; foreach ($data_query_field_names as $field_name) { echo "<td height='1'><strong><font color='#" . $colors["header_text"] . "'>" . $data_query_field_desc[$field_name] . "</font></strong></td>\n"; } echo "<td width='1%' align='center' bgcolor='#" . $colors["header_panel_background"] . "' style='" . get_checkbox_style() . "'><input type='checkbox' style='margin: 0px;' name='all_" . $data_query["id"] . "' title='Select All' onClick='" . _("SelectAll") . "(\"sg_" . $data_query["id"] . "\",this.checked);" . ($use_javascript == true ? "dq_update_selection_indicators();" : "") . "'></td>\n</tr>\n"; } } $row_counter = 0; foreach ($data_query_indexes as $index_value) { $query_row = $data_query["id"] . "_" . encode_data_query_index($index_value); echo "<tr id='line{$query_row}' bgcolor='#" . ($row_counter % 2 == 0 ? $colors["form_alternate1"] : $colors["form_alternate2"]) . "'>"; $i++; $column_counter = 0; foreach ($data_query_field_names as $field_name) { echo "<td " . ($use_javascript == true ? "onClick='dq_select_line(" . $data_query["id"] . ",\"" . encode_data_query_index($index_value) . "\");'" : "") . "><span id='text{$query_row}" . "_" . $column_counter . "'>" . (isset($data_query_data[$index_value][$field_name]) ? $data_query_data[$index_value][$field_name] : "") . "</span></td>"; $column_counter++; } echo "<td align='right'>"; echo "<input type='checkbox' name='sg_{$query_row}' id='sg_{$query_row}' " . ($use_javascript == true ? "onClick='dq_update_selection_indicators();'" : "") . ">"; echo "</td>"; echo "</tr>\n"; $row_counter++; } echo "</table>"; if (sizeof($attached_graph_templates) == 1) { form_hidden_box("sgg_" . $data_query["id"] . "' id='sgg_" . $data_query["id"], $attached_graph_templates[0]["id"], ""); } elseif (sizeof($attached_graph_templates) > 1) { print "\t<table align='center' width='98%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width='1' valign='top'>\n\t\t\t\t\t\t\t\t<img src='" . html_get_theme_images_path("arrow.gif") . "' alt='' align='absmiddle'> \n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td align='right'>\n\t\t\t\t\t\t\t\t<span style='font-size: 12px; font-style: italic;'>" . _("Select a graph type:") . "</span> \n\t\t\t\t\t\t\t\t<select name='sgg_" . $data_query["id"] . "' id='sgg_" . $data_query["id"] . "' " . ($use_javascript == true ? "onChange='dq_update_deps(" . $data_query["id"] . "," . $num_visible_columns . ");'" : "") . ">\n\t\t\t\t\t\t\t\t\t"; html_create_list($attached_graph_templates, "template_name", "id", "0"); print "\n\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>"; } print "<br>"; if ($use_javascript == true) { print "<script type='text/javascript'>dq_update_deps(" . $data_query["id"] . "," . $num_visible_columns . ");</script>\n"; } } } form_hidden_box("save_component_graph", "1", ""); form_hidden_box("host_id", $host["id"], "0"); form_save_button("graphs_new.php"); print "<script type='text/javascript'>dq_update_selection_indicators();</script>\n"; print "<script type='text/javascript'>gt_update_selection_indicators();</script>\n"; }
function form_actions() { global $colors, $ds_actions; /* if we are to save this form, instead of display it */ if (isset($_POST["selected_items"])) { $selected_items = unserialize(stripslashes($_POST["selected_items"])); if ($_POST["drp_action"] == "1") { /* delete */ if (!isset($_POST["delete_type"])) { $_POST["delete_type"] = 1; } switch ($_POST["delete_type"]) { case '2': /* delete all graph items tied to this data source */ $data_source_items = db_fetch_assoc("select id from data_source_item where " . array_to_sql_or($selected_items, "data_source_id")); /* loop through each data source item */ if (sizeof($data_source_items) > 0) { foreach ($data_source_items as $item) { db_execute("delete from graph_item where data_source_item_id = " . $item["id"]); } } break; case '3': /* delete all graphs tied to this data source */ $graphs = db_fetch_assoc("select distinct\n\t\t\t\t\t\tgraph.id\n\t\t\t\t\t\tfrom data_source_item,graph_item,graph\n\t\t\t\t\t\twhere graph_item.data_source_item_id=data_source_item.id\n\t\t\t\t\t\tand graph_item.graph_id=graph.id\n\t\t\t\t\t\tand " . array_to_sql_or($selected_items, "data_source_item.data_source_id")); if (sizeof($graphs) > 0) { foreach ($graphs as $graph) { api_graph_remove($graph["id"]); } } break; } for ($i = 0; $i < count($selected_items); $i++) { api_data_source_remove($selected_items[$i]); } } elseif ($_POST["drp_action"] == "2") { /* change graph template */ for ($i = 0; $i < count($selected_items); $i++) { change_data_template($selected_items[$i], $_POST["data_template_id"]); } } elseif ($_POST["drp_action"] == "3") { /* change host */ for ($i = 0; $i < count($selected_items); $i++) { db_execute("update data_local set host_id=" . $_POST["host_id"] . " where id=" . $selected_items[$i]); push_out_host($_POST["host_id"], $selected_items[$i]); api_data_source_title_cache_update($selected_items[$i]); } } elseif ($_POST["drp_action"] == "4") { /* duplicate */ for ($i = 0; $i < count($selected_items); $i++) { duplicate_data_source($selected_items[$i], 0, $_POST["title_format"]); } } elseif ($_POST["drp_action"] == "5") { /* data source -> data template */ for ($i = 0; $i < count($selected_items); $i++) { data_source_to_data_template($selected_items[$i], $_POST["title_format"]); } } elseif ($_POST["drp_action"] == "6") { /* data source enable */ for ($i = 0; $i < count($selected_items); $i++) { api_data_source_enable($selected_items[$i]); } } elseif ($_POST["drp_action"] == "7") { /* data source disable */ for ($i = 0; $i < count($selected_items); $i++) { api_data_source_disable($selected_items[$i]); } } header("Location: data_sources.php"); exit; } /* setup some variables */ $ds_list = ""; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ while (list($var, $val) = each($_POST)) { if (ereg("^chk_([0-9]+)\$", $var, $matches)) { $ds_list .= "<li>" . api_data_source_title_get($matches[1]) . "<br>"; $ds_array[$i] = $matches[1]; } $i++; } require_once CACTI_BASE_PATH . "/include/top_header.php"; html_start_box("<strong>" . $ds_actions[$_POST["drp_action"]] . "</strong>", "60%", $colors["header_panel_background"], "3", "center", ""); print "<form action='data_sources.php' method='post'>\n"; if ($_POST["drp_action"] == "1") { /* delete */ $graphs = array(); /* find out which (if any) graphs are using this data source, so we can tell the user */ if (isset($ds_array)) { $graphs = db_fetch_assoc("select distinct\n\t\t\t\tgraph.id,\n\t\t\t\tgraph.title_cache\n\t\t\t\tfrom data_source_item,graph_item,graph\n\t\t\t\twhere graph_item.data_source_item_id=data_source_item.id\n\t\t\t\tand graph_item.graph_id=graph.id\n\t\t\t\tand " . array_to_sql_or($ds_array, "data_source_item.data_source_id") . "\n\t\t\t\torder by graph.title_cache"); } print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("Are you sure you want to delete the following data sources?") . "</p>\n\t\t\t\t\t<p>{$ds_list}</p>\n\t\t\t\t\t"; if (sizeof($graphs) > 0) { print "<tr bgcolor='#" . $colors["form_alternate1"] . "'><td class='textArea'><p class='textArea'>The following graphs are using these data sources:</p>\n"; foreach ($graphs as $graph) { print "<strong>" . $graph["title_cache"] . "</strong><br>\n"; } print "<br>"; form_radio_button("delete_type", "3", "1", _("Leave the graphs untouched."), "1"); print "<br>"; form_radio_button("delete_type", "3", "2", _("Delete all <strong>graph items</strong> that reference these data sources."), "1"); print "<br>"; form_radio_button("delete_type", "3", "3", _("Delete all <strong>graphs</strong> that reference these data sources."), "1"); print "<br>"; print "</td></tr>"; } print "\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t"; } elseif ($_POST["drp_action"] == "2") { /* change graph template */ print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("Choose a data template and click save to change the data template for\n\t\t\t\t\tthe following data souces. Be aware that all warnings will be suppressed during the\n\t\t\t\t\tconversion, so graph data loss is possible.") . "</p>\n\t\t\t\t\t<p>{$ds_list}</p>\n\t\t\t\t\t<p><strong>" . _("New Data Template:") . "</strong><br>"; form_dropdown("data_template_id", db_fetch_assoc("select data_template.id,data_template.name from data_template order by data_template.name"), "name", "id", "", "", "0"); print "</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t"; } elseif ($_POST["drp_action"] == "3") { /* change device */ print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("Choose a new host for these data sources:") . "</p>\n\t\t\t\t\t<p>{$ds_list}</p>\n\t\t\t\t\t<p><strong>" . _("New Device:") . "</strong><br>"; form_dropdown("host_id", db_fetch_assoc("select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname"), "name", "id", "", "", "0"); print "</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t"; } elseif ($_POST["drp_action"] == "4") { /* duplicate */ print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("When you click save, the following data sources will be duplicated. You can\n\t\t\t\t\toptionally change the title format for the new data sources.") . "</p>\n\t\t\t\t\t<p>{$ds_list}</p>\n\t\t\t\t\t<p><strong>" . _("Title Format:") . "</strong><br>"; form_text_box("title_format", "<ds_title> (1)", "", "255", "30", "text"); print "</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t"; } elseif ($_POST["drp_action"] == "5") { /* graph -> graph template */ print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("When you click save, the following data sources will be converted into data templates.\n\t\t\t\t\tYou can optionally change the title format for the new data templates.") . "</p>\n\t\t\t\t\t<p>{$ds_list}</p>\n\t\t\t\t\t<p><strong>" . _("Title Format:") . "</strong><br>"; form_text_box("title_format", "<ds_title> " . _("Template"), "", "255", "30", "text"); print "</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t"; } elseif ($_POST["drp_action"] == "6") { /* data source enable */ print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>When you click yes, the following data sources will be enabled.</p>\n\t\t\t\t\t<p>{$ds_list}</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t"; } elseif ($_POST["drp_action"] == "7") { /* data source disable */ print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>When you click yes, the following data sources will be disabled.</p>\n\t\t\t\t\t<p>{$ds_list}</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t"; } if (!isset($ds_array)) { print "<tr><td bgcolor='#" . $colors["form_alternate1"] . "'><span class='textError'>" . _("You must select at least one data source.") . "</span></td></tr>\n"; $save_html = ""; } else { $save_html = "<input type='image' src='" . html_get_theme_images_path("button_yes.gif") . "' alt='" . _("Save") . "' align='absmiddle'>"; } print "\t<tr>\n\t\t\t<td align='right' bgcolor='#" . $colors["buttonbar_background"] . "'>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($ds_array) ? serialize($ds_array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . $_POST["drp_action"] . "'>\n\t\t\t\t<a href='data_sources.php'><img src='" . html_get_theme_images_path("button_no.gif") . "' alt='" . _("Cancel") . "' align='absmiddle' border='0'></a>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n\t\t"; html_end_box(); require_once CACTI_BASE_PATH . "/include/bottom_footer.php"; }
} } ?> </table> <table align='center' width='98%'> <tr> <td width='1'> <img src='<?php print html_get_theme_images_path("arrow.gif"); ?> ' alt='' align='absmiddle'> </td> <td> <input type='image' src='<?php print html_get_theme_images_path("button_view.gif"); ?> ' alt='View'> </td> </tr> </table><br><br> <input type='hidden' name='page' value='1'> <input type='hidden' name='style' value='selective'> <input type='hidden' name='action' value='preview'> <input type='hidden' name='graph_list' value='<? print $graph_list_text; ?>'> <input type='hidden' name='graph_add' value=''> <input type='hidden' name='graph_remove' value=''> </form> <?php break;
A:active { text-decoration: none;} A:hover {text-decoration: underline; color: #333333;} A:visited {color: Blue;} --> </style> </head> <body bgcolor="#FFFFFF" onload="document.login.login_username.focus()"> <form name="login" method="post" action="<?php print basename($_SERVER["PHP_SELF"]); ?> "> <input type="hidden" name="action" value="login"> <table align="center"> <tr> <td colspan="2"><img src="<?php print html_get_theme_images_path('auth_login.gif'); ?> " border="0" alt=""></td> </tr> <?php if ($ldap_error) { ?> <tr height="10"><td></td></tr> <tr> <td colspan="2"><font color="#FF0000"><strong><?php print $ldap_error_message; ?> </strong></font></td> </tr> <?php } else {
function template_edit() { global $colors, $fields_host_template_edit; display_output_messages(); if (!empty($_GET["id"])) { $host_template = db_fetch_row("select * from host_template where id=" . $_GET["id"]); $header_label = "[edit: " . $host_template["name"] . "]"; } else { $header_label = "[new]"; $_GET["id"] = 0; } html_start_box("<strong>" . _("Device Templates") . "</strong> {$header_label}", "98%", $colors["header_background"], "3", "center", ""); draw_edit_form(array("config" => array(), "fields" => inject_form_variables($fields_host_template_edit, isset($host_template) ? $host_template : array()))); html_end_box(); if (!empty($_GET["id"])) { html_start_box("<strong>" . _("Associated Graph Templates") . "</strong>", "98%", $colors["header_background"], "3", "center", ""); $selected_graph_templates = db_fetch_assoc("select\n\t\t\tgraph_template.id,\n\t\t\tgraph_template.template_name\n\t\t\tfrom graph_template,host_template_graph\n\t\t\twhere graph_template.id=host_template_graph.graph_template_id\n\t\t\tand host_template_graph.host_template_id=" . $_GET["id"] . "\n\t\t\torder by graph_template.template_name"); $available_graph_templates = db_fetch_assoc("select\n\t\t\tgraph_template.id,\n\t\t\tgraph_template.template_name\n\t\t\tfrom graph_template left join host_template_graph\n\t\t\ton (host_template_graph.graph_template_id = graph_template.id)\n\t\t\twhere host_template_graph.graph_template_id is null\n\t\t\torder by graph_template.template_name"); $i = 0; if (sizeof($selected_graph_templates) > 0) { foreach ($selected_graph_templates as $item) { $i++; ?> <tr bgcolor="<?php print $colors["form_alternate2"]; ?> "> <td style="padding: 4px;"> <strong><?php print $i; ?> )</strong> <?php print $item["template_name"]; ?> </td> <td align="right"> <a href='device_templates.php?action=item_remove_gt&id=<?php print $item["id"]; ?> &host_template_id=<?php print $_GET["id"]; ?> '><img src='<?php print html_get_theme_images_path("delete_icon.gif"); ?> ' width='10' height='10' border='0' alt='Delete'></a> </td> </tr> <?php } } else { print "<tr bgcolor='#" . $colors["form_alternate2"] . "'><td><em>" . _("No associated graph templates.") . "</em></td></tr>"; } ?> <tr bgcolor="#<?php print $colors["form_alternate1"]; ?> "> <td colspan="2"> <table cellspacing="0" cellpadding="1" width="100%"> <td nowrap><?php echo _("Add Graph Template"); ?> : <?php form_dropdown("graph_template_id", $available_graph_templates, "template_name", "id", "", "", ""); ?> </td> <td align="right"> <input type="image" src="<?php print html_get_theme_images_path('button_add.gif'); ?> " alt="Add" name="add_gt" align="absmiddle"> </td> </table> </td> </tr> <?php html_end_box(); html_start_box("<strong>" . _("Associated Data Queries") . "</strong>", "98%", $colors["header_background"], "3", "center", ""); $selected_data_queries = db_fetch_assoc("select\n\t\t\tdata_query.id,\n\t\t\tdata_query.name\n\t\t\tfrom data_query,host_template_data_query\n\t\t\twhere data_query.id=host_template_data_query.data_query_id\n\t\t\tand host_template_data_query.host_template_id=" . $_GET["id"] . "\n\t\t\torder by data_query.name"); $i = 0; if (sizeof($selected_data_queries) > 0) { foreach ($selected_data_queries as $item) { $i++; ?> <tr bgcolor="<?php print $colors["form_alternate2"]; ?> "> <td style="padding: 4px;"> <strong><?php print $i; ?> )</strong> <?php print $item["name"]; ?> </td> <td align='right'> <a href='device_templates.php?action=item_remove_dq&id=<?php print $item["id"]; ?> &host_template_id=<?php print $_GET["id"]; ?> '><img src='<?php print html_get_theme_images_path("delete_icon.gif"); ?> ' width='10' height='10' border='0' alt='Delete'></a> </td> </tr> <?php } } else { print "<tr bgcolor='#" . $colors["form_alternate2"] . "'><td><em>" . _("No associated data queries.") . "</em></td></tr>"; } ?> <tr bgcolor="#<?php print $colors["form_alternate1"]; ?> "> <td colspan="2"> <table cellspacing="0" cellpadding="1" width="100%"> <td nowrap><?php echo _("Add Data Query"); ?> : <?php form_dropdown("snmp_query_id", api_data_query_list(), "name", "id", "", "", ""); ?> </td> <td align="right"> <input type="image" src="<?php print html_get_theme_images_path('button_add.gif'); ?> " alt="Add" name="add_dq" align="absmiddle"> </td> </table> </td> </tr> <?php html_end_box(); } form_save_button("device_templates.php"); }
">Version <?php print CACTI_VERSION; ?> </font></strong> </td> </tr> <tr> <td valign="top" bgcolor="#<?php print $colors["form_alternate2"]; ?> " class="textArea"> <a href="http://www.cacti.net/"><img align="right" src="<?php print html_get_theme_images_path('cacti_logo_about.gif'); ?> " border="0" alt="Cacti"></a> Cacti is designed to be a complete graphing solution based on the RRDTool's framework. Its goal is to make a network administrator's job easier by taking care of all the necessary details necessary to create meaningful graphs. <p>Please see the <a href="http://www.cacti.net/">official Cacti website</a> for information, support, and updates.</p> <p><strong>Current Cacti Developers</strong><br> <ul type="disc"> <li><strong>Ian Berry</strong> (raX) is original creator of Cacti which was first released to the world in 2001. He remained the sole developer for over two years, writing code, supporting users, and keeping the project active. Today, Ian continues to actively develop Cacti, focusing on backend components such as templates, data queries, and graph management.</li> <li><strong>Larry Adams</strong> (TheWitness) joined the Cacti team in June of 2004 right before the major 0.8.6 release. He helped bring the new poller
<head> <title><?php echo _("Logout of Cacti");?></title> <STYLE TYPE="text/css"> <!-- BODY, TABLE, TR, TD {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;} A {text-decoration: none;} A:active { text-decoration: none;} A:hover {text-decoration: underline; color: #333333;} A:visited {color: Blue;} --> </style> </head> <body> <table align="center"> <tr> <td><img src="<?php print html_get_theme_images_path('auth_logout.gif');?>" border="0" alt=""></td> </tr><tr> <td><br><?php echo _("To end your Cacti session please close your web browser.");?><br><br><a href="index.php"><?php echo _("Return to Cacti");?></a></td> </tr> </table> </body> </html> <?php }else{ /* Default action */ header("Location: index.php"); exit; } ?>
function html_box_toolbar_draw($box_id, $form_id, $colspan, $search_type = HTML_BOX_SEARCH_NONE, $search_url = "", $show_default_actions = 1, $action_area_width = 400) { ?> <tr class="toolbar"> <td colspan="<?php echo $colspan;?>"> <table width="100%" cellpadding="3" cellspacing="0"> <tr> <td width="200"> </td> <td class="pagination" align="center" nowrap="true"> <?php if ($search_url == "") { echo " \n"; }else{ echo "[$search_url]\n"; } ?> </td> <td width="126"> </td> <?php if ($show_default_actions == 1) { ?> <td width="16" id="box-<?php echo $box_id;?>-button-duplicate" class="button_mouseout"> <a href="javascript:action_area_box_show('<?php echo $box_id;?>',document.forms[<?php echo $form_id;?>],'duplicate')"><img src="<?php echo html_get_theme_images_path('action_copy.gif');?>" width="16" height="16" border="0" alt="Duplicate" onMouseOver="action_bar_button_mouseover('box-<?php echo $box_id;?>-button-duplicate')" onMouseOut="action_bar_button_mouseout('box-<?php echo $box_id;?>-button-duplicate')" align="absmiddle"></a> </td> <td width="16" id="box-<?php echo $box_id;?>-button-delete" class="button_mouseout"> <a href="javascript:action_area_box_show('<?php echo $box_id;?>',document.forms[<?php echo $form_id;?>],'remove')"><img src="<?php echo html_get_theme_images_path('action_delete.gif');?>" width="16" height="16" border="0" alt="Delete" onMouseOver="action_bar_button_mouseover('box-<?php echo $box_id;?>-button-delete')" onMouseOut="action_bar_button_mouseout('box-<?php echo $box_id;?>-button-delete')" align="absmiddle"></a> </td> <?php }else{ ?> <td width="16"> </td> <td width="16"></td> <?php } ?> </td> </tr> </table> </td> <td width="1%" id="box-<?php echo $box_id;?>-button-menu-container" class="button_menu"> <table width="100%" cellpadding="3" cellspacing="0"> <tr> <td id="box-<?php echo $box_id;?>-button-menu" class="button_mouseout"> <a href="javascript:action_bar_button_menu_click('<?php echo $box_id;?>')"><img src="<?php echo html_get_theme_images_path('action_menu.gif');?>" width="16" height="16" border="0" alt="Choose..." onMouseOver="action_bar_button_menu_mouseover('<?php echo $box_id;?>')" onMouseOut="action_bar_button_menu_mouseout('<?php echo $box_id;?>')" align="absmiddle"></a> </td> </tr> </table> </td> </tr> <?php }
} print ">" . title_trim($graph_timeshifts[$shift_value], 40) . "</option>\n"; } } ?> </select> <input type='image' name='move_right' src='<?php print html_get_theme_images_path("move_right.gif"); ?> ' alt='Right' border='0' align='absmiddle' title='Shift Right'> <input type='image' name='button_refresh' src='<?php print html_get_theme_images_path("button_refresh.gif"); ?> ' alt='<?php echo _("Refresh Selected Time Span"); ?> ' border='0' align='absmiddle' value='refresh'> <input type='image' name='button_clear' src='<?php print html_get_theme_images_path("button_clear.gif"); ?> ' alt='<?php echo _("Return to the Default Time Span"); ?> ' border='0' align='absmiddle'> </td> </tr> </table> </td> </form> </tr>
function form_actions() { global $colors, $poller_actions; /* if we are to save this form, instead of display it */ if (isset($_POST["selected_items"])) { $selected_items = unserialize(stripslashes($_POST["selected_items"])); if ($_POST["drp_action"] == "1") { /* Enable Selected Pollers */ for ($i=0;($i<count($selected_items));$i++) { api_data_poller_enable($selected_items[$i]); } }elseif ($_POST["drp_action"] == "2") { /* Disable Selected Pollers */ for ($i=0;($i<count($selected_items));$i++) { api_data_poller_disable($selected_items[$i]); } }elseif ($_POST["drp_action"] == "3") { /* Delete Selected Pollers */ for ($i=0; $i<count($selected_items); $i++) { api_data_poller_delete($selected_items[$i]); } }elseif ($_POST["drp_action"] == "3") { /* Delete Selected Pollers */ for ($i=0; $i<count($selected_items); $i++) { api_poller_statistics_clear($selected_items[$i]); } } header("Location: pollers.php"); exit; } /* setup some variables */ $poller_list = ""; $i = 0; /* loop through each of the host templates selected on the previous page and get more info about them */ while (list($var,$val) = each($_POST)) { if (ereg("^chk_([0-9]+)$", $var, $matches)) { $poller_list .= "<li>" . db_fetch_cell("select name from poller where id=" . $matches[1]) . "<br>"; $poller_array[$i] = $matches[1]; } $i++; } require_once(CACTI_BASE_PATH . "/include/top_header.php"); html_start_box("<strong>" . $poller_actions{$_POST["drp_action"]} . "</strong>", "60%", $colors["header_panel_background"], "3", "center", ""); print "<form action='pollers.php' method='post'>\n"; if ($_POST["drp_action"] == "1") { /* Enable Pollers */ print " <tr> <td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'> <p>" . _("To enable the following pollers, press the \"yes\" button below.") . "</p> <p>$poller_list</p> </td> </tr>"; }elseif ($_POST["drp_action"] == "2") { /* Disable Pollers */ print " <tr> <td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'> <p>" . _("To disable the following pollers, press the \"yes\" button below.") . "</p> <p>$poller_list</p> </td> </tr>"; }elseif ($_POST["drp_action"] == "3") { /* Delete Pollers */ print " <tr> <td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'> <p>" . _("To delete the following pollers, press the \"yes\" button below.") . "</p> <p>$poller_list</p> </td> </tr>"; }elseif ($_POST["drp_action"] == "4") { /* Clear Poller Statistics */ print " <tr> <td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'> <p>" . _("To clear data collection statistics for the following pollers, press the \"yes\" button below.") . "</p> <p>$poller_list</p> </td> </tr>"; } if (!isset($poller_array)) { print "<tr><td bgcolor='#" . $colors["form_alternate1"]. "'><span class='textError'>" . _("You must select at least one poller.") . "</span></td></tr>\n"; $save_html = ""; }else{ $save_html = "<input type='image' src='" . html_get_theme_images_path("button_yes.gif") . "' alt='" . _("Save") . "' align='absmiddle'>"; } print " <tr> <td colspan='2' align='right' bgcolor='#" . $colors["buttonbar_background"] . "'> <input type='hidden' name='action' value='actions'> <input type='hidden' name='selected_items' value='" . (isset($poller_array) ? serialize($poller_array) : '') . "'> <input type='hidden' name='drp_action' value='" . $_POST["drp_action"] . "'> <a href='pollers.php'><img src='" . html_get_theme_images_path("button_no.gif") . "' alt='" . _("Cancel") . "' align='absmiddle' border='0'></a> $save_html </td> </tr> "; html_end_box(); require_once(CACTI_BASE_PATH . "/include/bottom_footer.php"); }
function template_edit() { global $colors; if (!empty($_GET["id"])) { $graph_template = db_fetch_row("select * from graph_template where id=" . $_GET["id"]); $header_label = _("[edit: ") . $graph_template["template_name"] . "]"; } else { $header_label = _("[new]"); } form_start("graph_templates.php", "form_graph_template"); /* ==================== Box: Graph Template ==================== */ html_start_box("<strong>" . _("Graph Template") . "</strong> {$header_label}", "98%", $colors["header_background"], "3", "center", ""); _graph_template_field__template_name("template_name", isset($graph_template) ? $graph_template["template_name"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]); html_end_box(); /* graph item list goes here */ if (!empty($_GET["id"])) { /* ==================== Box: Graph Items ==================== */ html_start_box("<strong>" . _("Graph Items") . "</strong>", "98%", $colors["header_background"], "3", "center", "graph_templates_items.php?action=edit&graph_template_id=" . $_GET["id"]); draw_graph_item_editor($_GET["id"], "graph_template", false); html_end_box(); /* ==================== Box: Graph Item Inputs ==================== */ html_start_box("<strong>" . _("Graph Item Inputs") . "</strong>", "98%", $colors["header_background"], "3", "center", "graph_templates_inputs.php?action=edit&graph_template_id=" . $_GET["id"]); $display_text = array("name" => array(_("Name"), "ASC")); html_header_sort($display_text, $sort_column, $sort_direction, 2); $template_item_list = db_fetch_assoc("select id,name from graph_template_item_input where graph_template_id=" . $_GET["id"] . " order by name"); $i = 0; if (sizeof($template_item_list) > 0) { foreach ($template_item_list as $item) { form_alternate_row_color($colors["form_alternate1"], $colors["form_alternate2"], $i); $i++; ?> <td> <a class="linkEditMain" href="graph_templates_inputs.php?action=edit&id=<?php print $item["id"]; ?> &graph_template_id=<?php print $_GET["id"]; ?> "><?php print $item["name"]; ?> </a> </td> <td align="right"> <a href="graph_templates_inputs.php?action=remove&id=<?php print $item["id"]; ?> &graph_template_id=<?php print $_GET["id"]; ?> "><img src="<?php print html_get_theme_images_path('delete_icon.gif'); ?> " width="10" height="10" border="0" alt="Delete"></a> </td> </tr> <?php } } else { print "<tr bgcolor='#" . $colors["form_alternate2"] . "'><td colspan='2'><em>" . _("No Inputs") . "</em></td></tr>"; } html_end_box(); } /* ==================== Box: Graph ==================== */ /* the user clicked the "add item" link. we need to make sure they get redirected back to * this page if an error occurs */ if ($_GET["action"] == "sv_add") { form_hidden_box("redirect_sv_add", "x", ""); } html_start_box("<strong>" . _("Graph") . "</strong>", "98%", $colors["header_background"], "3", "center", ""); field_row_header("General Options"); _graph_field__title("title", true, empty($_GET["id"]) ? 0 : $_GET["id"], "t_title", isset($graph_template["t_title"]) ? $graph_template["t_title"] : ""); _graph_field__vertical_label("vertical_label", true, isset($graph_template["vertical_label"]) ? $graph_template["vertical_label"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_vertical_label", isset($graph_template["t_vertical_label"]) ? $graph_template["t_vertical_label"] : ""); _graph_field__image_format("image_format", isset($graph_template["image_format"]) ? $graph_template["image_format"] : "", true, empty($_GET["id"]) ? 0 : $_GET["id"], "t_image_format", isset($graph_template["t_image_format"]) ? $graph_template["t_image_format"] : ""); _graph_field__export("export", true, isset($graph_template["export"]) ? $graph_template["export"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_export", isset($graph_template["t_export"]) ? $graph_template["t_export"] : ""); _graph_field__force_rules_legend("force_rules_legend", true, isset($graph_template["force_rules_legend"]) ? $graph_template["force_rules_legend"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_force_rules_legend", isset($graph_template["t_force_rules_legend"]) ? $graph_template["t_force_rules_legend"] : ""); field_row_header("Image Size Options"); _graph_field__height("height", true, isset($graph_template["height"]) ? $graph_template["height"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_height", isset($graph_template["t_height"]) ? $graph_template["t_height"] : ""); _graph_field__width("width", true, isset($graph_template["width"]) ? $graph_template["width"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_width", isset($graph_template["t_width"]) ? $graph_template["t_width"] : ""); field_row_header("Grid Options"); _graph_field__x_grid("x_grid", true, isset($graph_template["x_grid"]) ? $graph_template["x_grid"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_x_grid", isset($graph_template["t_x_grid"]) ? $graph_template["t_x_grid"] : ""); _graph_field__y_grid("y_grid", true, isset($graph_template["y_grid"]) ? $graph_template["y_grid"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_y_grid", isset($graph_template["t_y_grid"]) ? $graph_template["t_y_grid"] : ""); _graph_field__y_grid_alt("y_grid_alt", true, isset($graph_template["y_grid_alt"]) ? $graph_template["y_grid_alt"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_y_grid_alt", isset($graph_template["t_y_grid_alt"]) ? $graph_template["t_y_grid_alt"] : ""); _graph_field__no_minor("no_minor", true, isset($graph_template["no_minor"]) ? $graph_template["no_minor"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_no_minor", isset($graph_template["t_no_minor"]) ? $graph_template["t_no_minor"] : ""); field_row_header("Auto Scaling Options"); _graph_field__auto_scale("auto_scale", true, isset($graph_template["auto_scale"]) ? $graph_template["auto_scale"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_auto_scale", isset($graph_template["t_auto_scale"]) ? $graph_template["t_auto_scale"] : ""); _graph_field__auto_scale_opts("auto_scale_opts", true, isset($graph_template["auto_scale_opts"]) ? $graph_template["auto_scale_opts"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_auto_scale_opts", isset($graph_template["t_auto_scale_opts"]) ? $graph_template["t_auto_scale_opts"] : ""); _graph_field__auto_scale_log("auto_scale_log", true, isset($graph_template["auto_scale_log"]) ? $graph_template["auto_scale_log"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_auto_scale_log", isset($graph_template["t_auto_scale_log"]) ? $graph_template["t_auto_scale_log"] : ""); _graph_field__auto_scale_rigid("auto_scale_rigid", true, isset($graph_template["auto_scale_rigid"]) ? $graph_template["auto_scale_rigid"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_auto_scale_rigid", isset($graph_template["t_auto_scale_rigid"]) ? $graph_template["t_auto_scale_rigid"] : ""); _graph_field__auto_padding("auto_padding", true, isset($graph_template["auto_padding"]) ? $graph_template["auto_padding"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_auto_padding", isset($graph_template["t_auto_padding"]) ? $graph_template["t_auto_padding"] : ""); field_row_header("Fixed Scaling Options"); _graph_field__upper_limit("upper_limit", true, isset($graph_template["upper_limit"]) ? $graph_template["upper_limit"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_upper_limit", isset($graph_template["t_upper_limit"]) ? $graph_template["t_upper_limit"] : ""); _graph_field__lower_limit("lower_limit", true, isset($graph_template["lower_limit"]) ? $graph_template["lower_limit"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_lower_limit", isset($graph_template["t_lower_limit"]) ? $graph_template["t_lower_limit"] : ""); _graph_field__base_value("base_value", true, isset($graph_template["base_value"]) ? $graph_template["base_value"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_base_value", isset($graph_template["t_base_value"]) ? $graph_template["t_base_value"] : ""); field_row_header("Units Display Options"); _graph_field__unit_value("unit_value", true, isset($graph_template["unit_value"]) ? $graph_template["unit_value"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_unit_value", isset($graph_template["t_unit_value"]) ? $graph_template["t_unit_value"] : ""); _graph_field__unit_length("unit_length", true, isset($graph_template["unit_length"]) ? $graph_template["unit_length"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_unit_length", isset($graph_template["t_unit_length"]) ? $graph_template["t_unit_length"] : ""); _graph_field__unit_exponent_value("unit_exponent_value", true, isset($graph_template["unit_exponent_value"]) ? $graph_template["unit_exponent_value"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_unit_exponent_value", isset($graph_template["t_unit_exponent_value"]) ? $graph_template["t_unit_exponent_value"] : ""); html_end_box(); form_hidden_box("graph_template_id", empty($_GET["id"]) ? 0 : $_GET["id"], ""); form_hidden_box("action_post", "graph_template_edit"); form_save_button("graph_templates.php"); }
function user_actions() { global $colors, $user_actions, $fields_user_edit, $user_password_expire_intervals; /* if we are to save this form, instead of display it */ if (isset($_POST["selected_items"])) { $selected_items = unserialize(stripslashes($_POST["selected_items"])); if ($_POST["drp_action"] == "3") { /* Enable Selected Users */ for ($i=0;($i<count($selected_items));$i++) { api_user_enable($selected_items[$i]); } }elseif ($_POST["drp_action"] == "4") { /* Disable Selected Users */ for ($i=0;($i<count($selected_items));$i++) { api_user_disable($selected_items[$i]); } }elseif ($_POST["drp_action"] == "1") { /* Delete User */ for ($i=0; $i<count($selected_items); $i++) { api_user_remove($selected_items[$i]); } }elseif ($_POST["drp_action"] == "2") { /* Copy User */ /* Check for new user name */ if ((!empty($_POST["user_new"])) && (!empty($_POST["user_name"]))) { if (api_user_copy($_POST["user_name"],$_POST["user_new"]) == 1) { raise_message(12); } } }elseif ($_POST["drp_action"] == "5") { /* Password Expiration */ for ($i=0; $i<count($selected_items); $i++) { api_user_expire_length_set($selected_items[$i], $_POST["expire_interval"]); } } header("Location: user_admin.php"); exit; } /* setup some variables */ $user_list = ""; $i = 0; $username = ""; /* loop through each of the users selected on the previous page and get more info about them */ while (list($var,$val) = each($_POST)) { if (ereg("^chk_([0-9]+)$", $var, $matches)) { $user = api_user_info( array( "id" => $matches[1]) ); $user_list .= "<li>" . $user["username"] . "<br>"; $username_list[$user["username"]] = $user["username"]; $user_array[$i] = $matches[1]; } $i++; } require_once(CACTI_BASE_PATH . "/include/top_header.php"); html_start_box("<strong>" . $user_actions{$_POST["drp_action"]} . "</strong>", "60%", $colors["header_panel_background"], "3", "center", ""); print "<form action='user_admin.php' method='post'>\n"; if ($_POST["drp_action"] == "3") { /* Enable Users */ print " <tr> <td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'> <p>" . _("To enable the following users, press the \"yes\" button below.") . "</p> <p>$user_list</p> </td> </tr>"; }elseif ($_POST["drp_action"] == "4") { /* Disable Users */ print " <tr> <td colspan='4' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'> <p>". _("To disable the following users, press the \"yes\" button below.") . "</p> <p>$user_list</p> </td> </tr>"; }elseif ($_POST["drp_action"] == "2") { /* copy user */ print " <tr> <td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'> <p>" . _("Would you like to copy a user to a new user?") . "</p> </td> </tr>"; if (isset($user_array)) { $form_array = array( "user_name" => array( "method" => "drop_array", "friendly_name" => _("User Name"), "description" => _("Select the user name you would like to copy from."), "value" => "", "array" => $username_list ), "user_new" => array( "method" => "textbox", "friendly_name" => _("New User Name"), "description" => _("Type the user name of the new user."), "value" => "", "max_length" => "100" ) ); draw_edit_form( array( "config" => array("no_form_tag" => true), "fields" => $form_array ) ); } }elseif ($_POST["drp_action"] == "1") { /* delete */ print " <tr> <td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'> <p>" . _("Are you sure you want to delete the following users?") . "</p> <p>$user_list</p> </td></tr> </td> </tr>\n "; }elseif ($_POST["drp_action"] == "5") { /* Password Expiration */ print " <tr> <td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'> <p>" . _("Would you like to set Password Expiration?") . "</p> <p>$user_list</p> </td> </tr>"; $form_array = array( "expire_interval" => array( "method" => "drop_array", "friendly_name" => _("Password Expiration Interval"), "description" => _("Select the interval that you would like to apply to the selected users."), "value" => "", "array" => $user_password_expire_intervals ) ); draw_edit_form( array( "config" => array("no_form_tag" => true), "fields" => $form_array ) ); } if (!isset($user_array)) { print "<tr><td colspan='2' bgcolor='#" . $colors["form_alternate1"]. "'><span class='textError'>" . _("You must select at least one user.") . "</span></td></tr>\n"; $save_html = ""; }else{ $save_html = "<input type='image' src='" . html_get_theme_images_path("button_yes.gif") . "' alt='" . _("Save") . "' align='absmiddle'>"; } print " <tr> <td colspan='2' align='right' bgcolor='#" . $colors["buttonbar_background"] . "'> <input type='hidden' name='action' value='actions'> <input type='hidden' name='selected_items' value='" . (isset($user_array) ? serialize($user_array) : '') . "'> <input type='hidden' name='drp_action' value='" . $_POST["drp_action"] . "'> <a href='user_admin.php'><img src='" . html_get_theme_images_path("button_no.gif") . "' alt='" . _("Cancel") . "' align='absmiddle' border='0'></a> $save_html </td> </tr> "; html_end_box(); require_once(CACTI_BASE_PATH . "/include/bottom_footer.php"); }
function tree_edit() { $menu_items = array("remove" => "Remove"); $_graph_tree_id = get_get_var_number("id"); if (empty($_graph_tree_id)) { $header_label = "[new]"; } else { $graph_tree = api_graph_tree_get($_graph_tree_id); $header_label = "[edit: " . $graph_tree["name"] . "]"; } form_start("graph_trees.php", "form_graph_tree"); html_start_box("<strong>" . _("Graph Trees") . "</strong> {$header_label}", ""); _graph_tree_field__name("name", isset($graph_tree["name"]) ? $graph_tree["name"] : "", empty($_graph_tree_id) ? 0 : $_graph_tree_id); _graph_tree_field__sort_type("sort_type", isset($graph_tree["sort_type"]) ? $graph_tree["sort_type"] : "", empty($_graph_tree_id) ? 0 : $_graph_tree_id); html_end_box(); form_hidden_box("id", $_graph_tree_id); form_hidden_box("action_post", "graph_tree_edit"); form_save_button("graph_trees.php"); if (!empty($_graph_tree_id)) { echo "<br />\n"; form_start("graph_trees_items.php", "form_graph_tree_item"); $box_id = "1"; html_start_box("<strong>" . _("Tree Items") . "</strong>", "graph_trees_items.php?action=edit&tree_id=" . $_graph_tree_id . "&parent_id=0"); html_header_checkbox(array(_("Item"), _("Type"), ""), $box_id, "1"); /* get a sorted list of all graph items inside of this tree */ $tree_items = api_graph_tree_item_list($_graph_tree_id); /* get a list of available types (header, host, graph, etc) */ $tree_item_types = api_graph_tree_item_type_list(); if (is_array($tree_items) > 0 && sizeof($tree_items) > 0) { foreach ($tree_items as $tree_item) { $current_depth = api_graph_tree_item_depth_get($tree_item["order_key"]); /* keep track of the current item's sort type so we know whether to display sort * arrays for items children or not */ $sort_cache[$current_depth] = $tree_item["sort_children_type"]; $transparent_indent = ""; if ($tree_item["item_type"] == TREE_ITEM_TYPE_GRAPH) { $item_text = $tree_item["graph_title"]; } else { if ($tree_item["item_type"] == TREE_ITEM_TYPE_HEADER) { $item_text = "<strong>" . $tree_item["item_value"] . "</strong></a> (<a href='graph_trees_items.php?action=edit&tree_id=" . $_graph_tree_id . "&parent_id=" . $tree_item["id"] . "'>Add</a>)"; } else { if ($tree_item["item_type"] == TREE_ITEM_TYPE_HOST) { $item_text = "<strong>Device:</strong> " . $tree_item["host_hostname"]; } } } ?> <tr class="item" id="box-<?php echo $box_id; ?> -row-<?php echo $tree_item["id"]; ?> " onClick="display_row_select('<?php echo $box_id; ?> ',document.forms[1],'box-<?php echo $box_id; ?> -row-<?php echo $tree_item["id"]; ?> ', 'box-<?php echo $box_id; ?> -chk-<?php echo $tree_item["id"]; ?> ')" onMouseOver="display_row_hover('box-<?php echo $box_id; ?> -row-<?php echo $tree_item["id"]; ?> ')" onMouseOut="display_row_clear('box-<?php echo $box_id; ?> -row-<?php echo $tree_item["id"]; ?> ')"> <td class="title"> <img width="<?php echo ($current_depth - 1) * 20; ?> " height="1" align="middle" alt=""> <a onClick="display_row_block('box-<?php echo $box_id; ?> -row-<?php echo $tree_item["id"]; ?> ')" href="graph_trees_items.php?action=edit&tree_id=<?php echo $_graph_tree_id; ?> &id=<?php echo $tree_item["id"]; ?> "><span id="box-<?php echo $box_id; ?> -text-<?php echo $tree_item["id"]; ?> "><?php echo html_highlight_words(get_get_var("search_filter"), $item_text); ?> </span></a> </td> <td> <?php echo $tree_item_types[$tree_item["item_type"]]; ?> </td> <?php if (isset($sort_cache[$current_depth - 1]) && $sort_cache[$current_depth - 1] != TREE_ORDERING_NONE || $graph_tree["sort_type"] != TREE_ORDERING_NONE) { ?> <td width="80"> </td> <?php } else { ?> <td width="80" align="center"> <a href="graph_trees_items.php?action=movedown&id=<?php echo $tree_item["id"]; ?> &graph_tree_id=<?php echo $_graph_tree_id; ?> "><img src="<?php echo html_get_theme_images_path("move_down.gif"); ?> " border="0" alt="Move Down"></a> <a href="graph_trees_items.php?action=moveup&id=<?php echo $tree_item["id"]; ?> &graph_tree_id=<?php echo $_graph_tree_id; ?> "><img src="<?php echo html_get_theme_images_path("move_up.gif"); ?> " border="0" alt="Move Up"></a> </td> <?php } ?> <td class="checkbox" align="center"> <input type='checkbox' name='box-<?php echo $box_id; ?> -chk-<?php echo $tree_item["id"]; ?> ' id='box-<?php echo $box_id; ?> -chk-<?php echo $tree_item["id"]; ?> ' title="<?php echo strip_tags($item_text); ?> "> </td> </tr> <?php } } else { ?> <tr class="empty"> <td colspan="6"> No graph tree items found. </td> </tr> <?php } html_box_toolbar_draw($box_id, "1", "3", HTML_BOX_SEARCH_NONE); html_end_box(false); html_box_actions_menu_draw($box_id, "1", $menu_items); form_hidden_box("graph_tree_id", $_graph_tree_id); form_hidden_box("action", "save"); form_hidden_box("action_post", "graph_tree_item_list"); form_end(); ?> <script language="JavaScript"> <!-- function action_area_handle_type(box_id, type, parent_div, parent_form) { if (type == 'remove') { parent_div.appendChild(document.createTextNode('Are you sure you want to remove these graph tree items?')); parent_div.appendChild(action_area_generate_selected_rows(box_id)); action_area_update_header_caption(box_id, 'Remove Graph Tree Item'); action_area_update_submit_caption(box_id, 'Remove'); action_area_update_selected_rows(box_id, parent_form); } } --> </script> <?php } }
function draw_graph_item_editor($graph_X_id, $form_type, $disable_controls) { global $colors; require_once(CACTI_BASE_PATH . "/lib/graph/graph_utility.php"); require_once(CACTI_BASE_PATH . "/include/graph/graph_constants.php"); require(CACTI_BASE_PATH . "/include/graph/graph_arrays.php"); require(CACTI_BASE_PATH . "/include/data_source/data_source_arrays.php"); $graph_actions = array( 1 => _("Delete Items"), 2 => _("Duplicate Items") ); if ($form_type == "graph_template") { $item_list = db_fetch_assoc("select graph_template_item.id, graph_template_item.legend_format, graph_template_item.legend_value, graph_template_item.gprint_format, graph_template_item.hard_return, graph_template_item.graph_item_type, graph_template_item.consolidation_function, graph_template_item.color, graph_template_item.sequence, graph_template.auto_padding, data_template_item.data_source_name from (graph_template_item,graph_template) left join data_template_item on (graph_template_item.data_template_item_id=data_template_item.id) where graph_template_item.graph_template_id=graph_template.id and graph_template_item.graph_template_id = $graph_X_id order by graph_template_item.sequence"); $url_filename = "graph_templates_items.php"; $url_data = "&graph_template_id=$graph_X_id"; }else if ($form_type == "graph") { $item_list = db_fetch_assoc("select graph_item.id, graph_item.legend_format, graph_item.legend_value, graph_item.gprint_format, graph_item.hard_return, graph_item.graph_item_type, graph_item.consolidation_function, graph_item.color, graph_item.sequence, graph.auto_padding, data_source_item.data_source_name from (graph_item,graph) left join data_source_item on (graph_item.data_source_item_id=data_source_item.id) where graph_item.graph_id=graph.id and graph_item.graph_id = $graph_X_id order by graph_item.sequence"); $url_filename = "graphs_items.php"; $url_data = "&graph_id=$graph_X_id"; }else{ return; } ?> <tr bgcolor='#<?php echo $colors["header_panel_background"];?>'> <td width='12'> </td> <td width='60' class='textSubHeaderDark'> Item </td> <td class='textSubHeaderDark'> Graph Item Type </td> <td class='textSubHeaderDark'> Data Source </td> <td class='textSubHeaderDark'> Legend Text </td> <td class='textSubHeaderDark'> Color </td> <td class='textSubHeaderDark'> CF Type </td> <td> </td> <td> </td> <td width='1%' align='right' bgcolor='#819bc0' style='<?php echo get_checkbox_style();?>'> <input type='checkbox' style='margin: 0px;' name='all' title='<?php echo _("Select All");?>' onClick='graph_item_rows_selection(this.checked)'> </td> </tr> <?php if (sizeof($item_list) > 0) { /* calculate auto padding information and other information that we will need below */ $max_pad_length = 0; $total_num_rows = 0; for ($i=0; $i<sizeof($item_list); $i++) { if (($i == 0) || (!empty($item_list{$i-1}["hard_return"]))) { if (strlen($item_list[$i]["legend_format"]) > $max_pad_length) { $max_pad_length = strlen($item_list[$i]["legend_format"]); } $total_num_rows++; } } $i = 0; $row_counter = 1; /* preload expand/contract icons */ echo "<script type='text/javascript'>\nvar auxImg;\nauxImg = new Image();auxImg.src = '" . html_get_theme_images_path("show.gif") . "';\nauxImg.src = '" . html_get_theme_images_path("hide.gif") . "';\n</script>\n"; /* initialize JS variables */ echo "<script type='text/javascript'>\nvar item_row_list = new Array()\n</script>\n"; foreach ($item_list as $item) { $matrix_title = ""; $hard_return = ""; $show_moveup = true; $show_movedown = true; if (is_graph_item_type_primary($item["graph_item_type"])) { $matrix_title = "(" . $item["data_source_name"] . "): " . $item["legend_format"]; }else if (($item["graph_item_type"] == GRAPH_ITEM_TYPE_HRULE) || ($item["graph_item_type"] == GRAPH_ITEM_TYPE_VRULE)) { $matrix_title = $graph_item_types{$item["graph_item_type"]} . ": " . $item["legend_value"]; }else if ($item["graph_item_type"] == GRAPH_ITEM_TYPE_COMMENT) { $matrix_title = "COMMENT: " . $item["legend_format"]; } if (!empty($item["hard_return"])) { $hard_return = "<strong><font color=\"#FF0000\"><HR></font></strong>"; } if (($i == 0) || (!empty($item_list{$i-1}["hard_return"]))) { ?> <tr bgcolor="#<?php echo $colors["form_custom1"];?>"> <td width='12' style='border-bottom: 1px solid #b5b5b5;' align='center'> <a href="javascript:graph_item_row_visibility(<?php echo $row_counter;?>)"><img id='img_<?php echo $row_counter;?>' src='<?php echo html_get_theme_images_path("hide.gif");?>' border='0' title='<?php echo _("Collapse Row");?>' alt='<?php echo _("Collapse Row");?>' align='absmiddle'></a> </td> <td style='border-right: 1px solid #b5b5b5; border-bottom: 1px solid #b5b5b5;' width='60'> <strong><?php echo _("Row #") . $row_counter;?></strong> </td> <td colspan='5' style='font-family: monospace; color: #515151; cursor: pointer; border-bottom: 1px solid #b5b5b5;' onClick="graph_item_row_visibility(<?php echo $row_counter;?>)" nowrap> <pre><?php $j = $i; $graph_item_row = array(); do { $_item = $item_list[$j]; if (is_graph_item_type_primary($_item["graph_item_type"])) { if ($_item["color"] != "") { echo "<img src='" . html_get_theme_images_path("transparent_line.gif") . "'style='width: 9px; height: 9px; border: 1px solid #000000; background-color: #" . $_item["color"] . "' border='0' align='absmiddle' alt=''> "; } } if ($_item["graph_item_type"] == GRAPH_ITEM_TYPE_GPRINT) { printf(" " . $_item["legend_format"] . $_item["gprint_format"], "0", ""); }else{ echo $_item["legend_format"]; } /* the first item of the row is where auto padding is applied */ if ($i == $j) { echo (empty($_item["auto_padding"])) ? "" : str_repeat(" ", (($max_pad_length + 1) - strlen($_item["legend_format"]))); } /* keep track of each item in this row so we can create a JS array below */ $graph_item_row[] = $_item["id"]; $j++; } while ((empty($item_list{$j-1}["hard_return"])) && (($j+1)<=sizeof($item_list))); ?></pre> </td> <td align='center' width='15' style='border-bottom: 1px solid #b5b5b5;'> <?php if ($row_counter < $total_num_rows) { ?> <a href='<?php echo $url_filename;?>?action=row_movedown&row=<?php echo $row_counter;?><?php echo $url_data;?>'><img src='<?php echo html_get_theme_images_path("move_down.gif");?>' border='0' title='<?php echo _("Move Item Down");?>' alt='<?php echo _("Move Item Down");?>'></a> <?php }else{ ?> <?php } ?> </td> <td align='left' width='25' style='border-bottom: 1px solid #b5b5b5;'> <?php if ($i > 0) { ?> <a href='<?php echo $url_filename;?>?action=row_moveup&row=<?php echo $row_counter;?><?php echo $url_data;?>'><img src='<?php echo html_get_theme_images_path("move_up.gif");?>' border='0' title='<?php echo _("Move Item Up");?>' alt='<?php echo _("Move Item Up");?>'></a> <?php }else{ ?> <?php } ?> </td> <td style="<?php echo get_checkbox_style();?> border-bottom: 1px solid #b5b5b5;" width="1%" align="right"> <input type='checkbox' style='margin: 0px;' onClick="graph_item_row_selection(<?php echo $row_counter;?>)" name='row_chk_<?php echo $row_counter;?>' id='row_chk_<?php echo $row_counter;?>' title="<?php echo _('Row #') . $row_counter;?>"> </td> </tr> <?php /* create a JS array of graph items in each row */ echo "<script type='text/javascript'>\nitem_row_list[$row_counter] = new Array("; for ($j=0; $j<sizeof($graph_item_row); $j++) { echo "'" . $graph_item_row[$j] . "'" . (($j+1) < sizeof($graph_item_row) ? "," : ""); } echo ")\n</script>\n"; $row_counter++; } /* only show arrows when they are supposed to be shown */ if ($i == 0) { $show_moveup = false; }else if (($i+1) == sizeof($item_list)) { $show_movedown = false; } if (empty($item["graph_template_item_group_id"])) { $row_color = $colors["form_alternate1"]; }else{ $row_color = $colors["alternate"]; } ?> <tr id="tr_<?php echo $item["id"];?>" bgcolor="#<?php echo $row_color;?>"> <td width='12' align='center'> </td> <td width='60' style='border-right: 1px solid #b5b5b5;'> <a href='<?php echo $url_filename;?>?action=edit&id=<?php echo $item["id"];?>&<?php echo $url_data;?>'><?php echo _("Item #") . ($i+1);?></a> </td> <td> <?php echo $graph_item_types{$item["graph_item_type"]};?> </td> <td> <?php echo $item["data_source_name"];?> </td> <td> <?php echo $item["legend_format"];?><?php echo (empty($item["hard_return"]) ? "" : "<span style='color: red; font-weight: bold;'><HR></span>");?> </td> <td> <?php echo $item["color"];?> </td> <td> <?php echo $consolidation_functions{$item["consolidation_function"]};?> </td> <td width='15' align='center'> <?php if (($i+1) < sizeof($item_list)) { ?> <a href='<?php echo $url_filename;?>?action=item_movedown&id=<?php echo $item["id"];?>&<?php echo $url_data;?>'><img src='<?php echo html_get_theme_images_path("move_down.gif");?>' border='0' title='<?php echo _("Move Item Down");?>' alt='<?php echo _("Move Item Down");?>'></a> <?php } ?> </td> <td width='25' align='left'> <?php if ($i > 0) { ?> <a href='<?php echo $url_filename;?>?action=item_moveup&id=<?php echo $item["id"];?>&<?php echo $url_data;?>'><img src='<?php echo html_get_theme_images_path("move_up.gif");?>' border='0' title='<?php echo _("Move Item Up");?>' alt='<?php echo _("Move Item Up");?>'></a> <?php } ?> </td> <td width='1' style="<?php echo get_checkbox_style();?>" align="right"> <input type='checkbox' style='margin: 0px;' name='chk_gi_<?php echo $item["id"];?>' id='chk_<?php echo $item["id"];?>' title="<?php echo _('Item #') . ($i + 1);?>"> </td> </tr> <?php $i++; } /* create a JS array for each row */ echo "<script type='text/javascript'>\nvar item_rows = new Array("; for ($j=1; $j<$row_counter; $j++) { echo $j . (($j+1) < $row_counter ? "," : ""); } echo ")\n</script>\n"; ?> <tr bgcolor='#ffffff'> <td colspan='10' style='border-top: 1px dashed #a1a1a1;'> <?php draw_actions_dropdown($graph_actions, 2, 100); ?> </td> </tr> <?php }else{ echo "<tr><td><em>" . _("No graph items found.") . "</em></td></tr>\n"; } }
print $colors['graph_menu_border']; ?> 1px solid;"> <img src="<?php print html_get_theme_images_path('transparent_line.gif'); ?> " width="<?php print read_graph_config_option("default_dual_pane_width"); ?> " height="2" border="0"><br> </td> <td bgcolor="#<?php print $colors['graph_menu_background']; ?> " colspan="1" height="8" style="background-image: url(<?php print html_get_theme_images_path('shadow.gif'); ?> ); background-repeat: repeat-x;"> </td> </tr> <?php if (basename($_SERVER["PHP_SELF"]) == "graph.php" && $_REQUEST["action"] == "properties" && !$using_guest_account && $current_user_realms["20"]["value"] == "1") { ?> <tr> <td valign="top" height="1" colspan="3" bgcolor="#<?php print $colors['graph_menu_background']; ?> "> <?php
echo _("Cacti"); ?> </title> <link href='<?php print html_get_theme_css(); ?> ' rel='stylesheet'> </style> </head> <br><br> <table width='450' align='center'> <tr> <td colspan='2'><img src='<?php print html_get_theme_images_path("auth_deny.gif"); ?> ' border='0' alt='" . _("Access Denied") . "'></td> </tr> <tr height='10'><td></td></tr> <tr> <td class='textArea' colspan='2'><?php print _("You are not permitted to access this section of Cacti. If you feel that you need access to this particular section, please contact the Cacti administrator."); ?> </td> </tr> <tr> <td class='textArea' colspan='2' align='center'>( <a href='' onclick='javascript: history.back();'><?php print _("Return"); ?> </a> | <a href='logout.php'><?php
function draw_tree_header_row($tree_id, $tree_item_id, $current_tier, $current_title, $use_expand_contract, $expand_contract_status, $show_url) { global $colors; /* start the nested table for the heading */ print "<tr><td colspan='2'><table width='100%' cellpadding='2' cellspacing='1' border='0'><tr>\n"; /* draw one vbar for each tier */ for ($j=0;($j<($current_tier-1));$j++) { print "<td width='10' bgcolor='#" . $colors["panel"] . "'></td>\n"; } /* draw the '+' or '-' icons if configured to do so */ if (($use_expand_contract) && (!empty($current_title))) { if ($expand_contract_status == "1") { $other_status = '0'; $ec_icon = 'show.gif'; }else{ $other_status = '1'; $ec_icon = 'hide.gif'; } print "<td bgcolor='" . $colors["panel"] . "' align='center' width='1%'><a href='graph_view.php?action=tree&tree_id=$tree_id&hide=$other_status&branch_id=$tree_item_id'> <img src='" . html_get_theme_images_path($ec_icon) . "' border='0'></a></td>\n"; }elseif (!($use_expand_contract) && (!empty($current_title))) { print "<td bgcolor='" . $colors["panel"] . "' width='10'></td>\n"; } /* draw the actual cell containing the header */ if (!empty($current_title)) { print "<td bgcolor='" . $colors["panel"] . "' NOWRAP><strong> " . (($show_url == true) ? "<a href='graph_view.php?action=tree&tree_id=$tree_id&start_branch=$tree_item_id'>" : "") . $current_title . (($show_url == true) ? "</a>" : "") . " </strong></td>\n"; } /* end the nested table for the heading */ print "</tr></table></td></tr>\n"; }
function form_actions() { global $colors, $graph_actions; /* if we are to save this form, instead of display it */ if (isset($_POST["selected_items"])) { $selected_items = unserialize(stripslashes($_POST["selected_items"])); if ($_POST["drp_action"] == "1") { /* delete */ for ($i = 0; $i < count($selected_items); $i++) { if (!isset($_POST["delete_type"])) { $_POST["delete_type"] = 1; } switch ($_POST["delete_type"]) { case '2': /* delete all data sources referenced by this graph */ $data_sources = db_fetch_assoc("select distinct\n\t\t\t\t\t\t\tdata_source.id\n\t\t\t\t\t\t\tfrom data_source_item,data_source,graph_item\n\t\t\t\t\t\t\twhere graph_item.data_source_item_id=data_source_item.id\n\t\t\t\t\t\t\tand data_source_item.data_source_id=data_source.id\n\t\t\t\t\t\t\tand " . array_to_sql_or($selected_items, "graph_item.graph_id") . "\n\t\t\t\t\t\t\torder by data_source.name_cache"); if (sizeof($data_sources) > 0) { foreach ($data_sources as $data_source) { api_data_source_remove($data_source["id"]); } } break; } api_graph_remove($selected_items[$i]); } } elseif ($_POST["drp_action"] == "2") { /* change graph template */ for ($i = 0; $i < count($selected_items); $i++) { change_graph_template($selected_items[$i], $_POST["graph_template_id"], true); } } elseif ($_POST["drp_action"] == "3") { /* duplicate */ for ($i = 0; $i < count($selected_items); $i++) { duplicate_graph($selected_items[$i], 0, $_POST["title_format"]); } } elseif ($_POST["drp_action"] == "4") { /* graph -> graph template */ for ($i = 0; $i < count($selected_items); $i++) { graph_to_graph_template($selected_items[$i], $_POST["title_format"]); } } elseif (ereg("^tr_([0-9]+)\$", $_POST["drp_action"], $matches)) { /* place on tree */ for ($i = 0; $i < count($selected_items); $i++) { api_tree_item_save(0, $_POST["tree_id"], TREE_ITEM_TYPE_GRAPH, $_POST["tree_item_id"], "", $selected_items[$i], read_graph_config_option("default_rra_id"), 0, 0, 0, false); } } elseif ($_POST["drp_action"] == "5") { /* change host */ for ($i = 0; $i < count($selected_items); $i++) { db_execute("update graph set host_id = " . $_POST["host_id"] . " where id = " . $selected_items[$i]); api_graph_title_cache_update($selected_items[$i]); } } elseif ($_POST["drp_action"] == "6") { /* reapply suggested naming */ for ($i = 0; $i < count($selected_items); $i++) { api_reapply_suggested_graph_title($selected_items[$i]); api_graph_title_cache_update($selected_items[$i]); } } elseif ($_POST["drp_action"] == "7") { /* resize graphs */ for ($i = 0; $i < count($selected_items); $i++) { api_graph_resize($selected_items[$i], $_POST["graph_width"], $_POST["graph_height"]); } } header("Location: graphs.php"); exit; } /* setup some variables */ $graph_list = ""; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ while (list($var, $val) = each($_POST)) { if (ereg("^chk_([0-9]+)\$", $var, $matches)) { $graph_list .= "<li>" . db_fetch_cell("select title_cache from graph where id = " . $matches[1]) . "<br>"; $graph_array[$i] = $matches[1]; } $i++; } require_once CACTI_BASE_PATH . "/include/top_header.php"; html_start_box("<strong>" . $graph_actions[$_POST["drp_action"]] . "</strong>", "60%", $colors["header_panel_background"], "3", "center", ""); print "<form action='graphs.php' method='post'>\n"; if ($_POST["drp_action"] == "1") { /* delete */ $graphs = array(); /* find out which (if any) data sources are being used by this graph, so we can tell the user */ if (isset($graph_array)) { $data_sources = db_fetch_assoc("select distinct\n\t\t\t\tdata_source.id,\n\t\t\t\tdata_source.name_cache\n\t\t\t\tfrom data_source_item,data_source,graph_item\n\t\t\t\twhere graph_item.data_source_item_id=data_source_item.id\n\t\t\t\tand data_source_item.data_source_id=data_source.id\n\t\t\t\tand " . array_to_sql_or($graph_array, "graph_item.graph_id") . "\n\t\t\t\torder by data_source.name_cache"); } print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("Are you sure you want to delete the following graphs?") . "</p>\n\t\t\t\t\t<p>{$graph_list}</p>\n\t\t\t\t\t"; if (sizeof($data_sources) > 0) { print "<tr bgcolor='#" . $colors["form_alternate1"] . "'><td class='textArea'><p class='textArea'>" . _("The following data sources are in use by these graphs:") . "</p>\n"; foreach ($data_sources as $data_source) { print "<strong>" . $data_source["name_cache"] . "</strong><br>\n"; } print "<br>"; form_radio_button("delete_type", "1", "1", _("Leave the data sources untouched."), "1"); print "<br>"; form_radio_button("delete_type", "1", "2", _("Delete all <strong>data sources</strong> referenced by these graphs."), "1"); print "<br>"; print "</td></tr>"; } print "\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t"; } elseif ($_POST["drp_action"] == "2") { /* change graph template */ print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("Choose a graph template and click save to change the graph template for\n\t\t\t\t\tthe following graphs. Be aware that all warnings will be suppressed during the\n\t\t\t\t\tconversion, so graph data loss is possible.") . "</p>\n\t\t\t\t\t<p>{$graph_list}</p>\n\t\t\t\t\t<p><strong>" . _("New Graph Template:") . "</strong><br>"; form_dropdown("graph_template_id", db_fetch_assoc("select graph_templates.id,graph_templates.name from graph_templates"), "name", "id", "", "", "0"); print "</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t"; } elseif ($_POST["drp_action"] == "3") { /* duplicate */ print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("When you click save, the following graphs will be duplicated. You can\n\t\t\t\t\toptionally change the title format for the new graphs.") . "</p>\n\t\t\t\t\t<p>{$graph_list}</p>\n\t\t\t\t\t<p><strong>" . _("Title Format:") . "</strong><br>"; form_text_box("title_format", "<graph_title> (1)", "", "255", "30", "text"); print "</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t"; } elseif ($_POST["drp_action"] == "4") { /* graph -> graph template */ print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("When you click save, the following graphs will be converted into graph templates.\n\t\t\t\t\tYou can optionally change the title format for the new graph templates.") . "</p>\n\t\t\t\t\t<p>{$graph_list}</p>\n\t\t\t\t\t<p><strong>" . _("Title Format:") . "</strong><br>"; form_text_box("title_format", "<graph_title> " . _("Template"), "", "255", "30", "text"); print "</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t"; } elseif ($_POST["drp_action"] == "5") { /* change device */ print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("Choose a new host for these graphs:") . "</p>\n\t\t\t\t\t<p>{$graph_list}</p>\n\t\t\t\t\t<p><strong>" . _("New Device:") . "</strong><br>"; form_dropdown("host_id", db_fetch_assoc("select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname"), "name", "id", "", "", "0"); print "</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t"; } elseif ($_POST["drp_action"] == "6") { /* reapply suggested naming to host */ print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("When you click save, the following graphs will have thier suggested naming convensions\n\t\t\t\t\trecalculated and applies to the graphs.") . "</p>\n\t\t\t\t\t<p>{$graph_list}</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t"; } elseif ($_POST["drp_action"] == "7") { /* reapply suggested naming to host */ print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>When you click save, the following graphs will be resized per your specifications.</p>\n\t\t\t\t\t<p>{$graph_list}</p>\n\t\t\t\t\t<p><strong>Graph Height:</strong><br>"; form_text_box("graph_height", "", "", "255", "30", "text"); print "</p>\n\t\t\t\t\t<p><strong>Graph Width:</strong><br>"; form_text_box("graph_width", "", "", "255", "30", "text"); print "</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t"; } elseif ($_POST["drp_action"] == "8") { /* place on tree */ $trees = db_fetch_assoc("select id,name from graph_tree order by name"); print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("When you click save, the following graphs will be placed under the branch selected\n\t\t\t\t\tbelow.") . "</p>\n\t\t\t\t\t<p>{$graph_list}</p>\n\t\t\t\t\t<p><strong>" . _("Destination Branch:") . "</strong><br>"; html_tree_dropdown_draw($matches[1], "tree_item_id", "0"); print "</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t<input type='hidden' name='tree_id' value='" . $matches[1] . "'>\n\n\t\t\t"; } if (!isset($graph_array)) { print "<tr><td bgcolor='#" . $colors["form_alternate1"] . "'><span class='textError'>" . _("You must select at least one graph.") . "</span></td></tr>\n"; $save_html = ""; } else { $save_html = "<input type='image' src='" . html_get_theme_images_path("button_yes.gif") . "' alt='" . _("Save") . "' align='absmiddle'>"; } print "\t<tr>\n\t\t\t<td align='right' bgcolor='#" . $colors["buttonbar_background"] . "'>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($graph_array) ? serialize($graph_array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . $_POST["drp_action"] . "'>\n\t\t\t\t<a href='graphs.php'><img src='" . html_get_theme_images_path("button_no.gif") . "' alt='" . _("Cancel") . "' align='absmiddle' border='0'></a>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n\t\t"; html_end_box(); require_once CACTI_BASE_PATH . "/include/bottom_footer.php"; }
function host_edit() { $_device_id = get_get_var_number("id"); if (empty($_device_id)) { $header_label = "[new]"; } else { $device = api_device_get($_device_id); /* get a list of each package that is associated with this device */ $packages = api_device_package_list($_device_id); $header_label = "[edit: " . $device["description"] . "]"; } if (!empty($device["id"])) { echo "<div>\n"; echo $device["description"] . " (" . $device["hostname"] . ")<br />\n"; echo _("SNMP Information") . "\n"; if ($device["snmp_community"] == "" && $device["snmpv3_auth_username"] == "") { echo "<span style='color: #ab3f1e; font-weight: bold;'>" . _("SNMP not in use") . "</span>\n"; } else { $snmp_system = cacti_snmp_get($device["hostname"], $device["snmp_community"], ".1.3.6.1.2.1.1.1.0", $device["snmp_version"], $device["snmpv3_auth_username"], $device["snmpv3_auth_password"], $device["snmpv3_auth_protocol"], $device["snmpv3_priv_passphrase"], $device["snmpv3_priv_protocol"], $device["snmp_port"], $device["snmp_timeout"], SNMP_WEBUI); if ($snmp_system == "") { echo "<span style='color: #ff0000; font-weight: bold;'>" . _("SNMP error") . "</span>\n"; } else { $snmp_uptime = cacti_snmp_get($device["hostname"], $device["snmp_community"], ".1.3.6.1.2.1.1.3.0", $device["snmp_version"], $device["snmpv3_auth_username"], $device["snmpv3_auth_password"], $device["snmpv3_auth_protocol"], $device["snmpv3_priv_passphrase"], $device["snmpv3_priv_protocol"], $device["snmp_port"], $device["snmp_timeout"], SNMP_WEBUI); $snmp_hostname = cacti_snmp_get($device["hostname"], $device["snmp_community"], ".1.3.6.1.2.1.1.5.0", $device["snmp_version"], $device["snmpv3_auth_username"], $device["snmpv3_auth_password"], $device["snmpv3_auth_protocol"], $device["snmpv3_priv_passphrase"], $device["snmpv3_priv_protocol"], $device["snmp_port"], $device["snmp_timeout"], SNMP_WEBUI); $snmp_location = cacti_snmp_get($device["hostname"], $device["snmp_community"], ".1.3.6.1.2.1.1.6.0", $device["snmp_version"], $device["snmpv3_auth_username"], $device["snmpv3_auth_password"], $device["snmpv3_auth_protocol"], $device["snmpv3_priv_passphrase"], $device["snmpv3_priv_protocol"], $device["snmp_port"], $device["snmp_timeout"], SNMP_WEBUI); $snmp_contact = cacti_snmp_get($device["hostname"], $device["snmp_community"], ".1.3.6.1.2.1.1.4.0", $device["snmp_version"], $device["snmpv3_auth_username"], $device["snmpv3_auth_password"], $device["snmpv3_auth_protocol"], $device["snmpv3_priv_passphrase"], $device["snmpv3_priv_protocol"], $device["snmp_port"], $device["snmp_timeout"], SNMP_WEBUI); echo "<strong>System:</strong> {$snmp_system}<br>\n"; $days = intval($snmp_uptime / (60 * 60 * 24 * 100)); $remainder = $snmp_uptime % (60 * 60 * 24 * 100); $hours = intval($remainder / (60 * 60 * 100)); $remainder = $remainder % (60 * 60 * 100); $minutes = intval($remainder / (60 * 100)); echo "<strong>" . _("Uptime:") . "</strong> {$snmp_uptime}"; echo " ({$days} days, {$hours} hours, {$minutes} minutes)<br>\n"; echo "<strong>" . _("Hostname:") . "</strong> {$snmp_hostname}<br>\n"; echo "<strong>" . _("Location:") . "</strong> {$snmp_location}<br>\n"; echo "<strong>" . _("Contact:") . "</strong> {$snmp_contact}<br>\n"; } } ?> </span> </div> <div> <span style="color: #c16921;">*</span><a href="graphs_new.php?host_id=<?php print $host["id"]; ?> "><?php echo _("Create Graphs for this Host"); ?> </a> </div> <br /> <?php } form_start("devices.php", "form_device"); html_start_box("<strong>" . _("Devices") . "</strong> {$header_label}"); _device_field__description("description", isset($device["description"]) ? $device["description"] : "", isset($device["id"]) ? $device["id"] : "0"); _device_field__hostname("hostname", isset($device["hostname"]) ? $device["hostname"] : "", isset($device["id"]) ? $device["id"] : "0"); _device_field__host_template_id("host_template_id", isset($device["host_template_id"]) ? $device["host_template_id"] : "", isset($device["id"]) ? $device["id"] : "0"); _device_field__poller_id("poller_id", isset($device["poller_id"]) ? $device["poller_id"] : "", isset($device["id"]) ? $device["id"] : "0"); _device_field__disabled("disabled", isset($device["disabled"]) ? $device["disabled"] : "", isset($device["id"]) ? $device["id"] : "0"); echo ui_html_box_heading_make("SNMP Options"); _device_field__snmp_version("snmp_version", isset($device["snmp_version"]) ? $device["snmp_version"] : "", isset($device["id"]) ? $device["id"] : "0"); _device_field__snmp_community("snmp_community", isset($device["snmp_community"]) ? $device["snmp_community"] : "", isset($device["id"]) ? $device["id"] : "0"); _device_field__snmp_port("snmp_port", isset($device["snmp_port"]) ? $device["snmp_port"] : "", isset($device["id"]) ? $device["id"] : "0"); _device_field__snmp_timeout("snmp_timeout", isset($device["snmp_timeout"]) ? $device["snmp_timeout"] : "", isset($device["id"]) ? $device["id"] : "0"); echo ui_html_box_heading_make("SNMPv3 Authentication"); _device_field__snmpv3_auth_username("snmpv3_auth_username", isset($device["snmpv3_auth_username"]) ? $device["snmpv3_auth_username"] : "", isset($device["id"]) ? $device["id"] : "0"); _device_field__snmpv3_auth_password("snmpv3_auth_password", isset($device["snmpv3_auth_password"]) ? $device["snmpv3_auth_password"] : "", isset($device["id"]) ? $device["id"] : "0"); _device_field__snmpv3_auth_protocol("snmpv3_auth_protocol", isset($device["snmpv3_auth_protocol"]) ? $device["snmpv3_auth_protocol"] : "", isset($device["id"]) ? $device["id"] : "0"); _device_field__snmpv3_priv_passphrase("snmpv3_priv_passphrase", isset($device["snmpv3_priv_passphrase"]) ? $device["snmpv3_priv_passphrase"] : "", isset($device["id"]) ? $device["id"] : "0"); _device_field__snmpv3_priv_protocol("snmpv3_priv_protocol", isset($device["snmpv3_priv_protocol"]) ? $device["snmpv3_priv_protocol"] : "", isset($device["id"]) ? $device["id"] : "0"); html_end_box(); if (isset($_GET["display_dq_details"]) && isset($_SESSION["debug_log"]["data_query"])) { html_start_box("<strong>" . _("Data Query Debug Information") . "</strong>"); echo "<tr><td><span style='font-family: monospace;'>" . debug_log_return("data_query") . "</span></td></tr>"; html_end_box(); } if (!empty($_device_id)) { html_start_box("<strong>" . _("Assigned Packages") . "</strong>"); html_header(array(_("Package Name")), 2); if (sizeof($packages) > 0) { foreach ($packages as $package) { ?> <tr class="item"> <td style="padding: 4px;"> <?php echo $package["name"]; ?> </td> <td align="right" style="padding: 4px;"> <a href="devices.php?action=remove_package&id=<?php echo $_device_id; ?> &package_id=<?php echo $package["id"]; ?> "><img src="<?php echo html_get_theme_images_path("delete_icon_large.gif"); ?> " alt="<?php echo _("Delete Package Assignment"); ?> " border="0" align="absmiddle"></a> </td> </tr> <?php } } else { ?> <tr class="empty"> <td colspan="2"> No packages have been assigned to this device. </td> </tr> <?php } ?> <tr> <td style="border-top: 1px solid #b5b5b5; padding: 1px;" colspan="2"> <table width="100%" cellpadding="2" cellspacing="0"> <tr> <td> Add package: <?php form_dropdown("assoc_package_id", api_package_list(), "name", "id", "", "", ""); ?> </td> <td align="right"> <input type="image" src="<?php echo html_get_theme_images_path('button_add.gif'); ?> " alt="<?php echo _('Add'); ?> " name="assoc_package_add" align="absmiddle"> </td> </tr> </table> </td> </tr> <?php html_end_box(); } form_hidden_box("id", $_device_id); form_hidden_box("action_post", "device_edit"); form_save_button("devices.php", "save_device"); }
function package() { $menu_items = array( "remove" => "Remove", "duplicate" => "Duplicate" ); $filter_array = array(); /* search field: filter (searches package name) */ if (isset_get_var("search_filter")) { $filter_array["name"] = get_get_var("search_filter"); } /* get a list of all packages on this page */ $packages = api_package_list($filter_array); form_start("packages.php"); $box_id = "1"; html_start_box("<strong>" . _("Template Packages") . "</strong>", "packages.php?action=new"); html_header_checkbox(array(_("Name"), _("Author"), _("Category")), $box_id); $i = 0; if (sizeof($packages) > 0) { foreach ($packages as $package) { ?> <tr class="item" id="box-<?php echo $box_id;?>-row-<?php echo $package["id"];?>" onClick="display_row_select('<?php echo $box_id;?>',document.forms[0],'box-<?php echo $box_id;?>-row-<?php echo $package["id"];?>', 'box-<?php echo $box_id;?>-chk-<?php echo $package["id"];?>')" onMouseOver="display_row_hover('box-<?php echo $box_id;?>-row-<?php echo $package["id"];?>')" onMouseOut="display_row_clear('box-<?php echo $box_id;?>-row-<?php echo $package["id"];?>')"> <td class="title"> <a onClick="display_row_block('box-<?php echo $box_id;?>-row-<?php echo $package["id"];?>')" href="packages.php?action=view&id=<?php echo $package["id"];?>"><span id="box-<?php echo $box_id;?>-text-<?php echo $package["id"];?>"><?php echo html_highlight_words(get_get_var("search_filter"), $package["name"]);?></span></a> </td> <td> Ian Berry </td> <td> <?php echo $package["category"];?> </td> <td class="checkbox" align="center"> <input type='checkbox' name='box-<?php echo $box_id;?>-chk-<?php echo $package["id"];?>' id='box-<?php echo $box_id;?>-chk-<?php echo $package["id"];?>' title="<?php echo $package["name"];?>"> </td> </tr> <?php } }else{ ?> <tr class="empty"> <td colspan="6"> No template packages found. </td> </tr> <?php } html_box_toolbar_draw($box_id, "0", "3", HTML_BOX_SEARCH_NONE); html_end_box(false); //html_box_actions_menu_draw($box_id, "0", $menu_items); html_box_actions_area_create($box_id); form_hidden_box("action_post", "package_list"); form_end(); echo "<br />\n"; form_start("packages.php", "import_package", true); html_start_box("<strong>" . _("Import Package") . "</strong>"); _package_import_field__file("import_package_file"); _package_import_field__text("import_package_text"); ?> <tr> <td style="border-top: 1px solid #b5b5b5; padding: 1px;" colspan="2"> <table width="100%" cellpadding="2" cellspacing="0"> <tr> <td align="right"> <input type="image" src="<?php echo html_get_theme_images_path('button_import.gif');?>" alt="<?php echo _('Import');?>" name="package_import" align="absmiddle"> </td> </tr> </table> </td> </tr> <?php html_end_box(); form_hidden_box("action", "save"); form_hidden_box("action_post", "package_import"); form_end(); //print_a(htmlspecialchars(package_export("1"))); ?> <script language="JavaScript"> <!-- function action_area_handle_type(box_id, type, parent_div, parent_form) { if (type == 'remove') { parent_div.appendChild(document.createTextNode('Are you sure you want to remove these data templates?')); parent_div.appendChild(action_area_generate_selected_rows(box_id)); action_area_update_header_caption(box_id, 'Remove Data Template'); action_area_update_submit_caption(box_id, 'Remove'); action_area_update_selected_rows(box_id, parent_form); }else if (type == 'duplicate') { parent_div.appendChild(document.createTextNode('Are you sure you want to duplicate these data templates?')); parent_div.appendChild(action_area_generate_selected_rows(box_id)); parent_div.appendChild(action_area_generate_input('text', 'box-' + box_id + '-action-area-txt1', '')); action_area_update_header_caption(box_id, 'Duplicate Data Templates'); action_area_update_submit_caption(box_id, 'Duplicate'); action_area_update_selected_rows(box_id, parent_form); } } --> </script> <?php }
echo ui_html_header_navigation_group_make("templates", array("Packages" => "packages.php", "Graph Templates" => "graph_templates.php", "Data Templates" => "data_templates.php", "Device Templates" => "device_templates.php")); ?> <?php echo ui_html_header_navigation_group_make("configuration", array("System Settings" => "settings.php", "User Settings" => "user_settings.php", "Data Presets" => "presets.php", "Plugins" => "plugins.php", "System Utilities" => "utilities.php", "Log Management" => "logs.php")); ?> <?php echo ui_html_header_navigation_group_make("users", array("Manage" => "auth_user.php", "Groups" => "auth_group.php")); ?> </div> </div> <div id="content"> <div id="sidebar"> <div id="sidebar_navigation"> <a href="#" onClick="navigation_sidebar_toggle()"><img src="<?php echo html_get_theme_images_path("side_search.gif"); ?> " border="0" alt="Search" title="Search"></a> </div> <div id="sidebar_content"> <div> filter:<br /> <input type="text" size="18" name"x"> </div> <div> graph type:<br /> <input type="text" size="18" name"x"> </div> <div> device:<br /> <input type="text" size="18" name"x">