User Tools

Site Tools


en:user:favourites

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:user:favourites [2023/07/24 21:25] – [Favourites/Berry Baskets (Greenstone 3)] kjdonen:user:favourites [2025/10/03 00:55] (current) – [Disable Favourites for one collection] kjdon
Line 2: Line 2:
 ====== Greenstone 3 Favourites ====== ====== Greenstone 3 Favourites ======
  
-//[ This page documents favourites for Greenstone 3 version 3.11. For 3.10 and earlier versions, please see our [[en:user:berry_baskets| Berry Baskets]] page. ]//+//[ This page documents favourites for Greenstone 3 version 3.11 and later. For 3.10 and earlier versions, please see our [[en:user:berry_baskets| Berry Baskets]] page. ]//
  
 The favourites functionality allows the user to collect up a set of interesting or useful documents as she is browsing through the library. Once they are finished, they can view the basket of links, and email it to themselves. The favourites functionality allows the user to collect up a set of interesting or useful documents as she is browsing through the library. Once they are finished, they can view the basket of links, and email it to themselves.
Line 14: Line 14:
 A library can enable the favourites functionality using a servlet option. Favourites are enabled by default. To disable, please edit resources/web/servlets.xml.in, and set the **favouritebasket** parameter to **false** in the servlet description for the library you want to change.  A library can enable the favourites functionality using a servlet option. Favourites are enabled by default. To disable, please edit resources/web/servlets.xml.in, and set the **favouritebasket** parameter to **false** in the servlet description for the library you want to change. 
  
-A user can enable/disable favourites for themselves (assuming the library provides the funtionality) on the preferences page. Favourites are enabled for the user by default. To set them to be disabled by default,  set a paramDefault in web/sites/localsite/siteConfig.xml (or in the siteConfig.xml of the site you are using for the library). This format element goes at the top level of the siteConfig element.+A user can enable/disable favourites for themselves (assuming the library provides the funtionality) on the preferences page. Favourites are enabled for the user by default. To set them to be disabled by default (for the entire library), set a paramDefault in web/sites/localsite/siteConfig.xml (or in the siteConfig.xml of the site you are using for the library). This format element goes at the top level of the siteConfig element.
  
 <code> <code>
Line 22: Line 22:
 </code> </code>
  
 +Note, this doesn't completely disable favourites, it just makes them turned off by default, and a user can turn them back on in Preferences.
 +
 +Second note, if you are testing this you may need to use a private browser window. Greenstone stores your settings between sessions and if it has stored the favourites being on, then this changing this setting in the library won't affect your current stored session.
 +
 +===== Disable Favourites for one collection =====
 +
 +If you would like to turn off favourites just for one collection, you can add a custom gslib.xsl into the collection's transform folder. Use the Files tab in GLI (Greenstone 3.12) to do this, or locate the collection at web/sites/localsite/collect/<collname>. You may need to create the transform folder if the collection doesn't already have one.
 +
 +Open a new file in the transform folder called gslib.xsl and add the following as its contents.
 +<code>
 +<?xml version="1.0" encoding="UTF-8"?>
 +<xsl:stylesheet version="1.0" 
 +  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 +  xmlns:xslt="http://www.w3.org/1999/XSL/Transform" 
 +  xmlns:gslib="http://www.greenstone.org/XSL/Library" 
 +  xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat" 
 +  xmlns:util="http://org.greenstone.gsdl3.util.XSLTUtil" 
 +  xmlns:gs3="http://www.greenstone.org/gs3"
 +  xmlns:xlink="http://www.w3.org/1999/xlink" 
 +  xmlns:gsvar="http://www.greenstone.org/skinning-var"
 +  exclude-result-prefixes="util xalan gslib gsf xslt gs3 gsvar xlink">
 +
 +  <xsl:template name="documentFavouriteForClassifierOrSearchPage"></xsl:template>
 +  <xsl:template name="gotoFavourites"></xsl:template>
 +</xsl:stylesheet>
 +
 +</code>
 ===== Customizing Favourites ===== ===== Customizing Favourites =====
  
 +The links in the list of favourites can now be customised using format statements (like we use to customise document lists for browsing and searching).
  
 +The content of the favourites page is defined in web/interfaces/default/transform/pages/favourites.
  
 +The default templace for the documentNode is below. This will be used if there is no alternative specified in the FavouriteBasket ServiceRack, or in a collectionConfig file.
  
 +<code>
 +<xsl:template match="documentNode">
 +   <xsl:call-template name="displayFavourite"/>
 +</xsl:template>
 +<xsl:template match="documentNode" mode="plain-text">
 +   <xsl:call-template name="displayPlainText"/>
 +</xsl:template>
 +
 +</code>
 +
 +The displayFavourite template displays a link to the source doc (eg pdf/image etc) plus the document title which is linked to the greenstone version of the document. The displayPlainText template makes a plain text version, with no HTML markup, suitable for use in an email or in the copy buffer.
 +
 +web/sites/localsite/siteConfig.xml is where the FavouriteBasket ServiceRack is added to the library. In here we can customise the display for a particular site - by default, the documentNode templates above are just repeated here. Note, in order to be able to add collection specific formatting, this site-wide format element needs to be present.
 +
 +<code>
 +   <serviceRack name="FavouriteBasket">
 +      <format>
 +        <!-- set the following to true is you have an email service on the server, or if you have setup mail server properties in resources/web/global.properties.in-->
 +        <gsf:option name="serverEmail" value="false"/>
 +        <!-- default template used for email/copy-->
 +        <xsl:template match="documentNode" mode="plain-text">
 +          <xsl:call-template name="displayPlainText"/>
 +        </xsl:template>
 +        <!-- default template used for favourites display -->
 +        <xsl:template match="documentNode">
 +          <xsl:call-template name="displayFavourite"/>
 +        </xsl:template>
 +      </format>
 +    </serviceRack>
 +</code>
 +
 +A collection can specify its own customisation for documents from that collection in the favourites list. In this case, we have to put it in a special place: inside a top level ccServices element (cross collection services), specifying which service the format element is for.
 +
 +For example:
 +<code>
 +<ccServices>
 +  <format service="GetFavouritesList">
 +    <xsl:template match="documentNode">
 +      <xsl:call-template name="displayFavourite"/><gsf:metadata name="dc.Creator/>
 +    </xsl:template>
 +    <xsl:template mode="plain-text" match="documentNode">
 +      <gsf:metadata name="dc.Title"/>
 +       <xsl:text> (</xsl:text>
 +       <xsl:value-of select="@collection"/>
 +       <xsl:text>)</xsl:text>
 +    </xsl:template>
 +  </format>
 +</ccServices>
 +</code>
 +
 +The first template uses the default display template, but adds on dc.Creator metadata. The second template does away with the default altogether, and displays the dc.Title metadata, followed by the collection name in brackets. A pretty useless display, as it contains no link to the document, but just for illustrative purposes.
  
 ===== Setting up the Email Results Functionality ===== ===== Setting up the Email Results Functionality =====
  
 The favourites list can be emailed out using a mail server, or by using the user's existing mail client.  The favourites list can be emailed out using a mail server, or by using the user's existing mail client. 
 +
 Mail server:  Mail server: 
-  * the results will be emailed from an address you specify+  * the results will be emailed from a pre-specified  address
   * requires the mail server to be set up   * requires the mail server to be set up
   * works for all users   * works for all users
Line 43: Line 125:
 If you have a mail server set up on the machine running tomcat, or you want to use another existing mail server,  If you have a mail server set up on the machine running tomcat, or you want to use another existing mail server, 
  
-Please edit resources/web/global.properties.in (31 July 2018 and later binaries) or resources/web/global.properties (30 July 2018 or earlier binaries). Set your mail server, username and password etc by uncommenting the lines and setting the proper values.+Please edit resources/web/global.properties.in. Set your mail server, username and password etc by uncommenting the lines and setting the proper values.
  
 <code> <code>
en/user/favourites.1690233912.txt.gz · Last modified: 2023/07/24 21:25 by kjdon