my $cgiurl="";
my $historyurl="";
my $svn=1;
+my $anonok=0;
sub usage { #{{{
die "usage: ikiwiki [options] source templates dest\n";
return @links;
} #}}}
-sub parentlinks ($) {
+sub parentlinks ($) { #{{{
my $page=shift;
my @ret;
$path.="../";
}
return @ret;
-}
+} #}}}
sub indexlink () { #{{{
return "<a href=\"$url\">$wikiname</a>/ ";
$when=concise(ago(time - str2time($3)));
}
elsif ($state eq 'header' && /^\s+[A-Z]\s+\Q$svn_base\E\/(.+)$/) {
- push @pages, pagename($1) if length $1;
+ push @pages, { link => htmllink("", pagename($1), 1) }
+ if length $1;
}
elsif ($state eq 'header' && /^$/) {
$state='body';
error("$this doesn't seem to be executable");
}
- my @params=($srcdir, $destdir, "--wikiname=$wikiname");
+ my @params=($srcdir, $templatedir, $destdir, "--wikiname=$wikiname");
push @params, "--verbose" if $verbose;
push @params, "--rebuild" if $rebuild;
push @params, "--nosvn" if !$svn;
push @params, "--url=$url" if $url;
push @params, "--cgiurl=$cgiurl" if $cgiurl;
push @params, "--historyurl=$historyurl" if $historyurl;
+ push @params, "--anonok" if $anonok;
my $params=join(" ", @params);
my $call='';
foreach my $p ($this, $this, @params) {
exit 0;
} #}}}
-sub cgi_recentchanges ($) { #{{{
+sub cgi_recentchanges () { #{{{
my $q=shift;
-
-
- my $list="<ul>\n";
- foreach my $change (rcs_recentchanges(100)) {
- $list.="<li>";
- $list.=join(", ", map { htmllink("", $_, 1) } @{$change->{pages}});
- $list.="<br>\n";
- $list.="changed ".$change->{when}." by ".
- htmllink("", $change->{user}, 1).
- ": <i>".$change->{message}."</i>\n";
- $list.="</li>\n";
- }
- $list.="</ul>\n";
-
- print $q->header,
- $q->start_html("RecentChanges"),
- $q->h1(indexlink()." RecentChanges"),
- $list,
- $q->end_form,
- $q->end_html;
+ my $template=HTML::Template->new(
+ filename => "$templatedir/recentchanges.tmpl");
+ $template->param(
+ title => "RecentChanges",
+ indexlink => $url,
+ wikiname => $wikiname,
+ changelog => [rcs_recentchanges(100)],
+ );
+ return $template->output;
} #}}}
sub cgi_signin ($$) { #{{{
}
if ($do eq 'recentchanges') {
- cgi_recentchanges($q);
+ cgi_recentchanges();
return;
}
- if (! defined $session->param("name") || $do eq 'signin') {
+ if ((! $anonok && ! defined $session->param("name")) || $do eq 'signin') {
cgi_signin($q, $session);
return;
}
"rebuild" => \$rebuild,
"wrapper" => \$wrapper,
"svn!" => \$svn,
+ "anonok!" => \$anonok,
"cgi" => \$cgi,
"url=s" => \$url,
"cgiurl=s" => \$cgiurl,