/[pub]/suikawiki/script/lib/SuikaWiki/Plugin/WikiDB.wp2
Suika

Contents of /suikawiki/script/lib/SuikaWiki/Plugin/WikiDB.wp2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Wed Feb 18 07:18:30 2004 UTC (21 years, 5 months ago) by wakaba
Branch: MAIN
CVS Tags: suikawiki3-redirect, release-3-0-0, HEAD
Branch point for: paragraph-200404, helowiki, helowiki-2005
Changes since 1.4: +8 -10 lines
WikiDB Error reporting bug fixed

1 #?SuikaWikiConfig/2.0
2
3 Plugin:
4 @Name: WikiDB
5 @Description:
6 @@@: WikiDatabase support
7 @@lang:en
8 @License: %%Perl%%
9 @Author:
10 @@Name:
11 @@@@: Wakaba
12 @@@lang:ja
13 @@@script:Latn
14 @@Mail[list]: w@suika.fam.cx
15 @Date.RCS:
16 $Date: 2004/02/08 08:52:03 $
17 @RequiredPlugin[list]:
18 Error
19 WikiView
20 WikiStruct
21 WikiLinking
22 WikiResource
23 HTML
24 @Use:
25 my $WIKIRESOURCE;
26
27 PluginConst:
28 @NS_XHTML1:
29 http://www.w3.org/1999/xhtml
30 @WIKIRESOURCE:
31 {($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))}
32
33 ViewDefinition:
34 @Mode: -wdb--fatal-error
35 @Description:
36 @@@: Reporting fatal error with WikiDB system
37 @@lang: en
38 @method:
39 @@Name: main
40 @@@:
41 require SuikaWiki::Output::HTTP;
42 $opt2->{output} = SuikaWiki::Output::HTTP->new
43 (wiki => $self->{view}->{wiki},
44 view => $self->{view}, viewobj => $self);
45 for (@{$self->{view}->{wiki}->{var}->{client}->{used_for_negotiate}},
46 'Accept-Language') {
47 $opt2->{output}->add_negotiate_header_field ($_);
48 }
49
50 $opt2->{template} = q#%html-document (
51 title => {%res(name=>{WikiDB:FatalError:WebPageTitle});}p,
52 link-meta => {%template (name => links);
53 %html-meta(name => ROBOTS, content => NOINDEX);}p,
54 content => {
55 %block (id => tools1, class => tools,
56 content => {%template (name => navbar);}p);
57 %section (title => {%res (name => {WikiDB:FatalError:Title});}p,
58 heading,
59 content => {
60 %paragraph (content => {%res (name =>
61 {WikiDB:FatalError:Description});}p);
62 %error-list (
63 no-error => {%res (name => {Error:NoErrorReported});}p,
64 );
65 }p,
66 );
67 %block (id => footer, content => {%template (name => ws--footer);}p);
68 }p,
69 );#;
70 $opt2->{o} = {
71 wiki => $self->{view}->{wiki},
72 var => {wv__output => $opt2->{output}},
73 };
74 for (@{$self->{view}->{wiki}->{var}->{error}||[]}) {
75 $opt2->{output}->{status_code} = $_->{http_status}
76 if $opt2->{output}->{status_code} < $_->{http_status};
77 }
78 $opt2->{output}->{status_code} ||= 500;
79
80 $opt2->{output}->{entity}->{media_type} = q#text/html#;
81 $opt2->{output}->{entity}->{charset}
82 = $self->{view}->{wiki}->{config}->{charset}->{output};
83 $opt2->{output}->set_expires
84 (%{$self->{view}->{wiki}->{config}->{entity}->{expires}->{q#error#}});
85
86 $self->{view}->{wiki}->close_db;
87 $self->main_pre ($opt, $opt2);
88
89 my $fmt = SuikaWiki::Plugin->formatter ('view');
90 $opt2->{output}->{entity}->{body}
91 = $fmt->replace ($opt2->{template}, param => $opt2->{o});
92 $opt2->{output}->output (output => 'http-cgi');
93 $self->main_post ($opt, $opt2);
94
95 Function:
96 @Name: reporting_error
97 @Description:
98 @@@:
99 Reporting database error (or warning) message
100 @@lang:en
101 @Main:
102 my (undef, $err, $wiki) = @_;
103 my $error = {http_status => $err->{-def}->{http_status}};
104 my $dl = $error->{description}
105 = new Message::Markup::XML::Node
106 (type => '#element',
107 namespace_uri => $NS_XHTML1,
108 local_name => 'dl');
109 $dl->append_new_node (type => '#element',
110 namespace_uri => $NS_XHTML1,
111 local_name => 'dt')
112 ->append_text ($WIKIRESOURCE->get (name => 'Error:Detail',
113 wiki => $wiki));
114 $dl->append_new_node (type => '#element',
115 namespace_uri => $NS_XHTML1,
116 local_name => 'dd')
117 ->append_text ($err->text);
118 $dl->append_new_node (type => '#element',
119 namespace_uri => $NS_XHTML1,
120 local_name => 'dt')
121 ->append_text ($WIKIRESOURCE->get (name => 'Error:Call Stack Trace',
122 wiki => $wiki));
123 SuikaWiki::Plugin->module_package ('Error')->make_caller_trace_table
124 ($dl->append_new_node (type => '#element',
125 namespace_uri => $NS_XHTML1,
126 local_name => 'dd'),
127 {skip => 2});
128 push @{$wiki->{var}->{error}||=[]}, $error;
129
130 Resource:
131 @WikiDB:FatalError:Description:
132 @@@:
133 Some fatal error occurs on WikiDB system during processing your request.
134 Please contact the administrator of the wiki
135 with error messages below.
136 @@lang:en
137 @WikiDB:FatalError:Title:
138 @@@: Internal WikiDatabase Error
139 @@lang:en
140 @WikiDB:FatalError:WebPageTitle:
141 @@@: %err--http-status-code; WikiDatabase Error (%page-name;)
142 @@lang:en
143

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24  
Google Analytics is used in this page; Cookies are used. 忍者AdMax is used in this page; Cookies are used. Privacy policy.