|
24 | 24 |
|
25 | 25 | include_once('./include/auth.php');
|
26 | 26 |
|
27 |
| -$aggregate_actions = array( |
| 27 | +$actions = array( |
28 | 28 | 1 => __('Delete'),
|
29 | 29 | 2 => __('Duplicate'),
|
30 | 30 | 3 => __('Sync Aggregates')
|
@@ -256,7 +256,7 @@ function form_save() {
|
256 | 256 | * form_actions the action function
|
257 | 257 | */
|
258 | 258 | function form_actions() {
|
259 |
| - global $aggregate_actions, $config; |
| 259 | + global $actions, $config; |
260 | 260 | include_once(CACTI_PATH_LIBRARY . '/api_aggregate.php');
|
261 | 261 |
|
262 | 262 | /* ================= input validation ================= */
|
@@ -285,88 +285,67 @@ function form_actions() {
|
285 | 285 | header('Location: color_templates.php');
|
286 | 286 |
|
287 | 287 | exit;
|
288 |
| - } |
289 |
| - |
290 |
| - /* setup some variables */ |
291 |
| - $color_list = ''; |
292 |
| - $i = 0; |
293 |
| - |
294 |
| - /* loop through each of the color templates selected on the previous page and get more info about them */ |
295 |
| - foreach ($_POST as $var => $val) { |
296 |
| - if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { |
297 |
| - /* ================= input validation ================= */ |
298 |
| - input_validate_input_number($matches[1], 'chk[1]'); |
299 |
| - /* ==================================================== */ |
300 |
| - |
301 |
| - $name = db_fetch_cell_prepared('SELECT name |
302 |
| - FROM color_templates |
303 |
| - WHERE color_template_id = ?', |
304 |
| - array($matches[1])); |
305 |
| - |
306 |
| - $color_list .= '<li>' . html_escape($name) . '</li>'; |
307 |
| - $color_array[] = $matches[1]; |
| 288 | + } else { |
| 289 | + $ilist = ''; |
| 290 | + $iarray = array(); |
| 291 | + |
| 292 | + /* loop through each of the color templates selected on the previous page and get more info about them */ |
| 293 | + foreach ($_POST as $var => $val) { |
| 294 | + if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { |
| 295 | + /* ================= input validation ================= */ |
| 296 | + input_validate_input_number($matches[1], 'chk[1]'); |
| 297 | + /* ==================================================== */ |
| 298 | + |
| 299 | + $name = db_fetch_cell_prepared('SELECT name |
| 300 | + FROM color_templates |
| 301 | + WHERE color_template_id = ?', |
| 302 | + array($matches[1])); |
| 303 | + |
| 304 | + $ilist .= '<li>' . html_escape($name) . '</li>'; |
| 305 | + $iarray[] = $matches[1]; |
| 306 | + } |
308 | 307 | }
|
309 |
| - } |
310 |
| - |
311 |
| - top_header(); |
312 | 308 |
|
313 |
| - form_start('color_templates.php'); |
314 |
| - |
315 |
| - html_start_box($aggregate_actions[get_nfilter_request_var('drp_action')], '60%', '', '3', 'center', ''); |
316 |
| - |
317 |
| - if (isset($color_array) && cacti_sizeof($color_array)) { |
318 |
| - if (get_request_var('drp_action') == '1') { /* delete */ |
319 |
| - print "<tr> |
320 |
| - <td class='textArea'> |
321 |
| - <p>" . __n('Click \'Continue\' to delete the following Color Template', 'Click \'Continue\' to delete following Color Templates', cacti_sizeof($color_array)) . "</p> |
322 |
| - <div class='itemlist'><ul>$color_list</ul></div> |
323 |
| - </td> |
324 |
| - </tr>"; |
325 |
| - |
326 |
| - $save_html = "<input type='button' class='ui-button ui-corner-all ui-widget' value='" . __esc('Cancel') . "' onClick='cactiReturnTo()'> <input type='submit' class='ui-button ui-corner-all ui-widget' value='" . __esc('Continue') . "' title='" . __n('Delete Color Template', 'Delete Color Templates', cacti_sizeof($color_array)) . "'>"; |
327 |
| - } elseif (get_request_var('drp_action') == '2') { // duplicate |
328 |
| - print "<tr> |
329 |
| - <td class='textArea'> |
330 |
| - <p>" . __n('Click \'Continue\' to duplicate the following Color Template. You can optionally change the title format for the new color template.', 'Click \'Continue\' to duplicate following Color Templates. You can optionally change the title format for the new color templates.', cacti_sizeof($color_array)) . "</p> |
331 |
| - <div class='itemlist'><ul>$color_list</ul></div> |
332 |
| - <p>" . __('Title Format:') . '<br>'; |
333 |
| - form_text_box('title_format', '<template_title> (1)', '', '255', '30', 'text'); |
334 |
| - print '</p> |
335 |
| - </td> |
336 |
| - </tr>'; |
337 |
| - |
338 |
| - $save_html = "<input type='button' class='ui-button ui-corner-all ui-widget' value='" . __esc('Cancel') . "' onClick='cactiReturnTo()'> <input type='submit' class='ui-button ui-corner-all ui-widget' value='" . __esc('Continue') . "' title='" . __n('Duplicate Color Template', 'Duplicate Color Templates', cacti_sizeof($color_array)) . "'>"; |
339 |
| - } elseif (get_request_var('drp_action') == '3') { // sync |
340 |
| - print "<tr> |
341 |
| - <td class='textArea'> |
342 |
| - <p>" . __n('Click \'Continue\' to Synchronize all Aggregate Graphs with the selected Color Template.', 'Click \'Continue\' to Synchronize all Aggregate Graphs with the selected Color Templates.', cacti_sizeof($color_array)) . "</p> |
343 |
| - <div class='itemlist'><ul>$color_list</ul></div></p> |
344 |
| - </td> |
345 |
| - </tr>"; |
346 |
| - |
347 |
| - $save_html = "<input type='button' class='ui-button ui-corner-all ui-widget' value='" . __esc('Cancel') . "' onClick='cactiReturnTo()'> <input type='submit' class='ui-button ui-corner-all ui-widget' value='" . __esc('Continue') . "' title='" . __n('Synchronize Color Template', 'Synchronize Color Templates', cacti_sizeof($color_array)) . "'>"; |
348 |
| - } |
349 |
| - } else { |
350 |
| - raise_message(40); |
351 |
| - header('Location: color_templates.php'); |
| 309 | + $form_data = array( |
| 310 | + 'general' => array( |
| 311 | + 'page' => 'color_templates.php', |
| 312 | + 'actions' => $actions, |
| 313 | + 'optvar' => 'drp_action', |
| 314 | + 'item_array' => $iarray, |
| 315 | + 'item_list' => $ilist |
| 316 | + ), |
| 317 | + 'options' => array( |
| 318 | + 1 => array( |
| 319 | + 'smessage' => __('Click \'Continue\' to Delete the following Color Template.'), |
| 320 | + 'pmessage' => __('Click \'Continue\' to Delete following Color Templates.'), |
| 321 | + 'scont' => __('Delete Color Template'), |
| 322 | + 'pcont' => __('Delete Color Templates') |
| 323 | + ), |
| 324 | + 2 => array( |
| 325 | + 'smessage' => __('Click \'Continue\' to Duplicate the following Color Template.'), |
| 326 | + 'pmessage' => __('Click \'Continue\' to Duplicate following Color Templates.'), |
| 327 | + 'scont' => __('Duplicate Color Template'), |
| 328 | + 'pcont' => __('Duplicate Color Templates'), |
| 329 | + 'extra' => array( |
| 330 | + 'title_format' => array( |
| 331 | + 'method' => 'textbox', |
| 332 | + 'title' => __('Title Format:'), |
| 333 | + 'default' => '<template_titel> (1)', |
| 334 | + 'width' => 25 |
| 335 | + ) |
| 336 | + ) |
| 337 | + ), |
| 338 | + 3 => array( |
| 339 | + 'smessage' => __('Click \'Continue\' to Syncronize the following Color Template to its Aggregates.'), |
| 340 | + 'pmessage' => __('Click \'Continue\' to Syncronize the following Color Templates to its Aggregates.'), |
| 341 | + 'scont' => __('Synchronize Color Template'), |
| 342 | + 'pcont' => __('Synchronize Color Templates') |
| 343 | + ), |
| 344 | + ) |
| 345 | + ); |
352 | 346 |
|
353 |
| - exit; |
| 347 | + form_continue_confirmation($form_data); |
354 | 348 | }
|
355 |
| - |
356 |
| - print "<tr> |
357 |
| - <td class='saveRow'> |
358 |
| - <input type='hidden' name='action' value='actions'> |
359 |
| - <input type='hidden' name='selected_items' value='" . (isset($color_array) ? serialize($color_array) : '') . "'> |
360 |
| - <input type='hidden' name='drp_action' value='" . get_request_var('drp_action') . "'> |
361 |
| - $save_html |
362 |
| - </td> |
363 |
| - </tr>\n"; |
364 |
| - |
365 |
| - html_end_box(); |
366 |
| - |
367 |
| - form_end(); |
368 |
| - |
369 |
| - bottom_footer(); |
370 | 349 | }
|
371 | 350 |
|
372 | 351 | function color_templates_item_dnd() {
|
@@ -790,7 +769,7 @@ function sync_color_templates($color_template) {
|
790 | 769 | * color_template maintain color templates
|
791 | 770 | */
|
792 | 771 | function color_template() {
|
793 |
| - global $aggregate_actions, $item_rows, $config; |
| 772 | + global $actions, $item_rows, $config; |
794 | 773 | include_once(CACTI_PATH_LIBRARY . '/api_aggregate.php');
|
795 | 774 |
|
796 | 775 | /* ================= input validation and session storage ================= */
|
@@ -981,7 +960,7 @@ function color_template() {
|
981 | 960 | }
|
982 | 961 |
|
983 | 962 | /* draw the dropdown containing a list of available actions for this form */
|
984 |
| - draw_actions_dropdown($aggregate_actions); |
| 963 | + draw_actions_dropdown($actions); |
985 | 964 |
|
986 | 965 | form_end();
|
987 | 966 |
|
|
0 commit comments