jablonka.czprosek.czf

weathermap

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

 

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

Powered by WebSVN 2.2.1