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