summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-09-25 20:16:47 +0200
committerYorhel <git@yorhel.nl>2009-09-25 20:16:47 +0200
commit836eb84c9be9197b5ca842a755051f4230df7600 (patch)
tree5168af34e39d84f608df788ba8ca9d524a67c057 /lib
parentce6687f3766fdeca78cad90d3e461ed889ed37d6 (diff)
Handler::VNPage: Added simple browser detection for XHTML
If a browser does support the application/xhtml+xml mime, let's assume it also supports SVG (to my knowledge, this is the case in any recent browser). OTOH, browsers not supporting that mime type are sure to not support SVG, either.
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Handler/VNPage.pm16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index 5e0fc9dc..f31b3eeb 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -23,12 +23,24 @@ sub rand {
sub rg {
my($self, $vid) = @_;
- # TODO: browser detection + notice, this trick gives some ugly results in IE
-
my $v = $self->dbVNGet(id => $vid, what => 'relgraph')->[0];
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');
# This is a REALLY ugly hack, need find a proper solution in YAWF