/[pub]/suikawiki/wikidata/suikawiki-config.ph
Suika

Contents of /suikawiki/wikidata/suikawiki-config.ph

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Thu Apr 3 01:10:10 2003 UTC (21 years, 1 month ago) by wakaba
Branch: MAIN
Changes since 1.6: +89 -144 lines
Remove some definitions

1 use strict;
2
3 ## URI (or part of URI) of Wiki CGI itself and its external addons
4 ## Note: If your Wiki CGI URI is <http://foo.example/path/to/wiki.cgi>,
5 ## cookie-path: /path/to/
6 ## script-short-name: wiki.cgi
7 ## URI parts MUST NOT contains "&" and/or non-URI characters.
8 our %uri = (
9 cookie_path => '/temp/suikawiki/',
10 external_script => '../wiki/script/',
11 script_short_name => 'wiki',
12 ## If you use CVS repository of WikiDatabase,
13 #cvs_repository => 'http://path-to-viewcvs/path-to-repository/',
14 );
15 our $url_cgi; {
16 my $scheme = 'http';
17 $scheme = lc $1 if $main::ENV{SERVER_PROTOCOL} =~ m#([A-Za-z0-9+.%-]+)#;
18 $url_cgi = "$scheme://$main::ENV{SERVER_NAME}:$main::ENV{SERVER_PORT}$uri{cookie_path}$uri{script_short_name}";
19 }
20 $uri{wiki} = $url_cgi;
21
22 ## Path to modules and databases
23 use lib qw!../wiki/lib!;
24 $SuikaWiki::Plugin::plugin_directory = q(../wiki/lib/SuikaWiki/Plugin/);
25 our %PathTo = ( ## Path to your data, from the main CGI script (NOT from this config script)
26 CachePrefix => q(./wikidata/.cache.),
27 WikiDataBase => q(./wikidata/page),
28 );
29
30 ## Type of WikiPage Database
31 #our $modifier_dbtype = 'AnyDBM_File'; # Fast, not available on some server, page size limited.
32 #our $modifier_dbtype = 'dbmopen'; # Fast, not available on some server, page size limited.
33 #our $modifier_dbtype = 'Yuki::YukiWikiDB'; # Slow, available on all environment.
34 #our $modifier_dbtype = 'Yuki::YukiWikiDB2'; # Slow, available on all environment.
35 our $modifier_dbtype = 'Yuki::YukiWikiDBMeta'; # Slow, available on all environment.
36 our $use_exists = 1; # If you can use 'exists' method for your DB.
37
38 ## Name of Special WikiPage (linked as parts of navigations)
39 our %PageName = (
40 FrontPage => 'HomePage',
41 IndexPage => 'IndexPage',
42 SearchPage => 'SearchPage',
43 CreatePage => 'CreatePage',
44 RecentChanges => 'RecentChanges',
45 ResourceNS => 'Wiki//Resource//',
46 UserAgentList => 'WikiUserAgentList',
47 AdminSpecialPage => "\x11\x11Admin\x11Special\x11Page\x11\x11",
48 );
49
50 ## (Should be reimplemented)
51 our $kanjicode = 'euc';
52 our $lang = 'ja';
53 $wiki::useragent::UseLog = 0; ## Use User-Agent name log (WikiUserAgentList) or not
54
55 ## Misc. options
56
57 ## Definition of views
58
59 require SuikaWiki::View;
60 my %vd;
61 $vd{links} = SuikaWiki::View->template ('links')->add_line (<<'EOH');
62 %link-wiki(mode=>edit,rel=>edit,class=>wiki-cmd,title=>"%res(name=>EditThisPageLink,safe);"p);
63 %link-wiki(mode=>edit,rel=>edit,class=>wiki-cmd,title=>"%res(name=>AdminEditThisPageLink,safe);"p,add-param=>"admin=1");
64 %link-wiki(rel=>view,class=>wiki-cmd,title=>"%res(name=>ViewThisPageLink,safe);"p,up_to_date);
65 %link-wiki(rel=>myself,class=>wiki,title=>"%res(name=>GoToMyselfLink,safe);"p);
66 %link-wiki(page=>IndexPage,rel=>index,class=>wiki,title=>"%res(name=>GoToIndexPageLink,safe);"p);
67 %link-wiki(page=>HomePage,rel=>home,class=>wiki,title=>"%res(name=>GoToHomePageLink,safe);"p);
68 %link-wiki(page=>"Wiki//News",rel=>News,class=>wiki,title=>"%res(name=>GoToWikiNewsLink,safe);"p);
69 %link-wiki(page=>RecentChanges,rel=>News,class=>wiki,title=>"%res(name=>GoToRecentChangesLink,safe);"p);
70 %link-wiki(page=>RecentChanges,mode=>rss,rel=>News,class=>wiki,title=>"%res(name=>GoToRssPageLink,safe);"p,type=>"application/xml");
71 %link-wiki(page=>SearchPage,rel=>search,class=>wiki,title=>"%res(name=>GoToSearchPageLink,safe);"p);
72 %link-wiki(page=>"Wiki//Help",mode=>read,rel=>help,class=>wiki,title=>"%res(name=>GoToWikiHelpLink,safe);"p);
73 %link-wiki(page=>"Wiki//Page//License",rel=>copyright,class=>wiki,title=>"%res(name=>GoToWikiPageLicenseLink,safe);"p);
74 %link-wiki(mode=>map,rel=>sitemap,class=>wiki-cmd,title=>"%res(name=>ShowMapOfThisPageLink,safe);"p);
75 %link-wiki(mode=>RandomJump,up_to_date,rel=>lucky,class=>"wiki randomlink",title=>"%res(name=>GoSomewhereLink,safe);"p);
76 EOH
77 $vd{links} .= <<EOH;
78 %link-wiki(href=>"javascript:var%20WikiName=prompt('Please%20input%20the%20WikiName:','','Jump%20to%20SuikaWiki');if(WikiName)%7B_content.location.href='$url_cgi%3F'+encodeURIComponent(WikiName)%7D",rel=>jump,class=>wiki-cmd,title=>"%res(name=>JumpToLink,safe);"p);
79 %link-wiki(href=>"javascript:var%20WikiName=prompt('Please%20input%20the%20WikiName:','','Jump%20to%20SuikaWiki');if(WikiName)%7B_content.location.href='$url_cgi%3Fmycmd=edit;mypage='+encodeURIComponent(WikiName)%7D",rel=>jump,class=>wiki-cmd,title=>"%res(name=>JumpToEditLink,safe);"p);
80 EOH
81 $vd{navbar} = SuikaWiki::View->template ('navbar')->add_line (<<'EOH');
82 %anchor-wiki(mode=>edit,rel=>edit,class=>wiki-cmd,label=>"%res(name=>EditThisPage,safe);"p,title=>"%res(name=>EditThisPageLong,safe);"p,accesskey=>E);
83 %anchor-wiki(rel=>view,up_to_date,class=>wiki-cmd,label=>"%res(name=>ViewThisPage,safe);"p,title=>"%res(name=>ViewThisPageLong,safe);"p);
84 %anchor-wiki(page=>CreatePage,class=>wiki,label=>"%res(name=>GoToCreatePage,safe);"p,title=>"%res(name=>GoToCreatePageLong,safe);"p);
85 %anchor-wiki(page=>IndexPage,class=>wiki,label=>"%res(name=>GoToIndexPage,safe);"p,title=>"%res(name=>GoToIndexPageLong,safe);"p);
86 %anchor-wiki(page=>HomePage,class=>wiki,label=>"%res(name=>GoToHomePage,safe);"p,title=>"%res(name=>GoToHomePageLong,safe);"p);
87 %anchor-wiki(page=>SearchPage,class=>wiki,label=>"%res(name=>GoToSearchPage,safe);"p,title=>"%res(name=>GoToSearchPageLong,safe);"p);
88 %anchor-wiki(mode=>RandomJump,up-to-date,rel=>lucky,class=>"wiki randomlink",label=>"%res(name=>GoSomewhere,safe);"p,title=>"%res(name=>GoSomewhereLong,safe);"p);
89 %anchor-wiki(page=>RecentChanges,class=>wiki,label=>"%res(name=>GoToRecentChanges,safe);"p,title=>"%res(name=>GoToRecentChangesLong,safe);"p);
90 EOH
91
92
93 my %ViewDefinition = (
94 read => {media => {type => 'text/html', charset => 1, expires => 120}, check => sub {1},
95 #xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 120},
96 template => <<EOH},
97 %html-start;%html-head(title=>"%res(name=>\\"View:WebPageTitle\\",safe);"p,link-meta=>"%predefined-template(name=>links);"p);
98 %section(level=>1,add-to-toc=>0,type=>body,title=>"%ns-short-page-name(safe);"p,heading,content=>"
99 %section(id=>tools1,class=>tools,add-to-toc=>0,content=>\\"%predefined-template(name=>navbar);\\"p);
100 %section(level=>2,id=>read,add-to-toc=>0,content=>\\"%read(comment);\\");
101 %section(level=>2,id=>children,
102 title=>\\"%res(name=>\\\\\\"Children:Title\\\\\\",safe);\\"p,heading,
103 content=>\\"%page-list(ns=>\\\\\\"%page-name(safe);\\\\\\"p,recursive=>0,type=>both,
104 template=>\\\\\\"%wiki-link(label=>\\\\\\\\\\\\\\"%ns-short-page-or-ns-name;\\\\\\\\\\\\\\"ps);\\\\\\"
105 );\\"
106 );
107 %section(level=>2,id=>\\"see-also\\",title=>SeeAlso,heading,content=>\\"%search-result;\\");
108 %section(level=>2,id=>referer,title=>Referer,heading,content=>\\"%referer-list;\\");
109 %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");
110 %section(id=>last-modified,add_to_toc=>0,content=>\\"%res(name=>\\\\\\"LastModified=\\\\\\");%last-modified;\\");
111 %section(class=>tools,add_to_toc=>0,content=>\\\"%predefined-template(name=>navbar);\\"p);
112 %section(id=>footer,add-to-toc=>0,content=>\\"%predefined-template(name=>footer);\\");
113 %apply-user-preferred-style;");%html-end;
114 %log-hotness();
115 EOH
116 map => {media => {type => 'text/html', charset => 1, expires => 120}, check => sub {1},
117 #xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 120},
118 template => <<EOH},
119 %html-start;%html-head(title=>"%res(name=>\\"Map:WebPageTitle\\");",link_meta=>"%predefined-template(name=>links);"p);
120 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"
121 %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"%predefined-template(name=>navbar);\\"p);
122 %section(level=>2,id=>\\"link-map\\",title=>\\"Map:Title\\",heading,content=>\\"
123 <p>%res(name=>\\\\\\"Map:Description\\\\\\");</p>
124 %link-map;
125 \\");
126 %section(level=>2,id=>\\"see-also\\",title=>SeeAlso,heading,content=>\\"%search-result;\\");
127 %section(level=>2,id=>referer,title=>Referer,heading,content=>\\"%referer-list;\\");
128 %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");
129 %section(class=>tools,add_to_toc=>0,content=>\\\"%predefined-template(name=>navbar);\\"p);
130 %section(id=>footer,add-to-toc=>0,content=>\\"%predefined-template(name=>footer);\\");
131 %apply-user-preferred-style;");%html-end;
132 EOH
133
134 edit => {media => {type => 'text/html', charset => 1, expires => 60}, check => sub {1},
135 #xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60},
136 template => <<EOH},
137 %html-start;%html-head(title=>"%res(name=>\\"Edit:WebPageTitle\\");",link-meta=>"%predefined-template(name=>links);%html-meta(name=>ROBOTS,content=>NOINDEX);"p);
138 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"
139 %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"%predefined-template(name=>navbar);\\"p);
140 %section(level=>2,id=>edit,title=>\\"Edit:Title\\",heading,content=>\\"
141 %edit-form;
142 %section(level=>3,id=>edit-help,add_to_toc=>0,content=>\\\\\\"%read(page=>\\\\\\\\\\\\\\"Wiki//Help//Edit\\\\\\\\\\\\\\");\\\\\\");
143 \\");
144 %section(level=>2,id=>\\"see-also\\",title=>SeeAlso,heading,content=>\\"%search-result;\\");
145 %section(level=>2,id=>referer,title=>Referer,heading,content=>\\"%referer-list;\\");
146 %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");
147 %section(id=>last-modified,add_to_toc=>0,content=>\\"%res(name=>\\\\\\"LastModified=\\\\\\");%last-modified;\\");
148 %section(class=>tools,add_to_toc=>0,content=>\\\"%predefined-template(name=>navbar);\\"p);
149 %section(id=>footer,add-to-toc=>0,content=>\\"%predefined-template(name=>footer);\\");
150 %apply-user-preferred-style;");%html-end;
151 EOH
152 adminedit => {media => {type => 'text/html', charset => 1, expires => 60}, check => sub {1},
153 xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60},
154 template => <<EOH},
155 %html-start;%html-head(title=>"%res(name=>\\"Edit:Admin:WebPageTitle\\");"p,link_meta=>"%predefined-template(name=>links); %html-meta(name=>ROBOTS,content=>NOINDEX);"p);
156 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"
157 %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"%predefined-template(name=>navbar);\\"p);
158 %section(level=>2,id=>edit,title=>\\"Edit:Title\\",heading,content=>\\"%edit-form(admin);\\");
159 %section(level=>2,id=>edit,title=>\\"Edit:Rename:Title\\",heading,content=>
160 \\"%wp-rename-form-start;
161 %format(context=>form_input,template=>\\\\\\\"
162 %text(id=>to,label=>\\\\\\\\\\\\\\\"%res(name=>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"Edit:Rename:To=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");\\\\\\\\\\\\\\\",size=>10,default=>\\\\\\\\\\\\\\\"%page-name;\\\\\\\\\\\\\\\"ps);
163 %submit;
164 \\\\\\\");
165 %form-end;\\"
166 );
167 %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");
168 %section(id=>last-modified,add_to_toc=>0,content=>\\"%res(name=>\\\\\\"LastModified=\\\\\\");%last-modified;\\");
169 %section(id=>footer,add-to-toc=>0,content=>\\"%predefined-template(name=>footer);\\");
170 %apply-user-preferred-style;");%html-end;
171 EOH
172 -conflict => {media => {type => 'text/html', charset => 1, expires => 60}, check => sub {1},
173 #xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60},
174 template => <<EOH},
175 %html-start;%html-head(title=>"%res(name=>\\"Edit:Conflict:WebPageTitle\\");",link_meta=>"%predefined-template(name=>links); %html-meta(name=>ROBOTS,content=>NOINDEX);"p);
176 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"
177 %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"%predefined-template(name=>navbar);\\"p);
178 %section(level=>2,id=>edit-conflict,title=>\\"Edit:Conflict:Title\\",heading,content=>\\"
179 <p>%res(name=>\\\\\\"Edit:Conflict:Description\\\\\\");</p>
180 %conflict-form;
181 %section(level=>3,id=>edit-conflict-diff,title=>\\\\\\"Edit:Conflict:Diff:Title\\\\\\",heading,content=>\\\\\\"
182 <p>%res(name=>\\\\\\\\\\\\\\"Edit:Conflict:Diff:Description\\\\\\\\\\\\\\");</p>
183 %conflict-diff;
184 \\\\\\");
185 \\");
186 %section(level=>2,id=>edit,title=>\\"Edit:Title\\",heading,content=>\\"
187 <p>%res(name=>\\\\\\"Edit:Conflict:Edit:Description\\\\\\");</p>
188 %edit-form;
189 %section(level=>3,id=>edit-help,add_to_toc=>0,content=>\\\\\\"%read(page=>\\\\\\\\\\\\\\"Wiki//Help//Edit\\\\\\\\\\\\\\");\\\\\\");
190 \\");
191 %section(level=>2,id=>\\"see-also\\",title=>SeeAlso,heading,content=>\\"%search-result;\\");
192 %section(level=>2,id=>referer,title=>Referer,heading,content=>\\"%referer-list;\\");
193 %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");
194 %section(class=>tools,add_to_toc=>0,content=>\\\"%predefined-template(name=>navbar);\\"p);
195 %section(id=>footer,add-to-toc=>0,content=>\\"%predefined-template(name=>footer);\\");
196 %apply-user-preferred-style;");%html-end;
197 EOH
198 -wrote => {media => {type => 'text/html', charset => 1, expires => 60}, check => sub {1},
199 xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60},
200 template => <<EOH},
201 %html-start;%html-head(title=>"%res(name=>\\"Edit:Wrote:WebPageTitle\\");",link_meta=>"%predefined-template(name=>links); %html-meta(name=>ROBOTS,content=>NOINDEX);"p);
202 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"
203 %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"%predefined-template(name=>navbar);\\"p);
204 <p>%res(name=>\\"Edit:SavedSuccessfully\\");</p>
205 %section(id=>footer,add-to-toc=>0,content=>\\"%predefined-template(name=>footer);\\");
206 %apply-user-preferred-style;");%html-end;
207 %log-hotness(weight=>2);
208 EOH
209 -deleted => {media => {type => 'text/html', charset => 1, expires => 60}, check => sub {1},
210 xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60},
211 template => <<EOH},
212 %html-start;%html-head(title=>"%res(name=>\\"Edit:Deleted:WebPageTitle\\");",link_meta=>"%predefined-template(name=>links); %html-meta(name=>ROBOTS,content=>NOINDEX);"p);
213 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"
214 %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"%predefined-template(name=>navbar);\\"p);
215 <p>%res(name=>\\"Edit:PageIsDeletedSuccessfully\\");</p>
216 %section(id=>footer,add-to-toc=>0,content=>\\"%predefined-template(name=>footer);\\");
217 %apply-user-preferred-style;");%html-end;
218 EOH
219 -error => {media => {type => 'text/html', charset => 1, expires => 60}, check => sub {1},
220 xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60},
221 template => <<EOH},
222 %html-start;%html-head(title=>"%res(name=>\\"Error:WebPageTitle\\");",link_meta=>"%predefined-template(name=>links); %html-meta(name=>ROBOTS,content=>NOINDEX);"p);
223 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"
224 %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"%predefined-template(name=>navbar);\\"p);
225 %section(level=>2,id=>error,title=>\\"Error:Title\\",heading,content=>\\"
226 <p>%error-message;</p>
227 \\");
228 %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");
229 %section(id=>footer,add-to-toc=>0,content=>\\"%predefined-template(name=>footer);\\");
230 %apply-user-preferred-style;");%html-end;
231 EOH
232
233
234 rss => {media => {type => 'application/rss+xml', charset => 1, expires => 3600},
235 check => sub { ref $_[0]->format_converter ($_[0]->{magic} => 'RSS') ? 1 : 0 },
236 template => '<?xml version="1.0"?>%styles-wiki-xml(page=>"Wiki//Style//List//RSS");%read(to=>RSS);'},
237 -UnsupportedMediaType => {media => {type => 'text/html', charset => 1, expires => -1},
238 xmedia => {type => 'application/xhtml+xml', charset => 1, expires => -1},
239 check => sub {1}, template => <<EOH},
240 %html-start;%html-head(title=>"%page-name;",link_meta=>"%predefined-template(name=>links); %html-meta(name=>ROBOTS,content=>NOINDEX);"p);
241 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"
242 %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"%predefined-template(name=>navbar);\\"p);
243 %section(level=>2,title=>\\"UnsupportedMediaType:Title\\",heading,content=>\\"
244 <p>%res(name=>\\\\\\"UnsupportedMediaType:Description\\\\\\");</p>
245 \\");
246 %section(id=>footer,add-to-toc=>0,content=>\\"%predefined-template(name=>footer);\\");
247 %apply-user-preferred-style;");%html-end;
248 EOH
249 );
250
251 require SuikaWiki::View;
252 for (keys %ViewDefinition) {
253 SuikaWiki::View->definition ($_)->properties ($ViewDefinition{$_});
254 }
255
256 =head1 NAME
257
258 suikawiki-config.ph --- SuikaWiki: site configuration script
259
260 =head1 LICENSE
261
262 Copyright 2003 Wakaba <w@suika.fam.cx>
263
264 This program is free software; you can redistribute it and/or
265 modify it under the same terms as Perl itself.
266
267 =cut
268
269 1; # $Date: 2003/03/27 07:52:24 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24