Only show wiki delete control if channel owner
This commit is contained in:
parent
fad27fc1e7
commit
00d32f6b94
@ -78,6 +78,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
if(argc()<3) {
|
if(argc()<3) {
|
||||||
// GET /wiki/channel
|
// GET /wiki/channel
|
||||||
|
$channel = get_channel_by_nick(argv(1));
|
||||||
$wikiheader = t('Wiki Sandbox');
|
$wikiheader = t('Wiki Sandbox');
|
||||||
$content = '"# Wiki Sandbox\n\nContent you **edit** and **preview** here *will not be saved*."';
|
$content = '"# Wiki Sandbox\n\nContent you **edit** and **preview** here *will not be saved*."';
|
||||||
$hide_editor = false;
|
$hide_editor = false;
|
||||||
|
@ -859,17 +859,23 @@ function widget_wiki_list($arr) {
|
|||||||
require_once("include/wiki.php");
|
require_once("include/wiki.php");
|
||||||
if (argc() > 1) {
|
if (argc() > 1) {
|
||||||
$nick = argv(1);
|
$nick = argv(1);
|
||||||
|
$channel = get_channel_by_nick($nick);
|
||||||
} else {
|
} else {
|
||||||
$channel = \App::get_channel();
|
$channel = \App::get_channel();
|
||||||
$nick = $channel['channel_address'];
|
$nick = $channel['channel_address'];
|
||||||
}
|
}
|
||||||
$wikis = wiki_list($nick, get_observer_hash());
|
$wikis = wiki_list($channel, get_observer_hash());
|
||||||
|
if (local_channel() === intval($channel['channel_id'])) {
|
||||||
|
$showControls = true;
|
||||||
|
} else {
|
||||||
|
$showControls = false;
|
||||||
|
}
|
||||||
if ($wikis) {
|
if ($wikis) {
|
||||||
return replace_macros(get_markup_template('wikilist.tpl'), array(
|
return replace_macros(get_markup_template('wikilist.tpl'), array(
|
||||||
'$header' => t('Wiki List'),
|
'$header' => t('Wiki List'),
|
||||||
'$channel' => $nick,
|
'$channel' => $nick,
|
||||||
'$wikis' => $wikis['wikis']
|
'$wikis' => $wikis['wikis'],
|
||||||
|
'$showControls' => $showControls
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
use \Zotlabs\Storage\GitRepo as GitRepo;
|
use \Zotlabs\Storage\GitRepo as GitRepo;
|
||||||
define ( 'WIKI_ITEM_RESOURCE_TYPE', 'wiki' );
|
define ( 'WIKI_ITEM_RESOURCE_TYPE', 'wiki' );
|
||||||
|
|
||||||
function wiki_list($nick, $observer_hash) {
|
function wiki_list($channel, $observer_hash) {
|
||||||
if (local_channel() || remote_channel()) {
|
if (local_channel() || remote_channel()) {
|
||||||
$sql_extra = item_permissions_sql(get_channel_by_nick($nick)['channel_id'], $observer_hash);
|
$sql_extra = item_permissions_sql($channel['channel_id'], $observer_hash);
|
||||||
} else {
|
} else {
|
||||||
$sql_extra = " AND item_private = 0 ";
|
$sql_extra = " AND item_private = 0 ";
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,10 @@
|
|||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu pull-right">
|
<ul class="dropdown-menu pull-right">
|
||||||
<li><a href="/wiki/{{$channel}}/{{$wiki.title}}/Home.md" title="View {{$wiki.title}}">View</a></li>
|
<li><a href="/wiki/{{$channel}}/{{$wiki.title}}/Home.md" title="View {{$wiki.title}}">View</a></li>
|
||||||
|
{{if $showControls}}
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li><a href="#" onclick="wiki_delete_wiki('{{$wiki.title}}','{{$wiki.resource_id}}'); return false;" title="Delete {{$wiki.title}}">Delete wiki</a></li>
|
<li><a href="#" onclick="wiki_delete_wiki('{{$wiki.title}}','{{$wiki.resource_id}}'); return false;" title="Delete {{$wiki.title}}">Delete wiki</a></li>
|
||||||
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
Reference in New Issue
Block a user