Index: /main/trunk/greenstone3/web/interfaces/default/transform/pages/help.xsl
===================================================================
--- /main/trunk/greenstone3/web/interfaces/default/transform/pages/help.xsl	(revision 33279)
+++ /main/trunk/greenstone3/web/interfaces/default/transform/pages/help.xsl	(revision 33280)
@@ -1,130 +1,161 @@
 <?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"
-	extension-element-prefixes="java util"
-	exclude-result-prefixes="java util">
+		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">
+  
+  <!-- use the 'main' layout -->
+  <xsl:include href="layouts/main.xsl"/>
+  <xsl:variable name="help_interface_name" select="concat($interface_name, '2')"/>
+  
+  <!-- set page title -->
+  <xsl:template name="pageTitle"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/></xsl:template>
 
-	<!-- use the 'main' layout -->
-	<xsl:include href="layouts/main.xsl"/>
-	<xsl:variable name="help_interface_name" select="concat($interface_name, '2')"/>
-	
-	<!-- set page title -->
-	<xsl:template name="pageTitle"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/></xsl:template>
+  <!-- set page breadcrumbs -->
+  <xsl:template name="breadcrumbs">
+    <gslib:siteLink/><gslib:rightArrow/>
+    <xsl:if test="/page/pageResponse/collection">
+      <gslib:collectionNameLinked/><gslib:rightArrow/>
+    </xsl:if>
+  </xsl:template>
 
-	<!-- set page breadcrumbs -->
-	<xsl:template name="breadcrumbs">
-		<gslib:siteLink/><gslib:rightArrow/>
-		<xsl:if test="/page/pageResponse/collection">
-			<gslib:collectionNameLinked/><gslib:rightArrow/>
-		</xsl:if>
-	</xsl:template>
-
-	<!-- the page content -->
-	<xsl:template match="page">
-		<xsl:call-template name="helpTopics"/>
-		<xsl:choose>
+  <!-- the page content -->
+  <xsl:template match="page">
+    <xsl:choose>
       <xsl:when test="/page/pageResponse/collection">
-			<xsl:call-template name="findingInformationHelp"/>
-	</xsl:when>
+	<xsl:call-template name="collectionHelp"/>
+      </xsl:when>
       <xsl:otherwise>
 	<xsl:call-template name="homePageHelp"/>
-	</xsl:otherwise>
-		</xsl:choose>
-		<xsl:call-template name="readingDocsHelp"/>
-		<xsl:call-template name="searchingHelp"/>
-		<xsl:call-template name="preferencesHelp"/>
-	</xsl:template>
-	
-	<xsl:template name="helpTopics">
-		
-	</xsl:template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  
 
   <xsl:template name="homePageHelp">
     home page help
+    what should go here??
   </xsl:template>
-	<xsl:template name="findingInformationHelp">
-		<xsl:variable name="searchEnabled">
-			<xsl:choose>
-				<xsl:when test="/page/pageResponse/collection[@name=$collName]/serviceList/service[@type='query']">1</xsl:when>
-				<xsl:otherwise>0</xsl:otherwise>
-			</xsl:choose>
-		</xsl:variable>
-		
-		<xsl:variable name="numClassifiers">
-			<xsl:value-of select="count(/page/pageResponse/collection[@name=$collName]/serviceList/service[@name = 'ClassifierBrowse']/classifierList/classifier)"/>
-		</xsl:variable>
+  
+  <xsl:template name="collectionHelp">
+    <!-- Using the {0} collection -->
+    <h2><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.collection_title', $collName)"/></h2>
 
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.findinginformationtitle', $collName)"/>
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.findinginformation', $searchEnabled + $numClassifiers)"/>
-		
-		<!-- using actual <ul> and <li> tags here would cause the XML parser to break -->
-		<xsl:text disable-output-escaping="yes">&lt;ul&gt;</xsl:text>
-		<xsl:if test="$searchEnabled = 1">
-			<xsl:text disable-output-escaping="yes">&lt;li&gt;</xsl:text>
-			<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searchdesc')"/>
-			<xsl:text disable-output-escaping="yes">&lt;/li&gt;</xsl:text>
-		</xsl:if>
-		
-		<xsl:for-each select="/page/pageResponse/collection[@name=$collName]/serviceList/service[@name = 'ClassifierBrowse']/classifierList/classifier">
-			<xsl:text disable-output-escaping="yes">&lt;li&gt;</xsl:text>
-			<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.browsedesc', ./displayItem[@name = 'name'])"/>
-			<xsl:text disable-output-escaping="yes">&lt;/li&gt;</xsl:text>
-		</xsl:for-each>
-		<xsl:text disable-output-escaping="yes">&lt;/ul&gt;</xsl:text>
-	</xsl:template>
-	
-	<xsl:template name="readingDocsHelp">
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.readingdocstitle')"/>
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.readingdocs')"/>
-		
-		<table>
-			<tr>
-				<td colspan="2"><img src="interfaces/{$interface_name}/images/bookshelf.png"/></td>
-				<td><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.openbookshelf')"/></td>
-			</tr>
-			<tr>
-				<td><img src="interfaces/{$interface_name}/images/previous.png"/></td>
-				<td><img src="interfaces/{$interface_name}/images/next.png"/></td>
-				<td><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.sectionarrows')"/></td>
-			</tr>
-		</table>
-	</xsl:template>
-	
-	<xsl:template name="searchingHelp">
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searchingtitle')"/>
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searching')"/>
-		
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.querytermstitle')"/>
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.queryterms')"/>
-		
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.querytypetitle')"/>
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.querytype')"/>
-		
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.queryscopetitle')"/>
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.queryscope')"/>
-	</xsl:template>
-	
-	<xsl:template name="preferencesHelp">
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.changingpreferencestitle')"/>
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.changingpreferences')"/>
-		
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.collectionpreferencestitle')"/>
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.collectionpreferences')"/>
-		
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.languagepreferencestitle')"/>
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.languagepreferences')"/>
-		
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.presentationpreferencestitle')"/>
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.presentationpreferences')"/>
-		
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searchpreferencestitle')"/>
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searchpreferences1')"/>
-		<xsl:if test="/page/pageResponse/collection[@name=$collName and (@type='mgpp' or @type='mg')]">
-			<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.mgsearchpreferences')"/>
-		</xsl:if>
-		<xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searchpreferences2')"/>
-	</xsl:template>
+    <!-- general intro text -->
+    <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.collection_general')"/><br/><br/>
+
+    <xsl:call-template name="browsingHelp"/>
+    <xsl:if test="/page/pageResponse/collection/serviceList/service[@type='query']">
+      <xsl:call-template name="searchingHelp"/>
+      <xsl:call-template name="searchParamsHelp"/>
+      <xsl:call-template name="searchResultsHelp"/>
+    </xsl:if>
+    <xsl:call-template name="documentHelp"/>
+    <xsl:if test="/page/pageResponse/interfaceOptions/option[@name='favouritesBaskets']/@value='true'">
+      <xsl:call-template name="favouritesHelp"/>
+    </xsl:if>
+    <xsl:if test="/page/pageResponse/interfaceOptions/option[@name='berryBaskets']/@value='true'">
+      <xsl:call-template name="berrybasketsHelp"/>
+    </xsl:if>
+    <xsl:if test="//format/gsf:option[@name='RSS']/@value= 'true'">
+      <xsl:call-template name="rssHelp"/>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="browsingHelp">
+    <xsl:variable name="bookshelf"><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.icon_bookshelf')"/></xsl:variable>
+    <xsl:variable name="book"><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.icon_book')"/></xsl:variable>
+    <xsl:variable name="page"><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.icon_page')"/></xsl:variable>
+    <xsl:variable name="plus"><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.icon_plus')"/></xsl:variable>
+    <xsl:variable name="pdf"><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.icon_pdf')"/></xsl:variable>
+    <xsl:variable name="word"><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.icon_word')"/></xsl:variable>
+    <xsl:variable name="mp3"><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.icon_mp3')"/></xsl:variable>
+    <h3><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.browsing_title')"/></h3><br/>
+    <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.browsing_general')"/>
+    <dl>
+      <dt><img src="interfaces/{$interface_name}/images/bshelf.gif" title="{$bookshelf}"/></dt>
+      <xsl:variable name="plus_icon"><img src="interfaces/{$interface_name}/images/expand.png" alt="plus icon"/></xsl:variable>
+      <dd><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceTextWithDOM($help_interface_name, /page/@lang, 'help.browsing_bookshelf', $plus_icon)"/></dd>
+      <xsl:variable name="book_icon"><img src="interfaces/{$interface_name}/images/book.png" alt="{$book}" title="{$book}"/></xsl:variable>
+      <xsl:variable name="page_icon"><img src="interfaces/{$interface_name}/images/itext.gif" alt="{$page}" title="{$page}"/> </xsl:variable>
+      <dt><xsl:copy-of select="$book_icon"/><gsf:space/> <xsl:copy-of select="$page_icon"/></dt>
+      <dd><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceTextWithDOM($help_interface_name, /page/@lang, 'help.browsing_book', $book_icon, $page_icon)"/></dd>
+       <dt><img src="interfaces/{$interface_name}/images/ipdf.gif" alt="{$pdf}" title="{$pdf}"/><gsf:space/><img src="interfaces/{$interface_name}/images/imsword.gif" alt="{$word}" title="{$word}"/><gsf:space/><img src="interfaces/{$interface_name}/images/imp3.gif" alt="{$mp3}" title="{$mp3}"/> ...</dt>
+      <dd><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.browsing_srcicon')"/></dd>
+      </dl>
+  </xsl:template>
+
+  <xsl:template name="searchingHelp">
+    <h3><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searching_title')"/></h3><br/>
+    <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searching_quick')"/><br/><br/>
+    <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searching_more')"/>
+    <dl>
+      <xsl:for-each select="/page/pageResponse/collection/serviceList/service[@type='query']">
+	<xsl:variable name="qname"><xsl:value-of select="@name"/></xsl:variable>
+      <dt><xsl:value-of select="displayItem[@name='name']"/></dt>
+      <dd><xsl:choose><xsl:when test="$qname='TextQuery'"><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searching_text')"/></xsl:when>
+      <xsl:when test="$qname='FieldQuery'"><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searching_form')"/></xsl:when>
+      <xsl:when test="$qname='AdvancedFieldQuery'"><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searching_adv')"/></xsl:when>
+      <xsl:otherwise><xsl:value-of select="$qname"/></xsl:otherwise>
+    </xsl:choose>
+    </dd>
+      </xsl:for-each>
+    </dl>
+  </xsl:template>
+  <xsl:template name="searchParamsHelp">
+       <h3><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searchparams_title')"/></h3><br/>
+       <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searchparams_general')"/><br/>
+       <ul>
+    <xsl:for-each select="/page/pageResponse/collection/serviceList/service[@type='query']/paramList/param[@type != 'invisible' and @type != 'enum_multi' and @type != 'multi' and not(@name=preceding::param/@name)]">
+      <xsl:variable name="pname">help.sp_<xsl:value-of select="@name"/></xsl:variable>
+      <li><b><xsl:value-of select="displayItem[@name='name']"/>: </b><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, $pname)"/></li>
+    </xsl:for-each>
+    <xsl:if test="not(/page/pageResponse/collection/serviceList/service[@type='query']/paramList/param[@name='hitsPerPage'])">
+      <li><b><xsl:value-of disable-output-escaping="yes" select="util:getGenericText('ServiceRack', /page/@lang, 'param.hitsPerPage')"/>: </b><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.sp_hitsPerPage')"/></li>
+    </xsl:if>
+       </ul>
+  </xsl:template>
+  <xsl:template name="searchResultsHelp">
+    <h3><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searchresults_title')"/></h3><br/>
+    <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searchresults_general')"/><br/>
+    <xsl:if test="/page/pageResponse/collection/serviceList/service[@type='query']/metadataList/metadata[@name='does_facetsearch']/@value='true'">
+      <dl>
+      <dt><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searchresults_facet_title')"/></dt>
+      <dd><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.searchresults_facets')"/></dd>
+      </dl>
+    </xsl:if>
+    <br/>
+  </xsl:template>
+
+  <xsl:template name="documentHelp">
+    <h3><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.document_title')"/></h3><br/>
+    <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.document_general')"/><br/><br/>
+    TODO: put some stuff here about icons found on doc pages. toc/paged docs. highlighter, image zoomer, 
+  </xsl:template>
+  <xsl:template name="favouritesHelp">
+    <xsl:variable name="fav_icon"><img src="interfaces/{$interface_name}/images/favourite-star-transparent-unselected32.png" width="16" height="16" alt="favourites unselected"/></xsl:variable>
+    <xsl:variable name="fav_icon_selected"><img src="interfaces/{$interface_name}/images/favourite-star-transparent-selected32.png" width="16" height="16" alt="favourites selected"/></xsl:variable>
+    <h3><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.favourites_title')"/></h3><br/>
+    <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceTextWithDOM($help_interface_name, /page/@lang, 'help.favourites', $fav_icon, $fav_icon_selected)"/><br/><br/>
+  </xsl:template>
+
+  <xsl:template name="berrybasketsHelp">
+    <xsl:variable name="berry_icon"><img src="interfaces/{$interface_name}/images/berry.png" alt="berry icon" width="16" height="16"/></xsl:variable>
+    <h3><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.berrybasket_title')"/></h3><br/>
+    <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceTextWithDOM($help_interface_name, /page/@lang, 'help.berrybasket', $berry_icon)"/><br/><br/>
+  </xsl:template>
+  
+  <xsl:template name="rssHelp">
+    <xsl:variable name="rss"><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.icon_rss')"/></xsl:variable>
+    <xsl:variable name="rss_icon"><img src="interfaces/{$interface_name}/images/rssicon.png" alt="{$rss}" title="{$rss}"/></xsl:variable>
+    <h3><xsl:value-of disable-output-escaping="yes" select="util:getInterfaceText($help_interface_name, /page/@lang, 'help.rss_title')"/></h3><br/>
+    <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceTextWithDOM($help_interface_name, /page/@lang, 'help.rss', $rss_icon)"/><br/><br/>
+  </xsl:template>
+
+ 
 </xsl:stylesheet>
