Commit d3a07e607b618c64ebe8216d424f54e222825b6d
Merge branch 'edge' into multiselect
Showing
53 changed files
with
2777 additions
and
1965 deletions
ktapi/ktapi.inc.php
| ... | ... | @@ -2928,7 +2928,7 @@ class KTAPI |
| 2928 | 2928 | * @param string $tempfilename |
| 2929 | 2929 | * @return kt_document_detail. status_code can be KTWS_ERR_INVALID_SESSION, KTWS_ERR_INVALID_FOLDER, KTWS_ERR_INVALID_DOCUMENT or KTWS_SUCCESS |
| 2930 | 2930 | */ |
| 2931 | - public function checkin_document($document_id, $filename, $reason, $tempfilename, $major_update, | |
| 2931 | + public function checkin_document($document_id, $filename, $reason, $tempfilename, $major_update, | |
| 2932 | 2932 | $sig_username = '', $sig_password = '') |
| 2933 | 2933 | { |
| 2934 | 2934 | $response = $this->_check_electronic_signature($document_id, $sig_username, $sig_password, $reason, $reason, | ... | ... |
lib/api/ktcmis/classes/CMISDocumentPropertyCollection.inc.php
| ... | ... | @@ -71,6 +71,7 @@ class CMISDocumentPropertyCollection extends CMISPropertyCollection { |
| 71 | 71 | 'ContentStreamMimeType' => 'propertyString', |
| 72 | 72 | 'ContentStreamFilename' => 'propertyString', |
| 73 | 73 | 'ContentStreamUri' => 'propertyUri', |
| 74 | + 'IsLatestVersion' => 'propertyBoolean', | |
| 74 | 75 | 'IsVersionSeriesCheckedOut' => 'propertyBoolean', |
| 75 | 76 | 'VersionSeriesCheckedOutBy' => 'propertyString', |
| 76 | 77 | 'VersionSeriesCheckedOutId' => 'propertyId', | ... | ... |
lib/api/ktcmis/ktNavigationService.inc.php
0 → 100644
| 1 | +<?php | |
| 2 | +/** | |
| 3 | +* Navigation Service CMIS wrapper API for KnowledgeTree. | |
| 4 | +* | |
| 5 | +* KnowledgeTree Community Edition | |
| 6 | +* Document Management Made Simple | |
| 7 | +* Copyright (C) 2008,2009 KnowledgeTree Inc. | |
| 8 | +* Portions copyright The Jam Warehouse Software (Pty) Limited | |
| 9 | +* | |
| 10 | +* This program is free software; you can redistribute it and/or modify it under | |
| 11 | +* the terms of the GNU General Public License version 3 as published by the | |
| 12 | +* Free Software Foundation. | |
| 13 | +* | |
| 14 | +* This program is distributed in the hope that it will be useful, but WITHOUT | |
| 15 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 16 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
| 17 | +* details. | |
| 18 | +* | |
| 19 | +* You should have received a copy of the GNU General Public License | |
| 20 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 21 | +* | |
| 22 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 23 | +* California 94120-7775, or email info@knowledgetree.com. | |
| 24 | +* | |
| 25 | +* The interactive user interfaces in modified source and object code versions | |
| 26 | +* of this program must display Appropriate Legal Notices, as required under | |
| 27 | +* Section 5 of the GNU General Public License version 3. | |
| 28 | +* | |
| 29 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | |
| 30 | +* these Appropriate Legal Notices must retain the display of the "Powered by | |
| 31 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 32 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | |
| 33 | +* must display the words "Powered by KnowledgeTree" and retain the original | |
| 34 | +* copyright notice. | |
| 35 | +* | |
| 36 | +* @copyright 2008-2009, KnowledgeTree Inc. | |
| 37 | +* @license GNU General Public License version 3 | |
| 38 | +* @author KnowledgeTree Team | |
| 39 | +* @package KTCMIS | |
| 40 | +* @version Version 0.9 | |
| 41 | +*/ | |
| 42 | + | |
| 43 | +require_once(realpath(dirname(__FILE__) . '/ktService.inc.php')); | |
| 44 | +require_once(CMIS_DIR . '/services/CMISNavigationService.inc.php'); | |
| 45 | + | |
| 46 | +/* | |
| 47 | + * Handles repository navigation | |
| 48 | + */ | |
| 49 | +class KTNavigationService extends KTCMISBase { | |
| 50 | + | |
| 51 | + protected $NavigationService; | |
| 52 | + | |
| 53 | + public function __construct(&$ktapi = null, $username = null, $password = null) | |
| 54 | + { | |
| 55 | + parent::__construct($ktapi, $username, $password); | |
| 56 | + // instantiate underlying CMIS service | |
| 57 | + $this->NavigationService = new CMISNavigationService(); | |
| 58 | + $this->setInterface(); | |
| 59 | + } | |
| 60 | + | |
| 61 | + public function startSession($username, $password) | |
| 62 | + { | |
| 63 | + parent::startSession($username, $password); | |
| 64 | + $this->setInterface(); | |
| 65 | + return self::$session; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public function setInterface(&$ktapi = null) | |
| 69 | + { | |
| 70 | + parent::setInterface($ktapi); | |
| 71 | + $this->NavigationService->setInterface(self::$ktapi); | |
| 72 | + } | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * Get descendents of the specified folder, up to the depth indicated | |
| 76 | + * | |
| 77 | + * @param string $repositoryId | |
| 78 | + * @param string $folderId | |
| 79 | + * @param boolean $includeAllowableActions | |
| 80 | + * @param boolean $includeRelationships | |
| 81 | + * @param string $typeID | |
| 82 | + * @param int $depth | |
| 83 | + * @param string $filter | |
| 84 | + * @return array $descendants | |
| 85 | + */ | |
| 86 | + public function getDescendants($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, | |
| 87 | + $depth = 1, $typeID = 'Any', $filter = '') | |
| 88 | + { | |
| 89 | + // TODO optional parameters | |
| 90 | + $descendantsResult = $this->NavigationService->getDescendants($repositoryId, $folderId, $includeAllowableActions, | |
| 91 | + $includeRelationships, $depth); | |
| 92 | + | |
| 93 | + if (PEAR::isError($descendantsResult)) | |
| 94 | + { | |
| 95 | + return array( | |
| 96 | + "status_code" => 1, | |
| 97 | + "message" => "Failed getting descendants for folder" | |
| 98 | + ); | |
| 99 | + } | |
| 100 | + | |
| 101 | + // format for webservices consumption | |
| 102 | + // NOTE this will almost definitely be changing in the future, this is just to get something working | |
| 103 | + $descendants = CMISUtil::decodeObjectHierarchy($descendantsResult, 'child'); | |
| 104 | + | |
| 105 | + return array ( | |
| 106 | + "status_code" => 0, | |
| 107 | + "results" => $descendants | |
| 108 | + ); | |
| 109 | + } | |
| 110 | + | |
| 111 | + /** | |
| 112 | + * Get direct children of the specified folder | |
| 113 | + * | |
| 114 | + * @param string $repositoryId | |
| 115 | + * @param string $folderId | |
| 116 | + * @param boolean $includeAllowableActions | |
| 117 | + * @param boolean $includeRelationships | |
| 118 | + * @param string $typeID | |
| 119 | + * @param string $filter | |
| 120 | + * @param int $maxItems | |
| 121 | + * @param int $skipCount | |
| 122 | + * @return array $descendants | |
| 123 | + */ | |
| 124 | + public function getChildren($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, | |
| 125 | + $typeID = 'Any', $filter = '', $maxItems = 0, $skipCount = 0) | |
| 126 | + { | |
| 127 | + // TODO paging | |
| 128 | + // TODO optional parameters | |
| 129 | + $childrenResult = $this->NavigationService->getChildren($repositoryId, $folderId, $includeAllowableActions, $includeRelationships); | |
| 130 | + | |
| 131 | + if (PEAR::isError($childrenResult)) | |
| 132 | + { | |
| 133 | + return array( | |
| 134 | + "status_code" => 1, | |
| 135 | + "message" => "Failed getting descendants for folder" | |
| 136 | + ); | |
| 137 | + } | |
| 138 | + | |
| 139 | + $children = CMISUtil::decodeObjectHierarchy($childrenResult, 'child'); | |
| 140 | + | |
| 141 | + return array( | |
| 142 | + "status_code" => 0, | |
| 143 | + "results" => $children | |
| 144 | + ); | |
| 145 | + } | |
| 146 | + | |
| 147 | + /** | |
| 148 | + * Gets the parent of the selected folder | |
| 149 | + * | |
| 150 | + * @param string $repositoryId | |
| 151 | + * @param string $folderId | |
| 152 | + * @param boolean $includeAllowableActions | |
| 153 | + * @param boolean $includeRelationships | |
| 154 | + * @param boolean $returnToRoot | |
| 155 | + * @param string $filter | |
| 156 | + * @return ancestry[] | |
| 157 | + */ | |
| 158 | + public function getFolderParent($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, $returnToRoot, $filter = '') | |
| 159 | + { | |
| 160 | + $ancestryResult = $this->NavigationService->getFolderParent($repositoryId, $folderId, $includeAllowableActions, | |
| 161 | + $includeRelationships, $returnToRoot); | |
| 162 | + | |
| 163 | + if (PEAR::isError($ancestryResult)) | |
| 164 | + { | |
| 165 | + return array( | |
| 166 | + "status_code" => 1, | |
| 167 | + "message" => "Failed getting ancestry for folder" | |
| 168 | + ); | |
| 169 | + } | |
| 170 | + | |
| 171 | + $ancestry = CMISUtil::decodeObjectHierarchy($ancestryResult, 'child'); | |
| 172 | + | |
| 173 | + return array( | |
| 174 | + "status_code" => 0, | |
| 175 | + "results" => $ancestry | |
| 176 | + ); | |
| 177 | + } | |
| 178 | + | |
| 179 | + /** | |
| 180 | + * Gets the parents for the selected object | |
| 181 | + * | |
| 182 | + * @param string $repositoryId | |
| 183 | + * @param string $folderId | |
| 184 | + * @param boolean $includeAllowableActions | |
| 185 | + * @param boolean $includeRelationships | |
| 186 | + * @param string $filter | |
| 187 | + * @return ancestry[] | |
| 188 | + */ | |
| 189 | + function getObjectParents($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, $filter = '') | |
| 190 | + { | |
| 191 | + $ancestryResult = $this->NavigationService->getObjectParents($repositoryId, $objectId, $includeAllowableActions, | |
| 192 | + $includeRelationships); | |
| 193 | + | |
| 194 | + if (PEAR::isError($ancestryResult)) | |
| 195 | + { | |
| 196 | + return array( | |
| 197 | + "status_code" => 1, | |
| 198 | + "message" => "Failed getting ancestry for object" | |
| 199 | + ); | |
| 200 | + } | |
| 201 | + | |
| 202 | + $ancestry = CMISUtil::decodeObjectHierarchy($ancestryResult, 'child'); | |
| 203 | + | |
| 204 | + return array( | |
| 205 | + "status_code" => 0, | |
| 206 | + "results" => $ancestry | |
| 207 | + ); | |
| 208 | + } | |
| 209 | + | |
| 210 | + /** | |
| 211 | + * Returns a list of checked out documents from the selected repository | |
| 212 | + * | |
| 213 | + * @param string $repositoryId | |
| 214 | + * @param string $folderId The folder for which checked out docs are requested | |
| 215 | + * @param string $filter | |
| 216 | + * @param boolean $includeAllowableActions | |
| 217 | + * @param boolean $includeRelationships | |
| 218 | + * @param int $maxItems | |
| 219 | + * @param int $skipCount | |
| 220 | + * @return array $checkedout The collection of checked out documents | |
| 221 | + */ | |
| 222 | + function getCheckedOutDocs($repositoryId, $includeAllowableActions, $includeRelationships, $folderId = null, $filter = '', | |
| 223 | + $maxItems = 0, $skipCount = 0) | |
| 224 | + { | |
| 225 | + $checkedout = $this->NavigationService->getCheckedOutDocs($repositoryId, $includeAllowableActions, $includeRelationships, | |
| 226 | + $folderId, $filter, $maxItems, $skipCount); | |
| 227 | + | |
| 228 | + if (PEAR::isError($checkedout)) | |
| 229 | + { | |
| 230 | + return array( | |
| 231 | + "status_code" => 1, | |
| 232 | + "message" => "Failed getting list of checked out documents" | |
| 233 | + ); | |
| 234 | + } | |
| 235 | + | |
| 236 | + // convert to array format for external code | |
| 237 | + $co = array(); | |
| 238 | + foreach ($checkedout as $documentProperties) | |
| 239 | + { | |
| 240 | + $co[] = CMISUtil::createObjectPropertiesEntry($documentProperties);; | |
| 241 | + } | |
| 242 | + | |
| 243 | + return array( | |
| 244 | + "status_code" => 0, | |
| 245 | + "results" => $co | |
| 246 | + ); | |
| 247 | + } | |
| 248 | + | |
| 249 | +} | |
| 250 | + | |
| 251 | +?> | |
| 0 | 252 | \ No newline at end of file | ... | ... |
lib/api/ktcmis/ktObjectService.inc.php
0 → 100644
| 1 | +<?php | |
| 2 | +/** | |
| 3 | +* Object Service CMIS wrapper API for KnowledgeTree. | |
| 4 | +* | |
| 5 | +* KnowledgeTree Community Edition | |
| 6 | +* Document Management Made Simple | |
| 7 | +* Copyright (C) 2008,2009 KnowledgeTree Inc. | |
| 8 | +* Portions copyright The Jam Warehouse Software (Pty) Limited | |
| 9 | +* | |
| 10 | +* This program is free software; you can redistribute it and/or modify it under | |
| 11 | +* the terms of the GNU General Public License version 3 as published by the | |
| 12 | +* Free Software Foundation. | |
| 13 | +* | |
| 14 | +* This program is distributed in the hope that it will be useful, but WITHOUT | |
| 15 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 16 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
| 17 | +* details. | |
| 18 | +* | |
| 19 | +* You should have received a copy of the GNU General Public License | |
| 20 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 21 | +* | |
| 22 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 23 | +* California 94120-7775, or email info@knowledgetree.com. | |
| 24 | +* | |
| 25 | +* The interactive user interfaces in modified source and object code versions | |
| 26 | +* of this program must display Appropriate Legal Notices, as required under | |
| 27 | +* Section 5 of the GNU General Public License version 3. | |
| 28 | +* | |
| 29 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | |
| 30 | +* these Appropriate Legal Notices must retain the display of the "Powered by | |
| 31 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 32 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | |
| 33 | +* must display the words "Powered by KnowledgeTree" and retain the original | |
| 34 | +* copyright notice. | |
| 35 | +* | |
| 36 | +* @copyright 2008-2009, KnowledgeTree Inc. | |
| 37 | +* @license GNU General Public License version 3 | |
| 38 | +* @author KnowledgeTree Team | |
| 39 | +* @package KTCMIS | |
| 40 | +* @version Version 0.9 | |
| 41 | +*/ | |
| 42 | + | |
| 43 | +require_once(realpath(dirname(__FILE__) . '/ktService.inc.php')); | |
| 44 | +require_once(CMIS_DIR . '/services/CMISObjectService.inc.php'); | |
| 45 | + | |
| 46 | +/** | |
| 47 | + * Handles requests for and actions on Folders and Documents | |
| 48 | + */ | |
| 49 | +class KTObjectService extends KTCMISBase { | |
| 50 | + | |
| 51 | + protected $ObjectService; | |
| 52 | + | |
| 53 | + public function __construct(&$ktapi = null, $username = null, $password = null) | |
| 54 | + { | |
| 55 | + parent::__construct($ktapi, $username, $password); | |
| 56 | + // instantiate underlying CMIS service | |
| 57 | + $this->ObjectService = new CMISObjectService(); | |
| 58 | + $this->setInterface(); | |
| 59 | + } | |
| 60 | + | |
| 61 | + public function startSession($username, $password) | |
| 62 | + { | |
| 63 | + parent::startSession($username, $password); | |
| 64 | + $this->setInterface(); | |
| 65 | + return self::$session; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public function setInterface(&$ktapi = null) | |
| 69 | + { | |
| 70 | + parent::setInterface($ktapi); | |
| 71 | + $this->ObjectService->setInterface(self::$ktapi); | |
| 72 | + } | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * Gets the properties for the selected object | |
| 76 | + * | |
| 77 | + * @param string $repositoryId | |
| 78 | + * @param string $objectId | |
| 79 | + * @param boolean $includeAllowableActions | |
| 80 | + * @param boolean $includeRelationships | |
| 81 | + * @param string $returnVersion | |
| 82 | + * @param string $filter | |
| 83 | + * @return properties[] | |
| 84 | + */ | |
| 85 | + public function getProperties($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, | |
| 86 | + $returnVersion = false, $filter = '') | |
| 87 | + { | |
| 88 | + try { | |
| 89 | + $propertyCollection = $this->ObjectService->getProperties($repositoryId, $objectId, $includeAllowableActions, | |
| 90 | + $includeRelationships); | |
| 91 | + } | |
| 92 | + catch (Exception $e) | |
| 93 | + { | |
| 94 | + return array( | |
| 95 | + "status_code" => 1, | |
| 96 | + "message" => $e->getMessage() | |
| 97 | + ); | |
| 98 | + } | |
| 99 | + | |
| 100 | + $properties = CMISUtil::createObjectPropertiesEntry($propertyCollection); | |
| 101 | + | |
| 102 | + return array( | |
| 103 | + "status_code" => 0, | |
| 104 | + "results" => $properties | |
| 105 | + ); | |
| 106 | + } | |
| 107 | + | |
| 108 | + /** | |
| 109 | + * Creates a new document within the repository | |
| 110 | + * | |
| 111 | + * @param string $repositoryId The repository to which the document must be added | |
| 112 | + * @param string $typeId Object Type id for the document object being created | |
| 113 | + * @param array $properties Array of properties which must be applied to the created document object | |
| 114 | + * @param string $folderId The id of the folder which will be the parent of the created document object | |
| 115 | + * This parameter is optional IF unfilingCapability is supported | |
| 116 | + * @param contentStream $contentStream optional content stream data | |
| 117 | + * @param string $versioningState optional version state value: checkedout/major/minor | |
| 118 | + * @return string $objectId The id of the created folder object | |
| 119 | + */ | |
| 120 | + public function createDocument($repositoryId, $typeId, $properties, $folderId = null, | |
| 121 | + $contentStream = null, $versioningState = null) | |
| 122 | + { | |
| 123 | + $objectId = null; | |
| 124 | + | |
| 125 | + try { | |
| 126 | + $objectId = $this->ObjectService->createDocument($repositoryId, $typeId, $properties, $folderId, | |
| 127 | + $contentStream, $versioningState); | |
| 128 | + } | |
| 129 | + catch (Exception $e) | |
| 130 | + { | |
| 131 | + return array( | |
| 132 | + "status_code" => 1, | |
| 133 | + "message" => $e->getMessage() | |
| 134 | + ); | |
| 135 | + } | |
| 136 | + | |
| 137 | + return array( | |
| 138 | + 'status_code' => 0, | |
| 139 | + 'results' => $objectId | |
| 140 | + ); | |
| 141 | + } | |
| 142 | + | |
| 143 | + /** | |
| 144 | + * Creates a new folder within the repository | |
| 145 | + * | |
| 146 | + * @param string $repositoryId The repository to which the folder must be added | |
| 147 | + * @param string $typeId Object Type id for the folder object being created | |
| 148 | + * @param array $properties Array of properties which must be applied to the created folder object | |
| 149 | + * @param string $folderId The id of the folder which will be the parent of the created folder object | |
| 150 | + * @return string $objectId The id of the created folder object | |
| 151 | + */ | |
| 152 | + public function createFolder($repositoryId, $typeId, $properties, $folderId) | |
| 153 | + { | |
| 154 | + $objectId = null; | |
| 155 | + | |
| 156 | + try { | |
| 157 | + $objectId = $this->ObjectService->createFolder($repositoryId, $typeId, $properties, $folderId); | |
| 158 | + } | |
| 159 | + catch (Exception $e) | |
| 160 | + { | |
| 161 | + return array( | |
| 162 | + "status_code" => 1, | |
| 163 | + "message" => $e->getMessage() | |
| 164 | + ); | |
| 165 | + } | |
| 166 | + | |
| 167 | + return array( | |
| 168 | + 'status_code' => 0, | |
| 169 | + 'results' => $objectId | |
| 170 | + ); | |
| 171 | + } | |
| 172 | + | |
| 173 | + /** | |
| 174 | + * Fetches the content stream data for an object | |
| 175 | + * | |
| 176 | + * @param string $repositoryId | |
| 177 | + * @param string $objectId | |
| 178 | + * @return string $contentStream (binary or text data) | |
| 179 | + */ | |
| 180 | + function getContentStream($repositoryId, $objectId) | |
| 181 | + { | |
| 182 | + try { | |
| 183 | + $contentStream = $this->ObjectService->getContentStream($repositoryId, $objectId); | |
| 184 | + } | |
| 185 | + catch (Exception $e) | |
| 186 | + { | |
| 187 | + return array( | |
| 188 | + "status_code" => 1, | |
| 189 | + "message" => $e->getMessage() | |
| 190 | + ); | |
| 191 | + } | |
| 192 | + | |
| 193 | + return array( | |
| 194 | + 'status_code' => 0, | |
| 195 | + 'results' => $contentStream | |
| 196 | + ); | |
| 197 | + } | |
| 198 | + | |
| 199 | + /** | |
| 200 | + * Moves a fileable object from one folder to another. | |
| 201 | + * | |
| 202 | + * @param object $repositoryId | |
| 203 | + * @param object $objectId | |
| 204 | + * @param object $changeToken [optional] | |
| 205 | + * @param object $targetFolderId | |
| 206 | + * @param object $sourceFolderId [optional] | |
| 207 | + */ | |
| 208 | + public function moveObject($repositoryId, $objectId, $changeToken = '', $targetFolderId, $sourceFolderId = null) | |
| 209 | + { | |
| 210 | + try { | |
| 211 | + $this->ObjectService->moveObject($repositoryId, $objectId, $changeToken, $targetFolderId, $sourceFolderId); | |
| 212 | + } | |
| 213 | + catch (Exception $e) | |
| 214 | + { | |
| 215 | + return array( | |
| 216 | + "status_code" => 1, | |
| 217 | + "message" => $e->getMessage() | |
| 218 | + ); | |
| 219 | + } | |
| 220 | + | |
| 221 | + return array( | |
| 222 | + 'status_code' => 0, | |
| 223 | + 'results' => $objectId | |
| 224 | + ); | |
| 225 | + } | |
| 226 | + | |
| 227 | + /** | |
| 228 | + * Deletes an object from the repository | |
| 229 | + * | |
| 230 | + * @param string $repositoryId | |
| 231 | + * @param string $objectId | |
| 232 | + * @param string $changeToken [optional] | |
| 233 | + * @return array | |
| 234 | + */ | |
| 235 | + // NOTE Invoking this service method on an object SHALL not delete the entire version series for a Document Object. | |
| 236 | + // To delete an entire version series, use the deleteAllVersions() service | |
| 237 | + public function deleteObject($repositoryId, $objectId, $changeToken = null) | |
| 238 | + { | |
| 239 | + try { | |
| 240 | + $this->ObjectService->deleteObject($repositoryId, $objectId, $changeToken); | |
| 241 | + } | |
| 242 | + catch (Exception $e) | |
| 243 | + { | |
| 244 | + return array( | |
| 245 | + "status_code" => 1, | |
| 246 | + "message" => $e->getMessage() | |
| 247 | + ); | |
| 248 | + } | |
| 249 | + | |
| 250 | + return array( | |
| 251 | + 'status_code' => 0, | |
| 252 | + 'results' => $objectId | |
| 253 | + ); | |
| 254 | + } | |
| 255 | + | |
| 256 | + public function deleteTree($repositoryId, $objectId, $changeToken = null, $unfileNonfolderObject = 'delete', $continueOnFailure = false) | |
| 257 | + { | |
| 258 | + try { | |
| 259 | + $result = $this->ObjectService->deleteTree($repositoryId, $objectId, $changeToken, $unfileNonfolderObject, $continueOnFailure); | |
| 260 | + } | |
| 261 | + catch (Exception $e) | |
| 262 | + { | |
| 263 | + return array( | |
| 264 | + "status_code" => 1, | |
| 265 | + "message" => $e->getMessage() | |
| 266 | + ); | |
| 267 | + } | |
| 268 | + | |
| 269 | + // check whether there is a list of items which did not delete | |
| 270 | + if (count($result) > 0) | |
| 271 | + { | |
| 272 | + return array( | |
| 273 | + "status_code" => 1, | |
| 274 | + "message" => $result | |
| 275 | + ); | |
| 276 | + } | |
| 277 | + | |
| 278 | + return array( | |
| 279 | + 'status_code' => 0, | |
| 280 | + 'results' => $objectId | |
| 281 | + ); | |
| 282 | + } | |
| 283 | + | |
| 284 | + /** | |
| 285 | + * Sets the content stream data for an existing document | |
| 286 | + * | |
| 287 | + * if $overwriteFlag = TRUE, the new content stream is applied whether or not the document has an existing content stream | |
| 288 | + * if $overwriteFlag = FALSE, the new content stream is applied only if the document does not have an existing content stream | |
| 289 | + * | |
| 290 | + * NOTE A Repository MAY automatically create new Document versions as part of this service method. | |
| 291 | + * Therefore, the documentId output NEED NOT be identical to the documentId input. | |
| 292 | + * | |
| 293 | + * @param string $repositoryId | |
| 294 | + * @param string $documentId | |
| 295 | + * @param boolean $overwriteFlag | |
| 296 | + * @param string $contentStream | |
| 297 | + * @param string $changeToken | |
| 298 | + * @return string $documentId | |
| 299 | + */ | |
| 300 | + function setContentStream($repositoryId, $documentId, $overwriteFlag, $contentStream, $changeToken = null) | |
| 301 | + { | |
| 302 | + try { | |
| 303 | + $documentId = $this->ObjectService->setContentStream($repositoryId, $documentId, $overwriteFlag, $contentStream, $changeToken); | |
| 304 | + } | |
| 305 | + catch (Exception $e) | |
| 306 | + { | |
| 307 | + return array( | |
| 308 | + "status_code" => 1, | |
| 309 | + "message" => $e->getMessage() | |
| 310 | + ); | |
| 311 | + } | |
| 312 | + | |
| 313 | + return array( | |
| 314 | + 'status_code' => 0, | |
| 315 | + 'results' => $documentId | |
| 316 | + ); | |
| 317 | + } | |
| 318 | + | |
| 319 | +} | |
| 320 | + | |
| 321 | +?> | |
| 0 | 322 | \ No newline at end of file | ... | ... |
lib/api/ktcmis/ktRepositoryService.inc.php
0 → 100644
| 1 | +<?php | |
| 2 | +/** | |
| 3 | +* Repository Service CMIS wrapper API for KnowledgeTree. | |
| 4 | +* | |
| 5 | +* KnowledgeTree Community Edition | |
| 6 | +* Document Management Made Simple | |
| 7 | +* Copyright (C) 2008,2009 KnowledgeTree Inc. | |
| 8 | +* Portions copyright The Jam Warehouse Software (Pty) Limited | |
| 9 | +* | |
| 10 | +* This program is free software; you can redistribute it and/or modify it under | |
| 11 | +* the terms of the GNU General Public License version 3 as published by the | |
| 12 | +* Free Software Foundation. | |
| 13 | +* | |
| 14 | +* This program is distributed in the hope that it will be useful, but WITHOUT | |
| 15 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 16 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
| 17 | +* details. | |
| 18 | +* | |
| 19 | +* You should have received a copy of the GNU General Public License | |
| 20 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 21 | +* | |
| 22 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 23 | +* California 94120-7775, or email info@knowledgetree.com. | |
| 24 | +* | |
| 25 | +* The interactive user interfaces in modified source and object code versions | |
| 26 | +* of this program must display Appropriate Legal Notices, as required under | |
| 27 | +* Section 5 of the GNU General Public License version 3. | |
| 28 | +* | |
| 29 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | |
| 30 | +* these Appropriate Legal Notices must retain the display of the "Powered by | |
| 31 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 32 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | |
| 33 | +* must display the words "Powered by KnowledgeTree" and retain the original | |
| 34 | +* copyright notice. | |
| 35 | +* | |
| 36 | +* @copyright 2008-2009, KnowledgeTree Inc. | |
| 37 | +* @license GNU General Public License version 3 | |
| 38 | +* @author KnowledgeTree Team | |
| 39 | +* @package KTCMIS | |
| 40 | +* @version Version 0.9 | |
| 41 | +*/ | |
| 42 | + | |
| 43 | +require_once(realpath(dirname(__FILE__) . '/ktService.inc.php')); | |
| 44 | +require_once(CMIS_DIR . '/services/CMISRepositoryService.inc.php'); | |
| 45 | + | |
| 46 | +/** | |
| 47 | + * Handles low level repository information queries | |
| 48 | + */ | |
| 49 | +class KTRepositoryService extends KTCMISBase { | |
| 50 | + | |
| 51 | + protected $RepositoryService; | |
| 52 | + | |
| 53 | + public function __construct() | |
| 54 | + { | |
| 55 | + // we don't need to call the parent constructor here as there is no ktapi involved | |
| 56 | + // instantiate underlying CMIS service | |
| 57 | + $this->RepositoryService = new CMISRepositoryService(); | |
| 58 | + } | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * Fetch a list of all available repositories | |
| 62 | + * | |
| 63 | + * NOTE Since we only have one repository at the moment, this is expected to only return one result | |
| 64 | + * | |
| 65 | + * @return repositoryList[] | |
| 66 | + */ | |
| 67 | + public function getRepositories() | |
| 68 | + { | |
| 69 | + $repositories = $this->RepositoryService->getRepositories(); | |
| 70 | + if (PEAR::isError($repositories)) | |
| 71 | + { | |
| 72 | + return array( | |
| 73 | + "status_code" => 1, | |
| 74 | + "message" => "Failed getting repositories" | |
| 75 | + ); | |
| 76 | + } | |
| 77 | + | |
| 78 | + // extract the required info fields into array format for easy encoding; | |
| 79 | + $count = 0; | |
| 80 | + $repositoryList = array(); | |
| 81 | + foreach ($repositories as $repository) | |
| 82 | + { | |
| 83 | + $repositoryList[$count]['repositoryId'] = $repository->getRepositoryId(); | |
| 84 | + $repositoryList[$count]['repositoryName'] = $repository->getRepositoryName(); | |
| 85 | + $repositoryList[$count]['repositoryURI'] = $repository->getRepositoryURI(); | |
| 86 | + ++$count; | |
| 87 | + } | |
| 88 | + | |
| 89 | + return array( | |
| 90 | + "status_code" => 0, | |
| 91 | + "results" => $repositoryList | |
| 92 | + ); | |
| 93 | + } | |
| 94 | + | |
| 95 | + /** | |
| 96 | + * Fetches information about the selected repository | |
| 97 | + * | |
| 98 | + * @param string $repositoryId | |
| 99 | + */ | |
| 100 | + public function getRepositoryInfo($repositoryId) | |
| 101 | + { | |
| 102 | + $repositoryInfo = $this->RepositoryService->getRepositoryInfo($repositoryId); | |
| 103 | + if (PEAR::isError($repositoryInfo)) | |
| 104 | + { | |
| 105 | + return array( | |
| 106 | + "status_code" => 1, | |
| 107 | + "message" => "Failed getting repository information" | |
| 108 | + ); | |
| 109 | + } | |
| 110 | + | |
| 111 | + // TODO output this manually, the function works but only for some objects so rather avoid it completely? | |
| 112 | + // NOTE the problems appear to be due to recursive objects | |
| 113 | + return array ( | |
| 114 | + "status_code" => 0, | |
| 115 | + "results" => CMISUtil::objectToArray($repositoryInfo) | |
| 116 | + ); | |
| 117 | + } | |
| 118 | + | |
| 119 | + /** | |
| 120 | + * Fetch the list of supported object types for the selected repository | |
| 121 | + * | |
| 122 | + * @param string $repositoryId | |
| 123 | + */ | |
| 124 | + public function getTypes($repositoryId, $typeId = '', $returnPropertyDefinitions = false, | |
| 125 | + $maxItems = 0, $skipCount = 0, &$hasMoreItems = false) | |
| 126 | + { | |
| 127 | + try { | |
| 128 | + $repositoryObjectTypeResult = $this->RepositoryService->getTypes($repositoryId, $typeId, $returnPropertyDefinitions, | |
| 129 | + $maxItems, $skipCount, $hasMoreItems); | |
| 130 | + } | |
| 131 | + catch (Exception $e) | |
| 132 | + { | |
| 133 | + return array( | |
| 134 | + "status_code" => 1, | |
| 135 | + "message" => $e->getMessage() | |
| 136 | + ); | |
| 137 | + } | |
| 138 | + | |
| 139 | + // format as array style output | |
| 140 | + // NOTE only concerned with attributes at this time | |
| 141 | + // TODO add support for properties | |
| 142 | + foreach($repositoryObjectTypeResult as $key => $objectType) | |
| 143 | + { | |
| 144 | + $repositoryObjectTypes[$key] = $objectType['attributes']; | |
| 145 | + // TODO properties | |
| 146 | + // $repositoryObjectTypes[$key]['properties'] = $objectType['properties']; | |
| 147 | + } | |
| 148 | + | |
| 149 | + return array ( | |
| 150 | + "status_code" => 0, | |
| 151 | + "results" => $repositoryObjectTypes | |
| 152 | + ); | |
| 153 | + } | |
| 154 | + | |
| 155 | + /** | |
| 156 | + * Fetch the object type definition for the requested type | |
| 157 | + * | |
| 158 | + * @param string $repositoryId | |
| 159 | + * @param string $typeId | |
| 160 | + */ | |
| 161 | + public function getTypeDefinition($repositoryId, $typeId) | |
| 162 | + { | |
| 163 | + try { | |
| 164 | + $typeDefinitionResult = $this->RepositoryService->getTypeDefinition($repositoryId, $typeId); | |
| 165 | + } | |
| 166 | + catch (Exception $e) | |
| 167 | + { | |
| 168 | + return array( | |
| 169 | + "status_code" => 1, | |
| 170 | + "message" => $e->getMessage() | |
| 171 | + ); | |
| 172 | + } | |
| 173 | + | |
| 174 | + // format as array style output | |
| 175 | + // NOTE only concerned with attributes at this time | |
| 176 | + // TODO add support for properties | |
| 177 | + $typeDefinition = $typeDefinitionResult['attributes']; | |
| 178 | + | |
| 179 | + return array ( | |
| 180 | + "status_code" => 0, | |
| 181 | + "results" => $typeDefinition | |
| 182 | + ); | |
| 183 | + } | |
| 184 | + | |
| 185 | +} | |
| 186 | + | |
| 187 | +?> | |
| 0 | 188 | \ No newline at end of file | ... | ... |
lib/api/ktcmis/ktService.inc.php
0 → 100644
| 1 | +<?php | |
| 2 | +/** | |
| 3 | +* Base service class for CMIS wrapper API for KnowledgeTree. | |
| 4 | +* | |
| 5 | +* KnowledgeTree Community Edition | |
| 6 | +* Document Management Made Simple | |
| 7 | +* Copyright (C) 2008,2009 KnowledgeTree Inc. | |
| 8 | +* Portions copyright The Jam Warehouse Software (Pty) Limited | |
| 9 | +* | |
| 10 | +* This program is free software; you can redistribute it and/or modify it under | |
| 11 | +* the terms of the GNU General Public License version 3 as published by the | |
| 12 | +* Free Software Foundation. | |
| 13 | +* | |
| 14 | +* This program is distributed in the hope that it will be useful, but WITHOUT | |
| 15 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 16 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
| 17 | +* details. | |
| 18 | +* | |
| 19 | +* You should have received a copy of the GNU General Public License | |
| 20 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 21 | +* | |
| 22 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 23 | +* California 94120-7775, or email info@knowledgetree.com. | |
| 24 | +* | |
| 25 | +* The interactive user interfaces in modified source and object code versions | |
| 26 | +* of this program must display Appropriate Legal Notices, as required under | |
| 27 | +* Section 5 of the GNU General Public License version 3. | |
| 28 | +* | |
| 29 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | |
| 30 | +* these Appropriate Legal Notices must retain the display of the "Powered by | |
| 31 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 32 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | |
| 33 | +* must display the words "Powered by KnowledgeTree" and retain the original | |
| 34 | +* copyright notice. | |
| 35 | +* | |
| 36 | +* @copyright 2008-2009, KnowledgeTree Inc. | |
| 37 | +* @license GNU General Public License version 3 | |
| 38 | +* @author KnowledgeTree Team | |
| 39 | +* @package KTCMIS | |
| 40 | +* @version Version 0.9 | |
| 41 | +*/ | |
| 42 | + | |
| 43 | +require_once(realpath(dirname(__FILE__) . '/../../../config/dmsDefaults.php')); | |
| 44 | +require_once(KT_DIR . '/ktapi/ktapi.inc.php'); | |
| 45 | + | |
| 46 | +define ('CMIS_DIR', KT_LIB_DIR . '/api/ktcmis'); | |
| 47 | +require_once(CMIS_DIR . '/exceptions/PermissionDeniedException.inc.php'); | |
| 48 | +require_once(CMIS_DIR . '/util/CMISUtil.inc.php'); | |
| 49 | + | |
| 50 | +/** | |
| 51 | + * Base class for all KT CMIS classes | |
| 52 | + * Handles authentication | |
| 53 | + * | |
| 54 | + * This class is required for all CMIS Service classes | |
| 55 | + */ | |
| 56 | +class KTCMISBase { | |
| 57 | + | |
| 58 | + // we want all child classes to share the ktapi and session instances, no matter where they are set from, | |
| 59 | + // so we declare them as static | |
| 60 | + static protected $ktapi; | |
| 61 | + static protected $session; | |
| 62 | + | |
| 63 | + public function __construct(&$ktapi = null, $username = null, $password = null) | |
| 64 | + { | |
| 65 | + // TODO confirm KTAPI instance active??? shouldn't really be responsibility of this code | |
| 66 | + if (is_null($ktapi) && (!is_null($username) && !is_null($password))) { | |
| 67 | + $this->startSession($username, $password); | |
| 68 | + } | |
| 69 | + else if (!is_null($ktapi)) { | |
| 70 | + self::$ktapi = $ktapi; | |
| 71 | + self::$session = self::$ktapi->get_session(); | |
| 72 | + } | |
| 73 | + } | |
| 74 | + | |
| 75 | + // TODO this probably does not belong here??? probably should require all auth external, handled by transport protocol. | |
| 76 | + // perhaps simple refusal to execute without valid session? | |
| 77 | + // NOTE left in to allow transport protocol to delegate auth to this level, but not actually used in any code at present | |
| 78 | + public function startSession($username, $password) | |
| 79 | + { | |
| 80 | + // attempt to recover session if one exists | |
| 81 | + if (!is_null(self::$session) && !PEAR::isError(self::$session)) | |
| 82 | + { | |
| 83 | + self::$session =& self::$ktapi->get_active_session(self::$session->get_sessionid()); | |
| 84 | + } | |
| 85 | + | |
| 86 | + // start new session if no existing session or problem getting existing session (expired, etc...) | |
| 87 | + if (is_null(self::$session) || PEAR::isError(self::$session)) | |
| 88 | + { | |
| 89 | + self::$ktapi = new KTAPI(); | |
| 90 | + self::$session =& self::$ktapi->start_session($username, $password); | |
| 91 | + } | |
| 92 | + | |
| 93 | + // failed authentication? | |
| 94 | + if (PEAR::isError(self::$session)) | |
| 95 | + { | |
| 96 | + throw new PermissionDeniedException('You must be authenticated to perform this action'); | |
| 97 | + } | |
| 98 | + | |
| 99 | + return self::$session; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public function setInterface(&$ktapi = null) | |
| 103 | + { | |
| 104 | + if (!is_null($ktapi)) { | |
| 105 | + self::$ktapi = $ktapi; | |
| 106 | + } | |
| 107 | + } | |
| 108 | + | |
| 109 | + public function getInterface() | |
| 110 | + { | |
| 111 | + return self::$ktapi; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public function getSession() | |
| 115 | + { | |
| 116 | + return self::$session; | |
| 117 | + } | |
| 118 | + | |
| 119 | + // TODO what about destroying sessions? only on logout (which is not offered by the CMIS clients tested so far) | |
| 120 | +} | |
| 121 | + | |
| 122 | +?> | |
| 0 | 123 | \ No newline at end of file | ... | ... |
lib/api/ktcmis/ktVersioningService.inc.php
0 → 100644
| 1 | +<?php | |
| 2 | +/** | |
| 3 | +* Versioning Service CMIS wrapper API for KnowledgeTree. | |
| 4 | +* | |
| 5 | +* KnowledgeTree Community Edition | |
| 6 | +* Document Management Made Simple | |
| 7 | +* Copyright (C) 2008,2009 KnowledgeTree Inc. | |
| 8 | +* Portions copyright The Jam Warehouse Software (Pty) Limited | |
| 9 | +* | |
| 10 | +* This program is free software; you can redistribute it and/or modify it under | |
| 11 | +* the terms of the GNU General Public License version 3 as published by the | |
| 12 | +* Free Software Foundation. | |
| 13 | +* | |
| 14 | +* This program is distributed in the hope that it will be useful, but WITHOUT | |
| 15 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 16 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
| 17 | +* details. | |
| 18 | +* | |
| 19 | +* You should have received a copy of the GNU General Public License | |
| 20 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 21 | +* | |
| 22 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 23 | +* California 94120-7775, or email info@knowledgetree.com. | |
| 24 | +* | |
| 25 | +* The interactive user interfaces in modified source and object code versions | |
| 26 | +* of this program must display Appropriate Legal Notices, as required under | |
| 27 | +* Section 5 of the GNU General Public License version 3. | |
| 28 | +* | |
| 29 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | |
| 30 | +* these Appropriate Legal Notices must retain the display of the "Powered by | |
| 31 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 32 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | |
| 33 | +* must display the words "Powered by KnowledgeTree" and retain the original | |
| 34 | +* copyright notice. | |
| 35 | +* | |
| 36 | +* @copyright 2008-2009, KnowledgeTree Inc. | |
| 37 | +* @license GNU General Public License version 3 | |
| 38 | +* @author KnowledgeTree Team | |
| 39 | +* @package KTCMIS | |
| 40 | +* @version Version 0.9 | |
| 41 | +*/ | |
| 42 | + | |
| 43 | +/** | |
| 44 | + * Split into individual classes to handle each section of functionality. | |
| 45 | + * This is really just a handling layer between CMIS and the web services. | |
| 46 | + */ | |
| 47 | + | |
| 48 | +require_once(realpath(dirname(__FILE__) . '/ktService.inc.php')); | |
| 49 | +require_once(CMIS_DIR . '/services/CMISVersioningService.inc.php'); | |
| 50 | + | |
| 51 | +/** | |
| 52 | + * Handles requests for and actions on versionable objects | |
| 53 | + */ | |
| 54 | +class KTVersioningService extends KTCMISBase { | |
| 55 | + | |
| 56 | + protected $VersioningService; | |
| 57 | + | |
| 58 | + public function __construct(&$ktapi = null, $username = null, $password = null) | |
| 59 | + { | |
| 60 | + parent::__construct($ktapi, $username, $password); | |
| 61 | + // instantiate underlying CMIS service | |
| 62 | + $this->VersioningService = new CMISVersioningService(); | |
| 63 | + $this->setInterface(); | |
| 64 | + } | |
| 65 | + | |
| 66 | + public function startSession($username, $password) | |
| 67 | + { | |
| 68 | + parent::startSession($username, $password); | |
| 69 | + $this->setInterface(); | |
| 70 | + return self::$session; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public function setInterface(&$ktapi = null) | |
| 74 | + { | |
| 75 | + parent::setInterface($ktapi); | |
| 76 | + $this->VersioningService->setInterface(self::$ktapi); | |
| 77 | + } | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * Deletes all Document Objects in the specified Version Series, including the Private Working Copy | |
| 81 | + * | |
| 82 | + * @param string $repositoryId | |
| 83 | + * @param string $versionSeriesId | |
| 84 | + * @return boolean true if successful | |
| 85 | + */ | |
| 86 | + public function deleteAllVersions($repositoryId, $versionSeriesId) | |
| 87 | + { | |
| 88 | + try { | |
| 89 | + $result = $this->VersioningService->deleteAllVersions($repositoryId, $versionSeriesId); | |
| 90 | + } | |
| 91 | + catch (Exception $e) | |
| 92 | + { | |
| 93 | + return array( | |
| 94 | + "status_code" => 1, | |
| 95 | + "message" => $e->getMessage() | |
| 96 | + ); | |
| 97 | + } | |
| 98 | + | |
| 99 | + return array( | |
| 100 | + 'status_code' => 0, | |
| 101 | + 'results' => $result | |
| 102 | + ); | |
| 103 | + } | |
| 104 | + | |
| 105 | + /** | |
| 106 | + * Checks out a document and creates the PWC (Private Working Copy) which will represent the checked out document | |
| 107 | + * | |
| 108 | + * @param string $repositoryId | |
| 109 | + * @param string $documentId | |
| 110 | + * @param string $changeToken [optional] | |
| 111 | + * @return array results | |
| 112 | + */ | |
| 113 | + // TODO set up delivery of content stream? or is that up to the CMIS client? | |
| 114 | + public function checkOut($repositoryId, $documentId, $changeToken = '') | |
| 115 | + { | |
| 116 | + try { | |
| 117 | + $result = $this->VersioningService->checkOut($repositoryId, $documentId, $changeToken); | |
| 118 | + } | |
| 119 | + catch (Exception $e) | |
| 120 | + { | |
| 121 | + return array( | |
| 122 | + "status_code" => 1, | |
| 123 | + "message" => $e->getMessage() | |
| 124 | + ); | |
| 125 | + } | |
| 126 | + | |
| 127 | + return array( | |
| 128 | + 'status_code' => 0, | |
| 129 | + 'results' => (!empty($result) ? $result : 'Document Checked Out') | |
| 130 | + ); | |
| 131 | + } | |
| 132 | + | |
| 133 | + /** | |
| 134 | + * 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" | |
| 135 | + * | |
| 136 | + * @param string $repositoryId | |
| 137 | + * @param string $documentId | |
| 138 | + * @param string $changeToken [optional] | |
| 139 | + */ | |
| 140 | + // TODO exceptions: | |
| 141 | + // • ConstraintViolationException: The Repository SHALL throw this exception if ANY of the following conditions are met: | |
| 142 | + // o The Document’s Object-Type definition’s versionable attribute is FALSE. | |
| 143 | + // • updateConflictException | |
| 144 | + // • versioningException | |
| 145 | + public function cancelCheckOut($repositoryId, $documentId, $changeToken = '') | |
| 146 | + { | |
| 147 | + try { | |
| 148 | + $result = $this->VersioningService->cancelCheckOut($repositoryId, $documentId, $changeToken); | |
| 149 | + } | |
| 150 | + catch (Exception $e) | |
| 151 | + { | |
| 152 | + return array( | |
| 153 | + "status_code" => 1, | |
| 154 | + "message" => $e->getMessage() | |
| 155 | + ); | |
| 156 | + } | |
| 157 | + | |
| 158 | + return array( | |
| 159 | + 'status_code' => 0, | |
| 160 | + 'results' => (!empty($result) ? $result : 'Document Checkout Cancelled') | |
| 161 | + ); | |
| 162 | + } | |
| 163 | + | |
| 164 | + /** | |
| 165 | + * Checks in a checked out document | |
| 166 | + * | |
| 167 | + * @param string $repositoryId | |
| 168 | + * @param string $documentId | |
| 169 | + * @param boolean $major | |
| 170 | + * @param string $changeToken [optional] | |
| 171 | + * @param array $properties [optional] | |
| 172 | + * @param contentStream $contentStream [optional] | |
| 173 | + * @param string $checkinComment [optional] | |
| 174 | + * @return string $documentId | |
| 175 | + */ | |
| 176 | + public function checkIn($repositoryId, $documentId, $major, $contentStream = null, $changeToken = '', $properties = array(), $checkinComment = '') | |
| 177 | + { | |
| 178 | + try { | |
| 179 | + $result = $this->VersioningService->checkIn($repositoryId, $documentId, $major, $contentStream, $changeToken, $properties, $checkinComment); | |
| 180 | + } | |
| 181 | + catch (Exception $e) | |
| 182 | + { | |
| 183 | + return array( | |
| 184 | + "status_code" => 1, | |
| 185 | + "message" => $e->getMessage() | |
| 186 | + ); | |
| 187 | + } | |
| 188 | + | |
| 189 | + return array( | |
| 190 | + 'status_code' => 0, | |
| 191 | + 'results' => (!empty($result) ? $result : 'Document Checked In Successfully') | |
| 192 | + ); | |
| 193 | + } | |
| 194 | + | |
| 195 | +} | |
| 196 | + | |
| 197 | +?> | |
| 0 | 198 | \ No newline at end of file | ... | ... |
lib/api/ktcmis/ktcmis.inc.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | -* Implements a CMIS wrapper API for KnowledgeTree. | |
| 4 | -* | |
| 5 | -* KnowledgeTree Community Edition | |
| 6 | -* Document Management Made Simple | |
| 7 | -* Copyright (C) 2008,2009 KnowledgeTree Inc. | |
| 8 | -* Portions copyright The Jam Warehouse Software (Pty) Limited | |
| 9 | -* | |
| 10 | -* This program is free software; you can redistribute it and/or modify it under | |
| 11 | -* the terms of the GNU General Public License version 3 as published by the | |
| 12 | -* Free Software Foundation. | |
| 13 | -* | |
| 14 | -* This program is distributed in the hope that it will be useful, but WITHOUT | |
| 15 | -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 16 | -* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
| 17 | -* details. | |
| 18 | -* | |
| 19 | -* You should have received a copy of the GNU General Public License | |
| 20 | -* along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 21 | -* | |
| 22 | -* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 23 | -* California 94120-7775, or email info@knowledgetree.com. | |
| 24 | -* | |
| 25 | -* The interactive user interfaces in modified source and object code versions | |
| 26 | -* of this program must display Appropriate Legal Notices, as required under | |
| 27 | -* Section 5 of the GNU General Public License version 3. | |
| 28 | -* | |
| 29 | -* In accordance with Section 7(b) of the GNU General Public License version 3, | |
| 30 | -* these Appropriate Legal Notices must retain the display of the "Powered by | |
| 31 | -* KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 32 | -* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | |
| 33 | -* must display the words "Powered by KnowledgeTree" and retain the original | |
| 34 | -* copyright notice. | |
| 35 | -* | |
| 36 | -* @copyright 2008-2009, KnowledgeTree Inc. | |
| 37 | -* @license GNU General Public License version 3 | |
| 38 | -* @author KnowledgeTree Team | |
| 39 | -* @package KTCMIS | |
| 40 | -* @version Version 0.9 | |
| 41 | -*/ | |
| 42 | - | |
| 43 | -/** | |
| 44 | - * Split into individual classes to handle each section of functionality. | |
| 45 | - * This is really just a handling layer between CMIS and the web services. | |
| 46 | - */ | |
| 47 | - | |
| 48 | -// TODO implement exceptions in various calls (in the underlying classes) | |
| 49 | -// FIXME none of the error handling actually does anything, it's leftover from copy/paste of some ktapi code | |
| 50 | - | |
| 51 | -require_once(realpath(dirname(__FILE__) . '/../../../config/dmsDefaults.php')); | |
| 52 | -require_once(KT_DIR . '/ktapi/ktapi.inc.php'); | |
| 53 | - | |
| 54 | -define ('CMIS_DIR', KT_LIB_DIR . '/api/ktcmis'); | |
| 55 | -require_once(CMIS_DIR . '/exceptions/PermissionDeniedException.inc.php'); | |
| 56 | -require_once(CMIS_DIR . '/services/CMISRepositoryService.inc.php'); | |
| 57 | -require_once(CMIS_DIR . '/services/CMISNavigationService.inc.php'); | |
| 58 | -require_once(CMIS_DIR . '/services/CMISObjectService.inc.php'); | |
| 59 | -require_once(CMIS_DIR . '/services/CMISVersioningService.inc.php'); | |
| 60 | -require_once(CMIS_DIR . '/util/CMISUtil.inc.php'); | |
| 61 | - | |
| 62 | -/** | |
| 63 | - * Base class for all KT CMIS classes | |
| 64 | - * Handles authentication | |
| 65 | - */ | |
| 66 | -class KTCMISBase { | |
| 67 | - | |
| 68 | - // we want all child classes to share the ktapi and session instances, no matter where they are set from, | |
| 69 | - // so we declare them as static | |
| 70 | - static protected $ktapi; | |
| 71 | - static protected $session; | |
| 72 | - | |
| 73 | - public function __construct(&$ktapi = null, $username = null, $password = null) | |
| 74 | - { | |
| 75 | - // TODO confirm KTAPI instance active??? shouldn't really be responsibility of this code | |
| 76 | - if (is_null($ktapi) && (!is_null($username) && !is_null($password))) { | |
| 77 | - $this->startSession($username, $password); | |
| 78 | - } | |
| 79 | - else { | |
| 80 | - self::$ktapi = $ktapi; | |
| 81 | - self::$session = self::$ktapi->get_session(); | |
| 82 | - } | |
| 83 | - } | |
| 84 | - | |
| 85 | - // TODO this probably does not belong here??? probably should require all auth external, handled by transport protocol. | |
| 86 | - // perhaps simple refusal to execute without valid session? | |
| 87 | - // NOTE left in to allow transport protocol to delegate auth to this level, but not actually used in any code at present | |
| 88 | - public function startSession($username, $password) | |
| 89 | - { | |
| 90 | - // attempt to recover session if one exists | |
| 91 | - if (!is_null(self::$session) && !PEAR::isError(self::$session)) | |
| 92 | - { | |
| 93 | - self::$session =& self::$ktapi->get_active_session(self::$session->get_sessionid()); | |
| 94 | - } | |
| 95 | - | |
| 96 | - // start new session if no existing session or problem getting existing session (expired, etc...) | |
| 97 | - if (is_null(self::$session) || PEAR::isError(self::$session)) | |
| 98 | - { | |
| 99 | - self::$ktapi = new KTAPI(); | |
| 100 | - self::$session =& self::$ktapi->start_session($username, $password); | |
| 101 | - } | |
| 102 | - | |
| 103 | - // failed authentication? | |
| 104 | - if (PEAR::isError(self::$session)) | |
| 105 | - { | |
| 106 | - throw new PermissionDeniedException('You must be authenticated to perform this action'); | |
| 107 | - } | |
| 108 | - | |
| 109 | - return self::$session; | |
| 110 | - } | |
| 111 | - | |
| 112 | - public function setInterface(&$ktapi = null) | |
| 113 | - { | |
| 114 | - if (!is_null($ktapi)) { | |
| 115 | - self::$ktapi = $ktapi; | |
| 116 | - } | |
| 117 | - } | |
| 118 | - | |
| 119 | - public function getInterface() | |
| 120 | - { | |
| 121 | - return self::$ktapi; | |
| 122 | - } | |
| 123 | - | |
| 124 | - public function getSession() | |
| 125 | - { | |
| 126 | - return self::$session; | |
| 127 | - } | |
| 128 | - | |
| 129 | - // TODO what about destroying sessions? only on logout (which is not offered by the CMIS clients tested so far) | |
| 130 | -} | |
| 131 | - | |
| 132 | -/** | |
| 133 | - * Handles low level repository information queries | |
| 134 | - */ | |
| 135 | -class KTRepositoryService extends KTCMISBase { | |
| 136 | - | |
| 137 | - protected $RepositoryService; | |
| 138 | - | |
| 139 | - public function __construct() | |
| 140 | - { | |
| 141 | - // instantiate underlying CMIS service | |
| 142 | - $this->RepositoryService = new CMISRepositoryService(); | |
| 143 | - } | |
| 144 | - | |
| 145 | - /** | |
| 146 | - * Fetch a list of all available repositories | |
| 147 | - * | |
| 148 | - * NOTE Since we only have one repository at the moment, this is expected to only return one result | |
| 149 | - * | |
| 150 | - * @return repositoryList[] | |
| 151 | - */ | |
| 152 | - public function getRepositories() | |
| 153 | - { | |
| 154 | - $repositories = $this->RepositoryService->getRepositories(); | |
| 155 | - if (PEAR::isError($repositories)) | |
| 156 | - { | |
| 157 | - return array( | |
| 158 | - "status_code" => 1, | |
| 159 | - "message" => "Failed getting repositories" | |
| 160 | - ); | |
| 161 | - } | |
| 162 | - | |
| 163 | - // extract the required info fields into array format for easy encoding; | |
| 164 | - $count = 0; | |
| 165 | - $repositoryList = array(); | |
| 166 | - foreach ($repositories as $repository) | |
| 167 | - { | |
| 168 | - $repositoryList[$count]['repositoryId'] = $repository->getRepositoryId(); | |
| 169 | - $repositoryList[$count]['repositoryName'] = $repository->getRepositoryName(); | |
| 170 | - $repositoryList[$count]['repositoryURI'] = $repository->getRepositoryURI(); | |
| 171 | - ++$count; | |
| 172 | - } | |
| 173 | - | |
| 174 | - return array( | |
| 175 | - "status_code" => 0, | |
| 176 | - "results" => $repositoryList | |
| 177 | - ); | |
| 178 | - } | |
| 179 | - | |
| 180 | - /** | |
| 181 | - * Fetches information about the selected repository | |
| 182 | - * | |
| 183 | - * @param string $repositoryId | |
| 184 | - */ | |
| 185 | - public function getRepositoryInfo($repositoryId) | |
| 186 | - { | |
| 187 | - $repositoryInfo = $this->RepositoryService->getRepositoryInfo($repositoryId); | |
| 188 | - if (PEAR::isError($repositoryInfo)) | |
| 189 | - { | |
| 190 | - return array( | |
| 191 | - "status_code" => 1, | |
| 192 | - "message" => "Failed getting repository information" | |
| 193 | - ); | |
| 194 | - } | |
| 195 | - | |
| 196 | - // TODO output this manually, the function works but only for some objects so rather avoid it completely? | |
| 197 | - // NOTE the problems appear to be due to recursive objects | |
| 198 | - return array ( | |
| 199 | - "status_code" => 0, | |
| 200 | - "results" => CMISUtil::objectToArray($repositoryInfo) | |
| 201 | - ); | |
| 202 | - } | |
| 203 | - | |
| 204 | - /** | |
| 205 | - * Fetch the list of supported object types for the selected repository | |
| 206 | - * | |
| 207 | - * @param string $repositoryId | |
| 208 | - */ | |
| 209 | - public function getTypes($repositoryId, $typeId = '', $returnPropertyDefinitions = false, | |
| 210 | - $maxItems = 0, $skipCount = 0, &$hasMoreItems = false) | |
| 211 | - { | |
| 212 | - try { | |
| 213 | - $repositoryObjectTypeResult = $this->RepositoryService->getTypes($repositoryId, $typeId, $returnPropertyDefinitions, | |
| 214 | - $maxItems, $skipCount, $hasMoreItems); | |
| 215 | - } | |
| 216 | - catch (Exception $e) | |
| 217 | - { | |
| 218 | - return array( | |
| 219 | - "status_code" => 1, | |
| 220 | - "message" => $e->getMessage() | |
| 221 | - ); | |
| 222 | - } | |
| 223 | - | |
| 224 | - // format as array style output | |
| 225 | - // NOTE only concerned with attributes at this time | |
| 226 | - // TODO add support for properties | |
| 227 | - foreach($repositoryObjectTypeResult as $key => $objectType) | |
| 228 | - { | |
| 229 | - $repositoryObjectTypes[$key] = $objectType['attributes']; | |
| 230 | - // TODO properties | |
| 231 | - // $repositoryObjectTypes[$key]['properties'] = $objectType['properties']; | |
| 232 | - } | |
| 233 | - | |
| 234 | - return array ( | |
| 235 | - "status_code" => 0, | |
| 236 | - "results" => $repositoryObjectTypes | |
| 237 | - ); | |
| 238 | - } | |
| 239 | - | |
| 240 | - /** | |
| 241 | - * Fetch the object type definition for the requested type | |
| 242 | - * | |
| 243 | - * @param string $repositoryId | |
| 244 | - * @param string $typeId | |
| 245 | - */ | |
| 246 | - public function getTypeDefinition($repositoryId, $typeId) | |
| 247 | - { | |
| 248 | - try { | |
| 249 | - $typeDefinitionResult = $this->RepositoryService->getTypeDefinition($repositoryId, $typeId); | |
| 250 | - } | |
| 251 | - catch (Exception $e) | |
| 252 | - { | |
| 253 | - return array( | |
| 254 | - "status_code" => 1, | |
| 255 | - "message" => $e->getMessage() | |
| 256 | - ); | |
| 257 | - } | |
| 258 | - | |
| 259 | - // format as array style output | |
| 260 | - // NOTE only concerned with attributes at this time | |
| 261 | - // TODO add support for properties | |
| 262 | - $typeDefinition = $typeDefinitionResult['attributes']; | |
| 263 | - | |
| 264 | - return array ( | |
| 265 | - "status_code" => 0, | |
| 266 | - "results" => $typeDefinition | |
| 267 | - ); | |
| 268 | - } | |
| 269 | - | |
| 270 | -} | |
| 271 | - | |
| 272 | -/* | |
| 273 | - * Handles repository navigation | |
| 274 | - */ | |
| 275 | -class KTNavigationService extends KTCMISBase { | |
| 276 | - | |
| 277 | - protected $NavigationService; | |
| 278 | - | |
| 279 | - public function __construct(&$ktapi = null, $username = null, $password = null) | |
| 280 | - { | |
| 281 | - parent::__construct($ktapi, $username, $password); | |
| 282 | - // instantiate underlying CMIS service | |
| 283 | - $this->NavigationService = new CMISNavigationService(); | |
| 284 | - $this->setInterface(); | |
| 285 | - } | |
| 286 | - | |
| 287 | - public function startSession($username, $password) | |
| 288 | - { | |
| 289 | - parent::startSession($username, $password); | |
| 290 | - $this->setInterface(); | |
| 291 | - return self::$session; | |
| 292 | - } | |
| 293 | - | |
| 294 | - public function setInterface(&$ktapi = null) | |
| 295 | - { | |
| 296 | - parent::setInterface($ktapi); | |
| 297 | - $this->NavigationService->setInterface(self::$ktapi); | |
| 298 | - } | |
| 299 | - | |
| 300 | - /** | |
| 301 | - * Get descendents of the specified folder, up to the depth indicated | |
| 302 | - * | |
| 303 | - * @param string $repositoryId | |
| 304 | - * @param string $folderId | |
| 305 | - * @param boolean $includeAllowableActions | |
| 306 | - * @param boolean $includeRelationships | |
| 307 | - * @param string $typeID | |
| 308 | - * @param int $depth | |
| 309 | - * @param string $filter | |
| 310 | - * @return array $descendants | |
| 311 | - */ | |
| 312 | - public function getDescendants($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, | |
| 313 | - $depth = 1, $typeID = 'Any', $filter = '') | |
| 314 | - { | |
| 315 | - // TODO optional parameters | |
| 316 | - $descendantsResult = $this->NavigationService->getDescendants($repositoryId, $folderId, $includeAllowableActions, | |
| 317 | - $includeRelationships, $depth); | |
| 318 | - | |
| 319 | - if (PEAR::isError($descendantsResult)) | |
| 320 | - { | |
| 321 | - return array( | |
| 322 | - "status_code" => 1, | |
| 323 | - "message" => "Failed getting descendants for folder" | |
| 324 | - ); | |
| 325 | - } | |
| 326 | - | |
| 327 | - // format for webservices consumption | |
| 328 | - // NOTE this will almost definitely be changing in the future, this is just to get something working | |
| 329 | - $descendants = CMISUtil::decodeObjectHierarchy($descendantsResult, 'child'); | |
| 330 | - | |
| 331 | - return array ( | |
| 332 | - "status_code" => 0, | |
| 333 | - "results" => $descendants | |
| 334 | - ); | |
| 335 | - } | |
| 336 | - | |
| 337 | - /** | |
| 338 | - * Get direct children of the specified folder | |
| 339 | - * | |
| 340 | - * @param string $repositoryId | |
| 341 | - * @param string $folderId | |
| 342 | - * @param boolean $includeAllowableActions | |
| 343 | - * @param boolean $includeRelationships | |
| 344 | - * @param string $typeID | |
| 345 | - * @param string $filter | |
| 346 | - * @param int $maxItems | |
| 347 | - * @param int $skipCount | |
| 348 | - * @return array $descendants | |
| 349 | - */ | |
| 350 | - public function getChildren($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, | |
| 351 | - $typeID = 'Any', $filter = '', $maxItems = 0, $skipCount = 0) | |
| 352 | - { | |
| 353 | - // TODO paging | |
| 354 | - // TODO optional parameters | |
| 355 | - $childrenResult = $this->NavigationService->getChildren($repositoryId, $folderId, $includeAllowableActions, $includeRelationships); | |
| 356 | - | |
| 357 | - if (PEAR::isError($childrenResult)) | |
| 358 | - { | |
| 359 | - return array( | |
| 360 | - "status_code" => 1, | |
| 361 | - "message" => "Failed getting descendants for folder" | |
| 362 | - ); | |
| 363 | - } | |
| 364 | - | |
| 365 | - $children = CMISUtil::decodeObjectHierarchy($childrenResult, 'child'); | |
| 366 | - | |
| 367 | - return array( | |
| 368 | - "status_code" => 0, | |
| 369 | - "results" => $children | |
| 370 | - ); | |
| 371 | - } | |
| 372 | - | |
| 373 | - /** | |
| 374 | - * Gets the parent of the selected folder | |
| 375 | - * | |
| 376 | - * @param string $repositoryId | |
| 377 | - * @param string $folderId | |
| 378 | - * @param boolean $includeAllowableActions | |
| 379 | - * @param boolean $includeRelationships | |
| 380 | - * @param boolean $returnToRoot | |
| 381 | - * @param string $filter | |
| 382 | - * @return ancestry[] | |
| 383 | - */ | |
| 384 | - public function getFolderParent($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, $returnToRoot, $filter = '') | |
| 385 | - { | |
| 386 | - $ancestryResult = $this->NavigationService->getFolderParent($repositoryId, $folderId, $includeAllowableActions, | |
| 387 | - $includeRelationships, $returnToRoot); | |
| 388 | - | |
| 389 | - if (PEAR::isError($ancestryResult)) | |
| 390 | - { | |
| 391 | - return array( | |
| 392 | - "status_code" => 1, | |
| 393 | - "message" => "Failed getting ancestry for folder" | |
| 394 | - ); | |
| 395 | - } | |
| 396 | - | |
| 397 | - $ancestry = CMISUtil::decodeObjectHierarchy($ancestryResult, 'child'); | |
| 398 | - | |
| 399 | - return array( | |
| 400 | - "status_code" => 0, | |
| 401 | - "results" => $ancestry | |
| 402 | - ); | |
| 403 | - } | |
| 404 | - | |
| 405 | - /** | |
| 406 | - * Gets the parents for the selected object | |
| 407 | - * | |
| 408 | - * @param string $repositoryId | |
| 409 | - * @param string $folderId | |
| 410 | - * @param boolean $includeAllowableActions | |
| 411 | - * @param boolean $includeRelationships | |
| 412 | - * @param string $filter | |
| 413 | - * @return ancestry[] | |
| 414 | - */ | |
| 415 | - function getObjectParents($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, $filter = '') | |
| 416 | - { | |
| 417 | - $ancestryResult = $this->NavigationService->getObjectParents($repositoryId, $objectId, $includeAllowableActions, | |
| 418 | - $includeRelationships); | |
| 419 | - | |
| 420 | - if (PEAR::isError($ancestryResult)) | |
| 421 | - { | |
| 422 | - return array( | |
| 423 | - "status_code" => 1, | |
| 424 | - "message" => "Failed getting ancestry for object" | |
| 425 | - ); | |
| 426 | - } | |
| 427 | - | |
| 428 | - $ancestry = CMISUtil::decodeObjectHierarchy($ancestryResult, 'child'); | |
| 429 | - | |
| 430 | - return array( | |
| 431 | - "status_code" => 0, | |
| 432 | - "results" => $ancestry | |
| 433 | - ); | |
| 434 | - } | |
| 435 | - | |
| 436 | - /** | |
| 437 | - * Returns a list of checked out documents from the selected repository | |
| 438 | - * | |
| 439 | - * @param string $repositoryId | |
| 440 | - * @param string $folderId The folder for which checked out docs are requested | |
| 441 | - * @param string $filter | |
| 442 | - * @param boolean $includeAllowableActions | |
| 443 | - * @param boolean $includeRelationships | |
| 444 | - * @param int $maxItems | |
| 445 | - * @param int $skipCount | |
| 446 | - * @return array $checkedout The collection of checked out documents | |
| 447 | - */ | |
| 448 | - function getCheckedOutDocs($repositoryId, $includeAllowableActions, $includeRelationships, $folderId = null, $filter = '', | |
| 449 | - $maxItems = 0, $skipCount = 0) | |
| 450 | - { | |
| 451 | - $checkedout = $this->NavigationService->getCheckedOutDocs($repositoryId, $includeAllowableActions, $includeRelationships, | |
| 452 | - $folderId, $filter, $maxItems, $skipCount); | |
| 453 | - | |
| 454 | - if (PEAR::isError($checkedout)) | |
| 455 | - { | |
| 456 | - return array( | |
| 457 | - "status_code" => 1, | |
| 458 | - "message" => "Failed getting list of checked out documents" | |
| 459 | - ); | |
| 460 | - } | |
| 461 | - | |
| 462 | - // convert to array format for external code | |
| 463 | - $co = array(); | |
| 464 | - foreach ($checkedout as $documentProperties) | |
| 465 | - { | |
| 466 | - $co[] = CMISUtil::createObjectPropertiesEntry($documentProperties);; | |
| 467 | - } | |
| 468 | - | |
| 469 | - return array( | |
| 470 | - "status_code" => 0, | |
| 471 | - "results" => $co | |
| 472 | - ); | |
| 473 | - } | |
| 474 | - | |
| 475 | -} | |
| 476 | - | |
| 477 | -/** | |
| 478 | - * Handles requests for and actions on Folders and Documents | |
| 479 | - */ | |
| 480 | -class KTObjectService extends KTCMISBase { | |
| 481 | - | |
| 482 | - protected $ObjectService; | |
| 483 | - | |
| 484 | - public function __construct(&$ktapi = null, $username = null, $password = null) | |
| 485 | - { | |
| 486 | - parent::__construct($ktapi, $username, $password); | |
| 487 | - // instantiate underlying CMIS service | |
| 488 | - $this->ObjectService = new CMISObjectService(); | |
| 489 | - $this->setInterface(); | |
| 490 | - } | |
| 491 | - | |
| 492 | - public function startSession($username, $password) | |
| 493 | - { | |
| 494 | - parent::startSession($username, $password); | |
| 495 | - $this->setInterface(); | |
| 496 | - return self::$session; | |
| 497 | - } | |
| 498 | - | |
| 499 | - public function setInterface(&$ktapi = null) | |
| 500 | - { | |
| 501 | - parent::setInterface($ktapi); | |
| 502 | - $this->ObjectService->setInterface(self::$ktapi); | |
| 503 | - } | |
| 504 | - | |
| 505 | - /** | |
| 506 | - * Gets the properties for the selected object | |
| 507 | - * | |
| 508 | - * @param string $repositoryId | |
| 509 | - * @param string $objectId | |
| 510 | - * @param boolean $includeAllowableActions | |
| 511 | - * @param boolean $includeRelationships | |
| 512 | - * @param string $returnVersion | |
| 513 | - * @param string $filter | |
| 514 | - * @return properties[] | |
| 515 | - */ | |
| 516 | - public function getProperties($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, | |
| 517 | - $returnVersion = false, $filter = '') | |
| 518 | - { | |
| 519 | - try { | |
| 520 | - $propertyCollection = $this->ObjectService->getProperties($repositoryId, $objectId, $includeAllowableActions, | |
| 521 | - $includeRelationships); | |
| 522 | - } | |
| 523 | - catch (Exception $e) | |
| 524 | - { | |
| 525 | - return array( | |
| 526 | - "status_code" => 1, | |
| 527 | - "message" => $e->getMessage() | |
| 528 | - ); | |
| 529 | - } | |
| 530 | - | |
| 531 | - $properties = CMISUtil::createObjectPropertiesEntry($propertyCollection); | |
| 532 | - | |
| 533 | - return array( | |
| 534 | - "status_code" => 0, | |
| 535 | - "results" => $properties | |
| 536 | - ); | |
| 537 | - } | |
| 538 | - | |
| 539 | - /** | |
| 540 | - * Creates a new document within the repository | |
| 541 | - * | |
| 542 | - * @param string $repositoryId The repository to which the document must be added | |
| 543 | - * @param string $typeId Object Type id for the document object being created | |
| 544 | - * @param array $properties Array of properties which must be applied to the created document object | |
| 545 | - * @param string $folderId The id of the folder which will be the parent of the created document object | |
| 546 | - * This parameter is optional IF unfilingCapability is supported | |
| 547 | - * @param contentStream $contentStream optional content stream data | |
| 548 | - * @param string $versioningState optional version state value: checkedout/major/minor | |
| 549 | - * @return string $objectId The id of the created folder object | |
| 550 | - */ | |
| 551 | - public function createDocument($repositoryId, $typeId, $properties, $folderId = null, | |
| 552 | - $contentStream = null, $versioningState = null) | |
| 553 | - { | |
| 554 | - $objectId = null; | |
| 555 | - | |
| 556 | - try { | |
| 557 | - $objectId = $this->ObjectService->createDocument($repositoryId, $typeId, $properties, $folderId, | |
| 558 | - $contentStream, $versioningState); | |
| 559 | - } | |
| 560 | - catch (Exception $e) | |
| 561 | - { | |
| 562 | - return array( | |
| 563 | - "status_code" => 1, | |
| 564 | - "message" => $e->getMessage() | |
| 565 | - ); | |
| 566 | - } | |
| 567 | - | |
| 568 | - return array( | |
| 569 | - 'status_code' => 0, | |
| 570 | - 'results' => $objectId | |
| 571 | - ); | |
| 572 | - } | |
| 573 | - | |
| 574 | - /** | |
| 575 | - * Creates a new folder within the repository | |
| 576 | - * | |
| 577 | - * @param string $repositoryId The repository to which the folder must be added | |
| 578 | - * @param string $typeId Object Type id for the folder object being created | |
| 579 | - * @param array $properties Array of properties which must be applied to the created folder object | |
| 580 | - * @param string $folderId The id of the folder which will be the parent of the created folder object | |
| 581 | - * @return string $objectId The id of the created folder object | |
| 582 | - */ | |
| 583 | - public function createFolder($repositoryId, $typeId, $properties, $folderId) | |
| 584 | - { | |
| 585 | - $objectId = null; | |
| 586 | - | |
| 587 | - try { | |
| 588 | - $objectId = $this->ObjectService->createFolder($repositoryId, $typeId, $properties, $folderId); | |
| 589 | - } | |
| 590 | - catch (Exception $e) | |
| 591 | - { | |
| 592 | - return array( | |
| 593 | - "status_code" => 1, | |
| 594 | - "message" => $e->getMessage() | |
| 595 | - ); | |
| 596 | - } | |
| 597 | - | |
| 598 | - return array( | |
| 599 | - 'status_code' => 0, | |
| 600 | - 'results' => $objectId | |
| 601 | - ); | |
| 602 | - } | |
| 603 | - | |
| 604 | - /** | |
| 605 | - * Fetches the content stream data for an object | |
| 606 | - * | |
| 607 | - * @param string $repositoryId | |
| 608 | - * @param string $objectId | |
| 609 | - * @return string $contentStream (binary or text data) | |
| 610 | - */ | |
| 611 | - function getContentStream($repositoryId, $objectId) | |
| 612 | - { | |
| 613 | - try { | |
| 614 | - $contentStream = $this->ObjectService->getContentStream($repositoryId, $objectId); | |
| 615 | - } | |
| 616 | - catch (Exception $e) | |
| 617 | - { | |
| 618 | - return array( | |
| 619 | - "status_code" => 1, | |
| 620 | - "message" => $e->getMessage() | |
| 621 | - ); | |
| 622 | - } | |
| 623 | - | |
| 624 | - return array( | |
| 625 | - 'status_code' => 0, | |
| 626 | - 'results' => $contentStream | |
| 627 | - ); | |
| 628 | - } | |
| 629 | - | |
| 630 | - /** | |
| 631 | - * Moves a fileable object from one folder to another. | |
| 632 | - * | |
| 633 | - * @param object $repositoryId | |
| 634 | - * @param object $objectId | |
| 635 | - * @param object $changeToken [optional] | |
| 636 | - * @param object $targetFolderId | |
| 637 | - * @param object $sourceFolderId [optional] | |
| 638 | - */ | |
| 639 | - public function moveObject($repositoryId, $objectId, $changeToken = '', $targetFolderId, $sourceFolderId = null) | |
| 640 | - { | |
| 641 | - try { | |
| 642 | - $this->ObjectService->moveObject($repositoryId, $objectId, $changeToken, $targetFolderId, $sourceFolderId); | |
| 643 | - } | |
| 644 | - catch (Exception $e) | |
| 645 | - { | |
| 646 | - return array( | |
| 647 | - "status_code" => 1, | |
| 648 | - "message" => $e->getMessage() | |
| 649 | - ); | |
| 650 | - } | |
| 651 | - | |
| 652 | - return array( | |
| 653 | - 'status_code' => 0, | |
| 654 | - 'results' => $objectId | |
| 655 | - ); | |
| 656 | - } | |
| 657 | - | |
| 658 | - /** | |
| 659 | - * Deletes an object from the repository | |
| 660 | - * | |
| 661 | - * @param string $repositoryId | |
| 662 | - * @param string $objectId | |
| 663 | - * @param string $changeToken [optional] | |
| 664 | - * @return array | |
| 665 | - */ | |
| 666 | - // NOTE Invoking this service method on an object SHALL not delete the entire version series for a Document Object. | |
| 667 | - // To delete an entire version series, use the deleteAllVersions() service | |
| 668 | - public function deleteObject($repositoryId, $objectId, $changeToken = null) | |
| 669 | - { | |
| 670 | - try { | |
| 671 | - $this->ObjectService->deleteObject($repositoryId, $objectId, $changeToken); | |
| 672 | - } | |
| 673 | - catch (Exception $e) | |
| 674 | - { | |
| 675 | - return array( | |
| 676 | - "status_code" => 1, | |
| 677 | - "message" => $e->getMessage() | |
| 678 | - ); | |
| 679 | - } | |
| 680 | - | |
| 681 | - return array( | |
| 682 | - 'status_code' => 0, | |
| 683 | - 'results' => $objectId | |
| 684 | - ); | |
| 685 | - } | |
| 686 | - | |
| 687 | - public function deleteTree($repositoryId, $objectId, $changeToken = null, $unfileNonfolderObject = 'delete', $continueOnFailure = false) | |
| 688 | - { | |
| 689 | - try { | |
| 690 | - $result = $this->ObjectService->deleteTree($repositoryId, $objectId, $changeToken, $unfileNonfolderObject, $continueOnFailure); | |
| 691 | - } | |
| 692 | - catch (Exception $e) | |
| 693 | - { | |
| 694 | - return array( | |
| 695 | - "status_code" => 1, | |
| 696 | - "message" => $e->getMessage() | |
| 697 | - ); | |
| 698 | - } | |
| 699 | - | |
| 700 | - // check whether there is a list of items which did not delete | |
| 701 | - if (count($result) > 0) | |
| 702 | - { | |
| 703 | - return array( | |
| 704 | - "status_code" => 1, | |
| 705 | - "message" => $result | |
| 706 | - ); | |
| 707 | - } | |
| 708 | - | |
| 709 | - return array( | |
| 710 | - 'status_code' => 0, | |
| 711 | - 'results' => $objectId | |
| 712 | - ); | |
| 713 | - } | |
| 714 | - | |
| 715 | - /** | |
| 716 | - * Sets the content stream data for an existing document | |
| 717 | - * | |
| 718 | - * if $overwriteFlag = TRUE, the new content stream is applied whether or not the document has an existing content stream | |
| 719 | - * if $overwriteFlag = FALSE, the new content stream is applied only if the document does not have an existing content stream | |
| 720 | - * | |
| 721 | - * NOTE A Repository MAY automatically create new Document versions as part of this service method. | |
| 722 | - * Therefore, the documentId output NEED NOT be identical to the documentId input. | |
| 723 | - * | |
| 724 | - * @param string $repositoryId | |
| 725 | - * @param string $documentId | |
| 726 | - * @param boolean $overwriteFlag | |
| 727 | - * @param string $contentStream | |
| 728 | - * @param string $changeToken | |
| 729 | - * @return string $documentId | |
| 730 | - */ | |
| 731 | - function setContentStream($repositoryId, $documentId, $overwriteFlag, $contentStream, $changeToken = null) | |
| 732 | - { | |
| 733 | - try { | |
| 734 | - $documentId = $this->ObjectService->setContentStream($repositoryId, $documentId, $overwriteFlag, $contentStream, $changeToken); | |
| 735 | - } | |
| 736 | - catch (Exception $e) | |
| 737 | - { | |
| 738 | - return array( | |
| 739 | - "status_code" => 1, | |
| 740 | - "message" => $e->getMessage() | |
| 741 | - ); | |
| 742 | - } | |
| 743 | - | |
| 744 | - return array( | |
| 745 | - 'status_code' => 0, | |
| 746 | - 'results' => $documentId | |
| 747 | - ); | |
| 748 | - } | |
| 749 | - | |
| 750 | -} | |
| 751 | - | |
| 752 | -/** | |
| 753 | - * Handles requests for and actions on versionable objects | |
| 754 | - */ | |
| 755 | -class KTVersioningService extends KTCMISBase { | |
| 756 | - | |
| 757 | - protected $VersioningService; | |
| 758 | - | |
| 759 | - public function __construct(&$ktapi = null, $username = null, $password = null) | |
| 760 | - { | |
| 761 | - parent::__construct($ktapi, $username, $password); | |
| 762 | - // instantiate underlying CMIS service | |
| 763 | - $this->VersioningService = new CMISVersioningService(); | |
| 764 | - $this->setInterface(); | |
| 765 | - } | |
| 766 | - | |
| 767 | - public function startSession($username, $password) | |
| 768 | - { | |
| 769 | - parent::startSession($username, $password); | |
| 770 | - $this->setInterface(); | |
| 771 | - return self::$session; | |
| 772 | - } | |
| 773 | - | |
| 774 | - public function setInterface(&$ktapi = null) | |
| 775 | - { | |
| 776 | - parent::setInterface($ktapi); | |
| 777 | - $this->VersioningService->setInterface(self::$ktapi); | |
| 778 | - } | |
| 779 | - | |
| 780 | - /** | |
| 781 | - * Deletes all Document Objects in the specified Version Series, including the Private Working Copy | |
| 782 | - * | |
| 783 | - * @param string $repositoryId | |
| 784 | - * @param string $versionSeriesId | |
| 785 | - * @return boolean true if successful | |
| 786 | - */ | |
| 787 | - public function deleteAllVersions($repositoryId, $versionSeriesId) | |
| 788 | - { | |
| 789 | - try { | |
| 790 | - $result = $this->VersioningService->deleteAllVersions($repositoryId, $versionSeriesId); | |
| 791 | - } | |
| 792 | - catch (Exception $e) | |
| 793 | - { | |
| 794 | - return array( | |
| 795 | - "status_code" => 1, | |
| 796 | - "message" => $e->getMessage() | |
| 797 | - ); | |
| 798 | - } | |
| 799 | - | |
| 800 | - return array( | |
| 801 | - 'status_code' => 0, | |
| 802 | - 'results' => $result | |
| 803 | - ); | |
| 804 | - } | |
| 805 | - | |
| 806 | - /** | |
| 807 | - * Checks out a document and creates the PWC (Private Working Copy) which will represent the checked out document | |
| 808 | - * | |
| 809 | - * @param string $repositoryId | |
| 810 | - * @param string $documentId | |
| 811 | - * @param string $changeToken [optional] | |
| 812 | - * @return array results | |
| 813 | - */ | |
| 814 | - // TODO set up delivery of content stream? or is that up to the CMIS client? | |
| 815 | - public function checkOut($repositoryId, $documentId, $changeToken = '') | |
| 816 | - { | |
| 817 | - try { | |
| 818 | - $result = $this->VersioningService->checkOut($repositoryId, $documentId, $changeToken); | |
| 819 | - } | |
| 820 | - catch (Exception $e) | |
| 821 | - { | |
| 822 | - return array( | |
| 823 | - "status_code" => 1, | |
| 824 | - "message" => $e->getMessage() | |
| 825 | - ); | |
| 826 | - } | |
| 827 | - | |
| 828 | - return array( | |
| 829 | - 'status_code' => 0, | |
| 830 | - 'results' => (!empty($result) ? $result : 'Document Checked Out') | |
| 831 | - ); | |
| 832 | - } | |
| 833 | - | |
| 834 | - /** | |
| 835 | - * 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" | |
| 836 | - * | |
| 837 | - * @param string $repositoryId | |
| 838 | - * @param string $documentId | |
| 839 | - * @param string $changeToken [optional] | |
| 840 | - */ | |
| 841 | - // TODO exceptions: | |
| 842 | - // • ConstraintViolationException: The Repository SHALL throw this exception if ANY of the following conditions are met: | |
| 843 | - // o The Document’s Object-Type definition’s versionable attribute is FALSE. | |
| 844 | - // • updateConflictException | |
| 845 | - // • versioningException | |
| 846 | - public function cancelCheckOut($repositoryId, $documentId, $changeToken = '') | |
| 847 | - { | |
| 848 | - try { | |
| 849 | - $result = $this->VersioningService->cancelCheckOut($repositoryId, $documentId, $changeToken); | |
| 850 | - } | |
| 851 | - catch (Exception $e) | |
| 852 | - { | |
| 853 | - return array( | |
| 854 | - "status_code" => 1, | |
| 855 | - "message" => $e->getMessage() | |
| 856 | - ); | |
| 857 | - } | |
| 858 | - | |
| 859 | - return array( | |
| 860 | - 'status_code' => 0, | |
| 861 | - 'results' => (!empty($result) ? $result : 'Document Checkout Cancelled') | |
| 862 | - ); | |
| 863 | - } | |
| 864 | - | |
| 865 | - /** | |
| 866 | - * Checks in a checked out document | |
| 867 | - * | |
| 868 | - * @param string $repositoryId | |
| 869 | - * @param string $documentId | |
| 870 | - * @param boolean $major | |
| 871 | - * @param string $changeToken [optional] | |
| 872 | - * @param array $properties [optional] | |
| 873 | - * @param contentStream $contentStream [optional] | |
| 874 | - * @param string $checkinComment [optional] | |
| 875 | - * @return string $documentId | |
| 876 | - */ | |
| 877 | - public function checkIn($repositoryId, $documentId, $major, $changeToken = '', $properties = array(), $contentStream = null, $checkinComment = '') | |
| 878 | - { | |
| 879 | - try { | |
| 880 | - $result = $this->VersioningService->checkIn($repositoryId, $documentId, $major, $changeToken, $properties, $contentStream, $checkinComment); | |
| 881 | - } | |
| 882 | - catch (Exception $e) | |
| 883 | - { | |
| 884 | - return array( | |
| 885 | - "status_code" => 1, | |
| 886 | - "message" => $e->getMessage() | |
| 887 | - ); | |
| 888 | - } | |
| 889 | - | |
| 890 | - return array( | |
| 891 | - 'status_code' => 0, | |
| 892 | - 'results' => (!empty($result) ? $result : 'Document Checked In Successfully') | |
| 893 | - ); | |
| 894 | - } | |
| 895 | - | |
| 896 | -} | |
| 897 | - | |
| 898 | -?> |
lib/api/ktcmis/services/CMISObjectService.inc.php
| ... | ... | @@ -61,7 +61,7 @@ class CMISObjectService { |
| 61 | 61 | // NOTE The latter method has been adopted for the moment |
| 62 | 62 | catch (Exception $e) |
| 63 | 63 | { |
| 64 | - throw new ConstraintViolationException('Object is not of base type document. ' . $e->getMessage()); | |
| 64 | + throw new ConstraintViolationException('Object base type could not be determined. ' . $e->getMessage()); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | if ($typeDefinition['attributes']['baseType'] != 'document') |
| ... | ... | @@ -103,49 +103,41 @@ class CMISObjectService { |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if (!$typeAllowed) | |
| 107 | - { | |
| 106 | + if (!$typeAllowed) { | |
| 108 | 107 | throw new ConstraintViolationException('Parent folder may not hold objects of this type (' . $typeId . ')'); |
| 109 | 108 | } |
| 110 | 109 | |
| 111 | 110 | // if content stream is required and no content stream is supplied, throw a ConstraintViolationException |
| 112 | - if (($typeDefinition['attributes']['contentStreamAllowed'] == 'required') && is_null($contentStream)) | |
| 113 | - { | |
| 111 | + if (($typeDefinition['attributes']['contentStreamAllowed'] == 'required') && is_null($contentStream)) { | |
| 114 | 112 | throw new ConstraintViolationException('This repository requires a content stream for document creation. ' |
| 115 | 113 | . 'Refusing to create an empty document'); |
| 116 | 114 | } |
| 117 | - else if (($typeDefinition['attributes']['contentStreamAllowed'] == 'notAllowed') && !empty($contentStream)) | |
| 118 | - { | |
| 115 | + else if (($typeDefinition['attributes']['contentStreamAllowed'] == 'notAllowed') && !empty($contentStream)) { | |
| 119 | 116 | throw new StreamNotSupportedException('Content Streams are not supported'); |
| 120 | 117 | } |
| 121 | 118 | |
| 122 | 119 | // if versionable attribute is set to false and versioningState is supplied, throw a ConstraintViolationException |
| 123 | - if (!$typeDefinition['attributes']['versionable'] && !empty($versioningState)) | |
| 124 | - { | |
| 120 | + if (!$typeDefinition['attributes']['versionable'] && !empty($versioningState)) { | |
| 125 | 121 | throw new ConstraintViolationException('This repository does not support versioning'); |
| 126 | 122 | } |
| 127 | 123 | |
| 128 | 124 | // TODO deal with $versioningState when supplied |
| 129 | 125 | |
| 130 | 126 | // set title and name identical if only one submitted |
| 131 | - if ($properties['title'] == '') | |
| 132 | - { | |
| 127 | + if ($properties['title'] == '') { | |
| 133 | 128 | $properties['title'] = $properties['name']; |
| 134 | 129 | } |
| 135 | - else if ($properties['name'] == '') | |
| 136 | - { | |
| 130 | + else if ($properties['name'] == '') { | |
| 137 | 131 | $properties['name'] = $properties['title']; |
| 138 | 132 | } |
| 139 | 133 | |
| 140 | 134 | // if name is blank throw exception (check type) - using invalidArgument Exception for now |
| 141 | - if (trim($properties['name']) == '') | |
| 142 | - { | |
| 135 | + if (trim($properties['name']) == '') { | |
| 143 | 136 | throw new InvalidArgumentException('Refusing to create an un-named document'); |
| 144 | 137 | } |
| 145 | 138 | |
| 146 | 139 | // TODO also set to Default if a non-supported type is submitted |
| 147 | - if ($properties['type'] == '') | |
| 148 | - { | |
| 140 | + if ($properties['type'] == '') { | |
| 149 | 141 | $properties['type'] = 'Default'; |
| 150 | 142 | } |
| 151 | 143 | |
| ... | ... | @@ -154,17 +146,7 @@ class CMISObjectService { |
| 154 | 146 | // this check isn't strictly necessary; however it is needed for a repository which does not support content streams |
| 155 | 147 | if (!is_null($contentStream)) |
| 156 | 148 | { |
| 157 | - // TODO consider checking whether content is encoded (currently we expect encoded) | |
| 158 | - // TODO choose between this and the alternative decode function (see CMISUtil class) | |
| 159 | - // this will require some basic benchmarking | |
| 160 | - $contentStream = CMISUtil::decodeChunkedContentStream($contentStream); | |
| 161 | - | |
| 162 | - // NOTE There is a function in CMISUtil to do this, written for the unit tests but since KTUploadManager exists | |
| 163 | - // and has more functionality which could come in useful at some point I decided to go with that instead | |
| 164 | - // (did not know this existed when I wrote the CMISUtil function) | |
| 165 | - $uploadManager = new KTUploadManager(); | |
| 166 | - // assumes already decoded from base64, should use store_base64_file if not | |
| 167 | - $tempfilename = $uploadManager->store_file($contentStream, 'cmis_'); | |
| 149 | + $tempfilename = CMISUtil::createTemporaryFile($contentStream); | |
| 168 | 150 | |
| 169 | 151 | // metadata |
| 170 | 152 | $metadata = array(); |
| ... | ... | @@ -192,12 +174,10 @@ class CMISObjectService { |
| 192 | 174 | ); |
| 193 | 175 | } |
| 194 | 176 | |
| 195 | - if (!empty($properties['category'])) | |
| 196 | - { | |
| 177 | + if (!empty($properties['category'])) { | |
| 197 | 178 | $category = $properties['category']; |
| 198 | 179 | } |
| 199 | - else | |
| 200 | - { | |
| 180 | + else { | |
| 201 | 181 | $category = 'Miscellaneous'; |
| 202 | 182 | } |
| 203 | 183 | |
| ... | ... | @@ -231,12 +211,10 @@ class CMISObjectService { |
| 231 | 211 | $KTMime = new KTMime(); |
| 232 | 212 | $mimetype = $KTMime->getMimeTypeFromFile($tempfilename); |
| 233 | 213 | preg_match('/^([^\/]*)\/([^\/]*)/', $mimetype, $matches); |
| 234 | - if (($matches[1] == 'text') || ($matches[1] == 'image') || ($matches[1] == 'audio')) | |
| 235 | - { | |
| 214 | + if (($matches[1] == 'text') || ($matches[1] == 'image') || ($matches[1] == 'audio')) { | |
| 236 | 215 | $mediatype = ucwords($matches[1]); |
| 237 | 216 | } |
| 238 | - else if (($matches[2] == 'pdf') || ($matches[2] == 'msword')) | |
| 239 | - { | |
| 217 | + else if (($matches[2] == 'pdf') || ($matches[2] == 'msword')) { | |
| 240 | 218 | $mediatype = 'Text'; |
| 241 | 219 | } |
| 242 | 220 | |
| ... | ... | @@ -262,12 +240,10 @@ class CMISObjectService { |
| 262 | 240 | $response = $this->ktapi->add_document_with_metadata((int)$folderId, $properties['title'], $properties['name'], |
| 263 | 241 | $properties['type'], $tempfilename, $metadata, $sysdata); |
| 264 | 242 | |
| 265 | - if ($response['status_code'] != 0) | |
| 266 | - { | |
| 243 | + if ($response['status_code'] != 0) { | |
| 267 | 244 | throw new StorageException('The repository was unable to create the document. ' . $response['message']); |
| 268 | 245 | } |
| 269 | - else | |
| 270 | - { | |
| 246 | + else { | |
| 271 | 247 | $objectId = CMISUtil::encodeObjectId('Document', $response['results']['document_id']); |
| 272 | 248 | } |
| 273 | 249 | |
| ... | ... | @@ -314,13 +290,11 @@ class CMISObjectService { |
| 314 | 290 | // exception propogate upward... |
| 315 | 291 | // Alternatively: throw new exception with original exception message appended |
| 316 | 292 | // NOTE The latter method has been adopted for the moment |
| 317 | - catch (Exception $e) | |
| 318 | - { | |
| 293 | + catch (Exception $e) { | |
| 319 | 294 | throw new ConstraintViolationException('Object is not of base type folder. ' . $e->getMessage()); |
| 320 | 295 | } |
| 321 | 296 | |
| 322 | - if ($typeDefinition['attributes']['baseType'] != 'folder') | |
| 323 | - { | |
| 297 | + if ($typeDefinition['attributes']['baseType'] != 'folder') { | |
| 324 | 298 | throw new ConstraintViolationException('Object is not of base type folder'); |
| 325 | 299 | } |
| 326 | 300 | |
| ... | ... | @@ -333,20 +307,17 @@ class CMISObjectService { |
| 333 | 307 | // if parent folder is not allowed to hold this type, throw exception |
| 334 | 308 | $CMISFolder = new CMISFolderObject($folderId, $this->ktapi); |
| 335 | 309 | $allowed = $CMISFolder->getProperty('AllowedChildObjectTypeIds'); |
| 336 | - if (!is_array($allowed) || !in_array($typeId, $allowed)) | |
| 337 | - { | |
| 310 | + if (!is_array($allowed) || !in_array($typeId, $allowed)) { | |
| 338 | 311 | throw new ConstraintViolationException('Parent folder may not hold objects of this type (' . $typeId . ')'); |
| 339 | 312 | } |
| 340 | 313 | |
| 341 | 314 | // TODO if name is blank! throw another exception (check type) - using invalidArgument Exception for now |
| 342 | - if (trim($properties['name']) == '') | |
| 343 | - { | |
| 315 | + if (trim($properties['name']) == '') { | |
| 344 | 316 | throw new InvalidArgumentException('Refusing to create an un-named folder'); |
| 345 | 317 | } |
| 346 | 318 | |
| 347 | 319 | $response = $this->ktapi->create_folder((int)$folderId, $properties['name'], $sig_username = '', $sig_password = '', $reason = ''); |
| 348 | - if ($response['status_code'] != 0) | |
| 349 | - { | |
| 320 | + if ($response['status_code'] != 0) { | |
| 350 | 321 | throw new StorageException('The repository was unable to create the folder: ' . $response['message']); |
| 351 | 322 | } |
| 352 | 323 | else |
| ... | ... | @@ -380,8 +351,7 @@ class CMISObjectService { |
| 380 | 351 | |
| 381 | 352 | $objectId = CMISUtil::decodeObjectId($objectId, $typeId); |
| 382 | 353 | |
| 383 | - if ($typeId == 'Unknown') | |
| 384 | - { | |
| 354 | + if ($typeId == 'Unknown') { | |
| 385 | 355 | throw new ObjectNotFoundException('The type of the requested object could not be determined'); |
| 386 | 356 | } |
| 387 | 357 | |
| ... | ... | @@ -492,8 +462,7 @@ class CMISObjectService { |
| 492 | 462 | // check type id of object against allowed child types for destination folder |
| 493 | 463 | $CMISFolder = new CMISFolderObject($targetFolderId, $this->ktapi); |
| 494 | 464 | $allowed = $CMISFolder->getProperty('AllowedChildObjectTypeIds'); |
| 495 | - if (!is_array($allowed) || !in_array($typeId, $allowed)) | |
| 496 | - { | |
| 465 | + if (!is_array($allowed) || !in_array($typeId, $allowed)) { | |
| 497 | 466 | throw new ConstraintViolationException('Parent folder may not hold objects of this type (' . $typeId . ')'); |
| 498 | 467 | } |
| 499 | 468 | |
| ... | ... | @@ -517,8 +486,7 @@ class CMISObjectService { |
| 517 | 486 | } |
| 518 | 487 | |
| 519 | 488 | // if failed, throw StorageException |
| 520 | - if ($response['status_code'] != 0) | |
| 521 | - { | |
| 489 | + if ($response['status_code'] != 0) { | |
| 522 | 490 | throw new StorageException('The repository was unable to move the object: ' . $response['message']); |
| 523 | 491 | } |
| 524 | 492 | } |
| ... | ... | @@ -541,13 +509,15 @@ class CMISObjectService { |
| 541 | 509 | // TODO this should probably be a function, it is now used in two places... |
| 542 | 510 | // throw updateConflictException if the operation is attempting to update an object that is no longer current (as determined by the repository). |
| 543 | 511 | $exists = true; |
| 544 | - if ($typeId == 'Folder') { | |
| 512 | + if ($typeId == 'Folder') | |
| 513 | + { | |
| 545 | 514 | $object = $this->ktapi->get_folder_by_id($objectId); |
| 546 | 515 | if (PEAR::isError($object)) { |
| 547 | 516 | $exists = false; |
| 548 | 517 | } |
| 549 | 518 | } |
| 550 | - else if ($typeId == 'Document') { | |
| 519 | + else if ($typeId == 'Document') | |
| 520 | + { | |
| 551 | 521 | $object = $this->ktapi->get_document_by_id($objectId); |
| 552 | 522 | if (PEAR::isError($object)) { |
| 553 | 523 | $exists = false; |
| ... | ... | @@ -743,11 +713,7 @@ class CMISObjectService { |
| 743 | 713 | throw new ContentAlreadyExistsException('Unable to overwrite existing content stream'); |
| 744 | 714 | } |
| 745 | 715 | |
| 746 | - // NOTE There is a function in CMISUtil to do this but since KTUploadManager exists and has more functionality | |
| 747 | - // which could come in useful at some point I decided to go with that instead (did not know it existed when | |
| 748 | - // I wrote the CMISUtil function) | |
| 749 | - $uploadManager = new KTUploadManager(); | |
| 750 | - $tempfilename = $uploadManager->store_base64_file($contentStream, 'cmis_'); | |
| 716 | + $tempfilename = CMISUtil::createTemporaryFile($contentStream); | |
| 751 | 717 | // update the document content from this temporary file as per usual |
| 752 | 718 | // TODO Use checkin_document_with_metadata instead if metadata content submitted || update metadata separately? |
| 753 | 719 | $response = $this->ktapi->checkin_document($documentId, $csFileName, 'CMIS setContentStream action', $tempfilename, false); | ... | ... |
lib/api/ktcmis/services/CMISVersioningService.inc.php
| ... | ... | @@ -3,11 +3,12 @@ |
| 3 | 3 | require_once(KT_DIR . '/ktapi/ktapi.inc.php'); |
| 4 | 4 | require_once(CMIS_DIR . '/exceptions/ConstraintViolationException.inc.php'); |
| 5 | 5 | require_once(CMIS_DIR . '/exceptions/StorageException.inc.php'); |
| 6 | +require_once(CMIS_DIR . '/exceptions/StreamNotSupportedException.inc.php'); | |
| 6 | 7 | require_once(CMIS_DIR . '/exceptions/UpdateConflictException.inc.php'); |
| 7 | 8 | require_once(CMIS_DIR . '/exceptions/VersioningException.inc.php'); |
| 8 | 9 | require_once(CMIS_DIR . '/services/CMISObjectService.inc.php'); |
| 9 | 10 | require_once(CMIS_DIR . '/objecttypes/CMISDocumentObject.inc.php'); |
| 10 | -//require_once(CMIS_DIR . '/util/CMISUtil.inc.php'); | |
| 11 | +require_once(CMIS_DIR . '/util/CMISUtil.inc.php'); | |
| 11 | 12 | |
| 12 | 13 | class CMISVersioningService { |
| 13 | 14 | |
| ... | ... | @@ -182,14 +183,8 @@ class CMISVersioningService { |
| 182 | 183 | * @return string $documentId |
| 183 | 184 | */ |
| 184 | 185 | // TODO Exceptions: |
| 185 | - // • ConstraintViolationException - SHALL throw if o The Document’s Object-Type definition’s versionable attribute is FALSE. | |
| 186 | - // • storageException - MAY throw | |
| 187 | - // • streamNotSupportedException - The Repository SHALL throw this exception if the Object-Type definition specified by the typeId | |
| 188 | - // parameter’s “contentStreamAllowed” attribute is set to “not allowed” and a contentStream input | |
| 189 | - // parameter is provided. | |
| 190 | - // • updateConflictException - MAY throw | |
| 191 | 186 | // • versioningException - The repository MAY throw this exception if the object is a non-current Document Version |
| 192 | - public function checkIn($repositoryId, $documentId, $major, $changeToken = '', $properties = array(), $contentStream = null, $checkinComment = '') | |
| 187 | + public function checkIn($repositoryId, $documentId, $major, $contentStream = null, $changeToken = '', $properties = array(), $checkinComment = '') | |
| 193 | 188 | { |
| 194 | 189 | $documentId = CMISUtil::decodeObjectId($documentId, $typeId); |
| 195 | 190 | |
| ... | ... | @@ -206,7 +201,35 @@ class CMISVersioningService { |
| 206 | 201 | throw new ConstraintViolationException('This document is not versionable and may not be checked in'); |
| 207 | 202 | } |
| 208 | 203 | |
| 209 | - return $documentId; | |
| 204 | + $RepositoryService = new CMISRepositoryService(); | |
| 205 | + try { | |
| 206 | + $typeDefinition = $RepositoryService->getTypeDefinition($repositoryId, $typeId); | |
| 207 | + } | |
| 208 | + catch (exception $e) { | |
| 209 | + // if we can't get the type definition, then we can't store the content | |
| 210 | + throw new StorageException($e->getMessage()); | |
| 211 | + } | |
| 212 | + | |
| 213 | + if (($typeDefinition['attributes']['contentStreamAllowed'] == 'notAllowed') && !empty($contentStream)) { | |
| 214 | + throw new StreamNotSupportedException('Content Streams are not supported'); | |
| 215 | + } | |
| 216 | + | |
| 217 | + // check that this is the latest version | |
| 218 | + if ($pwc->getProperty('IsLatestVersion') != true) { | |
| 219 | + throw new VersioningException('The document is not the latest version and cannot be checked in'); | |
| 220 | + } | |
| 221 | + | |
| 222 | + // now do the checkin | |
| 223 | + $tempfilename = CMISUtil::createTemporaryFile($contentStream); | |
| 224 | + $response = $this->ktapi->checkin_document($documentId, $pwc->getProperty('ContentStreamFilename'), $reason, $tempfilename, $major, | |
| 225 | + $sig_username, $sig_password); | |
| 226 | + | |
| 227 | + // if there was any error in cancelling the checkout | |
| 228 | + if ($response['status_code'] == 1) { | |
| 229 | + throw new RuntimeException('There was an error checking in the document: ' . $response['message']); | |
| 230 | + } | |
| 231 | + | |
| 232 | + return CMISUtil::encodeObjectId(DOCUMENT, $documentId); | |
| 210 | 233 | } |
| 211 | 234 | |
| 212 | 235 | } | ... | ... |
lib/api/ktcmis/util/CMISUtil.inc.php
| ... | ... | @@ -406,30 +406,6 @@ class CMISUtil { |
| 406 | 406 | return (($input === true) ? 'true' : (($input === false) ? 'false' : $input)); |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | - /** | |
| 410 | - * Creates a temporary file | |
| 411 | - * Cleanup is the responsibility of the calling code | |
| 412 | - * | |
| 413 | - * @param string|binary $content The content to be written to the file. | |
| 414 | - * @param string $uploadDir Optional upload directory. Will use the KnowledgeTree system tmp directory if not supplied. | |
| 415 | - * @return string The path to the created file (for reference and cleanup.) | |
| 416 | - */ | |
| 417 | - static public function createTemporaryFile($content, $encoding = null, $uploadDir = null) | |
| 418 | - { | |
| 419 | - if(is_null($uploadDir)) | |
| 420 | - { | |
| 421 | - $oKTConfig =& KTConfig::getSingleton(); | |
| 422 | - $uploadDir = $oKTConfig->get('webservice/uploadDirectory'); | |
| 423 | - } | |
| 424 | - | |
| 425 | - $temp = tempnam($uploadDir, 'myfile'); | |
| 426 | - $fp = fopen($temp, 'wb'); | |
| 427 | - fwrite($fp, ($encoding == 'base64' ? base64_decode($content) : $content)); | |
| 428 | - fclose($fp); | |
| 429 | - | |
| 430 | - return $temp; | |
| 431 | - } | |
| 432 | - | |
| 433 | 409 | // TODO more robust base64 encoding detection, if possible |
| 434 | 410 | |
| 435 | 411 | /** |
| ... | ... | @@ -610,6 +586,33 @@ class CMISUtil { |
| 610 | 586 | |
| 611 | 587 | return $exists; |
| 612 | 588 | } |
| 589 | + | |
| 590 | + /** | |
| 591 | + * Creates a temporary file | |
| 592 | + * Cleanup is the responsibility of the calling code | |
| 593 | + * | |
| 594 | + * @param string $contentStream The content to be stored (assumed to be base64) | |
| 595 | + * @return string The path to the created file (for reference and cleanup.) | |
| 596 | + */ | |
| 597 | + static public function createTemporaryFile($contentStream) | |
| 598 | + { | |
| 599 | + // if contentStream is empty, cannot create file | |
| 600 | + if (empty($contentStream)) return null; | |
| 601 | + | |
| 602 | + // TODO consider checking whether content is encoded (currently we expect encoded) | |
| 603 | + // TODO choose between this and the alternative decode function (see CMISUtil class) | |
| 604 | + // this will require some basic benchmarking | |
| 605 | + $contentStream = CMISUtil::decodeChunkedContentStream($contentStream); | |
| 606 | + | |
| 607 | + // NOTE There is a function in CMISUtil to do this, written for the unit tests but since KTUploadManager exists | |
| 608 | + // and has more functionality which could come in useful at some point I decided to go with that instead | |
| 609 | + // (did not know this existed when I wrote the CMISUtil function) | |
| 610 | + $uploadManager = new KTUploadManager(); | |
| 611 | + // assumes already decoded from base64, should use store_base64_file if not | |
| 612 | + $tempfilename = $uploadManager->store_file($contentStream, 'cmis_'); | |
| 613 | + | |
| 614 | + return $tempfilename; | |
| 615 | + } | |
| 613 | 616 | |
| 614 | 617 | } |
| 615 | 618 | ... | ... |
plugins/thumbnails/templates/thumbnail_viewlet.smarty
0 → 100644
plugins/thumbnails/thumbnails.php
0 → 100644
| 1 | +<?php | |
| 2 | +/* | |
| 3 | + * $Id: $ | |
| 4 | + * | |
| 5 | + * The contents of this file are subject to the KnowledgeTree | |
| 6 | + * Commercial Editions On-Premise License ("License"); | |
| 7 | + * You may not use this file except in compliance with the License. | |
| 8 | + * You may obtain a copy of the License at | |
| 9 | + * http://www.knowledgetree.com/about/legal/ | |
| 10 | + * The terms of this license may change from time to time and the latest | |
| 11 | + * license will be published from time to time at the above Internet address. | |
| 12 | + * | |
| 13 | + * This edition of the KnowledgeTree software | |
| 14 | + * is NOT licensed to you under Open Source terms. | |
| 15 | + * You may not redistribute this source code. | |
| 16 | + * For more information please see the License above. | |
| 17 | + * | |
| 18 | + * (c) 2008 KnowledgeTree Inc. | |
| 19 | + * Portions copyright The Jam Warehouse Software (Pty) Ltd; | |
| 20 | + * All Rights Reserved. | |
| 21 | + * | |
| 22 | + */ | |
| 23 | + | |
| 24 | +require_once(KT_LIB_DIR . "/actions/documentviewlet.inc.php"); | |
| 25 | +require_once(KT_DIR . '/search2/documentProcessor/documentProcessor.inc.php'); | |
| 26 | + | |
| 27 | +/** | |
| 28 | + * Generates thumbnails of documents using the pdf converter output | |
| 29 | + * Dependent on the pdfConverter | |
| 30 | + */ | |
| 31 | +class thumbnailGenerator extends BaseProcessor | |
| 32 | +{ | |
| 33 | + public $order = 3; | |
| 34 | + protected $namespace = 'thumbnails.generator.processor'; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * Constructor | |
| 38 | + * | |
| 39 | + * @return thumbnailGenerator | |
| 40 | + */ | |
| 41 | + public function thumbnailGenerator() | |
| 42 | + { | |
| 43 | + } | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * Gets the document path and calls the generator function | |
| 47 | + * | |
| 48 | + * @return boolean | |
| 49 | + */ | |
| 50 | + public function processDocument() | |
| 51 | + { | |
| 52 | + // do the generation | |
| 53 | + $res = $this->generateThumbnail(); | |
| 54 | + return $res; | |
| 55 | + } | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * The supported mime types for the converter. | |
| 59 | + * | |
| 60 | + * @return array | |
| 61 | + */ | |
| 62 | + public function getSupportedMimeTypes() | |
| 63 | + { | |
| 64 | +// $aAcceptedMimeTypes = array('doc', 'ods', 'odt', 'ott', 'txt', 'rtf', 'sxw', 'stw', | |
| 65 | +// // 'html', 'htm', | |
| 66 | +// 'xml' , 'pdb', 'psw', 'ods', 'ots', 'sxc', | |
| 67 | +// 'stc', 'dif', 'dbf', 'xls', 'xlt', 'slk', 'csv', 'pxl', | |
| 68 | +// 'odp', 'otp', 'sxi', 'sti', 'ppt', 'pot', 'sxd', 'odg', | |
| 69 | +// 'otg', 'std', 'asc'); | |
| 70 | + | |
| 71 | + // taken from the original list of accepted types in the pdf generator action | |
| 72 | + $mime_types = array(); | |
| 73 | + $mime_types[] = 'text/plain'; | |
| 74 | + $mime_types[] = 'text/html'; | |
| 75 | + $mime_types[] = 'text/csv'; | |
| 76 | + $mime_types[] = 'text/rtf'; | |
| 77 | + | |
| 78 | + // Office OLE2 - 2003, XP, etc | |
| 79 | + $mime_types[] = 'application/msword'; | |
| 80 | + $mime_types[] = 'application/vnd.ms-powerpoint'; | |
| 81 | + $mime_types[] = 'application/vnd.ms-excel'; | |
| 82 | + | |
| 83 | + // Star Office | |
| 84 | + $mime_types[] = 'application/vnd.sun.xml.writer'; | |
| 85 | + $mime_types[] = 'application/vnd.sun.xml.writer.template'; | |
| 86 | + $mime_types[] = 'application/vnd.sun.xml.calc'; | |
| 87 | + $mime_types[] = 'application/vnd.sun.xml.calc.template'; | |
| 88 | + $mime_types[] = 'application/vnd.sun.xml.draw'; | |
| 89 | + $mime_types[] = 'application/vnd.sun.xml.draw.template'; | |
| 90 | + $mime_types[] = 'application/vnd.sun.xml.impress'; | |
| 91 | + $mime_types[] = 'application/vnd.sun.xml.impress.template'; | |
| 92 | + | |
| 93 | + // Open Office | |
| 94 | + $mime_types[] = 'application/vnd.oasis.opendocument.text'; | |
| 95 | + $mime_types[] = 'application/vnd.oasis.opendocument.text-template'; | |
| 96 | + $mime_types[] = 'application/vnd.oasis.opendocument.graphics'; | |
| 97 | + $mime_types[] = 'application/vnd.oasis.opendocument.graphics-template'; | |
| 98 | + $mime_types[] = 'application/vnd.oasis.opendocument.presentation'; | |
| 99 | + $mime_types[] = 'application/vnd.oasis.opendocument.presentation-template'; | |
| 100 | + $mime_types[] = 'application/vnd.oasis.opendocument.spreadsheet'; | |
| 101 | + $mime_types[] = 'application/vnd.oasis.opendocument.spreadsheet-template'; | |
| 102 | + | |
| 103 | + /* OO3 | |
| 104 | + // Office 2007 | |
| 105 | + $mime_types[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; | |
| 106 | + $mime_types[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; | |
| 107 | + $mime_types[] = 'application/vnd.openxmlformats-officedocument.presentationml.template'; | |
| 108 | + $mime_types[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; | |
| 109 | + $mime_types[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; | |
| 110 | + $mime_types[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; | |
| 111 | + $mime_types[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; | |
| 112 | + */ | |
| 113 | + | |
| 114 | + return $mime_types; | |
| 115 | + } | |
| 116 | + | |
| 117 | + /** | |
| 118 | + * Generates the thumbnail from the pdf | |
| 119 | + * | |
| 120 | + * @return boolean | |
| 121 | + */ | |
| 122 | + private function generateThumbnail() | |
| 123 | + { | |
| 124 | + /* | |
| 125 | + The thumbnail is displayed in the info panel and the document view | |
| 126 | + The info panel is in the plugin ktcore/documentpreview/ | |
| 127 | + - add a hook in there but build the functionality in this plugin ie keep the plugins separate and don't create dependencies | |
| 128 | + - if the thumbnail plugin is disabled then maybe display a normal sized info panel | |
| 129 | + | |
| 130 | + The document view will display the thumbnail on the right in a document viewlet similar to the workflow viewlet | |
| 131 | + - check out ktcore/KTDocumentViewlets.php | |
| 132 | + - viewlet class is below | |
| 133 | + */ | |
| 134 | + | |
| 135 | + $pdfDir = $default->pdfDirectory; | |
| 136 | + $pdfFile = $pdfDir .'/'. $this->document->iId.'.pdf'; | |
| 137 | + | |
| 138 | + // if a previous version of the pdf exists - delete it | |
| 139 | + if(!file_exists($pdfFile)){ | |
| 140 | + global $default; | |
| 141 | + $default->log->debug('Thumbnail Generator Plugin: PDF file does not exist, cannot generate a thumbnail'); | |
| 142 | + return false; | |
| 143 | + } | |
| 144 | + | |
| 145 | + // do generation | |
| 146 | + return true; | |
| 147 | + } | |
| 148 | +} | |
| 149 | + | |
| 150 | + | |
| 151 | +class ThumbnailViewlet extends KTDocumentViewlet { | |
| 152 | + var $sName = 'thumbnail.viewlets'; | |
| 153 | + | |
| 154 | + function display_viewlet() { | |
| 155 | + $oKTTemplating =& KTTemplating::getSingleton(); | |
| 156 | + $oTemplate =& $oKTTemplating->loadTemplate('thumbnail_viewlet'); | |
| 157 | + if (is_null($oTemplate)) return ''; | |
| 158 | + | |
| 159 | + $oTemplate->setData(array()); | |
| 160 | + return $oTemplate->render(); | |
| 161 | + } | |
| 162 | +} | |
| 163 | + | |
| 164 | +?> | |
| 0 | 165 | \ No newline at end of file | ... | ... |
plugins/thumbnails/thumbnailsPlugin.php
0 → 100644
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * $Id: $ | |
| 4 | + * | |
| 5 | + * The contents of this file are subject to the KnowledgeTree | |
| 6 | + * Commercial Editions On-Premise License ("License"); | |
| 7 | + * You may not use this file except in compliance with the License. | |
| 8 | + * You may obtain a copy of the License at | |
| 9 | + * http://www.knowledgetree.com/about/legal/ | |
| 10 | + * The terms of this license may change from time to time and the latest | |
| 11 | + * license will be published from time to time at the above Internet address. | |
| 12 | + * | |
| 13 | + * This edition of the KnowledgeTree software | |
| 14 | + * is NOT licensed to you under Open Source terms. | |
| 15 | + * You may not redistribute this source code. | |
| 16 | + * For more information please see the License above. | |
| 17 | + * | |
| 18 | + * (c) 2008 KnowledgeTree Inc. | |
| 19 | + * Portions copyright The Jam Warehouse Software (Pty) Ltd; | |
| 20 | + * All Rights Reserved. | |
| 21 | + * | |
| 22 | + */ | |
| 23 | + | |
| 24 | +require_once(KT_LIB_DIR . '/plugins/plugin.inc.php'); | |
| 25 | +require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php'); | |
| 26 | + | |
| 27 | +class thumbnailsPlugin extends KTPlugin { | |
| 28 | + var $sNamespace = 'thumbnails.generator.processor.plugin'; | |
| 29 | + var $iVersion = 0; | |
| 30 | + var $autoRegister = true; | |
| 31 | + | |
| 32 | + function thumbnailsPlugin($sFilename = null) { | |
| 33 | + $res = parent::KTPlugin($sFilename); | |
| 34 | + $this->sFriendlyName = _kt('Thumbnail Generator'); | |
| 35 | + return $res; | |
| 36 | + } | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * Setup the plugin: add the processor, viewlet action and template location | |
| 40 | + * | |
| 41 | + */ | |
| 42 | + function setup() { | |
| 43 | + $plugin_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR; | |
| 44 | + $dir = $plugin_dir . 'thumbnails.php'; | |
| 45 | + $this->registerProcessor('thumbnailGenerator', 'thumbnails.generator.processor', $dir); | |
| 46 | + $this->registerAction('documentviewlet', 'ThumbnailViewlet', 'thumbnail.viewlets', $dir); | |
| 47 | + | |
| 48 | + require_once(KT_LIB_DIR . '/templating/templating.inc.php'); | |
| 49 | + $oTemplating =& KTTemplating::getSingleton(); | |
| 50 | + $oTemplating->addLocation('thumbnails', $plugin_dir.'templates', 'thumbnails.generator.processor.plugin'); | |
| 51 | + } | |
| 52 | +} | |
| 53 | + | |
| 54 | +$oPluginRegistry =& KTPluginRegistry::getSingleton(); | |
| 55 | +$oPluginRegistry->registerPlugin('thumbnailsPlugin', 'thumbnails.generator.processor.plugin', __FILE__); | |
| 56 | +?> | |
| 0 | 57 | \ No newline at end of file | ... | ... |
setup/wizard/config/config.xml
setup/wizard/installUtil.php
| ... | ... | @@ -254,8 +254,8 @@ class InstallUtil { |
| 254 | 254 | */ |
| 255 | 255 | public function checkPermission($dir, $create=false) |
| 256 | 256 | { |
| 257 | - $exist = 'Directory does not exist'; | |
| 258 | - $write = 'Directory is not writable'; | |
| 257 | + $exist = 'Directory doesn\'t exist'; | |
| 258 | + $write = 'Directory not writable'; | |
| 259 | 259 | $ret = array('class' => 'cross'); |
| 260 | 260 | |
| 261 | 261 | if(!file_exists($dir)){ | ... | ... |
setup/wizard/installer.php
| ... | ... | @@ -105,6 +105,15 @@ class Installer { |
| 105 | 105 | protected $installOrders = array(); |
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | + * List of installation properties | |
| 109 | + * | |
| 110 | + * @author KnowledgeTree Team | |
| 111 | + * @access protected | |
| 112 | + * @var array string | |
| 113 | + */ | |
| 114 | + protected $installProperties = array(); | |
| 115 | + | |
| 116 | + /** | |
| 108 | 117 | * Flag if a step object needs confirmation |
| 109 | 118 | * |
| 110 | 119 | * @author KnowledgeTree Team |
| ... | ... | @@ -281,11 +290,7 @@ class Installer { |
| 281 | 290 | */ |
| 282 | 291 | private function _runStepAction($stepName) { |
| 283 | 292 | $this->stepAction = new stepAction($stepName); |
| 284 | - $this->stepAction->setSteps($this->getSteps()); | |
| 285 | - $this->stepAction->setStepNames($this->getStepNames()); | |
| 286 | - $this->stepAction->setDisplayConfirm($this->stepConfirmation); | |
| 287 | - $this->stepAction->setDisplayFirst($this->stepDisplayFirst()); | |
| 288 | - $this->stepAction->loadSession($this->session); | |
| 293 | + $this->stepAction->setUpStepAction($this->getSteps(), $this->getStepNames(), $this->getStepConfirmation(), $this->stepDisplayFirst(), $this->getSession(), $this->getInstallProperties()); | |
| 289 | 294 | |
| 290 | 295 | return $this->stepAction->doAction(); |
| 291 | 296 | } |
| ... | ... | @@ -367,6 +372,22 @@ class Installer { |
| 367 | 372 | } |
| 368 | 373 | |
| 369 | 374 | /** |
| 375 | + * Set install properties | |
| 376 | + * | |
| 377 | + * @author KnowledgeTree Team | |
| 378 | + * @param none | |
| 379 | + * @access private | |
| 380 | + * @return void | |
| 381 | + */ | |
| 382 | + private function _xmlInstallProperties() { | |
| 383 | + if(isset($this->simpleXmlObj)) { | |
| 384 | + $this->installProperties['install_version'] = (string) $this->simpleXmlObj['version']; | |
| 385 | + $this->installProperties['install_type'] = (string) $this->simpleXmlObj['type']; | |
| 386 | + $this->_loadToSession('installProperties', $this->installProperties); | |
| 387 | + } | |
| 388 | + } | |
| 389 | + | |
| 390 | + /** | |
| 370 | 391 | * Install steps |
| 371 | 392 | * |
| 372 | 393 | * @author KnowledgeTree Team |
| ... | ... | @@ -456,7 +477,11 @@ class Installer { |
| 456 | 477 | $this->installOrders = $this->session->get('installOrders'); |
| 457 | 478 | if(!$this->installOrders) { |
| 458 | 479 | $this->_xmlStepsOrders(); |
| 459 | - } | |
| 480 | + } | |
| 481 | + $this->installProperties = $this->session->get('installProperties'); | |
| 482 | + if(!$this->installProperties) { | |
| 483 | + $this->_xmlInstallProperties(); | |
| 484 | + } | |
| 460 | 485 | } |
| 461 | 486 | |
| 462 | 487 | private function loadNeeded() { |
| ... | ... | @@ -576,6 +601,42 @@ class Installer { |
| 576 | 601 | } |
| 577 | 602 | |
| 578 | 603 | /** |
| 604 | + * Returns whether or not a confirmation step is needed | |
| 605 | + * | |
| 606 | + * @author KnowledgeTree Team | |
| 607 | + * @param none | |
| 608 | + * @access public | |
| 609 | + * @return boolean | |
| 610 | + */ | |
| 611 | + public function getStepConfirmation() { | |
| 612 | + return $this->stepConfirmation; | |
| 613 | + } | |
| 614 | + | |
| 615 | + /** | |
| 616 | + * Return install properties | |
| 617 | + * | |
| 618 | + * @author KnowledgeTree Team | |
| 619 | + * @param string | |
| 620 | + * @access public | |
| 621 | + * @return string | |
| 622 | + */ | |
| 623 | + public function getInstallProperties() { | |
| 624 | + return $this->installProperties; | |
| 625 | + } | |
| 626 | + | |
| 627 | + /** | |
| 628 | + * Returns session | |
| 629 | + * | |
| 630 | + * @author KnowledgeTree Team | |
| 631 | + * @param none | |
| 632 | + * @access public | |
| 633 | + * @return boolean | |
| 634 | + */ | |
| 635 | + public function getSession() { | |
| 636 | + return $this->session; | |
| 637 | + } | |
| 638 | + | |
| 639 | + /** | |
| 579 | 640 | * Dump of SESSION |
| 580 | 641 | * |
| 581 | 642 | * @author KnowledgeTree Team | ... | ... |
setup/wizard/lib/services/unixOpenOffice.php
| ... | ... | @@ -42,10 +42,70 @@ |
| 42 | 42 | |
| 43 | 43 | class unixOpenOffice extends unixService { |
| 44 | 44 | |
| 45 | + // utility | |
| 46 | + public $util; | |
| 47 | + // path to office | |
| 48 | + private $path; | |
| 49 | + // host | |
| 50 | + private $host; | |
| 51 | + // pid running | |
| 52 | + private $pidFile; | |
| 53 | + // port to bind to | |
| 54 | + private $port; | |
| 55 | + // bin folder | |
| 56 | + private $bin; | |
| 57 | + // office executable | |
| 58 | + private $soffice; | |
| 59 | + // office log file | |
| 60 | + private $log; | |
| 61 | + | |
| 62 | + # 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 & | |
| 45 | 63 | public function __construct() { |
| 46 | 64 | $this->name = "KTOpenOfficeTest"; |
| 65 | + $this->util = new InstallUtil(); | |
| 47 | 66 | } |
| 48 | 67 | |
| 49 | - | |
| 68 | + public function load() { | |
| 69 | + $this->setPort("8100"); | |
| 70 | + $this->setHost("localhost"); | |
| 71 | + | |
| 72 | + } | |
| 73 | + | |
| 74 | + private function setPort($port = "8100") { | |
| 75 | + $this->port = $port; | |
| 76 | + } | |
| 77 | + | |
| 78 | + private function setHost($host = "localhost") { | |
| 79 | + $this->host = $host; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public function install() { | |
| 83 | + $status = $this->status(); | |
| 84 | + if($status == '') { | |
| 85 | + return $this->start(); | |
| 86 | + } else { | |
| 87 | + return $status; | |
| 88 | + } | |
| 89 | + } | |
| 90 | + | |
| 91 | + public function start() { | |
| 92 | + return false; | |
| 93 | + $state = $this->status(); | |
| 94 | + if($state != 'STARTED') { | |
| 95 | + $cmd = ""; | |
| 96 | + $cmd .= ""; | |
| 97 | + $response = $this->util->pexec($cmd); | |
| 98 | + | |
| 99 | + return $response; | |
| 100 | + } elseif ($state == '') { | |
| 101 | + // Start Service | |
| 102 | + return true; | |
| 103 | + } else { | |
| 104 | + // Service Running Already | |
| 105 | + return true; | |
| 106 | + } | |
| 107 | + | |
| 108 | + return false; | |
| 109 | + } | |
| 50 | 110 | } |
| 51 | 111 | ?> |
| 52 | 112 | \ No newline at end of file | ... | ... |
setup/wizard/resources/graphics/dame/installer-header_logo.png
0 → 100644
2.85 KB
setup/wizard/resources/graphics/dame/installer_head.png
setup/wizard/resources/graphics/dropbox.png
setup/wizard/resources/graphics/dropbox_old.png
0 → 100644
13.6 KB
setup/wizard/resources/graphics/question.gif
0 → 100644
1.03 KB
setup/wizard/resources/wizard.css
| ... | ... | @@ -66,7 +66,7 @@ select { |
| 66 | 66 | border:1px solid #B7B7B7; |
| 67 | 67 | left:215px; |
| 68 | 68 | position:relative; |
| 69 | - top:25px; | |
| 69 | + top:20px; | |
| 70 | 70 | width:1024px; |
| 71 | 71 | } |
| 72 | 72 | |
| ... | ... | @@ -92,9 +92,8 @@ select { |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | #content { |
| 95 | - margin-left: 200px; | |
| 95 | + margin-left: 220px; | |
| 96 | 96 | height:515px; |
| 97 | - | |
| 98 | 97 | } |
| 99 | 98 | |
| 100 | 99 | #content_container { |
| ... | ... | @@ -110,13 +109,65 @@ select { |
| 110 | 109 | height: 400px; |
| 111 | 110 | } |
| 112 | 111 | |
| 112 | +#step_content_dependencies { | |
| 113 | + border: 1px solid rgb(207, 207, 207); | |
| 114 | + padding: 5px; | |
| 115 | + min-height:265px; | |
| 116 | +} | |
| 117 | + | |
| 118 | +#step_content_configuration { | |
| 119 | + border: 1px solid rgb(207, 207, 207); | |
| 120 | + padding: 5px; | |
| 121 | + min-height:290px; | |
| 122 | +} | |
| 123 | + | |
| 124 | +#step_content_registration { | |
| 125 | + border: 1px solid rgb(207, 207, 207); | |
| 126 | + padding: 5px; | |
| 127 | + height:295px; | |
| 128 | +} | |
| 129 | + | |
| 130 | +#step_content_registration_confirm { | |
| 131 | + border: 1px solid rgb(207, 207, 207); | |
| 132 | + padding: 5px; | |
| 133 | + height:400px; | |
| 134 | +} | |
| 135 | + | |
| 136 | +#step_content_install { | |
| 137 | + border: 1px solid rgb(207, 207, 207); | |
| 138 | + padding: 5px; | |
| 139 | + height:290px; | |
| 140 | +} | |
| 141 | + | |
| 142 | +#step_content_database { | |
| 143 | + border: 1px solid rgb(207, 207, 207); | |
| 144 | + padding: 5px; | |
| 145 | + min-height:355px; | |
| 146 | +} | |
| 147 | + | |
| 148 | +#step_content_database_confirm { | |
| 149 | + border: 1px solid rgb(207, 207, 207); | |
| 150 | + padding: 5px; | |
| 151 | + height:375px; | |
| 152 | +} | |
| 153 | + | |
| 154 | +#step_content_complete { | |
| 155 | + border: 1px solid rgb(207, 207, 207); | |
| 156 | + padding: 5px; | |
| 157 | + min-height:355px; | |
| 158 | +} | |
| 159 | + | |
| 160 | +.radio { | |
| 161 | + float:none; | |
| 162 | +} | |
| 163 | + | |
| 113 | 164 | #sidebar { |
| 114 | 165 | background: rgb(239, 239, 239) none repeat scroll 0% 0%; |
| 115 | - font-size: 75%; | |
| 166 | + font-size: 90%; | |
| 116 | 167 | color: grey; |
| 117 | 168 | font-family: sans-serif; |
| 118 | 169 | margin-top: 0px; |
| 119 | - width: 200px; | |
| 170 | + width: 235px; | |
| 120 | 171 | float: left; |
| 121 | 172 | padding-top: 20px; |
| 122 | 173 | padding-bottom: 20px; |
| ... | ... | @@ -143,6 +194,18 @@ select { |
| 143 | 194 | margin-left: 10px; |
| 144 | 195 | } |
| 145 | 196 | |
| 197 | +#logo { | |
| 198 | + position:relative; | |
| 199 | + right:760px; | |
| 200 | + top:20px; | |
| 201 | +} | |
| 202 | + | |
| 203 | +#install_details { | |
| 204 | + bottom:30px; | |
| 205 | + position:relative; | |
| 206 | + right:10px; | |
| 207 | +} | |
| 208 | + | |
| 146 | 209 | .menu { |
| 147 | 210 | color: #616161; |
| 148 | 211 | text-align: left; |
| ... | ... | @@ -217,6 +280,16 @@ select { |
| 217 | 280 | color: red; |
| 218 | 281 | } |
| 219 | 282 | |
| 283 | +/* | |
| 284 | +td.error { | |
| 285 | + width:190px; | |
| 286 | +} | |
| 287 | +*/ | |
| 288 | + | |
| 289 | +.conf_paths { | |
| 290 | + width:755px; | |
| 291 | +} | |
| 292 | + | |
| 220 | 293 | .errors { |
| 221 | 294 | color: #9F0000; |
| 222 | 295 | } |
| ... | ... | @@ -228,31 +301,6 @@ select { |
| 228 | 301 | width:120px; |
| 229 | 302 | } |
| 230 | 303 | |
| 231 | -/* | |
| 232 | -#buttons_double input { | |
| 233 | - float: left; | |
| 234 | - margin-top: 10px; | |
| 235 | - margin-left: 5px; | |
| 236 | - font-size: 12px; | |
| 237 | - font-weight: bold; | |
| 238 | - background-image: url("graphics/dame/kt_gradient.jpg"); | |
| 239 | - background-repeat: repeat-x; | |
| 240 | - background-position-y: 0%; | |
| 241 | - border: 1px solid #cecece; | |
| 242 | -} | |
| 243 | - | |
| 244 | -#buttons_single input { | |
| 245 | - float: right; | |
| 246 | - margin-top: 10px; | |
| 247 | - margin-left: 5px; | |
| 248 | - font-size: 12px; | |
| 249 | - font-weight: bold; | |
| 250 | - background-image: url("graphics/dame/kt_gradient.jpg"); | |
| 251 | - background-repeat: repeat-x; | |
| 252 | - background-position-y: 0%; | |
| 253 | - border: 1px solid #cecece; | |
| 254 | -}*/ | |
| 255 | - | |
| 256 | 304 | .back { |
| 257 | 305 | background-image: url("graphics/dame/kt_gradient.jpg"); |
| 258 | 306 | background-repeat:repeat-x; |
| ... | ... | @@ -275,6 +323,11 @@ input { |
| 275 | 323 | margin-top:10px; |
| 276 | 324 | } |
| 277 | 325 | |
| 326 | +.textinput { | |
| 327 | + margin-top:0px; | |
| 328 | + float:left; | |
| 329 | +} | |
| 330 | + | |
| 278 | 331 | .buttons a { |
| 279 | 332 | background: #DDDDDD; |
| 280 | 333 | border: solid 1px #888; |
| ... | ... | @@ -326,12 +379,16 @@ input { |
| 326 | 379 | height:45px; |
| 327 | 380 | } |
| 328 | 381 | |
| 382 | +#dbconf { | |
| 383 | + width:755px; | |
| 384 | +} | |
| 385 | + | |
| 329 | 386 | table#dbconf tr td { |
| 330 | 387 | width:50%; |
| 331 | 388 | } |
| 332 | 389 | |
| 333 | -input#dname { | |
| 334 | - size:40px; | |
| 390 | +table#dbconf tr td input{ | |
| 391 | + | |
| 335 | 392 | } |
| 336 | 393 | |
| 337 | 394 | .options { |
| ... | ... | @@ -343,48 +400,92 @@ input#dname { |
| 343 | 400 | } |
| 344 | 401 | |
| 345 | 402 | #section { |
| 346 | - /*border:1px solid;*/ | |
| 403 | + | |
| 347 | 404 | } |
| 348 | 405 | |
| 349 | -sup { | |
| 350 | - font-size: 11px; | |
| 406 | +.php_ext_details table { | |
| 407 | + width:745px; | |
| 351 | 408 | } |
| 352 | 409 | |
| 353 | -refresh { | |
| 354 | - /* | |
| 355 | - style="color: #000000; | |
| 356 | - font-weight: normal; | |
| 357 | - */ | |
| 410 | +.php_ext_details table tr { | |
| 411 | + | |
| 358 | 412 | } |
| 359 | 413 | |
| 360 | -.php_ext_details table { | |
| 361 | - width:800px; | |
| 414 | +td.ext_indicator { | |
| 415 | + width:10px; | |
| 416 | +} | |
| 417 | + | |
| 418 | +td.ext_name { | |
| 419 | + width:110p; | |
| 420 | +} | |
| 421 | + | |
| 422 | +td.ext_description { | |
| 423 | + width:360px; | |
| 424 | +} | |
| 425 | + | |
| 426 | +td.ext_error { | |
| 427 | + width:350px; | |
| 428 | +} | |
| 429 | + | |
| 430 | +td.ext_refresh { | |
| 431 | + width:10px; | |
| 432 | +} | |
| 433 | + | |
| 434 | +td.dir_name { | |
| 435 | + width:200px; | |
| 436 | +} | |
| 437 | + | |
| 438 | +td.dir_description { | |
| 439 | + width:200px; | |
| 362 | 440 | } |
| 363 | 441 | |
| 364 | 442 | .php_con_details table { |
| 365 | - width:800px; | |
| 443 | + width:745px; | |
| 444 | + /*border:1px solid;*/ | |
| 366 | 445 | } |
| 367 | 446 | |
| 368 | 447 | .error_message { |
| 369 | 448 | border:none; |
| 370 | - background-color:#FFCCCC; | |
| 371 | 449 | color:#A30000; |
| 372 | -/* width:550px; */ | |
| 373 | 450 | padding:0px; |
| 451 | + color:red; | |
| 452 | + font-size:90%; | |
| 453 | + margin-bottom:0.75em; | |
| 454 | + font-weight:bold; | |
| 374 | 455 | } |
| 375 | 456 | |
| 376 | 457 | .continue_message { |
| 458 | + background: url("graphics/big-ok.png") no-repeat; | |
| 377 | 459 | border:none; |
| 378 | - background:transparent url("graphics/big-ok.png") no-repeat scroll 0 50%; | |
| 379 | 460 | width:550px; |
| 380 | 461 | padding:0px; |
| 462 | + color:#898989; | |
| 463 | + font-size:90%; | |
| 464 | + margin-bottom:0.75em; | |
| 381 | 465 | } |
| 382 | 466 | |
| 383 | 467 | .license_agreement { |
| 384 | 468 | overflow: scroll; |
| 385 | 469 | height: 255px; |
| 386 | - width:785px; | |
| 470 | + width:765px; | |
| 387 | 471 | height:370px; |
| 388 | 472 | overflow-x:hidden; |
| 389 | 473 | border:1px solid #CFCFCF; |
| 474 | +} | |
| 475 | + | |
| 476 | +.db_adv_options { | |
| 477 | + height:200px; | |
| 478 | + width:720px; | |
| 479 | +} | |
| 480 | + | |
| 481 | +.adv_option { | |
| 482 | + height:65px; | |
| 483 | + width:720px; | |
| 484 | +} | |
| 485 | + | |
| 486 | +#tooltips { | |
| 487 | + background: url("graphics/question.gif") no-repeat; | |
| 488 | + width:16px; | |
| 489 | + height:16px; | |
| 490 | + cursor:pointer; | |
| 390 | 491 | } |
| 391 | 492 | \ No newline at end of file | ... | ... |
setup/wizard/resources/wizard.js
| ... | ... | @@ -5,6 +5,7 @@ function wizard() { |
| 5 | 5 | // Does a form check on every new page load |
| 6 | 6 | wizard.prototype.doFormCheck = function() { |
| 7 | 7 | w.addReadOnly(); |
| 8 | + w.load(); | |
| 8 | 9 | } |
| 9 | 10 | |
| 10 | 11 | // Toggle Advance Database options |
| ... | ... | @@ -134,61 +135,87 @@ wizard.prototype.onSubmitValidate = function(silent) { |
| 134 | 135 | return true; |
| 135 | 136 | } |
| 136 | 137 | |
| 138 | +wizard.prototype.pClick = function() { | |
| 139 | + var state = document.getElementById('state'); | |
| 140 | + if(state != "undefined") { | |
| 141 | + state.name = 'previous'; | |
| 142 | + } | |
| 143 | +} | |
| 144 | + | |
| 145 | +wizard.prototype.nClick = function() { | |
| 146 | + var state = document.getElementById('state'); | |
| 147 | + if(state != "undefined") { | |
| 148 | + state.name = 'next'; | |
| 149 | + } | |
| 150 | +} | |
| 151 | + | |
| 137 | 152 | // Validate Registration Page |
| 138 | 153 | wizard.prototype.validateRegistration = function() { |
| 139 | - return true; | |
| 154 | + // See if next or previous is clicked. | |
| 155 | + var state = document.getElementById('state').name; | |
| 156 | + if(state == 'next') { | |
| 157 | + if(w.valRegHelper()) { | |
| 158 | + document.getElementById('sendAll').name = 'Next'; // Force the next step | |
| 159 | + document.getElementById('sendAll').value = 'next'; | |
| 160 | + document.getElementById('registration').submit(); | |
| 161 | + } | |
| 162 | + } else if(state == 'previous') { | |
| 163 | + document.getElementById('sendAll').name = 'Previous'; // Force the previous step | |
| 164 | + document.getElementById('sendAll').value = 'previous'; | |
| 165 | + document.getElementById('registration').submit(); | |
| 166 | + } | |
| 167 | +} | |
| 168 | + | |
| 169 | +wizard.prototype.valRegHelper = function() { | |
| 140 | 170 | var first = document.getElementById('first'); |
| 141 | 171 | var last = document.getElementById('last'); |
| 142 | 172 | var email = document.getElementById('email'); |
| 143 | 173 | |
| 144 | - if(first.value < 2) { | |
| 145 | - | |
| 174 | + if(first.value.length < 2) { | |
| 175 | + document.getElementById("reg_error").innerHTML = "Please enter a First Name"; | |
| 176 | + w.focusElement(first); | |
| 146 | 177 | return false; |
| 147 | 178 | } |
| 148 | - if(last.value < 2) { | |
| 149 | - | |
| 150 | - | |
| 179 | + if(last.value.length < 2) { | |
| 180 | + document.getElementById("reg_error").innerHTML = "Please enter a Last Name"; | |
| 181 | + w.focusElement(last); | |
| 182 | + return false; | |
| 151 | 183 | } |
| 152 | - if(w.emailCheck(email.value)) { | |
| 153 | - | |
| 184 | + if(!w.emailCheck(email.value)) { | |
| 185 | + document.getElementById("reg_error").innerHTML = "Please enter a valid email address"; | |
| 186 | + w.focusElement(email); | |
| 187 | + return false; | |
| 154 | 188 | } |
| 155 | 189 | |
| 156 | - return false; | |
| 190 | + return true; | |
| 157 | 191 | } |
| 158 | 192 | |
| 159 | 193 | // Validate Registration Page Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/) |
| 160 | -wizard.prototype.emailCheck = function() { | |
| 194 | +wizard.prototype.emailCheck = function(str) { | |
| 161 | 195 | var at="@"; |
| 162 | 196 | var dot="."; |
| 163 | 197 | var lat=str.indexOf(at); |
| 164 | 198 | var lstr=str.length; |
| 165 | 199 | var ldot=str.indexOf(dot); |
| 166 | 200 | if (str.indexOf(at)==-1) { |
| 167 | - // alert("Invalid E-mail ID") | |
| 168 | 201 | return false; |
| 169 | 202 | } |
| 170 | 203 | if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) { |
| 171 | - // alert("Invalid E-mail ID") | |
| 172 | 204 | return false; |
| 173 | 205 | } |
| 174 | 206 | if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) { |
| 175 | - // alert("Invalid E-mail ID") | |
| 176 | 207 | return false; |
| 177 | 208 | } |
| 178 | 209 | if (str.indexOf(at,(lat+1))!=-1) { |
| 179 | - // alert("Invalid E-mail ID") | |
| 180 | 210 | return false; |
| 181 | 211 | } |
| 182 | 212 | if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ |
| 183 | - // alert("Invalid E-mail ID") | |
| 184 | 213 | return false; |
| 185 | 214 | } |
| 186 | 215 | if (str.indexOf(dot,(lat+2))==-1){ |
| 187 | - // alert("Invalid E-mail ID") | |
| 188 | 216 | return false; |
| 189 | 217 | } |
| 190 | 218 | if (str.indexOf(" ")!=-1){ |
| 191 | - // alert("Invalid E-mail ID") | |
| 192 | 219 | return false; |
| 193 | 220 | } |
| 194 | 221 | return true; |
| ... | ... | @@ -213,4 +240,9 @@ wizard.prototype.addReadOnly = function() { |
| 213 | 240 | // w.focusElement(inputs[i]); |
| 214 | 241 | } |
| 215 | 242 | } |
| 243 | +} | |
| 244 | + | |
| 245 | +/* */ | |
| 246 | +wizard.prototype.load = function() { | |
| 247 | +// $('#tooltips').tooltip(); | |
| 216 | 248 | } |
| 217 | 249 | \ No newline at end of file | ... | ... |
setup/wizard/stepAction.php
| ... | ... | @@ -78,6 +78,15 @@ class stepAction { |
| 78 | 78 | protected $displayFirst = false; |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | + * List of install properties | |
| 82 | + * | |
| 83 | + * @author KnowledgeTree Team | |
| 84 | + * @access protected | |
| 85 | + * @var boolean | |
| 86 | + */ | |
| 87 | + protected $installProperties = array(); | |
| 88 | + | |
| 89 | + /** | |
| 81 | 90 | * Reference to session object |
| 82 | 91 | * |
| 83 | 92 | * @author KnowledgeTree Team |
| ... | ... | @@ -107,6 +116,95 @@ class stepAction { |
| 107 | 116 | } |
| 108 | 117 | |
| 109 | 118 | /** |
| 119 | + * Helper to initialize step actions | |
| 120 | + * | |
| 121 | + * @author KnowledgeTree Team | |
| 122 | + * @param string | |
| 123 | + * @access public | |
| 124 | + * @return string | |
| 125 | + */ | |
| 126 | + public function setUpStepAction($steps, $stepNames, $stepConfirmation, $stepDisplayFirst, $session, $installProperties) { | |
| 127 | + $this->setSteps($steps); | |
| 128 | + $this->setStepNames($stepNames); | |
| 129 | + $this->setDisplayConfirm($stepConfirmation); | |
| 130 | + $this->setDisplayFirst($stepDisplayFirst); | |
| 131 | + $this->loadSession($session); | |
| 132 | + $this->setInstallProperties($installProperties); | |
| 133 | + } | |
| 134 | + | |
| 135 | + /** | |
| 136 | + * Sets steps class names in string format | |
| 137 | + * | |
| 138 | + * @author KnowledgeTree Team | |
| 139 | + * @param array | |
| 140 | + * @access public | |
| 141 | + * @return void | |
| 142 | + */ | |
| 143 | + public function setSteps($stepClassNames) { | |
| 144 | + $this->stepClassNames = $stepClassNames; | |
| 145 | + } | |
| 146 | + | |
| 147 | + /** | |
| 148 | + * Sets steps in human readable string format | |
| 149 | + * | |
| 150 | + * @author KnowledgeTree Team | |
| 151 | + * @param array | |
| 152 | + * @access public | |
| 153 | + * @return void | |
| 154 | + */ | |
| 155 | + public function setStepNames($step_names) { | |
| 156 | + $this->step_names = $step_names; | |
| 157 | + } | |
| 158 | + | |
| 159 | + /** | |
| 160 | + * Sets confirmation page flag | |
| 161 | + * | |
| 162 | + * @author KnowledgeTree Team | |
| 163 | + * @param boolean | |
| 164 | + * @access public | |
| 165 | + * @return void | |
| 166 | + */ | |
| 167 | + public function setDisplayConfirm($displayConfirm) { | |
| 168 | + $this->displayConfirm = $displayConfirm; | |
| 169 | + } | |
| 170 | + | |
| 171 | + /** | |
| 172 | + * Sets confirmation page first flag | |
| 173 | + * | |
| 174 | + * @author KnowledgeTree Team | |
| 175 | + * @param boolean | |
| 176 | + * @access public | |
| 177 | + * @return void | |
| 178 | + */ | |
| 179 | + public function setDisplayFirst($displayFirst) { | |
| 180 | + $this->displayFirst = $displayFirst; | |
| 181 | + } | |
| 182 | + | |
| 183 | + /** | |
| 184 | + * Sets session object | |
| 185 | + * | |
| 186 | + * @author KnowledgeTree Team | |
| 187 | + * @param object Session | |
| 188 | + * @access public | |
| 189 | + * @return void | |
| 190 | + */ | |
| 191 | + public function loadSession($ses) { | |
| 192 | + $this->session = $ses; | |
| 193 | + } | |
| 194 | + | |
| 195 | + /** | |
| 196 | + * Sets install properties | |
| 197 | + * | |
| 198 | + * @author KnowledgeTree Team | |
| 199 | + * @param array | |
| 200 | + * @access public | |
| 201 | + * @return void | |
| 202 | + */ | |
| 203 | + public function setInstallProperties($installProperties) { | |
| 204 | + $this->installProperties = $installProperties; | |
| 205 | + } | |
| 206 | + | |
| 207 | + /** | |
| 110 | 208 | * Main control to handle the steps actions |
| 111 | 209 | * |
| 112 | 210 | * @author KnowledgeTree Team |
| ... | ... | @@ -181,43 +279,7 @@ class stepAction { |
| 181 | 279 | |
| 182 | 280 | return $str; |
| 183 | 281 | } |
| 184 | - | |
| 185 | - /** | |
| 186 | - * Sets steps class names in string format | |
| 187 | - * | |
| 188 | - * @author KnowledgeTree Team | |
| 189 | - * @param array | |
| 190 | - * @access public | |
| 191 | - * @return void | |
| 192 | - */ | |
| 193 | - public function setSteps($stepClassNames) { | |
| 194 | - $this->stepClassNames = $stepClassNames; | |
| 195 | - } | |
| 196 | - | |
| 197 | - /** | |
| 198 | - * Sets steps in human readable string format | |
| 199 | - * | |
| 200 | - * @author KnowledgeTree Team | |
| 201 | - * @param array | |
| 202 | - * @access public | |
| 203 | - * @return void | |
| 204 | - */ | |
| 205 | - public function setStepNames($step_names) { | |
| 206 | - $this->step_names = $step_names; | |
| 207 | - } | |
| 208 | - | |
| 209 | - /** | |
| 210 | - * Returns a message to display at the top of template | |
| 211 | - * | |
| 212 | - * @author KnowledgeTree Team | |
| 213 | - * @param none | |
| 214 | - * @access public | |
| 215 | - * @return string | |
| 216 | - */ | |
| 217 | - public function getTop() { | |
| 218 | - return '<span class="top">'.$this->getCurrentStepName().'</span>'; | |
| 219 | - } | |
| 220 | - | |
| 282 | + | |
| 221 | 283 | /** |
| 222 | 284 | * Returns current step name |
| 223 | 285 | * |
| ... | ... | @@ -270,10 +332,6 @@ class stepAction { |
| 270 | 332 | return $menu; |
| 271 | 333 | } |
| 272 | 334 | |
| 273 | - public function getActions() { | |
| 274 | - | |
| 275 | - } | |
| 276 | - | |
| 277 | 335 | /** |
| 278 | 336 | * Returns confirmation page flag |
| 279 | 337 | * |
| ... | ... | @@ -283,7 +341,6 @@ class stepAction { |
| 283 | 341 | * @return boolean |
| 284 | 342 | */ |
| 285 | 343 | public function displayConfirm() { |
| 286 | - // TODO:No other way I can think of doing this | |
| 287 | 344 | return $this->displayConfirm; |
| 288 | 345 | } |
| 289 | 346 | |
| ... | ... | @@ -300,42 +357,6 @@ class stepAction { |
| 300 | 357 | } |
| 301 | 358 | |
| 302 | 359 | /** |
| 303 | - * Sets confirmation page flag | |
| 304 | - * | |
| 305 | - * @author KnowledgeTree Team | |
| 306 | - * @param boolean | |
| 307 | - * @access public | |
| 308 | - * @return void | |
| 309 | - */ | |
| 310 | - public function setDisplayConfirm($displayConfirm) { | |
| 311 | - $this->displayConfirm = $displayConfirm; | |
| 312 | - } | |
| 313 | - | |
| 314 | - /** | |
| 315 | - * Sets confirmation page first flag | |
| 316 | - * | |
| 317 | - * @author KnowledgeTree Team | |
| 318 | - * @param boolean | |
| 319 | - * @access public | |
| 320 | - * @return void | |
| 321 | - */ | |
| 322 | - public function setDisplayFirst($displayFirst) { | |
| 323 | - $this->displayFirst = $displayFirst; | |
| 324 | - } | |
| 325 | - | |
| 326 | - /** | |
| 327 | - * Sets session object | |
| 328 | - * | |
| 329 | - * @author KnowledgeTree Team | |
| 330 | - * @param object Session | |
| 331 | - * @access public | |
| 332 | - * @return void | |
| 333 | - */ | |
| 334 | - public function loadSession($ses) { | |
| 335 | - $this->session = $ses; | |
| 336 | - } | |
| 337 | - | |
| 338 | - /** | |
| 339 | 360 | * Returns session object |
| 340 | 361 | * |
| 341 | 362 | * @author KnowledgeTree Team |
| ... | ... | @@ -356,8 +377,7 @@ class stepAction { |
| 356 | 377 | * @return string |
| 357 | 378 | */ |
| 358 | 379 | public function paintAction() { |
| 359 | - $left = $this->getLeftMenu(); | |
| 360 | - $top = $this->getTop(); | |
| 380 | + | |
| 361 | 381 | $step_errors = $this->action->getErrors(); // Get errors |
| 362 | 382 | $step_warnings = $this->action->getWarnings(); // Get warnings |
| 363 | 383 | if($this->displayConfirm()) { // Check if theres a confirm step |
| ... | ... | @@ -382,11 +402,19 @@ class stepAction { |
| 382 | 402 | } |
| 383 | 403 | $content = $step_tpl->fetch(); |
| 384 | 404 | $tpl = new Template("templates/wizard.tpl"); |
| 405 | + $vars = $this->getVars(); // Get template variables | |
| 406 | + $tpl->set("vars", $vars); // Set template errors | |
| 385 | 407 | $tpl->set('content', $content); |
| 386 | - $tpl->set('left', $left); | |
| 387 | 408 | echo $tpl->fetch(); |
| 388 | 409 | } |
| 389 | 410 | |
| 411 | + public function getVars() { | |
| 412 | + $left = $this->getLeftMenu(); | |
| 413 | + $vars['left'] = $left; // Set left menu | |
| 414 | + $vars['install_version'] = $this->installProperties['install_version']; // Set version | |
| 415 | + $vars['install_type'] = $this->installProperties['install_type']; // Set type | |
| 416 | + return $vars; | |
| 417 | + } | |
| 390 | 418 | /** |
| 391 | 419 | * Load class to session |
| 392 | 420 | * | ... | ... |
setup/wizard/steps/complete.php
| ... | ... | @@ -65,14 +65,6 @@ class complete extends Step { |
| 65 | 65 | |
| 66 | 66 | protected $util = null; |
| 67 | 67 | |
| 68 | - /** | |
| 69 | - * List of services to check | |
| 70 | - * | |
| 71 | - * @access private | |
| 72 | - * @var array | |
| 73 | - */ | |
| 74 | - private $_services = array('Lucene', 'Scheduler'); | |
| 75 | - | |
| 76 | 68 | public function __construct() { |
| 77 | 69 | $this->temp_variables = array("step_name"=>"complete", "silent"=>$this->silent); |
| 78 | 70 | $this->_dbhandler = new dbUtil(); | ... | ... |
setup/wizard/steps/dependencies.php
| ... | ... | @@ -361,7 +361,7 @@ class dependencies extends Step |
| 361 | 361 | private function getConfigurations() |
| 362 | 362 | { |
| 363 | 363 | return array( |
| 364 | - array('name' => 'Safe Mode', 'configuration' => 'safe_mode', 'recommended' => 'ON', 'type' => 'bool'), | |
| 364 | + array('name' => 'Safe Mode', 'configuration' => 'safe_mode', 'recommended' => 'OFF', 'type' => 'bool'), | |
| 365 | 365 | array('name' => 'Display Errors', 'configuration' => 'display_errors', 'recommended' => 'OFF', 'type' => 'bool'), |
| 366 | 366 | array('name' => 'Display Startup Errors', 'configuration' => 'display_startup_errors', 'recommended' => 'ON', 'type' => 'bool'), |
| 367 | 367 | array('name' => 'File Uploads', 'configuration' => 'file_uploads', 'recommended' => 'ON', 'type' => 'bool'), | ... | ... |
setup/wizard/steps/registration.php
| ... | ... | @@ -42,9 +42,6 @@ |
| 42 | 42 | |
| 43 | 43 | class registration extends Step |
| 44 | 44 | { |
| 45 | - | |
| 46 | - public $temp_variables = array("step_name"=>"registration"); | |
| 47 | - | |
| 48 | 45 | /** |
| 49 | 46 | * Initialise the registration step |
| 50 | 47 | * |
| ... | ... | @@ -66,10 +63,6 @@ class registration extends Step |
| 66 | 63 | public function doStep() |
| 67 | 64 | { |
| 68 | 65 | $this->setFormInfo(); |
| 69 | -// die('a'); | |
| 70 | -//print_r($_POST); | |
| 71 | -//print_r($_GET); | |
| 72 | -return 'next'; | |
| 73 | 66 | if(!$this->inStep("registration")) { |
| 74 | 67 | return 'landing'; |
| 75 | 68 | } |
| ... | ... | @@ -98,7 +91,7 @@ return 'next'; |
| 98 | 91 | if(isset($_POST['registered']) && $_POST['registered'] == 'yes'){ |
| 99 | 92 | return true; |
| 100 | 93 | } |
| 101 | - | |
| 94 | +return true; | |
| 102 | 95 | //$this->postForm($_POST); |
| 103 | 96 | //$this->sendToHost($_POST); |
| 104 | 97 | ... | ... |
setup/wizard/steps/services.php
| ... | ... | @@ -61,6 +61,7 @@ class services extends Step |
| 61 | 61 | protected $runInstall = true; |
| 62 | 62 | |
| 63 | 63 | private $services = array('Lucene', 'Scheduler', 'OpenOffice'); |
| 64 | +// private $services = array('OpenOffice'); | |
| 64 | 65 | |
| 65 | 66 | protected $java; |
| 66 | 67 | |
| ... | ... | @@ -68,7 +69,7 @@ class services extends Step |
| 68 | 69 | |
| 69 | 70 | protected $util; |
| 70 | 71 | |
| 71 | - private $javaVersion = '1.7'; | |
| 72 | + private $javaVersion = '1.5'; | |
| 72 | 73 | |
| 73 | 74 | /** |
| 74 | 75 | * Java Installed |
| ... | ... | @@ -294,8 +295,10 @@ class services extends Step |
| 294 | 295 | $service = new $className(); |
| 295 | 296 | $status = $this->serviceStatus($service); |
| 296 | 297 | if($status != 'STARTED') { |
| 297 | - $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$service->getName()." Could not be added as a Service"); | |
| 298 | + $msg = $service->getName()." Could not be added as a Service"; | |
| 299 | + $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$msg); | |
| 298 | 300 | $this->serviceCheck = 'cross_orange'; |
| 301 | + $this->warnings[] = $msg; | |
| 299 | 302 | } else { |
| 300 | 303 | if(WINDOWS_OS) { |
| 301 | 304 | $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service"); } |
| ... | ... | @@ -356,7 +359,7 @@ class services extends Step |
| 356 | 359 | } |
| 357 | 360 | |
| 358 | 361 | private function useDetected() { |
| 359 | - return $this->detSettings(); | |
| 362 | + return $this->detSettings(true); | |
| 360 | 363 | } |
| 361 | 364 | |
| 362 | 365 | private function specifyJava() { |
| ... | ... | @@ -387,7 +390,7 @@ class services extends Step |
| 387 | 390 | * @access private |
| 388 | 391 | * @return boolean |
| 389 | 392 | */ |
| 390 | - private function detSettings() { | |
| 393 | + private function detSettings($attempt) { | |
| 391 | 394 | $javaExecutable = $this->util->javaSpecified();// Retrieve java bin |
| 392 | 395 | $cmd = "$javaExecutable -version > output/outJV 2>&1 echo $!"; |
| 393 | 396 | $response = $this->util->pexec($cmd); |
| ... | ... | @@ -398,7 +401,7 @@ class services extends Step |
| 398 | 401 | if($matches[1] < $this->javaVersion) { // Check Version of java |
| 399 | 402 | $this->javaVersionInCorrect(); |
| 400 | 403 | $this->javaCheck = 'cross'; |
| 401 | - $this->error[] = "Requires Java 1.5+ to be installed"; | |
| 404 | + if(!$attempt) $this->error[] = "Requires Java 1.5+ to be installed"; | |
| 402 | 405 | return false; |
| 403 | 406 | } else { |
| 404 | 407 | $this->javaVersionCorrect(); |
| ... | ... | @@ -411,10 +414,12 @@ class services extends Step |
| 411 | 414 | $this->javaVersionWarning(); |
| 412 | 415 | $this->javaCheck = 'cross_orange'; |
| 413 | 416 | $this->javaExeError = "Java : Incorrect path specified"; |
| 414 | - $this->error[] = "Requires Java 1.5+ to be installed"; | |
| 417 | + if(!$attempt) $this->error[] = "Requires Java 1.5+ to be installed"; | |
| 415 | 418 | return false; |
| 416 | 419 | } |
| 417 | 420 | } |
| 421 | + | |
| 422 | + return false; | |
| 418 | 423 | } |
| 419 | 424 | |
| 420 | 425 | function detPhpSettings() { | ... | ... |
setup/wizard/templates/complete.tpl
| 1 | -<h1>Installation Completed</h1> | |
| 2 | - | |
| 3 | -<h2>KnowledgeTree post-configuration checkup</h2> | |
| 4 | - | |
| 5 | -<p>This allows you to check that your KnowledgeTree configuration is set | |
| 6 | -up correctly. You can run this at any time after configuration to check | |
| 7 | -that things are still set up correctly.</p> | |
| 8 | - | |
| 9 | -<?php | |
| 10 | -if($errors || $warnings){ | |
| 11 | - echo '<div>' | |
| 12 | - . '<a href="http://wiki.knowledgetree.com/Web_Based_Installer#Post_Install" target="_blank">' | |
| 13 | - . 'Click Here for help on overcoming post install issues</a></div><br/>'; | |
| 14 | -} | |
| 15 | -?> | |
| 1 | +<form> | |
| 2 | + <p class="title">Installation Completed</p> | |
| 3 | + | |
| 4 | +<!-- <h2>KnowledgeTree post-configuration checkup</h2>--> | |
| 16 | 5 | |
| 17 | -<div> | |
| 18 | - <h3><?php echo "<span class='{$paths_check}'> </span>"; ?>Paths and Permissions</h3> | |
| 19 | -<?php if($silent) { ?> | |
| 20 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('paths_check');}">Show Details</div> | |
| 21 | - <div class="paths_check" style="display:none"> | |
| 22 | -<?php } ?> | |
| 23 | - <table> | |
| 24 | - <tr><?php echo $varDirectory; ?></tr> | |
| 25 | - <tr><?php echo $documentRoot; ?></tr> | |
| 26 | - <tr><?php echo $logDirectory; ?></tr> | |
| 27 | - <tr><?php echo $tmpDirectory; ?></tr> | |
| 28 | - <tr><?php echo $uploadDirectory; ?></tr> | |
| 29 | - <tr><?php echo $config; ?></tr> | |
| 30 | - <tr><?php echo $docLocation; ?></tr> | |
| 31 | - </table> | |
| 32 | -<?php if($silent) { ?> | |
| 6 | + <p>This allows you to check that your KnowledgeTree configuration is set | |
| 7 | + up correctly. You can run this at any time after configuration to check | |
| 8 | + that things are still set up correctly.</p> | |
| 9 | + | |
| 10 | + <?php | |
| 11 | + if($errors || $warnings){ | |
| 12 | + echo '<div>' | |
| 13 | + . '<a href="http://wiki.knowledgetree.com/Web_Based_Installer#Post_Install" target="_blank">' | |
| 14 | + . 'Click Here for help on overcoming post install issues</a></div><br/>'; | |
| 15 | + } | |
| 16 | + ?> | |
| 17 | + <div id="step_content_complete"> | |
| 18 | + <div> | |
| 19 | + <h3><?php echo "<span class='{$paths_check}'> </span>"; ?>Paths and Permissions</h3> | |
| 20 | + <?php if($silent) { ?> | |
| 21 | + <div id="options" class="onclick" onclick="javascript:{w.toggleClass('paths_check');}">Show Details</div> | |
| 22 | + <div class="paths_check" style="display:none"> | |
| 23 | + <?php } ?> | |
| 24 | + <table> | |
| 25 | + <tr><?php echo $varDirectory; ?></tr> | |
| 26 | + <tr><?php echo $documentRoot; ?></tr> | |
| 27 | + <tr><?php echo $logDirectory; ?></tr> | |
| 28 | + <tr><?php echo $tmpDirectory; ?></tr> | |
| 29 | + <tr><?php echo $uploadDirectory; ?></tr> | |
| 30 | + <tr><?php echo $config; ?></tr> | |
| 31 | + <tr><?php echo $docLocation; ?></tr> | |
| 32 | + </table> | |
| 33 | + <?php if($silent) { ?> | |
| 34 | + </div> | |
| 35 | + <?php } ?> | |
| 33 | 36 | </div> |
| 34 | -<?php } ?> | |
| 35 | -</div> | |
| 36 | -<div> | |
| 37 | - <h3><?php echo "<span class='{$database_check}'> </span>"; ?>Database connectivity</h3> | |
| 38 | -<?php if($silent) { ?> | |
| 39 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('database_check');}">Show Details</div> | |
| 40 | - <div class="database_check" style="display:none"> | |
| 41 | -<?php } ?> | |
| 42 | - <table> | |
| 43 | - <tr><?php echo $dbConnectAdmin; ?></tr> | |
| 44 | - <tr><?php echo $dbConnectUser; ?></tr> | |
| 45 | - </table> | |
| 46 | -<?php if($silent) { ?> | |
| 37 | + <div> | |
| 38 | + <h3><?php echo "<span class='{$database_check}'> </span>"; ?>Database connectivity</h3> | |
| 39 | + <?php if($silent) { ?> | |
| 40 | + <div id="options" class="onclick" onclick="javascript:{w.toggleClass('database_check');}">Show Details</div> | |
| 41 | + <div class="database_check" style="display:none"> | |
| 42 | + <?php } ?> | |
| 43 | + <table> | |
| 44 | + <tr><?php echo $dbConnectAdmin; ?></tr> | |
| 45 | + <tr><?php echo $dbConnectUser; ?></tr> | |
| 46 | + </table> | |
| 47 | + <?php if($silent) { ?> | |
| 48 | + </div> | |
| 49 | + <?php } ?> | |
| 50 | + <h3><?php echo "<span class='{$privileges_check}'> </span>"; ?>Privileges</h3> | |
| 51 | + <?php if($silent) { ?> | |
| 52 | + <div id="options" class="onclick" onclick="javascript:{w.toggleClass('privileges_check');}">Show Details</div> | |
| 53 | + <div class="privileges_check" style="display:none"> | |
| 54 | + <?php } ?> | |
| 55 | + <table> | |
| 56 | + <tr><?php echo $dbPrivileges; ?></tr> | |
| 57 | + <tr><?php echo $dbTransaction; ?></tr> | |
| 58 | + </table> | |
| 59 | + <?php if($silent) { ?> | |
| 60 | + </div> | |
| 61 | + <?php } ?> | |
| 47 | 62 | </div> |
| 48 | -<?php } ?> | |
| 49 | - <h3><?php echo "<span class='{$privileges_check}'> </span>"; ?>Privileges</h3> | |
| 50 | -<?php if($silent) { ?> | |
| 51 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('privileges_check');}">Show Details</div> | |
| 52 | - <div class="privileges_check" style="display:none"> | |
| 53 | -<?php } ?> | |
| 54 | - <table> | |
| 55 | - <tr><?php echo $dbPrivileges; ?></tr> | |
| 56 | - <tr><?php echo $dbTransaction; ?></tr> | |
| 57 | - </table> | |
| 58 | -<?php if($silent) { ?> | |
| 63 | + <div> | |
| 64 | + <h3><?php echo "<span class='{$services_check}'> </span>"; ?>Services</h3> | |
| 65 | + <?php if($silent) { ?> | |
| 66 | + <div id="options" class="onclick" onclick="javascript:{w.toggleClass('services_check');}">Show Details</div> | |
| 67 | + <div class="services_check" style="display:none"> | |
| 68 | + <?php } ?> | |
| 69 | + <table> | |
| 70 | + <tr> | |
| 71 | + <td><?php echo "<span class='{$LuceneStatus}'> </span>"; ?>Lucene Service</td> | |
| 72 | + <?php if ($LuceneStatus != 'tick') { ?> | |
| 73 | + <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> | |
| 74 | + <?php } ?> | |
| 75 | + </tr> | |
| 76 | + <tr> | |
| 77 | + <td><?php echo "<span class='{$SchedulerStatus}'> </span>"; ?>Scheduler Service</td> | |
| 78 | + <?php if ($SchedulerStatus != 'tick') { ?> | |
| 79 | + <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> | |
| 80 | + <?php } ?> | |
| 81 | + </tr> | |
| 82 | + </table> | |
| 83 | + <?php if($silent) { ?> | |
| 84 | + </div> | |
| 85 | + <?php } ?> | |
| 59 | 86 | </div> |
| 60 | -<?php } ?> | |
| 61 | -</div> | |
| 62 | -<div> | |
| 63 | - <h3><?php echo "<span class='{$services_check}'> </span>"; ?>Services</h3> | |
| 64 | -<?php if($silent) { ?> | |
| 65 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('services_check');}">Show Details</div> | |
| 66 | - <div class="services_check" style="display:none"> | |
| 67 | -<?php } ?> | |
| 68 | - <table> | |
| 69 | - <tr> | |
| 70 | - <td><?php echo "<span class='{$LuceneStatus}'> </span>"; ?>Lucene Service</td> | |
| 71 | - <?php if ($LuceneStatus != 'tick') { ?> | |
| 72 | - <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> | |
| 73 | - <?php } ?> | |
| 74 | - </tr> | |
| 75 | - <tr> | |
| 76 | - <td><?php echo "<span class='{$SchedulerStatus}'> </span>"; ?>Scheduler Service</td> | |
| 77 | - <?php if ($SchedulerStatus != 'tick') { ?> | |
| 78 | - <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> | |
| 79 | - <?php } ?> | |
| 80 | - </tr> | |
| 81 | - </table> | |
| 82 | -<?php if($silent) { ?> | |
| 83 | 87 | </div> |
| 84 | -<?php } ?> | |
| 85 | -</div> | |
| 86 | -<form> | |
| 87 | - <div class="buttons"> | |
| 88 | -<!-- <a href="index.php?step_name=complete&step=previous" class="previous">Previous</a>--> | |
| 89 | -<!-- <a href="">Refresh</a>--> | |
| 90 | - <a href="../../">Goto Login</a> | |
| 91 | - <?php | |
| 92 | - if (INSTALL_TYPE == 'Zend') { | |
| 93 | - echo '<a href="http://' . $_SERVER['HTTP_HOST'] . '/ZendServer/Index">Zend Server Configuration</a>'; | |
| 94 | - } | |
| 95 | - ?> | |
| 96 | -</div> | |
| 88 | + <a href="../../" class="buttons back" style="width:80px;">Goto Login</a> | |
| 89 | + <?php | |
| 90 | + if (INSTALL_TYPE == 'Zend') { | |
| 91 | + ?> | |
| 92 | + <a href="<?php echo "http://".$_SERVER['HTTP_HOST'].":10081/ZendServer/Index"; ?>" class="back" target="_blank">Zend Server Configuration</a> | |
| 93 | + <?php | |
| 94 | + } | |
| 95 | + ?> | |
| 97 | 96 | </form> |
| 98 | 97 | \ No newline at end of file | ... | ... |
setup/wizard/templates/configuration.tpl
| 1 | -<h1>Checking System Configuration</h1> | |
| 1 | +<form action="index.php?step_name=configuration" method="post"> | |
| 2 | +<p class="title">Checking System Configuration</p> | |
| 2 | 3 | |
| 3 | 4 | <p class="description"> |
| 4 | 5 | The wizard will review your system to determine whether KnowledgeTree is correctly configured. You’ll see whether KnowledgeTree has the correct settings or whether changes are required. |
| ... | ... | @@ -15,7 +16,7 @@ The wizard will review your system to determine whether KnowledgeTree is correct |
| 15 | 16 | </div> |
| 16 | 17 | <div class="error_message"> |
| 17 | 18 | <?php if($errors) { ?> |
| 18 | - <span class='cross'> Your system is not quite ready to run KnowledgeTree. See the list below to determine which areas you need to address. <br/> Once you’ve fixed these items, return to this wizard and try again.</span><br/> | |
| 19 | + <span class='cross'> 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.</span><br/> | |
| 19 | 20 | <?php } elseif ($warnings) { |
| 20 | 21 | ?> |
| 21 | 22 | <span class='cross_orange'> KnowledgeTree Optional Dependencies not met, but you will be able to continue.</span><br/> |
| ... | ... | @@ -28,40 +29,47 @@ The wizard will review your system to determine whether KnowledgeTree is correct |
| 28 | 29 | <?php } ?> |
| 29 | 30 | </div> |
| 30 | 31 | |
| 31 | -<form action="index.php?step_name=configuration" method="post"> | |
| 32 | +<div id="step_content_configuration"> | |
| 32 | 33 | <h3>Server Settings</h3> |
| 33 | 34 | |
| 34 | 35 | <p class="description"> |
| 35 | 36 | 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. |
| 36 | 37 | </p> |
| 37 | 38 | |
| 38 | -<table> | |
| 39 | +<table class="dbconf"> | |
| 39 | 40 | <tr> |
| 40 | - <td><label for='host'>Host: </label></td> | |
| 41 | - <td><input name='host' id='host' size='60' value='<?php echo $server['host']['value']; ?>' /></td> | |
| 41 | + <td width="150px"><label for='host'>Host: </label></td> | |
| 42 | + <td> <div id="tooltips" title="Location of your web root"> </div> </td> | |
| 43 | + <td><input name='host' id='host' size='35' value='<?php echo $server['host']['value']; ?>' /></td> | |
| 42 | 44 | </tr> |
| 43 | 45 | <tr> |
| 44 | 46 | <td><label for='port'>Port: </label></td> |
| 45 | - <td><input name='port' id='port' size='5' value='<?php echo $server['port']['value']; ?>' /></td> | |
| 47 | + <td> <div id="tooltips" title="The port that the web server listens on."> </div> </td> | |
| 48 | + <td><input name='port' id='port' size='5' value='<?php echo $server['port']['value']; ?>' style="float:left;"/></td> | |
| 46 | 49 | </tr> |
| 47 | 50 | <tr> |
| 48 | 51 | <td><label for='root_url'>Root URL: </label></td> |
| 49 | - <td><input name='root_url' id='root_url' size='60' value='<?php echo $server['root_url']['value']; ?>' /></td> | |
| 52 | + <td> <div id="tooltips" title="Relative path to KnowledgeTree Source directory"> </div> </td> | |
| 53 | + <td><input name='root_url' id='root_url' size='35' value='<?php echo $server['root_url']['value']; ?>' /></td> | |
| 50 | 54 | </tr> |
| 51 | 55 | <tr> |
| 52 | 56 | <td><label for='file_system_root'>Web Root: </label></td> |
| 53 | - <td><input name='file_system_root' id='file_system_root' size='60' value='<?php echo $server['file_system_root']['value']; ?>' /></td> | |
| 57 | + <td> <div id="tooltips" title="Absolute path to KnowledgeTree Source directory"> </div> </td> | |
| 58 | + <td><input name='file_system_root' id='file_system_root' size='35' value='<?php echo $server['file_system_root']['value']; ?>' /></td> | |
| 54 | 59 | </tr> |
| 55 | 60 | <tr> |
| 56 | - <td><label for='yes'>Do you have SSL Enabled?: </label></td> | |
| 57 | - <td> | |
| 58 | - <label for='yes'>Yes: </label><input type='radio' name='ssl_enabled' id='yes' value='yes' <?php echo $server['ssl_enabled']['value'] == 'yes' ? 'CHECKED' : ''; ?> /> | |
| 59 | - <label for='no'>No: </label><input type='radio' name='ssl_enabled' id='no' value='no' <?php echo $server['ssl_enabled']['value'] == 'no' ? 'CHECKED' : ''; ?> /> | |
| 60 | - </td> | |
| 61 | + <td> <label for='yes'>Do you have SSL Enabled?: </label> </td> | |
| 62 | + <td> <div id="tooltips" title="Whether or not you have SSL installed"> </div> </td> | |
| 63 | + <td> | |
| 64 | + <label for='yes'>Yes: </label> | |
| 65 | + <input class="radio" type='radio' name='ssl_enabled' id='yes' value='yes' <?php echo $server['ssl_enabled']['value'] == 'yes' ? 'CHECKED' : ''; ?> /> | |
| 66 | + <label for='no'>No: </label> | |
| 67 | + <input class="radio" type='radio' name='ssl_enabled' id='no' value='no' <?php echo $server['ssl_enabled']['value'] == 'no' ? 'CHECKED' : ''; ?> /> | |
| 68 | + </td> | |
| 61 | 69 | </tr> |
| 62 | 70 | </table> |
| 63 | 71 | |
| 64 | -<h3><?php echo "<span class='{$paths_perms}'> </span>"; ?>Paths and Permissions</h3> | |
| 72 | +<h3><?php echo "<span class='{$paths_perms}'> </span>"; ?>Directory Paths and Permissions</h3> | |
| 65 | 73 | <?php if($silent) { ?> |
| 66 | 74 | <div id="options" class="onclick" onclick="javascript:{w.toggleClass('paths_perms');}">Show Details</div> |
| 67 | 75 | <div class="paths_perms" style="display:none"> |
| ... | ... | @@ -76,12 +84,17 @@ The following folders must be writable for KnowledgeTree to be able to run. The |
| 76 | 84 | <tr> |
| 77 | 85 | <td> <div class='<?php echo $path['class']; ?>'></div> </td> |
| 78 | 86 | <td> <label for='<?php echo $path['setting']; ?>'> <?php echo $path['name']; ?>: </label> </td> |
| 79 | - <td><input name='<?php echo $path['setting']; ?>' id='<?php echo $path['setting']; ?>' size='60' value='<?php echo $path['path']; ?>' /></td> | |
| 87 | + <td><input name='<?php echo $path['setting']; ?>' id='<?php echo $path['setting']; ?>' style="float:left;width:290px;" value='<?php echo $path['path']; ?>' /></td> | |
| 80 | 88 | <?php if(isset($path['msg'])) { |
| 81 | 89 | ?> |
| 82 | 90 | <td class="error"> <?php echo $path['msg']; ?> </td> |
| 83 | 91 | <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> |
| 84 | 92 | <?php |
| 93 | + } else { | |
| 94 | + ?> | |
| 95 | + <td class="error"> </td> | |
| 96 | + <td> </td> | |
| 97 | + <?php | |
| 85 | 98 | } |
| 86 | 99 | ?> |
| 87 | 100 | </tr> |
| ... | ... | @@ -92,8 +105,7 @@ The following folders must be writable for KnowledgeTree to be able to run. The |
| 92 | 105 | <?php if($silent) { ?> |
| 93 | 106 | </div> |
| 94 | 107 | <?php } ?> |
| 95 | -<div class="buttons"> | |
| 96 | - <input type="submit" name="Previous" value="Previous"/> | |
| 97 | - <input type="submit" name="Next" value="Next"/> | |
| 98 | -</div> | |
| 108 | + </div> | |
| 109 | + <input type="submit" name="Previous" value="Previous" class="back"/> | |
| 110 | + <input type="submit" name="Next" value="Next" class="input"/> | |
| 99 | 111 | </form> |
| 100 | 112 | \ No newline at end of file | ... | ... |
setup/wizard/templates/configuration_confirm.tpl
| 1 | -<h1>System Configuration</h1> | |
| 2 | - | |
| 3 | -<h3>Server Settings</h3> | |
| 4 | - | |
| 5 | -<table> | |
| 6 | - <tr> | |
| 7 | - <td>Host: </td> | |
| 8 | - <td><?php echo $server['host']['value']; ?></td> | |
| 9 | - </tr> | |
| 10 | - <tr> | |
| 11 | - <td>Port: </td> | |
| 12 | - <td><?php echo $server['port']['value']; ?></td> | |
| 13 | - </tr> | |
| 14 | - <tr> | |
| 15 | - <td>Root Url: </td> | |
| 16 | - <td><?php echo $server['root_url']['value']; ?></td> | |
| 17 | - </tr> | |
| 18 | - <tr> | |
| 19 | - <td>File System Root: </td> | |
| 20 | - <td><?php echo $server['file_system_root']['value']; ?></td> | |
| 21 | - </tr> | |
| 22 | - <tr> | |
| 23 | - <td>SSL Enabled: </td> | |
| 24 | - <td><?php echo $server['ssl_enabled']['value']; ?></td> | |
| 25 | - </tr> | |
| 26 | -</table> | |
| 27 | - | |
| 28 | -<h3>Paths and Permissions</h3> | |
| 29 | - | |
| 30 | -<table> | |
| 31 | -<?php | |
| 32 | - foreach ($paths as $key => $path){ | |
| 33 | -?> | |
| 34 | - <tr> | |
| 35 | - <td><div class='<?php echo $path['class']; ?>'></div></td> | |
| 36 | - <td><?php echo $path['name']; ?>:</td> | |
| 37 | - <td><?php echo $path['path']; ?></td> | |
| 38 | - </tr> | |
| 39 | -<?php | |
| 40 | - } | |
| 41 | -?> | |
| 42 | -</table> | |
| 43 | - | |
| 44 | 1 | <form action="index.php?step_name=configuration" method="post"> |
| 45 | - | |
| 46 | -<div class="buttons"> | |
| 47 | - <!--<input type="submit" onclick="history.back();" name="Back" value="Back"/> | |
| 48 | - <input type="submit" name="Back" value="Back"/>--> | |
| 49 | - <input type="submit" name="Edit" value="Edit"/> | |
| 50 | - <input type="submit" name="Confirm" value="Confirm"/> | |
| 51 | -</div> | |
| 2 | + <p class="title">System Configuration</p> | |
| 3 | + <div class="continue_message"> | |
| 4 | + <?php | |
| 5 | + if(!$errors && !$warnings) { | |
| 6 | + ?> | |
| 7 | + All configuration settings are correctly set. Please click next to continue. | |
| 8 | + <?php | |
| 9 | + } | |
| 10 | + ?> | |
| 11 | + </div> | |
| 12 | + <div class="error_message"> | |
| 13 | + <?php if($errors) { ?> | |
| 14 | + <span class='cross'> 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.</span><br/> | |
| 15 | + <?php } elseif ($warnings) { | |
| 16 | + ?> | |
| 17 | + <span class='cross_orange'> KnowledgeTree Optional Dependencies not met, but you will be able to continue.</span><br/> | |
| 18 | + <?php | |
| 19 | + }?> | |
| 20 | + <?php | |
| 21 | + if($errors || $warnings) { | |
| 22 | + ?> | |
| 23 | + <a href="http://wiki.knowledgetree.com/Web_Based_Installer#System_Configuration" target="_blank">Click here for help on overcoming configuration issues</a> | |
| 24 | + <?php } ?> | |
| 25 | + </div> | |
| 26 | + | |
| 27 | + <div id="step_content_configuration"> | |
| 28 | + <h3>Server Settings</h3> | |
| 29 | + <table> | |
| 30 | + <tr> | |
| 31 | + <td width="150px">Host: </td> | |
| 32 | + <td> <div id="tooltips" title="Location of your web root"> </div> </td> | |
| 33 | + <td><?php echo $server['host']['value']; ?></td> | |
| 34 | + </tr> | |
| 35 | + <tr> | |
| 36 | + <td>Port: </td> | |
| 37 | + <td> <div id="tooltips" title="The port that the web server listens on."> </div> </td> | |
| 38 | + <td><?php echo $server['port']['value']; ?></td> | |
| 39 | + </tr> | |
| 40 | + <tr> | |
| 41 | + <td>Root Url: </td> | |
| 42 | + <td> <div id="tooltips" title="Relative path to KnowledgeTree Source directory"> </div> </td> | |
| 43 | + <td><?php echo $server['root_url']['value']; ?></td> | |
| 44 | + </tr> | |
| 45 | + <tr> | |
| 46 | + <td>File System Root: </td> | |
| 47 | + <td> <div id="tooltips" title="Absolute path to KnowledgeTree Source directory"> </div> </td> | |
| 48 | + <td><?php echo $server['file_system_root']['value']; ?></td> | |
| 49 | + </tr> | |
| 50 | + <tr> | |
| 51 | + <td>SSL Enabled: </td> | |
| 52 | + <td> <div id="tooltips" title="Whether or not you have SSL installed"> </div> </td> | |
| 53 | + <td><?php echo $server['ssl_enabled']['value']; ?></td> | |
| 54 | + </tr> | |
| 55 | + </table> | |
| 56 | + | |
| 57 | + <h3>Paths and Permissions</h3> | |
| 58 | + | |
| 59 | + <table class="conf_paths"> | |
| 60 | + <?php | |
| 61 | + foreach ($paths as $key => $path){ | |
| 62 | + ?> | |
| 63 | + <tr> | |
| 64 | + <td width="10"><div class='<?php echo $path['class']; ?>'></div></td> | |
| 65 | + <td width="22%"><?php echo $path['name']; ?>:</td> | |
| 66 | + <td width="50%"><?php echo $path['path']; ?></td> | |
| 67 | + <?php if(isset($path['msg'])) { ?> | |
| 68 | + <td class="error" width="27%"> <?php echo $path['msg']; ?> </td> | |
| 69 | + <td width="10"><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> | |
| 70 | + <?php } else { ?> | |
| 71 | + <td class="error" width="27%"> </td> | |
| 72 | + <td width="10"> </td> | |
| 73 | + <?php } ?> | |
| 74 | + </tr> | |
| 75 | + <?php | |
| 76 | + } | |
| 77 | + ?> | |
| 78 | + </table> | |
| 79 | + <br/> | |
| 80 | + </div> | |
| 81 | + <input type="submit" name="Edit" value="Edit" class="back"/> | |
| 82 | + <input type="submit" name="Confirm" value="Confirm" class="input"/> | |
| 52 | 83 | </form> |
| 53 | 84 | \ No newline at end of file | ... | ... |
setup/wizard/templates/database.tpl
| 1 | -<h1>Confirming Database Configurations</h1> | |
| 1 | +<form id="dbsettings" action="index.php?step_name=<?php echo $step_name; ?>" method="post" onsubmit="w.onSubmitValidate(<?php if ($silent) echo 'true'; else echo 'false'; ?>);return false;"> | |
| 2 | +<p class="title">Confirming Database Configurations</p> | |
| 2 | 3 | <!-- Check For immediate Errors --> |
| 3 | 4 | <span class="error"> <?php if($errors['con']) { echo $errors['con']; } ?> </span> |
| 4 | -<form id="dbsettings" action="index.php?step_name=<?php echo $step_name; ?>" method="post" onsubmit="w.onSubmitValidate(<?php if ($silent) echo 'true'; else echo 'false'; ?>);return false;"> | |
| 5 | 5 | <!-- Hidden Fields --> |
| 6 | 6 | <input type="hidden" id='ddrop' name="ddrop" <?php echo ($ddrop) ? 'CHECKED' : ''; ?>/> |
| 7 | 7 | <input type="hidden" id="sendAll" name="" value="" /> |
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | This step configures the connection to the database server and installs the database. The details for an administrative <br/> |
| 12 | 12 | user on the database server are required in order to be able to configure and install the installation database. |
| 13 | 13 | </div> |
| 14 | + <div id="step_content_database"> | |
| 14 | 15 | <table class="dbconf"> |
| 15 | 16 | <!-- TODO: Different Databases--> |
| 16 | 17 | <tr><td>Your current database type is: </td> |
| ... | ... | @@ -26,53 +27,50 @@ |
| 26 | 27 | </tr> |
| 27 | 28 | <tr> |
| 28 | 29 | <td><label for='dname'>Enter a name for the database: </label></td> |
| 29 | - <td><input type='text' value="<?php echo $dname?>" id='dname' name='dname' size='40'/></td> | |
| 30 | + <td><input type='text' value="<?php echo $dname?>" id='dname' name='dname' size='45'/></td> | |
| 30 | 31 | <td id="error" class="error"><?php if($errors['dname']) echo $errors['dname']; ?></td> |
| 31 | 32 | </tr> |
| 32 | 33 | <tr> |
| 33 | 34 | <td><label for='duname'>Enter Database Administrative username: </label></td> |
| 34 | - <td><input type='text' value="<?php echo $duname?>" id='duname' name='duname' size='40' /></td> | |
| 35 | + <td><input type='text' value="<?php echo $duname?>" id='duname' name='duname' size='45' /></td> | |
| 35 | 36 | <td id="error" class="error"><?php if($errors['duname']) echo $errors['duname']; ?></td> |
| 36 | 37 | </tr> |
| 37 | 38 | <tr> |
| 38 | 39 | <td><label for='dpassword'>Enter the password for the user: </label></td> |
| 39 | - <td><input type='password' value="<?php echo $dpassword?>" id='dpassword' name='dpassword' size='40' /></td> | |
| 40 | + <td><input type='password' value="<?php echo $dpassword?>" id='dpassword' name='dpassword' size='45' /></td> | |
| 40 | 41 | <td id="error" class="error"><?php if($errors['dpassword']) echo $errors['dpassword']; ?></td> |
| 41 | 42 | </tr> |
| 42 | 43 | </table> |
| 43 | 44 | |
| 44 | 45 | <div id="options" class="onclick" onclick="javascript:{w.toggleClass('adv_options');}">Advanced Options</div> |
| 45 | - | |
| 46 | 46 | <div id="database" class="adv_options" style="display:none;"> |
| 47 | 47 | <div class="description"> |
| 48 | 48 | These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings. |
| 49 | 49 | </div> |
| 50 | - <p> | |
| 51 | - <label for='dhost'>Host: </label><br /> | |
| 52 | - <span class="description">The address of the server where the database is located, if different to the current server.</span><br/> | |
| 53 | - <input type="text" value="<?php echo $dhost?>" id="dhost" name="dhost" size='60'/> | |
| 54 | - </p> | |
| 55 | - | |
| 56 | - <p> | |
| 57 | - <label for='dport'>Port: </label><br /> | |
| 58 | - <span class="description">The port on which your database server is listening, if it is a non-standard port please enter the number here.</span><br/> | |
| 59 | - <input type="text" value="<?php echo $dport?>" id="dport" name="dport" size='10'/> | |
| 60 | - </p> | |
| 61 | - | |
| 62 | - <p> | |
| 63 | - <label for='dbbinary'>Socket: </label><br /> | |
| 64 | - <span class="description">The path to the database binary. If it is not on your system path then please enter it here.</span><br/> | |
| 65 | - <input type="text" value="<?php echo $dbbinary?>" id="dbbinary" name="dbbinary" size='60'/> | |
| 66 | - </p> | |
| 50 | + <div class="db_adv_options"> | |
| 51 | + <div class="adv_option"> | |
| 52 | + <label for='dhost'>Host: </label><br> | |
| 53 | + <span class="description">The address of the server where the database is located, if different to the current server.</span> | |
| 54 | + <input type="text" value="<?php echo $dhost?>" id="dhost" name="dhost" size='45' class="textinput"/> | |
| 55 | + </div> | |
| 56 | + <div class="adv_option"> | |
| 57 | + <label for='dport'>Port: </label><br> | |
| 58 | + <span class="description">The port on which your database server is listening, if it is a non-standard port please enter the number here.</span> | |
| 59 | + <input type="text" value="<?php echo $dport?>" id="dport" name="dport" size='10' class="textinput"/> | |
| 60 | + </div> | |
| 61 | + <div class="adv_option"> | |
| 62 | + <label for='dport'>Socket: </label><br> | |
| 63 | + <span class="description">The path to the database binary. If it is not on your system path then please enter it here.</span> <input type="text" value="<?php echo $dbbinary?>" id="dbbinary" name="dbbinary" size='45' class="textinput"/> | |
| 64 | + </div> | |
| 65 | + </div> | |
| 66 | + </div> | |
| 67 | 67 | </div> |
| 68 | - <div class="buttons"> | |
| 69 | - <input type="submit" name="Previous" value="Previous" /> | |
| 68 | + <input type="submit" class="back" name="Previous" value="Previous" /> | |
| 70 | 69 | <?php if ($silent) { ?> |
| 71 | - <input type="submit" name="Next" value="Next" /> | |
| 70 | + <input type="submit" class="input" name="Next" value="Next" /> | |
| 72 | 71 | <?php } else { ?> |
| 73 | - <input type="button" name="Next" value="Next" onclick="javascript:{w.showStep(1, 'n');}"/> | |
| 72 | + <input type="button" class="input" name="Next" value="Next" onclick="javascript:{w.showStep(1, 'n');}"/> | |
| 74 | 73 | <?php } ?> |
| 75 | - </div> | |
| 76 | 74 | </div> |
| 77 | 75 | |
| 78 | 76 | <!-- STEP 2 of the database configuration - Admin user password settings --> |
| ... | ... | @@ -99,10 +97,8 @@ An administrative user is required for creating tables within the database. |
| 99 | 97 | </tr> |
| 100 | 98 | </table> |
| 101 | 99 | |
| 102 | - <div class="buttons"> | |
| 103 | - <input type="button" name="Previous" value="Previous" onclick="javascript:{w.showStep(2, 'p');}"/> | |
| 104 | - <input type="button" name="Next" value="Next" onclick="javascript:{w.showStep(2, 'n');}"/> | |
| 105 | - </div> | |
| 100 | + <input type="button" name="Previous" class="back" value="Previous" onclick="javascript:{w.showStep(2, 'p');}"/> | |
| 101 | + <input type="button" name="Next" class="input" value="Next" onclick="javascript:{w.showStep(2, 'n');}"/> | |
| 106 | 102 | </div> |
| 107 | 103 | |
| 108 | 104 | <!-- STEP 3 of the database configuration - default user password settings --> |
| ... | ... | @@ -129,10 +125,7 @@ An second user is required for normal database interaction, the reading and writ |
| 129 | 125 | <td id="error_4_3" class="error" style="display:none">Passwords Do Not Match</td> |
| 130 | 126 | </tr> |
| 131 | 127 | </table> |
| 132 | - <div class="buttons"> | |
| 133 | - <input type="button" name="Previous" value="previous" onclick="javascript:{w.showStep(3, 'p');}"/> | |
| 134 | -<!-- <input type="button" name="Next" value="next" onclick="showStep(3, 'n');"/>--> | |
| 135 | - <input type="submit" name="Next" value="next" /> | |
| 136 | - </div> | |
| 128 | + <input type="button" name="Previous" value="previous" onclick="javascript:{w.showStep(3, 'p');}" class="back"/> | |
| 129 | + <input type="submit" name="Next" value="next" class="input"/> | |
| 137 | 130 | </div> |
| 138 | 131 | </form> |
| 139 | 132 | \ No newline at end of file | ... | ... |
setup/wizard/templates/database_confirm.tpl
| 1 | -<h1>Confirming Database Configurations</h1> | |
| 2 | - | |
| 3 | -<div class="description"> | |
| 4 | -Please confirm whether KnowledgeTree has correctly determined your database settings before proceeding. | |
| 5 | -</div> | |
| 6 | -<!--<div id="section">--> | |
| 7 | - | |
| 8 | 1 | <form action="index.php?step_name=<?php echo $step_name; ?>" method="post"> |
| 9 | -<h3><b>Database Settings</b></h3> | |
| 10 | -<table width="33%" class="dbconf"> | |
| 11 | -<?php | |
| 12 | -if($dtypes) { | |
| 13 | - $type = ''; | |
| 14 | - foreach($dtypes as $k=>$v) { | |
| 15 | - $type = (!$k) ? $v : $type; | |
| 16 | - } | |
| 17 | - ?> | |
| 18 | - <tr> | |
| 19 | - <td>Database type: </td> | |
| 20 | - <td><?php echo $type; ?></td> | |
| 21 | - </tr> | |
| 22 | -<?php } ?> | |
| 23 | - <tr> | |
| 24 | - <td>Name: </td> | |
| 25 | - <td><?php echo $dname; ?></td> | |
| 26 | - </tr> | |
| 27 | - <tr> | |
| 28 | - <td>Root Username: </td> | |
| 29 | - <td><?php echo $duname; ?></td> | |
| 30 | - </tr> | |
| 31 | - <tr> | |
| 32 | - <td>Root Password: </td> | |
| 33 | - <td><?php echo $dpassword; ?></td> | |
| 34 | - </tr> | |
| 35 | - <?php if($ddrop) { ?> | |
| 36 | - <tr> | |
| 37 | - <td colspan="2"><b>You are about to drop the database if it exists </b></td> | |
| 38 | - </tr> | |
| 39 | - <?php } ?> | |
| 40 | -</table> | |
| 41 | -<!--</div>--> | |
| 42 | -<h3><b>Advanced Settings</b></h3> | |
| 43 | - | |
| 44 | -<table width="35%" class="dbconf"> | |
| 45 | - <tr> | |
| 46 | - <td>Host: </td> | |
| 47 | - <td><?php echo $dhost; ?></td> | |
| 48 | - </tr> | |
| 49 | - <tr> | |
| 50 | - <td>Port: </td> | |
| 51 | - <td><?php echo $dport; ?></td> | |
| 52 | - </tr> | |
| 53 | - <tr> | |
| 54 | - <td>Mysql Binary: </td> | |
| 55 | - <td><?php echo $dbbinary; ?></td> | |
| 56 | - </tr> | |
| 57 | - <?php if (!$silent) { ?> | |
| 58 | - <tr> | |
| 59 | - <td><b>Table Prefix: </td> | |
| 60 | - <td><?php echo $tprefix; ?></td> | |
| 61 | - </tr> | |
| 62 | -<?php } ?> | |
| 63 | -</table> | |
| 64 | - | |
| 65 | -<h3><b>Database Users</b></h3> | |
| 66 | - | |
| 67 | -<table width="35%" class="dbconf"> | |
| 68 | - <?php //if (!$silent) { ?> | |
| 69 | - <tr> | |
| 70 | - <td>DMS Admin Username: </td> | |
| 71 | - <td><?php echo $dmsname; ?></td> | |
| 72 | - </tr> | |
| 73 | - <?php //} ?> | |
| 74 | - <tr> | |
| 75 | - <td>DMS Admin Password: </td> | |
| 76 | - <td><?php echo $dmspassword; ?></td> | |
| 77 | - </tr> | |
| 78 | - <?php //if (!$silent) { ?> | |
| 79 | - <tr> | |
| 80 | - <td>DMS User Username: </td> | |
| 81 | - <td><?php echo $dmsusername; ?></td> | |
| 82 | - </tr> | |
| 83 | - <?php //} ?> | |
| 84 | - <tr> | |
| 85 | - <td>DMS User Password: </td> | |
| 86 | - <td><?php echo $dmsuserpassword; ?></td> | |
| 87 | - </tr> | |
| 88 | -</table> | |
| 2 | +<p class="title">Confirming Database Configurations</p> | |
| 89 | 3 | |
| 90 | -<div class="buttons"> | |
| 91 | - <input type="submit" name="Edit" value="Edit"/> | |
| 92 | - <input type="submit" name="Confirm" value="Confirm"/> | |
| 93 | -</div> | |
| 4 | + <div class="description"> | |
| 5 | + Please confirm whether KnowledgeTree has correctly determined your database settings before proceeding. | |
| 6 | + </div> | |
| 7 | + <div id="step_content_database_confirm"> | |
| 8 | + <h3><b>Database Settings</b></h3> | |
| 9 | + <table class="dbconf"> | |
| 10 | + <?php | |
| 11 | + if($dtypes) { | |
| 12 | + $type = ''; | |
| 13 | + foreach($dtypes as $k=>$v) { | |
| 14 | + $type = (!$k) ? $v : $type; | |
| 15 | + } | |
| 16 | + ?> | |
| 17 | + <tr> | |
| 18 | + <td width="160px">Database Type: </td> | |
| 19 | + <td width="150px"> <div id="tooltips" title="Type of database being used."> </div> </td> | |
| 20 | + <td><?php echo $type; ?></td> | |
| 21 | + </tr> | |
| 22 | + <?php } ?> | |
| 23 | + <tr> | |
| 24 | + <td>Database Name: </td> | |
| 25 | + <td> <div id="tooltips" title="Name of the database being created."> </div> </td> | |
| 26 | + <td><?php echo $dname; ?></td> | |
| 27 | + </tr> | |
| 28 | + <tr> | |
| 29 | + <td>Root Username: </td> | |
| 30 | + <td> <div id="tooltips" title="Root user name of the database."> </div> </td> | |
| 31 | + <td><?php echo $duname; ?></td> | |
| 32 | + </tr> | |
| 33 | + <tr> | |
| 34 | + <td>Root Password: </td> | |
| 35 | + <td> <div id="tooltips" title="Root user password of the database"> </div> </td> | |
| 36 | + <td><?php echo $dpassword; ?></td> | |
| 37 | + </tr> | |
| 38 | + <?php if($ddrop) { ?> | |
| 39 | + <tr> | |
| 40 | + <td colspan="2"><b>You are about to drop the database if it exists </b></td> | |
| 41 | + </tr> | |
| 42 | + <?php } ?> | |
| 43 | + </table> | |
| 44 | + <!--</div>--> | |
| 45 | + <h3><b>Advanced Settings</b></h3> | |
| 46 | + | |
| 47 | + <table class="dbconf"> | |
| 48 | + <tr> | |
| 49 | + <td width="160px">Host: </td> | |
| 50 | + <td width="150px"> <div id="tooltips" title="The address of the server where the database is located"> </div> </td> | |
| 51 | + <td><?php echo $dhost; ?></td> | |
| 52 | + </tr> | |
| 53 | + <tr> | |
| 54 | + <td>Port: </td> | |
| 55 | + <td> <div id="tooltips" title="The port on which your database server is listening"> </div> </td> | |
| 56 | + <td><?php echo $dport; ?></td> | |
| 57 | + </tr> | |
| 58 | + <tr> | |
| 59 | + <td>Mysql Binary: </td> | |
| 60 | + <td> <div id="tooltips" title="The path to the database binary"> </div> </td> | |
| 61 | + <td><?php echo $dbbinary; ?></td> | |
| 62 | + </tr> | |
| 63 | + <?php if (!$silent) { ?> | |
| 64 | + <tr> | |
| 65 | + <td><b>Table Prefix: </td> | |
| 66 | + <td> <div id="tooltips" title="If needed, a prefix to the database name."> </div> </td> | |
| 67 | + <td><?php echo $tprefix; ?></td> | |
| 68 | + </tr> | |
| 69 | + <?php } ?> | |
| 70 | + </table> | |
| 71 | + | |
| 72 | + <h3><b>Database Users</b></h3> | |
| 73 | + | |
| 74 | + <table class="dbconf"> | |
| 75 | + <?php //if (!$silent) { ?> | |
| 76 | + <tr> | |
| 77 | + <td width="160px">DMS Admin Username: </td> | |
| 78 | + <td width="150px"> <div id="tooltips" title="Database Administrative User for KnowledgeTree System"> </div> </td> | |
| 79 | + <td><?php echo $dmsname; ?></td> | |
| 80 | + </tr> | |
| 81 | + <?php //} ?> | |
| 82 | + <tr> | |
| 83 | + <td>DMS Admin Password: </td> | |
| 84 | + <td> <div id="tooltips" title="Database Administrative User password"> </div> </td> | |
| 85 | + <td><?php echo $dmspassword; ?></td> | |
| 86 | + </tr> | |
| 87 | + <?php //if (!$silent) { ?> | |
| 88 | + <tr> | |
| 89 | + <td>DMS User Username: </td> | |
| 90 | + <td> <div id="tooltips" title="Database User for KnowledgeTree System"> </div> </td> | |
| 91 | + <td><?php echo $dmsusername; ?></td> | |
| 92 | + </tr> | |
| 93 | + <?php //} ?> | |
| 94 | + <tr> | |
| 95 | + <td>DMS User Password: </td> | |
| 96 | + <td> <div id="tooltips" title="Database User password"> </div> </td> | |
| 97 | + <td><?php echo $dmsuserpassword; ?></td> | |
| 98 | + </tr> | |
| 99 | + </table> | |
| 100 | + </div> | |
| 101 | + <input type="submit" name="Edit" value="Edit" class="back"/> | |
| 102 | + <input type="submit" name="Confirm" value="Confirm" class="input"/> | |
| 94 | 103 | </form> |
| 95 | 104 | \ No newline at end of file | ... | ... |
setup/wizard/templates/dependencies.tpl
| 1 | -<h1>Checking PHP Dependencies</h1> | |
| 2 | - | |
| 3 | -<p class="description"> | |
| 4 | -The wizard will review your system to determine whether you have the right PHP components in place to run KnowledgeTree. <br/> | |
| 5 | -Once the scan is completed, you’ll see whether your system has met the requirements or whether there are areas you need to address. | |
| 6 | -</p> | |
| 7 | - | |
| 8 | -<div class="continue_message"> | |
| 9 | -<?php | |
| 10 | - if(!$errors && $warnings) { | |
| 11 | - ?> | |
| 12 | - Congratulations! Your system is ready to run KnowledgeTree. Click Next to continue. | |
| 13 | - <?php | |
| 14 | - } | |
| 15 | -?> | |
| 16 | -</div> | |
| 17 | - | |
| 18 | -<div class="error_message"> | |
| 19 | -<?php if($errors) { ?> | |
| 20 | - <span class='cross'> Your system is not quite ready to run KnowledgeTree. See the list below to determine which areas you need to address. <br/> Once you’ve fixed these items, return to this wizard and try again.</span><br/> | |
| 21 | -<?php } elseif ($warnings) { ?> | |
| 22 | - <span class='cross_orange'> KnowledgeTree Optional Dependencies not met, but you will be able to continue.</span><br/> | |
| 23 | -<?php } ?> | |
| 24 | - | |
| 25 | -<?php | |
| 26 | - if($errors || $warnings) { | |
| 27 | - ?> | |
| 28 | - <a href="http://wiki.knowledgetree.com/Web_Based_Installer#PHP_Dependencies" target="_blank">Click here for help on overcoming dependency issues</a> | |
| 29 | -<?php } ?> | |
| 30 | -</div> | |
| 31 | - | |
| 32 | -<h3><?php echo "<span class='{$php}'> </span>"; ?>PHP Version Check</h3> | |
| 33 | -<?php if($silent) { ?> | |
| 34 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('php_details');}">Show Details</div> | |
| 35 | - <div class="php_details" style="display:none"> | |
| 36 | -<?php } ?> | |
| 37 | -<p class="description"> | |
| 38 | -Your version of PHP must be between 5.0 and 5.3.2 to run optimally. Versions higher than 5.3.2 are not recommended. | |
| 39 | -</p> | |
| 40 | -<?php echo "<span class='{$version['class']}'> </span>{$version['version']}"; ?> | |
| 41 | -<?php if($silent) { ?> | |
| 42 | - </div> | |
| 43 | -<?php } ?> | |
| 44 | -<br /> | |
| 45 | -<h3><?php echo "<span class='{$php_ext}'> </span>"; ?>PHP Extensions</h3> | |
| 46 | -<?php | |
| 47 | -if($silent) { ?> | |
| 48 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('php_ext_details');}">Show Details</div> | |
| 49 | - <div class="php_ext_details" style="display:none"> | |
| 50 | -<?php } ?> | |
| 51 | -<p class="description"> | |
| 52 | -The extensions shown in red below are required for KnowledgeTree to run optimally. Items shown in yellow are optional, but recommended. | |
| 53 | -</p> | |
| 54 | -<table> | |
| 55 | -<?php | |
| 56 | - foreach($extensions as $ext) { | |
| 57 | - ?> | |
| 58 | -<!-- $row = '<tr>';--> | |
| 59 | - <tr> | |
| 1 | +<form action="index.php?step_name=dependencies" method="post"> | |
| 2 | + <p class="title">Checking PHP Dependencies</p> | |
| 3 | + | |
| 4 | + <p class="description"> | |
| 5 | + The wizard will review your system to determine whether you have the right PHP components in place to run KnowledgeTree. <br/> | |
| 6 | + Once the scan is completed, you’ll see whether your system has met the requirements or whether there are areas you need to address. | |
| 7 | + </p> | |
| 8 | + | |
| 9 | + <div class="continue_message"> | |
| 60 | 10 | <?php |
| 61 | - switch($ext['available']){ | |
| 62 | - case 'yes': | |
| 63 | - $class = 'tick'; | |
| 64 | - break; | |
| 65 | - case 'optional': | |
| 66 | - $class = 'cross_orange'; | |
| 67 | - break; | |
| 68 | - case 'no': | |
| 69 | - default: | |
| 70 | - $class = 'cross'; | |
| 71 | - } | |
| 11 | + if(!$errors && $warnings) { | |
| 12 | + ?> | |
| 13 | + Congratulations! Your system is ready to run KnowledgeTree. Click Next to continue. | |
| 14 | + <?php | |
| 15 | + } | |
| 72 | 16 | ?> |
| 73 | - <td><div class='<?php echo $class; ?>'></div></td> | |
| 74 | - <td><?php echo $ext['name']; ?></td> | |
| 75 | - <?php echo ($ext['available'] != 'yes') ? "<td>{$ext['details']}</td>" : '<td></td>'; ?> | |
| 76 | - <?php echo isset($errors[$ext['extension']]) ? "<td><span class='error'>{$errors[$ext['extension']]}</span></td>" : '<td></td>'; ?> | |
| 77 | - <?php | |
| 78 | - if ($class == 'orange' || $class == 'cross') { | |
| 79 | - ?> | |
| 80 | - <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> | |
| 81 | - <?php | |
| 82 | - } | |
| 83 | - ?> | |
| 84 | - <?php | |
| 85 | - } | |
| 86 | -?> | |
| 87 | -</table> | |
| 88 | -<?php if($silent) { ?> | |
| 89 | 17 | </div> |
| 90 | -<?php } ?> | |
| 91 | -<br /> | |
| 92 | -<h3><?php echo "<span class='{$php_con}'> </span>"; ?>PHP Configuration</h3> | |
| 93 | -<?php | |
| 94 | -if($silent) { ?> | |
| 95 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('php_con_details');}">Show Details</div> | |
| 96 | - <div class="php_con_details" style="display:none"> | |
| 97 | -<?php } ?> | |
| 98 | -<p class="description"> | |
| 99 | -The configurations shown in red below are required for KnowledgeTree to run optimally. Items shown in yellow are optional, but recommended. | |
| 100 | -</p> | |
| 101 | -<table> | |
| 102 | -<tr> | |
| 103 | - <th>Setting</th> | |
| 104 | - <th>Recommended value</th> | |
| 105 | - <th>Current value</th> | |
| 106 | -</tr> | |
| 107 | -<?php | |
| 108 | - foreach($configurations as $config) { | |
| 109 | - ?> | |
| 110 | - <tr> | |
| 111 | - <td><?php echo $config['name']; ?></td> | |
| 112 | - <td><?php echo $config['recommended']; ?></td> | |
| 113 | - <td class="<?php echo $config['class']; ?>"><?php echo $config['name']; ?></td> | |
| 114 | - <?php | |
| 115 | - if ($config['class'] == 'orange' || $config['class'] == 'cross') { | |
| 116 | - ?> | |
| 117 | - <td><a href="javascript:this.location.reload();">Refresh</a></td> | |
| 118 | - <?php | |
| 119 | - } | |
| 120 | - ?> | |
| 121 | - </tr> | |
| 18 | + <div class="error_message"> | |
| 19 | + <?php if($errors) { ?> | |
| 20 | + <span class='cross'> 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.</span><br/> | |
| 21 | + <?php } elseif ($warnings) { ?> | |
| 22 | + <span class='cross_orange'> KnowledgeTree Optional Dependencies are not met, but you will be able to continue.</span><br/> | |
| 23 | + <?php } ?> | |
| 24 | + | |
| 25 | + <?php | |
| 26 | + if($errors || $warnings) { | |
| 27 | + ?> | |
| 28 | + <a href="http://wiki.knowledgetree.com/Web_Based_Installer#PHP_Dependencies" target="_blank">Click here for help on overcoming dependency issues</a> | |
| 29 | + <?php } ?> | |
| 30 | + </div> | |
| 31 | + <div id="step_content_dependencies"> | |
| 32 | + <h3><?php echo "<span class='{$php}'> </span>"; ?>PHP Version Check</h3> | |
| 33 | + <?php if($silent) { ?> | |
| 34 | + <div id="options" class="onclick" onclick="javascript:{w.toggleClass('php_details');}">Show Details</div> | |
| 35 | + <div class="php_details" style="display:none"> | |
| 36 | + <?php } ?> | |
| 37 | + <p class="description"> | |
| 38 | + Your version of PHP must be between 5.0 and 5.3.2 to run optimally. Versions higher than 5.3.2 are not recommended. | |
| 39 | + </p> | |
| 40 | + <?php echo "<span class='{$version['class']}'> </span>{$version['version']}"; ?> | |
| 41 | + <?php if($version['class'] != 'tick') { ?> | |
| 42 | + <a href="javascript:this.location.reload();" class="refresh">Refresh</a> | |
| 43 | + <?php } ?> | |
| 44 | + <?php if($silent) { ?> | |
| 45 | + </div> | |
| 46 | + <?php } ?> | |
| 47 | + <br /> | |
| 48 | + <h3><?php echo "<span class='{$php_ext}'> </span>"; ?>PHP Extensions</h3> | |
| 122 | 49 | <?php |
| 123 | - } | |
| 124 | -?> | |
| 125 | -</table> | |
| 126 | -<br/> | |
| 127 | -B = Bytes, K = Kilobytes, M = Megabytes, G = Gigabytes | |
| 128 | -<?php if($silent) { ?> | |
| 50 | + if($silent) { ?> | |
| 51 | + <div id="options" class="onclick" onclick="javascript:{w.toggleClass('php_ext_details');}">Show Details</div> | |
| 52 | + <div class="php_ext_details" style="display:none"> | |
| 53 | + <?php } ?> | |
| 54 | + <p class="description"> | |
| 55 | + The extensions shown in red below are required for KnowledgeTree to run optimally. <br/>Items shown in yellow are optional, but recommended. | |
| 56 | + </p> | |
| 57 | + <table class="description"> | |
| 58 | + <?php | |
| 59 | + foreach($extensions as $ext) { | |
| 60 | + ?> | |
| 61 | + <tr> | |
| 62 | + <?php | |
| 63 | + switch($ext['available']){ | |
| 64 | + case 'yes': | |
| 65 | + $class = 'tick'; | |
| 66 | + break; | |
| 67 | + case 'optional': | |
| 68 | + $class = 'cross_orange'; | |
| 69 | + break; | |
| 70 | + case 'no': | |
| 71 | + default: | |
| 72 | + $class = 'cross'; | |
| 73 | + } | |
| 74 | + ?> | |
| 75 | + <td class="ext_indicator"><div class='<?php echo $class; ?>'></div></td> | |
| 76 | + <td class="ext_name"><?php echo $ext['name']; ?></td> | |
| 77 | + <?php echo ($ext['available'] != 'yes') ? "<td class='ext_description'>{$ext['details']}</td>" : '<td></td>'; ?> | |
| 78 | + <?php echo isset($errors[$ext['extension']]) ? "<td class='ext_error'><span class='error'>{$errors[$ext['extension']]}</span></td>" : '<td></td>'; ?> | |
| 79 | + <?php | |
| 80 | + if ($class == 'orange' || $class == 'cross') { | |
| 81 | + ?> | |
| 82 | + <td class="ext_refresh"><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> | |
| 83 | + <?php | |
| 84 | + } | |
| 85 | + ?> | |
| 86 | + <?php | |
| 87 | + } | |
| 88 | + ?> | |
| 89 | + </table> | |
| 90 | + <?php if($silent) { ?> | |
| 91 | + </div> | |
| 92 | + <?php } ?> | |
| 93 | + <br /> | |
| 94 | + <h3><?php echo "<span class='{$php_con}'> </span>"; ?>PHP Configuration</h3> | |
| 95 | + <?php | |
| 96 | + if($silent) { ?> | |
| 97 | + <div id="options" class="onclick" onclick="javascript:{w.toggleClass('php_con_details');}">Show Details</div> | |
| 98 | + <div class="php_con_details" style="display:none"> | |
| 99 | + <?php } ?> | |
| 100 | + <p class="description"> | |
| 101 | + The configurations shown in red below are required for KnowledgeTree to run optimally. Items shown in yellow are optional, but recommended. | |
| 102 | + </p> | |
| 103 | + <table class="description"> | |
| 104 | + <tr> | |
| 105 | + <th>Setting</th> | |
| 106 | + <th>Recommended value</th> | |
| 107 | + <th>Current value</th> | |
| 108 | + </tr> | |
| 109 | + <?php | |
| 110 | + foreach($configurations as $config) { | |
| 111 | + ?> | |
| 112 | + <tr> | |
| 113 | + <td class="dir_name"><?php echo $config['name']; ?></td> | |
| 114 | + <td class="dir_description"><?php echo $config['recommended']; ?></td> | |
| 115 | + <td class="<?php echo $config['class']; ?>"><?php echo $config['name']; ?></td> | |
| 116 | + <?php | |
| 117 | + if ($config['class'] == 'orange' || $config['class'] == 'cross') { | |
| 118 | + ?> | |
| 119 | + <td class="ext_refresh"><a href="javascript:this.location.reload();">Refresh</a></td> | |
| 120 | + <?php | |
| 121 | + } | |
| 122 | + ?> | |
| 123 | + </tr> | |
| 124 | + <?php | |
| 125 | + } | |
| 126 | + ?> | |
| 127 | + </table> | |
| 128 | + <br/> | |
| 129 | + B = Bytes, K = Kilobytes, M = Megabytes, G = Gigabytes | |
| 130 | + <?php if($silent) { ?> | |
| 131 | + </div> | |
| 132 | + <?php } ?> | |
| 129 | 133 | </div> |
| 130 | -<?php } ?> | |
| 131 | -<form action="index.php?step_name=dependencies" method="post"> | |
| 132 | -<div class="buttons"> | |
| 133 | - <input type="submit" name="Previous" value="Back"/> | |
| 134 | - <input type="submit" name="Next" value="Next"/> | |
| 135 | -</div> | |
| 134 | + <input type="submit" class="back" name="Previous" value="Back"/> | |
| 135 | + <input type="submit" class="input" name="Next" value="Next"/> | |
| 136 | 136 | </form> |
| 137 | 137 | \ No newline at end of file | ... | ... |
setup/wizard/templates/error.tpl
| 1 | 1 | <head> |
| 2 | - <title>KnowledgeTree Installer</title> | |
| 3 | - <script type="text/javascript" src="resources/wizard.js"></script> | |
| 4 | - <link rel="stylesheet" type="text/css" href="resources/wizard.css"> | |
| 2 | + <title>KnowledgeTree Installer</title> | |
| 3 | + <script type="text/javascript" src="resources/wizard.js"></script> | |
| 4 | + <link rel="stylesheet" type="text/css" href="resources/wizard.css"> | |
| 5 | 5 | </head><body onload="w.doFormCheck();"> |
| 6 | 6 | <div id="outer-wrapper"> |
| 7 | 7 | <div id="header"> |
| 8 | 8 | <div class="logo"></div> |
| 9 | 9 | </div> |
| 10 | - | |
| 11 | 10 | <div id="wrapper"> |
| 12 | 11 | <div id="container"> |
| 13 | 12 | <div id="content"> |
| 14 | - <h1>Welcome to the KnowledgeTree Setup Wizard</h1> | |
| 15 | - | |
| 16 | -<div style="width: 800px;"> | |
| 17 | -<?php if(isset($error)) echo '';echo "<div class='error'>".$error."</div>"; ?> | |
| 18 | -<?php | |
| 19 | -if(isset($errors)) { | |
| 20 | - if($errors){ | |
| 21 | - echo '<div class="error">'; | |
| 22 | - foreach ($errors as $msg){ | |
| 23 | - echo $msg . "<br />\n"; | |
| 24 | - } | |
| 25 | - echo '</div>'; | |
| 26 | - } | |
| 27 | -} | |
| 28 | -?> | |
| 29 | -</div> | |
| 30 | - | |
| 31 | -<form action="index.php?step_name=welcome" method="post"> | |
| 32 | -<div class="buttons"> | |
| 33 | -</div> | |
| 34 | -</form> </div> | |
| 35 | - </div> | |
| 36 | - | |
| 13 | + <form action="index.php?step_name=welcome" method="post"> | |
| 14 | + <p class="title">Welcome to the KnowledgeTree Setup Wizard</p> | |
| 15 | + <div style="width: 800px;"> | |
| 16 | + <?php if(isset($error)) echo '';echo "<div class='error'>".$error."</div>"; ?> | |
| 17 | + <?php | |
| 18 | + if(isset($errors)) { | |
| 19 | + if($errors){ | |
| 20 | + echo '<div class="error">'; | |
| 21 | + foreach ($errors as $msg){ | |
| 22 | + echo $msg . "<br />\n"; | |
| 23 | + } | |
| 24 | + echo '</div>'; | |
| 25 | + } | |
| 26 | + } | |
| 27 | + ?> | |
| 28 | + </div> | |
| 29 | + </form> | |
| 30 | + </div> | |
| 31 | + </div> | |
| 37 | 32 | <div id="sidebar"> |
| 38 | - <div class="menu"><span class="active">Welcome</span><br><span class="inactive">License Agreement</span><br><span class="inactive">PHP Dependencies</span><br><span class="inactive">System Configuration</span><br><span class="inactive">Service Dependencies</span><br><span class="inactive">Database Configuration</span><br><span class="inactive">Registration</span><br><span class="inactive">Install</span><br><span class="inactive">Complete</span><br></div> </div> | |
| 33 | + <div class="menu"> | |
| 34 | + <span class="active">Welcome</span><br> | |
| 35 | + <span class="inactive">License Agreement</span><br> | |
| 36 | + <span class="inactive">PHP Dependencies</span><br> | |
| 37 | + <span class="inactive">System Configuration</span><br> | |
| 38 | + <span class="inactive">Service Dependencies</span><br> | |
| 39 | + <span class="inactive">Database Configuration</span><br> | |
| 40 | + <span class="inactive">Registration</span><br> | |
| 41 | + <span class="inactive">Install</span><br> | |
| 42 | + <span class="inactive">Complete</span><br> | |
| 43 | + </div> | |
| 44 | + </div> | |
| 39 | 45 | <div class="clearing"> </div> |
| 40 | 46 | </div> |
| 41 | - | |
| 42 | 47 | <div id="footer"> |
| 43 | 48 | <div class="powered-by"></div> |
| 44 | 49 | </div> | ... | ... |
setup/wizard/templates/errors.tpl
setup/wizard/templates/install.tpl
| 1 | -<h1>Finalizing System Installation</h1> | |
| 2 | - | |
| 3 | -<p class="description"> | |
| 4 | -The wizard will now complete the installation and run a final check on the system. | |
| 5 | -</p> | |
| 6 | - | |
| 7 | 1 | <form action="index.php?step_name=install" method="post"> |
| 8 | - <div class="buttons"> | |
| 9 | - <input type="submit" name="Previous" value="Previous"/> | |
| 10 | - <input type="submit" name="Install" value="Install"/> | |
| 11 | - </div> | |
| 2 | + <p class="title">Finalizing System Installation</p> | |
| 3 | + | |
| 4 | + <div id="step_content"> | |
| 5 | + The wizard will now complete the installation and run a final check on the system. | |
| 6 | + </div> | |
| 7 | + <input type="submit" name="Previous" value="Previous" class="back"/> | |
| 8 | + <input type="submit" name="Install" value="Install" class="input"/> | |
| 12 | 9 | </form> |
| 13 | 10 | \ No newline at end of file | ... | ... |
setup/wizard/templates/registration.tpl
| 1 | -<form action="index.php?step_name=registration" method="post"> | |
| 2 | -<h1>Registering KnowledgeTree</h1> | |
| 3 | - | |
| 4 | -<p> | |
| 5 | -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. | |
| 6 | -<a href="index.php?step_name=install">Skip Registration</a> | |
| 7 | -</p> | |
| 8 | - | |
| 9 | -<p class='disclaimer'> | |
| 10 | -We will not share your information with 3rd-parties, nor will we send you information not directly related to KnowledgeTree's products | |
| 11 | -and services. Please see our <a href="http://www.knowledgetree.com/about/legal" target="_blank">Privacy and Data Retention policies</a> for more information. | |
| 12 | -</p> | |
| 13 | - | |
| 14 | -<p> | |
| 15 | - | |
| 16 | -<table> | |
| 17 | - <tr> | |
| 18 | - <td><label for='first'>First Name</label></td> | |
| 19 | - <td rowspan='6' width='5%'> </td> | |
| 20 | - <td><input name='submitted[first_name]' id='first' size='37' /></td> | |
| 21 | - <td rowspan='6' width='5%'> </td> | |
| 22 | - <td rowspan='6'> | |
| 23 | - <img src='resources/graphics/dropbox.png' width="100%" height="100%"/> | |
| 24 | - </td> | |
| 25 | - </tr> | |
| 26 | - <tr> | |
| 27 | - <td><label for='last'>Last Name</label></td> | |
| 28 | - <td><input name='submitted[last_name]' id='last' size='37' /></td> | |
| 29 | - </tr> | |
| 30 | - <tr> | |
| 31 | - <td><label for='email'>Email Address</label></td> | |
| 32 | - <td><input name='submitted[email_address]' id='email' size='37' /></td> | |
| 33 | - </tr> | |
| 34 | - <tr> | |
| 35 | - <td><label for='country'>Country</label></td> | |
| 36 | - <td> | |
| 37 | - <select id='country' name='submitted[country]'> | |
| 38 | - <?php | |
| 39 | - $str = ''; | |
| 40 | - foreach ($countries as $code => $country) { | |
| 41 | - $str .= "<option name='{$code}' value='{$country}'>{$country}</option>"; | |
| 42 | - } | |
| 43 | - | |
| 44 | - echo $str; | |
| 45 | - ?> | |
| 46 | - </select> | |
| 47 | - </td> | |
| 48 | - </tr> | |
| 49 | - <tr> | |
| 50 | - <td><label for='industry'>Industry</label></td> | |
| 51 | - <td> | |
| 52 | - <select id='industry' name='submitted[industry]'> | |
| 53 | - <?php | |
| 54 | - $str = ''; | |
| 55 | - foreach ($industries as $code => $industry) { | |
| 56 | - $str .= "<option name='{$code}' value='{$industry}'>{$industry}</option>"; | |
| 57 | - } | |
| 58 | - | |
| 59 | - echo $str; | |
| 60 | - ?> | |
| 61 | - </select> | |
| 62 | - </td> | |
| 63 | - </tr> | |
| 64 | - <tr> | |
| 65 | - <td><label for='size'>Organization Size</label></td> | |
| 66 | - <td> | |
| 67 | - <select id='size' name='submitted[organization_size]'> | |
| 68 | - <?php | |
| 69 | - $str = ''; | |
| 70 | - foreach ($org_size as $code => $size) { | |
| 71 | - $str .= "<option name='{$code}' value='{$size}'>{$size}</option>"; | |
| 72 | - } | |
| 73 | - | |
| 74 | - echo $str; | |
| 75 | - ?> | |
| 76 | - </select> | |
| 77 | - </td> | |
| 78 | - </tr> | |
| 79 | -</table> | |
| 80 | -</p> | |
| 81 | - | |
| 82 | -<input type='hidden' name='form_id' value='webform_client_form_242' /> | |
| 83 | -<input type='hidden' name='op' value='Submit' /> | |
| 84 | - | |
| 85 | - | |
| 86 | -<div class="buttons"> | |
| 87 | - <input type="submit" name="Previous" value="Previous"/> | |
| 88 | - <input type="submit" name="Next" value="Register"/> | |
| 89 | -</div> | |
| 1 | +<form id="registration" action="index.php?step_name=<?php echo $step_name; ?>" method="post" onsubmit="w.validateRegistration();return false;"> | |
| 2 | + <p class="title">Registering KnowledgeTree</p> | |
| 3 | + | |
| 4 | + <p class="description"> | |
| 5 | + 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. | |
| 6 | + <a href="index.php?step_name=install">Skip Registration</a> | |
| 7 | + </p> | |
| 8 | + <!-- Hidden Fields --> | |
| 9 | + <input type="hidden" id="sendAll" name="" value="" /> | |
| 10 | + <input type="hidden" id="state" name="" /> | |
| 11 | + <p class='disclaimer'> | |
| 12 | + We will not share your information with 3rd-parties, nor will we send you information not directly related to KnowledgeTree's products | |
| 13 | + and services. Please see our <a href="http://www.knowledgetree.com/about/legal" target="_blank">Privacy and Data Retention policies</a> for more information. | |
| 14 | + </p> | |
| 15 | + <br/> | |
| 16 | + <div id="step_content_registration"> | |
| 17 | + <span class="error" id="reg_error"></span> | |
| 18 | + <table> | |
| 19 | + <tr> | |
| 20 | + <td><label for='first'>First Name</label></td> | |
| 21 | + <td rowspan='6' width='5%'> </td> | |
| 22 | + <td><input name='submitted[first_name]' id='first' size='37' /></td> | |
| 23 | + <td rowspan='6' width='5%'> </td> | |
| 24 | + <td rowspan='6'> <img src='resources/graphics/dropbox.png'/> </td> | |
| 25 | + </tr> | |
| 26 | + | |
| 27 | + <tr> | |
| 28 | + <td><label for='last'>Last Name</label></td> | |
| 29 | + <td><input name='submitted[last_name]' id='last' size='37' /></td> | |
| 30 | + </tr> | |
| 31 | + <tr> | |
| 32 | + <td><label for='email'>Email Address</label></td> | |
| 33 | + <td><input name='submitted[email_address]' id='email' size='37' /></td> | |
| 34 | + </tr> | |
| 35 | + <tr> | |
| 36 | + <td><label for='country'>Country</label></td> | |
| 37 | + <td> | |
| 38 | + <select id='country' name='submitted[country]'> | |
| 39 | + <?php | |
| 40 | + $str = ''; | |
| 41 | + foreach ($countries as $code => $country) { | |
| 42 | + $str .= "<option name='{$code}' value='{$country}'>{$country}</option>"; | |
| 43 | + } | |
| 44 | + | |
| 45 | + echo $str; | |
| 46 | + ?> | |
| 47 | + </select> | |
| 48 | + </td> | |
| 49 | + </tr> | |
| 50 | + <tr> | |
| 51 | + <td><label for='industry'>Industry</label></td> | |
| 52 | + <td> | |
| 53 | + <select id='industry' name='submitted[industry]'> | |
| 54 | + <?php | |
| 55 | + $str = ''; | |
| 56 | + foreach ($industries as $code => $industry) { | |
| 57 | + $str .= "<option name='{$code}' value='{$industry}'>{$industry}</option>"; | |
| 58 | + } | |
| 59 | + | |
| 60 | + echo $str; | |
| 61 | + ?> | |
| 62 | + </select> | |
| 63 | + </td> | |
| 64 | + </tr> | |
| 65 | + <tr> | |
| 66 | + <td><label for='size'>Organization Size</label></td> | |
| 67 | + <td> | |
| 68 | + <select id='size' name='submitted[organization_size]'> | |
| 69 | + <?php | |
| 70 | + $str = ''; | |
| 71 | + foreach ($org_size as $code => $size) { | |
| 72 | + $str .= "<option name='{$code}' value='{$size}'>{$size}</option>"; | |
| 73 | + } | |
| 74 | + | |
| 75 | + echo $str; | |
| 76 | + ?> | |
| 77 | + </select> | |
| 78 | + </td> | |
| 79 | + </tr> | |
| 80 | + </table> | |
| 81 | + | |
| 82 | + <input type='hidden' name='form_id' value='webform_client_form_242' /> | |
| 83 | + <input type='hidden' name='op' value='Submit' /> | |
| 84 | + </div> | |
| 85 | + | |
| 86 | + <input type="submit" name="Previous" value="Previous" class="back" onclick="w.pClick()"/> | |
| 87 | + <input type="submit" name="Next" value="Register" class="input" onclick="w.nClick()"/> | |
| 90 | 88 | </form> |
| 91 | 89 | \ No newline at end of file | ... | ... |
setup/wizard/templates/registration_confirm.tpl
| 1 | -<h1>Thank you for registering</h1> | |
| 2 | - | |
| 3 | -<p> | |
| 4 | -Thank you for signing up. You'll receive an email from us shortly with download instructions for the KnowledgeTree Drop Box software. | |
| 5 | -</p> | |
| 6 | - | |
| 7 | 1 | <form action="index.php?step_name=registration" method="post"> |
| 8 | - | |
| 9 | -<div class="buttons"> | |
| 10 | - <input type="submit" name="Previous" value="Previous"/> | |
| 11 | - <input type="submit" name="Confirm" value="Next"/> | |
| 12 | -</div> | |
| 2 | + <p class="title">Thank you for registering</p> | |
| 3 | + <div id="step_content_registration_confirm"> | |
| 4 | + Thank you for signing up. You'll receive an email from us shortly with download instructions for the KnowledgeTree Drop Box software. | |
| 5 | + </div> | |
| 6 | + <input type="submit" name="Previous" value="Previous" class="back"/> | |
| 7 | + <input type="submit" name="Confirm" value="Next" class="input"/> | |
| 13 | 8 | </form> |
| 14 | 9 | \ No newline at end of file | ... | ... |
setup/wizard/templates/services.tpl
| 1 | 1 | <form action="index.php?step_name=services" method="post"> |
| 2 | -<h1>Checking Service Dependencies</h1> | |
| 3 | - | |
| 4 | -<p class="description"> | |
| 5 | -The wizard will review your system to determine whether you can run KnowledgeTree background services. <br/>Once the scan is completed, you’ll see whether your system has met the requirements or whether there are areas you need to address. | |
| 6 | -</p> | |
| 7 | - | |
| 8 | -<div class="continue_message"> | |
| 9 | -<?php | |
| 10 | - if(!$errors && !$warnings) { | |
| 2 | + <p class="title">Checking Service Dependencies</p> | |
| 3 | + | |
| 4 | + <p class="description"> | |
| 5 | + The wizard will review your system to determine whether you can run KnowledgeTree background services. <br/>Once the scan is completed, you’ll see whether your system has met the requirements or whether there are areas you need to address. | |
| 6 | + </p> | |
| 7 | + | |
| 8 | + <div class="continue_message"> | |
| 9 | + <?php | |
| 10 | + if(!$errors && !$warnings) { | |
| 11 | + ?> | |
| 12 | + All service dependencies are met. Please click next to continue. | |
| 13 | + <?php | |
| 14 | + } | |
| 15 | + ?> | |
| 16 | + </div> | |
| 17 | + <div class="error_message"> | |
| 18 | + <?php if($errors) { ?> | |
| 19 | + <span class='cross'> 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.</span><br/> | |
| 20 | + <?php } elseif ($warnings) { | |
| 11 | 21 | ?> |
| 12 | - All service dependencies are met. Please click next to continue. | |
| 22 | + <span class='cross_orange'> KnowledgeTree Optional Dependencies not met, but you will be able to continue.</span><br/> | |
| 13 | 23 | <?php |
| 14 | - } | |
| 15 | -?> | |
| 16 | -</div> | |
| 17 | -<div class="error_message"> | |
| 18 | -<?php if($errors) { ?> | |
| 19 | - <span class='cross'> Your system is not quite ready to run KnowledgeTree. See the list below to determine which areas you need to address. <br/> Once you’ve fixed these items, return to this wizard and try again.</span><br/> | |
| 20 | -<?php } elseif ($warnings) { | |
| 21 | - ?> | |
| 22 | - <span class='cross_orange'> KnowledgeTree Optional Dependencies not met, but you will be able to continue.</span><br/> | |
| 24 | + }?> | |
| 23 | 25 | <?php |
| 24 | -}?> | |
| 25 | -<?php | |
| 26 | - if($errors || $warnings) { | |
| 27 | - ?> | |
| 28 | - <a href="http://wiki.knowledgetree.com/Web_Based_Installer#Service_Dependencies" target="_blank">Click here for help on overcoming dependency issues</a> | |
| 29 | -<?php } ?> | |
| 30 | -</div> | |
| 31 | - | |
| 32 | -<?php if(!$alreadyInstalled) { ?> | |
| 33 | - <?php if($javaExeError != '') { ?> | |
| 34 | - Specify the location of your Java executable | |
| 35 | - | |
| 36 | - <input name='java' id='port' size='25' value='<?php echo $java['location']; ?>'/> | |
| 37 | - | |
| 38 | - <?php if($javaExeError != true) { ?><span class="error"><?php echo $javaExeError; ?></span><?php } ?> | |
| 26 | + if($errors || $warnings) { | |
| 27 | + ?> | |
| 28 | + <a href="http://wiki.knowledgetree.com/Web_Based_Installer#Service_Dependencies" target="_blank">Click here for help on overcoming service issues</a> | |
| 39 | 29 | <?php } ?> |
| 40 | - <?php if($phpExeError != '') { ?> | |
| 41 | - <br /> | |
| 42 | - Specify the location of your PHP executable | |
| 43 | - <br /> | |
| 44 | - <?php if($php['location'] == '') { ?> | |
| 45 | - <input name='php' id='port' size='25' value='<?php echo $php['location']; ?>'/> | |
| 30 | + </div> | |
| 31 | + <div id="step_content_configuration" style="width:755px;"> | |
| 32 | + <?php if(!$alreadyInstalled) { ?> | |
| 33 | + <?php if($javaExeError != '') { ?> | |
| 34 | + Specify the location of your Java executable | |
| 35 | + | |
| 36 | + <input name='java' id='port' size='25' value='<?php echo $java['location']; ?>' style="float:none;"/> | |
| 37 | + | |
| 38 | + <?php if($javaExeError != true) { ?><span class="error"><?php echo $javaExeError; ?></span><?php } ?> | |
| 39 | + <?php } ?> | |
| 40 | + <?php if($phpExeError != '') { ?> | |
| 41 | + <br /> | |
| 42 | + Specify the location of your PHP executable | |
| 43 | + <br /> | |
| 44 | + <?php if($php['location'] == '') { ?> | |
| 45 | + <input name='php' id='port' size='25' value='<?php echo $php['location']; ?>'/> | |
| 46 | + <?php } else { ?> | |
| 47 | + <input type="hidden" name='php' id='port' size='25' value='<?php echo $php['location']; ?>'/> | |
| 48 | + <?php } ?> | |
| 49 | + | |
| 50 | + <?php if($phpExeError != true) { ?><span class="error"><?php echo $phpExeError; ?></span><?php } ?> | |
| 51 | + <?php } ?> | |
| 52 | + <?php if($javaExeError != '' || $phpExeError != '') { ?> | |
| 53 | + <input type="submit" name="Refresh" value="Submit" style="float:none;"/> | |
| 54 | + <?php } ?> | |
| 55 | + <h3><?php echo "<span class='{$javaCheck}'> </span>"; ?>Java Check</h3> | |
| 56 | + <?php if($silent) { ?> | |
| 57 | + <div id="options" class="onclick" onclick="javascript:{w.toggleClass('java_details');}">Show Details</div> | |
| 58 | + <div class="java_details" style="display:none"> | |
| 59 | + <?php } ?> | |
| 60 | + <p class="description"> | |
| 61 | + The Java version must be higher than 1.5. | |
| 62 | + </p> | |
| 63 | + <table> | |
| 64 | + <tr> | |
| 65 | + <td> <span class='<?php echo $step_vars['java']['class']; ?>'> </span> </td> | |
| 66 | + <td style="width:645px;"> <?php echo $step_vars['java']['found']; ?> </td> | |
| 67 | + <?php | |
| 68 | + if ($step_vars['java']['class'] != 'tick') { | |
| 69 | + ?> | |
| 70 | + <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> | |
| 71 | + <?php | |
| 72 | + } else { ?> | |
| 73 | + <td> </td> | |
| 74 | + <?php } ?> | |
| 75 | + </tr> | |
| 76 | + <tr> | |
| 77 | + <td> <span class='<?php echo $step_vars['version']['class']; ?>'> </span> </td> | |
| 78 | + <td> <?php echo $step_vars['version']['found']; ?> </td> | |
| 79 | + <?php if ($step_vars['version']['class'] != 'tick') { | |
| 80 | + ?> | |
| 81 | + <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> | |
| 82 | + <?php | |
| 83 | + } | |
| 84 | + ?> | |
| 85 | + </tr> | |
| 86 | + </table> | |
| 87 | + <?php if($silent) { ?> | |
| 88 | + </div> | |
| 89 | + <?php } ?> | |
| 90 | + <?php if (!$disableExtension) { ?> | |
| 91 | + <h3><?php echo "<span class='{$javaExtCheck}'> </span>"; ?>Java Extensions</h3> | |
| 92 | + <?php if($silent) { ?> | |
| 93 | + <div id="options" class="onclick" onclick="javascript:{w.toggleClass('java_ext_details');}">Show Details</div> | |
| 94 | + <div class="java_ext_details" style="display:none"> | |
| 95 | + <?php } ?> | |
| 96 | + <p class="description"> | |
| 97 | + A PHP Java Bridge is required for KnowledgeTree to perform at an optimal level. | |
| 98 | + </p> | |
| 99 | + <table> | |
| 100 | + <tr> | |
| 101 | + <td> <span class='<?php echo $step_vars['extensions']['class']; ?>'> </span> </td> | |
| 102 | + <td style="width:645px;"> <?php echo $step_vars['extensions']['found']; ?> </td> | |
| 103 | + <?php if ($step_vars['extensions']['class'] != 'tick') { | |
| 104 | + ?> | |
| 105 | + <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> | |
| 106 | + <?php | |
| 107 | + } | |
| 108 | + ?> | |
| 109 | + </tr> | |
| 110 | + </table> | |
| 111 | + <?php //echo "<span class='{$step_vars['extensions']['class']}'> </span>{$step_vars['extensions']['found']}"; ?> | |
| 112 | + <!-- <br />--> | |
| 113 | + <?php if($silent) { ?> | |
| 114 | + </div> | |
| 115 | + <?php } ?> | |
| 116 | + <?php } ?> | |
| 46 | 117 | <?php } else { ?> |
| 47 | - <input type="hidden" name='php' id='port' size='25' value='<?php echo $php['location']; ?>'/> | |
| 118 | + <p class="description"> | |
| 119 | + All services are already installed. | |
| 120 | + </p> | |
| 48 | 121 | <?php } ?> |
| 49 | - | |
| 50 | - <?php if($phpExeError != true) { ?><span class="error"><?php echo $phpExeError; ?></span><?php } ?> | |
| 51 | - <?php } ?> | |
| 52 | - <?php if($javaExeError != '' || $phpExeError != '') { ?> | |
| 53 | - <input type="submit" name="Refresh" value="Submit"/> | |
| 54 | - <?php } ?> | |
| 55 | - <h3><?php echo "<span class='{$javaCheck}'> </span>"; ?>Java Check</h3> | |
| 56 | - <?php if($silent) { ?> | |
| 57 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('java_details');}">Show Details</div> | |
| 58 | - <div class="java_details" style="display:none"> | |
| 59 | - <?php } ?> | |
| 60 | - <p class="description"> | |
| 61 | - The Java version must be higher than 1.5. | |
| 62 | - </p> | |
| 63 | - <table> | |
| 64 | - <tr> | |
| 65 | - <td> <span class='<?php echo $step_vars['java']['class']; ?>'> </span> </td> | |
| 66 | - <td> <?php echo $step_vars['java']['found']; ?> </td> | |
| 67 | - <?php if ($step_vars['java']['class'] != 'tick') { | |
| 68 | - ?> | |
| 69 | - <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> | |
| 70 | - <?php | |
| 71 | - } | |
| 72 | - ?> | |
| 73 | - </tr> | |
| 74 | - <tr> | |
| 75 | - <td> <span class='<?php echo $step_vars['version']['class']; ?>'> </span> </td> | |
| 76 | - <td> <?php echo $step_vars['version']['found']; ?> </td> | |
| 77 | - <?php if ($step_vars['version']['class'] != 'tick') { | |
| 78 | - ?> | |
| 79 | - <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> | |
| 80 | - <?php | |
| 81 | - } | |
| 82 | - ?> | |
| 83 | - </tr> | |
| 84 | - </table> | |
| 85 | - <?php if($silent) { ?> | |
| 86 | - </div> | |
| 87 | - <?php } ?> | |
| 88 | - <?php if (!$disableExtension) { ?> | |
| 89 | - <h3><?php echo "<span class='{$javaExtCheck}'> </span>"; ?>Java Extensions</h3> | |
| 122 | + <h3><?php echo "<span class='{$serviceCheck}'> </span>"; ?>Services Check</h3> | |
| 90 | 123 | <?php if($silent) { ?> |
| 91 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('java_ext_details');}">Show Details</div> | |
| 92 | - <div class="java_ext_details" style="display:none"> | |
| 124 | + <div id="options" class="onclick" onclick="javascript:{w.toggleClass('service_details');}">Show Details</div> | |
| 125 | + <div class="service_details" style="display:none"> | |
| 93 | 126 | <?php } ?> |
| 94 | 127 | <p class="description"> |
| 95 | - A PHP Java Bridge is required for KnowledgeTree to perform at an optimal level. | |
| 128 | + Preload Services if posibble. | |
| 96 | 129 | </p> |
| 97 | 130 | <table> |
| 98 | - <tr> | |
| 99 | - <td> <span class='<?php echo $step_vars['extensions']['class']; ?>'> </span> </td> | |
| 100 | - <td> <?php echo $step_vars['extensions']['found']; ?> </td> | |
| 101 | - <?php if ($step_vars['extensions']['class'] != 'tick') { | |
| 102 | - ?> | |
| 103 | - <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> | |
| 104 | - <?php | |
| 105 | - } | |
| 106 | - ?> | |
| 107 | - </tr> | |
| 131 | + <?php | |
| 132 | + if($step_vars) { | |
| 133 | + if(isset($step_vars['services'])) { | |
| 134 | + foreach ($step_vars['services'] as $ser){ | |
| 135 | + ?> | |
| 136 | + <tr> | |
| 137 | + <td> <span class='<?php echo $ser['class']; ?>'> </span> </td> | |
| 138 | + <td style="width:645px;"> <?php echo $ser['msg']; ?> </td> | |
| 139 | + <?php if ($ser['class'] != 'tick') { | |
| 140 | + ?> | |
| 141 | + <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> | |
| 142 | + <?php | |
| 143 | + } ?> | |
| 144 | + </tr> | |
| 145 | + <?php | |
| 146 | + } | |
| 147 | + } | |
| 148 | + } | |
| 149 | + ?> | |
| 108 | 150 | </table> |
| 109 | - <?php //echo "<span class='{$step_vars['extensions']['class']}'> </span>{$step_vars['extensions']['found']}"; ?> | |
| 110 | -<!-- <br />--> | |
| 111 | 151 | <?php if($silent) { ?> |
| 112 | 152 | </div> |
| 113 | 153 | <?php } ?> |
| 114 | - <?php } ?> | |
| 115 | -<?php } else { ?> | |
| 116 | - <p class="description"> | |
| 117 | - All services are already installed. | |
| 118 | - </p> | |
| 119 | -<?php } ?> | |
| 120 | -<h3><?php echo "<span class='{$serviceCheck}'> </span>"; ?>Services Check</h3> | |
| 121 | -<?php if($silent) { ?> | |
| 122 | - <div id="options" class="onclick" onclick="javascript:{w.toggleClass('service_details');}">Show Details</div> | |
| 123 | - <div class="service_details" style="display:none"> | |
| 124 | -<?php } ?> | |
| 125 | -<p class="description"> | |
| 126 | -Preload Services if posibble. | |
| 127 | -</p> | |
| 128 | -<table> | |
| 129 | -<?php | |
| 130 | -if($step_vars) { | |
| 131 | - if(isset($step_vars['services'])) { | |
| 132 | - foreach ($step_vars['services'] as $ser){ | |
| 133 | - ?> | |
| 134 | - <tr> | |
| 135 | - <td> <span class='<?php echo $ser['class']; ?>'> </span> </td> | |
| 136 | - <td> <?php echo $ser['msg']; ?> </td> | |
| 137 | - <?php if ($ser['class'] != 'tick') { | |
| 138 | - ?> | |
| 139 | - <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td> | |
| 140 | - <?php | |
| 141 | - } ?> | |
| 142 | - </tr> | |
| 143 | - <?php | |
| 144 | - } | |
| 145 | - } | |
| 146 | -} | |
| 147 | -?> | |
| 148 | -</table> | |
| 149 | -<?php if($silent) { ?> | |
| 150 | 154 | </div> |
| 151 | -<?php } ?> | |
| 152 | -<div class="buttons"> | |
| 153 | - <input type="submit" name="Previous" value="Back"/> | |
| 154 | - <input type="submit" name="Next" value="Next"/> | |
| 155 | -</div> | |
| 155 | + <input type="submit" class="back" name="Previous" value="Back"/> | |
| 156 | + <input type="submit" class="input" name="Next" value="Next"/> | |
| 156 | 157 | </form> |
| 157 | 158 | \ No newline at end of file | ... | ... |
setup/wizard/templates/welcome.tpl
| 1 | 1 | <form action="index.php?step_name=welcome" method="post"> |
| 2 | -<p class="title">Welcome to KnowledgeTree</p> | |
| 3 | - | |
| 4 | -<div id="step_content"> | |
| 5 | -<p> | |
| 6 | -This wizard will lead you through the steps needed to install and configure KnowledgeTree on your server. | |
| 7 | -</p> | |
| 8 | -</div> | |
| 9 | - | |
| 10 | -<!--<div class="buttons" id="buttons_single">--> | |
| 11 | - <input class="next" type="submit" name="Next" value="Next"/> | |
| 12 | -<!--</div>--> | |
| 2 | + <p class="title">Welcome to KnowledgeTree</p> | |
| 3 | + <div id="step_content"> | |
| 4 | + <p> This wizard will lead you through the steps needed to install and configure KnowledgeTree on your server. </p> | |
| 5 | + </div> | |
| 6 | + <input class="next" type="submit" name="Next" value="Next"/> | |
| 13 | 7 | </form> |
| 14 | 8 | \ No newline at end of file | ... | ... |
setup/wizard/templates/wizard.tpl
| ... | ... | @@ -2,22 +2,24 @@ |
| 2 | 2 | <html> |
| 3 | 3 | <head> |
| 4 | 4 | <title>KnowledgeTree Installer</title> |
| 5 | -<!-- <script type="text/javascript" src="resources/jquery-tooltip/lib/jquery.js"></script>--> | |
| 6 | -<!-- <script type="text/javascript" src="resources/jquery-tooltip/lib/jquery.bgiframe.js"></script>--> | |
| 7 | -<!-- <script type="text/javascript" src=".resources/jquery-tooltip/lib/jquery.dimensions.js"></script>--> | |
| 8 | -<!-- <script type="text/javascript" src="resources/jquery-tooltip/lib/jquery.tooltip.js"></script>--> | |
| 5 | + <script type="text/javascript" src="resources/jquery-tooltip/lib/jquery.js"></script> | |
| 9 | 6 | <script type="text/javascript" src="resources/wizard.js" ></script> |
| 10 | 7 | <link rel="stylesheet" type="text/css" href="resources/wizard.css" /> |
| 11 | 8 | |
| 12 | 9 | </head> |
| 13 | 10 | <body onload="w.doFormCheck();"> |
| 14 | 11 | <div id="outer-wrapper"> |
| 15 | - <div id="header"></div> | |
| 16 | - | |
| 12 | + <div id="header"> | |
| 13 | + <div id="logo"><img src="resources/graphics/dame/installer-header_logo.png"/></div> | |
| 14 | + <div id="install_details"> | |
| 15 | + <span style="font-size:120%;"> <?php echo $vars['install_version']; ?> </span><br> | |
| 16 | + <span style="font-size:80%;"><?php echo $vars['install_type']; ?></span> | |
| 17 | + </div> | |
| 18 | + </div> | |
| 17 | 19 | <div id="wrapper"> |
| 18 | 20 | <div id="container"> |
| 19 | 21 | <div id="sidebar"> |
| 20 | - <?php echo $left; ?> | |
| 22 | + <?php echo $vars['left']; ?> | |
| 21 | 23 | </div> |
| 22 | 24 | <div id="content"> |
| 23 | 25 | <div id="content_container"> | ... | ... |
tests/ktcmis/testCmisApi.php
| ... | ... | @@ -3,7 +3,10 @@ |
| 3 | 3 | // TODO use CMISUtil::encodeObjectId to create testing ids, as we may change how the encoding works in future |
| 4 | 4 | |
| 5 | 5 | require_once (KT_DIR . '/tests/test.php'); |
| 6 | -require_once (KT_LIB_DIR . '/api/ktcmis/ktcmis.inc.php'); | |
| 6 | +require_once (KT_LIB_DIR . '/api/ktcmis/ktNavigationService.inc.php'); | |
| 7 | +require_once (KT_LIB_DIR . '/api/ktcmis/ktObjectService.inc.php'); | |
| 8 | +require_once (KT_LIB_DIR . '/api/ktcmis/ktRepositoryService.inc.php'); | |
| 9 | +require_once (KT_LIB_DIR . '/api/ktcmis/ktVersioningService.inc.php'); | |
| 7 | 10 | |
| 8 | 11 | // username and password for authentication |
| 9 | 12 | // must be set correctly for all of the tests to pass in all circumstances |
| ... | ... | @@ -63,7 +66,7 @@ class CMISTestCase extends KTUnitTestCase { |
| 63 | 66 | } |
| 64 | 67 | |
| 65 | 68 | // Repository service functions |
| 66 | - function tedstRepositoryService() | |
| 69 | + function testRepositoryService() | |
| 67 | 70 | { |
| 68 | 71 | $RepositoryService = new KTRepositoryService(); |
| 69 | 72 | |
| ... | ... | @@ -180,7 +183,7 @@ class CMISTestCase extends KTUnitTestCase { |
| 180 | 183 | } |
| 181 | 184 | |
| 182 | 185 | // Navigation service functions |
| 183 | - function tedstNavigationService() | |
| 186 | + function testNavigationService() | |
| 184 | 187 | { |
| 185 | 188 | $NavigationService = new KTNavigationService($this->ktapi); |
| 186 | 189 | |
| ... | ... | @@ -302,7 +305,7 @@ class CMISTestCase extends KTUnitTestCase { |
| 302 | 305 | |
| 303 | 306 | // Object Services |
| 304 | 307 | |
| 305 | - function tedstObjectService() | |
| 308 | + function testObjectService() | |
| 306 | 309 | { |
| 307 | 310 | $ObjectService = new KTObjectService($this->ktapi); |
| 308 | 311 | // $ObjectService->startSession(KT_TEST_USER, KT_TEST_PASS); |
| ... | ... | @@ -526,7 +529,7 @@ class CMISTestCase extends KTUnitTestCase { |
| 526 | 529 | $response = $NavigationService->getCheckedOutDocs($repositoryId, false, false); |
| 527 | 530 | $this->assertEqual($response['status_code'], 0); |
| 528 | 531 | $this->assertNotNull($response['results']); |
| 529 | - $this->assertTrue(in_array($documentId, $response['results'])); | |
| 532 | + $this->assertTrue($this->findInPropertiesArray('ObjectId', $documentId, $response['results'])); | |
| 530 | 533 | // now let's cancel the checkout so that we can delete later during cleanup :) |
| 531 | 534 | $response = $VersioningService->cancelCheckOut($repositoryId, $pwcId); |
| 532 | 535 | |
| ... | ... | @@ -537,7 +540,46 @@ class CMISTestCase extends KTUnitTestCase { |
| 537 | 540 | // tear down the folder/doc tree structure with which we were testing |
| 538 | 541 | $this->cleanupFolderDocStructure(); |
| 539 | 542 | } |
| 543 | + | |
| 544 | + /** | |
| 545 | + * Searches a CMIS properties array for a specific value | |
| 546 | + * | |
| 547 | + * @param string $key The CMIS property key to look for | |
| 548 | + * @param string $needle The value to check | |
| 549 | + * @param array $haystack The CMIS properties array | |
| 550 | + * @param int $propeLevel -1 or positive value -> -1 = not yet found | positive = found | |
| 551 | + * @return boolean | |
| 552 | + */ | |
| 553 | + function findInPropertiesArray($key, $needle, $haystack, $propLevel = null) | |
| 554 | + { | |
| 555 | + $found = false; | |
| 556 | + | |
| 557 | + if (empty($propLevel)) $propLevel = -1; | |
| 540 | 558 | |
| 559 | + foreach($haystack as $elKey => $elValue) | |
| 560 | + { | |
| 561 | + if (($propLevel == -1) && ((string)$elKey != 'properties')) { | |
| 562 | + $found = $this->findInPropertiesArray($key, $needle, $elValue, $propLevel); | |
| 563 | + if ($found) break; | |
| 564 | + } | |
| 565 | + else if ((string)$elKey == 'properties') { | |
| 566 | + $propLevel = 1; | |
| 567 | + } | |
| 568 | + | |
| 569 | + // now check through actual properties array | |
| 570 | + $properties = $elValue; | |
| 571 | + foreach($properties as $propKey => $property) | |
| 572 | + { | |
| 573 | + if (($propKey == $key) && ($property['value'] == $needle)) { | |
| 574 | + $found = true; | |
| 575 | + break; | |
| 576 | + } | |
| 577 | + } | |
| 578 | + } | |
| 579 | + | |
| 580 | + return $found; | |
| 581 | + } | |
| 582 | + | |
| 541 | 583 | /** |
| 542 | 584 | * Helper function to create a document |
| 543 | 585 | */ | ... | ... |
webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php
| ... | ... | @@ -30,6 +30,7 @@ i. Other (Content-less document, Folder, Relationship, Type, etc) – best effor |
| 30 | 30 | When POSTing an Atom Document, the atom fields take precedence over the CMIS property field for writeable properties. For example, atom:title will overwrite cmis:name |
| 31 | 31 | */ |
| 32 | 32 | |
| 33 | +// load all available CMIS services | |
| 33 | 34 | include_once CMIS_ATOM_LIB_FOLDER . 'RepositoryService.inc.php'; |
| 34 | 35 | include_once CMIS_ATOM_LIB_FOLDER . 'NavigationService.inc.php'; |
| 35 | 36 | include_once CMIS_ATOM_LIB_FOLDER . 'ObjectService.inc.php'; |
| ... | ... | @@ -101,7 +102,7 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { |
| 101 | 102 | $feed = KT_cmis_atom_service_helper::getObjectFeed($this, $ObjectService, $repositoryId, $folderId); |
| 102 | 103 | } |
| 103 | 104 | |
| 104 | - //Expose the responseFeed | |
| 105 | + // Expose the responseFeed | |
| 105 | 106 | $this->responseFeed = $feed; |
| 106 | 107 | } |
| 107 | 108 | |
| ... | ... | @@ -140,7 +141,7 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { |
| 140 | 141 | $objectId = $this->params[2]; |
| 141 | 142 | } |
| 142 | 143 | |
| 143 | - $cmisObjectProperties = KT_cmis_atom_service_helper::getCmisProperties($this->parsedXMLContent['@children']['cmis:object']); | |
| 144 | + $cmisObjectProperties = KT_cmis_atom_service_helper::getCmisProperties($this->parsedXMLContent['@children']); | |
| 144 | 145 | |
| 145 | 146 | // check for existing object id as property of submitted object data |
| 146 | 147 | if (!empty($cmisObjectProperties['ObjectId'])) |
| ... | ... | @@ -159,7 +160,7 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { |
| 159 | 160 | CMISUtil::decodeObjectId($objectId, $typeId); |
| 160 | 161 | } |
| 161 | 162 | |
| 162 | - // now check for content stream | |
| 163 | + // check for content stream | |
| 163 | 164 | $content = KT_cmis_atom_service_helper::getAtomValues($this->parsedXMLContent['@children'], 'content'); |
| 164 | 165 | |
| 165 | 166 | // TODO this will possibly need to change somewhat once Relationship Objects come into play. |
| ... | ... | @@ -207,7 +208,7 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { |
| 207 | 208 | $feed = KT_cmis_atom_service_helper::getErrorFeed($this, self::STATUS_SERVER_ERROR, $error); |
| 208 | 209 | } |
| 209 | 210 | |
| 210 | - //Expose the responseFeed | |
| 211 | + // Expose the responseFeed | |
| 211 | 212 | $this->responseFeed = $feed; |
| 212 | 213 | } |
| 213 | 214 | |
| ... | ... | @@ -236,7 +237,7 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { |
| 236 | 237 | if (PEAR::isError($response)) |
| 237 | 238 | { |
| 238 | 239 | $feed = KT_cmis_atom_service_helper::getErrorFeed($this, self::STATUS_SERVER_ERROR, $response->getMessage()); |
| 239 | - //Expose the responseFeed | |
| 240 | + // Expose the responseFeed | |
| 240 | 241 | $this->responseFeed = $feed; |
| 241 | 242 | return null; |
| 242 | 243 | } |
| ... | ... | @@ -349,7 +350,7 @@ class KT_cmis_atom_service_types extends KT_cmis_atom_service { |
| 349 | 350 | $type = ((empty($this->params[0])) ? 'all' : $this->params[0]); |
| 350 | 351 | $feed = KT_cmis_atom_service_helper::getTypeFeed($type, $types); |
| 351 | 352 | |
| 352 | - //Expose the responseFeed | |
| 353 | + // Expose the responseFeed | |
| 353 | 354 | $this->responseFeed = $feed; |
| 354 | 355 | } |
| 355 | 356 | |
| ... | ... | @@ -385,7 +386,7 @@ class KT_cmis_atom_service_type extends KT_cmis_atom_service { |
| 385 | 386 | $feed = $this->getTypeChildrenFeed($this->params[1]); |
| 386 | 387 | } |
| 387 | 388 | |
| 388 | - //Expose the responseFeed | |
| 389 | + // Expose the responseFeed | |
| 389 | 390 | $this->responseFeed=$feed; |
| 390 | 391 | } |
| 391 | 392 | |
| ... | ... | @@ -494,7 +495,7 @@ class KT_cmis_atom_service_checkedout extends KT_cmis_atom_service { |
| 494 | 495 | // $entry = null; |
| 495 | 496 | // $feed->newField('cmis:hasMoreItems', 'false', $entry, true); |
| 496 | 497 | |
| 497 | - //Expose the responseFeed | |
| 498 | + // Expose the responseFeed | |
| 498 | 499 | $this->responseFeed = $feed; |
| 499 | 500 | } |
| 500 | 501 | |
| ... | ... | @@ -513,7 +514,7 @@ class KT_cmis_atom_service_checkedout extends KT_cmis_atom_service { |
| 513 | 514 | if (empty($cmisObjectProperties['ObjectId'])) |
| 514 | 515 | { |
| 515 | 516 | $feed = KT_cmis_atom_service_helper::getErrorFeed($this, self::STATUS_SERVER_ERROR, 'No object was specified for checkout'); |
| 516 | - //Expose the responseFeed | |
| 517 | + // Expose the responseFeed | |
| 517 | 518 | $this->responseFeed = $feed; |
| 518 | 519 | return null; |
| 519 | 520 | } |
| ... | ... | @@ -523,7 +524,7 @@ class KT_cmis_atom_service_checkedout extends KT_cmis_atom_service { |
| 523 | 524 | if (PEAR::isError($response)) |
| 524 | 525 | { |
| 525 | 526 | $feed = KT_cmis_atom_service_helper::getErrorFeed($this, self::STATUS_SERVER_ERROR, 'No object was specified for checkout'); |
| 526 | - //Expose the responseFeed | |
| 527 | + // Expose the responseFeed | |
| 527 | 528 | $this->responseFeed = $feed; |
| 528 | 529 | return null; |
| 529 | 530 | } |
| ... | ... | @@ -531,7 +532,7 @@ class KT_cmis_atom_service_checkedout extends KT_cmis_atom_service { |
| 531 | 532 | $this->setStatus(self::STATUS_CREATED); |
| 532 | 533 | $feed = KT_cmis_atom_service_helper::getObjectFeed($this, $ObjectService, $repositoryId, $cmisObjectProperties['ObjectId'], 'POST'); |
| 533 | 534 | |
| 534 | - //Expose the responseFeed | |
| 535 | + // Expose the responseFeed | |
| 535 | 536 | $this->responseFeed = $feed; |
| 536 | 537 | } |
| 537 | 538 | |
| ... | ... | @@ -559,13 +560,13 @@ class KT_cmis_atom_service_document extends KT_cmis_atom_service { |
| 559 | 560 | // this depends on $this->params[1] |
| 560 | 561 | if (!empty($this->params[1])) |
| 561 | 562 | { |
| 562 | - $this->getContentStream($ObjectService, $repositoryId); | |
| 563 | + KT_cmis_atom_service_helper::downloadContentStream($this, $ObjectService, $repositoryId); | |
| 563 | 564 | return null; |
| 564 | 565 | } |
| 565 | 566 | |
| 566 | 567 | $feed = KT_cmis_atom_service_helper::getObjectFeed($this, $ObjectService, $repositoryId, $this->params[0]); |
| 567 | 568 | |
| 568 | - //Expose the responseFeed | |
| 569 | + // Expose the responseFeed | |
| 569 | 570 | $this->responseFeed = $feed; |
| 570 | 571 | } |
| 571 | 572 | |
| ... | ... | @@ -594,7 +595,7 @@ class KT_cmis_atom_service_document extends KT_cmis_atom_service { |
| 594 | 595 | if (PEAR::isError($response)) |
| 595 | 596 | { |
| 596 | 597 | $feed = KT_cmis_atom_service_helper::getErrorFeed($this, self::STATUS_SERVER_ERROR, $response->getMessage()); |
| 597 | - //Expose the responseFeed | |
| 598 | + // Expose the responseFeed | |
| 598 | 599 | $this->responseFeed = $feed; |
| 599 | 600 | return null; |
| 600 | 601 | } |
| ... | ... | @@ -603,46 +604,6 @@ class KT_cmis_atom_service_document extends KT_cmis_atom_service { |
| 603 | 604 | $this->setStatus(self::STATUS_NO_CONTENT); |
| 604 | 605 | } |
| 605 | 606 | |
| 606 | - private function getContentStream(&$ObjectService, $repositoryId) | |
| 607 | - { | |
| 608 | - $response = $ObjectService->getProperties($repositoryId, $this->params[0], false, false); | |
| 609 | - if (PEAR::isError($response)) { | |
| 610 | - $feed = KT_cmis_atom_service_helper::getErrorFeed($this, KT_cmis_atom_service::STATUS_SERVER_ERROR, $response->getMessage()); | |
| 611 | - $this->responseFeed = $feed; | |
| 612 | - return null; | |
| 613 | - } | |
| 614 | - | |
| 615 | - // TODO also check If-Modified-Since? | |
| 616 | -// $this->headers['If-Modified-Since'] => 2009-07-24 17:16:54 | |
| 617 | - | |
| 618 | - $this->contentDownload = true; | |
| 619 | - $eTag = md5($response['properties']['LastModificationDate']['value'] . $response['properties']['ContentStreamLength']['value']); | |
| 620 | - | |
| 621 | - if ($this->headers['If-None-Match'] == $eTag) | |
| 622 | - { | |
| 623 | - $this->setStatus(self::STATUS_NOT_MODIFIED); | |
| 624 | - $this->contentDownload = false; | |
| 625 | - return null; | |
| 626 | - } | |
| 627 | - | |
| 628 | - $contentStream = $ObjectService->getContentStream($repositoryId, $this->params[0]); | |
| 629 | - | |
| 630 | - // headers specific to output | |
| 631 | - $this->setEtag($eTag); | |
| 632 | - $this->setHeader('Last-Modified', $response['properties']['LastModificationDate']['value']); | |
| 633 | - | |
| 634 | - if (!empty($response['properties']['ContentStreamMimeType']['value'])) { | |
| 635 | - $this->setHeader('Content-type', $response['properties']['ContentStreamMimeType']['value'] . ';charset=utf-8'); | |
| 636 | - } | |
| 637 | - else { | |
| 638 | - $this->setHeader('Content-type', 'text/plain;charset=utf-8'); | |
| 639 | - } | |
| 640 | - | |
| 641 | - $this->setHeader('Content-Disposition', 'attachment;filename="' . $response['properties']['ContentStreamFilename']['value'] . '"'); | |
| 642 | - $this->setHeader('Content-Length', $response['properties']['ContentStreamLength']['value']); | |
| 643 | - $this->output = $contentStream; | |
| 644 | - } | |
| 645 | - | |
| 646 | 607 | } |
| 647 | 608 | |
| 648 | 609 | class KT_cmis_atom_service_pwc extends KT_cmis_atom_service { |
| ... | ... | @@ -665,13 +626,13 @@ class KT_cmis_atom_service_pwc extends KT_cmis_atom_service { |
| 665 | 626 | // this depends on $this->params[1] |
| 666 | 627 | if (!empty($this->params[1])) |
| 667 | 628 | { |
| 668 | - $this->getContentStream($ObjectService, $repositoryId); | |
| 629 | + KT_cmis_atom_service_helper::downloadContentStream($this, $ObjectService, $repositoryId); | |
| 669 | 630 | return null; |
| 670 | 631 | } |
| 671 | 632 | |
| 672 | 633 | $feed = KT_cmis_atom_service_helper::getObjectFeed($this, $ObjectService, $repositoryId, $this->params[0]); |
| 673 | 634 | |
| 674 | - //Expose the responseFeed | |
| 635 | + // Expose the responseFeed | |
| 675 | 636 | $this->responseFeed = $feed; |
| 676 | 637 | } |
| 677 | 638 | |
| ... | ... | @@ -696,7 +657,7 @@ class KT_cmis_atom_service_pwc extends KT_cmis_atom_service { |
| 696 | 657 | if (PEAR::isError($response)) |
| 697 | 658 | { |
| 698 | 659 | $feed = KT_cmis_atom_service_helper::getErrorFeed($this, self::STATUS_SERVER_ERROR, $response->getMessage()); |
| 699 | - //Expose the responseFeed | |
| 660 | + // Expose the responseFeed | |
| 700 | 661 | $this->responseFeed = $feed; |
| 701 | 662 | return null; |
| 702 | 663 | } |
| ... | ... | @@ -707,25 +668,58 @@ class KT_cmis_atom_service_pwc extends KT_cmis_atom_service { |
| 707 | 668 | |
| 708 | 669 | public function PUT_action() |
| 709 | 670 | { |
| 710 | - // call the checkin function | |
| 711 | 671 | $RepositoryService = new RepositoryService(); |
| 712 | 672 | $VersioningService = new VersioningService(KT_cmis_atom_service_helper::getKt()); |
| 713 | 673 | |
| 714 | 674 | $repositories = $RepositoryService->getRepositories(); |
| 715 | 675 | $repositoryId = $repositories[0]['repositoryId']; |
| 716 | 676 | |
| 717 | - $response = $VersioningService->checkIn($repositoryId, $this->params[0]); | |
| 677 | + // check for content stream | |
| 678 | + // NOTE this is a hack! will not work with CMISSpaces at least, probably not with any client except RestTest and similar | |
| 679 | + // where we can manually modify the input | |
| 680 | + // first we try for an atom content tag | |
| 681 | + $content = KT_cmis_atom_service_helper::getAtomValues($this->parsedXMLContent['@children'], 'content'); | |
| 682 | + if (!empty($content)) { | |
| 683 | + $contentStream = $content; | |
| 684 | + } | |
| 685 | + // not found? try for a regular content tag | |
| 686 | + else { | |
| 687 | + $content = KT_cmis_atom_service_helper::findTag('content', $this->parsedXMLContent['@children'], null, false); | |
| 688 | + $contentStream = $content['@value']; | |
| 689 | + } | |
| 690 | + | |
| 691 | + // if we haven't found it now, the real hack begins - retrieve the EXISTING content and submit this as the contentStream | |
| 692 | + // this is needed because KnowledgeTree will not accept a checkin without a content stream but CMISSpaces (and possibly | |
| 693 | + // other CMIS clients are the same, does not send a content stream on checkin nor does it offer the user a method to choose one) | |
| 694 | + // NOTE that if the content is INTENDED to be empty this and all the above checks will FAIL! | |
| 695 | + // FIXME this is horrible, terrible, ugly and bad! | |
| 696 | + if (empty($contentStream)) | |
| 697 | + { | |
| 698 | + $ObjectService = new ObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 699 | + $contentStream = base64_encode(KT_cmis_atom_service_helper::getContentStream($this, $ObjectService, $repositoryId)); | |
| 700 | + } | |
| 701 | + | |
| 702 | + // and if we don't have it by now, we give up...but leave the error to be generated by the underlying KnowledgeTree code | |
| 703 | + | |
| 704 | + // checkin function call | |
| 705 | + // TODO dynamically detect version change type - leaving this for now as the CMIS clients tested do not appear to | |
| 706 | + // offer the choice to the user - perhaps it will turn out that this will come from somewhere else but for now | |
| 707 | + // we assume minor version updates only | |
| 708 | + $major = false; | |
| 709 | + $response = $VersioningService->checkIn($repositoryId, $this->params[0], $major, $contentStream); | |
| 718 | 710 | |
| 719 | 711 | if (PEAR::isError($response)) |
| 720 | 712 | { |
| 721 | 713 | $feed = KT_cmis_atom_service_helper::getErrorFeed($this, self::STATUS_SERVER_ERROR, $response->getMessage()); |
| 722 | - //Expose the responseFeed | |
| 714 | + // Expose the responseFeed | |
| 723 | 715 | $this->responseFeed = $feed; |
| 724 | 716 | return null; |
| 725 | 717 | } |
| 726 | 718 | |
| 727 | - $this->setStatus(self::STATUS_NO_CONTENT); | |
| 728 | - $this->responseFeed = null; | |
| 719 | + $feed = KT_cmis_atom_service_helper::getObjectFeed($this, $ObjectService, $repositoryId, $this->params[0]); | |
| 720 | + | |
| 721 | + // Expose the responseFeed | |
| 722 | + $this->responseFeed = $feed; | |
| 729 | 723 | } |
| 730 | 724 | |
| 731 | 725 | } | ... | ... |
webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php
| ... | ... | @@ -418,7 +418,7 @@ class KT_cmis_atom_service_helper { |
| 418 | 418 | while($start < $numFolders) |
| 419 | 419 | { |
| 420 | 420 | $name = $path[$numQ-$numFolders+$start]; |
| 421 | - // hack to fix drupal url encoding issue | |
| 421 | + // fix for possible url encoding issue | |
| 422 | 422 | $name = str_replace('%2520', '%20', $name); |
| 423 | 423 | |
| 424 | 424 | $folderName = urldecode($name); |
| ... | ... | @@ -494,6 +494,71 @@ class KT_cmis_atom_service_helper { |
| 494 | 494 | return date('Y-m-d H:i:s', $time); |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | + /** | |
| 498 | + * Fetches the document content stream for internal use | |
| 499 | + * | |
| 500 | + * @param object $ObjectService | |
| 501 | + * @param string $repositoryId | |
| 502 | + * @return null | string $contentStream | |
| 503 | + */ | |
| 504 | + static public function getContentStream(&$service, &$ObjectService, $repositoryId) | |
| 505 | + { | |
| 506 | + $response = $ObjectService->getProperties($repositoryId, $service->params[0], false, false); | |
| 507 | + if (PEAR::isError($response)) { | |
| 508 | + return null; | |
| 509 | + } | |
| 510 | + | |
| 511 | + $contentStream = $ObjectService->getContentStream($repositoryId, $service->params[0]); | |
| 512 | + | |
| 513 | + return $contentStream; | |
| 514 | + } | |
| 515 | + /** | |
| 516 | + * Fetches and prepares the document content stream for download/viewing | |
| 517 | + * | |
| 518 | + * @param object $ObjectService | |
| 519 | + * @param string $repositoryId | |
| 520 | + * @return null | nothing | |
| 521 | + */ | |
| 522 | + static public function downloadContentStream(&$service, &$ObjectService, $repositoryId) | |
| 523 | + { | |
| 524 | + $response = $ObjectService->getProperties($repositoryId, $service->params[0], false, false); | |
| 525 | + if (PEAR::isError($response)) { | |
| 526 | + $feed = KT_cmis_atom_service_helper::getErrorFeed($service, KT_cmis_atom_service::STATUS_SERVER_ERROR, $response->getMessage()); | |
| 527 | + $service->responseFeed = $feed; | |
| 528 | + return null; | |
| 529 | + } | |
| 530 | + | |
| 531 | + // TODO also check If-Modified-Since? | |
| 532 | +// $service->headers['If-Modified-Since'] => 2009-07-24 17:16:54 | |
| 533 | + | |
| 534 | + $service->setContentDownload(true); | |
| 535 | + $eTag = md5($response['properties']['LastModificationDate']['value'] . $response['properties']['ContentStreamLength']['value']); | |
| 536 | + | |
| 537 | + if ($service->headers['If-None-Match'] == $eTag) | |
| 538 | + { | |
| 539 | + $service->setStatus(KT_cmis_atom_service::STATUS_NOT_MODIFIED); | |
| 540 | + $service->setContentDownload(false); | |
| 541 | + return null; | |
| 542 | + } | |
| 543 | + | |
| 544 | + $contentStream = $ObjectService->getContentStream($repositoryId, $service->params[0]); | |
| 545 | + | |
| 546 | + // headers specific to output | |
| 547 | + $service->setEtag($eTag); | |
| 548 | + $service->setHeader('Last-Modified', $response['properties']['LastModificationDate']['value']); | |
| 549 | + | |
| 550 | + if (!empty($response['properties']['ContentStreamMimeType']['value'])) { | |
| 551 | + $service->setHeader('Content-type', $response['properties']['ContentStreamMimeType']['value'] . ';charset=utf-8'); | |
| 552 | + } | |
| 553 | + else { | |
| 554 | + $service->setHeader('Content-type', 'text/plain;charset=utf-8'); | |
| 555 | + } | |
| 556 | + | |
| 557 | + $service->setHeader('Content-Disposition', 'attachment;filename="' . $response['properties']['ContentStreamFilename']['value'] . '"'); | |
| 558 | + $service->setHeader('Content-Length', $response['properties']['ContentStreamLength']['value']); | |
| 559 | + $service->setOutput($contentStream); | |
| 560 | + } | |
| 561 | + | |
| 497 | 562 | //TODO: Add key information to be able to find the same tag in the original struct (MarkH) |
| 498 | 563 | static public function findTag($tagName=NULL,$xml=array(),$tagArray=NULL,$deep=false){ |
| 499 | 564 | $tagArray=is_array($tagArray)?$tagArray:array(); | ... | ... |
webservice/classes/atompub/KT_atom_service.inc.php
webservice/classes/atompub/cmis/KT_cmis_atom_service.inc.php
| ... | ... | @@ -8,7 +8,12 @@ class KT_cmis_atom_service extends KT_atom_service { |
| 8 | 8 | |
| 9 | 9 | protected $serviceType = null; |
| 10 | 10 | protected $contentDownload = false; |
| 11 | - | |
| 11 | + | |
| 12 | + public function setContentDownload($contentDownload) | |
| 13 | + { | |
| 14 | + $this->contentDownload = $contentDownload; | |
| 15 | + } | |
| 16 | + | |
| 12 | 17 | public public function isContentDownload() |
| 13 | 18 | { |
| 14 | 19 | return $this->contentDownload; |
| ... | ... | @@ -19,6 +24,11 @@ class KT_cmis_atom_service extends KT_atom_service { |
| 19 | 24 | return $this->status == self::STATUS_NOT_MODIFIED; |
| 20 | 25 | } |
| 21 | 26 | |
| 27 | + public function setoutput($output) | |
| 28 | + { | |
| 29 | + $this->output = $output; | |
| 30 | + } | |
| 31 | + | |
| 22 | 32 | public function getOutput() |
| 23 | 33 | { |
| 24 | 34 | return $this->output; |
| ... | ... | @@ -29,7 +39,7 @@ class KT_cmis_atom_service extends KT_atom_service { |
| 29 | 39 | return $this->serviceType; |
| 30 | 40 | } |
| 31 | 41 | |
| 32 | - protected function setHeader($header = null, $value = null) | |
| 42 | + public function setHeader($header = null, $value = null) | |
| 33 | 43 | { |
| 34 | 44 | if ($header) header($header . ': ' . $value); |
| 35 | 45 | } | ... | ... |
webservice/classes/atompub/cmis/NavigationService.inc.php
webservice/classes/atompub/cmis/ObjectService.inc.php
webservice/classes/atompub/cmis/RepositoryService.inc.php
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | * for processing of CMIS queries and responses via atompub/webservices |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -require_once KT_LIB_DIR . '/api/ktcmis/ktcmis.inc.php'; | |
| 8 | +require_once KT_LIB_DIR . '/api/ktcmis/ktRepositoryService.inc.php'; | |
| 9 | 9 | |
| 10 | 10 | class RepositoryService extends KTRepositoryService { |
| 11 | 11 | ... | ... |
webservice/classes/atompub/cmis/VersioningService.inc.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once KT_LIB_DIR . '/api/ktcmis/ktcmis.inc.php'; | |
| 3 | +require_once KT_LIB_DIR . '/api/ktcmis/ktVersioningService.inc.php'; | |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * CMIS Service class which hooks into the KnowledgeTree interface |
| ... | ... | @@ -85,9 +85,9 @@ class VersioningService extends KTVersioningService { |
| 85 | 85 | * @param string $checkinComment [optional] |
| 86 | 86 | * @return string $documentId |
| 87 | 87 | */ |
| 88 | - public function checkIn($repositoryId, $documentId, $major, $changeToken = '', $properties = array(), $contentStream = null, $checkinComment = '') | |
| 88 | + public function checkIn($repositoryId, $documentId, $major, $contentStream = null, $changeToken = '', $properties = array(), $checkinComment = '') | |
| 89 | 89 | { |
| 90 | - $result = parent::checkIn($repositoryId, $documentId, $major, $changeToken, $properties, $contentStream, $checkinComment); | |
| 90 | + $result = parent::checkIn($repositoryId, $documentId, $major, $contentStream, $changeToken, $properties, $checkinComment); | |
| 91 | 91 | |
| 92 | 92 | if ($result['status_code'] == 0) { |
| 93 | 93 | return $result['results']; | ... | ... |