/** * Deals with GET actions for folders. * This includes children and tree/descendant listings as well as individual folder retrieval */ public function GET_action() { $repositoryId = KT_cmis_atom_service_helper::getRepositoryId($RepositoryService); // TODO implement full path/node separation as with Alfresco - i.e. path requests come in on path/ and node requests come in on node/ // path request e.g.: path/Root Folder/DroppedDocuments // node request e.g.: node/F1/children // node request e.g.: node/F2/parent // node request e.g.: node/F2 if (urldecode($this->params[0]) == 'Root Folder') { $folderId = CMISUtil::encodeObjectId(FOLDER, 1); $folderName = urldecode($this->params[0]); } else { if ($this->params[0] == 'path') { $ktapi =& KT_cmis_atom_service_helper::getKt(); $folderId = KT_cmis_atom_service_helper::getFolderId($this->params, $ktapi); } else { if ($this->params[1] == 'children' || $this->params[1] == 'descendants') { $folderId = $this->params[0]; $ObjectService = new ObjectService(KT_cmis_atom_service_helper::getKt()); $response = $ObjectService->getProperties($repositoryId, $folderId, false, false); if (PEAR::isError($response)) { $feed = KT_cmis_atom_service_helper::getErrorFeed($this, KT_cmis_atom_service::STATUS_SERVER_ERROR, $response->getMessage()); $this->responseFeed = $feed; return null; } $folderName = $response['properties']['Name']['value']; } else { if ($this->params[1] == 'parent') { // abstract this to be used also by the document service (and the PWC service?) ??? // alternatively use getFolderParent here makes sense and use getObjectParents when document service? $folderId = $this->params[0]; $NavigationService = new NavigationService(KT_cmis_atom_service_helper::getKt()); $response = $NavigationService->getFolderParent($repositoryId, $folderId, false, false, false); if (PEAR::isError($response)) { $feed = KT_cmis_atom_service_helper::getErrorFeed($this, KT_cmis_atom_service::STATUS_SERVER_ERROR, $response->getMessage()); $this->responseFeed = $feed; return null; } // we know that a folder will only have one parent, so we can assume element 0 $folderId = $response[0]['properties']['ObjectId']['value']; $folderName = $response[0]['properties']['Name']['value']; } else { $folderId = $this->params[0]; } } } } if (!empty($this->params[1]) && ($this->params[1] == 'children' || $this->params[1] == 'descendants')) { $NavigationService = new NavigationService(KT_cmis_atom_service_helper::getKt()); $feed = $this->getFolderChildrenFeed($NavigationService, $repositoryId, $folderId, $folderName, $this->params[1]); } else { $ObjectService = new ObjectService(KT_cmis_atom_service_helper::getKt()); $feed = KT_cmis_atom_service_helper::getObjectFeed($this, $ObjectService, $repositoryId, $folderId); } // Expose the responseFeed $this->responseFeed = $feed; }
/** * Deals with GET actions for folders. * This includes children and tree/descendant listings as well as individual folder retrieval */ public function GET_action() { $RepositoryService = new RepositoryService(); $repositories = $RepositoryService->getRepositories(); $repositoryId = $repositories[0]['repositoryId']; // TODO implement full path/node separation as with Alfresco - i.e. path requests come in on path/ and node requests come in on node/ // path request e.g.: Root Folder/DroppedDocuments // node request e.g.: F1/children // node request e.g.: F2 if (urldecode($this->params[0]) == 'Root Folder') { $folderId = CMISUtil::encodeObjectId('Folder', 1); $folderName = urldecode($this->params[0]); } else { if ($this->params[0] == 'path') { $ktapi =& KT_cmis_atom_service_helper::getKt(); $folderId = KT_cmis_atom_service_helper::getFolderId($this->params, $ktapi); } else { if ($this->params[1] == 'children' || $this->params[1] == 'descendants') { $folderId = $this->params[0]; $ObjectService = new ObjectService(KT_cmis_atom_service_helper::getKt()); $response = $ObjectService->getProperties($repositoryId, $folderId, false, false); if (PEAR::isError($response)) { $feed = KT_cmis_atom_service_helper::getErrorFeed($this, KT_cmis_atom_service::STATUS_SERVER_ERROR, $response->getMessage()); $this->responseFeed = $feed; return null; } $folderName = $response['properties']['Name']['value']; } else { $folderId = $this->params[0]; } } } if (!empty($this->params[1]) && ($this->params[1] == 'children' || $this->params[1] == 'descendants')) { $NavigationService = new NavigationService(KT_cmis_atom_service_helper::getKt()); $feed = $this->getFolderChildrenFeed($NavigationService, $repositoryId, $folderId, $folderName, $this->params[1]); } else { $ObjectService = new ObjectService(KT_cmis_atom_service_helper::getKt()); $feed = KT_cmis_atom_service_helper::getObjectFeed($this, $ObjectService, $repositoryId, $folderId); } //Expose the responseFeed $this->responseFeed = $feed; }