Index: /branches/sjboddie/niupepa/etc/collect.cfg
===================================================================
--- /branches/sjboddie/niupepa/etc/collect.cfg	(revision 1024)
+++ /branches/sjboddie/niupepa/etc/collect.cfg	(revision 1024)
@@ -0,0 +1,41 @@
+creator                sjboddie@cs.waikato.ac.nz
+maintainer             sjboddie@cs.waikato.ac.nz
+public                 true
+beta                   true
+
+macrofiles             style.dm base.dm query.dm help.dm \
+                       pref.dm about.dm home.dm document.dm \
+	               status.dm npepa.dm abexpl.dm \
+		       english.dm chinese.dm maori.dm
+
+subcollection          commentaries   Filename/\.commentary$/
+subcollection          abstracts      Filename/\.abstract$/
+subcollection          papers         !Filename/\.(abstract|commentary)$/
+indexsubcollections    papers,commentaries,abstracts papers commentaries abstracts
+defaultsubcollection   papers,commentaries,abstracts
+
+indexes                section:text
+defaultindex           section:text
+
+plugin                 GMLPlug 
+plugin                 NPPlug -create_log
+plugin                 ArcPlug 
+plugin                 RecPlug
+
+classify               NPepaList
+classify               NPDateList
+
+format                 SearchVList "<td valign=top>[link][icon][/link]</td><td>{If}{[parent:Series],[parent:Series],[Series]}: {If}{[parent(All': '):Title],[parent(All': '):Title]: }[link][Title][/link]</td>"
+
+# [link] is overridden for CL1VList in this collection (to include links/icons to abstracts as well as papers)
+format                 CL1VList "<td valign=top>[link]</td><td valign=top>[Title]{If}{[numleafdocs], <i>([numleafdocs])</i>}</td><td valign=top>{If}{[Date],[Date]}</td>"
+
+format                 CL2DateList "<td valign=top>{If}{[abstract],<a href=_httpdocument_&cl=_cgiargcl_&d=[abstract]>_document:iconabstract_}[link][icon][/link]</td><td>[Series]: [Title]</td><td>[Date]</td>"
+
+format                 DocumentHeading "<h3>{If}{[parent(Top):Title],[parent(Top):Title],[Title]}<br>{If}{[parent(Top):Date],[parent(Top):Date],[Date]}"
+
+receptionist           http://www.nzdl.org/fast-cgi-bin/niupepalibrary?a=p&p=about&c=niupepa&l=mi
+
+collectionmeta         collectionname      "Niupepa: M&auml;ori Newspapers"
+collectionmeta         iconcollection      "/gsdl/collect/niupepa/images/niupepa.gif"
+collectionmeta         iconcollectionsmall "/gsdl/collect/niupepa/images/niupepsm.gif"
Index: /branches/sjboddie/niupepa/macros/abexpl.dm
===================================================================
--- /branches/sjboddie/niupepa/macros/abexpl.dm	(revision 1024)
+++ /branches/sjboddie/niupepa/macros/abexpl.dm	(revision 1024)
@@ -0,0 +1,49 @@
+package abexpl
+
+_imagethispage_ {}
+_pagetitle_ {English Abstracts of the M&auml;ori Language Newspapers}
+
+_content_ {
+<center>
+_navigationbar_
+</center>
+<h2>English Abstracts of the M&auml;ori Language Newspapers</h2>
+<h3>Introduction</h3>
+<P>The English abstracts of the M&auml;ori language newspapers are designed to give an impression of a whole newspaper 
+issue and to guide researchers to particular topics or information for translation. Although every item in an issue 
+is noted, the abstracts do not represent a full translation of the entire contents. They summarise long items such 
+as editorials, articles, and letters, and briefly record, sometimes by a complete translation, small items such as 
+notices, advertisements, short news reports. In sum the abstracts represent an abbreviated form of a newspaper and 
+so to ensure a complete reading of any item researchers will need to refer to or seek translation of the M&auml;ori text.
+
+<P>The abstracts follow the order of  items in a newspaper and include the titles and subtitles. Apart from occasional 
+additions in square brackets to clarify or inform, the abstracts report only what is in the newspaper. Where English 
+translation is published in the paper this is noted together with a brief statement of content.
+<P>A few M&auml;ori words remain in the abstracts without translation because they are key words for researchers of M&auml;ori 
+language and culture. These are highlighted and can be clicked on for explanation in the glossary. M&auml;ori names (personal, 
+place and tribal) have been written according to contemporary spelling as far as this is known.
+<P>The English abstracts are being created by a team of researchers who, in 1999, began a three-year project into the 
+history and contents of  these newspapers. The project is funded by grants from the Marsden Fund and the Trustees of 
+the National Library. The research team, from the Department of M&auml;ori Studies at the University of Auckland, comprises 
+Professor Ngapare Hopa, Dr Jane McRae, Jenifer Curnow, and postgraduate researchers Dinah Paul, Hazel Petrie, Yvonne 
+Sutherland, and Lyn Waymouth. They work collaboratively with the History of Print Culture in New Zealand Research Project, 
+and with Professor Mark Apperley and Te Taka Keegan of the Computer Science Department, University of Waikato, who are 
+carrying out the on-line conversion of the abstracts.
+
+<h3>Glossary</h3>
+<P>M&auml;ori words
+<P>The following M&auml;ori words have been retained in the abstracts because they are key words for researchers into 
+M&auml;ori language and culture. They are used here generically and so refer to all the different kinds of texts within 
+these genres.
+<P>karakia: incantations
+<P>k&ouml;rero: narratives 
+<P>waiata: sung and recited poetry
+<P>whakapapa: genealogy
+<P>whakatauk&iuml;: sayings, set expressions
+
+<h3>Abbreviations</h3>
+CMS: Church Missionary Society
+<P>MLC: Member of the Legislative Council
+<P>MHR: Member of the House of Representatives
+<P>WMMS: Wesleyan Missionary Society
+}
Index: /branches/sjboddie/niupepa/macros/about.dm
===================================================================
--- /branches/sjboddie/niupepa/macros/about.dm	(revision 1024)
+++ /branches/sjboddie/niupepa/macros/about.dm	(revision 1024)
@@ -0,0 +1,135 @@
+package about
+
+#######################################################################
+# Icons
+#######################################################################
+
+_imagethispage_ [c=niupepa] {<img src="_httpiconhabout_" width=_widthhabout_ height=_heighthabout_>}
+
+# don't want link to 'about' page
+_imagecollection_ [c=niupepa] {<img src="_iconcollection_" border=0>}
+
+_imagemined_ [c=niupepa] {<a href="http://www.minedu.govt.nz/">_iconmined_</a>}
+
+_iconmined_ [c=niupepa] {<img src="_httpcollection_/images/mined.gif" border=0>}
+
+#######################################################################
+# English language text 
+#######################################################################
+
+_texthelpexpl_ [c=niupepa] {For help at any time, press this button at the top of the page}
+
+_textretabout_ {To return to this "about" page, click the "collection"
+icon at the top left of the page.}
+
+_textabcol_ [c=niupepa] {About this collection}
+
+_textabout_ [c=niupepa] {
+<h3>_textabcol_</h3>
+<p>This is a small but growing collection based on "Niupepa 1842-1933", a microfiche collection 
+produced by the Alexander Turnbull Library. Niupepa are periodicals published in Maori or 
+for a Maori readership. Between 1842 and 1933 there were three main types of Niupepa published: 
+Government sponsored, Iwi based and religious. By the twentieth century most Niupepa were religious 
+publications. 
+<p>
+Niupepa are an important source of information on individuals, Iwi, whaikorero, waiata, Maori 
+opinions and the development of Maori as a written language. 
+<p>
+There are four main parts to the collection:
+<ul>
+<li>facsimile images of the original images
+<li>text extracted from the newspapers (used for searching)
+<li>bibliographic commentaries for each newspaper title
+<li><a href="_httppagex_(abexpl)">English abstracts</a> for each issue
+</ul>
+<p>
+The newspapers are also available on 35mm microfilm and microfiche. They can be borrowed on 
+Interloan through your local library or they can be purchased from:
+<p>
+Copying Services<br>
+Alexander Turnbull Library<br>
+PO Box 12349<br>
+Wellington<br>
+04 474 3113<br>
+04 474 6063 (fax)<br>
+<a href="mailto:atl@natlib.govt.nz">atl@natlib.govt.nz</a>
+<p>
+Commentaries on titles provided by Gail Dallimore.
+<p>
+Digital image capture carried out by New Zealand Micrographic Services Ltd.
+<p>
+OCR work sponsored by:<br>
+_imagemined_
+<p>
+}
+
+
+
+
+#######################################################################
+# Maori language text 
+#######################################################################
+
+_texthelpexpl_ [c=niupepa,l=mi] {Kia titiro ki ng_amn_ kupu _amn_whina p_amn_whiritia t_emn_nei
+p_amn_tene kei runga r_amn_ o ia wh_amn_rangi}
+
+_textabcol_ [c=niupepa,l=mi] {He kupu whakam_amn_rama i te kohikohinga niupepa}
+
+_textabout_ [c=niupepa,l=mi] {
+<h3>_textabcol_</h3>
+<p>E puaki ana _emn_nei pukapuka i te kohinga "Niupepa 1842-1933". Ko taua kohinga he 
+mea whakaemia e te Alexander Turnball Library ki runga i te kiriata mororiki. 
+Kua t_amn_ngia aua niupepa hei p_amn_nuitanga m_amn_ te iwi M_amn_ori, _amn_, ko te nuinga kua 
+tuhia ki te reo M_amn_ori. E toru ng_amn_ kaupapa matua o ng_amn_ niupepa: he h_amn_painga m_omn_ 
+te Kawanatanga, he p_amn_nuitanga r_amn_nei n_omn_ ng_amn_ iwi M_amn_ori, he kupu whakapono r_amn_nei 
+n_omn_ ng_amn_ h_amn_hi. I te huringa o te rautau 1900 i rahi haere te kaupapa h_amn_hi.
+<p>
+Ka nui ng_amn_ taonga ka noho mai nei i ng_amn_ Niupepa: ko ng_amn_ whaikorero, ng_amn_ waiata, 
+me ng_amn_ karakia, ng_amn_ k_omn_rero o te tangata, o te Iwi, o te whenua, o ng_amn_ 
+huihuinga, o ng_amn_ whakaaro me ng_amn_ _amn_huatanga o taua w_amn_, _amn_, ko ng_amn_ tauira hoki o 
+te reo M_amn_ori.
+
+<p>
+Kei runga te kohinga "Niupepa 1842-1933" katoa i te kiriata m_omn_kito 35mm me te 
+kiriata mororiki. Ka taea te tono _emn_nei i te whare pukapuka o t_omn_ rohe, ka taea 
+r_amn_nei te hoko mai i te
+<p>
+Copying Services<br>
+Alexander Turnbull Library<br>
+PO Box 12349<br>
+Wellington<br>
+04 474 3113<br>
+04 474 6063 (fax)<br>
+<a href="mailto:atl@natlib.govt.nz">atl@natlib.govt.nz</a>
+<p>
+ko ng_amn_ mahi OCR ka tautokohia e:<br>
+_imagemined_
+<p>
+}
+
+
+##############
+# about page #
+##############
+
+
+_aboutextra_ [c=niupepa] {
+_If_("_cgiargl_" eq "mi",<a href="_httppageabout_&l=en">English language version</a><p>)
+<h3>_help:textsimplehelpheading_</h3>
+_help:simplehelp_
+}
+
+_pagetitle_ [c=niupepa] {_collectionname_: About this collection}
+
+_content_ [c=niupepa] {
+<center>
+_navigationbar_
+</center>
+_query:queryform_
+<p>
+_iconblankbar_<br>
+_aboutextra_
+<p>
+_iconblankbar_<br>
+_textabout_
+}
Index: /branches/sjboddie/niupepa/macros/npepa.dm
===================================================================
--- /branches/sjboddie/niupepa/macros/npepa.dm	(revision 1024)
+++ /branches/sjboddie/niupepa/macros/npepa.dm	(revision 1024)
@@ -0,0 +1,408 @@
+package Global
+
+_textbiblio_ [c=niupepa] {Bibliographic Details}
+_textbackground_ [c=niupepa] {Background}
+_textsubmat_ [c=niupepa] {Subject Matter}
+_textavail_ [c=niupepa] {Availability}
+_commentary_ [c=niupepa] {Commentary}
+
+_missingtext_ [c=niupepa] {Text has yet to be digitised for this page}
+
+_iconclosedbook_ [c=niupepa] {<img src="_httpimg_/np.gif" valign=top width=20 height=20 border=0 alt="_texticonclosedbook_">}
+_texticonclosedbook_ [c=niupepa] {view niupepa}
+_texticonclosedbook_ [c=niupepa,l=mi] {tirohia niupepa}
+
+_textbiblio_ [c=niupepa,l=mi] {K_omn_rero T_amn_}
+_textbackground_ [c=niupepa,l=mi] {He Whakam_amn_rama}
+_textsubmat_ [c=niupepa,l=mi] {Kaupapa}
+_textavail_ [c=niupepa,l=mi] {Nohoanga}
+_commentary_ [c=niupepa,l=mi] {Kupu Whakataki}
+
+_abstract_ [c=niupepa] {Abstract: }
+
+_abstract_ [c=niupepa,l=mi] {R_amn_popoto reo P_amn_keh_amn_: }
+
+#######################################################################
+# index option macros
+#######################################################################
+
+_stx_ [c=niupepa] {}
+
+_ab_ [c=niupepa] {english abstracts}
+_ab_ [c=niupepa,l=mi] {ng_amn_ r_amn_popoto reo P_amn_keh_amn_ anake}
+_cm_ [c=niupepa] {bibliographic commentaries}
+_cm_ [c=niupepa,l=mi] {ng_amn_ kupu whakataki anake}
+_pc_ [c=niupepa] {papers, commentaries, and abstracts}
+_pc_ [c=niupepa,l=mi] {niupepa, kupu whakataki, me ng_amn_ r_amn_popoto}
+_pp_ [c=niupepa] {newspapers}
+_pp_ [c=niupepa,l=mi] {ng_amn_ niupepa anake}
+
+
+package document
+
+#_abstract_ [c=niupepa] {Abstract<br>}
+#_abstract_ [c=niupepa,l=mi] {R_amn_popoto reo P_amn_keh_amn_<br>}
+
+_httpthiscommentary_ [c=niupepa] {}
+_httpiconthispaper_ [c=niupepa] {}
+_thispapericonwidth_ [c=niupepa] {0}
+_thispapericonheight_ [c=niupepa] {0}
+
+_01width_ {314}
+_01height_ {126}
+_03width_ {320}
+_03height_ {205}
+_04width_ {322}
+_04height_ {195}
+_05width_ {320}
+_05height_ {210}
+_15width_ {320}
+_15height_ {110}
+_18width_ {310}
+_18height_ {120}
+_19width_ {333}
+_19height_ {230}
+_25width_ {312}
+_25height_ {56}
+_36awidth_ {327}
+_36aheight_ {153}
+_39width_ {320}
+_39height_ {102}
+_40width_ {298}
+_40height_ {153}
+
+
+_iconabstract_ [c=niupepa] {<img src="_httpimg_/iabstr.gif" valign=top border=0 alt="_texticonabstract_">}
+_iconabstract_ [c=niupepa,v=1] {_texticonabstract_}
+
+_iconcommentary_ [c=niupepa] {<img src="_httpimg_/icomm.gif" valign=top border=0 alt="_texticoncommentary_">}
+_iconcommentary_ [c=niupepa,v=1] {_texticoncommentary_}
+
+# javalinks specific to this collection
+_javafullimage_ [c=niupepa] {
+        fullimage\_on = new Image(_widthefix_, _heightefix_); 
+        fullimage\_on.src = "_httpiconefion_";
+        fullimage\_off = new Image(_widthefix_, _heightefix_); 
+        fullimage\_off.src = "_httpiconefiof_";
+}
+
+_javaprevimage_ [c=niupepa] {
+        previmage\_on = new Image(_widthepix_, _widthepix_); 
+        previmage\_on.src = "_httpiconepion_";
+        previmage\_off = new Image(_widthepix_, _heightepix_); 
+        previmage\_off.src = "_httpiconepiof_";
+}
+
+_javaviewtext_ [c=niupepa] {
+        viewtext\_on = new Image(_widthetextx_, _heightetextx_); 
+        viewtext\_on.src = "_httpiconetexton_";
+        viewtext\_off = new Image(_widthetextx_, _heightetextx_); 
+        viewtext\_off.src = "_httpiconetextof_";
+}
+
+_javacommentary_ [c=niupepa] {
+	commentary\_on = new Image(_thispapericonwidth_, _thispapericonheight_);
+	commentary\_on.src = "_httpiconthispaper_on.gif";
+	commentary\_off = new Image(_thispapericonwidth_, _thispapericonheight_);
+        commentary\_off.src = "_httpiconthispaper_of.gif"; 
+}
+
+_javaviewabstract_ [c=niupepa] {
+        abstract\_on = new Image(_widtheabstrx_, _heighteabstrx_); 
+        abstract\_on.src = "_httpiconeabstron_";
+        abstract\_off = new Image(_widtheabstrx_, _heighteabstrx_); 
+        abstract\_off.src = "_httpiconeabstrof_";
+}
+
+_javaviewpaper_ [c=niupepa] {
+        paper\_on = new Image(_widthenpepax_, _heightenpepax_); 
+        paper\_on.src = "_httpiconenpepaon_";
+        paper\_off = new Image(_widthenpepax_, _heightenpepax_); 
+        paper\_off.src = "_httpiconenpepaof_";
+}
+
+_javaabstractintro_ [c=niupepa] {
+        intro\_on = new Image(_widtheintrox_, _heighteintrox_); 
+        intro\_on.src = "_httpiconeintroon_";
+        intro\_off = new Image(_widtheintrox_, _heighteintrox_); 
+        intro\_off.src = "_httpiconeintroof_";
+}
+
+_prevarrow_ [c=niupepa] {_If_(_httpprevarrow_,<a href="_httpprevarrow__1_">_iconprev_</a>)}
+_nextarrow_ [c=niupepa] {_If_(_httpnextarrow_,<a href="_httpnextarrow__1_">_iconnext_</a>)}
+
+
+_iconfullimage_ [c=niupepa] {<img name="fullimage" src="_httpiconefiof_" width="_widthefix_" height="_heightefix_" alt="_texticonfullimage_" border="0">}
+_iconfullimage_ [c=niupepa,v=1] {_texticonfullimage_}
+
+_iconprevimage_ [c=niupepa] {<img name="previmage" src="_httpiconepiof_" width="_widthepix_" height="_heightepix_" alt="_texticonprevimage_" border="0">}
+_iconprevimage_ [c=niupepa,v=1] {_texticonprevimage_}
+
+_iconviewtext_ [c=niupepa] {<img name="viewtext" src="_httpiconetextof_" width="_widthetextx_" height="_heightetextx_" alt="_texticonviewtext_" border="0">}
+_iconviewtext_[c=niupepa,v=1] {_texticonviewtext_}
+
+_iconviewabstract_ [c=niupepa] {<img name="abstract" src="_httpiconeabstrof_" width="_widtheabstrx_" height="_heighteabstrx_" alt="_texticonviewabstract_" border="0">}
+_iconviewabstract_[c=niupepa,v=1] {_texticonviewabstract_}
+
+_iconviewpaper_ [c=niupepa] {<img name="paper" src="_httpiconenpepaof_" width="_widthenpepax_" height="_heightenpepax_" alt="_texticonviewpaper_" border="0">}
+_iconviewpaper_[c=niupepa,v=1] {_texticonviewpaper_}
+
+_iconabstractintro_ [c=niupepa] {<img name="intro" src="_httpiconeintroof_" width="_widtheintrox_" height="_heighteintrox_" alt="_texticonabstractintro_" border="0">}
+_iconabstractintro_[c=niupepa,v=1] {_texticonabstractintro_}
+
+_iconthispaper_ [c=niupepa] {<img name="commentary" src="_httpiconthispaper_of.gif" 
+width="_thispapericonwidth_" height="_thispapericonheight_" border="0" alt="_texticoncommentary_">}
+
+
+_imagedetach_ [c=niupepa] {<a href="_httpcurrentdocument_&x=1&gg=_cgiarggg_" target=\_blank onMouseover = "img\_on('detach')"
+onMouseout = "img\_off('detach')">_icondetach_</a>}
+_imagedetach_[c=niupepa,v=1] {<a href="_httpcurrentdocument_&x=1&gg=cgiarggg_" target=\_blank>_texticondetach_</a><br>}
+
+
+_imagefullimage_ [c=niupepa] {<a href="_httpcurrentdocument_&gg=full" onMouseover = "img\_on('fullimage')"
+onMouseout = "img\_off('fullimage')">_iconfullimage_</a>}
+_imagefullimage_ [c=niupepa,v=1] {<a href="_httpcurrentdocument_&gg=full">_texticonfullimage_</a><br>}
+
+_imageprevimage_ [c=niupepa] {<a href="_httpcurrentdocument_&gg=prev" onMouseover = "img\_on('previmage')"
+onMouseout = "img\_off('previmage')">_iconprevimage_</a>}
+_imageprevimage_ [c=niupepa,v=1] {<a href="_httpcurrentdocument_&gg=prev">_texticonprevimage_</a><br>}
+
+_imageviewtext_ [c=niupepa] {<a href="_httpcurrentdocument_&gg=text" onMouseover = "img\_on('viewtext')"
+onMouseout = "img\_off('viewtext')">_iconviewtext_</a>}
+_imageviewtext_ [c=niupepa,v=1] {<a href="_httpcurrentdocument_&gg=text">_texticonviewtext_</a><br>}
+
+_imageviewabstract_ [c=niupepa] {<a href="_httpdocument_&gg=text&&cl=_cgiargcl_&d=_1_" onMouseover = "img\_on('abstract')"
+onMouseout = "img\_off('abstract')">_iconviewabstract_</a>}
+_imageviewabstract_ [c=niupepa,v=1] {<a href="_httpdocument_&gg=text&cl=_cgiargcl_&d=_1_">_texticonviewabstract_</a><br>}
+
+_imageviewpaper_ [c=niupepa] {<a href="_httpdocument_&cl=_cgiargcl_&d=_1_" onMouseover = "img\_on('paper')"
+onMouseout = "img\_off('paper')">_iconviewpaper_</a>}
+_imageviewpaper_ [c=niupepa,v=1] {<a href="_httpdocument_&cl=_cgiargcl_&d=_1_">_texticonviewpaper_</a><br>}
+
+_imageabstractintro_ [c=niupepa] {<a href="_httppagex_(abexpl)" onMouseover = "img\_on('intro')"
+onMouseout = "img\_off('intro')">_iconabstractintro_</a>}
+_imageabstractintro_ [c=niupepa,v=1] {<a href="_httppagex_(abexpl)">_texticonabstractintro_</a><br>}
+
+_imagethispaper_ [c=niupepa] {_If_(_httpthiscommentary_,_linkthispaper_,_nolinkthispaper_)}
+
+_linkthispaper_ [c=niupepa] {<a href="_httpthiscommentary_" 
+    onMouseover = "img\_on('commentary')" 
+    onMouseout = "img\_off('commentary')">_iconthispaper_</a>}
+_imagethispaper_ [c=niupepa,v=1] {<a href="_httpthiscommentary_">_texticoncommentary_</a><br>
+}
+
+# this occurs when we're at a commentary page - (no alt text, no link)
+_nolinkthispaper_ [c=niupepa] {<img src="_httpiconthispaper_on.gif" width="_thispapericonwidth_" 
+height="_thispapericonheight_" border="0">}
+
+
+_httpiconefiof_ [c=niupepa] {_httpimg_/efiof.gif}
+_httpiconefiof_ [c=niupepa,l=mi] {_httpimg_/mefiof.gif}
+_httpiconefion_ [c=niupepa] {_httpimg_/efion.gif}
+_httpiconefion_ [c=niupepa,l=mi] {_httpimg_/mefion.gif}
+_widthefix_ [c=niupepa] {65}
+_widthefix_ [c=niupepa,l=mi] {65}
+_heightefix_ [c=niupepa] {30}
+
+_httpiconepiof_ [c=niupepa] {_httpimg_/epiof.gif}
+_httpiconepiof_ [c=niupepa,l=mi] {_httpimg_/mepiof.gif}
+_httpiconepion_ [c=niupepa] {_httpimg_/epion.gif}
+_httpiconepion_ [c=niupepa,l=mi] {_httpimg_/mepion.gif}
+_widthepix_ [c=niupepa] {65}
+_widthepix_ [c=niupepa,l=mi] {65}
+_heightepix_ [c=niupepa] {30}
+
+_httpiconetextof_ [c=niupepa] {_httpimg_/etextof.gif}
+_httpiconetextof_ [c=niupepa,l=mi] {_httpimg_/metextof.gif}
+_httpiconetexton_ [c=niupepa] {_httpimg_/etexton.gif}
+_httpiconetexton_ [c=niupepa,l=mi] {_httpimg_/metexton.gif}
+_widthetextx_ [c=niupepa,l=mi] {65}
+_widthetextx_ [c=niupepa] {65}
+_heightetextx_ [c=niupepa] {30}
+
+_httpiconeabstrof_ [c=niupepa] {_httpimg_/eabstrof.gif}
+_httpiconeabstrof_ [c=niupepa,l=mi] {_httpimg_/mabstrof.gif}
+_httpiconeabstron_ [c=niupepa] {_httpimg_/eabstron.gif}
+_httpiconeabstron_ [c=niupepa,l=mi] {_httpimg_/mabstron.gif}
+_widtheabstrx_ [c=niupepa] {65}
+_widtheabstrx_ [c=niupepa,l=mi] {65}
+_heighteabstrx_ [c=niupepa] {30}
+
+_httpiconenpepaof_ [c=niupepa] {_httpimg_/enpepaof.gif}
+_httpiconenpepaof_ [c=niupepa,l=mi] {_httpimg_/mnpepaof.gif}
+_httpiconenpepaon_ [c=niupepa] {_httpimg_/enpepaon.gif}
+_httpiconenpepaon_ [c=niupepa,l=mi] {_httpimg_/mnpepaon.gif}
+_widthenpepax_ [c=niupepa] {65}
+_widthenpepax_ [c=niupepa,l=mi] {65}
+_heightenpepax_ [c=niupepa] {30}
+
+_httpiconeintroof_ [c=niupepa] {_httpimg_/eintroof.gif}
+_httpiconeintroof_ [c=niupepa,l=mi] {_httpimg_/mintroof.gif}
+_httpiconeintroon_ [c=niupepa] {_httpimg_/eintroon.gif}
+_httpiconeintroon_ [c=niupepa,l=mi] {_httpimg_/mintroon.gif}
+_widtheintrox_ [c=niupepa] {65}
+_widtheintrox_ [c=niupepa,l=mi] {65}
+_heighteintrox_ [c=niupepa] {30}
+
+_texticonsmalltext_ [c=niupepa] {_texticoncommentary_}
+_texticonabstract_ [c=niupepa] {View the english abstract}
+_texticonfullimage_ [c=niupepa] {View fullsize image of this page}
+_texticonprevimage_ [c=niupepa] {View preview image of this page}
+_texticonviewtext_ [c=niupepa] {View the text of this page}
+_texticoncommentary_ [c=niupepa] {View the commentary of this paper}
+_texticonviewabstract_ [c=niupepa] {View the English abstract of this issue}
+_texticonviewpaper_ [c=niupepa] {View niupepa issue}
+_texticonabstractintro_ [c=niupepa] {View introduction to English abstracts}
+
+_texticonsmalltext_ [c=niupepa,l=mi] {Tirohia kupu whakataki}
+_texticonabstract_ [c=niupepa,l=mi] {Tirohia ng_amn_ r_amn_popoto reo P_amn_keh_amn_}
+_texticonfullimage_ [c=niupepa,l=mi] {Titiro ki te whakaahua nui o t_emn_nei wh_amn_rangi niupepa}
+_texticonprevimage_ [c=niupepa,l=mi] {Titiro ki te whakaahua iti o t_emn_nei wh_amn_rangi niupepa}
+_texticonviewtext_ [c=niupepa,l=mi] {Titiro ki ng_amn_ kupu kua tuhia k_emn_ ki te rorohiko}
+_texticoncommentary_ [c=niupepa,l=mi] {Tirohia ng_amn_ kupu whakataki o t_emn_nei niupepa}
+_texticonviewabstract_ [c=niupepa,l=mi] {Tirohia te r_amn_popoto reo P_amn_keh_amn_ e p_amn_ 
+ana ki t_emn_nei w_amn_hanga}
+_texticonviewpaper_ [c=niupepa,l=mi] {Tirohia te wh_amn_rangi niupepa}
+_texticonabstractintro_ [c=niupepa,l=mi] {He whakam_amn_rama i ng_amn_ r_amn_popoto reo P_amn_keh_amn_}
+
+
+
+#################
+package help
+#################
+
+# no scope help for this collection
+_texthelpscope_ [c=niupepa] {}
+
+_textexplainbuttons_ [c=niupepa] {
+<p>
+<table cellspacing="0" cellpadding="2" border="0">
+<tr><td><img src="_httpimg_/smtext.gif" border="0"></td><td>_document:texticonsmalltext_</td></tr>
+<tr><td><img src="_httpimg_/clsdfldr.gif" border="0"></td><td>_document:texticonclosedfolder_</td></tr>
+<tr><td><img src="_httpimg_/more.gif"></td><td>_textnextbutton_</td></tr>
+<tr><td><img src="_httpimg_/less.gif"></td><td>_textprevbutton_</td></tr>
+<tr><td><img src="_httpicondtchdemo_"></td><td valign="center">_document:texticondetach_</td></tr>
+<tr><td><img src="_httpiconealltdemo_"></td><td valign="center">_document:texticonexpandtext_</td></tr>
+<tr><td><img src="_document:httpiconefiof_"></td><td valign="center">_document:texticonfullimage_</td></tr>
+<tr><td><img src="_document:httpiconepiof_"></td><td valign="center">_document:texticonprevimage_</td></tr>
+<tr><td><img src="_document:httpiconehlof_"></td><td valign="center">_document:texticonhighlight_</td></tr>
+</table>
+}
+
+_texthelptopics_ [c=niupepa,l=mi] {
+<h2 align=left>Kaupapa</h2>
+<ul>
+  <li><a href="\#finding-information">Ng_amn_ huarahi hei rapu k_omn_rero</a>
+  <li><a href="\#reading-books">Te p_amn_nui niupepa/kupu whakataki</a>
+  <li><a href="\#searching">Te rapu kupu</a>
+<ul>
+  <li><a href="\#query-terms">Ng_amn_ kupu hei rapu</a>
+  <li><a href="\#query-type">Ng_amn_ t_umn_momo rapu</a>
+  <li><a href="\#stemming">Ng_amn_ p_umn_ matua, p_umn_ iti me ng_amn_ k_umn_muri hoki</a>
+</ul>
+</ul>
+}
+
+_texthelptopics_ [c=niupepa] {
+<h2 align=left>Topics</h2>
+<ul>
+  <li><a href="\#finding-information">_textsimplehelpheading_</a>
+  <li><a href="\#reading-books">How to read the books</a>
+  <li><a href="\#searching">How to search for particular words</a>
+<ul>
+  <li><a href="\#query-terms">Search terms</a>
+  <li><a href="\#query-type">Query type</a>
+  <li><a href="\#stemming">Case sensitivity and stemming</a>
+</ul>
+</ul>
+}
+
+
+_texthelpreadingbooks_ [c=niupepa] {
+<h2>How to read Niupepa Pages</h2>
+
+<p>You can tell when you are looking at a Niupepa page because there is a picture
+of the Niupepa's insignia on the top right of the screen. Also, on the top left
+of the screen, the issue and number of the Niupepa is displayed, along with the
+publication date and some navigation buttons.
+
+<p>The lower half of the screen displays the digitized text of the Niupepa.
+It must be remembered that this text is captured by the computer from the
+pictures of the Niupepa pages. If the pages are dirty then errors will occur in the
+digitized text. View the picture of the Niupepa page to see the correct text.
+
+<p>If you click on the insignia of the Niupepa you will see the Bibliographic
+Commentary for that Niupepa. Other buttons are:
+}
+
+_texthelpreadingbooks_ [c=niupepa,l=mi] {
+<h2>Te P_amn_nui Niupepa</h2>
+
+<p>Mehemea ka kite atu koe i t_emn_tehi tohu niupepa i te taha katau o runga,
+ka m_omn_hio mai koe kei te titiro ki t_emn_tehi wh_amn_rangi o taua niupepa.
+Kei te taha maui o runga ka kite atu hoki i te nama me te w_amn_hanga o taua
+niupepa, te r_amn_ o taua niupepa, _amn_, kei reira hoki _emn_tehi p_amn_tene 
+hei whakatere i ng_amn_ wh_amn_rangi o te niupepa.
+
+<p>Kei raro r_amn_ ka kite atu i ng_amn_ k_omn_rero o t_emn_tehi wh_amn_rangi
+o te niupepa. Kia maumahara mai, ko _emn_nei kupu _amn_-rorohiko he mea hangaia 
+e te rorohiko i t_amn_na titiro ki te whakaahua o te wh_amn_rangi. Mehemea ka 
+paruparu te _amn_hua o te whakaahua, ka h_emn_ _emn_tehi kupu. Kia kite atu 
+i ng_amn_ kupu tika tirohia k_emn_tia te whakaahua o te wh_amn_rangi.
+
+<p>Mehemea ka p_amn_whiritia te tohu o te niupepa ka puta mai ng_amn_ kupu
+whakam_amn_rama m_omn_ taua niupepa. Ka p_emn_nei _emn_tehi atu p_amn_tene:
+}
+
+
+_textSeriesshort_ [c=niupepa] {access the niupepa by series}
+_textSeriesshort_ [c=niupepa,l=mi] {tirohia te whakar_amn_rangi taitara}
+_textDateshort_ [c=niupepa] {access the niupepa by date}
+_textDateshort_ [c=niupepa,l=mi] {tirohia te whakar_amn_rangi e p_amn_ ana ki te w_amn_}
+
+_textSerieslong_ [c=niupepa] {
+<p>You can <i>access the niupepa by series</i> by pressing the <i>series</i> button. 
+This brings up a list of those niupepa series which are currently in the collection. 
+Each series also contains a brief commentary which can be accessed from here.
+}
+
+_textSerieslong_ [c=niupepa,l=mi] {
+<p>Kia <i>tirohia te whakar_amn_rangi taitara</i> p_amn_whiritia te p_amn_tene 
+<i>whakar_amn_rangi taitara</i>. Ka puta mai te whakar_amn_rangi o ng_amn_
+niupepa e p_amn_ ana ki ng_amn_ taitara.
+}
+
+_textDatelong_ [c=niupepa] {
+<p>You can <i>access the niupepa by date</i> by pressing the <i>dates</i> button. 
+This brings up a list of all the niupepa issues, sorted chronologically.
+}
+
+_textDatelong_ [c=niupepa,l=mi] {<p>Kia <i>tirohia te whakar_amn_rangi e p_amn_ ana ki te w_amn_</i> p_amn_whiritia te
+p_amn_tene <i>w_amn_taka</i>. Ka puta mai te whakar_amn_rangi o ng_amn_ niupepa
+e p_amn_ ana ki te w_amn_ i puta mai ai aua niupepa.
+}
+
+_iconexplain_ [c=niupepa] {
+<table cellspacing="0" cellpadding="2" border="0">
+<tr valign="top"><td><img src="_httpimg_/np.gif" width="20" height="20" border="0"></td>
+<td>Click on a newspaper icon to read the corresponding niupepa issue</td></tr>
+<tr valign="top"><td><img src="_httpimg_/bshelf.gif" border="0" width=20 height=16></td>
+<td>Click on a bookshelf icon when browsing the niupepa series to view a list of all the issues
+in that series</td></tr>
+<tr valign="top"><td><img src="_httpimg_/iabstr.gif" border="0"></td>
+<td>Click on an abstract icon to read English abstracts of the given issue</td></tr>
+</table>
+}
+
+_iconexplain_ [c=niupepa,l=mi] {
+<table cellspacing="0" cellpadding="2" border="0">
+<tr valign="top"><td><img src="_httpimg_/np.gif" width="20" height="20" border="0"></td>
+<td>P_amn_whiritia te p_amn_tene niupepa kia puta mai ai taua niupepa</td></tr>
+<tr valign="top"><td><img src="_httpimg_/bshelf.gif" border="0" width=20 height=16></td>
+<td>P_amn_whiritia te p_amn_tene kohinga kia puta mai ai ng_amn_ niupepa o taua kohinga</td></tr>
+<tr valign="top"><td><img src="_httpimg_/iabstr.gif" border="0"></td>
+<td>P_amn_whiritia te p_amn_tene wh_amn_rangi kia puta mai ai te r_amn_popoto i te reo P_amn_keh_amn_</td></tr>
+</table>
+}
+
+
Index: /branches/sjboddie/niupepa/perllib/classify/NPDateList.pm
===================================================================
--- /branches/sjboddie/niupepa/perllib/classify/NPDateList.pm	(revision 1024)
+++ /branches/sjboddie/niupepa/perllib/classify/NPDateList.pm	(revision 1024)
@@ -0,0 +1,57 @@
+###########################################################################
+#
+# NPDateList.pm -- classifier plugin for sorting by date
+# A component of the Greenstone digital library software
+# from the New Zealand Digital Library Project at the 
+# University of Waikato, New Zealand.
+#
+# Copyright (C) 1999 New Zealand Digital Library Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+###########################################################################
+
+# overridden for niupepa as we don't want to include abstracts directly in lists
+
+package NPDateList;
+
+use DateList;
+
+sub BEGIN {
+    @ISA = ('DateList');
+}
+
+sub classify {
+    my $self = shift (@_);
+    my ($doc_obj) = @_;
+
+    # want to ignore abstracts
+    my $doctype = $doc_obj->get_metadata_element($doc_obj->get_top_section(), 'doctype');
+    return if (defined $doctype && $doctype eq 'Description');
+
+    my $doc_OID = $doc_obj->get_OID();
+    my $date = $doc_obj->get_metadata_element ($doc_obj->get_top_section(), 'Date');
+
+    # if this document doesn't contain Date element we won't 
+    # include it in this classification
+    if (defined $date && $date =~ /\d/) {
+	if (defined $self->{'list'}->{$doc_OID}) {
+	    print STDERR "WARNING: DateList::classify called multiple times for $doc_OID\n";
+	} 
+	$self->{'list'}->{$doc_OID} = $date;
+    }
+}
+
+1;
Index: /branches/sjboddie/niupepa/perllib/classify/NPepaList.pm
===================================================================
--- /branches/sjboddie/niupepa/perllib/classify/NPepaList.pm	(revision 1024)
+++ /branches/sjboddie/niupepa/perllib/classify/NPepaList.pm	(revision 1024)
@@ -0,0 +1,111 @@
+###########################################################################
+#
+# NpepaList.pm -- website plugin
+#
+# A component of the Greenstone digital library software
+# from the New Zealand Digital Library Project at the 
+# University of Waikato, New Zealand.
+#
+# Copyright (C) 1999 New Zealand Digital Library Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+###########################################################################
+
+# There should probably be a general classifier to do this kind of stuff
+
+package NPepaList;
+
+sub new {
+    my ($class, @options) = @_;
+
+    return bless {
+	'list'=>{},
+	'metaname' => 'Series',
+	'sortname' => 'Date'
+	}, $class;
+}
+
+sub init {
+    my $self = shift (@_);
+
+    $self->{'list'} = {};
+}
+
+
+sub classify {
+    my $self = shift (@_);
+    my ($doc_obj) = @_;
+
+    my $doc_OID = $doc_obj->get_OID();
+
+    # want to ignore abstracts
+    my $doctype = $doc_obj->get_metadata_element($doc_obj->get_top_section(), 'doctype');
+    return if (defined $doctype && $doctype eq 'Description');
+
+    my $date = $doc_obj->get_metadata_element($doc_obj->get_top_section(),
+					      $self->{'sortname'});
+    # commentaries have no date but we want them to sort to the top
+    $date = '00000000' unless defined $date;
+
+    my $series = $doc_obj->get_metadata_element ($doc_obj->get_top_section(),
+						 $self->{'metaname'});
+
+    if (defined $series) {
+	if (!defined $self->{'list'}->{$series}) {
+	    $self->{'list'}->{$series} = {};
+	}
+	if (defined $self->{'list'}->{$series}->{$doc_OID}) {
+	    print STDERR "WARNING: NPepaList::classify called multiple times for $doc_OID\n";
+	} 
+	$self->{'list'}->{$series}->{$doc_OID} = $date;
+    } else {
+	print STDERR "WARNING: NpepaList::classify $doc_OID has no Series metadata\n";
+    }
+}
+
+
+sub get_classify_info {
+    my $self = shift (@_);
+
+    my $classifyinfo = $self->get_entry ('Series', 'VList', 'Invisible');
+
+    foreach $series (sort keys %{$self->{'list'}}) {
+	my $cinfo = $self->get_entry ($series, 'VList');
+	foreach $OID (sort {$self->{'list'}->{$series}->{$a} 
+			    cmp $self->{'list'}->{$series}->{$b};} keys %{$self->{'list'}->{$series}}) {
+	    push (@{$cinfo->{'contains'}}, {'OID'=>$OID});
+	}
+	push (@{$classifyinfo->{'contains'}}, $cinfo);
+    }
+
+    return $classifyinfo;
+}
+
+sub get_entry {
+    my $self = shift (@_);
+    my ($title, $childtype, $thistype) = @_;
+    
+    # organise into classification structure
+    my %classifyinfo = ('childtype'=>$childtype,
+			'Title'=>$title,
+			'contains'=>[]);
+    $classifyinfo{'thistype'} = $thistype 
+	if defined $thistype && $thistype =~ /\w/;
+
+    return \%classifyinfo;
+}
+
+1;
Index: /branches/sjboddie/niupepa/perllib/plugins/NPPlug.pm
===================================================================
--- /branches/sjboddie/niupepa/perllib/plugins/NPPlug.pm	(revision 1024)
+++ /branches/sjboddie/niupepa/perllib/plugins/NPPlug.pm	(revision 1024)
@@ -0,0 +1,424 @@
+###########################################################################
+#
+# NPPlug.pm -- Plugin for the niupepa collection
+# A component of the Greenstone digital library software
+# from the New Zealand Digital Library Project at the 
+# University of Waikato, New Zealand.
+#
+# Copyright (C) 1999 New Zealand Digital Library Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+###########################################################################
+
+# The niupepa collection has a file structure as follows:
+# Each niupepa series has its own directory containing some/all 
+# of the following:
+
+# meta.txt - file contains metadata to be associated with all documents
+# in series.
+# *.issue - each issue should have a .issue file which may or may not
+# contain metadata to associate with the issue. also contains the list
+# of filenames that make up the issue (i.e. one for each page). meta.txt
+# is read before *.issue so metadata in .issue files will override that in
+# meta.txt
+# *.commentary - the commentary of the niupepa series (1 per series)
+# text/*.txt/htm - text/html files of issue pages (1 per page) -
+# text files are expected to be either .htm or .txt (lower case).
+# images/*.gif - image files of issue pages (1 per page)
+# abstracts/*.abstract - html files of issue abstracts (1 per issue) 
+
+
+package NPPlug;
+
+use BasPlug;
+use util;
+
+sub BEGIN {
+    @ISA = ('BasPlug');
+}
+
+use strict;
+
+sub print_usage {
+    print STDERR "\nIncorrect options passed to NPPlug, check your collect.cfg configuration file\n";
+
+    print STDERR "\n  usage: plugin NPPlug [options]\n\n";
+    print STDERR "  options:\n";
+    print STDERR "   -create_log            Creates a log file containing info about which portions\n";
+    print STDERR "                          of papers are missing\n";
+    print STDERR "   -logfile               Path of logfile (defaults to ./log.txt)\n\n";
+}
+
+sub new {
+    my ($class) = @_;
+    my $self = new BasPlug ();
+
+    if (!parsargv::parse(\@_, 
+			 q^create_log^, \$self->{'create_log'},
+			 q^logfile/.*/./log.txt^, \$self->{'logfile'})) {
+	&print_usage();
+	die "\n";
+    }
+
+    $self->{'commentaries'} = {};
+    $self->{'num_issues'} = 0;
+    $self->{'num_text_pages'} = 0;
+    $self->{'num_images_pages'} = 0;
+    $self->{'num_abstracts'} = 0;
+    return bless $self, $class;
+}
+
+sub is_recursive {
+    my $self = shift (@_);
+
+    return 0; # this is not a recursive plugin
+}
+
+sub begin {
+    my $self = shift (@_);
+    my ($pluginfo, $base_dir, $processor, $maxdocs) = @_;
+
+    # open up logfile
+    # note that we append to logfile as building will otherwise
+    # overwrite a file generated at import time
+    if ($self->{'create_log'}) {
+	open (LOGFILE, ">>$self->{'logfile'}") || die 
+	    "NPPlug.pm: Couldn't open log file $self->{'logfile'}\n";
+
+	my @time = localtime (time);
+
+	print LOGFILE "------------------------------------------------------------\n";
+	print LOGFILE "Log start $time[3]/$time[4]/" . (1900 + $time[5]) . "\n";
+	print LOGFILE "------------------------------------------------------------\n";
+    }
+}
+
+sub end {
+    my $self = shift (@_);
+
+    if ($self->{'create_log'}) {
+	my $numseries = 0;
+	my $numcommentaries = 0;
+
+	# record missing commentaries in logfile
+	foreach my $key (keys %{$self->{'commentaries'}}) {
+	    $numseries ++;
+	    if (!$self->{'commentaries'}->{$key}) {
+		print LOGFILE "Commentary missing for series $key\n";
+	    } else {
+		$numcommentaries ++;
+	    }
+	}
+	
+	print LOGFILE "\n\nStatistics:\n";
+	print LOGFILE "series: $numseries\n";
+	print LOGFILE "commentaries: $numcommentaries\n";
+	print LOGFILE "issues: $self->{'num_issues'}\n";
+	print LOGFILE "abstracts: $self->{'num_abstracts'}\n";
+	print LOGFILE "text pages: $self->{'num_text_pages'}\n";
+	print LOGFILE "image pages: $self->{'num_image_pages'}\n";
+
+	# close logfile
+	close LOGFILE;
+    }
+}
+
+# return number of files processed, undef if can't process
+# Note that $base_dir might be "" and that $file might 
+# include directories
+sub read {
+    my $self = shift (@_);
+    my ($pluginfo, $base_dir, $file, $metadata, $processor) = @_;
+
+    my $filename = &util::filename_cat($base_dir, $file);
+
+    # we don't want RecPlug to go recursing into the text, images or 
+    # abstracts directories
+    return 0 if (-d $filename && $filename =~ /(abstracts|images|text)/);
+
+    return 0 if $filename =~ /meta\.txt$/i;
+
+    return undef unless ($filename =~ /\.(issue|commentary)$/i && (-e $filename));
+
+    $self->{'verbosity'} = $processor->{'verbosity'};
+    print STDERR "NPPlug: processing $filename\n" if $self->{'verbosity'};
+
+    my ($dir);
+    ($dir, $file) = $filename =~ /^(.*?)([^\/\\]*)$/;
+    my ($issuekey) = $file =~ /^([^\.\_]*)/;
+
+    if ($filename =~ /\.commentary$/i) {
+	# commentary
+	return $self->process_commentary ($filename, $issuekey, $dir, $file, $processor);
+    }
+
+    my $numprocessed = 0;
+    $self->{'commentaries'}->{$issuekey} = 0 unless defined $self->{'commentaries'}->{$issuekey};
+
+    my ($abstractfile) = $file =~ /^([^\.]*)\.issue/i;
+    my $abstractOID = $abstractfile . "abstract";
+    $abstractfile .= ".abstract";
+    my $afile = &util::filename_cat($dir, "abstracts", $abstractfile);
+    my $hasabstract = 0;
+    if (-e $afile) {$hasabstract = 1;}
+    else {$abstractOID = undef;}
+
+    # process the .issue file
+    my %meta = ();
+    $numprocessed += $self->process_issue ($filename, $issuekey, $dir, $file, 
+					   $abstractOID, $processor, \%meta);
+
+    # process abstract of this issue
+    if ($hasabstract) {
+	$numprocessed += $self->process_abstract ($afile, $issuekey, $dir, 
+						  $abstractfile, $processor, \%meta);
+    }
+
+    return $numprocessed;
+}
+
+sub process_issue {
+    my $self = shift (@_);
+    my ($filename, $issuekey, $dir, $file, $abstract, $processor, $meta) = @_;
+
+    $self->{'num_issues'} ++;
+    my $doc_obj = new doc ($file, "indexed_doc");
+    my $topsection = $doc_obj->get_top_section();
+    my $cursection = $topsection;
+    $self->associate_cover_images ($doc_obj, $dir, $issuekey);
+    $doc_obj->set_metadata_element ($topsection, 'Title', $self->get_title_string($file));
+    $doc_obj->set_metadata_element ($topsection, 'abstract', $abstract) if defined $abstract;
+    $self->set_main_metadata ($doc_obj, $dir);
+
+    open (ISSUEFILE, $filename) || die "couldn't open $filename\n";
+    my $line = "";
+    while (defined ($line = <ISSUEFILE>)) {
+	next unless $line =~ /\w/;
+	chomp $line;
+	if ($line =~ /^<([^>]*)>(.*?)\s*$/) {
+	    $doc_obj->set_metadata_element ($topsection, $1, $2);
+	    $meta->{$1} = $2;
+	} else {
+	    # should be a section name
+	    $line =~ s/^\s+//;
+	    $line =~ s/\s+$//;
+	    $cursection = $doc_obj->insert_section($doc_obj->get_end_child($topsection));
+	    my ($pagenum) = $line =~ /(\d+)$/;
+	    $doc_obj->set_metadata_element($cursection, 'Title', $pagenum);
+	    $self->process_text ($dir, $line, $doc_obj, $cursection);
+	    $self->process_images ($dir, $line, $doc_obj, $cursection);
+	}
+    }
+    $file =~ s/\.issue//i;
+    $doc_obj->set_OID ($file);
+    $processor->process ($doc_obj);
+    return 1;
+}
+
+sub process_images {
+    my $self = shift (@_);
+    my ($dir, $page, $doc_obj, $cursection) = @_;
+
+    my $filename = &util::filename_cat ($dir, "images", $page);
+
+    if (-e "$filename.gif") {
+	$self->{'num_image_pages'} ++;
+	$doc_obj->set_metadata_element ($cursection, "hasimg", "1");
+	$doc_obj->set_metadata_element ($cursection, "Source", $page);
+	$doc_obj->associate_file("$filename.gif", "$page.gif", "image/gif");	
+    } elsif ($self->{'create_log'}) {
+	$doc_obj->set_metadata_element ($cursection, "hasimg", "0");
+	print LOGFILE "no fullsize image file for $page\n";
+    }
+
+    if (-e "${filename}_p.gif") {
+	$doc_obj->set_metadata_element ($cursection, "hasprevimg", "1");
+	$doc_obj->set_metadata_element ($cursection, "Source", $page);
+	$doc_obj->associate_file("${filename}_p.gif", "${page}_p.gif", "image/gif");	
+    } elsif ($self->{'create_log'}) {
+	$doc_obj->set_metadata_element ($cursection, "hasprevimg", "0");
+	print LOGFILE "no preview image file for $page\n";
+    }
+}
+
+sub process_text {
+    my $self = shift (@_);
+    my ($dir, $page, $doc_obj, $cursection) = @_;
+    my ($text);
+
+    my $filename = &util::filename_cat ($dir, "text", $page);
+    if (-e "$filename.htm") {
+	$text = $self->get_text ("$filename.htm");
+    } elsif (-e "$filename.txt") {
+	$text = $self->get_text ("$filename.txt");
+    }
+
+    if (defined $text) {
+	$self->{'num_text_pages'} ++;
+	$doc_obj->add_text ($cursection, $text);
+    } elsif ($self->{'create_log'}) {
+	print LOGFILE "no txt or htm file for $page\n";
+    }
+}
+
+sub process_abstract {
+    my $self = shift (@_);
+    my ($filename, $issuekey, $dir, $file, $processor, $meta) = @_;
+
+    my $text = $self->get_text ($filename);
+    if (defined $text) {
+	# remove html header and stuff (assumes all future abstracts
+	# are same format as those for niupepa 01)
+	$text =~ s/^.*?<b>.*?<\/b>//is;
+	
+	$self->{'num_abstracts'} ++;
+	my $doc_obj = new doc ($file, "indexed_doc");
+	my $cursection = $doc_obj->get_top_section();
+	$self->associate_cover_images ($doc_obj, $dir, $issuekey);
+	$doc_obj->set_metadata_element ($cursection, 'Title', "_abstract_ " . 
+					$self->get_title_string($file));
+	$self->set_main_metadata ($doc_obj, $dir);
+	map { $doc_obj->set_metadata_element ($cursection, $_, $meta->{$_}); } keys %$meta;
+	$doc_obj->set_metadata_element ($cursection, "doctype", "Description");
+	$doc_obj->add_text ($cursection, $text);
+	$file =~ s/\.abstract//i;
+	$doc_obj->set_OID ($file . "abstract");
+	$processor->process ($doc_obj);
+	return 1;
+    }
+
+    if ($self->{'create_log'}) {
+	print LOGFILE "abstract file $filename doesn't exist\n";
+    }
+    return 0;
+}
+
+sub process_commentary { 
+    my $self = shift (@_);
+    my ($filename, $issuekey, $dir, $file, $processor) = @_;
+
+    my $text = $self->get_text ($filename);
+
+    return 0 unless defined $text;
+
+    $self->{'commentaries'}->{$issuekey} = 1;
+    my $doc_obj = new doc ($file, "indexed_doc");
+    my $cursection = $doc_obj->get_top_section();
+    $self->associate_cover_images ($doc_obj, $dir, $issuekey);
+    $doc_obj->set_metadata_element ($cursection, 'Title', "_commentary_");
+    $self->set_main_metadata ($doc_obj, $dir);
+    $doc_obj->set_metadata_element ($cursection, "doctype", "Commentary");
+    $doc_obj->add_text ($cursection, $text);
+    $doc_obj->set_OID ($issuekey . "commentary");
+    $processor->process ($doc_obj);
+    return 1;
+}
+
+sub associate_cover_images {
+    my $self = shift (@_);
+    my ($doc_obj, $dir, $issuekey) = @_;
+
+    my $cover = &util::filename_cat ($dir, $issuekey);
+    $doc_obj->associate_file("${cover}on.gif", "${issuekey}/coveron.gif", "image/gif");
+    $doc_obj->associate_file("${cover}of.gif", "${issuekey}/coverof.gif", "image/gif");
+}
+
+# reads in the meta.txt file and sets metadata
+sub set_main_metadata {
+    my $self = shift (@_);
+    my ($doc_obj, $dir) = @_;
+
+    my $metafile = &util::filename_cat ($dir, "meta.txt");
+    return unless (-e $metafile);
+
+    if (!open (METAFILE, $metafile)) {
+	print STDERR "NPPlug: Couldn't read $metafile\n" if $self->{'verbosity'};
+	return;
+    }
+
+    my $cursection = $doc_obj->get_top_section();
+    my $line = "";
+    while (defined ($line = <METAFILE>)) {
+	next unless $line =~ /\w/;
+	chomp $line;
+	if ($line =~ /<([^>]*)>(.*)$/) {
+	    # note we're using set_metadata_element (not add_metadata_element)
+	    # this will override any previously set metadata of the same name
+	    $doc_obj->set_metadata_element ($cursection, $1, $2);
+	} elsif ($self->{'verbosity'}) {
+	    print STDERR "NPPlug: Badly formatted line in $metafile\n";
+	    print STDERR "meta.txt lines should be formatted '<metaname>metavalue'\n";
+	}
+    }
+}
+
+sub get_text {
+    my $self = shift (@_);
+    my ($filename) = @_;
+
+    if (open (FILE, $filename)) {
+	my $text = "";
+	my $line = "";
+	if ($filename =~ /\.(htm|commentary|abstract)$/i) {
+	    my $savedtext = "";
+	    my $foundbody = 0;
+	    while (defined ($line = <FILE>)) {
+		if ($line =~ s/.*?<body[^>]*>//i) {
+		    $foundbody = 1;
+		}
+		$line =~ s/(<\/?html[^>]*>|<\/?head[^>]*>|<\/p>|<\/?font[^>]*>|<\/?body[^>]*>)//ig;
+		if ($foundbody) {
+		    $text .= $line; 
+		} else {
+		    $savedtext .= $line;
+		}
+	    }
+	    close FILE;
+	    if ($foundbody) {return $text;}
+	    else {return $savedtext;}
+
+	} else {
+	    while (defined ($line = <FILE>)) {
+		$line = "<p>\n" unless $line =~ /\w/;
+		$text .= $line;
+	    }
+	    close FILE;
+	    return $text;
+	}
+
+    } else {
+	print STDERR "NPPlug: Warning: get_text() couldn't open $filename\n" 
+	    if $self->{'verbosity'};
+	return undef;
+    }
+}
+
+sub get_title_string {
+    my $self = shift (@_);
+    my ($filename) = @_;
+
+    $filename =~ s/\.(issue|abstract)$//i;
+    my ($series, $vol, $num) = split /\_/, $filename;
+    my $title = "";
+    $title .= "_vol_ $vol" if defined $vol && $vol =~ /\w/;
+    if (defined $num && $num =~ /\w/) {
+	$title .= ": " if defined $vol && $vol =~ /\w/;
+	$title .= "_num_ $num";
+    }
+    return $title;
+}
+
+1;
Index: /branches/sjboddie/niupepa/src/recpt/Makefile.in
===================================================================
--- /branches/sjboddie/niupepa/src/recpt/Makefile.in	(revision 1024)
+++ /branches/sjboddie/niupepa/src/recpt/Makefile.in	(revision 1024)
@@ -0,0 +1,157 @@
+###########################################################################
+#
+# Makefile -- Makefile for niupepalibrary
+# A component of the Greenstone digital library software
+# from the New Zealand Digital Library Project at the 
+# University of Waikato, New Zealand.
+#
+# Copyright (C) 1999 New Zealand Digital Library Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+###########################################################################
+
+GD = ../../../..
+MAINRECPTDIR = $(GD)/src/recpt
+MAINCOLSERVRDIR = $(GD)/src/colservr
+
+
+AR = ar
+CC = @CC@
+CCFLAGS = @CFLAGS@ -Wall -Wunused -pedantic -W -Woverloaded-virtual
+DEFS = -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM -DGSDLSERVER \
+       -DGSDLSERVER @DEFS@
+
+USE_FASTCGI = @USE_FASTCGI@
+ifneq ($(USE_FASTCGI), 1)
+INCLUDES = -I$(MAINRECPTDIR) -I$(MAINCOLSERVRDIR) -I$(GD)/lib \
+	   -I$(GD)/packages/mg -I$(GD)/packages/mg/lib -I$(GD)/packages/mg/src/text 
+else
+INCLUDES = -I$(MAINRECPTDIR) -I$(MAINCOLSERVRDIR) -I$(GD)/lib \
+	   -I$(GD)/packages/mg -I$(GD)/packages/mg/lib -I$(GD)/packages/mg/src/text \
+           -I$(GD)/packages/fcgi/include
+endif
+
+RANLIB = @RANLIB@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+
+GSDLOS = @gsdlos@
+
+
+COMPILE = $(CC) -c $(CCFLAGS) $(DEFS) $(INCLUDES)
+LINK = $(CC) $(LDFLAGS) -o $@
+
+.SUFFIXES:
+.SUFFIXES: .c .o
+.c.o:
+	$(COMPILE) $<
+
+.SUFFIXES: .cpp .o
+.cpp.o:
+	$(COMPILE) $< 
+
+
+HEADERS = niupepadocaction.h niupepapagedbrowserclass.h \
+	  niupepabrowsetools.h niupepavlistbrowserclass.h \
+	  niupepahlistbrowserclass.h
+
+SOURCES = niupepalibrarymain.cpp niupepadocaction.cpp \
+	  niupepapagedbrowserclass.cpp niupepabrowsetools.cpp \
+	  niupepavlistbrowserclass.cpp niupepahlistbrowserclass.cpp
+
+OBJECTS = niupepalibrarymain.o niupepadocaction.o \
+	  niupepapagedbrowserclass.o niupepabrowsetools.o \
+	  niupepavlistbrowserclass.o niupepahlistbrowserclass.o
+
+EXEC    = niupepalibrary
+
+all : $(EXEC)
+
+install: $(EXEC)
+	install -m 755 -s $(EXEC) $(GD)/cgi-bin/$(EXEC)
+
+clean:
+	rm -f $(OBJECTS) $(EXEC)
+
+depend:
+	makedepend -Y -- $(DEFS) $(INCLUDES) $(CCFLAGS) -- $(SOURCES)
+
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+
+NIUPEPALIBRARY_OBJS = $(OBJECTS) \
+    $(MAINRECPTDIR)/querytools.o \
+    $(MAINRECPTDIR)/browsetools.o \
+    $(MAINRECPTDIR)/browserclass.o \
+    $(MAINRECPTDIR)/vlistbrowserclass.o \
+    $(MAINRECPTDIR)/hlistbrowserclass.o \
+    $(MAINRECPTDIR)/datelistbrowserclass.o \
+    $(MAINRECPTDIR)/invbrowserclass.o \
+    $(MAINRECPTDIR)/pagedbrowserclass.o \
+    $(MAINRECPTDIR)/htmlbrowserclass.o \
+    $(MAINRECPTDIR)/receptionist.o \
+    $(MAINRECPTDIR)/recptconfig.o \
+    $(MAINRECPTDIR)/cgiwrapper.o \
+    $(MAINRECPTDIR)/cgiargs.o \
+    $(MAINRECPTDIR)/action.o \
+    $(MAINRECPTDIR)/converter.o \
+    $(MAINRECPTDIR)/cgiutils.o \
+    $(MAINRECPTDIR)/OIDtools.o \
+    $(MAINRECPTDIR)/htmlgen.o \
+    $(MAINRECPTDIR)/statusaction.o \
+    $(MAINRECPTDIR)/pageaction.o \
+    $(MAINRECPTDIR)/comtypes.o \
+    $(MAINRECPTDIR)/recptproto.o \
+    $(MAINRECPTDIR)/pingaction.o \
+    $(MAINRECPTDIR)/queryaction.o \
+    $(MAINRECPTDIR)/documentaction.o \
+    $(MAINRECPTDIR)/htmlutils.o \
+    $(MAINRECPTDIR)/nullproto.o \
+    $(MAINRECPTDIR)/infodbclass.o \
+    $(MAINRECPTDIR)/formattools.o \
+    $(MAINRECPTDIR)/tipaction.o \
+    $(MAINRECPTDIR)/authenaction.o \
+    $(MAINRECPTDIR)/usersaction.o \
+    $(MAINRECPTDIR)/userdb.o \
+    $(MAINRECPTDIR)/delhistoryaction.o \
+    $(MAINRECPTDIR)/historydb.o \
+    $(MAINCOLSERVRDIR)/mgq.o \
+    $(MAINCOLSERVRDIR)/querycache.o \
+    $(MAINCOLSERVRDIR)/queryinfo.o \
+    $(MAINCOLSERVRDIR)/collectserver.o \
+    $(MAINCOLSERVRDIR)/colservrconfig.o \
+    $(MAINCOLSERVRDIR)/maptools.o \
+    $(MAINCOLSERVRDIR)/filter.o \
+    $(MAINCOLSERVRDIR)/source.o \
+    $(MAINCOLSERVRDIR)/browsefilter.o \
+    $(MAINCOLSERVRDIR)/queryfilter.o \
+    $(MAINCOLSERVRDIR)/phrasequeryfilter.o \
+    $(MAINCOLSERVRDIR)/phrasesearch.o \
+    $(MAINCOLSERVRDIR)/mggdbmsource.o \
+    $(MAINCOLSERVRDIR)/mgsearch.o \
+    $(GD)/lib/gsdllib.a  \
+    $(GD)/packages/mg/src/text/libtextin.a \
+    $(GD)/packages/mg/lib/libmg.a
+
+ifneq ($(USE_FASTCGI), 1)
+NIUPEPALIB_OBJS = $(NIUPEPALIBRARY_OBJS)
+else
+NIUPEPALIB_OBJS = $(NIUPEPALIBRARY_OBJS) $(GD)/packages/fcgi/libfcgi/libfcgi.a
+endif
+
+niupepalibrary: $(NIUPEPALIB_OBJS)
+	$(LINK) $(NIUPEPALIB_OBJS) $(LIBS) 
Index: /branches/sjboddie/niupepa/src/recpt/niupepabrowsetools.cpp
===================================================================
--- /branches/sjboddie/niupepa/src/recpt/niupepabrowsetools.cpp	(revision 1024)
+++ /branches/sjboddie/niupepa/src/recpt/niupepabrowsetools.cpp	(revision 1024)
@@ -0,0 +1,186 @@
+/**********************************************************************
+ *
+ * niupepabrowsetools.cpp -- 
+ * Copyright (C) 1999  The New Zealand Digital Library Project
+ *
+ * A component of the Greenstone digital library software
+ * from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id$
+ *
+ *********************************************************************/
+
+#include "niupepabrowsetools.h"
+#include "OIDtools.h"
+#include "cgiutils.h"
+#include "browsetools.h"
+
+static void output_niupepa_controls (cgiargsclass &args, const text_tarray &ibuttons, 
+				     recptproto *collectproto, displayclass &disp,
+				     outconvertclass &outconvert, ostream &textout, 
+				     ostream &logout) {
+
+  bool hastxt = false, hasimg = false, hasprevimg = false;
+  text_tarray buttons;
+  text_t &arg_gg = args["gg"];
+  text_t &arg_d = args["d"];
+  FilterResponse_t response;
+  text_tset metadata;
+  text_t doctype;
+  metadata.insert ("hastxt");
+  metadata.insert ("hasimg");
+  metadata.insert ("hasprevimg");
+  metadata.insert ("doctype");
+  if (!get_info (arg_d, args["c"], metadata, false, collectproto, response, logout))
+    return;
+
+  if (response.docInfo[0].metadata["hastxt"].values[0] == "1") hastxt = true;
+  if (response.docInfo[0].metadata["hasimg"].values[0] == "1") hasimg = true;
+  if (response.docInfo[0].metadata["hasprevimg"].values[0] == "1") hasprevimg = true;
+
+  MetadataInfo_tmap::iterator it = response.docInfo[0].metadata.find ("doctype");
+  if (it != response.docInfo[0].metadata.end()) {
+    if (! (*it).second.values.empty()) doctype = (*it).second.values[0];
+  }
+
+  if (doctype == "Description") {
+    // abstract
+    text_t paper = substr (arg_d.begin(), (arg_d.end() - 8));
+    buttons.push_back ("_document:imageviewpaper_(" + paper + ")");
+    buttons.push_back ("_document:imageabstractintro_");
+
+  } else if (doctype == "Commentary") {
+    // commentary
+
+
+  } else {
+    // newspaper page
+
+    if (arg_gg == "full") {
+      if (hastxt) buttons.push_back ("_document:imageviewtext_");
+      if (hasprevimg) buttons.push_back ("_document:imageprevimage_");
+    } else if (arg_gg == "prev") {
+      if (hastxt) buttons.push_back ("_document:imageviewtext_");
+      if (hasimg) buttons.push_back ("_document:imagefullimage_");
+    } else {
+      if (hasimg) buttons.push_back ("_document:imagefullimage_");
+      if (hasprevimg) buttons.push_back ("_document:imageprevimage_");
+    }
+
+    // see if paper has an abstract
+    text_t abstract;
+    get_top (arg_d, abstract);
+    abstract += "abstract";
+    metadata.erase (metadata.begin(), metadata.end());
+    if (get_info (abstract, args["c"], metadata, false, collectproto, response, logout))
+      buttons.push_back ("_document:imageviewabstract_(" + abstract + "&gg=text)");
+  } 
+
+  if (args["u"] != "1") {
+
+    text_tarray::const_iterator here = ibuttons.begin();
+    text_tarray::const_iterator end = ibuttons.end();
+    
+    while (here != end) {
+      
+      if (*here == "Detach")
+	buttons.push_back ("_document:imagedetach_");
+      else if (*here == "Highlight" && arg_gg == "text") {
+	if (args["hl"] == "1") 
+	  buttons.push_back ("_document:imagenohighlight_");
+	else 
+	  buttons.push_back ("_document:imagehighlight_");
+	
+      } else if ((*here == "Expand Text") && (doctype.empty()) && (arg_gg == "text")) {
+	if (args.getintarg("gt"))
+	  buttons.push_back ("_document:imagecontracttext_");
+	else 
+	  buttons.push_back ("_document:imageexpandtext_");
+      }
+      here ++;
+    }
+    
+    here = buttons.begin();
+    end = buttons.end();
+    int count = 0;
+    while (here != end) {
+      if ((count != 0) && ((count % 3) == 0)) textout << "<br>\n";
+      textout << outconvert << disp << *here;
+      count ++;
+      here ++;
+    }
+  }
+}
+
+
+
+void output_niupepa_toc (cgiargsclass &args, browsermapclass *browsermap,
+			 formatinfo_t &formatinfo, recptproto *collectproto,
+			 displayclass &disp, outconvertclass &outconvert,
+			 ostream &textout, ostream &logout) {
+
+  int tabcount = 0;
+  text_t &arg_d = args["d"];
+  
+  // get the cover image (if there is one) and the control buttons
+  // if we're inside a book
+  if (!arg_d.empty()) {
+    textout << outconvert << disp 
+	    << "<center>\n"
+	    << "<p><table cellpadding=0 cellspacing=0 width=_pagewidth_><tr>\n"
+	    << "<td align=left valign=top>\n";
+    output_titles (args, collectproto, formatinfo, disp, outconvert, textout, logout);
+    textout << "<p>\n";
+  }
+
+  if (formatinfo.DocumentContents || arg_d.empty()) {
+    if (args.getintarg("gc") == 1) {
+      
+      // expanded table of contents
+      expanded_contents (args, tabcount, false, browsermap, formatinfo, 
+			 collectproto, disp, outconvert, textout, logout);
+    } else {
+      
+      // contracted table of contents
+      contracted_contents (args, tabcount, false, browsermap, formatinfo, 
+			   collectproto, disp, outconvert, textout, logout);
+    }
+  }
+
+  if (!arg_d.empty()) {
+    output_niupepa_controls (args, formatinfo.DocumentButtons, collectproto, 
+			     disp, outconvert, textout, logout);
+
+    textout << outconvert << disp
+	    << "</td>\n"
+	    << "<td align=right valign=top>"
+	    << "_document:imagethispaper_\n"
+	    << "</td></tr>\n"
+	    << "</table>\n"
+	    << "</center>\n";
+  }
+  textout << outconvert << disp << "_iconblankbar_\n";
+}
+
+
+
+
+
+
+
+
Index: /branches/sjboddie/niupepa/src/recpt/niupepabrowsetools.h
===================================================================
--- /branches/sjboddie/niupepa/src/recpt/niupepabrowsetools.h	(revision 1024)
+++ /branches/sjboddie/niupepa/src/recpt/niupepabrowsetools.h	(revision 1024)
@@ -0,0 +1,45 @@
+/**********************************************************************
+ *
+ * niupepabrowsetools.h -- 
+ * Copyright (C) 1999  The New Zealand Digital Library Project
+ *
+ * A component of the Greenstone digital library software
+ * from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id$
+ *
+ *********************************************************************/
+
+
+#ifndef NIUPEPABROWSETOOLS_H
+#define NIUPEPABROWSETOOLS_H
+
+#include "gsdlconf.h"
+#include "text_t.h"
+#include "cgiargs.h"
+#include "display.h"
+#include "recptproto.h"
+#include "formattools.h"
+#include "browsetools.h"
+
+void output_niupepa_toc (cgiargsclass &args, browsermapclass *browsermap,
+			 formatinfo_t &formatinfo, recptproto *collectproto,
+			 displayclass &disp, outconvertclass &outconvert,
+			 ostream &textout, ostream &logout);
+#endif
+
Index: /branches/sjboddie/niupepa/src/recpt/niupepadocaction.cpp
===================================================================
--- /branches/sjboddie/niupepa/src/recpt/niupepadocaction.cpp	(revision 1024)
+++ /branches/sjboddie/niupepa/src/recpt/niupepadocaction.cpp	(revision 1024)
@@ -0,0 +1,281 @@
+/**********************************************************************
+ *
+ * niupepadocaction.cpp -- 
+ * A component of the Greenstone digital library software
+ * from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * Copyright (C) 1999  The New Zealand Digital Library Project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id$
+ *
+ *********************************************************************/
+
+/*
+   $Log$
+   Revision 1.1  2000/03/08 20:44:50  sjboddie
+   Initial revision
+
+   Revision 1.2  1999/09/07 22:19:50  sjboddie
+   added GPL header
+
+   Revision 1.1  1999/08/29 23:35:07  sjboddie
+   niupepa receptionist
+
+ */
+
+
+#include <string.h>
+#include "niupepadocaction.h"
+#include "niupepabrowsetools.h"
+#include "OIDtools.h"
+#include "querytools.h"
+#include "unitool.h"
+
+niupepadocaction::niupepadocaction () {
+  // this action uses cgi variable "gg" as well as
+  // those used by the standard documentaction
+
+  cgiarginfo arg_ainfo;
+
+  // in this action "gg" is the format of the
+  // document to view (i.e. "text", "prev" or "full")
+  arg_ainfo.shortname = "gg";
+  arg_ainfo.longname = "document format";
+  arg_ainfo.multiplechar = true;
+  arg_ainfo.defaultstatus = cgiarginfo::weak;
+  arg_ainfo.argdefault = "text";
+  arg_ainfo.savedarginfo = cgiarginfo::must;
+  argsinfo.addarginfo (NULL, arg_ainfo);
+}
+
+niupepadocaction::~niupepadocaction () {
+}
+
+void niupepadocaction::set_java_macros (cgiargsclass &args, displayclass &disp) {
+
+  text_t javaimagescontent = "_javaextras__javacommentary__javaviewabstract__javaviewpaper__javaabstractintro_";
+
+  text_t &arg_gg = args["gg"];
+
+  if (arg_gg == "full")
+    javaimagescontent += "_javaprevimage__javaviewtext_";
+  else if (arg_gg == "prev")
+    javaimagescontent += "_javafullimage__javaviewtext_";
+  else 
+    javaimagescontent += "_javafullimage__javaprevimage_";
+
+	
+  int arg_gt = args.getintarg("gt");
+  int arg_hl = args.getintarg("hl");
+
+  text_tarray::const_iterator button_here = formatinfo.DocumentButtons.begin();
+  text_tarray::const_iterator button_end = formatinfo.DocumentButtons.end();
+
+  while (button_here != button_end) {
+    if (*button_here == "Detach") 
+      javaimagescontent += "_javadetach_";
+    else if (*button_here == "Expand Text" && arg_gg == "text") {
+      if (arg_gt == 1)
+	javaimagescontent += "_javacontracttext__javacontinue_";
+      else if (arg_gt == 2)
+	javaimagescontent += "_javacontracttext_";
+      else
+	javaimagescontent += "_javaexpandtext_";
+    } else if (*button_here == "Highlight" && arg_gg == "text") {
+      if (arg_hl == 1)
+	javaimagescontent += "_javanohighlighting_";
+      else 
+	javaimagescontent += "_javahighlighting_";
+    }
+    button_here ++;
+  }
+  disp.setmacro ("javaimagescontent", "document", javaimagescontent);
+}
+
+// define all the macros which are related to pages generated
+// by this action. we also load up the formatinfo structure 
+// here (it's used in do_action as well as here)
+void niupepadocaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
+					       recptprotolistclass *protos, ostream &logout) {
+
+
+  // define_internal_macros sets the following macros (as well as those defined
+  // by documentaction::define_internal_macros)
+
+  // _httpthiscommentary_   the link to the papers commentary
+
+  // _httpiconthispaper_    the http address of the cover image
+  
+  // _thispapericonwidth_   the width and height of the cover image
+  // _thispapericonheight_ 
+
+
+  documentaction::define_internal_macros (disp, args, protos, logout);
+
+  text_t &arg_d = args["d"];
+  text_t &collection = args["c"];
+  text_tset metadata;
+  FilterResponse_t response;
+
+  recptproto *collectproto = protos->getrecptproto (collection, logout);
+  if (collectproto == NULL) return;
+
+  if (!arg_d.empty()) {
+    // we're at document level
+
+    text_t series = substr (arg_d.begin(), findchar (arg_d.begin(), arg_d.end(), '_'));
+    if ((series.size() > 10) && (substr ((series.end()-10), series.end()) == "commentary")) {
+      series = substr (series.begin(), (series.end()-10));
+    } else {
+      text_t commentaryOID = series + "commentary";
+
+      // set _httpthiscommentary_ if commentary exists
+      if (get_info (commentaryOID, collection, metadata, false, collectproto, response, logout))
+	disp.setmacro ("httpthiscommentary", "document", "_httpdocument_&gg=text&d=" + commentaryOID);
+    }
+    // _httpiconthispaper_
+    disp.setmacro ("httpiconthispaper", "document", "_httpcollimg_/" + series + "/cover");
+
+    // _thispapericonwidth_ and _thispapericonheight_
+    disp.setmacro ("thispapericonwidth", "document", "_" + series + "width_");
+    disp.setmacro ("thispapericonheight", "document", "_" + series + "height_");
+  }
+}
+
+void niupepadocaction::output_document (const text_t &OID, cgiargsclass &args, 
+					recptproto *collectproto, displayclass &disp, 
+					outconvertclass &outconvert, ostream &textout, 
+					ostream &logout) {
+  FilterResponse_t response;
+  text_tset metadata;
+  text_t &arg_gg = args["gg"];
+  text_t &collection = args["c"];
+
+  if (arg_gg == "full") {
+    
+    // fullsize image
+
+    metadata.insert ("hasimg");
+    metadata.insert ("Source");
+    if (!get_info (OID, collection, metadata, false, collectproto, response, logout))
+      return;
+    if (response.docInfo[0].metadata["hasimg"].values[0] == "1") {
+      textout << outconvert << disp 
+	      << "<p><img src=\"_httpcollimg_/_thisOID_/" 
+	      << response.docInfo[0].metadata["Source"].values[0] << ".gif\">\n";
+    } else {
+      textout << outconvert << disp << "_missingimage_\n";
+    }
+
+  } else if (arg_gg == "prev") {
+
+    // preview image
+
+    metadata.insert ("hasprevimg");
+    metadata.insert ("Source");
+    if (!get_info (OID, collection, metadata, false, collectproto, response, logout))
+      return;
+    if (response.docInfo[0].metadata["hasprevimg"].values[0] == "1") {
+      textout << outconvert << disp 
+	      << "<center>\n"
+	      << "<p><img src=\"_httpcollimg_/_thisOID_/" 
+	      << response.docInfo[0].metadata["Source"].values[0] << "_p.gif\">\n"
+	      << "</center>\n";
+    } else {
+      textout << outconvert << disp << "_missingimage_\n";
+    }
+  } else {
+
+    // text
+    metadata.insert ("hastxt");
+    if (!get_info (OID, collection, metadata, false, collectproto, response, logout))
+      return;
+    if (response.docInfo[0].metadata["hastxt"].values[0] == "1") {
+      documentaction::output_document (OID, args, collectproto, disp, 
+				       outconvert, textout, logout);
+    } else {
+      textout << outconvert << disp << "_missingtext_\n";
+    }
+  }
+}
+
+
+// this is only overridden so we can call output_niupepa_toc instead
+// of output_toc -- we should find a tidier way to do this both here
+// and in the cstr collection
+bool niupepadocaction::do_action (cgiargsclass &args, recptprotolistclass *protos, 
+				  browsermapclass *browsers, displayclass &disp, 
+				  outconvertclass &outconvert, ostream &textout, 
+				  ostream &logout) {
+
+
+  // must have a valid collection server
+  recptproto *collectproto = protos->getrecptproto (args["c"], logout);
+  if (collectproto == NULL) {
+    logout << "documentaction::do_action called with NULL collectproto\n";
+    textout << outconvert << disp << "_document:header_\n" 
+	    << "Error: Attempt to get document without setting collection\n"
+	    << "_document:footer_\n";
+  } else {  
+    
+    text_t OID = args["d"];
+    if (OID.empty()) OID = args["cl"];
+    if (OID.empty()) {
+      textout << outconvert << disp << "Document contains no data_document:footer_\n";
+      return true;
+    }
+
+    if (formatinfo.DocumentUseHTML) {
+      
+      if (!args["d"].empty()) {
+	if (args["f"] == "1") {
+	  textout << outconvert << disp 
+		  << "<html><head></head>\n"
+		  << "<frameset rows=\"68,*\" noresize border=0>\n"
+		  << "<frame scrolling=no frameborder=0 src=\"_gwcgi_?e=_compressedoptions_&a=p&p=nav\">\n"
+		  << "<frame name=\"documenttop\" frameborder=0 src=\"_gwcgi_?e=_compressedoptions_&a=d&d=" 
+		  << args["d"] << "\">"
+		  << "<noframes>\n"
+		  << "<p>You must have a frame enabled browser to view this.</p>\n"
+		  << "</noframes>\n"
+		  << "</frameset>\n"
+		  << "</html>\n";
+	} else {
+	  output_document (OID, args, collectproto, disp, outconvert, textout, logout);	
+	}
+	return true;
+      }
+    }
+
+    textout << outconvert << disp << "_document:header_\n"
+	    << "_document:content_\n";
+      
+    // output the table of contents
+    output_niupepa_toc (args, browsers, formatinfo, collectproto, 
+			disp, outconvert, textout, logout);
+    
+    // output the document text
+    if (!args["d"].empty()) {
+      textout << "<p>\n";
+      output_document (OID, args, collectproto, disp, outconvert, textout, logout);
+    }
+
+    textout << outconvert << disp << "_document:footer_\n";
+  }
+  return true;
+}
Index: /branches/sjboddie/niupepa/src/recpt/niupepadocaction.h
===================================================================
--- /branches/sjboddie/niupepa/src/recpt/niupepadocaction.h	(revision 1024)
+++ /branches/sjboddie/niupepa/src/recpt/niupepadocaction.h	(revision 1024)
@@ -0,0 +1,62 @@
+/**********************************************************************
+ *
+ * niupepadocaction.h -- 
+ * A component of the Greenstone digital library software
+ * from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * Copyright (C) 1999  The New Zealand Digital Library Project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id$
+ *
+ *********************************************************************/
+
+
+#ifndef NIUPEPADOCACTION_H
+#define NIUPEPADOCACTION_H
+
+#include "documentaction.h"
+
+class niupepadocaction : public documentaction {
+
+protected:
+
+  void set_java_macros (cgiargsclass &args, displayclass &disp);
+
+  void output_document (const text_t &OID, cgiargsclass &args, 
+  			recptproto *collectproto, displayclass &disp, 
+  			outconvertclass &outconvert, ostream &textout, 
+  			ostream &logout);
+
+public:
+  niupepadocaction ();
+  virtual ~niupepadocaction ();
+
+  bool do_action (cgiargsclass &args, recptprotolistclass *protos, 
+		  browsermapclass *browsers, displayclass &disp, 
+		  outconvertclass &outconvert, ostream &textout, 
+		  ostream &logout);
+  
+  void define_internal_macros (displayclass &disp, cgiargsclass &args,
+			       recptprotolistclass *protos, ostream &logout);
+};
+
+
+
+#endif
+
+
Index: /branches/sjboddie/niupepa/src/recpt/niupepahlistbrowserclass.cpp
===================================================================
--- /branches/sjboddie/niupepa/src/recpt/niupepahlistbrowserclass.cpp	(revision 1024)
+++ /branches/sjboddie/niupepa/src/recpt/niupepahlistbrowserclass.cpp	(revision 1024)
@@ -0,0 +1,125 @@
+/**********************************************************************
+ *
+ * niupepahlistbrowserclass.cpp -- 
+ * Copyright (C) 1999  The New Zealand Digital Library Project
+ *
+ * A component of the Greenstone digital library software
+ * from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id$
+ *
+ *********************************************************************/
+
+/*
+   $Log$
+   Revision 1.1  2000/03/08 20:44:50  sjboddie
+   Initial revision
+
+
+ */
+
+
+#include "niupepahlistbrowserclass.h"
+#include <assert.h>
+#include "OIDtools.h"
+
+niupepahlistbrowserclass::niupepahlistbrowserclass () {
+}
+
+niupepahlistbrowserclass::~niupepahlistbrowserclass () {
+}
+
+
+// overridden for niupepa so CL2 (date classification) wraps in the correct place
+// should probably do this in a more general way some time
+int niupepahlistbrowserclass::output_section_group (ResultDocInfo_t &section, cgiargsclass &args,
+						    const text_t &/*collection*/, int colnumber, 
+						    format_t *formatlistptr, bool use_table, 
+						    text_tset &metadata, bool &getParents, 
+						    recptproto *collectproto, displayclass &disp, 
+						    outconvertclass &outconvert, ostream &textout, 
+						    ostream &logout) {
+
+  // expanded contents are going to cause some nasty recursions
+  // so we'll only continue if being passed the current section
+  if ((args["gc"] == 1) && (section.OID != args["d"])) return 0;
+
+  // get all siblings
+  FilterResponse_t response;
+  text_t &arg_cl = args["cl"];
+  get_children (section.OID + ".pr", args["c"], metadata, getParents, 
+		collectproto, response, logout);
+
+					
+  if (use_table || colnumber > 0) {
+    textout << "<table><tr><td>";
+    // get tab size
+    text_t tab; int itab;
+    disp.expandstring ("Global", "_tabwidth_", tab);
+    itab = tab.getint();
+    if (colnumber > 0) textout << outconvert << disp 
+			       << "<img src=\"_httpimg_/space.gif\" width=" 
+			       << (itab*colnumber) << ">";
+    textout << "</td>\n";
+  }
+
+  textout << "<table><tr>\n";
+
+  ResultDocInfo_tarray::iterator tsibling = response.docInfo.begin();
+  ResultDocInfo_tarray::iterator esibling = response.docInfo.end();
+
+  text_t icon, link;
+  int scount = 1;
+  while (tsibling != esibling) {
+
+    bool highlight = false;
+    textout << "<td";
+    if (scount != 4 && scount != 5 && scount != 6 &&
+	scount != 7 && scount != 10 && scount != 11)
+      textout << " colspan=2";
+    textout << ">";
+
+    text_t &doctype = (*tsibling).metadata["doctype"].values[0];
+
+    if ((*tsibling).OID == section.OID) {
+      link.clear();
+      highlight = true;
+    } else {
+      link = "<a href=\"_httpdocument_";
+      if (doctype == "classify") 
+	link += "&cl=" + (*tsibling).OID + "\">";
+      else
+	link += "&cl=" + arg_cl + "&d=" + (*tsibling).OID + "\">";
+    }
+
+    textout << outconvert << disp 
+	    << get_formatted_string (*tsibling, formatlistptr, link, icon, highlight);
+
+    textout << "</td>\n";
+    if (scount == 12)
+      textout << "</tr><tr>\n";
+
+    tsibling ++;
+    scount ++;
+  }
+
+  textout << "<td colspan=2></td></tr></table>\n";
+  if (use_table  || colnumber > 0) textout << "</tr></table>\n";
+  return 0;
+}
+
Index: /branches/sjboddie/niupepa/src/recpt/niupepahlistbrowserclass.h
===================================================================
--- /branches/sjboddie/niupepa/src/recpt/niupepahlistbrowserclass.h	(revision 1024)
+++ /branches/sjboddie/niupepa/src/recpt/niupepahlistbrowserclass.h	(revision 1024)
@@ -0,0 +1,51 @@
+/**********************************************************************
+ *
+ * niupepahlistbrowserclass.h -- 
+ * Copyright (C) 1999  The New Zealand Digital Library Project
+ *
+ * A component of the Greenstone digital library software
+ * from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id$
+ *
+ *********************************************************************/
+
+
+#ifndef NIUPEPAHLISTBROWSERCLASS_H
+#define NIUPEPAHLISTBROWSERCLASS_H
+
+#include "hlistbrowserclass.h"
+
+class niupepahlistbrowserclass : public hlistbrowserclass {
+protected:
+
+public:
+  niupepahlistbrowserclass ();
+  virtual ~niupepahlistbrowserclass ();
+
+  int output_section_group (ResultDocInfo_t &section, cgiargsclass &args,
+			    const text_t &collection, int colnumber, format_t *formatlistptr, 
+			    bool use_table, text_tset &metadata, bool &getParents,
+			    recptproto *collectproto, displayclass &disp, 
+			    outconvertclass &outconvert, ostream &textout, 
+			    ostream &logout);
+  
+};
+
+#endif
+
Index: /branches/sjboddie/niupepa/src/recpt/niupepalibrarymain.cpp
===================================================================
--- /branches/sjboddie/niupepa/src/recpt/niupepalibrarymain.cpp	(revision 1024)
+++ /branches/sjboddie/niupepa/src/recpt/niupepalibrarymain.cpp	(revision 1024)
@@ -0,0 +1,191 @@
+/**********************************************************************
+ *
+ * niupepalibrarymain.cpp -- 
+ * A component of the Greenstone digital library software
+ * from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * Copyright (C) 1999  The New Zealand Digital Library Project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id$
+ *
+ *********************************************************************/
+
+/*
+   $Log$
+   Revision 1.1  2000/03/08 20:44:49  sjboddie
+   Initial revision
+
+   Revision 1.2  1999/09/07 22:19:50  sjboddie
+   added GPL header
+
+   Revision 1.1  1999/08/29 23:35:08  sjboddie
+   niupepa receptionist
+
+ */
+
+#include "receptionist.h"
+#include "cgiwrapper.h"
+#include "nullproto.h"
+#include "collectserver.h"
+#include "filter.h"
+#include "browsefilter.h"
+#include "queryfilter.h"
+#include "infodbclass.h"
+#include "mgsearch.h"
+#include "mggdbmsource.h"
+#include "fileutil.h"
+#include <assert.h>
+
+#include "action.h"
+#include "statusaction.h"
+#include "pageaction.h"
+#include "pingaction.h"
+#include "queryaction.h"
+#include "niupepadocaction.h"
+#include "authenaction.h"
+#include "usersaction.h"
+#include "authenaction.h"
+
+#include "browserclass.h"
+#include "niupepavlistbrowserclass.h"
+#include "niupepahlistbrowserclass.h"
+#include "datelistbrowserclass.h"
+#include "invbrowserclass.h"
+#include "niupepapagedbrowserclass.h"
+#include "htmlbrowserclass.h"
+
+#include "recptconfig.h"
+
+int main () {
+  receptionist recpt;
+  nullproto nproto;
+  
+  // add a collection server
+  text_tarray collections;
+  collections.push_back ("niupepa");
+
+  // get gsdlhome (if we fail the error will be picked up later -- in
+  // cgiwrapper)
+  text_t gsdlhome;
+  site_cfg_read (gsdlhome);
+
+  text_tarray::const_iterator thiscol = collections.begin();
+  text_tarray::const_iterator endcol = collections.end();
+
+  while (thiscol != endcol) {
+
+    // this memory is created but never destroyed
+    // we're also not doing any error checking to make sure we didn't
+    // run out of memory
+    collectserver *cserver = new collectserver();
+    gdbmclass *gdbmhandler = new gdbmclass();
+    mgsearchclass *mgsearch = new mgsearchclass();
+    
+    // add a null filter
+    filterclass *filter = new filterclass ();
+    cserver->add_filter (filter);
+    
+    // add a browse filter
+    browsefilterclass *browsefilter = new browsefilterclass();
+    browsefilter->set_gdbmptr (gdbmhandler);
+    cserver->add_filter (browsefilter);
+    
+    // add a query filter
+    queryfilterclass *queryfilter = new queryfilterclass();
+    queryfilter->set_gdbmptr (gdbmhandler);
+    queryfilter->set_mgsearchptr (mgsearch);
+    cserver->add_filter (queryfilter);
+
+    // add a mg and gdbm source
+    mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
+    mggdbmsource->set_gdbmptr (gdbmhandler);
+    mggdbmsource->set_mgsearchptr (mgsearch);
+    cserver->add_source (mggdbmsource);
+    
+    // inform collection server and everything it contains about its
+    // collection name
+    cserver->configure ("collection", *thiscol);
+    
+    nproto.add_collectserver (cserver);
+    thiscol ++;
+  }
+  
+  // add the protocol to the receptionist
+  recpt.add_protocol (&nproto);
+
+  // add other converters
+  utf8inconvertclass utf8inconvert;
+  utf8outconvertclass utf8outconvert;
+  recpt.add_converter ("u", &utf8inconvert, &utf8outconvert);
+
+  if (!gsdlhome.empty()) {
+    mapinconvertclass gbinconvert;
+    gbinconvert.setmapfile (gsdlhome, "gbku", 0x25a1);
+    mapoutconvertclass gboutconvert;
+    gboutconvert.setmapfile (gsdlhome, "ugbk", 0xa1f5);
+    recpt.add_converter ("g", &gbinconvert, &gboutconvert);
+  }
+
+  // the list of actions. Note: these actions will become invalid
+  // at the end of this function.
+  statusaction astatusaction;
+  astatusaction.set_receptionist (&recpt);
+  recpt.add_action (&astatusaction);
+
+  pageaction apageaction;
+  recpt.add_action (&apageaction);
+
+  pingaction apingaction;
+  recpt.add_action (&apingaction);
+
+  queryaction aqueryaction;
+  recpt.add_action (&aqueryaction);
+
+  niupepadocaction adocumentaction;
+  recpt.add_action (&adocumentaction);
+
+  usersaction ausersaction;
+  recpt.add_action (&ausersaction);
+
+  authenaction aauthenaction;
+  aauthenaction.set_receptionist(&recpt);
+  recpt.add_action (&aauthenaction);
+
+  // list of browsers
+  niupepavlistbrowserclass avlistbrowserclass;
+  recpt.add_browser (&avlistbrowserclass);
+  recpt.setdefaultbrowser ("VList");
+
+  niupepahlistbrowserclass ahlistbrowserclass;
+  recpt.add_browser (&ahlistbrowserclass);
+
+  datelistbrowserclass adatelistbrowserclass;
+  recpt.add_browser (&adatelistbrowserclass);
+
+  invbrowserclass ainvbrowserclass;
+  recpt.add_browser (&ainvbrowserclass);
+
+  niupepapagedbrowserclass apagedbrowserclass;
+  recpt.add_browser (&apagedbrowserclass);
+
+  htmlbrowserclass ahtmlbrowserclass;
+  recpt.add_browser (&ahtmlbrowserclass);
+
+  cgiwrapper (recpt, "niupepa");
+  return 0;
+}
Index: /branches/sjboddie/niupepa/src/recpt/niupepapagedbrowserclass.cpp
===================================================================
--- /branches/sjboddie/niupepa/src/recpt/niupepapagedbrowserclass.cpp	(revision 1024)
+++ /branches/sjboddie/niupepa/src/recpt/niupepapagedbrowserclass.cpp	(revision 1024)
@@ -0,0 +1,113 @@
+/**********************************************************************
+ *
+ * niupepapagedbrowserclass.cpp -- 
+ * Copyright (C) 1999  The New Zealand Digital Library Project
+ *
+ * A component of the Greenstone digital library software
+ * from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id$
+ *
+ *********************************************************************/
+
+/*
+   $Log$
+   Revision 1.1  2000/03/08 20:44:50  sjboddie
+   Initial revision
+
+
+ */
+
+
+#include "niupepapagedbrowserclass.h"
+#include <assert.h>
+#include "OIDtools.h"
+
+niupepapagedbrowserclass::niupepapagedbrowserclass () {
+}
+
+niupepapagedbrowserclass::~niupepapagedbrowserclass () {
+}
+
+// if the "gp" (go to page) argument is set we need to set
+// the "d" argument to the corresponding page
+// also want to set "d" argument to first child if we're at
+// an 'Invisible' top level
+// this is overridden for niupepa collection as we want to set "gg"
+// argument to be 'prev' if it's text and there isn't any text,
+// 'full' if it's prev and there is no prev, 'text' if it's prev
+// and there's no full or prev, 'prev' if it's full and there's
+// no full, 'text' if it's full and there's no full or prev.
+// default to text if all else fails 
+void niupepapagedbrowserclass::processOID (cgiargsclass &args, recptproto *collectproto,
+					   ostream &logout) {
+
+  text_t &arg_d = args["d"];
+  text_t &arg_gp = args["gp"];
+  text_t &arg_gg = args["gg"];
+  text_tset metadata;
+  FilterResponse_t response;
+
+  bool hastxt = false, hasimg = false, hasprevimg = false; 
+
+  if ((!arg_d.empty()) && (!arg_gp.empty()) && (is_number (arg_gp))) {
+    text_t top;
+    get_top (arg_d, top);
+    metadata.insert ("Title");
+    get_children (top, args["c"], metadata, false, collectproto, response, logout);
+    ResultDocInfo_tarray::iterator dochere = response.docInfo.begin();
+    ResultDocInfo_tarray::iterator docend = response.docInfo.end();
+    while (dochere != docend) {
+      if ((*dochere).metadata["Title"].values[0] == arg_gp) {
+        arg_d = (*dochere).OID;
+        break;
+      }
+      dochere ++;
+    }
+
+  } else if (!arg_d.empty() && is_top(arg_d)) { // if top level doc, check if not invisible
+    metadata.insert("thistype");
+    if (get_info(arg_d, args["c"], metadata, false, collectproto, response, logout)) {
+      text_t type = response.docInfo[0].metadata["thistype"].values[0];
+      if (type=="Invisible") { // display first child
+        arg_d = arg_d + ".fc";
+      }
+    }
+  }
+
+  metadata.erase (metadata.begin(), metadata.end());
+  metadata.insert ("hastxt");
+  metadata.insert ("hasimg");
+  metadata.insert ("hasprevimg");
+  if (get_info(arg_d, args["c"], metadata, false, collectproto, response, logout)) {
+    if (response.docInfo[0].metadata["hastxt"].values[0] == "1") hastxt = true;
+    if (response.docInfo[0].metadata["hasimg"].values[0] == "1") hasimg = true;
+    if (response.docInfo[0].metadata["hasprevimg"].values[0] == "1") hasprevimg = true;
+  }
+
+  if (arg_gg == "text" && !hastxt) {
+    if (hasprevimg) arg_gg = "prev";
+    else if (hasimg) arg_gg = "full";
+  } else if (arg_gg == "prev" && !hasprevimg) {
+    if (hasimg) arg_gg = "full";
+    else arg_gg = "text";
+  } else if (arg_gg == "full" && !hasimg) {
+    if (hasprevimg) arg_gg = "prev";
+    else arg_gg = "text";
+  }
+}
Index: /branches/sjboddie/niupepa/src/recpt/niupepapagedbrowserclass.h
===================================================================
--- /branches/sjboddie/niupepa/src/recpt/niupepapagedbrowserclass.h	(revision 1024)
+++ /branches/sjboddie/niupepa/src/recpt/niupepapagedbrowserclass.h	(revision 1024)
@@ -0,0 +1,46 @@
+/**********************************************************************
+ *
+ * niupepapagedbrowserclass.h -- 
+ * Copyright (C) 1999  The New Zealand Digital Library Project
+ *
+ * A component of the Greenstone digital library software
+ * from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id$
+ *
+ *********************************************************************/
+
+
+#ifndef NIUPEPAPAGEDBROWSERCLASS_H
+#define NIUPEPAPAGEDBROWSERCLASS_H
+
+#include "pagedbrowserclass.h"
+
+class niupepapagedbrowserclass : public pagedbrowserclass {
+protected:
+
+public:
+
+  niupepapagedbrowserclass ();
+  virtual ~niupepapagedbrowserclass ();
+
+  virtual void processOID (cgiargsclass &args, recptproto *collectproto,
+			   ostream &logout);
+};
+
+#endif
Index: /branches/sjboddie/niupepa/src/recpt/niupepavlistbrowserclass.cpp
===================================================================
--- /branches/sjboddie/niupepa/src/recpt/niupepavlistbrowserclass.cpp	(revision 1024)
+++ /branches/sjboddie/niupepa/src/recpt/niupepavlistbrowserclass.cpp	(revision 1024)
@@ -0,0 +1,145 @@
+/**********************************************************************
+ *
+ * niupepavlistbrowserclass.cpp -- 
+ * Copyright (C) 1999  The New Zealand Digital Library Project
+ *
+ * A component of the Greenstone digital library software
+ * from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id$
+ *
+ *********************************************************************/
+
+/*
+   $Log$
+   Revision 1.1  2000/03/08 20:44:50  sjboddie
+   Initial revision
+
+
+ */
+
+#include "niupepavlistbrowserclass.h"
+#include <assert.h>
+#include "OIDtools.h"
+
+niupepavlistbrowserclass::niupepavlistbrowserclass () {
+}
+
+niupepavlistbrowserclass::~niupepavlistbrowserclass () {
+}
+
+void niupepavlistbrowserclass::load_metadata_defaults (text_tset &metadata) {
+  metadata.insert ("haschildren");
+  metadata.insert ("doctype");
+  metadata.insert ("abstract");
+}
+
+// get_link_icon attempts to work out what type of icon should be displayed for
+// the given section and what it should link to.
+// overridden for niupepa to add links/icons for abstracts as well as 
+// papers
+void niupepavlistbrowserclass::get_link_icon (ResultDocInfo_t &section, cgiargsclass &args,
+					      const text_t &collink, text_t &link, text_t &icon) {
+
+  link = "<a href=\"_httpdocument_" + collink;
+  icon = "_document:icontext_";
+  int haschildren = 0;
+
+  if (section.metadata.count("haschildren") > 0)
+    haschildren = section.metadata["haschildren"].values[0].getint();
+
+  text_t doctype;
+  if (section.metadata.count("doctype") > 0)
+    doctype = section.metadata["doctype"].values[0];
+
+  text_t abstract;
+  if (section.metadata.count("abstract") > 0)
+    abstract = section.metadata["abstract"].values[0];
+
+  text_t &arg_d = args["d"];
+  text_t &arg_cl = args["cl"];
+
+  if (args["a"] == "q") {
+    // query results
+    if (doctype == "Description") {
+      icon = "_document:iconabstract_";
+      link += "&gg=text";
+    } else if (doctype == "Commentary") {
+      icon = "_document:iconcommentary_";
+      link += "&gg=text";
+    } else {
+      if (is_top (section.OID)) icon = "_document:iconclosedbook_";
+      else if (haschildren == 1) icon = "_document:iconclosedfolder_";
+    }
+    link += "&cl=search&d=" + section.OID + "\">";
+
+  } else if (!arg_d.empty()) {
+    // document level
+    if (is_top(section.OID)) {
+      icon = "_document:iconopenbook_";
+      if (arg_cl == "search") link = "<a href=\"_httpquery_\">";
+      else link += "&cl=" + arg_cl + "\">";
+    
+    } else if (haschildren == 1) {
+      if ((args["gc"] == "1") || 
+	  (is_child_of (section.OID, arg_d)) ||
+	  (section.OID == arg_d)) {
+	icon = "_document:iconopenfolder_";
+	link += "&cl=" + arg_cl + "&d=" + section.OID + ".pr\">";
+      } else {
+	icon = "_document:iconclosedfolder_";
+	link += "&cl=" + arg_cl + "&d=" + section.OID + "\">";
+      }
+    } else link += "&cl=" + arg_cl + "&d=" + section.OID + "\">";
+
+  } else {
+    // classification level
+    if (haschildren == 1) {
+      if (doctype == "classify") {
+	if ((args["gc"] == "1") || 
+	    (is_child_of (section.OID, arg_cl)) || 
+	    (section.OID == arg_cl)) {
+	  icon = "_document:iconopenbookshelf_";
+	  link += "&cl=" + section.OID + ".pr\">" + icon + "</a>";
+	} else {
+	  icon = "_document:iconclosedbookshelf_";
+	  link += "&cl=" + section.OID + "\">" + icon + "</a>";
+	}
+      } else {
+	icon = "_document:iconclosedbook_";
+	if (!abstract.empty())
+	  link += "&gg=text&cl=" + arg_cl + "&d=" + abstract + "\">"
+	    + "_document:iconabstract_</a>" + link +
+	    "&cl=" + arg_cl + "&d=" + section.OID + "\">"
+	    + icon + "</a>";
+	else 
+	  link += "&cl=" + arg_cl + "&d=" + section.OID + "\">"
+	    + icon + "</a>";
+      }
+    } else {
+      if (doctype == "classify") link = "";
+      else if (doctype == "Commentary")
+	link += "&gg=text&cl=" + arg_cl + "&d=" + section.OID + "\">"
+	  + "_document:iconcommentary_</a>";
+      else if (doctype == "Description")
+	link += "&cl=" + arg_cl + "&d=" + section.OID + "\">"
+	  + "_document:iconabstract_</a>";
+      else link += "&cl=" + arg_cl + "&d=" + section.OID + "\">";
+    }
+  }
+}
Index: /branches/sjboddie/niupepa/src/recpt/niupepavlistbrowserclass.h
===================================================================
--- /branches/sjboddie/niupepa/src/recpt/niupepavlistbrowserclass.h	(revision 1024)
+++ /branches/sjboddie/niupepa/src/recpt/niupepavlistbrowserclass.h	(revision 1024)
@@ -0,0 +1,49 @@
+/**********************************************************************
+ *
+ * niupepavlistbrowserclass.h -- 
+ * Copyright (C) 1999  The New Zealand Digital Library Project
+ *
+ * A component of the Greenstone digital library software
+ * from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id$
+ *
+ *********************************************************************/
+
+
+#ifndef NIUPEPAVLISTBROWSERCLASS_H
+#define NIUPEPAVLISTBROWSERCLASS_H
+
+#include "vlistbrowserclass.h"
+
+class niupepavlistbrowserclass : public vlistbrowserclass {
+protected:
+
+public:
+  niupepavlistbrowserclass ();
+  virtual ~niupepavlistbrowserclass ();
+
+  void load_metadata_defaults (text_tset &metadata);
+
+protected:
+  
+  void get_link_icon (ResultDocInfo_t &section, cgiargsclass &args,
+		      const text_t &collink, text_t &link, text_t &icon);
+};
+
+#endif
