Changeset 28
- Timestamp:
- 06/08/06 17:09:47 (4 years ago)
- Location:
- trunk/StyleCatcher/plugins/StyleCatcher
- Files:
-
- 5 added
- 6 modified
-
base-weblog.css (modified) (18 diffs)
-
lib/StyleCatcher (added)
-
lib/StyleCatcher.pm (modified) (19 diffs)
-
lib/StyleCatcher/L10N (added)
-
lib/StyleCatcher/L10N.pm (added)
-
lib/StyleCatcher/L10N/en_us.pm (added)
-
lib/StyleCatcher/L10N/ja.pm (added)
-
stylecatcher.cgi (modified) (1 diff)
-
stylecatcher.pl (modified) (7 diffs)
-
tmpl/header.tmpl (modified) (1 diff)
-
tmpl/view.tmpl (modified) (14 diffs)
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 $ */ 2 2 3 3 /* basic elements */ 4 4 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; 5 html { 6 margin: 0; 7 /* setting border: 0 hoses ie6 win window inner well border */ 8 padding: 0; 9 } 10 11 body { 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; 19 17 } 20 18 … … 24 22 25 23 h1, 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; 24 h1, h2, h3, h4, h5, h6, p, ol, ul, pre, blockquote { 25 margin-top: 10px; 26 margin-bottom: 10px; 30 27 } 31 28 … … 33 30 /* standard helper classes */ 34 31 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; 46 42 } 47 43 48 44 /* .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; 58 53 } 59 54 * html .pkg { display: inline-block; } … … 68 63 body { text-align: center; } /* center on ie */ 69 64 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; 76 70 } 77 71 #container-inner { position: static; width: auto; } … … 83 77 #pagebody-inner { position: static; width: 100%; } 84 78 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; 91 84 } 92 85 93 86 #delta { float: right; } 94 87 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; 98 90 } 99 91 … … 101 93 /* banner user/photo */ 102 94 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; 132 121 } 133 122 … … 135 124 /* content */ 136 125 137 .content-nav 138 { 139 margin: 10px; 140 text-align: center; 126 .content-nav { 127 margin: 10px; 128 text-align: center; 141 129 } 142 130 143 131 .date-header, 144 .entry-content 145 { 146 position: static; 147 clear: both; 132 .entry-content { 133 position: static; 134 clear: both; 148 135 } 149 136 … … 151 138 .trackbacks, 152 139 .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; 160 146 } 161 147 … … 165 151 .comment-content, 166 152 .comments-open-content, 167 .comments-closed 168 { 169 clear: both; 170 margin: 5px 10px; 153 .comments-closed { 154 clear: both; 171 155 } 172 156 … … 174 158 .entry-body, 175 159 .entry-more-link, 176 .entry-more 177 { 178 clear: both; 160 .entry-more { 161 clear: both; 179 162 } 180 163 … … 183 166 .comment-footer, 184 167 .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; 189 171 } 190 172 191 173 .comments-open label { display: block; } 192 174 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; 207 190 } 208 191 209 192 img.image-full { width: 100%; } 210 193 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; 223 204 } 224 205 … … 226 207 /* modules */ 227 208 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; 239 218 } 240 219 241 220 .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; 253 230 } 254 231 … … 258 235 .module-wishlist .module-content { text-align: center; } 259 236 260 .module-calendar .module-content table 261 { 262 border-collapse: collapse; 237 .module-calendar .module-content table { 238 border-collapse: collapse; 263 239 } 264 240 265 241 .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; 270 245 } 271 246 272 247 .typelist-thumbnailed { margin: 0 0 20px 0; } 273 248 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; 279 253 } 280 254 281 255 /* 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; 291 264 } 292 265 * html .typelist-thumbnailed .module-list-item { display: inline-block; } … … 296 269 /* */ 297 270 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; 307 279 } 308 280 … … 311 283 .module-galleries .typelist-thumbnail img { width: 50px; } 312 284 313 .typelist-description 314 { 315 margin: 0; 316 padding: 5px; 285 .typelist-description { 286 margin: 0; 287 padding: 5px; 317 288 } 318 289 319 290 .module-featured-photo .module-content, 320 .module-photo .module-content 321 { 322 margin: 0; 291 .module-photo .module-content { 292 margin: 0; 323 293 } 324 294 … … 327 297 .module-recent-photos { margin: 0 0 15px 0; } 328 298 .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; 337 306 } 338 307 339 308 /* 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; 349 317 } 350 318 * html .module-recent-photos .module-list { display: inline-block; } … … 354 322 /* */ 355 323 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; 380 345 } 381 346 … … 391 356 .module-mmt-calendar th { text-align: left; } 392 357 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 1 6 package StyleCatcher; 2 7 … … 7 12 8 13 $VERSION = '1.01'; 14 use vars qw($DEFAULT_STYLE_LIBRARY); 9 15 10 16 sub init { … … 22 28 } 23 29 30 sub init_request { 31 my $app = shift; 32 $app->SUPER::init_request(@_); 33 $DEFAULT_STYLE_LIBRARY ||= 'http://www.sixapart.com/movabletype/styles/library'; 34 } 35 24 36 sub build_page { 25 37 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 } 27 46 $app->SUPER::build_page(@_); 47 } 48 49 # passthru for L10N 50 sub translate_templatized { 51 my $app = shift; 52 $app->plugin->translate_templatized(@_); 28 53 } 29 54 … … 39 64 my $app = shift; 40 65 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 } 42 72 my $themeroot = $config->{themeroot}; 43 73 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'.")) 45 75 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; 48 77 49 78 my $theme_data = $app->make_themes; … … 83 112 themes_json => JSON::objToJson($theme_data, {pretty => 1, indent => 2, delimiter => 1}), 84 113 auto_fetch => $url ? 1 : 0, 85 last_theme_url => $url 86 || 'http://www.sixapart.com/movabletype/styles/library', 114 last_theme_url => $url || $stylelibrary 87 115 ); 88 116 … … 91 119 $param{blog_name} = $blog->name; 92 120 $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); 94 122 $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 })); 96 124 } 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')); 100 128 } 101 129 $app->add_breadcrumb("StyleCatcher", $app->uri); … … 146 174 147 175 my $url = $app->param('url'); 148 my $sess = $app->session;149 176 my $data = $app->fetch_themes; 150 177 $app->print(JSON::objToJson($data, {pretty => 1, indent => 2, delimiter => 1})); … … 196 223 my $css_request = HTTP::Request->new( GET => $url ); 197 224 my $response = $user_agent->request($css_request); 198 225 199 226 # Pick up the thumbnail and thumbnail-large 200 227 my $thumbnail_request = HTTP::Request->new( GET => $new_url."thumbnail.gif" ); … … 203 230 "thumbnail-large.gif" ); 204 231 my $thumbnail_large_response = $user_agent->request($thumbnail_large_request); 205 232 206 233 # Parse out image filenames in the css and then write out the css file 207 234 # 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; 209 238 $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)); 211 240 $filemgr->put_data($response->content, 212 241 File::Spec->catfile($sys_themeroot,$basename,$basename . '.css')); … … 215 244 $filemgr->put_data($thumbnail_large_response->content, 216 245 File::Spec->catfile($sys_themeroot, $basename, "thumbnail-large.gif"), 'upload'); 217 246 218 247 # Pick up the images we parsed earlier and write them to the theme folder 219 248 for my $image_url (@images) { … … 223 252 my @image_url = split(/\//, $image_url); 224 253 my $image_filename = $image_url[-1]; 225 254 226 255 $filemgr->put_data($image_response->content, 227 256 File::Spec->catfile($sys_themeroot, $basename, $image_filename), 'upload') … … 246 275 } 247 276 $url = "$webthemeroot/$basename/$basename.css"; 248 277 my $url2 = "$webthemeroot/base-weblog.css"; 278 249 279 # Replacing the theme import or adding a new one at the beginning 250 280 my $template_text = $tmpl->text(); … … 253 283 my $header = '/* This is the StyleCatcher theme addition. Do not remove this block. */'; 254 284 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 } 260 291 } 261 292 unless ($replaced) { … … 277 308 @template_lines = (<<EOT); 278 309 $header 279 \@import url($ webthemeroot/base-weblog.css);310 \@import url($url2); 280 311 \@import url($url); 281 312 /* end StyleCatcher imports */ … … 296 327 $app->send_http_header('text/plain'); 297 328 $app->{no_print_body} = 1; 298 $app->print( "Successfully applied new theme selection.");329 $app->print($app->plugin->translate("Successfully applied new theme selection.")); 299 330 } 300 331 … … 404 435 push @repo_themes, $css; 405 436 } 406 437 407 438 my $themes = []; 408 439 for my $repo_theme (@repo_themes) { … … 431 462 my $app = shift; 432 463 433 # my $sess = $app->session;434 435 464 # categories 436 465 # current (for active theme) … … 466 495 # } 467 496 468 # if we have a themes structure in our session, then preload the469 # catcher with that data. otherwise, leave it empty to signal to the470 # catcher that it needs to invoke a request for it and load it "in the471 # background".472 497 my ($categories, $themes); 498 473 499 # Load our plugin data for the current theme and roots 474 500 my $config = $app->plugin->get_config_hash; … … 558 584 s/^\s+|\s+$//g; 559 585 my ($key, $value) = split(/:/, $_) or next; 586 next unless defined $value; 560 587 $value =~ s/^\s+//; 561 588 $metadata{lc $key} = $value; -
trunk/StyleCatcher/plugins/StyleCatcher/stylecatcher.cgi
r7 r28 1 1 #!/usr/bin/perl -w 2 2 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 3 8 use strict; 4 #use lib ($0 =~ m!(.*[/\\])! ? $1 . 'lib' : 'lib'), ($ENV{MT_HOME} ? "$ENV{MT_HOME}/lib" : $1 ? "$1../../lib" : "../../lib");5 9 use lib "lib", ($ENV{MT_HOME} ? "$ENV{MT_HOME}/lib" : "../../lib"); 6 10 use 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 1 6 package MT::Plugin::StyleCatcher; 2 7 … … 6 11 $VERSION = '1.01'; 7 12 8 my $plugin = MT::Plugin::StyleCatcher->new({ 13 my $plugin; 14 $plugin = MT::Plugin::StyleCatcher->new({ 9 15 name => "StyleCatcher", 10 16 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.},12 17 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.\">", 13 19 config_link => "stylecatcher.cgi", 14 20 author_name => "Nick O'Neil, Brad Choate", 15 21 author_link => "http://www.authenticgeek.net/", 22 l10n_class => 'StyleCatcher::L10N', 16 23 config_template => \&configuration_template, 17 24 settings => new MT::PluginSettings([ 18 25 ['webthemeroot'], 19 26 ['themeroot'], 27 ['stylelibrary'], 20 28 ]), 21 29 }); 22 30 MT->add_plugin($plugin); 23 31 MT->add_plugin_action('list_template', 'stylecatcher.cgi', 'Select a Design using StyleCatcher'); 32 24 33 sub instance { $plugin } 25 34 … … 30 39 my $intro; 31 40 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 } 33 46 $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.">}; 39 49 } else { 40 50 if (my $blog = MT->instance->blog) { … … 51 61 } 52 62 } 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.">}; 55 64 } 56 65 … … 58 67 <p> 59 68 $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."> 62 70 </p> 63 71 64 72 <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> 66 74 <div class="field"> 67 75 <input type="text" name="webthemeroot" id="stycat_webthemeroot" value="<TMPL_VAR NAME=WEBTHEMEROOT ESCAPE=HTML>" style="width: 95%" /> … … 70 78 71 79 <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> 73 81 <div class="field"> 74 82 <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%" /> 75 90 </div> 76 91 </div> … … 92 107 "base-weblog.css"); 93 108 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); 96 111 97 112 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); 100 115 101 116 return $plugin->SUPER::save_config(@_); -
trunk/StyleCatcher/plugins/StyleCatcher/tmpl/header.tmpl
r7 r28 22 22 <div id="topnav-links"> 23 23 <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> 25 25 | 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> 27 27 | 28 <a href="<TMPL_VAR NAME=HELP_URL>"> Help</a>28 <a href="<TMPL_VAR NAME=HELP_URL>"><MT_TRANS phrase="Help"></a> 29 29 </div> 30 30 <div class="rightcol"> 31 Welcome31 <MT_TRANS phrase="Welcome"> 32 32 <a href="<TMPL_VAR NAME=MT_URL>?__mode=view&_type=author&id=<TMPL_VAR NAME=AUTHOR_ID>"><TMPL_VAR NAME=AUTHOR_NAME></a> 33 33 | 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> 35 35 </div> 36 36 </div> -
trunk/StyleCatcher/plugins/StyleCatcher/tmpl/view.tmpl
r7 r28 109 109 110 110 if( titleElement ) 111 titleElement.innerHTML = element.firstChild.nextSibling.innerHTML;111 titleElement.innerHTML = trans(element.firstChild.nextSibling.innerHTML); 112 112 if (element.title.match(/^https?:/)) { 113 113 var url_element = getByID("repo-url"); … … 160 160 var blog_id = sel.options[sel.selectedIndex].value; 161 161 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.">"); 163 163 return; 164 164 } … … 169 169 selected = mixer.name; 170 170 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.">"); 172 172 return; 173 173 } … … 175 175 176 176 btn.disabled = true; 177 btn.value = " Applying...";177 btn.value = "<MT_TRANS phrase="Applying...">"; 178 178 selected_blog_id = blog_id; 179 179 var client = TC.Client.call({ … … 242 242 chooseCategory('category-current'); 243 243 if (!btn) return; 244 btn.value = " Choose this Design";244 btn.value = "<MT_TRANS phrase="Choose this Design">"; 245 245 btn.disabled = false; 246 246 alert(result); … … 257 257 data = eval('('+styles+')'); 258 258 } 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">"; 261 261 btn.disabled = false; 262 262 return; … … 373 373 if (!btn) return; 374 374 btn.disabled = true; 375 btn.value = " Loading...";375 btn.value = "<MT_TRANS phrase="Loading...">"; 376 376 377 377 var el = getByID('repo-url'); … … 396 396 <TMPL_IF NAME=BLOG_LOOP> 397 397 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> 406 400 407 401 <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>&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>&blog_id=<TMPL_VAR NAME=BLOG_ID></TMPL_IF>;file=stylecatcher.user.js'><MT_TRANS phrase="StyleCatcher user script."></a></p>"); 405 } 409 406 </script> 410 407 411 408 <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()" /> 415 412 </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> 417 414 <p id="status-message" class="message" style="display: none"></p> 418 415 419 416 <div id="template-picker"> 420 417 <div id="categories-wrapper"> 421 <h2> Categories</h2>418 <h2><MT_TRANS phrase="Categories"></h2> 422 419 <div class="scrollbox" id="categories"> 423 420 <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> 425 422 <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> 427 424 </TMPL_IF> 428 425 </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> 430 427 </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> 432 429 </div> 433 430 </div> … … 435 432 436 433 <div id="templates-wrapper"> 437 <h2 id="selected-category-title"> Templates</h2>434 <h2 id="selected-category-title"><MT_TRANS phrase="Templates"></h2> 438 435 <div class="scrollbox" id="display-current" style="display: none;"></div> 439 436 <div class="scrollbox" id="display-my-designs" style="display: none;"></div> … … 442 439 443 440 <div id="details-wrapper" style="display: none"> 444 <h2> Details</h2>441 <h2><MT_TRANS phrase="Details"></h2> 445 442 <div id="display-details"> 446 443 <div class="tc-mixer-entry"></div> … … 448 445 </div> 449 446 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> 452 449 </div> 453 450 … … 457 454 <TMPL_UNLESS NAME=SINGLE_BLOG> 458 455 <select name="blog_id" id="select-blog"> 459 <option value=""> Select a Weblog...</option>456 <option value=""><MT_TRANS phrase="Select a Weblog..."></option> 460 457 <TMPL_LOOP NAME=BLOG_LOOP> 461 458 <option value="<TMPL_VAR NAME=BLOG_ID>"><TMPL_VAR NAME=BLOG_NAME></option> … … 464 461 </TMPL_UNLESS> 465 462 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">" /> 467 464 </div> 468 465 <br class="clr" /> … … 472 469 473 470 <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."> 476 472 </p> 477 473
