fix various wikipage widget issues (sort pages by name, respect locked mime type setting, move create tool back to the bottom)
This commit is contained in:
parent
66fb0fdcd7
commit
4500faf463
@ -21,7 +21,7 @@ class NativeWikiPage {
|
|||||||
$sql_extra = item_permissions_sql($channel_id,$observer_hash);
|
$sql_extra = item_permissions_sql($channel_id,$observer_hash);
|
||||||
|
|
||||||
$r = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s' and uid = %d and item_deleted = 0
|
$r = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s' and uid = %d and item_deleted = 0
|
||||||
$sql_extra order by created asc",
|
$sql_extra order by title asc",
|
||||||
dbesc($resource_id),
|
dbesc($resource_id),
|
||||||
intval($channel_id)
|
intval($channel_id)
|
||||||
);
|
);
|
||||||
@ -74,6 +74,7 @@ class NativeWikiPage {
|
|||||||
$arr['uid'] = $channel_id;
|
$arr['uid'] = $channel_id;
|
||||||
$arr['author_xchan'] = $observer_hash;
|
$arr['author_xchan'] = $observer_hash;
|
||||||
$arr['mimetype'] = $mimetype;
|
$arr['mimetype'] = $mimetype;
|
||||||
|
$arr['title'] = $name;
|
||||||
$arr['resource_type'] = 'nwikipage';
|
$arr['resource_type'] = 'nwikipage';
|
||||||
$arr['resource_id'] = $resource_id;
|
$arr['resource_id'] = $resource_id;
|
||||||
$arr['allow_cid'] = $w['wiki']['allow_cid'];
|
$arr['allow_cid'] = $w['wiki']['allow_cid'];
|
||||||
@ -139,8 +140,14 @@ class NativeWikiPage {
|
|||||||
if($ic) {
|
if($ic) {
|
||||||
foreach($ic as $c) {
|
foreach($ic as $c) {
|
||||||
set_iconfig($c['item_id'],'nwikipage','pagetitle',$pageNewName);
|
set_iconfig($c['item_id'],'nwikipage','pagetitle',$pageNewName);
|
||||||
|
$ids[] = $c['item_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$str_ids = implode(',', $ids);
|
||||||
|
q("update item set title = '%s' where id in ($str_ids)",
|
||||||
|
dbesc($pageNewName)
|
||||||
|
);
|
||||||
|
|
||||||
$page = [
|
$page = [
|
||||||
'rawName' => $pageNewName,
|
'rawName' => $pageNewName,
|
||||||
'htmlName' => escape_tags($pageNewName),
|
'htmlName' => escape_tags($pageNewName),
|
||||||
|
@ -3,23 +3,6 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
<h3>{{$header}}</h3>
|
<h3>{{$header}}</h3>
|
||||||
<ul class="nav nav-pills flex-column">
|
<ul class="nav nav-pills flex-column">
|
||||||
{{if $canadd}}
|
|
||||||
<li class="nav-item"><a class="nav-link" href="#" onclick="wiki_show_new_page_form(); return false;"><i class="fa fa-plus-circle"></i> {{$addnew}}</a></li>
|
|
||||||
{{/if}}
|
|
||||||
{{if $canadd}}
|
|
||||||
<div id="new-page-form-wrapper" class="sub-menu" style="display:none;">
|
|
||||||
<form id="new-page-form" action="wiki/{{$channel_address}}/create/page" method="post" >
|
|
||||||
<input type="hidden" name="resource_id" value="{{$resource_id}}">
|
|
||||||
{{if $typelock}}
|
|
||||||
<input type="hidden" name="mimetype" value="{{$lockedtype}}">
|
|
||||||
{{else}}
|
|
||||||
{{$mimetype}}
|
|
||||||
{{/if}}
|
|
||||||
{{include file="field_input.tpl" field=$pageName}}
|
|
||||||
<button id="new-page-submit" class="btn btn-primary" type="submit" name="submit" >Submit</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{if $pages}}
|
{{if $pages}}
|
||||||
{{foreach $pages as $page}}
|
{{foreach $pages as $page}}
|
||||||
<li class="nav-item nav-item-hack" id="{{$page.link_id}}">
|
<li class="nav-item nav-item-hack" id="{{$page.link_id}}">
|
||||||
@ -30,6 +13,23 @@
|
|||||||
</li>
|
</li>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{if $canadd}}
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#" onclick="wiki_show_new_page_form(); return false;"><i class="fa fa-plus-circle"></i> {{$addnew}}</a></li>
|
||||||
|
{{/if}}
|
||||||
|
{{if $canadd}}
|
||||||
|
<div id="new-page-form-wrapper" class="sub-menu" style="display:none;">
|
||||||
|
<form id="new-page-form" action="wiki/{{$channel_address}}/create/page" method="post" >
|
||||||
|
<input type="hidden" name="resource_id" value="{{$resource_id}}">
|
||||||
|
{{if $typelock}}
|
||||||
|
<input id="id_mimetype" type="hidden" name="mimetype" value="{{$lockedtype}}">
|
||||||
|
{{else}}
|
||||||
|
{{$mimetype}}
|
||||||
|
{{/if}}
|
||||||
|
{{include file="field_input.tpl" field=$pageName}}
|
||||||
|
<button id="new-page-submit" class="btn btn-primary" type="submit" name="submit" >Submit</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
{{if ! $refresh}}
|
{{if ! $refresh}}
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user