Repository navigation
Expand file tree
/
Copy pathweathermap-cacti-plugin-editor.php
More file actions
1027 lines (957 loc) · 57.5 KB
/
Copy pathweathermap-cacti-plugin-editor.php
File metadata and controls
1027 lines (957 loc) · 57.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2022-2026 The Cacti Group, Inc. |
| |
| Based on the Original Plugin developed by Howard Jones |
| |
| Copyright (C) 2005-2022 Howard Jones and contributors |
| |
| Permission is hereby granted, free of charge, to any person obtaining |
| a copy of this software and associated documentation files |
| (the "Software"), to deal in the Software without restriction, |
| including without limitation the rights to use, copy, modify, merge, |
| publish, distribute, sublicense, and/or sell copies of the Software, |
| and to permit persons to whom the Software is furnished to do so, |
| subject to the following conditions: |
| |
| The above copyright notice and this permission notice shall be |
| included in all copies or substantial portions of the Software. |
| |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
| OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| SOFTWARE. |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDtool-based Graphing Solution |
+-------------------------------------------------------------------------+
| Extensions to Howard Jones' original work are designed, written, and |
| maintained by the Cacti Group. |
| |
| Howard Jones was the original author of Weathermap. You can reach |
| him at: howie@thingy.com |
+-------------------------------------------------------------------------+
| http://www.network-weathermap.com/ |
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/
include_once('../../include/auth.php');
global $config;
include_once($config['base_path'] . '/plugins/weathermap/setup.php');
include_once($config['base_path'] . '/plugins/weathermap/lib/editor.inc.php');
include_once($config['base_path'] . '/plugins/weathermap/lib/editor.actions.php');
include_once($config['base_path'] . '/plugins/weathermap/lib/WeatherMap.class.php');
include_once($config['base_path'] . '/plugins/weathermap/lib/geometry.php');
include_once($config['base_path'] . '/plugins/weathermap/lib/WMPoint.class.php');
include_once($config['base_path'] . '/plugins/weathermap/lib/WMVector.class.php');
include_once($config['base_path'] . '/plugins/weathermap/lib/WMLine.class.php');
// If we're embedded in the Cacti UI (included from weathermap-cacti-plugin-editor.php), then authentication has happened. Enable the editor.
$editor_name = 'weathermap-cacti-plugin-editor.php';
$cacti_base = $config['base_path'];
$cacti_url = $config['url_path'];
// sensible defaults
$mapdir = 'configs';
// these are all set via the Editor Settings dialog, in the editor, now.
$use_overlay = false; // set to true to enable experimental overlay showing VIAs
$use_relative_overlay = false; // set to true to enable experimental overlay showing relative-positioning
$grid_snap_value = 0; // set non-zero to snap to a grid of that spacing
// Load some saves settings from the editor cookie
if (isset($_COOKIE['wmeditor'])) {
$parts = explode(':', $_COOKIE['wmeditor']);
if (intval($parts[0]) == 1) {
$use_overlay = true;
}
if ((isset($parts[1])) && (intval($parts[1]) == 1)) {
$use_relative_overlay = true;
}
if ((isset($parts[2])) && (intval($parts[2]) != 0)) {
$grid_snap_value = intval($parts[2]);
}
}
$action = '';
$mapname = '';
$selected = '';
set_default_action('');
$editor_return_context = get_nfilter_request_var('return_to') === 'manage' ? 'manage' : 'map';
if (isset_request_var('action')) {
$action = wm_editor_sanitize_action(get_nfilter_request_var('action'), [
'history_status', 'undo', 'redo', 'graphs', 'datasources', 'newmap', 'newmapcopy', 'font_samples', 'draw',
'show_config', 'fetch_config', 'set_link_config', 'set_node_config',
'set_note_properties', 'set_node_properties', 'set_link_properties', 'set_map_properties',
'set_map_style', 'image_data', 'upload_image', 'delete_image', 'colour_data', 'set_map_colours', 'add_link2', 'place_legend', 'place_stamp', 'via_link',
'move_node', 'link_tidy', 'retidy', 'retidy_all', 'untidy',
'delete_link', 'add_node', 'editor_settings', 'delete_node',
'clone_node', 'load_area_data', 'load_map_javascript', 'nothing'
]);
}
if (isset_request_var('mapname')) {
$mapname = get_nfilter_request_var('mapname');
$mapname = wm_editor_sanitize_conffile($mapname);
}
if (isset_request_var('selected')) {
$selected = wm_editor_sanitize_selected(get_nfilter_request_var('selected'));
}
$weathermap_debugging = false;
if ($mapname == '') {
// this is the file-picker/welcome page
show_editor_startpage();
exit();
}
// everything else in this file is inside this else
$mapfile = $mapdir . '/' . $mapname;
// We need to know the image URL for rendering
$imageurl = getImageUrl($mapname, $selected);
wm_debug('==========================================================================================================');
wm_debug("Starting Edit Run: action is $action on $mapname");
wm_debug('==========================================================================================================');
switch($action) {
case 'history_status':
case 'undo':
case 'redo':
\WeathermapEditorHistory\handle($mapfile, $action);
exit;
case 'image_data':
case 'upload_image':
case 'delete_image':
require_once __DIR__ . '/lib/editor.assets.php';
wm_editor_assets($mapfile, $action);
exit;
case 'colour_data':
case 'set_map_colours':
require_once __DIR__ . '/lib/editor.colours.php';
wm_editor_colours($mapfile, $action);
exit;
case 'graphs':
display_graphs();
exit;
case 'datasources':
display_datasources();
exit;
case 'newmap':
if (!newMap($mapfile)) {
print __esc('Unable to save changes. Please try again.', 'weathermap');
exit();
}
break;
case 'newmapcopy':
if (!newMapCopy($mapfile)) {
print __esc('Unable to save changes. Please try again.', 'weathermap');
exit();
}
break;
case 'font_samples':
displayFontSamples($mapfile);
exit();
case 'draw':
drawMap($mapfile, $selected, $use_overlay, $use_relative_overlay);
exit();
case 'show_config':
showConfig($mapfile);
exit();
case 'fetch_config':
fetchConfig($mapfile);
exit();
case 'set_link_config':
setLinkConfig($mapfile);
exit();
case 'set_node_config':
setNodeConfig($mapfile);
exit();
case 'set_note_properties':
setNoteProperties($mapfile, $grid_snap_value);
exit;
case 'set_node_properties':
setNodeProperties($mapfile);
exit;
case 'set_link_properties':
setLinkProperties($mapfile);
exit;
case 'set_map_properties':
setMapProperties($mapfile);
exit;
case 'set_map_style':
setMapStyle($mapfile);
exit;
case 'add_link2':
addLink($mapfile);
exit;
case 'place_legend':
placeLegend($mapfile, $grid_snap_value);
exit;
case 'place_stamp':
placeStamp($mapfile, $grid_snap_value);
exit;
case 'via_link':
viaLink($mapfile);
exit;
case 'move_node':
moveNode($mapfile, $grid_snap_value);
exit;
case 'link_tidy':
linkTidy($mapfile);
exit;
case 'retidy':
reTidy($mapfile);
exit;
case 'retidy_all':
reTidyAll($mapfile);
exit;
case 'untidy':
unTidy($mapfile);
exit;
case 'delete_link':
deleteLink($mapfile);
exit;
case 'add_node':
addNode($mapfile, $grid_snap_value);
exit;
case 'editor_settings':
editorSettings($mapfile);
exit;
case 'delete_node':
deleteNode($mapfile);
exit;
case 'clone_node':
cloneNode($mapfile);
exit;
case 'load_area_data':
getMapAreaData($mapfile);
exit;
case 'load_map_javascript':
getMapJavaScript($mapfile);
exit;
case 'nothing':
break;
default:
cacti_log('WARNING: Invalid action ' . $action, false, 'WEATHERMAP');
break;
}
$map = new WeatherMap;
$map->context = 'editor';
if (!wm_editor_read_config($map, $mapfile)) exit;
// by here, there should be a valid $map - either a blank one, the existing one, or the existing one with requested changes
wm_debug('Finished modifying');
// Fix the locations of the background and node images if they are not in the locations that they are
// expected. This function should re redundant as the images are relocated during upgrade, but
// is left here just in case.
fixMapBackgroundAndImages($map);
[$editor_width, $editor_height] = wm_note_effective_dimensions($map);
// get the list from the images/ folder too
$image_list = get_imagelist('objects');
$backgd_list = get_imagelist('backgrounds');
// append any images used in the map that aren't in the images folder
foreach ($map->used_images as $im) {
if (!in_array($im, $image_list, true)) {
$image_list[] = $im;
}
}
sort($image_list);
cacti_cookie_set('wmeditor', ($use_overlay ? '1' : '0') . ':' . ($use_relative_overlay ? '1' : '0') . ':' . intval($grid_snap_value));
// get the users selected theme and the weathermap version
$selectedTheme = get_selected_theme();
$weathermap_version = plugin_weathermap_numeric_version();
?>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml' lang='en' xml:lang='en'>
<head>
<link href='<?php print $config['url_path'] . 'include/themes/' . $selectedTheme . '/images/favicon.ico'?>' rel='shortcut icon'>
<link href='<?php print $config['url_path'] . 'include/themes/' . $selectedTheme . '/images/cacti_logo.gif'?>' rel='icon' sizes='96x96'>
<link rel='stylesheet' type='text/css' media='screen' href='<?php print $config['url_path'] . 'include/themes/' . $selectedTheme . '/jquery-ui.css'; ?>'>
<link rel='stylesheet' type='text/css' media='screen' href='<?php print $config['url_path'] . 'include/themes/' . $selectedTheme . '/main.css'; ?>'>
<?php print get_md5_include_css('plugins/weathermap/css/editor.css'); ?>
<?php if (cacti_version_compare(CACTI_VERSION, '1.2.32', '<')) { ?>
<?php print get_md5_include_css('plugins/weathermap/css/editor-ui-dialog-legacy.css'); ?>
<?php } ?>
<?php getEditorJs(); ?>
<?php print get_md5_include_js('include/js/jquery.js'); ?>
<?php print get_md5_include_js('include/js/jquery-ui.js'); ?>
<?php print get_md5_include_js('include/js/jquery.tablesorter.js'); ?>
<?php print get_md5_include_js('include/js/jquery.colorpicker.js'); ?>
<?php print get_md5_include_js('include/js/js.storage.js'); ?>
<?php print get_md5_include_js('plugins/weathermap/js/editor.js'); ?>
<?php print get_md5_include_js('plugins/weathermap/js/editor.history.js'); ?>
<?php print get_md5_include_js('plugins/weathermap/js/jquery.ddslick.js'); ?>
<?php print get_md5_include_js('plugins/weathermap/js/jquery.ui-contextmenu.js'); ?>
<title><?php print __('PHP Weathermap Editor %s', $weathermap_version, 'weathermap'); ?></title>
</head>
<?php
$editor_return_hash = db_fetch_cell_prepared('SELECT filehash FROM weathermap_maps WHERE configfile = ? LIMIT 1', [$mapname]);
$editor_return_url = 'weathermap-cacti-plugin.php';
$editor_return_label = __('Return to Map', 'weathermap');
if (!empty($editor_return_hash)) {
$editor_return_url .= '?action=viewmap&id=' . rawurlencode($editor_return_hash);
}
if ($editor_return_context === 'manage') {
$editor_return_url = 'weathermap-cacti-plugin-mgmt.php';
$editor_return_label = __('Return to Manage', 'weathermap');
}
?>
<body id='mainView' class='mainView' data-wm-theme='<?php print plugin_weathermap_escape_attr($selectedTheme); ?>' data-return-label='<?php print plugin_weathermap_escape_attr($editor_return_label); ?>' data-return-map='<?php print plugin_weathermap_escape_attr($editor_return_url); ?>'>
<div id='toolbar' class='cactiTableTitleRow'>
<ul>
<li class='wm-history-controls'>
<button type='button' id='wm-undo' disabled><?php print __('Undo', 'weathermap'); ?></button>
<button type='button' id='wm-redo' disabled><?php print __('Redo', 'weathermap'); ?></button>
<span id='wm-history-status' class='wm-visually-hidden' role='status' aria-live='polite'></span>
</li>
<li class='tb_active' id='tb_newfile'><?php print __('Change<br>File', 'weathermap'); ?></li>
<li class='tb_active' id='tb_addnode'><?php print __('Add<br>Node', 'weathermap'); ?></li>
<li class='tb_active' id='tb_addlink'><?php print __('Add<br>Link', 'weathermap'); ?></li>
<li class='tb_active' id='tb_addnote'><?php print __('Add<br>Note', 'weathermap'); ?></li>
<li class='tb_active' id='tb_poslegend'><?php print __('Position<br>Legend', 'weathermap'); ?></li>
<li class='tb_active' id='tb_postime'><?php print __('Position<br>Timestamp', 'weathermap'); ?></li>
<li class='tb_active' id='tb_mapprops'><?php print __('Map<br>Properties', 'weathermap'); ?></li>
<li class='tb_active' id='tb_mapstyle'><?php print __('Map<br>Style', 'weathermap'); ?></li>
<li class='tb_active' id='tb_colours'><?php print __('Manage<br>Colors', 'weathermap'); ?></li>
<li class='tb_active' id='tb_manageimages'><?php print __('Manage<br>Images', 'weathermap'); ?></li>
<li class='tb_active' id='tb_prefs'><?php print __('Editor<br>Settings', 'weathermap'); ?></li>
<li class='tb_coords' id='tb_coords'><?php print __('Position<br>---, ---', 'weathermap'); ?></li>
<li class='tb_help'>
<span id='tb_help' role='status' aria-live='polite'><?php print __('Select a menu item or either right-click or click on a Node or Link to edit its properties', 'weathermap'); ?></span>
</li>
</ul>
</div>
<form id='frmMain' action='<?php print $editor_name ?>' method='post'>
<div class='mainArea mapData'>
<input id='xycapture' name='xycapture' width='<?php print html_escape($editor_width); ?>' height='<?php print html_escape($editor_height); ?>' data-width='<?php print html_escape($editor_width); ?>' data-height='<?php print html_escape($editor_height); ?>' style='display:none' type='image' src='<?php print html_escape($imageurl); ?>' />
<img id='existingdata' name='existingdata' width='<?php print html_escape($editor_width); ?>' height='<?php print html_escape($editor_height); ?>' data-width='<?php print html_escape($editor_width); ?>' data-height='<?php print html_escape($editor_height); ?>' src='<?php print html_escape($imageurl); ?>' usemap='#weathermap_imap' />
<?php getMapAreaData($mapfile); ?>
<input id='x' name='x' type='hidden' />
<input id='y' name='y' type='hidden' />
<div class='debug' style='display:none'><p><strong><?php print __('Debug', 'weathermap'); ?></strong>
<a href='?action=retidy_all&mapname=<?php print plugin_weathermap_escape_attr(rawurlencode($mapname) . '&return_to=' . $editor_return_context); ?>'><?php print __('Re-tidy ALL', 'weathermap'); ?></a>
<a href='?action=retidy&mapname=<?php print plugin_weathermap_escape_attr(rawurlencode($mapname) . '&return_to=' . $editor_return_context); ?>'><?php print __('Re-tidy', 'weathermap'); ?></a>
<a href='?action=untidy&mapname=<?php print plugin_weathermap_escape_attr(rawurlencode($mapname) . '&return_to=' . $editor_return_context); ?>'><?php print __('Un-tidy', 'weathermap'); ?></a>
<a href='?action=nothing&mapname=<?php print plugin_weathermap_escape_attr(rawurlencode($mapname) . '&return_to=' . $editor_return_context); ?>'><?php print __('Do Nothing', 'weathermap'); ?></a>
<span>
<label for='mapname'><?php print __('mapfile', 'weathermap'); ?></label>
<input name='return_to' type='hidden' value='<?php print plugin_weathermap_escape_attr($editor_return_context); ?>'>
<input id='mapname' name='mapname' type='text' class='ui-state-default ui-corner-all' value='<?php print plugin_weathermap_escape_attr($mapname); ?>'>
</span>
<span>
<label for='action'><?php print __('action', 'weathermap'); ?></label>
<input id='action' name='action' type='text' class='ui-state-default ui-corner-all' value=''>
</span>
<span>
<label for='param'><?php print __('param', 'weathermap'); ?></label>
<input id='param' name='param' type='text' class='ui-state-default ui-corner-all' value=''>
</span>
<span>
<label for='param2'><?php print __('param2', 'weathermap'); ?></label>
<input id='param2' name='param2' type='text' class='ui-state-default ui-corner-all' value=''>
</span>
<span>
<label for='debug'><?php print __('debug', 'weathermap'); ?></label>
<input id='debug' name='debug' type='text' class='ui-state-default ui-corner-all' value=''>
</span>
<a target='configwindow' href='?action=show_config&mapname=<?php print plugin_weathermap_escape_attr(rawurlencode($mapname) . '&return_to=' . $editor_return_context); ?>'><?php print __('See config', 'weathermap'); ?></a>
</div>
</div>
<!-- Data for overlay and selection -->
<div class='scriptData'>
<script type='text/javascript' <?php print plugin_weathermap_csp_nonce(); ?>>
<?php getMapJavaScript($mapfile, $map); ?>
<?php print 'var infoUrlStyle=' . intval(read_config_option('weathermap_infourl_style')) . ';'; ?>
</script>
</div>
<!-- End Data for overlay and selection -->
<div id='dlgNoteProperties' class='dlgProperties' title='<?php print __esc('Note', 'weathermap'); ?>'>
<div class='dlgBody'>
<div id='wm-note-delete-bar' style='text-align:right;margin-bottom:8px'><button type='button' id='note_delete' class='ui-button ui-corner-all' style='color:#9b2525'><?php print __esc('Delete Note', 'weathermap'); ?></button></div>
<input type='hidden' id='note_name' name='note_name' value='' />
<table class='cactiTable'>
<tr><td><label for='note_text'><?php print __esc('Text', 'weathermap'); ?></label></td><td><textarea id='note_text' name='note_text' rows='3' maxlength='2000' style='width:100%'></textarea></td></tr>
<tr><td><label for='note_align'><?php print __esc('Text alignment', 'weathermap'); ?></label></td><td><select id='note_align' name='note_align'><option value='left'><?php print __esc('Left', 'weathermap'); ?></option><option value='centre'><?php print __esc('Centre', 'weathermap'); ?></option><option value='right'><?php print __esc('Right', 'weathermap'); ?></option></select></td></tr>
<tr><td><label for='note_font'><?php print __esc('Font', 'weathermap'); ?></label></td><td><select id='note_font' name='note_font'><?php print wm_style_font_options($map, $map->nodes['DEFAULT']->labelfont); ?></select></td></tr>
<tr><td><?php print __esc('Colour', 'weathermap'); ?></td><td><div id='note_palette' role='group' aria-label='<?php print __esc('Note colour', 'weathermap'); ?>' style='display:flex;flex-wrap:wrap;gap:6px'>
<?php foreach (['#000000' => __esc('Black', 'weathermap'), '#0000ff' => __esc('Blue', 'weathermap'), '#cc0000' => __esc('Red', 'weathermap'), '#008000' => __esc('Green', 'weathermap'), '#800080' => __esc('Purple', 'weathermap'), '#b35900' => __esc('Orange', 'weathermap'), '#666666' => __esc('Grey', 'weathermap'), '#ffffff' => __esc('White', 'weathermap')] as $colour => $label) { ?>
<button type='button' class='wm-note-colour ui-button ui-corner-all' data-colour='<?php print $colour; ?>' aria-pressed='false'><span aria-hidden='true' style='display:inline-block;width:12px;height:12px;background:<?php print $colour; ?>;border:1px solid #888;margin-right:5px'></span><?php print $label; ?></button>
<?php } ?></div></td></tr>
<tr><td><?php print __esc('Position', 'weathermap'); ?></td><td><input type='text' aria-label='X' size='4' class='ui-state-default ui-corner-all' id='note_x' name='note_x' min='0' max='<?php print $editor_width; ?>' />,<input type='text' aria-label='Y' size='4' class='ui-state-default ui-corner-all' id='note_y' name='note_y' min='0' max='<?php print $editor_height; ?>' /></td></tr>
</table>
<button type='button' id='note_advanced_toggle' class='ui-button ui-corner-all' aria-expanded='false' aria-controls='note_advanced'><?php print __esc('Advanced settings', 'weathermap'); ?></button><div id='note_advanced' style='display:none'><p><label for='note_colour'><?php print __esc('Custom colour', 'weathermap'); ?></label> <input type='color' id='note_colour' name='note_colour' value='#000000' /></p></div>
<p id='wm-note-error' role='alert' style='display:none'></p>
</div>
<div class='dlgButtons'>
<div class='dlgSubButtons'><button type='button' id='note_move' class='ui-button ui-corner-all'><?php print __esc('Move', 'weathermap'); ?></button><button type='button' id='note_clone' class='ui-button ui-corner-all' style='margin-right:24px'><?php print __esc('Clone', 'weathermap'); ?></button>
<button type='button' class='wm_submit ui-button ui-corner-all' style='font-weight:bold'><?php print __esc('Save', 'weathermap'); ?></button>
<button type='button' class='wm_cancel ui-button ui-corner-all'><?php print __esc('Cancel', 'weathermap'); ?></button>
</div>
</div>
</div>
<!-- Node Properties -->
<div id='dlgNodeProperties' class='dlgProperties' title='<?php print __('Node Properties', 'weathermap'); ?>'>
<div class='cactiTable'>
<div class='dlgBody'>
<table class='cactiTable'>
<tr>
<td>
<input id='node_name' name='node_name' type='hidden' size='6'/>
</td>
</tr>
<tr>
<td><?php print __('Map position (X, Y)', 'weathermap'); ?></td>
<td><input id='node_x' name='node_x' type='text' class='ui-state-default ui-corner-all' size='4' />,<input id='node_y' name='node_y' type='text' class='ui-state-default ui-corner-all' size='4' /></td>
</tr>
<tr>
<td><?php print __('Internal Name', 'weathermap'); ?></td>
<td><input id='node_new_name' name='node_new_name' type='text' class='ui-state-default ui-corner-all' /></td>
</tr>
<tr>
<td><?php print __('Label', 'weathermap'); ?></td>
<td><input id='node_label' name='node_label' type='text' class='ui-state-default ui-corner-all' /></td>
</tr>
<tr><td><label for='node_labelposition'><?php print __esc('Display name position', 'weathermap'); ?></label></td><td><select id='node_labelposition' name='node_labelposition'><option value='N60'><?php print __esc('Top', 'weathermap'); ?></option><option value='C' selected><?php print __esc('Middle', 'weathermap'); ?></option><option value='S60'><?php print __esc('Bottom', 'weathermap'); ?></option><option value='keep' hidden><?php print __esc('Custom (raw configuration)', 'weathermap'); ?></option></select></td></tr>
<tr>
<td><?php print __('Icon Filename', 'weathermap'); ?></td>
<td>
<select id='node_iconfilename' name='node_iconfilename'>
<?php
if (count($image_list) == 0) {
print '<option data-value="--NONE--">Label Only</option>';
print '<option data-value="--AICON--">Special Icon (AICON)></option>';
} else {
print '<option data-description="Label Only Icon" data-imagesrc="" value="--NONE--">Label Only</option>';
print '<option data-description="Special Purpose Icon" data-imagesrc="" value="--AICON--">Special Icon (AICON)</option>';
foreach ($image_list as $im) {
$display = ucfirst(str_replace(['.png', '.gif', '.jpg'], '', basename($im)));
print '<option ';
print 'data-description="' . $display . '" ';
print 'data-imagesrc="' . $im . '" ';
print 'value="' . html_escape($im) . '">' . $display . '</option>';
}
}
?>
</select>
</td>
</tr>
<tr>
<td><?php print __('Info URL(s)', 'weathermap'); ?></td>
<td>
<textarea id='node_infourl' name='node_infourl' class='ui-state-default ui-corner-all' rows='2' cols='60'></textarea>
</td>
</tr>
<tr>
<td><?php print __('Hover Graph URL(s)', 'weathermap'); ?></td>
<td>
<textarea id='node_hover' name='node_hover' class='ui-state-default ui-corner-all' rows='2' cols='60'></textarea>
</td>
</tr>
<tr>
<td><?php print __('Graph Template', 'weathermap'); ?></td>
<td>
<select id='node_template' name='node_template'>
<?php
print '<option value="-1"' . (get_request_var('node_template') == -1 ? 'selected' : '') . '>' . __('All', 'weathermap') . '</option>';
$graph_templates = db_fetch_assoc('SELECT DISTINCT gt.id, gt.name
FROM graph_templates AS gt
INNER JOIN graph_local AS gl
ON gt.id = gl.graph_template_id
ORDER BY gt.name');
foreach ($graph_templates as $gt) {
print '<option ' . (get_request_var('node_template') == $gt['id'] ? 'selected' : '');
print ' value="' . $gt['id'] . '">' . html_escape($gt['name']) . '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td><?php print __('Graph Selector', 'weathermap'); ?></td>
<td>
<input id='node_picker' name='node_picker' type='text' class='selectmenu-ajax ui-state-default ui-corner-all' data-action='graphs' />
</td>
</tr>
</table>
</div>
<div class='dlgButtons'>
<div class='dlgSubButtons'>
<a class='ui-button ui-corner-all ui-widget' id='node_move'><?php print __('Move', 'weathermap'); ?></a>
<a class='ui-button ui-corner-all ui-widget' id='node_delete'><?php print __('Delete', 'weathermap'); ?></a>
<a class='ui-button ui-corner-all ui-widget' id='node_clone'><?php print __('Clone', 'weathermap'); ?></a>
<a class='ui-button ui-corner-all ui-widget' id='node_edit'><?php print __('Edit Raw Configuration', 'weathermap'); ?></a>
<a id='tb_node_cancel' class='wm_cancel ui-button ui-corner-all ui-widget'><?php print __('Cancel', 'weathermap'); ?></a>
<a id='tb_node_submit' class='wm_submit ui-button ui-corner-all ui-widget'><?php print __('Save', 'weathermap'); ?></a>
</div>
</div>
<div class='dlgHelp'>
<?php print __('You can modify the Weathermap Node from here. The Position columns are the X,Y position on the Map. The Internal Name is the unique ID given to the Node. The Label is the external name of the Node that you provide to users. The Icon Filename is the Graphic that you want to represent the Node Object. The INFO URL is a link that you can provide when clicking on the active Map Node. The Hover Graph URL\'s are Cacti or other Graphs URL\'s that can will appear when hovering over the Node. The Graph Selector is a helper for selecting Cacti Graphs for the Graph URL\'s. There are several other Node properties possible. However, today we are only supporting those included above.', 'flowview'); ?>
</div>
</div>
</div>
<!-- Node Properties -->
<!-- Link Properties -->
<div id='dlgLinkProperties' class='dlgProperties' title='<?php print __('Link Properties', 'weathermap'); ?>'>
<div class='cactiTable'>
<div class='dlgBody'>
<div class='dlgComment'>
Link from '<span id='link_nodename1'>%NODE1%</span>' to '<span id='link_nodename2'>%NODE2%</span>'
</div>
<table class='cactiTable'>
<tr>
<td>
<input id='link_name' name='link_name' type='hidden' size='6' />
</td>
</tr>
<tr>
<td><?php print __('Maximum Bandwidth', 'weathermap'); ?><br /><?php print __('Into', 'weathermap'); ?><span id='link_nodename1a'>%NODE1%</span>'</td>
<td><input id='link_bandwidth_in' name='link_bandwidth_in' type='text' class='ui-state-default ui-corner-all' size='8'/> bits/sec</td>
</tr>
<tr>
<td><?php print __('Maximum Bandwidth', 'weathermap'); ?><br /><?php print __('Out of', 'weathermap'); ?><span id='link_nodename1b'>%NODE1%</span>'</td>
<td>
<input id='link_bandwidth_out_cb' name='link_bandwidth_out_cb' type='checkbox' value='symmetric' />Same As 'In' or <input id='link_bandwidth_out' name='link_bandwidth_out' type='text' class='ui-state-default ui-corner-all' size='8' /> bits/sec
</td>
</tr>
<tr>
<td><?php print __('Via Style', 'weathermap'); ?></td>
<td>
<select id='viastyle' name='viastyle'>
<option value='curved'><?php print __('Curved', 'weathermap'); ?></option>
<option value='angled'><?php print __('Angled', 'weathermap'); ?></option>
</select>
</td>
</tr>
<tr>
<td><?php print __('Measured traffic source(s)', 'weathermap'); ?></td>
<td>
<textarea id='link_target' name='link_target' class='ui-state-default ui-corner-all'></textarea>
</td>
</tr>
<tr>
<td><?php print __('Data Source Selector', 'weathermap'); ?></td>
<td>
<input aria-label='<?php print __esc('Traffic interface', 'weathermap'); ?>' id='link_target_picker' name='link_target_picker' type='text' class='selectmenu-ajax ui-state-default ui-corner-all' data-action='datasources' data-add-label='<?php print __esc('Add traffic source', 'weathermap'); ?>' />
</td>
</tr>
<tr>
<td><?php print __('Link Width', 'weathermap'); ?></td>
<td><input id='link_width' name='link_width' type='text' class='ui-state-default ui-corner-all' size='3' /> pixels</td>
</tr>
<tr>
<td><?php print __('Click destination URL', 'weathermap'); ?></td>
<td>
<textarea id='link_infourl' name='link_infourl' class='ui-state-default ui-corner-all'></textarea>
</td>
</tr>
<tr><td><label for='wm-link-primary-hover'><?php print __esc('Main hover graph URL', 'weathermap'); ?></label></td><td><input type='hidden' id='link_hover' name='link_hover' /><textarea id='wm-link-primary-hover' class='ui-state-default ui-corner-all'></textarea><small><?php print __esc('Shown first. Set by Use interface; additional graphs appear below it.', 'weathermap'); ?></small></td></tr>
<tr class='wm-link-section'><td colspan='2'><div class='cactiTableTitleRow wm-editor-section'><?php print __esc('Additional hover graphs', 'weathermap'); ?></div><p><?php print __esc('Show up to two hover graphs: the main traffic graph and one additional CPU, latency or other preview. Replace changes only the additional graph.', 'weathermap'); ?></p></td></tr>
<tr>
<td><?php print __('Additional graph URL(s)', 'weathermap'); ?></td>
<td>
<textarea id='wm-link-extra-hover' class='ui-state-default ui-corner-all' aria-label='<?php print __esc('Additional hover graph URLs', 'weathermap'); ?>'></textarea>
</td>
</tr>
<tr>
<td><?php print __('Filter by graph type', 'weathermap'); ?></td>
<td>
<select id='link_template' name='link_template'>
<?php
print '<option value="-1"' . (get_request_var('node_template') == -1 ? 'selected' : '') . '>' . __('All', 'weathermap') . '</option>';
$graph_templates = db_fetch_assoc('SELECT DISTINCT gt.id, gt.name
FROM graph_templates AS gt
INNER JOIN graph_local AS gl
ON gt.id = gl.graph_template_id
ORDER BY gt.name');
foreach ($graph_templates as $gt) {
print '<option ' . (get_request_var('node_template') == $gt['id'] ? 'selected' : '');
print ' value="' . $gt['id'] . '">' . html_escape($gt['name']) . '</option>';
}
?>
</td>
</tr>
<tr>
<td><?php print __('Choose hover graph', 'weathermap'); ?></td>
<td>
<input aria-label='<?php print __esc('Choose hover graph', 'weathermap'); ?>' id='link_picker' name='link_picker' type='text' class='selectmenu-ajax ui-state-default ui-corner-all' data-action='graphs' data-add-label='<?php print __esc('Add hover graph', 'weathermap'); ?>' data-replace-label='<?php print __esc('Replace hover graphs', 'weathermap'); ?>' />
</td>
</tr>
<tr>
<td><?php print __('IN Comment', 'weathermap'); ?></td>
<td>
<input id='link_commentin' name='link_commentin' type='text' class='ui-state-default ui-corner-all' size='25' />
<select id='link_commentposin' name='link_commentposin'>
<option value=95>95%</option>
<option value=90>90%</option>
<option value=80>80%</option>
<option value=70>70%</option>
<option value=60>60%</option>
</select>
</td>
</tr>
<tr>
<td><?php print __('OUT Comment', 'weathermap'); ?></td>
<td>
<input id='link_commentout' name='link_commentout' type='text' class='ui-state-default ui-corner-all' size='25' />
<select id='link_commentposout' name='link_commentposout'>
<option value=5>5%</option>
<option value=10>10%</option>
<option value=20>20%</option>
<option value=30>30%</option>
<option value=40>40%</option>
<option value=50>50%</option>
</select>
</td>
</tr>
</table>
</div>
<div class='dlgButtons'>
<div class='dlgSubButtons'>
<a class='ui-button ui-corner-all ui-widget' id='link_delete'><?php print __('Delete Link', 'weathermap'); ?></a>
<a class='ui-button ui-corner-all ui-widget' id='link_edit'><?php print __('Edit Raw Configuration', 'weathermap'); ?></a>
<a class='ui-button ui-corner-all ui-widget' id='link_tidy'><?php print __('Tidy', 'weathermap'); ?></a>
<a class='ui-button ui-corner-all ui-widget' id='link_via'><?php print __('Via', 'weathermap'); ?></a>
<a id='tb_link_cancel' class='wm_cancel ui-button ui-corner-all ui-widget'><?php print __('Cancel', 'weathermap'); ?></a>
<a id='tb_link_submit' class='wm_submit ui-button ui-corner-all ui-widget'><?php print __('Save', 'weathermap'); ?></a>
</div>
</div>
<div class='dlgHelp'>
<?php print __('<p><strong>Bandwidth:</strong> Set the capacity used to calculate utilisation, for example 100M or 1G. K, M, G and T are supported. Select Same As "In" when both directions have equal capacity.</p>
<p><strong>Traffic interface:</strong> Search by device, port or description, or select Browse all. Choose an interface, then click Use interface to set the primary measured source, click destination and main hover graph. Additional measured sources and hover graphs are kept.</p>
<p><strong>Appearance and comments:</strong> Via Style controls curved or angled bends; Link Width controls arrow thickness. IN Comment and OUT Comment add text along each direction. The percentage sets the text position along the link.</p>
<p><strong>Additional hover graphs:</strong> Show a maximum of two hover graphs: the main traffic graph and one extra, such as CPU, latency or another interface. Filter by graph type narrows the choices. Add hover graph adds the extra; Replace hover graphs changes it; Remove graph removes it. The main traffic graph, measured traffic and link click destination stay unchanged. In the viewer, each Cacti preview opens its own full graph when clicked.</p>
<p><strong>Advanced settings:</strong> Optional controls for combining measured sources, changing the click destination and entering custom hover image URLs. A normal traffic link usually needs no changes here.</p>
<p><strong>Combining traffic sources:</strong> Add traffic source adds another interface to the map total, separately for IN and OUT. Remove source removes an additional source. Change the primary source using Use interface at the top. The combined traffic is compared with the configured bandwidth to calculate utilisation. No combined Cacti graph is created automatically; create a matching aggregate graph in Cacti and enter its click and hover URLs if needed. Separate map links are usually clearer for primary and backup connections.</p>
<p><strong>Manual sources and URLs:</strong> The source text box edits the complete measured-source list, including the primary source. Click destination URL controls where clicking the map link goes. Main hover graph URL sets the first preview; Additional graph URL(s) accepts one extra image URL. This extra is also managed under Additional hover graphs.</p>
<p><strong>Tidy and Via:</strong> Tidy adjusts the link layout. Via lets you place a bend point on the map.</p>
<p><strong>Edit Raw Configuration:</strong> Edit the underlying map syntax for settings beyond this form.</p>', 'weathermap'); ?>
</div>
</div>
</div>
<!-- Link Properties -->
<!-- Map Properties -->
<div id='dlgMapProperties' class='dlgProperties' title='<?php print __('Map Properties', 'weathermap'); ?>'>
<div class='cactiTable'>
<div class='dlgBody'>
<table class='cactiTable'>
<tr><td colspan='2'><div class='cactiTableTitleRow wm-editor-section'><?php print __esc('Map Details', 'weathermap'); ?></div></td></tr>
<tr>
<td><?php print __('Map Title', 'weathermap'); ?></td>
<td><input id='map_title' name='map_title' type='text' class='ui-state-default ui-corner-all' size='40' value='<?php print html_escape($map->title) ?>'/></td>
</tr>
<tr>
<td><?php print __('Legend Text', 'weathermap'); ?></td>
<td><input id='map_legend' name='map_legend' type='text' class='ui-state-default ui-corner-all' size='25' value='<?php print html_escape($map->keytext['DEFAULT']) ?>' /></td>
</tr>
<tr>
<td><?php print __('Timestamp Text', 'weathermap'); ?></td>
<td><input id='map_stamp' name='map_stamp' type='text' class='ui-state-default ui-corner-all' size='40' value='<?php print html_escape($map->stamptext) ?>' /></td>
</tr>
<tr><td colspan='2'><div class='cactiTableTitleRow wm-editor-section'><?php print __esc('Background and Canvas', 'weathermap'); ?></div></td></tr>
<tr>
<td><?php print __('Background Image', 'weathermap'); ?></td>
<td>
<select id='map_bgfile' name='map_bgfile'>
<?php
if (cacti_count($backgd_list) == 0) {
print '<option data-value="--NONE--">' . __esc('(no images are available)', 'weathermap') . '</option>';
} else {
print '<option data-description="' . __esc('Use Map Background Colour', 'weathermap') . '" data-imagesrc="" value="--NONE--">' . __esc('--NO BACKGROUND--', 'weathermap') . '</option>';
foreach ($backgd_list as $im) {
$display = ucfirst(str_replace(['.png', '.gif', '.jpg'], '', basename($im)));
print '<option ' . ($im == $map->background ? 'selected ' : '');
print 'data-description="' . $display . '" ';
print 'data-imagesrc="' . $im . '" ';
print 'value="' . html_escape($im) . '">' . $display . '</option>';
}
}
?>
</select>
</td>
</tr>
<tr>
<td><?php print __esc('Map Background Colour', 'weathermap'); ?></td>
<td><input type='hidden' id='map_background_colour' name='map_background_colour' value='<?php $bg = $map->colours['DEFAULT']['BG']; print sprintf('#%02x%02x%02x', $bg['red1'], $bg['green1'], $bg['blue1']); ?>' />
<div id='wm-map-background-colour'></div>
<small><?php print __esc('Shown without an image, or through its transparent areas.', 'weathermap'); ?></small>
</td>
</tr>
<tr>
<td><label for='map_background_sizing'><?php print __('Background sizing', 'weathermap'); ?></label></td>
<td><select id='map_background_sizing' name='map_background_sizing'>
<?php
$background_sizing = $map->get_hint('background_sizing', 'image');
if (!in_array($background_sizing, ['fit', 'stretch', 'image'], true)) { $background_sizing = 'image'; }
foreach (['fit' => __('Fit to map', 'weathermap'), 'stretch' => __('Stretch to map', 'weathermap'), 'image' => __('Use image size', 'weathermap')] as $value => $label) {
print '<option value="' . $value . '"' . ($background_sizing === $value ? ' selected' : '') . '>' . html_escape($label) . '</option>';
}
?>
</select></td>
</tr>
<tr>
<td><?php print __('Map Size', 'weathermap'); ?></td>
<td>
<input id='map_width' name='map_width' type='text' class='ui-state-default ui-corner-all' size='5' value='<?php print html_escape($map->width) ?>' /> x
<input id='map_height' name='map_height' type='text' class='ui-state-default ui-corner-all' size='5' value='<?php print html_escape($map->height) ?>' /> <?php print __('pixels', 'weathermap'); ?>
</td>
</tr>
<tr><td colspan='2'><div class='cactiTableTitleRow wm-editor-section'><?php print __esc('Link Defaults', 'weathermap'); ?></div></td></tr>
<tr>
<td><?php print __('Default Link Width', 'weathermap'); ?></td>
<td><input id='map_linkdefaultwidth' name='map_linkdefaultwidth' type='text' class='ui-state-default ui-corner-all' size='6' value='<?php print html_escape($map->links['DEFAULT']->width) ?>' /> <?php print __('pixels', 'weathermap'); ?></td>
</tr>
<tr>
<td><?php print __('Default Link Bandwidth', 'weathermap'); ?></td>
<td>
<input id='map_linkdefaultbwin' name='map_linkdefaultbwin' type='text' class='ui-state-default ui-corner-all' size='6' value='<?php print html_escape($map->links['DEFAULT']->max_bandwidth_in_cfg) ?>' /> <?php print __('bit/sec in', 'weathermap'); ?>, <input id='map_linkdefaultbwout' name='map_linkdefaultbwout' type='text' class='ui-state-default ui-corner-all' size='6' value='<?php print html_escape($map->links['DEFAULT']->max_bandwidth_out_cfg) ?>' /> <?php print __('bit/sec out', 'weathermap'); ?>
</td>
</tr>
</table>
</div>
<div class='dlgButtons'>
<div class='dlgSubButtons'>
<a id='tb_map_cancel' class='wm_cancel ui-button ui-corner-all ui-widget'><?php print __('Cancel', 'weathermap'); ?></a>
<a id='tb_map_submit' class='wm_submit ui-button ui-corner-all ui-widget'><?php print __('Save', 'weathermap'); ?></a>
</div>
</div>
<div class='dlgHelp'>
<?php print __('Set the map’s title, legend, timestamp, background and canvas size, plus the default width and bandwidth for links. Map dimensions and link width are measured in pixels.', 'weathermap'); ?>
</div>
</div>
</div>
<!-- Map Properties -->
<!-- Map Style -->
<div id='dlgMapStyle' class='dlgProperties' title='<?php print __('Map Style', 'flowview'); ?>'>
<div class='cactiTable'>
<div class='dlgBody'>
<table class='cactiTable'>
<tr><td colspan='2'>
<div class='cactiTableTitleRow wm-editor-section'><?php print __('Map Defaults', 'weathermap'); ?></div>
</td></tr>
<tr>
<td><?php print __('HTML Style', 'weathermap'); ?></td>
<td>
<select id='mapstyle_htmlstyle' name='mapstyle_htmlstyle'>
<option <?php print ($map->htmlstyle == 'overlib' ? 'selected' : '') ?> value='overlib'><?php print __('Dynamic HTML', 'flowview'); ?></option>
<option <?php print ($map->htmlstyle == 'static' ? 'selected' : '') ?> value='static'><?php print __('Static HTML', 'flowview'); ?></option>
</select>
</td>
</tr>
<tr>
<td><?php print __('Key Style', 'weathermap'); ?></td>
<td>
<select id='mapstyle_keystyle' name='mapstyle_keystyle' class='ui-state-default ui-corner-all'>
<?php
$styles = [
'classic' => __('Classic', 'weathermap'),
'horizontal' => __('Horizontal', 'weathermap'),
'vertical' => __('Vertical', 'weathermap'),
'inverted' => __('Inverted', 'weathermap'),
'tags' => __('Tags', 'weathermap')
];
foreach ($styles as $id => $name) {
print "<option value='$id' " . ($map->keystyle['DEFAULT'] == $id ? 'selected' : '') . '>' . $name . '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td><?php print __('Legend Font', 'weathermap'); ?></td>
<td><?php print get_fontlist($map, 'mapstyle_legendfont', $map->keyfont); ?></td>
</tr>
<tr><td colspan='2'>
<div class='cactiTableTitleRow wm-editor-section'><?php print __('Node Defaults', 'weathermap'); ?></div>
</td></tr>
<tr>
<td><?php print __('Node Font', 'weathermap'); ?></td>
<td><?php print get_fontlist($map, 'mapstyle_nodefont', $map->nodes['DEFAULT']->labelfont); ?></td>
</tr>
<tr><td colspan='2'>
<div class='cactiTableTitleRow wm-editor-section'><?php print __('Link Defaults', 'weathermap'); ?></div>
</td></tr>
<tr>
<td><?php print __('Link Labels', 'weathermap'); ?></td>
<td>
<select id='mapstyle_linklabels' name='mapstyle_linklabels'>
<option <?php print($map->links['DEFAULT']->labelstyle == 'bits' ? 'selected' : ''); ?> value='bits'><?php print __('Bits/sec', 'weathermap'); ?></option>
<option <?php print($map->links['DEFAULT']->labelstyle == 'percent' ? 'selected' : ''); ?> value='percent'><?php print __('Percentage', 'weathermap'); ?></option>
<option <?php print($map->links['DEFAULT']->labelstyle == 'none' ? 'selected' : ''); ?> value='none'><?php print __('None', 'weathermap'); ?></option>
</select>
</td>
</tr>
<tr>
<td><?php print __('Arrow Style', 'weathermap'); ?></td>
<td>
<select id='mapstyle_arrowstyle' name='mapstyle_arrowstyle'>
<option <?php print($map->links['DEFAULT']->arrowstyle == 'classic' ? 'selected' : ''); ?> value='classic'><?php print __('Classic', 'weathermap'); ?></option>
<option <?php print($map->links['DEFAULT']->arrowstyle == 'compact' ? 'selected' : ''); ?> value='compact'><?php print __('Compact', 'weathermap'); ?></option>
</select>
</td>
</tr>
<tr>
<td><label for='mapstyle_linkfont'><?php print __esc('Traffic Label Font', 'weathermap'); ?></label></td>
<td><?php print wm_style_font_select($map, 'mapstyle_linkfont', $map->links['DEFAULT']->bwfont); ?></td>
</tr>
<?php print wm_comment_style_fields($map); ?>
</table>
<details class='wm-mapstyle-advanced' style='margin-top: 12px;'>
<summary style='cursor: pointer; padding: 8px 0;'><?php print __esc('Advanced settings', 'weathermap'); ?></summary>
<p><?php print __esc('Hover dimensions use pixels. Set 0 for automatic sizing. Width limits the preview size; height is a legacy hint and may not change the displayed height. Graph URLs can specify their own image dimensions.', 'weathermap'); ?></p>
<table style='width: 100%;'>
<tr>
<td><label for='mapstyle_nodewidth'><?php print __esc('Node Hover Width (pixels)', 'weathermap'); ?></label></td>
<td>
<input id='mapstyle_nodewidth' name='mapstyle_nodewidth' type='text' size='6' class='ui-state-default ui-corner-all' value='<?php print $map->nodes['DEFAULT']->overlibwidth; ?>'>
</td>
</tr>
<tr>
<td><label for='mapstyle_nodeheight'><?php print __esc('Node Hover Height (pixels)', 'weathermap'); ?></label></td>
<td>
<input id='mapstyle_nodeheight' name='mapstyle_nodeheight' type='text' size='6' class='ui-state-default ui-corner-all' value='<?php print $map->nodes['DEFAULT']->overlibheight; ?>'>
</td>
</tr>
<tr>
<td><label for='mapstyle_linkwidth'><?php print __esc('Link Hover Width (pixels)', 'weathermap'); ?></label></td>
<td>
<input id='mapstyle_linkwidth' name='mapstyle_linkwidth' type='text' size='6' class='ui-state-default ui-corner-all' value='<?php print $map->links['DEFAULT']->overlibwidth; ?>'>
</td>
</tr>
<tr>
<td><label for='mapstyle_linkheight'><?php print __esc('Link Hover Height (pixels)', 'weathermap'); ?></label></td>
<td>
<input id='mapstyle_linkheight' name='mapstyle_linkheight' type='text' size='6' class='ui-state-default ui-corner-all' value='<?php print $map->links['DEFAULT']->overlibheight; ?>'>
</td>
</tr>
</table>
</details>
</div>
<div class='dlgButtons'>
<div class='dlgSubButtons'>
<a id='tb_mapstyle_cancel' class='wm_cancel ui-button ui-corner-all ui-widget'><?php print __('Cancel', 'weathermap'); ?></a>
<a id='tb_mapstyle_submit' class='wm_submit ui-button ui-corner-all ui-widget'><?php print __('Save', 'weathermap'); ?></a>
</div>
</div>
<div class='dlgHelp'>
The Map Style form allows you to alter some, but not all Map style settings. See the Documentation for additional style options.
</div>
</div>
</div>
<!-- Map Style -->
<!-- Colours -->
<div id='dlgColours' class='dlgProperties' title='<?php print __esc('Manage Colors', 'weathermap'); ?>'>
<div class='dlgBody'>
<p id='wm-colours-error' role='alert'></p>
<div class='cactiTableTitleRow wm-editor-section'><?php print __esc('Link Appearance', 'weathermap'); ?></div>
<table class='cactiTable'><tr><th scope='row'><?php print __esc('Link Border Colour', 'weathermap'); ?></th><td id='wm-outline-colour'></td></tr><tr><th scope='row'><label for='wm-comment-colour-select'><?php print __esc('Link Comment Colour', 'weathermap'); ?></label></th><td id='wm-comment-colour'></td></tr></table>
<label><input type='checkbox' id='wm-traffic-pulse'><?php print __esc(' Pulse links at 80%+', 'weathermap'); ?></label>
<p><?php print __esc('Links at 80% utilisation or above pulse in their traffic colour.', 'weathermap'); ?></p>
<div class='cactiTableTitleRow wm-editor-section'><?php print __esc('Traffic Load Colours', 'weathermap'); ?></div>
<label for='wm-traffic-preset'><?php print __esc('Colour preset', 'weathermap'); ?></label>
<select id='wm-traffic-preset'><option value='classic'><?php print __esc('Default (Classic)', 'weathermap'); ?></option><option value='signals'><?php print __esc('Green / Amber / Red', 'weathermap'); ?></option><option value='ocean'><?php print __esc('Ocean Blues', 'weathermap'); ?></option><option value='heat'><?php print __esc('Purple / Orange / Red', 'weathermap'); ?></option><option value='modern'><?php print __esc('Modern Greens', 'weathermap'); ?></option><option value='sunrise'><?php print __esc('Sunrise Amber', 'weathermap'); ?></option><option value='midwinter'><?php print __esc('Midwinter Ice', 'weathermap'); ?></option><option value='custom'><?php print __esc('Custom', 'weathermap'); ?></option></select>
<p><?php print __esc('Colours show how much of a link\'s bandwidth is being used. For example, 75% means three quarters of its capacity.', 'weathermap'); ?></p>
<div id='wm-traffic-preview' aria-live='polite'></div>
<p><?php print __esc('Presets replace the DEFAULT traffic scale when you Save. Other named scales are kept.', 'weathermap'); ?></p>
<details id='wm-traffic-advanced'><summary><?php print __esc('Advanced settings', 'weathermap'); ?></summary>
<p><?php print __esc('Each row is a colour range. From and To are its limits, Colour is the fill, and Gradient End blends towards another colour. Label adds optional legend text. Scale names group ranges; DEFAULT is the usual traffic scale. Custom scales can use other units.', 'weathermap'); ?></p>
<table class='cactiTable'><thead><tr><th><?php print __esc('Scale', 'weathermap'); ?></th><th><?php print __esc('From (usually %)', 'weathermap'); ?></th><th><?php print __esc('To (usually %)', 'weathermap'); ?></th><th><?php print __esc('Colour', 'weathermap'); ?></th><th><?php print __esc('Gradient End', 'weathermap'); ?></th><th><?php print __esc('Label', 'weathermap'); ?></th><th></th></tr></thead><tbody id='wm-scale-rows'></tbody></table>
<button type='button' id='wm-scale-add' class='ui-button ui-corner-all ui-widget'><?php print __esc('Add range', 'weathermap'); ?></button>
</details>
</div>
<div class='dlgButtons'><div class='dlgSubButtons'>
<a class='wm_cancel ui-button ui-corner-all ui-widget'><?php print __esc('Cancel', 'weathermap'); ?></a>
<button type='button' id='wm-colours-save' class='ui-button ui-corner-all ui-widget'><?php print __esc('Save', 'weathermap'); ?></button>
</div></div>
<div class='dlgHelp'><?php print __esc('Scale ranges use the units configured for each link or node; traffic links normally use percentages.', 'weathermap'); ?></div>
</div>
<!-- Colours -->
<!-- Images -->
<div id='dlgImages' class='dlgProperties' title='<?php print __esc('Manage Images', 'weathermap'); ?>'>
<div class='dlgBody'>
<p id='wm-images-error' role='alert'></p>
<div class='cactiTableTitleRow wm-editor-section'><?php print __esc('Node Icons', 'weathermap'); ?></div>
<div class='wm-image-uploader'><label for='wm-image-file-objects'><?php print __esc('Upload node icon', 'weathermap'); ?></label><input type='file' id='wm-image-file-objects' accept='image/png,image/jpeg,image/gif'><button type='button' class='wm-image-upload ui-button ui-corner-all ui-widget' data-kind='objects'><?php print __esc('Upload Node Icon', 'weathermap'); ?></button></div>
<p id='wm-images-objects-count'></p><div id='wm-images-objects' class='wm-image-library' aria-label='<?php print __esc('Existing node icons', 'weathermap'); ?>'></div>
<div class='cactiTableTitleRow wm-editor-section'><?php print __esc('Background Images', 'weathermap'); ?></div>
<div class='wm-image-uploader'><label for='wm-image-file-backgrounds'><?php print __esc('Upload background', 'weathermap'); ?></label><input type='file' id='wm-image-file-backgrounds' accept='image/png,image/jpeg,image/gif'><button type='button' class='wm-image-upload ui-button ui-corner-all ui-widget' data-kind='backgrounds'><?php print __esc('Upload Background', 'weathermap'); ?></button></div>
<p id='wm-images-backgrounds-count'></p><div id='wm-images-backgrounds' class='wm-image-library' aria-label='<?php print __esc('Existing background images', 'weathermap'); ?>'></div>
</div>
<div class='dlgButtons'><div class='dlgSubButtons'><button type='button' class='wm_cancel ui-button ui-corner-all ui-widget'><?php print __esc('Close', 'weathermap'); ?></button></div></div>
<div class='dlgHelp'><?php print __esc('PNG, JPG/JPEG or GIF files up to 5 MB and 4 million pixels. GIF uploads use the first frame. Uploads are saved immediately. Images referenced by a map configuration cannot be deleted.', 'weathermap'); ?></div>
</div>
<!-- Images -->
<!-- TextEdit -->
<div id='dlgTextEdit' class='dlgProperties' title='<?php print __esc('Edit Raw Configuration', 'weathermap'); ?>'>
<div class='cactiTable'>
<div class='dlgBody'>
<p><?php print __esc('Edit the raw configuration for this map object.', 'weathermap'); ?></p>
<textarea id='item_configtext' name='item_configtext' cols='80' rows='15'></textarea>
</div>
<div class='dlgHelp'>
<?php print __esc('Advanced: changes are saved directly to the map configuration without syntax validation. Use Properties for the normal editing controls.', 'weathermap'); ?>
</div>
<div class='dlgButtons'>
<div class='dlgSubButtons'>
<a id='tb_textedit_cancel' class='wm_cancel ui-button ui-corner-all ui-widget'>Cancel</a>
<a id='tb_textedit_submit' class='wm_submit ui-button ui-corner-all ui-widget'>Save</a>
</div>
</div>
</div>
</div>
<!-- TextEdit -->
<!-- TextEditSettings -->
<div id='dlgEditorSettings' class='dlgProperties' title='Editor Settings'>
<div class='cactiTable'>
<div class='dlgBody'>
<table class='cactiTable'>
<tr><td colspan='2'><div class='cactiTableTitleRow wm-editor-section'><?php print __esc('Overlays', 'weathermap'); ?></div></td></tr>
<tr>
<td>Show VIAs overlay</td>
<td>
<select id='editorsettings_showvias' name='editorsettings_showvias'>
<option <?php print ($use_overlay ? 'selected' : '') ?> value='1'>Yes</option>
<option <?php print ($use_overlay ? '' : 'selected') ?> value='0'>No</option>
</select>
</td>
</tr>
<tr>
<td>Show Relative Positions overlay</td>
<td>
<select id='editorsettings_showrelative' name='editorsettings_showrelative'>
<option <?php print ($use_relative_overlay ? 'selected' : '') ?> value='1'>Yes</option>
<option <?php print ($use_relative_overlay ? '' : 'selected') ?> value='0'>No</option>
</select>
</td>
</tr>
<tr><td colspan='2'><div class='cactiTableTitleRow wm-editor-section'><?php print __esc('Placement', 'weathermap'); ?></div></td></tr>
<tr>
<td>Snap To Grid</td>
<td>
<select id='editorsettings_gridsnap' name='editorsettings_gridsnap'>
<option <?php print ($grid_snap_value == 0 ? 'selected' : '') ?> value='NO'>No</option>
<option <?php print ($grid_snap_value == 5 ? 'selected' : '') ?> value='5'>5 pixels</option>
<option <?php print ($grid_snap_value == 10 ? 'selected' : '') ?> value='10'>10 pixels</option>
<option <?php print ($grid_snap_value == 15 ? 'selected' : '') ?> value='15'>15 pixels</option>
<option <?php print ($grid_snap_value == 20 ? 'selected' : '') ?> value='20'>20 pixels</option>
<option <?php print ($grid_snap_value == 50 ? 'selected' : '') ?> value='50'>50 pixels</option>
<option <?php print ($grid_snap_value == 100 ? 'selected' : '') ?> value='100'>100 pixels</option>