]>
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);
25 use Template
::_thread
;
29 # ====================================================
31 # ====================================================
35 @EXPORT = qw(print_posting_as_HTML message_as_HTML);
37 ################################
38 # sub print_posting_as_HTML
41 ################################
43 sub print_posting_as_HTML
($$$) {
44 my ($threadpath, $tempfile, $param) = @_;
46 my $template = new Template
$tempfile;
48 # Datei sperren... (eigentlich)
49 my $view = get_view_params
({adminDefault
=> $param -> {adminDefault
}
52 my $xml=new XML
::DOM
::Parser
-> parsefile
($threadpath.'t'.$param -> {thread
}.'.xml');
54 my ($mnode, $tnode) = get_message_node
($xml, 't'.$param -> {thread
}, 'm'.$param -> {posting
});
55 my $pnode = $mnode -> getParentNode
;
56 my $header = get_message_header
($mnode);
57 my $msg = parse_single_thread
($tnode, $param -> {showDeleted
}, $view -> {sortedMsg
});
58 my $pheader = ($pnode -> getNodeName
eq 'Message')?get_message_header
($pnode):{};
60 my $assign = $param -> {assign
};
61 my $formdata = $param -> {form
} -> {data
};
62 my $formact = $param -> {form
} -> {action
};
64 my $body = get_message_body
($xml, 'm'.$param -> {posting
});
66 my $text = message_field
($body,
67 {quoteChars
=> plain
($view -> {quoteChars
}),
69 startCite
=> ${$template -> scrap
($assign -> {startCite
})},
70 endCite
=> ${$template -> scrap
($assign -> {endCite
})}
73 my $area = answer_field
($body,
75 quoteChars
=> plain
($view -> {quoteChars
}),
76 messages
=> $param -> {messages
}
81 for (qw(posterBody uniqueID followUp quoteChar userID posterName posterEmail posterURL posterImage)) {
82 $pars -> {$formdata -> {$_} -> {assign
} -> {name
}} = plain
($formdata -> {$_} -> {name
});}
84 my $cgi = $param -> {cgi
};
86 my $tpar = {thread
=> $param -> {thread
},
87 template
=> $param -> {tree
},
88 start
=> $param -> {posting
},
91 my $plink = %$pheader?
(query_string
({$cgi -> {thread
} => $param -> {thread
}, $cgi -> {posting
} => ($pnode -> getAttribute
('id') =~ /(\d+)/)[0]})):'';
93 print ${$template -> scrap
($assign->{mainDoc
},
94 {$assign->{name
} => plain
($header->{name
}),
95 $assign->{email
} => plain
($header->{email
}),
96 $assign->{home
} => plain
($header->{home
}),
97 $assign->{image
} => plain
($header->{image
}),
98 $assign->{time} => plain
(hr_time
($header->{time})),
99 $assign->{message
} => $text,
100 $assign->{messageTitle
} => plain
($header->{subject
}),
101 $assign->{parentTitle
} => plain
($pheader->{subject
}),
102 $assign->{messageCat
} => plain
($header->{category
}),
103 $assign->{parentCat
} => plain
($pheader->{category
}),
104 $assign->{parentName
} => plain
($pheader->{name
}),
105 $assign->{parentLink
} => $plink,
106 $assign->{parentTime
} => plain
(hr_time
($pheader->{time})),
107 $param->{tree
}->{main
} => html_thread
($msg, $template, $tpar),
108 $formact->{post
}->{assign
} => $formact->{post
}->{url
},
109 $formact->{vote
}->{assign
} => $formact->{vote
}->{url
},
110 $formdata->{posterBody
}->{assign
}->{value
} => $area,
111 $formdata->{uniqueID
} ->{assign
}->{value
} => plain
(unique_id
),
112 $formdata->{followUp
} ->{assign
}->{value
} => plain
($param -> {thread
}.';'.$param -> {posting
}),
113 $formdata->{quoteChar
} ->{assign
}->{value
} => "ÿ".plain
($view -> {quoteChars
}),
114 $formdata->{userID
} ->{assign
}->{value
} => '',
119 ################################
120 # sub message_as_HTML
123 ################################
125 sub message_as_HTML
($$$) {
126 my ($xml, $template, $param) = @_;
128 my $assign = $param -> {assign
};
129 my $body = get_message_body
($xml, $param -> {posting
});
131 my $text = message_field
($body,
132 {quoteChars
=> '»» ',
134 startCite
=> ${$template -> scrap
($assign -> {startCite
})},
135 endCite
=> ${$template -> scrap
($assign -> {endCite
})}
142 # ====================================================
143 # Modulinitialisierung
144 # ====================================================
146 # making require happy
149 # ====================================================
150 # end of Template::Posting
151 # ====================================================
patrick-canterino.de