[Affelio-cvs 363] CVS update: affelio/lib/Affelio/App/Admin

Back to archive index

Tadashi Okoshi slash****@users*****
2005年 6月 30日 (木) 18:05:43 JST


Index: affelio/lib/Affelio/App/Admin/AffelioNews.pm
diff -u affelio/lib/Affelio/App/Admin/AffelioNews.pm:1.4 affelio/lib/Affelio/App/Admin/AffelioNews.pm:1.5
--- affelio/lib/Affelio/App/Admin/AffelioNews.pm:1.4	Thu Jun 30 08:41:03 2005
+++ affelio/lib/Affelio/App/Admin/AffelioNews.pm	Thu Jun 30 18:05:43 2005
@@ -4,7 +4,7 @@
 #    http://affelio.jp/ (Japan)
 #    http://affelio.jp/ (USA and other area)
 #
-# $Id: AffelioNews.pm,v 1.4 2005/06/29 23:41:03 slash5234 Exp $
+# $Id: AffelioNews.pm,v 1.5 2005/06/30 09:05:43 slash5234 Exp $
 
 package Affelio::App::Admin::AffelioNews;
 {
@@ -14,14 +14,13 @@
     use Error qw(:try);
     use Fcntl;
     use LWP::Simple 'get';
-    use XML::RSS;
     use lib("../../../");
     use Affelio;
     use Affelio::misc::CGIError;
     use Affelio::misc::Debug qw(debug_print);
     use Affelio::misc::WebInput qw(delete_HTML);
     use Affelio::exception::IOException;
-    use Affelio::misc::Time qw(get_timestamp);
+    use Affelio::misc::Time;
 
     use Exporter;
     @Affelio::App::Admin::AffelioNews::ISA = "Exporter";
@@ -54,25 +53,27 @@
 	}
 	close(IN);
 
-	my $rss = new XML::RSS;
-	my $url = 'http://www.okoshi.org/tadashi/bbs2/archives/cat_0206affelio.rdf';
-	$rss->parse( get($url) );
+	my $url = "http://home1.affelio.jp/affelio_news/" 
+	    . $af->{site__locale} . "/index.txt";
+
+	my $data = LWP::Simple::get($url);
 	if($@){
-	    throw Affelio::exception::IOException("Network connection error to affelio web site");
+	    throw Affelio::exception::NetworkException("Network connection error to affelio web site");
 	}
 
 	sysopen(OUT, "$af->{site__user_dir}/AffelioNews/news.html", 
 		O_WRONLY|O_CREAT|O_TRUNC);
 	
-	my $line = 1;
-	foreach my $ref(@{$rss->{items}}){
-	    if($line < 6){
-		$ref->{dc}->{date} =~ /(\d\d\d\d)\-(\d\d\-\d\d)/;
-		my $date = $2;
-		$date =~ s/\-/\//g;
-		print OUT "<TR><TH>$date</TH><TD><A HREF=\"$ref->{'link'}\">$ref->{'title'}</A></TD></TR>";
-	    }
-	    $line = $line + 1;
+	my @elements = split('\n', $data);
+	my $size = @elements;
+	my $index=0;
+	while($index < $size){
+	    my $datetime = timestamp2string($elements[$index++]);
+	    my $type = $elements[$index++];
+	    my $title = $elements[$index++];
+	    my $url = $elements[$index++];
+
+	    print OUT "<TR><TH>$datetime</TH><TD><A HREF=\"$url\" target=\"_blank\">$title</A></TD></TR>";
 	}
 
 	print OUT "\n\0";


Affelio-cvs メーリングリストの案内
Back to archive index