diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index edcd6ec58..c4fa63673 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -128,7 +128,7 @@ class Wiki extends \Zotlabs\Web\Controller {
require_once('library/markdown.php');
$content = t('"# Wiki Sandbox\n\nContent you **edit** and **preview** here *will not be saved*."');
$renderedContent = Markdown(json_decode($content));
- $hide_editor = false;
+ $hide_editor = true;
$showPageControls = false;
$showNewWikiButton = $wiki_owner;
$showNewPageButton = false;
@@ -209,8 +209,10 @@ class Wiki extends \Zotlabs\Web\Controller {
$o .= replace_macros(get_markup_template('wiki.tpl'),array(
'$wikiheaderName' => $wikiheaderName,
'$wikiheaderPage' => $wikiheaderPage,
- '$hideEditor' => $hide_editor,
+ '$hideEditor' => $hide_editor, // True will completely hide the content section and is used for the case of no wiki selected
+ '$chooseWikiMessage' => t('Choose an available wiki from the list on the left.'),
'$showPageControls' => $showPageControls,
+ '$editOrSourceLabel' => (($showPageControls) ? t('Edit') : t('Source')),
'$tools_label' => 'Wiki Tools',
'$showNewWikiButton'=> $showNewWikiButton,
'$showNewPageButton'=> $showNewPageButton,
diff --git a/include/widgets.php b/include/widgets.php
index c0cc15e34..1441fbeb3 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -1017,6 +1017,7 @@ function widget_wiki_pages($arr) {
'$pages' => $pages,
'$canadd' => $can_create,
'$addnew' => t('Add new page'),
+ '$pageName' => array('pageName', t('Enter the name of the new page:'), '', ''),
));
}
diff --git a/include/wiki.php b/include/wiki.php
index bcdf9d7d8..d2cb51bd3 100644
--- a/include/wiki.php
+++ b/include/wiki.php
@@ -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)));
+ }
}
}
diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl
index 4eefb3189..cf076c244 100644
--- a/view/tpl/wiki.tpl
+++ b/view/tpl/wiki.tpl
@@ -11,7 +11,12 @@
transition: opacity 0.5s 0.5s ease;
}
-
+{{if $hideEditor}}
+
+
{{$chooseWikiMessage}}
+
+{{/if}}
+
@@ -40,21 +45,13 @@
-
:
+
 : 
+
+
-
+
-
+
+ {{if $showCommitMsg}}
+ {{if $showPageControls}}
+
+ {{/if}}
+ {{/if}}
- {{if $showCommitMsg}}
- {{if $showPageControls}}
-
- {{/if}}
- {{/if}}
{{$wikiModal}}
@@ -192,7 +192,9 @@
editor.getSession().setValue(window.wiki_page_content);
window.editor = editor; // Store the editor in the window object so the anonymous function can use it.
-
+ {{if !$showPageControls}}
+ editor.setReadOnly(true); // Disable editing if the viewer lacks edit permission
+ {{/if}}
$('#edit-pane-tab').click(function (ev) {
setTimeout(function() {window.editor.focus();}, 500); // Return the focus to the editor allowing immediate text entry
});
@@ -241,23 +243,6 @@
window.location = "wiki/{{$channel}}/download/wiki/" + resource_id;
}
- $('#new-page-submit').click(function (ev) {
- if (window.wiki_resource_id === '') {
- window.console.log('You must have a wiki open in order to create pages.');
- ev.preventDefault();
- return false;
- }
- $.post("wiki/{{$channel}}/create/page", {name: $('#id_pageName').val(), resource_id: window.wiki_resource_id},
- function (data) {
- if (data.success) {
- window.location = data.url;
- } else {
- window.console.log('Error creating page.');
- }
- }, 'json');
- ev.preventDefault();
- });
-
function wiki_refresh_page_list() {
if (window.wiki_resource_id === '') {
return false;
@@ -482,6 +467,7 @@
};
function wiki_show_new_wiki_form() {
+ $('div[id^=\'edit-wiki-form-wrapper\']').hide();
$('#new-page-form-wrapper').hide();
$('#edit-wiki-form-wrapper').hide();
$('#new-wiki-form-wrapper').toggle();
@@ -489,6 +475,7 @@
}
function wiki_show_new_page_form() {
+ $('div[id^=\'edit-wiki-form-wrapper\']').hide();
$('#edit-wiki-form-wrapper').hide();
$('#new-wiki-form-wrapper').hide();
$('#new-page-form-wrapper').toggle();
@@ -498,6 +485,7 @@
function wiki_show_edit_wiki_form(wiki_title, wiki_resource_id) {
window.wiki_resource_id = wiki_resource_id;
window.wiki_title = wiki_title;
+ $('div[id^=\'edit-wiki-form-wrapper\']').hide();
$('#new-page-form-wrapper').hide();
$('#new-wiki-form-wrapper').hide();
$('#edit-wiki-form-wrapper').toggle();
@@ -514,5 +502,6 @@
{{else}}
$('#new-wiki-button').hide();
{{/if}}
+
});
diff --git a/view/tpl/wiki_page_list.tpl b/view/tpl/wiki_page_list.tpl
index c020f2520..c0eeecff8 100644
--- a/view/tpl/wiki_page_list.tpl
+++ b/view/tpl/wiki_page_list.tpl
@@ -10,5 +10,38 @@
{{/if}}
{{if $canadd}}
{{$addnew}}{{/if}}
+ {{if $canadd}}
+
+ {{/if}}
{{if $not_refresh}}{{/if}}
+
+
\ No newline at end of file
diff --git a/view/tpl/wikilist.tpl b/view/tpl/wikilist.tpl
index b8da88ec4..51eccad90 100644
--- a/view/tpl/wikilist.tpl
+++ b/view/tpl/wikilist.tpl
@@ -21,7 +21,7 @@
{{/foreach}}
{{/if}}
{{if $owner}}
- {{$addnew}}
+ {{$addnew}}
{{/if}}
{{if $owner}}