]> iEval git - gruntmaster-page.git/blobdiff - lib/Gruntmaster/Page/Base.pm
Add register and passwd actions
[gruntmaster-page.git] / lib / Gruntmaster / Page / Base.pm
index 80fa027d5b2651249c504405476b182ab2ac57d2..bc8e9cec1b176e81c63a37cb903cbf880fdd6206 100644 (file)
@@ -27,8 +27,10 @@ sub import {
        *{"${caller}::TITLE"} = sub () { $title };
        *{"${caller}::debug"} = sub {
                local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1;
-               $_[0]->({qw/level debug message/ => $_[1]})
+               $_[0]->{'psgix.logger'}->({qw/level debug message/ => $_[1]})
        };
+       *{"${caller}::reply"} = sub { [200, ['Content-Type' => 'text/plain'], [ @_ ] ] }
+
 }
 
 ##################################################
@@ -52,7 +54,7 @@ my %orig_header_templates = (
 
 <div class="collapse navbar-collapse">
 <ul class="nav navbar-nav">
-<li><a href="/pb/">Problem list</a>
+<li><a href="/pb/">Problems</a>
 <li><a href="/ct/">Contests</a>
 <li><a href="/account">Account</a>
 </ul>
@@ -76,7 +78,7 @@ my %orig_header_templates = (
 <div class="container-fluid">
 
 <div id="subtitle">TITLE_GOES_HERE</div>
-
+<div id="result"></div>
 HTML
 );
 
@@ -92,7 +94,8 @@ HTML
 );
 
 sub patch_templates {
-       my $root = $ENV{GRUNTMASTER_TEMPLATE_ROOT} or return %{$_[0]};
+       my $root = 'tmpl';
+       return %{$_[0]} unless -d $root;
        my ($templates, $name) = @_;
        my %out = %$templates;
        for (<$root/$name.*>) {
@@ -103,19 +106,15 @@ sub patch_templates {
        %out
 }
 
-sub reload_templates (){ $ENV{GRUNTMASTER_RELOAD_TEMPLATES} }
-
 my %header_templates = patch_templates \%orig_header_templates, 'header';
 my %footer_templates = patch_templates \%orig_footer_templates, 'footer';
 
 sub header{
   my ($language, $title) = @_;
-  %header_templates = patch_templates \%orig_header_templates, 'header' if reload_templates;
   $header_templates{$language} =~ s/TITLE_GOES_HERE/$title/ger;
 }
 
 sub footer{
-  %footer_templates = patch_templates \%orig_footer_templates, 'footer' if reload_templates;
   $footer_templates{$_[0]};
 }
 
@@ -136,7 +135,7 @@ my %templates;
 sub generate{
        my ($self, $lang, @args) = @_;
 
-       $templates{$self} = { cook_templates $self->TEMPLATES, $self->NAME => $self->TITLE } if !exists $templates{$self} or reload_templates;
+       $templates{$self} = { cook_templates $self->TEMPLATES, $self->NAME => $self->TITLE } unless exists $templates{$self};
 
        my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$self}{$lang}, default_escape => 'HTML',);
        $self->_generate($htc, $lang, @args);
This page took 0.025607 seconds and 4 git commands to generate.