Skip to content

Share Link

Marten edited this page Jun 24, 2016 · 4 revisions

This customization enables a Share link for each metadata record that appears in the search results page. The Share link allows users to bookmark (i.e., Add to Favorites) or share (i.e., through Digg, MySpace, Google, etc.) a particular metadata record directly from the search results page using technology from AddThis.

Follow the steps below to add the Share link to the geoportal implementation. To perform this customization, access to the geoportal .jsp files on the geoportal web application server is necessary.

  • If you are using Geoportal Server version 1.0 or 1.1, download and apply the SearchResultRecord patch. Instructions for applying the patch are included in the download's ReadMe file. Subsequent versions of the Geoportal Server will include the SearchResultRecord patch and so do not need to follow this step.
  • Navigate to the \\geoportal\catalog\search folder.
  • Open the results.jsp file in a text editor.
  • At the top of the file, you will add some javascript. Find the first <f:verbatim></f:verbatim> tag, and add the following lines just beneath that f:verbatim tag:
<script type="text/javascript" src="http://s7.addthis.com/js/200/addthis_widget.js"></script>
<script type="text/javascript">
 var addthis_pub=" ";
</script>
  • Now, find in the results.jsp file where the <%//Resource links %><h:panelgroup></h:panelgroup> output links are defined. Add a new <h:outputlink></h:outputlink> section, right above the line that starts with <%//Zoom map, that has the following code:
<%//Share result%>
<h:outputLink
 id="_lnkShare2"
 rendered="#{record.resourceLinksAsMap['details'] != null && 
           record.resourceLinksAsMap['details'] != ''}"
 value="http://www.addthis.com/bookmark.php?v=20"
 styleClass="resultsLink"                 
 onmouseover="return addthis_open(this, , 
              '#{record.resourceLinksAsMap['details']}', 
              '#{record.title}')" 
 onmouseout="addthis_close()"
 onclick="return addthis_sendto()">
  <h:outputText id="_txtShareThis2" value="#{gptMsg['catalog.search.searchResult.share']}" />
</h:outputLink>
  • Save the results.jsp file and close it.
  • Navigate to the \\geoportal\WEB-INF\classes\gpt\resources folder. Open the gpt.properties file in a text editor.
  • Add the following resource key under the #search related pages heading. The resource key is the name of the link that appears in the search results user interface. Replace the text after the equals sign with a title for the link (Share in the example below):
 catalog.search.searchResult.share = Share
  • Save the gpt.properties file and close it.
  • Restart the geoportal web application, and do a search to see the new Share link in each search result.
Clone this wiki locally