summaryrefslogtreecommitdiff
path: root/lib/VNDB/Handler
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2008-12-04 13:02:26 +0100
committerYorhel <git@yorhel.nl>2008-12-04 13:02:26 +0100
commit41d31eb3eb4576cf7e621cd254b6cefe347981fc (patch)
treed26450cd86100cd48321f08a9e0f283cf38412c9 /lib/VNDB/Handler
parent8e606a77e4be57ed45286cdc9d939fc7c1f1c739 (diff)
...and an interface for adding/removing producers
Code reuse = good. Release edit form is now finished, functionality-wise.
Diffstat (limited to 'lib/VNDB/Handler')
-rw-r--r--lib/VNDB/Handler/Producers.pm27
-rw-r--r--lib/VNDB/Handler/Releases.pm12
2 files changed, 37 insertions, 2 deletions
diff --git a/lib/VNDB/Handler/Producers.pm b/lib/VNDB/Handler/Producers.pm
index d3e37a36..49a7b879 100644
--- a/lib/VNDB/Handler/Producers.pm
+++ b/lib/VNDB/Handler/Producers.pm
@@ -3,7 +3,7 @@ package VNDB::Handler::Producers;
use strict;
use warnings;
-use YAWF ':html';
+use YAWF ':html', ':xml';
use VNDB::Func;
@@ -12,6 +12,7 @@ YAWF::register(
qr{p(?:([1-9]\d*)(?:\.([1-9]\d*))?/edit|/new)}
=> \&edit,
qr{p/([a-z0]|all)} => \&list,
+ qr{xml/producers\.xml} => \&pxml,
);
@@ -205,5 +206,29 @@ sub list {
}
+# peforms a (simple) search and returns the results in XML format
+sub pxml {
+ my $self = shift;
+
+ my $q = $self->formValidate({ name => 'q', maxlength => 500 });
+ return 404 if $q->{_err};
+ $q = $q->{q};
+
+ my($list, $np) = $self->dbProducerGet(
+ $q =~ /^p([1-9]\d*)/ ? (id => $1) : (search => $q),
+ results => 10,
+ page => 1,
+ );
+
+ $self->resHeader('Content-type' => 'text/xml; charset=UTF-8');
+ xml;
+ tag 'producers', more => $np ? 'yes' : 'no', query => $q;
+ for(@$list) {
+ tag 'item', id => $_->{id}, $_->{name};
+ }
+ end;
+}
+
+
1;
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index 52cbde84..55ce8400 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -349,7 +349,17 @@ sub _form {
],
'Producers' => [
- [ input => short => 'producers', name => 'Producers' ],
+ [ hidden => short => 'producers' ],
+ [ static => nolabel => 1, content => sub {
+ h2 'Selected producers';
+ div id => 'producerssel';
+ end;
+ h2 'Add producer';
+ div;
+ input type => 'text', class => 'text';
+ a href => '#', 'add';
+ end;
+ }],
],
'Visual novels' => [