diff options
Diffstat (limited to 'lib/VNDB/Util/CommonHTML.pm')
-rw-r--r-- | lib/VNDB/Util/CommonHTML.pm | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm index 3d032d37..ad99d32d 100644 --- a/lib/VNDB/Util/CommonHTML.pm +++ b/lib/VNDB/Util/CommonHTML.pm @@ -12,7 +12,7 @@ use POSIX 'ceil'; our @EXPORT = qw| htmlMainTabs htmlDenied htmlHiddenMessage htmlBrowse htmlBrowseNavigate - htmlRevision htmlEditMessage htmlItemMessage htmlVoteStats htmlHistory htmlSearchBox + htmlRevision htmlEditMessage htmlItemMessage htmlVoteStats htmlHistory htmlSearchBox htmlRGHeader |; @@ -101,7 +101,7 @@ sub htmlMainTabs { end; } - if($type eq 'v' && $obj->{rgraph}) { + if($type =~ /[vp]/ && $obj->{rgraph}) { li $sel eq 'rg' ? (class => 'tabselected') : (); a href => "/$id/rg", mt '_mtabs_relations'; end; @@ -558,5 +558,41 @@ sub htmlSearchBox { } +sub htmlRGHeader { + my($self, $title, $type, $obj) = @_; + + if(($self->reqHeader('Accept')||'') !~ /application\/xhtml\+xml/) { + $self->htmlHeader(title => $title); + $self->htmlMainTabs($type, $obj, 'rg'); + div class => 'mainbox'; + h1 $title; + div class => 'warning'; + h2 mt '_rg_notsupp'; + p mt '_rg_notsupp_msg'; + end; + end; + $self->htmlFooter; + return 1; + } + $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; + $self->htmlMainTabs($type, $obj, 'rg'); + return 0; +} + 1; |