diff --git a/ktcmis/classes/CMISBaseObject.inc.php b/lib/api/ktcmis/classes/CMISBaseObject.inc.php index f0f636a..c43f247 100644 --- a/ktcmis/classes/CMISBaseObject.inc.php +++ b/lib/api/ktcmis/classes/CMISBaseObject.inc.php @@ -40,10 +40,9 @@ * @version Version 0.1 */ -require_once(CMIS_DIR . '/classes/CMISObject.inc.php'); +//require_once(CMIS_DIR . '/classes/CMISObject.inc.php'); -// NOTE chemistry class was abstract but this has gone in a different direction anyway -abstract class CMISBaseObject implements CMISObject { +abstract class CMISBaseObject { protected $typeId; protected $queryName; @@ -60,7 +59,7 @@ abstract class CMISBaseObject implements CMISObject { protected $properties; // list of property objects which define the additional properties for this object - // TODO all we have here so far is getAttributes & getProperties :) + // TODO all we have here so far is getAttributes & getProperties // add all the other methods as we go along function __construct() diff --git a/ktcmis/classes/CMISDocumentPropertyCollection.inc.php b/lib/api/ktcmis/classes/CMISDocumentPropertyCollection.inc.php index 8a08b55..8d30e13 100644 --- a/ktcmis/classes/CMISDocumentPropertyCollection.inc.php +++ b/lib/api/ktcmis/classes/CMISDocumentPropertyCollection.inc.php @@ -47,21 +47,26 @@ require_once(CMIS_DIR . '/classes/CMISPropertyCollection.inc.php'); */ class CMISDocumentPropertyCollection extends CMISPropertyCollection { - static $name; - static $isImmutable; - static $isLatestVersion; - static $isMajorVersion; - static $isLatestMajorVersion; - static $versionLabel; - static $versionSeriesId; - static $isVersionSeriesCheckedOut; - static $versionSeriesCheckedOutBy; - static $versionSeriesCheckedOutId; - static $checkinComment; - static $contentStreamLength; - static $contentStreamMimeType; - static $contentStreamFilename; - static $contentStreamUri; + static $Name; + static $IsImmutable; + static $IsLatestVersion; + static $IsMajorVersion; + static $IsLatestMajorVersion; + static $VersionLabel; + static $VersionSeriesId; + static $IsVersionSeriesCheckedOut; + static $VersionSeriesCheckedOutBy; + static $VersionSeriesCheckedOutId; + static $CheckinComment; + static $ContentStreamLength; + static $ContentStreamMimeType; + static $ContentStreamFilename; + static $ContentStreamUri; + + function __construct() + { + parent::__construct(); + } } diff --git a/ktcmis/classes/CMISFolderPropertyCollection.inc.php b/lib/api/ktcmis/classes/CMISFolderPropertyCollection.inc.php index dfafce9..9154917 100644 --- a/ktcmis/classes/CMISFolderPropertyCollection.inc.php +++ b/lib/api/ktcmis/classes/CMISFolderPropertyCollection.inc.php @@ -47,9 +47,14 @@ require_once(CMIS_DIR . '/classes/CMISPropertyCollection.inc.php'); */ class CMISFolderPropertyCollection extends CMISPropertyCollection { - static $name; - static $parentId; - static $allowedChildObjectTypeIds; + static $Name; + static $ParentId; + static $AllowedChildObjectTypeIds; + + function __construct() + { + parent::__construct(); + } } diff --git a/ktcmis/classes/CMISObject.inc.php b/lib/api/ktcmis/classes/CMISObject.inc.php index ee11fe2..ee11fe2 100644 --- a/ktcmis/classes/CMISObject.inc.php +++ b/lib/api/ktcmis/classes/CMISObject.inc.php diff --git a/ktcmis/classes/CMISObjectTypes.inc.php b/lib/api/ktcmis/classes/CMISObjectTypes.inc.php index fc2bf09..fc2bf09 100644 --- a/ktcmis/classes/CMISObjectTypes.inc.php +++ b/lib/api/ktcmis/classes/CMISObjectTypes.inc.php diff --git a/ktcmis/classes/CMISPropertyCollection.inc.php b/lib/api/ktcmis/classes/CMISPropertyCollection.inc.php index 412f6a6..210d691 100644 --- a/ktcmis/classes/CMISPropertyCollection.inc.php +++ b/lib/api/ktcmis/classes/CMISPropertyCollection.inc.php @@ -45,14 +45,26 @@ */ abstract class CMISPropertyCollection { - static $objectId; + static $ObjectId; static $URI; - static $typeId; - static $createdBy; - static $creationDate; - static $lastModifiedBy; - static $lastModificationDate; - static $changeToken; + static $ObjectTypeId; + static $CreatedBy; + static $CreationDate; + static $LastModifiedBy; + static $LastModificationDate; + static $ChangeToken; + + // TODO these definitions probably belong elsewhere, but here will do for now + static $propertyTypes; + + function __construct() + { + $this->propertyTypes = array('ObjectId' => 'propertyId', 'BaseType' => 'propertyString', + 'ObjectTypeId' => 'propertyString', 'CreatedBy' => 'propertyString', + 'CreationDate' => 'propertyDateTime', 'LastModifiedBy' => 'propertyString', + 'LastModificationDate' => 'propertyDateTime', 'Name' => 'propertyString', + 'ParentId' => 'propertyId'); + } /** * Gets the property value. @@ -71,6 +83,11 @@ abstract class CMISPropertyCollection { $this->{$field} = $value; } + function getFieldType($field) + { + return $this->propertyTypes[$field]; + } + } ?> diff --git a/ktcmis/classes/CMISRepository.inc.php b/lib/api/ktcmis/classes/CMISRepository.inc.php index 1d11da8..2cabc84 100644 --- a/ktcmis/classes/CMISRepository.inc.php +++ b/lib/api/ktcmis/classes/CMISRepository.inc.php @@ -98,13 +98,13 @@ class CMISRepository { } // set capabilities - foreach($config->repositoryCapabilities->children() as $field => $value) + foreach($config->repositoryCapabilities[0] as $field => $value) { $this->setCapabilityField($field, (string)$value); } // set supported document types - foreach($config->supportedTypes->children() as $field => $value) + foreach($config->supportedTypes[0] as $field => $value) { $this->objectTypes[] = (string)$value; } diff --git a/ktcmis/classes/CMISRepositoryCapabilities.inc.php b/lib/api/ktcmis/classes/CMISRepositoryCapabilities.inc.php index 75e685b..75e685b 100644 --- a/ktcmis/classes/CMISRepositoryCapabilities.inc.php +++ b/lib/api/ktcmis/classes/CMISRepositoryCapabilities.inc.php diff --git a/ktcmis/classes/CMISRepositoryInfo.inc.php b/lib/api/ktcmis/classes/CMISRepositoryInfo.inc.php index 69b665e..69b665e 100644 --- a/ktcmis/classes/CMISRepositoryInfo.inc.php +++ b/lib/api/ktcmis/classes/CMISRepositoryInfo.inc.php diff --git a/ktcmis/config/repositories.xml b/lib/api/ktcmis/config/repositories.xml index 6119698..65aa246 100644 --- a/ktcmis/config/repositories.xml +++ b/lib/api/ktcmis/config/repositories.xml @@ -12,15 +12,15 @@ http://127.0.0.1/ - 1 + 0ad7de04-7914-41b1-b5ee-be9f0b626437 KnowledgeTree self KnowledgeTree Repository KnowledgeTree - KnowledgeTree + KnowledgeTree Document Management System 3.6.2 - 1 - cmis 0.61c + F1 + 0.61c false @@ -41,7 +41,7 @@ http://12s7.w0.0.1/ - 44 + b60bd6c5-e8f9-4776-b292-8d544468c9e4 asdasdasd self KnowledgeTree Repository @@ -49,7 +49,7 @@ KnowledgeTree 3.6.1 1 - 0.61 + 0.61c false diff --git a/ktcmis/ktcmis.inc.php b/lib/api/ktcmis/ktcmis.inc.php index fc4d6b8..a39183d 100644 --- a/ktcmis/ktcmis.inc.php +++ b/lib/api/ktcmis/ktcmis.inc.php @@ -40,39 +40,29 @@ * @version Version 0.9 */ +/** + * Split into individual classes to handle each section of functionality. + * This is really just a handling layer between CMIS and the web services. + */ + // TODO implement exceptions in various calls (in the underlying classes) // FIXME none of the error handling actually does anything, it's leftover from copy/paste of some ktapi code -require_once(realpath(dirname(__FILE__) . '/../config/dmsDefaults.php')); +require_once(realpath(dirname(__FILE__) . '/../../../config/dmsDefaults.php')); require_once(KT_DIR . '/ktapi/ktapi.inc.php'); -define ('CMIS_DIR', KT_DIR . '/ktcmis'); +define ('CMIS_DIR', KT_LIB_DIR . '/api/ktcmis'); require_once(CMIS_DIR . '/services/CMISRepositoryService.inc.php'); require_once(CMIS_DIR . '/services/CMISNavigationService.inc.php'); require_once(CMIS_DIR . '/services/CMISObjectService.inc.php'); require_once(CMIS_DIR . '/util/CMISUtil.inc.php'); -class KTCMIS { +/** + * Handles authentication + */ +class KTCMISBase { /** - * Class for CMIS Repository Services - * - * @var object - */ - protected $RepositoryService; - /** - * Class for CMIS Navigation Services - * - * @var object - */ - protected $NavigationService; - /** - * Class for CMIS Object Services - * - * @var object - */ - protected $ObjectService; - /** * KnowledgeTree API instance * * @var object @@ -85,51 +75,41 @@ class KTCMIS { */ protected $session; - function __construct(&$ktapi = null, $user = '', $password = '') + public function startSession($username, $password) { - // ktapi interface + global $default; + $default->log->debug("attempt auth with $username :: $password"); $this->session = null; -// if (is_null($ktapi)) -// { -// // TODO this should probably throw an exception instead -// return PEAR::RaiseError('Cannot continue without KTAPI instance'); - // FIXME this CANNOT be allowed in a live environment - // possibly we should insist on a ktapi instance being passed - // or at least user/pass for logging in here, if one or other - // not sent, return error - $user = 'admin'; - $password = 'admin'; - $this->ktapi = new KTAPI(); - $this->session = $this->ktapi->start_session($user, $password); -// } -// else -// { -// $this->ktapi = $ktapi; -// } - - // instantiate services - $this->RepositoryService = new CMISRepositoryService(); - $this->NavigationService = new CMISNavigationService($this->ktapi); - $this->ObjectService = new CMISObjectService($this->ktapi); + // remove as soon as actual auth code is in place + $username = 'admin'; + $password = 'admin'; + $this->ktapi = new KTAPI(); + $this->session =& $this->ktapi->start_session($username, $password); + + if (PEAR::isError($this->session)) + { + $default->log->debug("FAILED $username :: $password FAILED"); + } + + return $this->session; } - function __destruct() + // TODO what about destroying sessions? +} + +/** + * Handles low level repository information queries + */ +class KTRepositoryService extends KTCMISBase { + + protected $RepositoryService; + + public function __construct() { -// if ($this->session instanceOf KTAPI_UserSession) -// { -// try -// { -// $this->session->logout(); -// } -// catch (Exception $e) -// { -// // no output -// } -// } + // instantiate underlying CMIS service + $this->RepositoryService = new CMISRepositoryService(); } - // Repository service functions - /** * Fetch a list of all available repositories * @@ -137,7 +117,7 @@ class KTCMIS { * * @return repositoryList[] */ - function getRepositories() + public function getRepositories() { $repositories = $this->RepositoryService->getRepositories(); if (PEAR::isError($repositories)) @@ -170,7 +150,7 @@ class KTCMIS { * * @param string $repositoryId */ - function getRepositoryInfo($repositoryId) + public function getRepositoryInfo($repositoryId) { $repositoryInfo = $this->RepositoryService->getRepositoryInfo($repositoryId); if (PEAR::isError($repositoryInfo)) @@ -194,7 +174,7 @@ class KTCMIS { * * @param string $repositoryId */ - function getTypes($repositoryId, $typeId = '', $returnPropertyDefinitions = false, + public function getTypes($repositoryId, $typeId = '', $returnPropertyDefinitions = false, $maxItems = 0, $skipCount = 0, &$hasMoreItems = false) { $repositoryObjectTypeResult = $this->RepositoryService->getTypes($repositoryId, $typeId, $returnPropertyDefinitions, @@ -229,10 +209,10 @@ class KTCMIS { * @param string $repositoryId * @param string $typeId */ - function getTypeDefinition($repositoryId, $typeId) + public function getTypeDefinition($repositoryId, $typeId) { $typeDefinitionResult = $this->RepositoryService->getTypeDefinition($repositoryId, $typeId); - + if (PEAR::isError($typeDefinitionResult)) { return array( @@ -252,7 +232,26 @@ class KTCMIS { ); } - // Navigation service functions +} + +/* + * Handles repository navigation + */ +class KTNavigationService extends KTCMISBase { + + protected $NavigationService; + + public function __construct() + { + // instantiate underlying CMIS service + $this->NavigationService = new CMISNavigationService(); + } + + public function startSession($username, $password) + { + parent::startSession($username, $password); + $this->NavigationService->setInterface($this->ktapi); + } /** * Get descendents of the specified folder, up to the depth indicated @@ -266,7 +265,7 @@ class KTCMIS { * @param string $filter * @return array $descendants */ - function getDescendants($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, + public function getDescendants($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, $depth = 1, $typeID = 'Any', $filter = '') { // TODO optional parameters @@ -284,11 +283,6 @@ class KTCMIS { // format for webservices consumption // NOTE this will almost definitely be changing in the future, this is just to get something working $descendants = CMISUtil::decodeObjectHierarchy($descendantsResult, 'child'); -// $descendants = array(array('properties' => array('objectId' => 'D2', 'typeId' => 'Document', 'name' => 'test document'), -// 'child' => array(array('properties' => array('objectId' => 'D7', -// 'typeId' => 'Document', 'name' => 'CHILD document'), 'child' => null), -// array('properties' => array('objectId' => 'F34', -// 'typeId' => 'Folder', 'name' => 'CHILD FOLDER'), 'child' => null)))); return array ( "status_code" => 0, @@ -309,7 +303,7 @@ class KTCMIS { * @param int $skipCount * @return array $descendants */ - function getChildren($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, + public function getChildren($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, $typeID = 'Any', $filter = '', $maxItems = 0, $skipCount = 0) { // TODO paging @@ -325,8 +319,6 @@ class KTCMIS { } $children = CMISUtil::decodeObjectHierarchy($childrenResult, 'child'); -// $children = array(array('properties' => array('objectId' => 'D2', 'typeId' => 'Document', 'name' => 'test document'), -// 'child' => null)); return array( "status_code" => 0, @@ -345,7 +337,7 @@ class KTCMIS { * @param string $filter * @return ancestry[] */ - function getFolderParent($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, $returnToRoot, $filter = '') + public function getFolderParent($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, $returnToRoot, $filter = '') { $ancestryResult = $this->NavigationService->getFolderParent($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, $returnToRoot); @@ -359,8 +351,6 @@ class KTCMIS { } $ancestry = CMISUtil::decodeObjectHierarchy($ancestryResult, 'child'); -// $ancestry = array(array('properties' => array('objectId' => 'D2', 'typeId' => 'Document', 'name' => 'test document'), -// 'child' => null)); return array( "status_code" => 0, @@ -368,42 +358,19 @@ class KTCMIS { ); } - /** - * Gets the parents for the selected object - * - * @param string $repositoryId - * @param string $folderId - * @param boolean $includeAllowableActions - * @param boolean $includeRelationships - * @param string $filter - * @return ancestry[] - */ - function getObjectParents($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, $filter = '') - { - $ancestryResult = $this->NavigationService->getObjectParents($repositoryId, $objectId, $includeAllowableActions, - $includeRelationships); - - if (PEAR::isError($ancestryResult)) - { - return array( - "status_code" => 1, - "message" => "Failed getting ancestry for object" - ); - } +} - $ancestry = CMISUtil::decodeObjectHierarchy($ancestryResult, 'child'); -// $ancestry = array(array('properties' => array('objectId' => 'D2', 'typeId' => 'Document', 'name' => 'test document'), -// 'child' => null)); +/** + * Handles requests for and actions on Folders and Documents + */ +class KTObjectService extends KTCMISBase { -// $ancestry = array(array('properties' => array(array('property' => array('name' => 'objectId', $value => 'D2')), -// array('property' => array('name' => 'typeId', $value => 'Document')), -// array('property' => array('name' => 'name', $value => 'test document')))), -// 'child' => null); + protected $ObjectService; - return array( - "status_code" => 0, - "results" => $ancestry - ); + public function __construct() + { + // instantiate underlying CMIS service + $this->ObjectService = new CMISObjectService(); } /** @@ -417,7 +384,7 @@ class KTCMIS { * @param string $filter * @return properties[] */ - function getProperties($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, + public function getProperties($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, $returnVersion = false, $filter = '') { $propertiesResult = $this->ObjectService->getProperties($repositoryId, $objectId, $includeAllowableActions, $includeRelationships); @@ -429,7 +396,7 @@ class KTCMIS { "message" => "Failed getting properties for object" ); } -// echo '
'.print_r($propertiesResult, true).'
'; + // will need to convert to array format, so: $propertyCollection['objectId'] = $propertiesResult->getValue('objectId'); $propertyCollection['URI'] = $propertiesResult->getValue('URI'); @@ -441,19 +408,13 @@ class KTCMIS { $propertyCollection['changeToken'] = $propertiesResult->getValue('changeToken'); $properties = array(array('properties' => $propertyCollection, 'child' => null)); -// echo '
'.print_r($properties, true).'
'; -// -// $properties = array(array('properties' => array('objectId' => 'F2', 'URI' => '', 'typeId' => 'Document', -// 'createdBy' => 'Administrator', 'creationDate' => '1 June 2009', -// 'lastModifiedBy' => 'Administrator', 'lastModificationDate' => '1 June 2009', -// 'changeToken' => ''), -// 'child' => null)); return array( "status_code" => 0, "results" => $properties ); } + } ?> diff --git a/ktcmis/objecttypes/CMISDocumentObject.inc.php b/lib/api/ktcmis/objecttypes/CMISDocumentObject.inc.php index 3dca392..8b5b8f2 100644 --- a/ktcmis/objecttypes/CMISDocumentObject.inc.php +++ b/lib/api/ktcmis/objecttypes/CMISDocumentObject.inc.php @@ -107,7 +107,7 @@ class CMISDocumentObject extends CMISBaseObject { $objectProperties = $object->get_detail(); - $this->_setPropertyInternal('objectId', CMISUtil::encodeObjectId($this->typeId, $objectProperties['document_id'])); + $this->_setPropertyInternal('ObjectId', CMISUtil::encodeObjectId($this->typeId, $objectProperties['document_id'])); // prevent doubled '/' chars $uri = preg_replace_callback('/([^:]\/)\//', create_function('$matches', 'return $matches[1];'), @@ -116,28 +116,28 @@ class CMISDocumentObject extends CMISBaseObject { . $objectProperties['document_id']); // NOTE what about instead creating a downloadable version with appropriate link? see ktapi::download_document // also ktapidocument::get_download_url - $this->_setPropertyInternal('Uri', $uri); + $this->_setPropertyInternal('URI', $uri); // TODO what is this? Assuming it is the object type id, and not OUR document type? - $this->_setPropertyInternal('typeId', $this->getAttribute('typeId')); - $this->_setPropertyInternal('createdBy', $objectProperties['created_by']); - $this->_setPropertyInternal('creationDate', $objectProperties['created_date']); - $this->_setPropertyInternal('lastModifiedBy', $objectProperties['modified_by']); - $this->_setPropertyInternal('lastModificationDate', $objectProperties['modified_date']); - $this->_setPropertyInternal('changeToken', null); - $this->_setPropertyInternal('name', $objectProperties['title']); - $this->_setPropertyInternal('isImmutable', $objectProperties['is_immutable']); + $this->_setPropertyInternal('ObjectTypeId', $this->getAttribute('typeId')); + $this->_setPropertyInternal('CreatedBy', $objectProperties['created_by']); + $this->_setPropertyInternal('CreationDate', $objectProperties['created_date']); + $this->_setPropertyInternal('LastModifiedBy', $objectProperties['modified_by']); + $this->_setPropertyInternal('LastModificationDate', $objectProperties['modified_date']); + $this->_setPropertyInternal('ChangeToken', null); + $this->_setPropertyInternal('Name', $objectProperties['title']); + $this->_setPropertyInternal('IsImmutable', $objectProperties['is_immutable']); // NOTE if access to older versions is allowed, this will need to be checked, else just set to yes // see ktapi::get_document_version_history // NOTE see ktapi::is_latest_version - $this->_setPropertyInternal('isLatestVersion', true); - $this->_setPropertyInternal('isMajorVersion', (strstr($objectProperties['version'], '.') ? false : true)); + $this->_setPropertyInternal('IsLatestVersion', true); + $this->_setPropertyInternal('IsMajorVersion', (strstr($objectProperties['version'], '.') ? false : true)); // NOTE if access to older versions is allowed, this will need to be checked, else just set to yes // see ktapi::get_document_version_history // NOTE see ktapi::is_latest_version - $this->_setPropertyInternal('isLatestMajorVersion', true); - $this->_setPropertyInternal('versionLabel', $objectProperties['version']); + $this->_setPropertyInternal('IsLatestMajorVersion', true); + $this->_setPropertyInternal('VersionLabel', $objectProperties['version']); // TODO what determines this, do we have anything? - $this->_setPropertyInternal('versionSeriesId', null); + $this->_setPropertyInternal('VersionSeriesId', null); if ($objectProperties['checked_out_by'] != 'n/a') { $checkedOut = true; @@ -151,18 +151,18 @@ class CMISDocumentObject extends CMISBaseObject { $checkedOutBy = null; $checkedOutId = null; } - $this->_setPropertyInternal('isVersionSeriesCheckedOut', $checkedOut); - $this->_setPropertyInternal('versionSeriesCheckedOutBy', $checkedOutBy); + $this->_setPropertyInternal('IsVersionSeriesCheckedOut', $checkedOut); + $this->_setPropertyInternal('VersionSeriesCheckedOutBy', $checkedOutBy); // TODO presumably this is the ID of the Private Working Copy created on checkout? // will find out more when we do checkout/checkin - $this->_setPropertyInternal('versionSeriesCheckedOutId', $checkedOutId); + $this->_setPropertyInternal('VersionSeriesCheckedOutId', $checkedOutId); // TODO currently not returned by KnowledgeTree? - $this->_setPropertyInternal('checkinComment', null); + $this->_setPropertyInternal('CheckinComment', null); // TODO if we implement content streams - $this->_setPropertyInternal('contentStreamLength', null); - $this->_setPropertyInternal('contentStreamMimeType', null); - $this->_setPropertyInternal('contentStreamFilename', null); - $this->_setPropertyInternal('contentStreamUri', null); + $this->_setPropertyInternal('ContentStreamLength', null); + $this->_setPropertyInternal('ContentStreamMimeType', null); + $this->_setPropertyInternal('ContentStreamFilename', null); + $this->_setPropertyInternal('ContentStreamUri', null); } } diff --git a/ktcmis/objecttypes/CMISFolderObject.inc.php b/lib/api/ktcmis/objecttypes/CMISFolderObject.inc.php index 4acc778..93e542c 100644 --- a/ktcmis/objecttypes/CMISFolderObject.inc.php +++ b/lib/api/ktcmis/objecttypes/CMISFolderObject.inc.php @@ -86,7 +86,7 @@ class CMISFolderObject extends CMISBaseObject { $objectProperties = $object->get_detail(); - $this->_setPropertyInternal('objectId', CMISUtil::encodeObjectId($this->typeId, $objectProperties['id'])); + $this->_setPropertyInternal('ObjectId', CMISUtil::encodeObjectId($this->typeId, $objectProperties['id'])); // prevent doubled '/' chars $uri = preg_replace_callback('/([^:]\/)\//', create_function('$matches', 'return $matches[1];'), @@ -94,20 +94,20 @@ class CMISFolderObject extends CMISBaseObject { . '/browse.php?fFolderId=' . $objectProperties['id']); // TODO this url is probably incorrect...needs to be checked - $this->_setPropertyInternal('Uri', $uri); + $this->_setPropertyInternal('URI', $uri); // TODO what is this? Assuming it is the object type id, and not OUR document type? - $this->_setPropertyInternal('typeId', $this->getAttribute('typeId')); - $this->_setPropertyInternal('createdBy', $objectProperties['created_by']); + $this->_setPropertyInternal('ObjectTypeId', $this->getAttribute('typeId')); + $this->_setPropertyInternal('CreatedBy', $objectProperties['created_by']); // TODO cannot currently retrieve via ktapi or regular folder code - add as with created by - $this->_setPropertyInternal('creationDate', $objectProperties['created_date']); + $this->_setPropertyInternal('CreationDate', $objectProperties['created_date']); // TODO cannot currently retrieve via ktapi or regular folder code - add as with created by - $this->_setPropertyInternal('lastModifiedBy', $objectProperties['modified_by']); + $this->_setPropertyInternal('LastModifiedBy', $objectProperties['modified_by']); // TODO cannot currently retrieve via ktapi or regular folder code - add as with created by - $this->_setPropertyInternal('lastModificationDate', $objectProperties['modified_date']); - $this->_setPropertyInternal('changeToken', null); - $this->_setPropertyInternal('name', $objectProperties['folder_name']); - $this->_setPropertyInternal('parentId', $objectProperties['parent_id']); - $this->_setPropertyInternal('allowedChildObjectTypeIds', array('Document', 'Folder')); + $this->_setPropertyInternal('LastModificationDate', $objectProperties['modified_date']); + $this->_setPropertyInternal('ChangeToken', null); + $this->_setPropertyInternal('Name', $objectProperties['folder_name']); + $this->_setPropertyInternal('ParentId', $objectProperties['parent_id']); + $this->_setPropertyInternal('AllowedChildObjectTypeIds', array('Document', 'Folder')); } } diff --git a/ktcmis/services/CMISNavigationService.inc.php b/lib/api/ktcmis/services/CMISNavigationService.inc.php index c68e491..e35da84 100644 --- a/ktcmis/services/CMISNavigationService.inc.php +++ b/lib/api/ktcmis/services/CMISNavigationService.inc.php @@ -48,7 +48,12 @@ class CMISNavigationService { protected $ktapi; - function CMISNavigationService(&$ktapi) + /** + * Sets the interface to be used to query the repository + * + * @param object $ktapi The KnowledgeTree API interface + */ + function setInterface(&$ktapi) { $this->ktapi = $ktapi; } diff --git a/ktcmis/services/CMISObjectService.inc.php b/lib/api/ktcmis/services/CMISObjectService.inc.php index b41bd59..2448a46 100644 --- a/ktcmis/services/CMISObjectService.inc.php +++ b/lib/api/ktcmis/services/CMISObjectService.inc.php @@ -11,10 +11,10 @@ class CMISObjectService { protected $ktapi; - function CMISObjectService(&$ktapi) - { - $this->ktapi = $ktapi; - } +// function CMISObjectService(&$ktapi) +// { +// $this->ktapi = $ktapi; +// } /** * Fetches the properties for the specified object diff --git a/ktcmis/services/CMISRepositoryService.inc.php b/lib/api/ktcmis/services/CMISRepositoryService.inc.php index adfb54f..adfb54f 100644 --- a/ktcmis/services/CMISRepositoryService.inc.php +++ b/lib/api/ktcmis/services/CMISRepositoryService.inc.php diff --git a/ktcmis/util/CMISUtil.inc.php b/lib/api/ktcmis/util/CMISUtil.inc.php index c534250..1d87234 100644 --- a/ktcmis/util/CMISUtil.inc.php +++ b/lib/api/ktcmis/util/CMISUtil.inc.php @@ -139,6 +139,7 @@ class CMISUtil { $CMISObject = new CMISFolderObject($ktapi, $repositoryURI); break; } + $CMISObject->get($object['id']); $CMISArray[$count]['object'] = $CMISObject; @@ -220,9 +221,13 @@ class CMISUtil { $object = $entry['object']; $properties = $object->getProperties(); - $hierarchy[$key]['properties']['objectId'] = $properties->getValue('objectId'); - $hierarchy[$key]['properties']['typeId'] = $properties->getValue('typeId'); - $hierarchy[$key]['properties']['name'] = $properties->getValue('name'); + // TODO additional properties to be returned + $hierarchy[$key]['properties']['ObjectId'] = array('type' => $properties->getFieldType('ObjectId'), + 'value' => $properties->getValue('ObjectId')); + $hierarchy[$key]['properties']['ObjectTypeId'] = array('type' => $properties->getFieldType('ObjectTypeId'), + 'value' => $properties->getValue('ObjectTypeId')); + $hierarchy[$key]['properties']['Name'] = array('type' => $properties->getFieldType('Name'), + 'value' => $properties->getValue('Name')); // if we have found a child/parent with one or more children/parents, recurse into the child/parent object if (count($entry['items']) > 0) @@ -272,6 +277,18 @@ class CMISUtil { return $array; } + /** + * Converts a boolean value to string representation + * If input is not true or false, return unaltered + * + * @param boolean/other $input + * @return string + */ + function boolToString($input) + { + return (($input === true) ? 'true' : (($input === false) ? 'false' : $input)); + } + } ?>