User Tools

Site Tools


en:user:gs2_customization

Greenstone 2 Customization

Here are some tips for how to do various Greenstone 2 customizations.

Put your new logo image into greenstone2/web/images. Then modify greenstone2/macros/home.dm, replacing all instances of "gsdlhead.gif" with the name of your logo image file.

Adding a new static page

Adding a new static page to Greenstone is relatively simple and involves only customizations to macro files (found in greenstone2/macros, or greenstone2/collect/<collname>/macros). (Adding a dynamic page is more difficult and involves adding a new action to the C++ receptionist.)

Add a new static page to the library

1. Create a macro file for the new page, in gsdl/macros, eg history.dm

A very basic content might look like this:

package history

_pagetitle_ {Library History}

_content_ {
<h2>The History of Our Library</h2>
Our library was created in June 2011, by an amazing team of volunteers... 
Thanks for all your help.
}

The _pagetitle_ macro defines the title that appears in the browser window frame. The <h2> bit in content gives a header for the actual page.

The page will be styled like the rest of the library, and have the 'home help prefs' buttons along the top.

2. Tell the library about the new page

Edit greenstone2/etc/main.cfg. Add history.dm to the macrofiles list. This tells the Greenstone library to read in that macro file.

3. Link to the new page from the home page

Edit the _content_ macro in macros/home.dm, adding the link where you want it. The link will look something like

<a href="_httppagex_(history)">Library History</a>. Note that the page name (history) in the URL (_httppagex_(history) ) must correspond to the package name in the macro file (package history). It has nothing to do with the actual filename.

Add a new static page to a collection

To add a page for just one collection, then we will do the modifications in the collection's macros/extra.dm file, rather than in the main macros folder.

1. Create the new page

This is similar to above, but we can just add it into extra.dm instead of creating a new file.

package history

_pagetitle_ {Collection History}

_content_ {
<h2>The History of Our Collection</h2>
This collection was created in June 2011, by an amazing team of volunteers... 
Thanks for all your help.
}

The page will have the home/help/prefs buttons, and the collection logo/link image. To add the navigation bar (containing search and classifier buttons), add _optnavigationbar_ at the start of the _content_ macro (above the <h2>…</h2> part).

We don't need to tell the library about the macro file as extra.dm is always loaded automatically.

However, if you do want the new page to be in its own macro file, then put the file into the collection's macro folder (or into the main greenstone2/macros folder if more than one collection might use it) and you will need to edit the macrofiles line of greenstone2/etc/main.cfg as above, adding in the new filename.

2. Link to the new page

Where do you want the new page linked from? If it is just a link from the about page, then add "package about" to the extra.dm file, and copy the _content_ macro from greenstone/macros/about.dm there as well. Then add in a link to the page, using _httppagex_(history) as the URL.

For example, it may look like this:

package about

_content_ {
_optnavigationbar_

<div class="document">
_If_("_cgiargqt_" ne "1",
     _If_("_cgiargu_" ne "1",_aboutqueryform_)
    )              
_If_(_Global:collectionextra_,<p>_textabout_)
_textsubcollections_

<div class="section">
<h3>_help:textsimplehelpheading_</h3>
_help:simplehelp_
</div>

<a href="_httppagex_(history)">Collection History</a>
</div>
}

Here I have added the link at the end of the page. Note that the page name (history) in the URL (_httppagex_(history) ) must correspond to the package name in the macro file (package history). It has nothing to do with the actual filename.

en/user/gs2_customization.txt · Last modified: 2023/03/13 01:46 by 127.0.0.1