--- DBCachePlugin/WebDB.pm~ 2006-03-01 12:59:31.000000000 -0500 +++ DBCachePlugin/WebDB.pm 2006-03-12 17:44:08.504770302 -0500 @@ -20,9 +20,27 @@ use strict; use TWiki::Contrib::DBCacheContrib; use TWiki::Plugins::DBCachePlugin; +use Time::Local; @TWiki::Plugins::DBCachePlugin::WebDB::ISA = ("TWiki::Contrib::DBCacheContrib"); +use vars qw( %MON2NUM ); + +%MON2NUM = ( + Jan => 0, + Feb => 1, + Mar => 2, + Apr => 3, + May => 4, + Jun => 5, + Jul => 6, + Aug => 7, + Sep => 8, + Oct => 9, + Nov => 10, + Dec => 11); + + ############################################################################### sub new { my ($class, $web, $cacheName) = @_; @@ -112,6 +130,28 @@ #applyGlue($defaultSection); $topic->set('_sectiondefault', $defaultSection); +################ added from BlogPlugin + foreach my $topicName (@$topics) { + my $topic = $this->fastget($topicName); + #print STDERR "DEBUG: reloading $topicName\n"; + # createdate + my $form = $topic->fastget('form'); + my $dateField; + if ($form) { + $form = $topic->fastget($form); + $dateField = $form->fastget('Date'); + } + my $createDate; + if ($dateField) { + $createDate = parseTime($dateField); + } else { + ($createDate, undef) = &TWiki::Func::getRevisionInfo($this->{_web}, $topicName, 1); + } + $topic->set('createdate', $createDate); + } + +################# end added from BlogPlugin + # get named sections # CAUTION: %SECTION will be deleted in the near future. @@ -129,6 +169,22 @@ } ############################################################################### +# added from BlogPlugin +sub parseTime { + my $date = shift; + + # try "31 Dec 2001 - 23:59" (TWiki date) + if ($date =~ /([0-9]+)\s+([A-Za-z]+)\s+([0-9]+)[\s\-]+([0-9]+)\:([0-9]+)/) { + my $year = $3; + $year -= 1900 if( $year > 1900 ); + # The ($2) will look up the constant so named + return timelocal( 0, $5, $4, $1, $MON2NUM{$2}, $year ); + } + + return 0; +} + +############################################################################### # local copy from GluePlugin sub applyGlue {