--- suikawiki/script/wiki.cgi 2002/10/17 07:56:58 1.28
+++ suikawiki/script/wiki.cgi 2002/10/21 06:28:02 1.29
@@ -208,8 +208,12 @@
sub do_read {
my $content = $database{$form{mypage}};
my $lm = &get_info($form{mypage}, $info_LastModified);
- &print_header($form{mypage}, -last_modified => $lm);
wiki::referer::add ($form{mypage}, $ENV{HTTP_REFERER});
+ my ($r, $c) = get_search_result ($form{mypage});
+ my $rl = wiki::referer::list_html ($form{mypage});
+ my @toc;
+ push @toc, qq(-See Also) if $c;
+ push @toc, qq(-参照元) if $rl;
my $cf = 'SuikaWiki/0.9';
## Should be support at least:
## - 'SuikaWiki/0.9' CRLF
@@ -217,19 +221,21 @@
## - "/*" WSP* 'W3C-CSS/' ("1.0" / "2.0") "*/" CRLF
$cf = $1 if $content =~ s#^(?:/\*\s*|[\#<]\?)?([A-Z][A-Za-z0-9-]+/[0-9.]+(?:[^0-9.][^\x0D\x0A]*)?)[\x0D\x0A]+##s;
if ($cf =~ m!^(?:\#\?)?SuikaWiki/0.9(?:$|\s)!) {
- &print_content($content, content_format => $cf, last_modified => $lm);
+ &print_header ($form{mypage}, -last_modified => $lm,
+ -content_format => $cf, -noindex => $cf =~ /obsoleted="yes"/);
+ &print_content ($content, content_format => $cf, last_modified => $lm,
+ -toc => \@toc);
print &text_to_html (q([[#comment]]));
} else {
+ &print_header($form{mypage}, -last_modified => $lm);
print "
@{[&escape($content)]}
";
}
- my ($r, $c) = get_search_result ($form{mypage});
if ($c) {
- print q{See also
};
+ print q{See also
};
print $r;
}
- my $r = wiki::referer::list_html ($form{mypage});
- if ($r) {
- print qq(参照元
\n$r\n);
+ if ($rl) {
+ print qq(参照元
\n$rl\n);
}
&print_footer($form{mypage}, $lm);
}
@@ -237,12 +243,14 @@
sub do_output_css {
my $content = $database{$form{mypage}};
if ($content =~ m#^\s*/\*\s*W3C-CSS#) {
+ my $lm = &get_info($form{mypage}, $info_LastModified);
print "Content-Type: text/css; charset=$charset\n";
+ print "Last-Modified: $lm\n";
print "\n";
print $content;
} else {
print "Status: 406 Unsupported Media Type\n";
- &print_header('WikiPageIsNotCSS');
+ &print_header('WikiPageIsNotCSS', -noindex => 1);
&print_content($database{WikiPageIsNotCSS});
&print_footer('WikiPageIsNotCSS');
}
@@ -250,7 +258,7 @@
sub do_edit {
my ($page) = &unarmor_name(&armor_name($form{mypage}));
- &print_header($page);
+ &print_header($page, -noindex => 1);
if (not &is_editable($page)) {
&print_message($resource{cantchange});
} elsif (&is_frozen($page)) {
@@ -263,7 +271,7 @@
sub do_adminedit {
my ($page) = &unarmor_name(&armor_name($form{mypage}));
- &print_header($page);
+ &print_header($page, -noindex => 1);
if (not &is_editable($page)) {
&print_message($resource{cantchange});
} else {
@@ -274,7 +282,7 @@
}
sub do_adminchangepasswordform {
- &print_header($AdminChangePassword);
+ &print_header($AdminChangePassword, -noindex => 1);
&print_passwordform;
&print_footer($AdminChangePassword);
}
@@ -301,7 +309,7 @@
my $crypted = crypt($form{mynewpassword}, "$salt1$salt2");
&set_info($AdminSpecialPage, $info_AdminPassword, $crypted);
- &print_header($CompletedSuccessfully);
+ &print_header($CompletedSuccessfully, -noindex => 1);
&print_message($resource{passwordchanged});
&print_footer($CompletedSuccessfully);
}
@@ -326,7 +334,7 @@
}
if (not &is_editable($form{mypage})) {
- &print_header($form{mypage});
+ &print_header($form{mypage}, -noindex => 1);
&print_message($resource{cantchange});
&print_footer($form{mypage});
return;
@@ -353,7 +361,7 @@
&update_recent_changes;
}
&set_info($form{mypage}, $info_IsFrozen, 0 + $form{myfrozen});
- &print_header($CompletedSuccessfully, -goto => $url_cgi.'?'.&encode($form{mypage}).($form{comment_index}?"#x-comment-$form{comment_index}":''));
+ &print_header($CompletedSuccessfully, -noindex => 1, -goto => $url_cgi.'?'.&encode($form{mypage}).($form{__comment_anchor_index}?"#anchor-$form{__comment_anchor_index}":''));
&print_message($resource{saved});
&print_content("$resource{continuereading} @{[&armor_name($form{mypage})]}");
&print_footer($CompletedSuccessfully);
@@ -364,7 +372,7 @@
if ($form{mytouch}) {
&update_recent_changes;
}
- &print_header($form{mypage});
+ &print_header($form{mypage}, -noindex => 1);
&print_message($resource{deleted});
&print_footer($form{mypage});
}
@@ -423,7 +431,9 @@
sub do_random_jump {
my @list = keys %database;
my $name = &encode ($list[rand @list]);
- print "Location: $url_cgi?$name\n";
+ my ($scheme) = 'http';
+ $scheme = $1 if $main::ENV{SERVER_PROTOCOL} =~ m#([A-Za-z0-9+.%-]+)#;
+ print "Location: $scheme://$main::ENV{SERVER_NAME}:$main::ENV{SERVER_PORT}$url_cgi?$name\n";
print "\n";
}
@@ -439,7 +449,7 @@
sub print_error {
my ($msg) = @_;
- &print_header($ErrorPage);
+ &print_header($ErrorPage, -noindex => 1);
print qq($msg
);
&print_footer($ErrorPage);
exit(0);
@@ -451,6 +461,7 @@
if (&is_frozen($page) and $form{mycmd} =~ /^(read|write)$/) {
$bodyclass = "frozen";
}
+ $bodyclass .= " wiki-page-obsoleted" if $option{-content_format} =~ /obsoleted="yes"/;
print qq{Refresh: 0; url="$option{-goto}"\n} if $option{-goto};
print qq{Last-Modified: $option{-last_modified}\n} if $option{-last_modified};
my $cookedpage = &encode($page);
@@ -466,18 +477,18 @@
"http://www.w3.org/TR/html4/loose.dtd"> + RUBY -->
- $escapedpage @{[&escape(&get_subjectline($page))]}
+ $escapedpage
+ @{[$option{-noindex} ? q() : '']}
EOD
&print_navigate_links ($page);
print <