diff options
-rw-r--r-- | check_user.php | 2 | ||||
-rw-r--r-- | config.php | 8 | ||||
-rw-r--r-- | data.php | 226 | ||||
-rw-r--r-- | db.class.php | 2 | ||||
-rw-r--r-- | index.php | 150 | ||||
-rw-r--r-- | login.php | 4 | ||||
-rw-r--r-- | map.css | 30 | ||||
-rw-r--r-- | map.js | 382 |
8 files changed, 381 insertions, 423 deletions
diff --git a/check_user.php b/check_user.php index 4b89267..bd7dfc7 100644 --- a/check_user.php +++ b/check_user.php @@ -10,7 +10,7 @@ function check_user($username, $password) $db->query("SELECT password FROM person WHERE email='".$escaped_username."'"); $data = $db->getNextObject(); - if($data->password == md5($password)) + if($data->password == md5($password)) return true; return false; @@ -10,13 +10,11 @@ $conf['router']['file'] = 'InfoRouter.plain'; /* neue eintraege bitte kommentieren !!!! */ $conf['acl']['range'] = array( - "10.0.0.0/8", // Funkfeuer Graz Private - "217.29.149.64/28", // 0xFF Citycom IP Bereich + "10.0.0.0/8", // Funkfeuer Graz et.al Private Adressen "193.33.150.0/23", // Funkfeuer Graz Public + "217.29.149.64/28", // 0xFF Citycom IP Bereich "193.238.156.0/22", // Funkfeuer Wien - "89.106.208.0/21", // mur.at -// "84.119.56.63/32", // equinox home test - "212.17.113.195/32" // roland home wien + "89.106.208.0/21" // mur.at ); ?> @@ -41,35 +41,35 @@ $ipname = array(); $dnsnames = array(); $ip = array(); $nodelocnames = array(); -$ipnodelocnames = array(); +$ipnodelocnames = array(); $links = array(); $already = array(); $count = array(); $db->query("SELECT ip, ip.name as ipname,location.id as locid,location.name as locname, node.name as nodename FROM ip, node, location WHERE ip.node_id = node.id and node.location_id=location.id"); while ($data = $db->getNextObject()) { - $locids[$data->ip]= $data->locid; - $nodename[$data->ip]= $data->nodename; - $locname[$data->ip]= $data->locname; - $ipname[$data->ip]= $data->ipname; - $dnsname = $data->ipname.'.'.$data->nodename.'.'.$data->locname; - $dnsnames[$data->locid][]=$dnsname; - $ip[$dnsname]=$data->ip; + $locids[$data->ip]= $data->locid; + $nodename[$data->ip]= $data->nodename; + $locname[$data->ip]= $data->locname; + $ipname[$data->ip]= $data->ipname; + $dnsname = $data->ipname.'.'.$data->nodename.'.'.$data->locname; + $dnsnames[$data->locid][]=$dnsname; + $ip[$dnsname]=$data->ip; $nodelocname = $data->nodename.'.'.$data->locname; - $nodelocnames[$data->locid][]=$nodelocname; - $ipnodelocnames[$nodelocname][]=$data->ipname; + $nodelocnames[$data->locid][]=$nodelocname; + $ipnodelocnames[$nodelocname][]=$data->ipname; } if($conf['acl']['auth']) - $db->query("SELECT id as locid, name as locname, pixel_x, pixel_y, gallery_link, location.hastinc as hastinc FROM location ORDER BY name ASC"); + $db->query("SELECT id as locid, name as locname, pixel_x, pixel_y, gallery_link, location.hastinc as hastinc FROM location ORDER BY name ASC"); else - $db->query("SELECT id as locid, name as locname, pixel_x, pixel_y, gallery_link, location.hastinc as hastinc FROM location WHERE location.hidden = 0 ORDER BY name ASC"); + $db->query("SELECT id as locid, name as locname, pixel_x, pixel_y, gallery_link, location.hastinc as hastinc FROM location WHERE location.hidden = 0 ORDER BY name ASC"); while ($data = $db->getNextObject()) { - if ($data->pixel_x == "0") - continue; + if ($data->pixel_x == "0") + continue; - $data->lng = $lng_startpoint + ($data->pixel_x - $x_startpoint) / $dx_dLng; - $data->lat = $lat_startpoint + ($y_startpoint - $data->pixel_y) / $dy_dLat; + $data->lng = $lng_startpoint + ($data->pixel_x - $x_startpoint) / $dx_dLng; + $data->lat = $lat_startpoint + ($y_startpoint - $data->pixel_y) / $dy_dLat; $data->state = "offline"; if($conf['acl']['auth']){ foreach($nodelocnames[$data->locid] as $nodelocname){ @@ -93,7 +93,7 @@ while ($data = $db->getNextObject()) { if ($channel!="" or $frequence!=""){ $data->dnsnames = $dnsname." (Kanal: ".$channel." / ".$frequence." GHz);".$data->dnsnames; break 2; - } + } } $data->dnsnames = $dnsname.";".$data->dnsnames; } @@ -117,7 +117,7 @@ while ($data = $db->getNextObject()) { } } */ - } + } $locations[$data->locid] = $data; } @@ -126,27 +126,27 @@ $lines = file($conf['topo']['file']); $linecnt=0; $i =0; -foreach ($lines as $num => $line) +foreach ($lines as $num => $line) { - $linecnt++; - if(preg_match($regmatch,$line,$matches)==0) + $linecnt++; + if(preg_match($regmatch,$line,$matches)==0) continue; - list( , $ipfromLoc, $iptoLoc, $label) = $matches; + list( , $ipfromLoc, $iptoLoc, $label) = $matches; + + if (empty($ipfromLoc) || empty($iptoLoc) || empty($label)) + continue; - if (empty($ipfromLoc) || empty($iptoLoc) || empty($label)) - continue; - if (empty($locids[$ipfromLoc]) || empty($locids[$iptoLoc])) - continue; - - if(empty($locations[$locids[$ipfromLoc]]->locid) || empty($locations[$locids[$iptoLoc]]->locid)) - continue; - - if($locations[$locids[$ipfromLoc]]->locid == $locations[$locids[$iptoLoc]]->locid) - continue; -// echo $locations[$locids[$ipfromLoc]]->locid; + continue; + + if(empty($locations[$locids[$ipfromLoc]]->locid) || empty($locations[$locids[$iptoLoc]]->locid)) + continue; + + if($locations[$locids[$ipfromLoc]]->locid == $locations[$locids[$iptoLoc]]->locid) + continue; +// echo $locations[$locids[$ipfromLoc]]->locid; // echo "-"; // echo "$ipfromLoc\n"; // echo $locations[$locids[$iptoLoc]]->locid; @@ -154,26 +154,26 @@ foreach ($lines as $num => $line) // echo "$iptoLoc\n"; - + if(isset($already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid])&& - ($already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->used == true)) { - $jot = $already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->i; + ($already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->used == true)) { + $jot = $already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->i; if($links[$jot]->label != -1){ if (($links[$jot]->$ipfromLoc==$iptoLoc) || ($links[$jot]->$iptoLoc==$ipfromLoc)){ - $links[$jot]->label = ($links[$jot]->label + $label)/2; - } else if ($links[$jot]->label > $label){ - $links[$jot]->label = $label; + $links[$jot]->label = ($links[$jot]->label + $label)/2; + } else if ($links[$jot]->label > $label){ + $links[$jot]->label = $label; } } - if (array_key_exists($ipfromLoc,$routerhash)){ + if (array_key_exists($ipfromLoc,$routerhash)){ if ($routerhash[$ipfromLoc][4]!==""){ $links[$jot]->channel = $routerhash[$ipfromLoc][4]; - + } if ($routerhash[$ipfromLoc][5]!==""){ $links[$jot]->frequence = $routerhash[$ipfromLoc][5]; } - + } else if (array_key_exists($iptoLoc,$routerhash)){ if ($routerhash[$iptoLoc][4]!==""){ $links[$jot]->channel = $routerhash[$iptoLoc][4]; @@ -183,20 +183,20 @@ foreach ($lines as $num => $line) } } else{ $links[$jot]->channel ="undef"; - $links[$jot]->frequence ="undef"; + $links[$jot]->frequence ="undef"; // echo "keine IP\n"; - } + } if (array_key_exists($ipfromLoc,$routerhash)){ if($conf['acl']['auth']){ if (strpos($links[$jot]->dnsfrom ,$routerhash[$ipfromLoc][1])===false){ $links[$jot]->dnsfrom =($routerhash[$ipfromLoc][1].' (Kanal: '.$links[$jot]->channel.' / '.$links[$jot]->frequence.' GHz)'.';'.($links[$jot]->dnsfrom)); } - + + } + if ($routerhash[$ipfromLoc][3]==$iptoLoc){ + $links[$jot]->defaultroute = "1"; } - if ($routerhash[$ipfromLoc][3]==$iptoLoc){ - $links[$jot]->defaultroute = "1"; - } } if (array_key_exists($iptoLoc,$routerhash)){ if($conf['acl']['auth']){ @@ -206,30 +206,30 @@ foreach ($lines as $num => $line) } } if ($routerhash[$iptoLoc][3]==$ipfromLoc){ - $links[$jot]->defaultroute = "1"; - } - } - - } - elseif(isset($already[$locations[$locids[$iptoLoc]]->locid . '-' . $locations[$locids[$ipfromLoc]]->locid])&& + $links[$jot]->defaultroute = "1"; + } + } + + } + elseif(isset($already[$locations[$locids[$iptoLoc]]->locid . '-' . $locations[$locids[$ipfromLoc]]->locid])&& ($already[$locations[$locids[$iptoLoc]]->locid . '-' . $locations[$locids[$ipfromLoc]]->locid]->used == true)) { - $jot = $already[$locations[$locids[$iptoLoc]]->locid . '-' . $locations[$locids[$ipfromLoc]]->locid]->i; + $jot = $already[$locations[$locids[$iptoLoc]]->locid . '-' . $locations[$locids[$ipfromLoc]]->locid]->i; if($links[$jot]->label != -1){ if (($links[$jot]->$ipfromLoc==$iptoLoc) || ($links[$jot]->$iptoLoc==$ipfromLoc)){ - $links[$jot]->label = ($links[$jot]->label + $label)/2; - } else if ($links[$jot]->label > $label){ - $links[$jot]->label = $label; + $links[$jot]->label = ($links[$jot]->label + $label)/2; + } else if ($links[$jot]->label > $label){ + $links[$jot]->label = $label; } } if (array_key_exists($ipfromLoc,$routerhash)){ if ($routerhash[$ipfromLoc][4]!==""){ $links[$jot]->channel = $routerhash[$ipfromLoc][4]; - + } if ($routerhash[$ipfromLoc][5]!==""){ $links[$jot]->frequence = $routerhash[$ipfromLoc][5]; } - + } else if (array_key_exists($iptoLoc,$routerhash)){ if ($routerhash[$iptoLoc][4]!==""){ $links[$jot]->channel = $routerhash[$iptoLoc][4]; @@ -239,19 +239,19 @@ foreach ($lines as $num => $line) } } else{ $links[$jot]->channel ="undef"; - $links[$jot]->frequence ="undef"; + $links[$jot]->frequence ="undef"; // echo "keine IP\n"; } - if (array_key_exists($ipfromLoc,$routerhash)){ + if (array_key_exists($ipfromLoc,$routerhash)){ if($conf['acl']['auth']){ if (strpos($links[$jot]->dnsto,$routerhash[$ipfromLoc][1])===false){ // echo "C\n"; $links[$jot]->dnsto =($routerhash[$ipfromLoc][1].' (Kanal: '.$links[$jot]->channel.' / '.$links[$jot]->frequence.' GHz)'.';'.($links[$jot]->dnsto)); } } - if ($routerhash[$ipfromLoc][3]==$iptoLoc){ - $links[$jot]->defaultroute = "1"; - } + if ($routerhash[$ipfromLoc][3]==$iptoLoc){ + $links[$jot]->defaultroute = "1"; + } } if (array_key_exists($iptoLoc,$routerhash)){ if($conf['acl']['auth']){ @@ -261,28 +261,28 @@ foreach ($lines as $num => $line) } } if ($routerhash[$iptoLoc][3]==$ipfromLoc){ - $links[$jot]->defaultroute = "1"; - } + $links[$jot]->defaultroute = "1"; + } } - } - else { + } + else { // if(isset($already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid])) { - $already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->used = true; - $already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->i = $i; -// - $links[$i]->ipfromLoc = $ipfromLoc; - $links[$i]->iptoLoc = $iptoLoc; - - if (array_key_exists($ipfromLoc,$routerhash)){ + $already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->used = true; + $already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->i = $i; +// + $links[$i]->ipfromLoc = $ipfromLoc; + $links[$i]->iptoLoc = $iptoLoc; + + if (array_key_exists($ipfromLoc,$routerhash)){ if ($routerhash[$ipfromLoc][4]!==""){ $links[$i]->channel = $routerhash[$ipfromLoc][4]; - + } if ($routerhash[$ipfromLoc][5]!==""){ $links[$i]->frequence = $routerhash[$ipfromLoc][5]; } - + } else if (array_key_exists($iptoLoc,$routerhash)){ if ($routerhash[$iptoLoc][4]!==""){ $links[$i]->channel = $routerhash[$iptoLoc][4]; @@ -292,24 +292,24 @@ foreach ($lines as $num => $line) } } else{ $links[$i]->channel ="undef"; - $links[$i]->frequence ="undef"; + $links[$i]->frequence ="undef"; // echo "keine IP\n"; - } + } $links[$i]->defaultroute = "0"; if($conf['acl']['auth']){ $links[$i]->dnsfrom =$ipname[$ipfromLoc].'.'.$nodename[$ipfromLoc].'.'.$locname[$ipfromLoc].' (Kanal: '.$links[$i]->channel.' / '.$links[$i]->frequence.' GHz )'; $links[$i]->dnsto =$ipname[$iptoLoc].'.'.$nodename[$iptoLoc].'.'.$locname[$iptoLoc].' (Kanal: '.$links[$i]->channel.' / '.$links[$i]->frequence.' GHz)'; } - + if (array_key_exists($ipfromLoc,$routerhash)){ if($conf['acl']['auth']){ $links[$i]->dnsfrom =$routerhash[$ipfromLoc][1].' (Kanal: '.$links[$i]->channel.' / '.$links[$i]->frequence.' GHz)'; } - if ($routerhash[$ipfromLoc][3]==$iptoLoc){ - $links[$i]->defaultroute = "1"; - } + if ($routerhash[$ipfromLoc][3]==$iptoLoc){ + $links[$i]->defaultroute = "1"; + } } if (array_key_exists($iptoLoc,$routerhash)){ if($conf['acl']['auth']){ @@ -317,36 +317,36 @@ foreach ($lines as $num => $line) } if ($routerhash[$iptoLoc][3]==$ipfromLoc){ - $links[$i]->defaultroute = "1"; - } + $links[$i]->defaultroute = "1"; + } } if($links[$i]->label != -1){ - $links[$i]->label = $label; + $links[$i]->label = $label; if($locations[$locids[$ipfromLoc]]->state == "offline") - $locations[$locids[$ipfromLoc]]->state = "online"; + $locations[$locids[$ipfromLoc]]->state = "online"; if($locations[$locids[$iptoLoc]]->state == "offline") - $locations[$locids[$iptoLoc]]->state = "online"; + $locations[$locids[$iptoLoc]]->state = "online"; + } + if (($nodename[$ipfromLoc] == "tunnel" && $locations[$locids[$ipfromLoc]]->locname=="housing") || + ($nodename[$iptoLoc] == "tunnel" && $locations[$locids[$iptoLoc]]->locname=="housing" ) || + ($locations[$locids[$iptoLoc]]->hastinc && $locations[$locids[$ipfromLoc]]->hastinc)) { + $links[$i]->label = -1; + + $links[$i]->defaultroute ="1"; + $locations[$locids[$ipfromLoc]]->state = "tunnel"; + $locations[$locids[$iptoLoc]]->state = "tunnel"; } - if (($nodename[$ipfromLoc] == "tunnel" && $locations[$locids[$ipfromLoc]]->locname=="housing") || - ($nodename[$iptoLoc] == "tunnel" && $locations[$locids[$iptoLoc]]->locname=="housing" ) || - ($locations[$locids[$iptoLoc]]->hastinc && $locations[$locids[$ipfromLoc]]->hastinc)) { - $links[$i]->label = -1; - - $links[$i]->defaultroute ="1"; - $locations[$locids[$ipfromLoc]]->state = "tunnel"; - $locations[$locids[$iptoLoc]]->state = "tunnel"; - } - if (($nodename[$ipfromLoc] == "tunnel" && $locations[$locids[$ipfromLoc]]->locname=="housing") || - ($nodename[$iptoLoc] == "tunnel" && $locations[$locids[$iptoLoc]]->locname=="housing" )){ + if (($nodename[$ipfromLoc] == "tunnel" && $locations[$locids[$ipfromLoc]]->locname=="housing") || + ($nodename[$iptoLoc] == "tunnel" && $locations[$locids[$iptoLoc]]->locname=="housing" )){ $links[$i]->frequence ="LAN"; - $links[$i]->channel ="undef"; + $links[$i]->channel ="undef"; } - - $i++; - } + + $i++; + } } @@ -355,9 +355,9 @@ echo "<root>\n"; echo "<nodes>\n"; foreach ($locations as $location) { - $data = $locations[$location->locid]; - printf("\t" . '<node id="%s" name="%s" lat="%s" lng="%s" pixel_x="%s" pixel_y="%s" state="%s" gallery_link="%s" router_links="%s"/>' . "\n", - $data->locid, $data->locname, $data->lat, $data->lng, $data->pixel_x, $data->pixel_y, $data->state, $data->gallery_link, $data->dnsnames); + $data = $locations[$location->locid]; + printf("\t" . '<node id="%s" name="%s" lat="%s" lng="%s" pixel_x="%s" pixel_y="%s" state="%s" gallery_link="%s" router_links="%s"/>' . "\n", + $data->locid, $data->locname, $data->lat, $data->lng, $data->pixel_x, $data->pixel_y, $data->state, $data->gallery_link, $data->dnsnames); } echo "</nodes>\n"; @@ -367,14 +367,14 @@ foreach ($links as $link) { - $data1 = $locations[$locids[$link->ipfromLoc]]; - $data2 = $locations[$locids[$link->iptoLoc]]; + $data1 = $locations[$locids[$link->ipfromLoc]]; + $data2 = $locations[$locids[$link->iptoLoc]]; - $count[$data1->locid]=true; - $count[$data2->locid]=true; + $count[$data1->locid]=true; + $count[$data2->locid]=true; - printf("\t" . '<link fromid="%s" from="%s" latfrom="%s" lngfrom="%s" toid="%s" to="%s" latto="%s" lngto="%s" value="%s" channel="%s" defaultroute="%s" frequence="%s" dnsfrom="%s" dnsto="%s"/>' . "\n", - $data1->locid, $data1->locname, $data1->lat,$data1->lng,$data2->locid, $data2->locname, $data2->lat, $data2->lng, $link->label, $link->channel, $link->defaultroute, $link->frequence, $link->dnsfrom,$link->dnsto); + printf("\t" . '<link fromid="%s" from="%s" latfrom="%s" lngfrom="%s" toid="%s" to="%s" latto="%s" lngto="%s" value="%s" channel="%s" defaultroute="%s" frequence="%s" dnsfrom="%s" dnsto="%s"/>' . "\n", + $data1->locid, $data1->locname, $data1->lat,$data1->lng,$data2->locid, $data2->locname, $data2->lat, $data2->lng, $link->label, $link->channel, $link->defaultroute, $link->frequence, $link->dnsfrom,$link->dnsto); } echo "</links>\n"; diff --git a/db.class.php b/db.class.php index 0921bc8..1a3647f 100644 --- a/db.class.php +++ b/db.class.php @@ -13,7 +13,7 @@ function DB($user, $pass, $host, $dbname) { } function connect() { - $this->db = mysql_connect($this->host, $this->user, $this->pass) + $this->db = mysql_connect($this->host, $this->user, $this->pass) or $this->error("Verbindungsaufbau fehlgeschlagen"); mysql_select_db($this->dbname); } @@ -10,12 +10,6 @@ if(empty($lat)) $lat=47.07102; if(empty($lng)) $lng=15.440; if(empty($res)) $res=15; -$apikey = 'unknownhost'; -if($_SERVER['HTTP_HOST'] == 'dev-karte.ffgraz.net') { - $apikey = 'ABQIAAAAZRu0cBQNp9TOBJp1i-DhohS9pf3riiZoWFmOpEuQ19If-UHZjhRHIGQIC00eY1H5H71yDqx-QzdyJA'; -} elseif($_SERVER['HTTP_HOST'] == 'dev-karte.graz.funkfeuer.at') { - $apikey = 'ABQIAAAAZRu0cBQNp9TOBJp1i-DhohSbKGG4yPVU7VmuBMuIIaQfSNuMAxRrbvJwWee4f-0iW-LpRZkkrl531Q'; -} ?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> @@ -59,10 +53,10 @@ if($_SERVER['HTTP_HOST'] == 'dev-karte.ffgraz.net') { <b>Elemente<br />aus-/einblenden</b> <form name="visibleform" action="#" onsubmit="return false"> <table class="legend"> - <!-- <tr> --> - <!-- <td><input type="checkbox" name="defaultroute" value="true" onclick="javascript:toggleVisible('defaultroute')"></td> --> - <!-- <td> </td><td>!Default</td> --> - <!-- </tr> --> + <tr> + <td><input type="checkbox" name="defaultroute" value="true" onclick="javascript:toggleVisible('defaultroute')"></td> + <td> </td><td>!Default</td> + </tr> <tr> <td><input type="checkbox" name="offline" value="true" onclick="javascript:toggleVisible('offline')"></td> <td> </td><td align="center"><img src="./img/marker_offline.png" /></td> @@ -88,61 +82,61 @@ if($_SERVER['HTTP_HOST'] == 'dev-karte.ffgraz.net') { <td> </td><td align="center"><img src="./img/link_blue.png" /></td> </tr> </table> - <!-- <table class="undef"> --> - <!-- <td><input type="checkbox" name="undef" value="true" onclick="javascript:toggleVisible('undef')"></td> --> - <!-- <td> </td><td>Kanaele undef.</td> --> - <!-- </table> --> - <!-- <table class="5channel"> --> - <!-- <tr> --> - <!-- <td><input type="checkbox" name="5channel" value="true" onclick="javascript:toggleVisible('5channel')"></td> --> - <!-- <td> </td><td>Alle 5GHz Kanaele</td> --> - <!-- </tr> --> - <!-- </table> --> - <!-- <table class="2.4channel"> --> - <!-- <tr> --> - <!-- <td><input type="checkbox" name="2.4channel" value="true" onclick="javascript:toggleVisible('2.4channel')"></td> --> - <!-- <td> </td><td>Alle 2.4GHz Kanaele</td> --> - <!-- </tr> --> - <!-- </table> --> - <!-- <table class="channel"> --> - <!-- <tr> --> - <!-- <td><input type="checkbox" name="channel1" value="true" onclick="javascript:toggleVisible('channel1')"></td> --> - <!-- <td> </td><td>1</td> --> - <!-- <td><input type="checkbox" name="channel2" value="true" onclick="javascript:toggleVisible('channel2')"></td> --> - <!-- <td> </td><td>2</td> --> - <!-- <td><input type="checkbox" name="channel3" value="true" onclick="javascript:toggleVisible('channel3')"></td> --> - <!-- <td> </td><td>3</td> --> - <!-- </tr> --> - <!-- <tr> --> + <table class="undef"> + <td><input type="checkbox" name="undef" value="true" onclick="javascript:toggleVisible('undef')"></td> + <td> </td><td>Kanaele undef.</td> + </table> + <table class="5channel"> + <tr> + <td><input type="checkbox" name="5channel" value="true" onclick="javascript:toggleVisible('5channel')"></td> + <td> </td><td>Alle 5GHz Kanaele</td> + </tr> + </table> + <table class="2.4channel"> + <tr> + <td><input type="checkbox" name="2.4channel" value="true" onclick="javascript:toggleVisible('2.4channel')"></td> + <td> </td><td>Alle 2.4GHz Kanaele</td> + </tr> + </table> + <table class="channel"> + <tr> + <td><input type="checkbox" name="channel1" value="true" onclick="javascript:toggleVisible('channel1')"></td> + <td> </td><td>1</td> + <td><input type="checkbox" name="channel2" value="true" onclick="javascript:toggleVisible('channel2')"></td> + <td> </td><td>2</td> + <td><input type="checkbox" name="channel3" value="true" onclick="javascript:toggleVisible('channel3')"></td> + <td> </td><td>3</td> + </tr> + <tr> - <!-- <td><input type="checkbox" name="channel4" value="true" onclick="javascript:toggleVisible('channel4')"></td> --> - <!-- <td> </td><td>4</td> --> - <!-- <td><input type="checkbox" name="channel5" value="true" onclick="javascript:toggleVisible('channel5')"></td> --> - <!-- <td> </td><td>5</td> --> - <!-- <td><input type="checkbox" name="channel6" value="true" onclick="javascript:toggleVisible('channel6')"></td> --> - <!-- <td> </td><td>6</td> --> - <!-- </tr> --> - <!-- <tr> --> - <!-- <td><input type="checkbox" name="channel7" value="true" onclick="javascript:toggleVisible('channel7')"></td> --> - <!-- <td> </td><td>7</td> --> - <!-- <td><input type="checkbox" name="channel8" value="true" onclick="javascript:toggleVisible('channel8')"></td> --> - <!-- <td> </td><td>8</td> --> - <!-- <td><input type="checkbox" name="channel9" value="true" onclick="javascript:toggleVisible('channel9')"></td> --> - <!-- <td> </td><td>9</td> --> - <!-- </tr> --> - <!-- <tr> --> - <!-- <td><input type="checkbox" name="channel10" value="true" onclick="javascript:toggleVisible('channel10')"></td> --> - <!-- <td> </td><td>10</td> --> - <!-- <td><input type="checkbox" name="channel11" value="true" onclick="javascript:toggleVisible('channel11')"></td> --> - <!-- <td> </td><td>11</td> --> - <!-- <td><input type="checkbox" name="channel12" value="true" onclick="javascript:toggleVisible('channel12')"></td> --> - <!-- <td> </td><td>12</td> --> - <!-- </tr> --> - <!-- <tr> --> - <!-- <td><input type="checkbox" name="channel13" value="true" onclick="javascript:toggleVisible('channel13')"></td> --> - <!-- <td> </td><td>13</td> --> - <!-- </tr> --> - <!-- </table> --> + <td><input type="checkbox" name="channel4" value="true" onclick="javascript:toggleVisible('channel4')"></td> + <td> </td><td>4</td> + <td><input type="checkbox" name="channel5" value="true" onclick="javascript:toggleVisible('channel5')"></td> + <td> </td><td>5</td> + <td><input type="checkbox" name="channel6" value="true" onclick="javascript:toggleVisible('channel6')"></td> + <td> </td><td>6</td> + </tr> + <tr> + <td><input type="checkbox" name="channel7" value="true" onclick="javascript:toggleVisible('channel7')"></td> + <td> </td><td>7</td> + <td><input type="checkbox" name="channel8" value="true" onclick="javascript:toggleVisible('channel8')"></td> + <td> </td><td>8</td> + <td><input type="checkbox" name="channel9" value="true" onclick="javascript:toggleVisible('channel9')"></td> + <td> </td><td>9</td> + </tr> + <tr> + <td><input type="checkbox" name="channel10" value="true" onclick="javascript:toggleVisible('channel10')"></td> + <td> </td><td>10</td> + <td><input type="checkbox" name="channel11" value="true" onclick="javascript:toggleVisible('channel11')"></td> + <td> </td><td>11</td> + <td><input type="checkbox" name="channel12" value="true" onclick="javascript:toggleVisible('channel12')"></td> + <td> </td><td>12</td> + </tr> + <tr> + <td><input type="checkbox" name="channel13" value="true" onclick="javascript:toggleVisible('channel13')"></td> + <td> </td><td>13</td> + </tr> + </table> </form> </div> </div> @@ -150,23 +144,23 @@ if($_SERVER['HTTP_HOST'] == 'dev-karte.ffgraz.net') { <div id="loginbox" class="box"> <script type="text/javascript"> <?php - /* if (!isset($_SESSION['logged_in']) || !$_SESSION['logged_in']) { */ - /* echo 'showFFLogin();'; */ - /* } else { */ - /* echo 'showFFLogout("'.$_SESSION['username'].'");'; */ - /* } */ + if (!isset($_SESSION['logged_in']) || !$_SESSION['logged_in']) { + echo 'showFFLogin();'; + } else { + echo 'showFFLogout("'.$_SESSION['username'].'");'; + } ?> </script> </div> - <div id="addressbox" class="box"> - <b>Adresse suchen (Strassenname Nr. <, Ort>):</b> - <form action="#" onsubmit="showAddress(this.address.value); return false"> - <p> - <input type="text" size="35" name="address" value="Lendkai 1" /> - <input type="submit" value="Suchen" /> - </p> - </form> - </div> + <!-- <div id="addressbox" class="box"> --> + <!-- <b>Adresse suchen (Strassenname Nr. <, Ort>):</b> --> + <!-- <form action="#" onsubmit="showAddress(this.address.value); return false"> --> + <!-- <p> --> + <!-- <input type="text" size="35" name="address" value="Lendkai 1" /> --> + <!-- <input type="submit" value="Suchen" /> --> + <!-- </p> --> + <!-- </form> --> + <!-- </div> --> </div> </body> </html> @@ -1,4 +1,4 @@ -<?php +<?php session_start(); header("Content-Type: text/xml"); @@ -28,7 +28,7 @@ else if (isset($_POST['logout'])) $_SESSION['logged_in'] = false; } -if (isset($_SESSION['logged_in']) && $_SESSION['logged_in']) +if (isset($_SESSION['logged_in']) && $_SESSION['logged_in']) { echo '<status code="'.'logged_in'.'" />'."\n"; echo '<username name="'.$_SESSION['username'].'" />'."\n"; @@ -58,8 +58,8 @@ div.box { #southeastcontainer { position: absolute; - right: center; - bottom: 40px; + left: 1ex; + bottom: 1ex; padding: 0; } @@ -91,14 +91,21 @@ div.box { } div.btn { - color: #0000cc; - background-color: white; - border: 1px solid black; - font: small Arial; - text-decoration: underline; + overflow: hidden; text-align: center; - padding: 2px; - margin-bottom: 3px; + position: relative; + color: black; + font-family: Roboto,Arial,sans-serif; + font-size: 11px; + background-color: white; + padding: 1px 6px; + border-bottom-left-radius: 2px; + border-top-left-radius: 2px; + background-clip: padding-box; + border: 1px solid rgba(0, 0, 0, 0.15); + box-shadow: 0px 1px 4px -1px rgba(0, 0, 0, 0.3); + min-width: 28px; + font-weight: 500; cursor: pointer; } @@ -106,10 +113,6 @@ div.btn { width: 10em; } -#reloadbtn { - width: 10em; -} - *.locinfo,table { font-size: 8pt; color: black; @@ -119,6 +122,7 @@ div.btn { font-size: 8pt; color: black; } + table.legend { margin-top: 3px; } @@ -13,42 +13,38 @@ var links = new Array(); debug = function (log_txt) { - if (typeof window.console != 'undefined') { - console.log(log_txt); - } + if (typeof window.console != 'undefined') { + console.log(log_txt); + } } function initialize(lat, lng, res) { debug("Initializing Funkfeuer Graz Map"); - $('#southeastcontainer').hide(); google.maps.visualRefresh=true; - var mapOptions = { - center: new google.maps.LatLng(lat, lng), - zoom: res, - streetViewControl: false, - mapTypeId: google.maps.MapTypeId.ROADMAP, - mapTypeControlOptions: { - mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.HYBRID , google.maps.MapTypeId.SATELLITE , google.maps.MapTypeId.TERRAIN ], + var mapOptions = { + center: new google.maps.LatLng(lat, lng), zoom: res, + streetViewControl: false, disableDoubleClickZoom: true, + mapTypeId: google.maps.MapTypeId.ROADMAP, + mapTypeControlOptions: { + mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.HYBRID, + google.maps.MapTypeId.SATELLITE , google.maps.MapTypeId.TERRAIN ], style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR, } - }; - map = new google.maps.Map(document.getElementById("map"), - mapOptions); -//##// deaktiviert 2013112 goole maps api v3 incompatibel -//##// map.disableDoubleClickZoom(); + }; + map = new google.maps.Map(document.getElementById("map"), mapOptions); //##// map.addControl(new RulerControl()); -//##// reloadcon = new reloadcontrol(); -//##// map.addcontrol(reloadcon); -//##// map.addControl(new GSmallMapControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(10,20))); -//##// map.addControl(new GMapTypeControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50,10))); + + var reloadconDiv = document.createElement('div'); + reloadcon = new ReloadControl(reloadconDiv, map); + map.controls[google.maps.ControlPosition.TOP_RIGHT].push(reloadconDiv); google.maps.event.addListener(map, "click", onMapClick); - lineinfo = document.createElement("div"); - document.getElementById("map").appendChild(lineinfo); - lineinfo.style.visibility = "hidden" + linkinfo = document.createElement("div"); + document.getElementById("map").appendChild(linkinfo); + linkinfo.style.visibility = "hidden" dnsinfo = document.createElement("div"); document.getElementById("map").appendChild(dnsinfo); @@ -60,8 +56,7 @@ function initialize(lat, lng, res) { countboxText = document.createTextNode("Aktiv: 0"); countbox.appendChild(countboxText); -//##// reloadcon.started(); - $.get( "data.php",onData); + reloadcon.reload(); } function onMapClick(mouse_event) @@ -70,13 +65,13 @@ function onMapClick(mouse_event) setNewMarker(mouse_event.latLng); } -//##//function onData(data, responseCode) { -//##// if (responseCode < 200 || responseCode > 299) { -//##// reloadcon.finished(); -//##// return alert("Fehler: Konnte die Daten nicht laden!\n(Server Antwort-Code: " + responseCode + ")"); -//##// } -//##// reloadcon.loaded(); +function onDataErr() { + reloadcon.finished(); +} + function onData(xmlData) { + reloadcon.loaded(); + for(var loc in overlays["locations"]) { overlays["locations"][loc].setMap(null); } @@ -101,7 +96,7 @@ function onData(xmlData) { countboxText.data = "Aktiv: " + count; } -//##// reloadcon.finished(); + reloadcon.finished(); } function drawLocations(xmlData) { @@ -182,35 +177,28 @@ function convertCoords(x) { function drawLinks(xmlData) { var element = xmlData.getElementsByTagName("link"); for (var i = 0; i< element.length; i++) { - var state; - var color; - var textcolor; - var width; - state="Unbekannt" var id = element[i].getAttribute("from") + "-" + element[i].getAttribute("to"); links[id] = new Link(element[i]); var line = new google.maps.Polyline({path: [links[id].frompoint, links[id].topoint], strokeColor: makeColor(Math.floor(links[id].value)), strokeWeight: makeWeight(Math.floor(links[id].value))}); line.name = id; - line.textcolor = textcolor; - line.state = state; + line.state = "Unbekannt"; line.overlaytype = "link"; line.linkid = id; line.dnsfrom = element[i].getAttribute("dnsfrom"); line.dnsto = element[i].getAttribute("dnsto"); line.Routerfrom = element[i].getAttribute("from"); line.Routerto = element[i].getAttribute("to"); -// google.maps.event.addListener(line, "mouseout", function() { lineinfo.style.visibility = "hidden"; }); +// google.maps.event.addListener(line, "mouseout", function() { linkinfo.style.visibility = "hidden"; }); // google.maps.event.addListener(line, "mouseover", function(point) { showLinkInfo(this, point)}); -// google.maps.event.addListener(line, "click", function(point){onLinkClick(this,point)}); -// google.maps.event.addListener(line, "click", function(latlng){map.openInfoWindowHtml(latlng, message)}); + google.maps.event.addListener(line, "click", function(event) { onLinkClick(this, event.latLng) }); line.setMap(map); overlays["links"].push(line); } - // if(document.visibleform.elements["defaultroute"].checked) { - // toggleVisible("defaultroute"); - // } + if(document.visibleform.elements["defaultroute"].checked) { + toggleVisible("defaultroute"); + } if(document.visibleform.elements["bad"].checked) { toggleVisible("bad"); } @@ -223,54 +211,54 @@ function drawLinks(xmlData) { if(document.visibleform.elements["tunnel"].checked) { toggleVisible("tunnel"); } - // if(document.visibleform.elements["2.4channel"].checked) { - // toggleVisible("2.4channel"); - // } - // if(document.visibleform.elements["channel1"].checked) { - // toggleVisible("channel1"); - // } - // if(document.visibleform.elements["channel2"].checked) { - // toggleVisible("channel2"); - // } - // if(document.visibleform.elements["channel3"].checked) { - // toggleVisible("channel3"); - // } - // if(document.visibleform.elements["channel4"].checked) { - // toggleVisible("channel4"); - // } - // if(document.visibleform.elements["channel5"].checked) { - // toggleVisible("channel5"); - // } - // if(document.visibleform.elements["channel6"].checked) { - // toggleVisible("channel6"); - // } - // if(document.visibleform.elements["channel7"].checked) { - // toggleVisible("channel7"); - // } - // if(document.visibleform.elements["channel8"].checked) { - // toggleVisible("channel8"); - // } - // if(document.visibleform.elements["channel9"].checked) { - // toggleVisible("channel9"); - // } - // if(document.visibleform.elements["channel10"].checked) { - // toggleVisible("channel10"); - // } - // if(document.visibleform.elements["channel11"].checked) { - // toggleVisible("channel11"); - // } - // if(document.visibleform.elements["channel12"].checked) { - // toggleVisible("channel12"); - // } - // if(document.visibleform.elements["channel13"].checked) { - // toggleVisible("channel13"); - // } - // if(document.visibleform.elements["5channel"].checked) { - // toggleVisible("5channel"); - // } - // if(document.visibleform.elements["undef"].checked) { - // toggleVisible("undef"); - // } + if(document.visibleform.elements["2.4channel"].checked) { + toggleVisible("2.4channel"); + } + if(document.visibleform.elements["channel1"].checked) { + toggleVisible("channel1"); + } + if(document.visibleform.elements["channel2"].checked) { + toggleVisible("channel2"); + } + if(document.visibleform.elements["channel3"].checked) { + toggleVisible("channel3"); + } + if(document.visibleform.elements["channel4"].checked) { + toggleVisible("channel4"); + } + if(document.visibleform.elements["channel5"].checked) { + toggleVisible("channel5"); + } + if(document.visibleform.elements["channel6"].checked) { + toggleVisible("channel6"); + } + if(document.visibleform.elements["channel7"].checked) { + toggleVisible("channel7"); + } + if(document.visibleform.elements["channel8"].checked) { + toggleVisible("channel8"); + } + if(document.visibleform.elements["channel9"].checked) { + toggleVisible("channel9"); + } + if(document.visibleform.elements["channel10"].checked) { + toggleVisible("channel10"); + } + if(document.visibleform.elements["channel11"].checked) { + toggleVisible("channel11"); + } + if(document.visibleform.elements["channel12"].checked) { + toggleVisible("channel12"); + } + if(document.visibleform.elements["channel13"].checked) { + toggleVisible("channel13"); + } + if(document.visibleform.elements["5channel"].checked) { + toggleVisible("5channel"); + } + if(document.visibleform.elements["undef"].checked) { + toggleVisible("undef"); + } } function showLinkInfo(link, point) { @@ -293,11 +281,11 @@ function showLinkInfo(link, point) { html += '<strong>Name:</strong> ' + link.name + '<br />'; //##// html += '<strong>Länge:</strong> ' + link.getLength().toFixed(0) + ' m<br />'; html += '</div>'; - lineinfo.innerHTML = html; + linkinfo.innerHTML = html; //##// var pos = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(180, 0)); -//##// pos.apply(lineinfo); - lineinfo.style.visibility = "visible"; +//##// pos.apply(linkinfo); + linkinfo.style.visibility = "visible"; } function Link(element) { @@ -321,7 +309,7 @@ function Link(element) { return link; } -function onLinkClick(line,latlng) { +function onLinkClick(line, latlng) { var html ='<div class="locinfo">'; html += '<strong>'+line.name+'</strong>'; html += '<table class="linkinfo">'; @@ -330,7 +318,7 @@ function onLinkClick(line,latlng) { for (var i = 0;i < dnsfrom.length; ++i){ if(dnsfrom[i].indexOf(" (")>=0) { link=dnsfrom[i].substring(0,dnsfrom[i].indexOf(" (")); - } else { + } else { link=dnsfrom[i]; } html += '<tr><td> Router:</td><td> </td><td><a href="http://' + link+ '.ext.graz.funkfeuer.at/" target="_blank">'+dnsfrom[i]+'</td></tr>'; @@ -342,7 +330,7 @@ function onLinkClick(line,latlng) { for (var i = 0;i < dnsto.length; ++i){ if(dnsto[i].indexOf(" (")>=0) { link=dnsto[i].substring(0,dnsto[i].indexOf(" (")); - } else { + } else { link=dnsto[i]; } html += '<tr><td> Router:</td><td> </td><td><a href="http://' + link+ '.ext.graz.funkfeuer.at/" target="_blank">'+dnsto[i]+'</td></tr>'; @@ -350,7 +338,9 @@ function onLinkClick(line,latlng) { } html += '</table>'; html += '</div>'; - map.openInfoWindowHtml(latlng,html); + + var infowindow = new google.maps.InfoWindow({ content: html, position: latlng }); + infowindow.open(map); } function makeColor(value) { @@ -398,63 +388,63 @@ function makeIcon(type) { function toggleVisible(element) { var elements = Object(); - // if (element=='bad' || element=='middle' || element=='good'){ - // document.visibleform.elements["2.4channel"].checked=false; - // document.visibleform.elements["channel1"].checked=false; - // document.visibleform.elements["channel2"].checked=false; - // document.visibleform.elements["channel3"].checked=false; - // document.visibleform.elements["channel4"].checked=false; - // document.visibleform.elements["channel5"].checked=false; - // document.visibleform.elements["channel6"].checked=false; - // document.visibleform.elements["channel7"].checked=false; - // document.visibleform.elements["channel8"].checked=false; - // document.visibleform.elements["channel9"].checked=false; - // document.visibleform.elements["channel10"].checked=false; - // document.visibleform.elements["channel11"].checked=false; - // document.visibleform.elements["channel12"].checked=false; - // document.visibleform.elements["channel13"].checked=false; - // document.visibleform.elements["5channel"].checked=false; - // document.visibleform.elements["undef"].checked=false; - // } - // if (element=='2.4channel'){ - // document.visibleform.elements["channel1"].checked=document.visibleform.elements["2.4channel"].checked; - // document.visibleform.elements["channel2"].checked=document.visibleform.elements["2.4channel"].checked; - // document.visibleform.elements["channel3"].checked=document.visibleform.elements["2.4channel"].checked; - // document.visibleform.elements["channel4"].checked=document.visibleform.elements["2.4channel"].checked; - // document.visibleform.elements["channel5"].checked=document.visibleform.elements["2.4channel"].checked; - // document.visibleform.elements["channel6"].checked=document.visibleform.elements["2.4channel"].checked; - // document.visibleform.elements["channel7"].checked=document.visibleform.elements["2.4channel"].checked; - // document.visibleform.elements["channel8"].checked=document.visibleform.elements["2.4channel"].checked; - // document.visibleform.elements["channel9"].checked=document.visibleform.elements["2.4channel"].checked; - // document.visibleform.elements["channel10"].checked=document.visibleform.elements["2.4channel"].checked; - // document.visibleform.elements["channel11"].checked=document.visibleform.elements["2.4channel"].checked; - // document.visibleform.elements["channel12"].checked=document.visibleform.elements["2.4channel"].checked; - // document.visibleform.elements["channel13"].checked=document.visibleform.elements["2.4channel"].checked; - // } + if (element=='bad' || element=='middle' || element=='good'){ + document.visibleform.elements["2.4channel"].checked=false; + document.visibleform.elements["channel1"].checked=false; + document.visibleform.elements["channel2"].checked=false; + document.visibleform.elements["channel3"].checked=false; + document.visibleform.elements["channel4"].checked=false; + document.visibleform.elements["channel5"].checked=false; + document.visibleform.elements["channel6"].checked=false; + document.visibleform.elements["channel7"].checked=false; + document.visibleform.elements["channel8"].checked=false; + document.visibleform.elements["channel9"].checked=false; + document.visibleform.elements["channel10"].checked=false; + document.visibleform.elements["channel11"].checked=false; + document.visibleform.elements["channel12"].checked=false; + document.visibleform.elements["channel13"].checked=false; + document.visibleform.elements["5channel"].checked=false; + document.visibleform.elements["undef"].checked=false; + } + if (element=='2.4channel'){ + document.visibleform.elements["channel1"].checked=document.visibleform.elements["2.4channel"].checked; + document.visibleform.elements["channel2"].checked=document.visibleform.elements["2.4channel"].checked; + document.visibleform.elements["channel3"].checked=document.visibleform.elements["2.4channel"].checked; + document.visibleform.elements["channel4"].checked=document.visibleform.elements["2.4channel"].checked; + document.visibleform.elements["channel5"].checked=document.visibleform.elements["2.4channel"].checked; + document.visibleform.elements["channel6"].checked=document.visibleform.elements["2.4channel"].checked; + document.visibleform.elements["channel7"].checked=document.visibleform.elements["2.4channel"].checked; + document.visibleform.elements["channel8"].checked=document.visibleform.elements["2.4channel"].checked; + document.visibleform.elements["channel9"].checked=document.visibleform.elements["2.4channel"].checked; + document.visibleform.elements["channel10"].checked=document.visibleform.elements["2.4channel"].checked; + document.visibleform.elements["channel11"].checked=document.visibleform.elements["2.4channel"].checked; + document.visibleform.elements["channel12"].checked=document.visibleform.elements["2.4channel"].checked; + document.visibleform.elements["channel13"].checked=document.visibleform.elements["2.4channel"].checked; + } switch(element) { - // case 'defaultroute': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].defaultroute == '0');"); break; + case 'defaultroute': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].defaultroute == '0');"); break; case 'offline': elements.overlays = overlays["locations"]; elements.select = new Function("id", "return (locations[overlays['locations'][id].locid].state == 'offline');"); break; case 'online': elements.overlays = overlays["locations"]; elements.select = new Function("id", "return (locations[overlays['locations'][id].locid].state != 'offline');"); break; case 'bad': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].value >= 6);"); break; case 'middle': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].value >= 3 && links[overlays['links'][id].linkid].value < 6);"); break; case 'good': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].value >= 0 && links[overlays['links'][id].linkid].value < 3);"); break; case 'tunnel': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].value == -1);"); break; - // case 'channel1': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '1');"); break; - // case 'channel2': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '2');"); break; - // case 'channel3': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '3');"); break; - // case 'channel4': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '4');"); break; - // case 'channel5': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '5');"); break; - // case 'channel6': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '6');"); break; - // case 'channel7': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '7');"); break; - // case 'channel8': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '8');"); break; - // case 'channel9': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '9');"); break; - // case 'channel10': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '10');"); break; - // case 'channel11': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '11');"); break; - // case 'channel12': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '12');"); break; - // case 'channel13': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '13');"); break; - // case 'undef': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence == 'undef');"); break; - // case '2.4channel': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence == '2.4');"); break; - // case '5channel': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence !=='2.4' && links[overlays['links'][id].linkid].frequence !=='undef');"); break; + case 'channel1': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '1');"); break; + case 'channel2': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '2');"); break; + case 'channel3': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '3');"); break; + case 'channel4': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '4');"); break; + case 'channel5': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '5');"); break; + case 'channel6': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '6');"); break; + case 'channel7': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '7');"); break; + case 'channel8': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '8');"); break; + case 'channel9': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '9');"); break; + case 'channel10': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '10');"); break; + case 'channel11': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '11');"); break; + case 'channel12': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '12');"); break; + case 'channel13': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '13');"); break; + case 'undef': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence == 'undef');"); break; + case '2.4channel': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence == '2.4');"); break; + case '5channel': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence !=='2.4' && links[overlays['links'][id].linkid].frequence !=='undef');"); break; } if(document.visibleform.elements[element].checked) { @@ -507,7 +497,6 @@ function addNewNodeText(point) { } function setNewMarker(point) { -// TODO: make this dragable?? var marker = new google.maps.Marker({position: point, icon: makeIcon('newnode')}); var infowindow = new google.maps.InfoWindow({ content: addNewNodeText(point) }); google.maps.event.addListener(infowindow,"closeclick",function () { marker.setMap(null); }); @@ -520,16 +509,11 @@ function setNewMarker(point) { } function fflogin(username, password) { - var postbody = "username=" + encodeURIComponent(username) + "&password=" + encodeURIComponent(password) + "&login=Einloggen#"; -//##// GDownloadUrl("login.php", onFFLogin, postbody); + $.post("login.php", { username: username, password: password, login: "Einloggen#" } ) + .done(function(data) { onFFLogin(data); }); } -function onFFLogin(data, responseCode) { - if (responseCode < 200 || responseCode > 299) { - return alert("Fehler: Konnte die Daten nicht laden!\n(Server Antwort-Code: " + responseCode + ")"); - } - xmlData = GXml.parse(data); - +function onFFLogin(xmlData) { var error = xmlData.getElementsByTagName("error"); if(error.length > 0) { alert(error[0].getAttribute("string")); @@ -539,9 +523,7 @@ function onFFLogin(data, responseCode) { if(status[0].getAttribute("code") == "logged_in") { var username = xmlData.getElementsByTagName("username")[0].getAttribute("name"); showFFLogout(username); - -//##// reloadcon.started(); - $.get( "data.php",onData); + reloadcon.reload(); } } } @@ -561,25 +543,18 @@ function showFFLogin() { } function fflogout() { - var postbody = "logout=Ausloggen#"; -//##// GDownloadUrl("login.php", onFFLogout, postbody); + $.post("login.php", { logout: "Ausloggen#" } ) + .done(function(data) { onFFLogout(data); }); } -function onFFLogout(data, responseCode) { - if (responseCode < 200 || responseCode > 299) { - return alert("Fehler: Konnte die Daten nicht laden!\n(Server Antwort-Code: " + responseCode + ")"); - } - xmlData = GXml.parse(data); - +function onFFLogout(xmlData) { var error = xmlData.getElementsByTagName("error"); if(error.length > 0) { alert(error[0].getAttribute("string")); } else { showFFLogin(); - -//##// reloadcon.started(); - $.get( "data.php",onData); + reloadcon.reload(); } } @@ -607,43 +582,30 @@ function showAddress(address) { } } -//##//function ReloadControl() { -//##//} -//##// -//##//ReloadControl.prototype = new GControl(); -//##// -//##//ReloadControl.prototype.initialize = function(map) { -//##// var container = document.createElement("div"); -//##// var btnDiv = document.createElement("div"); -//##// btnDiv.className = "btn"; -//##// btnDiv.id = "reloadbtn"; -//##// container.appendChild(btnDiv); -//##// btnText = document.createTextNode("Daten neu laden"); -//##// btnDiv.appendChild(btnText); -//##// google.maps.event.addDomListener(btnDiv, "click", function() { -//##// reloadcon.started(); -//##// GDownloadUrl("data.php", onData); -//##// }); -//##// -//##// map.getContainer().appendChild(container); -//##// return container; -//##//} -//##// -//##//ReloadControl.prototype.started = function() { -//##// btnText.data = "wird geladen..."; -//##//} -//##// -//##//ReloadControl.prototype.loaded = function() { -//##// btnText.data = "wird verarbeitet..."; -//##//} -//##// -//##//ReloadControl.prototype.finished = function() { -//##// btnText.data = "Daten neu laden"; -//##//} -//##// -//##//ReloadControl.prototype.getDefaultPosition = function() { -//##// return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7)); -//##//} +function ReloadControl(controlDiv, map) { + controlDiv.style.padding = '5px'; + + var controlUI = document.createElement('div'); + controlUI.className = 'btn'; + controlUI.title = 'Click to reload data'; + controlDiv.appendChild(controlUI); + + var controlText = document.createElement('div'); + controlText.innerHTML = 'Daten neu laden'; + controlUI.appendChild(controlText); + + var cntrl = new Object(); + cntrl.reload = function() { + controlText.innerHTML = 'wird geladen...'; + $.get("data.php", onData).fail(onDataErr); + } + cntrl.loaded = function() { controlText.innerHTML = 'wird verarbeitet...'; } + cntrl.finished = function() { controlText.innerHTML = 'Daten neu laden'; } + + google.maps.event.addDomListener(controlUI, 'click', cntrl.reload); + return cntrl; +} + //##//function RulerControl() { |