summaryrefslogtreecommitdiff
path: root/lib/VNDB/Util/LayoutHTML.pm
blob: a9e0c05f63b2198b0a2a4490ab43a7f9cf16d6e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

package VNDB::Util::LayoutHTML;

use strict;
use warnings;
use TUWF ':html';
use VNDB::Config;
use VNWeb::HTML;
use Exporter 'import';

our @EXPORT = qw|htmlHeader htmlFooter|;

sub htmlHeader { # %options->{ title, noindex, search, feeds, metadata }
  my($self, %o) = @_;
  %VNWeb::HTML::pagevars = ();

  $o{og} = $o{metadata} ? +{ map +(s/og://r, $o{metadata}{$_}), keys $o{metadata}->%* } : undef;
  $o{index} = !$o{noindex};

  html lang => 'en';
   head sub { VNWeb::HTML::_head_(\%o) };
   body;
    div id => 'bgright', ' ';
    div id => 'header', sub { h1 sub { a href => '/', 'the visual novel database' } };
    div id => 'menulist', sub { VNWeb::HTML::_menu_(\%o) };
    div id => 'maincontent';
}


sub htmlFooter { # %options => { pref_code => 1 }
  my($self, %o) = @_;
     div id => 'footer', sub { VNWeb::HTML::_footer_ };
    end 'div'; # maincontent

    # Abuse an empty noscript tag for the formcode to update a preference setting, if the page requires one.
    noscript id => 'pref_code', title => $self->authGetCode('/xml/prefs.xml'), ''
      if $o{pref_code} && $self->authInfo->{id};
    script type => 'text/javascript', src => config->{url_static}.'/g/vndb.js?'.config->{version}, '';
    VNWeb::HTML::_scripts_({});
   end 'body';
  end 'html';
}

1;