Report abuse

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
    my $page_layout;
    if (my $blog_id = $tmpl->blog_id) {
        $ctx->stash('blog_id', $blog_id);
        $ctx->stash('local_blog_id', $blog_id)
            unless $ctx->stash('local_blog_id');
        my $blog = $ctx->stash('blog');
        unless ($blog) {
            $blog = MT::Blog->load($blog_id) or
                return $tmpl->error(MT->translate(
                    "Load of blog '[_1]' failed: [_2]", $blog_id, MT::Blog->errstr ));
            $ctx->stash('blog', $blog);
        } else {
            $ctx->stash('blog_id', $blog->id);
            $ctx->stash('local_blog_id', $blog->id)
                unless $ctx->stash('local_blog_id');
        }
        MT->config->TimeOffset($blog->server_offset);
        $page_layout = $blog->page_layout;
    }
    $page_layout = $tmpl->page_layout if $tmpl->page_layout;
    $ctx->var( 'page_layout', $page_layout )
        unless $ctx->var('page_layout');
    if (my $layout = $ctx->var('page_layout')) {
        my $columns = {
            'layout-wt'  => 2,
            'layout-tw'  => 2,
            'layout-wm'  => 2,
            'layout-mw'  => 2,
            'layout-wtt' => 3,
            'layout-twt' => 3,
        }->{$layout};
        $ctx->var( 'page_columns', $columns ) if $columns;
    }