From 241cceaffaccafb1e808cbacd6f06cf610b2602d Mon Sep 17 00:00:00 2001 From: dingyongliang Date: Fri, 10 Jan 2025 14:33:05 +0800 Subject: [PATCH] * [bug#58900] fix doc and api sort. --- module/doc/control.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/module/doc/control.php b/module/doc/control.php index 1eefa061e4..933f07219b 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -1750,6 +1750,17 @@ class doc extends control list($spaces, $spaceID) = $this->doc->getSpaces($type, $spaceID); $data = array('spaceID' => (int)$spaceID); $libs = $this->doc->getLibsOfSpace($type, $spaceID); + if($type === 'project' || $type === 'product') + { + usort($libs, function($a, $b) + { + if($a->order < $b->order) return -1; + if($a->order > $b->order) return 1; + if($a->type !== 'api' && $b->type === 'api') return -1; + if($a->type === 'api' && $b->type !== 'api') return 1; + return 0; + }); + } $libIds = array_keys($libs); if($noPicks || strpos($picks, ',space,') !== false) $data['spaces'] = $spaces;