aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-05-28 07:42:18 -0400
committerAndrew Manning <tamanning@zoho.com>2016-05-28 07:42:18 -0400
commitae94e8a855d31125b96e158c0fb8c0d6f22631d6 (patch)
tree0bb82a3d3c885356dae690fc991b17a758fc96e6
parentf884fa66782544cd6fc44a81b978a905d4755cea (diff)
downloadvolse-hubzilla-ae94e8a855d31125b96e158c0fb8c0d6f22631d6.tar.gz
volse-hubzilla-ae94e8a855d31125b96e158c0fb8c0d6f22631d6.tar.bz2
volse-hubzilla-ae94e8a855d31125b96e158c0fb8c0d6f22631d6.zip
Wiki page list links work. File content is not yet loaded into the editor. Removed some logger calls.
-rw-r--r--Zotlabs/Module/Wiki.php10
-rw-r--r--include/widgets.php16
-rw-r--r--view/tpl/wiki.tpl4
-rw-r--r--view/tpl/wiki_page_list.tpl7
4 files changed, 25 insertions, 12 deletions
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index 9d905f561..54511fc91 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -55,7 +55,6 @@ class Wiki extends \Zotlabs\Web\Controller {
// Check if wiki exists andr redirect if it does not
$channel = get_channel_by_nick(argv(1));
$w = wiki_exists_by_name($channel['channel_id'], argv(2));
- logger('wiki_Exists: ' . json_encode($w));
if(!$w['id']) {
goaway('/'.argv(0).'/'.argv(1));
} else {
@@ -95,8 +94,6 @@ class Wiki extends \Zotlabs\Web\Controller {
// Render mardown-formatted text in HTML
if((argc() > 2) && (argv(2) === 'preview')) {
$content = $_POST['content'];
- logger('preview content: ' . $content);
- //require_once('library/parsedown/Parsedown.php');
$parsedown = new Parsedown();
$html = $parsedown->text($content);
json_return_and_die(array('html' => $html, 'success' => true));
@@ -133,9 +130,7 @@ class Wiki extends \Zotlabs\Web\Controller {
}
// Get ACL for permissions
$acl = new \Zotlabs\Access\AccessList($channel);
- logger('POST: ' . json_encode($_POST));
$acl->set_from_array($_POST);
- logger('acl: ' . json_encode($acl));
$r = wiki_create_wiki($channel, $observer_hash, $name, $acl);
if ($r['success']) {
goaway('/wiki/'.$which.'/'.$name);
@@ -220,7 +215,10 @@ class Wiki extends \Zotlabs\Web\Controller {
logger('Wiki read permission denied.' . EOL);
json_return_and_die(array('pages' => null, 'message' => 'Permission denied.', 'success' => false));
}
- $page_list_html = widget_wiki_pages(array('resource_id' => $resource_id));
+ $page_list_html = widget_wiki_pages(array(
+ 'resource_id' => $resource_id,
+ 'refresh' => true,
+ 'channel' => argv(1)));
json_return_and_die(array('pages' => $page_list_html, 'message' => '', 'success' => true));
}
diff --git a/include/widgets.php b/include/widgets.php
index 0d734d6cf..539d227aa 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -877,7 +877,13 @@ function widget_wiki_list($arr) {
function widget_wiki_pages($arr) {
require_once("include/wiki.php");
-
+ $channelname = ((array_key_exists('channel',$arr)) ? $arr['channel'] : '');
+ $wikiname = '';
+ if (array_key_exists('refresh', $arr)) {
+ $not_refresh = (($arr['refresh']=== true) ? false : true);
+ } else {
+ $not_refresh = true;
+ }
$pages = array();
if (!array_key_exists('resource_id', $arr)) {
$hide = true;
@@ -885,11 +891,19 @@ function widget_wiki_pages($arr) {
$p = wiki_page_list($arr['resource_id']);
if ($p['pages']) {
$pages = $p['pages'];
+ $w = wiki_get_wiki($arr['resource_id']);
+ $wikiname = $w['wiki']['title'];
+ if (!$wikiname) {
+ $wikiname = '';
+ }
}
}
return replace_macros(get_markup_template('wiki_page_list.tpl'), array(
'$hide' => $hide,
+ '$not_refresh' => $not_refresh,
'$header' => t('Wiki Pages'),
+ '$channel' => $channelname,
+ '$wikiname' => $wikiname,
'$pages' => $pages
));
}
diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl
index 27887cc1c..a18831aa5 100644
--- a/view/tpl/wiki.tpl
+++ b/view/tpl/wiki.tpl
@@ -139,8 +139,8 @@ function wiki_delete_wiki(wikiName, resource_id) {
}
$.post("wiki/{{$channel}}/get/page/list/", {resource_id: window.wiki_resource_id}, function (data) {
if (data.success) {
- $('#wiki_page_list').html(data.pages);
- $('#wiki_page_list').show();
+ $('#wiki_page_list_container').html(data.pages);
+ $('#wiki_page_list_container').show();
} else {
alert('Error fetching page list!');
window.console.log('Error fetching page list!');
diff --git a/view/tpl/wiki_page_list.tpl b/view/tpl/wiki_page_list.tpl
index 0ced893c3..c941e4a08 100644
--- a/view/tpl/wiki_page_list.tpl
+++ b/view/tpl/wiki_page_list.tpl
@@ -1,9 +1,10 @@
-<div id="wiki_page_list" class="widget" {{if $hide}} style="display: none;" {{/if}}>
+{{if $not_refresh}}<div id="wiki_page_list_container" {{if $hide}} style="display: none;" {{/if}}>{{/if}}
+<div id="wiki_page_list" class="widget" >
<h3>{{$header}}</h3>
<ul class="nav nav-pills nav-stacked">
{{foreach $pages as $page}}
- <li><a href="">{{$page}}</a></li>
+ <li><a href="/wiki/{{$channel}}/{{$wikiname}}/{{$page}}">{{$page}}</a></li>
{{/foreach}}
</ul>
</div>
-
+{{if $not_refresh}}</div>{{/if}}