Changeset 28

Show
Ignore:
Timestamp:
06/08/06 17:09:47 (4 years ago)
Author:
jallen
Message:

Updating StyleCatcher with latest dev code

Location:
trunk/StyleCatcher/plugins/StyleCatcher
Files:
5 added
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/StyleCatcher/plugins/StyleCatcher/base-weblog.css

    r7 r28  
    1 /* $Id: base-weblog.css 14515 2005-07-12 00:01:26Z mpaschal $ */ 
     1/* $Id: base-weblog.css 23812 2006-02-15 23:46:48Z bchoate $ */ 
    22 
    33/* basic elements */ 
    44 
    5 html 
    6 { 
    7         margin: 0; 
    8         /* setting border: 0 hoses ie6 win window inner well border */ 
    9         padding: 0; 
    10 } 
    11  
    12 body 
    13 { 
    14         margin: 0; 
    15         /* setting border: 0 hoses ie5 win window inner well border */ 
    16         padding: 0; 
    17         font-family: verdana, 'trebuchet ms', sans-serif; 
    18         font-size: 12px; 
     5html { 
     6    margin: 0; 
     7    /* setting border: 0 hoses ie6 win window inner well border */ 
     8    padding: 0; 
     9} 
     10 
     11body { 
     12    margin: 0; 
     13    /* setting border: 0 hoses ie5 win window inner well border */ 
     14    padding: 0; 
     15    font-family: verdana, 'trebuchet ms', sans-serif; 
     16    font-size: 12px; 
    1917} 
    2018 
     
    2422 
    2523h1, h2, h3, h4, h5, h6 { font-weight: normal; } 
    26 h1, h2, h3, h4, h5, h6, p, ol, ul, pre, blockquote 
    27 { 
    28         margin-top: 10px; 
    29         margin-bottom: 10px; 
     24h1, h2, h3, h4, h5, h6, p, ol, ul, pre, blockquote { 
     25    margin-top: 10px; 
     26    margin-bottom: 10px; 
    3027} 
    3128 
     
    3330/* standard helper classes */ 
    3431 
    35 .clr 
    36 { 
    37         clear: both; 
    38         overflow: hidden; 
    39         width: 1px; 
    40         height: 1px; 
    41         margin: 0 -1px -1px 0; 
    42         border: 0; 
    43         padding: 0; 
    44         font-size: 0; 
    45         line-height: 0; 
     32.clr { 
     33    clear: both; 
     34    overflow: hidden; 
     35    width: 1px; 
     36    height: 1px; 
     37    margin: 0 -1px -1px 0; 
     38    border: 0; 
     39    padding: 0; 
     40    font-size: 0; 
     41    line-height: 0; 
    4642} 
    4743 
    4844/* .pkg class wraps enclosing block element around inner floated elements */ 
    49 .pkg:after 
    50 { 
    51         content: " "; 
    52         display: block; 
    53         visibility: hidden; 
    54         clear: both; 
    55         height: 0.1px; 
    56         font-size: 0.1em; 
    57         line-height: 0; 
     45.pkg:after { 
     46    content: " "; 
     47    display: block; 
     48    visibility: hidden; 
     49    clear: both; 
     50    height: 0.1px; 
     51    font-size: 0.1em; 
     52    line-height: 0; 
    5853} 
    5954* html .pkg { display: inline-block; } 
     
    6863body { text-align: center; } /* center on ie */ 
    6964 
    70 #container 
    71 { 
    72         position: relative; 
    73         margin: 0 auto; /* center on everything else */ 
    74         width: 720px; 
    75         text-align: left; 
     65#container { 
     66    position: relative; 
     67    margin: 0 auto; /* center on everything else */ 
     68    width: 720px; 
     69    text-align: left; 
    7670} 
    7771#container-inner { position: static; width: auto; } 
     
    8377#pagebody-inner { position: static; width: 100%; } 
    8478 
    85 #alpha, #beta, #gamma, #delta 
    86 { 
    87         display: inline; /* ie win bugfix */ 
    88         position: relative; 
    89         float: left; 
    90         min-height: 1px; 
     79#alpha, #beta, #gamma, #delta { 
     80    display: inline; /* ie win bugfix */ 
     81    position: relative; 
     82    float: left; 
     83    min-height: 1px; 
    9184} 
    9285 
    9386#delta { float: right; } 
    9487 
    95 #alpha-inner, #beta-inner, #gamma-inner, #delta-inner 
    96 { 
    97         position: static; 
     88#alpha-inner, #beta-inner, #gamma-inner, #delta-inner { 
     89    position: static; 
    9890} 
    9991 
     
    10193/* banner user/photo */ 
    10294 
    103 .banner-user 
    104 { 
    105         float: left; 
    106         overflow: hidden; 
    107         width: 64px; 
    108         margin: 0 15px 0 0; 
    109         border: 0; 
    110         padding: 0; 
    111         text-align: center; 
    112 } 
    113  
    114 .banner-user-photo 
    115 { 
    116         display: block; 
    117         margin: 0 0 2px 0; 
    118         border: 0; 
    119         padding: 0; 
    120         background-position: center center; 
    121         background-repeat: no-repeat; 
    122         text-decoration: none !important; 
    123 } 
    124  
    125 .banner-user-photo img 
    126 { 
    127         width: 64px; 
    128         height: auto; 
    129         margin: 0; 
    130         border: 0; 
    131         padding: 0; 
     95.banner-user { 
     96    float: left; 
     97    overflow: hidden; 
     98    width: 64px; 
     99    margin: 0 15px 0 0; 
     100    border: 0; 
     101    padding: 0; 
     102    text-align: center; 
     103} 
     104 
     105.banner-user-photo { 
     106    display: block; 
     107    margin: 0 0 2px 0; 
     108    border: 0; 
     109    padding: 0; 
     110    background-position: center center; 
     111    background-repeat: no-repeat; 
     112    text-decoration: none !important; 
     113} 
     114 
     115.banner-user-photo img { 
     116    width: 64px; 
     117    height: auto; 
     118    margin: 0; 
     119    border: 0; 
     120    padding: 0; 
    132121} 
    133122 
     
    135124/* content */ 
    136125 
    137 .content-nav 
    138 { 
    139         margin: 10px; 
    140         text-align: center; 
     126.content-nav { 
     127    margin: 10px; 
     128    text-align: center; 
    141129} 
    142130 
    143131.date-header, 
    144 .entry-content 
    145 { 
    146         position: static; 
    147         clear: both; 
     132.entry-content { 
     133    position: static; 
     134    clear: both; 
    148135} 
    149136 
     
    151138.trackbacks, 
    152139.comments, 
    153 .archive 
    154 { 
    155         position: static; 
    156         overflow: hidden; 
    157         clear: both; 
    158         width: 100%; 
    159         margin-bottom: 20px; 
     140.archive { 
     141    position: static; 
     142    overflow: hidden; 
     143    clear: both; 
     144    width: 100%; 
     145    margin-bottom: 20px; 
    160146} 
    161147 
     
    165151.comment-content, 
    166152.comments-open-content, 
    167 .comments-closed 
    168 { 
    169         clear: both; 
    170         margin: 5px 10px; 
     153.comments-closed { 
     154    clear: both; 
    171155} 
    172156 
     
    174158.entry-body, 
    175159.entry-more-link, 
    176 .entry-more 
    177 { 
    178         clear: both; 
     160.entry-more { 
     161    clear: both; 
    179162} 
    180163 
     
    183166.comment-footer, 
    184167.comments-open-footer, 
    185 .archive-content 
    186 { 
    187         clear: both; 
    188         margin: 5px 10px 20px 10px; 
     168.archive-content { 
     169    clear: both; 
     170    margin: 5px 10px 20px 10px; 
    189171} 
    190172 
    191173.comments-open label { display: block; } 
    192174 
    193 #comment-author, #comment-email, #comment-url, #comment-text 
    194 { 
    195         width: 240px; 
    196 } 
    197  
    198 #comment-bake-cookie 
    199 { 
    200         margin-left: 0; 
    201         vertical-align: middle; 
    202 } 
    203  
    204 #comment-post 
    205 { 
    206         font-weight: bold; 
     175#comment-author, #comment-email, #comment-url, #comment-text { 
     176    width: 240px; 
     177} 
     178 
     179#comment-bake-cookie { 
     180    margin-left: 0; 
     181    vertical-align: middle; 
     182} 
     183 
     184.comments-open-header { 
     185    clear: both; 
     186} 
     187 
     188#comment-post { 
     189    font-weight: bold; 
    207190} 
    208191 
    209192img.image-full { width: 100%; } 
    210193 
    211 .image-thumbnail 
    212 { 
    213         float: left; 
    214         width: 115px; 
    215         margin: 0 10px 10px 0; 
    216 } 
    217  
    218 .image-thumbnail img 
    219 { 
    220         width: 115px; 
    221         height: 115px; 
    222         margin: 0 0 2px 0; 
     194.image-thumbnail { 
     195    float: left; 
     196    width: 115px; 
     197    margin: 0 10px 10px 0; 
     198} 
     199 
     200.image-thumbnail img { 
     201    width: 115px; 
     202    height: 115px; 
     203    margin: 0 0 2px 0; 
    223204} 
    224205 
     
    226207/* modules */ 
    227208 
    228 .module 
    229 { 
    230         position: relative; 
    231         overflow: hidden; 
    232         width: 100%; 
    233 } 
    234  
    235 .module-content 
    236 { 
    237         position: relative; 
    238         margin: 5px 10px 20px 10px; 
     209.module { 
     210    position: relative; 
     211    overflow: hidden; 
     212    width: 100%; 
     213} 
     214 
     215.module-content { 
     216    position: relative; 
     217    margin: 5px 10px 20px 10px; 
    239218} 
    240219 
    241220.module-list, 
    242 .archive-list 
    243 { 
    244         margin: 0; 
    245         padding: 0; 
    246         list-style: none; 
    247 } 
    248  
    249 .module-list-item 
    250 { 
    251         margin-top: 5px; 
    252         margin-bottom: 5px; 
     221.archive-list { 
     222    margin: 0; 
     223    padding: 0; 
     224    list-style: none; 
     225} 
     226 
     227.module-list-item { 
     228    margin-top: 5px; 
     229    margin-bottom: 5px; 
    253230} 
    254231 
     
    258235.module-wishlist .module-content { text-align: center; } 
    259236 
    260 .module-calendar .module-content table 
    261 { 
    262         border-collapse: collapse; 
     237.module-calendar .module-content table { 
     238    border-collapse: collapse; 
    263239} 
    264240 
    265241.module-calendar .module-content th, 
    266 .module-calendar .module-content td 
    267 { 
    268         width: 14%; 
    269         text-align: center; 
     242.module-calendar .module-content td { 
     243    width: 14%; 
     244    text-align: center; 
    270245} 
    271246 
    272247.typelist-thumbnailed { margin: 0 0 20px 0; } 
    273248 
    274 .typelist-thumbnailed .module-list-item 
    275 { 
    276         display: block; 
    277         clear: both; 
    278         margin: 0; 
     249.typelist-thumbnailed .module-list-item { 
     250    display: block; 
     251    clear: both; 
     252    margin: 0; 
    279253} 
    280254 
    281255/* positioniseverything.net/easyclearing.html */ 
    282 .typelist-thumbnailed .module-list-item:after 
    283 { 
    284         content: " "; 
    285         display: block; 
    286         visibility: hidden; 
    287         clear: both; 
    288         height: 0.1px; 
    289         font-size: 0.1em; 
    290         line-height: 0; 
     256.typelist-thumbnailed .module-list-item:after { 
     257    content: " "; 
     258    display: block; 
     259    visibility: hidden; 
     260    clear: both; 
     261    height: 0.1px; 
     262    font-size: 0.1em; 
     263    line-height: 0; 
    291264} 
    292265* html .typelist-thumbnailed .module-list-item { display: inline-block; } 
     
    296269/* */ 
    297270 
    298 .typelist-thumbnail 
    299 { 
    300         float: left; 
    301         min-width: 60px; 
    302         width: 60px; 
    303         /* no ie mac \*/width: auto;/* */ 
    304         margin: 0 5px 0 0; 
    305         text-align: center; 
    306         vertical-align: middle; 
     271.typelist-thumbnail { 
     272    float: left; 
     273    min-width: 60px; 
     274    width: 60px; 
     275    /* no ie mac \*/width: auto;/* */ 
     276    margin: 0 5px 0 0; 
     277    text-align: center; 
     278    vertical-align: middle; 
    307279} 
    308280 
     
    311283.module-galleries .typelist-thumbnail img { width: 50px; } 
    312284 
    313 .typelist-description 
    314 { 
    315         margin: 0; 
    316         padding: 5px; 
     285.typelist-description { 
     286    margin: 0; 
     287    padding: 5px; 
    317288} 
    318289 
    319290.module-featured-photo .module-content, 
    320 .module-photo .module-content 
    321 { 
    322         margin: 0; 
     291.module-photo .module-content { 
     292    margin: 0; 
    323293} 
    324294 
     
    327297.module-recent-photos { margin: 0 0 15px 0; } 
    328298.module-recent-photos .module-content { margin: 0; } 
    329 .module-recent-photos .module-list 
    330 { 
    331         display: block; 
    332         height: 1%; 
    333         margin: 0; 
    334         border: 0; 
    335         padding: 0; 
    336         list-style: none; 
     299.module-recent-photos .module-list { 
     300    display: block; 
     301    height: 1%; 
     302    margin: 0; 
     303    border: 0; 
     304    padding: 0; 
     305    list-style: none; 
    337306} 
    338307 
    339308/* positioniseverything.net/easyclearing.html */ 
    340 .module-recent-photos .module-list:after 
    341 { 
    342         content: " "; 
    343         display: block; 
    344         visibility: hidden; 
    345         clear: both; 
    346         height: 0.1px; 
    347         font-size: 0.1em; 
    348         line-height: 0; 
     309.module-recent-photos .module-list:after { 
     310    content: " "; 
     311    display: block; 
     312    visibility: hidden; 
     313    clear: both; 
     314    height: 0.1px; 
     315    font-size: 0.1em; 
     316    line-height: 0; 
    349317} 
    350318* html .module-recent-photos .module-list { display: inline-block; } 
     
    354322/* */ 
    355323 
    356 .module-recent-photos .module-list-item 
    357 { 
    358         display: block; 
    359         float: left; 
    360         /* ie win fix \*/ height: 1%; /**/ 
    361         margin: 0; 
    362         border: 0; 
    363         padding: 0; 
    364 } 
    365  
    366 .module-recent-photos .module-list-item a 
    367 { 
    368         display: block; 
    369         margin: 0; 
    370         border: 0; 
    371         padding: 0; 
    372 } 
    373  
    374 .module-recent-photos .module-list-item img 
    375 { 
    376         width: 60px; 
    377         height: 60px; 
    378         margin: 0; 
    379         padding: 0; 
     324.module-recent-photos .module-list-item { 
     325    display: block; 
     326    float: left; 
     327    /* ie win fix \*/ height: 1%; /**/ 
     328    margin: 0; 
     329    border: 0; 
     330    padding: 0; 
     331} 
     332 
     333.module-recent-photos .module-list-item a { 
     334    display: block; 
     335    margin: 0; 
     336    border: 0; 
     337    padding: 0; 
     338} 
     339 
     340.module-recent-photos .module-list-item img { 
     341    width: 60px; 
     342    height: 60px; 
     343    margin: 0; 
     344    padding: 0; 
    380345} 
    381346 
     
    391356.module-mmt-calendar th { text-align: left; } 
    392357 
    393 .module-mmt-calendar td 
    394 { 
    395         width: 14%; 
    396         height: 75px; 
    397         text-align: left; 
    398         vertical-align: top; 
    399 } 
    400  
    401 .day-photo 
    402 { 
    403         width: 54px; 
    404         height: 54px; 
    405 } 
    406  
    407 .day-photo a 
    408 { 
    409         display: block; 
    410 } 
    411  
    412 .day-photo a img 
    413 { 
    414         width: 50px; 
    415         height: 50px; 
    416 } 
     358.module-mmt-calendar td { 
     359    width: 14%; 
     360    height: 75px; 
     361    text-align: left; 
     362    vertical-align: top; 
     363} 
     364 
     365.day-photo { 
     366    width: 54px; 
     367    height: 54px; 
     368} 
     369 
     370.day-photo a { 
     371    display: block; 
     372} 
     373 
     374.day-photo a img { 
     375    width: 50px; 
     376    height: 50px; 
     377} 
  • trunk/StyleCatcher/plugins/StyleCatcher/lib/StyleCatcher.pm

    r7 r28  
     1# Copyright 2005-2006 Six Apart. This code cannot be redistributed without 
     2# permission from www.sixapart.com. 
     3# 
     4# $Id: StyleCatcher.pm 30483 2006-06-07 18:13:58Z lknowland $ 
     5 
    16package StyleCatcher; 
    27 
     
    712 
    813$VERSION = '1.01'; 
     14use vars qw($DEFAULT_STYLE_LIBRARY); 
    915 
    1016sub init { 
     
    2228} 
    2329 
     30sub init_request { 
     31    my $app = shift; 
     32    $app->SUPER::init_request(@_); 
     33    $DEFAULT_STYLE_LIBRARY ||= 'http://www.sixapart.com/movabletype/styles/library'; 
     34} 
     35 
    2436sub build_page { 
    2537    my $app = shift; 
    26     $_[1]->{plugin_static_uri} = $app->base . $app->static_path . $app->plugin->envelope . '/'; 
     38    my $plugin = $app->plugin; 
     39    if ($plugin) { 
     40        my $path = $app->static_path; 
     41        $path .= '/' unless $path =~ m!/$!; 
     42        $path .= $app->plugin->envelope . "/"; 
     43        $path = $app->base . $path if $path =~ m!^/!; 
     44        $_[1]->{plugin_static_uri} = $path; 
     45    } 
    2746    $app->SUPER::build_page(@_); 
     47} 
     48 
     49# passthru for L10N 
     50sub translate_templatized { 
     51    my $app = shift; 
     52    $app->plugin->translate_templatized(@_); 
    2853} 
    2954 
     
    3964    my $app = shift; 
    4065 
    41     my $config = $app->plugin->get_config_hash; 
     66    my $blog_id = $app->param('blog_id'); 
     67    my $config = $app->plugin->get_config_hash(); 
     68    my $blog_config; 
     69    if ($blog_id) { 
     70        $blog_config = $app->plugin->get_config_hash('blog:'.$blog_id); 
     71    } 
    4272    my $themeroot = $config->{themeroot}; 
    4373    my $webthemeroot = $config->{webthemeroot}; 
    44     return $app->error("Please configure the settings for this plugin before using it.") 
     74    return $app->error($app->plugin->translate("Before you can use StyleCatcher, you need to configure it from your System Overview menu. Simply click on 'Show Settings' to the right of the StyleCatcher module on the System Overview, follow the brief instructions for the settings, and click 'Save Changes'.")) 
    4575        unless $themeroot && $webthemeroot; 
    46  
    47     my $blog_id = $app->param('blog_id'); 
     76    my $stylelibrary = $blog_config ? $blog_config->{stylelibrary} || $DEFAULT_STYLE_LIBRARY : $DEFAULT_STYLE_LIBRARY; 
    4877 
    4978    my $theme_data = $app->make_themes; 
     
    83112        themes_json => JSON::objToJson($theme_data, {pretty => 1, indent => 2, delimiter => 1}), 
    84113        auto_fetch => $url ? 1 : 0, 
    85         last_theme_url => $url 
    86                       || 'http://www.sixapart.com/movabletype/styles/library', 
     114        last_theme_url => $url || $stylelibrary 
    87115    ); 
    88116 
     
    91119        $param{blog_name} = $blog->name; 
    92120        $param{blog_url} = $blog->site_url; 
    93         $app->add_breadcrumb(MT->translate("Main Menu"), $app->mt_uri); 
     121        $app->add_breadcrumb($app->plugin->translate("Main Menu"), $app->mt_uri); 
    94122        $app->add_breadcrumb($blog->name, $app->mt_uri(mode => 'menu', args => { blog_id => $blog_id })); 
    95         $app->add_breadcrumb(MT->translate('Templates'), $app->mt_uri(mode => 'list', args => { _type => 'template', blog_id => $blog_id })); 
     123        $app->add_breadcrumb($app->plugin->translate('Templates'), $app->mt_uri(mode => 'list', args => { _type => 'template', blog_id => $blog_id })); 
    96124    } else { 
    97         $app->add_breadcrumb(MT->translate("Main Menu"), $app->mt_uri); 
    98         $app->add_breadcrumb(MT->translate("System Overview"), $app->mt_uri(mode => 'admin')); 
    99         $app->add_breadcrumb(MT->translate("Plugins"), $app->mt_uri(mode => 'list_plugins')); 
     125        $app->add_breadcrumb($app->plugin->translate("Main Menu"), $app->mt_uri); 
     126        $app->add_breadcrumb($app->plugin->translate("System Overview"), $app->mt_uri(mode => 'admin')); 
     127        $app->add_breadcrumb($app->plugin->translate("Plugins"), $app->mt_uri(mode => 'list_plugins')); 
    100128    } 
    101129    $app->add_breadcrumb("StyleCatcher", $app->uri); 
     
    146174 
    147175    my $url = $app->param('url'); 
    148     my $sess = $app->session; 
    149176    my $data = $app->fetch_themes; 
    150177    $app->print(JSON::objToJson($data, {pretty => 1, indent => 2, delimiter => 1})); 
     
    196223        my $css_request = HTTP::Request->new( GET => $url ); 
    197224        my $response = $user_agent->request($css_request); 
    198   
     225 
    199226        # Pick up the thumbnail and thumbnail-large 
    200227        my $thumbnail_request = HTTP::Request->new( GET => $new_url."thumbnail.gif" ); 
     
    203230            "thumbnail-large.gif" ); 
    204231        my $thumbnail_large_response = $user_agent->request($thumbnail_large_request); 
    205      
     232 
    206233        # Parse out image filenames in the css and then write out the css file 
    207234        # and thumbnails to our theme folder 
    208         my @images = $response->content =~ m/(?<=url\().+(?=\))/g; 
     235        my $content = $response->content; 
     236        $content =~ s!/\*.*?\*/!!gs;  # strip all comments first 
     237        my @images = $content =~ m/\b(?:url\(\s*)([a-zA-Z0-9_.-]+\.(?:gif|jpe?g|png))(?:\s*?\))/gi; 
    209238        $filemgr->mkpath(File::Spec->catdir($sys_themeroot, $basename)) 
    210             or return $app->json_error("Could not create $basename folder - Check that your 'themes' folder is webserver-writable."); 
     239            or return $app->json_error($app->plugin->translate("Could not create [_1] folder - Check that your 'themes' folder is webserver-writable.", $basename)); 
    211240        $filemgr->put_data($response->content, 
    212241            File::Spec->catfile($sys_themeroot,$basename,$basename . '.css')); 
     
    215244        $filemgr->put_data($thumbnail_large_response->content, 
    216245            File::Spec->catfile($sys_themeroot, $basename, "thumbnail-large.gif"), 'upload'); 
    217   
     246 
    218247        # Pick up the images we parsed earlier and write them to the theme folder 
    219248        for my $image_url (@images) { 
     
    223252            my @image_url = split(/\//, $image_url); 
    224253            my $image_filename = $image_url[-1]; 
    225   
     254 
    226255            $filemgr->put_data($image_response->content, 
    227256                File::Spec->catfile($sys_themeroot, $basename, $image_filename), 'upload') 
     
    246275    } 
    247276    $url = "$webthemeroot/$basename/$basename.css"; 
    248    
     277    my $url2 = "$webthemeroot/base-weblog.css"; 
     278 
    249279    # Replacing the theme import or adding a new one at the beginning 
    250280    my $template_text = $tmpl->text(); 
     
    253283    my $header = '/* This is the StyleCatcher theme addition. Do not remove this block. */'; 
    254284    foreach my $template_line (@template_lines) { 
    255        if ($template_line =~ m!\Q$header\E!) { 
    256           $template_lines[$_+2] = "\@import url($url);"; 
    257           $replaced = 1; 
    258           last; 
    259        } 
     285        if ($template_line =~ m!\Q$header\E!) { 
     286            $template_lines[$_+1] = "\@import url($url2);"; 
     287            $template_lines[$_+2] = "\@import url($url);"; 
     288            $replaced = 1; 
     289            last; 
     290        } 
    260291    } 
    261292    unless ($replaced) {    
     
    277308        @template_lines = (<<EOT); 
    278309$header 
    279 \@import url($webthemeroot/base-weblog.css); 
     310\@import url($url2); 
    280311\@import url($url); 
    281312/* end StyleCatcher imports */ 
     
    296327    $app->send_http_header('text/plain'); 
    297328    $app->{no_print_body} = 1; 
    298     $app->print("Successfully applied new theme selection."); 
     329    $app->print($app->plugin->translate("Successfully applied new theme selection.")); 
    299330} 
    300331 
     
    404435                push @repo_themes, $css; 
    405436            } 
    406        
     437 
    407438            my $themes = []; 
    408439            for my $repo_theme (@repo_themes) { 
     
    431462    my $app = shift; 
    432463 
    433     # my $sess = $app->session; 
    434  
    435464    # categories 
    436465    #   current    (for active theme) 
     
    466495    #   } 
    467496 
    468     # if we have a themes structure in our session, then preload the 
    469     # catcher with that data. otherwise, leave it empty to signal to the 
    470     # catcher that it needs to invoke a request for it and load it "in the 
    471     # background". 
    472497    my ($categories, $themes); 
     498 
    473499    # Load our plugin data for the current theme and roots 
    474500    my $config = $app->plugin->get_config_hash; 
     
    558584        s/^\s+|\s+$//g; 
    559585        my ($key, $value) = split(/:/, $_) or next; 
     586        next unless defined $value; 
    560587        $value =~ s/^\s+//; 
    561588        $metadata{lc $key} = $value; 
  • trunk/StyleCatcher/plugins/StyleCatcher/stylecatcher.cgi

    r7 r28  
    11#!/usr/bin/perl -w 
    22 
     3# Copyright 2005-2006 Six Apart. This code cannot be redistributed without 
     4# permission from www.sixapart.com. 
     5# 
     6# $Id: stylecatcher.cgi 29585 2006-05-23 22:38:25Z gboggs $ 
     7 
    38use strict; 
    4 #use lib ($0 =~ m!(.*[/\\])! ? $1 . 'lib' : 'lib'), ($ENV{MT_HOME} ? "$ENV{MT_HOME}/lib" : $1 ? "$1../../lib" : "../../lib"); 
    59use lib "lib", ($ENV{MT_HOME} ? "$ENV{MT_HOME}/lib" : "../../lib");  
    610use MT::Bootstrap App => 'StyleCatcher'; 
  • trunk/StyleCatcher/plugins/StyleCatcher/stylecatcher.pl

    r7 r28  
     1# Copyright 2005-2006 Six Apart. This code cannot be redistributed without 
     2# permission from www.sixapart.com. 
     3# 
     4# $Id: stylecatcher.pl 29394 2006-05-22 10:42:39Z fyoshimatsu $ 
     5 
    16package MT::Plugin::StyleCatcher; 
    27 
     
    611$VERSION = '1.01'; 
    712 
    8 my $plugin = MT::Plugin::StyleCatcher->new({ 
     13my $plugin; 
     14$plugin = MT::Plugin::StyleCatcher->new({ 
    915    name => "StyleCatcher", 
    1016    version => $VERSION, 
    11     description => q{StyleCatcher lets you easily browse through styles and then apply them to your blog in just a few clicks. To find out more about Movable Type styles, or for new sources for styles, visit the <a href="http://www.sixapart.com/movabletype/styles">Movable Type styles</a> page.}, 
    1217    doc_link => "http://www.sixapart.com/movabletype/styles/", 
     18    description => "<MT_TRANS phrase=\"StyleCatcher lets you easily browse through styles and then apply them to your blog in just a few clicks. To find out more about Movable Type styles, or for new sources for styles, visit the <a href='http://www.sixapart.com/movabletype/styles'>Movable Type styles</a> page.\">", 
    1319    config_link => "stylecatcher.cgi", 
    1420    author_name => "Nick O'Neil, Brad Choate", 
    1521    author_link => "http://www.authenticgeek.net/", 
     22    l10n_class => 'StyleCatcher::L10N', 
    1623    config_template => \&configuration_template, 
    1724    settings => new MT::PluginSettings([ 
    1825        ['webthemeroot'], 
    1926        ['themeroot'], 
     27        ['stylelibrary'], 
    2028    ]), 
    2129}); 
    2230MT->add_plugin($plugin); 
    2331MT->add_plugin_action('list_template', 'stylecatcher.cgi', 'Select a Design using StyleCatcher'); 
     32 
    2433sub instance { $plugin } 
    2534 
     
    3039    my $intro; 
    3140    if ($scope eq 'system') { 
    32         $param->{webthemeroot} ||= MT->instance->static_path; 
     41        if (!$param->{webthemeroot}) { 
     42            $param->{webthemeroot} = MT->instance->static_path; 
     43            $param->{webthemeroot} =~ s!/$!!; 
     44            $param->{webthemeroot} .= '/themes/'; 
     45        } 
    3346        $param->{themeroot} ||= File::Spec->catdir(MT->instance->mt_dir, 'mt-static', 'themes'); 
    34         $intro = q{ 
    35 You must define a global theme repository where themes can be stored locally. 
    36 If a particular blog has not been configured for it's own theme paths, it will 
    37 use these settings. If a blog has it's own theme paths, then the theme will 
    38 be copied to that location when applied to that weblog.}; 
     47        $param->{stylelibrary} ||= $StyleCatcher::DEFAULT_STYLE_LIBRARY; 
     48        $intro = q{<MT_TRANS phrase="You must define a global theme repository where themes can be stored locally.  If a particular blog has not been configured for it's own theme paths, it will use these settings. If a blog has it's own theme paths, then the theme will be copied to that location when applied to that weblog.">}; 
    3949    } else { 
    4050        if (my $blog = MT->instance->blog) { 
     
    5161            } 
    5262        } 
    53         $intro = q{Your theme URL and path can be customized for this 
    54         weblog.}; 
     63        $intro = q{<MT_TRANS phrase="Your theme URL and path can be customized for this weblog.">}; 
    5564    } 
    5665 
     
    5867<p> 
    5968$intro 
    60 The paths defined here must physically exist and be 
    61 writable by the webserver. 
     69<MT_TRANS phrase="The paths defined here must physically exist and be writable by the webserver."> 
    6270</p> 
    6371 
    6472<div class="setting"> 
    65 <div class="label"><label for="stycat_webthemeroot">Theme Root URL:</label></div> 
     73<div class="label"><label for="stycat_webthemeroot"><MT_TRANS phrase="Theme Root URL:"></label></div> 
    6674<div class="field"> 
    6775<input type="text" name="webthemeroot" id="stycat_webthemeroot" value="<TMPL_VAR NAME=WEBTHEMEROOT ESCAPE=HTML>" style="width: 95%" /> 
     
    7078 
    7179<div class="setting"> 
    72 <div class="label"><label for="stycat_themeroot">Theme Root Path:</label></div> 
     80<div class="label"><label for="stycat_themeroot"><MT_TRANS phrase="Theme Root Path:"></label></div> 
    7381<div class="field"> 
    7482<input type="text" name="themeroot" id="stycat_themeroot" value="<TMPL_VAR NAME=THEMEROOT ESCAPE=HTML>" style="width: 95%" /> 
     83</div> 
     84</div> 
     85 
     86<div class="setting"> 
     87<div class="label"><label for="stycat_stylelibrary"><MT_TRANS phrase="Style Library URL:"></label></div> 
     88<div class="field"> 
     89<input type="text" name="stylelibrary" id="stycat_stylelibrary" value="<TMPL_VAR NAME=STYLELIBRARY ESCAPE=HTML>" style="width: 95%" /> 
    7590</div> 
    7691</div> 
     
    92107                                               "base-weblog.css"); 
    93108    my $base_weblog = $filemgr->get_data($base_weblog_path); 
    94     $filemgr->mkpath($app->param('themeroot')) 
    95         or die "Unable to create the theme root directory. Error: " . $filemgr->errstr; 
     109    $filemgr->mkpath($param->{themeroot}) 
     110        or die $plugin->translate("Unable to create the theme root directory. Error: [_1]", $filemgr->errstr); 
    96111 
    97112    defined($filemgr->put_data($base_weblog, 
    98         File::Spec->catfile($app->param('themeroot'), "base-weblog.css"))) 
    99         or die "Unable to write base-weblog.css to themeroot. File Manager gave the error: ".$filemgr->errstr.". Are you sure your theme root directory is web-server writable?"; 
     113        File::Spec->catfile($param->{themeroot}, "base-weblog.css"))) 
     114        or die $plugin->translate("Unable to write base-weblog.css to themeroot. File Manager gave the error: [_1]. Are you sure your theme root directory is web-server writable?", $filemgr->errstr); 
    100115 
    101116    return $plugin->SUPER::save_config(@_); 
  • trunk/StyleCatcher/plugins/StyleCatcher/tmpl/header.tmpl

    r7 r28  
    2222            <div id="topnav-links"> 
    2323               <div class="leftcol"> 
    24                   <a href="<TMPL_VAR NAME=MT_URL>">Main Menu</a> 
     24                  <a href="<TMPL_VAR NAME=MT_URL>"><MT_TRANS phrase="Main Menu"></a> 
    2525                  &nbsp;|&nbsp; 
    26                   <a href="<TMPL_VAR NAME=MT_URL>?__mode=admin">System Overview</a> 
     26                  <a href="<TMPL_VAR NAME=MT_URL>?__mode=admin"><MT_TRANS phrase="System Overview"></a> 
    2727                  &nbsp;|&nbsp; 
    28                   <a href="<TMPL_VAR NAME=HELP_URL>">Help</a> 
     28                  <a href="<TMPL_VAR NAME=HELP_URL>"><MT_TRANS phrase="Help"></a> 
    2929               </div> 
    3030               <div class="rightcol"> 
    31                   Welcome 
     31                  <MT_TRANS phrase="Welcome"> 
    3232                  <a href="<TMPL_VAR NAME=MT_URL>?__mode=view&amp;_type=author&amp;id=<TMPL_VAR NAME=AUTHOR_ID>"><TMPL_VAR NAME=AUTHOR_NAME></a> 
    3333                  &nbsp;|&nbsp; 
    34                   <a href="<TMPL_VAR NAME=MT_URL>?__mode=logout">Logout</a> 
     34                  <a href="<TMPL_VAR NAME=MT_URL>?__mode=logout"><MT_TRANS phrase="Logout"></a> 
    3535               </div> 
    3636            </div> 
  • trunk/StyleCatcher/plugins/StyleCatcher/tmpl/view.tmpl

    r7 r28  
    109109                         
    110110                        if( titleElement ) 
    111                             titleElement.innerHTML = element.firstChild.nextSibling.innerHTML; 
     111                            titleElement.innerHTML = trans(element.firstChild.nextSibling.innerHTML); 
    112112                        if (element.title.match(/^https?:/)) { 
    113113                            var url_element = getByID("repo-url"); 
     
    160160                var blog_id = sel.options[sel.selectedIndex].value; 
    161161                if (!blog_id) { 
    162                     alert("Please select a weblog to apply this theme."); 
     162                    alert("<MT_TRANS phrase="Please select a weblog to apply this theme.">"); 
    163163                    return; 
    164164                } 
     
    169169                selected = mixer.name; 
    170170                if (!selected) { 
    171                     alert("Please click on a theme before attempting to apply a new design to your blog."); 
     171                    alert("<MT_TRANS phrase="Please click on a theme before attempting to apply a new design to your blog.">"); 
    172172                    return; 
    173173                } 
     
    175175 
    176176                btn.disabled = true; 
    177                 btn.value = "Applying..."; 
     177                btn.value = "<MT_TRANS phrase="Applying...">"; 
    178178                selected_blog_id = blog_id; 
    179179                var client = TC.Client.call({ 
     
    242242                chooseCategory('category-current'); 
    243243                if (!btn) return; 
    244                 btn.value = "Choose this Design"; 
     244                btn.value = "<MT_TRANS phrase="Choose this Design">"; 
    245245                btn.disabled = false; 
    246246                alert(result); 
     
    257257                    data = eval('('+styles+')'); 
    258258                } catch (e) { 
    259                     alert("Error loading themes! -- " + styles); 
    260                     btn.value = "Find Style"; 
     259                    alert(trans("Error loading themes! -- [_1]", styles)); 
     260                    btn.value = "<MT_TRANS phrase="Find Style">"; 
    261261                    btn.disabled = false; 
    262262                    return; 
     
    373373                if (!btn) return; 
    374374                btn.disabled = true; 
    375                 btn.value = "Loading..."; 
     375                btn.value = "<MT_TRANS phrase="Loading...">"; 
    376376 
    377377                var el = getByID('repo-url'); 
     
    396396<TMPL_IF NAME=BLOG_LOOP> 
    397397 
    398             <p>StyleCatcher lets you easily browse through styles and 
    399             then apply them to your blog in just a few clicks. To find 
    400             out more about Movable Type styles, or for new sources for 
    401             styles, visit the <a 
    402 href="http://www.sixapart.com/movabletype/styles">Movable Type 
    403 styles</a> 
    404             page.<TMPL_IF NAME=CONFIG_LINK> To change the location of 
    405             your local theme repository, <a href="<TMPL_VAR NAME=CONFIG_LINK>">click here</a>.</TMPL_IF></p> 
     398         <p><MT_TRANS phrase="StyleCatcher lets you easily browse through styles and then apply them to your blog in just a few clicks. To find out more about Movable Type styles, or for new sources for styles, visit the <a href='http://www.sixapart.com/movabletype/styles'>Movable Type styles</a> page."> 
     399         <TMPL_IF NAME=CONFIG_LINK><MT_TRANS phrase=" To change the location of your local theme repository, "><a href="<TMPL_VAR NAME=CONFIG_LINK>"><MT_TRANS phrase="click here."></a></TMPL_IF></p> 
    406400 
    407401           <script type="text/javascript"> 
    408               document.writeln('<p>Install <a href="http://greasemonkey.mozdev.org/">GreaseMonkey</a> <a href="<TMPL_VAR NAME=SCRIPT_URL>?__mode=gm<TMPL_IF NAME=BLOG_ID>&amp;blog_id=<TMPL_VAR NAME=BLOG_ID></TMPL_IF>;file=stylecatcher.user.js">StyleCatcher user script</a>.</p>'); 
     402           if(navigator.userAgent.indexOf("Firefox")!=-1){ 
     403           var versionindex=navigator.userAgent.indexOf("Firefox")+8 
     404              document.writeln("<p><MT_TRANS phrase="Install <a href='http://greasemonkey.mozdev.org/'>GreaseMonkey</a> "> <a href='<TMPL_VAR NAME=SCRIPT_URL>?__mode=gm<TMPL_IF NAME=BLOG_ID>&amp;blog_id=<TMPL_VAR NAME=BLOG_ID></TMPL_IF>;file=stylecatcher.user.js'><MT_TRANS phrase="StyleCatcher user script."></a></p>"); 
     405           } 
    409406           </script> 
    410407 
    411408           <form method="get" action="<TMPL_VAR NAME=SCRIPT_URL>"> 
    412               Theme or Repository URL: 
    413               <input class="repo-url" name="url" id="repo-url" value="<TMPL_VAR NAME=LAST_THEME_URL>" /> 
    414               <input type="button" id="find-button" value="Find Style" onclick="getStyles()" /> 
     409              <MT_TRANS phrase="<strong>Theme or Repository URL:</strong>"> 
     410              <input class="repo-url" style="width:350px;" name="url" id="repo-url" value="<TMPL_VAR NAME=LAST_THEME_URL>" /> 
     411              <input type="button" id="find-button" value="<MT_TRANS phrase="Find Style">" onclick="getStyles()" /> 
    415412           </form> 
    416                          
     413            <p><MT_TRANS phrase="<strong>NOTE:</strong> It will take a moment for themes to populate once you click 'Find Style'."></p>  
    417414            <p id="status-message" class="message" style="display: none"></p> 
    418415             
    419416            <div id="template-picker"> 
    420417                <div id="categories-wrapper"> 
    421                     <h2>Categories</h2> 
     418                    <h2><MT_TRANS phrase="Categories"></h2> 
    422419                    <div class="scrollbox" id="categories"> 
    423420<TMPL_IF NAME=SINGLE_BLOG> 
    424                         <div class="category" id="category-current" title="Current theme for your weblog" style="display: none"><img src="<TMPL_VAR NAME=PLUGIN_STATIC_URI>images/top-rated.gif" alt="Your Current Theme" /><span>Current Theme</span> 
     421                        <div class="category" id="category-current" title="<MT_TRANS phrase="Current theme for your weblog">" style="display: none"><img src="<TMPL_VAR NAME=PLUGIN_STATIC_URI>images/top-rated.gif" alt="Your Current Theme" /><span><MT_TRANS phrase="Current Theme"></span> 
    425422<TMPL_ELSE> 
    426                         <div class="category" id="category-current" title="Current themes for your weblogs" style="display: none"><img src="<TMPL_VAR NAME=PLUGIN_STATIC_URI>images/top-rated.gif" alt="Your Current Themes" /><span>Current Themes</span> 
     423                        <div class="category" id="category-current" title="<MT_TRANS phrase="Current themes for your weblogs">" style="display: none"><img src="<TMPL_VAR NAME=PLUGIN_STATIC_URI>images/top-rated.gif" alt="Your Current Themes" /><span><MT_TRANS phrase="Current Themes"></span> 
    427424</TMPL_IF> 
    428425                        </div> 
    429                         <div class="category" id="category-my-designs" title="Locally saved themes" style="display: none"><img src="<TMPL_VAR NAME=PLUGIN_STATIC_URI>images/my-designs.gif" alt="my-designs" /><span>Saved Themes</span> 
     426                        <div class="category" id="category-my-designs" title="<MT_TRANS phrase="Locally saved themes">" style="display: none"><img src="<TMPL_VAR NAME=PLUGIN_STATIC_URI>images/my-designs.gif" alt="my-designs" /><span><MT_TRANS phrase="Saved Themes"></span> 
    430427                        </div> 
    431                         <div class="category" id="category-more" title="Single themes from the web" style="display: none"><img src="<TMPL_VAR NAME=PLUGIN_STATIC_URI>images/featured.gif" alt="my-designs" /><span>More Themes</span> 
     428                        <div class="category" id="category-more" title="<MT_TRANS phrase="Single themes from the web">" style="display: none"><img src="<TMPL_VAR NAME=PLUGIN_STATIC_URI>images/featured.gif" alt="my-designs" /><span><MT_TRANS phrase="More Themes"></span> 
    432429                        </div> 
    433430                    </div> 
     
    435432 
    436433                <div id="templates-wrapper"> 
    437                     <h2 id="selected-category-title">Templates</h2> 
     434                    <h2 id="selected-category-title"><MT_TRANS phrase="Templates"></h2> 
    438435                    <div class="scrollbox" id="display-current" style="display: none;"></div> 
    439436                    <div class="scrollbox" id="display-my-designs" style="display: none;"></div> 
     
    442439 
    443440                <div id="details-wrapper" style="display: none"> 
    444                     <h2>Details</h2> 
     441                    <h2><MT_TRANS phrase="Details"></h2> 
    445442                    <div id="display-details"> 
    446443                        <div class="tc-mixer-entry"></div> 
     
    448445                </div> 
    449446 
    450                 <a id="show-details" href="javascript:void(0);" onclick="return showDetails( true );" style="display: none">Show Details</a> 
    451                 <a id="hide-details" href="javascript:void(0);" onclick="return showDetails( false );" style="display: none">Hide Details</a> 
     447                <a id="show-details" href="javascript:void(0);" onclick="return showDetails( true );" style="display: none"><MT_TRANS phrase="Show Details"></a> 
     448                <a id="hide-details" href="javascript:void(0);" onclick="return showDetails( false );" style="display: none"><MT_TRANS phrase="Hide Details"></a> 
    452449            </div> 
    453450             
     
    457454<TMPL_UNLESS NAME=SINGLE_BLOG> 
    458455            <select name="blog_id" id="select-blog"> 
    459             <option value="">Select a Weblog...</option> 
     456            <option value=""><MT_TRANS phrase="Select a Weblog..."></option> 
    460457            <TMPL_LOOP NAME=BLOG_LOOP> 
    461458            <option value="<TMPL_VAR NAME=BLOG_ID>"><TMPL_VAR NAME=BLOG_NAME></option> 
     
    464461</TMPL_UNLESS> 
    465462 
    466             <input type="button" name="choose" id="apply-button" onclick="applyDesign()" value="Choose this Design" /> 
     463            <input type="button" name="choose" id="apply-button" onclick="applyDesign()" value="<MT_TRANS phrase="Apply Selected Design">" /> 
    467464            </div> 
    468465            <br class="clr" /> 
     
    472469 
    473470<p class="message"> 
    474 You don't appear to have any weblogs with a "styles-site.css" template that 
    475 you have rights to edit. Please check your weblog(s) for this template. 
     471<MT_TRANS phrase="You don't appear to have any weblogs with a "styles-site.css" template that you have rights to edit. Please check your weblog(s) for this template."> 
    476472</p> 
    477473