fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-01-31 11:32 am

[dw-free] Add ability for Template Toolkit site-schemes to DW::Template

[commit: http://hg.dwscoalition.org/dw-free/rev/c79d1dcc92a6]

http://bugs.dwscoalition.org/show_bug.cgi?id=2304

Move site skins to use Template Toolkit instead of BML as part of a push for
cleaner code. Adds a TT plugin module to be used by site skins, and adds an
ssl.imgroot constant for .tt. There shouldn't be any user-visible changes.

Patch by [personal profile] exor674.

Files modified:
  • cgi-bin/DW/SiteScheme.pm
  • cgi-bin/DW/Template.pm
  • cgi-bin/DW/Template/Plugin.pm
  • cgi-bin/DW/Template/Plugin/SiteScheme.pm
  • cgi-bin/LJ/Setting/SiteScheme.pm
  • cgi-bin/bml/scheme/blueshift.look
  • cgi-bin/bml/scheme/celerity.look
  • cgi-bin/bml/scheme/common.look
  • cgi-bin/bml/scheme/gradation-horizontal.look
  • cgi-bin/bml/scheme/gradation-vertical.look
  • cgi-bin/bml/scheme/lynx.look
  • cgi-bin/bml/scheme/tt_runner.look
  • schemes/_init.tt
  • schemes/blueshift.tt
  • schemes/celerity.tt
  • schemes/common.tt
  • schemes/global.tt
  • schemes/gradation-horizontal.tt
  • schemes/gradation-vertical.tt
  • schemes/lynx.tt
  • views/login.tt
--------------------------------------------------------------------------------
diff -r 744f97686e08 -r c79d1dcc92a6 cgi-bin/DW/SiteScheme.pm
--- a/cgi-bin/DW/SiteScheme.pm	Mon Jan 31 19:17:57 2011 +0800
+++ b/cgi-bin/DW/SiteScheme.pm	Mon Jan 31 19:32:26 2011 +0800
@@ -32,11 +32,66 @@ our %sitescheme_data = (
     'gradation-horizontal' => { parent => 'common', title => "Gradation Horizontal" },
     'gradation-vertical' => { parent => 'common', title => "Gradation Vertical" },
     lynx => { parent => 'common', title => "Lynx (light mode)" },
+    global => { engine => 'bml' },
+    tt_runner => { engine => 'bml', internal => 1 },
 );
 
 my $data_loaded = 0;
 
 our @sitescheme_order = ();
+
+sub get {
+    my ( $class, $scheme ) = @_;
+    $scheme ||= $class->current;
+
+    $scheme = $sitescheme_order[0] unless exists $sitescheme_data{$scheme};
+
+    return $class->new($scheme);
+}
+
+# should not be called directly
+sub new {
+    my ( $class, $scheme ) = @_;
+
+    return bless { scheme => $scheme }, $class;
+}
+
+sub tt_file {
+    return $_[0]->{scheme} . '.tt';
+}
+
+sub engine {
+    return $sitescheme_data{$_[0]->{scheme}}->{engine} || 'tt';
+}
+
+=head2 C<< DW::SiteScheme->inheritance( $scheme ) >>
+
+Scheme defaults to the current sitescheme.
+
+Returns the inheritance array, with the provided scheme being at the start of the list.
+
+Also works on a DW::SiteScheme object
+
+=cut
+
+sub inheritance {
+    my ( $self, $scheme ) = @_;
+    DW::SiteScheme->__load_data;
+
+    $scheme = $self->{scheme} if ref $self;
+
+    $scheme ||= $self->current;
+    my @scheme;
+    push @scheme, $scheme;
+    push @scheme, $scheme while ( $scheme = $sitescheme_data{$scheme}->{parent} );
+    return @scheme;
+}
+
+sub get_vars {
+    return {
+        remote => LJ::get_remote()
+    };
+}
 
 sub __load_data {
     return if $data_loaded;
@@ -118,24 +173,4 @@ sub current {
         'global';
 }
 
-=head2 C<< DW::SiteScheme->inheritance( $scheme ) >>
-
-Scheme defaults to the current sitescheme.
-
-Returns the inheritance array, with the provided scheme being at the start of the list.
-
-=cut
-
-sub inheritance {
-    my ( $self, $scheme ) = @_;
-    $self->__load_data;
-
-    $scheme ||= $self->current;
-
-    my @scheme;
-    push @scheme, $scheme;
-    push @scheme, $scheme while ( $scheme = $sitescheme_data{$scheme}->{parent} );
-    return @scheme;
-}
-
 1;
diff -r 744f97686e08 -r c79d1dcc92a6 cgi-bin/DW/Template.pm
--- a/cgi-bin/DW/Template.pm	Mon Jan 31 19:17:57 2011 +0800
+++ b/cgi-bin/DW/Template.pm	Mon Jan 31 19:32:26 2011 +0800
@@ -7,7 +7,7 @@
 # Authors:
 #      Andrea Nall <anall@andreanall.com>
 #
-# Copyright (c) 2009-2010 by Dreamwidth Studios, LLC.
+# Copyright (c) 2009-2011 by Dreamwidth Studios, LLC.
 #
 # This program is free software; you may redistribute it and/or modify it under
 # the same terms as Perl itself.  For a copy of the license, please reference
@@ -47,7 +47,10 @@ my $site_constants = Template::Namespace
 
     root    => $LJ::SITEROOT,
     imgroot => $LJ::IMGPREFIX,
-    sslroot => $LJ::SSLROOT,
+    ssl => {
+        root => $LJ::SSLROOT,
+        imgroot => $LJ::SSLIMGPREFIX,
+    },
 
     help => \%LJ::HELPURL,
 
@@ -73,6 +76,19 @@ my $view_engine = Template->new({
         dw => 'DW::Template::Plugin',
     },
     PRE_PROCESS => '_init.tt',
+});
+
+my $scheme_engine = Template->new({
+    INCLUDE_PATH => "$LJ::HOME/schemes/",
+    NAMESPACE => {
+        site => $site_constants,
+    },
+    CACHE_SIZE => $LJ::TEMPLATE_CACHE_SIZE, # this can be undef, and that means cache everything.
+    STAT_TTL => $LJ::IS_DEV_SERVER ? 1 : 3600,
+    PLUGINS => {
+        dw => 'DW::Template::Plugin',
+        dw_scheme => 'DW::Template::Plugin::SiteScheme'
+    },
 });
 
 =head1 API
@@ -228,8 +244,15 @@ sub render_string {
     $r->status( $extra->{status} ) if $extra->{status};
     $r->content_type( $extra->{content_type} ) if $extra->{content_type};
 
+    my $scheme = DW::SiteScheme->get;
+
     if ( $extra->{no_sitescheme} ) {
         $r->print( $out );
+
+        return $r->OK;
+    } elsif ( $scheme->engine eq 'tt' ) {
+        $r->content_type("text/html; charset=utf-8");
+        $r->print( $class->render_scheme( $scheme, $out, $extra ) );
 
         return $r->OK;
     } else {
@@ -238,6 +261,39 @@ sub render_string {
 
         return $r->call_bml("$LJ::HOME/htdocs/misc/render_sitescheme.bml");
     }
+}
+
+=head2 C<< $class->render_scheme( $sitescheme, $body, $sections ) >>
+
+Render the body and sections in a TT sitescheme
+
+=over
+
+=item B< sitescheme >
+
+A DW::SiteScheme object
+
+=back
+
+=cut
+
+sub render_scheme {
+    my ( $class, $scheme, $body, $sections ) = @_;
+    my $r = DW::Request->get;
+
+    my $out;
+
+    my $opts = $scheme->get_vars;
+    $opts->{sections} = $sections;
+    $opts->{inheritance} = [ map { "$_.tt" } reverse $scheme->inheritance ];
+    $opts->{content} = $body;
+    $opts->{is_ssl} = $LJ::IS_SSL;
+    $opts->{get} = $r->get_args;
+
+    $scheme_engine->process( "_init.tt", $opts, \$out )
+        or die Template->error();
+
+    return $out;
 }
 
 =head1 AUTHOR
@@ -250,7 +306,7 @@ sub render_string {
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright (c) 2009-2010 by Dreamwidth Studios, LLC.
+Copyright (c) 2009-2011 by Dreamwidth Studios, LLC.
 
 This program is free software; you may redistribute it and/or modify it under
 the same terms as Perl itself. For a copy of the license, please reference
diff -r 744f97686e08 -r c79d1dcc92a6 cgi-bin/DW/Template/Plugin.pm
--- a/cgi-bin/DW/Template/Plugin.pm	Mon Jan 31 19:17:57 2011 +0800
+++ b/cgi-bin/DW/Template/Plugin.pm	Mon Jan 31 19:32:26 2011 +0800
@@ -7,7 +7,7 @@
 # Authors:
 #      Andrea Nall <anall@andreanall.com>
 #
-# Copyright (c) 2010 by Dreamwidth Studios, LLC.
+# Copyright (c) 2010-2011 by Dreamwidth Studios, LLC.
 #
 # This program is free software; you may redistribute it and/or modify it under
 # the same terms as Perl itself.  For a copy of the license, please reference
@@ -117,6 +117,11 @@ sub create_url {
     return LJ::create_url( $_[1], %{ $_[2] || {} } );
 }
 
+
+sub img {
+    my $self = shift;
+    return LJ::img(@_);
+}
 =head1 AUTHOR
 
 =over
diff -r 744f97686e08 -r c79d1dcc92a6 cgi-bin/DW/Template/Plugin/SiteScheme.pm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cgi-bin/DW/Template/Plugin/SiteScheme.pm	Mon Jan 31 19:32:26 2011 +0800
@@ -0,0 +1,101 @@
+#!/usr/bin/perl
+#
+# DW::Template::Plugin::SiteScheme
+#
+# Template Toolkit plugin for Dreamwidth siteschemes
+#
+# Authors:
+#      Andrea Nall <anall@andreanall.com>
+#
+# Copyright (c) 2011 by Dreamwidth Studios, LLC.
+#
+# This program is free software; you may redistribute it and/or modify it under
+# the same terms as Perl itself.  For a copy of the license, please reference
+# 'perldoc perlartistic' or 'perldoc perlgpl'.
+#
+package DW::Template::Plugin::SiteScheme;
+use base 'Template::Plugin';
+use strict;
+use DW::Logic::MenuNav;
+
+=head1 NAME
+
+DW::Template::Plugin - Template Toolkit plugin for Dreamwidth
+
+=head1 SYNOPSIS
+
+=cut
+
+sub load {
+    return $_[0];
+}
+
+sub new {
+    my ( $class, $context, @params ) = @_;
+
+    my $self = bless {
+        _CONTEXT => $context,
+    }, $class;
+
+    return $self;
+}
+
+=head1 METHODS
+
+=cut
+
+sub need_res {
+    my $self = shift;
+
+    my $hash_arg = {};
+    $hash_arg = shift @_ if ref $_[0] eq 'HASH';
+    $hash_arg->{priority} = $LJ::SCHEME_RES_PRIORITY;
+
+    my @args = @_;
+    @args = @{$args[0]} if ref $_[0] eq 'ARRAY';
+    
+    return LJ::need_res($hash_arg,@args);
+}
+
+sub res_includes {
+    return LJ::res_includes();
+}
+
+sub final_body_html {
+    return LJ::final_body_html();
+}
+
+sub menu_nav {
+    return DW::Logic::MenuNav->get_menu_navigation;
+}
+
+sub search_render {
+    return LJ::Widget::Search->render;
+}
+
+sub challenge_generate {
+    my $self = shift;
+    return LJ::challenge_generate(@_);
+}
+
+=head1 AUTHOR
+
+=over
+
+=item Andrea Nall <anall@andreanall.com>
+
+=item Mark Smith <mark@dreamwidth.org>
+
+=back
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (c) 2011 by Dreamwidth Studios, LLC.
+
+This program is free software; you may redistribute it and/or modify it under
+the same terms as Perl itself. For a copy of the license, please reference
+'perldoc perlartistic' or 'perldoc perlgpl'.
+
+=cut
+
+1;
diff -r 744f97686e08 -r c79d1dcc92a6 cgi-bin/LJ/Setting/SiteScheme.pm
--- a/cgi-bin/LJ/Setting/SiteScheme.pm	Mon Jan 31 19:17:57 2011 +0800
+++ b/cgi-bin/LJ/Setting/SiteScheme.pm	Mon Jan 31 19:32:26 2011 +0800
@@ -45,7 +45,7 @@ sub option {
     return "" unless @bml_schemes;
 
     my $show_hidden = $opts{getargs}->{view} && $opts{getargs}->{view} eq "schemes";
-    my $sitescheme = $class->get_arg( $args, "sitescheme" ) || BML::get_scheme() || $r->cookie( 'BMLschemepref' ) || $bml_schemes[0]->{scheme};
+    my $sitescheme = $class->get_arg( $args, "sitescheme" ) || DW::SiteScheme->current;
 
     my $ret;
     foreach my $scheme (@bml_schemes) {
diff -r 744f97686e08 -r c79d1dcc92a6 cgi-bin/bml/scheme/blueshift.look
--- a/cgi-bin/bml/scheme/blueshift.look	Mon Jan 31 19:17:57 2011 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-# Blueshift Site Scheme
-#
-# Authors:
-#     Emily Ravenwood <ravenwood@alltrees.org>
-#     Denise Paolucci <denise@dreamwidth.org>
-#  Based on Tropospherical Red authored by:
-#     Janine Smith <janine@netrophic.com>
-#     Jesse Proulx <jproulx@jproulx.net>
-#     Elizabeth Lubowitz <grrliz@gmail.com>
-#
-# Copyright (c) 2009 by Dreamwidth Studios, LLC.
-#
-# This program is free software; you may redistribute it and/or modify it under
-# the same terms as Perl itself.  For a copy of the license, please reference
-# 'perldoc perlartistic' or 'perldoc perlgpl'.
-
-_parent=>common.look
-
-head<=
-<head>
-    <title>
-    <?_code
-        my $elhash = $_[2];
-        return $elhash->{WINDOWTITLE} || $elhash->{TITLE};
-    _code?>
-    </title>
-
-    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-
-    <?_code
-        LJ::need_res( { priority => $LJ::SCHEME_RES_PRIORITY },
-            qw( stc/reset.css
-                stc/jquery/jquery.ui.theme.smoothness.css
-                stc/lj_base-app.css
-                stc/blueshift/blueshift.css
-            )
-        );
-
-    _code?>
-    <?_code LJ::res_includes(); _code?>
-
-    %%head%%
-</head>
-<=head
-
-page<=
-{Fps}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-    <?head?>
-    <body %%bodyopts%%>
-        <div id="canvas">
-            <?pagediv?>
-        </div>
-        <?_code LJ::final_body_html(); _code?>
-    </body>
-</html>
-<=page
diff -r 744f97686e08 -r c79d1dcc92a6 cgi-bin/bml/scheme/celerity.look
--- a/cgi-bin/bml/scheme/celerity.look	Mon Jan 31 19:17:57 2011 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-# Celerity Site Scheme
-#
-# Authors:
-#     Emily Ravenwood <ravenwood@alltrees.org>
-#     Denise Paolucci <denise@dreamwidth.org>
-#  Based on Tropospherical Red authored by:
-#     Janine Smith <janine@netrophic.com>
-#     Jesse Proulx <jproulx@jproulx.net>
-#     Elizabeth Lubowitz <grrliz@gmail.com>
-#
-# Copyright (c) 2009 by Dreamwidth Studios, LLC.
-#
-# This program is free software; you may redistribute it and/or modify it under
-# the same terms as Perl itself.  For a copy of the license, please reference
-# 'perldoc perlartistic' or 'perldoc perlgpl'.
-
-_parent=>common.look
-
-head<=
-<head>
-    <title>
-    <?_code
-        my $elhash = $_[2];
-        return $elhash->{WINDOWTITLE} || $elhash->{TITLE};
-    _code?>
-    </title>
-
-    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-
-    <?_code
-        LJ::need_res( { priority => $LJ::SCHEME_RES_PRIORITY },
-            qw( stc/reset.css
-                stc/jquery/jquery.ui.theme.smoothness.css
-                stc/lj_base-app.css
-                stc/celerity/celerity.css
-            )
-        );
-
-    _code?>
-    <?_code LJ::res_includes(); _code?>
-
-    %%head%%
-</head>
-<=head
-
-accountlinks<=
-<?_code
-{
-    my $remote = LJ::get_remote();
-    my $ret;
-
-    if ( $remote ) {
-        my $inbox = $remote->notification_inbox;
-        my $unread = $inbox->unread_count;
-        my $identity = $remote->is_identity;
-
-        $ret .= "<div id='account-links-text'>";
-        $ret .= "<form action='$LJ::SITEROOT/logout?ret=1' method='post'>";
-        $ret .= $remote->ljuser_display;
-        $ret .= "<input type='hidden' name='user' value='" . $remote->user . "' />";
-        $ret .= "<input type='hidden' name='sessid' value='$remote->{_session}->{sessid}' />";
-        $ret .= " <input type='submit' value=\"$ML{'sitescheme.accountlinks.btn.logout'}\" />";
-        $ret .= "</form>";
-        $ret .= "<ul>";
-        $ret .= "<li><a href='$LJ::SITEROOT/update'>$ML{'sitescheme.accountlinks.post'}</a>  &bull; </li>" unless $identity;
-        $ret .= "<li><a href='" . $remote->journal_base . "/read'>$ML{'sitescheme.accountlinks.readinglist'}</a> &bull; </li>";
-        $ret .= "<li><a href='$LJ::SITEROOT/inbox/'>$ML{'sitescheme.accountlinks.inbox'}";
-        $ret .= " <span id='Inbox_Unread_Count'>($unread)</span>" if $unread;
-        $ret .= "</a> &bull; </li>";
-        $ret .= "<li><a href='$LJ::SITEROOT/manage/settings/'>$ML{'sitescheme.accountlinks.account'}</a></li> <br />";
-        $ret .= "<li><a href='$LJ::SITEROOT/manage/circle/invite'>$ML{'sitescheme.accountlinks.invitefriend'}</a> &bull; </li>" unless $identity;
-        $ret .= "<li><a href='$LJ::SITEROOT/support/'>$ML{'sitescheme.accountlinks.help'}</a></li>";
-        $ret .= "</ul>";
-        $ret .= "</div>";
-    } else {
-        my $chal = LJ::challenge_generate(300);
-
-        $ret .= "<form action='$LJ::SITEROOT/login?ret=1' method='post'>";
-        $ret .= LJ::html_hidden( returnto => $GET{returnto} );
-        $ret .= "<input type='hidden' name='chal' class='lj_login_chal' value='$chal' />\n";
-        $ret .= "<input type='hidden' name='response' class='lj_login_response' value='' />\n";
-        $ret .= "<table summary='' id='login-table'>";
-        $ret .= "<tr><td><label for='login_user'>$ML{'sitescheme.accountlinks.login.username'}</label></td>";
-        $ret .= "<td class='input-cell' colspan='2'>" . LJ::html_text({
-            name => "user",
-            id => "login_user",
-            size => 20,
-            maxlength => 27,
-            tabindex => 1,
-            raw => 'aria-required="true"',
-        }) . " <a href='$LJ::SITEROOT/openid/' tabindex=5>$ML{'sitescheme.accountlinks.login.openid'}</a></td></tr>";
-        $ret .= "<tr><td><label for='login_password'>$ML{'sitescheme.accountlinks.login.password'}</label></td>";
-        $ret .= "<td class='input-cell' colspan='2'>" . LJ::html_text({
-            type => "password",
-            name => "password",
-            id => "login_password",
-            size => 20,
-            tabindex => 2,
-            raw => 'aria-required="true"',
-        }) . " <a href='$LJ::SITEROOT/lostinfo' tabindex=6>$ML{'sitescheme.accountlinks.login.forgotpassword'}</a></td></tr>";
-        $ret .= "<tr><td>&nbsp;</td>";
-        $ret .= "<td class='remember-me-cell'>";
-        $ret .= LJ::html_check({
-            name => "remember_me",
-            id => "login_remember_me",
-            value => 1,
-            tabindex => 3,
-        });
-        $ret .= " <label for='login_remember_me'>$ML{'sitescheme.accountlinks.login.rememberme'}</label></td>";
-        $ret .= "<td>" . LJ::html_submit( login => $ML{'sitescheme.accountlinks.btn.login'}, { tabindex => 4 }) . "</td>";
-        $ret .= "</tr>";
-        $ret .= "</table>";
-        $ret .= "</form>";
-   }
-
-    return $ret;
-}
-_code?>
-<=accountlinks
-
-userpic<=
-<?_code
-{
-    my $remote = LJ::get_remote();
-    my $ret;
-
-    $ret .= "<div id='header-userpic'><a href='$LJ::SITEROOT/editicons'>";
-
-    if ( $remote ) {
-        my $userpic = $remote->userpic;
-        if ( $userpic && !$LJ::IS_SSL ) {
-            my $wh = $userpic->img_fixedsize( width => 80, height => 80 );
-            $ret .= "<img src='" . $userpic->url . "' $wh alt=\"$ML{'sitescheme.accountlinks.userpic.alt'}\" />";
-        } else {
-            $ret .= LJ::img( "nouserpic_sitescheme", "", { ssl => 1 } );
-        }
-    }
-
-    $ret .= "</a></div>";
-    return $ret;
-}
-_code?>
-<=userpic
-
-page<=
-{Fps}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-    <?head?>
-    <body %%bodyopts%%>
-        <div id="canvas">
-            <div id="page">
-                <div id="masthead">
-                        <?logo?>
-                </div><!-- end masthead-->
-
-                <div id="content" %%contentopts%%>
-                <h1>%%title%%</h1>
-                %%body%%
-                </div><!--end content-->
-                <div id="page-decoration"></div>
-                </div><!-- end page-->
-                <div id="account-links">
-                    <?accountlinks?>
-                </div><!-- end account links-->
-                <div id="sidebar">
-                    <?userpic?>
-                    <?menunav?>
-                </div>
-                <div id="header-divider"> <div id="header-divider-insert"></div></div>
-                <div id="header-search">
-                    <?_code return LJ::Widget::Search->render; _code?>
-                </div><!-- end header-search--> 
-                <div id="footer">
-                    <?footer?>
-                </div>
-        </div> <!-- end canvas-->
-        <?_code LJ::final_body_html(); _code?>
-    </body>
-</html>
-<=page
diff -r 744f97686e08 -r c79d1dcc92a6 cgi-bin/bml/scheme/common.look
--- a/cgi-bin/bml/scheme/common.look	Mon Jan 31 19:17:57 2011 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-# Common BML for all Dreamwidth site schemes, refactored for inheritance.
-#
-# Authors:
-#     Jen Griffin <kareila@livejournal.com>
-#  Based on Blueshift Site Scheme, authored by:
-#     Emily Ravenwood <ravenwood@alltrees.org>
-#     Denise Paolucci <denise@dreamwidth.org>
-#  Which was in turn based on Tropospherical Red, authored by:
-#     Janine Smith <janine@netrophic.com>
-#     Jesse Proulx <jproulx@jproulx.net>
-#     Elizabeth Lubowitz <grrliz@gmail.com>
-#
-# Copyright (c) 2010 by Dreamwidth Studios, LLC.
-#
-# This program is free software; you may redistribute it and/or modify it under
-# the same terms as Perl itself.  For a copy of the license, please reference
-# 'perldoc perlartistic' or 'perldoc perlgpl'.
-
-_parent=>global.look
-
-h1=>{D}<h1>%%data%%</h1>
-h2=>{D}<h2>%%data%%</h2>
-p=>{D}<p>%%data%%</p>
-hr=><hr />
-
-de=><span style='font-size: smaller;'>%%data%%</span>
-emailex=><div style='width: 50%; font-family: courier; background-color: #efefef; border: dotted #cdcdcd 2px; padding: 5px;'>%%data%%</div>
-
-standout<=
-{DRps}<div class='standout'><table summary='' class='standout-inner'><tr><td>%%data%%</td></tr></table></div>
-<=standout
-
-logo<=
-<span id='sitename'><a href="<?siteroot?>"><?_code $LJ::SITENAMESHORT _code?></a></span>
-<=logo
-
-footer<=
-<ul>
-    <li><a href="<?siteroot?>/legal/privacy"><?_ml sitescheme.footer.legal.privacypolicy _ml?></a> &bull; </li>
-    <li><a href="<?siteroot?>/legal/tos"><?_ml sitescheme.footer.legal.tos _ml?></a> &bull; </li>
-    <li><a href="<?siteroot?>/legal/diversity"><?_ml sitescheme.footer.legal.diversitystatement _ml?></a> &bull; </li>
-    <li><a href="<?siteroot?>/legal/principles"><?_ml sitescheme.footer.legal.guidingprinciples _ml?></a> &bull; </li>
-    <li><a href="<?siteroot?>/site/"><?_ml sitescheme.footer.sitemap _ml?></a> &bull; </li>
-    <li><a href="<?siteroot?>/site/suggest"><?_ml sitescheme.footer.suggestion _ml?></a></li>
-</ul>
-<p><?_ml sitescheme.footer.info _ml?></p>
-<=footer
-
-accountlinks<=
-<?_code
-{
-    my $remote = LJ::get_remote();
-    my $ret;
-
-    if ( $remote ) {
-        my $userpic = $remote->userpic;
-        my $inbox = $remote->notification_inbox;
-        my $unread = $inbox->unread_count;
-        my $identity = $remote->is_identity;
-
-        $ret .= "<div id='account-links-userpic'><a href='$LJ::SITEROOT/editicons'>";
-
-        if ( $userpic && !$LJ::IS_SSL ) {
-            my $wh = $userpic->img_fixedsize( width => 80, height => 80 );
-            $ret .= "<img src='" . $userpic->url . "' $wh alt=\"$ML{'sitescheme.accountlinks.userpic.alt'}\" />";
-        } else {
-            $ret .= LJ::img( "nouserpic_sitescheme", "" );
-        }
-        $ret .= "</a></div>";
-        $ret .= "<div id='account-links-text'>";
-        $ret .= "<form action='$LJ::SITEROOT/logout?ret=1' method='post'>";
-        $ret .= $remote->ljuser_display;
-        $ret .= "<input type='hidden' name='user' value='" . $remote->user . "' />";
-        $ret .= "<input type='hidden' name='sessid' value='$remote->{_session}->{sessid}' />";
-        $ret .= " <input type='submit' value=\"$ML{'sitescheme.accountlinks.btn.logout'}\" />";
-        $ret .= "</form>";
-        $ret .= "<ul>";
-        $ret .= "<li><a href='$LJ::SITEROOT/update'>$ML{'sitescheme.accountlinks.post'}</a>  &bull; </li>" unless $identity;
-        $ret .= "<li><a href='" . $remote->journal_base . "/read'>$ML{'sitescheme.accountlinks.readinglist'}</a> &bull; </li>";
-        $ret .= "<li><a href='$LJ::SITEROOT/inbox/'>$ML{'sitescheme.accountlinks.inbox'}";
-        $ret .= " <span id='Inbox_Unread_Count'>($unread)</span>" if $unread;
-        $ret .= "</a> &bull; </li>";
-        $ret .= "<li><a href='$LJ::SITEROOT/manage/settings/'>$ML{'sitescheme.accountlinks.account'}</a></li> <br />";
-        $ret .= "<li><a href='$LJ::SITEROOT/manage/circle/invite'>$ML{'sitescheme.accountlinks.invitefriend'}</a> &bull; </li>" unless $identity;
-        $ret .= "<li><a href='$LJ::SITEROOT/support/'>$ML{'sitescheme.accountlinks.help'}</a></li>";
-        $ret .= "</ul>";
-        $ret .= "</div>";
-    } else {
-        my $chal = LJ::challenge_generate(300);
-
-        $ret .= "<form action='$LJ::SITEROOT/login?ret=1' method='post'>";
-        $ret .= LJ::html_hidden( returnto => $GET{returnto} );
-        $ret .= "<input type='hidden' name='chal' class='lj_login_chal' value='$chal' />\n";
-        $ret .= "<input type='hidden' name='response' class='lj_login_response' value='' />\n";
-        $ret .= "<table summary='' id='login-table'>";
-        $ret .= "<tr><td><label for='login_user'>$ML{'sitescheme.accountlinks.login.username'}</label></td>";
-        $ret .= "<td class='input-cell' colspan='2'>" . LJ::html_text({
-            name => "user",
-            id => "login_user",
-            size => 20,
-            maxlength => 27,
-            tabindex => 1,
-            raw => 'aria-required="true"',
-        }) . " <a href='$LJ::SITEROOT/openid/' tabindex=5>$ML{'sitescheme.accountlinks.login.openid'}</a></td></tr>";
-        $ret .= "<tr><td><label for='login_password'>$ML{'sitescheme.accountlinks.login.password'}</label></td>";
-        $ret .= "<td class='input-cell' colspan='2'>" . LJ::html_text({
-            type => "password",
-            name => "password",
-            id => "login_password",
-            size => 20,
-            tabindex => 2,
-            raw => 'aria-required="true"',
-        }) . " <a href='$LJ::SITEROOT/lostinfo' tabindex=6>$ML{'sitescheme.accountlinks.login.forgotpassword'}</a></td></tr>";
-        $ret .= "<tr><td>&nbsp;</td>";
-        $ret .= "<td class='remember-me-cell'>";
-        $ret .= LJ::html_check({
-            name => "remember_me",
-            id => "login_remember_me",
-            value => 1,
-            tabindex => 3,
-        });
-        $ret .= " <label for='login_remember_me'>$ML{'sitescheme.accountlinks.login.rememberme'}</label></td>";
-        $ret .= "<td>" . LJ::html_submit( login => $ML{'sitescheme.accountlinks.btn.login'}, { tabindex => 4 }) . "</td>";
-        $ret .= "</tr>";
-        $ret .= "</table>";
-        $ret .= "</form>";
-   }
-
-    return $ret;
-}
-_code?>
-<=accountlinks
-
-pagediv<=
-            <div id="page">
-                <div id="masthead">
-                    <span id="logo">
-                        <?logo?>
-                    </span>
-                </div>
-
-                <div id="content" %%contentopts%%>
-                <h1>%%title%%</h1>
-                %%body%%
-                </div>
-                <div id="account-links">
-                    <?accountlinks?>
-                </div>
-                <div id="menu">
-                    <?menunav?>
-                </div>
-                <div id="header-search">
-                    <?_code return LJ::Widget::Search->render; _code?>
-                </div>
-                <div id="footer">
-                    <?footer?>
-                </div>
-            </div>
-<=pagediv
diff -r 744f97686e08 -r c79d1dcc92a6 cgi-bin/bml/scheme/gradation-horizontal.look
--- a/cgi-bin/bml/scheme/gradation-horizontal.look	Mon Jan 31 19:17:57 2011 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-# Gradation Horizontal Site Scheme
-#
-# Authors:
-#     Emily Ravenwood <ravenwood@alltrees.org>
-#     Denise Paolucci <denise@dreamwidth.org>
-#  Based on Tropospherical Red authored by:
-#     Janine Smith <janine@netrophic.com>
-#     Jesse Proulx <jproulx@jproulx.net>
-#     Elizabeth Lubowitz <grrliz@gmail.com>
-#
-# Copyright (c) 2009 by Dreamwidth Studios, LLC.
-#
-# This program is free software; you may redistribute it and/or modify it under
-# the same terms as Perl itself.  For a copy of the license, please reference
-# 'perldoc perlartistic' or 'perldoc perlgpl'.
-
-_parent=>common.look
-
-head<=
-<head>
-    <title>
-    <?_code
-        my $elhash = $_[2];
-        return $elhash->{WINDOWTITLE} || $elhash->{TITLE};
-    _code?>
-    </title>
-
-    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-
-    <?_code
-        LJ::need_res( { priority => $LJ::SCHEME_RES_PRIORITY },
-            qw( stc/reset.css
-                stc/jquery/jquery.ui.theme.dark-hive.css
-                stc/lj_base-app.css
-                stc/gradation/gradation.css
-            )
-        );
-
-        LJ::need_res( { group => 'jquery', priority => $LJ::SCHEME_RES_PRIORITY }, "js/nav-jquery.js" );
-        LJ::need_res( { group => 'default', priority => $LJ::SCHEME_RES_PRIORITY }, "js/nav.js" );
-    _code?>
-    <?_code LJ::res_includes(); _code?>
-
-    %%head%%
-</head>
-<=head
-
-page<=
-{Fps}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-    <?head?>
-    <body %%bodyopts%%>
-        <div id="canvas" class="horizontal-nav">
-            <?pagediv?>
-        </div>
-        <?_code LJ::final_body_html(); _code?>
-    </body>
-</html>
-<=page
diff -r 744f97686e08 -r c79d1dcc92a6 cgi-bin/bml/scheme/gradation-vertical.look
--- a/cgi-bin/bml/scheme/gradation-vertical.look	Mon Jan 31 19:17:57 2011 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-# Gradation Vertical Site Scheme
-#
-# Authors:
-#     Emily Ravenwood <ravenwood@alltrees.org>
-#     Denise Paolucci <denise@dreamwidth.org>
-#  Based on Tropospherical Red authored by:
-#     Janine Smith <janine@netrophic.com>
-#     Jesse Proulx <jproulx@jproulx.net>
-#     Elizabeth Lubowitz <grrliz@gmail.com>
-#
-# Copyright (c) 2009 by Dreamwidth Studios, LLC.
-#
-# This program is free software; you may redistribute it and/or modify it under
-# the same terms as Perl itself.  For a copy of the license, please reference
-# 'perldoc perlartistic' or 'perldoc perlgpl'.
-
-_parent=>common.look
-
-head<=
-<head>
-    <title>
-    <?_code
-        my $elhash = $_[2];
-        return $elhash->{WINDOWTITLE} || $elhash->{TITLE};
-    _code?>
-    </title>
-
-    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-
-    <?_code
-        LJ::need_res( { priority => $LJ::SCHEME_RES_PRIORITY },
-            qw( stc/reset.css
-                stc/jquery/jquery.ui.theme.dark-hive.css
-                stc/lj_base-app.css
-                stc/gradation/gradation.css
-            )
-        );
-
-    _code?>
-    <?_code LJ::res_includes(); _code?>
-
-    %%head%%
-</head>
-<=head
-
-page<=
-{Fps}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-    <?head?>
-    <body %%bodyopts%%>
-        <div id="canvas" class="vertical-nav">
-            <?pagediv?>
-        </div>
-        <?_code LJ::final_body_html(); _code?>
-    </body>
-</html>
-<=page
diff -r 744f97686e08 -r c79d1dcc92a6 cgi-bin/bml/scheme/lynx.look
--- a/cgi-bin/bml/scheme/lynx.look	Mon Jan 31 19:17:57 2011 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-# This code was forked from the LiveJournal project owned and operated
-# by Live Journal, Inc. The code has been modified and expanded by 
-# Dreamwidth Studios, LLC. These files were originally licensed under
-# the terms of the license supplied by Live Journal, Inc, which can
-# currently be found at:
-#
-# http://code.livejournal.org/trac/livejournal/browser/trunk/LICENSE-LiveJournal.txt
-#
-# In accordance with the original license, this code and all its
-# modifications are provided under the GNU General Public License. 
-# A copy of that license can be found in the LICENSE file included as
-# part of this distribution.
-#
-###
-###       Lynx Scheme - Very simple for text browsers
-###
-
-_parent=>global.look
-
-h1=>{D}<h1>%%DATA%%</h1>
-h2=>{D}<h2>%%DATA%%</h2>
-
-loginboxstyle=>{S}
-commloginboxstyle=>{S}
-
-page<=
-{Fps}<!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">
-<head>
-<link rel="home" title="<?_ml lynx.nav.home _ml?>" href="<?siteroot?>/" />
-<link rel="contents" title="<?_ml lynx.nav.sitemap _ml?>" href="<?siteroot?>/site/" />
-<link rel="help" title="<?_ml lynx.nav.help _ml?>" href="<?siteroot?>/support/" />
-<?_code
-    use strict;
-    LJ::need_res( { priority => $LJ::SCHEME_RES_PRIORITY },
-        qw( stc/jquery/jquery.ui.theme.smoothness.css
-            stc/lj_base-app.css
-            stc/lynx/lynx.css
-        )
-    );
-
-    my $crumb_up;
-    if (LJ::get_active_crumb() ne '') {
-        my $parentcrumb = LJ::get_parent_crumb();
-        $crumb_up = "<link rel='up' title='$parentcrumb->[0]' href='$parentcrumb->[1]' />";
-    }
-    return $crumb_up;
-_code?>
-<style>
-    #Comments q { padding-left: 2.5em; font-style: italic; }
-</style>
-<title><?_code {
-    my $elhash = $_[2];
-    return $elhash->{'WINDOWTITLE'} || $elhash->{'TITLE'};
-} _code?></title>
-<?_code LJ::res_includes() _code?>
-%%HEAD%%
-</head>
-
-<body %%bodyopts%%>
-
-%%BODY%%
-
-<hr />
-<?_code
-{
-    my $remote = LJ::get_remote();
-    my $ret;
-
-    $ret .= "<p>[ <a href='<?siteroot?>/'><?_ml lynx.nav.home _ml?></a> | <a href='<?siteroot?>/update'><?_ml lynx.nav.update _ml?></a> | ";
-
-    if ( $remote ) {
-         my $baseurl = $remote->journal_base();
-         $ret .= "<a href='$baseurl/'>$ML{'lynx.nav.recent'}</a> | <a href='$baseurl/read'>$ML{'lynx.nav.friends'}</a> | ";
-         $ret .= "<a href='<?siteroot?>/logout'><?_ml lynx.nav.logout _ml?></a> " . $remote->ljuser_display . " | ";
-    } else {
-         $ret .= "<a href='<?siteroot?>/login'><?_ml lynx.nav.login _ml?></a> | ";
-    }
-
-    $ret .= "<a href='<?siteroot?>/tools/search'><?_ml lynx.nav.search _ml?></a> | ";
-    $ret .= "<a href='<?siteroot?>/manage/settings/'><?_ml lynx.nav.siteopts _ml?></a> | ";
-    $ret .= "<a href='<?siteroot?>/site/'><?_ml lynx.nav.sitemap _ml?></a> ]</p>";
-
-    return $ret;
-}
-
-_code?>
-<?breadcrumbs?>
-<?_code LJ::final_body_html() _code?>
-</body>
-</html>
-<=page
diff -r 744f97686e08 -r c79d1dcc92a6 cgi-bin/bml/scheme/tt_runner.look
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cgi-bin/bml/scheme/tt_runner.look	Mon Jan 31 19:32:26 2011 +0800
@@ -0,0 +1,19 @@
+_parent=>global.look
+page<=
+{Fps}<?_code
+use DW::Template;
+use DW::Request;
+
+my $r = DW::Request->get;
+my $scheme = $r->pnote('actual_scheme');
+die "Somehow we went down the TT path for a BML scheme" unless $scheme && $scheme->engine eq 'tt';
+
+return BML::ebml( DW::Template->render_scheme( $scheme, $_[2]->{BODY}, {
+    windowtitle => $_[2]->{WINDOWTITLE},
+    title => $_[2]->{TITLE},
+    head => $_[2]->{HEAD},
+    bodyopts => $_[2]->{BODYOPTS},
+    contentopts => $_[2]->{CONTENTOPTS}
+} ) );
+_code?>
+<=page
\ No newline at end of file
diff -r 744f97686e08 -r c79d1dcc92a6 schemes/_init.tt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schemes/_init.tt	Mon Jan 31 19:32:26 2011 +0800
@@ -0,0 +1,4 @@
+[%- USE dw -%]
+[%- USE dw_scheme -%]
+[%- FOREACH current_scheme IN inheritance -%][%- PROCESS $current_scheme -%][%- END -%]
+[%- PROCESS block.page -%]
\ No newline at end of file
diff -r 744f97686e08 -r c79d1dcc92a6 schemes/blueshift.tt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schemes/blueshift.tt	Mon Jan 31 19:32:26 2011 +0800
@@ -0,0 +1,26 @@
+[%#
+Blueshift Site Scheme
+
+ Converted to Template Toolkit:
+    Andrea Nall <anall@andreanall.com>
+ Authors:
+    Emily Ravenwood <ravenwood@alltrees.org>
+    Denise Paolucci <denise@dreamwidth.org>
+ Based on Tropospherical Red authored by:
+    Janine Smith <janine@netrophic.com>
+    Jesse Proulx <jproulx@jproulx.net>
+    Elizabeth Lubowitz <grrliz@gmail.com>
+
+Copyright (c) 2009-2011 by Dreamwidth Studios, LLC.
+
+This program is free software; you may redistribute it and/or modify it under
+the same terms as Perl itself.  For a copy of the license, please reference
+'perldoc perlartistic' or 'perldoc perlgpl'.
+
+%][%- BLOCK block.need_res -%]
+    [%- dw_scheme.need_res(
+        'stc/reset.css',
+        'stc/jquery/jquery.ui.theme.smoothness.css',
+        'stc/lj_base-app.css',
+        'stc/blueshift/blueshift.css') -%]
+[%- END -%]
\ No newline at end of file
diff -r 744f97686e08 -r c79d1dcc92a6 schemes/celerity.tt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schemes/celerity.tt	Mon Jan 31 19:32:26 2011 +0800
@@ -0,0 +1,70 @@
+[%#
+Celerity Site Scheme
+
+ Converted to Template Toolkit:
+    Andrea Nall <anall@andreanall.com>
+ Authors:
+    Emily Ravenwood <ravenwood@alltrees.org>
+    Denise Paolucci <denise@dreamwidth.org>
+ Based on Tropospherical Red authored by:
+    Janine Smith <janine@netrophic.com>
+    Jesse Proulx <jproulx@jproulx.net>
+    Elizabeth Lubowitz <grrliz@gmail.com>
+
+Copyright (c) 2009-2011 by Dreamwidth Studios, LLC.
+
+This program is free software; you may redistribute it and/or modify it under
+the same terms as Perl itself.  For a copy of the license, please reference
+'perldoc perlartistic' or 'perldoc perlgpl'.
+
+%][%- BLOCK block.need_res -%]
+    [%- dw_scheme.need_res(
+        'stc/reset.css',
+        'stc/jquery/jquery.ui.theme.smoothness.css',
+        'stc/lj_base-app.css',
+        'stc/celerity/celerity.css') -%]
+[%- END -%]
+
+[%- account_link_options = {
+    no_userpic = 1,
+    
+} -%]
+
+[%- userpic_class = 'header-userpic' -%]
+
+[%- BLOCK block.page -%]
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+    [% PROCESS block.head %]
+    <body [% sections.bodyopts %]>
+        <div id="canvas">
+            <div id="page">
+                <div id="masthead">
+                        [% PROCESS block.logo %]
+                </div><!-- end masthead-->
+
+                <div id="content" [% sections.contentopts %]>
+                <h1>[% sections.title %]</h1>
+                [% content %]
+                </div><!--end content-->
+                <div id="page-decoration"></div>
+                </div><!-- end page-->
+                <div id="account-links">
+                    [% PROCESS block.accountlinks %]
+                </div><!-- end account links-->
+                <div id="sidebar">
+                    [% PROCESS block.userpic %]
+                    [% PROCESS block.menunav %]
+                </div>
+                <div id="header-divider"> <div id="header-divider-insert"></div></div>
+                <div id="header-search">
+                    [% dw_scheme.search_render %]
+                </div><!-- end header-search--> 
+                <div id="footer">
+                    [% PROCESS block.footer %]
+                </div>
+        </div> <!-- end canvas-->
+        [% dw_scheme.final_body_html %]
+    </body>
+</html>
+[%- END -%]
diff -r 744f97686e08 -r c79d1dcc92a6 schemes/common.tt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schemes/common.tt	Mon Jan 31 19:32:26 2011 +0800
@@ -0,0 +1,152 @@
+[%#
+Common code for all Dreamwidth site schemes, refactored for inheritance.
+
+ Authors:
+    Jen Griffin <kareila@livejournal.com>
+    Andrea Nall <anall@andreanall.com>
+ Based on Blueshift Site Scheme, authored by:
+    Emily Ravenwood <ravenwood@alltrees.org>
+    Denise Paolucci <denise@dreamwidth.org>
+ Which was in turn based on Tropospherical Red, authored by:
+    Janine Smith <janine@netrophic.com>
+    Jesse Proulx <jproulx@jproulx.net>
+    Elizabeth Lubowitz <grrliz@gmail.com>
+
+Copyright (c) 2010-2011 by Dreamwidth Studios, LLC.
+
+This program is free software; you may redistribute it and/or modify it under
+the same terms as Perl itself.  For a copy of the license, please reference
+'perldoc perlartistic' or 'perldoc perlgpl'.
+
+%][%- BLOCK block.need_res -%]
+[%- END -%]
+
+[%- BLOCK block.head -%]
+<head>
+    <title>[% sections.windowtitle || sections.title %]</title>
+
+    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+
+    [%- PROCESS block.need_res -%]
+    [% dw_scheme.res_includes %]
+    [% sections.head %]
+</head>
+[%- END -%]
+
+[%- BLOCK block.logo -%]
+<span id='sitename'><a href="[% site.root %]/">[% site.nameshort %]</a></span>
+[%- END -%]
+
+[%- BLOCK block.footer -%]
+<ul>
+    <li><a href="[% site.root %]/legal/privacy">[% 'sitescheme.footer.legal.privacypolicy' | ml %]</a> &bull; </li>
+    <li><a href="[% site.root %]/legal/tos">[% 'sitescheme.footer.legal.tos' | ml %]</a> &bull; </li>
+    <li><a href="[% site.root %]/legal/diversity">[% 'sitescheme.footer.legal.diversitystatement' | ml %]</a> &bull; </li>
+    <li><a href="[% site.root %]/legal/principles">[% 'sitescheme.footer.legal.guidingprinciples' | ml %]</a> &bull; </li>
+    <li><a href="[% site.root %]/site/">[% 'sitescheme.footer.sitemap' | ml %]</a> &bull; </li>
+    <li><a href="[% site.root %]/site/suggest">[% 'sitescheme.footer.suggestion' | ml %]</a></li>
+</ul>
+<p>[% 'sitescheme.footer.info' | ml %]</p>
+[%- END -%]
+
+[%- userpic_class = 'account-links-userpic' -%]
+[%- BLOCK block.userpic -%]
+<div id='[% userpic_class %]'><a href='[% site.root %]/editicons'>
+    [%- IF remote -%][%- userpic = remote.userpic -%]
+        [%- IF userpic && ! is_ssl -%]
+            <img src='[% userpic.url %]' [% userpic.img_fixedsize( 'width', 80, 'height', 80 ) %] alt=[% 'sitescheme.accountlinks.userpic.alt' | ml %] />
+        [%- ELSE -%]
+            [%- dw.img( "nouserpic_sitescheme", "", { ssl => 1} ) -%]
+        [%- END -%]
+    [%- END -%]
+</a></div>
+[%- END -%]
+
+[%- account_link_options = {} -%]
+[%- BLOCK block.accountlinks -%]
+[%- IF remote -%]
+    [%- IF ! account_link_options.no_userpic -%]
+        [%- PROCESS block.userpic -%]
+    [%- END -%]
+    [%- inbox = remote.notification_inbox -%]
+    [%- unread = inbox.unread_count -%]
+    [%- identity = remote.is_identity -%]
+    [%- -%]<div id='account-links-text'>
+    [%- -%]<form action='[% site.root %]/logout?ret=1' method='post'>
+    [%- remote.ljuser_display -%]
+    [%- -%]<input type='hidden' name='user' value='[% remote.user %]' />
+    [%- -%]<input type='hidden' name='sessid' value='[% remote._session.sessid %]' />
+    [%- -%]<input type='submit' value="[% 'sitescheme.accountlinks.btn.logout' | ml %]" />
+    [%- -%]</form>
+    [%- -%]<ul>
+    [%- IF ! identity -%]<li><a href='[% site.root %]/update'>[% 'sitescheme.accountlinks.post' | ml %]</a>  &bull; </li>[%- END -%]
+    [%- -%]<li><a href='[% remote.journal_base %]/read'>[% 'sitescheme.accountlinks.readinglist' | ml %]</a> &bull; </li>
+    [%- -%]<li><a href='[% site.root %]/inbox/'>[% 'sitescheme.accountlinks.inbox' | ml %]
+    [%- IF unread -%] <span id='Inbox_Unread_Count'>([% unread %])</span>[%- END -%]
+    [%- -%]</a> &bull; </li>
+    [%- -%]<li><a href='[% site.root %]/manage/settings/'>[% 'sitescheme.accountlinks.account' | ml %]</a></li> <br />
+    [%- IF ! identity -%]<li><a href='[% site.root %]/manage/circle/invite'>[% 'sitescheme.accountlinks.invitefriend' | ml %]</a> &bull; </li>[%- END -%]
+    [%- -%]<li><a href='[% site.root %]/support/'>[% 'sitescheme.accountlinks.help' | ml %]</a></li>
+    [%- -%]</div>
+[%- ELSE -%]
+    [%- chal = dw_scheme.challenge_generate(300) -%]
+    [%- -%]<form action='[% site.root %]/login?ret=1' method='post'>
+    [%- -%]<input type="hidden" name="returnto" value="[% get.returnto %]" />
+    [%- -%]<input type='hidden' name='chal' class='lj_login_chal' value='[% chal %]' />
+    <input type='hidden' name='response' class='lj_login_response' value='' />
+    <table summary='' id='login-table'>
+    [%- -%]<tr><td><label for='login_user'>[% 'sitescheme.accountlinks.login.username' | ml %]</label></td>
+    [%- -%]<td class='input-cell' colspan='2'><input name="user" id="login_user" size="20" maxlength="27" tabindex="1" aria-required="true" />
+    [%- %] <a href='[% site.root %]/openid/' tabindex=5>[% 'sitescheme.accountlinks.login.openid' | ml %]</a></td></tr>
+    [%- -%]<tr><td><label for='login_password'>[% 'sitescheme.accountlinks.login.password' | ml %]</label></td>
+    [%- -%]<td class='input-cell' colspan='2'><input type="password" name="password" id="login_password" size="20" tabindex="2" aria-required="true">
+    [%- %] <a href='[% site.root %]/lostinfo' tabindex=6>[% 'sitescheme.accountlinks.login.forgotpassword' | ml %]</a></td></tr>
+    [%- -%]<tr><td>&nbsp;</td>
+    [%- -%]<td class='remember-me-cell'>
+    [%- -%]<input type="checkbox" name="remember_me" id="login_remember_me" value="1" tabindex="3" />
+    [%- %] <label for='login_remember_me'>[% 'sitescheme.accountlinks.login.rememberme' | ml %]</label></td>
+    [%- -%]<td><input type="submit" name="login" value="[% 'sitescheme.accountlinks.btn.login' | ml %]" tabindex="4"/></td>
+    [%- -%]</tr></table></form>
+[%- END -%]
+[%- END -%]
+
+[%- BLOCK block.pagediv -%]
+<div id="page">
+    <div id="masthead">
+        <span id="logo">
+            [% PROCESS block.logo %]
+        </span>
+    </div>
+
+    <div id="content" [% sections.contentopts %]>
+    <h1>[% sections.title %]</h1>
+    [% content %]
+    </div>
+    <div id="account-links">
+        [% PROCESS block.accountlinks %]
+    </div>
+    <div id="menu">
+        [% PROCESS block.menunav %]
+    </div>
+    <div id="header-search">
+        [% dw_scheme.search_render %]
+    </div>
+    <div id="footer">
+        [% PROCESS block.footer %]
+    </div>
+</div>
+[%- END -%]
+
+[%- canvas_opts = "" -%]
+[%- BLOCK block.page -%]
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+    [% PROCESS block.head %]
+    <body [% sections.bodyopts %]>
+        <div id="canvas" [% canvas_opts %]>
+            [% PROCESS block.pagediv %]
+        </div>
+        [% dw_scheme.final_body_html %]
+    </body>
+</html>
+[%- END -%]
\ No newline at end of file
diff -r 744f97686e08 -r c79d1dcc92a6 schemes/global.tt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schemes/global.tt	Mon Jan 31 19:32:26 2011 +0800
@@ -0,0 +1,22 @@
+[%- BLOCK block.menunav -%]
+<ul>[%- nav_links = dw_scheme.menu_nav -%]
+[% FOREACH cathash IN nav_links -%]
+    [%- cat = cathash.name -%][%- submenu = cathash.items -%]
+    [%- displayed = [] -%]
+    [%- FOREACH item IN submenu -%]
+        [%- IF item.display -%]
+            [%- v = BLOCK -%]
+                <li class='subnav'><a href='[% item.url %]'>[% item.text | ml(item.text_opts) %]</a></li>
+            [%- END; displayed.push(v) -%]
+        [%- END -%]
+    [%- END -%]
+    [%- IF displayed.size -%]
+<li id='[% cat %]_topnav' class='topnav'><a href='[% site.root %]/nav/[% cat %]'>[% "menunav.$cat" | ml %]</a>
+<ul id='[% cat %]_subnav' class='subnav_container'>
+[% displayed.join("\n") %]
+</ul>
+</li>
+    [%- END -%]
+[%- END %]
+</ul>
+[%- END -%]
\ No newline at end of file
diff -r 744f97686e08 -r c79d1dcc92a6 schemes/gradation-horizontal.tt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schemes/gradation-horizontal.tt	Mon Jan 31 19:32:26 2011 +0800
@@ -0,0 +1,30 @@
+[%#
+Gradation Horizontal Site Scheme
+
+ Converted to Template Toolkit:
+    Andrea Nall <anall@andreanall.com>
+ Authors:
+    Emily Ravenwood <ravenwood@alltrees.org>
+    Denise Paolucci <denise@dreamwidth.org>
+ Based on Tropospherical Red authored by:
+    Janine Smith <janine@netrophic.com>
+    Jesse Proulx <jproulx@jproulx.net>
+    Elizabeth Lubowitz <grrliz@gmail.com>
+
+Copyright (c) 2009-2011 by Dreamwidth Studios, LLC.
+
+This program is free software; you may redistribute it and/or modify it under
+the same terms as Perl itself.  For a copy of the license, please reference
+'perldoc perlartistic' or 'perldoc perlgpl'.
+
+%][%- BLOCK block.need_res -%]
+    [%- dw_scheme.need_res(
+            'stc/reset.css',
+            'stc/jquery/jquery.ui.theme.dark-hive.css',
+            'stc/lj_base-app.css',
+            'stc/gradation/gradation.css');
+        dw_scheme.need_res({ group => 'jquery' }, 'js/nav-jquery.js' );
+        dw_scheme.need_res({ group => 'default' }, 'js/nav.js' ); -%]
+[%- END -%]
+
+[%- canvas_opts='class="horizontal-nav"' -%]
\ No newline at end of file
diff -r 744f97686e08 -r c79d1dcc92a6 schemes/gradation-vertical.tt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schemes/gradation-vertical.tt	Mon Jan 31 19:32:26 2011 +0800
@@ -0,0 +1,28 @@
+[%#
+Gradation Vertical Site Scheme
+
+ Converted to Template Toolkit:
+    Andrea Nall <anall@andreanall.com>
+ Authors:
+    Emily Ravenwood <ravenwood@alltrees.org>
+    Denise Paolucci <denise@dreamwidth.org>
+ Based on Tropospherical Red authored by:
+    Janine Smith <janine@netrophic.com>
+    Jesse Proulx <jproulx@jproulx.net>
+    Elizabeth Lubowitz <grrliz@gmail.com>
+
+Copyright (c) 2009-2011 by Dreamwidth Studios, LLC.
+
+This program is free software; you may redistribute it and/or modify it under
+the same terms as Perl itself.  For a copy of the license, please reference
+'perldoc perlartistic' or 'perldoc perlgpl'.
+
+%][%- BLOCK block.need_res -%]
+    [%- dw_scheme.need_res(
+            'stc/reset.css',
+            'stc/jquery/jquery.ui.theme.dark-hive.css',
+            'stc/lj_base-app.css',
+            'stc/gradation/gradation.css'); -%]
+[%- END -%]
+
+[%- canvas_opts='class="vertical-nav"' -%]
\ No newline at end of file
diff -r 744f97686e08 -r c79d1dcc92a6 schemes/lynx.tt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schemes/lynx.tt	Mon Jan 31 19:32:26 2011 +0800
@@ -0,0 +1,38 @@
+[%- BLOCK block.page -%]
+<!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">
+<head>
+<link rel="home" title="[% 'lynx.nav.home' | ml %]" href="[% site.root %]/" />
+<link rel="contents" title="[% 'lynx.nav.sitemap' | ml %]" href="[% site.root %]/site/" />
+<link rel="help" title="[% 'lynx.nav.help' | ml %]" href="[% site.root %]/support/" />
+[% dw_scheme.need_res(
+    'stc/jquery/jquery.ui.theme.smoothness.css',
+    'stc/lj_base-app.css',
+    'stc/lynx/lynx.css' ) %]
+<style>
+    #Comments q { padding-left: 2.5em; font-style: italic; }
+</style>
+<title>[% sections.windowtitle || sections.title %]</title>
+[% dw_scheme.res_includes %]
+[% sections.head %]
+</head>
+
+<body [% sections.bodyopts %]>
+
+[% content %]
+
+<hr />
+<p>[ <a href='[% site.root %]/'>[% 'lynx.nav.home' | ml %]</a> | <a href='[% site.root %]/update'>[% 'lynx.nav.update' | ml %]</a> |
+[%- IF remote %][% baseurl = remote.journal_base %]
+<a href='[% baseurl %]/'>[% 'lynx.nav.recent' | ml %]</a> | <a href='[% baseurl %]/read'>[% 'lynx.nav.friends' | ml %]</a> |
+<a href='[% site.root %]/logout'>[% 'lynx.nav.logout' | ml %]</a> | [% remote.ljuser_display %] |
+[%- ELSE %]
+<a href='[% site.root %]/login'>[% 'lynx.nav.login' | ml %]</a> | 
+[%- END %]
+<a href='[% site.root %]/tools/search'>[% 'lynx.nav.search' | ml %]</a> | 
+<a href='[% site.root %]/manage/settings/'>[% 'lynx.nav.siteopts' | ml %]</a> | 
+<a href='[% site.root %]/site/'>[% 'lynx.nav.sitemap' | ml %]</a> ]</p>
+[% dw_scheme.final_body_html %]
+</body>
+</html>
+[%- END -%]
\ No newline at end of file
diff -r 744f97686e08 -r c79d1dcc92a6 views/login.tt
--- a/views/login.tt	Mon Jan 31 19:17:57 2011 +0800
+++ b/views/login.tt	Mon Jan 31 19:32:26 2011 +0800
@@ -11,7 +11,7 @@ reference 'perldoc perlartistic' or 'per
 %]
 <div class="login-container">
   <div class="appwidget appwidget-login" id="protected_login"> 
-    <form action="[% IF usessl %][% site.sslroot %][% ELSE %][% site.root %][% END %]/login" method="post" class="lj_login_form pkg"> 
+    <form action="[% IF usessl %][% site.ssl.root %][% ELSE %][% site.root %][% END %]/login" method="post" class="lj_login_form pkg">
     <h4>[% '.login.header' | ml( sitename = site.name ) %]</h4> 
       [% dw.form_auth() %]
       <input type="hidden" name="chal" class="lj_login_chal" value="[% chal %]" /> 
--------------------------------------------------------------------------------