en:user:favourites
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:user:favourites [2023/07/24 01:47] – updated version info kjdon | en:user:favourites [2024/02/12 23:42] (current) – [Customizing Favourites] kjdon | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Greenstone 3 Favourites ====== | ||
- | ====== Favourites/Berry Baskets (Greenstone 3) ====== | + | //[ This page documents favourites for Greenstone 3 version 3.11. For 3.10 and earlier versions, please see our [[en: |
- | //[ This version | + | 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, |
- | A favourites/berry basket functionality has been implemented in Greenstone 3. This allows the user to collect up a set of interesting or useful documents as she is browsing | + | When favourites |
- | Favourites - a star is displayed | + | A link to the favourites list is also displayed |
- | Berry Baskets - little berries are displayed by each document. Drag a berry on to the basket to add that document. | + | ===== Activating Favourites ===== |
- | The basket itself is displayed on the side of the page. Clicking the link in the basket will take you to a full view of the contents of the basket. | + | A library can enable |
- | ===== Activating | + | A user can enable/ |
- | By default, Favourites is active, not Berry Baskets. | ||
- | |||
- | The library administrator can change to use Berry Baskets, or disable the functionality altogether by editing options in the web/ | ||
- | < | ||
- | < | ||
- | <option name=" | ||
- | <option name=" | ||
- | </ | ||
- | </ | ||
- | Set both to false to disable this completely. | ||
- | |||
- | While the functionality is active, it is not turned on for the user by default. (It will be for 3.10 and later). The user can go to Preferences, | ||
- | |||
- | To make it turned on/off by default, set a paramDefault in web/ | ||
< | < | ||
< | < | ||
- | < | + | < |
</ | </ | ||
</ | </ | ||
- | ===== Customizing | + | ===== Customizing |
- | ==== Metadata ==== | + | 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). |
- | If you want to add an extra metadata field to the display, then you need to specify that metadata | + | The content of the favourites page is defined |
- | < | + | The default templace for the documentNode is below. This will be used if there is no alternative specified in the FavouriteBasket ServiceRack, |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | </ | + | |
- | </ | + | |
- | Then restart Tomcat. | ||
- | |||
- | By default, these specified metadata elements will just get added to the item's display, e.g. at the bottom of the metadata lists in the ' | ||
- | |||
- | If you want to customise the display, take a look at the javascript code. web/ | ||
- | |||
- | === Example: Using dc.Title instead of Title in Berry Basket display === | ||
- | |||
- | By default, the berry basket entries display Title metadata. If the linked item is a section, it will also display the book Title (root_Title). | ||
- | |||
- | If we have a collection that doesn' | ||
- | |||
- | 1. Edit web/ | ||
< | < | ||
- | <serviceRack name="BerryBaskets"> | + | <xsl: |
- | <metadataList> | + | |
- | < | + | </xsl: |
- | </metadataList> | + | <xsl: |
- | </serviceRack> | + | < |
- | </code> | + | </xsl: |
- | 2. Edit web/ | ||
- | |||
- | Look for generateDocDisplay and edit it: | ||
- | < | ||
- | Replace: | ||
- | a.href=generateURL(doc); | ||
- | a.appendChild(document.createTextNode(doc[' | ||
- | with either: | ||
- | 1. Use this if all documents have dc.Title instead of Title | ||
- | |||
- | a.href=generateURL(doc); | ||
- | a.appendChild(document.createTextNode(doc[' | ||
- | |||
- | or: | ||
- | 2. use this if some documents have Title and some have dc.Title | ||
- | |||
- | a.href=generateURL(doc); | ||
- | if (doc[' | ||
- | | ||
- | } else if (doc[' | ||
- | | ||
- | } | ||
</ | </ | ||
- | This will now display dc.Title instead of Title for the title link to the document | + | The displayFavourite template displays a link to the source doc (eg pdf/image etc) plus the document |
- | However, as dc.Title | + | |
- | < | + | |
- | Replace: | + | |
- | for (var metaItem | + | |
- | if ( !default_metas.includes(metaItem)){ | + | |
- | | + | |
- | } | + | |
- | } | + | |
- | with: | + | web/ |
- | for (var metaItem in doc) { | + | |
- | if ( !default_metas.includes(metaItem) && metaItem != 'dc.Title' | + | |
- | | + | |
- | } | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | In the text and email view, all metadata is displayed in a list: First the hard-wired ones, then any that are not in the default list. So the dc.Title metadata | + | |
- | For example, in populateUrlsAndMetadata(), | ||
< | < | ||
- | if (doc[' | + | < |
- | | + | < |
- | } | + | <!-- set the following to true is you have an email service on the server, or if you have setup mail server properties in resources/ |
+ | < | ||
+ | <!-- default template used for email/ | ||
+ | <xsl:template match="documentNode" | ||
+ | < | ||
+ | </ | ||
+ | <!-- default template used for favourites display --> | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
</ | </ | ||
+ | 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: | |
- | ==== Document Link ==== | + | |
- | + | ||
- | By default the link in the basket will be to the Greenstone HTML version of the document. You can change this to link to the source document, eg the PDF version. | + | |
- | + | ||
- | Edit web/ | + | |
- | + | ||
- | There are three variables at the top of this file: | + | |
< | < | ||
- | var default_link_type | + | < |
- | var source_link_collections | + | <format service="GetFavouritesList"> |
- | var document_link_collections | + | < |
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
</ | </ | ||
- | The default_link_type specifies whether links are to the Greenstone versions (" | + | 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 |
- | For example, if most collections use document, but pdfcoll and exampapers use source, then set the variables like this: | + | ===== 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. |
- | var default_link_type = " | + | |
- | var source_link_collections = [" | + | |
- | </ | + | |
- | Similarly, use document_link_collections to set the exceptions if you have made the default " | + | Mail server: |
+ | * the results will be emailed from a pre-specified | ||
+ | * requires | ||
+ | * works for all users | ||
- | ===== Setting up the Email Results Functionality ===== | + | User's mail client: |
+ | * doesn' | ||
+ | * the email will be sent from the user's own address | ||
+ | * Won't work if the user has no default mail client | ||
- | This applies | + | 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/ | + | Please edit resources/ |
< | < |
en/user/favourites.1690163267.txt.gz · Last modified: 2023/07/24 01:47 by kjdon