function item() { global $colors, $consolidation_functions, $graph_item_types; /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); /* ==================================================== */ if (empty($_GET["id"])) { $template_item_list = array(); $header_label = "[new]"; } else { $template_item_list = db_fetch_assoc("select\n\t\t\tgraph_templates_item.id,\n\t\t\tgraph_templates_item.text_format,\n\t\t\tgraph_templates_item.value,\n\t\t\tgraph_templates_item.hard_return,\n\t\t\tgraph_templates_item.graph_type_id,\n\t\t\tgraph_templates_item.consolidation_function_id,\n\t\t\tCONCAT_WS(' - ',data_template_data.name,data_template_rrd.data_source_name) as data_source_name,\n\t\t\tcdef.name as cdef_name,\n\t\t\tcolors.hex\n\t\t\tfrom graph_templates_item\n\t\t\tleft join data_template_rrd on (graph_templates_item.task_item_id=data_template_rrd.id)\n\t\t\tleft join data_local on (data_template_rrd.local_data_id=data_local.id)\n\t\t\tleft join data_template_data on (data_local.id=data_template_data.local_data_id)\n\t\t\tleft join cdef on (cdef_id=cdef.id)\n\t\t\tleft join colors on (color_id=colors.id)\n\t\t\twhere graph_templates_item.graph_template_id=" . $_GET["id"] . "\n\t\t\tand graph_templates_item.local_graph_id=0\n\t\t\torder by graph_templates_item.sequence"); $header_label = "[edit: " . db_fetch_cell("select name from graph_templates where id=" . $_GET["id"]) . "]"; } html_start_box("<strong>Graph Template Items</strong> {$header_label}", "100%", $colors["header"], "3", "center", "graph_templates_items.php?action=item_edit&graph_template_id=" . $_GET["id"]); draw_graph_items_list($template_item_list, "graph_templates_items.php", "graph_template_id=" . $_GET["id"], false); html_end_box(); html_start_box("<strong>Graph Item Inputs</strong>", "100%", $colors["header"], "3", "center", "graph_templates_inputs.php?action=input_edit&graph_template_id=" . $_GET["id"]); print "<tr bgcolor='#" . $colors["header_panel"] . "'>"; DrawMatrixHeaderItem("Name", $colors["header_text"], 2); print "</tr>"; $template_item_list = db_fetch_assoc("select id,name from graph_template_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["alternate"], $colors["light"], $i); ?> <td> <a class="linkEditMain" href="graph_templates_inputs.php?action=input_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=input_remove&id=<?php print $item["id"]; ?> &graph_template_id=<?php print $_GET["id"]; ?> "><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a> </td> </tr> <?php $i++; } } else { print "<tr bgcolor='#" . $colors["form_alternate2"] . "'><td colspan='2'><em>No Inputs</em></td></tr>"; } html_end_box(); }
function draw_graph_items_list($item_list, $filename, $url_data, $disable_controls) { global $colors, $config; include($config["include_path"] . "/config_arrays.php"); print "<tr bgcolor='#" . $colors["header_panel"] . "'>"; DrawMatrixHeaderItem("Graph Item",$colors["header_text"],1); DrawMatrixHeaderItem("Data Source",$colors["header_text"],1); DrawMatrixHeaderItem("Graph Item Type",$colors["header_text"],1); DrawMatrixHeaderItem("CF Type",$colors["header_text"],1); DrawMatrixHeaderItem("Item Color",$colors["header_text"],4); print "</tr>"; $group_counter = 0; $_graph_type_name = ""; $i = 0; $alternate_color_1 = $colors["alternate"]; $alternate_color_2 = $colors["alternate"]; if (sizeof($item_list) > 0) { foreach ($item_list as $item) { /* graph grouping display logic */ $this_row_style = ""; $use_custom_row_color = false; $hard_return = ""; if ($graph_item_types{$item["graph_type_id"]} != "GPRINT") { $this_row_style = "font-weight: bold;"; $use_custom_row_color = true; if ($group_counter % 2 == 0) { $alternate_color_1 = "EEEEEE"; $alternate_color_2 = "EEEEEE"; $custom_row_color = "D5D5D5"; }else{ $alternate_color_1 = $colors["alternate"]; $alternate_color_2 = $colors["alternate"]; $custom_row_color = "D2D6E7"; } $group_counter++; } $_graph_type_name = $graph_item_types{$item["graph_type_id"]}; /* alternating row color */ if ($use_custom_row_color == false) { form_alternate_row_color($alternate_color_1,$alternate_color_2,$i); }else{ print "<tr bgcolor='#$custom_row_color'>"; } print "<td>"; if ($disable_controls == false) { print "<a href='$filename?action=item_edit&id=" . $item["id"] . "&$url_data'>"; } print "<strong>Item # " . ($i+1) . "</strong>"; if ($disable_controls == false) { print "</a>"; } print "</td>\n"; if (empty($item["data_source_name"])) { $item["data_source_name"] = "No Task"; } switch (true) { case ereg("(AREA|STACK|GPRINT|LINE[123])", $_graph_type_name): $matrix_title = "(" . $item["data_source_name"] . "): " . $item["text_format"]; break; case ereg("(HRULE|VRULE)", $_graph_type_name): $matrix_title = "HRULE: " . $item["value"]; break; case ereg("(COMMENT)", $_graph_type_name): $matrix_title = "COMMENT: " . $item["text_format"]; break; } if ($item["hard_return"] == "on") { $hard_return = "<strong><font color=\"#FF0000\"><HR></font></strong>"; } print "<td style='$this_row_style'>" . htmlspecialchars($matrix_title) . $hard_return . "</td>\n"; print "<td style='$this_row_style'>" . $graph_item_types{$item["graph_type_id"]} . "</td>\n"; print "<td style='$this_row_style'>" . $consolidation_functions{$item["consolidation_function_id"]} . "</td>\n"; print "<td" . ((!empty($item["hex"])) ? " bgcolor='#" . $item["hex"] . "'" : "") . " width='1%'> </td>\n"; print "<td style='$this_row_style'>" . $item["hex"] . "</td>\n"; if ($disable_controls == false) { print "<td><a href='$filename?action=item_movedown&id=" . $item["id"] . "&$url_data'><img src='images/move_down.gif' border='0' alt='Move Down'></a> <a href='$filename?action=item_moveup&id=" . $item["id"] . "&$url_data'><img src='images/move_up.gif' border='0' alt='Move Up'></a></td>\n"; print "<td align='right'><a href='$filename?action=item_remove&id=" . $item["id"] . "&$url_data'><img src='images/delete_icon.gif' width='10' height='10' border='0' alt='Delete'></a></td>\n"; } print "</tr>"; $i++; } }else{ print "<tr bgcolor='#" . $colors["form_alternate2"] . "'><td colspan='7'><em>No Items</em></td></tr>"; } }
function cdef() { global $colors; html_start_box("<strong>CDEF's</strong>", "98%", $colors["header"], "3", "center", "cdef.php?action=edit"); print "<tr bgcolor='#" . $colors["header_panel"] . "'>"; DrawMatrixHeaderItem("Name",$colors["header_text"],1); DrawMatrixHeaderItem(" ",$colors["header_text"],1); print "</tr>"; $cdefs = db_fetch_assoc("select * from cdef order by name"); $i = 0; if (sizeof($cdefs) > 0) { foreach ($cdefs as $cdef) { form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++; ?> <td> <a class="linkEditMain" href="cdef.php?action=edit&id=<?php print $cdef["id"];?>"><?php print $cdef["name"];?></a> </td> <td align="right"> <a href="cdef.php?action=remove&id=<?php print $cdef["id"];?>"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a> </td> </tr> <?php } } html_end_box(); }
function mactrack_snmp_edit() { global $config, $fields_mactrack_snmp_edit; include_once $config['base_path'] . '/plugins/mactrack/lib/mactrack_functions.php'; /* ================= input validation ================= */ get_filter_request_var('id'); get_filter_request_var('page'); /* ==================================================== */ /* clean up rule name */ if (isset_request_var('name')) { set_request_var('name', sanitize_search_string(get_request_var('name'))); } /* remember these search fields in session vars so we don't have to keep passing them around */ load_current_session_value('page', 'sess_mactrack_edit_current_page', '1'); load_current_session_value('rows', 'sess_default_rows', read_config_option('num_rows_table')); /* display the mactrack snmp option set */ $snmp_group = array(); if (!isempty_request_var('id')) { $snmp_group = db_fetch_row_prepared('SELECT * FROM mac_track_snmp where id = ?', array(get_request_var('id'))); $header_label = __('SNMP Option Set [edit: %s]', $snmp_group['name']); } else { $header_label = __('SNMP Option Set [new]'); } form_start('mactrack_snmp.php', 'mactrack_snmp_group'); html_start_box($header_label, '100%', '', '3', 'center', ''); draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => inject_form_variables($fields_mactrack_snmp_edit, $snmp_group))); html_end_box(); form_hidden_box('id', isset_request_var('id') ? get_request_var('id') : '0', ''); form_hidden_box('save_component_mactrack_snmp', '1', ''); if (!isempty_request_var('id')) { $items = db_fetch_assoc_prepared('SELECT * FROM mac_track_snmp_items WHERE snmp_id= ? ORDER BY sequence', array(get_request_var('id'))); html_start_box(__('Mactrack SNMP Options'), '100%', '', '3', 'center', 'mactrack_snmp.php?action=item_edit&id=' . get_request_var('id')); print "<tr class='tableHeader'>"; DrawMatrixHeaderItem(__('Item'), '', 1); DrawMatrixHeaderItem(__('Version'), '', 1); DrawMatrixHeaderItem(__('Community'), '', 1); DrawMatrixHeaderItem(__('Port'), '', 1); DrawMatrixHeaderItem(__('Timeout'), '', 1); DrawMatrixHeaderItem(__('Retries'), '', 1); DrawMatrixHeaderItem(__('Max OIDs'), '', 1); DrawMatrixHeaderItem(__('Username'), '', 1); DrawMatrixHeaderItem(__('Auth Proto'), '', 1); DrawMatrixHeaderItem(__('Priv Proto'), '', 1); DrawMatrixHeaderItem(__('Actions'), '', 1); print '</tr>'; $i = 1; if (sizeof($items)) { foreach ($items as $item) { form_alternate_row(); $form_data = '<td><a class="linkEditMain" href="' . htmlspecialchars('mactrack_snmp.php?action=item_edit&item_id=' . $item['id'] . '&id=' . $item['snmp_id']) . '">Item#' . $i . '</a></td>'; $form_data .= '<td>' . $item['snmp_version'] . '</td>'; $form_data .= '<td>' . ($item['snmp_version'] == 3 ? __('N/A') : $item['snmp_readstring']) . '</td>'; $form_data .= '<td>' . $item['snmp_port'] . '</td>'; $form_data .= '<td>' . $item['snmp_timeout'] . '</td>'; $form_data .= '<td>' . $item['snmp_retries'] . '</td>'; $form_data .= '<td>' . $item['max_oids'] . '</td>'; $form_data .= '<td>' . ($item['snmp_version'] == 3 ? $item['snmp_username'] : __('N/A')) . '</td>'; $form_data .= '<td>' . ($item['snmp_version'] == 3 ? $item['snmp_auth_protocol'] : __('N/A')) . '</td>'; $form_data .= '<td>' . ($item['snmp_version'] == 3 ? $item['snmp_priv_protocol'] : __('N/A')) . '</td>'; $form_data .= '<td class="right">' . ($i < sizeof($items) ? '<a class="remover fa fa-caret-down moveArrow" href="' . htmlspecialchars($config['url_path'] . 'plugins/mactrack/mactrack_snmp.php?action=item_movedown&item_id=' . $item["id"] . '&id=' . $item["snmp_id"]) . '"></a>' : '<span class="moveArrowNone"></span>') . ($i > 1 ? '<a class="remover fa fa-caret-up moveArrow" href="' . htmlspecialchars($config['url_path'] . 'plugins/mactrack/mactrack_snmp.php?action=item_moveup&item_id=' . $item["id"] . '&id=' . $item["snmp_id"]) . '"></a>' : '<span class="moveArrowNone"></span>'); $form_data .= '<a class="delete deleteMarker fa fa-remove" href="' . htmlspecialchars($config['url_path'] . 'plugins/mactrack/mactrack_snmp.php?action=item_remove&item_id=' . $item["id"] . '&id=' . $item["snmp_id"]) . '"></a>' . '</td></tr>'; print $form_data; $i++; } } else { print '<tr><td colspan="5"><em>' . __('No SNMP Items') . '</em></td></tr>'; } html_end_box(); } form_save_button('mactrack_snmp.php'); }
function data_edit() { global $fields_data_input_edit; /* ================= input validation ================= */ input_validate_input_number(get_request_var_request('id')); /* ==================================================== */ if (!empty($_REQUEST['id'])) { $data_input = db_fetch_row_prepared('SELECT * FROM data_input WHERE id = ?', array(get_request_var_request('id'))); $header_label = '[edit: ' . htmlspecialchars($data_input['name']) . ']'; } else { $header_label = '[new]'; } html_start_box("<strong>Data Input Methods</strong> {$header_label}", '100%', '', '3', 'center', ''); draw_edit_form(array('config' => array(), 'fields' => inject_form_variables($fields_data_input_edit, isset($data_input) ? $data_input : array()))); html_end_box(); if (!empty($_REQUEST['id'])) { html_start_box('<strong>Input Fields</strong>', '100%', '', '3', 'center', 'data_input.php?action=field_edit&type=in&data_input_id=' . htmlspecialchars(get_request_var_request('id'))); print "<tr class='tableHeader'>"; DrawMatrixHeaderItem('Name', '', 1); DrawMatrixHeaderItem('Field Order', '', 1); DrawMatrixHeaderItem('Friendly Name', '', 2); print '</tr>'; $fields = db_fetch_assoc_prepared("SELECT id, data_name, name, sequence FROM data_input_fields WHERE data_input_id = ? AND input_output = 'in' ORDER BY sequence, data_name", array(get_request_var_request('id'))); $i = 0; if (sizeof($fields) > 0) { foreach ($fields as $field) { form_alternate_row('', true); ?> <td> <a class="linkEditMain" href="<?php print htmlspecialchars('data_input.php?action=field_edit&id=' . $field['id'] . '&data_input_id=' . $_REQUEST['id']); ?> "><?php print htmlspecialchars($field['data_name']); ?> </a> </td> <td> <?php print $field['sequence']; if ($field['sequence'] == '0') { print ' (Not In Use)'; } ?> </td> <td> <?php print htmlspecialchars($field['name']); ?> </td> <td align="right"> <a href="<?php print htmlspecialchars('data_input.php?action=field_remove&id=' . $field['id'] . '&data_input_id=' . $_REQUEST['id']); ?> "><img src="images/delete_icon.gif" style="height:10px;width:10px;" border="0" alt="Delete"></a> </td> </tr> <?php } } else { print '<tr><td><em>No Input Fields</em></td></tr>'; } html_end_box(); html_start_box('<strong>Output Fields</strong>', '100%', '', '3', 'center', 'data_input.php?action=field_edit&type=out&data_input_id=' . $_REQUEST['id']); print "<tr class='tableHeader'>"; DrawMatrixHeaderItem('Name', '', 1); DrawMatrixHeaderItem('Field Order', '', 1); DrawMatrixHeaderItem('Friendly Name', '', 1); DrawMatrixHeaderItem('Update RRA', '', 2); print '</tr>'; $fields = db_fetch_assoc_prepared("SELECT id, name, data_name, update_rra, sequence FROM data_input_fields WHERE data_input_id = ? and input_output = 'out' ORDER BY sequence, data_name", array(get_request_var_request('id'))); $i = 0; if (sizeof($fields) > 0) { foreach ($fields as $field) { form_alternate_row('', true); ?> <td> <a class="linkEditMain" href="<?php print htmlspecialchars('data_input.php?action=field_edit&id=' . $field['id'] . '&data_input_id=' . $_REQUEST['id']); ?> "><?php print htmlspecialchars($field['data_name']); ?> </a> </td> <td> <?php print $field['sequence']; if ($field['sequence'] == '0') { print ' (Not In Use)'; } ?> </td> <td> <?php print htmlspecialchars($field['name']); ?> </td> <td> <?php print html_boolean_friendly($field['update_rra']); ?> </td> <td align="right"> <a href="<?php print htmlspecialchars('data_input.php?action=field_remove&id=' . $field['id'] . '&data_input_id=' . $_REQUEST['id']); ?> "><img src="images/delete_icon.gif" style="height:10px;width:10px;" border="0" alt="Delete"></a> </td> </tr> <?php } } else { print '<tr><td><em>No Output Fields</em></td></tr>'; } html_end_box(); } form_save_button('data_input.php', 'return'); }
function tree() { global $colors; /* modify for multi user start */ if ($_SESSION["permission"] < ACCESS_ADMINISTRATOR) { html_start_box("<strong>Graph Trees</strong>", "100%", $colors["header"], "3", "center", ""); } else { html_start_box("<strong>Graph Trees</strong>", "100%", $colors["header"], "3", "center", "tree.php?action=edit"); } /* modify for multi user end */ print "<tr bgcolor='#" . $colors["header_panel"] . "'>"; DrawMatrixHeaderItem("Name", $colors["header_text"], 1); DrawMatrixHeaderItem(" ", $colors["header_text"], 1); print "</tr>"; /* modify for multi user start */ if ($_SESSION["permission"] < ACCESS_ADMINISTRATOR) { $trees = db_fetch_assoc("SELECT * FROM graph_tree WHERE id = '" . $_SESSION["public_tree_id"] . "' OR id = '" . $_SESSION["private_tree_id"] . "' ORDER BY name"); } else { $tree_id = db_fetch_cell("\r\n SELECT graph_tree.id FROM graph_tree \r\n\t INNER JOIN user_auth_perms ON graph_tree.id = user_auth_perms.item_id AND user_auth_perms.type = '2'\r\n\t INNER JOIN user_auth ON user_auth_perms.user_id = user_auth.id AND user_auth.username = '******'\r\n\t WHERE graph_tree.id != '" . $_SESSION["public_tree_id"] . "'"); $trees = db_fetch_assoc("SELECT * FROM graph_tree WHERE id = '" . $_SESSION["public_tree_id"] . "' OR id = '" . $_SESSION["private_tree_id"] . "' OR id = '{$tree_id}' ORDER BY name"); } /* modify for multi user end */ $i = 0; if (sizeof($trees) > 0) { foreach ($trees as $tree) { form_alternate_row_color($colors["alternate"], $colors["light"], $i); $i++; ?> <td> <a class="linkEditMain" href="<?php print htmlspecialchars("tree.php?action=edit&id=" . $tree["id"]); ?> "><?php print htmlspecialchars($tree["name"]); ?> </a> </td> <td align="right"> <?php /* modify for multi user end */ if ($_SESSION["permission"] == ACCESS_ADMINISTRATOR) { ?> <a href="<?php print htmlspecialchars("tree.php?action=remove&id=" . $tree["id"]); ?> "><img src="images/delete_icon.gif" style="height:10px;width:10px;" border="0" alt="Delete"></a> <?php } /* modify for multi user end */ ?> </td> </tr> <?php } /* modify for multi user start */ if ($_SESSION["permission"] == ACCESS_ADMINISTRATOR) { form_alternate_row_color($colors["alternate"], $colors["light"], $i); $i++; print "<td><form method='post' autocomplete='off' action='tree.php'><input id='user_name' name='user_name' type ='text' size='8'><input type='submit' value='SEARCH' title='SEARCH'></form></td><td align='right'></td></tr>"; } /* modify for multi user end */ } else { print "<tr><td><em>No Graphs Trees</em></td></tr>\n"; } html_end_box(); }
function cdef_edit() { global $colors, $cdef_item_types, $fields_cdef_edit; /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); /* ==================================================== */ if (!empty($_GET["id"])) { $cdef = db_fetch_row("select * from cdef where id=" . $_GET["id"]); $header_label = "[edit: " . $cdef["name"] . "]"; }else{ $header_label = "[new]"; } html_start_box("<strong>CDEF's</strong> $header_label", "100%", $colors["header"], "3", "center", ""); draw_edit_form(array( "config" => array(), "fields" => inject_form_variables($fields_cdef_edit, (isset($cdef) ? $cdef : array())) )); html_end_box(); if (!empty($_GET["id"])) { html_start_box("", "100%", "aaaaaa", "3", "center", ""); draw_cdef_preview($_GET["id"]); html_end_box(); html_start_box("<strong>CDEF Items</strong>", "100%", $colors["header"], "3", "center", "cdef.php?action=item_edit&cdef_id=" . $cdef["id"]); print "<tr bgcolor='#" . $colors["header_panel"] . "'>"; DrawMatrixHeaderItem("Item",$colors["header_text"],1); DrawMatrixHeaderItem("Item Value",$colors["header_text"],1); DrawMatrixHeaderItem(" ",$colors["header_text"],2); print "</tr>"; $cdef_items = db_fetch_assoc("select * from cdef_items where cdef_id=" . $_GET["id"] . " order by sequence"); $i = 0; if (sizeof($cdef_items) > 0) { foreach ($cdef_items as $cdef_item) { form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++; ?> <td> <a class="linkEditMain" href="cdef.php?action=item_edit&id=<?php print $cdef_item["id"];?>&cdef_id=<?php print $cdef["id"];?>">Item #<?php print $i;?></a> </td> <td> <em><?php $cdef_item_type = $cdef_item["type"]; print $cdef_item_types[$cdef_item_type];?></em>: <strong><?php print get_cdef_item_name($cdef_item["id"]);?></strong> </td> <td> <a href="cdef.php?action=item_movedown&id=<?php print $cdef_item["id"];?>&cdef_id=<?php print $cdef["id"];?>"><img src="images/move_down.gif" border="0" alt="Move Down"></a> <a href="cdef.php?action=item_moveup&id=<?php print $cdef_item["id"];?>&cdef_id=<?php print $cdef["id"];?>"><img src="images/move_up.gif" border="0" alt="Move Up"></a> </td> <td align="right"> <a href="cdef.php?action=item_remove&id=<?php print $cdef_item["id"];?>&cdef_id=<?php print $cdef["id"];?>"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a> </td> </tr> <?php } } html_end_box(); } form_save_button("cdef.php"); }
function rra() { global $colors; html_start_box("<strong>Round Robin Archives</strong>", "98%", $colors["header"], "3", "center", "rra.php?action=edit"); print "<tr bgcolor='#" . $colors["header_panel"] . "'>"; DrawMatrixHeaderItem("Name",$colors["header_text"],1); DrawMatrixHeaderItem("Steps",$colors["header_text"],1); DrawMatrixHeaderItem("Rows",$colors["header_text"],1); DrawMatrixHeaderItem("Timespan",$colors["header_text"],2); print "</tr>"; $rras = db_fetch_assoc("select id,name,rows,steps,timespan from rra order by steps"); $i = 0; if (sizeof($rras) > 0) { foreach ($rras as $rra) { form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++; ?> <td> <a class="linkEditMain" href="rra.php?action=edit&id=<?php print $rra["id"];?>"><?php print $rra["name"];?></a> </td> <td> <?php print $rra["steps"];?> </td> <td> <?php print $rra["rows"];?> </td> <td> <?php print $rra["timespan"];?> </td> <td align="right"> <a href="rra.php?action=remove&id=<?php print $rra["id"];?>"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a> </td> </tr> <?php } } html_end_box(); }
function color() { html_start_box('<strong>Colors</strong>', '100%', '', '3', 'center', 'color.php?action=edit'); print "<tr class='tableHeader'>"; DrawMatrixHeaderItem('Hex Value', '', 1); DrawMatrixHeaderItem('Color', '', 1); DrawMatrixHeaderItem(' ', '', 1); DrawMatrixHeaderItem(' ', '', 1); DrawMatrixHeaderItem('Hex Value', '', 1); DrawMatrixHeaderItem('Color', '', 1); DrawMatrixHeaderItem(' ', '', 1); DrawMatrixHeaderItem(' ', '', 1); DrawMatrixHeaderItem('Hex Value', '', 1); DrawMatrixHeaderItem('Color', '', 1); DrawMatrixHeaderItem(' ', '', 1); DrawMatrixHeaderItem(' ', '', 1); DrawMatrixHeaderItem('Hex Value', '', 1); DrawMatrixHeaderItem('Color', '', 1); DrawMatrixHeaderItem(' ', '', 1); print '</tr>'; $color_list = db_fetch_assoc('SELECT * FROM colors ORDER BY hex'); $i = 0; if (sizeof($color_list) > 0) { $j = 0; ## even/odd counter foreach ($color_list as $color) { $j++; if ($j % 4 == 1) { form_alternate_row('', true); ?> <td width='1'> <a class="linkEditMain" style='display:block;' href="<?php print htmlspecialchars('color.php?action=edit&id=' . $color['id']); ?> "><?php print $color['hex']; ?> </a> </td> <td bgcolor="#<?php print $color['hex']; ?> " width="10%"> </td> <td align="right"> <a href="<?php print htmlspecialchars('color.php?action=remove&id=' . $color['id']); ?> "><img src="images/delete_icon.gif" style="height:10px;width:10px;" border="0" alt="Delete"></a> </td> <?php $j = 1; } elseif ($j % 4 == 2 || $j % 4 == 3) { ?> <td></td> <td width='1'> <a class="linkEditMain" style='display:block;' href="<?php print htmlspecialchars('color.php?action=edit&id=' . $color['id']); ?> "><?php print $color['hex']; ?> </a> </td> <td bgcolor="#<?php print $color['hex']; ?> " width="10%"> </td> <td align="right"> <a href="<?php print htmlspecialchars('color.php?action=remove&id=' . $color['id']); ?> "><img src="images/delete_icon.gif" style="height:10px;width:10px;" border="0" alt="Delete"></a> </td> <?php $j = $j++; } else { ?> <td></td> <td width='1'> <a class="linkEditMain" style='display:block;' href="<?php print htmlspecialchars('color.php?action=edit&id=' . $color['id']); ?> "><?php print $color['hex']; ?> </a> </td> <td bgcolor="#<?php print $color['hex']; ?> " width="10%"> </td> <td align="right"> <a href="<?php print htmlspecialchars('color.php?action=remove&id=' . $color['id']); ?> "><img src="images/delete_icon.gif" style="height:10px;width:10px;" border="0" alt="Delete"></a> </td> </tr> <?php } } ## check for completion of odd number second column: ?> <td colspan=<?php print (4 - $j) * 4; ?> ></td> </tr> <?php } html_end_box(); }
function data() { global $colors, $input_types; html_start_box("<strong>Data Input Methods</strong>", "98%", $colors["header"], "3", "center", "data_input.php?action=edit"); print "<tr bgcolor='#" . $colors["header_panel"] . "'>"; DrawMatrixHeaderItem("Name",$colors["header_text"],1); DrawMatrixHeaderItem("Data Input Method",$colors["header_text"],1); DrawMatrixHeaderItem(" ",$colors["header_text"],1); print "</tr>"; $data_inputs = db_fetch_assoc("select * from data_input order by name"); $i = 0; if (sizeof($data_inputs) > 0) { foreach ($data_inputs as $data_input) { form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++; ?> <td> <a class="linkEditMain" href="data_input.php?action=edit&id=<?php print $data_input["id"];?>"><?php print $data_input["name"];?></a> </td> <td> <?php print $input_types{$data_input["type_id"]};?> </td> <td align="right"> <a href="data_input.php?action=remove&id=<?php print $data_input["id"];?>"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a> </td> </tr> <?php } }else{ print "<tr><td><em>No Data Input Methods</em></td></tr>"; } html_end_box(); }
function color() { global $colors; html_start_box("<strong>Colors</strong>", "100%", $colors["header"], "3", "center", "color.php?action=edit"); print "<tr bgcolor='#" . $colors["header_panel"] . "'>"; DrawMatrixHeaderItem("Hex Value", $colors["header_text"], 1); DrawMatrixHeaderItem("Color", $colors["header_text"], 1); DrawMatrixHeaderItem(" ", $colors["header_text"], 1); DrawMatrixHeaderItem(" ", $colors["header_text"], 1); DrawMatrixHeaderItem("Hex Value", $colors["header_text"], 1); DrawMatrixHeaderItem("Color", $colors["header_text"], 1); DrawMatrixHeaderItem(" ", $colors["header_text"], 1); DrawMatrixHeaderItem(" ", $colors["header_text"], 1); DrawMatrixHeaderItem("Hex Value", $colors["header_text"], 1); DrawMatrixHeaderItem("Color", $colors["header_text"], 1); DrawMatrixHeaderItem(" ", $colors["header_text"], 1); DrawMatrixHeaderItem(" ", $colors["header_text"], 1); DrawMatrixHeaderItem("Hex Value", $colors["header_text"], 1); DrawMatrixHeaderItem("Color", $colors["header_text"], 1); DrawMatrixHeaderItem(" ", $colors["header_text"], 1); print "</tr>"; $color_list = db_fetch_assoc("select * from colors order by hex"); $i = 0; if (sizeof($color_list) > 0) { $j = 0; ## even/odd counter foreach ($color_list as $color) { $j++; if ($j % 4 == 1) { form_alternate_row_color($colors["alternate"], $colors["light"], $i); $i++; ?> <td width='1'> <a class="linkEditMain" style='display:block;' href="color.php?action=edit&id=<?php print $color["id"]; ?> "><?php print $color["hex"]; ?> </a> </td> <td bgcolor="#<?php print $color["hex"]; ?> " width="10%"> </td> <td align="right"> <a href="color.php?action=remove&id=<?php print $color["id"]; ?> "><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a> </td> <?php $j = 1; } elseif ($j % 4 == 2 || $j % 4 == 3) { ?> <td></td> <td width='1'> <a class="linkEditMain" style='display:block;' href="color.php?action=edit&id=<?php print $color["id"]; ?> "><?php print $color["hex"]; ?> </a> </td> <td bgcolor="#<?php print $color["hex"]; ?> " width="10%"> </td> <td align="right"> <a href="color.php?action=remove&id=<?php print $color["id"]; ?> "><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a> </td> <?php $j = $j++; } else { ?> <td></td> <td width='1'> <a class="linkEditMain" style='display:block;' href="color.php?action=edit&id=<?php print $color["id"]; ?> "><?php print $color["hex"]; ?> </a> </td> <td bgcolor="#<?php print $color["hex"]; ?> " width="10%"> </td> <td align="right"> <a href="color.php?action=remove&id=<?php print $color["id"]; ?> "><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a> </td> </tr> <?php } } ## check for completion of odd number second column: if ($j == 1) { ?> <td colspan=4></td> </tr> <?php } } html_end_box(); }
function mactrack_snmp_edit() { global $colors, $config, $fields_mactrack_snmp_edit; #print "<pre>Post: "; print_r($_POST); print "Get: "; print_r($_GET); print "Request: "; print_r($_REQUEST); print "Session: "; print_r($_SESSION); print "</pre>"; #include_once($config["base_path"]."/plugins/mactrack/mactrack_functions.php"); /* ================= input validation ================= */ input_validate_input_number(get_request_var_request("id")); input_validate_input_number(get_request_var_request("page")); /* ==================================================== */ /* clean up rule name */ if (isset($_REQUEST["name"])) { $_REQUEST["name"] = sanitize_search_string(get_request_var("name")); } /* remember these search fields in session vars so we don't have to keep passing them around */ load_current_session_value("page", "sess_mactrack_edit_current_page", "1"); load_current_session_value("rows", "sess_mactrack_edit_rows", read_config_option("num_rows_data_query")); /* display the mactrack snmp option set */ $snmp_group = array(); if (!empty($_GET["id"])) { $snmp_group = db_fetch_row("SELECT * FROM mac_track_snmp where id=" . $_GET["id"]); # setup header $header_label = "[edit: " . $snmp_group["name"] . "]"; }else{ $header_label = "[new]"; } print '<form name="mactrack_snmp_group" action="mactrack_snmp.php" method="post">'; html_start_box("<strong>SNMP Option Set</strong> $header_label", "100%", $colors["header"], "3", "center", ""); draw_edit_form(array( "config" => array("no_form_tag" => true), "fields" => inject_form_variables($fields_mactrack_snmp_edit, $snmp_group) )); html_end_box(); form_hidden_box("id", (isset($_GET["id"]) ? $_GET["id"] : "0"), ""); form_hidden_box("save_component_mactrack_snmp", "1", ""); if (!empty($_GET["id"])) { $items = db_fetch_assoc("SELECT * " . "FROM mac_track_snmp_items " . "WHERE snmp_id=" . $_GET["id"] . " ORDER BY sequence"); html_start_box("<strong>Mactrack SNMP Options</strong>", "100%", $colors["header"], "3", "center", htmlspecialchars("mactrack_snmp.php?action=item_edit&id=" . $_GET["id"])); print "<tr bgcolor='#" . $colors["header_panel"] . "'>"; DrawMatrixHeaderItem("Item",$colors["header_text"],1); DrawMatrixHeaderItem("Version",$colors["header_text"],1); DrawMatrixHeaderItem("Community",$colors["header_text"],1); DrawMatrixHeaderItem("Port",$colors["header_text"],1); DrawMatrixHeaderItem("Timeout",$colors["header_text"],1); DrawMatrixHeaderItem("Retries",$colors["header_text"],1); DrawMatrixHeaderItem("Max OIDs",$colors["header_text"],1); DrawMatrixHeaderItem("Username",$colors["header_text"],1); DrawMatrixHeaderItem("Password",$colors["header_text"],1); DrawMatrixHeaderItem("Auth Proto",$colors["header_text"],1); DrawMatrixHeaderItem("Priv Passphrase",$colors["header_text"],1); DrawMatrixHeaderItem("Priv Proto",$colors["header_text"],1); DrawMatrixHeaderItem("Context",$colors["header_text"],1); DrawMatrixHeaderItem(" ",$colors["header_text"],2); print "</tr>"; $i = 0; if (sizeof($items) > 0) { foreach ($items as $item) { form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++; $form_data = '<td><a class="linkEditMain" href="' . htmlspecialchars("mactrack_snmp.php?action=item_edit&item_id=" . $item["id"] . "&id=" . $item["snmp_id"]) . '">Item#' . $i . '</a></td>'; #$form_data .= '<td>' . $item["sequence"] . '</td>'; $form_data .= '<td>' . $item["snmp_version"] . '</td>'; $form_data .= '<td>' . ($item["snmp_version"] == 3 ? "none" : $item["snmp_readstring"]) . '</td>'; $form_data .= '<td>' . $item["snmp_port"] . '</td>'; $form_data .= '<td>' . $item["snmp_timeout"] . '</td>'; $form_data .= '<td>' . $item["snmp_retries"] . '</td>'; $form_data .= '<td>' . $item["max_oids"] . '</td>'; $form_data .= '<td>' . ($item["snmp_version"] == 3 ? $item["snmp_username"] : "******") . '</td>'; $form_data .= '<td>' . ($item["snmp_version"] == 3 ? $item["snmp_password"] : "******") . '</td>'; $form_data .= '<td>' . ($item["snmp_version"] == 3 ? $item["snmp_auth_protocol"] : "none") . '</td>'; $form_data .= '<td>' . ($item["snmp_version"] == 3 ? $item["snmp_priv_passphrase"] : "none") . '</td>'; $form_data .= '<td>' . ($item["snmp_version"] == 3 ? $item["snmp_priv_protocol"] : "none") . '</td>'; $form_data .= '<td>' . ($item["snmp_version"] == 3 ? $item["snmp_context"] : "none") . '</td>'; $form_data .= '<td>' . '<a href="' . htmlspecialchars('mactrack_snmp.php?action=item_movedown&item_id=' . $item["id"] . '&id=' . $item["snmp_id"]) . '"><img src="../../images/move_down.gif" border="0" alt="Move Down"></a>' . '<a href="' . htmlspecialchars('mactrack_snmp.php?action=item_moveup&item_id=' . $item["id"] . '&id=' . $item["snmp_id"]) . '"><img src="../../images/move_up.gif" border="0" alt="Move Up"></a>' . '</td>'; $form_data .= '<td align="right"><a href="' . htmlspecialchars('mactrack_snmp.php?action=item_remove&item_id=' . $item["id"] . '&id=' . $item["snmp_id"]) . '"><img src="../../images/delete_icon.gif" border="0" width="10" height="10" alt="Delete"></a>' . '</td></tr>'; print $form_data; } } else { print "<tr><td><em>No SNMP Items</em></td></tr>\n"; } html_end_box(); } mactrack_save_button("mactrack_snmp.php"); }
function item() { global $consolidation_functions, $graph_item_types; /* ================= input validation ================= */ input_validate_input_number(get_request_var_request("id")); /* ==================================================== */ if (empty($_REQUEST["id"])) { $template_item_list = array(); $header_label = "[new]"; } else { $template_item_list = db_fetch_assoc("SELECT\n\t\t\tgraph_templates_item.id,\n\t\t\tgraph_templates_item.text_format,\n\t\t\tgraph_templates_item.value,\n\t\t\tgraph_templates_item.hard_return,\n\t\t\tgraph_templates_item.graph_type_id,\n\t\t\tgraph_templates_item.consolidation_function_id,\n\t\t\tCONCAT_WS(' - ',data_template_data.name,data_template_rrd.data_source_name) AS data_source_name,\n\t\t\tcdef.name AS cdef_name,\n\t\t\tcolors.hex\n\t\t\tFROM graph_templates_item\n\t\t\tLEFT JOIN data_template_rrd ON (graph_templates_item.task_item_id=data_template_rrd.id)\n\t\t\tLEFT JOIN data_local ON (data_template_rrd.local_data_id=data_local.id)\n\t\t\tLEFT JOIN data_template_data ON (data_local.id=data_template_data.local_data_id)\n\t\t\tLEFT JOIN cdef ON (cdef_id=cdef.id)\n\t\t\tLEFT JOIN colors ON (color_id=colors.id)\n\t\t\tWHERE graph_templates_item.graph_template_id=" . $_REQUEST["id"] . "\n\t\t\tAND graph_templates_item.local_graph_id=0\n\t\t\tORDER BY graph_templates_item.sequence"); $header_label = "[edit: " . db_fetch_cell("SELECT name FROM graph_templates WHERE id=" . $_REQUEST["id"]) . "]"; } html_start_box("<strong>Graph Template Items</strong> " . htmlspecialchars($header_label), "100%", "", "3", "center", "graph_templates_items.php?action=item_edit&graph_template_id=" . htmlspecialchars(get_request_var_request("id"))); draw_graph_items_list($template_item_list, "graph_templates_items.php", "graph_template_id=" . $_REQUEST["id"], false); html_end_box(); html_start_box("<strong>Graph Item Inputs</strong>", "100%", "", "3", "center", "graph_templates_inputs.php?action=input_edit&graph_template_id=" . htmlspecialchars(get_request_var_request("id"))); print "<tr class='tableHeader'>"; DrawMatrixHeaderItem("Name", "", 2); print "</tr>"; $template_item_list = db_fetch_assoc("SELECT id,name FROM graph_template_input WHERE graph_template_id=" . $_REQUEST["id"] . " ORDER BY name"); $i = 0; if (sizeof($template_item_list) > 0) { foreach ($template_item_list as $item) { form_alternate_row('', true); ?> <td> <a class="linkEditMain" href="<?php print htmlspecialchars("graph_templates_inputs.php?action=input_edit&id=" . $item["id"] . "&graph_template_id=" . $_REQUEST["id"]); ?> "><?php print htmlspecialchars($item["name"]); ?> </a> </td> <td align="right"> <a href="<?php print htmlspecialchars("graph_templates_inputs.php?action=input_remove&id=" . $item["id"] . "&graph_template_id=" . $_REQUEST["id"]); ?> "><img src="images/delete_icon.gif" style="height:10px;width:10px;" border="0" alt="Delete"></a> </td> </tr> <?php } } else { print "<tr><td colspan='2'><em>No Inputs</em></td></tr>"; } html_end_box(); }
function tree() { html_start_box("<strong>Graph Trees</strong>", "100%", "", "3", "center", "tree.php?action=edit"); print "<tr class='tableHeader'>"; DrawMatrixHeaderItem("Name", "", 1); DrawMatrixHeaderItem(" ", "", 1); print "</tr>"; $trees = db_fetch_assoc("SELECT * FROM graph_tree ORDER BY name"); $i = 0; if (sizeof($trees) > 0) { foreach ($trees as $tree) { form_alternate_row('', true); ?> <td> <a class="linkEditMain" href="<?php print htmlspecialchars("tree.php?action=edit&id=" . $tree["id"]); ?> "><?php print htmlspecialchars($tree["name"]); ?> </a> </td> <td align="right"> <a href="<?php print htmlspecialchars("tree.php?action=remove&id=" . $tree["id"]); ?> "><img src="images/delete_icon.gif" style="height:10px;width:10px;" border="0" alt="Delete"></a> </td> </tr> <?php } } else { print "<tr><td><em>No Graphs Trees</em></td></tr>\n"; } html_end_box(); }
function data_query() { global $colors; html_start_box("<strong>Data Queries</strong>", "98%", $colors["header"], "3", "center", "data_queries.php?action=edit"); print "<tr bgcolor='#" . $colors["header_panel"] . "'>"; DrawMatrixHeaderItem("Name",$colors["header_text"],1); DrawMatrixHeaderItem("Data Input Method",$colors["header_text"],1); DrawMatrixHeaderItem(" ",$colors["header_text"],1); print "</tr>"; $snmp_queries = db_fetch_assoc("SELECT snmp_query.id, snmp_query.name, data_input.name AS data_input_method FROM snmp_query INNER JOIN data_input ON snmp_query.data_input_id = data_input.id ORDER BY snmp_query.name"); $i = 0; if (sizeof($snmp_queries) > 0) { foreach ($snmp_queries as $snmp_query) { form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++; ?> <td> <a class="linkEditMain" href="data_queries.php?action=edit&id=<?php print $snmp_query["id"];?>"><?php print $snmp_query["name"];?></a> </td> <td> <?php print $snmp_query["data_input_method"]; ?> </td> <td align="right"> <a href="data_queries.php?action=remove&id=<?php print $snmp_query["id"];?>"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a> </td> </tr> <?php } } html_end_box(); }
function data_edit() { global $colors, $fields_data_input_edit; /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); /* ==================================================== */ if (!empty($_GET["id"])) { $data_input = db_fetch_row("select * from data_input where id=" . $_GET["id"]); $header_label = "[edit: " . $data_input["name"] . "]"; } else { $header_label = "[new]"; } html_start_box("<strong>Data Input Methods</strong> {$header_label}", "100%", $colors["header"], "3", "center", ""); draw_edit_form(array("config" => array(), "fields" => inject_form_variables($fields_data_input_edit, isset($data_input) ? $data_input : array()))); html_end_box(); if (!empty($_GET["id"])) { html_start_box("<strong>Input Fields</strong>", "100%", $colors["header"], "3", "center", "data_input.php?action=field_edit&type=in&data_input_id=" . $_GET["id"]); print "<tr bgcolor='#" . $colors["header_panel"] . "'>"; DrawMatrixHeaderItem("Name", $colors["header_text"], 1); DrawMatrixHeaderItem("Field Order", $colors["header_text"], 1); DrawMatrixHeaderItem("Friendly Name", $colors["header_text"], 2); print "</tr>"; $fields = db_fetch_assoc("select id,data_name,name,sequence from data_input_fields where data_input_id=" . $_GET["id"] . " and input_output='in' order by sequence, data_name"); $i = 0; if (sizeof($fields) > 0) { foreach ($fields as $field) { form_alternate_row_color($colors["alternate"], $colors["light"], $i); $i++; ?> <td> <a class="linkEditMain" href="data_input.php?action=field_edit&id=<?php print $field["id"]; ?> &data_input_id=<?php print $_GET["id"]; ?> "><?php print $field["data_name"]; ?> </a> </td> <td> <?php print $field["sequence"]; if ($field["sequence"] == "0") { print " (Not In Use)"; } ?> </td> <td> <?php print $field["name"]; ?> </td> <td align="right"> <a href="data_input.php?action=field_remove&id=<?php print $field["id"]; ?> &data_input_id=<?php print $_GET["id"]; ?> "><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a> </td> </tr> <?php } } else { print "<tr><td><em>No Input Fields</em></td></tr>"; } html_end_box(); html_start_box("<strong>Output Fields</strong>", "100%", $colors["header"], "3", "center", "data_input.php?action=field_edit&type=out&data_input_id=" . $_GET["id"]); print "<tr bgcolor='#" . $colors["header_panel"] . "'>"; DrawMatrixHeaderItem("Name", $colors["header_text"], 1); DrawMatrixHeaderItem("Field Order", $colors["header_text"], 1); DrawMatrixHeaderItem("Friendly Name", $colors["header_text"], 1); DrawMatrixHeaderItem("Update RRA", $colors["header_text"], 2); print "</tr>"; $fields = db_fetch_assoc("select id,name,data_name,update_rra,sequence from data_input_fields where data_input_id=" . $_GET["id"] . " and input_output='out' order by sequence, data_name"); $i = 0; if (sizeof($fields) > 0) { foreach ($fields as $field) { form_alternate_row_color($colors["alternate"], $colors["light"], $i); $i++; ?> <td> <a class="linkEditMain" href="data_input.php?action=field_edit&id=<?php print $field["id"]; ?> &data_input_id=<?php print $_GET["id"]; ?> "><?php print $field["data_name"]; ?> </a> </td> <td> <?php print $field["sequence"]; if ($field["sequence"] == "0") { print " (Not In Use)"; } ?> </td> <td> <?php print $field["name"]; ?> </td> <td> <?php print html_boolean_friendly($field["update_rra"]); ?> </td> <td align="right"> <a href="data_input.php?action=field_remove&id=<?php print $field["id"]; ?> &data_input_id=<?php print $_GET["id"]; ?> "><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a> </td> </tr> <?php } } else { print "<tr><td><em>No Output Fields</em></td></tr>"; } html_end_box(); } form_save_button("data_input.php"); }
function tree() { global $colors; html_start_box("<strong>Graph Trees</strong>", "100%", $colors["header"], "3", "center", "tree.php?action=edit"); print "<tr bgcolor='#" . $colors["header_panel"] . "'>"; DrawMatrixHeaderItem("Name",$colors["header_text"],1); DrawMatrixHeaderItem(" ",$colors["header_text"],1); print "</tr>"; $trees = db_fetch_assoc("SELECT * FROM graph_tree ORDER BY name"); $i = 0; if (sizeof($trees) > 0) { foreach ($trees as $tree) { form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++; ?> <td> <a class="linkEditMain" href="tree.php?action=edit&id=<?php print $tree["id"];?>"><?php print $tree["name"];?></a> </td> <td align="right"> <a href="tree.php?action=remove&id=<?php print $tree["id"];?>"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a> </td> </tr> <?php } }else{ print "<tr><td><em>No Graphs Trees</em></td></tr>\n"; } html_end_box(); }
function cdef_edit() { global $cdef_item_types, $fields_cdef_edit; /* ================= input validation ================= */ input_validate_input_number(get_request_var_request('id')); /* ==================================================== */ if (!empty($_REQUEST['id'])) { $cdef = db_fetch_row_prepared('SELECT * FROM cdef WHERE id = ?', array(get_request_var_request('id'))); $header_label = '[edit: ' . htmlspecialchars($cdef['name']) . ']'; } else { $header_label = '[new]'; } html_start_box("<strong>CDEF's</strong> {$header_label}", '100%', '', '3', 'center', ''); draw_edit_form(array('config' => array(), 'fields' => inject_form_variables($fields_cdef_edit, isset($cdef) ? $cdef : array()))); html_end_box(); if (!empty($_REQUEST['id'])) { html_start_box('', '100%', '', '3', 'center', ''); draw_cdef_preview($_REQUEST['id']); html_end_box(); html_start_box('<strong>CDEF Items</strong>', '100%', '', '3', 'center', 'cdef.php?action=item_edit&cdef_id=' . $cdef['id']); print "<tr class='tableHeader'>"; DrawMatrixHeaderItem('Item', '', 1); DrawMatrixHeaderItem('Position', '', 1); DrawMatrixHeaderItem('Item Value', '', 2); print '</tr>'; $cdef_items = db_fetch_assoc_prepared('SELECT * FROM cdef_items WHERE cdef_id = ? ORDER BY sequence', array(get_request_var_request('id'))); $i = 0; if (sizeof($cdef_items) > 0) { foreach ($cdef_items as $cdef_item) { form_alternate_row(); $i++; ?> <td style='white-space:nowrap;'> <a class='linkEditMain' href='<?php print htmlspecialchars('cdef.php?action=item_edit&id=' . $cdef_item['id'] . '&cdef_id=' . $cdef['id']); ?> '>Item #<?php print htmlspecialchars($i); ?> </a> </td> <td align='left' width='50'> <a href='<?php print htmlspecialchars('cdef.php?action=item_movedown&id=' . $cdef_item['id'] . '&cdef_id=' . $cdef['id']); ?> '><img src='images/move_down.gif' border='0' alt='Move Down'></a> <a href='<?php print htmlspecialchars('cdef.php?action=item_moveup&id=' . $cdef_item['id'] . '&cdef_id=' . $cdef['id']); ?> '><img src='images/move_up.gif' border='0' alt='Move Up'></a> </td> <td> <em><?php $cdef_item_type = $cdef_item['type']; print $cdef_item_types[$cdef_item_type]; ?> </em>: <strong><?php print htmlspecialchars(get_cdef_item_name($cdef_item['id'])); ?> </strong> </td> <td align='right'> <a href='<?php print htmlspecialchars('cdef.php?action=item_remove&id=' . $cdef_item['id'] . '&cdef_id=' . $cdef['id']); ?> '><img src='images/delete_icon.gif' style='height:10px;width:10px;' border='0' alt='Delete'></a> </td> </tr> <?php } } html_end_box(); } form_save_button('cdef.php', 'return'); }