1 |
|
=head1 NAME |
2 |
|
|
3 |
|
suikawiki-config.ph - SuikaWiki: Configuration for SuikaWiki HTTP CGI Driver |
4 |
|
|
5 |
|
=head1 DESCRIPTION |
6 |
|
|
7 |
|
This is a configuration file for SuikaWiki Driver for HTTP CGI Script |
8 |
|
(SWHCS). Basic options such as WikiDB directory mapping and |
9 |
|
special purpose WikiPage names can be customized with this file. |
10 |
|
|
11 |
|
More complex customizing, e.g. modifying navigation bar or |
12 |
|
adding new mode, is also possible by config.ph (generated from |
13 |
|
config.wp2) and WikiPlugin modules. For more information, |
14 |
|
see <http://suika.fam.cx/~wakaba/-temp/wiki/wiki?SuikaWiki>. |
15 |
|
|
16 |
|
This file is part of SuikaWiki. |
17 |
|
|
18 |
|
=cut |
19 |
|
|
20 |
|
package wiki::driver::http; |
21 |
use strict; |
use strict; |
22 |
|
|
23 |
## URI (or part of URI) of Wiki CGI itself and its external addons |
## These lines should be removed after utf8 support |
24 |
## Note: If your Wiki CGI URI is <http://foo.example/path/to/wiki.cgi>, |
BEGIN { |
25 |
## cookie-path: /path/to/ |
$Message::Util::Formatter::Base::Token = qr/[\w._+\x80-\xFF-]+/; |
26 |
## script-short-name: wiki.cgi |
require Message::Util::Formatter::Base; |
|
## URI parts MUST NOT contains "&" and/or non-URI characters. |
|
|
our %uri = ( |
|
|
cookie_path => '/~wakaba/-temp/wiki/', |
|
|
external_script => '../wiki/script/', |
|
|
script_short_name => 'wiki', |
|
|
## If you use CVS repository of WikiDatabase, |
|
|
cvs_repository => '/gate/cvs/suikawiki/wikidata/page/', |
|
|
); |
|
|
our $url_cgi; { |
|
|
my $scheme = 'http'; |
|
|
$scheme = lc $1 if $main::ENV{SERVER_PROTOCOL} =~ m#([A-Za-z0-9+.%-]+)#; |
|
|
$url_cgi = "$scheme://".($main::ENV{HTTP_HOST} || $main::ENV{SERVER_NAME}.($main::ENV{SERVER_PORT}==80?'':":$main::ENV{SERVER_PORT}"))."$uri{cookie_path}$uri{script_short_name}"; |
|
27 |
} |
} |
28 |
$uri{wiki_abs} = $url_cgi; |
use Message::Util::Error; |
|
$uri{wiki} = qq($uri{cookie_path}$uri{script_short_name}); |
|
29 |
|
|
30 |
## Path to modules and databases |
use Message::Util::QName::General [q<ExpandedURI>], { |
31 |
push @main::INC, 'lib'; |
'log' => q<http://suika.fam.cx/~wakaba/-temp/2004/05/01/reqlog#>, |
32 |
push @SuikaWiki::Plugin::plugin_directory, ( |
'media-type' => q<http://suika.fam.cx/~wakaba/-temp/2004/04/24/mt#>, |
33 |
q(lib/SuikaWiki/Plugin/), |
'ss' => q<http://suika.fam.cx/~wakaba/archive/2004/05/sw-stylesheet#>, |
|
q(misc/plugins/), |
|
|
); |
|
|
our %PathTo = ( ## Path to your data, from the main CGI script (NOT from this config script) |
|
|
CachePrefix => q(./wikidata/.cache.), |
|
|
TempPrefix => q(./wikidata/.tmp.), |
|
|
WikiDataBase => q(./wikidata/page), |
|
|
WikiDatabase => q(./wikidata/page), |
|
|
WikiDatabaseErrorLog => q(./wikidata/log/error.log), |
|
|
convert => q(/usr/X11R6/bin/convert), |
|
|
); |
|
|
|
|
|
require SuikaWiki::DB::Util::Lock; |
|
|
our $locker = SuikaWiki::DB::Util::Lock->new (-directory => q(./wikidata/lock), |
|
|
-name => 'wikipage', |
|
|
-retry => ($main::ENV{HTTP_USER_AGENT} =~ m#Openbot/3# ? 2 : 80), |
|
|
-timeout => 300, |
|
|
-error_handler => sub { |
|
|
my ($self, %o) = @_; |
|
|
open LOG, '>>', $main::PathTo{WikiDatabaseErrorLog}; |
|
|
print LOG scalar (gmtime)."\@@{[time]} @{[$$]} {$o{level}}: ", $o{msg}, "\n"; |
|
|
close LOG; |
|
|
if ($o{level} eq 'fatal') { |
|
|
die $o{msg}; |
|
|
} |
|
|
}); |
|
|
$locker->lock or do { |
|
|
open LOG, '>>', $main::PathTo{WikiDatabaseErrorLog}; |
|
|
print LOG scalar (time), " Can't lock\n"; |
|
|
close LOG; |
|
|
print "Status: 423 Locked\n"; |
|
|
die "Can't lock --- already locked"; |
|
34 |
}; |
}; |
35 |
|
|
36 |
|
BEGIN { |
37 |
|
if ($main::ENV{REQUEST_URI} =~ /\#/) { |
38 |
|
require SuikaWiki::Output::HTTP; |
39 |
|
my $out = SuikaWiki::Output::HTTP->new; |
40 |
|
$out->{status_code} = 401; |
41 |
|
$out->{status_phrase} = q<Request-URI MUST NOT have Fragment Identifier>; |
42 |
|
$out->{entity}->{media_type} = q<text/html>; |
43 |
|
$out->{entity}->{charset} = q<iso-8859-1>; |
44 |
|
$out->{entity}->{language} = [q<en>]; |
45 |
|
$out->{entity}->{body_is_octet_stream} = 1; |
46 |
|
my $ua = $main::ENV{HTTP_USER_AGENT}; |
47 |
|
for ($ua) { |
48 |
|
s/&/&/g; s/</</g; s/([^\x20-\x7E])/sprintf '&#x%02X;', ord $1/ge; |
49 |
|
}; |
50 |
|
$out->{entity}->{body} = qq< |
51 |
|
<!DOCTYPE html SYSTEM> |
52 |
|
<title>401 Bad Request-URI</title> |
53 |
|
<h1>Bad Request-URI</h1> |
54 |
|
<p>Your Request-URI has fragment identifier but it is not allowed here. |
55 |
|
It might be a bug of your user agent ($ua). Please contact to the UA |
56 |
|
vendor.</p> |
57 |
|
>; |
58 |
|
$out->output (output => 'http-cgi'); |
59 |
|
exit; |
60 |
|
} |
61 |
|
} |
62 |
|
|
63 |
|
push our @Config, sub ($) { |
64 |
|
my $WIKI = shift; |
65 |
|
use FindBin q($Bin); |
66 |
|
use File::Spec; |
67 |
|
|
68 |
|
## -- Filesystem path mapping |
69 |
|
for ( |
70 |
|
[db__cache__dir => q"./wikidata/cache/"], |
71 |
|
[db__cache_struct__file => q"./wikidata/cache/struct.db"], |
72 |
|
[db__content__dir => q"./wikidata/page/"], |
73 |
|
[db__content__error_log => q"./wikidata/log/db-content.log"], |
74 |
|
[db__bdb__home_dir => q"./wikidata/lock/"], |
75 |
|
[db__bdb__log_dir => q"./wikidata/log/bdb/"], |
76 |
|
[db__bdb__log_file => q"./wikidata/log/bdb.log"], |
77 |
|
[db__bdb__temp_dir => q"./wikidata/lock/"], |
78 |
|
[db__lock__dir => q"./wikidata/lock/"], |
79 |
|
[db__lock__log_file => q"./wikidata/log/lock.log"], |
80 |
|
[db__log__dir => q"./wikidata/log/"], |
81 |
|
[db__request_log__dir => q"./wikidata/rlog/"], |
82 |
|
[db__static__dir => q"./wikidata/static/"], |
83 |
|
[db__temp__dir => q"./wikidata/lock/"], |
84 |
|
[namazu__index_dir => q"/var/namazu/index/suikawiki"], |
85 |
|
) { |
86 |
|
## On system that does not set current directory as main script |
87 |
|
## directory, you should specify it instead of using "abs_path". |
88 |
|
$WIKI->{config}->{path_to}->{$_->[0]} = File::Spec->rel2abs ($_->[1], $Bin); |
89 |
|
} |
90 |
|
|
91 |
|
## -- Namazu URI Mapping (See SuikaWiki:SuikaWiki//Namazu) -- |
92 |
|
$WIKI->{config}->{nmz__uri_to_uri} = sub { |
93 |
|
my ($nmzuri, %opt) = @_; |
94 |
|
if ($nmzuri =~ s!^\Q$opt{o}->{wiki}->{config}->{path_to}->{db__content__dir}\E/*!!o) { |
95 |
|
$nmzuri =~ s/\.txt$//; |
96 |
|
return $opt{o}->{wiki}->uri_reference |
97 |
|
(page => $opt{o}->{wiki}->name ([ |
98 |
|
map {s/([0-9A-F][0-9A-F])/pack 'C', hex $1/ge; $_} |
99 |
|
split m!\.ns/!, $nmzuri |
100 |
|
]), base => 1); |
101 |
|
} else { |
102 |
|
$nmzuri =~ s<^/home/wakaba/public_html/([^.]+)><http://suika.fam.cx/~wakaba/$1>; |
103 |
|
return ($nmzuri, $nmzuri); |
104 |
|
} |
105 |
|
}; |
106 |
|
|
107 |
|
## -- WikiPlugin |
108 |
|
push @{$WIKI->{event}->{plugin_manager_loaded}}, sub { |
109 |
|
my $wiki = shift; |
110 |
|
|
111 |
|
## Installed plugin modules |
112 |
|
$wiki->{plugin}->load_directory (qw( |
113 |
|
lib/SuikaWiki/Plugin/ |
114 |
|
misc/plugins/ |
115 |
|
misc/plugins/form/ |
116 |
|
misc/plugins/format/ |
117 |
|
misc/plugins/link/ |
118 |
|
misc/plugins/view/ |
119 |
|
)); |
120 |
|
|
121 |
|
## Configuration file as pseudo-plugin module |
122 |
|
require 'wikidata/config.ph'; |
123 |
|
}; |
124 |
|
|
125 |
|
## -- WikiDatabase: Mapping logical to physical |
126 |
|
push @{$WIKI->{event}->{database_loaded}}, sub { |
127 |
|
my $wiki = shift; |
128 |
|
|
129 |
|
## Main content |
130 |
|
$wiki->{db}->_set_prop_db (content => {-db_open => sub { |
131 |
|
require SuikaWiki::DB::FileSystem::LeafFile; |
132 |
|
SuikaWiki::DB::FileSystem::LeafFile->new |
133 |
|
(base_directory => $wiki->{config}->{path_to}->{db__content__dir}, |
134 |
|
directory_suffix => '.ns', |
135 |
|
file_suffix => '.txt', |
136 |
|
root_key => $wiki->{config}->{page}->{Default}, |
137 |
|
-lock => $wiki->{var}->{db}->{lock_prop}->('content_prop')); |
138 |
|
}, -db_close => sub { |
139 |
|
my %opt = @_; |
140 |
|
$opt{prop_info}->{-db}->close; |
141 |
|
delete $opt{prop_info}->{-db}; |
142 |
|
}}); |
143 |
|
|
144 |
|
## Properties |
145 |
|
$wiki->{db}->_set_prop_db (content_prop => {-db_open => sub { |
146 |
|
require SuikaWiki::DB::FileSystem::LeafProp; |
147 |
|
SuikaWiki::DB::FileSystem::LeafProp->new |
148 |
|
(base_directory => $wiki->{config}->{path_to}->{db__content__dir}, |
149 |
|
directory_suffix => '.ns', |
150 |
|
file_suffix => '.prop', |
151 |
|
root_key => $wiki->{config}->{page}->{Default}, |
152 |
|
-lock => $wiki->{var}->{db}->{lock_prop}->('content')); |
153 |
|
}, -db_close => sub { |
154 |
|
my %opt = @_; |
155 |
|
$opt{prop_info}->{-db}->close; |
156 |
|
delete $opt{prop_info}->{-db}; |
157 |
|
}}); |
158 |
|
|
159 |
|
## Last modified |
160 |
|
$wiki->{db}->_set_prop_db (lastmodified => {-db_open => sub { |
161 |
|
require SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09; |
162 |
|
SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09->new |
163 |
|
(directory => $wiki->{config}->{path_to}->{db__content__dir}, |
164 |
|
-lock => $wiki->{var}->{db}->{lock_prop}->('lastmodified')); |
165 |
|
}, -prop => 'last_modified', -db_close => sub { |
166 |
|
my %opt = @_; |
167 |
|
$opt{prop_info}->{-db}->close; |
168 |
|
delete $opt{prop_info}->{-db}; |
169 |
|
}}); |
170 |
|
|
171 |
|
## Static version |
172 |
|
$wiki->{db}->_set_prop_db (static__css => {-db_open => sub { |
173 |
|
require SuikaWiki::DB::FileSystem::LeafFileP; |
174 |
|
SuikaWiki::DB::FileSystem::LeafFileP->new |
175 |
|
(base_directory => $wiki->{config}->{path_to}->{db__static__dir}, |
176 |
|
directory_suffix => '.ns', |
177 |
|
file_suffix => '.css', |
178 |
|
root_key => $wiki->{config}->{page}->{Default}); |
179 |
|
}, -db_close => sub { |
180 |
|
my %opt = @_; |
181 |
|
$opt{prop_info}->{-db}->close; |
182 |
|
delete $opt{prop_info}->{-db}; |
183 |
|
}}); |
184 |
|
$wiki->{config}->{ExpandedURI q<ss:use-static>} = 1; |
185 |
|
## URI maker for LeafFileP generated files |
186 |
|
$wiki->{config}->{ExpandedURI q<ss:wikiname-to-uri>} = sub { |
187 |
|
my (undef, %opt) = @_; |
188 |
|
my $page = join '.ns/', |
189 |
|
map {s/([^0-9A-Za-z_-])/sprintf '+%02X', ord $1/ge;$_} |
190 |
|
@{$opt{wikiname}}; |
191 |
|
return URI->new ('wikidata/static/' . $page . '.css'); |
192 |
|
}; |
193 |
|
## Reverse mapping of generate-uri |
194 |
|
$wiki->{config}->{ExpandedURI q<ss:uri-to-wikiname>} = sub { |
195 |
|
my (undef, %opt) = @_; |
196 |
|
$opt{uri} =~ s!^.+/wikidata/static/!!g; |
197 |
|
$opt{uri} =~ s/\?[^?]*$//g; |
198 |
|
$opt{uri} =~ s/\.css$//g; |
199 |
|
return $opt{wiki}->name |
200 |
|
([map {s/\+([0-9A-Fa-f_-][0-9A-Fa-f_-])/pack 'CC', hex $1/ge;$_} |
201 |
|
split m!.ns/!, $opt{uri}]); |
202 |
|
}; |
203 |
|
|
204 |
|
|
205 |
|
## Cache DBs |
206 |
|
require SuikaWiki::DB::FileSystem::SuikaWikiCache09; |
207 |
|
my $cachedb = SuikaWiki::DB::FileSystem::SuikaWikiCache09->new |
208 |
|
(directory => $wiki->{config}->{path_to}->{db__cache__dir}, |
209 |
|
expires => 86400 * 3, removes => 86400 * 3); # 3 days |
210 |
|
$wiki->{db}->_set_prop_db (m__search_result => |
211 |
|
{-db => $cachedb, -prop => 'search_result', -db_close => sub { |
212 |
|
my %opt = @_; |
213 |
|
$opt{prop_info}->{-db}->close; |
214 |
|
delete $opt{prop_info}->{-db}; |
215 |
|
}}); |
216 |
|
$wiki->{db}->_set_prop_db (wpp__headsummary => |
217 |
|
{-db => $cachedb, -prop => 'headsummary', -db_close => sub { |
218 |
|
my %opt = @_; |
219 |
|
$opt{prop_info}->{-db}->close; |
220 |
|
delete $opt{prop_info}->{-db}; |
221 |
|
}}); |
222 |
|
$wiki->{db}->_set_prop_db (ref__item_template => |
223 |
|
{-db => $cachedb, -prop => 'refereritem', -db_close => sub { |
224 |
|
my %opt = @_; |
225 |
|
$opt{prop_info}->{-db}->close; |
226 |
|
delete $opt{prop_info}->{-db}; |
227 |
|
}}); |
228 |
|
|
229 |
|
## Berkely DB Environment Preparation |
230 |
|
use BerkeleyDB; |
231 |
|
my $bdbenv = new BerkeleyDB::Env |
232 |
|
-Home => $wiki->{config}->{path_to}->{db__bdb__home_dir}, |
233 |
|
-Config => { |
234 |
|
DB_DATA_DIR => $wiki->{config}->{path_to}->{db__content__dir}, |
235 |
|
DB_LOG_DIR => $wiki->{config}->{path_to}->{db__bdb__log_dir}, |
236 |
|
DB_TMP_DIR => $wiki->{config}->{path_to}->{db__bdb__temp_dir}, |
237 |
|
}, |
238 |
|
-ErrFile => $wiki->{config}->{path_to}->{db__bdb__log_file}, |
239 |
|
-Flags => DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL, |
240 |
|
-Verbose => $wiki->{config}->{debug}->{db}; |
241 |
|
|
242 |
|
$wiki->{db}->_set_prop_db (content__structured => {-db_open => sub { |
243 |
|
require SuikaWiki::DB::Hash; |
244 |
|
new SuikaWiki::DB::Hash constructor => sub { |
245 |
|
use MLDBM qw(BerkeleyDB::Hash);# Storable); |
246 |
|
tie my %mldb, 'MLDBM', |
247 |
|
-Filename => $wiki->{config}->{path_to} |
248 |
|
->{db__cache_struct__file}, |
249 |
|
-Env => $bdbenv, |
250 |
|
-Flags => DB_CREATE, |
251 |
|
-Mode => 0644; |
252 |
|
\%mldb; |
253 |
|
}; |
254 |
|
}}); |
255 |
|
|
256 |
|
## Referer Database (See Referer plugin module) |
257 |
|
$wiki->{db}->_set_prop_db (referer => {-db_open => sub { |
258 |
|
require SuikaWiki::DB::FileSystem::Count; |
259 |
|
SuikaWiki::DB::FileSystem::Count->new |
260 |
|
(base_directory => $wiki->{config}->{path_to}->{db__content__dir}, |
261 |
|
directory_suffix => '.ns', |
262 |
|
file_suffix => '.ref', |
263 |
|
root_key => $wiki->{config}->{page}->{Default}, |
264 |
|
auto_mkdir => 0, |
265 |
|
-lock => $wiki->{var}->{db}->{lock_prop}->('referer')); |
266 |
|
}, -db_close => sub { |
267 |
|
my %opt = @_; |
268 |
|
$opt{prop_info}->{-db}->close; |
269 |
|
delete $opt{prop_info}->{-db}; |
270 |
|
}}); |
271 |
|
|
272 |
|
## HTTP Request Logging Database (See RequestLog plugin module) |
273 |
|
$wiki->{db}->_set_prop_db (log__http_request => {-db_open => sub { |
274 |
|
require SuikaWiki::DB::FileSystem::Count; |
275 |
|
SuikaWiki::DB::FileSystem::Count->new |
276 |
|
(base_directory => $wiki->{config}->{path_to}->{db__request_log__dir}, |
277 |
|
directory_suffix => '.ns', |
278 |
|
file_suffix => '.rlog', |
279 |
|
root_key => $wiki->{config}->{page}->{Default}, |
280 |
|
auto_mkdir => 1); |
281 |
|
}, -db_close => sub { |
282 |
|
my %opt = @_; |
283 |
|
$opt{prop_info}->{-db}->close; |
284 |
|
delete $opt{prop_info}->{-db}; |
285 |
|
}}); |
286 |
|
|
287 |
|
## Additional WikiDB properties should be defined here |
288 |
|
# ... |
289 |
|
}; |
290 |
|
|
291 |
|
push @{$WIKI->{event}->{input_close}}, sub { |
292 |
|
my ($wiki, $event) = @_; |
293 |
|
try { |
294 |
|
SuikaWiki::Plugin->module_package ('RequestLog') |
295 |
|
->http_request_log (wiki => $wiki, |
296 |
|
prop => 'log__http_request'); |
297 |
|
} catch SuikaWiki::Plugin::error with { |
298 |
|
my $err = shift; |
299 |
|
$err->raise unless $err->{-type} eq 'PLUGIN_NOT_FOUND'; |
300 |
|
}; |
301 |
|
}; |
302 |
|
|
303 |
|
$WIKI->{config}->{engine_max_access} = 15; |
304 |
|
|
305 |
|
## -- WikiName of special purpose WikiPages |
306 |
|
$WIKI->{config}->{page} = { |
307 |
|
Default => $WIKI->name ([qw/HomePage/]), |
308 |
|
InterWikiName => $WIKI->name ([qw/Wiki InterWikiName/]), |
309 |
|
NewPageTemplate => $WIKI->name ([qw/Wiki NewPageTemplate/]), |
310 |
|
'StyleSheetList(text/html)' => $WIKI->name ([qw<Wiki Style List text/html>]), |
311 |
|
ExpandedURI q<log:root> => $WIKI->name ([]), |
312 |
|
}; |
313 |
|
|
314 |
|
## -- WikiNamespace constants |
315 |
|
$WIKI->{config}->{name}->{space} = { |
316 |
|
separator => '//', |
317 |
|
separator_reg => qr#\s*//\s*#, |
318 |
|
self => '.', |
319 |
|
parent => '..', |
320 |
|
root => '//', |
321 |
|
}; |
322 |
|
|
323 |
|
## -- Default character codes |
324 |
|
$WIKI->{config}->{charset} = { |
325 |
|
## Internal code - MUST be ASCII + 8bit coding scheme |
326 |
|
internal => 'euc-jp', |
327 |
|
## Default output code |
328 |
|
output => 'iso-2022-jp', |
329 |
|
## "query" part in URI reference |
330 |
|
uri_query => '', # auto-detected |
331 |
|
uri_query_encode => 'euc-jp', ## For compatibility w/ SuikaWiki 2 |
332 |
|
uri_param => '', # auto-detected |
333 |
|
uri_param_encode => 'euc-jp', ## For compatibility w/ SuikaWiki 2 |
334 |
|
## PATH_INFO part in URI reference |
335 |
|
uri_path_info => 'x-utf-8-10646', ## Reserved for future use |
336 |
|
## Fragment identifier in URI reference |
337 |
|
uri_fragment => 'x-punycode', ## Reserved for possible future use |
338 |
|
}; |
339 |
|
|
340 |
|
## -- User option for media types |
341 |
|
$WIKI->{config}->{ExpandedURI q<media-type:accept-media-type>} = { |
342 |
|
q<IMT:text/css##> => 1, |
343 |
|
q<IMT:text/plain##> => 1, |
344 |
|
q<IMT:text/x-suikawiki;version="0.9"##> => 1, |
345 |
|
q<IMT:application/x.suikawiki.config;version="2.0"##> => 1, |
346 |
|
}; |
347 |
|
|
348 |
|
## -- Expires duration templates |
349 |
|
$WIKI->{config}->{entity}->{expires} = { |
350 |
|
edit => {delta => 60}, |
351 |
|
view => {delta => 2*3600}, |
352 |
|
list => {delta => 60}, |
353 |
|
lm_flaged => {delta => 30*24*3600}, |
354 |
|
stylesheet => {delta => 30*24*3600}, |
355 |
|
error => {delta => 60}, |
356 |
|
}; |
357 |
|
|
358 |
|
## -- Debug mode |
359 |
|
$WIKI->{config}->{debug} = { |
360 |
|
general => 0, |
361 |
|
db => 0, |
362 |
|
format => 0, |
363 |
|
view => 0, |
364 |
|
}; |
365 |
|
|
|
## Type of WikiPage Database |
|
|
#our $modifier_dbtype = 'AnyDBM_File'; # Fast, not available on some server, page size limited. |
|
|
#our $modifier_dbtype = 'dbmopen'; # Fast, not available on some server, page size limited. |
|
|
#our $modifier_dbtype = 'Yuki::YukiWikiDB'; # Slow, available on all environment. |
|
|
#our $modifier_dbtype = 'Yuki::YukiWikiDB2'; # Slow, available on all environment. |
|
|
our $modifier_dbtype = 'Yuki::YukiWikiDBMeta'; # Slow, available on all environment. |
|
|
our $use_exists = 1; # If you can use 'exists' method for your DB. |
|
|
|
|
|
## Name of Special WikiPage (linked as parts of navigations) |
|
|
our %PageName = ( |
|
|
FrontPage => 'HomePage', |
|
|
IndexPage => 'IndexPage', |
|
|
InterWikiName => 'Wiki//InterWikiName', |
|
|
SearchPage => 'Wiki//Page//Search', |
|
|
CreatePage => 'Wiki//Page//Create', |
|
|
MenuBar => 'Wiki//MenuBar', |
|
|
RecentChanges => 'RecentChanges', |
|
|
RefererDontRecord => 'Wiki//Referer//IgnoreSite', |
|
|
RefererSiteName => 'Wiki//Referer//SiteName', |
|
|
ResourceNS => 'Wiki//Resource//', |
|
|
StyleList => 'Wiki//Style//List//', |
|
|
UserAgentList => 'Wiki//UserAgentList', |
|
|
AdminSpecialPage => "\x11\x11Admin\x11Special\x11Page\x11\x11", |
|
|
); |
|
|
|
|
|
## (Should be reimplemented) |
|
|
our $kanjicode = 'euc'; |
|
|
our $lang = 'ja'; |
|
|
|
|
|
## Misc. options |
|
|
$SuikaWiki::Plugin::UserAgent::LoggingName = 1; |
|
|
## Use UA-name log? (require UserAgent plugin module) |
|
|
|
|
|
## Definition of views |
|
|
|
|
|
require SuikaWiki::View; |
|
|
SuikaWiki::View->template ('links')->add_line (<<'EOH'); |
|
|
%link-wiki(page=>"Wiki//News",rel=>News,class=>wiki,title=>"%res(name=>GoToWikiNewsLink);"p); |
|
|
%link-wiki(page=>"Wiki//Help",rel=>help,class=>wiki,title=>"%res(name=>GoToWikiHelpLink);"p); |
|
|
%link-wiki(page=>"Wiki//Page//License",rel=>copyright,class=>wiki,title=>"%res(name=>GoToWikiPageLicenseLink);"p); |
|
|
EOH |
|
|
|
|
|
SuikaWiki::View->template ('navbar')->add_line (<<"EOH"); |
|
|
%anchor-wiki(mode=>edit,rel=>edit,class=>wiki-cmd,label=>"%res(name=>EditThisPage);"p,title=>"%res(name=>EditThisPageLong);"p,accesskey=>E,add-param=>{#edit}); |
|
|
%anchor-wiki(rel=>view,up_to_date,class=>wiki-cmd,label=>"%res(name=>ViewThisPage);"p,title=>"%res(name=>ViewThisPageLong);"p); |
|
|
%anchor-wiki(page=>{$main::PageName{CreatePage}},class=>wiki,label=>"%res(name=>GoToCreatePage);"p,title=>"%res(name=>GoToCreatePageLong);"p); |
|
|
%anchor-wiki(page=>{$main::PageName{SearchPage}},class=>wiki,label=>"%res(name=>GoToSearchPage);"p,title=>"%res(name=>GoToSearchPageLong);"p); |
|
|
%anchor-wiki(mode=>RandomJump,up-to-date,rel=>lucky,class=>"wiki randomlink",label=>"%res(name=>GoSomewhere);"p,title=>"%res(name=>GoSomewhereLong);"p); |
|
|
%anchor-wiki(page=>{$main::PageName{RecentChanges}},class=>wiki,label=>"%res(name=>GoToRecentChanges);"p,title=>"%res(name=>GoToRecentChangesLong,safe);"p); |
|
|
EOH |
|
|
|
|
|
push @{$SuikaWiki::Plugin::On{Load}}, sub { |
|
|
SuikaWiki::View->definition ('read')->property (template => <<'EOH'); |
|
|
%html-document(title=>{%res(name=>{View:WebPageTitle});}p,link-meta=>{%predefined-template(name=>links);}p,content=>{ |
|
|
%section(level=>1,add-to-toc=>0,type=>body,title=>{%ns-short-page-name;}p,heading,content=>{ |
|
|
%section(id=>tools1,class=>tools,add-to-toc=>0,content=>{%predefined-template(name=>navbar);}p); |
|
|
%section(level=>2,id=>read,add-to-toc=>0,content=>{ |
|
|
%if-calender(month,true=>{ |
|
|
%format(context=>form_input,template=>{%calender;}); |
|
|
},false=>{ |
|
|
%if-calender(true=>{ |
|
|
%format(context=>form_input,template=>{%calender-months;}); |
|
|
}); |
|
|
}); |
|
|
%read(comment); |
|
|
}p); |
|
|
%section(level=>2,id=>children,title=>{%res(name=>{Children:Title});}p,heading, |
|
|
content=>{%page-list(ns=>{%page-name;}p,recursive=>0,type=>both,template=>{%res(name=>{Children:Item});}p);}p); |
|
|
%section(level=>2,id=>see-also,title=>{%res(name=>SeeAlso);}p,heading,content=>{%search-result;}p); |
|
|
%section(level=>2,id=>referer,title=>{%res(name=>Referer);}p,heading,content=>{%referer-list;}p); |
|
|
%section(level=>2,id=>toc,title=>{%res(name=>{TOC:Title});}p,heading,add_to_toc=>0,content=>{%toc(drag);}p); |
|
|
%section(id=>last-modified,add_to_toc=>0,content=>{%res(name=>{LastModified=});%last-modified;}p); |
|
|
%section(class=>tools,add_to_toc=>0,content=>{%predefined-template(name=>navbar);}p); |
|
|
%section(id=>footer,add-to-toc=>0,content=>{%predefined-template(name=>footer);}p); |
|
|
}p); |
|
|
}p);%log-hotness; |
|
|
EOH |
|
|
SuikaWiki::View->definition ('-wrote')->property (template => SuikaWiki::View->definition ('-wrote')->property ('template').q(%log-hotness(weight=>2);)); |
|
|
SuikaWiki::View->definition ('WithMenu')->property (template => SuikaWiki::View->definition ('WithMenu')->property ('template').q(%log-hotness;)); |
|
366 |
}; |
}; |
367 |
|
|
368 |
=head1 NAME |
=head1 SEE ALSO |
369 |
|
|
370 |
suikawiki-config.ph --- SuikaWiki: site configuration script |
C<lib/suikawiki.pl>, C<wiki.cgi>, |
371 |
|
<http://suika.fam.cx/~wakaba/-temp/wiki/wiki?SuikaWiki>, |
372 |
|
<http://suika.fam.cx/~wakaba/-temp/wiki/wiki?SWHCS> |
373 |
|
|
374 |
=head1 LICENSE |
=head1 LICENSE |
375 |
|
|
376 |
Copyright 2003 Wakaba <w@suika.fam.cx> |
Copyright 2003-2004 Wakaba <w@suika.fam.cx>. All rights reserved. |
377 |
|
|
378 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
379 |
modify it under the same terms as Perl itself. |
modify it under the same terms as Perl itself. |