-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdefault.htm
1130 lines (1066 loc) · 60 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
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<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.
-->
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Election Polling Place</title>
<link rel="shortcut icon" href="images/appIcon.ico" />
<link rel="apple-touch-icon" href="images/EPPIcon.png" />
<link id="stylesheet" href='http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/dojo/dojox/mobile/themes/iPhone/iPhone.css'
rel='stylesheet' />
<link href="styles/electionPollingPlace.css" rel="stylesheet" type="text/css" />
<link rel="Stylesheet" id="dynamicStyleSheet" />
<script type="text/javascript">
djConfig = {
parseOnLoad: true,
mblHideAddressBar: false,
baseUrl: "./",
modulePaths: { "js": "js" }
}
</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.8compact">
</script>
<script src="js/infoWindow.js" type="text/javascript"></script>
<script type="text/javascript" src="js/baseMapGallery.js"></script>
<script src="js/modernizr-2.5.3.js" type="text/javascript"></script>
<script type="text/javascript" src="js/route.js"></script>
<script type="text/javascript" src="js/locator.js"></script>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/result.js"></script>
<script src="js/webmap.js" type="text/javascript"></script>
<script type="text/javascript">
dojo.require("esri.map");
dojo.require("mobile.InfoWindow");
dojo.require("esri.layers.FeatureLayer");
dojo.require("esri.tasks.geometry");
dojo.require("esri.tasks.query");
dojo.require("esri.tasks.locator");
dojo.require("esri.tasks.route");
dojo.require("dojo.date.locale");
dojo.require("dojox.mobile.parser");
dojo.require("dojox.mobile");
dojo.require("js.Config");
dojo.require("dojo.window");
dojo.require("js.date");
var baseMapLayers; //Variable for storing base map layers
var infoBoxWidth; //variable for storing the width of the box
var showCommentsTab; //variable used for toggling the comments tab
var formatDateAs; //variable to store the date format
var desgFlag = false; //flag used for setting the designation
var devObjectId; //Temp variable for storing feature object ID
var directions; //Directions in route.
var fontSize; //variable for storing font sizes for all devices.
var showNullValueAs; //variable to store the deafault value for replacing null values
var webMapId; //Variable used to store webmap id
var generateRouteToNonDesignatedPollingPlace; //flag used for setting the non designated polling place
var handleElected; ////variable for storing elected officials container touch event
var handlePoll; //variable for storing polling container touch event
var highlightPollLayerId = "highlightPollLayerId"; //variable to store highlighting layer ID
var infoPopupFieldsCollection; //array used for storing the fields collection in the info window
var infoTitle; //variable used for the webmap to store the title of the header
var infoWindowContent; //variable used to store the info window content
var infoWindowHeader; //variable used to store the info window header
var infoPopupHeight; //variable used for storing the info window height
var infoPopupWidth; //varible used for storing the info window width
var isBrowser = false; //flag set for browser web device
var isiOS = false; //flag set for ios devices
var isMobileDevice = false; //flag set for mobile devices
var isTablet = false; //flag det for tablet devices
var locatorMarkupSymbolPath; //variable for storing the locator marker image URL
var locatorURL; //variable to store locator object for geocoding
var map; //varibale to store map object
var mapPoint; //variable to store mappoint
var messages; //variable used for storing the error mesages
var newLeft = 0; //Variable to store the new left value for carrosuel of polling place
var newLeftOffice = 0; //Variable to store the new left value for carrosuel of Elected Offices
var pollingCommentsLayer; //variable to store polling comments layer URL
var pollingCommentsLayerId = "pollingCommentsLayerId"; //variable to store polling comments layer Id
var pollingPlaceData; //variable to store pollingplace layer URL
var pollMobileLayer; //variable to store pollingplace layer URL for mobile
var pollLayer; //variable to store pollingplace layer URL
var pollLayerId = 'pollLayerID'; //variable to store polling place layer ID
var pollPoint; //Point represent polling place geometry.
var precinctLayer; //variable to store precinct layer URL
var precinctLayerId = 'precinctLayerID'; //variable to store precinct layer ID
var precinctOfficeLayer; //variable to store table layer URL
var precinctOfficeLayerId = 'precinctOfficeLayerId'; //variable to store table layer ID
var queryTask; //varaible used to query the layer
var electedOfficialsTabData; //array used for storing the collection of fields for election results
var locatorRippleSize; //variable to store the size of the ripple
var routeGraphicsLayerId = 'routeGraphicsLayerID'; //variable to store route layer Id
var routeSymbol; //Symbol to mark the route.
var routeTask; //Route Task to find the route.
var locatorFields; //Variable for storing configurable address fields
var selectedPollPoint; //variable used to store the selected polling place
var tempGraphicsLayerId = 'tempGraphicsLayerID'; //variable to store graphics layer ID
var mapSharingOptions; //variable for storing the tiny service URL
var useWebmap; //flag used for setting the webmap use.
var referenceOverlayLayer;
//Function to initialize the map and read data from Configuration file
function init() {
esri.config.defaults.io.proxyUrl = "proxy.ashx"; //Setting to use proxy file
esriConfig.defaults.io.alwaysUseProxy = false;
esriConfig.defaults.io.timeout = 180000; //esri request timeout value
var userAgent = window.navigator.userAgent;
if (userAgent.indexOf("iPhone") >= 0 || userAgent.indexOf("iPad") >= 0) {
isiOS = true;
}
if (userAgent.indexOf("Android") >= 0 || userAgent.indexOf("iPhone") >= 0) {
fontSize = 15;
isMobileDevice = true;
dojo.byId('dynamicStyleSheet').href = "styles/mobile.css";
}
else if (userAgent.indexOf("iPad") >= 0) {
fontSize = 14;
isTablet = true;
dojo.byId('dynamicStyleSheet').href = "styles/tablet.css";
}
else {
fontSize = 11;
isBrowser = true;
dojo.byId('dynamicStyleSheet').href = "styles/browser.css";
}
dojo.byId("divSplashContent").style.fontSize = fontSize + "px";
dojo.connect(dojo.byId("txtAddress"), 'onkeydown', function (evt) {
if (evt) {
var key = evt.which || evt.keyCode;
if (key == 13) {
if (dojo.coords("divAddressHolder").h > 0) {
dojo.byId("txtAddress").blur();
LocateAddress();
}
}
}
});
window.onkeydown = function (e) {
return !(e.keyCode == 9);
};
if (!Modernizr.geolocation) {
dojo.byId("tdGeolocation").style.display = "none";
}
var responseObject = new js.Config();
useWebmap = responseObject.UseWebmap;
if (useWebmap) {
webMapId = responseObject.WebMapId;
var count = 0;
var webmapDetails = getWebMapInfo("electionPollingPlace", webMapId);
webmapDetails.addCallback(function (webmapInfo) {
electedOfficialsTabData = [];
infoPopupFieldsCollection = []
for (var b = 0; b < webmapInfo.operationalLayers.length; b++) {
dojo.io.script.get({
url: webmapInfo.operationalLayers[b].url + "?f=pjson",
callbackParamName: "callback",
load: function (data) {
count++;
for (var c = 0; c < webmapInfo.operationalLayers.length; c++) {
if (this.url == webmapInfo.operationalLayers[c].url + "?f=pjson") {
break;
}
}
if (data.geometryType == "esriGeometryPolygon") {
if (webmapInfo.operationalLayers[c].popupInfo) {
if (!electedOfficialsTabData[webmapInfo.operationalLayers[c].id]) {
dataLayer = [];
for (var d = 0; d < webmapInfo.operationalLayers[c].popupInfo.fieldInfos.length; d++) {
if (webmapInfo.operationalLayers[c].popupInfo.fieldInfos[d].visible) {
dataLayer.push({ "DisplayText": webmapInfo.operationalLayers[c].popupInfo.fieldInfos[d].label + ":", "FieldName": "${" + webmapInfo.operationalLayers[c].popupInfo.fieldInfos[d].fieldName + "}" });
}
}
electedOfficialsTabData[webmapInfo.operationalLayers[c].id] = [];
electedOfficialsTabData[webmapInfo.operationalLayers[c].id] = ({ "ServiceUrl": webmapInfo.operationalLayers[c].url, "HeaderColor": "#393939", "Title": webmapInfo.operationalLayers[c].title.split("- ")[1], "Data": dataLayer });
}
}
else {
precinctLayer.ServiceUrl = webmapInfo.operationalLayers[c].url;
}
}
else {
if (!isMobileDevice) {
pollLayer.ServiceUrl = webmapInfo.operationalLayers[c].url;
if (webmapInfo.operationalLayers[c].popupInfo.title) {
infoTitle = webmapInfo.operationalLayers[c].popupInfo.title.split("{")[0];
infoWindowHeader = "$" + webmapInfo.operationalLayers[c].popupInfo.title.split(": ")[1];
}
if (webmapInfo.operationalLayers[c].popupInfo.fieldInfos.length > 0) {
for (var r = 0; r < webmapInfo.operationalLayers[c].popupInfo.fieldInfos.length; r++) {
if (webmapInfo.operationalLayers[c].popupInfo.fieldInfos[r].visible) {
infoWindowContent = "${" + webmapInfo.operationalLayers[c].popupInfo.fieldInfos[r].fieldName + "}";
break;
}
}
}
for (var e = 0; e < webmapInfo.operationalLayers[c].popupInfo.fieldInfos.length; e++) {
if (webmapInfo.operationalLayers[c].popupInfo.fieldInfos[e].visible) {
infoPopupFieldsCollection.push({ "DisplayText": webmapInfo.operationalLayers[c].popupInfo.fieldInfos[e].label + ":", "FieldName": "${" + webmapInfo.operationalLayers[c].popupInfo.fieldInfos[e].fieldName + "}" });
}
}
}
else {
pollMobileLayer.ServiceUrl = webmapInfo.operationalLayers[c].url;
if (webmapInfo.operationalLayers[c].popupInfo.title) {
infoTitle = webmapInfo.operationalLayers[c].popupInfo.title.split("{")[0];
infoWindowHeader = "$" + webmapInfo.operationalLayers[c].popupInfo.title.split(": ")[1];
}
if (webmapInfo.operationalLayers[c].popupInfo.fieldInfos.length > 0) {
for (var r = 0; r < webmapInfo.operationalLayers[c].popupInfo.fieldInfos.length; r++) {
if (webmapInfo.operationalLayers[c].popupInfo.fieldInfos[r].visible) {
infoWindowContent = "${" + webmapInfo.operationalLayers[c].popupInfo.fieldInfos[r].fieldName + "}";
break;
}
}
}
for (var e = 0; e < webmapInfo.operationalLayers[c].popupInfo.fieldInfos.length; e++) {
if (webmapInfo.operationalLayers[c].popupInfo.fieldInfos[e].visible) {
infoPopupFieldsCollection.push({ "DisplayText": webmapInfo.operationalLayers[c].popupInfo.fieldInfos[e].label + ":", "FieldName": "${" + webmapInfo.operationalLayers[c].popupInfo.fieldInfos[e].fieldName + "}" });
}
}
}
}
if (count == webmapInfo.operationalLayers.length) {
MapInitFunction();
}
},
error: function (error) {
alert(error.message);
}
});
}
});
}
Initialize(responseObject);
}
//function calls at the intialize state
function Initialize(responseObject) {
var infoWindow = new mobile.InfoWindow({
domNode: dojo.create("div", null, dojo.byId("map"))
});
if (isMobileDevice) {
dojo.byId('divInfoContainer').style.display = "none";
dojo.replaceClass("divAddressHolder", "hideContainer", "hideContainerHeight");
dojo.byId('divAddressContainer').style.display = "none";
dojo.removeClass(dojo.byId('divInfoContainer'), "opacityHideAnimation");
dojo.removeClass(dojo.byId('divAddressContainer'), "hideContainerHeight");
dojo.byId('divSplashScreenContent').style.width = "95%";
dojo.byId('divSplashScreenContent').style.height = "95%";
dojo.byId('imgDirections').src = "images/imgDirections.png";
dojo.byId('imgDirections').title = "Directions";
dojo.byId("divLogo").style.display = "none";
dojo.byId("lblAppName").style.display = "none";
dojo.byId("lblAppName").style.width = "80%";
}
else {
var imgBasemap = document.createElement('img');
imgBasemap.src = "images/imgBaseMap.png";
imgBasemap.className = "imgOptions";
imgBasemap.title = "Switch Basemap";
imgBasemap.id = "imgBaseMap";
imgBasemap.style.cursor = "pointer";
imgBasemap.onclick = function () {
ShowBaseMaps();
}
dojo.byId("tdBaseMap").appendChild(imgBasemap);
dojo.byId("tdBaseMap").className = "tdHeader";
dojo.byId('divSplashScreenContent').style.width = "350px";
dojo.byId('divSplashScreenContent').style.height = "290px";
dojo.byId('divAddressContainer').style.display = "block";
dojo.byId('imgDirections').src = "images/Details.png";
dojo.byId('imgDirections').title = "Details";
dojo.byId('imgDirections').style.display = "none";
dojo.byId("divLogo").style.display = "block";
}
dojo.byId('imgApp').src = responseObject.ApplicationIcon;
dojo.byId("lblAppName").innerHTML = responseObject.ApplicationName;
dojo.byId('divSplashContent').innerHTML = responseObject.SplashScreenMessage;
dojo.xhrGet(
{
url: "ErrorMessages.xml",
handleAs: "xml",
preventCache: true,
load: function (xmlResponse) {
messages = xmlResponse;
}
});
map = new esri.Map("map", {
slider: true,
infoWindow: infoWindow
});
ShowProgressIndicator();
locatorFields = responseObject.LocatorFields.split(",");
geometryService = new esri.tasks.GeometryService(responseObject.GeometryService);
locatorURL = responseObject.LocatorURL;
pollLayer = responseObject.PollLayer;
pollMobileLayer = responseObject.PollMobileLayer;
precinctLayer = responseObject.PrecinctLayer;
precinctOfficeLayer = responseObject.PrecinctOfficeLayer;
baseMapLayers = responseObject.BaseMapLayers;
electedOfficialsTabData = responseObject.ElectedOfficialsTabData;
infoPopupFieldsCollection = responseObject.InfoPopupFieldsCollection;
pollingPlaceData = responseObject.PollingPlaceTabData;
infoBoxWidth = responseObject.InfoBoxWidth;
mapSharingOptions = responseObject.MapSharingOptions;
locatorMarkupSymbolPath = responseObject.LocatorMarkupSymbolPath;
infoPopupWidth = responseObject.InfoPopupWidth;
infoPopupHeight = responseObject.InfoPopupHeight;
infoWindowContent = responseObject.InfoWindowContent;
infoWindowHeader = responseObject.InfoWindowHeader;
showCommentsTab = responseObject.ShowCommentsTab;
locatorRippleSize = responseObject.LocatorRippleSize;
formatDateAs = responseObject.FormatDateAs;
generateRouteToNonDesignatedPollingPlace = responseObject.GenerateRouteToNonDesignatedPollingPlace;
pollingCommentsLayer = responseObject.PollingCommentsLayer;
showNullValueAs = responseObject.ShowNullValueAs;
referenceOverlayLayer = responseObject.ReferenceOverlayLayer;
if (!showCommentsTab) {
dojo.byId('tdComments').style.display = "none";
}
CreateBaseMapComponent();
dojo.connect(map, "onLoad", function () {
var zoomExtent;
var extent = GetQuerystring('extent');
if (extent != "") {
zoomExtent = extent.split(',');
}
else {
zoomExtent = responseObject.DefaultExtent.split(",");
}
var startExtent = new esri.geometry.Extent(parseFloat(zoomExtent[0]), parseFloat(zoomExtent[1]), parseFloat(zoomExtent[2]), parseFloat(zoomExtent[3]), map.spatialReference);
map.setExtent(startExtent);
if (!useWebmap) {
MapInitFunction();
}
});
dojo.connect(map, "onExtentChange", function (evt) {
SetMapTipPosition();
if (dojo.coords("divAppContainer").h > 0) {
ShareLink(false);
}
});
dojo.connect(map, "onClick", FindLocation);
dojo.byId("txtAddress").setAttribute("defaultAddress", responseObject.LocatorDefaultAddress);
dojo.byId('txtAddress').value = responseObject.LocatorDefaultAddress;
routeTask = new esri.tasks.RouteTask(responseObject.RouteServiceURL);
routeSymbol = new esri.symbol.SimpleLineSymbol().setColor(responseObject.RouteColor).setWidth(responseObject.RouteWidth);
dojo.connect(routeTask, "onSolveComplete", function (routeResponse) {
ShowRoute(routeResponse);
});
dojo.connect(dojo.byId('imgHelp'), "onclick", function () {
window.open(responseObject.HelpURL);
});
}
//function called when map is initialized
function MapInitFunction() {
if (dojo.query('.logo-med', dojo.byId('map')).length > 0) {
dojo.query('.logo-med', dojo.byId('map'))[0].id = "esriLogo";
}
else if (dojo.query('.logo-sm', dojo.byId('map')).length > 0) {
dojo.query('.logo-sm', dojo.byId('map'))[0].id = "esriLogo";
}
dojo.addClass("esriLogo", "esriLogo");
dojo.byId('divSplashScreenContainer').style.display = "block";
dojo.replaceClass("divSplashScreenContent", "showContainer", "hideContainer");
SetHeightSplashScreen();
if (!isMobileDevice) {
CreateDataLayOut();
CreateOfficeDataLayOut();
}
else {
SetHeightAddressResults();
SetHeightComments();
SetHeightViewDetails();
SetHeightViewDirections();
SetHeightCmtControls();
}
dojo.byId("esriLogo").style.bottom = "10px";
var precinctLayer1 = new esri.layers.FeatureLayer(precinctLayer.ServiceUrl, {
mode: esri.layers.FeatureLayer.MODE_SELECTION,
displayOnPan: isBrowser ? false : true,
outFields: ["*"]
});
precinctLayer1.id = precinctLayerId;
if (precinctLayer.UseColor) {
var precinctSymbol = new esri.symbol.SimpleFillSymbol();
var precinctfillColor = new dojo.Color(precinctLayer.Color);
precinctfillColor.a = precinctLayer.Alpha;
precinctSymbol.setColor(precinctfillColor);
var precinctRenderer = new esri.renderer.SimpleRenderer(precinctSymbol);
precinctLayer1.setRenderer(precinctRenderer);
}
var officeLayer = new esri.layers.FeatureLayer(precinctOfficeLayer, {
mode: esri.layers.FeatureLayer.MODE_SELECTION,
outFields: ["*"]
});
officeLayer.id = 'precinctOfficeLayerId';
map.addLayer(precinctLayer1);
map.addLayer(officeLayer);
var gLayer = new esri.layers.GraphicsLayer({ displayOnPan: isBrowser ? false : true });
gLayer.id = tempGraphicsLayerId;
map.addLayer(gLayer);
var pollLayer1 = new esri.layers.FeatureLayer(isBrowser ? pollLayer.ServiceUrl : pollMobileLayer.ServiceUrl, {
mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
displayOnPan: isBrowser ? true : true,
outFields: ["*"]
});
pollLayer1.id = pollLayerId;
if (isBrowser) {
if (pollLayer.UseImage) {
var pictureSymbol = new esri.symbol.PictureMarkerSymbol(pollLayer.Image, 25, 25);
var pollingPlaceRenderer = new esri.renderer.SimpleRenderer(pictureSymbol);
pollLayer1.setRenderer(pollingPlaceRenderer);
}
}
else {
if (pollMobileLayer.UseImage) {
var pictureSymbol = new esri.symbol.PictureMarkerSymbol(pollMobileLayer.Image, 25, 25);
var pollingPlaceRenderer = new esri.renderer.SimpleRenderer(pictureSymbol);
pollLayer1.setRenderer(pollingPlaceRenderer);
}
}
var gLayer = new esri.layers.GraphicsLayer({ displayOnPan: isBrowser ? false : true });
gLayer.id = highlightPollLayerId;
map.addLayer(gLayer);
var gLayer = new esri.layers.GraphicsLayer({ displayOnPan: isBrowser ? false : true });
gLayer.id = routeGraphicsLayerId;
map.addLayer(gLayer);
dojo.connect(pollLayer1, "onUpdateEnd", function (err) {
HideProgressIndicator();
if (err) {
alert(err.message);
return;
}
dojo.disconnect(this);
});
dojo.connect(pollLayer1, "onClick", function (evtArgs) {
ShowServiceInfoDetails(evtArgs.graphic.geometry, evtArgs.graphic.attributes);
evtArgs = (evtArgs) ? evtArgs : event;
evtArgs.cancelBubble = true;
if (evtArgs.stopPropagation) {
evtArgs.stopPropagation();
}
if (!isMobileDevice) {
ShowPollingPlaceDetails();
}
});
map.addLayer(pollLayer1);
var pollingCommentsLayer1 = new esri.layers.FeatureLayer(pollingCommentsLayer, {
mode: esri.layers.FeatureLayer.MODE_SELECTION,
outFields: ["*"],
id: pollingCommentsLayerId,
displayOnPan: isBrowser ? false : true
});
map.addLayer(pollingCommentsLayer1);
dojo.byId("txtComments").onfocus = function () {
CreateScrollbar(dojo.byId("divCmtIpContainer"), dojo.byId("divCmtIpContent"));
};
if (referenceOverlayLayer.DisplayOnLoad) {
var overlaymap = new esri.layers.ArcGISTiledMapServiceLayer(referenceOverlayLayer.ServiceUrl);
map.addLayer(overlaymap);
}
if (!isMobileDevice) {
window.onresize = function () {
resizeHandler();
setTimeout(function () {
dojo.disconnect(handlePoll);
dojo.disconnect(handleElected);
CreateHorizontalScrollbar(dojo.byId("divOfficeData"), dojo.byId("carouselOfficescroll"));
CreateHorizontalScrollbar(dojo.byId("divPollingData"), dojo.byId("carouselscroll"));
}, 300);
ResetSlideControls();
}
}
}
//function for displaying polling details at bottom panel
function ShowPollingPlaceDetails() {
if (mapPoint) {
if (!noRoute) {
dojo.byId('divPollingPlaceDetailsHeader').className = "divSelectedHeader";
dojo.byId('divElectedOfficialsHeader').className = "divDefaultHeader";
dojo.byId('divPollingPlaceDetailsHeader').style.cursor = "default";
dojo.byId('divElectedOfficialsHeader').style.cursor = "pointer";
dojo.byId("imgToggleResults").style.cursor = "pointer";
dojo.byId('divGradient').style.display = 'none';
dojo.byId('divPollingDetails').style.display = "block";
ResetSlideControls();
if (dojo.byId("divSegmentContent")) {
CreateDirectionsScrollBar();
}
for (var index in pollingPlaceData) {
if (pollingPlaceData[index].ShowDirection) {
continue;
}
CreatePollingDetailsScrollBar("div" + index + "container", "div" + index + "content");
}
dojo.disconnect(handlePoll);
dojo.disconnect(handleElected);
CreateHorizontalScrollbar(dojo.byId("divPollingData"), dojo.byId("carouselscroll"));
// for (var index in pollingPlaceData) {
// dojo.byId("div" + index + "container").className = "style";
// }
}
}
else {
ClearSelection();
}
}
//function for clearing the data at ottom panel
function ClearSelection() {
dojo.byId('divPollingPlaceDetailsHeader').className = "divDefaultHeader";
dojo.byId('divElectedOfficialsHeader').className = "divDefaultHeader";
dojo.byId('divPollingPlaceDetailsHeader').style.cursor = "default";
dojo.byId('divElectedOfficialsHeader').style.cursor = "default";
dojo.byId("imgToggleResults").style.cursor = "default";
dojo.byId('imgToggleResults').title = "";
}
//function for displaying the data for elected officials at bottom panel
function ElectedOfficials() {
if (mapPoint) {
if (!noRoute) {
dojo.byId('divElectedOfficialsHeader').className = "divSelectedHeader";
dojo.byId('divPollingPlaceDetailsHeader').className = "divDefaultHeader";
dojo.byId('divPollingPlaceDetailsHeader').style.cursor = "pointer";
dojo.byId('divElectedOfficialsHeader').style.cursor = "default";
dojo.byId("imgToggleResults").style.cursor = "pointer";
dojo.byId('divPollingDetails').style.display = "none";
dojo.byId('divGradient').style.display = 'block';
ResetSlideControls();
dojo.disconnect(handlePoll);
dojo.disconnect(handleElected);
CreateHorizontalScrollbar(dojo.byId("divOfficeData"), dojo.byId("carouselOfficescroll"));
}
}
else {
ClearSelection();
}
}
//function for creating a layout for polling data at bottom panel
function CreateDataLayOut() {
RemoveChildren(dojo.byId('divPollingPlaceDataContainer'));
var i = 0;
var tableHeader = document.createElement("table");
var tbodyHeader = document.createElement("tbody");
tableHeader.appendChild(tbodyHeader);
var tr = document.createElement("tr");
tbodyHeader.appendChild(tr);
for (var index in pollingPlaceData) {
var td = document.createElement("td");
var templateNode = dojo.byId('divTemplate');
var dataContainerNode = templateNode.cloneNode(true);
dataContainerNode.style.display = "block";
dataContainerNode.id = "div" + index;
dataContainerNode.style.width = infoBoxWidth + "px";
var divDataHeader = dojo.query(".divDetailsHeader", dataContainerNode)[0];
var spanHeader = dojo.query(".spanHeader", divDataHeader)[0];
var value;
if (pollingPlaceData[index].Title.length > 0) {
if (isBrowser) {
value = pollingPlaceData[index].Title.trim();
value = value.trimString(Math.round(infoBoxWidth / 7));
if (value.length > Math.round(infoBoxWidth / 7)) {
spanHeader.title = pollingPlaceData[index].Title;
}
}
else if (isTablet) {
value = pollingPlaceData[index].Title.trim();
value = value.trimString(Math.round(infoBoxWidth / 9));
}
}
spanHeader.innerHTML = value;
divDataHeader.style.backgroundColor = pollingPlaceData[index].HeaderColor;
divDataHeader.style.borderBottom = "gray 1px solid";
var divDataContent = dojo.query(".divContentStyle", dataContainerNode);
divDataContent[0].id = "div" + index + "container";
divDataContent[1].id = "div" + index + "content";
td.appendChild(dataContainerNode);
tr.appendChild(td);
}
dojo.byId('divPollingPlaceDataContainer').appendChild(tableHeader);
}
//function for creating a layout for elected data at bottom panel
function CreateOfficeDataLayOut() {
RemoveChildren(dojo.byId('divOfficeDataContainer'));
var i = 0;
var tableHeader = document.createElement("table");
var tbodyHeader = document.createElement("tbody");
tableHeader.appendChild(tbodyHeader);
var tr = document.createElement("tr");
tbodyHeader.appendChild(tr);
for (var index in electedOfficialsTabData) {
var td = document.createElement("td");
var templateNode = dojo.byId('divTemplate');
var dataContainerNode = templateNode.cloneNode(true);
dataContainerNode.style.display = "block";
dataContainerNode.id = "div" + index;
dataContainerNode.style.width = infoBoxWidth + "px";
var divDataHeader = dojo.query(".divDetailsHeader", dataContainerNode)[0];
var spanHeader = dojo.query(".spanHeader", divDataHeader)[0];
var value;
if (electedOfficialsTabData[index].Title.length > 0) {
if (isBrowser) {
value = electedOfficialsTabData[index].Title.trim();
value = value.trimString(Math.round(infoBoxWidth / 7));
if (value.length > Math.round(infoBoxWidth / 7)) {
spanHeader.title = electedOfficialsTabData[index].Title;
}
}
else if (isTablet) {
value = electedOfficialsTabData[index].Title.trim();
value = value.trimString(Math.round(infoBoxWidth / 9));
}
}
spanHeader.innerHTML = value;
divDataHeader.style.backgroundColor = electedOfficialsTabData[index].HeaderColor;
divDataHeader.style.borderBottom = "gray 1px solid";
var divDataContent = dojo.query(".divContentStyle", dataContainerNode);
divDataContent[0].id = "div" + index + "container";
divDataContent[1].id = "div" + index + "content";
td.appendChild(dataContainerNode);
tr.appendChild(td);
}
dojo.byId('divOfficeDataContainer').appendChild(tableHeader);
}
dojo.addOnLoad(init);
</script>
</head>
<body onorientationchange="orientationChanged();">
<div id="divMainContainer" style="width: 100%; height: 100%;" dojotype="dojox.mobile.View"
selected="true">
<div id="map" style="width: 100%; height: 100%;">
</div>
</div>
<div id="divSplashScreenContainer" class="divSplashScreenContainer" style="display: none;">
<table style="width: 100%; height: 100%;">
<tr align="center" valign="middle">
<td>
<div id="divSplashScreenContent" class="hideContainer divSplashScreenContent">
<table style="width: 100%;">
<tr>
<td>
<div id="divSplashContainer" class="divSplashContainer" style="margin-top: 10px;">
<div id="divSplashContent" class="divSplashContent">
</div>
</div>
</td>
</tr>
<tr>
<td align="center">
<div style="width: 75px; margin-top: 10px" class="customButton" onclick="HideSplashScreenMessage();">
<div class="customButtonInner">
<table style="width: 100%; height: 100%;">
<tr>
<td align="center" valign="middle">
OK
</td>
</tr>
</table>
</div>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
<div id="divLogo" class="divLogo">
<table style="width: 100%; height: 100%;">
<tr>
<td>
<img id="imgApp" class="imgApp" />
</td>
</tr>
</table>
</div>
<div class="divApplicationHeader" align="right">
<table cellpadding="0" cellspacing="0" class="tableHeader">
<tr>
<td id="lblAppName" class="lblAppName" align="left">
</td>
<td align="right">
<table>
<tr>
<td align="center" id="Td1" class="tdHeader">
<img alt="Settings" src="images/locate.png" class="imgOptions" title="Search" onclick="ShowLocateContainer();"
style="cursor: pointer" />
</td>
<td align="center" id="tdGeolocation" class="tdHeader">
<img alt="Settings" src="images/imgGeolocation.png" class="imgOptions" title="Locate"
onclick="ShowMyLocation();" style="cursor: pointer" />
</td>
<td align="center" id="tdBaseMap">
</td>
<td align="center" class="tdHeader">
<img src="images/imgSocialMedia.png" class="imgOptions" title="Share" onclick="ShareLink(true);"
style="cursor: pointer" />
</td>
<td align="center" id="help" class="tdHeader">
<img src="images/help.png" title="Help" id="imgHelp" class="imgOptions" style="cursor: pointer" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="divAddressContainer" align="center" class="divAddressContainer hideContainerHeight"
style="display: none">
<table style="width: 100%; height: 100%;">
<tr align="center" valign="middle">
<td>
<div id="divAddressHolder" class="hideContainerHeight divAddressHolder">
<div id="divAddressContent" class="divAddressContent">
<table class="tblHeader" style="width: 100%;">
<tr style="height: 30px;" align="center" valign="top">
<td class="tdHeader" align="left" valign="middle" style="padding-left: 8px;">
Search Address
</td>
<td style="width: 10%;" align="right">
<img src="images/close.png" class="imgOptions" title="Close" style="cursor: pointer;
padding: 0px" onclick="HideAddressContainer();" />
</td>
</tr>
</table>
<div id="divAddressResultContainer" style="margin: 5px;">
<table style="color: #fff; width: 100%;">
<tr>
<td>
<div id="divAddressPlaceHolder" class="divAddressPlaceHolder" align="left">
<input type="text" id="txtAddress" class="txtAddress" onfocus="if(this.setSelectionRange)this.setSelectionRange(this.value.length, this.value.length);" />
<img src="images/locate.png" id="imgLocate" class="imgLocate" style="cursor: pointer"
title="Locate" onclick="LocateAddress();" />
</div>
<div id="divAddressList" class="divAddressList">
<div id="divAddressScrollContainer" class="divAddressScrollContainer" align="left">
<div id="divAddressScrollContent" class="divAddressScrollContent">
<table id="tblAddressResults" cellpadding="0" cellspacing="2" style="width: 100%;">
</table>
</div>
</div>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</td>
</tr>
</table>
</div>
<div id="divLayerContainer" class="divLayerContainer hideContainerHeight">
<div id="divLayerHolder" class="divLayerHolder">
<div id="divLayerContentHolder" class="divLayerContentHolder">
<div id="layerList">
</div>
</div>
</div>
</div>
<div id="divAppContainer" class="divAppContainer hideContainerHeight">
<div id="divAppHolder" class="divAppHolder">
<div id="divAppContent">
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<table cellpadding="2" cellspacing="2">
<tr>
<td align="center" colspan="3" style="color: white;">
Share this map
</td>
</tr>
<tr>
<td style="width: 30px;" align="center" id="tdFacebook">
<img title="Facebook" class="imgShare" id="imgFacebook" src="images/img_facebook.png"
onclick="Share('facebook')" />
</td>
<td style="width: 30px;" align="center" id="tdTwitter">
<img title="Twitter" class="imgShare" id="imgTwitter" src="images/img_twitter.png"
onclick="Share('twitter')" />
</td>
<td style="width: 30px;" align="center" id="tdMail">
<img title="Email" class="imgShare" id="imgMail" src="images/img_email.png" onclick="Share('mail')" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="showHide" class="showHide" style="bottom: 0px">
<table cellpadding="0" cellspacing="0" style="margin-left: 45px;">
<tr>
<td>
<table cellpadding="0" cellspacing="0" style="height: 100%;">
<tr>
<td>
<div id="divPollingPlaceDetailsHeader" align="center" class="divDefaultHeader" onclick="ShowPollingPlaceDetails();"
style="display: none;">
<table style="height: 100%; width: 160px;">
<tr>
<td>
Polling Place
</td>
</tr>
</table>
</div>
</td>
<td style="width: 5px;">
</td>
<td>
<div id="divElectedOfficialsHeader" class="divDefaultHeader" onclick="ElectedOfficials();"
style="display: none;">
<table style="height: 100%; width: 160px;">
<tr>
<td>
Elected Officials
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
<td style="width: 5px;">
</td>
<td align="right">
<div id="divImageBackground" class="divShowHeader" style="display: none;">
<div id="divImage">
<table style="width: 40px; height: 100%">
<tr>
<td align="center">
<img id="imgToggleResults" state="minimized" class="imgShare" src="images/up.png"
style="cursor: pointer;" onclick="ShowHideResult(this);" />
</td>
</tr>
</table>
</div>
</div>
</td>
</tr>
</table>
</div>
<div id="divGradient" class="divGradient hideBottomContainerHeight">
<div class="transparentBackground" style="height: 200px">
<table style="width: 100%; height: 100%;">
<tr>
<td align="left" style="width: 37px;">
<div id="OfficeLeftArrow" style="z-index: 1000; display: none;">
<img src="images/arrLeft.png" style="cursor: pointer; vertical-align: middle;" onclick="SlideOfficeLeft();"
class="imgShare" />
</div>
</td>
<td>
<div id="divOfficeData" class="divOfficeData">
<div id="carouselOfficescroll" class="carouselOfficescroll">
<div id="divOfficeDataContainer" style="padding-top: 5px;">
</div>
</div>
</div>
</td>
<td align="right" style="width: 37px;">
<div id="OfficeRightArrow" style="z-index: 1000; display: block">
<img src="images/arrRight.png" style="cursor: pointer; vertical-align: middle;" onclick="SlideOfficeRight();"
class="imgShare" />
</div>
</td>
</tr>
</table>
</div>
</div>
<div id="divPollingDetails" class="divPollingDetails hideBottomContainerHeight">
<div class="transparentBackground" style="height: 200px">
<table style="width: 100%; height: 100%;">
<tr>
<td align="left" style="width: 37px;">
<div id="PollingLeftArrow" style="z-index: 1000; display: none;">
<img src="images/arrLeft.png" style="cursor: pointer; vertical-align: middle;" onclick="SlideLeft();"
class="imgShare" />
</div>
</td>
<td>
<div id="divPollingData" class="divPollingData">
<div id="carouselscroll" class="carouselscroll">
<div id="divPollingPlaceDataContainer" style="padding-top: 5px;">
</div>
</div>
</div>
</td>
<td align="right" style="width: 37px;">
<div id="PollingRightArrow" style="z-index: 1000; display: block">
<img src="images/arrRight.png" style="cursor: pointer; vertical-align: middle;" onclick="SlideRight();"
class="imgShare" />
</div>
</td>
</tr>
</table>
</div>
</div>
<div id='divTemplate' class='divDetails'>
<div id="divDetailsHeader" class='divDetailsHeader' style="width: 100%; position: relative;">
<table style="height: 100%; width: 100%">
<tr>
<td>
<span class="spanHeader"></span>
</td>
</tr>
</table>
</div>
<div class='divContentStyle'>
<div class='divContentStyle'>
</div>
</div>
</div>
<div id="divInfoContainer" align="center" class="divInfoContainer opacityHideAnimation">
<table style="width: 100%; height: 100%;">
<tr align="center" valign="middle">
<td>
<div align="left" id="divInfoContent" class="hideContainer divInfoContent">
<table id="tblHeader" class="infotblHeader" style="width: 100%; padding: 1px" cellpadding="0"