Revision [2446]
This is an old revision of LastEdit made by DarTar on 2004-11-25 12:05:41.
Last Edit Action
In order to avoid clicking on RecentChanges to know who edited a page and why,
here's a (stupid) action proposal which prints short lastedit infos in the page body:
Last edited by DarTar:
Added line to restrict output to 'show' method
Thu, 25 Nov 2004 12:05 UTC [diff]
Added line to restrict output to 'show' method
Thu, 25 Nov 2004 12:05 UTC [diff]
Usage {{lastedit}}
Optional parameter: show
{{lastedit show="0"}} show user only
Last edited by DarTar
{{lastedit}} or {{lastedit show="1"}} show user and notes (default)
Last edited by DarTar:
Added line to restrict output to 'show' method
Added line to restrict output to 'show' method
{{lastedit show="2"}} show user, notes, date
Last edited by DarTar:
Added line to restrict output to 'show' method
Thu, 25 Nov 2004 12:05 UTC
Added line to restrict output to 'show' method
Thu, 25 Nov 2004 12:05 UTC
{{lastedit show="3"}} show user, notes, date and quickdiff link
Last edited by DarTar:
Added line to restrict output to 'show' method
Thu, 25 Nov 2004 12:05 UTC [diff]
Added line to restrict output to 'show' method
Thu, 25 Nov 2004 12:05 UTC [diff]
actions/lastedit.php
<?php
// Prints short infos on last edit
// Uses parameter: show
// 0 show user only
// 1 show user and notes
// 2 show user, notes, date
// 3 show user, notes, date and quickdiff link
// set default
if ($show == "") {$show="1";}
$page = $this->LoadSingle("SELECT * FROM ".$this->config["table_prefix"]."pages WHERE tag='".$this->GetPageTag()."' AND latest = 'Y'");
$pagetag = $page["tag"];
$user = ($this->LoadUser($page["user"]))? $this->Link($page["user"]) : "anonymous";
if (!($show == 0)) {
$note = ($page["note"])? ": <br /><span class=\"notes\">".$page["note"]."</span>" : "";
}
if ($show == 2 || $show == 3) {
list($day, $time) = explode(" ", $page["time"]);
$dateformatted = date("D, d M Y", strtotime($day));
$timeformatted = date("H:i T", strtotime($page["time"]));
}
if ($show == 3) {
$oldpage = $this->LoadSingle("SELECT * FROM ".$this->config["table_prefix"]."pages WHERE tag='".$this->GetPageTag()."' AND latest = 'N' ORDER BY time desc LIMIT 1");
$newid = $page["id"];
$oldid = $oldpage["id"];
$difflink = " [<a title=\"Show differences from last version\" href=\"".$this->Href("diff", $pagetag, "a=".$page["id"]."&b=".$oldpage["id"]."&fastdiff=1")."\">diff</a>]";
}
$output = "<div class=\"lastedit\" style=\"border:dotted 1px; padding:3pt; margin:8pt; color:#888; font-size:8pt; width:30%;\">Last edited by
".$user.$note."<br /> ".$dateformatted." ".$timeformatted.$difflink."</div>";
if ($this->method == "show") {print $output;}
?>
// Prints short infos on last edit
// Uses parameter: show
// 0 show user only
// 1 show user and notes
// 2 show user, notes, date
// 3 show user, notes, date and quickdiff link
// set default
if ($show == "") {$show="1";}
$page = $this->LoadSingle("SELECT * FROM ".$this->config["table_prefix"]."pages WHERE tag='".$this->GetPageTag()."' AND latest = 'Y'");
$pagetag = $page["tag"];
$user = ($this->LoadUser($page["user"]))? $this->Link($page["user"]) : "anonymous";
if (!($show == 0)) {
$note = ($page["note"])? ": <br /><span class=\"notes\">".$page["note"]."</span>" : "";
}
if ($show == 2 || $show == 3) {
list($day, $time) = explode(" ", $page["time"]);
$dateformatted = date("D, d M Y", strtotime($day));
$timeformatted = date("H:i T", strtotime($page["time"]));
}
if ($show == 3) {
$oldpage = $this->LoadSingle("SELECT * FROM ".$this->config["table_prefix"]."pages WHERE tag='".$this->GetPageTag()."' AND latest = 'N' ORDER BY time desc LIMIT 1");
$newid = $page["id"];
$oldid = $oldpage["id"];
$difflink = " [<a title=\"Show differences from last version\" href=\"".$this->Href("diff", $pagetag, "a=".$page["id"]."&b=".$oldpage["id"]."&fastdiff=1")."\">diff</a>]";
}
$output = "<div class=\"lastedit\" style=\"border:dotted 1px; padding:3pt; margin:8pt; color:#888; font-size:8pt; width:30%;\">Last edited by
".$user.$note."<br /> ".$dateformatted." ".$timeformatted.$difflink."</div>";
if ($this->method == "show") {print $output;}
?>
CategoryDevelopment