Line 0
Link Here
|
|
|
1 |
<?php |
2 |
/* |
3 |
+-------------------------------------------------------------------------+ |
4 |
| Copyright (C) 2004-2010 The Cacti Group | |
5 |
| | |
6 |
| This program is free software; you can redistribute it and/or | |
7 |
| modify it under the terms of the GNU General Public License | |
8 |
| as published by the Free Software Foundation; either version 2 | |
9 |
| of the License, or (at your option) any later version. | |
10 |
| | |
11 |
| This program is distributed in the hope that it will be useful, | |
12 |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 |
| GNU General Public License for more details. | |
15 |
+-------------------------------------------------------------------------+ |
16 |
| Cacti: The Complete RRDTool-based Graphing Solution | |
17 |
+-------------------------------------------------------------------------+ |
18 |
| This code is designed, written, and maintained by the Cacti Group. See | |
19 |
| about.php and/or the AUTHORS file for specific developer information. | |
20 |
+-------------------------------------------------------------------------+ |
21 |
| http://www.cacti.net/ | |
22 |
+-------------------------------------------------------------------------+ |
23 |
*/ |
24 |
|
25 |
include ("./include/auth.php"); |
26 |
include_once("./lib/utility.php"); |
27 |
include_once("./lib/api_graph.php"); |
28 |
include_once("./lib/api_data_source.php"); |
29 |
include_once("./lib/template.php"); |
30 |
include_once("./lib/html_form_template.php"); |
31 |
include_once("./lib/rrd.php"); |
32 |
include_once("./lib/data_query.php"); |
33 |
|
34 |
define("MAX_DISPLAY_PAGES", 21); |
35 |
|
36 |
$ds_actions = array( |
37 |
1 => "Delete", |
38 |
2 => "Change Data Template", |
39 |
3 => "Change Host", |
40 |
8 => "Reapply Suggested Names", |
41 |
4 => "Duplicate", |
42 |
5 => "Convert to Data Template", |
43 |
6 => "Enable", |
44 |
7 => "Disable" |
45 |
); |
46 |
|
47 |
/* set default action */ |
48 |
if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; } |
49 |
|
50 |
switch ($_REQUEST["action"]) { |
51 |
case 'save': |
52 |
form_save(); |
53 |
|
54 |
break; |
55 |
case 'actions': |
56 |
form_actions(); |
57 |
|
58 |
break; |
59 |
case 'rrd_add': |
60 |
ds_rrd_add(); |
61 |
|
62 |
break; |
63 |
case 'rrd_remove': |
64 |
ds_rrd_remove(); |
65 |
|
66 |
break; |
67 |
case 'data_edit': |
68 |
include_once("./include/top_header.php"); |
69 |
|
70 |
data_edit(); |
71 |
|
72 |
include_once("./include/bottom_footer.php"); |
73 |
break; |
74 |
case 'ds_remove': |
75 |
ds_remove(); |
76 |
|
77 |
header ("Location: data_sources.php"); |
78 |
break; |
79 |
case 'ds_edit': |
80 |
ds_edit(); |
81 |
|
82 |
break; |
83 |
default: |
84 |
include_once("./include/top_header.php"); |
85 |
|
86 |
ds(); |
87 |
|
88 |
include_once("./include/bottom_footer.php"); |
89 |
break; |
90 |
} |
91 |
|
92 |
/* -------------------------- |
93 |
The Save Function |
94 |
-------------------------- */ |
95 |
|
96 |
function form_save() { |
97 |
if ((isset($_POST["save_component_data_source_new"])) && (!empty($_POST["data_template_id"]))) { |
98 |
/* ================= input validation ================= */ |
99 |
input_validate_input_number(get_request_var_post("host_id")); |
100 |
input_validate_input_number(get_request_var_post("data_template_id")); |
101 |
/* ==================================================== */ |
102 |
|
103 |
$save["id"] = $_POST["local_data_id"]; |
104 |
$save["data_template_id"] = $_POST["data_template_id"]; |
105 |
$save["host_id"] = $_POST["host_id"]; |
106 |
|
107 |
$local_data_id = sql_save($save, "data_local"); |
108 |
|
109 |
change_data_template($local_data_id, $_POST["data_template_id"]); |
110 |
|
111 |
/* update the title cache */ |
112 |
update_data_source_title_cache($local_data_id); |
113 |
|
114 |
/* update host data */ |
115 |
if (!empty($_POST["host_id"])) { |
116 |
push_out_host($_POST["host_id"], $local_data_id); |
117 |
} |
118 |
} |
119 |
|
120 |
if ((isset($_POST["save_component_data"])) && (!is_error_message())) { |
121 |
/* ================= input validation ================= */ |
122 |
input_validate_input_number(get_request_var_post("data_template_data_id")); |
123 |
/* ==================================================== */ |
124 |
|
125 |
/* ok, first pull out all 'input' values so we know how much to save */ |
126 |
$input_fields = db_fetch_assoc("select |
127 |
data_template_data.data_input_id, |
128 |
data_local.host_id, |
129 |
data_input_fields.id, |
130 |
data_input_fields.input_output, |
131 |
data_input_fields.data_name, |
132 |
data_input_fields.regexp_match, |
133 |
data_input_fields.allow_nulls, |
134 |
data_input_fields.type_code |
135 |
from data_template_data |
136 |
left join data_input_fields on (data_input_fields.data_input_id=data_template_data.data_input_id) |
137 |
left join data_local on (data_template_data.local_data_id=data_local.id) |
138 |
where data_template_data.id=" . $_POST["data_template_data_id"] . " |
139 |
and data_input_fields.input_output='in'"); |
140 |
|
141 |
if (sizeof($input_fields) > 0) { |
142 |
foreach ($input_fields as $input_field) { |
143 |
if (isset($_POST{"value_" . $input_field["id"]})) { |
144 |
/* save the data into the 'data_input_data' table */ |
145 |
$form_value = $_POST{"value_" . $input_field["id"]}; |
146 |
|
147 |
/* we shouldn't enforce rules on fields the user cannot see (ie. templated ones) */ |
148 |
$is_templated = db_fetch_cell("select t_value from data_input_data where data_input_field_id=" . $input_field["id"] . " and data_template_data_id=" . db_fetch_cell("select local_data_template_data_id from data_template_data where id=" . $_POST["data_template_data_id"])); |
149 |
|
150 |
if ($is_templated == "") { |
151 |
$allow_nulls = true; |
152 |
}elseif ($input_field["allow_nulls"] == "on") { |
153 |
$allow_nulls = true; |
154 |
}elseif (empty($input_field["allow_nulls"])) { |
155 |
$allow_nulls = false; |
156 |
} |
157 |
|
158 |
/* run regexp match on input string */ |
159 |
$form_value = form_input_validate($form_value, "value_" . $input_field["id"], $input_field["regexp_match"], $allow_nulls, 3); |
160 |
|
161 |
if (!is_error_message()) { |
162 |
db_execute("replace into data_input_data (data_input_field_id,data_template_data_id,t_value,value) values |
163 |
(" . $input_field["id"] . "," . $_POST["data_template_data_id"] . ",'','$form_value')"); |
164 |
} |
165 |
} |
166 |
} |
167 |
} |
168 |
} |
169 |
|
170 |
if ((isset($_POST["save_component_data_source"])) && (!is_error_message())) { |
171 |
/* ================= input validation ================= */ |
172 |
input_validate_input_number(get_request_var_post("local_data_id")); |
173 |
input_validate_input_number(get_request_var_post("current_rrd")); |
174 |
input_validate_input_number(get_request_var_post("data_template_id")); |
175 |
input_validate_input_number(get_request_var_post("host_id")); |
176 |
/* ==================================================== */ |
177 |
|
178 |
$save1["id"] = $_POST["local_data_id"]; |
179 |
$save1["data_template_id"] = $_POST["data_template_id"]; |
180 |
$save1["host_id"] = $_POST["host_id"]; |
181 |
|
182 |
$save2["id"] = $_POST["data_template_data_id"]; |
183 |
$save2["local_data_template_data_id"] = $_POST["local_data_template_data_id"]; |
184 |
$save2["data_template_id"] = $_POST["data_template_id"]; |
185 |
$save2["data_input_id"] = form_input_validate($_POST["data_input_id"], "data_input_id", "", true, 3); |
186 |
$save2["name"] = form_input_validate($_POST["name"], "name", "", false, 3); |
187 |
$save2["data_source_path"] = form_input_validate($_POST["data_source_path"], "data_source_path", "", true, 3); |
188 |
$save2["active"] = form_input_validate((isset($_POST["active"]) ? $_POST["active"] : ""), "active", "", true, 3); |
189 |
$save2["rrd_step"] = form_input_validate($_POST["rrd_step"], "rrd_step", "^[0-9]+$", false, 3); |
190 |
|
191 |
if (!is_error_message()) { |
192 |
$local_data_id = sql_save($save1, "data_local"); |
193 |
|
194 |
$save2["local_data_id"] = $local_data_id; |
195 |
$data_template_data_id = sql_save($save2, "data_template_data"); |
196 |
|
197 |
if ($data_template_data_id) { |
198 |
raise_message(1); |
199 |
}else{ |
200 |
raise_message(2); |
201 |
} |
202 |
} |
203 |
|
204 |
if (!is_error_message()) { |
205 |
/* if this is a new data source and a template has been selected, skip item creation this time |
206 |
otherwise it throws off the templatate creation because of the NULL data */ |
207 |
if ((!empty($_POST["local_data_id"])) || (empty($_POST["data_template_id"]))) { |
208 |
/* if no template was set before the save, there will be only one data source item to save; |
209 |
otherwise there might be >1 */ |
210 |
if (empty($_POST["_data_template_id"])) { |
211 |
$rrds[0]["id"] = $_POST["current_rrd"]; |
212 |
}else{ |
213 |
$rrds = db_fetch_assoc("select id from data_template_rrd where local_data_id=" . $_POST["local_data_id"]); |
214 |
} |
215 |
|
216 |
if (sizeof($rrds) > 0) { |
217 |
foreach ($rrds as $rrd) { |
218 |
if (empty($_POST["_data_template_id"])) { |
219 |
$name_modifier = ""; |
220 |
}else{ |
221 |
$name_modifier = "_" . $rrd["id"]; |
222 |
} |
223 |
|
224 |
$save3["id"] = $rrd["id"]; |
225 |
$save3["local_data_id"] = $local_data_id; |
226 |
$save3["local_data_template_rrd_id"] = db_fetch_cell("select local_data_template_rrd_id from data_template_rrd where id=" . $rrd["id"]); |
227 |
$save3["data_template_id"] = $_POST["data_template_id"]; |
228 |
$save3["rrd_maximum"] = form_input_validate($_POST["rrd_maximum$name_modifier"], "rrd_maximum$name_modifier", "^(-?([0-9]+(\.[0-9]*)?|[0-9]*\.[0-9]+)([eE][+\-]?[0-9]+)?)|U$", false, 3); |
229 |
$save3["rrd_minimum"] = form_input_validate($_POST["rrd_minimum$name_modifier"], "rrd_minimum$name_modifier", "^(-?([0-9]+(\.[0-9]*)?|[0-9]*\.[0-9]+)([eE][+\-]?[0-9]+)?)|U$", false, 3); |
230 |
$save3["rrd_heartbeat"] = form_input_validate($_POST["rrd_heartbeat$name_modifier"], "rrd_heartbeat$name_modifier", "^[0-9]+$", false, 3); |
231 |
$save3["data_source_type_id"] = $_POST["data_source_type_id$name_modifier"]; |
232 |
$save3["data_source_name"] = form_input_validate($_POST["data_source_name$name_modifier"], "data_source_name$name_modifier", "^[a-zA-Z0-9_-]{1,19}$", false, 3); |
233 |
$save3["data_input_field_id"] = form_input_validate((isset($_POST["data_input_field_id$name_modifier"]) ? $_POST["data_input_field_id$name_modifier"] : "0"), "data_input_field_id$name_modifier", "", true, 3); |
234 |
|
235 |
$data_template_rrd_id = sql_save($save3, "data_template_rrd"); |
236 |
|
237 |
if ($data_template_rrd_id) { |
238 |
raise_message(1); |
239 |
}else{ |
240 |
raise_message(2); |
241 |
} |
242 |
} |
243 |
} |
244 |
} |
245 |
} |
246 |
|
247 |
if (!is_error_message()) { |
248 |
if (!empty($_POST["rra_id"])) { |
249 |
/* save entries in 'selected rras' field */ |
250 |
db_execute("delete from data_template_data_rra where data_template_data_id=$data_template_data_id"); |
251 |
|
252 |
for ($i=0; ($i < count($_POST["rra_id"])); $i++) { |
253 |
/* ================= input validation ================= */ |
254 |
input_validate_input_number($_POST["rra_id"][$i]); |
255 |
/* ==================================================== */ |
256 |
|
257 |
db_execute("insert into data_template_data_rra (rra_id,data_template_data_id) |
258 |
values (" . $_POST["rra_id"][$i] . ",$data_template_data_id)"); |
259 |
} |
260 |
} |
261 |
|
262 |
if ($_POST["data_template_id"] != $_POST["_data_template_id"]) { |
263 |
/* update all necessary template information */ |
264 |
change_data_template($local_data_id, $_POST["data_template_id"]); |
265 |
}elseif (!empty($_POST["data_template_id"])) { |
266 |
update_data_source_data_query_cache($local_data_id); |
267 |
} |
268 |
|
269 |
if ($_POST["host_id"] != $_POST["_host_id"]) { |
270 |
/* push out all necessary host information */ |
271 |
push_out_host($_POST["host_id"], $local_data_id); |
272 |
|
273 |
/* reset current host for display purposes */ |
274 |
$_SESSION["sess_data_source_current_host_id"] = $_POST["host_id"]; |
275 |
} |
276 |
|
277 |
/* if no data source path has been entered, generate one */ |
278 |
if (empty($_POST["data_source_path"])) { |
279 |
generate_data_source_path($local_data_id); |
280 |
} |
281 |
|
282 |
/* update the title cache */ |
283 |
update_data_source_title_cache($local_data_id); |
284 |
} |
285 |
} |
286 |
|
287 |
/* update the poller cache last to make sure everything is fresh */ |
288 |
if ((!is_error_message()) && (!empty($local_data_id))) { |
289 |
update_poller_cache($local_data_id, false); |
290 |
} |
291 |
|
292 |
if ((isset($_POST["save_component_data_source_new"])) && (empty($_POST["data_template_id"]))) { |
293 |
header("Location: data_sources.php?action=ds_edit&host_id=" . $_POST["host_id"] . "&new=1"); |
294 |
}elseif ((is_error_message()) || ($_POST["data_template_id"] != $_POST["_data_template_id"]) || ($_POST["data_input_id"] != $_POST["_data_input_id"]) || ($_POST["host_id"] != $_POST["_host_id"])) { |
295 |
header("Location: data_sources.php?action=ds_edit&id=" . (empty($local_data_id) ? $_POST["local_data_id"] : $local_data_id) . "&host_id=" . $_POST["host_id"] . "&view_rrd=" . (isset($_POST["current_rrd"]) ? $_POST["current_rrd"] : "0")); |
296 |
}else{ |
297 |
header("Location: data_sources.php"); |
298 |
} |
299 |
} |
300 |
|
301 |
/* ------------------------ |
302 |
The "actions" function |
303 |
------------------------ */ |
304 |
|
305 |
function form_actions() { |
306 |
global $colors, $ds_actions; |
307 |
|
308 |
/* if we are to save this form, instead of display it */ |
309 |
if (isset($_POST["selected_items"])) { |
310 |
$selected_items = unserialize(stripslashes($_POST["selected_items"])); |
311 |
|
312 |
if ($_POST["drp_action"] == "1") { /* delete */ |
313 |
if (!isset($_POST["delete_type"])) { $_POST["delete_type"] = 1; } |
314 |
|
315 |
switch ($_POST["delete_type"]) { |
316 |
case '2': /* delete all graph items tied to this data source */ |
317 |
$data_template_rrds = db_fetch_assoc("select id from data_template_rrd where " . array_to_sql_or($selected_items, "local_data_id")); |
318 |
|
319 |
/* loop through each data source item */ |
320 |
if (sizeof($data_template_rrds) > 0) { |
321 |
foreach ($data_template_rrds as $item) { |
322 |
db_execute("delete from graph_templates_item where task_item_id=" . $item["id"] . " and local_graph_id > 0"); |
323 |
} |
324 |
} |
325 |
|
326 |
break; |
327 |
case '3': /* delete all graphs tied to this data source */ |
328 |
$graphs = db_fetch_assoc("select |
329 |
graph_templates_graph.local_graph_id |
330 |
from (data_template_rrd,graph_templates_item,graph_templates_graph) |
331 |
where graph_templates_item.task_item_id=data_template_rrd.id |
332 |
and graph_templates_item.local_graph_id=graph_templates_graph.local_graph_id |
333 |
and " . array_to_sql_or($selected_items, "data_template_rrd.local_data_id") . " |
334 |
and graph_templates_graph.local_graph_id > 0 |
335 |
group by graph_templates_graph.local_graph_id"); |
336 |
|
337 |
if (sizeof($graphs) > 0) { |
338 |
foreach ($graphs as $graph) { |
339 |
api_graph_remove($graph["local_graph_id"]); |
340 |
} |
341 |
} |
342 |
|
343 |
break; |
344 |
} |
345 |
|
346 |
for ($i=0;($i<count($selected_items));$i++) { |
347 |
/* ================= input validation ================= */ |
348 |
input_validate_input_number($selected_items[$i]); |
349 |
/* ==================================================== */ |
350 |
|
351 |
api_data_source_remove($selected_items[$i]); |
352 |
} |
353 |
}elseif ($_POST["drp_action"] == "2") { /* change graph template */ |
354 |
for ($i=0;($i<count($selected_items));$i++) { |
355 |
/* ================= input validation ================= */ |
356 |
input_validate_input_number($selected_items[$i]); |
357 |
input_validate_input_number(get_request_var_post("data_template_id")); |
358 |
/* ==================================================== */ |
359 |
|
360 |
change_data_template($selected_items[$i], $_POST["data_template_id"]); |
361 |
} |
362 |
}elseif ($_POST["drp_action"] == "3") { /* change host */ |
363 |
for ($i=0;($i<count($selected_items));$i++) { |
364 |
/* ================= input validation ================= */ |
365 |
input_validate_input_number($selected_items[$i]); |
366 |
input_validate_input_number(get_request_var_post("host_id")); |
367 |
/* ==================================================== */ |
368 |
|
369 |
db_execute("update data_local set host_id=" . $_POST["host_id"] . " where id=" . $selected_items[$i]); |
370 |
push_out_host($_POST["host_id"], $selected_items[$i]); |
371 |
update_data_source_title_cache($selected_items[$i]); |
372 |
} |
373 |
}elseif ($_POST["drp_action"] == "4") { /* duplicate */ |
374 |
for ($i=0;($i<count($selected_items));$i++) { |
375 |
/* ================= input validation ================= */ |
376 |
input_validate_input_number($selected_items[$i]); |
377 |
/* ==================================================== */ |
378 |
|
379 |
duplicate_data_source($selected_items[$i], 0, $_POST["title_format"]); |
380 |
} |
381 |
}elseif ($_POST["drp_action"] == "5") { /* data source -> data template */ |
382 |
for ($i=0;($i<count($selected_items));$i++) { |
383 |
/* ================= input validation ================= */ |
384 |
input_validate_input_number($selected_items[$i]); |
385 |
/* ==================================================== */ |
386 |
|
387 |
data_source_to_data_template($selected_items[$i], $_POST["title_format"]); |
388 |
} |
389 |
}elseif ($_POST["drp_action"] == "6") { /* data source enable */ |
390 |
for ($i=0;($i<count($selected_items));$i++) { |
391 |
api_data_source_enable($selected_items[$i]); |
392 |
} |
393 |
}elseif ($_POST["drp_action"] == "7") { /* data source disable */ |
394 |
for ($i=0;($i<count($selected_items));$i++) { |
395 |
api_data_source_disable($selected_items[$i]); |
396 |
} |
397 |
}elseif ($_POST["drp_action"] == "8") { /* reapply suggested data source naming */ |
398 |
for ($i=0;($i<count($selected_items));$i++) { |
399 |
/* ================= input validation ================= */ |
400 |
input_validate_input_number($selected_items[$i]); |
401 |
/* ==================================================== */ |
402 |
api_reapply_suggested_data_source_title($selected_items[$i]); |
403 |
update_data_source_title_cache($selected_items[$i]); |
404 |
} |
405 |
} |
406 |
header("Location: data_sources.php"); |
407 |
exit; |
408 |
} |
409 |
|
410 |
/* setup some variables */ |
411 |
$ds_list = ""; $i = 0; |
412 |
|
413 |
/* loop through each of the graphs selected on the previous page and get more info about them */ |
414 |
while (list($var,$val) = each($_POST)) { |
415 |
if (ereg("^chk_([0-9]+)$", $var, $matches)) { |
416 |
/* ================= input validation ================= */ |
417 |
input_validate_input_number($matches[1]); |
418 |
/* ==================================================== */ |
419 |
|
420 |
$ds_list .= "<li>" . get_data_source_title($matches[1]) . "<br>"; |
421 |
$ds_array[$i] = $matches[1]; |
422 |
|
423 |
$i++; |
424 |
} |
425 |
} |
426 |
|
427 |
include_once("./include/top_header.php"); |
428 |
|
429 |
html_start_box("<strong>" . $ds_actions{$_POST["drp_action"]} . "</strong>", "60%", $colors["header_panel"], "3", "center", ""); |
430 |
|
431 |
print "<form action='data_sources.php' method='post'>\n"; |
432 |
|
433 |
if (isset($ds_array) && sizeof($ds_array)) { |
434 |
if ($_POST["drp_action"] == "1") { /* delete */ |
435 |
$graphs = array(); |
436 |
|
437 |
/* find out which (if any) graphs are using this data source, so we can tell the user */ |
438 |
if (isset($ds_array)) { |
439 |
$graphs = db_fetch_assoc("select |
440 |
graph_templates_graph.local_graph_id, |
441 |
graph_templates_graph.title_cache |
442 |
from (data_template_rrd,graph_templates_item,graph_templates_graph) |
443 |
where graph_templates_item.task_item_id=data_template_rrd.id |
444 |
and graph_templates_item.local_graph_id=graph_templates_graph.local_graph_id |
445 |
and " . array_to_sql_or($ds_array, "data_template_rrd.local_data_id") . " |
446 |
and graph_templates_graph.local_graph_id > 0 |
447 |
group by graph_templates_graph.local_graph_id |
448 |
order by graph_templates_graph.title_cache"); |
449 |
} |
450 |
|
451 |
print " <tr> |
452 |
<td class='textArea' bgcolor='#" . $colors["form_alternate1"]. "'> |
453 |
<p>When you click \"Continue\", the following Data Source(s) will be deleted.</p> |
454 |
<p><ul>$ds_list</ul></p>"; |
455 |
|
456 |
if (sizeof($graphs) > 0) { |
457 |
print "<tr bgcolor='#" . $colors["form_alternate1"] . "'><td class='textArea'><p class='textArea'>The following graphs are using these data sources:</p>\n"; |
458 |
|
459 |
print "<ul>"; |
460 |
foreach ($graphs as $graph) { |
461 |
print "<li><strong>" . $graph["title_cache"] . "</strong></li>\n"; |
462 |
} |
463 |
print "</ul>"; |
464 |
|
465 |
print "<br>"; |
466 |
form_radio_button("delete_type", "3", "1", "Leave the Graph(s) untouched.", "1"); print "<br>"; |
467 |
form_radio_button("delete_type", "3", "2", "Delete all <strong>Graph Item(s)</strong> that reference these Data Source(s).", "1"); print "<br>"; |
468 |
form_radio_button("delete_type", "3", "3", "Delete all <strong>Graph(s)</strong> that reference these Data Source(s).", "1"); print "<br>"; |
469 |
print "</td></tr>"; |
470 |
} |
471 |
print " |
472 |
</td> |
473 |
</tr>\n |
474 |
"; |
475 |
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Delete Data Source(s)'>"; |
476 |
}elseif ($_POST["drp_action"] == "2") { /* change graph template */ |
477 |
print " <tr> |
478 |
<td class='textArea' bgcolor='#" . $colors["form_alternate1"]. "'> |
479 |
<p>Choose a Data Template and click \"Continue\" to change the Data Template for |
480 |
the following Data Source(s). Be aware that all warnings will be suppressed during the |
481 |
conversion, so graph data loss is possible.</p> |
482 |
<p><ul>$ds_list</ul></p> |
483 |
<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> |
484 |
</td> |
485 |
</tr>\n |
486 |
"; |
487 |
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Change Graph Template for Data Source(s)'>"; |
488 |
}elseif ($_POST["drp_action"] == "3") { /* change host */ |
489 |
print " <tr> |
490 |
<td class='textArea' bgcolor='#" . $colors["form_alternate1"]. "'> |
491 |
<p>Choose a new Device for these Data Source(s) and click \"Continue\"</p> |
492 |
<p><ul>$ds_list</ul></p> |
493 |
<p><strong>New Host:</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> |
494 |
</td> |
495 |
</tr>\n |
496 |
"; |
497 |
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Change Device'>"; |
498 |
}elseif ($_POST["drp_action"] == "4") { /* duplicate */ |
499 |
print " <tr> |
500 |
<td class='textArea' bgcolor='#" . $colors["form_alternate1"]. "'> |
501 |
<p>When you click \"Continue\", the following Data Source(s) will be duplicated. You can |
502 |
optionally change the title format for the new Data Source(s).</p> |
503 |
<p><ul>$ds_list</ul></p> |
504 |
<p><strong>Title Format:</strong><br>"; form_text_box("title_format", "<ds_title> (1)", "", "255", "30", "text"); print "</p> |
505 |
</td> |
506 |
</tr>\n |
507 |
"; |
508 |
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Duplicate Data Source(s)'>"; |
509 |
}elseif ($_POST["drp_action"] == "5") { /* data source -> data template */ |
510 |
print " <tr> |
511 |
<td class='textArea' bgcolor='#" . $colors["form_alternate1"]. "'> |
512 |
<p>When you click \"Continue\", the following Data Source(s) will be converted into Data Template(s). |
513 |
You can optionally change the title format for the new Data Template(s).</p> |
514 |
<p><ul>$ds_list</ul></p> |
515 |
<p><strong>Title Format:</strong><br>"; form_text_box("title_format", "<ds_title> Template", "", "255", "30", "text"); print "</p> |
516 |
</td> |
517 |
</tr>\n |
518 |
"; |
519 |
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Convert Data Source(s) to Data Template(s)'>"; |
520 |
}elseif ($_POST["drp_action"] == "6") { /* data source enable */ |
521 |
print " <tr> |
522 |
<td class='textArea' bgcolor='#" . $colors["form_alternate1"]. "'> |
523 |
<p>When you click \"Continue\", the following Data Source(s) will be enabled.</p> |
524 |
<p><ul>$ds_list</ul></p> |
525 |
</td> |
526 |
</tr>\n |
527 |
"; |
528 |
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Enable Data Source(s)'>"; |
529 |
}elseif ($_POST["drp_action"] == "7") { /* data source disable */ |
530 |
print " <tr> |
531 |
<td class='textArea' bgcolor='#" . $colors["form_alternate1"]. "'> |
532 |
<p>When you click \"Continue\", the following Data Source(s) will be disabled.</p> |
533 |
<p><ul>$ds_list</ul></p> |
534 |
</td> |
535 |
</tr>\n |
536 |
"; |
537 |
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Disable Data Source(s)'>"; |
538 |
}elseif ($_POST["drp_action"] == "8") { /* reapply suggested data source naming */ |
539 |
print " <tr> |
540 |
<td class='textArea' bgcolor='#" . $colors["form_alternate1"]. "'> |
541 |
<p>When you click \"Continue\", the following Data Source(s) will will have their suggested naming conventions |
542 |
recalculated.</p> |
543 |
<p><ul>$ds_list</ul></p> |
544 |
</td> |
545 |
</tr>\n |
546 |
"; |
547 |
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Reapply Suggested Naming to Data Source(s)'>"; |
548 |
} |
549 |
}else{ |
550 |
print "<tr><td bgcolor='#" . $colors["form_alternate1"]. "'><span class='textError'>You must select at least one data source.</span></td></tr>\n"; |
551 |
$save_html = "<input type='button' value='Return' onClick='window.history.back()'>"; |
552 |
} |
553 |
|
554 |
print " <tr> |
555 |
<td align='right' bgcolor='#eaeaea'> |
556 |
<input type='hidden' name='action' value='actions'> |
557 |
<input type='hidden' name='selected_items' value='" . (isset($ds_array) ? serialize($ds_array) : '') . "'> |
558 |
<input type='hidden' name='drp_action' value='" . $_POST["drp_action"] . "'> |
559 |
$save_html |
560 |
</td> |
561 |
</tr> |
562 |
"; |
563 |
|
564 |
html_end_box(); |
565 |
|
566 |
include_once("./include/bottom_footer.php"); |
567 |
} |
568 |
|
569 |
/* ---------------------------- |
570 |
data - Custom Data |
571 |
---------------------------- */ |
572 |
|
573 |
function data_edit() { |
574 |
/* ================= input validation ================= */ |
575 |
input_validate_input_number(get_request_var("id")); |
576 |
/* ==================================================== */ |
577 |
|
578 |
global $config, $colors; |
579 |
|
580 |
if (!empty($_GET["id"])) { |
581 |
$data = db_fetch_row("select id,data_input_id,data_template_id,name,local_data_id from data_template_data where local_data_id=" . $_GET["id"]); |
582 |
$template_data = db_fetch_row("select id,data_input_id from data_template_data where data_template_id=" . $data["data_template_id"] . " and local_data_id=0"); |
583 |
|
584 |
$host = db_fetch_row("select host.id,host.hostname from (data_local,host) where data_local.host_id=host.id and data_local.id=" . $_GET["id"]); |
585 |
|
586 |
$header_label = "[edit: " . htmlspecialchars($data["name"]) . "]"; |
587 |
}else{ |
588 |
$header_label = "[new]"; |
589 |
} |
590 |
|
591 |
print "<form method='post' action='data_sources.php'>\n"; |
592 |
|
593 |
$i = 0; |
594 |
if (!empty($data["data_input_id"])) { |
595 |
/* get each INPUT field for this data input source */ |
596 |
$fields = db_fetch_assoc("select * from data_input_fields where data_input_id=" . $data["data_input_id"] . " and input_output='in' order by name"); |
597 |
|
598 |
html_start_box("<strong>Custom Data</strong> [data input: " . htmlspecialchars(db_fetch_cell("select name from data_input where id=" . $data["data_input_id"])) . "]", "100%", $colors["header"], "3", "center", ""); |
599 |
|
600 |
/* loop through each field found */ |
601 |
if (sizeof($fields) > 0) { |
602 |
foreach ($fields as $field) { |
603 |
$data_input_data = db_fetch_row("select * from data_input_data where data_template_data_id=" . $data["id"] . " and data_input_field_id=" . $field["id"]); |
604 |
|
605 |
if (sizeof($data_input_data) > 0) { |
606 |
$old_value = $data_input_data["value"]; |
607 |
}else{ |
608 |
$old_value = ""; |
609 |
} |
610 |
|
611 |
/* if data template then get t_value from template, else always allow user input */ |
612 |
if (empty($data["data_template_id"])) { |
613 |
$can_template = "on"; |
614 |
}else{ |
615 |
$can_template = db_fetch_cell("select t_value from data_input_data where data_template_data_id=" . $template_data["id"] . " and data_input_field_id=" . $field["id"]); |
616 |
} |
617 |
|
618 |
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i); |
619 |
|
620 |
if ((!empty($host["id"])) && (eregi('^' . VALID_HOST_FIELDS . '$', $field["type_code"]))) { |
621 |
print "<td width='50%'><strong>" . $field["name"] . "</strong> (From Host: " . $host["hostname"] . ")</td>\n"; |
622 |
print "<td><em>$old_value</em></td>\n"; |
623 |
}elseif (empty($can_template)) { |
624 |
print "<td width='50%'><strong>" . $field["name"] . "</strong> (From Data Template)</td>\n"; |
625 |
print "<td><em>" . (empty($old_value) ? "Nothing Entered" : $old_value) . "</em></td>\n"; |
626 |
}else{ |
627 |
print "<td width='50%'><strong>" . $field["name"] . "</strong></td>\n"; |
628 |
print "<td>"; |
629 |
|
630 |
draw_custom_data_row("value_" . $field["id"], $field["id"], $data["id"], $old_value); |
631 |
|
632 |
print "</td>"; |
633 |
} |
634 |
|
635 |
print "</tr>\n"; |
636 |
|
637 |
$i++; |
638 |
} |
639 |
}else{ |
640 |
print "<tr><td><em>No Input Fields for the Selected Data Input Source</em></td></tr>"; |
641 |
} |
642 |
|
643 |
html_end_box(); |
644 |
} |
645 |
|
646 |
form_hidden_box("local_data_id", (isset($data) ? $data["local_data_id"] : "0"), ""); |
647 |
form_hidden_box("data_template_data_id", (isset($data) ? $data["id"] : "0"), ""); |
648 |
form_hidden_box("save_component_data", "1", ""); |
649 |
} |
650 |
|
651 |
/* ------------------------ |
652 |
Data Source Functions |
653 |
------------------------ */ |
654 |
|
655 |
function ds_rrd_remove() { |
656 |
/* ================= input validation ================= */ |
657 |
input_validate_input_number(get_request_var("id")); |
658 |
/* ==================================================== */ |
659 |
|
660 |
db_execute("delete from data_template_rrd where id=" . $_GET["id"]); |
661 |
db_execute("update graph_templates_item set task_item_id=0 where task_item_id=" . $_GET["id"]); |
662 |
|
663 |
header("Location: data_sources.php?action=ds_edit&id=" . $_GET["local_data_id"]); |
664 |
} |
665 |
|
666 |
function ds_rrd_add() { |
667 |
/* ================= input validation ================= */ |
668 |
input_validate_input_number(get_request_var("id")); |
669 |
/* ==================================================== */ |
670 |
|
671 |
db_execute("insert into data_template_rrd (local_data_id,rrd_maximum,rrd_minimum,rrd_heartbeat,data_source_type_id, |
672 |
data_source_name) values (" . $_GET["id"] . ",100,0,600,1,'ds')"); |
673 |
$data_template_rrd_id = db_fetch_insert_id(); |
674 |
|
675 |
header("Location: data_sources.php?action=ds_edit&id=" . $_GET["id"] . "&view_rrd=$data_template_rrd_id"); |
676 |
} |
677 |
|
678 |
function ds_edit() { |
679 |
global $colors, $struct_data_source, $struct_data_source_item, $data_source_types; |
680 |
|
681 |
/* ================= input validation ================= */ |
682 |
input_validate_input_number(get_request_var("id")); |
683 |
input_validate_input_number(get_request_var("host_id")); |
684 |
/* ==================================================== */ |
685 |
|
686 |
$use_data_template = true; |
687 |
$host_id = 0; |
688 |
|
689 |
if (!empty($_GET["id"])) { |
690 |
$data_local = db_fetch_row("select host_id,data_template_id from data_local where id='" . $_GET["id"] . "'"); |
691 |
$data = db_fetch_row("select * from data_template_data where local_data_id='" . $_GET["id"] . "'"); |
692 |
|
693 |
if (isset($data_local["data_template_id"]) && $data_local["data_template_id"] >= 0) { |
694 |
$data_template = db_fetch_row("select id,name from data_template where id='" . $data_local["data_template_id"] . "'"); |
695 |
$data_template_data = db_fetch_row("select * from data_template_data where data_template_id='" . $data_local["data_template_id"] . "' and local_data_id=0"); |
696 |
} else { |
697 |
$_SESSION["sess_messages"] = 'Data Source "' . $_GET["id"] . '" does not exist.'; |
698 |
header ("Location: data_sources.php"); |
699 |
exit; |
700 |
} |
701 |
|
702 |
$header_label = "[edit: " . htmlspecialchars(get_data_source_title($_GET["id"])) . "]"; |
703 |
|
704 |
if (empty($data_local["data_template_id"])) { |
705 |
$use_data_template = false; |
706 |
} |
707 |
}else{ |
708 |
$header_label = "[new]"; |
709 |
|
710 |
$use_data_template = false; |
711 |
} |
712 |
|
713 |
/* handle debug mode */ |
714 |
if (isset($_GET["debug"])) { |
715 |
if ($_GET["debug"] == "0") { |
716 |
kill_session_var("ds_debug_mode"); |
717 |
}elseif ($_GET["debug"] == "1") { |
718 |
$_SESSION["ds_debug_mode"] = true; |
719 |
} |
720 |
} |
721 |
|
722 |
include_once("./include/top_header.php"); |
723 |
|
724 |
if (!empty($_GET["id"])) { |
725 |
?> |
726 |
<table width="100%" align="center"> |
727 |
<tr> |
728 |
<td class="textInfo" colspan="2" valign="top"> |
729 |
<?php print htmlspecialchars(get_data_source_title($_GET["id"]));?> |
730 |
</td> |
731 |
<td class="textInfo" align="right" valign="top"> |
732 |
<span style="color: #c16921;">*<a href='<?php print htmlspecialchars("data_sources.php?action=ds_edit&id=" . (isset($_GET["id"]) ? $_GET["id"] : "0"));?>&debug=<?php print (isset($_SESSION["ds_debug_mode"]) ? "0" : "1");?>'>Turn <strong><?php print (isset($_SESSION["ds_debug_mode"]) ? "Off" : "On");?></strong> Data Source Debug Mode.</a><br> |
733 |
<?php |
734 |
if (!empty($data_template["id"])) { |
735 |
?><span style="color: #c16921;">*<a href='<?php print htmlspecialchars("data_templates.php?action=template_edit&id=" . (isset($data_template["id"]) ? $data_template["id"] : "0"));?>'>Edit Data Template.</a><br><?php |
736 |
} |
737 |
if (!empty($_GET["host_id"]) || !empty($data_local["host_id"])) { |
738 |
?><span style="color: #c16921;">*<a href='<?php print htmlspecialchars("host.php?action=edit&id=" . (isset($_GET["host_id"]) ? $_GET["host_id"] : $data_local["host_id"]));?>'>Edit Host.</a><br><?php |
739 |
} |
740 |
?> |
741 |
</td> |
742 |
</tr> |
743 |
</table> |
744 |
<br> |
745 |
<?php |
746 |
} |
747 |
|
748 |
html_start_box("<strong>Data Template Selection</strong> $header_label", "100%", $colors["header"], "3", "center", ""); |
749 |
|
750 |
$form_array = array( |
751 |
"data_template_id" => array( |
752 |
"method" => "drop_sql", |
753 |
"friendly_name" => "Selected Data Template", |
754 |
"description" => "The name given to this data template.", |
755 |
"value" => (isset($data_template) ? $data_template["id"] : "0"), |
756 |
"none_value" => "None", |
757 |
"sql" => "select id,name from data_template order by name" |
758 |
), |
759 |
"host_id" => array( |
760 |
"method" => "drop_sql", |
761 |
"friendly_name" => "Host", |
762 |
"description" => "Choose the host that this graph belongs to.", |
763 |
"value" => (isset($_GET["host_id"]) ? $_GET["host_id"] : $data_local["host_id"]), |
764 |
"none_value" => "None", |
765 |
"sql" => "select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname" |
766 |
), |
767 |
"_data_template_id" => array( |
768 |
"method" => "hidden", |
769 |
"value" => (isset($data_template) ? $data_template["id"] : "0") |
770 |
), |
771 |
"_host_id" => array( |
772 |
"method" => "hidden", |
773 |
"value" => (empty($data_local["host_id"]) ? (isset($_GET["host_id"]) ? $_GET["host_id"] : "0") : $data_local["host_id"]) |
774 |
), |
775 |
"_data_input_id" => array( |
776 |
"method" => "hidden", |
777 |
"value" => (isset($data["data_input_id"]) ? $data["data_input_id"] : "0") |
778 |
), |
779 |
"data_template_data_id" => array( |
780 |
"method" => "hidden", |
781 |
"value" => (isset($data) ? $data["id"] : "0") |
782 |
), |
783 |
"local_data_template_data_id" => array( |
784 |
"method" => "hidden", |
785 |
"value" => (isset($data) ? $data["local_data_template_data_id"] : "0") |
786 |
), |
787 |
"local_data_id" => array( |
788 |
"method" => "hidden", |
789 |
"value" => (isset($data) ? $data["local_data_id"] : "0") |
790 |
), |
791 |
); |
792 |
|
793 |
draw_edit_form( |
794 |
array( |
795 |
"config" => array(), |
796 |
"fields" => $form_array |
797 |
) |
798 |
); |
799 |
|
800 |
html_end_box(); |
801 |
|
802 |
/* only display the "inputs" area if we are using a data template for this data source */ |
803 |
if (!empty($data["data_template_id"])) { |
804 |
$template_data_rrds = db_fetch_assoc("select * from data_template_rrd where local_data_id=" . $_GET["id"] . " order by data_source_name"); |
805 |
|
806 |
html_start_box("<strong>Supplemental Data Template Data</strong>", "100%", $colors["header"], "3", "center", ""); |
807 |
|
808 |
draw_nontemplated_fields_data_source($data["data_template_id"], $data["local_data_id"], $data, "|field|", "<strong>Data Source Fields</strong>", true, true, 0); |
809 |
draw_nontemplated_fields_data_source_item($data["data_template_id"], $template_data_rrds, "|field|_|id|", "<strong>Data Source Item Fields</strong>", true, true, true, 0); |
810 |
draw_nontemplated_fields_custom_data($data["id"], "value_|id|", "<strong>Custom Data</strong>", true, true, 0); |
811 |
|
812 |
form_hidden_box("save_component_data","1",""); |
813 |
|
814 |
html_end_box(); |
815 |
} |
816 |
|
817 |
if (((isset($_GET["id"])) || (isset($_GET["new"]))) && (empty($data["data_template_id"]))) { |
818 |
html_start_box("<strong>Data Source</strong>", "100%", $colors["header"], "3", "center", ""); |
819 |
|
820 |
$form_array = array(); |
821 |
|
822 |
while (list($field_name, $field_array) = each($struct_data_source)) { |
823 |
$form_array += array($field_name => $struct_data_source[$field_name]); |
824 |
|
825 |
if (!(($use_data_template == false) || (!empty($data_template_data{"t_" . $field_name})) || ($field_array["flags"] == "NOTEMPLATE"))) { |
826 |
$form_array[$field_name]["description"] = ""; |
827 |
} |
828 |
|
829 |
$form_array[$field_name]["value"] = (isset($data[$field_name]) ? $data[$field_name] : ""); |
830 |
$form_array[$field_name]["form_id"] = (empty($data["id"]) ? "0" : $data["id"]); |
831 |
|
832 |
if (!(($use_data_template == false) || (!empty($data_template_data{"t_" . $field_name})) || ($field_array["flags"] == "NOTEMPLATE"))) { |
833 |
$form_array[$field_name]["method"] = "template_" . $form_array[$field_name]["method"]; |
834 |
} |
835 |
} |
836 |
|
837 |
draw_edit_form( |
838 |
array( |
839 |
"config" => array( |
840 |
"no_form_tag" => true |
841 |
), |
842 |
"fields" => inject_form_variables($form_array, (isset($data) ? $data : array())) |
843 |
) |
844 |
); |
845 |
|
846 |
html_end_box(); |
847 |
|
848 |
/* fetch ALL rrd's for this data source */ |
849 |
if (!empty($_GET["id"])) { |
850 |
$template_data_rrds = db_fetch_assoc("select id,data_source_name from data_template_rrd where local_data_id=" . $_GET["id"] . " order by data_source_name"); |
851 |
} |
852 |
|
853 |
/* select the first "rrd" of this data source by default */ |
854 |
if (empty($_GET["view_rrd"])) { |
855 |
$_GET["view_rrd"] = (isset($template_data_rrds[0]["id"]) ? $template_data_rrds[0]["id"] : "0"); |
856 |
} |
857 |
|
858 |
/* get more information about the rrd we chose */ |
859 |
if (!empty($_GET["view_rrd"])) { |
860 |
$local_data_template_rrd_id = db_fetch_cell("select local_data_template_rrd_id from data_template_rrd where id=" . $_GET["view_rrd"]); |
861 |
|
862 |
$rrd = db_fetch_row("select * from data_template_rrd where id=" . $_GET["view_rrd"]); |
863 |
$rrd_template = db_fetch_row("select * from data_template_rrd where id=$local_data_template_rrd_id"); |
864 |
|
865 |
$header_label = "[edit: " . $rrd["data_source_name"] . "]"; |
866 |
}else{ |
867 |
$header_label = ""; |
868 |
} |
869 |
|
870 |
$i = 0; |
871 |
if (isset($template_data_rrds)) { |
872 |
if (sizeof($template_data_rrds) > 1) { |
873 |
|
874 |
/* draw the data source tabs on the top of the page */ |
875 |
print " <table class='tabs' width='100%' cellspacing='0' cellpadding='3' align='center'> |
876 |
<tr>\n"; |
877 |
|
878 |
foreach ($template_data_rrds as $template_data_rrd) { |
879 |
$i++; |
880 |
print " <td " . (($template_data_rrd["id"] == $_GET["view_rrd"]) ? "bgcolor='silver'" : "bgcolor='#DFDFDF'") . " nowrap='nowrap' width='" . ((strlen($template_data_rrd["data_source_name"]) * 9) + 50) . "' align='center' class='tab'> |
881 |
<span class='textHeader'><a href='" . htmlspecialchars("data_sources.php?action=ds_edit&id=" . $_GET["id"] . "&view_rrd=" . $template_data_rrd["id"]) . "'>$i: " . htmlspecialchars($template_data_rrd["data_source_name"]) . "</a>" . (($use_data_template == false) ? " <a href='" . htmlspecialchars("data_sources.php?action=rrd_remove&id=" . $template_data_rrd["id"] . "&local_data_id=" . $_GET["id"]) . "'><img src='images/delete_icon.gif' border='0' alt='Delete'></a>" : "") . "</span> |
882 |
</td>\n |
883 |
<td width='1'></td>\n"; |
884 |
} |
885 |
|
886 |
print " |
887 |
<td></td>\n |
888 |
</tr> |
889 |
</table>\n"; |
890 |
|
891 |
}elseif (sizeof($template_data_rrds) == 1) { |
892 |
$_GET["view_rrd"] = $template_data_rrds[0]["id"]; |
893 |
} |
894 |
} |
895 |
|
896 |
html_start_box("", "100%", $colors["header"], "3", "center", ""); |
897 |
|
898 |
print " <tr> |
899 |
<td bgcolor='#" . $colors["header"] . "' class='textHeaderDark'> |
900 |
<strong>Data Source Item</strong> $header_label |
901 |
</td> |
902 |
<td class='textHeaderDark' align='right' bgcolor='#" . $colors["header"] . "'> |
903 |
" . ((!empty($_GET["id"]) && (empty($data_template["id"]))) ? "<strong><a class='linkOverDark' href='" . htmlspecialchars("data_sources.php?action=rrd_add&id=" . $_GET["id"]) . "'>New</a> </strong>" : "") . " |
904 |
</td> |
905 |
</tr>\n"; |
906 |
|
907 |
/* data input fields list */ |
908 |
if ((empty($data["data_input_id"])) || (db_fetch_cell("select type_id from data_input where id=" . $data["data_input_id"]) > "1")) { |
909 |
unset($struct_data_source_item["data_input_field_id"]); |
910 |
}else{ |
911 |
$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=" . $data["data_input_id"] . " and input_output='out' and update_rra='on' order by data_name,name"; |
912 |
} |
913 |
|
914 |
$form_array = array(); |
915 |
|
916 |
while (list($field_name, $field_array) = each($struct_data_source_item)) { |
917 |
$form_array += array($field_name => $struct_data_source_item[$field_name]); |
918 |
|
919 |
if (!(($use_data_template == false) || ($rrd_template{"t_" . $field_name} == "on"))) { |
920 |
$form_array[$field_name]["description"] = ""; |
921 |
} |
922 |
|
923 |
$form_array[$field_name]["value"] = (isset($rrd) ? $rrd[$field_name] : ""); |
924 |
|
925 |
if (!(($use_data_template == false) || ($rrd_template{"t_" . $field_name} == "on"))) { |
926 |
$form_array[$field_name]["method"] = "template_" . $form_array[$field_name]["method"]; |
927 |
} |
928 |
} |
929 |
|
930 |
draw_edit_form( |
931 |
array( |
932 |
"config" => array( |
933 |
"no_form_tag" => true |
934 |
), |
935 |
"fields" => array( |
936 |
"data_template_rrd_id" => array( |
937 |
"method" => "hidden", |
938 |
"value" => (isset($rrd) ? $rrd["id"] : "0") |
939 |
), |
940 |
"local_data_template_rrd_id" => array( |
941 |
"method" => "hidden", |
942 |
"value" => (isset($rrd) ? $rrd["local_data_template_rrd_id"] : "0") |
943 |
) |
944 |
) + $form_array |
945 |
) |
946 |
); |
947 |
|
948 |
html_end_box(); |
949 |
|
950 |
/* data source data goes here */ |
951 |
data_edit(); |
952 |
|
953 |
form_hidden_box("current_rrd", $_GET["view_rrd"], "0"); |
954 |
} |
955 |
|
956 |
/* display the debug mode box if the user wants it */ |
957 |
if ((isset($_SESSION["ds_debug_mode"])) && (isset($_GET["id"]))) { |
958 |
?> |
959 |
<table width="100%" align="center"> |
960 |
<tr> |
961 |
<td> |
962 |
<span class="textInfo">Data Source Debug</span><br> |
963 |
<pre><?php print @rrdtool_function_create($_GET["id"], true);?></pre> |
964 |
</td> |
965 |
</tr> |
966 |
</table> |
967 |
<?php |
968 |
} |
969 |
|
970 |
if ((isset($_GET["id"])) || (isset($_GET["new"]))) { |
971 |
form_hidden_box("save_component_data_source","1",""); |
972 |
}else{ |
973 |
form_hidden_box("save_component_data_source_new","1",""); |
974 |
} |
975 |
|
976 |
form_save_button("data_sources.php"); |
977 |
|
978 |
include_once("./include/bottom_footer.php"); |
979 |
|
980 |
} |
981 |
|
982 |
function get_poller_interval($seconds) { |
983 |
if ($seconds == 0) { |
984 |
return "<em>External</em>"; |
985 |
}else if ($seconds < 60) { |
986 |
return "<em>" . $seconds . " Seconds</em>"; |
987 |
}else if ($seconds == 60) { |
988 |
return "1 Minute"; |
989 |
}else{ |
990 |
return "<em>" . ($seconds / 60) . " Minutes</em>"; |
991 |
} |
992 |
} |
993 |
|
994 |
function ds() { |
995 |
global $colors, $ds_actions, $item_rows; |
996 |
|
997 |
/* ================= input validation ================= */ |
998 |
input_validate_input_number(get_request_var_request("ds_rows")); |
999 |
input_validate_input_number(get_request_var_request("host_id")); |
1000 |
input_validate_input_number(get_request_var_request("template_id")); |
1001 |
input_validate_input_number(get_request_var_request("method_id")); |
1002 |
input_validate_input_number(get_request_var_request("page")); |
1003 |
/* ==================================================== */ |
1004 |
|
1005 |
/* clean up search string */ |
1006 |
if (isset($_REQUEST["filter"])) { |
1007 |
$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter")); |
1008 |
} |
1009 |
|
1010 |
/* clean up sort_column string */ |
1011 |
if (isset($_REQUEST["sort_column"])) { |
1012 |
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column")); |
1013 |
} |
1014 |
|
1015 |
/* clean up sort_direction string */ |
1016 |
if (isset($_REQUEST["sort_direction"])) { |
1017 |
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction")); |
1018 |
} |
1019 |
|
1020 |
/* if the user pushed the 'clear' button */ |
1021 |
if (isset($_REQUEST["clear_x"])) { |
1022 |
kill_session_var("sess_ds_current_page"); |
1023 |
kill_session_var("sess_ds_filter"); |
1024 |
kill_session_var("sess_ds_sort_column"); |
1025 |
kill_session_var("sess_ds_sort_direction"); |
1026 |
kill_session_var("sess_ds_rows"); |
1027 |
kill_session_var("sess_ds_host_id"); |
1028 |
kill_session_var("sess_ds_template_id"); |
1029 |
kill_session_var("sess_ds_method_id"); |
1030 |
|
1031 |
unset($_REQUEST["page"]); |
1032 |
unset($_REQUEST["filter"]); |
1033 |
unset($_REQUEST["sort_column"]); |
1034 |
unset($_REQUEST["sort_direction"]); |
1035 |
unset($_REQUEST["ds_rows"]); |
1036 |
unset($_REQUEST["host_id"]); |
1037 |
unset($_REQUEST["template_id"]); |
1038 |
unset($_REQUEST["method_id"]); |
1039 |
} |
1040 |
|
1041 |
/* remember these search fields in session vars so we don't have to keep passing them around */ |
1042 |
load_current_session_value("page", "sess_ds_current_page", "1"); |
1043 |
load_current_session_value("filter", "sess_ds_filter", ""); |
1044 |
load_current_session_value("sort_column", "sess_ds_sort_column", "name_cache"); |
1045 |
load_current_session_value("sort_direction", "sess_ds_sort_direction", "ASC"); |
1046 |
load_current_session_value("ds_rows", "sess_ds_rows", read_config_option("num_rows_data_source")); |
1047 |
load_current_session_value("host_id", "sess_ds_host_id", "-1"); |
1048 |
load_current_session_value("template_id", "sess_ds_template_id", "-1"); |
1049 |
load_current_session_value("method_id", "sess_ds_method_id", "-1"); |
1050 |
|
1051 |
$host = db_fetch_row("select hostname from host where id=" . get_request_var_request("host_id")); |
1052 |
|
1053 |
/* if the number of rows is -1, set it to the default */ |
1054 |
if (get_request_var_request("ds_rows") == -1) { |
1055 |
$_REQUEST["ds_rows"] = read_config_option("num_rows_data_source"); |
1056 |
} |
1057 |
|
1058 |
?> |
1059 |
<script type="text/javascript"> |
1060 |
<!-- |
1061 |
|
1062 |
function applyDSFilterChange(objForm) { |
1063 |
strURL = '?host_id=' + objForm.host_id.value; |
1064 |
strURL = strURL + '&filter=' + objForm.filter.value; |
1065 |
strURL = strURL + '&ds_rows=' + objForm.ds_rows.value; |
1066 |
strURL = strURL + '&template_id=' + objForm.template_id.value; |
1067 |
strURL = strURL + '&method_id=' + objForm.method_id.value; |
1068 |
document.location = strURL; |
1069 |
} |
1070 |
|
1071 |
--> |
1072 |
</script> |
1073 |
<?php |
1074 |
|
1075 |
html_start_box("<strong>Data Sources</strong> [host: " . (empty($host["hostname"]) ? "No Host" : htmlspecialchars($host["hostname"])) . "]", "100%", $colors["header"], "3", "center", "data_sources.php?action=ds_edit&host_id=" . get_request_var_request("host_id")); |
1076 |
|
1077 |
?> |
1078 |
<tr bgcolor="#<?php print $colors["panel"];?>"> |
1079 |
<td> |
1080 |
<form name="form_data_sources" action="data_sources.php"> |
1081 |
<table cellpadding="1" cellspacing="0"> |
1082 |
<tr> |
1083 |
<td width="50"> |
1084 |
Host: |
1085 |
</td> |
1086 |
<td> |
1087 |
<select name="host_id" onChange="applyDSFilterChange(document.form_data_sources)"> |
1088 |
<option value="-1"<?php if (get_request_var_request("host_id") == "-1") {?> selected<?php }?>>Any</option> |
1089 |
<option value="0"<?php if (get_request_var_request("host_id") == "0") {?> selected<?php }?>>None</option> |
1090 |
<?php |
1091 |
$hosts = db_fetch_assoc("select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname"); |
1092 |
|
1093 |
if (sizeof($hosts) > 0) { |
1094 |
foreach ($hosts as $host) { |
1095 |
print "<option value='" . $host["id"] . "'"; if (get_request_var_request("host_id") == $host["id"]) { print " selected"; } print ">" . title_trim(htmlspecialchars($host["name"]), 40) . "</option>\n"; |
1096 |
} |
1097 |
} |
1098 |
?> |
1099 |
|
1100 |
</select> |
1101 |
</td> |
1102 |
<td width="50"> |
1103 |
Template: |
1104 |
</td> |
1105 |
<td width="1"> |
1106 |
<select name="template_id" onChange="applyDSFilterChange(document.form_data_sources)"> |
1107 |
<option value="-1"<?php if (get_request_var_request("template_id") == "-1") {?> selected<?php }?>>Any</option> |
1108 |
<option value="0"<?php if (get_request_var_request("template_id") == "0") {?> selected<?php }?>>None</option> |
1109 |
<?php |
1110 |
|
1111 |
$templates = db_fetch_assoc("SELECT DISTINCT data_template.id, data_template.name |
1112 |
FROM data_template |
1113 |
INNER JOIN data_template_data |
1114 |
ON data_template.id=data_template_data.data_template_id |
1115 |
WHERE data_template_data.local_data_id>0 |
1116 |
ORDER BY data_template.name"); |
1117 |
|
1118 |
if (sizeof($templates) > 0) { |
1119 |
foreach ($templates as $template) { |
1120 |
print "<option value='" . $template["id"] . "'"; if (get_request_var_request("template_id") == $template["id"]) { print " selected"; } print ">" . title_trim(htmlspecialchars($template["name"]), 40) . "</option>\n"; |
1121 |
} |
1122 |
} |
1123 |
?> |
1124 |
|
1125 |
</select> |
1126 |
</td> |
1127 |
<td nowrap style='white-space: nowrap;'> |
1128 |
<input type="submit" value="Go" title="Set/Refresh Filters"> |
1129 |
<input type="submit" name="clear_x" value="Clear" title="Clear Filters"> |
1130 |
</td> |
1131 |
</tr> |
1132 |
<tr> |
1133 |
<td width="50"> |
1134 |
Method: |
1135 |
</td> |
1136 |
<td width="1"> |
1137 |
<select name="method_id" onChange="applyDSFilterChange(document.form_data_sources)"> |
1138 |
<option value="-1"<?php if (get_request_var_request("method_id") == "-1") {?> selected<?php }?>>Any</option> |
1139 |
<option value="0"<?php if (get_request_var_request("method_id") == "0") {?> selected<?php }?>>None</option> |
1140 |
<?php |
1141 |
|
1142 |
$methods = db_fetch_assoc("SELECT DISTINCT data_input.id, data_input.name |
1143 |
FROM data_input |
1144 |
INNER JOIN data_template_data |
1145 |
ON data_input.id=data_template_data.data_input_id |
1146 |
WHERE data_template_data.local_data_id>0 |
1147 |
ORDER BY data_input.name"); |
1148 |
|
1149 |
if (sizeof($methods) > 0) { |
1150 |
foreach ($methods as $method) { |
1151 |
print "<option value='" . $method["id"] . "'"; if (get_request_var_request("method_id") == $method["id"]) { print " selected"; } print ">" . title_trim(htmlspecialchars($method["name"]), 40) . "</option>\n"; |
1152 |
} |
1153 |
} |
1154 |
?> |
1155 |
</select> |
1156 |
</td> |
1157 |
<td nowrap style='white-space: nowrap;' width="50"> |
1158 |
Rows per Page: |
1159 |
</td> |
1160 |
<td width="1"> |
1161 |
<select name="ds_rows" onChange="applyDSFilterChange(document.form_data_sources)"> |
1162 |
<option value="-1"<?php if (get_request_var_request("ds_rows") == "-1") {?> selected<?php }?>>Default</option> |
1163 |
<?php |
1164 |
if (sizeof($item_rows) > 0) { |
1165 |
foreach ($item_rows as $key => $value) { |
1166 |
print "<option value='" . $key . "'"; if (get_request_var_request("ds_rows") == $key) { print " selected"; } print ">" . htmlspecialchars($value) . "</option>\n"; |
1167 |
} |
1168 |
} |
1169 |
?> |
1170 |
</select> |
1171 |
</td> |
1172 |
</tr> |
1173 |
</table> |
1174 |
<table cellpadding="1" cellspacing="0"> |
1175 |
<tr> |
1176 |
<td width="50"> |
1177 |
Search: |
1178 |
</td> |
1179 |
<td width="1"> |
1180 |
<input type="text" name="filter" size="40" value="<?php print htmlspecialchars(get_request_var_request("filter"));?>"> |
1181 |
</td> |
1182 |
</tr> |
1183 |
</table> |
1184 |
<input type='hidden' name='page' value='1'> |
1185 |
</form> |
1186 |
</td> |
1187 |
</tr> |
1188 |
<?php |
1189 |
|
1190 |
html_end_box(); |
1191 |
|
1192 |
/* form the 'where' clause for our main sql query */ |
1193 |
if (strlen(get_request_var_request("filter"))) { |
1194 |
$sql_where1 = "AND (data_template_data.name_cache like '%%" . get_request_var_request("filter") . "%%'" . |
1195 |
" OR data_template_data.local_data_id like '%%" . get_request_var_request("filter") . "%%'" . |
1196 |
" OR data_template.name like '%%" . get_request_var_request("filter") . "%%'" . |
1197 |
" OR data_input.name like '%%" . get_request_var_request("filter") . "%%')"; |
1198 |
|
1199 |
$sql_where2 = "AND (data_template_data.name_cache like '%%" . get_request_var_request("filter") . "%%'" . |
1200 |
" OR data_template.name like '%%" . get_request_var_request("filter") . "%%')"; |
1201 |
}else{ |
1202 |
$sql_where1 = ""; |
1203 |
$sql_where2 = ""; |
1204 |
} |
1205 |
|
1206 |
if (get_request_var_request("host_id") == "-1") { |
1207 |
/* Show all items */ |
1208 |
}elseif (get_request_var_request("host_id") == "0") { |
1209 |
$sql_where1 .= " AND data_local.host_id=0"; |
1210 |
$sql_where2 .= " AND data_local.host_id=0"; |
1211 |
}elseif (!empty($_REQUEST["host_id"])) { |
1212 |
$sql_where1 .= " AND data_local.host_id=" . get_request_var_request("host_id"); |
1213 |
$sql_where2 .= " AND data_local.host_id=" . get_request_var_request("host_id"); |
1214 |
} |
1215 |
|
1216 |
if (get_request_var_request("template_id") == "-1") { |
1217 |
/* Show all items */ |
1218 |
}elseif (get_request_var_request("template_id") == "0") { |
1219 |
$sql_where1 .= " AND data_template_data.data_template_id=0"; |
1220 |
$sql_where2 .= " AND data_template_data.data_template_id=0"; |
1221 |
}elseif (!empty($_REQUEST["host_id"])) { |
1222 |
$sql_where1 .= " AND data_template_data.data_template_id=" . get_request_var_request("template_id"); |
1223 |
$sql_where2 .= " AND data_template_data.data_template_id=" . get_request_var_request("template_id"); |
1224 |
} |
1225 |
|
1226 |
if (get_request_var_request("method_id") == "-1") { |
1227 |
/* Show all items */ |
1228 |
}elseif (get_request_var_request("method_id") == "0") { |
1229 |
$sql_where1 .= " AND data_template_data.data_input_id=0"; |
1230 |
$sql_where2 .= " AND data_template_data.data_input_id=0"; |
1231 |
}elseif (!empty($_REQUEST["method_id"])) { |
1232 |
$sql_where1 .= " AND data_template_data.data_input_id=" . get_request_var_request("method_id"); |
1233 |
$sql_where2 .= " AND data_template_data.data_input_id=" . get_request_var_request("method_id"); |
1234 |
} |
1235 |
|
1236 |
$total_rows = sizeof(db_fetch_assoc("SELECT |
1237 |
data_local.id |
1238 |
FROM (data_local,data_template_data) |
1239 |
LEFT JOIN data_input |
1240 |
ON (data_input.id=data_template_data.data_input_id) |
1241 |
LEFT JOIN data_template |
1242 |
ON (data_local.data_template_id=data_template.id) |
1243 |
WHERE data_local.id=data_template_data.local_data_id |
1244 |
$sql_where1")); |
1245 |
|
1246 |
$poller_intervals = array_rekey(db_fetch_assoc("SELECT data_template_data.local_data_id AS id, |
1247 |
Min(data_template_data.rrd_step*rra.steps) AS poller_interval |
1248 |
FROM data_template |
1249 |
INNER JOIN (data_local |
1250 |
INNER JOIN ((data_template_data_rra |
1251 |
INNER JOIN data_template_data ON data_template_data_rra.data_template_data_id=data_template_data.id) |
1252 |
INNER JOIN rra ON data_template_data_rra.rra_id = rra.id) ON data_local.id = data_template_data.local_data_id) ON data_template.id = data_template_data.data_template_id |
1253 |
$sql_where2 |
1254 |
GROUP BY data_template_data.local_data_id"), "id", "poller_interval"); |
1255 |
|
1256 |
$data_sources = db_fetch_assoc("SELECT |
1257 |
data_template_data.local_data_id, |
1258 |
data_template_data.name_cache, |
1259 |
data_template_data.active, |
1260 |
data_input.name as data_input_name, |
1261 |
data_template.name as data_template_name, |
1262 |
data_local.host_id |
1263 |
FROM (data_local,data_template_data) |
1264 |
LEFT JOIN data_input |
1265 |
ON (data_input.id=data_template_data.data_input_id) |
1266 |
LEFT JOIN data_template |
1267 |
ON (data_local.data_template_id=data_template.id) |
1268 |
WHERE data_local.id=data_template_data.local_data_id |
1269 |
$sql_where1 |
1270 |
ORDER BY ". get_request_var_request("sort_column") . " " . get_request_var_request("sort_direction") . |
1271 |
" LIMIT " . (get_request_var_request("ds_rows")*(get_request_var_request("page")-1)) . "," . get_request_var_request("ds_rows")); |
1272 |
|
1273 |
print "<form name='chk' method='post' action='data_sources.php'>\n"; |
1274 |
|
1275 |
html_start_box("", "100%", $colors["header"], "3", "center", ""); |
1276 |
|
1277 |
/* generate page list */ |
1278 |
$url_page_select = get_page_list(get_request_var_request("page"), MAX_DISPLAY_PAGES, get_request_var_request("ds_rows"), $total_rows, "data_sources.php?filter=" . get_request_var_request("filter") . "&host_id=" . get_request_var_request("host_id")); |
1279 |
|
1280 |
$nav = "<tr bgcolor='#" . $colors["header"] . "'> |
1281 |
<td colspan='7'> |
1282 |
<table width='100%' cellspacing='0' cellpadding='0' border='0'> |
1283 |
<tr> |
1284 |
<td align='left' class='textHeaderDark'> |
1285 |
<strong><< "; if (get_request_var_request("page") > 1) { $nav .= "<a class='linkOverDark' href='" . htmlspecialchars("data_sources.php?filter=" . get_request_var_request("filter") . "&host_id=" . get_request_var_request("host_id") . "&page=" . (get_request_var_request("page")-1)) . "'>"; } $nav .= "Previous"; if (get_request_var_request("page") > 1) { $nav .= "</a>"; } $nav .= "</strong> |
1286 |
</td>\n |
1287 |
<td align='center' class='textHeaderDark'> |
1288 |
Showing Rows " . ((get_request_var_request("ds_rows")*(get_request_var_request("page")-1))+1) . " to " . ((($total_rows < get_request_var_request("ds_rows")) || ($total_rows < (get_request_var_request("ds_rows")*get_request_var_request("page")))) ? $total_rows : (get_request_var_request("ds_rows")*get_request_var_request("page"))) . " of $total_rows [$url_page_select] |
1289 |
</td>\n |
1290 |
<td align='right' class='textHeaderDark'> |
1291 |
<strong>"; if ((get_request_var_request("page") * get_request_var_request("ds_rows")) < $total_rows) { $nav .= "<a class='linkOverDark' href='" . htmlspecialchars("data_sources.php?filter=" . get_request_var_request("filter") . "&host_id=" . get_request_var_request("host_id") . "&page=" . (get_request_var_request("page")+1)) . "'>"; } $nav .= "Next"; if ((get_request_var_request("page") * get_request_var_request("ds_rows")) < $total_rows) { $nav .= "</a>"; } $nav .= " >></strong> |
1292 |
</td>\n |
1293 |
</tr> |
1294 |
</table> |
1295 |
</td> |
1296 |
</tr>\n"; |
1297 |
|
1298 |
print $nav; |
1299 |
|
1300 |
$display_text = array( |
1301 |
"name_cache" => array("Name", "ASC"), |
1302 |
"local_data_id" => array("ID","ASC"), |
1303 |
"data_input_name" => array("Data Input Method", "ASC"), |
1304 |
"nosort" => array("Poller Interval", "ASC"), |
1305 |
"active" => array("Active", "ASC"), |
1306 |
"data_template_name" => array("Template Name", "ASC")); |
1307 |
|
1308 |
html_header_sort_checkbox($display_text, get_request_var_request("sort_column"), get_request_var_request("sort_direction"), false); |
1309 |
|
1310 |
$i = 0; |
1311 |
if (sizeof($data_sources) > 0) { |
1312 |
foreach ($data_sources as $data_source) { |
1313 |
/* we're escaping strings here, so no need to escape them on form_selectable_cell */ |
1314 |
$data_template_name = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : htmlspecialchars($data_source["data_template_name"])); |
1315 |
$data_input_name = ((empty($data_source["data_input_name"])) ? "<em>External</em>" : htmlspecialchars($data_source["data_input_name"])); |
1316 |
$poller_interval = ((isset($poller_intervals[$data_source["local_data_id"]])) ? $poller_intervals[$data_source["local_data_id"]] : 0); |
1317 |
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $data_source["local_data_id"]); $i++; |
1318 |
form_selectable_cell("<a class='linkEditMain' href='" . htmlspecialchars("data_sources.php?action=ds_edit&id=" . $data_source["local_data_id"]) . "' title='" . $data_source["name_cache"] . "'>" . ((get_request_var_request("filter") != "") ? eregi_replace("(" . preg_quote(get_request_var_request("filter")) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim(htmlspecialchars($data_source["name_cache"]), read_config_option("max_title_data_source"))) : title_trim(htmlspecialchars($data_source["name_cache"]), read_config_option("max_title_data_source"))) . "</a>", $data_source["local_data_id"]); |
1319 |
form_selectable_cell($data_source['local_data_id'], $data_source['local_data_id']); |
1320 |
form_selectable_cell(((get_request_var_request("filter") != "") ? eregi_replace("(" . preg_quote(get_request_var_request("filter")) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $data_input_name) : $data_input_name), $data_source["local_data_id"]); |
1321 |
form_selectable_cell(get_poller_interval($poller_interval), $data_source["local_data_id"]); |
1322 |
form_selectable_cell(($data_source['active'] == "on" ? "Yes" : "No"), $data_source["local_data_id"]); |
1323 |
form_selectable_cell(((get_request_var_request("filter") != "") ? eregi_replace("(" . preg_quote(get_request_var_request("filter")) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $data_template_name) : $data_template_name), $data_source["local_data_id"]); |
1324 |
form_checkbox_cell($data_source["name_cache"], $data_source["local_data_id"]); |
1325 |
form_end_row(); |
1326 |
} |
1327 |
|
1328 |
/* put the nav bar on the bottom as well */ |
1329 |
print $nav; |
1330 |
}else{ |
1331 |
print "<tr><td><em>No Data Sources</em></td></tr>"; |
1332 |
} |
1333 |
|
1334 |
html_end_box(false); |
1335 |
|
1336 |
/* draw the dropdown containing a list of available actions for this form */ |
1337 |
draw_actions_dropdown($ds_actions); |
1338 |
|
1339 |
print "</form>\n"; |
1340 |
} |
1341 |
?> |
1342 |
|