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

Revision 28333, 6.9 KB (checked in by jlwhisler, 7 years ago)

Updated Homepage tutorial files to use library_name and interface_name variable instead of hard-coding library/default. Added an icon for the page. Corrected the AddUser? url.

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/{$interface_name}/style/themes/tutorialbliss/style.css" rel="stylesheet" type="text/css" media="screen" />
17<link rel="icon" href="interfaces/{$interface_name}/style/themes/tutorialbliss/images/icon.jpg" type="image/jpg"/>
18<!--
19Design by Free CSS Templates
20http://www.freecsstemplates.org
21Released for free under a Creative Commons Attribution 2.5 License
22
23Name       : Heavenly Bliss 
24Description: A two-column, fixed-width design with dark color scheme.
25Version    : 1.0
26Released   : 20130517
27
28-->
29</head>
30<body>
31<div id="banner-wrapper">
32    <div id="banner"><img src="interfaces/{$interface_name}/style/themes/tutorialbliss/images/ngunguru.jpg" width="1200" height="300" alt="" /></div>
33</div>
34<div id="header-wrapper">
35    <div id="header">
36        <div id="logo">
37            <h1><a href="{$library_name}"><xsl:call-template name="siteName"/></a></h1>
38            <p>A <a href="http://www.greenstone.org/">Greenstone3</a> Digital Library</p>
39        </div>
40    </div>
41</div>
42<div id="wrapper"> 
43    <!-- end #header -->
44    <div id="page">
45        <div id="page-bgtop">
46            <div id="page-bgbtm">
47                <div id="sidebar">
48                    <ul>
49                        <li>
50                            <h2><a href="?a=q&amp;rt=d&amp;s=TextQuery">Cross-Collection Search:</a></h2>
51                            <div id="search" > 
52                                    <xsl:call-template name="searchBox"/>
53                            </div>
54                            <div style="clear: both;"></div>
55                        </li>
56                        <li>
57                            <h2>Library Links</h2>
58                            <ul>
59                                    <xsl:call-template name="loginButton"/>
60                                <li><a href="{$library_name}/collection//page/help">Help</a></li>
61                                <li><a href="{$library_name}/collection//page/pref">Preferences</a></li>
62                            </ul>
63                        </li>
64                        <li>
65                            <h2>External Links</h2>
66                            <ul>
67                                <li><a href="http://www.greenstone.org">Greenstone</a></li>
68                                <li><a href="http://wiki.greenstone.org">Greenstone Wiki</a></li>
69                            </ul>
70                        </li>
71                    </ul>
72                </div>
73                <!-- end #sidebar -->
74                <div id="content">
75                    <div class="post">
76                        <h2 class="title"><a href="#">Welcome to your new home page!</a></h2>
77                        <div class="entry">
78                            <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>
79                            <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>
80                            <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>
81                            <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>
82                            <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>
83                        </div>
84                    </div>
85                </div>
86                <!-- end #content -->
87               
88                <div id="sidebar2">
89                    <ul>
90                        <li>
91                            <h2>Select a Collection:</h2>
92                            <ul>
93                                <xsl:call-template name="collectionsList"/>
94                            </ul>
95                        </li>                   
96                    </ul>
97                </div>
98                <div style="clear: both;"></div>
99            </div>
100        </div>
101    </div>
102    <!-- end #page -->
103</div>
104<div id="footer">
105    <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>
106</div>
107<!-- end #footer -->
108</body>
109</html>
110</xsl:template>
111   
112<xsl:template name="collectionsList">
113    <xsl:for-each select="./page/pageResponse/collectionList/collection">
114    <xsl:variable name="collectionName" select="@name"/>
115        <li>
116        <a href="{$library_name}/collection/{$collectionName}/page/about">
117        <xsl:value-of select="displayItem[@name='name']"/>
118        </a>
119        </li>
120    </xsl:for-each>
121</xsl:template>
122
123<xsl:template name="searchBox">
124<xsl:for-each select="//page/pageResponse/serviceList/service[@name='TextQuery']">
125<form name="QuickSearch" method="get" action="{$library_name}">
126<input type="hidden" name="a" value="q"/>
127<input type="hidden" name="rt" value="rd"/>
128<input type="hidden" name="s" value="{@name}"/>
129<input type="hidden" name="s1.collection" value="all"/>
130<input type="text" name="s1.query" size="20" id="search-text" value="" />
131<input type="submit" id="search-submit">
132<xsl:attribute name="value">
133<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.quick_search')"/>
134</xsl:attribute>
135</input>
136</form>     
137</xsl:for-each>
138</xsl:template>
139   
140    <xsl:template name="loginButton">
141            <xsl:variable name="username" select="/page/pageRequest/userInformation/@username"/>
142                <xsl:choose>
143                    <xsl:when test="$username">
144                        <li><a>
145                            <xsl:attribute name="href"><xsl:value-of select="$library_name"/>/admin/AccountSettings?s1.username=<xsl:value-of select="$username"/></xsl:attribute><xsl:value-of select="$username"/>
146                        </a></li>
147                        <li><a href="{$library_name}/admin/AddUser">Register a new user</a></li>
148                                <li><a href="{$library_name}/admin/ListUsers">Administration</a></li>
149                        <li><a><xsl:attribute name="href"><xsl:value-of select="$library_name"/>?logout=</xsl:attribute>Logout</a></li>
150                    </xsl:when>
151                    <xsl:otherwise>
152                        <li><a href="?a=p&amp;sa=login&amp;redirectURL={$library_name}%3Fa=p%26sa=home">Login
153                            <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/></xsl:attribute>
154
155                        </a></li>
156                    </xsl:otherwise>
157                </xsl:choose>
158</xsl:template>
159   
160   
161</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.