Index: /main/trunk/greenstone3/web/interfaces/oran/transform/pages/document.xsl
===================================================================
--- /main/trunk/greenstone3/web/interfaces/oran/transform/pages/document.xsl	(revision 24790)
+++ /main/trunk/greenstone3/web/interfaces/oran/transform/pages/document.xsl	(revision 24791)
@@ -100,4 +100,14 @@
 			
 			<div id="doc{@nodeID}" class="sectionContainer" style="display:block;"><!-- *** -->
+				<xsl:if test="/page/pageRequest/paramList/param[@name = 'db']/@value = 'true'">
+					<table id="meta{@nodeID}">
+						<xsl:for-each select="metadataList/metadata">
+							<tr>
+								<td class="metaTableCellName"><xsl:value-of select="@name"/></td>
+								<td class="metaTableCellValue editable"><xsl:value-of select="."/></td>
+							</tr>
+						</xsl:for-each>
+					</table>
+				</xsl:if>
 				<div id="text{@nodeID}" class="sectionText"><!-- *** -->
 					<!-- Get the section content from the document template -->
@@ -113,4 +123,8 @@
 	<!-- the page content -->
 	<xsl:template match="/page/pageResponse/document">
+		<xsl:if test="/page/pageRequest/paramList/param[@name = 'db']/@value = 'true'">
+			<gsf:metadata name="all"/>
+		</xsl:if>
+
 		<xsl:if test="$bookswitch = 'off'">
 			<div id="bookdiv" style="visibility:hidden; height:0px; display:inline;"><xsl:text> </xsl:text></div>
@@ -131,6 +145,6 @@
 			<!-- show the little berries for this document -->
 			<xsl:call-template name="documentBerryForDocumentPage"/>
-
-			<xsl:if test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='coverImage']) or /page/pageResponse/format[@type='display']/gsf:option[@name='sideBar']/@value='true'">
+			
+			<xsl:if test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='sideBar']) or /page/pageResponse/format[@type='display']/gsf:option[@name='sideBar']/@value='true'">
 				<table id="rightSidebar">
 					<tr><td>
@@ -139,31 +153,28 @@
 					<tr><td>
 						<div id="contentsArea">	
-
 							<!-- show the berry basket if it's turned on -->
 							<gslib:berryBasket/>
 
 							<!-- the book's cover image -->
-							<xsl:choose>
-								<xsl:when test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='coverImage']) or /page/pageResponse/format[@type='display']/gsf:option[@name='coverImage']/@value='true'">
-									<div id="coverImage" class="visible"><gslib:coverImage/></div>
-								</xsl:when>
-								<xsl:otherwise>
-									<div id="coverImage" class="hidden"><gslib:coverImage/></div>
-								</xsl:otherwise>    
-							</xsl:choose>
+							<div id="coverImage">
+								<xsl:attribute name="class">
+									<xsl:choose>
+										<xsl:when test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='coverImage']) or /page/pageResponse/format[@type='display']/gsf:option[@name='coverImage']/@value='true'">visible</xsl:when>
+										<xsl:otherwise>hidden</xsl:otherwise>    
+									</xsl:choose>
+								</xsl:attribute>
+								<gslib:coverImage/><xsl:text> </xsl:text>
+							</div>
 
 							<!-- the contents (if enabled) -->
-							<xsl:choose>
-								<xsl:when test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='TOC']) or /page/pageResponse/format[@type='display']/gsf:option[@name='TOC']/@value='true'">
-									<div id="tableOfContents" class="visible">
-										<xsl:apply-templates select="documentNode" mode="TOC"/>
-									</div>
-								</xsl:when>    
-								<xsl:otherwise>
-									<div id="tableOfContents" class="hidden">
-										<xsl:apply-templates select="documentNode" mode="TOC"/>
-									</div>
-								</xsl:otherwise>    
-							</xsl:choose>
+							<div id="tableOfContents">
+								<xsl:attribute name="class">
+									<xsl:choose>
+										<xsl:when test="count(//documentNode) > 1 and not(/page/pageResponse/format[@type='display']/gsf:option[@name='TOC']) or /page/pageResponse/format[@type='display']/gsf:option[@name='TOC']/@value='true'">visible</xsl:when>
+										<xsl:otherwise>hidden</xsl:otherwise>
+									</xsl:choose>
+								</xsl:attribute>
+								<xsl:apply-templates select="documentNode" mode="TOC"/>
+							</div>
 						</div>
 					</td></tr>
@@ -183,6 +194,6 @@
 			</xsl:when>
 			<xsl:when test="$bookswitch = 'on'">
-				<!-- *** in document-scripts.xsl *** -->
 				<div id="bookdiv" style="display:inline;"><xsl:text> </xsl:text></div>
+				<!-- *** in document-scripts.js *** -->
 				<script type="text/javascript">
 					<xsl:text disable-output-escaping="yes">
@@ -195,10 +206,19 @@
 			</xsl:when>
 			<xsl:otherwise>
-				<div id="gs-document-text" class="documenttext"> 
-					<xsl:call-template name="wrapDocumentNodes"/>
-				</div>	
+				<table><tbody><tr><td>
+					<div id="gs-document-image" class="sectionImage">
+						<!-- Get the section content from the document template -->
+						<xsl:call-template name="documentImage"/>
+					</div>
+				</td>
+				<td>
+					<div id="gs-document-text" class="documenttext" collection="{/page/pageResponse/collection/@name}"><!-- *** -->
+						<xsl:call-template name="wrapDocumentNodes"/>
+					</div>
+				</td></tr></tbody></table>
+
 			</xsl:otherwise>
 		</xsl:choose>
-
+		
 		<div class="clear"><xsl:text> </xsl:text></div>
 	</xsl:template>
@@ -251,4 +271,19 @@
 			</xsl:for-each>
 		</xsl:for-each><xsl:text> </xsl:text>
+	</xsl:template>
+	
+	<!-- The default template for displaying the document image -->
+	<xsl:template name="documentImage">
+		<xsl:variable name="imageTest"><gsf:metadata name="ScreenWidth"/></xsl:variable>
+		<xsl:if test="$imageTest != ''">
+			<h3>   
+				<gsf:choose-metadata>
+					<gsf:metadata name="dc.Title"/>
+					<gsf:metadata name="ex.Title"/>
+					<gsf:default>Untitled</gsf:default>
+				</gsf:choose-metadata>
+			</h3>
+			<gsf:metadata name="screenicon"/>
+		</xsl:if>
 	</xsl:template>
 
@@ -402,4 +437,5 @@
 				</td>
 			</xsl:if>
+			<td class="tableOfContentsTitle">Table of Contents</td>
 			<td style="vertical-align:top;">
 				<a id="sidebarMinimizeButton" href="javascript:minimizeSidebar();" style="float: right; font-size:0.6em;">
