当前位置: 首页>>代码示例>>PHP>>正文


PHP draw_edit_form函数代码示例

本文整理汇总了PHP中draw_edit_form函数的典型用法代码示例。如果您正苦于以下问题:PHP draw_edit_form函数的具体用法?PHP draw_edit_form怎么用?PHP draw_edit_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了draw_edit_form函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: draw_page

function draw_page() {
	global $userinfo;
?>
<div class="container">
	<?php open_panel('edituser','User Information', false); ?>
	<div class="form-group col-md-6">
	<?php draw_edit_form($userinfo); ?>
	</div>
	<?php close_panel(); ?>
</div>
<?php 
}
开发者ID:rogerapras,项目名称:php_timeclock,代码行数:12,代码来源:profile.php

示例2: draw_edit_form_row

function draw_edit_form_row($field_array, $field_name, $previous_value) {
	$field_array["value"] = $previous_value;

	draw_edit_form(
		array(
			"config" => array(
				"no_form_tag" => true,
				"force_row_color" => "F5F5F5"
				),
			"fields" => array(
				$field_name => $field_array
				)
			)
		);
}
开发者ID:songchin,项目名称:Cacti,代码行数:15,代码来源:graphs_new_form.php

示例3: draw_edit_form_row

function draw_edit_form_row($field_array, $field_name, $previous_value)
{
    $field_array['value'] = $previous_value;
    draw_edit_form(array('config' => array('no_form_tag' => true, 'force_row_color' => 'F5F5F5'), 'fields' => array($field_name => $field_array)));
}
开发者ID:MrWnn,项目名称:cacti,代码行数:5,代码来源:graphs_new.php

示例4: graph_edit


//.........这里部分代码省略.........
			"none_value" => "None",
			"sql" => "select graph_templates.id,graph_templates.name from graph_templates order by name"
			),
		"host_id" => array(
			"method" => "drop_sql",
			"friendly_name" => "Host",
			"description" => "Choose the host that this graph belongs to.",
			"value" => (isset($_GET["host_id"]) ? $_GET["host_id"] : $host_id),
			"none_value" => "None",
			"sql" => "select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname"
			),
		"graph_template_graph_id" => array(
			"method" => "hidden",
			"value" => (isset($graphs) ? $graphs["id"] : "0")
			),
		"local_graph_id" => array(
			"method" => "hidden",
			"value" => (isset($graphs) ? $graphs["local_graph_id"] : "0")
			),
		"local_graph_template_graph_id" => array(
			"method" => "hidden",
			"value" => (isset($graphs) ? $graphs["local_graph_template_graph_id"] : "0")
			),
		"_graph_template_id" => array(
			"method" => "hidden",
			"value" => (isset($graphs) ? $graphs["graph_template_id"] : "0")
			),
		"_host_id" => array(
			"method" => "hidden",
			"value" => (isset($host_id) ? $host_id : "0")
			)
		);

	draw_edit_form(
		array(
			"config" => array(),
			"fields" => $form_array
			)
		);

	html_end_box();

	/* only display the "inputs" area if we are using a graph template for this graph */
	if (!empty($graphs["graph_template_id"])) {
		html_start_box("<strong>Supplemental Graph Template Data</strong>", "100%", $colors["header"], "3", "center", "");

		print "<form method='post' action='graphs.php'>\n";

		draw_nontemplated_fields_graph($graphs["graph_template_id"], $graphs, "|field|", "<strong>Graph Fields</strong>", true, true, 0);
		draw_nontemplated_fields_graph_item($graphs["graph_template_id"], $_GET["id"], "|field|_|id|", "<strong>Graph Item Fields</strong>", true);

		html_end_box();
	}

	/* graph item list goes here */
	if ((!empty($_GET["id"])) && (empty($graphs["graph_template_id"]))) {
		item();
	}

	if (!empty($_GET["id"])) {
		?>
		<table width="100%" align="center">
			<tr>
				<td align="center" class="textInfo" colspan="2">
					<img src="graph_image.php?action=edit&local_graph_id=<?php print $_GET["id"];?>&rra_id=<?php print read_graph_config_option("default_rra_id");?>" alt="">
				</td>
开发者ID:songchin,项目名称:Cacti,代码行数:67,代码来源:graphs.php

示例5: template_edit

function template_edit()
{
    global $struct_data_source, $struct_data_source_item, $data_source_types, $fields_data_template_template_edit;
    /* ================= input validation ================= */
    input_validate_input_number(get_request_var("id"));
    input_validate_input_number(get_request_var("view_rrd"));
    /* ==================================================== */
    if (!empty($_GET["id"])) {
        $template_data = db_fetch_row("select * from data_template_data where data_template_id=" . $_GET["id"] . " and local_data_id=0");
        $template = db_fetch_row("select * from data_template where id=" . $_GET["id"]);
        $header_label = "[edit: " . $template["name"] . "]";
    } else {
        $header_label = "[new]";
    }
    html_start_box("<strong>Data Templates</strong> " . htmlspecialchars($header_label), "100%", "", "3", "center", "");
    draw_edit_form(array("config" => array(), "fields" => inject_form_variables($fields_data_template_template_edit, isset($template) ? $template : array(), isset($template_data) ? $template_data : array(), $_GET)));
    html_end_box();
    html_start_box("<strong>Data Source</strong>", "100%", "", "3", "center", "");
    /* make sure 'data source path' doesn't show up for a template... we should NEVER template this field */
    unset($struct_data_source["data_source_path"]);
    $form_array = array();
    while (list($field_name, $field_array) = each($struct_data_source)) {
        $form_array += array($field_name => $struct_data_source[$field_name]);
        if ($field_array["flags"] == "ALWAYSTEMPLATE") {
            $form_array[$field_name]["description"] = "<em>This field is always templated.</em>";
        } else {
            $form_array[$field_name]["description"] = "";
            $form_array[$field_name]["sub_checkbox"] = array("name" => "t_" . $field_name, "friendly_name" => "Use Per-Data Source Value (Ignore this Value)", "value" => isset($template_data["t_" . $field_name]) ? $template_data["t_" . $field_name] : "");
        }
        $form_array[$field_name]["value"] = isset($template_data[$field_name]) ? $template_data[$field_name] : "";
        $form_array[$field_name]["form_id"] = isset($template_data) ? $template_data["data_template_id"] : "0";
    }
    draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => inject_form_variables($form_array, isset($template_data) ? $template_data : array())));
    html_end_box();
    /* fetch ALL rrd's for this data source */
    if (!empty($_GET["id"])) {
        $template_data_rrds = db_fetch_assoc("select id,data_source_name from data_template_rrd where data_template_id=" . $_GET["id"] . " and local_data_id=0 order by data_source_name");
    }
    /* select the first "rrd" of this data source by default */
    if (empty($_GET["view_rrd"])) {
        $_GET["view_rrd"] = isset($template_data_rrds[0]["id"]) ? $template_data_rrds[0]["id"] : "0";
    }
    /* get more information about the rrd we chose */
    if (!empty($_GET["view_rrd"])) {
        $template_rrd = db_fetch_row("select * from data_template_rrd where id=" . $_GET["view_rrd"]);
    }
    $i = 0;
    if (isset($template_data_rrds)) {
        if (sizeof($template_data_rrds) > 1) {
            /* draw the data source tabs on the top of the page */
            print "\t<table class='tabs' width='100%' cellspacing='0' cellpadding='3' align='center'>\n\t\t\t\t<tr>\n";
            foreach ($template_data_rrds as $template_data_rrd) {
                $i++;
                print "\t<td " . ($template_data_rrd["id"] == $_GET["view_rrd"] ? "class='tabSelected tab'" : "class='tabNotSelected tab'") . " width='" . (strlen($template_data_rrd["data_source_name"]) * 9 + 50) . "' align='center'>\n\t\t\t\t\t\t\t<span class='textHeader'><a href='" . htmlspecialchars("data_templates.php?action=template_edit&id=" . $_GET["id"] . "&view_rrd=" . $template_data_rrd["id"]) . "'>{$i}: " . htmlspecialchars($template_data_rrd["data_source_name"]) . "</a> <a href='" . htmlspecialchars("data_templates.php?action=rrd_remove&id=" . $template_data_rrd["id"] . "&data_template_id=" . $_GET["id"]) . "'><img src='images/delete_icon.gif' border='0' alt='Delete'></a></span>\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t<td width='1'></td>\n";
            }
            print "\n\t\t\t\t<td></td>\n\n\t\t\t\t</tr>\n\t\t\t</table>\n";
        } elseif (sizeof($template_data_rrds) == 1) {
            $_GET["view_rrd"] = $template_data_rrds[0]["id"];
        }
    }
    html_start_box("", "100%", "", "3", "center", "");
    print "\t<tr class='cactiTableTitle'>\n\t\t\t<td class='textHeaderDark'>\n\t\t\t\t<strong>Data Source Item</strong> [" . (isset($template_rrd) ? htmlspecialchars($template_rrd["data_source_name"]) : "") . "]\n\t\t\t</td>\n\t\t\t<td class='textHeaderDark' align='right'>\n\t\t\t\t" . (!empty($_GET["id"]) ? "<strong><a class='linkOverDark' href='" . htmlspecialchars("data_templates.php?action=rrd_add&id=" . $_GET["id"]) . "'>New</a>&nbsp;</strong>" : "") . "\n\t\t\t</td>\n\t\t</tr>\n";
    /* data input fields list */
    if (empty($template_data["data_input_id"]) || db_fetch_cell("select type_id from data_input where id=" . $template_data["data_input_id"]) != "1" && db_fetch_cell("select type_id from data_input where id=" . $template_data["data_input_id"]) != "5") {
        unset($struct_data_source_item["data_input_field_id"]);
    } else {
        $struct_data_source_item["data_input_field_id"]["sql"] = "select id,CONCAT(data_name,' - ',name) as name from data_input_fields where data_input_id=" . $template_data["data_input_id"] . " and input_output='out' and update_rra='on' order by data_name,name";
    }
    $form_array = array();
    while (list($field_name, $field_array) = each($struct_data_source_item)) {
        $form_array += array($field_name => $struct_data_source_item[$field_name]);
        $form_array[$field_name]["description"] = "";
        $form_array[$field_name]["value"] = isset($template_rrd) ? $template_rrd[$field_name] : "";
        $form_array[$field_name]["sub_checkbox"] = array("name" => "t_" . $field_name, "friendly_name" => "Use Per-Data Source Value (Ignore this Value)", "value" => isset($template_rrd) ? $template_rrd["t_" . $field_name] : "");
    }
    draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => $form_array + array("data_template_rrd_id" => array("method" => "hidden", "value" => isset($template_rrd) ? $template_rrd["id"] : "0"))));
    html_end_box();
    $i = 0;
    if (!empty($_GET["id"])) {
        /* get each INPUT field for this data input source */
        $fields = db_fetch_assoc("select * from data_input_fields where data_input_id=" . $template_data["data_input_id"] . " and input_output='in' order by name");
        html_start_box("<strong>Custom Data</strong> [data input: " . htmlspecialchars(db_fetch_cell("select name from data_input where id=" . $template_data["data_input_id"])) . "]", "100%", "", "3", "center", "");
        /* loop through each field found */
        if (sizeof($fields) > 0) {
            foreach ($fields as $field) {
                $data_input_data = db_fetch_row("select t_value,value from data_input_data where data_template_data_id=" . $template_data["id"] . " and data_input_field_id=" . $field["id"]);
                if (sizeof($data_input_data) > 0) {
                    $old_value = $data_input_data["value"];
                } else {
                    $old_value = "";
                }
                form_alternate_row();
                ?>
				<td width="50%">
					<strong><?php 
                print $field["name"];
                ?>
</strong><br>
					<?php 
                form_checkbox("t_value_" . $field["data_name"], $data_input_data["t_value"], "Use Per-Data Source Value (Ignore this Value)", "", "", $_GET["id"]);
//.........这里部分代码省略.........
开发者ID:teddywen,项目名称:cacti,代码行数:101,代码来源:data_templates.php

示例6: thold_graphs_action_prepare

function thold_graphs_action_prepare($save)
{
    global $colors, $config;
    if ($save["drp_action"] == "plugin_thold_create") {
        /* get the valid thold templates
         * remove those hosts that do not have any valid templates
         */
        $templates = "";
        $found_list = "";
        $not_found = "";
        if (sizeof($save["graph_array"])) {
            foreach ($save["graph_array"] as $item) {
                $data_template_id = db_fetch_cell("SELECT dtr.data_template_id\r\n\t\t\t\t FROM data_template_rrd AS dtr\r\n\t\t\t\t LEFT JOIN graph_templates_item AS gti\r\n\t\t\t\t ON gti.task_item_id=dtr.id\r\n\t\t\t\t LEFT JOIN graph_local AS gl\r\n\t\t\t\t ON gl.id=gti.local_graph_id\r\n\t\t\t\t WHERE gl.id={$item}");
                if ($data_template_id != "") {
                    if (sizeof(db_fetch_assoc("SELECT id FROM thold_template WHERE data_template_id={$data_template_id}"))) {
                        $found_list .= "<li>" . get_graph_title($item) . "</li>";
                        if (strlen($templates)) {
                            $templates .= ", {$data_template_id}";
                        } else {
                            $templates = "{$data_template_id}";
                        }
                    } else {
                        $not_found .= "<li>" . get_graph_title($item) . "</li>";
                    }
                } else {
                    $not_found .= "<li>" . get_graph_title($item) . "</li>";
                }
            }
        }
        if (strlen($templates)) {
            $sql = "SELECT id, name FROM thold_template WHERE data_template_id IN (" . $templates . ") ORDER BY name";
        } else {
            $sql = "SELECT id, name FROM thold_template ORDER BY name";
        }
        print "\t<tr>\r\n\t\t\t\t<td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>";
        if (strlen($found_list)) {
            if (strlen($not_found)) {
                print "<p>The following Graphs have no Threshold Templates associated with them</p>";
                print "<ul>" . $not_found . "</ul>";
            }
            print "<p>Are you sure you wish to create Thresholds for these Graphs?</p>\r\n\t\t\t\t\t<ul>" . $found_list . "</ul>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\n\r\n\t\t\t\t";
            $form_array = array('general_header' => array('friendly_name' => 'Available Threshold Templates', 'method' => 'spacer'), 'thold_template_id' => array('method' => 'drop_sql', 'friendly_name' => 'Select a Threshold Template', 'description' => '', 'none_value' => 'None', 'value' => 'None', 'sql' => $sql));
            draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => $form_array));
        } else {
            if (strlen($not_found)) {
                print "<p>There are no Threshold Templates associated with the following Graphs</p>";
                print "<ul>" . $not_found . "</ul>";
            }
        }
    } else {
        return $save;
    }
}
开发者ID:caiorasec,项目名称:thold,代码行数:53,代码来源:setup.php

示例7: template_edit

function template_edit()
{
    global $fields_host_template_edit;
    /* ================= input validation ================= */
    input_validate_input_number(get_request_var_request('id'));
    /* ==================================================== */
    if (!empty($_REQUEST['id'])) {
        $host_template = db_fetch_row_prepared('SELECT * FROM host_template WHERE id = ?', array(get_request_var_request('id')));
        $header_label = '[edit: ' . $host_template['name'] . ']';
    } else {
        $header_label = '[new]';
        $_REQUEST['id'] = 0;
    }
    html_start_box('<strong>Device Templates</strong> ' . htmlspecialchars($header_label), '100%', '', '3', 'center', '');
    draw_edit_form(array('config' => array('form_name' => 'chk'), 'fields' => inject_form_variables($fields_host_template_edit, isset($host_template) ? $host_template : array())));
    /* we have to hide this button to make a form change in the main form trigger the correct
     * submit action */
    echo "<div style='display:none;'><input type='submit' value='Default Submit Button'></div>";
    html_end_box();
    if (!empty($_REQUEST['id'])) {
        html_start_box('<strong>Associated Graph Templates</strong>', '100%', '', '3', 'center', '');
        $selected_graph_templates = db_fetch_assoc_prepared('SELECT
			graph_templates.id,
			graph_templates.name
			FROM (graph_templates,host_template_graph)
			WHERE graph_templates.id = host_template_graph.graph_template_id
			AND host_template_graph.host_template_id = ?
			ORDER BY graph_templates.name', array(get_request_var_request('id')));
        $i = 0;
        if (sizeof($selected_graph_templates) > 0) {
            foreach ($selected_graph_templates as $item) {
                form_alternate_row('', true);
                ?>
					<td style="padding: 4px;">
						<strong><?php 
                print $i;
                ?>
)</strong> <?php 
                print htmlspecialchars($item['name']);
                ?>
					</td>
					<td align="right">
						<a href='<?php 
                print htmlspecialchars('host_templates.php?action=item_remove_gt&id=' . $item['id'] . '&host_template_id=' . $_REQUEST['id']);
                ?>
'><img src='images/delete_icon.gif' style="height:10px;width:10px;" border='0' alt='Delete'></a>
					</td>
				<?php 
                form_end_row();
                $i++;
            }
        } else {
            print '<tr><td><em>No associated graph templates.</em></td></tr>';
        }
        ?>
		<tr class='odd'>
			<td colspan="2">
				<table cellspacing="0" cellpadding="1" width="100%">
					<td nowrap>Add Graph Template:&nbsp;
						<?php 
        form_dropdown('graph_template_id', db_fetch_assoc_prepared('SELECT
							graph_templates.id,
							graph_templates.name
							FROM graph_templates LEFT JOIN host_template_graph
							ON (graph_templates.id = host_template_graph.graph_template_id AND host_template_graph.host_template_id = ?)
							WHERE host_template_graph.host_template_id is null
							ORDER BY graph_templates.name', array(get_request_var_request('id'))), 'name', 'id', '', '', '');
        ?>
					</td>
					<td align="right">
						&nbsp;<input type="submit" value="Add" name="add_gt_x" title="Add Graph Template to Device Template">
					</td>
				</table>
			</td>
		</tr>

		<?php 
        html_end_box();
        html_start_box('<strong>Associated Data Queries</strong>', '100%', '', '3', 'center', '');
        $selected_data_queries = db_fetch_assoc_prepared('SELECT
			snmp_query.id,
			snmp_query.name
			FROM (snmp_query, host_template_snmp_query)
			WHERE snmp_query.id = host_template_snmp_query.snmp_query_id
			AND host_template_snmp_query.host_template_id = ?
			ORDER BY snmp_query.name', array(get_request_var_request('id')));
        $i = 0;
        if (sizeof($selected_data_queries) > 0) {
            foreach ($selected_data_queries as $item) {
                form_alternate_row('', true);
                ?>
					<td style="padding: 4px;">
						<strong><?php 
                print $i;
                ?>
)</strong> <?php 
                print htmlspecialchars($item['name']);
                ?>
					</td>
					<td align='right'>
//.........这里部分代码省略.........
开发者ID:MrWnn,项目名称:cacti,代码行数:101,代码来源:host_templates.php

示例8: mactrack_site_edit

function mactrack_site_edit()
{
    global $fields_mactrack_site_edit;
    /* ================= input validation ================= */
    get_filter_request_var('site_id');
    /* ==================================================== */
    display_output_messages();
    if (!isempty_request_var('site_id')) {
        $site = db_fetch_row('SELECT * FROM mac_track_sites WHERE site_id=' . get_request_var('site_id'));
        $header_label = __('MacTrack Site [edit: %s]', $site['site_name']);
    } else {
        $header_label = __('MacTrack Site [new]');
    }
    form_start('mactrack_sites.php');
    html_start_box($header_label, '100%', '', '3', 'center', '');
    draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => inject_form_variables($fields_mactrack_site_edit, isset($site) ? $site : array())));
    html_end_box();
    form_save_button('mactrack_sites.php', 'return', 'site_id');
}
开发者ID:Cacti,项目名称:plugin_mactrack,代码行数:19,代码来源:mactrack_sites.php

示例9: thold_add_graphs_action_prepare

function thold_add_graphs_action_prepare()
{
    global $config;
    $local_graph_id = get_filter_request_var('local_graph_id');
    top_header();
    html_start_box(__('Create Threshold from Template'), '60%', '', '3', 'center', '');
    form_start('thold.php?action=add');
    /* get the valid thold templates
     * remove those hosts that do not have any valid templates
     */
    $templates = '';
    $found_list = '';
    $not_found = '';
    $data_template_id = db_fetch_cell("SELECT dtr.data_template_id\n\t\t FROM data_template_rrd AS dtr\n\t\t LEFT JOIN graph_templates_item AS gti\n\t\t ON gti.task_item_id=dtr.id\n\t\t LEFT JOIN graph_local AS gl\n\t\t ON gl.id=gti.local_graph_id\n\t\t WHERE gl.id={$local_graph_id}");
    if ($data_template_id != '') {
        if (sizeof(db_fetch_assoc("SELECT id FROM thold_template WHERE data_template_id={$data_template_id}"))) {
            $found_list .= '<li>' . get_graph_title($local_graph_id) . '</li>';
            if (strlen($templates)) {
                $templates .= ", {$data_template_id}";
            } else {
                $templates = "{$data_template_id}";
            }
        } else {
            $not_found .= '<li>' . get_graph_title($local_graph_id) . '</li>';
        }
    } else {
        $not_found .= '<li>' . get_graph_title($local_graph_id) . '</li>';
    }
    if (strlen($templates)) {
        $sql = 'SELECT id, name FROM thold_template WHERE data_template_id IN (' . $templates . ') ORDER BY name';
    } else {
        $sql = 'SELECT id, name FROM thold_template ORDER BY name';
    }
    print "<tr><td colspan='2' class='textArea'>\n";
    if (strlen($found_list)) {
        if (strlen($not_found)) {
            print '<p>' . __('The following Graph has no Threshold Templates associated with them.') . '</p>';
            print '<ul>' . $not_found . '</ul>';
        }
        print '<p>' . __('Are you sure you wish to create Thresholds for this Graph?') . '
			<ul>' . $found_list . "</ul>\n\t\t\t</td>\n\t\t</tr>\n";
        if (isset_request_var('tree_id')) {
            get_filter_request_var('tree_id');
        } else {
            set_request_var('tree_id', '');
        }
        if (isset_request_var('leaf_id')) {
            get_filter_request_var('leaf_id');
        } else {
            set_request_var('leaf_id', '');
        }
        $form_array = array('general_header' => array('friendly_name' => __('Available Threshold Templates'), 'method' => 'spacer'), 'thold_template_id' => array('method' => 'drop_sql', 'friendly_name' => __('Select a Threshold Template'), 'description' => '', 'none_value' => __('None'), 'value' => __('None'), 'sql' => $sql), 'usetemplate' => array('method' => 'hidden', 'value' => 1), 'local_graph_id' => array('method' => 'hidden', 'value' => $local_graph_id));
        draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => $form_array));
    } else {
        if (strlen($not_found)) {
            print '<p>' . __('There are no Threshold Templates associated with the following Graph.') . '</p>';
            print '<ul>' . $not_found . '</ul>';
        }
        $form_array = array('general_header' => array('friendly_name' => __('Please select an action'), 'method' => 'spacer'), 'doaction' => array('method' => 'drop_array', 'friendly_name' => __('Threshold Action'), 'description' => __('You may either create a new Threshold Template, or an non-templated Threshold from this screen.'), 'value' => 'None', 'array' => array(1 => __('Create a new Threshold'), 2 => __('Create a Threshold Template'))), 'usetemplate' => array('method' => 'hidden', 'value' => 1), 'local_graph_id' => array('method' => 'hidden', 'value' => $local_graph_id));
        draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => $form_array));
    }
    if (!strlen($not_found)) {
        $save_html = "<input type='submit' value='" . __('Continue') . "'>";
        print "<tr>\n\t\t\t<td colspan='2' class='saveRow'>\n\t\t\t\t<input type='hidden' id='action' value='actions'>\n\t\t\t\t<input type='button' onClick='cactiReturnTo()' value='" . __('Cancel') . "' title='" . __('Cancel') . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n";
    } else {
        $save_html = "<input type='submit' value='" . __('Continue') . "'>";
        print "<tr>\n\t\t\t<td colspan='2' class='saveRow'>\n\t\t\t\t<input type='button' onClick='cactiReturnTo()' value='" . __('Cancel') . "' title='" . __('Cancel') . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n";
    }
    html_end_box();
    print "<script type='text/javascript'>\$(function() { applySkin() ;});</script>";
    bottom_footer();
}
开发者ID:Cacti,项目名称:plugin_thold,代码行数:72,代码来源:thold_webapi.php

示例10: syslog_uninstall_advisor

function syslog_uninstall_advisor()
{
    global $config, $colors;
    include dirname(__FILE__) . '/config.php';
    syslog_connect();
    $syslog_exists = sizeof(syslog_db_fetch_row('SHOW TABLES FROM `' . $syslogdb_default . "` LIKE 'syslog'"));
    top_header();
    $fields_syslog_update = array('uninstall_method' => array('method' => 'drop_array', 'friendly_name' => __('What uninstall method do you want to use?'), 'description' => __('When uninstalling syslog, you can remove everything, or only components, just in case you plan on re-installing in the future.'), 'value' => 'all', 'array' => array('all' => __('Remove Everything (Logs, Tables, Settings)'), 'syslog' => __('Syslog Data Only'))), 'mode' => array('method' => 'hidden', 'value' => 'uninstall'), 'id' => array('method' => 'hidden', 'value' => 'syslog'));
    print "<form action='plugins.php' method='get'>\n";
    print "<table align='center' width='80%'><tr><td>\n";
    html_start_box(__('Syslog Uninstall Preferences'), '100%', $colors['header'], '3', 'center', '');
    draw_edit_form(array('config' => array(), 'fields' => inject_form_variables($fields_syslog_update, array())));
    html_end_box();
    syslog_confirm_button('uninstall', 'plugins.php', $syslog_exists);
    print "</td></tr></table>\n";
    bottom_footer();
    exit;
}
开发者ID:Cacti,项目名称:plugin_syslog,代码行数:18,代码来源:setup.php

示例11: host_edit


//.........这里部分代码省略.........
				<?php 
        } else {
            if ($host["availability_method"] == AVAIL_NONE) {
                ?>
					No Availability Check In Use<br>
				<?php 
            }
        }
        ?>
				</td>
				<td class="textInfo" valign="top">
					<span style="color: #c16921;">*</span><a href="graphs_new.php?host_id=<?php 
        print $host["id"];
        ?>
">Create Graphs for this Host</a><br>
					<span style="color: #c16921;">*</span><a href="data_sources.php?host_id=<?php 
        print $host["id"];
        ?>
&ds_rows=30&filter=&template_id=-1&method_id=-1&page=1">Data Source List</a><br>
					<span style="color: #c16921;">*</span><a href="graphs.php?host_id=<?php 
        print $host["id"];
        ?>
&graph_rows=30&filter=&template_id=-1&page=1">Graph List</a>
				</td>
			</tr>
		</table>
		<?php 
    }
    html_start_box("<strong>Devices</strong> {$header_label}", "100%", $colors["header"], "3", "center", "");
    /* preserve the host template id if passed in via a GET variable */
    if (!empty($_GET["host_template_id"])) {
        $fields_host_edit["host_template_id"]["value"] = $_GET["host_template_id"];
    }
    draw_edit_form(array("config" => array("form_name" => "chk"), "fields" => inject_form_variables($fields_host_edit, isset($host) ? $host : array())));
    html_end_box();
    ?>
	<script type="text/javascript">
	<!--

	// default snmp information
	var snmp_community       = document.getElementById('snmp_community').value;
	var snmp_username        = document.getElementById('snmp_username').value;
	var snmp_password        = document.getElementById('snmp_password').value;
	var snmp_auth_protocol   = document.getElementById('snmp_auth_protocol').value;
	var snmp_priv_passphrase = document.getElementById('snmp_priv_passphrase').value;
	var snmp_priv_protocol   = document.getElementById('snmp_priv_protocol').value;
	var snmp_context         = document.getElementById('snmp_context').value;
	var snmp_port            = document.getElementById('snmp_port').value;
	var snmp_timeout         = document.getElementById('snmp_timeout').value;
	var max_oids             = document.getElementById('max_oids').value;

	// default ping methods
	var ping_method    = document.getElementById('ping_method').value;
	var ping_port      = document.getElementById('ping_port').value;
	var ping_timeout   = document.getElementById('ping_timeout').value;
	var ping_retries   = document.getElementById('ping_retries').value;

	var availability_methods = document.getElementById('availability_method').options;
	var num_methods          = document.getElementById('availability_method').length;
	var selectedIndex        = document.getElementById('availability_method').selectedIndex;

	var agent = navigator.userAgent;
	agent = agent.match("MSIE");

	function setPingVisibility() {
		availability_method = document.getElementById('availability_method').value;
开发者ID:songchin,项目名称:Cacti,代码行数:67,代码来源:host.php

示例12: template_edit

function template_edit()
{
    global $colors, $struct_graph, $image_types, $fields_graph_template_template_edit;
    /* ================= input validation ================= */
    input_validate_input_number(get_request_var("id"));
    /* ==================================================== */
    /* graph item list goes here */
    if (!empty($_GET["id"])) {
        item();
    }
    if (!empty($_GET["id"])) {
        $template = db_fetch_row("select * from graph_templates where id=" . $_GET["id"]);
        $template_graph = db_fetch_row("select * from graph_templates_graph where graph_template_id=" . $_GET["id"] . " and local_graph_id=0");
        $header_label = "[edit: " . $template["name"] . "]";
    } else {
        $header_label = "[new]";
    }
    html_start_box("<strong>Template</strong> {$header_label}", "100%", $colors["header"], "3", "center", "");
    draw_edit_form(array("config" => array(), "fields" => inject_form_variables($fields_graph_template_template_edit, isset($template) ? $template : array(), isset($template_graph) ? $template_graph : array())));
    html_end_box();
    html_start_box("<strong>Graph Template</strong>", "100%", $colors["header"], "3", "center", "");
    $form_array = array();
    while (list($field_name, $field_array) = each($struct_graph)) {
        $form_array += array($field_name => $struct_graph[$field_name]);
        $form_array[$field_name]["value"] = isset($template_graph) ? $template_graph[$field_name] : "";
        $form_array[$field_name]["form_id"] = isset($template_graph) ? $template_graph["id"] : "0";
        $form_array[$field_name]["description"] = "";
        $form_array[$field_name]["sub_checkbox"] = array("name" => "t_" . $field_name, "friendly_name" => "Use Per-Graph Value (Ignore this Value)", "value" => isset($template_graph) ? $template_graph["t_" . $field_name] : "");
    }
    draw_edit_form(array("config" => array(), "fields" => $form_array));
    form_hidden_box("rrdtool_version", read_config_option("rrdtool_version"), "");
    html_end_box();
    form_save_button("graph_templates.php");
    //Now we need some javascript to make it dynamic
    ?>
<script language="JavaScript">

dynamic();

function dynamic() {
	//alert("RRDTool Version is '" + document.getElementById('rrdtool_version').value + "'");
	//alert("Log is '" + document.getElementById('auto_scale_log').checked + "'");
	document.getElementById('t_scale_log_units').disabled=true;
	document.getElementById('scale_log_units').disabled=true;
	if ((document.getElementById('rrdtool_version').value != 'rrd-1.0.x') &&
		(document.getElementById('auto_scale_log').checked)) {
		document.getElementById('t_scale_log_units').disabled=false;
		document.getElementById('scale_log_units').disabled=false;
	}
}

function changeScaleLog() {
	//alert("Log changed to '" + document.getElementById('auto_scale_log').checked + "'");
	document.getElementById('t_scale_log_units').disabled=true;
	document.getElementById('scale_log_units').disabled=true;
	if ((document.getElementById('rrdtool_version').value != 'rrd-1.0.x') &&
		(document.getElementById('auto_scale_log').checked)) {
		document.getElementById('t_scale_log_units').disabled=false;
		document.getElementById('scale_log_units').disabled=false;
	}
}
</script>
<?php 
}
开发者ID:songchin,项目名称:Cacti,代码行数:64,代码来源:graph_templates.php

示例13: graph_edit


//.........这里部分代码省略.........
        }
        if (!empty($graphs["graph_template_id"]) && $_SESSION["permission"] == ACCESS_ADMINISTRATOR) {
            ?>
<span style="color: #c16921;">*<a href='<?php 
            print htmlspecialchars("graph_templates.php?action=template_edit&id=" . (isset($graphs["graph_template_id"]) ? $graphs["graph_template_id"] : "0"));
            ?>
'>Edit Graph Template.</a></span><br><?php 
        }
        /* modify for multi user end */
        if (!empty($_GET["host_id"]) || !empty($host_id)) {
            ?>
<span style="color: #c16921;">*<a href='<?php 
            print htmlspecialchars("host.php?action=edit&id=" . (isset($_GET["host_id"]) ? $_GET["host_id"] : $host_id));
            ?>
'>Edit Host.</a></span><br><?php 
        }
        ?>
				</td>
			</tr>
		</table>
		<br>
		<?php 
    }
    html_start_box("<strong>Graph Template Selection</strong> {$header_label}", "100%", $colors["header"], "3", "center", "");
    $form_array = array("graph_template_id" => array("method" => "drop_sql", "friendly_name" => "Selected Graph Template", "description" => "Choose a graph template to apply to this graph. Please note that graph data may be lost if you change the graph template after one is already applied.", "value" => isset($graphs) ? $graphs["graph_template_id"] : "0", "none_value" => "None", "sql" => "select graph_templates.id,graph_templates.name from graph_templates order by name"), "host_id" => array("method" => "drop_sql", "friendly_name" => "Host", "description" => "Choose the host that this graph belongs to.", "value" => isset($_GET["host_id"]) ? $_GET["host_id"] : $host_id, "none_value" => "None", "sql" => "select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname"), "graph_template_graph_id" => array("method" => "hidden", "value" => isset($graphs) ? $graphs["id"] : "0"), "local_graph_id" => array("method" => "hidden", "value" => isset($graphs) ? $graphs["local_graph_id"] : "0"), "local_graph_template_graph_id" => array("method" => "hidden", "value" => isset($graphs) ? $graphs["local_graph_template_graph_id"] : "0"), "_graph_template_id" => array("method" => "hidden", "value" => isset($graphs) ? $graphs["graph_template_id"] : "0"), "_host_id" => array("method" => "hidden", "value" => isset($host_id) ? $host_id : "0"));
    /* modify for multi user start */
    if ($_SESSION["permission"] < ACCESS_ADMINISTRATOR) {
        unset($form_array["graph_template_id"]["none_value"]);
        $form_array["graph_template_id"]["sql"] = "SELECT graph_templates.id,graph_templates.name FROM graph_templates WHERE name NOT LIKE '%@system' ORDER BY name";
        unset($form_array["host_id"]["none_value"]);
        $form_array["host_id"]["sql"] = "\r\n            SELECT host.id,CONCAT_WS('',host.description,' (',host.hostname,')') AS name FROM host \r\n                INNER JOIN user_auth_perms ON host.id = user_auth_perms.item_id AND user_auth_perms.user_id = '" . $_SESSION["sess_user_id"] . "' AND user_auth_perms.type = '3' \r\n            ORDER BY host.description,host.hostname";
    }
    /* modify for multi user end */
    draw_edit_form(array("config" => array(), "fields" => $form_array));
    html_end_box();
    /* only display the "inputs" area if we are using a graph template for this graph */
    if (!empty($graphs["graph_template_id"])) {
        html_start_box("<strong>Supplemental Graph Template Data</strong>", "100%", $colors["header"], "3", "center", "");
        draw_nontemplated_fields_graph($graphs["graph_template_id"], $graphs, "|field|", "<strong>Graph Fields</strong>", true, true, 0);
        draw_nontemplated_fields_graph_item($graphs["graph_template_id"], $_GET["id"], "|field|_|id|", "<strong>Graph Item Fields</strong>", true);
        html_end_box();
    }
    /* graph item list goes here */
    if (!empty($_GET["id"]) && empty($graphs["graph_template_id"])) {
        item();
    }
    if (!empty($_GET["id"])) {
        ?>
		<table width="100%" align="center">
			<tr>
				<td align="center" class="textInfo" colspan="2">
					<img src="<?php 
        print htmlspecialchars("graph_image.php?action=edit&local_graph_id=" . $_GET["id"] . "&rra_id=" . read_graph_config_option("default_rra_id"));
        ?>
" alt="">
				</td>
				<?php 
        if (isset($_SESSION["graph_debug_mode"]) && isset($_GET["id"])) {
            $graph_data_array["output_flag"] = RRDTOOL_OUTPUT_STDERR;
            $graph_data_array["print_source"] = 1;
            ?>
					<td>
						<span class="textInfo">RRDTool Command:</span><br>
						<pre><?php 
            print @rrdtool_function_graph($_GET["id"], 1, $graph_data_array);
            ?>
开发者ID:resmon,项目名称:resmon-cacti,代码行数:67,代码来源:graphs.php

示例14: poller_edit

function poller_edit() {
	global $colors;
	require_once(CACTI_BASE_PATH . "/lib/poller/poller_info.php");

	/* ================= input validation ================= */
	input_validate_input_number(get_request_var("id"));
	/* ==================================================== */

	/* remember if there's something we want to show to the user */
	$debug_log = debug_log_return("poller");

	if (!empty($debug_log)) {
		debug_log_clear("poller");
		?>
		<table class='topBoxAlt'>
			<tr bgcolor="<?php print $colors["light"];?>">
				<td class='mono'>
					<?php print $debug_log;?>
				</td>
			</tr>
		</table>
		<br>
		<?php
	}

	if (!empty($_GET["id"])) {
		$poller = db_fetch_row("select * from poller where id=" . $_GET["id"]);
		$header_label = __("[edit: ") . $poller["description"] . "]";
	}else{
		$header_label = __("[new]");
		$_GET["id"] = 0;
	}

	print "<form method='post' action='" .  basename($_SERVER["PHP_SELF"]) . "' name='poller_edit'>\n";
	html_start_box("<strong>" . __("Pollers") . "</strong> $header_label", "100", $colors["header"], 0, "center", "", true);
	$header_items = array(__("Field"), __("Value"));
	print "<tr><td>";
	html_header($header_items, 1, true, 'poller_edit');

	draw_edit_form(array(
		"config" => array(),
		"fields" => inject_form_variables(poller_form_list(), (isset($poller) ? $poller : array()))
		));

	print "</table></td></tr>";		/* end of html_header */
	html_end_box();

	form_save_button_alt();
}
开发者ID:songchin,项目名称:Cacti,代码行数:49,代码来源:pollers.php

示例15: user_edit

function user_edit() {
	global $colors, $fields_user_user_edit_host;

	if (!empty($_GET["id"])) {
		$user = db_fetch_row("select * from user_auth where id=" . $_GET["id"]);
		$header_label = "[edit: " . $user["username"] . "]";
	}else{
		$header_label = "[new]";
	}

	html_start_box("<strong>User Management</strong> $header_label", "98%", $colors["header"], "3", "center", "");

	draw_edit_form(array(
		"config" => array("form_name" => "chk"),
		"fields" => inject_form_variables($fields_user_user_edit_host, (isset($user) ? $user : array()))
		));

	html_end_box();

	if (!empty($_GET["id"])) {
		/* draw user admin nav tabs */
		?>
		<table class='tabs' width='98%' cellspacing='0' cellpadding='3' align='center'>
			<tr>
				<td width='1'></td>
				<td <?php print ((($_GET["action"] == "user_realms_edit") || ($_GET["action"] == "user_edit")) ? "bgcolor='silver'" : "bgcolor='#DFDFDF'");?> nowrap='nowrap' width='150' align='center' class='tab'>
					<span class='textHeader'><a href='user_admin.php?action=user_realms_edit&id=<?php print $_GET["id"];?>'>Realm Permissions</a></span>
				</td>
				<td width='1'></td>
				<td <?php print (($_GET["action"] == "graph_perms_edit") ? "bgcolor='silver'" : "bgcolor='#DFDFDF'");?> nowrap='nowrap' width='150' align='center' class='tab'>
					<span class='textHeader'><a href='user_admin.php?action=graph_perms_edit&id=<?php print $_GET["id"];?>'>Graph Permissions</a></span>
				</td>
				<td width='1'></td>
				<td <?php print (($_GET["action"] == "graph_settings_edit") ? "bgcolor='silver'" : "bgcolor='#DFDFDF'");?> nowrap='nowrap' width='130' align='center' class='tab'>
					<span class='textHeader'><a href='user_admin.php?action=graph_settings_edit&id=<?php print $_GET["id"];?>'>Graph Settings</a></span>
				</td>
				<td></td>
			</tr>
		</table>
		<?php
	}

	if ($_GET["action"] == "graph_settings_edit") {
		graph_settings_edit();
	}elseif ($_GET["action"] == "user_realms_edit") {
		user_realms_edit();
	}elseif ($_GET["action"] == "graph_perms_edit") {
		graph_perms_edit();
	}else{
		user_realms_edit();
	}

	form_save_button("user_admin.php");
}
开发者ID:songchin,项目名称:Cacti,代码行数:54,代码来源:user_admin.php


注:本文中的draw_edit_form函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。