summaryrefslogtreecommitdiff
path: root/lib/VNDB/Handler
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-10-21 16:01:08 +0200
committerYorhel <git@yorhel.nl>2009-10-21 16:01:08 +0200
commit6900668e8dad97762e4a4c493c21dec1391998cb (patch)
treebb1c57a92d773c0a4505c3374a230e6087818583 /lib/VNDB/Handler
parent96e77619793fbe8351e023d17e257e96cdb37509 (diff)
Added relation graphs for producers
TODO: - document the relations - emit a relgraph notify when needed
Diffstat (limited to 'lib/VNDB/Handler')
-rw-r--r--lib/VNDB/Handler/Producers.pm23
-rw-r--r--lib/VNDB/Handler/VNPage.pm32
2 files changed, 24 insertions, 31 deletions
diff --git a/lib/VNDB/Handler/Producers.pm b/lib/VNDB/Handler/Producers.pm
index 41465b18..4e75962b 100644
--- a/lib/VNDB/Handler/Producers.pm
+++ b/lib/VNDB/Handler/Producers.pm
@@ -8,6 +8,7 @@ use VNDB::Func;
YAWF::register(
+ qr{p([1-9]\d*)/rg} => \&rg,
qr{p([1-9]\d*)(?:\.([1-9]\d*))?} => \&page,
qr{p(?:([1-9]\d*)(?:\.([1-9]\d*))?/edit|/new)}
=> \&edit,
@@ -16,6 +17,28 @@ YAWF::register(
);
+sub rg {
+ my($self, $pid) = @_;
+
+ my $p = $self->dbProducerGet(id => $pid, what => 'relgraph')->[0];
+ return 404 if !$p->{id} || !$p->{rgraph};
+
+ my $title = mt '_prodrg_title', $p->{name};
+ return if $self->htmlRGHeader($title, 'p', $p);
+
+ $p->{svg} =~ s/\$___(_prodrel_[a-z]+)____\$/mt $1/eg;
+ $p->{svg} =~ s/\$(_lang_[a-z]+)_\$/mt $1/eg;
+ $p->{svg} =~ s/\$(_ptype_[a-z]+)_\$/mt $1/eg;
+
+ div class => 'mainbox';
+ h1 $title;
+ p class => 'center';
+ lit $p->{svg};
+ end;
+ end;
+ $self->htmlFooter;
+}
+
sub page {
my($self, $pid, $rev) = @_;
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index 0205e77d..ec5f4afc 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -27,40 +27,10 @@ sub rg {
return 404 if !$v->{id} || !$v->{rgraph};
my $title = mt '_vnrg_title', $v->{title};
-
- if(($self->reqHeader('Accept')||'') !~ /application\/xhtml\+xml/) {
- $self->htmlHeader(title => $title);
- $self->htmlMainTabs('v', $v, 'rg');
- div class => 'mainbox';
- h1 $title;
- div class => 'warning';
- h2 mt '_vnrg_notsupp';
- p mt '_vnrg_notsupp_msg';
- end;
- end;
- $self->htmlFooter;
- return;
- }
- $self->resHeader('Content-Type' => 'application/xhtml+xml; charset=UTF-8');
-
- # This is a REALLY ugly hack, need find a proper solution in YAWF
- no warnings 'redefine';
- my $sub = \&YAWF::XML::html;
- *YAWF::XML::html = sub () {
- lit q|<!DOCTYPE html PUBLIC
- "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
- "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">|;
- tag 'html',
- xmlns => "http://www.w3.org/1999/xhtml",
- 'xmlns:svg' => 'http://www.w3.org/2000/svg',
- 'xmlns:xlink' => 'http://www.w3.org/1999/xlink';
- };
- $self->htmlHeader(title => $title);
- *YAWF::XML::html = $sub;
+ return if $self->htmlRGHeader($title, 'v', $v);
$v->{svg} =~ s/\$___(_vnrel_[a-z]+)____\$/mt $1/eg;
- $self->htmlMainTabs('v', $v, 'rg');
div class => 'mainbox';
h1 $title;
p class => 'center';