Commit f8fc14641887dfdba0d54d35fcb1c708134d3d23

Authored by Megan Watson
1 parent dda957a6

Ordered folders by name for get listing

Jira: KTE-55

Committed by: Megan Watson
Reviewed by: Tohir Solomons
Showing 1 changed file with 9 additions and 7 deletions
ktapi/KTAPIFolder.inc.php
... ... @@ -5,7 +5,7 @@
5 5 * KnowledgeTree Community Edition
6 6 * Document Management Made Simple
7 7 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
8   - *
  8 + *
9 9 *
10 10 * This program is free software; you can redistribute it and/or modify it under
11 11 * the terms of the GNU General Public License version 3 as published by the
... ... @@ -227,7 +227,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
227 227  
228 228 return $detail;
229 229 }
230   -
  230 +
231 231 /**
232 232 * This clears the global object cache of the folder class.
233 233 *
... ... @@ -545,7 +545,8 @@ class KTAPI_Folder extends KTAPI_FolderItem
545 545 if (strpos($what,'F') !== false)
546 546 {
547 547  
548   - $folder_children = Folder::getList(array('parent_id = ?', $this->folderid));
  548 + $aOptions['orderby'] = 'name';
  549 + $folder_children = Folder::getList(array('parent_id = ?', $this->folderid), $aOptions);
549 550  
550 551 foreach ($folder_children as $folder)
551 552 {
... ... @@ -798,7 +799,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
798 799  
799 800 return $contents;
800 801 }
801   -
  802 +
802 803 /**
803 804 * Get's a folder listing, recursing to the maximum depth.
804 805 * Derived from the get_listing function.
... ... @@ -836,7 +837,8 @@ class KTAPI_Folder extends KTAPI_FolderItem
836 837 if (strpos($what,'F') !== false)
837 838 {
838 839  
839   - $folder_children = Folder::getList(array('parent_id = ?', $this->folderid));
  840 + $aOptions['orderby'] = 'name';
  841 + $folder_children = Folder::getList(array('parent_id = ?', $this->folderid), $aOptions);
840 842  
841 843 foreach ($folder_children as $folder)
842 844 {
... ... @@ -903,9 +905,9 @@ class KTAPI_Folder extends KTAPI_FolderItem
903 905 $array['item_type'] = "S";
904 906 }
905 907 }
906   -
  908 +
907 909 $array['items']=$items;
908   - if($wsversion<3 || (strpos($what,'F') !== false && !$folder->isSymbolicLink()) ||
  910 + if($wsversion<3 || (strpos($what,'F') !== false && !$folder->isSymbolicLink()) ||
909 911 ($folder->isSymbolicLink() && strpos($what,'S') !== false)) {
910 912 $contents[] = $array;
911 913 }
... ...