aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2017-09-19 18:59:06 +0200
committerMario <mario@mariovavti.com>2017-09-19 18:59:06 +0200
commit4500faf463e7fd6fcf9948666421c941a1292df9 (patch)
tree6ce7fcce4ead9110c67eecd08be652b07350ccb5
parent66fb0fdcd77f46c614f8149e71ca0d4fb1757d0a (diff)
downloadvolse-hubzilla-4500faf463e7fd6fcf9948666421c941a1292df9.tar.gz
volse-hubzilla-4500faf463e7fd6fcf9948666421c941a1292df9.tar.bz2
volse-hubzilla-4500faf463e7fd6fcf9948666421c941a1292df9.zip
fix various wikipage widget issues (sort pages by name, respect locked mime type setting, move create tool back to the bottom)
-rw-r--r--Zotlabs/Lib/NativeWikiPage.php9
-rw-r--r--view/tpl/wiki_page_list.tpl22
2 files changed, 19 insertions, 12 deletions
diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php
index 4b637781e..209a5ef3c 100644
--- a/Zotlabs/Lib/NativeWikiPage.php
+++ b/Zotlabs/Lib/NativeWikiPage.php
@@ -21,7 +21,7 @@ class NativeWikiPage {
$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
- $sql_extra order by created asc",
+ $sql_extra order by title asc",
dbesc($resource_id),
intval($channel_id)
);
@@ -74,6 +74,7 @@ class NativeWikiPage {
$arr['uid'] = $channel_id;
$arr['author_xchan'] = $observer_hash;
$arr['mimetype'] = $mimetype;
+ $arr['title'] = $name;
$arr['resource_type'] = 'nwikipage';
$arr['resource_id'] = $resource_id;
$arr['allow_cid'] = $w['wiki']['allow_cid'];
@@ -139,8 +140,14 @@ class NativeWikiPage {
if($ic) {
foreach($ic as $c) {
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 = [
'rawName' => $pageNewName,
'htmlName' => escape_tags($pageNewName),
diff --git a/view/tpl/wiki_page_list.tpl b/view/tpl/wiki_page_list.tpl
index bf5f6697d..a7e6ebdaf 100644
--- a/view/tpl/wiki_page_list.tpl
+++ b/view/tpl/wiki_page_list.tpl
@@ -3,6 +3,16 @@
{{/if}}
<h3>{{$header}}</h3>
<ul class="nav nav-pills flex-column">
+ {{if $pages}}
+ {{foreach $pages as $page}}
+ <li class="nav-item nav-item-hack" id="{{$page.link_id}}">
+ {{if $page.resource_id && $candel}}
+ <i class="nav-link widget-nav-pills-icons fa fa-trash-o drop-icons" onclick="wiki_delete_page('{{$page.title}}', '{{$page.title}}', '{{$page.resource_id}}', '{{$page.link_id}}')"></i>
+ {{/if}}
+ <a class="nav-link" href="/wiki/{{$channel_address}}/{{$wikiname}}/{{$page.url}}">{{$page.title}}</a>
+ </li>
+ {{/foreach}}
+ {{/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>&nbsp;{{$addnew}}</a></li>
{{/if}}
@@ -11,7 +21,7 @@
<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}}">
+ <input id="id_mimetype" type="hidden" name="mimetype" value="{{$lockedtype}}">
{{else}}
{{$mimetype}}
{{/if}}
@@ -20,16 +30,6 @@
</form>
</div>
{{/if}}
- {{if $pages}}
- {{foreach $pages as $page}}
- <li class="nav-item nav-item-hack" id="{{$page.link_id}}">
- {{if $page.resource_id && $candel}}
- <i class="nav-link widget-nav-pills-icons fa fa-trash-o drop-icons" onclick="wiki_delete_page('{{$page.title}}', '{{$page.title}}', '{{$page.resource_id}}', '{{$page.link_id}}')"></i>
- {{/if}}
- <a class="nav-link" href="/wiki/{{$channel_address}}/{{$wikiname}}/{{$page.url}}">{{$page.title}}</a>
- </li>
- {{/foreach}}
- {{/if}}
</ul>
{{if ! $refresh}}
</div>