Table of Contents

This page is in the 'old' namespace, and was imported from our previous wiki. We recommend checking for more up-to-date information using the search box.

Customizing your Greenstone Library

How do I change the logo on the front page of my library ("greenstone digital library software")?

You can change the logo that appears at the top of the front page of your library by editing the home.dm file in your Greenstone "macros" folder and replacing all instances of "gsdlhead.gif" with the name of your logo image file.

Where can I get more information about customizing my Greenstone library?

Try this document. There is also a basic introduction to using CSS in Greenstone in this document.

How can I add a new page to my Greenstone library?

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

Lets look at the example of adding a new static page called mypage.

mypage.dm will contain all the content on the page. A basic mypage.dm might look something like the following.

package mypage 

_pagetitle_ {My New page}  
_content_{ <h2>My New Page</h2>
 This is the content of the page. 
}

The URL for the new page can be specified internally as _httppagex_(mypage): this maps to your library address with cgi arguments a=p&p=mypage.

If this is not a page that belongs to a collection, you should modify the 'home help prefs' buttons. You may like to add the following to your mypage.dm.

_javalinks_ {_imagehome_ _imagehelp_ _imagepref_ }  
_imagehelp_{_gsimage_(_home:httppagehomehelp_,_httpiconchelpof_,_httpiconchelpon_,help,_textimagehelp_)}  
_imagepref_{_gsimage_(_home:httppagehomepref_,_httpiconcprefof_,_httpiconcprefon_,pref,_textimagepref_)}

This will give you the standard home button, and the help and preferences buttons that link to the same pages as those on the home page. Help and preferences are different depending on whether you are in a collection or not.

If you are using the Windows local library server you probably need to restart it for the changes to take effect.

What do the cgi arguments used by library stand for?

CGI arguments encode the parameters of each page, for instance, what kind of page to display, what query to carry out etc. This page gives a list of the most common arguments and what they are used for.

How do I change the default settings for the cgi arguments?

You can set the default value of any cgi argument in the Greenstone\etc\main.cfg file. Add a line like

 cgiarg shortname=a argdefault=p

This will set the default value of argument 'a' to 'p'. To find out which argument you need to change, see this page for a list of common arguments, or look at the page source of the page in the browser.

Clicking on a link to an external resource from a Greenstone document takes the user to an intermediate page that says something like the following:

 "External Link
 The link you have selected is external to any of your currently selected
 collections. If you still wish to view this link and your browser has access to
 the Web, you can go forward to this page; otherwise use your browsers "back"
 button to return to the previous document.”

To get rid of this intermediate page, add the following to greenstone/etc/main.cfg

 cgiarg shortname=el argdefault=direct

How do I add a language selection box to each page?

You can do this by editing macros, adding some HTML elements and javascript to the pages.

In style.dm, add the following macro:

_languagescript_ {

function updatelang () \{
 newlang = document.LangForm.l.options[document.LangForm.l.selectedIndex].value;

 href=location.href;
  if (href.match(/&amp;l=[\w\-]+/)) href = href.replace(/&amp;l=[\w\-]+/, "&amp;l=" + newlang);
  else href += "&amp;l=" + newlang;
  location.href= href;
\}
</script>
}

Then add the _languagescript_ macro to the end of the _globalscripts_ macro, i.e.

_globalscripts_{
<script language="javascript" type="text/javascript">
_If_(_pagescriptextra_,_pagescriptextra_)
_imagescript_
_languagescript_
</script>
}

Create a language change form in style.dm or base.dm:

_langselectform_{
<div class=langltr style="float: right;">
 <form name="LangForm" method="get" action="_gwcgi_">
  <select name="l" onchange="updatelang();">
   
  <option value="fr" _If_("_cgiargl_" eq "fr", selected)>French
  </option>
  <option value="en" _If_("_cgiargl_" eq "en", selected)>English
  </option>
  <option value="es" _If_("_cgiargl_" eq "es", selected)>Spanish
  </option>

  </select>
 </form>
</div>
}

Add whichever languages you want to support.

Then you need to add the _langselectform_ to all pages that you want it to appear in. To add it beneath the navigation bar on each collection page, add it just at the end of the _optnavigationbar_ macro in nav_css.dm. Otherwise, you will need to add it to the content macro of each page (or to a macro called from the _content_ macro).

From Katherine (kjdon's) response to the mailing list:

You can create links between items in different collections. To do this you need to manually assign metadata to link things. What metadata you will need will depend on what you want to achieve.

Do you want to link always to the other collection? Or maybe link to something in the same collection as well?

A simple example: doc A in one collection, and doc B in another. They need to link to each other. Store for example, my.RelatedDoc metadata, for each document, and set the value to B for doc A, and A for doc B. (Usign my. as a metadata namespace for new metadata).

You will need to know the identifiers for each document. The easiest way to do this is to manually assign an identifier to each document. E.g. dc.Identifier. Then when importing, use -OIDtype assigned -OIDtype dc.Identifier options to import.pl.

In GLI, you can create a new metadata set or modify an existing one to add the new elements that you need.

Once you have a metadata element containing an id for a document to link to, then you can add a link in a format statement. If you want to link from the document itself, you can add the link in the DocumentText format statement. A link might look like:

<a href="_httpdocument_&amp;c=collname&amp;d=[my.RelatedDoc]">related document</a> collname needs to be the name of the collection the related doc is in.

Another example, have a resource A with activities B, C and D.

You could manually add eg my.NumberActivites metadata (set to 3) for A. Then to link to them, you could maybe use search. If each activity stored the resource they were made from, then if you have an index on that resource metadata, you can create a link to a search of that resource. _httpquery_&amp;c=collname&amp;q=[DocOID]&amp;other parameters. Other parameters will depend on what the index name is etc. DocOID is the id of the current document - if each resource/activity has an identifier, and that is used as the greenstone identifier, and also to link between them - then can use the current id to search for all activities based on this resource.

A useful page: How_to_format_the_output_of_your_collection - format statement elements