svnno****@sourc*****
svnno****@sourc*****
2007年 11月 19日 (月) 19:26:47 JST
Revision: 266 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=266 Author: tach Date: 2007-11-19 19:26:47 +0900 (Mon, 19 Nov 2007) Log Message: ----------- add set_sectionlinks.pl to create resentSection template Added Paths: ----------- slashjp/trunk/themes/slashcode/tasks/set_sectionlinks.pl -------------- next part -------------- Added: slashjp/trunk/themes/slashcode/tasks/set_sectionlinks.pl =================================================================== --- slashjp/trunk/themes/slashcode/tasks/set_sectionlinks.pl 2007-11-19 10:17:30 UTC (rev 265) +++ slashjp/trunk/themes/slashcode/tasks/set_sectionlinks.pl 2007-11-19 10:26:47 UTC (rev 266) @@ -0,0 +1,46 @@ +#!/usr/bin/perl -w + +use strict; +use Slash; +use Slash::Display; +use Slash::Utility; + +# for debug +use Data::Dumper; + +use vars qw( %task $me ); + +$task{$me}{timespec} = '2,12,22,32,42,52 * * * *'; +$task{$me}{timespec_panic_1} = ''; # not that important +$task{$me}{on_startup} = 1; +$task{$me}{code} = sub { + + my($virtual_user, $constants, $slashdb, $user) = @_; + my $mainskin = $slashdb->getSkin( $constants->{mainpage_skid} ); + my $skins = $slashdb->sqlSelectAll("skid, name, title","skins", "skid != " . $mainskin->{skid}); + my $html = ''; + $html .= q|<ul>|; + $html .= qq|<li><a href="[% constants.real_rootdir %]/">$mainskin->{title}</a></li>|; + + foreach my $skin (@$skins) { + my ($skid, $skinname, $skintitle) = @$skin; + #my $date = timeCalc($slashdb->sqlSelect("time","stories","section='$sectid'"," ORDER BY time DESC"),'%m/%d'); + my $date = $slashdb->sqlSelect("time","stories","primaryskid='$skid'"," ORDER BY time DESC LIMIT 1" ); + if ($date) { + $date = timeCalc($date,'%m/%d'); + } else { + next; + } + $html .= qq|<li><a href="[% constants.real_rootdir %]/$skinname/">$skintitle <span class="date">$date</span></a></li>|; + + } + $html .= '</ul>'; + + my($tpid) = $slashdb->getTemplateByName('recentSections', 'tpid'); + $slashdb->setTemplate($tpid, { template => $html }); + + return ; +}; + +1; + Property changes on: slashjp/trunk/themes/slashcode/tasks/set_sectionlinks.pl ___________________________________________________________________ Name: svn:executable + *