root/documentation/trunk/tutorial_sample_files/custom/home-tutorial-final.xsl @ 27854

Revision 27854, 6.2 KB (checked in by jlwhisler, 6 years ago)

New files for the new tutorial on GS3 home page customization

Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<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    xmlns:gslib="http://www.greenstone.org/skinning"
7    extension-element-prefixes="java util"
8    exclude-result-prefixes="java util">
9   
10<xsl:template match="/">
11<html>
12<head>
13<meta name="keywords" content="" />
14<meta name="description" content="" />
15<title><xsl:call-template name="siteName"/></title>
16<link href="interfaces/default/style/themes/tutorialbliss/style.css" rel="stylesheet" type="text/css" media="screen" />
17<!--
18Design by Free CSS Templates
19http://www.freecsstemplates.org
20Released for free under a Creative Commons Attribution 2.5 License
21
22Name       : Heavenly Bliss 
23Description: A two-column, fixed-width design with dark color scheme.
24Version    : 1.0
25Released   : 20130517
26
27-->
28</head>
29<body>
30<div id="banner-wrapper">
31    <div id="banner"><img src="interfaces/default/style/themes/tutorialbliss/images/ngunguru.jpg" width="1200" height="300" alt="" /></div>
32</div>
33<div id="header-wrapper">
34    <div id="header">
35        <div id="logo">
36            <h1><a href="library"><xsl:call-template name="siteName"/></a></h1>
37            <p>A <a href="http://www.greenstone.org/">Greenstone3</a> Digital Library</p>
38        </div>
39    </div>
40</div>
41<div id="wrapper"> 
42    <!-- end #header -->
43    <div id="page">
44        <div id="page-bgtop">
45            <div id="page-bgbtm">
46                <div id="sidebar">
47                    <ul>
48                        <li>
49                            <h2><a href="?a=q&amp;rt=d&amp;s=TextQuery">Cross-Collection Search:</a></h2>
50                            <div id="search" > 
51                                    <xsl:call-template name="searchBox"/>
52                            </div>
53                            <div style="clear: both;"></div>
54                        </li>
55                        <li>
56                            <h2>Library Links</h2>
57                            <ul>
58                                    <xsl:call-template name="loginButton"/>
59                                <li><a href="library/collection//page/help">Help</a></li>
60                                <li><a href="library/collection//page/pref">Preferences</a></li>
61                            </ul>
62                        </li>
63                        <li>
64                            <h2>External Links</h2>
65                            <ul>
66                                <li><a href="http://www.greenstone.org">Greenstone</a></li>
67                                <li><a href="http://wiki.greenstone.org">Greenstone Wiki</a></li>
68                            </ul>
69                        </li>
70                    </ul>
71                </div>
72                <!-- end #sidebar -->
73                <div id="content">
74                    <div class="post">
75                        <h2 class="title"><a href="#">Welcome to your new home page!</a></h2>
76                        <div class="entry">
77                            <p>A new home page can be created for your Greenstone3 digital library by modifying or replacing the <span style="font-family:courier;">home.xsl</span> file found in the <i>Greenstone3/web/interfaces/default/transform/pages</i> folder.</p>
78                            <p>For this homepage, we first downloaded a free CSS template from <a href="http://www.freecsstemplates.org/previews/heavenlybliss/" rel="nofollow">FreeCSSTemplates.org</a>, released under a <a href="http://creativecommons.org/licenses/by/2.5/">Creative Commons Attributions 2.5</a> license, so you're pretty much free to do whatever you want with it (even use it commercially) provided you keep the links in the footer intact.</p>
79                            <p>We made a few modifications to the HTML of the <span style="font-family:courier;">index.html</span> page-like removing a navigation bar at the top, changing the main photo, and removing or replacing parts of the text, as well as removing some escape characters (e.g. <i>&amp;nbsp;</i>, <i>&amp;copy;</i>), before including it in this tutorial.</p>
80                            <p>In the tutorial, you create your own <span style="font-family:courier;">home.xsl</span>, and <b>define</b> and <b>call</b> some XSL templates that make it possible to do many things, like include an up-to-date list of collections in your library, have a cross-collection search box, and have links that appear/disappear when you login.</p>
81                            <p>If you want to completely change the layout of your entire library, you probably want to define your very own interface. You can read more about interfaces in the <a href="http://www.greenstone.org/docs/greenstone3/manual.pdf">Greenstone3 manual</a>. Tutorial coming soon!</p>
82                        </div>
83                    </div>
84                </div>
85                <!-- end #content -->
86               
87                <div id="sidebar2">
88                    <ul>
89                        <li>
90                            <h2>Select a Collection:</h2>
91                            <ul>
92                                <xsl:call-template name="collectionsList"/>
93                            </ul>
94                        </li>                   
95                    </ul>
96                </div>
97                <div style="clear: both;"></div>
98            </div>
99        </div>
100    </div>
101    <!-- end #page -->
102</div>
103<div id="footer">
104    <p> 2013 Sitename.com. | Photo by <a href="http://www.leagoon.com/">Leagoon</a> | Design by <a href="http://www.freecsstemplates.org/" rel="nofollow">FreeCSSTemplates.org</a>.</p>
105</div>
106<!-- end #footer -->
107</body>
108</html>
109</xsl:template>
110   
111<xsl:template name="collectionsList">
112    <xsl:for-each select="./page/pageResponse/collectionList/collection">
113    <xsl:variable name="collectionName" select="@name"/>
114        <li>
115        <a href="library/collection/{$collectionName}/page/about">
116        <xsl:value-of select="displayItem[@name='name']"/>
117        </a>
118        </li>
119    </xsl:for-each>
120</xsl:template>
121
122    <xsl:template name="searchBox">
123        <xsl:for-each select="//page/pageResponse">
124        <div id="quickSearch">
125            <gslib:crossCollectionQuickSearchForm/>
126        </div>
127        </xsl:for-each>
128    </xsl:template>
129   
130    <xsl:template name="loginButton">
131            <xsl:variable name="username" select="/page/pageRequest/userInformation/@username"/>
132                <xsl:choose>
133                    <xsl:when test="$username">
134                        <li><a>
135                            <xsl:attribute name="href">library/admin/AccountSettings?s1.username=<xsl:value-of select="$username"/></xsl:attribute><xsl:value-of select="$username"/>
136                        </a></li>
137                        <li><a href="library/admin/Register">Register a new user</a></li>
138                                <li><a href="library/admin/ListUsers">Administration</a></li>
139                        <li><a><xsl:attribute name="href">library?logout=</xsl:attribute>Logout</a></li>
140                    </xsl:when>
141                    <xsl:otherwise>
142                        <li><a href="?a=p&amp;sa=login&amp;redirectURL=library%3Fa=p%26sa=home">Login
143                            <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/></xsl:attribute>
144
145                        </a></li>
146                    </xsl:otherwise>
147                </xsl:choose>
148</xsl:template>
149   
150   
151</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.