/[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.1 - (show annotations) (download)
Fri Dec 26 06:38:12 2003 UTC (22 years, 6 months ago) by wakaba
Branch: MAIN
New module

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]: [email protected]
15 @Date.RCS: $Date: 2003/11/25 12:38:22 $
16 @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 content => {
52 %paragraph (content => {%res (name =>
53 {WikiDB:FatalError:Description});}p);
54 %error-list (
55 no-error => {%res (name => {Error:NoErrorReported});}p,
56 );
57 },
58 );
59 }p,
60 );#;
61 $opt2->{o} = bless {
62 wiki => $self->{view}->{wiki},
63 plugin => $self->{view}->{wiki}->{plugin},
64 var => {},
65 }, 'SuikaWiki::Plugin';
66 for (@{$self->{view}->{wiki}->{var}->{error}||{}}) {
67 $opt2->{output}->{status_code} = $_->{http_status}
68 if $opt2->{output}->{status_code} < $_->{http_status};
69 }
70 $opt2->{output}->{status_code} ||= 500;
71
72 $opt2->{output}->{entity}->{media_type} = q#text/html#;
73 $opt2->{output}->{entity}->{charset} = $self->{view}->{wiki}->{config}->{charset}->{output};
74 $opt2->{output}->set_expires (%{$self->{view}->{wiki}->{config}->{entity}->{expires}->{q#error#}});
75
76 $self->{view}->{wiki}->close_db;
77 $self->main_pre ($opt, $opt2);
78
79 my $fmt = SuikaWiki::Plugin->formatter ('view');
80 $opt2->{output}->{entity}->{body}
81 = $fmt->replace ($opt2->{template}, param => $opt2->{o});
82 $opt2->{output}->output (output => 'http-cgi');
83 $self->main_post ($opt, $opt2);
84
85 Function:
86 @Name: reporting_error
87 @Description:
88 @@@:
89 Reporting database error (or warning) message
90 @@lang:en
91 @Main:
92 my (undef, $err, $wiki) = @_;
93 my $error = {http_status => $err->{-def}->{http_status}};
94 my $dl = $error->{description}
95 = new Message::Markup::XML::Node
96 (type => '#element',
97 namespace_uri => $NS_XHTML1,
98 local_name => 'dl');
99 ## TODO: Use resource
100 $dl->append_new_node (type => '#element',
101 namespace_uri => $NS_XHTML1,
102 local_name => 'dt')
103 ->append_text ('Detail');
104 $dl->append_new_node (type => '#element',
105 namespace_uri => $NS_XHTML1,
106 local_name => 'dd')
107 ->append_text ($err->text);
108 $dl->append_new_node (type => '#element',
109 namespace_uri => $NS_XHTML1,
110 local_name => 'dt')
111 ->append_text ('Call stack trace');
112 SuikaWiki::Plugin->module_package ('Error')->make_caller_trace_table
113 ($dl->append_new_node (type => '#element',
114 namespace_uri => $NS_XHTML1,
115 local_name => 'dd'),
116 {skip => 2});
117 push @{$wiki->{var}->{error}||=[]}, $error;
118
119 Resource:
120 @WikiDB:FatalError:Description:
121 @@@:
122 Some fatal error occurs during processing your request.
123 Please contact the administrator of the wiki
124 with error messages below.
125 @@lang:en
126 @WikiDB:FatalError:Title:
127 @@@: Internal WikiDatabase Error
128 @@lang:en
129 @WikiDB:FatalError:WebPageTitle:
130 @@@: WikiDatabase Error (%page-name;)
131 @@lang:en
132

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24