/[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.4 - (show annotations) (download)
Sun Feb 8 08:52:03 2004 UTC (22 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.3: +7 -4 lines
SuikaWiki 3 WikiName interface supported

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24