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.

"; 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.

"; print "Here is a copy of the phpinfo() from your PHP web module, to help debugging this...


"; phpinfo(); exit(); } if(isset($_REQUEST['action'])) { $action = $_REQUEST['action']; } if(isset($_REQUEST['mapname'])) { $mapname = $_REQUEST['mapname']; } if(isset($_REQUEST['selected'])) { $selected = $_REQUEST['selected']; } if($mapname == '') { // this is the file-picker/welcome page show_editor_startpage(); } else { // everything else in this file is inside this else $mapfile = $mapdir.'/'.$mapname; $map = new WeatherMap; $map->context = 'editor'; switch($action) { case 'newmap': $map->WriteConfig($mapfile); break; case 'font_samples': $map->ReadConfig($mapfile); ksort($map->fonts); header('Content-type: image/png'); $keyfont = 2; $keyheight = imagefontheight($keyfont)+2; $sampleheight = 32; // $im = imagecreate(250,imagefontheight(5)+5); $im = imagecreate(2000,$sampleheight); $imkey = imagecreate(2000,$keyheight); $white = imagecolorallocate($im,255,255,255); $black = imagecolorallocate($im,0,0,0); $whitekey = imagecolorallocate($imkey,255,255,255); $blackkey = imagecolorallocate($imkey,0,0,0); $x = 3; #for($i=1; $i< 6; $i++) foreach ($map->fonts as $fontnumber => $font) { $string = "Abc123%"; $keystring = "Font $fontnumber"; list($width,$height) = $map->myimagestringsize($fontnumber,$string); list($kwidth,$kheight) = $map->myimagestringsize($keyfont,$keystring); if($kwidth > $width) $width = $kwidth; $y = ($sampleheight/2) + $height/2; $map->myimagestring($im, $fontnumber, $x, $y, $string, $black); $map->myimagestring($imkey, $keyfont,$x,$keyheight,"Font $fontnumber",$blackkey); $x = $x + $width + 6; } $im2 = imagecreate($x,$sampleheight + $keyheight); imagecopy($im2,$im, 0,0, 0,0, $x, $sampleheight); imagecopy($im2,$imkey, 0,$sampleheight, 0,0, $x, $keyheight); imagedestroy($im); imagepng($im2); imagedestroy($im2); exit(); break; case 'draw': header('Content-type: image/png'); $map->ReadConfig($mapfile); if($selected != '') { if(substr($selected,0,5) == 'NODE:') { $nodename = substr($selected,5); $map->nodes[$nodename]->selected=1; } if(substr($selected,0,5) == 'LINK:') { $linkname = substr($selected,5); $map->links[$linkname]->selected=1; } } $map->sizedebug = TRUE; // $map->RandomData(); $map->DrawMap(); exit(); break; case 'show_config': header('Content-type: text/plain'); $fd = fopen($mapfile,'r'); while (!feof($fd)) { $buffer = fgets($fd, 4096); echo $buffer; } fclose($fd); exit(); break; case "set_node_properties": $map->ReadConfig($mapfile); $node_name = $_REQUEST['node_name']; $new_node_name = $_REQUEST['node_new_name']; if($node_name != $new_node_name) { if(!isset($map->nodes[$new_node_name])) { // we need to rename the node first. $newnode = $map->nodes[$node_name]; $newnode->name = $new_node_name; $map->nodes[$new_node_name] = $newnode; unset($map->nodes[$node_name]); foreach ($map->links as $link) { if($link->a->name == $node_name) { $map->links[$link->name]->a = $newnode; } if($link->b->name == $node_name) { $map->links[$link->name]->b = $newnode; } } } else { // silently ignore attempts to rename a node to an existing name $new_node_name = $node_name; } } // by this point, and renaming has been done, and new_node_name will always be the right name $map->nodes[$new_node_name]->label = $_REQUEST['node_label']; $map->nodes[$new_node_name]->infourl = $_REQUEST['node_infourl']; $map->nodes[$new_node_name]->overliburl = $_REQUEST['node_hover']; if($_REQUEST['node_iconfilename'] == '--NONE--') { $map->nodes[$new_node_name]->iconfile=''; } else { $map->nodes[$new_node_name]->iconfile = stripslashes($_REQUEST['node_iconfilename']); } $map->WriteConfig($mapfile); break; case "set_link_properties": $map->ReadConfig($mapfile); $link_name = $_REQUEST['link_name']; $map->links[$link_name]->width = intval($_REQUEST['link_width']); $map->links[$link_name]->infourl = $_REQUEST['link_infourl']; $map->links[$link_name]->overliburl = $_REQUEST['link_hover']; // $map->links[$link_name]->target = $_REQUEST['link_target']; $targets = preg_split('/\s+/',$_REQUEST['link_target'],-1,PREG_SPLIT_NO_EMPTY); $new_target_list = array(); foreach ($targets as $target) { // we store the original TARGET string, and line number, along with the breakdown, to make nicer error messages later $newtarget = array($target,'traffic_in','traffic_out',0,$target); // if it's an RRD file, then allow for the user to specify the // DSs to be used. The default is traffic_in, traffic_out, which is // OK for Cacti (most of the time), but if you have other RRDs... if(preg_match("/(.*\.rrd):([\-a-zA-Z0-9_]+):([\-a-zA-Z0-9_]+)$/i",$target,$matches)) { $newtarget[0] = $matches[1]; $newtarget[1] = $matches[2]; $newtarget[2] = $matches[3]; } // now we've (maybe) messed with it, we'll store the array of target specs $new_target_list[] = $newtarget; } $map->links[$link_name]->targets = $new_target_list; $bwin = $_REQUEST['link_bandwidth_in']; $bwout = $_REQUEST['link_bandwidth_out']; if(isset($_REQUEST['link_bandwidth_out_cb']) && $_REQUEST['link_bandwidth_out_cb'] == 'symmetric') { $bwout = $bwin; } $map->links[$link_name]->SetBandwidth($bwin,$bwout); $map->WriteConfig($mapfile); break; case "set_map_properties": $map->ReadConfig($mapfile); $map->title = $_REQUEST['map_title']; $map->keytext['DEFAULT'] = $_REQUEST['map_legend']; $map->stamptext = $_REQUEST['map_stamp']; $map->htmloutputfile = $_REQUEST['map_htmlfile']; $map->imageoutputfile = $_REQUEST['map_pngfile']; $map->width = intval($_REQUEST['map_width']); $map->height = intval($_REQUEST['map_height']); // XXX sanitise this a bit if($_REQUEST['map_bgfile'] == '--NONE--') { $map->background=''; } else { $map->background = stripslashes($_REQUEST['map_bgfile']); } $inheritables = array( array('link','width','map_linkdefaultwidth'), ); handle_inheritance($map, $inheritables); $bwin = $_REQUEST['map_linkdefaultbwin']; $bwout = $_REQUEST['map_linkdefaultbwout']; $bwin_old = $map->defaultlink->max_bandwidth_in_cfg; $bwout_old = $map->defaultlink->max_bandwidth_out_cfg; if( ($bwin_old != $bwin) || ($bwout_old != $bwout) ) { $map->defaultlink->SetBandwidth($bwin,$bwout); foreach ($map->links as $link) { if( ($link->max_bandwidth_in_cfg == $bwin_old) || ($link->max_bandwidth_out_cfg == $bwout_old) ) { $link->SetBandwidth($bwin,$bwout); } } } $map->WriteConfig($mapfile); break; case 'set_map_style': $map->ReadConfig($mapfile); $map->htmlstyle = $_REQUEST['mapstyle_htmlstyle']; $map->keyfont = intval($_REQUEST['mapstyle_legendfont']); $inheritables = array( array('link','labelstyle','mapstyle_linklabels'), array('link','bwfont','mapstyle_linkfont'), array('link','arrowstyle','mapstyle_arrowstyle'), array('node','labelfont','mapstyle_nodefont') ); handle_inheritance($map, $inheritables); $map->WriteConfig($mapfile); break; case "add_link": $map->ReadConfig($mapfile); $param2 = $_REQUEST['param']; $newaction = 'add_link2'; $selected = 'NODE:'.$param2; break; case "add_link2": $map->ReadConfig($mapfile); $a = $_REQUEST['param2']; $b = $_REQUEST['param']; $log = "[$a -> $b]"; if($a != $b) { $newlink = new WeatherMapLink; $newlink->Reset($map); $newlink->a = $map->nodes[$a]; $newlink->b = $map->nodes[$b]; $newlink->SetBandwidth($map->defaultlink->max_bandwidth_in_cfg, $map->defaultlink->max_bandwidth_out_cfg); $newlink->width = $map->defaultlink->width; // make sure the link name is unique. We can have multiple links between // the same nodes, these days $newlinkname = "$a-$b"; while(array_key_exists($newlinkname,$map->links)) { $newlinkname .= "a"; } $newlink->name = $newlinkname; $map->links[$newlinkname] = $newlink; $map->WriteConfig($mapfile); } break; case "place_legend": $x = intval($_REQUEST['x']); $y = intval($_REQUEST['y']); $scalename = $_REQUEST['param']; $map->ReadConfig($mapfile); $map->keyx[$scalename] = $x; $map->keyy[$scalename] = $y; $map->WriteConfig($mapfile); break; case "place_stamp": $x = intval($_REQUEST['x']); $y = intval($_REQUEST['y']); $map->ReadConfig($mapfile); $map->timex = $x; $map->timey = $y; $map->WriteConfig($mapfile); break; case "move_node": $x = intval($_REQUEST['x']); $y = intval($_REQUEST['y']); $node_name = $_REQUEST['node_name']; $map->ReadConfig($mapfile); if(1==1) { // This is a complicated bit. Find out if this node is involved in any // links that have VIAs. If it is, we want to rotate those VIA points // about the *other* node in the link foreach ($map->links as $link) { if( (count($link->vialist)>0) && (($link->a->name == $node_name) || ($link->b->name == $node_name)) ) { // get the other node from us if($link->a->name == $node_name) $pivot = $link->b; if($link->b->name == $node_name) $pivot = $link->a; if( ($link->a->name == $node_name) && ($link->b->name == $node_name) ) { // this is a wierd special case, but it is possible # $log .= "Special case for node1->node1 links\n"; $dx = $link->a->x - $x; $dy = $link->a->y - $y; for($i=0; $ivialist); $i++) { $link->vialist[$i][0] = $link->vialist[$i][0]-$dx; $link->vialist[$i][1] = $link->vialist[$i][1]-$dy; } } else { $pivx = $pivot->x; $pivy = $pivot->y; $dx_old = $pivx - $map->nodes[$node_name]->x; $dy_old = $pivy - $map->nodes[$node_name]->y; $dx_new = $pivx - $x; $dy_new = $pivy - $y; $l_old = sqrt($dx_old*$dx_old + $dy_old*$dy_old); $l_new = sqrt($dx_new*$dx_new + $dy_new*$dy_new); $angle_old = rad2deg(atan2(-$dy_old,$dx_old)); $angle_new = rad2deg(atan2(-$dy_new,$dx_new)); # $log .= "$pivx,$pivy\n$dx_old $dy_old $l_old => $angle_old\n"; # $log .= "$dx_new $dy_new $l_new => $angle_new\n"; // the geometry stuff uses a different point format, helpfully $points = array(); foreach($link->vialist as $via) { $points[] = $via[0]; $points[] = $via[1]; } $scalefactor = $l_new/$l_old; # $log .= "Scale by $scalefactor along link-line"; // rotate so that link is along the axis RotateAboutPoint($points,$pivx, $pivy, deg2rad($angle_old)); // do the scaling in here for($i=0; $i<(count($points)/2); $i++) { $basex = ($points[$i*2] - $pivx) * $scalefactor + $pivx; $points[$i*2] = $basex; } // rotate back so that link is along the new direction RotateAboutPoint($points,$pivx, $pivy, deg2rad(-$angle_new)); // now put the modified points back into the vialist again $v = 0; $i = 0; foreach($points as $p) { $link->vialist[$v][$i]=$p; $i++; if($i==2) { $i=0; $v++;} } } } } } $map->nodes[$node_name]->x = $x; $map->nodes[$node_name]->y = $y; $map->WriteConfig($mapfile); break; case "add_node": $x = intval($_REQUEST['x']); $y = intval($_REQUEST['y']); $map->ReadConfig($mapfile); $node = new WeatherMapNode; $node->Reset($map); $node->x = snap($x); $node->y = snap($y); $node->name = "node".time(); $node->label = "NODE"; $map->nodes[$node->name] = $node; $map->WriteConfig($mapfile); break; case "delete_link": $map->ReadConfig($mapfile); $target = $_REQUEST['param']; $log = "delete link ".$target; unset($map->links[$target]); $map->WriteConfig($mapfile); break; case "delete_node": $map->ReadConfig($mapfile); $target = $_REQUEST['param']; $log = "delete node ".$target; foreach ($map->links as $link) { if( ($target == $link->a->name) || ($target == $link->b->name) ) { unset($map->links[$link->name]); } } unset($map->nodes[$target]); $map->WriteConfig($mapfile); break; // no action was defined - starting a new map? default: $map->ReadConfig($mapfile); break; } // now we'll just draw the full editor page, with our // new knowledge $imageurl = '?mapname='.$mapname . '&action=draw'; if($selected != '') { $imageurl .= '&selected='.$selected; } $imageurl .= '&unique='.time(); $imlist = get_imagelist("images"); $fontlist = array(); ?> PHP Weathermap Editor <?php echo $WEATHERMAP_VERSION; ?>
Weathermap

Debug: Do Nothing See config

DrawMap('null'); $map->htmlstyle='editor'; $map->PreloadMapHTML(); print $map->imap->subHTML("LEGEND:"); print $map->imap->subHTML("TIMESTAMP"); print $map->imap->subHTML("NODE:"); print $map->imap->subHTML("LINK:"); ?>
Node Properties
Internal Name
Label
Info URL
'Hover' Graph URL [Pick from Cacti]
Icon Filename
 
Move NodeDelete Node
Helpful text will appear here, depending on the current item selected. It should wrap onto several lines, if it's necessary for it to do that.
Link Properties
Link from '%NODE1%' to '%NODE2%'
Maximum Bandwidth
Into '%NODE1%'
bits/sec
Maximum Bandwidth
Out of '%NODE1%'
Same As 'In' or bits/sec
Data Source [Pick from Cacti]
Link Width pixels
Info URL
'Hover' Graph URL
 
Delete Link
Map Properties
Map Title
Legend Text
Timestamp Text
Default Link Width pixels
Default Link Bandwidth bit/sec in, bit/sec out
Map Size x pixels
Output Image Filename
Output HTML Filename
Background Image Filename
Helpful text will appear here, depending on the current item selected. It should wrap onto several lines, if it's necessary for it to do that.
Map Style
Link Labels
HTML Style
Arrow Style
Node Font defaultnode->labelfont); ?>
Link Label Font defaultlink->bwfont); ?>
Legend Font keyfont); ?>
Font Samples:

(Drawn using your PHP install)
Helpful text will appear here, depending on the current item selected. It should wrap onto several lines, if it's necessary for it to do that.
Manage Colors
Nothing in here works yet. The aim is to have a nice color picker somehow.
Background Color
Link Outline Color
Scale Colors Some pleasant way to design the bandwidth color scale goes in here???
Helpful text will appear here, depending on the current item selected. It should wrap onto several lines, if it's necessary for it to do that.
Manage Images

Nothing in here works yet.

The aim is to have some nice way to upload images which can be used as icons or backgrounds. 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...
Helpful text will appear here, depending on the current item selected. It should wrap onto several lines, if it's necessary for it to do that.
WebSVN - weathermap - Blame - Rev 29 - /editor.php
  jablonka.czprosek.czf

weathermap

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

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1