1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 04:23:01 +00:00

Improved recent changes links a bit.

This commit is contained in:
Starbeamrainbowlabs 2016-11-02 17:51:00 +00:00
parent e5d56badf3
commit b7f85b774e
4 changed files with 34 additions and 5 deletions

View file

@ -11,6 +11,7 @@
- Overhauled internal history logic - history logic is now done in core. - Overhauled internal history logic - history logic is now done in core.
- Added `$env->page_filename`, which points to the current page on disk. - Added `$env->page_filename`, which points to the current page on disk.
- Changed the way different display modes are accessed. You can now use the new `mode` parameter to the `view` action. It supports 4 different modes at present: `normal`, `printable`, `contentonly`, and `parsedsourceonly`. - Changed the way different display modes are accessed. You can now use the new `mode` parameter to the `view` action. It supports 4 different modes at present: `normal`, `printable`, `contentonly`, and `parsedsourceonly`.
- Improved recent changes links a bit.
## Fixed ## Fixed
- The login session lifetime is now configurable (defaults to 24 hours), so you won't keep getting logged out all the time (in theory). (#113) - The login session lifetime is now configurable (defaults to 24 hours), so you won't keep getting logged out all the time (in theory). (#113)

View file

@ -2221,7 +2221,7 @@ function render_recent_changes($recent_changes)
$userDisplayHtml = render_editor(implode(", ", $users)); $userDisplayHtml = render_editor(implode(", ", $users));
// TODO: Collect up and render a list of participating users // TODO: Collect up and render a list of participating users
$next_entry = "<li><details><summary>$pageDisplayHtml $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>"; $next_entry = "<li><details><summary><a href='?page=" . rawurlencode($rchange_first->page) . "'>$pageDisplayHtml</a> $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>";
$content .= "$next_entry\n"; $content .= "$next_entry\n";
} }
@ -2239,10 +2239,24 @@ function render_recent_changes($recent_changes)
function render_recent_change($rchange) function render_recent_change($rchange)
{ {
global $pageindex;
$pageDisplayHtml = render_pagename($rchange); $pageDisplayHtml = render_pagename($rchange);
$editorDisplayHtml = render_editor($rchange->user); $editorDisplayHtml = render_editor($rchange->user);
$timeDisplayHtml = render_timestamp($rchange->timestamp); $timeDisplayHtml = render_timestamp($rchange->timestamp);
$revisionId = false;
if(isset($pageindex->{$rchange->page}))
{
foreach($pageindex->{$rchange->page}->history as $historyEntry)
{
if($historyEntry->timestamp == $rchange->timestamp)
{
$revisionId = $historyEntry->rid;
break;
}
}
}
$result = ""; $result = "";
$resultClasses = []; $resultClasses = [];
switch(isset($rchange->type) ? $rchange->type : "edit") switch(isset($rchange->type) ? $rchange->type : "edit")
@ -2260,7 +2274,7 @@ function render_recent_change($rchange)
if(!empty($rchange->newpage)) if(!empty($rchange->newpage))
$resultClasses[] = "newpage"; $resultClasses[] = "newpage";
$result .= "<a href='?page=$rchange->page'>$pageDisplayHtml</a> $editorDisplayHtml $timeDisplayHtml <span class='$size_display_class' title='$size_title_display'>($size_display)</span>"; $result .= "<a href='?page=" . rawurlencode($rchange->page) . ($revisionId !== false ? "&revision=$revisionId" : "") . "'>$pageDisplayHtml</a> $editorDisplayHtml $timeDisplayHtml <span class='$size_display_class' title='$size_title_display'>($size_display)</span>";
break; break;
case "deletion": case "deletion":

View file

@ -59,7 +59,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Adds recent changes. Access through the 'recent-changes' action.", "description": "Adds recent changes. Access through the 'recent-changes' action.",
"id": "feature-recent-changes", "id": "feature-recent-changes",
"lastupdate": 1476906745, "lastupdate": 1478108942,
"optional": false "optional": false
}, },
{ {

View file

@ -175,7 +175,7 @@ function render_recent_changes($recent_changes)
$userDisplayHtml = render_editor(implode(", ", $users)); $userDisplayHtml = render_editor(implode(", ", $users));
// TODO: Collect up and render a list of participating users // TODO: Collect up and render a list of participating users
$next_entry = "<li><details><summary>$pageDisplayHtml $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>"; $next_entry = "<li><details><summary><a href='?page=" . rawurlencode($rchange_first->page) . "'>$pageDisplayHtml</a> $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>";
$content .= "$next_entry\n"; $content .= "$next_entry\n";
} }
@ -193,10 +193,24 @@ function render_recent_changes($recent_changes)
function render_recent_change($rchange) function render_recent_change($rchange)
{ {
global $pageindex;
$pageDisplayHtml = render_pagename($rchange); $pageDisplayHtml = render_pagename($rchange);
$editorDisplayHtml = render_editor($rchange->user); $editorDisplayHtml = render_editor($rchange->user);
$timeDisplayHtml = render_timestamp($rchange->timestamp); $timeDisplayHtml = render_timestamp($rchange->timestamp);
$revisionId = false;
if(isset($pageindex->{$rchange->page}))
{
foreach($pageindex->{$rchange->page}->history as $historyEntry)
{
if($historyEntry->timestamp == $rchange->timestamp)
{
$revisionId = $historyEntry->rid;
break;
}
}
}
$result = ""; $result = "";
$resultClasses = []; $resultClasses = [];
switch(isset($rchange->type) ? $rchange->type : "edit") switch(isset($rchange->type) ? $rchange->type : "edit")
@ -214,7 +228,7 @@ function render_recent_change($rchange)
if(!empty($rchange->newpage)) if(!empty($rchange->newpage))
$resultClasses[] = "newpage"; $resultClasses[] = "newpage";
$result .= "<a href='?page=$rchange->page'>$pageDisplayHtml</a> $editorDisplayHtml $timeDisplayHtml <span class='$size_display_class' title='$size_title_display'>($size_display)</span>"; $result .= "<a href='?page=" . rawurlencode($rchange->page) . ($revisionId !== false ? "&revision=$revisionId" : "") . "'>$pageDisplayHtml</a> $editorDisplayHtml $timeDisplayHtml <span class='$size_display_class' title='$size_title_display'>($size_display)</span>";
break; break;
case "deletion": case "deletion":