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
This commit is contained in:
josch 2007-12-27 14:50:08 +00:00
parent 24f536e1e8
commit f49a7367e9
6 changed files with 49 additions and 11 deletions

View file

@ -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;
}

View file

@ -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;

View file

@ -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");

View file

@ -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';
}

View file

@ -24,6 +24,7 @@
<xsl:include href="./xhtml/video.xsl"/>
<xsl:include href="./xhtml/register.xsl"/>
<xsl:include href="./xhtml/settings.xsl"/>
<xsl:include href="./xhtml/advancedsearch.xsl"/>
<xsl:variable name="locale">
<xsl:choose>
@ -237,6 +238,9 @@
<xsl:when test="//search">
<xsl:call-template name="results"/>
</xsl:when>
<xsl:when test="//advancedsearch">
<xsl:call-template name="advancedsearch"/>
</xsl:when>
<xsl:when test="//video">
<xsl:call-template name="video"/>
</xsl:when>

View file

@ -59,8 +59,8 @@
<xsl:value-of select="$locale_strings[@id='settings_instruction_method']" />
<br />
<input type="radio" name="cortado" value="1">
<xsl:if test="//settings/@cortado=1">
<input type="radio" name="cortado" value="true">
<xsl:if test="//settings/@cortado='true'">
<xsl:attribute name="checked">
checked
</xsl:attribute>
@ -69,8 +69,8 @@
<xsl:value-of select="$locale_strings[@id='watch_cortadoapplet']" />
<br />
<input type="radio" name="cortado" value="0">
<xsl:if test="//settings/@cortado=0">
<input type="radio" name="cortado" value="false">
<xsl:if test="//settings/@cortado='false'">
<xsl:attribute name="checked">
checked
</xsl:attribute>