Changeset 9213


Ignore:
Timestamp:
May 24, 2011, 4:08:04 PM (13 years ago)
Author:
dennisw
Message:

Added nodelist to layout again. Progress on filters (remains of useless code may still be there, will clean up later when filters work as planned).

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

Legend:

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

    r9208 r9213  
    1313    if (nodelist.readyState==4 && nodelist.status==200){
    1414      json=eval('(' + nodelist.responseText + ')');
    15       var list = '<br>';
    16       for (var i=0; i<json.length; i++){
    17         list += json[i].fields.ssid + '<br>';
     15      var list;
     16      if (json.length>0){
     17        list = '<center>Wireless Leiden nodes on mouseposition:<br /><b>';
     18        for (var i=0; i<json.length; i++){
     19          list += json[i].fields.ssid + '<br />';
     20        }
     21        list += '</b></center>';
    1822      }
    19       document.getElementById('nodelist').innerHTML=list;
     23      else{
     24        list = '<center>No nodes to display.</center>';
     25      }
     26      document.getElementById('node_list').innerHTML=list;
    2027    }
    2128  }
     
    2532
    2633
    27 // Retrieve form values for filter and pass them on to addFilter()
    28 function filters(){
    29   var user = encodeURIComponent(document.getElementById("user").value);
    30   var dataset = encodeURIComponent(document.getElementById("dataset").value);
    31   var wlnode = encodeURIComponent(document.getElementById("wlnode").value);
    32   var enc = encodeURIComponent(document.getElementById("enc").value);
    33   var date = encodeURIComponent(document.getElementById("date").value);
    34   var colour = encodeURIComponent(document.getElementById("colour").value);
    35   var lname = encodeURIComponent(document.getElementById("lname").value);
     34// Get filter values from django view and serve as option list
     35function getFilters(){
     36  var filterlist;
    3637
    37   addFilter(user, dataset, wlnode, enc, date, colour, lname);
     38  if (window.XMLHttpRequest){
     39    filterlist=new XMLHttpRequest();
     40  }
     41  else{
     42    filterlist=new ActiveXObject("Microsoft.XMLHTTP");
     43  }
     44
     45  filterlist.onreadystatechange=function(){
     46    if (filterlist.readyState==4 && filterlist.status==200){
     47      json=eval('(' + filterlist.responseText + ')');
     48      var list = '<form method="get" action="">';
     49      list += '<select id="wlnode" style="width:104px"><option></option>';
     50      for (var i=0; i<json.length; i++){
     51        list += '<option>' + json[i].fields.ssid + '</option>';
     52      }
     53      list += '</select> WLnode<br />';
     54      list += '<input type="text" id="colour" name="colour" size="10"/> Colour<br />';
     55      list += '<input type="text" id="lname" name="lname" size="10"/> Layername<br />';
     56      list += '<input type="button" value="Add filter" onClick="addFilter()"/>';
     57      list += '</form>';
     58      document.getElementById('filter_list').innerHTML=list;
     59    }
     60  }
     61  filterlist.open("GET","/website/filters",true);
     62  filterlist.send();
    3863}
    3964
    4065
    4166// Some value checks, create an overlay using these values and place it on the map.
    42 function addFilter(user, dataset, wlnode, enc, date, colour, lname){
     67function addFilter(){
     68
     69  var user = '';
     70  var dataset = '';
     71  var wlnode = encodeURIComponent(document.getElementById("wlnode").value);
     72  var enc ='';
     73  var date = '';
     74  var colour = encodeURIComponent(document.getElementById("colour").value);
     75  var lname = encodeURIComponent(document.getElementById("lname").value);
    4376
    4477  if (user != ''){user='&accespoint__id='+user;}
  • src/django_gheat/website/static/style.css

    r9212 r9213  
    5757}
    5858
    59 #filters{
     59#filter{
    6060  width:100%-10px;
    6161  display:none;
     
    6363}
    6464
    65 #filters_text{
     65#filter_text{
    6666  height:100%;
    6767  width:570px;
     
    7070}
    7171
    72 #filters_list{
     72#filter_list{
    7373  padding:5px;
    7474  width:200px;
     
    7676  float:right;
    7777  margin-bottom:5px;
     78}
     79
     80#node_list{
     81  position:absolute;
     82  left:50%;
     83  margin-left:-150px;
     84  bottom:-2px;
     85  width:300px;
     86  background-color:#FFF;
     87  border:2px solid #BA0000;
     88  z-index:1;
     89  padding:5px;
    7890}
    7991       
     
    8496A:link{
    8597  color:#FFF;
     98  padding-left:8px;
    8699}
    87100
  • src/django_gheat/website/templates/home.html

    r9212 r9213  
    1111      var hide;
    1212      if(show == 'info'){
    13         hide = 'filters';
     13        hide = 'filter';
    1414      }
    1515      else{
     
    2929
    3030
    31 <body onload="init()">
     31<body onload="init(),getFilters()">
    3232  <div id="heatmap"></div>
    3333  <div id="container">
     
    3737    <div id="menu">
    3838      <a href="javascript:toggleDiv('info')">Info</a>
    39       <a href="javascript:toggleDiv('filters')" style="padding-left:15px;">Filters</a>
     39      <a href="javascript:toggleDiv('filter')">Filters</a>
    4040    </div>
    4141    <div id="info">
    4242       test<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />test
    4343    </div>
    44     <div id="filters">
    45       <div id="filters_text">
     44    <div id="filter">
     45      <div id="filter_text">
    4646      <h1>Filters</h1>
    4747      <p>Create your custom layer by choosing the desired filter options on the right and adding it the layer to the list.</p>
    4848      <p>For instance, you can choose to create a layer with data measured only by yourself, or with a certain node from Wireless Leiden only.</p>
    4949      </div>
    50       <div id="filters_list">
     50      <div id="filter_list">
    5151      <form method="get" action="">
    5252      <table border="0">
     
    8888    </div>
    8989  </div>
     90  <div id='node_list'>
     91  <center>Click on the map to display Wireless Leiden nodes.</center>
     92  </div>
    9093</body>
    9194</html>
  • src/django_gheat/website/urls.py

    r9196 r9213  
    3636       ),
    3737    )
     38
     39urlpatterns += patterns('website.filters',
     40    url(
     41        regex = r'^filters$',
     42        view = 'serve_filters',
     43        name = 'serve_filters',
     44       ),
     45    )
Note: See TracChangeset for help on using the changeset viewer.