Ignore:
Timestamp:
May 10, 2011, 4:52:19 PM (14 years ago)
Author:
dennisw
Message:

Website layout updated. Little AJAX test thing, ignore that.

Location:
src/django_gheat/website
Files:
5 added
2 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/website/static/heatmap.js

    r9166 r9175  
    1818                displayProjection: new OpenLayers.Projection("EPSG:4326")
    1919        });
    20        
     20
     21        map.events.register('click', map, GetMousePos);
     22        function GetMousePos(pos) {
     23                var pixel = new OpenLayers.Pixel(pos.xy.x,pos.xy.y);
     24                var lonlat = map.getLonLatFromPixel(pixel);
     25                var mousepos = OpenLayers.Layer.SphericalMercator.inverseMercator(lonlat.lon, lonlat.lat);
     26                loadXMLDoc(mousepos);
     27                //var url = "/website/wlnode/" + mousepos.lat + "," + mousepos.lon;
     28                //window.location = url;
     29        }
     30
    2131        layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
    2232        map.addLayer(layerMapnik);
     
    3747        map.setCenter (lonLat, zoom);
    3848}
     49
     50function loadXMLDoc(mousepos)
     51{
     52var xmlhttp;
     53var txt,xx,x,i;
     54if (window.XMLHttpRequest)
     55  {// code for IE7+, Firefox, Chrome, Opera, Safari
     56  xmlhttp=new XMLHttpRequest();
     57  }
     58else
     59  {// code for IE6, IE5
     60  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
     61  }
     62
     63
     64xmlhttp.onreadystatechange=function()
     65  {
     66  if (xmlhttp.readyState==4 && xmlhttp.status==200)
     67    {
     68    txt="";
     69    x=xmlhttp.responseXML.documentElement.getElementsByTagName("CD");
     70    for (i=0;i<x.length;i++)
     71      {
     72      xx=x[i].getElementsByTagName("ARTIST");
     73      txt=txt + xx[0].firstChild.nodeValue + "<br>";
     74      }
     75    document.getElementById('nodelist').innerHTML=txt;
     76    }
     77  }
     78xmlhttp.open("POST","/static/test.xml",true);
     79//xmlhttp.open("POST","/website/lat=" + mousepos.lat + "&lon=" + mousepos.lon,true);
     80xmlhttp.send();
     81}
  • src/django_gheat/website/templates/home.html

    r9139 r9175  
    11<html>
    22<head>
     3  <link href="{{ STATIC_URL }}style.css" rel="stylesheet" type="text/css" media="screen" />
    34  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}OpenLayers.js"></script>
    45  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}heatmap.js"></script>
    56  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}OpenStreetMap.js"></script>
    6     <style>
    7       #heatmap{
    8         width:100%;
    9         height:100%;
    10       }
    11     </style>
    127</head>
    138<body onload="init()">
    14   <div id="heatmap"></div>
     9  <div id="wrapper">
     10    <div id="contentcontainer">
     11      <div id="header">
     12        <a href="index.html"><img src="/static/img/logo.jpg" border="0" style="float: left;"/></a>
     13        &nbsp; <font style="font-size:24px; color:white;">Stichting Wireless Leiden</font><br />
     14        &nbsp; <font style="font-size:46px; color:white;">Heatmap</font>
     15      </div>
     16      <div id="content">
     17        <h1>Info</h1><br />
     18        Info
     19        <div id="nodelist"><h2>Let AJAX change this text</h2></div>
     20        <button type="button" onclick="loadXMLDoc()">Change Content</button>
     21      </div>
     22      <div id="footer"> <a href="http://www.wirelessleiden.nl/">wirelessleiden.nl</a> </div>
     23    </div>
     24    <div id="heatmapwrapper">
     25    <div id="heatmap"></div>
     26    </div>
     27  </div>
    1528</body>
    1629</html>
    17 
Note: See TracChangeset for help on using the changeset viewer.