1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-12-22 13:45:02 +00:00

Add page moves to the recent changes page - fixes #151

This commit is contained in:
Starbeamrainbowlabs 2018-03-18 21:38:58 +00:00
parent 104d267bed
commit bd1cad3007
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
6 changed files with 43 additions and 4 deletions

View file

@ -7,6 +7,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- [Rest API] Added support for the `mode` parameter to the `random` action.
- Fixed various issues with both the module api & the rest api docs.
- Add json support to the search action :D
- Added page moves to the recent changes page (#151).
### Fixed
- Properly escaped content of short code box on file pages

View file

@ -352,6 +352,7 @@ summary { cursor: pointer; }
.diff-removed { background-color: rgba(255, 96, 96, 0.6); color: rgba(191, 38, 38, 1); }
.newpage::before { content: "N"; margin: 0 0.3em 0 -1em; font-weight: bolder; text-decoration: underline dotted; }
.move::before { content: "\\1f69a"; font-size: 1.25em; margin: 0 0.1em 0 -1.1em; }
.upload::before { content: "\\1f845"; margin: 0 0.1em 0 -1.1em; }
.new-comment::before { content: "\\1f4ac"; margin: 0 0.1em 0 -1.1em; }
@ -3538,12 +3539,17 @@ function render_recent_change($rchange)
$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;
case "deletion":
$resultClasses[] = "deletion";
$result .= "$pageDisplayHtml $editorDisplayHtml $timeDisplayHtml";
break;
case "move":
$resultClasses[] = "move";
$result .= "$rchange->oldpage &#11106; <a href='?page=" . rawurlencode($rchange->page) . "'>$pageDisplayHtml</a> $editorDisplayHtml $timeDisplayHtml";
break;
case "upload":
$resultClasses[] = "upload";
$result .= "<a href='?page=$rchange->page'>$pageDisplayHtml</a> $editorDisplayHtml $timeDisplayHtml (" . human_filesize($rchange->filesize) . ")";
@ -7472,6 +7478,19 @@ register_module([
);
}
// Add a recent change announcing the move if the recent changes
// module is installed
if(module_exists("feature-recent-changes"))
{
add_recent_change([
"type" => "move",
"timestamp" => time(),
"oldpage" => $page,
"page" => $new_name,
"user" => $env->user
]);
}
// Exit with a nice message
exit(page_renderer::render_main("Moving " . htmlentities($env->page), "<p><a href='index.php?page=" . rawurlencode($env->page) . "'>" . htmlentities($env->page) . "</a> has been moved to <a href='index.php?page=" . rawurlencode($new_name) . "'>" . htmlentities($new_name) . "</a> successfully.</p>"));
});

View file

@ -86,7 +86,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds recent changes. Access through the 'recent-changes' action.",
"id": "feature-recent-changes",
"lastupdate": 1505512941,
"lastupdate": 1521408644,
"optional": false
},
{
@ -221,7 +221,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds an action to allow administrators to move pages.",
"id": "page-move",
"lastupdate": 1511449784,
"lastupdate": 1521408303,
"optional": false
},
{

View file

@ -244,12 +244,17 @@ function render_recent_change($rchange)
$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;
case "deletion":
$resultClasses[] = "deletion";
$result .= "$pageDisplayHtml $editorDisplayHtml $timeDisplayHtml";
break;
case "move":
$resultClasses[] = "move";
$result .= "$rchange->oldpage &#11106; <a href='?page=" . rawurlencode($rchange->page) . "'>$pageDisplayHtml</a> $editorDisplayHtml $timeDisplayHtml";
break;
case "upload":
$resultClasses[] = "upload";
$result .= "<a href='?page=$rchange->page'>$pageDisplayHtml</a> $editorDisplayHtml $timeDisplayHtml (" . human_filesize($rchange->filesize) . ")";

View file

@ -127,6 +127,19 @@ register_module([
);
}
// Add a recent change announcing the move if the recent changes
// module is installed
if(module_exists("feature-recent-changes"))
{
add_recent_change([
"type" => "move",
"timestamp" => time(),
"oldpage" => $page,
"page" => $new_name,
"user" => $env->user
]);
}
// Exit with a nice message
exit(page_renderer::render_main("Moving " . htmlentities($env->page), "<p><a href='index.php?page=" . rawurlencode($env->page) . "'>" . htmlentities($env->page) . "</a> has been moved to <a href='index.php?page=" . rawurlencode($new_name) . "'>" . htmlentities($new_name) . "</a> successfully.</p>"));
});

View file

@ -123,6 +123,7 @@ summary { cursor: pointer; }
.diff-removed { background-color: rgba(255, 96, 96, 0.6); color: rgba(191, 38, 38, 1); }
.newpage::before { content: "N"; margin: 0 0.3em 0 -1em; font-weight: bolder; text-decoration: underline dotted; }
.move::before { content: "\\1f69a"; font-size: 1.25em; margin: 0 0.1em 0 -1.1em; }
.upload::before { content: "\\1f845"; margin: 0 0.1em 0 -1.1em; }
.new-comment::before { content: "\\1f4ac"; margin: 0 0.1em 0 -1.1em; }