Changeset 1746

Show
Ignore:
Timestamp:
04/03/08 08:26:12 (23 months ago)
Author:
auno
Message:

changed the way to show date and time error message. BugzID:65714
* suppress the auto-saved information when user get errors
* accept the number without zero padding for date and time

Location:
branches/release-33
Files:
2 modified

Legend:

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

    r1741 r1746  
    150150                          . MT::Entry::status_text($def_status) } = 1; 
    151151                } 
    152                 $param->{ 
    153                     'allow_comments_' 
    154                       . ( 
    155                         defined $q->param('allow_comments') 
    156                         ? $q->param('allow_comments') 
    157                         : $blog->allow_comments_default 
    158                       ) 
    159                   } 
    160                   = 1; 
    161                 $param->{allow_comments} = $blog->allow_comments_default 
    162                   unless defined $q->param('allow_comments'); 
    163                 $param->{allow_pings} = $blog->allow_pings_default 
    164                   unless defined $q->param('allow_pings'); 
     152                if ( $param->{status} ) { 
     153                    $param->{ 'allow_comments_' 
     154                          . $q->param('allow_comments') } = 1; 
     155                    $param->{allow_comments} = $q->param('allow_comments'); 
     156                    $param->{allow_pings}    = $q->param('allow_pings'); 
     157                } 
     158                else { 
     159                    # new edit 
     160                    $param->{ 'allow_comments_' 
     161                          . $blog->allow_comments_default } = 1; 
     162                    $param->{allow_comments} = $blog->allow_comments_default; 
     163                    $param->{allow_pings}    = $blog->allow_pings_default; 
     164                } 
    165165            } 
    166166        } 
     
    12161216        && ($ao_d) ) 
    12171217    { 
     1218        my %param = (); 
    12181219        my $ao = $ao_d . ' ' . $ao_t; 
    12191220        unless ( 
    1220             $ao =~ m!^(\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2})(?::(\d{2}))?$! ) 
     1221            $ao =~ m!^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$! ) 
    12211222        { 
    1222             return $app->error( 
    1223                 $app->translate( 
     1223            $param{error} = $app->translate( 
    12241224"Invalid date '[_1]'; authored on dates must be in the format YYYY-MM-DD HH:MM:SS.", 
    12251225$ao 
    1226                 ) 
    12271226            ); 
    12281227        } 
    12291228        my $s = $6 || 0; 
    1230         return $app->error( 
    1231             $app->translate( 
     1229            $param{error} = $app->translate( 
    12321230                "Invalid date '[_1]'; authored on dates should be real dates.", 
    12331231                $ao 
    1234             ) 
    12351232          ) 
    12361233          if ( 
     
    12471244                && !MT::Util::leap_day( $0, $1, $2 ) ) 
    12481245          ); 
     1246        $param{return_args} = $app->param('return_args'); 
     1247        return $app->forward( "view", \%param ) if $param{error}; 
    12491248        if ($obj->authored_on) { 
    12501249            $previous_old = $obj->previous(1); 
  • branches/release-33/tmpl/cms/edit_entry.tmpl

    r1615 r1746  
    8383    <mt:unless name="recovered_object"> 
    8484        <mt:if name="autosaved_object_exists"> 
     85            <mt:unless name="error"> 
    8586            <mtapp:statusmsg 
    8687                id="recovered-object" 
     
    9293                </mt:if> 
    9394            </mtapp:statusmsg> 
     95            </mt:unless> 
    9496        </mt:if> 
    9597    </mt:unless>