-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdefault.htm
490 lines (467 loc) · 23.7 KB
/
default.htm
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset=utf-8>
<!--
| Version 10.1.1
| Copyright 2012 Esri
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
-->
<title>Parks Finder</title>
<link rel="Stylesheet" href="LocalGovernment.css" />
<link rel="Stylesheet" href="ParkFinder.css" />
<style type="text/css">
@import "http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/dojo/dijit/themes/claro/claro.css";
</style>
<script type="text/javascript" src="JS/Utils.js"></script>
<script type="text/javascript" src="JS/BaseMapGallery.js"></script>
<script type="text/javascript" src="JS/locator.js"></script>
<script src="JS/modernizr-2.5.3.js" type="text/javascript"></script>
<script src="JS/Route.js" type="text/javascript"></script>
<script type="text/javascript">
var djConfig = {
parseOnLoad: true,
baseUrl: "./",
modulePaths: { "js": "js" }
}
</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.8"
djconfig="parseOnLoad:true"></script>
<script type="text/javascript">
dojo.require("esri.map");
dojo.require("esri.tasks.query");
dojo.require("esri.tasks.geometry");
dojo.require("esri.layers.FeatureLayer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.Dialog");
dojo.require("dijit.form.Button");
dojo.require("dijit.TooltipDialog");
dojo.require("dijit.form.ToggleButton");
dojo.require("dojox.widget.Standby");
dojo.require("esri.tasks.route");
dojo.require("js.date");
var baseMapLayerCollection; //variable to store basemap collection
var bufferDistance; //variable for storing the buffer distance
var defaultAddress; //variable for storing the default address
var devPlanLayerID = 'devPlanLayerID'; //Temp Feature layer ID
var devPlanLayerURL; //Variable for storing Feature layer URL
var displayValue; //variable for storing the displayed value at info window.
var featureID; // variable used for storing the selected park id while sharing
var findTask; //Findtask object for querying feature layer
var formatDateAs;
var geometryService; //Geometry used for Geocoding
var highlightPollLayerId = "highlightPollLayerId"; //Graphics layer object for displaying selected park
var infoActivity; //variable for storing the activities
var infoPopupFieldsCollection; //variable for storing the info window fields
var infoWindowHeader; //variable for storing the info window header part
var infoWindowHeight; //variable for storing the info window height
var infoWindowWidth; //variable for storing the info window width
var intervalIDs = new Array(); //Array of IntervalID of glow-effect.
var layer = true;
var locatorParams; //variable to store location params
var locatorMarkupSymbolPath;
var locatorURL; //used for locating addresses
var map; //ESRI map object
var messages;
var rendererColor; //variable for storing the buffer color
var rippleColor; // variable for storing the ripple color
var routeparams; // variable for storing the route parameters
var routeSymbol; //Symbol to mark the route.
var routeTask; //Route Task to find the route.
var searchFields; //variable for storing the search fields
var tempBufferLayer = 'tempBufferLayer'; //Graphics layer object for displaying buffered region
var tempGraphicsLayerId = 'tempGraphicsLayerID'; //variable to store graphics layer ID
var tinyURLServiceURL; //variable to store tinyurl generator
//Function to Initialize the map and read data from Configuration file
function Init() {
ShowLoadingMessage("Loading...");
esri.config.defaults.io.proxyUrl = "proxy.ashx"; //Setting to use proxy file
esriConfig.defaults.io.alwaysUseProxy = false;
esriConfig.defaults.io.timeout = 180000; //ersi request timeout value
dojo.connect(window, "onresize", function () {
if (map) {
var coords = dojo.coords('divAddress');
var span = dojo.byId('divAddressContainer');
dojo.style(span, {
left: coords.x + "px",
top: parseInt(coords.h) + parseInt(coords.y) + "px"
});
map.resize();
map.reposition();
}
});
dojo.connect(dojo.byId("txtAddress"), 'onkeypress', function (evt) {
key = evt.keyCode;
if (key == dojo.keys.ENTER) {
dojo.byId('txtAddress').blur();
Locate(this);
}
});
if (!Modernizr.geolocation) {
dojo.byId("tdGeolocation").style.display = "none";
dojo.byId("tdGeolocation").style.width = "0px";
}
dojo.xhrGet({
url: "Config.txt",
handleAs: "json",
preventCache: true,
load: function (responseObject, ioArgs) {
dojo.xhrGet(
{
url: "errorMessages.xml",
handleAs: "xml",
preventCache: true,
load: function (xmlResponse) {
messages = xmlResponse;
dojo.query(".dijitDialogCloseIcon", dojo.byId('dialogLoadMessage'))[0].title = 'Close';
dojo.byId('divLoadMessage').innerHTML = responseObject.SplashScreenMessage;
dijit.byId('dialogLoadMessage').show();
var mapExtent = responseObject.DefaultExtent;
var extent = GetQuerystring('extent');
if (extent != "") {
zoomExtent = extent.split(',');
}
else {
zoomExtent = mapExtent.split(',');
}
map = new esri.Map("map", { slider: true });
map.setExtent(new esri.geometry.Extent(parseFloat(zoomExtent[0]), parseFloat(zoomExtent[1]), parseFloat(zoomExtent[2]), parseFloat(zoomExtent[3]), new esri.SpatialReference({ wkid: 102100 })));
locatorParams = responseObject.LocatorFields;
dojo.connect(dijit.byId('imgHelp'), "onClick", function () {
window.open(helpFileURL, "helpwindow");
dijit.byId('imgHelp').attr("checked", false);
});
helpFileURL = responseObject.HelpURL;
dojo.byId('imgApp').src = responseObject.ApplicationImage;
dojo.byId('lblAppName').innerHTML = responseObject.ApplicationName;
var defaultSearch = responseObject.DefaultSearch;
defaultAddress = responseObject.LocatorDefaultAddress;
if (defaultSearch[0].address) {
dojo.byId('rbAddress').checked = true;
dojo.byId('txtAddress').title = 'Enter address,zip code';
}
else {
dojo.byId('rbParkActivity').checked = true;
dojo.byId('txtAddress').title = 'Enter park or activity name';
}
devPlanLayerURL = responseObject.DevPlanLayer;
locatorURL = responseObject.LocatorURL;
queryTask = new esri.tasks.QueryTask(devPlanLayerURL);
bufferDistance = responseObject.BufferDistance;
displayValue = responseObject.ShowNullValueAs;
tinyURLServiceURL = responseObject.MapSharingOptions;
baseMapLayerCollection = responseObject.BaseMapLayers;
infoWindowHeader = responseObject.InfoWindowHeader;
infoWindowHeaderAlias = responseObject.InfoWindowHeaderAlias;
infoPopupFieldsCollection = responseObject.InfoWindowFieldsCollection;
infoPopupFieldsCollectionAlias = responseObject.InfoPopupFieldsCollectionAlias;
infoWindowHeight = responseObject.InfoWindowHeight;
infoWindowWidth = responseObject.InfoWindowWidth;
formatDateAs = responseObject.FormatDateAs;
CreateBaseMapComponent();
searchFields = responseObject.SearchFields.split(",");
rendererColor = responseObject.BufferColor;
rippleColor = responseObject.RippleColor;
infoActivity = responseObject.Activities;
locatorMarkupSymbolPath = responseObject.LocatorMarkupSymbolPath;
geometryService = new esri.tasks.GeometryService(responseObject.GeometryService);
dojo.connect(map, "onLoad", MapInitFunction);
RadioButtonClicked();
findTask = new esri.tasks.FindTask(responseObject.FindTaskLayer);
routeTask = new esri.tasks.RouteTask(responseObject.RouteServiceURL);
dojo.connect(routeTask, "onSolveComplete", ShowRoute);
dojo.connect(routeTask, "onError", ErrorHandler);
routeSymbol = new esri.symbol.SimpleLineSymbol().setColor(new dojo.Color(responseObject.RouteColor)).setWidth(responseObject.RouteWidth);
customMouseHandler.addEvent(dojo.byId('divContainer'), 'mouseleave', HideBaseMapWidget, false);
customMouseHandler.addEvent(dojo.byId('divAppContent'), 'mouseleave', HideApplicationShareWidget, false);
}
});
}
});
dojo.connect(dojo.byId('txtAddress'), "onfocus", ClearDefaultText);
dojo.connect(dojo.byId('txtAddress'), "onblur", ReplaceDefaultText);
}
//function for map Initialized
function MapInitFunction(map) {
//setting Map slider position
if (dojo.byId('map_zoom_slider')) {
dojo.byId('map_zoom_slider').style.top = '175px';
dojo.byId('map_zoom_slider').style.left = '15px';
}
routeParams = new esri.tasks.RouteParameters();
routeParams.stops = new esri.tasks.FeatureSet();
routeParams.returnRoutes = false;
routeParams.returnDirections = true;
routeParams.directionsLengthUnits = esri.Units.MILES;
routeParams.outSpatialReference = map.spatialReference;
var gLayer = new esri.layers.GraphicsLayer();
gLayer.id = tempBufferLayer;
map.addLayer(gLayer);
gLayer = new esri.layers.GraphicsLayer();
gLayer.id = tempGraphicsLayerId;
dojo.connect(gLayer, "onMouseMove", function (evt) {
if (evt.graphic) {
if (evt.graphic.attributes) {
ShowMapTip(evt, evt.graphic.attributes.Address);
}
}
});
dojo.connect(gLayer, "onMouseOut", CloseMapTip);
map.addLayer(gLayer);
var devPlanLayer = new esri.layers.FeatureLayer(devPlanLayerURL, {
mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
outFields: ["*"],
id: devPlanLayerID,
displayOnPan: false
});
gLayer = new esri.layers.GraphicsLayer();
gLayer.id = highlightPollLayerId;
map.addLayer(gLayer);
dojo.connect(devPlanLayer, "onUpdateEnd", function (err) {
var url = esri.urlToObject(window.location.toString());
if (url.query && url.query != null) {
if (url.query.featureID) {
var bounds = url.query.featureID.split(",");
x = parseFloat(bounds[0]);
y = parseFloat(bounds[1]);
featureID = bounds[2];
Extent = new esri.geometry.Point(x, y, map.spatialReference);
}
}
if (featureID != "" && featureID != null && featureID != undefined) {
ExecuteQueryTask();
}
HideLoadingMessage();
if (err) {
ShowDialog("Data Error", err.message);
return;
}
});
dojo.connect(devPlanLayer, "onClick", function (evtArgs) {
ShowInfoWindow(evtArgs.graphic, evtArgs.graphic.geometry);
evtArgs = (evtArgs) ? evtArgs : event;
evtArgs.cancelBubble = true;
if (evtArgs.stopPropagation) {
evtArgs.stopPropagation();
}
});
map.addLayer(devPlanLayer);
dojo.query(".dijitDialogCloseIcon", dojo.byId('dialogAlertMessage'))[0].title = 'Close';
dojo.byId('divLoadingOK').focus();
}
dojo.addOnLoad(Init);
</script>
</head>
<body class="claro" onkeydown="if (event.keyCode==dojo.keys.TAB) { if (dijit.byId('dialogLoadMessage').open || dijit.byId('dialogAlertMessage').open) {return event.keyCode!=dojo.keys.TAB;}}">
<div dojotype="dijit.layout.BorderContainer" id="divMainContainer" design="headline"
gutters="false" style="width: 100%; height: 100%;">
<div id="map" dojotype="dijit.layout.ContentPane" region="center" style="position: relative;
overflow: hidden; border: double silver; padding: 0px !important; width: 100%;
height: 100%; padding: 0; margin: 0; border: 0;">
</div>
</div>
<div class="headerBackground">
</div>
<div class="headerIcon">
<div id="divimgglobeApp" style="background-color: transparent;">
<img id="imgApp" style="width: 64px;" />
</div>
</div>
<div class="header">
<label id="lblAppName" align="left" valign="middle">
</label>
</div>
<div class="headerContent" style="vertical-align: middle;" align="right">
<table style="height: 100%;">
<tr>
<td align="right" valign="middle">
<table>
<tr>
<td align="left" valign="bottom">
<input type="radio" id="rbAddress" name="rbSearchGroup" onclick="RadioButtonClicked()" />
<span id="spanAddress" class="text" onclick="ToggleSearch(this);">Find parks near me
</span>
</td>
</tr>
<tr>
<td align="left" valign="top">
<input type="radio" id="rbParkActivity" name="rbSearchGroup" onclick="RadioButtonClicked()" />
<span id="spanParkActivity" class="disabledText" onclick="ToggleSearch(this);">Find
parks by name or activity </span>
</td>
</tr>
</table>
</td>
<td style="width: 270px;" align="left" valign="middle">
<div id="divAddress">
<input type="text" id="txtAddress" value="" class="textBox" title="Enter an Address to Locate" />
<img id="imgLocateAddress" src="images/locate.png" onclick="Locate(this);" title="Search"
style="height: 20px; position: absolute; right: 2px; top: 0px;" alt="" />
</div>
</td>
<td align="center" style="width: 50px;" valign="middle" id="tdGeolocation">
<button dojotype="dijit.form.ToggleButton" id="imgGeolocation" onclick="ShowMyLocation(this)">
<img src="images/imgGeolocation.png" width="30px" title="Find parks near my current location"
alt="" />
</button>
</td>
<td align="center" style="width: 40px;" valign="middle">
<button dojotype="dijit.form.ToggleButton" id="imgBaseMap" title="Switch Basemap"
onclick="ShowHideBaseMapComponent();">
<img src="images/imgBaseMap.png" width="30px" />
</button>
</td>
<td align="center" style="width: 40px;" valign="middle">
<button dojotype="dijit.form.ToggleButton" id="imgapplink" title="Share Map" onclick="ToggleApplication();">
<img src="images/imgSocialMedia.png" width="30px" />
</button>
</td>
<td align="center" style="width: 40px;" valign="middle">
<button dojotype="dijit.form.ToggleButton" id="imgHelp" title="Help">
<img src="images/Help.png" width="28px" />
</button>
</td>
</tr>
</table>
</div>
<div id="divAddressContainer" style="display: none;">
</div>
<div id="divBaseMapTitleContainer" style="display: none;">
<div id="divContainer" dojotype="dijit.layout.ContentPane" class="divBaseMapContainer">
<div id="layerList">
</div>
</div>
</div>
<div id="divAppContainer" style="display: none;">
<div dojotype="dijit.layout.ContentPane" class="divBaseMapContainer">
<div id="divAppContent">
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<table cellpadding="2" cellspacing="2">
<tr>
<td align="center" colspan="3" style="color: #F5F5DC; font-size: 11px;">
Share this map
</td>
</tr>
<tr>
<td style="width: 30px;" align="center">
<img title="Facebook" class="imgSocialMediaIcon" src="images/img_facebook.png" onclick="ShareLink('facebook');" />
</td>
<td style="width: 30px;" align="center">
<img title="Twitter" class="imgSocialMediaIcon" src="images/img_twitter.png" onclick="ShareLink('twitter');" />
</td>
<td style="width: 30px;" align="center">
<img title="Email" class="imgSocialMediaIcon" src="images/img_email.png" onclick="ShareLink('mail');" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="dialogAlertMessage" dojotype="dijit.Dialog">
<table style="width: 100%;">
<tr>
<td align="center">
<div id="divMessage">
</div>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td align="center">
<div class="divOk" id="divOKButton" onclick="CloseDialog();">
OK</div>
</td>
</tr>
</table>
</div>
<div id="dialogLoadMessage" dojotype="dijit.Dialog" style="width: 350px;">
<table>
<tr>
<td>
<div id="divLoadMessage" style="background: #556B2F; color: #F5F5DC;">
</div>
</td>
</tr>
<tr>
<td align="center">
<div class="divOk" id="divLoadingOK" onclick="dijit.byId('dialogLoadMessage').hide();">
OK</div>
</td>
</tr>
</table>
</div>
<div id="divLeftPanelBackground">
</div>
<div id="divSearchDetailsPanel">
<div style="width: 100%">
<div class="divAccordionTitle">
Search Results</div>
<div id="divParkListContainer" class="divInstructions">
<span id="spanParkListContainer" style="margin-left: 20px; font-weight: bold;"></span>
<div id="divParkList" style="color: #F5F5DC; height: 150px; overflow: hidden; margin-left: 10px;
margin-top: 8px;">
</div>
</div>
<div id="divParkActivityContainer" class="divInstructions" style="display: none">
<span id="spanParkActivityContainer" style="margin-left: 20px; font-weight: bold;">
</span>
<div id="divParkActivity" style="color: #F5F5DC; height: 150px; overflow: hidden;
margin-left: 10px; margin-top: 8px;">
</div>
</div>
<div id="divActivityListContainer" class="divInstructions" style="display: none">
<span id="spanActivityListContainer" style="margin-left: 20px; font-weight: bold;">
</span>
<div id="divActivityList" style="color: #F5F5DC; height: 150px; overflow: hidden;
margin-left: 10px; margin-top: 8px;">
</div>
</div>
<div id="divParkDetails" style="color: #F5F5DC">
</div>
<div id="divParkDirections" style="color: #F5F5DC">
</div>
</div>
</div>
<div id="divToggleDetail" class="divToggleDetailCollapse" onclick="AnimateDetailsView();">
</div>
<div id="dojoStandBy" dojotype="dojox.widget.Standby" color="#849966">
</div>
<div id="divLoadingIndicator">
<table style="width: 100%; height: 100%;">
<tr>
<td align="center">
<table>
<tr>
<td align="center">
<img src="images/loading.gif" />
</td>
<td id="loadingMessage">
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>