From 2bdfa7449d4b2b3752f0ad41efdbac2f520237ac Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 11 May 2022 14:44:16 +0800 Subject: [PATCH] * Finish task #53831. --- module/doc/js/tablecontents.js | 2 +- module/doc/model.php | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/module/doc/js/tablecontents.js b/module/doc/js/tablecontents.js index 15891830ea..d11c77d92a 100644 --- a/module/doc/js/tablecontents.js +++ b/module/doc/js/tablecontents.js @@ -22,7 +22,7 @@ $(function() /* Make modules tree sortable. */ $('#modules').sortable( { - trigger: '.module-name>a.sort-module, .tree-actions>.sortModule>.icon-move, .module-name>a.sortDoc, .tree-actions>.sortDoc>.icon-move', + trigger: '.module-name>a.sort-module, .tree-actions>.sortModule>.icon-move, a.sortDoc, .tree-actions>.sortDoc>.icon-move', dropToClass: 'sort-to', stopPropagation: true, nested: true, diff --git a/module/doc/model.php b/module/doc/model.php index 8c86a191c6..87f9a94b0c 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -2416,7 +2416,13 @@ EOT; if($currentMethod == 'tablecontents') { - $treeMenu[0] .= '' . zget($users, $doc->editedBy) . '  ' . $doc->editedDate . ''; + $treeMenu[0] .= '
' . zget($users, $doc->editedBy) . '  ' . $doc->editedDate . ''; + if(common::hasPriv('doc', 'updateOrder')) + { + $treeMenu[0] .= "
"; + $treeMenu[0] .= html::a('javascript:;', "", '', "title='{$this->lang->doc->updateOrder}' class='sortDoc'"); + $treeMenu[0] .= '
'; + } } if($currentMethod == 'objectlibs') { @@ -2432,7 +2438,9 @@ EOT; } else { - $treeMenu[0] .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID&libID=$rootID&docID={$doc->id}"), "  " . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title' title='{$doc->title}'"); + $class = common::hasPriv('doc', 'updateOrder') ? 'sortDoc' : ''; + $treeMenu[0] .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID&libID=$rootID&docID={$doc->id}"), "  " . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title $class' title='{$doc->title}'"); + $treeMenu[0] .= '
'; } $treeMenu[0] .= ''; @@ -2527,14 +2535,11 @@ EOT; else { $li = "
" . $module->name . ''; - if($currentMethod == 'tablecontents') + if($currentMethod == 'tablecontents' and common::hasPriv('tree', 'updateOrder')) { - if(common::hasPriv('tree', 'updateOrder')) - { - $li .= "
"; - $li .= html::a('javascript:;', "", '', "title='{$this->lang->doc->updateOrder}' class='sortModule'"); - $li .= '
'; - } + $li .= "
"; + $li .= html::a('javascript:;', "", '', "title='{$this->lang->doc->updateOrder}' class='sortModule'"); + $li .= '
'; } else {