Changeset 13996


Ignore:
Timestamp:
2007-03-28T16:24:18+12:00 (17 years ago)
Author:
lh92
Message:

Added code to display the page turning when book switch is on and the tidy_option is set

Location:
trunk/gsdl3/web/interfaces/default/transform
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/web/interfaces/default/transform/config_format.xsl

    r13227 r13996  
    3737      </xsl:when>
    3838      <xsl:otherwise> <!-- a document link -->
    39     <a><xslt:attribute name="href"><xslt:value-of select='$library_name'/>?a=d&amp;c=<xslt:value-of select='$collName'/>&amp;d=<xslt:value-of select='@nodeID'/>&amp;dt=<xslt:value-of select='@docType'/><xslt:if test="@nodeType='leaf'">&amp;sib=1</xslt:if>&amp;p.a=<xslt:value-of select="/page/pageRequest/@action"/>&amp;p.sa=<xsl:value-of select="/page/pageRequest/@subaction"/>&amp;p.s=<xslt:value-of select="$serviceName"/></xslt:attribute><xsl:apply-templates/></a>
     39    <xslt:variable name="bookswitch"><xslt:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/></xslt:variable>
     40    <xslt:choose>
     41            <xslt:when test="$bookswitch = 'on' or $bookswitch = 'flashxml'">
     42                <a><xslt:attribute name="href"><xslt:value-of select='$library_name'/>?a=d&amp;ed=1&amp;book=on&amp;c=<xslt:value-of select='$collName'/>&amp;d=<xslt:value-of select='@nodeID'/>&amp;dt=<xslt:value-of select='@docType'/><xslt:if test="@nodeType='leaf'">&amp;sib=1</xslt:if>&amp;p.a=<xslt:value-of select="/page/pageRequest/@action"/>&amp;p.sa=<xsl:value-of select="/page/pageRequest/@subaction"/>&amp;p.s=<xslt:value-of select="$serviceName"/></xslt:attribute><xsl:apply-templates/></a>
     43        </xslt:when>
     44        <xslt:otherwise>
     45               <a><xslt:attribute name="href"><xslt:value-of select='$library_name'/>?a=d&amp;book=off&amp;c=<xslt:value-of select='$collName'/>&amp;d=<xslt:value-of select='@nodeID'/>&amp;dt=<xslt:value-of select='@docType'/><xslt:if test="@nodeType='leaf'">&amp;sib=1</xslt:if>&amp;p.a=<xslt:value-of select="/page/pageRequest/@action"/>&amp;p.sa=<xsl:value-of select="/page/pageRequest/@subaction"/>&amp;p.s=<xslt:value-of select="$serviceName"/></xslt:attribute><xsl:apply-templates/></a>
     46        </xslt:otherwise>
     47    </xslt:choose>
    4048      </xsl:otherwise>
    4149    </xsl:choose>
  • trunk/gsdl3/web/interfaces/default/transform/document.xsl

    r13831 r13996  
    1414  <xsl:output method="html"/>
    1515   <xsl:variable name="berrybasketswitch"><xsl:value-of select="/page/pageRequest/paramList/param[@name='berrybasket']/@value"/></xsl:variable>
     16   <xsl:variable name="bookswitch"><xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/></xsl:variable>
    1617 
    1718  <xsl:template name="pageTitle">
     
    4142  <xsl:template match="pageResponse">
    4243    <xsl:variable name="collName"><xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
    43     <xsl:call-template name="standardPageBanner">
    44       <xsl:with-param name="collName" select="$collName"/>
    45     </xsl:call-template>
    46     <xsl:call-template name="navigationBar">
    47       <xsl:with-param name="collName" select="$collName"/>
    48     </xsl:call-template>
    49  
    50   <!--<xsl:if test="$berryBaskets = 'true'">-->
    51     <xsl:if test="$berrybasketswitch = 'on'">
    52     <xsl:call-template name="documentBerryBasket">
    53       <xsl:with-param name="collName" select="$collName"/>
    54       <xsl:with-param name="selectedNode" select="/page/pageResponse/document/@selectedNode"/>
    55       <xsl:with-param name="rootNode" select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
    56       <xsl:with-param name="docType" select="/page/pageResponse/document/@docType"/>
    57     </xsl:call-template>
    58    </xsl:if>
     44    <xsl:choose>
     45      <xsl:when test="$bookswitch = 'on' or $bookswitch = 'off'">
     46        <xsl:call-template name="standardPageBanner">
     47           <xsl:with-param name="collName" select="$collName"/>
     48        </xsl:call-template>
     49        <xsl:call-template name="navigationBar">
     50           <xsl:with-param name="collName" select="$collName"/>
     51        </xsl:call-template>
     52 
     53        <!--<xsl:if test="$berryBaskets = 'true'">-->
     54        <xsl:if test="$berrybasketswitch = 'on'">
     55          <xsl:call-template name="documentBerryBasket">
     56             <xsl:with-param name="collName" select="$collName"/>
     57             <xsl:with-param name="selectedNode" select="/page/pageResponse/document/@selectedNode"/>
     58             <xsl:with-param name="rootNode" select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
     59             <xsl:with-param name="docType" select="/page/pageResponse/document/@docType"/>
     60          </xsl:call-template>
     61        </xsl:if>
     62      </xsl:when>
     63   </xsl:choose>   
    5964
    6065  <!-- display the document -->
    61   <div id="content">
     66    <xsl:if test="$bookswitch != 'flashxml'">
     67       <xsl:text disable-output-escaping="yes">&lt;div id="content"&gt;</xsl:text>
     68    </xsl:if>
    6269    <xsl:apply-templates select="document">
    6370      <xsl:with-param name="collName" select="$collName"/>
    6471    </xsl:apply-templates>
    65     </div>
     72    <xsl:if test="$bookswitch != 'flashxml'">
     73    <xsl:text disable-output-escaping="yes">&lt;/div&gt;</xsl:text>
     74    </xsl:if>
    6675  </xsl:template>
    6776   
     
    6978   <xsl:param name="collName"/>
    7079 
     80   <xsl:if test="$bookswitch = 'flashxml'">
     81            <xsl:call-template name="xmldocumentContentPeeling">
     82                <xsl:with-param name="collName" select="$collName"/>
     83            </xsl:call-template>
     84        </xsl:if>
     85   
     86   <xsl:if test="$bookswitch = 'off'">
    7187    <xsl:call-template name="documentHeading">
    7288      <xsl:with-param name="collName" select="$collName"/>
     
    8197    <xsl:call-template name="documentArrows">
    8298      <xsl:with-param name="collName" select="$collName"/>
    83     </xsl:call-template>     
     99    </xsl:call-template>   
     100   </xsl:if>
     101   <xsl:if test="$bookswitch = 'on'">
     102            <xsl:call-template name="documentHeading">
     103                <xsl:with-param name="collName" select="$collName"/>
     104            </xsl:call-template>
     105            <div id="bookdiv"></div>
     106            <script type="text/javascript">
     107                <xsl:text disable-output-escaping="yes">
     108                    var doc_url = document.URL;
     109                    doc_url = doc_url.replace(/(&amp;|\?)book=[a-z]+/gi,'');
     110                    doc_url += '&amp;book=flashxml';
     111
     112                    // var src_image = "http://kia.cs.waikato.ac.nz:8080/greenstone3/sites/localsite/collect/gs2mgdemo/index/assoc/HASH49aa.dir/cover.jpg"
     113                    //var doc_url = "/greenstone3/library?a=d&amp;c=gs2mgdemo&amp;d=HASH49aab56062938fbe2ff7f1&amp;dt=hierarchy&amp;p.a=b&amp;p.s=ClassifierBrowse&amp;ed=1";
     114
     115                    var flash_plug_html = ""
     116                    flash_plug_html += '&lt;OBJECT align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" \n';
     117                    flash_plug_html += '  codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" \n';
     118                    flash_plug_html += '  height="100%" id="Book" swLiveConnect="true" \n';
     119                    flash_plug_html += '  width="100%"&gt;\n';
     120                    flash_plug_html += '    &lt;PARAM name="allowScriptAccess" value="always" /&gt;\n';
     121                    flash_plug_html += '    &lt;PARAM name="movie" value="Book.swf';
     122                    flash_plug_html += '?src_image=' + escape(img_cover);
     123                    flash_plug_html += '&amp;doc_url=' + escape(doc_url)
     124                    flash_plug_html += '" /&gt;\n';
     125                    flash_plug_html += '    &lt;PARAM name="quality" value="high" /&gt;\n';
     126                    flash_plug_html += '    &lt;PARAM name="bgcolor" value="#FFFFFF" /&gt;\n';
     127                    flash_plug_html += '    &lt;EMBED align="middle" \n';
     128                    flash_plug_html += '      allowScriptAccess="always" swLiveConnect="true" \n';
     129                    flash_plug_html += '      bgcolor="#FFFFFF" height="100%" name="Book" \n';
     130                    flash_plug_html += '      pluginspage="http://www.macromedia.com/go/getflashplayer" \n';
     131                    flash_plug_html += '      quality="high" \n';
     132                    flash_plug_html += '      src="Book.swf';
     133                    flash_plug_html += '?src_image=' + escape(img_cover);
     134                    flash_plug_html += '&amp;doc_url=' + escape(doc_url);
     135                    flash_plug_html += '"\n';
     136                    flash_plug_html += '      type="application/x-shockwave-flash" width="100%" /&gt;\n';
     137                    flash_plug_html += '&lt;/OBJECT&gt;\n';
     138                    var flash_div = document.getElementById("bookdiv");
     139                    flash_div.innerHTML = flash_plug_html;
     140                </xsl:text>
     141            </script>
     142        </xsl:if>   
    84143 </xsl:template>
    85144
     
    100159 <div id="docheadwrapper">
    101160  <div id="documentinfo">
    102     <xsl:if test="string($doCoverImage) != 'false' and (@docType='paged' or @docType='hierarchy')">
    103        <div id="headingimage">
    104          <xsl:call-template name="coverImage"/>
    105        </div>
    106     </xsl:if>
     161   
     162  <xsl:choose>
     163    <xsl:when test="$bookswitch = 'on'">
     164        <xsl:if test="string($doCoverImage) != 'false' and (@docType='paged' or @docType='hierarchy')">
     165         <div id="headingimage">
     166          <xsl:call-template name="coverImage"/>
     167         </div>
     168        </xsl:if>
     169    </xsl:when>
     170    <xsl:otherwise>
     171        <xsl:if test="string($doCoverImage) != 'false' and (@docType='paged' or @docType='hierarchy')">
     172          <div id="headingimage">
     173             <xsl:call-template name="coverImage"/>
     174          </div>
     175        </xsl:if>
    107176     
    108      <ul id="docbuttons" >
    109        <xsl:call-template name="documentButtons">
    110       <xsl:with-param name="collName" select="$collName"/>
    111        </xsl:call-template>
    112      </ul>
     177        <ul id="docbuttons" >
     178         <xsl:call-template name="documentButtons">
     179       <xsl:with-param name="collName" select="$collName"/>
     180         </xsl:call-template>
     181       </ul>
     182     </xsl:otherwise>
     183  </xsl:choose>     
    113184  </div>
    114185    <!--<div><xsl:call-template name="enrichServices">
    115186       <xsl:with-param name="collName" select="$collName"/>
    116187      </xsl:call-template></div>-->
    117      <xsl:if test="string($doTOC) != 'false'">
     188   <xsl:if test="$bookswitch = 'off'">
     189    <xsl:if test="string($doTOC) != 'false'">
    118190       <div id="toc">
    119191     <xsl:call-template name="TOC">
    120192       <xsl:with-param name="collName" select="$collName"/>
    121193     </xsl:call-template>
    122        </div>
    123       </xsl:if>
    124      
    125194      </div>
    126     </xsl:template>
     195    </xsl:if>
     196  </xsl:if> 
     197 </div>
     198 </xsl:template>
    127199
    128200  <xsl:template name="coverImage">
    129     <img><xsl:attribute name='src'><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='archivedir']"/>/cover.jpg</xsl:attribute></img>
     201  <xsl:choose>
     202            <xsl:when test="$bookswitch = 'on'">
     203                <script type="text/javascript">
     204                    <xsl:text disable-output-escaping="yes">var img_cover = '</xsl:text><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='archivedir']"/>/cover.jpg<xsl:text disable-output-escaping="yes">';</xsl:text>
     205                </script>
     206            </xsl:when>
     207            <xsl:otherwise>
     208                    <img><xsl:attribute name='src'><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='archivedir']"/>/cover.jpg</xsl:attribute></img>
     209            </xsl:otherwise>
     210        </xsl:choose>
    130211  </xsl:template>
    131212
     
    266347   <div class="documenttext">
    267348    <xsl:choose>
    268       <xsl:when test="@docType='simple'">
    269     <xsl:apply-templates select="nodeContent"/>
    270       </xsl:when>
     349      <xsl:when test="@docType='simple'"><xsl:apply-templates select="nodeContent"/></xsl:when>
    271350      <xsl:otherwise>
    272351    <xsl:apply-templates select="descendant-or-self::node()/documentNode" mode="content"/>
     
    290369    <xsl:for-each select="node()">
    291370      <xsl:choose>
    292     <xsl:when test="not(name())"><xsl:value-of select="." disable-output-escaping="yes"/></xsl:when>
     371    <xsl:when test="not(name())">
     372        <xsl:value-of select="." disable-output-escaping="yes"/>
     373    </xsl:when>
    293374    <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
    294375      </xsl:choose>
    295376    </xsl:for-each>
    296377  </xsl:template>
     378 
     379  <xsl:template name="xmldocumentContentPeeling">
     380        <xsl:choose>
     381            <xsl:when test="@docType='simple'">
     382                <xsl:apply-templates select="nodeContent"/>
     383            </xsl:when>
     384            <xsl:otherwise>
     385                <xsl:call-template name="xmlpeelingContents" />
     386            </xsl:otherwise>
     387        </xsl:choose>
     388    </xsl:template>
     389   
     390  <xsl:template name="xmlpeelingContents">
     391        <xsl:if test="documentNode">
     392            <xsl:apply-templates select="documentNode" mode="xmlpeeling" />
     393        </xsl:if>
     394    </xsl:template>
     395
     396    <xsl:template match="documentNode" mode="xmlpeeling">
     397        <!-- get title -->
     398        <xsl:choose>
     399            <xsl:when test="nodeContent">
     400                <xsl:text disable-output-escaping="yes">
     401                    &lt;Section&gt;
     402                    &lt;Description&gt;
     403                    &lt;Metadata name="Title"&gt;
     404                </xsl:text>
     405                <xsl:value-of select="normalize-space(metadataList/metadata[@name='Title'])"/>
     406                <xsl:text disable-output-escaping="yes">
     407                    &lt;/Metadata&gt;
     408                    &lt;/Description&gt;
     409                </xsl:text>
     410                <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
     411                <xsl:text disable-output-escaping="yes">&lt;/Sec&gt;</xsl:text>
     412            </xsl:when>
     413        </xsl:choose>
     414
     415        <!-- recurse to the children -->
     416        <xsl:if test="documentNode">
     417            <xsl:apply-templates select="documentNode" mode="xmlpeeling" />
     418        </xsl:if>
     419
     420        <!-- end the section -->
     421        <xsl:text disable-output-escaping="yes">
     422            &lt;/Section&gt;
     423        </xsl:text>
     424    </xsl:template>
    297425 
    298426  <!-- match any file nodes -->
  • trunk/gsdl3/web/interfaces/default/transform/pref.xsl

    r13505 r13996  
    2222  <xsl:template match="pageResponse">
    2323    <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
     24   
     25   <xsl:variable name="tidyoption"><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='tidyoption']"/></xsl:variable>
     26     
    2427    <xsl:call-template name="standardPageBanner">
    2528      <xsl:with-param name="collName" select="$collName"/>
     
    3841      <ul id="presprefs"><xsl:call-template name="pres-prefs"/></ul>
    3942      <ul id="berrybasketprefs" ><xsl:call-template name="berrybasket-prefs"/></ul>
     43     
     44      <xsl:if test="$tidyoption='tidy'">
     45        <ul id="bookprefs"><xsl:call-template name="book-prefs"/></ul>
     46      </xsl:if>
     47     
    4048      <div class="formheading"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.searchpref')"/></div>
    4149      <ul id="searchprefs"><xsl:call-template name="search-prefs"/></ul>
     
    8189  </xsl:template>
    8290
    83 
     91<xsl:template name="book-prefs">
     92      <xsl:variable name="book"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='book']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/></xsl:when><xsl:otherwise>off</xsl:otherwise></xsl:choose></xsl:variable>
     93     
     94    <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.book')"/> <select name="book">
     95        <option value="on"><xsl:if test="$book='on'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.berrybasket.on')"/></option>
     96    <option value="off"><xsl:if test="$book='off'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref.berrybasket.off')"/></option>
     97      </select>
     98   
     99  </xsl:template>
    84100</xsl:stylesheet>
  • trunk/gsdl3/web/interfaces/default/transform/style.xsl

    r13505 r13996  
    1717  <!-- the main page layout template is here -->
    1818  <xsl:template match="page">
    19     <html>
     19    <xsl:variable name="bookswitch"><xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/></xsl:variable>
     20    <xsl:variable name="a"><xsl:value-of select="/page/pageRequest/paramList/param[@name='a']/@value"/></xsl:variable>
     21
     22    <xsl:choose>
     23      <xsl:when test="$bookswitch = 'flashxml' and $a = 'd'">
     24         <html>
     25          <xsl:call-template name="response" />
     26        </html>
     27      </xsl:when>
     28
     29      <xsl:otherwise>   
     30        <html>
    2031         <xsl:call-template name="pageHead"/>
    21      
    22    <body>
    23       <div id="globalwrapper">
     32          <body>
     33           <div id="globalwrapper">
     34          <xsl:call-template name="response" />
     35          <xsl:call-template name="greenstoneFooter"/>
     36       </div>
     37          </body>
     38        </html>
     39      </xsl:otherwise>
     40    </xsl:choose>
     41  </xsl:template>
     42
     43 <xsl:template name="response">
    2444      <xsl:apply-templates select="pageResponse"/>
    2545          <xsl:if test="descendant::error">
     
    5373            </div>
    5474          </xsl:if>
    55           <xsl:call-template name="greenstoneFooter"/>
    56      </div>
    57       </body>
    58     </html>
    59   </xsl:template>
     75 </xsl:template>
    6076
    6177  <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
Note: See TracChangeset for help on using the changeset viewer.