wiki: permissions issues, untranslated strings in templates and some minor changes to provide a consistent UI with the rest of the app.

This commit is contained in:
zotlabs 2016-11-15 00:50:31 -08:00
parent e990a35a91
commit e0a702df76
4 changed files with 29 additions and 17 deletions

View File

@ -917,7 +917,11 @@ function widget_wiki_list($arr) {
'$channel' => $channel['channel_address'],
'$wikis' => $wikis['wikis'],
// If the observer is the local channel owner, show the wiki controls
'$owner' => ((local_channel() === intval($channel['channel_id'])) ? true : false)
'$owner' => ((local_channel() && local_channel() === intval(\App::$profile['uid'])) ? true : false),
'$edit' => t('Edit'),
'$download' => t('Download'),
'$view' => t('View'),
'$addnew' => t('Add new wiki')
));
}
return '';
@ -948,13 +952,17 @@ function widget_wiki_pages($arr) {
}
}
}
$can_create = perm_is_allowed(\App::$profile['uid'],get_observer_hash(),'write_pages');
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
'$pages' => $pages,
'$canadd' => $can_create,
'$addnew' => t('Add new page'),
));
}

View File

@ -151,3 +151,7 @@ li:hover .group-edit-icon {
.cover-photo-subtitle {
font-size: 20px;
}
a.wikilist {
z-index: 1;
}

View File

@ -1,12 +1,14 @@
{{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}}
<i id="new-page-button" class="pull-right generic-icons fakelink fa fa-plus" title="New page" onclick="wiki_show_new_page_form();"></i>
</h3>
<h3>{{$header}}</h3>
<ul class="nav nav-pills nav-stacked">
{{if $pages}}
{{foreach $pages as $page}}
<li><a href="/wiki/{{$channel}}/{{$wikiname}}/{{$page.url}}">{{$page.title}}</a></li>
{{/foreach}}
{{/if}}
{{if $canadd}}<li><a href="#" onclick="wiki_show_new_page_form(); return false;"><i class="fa fa-plus-circle"></i>&nbsp;{{$addnew}}</a></li>{{/if}}
</ul>
</div>
{{if $not_refresh}}</div>{{/if}}

View File

@ -1,17 +1,15 @@
<div id="wiki_list" class="widget">
<h3>{{$header}}
<i id="new-wiki-button" class="pull-right generic-icons fakelink fa fa-plus" title="New wiki" onclick="wiki_show_new_wiki_form();"></i>
</h3>
<div>
<h3>{{$header}}</h3>
<ul class="nav nav-pills nav-stacked">
{{if $wikis}}
{{foreach $wikis as $wiki}}
<div class="form-group" id="wiki-{{$wiki.resource_id}}">
<a href="/wiki/{{$channel}}/{{$wiki.urlName}}/Home" title="View {{$wiki.title}}"><b>{{$wiki.title}}</b></a>
<i id="edit-wiki-button" class="pull-right generic-icons fakelink fa fa-edit" onclick="wiki_show_edit_wiki_form('{{$wiki.title}}', '{{$wiki.resource_id}}');" title="Edit {{$wiki.title}}"></i>
<i class="pull-right generic-icons fakelink fa fa-download" onclick="wiki_download_wiki('{{$wiki.resource_id}}'); return false;" title="Download {{$wiki.title}}"></i>
</div>
<li>{{if $owner}}<a href="#" onclick="wiki_show_edit_wiki_form('{{$wiki.title}}', '{{$wiki.resource_id}}'); return false;" class="pull-right wikilist" title="{{$edit}}"><i id="edit-wiki-button" class="fa fa-edit"></i></a>{{/if}}
<a href="#" onclick="wiki_download_wiki('{{$wiki.resource_id}}'); return false;" title="{{$download}}" class="pull-right wikilist"><i class="fa fa-download"></i></a>
<a href="/wiki/{{$channel}}/{{$wiki.urlName}}/Home" title="{{$view}}">{{$wiki.title}}</a>
</li>
{{/foreach}}
</div>
{{/if}}
{{if $owner}}<li><a href="#" class="fakelink" onclick="wiki_show_new_wiki_form(); return false;"><i id="new-wiki-button" class="fa fa-plus-circle"></i>&nbsp;{{$addnew}}</a></li>{{/if}}
</ul>
</div>