Commit 5859c2c3633733a90ba926a24bc1aeff4a6d5e31
1 parent
ba2f2f74
Modifications to CMIS AtomPub folder feed to fix incorrect last folder name
Committed by: Paul Barrett Reviewed by: Jarret Jordaan
Showing
1 changed file
with
11 additions
and
9 deletions
ktatompub/services/cmis/folder.inc.php
| ... | ... | @@ -480,27 +480,30 @@ class CMISFolderFeed extends CMISObjectFeed { |
| 480 | 480 | return $output; |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | - static public function getFolderData($query, &$folderId, &$tree) | |
| 483 | + static public function getFolderData($query, &$folderName, &$tree) | |
| 484 | 484 | { |
| 485 | 485 | $ktapi = new KTAPI(); |
| 486 | 486 | $ktapi->start_session('admin', 'admin'); |
| 487 | - $repositoryId = $repositories[0]['repositoryId']; | |
| 487 | + | |
| 488 | 488 | $numQ = count($query); |
| 489 | 489 | $numFolders = $numQ-3; |
| 490 | - $folderName = urldecode($query[$numQ-$numFolders]); | |
| 491 | 490 | $folderId = 1; |
| 492 | - if($query[$numQ-1] == 'children' || $query[$numQ-1] == 'descendants') { | |
| 491 | + | |
| 492 | + if ($query[$numQ-1] == 'children' || $query[$numQ-1] == 'descendants') | |
| 493 | + { | |
| 493 | 494 | $tree = $query[$numQ-1]; |
| 494 | 495 | } |
| 496 | + | |
| 495 | 497 | $start = 0; |
| 496 | - while($start < $numFolders-1) { | |
| 498 | + while($start < $numFolders-1) | |
| 499 | + { | |
| 500 | + $folderName = urldecode($query[$numQ-$numFolders+$start]); | |
| 497 | 501 | $folder = $ktapi->get_folder_by_name($folderName, $folderId); |
| 498 | 502 | $folderId = $folder->get_folderid(); |
| 499 | - $start++; | |
| 500 | - $folderName = urldecode($query[$numQ-$numFolders+$start]); | |
| 503 | + ++$start; | |
| 501 | 504 | } |
| 502 | - return CMISUtil::encodeObjectId('Folder', $folderId); | |
| 503 | 505 | |
| 506 | + return CMISUtil::encodeObjectId('Folder', $folderId); | |
| 504 | 507 | } |
| 505 | 508 | } |
| 506 | 509 | |
| ... | ... | @@ -514,7 +517,6 @@ $repositoryId = $repositories[0]['repositoryId']; |
| 514 | 517 | |
| 515 | 518 | $folderId = CMISFolderFeed::getFolderData($query, $folderName, $tree); |
| 516 | 519 | |
| 517 | - | |
| 518 | 520 | if (isset($tree) && (($tree == 'children') || ($tree == 'descendants'))) |
| 519 | 521 | { |
| 520 | 522 | $NavigationService = new NavigationService(); | ... | ... |