Revision history for LastEdit


Revision [18441]

Last edited on 2008-01-28 00:11:29 by JavaWoman [Modified links pointing to docs server]

No Differences

Revision [8633]

Edited on 2005-05-28 19:22:07 by JavaWoman [move to subcategory]
Additions:
===== Last Edit Action =====

In order to avoid clicking on RecentChanges to know //who// edited a page and //why//,
here's an action which prints short lastedit infos in the page body:
{{lastedit show="3"}}
**Usage** ""{{lastedit}}""

**Optional parameter**: ##show##
""{{lastedit show="0"}}"" //show user only//
{{lastedit show="0"}}
""{{lastedit}}"" or ""{{lastedit show="1"}}"" //show user and notes// (default)
{{lastedit show="1"}}
""{{lastedit show="2"}}"" //show user, notes, date//
{{lastedit show="2"}}
""{{lastedit show="3"}}"" //show user, notes, date and quickdiff link//
{{lastedit show="3"}}

==##actions/lastedit.php##==
%%(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";}

if ($this->method == "show") {
$page = $this->page;
$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\">Last edited by ".$user.$note."<br /> ".$dateformatted." ".$timeformatted.$difflink."</div>";
print $output;
}
?>
%%

Mods by JsnX:
- Removed the line that loaded the current page. The current page is already loaded and stored in $this->page.
- Moved test for show method to beginning. There's no point in running through the code if we're not going to do anything.
- Oops, thanks: I had made both corrections on my machine and forgot to post the modifications :)

----
CategoryDevelopmentActions
Deletions:
===== Last Edit Action =====

In order to avoid clicking on RecentChanges to know //who// edited a page and //why//,
here's an action which prints short lastedit infos in the page body:
{{lastedit show="3"}}
**Usage** ""{{lastedit}}""

**Optional parameter**: ##show##
""{{lastedit show="0"}}"" //show user only//
{{lastedit show="0"}}
""{{lastedit}}"" or ""{{lastedit show="1"}}"" //show user and notes// (default)
{{lastedit show="1"}}
""{{lastedit show="2"}}"" //show user, notes, date//
{{lastedit show="2"}}
""{{lastedit show="3"}}"" //show user, notes, date and quickdiff link//
{{lastedit show="3"}}

==##actions/lastedit.php##==
%%(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";}

if ($this->method == "show") {
$page = $this->page;
$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\">Last edited by ".$user.$note."<br /> ".$dateformatted." ".$timeformatted.$difflink."</div>";
print $output;
}
?>
%%

Mods by JsnX:
- Removed the line that loaded the current page. The current page is already loaded and stored in $this->page.
- Moved test for show method to beginning. There's no point in running through the code if we're not going to do anything.
- Oops, thanks: I had made both corrections on my machine and forgot to post the modifications :)

----
CategoryDevelopment


Revision [2562]

Edited on 2004-11-27 19:09:38 by DarTar [thanks]
Additions:
- Oops, thanks: I had made both corrections on my machine and forgot to post the modifications :)


Revision [2541]

Edited on 2004-11-27 15:51:23 by JsnX [Modified code slightly]
Additions:
here's an action which prints short lastedit infos in the page body:
if ($this->method == "show") {
$page = $this->page;
$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\">Last edited by ".$user.$note."<br /> ".$dateformatted." ".$timeformatted.$difflink."</div>";
print $output;
Mods by JsnX:
- Removed the line that loaded the current page. The current page is already loaded and stored in $this->page.
- Moved test for show method to beginning. There's no point in running through the code if we're not going to do anything.
Deletions:
here's a (stupid) action proposal which prints short lastedit infos in the page body:
$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\">Last edited by
".$user.$note."<br /> ".$dateformatted." ".$timeformatted.$difflink."</div>";
if ($this->method == "show") {print $output;}


Revision [2513]

Edited on 2004-11-27 11:45:13 by DarTar [Removing style attributes]
Additions:
$output = "<div class=\"lastedit\">Last edited by
Deletions:
$output = "<div class=\"lastedit\" style=\"border:dotted 1px; padding:3pt; margin:8pt; color:#888; font-size:8pt; width:30%;\">Last edited by


Revision [2446]

Edited on 2004-11-25 12:05:41 by DarTar [Added line to restrict output to 'show' method]
Additions:
{{lastedit show="3"}}


Revision [2445]

Edited on 2004-11-25 12:03:20 by DarTar [Added line to restrict output to show method]
Additions:
""{{lastedit show="0"}}"" //show user only//
""{{lastedit}}"" or ""{{lastedit show="1"}}"" //show user and notes// (default)
""{{lastedit show="2"}}"" //show user, notes, date//
""{{lastedit show="3"}}"" //show user, notes, date and quickdiff link//
if ($this->method == "show") {print $output;}
Deletions:
0 //show user only//
1 //show user and notes// (default)
2 //show user, notes, date//
3 //show user, notes, date and quickdiff link//
print $output;


Revision [2439]

Edited on 2004-11-25 01:26:50 by DarTar [Parameter values changed]
Additions:
if ($show == "") {$show="1";}
Deletions:
if (!$show) { $show="1";}


Revision [2438]

Edited on 2004-11-25 01:22:28 by DarTar [Parameter values changed]
Additions:
if (!$show) { $show="1";}
Deletions:
if (!$show) $show="1";


Revision [2437]

Edited on 2004-11-25 01:01:46 by DarTar [Parameter values changed]
Additions:
{{lastedit show="3"}}
0 //show user only//
{{lastedit show="0"}}
1 //show user and notes// (default)
{{lastedit show="1"}}
2 //show user, notes, date//
3 //show user, notes, date and quickdiff link//
{{lastedit show="3"}}
// 0 show user only
// 1 show user and notes
// 2 show user, notes, date
// 3 show user, notes, date and quickdiff link
if (!$show) $show="1";
if (!($show == 0)) {
$note = ($page["note"])? ": <br /><span class=\"notes\">".$page["note"]."</span>" : "";
if ($show == 2 || $show == 3) {
if ($show == 3) {
Deletions:
-1 //show user only//
0 //show user and notes//
1 //show user, notes, date//
2 //show user, notes, date and quickdiff link//
// -1 show user only
// 0 show user and notes
// 1 show user, notes, date
// 2 show user, notes, date and quickdiff link
if (!$show) $show="0";
if (!($show == -1)) {
$note = ($page["note"])? ": <span class=\"notes\">".$page["note"]."</span>" : "";
if ($show == 1 || $show == 2) {
if ($show == 2) {


Revision [2418]

Edited on 2004-11-24 14:42:54 by DarTar [Stupid action proposal]
Additions:
%%
----
CategoryDevelopment
Deletions:
%%


Revision [2417]

The oldest known version of this page was created on 2004-11-24 14:42:20 by DarTar [Stupid action proposal]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki