Changeset 9207


Ignore:
Timestamp:
May 19, 2011, 3:12:41 PM (14 years ago)
Author:
dennisw
Message:

Filters & nodelist moved to heatmap_extensions.js

Some work on filters done. Need to request some values from the database so dropboxes can be created dynamically. Makes it more user friendly to add a filter.

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

Legend:

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

    r9203 r9207  
    4747        map.setCenter (lonLat, zoom);
    4848}
    49 
    50 function getNodeList(zoomlevel, mousepos){
    51   var nodelist;
    52   if (window.XMLHttpRequest){
    53     // code for IE7+, Firefox, Chrome, Opera, Safari
    54     nodelist=new XMLHttpRequest();
    55   }
    56   else{
    57     // code for IE6, IE5
    58     nodelist=new ActiveXObject("Microsoft.XMLHTTP");
    59   }
    60 
    61   nodelist.onreadystatechange=function(){
    62     if (nodelist.readyState==4 && nodelist.status==200){
    63       json=eval('(' + nodelist.responseText + ')');
    64       var list = '<br>';
    65       for (var i=0; i<json.length; i++){
    66         list += json[i].fields.ssid + '<br>';
    67       }
    68       document.getElementById('filters').innerHTML=list;
    69     }
    70   }
    71   nodelist.open("GET","/website/nodelist/" + zoomlevel + "," + mousepos.lat + "," + mousepos.lon,true);
    72   nodelist.send();
    73 }
    74 
    75 var apid = 1;
    76 
    77 function filters(){
    78   var filter;
    79   if (window.XMLHttpRequest){
    80     // code for IE7+, Firefox, Chrome, Opera, Safari
    81     filter=new XMLHttpRequest();
    82   }
    83   else{
    84     // code for IE6, IE5
    85     filter=new ActiveXObject("Microsoft.XMLHTTP");
    86   }
    87 
    88   filter.onreadystatechange=function(){
    89     if (filter.readyState==4 && filter.status==200){
    90       map.addLayer(layerHeatmap3);
    91     }
    92   }
    93   var apid = encodeURIComponent(document.getElementById("apid").value);
    94   addFilter(apid);
    95 }
    96 
    97 function addFilter(apid){
    98   OpenLayers.Layer.OSM.Overlay = OpenLayers.Class(OpenLayers.Layer.OSM, {
    99     initialize: function(name, options) {
    100       var url = [
    101         "/website/tile/${z}/${x},${y}.png?colour=0,0,255&accespoint__id=" + apid
    102       ];
    103       options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
    104       var newArguments = [name, url, options];
    105       OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
    106     },
    107   CLASS_NAME: "OpenLayers.Layer.Overlay"
    108   });
    109 
    110   testlayer = new OpenLayers.Layer.OSM.Overlay("addFilter layer", {isBaseLayer: false, visibility: true});
    111   map.addLayer(testlayer);
    112 }
  • src/django_gheat/website/templates/home.html

    r9203 r9207  
    55  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}OpenStreetMap.js"></script>
    66  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}heatmap.js"></script>
     7  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}heatmap_extensions.js"></script>
    78</head>
    89<body onload="init()">
     
    1819        Info
    1920        <form method="get" action="">
    20           Accespoint ID: <input type="text" id="apid" name="apid" size="25" /> <br />
    21           <input type="button" value="submit" onClick="filters()" />
     21          Gebruiker: <input type="text" id="user" name="user" size="25"/> <br />
     22          Meetrondje: <input type="text" id="dataset" name="dataset" size="25"/> <br />
     23          WirelessLeiden Node: <input type="text" id="wlnode" name="wlnode" size="25"/> <br />
     24          Encrypted: <input type="checkbox" id="enc" name="enc"/> <br />
     25          Datum: <input type="text" id="date" name="date" size="25"/> <br />
     26          Colour: <input type="text" id="colour" name="colour" size="25"/> <br />
     27          Layernaam: <input type="text" id="lname" name="lname" size="25"/> <br />
     28          <input type="button" value="Add filter" onClick="filters()"/>
    2229        </form>
    2330        <div id="nodelist"></div>
Note: See TracChangeset for help on using the changeset viewer.