package main; use strict; ## URI (or part of URI) of Wiki CGI itself and its external addons ## Note: If your Wiki CGI URI is , ## cookie-path: /path/to/ ## script-short-name: wiki.cgi ## URI parts MUST NOT contains "&" and/or non-URI characters. our %uri = ( cookie_path => '/~wakaba/-temp/expwiki/', external_script => '../wiki/script/', script_short_name => 'wiki', ## If you use CVS repository of WikiDatabase, #cvs_repository => 'http://path-to-viewcvs/path-to-repository/', ); our $url_cgi = "http://".($main::ENV{HTTP_HOST} || $main::ENV{SERVER_NAME}.($main::ENV{SERVER_PORT}==80?'':":$main::ENV{SERVER_PORT}"))."$uri{cookie_path}$uri{script_short_name}"; $uri{wiki_abs} = $url_cgi; $uri{wiki} = qq($uri{cookie_path}$uri{script_short_name}); ## Path to modules and databases push @main::INC, qw'lib ../wiki/lib lib'; require SuikaWiki::Implementation; our $WIKI = SuikaWiki::Implementation->new; our %PathTo = ( ## Path to your data, from the main CGI script (NOT from this config script) CachePrefix => q(./wikidata/.cache.), # WikiPlugin TempPrefix => q(./wikidata/.tmp.), # WikiPlugin, Image convert => q(/usr/X11R6/bin/convert), # Image ); ## Filesystem path mapping for ( [db__content__dir => q"./wikidata/page"], [db__content__error_log => q"./wikidata/log/db-content.log"], [db__lock__dir => q"./wikidata/lock/"], ) { $WIKI->{config}->{path_to}->{$_->[0]} = $_->[1]; } ## Plugin push @{$WIKI->{event}->{plugin_manager_loaded}}, sub { ## Obsolete interface push @SuikaWiki::Plugin::plugin_directory, ( q(../wiki/lib/SuikaWiki/Plugin/), q(../wiki/misc/plugins/), q(lib/SuikaWiki/Plugin/), q(misc/plugins/), ); SuikaWiki::Plugin->import_plugins (); require 'wikidata/config.ph'; }; ## Database mapping push @{$WIKI->{event}->{database_loaded}}, sub { ## Main content $WIKI->{db}->_set_prop_db (content => {-db_open => sub { require SuikaWiki::DB::FileSystem::YukiWikiDBNS; SuikaWiki::DB::FileSystem::YukiWikiDBNS->new (directory => $WIKI->{config}->{path_to}->{db__content__dir}, logfile => $WIKI->{config}->{path_to}->{db__content__error_log}, suffix => '.txt', -lock => &{$WIKI->{var}->{db}->{lock_prop}} ('content')); }, -own => 1}); ## Last modified $WIKI->{db}->_set_prop_db (lastmodified => {-db_open => sub { require SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09; SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09->new (directory => $WIKI->{config}->{path_to}->{db__content__dir}, -lock => &{$WIKI->{var}->{db}->{lock_prop}} ('lastmodified')); }, -prop => 'last_modified', -own => 1}); }; push @{$WIKI->{event}->{database_loaded}}, sub { $WIKI->{db}->get (content => ['dummy']); *main::database = $WIKI->{db}->{prop}->{content}->{-db}->{db_hash}; $SuikaWiki::Plugin::DB = $WIKI->{db}; for (@{$SuikaWiki::Plugin::On{WikiDatabaseLoaded}||[]}) { &{$_} } package wiki::dummy; sub meta {undef}; sub list_items {}; sub STORE {}; }; ## 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", ); $WIKI->{config}->{page} = { Default => [qw/HomePage/], NewPageTemplate => [qw/Wiki NewPageTemplate/], }; our %PageOf = %{$WIKI->{config}->{page}}; $WIKI->{config}->{charset}->{internal} = 'euc-jp'; $WIKI->{config}->{charset}->{output} = 'iso-2022-jp'; $WIKI->{config}->{charset}->{uri_param} = ''; # auto detect $WIKI->{config}->{charset}->{uri_query} = ''; # auto detect our $kanjicode = 'euc'; # obsolete $WIKI->{config}->{entity}->{expires} = { edit => {delta => 60}, view => {delta => 2*3600}, lm_flaged => {delta => 30*24*3600}, }; ## Misc. options $SuikaWiki::Plugin::UserAgent::LoggingName = 1; ## Use UA-name log? (require UserAgent plugin module) ## Definition of views require SuikaWiki::View; 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;)); }; =head1 NAME suikawiki-config.ph --- SuikaWiki: site configuration script =head1 LICENSE Copyright 2003 Wakaba This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; # $Date: 2003/10/25 06:40:08 $