Wiki pages display in tab to the left of the edit pane tab. Home is always first in the list.

This commit is contained in:
Andrew Manning
2016-11-18 21:25:40 -05:00
parent f9b836027d
commit d5c14a513d
2 changed files with 9 additions and 6 deletions

View File

@@ -32,13 +32,16 @@ function wiki_page_list($resource_id) {
return array('pages' => null, 'wiki' => null);
}
$pages = array();
$pages[] = array('title' => 'Home', 'url' => 'Home');
if (is_dir($w['path']) === true) {
$files = array_diff(scandir($w['path']), array('.', '..', '.git'));
// TODO: Check that the files are all text files
foreach($files as $file) {
// strip the .md file extension and unwrap URL encoding to leave HTML encoded name
$pages[] = array('title' => urldecode(substr($file, 0, -3)), 'url' => urlencode(substr($file, 0, -3)));
if( urldecode(substr($file, 0, -3)) !== 'Home') {
$pages[] = array('title' => urldecode(substr($file, 0, -3)), 'url' => urlencode(substr($file, 0, -3)));
}
}
}