====== 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. ]//
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.
When favourites are enabled, a star is displayed for each document in browsing and searching lists. Clicking the star will add/remove that document to/from the favourites list.
A link to the favourites list is also displayed on searching, browsing and document view pages. Clicking the link will take you to a full view of the contents of the list, where you can remove items, and email the list, or copy the list for pasting elsewhere.
===== Activating Favourites =====
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.
===== 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.
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:
(
)
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 =====
The favourites list can be emailed out using a mail server, or by using the user's existing mail client.
Mail server:
* the results will be emailed from a pre-specified address
* requires the mail server to be set up
* works for all users
User's mail client:
* doesn't require any mail server setup
* the email will be sent from the user's own address
* Won't work if the user has no default mail client
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. Set your mail server, username and password etc by uncommenting the lines and setting the proper values.
#outgoing mail setup.
# by default it will use port 25 on localhost. Uncomment and modify
# these settings to use another mail server
# sample values are for gmail setup
# Note for gmail, you will need to enable account access for less secure apps
# for this to work. https://www.google.com/settings/security/lesssecureapps
#mail.smtp.host=smtp.gmail.com
#mail.smtp.username=xxx@gmail.com
#mail.smtp.password=xxxpassword
# port number, eg for gmail: 465 (ssl) 587 (tls)
#mail.smtp.port=587
#mail.from=xxx@gmail.com
# set the following to ssl or tls
#mail.security=tls