Index: /trunk/niupepa/etc/collect.cfg
===================================================================
--- /trunk/niupepa/etc/collect.cfg	(revision 13343)
+++ /trunk/niupepa/etc/collect.cfg	(revision 13344)
@@ -1,11 +1,5 @@
-creator                sjboddie@cs.waikato.ac.nz
-maintainer             sjboddie@cs.waikato.ac.nz
+creator                greenstone@cs.waikato.ac.nz
+maintainer             greenstone@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 abexpl.dm \
-		       english.dm chinese.dm maori.dm npepa.dm 
 
 subcollection          commentaries   Filename/\.commentary$/
@@ -18,5 +12,4 @@
 defaultindex           section:text
 
-#plugin                 GMLPlug 
 plugin                 GAPlug 
 plugin                 NPPlug -create_log
@@ -27,18 +20,308 @@
 classify               NPDateList
 
+format AllowExtendedOptions true
+
 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_&gg=text&cl=_cgiargcl_&d=[abstract]>_document:iconabstract_}[link][icon][/link]</td><td>[Series]: [Title]</td><td>[Date]</td>"
-
-format                 DocumentHeading "<h3>_headerextra__toplink_{If}{[parent(Top):Title],[parent(Top):Title],[Title]}<br>{If}{[parent(Top):Date],[parent(Top):Date],[Date]}_endtoplink_"
-
-format DocumentText "<center><table width=_pagewidth_><tr><td>[Text]</td></tr></table></center>"
-
-receptionist           /cgi-bin/niupepalibrary?a=p&p=about&c=niupepa&l=mi&nw=utf-8
+format                 CL1VList "
+    <td valign=middle>
+      {If}{[doctype] eq 'Commentary',[link]_document:iconcommentary_[/link]}
+      {If}{[doctype] eq 'doc',<!-- then -->
+	  {If}{[abstract],<a href='_httpdocumentnogg_&d=[DocOID]abstract&gg=text'>_document:iconabstract_</a>}
+      }
+    </td>
+    <td valign=top>
+      {If}{[doctype] ne 'Commentary',[link][icon][/link]}
+    </td>
+    <td valign=top>
+      [Title]{If}{[numleafdocs], <i>(_numissues_([numleafdocs]))</i>}
+    </td>
+    <td valign=top>{If}{[Date],[Date]}</td>"
+
+format                 CL2DateList "<td valign=top>{If}{[abstract],<a href=_httpdocumentnogg_&cl=_cgiargcl_&d=[abstract]&gg=text>_document:iconabstract_}[link][icon][/link]</td><td>[Series]: [Title]</td><td>[Date]</td>"
+
+
+format                 DocumentHeading "
+    <script language='JavaScript'>
+
+      function news\_start\_url (docid) \{
+        var cutat=docid.indexOf('.');
+        var news\_start = docid;
+	if (cutat<0) \{
+          var newslen = news\_start.length;
+	  if (newslen>8) \{
+	    var abtail = news\_start.substr(newslen-8,8);
+            if (abtail == \"abstract\") \{
+	      news\_start = news\_start.substr(0,newslen-8);
+	    \}
+	  \}
+	\}
+	else \{
+          news\_start = docid.substr(0,cutat);
+        \}
+        document.location = \"_httpdocumentnogg_&gg=prev&d=\"+news\_start;
+      \}
+
+      function commentary\_url (docid) \{
+        var cutat=docid.indexOf('_');
+        var series = docid.substr(0,cutat);
+	var commentary = \"_httpdocumentnogg_&gg=text&d=\" + series + \"commentary\";
+        document.location = commentary
+      \}
+
+      function series\_imgtag (docid) \{
+        var cutat=docid.indexOf('c');
+        var series = docid.substr(0,cutat);
+	var imgtag = \"<img src='_httpcollection_/index/assoc/\" + series + \".dir/coveron.gif'\";
+        document.write(imgtag)
+      \}
+
+      function view\_abstract (docid) \{
+        var cutat=docid.indexOf('.');
+        var news\_start\_abstract = docid.substr(0,cutat) + \"abstract\";
+
+        var aburlstart = \"_escdocbutton_(_httpdocumentnogg_&gg=text&cl=_cgiargcl_&d=\";
+        var aburlend   = \",_document:textabstract_,_document:texticonabstract_)\";
+
+	var aburl = aburlstart + news\_start\_abstract + aburlend;
+        document.write(aburl);
+        \}
+
+      function view\_newspaper (docid) \{
+        var doclen = docid.length;
+	news\_start = docid.substr(0,doclen-8);
+
+        var nsurlstart = \"_escdocbutton_(_httpdocumentnogg_&gg=text&cl=_cgiargcl_&d=\";
+        var nsurlend   = \",_document:textviewpaper_,_document:texticonviewpaper_)\";
+
+	var nsurl = nsurlstart + news\_start + nsurlend;
+        document.write(nsurl);
+      \}
+
+      function commentary\_banner (docid) \{
+        var cutat=docid.indexOf('_');
+        var series = docid.substr(0,cutat);
+	var commentary = \"_httpdocumentnogg_&gg=text&d=\" + series + \"commentary\";
+	var imgbase = \"_httpcollection_/index/assoc/\" + series + \".dir/cover\";
+	var imgon = imgbase + \"on.gif\";
+	var imgof = imgbase + \"of.gif\";
+	var comurlstart = \"_escgsimage_(\";
+	var comurlend = \",\"+imgof+\",\"+imgon+\",comm,_document:texticoncommentary_)\";
+	var comurl = comurlstart + commentary + comurlend;
+        document.write(comurl);
+      \}
+
+      function commentary\_image (docid) \{
+        var cutat=docid.indexOf('_');
+        var series = docid.substr(0,cutat);
+	var imgbase = \"_httpcollection_/index/assoc/\" + series + \".dir/cover\";
+	var imgon = imgbase + \"on.gif\";
+	var imgtag = \"<img src='\" + imgon + \"'>\";
+        document.write(imgtag);
+      \}
+
+    </script>
+
+
+    <center><table width='_pagewidth_'><tr><td>
+
+    <!-- ##### Commentary ##### -->
+    {If}{[doctype] eq 'Commentary',
+      <table border=0 cellspacing=0 cellpadding=0>
+        <tr>
+	  <td colspan='3'>
+            <h3>    	   	    
+              [Title]
+            </h3>
+	  </td>
+	</tr>
+        <tr>
+	  <td colspan='3'>
+    	    <nobr>[DocumentButtonDetach][DocumentButtonHighlight]</nobr>
+	  </td>
+	</tr>
+      </table>
+
+    </td><td align=right>
+
+      <table border=0 cellspacing=0 cellpadding=0>
+        <tr>
+	  <td align=right>
+	      <script>series\_imgtag(\"[DocOID]\")</script>
+	  </td>
+        </tr>
+      </table>
+    }
+
+    <!-- ##### Abstract ##### -->
+    {If}{[doctype] eq 'Description',
+      <table border=0 cellspacing=0 cellpadding=0>
+        <tr>
+	  <td colspan='3'>
+            <h3>    	   	    
+	      _abstract_
+	      <a href='javascript:news\_start\_url(\"[DocOID]\")'><!--
+	        -->{If}{[parent(Top):Title], [parent(Top):Title], [Title]}<br>
+	           {If}{[parent(Top):Date], [parent(Top):Date], [Date]}
+	      </a>
+            </h3>
+	  </td>
+	</tr>
+        <tr>
+	  <td colspan='3'>
+	    <nobr>_document:imageabstractintro_<script>view\_newspaper(\"[DocOID]\")</script></nobr>
+    	    <nobr>[DocumentButtonDetach][DocumentButtonHighlight]</nobr>
+	  </td>
+	</tr>
+      </table>
+
+    </td><td align=right>
+
+      <table border=0 cellspacing=0 cellpadding=0>
+        <tr>
+	  <td align=right>
+	    {If}{[parent(Top):hascom] eq '1',
+	      <script>commentary\_banner(\"[DocOID]\")</script>
+	      <br>
+	      <small><a href='javascript:commentary\_url(\"[DocOID]\")'>_document:texticoncommentary_</a></small>
+	    ,<!-- else -->
+	      <script>commentary\_image(\"[DocOID]\")</script>
+	    }<!-- endif -->
+	  </td>
+        </tr>
+      </table>
+    }
+
+    <!-- ##### Basic Newspaper Document ##### -->
+    {If}{[doctype] eq 'doc',
+      <table border=0 cellspacing=0 cellpadding=0>
+        <tr>
+	  <td colspan='3'>
+            <h3>    	   	    
+	      <a href='javascript:news\_start\_url(\"[DocOID]\")'><!--
+                 -->{If}{[parent(Top):Title], [parent(Top):Title], [Title]}<br>
+	            {If}{[parent(Top):Date], [parent(Top):Date], [Date]}
+	      </a>
+            </h3>
+	  </td>
+	</tr>
+	<tr>
+	  <td colspan='3'>
+	    <center><b>_page_ [Title]</b> _document:textnumpages_(_numpages_)</center>
+	  </td>
+	</tr> 
+
+	<tr valign=middle>
+	  <td align=right>{If}{_document:prevarrow_,_document:prevarrow_}</td>
+	  <td align=center valign=top>_document:gotoform_</td>
+	  <td align=left>{If}{_document:nextarrow_,_document:nextarrow_}</td>
+	</tr>
+        <tr>
+          <td colspan='3'>
+	    {If}{_cgiarggg_ eq 'full',
+	      <nobr>
+	        {If}{[hastxt] eq '1',_document:imageviewtext_}
+	        {If}{[hasprevimg] eq '1',_document:imageprevimage_}
+	        {If}{[parent(Top):abstract],<script>view\_abstract(\"[DocOID]\")</script>}
+	      </nobr>
+	    }
+	    {If}{_cgiarggg_ eq 'prev',
+	      <nobr>
+	        {If}{[hastxt] eq '1',_document:imageviewtext_}
+	        {If}{[hasimg] eq '1',_document:imagefullimage_}
+	        {If}{[parent(Top):abstract],<script>view\_abstract(\"[DocOID]\")</script>}
+	      </nobr>
+	    }
+	    {If}{_cgiarggg_ eq 'text',
+	      <nobr>
+	        {If}{[hastxt] eq '1',
+	          {If}{[hasimg] eq '1',_document:imagefullimage_}
+ 	          {If}{[hasprevimg] eq '1',_document:imageprevimage_}
+	          {If}{[parent(Top):abstract],<script>view\_abstract(\"[DocOID]\")</script>}
+		, <!-- else -->
+  	          {If}{[hasimg] eq '1',_document:imagefullimage_}
+	          {If}{[parent(Top):abstract],<script>view\_abstract(\"[DocOID]\")</script>}
+		}
+	      </nobr>
+	    }
+	    {If}{_cgiarggg_,,
+	      <nobr>
+  	        {If}{[hastxt] eq '1',
+  	          {If}{[hasimg] eq '1',_document:imagefullimage_}
+	          {If}{[hasprevimg] eq '1',_document:imageprevimage_}
+	          {If}{[parent(Top):abstract],<script>view\_abstract(\"[DocOID]\")</script>}
+		, <!-- else -->
+  	          {If}{[hasimg] eq '1',_document:imagefullimage_}
+	          {If}{[parent(Top):abstract],<script>view\_abstract(\"[DocOID]\")</script>}
+		}
+	      </nobr>
+	    }
+	    <br><nobr>[DocumentButtonDetach]{If}{[hastxt] eq '1',[DocumentButtonHighlight]}</nobr>
+	  </td>
+        </tr>
+      </table>
+
+    </td><td align=right>
+
+      <table border=0 cellspacing=0 cellpadding=0>
+        <tr>
+	  <td align=right>
+	    {If}{[parent(Top):hascom] eq '1',
+	      <script>commentary\_banner(\"[DocOID]\")</script>
+	      <br>
+	      <small><a href='javascript:commentary\_url(\"[DocOID]\")'>_document:texticoncommentary_</a></small>
+	    ,<!-- else -->
+	      <script>commentary\_image(\"[DocOID]\")</script>
+	    }<!-- endif -->
+	  </td>
+        </tr>
+      </table>
+    }
+
+    </td></tr></table><br>_iconblankbar_</center>
+
+  {If}{[doctype] eq 'doc',
+    {If}{[hastxt] eq '0',
+    <center><table width=_pagewidth_>
+      <table width=_pagewidth_>
+        <tr><td align=center>
+	  {If}{[hasimg] eq '0',
+	    _missingtext_,
+            {If}{_cgiarggg_ eq 'full',<p><img src='_httpcollection_/index/assoc/_thisOID_/[Source].gif'}
+            {If}{_cgiarggg_ eq 'prev',<p><img src='_httpcollection_/index/assoc/_thisOID_/[Source]_p.gif'}
+            {If}{_cgiarggg_ eq 'text',<p><img src='_httpcollection_/index/assoc/_thisOID_/[Source]_p.gif'}
+            {If}{_cgiarggg_,,<p><img src='_httpcollection_/index/assoc/_thisOID_/[Source]_p.gif'}
+	  }
+        </td></tr>
+      </table>
+    </center>}
+  }
+<!-- end -->"
+
+format DocumentText "
+  <center><table width=_pagewidth_>
+    <table width=_pagewidth_>
+      <tr><td>
+    {If}{[doctype] eq 'doc',
+        {If}{_cgiarggg_ eq 'full',<p><img src='_httpcollection_/index/assoc/_thisOID_/[Source].gif'}
+        {If}{_cgiarggg_ eq 'prev',<p><img src='_httpcollection_/index/assoc/_thisOID_/[Source]_p.gif'}
+        {If}{_cgiarggg_ eq 'text',[Text]}
+        {If}{_cgiarggg_,,[Text]}
+    ,<!-- else -->
+        [Text]
+    }
+      </td></tr>
+    </table>
+  </center>"
+
+# add this line not because we have a custom receptionist, but because we
+# want the default language to be Maori.
+receptionist           _gwcgi_?a=p&p=about&c=niupepa&l=mi&nw=utf-8
 
 collectionmeta         collectionname      "Niupepa: Maori Newspapers"
 collectionmeta         iconcollection      "_httpprefix_/collect/niupepa/images/niupepa.gif"
 collectionmeta         iconcollectionsmall "_httpprefix_/collect/niupepa/images/niupepsm.gif"
+
+
+
