Changeset 8272 for mauRepo/MolesManager
- Timestamp:
- 20/04/12 13:08:37 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mauRepo/MolesManager/trunk/src/MolesManager/static/js/cedaObservation.js
r8268 r8272 10 10 var idDict = {}; 11 11 for (loopVal=0; loopVal<coObs.identifier.length; loopVal++){ 12 idDict[coObs.identifier[loopVal].authority.title] = coObs.identifier[loopVal].code; 12 var innerDict = {}; 13 innerDict['code'] = coObs.identifier[loopVal].code; 14 if (coObs.identifier[loopVal].authority.title == 'DOI'){ 15 innerDict['doiDate'] = (coObs.identifier[loopVal].authority.hasOwnProperty('date') && coObs.identifier[loopVal].authority.date.length != 0 )?coObs.identifier[loopVal].authority.date.dateTime8601.year:coObs.resultTime.position.dateTime8601.year; 16 } 17 idDict[coObs.identifier[loopVal].authority.title] = innerDict; 13 18 } 14 19 return idDict … … 40 45 function publicationDetails(coObs,ids){ 41 46 var pubDetails = {}; 42 var typePub=(ids.hasOwnProperty(' doi'))?"Dataset is Citatable <br /> additional metadata fields may be added ": coObs.publicationState.value;47 var typePub=(ids.hasOwnProperty('DOI'))?"Dataset is Citatable <br /> additional metadata fields may be added ": coObs.publicationState.value; 43 48 44 49 pubDetails['pubType'] = typePub; … … 46 51 pubDetails['pubMonth'] = timeLead0(coObs.resultTime.position.dateTime8601.month) 47 52 pubDetails['pubDay'] = timeLead0(coObs.resultTime.position.dateTime8601.day) 48 49 53 pubDetails['pubString'] = '<p> Record Status: <b>'+ pubDetails['pubType'] +'</b><br /> Created: <b>' + pubDetails['pubYear'] +'-'+ pubDetails['pubMonth'] + '-' + pubDetails['pubDay']+'</b></p>'; 50 54 return pubDetails … … 143 147 } 144 148 145 function createCitation(coObs,ids,rps,pubDetails ){149 function createCitation(coObs,ids,rps,pubDetails,guid){ 146 150 var citationString =''; 147 151 citationString += '<p>' + citeNameArrange(Object.keys(rps['cl_author'])[0],rps['cl_author']); … … 151 155 } 152 156 } 153 var dataYear=(ids.hasOwnProperty("doi"))?ids['doi']:pubDetails['pubYear']; 154 citationString += ', (' + dataYear + '): ' + ids['ceda_title'] 155 if (ids['ceda_title'].substring[ids['ceda_title'].length -1, ids['ceda_title'].length] != '.'){ 157 var dataYear=(ids.hasOwnProperty("DOI") && ids["DOI"].doiDate != pubDetails['pubYear'])?ids['DOI'].doiDate:pubDetails['pubYear']; 158 var titleString = ids['ceda_title'].code; 159 citationString += ', (' + dataYear + '): ' + titleString 160 161 if (titleString.substring(titleString.length -1, length) != '.'){ 156 162 citationString += '.'; 157 163 } … … 163 169 citationString += ' Centre for Environmental Data Archival.'; 164 170 } 165 if ('doi' in ids){ 166 var doiHttp = 'http://dx.doi.org/' + ids['doi'].substring[18,ids['doi'].length] 167 citationString += ' ' + ids['doi'] + '. ' + '<a href="' + doiHttp + '">' + doiHttp + '</a>'; 168 } 169 else{ 170 citationString += ' Available from: ' + '<a href="' + ids['moles2url'] + '">' + ids['moles2url'] + '</a>'; 171 if (ids.hasOwnProperty('DOI')){ 172 var doi = ids['DOI'].code; 173 var doiHttp = 'http://dx.doi.org/' + doi 174 citationString += ' ' + doi + '. ' + '<a href="' + doiHttp + '">' + doiHttp + '</a>'; 175 } 176 else { 177 var citeURL = 'http://www.ceda.ac.uk/datacat/' 178 citationString += ' Available from: ' + '<a href="' + citeURL + guid + '">' + citeURL + guid + '</a>'; 171 179 } 172 180 citationString += '</p>' … … 330 338 331 339 var json = dojo.byId('coObs_id').value; 340 var guid = dojo.byId('guid_id').value; 332 341 coObs = dojo.fromJson(json); 333 342 console.log(guid) 334 343 if (coObs != ''){ 335 344 var ids = getIDs(coObs); … … 346 355 // title_id.startup(); 347 356 348 var title_id = new dojo.html.set(dojo.byId("title_id"),'<h3>'+ids['ceda_title'] +'</h3>');357 var title_id = new dojo.html.set(dojo.byId("title_id"),'<h3>'+ids['ceda_title'].code+'</h3>'); 349 358 var rps = getRelatedParties(coObs); 350 359 var pubDetails = publicationDetails(coObs,ids); … … 353 362 var citation_id = new dijit.TitlePane( 354 363 { 355 title: 'Citation', content: createCitation(coObs,ids,rps,pubDetails )364 title: 'Citation', content: createCitation(coObs,ids,rps,pubDetails,guid) 356 365 },"citation_id"); 357 366 citation_id.startup(); … … 360 369 var pastCitation_id = new dijit.TitlePane( 361 370 { 362 title: "Previous Identifiers Used:", content: ids['moles2url'] , open: 0371 title: "Previous Identifiers Used:", content: ids['moles2url'].code, open: 0 363 372 },"pastCitation_id"); 364 373 citation_id.startup(); … … 378 387 dojo.attr("help_id",'value',''); 379 388 380 var docLink_id = new dojo.html.set(dojo.byId("docLink_id"),docLinkObj(ids['moles2url'] ));389 var docLink_id = new dojo.html.set(dojo.byId("docLink_id"),docLinkObj(ids['moles2url'].code)); 381 390 382 391 var bbox_id = new dijit.TitlePane(
Note: See TracChangeset
for help on using the changeset viewer.