최근변경내역 화면을 표 형식으로 출력함
- 필수 요구 사항:
- /북마크 패치가 적용된 상태이어야 아래의 소스를 그대로 사용할 수 있다.
- 아래의 코드를 참조하여, GetRcHtml 함수의 내용 중 "최근 변경 내역을 테이블로 출력" 이라는 주석문으로 둘러쌓인 부분들을 수정해 주면 된다. 아래의 코드는 /북마크 패치가 같이 적용된 상태이므로, /북마크 패치를 하지 않고 이 패치만 적용할 경우는 주석을 참조하면서 적절하게 고쳐 주어야 할 것이다.
-
sub GetRcHtml {
my @outrc = @_;
my ($rcline, $html, $date, $sum, $edit, $count, $newtop, $author);
my ($showedit, $inlist, $link, $all, $idOnly);
my ($ts, $oldts, $pagename, $summary, $isEdit, $host, $kind, $extraTemp);
my ($tEdit, $tChanges, $tDiff);
my %extra = ();
my %changetime = ();
my %pagecount = ();
$tEdit = T('(edit)');
$tDiff = T('(diff)');
$tChanges = T('changes');
$showedit = &GetParam("rcshowedit", $ShowEdits);
$showedit = &GetParam("showedit", $showedit);
my $bookmark;
my $bookmarkuser = &GetParam('username', "");
my ($rcnew, $rcupdated, $rcdiff, $rcdeleted) = (
"<img style='border:0' src='icons/rc-new.gif'>",
"<img style='border:0' src='icons/rc-updated.gif'>",
"<img style='border:0' src='icons/rc-diff.gif'>",
"<img style='border:0' src='icons/rc-deleted.gif'>"
);
$bookmark = &GetParam('bookmark',-1);
if ($showedit != 1) {
my @temprc = ();
foreach $rcline (@outrc) {
($ts, $pagename, $summary, $isEdit, $host) = split(/$FS3/, $rcline);
if ($showedit == 0) {
push(@temprc, $rcline) if (!$isEdit);
} else {
push(@temprc, $rcline) if ($isEdit);
}
}
@outrc = @temprc;
}
foreach $rcline (@outrc) {
($ts, $pagename) = split(/$FS3/, $rcline);
$pagecount{$pagename}++ if ($ts > $bookmark);
$changetime{$pagename} = $ts;
}
$date = "";
$inlist = 0;
$html = "<table style='border:0'>";
$all = &GetParam("rcall", 0);
$all = &GetParam("all", $all);
$newtop = &GetParam("rcnewtop", $RecentTop);
$newtop = &GetParam("newtop", $newtop);
$idOnly = &GetParam("rcidonly", "");
@outrc = reverse @outrc if ($newtop);
($oldts, $pagename, $summary, $isEdit, $host, $kind, $extraTemp)
= split(/$FS3/, $outrc[0]);
$oldts += 1;
foreach $rcline (@outrc) {
($ts, $pagename, $summary, $isEdit, $host, $kind, $extraTemp)
= split(/$FS3/, $rcline);
next if ((!$all) && ($ts < $changetime{$pagename}));
next if (($idOnly ne "") && ($idOnly ne $pagename));
next if ($ts >= $oldts);
$oldts = $ts;
%extra = split(/$FS2/, $extraTemp, -1);
if ($date ne &CalcDay($ts)) {
$date = &CalcDay($ts);
if ($inlist) {
$inlist = 0;
}
$html .= "<tr><td colspan=6 style='border:0;'><br><b>" . $date . "</b>";
if ($bookmarkuser eq "") {
$html .= "<br> </td></tr>\n";
} else {
$html .= " [" .&ScriptLink("action=bookmark&time=$ts",T('set bookmark')) ."]"
. "</td></tr>\n";
}
}
if (!$inlist) {
$inlist = 1;
}
$host = &QuoteHtml($host);
if (defined($extra{'name'}) && defined($extra{'id'})) {
$author = &GetAuthorLink($host, $extra{'name'}, $extra{'id'});
} else {
$author = &GetAuthorLink($host, "", 0);
}
$sum = "";
if (($summary ne "") && ($summary ne "*")) {
$summary = &QuoteHtml($summary);
$sum = "<span style='color:green'>[$summary]</span> ";
}
$edit = "";
$edit = "<em>$tEdit</em> " if ($isEdit);
$count = "";
if ((!$all) && ($pagecount{$pagename} > 1)) {
$count = "($pagecount{$pagename} ";
if (&GetParam("rcchangehist", 1)) {
$count .= &GetHistoryLink($pagename, $tChanges);
} else {
$count .= $tChanges;
}
$count .= ") ";
}
$link = "";
if ($UseDiff && &GetParam("diffrclink", 1)) {
if (!(-f &GetPageFile($pagename))) {
$link .= &GetHistoryLink($pagename, $rcdeleted);
} elsif (($bookmarkuser eq "") || ($ts <= $bookmark)) {
$link .= &ScriptLinkDiff(4, $pagename, $rcdiff, "") . " ";
} elsif ($extra{'tscreate'} > $bookmark) {
$link .= $rcnew . " ";
} else {
$link .= &ScriptLinkDiffRevision(5, $pagename, "", $rcupdated) . " ";
}
}
$html .= "<tr><td style='border:0'> </td>"
. "<td style='border:0'>$link </td>"
. "<td style='border:0'>" . &GetPageOrEditLink($pagename) . "</td>"
. "<td style='border:0'>" . &CalcTime($ts) . "</td>"
. "<td style='border:0'>$count$edit</td>"
. "<td style='border:0'>$author</td></tr>\n";
if ($sum ne "") {
$html .= "<tr><td systems='border:0' colspan=2></td>"
. "<td colspan=4 style='border:0'> $sum</td></tr>\n";
}
}
$html .= "</table>";
return $html;
}
Notes
날짜 출력하는 부분에서 tr 태그가 빠져있네요. 닫는건 나옵니다.
그렇군요. 수정했습니다.
$html .= "<tr><td colspan=6 style='border:0;'><br><b>" . $date . "</b>";
위키위키분류