completed paginated, sorted display of search results

git-svn-id: http://yolanda.mister-muffin.de/svn@139 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
josch 2007-10-26 12:51:00 +00:00
parent b6d9b387b8
commit bacb8c775d
5 changed files with 336 additions and 118 deletions

View file

@ -57,6 +57,17 @@
<!-- results page--> <!-- results page-->
<str id="results_for_query">results for query</str> <str id="results_for_query">results for query</str>
<str id="ordered_by">ordered by</str>
<str id="ascending">ascending</str>
<str id="descending">descending</str>
<str id="results_on">results on</str>
<str id="pages">pages</str>
<str id="relevance">relevance</str>
<str id="duration">duration</str>
<str id="filesize">filesize</str>
<str id="viewcount">viewcount</str>
<str id="downloadcount">downloadcount</str>
<str id="timestamp">timestamp</str>
<!-- search bar--> <!-- search bar-->
<str id="search">search</str> <str id="search">search</str>
@ -101,6 +112,9 @@
<str id="DC.Language">language</str> <str id="DC.Language">language</str>
<str id="DC.Coverage">coverage</str> <str id="DC.Coverage">coverage</str>
<str id="DC.Rights">righs holder</str> <str id="DC.Rights">righs holder</str>
<str id="duration">duration</str>
<str id="viewcount">viewcount</str>
</strings> </strings>

View file

@ -21,6 +21,7 @@ if($query->param('query') or $query->param('orderby'))
{ {
$page->{results}->{query} = $query->param('query'); $page->{results}->{query} = $query->param('query');
$page->{results}->{orderby} = $query->param('orderby'); $page->{results}->{orderby} = $query->param('orderby');
$page->{results}->{sort} = $query->param('sort');
#connect to db #connect to db
my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass) or die $dbh->errstr; my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass) or die $dbh->errstr;
@ -28,7 +29,7 @@ if($query->param('query') or $query->param('orderby'))
my @args = (); my @args = ();
#build mysql query #build mysql query
$dbquery = "select v.id, v.title, v.description, u.username, from_unixtime( v.timestamp )"; $dbquery = "select v.id, v.title, v.creator, v.description, u.username, from_unixtime( v.timestamp ), v.duration, v.viewcount";
if($query->param('query')) if($query->param('query'))
{ {
@ -91,7 +92,9 @@ if($query->param('query') or $query->param('orderby'))
$rowsperpage = 2; $rowsperpage = 2;
$lastpage = int($resultcount/2); #rediculous but funny round up, will fail with 1000000000000000 results per page
#on 0.00000000000001% of all queries - this is a risk we can handle
$lastpage = int($resultcount/$rowsperpage+0.999999999999999);
$currentpage = $query->param('page') or $currentpage = 1; $currentpage = $query->param('page') or $currentpage = 1;
@ -105,22 +108,27 @@ if($query->param('query') or $query->param('orderby'))
$page->{'results'}->{'lastpage'} = $lastpage; $page->{'results'}->{'lastpage'} = $lastpage;
$page->{'results'}->{'currentpage'} = $currentpage; $page->{'results'}->{'currentpage'} = $currentpage;
$page->{'results'}->{'resultcount'} = $resultcount;
#get every returned value #get every returned value
while (my ($id, $title, $description, $username, $timestamp, $relevance) = $sth->fetchrow_array()) while (my ($id, $title, $creator, $description, $username, $timestamp, $duration, $viewcount, $relevance) = $sth->fetchrow_array())
{ {
#before code cleanup, this was a really obfuscated array/hash creation #before code cleanup, this was a really obfuscated array/hash creation
push @{ $page->{'results'}->{'result'} }, push @{ $page->{'results'}->{'result'} },
{ {
'thumbnail' => ["./video-stills/$id"], 'thumbnail' => "./video-stills/$id",
'duration' => $duration,
'viewcount' => $viewcount,
'rdf:RDF' => 'rdf:RDF' =>
{ {
'cc:Work' => 'cc:Work' =>
{ {
'rdf:about' => "./video.pl?title=$title&id=$id", 'rdf:about' => "$domain/download/$id",
'dc:title' => [$title], 'dc:title' => [$title],
'dc:date' => [$timestamp], 'dc:creator' => [$creator],
'dc:publisher' => [$username] 'dc:date' => [$timestamp],
'dc:identifier' => ["$domain/video/$title/$id"],
'dc:publisher' => [$username]
}, },
'cc:License' => 'cc:License' =>
{ {

View file

@ -23,7 +23,7 @@
<str id="page_results">search.pl?query=</str> <str id="page_results">search.pl?query=</str>
<str id="page_upload">upload.pl</str> <str id="page_upload">upload.pl</str>
<str id="page_uploader">uploader.pl</str> <str id="page_uploader">uploader.pl</str>
<str id="page_query_latestadditions">search.pl?sort=desc</str> <str id="page_query_latestadditions">search.pl?query=&amp;orderby=timestamp&amp;sort=desc</str>
</strings> </strings>

View file

@ -260,4 +260,9 @@ span.protip:after
span.protip:before span.protip:before
{ {
content: "( "; content: "( ";
} }
td
{
vertical-align: top;
}

View file

@ -17,8 +17,8 @@
omit-xml-declaration="no" omit-xml-declaration="no"
/> />
<xsl:variable name="site_strings" select="document('../site/gnutube.xml')//strings" /> <xsl:variable name="site_strings" select="document('../site/gnutube.xml')//strings/str" />
<xsl:variable name="locale_strings" select="document(concat('../locale/',/page/@locale,'.xml'))//strings" /> <xsl:variable name="locale_strings" select="document(concat('../locale/',/page/@locale,'.xml'))//strings/str" />
<xsl:template match="/"> <xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
@ -34,20 +34,20 @@
<title> <title>
<xsl:choose> <xsl:choose>
<xsl:when test="boolean(//frontpage)"> <xsl:when test="boolean(//frontpage)">
<xsl:value-of select="$site_strings/str[@id='site_name']" /> <xsl:value-of select="$site_strings[@id='site_name']" />
- -
<xsl:value-of select="$site_strings/str[@id='site_motto']" /> <xsl:value-of select="$site_strings[@id='site_motto']" />
</xsl:when> </xsl:when>
<xsl:when test="boolean(//resultspage)"> <xsl:when test="boolean(//resultspage)">
<xsl:value-of select="$site_strings/str[@id='site_name']" /> <xsl:value-of select="$site_strings[@id='site_name']" />
- -
<xsl:value-of select="$locale_strings/str[@id='results_for_query']" /> <xsl:value-of select="$locale_strings[@id='results_for_query']" />
"<xsl:value-of select="//resultspage/@query" />" "<xsl:value-of select="//resultspage/@query" />"
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="$site_strings/str[@id='site_name']" /> <xsl:value-of select="$site_strings[@id='site_name']" />
- -
<xsl:value-of select="$site_strings/str[@id='site_motto']" /> <xsl:value-of select="$site_strings[@id='site_motto']" />
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</title> </title>
@ -60,32 +60,32 @@
<div class="header1"> <div class="header1">
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="$site_strings/str[@id='page_login']" /> <xsl:value-of select="$site_strings[@id='page_login']" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="$locale_strings/str[@id='login_to_upload']" /> <xsl:value-of select="$locale_strings[@id='login_to_upload']" />
</a> </a>
</div> </div>
<div class="header2"> <div class="header2">
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="$site_strings/str[@id='page_register']" /> <xsl:value-of select="$site_strings[@id='page_register']" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="$locale_strings/str[@id='register']" /> <xsl:value-of select="$locale_strings[@id='register']" />
</a> </a>
<xsl:value-of select="$locale_strings/str[@id='separator']" /> <xsl:value-of select="$locale_strings[@id='separator']" />
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="$site_strings/str[@id='page_login']" /> <xsl:value-of select="$site_strings[@id='page_login']" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="$locale_strings/str[@id='login']" /> <xsl:value-of select="$locale_strings[@id='login']" />
</a> </a>
<xsl:value-of select="$locale_strings/str[@id='separator']" /> <xsl:value-of select="$locale_strings[@id='separator']" />
<img class="openid-icon" src="/images/openid-icon.png" alt="open id logo" /> <img class="openid-icon" src="/images/openid-icon.png" alt="open id logo" />
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="$site_strings/str[@id='page_login-openid']" /> <xsl:value-of select="$site_strings[@id='page_login-openid']" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="$locale_strings/str[@id='login_openid']" /> <xsl:value-of select="$locale_strings[@id='login_openid']" />
</a> </a>
</div> </div>
</xsl:when> </xsl:when>
@ -93,39 +93,39 @@
<div class="header1"> <div class="header1">
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="$site_strings/str[@id='page_upload']" /> <xsl:value-of select="$site_strings[@id='page_upload']" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="$locale_strings/str[@id='upload_video']" /> <xsl:value-of select="$locale_strings[@id='upload_video']" />
</a> </a>
<xsl:value-of select="$locale_strings/str[@id='separator']" /> <xsl:value-of select="$locale_strings[@id='separator']" />
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="$site_strings/str[@id='page_bookmarks']" /> <xsl:value-of select="$site_strings[@id='page_bookmarks']" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="$locale_strings/str[@id='bookmarks']" /> <xsl:value-of select="$locale_strings[@id='bookmarks']" />
</a> </a>
<xsl:value-of select="$locale_strings/str[@id='separator']" /> <xsl:value-of select="$locale_strings[@id='separator']" />
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="$site_strings/str[@id='page_account']" /> <xsl:value-of select="$site_strings[@id='page_account']" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="$locale_strings/str[@id='account_details']" /> <xsl:value-of select="$locale_strings[@id='account_details']" />
</a> </a>
</div> </div>
<div class="header2"> <div class="header2">
<xsl:value-of select="$locale_strings/str[@id='logged_in_as']" /> <xsl:value-of select="$locale_strings[@id='logged_in_as']" />
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
user/<xsl:value-of select="//@username" /> user/<xsl:value-of select="//@username" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="//@username" /> <xsl:value-of select="//@username" />
</a> </a>
<xsl:value-of select="$locale_strings/str[@id='separator']" /> <xsl:value-of select="$locale_strings[@id='separator']" />
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="$site_strings/str[@id='page_logout']" /> <xsl:value-of select="$site_strings[@id='page_logout']" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="$locale_strings/str[@id='logout']" /> <xsl:value-of select="$locale_strings[@id='logout']" />
</a> </a>
</div> </div>
</xsl:otherwise> </xsl:otherwise>
@ -138,23 +138,23 @@
<div class="footer"> <div class="footer">
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="$site_strings/str[@id='page_gnutube-authors']" /> <xsl:value-of select="$site_strings[@id='page_gnutube-authors']" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="$locale_strings/str[@id='gnutube_authors']" /> <xsl:value-of select="$locale_strings[@id='gnutube_authors']" />
</a> </a>
<xsl:value-of select="$locale_strings/str[@id='separator']" /> <xsl:value-of select="$locale_strings[@id='separator']" />
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="$site_strings/str[@id='page_gnutube-license']" /> <xsl:value-of select="$site_strings[@id='page_gnutube-license']" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="$locale_strings/str[@id='gnutube_license']" /> <xsl:value-of select="$locale_strings[@id='gnutube_license']" />
</a> </a>
<xsl:value-of select="$locale_strings/str[@id='separator']" /> <xsl:value-of select="$locale_strings[@id='separator']" />
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="$site_strings/str[@id='page_gnutube-source-code']" /> <xsl:value-of select="$site_strings[@id='page_gnutube-source-code']" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="$locale_strings/str[@id='gnutube_source_code']" /> <xsl:value-of select="$locale_strings[@id='gnutube_source_code']" />
</a> </a>
</div> </div>
@ -172,18 +172,18 @@
<div class="search"> <div class="search">
<form method="get" enctype="text/plain"> <form method="get" enctype="text/plain">
<xsl:attribute name="action"> <xsl:attribute name="action">
<xsl:value-of select="$site_strings/str[@id='page_results']" /> <xsl:value-of select="$site_strings[@id='page_results']" />
</xsl:attribute> </xsl:attribute>
<fieldset> <fieldset>
<input type="text" name="query" size="40" /><br /> <input type="text" name="query" size="40" /><br />
<input type="submit"> <input type="submit">
<xsl:attribute name="value"> <xsl:attribute name="value">
<xsl:value-of select="$locale_strings/str[@id='button_find']" /> <xsl:value-of select="$locale_strings[@id='button_find']" />
</xsl:attribute> </xsl:attribute>
</input>&#160; </input>&#160;
<input type="submit" name="lucky"> <input type="submit" name="lucky">
<xsl:attribute name="value"> <xsl:attribute name="value">
<xsl:value-of select="$locale_strings/str[@id='button_lucky']" /> <xsl:value-of select="$locale_strings[@id='button_lucky']" />
</xsl:attribute> </xsl:attribute>
</input> </input>
</fieldset> </fieldset>
@ -193,14 +193,14 @@
<div class="toplists"> <div class="toplists">
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="$site_strings/str[@id='page_query_latestadditions']" /> <xsl:value-of select="$site_strings[@id='page_query_latestadditions']" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="$locale_strings/str[@id='query_latestadditions']" /> <xsl:value-of select="$locale_strings[@id='query_latestadditions']" />
</a> </a>
<xsl:value-of select="$locale_strings/str[@id='separator']" /> <xsl:value-of select="$locale_strings[@id='separator']" />
<a href="about:blank"><xsl:value-of select="$locale_strings/str[@id='query_mostdownloads']" /></a> <a href="about:blank"><xsl:value-of select="$locale_strings[@id='query_mostdownloads']" /></a>
<xsl:value-of select="$locale_strings/str[@id='separator']" /> <xsl:value-of select="$locale_strings[@id='separator']" />
<a href="about:blank"><xsl:value-of select="$locale_strings/str[@id='query_bestrated']" /></a> <a href="about:blank"><xsl:value-of select="$locale_strings[@id='query_bestrated']" /></a>
</div> </div>
</xsl:template> </xsl:template>
@ -214,10 +214,10 @@
<div class="search-small"> <div class="search-small">
<form method="get" enctype="text/plain"> <form method="get" enctype="text/plain">
<xsl:attribute name="action"> <xsl:attribute name="action">
<xsl:value-of select="$site_strings/str[@id='page_results']" /> <xsl:value-of select="$site_strings[@id='page_results']" />
</xsl:attribute> </xsl:attribute>
<fieldset> <fieldset>
<xsl:value-of select="$locale_strings/str[@id='search']" />: <xsl:value-of select="$locale_strings[@id='search']" />:
<input type="text" name="query" size="auto" /> <input type="text" name="query" size="auto" />
</fieldset> </fieldset>
</form> </form>
@ -247,7 +247,7 @@
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>
<xsl:variable name="messagetext" select="@text" /> <xsl:variable name="messagetext" select="@text" />
<xsl:value-of select="$locale_strings/str[@id=$messagetext]" /> <xsl:value-of select="$locale_strings[@id=$messagetext]" />
<!-- probably one can do this on one line, dunno how --> <!-- probably one can do this on one line, dunno how -->
</div> </div>
@ -269,7 +269,7 @@
</xsl:choose> </xsl:choose>
</xsl:attribute> </xsl:attribute>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="$site_strings/str[@id='page_results']" /> <xsl:value-of select="$site_strings[@id='page_results']" />
tag: tag:
<xsl:value-of select="text" /> <xsl:value-of select="text" />
</xsl:attribute> </xsl:attribute>
@ -281,9 +281,7 @@
</xsl:template> </xsl:template>
<xsl:template match="results"> <xsl:template name="pagination">
<xsl:call-template name="searchbar"/>
<div> <div>
<xsl:choose> <xsl:choose>
<xsl:when test="@currentpage&lt;=1"> <xsl:when test="@currentpage&lt;=1">
@ -292,13 +290,13 @@
<xsl:otherwise> <xsl:otherwise>
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="concat('search.pl?query=', @query, '&amp;orderby=', @orderby, '&amp;page=1')" /> <xsl:value-of select="concat($site_strings[@id='page_results'], @query, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=1')" />
</xsl:attribute> </xsl:attribute>
&lt;&lt; &lt;&lt;
</a> </a>
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="concat('search.pl?query=', @query, '&amp;orderby=', @orderby, '&amp;page=', @currentpage - 1)" /> <xsl:value-of select="concat($site_strings[@id='page_results'], @query, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=', @currentpage - 1)" />
</xsl:attribute> </xsl:attribute>
&lt; &lt;
</a> </a>
@ -307,7 +305,7 @@
<xsl:if test="@currentpage > 2"> <xsl:if test="@currentpage > 2">
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="concat('search.pl?query=', @query, '&amp;orderby=', @orderby, '&amp;page=', @currentpage - 2)" /> <xsl:value-of select="concat($site_strings[@id='page_results'], @query, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=', @currentpage - 2)" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="@currentpage - 2" /> <xsl:value-of select="@currentpage - 2" />
</a> </a>
@ -315,7 +313,7 @@
<xsl:if test="@currentpage > 1"> <xsl:if test="@currentpage > 1">
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="concat('search.pl?query=', @query, '&amp;orderby=', @orderby, '&amp;page=', @currentpage - 1)" /> <xsl:value-of select="concat($site_strings[@id='page_results'], @query, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=', @currentpage - 1)" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="@currentpage - 1" /> <xsl:value-of select="@currentpage - 1" />
</a> </a>
@ -325,7 +323,7 @@
<xsl:if test="$temp > 0"> <xsl:if test="$temp > 0">
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="concat('search.pl?query=', @query, '&amp;orderby=', @orderby, '&amp;page=', @currentpage + 1)" /> <xsl:value-of select="concat($site_strings[@id='page_results'], @query, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=', @currentpage + 1)" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="@currentpage + 1" /> <xsl:value-of select="@currentpage + 1" />
</a> </a>
@ -333,7 +331,7 @@
<xsl:if test="$temp > 1"> <xsl:if test="$temp > 1">
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="concat('search.pl?query=', @query, '&amp;orderby=', @orderby, '&amp;page=', @currentpage + 2)" /> <xsl:value-of select="concat($site_strings[@id='page_results'], @query, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=', @currentpage + 2)" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="@currentpage + 2" /> <xsl:value-of select="@currentpage + 2" />
</a> </a>
@ -345,25 +343,124 @@
<xsl:otherwise> <xsl:otherwise>
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="concat('search.pl?query=', @query, '&amp;orderby=', @orderby, '&amp;page=', @currentpage + 1)" /> <xsl:value-of select="concat($site_strings[@id='page_results'], @query, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=', @currentpage + 1)" />
</xsl:attribute> </xsl:attribute>
&gt; &gt;
</a> </a>
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="concat('search.pl?query=', @query, '&amp;orderby=', @orderby, '&amp;page=', @lastpage)" /> <xsl:value-of select="concat($site_strings[@id='page_results'], @query, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=', @lastpage)" />
</xsl:attribute> </xsl:attribute>
&gt;&gt; &gt;&gt;
</a> </a>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</div> </div>
<div>_</div> </xsl:template>
<xsl:template match="results">
<xsl:call-template name="searchbar"/>
<div> <div>
<xsl:value-of select="$locale_strings/str[@id='results_for_query']" />: <xsl:choose>
"<xsl:value-of select="@query" />" <xsl:when test="@query!=''">
<xsl:value-of select="$locale_strings[@id='results_for_query']" />
"<xsl:value-of select="@query" />"
<xsl:if test="@orderby!=''">
<xsl:value-of select="$locale_strings[@id='ordered_by']" />
<xsl:choose>
<xsl:when test="@orderby='relevance'">
<xsl:value-of select="$locale_strings[@id='relevance']" />
</xsl:when>
<xsl:when test="@orderby='duration'">
<xsl:value-of select="$locale_strings[@id='duration']" />
</xsl:when>
<xsl:when test="@orderby='filesize'">
<xsl:value-of select="$locale_strings[@id='filesize']" />
</xsl:when>
<xsl:when test="@orderby='viewcount'">
<xsl:value-of select="$locale_strings[@id='viewcount']" />
</xsl:when>
<xsl:when test="@orderby='downloadcount'">
<xsl:value-of select="$locale_strings[@id='downloadcount']" />
</xsl:when>
<xsl:when test="@orderby='timestamp'">
<xsl:value-of select="$locale_strings[@id='timestamp']" />
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="@sort='asc'">
<xsl:value-of select="$locale_strings[@id='ascending']" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$locale_strings[@id='descending']" />
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:when>
<xsl:when test="@orderby!=''">
<xsl:choose>
<xsl:when test="@orderby='timestamp'">
<xsl:choose>
<xsl:when test="@sort='asc'">
the oldest videos
</xsl:when>
<xsl:otherwise>
the newest videos
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@orderby='downloadcount'">
<xsl:choose>
<xsl:when test="@sort='asc'">
the least downloaded videos
</xsl:when>
<xsl:otherwise>
the most downloaded videos
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@orderby='viewcount'">
<xsl:choose>
<xsl:when test="@sort='asc'">
the least viewed videos
</xsl:when>
<xsl:otherwise>
the most viewed videos
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@orderby='duration'">
<xsl:choose>
<xsl:when test="@sort='asc'">
the shortest videos
</xsl:when>
<xsl:otherwise>
the lengthest videos
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@orderby='filesize'">
<xsl:choose>
<xsl:when test="@sort='asc'">
the smallest videos
</xsl:when>
<xsl:otherwise>
the biggest videos
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
</div> </div>
<table class="results"> <div>
<xsl:value-of select="@resultcount" /> results on <xsl:value-of select="@lastpage" /> pages
</div>
<xsl:call-template name="pagination"/>
<table class="results" align="center">
<xsl:for-each select="result"> <xsl:for-each select="result">
<tr class="result"> <tr class="result">
<td> <td>
@ -373,7 +470,7 @@
</xsl:attribute> </xsl:attribute>
<img> <img>
<xsl:attribute name="src"> <xsl:attribute name="src">
<xsl:value-of select="thumbnail" /> <xsl:value-of select="@thumbnail" />
</xsl:attribute> </xsl:attribute>
<xsl:attribute name="alt"> <xsl:attribute name="alt">
<xsl:value-of select="rdf:RDF/cc:Work/dc:title" /> <xsl:value-of select="rdf:RDF/cc:Work/dc:title" />
@ -381,14 +478,108 @@
</img> </img>
</a> </a>
</td> </td>
<td> <td><h2>
<xsl:value-of select="$locale_strings/str[@id='DC.Title']" />: <xsl:value-of select="rdf:RDF/cc:Work/dc:title" /><br /> <a>
<xsl:value-of select="$locale_strings/str[@id='DC.Creator']" />: <xsl:value-of select="rdf:RDF/cc:Work/dc:creator" /><br /> <xsl:attribute name="href">
<xsl:value-of select="$locale_strings/str[@id='DC.Publisher']" />: <xsl:value-of select="rdf:RDF/cc:Work/dc:publisher" /> <xsl:value-of select="rdf:RDF/cc:Work/dc:identifier" />
</xsl:attribute>
<xsl:value-of select="rdf:RDF/cc:Work/dc:title" />
</a></h2>
<table class="videometadata">
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='duration']" />:
</td>
<td class="rightcell">
<xsl:variable name="minutes" select="floor(@duration div 60)" />
<xsl:variable name="hours" select="floor(@duration div 3600)" />
<xsl:variable name="seconds" select="@duration - $minutes*60 - $hours*3600" />
<xsl:value-of select="concat($hours, ':', format-number($minutes, '00'), ':', format-number($seconds, '00'))" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='viewcount']" />:
</td>
<td class="rightcell">
<xsl:value-of select="@viewcount" />
</td>
</tr>
</table>
</td> </td>
</tr> </tr>
</xsl:for-each> </xsl:for-each>
</table> </table>
<xsl:call-template name="pagination"/>
<div>
<form method="get" action="search.pl">
<fieldset>
<input type="hidden" name="query">
<xsl:attribute name="value">
<xsl:value-of select="@query" />
</xsl:attribute>
</input>
order by:
<select name="orderby">
<xsl:if test="@query!=''">
<option value="relevance">
<xsl:if test="@orderby='relevance'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='relevance']" />
</option>
</xsl:if>
<option value="filesize">
<xsl:if test="@orderby='filesize'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='filesize']" />
</option>
<option value="duration">
<xsl:if test="@orderby='duration'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='duration']" />
</option>
<option value="viewcount">
<xsl:if test="@orderby='viewcount'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='viewcount']" />
</option>
<option value="downloadcount">
<xsl:if test="@orderby='downloadcount'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='downloadcount']" />
</option>
<option value="timestamp">
<xsl:if test="@orderby='timestamp'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='timestamp']" />
</option>
</select>
<select name="sort">
<option value="desc">
<xsl:if test="@sort='desc'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='descending']" />
</option>
<option value="asc">
<xsl:if test="@sort='asc'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='ascending']" />
</option>
</select>
<input type="submit" />
</fieldset>
</form>
</div>
</xsl:template> </xsl:template>
@ -440,7 +631,7 @@
<xsl:value-of select="rdf:RDF/cc:Work/@rdf:about" /> <xsl:value-of select="rdf:RDF/cc:Work/@rdf:about" />
</xsl:attribute> </xsl:attribute>
<br /> <br />
<xsl:value-of select="$locale_strings/str[@id='download_video']" /> <xsl:value-of select="$locale_strings[@id='download_video']" />
</a> </a>
</div> </div>
@ -449,7 +640,7 @@
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="rdf:RDF/cc:License/@rdf:about" /> <xsl:value-of select="rdf:RDF/cc:License/@rdf:about" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="$locale_strings/str[@id='license_conditions']" />: <xsl:value-of select="$locale_strings[@id='license_conditions']" />:
</a> </a>
<br /> <br />
<a> <a>
@ -507,7 +698,7 @@
<table class="videometadata"> <table class="videometadata">
<tr> <tr>
<td class="leftcell"> <td class="leftcell">
<xsl:value-of select="$locale_strings/str[@id='DC.Title']" />: <xsl:value-of select="$locale_strings[@id='DC.Title']" />:
</td> </td>
<td class="rightcell"> <td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:title" /> <xsl:value-of select="rdf:RDF/cc:Work/dc:title" />
@ -515,7 +706,7 @@
</tr> </tr>
<tr> <tr>
<td class="leftcell"> <td class="leftcell">
<xsl:value-of select="$locale_strings/str[@id='DC.Creator']" />: <xsl:value-of select="$locale_strings[@id='DC.Creator']" />:
</td> </td>
<td class="rightcell"> <td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:creator" /> <xsl:value-of select="rdf:RDF/cc:Work/dc:creator" />
@ -523,7 +714,7 @@
</tr> </tr>
<tr> <tr>
<td class="leftcell"> <td class="leftcell">
<xsl:value-of select="$locale_strings/str[@id='DC.Subject']" />: <xsl:value-of select="$locale_strings[@id='DC.Subject']" />:
</td> </td>
<td class="rightcell"> <td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:subject" /> <xsl:value-of select="rdf:RDF/cc:Work/dc:subject" />
@ -531,7 +722,7 @@
</tr> </tr>
<tr> <tr>
<td class="leftcell"> <td class="leftcell">
<xsl:value-of select="$locale_strings/str[@id='DC.Description']" />: <xsl:value-of select="$locale_strings[@id='DC.Description']" />:
</td> </td>
<td class="rightcell"> <td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:description" /> <xsl:value-of select="rdf:RDF/cc:Work/dc:description" />
@ -539,7 +730,7 @@
</tr> </tr>
<tr> <tr>
<td class="leftcell"> <td class="leftcell">
<xsl:value-of select="$locale_strings/str[@id='DC.Publisher']" />: <xsl:value-of select="$locale_strings[@id='DC.Publisher']" />:
</td> </td>
<td class="rightcell"> <td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:publisher" /> <xsl:value-of select="rdf:RDF/cc:Work/dc:publisher" />
@ -547,7 +738,7 @@
</tr> </tr>
<tr> <tr>
<td class="leftcell"> <td class="leftcell">
<xsl:value-of select="$locale_strings/str[@id='DC.Date']" />: <xsl:value-of select="$locale_strings[@id='DC.Date']" />:
</td> </td>
<td class="rightcell"> <td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:date" /> <xsl:value-of select="rdf:RDF/cc:Work/dc:date" />
@ -555,7 +746,7 @@
</tr> </tr>
<tr> <tr>
<td class="leftcell"> <td class="leftcell">
<xsl:value-of select="$locale_strings/str[@id='DC.Source']" />: <xsl:value-of select="$locale_strings[@id='DC.Source']" />:
</td> </td>
<td class="rightcell"> <td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:source" /> <xsl:value-of select="rdf:RDF/cc:Work/dc:source" />
@ -563,7 +754,7 @@
</tr> </tr>
<tr> <tr>
<td class="leftcell"> <td class="leftcell">
<xsl:value-of select="$locale_strings/str[@id='DC.Rights']" />: <xsl:value-of select="$locale_strings[@id='DC.Rights']" />:
</td> </td>
<td class="rightcell"> <td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:rights" /> <xsl:value-of select="rdf:RDF/cc:Work/dc:rights" />
@ -590,7 +781,7 @@
<div class="comments"> <div class="comments">
<span class="protip"> <span class="protip">
<xsl:value-of select="$locale_strings/str[@id='comment_on_video']" /> <xsl:value-of select="$locale_strings[@id='comment_on_video']" />
</span> </span>
<br /> <br />
<xsl:for-each select="comment"> <xsl:for-each select="comment">
@ -620,7 +811,7 @@
<br /> <br />
<input type="submit" name="send"> <input type="submit" name="send">
<xsl:attribute name="value"> <xsl:attribute name="value">
<xsl:value-of select="$locale_strings/str[@id='comment_post']" /> <xsl:value-of select="$locale_strings[@id='comment_post']" />
</xsl:attribute> </xsl:attribute>
</input> </input>
</fieldset> </fieldset>
@ -635,20 +826,20 @@
<form method="post"> <form method="post">
<xsl:attribute name="action"> <xsl:attribute name="action">
<xsl:value-of select="$site_strings/str[@id='page_register']" /> <xsl:value-of select="$site_strings[@id='page_register']" />
</xsl:attribute> </xsl:attribute>
<fieldset> <fieldset>
<xsl:value-of select="$locale_strings/str[@id='username']" />: <xsl:value-of select="$locale_strings[@id='username']" />:
<br /> <br />
<input name="user" type="text" size="30" maxlength="30" /> <input name="user" type="text" size="30" maxlength="30" />
<br /> <br />
<xsl:value-of select="$locale_strings/str[@id='password']" />: <xsl:value-of select="$locale_strings[@id='password']" />:
<br /> <br />
<input name="pass" type="password" size="30" maxlength="30" /> <input name="pass" type="password" size="30" maxlength="30" />
<br /> <br />
<input type="submit" name="register" > <input type="submit" name="register" >
<xsl:attribute name="value"> <xsl:attribute name="value">
<xsl:value-of select="$locale_strings/str[@id='button_register']" /> <xsl:value-of select="$locale_strings[@id='button_register']" />
</xsl:attribute> </xsl:attribute>
</input> </input>
</fieldset> </fieldset>
@ -664,38 +855,38 @@
<form method="post"> <form method="post">
<xsl:attribute name="action"> <xsl:attribute name="action">
<xsl:value-of select="$site_strings/str[@id='page_login']" /> <xsl:value-of select="$site_strings[@id='page_login']" />
</xsl:attribute> </xsl:attribute>
<fieldset> <fieldset>
<input name="action" type="hidden" value="login" /> <input name="action" type="hidden" value="login" />
<xsl:value-of select="$locale_strings/str[@id='username']" />: <xsl:value-of select="$locale_strings[@id='username']" />:
<br /> <br />
<input name="user" type="text" size="30" maxlength="30" /> <input name="user" type="text" size="30" maxlength="30" />
<br /> <br />
<xsl:value-of select="$locale_strings/str[@id='password']" />: <xsl:value-of select="$locale_strings[@id='password']" />:
<br /> <br />
<input name="pass" type="password" size="30" maxlength="30" /> <input name="pass" type="password" size="30" maxlength="30" />
<br /> <br />
<input type="submit" name="login" > <input type="submit" name="login" >
<xsl:attribute name="value"> <xsl:attribute name="value">
<xsl:value-of select="$locale_strings/str[@id='button_login']" /> <xsl:value-of select="$locale_strings[@id='button_login']" />
</xsl:attribute> </xsl:attribute>
</input> </input>
</fieldset> </fieldset>
</form> </form>
<form method="post"> <form method="post">
<xsl:attribute name="action"> <xsl:attribute name="action">
<xsl:value-of select="$site_strings/str[@id='page_login']" /> <xsl:value-of select="$site_strings[@id='page_login']" />
</xsl:attribute> </xsl:attribute>
<fieldset> <fieldset>
<input name="action" type="hidden" value="openid" /> <input name="action" type="hidden" value="openid" />
<xsl:value-of select="$locale_strings/str[@id='username']" />: <xsl:value-of select="$locale_strings[@id='username']" />:
<br /> <br />
<input name="user" type="text" size="30" maxlength="30" /> <input name="user" type="text" size="30" maxlength="30" />
<br /> <br />
<input type="submit" name="login" > <input type="submit" name="login" >
<xsl:attribute name="value"> <xsl:attribute name="value">
<xsl:value-of select="$locale_strings/str[@id='button_login']" /> <xsl:value-of select="$locale_strings[@id='button_login']" />
</xsl:attribute> </xsl:attribute>
</input> </input>
</fieldset> </fieldset>
@ -712,29 +903,29 @@
<xsl:when test="@page=1"> <xsl:when test="@page=1">
<form method="post" enctype="multipart/form-data"> <form method="post" enctype="multipart/form-data">
<xsl:attribute name="action"> <xsl:attribute name="action">
<xsl:value-of select="$site_strings/str[@id='page_uploader']" /> <xsl:value-of select="$site_strings[@id='page_uploader']" />
</xsl:attribute> </xsl:attribute>
<fieldset> <fieldset>
<xsl:value-of select="$locale_strings/str[@id='instruction_file']" /> <xsl:value-of select="$locale_strings[@id='instruction_file']" />
<br /> <br />
<input name="file" type="file" size="13" /> <input name="file" type="file" size="13" />
<br /> <br />
<xsl:value-of select="$locale_strings/str[@id='instruction_title']" /> <xsl:value-of select="$locale_strings[@id='instruction_title']" />
<br /> <br />
<input name="DC.Title" type="text" size="30" /> <input name="DC.Title" type="text" size="30" />
<br /> <br />
<xsl:value-of select="$locale_strings/str[@id='instruction_description']" /> <xsl:value-of select="$locale_strings[@id='instruction_description']" />
<br /> <br />
<input name="DC.Description" type="text" size="30" /> <input name="DC.Description" type="text" size="30" />
<br /><br /> <br /><br />
<input type="submit" name="page2" > <input type="submit" name="page2" >
<xsl:attribute name="value"> <xsl:attribute name="value">
<xsl:value-of select="$locale_strings/str[@id='button_next_page']" /> <xsl:value-of select="$locale_strings[@id='button_next_page']" />
</xsl:attribute> </xsl:attribute>
</input> </input>
<br /> <br />
<span class="protip"> <span class="protip">
<xsl:value-of select="$locale_strings/str[@id='this_is_page_1']" /> <xsl:value-of select="$locale_strings[@id='this_is_page_1']" />
</span> </span>
</fieldset> </fieldset>
</form> </form>
@ -743,37 +934,37 @@
<xsl:when test="@page=2"> <xsl:when test="@page=2">
<form method="post" enctype="multipart/form-data"> <form method="post" enctype="multipart/form-data">
<xsl:attribute name="action"> <xsl:attribute name="action">
<xsl:value-of select="$site_strings/str[@id='page_uploader']" /> <xsl:value-of select="$site_strings[@id='page_uploader']" />
</xsl:attribute> </xsl:attribute>
<fieldset> <fieldset>
<xsl:value-of select="$locale_strings/str[@id='instruction_creator']" /> <xsl:value-of select="$locale_strings[@id='instruction_creator']" />
<br /> <br />
<input name="DC.Creator" type="text" size="30" /> <input name="DC.Creator" type="text" size="30" />
<br /> <br />
<xsl:value-of select="$locale_strings/str[@id='instruction_subject']" /> <xsl:value-of select="$locale_strings[@id='instruction_subject']" />
<br /> <br />
<input name="DC.Subject" type="text" size="30" /> <input name="DC.Subject" type="text" size="30" />
<br /> <br />
<xsl:value-of select="$locale_strings/str[@id='instruction_source']" /> <xsl:value-of select="$locale_strings[@id='instruction_source']" />
<br /> <br />
<input name="DC.Source" type="text" size="30" /> <input name="DC.Source" type="text" size="30" />
<br /> <br />
<xsl:value-of select="$locale_strings/str[@id='instruction_language']" /> <xsl:value-of select="$locale_strings[@id='instruction_language']" />
<br /> <br />
<input name="DC.Language" type="text" size="30" /> <input name="DC.Language" type="text" size="30" />
<br /> <br />
<xsl:value-of select="$locale_strings/str[@id='instruction_coverage']" /> <xsl:value-of select="$locale_strings[@id='instruction_coverage']" />
<br /> <br />
<input name="DC.Coverage" type="text" size="30" /> <input name="DC.Coverage" type="text" size="30" />
<br /> <br />
<input type="submit" name="page2" > <input type="submit" name="page2" >
<xsl:attribute name="value"> <xsl:attribute name="value">
<xsl:value-of select="$locale_strings/str[@id='button_next_page']" /> <xsl:value-of select="$locale_strings[@id='button_next_page']" />
</xsl:attribute> </xsl:attribute>
</input> </input>
<br /> <br />
<span class="protip"> <span class="protip">
<xsl:value-of select="$locale_strings/str[@id='this_is_page_2']" /> <xsl:value-of select="$locale_strings[@id='this_is_page_2']" />
</span> </span>
</fieldset> </fieldset>
</form> </form>