]> git.p6c8.net - selfforum.git/blob - selfforum-cgi/shared/Template/Delete.pm
Delete.pm: template for administrator interface to delete msgs.
[selfforum.git] / selfforum-cgi / shared / Template / Delete.pm
1 package Template::Delete;
2
3 ################################################################################
4 # #
5 # File: shared/Template/Delete.pm #
6 # #
7 # Authors: Christian Kruse <ckruse@wwwtech.de> #
8 # #
9 # Description: 'Administrator' view of forum index for deleting msgs #
10 # #
11 ################################################################################
12
13 use strict;
14 use vars qw(
15 @EXPORT
16 );
17
18 use Lock;
19 use Encode::Plain; $Encode::Plain::utf8 = 1;
20 use Posting::_lib qw(
21 get_all_threads
22 long_hr_time
23 );
24 use Template;
25 use Template::_conf;
26 use Template::_thread;
27 use Data::Dumper;
28
29 ################################################################################
30 #
31 # Version check
32 #
33 # last modified:
34 # $Date$ (GMT)
35 # by $Author$
36 #
37 sub VERSION {(q$Revision$ =~ /([\d.]+)\s*$/)[0] or '0.0'}
38
39 ################################################################################
40 #
41 # Export
42 #
43 use base qw(Exporter);
44 @EXPORT = qw(print_forum_as_HTML);
45
46 ### print_forum_as_HTML () #####################################################
47 #
48 # print Forum main file to STDOUT
49 #
50 # Params: $mainfile - main xml file name
51 # $tempfile - template file name
52 # $param - hash reference (see doc for details)
53 #
54 # Return: ~none~
55 #
56 sub print_forum_as_HTML ($$$) {
57 my ($mainfile, $tempfile, $param) = @_;
58 my $assign = $param->{assign};
59
60 my $template = new Template $tempfile;
61
62 my ($threads, $stat);
63 my $main = new Lock ($mainfile);
64
65 unless ($main->lock (LH_SHARED)) {
66 unless ($main->masterlocked) {
67 print ${$template->scrap (
68 $assign->{errorDoc},
69 { $assign->{errorText} => $template->insert ($assign->{'occupied'}) }
70 )};
71 }
72 else {
73 print ${$template->scrap (
74 $assign->{errorDoc},
75 { $assign->{errorText} => $template->insert($assign->{'notAvailable'}) }
76 )};
77 }}
78
79 else {
80 my $view = get_view_params (
81 { adminDefault => $param->{adminDefault} }
82 );
83
84 # set process priority, remove if you don't need...
85 #
86 eval {setpriority 0,0,1};
87
88 $threads = get_all_threads($main->filename, $param->{showDeleted}, $view->{sortedMsg});
89 $main->unlock;
90
91 print ${$template->scrap (
92 $assign->{mainDocStart},
93 { $assign->{loadingTime} => plain(long_hr_time (time)) }
94 )
95 },"\n<dl>";
96
97 my $tpar = {
98 template => $param->{tree},
99 cgi => $param->{cgi},
100 start => -1
101 };
102
103 my @threads;
104
105 unless ($view->{sortedThreads}) {
106 @threads = sort {$b <=> $a} keys %$threads;
107 }
108 else {
109 @threads = sort {$a <=> $b} keys %$threads;
110 }
111
112 for (@threads) {
113 $tpar->{thread} = "$_";
114
115 print ${
116 html_thread(
117 $threads->{$_}, $template, $tpar, {
118 action => '<a href="fo_delete.pl?m={mid}&t='.$_.'&c=d"><b>L&ouml;schen</b></a>',
119 actionDeleted => '<a href="fo_delete.pl?m={mid}&t='.$_.'&c=w"><b>Wiederherstellen</b></a>',
120 base_link => 'fo_delete.pl'
121 }
122 )
123 },"\n",'<dd>&nbsp;</dd>',"\n";
124 }
125
126 print "</dl>\n",${$template->scrap($assign->{mainDocEnd})};}
127
128 return;
129 }
130
131 # keep 'require' happy
132 1;
133
134 #
135 #
136 ### end of Template::Forum #####################################################

patrick-canterino.de