]>
git.p6c8.net - selfforum.git/blob - selfforum-cgi/shared/Template/Archive.pm
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;
32 use Template
::_thread
;
34 ################################################################################
38 use base
qw(Exporter);
39 @Template::Archive
::EXPORT
= qw(print_thread_as_HTML);
42 ### print_year_as_HTML () ######################################################
44 # yearly overview over months
47 # $tempfile template filename
48 # $param hash reference
53 ### print_month_as_HTML () #####################################################
55 # monthly overview over threads
57 # Params: $mainfile XML file on a per-month base
58 # $tempfile template filename
59 # $param hash reference
62 sub print_month_as_HTML
($$$) {
63 my ($mainfile, $tempfile, $param) = @_;
65 my $template = new Template
$tempfile;
70 ### print_thread_as_HTML () ####################################################
72 # print a complete thread
74 # Params: $mainfile thread XML file
75 # $tempfile template filename
76 # $param hash reference
79 sub print_thread_as_HTML
($$$) {
80 my ($mainfile, $tempfile, $param) = @_;
82 my $assign = $param->{'assign'};
83 my $tree = $param->{'tree'};
84 my $tid = $param->{'thread'};
86 my $template = new Template
$tempfile;
88 my $view = get_view_params
({
89 'adminDefault' => $param->{'adminDefault'}
91 my $xml = parse_xml_file
($mainfile);
92 my $tnode = $xml->getElementsByTagName('Thread', 1)->item(0);
93 my $thread = parse_single_thread
($tnode, KILL_DELETED
);
96 $tree->{'year'} => $param->{'year'},
97 $tree->{'month'} => $param->{'month'}
101 'thread' => $param->{'thread'},
102 'template' => $param->{'tree'},
104 'cgi' => $param->{'cgi'},
105 'addParam' => $addparam
109 $assign->{'threadCategory'} => $thread->[0]->{'cat'},
110 $assign->{'threadTitle'} => $thread->[0]->{'subject'},
111 $assign->{'threadYear'} => $param->{'year'},
112 $assign->{'threadMonth'} => $param->{'month'},
113 $param->{'tree'}->{'main'} => html_thread
($thread, $template, $tpar)
116 print ${$template->scrap(
117 $assign->{'threadDocStart'},
122 my $mnode = get_message_node
($xml, 't'.$tid, 'm'.$_->{'mid'});
123 my $header = get_message_header
($mnode);
124 my $body = get_message_body
($xml, 'm'.$_->{'mid'});
126 my $text = message_field
(
129 'quoteChars' => plain
($view->{'quoteChars'}),
130 'quoting' => $view->{'quoting'},
131 'startCite' => ${$template->scrap($assign->{'startCite'})},
132 'endCite' => ${$template->scrap($assign->{'endCite'})}
137 print ${$template->scrap(
138 $assign->{'posting'},
140 $assign->{'msgID'} => $_->{'mid'},
141 $assign->{'msgAuthor'} => $_->{'name'},
142 $assign->{'msgMail'} => $header->{'email'},
143 $assign->{'msgHomepage'} => $header->{'home'},
144 $assign->{'msgTime'} => hr_time
($header->{'time'}),
145 $assign->{'msgCategory'} => plain
($header->{'category'}),
146 $assign->{'msgSubject'} => plain
($header->{'subject'}),
147 $assign->{'msgBody'} => $text
152 print ${$template->scrap(
153 $assign->{'threadDocEnd'},
164 ### end of Template::Archive ###################################################
patrick-canterino.de