From f49a7367e9a063d3e7a94f1110e4bb7659966af6 Mon Sep 17 00:00:00 2001 From: josch Date: Thu, 27 Dec 2007 14:50:08 +0000 Subject: [PATCH] fixed cortado user settings bug, saved cortado settings for all users (not only logged in) in cookie, fixed non ascii bug in search query, changed user table layout, added advancedsearch entry git-svn-id: http://yolanda.mister-muffin.de/svn@221 7eef14d0-6ed0-489d-bf55-20463b2d70db --- trunk/functions.pl | 12 +++++++++++- trunk/init_sql.pl | 2 +- trunk/search.pl | 20 ++++++++++++++++++-- trunk/video.pl | 14 +++++++++++--- trunk/xsl/xhtml.xsl | 4 ++++ trunk/xsl/xhtml/settings.xsl | 8 ++++---- 6 files changed, 49 insertions(+), 11 deletions(-) diff --git a/trunk/functions.pl b/trunk/functions.pl index ce1349d..22987a2 100644 --- a/trunk/functions.pl +++ b/trunk/functions.pl @@ -167,10 +167,20 @@ sub output_page ) ); + if($query->param('cortado') eq 'true') + { + @cookies = [$session->cookie(-name=>$session_name, -value=>$session->id), $session->cookie(-name=>'cortado', -value=>'true')]; + } + elsif($query->param('cortado') eq 'false') + { + @cookies = [$session->cookie(-name=>$session_name, -value=>$session->id), $session->cookie(-name=>'cortado', -value=>'false')]; + } + #send everything including http headers to the user - if xslt chosen is xspf set download filename return $session->header( -type=>'text/xml', - -charset=>'UTF-8' + -charset=>'UTF-8', + -cookie=>@cookies ), $foo->toString; } diff --git a/trunk/init_sql.pl b/trunk/init_sql.pl index 7d780ad..80a8881 100644 --- a/trunk/init_sql.pl +++ b/trunk/init_sql.pl @@ -52,7 +52,7 @@ $dbh->do(qq{create table timestamp bigint not null, locale varchar(10) not null, pagesize tinyint unsigned default 5, - cortado tinyint default 1, + cortado varchar(5) default 'true', primary key (id) ) }) or die $dbh->errstr; diff --git a/trunk/search.pl b/trunk/search.pl index c57caac..9958c2f 100644 --- a/trunk/search.pl +++ b/trunk/search.pl @@ -18,9 +18,20 @@ if($query->param('query')) my @args = (); $strquery = $query->param('query'); + $strquery = s/%([0-9A-F]{2})/chr(hex($1))/eg; (@tags) = $strquery =~ /tag:(\w+)/gi; ($orderby) = $strquery =~ /orderby:(\w+)/i; ($sort) = $strquery =~ /sort:(\w+)/i; + #($title) = $strquery =~ /title:(\w+)/i; + #($description) = $strquery =~ /description:(\w+)/i; + #($creator) = $strquery =~ /creator:(\w+)/i; + #($language) = $strquery =~ /language:(\w+)/i; + #($coverage) = $strquery =~ /coverage:(\w+)/i; + #($rights) = $strquery =~ /rights:(\w+)/i; + #($license) = $strquery =~ /license:(\w+)/i; + #($filesize) = $strquery =~ /filesize:([<>]?\w+)/i; + #($duration) = $strquery =~ /duration:([<>]?\w+)/i; + #($timestamp) = $strquery =~ /timestamp:([<>]?\w+)/i; $strquery =~ s/(tag|orderby|sort):\w+//gi; $strquery =~ s/^\s*(.*?)\s*$/$1/; @@ -101,15 +112,20 @@ if($query->param('query')) { print $query->redirect("index.pl?warning=warning_no_results"); } - if(@{$page->{'results'}->{'result'}} == 1 or $query->param('lucky')) + elsif(@{$page->{'results'}->{'result'}} == 1 or $query->param('lucky')) { - print $query->redirect(@{$page->{'results'}->{'result'}}[0]->{'rdf:RDF'}->{'cc:Work'}->{'dc:identifier'}[0]); + print $query->redirect($page->{'results'}->{'result'}[0]->{'rdf:RDF'}->{'cc:Work'}->{'dc:identifier'}[0]); } else { print output_page(); } } +elsif($query->param('advanced')) +{ + $page->{'advancedsearch'} = ['']; + print output_page(); +} else { print $query->redirect("index.pl?error=error_no_query"); diff --git a/trunk/video.pl b/trunk/video.pl index ef4f2b5..68b6120 100644 --- a/trunk/video.pl +++ b/trunk/video.pl @@ -125,13 +125,21 @@ elsif($query->url_param('title') or $query->url_param('id')) } elsif($query->param('cortado') eq 'false') { - $cortado = 'false' + $cortado = 'false'; } - elsif($userinfo->{'cortado'} = 1) + elsif($userinfo->{'cortado'} eq 'true') { $cortado = 'true'; } - elsif($userinfo->{'cortado'} = 0) + elsif($userinfo->{'cortado'} eq 'false') + { + $cortado = 'false'; + } + elsif($query->cookie('cortado') eq 'true') + { + $cortado = 'true'; + } + elsif($query->cookie('cortado') eq 'false') { $cortado = 'false'; } diff --git a/trunk/xsl/xhtml.xsl b/trunk/xsl/xhtml.xsl index b6c59ae..c5bf555 100755 --- a/trunk/xsl/xhtml.xsl +++ b/trunk/xsl/xhtml.xsl @@ -24,6 +24,7 @@ + @@ -237,6 +238,9 @@ + + + diff --git a/trunk/xsl/xhtml/settings.xsl b/trunk/xsl/xhtml/settings.xsl index 9b6a5a3..7d9f9ab 100644 --- a/trunk/xsl/xhtml/settings.xsl +++ b/trunk/xsl/xhtml/settings.xsl @@ -59,8 +59,8 @@
- - + + checked @@ -69,8 +69,8 @@
- - + + checked