- Timestamp:
- May 31, 2011, 2:23:09 PM (13 years ago)
- Location:
- src/django_gheat/website
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/website/filters.py
r9224 r9225 1 1 #!/usr/bin/env python 2 2 # 3 # View serving available WirelessLeiden Nodes in list on mouseover.3 # View serving filter values. 4 4 # 5 5 # Dennis Wagenaar … … 73 73 { 74 74 'naam' : mr.naam, 75 'date' : mr.datum.strftime('%Y-%m-%d'), 75 76 'nodes' : list(wirelessleiden_ssid) 76 77 } -
src/django_gheat/website/static/heatmap_extensions_test.js
r9223 r9225 1 1 // Base stolen from http://java.sun.com/developer/technicalArticles/J2EE/AJAX/RealtimeValidation/ 2 var json _dataset;2 var json; 3 3 function AjaxRequest(url, callback, filter, field) { 4 4 … … 41 41 42 42 function setNodeList(responseText) { 43 json =eval('(' + responseText + ')');44 if (json .length>0){43 json_nodelist=eval('(' + responseText + ')'); 44 if (json_nodelist.length>0){ 45 45 list = 'Wireless Leiden nodes on mouseposition:<br /><b>'; 46 for (var i=0; i<json .length; i++){47 list += json [i].fields.ssid + '<br />';46 for (var i=0; i<json_nodelist.length; i++){ 47 list += json_nodelist[i].fields.ssid + '<br />'; 48 48 } 49 49 list += '</b>'; … … 63 63 var layername = '<input type="text" id="lname" name="lname" size="10"/> Layername<br />'; 64 64 var colour = '<input type="text" id="colour" name="colour" size="10"/> Colour<br />'; 65 var user = '<select id="user" style="width:104px" onchange= "update_dataset()"><option></option></select> User<br />';65 var user = '<select id="user" style="width:104px" onchange=update_dataset()><option></option></select> User<br />'; 66 66 var dataset = '<select id="dataset" style="width:104px"><option></option></select> Dataset<br />'; 67 67 var node = '<select id="node" style="width:104px"><option></option></select> Node<br />'; … … 72 72 document.getElementById('filter_list').innerHTML+=(formstart + user + dataset + node + enc + date + colour + layername + formend); 73 73 74 // Get values for select boxes 75 // filters[] first value is what to get, second value is which field values will be shown in select box 76 get_user(); 77 get_dataset(); 78 } 79 80 81 function get_user() { 82 var url = "/website/filter/filter_user"; 74 // Request JSON with filter values 75 var url = "/website/foofilter"; 83 76 var ajax = new AjaxRequest(url, set_user); 84 77 ajax.doGet(); 85 78 } 86 79 87 function get_dataset() { 88 var url = "/website/filter/filter_dataset"; 89 var ajax = new AjaxRequest(url, update_dataset); 90 ajax.doGet(); 80 function set_user(responseText) { 81 json=eval('(' + responseText + ')'); 82 var options = '<option value="All">All</option>'; 83 for (var i=0; i<json.length; i++){ 84 options += '<option>' + json[i].gebruiker + '</option>'; 85 } 86 document.getElementById('user').innerHTML=options; 87 88 update_dataset(); 91 89 } 92 90 93 91 92 function update_dataset(){ 93 var options = ''; 94 var user_value = $('#user option:selected').text(); 94 95 95 function set_user(responseText) { 96 json_user=eval('(' + responseText + ')'); 97 var options = '<option value="All">All</option>'; 98 for (var i=0; i<json_user.length; i++){ 99 options += '<option value="' + json_user[i].pk + '">' + json_user[i].fields.naam + '</option>'; 100 } 101 document.getElementById('user').innerHTML=options; 102 } 103 104 105 function update_dataset(responseText){ 106 if (!json_dataset){ 107 json_dataset=eval('(' + responseText + ')'); 108 } 109 else{ 110 } 111 var options = ''; 112 113 var e = document.getElementById('user'); 114 var user_value = e.options[e.selectedIndex].value; 115 116 for (var i=0; i<json_dataset.length; i++){ 117 if (user_value != 'All'){ 118 if (json_dataset[i].fields.gebruiker == user_value){ 119 options += '<option value="' + json_dataset[i].fields.gebruiker + '">' + json_dataset[i].fields.naam + '</option>'; 96 for (var i=0; i<json.length; i++){ 97 for (m in json[i].meetrondje){ 98 if (user_value != 'All'){ 99 if (json[i].gebruiker == user_value){ 100 options += '<option>' + json[i].meetrondje[m].naam + '</option>'; 101 } 102 else{ 103 continue; 104 } 120 105 } 121 106 else{ 122 continue;107 options += '<option>' + json[i].meetrondje[m].naam + '</option>'; 123 108 } 124 }125 else{126 options += '<option value="' + json_dataset[i].fields.gebruiker + '">' + json_dataset[i].fields.naam + '</option>';127 109 } 128 110 } … … 143 125 var user = $('#user option:selected').text(); 144 126 var dataset = $('#dataset option:selected').text(); 145 var wlnode = encodeURIComponent(document.getElementById("node").value);146 var enc = encodeURIComponent(document.getElementById("enc").value);147 var date = encodeURIComponent(document.getElementById("date").value);127 var wlnode = $('#wlnode option:selected').text(); 128 var enc = $('#enc option:selected').text(); 129 var date = $('#date option:selected').text(); 148 130 var colour = encodeURIComponent(document.getElementById("colour").value); 149 131 var lname = encodeURIComponent(document.getElementById("lname").value);
Note:
See TracChangeset
for help on using the changeset viewer.