]>
git.p6c8.net - selfforum.git/blob - selfforum-cgi/shared/Template/Posting.pm
3 # ====================================================
4 # Autor: n.d.p. / 2001-01-14
5 # lm : n.d.p. / 2001-01-14
6 # ====================================================
8 # HTML-Darstellung eines Postings
9 # ====================================================
13 package Template
::Posting
;
15 use vars
qw(@ISA @EXPORT);
18 use Encode::Plain; $Encode::Plain::utf8 = 1;
21 use Posting
::_lib
qw(get_message_node get_message_header get_message_body parse_single_thread hr_time);
24 use Template
::_thread
;
28 # ====================================================
30 # ====================================================
34 @EXPORT = qw(print_posting_as_HTML message_as_HTML);
36 ################################
37 # sub print_posting_as_HTML
40 ################################
42 sub print_posting_as_HTML
($$$) {
43 my ($threadpath, $tempfile, $param) = @_;
45 my $template = new Template
$tempfile;
47 # Datei sperren... (eigentlich)
48 my $xml=new XML
::DOM
::Parser
-> parsefile
($threadpath.'t'.$param -> {thread
}.'.xml');
50 my ($mnode, $tnode) = get_message_node
($xml, 't'.$param -> {thread
}, 'm'.$param -> {posting
});
51 my $pnode = $mnode -> getParentNode
;
52 my $header = get_message_header
($mnode);
53 my $msg = parse_single_thread
($tnode, 0, 0);
54 my $pheader = ($pnode -> getNodeName
eq 'Message')?get_message_header
($pnode):{};
56 my $assign = $param -> {assign
};
57 my $formdata = $param -> {form
} -> {data
};
58 my $formact = $param -> {form
} -> {action
};
60 my $body = get_message_body
($xml, 'm'.$param -> {posting
});
62 my $text = message_field
($body,
63 {quoteChars
=> '»» ',
65 startCite
=> ${$template -> scrap
($assign -> {startCite
})},
66 endCite
=> ${$template -> scrap
($assign -> {endCite
})}
69 my $area = answer_field
($body,
71 quoteChars
=> '»» ',
72 messages
=> $param -> {messages
}
77 for (qw(posterBody uniqueID followUp quoteChar userID posterName posterEmail posterURL posterImage)) {
78 $pars -> {$formdata -> {$_} -> {assign
} -> {name
}} = plain
($formdata -> {$_} -> {name
});}
80 my $cgi = $param -> {cgi
};
82 my $tpar = {thread
=> $param -> {thread
},
83 template
=> $param -> {tree
},
84 start
=> $param -> {posting
},
87 my $plink = %$pheader?
(query_string
({$cgi -> {thread
} => $param -> {thread
}, $cgi -> {posting
} => ($pnode -> getAttribute
('id') =~ /(\d+)/)[0]})):'';
89 print ${$template -> scrap
($assign->{mainDoc
},
90 {$assign->{name
} => plain
($header->{name
}),
91 $assign->{email
} => plain
($header->{email
}),
92 $assign->{home
} => plain
($header->{home
}),
93 $assign->{image
} => plain
($header->{image
}),
94 $assign->{time} => plain
(hr_time
($header->{time})),
95 $assign->{message
} => $text,
96 $assign->{messageTitle
} => plain
($header->{subject
}),
97 $assign->{parentTitle
} => plain
($pheader->{subject
}),
98 $assign->{messageCat
} => plain
($header->{category
}),
99 $assign->{parentCat
} => plain
($pheader->{category
}),
100 $assign->{parentName
} => plain
($pheader->{name
}),
101 $assign->{parentLink
} => $plink,
102 $assign->{parentTime
} => plain
(hr_time
($pheader->{time})),
103 $param->{tree
}->{main
} => html_thread
($msg, $template, $tpar),
104 $formact->{post
}->{assign
} => $formact->{post
}->{url
},
105 $formact->{vote
}->{assign
} => $formact->{vote
}->{url
},
106 $formdata->{posterBody
}->{assign
}->{value
} => $area,
107 $formdata->{uniqueID
} ->{assign
}->{value
} => plain
(unique_id
),
108 $formdata->{followUp
} ->{assign
}->{value
} => plain
($param -> {thread
}.';'.$param -> {posting
}),
109 $formdata->{quoteChar
} ->{assign
}->{value
} => "ÿ".plain
('»» '),
110 $formdata->{userID
} ->{assign
}->{value
} => '',
115 ################################
116 # sub message_as_HTML
119 ################################
121 sub message_as_HTML
($$$) {
122 my ($xml, $template, $param) = @_;
124 my $assign = $param -> {assign
};
125 my $body = get_message_body
($xml, $param -> {posting
});
127 my $text = message_field
($body,
128 {quoteChars
=> '»» ',
130 startCite
=> ${$template -> scrap
($assign -> {startCite
})},
131 endCite
=> ${$template -> scrap
($assign -> {endCite
})}
138 # ====================================================
139 # Modulinitialisierung
140 # ====================================================
142 # making require happy
145 # ====================================================
146 # end of Template::Posting
147 # ====================================================
patrick-canterino.de