/[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.3 - (show annotations) (download)
Sun Feb 1 12:15:07 2004 UTC (22 years, 7 months ago) by wakaba
Branch: MAIN
Changes since 1.2: +13 -4 lines
More resource'ization

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: 2004/01/16 07:52:29 $
16 @RequiredModule[list]:
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 => navbar, class => navbar,
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 }p,
68 );#;
69 $opt2->{o} = bless {
70 wiki => $self->{view}->{wiki},
71 plugin => $self->{view}->{wiki}->{plugin},
72 var => {},
73 }, 'SuikaWiki::Plugin';
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} = $self->{view}->{wiki}->{config}->{charset}->{output};
82 $opt2->{output}->set_expires (%{$self->{view}->{wiki}->{config}->{entity}->{expires}->{q#error#}});
83
84 $self->{view}->{wiki}->close_db;
85 $self->main_pre ($opt, $opt2);
86
87 my $fmt = SuikaWiki::Plugin->formatter ('view');
88 $opt2->{output}->{entity}->{body}
89 = $fmt->replace ($opt2->{template}, param => $opt2->{o});
90 $opt2->{output}->output (output => 'http-cgi');
91 $self->main_post ($opt, $opt2);
92
93 Function:
94 @Name: reporting_error
95 @Description:
96 @@@:
97 Reporting database error (or warning) message
98 @@lang:en
99 @Main:
100 my (undef, $err, $wiki) = @_;
101 my $error = {http_status => $err->{-def}->{http_status}};
102 my $dl = $error->{description}
103 = new Message::Markup::XML::Node
104 (type => '#element',
105 namespace_uri => $NS_XHTML1,
106 local_name => 'dl');
107 ## TODO: Use resource
108 $dl->append_new_node (type => '#element',
109 namespace_uri => $NS_XHTML1,
110 local_name => 'dt')
111 ->append_text ($WIKIRESOURCE->get (name => 'Error:Detail',
112 wiki => $wiki));
113 $dl->append_new_node (type => '#element',
114 namespace_uri => $NS_XHTML1,
115 local_name => 'dd')
116 ->append_text ($err->text);
117 $dl->append_new_node (type => '#element',
118 namespace_uri => $NS_XHTML1,
119 local_name => 'dt')
120 ->append_text ($WIKIRESOURCE->get (name => 'Error:Call Stack Trace',
121 wiki => $wiki));
122 SuikaWiki::Plugin->module_package ('Error')->make_caller_trace_table
123 ($dl->append_new_node (type => '#element',
124 namespace_uri => $NS_XHTML1,
125 local_name => 'dd'),
126 {skip => 2});
127 push @{$wiki->{var}->{error}||=[]}, $error;
128
129 Resource:
130 @WikiDB:FatalError:Description:
131 @@@:
132 Some fatal error occurs during processing your request.
133 Please contact the administrator of the wiki
134 with error messages below.
135 @@lang:en
136 @WikiDB:FatalError:Title:
137 @@@: Internal WikiDatabase Error
138 @@lang:en
139 @WikiDB:FatalError:WebPageTitle:
140 @@@: WikiDatabase Error (%page-name;)
141 @@lang:en
142

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24