Show
Ignore:
Timestamp:
07/08/08 05:52:25 (17 months ago)
Author:
bchoate
Message:

Return asset immediately if asset_select parameter is given (skips options dialog). BugId:80550

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-41/lib/MT/CMS/Asset.pm

    r1823 r2726  
    230230    my $text = _process_post_upload( $app ); 
    231231    return unless defined $text; 
    232     $app->load_tmpl( 
     232    my $tmpl = $app->load_tmpl( 
    233233        'dialog/asset_insert.tmpl', 
    234234        { 
     235             
    235236            upload_html => $text || '', 
    236237            edit_field => scalar $app->param('edit_field') || '', 
    237238        }, 
    238239    ); 
     240    my $ctx = $tmpl->context; 
     241    my $id = $app->param('id') 
     242        or return $app->errtrans("Invalid request."); 
     243    my $asset = MT::Asset->load( $id ); 
     244    $ctx->stash('asset', $asset); 
     245    return $tmpl; 
    239246} 
    240247 
     
    336343    my $perms = $app->permissions 
    337344      or return $app->errtrans('No permissions'); 
     345 
     346    # caller wants asset without any option step, so insert immediately 
     347    return insert($app) if $app->param('asset_select'); 
    338348 
    339349    my $param = {