]>
git.p6c8.net - selfforum.git/blob - selfforum-cgi/shared/Template/Archive.pm
ec5ee22cbd83d3df14d51caa895838b169eac3e6
1 package Template
::Archive
;
3 ################################################################################
5 # File: shared/Template/Archive.pm #
7 # Authors: Frank Schoenmann <fs@tower.de>, 2001-06-04 #
9 # Description: archive display #
11 ################################################################################
17 use Encode
::Plain
; $Encode::Plain
::utf8
= 1;
36 use Template
::_thread
;
38 ################################################################################
42 use base
qw(Exporter);
43 @Template::Archive
::EXPORT
= qw(
49 ### print_year_as_HTML () ######################################################
51 # yearly overview over months
54 # $tempfile template filename
55 # $param hash reference
60 ### print_month_as_HTML () #####################################################
62 # monthly overview over threads
64 # Params: $mainfile XML file on a per-month base
65 # $tempfile template filename
66 # $param hash reference
69 sub print_month_as_HTML
($$$) {
70 my ($mainfile, $tempfile, $param) = @_;
72 my $assign = $param->{'assign'};
74 my $template = new Template
$tempfile;
76 my $threads = get_all_threads
($mainfile, KILL_DELETED
);
79 $assign->{'year'} => $param->{'year'},
80 $assign->{'month'} => $param->{'month'},
81 $assign->{'monthName'} => month
($param->{'month'})
87 print ${$template->scrap(
88 $assign->{'monthDocStart'},
95 for (sort keys %$threads) {
96 print ${$template->scrap(
97 $assign->{'monthThreadEntry'},
99 $assign->{'threadID'} => $_,
100 $assign->{'threadCategory'} => $threads->{$_}->[0]->{'cat'},
101 $assign->{'threadTitle'} => $threads->{$_}->[0]->{'subject'},
102 $assign->{'threadTime'} => short_hr_time
($threads->{$_}->[0]->{'time'}),
103 $assign->{'threadDate'} => very_short_hr_time
($threads->{$_}->[0]->{'time'}),
104 $assign->{'year'} => $param->{'year'},
105 $assign->{'month'} => $param->{'month'}
113 print ${$template->scrap(
114 $assign->{'monthDocEnd'},
121 ### print_thread_as_HTML () ####################################################
123 # print a complete thread
125 # Params: $mainfile thread XML file
126 # $tempfile template filename
127 # $param hash reference
130 sub print_thread_as_HTML
($$$) {
131 my ($mainfile, $tempfile, $param) = @_;
133 my $assign = $param->{'assign'};
134 my $tree = $param->{'tree'};
135 my $tid = $param->{'thread'};
137 my $template = new Template
$tempfile;
139 my $view = get_view_params
({
140 'adminDefault' => $param->{'adminDefault'}
142 my $xml = parse_xml_file
($mainfile);
143 my $tnode = $xml->getElementsByTagName('Thread', 1)->item(0);
144 my $thread = parse_single_thread
($tnode, KILL_DELETED
);
147 $tree->{'year'} => $param->{'year'},
148 $tree->{'month'} => $param->{'month'}
152 # used to print the thread view
155 'thread' => $param->{'thread'},
156 'template' => $param->{'tree'},
158 'cgi' => $param->{'cgi'},
159 'addParam' => $addparam
166 $assign->{'threadCategory'} => $thread->[0]->{'cat'},
167 $assign->{'threadTitle'} => $thread->[0]->{'subject'},
168 $assign->{'year'} => $param->{'year'},
169 $assign->{'month'} => $param->{'month'},
170 $assign->{'monthName'} => month
($param->{'month'}),
171 $param->{'tree'}->{'main'} => html_thread
($thread, $template, $tpar)
174 print ${$template->scrap(
175 $assign->{'threadDocStart'},
183 my $mnode = get_message_node
($xml, 't'.$tid, 'm'.$_->{'mid'});
184 my $header = get_message_header
($mnode);
185 my $body = get_message_body
($xml, 'm'.$_->{'mid'});
187 my $text = message_field
(
190 'quoteChars' => plain
($view->{'quoteChars'}),
191 'quoting' => $view->{'quoting'},
192 'startCite' => ${$template->scrap($assign->{'startCite'})},
193 'endCite' => ${$template->scrap($assign->{'endCite'})}
198 print ${$template->scrap(
199 $assign->{'posting'},
201 $assign->{'msgID'} => $_->{'mid'},
202 $assign->{'msgAuthor'} => $_->{'name'},
203 $assign->{'msgMail'} => $header->{'email'},
204 $assign->{'msgHomepage'} => $header->{'home'},
205 $assign->{'msgTime'} => hr_time
($header->{'time'}),
206 $assign->{'msgCategory'} => plain
($header->{'category'}),
207 $assign->{'msgSubject'} => plain
($header->{'subject'}),
208 $assign->{'msgBody'} => $text
216 print ${$template->scrap(
217 $assign->{'threadDocEnd'},
228 ### end of Template::Archive ###################################################
patrick-canterino.de