Changeset 2743

Show
Ignore:
Timestamp:
07/09/08 22:25:40 (19 months ago)
Author:
breese
Message:

Added support for an additional registry parameter. This template_sets->base_css registry item points to a base CSS file that should imported via a CSS @import command any time a style for this template set is applied. This change is being made to support those styles that may *not* require a base.css file to be imported. The base_css registry item should be a path relative to the mt-static directory.

I also converted style catcher from using the legacy .pl plugin format to the more standard config.yaml format.

Location:
branches/release-41/plugins/StyleCatcher
Files:
1 added
1 removed
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-41/plugins/StyleCatcher/lib/StyleCatcher/CMS.pm

    r2576 r2743  
    254254    } 
    255255     
    256  
    257     my $url2 = $mtthemebase . "blog.css"; 
     256    my $blog = MT->model('blog')->load($blog_id)     
     257      or return $app->json_error( $app->translate('No such blog [_1]', $blog_id) ); 
     258 
     259    my $r = MT->registry; 
     260    my $base_css = $r->{"template_sets"}{$blog->template_set}{"base_css"}; 
    258261 
    259262    # Replacing the theme import or adding a new one at the beginning 
     
    263266'/* This is the StyleCatcher theme addition. Do not remove this block. */'; 
    264267    my $footer = '/* end StyleCatcher imports */'; 
    265     my $styles = $header . "\n" . <<"EOT" . $footer; 
    266 \@import url($url2); 
    267 \@import url($url); 
    268 EOT 
     268    my $styles = $header . "\n"; 
     269    $styles .= "\@import url(".File::Spec->catfile($app->static_path, $base_css).");\n" if $base_css; 
     270    $styles .= "\@import url($url);\n"; 
     271    $styles .= $footer; 
     272    print STDERR "styles=$styles\n"; 
     273 
    269274    if ($template_text =~ s/\Q$header\E.*\Q$footer\E/$styles/s) { 
    270275        $tmpl->text( $template_text ); 
     
    299304    $tmpl->save or return $app->json_error( $tmpl->errstr ); 
    300305 
    301     my $blog = MT->model('blog')->load($blog_id)     
    302       or return $app->json_error( $app->translate('No such blog [_1]', $blog_id) ); 
    303306    $blog->page_layout($layout); 
    304307    $blog->touch();