]>
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
;
16 use Encode
::Plain
; $Encode::Plain
::utf8
= 1;
19 use Posting
::_lib
qw(get_message_node get_message_header get_message_body parse_single_thread hr_time);
23 use Template
::_thread
;
27 # ====================================================
29 # ====================================================
31 use base
qw(Exporter);
32 @Template::Posting
::EXPORT
= qw(print_posting_as_HTML message_as_HTML);
34 ################################
35 # sub print_posting_as_HTML
38 ################################
40 sub print_posting_as_HTML
($$$) {
41 my ($threadpath, $tempfile, $param) = @_;
43 my $template = new Template
$tempfile;
45 # Datei sperren... (eigentlich)
46 my $view = get_view_params
({adminDefault
=> $param -> {adminDefault
}
49 my $xml=new XML
::DOM
::Parser
-> parsefile
($threadpath.'t'.$param -> {thread
}.'.xml');
51 my ($mnode, $tnode) = get_message_node
($xml, 't'.$param -> {thread
}, 'm'.$param -> {posting
});
52 my $pnode = $mnode -> getParentNode
;
53 my $header = get_message_header
($mnode);
54 my $msg = parse_single_thread
($tnode, $param -> {showDeleted
}, $view -> {sortedMsg
});
55 my $pheader = ($pnode -> getNodeName
eq 'Message')?get_message_header
($pnode):{};
57 my $assign = $param -> {assign
};
58 my $formdata = $param -> {form
} -> {data
};
59 my $formact = $param -> {form
} -> {action
};
61 my $body = get_message_body
($xml, 'm'.$param -> {posting
});
63 my $text = message_field
($body,
64 {quoteChars
=> plain
($view -> {quoteChars
}),
66 startCite
=> ${$template -> scrap
($assign -> {startCite
})},
67 endCite
=> ${$template -> scrap
($assign -> {endCite
})}
70 my $area = answer_field
($body,
72 quoteChars
=> plain
($view -> {quoteChars
}),
73 messages
=> $param -> {messages
}
78 for (qw(posterBody uniqueID followUp quoteChar userID posterName posterEmail posterURL posterImage)) {
79 $pars -> {$formdata -> {$_} -> {assign
} -> {name
}} = plain
($formdata -> {$_} -> {name
});}
81 my $cgi = $param -> {cgi
};
83 my $tpar = {thread
=> $param -> {thread
},
84 template
=> $param -> {tree
},
85 start
=> $param -> {posting
},
88 my $plink = %$pheader?
(query_string
({$cgi -> {thread
} => $param -> {thread
}, $cgi -> {posting
} => ($pnode -> getAttribute
('id') =~ /(\d+)/)[0]})):'';
90 print ${$template -> scrap
($assign->{mainDoc
},
91 {$assign->{name
} => plain
($header->{name
}),
92 $assign->{email
} => plain
($header->{email
}),
93 $assign->{home
} => plain
($header->{home
}),
94 $assign->{image
} => plain
($header->{image
}),
95 $assign->{time} => plain
(hr_time
($header->{time})),
96 $assign->{message
} => $text,
97 $assign->{messageTitle
} => plain
($header->{subject
}),
98 $assign->{parentTitle
} => plain
($pheader->{subject
}),
99 $assign->{messageCat
} => plain
($header->{category
}),
100 $assign->{parentCat
} => plain
($pheader->{category
}),
101 $assign->{parentName
} => plain
($pheader->{name
}),
102 $assign->{parentLink
} => $plink,
103 $assign->{parentTime
} => plain
(hr_time
($pheader->{time})),
104 $param->{tree
}->{main
} => html_thread
($msg, $template, $tpar),
105 $formact->{post
}->{assign
} => $formact->{post
}->{url
},
106 $formact->{vote
}->{assign
} => $formact->{vote
}->{url
},
107 $formdata->{posterBody
}->{assign
}->{value
} => $area,
108 $formdata->{uniqueID
} ->{assign
}->{value
} => plain
(unique_id
),
109 $formdata->{followUp
} ->{assign
}->{value
} => plain
($param -> {thread
}.';'.$param -> {posting
}),
110 $formdata->{quoteChar
} ->{assign
}->{value
} => "ÿ".plain
($view -> {quoteChars
}),
111 $formdata->{userID
} ->{assign
}->{value
} => '',
116 ################################
117 # sub message_as_HTML
120 ################################
122 sub message_as_HTML
($$$) {
123 my ($xml, $template, $param) = @_;
125 my $assign = $param -> {assign
};
126 my $body = get_message_body
($xml, $param -> {posting
});
128 my $text = message_field
($body,
129 {quoteChars
=> '»» ',
131 startCite
=> ${$template -> scrap
($assign -> {startCite
})},
132 endCite
=> ${$template -> scrap
($assign -> {endCite
})}
139 # ====================================================
140 # Modulinitialisierung
141 # ====================================================
143 # making require happy
146 # ====================================================
147 # end of Template::Posting
148 # ====================================================
patrick-canterino.de