]>
git.p6c8.net - selfforum.git/blob - selfforum-cgi/shared/Template/Posting.pm
5081a1a9a8b182e7ace6c793bfac89d73775b606
1 package Template
::Posting
;
3 ################################################################################
5 # File: shared/Template/Posting.pm #
7 # Authors: Andre Malo <nd@o3media.de>, 2001-04-01 #
9 # Description: show HTML formatted posting #
11 ################################################################################
16 use Encode
::Plain
; $Encode::Plain
::utf8
= 1;
30 use Template
::_thread
;
34 ################################################################################
38 use base
qw(Exporter);
39 @Template::Posting
::EXPORT
= qw(
44 ### sub print_posting_as_HTML ($$$) ############################################
46 # print HTML formatted Posting to STDOUT
48 # Params: $threadpath - /path/to/thread_files
49 # $tempfile - template file
50 # $param - Hash-Reference (see doc for details)
54 sub print_posting_as_HTML
($$$) {
55 my ($threadpath, $tempfile, $param) = @_;
57 my $template = new Template
$tempfile;
59 # Datei sperren... (eigentlich)
60 my $view = get_view_params
({
61 adminDefault
=> $param -> {adminDefault
}
64 my $xml = parse_xml_file
($threadpath.'t'.$param -> {thread
}.'.xml');
66 my ($mnode, $tnode) = get_message_node
($xml, 't'.$param -> {thread
}, 'm'.$param -> {posting
});
67 my $pnode = $mnode -> getParentNode
;
68 my $header = get_message_header
($mnode);
69 my $msg = parse_single_thread
($tnode, $param -> {showDeleted
}, $view -> {sortedMsg
});
70 my $pheader = ($pnode -> getNodeName
eq 'Message')?get_message_header
($pnode):{};
72 my $assign = $param -> {assign
};
73 my $formdata = $param -> {form
} -> {data
};
74 my $formact = $param -> {form
} -> {action
};
76 my $body = get_message_body
($xml, 'm'.$param -> {posting
});
78 my $text = message_field
(
80 { quoteChars
=> plain
($view -> {quoteChars
}),
82 startCite
=> ${$template -> scrap
($assign -> {startCite
})},
83 endCite
=> ${$template -> scrap
($assign -> {endCite
})}
87 my $area = answer_field
(
90 quoteChars
=> plain
($view -> {quoteChars
}),
91 messages
=> $param -> {messages
}
97 $pars -> {$formdata -> {$_} -> {assign
} -> {name
}} = plain
($formdata -> {$_} -> {name
})
110 my $cgi = $param -> {cgi
};
113 thread
=> $param -> {thread
},
114 template
=> $param -> {tree
},
115 start
=> $param -> {posting
},
122 $assign->{parentTitle
} => plain
($pheader->{subject
}),
123 $assign->{parentCat
} => plain
($pheader->{category
}),
124 $assign->{parentName
} => plain
($pheader->{name
}),
125 $assign->{parentTime
} => plain
(hr_time
($pheader->{time})),
126 $assign->{parentLink
} => query_string
(
127 { $cgi -> {thread
} => $param -> {thread
},
128 $cgi -> {posting
} => ($pnode -> getAttribute
('id') =~ /(\d+)/)[0]
132 print ${$template -> scrap
(
134 { $assign->{name
} => plain
($header->{name
}),
135 $assign->{email
} => plain
($header->{email
}),
136 $assign->{home
} => plain
($header->{home
}),
137 $assign->{image
} => plain
($header->{image
}),
138 $assign->{time} => plain
(hr_time
($header->{time})),
139 $assign->{message
} => $text,
140 $assign->{messageTitle
} => plain
($header->{subject
}),
141 $assign->{messageCat
} => plain
($header->{category
}),
142 $param->{tree
}->{main
} => html_thread
($msg, $template, $tpar),
143 $formact->{post
}->{assign
} => $formact->{post
}->{url
},
144 $formact->{vote
}->{assign
} => $formact->{vote
}->{url
},
145 $formdata->{posterBody
}->{assign
}->{value
} => $area,
146 $formdata->{uniqueID
} ->{assign
}->{value
} => plain
(unique_id
),
147 $formdata->{followUp
} ->{assign
}->{value
} => plain
($param -> {thread
}.';'.$param -> {posting
}),
148 $formdata->{quoteChar
} ->{assign
}->{value
} => "ÿ".plain
($view -> {quoteChars
}),
149 $formdata->{userID
} ->{assign
}->{value
} => ''
158 ### sub message_as_HTML ($$$) ##################################################
160 # create HTML String for the Messagetext
162 # Params: $xml - XML::DOM::Document object
163 # $template - Template object
164 # $param - Hash reference
165 # (assign, posting, quoteChars, quoting)
167 # Return: HTML String
169 sub message_as_HTML
($$$) {
170 my ($xml, $template, $param) = @_;
172 my $assign = $param -> {assign
};
173 my $body = get_message_body
($xml, $param -> {posting
});
175 my $text = message_field
(
177 { quoteChars
=> plain
($param -> {quoteChars
}),
178 quoting
=> $param -> {quoting
},
179 startCite
=> ${$template -> scrap
($assign -> {startCite
})},
180 endCite
=> ${$template -> scrap
($assign -> {endCite
})}
193 ### end of Template::Posting ###################################################
patrick-canterino.de