en:user:gs3_sample_interface_modifications
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:user:gs3_sample_interface_modifications [2019/09/23 22:59] – kjdon | en:user:gs3_sample_interface_modifications [2023/03/13 01:46] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | |||
+ | |||
+ | |||
====== Sample Greenstone3 Interface Modifications ====== | ====== Sample Greenstone3 Interface Modifications ====== | ||
Line 20: | Line 23: | ||
< | < | ||
- | Lets leave the collection description displayed as is, but output "This collection contains X documents, and was last built on Y". | + | This template basically outputs |
We can redefine the template as: | We can redefine the template as: | ||
Line 32: | Line 35: | ||
</ | </ | ||
- | < | + | < |
The buildDate metadata element is a timestamp, so is not user friendly. We can use one of our utility functions to format it. | The buildDate metadata element is a timestamp, so is not user friendly. We can use one of our utility functions to format it. | ||
+ | Utility functions are defined in src/ | ||
+ | In this case, we are formatting the timestamp as a date (the second 0). We could also format it as 'days ago' (using 3 instead of 0): | ||
+ | < | ||
+ | The collection contains < | ||
+ | built < | ||
+ | </ | ||
+ | |||
+ | If we want this text to be displayed in a language dependent manner, then we need to define it in the properties file, (and translate it in the appropriate language properties file), and retrieve it from there. | ||
+ | |||
+ | The default interface has these two statements already defined (in web/ | ||
+ | < | ||
+ | about.standarddescriptiondays=This collection contains {0-numdocs} documents and was last built | ||
+ | {1-numdays} days ago. | ||
+ | about.standarddescriptiondate=This collection contains {0-numdocs} documents and was last built on | ||
+ | {1-date}. | ||
+ | </ | ||
+ | |||
+ | To call them, we need to define variables for the arguments, and then pass them in as a ; separated string. | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | / | ||
+ | < | ||
+ | < | ||
+ | ' | ||
+ | </ | ||
+ | |||
+ | If we wanted to use this technique, but want to define our own text just for the collection, we can add an interface_custom.propeties file into web/ | ||
+ | Define the property there, eg: | ||
+ | < | ||
+ | descriptionextra=This very awesome collection was last built {0-days} ago, | ||
+ | and contains {1-numdocs} manuscripts. | ||
+ | </ | ||
+ | |||
+ | Then we use a similar utility function call that will look for the key in the custom file instead of the standard file: | ||
+ | < | ||
+ | < | ||
+ | / | ||
+ | </ | ||
+ | Note we have changed the order in which we use the arguments, so we need to change the order we pass them in. | ||
==== Total documents in library ==== | ==== Total documents in library ==== | ||
Line 40: | Line 83: | ||
The above section shows how to add "this collection contains X number of documents" | The above section shows how to add "this collection contains X number of documents" | ||
- | We can add up all the numDocs from each collection using ' | + | We can add up all the numDocs from each collection using ' |
< | < | ||
< | < | ||
.... | .... | ||
- | < | + | < |
+ | / | ||
< | < | ||
- | < | + | |
+ | < | ||
+ | select=" | ||
.... | .... | ||
</ | </ | ||
Line 134: | Line 180: | ||
+ | ==== Changing the header background on classifier and document pages ===== | ||
+ | Getting the gs_banner background in the header to change based on the browsing classifier page loaded, or at random for each document page loaded, can be achieved by a combination of XSL and javascript at the collection level. | ||
+ | 1. If they don't already exist, create the following subfolders within your collection folder that's located at GS3's '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | 2. In your collection' | ||
+ | 3. Unless it already exists, use a text editor to create a file called '' | ||
+ | a. Paste the following code into it: | ||
+ | < | ||
+ | $(' | ||
+ | |||
+ | // If we're on a classifier page, then header banner image will be the album image for that classifier | ||
+ | if(gs.cgiParams[" | ||
+ | |||
+ | $('# | ||
+ | } else { | ||
+ | // we're not on a classifier page (probably on a document page) | ||
+ | // In that case, the header banner image will be a randomly determined image | ||
+ | |||
+ | var numImages = n; | ||
+ | var randomNumber = Math.floor((Math.random() * numImages) + 1); | ||
+ | $('# | ||
+ | } | ||
+ | |||
+ | }); | ||
+ | </ | ||
+ | b. Adjust the line of code '' | ||
+ | |||
+ | c. If the file extension of all your images is anything other than '' | ||
+ | |||
+ | 4. Unless it already exists, use a text editor to create a file called '' | ||
+ | |||
+ | a. Next ensure this '' | ||
+ | * loads an image of your choice from your collection' | ||
+ | * refers to the '' | ||
+ | If your collection didn't have its own '' | ||
+ | |||
+ | < | ||
+ | <?xml version=" | ||
+ | < | ||
+ | xmlns: | ||
+ | xmlns: | ||
+ | xmlns: | ||
+ | xmlns: | ||
+ | xmlns: | ||
+ | extension-element-prefixes=" | ||
+ | exclude-result-prefixes=" | ||
+ | |||
+ | <!-- This template should be overridden in the collectionConfig.xml file if you want to add extra header content --> | ||
+ | < | ||
+ | |||
+ | <script type=" | ||
+ | |||
+ | < | ||
+ | | ||
+ | #gs_banner { | ||
+ | | ||
+ | padding-top: | ||
+ | } | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | b. In your header.xsl, now adjust the following line to refer to your collection folder' | ||
+ | < | ||
+ | <script type=" | ||
+ | </ | ||
+ | c. Also adjust the following line to refer to your collection folder' | ||
+ | < | ||
+ | For example, if your collection folder is called " | ||
en/user/gs3_sample_interface_modifications.txt · Last modified: 2023/03/13 01:46 by 127.0.0.1