";
if ($form_title != "") { print "$form_title \n"; }
print "$form_description\n\n";
}
/* creates a standard html textbox */
function form_text_box($form_name, $form_previous_value, $form_default_value, $form_max_length, $form_size = 30) {
if ($form_previous_value == "") {
$form_previous_value = htmlspecialchars($form_default_value);
}
print "
\n\n
\n";
}
/* creates a standard hidden html textbox */
function form_hidden_box($form_name, $form_previous_value, $form_default_value) {
if ($form_previous_value == "") {
$form_previous_value = $form_default_value;
}
print "\n";
}
/* creates a dropdown box from a sql string */
function form_dropdown($form_name, $form_data, $column_display,$column_id, $form_previous_value, $form_none_entry, $form_default_value) {
if ($form_previous_value == "") {
$form_previous_value = htmlspecialchars($form_default_value);
}
if (isset($_SESSION["sess_field_values"])) {
if (!empty($_SESSION["sess_field_values"][$form_name])) {
$form_previous_value = htmlspecialchars($_SESSION["sess_field_values"][$form_name]);
}
}
print "
\n
\n";
}
/* creates a checkbox */
function form_checkbox($form_name, $form_previous_value, $form_caption, $form_default_value, $current_id = 0) {
if (($form_previous_value == "") && (empty($current_id))) {
$form_previous_value = $form_default_value;
}
if (isset($_SESSION["sess_field_values"])) {
if (!empty($_SESSION["sess_field_values"][$form_name])) {
$form_previous_value = htmlspecialchars($_SESSION["sess_field_values"][$form_name]);
}
}
print "
$form_caption\n
\n";
}
/* creates a radio */
function form_radio_button($form_name, $form_previous_value, $form_current_value, $form_caption, $form_default_value) {
if ($form_previous_value == "") {
$form_previous_value = $form_default_value;
}
if (isset($_SESSION["sess_field_values"])) {
if (!empty($_SESSION["sess_field_values"][$form_name])) {
$form_previous_value = htmlspecialchars($_SESSION["sess_field_values"][$form_name]);
}
}
print "
$form_caption\n
\n";
}
/* creates a text area with a user defined rows and cols */
function form_text_area($form_name, $form_previous_value, $form_rows, $form_columns, $form_default_value) {
if ($form_previous_value == "") {
$form_previous_value = htmlspecialchars($form_default_value);
}
if (isset($_SESSION["sess_field_values"])) {
if (!empty($_SESSION["sess_field_values"][$form_name])) {
$form_previous_value = htmlspecialchars($_SESSION["sess_field_values"][$form_name]);
}
}
print "
\n
\n";
}
/* creates a hidden text box containing the ID */
function form_hidden_id($form_name, $form_id) {
if ($form_id == "") {
$form_id = 0;
}
print "\n";
}
/* creates a dropdown box from a sql string */
function form_color_dropdown($form_name, $form_previous_value, $form_none_entry, $form_default_value) {
if ($form_previous_value=="") {
$form_previous_value = $form_default_value;
}
$colors_list = db_fetch_assoc("select id,hex from colors order by hex desc");
?>
\n";
break;
case 'drop_multi_rra':
$array_rra = array_rekey(db_fetch_assoc("select id,name from rra order by name"), "id", "name");
form_multi_dropdown($field_name,$array_rra,db_fetch_assoc("select * from data_template_data_rra where data_template_data_id=$extra_id_1"), $field_name);
break;
}
}
function draw_templated_item($array_struct, $field_name, $previous_value, $extra_id_1 = 0) {
global $config;
include ($config["include_path"] . "/config_arrays.php");
switch ($array_struct["type"]) {
case 'check':
print "
";
break;
case 'drop_multi_rra':
$rras = db_fetch_assoc("select rra.name from data_template_data_rra,rra where data_template_data_rra.rra_id=rra.id and data_template_data_rra.data_template_data_id=$extra_id_1");
print "
";
if (sizeof($rras) > 0) {
foreach ($rras as $rra) {
print $rra["name"] . " ";
}
}
print "
";
break;
default:
print "
" . $previous_value . "
";
break;
}
form_hidden_box($field_name,$previous_value,"");
}
function draw_templated_row($array_struct, $field_name, $previous_value) {
global $colors, $row_counter;
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$row_counter); $row_counter++;
print "
\n";
draw_nontemplated_item($array_struct, $field_name, $previous_value);
print "\n";
}
function draw_tree_dropdown($current_tree_id) {
global $colors;
$html = "";
$tree_list = get_graph_tree_array();
if (isset($_GET["tree_id"])) {
$_SESSION["sess_view_tree_id"] = $current_tree_id;
}
/* if there is a current tree, make sure it still exists before going on */
if ((!empty($_SESSION["sess_view_tree_id"])) && (db_fetch_cell("select id from graph_tree where id=" . $_SESSION["sess_view_tree_id"]) == "")) {
$_SESSION["sess_view_tree_id"] = 0;
}
/* set a default tree if none is already selected */
if (empty($_SESSION["sess_view_tree_id"])) {
if (db_fetch_cell("select id from graph_tree where id=" . read_graph_config_option("default_tree_id")) > 0) {
$_SESSION["sess_view_tree_id"] = read_graph_config_option("default_tree_id");
}else{
if (sizeof($tree_list) > 0) {
$_SESSION["sess_view_tree_id"] = $tree_list[0]["id"];
}
}
}
/* make the dropdown list of trees */
if (sizeof($tree_list) > 1) {
$html ="\n";
}elseif (sizeof($tree_list) == 1) {
/* there is only one tree; use it */
//print "
";
}
return $html;
}
function draw_menu() {
global $colors, $config;
include ($config["include_path"] . "/config_arrays.php");
print "
\n";
foreach (array_keys($menu) as $header) {
print "
$header
\n";
if (sizeof($menu[$header]) > 0) {
foreach (array_keys($menu[$header]) as $url) {
if (basename($_SERVER["PHP_SELF"]) == basename($url)) {
print "