Changeset 18482


Ignore:
Timestamp:
2009-02-09T17:49:07+13:00 (15 years ago)
Author:
max
Message:

Simplified the site home transformation, library.xsl defines the output method and allow the user to create its own gslib elements, addind util.xsl containing all the gslib elements provided by us.

Location:
greenstone3/trunk/web/interfaces/default/transform
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • greenstone3/trunk/web/interfaces/default/transform/home.xsl

    r18388 r18482  
    11<?xml version="1.0" encoding="ISO-8859-1"?>
    22<xsl:stylesheet version="1.0"
    3   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    4   xmlns:java="http://xml.apache.org/xslt/java"
    5   xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
    6   extension-element-prefixes="java util"
    7   exclude-result-prefixes="java util">
     3    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     4    xmlns:java="http://xml.apache.org/xslt/java"
     5    xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
     6    xmlns:gslib="http://www.greenstone.org/skinning"
     7    extension-element-prefixes="java util"
     8    exclude-result-prefixes="util java util">
    89
    9   <!-- style includes global params interface_name, library_name -->
    10   <xsl:include href="style.xsl"/>
     10 
     11  <xsl:template match="page/pageResponse">
     12 
     13   <!-- the main page layout template is here -->
     14    <html>
     15           
     16          <head>
     17            <title>
     18                <gslib:homePageTitle/>
     19            </title>
     20            <link rel="stylesheet" href="interfaces/default/style/core.css" type="text/css"/>
     21          </head>
     22         
     23          <body><gslib:textDirectionAttribute/>
     24       
     25        <div id="page-wrapper">
     26        <gslib:displayErrorsIfAny/>
     27     
     28       
     29        <div id="banner">
     30          <p>
     31            <img src="interfaces/default/images/gsdlhead.gif"><xsl:attribute name="alt"><gslib:greenstoneLogoAlternateText/></xsl:attribute>
     32            </img>
     33          </p>
     34        </div>
     35       
     36        <div id="content">
     37       
     38            <div class="divbar"><gslib:selectACollectionTextBar/></div>
     39           
     40            <div class="QuickSearch">
     41                <gslib:crossCollectionQuickSearchForm/>
     42            </div>
     43               
     44           
     45            <ul id="collectionlist">
     46                <xsl:for-each select="collectionList/collection">
     47                    <li>
     48                        <gslib:collectionLinkWithImage/>
     49                    </li>
     50                </xsl:for-each>
     51            </ul>
     52           
     53            <gslib:serviceClusterList/>
     54           
     55            <div class="divbar"><gslib:noTextBar/></div>
     56           
     57            <ul id="servicelist">
     58                <xsl:for-each select="serviceList/service[@type='query']">
     59                    <li><gslib:serviceLink/></li>
     60                </xsl:for-each>
     61               
     62             <!--uncomment the line below to display an authentication link inside a <li>-->
     63             <!--<gslib:authenticationLink/>-->
     64               
     65             <!--uncomment the line below to display a library interface link inside a <li>-->
     66             <!--<gslib:libraryInterfaceLink/>-->
     67            </ul>
     68           
     69        </div>
    1170
    12   <xsl:output method="html"/> 
    13  
    14   <!-- the main page layout template is here -->
    15   <xsl:template match="page">
    16     <html>
    17       <head>
    18     <title>
    19       <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
    20       <xsl:call-template name="pageTitle"/><xsl:text> </xsl:text>
    21     </title>
    22     <xsl:call-template name="globalStyle"/>
    23     <xsl:call-template name="pageStyle"/>
    24       </head>
    25       <body>
    26     <xsl:attribute name="dir"><xsl:call-template name="direction"/></xsl:attribute>
    27     <div id="page-wrapper">
    28       <xsl:call-template name="response" />
    29       <xsl:call-template name="greenstoneFooter"/>
    30     </div>
    31       </body>
     71       
     72            <div id="footer">
     73                <div class="divbar"><gslib:poweredByGS3TextBar/></div>
     74            </div>
     75         
     76        </div>
     77       
     78       </body>
    3279    </html>
    33   </xsl:template>
    34 
    35   <xsl:template name="pageTitle">
    36     <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
    37   </xsl:template>
    38 
    39   <!-- page specific style goes here -->
    40   <xsl:template name="pageStyle"/>
    41 
    42   <xsl:template match="pageResponse">
    43     <xsl:call-template name="pageBanner"/>
    44     <xsl:apply-templates select="serviceList/service[@name='TextQuery']"/>
    45     <xsl:apply-templates select="collectionList"/>   
    46     <xsl:apply-templates select="serviceClusterList"/>
    47     <xsl:apply-templates select="serviceList"/>
    48   </xsl:template>
    49 
    50   <xsl:template name="pageBanner">
    51     <div id="banner">
    52       <p>
    53     <img src="interfaces/default/images/gsdlhead.gif"><xsl:attribute name="alt"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/></xsl:attribute>
    54     </img>
    55       </p>
    56     </div>
    57     <div id="content">
    58       <xsl:call-template name="dividerBar">
    59     <xsl:with-param name="text" select="util:getInterfaceText($interface_name, /page/@lang, 'home.select_a_collection')"/>
    60       </xsl:call-template> 
    61     </div>
    62   </xsl:template>
    63 
    64   <xsl:template match="collectionList">
    65     <ul id="collectionlist">
    66       <xsl:for-each select="collection">
    67     <li>
    68      
    69       <xsl:choose>
    70         <xsl:when test="displayItem[@name='icon']">
    71               <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}">
    72                 <img>
    73           <xsl:attribute name="src">
    74             <xsl:value-of select="metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="displayItem[@name='icon']"/>
    75           </xsl:attribute>
    76           <xsl:attribute name="alt">
    77             <xsl:value-of select="displayItem[@name='name']"/>
    78           </xsl:attribute>
    79         </img>
    80           </a> 
    81         </xsl:when>
    82         <xsl:otherwise>
    83           <a class="noimage" href="{$library_name}?a=p&amp;sa=about&amp;c={@name}"> 
    84         <xsl:value-of select="displayItem[@name='name']"/>
    85           </a>
    86         </xsl:otherwise>
    87       </xsl:choose>         
    88      
    89     </li>
    90       </xsl:for-each>
    91     </ul>
    92   </xsl:template>
    93  
    94   <xsl:template match="serviceClusterList">
    95     <xsl:for-each select="serviceCluster">
    96       <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}"><xsl:value-of select='@name'/><xsl:value-of select="displayItem[@name='name']"/></a>
    97     </xsl:for-each>
    98   </xsl:template>
    99 
    100   <xsl:template match="service[@name='TextQuery']">
    101     <div class="QuickSearch">
    102       <form name="QuickSearch" method="get" action="{$library_name}">
    103     <input type="hidden" name="a" value="q"/>
    104     <input type="hidden" name="rt" value="rd"/>
    105     <input type="hidden" name="s" value="{@name}"/>
    106     <input type="hidden" name="s1.collection" value="all"/>
    107     <input type="text" name="s1.query" size="20"/>
    108     <input type="submit"><xsl:attribute name="value"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.quick_search')"/></xsl:attribute></input>
    109       </form>
    110     </div>
    111   </xsl:template>
    112 
    113   <xsl:template match="serviceList">
    114     <xsl:call-template name="dividerBar"/>
    115     <ul id="servicelist">
    116       <xsl:for-each select="service[@type='query']">
    117     <li><a href="{$library_name}?a=q&amp;rt=d&amp;s={@name}"><xsl:value-of select="displayItem[@name='name']"/></a><xsl:value-of select="displayItem[@name='description']"/></li>
    118       </xsl:for-each>
    119       <!--uncomment to display an authentication link-->
    120       <!--<xsl:for-each select="service[@type='authen']">
    121       <li><a href="{$library_name}?a=g&amp;rt=r&amp;sa=authen&amp;s={@name}&amp;s1.aup=Login&amp;s1.un=&amp;s1.asn="><xsl:value-of select="displayItem[@name='name']"/></a><xsl:value-of select="displayItem[@name='description']"/></li>      </xsl:for-each>-->
    122       <!--uncomment to display a library interface link-->
    123       <!--<li><a href="{$library_name}?a=p&amp;sa=gli4gs3"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.librarian_interface')"/></a></li>-->
    124     </ul>
     80   
     81   
    12582  </xsl:template>
    12683</xsl:stylesheet> 
  • greenstone3/trunk/web/interfaces/default/transform/library.xsl

    r18438 r18482  
    22
    33<xsl:stylesheet version="1.0"
    4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    5 xmlns:gslib="http://www.greenstone.org/XSL/Library"
    6 exclude-result-prefixes="xalan gslib gsf xslt">
     4    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     5    xmlns:gslib="http://www.greenstone.org/XSL/Library"
     6    exclude-result-prefixes="util xalan gslib gsf xslt">
    77
    88
    9 <xsl:output method="html"
    10 doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
    11 doctype-system="http://www.w3.org/TR/html4/loose.dtd"
    12 />
     9<xsl:output
     10    method="html"
     11    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
     12    doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
     13
     14   
     15<!--Load the Greenstone Utility file that contains all the code needed to expand all GSLib elements-->
     16<xsl:include href="util.xsl"/>
    1317
    1418
    1519
    16     <!-- some global parameters - these are set by whoever is invoking the transformation -->
    17   <xsl:param name="interface_name"/>
    18   <xsl:param name="library_name"/>
    19  
    20   <!-- every pages ....................................................................... -->
    21  
    22     <xsl:variable name="a"><xsl:value-of select="/page/pageRequest/paramList/param[@name='a']/@value"/></xsl:variable>
    23     <xsl:variable name="collections" select="/page/pageResponse/collectionList/collection"/>
    24  
    25     <xsl:template name="GS2LibDividerBar">
    26    <xsl:param name='text'/>
    27       <xsl:choose>
    28       <xsl:when test="$text">
    29      <div class="divbar"><xsl:value-of select="$text"/></div>
    30       </xsl:when>
    31       <xsl:otherwise>
    32      <div class="divbar"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></div>
    33       </xsl:otherwise>
    34     </xsl:choose>
    35   </xsl:template>
    36  
    37     <xsl:template match="error">
    38     Error: <xsl:value-of select="."/>
    39   </xsl:template>
    40  
    41     <!-- site home ....................................................................... -->
    42 
    43 
    44 <xsl:template name="pageTitleLanguageDependant">
    45  <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
    46 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/><xsl:text> </xsl:text>
    47 </xsl:template>
    48 
    49 
    50 <xsl:template name="greenstoneLogoAlternateText">
    51 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
    52 </xsl:template>
    53 
    54 
    55 <xsl:template name="collectionLinkWithImage">
    56                <xsl:choose>
    57               <xsl:when test="displayItem[@name='icon']">
    58               <a href="{$library_name}?a=p&amp;amp;sa=about&amp;amp;c={@name}">
    59                 <img>
    60                <xsl:attribute name="src">
    61                  <xsl:value-of select="metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="displayItem[@name='icon']"/>
    62                </xsl:attribute>
    63                <xsl:attribute name="alt">
    64                     <xsl:value-of select="displayItem[@name='name']"/>
    65                </xsl:attribute>
    66              </img>
    67                </a> 
    68           </xsl:when>
    69               <xsl:otherwise>
    70                <a class="noimage" href="{$library_name}?a=p&amp;amp;sa=about&amp;amp;c={@name}"> 
    71                  <xsl:value-of select="displayItem[@name='name']"/>
    72                </a>
    73               </xsl:otherwise>
    74            </xsl:choose>
    75 </xsl:template>
    76 
    77 
    78     <xsl:template name="quickSearchForm">
    79     <form name="QuickSearch" method="get" action="{$library_name}">
    80     <input type="hidden" name="a" value="q"/>
    81     <input type="hidden" name="rt" value="rd"/>
    82     <input type="hidden" name="s" value="{/page/pageResponse/serviceList/service[@name='TextQuery']/@name}"/>
    83     <input type="hidden" name="s1.collection" value="all"/>
    84     <input type="text" name="s1.query" size="20"/>
    85     <input type="submit" value="Quick Search"/>
    86     </form>
    87     </xsl:template>
    88    
    89    
    90       <xsl:template match="serviceClusterList">
    91     <xsl:for-each select="serviceCluster">
    92       <a href="{$library_name}?a=p&amp;amp;sa=about&amp;amp;c={@name}"><xsl:value-of select='@name'/><xsl:value-of select="displayItem[@name='name']"/></a>
    93     </xsl:for-each>
    94   </xsl:template>
    95  
    96     <xsl:template name="test" match="pageResponse/serviceList">
    97       <xsl:for-each select="service[@type='query']">
    98       <li><a href="{$library_name}?a=q&amp;amp;rt=d&amp;amp;s={@name}"><xsl:value-of select="displayItem[@name='name']"/></a><xsl:value-of select="displayItem[@name='description']"/>
    99       </li>
    100       </xsl:for-each>
    101       <!--uncomment to display an authentication link-->
    102        <!--<xsl:for-each select="service[@type='authen']">
    103       <li><a href="{$library_name}?a=g&amp;rt=r&amp;sa=authen&amp;s={@name}&amp;s1.aup=Login&amp;s1.un=&amp;s1.asn="><xsl:value-of select="displayItem[@name='name']"/></a><xsl:value-of select="displayItem[@name='description']"/></li>      </xsl:for-each>-->
    104       <!--uncomment to display a library interface link-->
    105       <!--<li><a href="{$library_name}?a=p&amp;sa=gli4gs3">The Librarian Interface</a></li>-->
    106        </xsl:template>
    107  
    108  
    109     <xsl:template name="poweredByGS3LanguageDependant">
    110             <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gs3power')"/>
    111   </xsl:template>
    11220
    11321
Note: See TracChangeset for help on using the changeset viewer.