aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Wiki_pages.php
diff options
context:
space:
mode:
authorgit-marijus <mario@mariovavti.com>2017-06-03 17:23:53 +0200
committergit-marijus <mario@mariovavti.com>2017-06-03 17:23:53 +0200
commit7562f77bdf7040d5cc63473a3c6ff7c499600f13 (patch)
tree5d427c64a09582af5f859d8629205130adf38bc8 /Zotlabs/Widget/Wiki_pages.php
parentc4ed04fc827ec5a1039959e260702141083836c8 (diff)
downloadvolse-hubzilla-7562f77bdf7040d5cc63473a3c6ff7c499600f13.tar.gz
volse-hubzilla-7562f77bdf7040d5cc63473a3c6ff7c499600f13.tar.bz2
volse-hubzilla-7562f77bdf7040d5cc63473a3c6ff7c499600f13.zip
rewrite wiki pages widget - no need for ajax on pageload, show the pages to not authenticated people.
Diffstat (limited to 'Zotlabs/Widget/Wiki_pages.php')
-rw-r--r--Zotlabs/Widget/Wiki_pages.php57
1 files changed, 28 insertions, 29 deletions
diff --git a/Zotlabs/Widget/Wiki_pages.php b/Zotlabs/Widget/Wiki_pages.php
index f992b3f93..53966b06f 100644
--- a/Zotlabs/Widget/Wiki_pages.php
+++ b/Zotlabs/Widget/Wiki_pages.php
@@ -7,58 +7,57 @@ class Wiki_pages {
function widget($arr) {
- $channelname = ((array_key_exists('channel',$arr)) ? $arr['channel'] : '');
- $c = channelx_by_nick($channelname);
+ if(argc() < 3)
+ return;
+
+ if(! $arr['resource_id']) {
- if(! $c)
$c = \App::get_channel();
- if(! $c)
- return '';
+ if(! $c)
+ $c = channelx_by_nick(argv(1));
- $wikiname = '';
- if(array_key_exists('refresh', $arr)) {
- $not_refresh = (($arr['refresh']=== true) ? false : true);
- }
- else {
- $not_refresh = true;
+ $w = \Zotlabs\Lib\NativeWiki::exists_by_name($c['channel_id'],argv(2));
+
+ $arr = array(
+ 'resource_id' => $w['resource_id'],
+ 'channel_id' => $c['channel_id'],
+ 'channel_address' => $c['channel_address'],
+ 'refresh' => false
+ );
}
+ $wikiname = '';
+
$pages = array();
- if(! array_key_exists('resource_id', $arr)) {
- $hide = true;
- }
- else {
- $p = \Zotlabs\Lib\NativeWikiPage::page_list($c['channel_id'],get_observer_hash(),$arr['resource_id']);
-
- if($p['pages']) {
- $pages = $p['pages'];
- $w = $p['wiki'];
- // Wiki item record is $w['wiki']
- $wikiname = $w['urlName'];
- if (!$wikiname) {
- $wikiname = '';
- }
+
+ $p = \Zotlabs\Lib\NativeWikiPage::page_list($arr['channel_id'],get_observer_hash(),$arr['resource_id']);
+
+ if($p['pages']) {
+ $pages = $p['pages'];
+ $w = $p['wiki'];
+ // Wiki item record is $w['wiki']
+ $wikiname = $w['urlName'];
+ if (!$wikiname) {
+ $wikiname = '';
}
}
-
$can_create = perm_is_allowed(\App::$profile['uid'],get_observer_hash(),'write_wiki');
$can_delete = ((local_channel() && (local_channel() == \App::$profile['uid'])) ? true : false);
return replace_macros(get_markup_template('wiki_page_list.tpl'), array(
- '$hide' => $hide,
'$resource_id' => $arr['resource_id'],
- '$not_refresh' => $not_refresh,
'$header' => t('Wiki Pages'),
- '$channel' => $channelname,
+ '$channel_address' => $arr['channel_address'],
'$wikiname' => $wikiname,
'$pages' => $pages,
'$canadd' => $can_create,
'$candel' => $can_delete,
'$addnew' => t('Add new page'),
'$pageName' => array('pageName', t('Page name')),
+ '$refresh' => $arr['refresh']
));
}
}