From: fox_two <> Date: Tue, 27 Feb 2001 21:30:10 +0000 (+0000) Subject: change_posting_visibility(): works now recursive, todo: delete 'invisible' X-Git-Url: https://git.p6c8.net/selfforum.git/commitdiff_plain/cd70ccb79697cf5a16df1dda1063e0c0a36e17cb change_posting_visibility(): works now recursive, todo: delete 'invisible' flag instead of setting it to 0 --- diff --git a/selfforum-cgi/shared/Posting/Handle.pm b/selfforum-cgi/shared/Posting/Handle.pm index 27c211b..11ec9aa 100644 --- a/selfforum-cgi/shared/Posting/Handle.pm +++ b/selfforum-cgi/shared/Posting/Handle.pm @@ -17,7 +17,7 @@ use base qw(Exporter); @EXPORT = qw(hide_posting recover_posting); -use Posting::_lib; +use Posting::_lib qw(get_message_node); use XML::DOM; @@ -80,9 +80,16 @@ sub change_posting_visibility($$$) my $parser = new XML::DOM::Parser; my $xml = $parser->parsefile($fname); + # Set flag in given msg my $mnode = get_message_node($xml, $tid, $mid); $mnode->setAttribute('invisible', $invisible); + # Set flag in sub nodes + for ($mnode->getElementsByTagName('Message')) + { + $_->setAttribute('invisible', $invisible); + } + $xml->printToFile($fname.'.temp'); rename $fname.'.temp', $fname; }