Changeset 211 for trunk/map/index.php


Ignore:
Timestamp:
May 10, 2009, 11:35:41 AM (15 years ago)
Author:
george
Message:
  • Upraveno: Dynamická velikost mapy.
  • Upraveno: Volba zobrazení prvků mapy.
  • Opraveno: Skript pro generování DNS záznamů opraven pro podporu struktury nových tabulek.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        22php_script_error.log
        33statistic
        4 
         4webis
  • trunk/map/index.php

    r209 r211  
    1717    $Output .= '<script type="text/javascript">
    1818
     19    var map;
     20
    1921    function initialize()
    2022    {
    2123      if (GBrowserIsCompatible())
    2224      {
    23         var map = new GMap2(document.getElementById("map_canvas"));
     25        map = new GMap2(document.getElementById("map_canvas"));
    2426        map.setMapType(G_SATELLITE_MAP);
    2527        map.setCenter(new GLatLng(49.260422, 18.081179), 15);
    2628        map.setUIToDefault();
     29        map.addControl(new GOverviewMapControl(new GSize(128, 96)));
     30       
    2731
    2832// Create our "tiny" marker icon
     
    3741// Set up our GMarkerOptions object literal
    3842markerOptions = { icon:tinyIcon };';
    39 
    40 
    41     $DbResult = $this->Database->query('SELECT * FROM NetworkDevice');
    42     while($Device = $DbResult->fetch_assoc())
    43     {
    44       $Output .= 'map.addOverlay(new GMarker(new GLatLng('.$Device['PositionLatitude'].', '.$Device['PositionLongitude'].'), markerOptions)); ';
     43   
     44    $Output .= '   
     45       }     
    4546    }
    4647   
     48function toggleLabel(id)
     49{
     50        var ele = document.getElementById(id);
     51        ele.checked = !ele.checked;
     52        ele.onclick( );
     53}
     54
     55    function UpdateNetworkLinks()
     56    {
     57            if ((document.getElementById("NetworkLinks")).checked == true)
     58      {
     59                    NetworkLinks = [';
    4760    $DbResult = $this->Database->query('SELECT * FROM NetworkLink WHERE Interface1 <> 0 AND Interface2 <> 0');
    4861    while($Link = $DbResult->fetch_assoc())
     
    5467        $Device1 = $DbResult2->fetch_assoc();
    5568        $Device2 = $DbResult3->fetch_assoc();
    56         $Output .= 'map.addOverlay(new GPolyline([new GLatLng('.$Device1['PositionLatitude'].', '.$Device1['PositionLongitude'].'),new GLatLng('.$Device2['PositionLatitude'].', '.$Device2['PositionLongitude'].')], "#FFFFFF", 3, 0.8)); ';
     69        $Output .= 'new GPolyline([new GLatLng('.$Device1['PositionLatitude'].', '.$Device1['PositionLongitude'].'),new GLatLng('.$Device2['PositionLatitude'].', '.$Device2['PositionLongitude'].')], "#4F4FBF", 3, 0.8), ';
    5770      }
    5871    }
    59     $Output .= '   
    60        }     
     72    $Output .= '];
     73                for (var i in NetworkLinks)
     74                {
     75                        map.addOverlay(NetworkLinks[i]);
     76                }
     77
     78         } else { //checkbox turned off
     79                for (var i in NetworkLinks)
     80    {
     81                        map.removeOverlay(NetworkLinks[i]);
     82                        NetworkLinks[i] = null;
     83                }
     84        }
     85}
     86
     87function toggleLabel(id)
     88{
     89        var ele = document.getElementById(id);
     90        ele.checked = !ele.checked;
     91        ele.onclick( );
     92}
     93
     94    function UpdateNetworkDevices()
     95    {
     96            if ((document.getElementById("NetworkDevices")).checked == true)
     97      {
     98                    NetworkDevices = [';
     99
     100    $DbResult = $this->Database->query('SELECT * FROM NetworkDevice');
     101    while($Device = $DbResult->fetch_assoc())
     102    {
     103      $Output .= 'new GMarker(new GLatLng('.$Device['PositionLatitude'].', '.$Device['PositionLongitude'].'), markerOptions), ';
    61104    }
     105    $Output .= '];
     106                for (var i in NetworkDevices)
     107                {
     108                        map.addOverlay(NetworkDevices[i]);
     109                }
     110
     111         } else { //checkbox turned off
     112                for (var i in NetworkDevices)
     113    {
     114                        map.removeOverlay(NetworkDevices[i]);
     115                        NetworkDevices[i] = null;
     116                }
     117        }
     118}
     119
    62120    </script>';
    63     $Output .= '<div align="center">
    64     <div id="map_canvas" style="width: 800px; height: 500px;"></div>
    65     <div id="message"></div>
    66     <div id="message2"></div>
    67     </div>';
     121    $Output .= '<table style="margin-left: auto; margin-right: auto; width: 100%; height: 80%;">
     122                  <tr>
     123                    <td style="width: 80%; height: 100%;">
     124    <div id="map_canvas" style="width: 100%; height: 100%;"></div></td>
     125    <td style="width: 20%">
     126    <form>
     127    <input type="checkbox" id="NetworkLinks" onClick="UpdateNetworkLinks();" >
     128       <a href="" onClick="toggleLabel(\'NetworkLinks\');return false;">Ukázat spoje</a>
     129       </input><br />
     130    <input type="checkbox" id="NetworkDevices" onClick="UpdateNetworkDevices();" >
     131       <a href="" onClick="toggleLabel(\'NetworkDevices\');return false;">Ukázat zařízení</a>
     132       </input>
     133    </form></td>
     134                  </tr>
     135                </table>';
    68136    return($Output);
    69137  }
Note: See TracChangeset for help on using the changeset viewer.