From: Richard D. <rd...@us...> - 2002-03-29 00:26:40
|
Update of /cvsroot/twiki/twiki/lib In directory usw-pr-cvs1:/tmp/cvs-serv15022 Modified Files: TWiki.pm Log Message: Fix for date formats in BackFromPreviewLosesText, including cleanup and addition of HTTP date format to formatGmTime Index: TWiki.pm =================================================================== RCS file: /cvsroot/twiki/twiki/lib/TWiki.pm,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -r1.124 -r1.125 *** TWiki.pm 27 Mar 2002 21:33:52 -0000 1.124 --- TWiki.pm 29 Mar 2002 00:26:36 -0000 1.125 *************** *** 1,3 **** ! # # TWiki WikiClone ($wikiversion has version info) # --- 1,3 ---- ! #st # TWiki WikiClone ($wikiversion has version info) # *************** *** 67,72 **** $doLogTopicAttach $doLogTopicUpload $doLogTopicRdiff $doLogTopicChanges $doLogTopicSearch $doLogRegistration ! $disableAllPlugins ! @isoMonth $TranslationToken %mon2num $isList @listTypes @listElements $newTopicFontColor $newTopicBgColor $linkProtocolPattern $headerPatternDa $headerPatternSp $headerPatternHt --- 67,72 ---- $doLogTopicAttach $doLogTopicUpload $doLogTopicRdiff $doLogTopicChanges $doLogTopicSearch $doLogRegistration ! $disableAllPlugins @isoMonth @weekDay ! $TranslationToken %mon2num $isList @listTypes @listElements $newTopicFontColor $newTopicBgColor $linkProtocolPattern $headerPatternDa $headerPatternSp $headerPatternHt *************** *** 114,118 **** # =========================== # variables: (new variables must be declared in "use vars qw(..)" above) ! @isoMonth = ( "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ); { my $count = 0; --- 114,119 ---- # =========================== # variables: (new variables must be declared in "use vars qw(..)" above) ! @isoMonth = ( "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ); ! @weekDay = ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"); { my $count = 0; *************** *** 284,291 **** } ! # Generate date of format 'Thu, 23 Jul 1998 07:21:56 GMT' ! my $lastModifiedString = gmtime(); ! $lastModifiedString =~ s/ /, /; # Comma after the day ! $lastModifiedString =~ s/$/ GMT/; # Expiry time is set high to avoid any data loss. Each instance of Edit --- 285,290 ---- } ! # Get time now in HTTP header format ! my $lastModifiedString = formatGmTime(time, 'http'); # Expiry time is set high to avoid any data loss. Each instance of Edit *************** *** 590,594 **** # ========================= # Get date in '1 Jan 2002' format, in local timezone of server - # (used for %DATE%) sub getLocaldate { --- 589,592 ---- *************** *** 605,612 **** my( $theTime, $theFormat ) = @_; ! my( $sec, $min, $hour, $mday, $mon, $year ) = gmtime( $theTime ); if( $theFormat ) { - $mon += 1; $year += 1900; --- 603,609 ---- my( $theTime, $theFormat ) = @_; ! my( $sec, $min, $hour, $mday, $mon, $year, $wday ) = gmtime( $theTime ); if( $theFormat ) { $year += 1900; *************** *** 614,625 **** # RCS format, example: "2001/12/31 23:59:59:59" return sprintf( "%.4u/%.2u/%.2u %.2u:%.2u:%.2u", ! $year, $mon, $mday, $hour, $min, $sec ); ! } ! ! # ISO Format, see ISO date spec at http://www.w3.org/TR/NOTE-datetime ! return sprintf( "%.4u\-%.2u\-%.2uT%.2u\:%.2u:%.2uZ", ! $year, $mon, $mday, $hour, $min, $sec ); } my( $tmon ) = $isoMonth[$mon]; $year = sprintf( "%.4u", $year + 1900 ); # Y2K fix --- 611,629 ---- # RCS format, example: "2001/12/31 23:59:59:59" return sprintf( "%.4u/%.2u/%.2u %.2u:%.2u:%.2u", ! $year, $mon+1, $mday, $hour, $min, $sec ); ! } elsif ( $theFormat =~ /http/i ) { ! # HTTP header format, example: "Thu, 23 Jul 1998 07:21:56 GMT" ! # - based on RFC 2616/1123 and HTTP::Date ! return sprintf( "%s, %02d %s %04d %02d:%02d:%02d GMT", ! $weekDay[$wday], $mday, $isoMonth[$mon], $year, ! $hour, $min, $sec ); ! } else { ! # ISO Format, see spec at http://www.w3.org/TR/NOTE-datetime ! return sprintf( "%.4u\-%.2u\-%.2uT%.2u\:%.2u:%.2uZ", ! $year, $mon+1, $mday, $hour, $min, $sec ); ! } } + # Default format my( $tmon ) = $isoMonth[$mon]; $year = sprintf( "%.4u", $year + 1900 ); # Y2K fix |