Changeset 2813

Show
Ignore:
Timestamp:
07/18/08 18:43:15 (1 month ago)
Author:
breese
Message:

reverted style catcher files to revision 2811, keeping dashboard widget copy changes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/release-41/mt-static/js/tc/mixer/display.js

    r2812 r2813  
    5353        "description" : "Description:", 
    5454        "author" : "Author:", 
    55         "tags" : "Tags:", 
    56         "url" : "CSS File", 
    57         "props_url" : "Donate" 
     55        "tags" : "Tags:" 
     56        ,"url" : "URL:" 
    5857}; 
    5958 
     
    228227                        // get natural language label 
    229228                        var epLabel = this.entryProperties[ ep ]; 
    230                         var epValue = entry[ ep ]; 
    231  
    232                         if( epValue == null )  
    233                             continue; 
     229                        var epValue = entry[ ep ] || " "; 
    234230                         
    235231                        // fix array values 
    236232                        if( epValue.join ) 
    237                             epValue = epValue.join( ", " ); 
     233                               epValue = epValue.join( ", " ); 
    238234                         
    239235                        // only handle strings 
    240236                        if( typeof( epValue ) != "string" ) 
    241                             continue; 
     237                               continue; 
    242238                         
    243239                        // property 
     
    246242                        props.appendChild( prop ); 
    247243                         
     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                         
    248250                        // content 
    249251                        var content = this.document.createElement( "span" ); 
    250252                        content.className = "content"; 
    251                         if ( ep.match(/(_|^)url$/) ) { 
     253                        if ( epLabel == "URL:") { 
    252254                           var link = this.document.createElement( "a" ); 
    253255                           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" )); 
    257257                           content.appendChild( link ); 
    258258                        } 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 ) ); 
    265260                        } 
    266261                        prop.appendChild( content ); 
  • branches/release-41/mt-static/plugins/StyleCatcher/templates.css

    r2812 r2813  
    372372#display-details .url .content { display: inline; height: auto; } 
    373373 
    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  
    384374/*#display-details .tags .label { display: inline; height: auto; } 
    385375#display-details .tags .content { display: inline; height: auto; word-spacing: 0.5em; }*/ 
  • branches/release-41/mt-static/themes/hills-dusk/screen.css

    r2812 r2813  
    55designer: Mena Trott   
    66layouts: layout-wtt, layout-twt, layout-wt, layout-tw 
    7 props_url: byrne@majordojo.com 
    87*/ 
    98 
  • branches/release-41/plugins/StyleCatcher/lib/StyleCatcher/CMS.pm

    r2812 r2813  
    99use strict; 
    1010use File::Basename qw(basename); 
    11 use MT::Util qw( caturl ); 
    1211 
    1312our $DEFAULT_STYLE_LIBRARY; 
     
    156155    $app->validate_magic or return $app->json_error($app->translate("Invalid request")); 
    157156    return $app->json_error($app->translate("Invalid request")) 
    158        unless $blog_id && $url && $tmpl; 
     157      unless $blog_id && $url && $tmpl; 
    159158 
    160159    my $static_path = $app->static_file_path; 
     
    163162    } 
    164163 
    165     my $themeroot =  File::Spec->catdir( $static_path, 'support', 'themes' ); 
     164    my $themeroot = 
     165      File::Spec->catdir( $static_path, 'support', 'themes' ); 
    166166    my $webthemeroot = $app->static_path . 'support/themes/'; 
    167167    my $mtthemeroot  = $app->static_path . 'themes/'; 
     
    174174    # yonder... 
    175175    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 ); 
    178177 
    179178    if ( $url !~ m/^(\Q$webthemeroot\E|\Q$mtthemeroot\E)/ ) { 
    180179        my $new_url = ''; 
     180 
    181181        for (0..(scalar(@url)-2)) { 
    182182            $new_url .= $url[$_] . '/'; 
    183183        } 
    184         print STDERR "Processing for application: $url\n"; 
    185184        my ( $basename, $extension ) = split( /\./, $url[-1] ); 
    186185        if ($basename eq 'screen') { 
     
    207206        $content =~ s!/\*.*?\*/!!gs;    # strip all comments first 
    208207        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; 
    210209        $filemgr->mkpath( File::Spec->catdir( $themeroot, $basename ) ) 
    211210          or return $app->json_error( 
     
    234233        } 
    235234 
    236         # Pick up the images we parsed earlier and write them to the theme folder 
     235       # Pick up the images we parsed earlier and write them to the theme folder 
    237236        for my $image_url (@images) { 
    238237            my $image_request = 
     
    254253        $url = "$webthemeroot$basename/$basename.css"; 
    255254    } 
    256     print STDERR "url: $url\n"; 
    257255     
    258256    my $blog = MT->model('blog')->load($blog_id)     
     
    269267    my $footer = '/* end StyleCatcher imports */'; 
    270268    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; 
    272270    $styles .= "\@import url($url);\n"; 
    273271    $styles .= $footer; 
     272    print STDERR "styles=$styles\n"; 
    274273 
    275274    if ($template_text =~ s/\Q$header\E.*\Q$footer\E/$styles/s) { 
     
    427426    my $data    = {}; 
    428427 
    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) 
    430429    # Pick up the file (html with <link>s or a css file with metadata) 
    431430    my $user_agent = $app->new_ua; 
     
    594593        return unless $stylesheet; 
    595594 
    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) 
    597596        $theme = $url; 
    598597        # discard any generic 'screen.css' filename 
     
    603602            $new_url .= $url[$_] . '/'; 
    604603        } 
    605         # note: this stripped off the css file and left a path only 
    606604    } 
    607605    else { 
     
    653651    # Trim me white space, yarr 
    654652    for (@comments) { 
     653 
    655654        # TBD: strip any "risky" content; we don't want any 
    656655        # XSS in this content. 
     
    664663    } 
    665664 
    666 #    for my $line (@comments) { 
    667 #        # TBD: strip any "risky" content; we don't want any 
    668 #        # XSS in this content. 
    669 #        # Strip any null bytes 
    670 #        $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  
    680665    my $thumbnail_link; 
    681666    $thumbnail_link = $new_url . 'thumbnail.gif'; 
     
    684669 
    685670    require MT::Util; 
    686     my $name = delete $metadata{'name'} || delete $metadata{'theme name'}; 
    687     print STDERR "name = $name\n"; 
    688671    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)', 
    693675        url         => $url, 
    694676        imageSmall  => $thumbnail_link, 
    695677        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} || '', 
    701683        tags               => $tags, 
    702684        blogs              => [], 
    703685    }; 
    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)); 
    711686    $data; 
    712687}