Changeset 8215
- Timestamp:
- 04/04/12 16:51:51 (9 years ago)
- Location:
- mauRepo/MolesManager/trunk/src/MolesManager/static
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
mauRepo/MolesManager/trunk/src/MolesManager/static/js/cedaObservation.js
r8211 r8215 26 26 if (typeof coObs.relatedParty[loopVal].role !='undefined') 27 27 { 28 28 29 if (typeof coObs.relatedParty[loopVal].role.name !='undefined') 29 30 { 31 console.log(coObs.relatedParty[loopVal].role.name,loopVal) 30 32 for (loopInner=0; loopInner<coObs.relatedParty[loopVal].party.length; loopInner++) 31 33 { 32 34 names.push(coObs.relatedParty[loopVal].party[0].name) 35 } 36 37 if (coObs.relatedParty[loopVal].role.name == 'cl_pointofcontact'){ 38 var helpEmail = coObs.relatedParty[loopVal].party[0].contactInfo[0].address.electronicMailAddress[0]; 39 //helpEmail = "badc@rl.ac.uk" 40 var helpString = '<p>For assistance please contact <a href="mailto:' + helpEmail + '">'+ coObs.relatedParty[loopVal].party[0].name +'</a>.</p>' 33 41 } 34 42 relatedPartyDict[coObs.relatedParty[loopVal].role.name] = names; … … 37 45 } 38 46 } 39 return relatedPartyDict47 return [relatedPartyDict, helpString] 40 48 } 41 49 … … 48 56 } 49 57 } 50 citationString += '. ' + ids['ceda_title'] + '. ' + 'Centre for Environmental Data Archival.'; 58 if (rps.hasOwnProperty('cl_publisher')) 59 { 60 citationString += '. ' + ids['ceda_title'] + '. ' + rps['cl_publisher'] +'.'; 61 } 51 62 if ('doi' in ids){ 52 63 citationString += ' ' + ids['doi']; … … 54 65 return citationString 55 66 } 67 68 function accessLink(useLimitation){ 69 var accessString = ''; 70 71 if (useLimitation != ''){ 72 var split = useLimitation[0].split(' http://') 73 console.log(split[1].substring[0,5]) 74 if (split[1][split[1].length] == '.'){split[1] = split[1].substring[0,split[1].length - 1]} 75 accessString = '<p>' + split[0] + ' <a href="http://' + split[1] + '">' + split[1] + '</a></p>' 76 77 } 78 if (accessString == '' ){acessString = '<p>These data are open access. Please visit the data centre to access these data or contact the data centre for access assistance.</p>'} 79 return accessString 80 } 81 82 function drawMap(extents, map_id) 83 { 84 map = new OpenLayers.Map(map_id); 85 var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0?", {layers: 'basic'} ); 86 87 var boxes = new OpenLayers.Layer.Vector( "Boxes" ); 88 //minLon,minLat,maxlon,maxlat 89 if (typeof extents[0].westBoundLongitude != 'undefined'){ 90 box_extents = [[extents[0].westBoundLongitude.value,extents[0].southBoundLatitude.value,extents[0].eastBoundLongitude.value,extents[0].northBoundLatitude.value]] 91 for (var i = 0; i < box_extents.length; i++) { 92 ext = box_extents[i]; 93 94 bounds = new OpenLayers.Bounds(ext[0],ext[1],ext[2],ext[3]); 95 96 box = new OpenLayers.Feature.Vector(bounds.toGeometry()); 97 boxes.addFeatures(box); 98 } 99 } 100 101 map.addLayer(ol_wms); 102 map.addLayer(boxes); 103 var boxes = new OpenLayers.Layer.Vector( "boxes" ); 104 var layerSwitch = new OpenLayers.Control.LayerSwitcher 105 // this is where we find there is an issue - the error is: 106 // map.addControl(layerSwitch); 107 var sf = new OpenLayers.Control.SelectFeature(boxes); 108 console.log(ext[0],ext[1],ext[2],ext[3]) 109 110 map.addControl(sf); 111 sf.activate(); 112 113 var proj = new OpenLayers.Projection("EPSG:4326"); 114 var point = new OpenLayers.LonLat(ext[0], ext[1]); 115 point.transform(proj, map.getProjectionObject()); 116 map.setCenter(point,3); 117 map.zoomToMaxExtent(); 118 } 119 56 120 57 121 require(['dojo/ready', 'dojo/parser', 'dijit/registry', 'dojo/_base/json', 'dojo/store/Memory', 58 'dijit/Tree', 'dijit/form/Button' ], function(ready, parser, registry, Tree){122 'dijit/Tree', 'dijit/form/Button', 'dojo/html'], function(ready, parser, registry, Tree){ 59 123 ready(function () 60 124 { … … 105 169 }, "keywords_id"); 106 170 keywords_id.startup(); 107 171 108 172 //---------------------------------------------- 109 173 //---------- Loads the widgets values ---------- … … 118 182 var ids = getIDs(coObs); 119 183 var rps = getRelatedParties(coObs); 184 185 console.log(coObs.permission.useLimitation) 186 var access_id = new dojo.html.set(dojo.byId("access_id"),accessLink(coObs.permission.useLimitation)); 187 188 var help_id = new dojo.html.set(dojo.byId("help_id"),rps[1]); 189 console.log(rps[1]) 120 190 121 191 dojo.attr("title_id", 'value', ids['ceda_title']); 122 dojo.attr("citation_id", 'value', createCitation(coObs,ids,rps ));192 dojo.attr("citation_id", 'value', createCitation(coObs,ids,rps[0])); 123 193 dojo.attr("records_dataLineage", 'value', coObs.dataLineage); 124 194 dojo.attr("description_id", 'value', coObs.description); 125 195 dojo.attr("keywords_id", 'value', coObs.keywords); 126 coords = new dojo.store.Memory(coObs.geographicalExtent); 127 rp = new dojo.store.Memory(coObs.relatedParty[0]); 196 //dojo.attr("access_id",'value',''); 197 dojo.attr("help_id",'value',''); 198 drawMap(coObs.geographicExtent,'map'); 128 199 }); 129 200 }); -
mauRepo/MolesManager/trunk/src/MolesManager/static/templates/cedaObservation.html
r8211 r8215 1 1 {% extends "base.html" %} 2 2 {% block extra_head %} 3 <script src="http://openlayers.org/api/OpenLayers.js"></script> 4 <link rel="stylesheet" href="http://openlayers.org/dev/theme/default/style.css" type="text/css"> 5 6 <script type="text/javascript"> 7 var box_extents = [[-10,50,4,62]]; 8 var map; 9 var vectorLayer = new OpenLayers.Layer.Vector("Overlay",{isBaseLayer:false}); 10 function init() { 11 map = new OpenLayers.Map('map'); 12 var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0?", {layers: 'basic'} ); 13 14 var boxes = new OpenLayers.Layer.Vector( "Boxes" ); 15 16 for (var i = 0; i < box_extents.length; i++) { 17 ext = box_extents[i]; 18 console.log(ext[0],ext[1]) 19 bounds = new OpenLayers.Bounds(ext[0],ext[1],ext[2],ext[3]); 20 21 22 box = new OpenLayers.Feature.Vector(bounds.toGeometry()); 23 24 boxes.addFeatures(box); 25 26 } 27 28 map.addLayer([ol_wms,boxes]); 29 console.log('ere') 30 map.addControl(new OpenLayers.Control.LayerSwitcher()); 31 var sf = new OpenLayers.Control.SelectFeature(boxes); 32 map.addControl(sf); 33 sf.activate(); 34 var proj = new OpenLayers.Projection("EPSG:4326"); 35 var point = new OpenLayers.LonLat(ext[0], ext[1]); 36 point.transform(proj, map.getProjectionObject()); 37 38 map.setCenter(point,3); 39 map.zoomToMaxExtent(); 40 } 41 window.onload = init; 42 </script> 43 44 45 {% endblock %} 3 <script src="http://openlayers.org/api/OpenLayers.js"></script> 4 <link rel="stylesheet" href="http://openlayers.org/dev/theme/default/style.css" type="text/css"> 5 {% endblock %} 46 6 47 7 {% block title %} CEDA Observation Record {% endblock %} … … 82 42 </div> 83 43 <div data-dojo-type="dijit.layout.ContentPane" title="Apply for Access"> 84 <p>This is a restricted dataset. To obtain access please use this link:</p>85 44 <div id="access_id">Access to these data may be restricted</div> 45 </div> 86 46 <div data-dojo-type="dijit.layout.ContentPane" title="Help"> 87 < p>To contact the CEDA Helpdesk please use the <a href="http://www.ceda.ac.uk/contact">Contact Us page.</a></p>47 <div id="help_id">For assistance contact <a href="mailto:badc@rl.ac.uk">badc@rl.ac.uk</a></div> 88 48 </div> 89 49 </div> … … 94 54 <br /> 95 55 </div><!-- End of div description --> 96 < div class="grid_5 omega" id="news">56 <!-- <div class="grid_5 omega" id="news"> 97 57 <p>News bar</p> 98 </div><!-- End of div news -->58 </div><!-- End of div news --> 99 59 </div> 100 60 <div class="grid_3 cedaObs omega" id="middleRight"> 101 61 <label for="geographicExtent">Geographic Extent</label><div id="geographicalExtent_id"></div> <br /> 102 62 <!-- begin map test --> 63 103 64 <div style="width:220px; height:150px" id="map" class="smallmap"></div> 104 65
Note: See TracChangeset
for help on using the changeset viewer.