jablonka.czprosek.czf

weathermap

Subversion Repositories:
[/] [editor.php] - Blame information for rev 11

 

Line No. Rev Author Line
11simandl<?php
2 $use_jquery = FALSE;
3 
4require_once 'editor-config.php';
5require_once 'editor.inc.php';
6require_once 'Weathermap.class.php';
7 
8 chdir(dirname(__FILE__));
9 
10$action = '';
11$mapname = '';
12$selected = '';
13 
14$newaction = '';
15$param = '';
16$param2 = '';
17$log = '';
18 
19if(!module_checks())
20{
21 print "<b>Required PHP extensions are not present in your mod_php/ISAPI PHP module. Please check your PHP setup to ensure you have the GD extension installed and enabled.</b><p>";
22 print "If you find that the weathermap tool itself is working, from the command-line or Cacti poller, then it is possible that you have two different PHP installations. The Editor uses the same PHP that webpages on your server use, but the main weathermap tool uses the command-line PHP interpreter.<p>";
23 print "Here is a copy of the phpinfo() from your PHP web module, to help debugging this...<hr>";
24 phpinfo();
25 exit();
26}
27 
28if(isset($_REQUEST['action'])) { $action = $_REQUEST['action']; }
29if(isset($_REQUEST['mapname'])) { $mapname = $_REQUEST['mapname']; }
30if(isset($_REQUEST['selected'])) { $selected = $_REQUEST['selected']; }
31 
32if($mapname == '')
33{
34 // this is the file-picker/welcome page
35 show_editor_startpage();
36}
37else
38{
39 // everything else in this file is inside this else
40 $mapfile = $mapdir.'/'.$mapname;
41 
42 $map = new WeatherMap;
43 $map->context = 'editor';
44 
45 switch($action)
46 {
47 case 'newmap':
48 $map->WriteConfig($mapfile);
49 break;
50 
51 case 'font_samples':
52 header('Content-type: image/png');
53 
54 $im = imagecreate(250,imagefontheight(5)+5);
55 
56 $white = imagecolorallocate($im,255,255,255);
57 $black = imagecolorallocate($im,0,0,0);
58 
59 $x = 3;
60 for($i=1; $i< 6; $i++)
61 {
62 imagestring($im, $i, $x, 2, "Font $i", $black);
63 $x = $x + imagefontwidth($i)*7;
64 }
65 imagepng($im);
66 imagedestroy($im);
67 
68 exit();
69 break;
70 case 'draw':
71 header('Content-type: image/png');
72 $map->ReadConfig($mapfile);
73 
74 if($selected != '')
75 {
76 if(substr($selected,0,5) == 'NODE:')
77 {
78 $nodename = substr($selected,5);
79 $map->nodes[$nodename]->selected=1;
80 }
81 
82 if(substr($selected,0,5) == 'LINK:')
83 {
84 $linkname = substr($selected,5);
85 $map->links[$linkname]->selected=1;
86 }
87 }
88 
89 $map->sizedebug = TRUE;
90 // $map->RandomData();
91 $map->DrawMap();
92 exit();
93 break;
94 
95 case 'show_config':
96 header('Content-type: text/plain');
97 
98 $fd = fopen($mapfile,'r');
99 while (!feof($fd))
100 {
101 $buffer = fgets($fd, 4096);
102 echo $buffer;
103 }
104 fclose($fd);
105 
106 exit();
107 break;
108 
109 case "set_node_properties":
110 $map->ReadConfig($mapfile);
111 
112 $node_name = $_REQUEST['node_name'];
113 $new_node_name = $_REQUEST['node_new_name'];
114 
115 if($node_name != $new_node_name)
116 {
117 if(!isset($map->nodes[$new_node_name]))
118 {
119 // we need to rename the node first.
120 $newnode = $map->nodes[$node_name];
121 $newnode->name = $new_node_name;
122 $map->nodes[$new_node_name] = $newnode;
123 unset($map->nodes[$node_name]);
124 
125 foreach ($map->links as $link)
126 {
127 if($link->a->name == $node_name)
128 {
129 $map->links[$link->name]->a = $newnode;
130 }
131 if($link->b->name == $node_name)
132 {
133 $map->links[$link->name]->b = $newnode;
134 }
135 }
136 }
137 else
138 {
139 // silently ignore attempts to rename a node to an existing name
140 $new_node_name = $node_name;
141 }
142 }
143 
144 // by this point, and renaming has been done, and new_node_name will always be the right name
145 $map->nodes[$new_node_name]->label = $_REQUEST['node_label'];
146 $map->nodes[$new_node_name]->infourl = $_REQUEST['node_infourl'];
147 $map->nodes[$new_node_name]->overliburl = $_REQUEST['node_hover'];
148 
149 if($_REQUEST['node_iconfilename'] == '--NONE--')
150 {
151 $map->nodes[$new_node_name]->iconfile='';
152 }
153 else
154 {
155 $map->nodes[$new_node_name]->iconfile = stripslashes($_REQUEST['node_iconfilename']);
156 }
157 
158 $map->WriteConfig($mapfile);
159 break;
160 
161 case "set_link_properties":
162 $map->ReadConfig($mapfile);
163 $link_name = $_REQUEST['link_name'];
164 
165 $map->links[$link_name]->width = intval($_REQUEST['link_width']);
166 $map->links[$link_name]->infourl = $_REQUEST['link_infourl'];
167 $map->links[$link_name]->overliburl = $_REQUEST['link_hover'];
168 
169 // $map->links[$link_name]->target = $_REQUEST['link_target'];
170 
171 $targets = preg_split('/\s+/',$_REQUEST['link_target'],-1,PREG_SPLIT_NO_EMPTY);
172 $new_target_list = array();
173 
174 foreach ($targets as $target)
175 {
176 // we store the original TARGET string, and line number, along with the breakdown, to make nicer error messages later
177 $newtarget = array($target,'traffic_in','traffic_out',0,$target);
178 
179 // if it's an RRD file, then allow for the user to specify the
180 // DSs to be used. The default is traffic_in, traffic_out, which is
181 // OK for Cacti (most of the time), but if you have other RRDs...
182 if(preg_match("/(.*\.rrd):([\-a-zA-Z0-9_]+):([\-a-zA-Z0-9_]+)$/i",$target,$matches))
183 {
184 $newtarget[0] = $matches[1];
185 $newtarget[1] = $matches[2];
186 $newtarget[2] = $matches[3];
187 }
188 // now we've (maybe) messed with it, we'll store the array of target specs
189 $new_target_list[] = $newtarget;
190 }
191 $map->links[$link_name]->targets = $new_target_list;
192 
193 $bwin = $_REQUEST['link_bandwidth_in'];
194 $bwout = $_REQUEST['link_bandwidth_out'];
195 
196 if(isset($_REQUEST['link_bandwidth_out_cb']) && $_REQUEST['link_bandwidth_out_cb'] == 'symmetric')
197 {
198 $bwout = $bwin;
199 }
200 
201 $map->links[$link_name]->SetBandwidth($bwin,$bwout);
202 
203 $map->WriteConfig($mapfile);
204 break;
205 
206 case "set_map_properties":
207 $map->ReadConfig($mapfile);
208 
209 $map->title = $_REQUEST['map_title'];
210 $map->keytext['DEFAULT'] = $_REQUEST['map_legend'];
211 $map->stamptext = $_REQUEST['map_stamp'];
212 
213 $map->htmloutputfile = $_REQUEST['map_htmlfile'];
214 $map->imageoutputfile = $_REQUEST['map_pngfile'];
215 
216 $map->width = intval($_REQUEST['map_width']);
217 $map->height = intval($_REQUEST['map_height']);
218 
219 // XXX sanitise this a bit
220 if($_REQUEST['map_bgfile'] == '--NONE--')
221 {
222 $map->background='';
223 }
224 else
225 {
226 $map->background = stripslashes($_REQUEST['map_bgfile']);
227 }
228 
229 $oldlinkwidth = $map->defaultlink->width;
230 $newlinkwidth = intval($_REQUEST['map_linkdefaultwidth']);
231 $map->defaultlink->width = $newlinkwidth;
232 // find all the links that have the old default width, and change them to the new default width
233 // this is something that has bugged me for a while
234 foreach ($map->links as $link)
235 {
236 if($link->width == $oldlinkwidth)
237 {
238 $map->links[$link->name]->width = $newlinkwidth;
239 }
240 }
241 
242 $bwin = $_REQUEST['map_linkdefaultbwin'];
243 $bwout = $_REQUEST['map_linkdefaultbwout'];
244 
245 $map->defaultlink->SetBandwidth($bwin,$bwout);
246 
247 $map->WriteConfig($mapfile);
248 break;
249 
250 case 'set_map_style':
251 $map->ReadConfig($mapfile);
252 
253 $map->defaultlink->labelstyle = $_REQUEST['mapstyle_linklabels'];
254 $map->htmlstyle = $_REQUEST['mapstyle_htmlstyle'];
255 $map->defaultlink->arrowstyle = $_REQUEST['mapstyle_arrowstyle'];
256 
257 $map->defaultlink->bwfont = intval($_REQUEST['mapstyle_linkfont']);
258 $map->defaultnode->labelfont = intval($_REQUEST['mapstyle_nodefont']);
259 $map->keyfont = intval($_REQUEST['mapstyle_legendfont']);
260 
261 $map->WriteConfig($mapfile);
262 break;
263 
264 case "add_link":
265 $map->ReadConfig($mapfile);
266 
267 $param2 = $_REQUEST['param'];
268 $newaction = 'add_link2';
269 $selected = 'NODE:'.$param2;
270 break;
271 
272 case "add_link2":
273 $map->ReadConfig($mapfile);
274 $a = $_REQUEST['param2'];
275 $b = $_REQUEST['param'];
276 $log = "[$a -> $b]";
277 
278 if($a != $b)
279 {
280 $newlink = new WeatherMapLink;
281 $newlink->Reset($map);
282 $newlink->a = $map->nodes[$a];
283 $newlink->b = $map->nodes[$b];
284 $newlink->SetBandwidth($map->defaultlink->max_bandwidth_in_cfg, $map->defaultlink->max_bandwidth_out_cfg);
285 $newlink->width = $map->defaultlink->width;
286 
287 // make sure the link name is unique. We can have multiple links between
288 // the same nodes, these days
289 $newlinkname = "$a-$b";
290 while(array_key_exists($newlinkname,$map->links))
291 {
292 $newlinkname .= "a";
293 }
294 $newlink->name = $newlinkname;
295 $map->links[$newlinkname] = $newlink;
296 
297 $map->WriteConfig($mapfile);
298 }
299 break;
300 
301 case "place_legend":
302 $x = intval($_REQUEST['x']);
303 $y = intval($_REQUEST['y']);
304 $scalename = $_REQUEST['param'];
305 
306 $map->ReadConfig($mapfile);
307 
308 $map->keyx[$scalename] = $x;
309 $map->keyy[$scalename] = $y;
310 
311 $map->WriteConfig($mapfile);
312 break;
313 
314 case "place_stamp":
315 $x = intval($_REQUEST['x']);
316 $y = intval($_REQUEST['y']);
317 
318 $map->ReadConfig($mapfile);
319 
320 $map->timex = $x;
321 $map->timey = $y;
322 
323 $map->WriteConfig($mapfile);
324 break;
325 
326 case "move_node":
327 $x = intval($_REQUEST['x']);
328 $y = intval($_REQUEST['y']);
329 $node_name = $_REQUEST['node_name'];
330 
331 $map->ReadConfig($mapfile);
332 
333 $map->nodes[$node_name]->x = $x;
334 $map->nodes[$node_name]->y = $y;
335 
336 $map->WriteConfig($mapfile);
337 break;
338 
339 case "add_node":
340 $x = intval($_REQUEST['x']);
341 $y = intval($_REQUEST['y']);
342 
343 $map->ReadConfig($mapfile);
344 
345 $node = new WeatherMapNode;
346 $node->Reset($map);
347 
348 $node->x = snap($x);
349 $node->y = snap($y);
350 $node->name = "node".time();
351 $node->label = "NODE";
352 
353 $map->nodes[$node->name] = $node;
354 
355 $map->WriteConfig($mapfile);
356 break;
357 
358 case "delete_link":
359 $map->ReadConfig($mapfile);
360 
361 $target = $_REQUEST['param'];
362 $log = "delete link ".$target;
363 
364 unset($map->links[$target]);
365 
366 $map->WriteConfig($mapfile);
367 break;
368 
369 case "delete_node":
370 $map->ReadConfig($mapfile);
371 
372 $target = $_REQUEST['param'];
373 $log = "delete node ".$target;
374 
375 foreach ($map->links as $link)
376 {
377 if( ($target == $link->a->name) || ($target == $link->b->name) )
378 {
379 unset($map->links[$link->name]);
380 }
381 }
382 
383 unset($map->nodes[$target]);
384 
385 $map->WriteConfig($mapfile);
386 break;
387 
388 // no action was defined - starting a new map?
389 default:
390 $map->ReadConfig($mapfile);
391 break;
392 }
393 
394 
395 // now we'll just draw the full editor page, with our
396 // new knowledge
397 
398 $imageurl = '?mapname='.$mapname . '&amp;action=draw';
399 if($selected != '')
400 {
401 $imageurl .= '&amp;selected='.$selected;
402 }
403 
404 $imageurl .= '&amp;unique='.time();
405 
406 $imlist = get_imagelist("images")
407 
408?>
409<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
410<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
411<head>
412<style>
413<?php
414 // if the cacti config was included properly, then
415 // this will be non-empty, and we can unhide the cacti links in the Link Properties box
416 if( ! isset($config['cacti_version']) )
417 {
418 echo " .cactilink { display: none; }\n";
419 }
420?>
421 </style>
422 <link rel="stylesheet" type="text/css" media="screen" href="editor.css" />
423 <script src="editor.js" type="text/javascript"></script>
424<?php
425if($use_jquery)
426{
427?>
428 <script src="lib/javascript/jquery-latest.pack.js" type="text/javascript"></script>
429 <script src="lib/javascript/jquery.contextmenu.packed.js" type="text/javascript"></script>
430<?php
431}
432?>
433 <script type="text/javascript">
434 // the only javascript in here should be the objects representing the map itself
435 // all code should be in editor.js
436 <?php print $map->asJS() ?>
437<?php
438 
439 // append any images used in the map that aren't in the images folder
440 foreach ($map->used_images as $im)
441 {
442 if(! in_array($im,$imlist))
443 {
444 $imlist[]=$im;
445 }
446 }
447 
448 sort($imlist);
449 
450 if(1==0)
451 {
452 $out = "";
453 $out .= 'var mapimages = [';
454 
455 foreach ($imlist as $im)
456 {
457 $out .= js_escape($im);
458 $out .= ",";
459 }
460 $out = rtrim($out,', ');
461 $out .= "];\n";
462 print $out;
463 }
464 
465 
466 if($use_jquery)
467 {
468?>
469 $(document).ready(function(){
470 
471 $.contextMenu.defaults({
472 itemStyle : {
473 fontFamily : "arial narrow",
474 fontSize: "10px"
475 
476 }
477 });
478 
479 $("area[@id^=NODE:]").contextMenu("#nodeMenu1", { });
480 $("area[@id^=LINK:]").contextMenu("#linkMenu1", { });
481 $("area[@id^=LEGEND:]").contextMenu("#legendMenu1", { });
482 $("area#TIMESTAMP").contextMenu("#timeMenu1", { });
483 $("img#existingdata").contextMenu("#mapMenu1", { } );
484 
485 });
486<?php
487 }
488?>
489 
490 
491 </script>
492 <title>PHP Weathermap Editor <?php echo $WEATHERMAP_VERSION; ?></title>
493</head>
494 
495<body id="mainview">
496 <div id="toolbar">
497 <ul>
498 <li class="tb_active" id="tb_newfile">Change<br />File</li>
499 <li class="tb_active" id="tb_addnode">Add<br />Node</li>
500 <li class="tb_active" id="tb_addlink">Add<br />Link</li>
501 <li class="tb_active" id="tb_poslegend">Position<br />Legend</li>
502 <li class="tb_active" id="tb_postime">Position<br />Timestamp</li>
503 <li class="tb_active" id="tb_mapprops">Map<br />Properties</li>
504 <li class="tb_active" id="tb_mapstyle">Map<br />Style</li>
505 <li class="tb_active" id="tb_colours">Manage<br />Colors</li>
506 <li class="tb_active" id="tb_manageimages">Manage<br />Images</li>
507 <li class="tb_active" id="tb_prefs">Editor<br />Settings</li>
508 <li class="tb_help"><span id="tb_help">or click a Node or Link to edit it's properties</span></li>
509 </ul>
510 </div>
511 
512 <form action="editor.php" method="post" name="frmMain">
513 <div align="center">
514 <input style="display:none" type="image"
515 src="<?php echo $imageurl; ?>" id="xycapture" /><img src=
516 "<?php echo $imageurl; ?>" id="existingdata" alt="Weathermap" usemap="#weathermap_imap"
517 /><br />
518 <div class="debug"><p><strong>Debug:</strong> <a href="?action=nothing&amp;mapname=<?php echo $mapname ?>">Do Nothing</a>
519 <span><label for="mapname">mapfile</label><input type="text" name="mapname" value="<?php echo $mapname; ?>" /></span>
520 <span><label for="action">action</label><input type="text" id="action" name="action" value="<?php echo $newaction ?>" /></span>
521 <span><label for="param">param</label><input type="text" name="param" id="param" value="" /></span>
522 <span><label for="param2">param2</label><input type="text" name="param2" id="param2" value="<?php echo $param2 ?>" /></span>
523 <span><label for="debug">debug</label><input id="debug" value="" name="debug" /></span>
524 <a target="configwindow" href="?action=show_config&amp;mapname=<?php echo $mapname ?>">See config</a></p>
525 <?php echo $log ?>
526 </div>
527 <map name="weathermap_imap">
528<?php
529 // we need to draw and throw away a map, to get the
530 // dimensions for the imagemap. Oh well.
531 $map->DrawMap('null');
532 $map->htmlstyle='editor';
533 $map->PreloadMapHTML();
534 
535 print $map->imap->subHTML("LEGEND:");
536 print $map->imap->subHTML("TIMESTAMP");
537 print $map->imap->subHTML("NODE:");
538 print $map->imap->subHTML("LINK:");
539?>
540 </map>
541 </div><!-- Node Properties -->
542 
543 <div id="dlgNodeProperties" class="dlgProperties">
544 <div class="dlgTitlebar">
545 Node Properties
546 <input size="6" name="node_name" type="hidden" />
547 <ul>
548 <li><a id="tb_node_submit" title="Submit any changes made">Submit</a></li>
549 <li><a id="tb_node_cancel" title="Cancel any changes">Cancel</a></li>
550 </ul>
551 </div>
552 
553 <div class="dlgBody">
554 <table>
555 <tr>
556 <th>Internal Name</th>
557 <td><input id="node_new_name" name="node_new_name" type="text" /></td>
558 </tr>
559 <tr>
560 <th>Label</th>
561 <td><input id="node_label" name="node_label" type="text" /></td>
562 </tr>
563 <tr>
564 <th>Info URL</th>
565 <td><input id="node_infourl" name="node_infourl" type="text" /></td>
566 </tr>
567 <tr>
568 <th>'Hover' Graph URL</th>
569 <td><input id="node_hover" name="node_hover" type="text" />[Pick from
570 Cacti] (not yet)</td>
571 </tr>
572 <tr>
573 <th>Icon Filename</th>
574 <td><select id="node_iconfilename" name="node_iconfilename">
575 
576<?php
577 if(count($imlist)==0)
578 {
579 print '<option value="--NONE--">(no images are available)</option>';
580 }
581 else
582 {
583 print '<option value="--NONE--">--NO ICON--</option>';
584 foreach ($imlist as $im)
585 {
586 print "<option ";
587 print "value=\"$im\">$im</option>\n";
588 }
589 }
590?>
591 
592 
593 </select></td>
594 </tr>
595 <tr>
596 <th></th>
597 <td>&nbsp;</td>
598 </tr>
599 <tr>
600 <th></th>
601 <td><a id="node_move" class="dlgTitlebar">Move Node</a><a class="dlgTitlebar" id="node_delete">Delete Node</a></td>
602 </tr>
603 </table>
604 </div>
605 
606 <div class="dlgHelp" id="node_help">
607 Helpful text will appear here, depending on the current
608 item selected. It should wrap onto several lines, if it's
609 necessary for it to do that.
610 </div>
611 </div><!-- Node Properties -->
612 
613 
614 
615 
616 <!-- Link Properties -->
617 
618 <div id="dlgLinkProperties" class="dlgProperties">
619 <div class="dlgTitlebar">
620 Link Properties
621 
622 <ul>
623 <li><a title="Submit any changes made" id="tb_link_submit">Submit</a></li>
624 <li><a title="Cancel any changes" id="tb_link_cancel">Cancel</a></li>
625 </ul>
626 </div>
627 
628 <div class="dlgBody">
629 <div class="comment">
630 Link from '<span id="link_nodename1">%NODE1%</span>' to '<span id="link_nodename2">%NODE2%</span>'
631 </div>
632 
633 <input size="6" name="link_name" type="hidden" />
634 
635 <table>
636 <tr>
637 <th>Maximum Bandwidth<br />
638 Into '<span id="link_nodename1a">%NODE1%</span>'</th>
639 <td><input size="8" id="link_bandwidth_in" name="link_bandwidth_in" type=
640 "text" /> bits/sec</td>
641 </tr>
642 <tr>
643 <th>Maximum Bandwidth<br />
644 Out of '<span id="link_nodename1b">%NODE1%</span>'</th>
645 <td><input type="checkbox" id="link_bandwidth_out_cb" name=
646 "link_bandwidth_out_cb" value="symmetric" />Same As
647 'In' or <input id="link_bandwidth_out" name="link_bandwidth_out"
648 size="8" type="text" /> bits/sec</td>
649 </tr>
650 <tr>
651 <th>Data Source</th>
652 <td><input id="link_target" name="link_target" type="text" /> <span class="cactilink"><a id="link_cactipick">[Pick
653 from Cacti]</a></span></td>
654 </tr>
655 <tr>
656 <th>Link Width</th>
657 <td><input id="link_width" name="link_width" size="3" type="text" />
658 pixels</td>
659 </tr>
660 <tr>
661 <th>Info URL</th>
662 <td><input id="link_infourl" size="20" name="link_infourl" type="text" /></td>
663 </tr>
664 <tr>
665 <th>'Hover' Graph URL</th>
666 <td><input id="link_hover" size="20" name="link_hover" type="text" /></td>
667 </tr>
668 <tr>
669 <th></th>
670 <td>&nbsp;</td>
671 </tr>
672 <tr>
673 <th></th>
674 <td><a class="dlgTitlebar" id="link_delete">Delete
675 Link</a></td>
676 </tr>
677 </table>
678 </div>
679 
680 <div class="dlgHelp" id="link_help">
681 Helpful text will appear here, depending on the current
682 item selected. It should wrap onto several lines, if it's
683 necessary for it to do that.
684 </div>
685 </div><!-- Link Properties -->
686 
687 <!-- Map Properties -->
688 
689 <div id="dlgMapProperties" class="dlgProperties">
690 <div class="dlgTitlebar">
691 Map Properties
692 
693 <ul>
694 <li><a title="Submit any changes made" id="tb_map_submit">Submit</a></li>
695 <li><a title="Cancel any changes" id="tb_map_cancel">Cancel</a></li>
696 </ul>
697 </div>
698 
699 <div class="dlgBody">
700 <table>
701 <tr>
702 <th>Map Title</th>
703 <td><input name="map_title" size="25" type="text" value="<?php echo $map->title ?>"/></td>
704 </tr>
705 <tr>
706 <th>Legend Text</th>
707 <td><input name="map_legend" size="25" type="text" value="<?php echo $map->keytext['DEFAULT'] ?>" /></td>
708 </tr>
709 <tr>
710 <th>Timestamp Text</th>
711 <td><input name="map_stamp" size="25" type="text" value="<?php echo $map->stamptext ?>" /></td>
712 </tr>
713 
714 <tr>
715 <th>Default Link Width</th>
716 <td><input name="map_linkdefaultwidth" size="6" type="text" value="<?php echo $map->defaultlink->width ?>" /> pixels</td>
717 </tr>
718 
719 <tr>
720 <th>Default Link Bandwidth</th>
721 <td><input name="map_linkdefaultbwin" size="6" type="text" value="<?php echo $map->defaultlink->max_bandwidth_in_cfg ?>" /> bit/sec in, <input name="map_linkdefaultbwout" size="6" type="text" value="<?php echo $map->defaultlink->max_bandwidth_out_cfg ?>" /> bit/sec out</td>
722 </tr>
723 
724 
725 <tr>
726 <th>Map Size</th>
727 <td><input name="map_width" size="5" type=
728 "text" value="<?php echo $map->width ?>" /> x <input name="map_height" size="5" type=
729 "text" value="<?php echo $map->height ?>" /> pixels</td>
730 </tr>
731 <tr>
732 <th>Output Image Filename</th>
733 <td><input name="map_pngfile" type="text" value="<?php echo $map->imageoutputfile ?>" /></td>
734 </tr>
735 <tr>
736 <th>Output HTML Filename</th>
737 <td><input name="map_htmlfile" type="text" value="<?php echo $map->htmloutputfile ?>" /></td>
738 </tr>
739 <tr>
740 <th>Background Image Filename</th>
741 <td><select name="map_bgfile">
742 
743<?php
744 if(count($imlist)==0)
745 {
746 print '<option value="--NONE--">(no images are available)</option>';
747 }
748 else
749 {
750 print '<option value="--NONE--">--NONE--</option>';
751 foreach ($imlist as $im)
752 {
753 print "<option ";
754 if($map->background == $im) print " selected ";
755 print "value=\"$im\">$im</option>\n";
756 
757 }
758 }
759?>
760 </select></td>
761 </tr>
762 </table>
763 </div>
764 
765 <div class="dlgHelp" id="map_help">
766 Helpful text will appear here, depending on the current
767 item selected. It should wrap onto several lines, if it's
768 necessary for it to do that.
769 </div>
770 </div><!-- Map Properties -->
771 
772 <!-- Map Style -->
773 <div id="dlgMapStyle" class="dlgProperties">
774 <div class="dlgTitlebar">
775 Map Style
776 
777 <ul>
778 <li><a title="Submit any changes made" id="tb_mapstyle_submit">Submit</a></li>
779 <li><a title="Cancel any changes" id="tb_mapstyle_cancel">Cancel</a></li>
780 </ul>
781 </div>
782 
783 <div class="dlgBody">
784 <table>
785 <tr>
786 <th>Link Labels</th>
787 <td><select name="mapstyle_linklabels">
788 <option <?php echo ($map->defaultlink->labelstyle=='bits' ? 'selected' : '') ?> value="bits">Bits/sec</option>
789 <option <?php echo ($map->defaultlink->labelstyle=='percent' ? 'selected' : '') ?> value="percent">Percentage</option>
790 <option <?php echo ($map->defaultlink->labelstyle=='none' ? 'selected' : '') ?> value="none">None</option>
791 </select></td>
792 </tr>
793 <tr>
794 <th>HTML Style</th>
795 <td><select name="mapstyle_htmlstyle">
796 <option <?php echo ($map->htmlstyle=='overlib' ? 'selected' : '') ?> value="overlib">Overlib (DHTML)</option>
797 <option <?php echo ($map->htmlstyle=='static' ? 'selected' : '') ?> value="static">Static HTML</option>
798 </select></td>
799 </tr>
800 <tr>
801 <th>Arrow Style</th>
802 <td><select name="mapstyle_arrowstyle">
803 <option <?php echo ($map->defaultlink->arrowstyle=='classic' ? 'selected' : '') ?> value="classic">Classic</option>
804 <option <?php echo ($map->defaultlink->arrowstyle=='compact' ? 'selected' : '') ?> value="compact">Compact</option>
805 </select></td>
806 </tr>
807 <tr>
808 <th>Node Font</th>
809 <td><select name="mapstyle_nodefont"><?php
810 for($i=1; $i<6; $i++)
811 {
812 print '<option ';
813 if($map->defaultnode->labelfont == $i) { print "selected "; }
814 print 'value="'.$i.'">'.$i.'</option>';
815 }
816 foreach ($map->fonts as $n => $font)
817 {
818 print '<option ';
819 if($map->defaultnode->labelfont == $n) { print " selected "; }
820 print 'value="'.$n.'">'.$n.'</option>';
821 }
822?></select></td>
823 </tr>
824 <tr>
825 <th>Link Label Font</th>
826 <td><select name="mapstyle_linkfont"><?php
827 for($i=1; $i<6; $i++)
828 {
829 print '<option ';
830 if($map->defaultlink->bwfont==$i) { print "selected "; }
831 print 'value="'.$i.'">'.$i.'</option>';
832 }
833 foreach ($map->fonts as $n => $font)
834 {
835 print '<option ';
836 if($map->defaultlink->bwfont == $n) { print " selected "; }
837 print 'value="'.$n.'">'.$n.'</option>';
838 }
839?></select></td>
840 </tr>
841 <tr>
842 <th>Legend Font</th>
843 <td><select name="mapstyle_legendfont"><?php
844 for($i=1; $i<6; $i++)
845 {
846 print '<option ';
847 if($map->keyfont==$i) { print "selected "; }
848 print 'value="'.$i.'">'.$i.'</option>';
849 }
850 foreach ($map->fonts as $n => $font)
851 {
852 print '<option ';
853 if($map->keyfont == $n) { print " selected "; }
854 print 'value="'.$n.'">'.$n.'</option>';
855 }
856?></select></td>
857 </tr>
858 <tr>
859 <th>Font Samples:</th>
860 <td><img src="?action=font_samples&mapname=<?php echo $mapname?>" /><br />(Drawn using your PHP install)</td>
861 </tr>
862 </table>
863 </div>
864 
865 <div class="dlgHelp" id="mapstyle_help">
866 Helpful text will appear here, depending on the current
867 item selected. It should wrap onto several lines, if it's
868 necessary for it to do that.
869 </div>
870 </div><!-- Map Style -->
871 
872 
873 
874 <!-- Colours -->
875 
876 <div id="dlgColours" class="dlgProperties">
877 <div class="dlgTitlebar">
878 Manage Colors
879 
880 <ul>
881 <li><a title="Submit any changes made" id="tb_colours_submit">Submit</a></li>
882 <li><a title="Cancel any changes" id="tb_colours_cancel">Cancel</a></li>
883 </ul>
884 </div>
885 
886 <div class="dlgBody">
887 Nothing in here works yet. The aim is to have a nice color picker somehow.
888 <table>
889 <tr>
890 <th>Background Color</th>
891 <td></td>
892 </tr>
893 
894 <tr>
895 <th>Link Outline Color</th>
896 <td></td>
897 </tr>
898 <tr>
899 <th>Scale Colors</th>
900 <td>Some pleasant way to design the bandwidth color scale goes in here???</td>
901 </tr>
902 
903 </table>
904 </div>
905 
906 <div class="dlgHelp" id="colours_help">
907 Helpful text will appear here, depending on the current
908 item selected. It should wrap onto several lines, if it's
909 necessary for it to do that.
910 </div>
911 </div><!-- Colours -->
912 
913 
914 <!-- Images -->
915 
916 <div id="dlgImages" class="dlgProperties">
917 <div class="dlgTitlebar">
918 Manage Images
919 
920 <ul>
921 <li><a title="Submit any changes made" id="tb_images_submit">Submit</a></li>
922 <li><a title="Cancel any changes" id="tb_images_cancel">Cancel</a></li>
923 </ul>
924 </div>
925 
926 <div class="dlgBody">
927 <p>Nothing in here works yet. </p>
928 The aim is to have some nice way to upload images which can be used as icons or backgrounds.
929 These images are what would appear in the dropdown boxes that don't currently do anything in the Node and Map Properties dialogs. This may end up being a seperate page rather than a dialog box...
930 </div>
931 
932 <div class="dlgHelp" id="images_help">
933 Helpful text will appear here, depending on the current
934 item selected. It should wrap onto several lines, if it's
935 necessary for it to do that.
936 </div>
937 </div><!-- Images -->
938 
939 </form>
940 <?php
941if($use_jquery)
942{
943 ?>
944 <div class="contextMenu" id="linkMenu1">
945 <ul>
946 <li id="properties"><img src="editor-resources/page_white_text.png" /> Link Properties</li>
947 <li id="delete"><img src="editor-resources/cross.png" /> Delete Link</li>
948 </ul>
949 </div>
950 <div class="contextMenu" id="nodeMenu1">
951 <ul>
952 <li id="properties"><img src="editor-resources/page_white_text.png" /> Node Properties</li>
953 <li id="move"><img src="editor-resources/arrow_out.png" /> Move Node</li>
954 <li id="delete"><img src="editor-resources/cross.png" /> Delete Node</li>
955 </ul>
956 </div>
957 <div class="contextMenu" id="mapMenu1">
958 <ul>
959 <li id="properties"><img src="editor-resources/page_white_text.png" /> Map Properties</li>
960 </ul>
961 </div>
962 <div class="contextMenu" id="legendMenu1">
963 <ul>
964 <li id="scaleproperties"><img src="editor-resources/page_white_text.png" /> Edit Scale</li>
965 <li id="legendproperties"><img src="editor-resources/page_white_text.png" /> Legend Properties</li>
966 </ul>
967 </div>
968 <div class="contextMenu" id="timeMenu1">
969 <ul>
970 <li id="stampproperties"><img src="editor-resources/page_white_text.png" /> Timestamp Properties</li>
971 </ul>
972 </div>
973 <?php
974}
975 ?>
976</body>
977</html>
978<?php
979} // if mapname != ''
980// vim:ts=4:sw=4:
981?>

Powered by WebSVN 2.2.1