1 rizwank 1.1 #
2 # TWiki Collaboration Platform, http://TWiki.org/
3 #
4 # Copyright (C) 1999-2004 Peter Thoeny, peter@thoeny.com
5 #
6 # For licensing info read license.txt file in the TWiki root.
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
9 # as published by the Free Software Foundation; either version 2
10 # of the License, or (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details, published at
16 # http://www.gnu.org/copyleft/gpl.html
17 =begin twiki
18
19 ---+ TWiki::UI::Oops
20
21 UI delegate for oops function
22 rizwank 1.1
23 =cut
24
25 package TWiki::UI::Oops;
26
27 use strict;
28 use TWiki;
29
30 =pod
31
32 ---++ oops( )
33 Command handler for error command. Some parameters are passed in CGI:
34 | =template= | name of template to use |
35 | =param1= | Parameter for expansion of template |
36 | =param2= | Parameter for expansion of template |
37 | =param3= | Parameter for expansion of template |
38 | =param4= | Parameter for expansion of template |
39 =cut
40
41 sub oops_cgi {
42 my ( $web, $topic, $user, $query ) = @_;
43 rizwank 1.1
44 my $tmplName = $query->param( 'template' ) || "oops";
45 my $skin = $query->param( "skin" ) || TWiki::Prefs::getPreferencesValue( "SKIN" );
46 my $tmplData = TWiki::Store::readTemplate( $tmplName, $skin );
47 if( ! $tmplData ) {
48 TWiki::writeHeader( $query );
49 print "<html><body>\n"
50 . "<h1>TWiki Installation Error</h1>\n"
51 . "Template file $tmplName.tmpl not found or template directory \n"
52 . "$TWiki::templateDir not found.<p />\n"
53 . "Check the \$templateDir variable in TWiki.cfg.\n"
54 . "</body></html>\n";
55 return;
56 }
57
58 my $param = $query->param( 'param1' ) || "";
59 $tmplData =~ s/%PARAM1%/$param/go;
60 $param = $query->param( 'param2' ) || "";
61 $tmplData =~ s/%PARAM2%/$param/go;
62 $param = $query->param( 'param3' ) || "";
63 $tmplData =~ s/%PARAM3%/$param/go;
64 rizwank 1.1 $param = $query->param( 'param4' ) || "";
65 $tmplData =~ s/%PARAM4%/$param/go;
66
67 $tmplData = &TWiki::handleCommonTags( $tmplData, $topic );
68 $tmplData = &TWiki::Render::getRenderedVersion( $tmplData );
69 $tmplData =~ s/( ?) *<\/?(nop|noautolink)\/?>\n?/$1/gois; # remove <nop> and <noautolink> tags
70
71 TWiki::writeHeader( $query );
72 print $tmplData;
73 }
74
75 1;
|