From 5ac3d668fb56961aa43f824feb7dc3407b8eb33e Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sat, 1 Jan 2011 15:05:34 +0100 Subject: More infrastructural changes to accomodate for the permanent filters - Added a 'prefs' option to htmlFooter() to add preference data for use by Javascript. - Added an /xml/prefs.xml URL for setting preferences from JS. - Added 'filter_*' keys to the prefs_key ENUM - Load filters by default on VN and Release browser --- lib/VNDB/Handler/Misc.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib/VNDB/Handler/Misc.pm') diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm index 8b4b8900..2d9932b1 100644 --- a/lib/VNDB/Handler/Misc.pm +++ b/lib/VNDB/Handler/Misc.pm @@ -16,6 +16,7 @@ YAWF::register( qr{setlang}, \&setlang, qr{nospam}, \&nospam, qr{we-dont-like-ie}, \&iemessage, + qr{xml/prefs\.xml}, \&prefs, qr{opensearch\.xml}, \&opensearch, # redirects for old URLs @@ -412,6 +413,24 @@ sub iemessage { } +sub prefs { + my $self = shift; + return if !$self->authCheckCode; + return 404 if !$self->authInfo->{id}; + my $f = $self->formValidate( + { name => 'key', enum => [qw|filter_vn filter_release|] }, + { name => 'value', required => 0, maxlength => 2000 }, + ); + return 404 if $f->{_err}; + $self->authPref($f->{key}, $f->{value}); + + # doesn't really matter what we return, as long as it's XML + $self->resHeader('Content-type' => 'text/xml'); + xml; + tag 'done', ''; +} + + sub opensearch { my $self = shift; $self->resHeader('Content-Type' => 'application/opensearchdescription+xml'); -- cgit v1.2.3