Example #1
0
            $map->ReadConfig($input_mapfile);
            foreach ($map->nodes as $node) {
                $target = $node->name;
                if ($node->x < $min_x || $node->x >= $max_x || $node->y < $min_y || $node->y >= $max_y) {
                    print "{$target} falls outside of this map. Deleting it and links that use it.\n";
                    foreach ($map->links as $link) {
                        if ($target == $link->a->name || $target == $link->b->name) {
                            print "link {$link->name} uses it. Deleted.\n";
                            unset($map->links[$link->name]);
                        }
                    }
                    unset($map->nodes[$target]);
                } else {
                    print "{$target} is OK, but will be moved for the new map from " . $node->x . "," . $node->y . " to ";
                    $x = $node->x;
                    $y = $node->y;
                    $x = $node->x - $min_x;
                    $y = $node->y - $min_y;
                    $map->nodes[$target]->x = $x;
                    $map->nodes[$target]->y = $y;
                    print "{$x},{$y}\n";
                }
            }
            $output_mapfile = $input_mapfile . "-" . $row . "-" . $col . ".conf";
            $map->width = $desired_width;
            $map->height = $desired_height;
            $map->background = "";
            $map->WriteConfig($output_mapfile);
        }
    }
}
Example #2
0
		$map->nodes[$new_node_name]->y = intval($_REQUEST['node_y']);

		if($_REQUEST['node_iconfilename'] == '--NONE--')
		{
		    $map->nodes[$new_node_name]->iconfile='';   
		}
		else
		{
		    // AICONs mess this up, because they're not fully supported by the editor, but it can still break them
		    if($_REQUEST['node_iconfilename'] != '--AICON--') {
			    $iconfile = stripslashes($_REQUEST['node_iconfilename']);			    
			    $map->nodes[$new_node_name]->iconfile = $iconfile;
		    }
		}

		$map->WriteConfig($mapfile);
		break;

	case "set_link_properties":
		$map->ReadConfig($mapfile);
		$link_name = $_REQUEST['link_name'];

		if(strpos($link_name," ") === false) {
		    $map->links[$link_name]->width = floatval($_REQUEST['link_width']);
		    $map->links[$link_name]->infourl[IN] = wm_editor_sanitize_string($_REQUEST['link_infourl']);
		    $map->links[$link_name]->infourl[OUT] = wm_editor_sanitize_string($_REQUEST['link_infourl']);
		    $urls = preg_split('/\s+/', $_REQUEST['link_hover'], -1, PREG_SPLIT_NO_EMPTY);
		    $map->links[$link_name]->overliburl[IN] = $urls;
		    $map->links[$link_name]->overliburl[OUT] = $urls;
		    
		    $map->links[$link_name]->comments[IN] =  wm_editor_sanitize_string($_REQUEST['link_commentin']);
							
						}
					
						$tindex++;
					}

					wm_debug ("ReadData complete for $type $name\n");
				}
				else
				{
					wm_debug("ReadData: No targets for $type $name\n");
				}
			}
			else
			{
				wm_debug("ReadData: Skipping $type $name that looks like a template\n.");
			}
			
			unset($myobj);
		}
	}
	
	$map->WriteConfig($outputfile);

	print "Wrote new config to $outputfile\n";
	
	print "$totaltargets targets, $candidates rrd-based targets, $converted were actually converted.\n";

	// vim:ts=4:sw=4:
?>