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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by w, Sun Jan 26 02:39:48 2003 UTC revision 1.14 by wakaba, Thu Apr 22 05:45:14 2004 UTC
# Line 1  Line 1 
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  # You MUST modify following '$modifier_...' variables.    ## These lines should be removed after utf8 support
24  #    BEGIN {
25  # our $modifier_dbtype = 'AnyDBM_File';  # Fast, not available on some server, page size limited.      $Message::Util::Formatter::Base::Token = qr/[\w._+\x80-\xFF-]+/;
26  # our $modifier_dbtype = 'dbmopen';      # Fast, not available on some server, page size limited.      require Message::Util::Formatter::Base;
27  #our $modifier_dbtype = 'Yuki::YukiWikiDB';     # Slow, available on all environment.    }
28  #our $modifier_dbtype = 'Yuki::YukiWikiDB2';     # Slow, available on all environment.    use Message::Util::Error;
29  our $modifier_dbtype = 'Yuki::YukiWikiDBMeta';     # Slow, available on all environment.  
30  our $url_cgi; {  BEGIN {
31      my $scheme = 'http';    if ($main::ENV{REQUEST_URI} =~ /\#/) {
32      $scheme = lc $1 if $main::ENV{SERVER_PROTOCOL} =~ m#([A-Za-z0-9+.%-]+)#;      require SuikaWiki::Output::HTTP;
33      $url_cgi = "$scheme://$main::ENV{SERVER_NAME}:$main::ENV{SERVER_PORT}/~wakaba/suikawiki/wiki";      my $out = SuikaWiki::Output::HTTP->new;
34          ## - MUST NOT include [&<>"] and/or non-URI characters      $out->{status_code} = 401;
35        $out->{status_phrase} = q<Request-URI MUST NOT have Fragment Identifier>;
36        $out->{entity}->{media_type} = q<text/html>;
37        $out->{entity}->{charset} = q<iso-8859-1>;
38        $out->{entity}->{language} = [q<en>];
39        $out->{entity}->{body_is_octet_stream} = 1;
40        my $ua = $main::ENV{HTTP_USER_AGENT};
41        for ($ua) {
42          s/&/&amp;/g; s/</&lt;/g; s/([^\x20-\x7E])/sprintf '&#x%02X;', ord $1/ge;
43        };
44        $out->{entity}->{body} = qq<
45          <!DOCTYPE html SYSTEM>
46          <title>401 Bad Request-URI</title>
47          <h1>Bad Request-URI</h1>
48          <p>Your Request-URI has fragment identifier but it is not allowed here.
49          It might be a bug of your user agent ($ua).  Please contact to the UA
50          vendor.</p>
51        >;
52        $out->output (output => 'http-cgi');
53        exit;
54      }
55  }  }
 our %uri = (  
   cookie_path   => '/~wakaba/suikawiki/',  
   external_script       => '../wiki/script/',  
 );  
 $uri{wiki} = $url_cgi;  
 $SuikaWiki::Plugin::plugin_directory = q(../wiki/lib/SuikaWiki/Plugin/);  
 our %PathTo = ( ## Path to your data, from the main CGI script (NOT from this config script)  
   CachePrefix   => q(./wikidata/.cache.),  
   WikiDataBase  => q(./wikidata/page),  
 );  
 ##############################  
 our %PageName = (  
   FrontPage     => 'HomePage',  
   IndexPage     => 'IndexPage',  
   SearchPage    => 'SearchPage',  
   CreatePage    => 'CreatePage',  
   ErrorPage     => 'ErrorPage',  
   RecentChanges => 'RecentChanges',  
   AdminSpecialPage      => "\x11\x11Admin\x11Special\x11Page\x11\x11",  
   UserAgentList => 'WikiUserAgentList',  
 );  
 our $kanjicode = 'euc';  
 our $lang = 'ja';  
   
 $wiki::useragent::UseLog = 0;   ## Use User-Agent name log (WikiUserAgentList) or not  
 $wiki::diff::UseDiff = 1;       ## Use diff mode or not  
   
 my %vd;  
 $vd{links} = <<'EOH';  
   %styles-wiki-html(page=>\"WikiStyleList:HTML\");  
   %link-wiki(mode=>edit,rel=>edit,class=>wiki-cmd,title=>\"%res(name=>EditThisPageLink);\");  
   %link-wiki(mode=>edit,rel=>edit,class=>wiki-cmd,title=>\"%res(name=>AdminEditThisPageLink);\",add_param=>\"admin=1\");  
   %link-wiki(rel=>view,class=>wiki-cmd,title=>\"%res(name=>ViewThisPageLink);\",up_to_date);  
   %link-wiki(rel=>myself,class=>wiki,title=>\"%res(name=>GoToMyselfLink);\");  
   %link-wiki(page=>IndexPage,rel=>index,class=>wiki,title=>\"%res(name=>GoToIndexPageLink);\");  
   %link-wiki(page=>HomePage,rel=>home,class=>wiki,title=>\"%res(name=>GoToHomePageLink);\");  
   %link-wiki(page=>WikiNews,rel=>News,class=>wiki,title=>\"%res(name=>GoToWikiNewsLink);\");  
   %link-wiki(page=>RecentChanges,rel=>News,class=>wiki,title=>\"%res(name=>GoToRecentChangesLink);\");  
   %link-wiki(page=>RecentChanges,mode=>rss,rel=>News,class=>wiki,title=>\"%res(name=>GoToRssPageLink);\",type=>\"application/xml\");  
   %link-wiki(page=>SearchPage,rel=>search,class=>wiki,title=>\"%res(name=>GoToSearchPageLink);\");  
   %link-wiki(page=>WikiHelp,mode=>read,rel=>help,class=>wiki,title=>\"%res(name=>GoToWikiHelpLink);\");  
   %link-wiki(page=>WikiPageLicense,rel=>copyright,class=>wiki,title=>\"%res(name=>GoToWikiPageLicenseLink);\");  
   %link-wiki(mode=>map,rel=>contents,class=>wiki-cmd,title=>\"%res(name=>ShowMapOfThisPageLink);\");  
   %link-wiki(mode=>RandomJump,up_to_date,rel=>lucky,class=>\"wiki randomlink\",title=>\"%res(name=>GoSomewhereLink);\");  
 EOH  
   #%link-viewcvs(href=>\"http://path-to-viewcvs/path-to-repository/\",rel=>history,class=>wiki-cmd,title=>\"%res(name=>ViewHistoryOfThisPageLink);\",hreflang=>en);  
 $vd{links} .= q(  %link-wiki(mode=>diff,rel=>history,class=>wiki-cmd,title=>\"%res(name=>ViewDiffOfThisPageLink);\");) if $wiki::diff::UseDiff;  
 $vd{links} .= <<EOH;  
   %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);\\\");  
   %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);\\\");  
 EOH  
 $vd{navbar} = <<'EOH';  
   %anchor-wiki(mode=>edit,rel=>edit,class=>wiki-cmd,label=>\\\"%res(name=>EditThisPage);\\\",title=>\\\"%res(name=>EditThisPageLong,accesskey=>E);\\\");  
   %anchor-wiki(rel=>view,up_to_date,class=>wiki-cmd,label=>\\\"%res(name=>ViewThisPage);\\\",title=>\\\"%res(name=>ViewThisPageLong);\\\");  
   %anchor-wiki(page=>CreatePage,class=>wiki,label=>\\\"%res(name=>GoToCreatePage);\\\",title=>\\\"%res(name=>GoToCreatePageLong);\\\");  
   %anchor-wiki(page=>IndexPage,class=>wiki,label=>\\\"%res(name=>GoToIndexPage);\\\",title=>\\\"%res(name=>GoToIndexPageLong);\\\");  
   %anchor-wiki(page=>HomePage,class=>wiki,label=>\\\"%res(name=>GoToHomePage);\\\",title=>\\\"%res(name=>GoToHomePageLong);\\\");  
   %anchor-wiki(page=>SearchPage,class=>wiki,label=>\\\"%res(name=>GoToSearchPage);\\\",title=>\\\"%res(name=>GoToSearchPageLong);\\\");  
   %anchor-wiki(mode=>RandomJump,up_to_date,rel=>lucky,class=>\\\"wiki randomlink\\\",label=>\\\"%res(name=>GoSomewhere);\\\",title=>\\\"%res(name=>GoSomewhereLong);\\\");  
   %anchor-wiki(page=>RecentChanges,class=>wiki,label=>\\\"%res(name=>GoToRecentChanges);\\\",title=>\\\"%res(name=>GoToRecentChangesLong);\\\");  
 EOH  
   
 our %ViewDefinition = (  
 read => {media => {type => 'text/html', charset => 1, expires => 120}, check => sub {1},  
   #xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 120},  
   template => <<EOH},  
 %html-start;%html-head(title=>"%res(name=>\\"View:WebPageTitle\\");",link_meta=>"$vd{links}");  
 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"  
   %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"$vd{navbar}\\");  
   %section(level=>2,id=>read,add_to_toc=>0,content=>\\"%read(comment);\\");  
   %section(level=>2,id=>\\"see-also\\",title=>SeeAlso,heading,content=>\\"%search-result;\\");  
   %section(level=>2,id=>referer,title=>Referer,heading,content=>\\"%referer-list;\\");  
   %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");  
   %section(id=>last-modified,add_to_toc=>0,content=>\\"%res(name=>\\\\\\"LastModified=\\\\\\");%last-modified;\\");  
   %section(class=>tools,add_to_toc=>0,content=>\\\"$vd{navbar}\\\");  
   %section(id=>footer,add_to_toc=>0,content=>\\"  
     <a href=\\\\\\"http://www.hyuki.com/yukiwiki/\\\\\\" title=\\\\\\"YukiWiki 2.0.beta1.2002-05-29 &copy; 2000-2002 by Hiroshi Yuki\\\\\\">%res(name=>\\\\\\"About:Name:YukiWiki\\\\\\");</a>  
     <a href=\\\\\\"http://digit.que.ne.jp/work/\\\\\\" title=\\\\\\"WalWiki 2.0.beta1.wal.1 &copy; 2000-2002 by Makio Tsukamoto\\\\\\">%res(name=>\\\\\\"About:Name:WalWiki\\\\\\");</a>  
     <a href=\\\\\\"http://suika.fam.cx/gate/cvs/wakaba/wiki/\\\\\\" title=\\\\\\"%res(name=>\\\\\\"About:SuikaWiki:JumpToCVS\\\\\\");\\\\\\">%res(name=>\\\\\\"About:Name:SuikaWiki\\\\\\"); %wiki-version;</a>  
   \\");  
 %apply-user-preferred-style;");%html-end;  
 EOH  
 map => {media => {type => 'text/html', charset => 1, expires => 120}, check => sub {1},  
   #xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 120},  
   template => <<EOH},  
 %html-start;%html-head(title=>"%res(name=>\\"Map:WebPageTitle\\");",link_meta=>"$vd{links}");  
 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"  
   %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"$vd{navbar}\\");  
   %section(level=>2,id=>\\"link-map\\",title=>\\"Map:Title\\",heading,content=>\\"  
     <p>%res(name=>\\\\\\"Map:Description\\\\\\");</p>  
     %link-map;  
   \\");  
   %section(level=>2,id=>\\"see-also\\",title=>SeeAlso,heading,content=>\\"%search-result;\\");  
   %section(level=>2,id=>referer,title=>Referer,heading,content=>\\"%referer-list;\\");  
   %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");  
   %section(class=>tools,add_to_toc=>0,content=>\\\"$vd{navbar}\\\");  
   %section(id=>footer,add_to_toc=>0,content=>\\"%res(name=>\\\\\\"About:Name:SuikaWiki\\\\\\"); %wiki-version;\\");  
 %apply-user-preferred-style;");%html-end;  
 EOH  
   
 edit => {media => {type => 'text/html', charset => 1, expires => 60}, check => sub {1},  
   #xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60},  
   template => <<EOH},  
 %html-start;%html-head(title=>"%res(name=>\\"Edit:WebPageTitle\\");",link_meta=>"$vd{links}  %html-meta(name=>ROBOTS,content=>NOINDEX);");  
 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"  
   %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"$vd{navbar}\\");  
   %section(level=>2,id=>edit,title=>\\"Edit:Title\\",heading,content=>\\"  
     %edit-form;  
     %section(level=>3,id=>edit-help,add_to_toc=>0,content=>\\\\\\"%read(page=>WikiEditHelp);\\\\\\");  
   \\");  
   %section(level=>2,id=>\\"see-also\\",title=>SeeAlso,heading,content=>\\"%search-result;\\");  
   %section(level=>2,id=>referer,title=>Referer,heading,content=>\\"%referer-list;\\");  
   %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");  
   %section(id=>last-modified,add_to_toc=>0,content=>\\"%res(name=>\\\\\\"LastModified=\\\\\\");%last-modified;\\");  
   %section(class=>tools,add_to_toc=>0,content=>\\\"$vd{navbar}\\\");  
   %section(id=>footer,add_to_toc=>0,content=>\\"%res(name=>\\\\\\"About:Name:SuikaWiki\\\\\\"); %wiki-version;\\");  
 %apply-user-preferred-style;");%html-end;  
 EOH  
 adminedit => {media => {type => 'text/html', charset => 1, expires => 60}, check => sub {1},  
   xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60},  
   template => <<EOH},  
 %html-start;%html-head(title=>"%res(name=>\\"Edit:Admin:WebPageTitle\\");",link_meta=>"$vd{links}  %html-meta(name=>ROBOTS,content=>NOINDEX);");  
 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"  
   %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"$vd{navbar}\\");  
   %section(level=>2,id=>edit,title=>\\"Edit:Title\\",heading,content=>\\"%edit-form(admin);\\");  
   %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");  
   %section(id=>last-modified,add_to_toc=>0,content=>\\"%res(name=>\\\\\\"LastModified=\\\\\\");%last-modified;\\");  
   %section(id=>footer,add_to_toc=>0,content=>\\"%res(name=>\\\\\\"About:Name:SuikaWiki\\\\\\"); %wiki-version;\\");  
 %apply-user-preferred-style;");%html-end;  
 EOH  
 -conflict => {media => {type => 'text/html', charset => 1, expires => 60}, check => sub {1},  
   #xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60},  
   template => <<EOH},  
 %html-start;%html-head(title=>"%res(name=>\\"Edit:Conflict:WebPageTitle\\");",link_meta=>"$vd{links}  %html-meta(name=>ROBOTS,content=>NOINDEX);");  
 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"  
   %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"$vd{navbar}\\");  
   %section(level=>2,id=>edit-conflict,title=>\\"Edit:Conflict:Title\\",heading,content=>\\"  
     <p>%res(name=>\\\\\\"Edit:Conflict:Description\\\\\\");</p>  
     %conflict-form;  
     %section(level=>3,id=>edit-conflict-diff,title=>\\\\\\"Edit:Conflict:Diff:Title\\\\\\",heading,content=>\\\\\\"  
       <p>%res(name=>\\\\\\\\\\\\\\"Edit:Conflict:Diff:Description\\\\\\\\\\\\\\");</p>  
       %conflict-diff;  
     \\\\\\");  
   \\");  
   %section(level=>2,id=>edit,title=>\\"Edit:Title\\",heading,content=>\\"  
     <p>%res(name=>\\\\\\"Edit:Conflict:Edit:Description\\\\\\");</p>  
     %edit-form;  
     %section(level=>3,id=>edit-help,add_to_toc=>0,content=>\\\\\\"%read(page=>WikiEditHelp);\\\\\\");  
   \\");  
   %section(level=>2,id=>\\"see-also\\",title=>SeeAlso,heading,content=>\\"%search-result;\\");  
   %section(level=>2,id=>referer,title=>Referer,heading,content=>\\"%referer-list;\\");  
   %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");  
   %section(class=>tools,add_to_toc=>0,content=>\\\"$vd{navbar}\\\");  
   %section(id=>footer,add_to_toc=>0,content=>\\"%res(name=>\\\\\\"About:Name:SuikaWiki\\\\\\"); %wiki-version;\\");  
 %apply-user-preferred-style;");%html-end;  
 EOH  
 -wrote => {media => {type => 'text/html', charset => 1, expires => 60}, check => sub {1},  
   xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60},  
   template => <<EOH},  
 %html-start;%html-head(title=>"%res(name=>\\"Edit:Wrote:WebPageTitle\\");",link_meta=>"$vd{links}  %html-meta(name=>ROBOTS,content=>NOINDEX);");  
 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"  
   %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"$vd{navbar}\\");  
   <p>%res(name=>\\"Edit:SavedSuccessfully\\");</p>  
   %section(id=>footer,add_to_toc=>0,content=>\\"%res(name=>\\\\\\"About:Name:SuikaWiki\\\\\\"); %wiki-version;\\");  
 %apply-user-preferred-style;");%html-end;  
 EOH  
 -deleted => {media => {type => 'text/html', charset => 1, expires => 60}, check => sub {1},  
   xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60},  
   template => <<EOH},  
 %html-start;%html-head(title=>"%res(name=>\\"Edit:Deleted:WebPageTitle\\");",link_meta=>"$vd{links}  %html-meta(name=>ROBOTS,content=>NOINDEX);");  
 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"  
   %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"$vd{navbar}\\");  
   <p>%res(name=>\\"Edit:PageIsDeletedSuccessfully\\");</p>  
   %section(id=>footer,add_to_toc=>0,content=>\\"%res(name=>\\\\\\"About:Name:SuikaWiki\\\\\\"); %wiki-version;\\");  
 %apply-user-preferred-style;");%html-end;  
 EOH  
 -error => {media => {type => 'text/html', charset => 1, expires => 60}, check => sub {1},  
   xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 60},  
   template => <<EOH},  
 %html-start;%html-head(title=>"%res(name=>\\"Error:WebPageTitle\\");",link_meta=>"$vd{links}  %html-meta(name=>ROBOTS,content=>NOINDEX);");  
 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"  
   %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"$vd{navbar}\\");  
   %section(level=>2,id=>error,title=>\\"Error:Title\\",heading,content=>\\"  
     <p>%error-message;</p>  
   \\");  
   %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");  
   %section(id=>footer,add_to_toc=>0,content=>\\"%res(name=>\\\\\\"About:Name:SuikaWiki\\\\\\"); %wiki-version;\\");  
 %apply-user-preferred-style;");%html-end;  
 EOH  
   
 css => {media => {type => 'text/css', charset => 1, expires => 3600},  
   check => sub { ref $_[0]->format_converter ($_[0]->{magic} => 'CSS') ? 1 : 0 },  
   template => '%read(to=>CSS);'},  
 rss => {media => {type => 'application/rss+xml', charset => 1, expires => 3600},  
   check => sub { ref $_[0]->format_converter ($_[0]->{magic} => 'RSS') ? 1 : 0 },  
   template => '%read(to=>RSS);'},  
 -UnsupportedMediaType => {media => {type => 'text/html', charset => 1, expires => -1},  
   xmedia => {type => 'application/xhtml+xml', charset => 1, expires => -1},  
   check => sub {1}, template => <<EOH},  
 %html-start;%html-head(title=>"%page-name;",link_meta=>"$vd{links}");  
 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"  
   %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"$vd{navbar}\\");  
   %section(level=>2,title=>\\"UnsupportedMediaType:Title\\",heading,content=>\\"  
     %res(name=>\\\\\\"UnsupportedMediaType:Description\\\\\\");  
   \\");  
   %section(level=>2,id=>\\"see-also\\",title=>SeeAlso,heading,content=>\\"%search-result;\\");  
   %section(level=>2,id=>referer,title=>Referer,heading,content=>\\"%referer-list;\\");  
   %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");  
   %section(class=>tools,add_to_toc=>0,content=>\\"$vd{navbar}\\");  
   %section(id=>footer,add_to_toc=>0,content=>\\"%res(name=>\\\\\\"About:Name:SuikaWiki\\\\\\"); %wiki-version;\\");  
 %apply-user-preferred-style;");%html-end;  
 EOH  
 );  
   
   
 $ViewDefinition{diff} = {media => {type => 'text/html', charset => 1, expires => 120},  
   #xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 120},  
   template => <<EOH, check => sub {1}} if $wiki::diff::UseDiff;  
 %html-start;%html-head(title=>"%res(name=>\\"Diff:WebPageTitle\\");",link_meta=>"$vd{links}");  
 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"  
   %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"$vd{navbar}\\");  
   %section(level=>2,id=>\\"diff\\",title=>\\"Diff:Title\\",heading,content=>\\"  
     <p>%res(name=>\\\\\\"Diff:Notice\\\\\\");</p>  
     %diff-between-previous;  
   \\");  
   %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");  
   %section(class=>tools,add_to_toc=>0,content=>\\\"$vd{navbar}\\\");  
   %section(id=>footer,add_to_toc=>0,content=>\\"%res(name=>\\\\\\"About:Name:SuikaWiki\\\\\\"); %wiki-version;\\");  
 %apply-user-preferred-style;");%html-end;  
 EOH  
   
 $ViewDefinition{WithMenu} = {%{$ViewDefinition{read}}, template => <<EOH};  
 %html-start;%html-head(title=>"%res(name=>\\"View:WebPageTitle\\");",link_meta=>"$vd{links}");  
 %section(level=>1,add_to_toc=>0,type=>body,title=>"%page-name;",heading,content=>"  
   <div id=\\\"myuri\\\">%uri-wiki();</div>  
   %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"  
     %anchor-wiki(rel=>view,up_to_date,mode=>default,class=>wiki-cmd,label=>\\\\\\"%res(name=>ReloadThisPage);\\\\\\",title=>\\\\\\"%res(name=>ReloadThisPageLong);\\\\\\");  
     $vd{navbar}  
   \\");  
   %section(level=>2,id=>side-menu,add_to_toc=>0,content=>\\"%read(page=>WikiMenuBar);\\");  
   %section(id=>content-frame,add_to_toc=>0,content=>\\"  
     %section(level=>2,id=>read,add_to_toc=>0,content=>\\\\\\"%read(comment);\\\\\\");  
     %section(level=>2,id=>\\\\\\"see-also\\\\\\",title=>SeeAlso,heading,content=>\\\\\\"%search-result;\\\\\\");  
     %section(level=>2,id=>referer,title=>Referer,heading,content=>\\\\\\"%referer-list;\\\\\\");  
     %section(level=>2,id=>toc,title=>\\\\\\"TOC:Title\\\\\\",heading,add_to_toc=>0,content=>\\\\\\"%toc(drag);\\\\\\");  
     %section(id=>last-modified,add_to_toc=>0,content=>\\\\\\"%res(name=>\\\\\\\\\\\\\\"LastModified=\\\\\\\\\\\\\\");%last-modified;\\\\\\");  
     %section(id=>footer,add_to_toc=>0,content=>\\\\\\"  
       <a href=\\\\\\\\\\\\\\"http://www.hyuki.com/yukiwiki/\\\\\\\\\\\\\\" title=\\\\\\\\\\\\\\"YukiWiki 2.0.beta1.2002-05-29 &copy; 2000-2002 by Hiroshi Yuki\\\\\\\\\\\\\\">%res(name=>\\\\\\\\\\\\\\"About:Name:YukiWiki\\\\\\\\\\\\\\");</a>  
       <a href=\\\\\\\\\\\\\\"http://digit.que.ne.jp/work/\\\\\\\\\\\\\\" title=\\\\\\\\\\\\\\"WalWiki 2.0.beta1.wal.1 &copy; 2000-2002 by Makio Tsukamoto\\\\\\\\\\\\\\">%res(name=>\\\\\\\\\\\\\\"About:Name:WalWiki\\\\\\\\\\\\\\");</a>  
       <a href=\\\\\\\\\\\\\\"http://suika.fam.cx/gate/cvs/wakaba/wiki/\\\\\\\\\\\\\\" title=\\\\\\\\\\\\\\"%res(name=>\\\\\\\\\\\\\\"About:SuikaWiki:JumpToCVS\\\\\\\\\\\\\\");\\\\\\\\\\\\\\">%res(name=>\\\\\\\\\\\\\\"About:Name:SuikaWiki\\\\\\\\\\\\\\"); %wiki-version;</a>  
     \\\\\\");  
   \\");  
 %apply-user-preferred-style;");%html-end;  
 EOH  
56    
57  1;  push our @Config, sub ($) {
58      my $WIKI = shift;
59      use Cwd qw(abs_path);
60      
61      ## -- Filesystem path mapping
62      for (
63         [db__cache__dir          => q"./wikidata/cache/"],
64         [db__cache_struct__file  => q"./wikidata/cache/struct.db"],
65         [db__content__dir        => q"./wikidata/page/"],
66         [db__content__error_log  => q"./wikidata/log/db-content.log"],
67         [db__bdb__home_dir       => q"./wikidata/lock/"],
68         [db__bdb__log_dir        => q"./wikidata/log/bdb/"],
69         [db__bdb__log_file       => q"./wikidata/log/bdb.log"],
70         [db__bdb__temp_dir       => q"./wikidata/lock/"],
71         [db__lock__dir           => q"./wikidata/lock/"],
72         [db__lock__log_file      => q"./wikidata/log/lock.log"],
73         [db__log__dir            => q"./wikidata/log/"],
74         [db__temp__dir           => q"./wikidata/lock/"],
75         [namazu__index_dir       => q"/var/namazu/index/suikawiki"],
76      ) {
77        ## On system that does not set current directory as main script
78        ## directory, you should specify it instead of using "abs_path".
79        $WIKI->{config}->{path_to}->{$_->[0]} = abs_path $_->[1];
80      }
81      
82      ## -- Namazu URI Mapping (See SuikaWiki:SuikaWiki//Namazu) --
83      $WIKI->{config}->{nmz__uri_to_uri} = sub {
84        my ($nmzuri, %opt) = @_;
85        if ($nmzuri =~ s!^\Q$opt{o}->{wiki}->{config}->{path_to}->{db__content__dir}\E/*!!o) {
86          $nmzuri =~ s/\.txt$//;
87          return $opt{o}->{wiki}->uri_reference
88                          (page => $opt{o}->{wiki}->name ([
89            map {s/([0-9A-F][0-9A-F])/pack 'C', hex $1/ge; $_}
90            split m!\.ns/!, $nmzuri
91          ]), base => 1);
92        } else {
93          $nmzuri =~ s<^/home/wakaba/public_html/([^.]+)><http://suika.fam.cx/~wakaba/$1>;
94          return ($nmzuri, $nmzuri);
95        }
96      };
97    
98      ## -- WikiPlugin
99      push @{$WIKI->{event}->{plugin_manager_loaded}}, sub {
100        my $wiki = shift;
101        
102        ## Installed plugin modules
103        $wiki->{plugin}->load_directory (qw(
104          lib/SuikaWiki/Plugin/
105          misc/plugins/
106          misc/plugins/form/
107          misc/plugins/format/
108          misc/plugins/link/
109          misc/plugins/view/
110        ));
111    
112        ## Configuration file as pseudo-plugin module
113        require 'wikidata/config.ph';
114      };
115    
116      ## -- WikiDatabase: Mapping logical to physical
117      push @{$WIKI->{event}->{database_loaded}}, sub {
118          my $wiki = shift;
119          
120          ## Main content
121          $wiki->{db}->_set_prop_db (content => {-db_open => sub {
122            require SuikaWiki::DB::FileSystem::LeafFile;
123            SuikaWiki::DB::FileSystem::LeafFile->new
124              (base_directory => $wiki->{config}->{path_to}->{db__content__dir},
125               directory_suffix => '.ns',
126               file_suffix    => '.txt',
127               root_key => $wiki->{config}->{page}->{Default},
128               -lock => $wiki->{var}->{db}->{lock_prop}->('content'));
129          }, -db_close => sub {
130            my %opt = @_;
131            $opt{prop_info}->{-db}->close;
132            delete $opt{prop_info}->{-db};
133          }});
134          
135          ## Last modified
136          $wiki->{db}->_set_prop_db (lastmodified => {-db_open => sub {
137            require SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09;
138            SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09->new
139              (directory => $wiki->{config}->{path_to}->{db__content__dir},
140               -lock => $wiki->{var}->{db}->{lock_prop}->('lastmodified'));
141          }, -prop => 'last_modified', -db_close => sub {
142            my %opt = @_;
143            $opt{prop_info}->{-db}->close;
144            delete $opt{prop_info}->{-db};
145          }});
146          
147          ## Cache DBs
148          require SuikaWiki::DB::FileSystem::SuikaWikiCache09;
149          my $cachedb = SuikaWiki::DB::FileSystem::SuikaWikiCache09->new
150                (directory => $wiki->{config}->{path_to}->{db__cache__dir},
151                 expires => 86400 * 3, removes => 86400 * 3); # 3 days
152          $wiki->{db}->_set_prop_db (m__search_result =>
153            {-db => $cachedb, -prop => 'search_result', -db_close => sub {
154              my %opt = @_;
155              $opt{prop_info}->{-db}->close;
156              delete $opt{prop_info}->{-db};
157            }});
158          $wiki->{db}->_set_prop_db (wpp__headsummary =>
159            {-db => $cachedb, -prop => 'headsummary', -db_close => sub {
160              my %opt = @_;
161              $opt{prop_info}->{-db}->close;
162              delete $opt{prop_info}->{-db};
163            }});
164          $wiki->{db}->_set_prop_db (ref__item_template =>
165            {-db => $cachedb, -prop => 'refereritem', -db_close => sub {
166              my %opt = @_;
167              $opt{prop_info}->{-db}->close;
168              delete $opt{prop_info}->{-db};
169            }});
170    
171          ## Berkely DB Environment Preparation
172          use BerkeleyDB;
173          my $bdbenv = new BerkeleyDB::Env
174             -Home => $wiki->{config}->{path_to}->{db__bdb__home_dir},
175             -Config => {
176               DB_DATA_DIR => $wiki->{config}->{path_to}->{db__content__dir},
177               DB_LOG_DIR => $wiki->{config}->{path_to}->{db__bdb__log_dir},
178               DB_TMP_DIR => $wiki->{config}->{path_to}->{db__bdb__temp_dir},
179             },
180             -ErrFile => $wiki->{config}->{path_to}->{db__bdb__log_file},
181             -Flags => DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL,
182             -Verbose => $wiki->{config}->{debug}->{db};
183    
184          $wiki->{db}->_set_prop_db (content__structured => {-db_open => sub {
185            require SuikaWiki::DB::Hash;
186            new SuikaWiki::DB::Hash constructor => sub {
187              use MLDBM qw(BerkeleyDB::Hash);# Storable);
188              tie my %mldb, 'MLDBM',
189                            -Filename => $wiki->{config}->{path_to}
190                                              ->{db__cache_struct__file},
191                            -Env => $bdbenv,
192                            -Flags => DB_CREATE,
193                            -Mode => 0644;
194              \%mldb;
195           };
196          }});
197          
198          ## Referer Database (See Referer plugin module)
199          $wiki->{db}->_set_prop_db (referer => {-db_open => sub {
200            require SuikaWiki::DB::FileSystem::Count;
201            SuikaWiki::DB::FileSystem::Count->new
202              (base_directory => $wiki->{config}->{path_to}->{db__content__dir},
203               directory_suffix => '.ns',
204               file_suffix    => '.ref',
205               root_key => $wiki->{config}->{page}->{Default},
206               auto_mkdir => 0,
207               -lock => $wiki->{var}->{db}->{lock_prop}->('referer'));
208          }, -db_close => sub {
209            my %opt = @_;
210            $opt{prop_info}->{-db}->close;
211            delete $opt{prop_info}->{-db};
212          }});
213    
214          ## HTTP Request Logging Database (See RequestLog plugin module)
215          $wiki->{db}->_set_prop_db (log__http_request => {-db_open => sub {
216            require SuikaWiki::DB::Hash;
217            new SuikaWiki::DB::Hash constructor => sub {
218              tie my %db, 'BerkeleyDB::Hash',
219                            -Filename => 'http-request-log.db',
220                            -Env => $bdbenv,
221                            -Flags => DB_CREATE,
222                            -Mode => 0644;
223              \%db;
224           };
225          }});
226          
227          ## Additional WikiDB properties should be defined here
228          # ...    
229      };
230    
231      push @{$WIKI->{event}->{input_close}}, sub {
232        my ($wiki, $event) = @_;
233        try {
234          SuikaWiki::Plugin->module_package ('Referer')
235                         ->add_referer (wiki => $wiki,
236                                        uri => $wiki->{input}->meta_variable
237                                                 ('HTTP_REFERER'));
238        } catch SuikaWiki::Plugin::error with {
239          my $err = shift;
240          $err->raise unless $err->{-type} eq 'PLUGIN_NOT_FOUND';
241        };
242        try {
243          SuikaWiki::Plugin->module_package ('RequestLog')
244                         ->http_request_log (wiki => $wiki,
245                                             prop => 'log__http_request');
246        } catch SuikaWiki::Plugin::error with {
247          my $err = shift;
248          $err->raise unless $err->{-type} eq 'PLUGIN_NOT_FOUND';
249        };
250      };
251    
252      ## -- WikiName of special purpose WikiPages
253      $WIKI->{config}->{page} = {
254        Default         => $WIKI->name ([qw/HomePage/]),
255        InterWikiName   => $WIKI->name ([qw/Wiki InterWikiName/]),
256        NewPageTemplate => $WIKI->name ([qw/Wiki NewPageTemplate/]),
257        'StyleSheetList(text/html)' => $WIKI->name ([qw<Wiki Style List text/html>]),
258      };
259      
260      ## -- WikiNamespace constants
261      $WIKI->{config}->{name}->{space} = {
262        separator => '//',
263        separator_reg => qr#\s*//\s*#,
264        self => '.',
265        parent => '..',
266        root => '//',
267      };
268      
269      ## -- Default character codes
270      $WIKI->{config}->{charset} = {
271        ## Internal code - MUST be ASCII + 8bit coding scheme
272          internal => 'euc-jp',
273        ## Default output code
274          output => 'iso-2022-jp',
275        ## "query" part in URI reference
276          uri_query => '', # auto-detected
277          uri_query_encode => 'euc-jp',     ## For compatibility w/ SuikaWiki 2
278          uri_param => '', # auto-detected
279          uri_param_encode => 'euc-jp',     ## For compatibility w/ SuikaWiki 2
280        ## PATH_INFO part in URI reference
281          uri_path_info => 'x-utf-8-10646', ## Reserved for future use
282        ## Fragment identifier in URI reference
283          uri_fragment => 'x-punycode',     ## Reserved for possible future use
284      };
285      
286      ## -- Expires duration templates
287      $WIKI->{config}->{entity}->{expires} = {
288        edit      => {delta => 60},
289        view      => {delta => 2*3600},
290        list      => {delta => 60},
291        lm_flaged => {delta => 30*24*3600},
292        stylesheet => {delta => 30*24*3600},
293        error     => {delta => 60},
294      };
295    
296      ## -- Debug mode
297      $WIKI->{config}->{debug} = {
298        general => 0,
299        db => 0,
300        format => 0,
301        view => 0,
302      };
303    
304    };
305    
306    =head1 SEE ALSO
307    
308    C<lib/suikawiki.pl>, C<wiki.cgi>,
309    <http://suika.fam.cx/~wakaba/-temp/wiki/wiki?SuikaWiki>,
310    <http://suika.fam.cx/~wakaba/-temp/wiki/wiki?SWHCS>
311    
312    =head1 LICENSE
313    
314    Copyright 2003-2004 Wakaba <w@suika.fam.cx>.  All rights reserved.
315    
316    This program is free software; you can redistribute it and/or
317    modify it under the same terms as Perl itself.
318    
319    =cut
320    
321    1; # $Date$

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.14

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24