Changeset 2454

Show
Ignore:
Timestamp:
05/28/08 10:32:31 (21 months ago)
Author:
fumiakiy
Message:

Calculate and set offset value correctly when the number of items appearing on a page is changed. BugId:79897

Location:
branches/release-39/lib/MT/CMS
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/release-39/lib/MT/CMS/Entry.pm

    r2417 r2454  
    559559    $arg{direction} = 'descend'; 
    560560    $arg{limit}     = $limit + 1; 
    561     if ( $total && $offset > $total - 1 ) { 
     561    if ( $total <= $limit ) { 
     562        delete $arg{limit}; 
     563        $offset = 0; 
     564    } 
     565    elsif ( $total && $offset > $total - 1 ) { 
    562566        $arg{offset} = $offset = $total - $limit; 
    563567    } 
    564568    elsif ( $offset && ( ( $offset < 0 ) || ( $total - $offset < $limit ) ) ) { 
    565         $arg{offset} = $offset = 0; 
     569        $arg{offset} = $offset = $total - $limit; 
    566570    } 
    567571    else { 
  • branches/release-39/lib/MT/CMS/Tag.pm

    r1873 r2454  
    387387    $arg{'sort'} = 'name'; 
    388388    $arg{limit} = $limit + 1; 
    389     if ( $total && $offset > $total - 1 ) { 
     389    if ( $total <= $limit ) { 
     390        delete $arg{limit}; 
     391        $offset = 0; 
     392    } 
     393    elsif ( $total && $offset > $total - 1 ) { 
    390394        $arg{offset} = $offset = $total - $limit; 
    391395    } 
  • branches/release-39/lib/MT/CMS/TrackBack.pm

    r2169 r2454  
    245245    $arg{direction} = $sort_direction; 
    246246    $arg{limit}     = $limit + 1; 
    247     if ( $total && $offset > $total - 1 ) { 
     247    if ( $total <= $limit ) { 
     248        delete $arg{limit}; 
     249        $offset = 0; 
     250    } 
     251    elsif ( $total && $offset > $total - 1 ) { 
    248252        $arg{offset} = $offset = $total - $limit; 
    249253    } 
    250254    elsif ( $offset && ( ( $offset < 0 ) || ( $total - $offset < $limit ) ) ) { 
    251         $arg{offset} = $offset = 0; 
    252     } 
    253     elsif ($offset) { 
    254         $arg{offset} = $offset; 
     255        $arg{offset} = $offset = $total - $limit; 
     256    } 
     257    else { 
     258        $arg{offset} = $offset if $offset; 
    255259    } 
    256260