diff --git a/lib/api/ktcmis/classes/AbstractEnum.inc.php b/lib/api/ktcmis/classes/AbstractEnum.inc.php new file mode 100644 index 0000000..7892ee2 --- /dev/null +++ b/lib/api/ktcmis/classes/AbstractEnum.inc.php @@ -0,0 +1,41 @@ + \ No newline at end of file diff --git a/lib/api/ktcmis/classes/CMISDocumentPropertyCollection.inc.php b/lib/api/ktcmis/classes/CMISDocumentPropertyCollection.inc.php index 345ad85..c746755 100644 --- a/lib/api/ktcmis/classes/CMISDocumentPropertyCollection.inc.php +++ b/lib/api/ktcmis/classes/CMISDocumentPropertyCollection.inc.php @@ -51,35 +51,35 @@ 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(); - self::$propertyTypes = array_merge(self::$propertyTypes, array('ContentStreamAllowed' => 'propertyString', - 'ContentStreamLength' => 'propertyInteger', - 'ContentStreamMimeType' => 'propertyString', - 'ContentStreamFilename' => 'propertyString', - 'ContentStreamUri' => 'propertyUri', - 'IsLatestVersion' => 'propertyBoolean', - 'IsVersionSeriesCheckedOut' => 'propertyBoolean', - 'VersionSeriesCheckedOutBy' => 'propertyString', - 'VersionSeriesCheckedOutId' => 'propertyId', - 'VersionLabel' => 'propertyString')); + self::$propertyTypes = array_merge(self::$propertyTypes, array('contentStreamAllowed' => 'propertyString', + 'contentStreamLength' => 'propertyInteger', + 'contentStreamMimeType' => 'propertyString', + 'contentStreamFilename' => 'propertyString', + 'contentStreamUri' => 'propertyUri', + 'isLatestVersion' => 'propertyBoolean', + 'isVersionSeriesCheckedOut' => 'propertyBoolean', + 'versionSeriesCheckedOutBy' => 'propertyString', + 'versionSeriesCheckedOutId' => 'propertyId', + 'versionLabel' => 'propertyString')); } } diff --git a/lib/api/ktcmis/classes/CMISFolderPropertyCollection.inc.php b/lib/api/ktcmis/classes/CMISFolderPropertyCollection.inc.php index 3043cce..dad955a 100644 --- a/lib/api/ktcmis/classes/CMISFolderPropertyCollection.inc.php +++ b/lib/api/ktcmis/classes/CMISFolderPropertyCollection.inc.php @@ -51,9 +51,9 @@ 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() { diff --git a/lib/api/ktcmis/classes/CMISPropertyCollection.inc.php b/lib/api/ktcmis/classes/CMISPropertyCollection.inc.php index 132ac9d..2a6158e 100644 --- a/lib/api/ktcmis/classes/CMISPropertyCollection.inc.php +++ b/lib/api/ktcmis/classes/CMISPropertyCollection.inc.php @@ -49,35 +49,35 @@ */ abstract class CMISPropertyCollection { - static $ObjectId; - static $BaseType; - static $Uri; - static $ObjectTypeId; - static $CreatedBy; - static $CreationDate; - static $LastModifiedBy; - static $LastModificationDate; - static $ChangeToken; + static $objectId; + static $baseTypeId; + static $uri; + static $objectTypeId; + static $createdBy; + static $creationDate; + static $lastModifiedBy; + static $lastModificationDate; + static $changeToken; // TODO these definitions belong in their own classe definition (see property type definions,) but here will do for now static public $propertyTypes; function __construct() { - self::$propertyTypes = array('ObjectId' => 'propertyId', - 'Author' => 'propertyString', - 'BaseType' => 'propertyString', - 'ObjectTypeId' => 'propertyId', - 'CreatedBy' => 'propertyString', - 'CreationDate' => 'propertyDateTime', - 'LastModifiedBy' => 'propertyString', - 'LastModificationDate' => 'propertyDateTime', - 'Name' => 'propertyString', - 'Uri' => 'propertyUri', - 'AllowedChildObjectTypeIds' => 'propertyId', - 'CreatedBy' => 'propertyString', - 'CreationDate' => 'propertyDateTime', - 'ChangeToken' => 'propertyString', - 'ParentId' => 'propertyId'); + self::$propertyTypes = array('objectId' => 'propertyId', + 'author' => 'propertyString', + 'baseTypeId' => 'propertyId', + 'objectTypeId' => 'propertyId', + 'createdBy' => 'propertyString', + 'creationDate' => 'propertyDateTime', + 'lastModifiedBy' => 'propertyString', + 'lastModificationDate' => 'propertyDateTime', + 'name' => 'propertyString', + 'uri' => 'propertyUri', + 'allowedChildObjectTypeIds' => 'propertyId', + 'createdBy' => 'propertyString', + 'creationDate' => 'propertyDateTime', + 'changeToken' => 'propertyString', + 'parentId' => 'propertyId'); } /** diff --git a/lib/api/ktcmis/classes/CMISRepository.inc.php b/lib/api/ktcmis/classes/CMISRepository.inc.php index 798a816..d2b8ff5 100644 --- a/lib/api/ktcmis/classes/CMISRepository.inc.php +++ b/lib/api/ktcmis/classes/CMISRepository.inc.php @@ -84,6 +84,7 @@ class CMISRepository { foreach($xml->repository as $repository) { $currentRepo = $repository->repositoryInfo[0]->repositoryId; + // TODO this is no longer correct - is an object of SimpleXMLElement and not a string or int if ((int)$currentRepo == $this->repositoryId) { $config = $repository; diff --git a/lib/api/ktcmis/enums/EnumCapabilityACL.inc.php b/lib/api/ktcmis/enums/EnumCapabilityACL.inc.php new file mode 100644 index 0000000..571f44c --- /dev/null +++ b/lib/api/ktcmis/enums/EnumCapabilityACL.inc.php @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/lib/api/ktcmis/enums/EnumCapabilityChanges.inc.php b/lib/api/ktcmis/enums/EnumCapabilityChanges.inc.php new file mode 100644 index 0000000..c0e6700 --- /dev/null +++ b/lib/api/ktcmis/enums/EnumCapabilityChanges.inc.php @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/lib/api/ktcmis/enums/EnumCapabilityContentStreamUpdatability.inc.php b/lib/api/ktcmis/enums/EnumCapabilityContentStreamUpdatability.inc.php new file mode 100644 index 0000000..aaa0896 --- /dev/null +++ b/lib/api/ktcmis/enums/EnumCapabilityContentStreamUpdatability.inc.php @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/lib/api/ktcmis/enums/EnumCapabilityJoin.inc.php b/lib/api/ktcmis/enums/EnumCapabilityJoin.inc.php new file mode 100644 index 0000000..8bd6bf4 --- /dev/null +++ b/lib/api/ktcmis/enums/EnumCapabilityJoin.inc.php @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/lib/api/ktcmis/enums/EnumCapabilityQuery.inc.php b/lib/api/ktcmis/enums/EnumCapabilityQuery.inc.php new file mode 100644 index 0000000..27ee15d --- /dev/null +++ b/lib/api/ktcmis/enums/EnumCapabilityQuery.inc.php @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/lib/api/ktcmis/enums/EnumCapabilityRenditions.inc.php b/lib/api/ktcmis/enums/EnumCapabilityRenditions.inc.php new file mode 100644 index 0000000..07dc57b --- /dev/null +++ b/lib/api/ktcmis/enums/EnumCapabilityRenditions.inc.php @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/lib/api/ktcmis/objecttypes/CMISDocumentObject.inc.php b/lib/api/ktcmis/objecttypes/CMISDocumentObject.inc.php index b104961..df2d424 100644 --- a/lib/api/ktcmis/objecttypes/CMISDocumentObject.inc.php +++ b/lib/api/ktcmis/objecttypes/CMISDocumentObject.inc.php @@ -74,9 +74,9 @@ class CMISDocumentObject extends CMISObject { $this->creatable = ''; // /* * fileable SHOULD be set as follows: - * If the repository does NOT support the “un-filing” capability: + * If the repository does NOT support the “un-filing? capability: * TRUE - * If the repository does support the “un-filing” capability: + * If the repository does support the “un-filing? capability: * , but SHOULD be TRUE */ $this->fileable = true; // TODO implement check for whether un-filing is supported @@ -119,7 +119,7 @@ class CMISDocumentObject extends CMISObject { $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];'), @@ -128,33 +128,33 @@ class CMISDocumentObject extends CMISObject { . $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', ''); +// $this->_setPropertyInternal('uri', $uri); + $this->_setPropertyInternal('uri', ''); // TODO what is this? Assuming it is the object type id, and not OUR document type? - $this->_setPropertyInternal('ObjectTypeId', $this->getAttribute('typeId')); + $this->_setPropertyInternal('objectTypeId', 'cmis:' . strtolower($this->getAttribute('typeId'))); // Needed to distinguish type - $this->_setPropertyInternal('BaseType', strtolower($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('ParentId', $objectProperties['folder_id']); - $this->_setPropertyInternal('IsImmutable', $objectProperties['is_immutable']); + $this->_setPropertyInternal('baseTypeId', 'cmis:' . strtolower($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('parentId', CMISUtil::encodeObjectId(FOLDER, $objectProperties['folder_id'])); + $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']); // VersionSeriesId should be the id of the latest version // NOTE this may change in the future but is easiest for the current implementation - $this->_setPropertyInternal('VersionSeriesId', $objectProperties['version']); + $this->_setPropertyInternal('versionSeriesId', $objectProperties['version']); if ($objectProperties['checked_out_by'] != 'n/a') { $checkedOut = true; @@ -168,18 +168,18 @@ class CMISDocumentObject extends CMISObject { $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('ContentStreamLength', $objectProperties['filesize']); - $this->_setPropertyInternal('ContentStreamMimeType', $objectProperties['mime_type']); - $this->_setPropertyInternal('ContentStreamFilename', $objectProperties['filename']); - $this->_setPropertyInternal('ContentStreamUri', $this->getProperty('ObjectId') . '/' . $objectProperties['filename']); - $this->_setPropertyInternal('Author', $objectProperties['created_by']); + $this->_setPropertyInternal('checkinComment', null); + $this->_setPropertyInternal('contentStreamLength', $objectProperties['filesize']); + $this->_setPropertyInternal('contentStreamMimeType', $objectProperties['mime_type']); + $this->_setPropertyInternal('contentStreamFilename', $objectProperties['filename']); + $this->_setPropertyInternal('contentStreamUri', $this->getProperty('objectId') . '/' . $objectProperties['filename']); + $this->_setPropertyInternal('author', $objectProperties['created_by']); } } diff --git a/lib/api/ktcmis/objecttypes/CMISFolderObject.inc.php b/lib/api/ktcmis/objecttypes/CMISFolderObject.inc.php index 12a0bb6..283ab56 100644 --- a/lib/api/ktcmis/objecttypes/CMISFolderObject.inc.php +++ b/lib/api/ktcmis/objecttypes/CMISFolderObject.inc.php @@ -98,7 +98,7 @@ class CMISFolderObject extends CMISObject { $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];'), @@ -106,24 +106,24 @@ class CMISFolderObject extends CMISObject { . '/browse.php?fFolderId=' . $objectProperties['id']); // TODO this url is probably incorrect...needs to be checked -// $this->_setPropertyInternal('Uri', $uri); - $this->_setPropertyInternal('Uri', ''); +// $this->_setPropertyInternal('uri', $uri); + $this->_setPropertyInternal('uri', ''); // TODO what is this? Assuming it is the object type id, and not OUR document type? - $this->_setPropertyInternal('ObjectTypeId', $this->getAttribute('typeId')); + $this->_setPropertyInternal('objectTypeId', 'cmis:' . strtolower($this->getAttribute('typeId'))); // Needed to distinguish type - $this->_setPropertyInternal('BaseType', strtolower($this->getAttribute('typeId'))); - $this->_setPropertyInternal('CreatedBy', $objectProperties['created_by']); + $this->_setPropertyInternal('baseTypeId', 'cmis:' . strtolower($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('Author', $objectProperties['created_by']); + $this->_setPropertyInternal('lastModificationDate', $objectProperties['modified_date']); + $this->_setPropertyInternal('changeToken', null); + $this->_setPropertyInternal('name', $objectProperties['folder_name']); + $this->_setPropertyInternal('parentId', CMISUtil::encodeObjectId(FOLDER, $objectProperties['parent_id'])); + $this->_setPropertyInternal('allowedChildObjectTypeIds', array('Document', 'Folder')); + $this->_setPropertyInternal('author', $objectProperties['created_by']); } } diff --git a/lib/api/ktcmis/services/CMISNavigationService.inc.php b/lib/api/ktcmis/services/CMISNavigationService.inc.php index d3785b7..959bc63 100644 --- a/lib/api/ktcmis/services/CMISNavigationService.inc.php +++ b/lib/api/ktcmis/services/CMISNavigationService.inc.php @@ -276,7 +276,7 @@ class CMISNavigationService { { $CMISDocument = new CMISDocumentObject($document->getId(), $this->ktapi); // set version label property - possibly belongs in document class - $CMISDocument->setProperty('VersionLabel', $CMISDocument->getProperty('VersionSeriesCheckedOutId')); + $CMISDocument->setProperty('versionLabel', $CMISDocument->getProperty('versionSeriesCheckedOutId')); $checkedout[] = $CMISDocument->getProperties(); } diff --git a/lib/api/ktcmis/services/CMISObjectService.inc.php b/lib/api/ktcmis/services/CMISObjectService.inc.php index bbee385..e04c53b 100644 --- a/lib/api/ktcmis/services/CMISObjectService.inc.php +++ b/lib/api/ktcmis/services/CMISObjectService.inc.php @@ -88,7 +88,7 @@ class CMISObjectService { // if parent folder is not allowed to hold this type, throw exception $CMISFolder = new CMISFolderObject($folderId, $this->ktapi); - $allowed = $CMISFolder->getProperty('AllowedChildObjectTypeIds'); + $allowed = $CMISFolder->getProperty('allowedChildObjectTypeIds'); $typeAllowed = false; if (is_array($allowed)) @@ -306,7 +306,7 @@ class CMISObjectService { // if parent folder is not allowed to hold this type, throw exception $CMISFolder = new CMISFolderObject($folderId, $this->ktapi); - $allowed = $CMISFolder->getProperty('AllowedChildObjectTypeIds'); + $allowed = $CMISFolder->getProperty('allowedChildObjectTypeIds'); if (!is_array($allowed) || !in_array($typeId, $allowed)) { throw new ConstraintViolationException('Parent folder may not hold objects of this type (' . $typeId . ')'); } @@ -366,7 +366,7 @@ class CMISObjectService { } // check that we were actually able to retrieve a real object - $objectId = $CMISObject->getProperty('ObjectId'); + $objectId = $CMISObject->getProperty('objectId'); if (empty($objectId)) { throw new ObjectNotFoundException('The requested object could not be found'); } @@ -384,7 +384,7 @@ class CMISObjectService { * @return string $contentStream (binary or text data) */ // NOTE streamNotSupportedException: The Repository SHALL throw this exception if the Object-Type definition - // specified by the objectId parameter’s “contentStreamAllowed” attribute is set to “not allowed”. + // specified by the objectId parameter’s “contentStreamAllowed? attribute is set to “not allowed?. // function getContentStream($repositoryId, $objectId) { @@ -461,7 +461,7 @@ class CMISObjectService { // check type id of object against allowed child types for destination folder $CMISFolder = new CMISFolderObject($targetFolderId, $this->ktapi); - $allowed = $CMISFolder->getProperty('AllowedChildObjectTypeIds'); + $allowed = $CMISFolder->getProperty('allowedChildObjectTypeIds'); if (!is_array($allowed) || !in_array($typeId, $allowed)) { throw new ConstraintViolationException('Parent folder may not hold objects of this type (' . $typeId . ')'); } @@ -707,7 +707,7 @@ class CMISObjectService { throw new StreamNotSupportedException('Content Streams are not allowed for this object type'); } - $csFileName = $CMISDocument->getProperty('ContentStreamFilename'); + $csFileName = $CMISDocument->getProperty('contentStreamFilename'); if (!empty($csFileName) && (!$overwriteFlag)) { throw new ContentAlreadyExistsException('Unable to overwrite existing content stream'); @@ -730,7 +730,7 @@ class CMISObjectService { // update the CMIS document object with the content stream information // $CMISDocument->reload($document['result']['document_id']); - return $CMISDocument->getProperty('ObjectId'); + return $CMISDocument->getProperty('objectId'); } } diff --git a/lib/api/ktcmis/services/CMISRepositoryService.inc.php b/lib/api/ktcmis/services/CMISRepositoryService.inc.php index b701f00..8393a4a 100644 --- a/lib/api/ktcmis/services/CMISRepositoryService.inc.php +++ b/lib/api/ktcmis/services/CMISRepositoryService.inc.php @@ -104,7 +104,7 @@ class CMISRepositoryService { // NOTE this code may fit better within the Repository Class // TODO return for specific type when $typeId is specified // TODO other optional parameters - private function getTypes($repositoryId, $typeId = '', $returnPropertyDefinitions = false, + public function getTypes($repositoryId, $typeId = '', $returnPropertyDefinitions = false, $maxItems = 0, $skipCount = 0, &$hasMoreItems = false) { /* diff --git a/lib/api/ktcmis/services/CMISVersioningService.inc.php b/lib/api/ktcmis/services/CMISVersioningService.inc.php index b4a20cc..f92487b 100644 --- a/lib/api/ktcmis/services/CMISVersioningService.inc.php +++ b/lib/api/ktcmis/services/CMISVersioningService.inc.php @@ -116,18 +116,18 @@ class CMISVersioningService { }; // if successful, set $contentCopied = true; unless contentStream is not set - if ($pwc->getProperty('ContentStreamFilename') != '') $contentCopied = true; + if ($pwc->getProperty('contentStreamFilename') != '') $contentCopied = true; $documentId = CMISUtil::encodeObjectId('Document', $documentId); // mark document object as checked out - $pwc->setProperty('IsVersionSeriesCheckedOut', true); + $pwc->setProperty('isVersionSeriesCheckedOut', true); $userName = ''; $user = $this->ktapi->get_user(); if (!PEAR::isError($user)) { $userName = $user->getName(); } - $pwc->setProperty('VersionSeriesCheckedOutBy', $userName); - $pwc->setProperty('VersionSeriesCheckedOutId', $documentId); + $pwc->setProperty('versionSeriesCheckedOutBy', $userName); + $pwc->setProperty('versionSeriesCheckedOutId', $documentId); return $contentCopied; } @@ -215,13 +215,13 @@ class CMISVersioningService { } // check that this is the latest version - if ($pwc->getProperty('IsLatestVersion') != true) { + if ($pwc->getProperty('isLatestVersion') != true) { throw new VersioningException('The document is not the latest version and cannot be checked in'); } // now do the checkin $tempfilename = CMISUtil::createTemporaryFile($contentStream); - $response = $this->ktapi->checkin_document($documentId, $pwc->getProperty('ContentStreamFilename'), $reason, $tempfilename, $major, + $response = $this->ktapi->checkin_document($documentId, $pwc->getProperty('contentStreamFilename'), $reason, $tempfilename, $major, $sig_username, $sig_password); // if there was any error in cancelling the checkout diff --git a/lib/api/ktcmis/util/CMISUtil.inc.php b/lib/api/ktcmis/util/CMISUtil.inc.php index be987a7..dd0ba39 100644 --- a/lib/api/ktcmis/util/CMISUtil.inc.php +++ b/lib/api/ktcmis/util/CMISUtil.inc.php @@ -278,7 +278,7 @@ class CMISUtil { foreach(CMISPropertyCollection::$propertyTypes as $property => $type) { // hack for Author property - if ($property == 'Author') { + if ($property == 'author') { $object[$property] = array('value' => $properties->getValue($property)); } else { @@ -286,71 +286,7 @@ class CMISUtil { } } - /* old static method */ - /* - $object['Author'] = array('value' => $properties->getValue('Author')); - - $object['properties']['BaseType'] = array('type' => $properties->getFieldType('BaseType'), - 'value' => $properties->getValue('BaseType')); - - $object['properties']['Name'] = array('type' => $properties->getFieldType('Name'), - 'value' => $properties->getValue('Name')); - - $object['properties']['ParentId'] = array('type' => $properties->getFieldType('ParentId'), - 'value' => self::encodeObjectId('Folder', - $properties->getValue('ParentId'))); - - $object['properties']['Uri'] = array('type' => $properties->getFieldType('Uri'), - 'value' => $properties->getValue('Uri')); - - // TODO ensure format of date is always correct - $object['properties']['LastModificationDate'] = array('type' => $properties->getFieldType('LastModificationDate'), - 'value' => $properties->getValue('LastModificationDate')); - - $object['properties']['CreatedBy'] = array('type' => $properties->getFieldType('CreatedBy'), - 'value' => $properties->getValue('CreatedBy')); - - $object['properties']['AllowedChildObjectTypeIds'] = array('type' => $properties->getFieldType('AllowedChildObjectTypeIds'), - 'value' => $properties->getValue('AllowedChildObjectTypeIds')); - - $object['properties']['CreationDate'] = array('type' => $properties->getFieldType('CreationDate'), - 'value' => $properties->getValue('CreationDate')); - - $object['properties']['LastModifiedBy'] = array('type' => $properties->getFieldType('LastModifiedBy'), - 'value' => $properties->getValue('LastModifiedBy')); - - $object['properties']['ChangeToken'] = array('type' => $properties->getFieldType('ChangeToken'), - 'value' => $properties->getValue('ChangeToken')); - - $object['properties']['ObjectTypeId'] = array('type' => $properties->getFieldType('ObjectTypeId'), - 'value' => $properties->getValue('ObjectTypeId')); - - $object['properties']['ObjectId'] = array('type' => $properties->getFieldType('ObjectId'), - 'value' => $properties->getValue('ObjectId')); - - if (strtolower($properties->getValue('ObjectTypeId')) == 'document') - { - $object['properties']['ChangeToken'] = array('type' => $properties->getFieldType('ChangeToken'), - 'value' => $properties->getValue('ChangeToken')); - $contentStreamLength = $properties->getValue('ContentStreamLength'); - if (!empty($contentStreamLength)) - { - $contentStreamLength = $properties->getValue('ContentStreamLength'); - $object['properties']['ContentStreamAllowed'] = array('type' => $properties->getFieldType('ContentStreamAllowed'), - 'value' => $properties->getValue('ContentStreamAllowed')); - $object['properties']['ContentStreamLength'] = array('type' => $properties->getFieldType('ContentStreamLength'), - 'value' => $properties->getValue('ContentStreamLength')); - $object['properties']['ContentStreamMimeType'] = array('type' => $properties->getFieldType('ContentStreamMimeType'), - 'value' => $properties->getValue('ContentStreamMimeType')); - $object['properties']['ContentStreamFilename'] = array('type' => $properties->getFieldType('ContentStreamFilename'), - 'value' => $properties->getValue('ContentStreamFilename')); - $object['properties']['ContentStreamUri'] = array('type' => $properties->getFieldType('ContentStreamUri'), - 'value' => $properties->getValue('ContentStreamUri')); - } - } - */ - - /* what on earth was this for? */ + /* what was this for and is it still needed? */ /* // if we have found a child/parent with one or more children/parents, recurse into the child/parent object if (count($entry['items']) > 0) { diff --git a/tests/ktcmis/testCmisApi.php b/tests/ktcmis/testCmisApi.php index a9a3c00..d2cd9fd 100644 --- a/tests/ktcmis/testCmisApi.php +++ b/tests/ktcmis/testCmisApi.php @@ -531,7 +531,7 @@ class CMISTestCase extends KTUnitTestCase { $response = $NavigationService->getCheckedOutDocs($repositoryId, false, false); $this->assertEqual($response['status_code'], 0); $this->assertNotNull($response['results']); - $this->assertTrue($this->findInPropertiesArray('ObjectId', $documentId, $response['results'])); + $this->assertTrue($this->findInPropertiesArray('objectId', $documentId, $response['results'])); // now let's cancel the checkout so that we can delete later during cleanup :) $response = $VersioningService->cancelCheckOut($repositoryId, $pwcId); diff --git a/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php b/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php index 150d193..95a0759 100644 --- a/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php +++ b/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php @@ -104,8 +104,8 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { } // 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']; + $folderId = $response[0]['properties']['objectId']['value']; + $folderName = $response[0]['properties']['name']['value']; } else { $folderId = $this->params[0]; @@ -162,10 +162,10 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { $cmisObjectProperties = KT_cmis_atom_service_helper::getCmisProperties($this->parsedXMLContent['@children']); // check for existing object id as property of submitted object data - if (!empty($cmisObjectProperties['ObjectId'])) + if (!empty($cmisObjectProperties['objectId'])) { $action = 'move'; - $objectId = $cmisObjectProperties['ObjectId']; + $objectId = $cmisObjectProperties['objectId']; } // TODO there may be more to do for the checking of an existing object. @@ -196,9 +196,9 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { if ($action == 'create') { if ($type == 'folder') - $newObjectId = $ObjectService->createFolder($repositoryId, ucwords($cmisObjectProperties['ObjectTypeId']), $properties, $folderId); + $newObjectId = $ObjectService->createFolder($repositoryId, ucwords($cmisObjectProperties['objectTypeId']), $properties, $folderId); else - $newObjectId = $ObjectService->createDocument($repositoryId, ucwords($cmisObjectProperties['ObjectTypeId']), $properties, $folderId, $content); + $newObjectId = $ObjectService->createDocument($repositoryId, ucwords($cmisObjectProperties['objectTypeId']), $properties, $folderId, $content); // check if returned Object Id is a valid CMIS Object Id CMISUtil::decodeObjectId($newObjectId, $typeId); @@ -272,12 +272,12 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { $objectElement = $feed->newElement('cmisra:object'); $propertiesElement = $feed->newElement('cmis:properties'); $propElement = $feed->newElement('cmis:propertyId'); - $propElement->appendChild($feed->newAttr('cmis:name', 'ObjectId')); + $propElement->appendChild($feed->newAttr('cmis:name', 'objectId')); $feed->newField('cmis:value', $failed, $propElement); $propertiesElement->appendChild($propElement); $objectElement->appendChild($propertiesElement); $entry->appendChild($objectElement); - $entry->appendChild($feed->newElement('cmis:terminator')); +// $entry->appendChild($feed->newElement('cmis:terminator')); } $this->responseFeed = $feed; @@ -386,7 +386,7 @@ class KT_cmis_atom_service_document extends KT_cmis_atom_service { // for now a document will only have one parent as KnowledgeTree does not support multi-filing // TODO update this code if/when multi-filing support is added - $objectId = $response[0]['properties']['ObjectId']['value']; + $objectId = $response[0]['properties']['objectId']['value']; } // determine whether we want the document entry feed or the actual physical document content. // this depends on $this->params[1] @@ -622,7 +622,7 @@ class KT_cmis_atom_service_checkedout extends KT_cmis_atom_service { $cmisObjectProperties = KT_cmis_atom_service_helper::getCmisProperties($this->parsedXMLContent['@children']); // check for existing object id as property of submitted object data - if (empty($cmisObjectProperties['ObjectId'])) + if (empty($cmisObjectProperties['objectId'])) { $feed = KT_cmis_atom_service_helper::getErrorFeed($this, self::STATUS_SERVER_ERROR, 'No object was specified for checkout'); // Expose the responseFeed @@ -630,7 +630,7 @@ class KT_cmis_atom_service_checkedout extends KT_cmis_atom_service { return null; } - $response = $VersioningService->checkOut($repositoryId, $cmisObjectProperties['ObjectId']); + $response = $VersioningService->checkOut($repositoryId, $cmisObjectProperties['objectId']); if (PEAR::isError($response)) { @@ -641,7 +641,7 @@ class KT_cmis_atom_service_checkedout extends KT_cmis_atom_service { } $this->setStatus(self::STATUS_CREATED); - $feed = KT_cmis_atom_service_helper::getObjectFeed($this, $ObjectService, $repositoryId, $cmisObjectProperties['ObjectId'], 'POST'); + $feed = KT_cmis_atom_service_helper::getObjectFeed($this, $ObjectService, $repositoryId, $cmisObjectProperties['objectId'], 'POST'); // Expose the responseFeed $this->responseFeed = $feed; diff --git a/webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php b/webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php index 20d3155..ff81273 100644 --- a/webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php +++ b/webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php @@ -78,12 +78,12 @@ class KT_cmis_atom_service_helper { } else if ($method == 'GET') { $response = new KT_cmis_atom_responseFeed_GET(CMIS_APP_BASE_URI); - $response->newField('title', $cmisEntry['properties']['ObjectTypeId']['value'], $response); - $response->newField('id', 'urn:uuid:' . $cmisEntry['properties']['ObjectId']['value'], $response); + $response->newField('title', $cmisEntry['properties']['objectTypeId']['value'], $response); + $response->newField('id', 'urn:uuid:' . $cmisEntry['properties']['objectId']['value'], $response); } if ($serviceType == 'PWC') $pwc = true; else $pwc = false; - KT_cmis_atom_service_helper::createObjectEntry($response, $cmisEntry, $cmisEntry['properties']['ParentId']['value'], $pwc, $method); + KT_cmis_atom_service_helper::createObjectEntry($response, $cmisEntry, $cmisEntry['properties']['parentId']['value'], $pwc, $method); // Don't think this should be here...only one item so why would we need to say there are no more? /*if ($method == 'GET') { @@ -103,7 +103,7 @@ class KT_cmis_atom_service_helper { static public function createObjectEntry(&$response, $cmisEntry, $parent, $pwc = false, $method = 'GET') { $workspace = $response->getWorkspace(); - $type = strtolower($cmisEntry['properties']['ObjectTypeId']['value']); + $type = strtolower($cmisEntry['properties']['objectTypeId']['value']); // create entry $entry = $response->newEntry(); @@ -114,7 +114,8 @@ class KT_cmis_atom_service_helper { // append attributes $entry->appendChild($response->newAttr('xmlns', 'http://www.w3.org/2005/Atom')); $entry->appendChild($response->newAttr('xmlns:app', 'http://www.w3.org/2007/app')); - $entry->appendChild($response->newAttr('xmlns:cmis', 'http://docs.oasis-open.org/ns/cmis/core/200901')); + $entry->appendChild($response->newAttr('xmlns:cmis', 'http://docs.oasis-open.org/ns/cmis/core/200908/')); + $entry->appendChild($response->newAttr('xmlns:cmisra', 'http://docs.oasis-open.org/ns/cmis/restatom/200908/')); } // TODO dynamic actual creator name @@ -122,18 +123,18 @@ class KT_cmis_atom_service_helper { $element = $response->newField('name', 'admin', $responseElement); $entry->appendChild($responseElement); - if (!empty($cmisEntry['properties']['ContentStreamLength']['value'])) + if (!empty($cmisEntry['properties']['contentStreamLength']['value'])) { $field = $response->newElement('content'); - $field->appendChild($response->newAttr('type', $cmisEntry['properties']['ContentStreamMimeType']['value'])); + $field->appendChild($response->newAttr('type', $cmisEntry['properties']['contentStreamMimeType']['value'])); $field->appendChild($response->newAttr('src', CMIS_APP_BASE_URI . $workspace . '/' . $type - . '/' . $cmisEntry['properties']['ObjectId']['value'] - . '/' . $cmisEntry['properties']['ContentStreamFilename']['value'])); + . '/' . $cmisEntry['properties']['objectId']['value'] + . '/' . $cmisEntry['properties']['contentStreamFilename']['value'])); $entry->appendChild($field); } // content & id tags - $id = $cmisEntry['properties']['ObjectId']['value']; + $id = $cmisEntry['properties']['objectId']['value']; $response->newField('id', 'urn:uuid:' . $id, $entry); @@ -141,32 +142,32 @@ class KT_cmis_atom_service_helper { $link = $response->newElement('link'); $link->appendChild($response->newAttr('rel', 'self')); $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . (!$pwc ? $type : 'pwc') . '/' - . $cmisEntry['properties']['ObjectId']['value'])); + . $cmisEntry['properties']['objectId']['value'])); $entry->appendChild($link); $link = $response->newElement('link'); $link->appendChild($response->newAttr('rel', 'edit')); $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type - . '/' . $cmisEntry['properties']['ObjectId']['value'])); + . '/' . $cmisEntry['properties']['objectId']['value'])); $entry->appendChild($link); - if ((strtolower($cmisEntry['properties']['ObjectTypeId']['value']) == 'document') - && (!empty($cmisEntry['properties']['ContentStreamLength']['value']))) + if ((strtolower($cmisEntry['properties']['objectTypeId']['value']) == 'document') + && (!empty($cmisEntry['properties']['contentStreamLength']['value']))) { $link = $response->newElement('link'); $link->appendChild($response->newAttr('rel', 'edit-media')); - $link->appendChild($response->newAttr('type', $cmisEntry['properties']['ContentStreamMimeType']['value'])); + $link->appendChild($response->newAttr('type', $cmisEntry['properties']['contentStreamMimeType']['value'])); $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type - . '/' . $cmisEntry['properties']['ObjectId']['value'] - . '/' . $cmisEntry['properties']['ContentStreamFilename']['value'])); + . '/' . $cmisEntry['properties']['objectId']['value'] + . '/' . $cmisEntry['properties']['contentStreamFilename']['value'])); $entry->appendChild($link); $link = $response->newElement('link'); $link->appendChild($response->newAttr('rel', 'enclosure')); - $link->appendChild($response->newAttr('type', $cmisEntry['properties']['ContentStreamMimeType']['value'])); + $link->appendChild($response->newAttr('type', $cmisEntry['properties']['contentStreamMimeType']['value'])); $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type - . '/' . $cmisEntry['properties']['ObjectId']['value'] - . '/' . $cmisEntry['properties']['ContentStreamFilename']['value'])); + . '/' . $cmisEntry['properties']['objectId']['value'] + . '/' . $cmisEntry['properties']['contentStreamFilename']['value'])); $entry->appendChild($link); } @@ -175,7 +176,7 @@ class KT_cmis_atom_service_helper { $link = $response->newElement('link'); $link->appendChild($response->newAttr('rel', 'allowableactions')); $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type . '/' - . $cmisEntry['properties']['ObjectId']['value'] . '/permissions')); + . $cmisEntry['properties']['objectId']['value'] . '/permissions')); $entry->appendChild($link); // according to spec this MUST be present, but spec says that links for function which are not supported @@ -183,67 +184,67 @@ class KT_cmis_atom_service_helper { $link = $response->newElement('link'); $link->appendChild($response->newAttr('rel', 'relationships')); $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type . '/' - . $cmisEntry['properties']['ObjectId']['value'] . '/rels')); + . $cmisEntry['properties']['objectId']['value'] . '/rels')); $entry->appendChild($link); // if there is no parent or parent is 0, do not add the parent link // also if this is specifically the root folder, do not add the parent link -// if (!empty($cmisEntry['properties']['ParentId']['value']) && !CMISUtil::isRootFolder(self::$repositoryId, $cmisEntry['properties']['ObjectId']['value'])) +// if (!empty($cmisEntry['properties']['parentId']['value']) && !CMISUtil::isRootFolder(self::$repositoryId, $cmisEntry['properties']['objectId']['value'])) - if (!CMISUtil::isRootFolder(self::$repositoryId, $cmisEntry['properties']['ObjectId']['value'], self::$ktapi)) + if (!CMISUtil::isRootFolder(self::$repositoryId, $cmisEntry['properties']['objectId']['value'], self::$ktapi)) { // TODO check parent link is correct, fix if needed $link = $response->newElement('link'); $link->appendChild($response->newAttr('rel', 'parents')); $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/folder/' - . $cmisEntry['properties']['ObjectId']['value'] . '/parent')); + . $cmisEntry['properties']['objectId']['value'] . '/parent')); $entry->appendChild($link); } // Folder/Document specific links - if (strtolower($cmisEntry['properties']['ObjectTypeId']['value']) == 'folder') + if (strtolower($cmisEntry['properties']['objectTypeId']['value']) == 'folder') { $link = $response->newElement('link'); $link->appendChild($response->newAttr('rel', 'children')); $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type - . '/' . $cmisEntry['properties']['ObjectId']['value'] + . '/' . $cmisEntry['properties']['objectId']['value'] . '/children')); $entry->appendChild($link); $link = $response->newElement('link'); $link->appendChild($response->newAttr('rel', 'descendants')); $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type - . '/' . $cmisEntry['properties']['ObjectId']['value'] + . '/' . $cmisEntry['properties']['objectId']['value'] . '/descendants')); $entry->appendChild($link); } - else if (strtolower($cmisEntry['properties']['ObjectTypeId']['value']) == 'document') + else if (strtolower($cmisEntry['properties']['objectTypeId']['value']) == 'document') { // according to spec this MUST be present, but spec says that links for function which are not supported // do not need to be present, so unsure for the moment // $link = $response->newElement('link'); // $link->appendChild($response->newAttr('rel', 'allversions')); -// $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type . '/' . $cmisEntry['properties']['ParentId']['value'])); +// $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type . '/' . $cmisEntry['properties']['parentId']['value'])); // $entry->appendChild($link); // according to spec this MUST be present, but spec says that links for function which are not supported // do not need to be present, so unsure for the moment // $link = $response->newElement('link'); // $link->appendChild($response->newAttr('rel', 'latestversion')); -// $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type . '/' . $cmisEntry['properties']['ParentId']['value'])); +// $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type . '/' . $cmisEntry['properties']['parentId']['value'])); // $entry->appendChild($link); // if there is a content stream, this link MUST be present // not sure yet where it must point... - if (!empty($cmisEntry['properties']['ContentStreamLength']['value'])) + if (!empty($cmisEntry['properties']['contentStreamLength']['value'])) { $link = $response->newElement('link'); $link->appendChild($response->newAttr('rel', 'stream')); - $link->appendChild($response->newAttr('type', $cmisEntry['properties']['ContentStreamMimeType']['value'])); + $link->appendChild($response->newAttr('type', $cmisEntry['properties']['contentStreamMimeType']['value'])); $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type - . '/' . $cmisEntry['properties']['ObjectId']['value'] - . '/' . $cmisEntry['properties']['ContentStreamFilename']['value'])); + . '/' . $cmisEntry['properties']['objectId']['value'] + . '/' . $cmisEntry['properties']['contentStreamFilename']['value'])); $entry->appendChild($link); } @@ -255,22 +256,22 @@ class KT_cmis_atom_service_helper { $link = $response->newElement('link'); $link->appendChild($response->newAttr('rel', 'pwc')); $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type - . '/' . $cmisEntry['properties']['ObjectId']['value'] - . '/' . $cmisEntry['properties']['ContentStreamFilename']['value'])); + . '/' . $cmisEntry['properties']['objectId']['value'] + . '/' . $cmisEntry['properties']['contentStreamFilename']['value'])); $entry->appendChild($link); $link = $response->newElement('link'); $link->appendChild($response->newAttr('rel', 'source')); $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type - . '/' . $cmisEntry['properties']['ObjectId']['value'] - . '/' . $cmisEntry['properties']['ContentStreamFilename']['value'])); + . '/' . $cmisEntry['properties']['objectId']['value'] + . '/' . $cmisEntry['properties']['contentStreamFilename']['value'])); $entry->appendChild($link); } // $link = $response->newElement('link'); // $link->appendChild($response->newAttr('rel', 'stream')); // $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type -// . '/' . $cmisEntry['properties']['ObjectId']['value'] -// . '/' . $cmisEntry['properties']['ContentStreamFilename']['value'])); +// . '/' . $cmisEntry['properties']['objectId']['value'] +// . '/' . $cmisEntry['properties']['contentStreamFilename']['value'])); } $link = $response->newElement('link'); @@ -287,14 +288,14 @@ class KT_cmis_atom_service_helper { // do not need to be present, so unsure for the moment - policies are being abandoned, or so I thought... // $link = $response->newElement('link'); // $link->appendChild($response->newAttr('rel', 'policies')); -// $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type . '/' . $cmisEntry['properties']['ParentId']['value'])); +// $link->appendChild($response->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/' . $type . '/' . $cmisEntry['properties']['parentId']['value'])); // $entry->appendChild($link); // end links // TODO proper date $entry->appendChild($response->newField('published', self::formatDatestamp())); - $entry->appendChild($response->newElement('summary', $cmisEntry['properties']['Name']['value'])); - $entry->appendChild($response->newElement('title', $cmisEntry['properties']['Name']['value'])); + $entry->appendChild($response->newElement('summary', $cmisEntry['properties']['name']['value'])); + $entry->appendChild($response->newElement('title', $cmisEntry['properties']['name']['value'])); $entry->appendChild($response->newField('updated', self::formatDatestamp())); // main CMIS entry @@ -304,11 +305,11 @@ class KT_cmis_atom_service_helper { foreach($cmisEntry['properties'] as $propertyName => $property) { $propElement = $response->newElement('cmis:' . $property['type']); - $propElement->appendChild($response->newAttr('localName', 'rep-cmis:' . $propertyName)); +// $propElement->appendChild($response->newAttr('localName', 'rep-cmis:' . $propertyName)); $propElement->appendChild($response->newAttr('propertyDefinitionId', 'cmis:' . $propertyName)); if (!empty($property['value'])) { - if ($propertyName == 'ContentStreamUri') { + if ($propertyName == 'contentStreamUri') { $property['value'] = CMIS_APP_BASE_URI . $workspace . '/' . $type . '/' .$property['value']; } $response->newField('cmis:value', CMISUtil::boolToString($property['value']), $propElement); @@ -320,7 +321,7 @@ class KT_cmis_atom_service_helper { $entry->appendChild($objectElement); // after every entry, append a cmis:terminator tag - $entry->appendChild($response->newElement('cmis:terminator')); +// $entry->appendChild($response->newElement('cmis:terminator')); // TODO check determination of when to add app:edited tag // if ($method == 'POST') { @@ -431,7 +432,7 @@ class KT_cmis_atom_service_helper { $entry->appendChild($feedElement); // after every entry, append a cmis:terminator tag - $entry->appendChild($feed->newElement('cmis:terminator')); +// $entry->appendChild($feed->newElement('cmis:terminator')); } return $feed; @@ -478,7 +479,7 @@ class KT_cmis_atom_service_helper { ++$start; } - return CMISUtil::encodeObjectId('Folder', $folderId); + return CMISUtil::encodeObjectId(FOLDER, $folderId); } static public function getCmisProperties($xmlArray) @@ -591,7 +592,7 @@ class KT_cmis_atom_service_helper { // $service->headers['If-Modified-Since'] => 2009-07-24 17:16:54 $service->setContentDownload(true); - $eTag = md5($response['properties']['LastModificationDate']['value'] . $response['properties']['ContentStreamLength']['value']); + $eTag = md5($response['properties']['lastModificationDate']['value'] . $response['properties']['contentStreamLength']['value']); if ($service->headers['If-None-Match'] == $eTag) { @@ -604,17 +605,17 @@ class KT_cmis_atom_service_helper { // headers specific to output $service->setEtag($eTag); - $service->setHeader('Last-Modified', $response['properties']['LastModificationDate']['value']); + $service->setHeader('Last-Modified', $response['properties']['lastModificationDate']['value']); - if (!empty($response['properties']['ContentStreamMimeType']['value'])) { - $service->setHeader('Content-type', $response['properties']['ContentStreamMimeType']['value'] . ';charset=utf-8'); + if (!empty($response['properties']['contentStreamMimeType']['value'])) { + $service->setHeader('Content-type', $response['properties']['contentStreamMimeType']['value'] . ';charset=utf-8'); } else { $service->setHeader('Content-type', 'text/plain;charset=utf-8'); } - $service->setHeader('Content-Disposition', 'attachment;filename="' . $response['properties']['ContentStreamFilename']['value'] . '"'); - $service->setHeader('Content-Length', $response['properties']['ContentStreamLength']['value']); + $service->setHeader('Content-Disposition', 'attachment;filename="' . $response['properties']['contentStreamFilename']['value'] . '"'); + $service->setHeader('Content-Length', $response['properties']['contentStreamLength']['value']); $service->setOutput($contentStream); } diff --git a/webservice/classes/atompub/cmis/KT_cmis_atom_responseFeed.inc.php b/webservice/classes/atompub/cmis/KT_cmis_atom_responseFeed.inc.php index 9a01898..6af5a3a 100644 --- a/webservice/classes/atompub/cmis/KT_cmis_atom_responseFeed.inc.php +++ b/webservice/classes/atompub/cmis/KT_cmis_atom_responseFeed.inc.php @@ -19,7 +19,7 @@ class KT_cmis_atom_responseFeed extends KT_atom_responseFeed { // append additional tags $this->feed->appendChild($this->newAttr('xmlns:app', 'http://www.w3.org/2007/app')); - $this->feed->appendChild($this->newAttr('xmlns:cmis', 'http://docs.oasis-open.org/ns/cmis/core/200908')); + $this->feed->appendChild($this->newAttr('xmlns:cmis', 'http://docs.oasis-open.org/ns/cmis/core/200908/')); $this->feed->appendChild($this->newAttr('xmlns:cmisra', 'http://docs.oasis-open.org/ns/cmis/restatom/200908/')); // require the workspace for creating links within responses diff --git a/webservice/classes/atompub/cmis/KT_cmis_atom_server.inc.php b/webservice/classes/atompub/cmis/KT_cmis_atom_server.inc.php index e2254e5..0d24247 100644 --- a/webservice/classes/atompub/cmis/KT_cmis_atom_server.inc.php +++ b/webservice/classes/atompub/cmis/KT_cmis_atom_server.inc.php @@ -115,8 +115,13 @@ class KT_cmis_atom_server extends KT_atom_server { } } } + + ob_start(); + readfile('C:\Users\Paul\Documents\Downloads\cmis_mod_kt.xml'); + $this->output = ob_get_contents(); + ob_end_clean(); - $this->output = $service->getAPPdoc(); +// $this->output = $service->getAPPdoc(); } public function registerService($workspace = NULL, $serviceName = NULL, $serviceClass = NULL, $title = NULL, @@ -154,7 +159,21 @@ class KT_cmis_atom_server extends KT_atom_server { //include('/var/www/atompub_response.xml'); - if ($this->renderBody) echo $this->output; + if (false && preg_match('/F1\-children/', $this->output)) { + readfile('C:\Users\Paul\Documents\Downloads\alfresco folder tree atompub response.xml'); + } + else if (false && preg_match('/urn:uuid:checkedout/', $this->output)) { + readfile('C:\Users\Paul\Documents\Downloads\alfresco checkedout atompub response.xml'); + } + else if (false && preg_match('/urn:uuid:types\-all/', $this->output)) { + readfile('C:\Users\Paul\Documents\Downloads\alfresco types atompub response.xml'); + } + else if (false && preg_match('/\/', $this->output)) { + readfile('C:\Users\Paul\Documents\Downloads\cmis_mod_kt.xml'); + } + else { + if ($this->renderBody) echo $this->output; + } } }