diff --git a/ktapi/ktapi.inc.php b/ktapi/ktapi.inc.php index c911c0c..4d5c8a1 100644 --- a/ktapi/ktapi.inc.php +++ b/ktapi/ktapi.inc.php @@ -2928,7 +2928,7 @@ class KTAPI * @param string $tempfilename * @return kt_document_detail. status_code can be KTWS_ERR_INVALID_SESSION, KTWS_ERR_INVALID_FOLDER, KTWS_ERR_INVALID_DOCUMENT or KTWS_SUCCESS */ - public function checkin_document($document_id, $filename, $reason, $tempfilename, $major_update, + public function checkin_document($document_id, $filename, $reason, $tempfilename, $major_update, $sig_username = '', $sig_password = '') { $response = $this->_check_electronic_signature($document_id, $sig_username, $sig_password, $reason, $reason, diff --git a/lib/api/ktcmis/classes/CMISDocumentPropertyCollection.inc.php b/lib/api/ktcmis/classes/CMISDocumentPropertyCollection.inc.php index 0a19724..87c9498 100644 --- a/lib/api/ktcmis/classes/CMISDocumentPropertyCollection.inc.php +++ b/lib/api/ktcmis/classes/CMISDocumentPropertyCollection.inc.php @@ -71,6 +71,7 @@ class CMISDocumentPropertyCollection extends CMISPropertyCollection { 'ContentStreamMimeType' => 'propertyString', 'ContentStreamFilename' => 'propertyString', 'ContentStreamUri' => 'propertyUri', + 'IsLatestVersion' => 'propertyBoolean', 'IsVersionSeriesCheckedOut' => 'propertyBoolean', 'VersionSeriesCheckedOutBy' => 'propertyString', 'VersionSeriesCheckedOutId' => 'propertyId', diff --git a/lib/api/ktcmis/ktNavigationService.inc.php b/lib/api/ktcmis/ktNavigationService.inc.php new file mode 100644 index 0000000..2a88729 --- /dev/null +++ b/lib/api/ktcmis/ktNavigationService.inc.php @@ -0,0 +1,251 @@ +. +* +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, +* California 94120-7775, or email info@knowledgetree.com. +* +* The interactive user interfaces in modified source and object code versions +* of this program must display Appropriate Legal Notices, as required under +* Section 5 of the GNU General Public License version 3. +* +* In accordance with Section 7(b) of the GNU General Public License version 3, +* these Appropriate Legal Notices must retain the display of the "Powered by +* KnowledgeTree" logo and retain the original copyright notice. If the display of the +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices +* must display the words "Powered by KnowledgeTree" and retain the original +* copyright notice. +* +* @copyright 2008-2009, KnowledgeTree Inc. +* @license GNU General Public License version 3 +* @author KnowledgeTree Team +* @package KTCMIS +* @version Version 0.9 +*/ + +require_once(realpath(dirname(__FILE__) . '/ktService.inc.php')); +require_once(CMIS_DIR . '/services/CMISNavigationService.inc.php'); + +/* + * Handles repository navigation + */ +class KTNavigationService extends KTCMISBase { + + protected $NavigationService; + + public function __construct(&$ktapi = null, $username = null, $password = null) + { + parent::__construct($ktapi, $username, $password); + // instantiate underlying CMIS service + $this->NavigationService = new CMISNavigationService(); + $this->setInterface(); + } + + public function startSession($username, $password) + { + parent::startSession($username, $password); + $this->setInterface(); + return self::$session; + } + + public function setInterface(&$ktapi = null) + { + parent::setInterface($ktapi); + $this->NavigationService->setInterface(self::$ktapi); + } + + /** + * Get descendents of the specified folder, up to the depth indicated + * + * @param string $repositoryId + * @param string $folderId + * @param boolean $includeAllowableActions + * @param boolean $includeRelationships + * @param string $typeID + * @param int $depth + * @param string $filter + * @return array $descendants + */ + public function getDescendants($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, + $depth = 1, $typeID = 'Any', $filter = '') + { + // TODO optional parameters + $descendantsResult = $this->NavigationService->getDescendants($repositoryId, $folderId, $includeAllowableActions, + $includeRelationships, $depth); + + if (PEAR::isError($descendantsResult)) + { + return array( + "status_code" => 1, + "message" => "Failed getting descendants for folder" + ); + } + + // 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'); + + return array ( + "status_code" => 0, + "results" => $descendants + ); + } + + /** + * Get direct children of the specified folder + * + * @param string $repositoryId + * @param string $folderId + * @param boolean $includeAllowableActions + * @param boolean $includeRelationships + * @param string $typeID + * @param string $filter + * @param int $maxItems + * @param int $skipCount + * @return array $descendants + */ + public function getChildren($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, + $typeID = 'Any', $filter = '', $maxItems = 0, $skipCount = 0) + { + // TODO paging + // TODO optional parameters + $childrenResult = $this->NavigationService->getChildren($repositoryId, $folderId, $includeAllowableActions, $includeRelationships); + + if (PEAR::isError($childrenResult)) + { + return array( + "status_code" => 1, + "message" => "Failed getting descendants for folder" + ); + } + + $children = CMISUtil::decodeObjectHierarchy($childrenResult, 'child'); + + return array( + "status_code" => 0, + "results" => $children + ); + } + + /** + * Gets the parent of the selected folder + * + * @param string $repositoryId + * @param string $folderId + * @param boolean $includeAllowableActions + * @param boolean $includeRelationships + * @param boolean $returnToRoot + * @param string $filter + * @return ancestry[] + */ + public function getFolderParent($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, $returnToRoot, $filter = '') + { + $ancestryResult = $this->NavigationService->getFolderParent($repositoryId, $folderId, $includeAllowableActions, + $includeRelationships, $returnToRoot); + + if (PEAR::isError($ancestryResult)) + { + return array( + "status_code" => 1, + "message" => "Failed getting ancestry for folder" + ); + } + + $ancestry = CMISUtil::decodeObjectHierarchy($ancestryResult, 'child'); + + return array( + "status_code" => 0, + "results" => $ancestry + ); + } + + /** + * 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'); + + return array( + "status_code" => 0, + "results" => $ancestry + ); + } + + /** + * Returns a list of checked out documents from the selected repository + * + * @param string $repositoryId + * @param string $folderId The folder for which checked out docs are requested + * @param string $filter + * @param boolean $includeAllowableActions + * @param boolean $includeRelationships + * @param int $maxItems + * @param int $skipCount + * @return array $checkedout The collection of checked out documents + */ + function getCheckedOutDocs($repositoryId, $includeAllowableActions, $includeRelationships, $folderId = null, $filter = '', + $maxItems = 0, $skipCount = 0) + { + $checkedout = $this->NavigationService->getCheckedOutDocs($repositoryId, $includeAllowableActions, $includeRelationships, + $folderId, $filter, $maxItems, $skipCount); + + if (PEAR::isError($checkedout)) + { + return array( + "status_code" => 1, + "message" => "Failed getting list of checked out documents" + ); + } + + // convert to array format for external code + $co = array(); + foreach ($checkedout as $documentProperties) + { + $co[] = CMISUtil::createObjectPropertiesEntry($documentProperties);; + } + + return array( + "status_code" => 0, + "results" => $co + ); + } + +} + +?> \ No newline at end of file diff --git a/lib/api/ktcmis/ktObjectService.inc.php b/lib/api/ktcmis/ktObjectService.inc.php new file mode 100644 index 0000000..a7c5fcd --- /dev/null +++ b/lib/api/ktcmis/ktObjectService.inc.php @@ -0,0 +1,321 @@ +. +* +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, +* California 94120-7775, or email info@knowledgetree.com. +* +* The interactive user interfaces in modified source and object code versions +* of this program must display Appropriate Legal Notices, as required under +* Section 5 of the GNU General Public License version 3. +* +* In accordance with Section 7(b) of the GNU General Public License version 3, +* these Appropriate Legal Notices must retain the display of the "Powered by +* KnowledgeTree" logo and retain the original copyright notice. If the display of the +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices +* must display the words "Powered by KnowledgeTree" and retain the original +* copyright notice. +* +* @copyright 2008-2009, KnowledgeTree Inc. +* @license GNU General Public License version 3 +* @author KnowledgeTree Team +* @package KTCMIS +* @version Version 0.9 +*/ + +require_once(realpath(dirname(__FILE__) . '/ktService.inc.php')); +require_once(CMIS_DIR . '/services/CMISObjectService.inc.php'); + +/** + * Handles requests for and actions on Folders and Documents + */ +class KTObjectService extends KTCMISBase { + + protected $ObjectService; + + public function __construct(&$ktapi = null, $username = null, $password = null) + { + parent::__construct($ktapi, $username, $password); + // instantiate underlying CMIS service + $this->ObjectService = new CMISObjectService(); + $this->setInterface(); + } + + public function startSession($username, $password) + { + parent::startSession($username, $password); + $this->setInterface(); + return self::$session; + } + + public function setInterface(&$ktapi = null) + { + parent::setInterface($ktapi); + $this->ObjectService->setInterface(self::$ktapi); + } + + /** + * Gets the properties for the selected object + * + * @param string $repositoryId + * @param string $objectId + * @param boolean $includeAllowableActions + * @param boolean $includeRelationships + * @param string $returnVersion + * @param string $filter + * @return properties[] + */ + public function getProperties($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, + $returnVersion = false, $filter = '') + { + try { + $propertyCollection = $this->ObjectService->getProperties($repositoryId, $objectId, $includeAllowableActions, + $includeRelationships); + } + catch (Exception $e) + { + return array( + "status_code" => 1, + "message" => $e->getMessage() + ); + } + + $properties = CMISUtil::createObjectPropertiesEntry($propertyCollection); + + return array( + "status_code" => 0, + "results" => $properties + ); + } + + /** + * Creates a new document within the repository + * + * @param string $repositoryId The repository to which the document must be added + * @param string $typeId Object Type id for the document object being created + * @param array $properties Array of properties which must be applied to the created document object + * @param string $folderId The id of the folder which will be the parent of the created document object + * This parameter is optional IF unfilingCapability is supported + * @param contentStream $contentStream optional content stream data + * @param string $versioningState optional version state value: checkedout/major/minor + * @return string $objectId The id of the created folder object + */ + public function createDocument($repositoryId, $typeId, $properties, $folderId = null, + $contentStream = null, $versioningState = null) + { + $objectId = null; + + try { + $objectId = $this->ObjectService->createDocument($repositoryId, $typeId, $properties, $folderId, + $contentStream, $versioningState); + } + catch (Exception $e) + { + return array( + "status_code" => 1, + "message" => $e->getMessage() + ); + } + + return array( + 'status_code' => 0, + 'results' => $objectId + ); + } + + /** + * Creates a new folder within the repository + * + * @param string $repositoryId The repository to which the folder must be added + * @param string $typeId Object Type id for the folder object being created + * @param array $properties Array of properties which must be applied to the created folder object + * @param string $folderId The id of the folder which will be the parent of the created folder object + * @return string $objectId The id of the created folder object + */ + public function createFolder($repositoryId, $typeId, $properties, $folderId) + { + $objectId = null; + + try { + $objectId = $this->ObjectService->createFolder($repositoryId, $typeId, $properties, $folderId); + } + catch (Exception $e) + { + return array( + "status_code" => 1, + "message" => $e->getMessage() + ); + } + + return array( + 'status_code' => 0, + 'results' => $objectId + ); + } + + /** + * Fetches the content stream data for an object + * + * @param string $repositoryId + * @param string $objectId + * @return string $contentStream (binary or text data) + */ + function getContentStream($repositoryId, $objectId) + { + try { + $contentStream = $this->ObjectService->getContentStream($repositoryId, $objectId); + } + catch (Exception $e) + { + return array( + "status_code" => 1, + "message" => $e->getMessage() + ); + } + + return array( + 'status_code' => 0, + 'results' => $contentStream + ); + } + + /** + * Moves a fileable object from one folder to another. + * + * @param object $repositoryId + * @param object $objectId + * @param object $changeToken [optional] + * @param object $targetFolderId + * @param object $sourceFolderId [optional] + */ + public function moveObject($repositoryId, $objectId, $changeToken = '', $targetFolderId, $sourceFolderId = null) + { + try { + $this->ObjectService->moveObject($repositoryId, $objectId, $changeToken, $targetFolderId, $sourceFolderId); + } + catch (Exception $e) + { + return array( + "status_code" => 1, + "message" => $e->getMessage() + ); + } + + return array( + 'status_code' => 0, + 'results' => $objectId + ); + } + + /** + * Deletes an object from the repository + * + * @param string $repositoryId + * @param string $objectId + * @param string $changeToken [optional] + * @return array + */ + // NOTE Invoking this service method on an object SHALL not delete the entire version series for a Document Object. + // To delete an entire version series, use the deleteAllVersions() service + public function deleteObject($repositoryId, $objectId, $changeToken = null) + { + try { + $this->ObjectService->deleteObject($repositoryId, $objectId, $changeToken); + } + catch (Exception $e) + { + return array( + "status_code" => 1, + "message" => $e->getMessage() + ); + } + + return array( + 'status_code' => 0, + 'results' => $objectId + ); + } + + public function deleteTree($repositoryId, $objectId, $changeToken = null, $unfileNonfolderObject = 'delete', $continueOnFailure = false) + { + try { + $result = $this->ObjectService->deleteTree($repositoryId, $objectId, $changeToken, $unfileNonfolderObject, $continueOnFailure); + } + catch (Exception $e) + { + return array( + "status_code" => 1, + "message" => $e->getMessage() + ); + } + + // check whether there is a list of items which did not delete + if (count($result) > 0) + { + return array( + "status_code" => 1, + "message" => $result + ); + } + + return array( + 'status_code' => 0, + 'results' => $objectId + ); + } + + /** + * Sets the content stream data for an existing document + * + * if $overwriteFlag = TRUE, the new content stream is applied whether or not the document has an existing content stream + * if $overwriteFlag = FALSE, the new content stream is applied only if the document does not have an existing content stream + * + * NOTE A Repository MAY automatically create new Document versions as part of this service method. + * Therefore, the documentId output NEED NOT be identical to the documentId input. + * + * @param string $repositoryId + * @param string $documentId + * @param boolean $overwriteFlag + * @param string $contentStream + * @param string $changeToken + * @return string $documentId + */ + function setContentStream($repositoryId, $documentId, $overwriteFlag, $contentStream, $changeToken = null) + { + try { + $documentId = $this->ObjectService->setContentStream($repositoryId, $documentId, $overwriteFlag, $contentStream, $changeToken); + } + catch (Exception $e) + { + return array( + "status_code" => 1, + "message" => $e->getMessage() + ); + } + + return array( + 'status_code' => 0, + 'results' => $documentId + ); + } + +} + +?> \ No newline at end of file diff --git a/lib/api/ktcmis/ktRepositoryService.inc.php b/lib/api/ktcmis/ktRepositoryService.inc.php new file mode 100644 index 0000000..4b5423c --- /dev/null +++ b/lib/api/ktcmis/ktRepositoryService.inc.php @@ -0,0 +1,187 @@ +. +* +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, +* California 94120-7775, or email info@knowledgetree.com. +* +* The interactive user interfaces in modified source and object code versions +* of this program must display Appropriate Legal Notices, as required under +* Section 5 of the GNU General Public License version 3. +* +* In accordance with Section 7(b) of the GNU General Public License version 3, +* these Appropriate Legal Notices must retain the display of the "Powered by +* KnowledgeTree" logo and retain the original copyright notice. If the display of the +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices +* must display the words "Powered by KnowledgeTree" and retain the original +* copyright notice. +* +* @copyright 2008-2009, KnowledgeTree Inc. +* @license GNU General Public License version 3 +* @author KnowledgeTree Team +* @package KTCMIS +* @version Version 0.9 +*/ + +require_once(realpath(dirname(__FILE__) . '/ktService.inc.php')); +require_once(CMIS_DIR . '/services/CMISRepositoryService.inc.php'); + +/** + * Handles low level repository information queries + */ +class KTRepositoryService extends KTCMISBase { + + protected $RepositoryService; + + public function __construct() + { + // we don't need to call the parent constructor here as there is no ktapi involved + // instantiate underlying CMIS service + $this->RepositoryService = new CMISRepositoryService(); + } + + /** + * Fetch a list of all available repositories + * + * NOTE Since we only have one repository at the moment, this is expected to only return one result + * + * @return repositoryList[] + */ + public function getRepositories() + { + $repositories = $this->RepositoryService->getRepositories(); + if (PEAR::isError($repositories)) + { + return array( + "status_code" => 1, + "message" => "Failed getting repositories" + ); + } + + // extract the required info fields into array format for easy encoding; + $count = 0; + $repositoryList = array(); + foreach ($repositories as $repository) + { + $repositoryList[$count]['repositoryId'] = $repository->getRepositoryId(); + $repositoryList[$count]['repositoryName'] = $repository->getRepositoryName(); + $repositoryList[$count]['repositoryURI'] = $repository->getRepositoryURI(); + ++$count; + } + + return array( + "status_code" => 0, + "results" => $repositoryList + ); + } + + /** + * Fetches information about the selected repository + * + * @param string $repositoryId + */ + public function getRepositoryInfo($repositoryId) + { + $repositoryInfo = $this->RepositoryService->getRepositoryInfo($repositoryId); + if (PEAR::isError($repositoryInfo)) + { + return array( + "status_code" => 1, + "message" => "Failed getting repository information" + ); + } + + // TODO output this manually, the function works but only for some objects so rather avoid it completely? + // NOTE the problems appear to be due to recursive objects + return array ( + "status_code" => 0, + "results" => CMISUtil::objectToArray($repositoryInfo) + ); + } + + /** + * Fetch the list of supported object types for the selected repository + * + * @param string $repositoryId + */ + public function getTypes($repositoryId, $typeId = '', $returnPropertyDefinitions = false, + $maxItems = 0, $skipCount = 0, &$hasMoreItems = false) + { + try { + $repositoryObjectTypeResult = $this->RepositoryService->getTypes($repositoryId, $typeId, $returnPropertyDefinitions, + $maxItems, $skipCount, $hasMoreItems); + } + catch (Exception $e) + { + return array( + "status_code" => 1, + "message" => $e->getMessage() + ); + } + + // format as array style output + // NOTE only concerned with attributes at this time + // TODO add support for properties + foreach($repositoryObjectTypeResult as $key => $objectType) + { + $repositoryObjectTypes[$key] = $objectType['attributes']; + // TODO properties + // $repositoryObjectTypes[$key]['properties'] = $objectType['properties']; + } + + return array ( + "status_code" => 0, + "results" => $repositoryObjectTypes + ); + } + + /** + * Fetch the object type definition for the requested type + * + * @param string $repositoryId + * @param string $typeId + */ + public function getTypeDefinition($repositoryId, $typeId) + { + try { + $typeDefinitionResult = $this->RepositoryService->getTypeDefinition($repositoryId, $typeId); + } + catch (Exception $e) + { + return array( + "status_code" => 1, + "message" => $e->getMessage() + ); + } + + // format as array style output + // NOTE only concerned with attributes at this time + // TODO add support for properties + $typeDefinition = $typeDefinitionResult['attributes']; + + return array ( + "status_code" => 0, + "results" => $typeDefinition + ); + } + +} + +?> \ No newline at end of file diff --git a/lib/api/ktcmis/ktService.inc.php b/lib/api/ktcmis/ktService.inc.php new file mode 100644 index 0000000..e3d33da --- /dev/null +++ b/lib/api/ktcmis/ktService.inc.php @@ -0,0 +1,122 @@ +. +* +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, +* California 94120-7775, or email info@knowledgetree.com. +* +* The interactive user interfaces in modified source and object code versions +* of this program must display Appropriate Legal Notices, as required under +* Section 5 of the GNU General Public License version 3. +* +* In accordance with Section 7(b) of the GNU General Public License version 3, +* these Appropriate Legal Notices must retain the display of the "Powered by +* KnowledgeTree" logo and retain the original copyright notice. If the display of the +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices +* must display the words "Powered by KnowledgeTree" and retain the original +* copyright notice. +* +* @copyright 2008-2009, KnowledgeTree Inc. +* @license GNU General Public License version 3 +* @author KnowledgeTree Team +* @package KTCMIS +* @version Version 0.9 +*/ + +require_once(realpath(dirname(__FILE__) . '/../../../config/dmsDefaults.php')); +require_once(KT_DIR . '/ktapi/ktapi.inc.php'); + +define ('CMIS_DIR', KT_LIB_DIR . '/api/ktcmis'); +require_once(CMIS_DIR . '/exceptions/PermissionDeniedException.inc.php'); +require_once(CMIS_DIR . '/util/CMISUtil.inc.php'); + +/** + * Base class for all KT CMIS classes + * Handles authentication + * + * This class is required for all CMIS Service classes + */ +class KTCMISBase { + + // we want all child classes to share the ktapi and session instances, no matter where they are set from, + // so we declare them as static + static protected $ktapi; + static protected $session; + + public function __construct(&$ktapi = null, $username = null, $password = null) + { + // TODO confirm KTAPI instance active??? shouldn't really be responsibility of this code + if (is_null($ktapi) && (!is_null($username) && !is_null($password))) { + $this->startSession($username, $password); + } + else if (!is_null($ktapi)) { + self::$ktapi = $ktapi; + self::$session = self::$ktapi->get_session(); + } + } + + // TODO this probably does not belong here??? probably should require all auth external, handled by transport protocol. + // perhaps simple refusal to execute without valid session? + // NOTE left in to allow transport protocol to delegate auth to this level, but not actually used in any code at present + public function startSession($username, $password) + { + // attempt to recover session if one exists + if (!is_null(self::$session) && !PEAR::isError(self::$session)) + { + self::$session =& self::$ktapi->get_active_session(self::$session->get_sessionid()); + } + + // start new session if no existing session or problem getting existing session (expired, etc...) + if (is_null(self::$session) || PEAR::isError(self::$session)) + { + self::$ktapi = new KTAPI(); + self::$session =& self::$ktapi->start_session($username, $password); + } + + // failed authentication? + if (PEAR::isError(self::$session)) + { + throw new PermissionDeniedException('You must be authenticated to perform this action'); + } + + return self::$session; + } + + public function setInterface(&$ktapi = null) + { + if (!is_null($ktapi)) { + self::$ktapi = $ktapi; + } + } + + public function getInterface() + { + return self::$ktapi; + } + + public function getSession() + { + return self::$session; + } + + // TODO what about destroying sessions? only on logout (which is not offered by the CMIS clients tested so far) +} + +?> \ No newline at end of file diff --git a/lib/api/ktcmis/ktVersioningService.inc.php b/lib/api/ktcmis/ktVersioningService.inc.php new file mode 100644 index 0000000..cc45c39 --- /dev/null +++ b/lib/api/ktcmis/ktVersioningService.inc.php @@ -0,0 +1,197 @@ +. +* +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, +* California 94120-7775, or email info@knowledgetree.com. +* +* The interactive user interfaces in modified source and object code versions +* of this program must display Appropriate Legal Notices, as required under +* Section 5 of the GNU General Public License version 3. +* +* In accordance with Section 7(b) of the GNU General Public License version 3, +* these Appropriate Legal Notices must retain the display of the "Powered by +* KnowledgeTree" logo and retain the original copyright notice. If the display of the +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices +* must display the words "Powered by KnowledgeTree" and retain the original +* copyright notice. +* +* @copyright 2008-2009, KnowledgeTree Inc. +* @license GNU General Public License version 3 +* @author KnowledgeTree Team +* @package KTCMIS +* @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. + */ + +require_once(realpath(dirname(__FILE__) . '/ktService.inc.php')); +require_once(CMIS_DIR . '/services/CMISVersioningService.inc.php'); + +/** + * Handles requests for and actions on versionable objects + */ +class KTVersioningService extends KTCMISBase { + + protected $VersioningService; + + public function __construct(&$ktapi = null, $username = null, $password = null) + { + parent::__construct($ktapi, $username, $password); + // instantiate underlying CMIS service + $this->VersioningService = new CMISVersioningService(); + $this->setInterface(); + } + + public function startSession($username, $password) + { + parent::startSession($username, $password); + $this->setInterface(); + return self::$session; + } + + public function setInterface(&$ktapi = null) + { + parent::setInterface($ktapi); + $this->VersioningService->setInterface(self::$ktapi); + } + + /** + * Deletes all Document Objects in the specified Version Series, including the Private Working Copy + * + * @param string $repositoryId + * @param string $versionSeriesId + * @return boolean true if successful + */ + public function deleteAllVersions($repositoryId, $versionSeriesId) + { + try { + $result = $this->VersioningService->deleteAllVersions($repositoryId, $versionSeriesId); + } + catch (Exception $e) + { + return array( + "status_code" => 1, + "message" => $e->getMessage() + ); + } + + return array( + 'status_code' => 0, + 'results' => $result + ); + } + + /** + * Checks out a document and creates the PWC (Private Working Copy) which will represent the checked out document + * + * @param string $repositoryId + * @param string $documentId + * @param string $changeToken [optional] + * @return array results + */ + // TODO set up delivery of content stream? or is that up to the CMIS client? + public function checkOut($repositoryId, $documentId, $changeToken = '') + { + try { + $result = $this->VersioningService->checkOut($repositoryId, $documentId, $changeToken); + } + catch (Exception $e) + { + return array( + "status_code" => 1, + "message" => $e->getMessage() + ); + } + + return array( + 'status_code' => 0, + 'results' => (!empty($result) ? $result : 'Document Checked Out') + ); + } + + /** + * Reverses the effect of a checkout: I.E. deletes the PWC (Private Working Copy) and re-sets the status of the document to "not checked out" + * + * @param string $repositoryId + * @param string $documentId + * @param string $changeToken [optional] + */ + // TODO exceptions: + // • ConstraintViolationException: The Repository SHALL throw this exception if ANY of the following conditions are met: + // o The Document’s Object-Type definition’s versionable attribute is FALSE. + // • updateConflictException + // • versioningException + public function cancelCheckOut($repositoryId, $documentId, $changeToken = '') + { + try { + $result = $this->VersioningService->cancelCheckOut($repositoryId, $documentId, $changeToken); + } + catch (Exception $e) + { + return array( + "status_code" => 1, + "message" => $e->getMessage() + ); + } + + return array( + 'status_code' => 0, + 'results' => (!empty($result) ? $result : 'Document Checkout Cancelled') + ); + } + + /** + * Checks in a checked out document + * + * @param string $repositoryId + * @param string $documentId + * @param boolean $major + * @param string $changeToken [optional] + * @param array $properties [optional] + * @param contentStream $contentStream [optional] + * @param string $checkinComment [optional] + * @return string $documentId + */ + public function checkIn($repositoryId, $documentId, $major, $contentStream = null, $changeToken = '', $properties = array(), $checkinComment = '') + { + try { + $result = $this->VersioningService->checkIn($repositoryId, $documentId, $major, $contentStream, $changeToken, $properties, $checkinComment); + } + catch (Exception $e) + { + return array( + "status_code" => 1, + "message" => $e->getMessage() + ); + } + + return array( + 'status_code' => 0, + 'results' => (!empty($result) ? $result : 'Document Checked In Successfully') + ); + } + +} + +?> \ No newline at end of file diff --git a/lib/api/ktcmis/ktcmis.inc.php b/lib/api/ktcmis/ktcmis.inc.php deleted file mode 100644 index d59fb5b..0000000 --- a/lib/api/ktcmis/ktcmis.inc.php +++ /dev/null @@ -1,898 +0,0 @@ -. -* -* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, -* California 94120-7775, or email info@knowledgetree.com. -* -* The interactive user interfaces in modified source and object code versions -* of this program must display Appropriate Legal Notices, as required under -* Section 5 of the GNU General Public License version 3. -* -* In accordance with Section 7(b) of the GNU General Public License version 3, -* these Appropriate Legal Notices must retain the display of the "Powered by -* KnowledgeTree" logo and retain the original copyright notice. If the display of the -* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices -* must display the words "Powered by KnowledgeTree" and retain the original -* copyright notice. -* -* @copyright 2008-2009, KnowledgeTree Inc. -* @license GNU General Public License version 3 -* @author KnowledgeTree Team -* @package KTCMIS -* @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(KT_DIR . '/ktapi/ktapi.inc.php'); - -define ('CMIS_DIR', KT_LIB_DIR . '/api/ktcmis'); -require_once(CMIS_DIR . '/exceptions/PermissionDeniedException.inc.php'); -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 . '/services/CMISVersioningService.inc.php'); -require_once(CMIS_DIR . '/util/CMISUtil.inc.php'); - -/** - * Base class for all KT CMIS classes - * Handles authentication - */ -class KTCMISBase { - - // we want all child classes to share the ktapi and session instances, no matter where they are set from, - // so we declare them as static - static protected $ktapi; - static protected $session; - - public function __construct(&$ktapi = null, $username = null, $password = null) - { - // TODO confirm KTAPI instance active??? shouldn't really be responsibility of this code - if (is_null($ktapi) && (!is_null($username) && !is_null($password))) { - $this->startSession($username, $password); - } - else { - self::$ktapi = $ktapi; - self::$session = self::$ktapi->get_session(); - } - } - - // TODO this probably does not belong here??? probably should require all auth external, handled by transport protocol. - // perhaps simple refusal to execute without valid session? - // NOTE left in to allow transport protocol to delegate auth to this level, but not actually used in any code at present - public function startSession($username, $password) - { - // attempt to recover session if one exists - if (!is_null(self::$session) && !PEAR::isError(self::$session)) - { - self::$session =& self::$ktapi->get_active_session(self::$session->get_sessionid()); - } - - // start new session if no existing session or problem getting existing session (expired, etc...) - if (is_null(self::$session) || PEAR::isError(self::$session)) - { - self::$ktapi = new KTAPI(); - self::$session =& self::$ktapi->start_session($username, $password); - } - - // failed authentication? - if (PEAR::isError(self::$session)) - { - throw new PermissionDeniedException('You must be authenticated to perform this action'); - } - - return self::$session; - } - - public function setInterface(&$ktapi = null) - { - if (!is_null($ktapi)) { - self::$ktapi = $ktapi; - } - } - - public function getInterface() - { - return self::$ktapi; - } - - public function getSession() - { - return self::$session; - } - - // TODO what about destroying sessions? only on logout (which is not offered by the CMIS clients tested so far) -} - -/** - * Handles low level repository information queries - */ -class KTRepositoryService extends KTCMISBase { - - protected $RepositoryService; - - public function __construct() - { - // instantiate underlying CMIS service - $this->RepositoryService = new CMISRepositoryService(); - } - - /** - * Fetch a list of all available repositories - * - * NOTE Since we only have one repository at the moment, this is expected to only return one result - * - * @return repositoryList[] - */ - public function getRepositories() - { - $repositories = $this->RepositoryService->getRepositories(); - if (PEAR::isError($repositories)) - { - return array( - "status_code" => 1, - "message" => "Failed getting repositories" - ); - } - - // extract the required info fields into array format for easy encoding; - $count = 0; - $repositoryList = array(); - foreach ($repositories as $repository) - { - $repositoryList[$count]['repositoryId'] = $repository->getRepositoryId(); - $repositoryList[$count]['repositoryName'] = $repository->getRepositoryName(); - $repositoryList[$count]['repositoryURI'] = $repository->getRepositoryURI(); - ++$count; - } - - return array( - "status_code" => 0, - "results" => $repositoryList - ); - } - - /** - * Fetches information about the selected repository - * - * @param string $repositoryId - */ - public function getRepositoryInfo($repositoryId) - { - $repositoryInfo = $this->RepositoryService->getRepositoryInfo($repositoryId); - if (PEAR::isError($repositoryInfo)) - { - return array( - "status_code" => 1, - "message" => "Failed getting repository information" - ); - } - - // TODO output this manually, the function works but only for some objects so rather avoid it completely? - // NOTE the problems appear to be due to recursive objects - return array ( - "status_code" => 0, - "results" => CMISUtil::objectToArray($repositoryInfo) - ); - } - - /** - * Fetch the list of supported object types for the selected repository - * - * @param string $repositoryId - */ - public function getTypes($repositoryId, $typeId = '', $returnPropertyDefinitions = false, - $maxItems = 0, $skipCount = 0, &$hasMoreItems = false) - { - try { - $repositoryObjectTypeResult = $this->RepositoryService->getTypes($repositoryId, $typeId, $returnPropertyDefinitions, - $maxItems, $skipCount, $hasMoreItems); - } - catch (Exception $e) - { - return array( - "status_code" => 1, - "message" => $e->getMessage() - ); - } - - // format as array style output - // NOTE only concerned with attributes at this time - // TODO add support for properties - foreach($repositoryObjectTypeResult as $key => $objectType) - { - $repositoryObjectTypes[$key] = $objectType['attributes']; - // TODO properties - // $repositoryObjectTypes[$key]['properties'] = $objectType['properties']; - } - - return array ( - "status_code" => 0, - "results" => $repositoryObjectTypes - ); - } - - /** - * Fetch the object type definition for the requested type - * - * @param string $repositoryId - * @param string $typeId - */ - public function getTypeDefinition($repositoryId, $typeId) - { - try { - $typeDefinitionResult = $this->RepositoryService->getTypeDefinition($repositoryId, $typeId); - } - catch (Exception $e) - { - return array( - "status_code" => 1, - "message" => $e->getMessage() - ); - } - - // format as array style output - // NOTE only concerned with attributes at this time - // TODO add support for properties - $typeDefinition = $typeDefinitionResult['attributes']; - - return array ( - "status_code" => 0, - "results" => $typeDefinition - ); - } - -} - -/* - * Handles repository navigation - */ -class KTNavigationService extends KTCMISBase { - - protected $NavigationService; - - public function __construct(&$ktapi = null, $username = null, $password = null) - { - parent::__construct($ktapi, $username, $password); - // instantiate underlying CMIS service - $this->NavigationService = new CMISNavigationService(); - $this->setInterface(); - } - - public function startSession($username, $password) - { - parent::startSession($username, $password); - $this->setInterface(); - return self::$session; - } - - public function setInterface(&$ktapi = null) - { - parent::setInterface($ktapi); - $this->NavigationService->setInterface(self::$ktapi); - } - - /** - * Get descendents of the specified folder, up to the depth indicated - * - * @param string $repositoryId - * @param string $folderId - * @param boolean $includeAllowableActions - * @param boolean $includeRelationships - * @param string $typeID - * @param int $depth - * @param string $filter - * @return array $descendants - */ - public function getDescendants($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, - $depth = 1, $typeID = 'Any', $filter = '') - { - // TODO optional parameters - $descendantsResult = $this->NavigationService->getDescendants($repositoryId, $folderId, $includeAllowableActions, - $includeRelationships, $depth); - - if (PEAR::isError($descendantsResult)) - { - return array( - "status_code" => 1, - "message" => "Failed getting descendants for folder" - ); - } - - // 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'); - - return array ( - "status_code" => 0, - "results" => $descendants - ); - } - - /** - * Get direct children of the specified folder - * - * @param string $repositoryId - * @param string $folderId - * @param boolean $includeAllowableActions - * @param boolean $includeRelationships - * @param string $typeID - * @param string $filter - * @param int $maxItems - * @param int $skipCount - * @return array $descendants - */ - public function getChildren($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, - $typeID = 'Any', $filter = '', $maxItems = 0, $skipCount = 0) - { - // TODO paging - // TODO optional parameters - $childrenResult = $this->NavigationService->getChildren($repositoryId, $folderId, $includeAllowableActions, $includeRelationships); - - if (PEAR::isError($childrenResult)) - { - return array( - "status_code" => 1, - "message" => "Failed getting descendants for folder" - ); - } - - $children = CMISUtil::decodeObjectHierarchy($childrenResult, 'child'); - - return array( - "status_code" => 0, - "results" => $children - ); - } - - /** - * Gets the parent of the selected folder - * - * @param string $repositoryId - * @param string $folderId - * @param boolean $includeAllowableActions - * @param boolean $includeRelationships - * @param boolean $returnToRoot - * @param string $filter - * @return ancestry[] - */ - public function getFolderParent($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, $returnToRoot, $filter = '') - { - $ancestryResult = $this->NavigationService->getFolderParent($repositoryId, $folderId, $includeAllowableActions, - $includeRelationships, $returnToRoot); - - if (PEAR::isError($ancestryResult)) - { - return array( - "status_code" => 1, - "message" => "Failed getting ancestry for folder" - ); - } - - $ancestry = CMISUtil::decodeObjectHierarchy($ancestryResult, 'child'); - - return array( - "status_code" => 0, - "results" => $ancestry - ); - } - - /** - * 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'); - - return array( - "status_code" => 0, - "results" => $ancestry - ); - } - - /** - * Returns a list of checked out documents from the selected repository - * - * @param string $repositoryId - * @param string $folderId The folder for which checked out docs are requested - * @param string $filter - * @param boolean $includeAllowableActions - * @param boolean $includeRelationships - * @param int $maxItems - * @param int $skipCount - * @return array $checkedout The collection of checked out documents - */ - function getCheckedOutDocs($repositoryId, $includeAllowableActions, $includeRelationships, $folderId = null, $filter = '', - $maxItems = 0, $skipCount = 0) - { - $checkedout = $this->NavigationService->getCheckedOutDocs($repositoryId, $includeAllowableActions, $includeRelationships, - $folderId, $filter, $maxItems, $skipCount); - - if (PEAR::isError($checkedout)) - { - return array( - "status_code" => 1, - "message" => "Failed getting list of checked out documents" - ); - } - - // convert to array format for external code - $co = array(); - foreach ($checkedout as $documentProperties) - { - $co[] = CMISUtil::createObjectPropertiesEntry($documentProperties);; - } - - return array( - "status_code" => 0, - "results" => $co - ); - } - -} - -/** - * Handles requests for and actions on Folders and Documents - */ -class KTObjectService extends KTCMISBase { - - protected $ObjectService; - - public function __construct(&$ktapi = null, $username = null, $password = null) - { - parent::__construct($ktapi, $username, $password); - // instantiate underlying CMIS service - $this->ObjectService = new CMISObjectService(); - $this->setInterface(); - } - - public function startSession($username, $password) - { - parent::startSession($username, $password); - $this->setInterface(); - return self::$session; - } - - public function setInterface(&$ktapi = null) - { - parent::setInterface($ktapi); - $this->ObjectService->setInterface(self::$ktapi); - } - - /** - * Gets the properties for the selected object - * - * @param string $repositoryId - * @param string $objectId - * @param boolean $includeAllowableActions - * @param boolean $includeRelationships - * @param string $returnVersion - * @param string $filter - * @return properties[] - */ - public function getProperties($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, - $returnVersion = false, $filter = '') - { - try { - $propertyCollection = $this->ObjectService->getProperties($repositoryId, $objectId, $includeAllowableActions, - $includeRelationships); - } - catch (Exception $e) - { - return array( - "status_code" => 1, - "message" => $e->getMessage() - ); - } - - $properties = CMISUtil::createObjectPropertiesEntry($propertyCollection); - - return array( - "status_code" => 0, - "results" => $properties - ); - } - - /** - * Creates a new document within the repository - * - * @param string $repositoryId The repository to which the document must be added - * @param string $typeId Object Type id for the document object being created - * @param array $properties Array of properties which must be applied to the created document object - * @param string $folderId The id of the folder which will be the parent of the created document object - * This parameter is optional IF unfilingCapability is supported - * @param contentStream $contentStream optional content stream data - * @param string $versioningState optional version state value: checkedout/major/minor - * @return string $objectId The id of the created folder object - */ - public function createDocument($repositoryId, $typeId, $properties, $folderId = null, - $contentStream = null, $versioningState = null) - { - $objectId = null; - - try { - $objectId = $this->ObjectService->createDocument($repositoryId, $typeId, $properties, $folderId, - $contentStream, $versioningState); - } - catch (Exception $e) - { - return array( - "status_code" => 1, - "message" => $e->getMessage() - ); - } - - return array( - 'status_code' => 0, - 'results' => $objectId - ); - } - - /** - * Creates a new folder within the repository - * - * @param string $repositoryId The repository to which the folder must be added - * @param string $typeId Object Type id for the folder object being created - * @param array $properties Array of properties which must be applied to the created folder object - * @param string $folderId The id of the folder which will be the parent of the created folder object - * @return string $objectId The id of the created folder object - */ - public function createFolder($repositoryId, $typeId, $properties, $folderId) - { - $objectId = null; - - try { - $objectId = $this->ObjectService->createFolder($repositoryId, $typeId, $properties, $folderId); - } - catch (Exception $e) - { - return array( - "status_code" => 1, - "message" => $e->getMessage() - ); - } - - return array( - 'status_code' => 0, - 'results' => $objectId - ); - } - - /** - * Fetches the content stream data for an object - * - * @param string $repositoryId - * @param string $objectId - * @return string $contentStream (binary or text data) - */ - function getContentStream($repositoryId, $objectId) - { - try { - $contentStream = $this->ObjectService->getContentStream($repositoryId, $objectId); - } - catch (Exception $e) - { - return array( - "status_code" => 1, - "message" => $e->getMessage() - ); - } - - return array( - 'status_code' => 0, - 'results' => $contentStream - ); - } - - /** - * Moves a fileable object from one folder to another. - * - * @param object $repositoryId - * @param object $objectId - * @param object $changeToken [optional] - * @param object $targetFolderId - * @param object $sourceFolderId [optional] - */ - public function moveObject($repositoryId, $objectId, $changeToken = '', $targetFolderId, $sourceFolderId = null) - { - try { - $this->ObjectService->moveObject($repositoryId, $objectId, $changeToken, $targetFolderId, $sourceFolderId); - } - catch (Exception $e) - { - return array( - "status_code" => 1, - "message" => $e->getMessage() - ); - } - - return array( - 'status_code' => 0, - 'results' => $objectId - ); - } - - /** - * Deletes an object from the repository - * - * @param string $repositoryId - * @param string $objectId - * @param string $changeToken [optional] - * @return array - */ - // NOTE Invoking this service method on an object SHALL not delete the entire version series for a Document Object. - // To delete an entire version series, use the deleteAllVersions() service - public function deleteObject($repositoryId, $objectId, $changeToken = null) - { - try { - $this->ObjectService->deleteObject($repositoryId, $objectId, $changeToken); - } - catch (Exception $e) - { - return array( - "status_code" => 1, - "message" => $e->getMessage() - ); - } - - return array( - 'status_code' => 0, - 'results' => $objectId - ); - } - - public function deleteTree($repositoryId, $objectId, $changeToken = null, $unfileNonfolderObject = 'delete', $continueOnFailure = false) - { - try { - $result = $this->ObjectService->deleteTree($repositoryId, $objectId, $changeToken, $unfileNonfolderObject, $continueOnFailure); - } - catch (Exception $e) - { - return array( - "status_code" => 1, - "message" => $e->getMessage() - ); - } - - // check whether there is a list of items which did not delete - if (count($result) > 0) - { - return array( - "status_code" => 1, - "message" => $result - ); - } - - return array( - 'status_code' => 0, - 'results' => $objectId - ); - } - - /** - * Sets the content stream data for an existing document - * - * if $overwriteFlag = TRUE, the new content stream is applied whether or not the document has an existing content stream - * if $overwriteFlag = FALSE, the new content stream is applied only if the document does not have an existing content stream - * - * NOTE A Repository MAY automatically create new Document versions as part of this service method. - * Therefore, the documentId output NEED NOT be identical to the documentId input. - * - * @param string $repositoryId - * @param string $documentId - * @param boolean $overwriteFlag - * @param string $contentStream - * @param string $changeToken - * @return string $documentId - */ - function setContentStream($repositoryId, $documentId, $overwriteFlag, $contentStream, $changeToken = null) - { - try { - $documentId = $this->ObjectService->setContentStream($repositoryId, $documentId, $overwriteFlag, $contentStream, $changeToken); - } - catch (Exception $e) - { - return array( - "status_code" => 1, - "message" => $e->getMessage() - ); - } - - return array( - 'status_code' => 0, - 'results' => $documentId - ); - } - -} - -/** - * Handles requests for and actions on versionable objects - */ -class KTVersioningService extends KTCMISBase { - - protected $VersioningService; - - public function __construct(&$ktapi = null, $username = null, $password = null) - { - parent::__construct($ktapi, $username, $password); - // instantiate underlying CMIS service - $this->VersioningService = new CMISVersioningService(); - $this->setInterface(); - } - - public function startSession($username, $password) - { - parent::startSession($username, $password); - $this->setInterface(); - return self::$session; - } - - public function setInterface(&$ktapi = null) - { - parent::setInterface($ktapi); - $this->VersioningService->setInterface(self::$ktapi); - } - - /** - * Deletes all Document Objects in the specified Version Series, including the Private Working Copy - * - * @param string $repositoryId - * @param string $versionSeriesId - * @return boolean true if successful - */ - public function deleteAllVersions($repositoryId, $versionSeriesId) - { - try { - $result = $this->VersioningService->deleteAllVersions($repositoryId, $versionSeriesId); - } - catch (Exception $e) - { - return array( - "status_code" => 1, - "message" => $e->getMessage() - ); - } - - return array( - 'status_code' => 0, - 'results' => $result - ); - } - - /** - * Checks out a document and creates the PWC (Private Working Copy) which will represent the checked out document - * - * @param string $repositoryId - * @param string $documentId - * @param string $changeToken [optional] - * @return array results - */ - // TODO set up delivery of content stream? or is that up to the CMIS client? - public function checkOut($repositoryId, $documentId, $changeToken = '') - { - try { - $result = $this->VersioningService->checkOut($repositoryId, $documentId, $changeToken); - } - catch (Exception $e) - { - return array( - "status_code" => 1, - "message" => $e->getMessage() - ); - } - - return array( - 'status_code' => 0, - 'results' => (!empty($result) ? $result : 'Document Checked Out') - ); - } - - /** - * Reverses the effect of a checkout: I.E. deletes the PWC (Private Working Copy) and re-sets the status of the document to "not checked out" - * - * @param string $repositoryId - * @param string $documentId - * @param string $changeToken [optional] - */ - // TODO exceptions: - // • ConstraintViolationException: The Repository SHALL throw this exception if ANY of the following conditions are met: - // o The Document’s Object-Type definition’s versionable attribute is FALSE. - // • updateConflictException - // • versioningException - public function cancelCheckOut($repositoryId, $documentId, $changeToken = '') - { - try { - $result = $this->VersioningService->cancelCheckOut($repositoryId, $documentId, $changeToken); - } - catch (Exception $e) - { - return array( - "status_code" => 1, - "message" => $e->getMessage() - ); - } - - return array( - 'status_code' => 0, - 'results' => (!empty($result) ? $result : 'Document Checkout Cancelled') - ); - } - - /** - * Checks in a checked out document - * - * @param string $repositoryId - * @param string $documentId - * @param boolean $major - * @param string $changeToken [optional] - * @param array $properties [optional] - * @param contentStream $contentStream [optional] - * @param string $checkinComment [optional] - * @return string $documentId - */ - public function checkIn($repositoryId, $documentId, $major, $changeToken = '', $properties = array(), $contentStream = null, $checkinComment = '') - { - try { - $result = $this->VersioningService->checkIn($repositoryId, $documentId, $major, $changeToken, $properties, $contentStream, $checkinComment); - } - catch (Exception $e) - { - return array( - "status_code" => 1, - "message" => $e->getMessage() - ); - } - - return array( - 'status_code' => 0, - 'results' => (!empty($result) ? $result : 'Document Checked In Successfully') - ); - } - -} - -?> diff --git a/lib/api/ktcmis/services/CMISObjectService.inc.php b/lib/api/ktcmis/services/CMISObjectService.inc.php index 39d8d90..bbee385 100644 --- a/lib/api/ktcmis/services/CMISObjectService.inc.php +++ b/lib/api/ktcmis/services/CMISObjectService.inc.php @@ -61,7 +61,7 @@ class CMISObjectService { // NOTE The latter method has been adopted for the moment catch (Exception $e) { - throw new ConstraintViolationException('Object is not of base type document. ' . $e->getMessage()); + throw new ConstraintViolationException('Object base type could not be determined. ' . $e->getMessage()); } if ($typeDefinition['attributes']['baseType'] != 'document') @@ -103,49 +103,41 @@ class CMISObjectService { } } - if (!$typeAllowed) - { + if (!$typeAllowed) { throw new ConstraintViolationException('Parent folder may not hold objects of this type (' . $typeId . ')'); } // if content stream is required and no content stream is supplied, throw a ConstraintViolationException - if (($typeDefinition['attributes']['contentStreamAllowed'] == 'required') && is_null($contentStream)) - { + if (($typeDefinition['attributes']['contentStreamAllowed'] == 'required') && is_null($contentStream)) { throw new ConstraintViolationException('This repository requires a content stream for document creation. ' . 'Refusing to create an empty document'); } - else if (($typeDefinition['attributes']['contentStreamAllowed'] == 'notAllowed') && !empty($contentStream)) - { + else if (($typeDefinition['attributes']['contentStreamAllowed'] == 'notAllowed') && !empty($contentStream)) { throw new StreamNotSupportedException('Content Streams are not supported'); } // if versionable attribute is set to false and versioningState is supplied, throw a ConstraintViolationException - if (!$typeDefinition['attributes']['versionable'] && !empty($versioningState)) - { + if (!$typeDefinition['attributes']['versionable'] && !empty($versioningState)) { throw new ConstraintViolationException('This repository does not support versioning'); } // TODO deal with $versioningState when supplied // set title and name identical if only one submitted - if ($properties['title'] == '') - { + if ($properties['title'] == '') { $properties['title'] = $properties['name']; } - else if ($properties['name'] == '') - { + else if ($properties['name'] == '') { $properties['name'] = $properties['title']; } // if name is blank throw exception (check type) - using invalidArgument Exception for now - if (trim($properties['name']) == '') - { + if (trim($properties['name']) == '') { throw new InvalidArgumentException('Refusing to create an un-named document'); } // TODO also set to Default if a non-supported type is submitted - if ($properties['type'] == '') - { + if ($properties['type'] == '') { $properties['type'] = 'Default'; } @@ -154,17 +146,7 @@ class CMISObjectService { // this check isn't strictly necessary; however it is needed for a repository which does not support content streams if (!is_null($contentStream)) { - // TODO consider checking whether content is encoded (currently we expect encoded) - // TODO choose between this and the alternative decode function (see CMISUtil class) - // this will require some basic benchmarking - $contentStream = CMISUtil::decodeChunkedContentStream($contentStream); - - // NOTE There is a function in CMISUtil to do this, written for the unit tests but since KTUploadManager exists - // and has more functionality which could come in useful at some point I decided to go with that instead - // (did not know this existed when I wrote the CMISUtil function) - $uploadManager = new KTUploadManager(); - // assumes already decoded from base64, should use store_base64_file if not - $tempfilename = $uploadManager->store_file($contentStream, 'cmis_'); + $tempfilename = CMISUtil::createTemporaryFile($contentStream); // metadata $metadata = array(); @@ -192,12 +174,10 @@ class CMISObjectService { ); } - if (!empty($properties['category'])) - { + if (!empty($properties['category'])) { $category = $properties['category']; } - else - { + else { $category = 'Miscellaneous'; } @@ -231,12 +211,10 @@ class CMISObjectService { $KTMime = new KTMime(); $mimetype = $KTMime->getMimeTypeFromFile($tempfilename); preg_match('/^([^\/]*)\/([^\/]*)/', $mimetype, $matches); - if (($matches[1] == 'text') || ($matches[1] == 'image') || ($matches[1] == 'audio')) - { + if (($matches[1] == 'text') || ($matches[1] == 'image') || ($matches[1] == 'audio')) { $mediatype = ucwords($matches[1]); } - else if (($matches[2] == 'pdf') || ($matches[2] == 'msword')) - { + else if (($matches[2] == 'pdf') || ($matches[2] == 'msword')) { $mediatype = 'Text'; } @@ -262,12 +240,10 @@ class CMISObjectService { $response = $this->ktapi->add_document_with_metadata((int)$folderId, $properties['title'], $properties['name'], $properties['type'], $tempfilename, $metadata, $sysdata); - if ($response['status_code'] != 0) - { + if ($response['status_code'] != 0) { throw new StorageException('The repository was unable to create the document. ' . $response['message']); } - else - { + else { $objectId = CMISUtil::encodeObjectId('Document', $response['results']['document_id']); } @@ -314,13 +290,11 @@ class CMISObjectService { // exception propogate upward... // Alternatively: throw new exception with original exception message appended // NOTE The latter method has been adopted for the moment - catch (Exception $e) - { + catch (Exception $e) { throw new ConstraintViolationException('Object is not of base type folder. ' . $e->getMessage()); } - if ($typeDefinition['attributes']['baseType'] != 'folder') - { + if ($typeDefinition['attributes']['baseType'] != 'folder') { throw new ConstraintViolationException('Object is not of base type folder'); } @@ -333,20 +307,17 @@ class CMISObjectService { // if parent folder is not allowed to hold this type, throw exception $CMISFolder = new CMISFolderObject($folderId, $this->ktapi); $allowed = $CMISFolder->getProperty('AllowedChildObjectTypeIds'); - if (!is_array($allowed) || !in_array($typeId, $allowed)) - { + if (!is_array($allowed) || !in_array($typeId, $allowed)) { throw new ConstraintViolationException('Parent folder may not hold objects of this type (' . $typeId . ')'); } // TODO if name is blank! throw another exception (check type) - using invalidArgument Exception for now - if (trim($properties['name']) == '') - { + if (trim($properties['name']) == '') { throw new InvalidArgumentException('Refusing to create an un-named folder'); } $response = $this->ktapi->create_folder((int)$folderId, $properties['name'], $sig_username = '', $sig_password = '', $reason = ''); - if ($response['status_code'] != 0) - { + if ($response['status_code'] != 0) { throw new StorageException('The repository was unable to create the folder: ' . $response['message']); } else @@ -380,8 +351,7 @@ class CMISObjectService { $objectId = CMISUtil::decodeObjectId($objectId, $typeId); - if ($typeId == 'Unknown') - { + if ($typeId == 'Unknown') { throw new ObjectNotFoundException('The type of the requested object could not be determined'); } @@ -492,8 +462,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'); - if (!is_array($allowed) || !in_array($typeId, $allowed)) - { + if (!is_array($allowed) || !in_array($typeId, $allowed)) { throw new ConstraintViolationException('Parent folder may not hold objects of this type (' . $typeId . ')'); } @@ -517,8 +486,7 @@ class CMISObjectService { } // if failed, throw StorageException - if ($response['status_code'] != 0) - { + if ($response['status_code'] != 0) { throw new StorageException('The repository was unable to move the object: ' . $response['message']); } } @@ -541,13 +509,15 @@ class CMISObjectService { // TODO this should probably be a function, it is now used in two places... // throw updateConflictException if the operation is attempting to update an object that is no longer current (as determined by the repository). $exists = true; - if ($typeId == 'Folder') { + if ($typeId == 'Folder') + { $object = $this->ktapi->get_folder_by_id($objectId); if (PEAR::isError($object)) { $exists = false; } } - else if ($typeId == 'Document') { + else if ($typeId == 'Document') + { $object = $this->ktapi->get_document_by_id($objectId); if (PEAR::isError($object)) { $exists = false; @@ -743,11 +713,7 @@ class CMISObjectService { throw new ContentAlreadyExistsException('Unable to overwrite existing content stream'); } - // NOTE There is a function in CMISUtil to do this but since KTUploadManager exists and has more functionality - // which could come in useful at some point I decided to go with that instead (did not know it existed when - // I wrote the CMISUtil function) - $uploadManager = new KTUploadManager(); - $tempfilename = $uploadManager->store_base64_file($contentStream, 'cmis_'); + $tempfilename = CMISUtil::createTemporaryFile($contentStream); // update the document content from this temporary file as per usual // TODO Use checkin_document_with_metadata instead if metadata content submitted || update metadata separately? $response = $this->ktapi->checkin_document($documentId, $csFileName, 'CMIS setContentStream action', $tempfilename, false); diff --git a/lib/api/ktcmis/services/CMISVersioningService.inc.php b/lib/api/ktcmis/services/CMISVersioningService.inc.php index 345086e..5ac4f80 100644 --- a/lib/api/ktcmis/services/CMISVersioningService.inc.php +++ b/lib/api/ktcmis/services/CMISVersioningService.inc.php @@ -3,11 +3,12 @@ require_once(KT_DIR . '/ktapi/ktapi.inc.php'); require_once(CMIS_DIR . '/exceptions/ConstraintViolationException.inc.php'); require_once(CMIS_DIR . '/exceptions/StorageException.inc.php'); +require_once(CMIS_DIR . '/exceptions/StreamNotSupportedException.inc.php'); require_once(CMIS_DIR . '/exceptions/UpdateConflictException.inc.php'); require_once(CMIS_DIR . '/exceptions/VersioningException.inc.php'); require_once(CMIS_DIR . '/services/CMISObjectService.inc.php'); require_once(CMIS_DIR . '/objecttypes/CMISDocumentObject.inc.php'); -//require_once(CMIS_DIR . '/util/CMISUtil.inc.php'); +require_once(CMIS_DIR . '/util/CMISUtil.inc.php'); class CMISVersioningService { @@ -182,14 +183,8 @@ class CMISVersioningService { * @return string $documentId */ // TODO Exceptions: - // • ConstraintViolationException - SHALL throw if o The Document’s Object-Type definition’s versionable attribute is FALSE. - // • storageException - MAY throw - // • streamNotSupportedException - The Repository SHALL throw this exception if the Object-Type definition specified by the typeId - // parameter’s “contentStreamAllowed” attribute is set to “not allowed” and a contentStream input - // parameter is provided. - // • updateConflictException - MAY throw // • versioningException - The repository MAY throw this exception if the object is a non-current Document Version - public function checkIn($repositoryId, $documentId, $major, $changeToken = '', $properties = array(), $contentStream = null, $checkinComment = '') + public function checkIn($repositoryId, $documentId, $major, $contentStream = null, $changeToken = '', $properties = array(), $checkinComment = '') { $documentId = CMISUtil::decodeObjectId($documentId, $typeId); @@ -206,7 +201,35 @@ class CMISVersioningService { throw new ConstraintViolationException('This document is not versionable and may not be checked in'); } - return $documentId; + $RepositoryService = new CMISRepositoryService(); + try { + $typeDefinition = $RepositoryService->getTypeDefinition($repositoryId, $typeId); + } + catch (exception $e) { + // if we can't get the type definition, then we can't store the content + throw new StorageException($e->getMessage()); + } + + if (($typeDefinition['attributes']['contentStreamAllowed'] == 'notAllowed') && !empty($contentStream)) { + throw new StreamNotSupportedException('Content Streams are not supported'); + } + + // check that this is the latest version + 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, + $sig_username, $sig_password); + + // if there was any error in cancelling the checkout + if ($response['status_code'] == 1) { + throw new RuntimeException('There was an error checking in the document: ' . $response['message']); + } + + return CMISUtil::encodeObjectId(DOCUMENT, $documentId); } } diff --git a/lib/api/ktcmis/util/CMISUtil.inc.php b/lib/api/ktcmis/util/CMISUtil.inc.php index e9d0efd..c116ded 100644 --- a/lib/api/ktcmis/util/CMISUtil.inc.php +++ b/lib/api/ktcmis/util/CMISUtil.inc.php @@ -406,30 +406,6 @@ class CMISUtil { return (($input === true) ? 'true' : (($input === false) ? 'false' : $input)); } - /** - * Creates a temporary file - * Cleanup is the responsibility of the calling code - * - * @param string|binary $content The content to be written to the file. - * @param string $uploadDir Optional upload directory. Will use the KnowledgeTree system tmp directory if not supplied. - * @return string The path to the created file (for reference and cleanup.) - */ - static public function createTemporaryFile($content, $encoding = null, $uploadDir = null) - { - if(is_null($uploadDir)) - { - $oKTConfig =& KTConfig::getSingleton(); - $uploadDir = $oKTConfig->get('webservice/uploadDirectory'); - } - - $temp = tempnam($uploadDir, 'myfile'); - $fp = fopen($temp, 'wb'); - fwrite($fp, ($encoding == 'base64' ? base64_decode($content) : $content)); - fclose($fp); - - return $temp; - } - // TODO more robust base64 encoding detection, if possible /** @@ -610,6 +586,33 @@ class CMISUtil { return $exists; } + + /** + * Creates a temporary file + * Cleanup is the responsibility of the calling code + * + * @param string $contentStream The content to be stored (assumed to be base64) + * @return string The path to the created file (for reference and cleanup.) + */ + static public function createTemporaryFile($contentStream) + { + // if contentStream is empty, cannot create file + if (empty($contentStream)) return null; + + // TODO consider checking whether content is encoded (currently we expect encoded) + // TODO choose between this and the alternative decode function (see CMISUtil class) + // this will require some basic benchmarking + $contentStream = CMISUtil::decodeChunkedContentStream($contentStream); + + // NOTE There is a function in CMISUtil to do this, written for the unit tests but since KTUploadManager exists + // and has more functionality which could come in useful at some point I decided to go with that instead + // (did not know this existed when I wrote the CMISUtil function) + $uploadManager = new KTUploadManager(); + // assumes already decoded from base64, should use store_base64_file if not + $tempfilename = $uploadManager->store_file($contentStream, 'cmis_'); + + return $tempfilename; + } } diff --git a/plugins/thumbnails/templates/thumbnail_viewlet.smarty b/plugins/thumbnails/templates/thumbnail_viewlet.smarty new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/plugins/thumbnails/templates/thumbnail_viewlet.smarty diff --git a/plugins/thumbnails/thumbnails.php b/plugins/thumbnails/thumbnails.php new file mode 100644 index 0000000..2b97851 --- /dev/null +++ b/plugins/thumbnails/thumbnails.php @@ -0,0 +1,164 @@ +generateThumbnail(); + return $res; + } + + /** + * The supported mime types for the converter. + * + * @return array + */ + public function getSupportedMimeTypes() + { +// $aAcceptedMimeTypes = array('doc', 'ods', 'odt', 'ott', 'txt', 'rtf', 'sxw', 'stw', +// // 'html', 'htm', +// 'xml' , 'pdb', 'psw', 'ods', 'ots', 'sxc', +// 'stc', 'dif', 'dbf', 'xls', 'xlt', 'slk', 'csv', 'pxl', +// 'odp', 'otp', 'sxi', 'sti', 'ppt', 'pot', 'sxd', 'odg', +// 'otg', 'std', 'asc'); + + // taken from the original list of accepted types in the pdf generator action + $mime_types = array(); + $mime_types[] = 'text/plain'; + $mime_types[] = 'text/html'; + $mime_types[] = 'text/csv'; + $mime_types[] = 'text/rtf'; + + // Office OLE2 - 2003, XP, etc + $mime_types[] = 'application/msword'; + $mime_types[] = 'application/vnd.ms-powerpoint'; + $mime_types[] = 'application/vnd.ms-excel'; + + // Star Office + $mime_types[] = 'application/vnd.sun.xml.writer'; + $mime_types[] = 'application/vnd.sun.xml.writer.template'; + $mime_types[] = 'application/vnd.sun.xml.calc'; + $mime_types[] = 'application/vnd.sun.xml.calc.template'; + $mime_types[] = 'application/vnd.sun.xml.draw'; + $mime_types[] = 'application/vnd.sun.xml.draw.template'; + $mime_types[] = 'application/vnd.sun.xml.impress'; + $mime_types[] = 'application/vnd.sun.xml.impress.template'; + + // Open Office + $mime_types[] = 'application/vnd.oasis.opendocument.text'; + $mime_types[] = 'application/vnd.oasis.opendocument.text-template'; + $mime_types[] = 'application/vnd.oasis.opendocument.graphics'; + $mime_types[] = 'application/vnd.oasis.opendocument.graphics-template'; + $mime_types[] = 'application/vnd.oasis.opendocument.presentation'; + $mime_types[] = 'application/vnd.oasis.opendocument.presentation-template'; + $mime_types[] = 'application/vnd.oasis.opendocument.spreadsheet'; + $mime_types[] = 'application/vnd.oasis.opendocument.spreadsheet-template'; + + /* OO3 + // Office 2007 + $mime_types[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; + $mime_types[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; + $mime_types[] = 'application/vnd.openxmlformats-officedocument.presentationml.template'; + $mime_types[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; + $mime_types[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; + $mime_types[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; + $mime_types[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; + */ + + return $mime_types; + } + + /** + * Generates the thumbnail from the pdf + * + * @return boolean + */ + private function generateThumbnail() + { + /* + The thumbnail is displayed in the info panel and the document view + The info panel is in the plugin ktcore/documentpreview/ + - add a hook in there but build the functionality in this plugin ie keep the plugins separate and don't create dependencies + - if the thumbnail plugin is disabled then maybe display a normal sized info panel + + The document view will display the thumbnail on the right in a document viewlet similar to the workflow viewlet + - check out ktcore/KTDocumentViewlets.php + - viewlet class is below + */ + + $pdfDir = $default->pdfDirectory; + $pdfFile = $pdfDir .'/'. $this->document->iId.'.pdf'; + + // if a previous version of the pdf exists - delete it + if(!file_exists($pdfFile)){ + global $default; + $default->log->debug('Thumbnail Generator Plugin: PDF file does not exist, cannot generate a thumbnail'); + return false; + } + + // do generation + return true; + } +} + + +class ThumbnailViewlet extends KTDocumentViewlet { + var $sName = 'thumbnail.viewlets'; + + function display_viewlet() { + $oKTTemplating =& KTTemplating::getSingleton(); + $oTemplate =& $oKTTemplating->loadTemplate('thumbnail_viewlet'); + if (is_null($oTemplate)) return ''; + + $oTemplate->setData(array()); + return $oTemplate->render(); + } +} + +?> \ No newline at end of file diff --git a/plugins/thumbnails/thumbnailsPlugin.php b/plugins/thumbnails/thumbnailsPlugin.php new file mode 100644 index 0000000..6be306f --- /dev/null +++ b/plugins/thumbnails/thumbnailsPlugin.php @@ -0,0 +1,56 @@ +sFriendlyName = _kt('Thumbnail Generator'); + return $res; + } + + /** + * Setup the plugin: add the processor, viewlet action and template location + * + */ + function setup() { + $plugin_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR; + $dir = $plugin_dir . 'thumbnails.php'; + $this->registerProcessor('thumbnailGenerator', 'thumbnails.generator.processor', $dir); + $this->registerAction('documentviewlet', 'ThumbnailViewlet', 'thumbnail.viewlets', $dir); + + require_once(KT_LIB_DIR . '/templating/templating.inc.php'); + $oTemplating =& KTTemplating::getSingleton(); + $oTemplating->addLocation('thumbnails', $plugin_dir.'templates', 'thumbnails.generator.processor.plugin'); + } +} + +$oPluginRegistry =& KTPluginRegistry::getSingleton(); +$oPluginRegistry->registerPlugin('thumbnailsPlugin', 'thumbnails.generator.processor.plugin', __FILE__); +?> \ No newline at end of file diff --git a/setup/wizard/config/config.xml b/setup/wizard/config/config.xml index bdf7b6c..5fa1695 100644 --- a/setup/wizard/config/config.xml +++ b/setup/wizard/config/config.xml @@ -7,7 +7,7 @@ Description: Installer steps --> - + welcome license diff --git a/setup/wizard/installUtil.php b/setup/wizard/installUtil.php index 60f7dfd..033c521 100644 --- a/setup/wizard/installUtil.php +++ b/setup/wizard/installUtil.php @@ -254,8 +254,8 @@ class InstallUtil { */ public function checkPermission($dir, $create=false) { - $exist = 'Directory does not exist'; - $write = 'Directory is not writable'; + $exist = 'Directory doesn\'t exist'; + $write = 'Directory not writable'; $ret = array('class' => 'cross'); if(!file_exists($dir)){ diff --git a/setup/wizard/installer.php b/setup/wizard/installer.php index 5552708..96cb136 100644 --- a/setup/wizard/installer.php +++ b/setup/wizard/installer.php @@ -105,6 +105,15 @@ class Installer { protected $installOrders = array(); /** + * List of installation properties + * + * @author KnowledgeTree Team + * @access protected + * @var array string + */ + protected $installProperties = array(); + + /** * Flag if a step object needs confirmation * * @author KnowledgeTree Team @@ -281,11 +290,7 @@ class Installer { */ private function _runStepAction($stepName) { $this->stepAction = new stepAction($stepName); - $this->stepAction->setSteps($this->getSteps()); - $this->stepAction->setStepNames($this->getStepNames()); - $this->stepAction->setDisplayConfirm($this->stepConfirmation); - $this->stepAction->setDisplayFirst($this->stepDisplayFirst()); - $this->stepAction->loadSession($this->session); + $this->stepAction->setUpStepAction($this->getSteps(), $this->getStepNames(), $this->getStepConfirmation(), $this->stepDisplayFirst(), $this->getSession(), $this->getInstallProperties()); return $this->stepAction->doAction(); } @@ -367,6 +372,22 @@ class Installer { } /** + * Set install properties + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return void + */ + private function _xmlInstallProperties() { + if(isset($this->simpleXmlObj)) { + $this->installProperties['install_version'] = (string) $this->simpleXmlObj['version']; + $this->installProperties['install_type'] = (string) $this->simpleXmlObj['type']; + $this->_loadToSession('installProperties', $this->installProperties); + } + } + + /** * Install steps * * @author KnowledgeTree Team @@ -456,7 +477,11 @@ class Installer { $this->installOrders = $this->session->get('installOrders'); if(!$this->installOrders) { $this->_xmlStepsOrders(); - } + } + $this->installProperties = $this->session->get('installProperties'); + if(!$this->installProperties) { + $this->_xmlInstallProperties(); + } } private function loadNeeded() { @@ -576,6 +601,42 @@ class Installer { } /** + * Returns whether or not a confirmation step is needed + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return boolean + */ + public function getStepConfirmation() { + return $this->stepConfirmation; + } + + /** + * Return install properties + * + * @author KnowledgeTree Team + * @param string + * @access public + * @return string + */ + public function getInstallProperties() { + return $this->installProperties; + } + + /** + * Returns session + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return boolean + */ + public function getSession() { + return $this->session; + } + + /** * Dump of SESSION * * @author KnowledgeTree Team diff --git a/setup/wizard/lib/services/unixOpenOffice.php b/setup/wizard/lib/services/unixOpenOffice.php index 3f46ea6..9c02694 100644 --- a/setup/wizard/lib/services/unixOpenOffice.php +++ b/setup/wizard/lib/services/unixOpenOffice.php @@ -42,10 +42,70 @@ class unixOpenOffice extends unixService { + // utility + public $util; + // path to office + private $path; + // host + private $host; + // pid running + private $pidFile; + // port to bind to + private $port; + // bin folder + private $bin; + // office executable + private $soffice; + // office log file + private $log; + + # nohup /home/jarrett/ktdms/openoffice/program/soffice.bin -nofirststartwizard -nologo -headless -accept=socket,host=127.0.0.1,port=8100;urp;StarOffice.ServiceManager &> /home/jarrett/ktdms/var/log/dmsctl.log & public function __construct() { $this->name = "KTOpenOfficeTest"; + $this->util = new InstallUtil(); } - + public function load() { + $this->setPort("8100"); + $this->setHost("localhost"); + + } + + private function setPort($port = "8100") { + $this->port = $port; + } + + private function setHost($host = "localhost") { + $this->host = $host; + } + + public function install() { + $status = $this->status(); + if($status == '') { + return $this->start(); + } else { + return $status; + } + } + + public function start() { + return false; + $state = $this->status(); + if($state != 'STARTED') { + $cmd = ""; + $cmd .= ""; + $response = $this->util->pexec($cmd); + + return $response; + } elseif ($state == '') { + // Start Service + return true; + } else { + // Service Running Already + return true; + } + + return false; + } } ?> \ No newline at end of file diff --git a/setup/wizard/resources/graphics/dame/installer-header_logo.png b/setup/wizard/resources/graphics/dame/installer-header_logo.png new file mode 100644 index 0000000..c5d8e7d --- /dev/null +++ b/setup/wizard/resources/graphics/dame/installer-header_logo.png diff --git a/setup/wizard/resources/graphics/dame/installer_head.png b/setup/wizard/resources/graphics/dame/installer_head.png index e48fa00..dcd92ac 100644 --- a/setup/wizard/resources/graphics/dame/installer_head.png +++ b/setup/wizard/resources/graphics/dame/installer_head.png diff --git a/setup/wizard/resources/graphics/dropbox.png b/setup/wizard/resources/graphics/dropbox.png index 6958c3c..af538e5 100644 --- a/setup/wizard/resources/graphics/dropbox.png +++ b/setup/wizard/resources/graphics/dropbox.png diff --git a/setup/wizard/resources/graphics/dropbox_old.png b/setup/wizard/resources/graphics/dropbox_old.png new file mode 100644 index 0000000..6958c3c --- /dev/null +++ b/setup/wizard/resources/graphics/dropbox_old.png diff --git a/setup/wizard/resources/graphics/question.gif b/setup/wizard/resources/graphics/question.gif new file mode 100644 index 0000000..390a7fc --- /dev/null +++ b/setup/wizard/resources/graphics/question.gif diff --git a/setup/wizard/resources/wizard.css b/setup/wizard/resources/wizard.css index b1c3e8a..4f0b506 100644 --- a/setup/wizard/resources/wizard.css +++ b/setup/wizard/resources/wizard.css @@ -66,7 +66,7 @@ select { border:1px solid #B7B7B7; left:215px; position:relative; - top:25px; + top:20px; width:1024px; } @@ -92,9 +92,8 @@ select { } #content { - margin-left: 200px; + margin-left: 220px; height:515px; - } #content_container { @@ -110,13 +109,65 @@ select { height: 400px; } +#step_content_dependencies { + border: 1px solid rgb(207, 207, 207); + padding: 5px; + min-height:265px; +} + +#step_content_configuration { + border: 1px solid rgb(207, 207, 207); + padding: 5px; + min-height:290px; +} + +#step_content_registration { + border: 1px solid rgb(207, 207, 207); + padding: 5px; + height:295px; +} + +#step_content_registration_confirm { + border: 1px solid rgb(207, 207, 207); + padding: 5px; + height:400px; +} + +#step_content_install { + border: 1px solid rgb(207, 207, 207); + padding: 5px; + height:290px; +} + +#step_content_database { + border: 1px solid rgb(207, 207, 207); + padding: 5px; + min-height:355px; +} + +#step_content_database_confirm { + border: 1px solid rgb(207, 207, 207); + padding: 5px; + height:375px; +} + +#step_content_complete { + border: 1px solid rgb(207, 207, 207); + padding: 5px; + min-height:355px; +} + +.radio { + float:none; +} + #sidebar { background: rgb(239, 239, 239) none repeat scroll 0% 0%; - font-size: 75%; + font-size: 90%; color: grey; font-family: sans-serif; margin-top: 0px; - width: 200px; + width: 235px; float: left; padding-top: 20px; padding-bottom: 20px; @@ -143,6 +194,18 @@ select { margin-left: 10px; } +#logo { + position:relative; + right:760px; + top:20px; +} + +#install_details { + bottom:30px; + position:relative; + right:10px; +} + .menu { color: #616161; text-align: left; @@ -217,6 +280,16 @@ select { color: red; } +/* +td.error { + width:190px; +} +*/ + +.conf_paths { + width:755px; +} + .errors { color: #9F0000; } @@ -228,31 +301,6 @@ select { width:120px; } -/* -#buttons_double input { - float: left; - margin-top: 10px; - margin-left: 5px; - font-size: 12px; - font-weight: bold; - background-image: url("graphics/dame/kt_gradient.jpg"); - background-repeat: repeat-x; - background-position-y: 0%; - border: 1px solid #cecece; -} - -#buttons_single input { - float: right; - margin-top: 10px; - margin-left: 5px; - font-size: 12px; - font-weight: bold; - background-image: url("graphics/dame/kt_gradient.jpg"); - background-repeat: repeat-x; - background-position-y: 0%; - border: 1px solid #cecece; -}*/ - .back { background-image: url("graphics/dame/kt_gradient.jpg"); background-repeat:repeat-x; @@ -275,6 +323,11 @@ input { margin-top:10px; } +.textinput { + margin-top:0px; + float:left; +} + .buttons a { background: #DDDDDD; border: solid 1px #888; @@ -326,12 +379,16 @@ input { height:45px; } +#dbconf { + width:755px; +} + table#dbconf tr td { width:50%; } -input#dname { - size:40px; +table#dbconf tr td input{ + } .options { @@ -343,48 +400,92 @@ input#dname { } #section { - /*border:1px solid;*/ + } -sup { - font-size: 11px; +.php_ext_details table { + width:745px; } -refresh { - /* - style="color: #000000; - font-weight: normal; - */ +.php_ext_details table tr { + } -.php_ext_details table { - width:800px; +td.ext_indicator { + width:10px; +} + +td.ext_name { + width:110p; +} + +td.ext_description { + width:360px; +} + +td.ext_error { + width:350px; +} + +td.ext_refresh { + width:10px; +} + +td.dir_name { + width:200px; +} + +td.dir_description { + width:200px; } .php_con_details table { - width:800px; + width:745px; + /*border:1px solid;*/ } .error_message { border:none; - background-color:#FFCCCC; color:#A30000; -/* width:550px; */ padding:0px; + color:red; + font-size:90%; + margin-bottom:0.75em; + font-weight:bold; } .continue_message { + background: url("graphics/big-ok.png") no-repeat; border:none; - background:transparent url("graphics/big-ok.png") no-repeat scroll 0 50%; width:550px; padding:0px; + color:#898989; + font-size:90%; + margin-bottom:0.75em; } .license_agreement { overflow: scroll; height: 255px; - width:785px; + width:765px; height:370px; overflow-x:hidden; border:1px solid #CFCFCF; +} + +.db_adv_options { + height:200px; + width:720px; +} + +.adv_option { + height:65px; + width:720px; +} + +#tooltips { + background: url("graphics/question.gif") no-repeat; + width:16px; + height:16px; + cursor:pointer; } \ No newline at end of file diff --git a/setup/wizard/resources/wizard.js b/setup/wizard/resources/wizard.js index 8e18219..9fda3bd 100644 --- a/setup/wizard/resources/wizard.js +++ b/setup/wizard/resources/wizard.js @@ -5,6 +5,7 @@ function wizard() { // Does a form check on every new page load wizard.prototype.doFormCheck = function() { w.addReadOnly(); + w.load(); } // Toggle Advance Database options @@ -134,61 +135,87 @@ wizard.prototype.onSubmitValidate = function(silent) { return true; } +wizard.prototype.pClick = function() { + var state = document.getElementById('state'); + if(state != "undefined") { + state.name = 'previous'; + } +} + +wizard.prototype.nClick = function() { + var state = document.getElementById('state'); + if(state != "undefined") { + state.name = 'next'; + } +} + // Validate Registration Page wizard.prototype.validateRegistration = function() { - return true; + // See if next or previous is clicked. + var state = document.getElementById('state').name; + if(state == 'next') { + if(w.valRegHelper()) { + document.getElementById('sendAll').name = 'Next'; // Force the next step + document.getElementById('sendAll').value = 'next'; + document.getElementById('registration').submit(); + } + } else if(state == 'previous') { + document.getElementById('sendAll').name = 'Previous'; // Force the previous step + document.getElementById('sendAll').value = 'previous'; + document.getElementById('registration').submit(); + } +} + +wizard.prototype.valRegHelper = function() { var first = document.getElementById('first'); var last = document.getElementById('last'); var email = document.getElementById('email'); - if(first.value < 2) { - + if(first.value.length < 2) { + document.getElementById("reg_error").innerHTML = "Please enter a First Name"; + w.focusElement(first); return false; } - if(last.value < 2) { - - + if(last.value.length < 2) { + document.getElementById("reg_error").innerHTML = "Please enter a Last Name"; + w.focusElement(last); + return false; } - if(w.emailCheck(email.value)) { - + if(!w.emailCheck(email.value)) { + document.getElementById("reg_error").innerHTML = "Please enter a valid email address"; + w.focusElement(email); + return false; } - return false; + return true; } // Validate Registration Page Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/) -wizard.prototype.emailCheck = function() { +wizard.prototype.emailCheck = function(str) { var at="@"; var dot="."; var lat=str.indexOf(at); var lstr=str.length; var ldot=str.indexOf(dot); if (str.indexOf(at)==-1) { - // alert("Invalid E-mail ID") return false; } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) { - // alert("Invalid E-mail ID") return false; } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) { - // alert("Invalid E-mail ID") return false; } if (str.indexOf(at,(lat+1))!=-1) { - // alert("Invalid E-mail ID") return false; } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ - // alert("Invalid E-mail ID") return false; } if (str.indexOf(dot,(lat+2))==-1){ - // alert("Invalid E-mail ID") return false; } if (str.indexOf(" ")!=-1){ - // alert("Invalid E-mail ID") return false; } return true; @@ -213,4 +240,9 @@ wizard.prototype.addReadOnly = function() { // w.focusElement(inputs[i]); } } +} + +/* */ +wizard.prototype.load = function() { +// $('#tooltips').tooltip(); } \ No newline at end of file diff --git a/setup/wizard/stepAction.php b/setup/wizard/stepAction.php index 9d079ea..8d45c35 100644 --- a/setup/wizard/stepAction.php +++ b/setup/wizard/stepAction.php @@ -78,6 +78,15 @@ class stepAction { protected $displayFirst = false; /** + * List of install properties + * + * @author KnowledgeTree Team + * @access protected + * @var boolean + */ + protected $installProperties = array(); + + /** * Reference to session object * * @author KnowledgeTree Team @@ -107,6 +116,95 @@ class stepAction { } /** + * Helper to initialize step actions + * + * @author KnowledgeTree Team + * @param string + * @access public + * @return string + */ + public function setUpStepAction($steps, $stepNames, $stepConfirmation, $stepDisplayFirst, $session, $installProperties) { + $this->setSteps($steps); + $this->setStepNames($stepNames); + $this->setDisplayConfirm($stepConfirmation); + $this->setDisplayFirst($stepDisplayFirst); + $this->loadSession($session); + $this->setInstallProperties($installProperties); + } + + /** + * Sets steps class names in string format + * + * @author KnowledgeTree Team + * @param array + * @access public + * @return void + */ + public function setSteps($stepClassNames) { + $this->stepClassNames = $stepClassNames; + } + + /** + * Sets steps in human readable string format + * + * @author KnowledgeTree Team + * @param array + * @access public + * @return void + */ + public function setStepNames($step_names) { + $this->step_names = $step_names; + } + + /** + * Sets confirmation page flag + * + * @author KnowledgeTree Team + * @param boolean + * @access public + * @return void + */ + public function setDisplayConfirm($displayConfirm) { + $this->displayConfirm = $displayConfirm; + } + + /** + * Sets confirmation page first flag + * + * @author KnowledgeTree Team + * @param boolean + * @access public + * @return void + */ + public function setDisplayFirst($displayFirst) { + $this->displayFirst = $displayFirst; + } + + /** + * Sets session object + * + * @author KnowledgeTree Team + * @param object Session + * @access public + * @return void + */ + public function loadSession($ses) { + $this->session = $ses; + } + + /** + * Sets install properties + * + * @author KnowledgeTree Team + * @param array + * @access public + * @return void + */ + public function setInstallProperties($installProperties) { + $this->installProperties = $installProperties; + } + + /** * Main control to handle the steps actions * * @author KnowledgeTree Team @@ -181,43 +279,7 @@ class stepAction { return $str; } - - /** - * Sets steps class names in string format - * - * @author KnowledgeTree Team - * @param array - * @access public - * @return void - */ - public function setSteps($stepClassNames) { - $this->stepClassNames = $stepClassNames; - } - - /** - * Sets steps in human readable string format - * - * @author KnowledgeTree Team - * @param array - * @access public - * @return void - */ - public function setStepNames($step_names) { - $this->step_names = $step_names; - } - - /** - * Returns a message to display at the top of template - * - * @author KnowledgeTree Team - * @param none - * @access public - * @return string - */ - public function getTop() { - return ''.$this->getCurrentStepName().''; - } - + /** * Returns current step name * @@ -270,10 +332,6 @@ class stepAction { return $menu; } - public function getActions() { - - } - /** * Returns confirmation page flag * @@ -283,7 +341,6 @@ class stepAction { * @return boolean */ public function displayConfirm() { - // TODO:No other way I can think of doing this return $this->displayConfirm; } @@ -300,42 +357,6 @@ class stepAction { } /** - * Sets confirmation page flag - * - * @author KnowledgeTree Team - * @param boolean - * @access public - * @return void - */ - public function setDisplayConfirm($displayConfirm) { - $this->displayConfirm = $displayConfirm; - } - - /** - * Sets confirmation page first flag - * - * @author KnowledgeTree Team - * @param boolean - * @access public - * @return void - */ - public function setDisplayFirst($displayFirst) { - $this->displayFirst = $displayFirst; - } - - /** - * Sets session object - * - * @author KnowledgeTree Team - * @param object Session - * @access public - * @return void - */ - public function loadSession($ses) { - $this->session = $ses; - } - - /** * Returns session object * * @author KnowledgeTree Team @@ -356,8 +377,7 @@ class stepAction { * @return string */ public function paintAction() { - $left = $this->getLeftMenu(); - $top = $this->getTop(); + $step_errors = $this->action->getErrors(); // Get errors $step_warnings = $this->action->getWarnings(); // Get warnings if($this->displayConfirm()) { // Check if theres a confirm step @@ -382,11 +402,19 @@ class stepAction { } $content = $step_tpl->fetch(); $tpl = new Template("templates/wizard.tpl"); + $vars = $this->getVars(); // Get template variables + $tpl->set("vars", $vars); // Set template errors $tpl->set('content', $content); - $tpl->set('left', $left); echo $tpl->fetch(); } + public function getVars() { + $left = $this->getLeftMenu(); + $vars['left'] = $left; // Set left menu + $vars['install_version'] = $this->installProperties['install_version']; // Set version + $vars['install_type'] = $this->installProperties['install_type']; // Set type + return $vars; + } /** * Load class to session * diff --git a/setup/wizard/steps/complete.php b/setup/wizard/steps/complete.php index 985e548..d157e62 100644 --- a/setup/wizard/steps/complete.php +++ b/setup/wizard/steps/complete.php @@ -65,14 +65,6 @@ class complete extends Step { protected $util = null; - /** - * List of services to check - * - * @access private - * @var array - */ - private $_services = array('Lucene', 'Scheduler'); - public function __construct() { $this->temp_variables = array("step_name"=>"complete", "silent"=>$this->silent); $this->_dbhandler = new dbUtil(); diff --git a/setup/wizard/steps/dependencies.php b/setup/wizard/steps/dependencies.php index e33c2f3..5f6511f 100644 --- a/setup/wizard/steps/dependencies.php +++ b/setup/wizard/steps/dependencies.php @@ -361,7 +361,7 @@ class dependencies extends Step private function getConfigurations() { return array( - array('name' => 'Safe Mode', 'configuration' => 'safe_mode', 'recommended' => 'ON', 'type' => 'bool'), + array('name' => 'Safe Mode', 'configuration' => 'safe_mode', 'recommended' => 'OFF', 'type' => 'bool'), array('name' => 'Display Errors', 'configuration' => 'display_errors', 'recommended' => 'OFF', 'type' => 'bool'), array('name' => 'Display Startup Errors', 'configuration' => 'display_startup_errors', 'recommended' => 'ON', 'type' => 'bool'), array('name' => 'File Uploads', 'configuration' => 'file_uploads', 'recommended' => 'ON', 'type' => 'bool'), diff --git a/setup/wizard/steps/registration.php b/setup/wizard/steps/registration.php index d2b4dea..cf9e0d4 100644 --- a/setup/wizard/steps/registration.php +++ b/setup/wizard/steps/registration.php @@ -42,9 +42,6 @@ class registration extends Step { - - public $temp_variables = array("step_name"=>"registration"); - /** * Initialise the registration step * @@ -66,10 +63,6 @@ class registration extends Step public function doStep() { $this->setFormInfo(); -// die('a'); -//print_r($_POST); -//print_r($_GET); -return 'next'; if(!$this->inStep("registration")) { return 'landing'; } @@ -98,7 +91,7 @@ return 'next'; if(isset($_POST['registered']) && $_POST['registered'] == 'yes'){ return true; } - +return true; //$this->postForm($_POST); //$this->sendToHost($_POST); diff --git a/setup/wizard/steps/services.php b/setup/wizard/steps/services.php index 1dbda64..dcd18a7 100644 --- a/setup/wizard/steps/services.php +++ b/setup/wizard/steps/services.php @@ -61,6 +61,7 @@ class services extends Step protected $runInstall = true; private $services = array('Lucene', 'Scheduler', 'OpenOffice'); +// private $services = array('OpenOffice'); protected $java; @@ -68,7 +69,7 @@ class services extends Step protected $util; - private $javaVersion = '1.7'; + private $javaVersion = '1.5'; /** * Java Installed @@ -294,8 +295,10 @@ class services extends Step $service = new $className(); $status = $this->serviceStatus($service); if($status != 'STARTED') { - $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$service->getName()." Could not be added as a Service"); + $msg = $service->getName()." Could not be added as a Service"; + $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$msg); $this->serviceCheck = 'cross_orange'; + $this->warnings[] = $msg; } else { if(WINDOWS_OS) { $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service"); } @@ -356,7 +359,7 @@ class services extends Step } private function useDetected() { - return $this->detSettings(); + return $this->detSettings(true); } private function specifyJava() { @@ -387,7 +390,7 @@ class services extends Step * @access private * @return boolean */ - private function detSettings() { + private function detSettings($attempt) { $javaExecutable = $this->util->javaSpecified();// Retrieve java bin $cmd = "$javaExecutable -version > output/outJV 2>&1 echo $!"; $response = $this->util->pexec($cmd); @@ -398,7 +401,7 @@ class services extends Step if($matches[1] < $this->javaVersion) { // Check Version of java $this->javaVersionInCorrect(); $this->javaCheck = 'cross'; - $this->error[] = "Requires Java 1.5+ to be installed"; + if(!$attempt) $this->error[] = "Requires Java 1.5+ to be installed"; return false; } else { $this->javaVersionCorrect(); @@ -411,10 +414,12 @@ class services extends Step $this->javaVersionWarning(); $this->javaCheck = 'cross_orange'; $this->javaExeError = "Java : Incorrect path specified"; - $this->error[] = "Requires Java 1.5+ to be installed"; + if(!$attempt) $this->error[] = "Requires Java 1.5+ to be installed"; return false; } } + + return false; } function detPhpSettings() { diff --git a/setup/wizard/templates/complete.tpl b/setup/wizard/templates/complete.tpl index 43b811e..3147817 100644 --- a/setup/wizard/templates/complete.tpl +++ b/setup/wizard/templates/complete.tpl @@ -1,97 +1,96 @@ -

Installation Completed

- -

KnowledgeTree post-configuration checkup

- -

This allows you to check that your KnowledgeTree configuration is set -up correctly. You can run this at any time after configuration to check -that things are still set up correctly.

- -' - . '' - . 'Click Here for help on overcoming post install issues
'; -} -?> +
+

Installation Completed

+ + -
-

     "; ?>Paths and Permissions

- -
Show Details
-
'; + } + ?> +
+
+

     "; ?>Paths and Permissions

+ +
Show Details
+ +
- -
-
-

     "; ?>Database connectivity

- -
Show Details
-
-      Your system is not quite ready to run KnowledgeTree. See the list below to determine which areas you need to address.
     Once you’ve fixed these items, return to this wizard and try again.

+      Your system is not quite ready to run KnowledgeTree. See the list below to determine which areas you need      to address. Once you’ve fixed these items, return to this wizard and try again.
     KnowledgeTree Optional Dependencies not met, but you will be able to continue.
@@ -28,40 +29,47 @@ The wizard will review your system to determine whether KnowledgeTree is correct
- +

Server Settings

The settings below have been drawn from the system information. The host and port should reflect the host and port that will be used to access KnowledgeTree. The Root Url is only needed if your installation is in a directory off the main web server root.

- +
- - + + + - + + - + + - + + - - + + +
' />
 
' />
' />
 
' style="float:left;"/>
' />
 
' />
' />
 
' />
- />   - /> -
 
+ + /> + + /> +
-

     "; ?>Paths and Permissions

+

     "; ?>Directory Paths and Permissions

Show Details
-
- - -
+
+ + \ No newline at end of file diff --git a/setup/wizard/templates/configuration_confirm.tpl b/setup/wizard/templates/configuration_confirm.tpl index 52a5fca..e586efb 100644 --- a/setup/wizard/templates/configuration_confirm.tpl +++ b/setup/wizard/templates/configuration_confirm.tpl @@ -1,52 +1,83 @@ -

System Configuration

- -

Server Settings

- - - - - - - - - - - - - - - - - - - - - - -
Host:
Port:
Root Url:
File System Root:
SSL Enabled:
- -

Paths and Permissions

- - - $path){ -?> - - - - - - -
'>
:
-
- -
- - - -
+

System Configuration

+
+ +      All configuration settings are correctly set. Please click next to continue. + +
+
+ +      Your system is not quite ready to run KnowledgeTree. See the list below to determine which areas you need      to address. Once you’ve fixed these items, return to this wizard and try again.
+ +      KnowledgeTree Optional Dependencies not met, but you will be able to continue.
+ + +      Click here for help on overcoming configuration issues + +
+ +
+

Server Settings

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Host:
 
Port:
 
Root Url:
 
File System Root:
 
SSL Enabled:
 
+ +

Paths and Permissions

+ + + $path){ + ?> + + + + + + + + + + + + + +
'>
: Refresh
+
+
+ +
\ No newline at end of file diff --git a/setup/wizard/templates/database.tpl b/setup/wizard/templates/database.tpl index 4909afc..7ce947c 100644 --- a/setup/wizard/templates/database.tpl +++ b/setup/wizard/templates/database.tpl @@ -1,7 +1,7 @@ -

Confirming Database Configurations

+
+

Confirming Database Configurations

- /> @@ -11,6 +11,7 @@ This step configures the connection to the database server and installs the database. The details for an administrative
user on the database server are required in order to be able to configure and install the installation database.
+
@@ -26,53 +27,50 @@ - + - + - +
Your current database type is:
Advanced Options
-
-
- + - + - + -
@@ -99,10 +97,8 @@ An administrative user is required for creating tables within the database. -
- - -
+ + @@ -129,10 +125,7 @@ An second user is required for normal database interaction, the reading and writ Passwords Do Not Match -
- - - -
+ + \ No newline at end of file diff --git a/setup/wizard/templates/database_confirm.tpl b/setup/wizard/templates/database_confirm.tpl index 6ffadb9..7daf88a 100644 --- a/setup/wizard/templates/database_confirm.tpl +++ b/setup/wizard/templates/database_confirm.tpl @@ -1,94 +1,103 @@ -

Confirming Database Configurations

- -
-Please confirm whether KnowledgeTree has correctly determined your database settings before proceeding. -
- -
-

Database Settings

- -$v) { - $type = (!$k) ? $v : $type; - } - ?> - - - - - - - - - - - - - - - - - - - - - - -
Database type:
Name:
Root Username:
Root Password:
You are about to drop the database if it exists
- -

Advanced Settings

- - - - - - - - - - - - - - - - - - - - -
Host:
Port:
Mysql Binary:
Table Prefix:
- -

Database Users

- - - - - - - - - - - - - - - - - - - - - - -
DMS Admin Username:
DMS Admin Password:
DMS User Username:
DMS User Password:
+

Confirming Database Configurations

-
- - -
+
+ Please confirm whether KnowledgeTree has correctly determined your database settings before proceeding. +
+
+

Database Settings

+ + $v) { + $type = (!$k) ? $v : $type; + } + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + +
Database Type:
 
Database Name:
 
Root Username:
 
Root Password:
 
You are about to drop the database if it exists
+ +

Advanced Settings

+ + + + + + + + + + + + + + + + + + + + + + + + +
Host:
 
Port:
 
Mysql Binary:
 
Table Prefix:
 
+ +

Database Users

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
DMS Admin Username:
 
DMS Admin Password:
 
DMS User Username:
 
DMS User Password:
 
+
+ +
\ No newline at end of file diff --git a/setup/wizard/templates/dependencies.tpl b/setup/wizard/templates/dependencies.tpl index afe623e..d33dbf4 100644 --- a/setup/wizard/templates/dependencies.tpl +++ b/setup/wizard/templates/dependencies.tpl @@ -1,136 +1,136 @@ -

Checking PHP Dependencies

- -

-The wizard will review your system to determine whether you have the right PHP components in place to run KnowledgeTree.
-Once the scan is completed, you’ll see whether your system has met the requirements or whether there are areas you need to address. -

- -
- -      Congratulations! Your system is ready to run KnowledgeTree. Click Next to continue. - -
- -
- -      Your system is not quite ready to run KnowledgeTree. See the list below to determine which areas you need to address.
     Once you’ve fixed these items, return to this wizard and try again.

- -      KnowledgeTree Optional Dependencies not met, but you will be able to continue.
- - - -      Click here for help on overcoming dependency issues - -
- -

     "; ?>PHP Version Check

- -
Show Details
- - -
-

     "; ?>PHP Extensions

- -
Show Details
- - -
-

     "; ?>PHP Configuration

- -
Show Details
- - - -
- - -
+ + \ No newline at end of file diff --git a/setup/wizard/templates/error.tpl b/setup/wizard/templates/error.tpl index 706cb45..6ee3afb 100644 --- a/setup/wizard/templates/error.tpl +++ b/setup/wizard/templates/error.tpl @@ -1,44 +1,49 @@ - KnowledgeTree Installer - - + KnowledgeTree Installer + +
-
-

Welcome to the KnowledgeTree Setup Wizard

- -
-".$error."
"; ?> -'; - foreach ($errors as $msg){ - echo $msg . "
\n"; - } - echo '
'; - } -} -?> -
- -
-
-
-
-
- +
+

Welcome to the KnowledgeTree Setup Wizard

+
+ ".$error."
"; ?> + '; + foreach ($errors as $msg){ + echo $msg . "
\n"; + } + echo ''; + } + } + ?> + +
+ + + +
 
- diff --git a/setup/wizard/templates/errors.tpl b/setup/wizard/templates/errors.tpl index 5eeaaf0..f105fa7 100644 --- a/setup/wizard/templates/errors.tpl +++ b/setup/wizard/templates/errors.tpl @@ -1,4 +1,4 @@ -

Welcome to the KnowledgeTree Setup Wizard

+

Welcome to the KnowledgeTree Setup Wizard

diff --git a/setup/wizard/templates/install.tpl b/setup/wizard/templates/install.tpl index f66ecdd..2d0b043 100644 --- a/setup/wizard/templates/install.tpl +++ b/setup/wizard/templates/install.tpl @@ -1,12 +1,9 @@ -

Finalizing System Installation

- -

-The wizard will now complete the installation and run a final check on the system. -

-
-
- - -
+

Finalizing System Installation

+ +
+ The wizard will now complete the installation and run a final check on the system. +
+ +
\ No newline at end of file diff --git a/setup/wizard/templates/registration.tpl b/setup/wizard/templates/registration.tpl index c7d36b6..2d55716 100644 --- a/setup/wizard/templates/registration.tpl +++ b/setup/wizard/templates/registration.tpl @@ -1,90 +1,88 @@ -
-

Registering KnowledgeTree

- -

-Register with KnowledgeTree to receive important product updates. We respect your privacy and will not share your information with third parties. For more information, please refer to our Privacy and Data Retention Policies. -Skip Registration -

- -

-We will not share your information with 3rd-parties, nor will we send you information not directly related to KnowledgeTree's products -and services. Please see our Privacy and Data Retention policies for more information. -

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   - -
- -
- -
- -
-

- - - - - -
- - -
+ +

Registering KnowledgeTree

+ +

+ Register with KnowledgeTree to receive important product updates. We respect your privacy and will not share your information with third parties. For more information, please refer to our Privacy and Data Retention Policies. + Skip Registration +

+ + + +

+ We will not share your information with 3rd-parties, nor will we send you information not directly related to KnowledgeTree's products + and services. Please see our Privacy and Data Retention policies for more information. +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  
+ +
+ +
+ +
+ + + +
+ + +
\ No newline at end of file diff --git a/setup/wizard/templates/registration_confirm.tpl b/setup/wizard/templates/registration_confirm.tpl index 84f624f..1f694d3 100644 --- a/setup/wizard/templates/registration_confirm.tpl +++ b/setup/wizard/templates/registration_confirm.tpl @@ -1,13 +1,8 @@ -

Thank you for registering

- -

-Thank you for signing up. You'll receive an email from us shortly with download instructions for the KnowledgeTree Drop Box software. -

-
- -
- - -
+

Thank you for registering

+
+ Thank you for signing up. You'll receive an email from us shortly with download instructions for the KnowledgeTree Drop Box software. +
+ +
\ No newline at end of file diff --git a/setup/wizard/templates/services.tpl b/setup/wizard/templates/services.tpl index 8d888d8..0646531 100644 --- a/setup/wizard/templates/services.tpl +++ b/setup/wizard/templates/services.tpl @@ -1,156 +1,157 @@
-

Checking Service Dependencies

- -

-The wizard will review your system to determine whether you can run KnowledgeTree background services.
Once the scan is completed, you’ll see whether your system has met the requirements or whether there are areas you need to address. -

- -
-Checking Service Dependencies

+ +

+ The wizard will review your system to determine whether you can run KnowledgeTree background services.
Once the scan is completed, you’ll see whether your system has met the requirements or whether there are areas you need to address. +

+ +
+ +      All service dependencies are met. Please click next to continue. + +
+
+ +      Your system is not quite ready to run KnowledgeTree. See the list below to determine which areas you need      to address. Once you’ve fixed these items, return to this wizard and try again.
+ -      All service dependencies are met. Please click next to continue. +      KnowledgeTree Optional Dependencies not met, but you will be able to continue.
-
-
- -      Your system is not quite ready to run KnowledgeTree. See the list below to determine which areas you need to address.
     Once you’ve fixed these items, return to this wizard and try again.

- -      KnowledgeTree Optional Dependencies not met, but you will be able to continue.
+ }?> - -      Click here for help on overcoming dependency issues - -
- - - - Specify the location of your Java executable -     - '/> -     - + if($errors || $warnings) { + ?> +      Click here for help on overcoming service issues - -
- Specify the location of your PHP executable -
- - '/> +
+
+ + + Specify the location of your Java executable +     + ' style="float:none;"/> +     + + + +
+ Specify the location of your PHP executable +
+ + '/> + + '/> + +     + + + + + +

     "; ?>Java Check

+ +
Show Details
+ + + +

     "; ?>Java Extensions

+ +
Show Details
+ + + - '/> +

+ All services are already installed. +

-     - - - - - -

     "; ?>Java Check

- -
Show Details
- - - -

     "; ?>Java Extensions

+

     "; ?>Services Check

-
Show Details
-