Sort entries in all pages alphabetically. Fixes #15

This commit is contained in:
Starbeamrainbowlabs 2015-07-15 17:11:32 +01:00
parent 3126322148
commit f6e3b9803d
3 changed files with 12 additions and 6 deletions

View File

@ -998,13 +998,16 @@ Size the image to at most 120px wide and have it float at the right ahnd size of
register_module([
"name" => "Page list",
"version" => "0.5",
"version" => "0.6",
"author" => "Starbeamrainbowlabs",
"description" => "Adds a page that lists all the pages in the index along with their metadata.",
"id" => "page-list",
"code" => function() {
add_action("list", function() {
global $pageindex, $settings;
$sorted_pageindex = get_object_vars($pageindex);
ksort($sorted_pageindex, SORT_NATURAL);
$title = "All Pages";
$content = " <h1>$title on $settings->sitename</h1>
<table>
@ -1015,7 +1018,7 @@ register_module([
<th>Last Edit Time</th>
</tr>\n";
// todo list the pages in alphabetical order
foreach($pageindex as $pagename => $pagedetails)
foreach($sorted_pageindex as $pagename => $pagedetails)
{
$content .= "\t\t<tr>
<td><a href='index.php?page=$pagename'>$pagename</a></td>

View File

@ -41,11 +41,11 @@
},
{
"name": "Page list",
"version": "0.5",
"version": "0.6",
"author": "Starbeamrainbowlabs",
"description": "Adds a page that lists all the pages in the index along with their metadata.",
"id": "page-list",
"lastupdate": 1436796812
"lastupdate": 1436976553
},
{
"name": "Login",

View File

@ -1,13 +1,16 @@
<?php
register_module([
"name" => "Page list",
"version" => "0.5",
"version" => "0.6",
"author" => "Starbeamrainbowlabs",
"description" => "Adds a page that lists all the pages in the index along with their metadata.",
"id" => "page-list",
"code" => function() {
add_action("list", function() {
global $pageindex, $settings;
$sorted_pageindex = get_object_vars($pageindex);
ksort($sorted_pageindex, SORT_NATURAL);
$title = "All Pages";
$content = " <h1>$title on $settings->sitename</h1>
<table>
@ -18,7 +21,7 @@ register_module([
<th>Last Edit Time</th>
</tr>\n";
// todo list the pages in alphabetical order
foreach($pageindex as $pagename => $pagedetails)
foreach($sorted_pageindex as $pagename => $pagedetails)
{
$content .= "\t\t<tr>
<td><a href='index.php?page=$pagename'>$pagename</a></td>