PageRenderTime 29ms CodeModel.GetById 16ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/webportal/src/main/webapp/index.zul

http://alageospatialportal.googlecode.com/
Unknown | 660 lines | 586 code | 74 blank | 0 comment | 0 complexity | 7a08ddfd36403e040990f99a45f77833 MD5 | raw file
  1<?variable-resolver class="org.zkoss.spring.DelegatingVariableResolver"?>
  2<?script type="text/javascript" src="index.js.dsp"?>
  3
  4<?component name="leftMenuSearch" macro-uri="/WEB-INF/zul/leftMenuSearch.zul"?>
  5<?component name="footer" macro-uri="/WEB-INF/zul/footer.zul"?>
  6<?component name="contextualMenu" macro-uri="/WEB-INF/zul/ContextualMenu.zul"?>
  7
  8<?page id="MapZul" title="${portalNaming.portalName}" cacheable="false"
  9language="xul/html" zscriptLanguage="Java" contentType="text/html;charset=UTF-8"?>
 10<?link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico"?>
 11<?meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" ?>
 12
 13<zk xmlns="http://www.zkoss.org/2005/zul" xmlns:h="http://www.w3.org/1999/xhtml"
 14    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 15    xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd"
 16    xmlns:w="http://www.zkoss.org/2005/zk/client" xmlns:n="http://www.zkoss.org/2005/zk/native">
 17
 18    <!--<style src="css/test.ala.buttons.css" media="screen" />-->
 19    <style src="css/ala-skin.css" media="screen" />
 20    <style src="css/zkcomponents.css" media="screen" />
 21    <style src="css/zkprint.css" media="print" />
 22
 23    <style src="css/sf.css" />
 24  
 25    <script defer="false" type="text/javascript">
 26        var mapLayers = null;
 27        var currFeature = null;
 28        var map = null;
 29        var bLayer = null;
 30        var bLayer2 = null;
 31        var bLayer3 = null;
 32        var bLayer4 = null;
 33        var OpenLayers = null;
 34        var baseLayers = null;
 35        var currentbaselayertxt = "normal";
 36        var currentBaseLayer = null;
 37        var safeToLoadMapId = null;
 38        var registerLayer = null;
 39        var tmpvars;
 40        var disableDepthServlet= ${settings.disableDepthServlet};           
 41
 42        var wms100 = ${layerUtilities.wms100};
 43        var wms110 = ${layerUtilities.wms110};
 44        var wms111 = ${layerUtilities.wms111};
 45        var wms130 = ${layerUtilities.wms130};
 46        var ncwms = ${layerUtilities.ncwms};
 47        var thredds = ${layerUtilities.thredds};
 48        var georss = ${layerUtilities.georss};
 49        var kml = ${layerUtilities.kml};
 50        var unsupported =${layerUtilities.unsupported};
 51    </script>
 52
 53    <window id="mapPortalPage" width="100%" height="100%"
 54            use="au.org.emii.portal.composer.MapComposer" apply="au.org.emii.portal.composer.MapComposer"
 55            style="overflow:hidden;">
 56        <script defer="false" type="text/javascript">
 57            <!-- Set up the google analytics -->
 58            var _gaq = _gaq || [];
 59            _gaq.push(['_setAccount', 'UA-4355440-1']);
 60            _gaq.push(['_setDomainName', 'ala.org.au']);
 61            _gaq.push(['_trackPageview']);
 62
 63            (function() {
 64                var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 65                ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 66                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 67            })();
 68        </script>
 69        <script defer="true" type="text/JavaScript" src="scripts/index.js" />
 70
 71        <timer id="timerKeepAliveSession" repeats="true" delay="30000" onTimer="" />
 72
 73        <div id="menucontainer">
 74            <div width="400px" id="menudiv" sclass="menudiv" height="39px" style="position:absolute; top:58px">
 75                <n:div id="nav-sp">
 76                    <n:ul class="sf">
 77                        <n:li class='nav-home' style="display:none">
 78                            <n:a href="http://www.ala.org.au/" target="_blank">Home</n:a>
 79                        </n:li>
 80                        <n:li>
 81                            <n:a href="" n:onClick="doNothing()">Add to Map</n:a>
 82                            <n:ul>
 83                                <n:li>
 84                                    <n:a href="#" n:onClick="addSpeciesAction();">Species</n:a>
 85                                </n:li>
 86                                <n:li>
 87                                    <n:a href="#" n:onClick="addAreaAction();">Areas</n:a>
 88                                </n:li>
 89                                <n:li>
 90                                    <n:a href="#" n:onClick="addLayerAction();">Layers</n:a>
 91                                </n:li>
 92                                <n:li>
 93                                    <n:a href="#" n:onClick="addFacetAction();">Facet</n:a>
 94                                </n:li>
 95                            </n:ul>
 96                        </n:li>
 97                        <n:li>
 98                            <n:a href="" n:onClick="doNothing()">Tools</n:a>
 99                            <n:ul>
100                                <n:li>
101                                    <n:a href="#" n:onClick="runAreaReport();">Area Report</n:a>
102                                </n:li>
103                                <n:li>
104                                    <n:a href="#" n:onClick="runNearestLocality();">Nearest locality</n:a>
105                                </n:li>
106                                <n:li>
107                                    <n:a href="#" n:onClick="runScatterPlot();">Scatterplot</n:a>
108                                </n:li>
109                                <n:li>
110                                    <n:a href="#" n:onClick="runScatterPlotList();">Scatterplot List</n:a>
111                                </n:li>
112                                <n:li>
113                                    <n:a href="#" n:onClick="runTabulation();">Tabulate</n:a>
114                                </n:li>
115                                <n:li>
116                                    <n:a href="#" n:onClick="runSitesBySpecies();">Points to Grid</n:a>
117                                </n:li>
118                                <n:li>
119                                    <n:a href="#" n:onClick="runClassification();">Classify</n:a>
120                                </n:li>
121                                <n:li>
122                                    <n:a href="#" n:onClick="runPrediction();">Predict</n:a>
123                                </n:li>
124                                <n:li>
125                                    <n:a href="#" n:onClick="runGDM();">GDM</n:a>
126                                </n:li>
127                                <n:li>
128                                    <n:a href="#" n:onClick="runImportAnalysis();">Restore prior analysis</n:a>
129                                </n:li>
130                            </n:ul>
131                        </n:li>
132                        <n:li>
133                            <n:a href="" n:onClick="doNothing()">Import</n:a>
134                            <n:ul>
135                                <n:li>
136                                    <n:a href="#" n:onClick="runImportSpecies('points');">Points</n:a>
137                                </n:li>
138                                <n:li>
139                                    <n:a href="#" n:onClick="runImportSpecies('assemblage');">Species list</n:a>
140                                </n:li>
141                                <n:li>
142                                    <n:a href="#" n:onClick="runImportAreas();">Areas</n:a>
143                                </n:li>
144                                <n:li>
145                                    <n:a href="#" n:onClick="runImportAnalysis();">Restore prior analysis</n:a>
146                                </n:li>
147                            </n:ul>
148                        </n:li>
149                        <n:li>
150                            <n:a href="" n:onClick="doNothing()">Export</n:a>
151                            <n:ul>
152                                <n:li>
153                                    <n:a href="#" n:onClick='printHack();'>Map</n:a>
154                                </n:li>
155                                <n:li>
156                                    <n:a href="#" n:onClick="runSpeciesList();">Checklist</n:a>
157                                </n:li>
158                                <n:li>
159                                    <n:a href="#" n:onClick="runSamplingAction();">Point Sample</n:a>
160                                </n:li>
161                                <n:li>
162                                    <n:a href="#" n:onClick="runExport();">Areas</n:a>
163                                </n:li>
164                            </n:ul>
165                        </n:li>
166                        <n:li>
167                            <n:a href="" n:onClick="doNothing()">Help</n:a>
168                            <n:ul>
169                                <n:li>
170                                    <n:a href="#" n:onClick="loadHelp('getting-started');">Getting Started</n:a>
171                                </n:li>
172                                <n:li>
173                                    <n:a href="#" n:onClick="loadHelp('add-to-map');">Add To Map</n:a>
174                                </n:li>
175                                <n:li>
176                                    <n:a href="#" n:onClick="loadHelp('tools');">Tools</n:a>
177                                </n:li>
178                                <n:li>
179                                    <n:a href="#" n:onClick="loadHelp('import');">Import</n:a>
180                                </n:li>
181                                <n:li>
182                                    <n:a href="#" n:onClick="loadHelp('export');">Export</n:a>
183                                </n:li>
184                            </n:ul>
185                        </n:li>
186                    </n:ul>
187                </n:div>
188                <div onClick='menus.setOpen(false);menudiv.setStyle("position:absolute; top:0px");menudiv.setParent(menucontainerwest);' sclass="z-west-colps z-borderlayout-icon"
189                style="position: absolute; z-index: 201; left: 380px; top: 3px;" >
190                </div>
191            </div>
192        </div>
193
194        <borderlayout width="100%" height="100%">
195            <north id="header" height="58" visible="true" style="height: 58px">
196                <html id="headerhtml"><![CDATA[
197<header id="site-header">
198	<div class="inner">
199		<h1 title="Atlas of Living Australia"><a href="http://www.ala.org.au" title="Atlas of Living Australia home"><img src="img/test.ala.logo.png" width="315" height="33" alt="" /></a></h1>
200		<section id="nav-search">
201			<section id="header-search">
202				<form id="search-form" action="http://bie.ala.org.au/search" method="get" name="search-form"><label for="search">Search</label>
203				<input id="search" class="filled" title="Search" type="text" name="q" placeholder="Search the Atlas" />
204				<span class="search-button-wrapper"><button id="search-button" class="search-button" value="Search" type="submit"><img src="img/test.ala.button_search-grey.png" alt="Search" width="12" height="12" /></button></span></form>
205
206			</section>
207			<nav class="not_logged_in">
208				<ol>
209					<li><a href="http://www.ala.org.au" title="Atlas of Living Australia home">Home</a></li>
210                    <!-- <li><a href="http://www.ala.org.au/my-profile/" title="My profile">My profile</a></li> -->
211                    <li><a href="/actions/dashboard" title="Spatial Portal Dashboard">Dashboard</a></li>
212                    <li><a href="javascript:saveSession();" title="Save current session">Save session</a></li>
213					<li class="last"><a href="https://auth.ala.org.au/cas/login?service=http://spatial.ala.org.au/">Log in</a></li>
214				</ol>
215			</nav>
216			<nav class="logged_in">
217				<ol>
218					<li><a href="http://www.ala.org.au" title="Atlas of Living Australia home">Home</a></li>
219                    <!-- <li><a href="http://www.ala.org.au/my-profile/" title="My profile">My profile</a></li> -->
220                    <li><a href="/actions/dashboard" title="Spatial Portal Dashboard">Dashboard</a></li>
221                    <li><a href="javascript:saveSession();" title="Save current session">Save session</a></li>
222					<li class="last"><a href="https://auth.ala.org.au/cas/logout?service=http://spatial.ala.org.au/">Log out</a></li>
223				</ol>
224			</nav>
225		</section>
226
227	</div>
228</header>
229                ]]>
230                </html>
231            </north>
232            <west title=" " size="${settingsSupplementary.values.menu_default_width}"
233                   id="menus" collapsible="true"
234                   splittable="false" width="400px">
235                <div id="westChild" vflex="1">
236                    <div id="westMinimised" visible="false" class="westMinimised" width="${settingsSupplementary.values.menu_minimised_width}" >
237                        <div zclass="closebox" zindex="500" left="2px" top="2px">
238                            <toolbarbutton
239                            id="showLeftMenu"
240                            label=""
241                            image="img/buttonopen.png"
242                            hoverImage="img/buttonopen-over.png"
243                            visible="false"
244                            />
245                        </div>
246                    </div>
247                    <div id="menucontainerwest" />
248                    <div id="westContent" class="westContent" visible="true" height="100%">
249                        <borderlayout style="position:absolute;top:0px;left:0px">
250                            <north height="189px">
251                                <div>
252                                    <!-- space for top level menu -->
253                                    <div height="39px" />
254                                    <div id="activeLayersHolder" width="400px" style="overflow: auto;background:white" height="160px">
255                                        <listbox id="activeLayersList" width="100%" />
256                                    </div>
257                                    <div width="100%" height="1px" sclass="selectedLayerDiv" />
258                                </div>
259                            </north>
260                            <center vflex="false">
261                                <vlayout height="100%" style="overflow-y: auto" >
262                                    <div width="400px" style="margin-left:3px;">
263                                        <label id="lblSelectedLayer" value="No layers added" sclass="selectedLayer" />
264                                    </div>
265                                    <separator />
266                                    <div  id="layerControls"/>
267                                </vlayout>
268                            </center>
269                            <south height="110px;">
270                                <div sclass="contextualDivMenu" height="90px" width="390px" style="margin:0; padding:0px;">
271                                    <contextualMenu id="contextualMenu" style="margin:2px;" width="390px" />
272                                </div>
273                            </south>
274                        </borderlayout>
275                    </div>
276                    <leftMenuSearch id="leftMenuSearch" visible="false" />
277                </div>
278            </west>
279
280            <center id="center">
281                <div id="mapcontainer" width="100%" height="100%" >
282                    <div style="float:left" width="100%" height="100%" >
283                        <iframe id="mapIframe" width="100%" height="100%" name="mapFrame" src="./map2.html?" />
284                    </div>
285                </div>
286            </center>
287
288            <south id="south" visible="false">
289                <footer id="footer" />
290            </south>
291        </borderlayout>
292
293        <script defer="false" type="text/javascript"><![CDATA[
294                    var onIframeMapFullyLoaded = function() {
295            //update screen widths before map is loaded (hide header)
296            var h0 = window.location.href.split('?');
297            if(h0.length > 1){
298                var h1 = h0[1].split("&");
299                var i;
300                for(i=0;i<h1.length;i++){
301                    if(h1[i].substring(0,2) == "p="){
302                        h1[i] = h1[i].substring(2,h1[i].length);
303                        var h2 = h1[i].split(",");
304                        if(h2.length > 6) {
305                            //style adjustment
306                            document.getElementsByTagName("body")[0].style.margin = "0px";
307                            document.getElementsByTagName("html")[0].style.margin = "0px";
308
309                            //hide map buttons
310                            //var q = jq('$mapbuttons')[0];
311                            //q.style.display="none";
312
313                            //hide menu
314                            q = document.getElementById(zk.Widget.$(jq('$menudiv')[0]).uuid);
315                            q.style.display="none";
316
317                            //hide north
318                            q = document.getElementById(zk.Widget.$(jq('$header')[0]).uuid + "-real");
319                            q.style.height="0px";
320
321                            //set west
322                            var m = document.getElementById(zk.Widget.$(jq('$menus')[0]).uuid + "-real");
323
324                            var w = m.style.width;
325                            var diff = (w.substring(0,w.length-2))*1 - h2[6]*1 + 10;
326                            m.style.width = h2[6] + "px";
327
328                            var p = document.getElementById(zk.Widget.$(jq('$menus')[0]).uuid + "-split");
329                            p.style.width = h2[6] + "px";
330                            p.style.left = h2[6] + "px";
331                            p.style.display = "none";
332
333                            var n = document.getElementById(zk.Widget.$(jq('$center')[0]).uuid + "-real");
334                            w = n.style.width;
335                            var l = n.style.left;
336                            l = (l.substring(0,l.length-2)*1);
337                            var val = diff + w.substring(0,w.length-2)*1;
338                            n.style.width = val + "px";
339
340                            n.style.top = "0px";
341                            w = n.style.height;
342                            val2 = w.substring(0,w.length-2)*1;
343                            n.style.height = val2 + "px";
344
345                            w = n.style.left;
346                            val = w.substring(0,w.length-2)*1 - diff;
347                            n.style.left =  val + "px";
348
349                            var n = document.getElementById(zk.Widget.$(jq('$center')[0]).uuid + "-cave");
350                            w = n.style.width;
351                            var val = diff + w.substring(0,w.length-2)*1;
352                            n.style.width = val + "px";
353                            n.style.left =  val + "px";
354                            n.style.top = "0px";
355                            n.style.height = val2 + "px";
356
357                            mapFrame.document.getElementById("zoomtolocation").style.display="none";
358                            mapFrame.document.getElementById("addPanoramio").style.display="none";
359                            if(mapFrame.document.getElementById("hoverTool") != null)
360                                mapFrame.document.getElementById("hoverTool").style.display="none";
361                            if(mapFrame.document.getElementById("nearestTool") != null)
362                                mapFrame.document.getElementById("nearestTool").style.display="none";
363                                if(mapFrame.document.getElementById("featureTool") != null)
364                                mapFrame.document.getElementById("featureTool").style.display="none";
365
366                            jQuery('.z-center')[0].style.border = "0px";
367                        }
368                    }
369                }
370            }
371
372            ${session.attributes.portalSession.onIframeMapFullyLoaded};
373
374            map = window.mapFrame.map;
375            mapFrame = window.mapFrame;
376
377            //update map extents
378            var printing = false;
379            var h0 = window.location.href.split('?');
380            if(h0.length > 1){
381                var h1 = h0[1].split("&");
382                var i;
383                for(i=0;i<h1.length;i++){
384                    if(h1[i].substring(0,2) == "p="){
385                        printing = true;
386                        h1[i] = h1[i].substring(2,h1[i].length);
387                        var h2 = h1[i].split(",");
388                        if(h2.length > 5){
389                            if(h2[2].substring(0,1) == 'n') {
390                                fixExtent4326(1*(h2[2].substring(1,h2[2].length)),1*h2[3],1*h2[4],1*h2[5]);
391                            } else {
392                                fixExtent(1*h2[2],1*h2[3],1*h2[4],1*h2[5]);
393                            }
394                            //map.zoomToExtent(new OpenLayers.Bounds(1*h2[2],1*h2[3],1*h2[4],1*h2[5]), true);
395
396                            while(map.controls.length > 0){
397                                map.controls[0].deactivate();
398                                map.removeControl(map.controls[0]);
399                            }
400
401                            window.frames["mapFrame"].document.getElementById('controlPanZoom').style.display = "none";
402                        }
403
404console.log(currentbaselayertxt);
405                        if(h2.length > 7 && currentbaselayertxt != h2[7]) {
406                        console.log(h2[7]);
407                            changeBaseLayer(h2[7]);
408                        }
409
410                        //draw grid
411                        if(h2.length > 8){
412                            if (h2[8] != '0' && h2[8] != '0.0') {
413                                var ctrl = new OpenLayers.Control.Graticule({
414                                    numPoints: 2,
415                                    labelled: true,
416                                    visible: true
417                                });
418                                ctrl.labelSymbolizer.fontColor = "white";
419                                if(h2.length > 9) {
420                                    ctrl.labelSymbolizer.fontSize = "15";
421                                    ctrl.labelSymbolizer.fontWeight = "bold";
422                                    ctrl.lineSymbolizer.strokeWidth = 2;
423
424                                    //resize scale text
425                                    mapFrame.document.getElementById("mapscale").style.fontSize = "15px"
426                                    mapFrame.document.getElementById("mapscale").style.fontWeight = "bold"
427
428                                } else {
429                                    ctrl.lineSymbolizer.strokeWidth = 1;
430                                }
431                                ctrl.lineSymbolizer.strokeColor = "white";
432                                ctrl.lineSymbolizer.strokeOpacity = 0.6;
433                                map.addControl(ctrl);
434                            }
435                        }
436
437                        //scale circles
438                        if(h2.length > 9){
439                            var scaleby = 1.0*(h2[9]);
440                            var vl = map.getLayersByClass("OpenLayers.Layer.Vector");
441                            for (var i = 0; i < vl.length; i++) {
442                                var f = vl[i].features;
443                                if(vl[i].style != undefined && vl[i].style.pointRadius != undefined) {
444                                    vl[i].style.pointRadius *= scaleby;
445                                }
446                                for(var j=0;j<f.length;j++){
447                                    if(f[j].geometry.toString().indexOf('POINT') == 0) {
448                                        if(f[j].style != undefined && f[j].style.pointRadius != undefined) {
449                                            f[j].style.pointRadius *= scaleby;
450                                        }
451                                    }
452                                }
453                                vl[i].redraw(true);
454                            }
455                        }
456
457                    //scale text?
458                    //...
459                    }
460                }
461            }
462
463            //use session state extents for printing
464            if (!printing) {
465                window.mapFrame.loadBaseMap();
466                if (!readCookie('ALA-Auth')) {
467                    $(".login-bubble").show().delay(8000).fadeOut(2000);
468                }  
469                window.mapFrame.document.getElementById("layervalues").style.display= "block";
470            }
471
472            map.signalLayerLoaded = function (layerName) {
473                zAu.send(new zk.Event(zk.Widget.$(jq('$mapPortalPage')[0]), 'onLayerLoaded', layerName));
474            }
475
476            map.baseLayer.redraw(); 
477        };
478
479        ]]>
480        </script>
481
482        <!--
483            Nasty hack to stop you getting SEVERE errors in the console. The
484            iframe in the holder gets moved into ErrorMessageWithDetail.zul when
485            raw text is required to be displayed and then gets moved back here
486            when the window is closed. Yuk
487        -->
488        <div id="rawMessageHackHolder" visible="false">
489            <iframe id="rawMessageIframeHack" width="100%" height="250px" />
490        </div>
491
492
493        <!--  flag indicating whether safe to load map (OL library loaded) -->
494        <!-- textbox visible="true" id="safeToLoadMap" value="false" / -->
495
496        <doublebox id="southReal" visible="false" />
497        <doublebox id="northReal" visible="false" />
498        <doublebox id="westReal" visible="false" />
499        <doublebox id="eastReal" visible="false" />
500
501        <textbox id="baseMap" visible="false" />
502        <textbox id="currentLayerExtent" visible="false" />
503        
504        <label id="sat_url" value="${settingsSupplementary.values.sat_url}" visible="false" />
505        <label id="geoserver_url" value="${settingsSupplementary.values.geoserver_url}" visible="false" />
506        <label id="layers_url" value="${settingsSupplementary.values.layers_url}" visible="false" />
507        <label id="biocache_service_url" value="${settingsSupplementary.values.biocache_service_url}" visible="false" />
508        <label id="biocache_webapp_url" value="${settingsSupplementary.values.biocache_webapp_url}" visible="false" />
509        <label id="bie_url" value="${settingsSupplementary.values.bie_url}" visible="false" />
510        <label id="print_server_url" value="${settingsSupplementary.values.print_server_url}" visible="false" />
511        <label id="webportal_url" value="${settingsSupplementary.values.webportal_url}" visible="false" />
512        <label id="help_url" value="${settingsSupplementary.values.help_url}" visible="false" />
513        
514
515          <!--script defer="false" type="text/javascript"><![CDATA[
516            
517       var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
518       document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js'<http://google-analytics.com/ga.js'> type='text/javascript'%3E%3C/script%3E"));
519        ]]></script>
520        <script defer="true" type="text/javascript"><![CDATA[
521       var pageTracker = _gat._getTracker("UA-4355440-1");
522       pageTracker._initData();
523       pageTracker._trackPageview();
524       ]]>
525        </script-->
526
527        <script><![CDATA[
528
529    function downloadSubmitButtonClick() {
530        //e.preventDefault();
531        if (validateForm()) {
532            var downloadUrl = $("input#downloadUrl").val().replace(/\\ /g, " ");
533            var fastDownloadUrl = $("input#fastDownloadUrl").val().replace(/\\ /g, " ");
534            var downloadType = $('input:radio[name=downloadType]:checked').val();
535            var reason = $("#reasonTypeId").val();
536            if(typeof reason == "undefined")
537                reason = "";
538
539            if (downloadType == "fast") {
540                downloadUrl = fastDownloadUrl + "&type=&email="+$("#email").val()+ "&reasonTypeId="+$("#reasonTypeId").val()+"&reason="+encodeURIComponent(reason)+"&file="+$("#filename").val();
541            } else {
542                downloadUrl = downloadUrl + "&type=&email="+$("#email").val()+ "&reasonTypeId="+$("#reasonTypeId").val()+"&reason="+encodeURIComponent(reason)+"&file="+$("#filename").val();
543            }
544
545            //console.log("downloadUrl = " + downloadUrl);
546            //alert("downloadUrl = " + downloadUrl);
547            window.location.href = downloadUrl;
548            zk.Widget.$(jq('$externalContentWindow')).detach();
549            return false;
550        }
551    }
552
553    function validateForm() {
554            var isValid = false;
555            var reasonId = $("#reasonTypeId option:selected").val();
556
557            if (reasonId) {
558                isValid = true;
559            } else {
560                $("#reasonTypeId").focus();
561                $("label[for='reasonTypeId']").css("color","red");
562                alert("Please select a \"download reason\" from the drop-down list");
563            }
564
565            return isValid;
566        }
567
568function readCookie(name) {
569    var nameEQ = name+"=";
570    var ca = document.cookie.split(";");
571    for (var i = 0; i < ca.length; i++) {
572        var c = ca[i];
573        while (c.charAt(0)==' ') c = c.substring(1, c.length);
574        if (c.indexOf(nameEQ)==0) return c.substring(nameEQ.length, c.length);
575    }
576    return null;
577}
578
579
580
581            //capture mouse events during window resize or move over an iframe
582            var overlayon = false;
583            function needOverlay() {
584                var zkresizing = parent.document.getElementById("zk_ddghost");
585                var zkmoving = parent.document.getElementById("zk_wndghost");
586
587                if(zkresizing != null && zkresizing.className.indexOf('drop') >= 0) {
588                    //do nothing with drag/drop
589                } else if(!overlayon && (zkmoving != null || zkresizing != null)) {
590                    //sit above zk (z-index:1800)
591                    parent.jq(parent.document.body).append("<div id='overlay_' style='position:absolute;width:100%;height:100%;top:0;left:0;z-index:1900;background-color:white;opacity:0.01;filter:alpha(opacity=1);'></div>");
592                    overlayon = true;
593                } else if(overlayon && zkmoving == null && zkresizing == null) {
594                    overlayon = false;
595                    parent.jq(parent.document.getElementById("overlay_")).remove();
596                }
597                setTimeout(needOverlay, 500);
598             }
599            setTimeout(needOverlay, 500);  //start
600              ]]>
601              
602        </script>
603        <window id="hovertool" border="normal" sizable="true"
604                 xmlns:n="http://www.zkoss.org/2005/zk/native" mode="overlapped" width="450px" height="120px" position="center,top">
605            <n:a class="fancybox-close" n:onClick="mapFrame.doSome('min');" style="display: inline" />
606            <caption label="Layer value hover tool" />
607            <div height="100%" style="background:white">
608                <n:div id="hoverOutput"></n:div>
609            </div>
610        </window>
611        <window id="nearesttool" border="normal" sizable="true"
612                 xmlns:n="http://www.zkoss.org/2005/zk/native" mode="overlapped" width="400px" height="120px" position="center,top">
613            <n:a class="fancybox-close" n:onClick="clearNearestMarkerLayer();mapFrame.toggleActiveNearest();" style="display: inline" />
614            <caption label="Nearest locality tool">
615                <n:a href='#' n:onClick="clearNearestMarkerLayer();">
616                    <n:span style="color:black;text-decoration:underline">remove all markers</n:span>
617                </n:a>
618            </caption>
619            <div height="100%" style="background:white">
620                <n:div id="nearestOutput"></n:div>
621            </div>
622        </window>
623        <window id="featuretool" border="normal" sizable="true"
624                 xmlns:n="http://www.zkoss.org/2005/zk/native" mode="overlapped" width="400px" height="120px" position="center,top">
625            <n:a class="fancybox-close" n:onClick="clearNearestMarkerLayer();mapFrame.toggleActiveFeatures();" style="display: inline" />
626            <caption label="Mapped features">
627                <n:a href='#' n:onClick="clearNearestMarkerLayer();mapFrame.toggleActiveFeatures();">
628                    <n:span style="color:black;text-decoration:underline">remove all markers</n:span>
629                </n:a>
630                <n:a href='#' n:onClick="downloadFeaturesCSV()">
631                    <n:span style="color:black;text-decoration:underline">download CSV</n:span>
632                </n:a>
633            </caption>
634            <div height="100%" style="background:white">
635                <n:div n:style="height:300px;overflow:auto;" id="featureOutput"></n:div>
636            </div>
637        </window>
638
639        <html><![CDATA[
640            <div class="login-bubble">
641                <div class="login-bubble-arrow"></div>
642                <div class="login-bubble-arrow-border"></div>
643                Log into the ALA Spatial Portal to keep track of your session.
644            </div>
645        ]]>
646        </html>
647        
648        <zscript defer="true">
649            hovertool.setVisible(false);
650            nearesttool.setVisible(false);
651            featuretool.setVisible(false);
652        </zscript>
653
654    </window>
655
656    
657
658   
659</zk>
660