Changeset 2813
- Timestamp:
- 07/18/08 18:43:15 (1 month ago)
- Files:
-
- branches/release-41/mt-static/js/tc/mixer/display.js (modified) (3 diffs)
- branches/release-41/mt-static/plugins/StyleCatcher/templates.css (modified) (1 diff)
- branches/release-41/mt-static/themes/hills-dusk/screen.css (modified) (1 diff)
- branches/release-41/plugins/StyleCatcher/lib/StyleCatcher/CMS.pm (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/release-41/mt-static/js/tc/mixer/display.js
r2812 r2813 53 53 "description" : "Description:", 54 54 "author" : "Author:", 55 "tags" : "Tags:", 56 "url" : "CSS File", 57 "props_url" : "Donate" 55 "tags" : "Tags:" 56 ,"url" : "URL:" 58 57 }; 59 58 … … 228 227 // get natural language label 229 228 var epLabel = this.entryProperties[ ep ]; 230 var epValue = entry[ ep ]; 231 232 if( epValue == null ) 233 continue; 229 var epValue = entry[ ep ] || " "; 234 230 235 231 // fix array values 236 232 if( epValue.join ) 237 epValue = epValue.join( ", " );233 epValue = epValue.join( ", " ); 238 234 239 235 // only handle strings 240 236 if( typeof( epValue ) != "string" ) 241 continue;237 continue; 242 238 243 239 // property … … 246 242 props.appendChild( prop ); 247 243 244 // label 245 var label = this.document.createElement( "span" ); 246 label.className = "label"; 247 label.appendChild( this.document.createTextNode( epLabel ) ); 248 prop.appendChild( label ); 249 248 250 // content 249 251 var content = this.document.createElement( "span" ); 250 252 content.className = "content"; 251 if ( ep .match(/(_|^)url$/)) {253 if ( epLabel == "URL:") { 252 254 var link = this.document.createElement( "a" ); 253 255 link.href = epValue; 254 var link_text = this.document.createElement( "span" ); 255 link_text.appendChild( this.document.createTextNode( epLabel ) ); 256 link.appendChild( link_text ); 256 link.appendChild( this.document.createTextNode( "CSS File" )); 257 257 content.appendChild( link ); 258 258 } else { 259 // label 260 var label = this.document.createElement( "span" ); 261 label.className = "label"; 262 label.appendChild( this.document.createTextNode( epLabel ) ); 263 prop.appendChild( label ); 264 content.appendChild( this.document.createTextNode( epValue ) ); 259 content.appendChild( this.document.createTextNode( epValue ) ); 265 260 } 266 261 prop.appendChild( content ); branches/release-41/mt-static/plugins/StyleCatcher/templates.css
r2812 r2813 372 372 #display-details .url .content { display: inline; height: auto; } 373 373 374 #display-details .props_url { margin-bottom: 4px; }375 #display-details .props_url .content { display: block; height: auto; }376 #display-details .props_url .content a {377 display: block;378 background-image: url(https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif);379 width: 74px;380 height: 21px;381 }382 #display-details .props_url .content a * { display: none }383 384 374 /*#display-details .tags .label { display: inline; height: auto; } 385 375 #display-details .tags .content { display: inline; height: auto; word-spacing: 0.5em; }*/ branches/release-41/mt-static/themes/hills-dusk/screen.css
r2812 r2813 5 5 designer: Mena Trott 6 6 layouts: layout-wtt, layout-twt, layout-wt, layout-tw 7 props_url: byrne@majordojo.com8 7 */ 9 8 branches/release-41/plugins/StyleCatcher/lib/StyleCatcher/CMS.pm
r2812 r2813 9 9 use strict; 10 10 use File::Basename qw(basename); 11 use MT::Util qw( caturl );12 11 13 12 our $DEFAULT_STYLE_LIBRARY; … … 156 155 $app->validate_magic or return $app->json_error($app->translate("Invalid request")); 157 156 return $app->json_error($app->translate("Invalid request")) 158 unless $blog_id && $url && $tmpl;157 unless $blog_id && $url && $tmpl; 159 158 160 159 my $static_path = $app->static_file_path; … … 163 162 } 164 163 165 my $themeroot = File::Spec->catdir( $static_path, 'support', 'themes' ); 164 my $themeroot = 165 File::Spec->catdir( $static_path, 'support', 'themes' ); 166 166 my $webthemeroot = $app->static_path . 'support/themes/'; 167 167 my $mtthemeroot = $app->static_path . 'themes/'; … … 174 174 # yonder... 175 175 my $filemgr = file_mgr() 176 or return $app->json_error( MT::FileMgr->errstr ); 177 print STDERR "Applying theme... ($url)\n"; 176 or return $app->json_error( MT::FileMgr->errstr ); 178 177 179 178 if ( $url !~ m/^(\Q$webthemeroot\E|\Q$mtthemeroot\E)/ ) { 180 179 my $new_url = ''; 180 181 181 for (0..(scalar(@url)-2)) { 182 182 $new_url .= $url[$_] . '/'; 183 183 } 184 print STDERR "Processing for application: $url\n";185 184 my ( $basename, $extension ) = split( /\./, $url[-1] ); 186 185 if ($basename eq 'screen') { … … 207 206 $content =~ s!/\*.*?\*/!!gs; # strip all comments first 208 207 my @images = $content =~ 209 m/\b(?:url\(\s*)([a-zA-Z0-9_.-]+\.(?:gif|jpe?g|png |css))(?:\s*?\))/gi;208 m/\b(?:url\(\s*)([a-zA-Z0-9_.-]+\.(?:gif|jpe?g|png))(?:\s*?\))/gi; 210 209 $filemgr->mkpath( File::Spec->catdir( $themeroot, $basename ) ) 211 210 or return $app->json_error( … … 234 233 } 235 234 236 # Pick up the images we parsed earlier and write them to the theme folder235 # Pick up the images we parsed earlier and write them to the theme folder 237 236 for my $image_url (@images) { 238 237 my $image_request = … … 254 253 $url = "$webthemeroot$basename/$basename.css"; 255 254 } 256 print STDERR "url: $url\n";257 255 258 256 my $blog = MT->model('blog')->load($blog_id) … … 269 267 my $footer = '/* end StyleCatcher imports */'; 270 268 my $styles = $header . "\n"; 271 $styles .= "\@import url(". caturl($app->static_path, $base_css).");\n" if $base_css;269 $styles .= "\@import url(".File::Spec->catfile($app->static_path, $base_css).");\n" if $base_css; 272 270 $styles .= "\@import url($url);\n"; 273 271 $styles .= $footer; 272 print STDERR "styles=$styles\n"; 274 273 275 274 if ($template_text =~ s/\Q$header\E.*\Q$footer\E/$styles/s) { … … 427 426 my $data = {}; 428 427 429 # If we have a url then we're specifying a specific theme (css) or repo (html)428 # If we have a url then we're specifying a specific theme (css) or repo (html) 430 429 # Pick up the file (html with <link>s or a css file with metadata) 431 430 my $user_agent = $app->new_ua; … … 594 593 return unless $stylesheet; 595 594 596 # Break up the css url in to a couple useful pieces (generalize and break me out)595 # Break up the css url in to a couple useful pieces (generalize and break me out) 597 596 $theme = $url; 598 597 # discard any generic 'screen.css' filename … … 603 602 $new_url .= $url[$_] . '/'; 604 603 } 605 # note: this stripped off the css file and left a path only606 604 } 607 605 else { … … 653 651 # Trim me white space, yarr 654 652 for (@comments) { 653 655 654 # TBD: strip any "risky" content; we don't want any 656 655 # XSS in this content. … … 664 663 } 665 664 666 # for my $line (@comments) {667 # # TBD: strip any "risky" content; we don't want any668 # # XSS in this content.669 # # Strip any null bytes670 # $line =~ tr/\x00//d;671 # $line =~ s/^\s+|\s+$//g;672 # if ($line =~ m{ \A (\w+) : \s* (.*) \z }xmsg) {673 # my ( $key, $value ) = ($1, $2);674 # print STDERR "$key => $value\n";# if (lc $key eq 'theme name' || lc $key eq 'name');675 # next if !$value;676 # $metadata{ lc $key } = $value;677 # }678 # }679 680 665 my $thumbnail_link; 681 666 $thumbnail_link = $new_url . 'thumbnail.gif'; … … 684 669 685 670 require MT::Util; 686 my $name = delete $metadata{'name'} || delete $metadata{'theme name'};687 print STDERR "name = $name\n";688 671 my $data = { 689 # name => $theme, 690 name => $name, 691 # description => $metadata{'description'} || $metadata{'description'} || '', 692 title => $name || '(Untitled)', 672 name => $theme, 673 description => $metadata{description} || '', 674 title => $metadata{name} || '(Untitled)', 693 675 url => $url, 694 676 imageSmall => $thumbnail_link, 695 677 imageBig => $thumbnail_large_link, 696 author => delete $metadata{'designer'} || delete $metadata{'author'} || '',697 author_url => delete $metadata{'designer_url'} || delete $metadata{'author_url'} || delete $metadata{'author uri'} || '',698 # author_affiliation => $metadata{'author_affiliation'} || '',699 # layouts => $metadata{'layouts'} || '',700 'sort' => $ name|| '',678 author => $metadata{designer} || $metadata{author} || '', 679 author_url => $metadata{designer_url} || $metadata{author_url} || '', 680 author_affiliation => $metadata{author_affiliation} || '', 681 layouts => $metadata{layouts} || '', 682 'sort' => $metadata{name} || '', 701 683 tags => $tags, 702 684 blogs => [], 703 685 }; 704 for my $field (qw( author_affiliation layouts description )) {705 $data->{$field} = delete $metadata{$field} || '';706 }707 # Toss in all the other metadata too.708 @$data{keys %metadata} = values %metadata;709 require Data::Dumper;710 MT->log('YAY THEME DATA: ' . Data::Dumper::Dumper($data));711 686 $data; 712 687 }
