- Timestamp:
- 03/07/12 17:04:37 (9 years ago)
- Location:
- mauRepo/MolesManager/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
mauRepo/MolesManager/trunk/resources/requirements.txt
r8408 r8430 11 11 # --extra-index-url http://ciprod1.cems.rl.ac.uk/pip 12 12 # to your pip install 13 ceda-moles-model==0.1. 013 ceda-moles-model==0.1.1 -
mauRepo/MolesManager/trunk/src/MolesManager/moles3epb.py
r8416 r8430 46 46 from ea_model.ceda_metadatamodel.ceda_observation.ceda_observation import CEDA_Observation 47 47 from ea_model.ceda_metadatamodel.ceda_project.ceda_project import CEDA_Project 48 from ea_model.moles3_4.utilities.mo_responsiblepartyinfo import MO_ResponsiblePartyInfo 49 from ea_model.moles3_4.utilities.ceda_rolevalue import CEDA_RoleValue 50 from MolesManager.codelist import MM_RoleValue, getCLValue 48 51 49 52 class Moles3EPBFactory(EPB): … … 152 155 return coll 153 156 154 def getGeograpicExtentGeometry(self, ge):155 '''156 Creates the appropriate postgis geometry from a EX_GeographicExtent157 @param ge: an EX_GeographicExtent instance158 @return: a postgix text geometry159 '''160 if isinstance(ge, EX_GeographicBoundingBox):161 return create_st_setSRID(ge.westBoundLongitude, ge.southBoundLatitude, \162 ge.eastBoundLongitude, ge.northBoundLatitude)163 return None164 165 157 def getUnifyObservationCollectionGEAsBBox(self, collection): 166 158 """ … … 171 163 for member in collection.member: 172 164 for ge in member.geographicExtent: 173 bboxes.append( self.getGeograpicExtentGeometry(ge))165 bboxes.append(getGeograpicExtentGeometry(ge)) 174 166 175 167 return unifyGeometriesAsBBox(bboxes, self) … … 199 191 return obs in coll.member 200 192 201 def observationAuthor(self, obs _id):193 def observationAuthor(self, observation): 202 194 """ 203 195 Lists the CEDA_Observation author. 204 @param obs _id: the CEDA_Observation id196 @param observation: the CEDA_Observation inside which look for the author 205 197 @return: True if the collection contains the given observation, False otherwise 206 198 """ 207 199 208 200 # TO FIX!!! 209 210 ''' 211 ret = self._session.query(MO_ResponsiblePartyInfo).join(MO_Observation). \ 212 filter(MO_ResponsiblePartyInfo.role == CEDA_RoleValue.cl_author). \ 213 filter(MO_Observation.id == obs_id) 214 return ret 215 ''' 201 for partyInfo in observation.relatedParty: 202 if partyInfo.role == getCLValue(MM_RoleValue.cl_author): 203 return partyInfo.party 204 216 205 217 206 … … 327 316 def executeNative(self, sqlNative): 328 317 return EPB.executeNative(sqlNative, self._session) 318 319 320 def getGeograpicExtentGeometry(ge): 321 ''' 322 Creates the appropriate postgis geometry from a EX_GeographicExtent 323 @param ge: an EX_GeographicExtent instance 324 @return: a postgix text geometry 325 ''' 326 if isinstance(ge, EX_GeographicBoundingBox): 327 return create_st_setSRID(ge.westBoundLongitude, ge.southBoundLatitude, \ 328 ge.eastBoundLongitude, ge.northBoundLatitude) 329 return None -
mauRepo/MolesManager/trunk/src/MolesManager/static/templates/base.html
r8426 r8430 86 86 encType="multipart/form-data" 87 87 action="{% url MolesManager.views.cedaSearch.coSearch %}" method="POST"> 88 89 <script type="dojo/method" data-dojo-event="onSubmit">90 if(this.validate()){91 return confirm('Form is valid, press OK to submit');92 }else{93 alert('Form contains invalid data. Please correct first');94 return false;95 }96 return true;97 </script>98 88 99 89 {% csrf_token %} 100 90 101 < !-- <div class="fieldWrapper claro">91 <div class="fieldWrapper claro"> 102 92 <label for="id_obj_id">Search:</label> 103 93 <input type="text" name="searchTerm" value= "" … … 107 97 108 98 </div> <!-- End of div fieldWrapper --> 99 <!-- 109 100 <form method=POST name="searchAll" action="http://badc.nerc.ac.uk/cgi-bin/search/select_search"> 110 101 <input type="hidden" name=badc_only value="n"> … … 120 111 </table> 121 112 </center> 113 --> 122 114 </div> <!-- End of div myForm --> 123 115 -
mauRepo/MolesManager/trunk/src/MolesManager/views/cedaSearch.py
r8339 r8430 30 30 baseCov = "http://" + request.get_host() + "/cov/" 31 31 for o in obsevations: 32 a = "".join( 33 [baseCov, 34 str(o.id)]) 35 auth_query = request.moles3EPB.observationAuthor(o.id) 36 ath = auth_query.all() 37 ath0 = ath[0] 38 list_list.append((a, o.description, ath0.role)) 32 a = "".join([baseCov, str(o.id)]) 33 responsibleAuthors = request.moles3EPB.observationAuthor(o) 34 list_list.append((a, o.description, _appendAuthors(responsibleAuthors))) 39 35 return list_list 36 37 def _appendAuthors(party): 38 res = None 39 for item in party: 40 res = ("%s%s,") % (res, item.name) 41 if len(res) > 1: 42 return res[:len(res)-1] 43 return res 40 44 41 45
Note: See TracChangeset
for help on using the changeset viewer.