Subversion Repositories jafer

Compare Revisions

Ignore whitespace Rev 565 → Rev 566

/trunk/webapps/Portlet/images/previous_inactive.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/webapps/Portlet/images/previous_inactive.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/record_big.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/record_big.png
===================================================================
--- trunk/webapps/Portlet/images/record_big.png (revision 565)
+++ trunk/webapps/Portlet/images/record_big.png (revision 566)
/trunk/webapps/Portlet/images/record_big.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/next_inactive.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/next_inactive.png
===================================================================
--- trunk/webapps/Portlet/images/next_inactive.png (revision 565)
+++ trunk/webapps/Portlet/images/next_inactive.png (revision 566)
/trunk/webapps/Portlet/images/next_inactive.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/results.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/results.png
===================================================================
--- trunk/webapps/Portlet/images/results.png (revision 565)
+++ trunk/webapps/Portlet/images/results.png (revision 566)
/trunk/webapps/Portlet/images/results.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/history.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/history.png
===================================================================
--- trunk/webapps/Portlet/images/history.png (revision 565)
+++ trunk/webapps/Portlet/images/history.png (revision 566)
/trunk/webapps/Portlet/images/history.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/search.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/search.png
===================================================================
--- trunk/webapps/Portlet/images/search.png (revision 565)
+++ trunk/webapps/Portlet/images/search.png (revision 566)
/trunk/webapps/Portlet/images/search.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/re-run.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/re-run.png
===================================================================
--- trunk/webapps/Portlet/images/re-run.png (revision 565)
+++ trunk/webapps/Portlet/images/re-run.png (revision 566)
/trunk/webapps/Portlet/images/re-run.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/search_cancel.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/search_cancel.png
===================================================================
--- trunk/webapps/Portlet/images/search_cancel.png (revision 565)
+++ trunk/webapps/Portlet/images/search_cancel.png (revision 566)
/trunk/webapps/Portlet/images/search_cancel.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/previous.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/previous.png
===================================================================
--- trunk/webapps/Portlet/images/previous.png (revision 565)
+++ trunk/webapps/Portlet/images/previous.png (revision 566)
/trunk/webapps/Portlet/images/previous.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/record.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/record.png
===================================================================
--- trunk/webapps/Portlet/images/record.png (revision 565)
+++ trunk/webapps/Portlet/images/record.png (revision 566)
/trunk/webapps/Portlet/images/record.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/next.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/next.png
===================================================================
--- trunk/webapps/Portlet/images/next.png (revision 565)
+++ trunk/webapps/Portlet/images/next.png (revision 566)
/trunk/webapps/Portlet/images/next.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/return.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/return.png
===================================================================
--- trunk/webapps/Portlet/images/return.png (revision 565)
+++ trunk/webapps/Portlet/images/return.png (revision 566)
/trunk/webapps/Portlet/images/return.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/history_big.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/history_big.png
===================================================================
--- trunk/webapps/Portlet/images/history_big.png (revision 565)
+++ trunk/webapps/Portlet/images/history_big.png (revision 566)
/trunk/webapps/Portlet/images/history_big.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/results_big.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/results_big.png
===================================================================
--- trunk/webapps/Portlet/images/results_big.png (revision 565)
+++ trunk/webapps/Portlet/images/results_big.png (revision 566)
/trunk/webapps/Portlet/images/results_big.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/edit.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/edit.png
===================================================================
--- trunk/webapps/Portlet/images/edit.png (revision 565)
+++ trunk/webapps/Portlet/images/edit.png (revision 566)
/trunk/webapps/Portlet/images/edit.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/search_big.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/search_big.png
===================================================================
--- trunk/webapps/Portlet/images/search_big.png (revision 565)
+++ trunk/webapps/Portlet/images/search_big.png (revision 566)
/trunk/webapps/Portlet/images/search_big.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/help.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/help.png
===================================================================
--- trunk/webapps/Portlet/images/help.png (revision 565)
+++ trunk/webapps/Portlet/images/help.png (revision 566)
/trunk/webapps/Portlet/images/help.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/images/search_go.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/webapps/Portlet/images/search_go.png
===================================================================
--- trunk/webapps/Portlet/images/search_go.png (revision 565)
+++ trunk/webapps/Portlet/images/search_go.png (revision 566)
/trunk/webapps/Portlet/images/search_go.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/webapps/Portlet/Tango-license.txt
===================================================================
--- trunk/webapps/Portlet/Tango-license.txt (revision 0)
+++ trunk/webapps/Portlet/Tango-license.txt (revision 566)
@@ -0,0 +1,4 @@
+JaferPortlets makes use of some icons from the Tango Desktop Project
+ under the Creative Commons
+Attribution-ShareAlike 2.5 License
+.
\ No newline at end of file
/trunk/webapps/Portlet/Tango-license.txt
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/webapps/Portlet/xsl/list.xsl
===================================================================
--- trunk/webapps/Portlet/xsl/list.xsl (revision 565)
+++ trunk/webapps/Portlet/xsl/list.xsl (revision 566)
@@ -1,5 +1,8 @@
+
+
+
images
@@ -7,52 +10,116 @@
en_US
-
-

-
-
- New Search
-
-
-
-
-
-
- Previous Records
-
-
-
-
-
-
-
- Next Records
-
-
-
-
-
-
-

Your search has not found any matching records!

+
+
+
+ Please try again.
+
+
+
+
+
+ Search Results
+ Search Results
+
+
+
+
+
+
+
+
+
+
+ Your search has not found any matching records.
+
+
+
+
+ Your search has found record.
+
+
+
+
+
+ Your search has found records
+
+ Displaying -
+
+
+
+
+
+
+ Previous Results
+ border="0" src="{$mediaPath}/previous.png" align="top"/>
+
+
+
+ No Previous Results
+ border="0" src="{$mediaPath}/previous_inactive.png" align="top"/>
+
+
+
+
+
+
+
+ Next Results
+ border="0" src="{$mediaPath}/next.png" align="top"/>
+
+
+
+ No Next Results
+ border="0" src="{$mediaPath}/next_inactive.png" align="top"/>
+
+
+
+
+
-
-

-

- Your search has found records: viewing records to
-

-
-

-
-

+
+
+
+ Search:
+
+ Title =
+
+
+
+ ,
+
+
+
+ Author =
+
+
+ [Catalogue:
+
+
+
+ ]
+
+
+
+
+ Edit
+ border="0" src="{$mediaPath}/edit.png" align="top"/>
+
+
+
- Show result
- -
-
-
+ Show result
+
+
+
+
+
+
/trunk/webapps/Portlet/xsl/item.xsl
1,5 → 1,8
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:portlet="http://www.uportal.org/extensions/portlet" xmlns:mods="http://www.loc.gov/mods/">
 
<xsl:include href="wrap.xsl"/>
 
<xsl:output method="html"/>
 
<xsl:param name="mediaPath">images</xsl:param>
8,91 → 11,115
<xsl:param name="locale">en_US</xsl:param>
 
<xsl:template match="/record">
<p>
<a href="renderURL">
<portlet:param name="action" value="search"/>
<img alt="New Search" src="{$mediaPath}/find.gif" align="TOP"/>
</a>
<div class="portlet-section-header">
<img title="Record Details" alt="Record Details" src="{$mediaPath}/record_big.png"/>
Record Details
</div>
 
<xsl:if test="@id &gt; 1">
<a href="renderURL">
<portlet:param name="action" value="item"/>
<portlet:param name="id" value="{@id - 1}" />
<img alt="Previous Record" src="{$mediaPath}/left.gif" align="TOP"/>
</a>
</xsl:if>
 
<a href="renderURL">
<portlet:param name="action" value="list"/>
<portlet:param name="id" value="{@id}" />
<img alt="List Records" src="{$mediaPath}/return.gif" align="TOP"/>
</a>
 
<xsl:if test="@id &lt; @total">
<a href="renderURL">
<portlet:param name="action" value="item"/>
<portlet:param name="id" value="{@id + 1}" />
<img alt="Next Record" src="{$mediaPath}/right.gif" align="TOP"/>
</a>
</xsl:if>
 
<p>
<p>
Your search has found <xsl:value-of select="@total"/> records: viewing record <xsl:value-of select="@id"/>
</p>
<dl>
<xsl:apply-templates select="*" />
</dl>
</p>
</p>
<div class="portlet-msg-info">
Your search has found <xsl:value-of select="@total"/> records
<br/>
Displaying record <xsl:value-of select="@id"/>
<br/>
<a href="renderURL">
<portlet:param name="action" value="list"/>
<portlet:param name="id" value="{@id}" />
<img title="Return to Results" alt="Return to Results"
border="0" src="{$mediaPath}/results.png" align="top"/>
</a>
<xsl:choose>
<xsl:when test="@id &gt; 1">
<a href="renderURL">
<portlet:param name="action" value="item"/>
<portlet:param name="id" value="{@id - 1}" />
<img title="Previous Record" alt="Previous Record"
border="0" src="{$mediaPath}/previous.png" align="top"/>
</a>
</xsl:when>
<xsl:otherwise>
<img title="No Previous Record" alt="No Previous Record"
border="0" src="{$mediaPath}/previous_inactive.png" align="top"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="@id &lt; @total">
<a href="renderURL">
<portlet:param name="action" value="item"/>
<portlet:param name="id" value="{@id + 1}" />
<img title="Next Record" alt="Next Record"
border="0" src="{$mediaPath}/next.png" align="top"/>
</a>
</xsl:when>
<xsl:otherwise>
<img title="No Next Record" alt="No Next Record"
border="0" src="{$mediaPath}/next_inactive.png" align="top"/>
</xsl:otherwise>
</xsl:choose>
</div>
 
<div class="portlet-section-body">
<xsl:apply-templates select="//mods:title" />
<xsl:apply-templates select="//mods:name" />
<xsl:apply-templates select="//mods:publisher" />
<xsl:apply-templates select="//mods:extent" />
<xsl:apply-templates select="//mods:topic" />
<xsl:apply-templates select="//mods:identifier" />
</div>
</xsl:template>
 
<xsl:template match="mods:name">
<dt><b>Author</b></dt><dd><xsl:value-of select="."/></dd>
<b>Author: </b><xsl:value-of select="."/><br/>
</xsl:template>
<xsl:template match="mods:title">
<dt><b>Title</b></dt><dd><xsl:value-of select="."/></dd>
<b>Title: </b><xsl:value-of select="."/><br/>
</xsl:template>
<xsl:template match="mods:publisher">
<dt><b>Publisher</b></dt><dd><xsl:value-of select="."/></dd>
<b>Publisher: </b><xsl:value-of select="."/><br/>
</xsl:template>
<xsl:template match="mods:extent">
<dt><b>Description</b></dt><dd><xsl:value-of select="."/></dd>
<b>Description: </b><xsl:value-of select="."/><br/>
</xsl:template>
<xsl:template match="mods:identifier">
<xsl:choose>
<xsl:when test="@type = 'isbn'">
<dt><b>ISBN</b></dt>
<dd>
<xsl:value-of select="."/><br />
<b>ISBN: </b><xsl:value-of select="."/>
<span style="font-size:80%;">
<a href="http://openurl.ac.uk/?isbn={.}">Find the item via OpenURL</a><br/>
</span>
<!--
<xsl:choose>
<xsl:when test="/record/@database = 'INNOPAC'">
<a href="http://library.hull.ac.uk/search/i{.}" target="_blank">Direct link to catalogue</a>
<a href="http://library.hull.ac.uk/search/i{.}" target="_blank">Direct link to catalogue</a><br/>
</xsl:when>
<xsl:when test="/record/@database = 'MAIN*BIBMAST'">
<a href="http://library.ox.ac.uk/find?isbn={.}" target="_blank">Direct link to catalogue</a>
<a href="http://library.ox.ac.uk/find?isbn={.}" target="_blank">Direct link to catalogue</a><br/>
</xsl:when>
</xsl:choose>
</dd>
</xsl:choose>
-->
</xsl:when>
<xsl:when test="@type = 'issn'">
<dt><b>ISSN</b></dt><dd><xsl:value-of select="."/></dd>
<b>ISSN: </b><xsl:value-of select="."/>
<span style="font-size:80%;">
<a href="http://openurl.ac.uk/?issn={.}">Find the item via OpenURL</a><br/>
</span>
<!--
<xsl:choose>
<xsl:when test="/record/@database = 'INNOPAC'">
<a href="http://library.hull.ac.uk/search/i{.}" target="_blank">Direct link to catalogue</a>
<a href="http://library.hull.ac.uk/search/i{.}" target="_blank">Direct link to catalogue</a><br/>
</xsl:when>
<xsl:when test="/record/@database = 'MAIN*BIBMAST'">
<a href="http://library.ox.ac.uk/find?issn={.}" target="_blank">Direct link to catalogue</a>
<a href="http://library.ox.ac.uk/find?issn={.}" target="_blank">Direct link to catalogue</a><br/>
</xsl:when>
</xsl:choose>
</xsl:choose>
-->
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="mods:topic">
<dt><b>Subject</b></dt><dd><xsl:value-of select="."/></dd>
<b>Subject: </b><xsl:value-of select="."/><br/>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="." />
<xsl:value-of select="." /><br/>
</xsl:template>
<xsl:template match="*">
<xsl:apply-templates select="*" />
/trunk/webapps/Portlet/xsl/history.xsl
New file
0,0 → 1,111
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:portlet="http://www.uportal.org/extensions/portlet" xmlns:mods="http://www.loc.gov/mods/">
 
<xsl:include href="wrap.xsl"/>
 
<xsl:output method="html" omit-xml-declaration="yes" doctype-public="" doctype-system=""/>
 
<xsl:param name="mediaPath">images</xsl:param>
<xsl:param name="author"></xsl:param>
<xsl:param name="title"></xsl:param>
<xsl:param name="locale">en_US</xsl:param>
 
<xsl:template match="/searches">
<div class="portlet-section-header">
<img title="Session History" alt="Session History" src="{$mediaPath}/history_big.png"/>
Previous Searches
</div>
 
<xsl:choose>
<xsl:when test="@total = 0">
<div class="portlet-msg-info">
You have no previous searches in this session.
</div>
</xsl:when>
<xsl:when test="@total = 1">
<div class="portlet-msg-info">
You have <xsl:value-of select="@total"/> previous search in this session.
</div>
</xsl:when>
<xsl:when test="@total > 1">
<div class="portlet-msg-info">
You have <xsl:value-of select="@total"/> previous searches in this session.
<br/>
Displaying <xsl:value-of select="@start"/> - <xsl:value-of select="@end"/>
</div>
</xsl:when>
</xsl:choose>
 
<xsl:choose>
<xsl:when test="@start &gt; 10">
<a href="renderURL">
<portlet:param name="action" value="history"/>
<portlet:param name="id" value="{@start - 10}" />
<img title="Previous Searches" alt="Previous Searches"
border="0" src="{$mediaPath}/previous.png" align="top"/>
</a>
</xsl:when>
<xsl:otherwise>
<img title="No Previous Searches" alt="No Previous Searches"
border="0" src="{$mediaPath}/previous_inactive.png" align="top"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="@end &lt; @total">
<a href="renderURL">
<portlet:param name="action" value="history"/>
<portlet:param name="id" value="{@end + 1}" />
<img title="Next Searches" alt="Next Searches"
border="0" src="{$mediaPath}/next.png" align="top"/>
</a>
</xsl:when>
<xsl:otherwise>
<img title="No Next Searches" alt="No Next Searches"
border="0" src="{$mediaPath}/next_inactive.png" align="top"/>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="search" />
 
</xsl:template>
 
<xsl:template match="search">
<div class="portlet-section-body">
<span style="font-style:italic"><xsl:value-of select="@id" />: </span>
<xsl:if test="rpn/item[@name='title']">
<span style="font-size:100%">Title = <xsl:value-of select="rpn/item[@name='title']"/></span>
</xsl:if>
<xsl:if test="rpn/item[@name='title']">
<xsl:if test="rpn/item[@name='author']">
<span style="font-size:100%">, </span>
</xsl:if>
</xsl:if>
<xsl:if test="rpn/item[@name='author']">
<span style="font-size:100%">Author = <xsl:value-of select="rpn/item[@name='author']"/></span>
</xsl:if>
<span style="font-size:80%">
[Catalogue:
<xsl:for-each select="database">
<xsl:value-of select="."/>
</xsl:for-each>
]
</span>
<span style="font-size:70%; font-style:italic;">
<br/>
<xsl:value-of select="@date"/>
<a href="actionURL">
<portlet:param name="action" value="search" />
<portlet:param name="history" value="{@id}" />
<img title="Re-run" alt="Re-run"
border="0" src="{$mediaPath}/re-run.png" align="top"/>
</a>
<a href="renderURL">
<portlet:param name="action" value="start" />
<portlet:param name="history" value="{@id}" />
<img title="Edit" alt="Edit"
border="0" src="{$mediaPath}/edit.png" align="top"/>
</a>
</span>
</div>
</xsl:template>
</xsl:stylesheet>
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/webapps/Portlet/xsl/search.xsl
===================================================================
--- trunk/webapps/Portlet/xsl/search.xsl (revision 565)
+++ trunk/webapps/Portlet/xsl/search.xsl (revision 566)
@@ -1,5 +1,8 @@
+
+
+
images
@@ -7,57 +10,81 @@
en_US
-
+
+
+ Search
+ Search
+
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ alt="Start Search" title="Start Search"
+ src="{$mediaPath}/search_go.png"
+ name="search" value="{$portlet.search.form.button.search}" tabindex="3" />
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
Search Library
Catalogue:
/trunk/webapps/Portlet/xsl/help.xsl
New file
0,0 → 1,63
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:portlet="http://www.uportal.org/extensions/portlet" xmlns:mods="http://www.loc.gov/mods/">
 
<xsl:output method="html"/>
 
<xsl:param name="mediaPath">images</xsl:param>
<xsl:param name="author"></xsl:param>
<xsl:param name="title"></xsl:param>
<xsl:param name="locale">en_US</xsl:param>
 
<xsl:template match="/help">
<div class="portlet-section-header">
<img title="Help" alt="Help" src="{$mediaPath}/help.png"/>
Help
</div>
<div style="float:left;">
<a href="actionURL">
<portlet:param name="action" value="help" />
<portlet:param name="page" value="search" />
search
</a><br/>
<a href="actionURL">
<portlet:param name="action" value="help" />
<portlet:param name="page" value="list" />
results listing
</a><br/>
<a href="actionURL">
<portlet:param name="action" value="help" />
<portlet:param name="page" value="item" />
record item
</a><br/>
<a href="actionURL">
<portlet:param name="action" value="help" />
<portlet:param name="page" value="history" />
history
</a><br/>
</div>
<div class="portlet-section-body">
General help goes here...
<br/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="search">
Contextual Search help goes here...
</xsl:template>
 
<xsl:template match="list">
Contextual Results listing help goes here...
</xsl:template>
 
<xsl:template match="item">
Contextual Record item help goes here...
</xsl:template>
 
<xsl:template match="history">
Contextual History help goes here...
</xsl:template>
</xsl:stylesheet>
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/webapps/Portlet/xsl/wrap.xsl
===================================================================
--- trunk/webapps/Portlet/xsl/wrap.xsl (revision 0)
+++ trunk/webapps/Portlet/xsl/wrap.xsl (revision 566)
@@ -0,0 +1,47 @@
+
+
+
+
+
+ images
+
+
+ en_US
+
+
+
+
+ style="border-bottom: 1px dashed;
+ font-size:smaller">
+
+
+ New Search
+
+
+
+ Session History
+
+
+
+
+
+ Edit
+ border="0" src="{$mediaPath}/edit.png" align="top"/>
+
+
+
+
+
+
+ Return to Results
+ border="0" src="{$mediaPath}/results.png" align="top"/>
+
+
+
+
+
+
+
+
+
+
/trunk/webapps/Portlet/xsl/wrap.xsl
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/webapps/Portlet/WEB-INF/portlet.xml
===================================================================
--- trunk/webapps/Portlet/WEB-INF/portlet.xml (revision 565)
+++ trunk/webapps/Portlet/WEB-INF/portlet.xml (revision 566)
@@ -60,15 +60,24 @@
item
xsl/item.xsl
+
+ history
+ xsl/history.xsl
+
images
images/
+
+ help
+ xsl/help.xsl
+
-1
text/html
VIEW
+ HELP
en
@@ -79,5 +88,96 @@
JAFER, Search
+
+
+ JAFER Single Search Portlet
+ SingleSearchPortlet
+ JAFER Single Search Portlet
+ org.jafer.portlets.XsltSingleSearchPortlet
+
+
+ uddiInquiryUrl
+
+
+
+ uddiPublishUrl
+
+
+
+ uddiPartition
+
+
+
+
+
+ target.Tulane University
+ z3950s://voyager.tcs.tulane.edu:7090/VOYAGER
+
+
+ target.Library of Congress
+ z3950s://z3950.loc.gov:7090/VOYAGER
+
+
+ target.Hull University
+ z3950s://library.hull.ac.uk:210/INNOPAC
+
+
+ target.Oxford University
+ z3950s://olis.ox.ac.uk:210/ADVANCE
+
+
+ target.DSpace
+ http://repository.ust.hk/SRW/search/DSpace
+
+
+ target.Leeds University
+ z3950s://lib.leeds.ac.uk:210/INNOPAC
+
+
+ recordSchema
+ http://www.loc.gov/mods/
+
+
+ search
+ xsl-ss/search.xsl
+
+
+ list
+ xsl-ss/list.xsl
+
+
+ item
+ xsl-ss/item.xsl
+
+
+ history
+ xsl-ss/history.xsl
+
+
+ help
+ xsl-ss/help.xsl
+
+
+ images
+ images/
+
+
+ -1
+
+ text/html
+ VIEW
+ EDIT
+ HELP
+
+
+ en
+
+
+ JAFER Single Search Portlet
+ Single Search
+ JAFER, Search
+
+
+
/trunk/webapps/Portlet/WEB-INF/web.xml
1,26 → 1,10
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
 
<web-app>
<display-name>jafer</display-name>
<description>Automated generated Application Wrapper</description>
<servlet>
<servlet-name>SearchPortlet</servlet-name>
<display-name>SearchPortlet Wrapper</display-name>
<description>Automated generated Portlet Wrapper</description>
<servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
<init-param>
<param-name>portlet-class</param-name>
<param-value>org.jafer.portlets.XsltSearchPortlet</param-value>
</init-param>
<init-param>
<param-name>portlet-guid</param-name>
<param-value>JaferPortlets.SearchPortlet</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>SearchPortlet</servlet-name>
<url-pattern>/SearchPortlet/*</url-pattern>
</servlet-mapping>
<description>Jafer Portlets</description>
</web-app>
 
/trunk/webapps/Portlet/xsl-ss/list.xsl
New file
0,0 → 1,120
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:portlet="http://www.uportal.org/extensions/portlet" xmlns:mods="http://www.loc.gov/mods/">
 
<xsl:output method="html" omit-xml-declaration="yes" doctype-public="" doctype-system=""/>
 
<xsl:param name="mediaPath">images</xsl:param>
<xsl:param name="author"></xsl:param>
<xsl:param name="title"></xsl:param>
<xsl:param name="locale">en_US</xsl:param>
 
<xsl:template match="/error">
<div class="portlet-msg-error">
<xsl:value-of select="."/>
Please edit it and try again.
</div>
</xsl:template>
 
<xsl:template match="/results">
<div class="portlet-section-header">
<xsl:apply-templates select="search"/>
</div>
<xsl:apply-templates select="records"/>
</xsl:template>
 
<xsl:template match="records">
 
<xsl:choose>
<xsl:when test="@total = 0">
<div class="portlet-msg-info">
Your search has not found any matching records.
<br/>
Please use 'edit' to setup your search.
</div>
</xsl:when>
<xsl:when test="@total = 1">
<div class="portlet-msg-info">
Your search has found <xsl:value-of select="@total"/> record.
</div>
<xsl:apply-templates select="record" />
</xsl:when>
<xsl:when test="@total > 1">
<div class="portlet-msg-info">
Your search has found <xsl:value-of select="@total"/> records
<br/>
Displaying <xsl:value-of select="@start"/> - <xsl:value-of select="@end"/>
<br/>
<xsl:choose>
<xsl:when test="@start &gt; 10">
<a href="renderURL">
<portlet:param name="action" value="list"/>
<portlet:param name="id" value="{@start - 10}" />
<img title="Previous Results" alt="Previous Results"
border="0" src="{$mediaPath}/previous.png" align="top"/>
</a>
</xsl:when>
<xsl:otherwise>
<img title="No Previous Results" alt="No Previous Results"
border="0" src="{$mediaPath}/previous_inactive.png" align="top"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="@end &lt; @total">
<a href="renderURL">
<portlet:param name="action" value="list"/>
<portlet:param name="id" value="{@end + 1}" />
<img title="Next Results" alt="Next Results"
border="0" src="{$mediaPath}/next.png" align="top"/>
</a>
</xsl:when>
<xsl:otherwise>
<img title="No Next Results" alt="No Next Results"
border="0" src="{$mediaPath}/next_inactive.png" align="top"/>
</xsl:otherwise>
</xsl:choose>
</div>
 
<xsl:apply-templates select="record" />
</xsl:when>
</xsl:choose>
</xsl:template>
 
<xsl:template match="search">
<a href="actionURL">
<portlet:param name="action" value="search" />
<portlet:param name="history" value="{@id}" />
<img title="Refresh" alt="Refresh"
border="0" src="{$mediaPath}/re-run.png" align="top"/>
</a>
<xsl:if test="rpn/item[@name='title']">
<span style="font-size:100%">Title = <xsl:value-of select="rpn/item[@name='title']"/></span>
</xsl:if>
<xsl:if test="rpn/item[@name='title']">
<xsl:if test="rpn/item[@name='author']">
<span style="font-size:100%">, </span>
</xsl:if>
</xsl:if>
<xsl:if test="rpn/item[@name='author']">
<span style="font-size:100%">Author = <xsl:value-of select="rpn/item[@name='author']"/></span>
</xsl:if>
<span style="font-size:80%">
[Catalogue:
<xsl:for-each select="database">
<xsl:value-of select="."/>
</xsl:for-each>
]
</span>
</xsl:template>
 
<xsl:template match="record">
<a href="renderURL">
<portlet:param name="action" value="item" />
<portlet:param name="id" value="{@id}" />
<img border="0" title="Show result" alt="Show result" src="{$mediaPath}/record.png" align="TOP"/>
<xsl:value-of select="mods:mods/mods:title"/>
</a>
<xsl:value-of select="mods:mods/mods:name"/>
<br />
</xsl:template>
</xsl:stylesheet>
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/webapps/Portlet/xsl-ss/item.xsl
===================================================================
--- trunk/webapps/Portlet/xsl-ss/item.xsl (revision 0)
+++ trunk/webapps/Portlet/xsl-ss/item.xsl (revision 566)
@@ -0,0 +1,125 @@
+
+
+
+
+
+ images
+
+
+ en_US
+
+
+
+ Record Details
+ Record Details
+
+
+
+ Your search has found records
+
+ Displaying record
+
+
+
+
+ Return to Results
+ border="0" src="{$mediaPath}/results.png" align="top"/>
+
+
+
+
+
+
+ Previous Record
+ border="0" src="{$mediaPath}/previous.png" align="top"/>
+
+
+
+ No Previous Record
+ border="0" src="{$mediaPath}/previous_inactive.png" align="top"/>
+
+
+
+
+
+
+
+ Next Record
+ border="0" src="{$mediaPath}/next.png" align="top"/>
+
+
+
+ No Next Record
+ border="0" src="{$mediaPath}/next_inactive.png" align="top"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Author:
+
+
+ Title:
+
+
+ Publisher:
+
+
+ Description:
+
+
+
+
+ ISBN:
+
+ Find the item via OpenURL
+
+
+
+
+ ISSN:
+
+ Find the item via OpenURL
+
+
+
+
+
+
+ Subject:
+
+
+
+
+
+
+
+
/trunk/webapps/Portlet/xsl-ss/item.xsl
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/webapps/Portlet/xsl-ss/search.xsl
===================================================================
--- trunk/webapps/Portlet/xsl-ss/search.xsl (revision 0)
+++ trunk/webapps/Portlet/xsl-ss/search.xsl (revision 566)
@@ -0,0 +1,95 @@
+
+
+
+
+
+ images
+
+
+ en_US
+
+
+
+ Search
+ Edit Search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ alt="Start Search" title="Start Search"
+ src="{$mediaPath}/search_go.png"
+ name="search" value="{$portlet.search.form.button.search}" tabindex="3" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Search Library
+ Catalogue:
+ Author:
+ Title:
+ Submit
+ Clear
+
+
+
/trunk/webapps/Portlet/xsl-ss/search.xsl
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/webapps/Portlet/xsl-ss/help.xsl
===================================================================
--- trunk/webapps/Portlet/xsl-ss/help.xsl (revision 0)
+++ trunk/webapps/Portlet/xsl-ss/help.xsl (revision 566)
@@ -0,0 +1,54 @@
+
+
+
+
+
+ images
+
+
+ en_US
+
+
+
+ Help
+ Help
+
+
+
+
+
+ search
+
+
+
+
+ results listing
+
+
+
+
+ record item
+
+
+
+ General help goes here...
+
+
+
+
+
+
+
+
+ Contextual Search help goes here...
+
+
+
+ Contextual Results listing help goes here...
+
+
+
+ Contextual Record item help goes here...
+
+
+
/trunk/webapps/Portlet/xsl-ss/help.xsl
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/.project
===================================================================
--- trunk/.project (revision 0)
+++ trunk/.project (revision 566)
@@ -0,0 +1,11 @@
+
+
+ jafer
+
+
+
+
+
+
+
+
/trunk/.project
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/buildscripts/build_jaferportlet.xml
===================================================================
--- trunk/buildscripts/build_jaferportlet.xml (revision 565)
+++ trunk/buildscripts/build_jaferportlet.xml (revision 566)
@@ -1,7 +1,7 @@
/trunk/buildscripts/build_compilerscript.xml
97,7 → 97,7
author="true"
version="true"
use="true"
source="1.4"
source="1.5"
windowtitle="Jafer API">
 
<tag name="uml.dependency" enabled="false" description="omondo tag to remove till aquire doclet" />
/trunk/src/org/jafer/interfaces/RecordedSearch.java
New file
0,0 → 1,31
package org.jafer.interfaces;
 
import java.util.Date;
 
import org.w3c.dom.Document;
import org.w3c.dom.Node;
 
/**
* Represents a search run at a particular time.
*
* @author <a href="mailto:jasper.tredgold@bristol.ac.uk">Jasper Tredgold</a>
* @version $Id$
*
*/
public interface RecordedSearch {
 
public String[] getDatabases();
 
public RPNItem[] getRPN();
 
public Node getQuery();
public Date getDate();
public Node getNode(Document xml);
 
public Node getNode(Document xml, Integer index);
 
public Node getNode(Document xml, int index);
 
}
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/src/org/jafer/interfaces/RPNItem.java
===================================================================
--- trunk/src/org/jafer/interfaces/RPNItem.java (revision 0)
+++ trunk/src/org/jafer/interfaces/RPNItem.java (revision 566)
@@ -0,0 +1,15 @@
+package org.jafer.interfaces;
+
+/**
+ * An item in a RPN expression.
+ *
+ * @author Jasper Tredgold
+ * @version $Id$
+ *
+ */
+public interface RPNItem {
+
+ public String getName();
+
+ public String getValue();
+}
/trunk/src/org/jafer/interfaces/RPNItem.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/src/org/jafer/query/RPNOperand.java
===================================================================
--- trunk/src/org/jafer/query/RPNOperand.java (revision 0)
+++ trunk/src/org/jafer/query/RPNOperand.java (revision 566)
@@ -0,0 +1,34 @@
+package org.jafer.query;
+
+import org.jafer.interfaces.RPNItem;
+
+/**
+ * @author Jasper Tredgold
+ * @version $Id$
+ *
+ */
+public class RPNOperand implements RPNItem {
+
+ private String name;
+ private String value;
+
+ public RPNOperand(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jafer.interfaces.RPNItem#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jafer.interfaces.RPNItem#getValue()
+ */
+ public String getValue() {
+ return value;
+ }
+
+}
/trunk/src/org/jafer/query/RPNOperand.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/src/org/jafer/query/RPNOperator.java
===================================================================
--- trunk/src/org/jafer/query/RPNOperator.java (revision 0)
+++ trunk/src/org/jafer/query/RPNOperator.java (revision 566)
@@ -0,0 +1,34 @@
+package org.jafer.query;
+
+import org.jafer.interfaces.RPNItem;
+
+/**
+ * @author Jasper Tredgold
+ * @version $Id$
+ *
+ */
+public class RPNOperator implements RPNItem {
+
+ public enum Op { AND, OR }
+
+ private Op value;
+
+ public RPNOperator(Op value) {
+ this.value = value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jafer.interfaces.RPNItem#getName()
+ */
+ public String getName() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jafer.interfaces.RPNItem#getValue()
+ */
+ public String getValue() {
+ return value.toString();
+ }
+
+}
/trunk/src/org/jafer/query/RPNOperator.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/src/org/jafer/query/QueryBuilder.java
===================================================================
--- trunk/src/org/jafer/query/QueryBuilder.java (revision 565)
+++ trunk/src/org/jafer/query/QueryBuilder.java (revision 566)
@@ -380,7 +380,6 @@
* are not set to 0 are used in the query being built. a check is made
* to ensure that a Use attribute has been set.
*/
-
if (attributes[1] < 1)
throw new QueryException("Use attribute has been incorrectly set.");
/trunk/src/org/jafer/query/RecordedSearch.java
New file
0,0 → 1,103
package org.jafer.query;
 
import java.util.Date;
 
import org.jafer.interfaces.RPNItem;
import org.jafer.util.xml.DOMFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
 
/**
* A RecordedSearch captures a search executed at a particular time. It is immutable.
*
* @author <a href="mailto:jasper.tredgold@bristol.ac.uk">Jasper Tredgold</a>
* @version $Id$
*
*/
public class RecordedSearch implements org.jafer.interfaces.RecordedSearch {
 
private Node query;
private String[] databases;
private Date date;
private Document document;
private RPNItem[] rpn;
public RecordedSearch(Node query, RPNItem[] rpn, String[] databases, Date date) {
this.document = DOMFactory.newDocument();
this.query = document.importNode(query, true);
this.date = new Date(date.getTime());
this.databases = new String[databases.length];
System.arraycopy(databases, 0, this.databases, 0, databases.length);
this.rpn = new RPNItem[rpn.length];
System.arraycopy(rpn, 0, this.rpn, 0, rpn.length);
}
/* (non-Javadoc)
* @see org.jafer.interfaces.RecordedSearch#getDatabases()
*/
public String[] getDatabases() {
String[] ret = new String[databases.length];
System.arraycopy(databases, 0, ret, 0, databases.length);
return ret;
}
 
public RPNItem[] getRPN() {
RPNItem[] ret = new RPNItem[rpn.length];
System.arraycopy(rpn, 0, ret, 0, rpn.length);
return ret;
}
 
/* (non-Javadoc)
* @see org.jafer.interfaces.RecordedSearch#getDate()
*/
public Date getDate() {
return new Date(date.getTime());
}
 
/* (non-Javadoc)
* @see org.jafer.interfaces.RecordedSearch#getQuery()
*/
public Node getQuery() {
return query.cloneNode(true);
}
public Node getNode(Document xml) {
return getNode(xml, null);
}
 
public Node getNode(Document xml, int index) {
return getNode(xml, new Integer(index));
}
 
public Node getNode(Document xml, Integer index) {
Element srrNode = xml.createElement("search");
if(index != null) {
srrNode.setAttribute("id", Integer.toString(index));
}
srrNode.setAttribute("date", getDate().toString());
for(String database: getDatabases()) {
Element dbNode = xml.createElement("database");
dbNode.appendChild(xml.createTextNode(database));
srrNode.appendChild(dbNode);
}
Node query = xml.importNode(getQuery(), true);
srrNode.appendChild(query);
Element rpnNode = xml.createElement("rpn");
RPNItem[] rpn = getRPN();
for(RPNItem item: rpn) {
if(item == null)
continue;
Element itemNode = xml.createElement("item");
if(item instanceof RPNOperand) {
itemNode.setAttribute("name", item.getName());
}
itemNode.appendChild(xml.createTextNode(item.getValue()));
rpnNode.appendChild(itemNode);
}
srrNode.appendChild(rpnNode);
return srrNode;
}
 
}
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/src/org/jafer/portlets/AbstractXSLTPortlet.java
===================================================================
--- trunk/src/org/jafer/portlets/AbstractXSLTPortlet.java (revision 565)
+++ trunk/src/org/jafer/portlets/AbstractXSLTPortlet.java (revision 566)
@@ -4,6 +4,8 @@
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
+import javax.portlet.PortletResponse;
+
import java.io.IOException;
import java.lang.reflect.Method;
import javax.portlet.RenderRequest;
@@ -84,6 +86,14 @@
abstract protected String[][] getVTableEdit();
private String dispatchVTable(PortletRequest request,
+ String[][] vTable, String action,
+ Document[] xml) throws
+ PortletException {
+ return dispatchVTable(request, null, vTable, action, xml);
+
+ }
+
+ private String dispatchVTable(PortletRequest request, PortletResponse response,
String[][] vTable, String action,
Document[] xml) throws
PortletException {
@@ -104,14 +114,49 @@
throw new PortletException(
"Unknown PortletRequest type");
}
- Method func = this.getClass().getMethod(method,
- new Class[] {cl});
- if (xml == null || xml.length == 0) {
- func.invoke(this, new Object[] {request});
- } else {
- xml[0] = ((Document) func.invoke(this,
- new Object[] {request}));
+ // if we've a response we'll first
+ // look for methods that require it
+ Class cl_resp = null;
+ if(response != null) {
+ if (response instanceof ActionResponse) {
+ cl_resp = ActionResponse.class;
+ }
+ if (response instanceof RenderResponse) {
+ cl_resp = RenderResponse.class;
+ }
+ if (cl_resp == null) {
+ throw new PortletException(
+ "Unknown PortletResponse type");
+ }
}
+ Method func = null;
+ if(cl_resp != null) {
+ try {
+ func = this.getClass().getMethod(method,
+ new Class[] {cl, cl_resp});
+ if (xml == null || xml.length == 0) {
+ func.invoke(this, new Object[] {request, response});
+ } else {
+ xml[0] = ((Document) func.invoke(this,
+ new Object[] {request, response}));
+ }
+ } catch(NoSuchMethodException e) {
+ ;
+ }
+ }
+ // if we've no methods that support a response
+ // (if we were passed one) we'll fall back
+ // to looking for request-only signatures
+ if(func == null) {
+ func = this.getClass().getMethod(method,
+ new Class[] {cl});
+ if (xml == null || xml.length == 0) {
+ func.invoke(this, new Object[] {request});
+ } else {
+ xml[0] = ((Document) func.invoke(this,
+ new Object[] {request}));
+ }
+ }
}
}
} catch (Exception ex) {
@@ -168,7 +213,7 @@
if (action == null) {
action = vTableAction[0][0];
}
- String page = dispatchVTable(request, vTableAction, action, null);
+ String page = dispatchVTable(request, response, vTableAction, action, null);
response.setRenderParameter("action", page);
}
/trunk/src/org/jafer/portlets/XsltSearchPortlet.java
1,27 → 1,59
package org.jafer.portlets;
 
import java.io.*;
import javax.portlet.*;
import java.util.Calendar;
import java.util.Date;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.TreeMap;
import java.util.Vector;
import java.util.concurrent.CopyOnWriteArrayList;
 
import org.jafer.exception.*;
import org.jafer.interfaces.*;
import java.util.Enumeration;
import org.jafer.databeans.*;
import java.util.*;
import org.w3c.dom.*;
import javax.xml.parsers.DocumentBuilder;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
import javax.portlet.PortletMode;
import javax.portlet.PortletRequest;
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.xml.parsers.DocumentBuilderFactory;
import org.jafer.registry.model.ServiceInfo;
import org.jafer.registry.model.Protocol;
import org.jafer.registry.model.Service;
 
import org.jafer.databeans.ZurlFactory;
import org.jafer.exception.JaferException;
import org.jafer.interfaces.Cache;
import org.jafer.interfaces.Connection;
import org.jafer.interfaces.Databean;
import org.jafer.interfaces.Present;
import org.jafer.interfaces.QueryBuilder;
import org.jafer.interfaces.RPNItem;
import org.jafer.interfaces.RecordedSearch;
import org.jafer.interfaces.Search;
import org.jafer.query.RPNOperand;
import org.jafer.query.RPNOperator;
import org.jafer.registry.RegistryException;
import org.jafer.registry.RegistryFactory;
import org.jafer.registry.RegistryException;
import org.jafer.registry.RegistryManager;
import org.jafer.registry.model.ServiceProviderInfo;
import org.jafer.registry.ServiceLocator;
import org.jafer.registry.model.CategoryType;
import org.jafer.registry.model.Protocol;
import org.jafer.registry.model.Service;
import org.jafer.registry.model.ServiceInfo;
import org.jafer.registry.model.ServiceProviderInfo;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
 
public class XsltSearchPortlet extends AbstractXSLTPortlet {
 
/**
* Constants for context-sensitive help
*/
public static final int SEARCH_PAGE = 1;
public static final int LIST_PAGE = 2;
public static final int ITEM_PAGE = 3;
public static final int HISTORY_PAGE = 4;
private TreeMap targets = new TreeMap();
static {
try {
211,6 → 243,8
}
session.removeAttribute("databean", PortletSession.PORTLET_SCOPE);
}
// clear any existing error messages
clearError(request);
}
 
/**
232,32 → 266,94
}
session.removeAttribute("databean", PortletSession.PORTLET_SCOPE);
}
// clear any existing error messages
clearError(request);
}
 
protected String[][] getVTableAction() {
// includes help action to allow navigation within the HELP
// mode pages
return new String[][] {
new String[] {"search", "search", "list"}
new String[] {"search", "search", "list"},
new String[] {"help", "navigateHelp", "help"},
};
}
 
/**
* Triggered by action=help Action URLs. Takes
* page parameter. Allowed values: search, history,
* list and item.
* @param req
*/
public void navigateHelp (ActionRequest req) {
String page = req.getParameter("page");
if (page != null) {
if(page.equalsIgnoreCase("search"))
setHelpContext(req, SEARCH_PAGE);
if(page.equalsIgnoreCase("history"))
setHelpContext(req, HISTORY_PAGE);
if(page.equalsIgnoreCase("list"))
setHelpContext(req, LIST_PAGE);
if(page.equalsIgnoreCase("item"))
setHelpContext(req, ITEM_PAGE);
}
}
protected String[][] getVTableView() {
// includes 'history' to support search history
return new String[][] {
new String[] {"start", "initSession", "search"},
new String[] {"list", "setItemCloud", "list"},
new String[] {"item", "setItem", "item"},
new String[] {"history", "setHistory", "history"},
};
}
 
protected String[][] getVTableHelp() {
return null;
return new String[][] {
new String[] {"help", "setHelp", "help"},
};
}
 
protected String[][] getVTableEdit() {
// not supported
return null;
}
 
/**
* Sets up the xml for rendering the HELP mode.
* Uses the HelpContext, if set.
*
* @param request
* @return
*/
public Document setHelp(RenderRequest request) {
Document xml = domBuilder.newDocument();
Element hNode = xml.createElement("help");
 
public void search(ActionRequest request) {
int loc = getHelpContext(request);
 
switch (loc) {
case HISTORY_PAGE:
hNode.appendChild(xml.createElement("history"));
break;
case SEARCH_PAGE:
hNode.appendChild(xml.createElement("search"));
break;
case LIST_PAGE:
hNode.appendChild(xml.createElement("list"));
break;
case ITEM_PAGE:
hNode.appendChild(xml.createElement("item"));
break;
default: break;
}
xml.appendChild(hNode);
return xml;
}
 
public void search(ActionRequest request)
throws PortletException {
try {
String database = request.getParameter("database");
if (database == null)
268,34 → 364,128
String title = request.getParameter("title");
if (title == null)
title = "";
String historyId = request.getParameter("history");
 
clearSession(request);
Node query_node = null;
 
// Set up an RPN version of the original query.
// This is used for re-editing a search or when
// displaying the search used to the user
RPNItem rpn[] = new RPNItem[3];
 
if(historyId != null) {
// got a request to re-run a stored search
// retrieve the components
RecordedSearch recordedSearch = retrieveSearch(request, (Integer.valueOf(historyId)).intValue());
query_node = recordedSearch.getQuery();
database = recordedSearch.getDatabases()[0];
rpn = recordedSearch.getRPN();
} else {
// build the new query
// stashing it in RPN as we go
try {
QueryBuilder query = new org.jafer.query.QueryBuilder();
if (title.length() == 0) {
query_node = query.getNode("author", author);
rpn[0] = new RPNOperand("author",author);
} else if (author.length() == 0) {
query_node = query.getNode("title", title);
rpn[0] = new RPNOperand("title",title);
} else {
query_node = query.and(query.getNode("author", author),
query.getNode("title", title));
rpn[0] = new RPNOperand("author",author);
rpn[1] = new RPNOperand("title",title);
rpn[2] = new RPNOperator(RPNOperator.Op.AND);
}
} catch (JaferException ex) {
ex.printStackTrace();
clearSession(request);
setError(request, "There was an error with your search.");
}
}
Databean bean = getSession(request, database);
// record the search in the history
recordSearch(request, rpn, query_node, database);
// run it
try {
clearSession(request);
Databean bean = getSession(request, database);
QueryBuilder query = new org.jafer.query.QueryBuilder();
if (title.length() == 0) {
((Search) bean).submitQuery(
query.getNode("author", author));
} else if (author.length() == 0) {
((Search) bean).submitQuery(
query.getNode("title", title));
} else {
((Search) bean).submitQuery(
query.and(query.getNode("author", author),
query.getNode("title", title)));
}
((Search) bean).submitQuery(query_node);
if (((Search) bean).getNumberOfResults() > 0) {
((Present) bean).setRecordCursor(1);
}
} catch (JaferException ex) {
ex.printStackTrace();
clearSession(request);
setError(request, "There was an error with your search.");
}
} catch (Exception ex) {
ex.printStackTrace();
setError(request, "There was an error with your search.");
}
}
 
protected void setError(PortletRequest request, String msg) {
PortletSession session = request.getPortletSession(false);
if (session != null) {
session.setAttribute("error", msg);
}
}
protected String getError(PortletRequest request) {
PortletSession session = request.getPortletSession(false);
if (session != null) {
return((String)session.getAttribute("error"));
}
return null;
}
 
protected void clearError(PortletRequest request) {
PortletSession session = request.getPortletSession(false);
if (session != null) {
session.removeAttribute("error");
}
}
// record a search in the session
private void recordSearch(ActionRequest request, RPNItem[] rpn, Node query, String database) {
PortletSession session = request.getPortletSession(false);
if (session != null) {
List<RecordedSearch> history = (List)session.getAttribute("history");
if(history == null) {
history = new CopyOnWriteArrayList<RecordedSearch>();
}
Date date = Calendar.getInstance().getTime();
RecordedSearch rs = new org.jafer.query.RecordedSearch(query, rpn, new String[] { database }, date);
history.add(rs);
session.setAttribute("history", history, PortletSession.PORTLET_SCOPE);
}
}
 
// get a previously stored search by its index
protected RecordedSearch retrieveSearch(PortletRequest request, int id) {
PortletSession session = request.getPortletSession(false);
if (session != null) {
List<RecordedSearch> history = (List)session.getAttribute("history");
if(history != null) {
return(history.get(id-1));
}
}
return null;
}
// get the size of the session search history
protected int getHistorySize(PortletRequest request) {
PortletSession session = request.getPortletSession(false);
if (session != null) {
List<RecordedSearch> history = (List)session.getAttribute("history");
if(history != null) {
return(history.size());
}
}
return -1;
}
 
/**
* initSession
* view method for action=start
303,35 → 493,124
* @param request RenderRequest
*/
public Document initSession(RenderRequest request) throws PortletException {
clearSession(request);
//clearSession(request);
 
// record where we are for the contextual help
setHelpContext(request, SEARCH_PAGE);
 
Document xml = domBuilder.newDocument();
Element srNode = xml.createElement("databases");
Element srNode = xml.createElement("data");
 
targets.clear();
addStaticEntries();
addRegistryEntries();
 
Element dbsNode = xml.createElement("databases");
Iterator enumerate = targets.keySet().iterator();
 
while (enumerate.hasNext()) {
Element ssrNode = xml.createElement("database");
Text textNode = xml.createTextNode((String) enumerate.next());
ssrNode.appendChild(textNode);
srNode.appendChild(ssrNode);
dbsNode.appendChild(ssrNode);
}
srNode.appendChild(dbsNode);
 
// if we've a history param we're trying to edit
// a previous search
String historyId = request.getParameter("history");
if(historyId != null){
PortletSession session = request.getPortletSession(false);
List<RecordedSearch> history = null;
if (session != null) {
history = (List)session.getAttribute("history");
}
if(history != null) {
try {
int rec = 0;
try {
rec = Integer.parseInt(historyId);
} catch (Exception e) {
;
}
if(rec > 0) {
RecordedSearch rs = history.get(rec-1);
srNode.appendChild(rs.getNode(xml, rec));
}
} catch (Exception ex1) {
ex1.printStackTrace();
}
}
}
 
xml.appendChild(srNode);
return xml;
}
 
/**
* setHistory
* view method for action=history
*
* @param request RenderRequest
*/
public Document setHistory(RenderRequest request) throws PortletException {
// record where we are for the contextual help
setHelpContext(request, HISTORY_PAGE);
//Databean bean = getSession(request);
String id = request.getParameter("id");
PortletSession session = request.getPortletSession(false);
List<RecordedSearch> history = null;
if (session != null) {
history = (List)session.getAttribute("history");
}
 
Document xml = domBuilder.newDocument();
Element srNode = xml.createElement("searches");
if(history != null) {
try {
int rec = 1;
try {
rec = Integer.parseInt(id);
} catch (Exception e) {
;
}
int start = (rec / 10) * 10 + 1;
int end = start + 9;
if (end > history.size()) {
end = history.size();
}
srNode.setAttribute("start", Integer.toString(start));
srNode.setAttribute("end", Integer.toString(end));
srNode.setAttribute("total", Integer.toString(history.size()));
for (int n = start; n <= end; n++) {
RecordedSearch rs = history.get(n-1);
srNode.appendChild(rs.getNode(xml, n));
}
} catch (Exception ex1) {
ex1.printStackTrace();
srNode.setAttribute("start", "0");
srNode.setAttribute("end", "0");
srNode.setAttribute("total", "0");
}
} else {
srNode.setAttribute("total", "0");
}
xml.appendChild(srNode);
return xml;
}
 
/**
* setItem
* view method for action=item
*
* @param request RenderRequest
*/
public Document setItem(RenderRequest request) throws PortletException {
// record where we are for the contextual help
setHelpContext(request, ITEM_PAGE);
Databean bean = getSession(request);
Document xml = domBuilder.newDocument();
Element srNode = xml.createElement("record");
358,7 → 637,7
xml.appendChild(srNode);
return xml;
}
 
/**
* setItemCloud
* view method for action=list
366,10 → 645,26
* @param request RenderRequest
*/
public Document setItemCloud(RenderRequest request) throws PortletException {
// record where we are for the contextual help
setHelpContext(request, LIST_PAGE);
Document xml = domBuilder.newDocument();
// check for search errors
String error = getError(request);
if(error != null) {
Element eNode = xml.createElement("error");
eNode.appendChild(xml.createTextNode(error));
xml.appendChild(eNode);
return xml;
}
Databean bean = getSession(request);
String id = request.getParameter("id");
Document xml = domBuilder.newDocument();
Element rNode = xml.createElement("results");
Element srNode = xml.createElement("records");
int last = getHistorySize(request);
RecordedSearch rs = retrieveSearch(request, last);
if(rs != null)
rNode.appendChild(rs.getNode(xml, last));
 
try {
int rec = 1;
try {
404,7 → 699,29
srNode.setAttribute("end", "0");
srNode.setAttribute("total", "0");
}
xml.appendChild(srNode);
rNode.appendChild(srNode);
xml.appendChild(rNode);
return xml;
}
protected void setHelpContext(PortletRequest request, int loc) {
PortletSession session = request.getPortletSession();
if(session != null) {
session.setAttribute("help_context", new Integer(loc));
}
}
 
protected int getHelpContext(PortletRequest request) {
PortletSession session = request.getPortletSession();
if(session != null) {
Integer i = (Integer)session.getAttribute("help_context");
try {
return(i.intValue());
} catch (Exception e) {
;
}
}
return -1;
}
 
}
/trunk/src/org/jafer/portlets/XsltSingleSearchPortlet.java
New file
0,0 → 1,67
package org.jafer.portlets;
 
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
import javax.portlet.PortletMode;
import javax.portlet.RenderRequest;
 
import org.jafer.interfaces.RecordedSearch;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
 
/**
* Extends {@link XsltSearchPortlet} to provide a portlet
* that supports a single search (as set in EDIT mode) and
* displays the results of that search in VIEW mode.
*
* @author <a href="mailto:jasper.tredgold@bristol.ac.uk">Jasper Tredgold</a>
* @version $Id$
*
*/
 
public class XsltSingleSearchPortlet extends XsltSearchPortlet {
 
public XsltSingleSearchPortlet() {
super();
}
 
// The VIEW table is limited to results list and record item
@Override
protected String[][] getVTableView() {
return new String[][] {
new String[] {"list", "setItemCloud", "list"},
new String[] {"item", "setItem", "item"},
};
}
 
// The EDIT table contains the search construction page
@Override
protected String[][] getVTableEdit() {
return new String[][] {
new String[] {"start", "initSession", "search"},
};
}
 
// We override so that we use the history to pull out the
// last search run. This will be the one to edit.
@Override
public Document initSession(RenderRequest request)
throws PortletException {
Document xml = super.initSession(request);
Node srNode = xml.getDocumentElement();
int last = getHistorySize(request);
RecordedSearch rs = retrieveSearch(request, last);
if(rs != null)
srNode.appendChild(rs.getNode(xml, last));
return xml;
}
public void search(ActionRequest request, ActionResponse response) throws PortletException {
super.search(request);
// this portlet uses EDIT mode to edit the search. Once run
// we switch to VIEW mode.
response.setPortletMode(PortletMode.VIEW);
}
 
}
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/src/org/jafer/util/Config.java
===================================================================
--- trunk/src/org/jafer/util/Config.java (revision 565)
+++ trunk/src/org/jafer/util/Config.java (revision 566)
@@ -566,6 +566,7 @@
}
return value;
}
+
//////////////////////////////////////////////////////////
/**
* Following methods added temporarily for use in CQL query generation:
Index: trunk/src
===================================================================
--- trunk/src (revision 565)
+++ trunk/src (revision 566)
/trunk/src
Property changes:
Added: svn:ignore
## -0,0 +1 ##
+gov
Index: trunk/readme-spp.txt
===================================================================
--- trunk/readme-spp.txt (revision 0)
+++ trunk/readme-spp.txt (revision 566)
@@ -0,0 +1,16 @@
+SPP Jafer Portlet modifications
+2007-06
+For more info see http://www.spp.opensource.ac.uk/
+
+Changes
+=======
+- Search history. Searches can be edited or re-run.
+- Second portlet that displays the results of a single search, set up via EDIT mode.
+- UI edits, including use of Tango icons.
+- Use of openurl.ac.uk
+- Support for contextual help, via HELP mode.
+
+Building
+========
+> ant build-jafer-portlet
+
/trunk/readme-spp.txt
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk
===================================================================
--- trunk (revision 565)
+++ trunk (revision 566)
/trunk
Property changes:
Added: svn:ignore
## -0,0 +1 ##
+build