-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
249 lines (216 loc) · 7.75 KB
/
index.php
File metadata and controls
249 lines (216 loc) · 7.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<?php
session_start();
// require('access.php');
?>
<html>
<head>
<title>POPSnyc</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<link rel="apple-touch-icon-precomposed" href="icon.png">
<link rel="apple-touch-startup-image" href="startup.png">
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
<link type="text/css" rel="stylesheet" href="css/style.css"/>
<script type="text/javascript" charset="utf-8">
navigator.geolocation.getCurrentPosition(
gotPosition,
errorGettingPosition,
{'enableHighAccuracy':true,'timeout':20000,'maximumAge':0}
);
$(document).ready(function () {
$("#refreshb").click(refres_location);
});
var watchProcess = null;
function refres_location() {
navigator.geolocation.getCurrentPosition(
gotPosition,
errorGettingPosition,
{'enableHighAccuracy':true,'timeout':20000,'maximumAge':0}
);
}
$('#popstoura').live('pageshow', function () {
get_pops(<?php echo $_GET['id']; ?>);
});
function handle_pops_query(position) {
var text = "You are within " + Math.round(position.coords.accuracy) + "m of the . . . <br/>";
text = "";
$("#Output").html(text);
$("#msgs").html('');
$('#SqlStatus').show().html('scanning...');
$.ajax({
type: 'POST',
url: 'fetch_spaces_sansfq.php',
data: 'get_spaces=nyc&lat='+position.coords.latitude+'&lng='+position.coords.longitude+'&accuracy='+position.coords.accuracy,
cache: true,
success: function(response){
response = unescape(response);
var response = response.split("|");
var responseType = response[0];
var aaddy = jQuery.parseJSON(response[1]);
var aname = jQuery.parseJSON(response[2]);
var aloc = jQuery.parseJSON(response[3]);
var ayear = jQuery.parseJSON(response[4]);
var atype = jQuery.parseJSON(response[5]);
var aid = jQuery.parseJSON(response[6]);
var responseCnt = response[7];
var caddy = '';
var ctype = '';
var xusers = '';
var cstat = '';
var px = 0;
if(responseType=="success"){
for(var i = 0; i<responseCnt; i++) {
caddy = aaddy[i];
cname = aname[i];
cloc = aloc[i];
cyear = ayear[i];
ctype = atype[i];
caid = aid[i];
$('#SqlStatus').show().html('');
$('#Output').append('<h3 style="clear:both;">' + caddy + '</h3>');
$('#Output').append('<p>' + cname
+ '<br/> ' + cloc
+ '<br/> ' + cyear
+ '<br/> ' + ctype
+ '<br/> ' + cstat
+ '<a href="addFieldReport.php?id=' + caid + '" data-role="button" data-prefetch="true" data-icon="arrow-r" >submit field report</a>'
+ '</p>');
}
}else{
$('#SqlStatus').show().html('<b>Unexpected Error</b><br/> <p>Please try again</p>'+response);
}
}
});
}
function gotPosition(pos)
{
$("#msg").html("finding your location...");
handle_pops_query(pos);
}
function errorGettingPosition(err)
{
if(err.code==1)
{
$("#Output").html("User denied geolocation.");
}
else if(err.code==2)
{
$("#Output").html("Position unavailable.");
}
else if(err.code==3)
{
$("#Output").html("Timeout expired.");
}
else
{
$("#Output").html("ERROR:"+ err.message);
}
}
function get_pops(id) {
$('#popstouraOutput').show().html('scanning...');
$.ajax({
type: 'POST',
url: 'fetch_spaces_sansfq.php',
data: 'get_spaces=pops&pid='+id,
cache: true,
success: function(response){
$("#popstouraOutput").html('');
response = unescape(response);
var response = response.split("|");
var responseType = response[0];
var aaddy = jQuery.parseJSON(response[1]);
var aname = jQuery.parseJSON(response[2]);
var aloc = jQuery.parseJSON(response[3]);
var ayear = jQuery.parseJSON(response[4]);
var atype = jQuery.parseJSON(response[5]);
var asize = jQuery.parseJSON(response[6]);
var aid = jQuery.parseJSON(response[7]);
var responseCnt = response[8];
var caddy = '';
var ctype = '';
var xusers = '';
var cstat = '';
var px = 0;
if(responseType=="success"){
for(var i = 0; i<responseCnt; i++) {
caddy = aaddy[i];
cname = aname[i];
cloc = aloc[i];
cyear = ayear[i];
ctype = atype[i];
caid = aid[i];
csize = asize[i];
$('#popstouraOutput').append('<h3 style="clear:both;">Are you at the ' + caddy + ' POPS?</h3>');
$('#popstouraOutput').append('<p>According to the City it is located ... \"' + cloc + '</p>');
$('#popstouraLink').html('<a href="addFieldReport.php?id=' + aid + '" data-role="button" data-icon="arrow-r">yes, I am here!</a>');
}
}else{
$('#popstouraOutput').show().html('<b>Unexpected Error</b><br/> <p>Please try again</p>'+response);
}
}
});
}
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div data-role="page" id="mainpage">
<div data-role="header" data-id="fool">
<a href="#about" data-icon="gear" data-rel="dialog" data-transition="flip" class="ui-btn-right">About</a>
<h2 style="margin:0.6em 1em .8em; text-align:left;">POPSnyc</h2>
</div>
<div data-role="content">
<a href="#" id="refreshb" data-icon="refresh" class="button" data-role="button" data-theme="b">refresh</a>
<div id="msgs" style="height:20px;text-align:center;"></div>
<span id="Output" style="display: block;"></span>
<span id="SqlStatus" style="display: block;clear:both;"></span>
<span id="gpsStatus"></span>
</div>
</div>
<div data-role="page" id="popstoura">
<div data-role="header" data-id="fool">
<a href="#about" data-icon="gear" data-rel="dialog" data-transition="flip" class="ui-btn-right">About</a>
<h2 style="margin:0.6em 1em .8em; text-align:left;">Welcome to this week's POPS</h2>
</div>
<div data-role="content">
<span id="popstouraOutput" style="display: block;"></span>
<div id="popstouraLink" style="display: block;"></div>
</div>
</div>
<div data-role="page" id="about">
<div data-role="header" data-id="fool">
<h2 style="margin:0.6em 5px .8em;"><?php echo $headline; ?></h2>
</div>
<div data-role="content">
<img src="icon.png" class="ui-overlay-shadow"/><br/>
<p><b>POPS</b>nyc is a public-making data project that interfaces with City data on privately-owned public spaces in the built environment.</p>
<p>This project aims to contribute usability and experience sampling data to public understanding of these spaces.</p>
<p>by cdk</p>
</div>
</div>
<script type="text/javascript">
$('[data-role=page]').live('pageshow', function (event, ui) {
try {
_gaq.push(['_setAccount', 'UA-2343767-1']);
hash = location.hash;
if (hash) {
_gaq.push(['_trackPageview', hash.substr(1)]);
} else {
_gaq.push(['_trackPageview']);
}
} catch(err) {
}
});
</script>
</body>
</html>