[Affelio-cvs 1407] CVS update: affelio/lib/Affelio/App/Standalone/AdminAjax

Back to archive index

Tadashi Okoshi slash****@users*****
2006年 8月 9日 (水) 14:12:17 JST


Index: affelio/lib/Affelio/App/Standalone/AdminAjax/GetNews.pm
diff -u /dev/null affelio/lib/Affelio/App/Standalone/AdminAjax/GetNews.pm:1.1
--- /dev/null	Wed Aug  9 14:12:17 2006
+++ affelio/lib/Affelio/App/Standalone/AdminAjax/GetNews.pm	Wed Aug  9 14:12:16 2006
@@ -0,0 +1,122 @@
+# Copyright (C) 2005 FishGrove Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# $Id: GetNews.pm,v 1.1 2006/08/09 05:12:16 slash5234 Exp $
+
+package Affelio::App::Standalone::AdminAjax::GetNews;
+{
+    use strict;
+
+    use lib("../../../../../extlib/");
+    use Error qw(:try);
+
+    use lib("../../../");
+    use Affelio;
+    use Affelio::misc::CGIError;
+    use Affelio::misc::Debug qw(debug_print);
+    use Affelio::misc::Time qw(timestamp2string get_timestamp);
+    use Affelio::misc::WebInput;
+    use Affelio::exception::CommunicationException;
+
+    use Exporter;
+    @Affelio::App::Standalone::AdminAjax::GetNews::ISA = "Exporter";
+    @Affelio::App::Standalone::AdminAjax::GetNews::EXPORT = qw (show handler);
+
+    #######################################################################
+    #handler
+    #######################################################################
+    sub handler{
+	my $cgi = shift;
+	my $af = shift;
+	my $out_ref = shift;
+	
+	debug_print("Standalone::GetNews::handler: start.");
+
+	my $wi = new Affelio::misc::WebInput();
+	my $sub_mode = $wi->PTN_mode($cgi->url_param("action"));
+	my $start_num = $wi->PTN_num($cgi->url_param("num"));
+	my $category = $wi->PTN_mode($cgi->url_param("category"));
+	debug_print("Standalone::GetNews::query: $sub_mode: $start_num: $category");
+
+	###############################
+	#normal show
+	###############################
+	show($af, $cgi, $out_ref, $sub_mode, $start_num, $category);
+	debug_print("Standalone::GetNews::handler: end.");
+    }
+
+    #######################################################################
+    #show
+    #######################################################################    
+    sub show{
+	my $af= shift;
+	my $q=shift;
+	my $output_ref = shift;
+	my $sort = shift;
+	my $start_num = shift;
+	my $category = shift;
+	debug_print("Standalone::GetNews::show start.");
+
+	$start_num=0 if ($start_num eq "");
+	$category="Standalone" if ($category eq "");
+	my $ret="";
+
+	my $sqlret = $af->getNghrNews()->retrieve_ajax_news($sort, $start_num, $category);
+	my $index = 0;
+	my @row=();
+	while(($index < 10) && (@row = $sqlret->fetchrow_array) ){
+
+#datetime, af_id, nickname, app_install_name, title, description, creator, URL
+
+	    ### If datetime is using format of SQL DATETIME type,
+	    ### we don't do anything. Otherwise (older version),
+	    ### we translate integer value to YY/MM/HH style.
+	    my $datetime="";
+	    if($row[0]=~/:/){
+		$datetime= $row[0];
+	    }else{
+		$datetime = timestamp2stringB($row[0]);
+	    }
+	    my $af_id = $row[1];
+	    my $name = $row[2] . "/" . $row[3];
+	    my $title = $row[4];
+	    my $url1 = $row[7];
+
+	    my $url2 = "$af->{site__user_afid}/outgoing.cgi?"
+		. "dest_url=$af_id&dest_url2=$url1";
+
+	    debug_print("Standalone::$url2");
+
+	    $ret .= "<TR><TH>$datetime</TH>"
+		. "<TD><A HREF=\"$af_id\" target=\"_blank\">$name</A></TD>"
+		. '<TD><A HREF="' . $url2 . '" target="_blank">' . $title. "</A></TD>"
+		. "</TR>";
+
+	    debug_print("Standalone::$ret");
+
+	    $index++;
+	}	    
+
+	$output_ref->{NeighborNews} = $ret;
+
+	debug_print("Standalone::GetNews::show end.");
+    }
+
+
+}
+1;
+
+


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