Index: main/trunk/model-sites-dev/pei-jones/collect/gallery/etc/collectionConfig.xml
===================================================================
--- main/trunk/model-sites-dev/pei-jones/collect/gallery/etc/collectionConfig.xml	(revision 31796)
+++ main/trunk/model-sites-dev/pei-jones/collect/gallery/etc/collectionConfig.xml	(revision 31796)
@@ -0,0 +1,473 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CollectionConfig xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <metadataList>
+    <metadata lang="en" name="creator"/>
+    <metadata lang="en" name="maintainer"/>
+    <metadata lang="en" name="public">true</metadata>
+  </metadataList>
+  <displayItemList>
+    <displayItem assigned="true" lang="en" name="description">
+
+      &lt;p&gt;
+      The Pei Jones Gallery provides a snapshot to Pei Te Hurinui Jones&apos;
+      life. It includes a small collection of personal photographs, sporting
+      photographs, Pei&apos;s artwork, images of the taonga and kÄkahu collection,
+      recent book launches and other activities.
+
+      &lt;p&gt;
+      Use the Titles tab above to browse the gallery, or else type a query into the
+      search box in the upper-righthand corner.
+
+    </displayItem>
+    <displayItem assigned="true" lang="en" name="name">Gallery</displayItem>
+    <displayItem assigned="true" lang="en" name="text">text</displayItem>
+    <displayItem assigned="true" lang="en" name="dc.Title,ex.dc.Title,Title">titles</displayItem>
+    <displayItem assigned="true" lang="en" name="Source">filenames</displayItem>
+    <displayItem assigned="true" lang="en" name="gsimg.Annotation">image annotations</displayItem>
+    <displayItem assigned="true" lang="en" name="document:text">text</displayItem>
+    <displayItem assigned="true" lang="en" name="document:ex.Title">Title</displayItem>
+    <displayItem assigned="true" lang="en" name="document:ex.Source">Source</displayItem>
+    <displayItem assigned="true" lang="en" name="document">document</displayItem>
+    <displayItem assigned="true" lang="en" name="section">section</displayItem>
+    <displayItem assigned="true" lang="en" name="shortDescription">
+      Images from the Pei Jones collection
+    </displayItem>
+  </displayItemList>
+  <format>
+    <gsf:template name="choose-title">
+      <gsf:choose-metadata>
+	<gsf:metadata name="pj.Title"/>
+	<gsf:metadata name="Title"/>
+	<gsf:default>Untitled</gsf:default>
+      </gsf:choose-metadata>
+    </gsf:template>
+  </format>
+  <search type="lucene">
+    <level name="document">
+      <displayItem lang="en" name="name">document</displayItem>
+    </level>
+    <defaultLevel name="document"/>
+    <index name="allfields"/>
+    <index name="pj.Title,Title">
+      <displayItem lang="en" name="name">title</displayItem>
+    </index>
+    <index name="pj.Catalogue-Number,pj.Catalogue-Short">
+      <displayItem lang="en" name="name">catalogue number</displayItem>
+    </index>
+    <index name="pj.Description">
+      <displayItem lang="en" name="name">description</displayItem>
+    </index>
+    <index name="pj.Date">
+      <displayItem lang="en" name="name">date</displayItem>
+    </index>
+    <index name="pj.Subject">
+      <displayItem lang="en" name="name">subject</displayItem>
+    </index>
+    <index name="pj.Physical-Location">
+      <displayItem lang="en" name="name">physical location</displayItem>
+    </index>
+    <index name="pj.Provenance">
+      <displayItem lang="en" name="name">provenance</displayItem>
+    </index>
+    <index name="pj.Tags">
+      <displayItem lang="en" name="name">tags</displayItem>
+    </index>
+    <index name="pj.Document-Type">
+      <displayItem lang="en" name="name">document type</displayItem>
+    </index>
+    <index name="pj.MSHeading">
+      <displayItem lang="en" name="name">maori subject heading</displayItem>
+    </index>
+    <index name="text">
+      <displayItem lang="en" name="name">text</displayItem>
+    </index>
+    <index name="gsimg.Annotation">
+      <displayItem lang="en" name="name">image annotations</displayItem>
+    </index>
+    <defaultIndex name="text"/>
+    <indexOption name="casefold"/>
+    <indexOption name="stem"/>
+    <searchType name="plain"/>
+    <format>
+      <gsf:template match="documentNode">
+	<td align="center" valign="top" width="104">
+	  <gsf:link type="document">
+	    <gsf:choose-metadata>
+	      <gsf:metadata name="thumbicon"/>
+	      <gsf:metadata name="srcicon"/>
+	    </gsf:choose-metadata>
+	  </gsf:link>
+	</td>
+	<td valign="top">
+	  <gsf:link type="document">
+	    <!--
+		Defined in the global format statement
+	    -->
+	    <xsl:call-template name="choose-title"/>
+	    <!--
+		<gsf:switch>
+		<gsf:metadata name="Source"/>
+		<gsf:when test="exists">
+		<br/>
+		<i>(<gsf:metadata name="Source"/>)</i>
+		</gsf:when>
+		</gsf:switch>
+	    -->
+	  </gsf:link>
+	</td>
+      </gsf:template>
+    </format>
+  </search>
+  <infodb type="jdbm"/>
+  <import>
+    <pluginList>
+      <plugin name="GreenstoneXMLPlugin"/>
+      <plugin name="TextPlugin"/>
+      <plugin name="ImagePlugin">
+	<option name="-enable_cache"/>
+	<option name="-OIDtype" value="filename"/>
+      </plugin>
+      <plugin name="MetadataXMLPlugin"/>
+      <plugin name="ArchivesInfPlugin"/>
+      <plugin name="DirectoryPlugin"/>
+    </pluginList>
+  </import>
+  <importOption name="OIDtype" value="hash_on_full_filename"/>
+  <browse>
+    <classifier name="List">
+      <option name="-metadata" value="pj.Title;Title"/>
+      <option name="-partition_type_within_level" value="approximate_size"/>
+    </classifier>
+    <!--		<classifier name="List">
+	<option name="-metadata" value="pj.Provenance"/>
+	<option name="-hfile" value="Provenance.txt"/>
+	<option name="-buttonname" value="Provenance"/>
+	</classifier>
+	<classifier name="Hierarchy">
+	<option name="-metadata" value="pj.Document-Type"/>
+	<option name="-hfile" value="DocumentType.txt"/>
+	<option name="-buttonname" value="DocType"/>
+	</classifier>
+	<classifier name="Hierarchy">
+	<option name="-metadata" value="pj.MSHeading"/>
+	<option name="-hfile" value="MaoriSubjectHeading.txt"/>
+	<option name="-buttonname" value="MSH"/>
+	</classifier>-->
+    <format>
+      <gsf:template match="documentNode">
+	<td align="center" valign="top" width="104">
+	  <gsf:link type="document">
+	    <gsf:choose-metadata>
+	      <gsf:metadata name="thumbicon"/>
+	      <gsf:metadata name="srcicon"/>
+	    </gsf:choose-metadata>
+	  </gsf:link>
+	</td>
+	<td valign="top">
+	  <gsf:link type="document">
+	    <!--
+		Defined in the global format statement
+	    -->
+	    <xsl:call-template name="choose-title"/>
+	    <!--
+		<gsf:switch>
+		<gsf:metadata name="Source"/>
+		<gsf:when test="exists">
+		<br/>
+		<i>(<gsf:metadata name="Source"/>)</i>
+		</gsf:when>
+		</gsf:switch>
+	    -->
+	  </gsf:link>
+	</td>
+      </gsf:template>
+    </format>
+  </browse>
+  <display>
+    <format>
+      <gsf:option name="disableZoom" value="true"/>
+      <gsf:option name="disableSearchTermHighlighting" value="true"/>
+      <!--
+	  Overwriting this template allows you to change the heading of the document.
+      -->
+      <gsf:template name="documentHeading">
+	<span rect="norect" style="display: inline-block; width: 110px; font-weight: bold; font-size: 120%;">
+	  <xsl:call-template name="choose-title"/>
+	</span>
+      </gsf:template>
+
+      <!--
+	  <gsf:template name="documentHeading">
+	  <span style="font-weight:bold; font-size: 120%;">
+	  <xsl:call-template name="choose-title"/>
+	  </span>
+	  </gsf:template>
+      -->
+      <!--
+	  Overwriting this template can be used to redefine the content of the whole document. This is useful for simple documents, but not recommended for more complex documents (e.g. hierachical and paged documents) as it can prevent any sub-sections from showing.
+      -->
+
+      <!-- copied from taonga-->
+      <gsf:template name="documentContent">
+	<div rect="norect" style="float: left; margin: 15px;">
+	  <gsf:link type="source">
+	    <gsf:image type="screen" style="border: 1px solid #000;"/>
+	  </gsf:link>
+	</div>
+	<xsl:call-template name="pjMetadataDisplayTable"/>
+	<div style="clear:left;">
+	  <gsf:if-metadata-exists><gsf:metadata name="NoText"/><gsf:else><gsf:text/></gsf:else></gsf:if-metadata-exists>
+	</div>
+	<br clear="all"/>
+      </gsf:template>
+
+      <gsf:template name="documentContentOld">
+	<!--
+	    Checks the format of the current GSDL document - in this case, either "Photographs", "Books" or "Scanned Documents".
+	-->
+	<xsl:variable name="format">
+	  <gsf:metadata name="pj.Format"/>
+	  <gsf:default>""</gsf:default>
+	</xsl:variable>
+	<xsl:choose>
+	  <!--
+	      If the current document is in the format of a (Realistic) Book, then link the image on the page to the matching realistic book for people to view/read.
+	  -->
+	  <xsl:when test="contains($format,'Books')">
+	    <xsl:variable name="BookName">
+	      <gsf:choose-metadata>
+		<gsf:metadata name="Title"/>
+		<gsf:default>""</gsf:default>
+	      </gsf:choose-metadata>
+	    </xsl:variable>
+	    <xsl:variable name="NewBookName">
+	      <xsl:call-template name="replace-function">
+		<xsl:with-param name="stringIn" select="string($BookName)"/>
+		<xsl:with-param name="charsIn" select="' '"/>
+		<xsl:with-param name="charsOut" select="'_'"/>
+	      </xsl:call-template>
+	    </xsl:variable>
+	    <xsl:variable name="url">
+	      <xsl:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name= 'httpPath']"/>
+	      <xsl:text>/books/</xsl:text>
+	      <xsl:value-of select="$NewBookName"/>
+	      <xsl:text>/index.html</xsl:text>
+	    </xsl:variable>
+	    <a href="{$url}" target="_blank">
+	      <xsl:call-template name="wrappedSectionImage"/>
+	    </a>
+	    <br/>
+	    <br/>
+	    <p>Click on the image above to view/read the book.</p>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <!--						<xsl:if test="contains($format,'Photographs')">
+		<script text="text/javascript">
+		<xsl:text disable-output-escaping="yes">$(window).load(function(){
+
+var found = $(".zoomImage").find("img");
+var imageJson;
+var matches;
+var existing_notes;
+var img;
+
+if(found.length != 0){
+img = found[0];
+}else{
+
+var imageDivName = "#image" + gs.cgiParams.d;
+
+found = $(imageDivName).find("img");
+
+if(found.length != 0)
+img = found[0];
+}
+
+if(img !== null &amp;&amp; img !== undefined){
+
+imageJson = '</xsl:text>
+<gsf:metadata name="gsimg.Annotation"/>
+<xsl:text disable-output-escaping="yes">';
+
+matches = getImageNoteMatches(imageJson);
+existing_notes = getExistingImageNotes(matches, 0);
+
+$(img).attr('id','toAnnotate');
+
+$('#toAnnotate').annotateImage({</xsl:text>
+<xsl:choose>
+<xsl:when test="/page/pageRequest/userInformation/@username and /page/pageRequest/userInformation/@editEnabled = 'true'">
+<xsl:text disable-output-escaping="yes">editable: true,</xsl:text>
+</xsl:when>
+<xsl:otherwise>
+<xsl:text disable-output-escaping="yes">editable: false,</xsl:text>
+</xsl:otherwise>
+</xsl:choose>
+<xsl:text disable-output-escaping="yes">useAjax: true,
+notes: existing_notes
+});
+}else{
+console.log("ERROR: Image could not be found for annotating");
+}
+
+});</xsl:text>
+</script>
+</xsl:if>-->
+	    <xsl:call-template name="wrappedSectionImage"/>
+	    <br/>
+	    <br/>
+	    <xsl:call-template name="wrappedSectionText"/>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </gsf:template>
+      <!--
+	  This is a template for replacing characters in a string, e.g. replacing spaces with underscore characters.
+      -->
+      <xsl:template name="replace-function">
+	<xsl:param name="stringIn"/>
+	<xsl:param name="charsIn"/>
+	<xsl:param name="charsOut"/>
+	<xsl:choose>
+	  <xsl:when test="contains($stringIn,$charsIn)">
+	    <xsl:value-of select="concat(substring-before($stringIn,$charsIn),$charsOut)"/>
+	    <xsl:call-template name="replace-function">
+	      <xsl:with-param name="stringIn" select="substring-after($stringIn,$charsIn)"/>
+	      <xsl:with-param name="charsIn" select="$charsIn"/>
+	      <xsl:with-param name="charsOut" select="$charsOut"/>
+	    </xsl:call-template>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:value-of select="$stringIn"/>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:template>
+      <!--
+	  Overwriting this template can be used to change the content of section headings.
+      -->
+      <!--
+	  <gsf:template name="sectionHeading">
+	  <xsl:call-template name="choose-title"/>
+	  </gsf:template>
+      -->
+      <!--
+	  This template is called when displaying the paged scanned documents in the library collection. Controls the display of the area where the user collapses/expands pages.
+      -->
+      <gsf:template name="topLevelSectionContent">
+	<!--
+	    Create a variable to store numpages.
+	-->
+	<xsl:variable name="NumPages">
+	  <gsf:choose-metadata>
+	    <gsf:metadata name="NumPages"/>
+	    <gsf:default>0</gsf:default>
+	  </gsf:choose-metadata>
+	</xsl:variable>
+	<!--
+	    Check if $NumPages == 1
+	-->
+	<xsl:if test="$NumPages=1">
+	  <!--
+	      Write functionality so that we don't have to collapse the page - it should be instantly viewable.
+	  -->
+	  <script>
+	  <xsl:text disable-output-escaping="yes">						</xsl:text>					</script>
+	</xsl:if>
+	<xsl:call-template name="wrappedSectionImage"/>
+	<xsl:call-template name="wrappedSectionText"/>
+      </gsf:template>
+      <!--
+	  Overwriting this template can be used to change the content of each section - useful for paged documents.
+      -->
+      <gsf:template name="sectionContent">
+	<!--
+	    <p>
+	    <gsf:metadata name="assocfilepath" select="root"/>
+	    </p>
+	-->
+	<!--
+	    Check if pj.format == "Scanned Documents"
+	-->
+	<xsl:variable name="FileFormat">
+	  <gsf:choose-metadata>
+	    <gsf:metadata name="pj.Format" select="root"/>
+	    <gsf:default>""</gsf:default>
+	  </gsf:choose-metadata>
+	</xsl:variable>
+	<xsl:if test="contains($FileFormat,'Scanned Documents')">
+	  <script type="text/javascript">
+	    <xsl:text disable-output-escaping="yes">var docID = gs.cgiParams.d; 
+	    var num = '</xsl:text>
+	    <gsf:metadata name="Title"/>
+	    <xsl:text disable-output-escaping="yes">'; 
+	    var divId = "#small" + docID + "_" + num; 
+	    var found = $(divId).find("img"); 
+	    
+	    //Load up existing image annotations 
+	    var imageJson = '</xsl:text>
+	    <gsf:metadata name="gsimg.Annotation" select="root"/>
+	    <xsl:text disable-output-escaping="yes">'; 
+	    
+	    var matches = getImageNoteMatches(imageJson); 
+	    var existing_notes = getExistingImageNotes(matches,num); 
+	    console.log(existing_notes);
+	    
+	    if(found.length != 0){ 
+	    var img = found[0]; 
+	    
+	    var img_width = img.width; 
+	    var img_height = img.height; 
+	    
+	    var imgId = 'img_annotate'+docID+'_'+num; 
+	    
+	    $(img).attr('id',imgId); 
+	    $('#'+imgId).annotateImage({ 
+	    editable: true, 
+	    useAjax: true, 
+	    notes: existing_notes, 
+	    width: img_width, 
+	    height: img_height, 
+	    page: num  
+	    });
+	    
+	    //enable text annotating - assumes that only one pre element exists on the page...
+	    /*var preAnnotator = $("pre").annotator();
+	    
+	    preAnnotator.annotator('addPlugin','Store',{
+	    
+	    prefix: 'cgi-bin/metadata-server.pl',
+	    
+	    //Attach uri of the current page to all annotations to allow search
+	    annotationData: {
+	    'uri': 'http://localhost:8787/greenstone3/library/colection/pjpaged/document/HASH012777c0ef1cbbe239b1cc66'
+	    },
+	    
+	    loadFromSearch: {
+	    'limit': 20,
+	    'uri': 'http://localhost:8787/greenstone3/library/colection/pjpaged/document/HASH012777c0ef1cbbe239b1cc66'
+	    },
+	    
+	    urls: {
+	    create: 'createurl',
+	    read: 'readurl',
+	    update: 'updateurl',
+	    destroy: 'destroyurl',
+	    search: 'searchurl'
+	    }
+	    
+	    });*/
+	    
+	    
+	    }</xsl:text>
+	  </script>
+	</xsl:if>
+	<xsl:call-template name="wrappedSectionImage"/>
+	<br/>
+	<br/>
+	<xsl:call-template name="wrappedSectionText"/>
+      </gsf:template>
+    </format>
+  </display>
+  <replaceListRef id="gs2-standard"/>
+  <replaceListRef id="gs2-image"/>
+  <serviceRackList/>
+</CollectionConfig>
Index: main/trunk/model-sites-dev/pei-jones/collect/gallery/js/custom-doc-editing.js
===================================================================
--- main/trunk/model-sites-dev/pei-jones/collect/gallery/js/custom-doc-editing.js	(revision 31796)
+++ main/trunk/model-sites-dev/pei-jones/collect/gallery/js/custom-doc-editing.js	(revision 31796)
@@ -0,0 +1,1 @@
+availableMetadataElements = [ "pj.Title", "pj.Date", "pj.Catalogue-Number", "pj.Catalogue-Short", "pj.Description", "pj.Subject", "pj.MSHeading", "pj.Physical-Location", "pj.Provenance", "pj.Document-Type", "pj.Tags"];
Index: main/trunk/model-sites-dev/pei-jones/collect/gallery/resources/GS2LuceneSearch.properties
===================================================================
--- main/trunk/model-sites-dev/pei-jones/collect/gallery/resources/GS2LuceneSearch.properties	(revision 31796)
+++ main/trunk/model-sites-dev/pei-jones/collect/gallery/resources/GS2LuceneSearch.properties	(revision 31796)
@@ -0,0 +1,1 @@
+TextQuery.name=Advanced Search
Index: main/trunk/model-sites-dev/pei-jones/collect/taonga/etc/collectionConfig.xml
===================================================================
--- main/trunk/model-sites-dev/pei-jones/collect/taonga/etc/collectionConfig.xml	(revision 31796)
+++ main/trunk/model-sites-dev/pei-jones/collect/taonga/etc/collectionConfig.xml	(revision 31796)
@@ -0,0 +1,276 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CollectionConfig xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <metadataList>
+    <metadata lang="en" name="creator"/>
+    <metadata lang="en" name="maintainer"/>
+    <metadata lang="en" name="public">true</metadata>
+  </metadataList>
+  <displayItemList>
+    <displayItem assigned="true" lang="en" name="description">
+
+      &lt;p&gt;
+      Over the years, Pei Te Hurinui amassed and was gifted a significant collection of taonga and kÄkahu including whakapapa scrolls and books, huia feathers, pendants, watches, medals, weapons and kÄkahu (i.e., kÄkahu huruhuru, pihepihe, karure and korowai). These taonga are located in Mahi MÄreikura on level 4 of the University of Waikato Library. To house the collection of taonga, two lockable four-drawer moisture-cured polyurethane pine units (measuring approximately 430mm high, 1700mm wide and 1500 deep) were purchased. The taonga in the collection are organised according to whakapapa, relevant kÅrero and use. The organisation of these taonga depends upon the interpretation of relevant MÄori philosophical values, tikanga and the kÅrero associated with each object.
+      &lt;p&gt;
+      Use the Titles tab above to browse the taonga, or else type a query into the
+      search box in the upper-righthand corner.
+
+    </displayItem>
+    <displayItem assigned="true" lang="en" name="name">Taonga</displayItem>
+   <displayItem assigned="true" lang="en" name="shortDescription">
+
+      Photos and catalogued information of the artifacts stored in the
+      main (central) display cabinet of the Pei Jones special collection
+      room
+    </displayItem>
+ </displayItemList>
+  <format>
+    <gsf:template name="choose-title">
+      <gsf:choose-metadata>
+	<gsf:metadata name="pj.Title"/>
+	<gsf:metadata name="Title"/>
+	<gsf:default>Untitled</gsf:default>
+      </gsf:choose-metadata>
+    </gsf:template>
+  </format>
+  <search type="lucene">
+    <level name="document">
+      <displayItem lang="en" name="name">document</displayItem>
+    </level>
+    <defaultLevel name="document"/>
+    <index name="allfields"/>
+    <index name="pj.Title,Title">
+      <displayItem lang="en" name="name">title</displayItem>
+    </index>
+    <index name="pj.Catalogue-Number,pj.Catalogue-Short">
+      <displayItem lang="en" name="name">catalogue number</displayItem>
+    </index>
+    <index name="pj.Description">
+      <displayItem lang="en" name="name">description</displayItem>
+    </index>
+   <index name="pj.Physical-Location">
+      <displayItem lang="en" name="name">physical location</displayItem>
+    </index>
+    <index name="pj.Provenance">
+      <displayItem lang="en" name="name">provenance</displayItem>
+    </index>
+    <index name="pj.Tags">
+      <displayItem lang="en" name="name">tags</displayItem>
+    </index>
+    <index name="pj.MSHeading">
+      <displayItem lang="en" name="name">maori subject heading</displayItem>
+    </index>
+    <index name="text">
+      <displayItem lang="en" name="name">text</displayItem>
+    </index>
+     <defaultIndex name="allfields"/>
+    <indexOption name="casefold"/>
+    <indexOption name="stem"/>
+    <searchType name="plain"/>
+    <format>
+      <gsf:template match="documentNode">
+	<td align="center" valign="top" width="104">
+	  <gsf:link type="document">
+	    <gsf:choose-metadata>
+	      <gsf:metadata name="thumbicon"/>
+	      <gsf:metadata name="srcicon"/>
+	    </gsf:choose-metadata>
+	  </gsf:link>
+	</td>
+	<td valign="top">
+	  <gsf:link type="document">
+	    <!--
+		Defined in the global format statement
+	    -->
+	    <xsl:call-template name="choose-title"/>
+	  </gsf:link>
+	</td>
+      </gsf:template>
+    </format>
+  </search>
+  <infodb type="jdbm"/>
+  <import>
+    <pluginList>
+      <plugin name="ZIPPlugin"/>
+      <plugin name="GreenstoneXMLPlugin"/>
+      <plugin name="TextPlugin"/>
+      <plugin name="HTMLPlugin"/>
+      <plugin name="RTFPlugin"/>
+      <plugin name="PostScriptPlugin"/>
+      <plugin name="ExcelPlugin"/>
+      <plugin name="ImagePlugin">
+	<option name="-enable_cache"/>
+	<option name="-OIDtype" value="assigned"/>
+	<option name="-OIDmetadata" value="pj.Catalogue-Number"/>
+      </plugin>
+      <plugin name="ISISPlugin"/>
+      <plugin name="OAIPlugin"/>
+      <plugin name="MetadataCSVPlugin"/>
+      <plugin name="MetadataXMLPlugin"/>
+      <plugin name="ArchivesInfPlugin"/>
+      <plugin name="DirectoryPlugin"/>
+    </pluginList>
+  </import>
+  <importOption name="-NO_IMPORT"/>
+  <browse>
+    <classifier name="List">
+      <option name="-metadata" value="pj.Title;Title"/>
+      <option name="-buttonname" value="Titles"/>
+      <option name="-partition_type_within_level" value="approximate_size"/>
+    </classifier>
+    <!-- use custom classifier to get the catalogue numbers sorted properly -->
+    <classifier name="CatalogNumList">
+      <option name="-metadata" value="pj.Catalogue-Short/pj.Catalogue-Number"/>
+      <option name="-buttonname" value="Catalogue No."/>
+      <option name="-partition_type_within_level" value="none"/>
+      <option name="-bookshelf_type" value="never"/>
+      <option name="-use_hlist_for" value="pj.Catalogue-Short"/>
+      <format>
+	<gsf:template match="documentNode">
+	  <td align="center" valign="top" width="104">
+	    <gsf:link type="document">
+	      <gsf:choose-metadata>
+		<gsf:metadata name="thumbicon"/>
+		<gsf:metadata name="srcicon"/>
+	      </gsf:choose-metadata>
+	    </gsf:link>
+	  </td>
+	  <td valign="top"><gsf:link type="document"><gsf:metadata name="pj.Catalogue-Number"/></gsf:link> (<gsf:metadata name="Source"/>)</td>
+	</gsf:template>
+	<gsf:template match="classifierNode[@classifierStyle = 'HList']">
+	  <gsf:link type="classifier">
+	    <gsf:metadata name="Title"/>
+	  </gsf:link>
+	</gsf:template>
+      </format>
+    </classifier>
+    <format>
+      <gsf:template match="documentNode">
+	<td align="center" valign="top" width="104">
+	  <gsf:link type="document">
+	    <gsf:choose-metadata>
+	      <gsf:metadata name="thumbicon"/>
+	      <gsf:metadata name="srcicon"/>
+	    </gsf:choose-metadata>
+	  </gsf:link>
+	</td>
+	<td valign="top">
+	  <gsf:link type="document">
+	    <!--
+		Defined in the global format statement
+	    -->
+	    <xsl:call-template name="choose-title" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
+	    <gsf:switch>
+	      <gsf:metadata name="Source"/>
+	    <gsf:when test="exists">							</gsf:when>						</gsf:switch>
+	  </gsf:link>
+	</td>
+      </gsf:template>
+      <gsf:template match="classifierNode[@classifierStyle = 'VList']">
+	<td valign="top">
+	  <gsf:link type="classifier">
+	    <gsf:icon type="classifier"/>
+	  </gsf:link>
+	</td>
+	<td valign="top">
+	  <gsf:metadata name="Title"/>
+	</td>
+      </gsf:template>
+      <gsf:template match="classifierNode[@classifierStyle = 'HList']">
+	<gsf:link type="classifier">
+	  <gsf:metadata name="Title"/>
+	</gsf:link>
+      </gsf:template>
+    </format>
+  </browse>
+  <display>
+    <format>
+      <!--<gsf:option name="TOC" value="true"/>-->
+      <gsf:option name="disableSearchTermHighlighting" value="true"/>
+
+      <!--
+	  Overwriting this template allows you to change the heading of the document.
+      -->
+      <gsf:template name="documentHeading">
+	<span rect="norect" style="display: inline-block; font-weight: bold; font-size: 120%;">
+	  <xsl:call-template name="choose-title"/>
+	</span>
+      </gsf:template>
+      <!--
+	  Overwriting this template can be used to redefine the content of the whole document. This is useful for simple documents, but not recommended for more complex documents (e.g. hierachical and paged documents) as it can prevent any sub-sections from showing.
+      -->
+      <!--
+	  Overwriting this template can be used to change the content of section headings.
+      -->
+      <!--
+	  <gsf:template name="sectionHeading">
+	  <xsl:call-template name="choose-title"/>
+	  </gsf:template>
+      -->
+      <!--
+	  Overwriting this template can be used to change the content of the top-level section.
+      -->
+      <!--
+	  <gsf:template name="topLevelSectionContent">
+	  <xsl:call-template name="wrappedSectionImage"/>
+	  <xsl:call-template name="wrappedSectionText"/>
+	  </gsf:template>
+      -->
+      <!--
+	  Overwriting this template can be used to change the content of sections.
+      -->
+      <!--
+	  <gsf:template name="sectionContent">
+	  <xsl:call-template name="wrappedSectionImage"/>
+	  <xsl:call-template name="wrappedSectionText"/>
+	  </gsf:template>
+      -->
+      <gsf:template name="documentContent" xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat">
+	<!--
+	    CSS styling was #81BEF7, #A9D0F5; 
+	-->
+	<!--<style type="text/css">table.alternating{ font-family: Georgia; font-size: 16px; color: #000; }table.alternating tr:nth-child(odd){ background: #CDC3B7; }table.alternating tr:nth-child(even){ background: #EDE4D4; }table.alternating td{ border: 1px solid #000; }div.container{ border: 1px solid #000; display: inline-block; padding: 5px; }td.heading{ font-weight: bold; font-style: italic; color: #EEEEFF; }</style>-->
+	<!--
+	    <div align="center">
+	-->
+	<!--
+	    <div class="container" rect="norect">
+	-->
+	<div rect="norect" style="float: left; margin: 15px;">
+	  <gsf:link type="source">
+	    <gsf:image type="screen" style="border: 1px solid #000;"/>
+	  </gsf:link>
+	</div>
+	<xsl:call-template name="pjMetadataDisplayTable"/>
+	<div style="clear:left;">
+	  <gsf:if-metadata-exists><gsf:metadata name="NoText"/><gsf:else><gsf:text/></gsf:else></gsf:if-metadata-exists>
+	</div>
+	<br clear="all"/>
+	<!--
+	    </div>
+	-->
+	<!--
+	    </div>
+	-->
+	<xsl:call-template name="showAssocFilePath" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
+	<xsl:call-template name="showExpediteeAttributes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
+      </gsf:template>
+      <!--
+	  Template to display any notes produced in GlamED.
+      -->
+      <xsl:template name="showNotes">
+	<xsl:if test="/page/pageRequest/paramList/param[@name='p.showNotes']/@value='1'">
+	  <gsf:switch>
+	    <gsf:metadata name="GlamED-Notes"/>
+	    <gsf:when test="exists">
+	      <gsf:metadata name="GlamED-Notes"/>
+	    </gsf:when>
+	  </gsf:switch>
+	</xsl:if>
+      </xsl:template>
+    </format>
+  </display>
+  <replaceListRef id="gs2-standard"/>
+  <replaceListRef id="gs2-image"/>
+  <serviceRackList><!-- comment out the following serviceRack if you want to disable OAI for this collection -->
+  </serviceRackList>
+</CollectionConfig>
Index: main/trunk/model-sites-dev/pei-jones/collect/taonga/js/custom-doc-editing.js
===================================================================
--- main/trunk/model-sites-dev/pei-jones/collect/taonga/js/custom-doc-editing.js	(revision 31796)
+++ main/trunk/model-sites-dev/pei-jones/collect/taonga/js/custom-doc-editing.js	(revision 31796)
@@ -0,0 +1,1 @@
+availableMetadataElements = [ "pj.Catalogue-Number", "pj.Catalogue-Short", "pj.Title", "pj.Description", "pj.MSHeading", "pj.Physical-Location", "pj.Provenance", "pj.Tags"];
Index: main/trunk/model-sites-dev/pei-jones/collect/taonga/perllib/classify/CatalogNumList.pm
===================================================================
--- main/trunk/model-sites-dev/pei-jones/collect/taonga/perllib/classify/CatalogNumList.pm	(revision 31796)
+++ main/trunk/model-sites-dev/pei-jones/collect/taonga/perllib/classify/CatalogNumList.pm	(revision 31796)
@@ -0,0 +1,36 @@
+## CatalogNumList.pm A version of List that correctly sorts Taonga catalogue numbers
+package CatalogNumList;
+
+use List;
+
+use strict;
+
+sub BEGIN {
+    @CatalogNumList::ISA = ('List');
+}
+
+# all I want to do with this classifier is sort numbers like 3q1 and
+# 3q1/2a so that the numeric parts are sorted numerically.
+sub alpha_numeric_cmp
+{
+    my ($self,$a,$b) = @_;
+    my ($a1, $a2, $a3) = $a =~ m@^3q(\d+)(?:/(\d+)(.*))?$@;
+    my ($b1, $b2, $b3) = $b =~ m@^3q(\d+)(?:/(\d+)(.*))?$@;
+
+    if ($a1 && $b1) {
+	if ($a1 != $b1) {
+	    return ($a1 <=> $b1);
+	}
+	if ($a2 && $b2) {
+	    if ($a2 != $b2) {
+		return ($a2 <=> $b2);
+	    }
+	    return ($a3 cmp $b3);
+	}
+    }
+    return $a cmp $b;
+}
+
+
+
+1;
Index: main/trunk/model-sites-dev/pei-jones/collect/taonga/resources/GS2LuceneSearch.properties
===================================================================
--- main/trunk/model-sites-dev/pei-jones/collect/taonga/resources/GS2LuceneSearch.properties	(revision 31796)
+++ main/trunk/model-sites-dev/pei-jones/collect/taonga/resources/GS2LuceneSearch.properties	(revision 31796)
@@ -0,0 +1,1 @@
+TextQuery.name=Advanced Search
Index: main/trunk/model-sites-dev/pei-jones/collect/written-works/etc/collectionConfig.xml
===================================================================
--- main/trunk/model-sites-dev/pei-jones/collect/written-works/etc/collectionConfig.xml	(revision 31796)
+++ main/trunk/model-sites-dev/pei-jones/collect/written-works/etc/collectionConfig.xml	(revision 31796)
@@ -0,0 +1,231 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CollectionConfig xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <metadataList>
+    <metadata lang="en" name="creator"></metadata>
+    <metadata lang="en" name="maintainer"></metadata>
+    <metadata lang="en" name="public">true</metadata>
+  </metadataList>
+  <displayItemList>
+    <displayItem assigned="true" lang="en" name="name">Written works</displayItem>
+    <displayItem assigned="true" lang="en" name="description">Pei was a prolific writer in MÄori and English. His works include the NgÄ MÅteatea series, King PÅtatau, Mahinarangi, Puhiwahine, translations of Shakespeareâs works into MÄori, such as Huria Hiha (Julius Caesar), Owhiro (Othello), and Tangata Whai Rawa o Weniti (The Merchant of Venice), literary works like NgÄ Iwi o Tainui, He Tuhi Marei-kura and numerous articles and reviews on a range of topics to Te Ao Hou, the Journal of the Polynesian Society, various symposia, societies, in addition to writing many booklets to commemorate the opening of meeting houses in the Tainui and NgÄti TÅ«wharetoa areas.</displayItem>
+  </displayItemList>
+  <search type="lucene">
+    <level name="document">
+      <displayItem lang="en" name="name">document</displayItem>
+    </level>
+    <level name="section">
+      <displayItem lang="en" name="name">section</displayItem>
+    </level>
+    <defaultLevel name="document"/>
+    <index name="allfields"/>
+    <index name="pj.Title,Title">
+      <displayItem lang="en" name="name">title</displayItem>
+    </index>
+    <index name="pj.Catalogue-Number,pj.Catalogue-Short">
+      <displayItem lang="en" name="name">catalogue number</displayItem>
+    </index>
+    <index name="pj.Description">
+      <displayItem lang="en" name="name">description</displayItem>
+    </index>
+    <index name="pj.Date">
+      <displayItem lang="en" name="name">date</displayItem>
+    </index>
+    <index name="pj.Subject">
+      <displayItem lang="en" name="name">subject</displayItem>
+    </index>
+    <index name="pj.Author">
+      <displayItem lang="en" name="name">author</displayItem>
+    </index>
+    <index name="pj.Physical-Location">
+      <displayItem lang="en" name="name">physical location</displayItem>
+    </index>
+    <index name="pj.Provenance">
+      <displayItem lang="en" name="name">provenance</displayItem>
+    </index>
+    <index name="pj.Tags">
+      <displayItem lang="en" name="name">tags</displayItem>
+    </index>
+    <index name="pj.Document-Type">
+      <displayItem lang="en" name="name">document type</displayItem>
+    </index>
+    <index name="pj.MSHeading">
+      <displayItem lang="en" name="name">maori subject heading</displayItem>
+    </index>
+    <index name="text">
+      <displayItem lang="en" name="name">text</displayItem>
+    </index>
+   <index name="Source">
+      <displayItem lang="en" name="name">filenames</displayItem>
+    </index>
+    <defaultIndex name="allfields"/>
+    <searchType name="plain"/>
+    <format>
+      <gsf:template match="documentNode">
+	<td valign="top">
+	  <gsf:link type="document">
+	    <gsf:icon type="document"/>
+	  </gsf:link>
+	</td>
+	<td>
+	  <gsf:link type="document">
+	    <gsf:choose-metadata>
+	      <gsf:metadata name="pj.Title"/>
+	      <gsf:metadata name="Title"/>
+	      <gsf:default>Untitled</gsf:default>
+	    </gsf:choose-metadata>
+	  </gsf:link>
+	</td>
+      </gsf:template>
+    </format>
+  </search>
+  <infodb type="gdbm"/>
+  <import>
+    <pluginList>
+      <plugin name="ZIPPlugin"/>
+      <plugin name="GreenstoneXMLPlugin"/>
+      <plugin name="PagedImagePlugin">
+	<option name="-OIDtype" value="filename"/>
+	<option name="-enable_cache"/>
+      </plugin>
+      <plugin name="TextPlugin"/>
+      <plugin name="HTMLPlugin"/>
+      <plugin name="EmailPlugin"/>
+      <plugin name="PDFPlugin"/>
+      <plugin name="RTFPlugin"/>
+      <plugin name="WordPlugin"/>
+      <plugin name="PostScriptPlugin"/>
+      <plugin name="PowerPointPlugin"/>
+      <plugin name="ExcelPlugin"/>
+      <plugin name="ImagePlugin"/>
+      <plugin name="ISISPlugin"/>
+      <plugin name="NulPlugin"/>
+      <plugin name="OAIPlugin"/>
+      <plugin name="MetadataXMLPlugin"/>
+      <plugin name="ArchivesInfPlugin"/>
+      <plugin name="DirectoryPlugin"/>
+    </pluginList>
+  </import>
+    <importOption name="saveas_options" value="-subdir_split_length 40"/>
+  <browse>
+    <classifier name="List">
+      <option name="-metadata" value="pj.Title;Title"/>
+      <option name="-partition_type_within_level" value="approximate_size"/>
+    </classifier>
+    <classifier name="List">
+      <option name="-metadata" value="Source"/>
+      <option name="-partition_type_within_level" value="approximate_size"/>
+      <format>
+	<gsf:template match="documentNode">
+	  <td valign="top">
+	    <gsf:link type="document">
+	      <xsl:variable name="image-file">
+		<gsf:choose-metadata>
+		  <gsf:metadata name="Thumb"/>
+		  <gsf:metadata name="Thumb" select="children" pos="1"/>
+		  <gsf:metadata name="srcLinkFile"/>
+		</gsf:choose-metadata>
+	      </xsl:variable>
+	      <img><xsl:attribute name="src">sites/<xsl:value-of select="$site_name"/>/collect/written-works/index/assoc/<gsf:metadata name="assocfilepath"/>/<xsl:value-of select="$image-file"/></xsl:attribute></img>
+	    </gsf:link>
+	  </td>
+	  <td valign="top">
+	    <gsf:link type="document">
+	      <gsf:metadata name="SourceFile"/><xsl:text>: </xsl:text>
+	      <gsf:choose-metadata>
+		<gsf:metadata name="pj.Title"/>
+		<gsf:metadata name="Title"/>
+		<gsf:default>Untitled</gsf:default>
+	      </gsf:choose-metadata>
+	    </gsf:link>
+	  </td>
+	</gsf:template>
+      </format>
+    </classifier>
+    <format>
+      <gsf:template match="documentNode">
+	<td valign="top">
+	  <gsf:link type="document">
+	    <xsl:variable name="image-file">
+	      <gsf:choose-metadata>
+		<gsf:metadata name="Thumb"/>
+		<gsf:metadata name="Thumb" select="children" pos="1"/>
+		<gsf:metadata name="srcLinkFile"/>
+	      </gsf:choose-metadata>
+	    </xsl:variable>
+	    <img><xsl:attribute name="src">sites/<xsl:value-of select="$site_name"/>/collect/written-works/index/assoc/<gsf:metadata name="assocfilepath"/>/<xsl:value-of select="$image-file"/></xsl:attribute></img>
+	  </gsf:link>
+	</td>
+	<td valign="top">
+	  <gsf:link type="document">
+	    <gsf:choose-metadata>
+	      <gsf:metadata name="pj.Title"/>
+	      <gsf:metadata name="Title"/>
+	      <gsf:default>Untitled</gsf:default>
+	    </gsf:choose-metadata>
+	    <gsf:switch>
+	      <gsf:metadata name="FileFormat"/>
+	      <gsf:when test="equals" test-value="PagedImage"><i> (<gsf:metadata name="Identifier"/>)</i></gsf:when>
+	    </gsf:switch>
+	  </gsf:link>
+	</td>
+      </gsf:template>
+      <gsf:template match="classifierNode[@classifierStyle = 'VList']">
+	<td valign="top">
+	  <gsf:link type="classifier">
+	    <gsf:icon type="classifier"/>
+	  </gsf:link>
+	</td>
+	<td valign="top"><gsf:metadata name="Title"/></td>
+     </gsf:template>
+      <gsf:template match="classifierNode[@classifierStyle = 'HList']">
+	<gsf:link type="classifier">
+	  <gsf:metadata name="Title"/>
+	</gsf:link>
+      </gsf:template>
+    </format>
+  </browse>
+  <display>
+    <format>
+      <gsf:option name="TOC" value="true"/>
+      <xsl:template name="documentContent">
+	<!-- modify the default template. if its a real book, then we link to the real book, otherwise we are using the default template -->
+	<xsl:variable name="format">
+	  <gsf:metadata name="pj.Format"/>
+	  <gsf:default>""</gsf:default>
+	</xsl:variable>
+	<xsl:choose>
+	  <xsl:when test="contains($format,'RealBook')">
+	    <xsl:variable name="url">
+	      <xsl:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name= 'httpPath']"/>
+	      <xsl:text>/realbooks/</xsl:text>
+	      <xsl:value-of select="@nodeID"/>
+	      <xsl:text>/index.html</xsl:text>
+	    </xsl:variable>
+	    <a href="{$url}" target="_blank">
+	      <xsl:call-template name="sectionImage"/>
+	    </a>
+	    <br/>
+	    <br/>
+	    <p>Click on the image above to view/read the book.</p>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <div id="gs-document">
+	      <xsl:call-template name="documentPre"/>
+	      <xsl:call-template name="wrappedSectionImage"/>
+	      metadata table:
+	      <xsl:call-template name="pjMetadataDisplayTable"/>
+	      <div style="clear:left;"/>
+		
+		<div id="gs-document-text">
+		<xsl:call-template name="documentNodeText"/>
+	      </div>
+	    </div>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:template>
+    </format>
+  </display>
+  <replaceListRef id="gs2-standard"/>
+  <replaceListRef id="gs2-image" />
+  <serviceRackList/>
+</CollectionConfig>
Index: main/trunk/model-sites-dev/pei-jones/collect/written-works/js/custom-doc-editing.js
===================================================================
--- main/trunk/model-sites-dev/pei-jones/collect/written-works/js/custom-doc-editing.js	(revision 31796)
+++ main/trunk/model-sites-dev/pei-jones/collect/written-works/js/custom-doc-editing.js	(revision 31796)
@@ -0,0 +1,7 @@
+availableMetadataElements = [ "pj.Title", "pj.Date", "pj.Author", "pj.Catalogue-Number", "pj.Catalogue-Short", "pj.Description", "pj.Subject", "pj.MSHeading", "pj.Document-Type", "pj.Year", "pj.Location", "pj.Physical-Location", "pj.Provenance", "pj.Notes", "pj.Tags", "pj.Access", "pj.PersonOfInterest", "pj.Event", "pj.Correspondent", "pj.DisplayText"];
+
+var display_metadata_set_selector = false;
+
+
+
+
Index: main/trunk/model-sites-dev/pei-jones/collect/written-works/resources/GS2LuceneSearch.properties
===================================================================
--- main/trunk/model-sites-dev/pei-jones/collect/written-works/resources/GS2LuceneSearch.properties	(revision 31796)
+++ main/trunk/model-sites-dev/pei-jones/collect/written-works/resources/GS2LuceneSearch.properties	(revision 31796)
@@ -0,0 +1,1 @@
+TextQuery.name=Advanced Search
Index: main/trunk/model-sites-dev/pei-jones/collect/written-works/transform/pages/document.xsl
===================================================================
--- main/trunk/model-sites-dev/pei-jones/collect/written-works/transform/pages/document.xsl	(revision 31796)
+++ main/trunk/model-sites-dev/pei-jones/collect/written-works/transform/pages/document.xsl	(revision 31796)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+        xmlns:java="http://xml.apache.org/xslt/java"
+        xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
+        xmlns:gslib="http://www.greenstone.org/skinning"
+        xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
+        extension-element-prefixes="java util"
+        exclude-result-prefixes="java util gsf">
+
+  <!-- override the documentNodeText template as we want to hide the text unless pj.displayText metadata is set to true. -->
+
+  <!-- The default template for displaying the document node text -->
+  <!-- equivalent to gsf:text -->
+  <xsl:template name="documentNodeText">
+    <xsl:variable name="displayText"><gsf:metadata name="pj.DisplayText"/></xsl:variable>
+    <xsl:if test="$displayText = 'true'">	
+        <!-- Section text -->
+        <xsl:for-each select="nodeContent">
+          <xsl:for-each select="node()">
+            <xsl:choose>
+              <xsl:when test="not(name())">
+                <xsl:value-of select="." disable-output-escaping="yes"/>
+              </xsl:when>
+              <xsl:when test="name() = 'annotation'">
+                <xsl:call-template name="displayAnnotation"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:apply-templates/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:for-each>
+        </xsl:for-each>
+    </xsl:if>
+    <xsl:text> </xsl:text>
+  </xsl:template>
+  
+</xsl:stylesheet>
