Changeset 998

Show
Ignore:
Timestamp:
08/28/08 21:47:30 (3 months ago)
Author:
mpaschal
Message:

Push template set through the mixer

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/StyleCatcher-2.1-dev/plugins/StyleCatcher/lib/StyleCatcher/CMS.pm

    r985 r998  
    428428    if ( $type =~ m!^text/css! ) { 
    429429        $data->{auto}{url} = $url; 
    430         my $theme = fetch_theme( $url, ['collection:auto'] ); 
     430        my $theme = fetch_theme( 
     431            url  => $url, 
     432            tags => ['collection:auto'], 
     433        ); 
    431434        $data->{themes} = [$theme]; 
    432435    } 
     
    464467        my $themes = []; 
    465468        for my $repo_theme (@repo_themes) { 
    466             my $theme = fetch_theme( $repo_theme, [] ); 
     469            my $theme = fetch_theme( 
     470                url => $repo_theme, 
     471            ); 
    467472            push @$themes, $theme if $theme; 
    468473        } 
     
    536541        next unless -d $theme; 
    537542        $theme =~ s/.*[\\\/]//; 
    538         $themes->{$theme} = 
    539           fetch_theme( $theme_dir, ['collection:mt-designs'], $theme_url, 
    540             $theme_dir ); 
     543        $themes->{$theme} = fetch_theme( 
     544            url      => $theme_dir, 
     545            tags     => ['collection:mt-designs'], 
     546            baseurl  => $theme_url, 
     547            basepath => $theme_dir, 
     548        ); 
    541549        $themes->{$theme}{name} = $themes->{$theme}{name}; 
    542550        $themes->{$theme}{prefix} = 'default'; 
     
    553561        next unless -d $theme; 
    554562        $theme =~ s/.*[\\\/]//; 
    555         $themes->{$theme} = 
    556           fetch_theme( $theme_dir, ['collection:my-designs'] ); 
     563        $themes->{$theme} = fetch_theme( 
     564            url  => $theme_dir, 
     565            tags => ['collection:my-designs'], 
     566        ); 
    557567        $themes->{$theme}{prefix} = 'local'; 
    558568    } 
     
    568578sub fetch_theme { 
    569579    my $app = MT->app; 
    570     my ( $url, $tags, $baseurl, $basepath ) = @_; 
     580    my %param = @_; 
     581    my ($url, $tags, $baseurl, $basepath, $default_metadata) 
     582        = @param{qw( url tags baseurl basepath metadata )}; 
     583    $tags ||= []; 
    571584 
    572585    my $theme; 
     
    685698 
    686699    my %field_map = ( 
    687         author_url   => [ 'designer_url', 'author_url', 'author uri' ], 
    688700        title        => [ 'name',         'theme name' ], 
    689701        author       => [ 'designer',     'author' ], 
     702        author_url   => [ 'designer_url', 'author_url', 'author uri' ], 
     703        template_set => [ 'template_set', 'template' ], 
    690704    ); 
    691705    while (my ($best_name, $possible_names) = each %field_map) { 
    692706        ($metadata{$best_name}) = grep { defined } 
    693             delete @metadata{ @$possible_names }
    694     } 
    695      
     707            delete @metadata{ @$possible_names }, q{}
     708    } 
     709 
    696710    require MT::Util; 
    697711    my $data = { 
    698712        name         => $theme, 
    699         description  => $metadata{description} || ''
     713        description  => $metadata{description} || q{}
    700714        title        => $metadata{title} || '(Untitled)', 
    701715        url          => $url, 
    702716        imageSmall   => $thumbnails{thumbnail}, 
    703717        imageBig     => $thumbnails{thumbnail_large}, 
    704         layouts      => $metadata{layouts} || ''
     718        layouts      => $metadata{layouts} || q{}
    705719        sort         => $metadata{name} || $theme || q{}, 
    706720        tags         => $tags, 
    707721        blogs        => [], 
    708         author       => $metadata{author}     || q{}, 
    709         author_url   => $metadata{author_url} || q{}, 
     722        author       => $metadata{author}, 
     723        author_url   => $metadata{author_url}, 
     724        template_set => $metadata{template_set}, 
    710725        author_affiliation => $metadata{author_affiliation} || q{}, 
    711726    }; 
  • branches/StyleCatcher-2.1-dev/plugins/StyleCatcher/tmpl/view.tmpl

    r817 r998  
    7676        mixer = new TC.Mixer(); 
    7777        // initialize mixer object 
    78         mixer.addSelectedDisplay( "display-details-content" ); 
     78        var display = mixer.addSelectedDisplay( "display-details-content" ); 
     79        display.entryProperties['template_set'] = 'Template Set'; 
    7980        mixer.onselect = selectDesign; 
    8081    }