]>
git.p6c8.net - selfforum.git/blob - selfforum-cgi/shared/Template/_thread.pm
3f00ad25c8655a146ed959dd0154c805fcbc2729
1 package Template
::_thread
;
3 ################################################################################
5 # File: shared/Template/_thread.pm #
7 # Authors: Andre Malo <nd@o3media.de>, 2001-04-02 #
9 # Description: convert parsed thread to HTML #
11 ################################################################################
15 use Encode
::Plain
; $Encode::Plain
::utf8
= 1;
16 use Posting
::_lib
qw(short_hr_time);
20 ################################################################################
24 use base
qw(Exporter);
25 @Template::_thread
::EXPORT
= qw(html_thread);
27 ### sub html_thread ($$$) ######################################################
31 # Params: $msg - Reference of Message-Array
32 # (Output of parse_single_thread in Posting::_lib)
33 # $template - Template object
34 # $par - Hash Reference (see doc for details)
36 # Return: Reference of HTML String
38 sub html_thread
($$$) {
39 my ($msg, $template, $par) = @_;
41 return \'' unless @$msg;
43 my $temp = $par -> {template};
44 my $i = $par -> {cgi} -> {user};
45 my $t = $par -> {cgi} -> {thread};
46 my $p = $par -> {cgi} -> {posting};
47 my $c = $par -> {cgi} -> {command};
48 my $tid = $par -> {thread};
55 if ($par -> {start} == -1) {
57 @indexes = (1..$_ -> {answers});
59 if ($_ -> {answers}) {
63 ${$template -> scrap (
69 { $temp -> {name} => $_ -> {name},
70 $temp -> {subject} => $_ -> {subject},
71 $temp -> {cat} => $_ -> {cat},
72 $temp -> {time} => plain(short_hr_time ($_ -> {time})),
73 $temp -> {link} => query_string({$t => $tid, $p => $_ -> {mid}})
83 ${$template -> scrap (
89 { $temp -> {name} => $_ -> {name},
90 $temp -> {subject} => $_ -> {subject},
91 $temp -> {cat} => $_ -> {cat},
92 $temp -> {time} => plain(short_hr_time ($_ -> {time})),
93 $temp -> {link} => query_string({$t => $tid, $p => $_ -> {mid}})
107 for (@$msg) {$start++; last if ($_ -> {mid} == $par -> {start});}
108 my $end = $start + $msg -> [$start] -> {answers};
110 @indexes = ($start..$end);
111 $oldlevel = $startlevel = $msg -> [$start] -> {level}
112 if (defined $msg -> [$start] -> {level});
117 for (@$msg[@indexes]) {
119 if ($_ -> {level} < $oldlevel) {
120 $html.='</dl></dd>' x ($oldlevel - $_ -> {level});}
122 $oldlevel = $_ -> {level};
124 if ($_ -> {answers}) {
127 ${$template -> scrap (
133 { $temp -> {name} => $_ -> {name},
134 $temp -> {subject} => $_ -> {subject},
135 $temp -> {cat} => $_ -> {cat},
136 $temp -> {time} => plain(short_hr_time ($_ -> {time})),
137 $temp -> {link} => query_string({$t => $tid, $p => $_ -> {mid}})
146 ${$template -> scrap (
152 { $temp -> {name} => $_ -> {name},
153 $temp -> {subject} => $_ -> {subject},
154 $temp -> {cat} => $_ -> {cat},
155 $temp -> {time} => plain(short_hr_time ($_ -> {time})),
156 $temp -> {link} => query_string({$t => $tid, $p => $_ -> {mid}})
163 $html.='</dl></dd>' x ($oldlevel - $startlevel);
173 ### end of Template::_thread ###################################################
patrick-canterino.de