Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[ljcom] r10995: LJSUP-9789 (create a widget and a templa...

Committer: ailyin
LJSUP-9789 (create a widget and a template for error pages)
A   trunk/cgi-bin/LJ/Widget/ErrorPage.pm
U   trunk/htdocs/error-page.bml
A   trunk/templates/ErrorPage.tmpl
Added: trunk/cgi-bin/LJ/Widget/ErrorPage.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/ErrorPage.pm	                        (rev 0)
+++ trunk/cgi-bin/LJ/Widget/ErrorPage.pm	2011-09-13 07:08:15 UTC (rev 10995)
@@ -0,0 +1,340 @@
+package LJ::Widget::ErrorPage;
+use strict;
+use warnings;
+
+my %links = (
+    'recent' => sub {
+        my %args    = @_;
+        my $journal = $args{'journal'};
+
+        return '' unless $journal && $journal->is_visible;
+
+        return LJ::Lang::ml( '.errorpage.recent_entries',
+            { 'aopts' => "href='" . $journal->journal_base . "'" },
+        );
+    },
+
+    'photos' => sub {
+        my %args    = @_;
+        my $journal = $args{'journal'};
+
+        return '' unless $journal && $journal->is_visible;
+
+        my $link = $journal->journal_base . '/pics/catalog';
+        return LJ::Lang::ml( '.errorpage.photo_catalog',
+            { 'aopts' => "href='$link'" },
+        );
+    },
+
+    'home' => sub {
+        return LJ::Lang::ml( '.errorpage.link.go_home',
+            { 'aopts' => "href='$LJ::SITEROOT'" },
+        );
+    },
+
+    'faq' => sub {
+        return LJ::Lang::ml(
+            '.errorpage.not_found.link.faq',
+            { 'aopts' => "href='$LJ::SITEROOT/support/faq.bml'" },
+        );
+    },
+
+    'sitemap' => sub {
+        return LJ::Lang::ml(
+            '.errorpage.not_found.link.site_map',
+            { 'aopts' => "href='$LJ::SITEROOT/site/'" },
+        );
+    },
+
+    'status' => sub {
+        return LJ::Lang::ml(
+            '.errorpage.not_found.link.lj_status',
+            { 'aopts' => "href='http://status.livejournal.org/'" },
+        );
+    },
+);
+
+## We can handle a few error types:
+##
+## e404         => Error 404
+## e500         => Error 500
+## baduser      => not exist journals
+## readonly     => read only
+## suspended    => suspended journals
+## suspended_post => suspended posts
+## deleted      => deleted journals
+## expunged     => expunged journals
+## forfriends   => only for friends
+## custom       => custom friends
+## private      => private (just me)
+## private_photo => private photo (just me)
+## members      => only for community members
+##
+my %handlers = (
+    '_default' => sub {
+        return {
+            'title'       => LJ::Lang::ml('.errorpage.unhandled.title'),
+            'description' => LJ::Lang::ml('.errorpage.unhandled.description'),
+            'links'       => [qw( home faq sitemap )],
+        };
+    },
+
+    'e404' => sub {
+        return {
+            'title'       => LJ::Lang::ml('.errorpage.not_found.title'),
+            'description' => LJ::Lang::ml('.errorpage.not_found.description'),
+            'links'       => [qw( recent home faq sitemap status )],
+            'ads_location' => 'error_page.not_found',
+        };
+    },
+
+    'baduser' => sub {
+        my %args             = @_;
+        my $journal_username = $args{'journal_username'};
+        my $ml_description   = LJ::Lang::ml(
+            '.errorpage.baduser.description',
+            { 'username' => $journal_username },
+        );
+
+        return {
+            'title'        => LJ::Lang::ml('.errorpage.baduser.title'),
+            'description'  => $ml_description,
+            'links'        => [qw( home faq sitemap )],
+            'ads_location' => 'error_page.baduser',
+        };
+    },
+
+    'suspended_post' => sub {
+        my %args             = @_;
+        my $journal_username = $args{'journal_username'};
+        my $ml_description   = LJ::Lang::ml(
+            '.errorpage.suspended_post.description.alien',
+            { 'username' => $journal_username },
+        );
+
+        return {
+            'frank_img'    => '/frank-suspend.png',
+            'title'        => LJ::Lang::ml('.errorpage.suspended_post.title'),
+            'description'  => $ml_description,
+            'links'        => [qw( recent home faq sitemap )],
+            'ads_location' => 'error_page.suspended',
+        };
+    },
+
+    'suspended' => sub {
+        my %args                  = @_;
+        my $journal_username      = $args{'journal_username'};
+        my $remote_equals_journal = $args{'remote_equals_journal'};
+
+        my $ml_description = '';
+        if ($remote_equals_journal) {
+            $ml_description = LJ::Lang::ml(
+                '.errorpage.suspended.description.owner',
+                { 'username' => $journal_username },
+            );
+        } else {
+            $ml_description = LJ::Lang::ml(
+                '.errorpage.suspended.description.alien',
+                { 'username' => $journal_username },
+            );
+        }
+
+        return {
+            'frank_img'    => '/frank-suspend.png',
+            'title'        => LJ::Lang::ml('.errorpage.suspended.title'),
+            'description'  => $ml_description,
+            'links'        => [qw( home faq sitemap )],
+            'ads_location' => 'error_page.suspended',
+        };
+    },
+
+    'deleted' => sub {
+        my %args                  = @_;
+        my $journal_username      = $args{'journal_username'};
+        my $remote_equals_journal = $args{'remote_equals_journal'};
+
+        my $ml_description = '';
+        if ($remote_equals_journal) {
+            $ml_description = LJ::Lang::ml(
+                '.errorpage.deleted.description.owner',
+                {
+                    'ndays' => $LJ::DAYS_BEFORE_EXPUNGE,
+                    'aopts' => "href='$LJ::SITEROOT/accountstatus.bml?"
+                        . "authas=$journal_username'",
+                },
+            );
+        } else {
+            $ml_description = LJ::Lang::ml(
+                '.errorpage.deleted.description.alien',
+                {
+                    'ndays' => $LJ::DAYS_BEFORE_EXPUNGE,
+                    'aopts' => "href='$LJ::SITEROOT/manage/subscriptions/"
+                        . "user.bml?journal=$journal_username'",
+                },
+            );
+        }
+
+        return {
+            'title'        => LJ::Lang::ml('.errorpage.deleted.title'),
+            'description'  => $ml_description,
+            'links'        => [qw( home faq sitemap )],
+            'ads_location' => 'error_page.deleted',
+        };
+    },
+
+    'expunged' => sub {
+        my %args             = @_;
+        my $journal_username = $args{'journal_username'};
+
+        my $ml_description = LJ::Lang::ml(
+            '.errorpage.expunged.description',
+            {
+                'username' => $journal_username,
+                'aopts'    => "href='$LJ::SITEROOT/shop/renameaccount.bml'",
+            }
+        );
+
+        return {
+            'title'        => LJ::Lang::ml('.errorpage.expunged.title'),
+            'description'  => $ml_description,
+            'links'        => [qw( home faq sitemap )],
+            'ads_location' => 'error_page.expunged',
+        };
+    },
+
+    'private_photo' => sub {
+        my %args             = @_;
+        my $journal_username = $args{'journal_username'};
+
+        my $ml_description = LJ::Lang::ml(
+            '.errorpage.private_photo.description',
+            { 'username' => $journal_username },
+        );
+
+        return {
+            'frank_img'    => '/frank-private.png',
+            'title'        => LJ::Lang::ml('.errorpage.private_photo.title'),
+            'description'  => $ml_description,
+            'links'        => [qw( photos home faq sitemap )],
+            'ads_location' => 'error_page.private',
+        };
+    },
+
+    'ljphoto_members' => sub {
+        my $ml_description = '';
+
+        my $ljphoto_comm = LJ::load_user($LJ::LJPHOTO_ALLOW_FROM_COMMUNITY);
+        if ($ljphoto_comm) {
+            $ml_description = LJ::Lang::ml(
+                '.errorpage.ljphoto_closed.description',
+                { 'ljphoto_comm' => $ljphoto_comm->ljuser_display },
+            );
+        }
+
+        return {
+            'frank_img'    => '/frank-private.png',
+            'title'        => LJ::Lang::ml('.errorpage.ljphoto_closed.title'),
+            'description'  => $ml_description,
+            'links'        => [qw( home faq sitemap )],
+            'ads_location' => 'error_page.private',
+        };
+    },
+
+    # this one has synonyms: forfriends, custom, members
+    'private' => sub {
+        my %args             = @_;
+        my $journal_username = $args{'journal_username'};
+
+        my $ml_description = LJ::Lang::ml(
+            '.errorpage.private.description',
+            { 'username' => $journal_username },
+        );
+
+        return {
+            'frank_img'    => '/frank-private.png',
+            'title'        => LJ::Lang::ml('.errorpage.private.title'),
+            'description'  => $ml_description,
+            'links'        => [qw( recent home faq sitemap )],
+            'ads_location' => 'error_page.private',
+        };
+    },
+
+    'discontinued' => sub {
+        return {
+            'title' => LJ::Lang::ml('.errorpage.discontinued.title'),
+            'description' =>
+                LJ::Lang::ml('.errorpage.discontinued.description'),
+            'links' => [qw( home faq sitemap )],
+        };
+    },
+
+);
+
+$handlers{$_} = $handlers{'private'} foreach qw( forfriends custom members );
+
+sub render {
+    my ( $class, %args ) = @_;
+
+    my $error_type              = $args{'error_type'};
+    my $uri                     = $args{'uri'};
+    my $remote                  = $args{'remote'};
+    my $active_journal_username = $args{'active_journal_username'};
+
+    my $journal;
+    if ( $active_journal_username ne '' ) {
+        $journal = LJ::load_user($active_journal_username);
+    }
+
+    my $handler = $handlers{$error_type} || $handlers{'_default'};
+    my %handler_args = (
+        'journal'               => $journal,
+        'journal_username'      => $active_journal_username,
+        'remote_equals_journal' => LJ::u_equals( $remote, $journal ),
+    );
+
+    my $data = $handler->(%handler_args);
+
+    my $template = LJ::HTML::Template->new(
+        { use_expr => 1 },    # force HTML::Template::Pro with Expr support
+        filename => 'templates/ErrorPage.tmpl',
+    );
+
+    my $ad_html = '';
+    if ( my $location = $data->{'ads_location'} ) {
+        $ad_html = LJ::get_ads(
+            {
+                'location' => $location,
+                'journalu' => $remote,
+            }
+        );
+    }
+
+    my @links_display;
+    foreach my $link ( @{ $data->{'links'} || [] } ) {
+        my $link_html = $links{$link}->(%handler_args);
+
+        next if $link_html eq '';
+        push @links_display, { 'link' => $link_html };
+    }
+
+    my $pagestats_obj  = LJ::pagestats_obj();
+    my $pagestats_html = $pagestats_obj->render(
+        {
+            'error_url'  => $uri,
+            'error_type' => $error_type,
+        }
+    );
+
+    $template->param(
+        'title'       => $data->{'title'}       || '',
+        'frank_img'   => $data->{'frank_img'}   || '/frank-404.png',
+        'description' => $data->{'description'} || '',
+        'ad_html'     => $ad_html,
+        'links'       => \@links_display,
+        'pagestats_html' => $pagestats_html,
+    );
+
+    return $template->output;
+}
+
+1;

Modified: trunk/htdocs/error-page.bml
===================================================================
--- trunk/htdocs/error-page.bml	2011-09-13 06:45:07 UTC (rev 10994)
+++ trunk/htdocs/error-page.bml	2011-09-13 07:08:15 UTC (rev 10995)
@@ -2,24 +2,8 @@
 
 use strict;
 
-use vars qw/%GET/;
+use LJ::Widget::ErrorPage;
 
-## We are handle a few error types:
-##
-## e404         => Error 404
-## e500         => Error 500
-## baduser      => not exist journals
-## readonly     => read only
-## suspended    => suspended journals
-## suspended_post => suspended posts
-## deleted      => deleted journals
-## expunged     => expunged journals
-## forfriends   => only for friends
-## custom       => custom friends
-## private      => private (just me)
-## private_photo => private photo (just me)
-## members      => only for community members
-
 BML::set_language_scope('/error-page.bml');
 
 my $main_req = LJ::Request->prev();
@@ -65,182 +49,11 @@
     $remote = $remoteid ? LJ::load_userid($remoteid) : undef;
 }
 
-if ($error_type eq 'e404') {
-    $frank_img = "/frank-404.png";
-    $title = LJ::Lang::ml('.errorpage.not_found.title');
-    $description = LJ::Lang::ml('.errorpage.not_found.description');
-    $user = LJ::load_user ($user);
-    push @links, LJ::Lang::ml('.errorpage.recent_entries', { aopts => "href='".$user->journal_base."'" } ) if $user && $user->statusvis eq 'V';
-    push @links, LJ::Lang::ml('.errorpage.link.go_home',   { aopts => "href='$LJ::SITEROOT'" });
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.faq',       { aopts => "href='$LJ::SITEROOT/support/faq.bml'" });
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.site_map',  { aopts => "href='$LJ::SITEROOT/site/'" });
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.lj_status', { aopts => "href='http://status.livejournal.org/'" });
-    $ad_html = LJ::get_ads( { location => 'error_page.not_found', journalu => $remote } );
-} elsif ($error_type eq 'baduser') {
-    $frank_img = "/frank-404.png";
-    $title = LJ::Lang::ml('.errorpage.baduser.title');
-    $description = LJ::Lang::ml('.errorpage.baduser.description', { username => $user } );
-    push @links, LJ::Lang::ml('.errorpage.link.go_home',   { aopts => "href='$LJ::SITEROOT'" });
-    push @links, LJ::Lang::ml('.errorpage.baduser.link.faq', { aopts => "href='$LJ::SITEROOT/support/faq.bml'" });
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.site_map',  { aopts => "href='$LJ::SITEROOT/site/'" });
-    $ad_html = LJ::get_ads( { location => 'error_page.baduser', journalu => $remote } );
-} elsif ($error_type eq 'suspended_post') {
-    $frank_img = "/frank-suspend.png";
-    $title = LJ::Lang::ml('.errorpage.suspended_post.title');
-    $description = LJ::Lang::ml('.errorpage.suspended_post.description.alien', { username => $user } );
-    $user = LJ::load_user ($user);
-    push @links, LJ::Lang::ml('.errorpage.recent_entries', { aopts => "href='".$user->journal_base."'" } ) if $user && $user->statusvis eq 'V';
-    push @links, LJ::Lang::ml('.errorpage.link.go_home',   { aopts => "href='$LJ::SITEROOT'" });
-    push @links, LJ::Lang::ml('.errorpage.suspend_post.link.faq', { aopts => "href='$LJ::SITEROOT/support/faqbrowse.bml?faqid=106'" });
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.site_map',  { aopts => "href='$LJ::SITEROOT/site/'" });
-    $ad_html = LJ::get_ads( { location => 'error_page.suspended', journalu => $remote } );
-} elsif ($error_type eq 'suspended') {
-    $frank_img = "/frank-suspend.png";
-    $title = LJ::Lang::ml('.errorpage.suspended.title');
-    $user = LJ::load_user ($user);
-    $description = LJ::u_equals($remote, $user)
-                    ? LJ::Lang::ml('.errorpage.suspended.description.owner', { username => $user } )
-                    : LJ::Lang::ml('.errorpage.suspended.description.alien', { username => $user } );
-    push @links, LJ::Lang::ml('.errorpage.link.go_home',   { aopts => "href='$LJ::SITEROOT'" });
-    push @links, LJ::Lang::ml('.errorpage.suspend.link.faq', { aopts => "href='$LJ::SITEROOT/support/faqbrowse.bml?faqid=106'" });
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.site_map',  { aopts => "href='$LJ::SITEROOT/site/'" });
-    $ad_html = LJ::get_ads( { location => 'error_page.suspended', journalu => $remote } );
-} elsif ($error_type eq 'deleted') {
-    $frank_img = "/frank-404.png";
-    $title = LJ::Lang::ml('.errorpage.deleted.title');
-    $user = LJ::load_user ($user);
-    $description = LJ::u_equals($remote, $user)
-                    ? LJ::Lang::ml('.errorpage.deleted.description.owner', { ndays => $LJ::DAYS_BEFORE_EXPUNGE, aopts => "href='$LJ::SITEROOT/accountstatus.bml?authas=$user->{user}'"} )
-                    : LJ::Lang::ml('.errorpage.deleted.description.alien', { ndays => $LJ::DAYS_BEFORE_EXPUNGE, aopts => "href='$LJ::SITEROOT/manage/subscriptions/user.bml?journal=$user->{user}'" } );
-    push @links, LJ::Lang::ml('.errorpage.link.go_home',   { aopts => "href='$LJ::SITEROOT'" });
-    push @links, LJ::Lang::ml('.errorpage.deleted.link.faq', { aopts => "href='$LJ::SITEROOT/support/faqbrowse.bml?faqid=16'" });
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.site_map',  { aopts => "href='$LJ::SITEROOT/site/'" });
-    $ad_html = LJ::get_ads( { location => 'error_page.deleted', journalu => $remote } );
-} elsif ($error_type eq 'expunged') {
-    $frank_img = "/frank-404.png";
-    $title = LJ::Lang::ml('.errorpage.expunged.title');
-    $description = LJ::Lang::ml('.errorpage.expunged.description', { username => $user, aopts => "href='$LJ::SITEROOT/shop/renameaccount.bml'" } );
-    push @links, LJ::Lang::ml('.errorpage.link.go_home',   { aopts => "href='$LJ::SITEROOT'" });
-    push @links, LJ::Lang::ml('.errorpage.expunged.link.faq', { aopts => "href='$LJ::SITEROOT/support/faqbrowse.bml?faqid=16'" });
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.site_map',  { aopts => "href='$LJ::SITEROOT/site/'" });
-    $ad_html = LJ::get_ads( { location => 'error_page.expunged', journalu => $remote } );
-} elsif ($error_type =~ /private_photo/) {
-    $frank_img = "/frank-private.png";
-    $title = LJ::Lang::ml('.errorpage.private_photo.title');
-    $description = LJ::Lang::ml('.errorpage.private_photo.description', { username => $user } );
-    $user = LJ::load_user ($user);
-    push @links, LJ::Lang::ml('.errorpage.photo_catalog', { aopts => "href='".$user->journal_base."/pics/catalog'" } ) if $user && $user->statusvis eq 'V';
-    push @links, LJ::Lang::ml('.errorpage.link.go_home',   { aopts => "href='$LJ::SITEROOT'" });
-    push @links, LJ::Lang::ml('.errorpage.private.link.faq', { aopts => "href='$LJ::SITEROOT/support/faqbrowse.bml?faqid=24'" });
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.site_map',  { aopts => "href='$LJ::SITEROOT/site/'" });
-    $ad_html = LJ::get_ads( { location => 'error_page.private', journalu => $remote } );
-} elsif ($error_type =~ /ljphoto_members/) {
-    $frank_img = "/frank-private.png";
-    $title = LJ::Lang::ml('.errorpage.ljphoto_closed.title');
-    my $ljphoto_comm = LJ::load_user($LJ::LJPHOTO_ALLOW_FROM_COMMUNITY);
-    $description = LJ::Lang::ml('.errorpage.ljphoto_closed.description', { ljphoto_comm => $ljphoto_comm->ljuser_display } );
-    $user = LJ::load_user ($user);
-    #push @links, LJ::Lang::ml('.errorpage.recent_entries', { aopts => "href='".$user->journal_base."'" } ) if $user && $user->statusvis eq 'V';
-    push @links, LJ::Lang::ml('.errorpage.link.go_home',   { aopts => "href='$LJ::SITEROOT'" });
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.faq', { aopts => "href='$LJ::SITEROOT/support/faq.bml'" });
-    #push @links, LJ::Lang::ml('.errorpage.private.link.lastentries', { aopts => "href='".$user->journal_base."'" }) if $user;
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.site_map',  { aopts => "href='$LJ::SITEROOT/site/'" });
-    $ad_html = LJ::get_ads( { location => 'error_page.private', journalu => $remote } );
-} elsif ($error_type =~ /forfriends|custom|private|members/) {
-    $frank_img = "/frank-private.png";
-    $title = LJ::Lang::ml('.errorpage.private.title');
-    $description = LJ::Lang::ml('.errorpage.private.description', { username => $user } );
-    $user = LJ::load_user ($user);
-    push @links, LJ::Lang::ml('.errorpage.recent_entries', { aopts => "href='".$user->journal_base."'" } ) if $user && $user->statusvis eq 'V';
-    push @links, LJ::Lang::ml('.errorpage.link.go_home',   { aopts => "href='$LJ::SITEROOT'" });
-    push @links, LJ::Lang::ml('.errorpage.private.link.faq', { aopts => "href='$LJ::SITEROOT/support/faqbrowse.bml?faqid=24'" });
-    #push @links, LJ::Lang::ml('.errorpage.private.link.lastentries', { aopts => "href='".$user->journal_base."'" }) if $user;
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.site_map',  { aopts => "href='$LJ::SITEROOT/site/'" });
-    $ad_html = LJ::get_ads( { location => 'error_page.private', journalu => $remote } );
-} elsif ( $error_type eq 'discontinued' ) {
-    $frank_img = "/frank-404.png";
-    $title = LJ::Lang::ml('.errorpage.discontinued.title');
-    $description = LJ::Lang::ml('.errorpage.discontinued.description');
-    push @links, LJ::Lang::ml('.errorpage.link.go_home',   { aopts => "href='$LJ::SITEROOT'" });
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.faq', { aopts => "href='$LJ::SITEROOT/support/faq.bml'" });
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.site_map',  { aopts => "href='$LJ::SITEROOT/site/'" });
-} else {
-    $frank_img = "/frank-404.png";
-    $title = LJ::Lang::ml('.errorpage.unhandled.title');
-    $description = LJ::Lang::ml('.errorpage.unhandled.description');
-    push @links, LJ::Lang::ml('.errorpage.link.go_home',   { aopts => "href='$LJ::SITEROOT'" });
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.faq', { aopts => "href='$LJ::SITEROOT/support/faq.bml'" });
-    push @links, LJ::Lang::ml('.errorpage.not_found.link.site_map',  { aopts => "href='$LJ::SITEROOT/site/'" });
-}
+return LJ::Widget::ErrorPage->render(
+    'error_type' => $error_type,
+    'uri' => $main_req->uri,
+    'remote' => $remote,
+    'active_journal_username' => $user,
+);
 
-$title .= $LJ::SERVER_SIGNATURE_TITLE if $LJ::SERVER_SIGNATURE_TITLE;
-
-$ret .= qq|
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-<head>
-	<title>$title</title>
-	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9" />
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-	<link href="$LJ::STATPREFIX/framework/error-pages.css" rel="stylesheet" type="text/css" />
-	<!--[if lte IE 7]><link rel="stylesheet" href="$LJ::STATPREFIX/framework/error-pages-ie.css"><![endif]-->
-</head>
-    <body class="error-page"><div class="header">
-        <img src="$LJ::IMGPREFIX/error-pages$frank_img" width="250" height="260" alt="" class="pic" />|;
-
-$ret .= "<div class=\"desc\">
-		<h1>$title</h1>
-		<p>$description</p>";
-
-$ret .= qq|
-	</div>
-	<div class="adv-block">
-		$ad_html
-	</div>
-</div>
-<div class="content">
-	<div class="article">
-		<p><strong>$links_title</strong></p>
-		<ul>
-|;
-
-foreach (@links) {
-    $ret .= "<li>".$_."</li>";
-}
-
-$ret .= "</ul>";
-$ret .= qq|
-	</div>
-	<div class="searchbar">
-		<h3><a href="http://www.livejournal.com">LiveJournal</a></h3>
-		<form action="http://www.livejournal.com/search/" method="get" id="search_form_basic" class="form-on">
-			<fieldset>
-				<div class="type-text">
-					<input id="basic_query" name="q" type="search" value="" />
-				</div>
-				<div class="type-submit">
-					<input type="submit" value="|.LJ::Lang::ml('.errorpage.advanced_search.button').qq|" />
-				</div>
-			</fieldset>
-			<ul class="helper">
-				<li><a href="http://www.livejournal.com/search/?area=advanced">|.LJ::Lang::ml('.errorpage.advanced_search.label').qq|</a></li>
-			</ul>
-		</form>
-	</div>
-</div>
-
-|;
-
-my $pagestats_obj = LJ::pagestats_obj();
-$ret .= $pagestats_obj->render( { error_url => $main_req->uri, error_type => $error_type } );
-
-$ret .= qq|
-
-</body>
-</html>
-|;
-
-return $ret;
-
 _code?>
-

Added: trunk/templates/ErrorPage.tmpl
===================================================================
--- trunk/templates/ErrorPage.tmpl	                        (rev 0)
+++ trunk/templates/ErrorPage.tmpl	2011-09-13 07:08:15 UTC (rev 10995)
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+	<title><TMPL_VAR title></title>
+	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9" />
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<link href="<TMPL_VAR lj_statprefix>/framework/error-pages.css" rel="stylesheet" type="text/css" />
+	<!--[if lte IE 7]><link rel="stylesheet" href="<TMPL_VAR lj_statprefix>/framework/error-pages-ie.css"><![endif]-->
+</head>
+<body class="error-page">
+
+<div class="header">
+    <img src="<TMPL_VAR lj_imgprefix>/error-pages<TMPL_VAR frank_img>" width="250" height="260" alt="" class="pic" />
+    <div class="desc">
+		<h1><TMPL_VAR title></h1>
+		<p><TMPL_VAR description></p>
+	</div>
+	<div class="adv-block">
+		<TMPL_VAR ad_html>
+	</div>
+</div>
+
+<div class="content">
+	<div class="article">
+		<p><strong><TMPL_VAR expr="ml('.errorpage.links')"></strong></p>
+		<ul>
+            <TMPL_LOOP links>
+                <li><TMPL_VAR link></li>
+            </TMPL_LOOP>
+        </ul>
+	</div>
+	<div class="searchbar">
+		<h3><a href="http://www.livejournal.com">LiveJournal</a></h3>
+		<form action="http://www.livejournal.com/search/" method="get" id="search_form_basic" class="form-on">
+			<fieldset>
+				<div class="type-text">
+					<input id="basic_query" name="q" type="search" value="" />
+				</div>
+				<div class="type-submit">
+					<input type="submit" value="<TMPL_VAR expr="ml('.errorpage.advanced_search.button')">" />
+				</div>
+			</fieldset>
+			<ul class="helper">
+				<li><a href="http://www.livejournal.com/search/?area=advanced"><TMPL_VAR expr="ml('.errorpage.advanced_search.label')"></a></li>
+			</ul>
+		</form>
+	</div>
+</div>
+
+<TMPL_VAR pagestats_html>
+
+</body>
+</html>

Tags: andy, bml, ljcom, pm, tmpl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments