Tatsuki SUGIURA
sugi****@users*****
2005年 11月 21日 (月) 17:07:21 JST
Index: slashjp/themes/slashcode/tasks/create_sidebar.pl diff -u /dev/null slashjp/themes/slashcode/tasks/create_sidebar.pl:1.1 --- /dev/null Mon Nov 21 17:07:21 2005 +++ slashjp/themes/slashcode/tasks/create_sidebar.pl Mon Nov 21 17:07:21 2005 @@ -0,0 +1,41 @@ +#!/usr/bin/perl -w +# This code is a part of Slash, and is released under the GPL. +# Copyright 1997-2001 by Open Source Development Network. See README +# and COPYING for more information, or see http://slashcode.com/. +# $Id: create_sidebar.pl,v 1.1 2005/11/21 08:07:21 sugi Exp $ + +use strict; +use File::Spec::Functions; +use Slash::Utility; + +my $me = 'create_sidebar.pl'; + +use vars qw( %task ); + +$task{$me}{timespec} = '8,28,48 * * * *'; +$task{$me}{timespec_panic_1} = '5-59/15 * * * *'; # less often +$task{$me}{code} = sub { + my($virtual_user, $constants, $slashdb, $user) = @_; + + my $nexus_topics = $slashdb->getDescriptions('nexus_topics'); + my $all_topics = $slashdb->getTopics(); + foreach my $tid (keys(%$nexus_topics)) { + my $stories = $slashdb->getStoriesEssentials({limit => 10, + tid => $tid}); + my $storydata = $slashdb->getStoriesData([map {$_->{stoid}} @$stories]); + foreach my $story ( @$stories ) { + $story->{title} = $storydata->{$story->{stoid}}->{title}; + } + #$topic = $topic ||= 'index'; + open(FILE, ">$constants->{basedir}/$constants->{sidebardir}/" + . $slashdb->getTopic($tid)->{keyword} + . ".shtml") || next; + print FILE slashDisplay('sidebar', + { stories => $stories, + section => $nexus_topics->{$tid} }, + { Return => 1 }); + close(FILE); + } +}; + +1;