aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Wiki_pages.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2017-12-06 09:13:49 +0100
committerMario Vavti <mario@mariovavti.com>2017-12-06 09:13:49 +0100
commit5024fe3e2df65314a288c68fece97aa487c4ad2f (patch)
tree1b13ade0f452b2eb1b1d7f29ef67ca79f3e8102b /Zotlabs/Widget/Wiki_pages.php
parent157966eb115606ef1d25fc55e90cb25fec1b6333 (diff)
parent44cb68a3561e6079e6185c1000753896b89c5129 (diff)
downloadvolse-hubzilla-5024fe3e2df65314a288c68fece97aa487c4ad2f.tar.gz
volse-hubzilla-5024fe3e2df65314a288c68fece97aa487c4ad2f.tar.bz2
volse-hubzilla-5024fe3e2df65314a288c68fece97aa487c4ad2f.zip
Merge branch 'dentm42-wiki-create-missing' into dev
Diffstat (limited to 'Zotlabs/Widget/Wiki_pages.php')
-rw-r--r--Zotlabs/Widget/Wiki_pages.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/Zotlabs/Widget/Wiki_pages.php b/Zotlabs/Widget/Wiki_pages.php
index 39d4b1717..46f12f092 100644
--- a/Zotlabs/Widget/Wiki_pages.php
+++ b/Zotlabs/Widget/Wiki_pages.php
@@ -5,6 +5,42 @@ namespace Zotlabs\Widget;
class Wiki_pages {
+ function create_missing_page($arr) {
+ if(argc() < 4)
+ return;
+
+ $c = channelx_by_nick(argv(1));
+ $w = \Zotlabs\Lib\NativeWiki::exists_by_name($c['channel_id'],urldecode(argv(2)));
+ $arr = array(
+ 'resource_id' => $w['resource_id'],
+ 'channel_id' => $c['channel_id'],
+ 'channel_address' => $c['channel_address'],
+ 'refresh' => false
+ );
+
+ $can_create = perm_is_allowed(\App::$profile['uid'],get_observer_hash(),'write_wiki');
+
+ $can_delete = ((local_channel() && (local_channel() == \App::$profile['uid'])) ? true : false);
+ $pageName = urlencode(escape_tags(urldecode(argv(3))));
+
+ return replace_macros(get_markup_template('wiki_page_not_found.tpl'), array(
+ '$resource_id' => $arr['resource_id'],
+ '$channel_address' => $arr['channel_address'],
+ '$wikiname' => $wikiname,
+ '$canadd' => $can_create,
+ '$candel' => $can_delete,
+ '$addnew' => t('Add new page'),
+ '$typelock' => $typelock,
+ '$lockedtype' => $w['mimeType'],
+ '$mimetype' => mimetype_select(0,$w['mimeType'],
+ [ 'text/markdown' => t('Markdown'), 'text/bbcode' => t('BBcode'), 'text/plain' => t('Text') ]),
+ '$pageName' => array('missingPageName', 'Create Page' , $pageName),
+ '$refresh' => $arr['refresh'],
+ '$options' => t('Options'),
+ '$submit' => t('Submit')
+ ));
+ }
+
function widget($arr) {
if(argc() < 3)