Skip to content

Commit 5de68bd

Browse files
committed
fixes for local and remote image links
1 parent 5a88c74 commit 5de68bd

File tree

7 files changed

+21
-30
lines changed

7 files changed

+21
-30
lines changed

Diff for: BiocacheHubsGrailsPlugin.groovy

+7-14
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,20 @@ import grails.util.Environment
1818

1919
class BiocacheHubsGrailsPlugin {
2020
// the plugin version
21-
def version = "0.36"
21+
def version = "0.37"
2222
// the version or versions of Grails the plugin is designed for
2323
def grailsVersion = "2.3 > *"
2424
// resources that are excluded from plugin packaging
2525
def pluginExcludes = [
2626
"grails-app/views/error.gsp"
2727
]
2828

29-
// TODO Fill in these fields
3029
def title = "Biocache Hubs Plugin" // Headline display name of the plugin
3130
def author = "Nick dos Remedios"
3231
def authorEmail = "nick.dosremedios@csiro.au"
3332
def description = '''\
34-
A client web application for searching and displaying biodiversity data from the
35-
Atlas of Living Australia (ALA). Data access is via JSON REST web services from
33+
A client web application for searching and displaying biodiversity data from biocache web services.
34+
Data access is via JSON REST web services from
3635
the ALA biocache-service app (no local DB is required for this app).
3736
'''
3837

@@ -48,7 +47,10 @@ the ALA biocache-service app (no local DB is required for this app).
4847
def organization = [ name: "Atlas of Living Australia", url: "http://www.ala.org.au/" ]
4948

5049
// Any additional developers beyond the author specified above.
51-
def developers = [ [ name: "Dave Martin", email: "david.martin@csiro.au" ]]
50+
def developers = [
51+
[ name: "Dave Martin", email: "david.martin@csiro.au" ],
52+
[ name: "Dave Baird", email: "david.baird@csiro.au" ]
53+
]
5254

5355
// Location of the plugin's issue tracker.
5456
def issueManagement = [ system: "Google Code", url: "https://code.google.com/p/ala/issues/list" ]
@@ -108,26 +110,17 @@ the ALA biocache-service app (no local DB is required for this app).
108110
}
109111

110112
def doWithDynamicMethods = { ctx ->
111-
// TODO Implement registering dynamic methods to classes (optional)
112113
}
113114

114115
def doWithApplicationContext = { ctx ->
115-
// TODO Implement post initialization spring config (optional)
116116
}
117117

118118
def onChange = { event ->
119-
// TODO Implement code that is executed when any artefact that this plugin is
120-
// watching is modified and reloaded. The event contains: event.source,
121-
// event.application, event.manager, event.ctx, and event.plugin.
122119
}
123120

124121
def onConfigChange = { event ->
125-
//this.mergeConfig(application)
126-
// TODO Implement code that is executed when the project configuration changes.
127-
// The event is the same as for 'onChange'.
128122
}
129123

130124
def onShutdown = { event ->
131-
// TODO Implement code that is executed when the application shuts down (optional)
132125
}
133126
}

Diff for: grails-app/conf/defaultConfig.groovy

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ biocache.downloads.extra = "dataResourceUid,dataResourceName.p"
5151
biocache.ajax.useProxy = false
5252
collections.baseUrl = "http://collections.ala.org.au"
5353

54-
images.baseUrl="http://images.ala.org.au"
54+
// images
55+
images.baseUrl = "http://images.ala.org.au"
56+
images.viewerUrl = "http://images.ala.org.au/image/viewer?imageId="
57+
images.metadataUrl = "http://images.ala.org.au/image/details?imageId="
5558

5659
// For sandbox environment
5760
//spatial.params = "&dynamic=true&ws=http%3A%2F%2Fsandbox.ala.org.au%2Fhubs-webapp&bs=http%3A%2F%2Fsandbox.ala.org.au%2Fbiocache-service"

Diff for: grails-app/controllers/au/org/ala/biocache/hubs/OccurrenceController.groovy

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@
1414
*/
1515

1616
package au.org.ala.biocache.hubs
17-
1817
import grails.converters.JSON
19-
import org.codehaus.groovy.grails.web.json.JSONArray
2018
import org.codehaus.groovy.grails.web.json.JSONElement
2119
import org.codehaus.groovy.grails.web.json.JSONObject
2220

2321
import java.text.SimpleDateFormat
24-
2522
/**
2623
* Controller for occurrence searches and records
2724
*/
@@ -57,7 +54,7 @@ class OccurrenceController {
5754
List taxaQueries = (ArrayList<String>) params.list("taxa") // will be list for even one instance
5855
log.debug "skin.useAlaBie = ${grailsApplication.config.skin.useAlaBie}"
5956

60-
if (grailsApplication.config.skin.useAlaBie && !params.q && taxaQueries && taxaQueries[0]) { // check for list with empty string
57+
if (grailsApplication.config.skin.useAlaBie && grailsApplication.config.skin.bie.baseUrl && !params.q && taxaQueries && taxaQueries[0]) { // check for list with empty string
6158
// taxa query - attempt GUID lookup via BIE
6259
List guidsForTaxa = webServicesService.getGuidsForTaxa(taxaQueries)
6360
requestParams.q = postProcessingService.createQueryWithTaxaParam(taxaQueries, guidsForTaxa)

Diff for: grails-app/i18n/messages.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ show.sidebar03.title = Images
130130
show.sidebar03.cite01 = Photographer
131131
show.sidebar03.cite02 = Rights
132132
show.sidebar03.cite03 = Rights holder
133-
show.sidebardiv.occurrenceimages.navigator01 = Original image
134-
show.sidebardiv.occurrenceimages.navigator02 = Image details
133+
show.sidebardiv.occurrenceimages.navigator01 = View image details
134+
show.sidebardiv.occurrenceimages.navigator02 = View original image
135135
show.occurrencemap.title = Location of record
136136
show.soundsheader.title = Sounds
137137
show.sidebar04.cite = Rights

Diff for: grails-app/services/au/org/ala/biocache/hubs/WebServicesService.groovy

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class WebServicesService {
4747
}
4848

4949
def JSONArray getMapLegend(String queryString) {
50-
def url = "${grailsApplication.config.biocache.baseUrl}/webportal/legend?${queryString}"
50+
def url = "${grailsApplication.config.biocache.baseUrl}/mapping/legend?${queryString}"
5151
JSONArray json = getJsonElements(url)
5252
def facetName
5353
Map facetLabelsMap = [:]
@@ -158,7 +158,7 @@ class WebServicesService {
158158
@Cacheable('longTermCache')
159159
def Map getLayersMetaData() {
160160
Map layersMetaMap = [:]
161-
def url = "${grailsApplication.config.spatial.baseUrl}/layers.json"
161+
def url = "${grailsApplication.config.spatial.baseUrl}/ws/layers"
162162
def jsonArray = getJsonElements(url)
163163

164164
jsonArray.each {

Diff for: grails-app/views/occurrence/_recordSidebar.gsp

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<g:if test="${collectionLogo}">
32
<div class="sidebar">
43
<img src="${collectionLogo}" alt="institution logo" id="institutionLogo"/>
@@ -212,9 +211,9 @@
212211
<div id="occurrenceImages" style="margin-top:5px;">
213212
<g:each in="${record.images}" var="image">
214213
<div style="margin-bottom:10px;">
215-
<g:if test="${useImageService}">
216-
<a href="${grailsApplication.config.images.baseUrl}/image/view?imageId=${image.filePath}" target="_blank">
217-
<img src="${image.alternativeFormats.smallImageUrl}" style="max-width: 100%;"/>
214+
<g:if test="${grailsApplication.config.skin.useAlaImageService.toBoolean()}">
215+
<a href="${grailsApplication.config.images.viewerUrl}${image.filePath}" target="_blank">
216+
<img src="${image.alternativeFormats.smallImageUrl}" style="max-width: 100%;" alt="Click to view this image in a large viewer"/>
218217
</a>
219218
</g:if>
220219
<g:else>
@@ -232,8 +231,8 @@
232231
<g:if test="${record.raw.occurrence.rightsholder}">
233232
<cite><g:message code="show.sidebar03.cite03" default="Rights holder"/>: ${record.raw.occurrence.rightsholder}</cite><br/>
234233
</g:if>
235-
<g:if test="${useImageService}">
236-
<a href="${grailsApplication.config.images.baseUrl}/image/details?imageId=${image.filePath}" target="_blank"><g:message code="show.sidebardiv.occurrenceimages.navigator01" default="Image details"/></a>
234+
<g:if test="${grailsApplication.config.skin.useAlaImageService.toBoolean()}">
235+
<a href="${grailsApplication.config.images.images.metadataUrl}${image.filePath}" target="_blank"><g:message code="show.sidebardiv.occurrenceimages.navigator01" default="View image details"/></a>
237236
</g:if>
238237
<g:else>
239238
<a href="${image.alternativeFormats.imageUrl}" target="_blank"><g:message code="show.sidebardiv.occurrenceimages.navigator02" default="Original image"/></a>

Diff for: grails-app/views/occurrence/show.gsp

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
<g:set var="bieWebappContext" value="${grailsApplication.config.bie.baseUrl}"/>
1212
<g:set var="collectionsWebappContext" value="${grailsApplication.config.collections.baseUrl}"/>
1313
<g:set var="useAla" value="${grailsApplication.config.skin.useAlaBie?.toBoolean() ? 'true' : 'false'}"/>
14-
<g:set var="useImageService" value="${grailsApplication.config.skin.useAlaImageService?.toBoolean()} "/>
1514
<g:set var="taxaLinks" value="${grailsApplication.config.skin.taxaLinks}"/>
1615
<g:set var="dwcExcludeFields" value="${grailsApplication.config.dwc.exclude}"/>
1716
<g:set var="hubDisplayName" value="${grailsApplication.config.skin.orgNameLong}"/>

0 commit comments

Comments
 (0)