[Affelio-cvs 1217] CVS update: affelio/apps/diary/Diary

Back to archive index

Yoshihisa Fukuhara higef****@users*****
2006年 4月 6日 (木) 09:03:45 JST


Index: affelio/apps/diary/Diary/ListDiary.pm
diff -u /dev/null affelio/apps/diary/Diary/ListDiary.pm:1.1
--- /dev/null	Thu Apr  6 09:03:45 2006
+++ affelio/apps/diary/Diary/ListDiary.pm	Thu Apr  6 09:03:45 2006
@@ -0,0 +1,73 @@
+# Copyright (C) 2006 Affelio 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.
+
+
+package Diary::ListDiary;
+{
+    use strict;
+    use Affelio::misc::Debug qw( debug_print);
+
+    use Exporter;
+    @Diary::ListDiary::ISA = "Exporter";
+    @Diary::ListDiary::EXPORT = qw (show handler);
+
+
+    #######################################################################
+    #handler
+    #######################################################################
+    sub handler{
+	my $cgi = shift;
+	my $diary = shift;
+	my $out_ref = shift;
+	
+	debug_print("Diary::ListDiary::handler: start.");
+
+	###############################
+	#normal show
+	###############################
+	$out_ref->{tmpl_file}
+	= $diary->{afap}->{app__fs_root}."/templates/admin_list_diary.tmpl";
+	
+	show($diary, $cgi, $out_ref);
+	debug_print("Diary::ListDiary::handler: end.");
+    }
+
+    #######################################################################
+    #show
+    #######################################################################    
+    sub show{
+	my $diary= shift;
+	my $cgi=shift;
+	my $output_ref = shift;
+	debug_print("Diary::ListDiary::show start.");
+
+	my $wi = new Affelio::misc::WebInput();
+	my $id = $wi->PTN_num($cgi->param("id"));
+	my $action = $wi->PTN_mode($cgi->param("action"));
+	if ($action eq "delete" && $id ne ""){
+	    debug_print("Diary::Category::show: delete the entry.");
+	    $diary->{dbh}->do("DELETE FROM $diary->{entry_table} WHERE id = $id");
+	    $output_ref->{"DONE_DELETE"} = '1';
+	}
+	my @entries = $diary->getall("SELECT D.id, title, year, month, day, c_id, C.category FROM $diary->{entry_table} D INNER JOIN $diary->{category_table} C ON D.c_id = C.id ORDER BY timestamp DESC");
+
+	$output_ref->{"ENTRIES"}= \@entries;
+
+	debug_print("Diary::ListDiary::show end.");
+    }
+
+}
+1;


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