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
Last revisionBoth sides next revision
en:user:favourites [2023/07/24 21:28] – [Setting up the Email Results Functionality] kjdonen:user:favourites [2023/07/24 21:48] – [Customizing Favourites] kjdon
Line 24: Line 24:
 ===== 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.
 +
 +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 =====
en/user/favourites.txt · Last modified: 2024/02/12 23:42 by kjdon