@@ -368,8 +368,7 @@ function form_save() {
368
368
$ task_item_changed = true ;
369
369
370
370
if (get_request_var ('graph_template_item_id ' ) > 0 ) {
371
- $ task_item_id = db_fetch_cell_prepared (
372
- 'SELECT task_item_id
371
+ $ task_item_id = db_fetch_cell_prepared ('SELECT task_item_id
373
372
FROM graph_templates_item
374
373
WHERE id = ? ' ,
375
374
array (get_request_var ('graph_template_item_id ' ))
@@ -474,8 +473,7 @@ function form_save() {
474
473
475
474
/* an input for the current data source does NOT currently exist, let's create one */
476
475
if (!isset ($ orig_data_source_to_input [$ save ['task_item_id ' ]])) {
477
- $ ds_name = db_fetch_cell_prepared (
478
- 'SELECT data_source_name
476
+ $ ds_name = db_fetch_cell_prepared ('SELECT data_source_name
479
477
FROM data_template_rrd
480
478
WHERE id = ? ' ,
481
479
array (get_nfilter_request_var ('task_item_id ' ))
@@ -490,8 +488,7 @@ function form_save() {
490
488
491
489
$ graph_template_input_id = db_fetch_insert_id ();
492
490
493
- $ graph_items = db_fetch_assoc_prepared (
494
- 'SELECT id
491
+ $ graph_items = db_fetch_assoc_prepared ('SELECT id
495
492
FROM graph_templates_item
496
493
WHERE graph_template_id = ?
497
494
AND task_item_id = ? ' ,
@@ -557,7 +554,13 @@ function form_save() {
557
554
raise_message (1 );
558
555
559
556
/* list all graph items from the db so we can compare them with the current form */
560
- $ db_selected_graph_item = array_rekey (db_fetch_assoc_prepared ('SELECT graph_template_item_id FROM graph_template_input_defs WHERE graph_template_input_id = ? ' , array ($ graph_template_input_id )), 'graph_template_item_id ' , 'graph_template_item_id ' );
557
+ $ db_selected_graph_item = array_rekey (
558
+ db_fetch_assoc_prepared ('SELECT graph_template_item_id
559
+ FROM graph_template_input_defs
560
+ WHERE graph_template_input_id = ? ' ,
561
+ array ($ graph_template_input_id )),
562
+ 'graph_template_item_id ' , 'graph_template_item_id '
563
+ );
561
564
562
565
/* list all select graph items for use down below */
563
566
foreach ($ _POST as $ var => $ val ) {
@@ -686,8 +689,7 @@ function item_remove() {
686
689
db_execute_prepared ('DELETE FROM graph_templates_item WHERE local_graph_template_item_id = ? ' , array (get_request_var ('id ' )));
687
690
688
691
/* delete the graph item input if it is empty */
689
- $ graph_item_inputs = db_fetch_assoc_prepared ('SELECT
690
- graph_template_input.id
692
+ $ graph_item_inputs = db_fetch_assoc_prepared ('SELECT graph_template_input.id
691
693
FROM (graph_template_input, graph_template_input_defs)
692
694
WHERE graph_template_input.id = graph_template_input_defs.graph_template_input_id
693
695
AND graph_template_input.graph_template_id = ?
@@ -1033,7 +1035,7 @@ function form_actions() {
1033
1035
retemplate_graphs ($ selected_items [$ i ]);
1034
1036
1035
1037
$ graph_template_name = db_fetch_cell_prepared ('SELECT name
1036
- FROM graph_templates AS gt
1038
+ FROM graph_templates
1037
1039
WHERE id = ? ' ,
1038
1040
array ($ selected_items [$ i ]));
1039
1041
@@ -1154,98 +1156,6 @@ function form_actions() {
1154
1156
1155
1157
form_continue_confirmation ($ form_data );
1156
1158
}
1157
- exit ;
1158
-
1159
- top_header ();
1160
-
1161
- form_start ('graph_templates.php ' );
1162
-
1163
- html_start_box ($ actions [get_nfilter_request_var ('drp_action ' )], '60% ' , '' , '3 ' , 'center ' , '' );
1164
-
1165
- if (isset ($ graph_array ) && cacti_sizeof ($ graph_array )) {
1166
- if (get_request_var ('drp_action ' ) == '1 ' ) { // delete
1167
- print "<tr>
1168
- <td class='textArea'>
1169
- <p> " . __ ('Click \'Continue \' to delete the following Graph Template(s). Any Graph(s) associated with the Template(s) will become individual Graph(s). ' ) . "</p>
1170
- <div class='itemlist'><ul> $ graph_list</ul></div>
1171
- </td>
1172
- </tr> \n" ;
1173
-
1174
- $ 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=' " . __esc ('Delete Graph Template(s) ' ) . "'> " ;
1175
- } elseif (get_request_var ('drp_action ' ) == '2 ' ) { // duplicate
1176
- print "<tr>
1177
- <td class='textArea'>
1178
- <p> " . __ ('Click \'Continue \' to duplicate the following Graph Template(s). You can optionally change the title format for the new Graph Template(s). ' ) . "</p>
1179
- <div class='itemlist'><ul> $ graph_list</ul></div>
1180
- <p><strong> " . __ ('Title Format: ' ). '</strong><br> ' ;
1181
- form_text_box ('title_format ' , '<template_title> (1) ' , '' , '255 ' , '30 ' , 'text ' );
1182
- print "</p>
1183
- </td>
1184
- </tr> \n" ;
1185
-
1186
- $ 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=' " . __esc ('Duplicate Graph Template(s) ' ) . "'> " ;
1187
- } elseif (get_request_var ('drp_action ' ) == '3 ' ) { // resize
1188
- print "<tr>
1189
- <td class='textArea'>
1190
- <p> " . __ ('Click \'Continue \' to resize the following Graph Template(s) and Graph(s) to the Height and Width below. The defaults below are maintained in Settings. ' ) . "</p>
1191
- <div class='itemlist'><ul> $ graph_list</ul></div>
1192
- </td>
1193
- </tr>
1194
- </table>
1195
- <table class='filterTable'>
1196
- <tr>
1197
- <td> " ;
1198
-
1199
- print __ ('Graph Height ' ) . '</td><td> ' ;
1200
- form_text_box ('graph_height ' , read_config_option ('default_graph_height ' ), '' , '5 ' , '5 ' , 'text ' );
1201
- print '</td></tr><tr><td> ' . __ ('Graph Width ' ) . '</td><td> ' ;
1202
- form_text_box ('graph_width ' , read_config_option ('default_graph_width ' ), '' , '5 ' , '5 ' , 'text ' );
1203
- print '</td></tr><tr><td> ' . __ ('Image Format ' ) . '</td><td> ' ;
1204
- form_dropdown ('image_format_id ' , $ image_types , '' , '' , read_config_option ('default_image_format ' ), '' , '' );
1205
-
1206
- print "</td></tr></table><div class='break'></div><table style='width:100%'> \n" ;
1207
-
1208
- $ 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=' " . __esc ('Resize Selected Graph Template(s) ' ) . "'> " ;
1209
- } elseif (get_request_var ('drp_action ' ) == '4 ' ) { // retemplate
1210
- print "<tr>
1211
- <td class='textArea'>
1212
- <p> " . __ ('Click \'Continue \' to perform a Full Synchronization between your Graphs and the chosen Graph Templates(s). If you simply have a situation where the Graph Items don \'t match the Graph Template, try the Quick Sync Graphs option first as it will take much less time. This function is important if you have Graphs that exist with multiple versions of a Graph Template and wish to make them all common in appearance. ' ) . "</p>
1213
- <div class='itemlist'><ul> $ graph_list</ul></div>
1214
- </td>
1215
- </tr> \n" ;
1216
-
1217
- $ 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=' " . __esc ('Synchronize Graphs to Graph Template(s) ' ) . "'> " ;
1218
- } elseif (get_request_var ('drp_action ' ) == '5 ' ) { // retemplate only where sequences are off
1219
- print "<tr>
1220
- <td class='textArea'>
1221
- <p> " . __ ('Click \'Continue \' to perform a Quick Synchronization of your Graphs for the following Graph Template(s). Use this option if your Graphs have Graph Items that do not match your Graph Template. If this option does not work, use the Full Sync Graphs option, which will take more time to complete. ' ) . "</p>
1222
- <div class='itemlist'><ul> $ graph_list</ul></div>
1223
- </td>
1224
- </tr> \n" ;
1225
-
1226
- $ 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=' " . __esc ('Synchronize Graphs to Graph Template(s) ' ) . "'> " ;
1227
- }
1228
- } else {
1229
- raise_message (40 );
1230
- header ('Location: graph_templates.php ' );
1231
-
1232
- exit ;
1233
- }
1234
-
1235
- print "<tr>
1236
- <td class='saveRow'>
1237
- <input type='hidden' name='action' value='actions'>
1238
- <input type='hidden' name='selected_items' value=' " . (isset ($ graph_array ) ? serialize ($ graph_array ) : '' ) . "'>
1239
- <input type='hidden' name='drp_action' value=' " . html_escape (get_nfilter_request_var ('drp_action ' )) . "'>
1240
- $ save_html
1241
- </td>
1242
- </tr> \n" ;
1243
-
1244
- html_end_box ();
1245
-
1246
- form_end ();
1247
-
1248
- bottom_footer ();
1249
1159
}
1250
1160
1251
1161
function item () {
@@ -1669,8 +1579,7 @@ function clearFilter() {
1669
1579
$ sql_order = get_order_string ();
1670
1580
$ sql_limit = ' LIMIT ' . ($ rows * (get_request_var ('page ' ) - 1 )) . ', ' . $ rows ;
1671
1581
1672
- $ template_list = db_fetch_assoc ("SELECT
1673
- gt.id, gt.name, gt.graphs,
1582
+ $ template_list = db_fetch_assoc ("SELECT gt.id, gt.name, gt.graphs,
1674
1583
CONCAT(gtg.height, 'x', gtg.width) AS size, gtg.vertical_label, gtg.image_format_id
1675
1584
FROM graph_templates AS gt
1676
1585
INNER JOIN graph_templates_graph AS gtg
@@ -1824,13 +1733,9 @@ function input_edit() {
1824
1733
1825
1734
html_end_box (true , true );
1826
1735
1827
- $ item_list = db_fetch_assoc_prepared ("SELECT
1828
- CONCAT_WS(' - ', dtd.name, dtr.data_source_name) AS data_source_name,
1829
- gti.text_format,
1830
- gti.id AS graph_templates_item_id,
1831
- gti.graph_type_id,
1832
- gti.consolidation_function_id,
1833
- gtid.graph_template_input_id
1736
+ $ item_list = db_fetch_assoc_prepared ("SELECT CONCAT_WS(' - ', dtd.name, dtr.data_source_name) AS data_source_name,
1737
+ gti.text_format, gti.id AS graph_templates_item_id, gti.graph_type_id,
1738
+ gti.consolidation_function_id, gtid.graph_template_input_id
1834
1739
FROM graph_templates_item AS gti
1835
1740
LEFT JOIN graph_template_input_defs AS gtid
1836
1741
ON gtid.graph_template_item_id = gti.id
@@ -1847,7 +1752,8 @@ function input_edit() {
1847
1752
1848
1753
html_start_box (__ ('Associated Graph Items ' ), '100% ' , false , '3 ' , 'center ' , '' );
1849
1754
1850
- $ i = 0 ;
1755
+ $ i = 0 ;
1756
+
1851
1757
$ any_selected_item = '' ;
1852
1758
1853
1759
if (cacti_sizeof ($ item_list )) {
@@ -1857,7 +1763,8 @@ function input_edit() {
1857
1763
if ($ item ['graph_template_input_id ' ] == '' ) {
1858
1764
$ old_value = '' ;
1859
1765
} else {
1860
- $ old_value = 'on ' ;
1766
+ $ old_value = 'on ' ;
1767
+
1861
1768
$ any_selected_item = $ item ['graph_templates_item_id ' ];
1862
1769
}
1863
1770
0 commit comments