Commit 0989bdd4e2a30c16240ca61a1b455d1cd9d5e819
Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge
Showing
27 changed files
with
1211 additions
and
1299 deletions
ktapi/KTAPIDocument.inc.php
| @@ -2225,6 +2225,7 @@ class KTAPI_Document extends KTAPI_FolderItem | @@ -2225,6 +2225,7 @@ class KTAPI_Document extends KTAPI_FolderItem | ||
| 2225 | $version['user'] = $username; | 2225 | $version['user'] = $username; |
| 2226 | $version['metadata_version'] = $document->getMetadataVersion(); | 2226 | $version['metadata_version'] = $document->getMetadataVersion(); |
| 2227 | $version['content_version'] = $document->getVersion(); | 2227 | $version['content_version'] = $document->getVersion(); |
| 2228 | + $version['datetime'] = $document->getVersionCreated(); | ||
| 2228 | if ($wsversion >= 2) | 2229 | if ($wsversion >= 2) |
| 2229 | { | 2230 | { |
| 2230 | $version['metadata_version'] = (int) $version['metadata_version']; | 2231 | $version['metadata_version'] = (int) $version['metadata_version']; |
plugins/ktcore/KTBulkActions.php
| @@ -259,16 +259,9 @@ class KTBulkDeleteAction extends KTBulkAction { | @@ -259,16 +259,9 @@ class KTBulkDeleteAction extends KTBulkAction { | ||
| 259 | return parent::do_performaction(); | 259 | return parent::do_performaction(); |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | - /* | 262 | + /** |
| 263 | * Bulk delete | 263 | * Bulk delete |
| 264 | - * Author : Jarrett Jordaan | ||
| 265 | - * Modified : 28/04/09 | ||
| 266 | - * | ||
| 267 | * @params : KTDocumentUtil/KTFolderUtil $oEntity | 264 | * @params : KTDocumentUtil/KTFolderUtil $oEntity |
| 268 | - * | ||
| 269 | - * Description : Since its a bulk operation, the delete function needs to | ||
| 270 | - * know that. Added extra boolean param to the delete | ||
| 271 | - * function. | ||
| 272 | */ | 265 | */ |
| 273 | function perform_action($oEntity) { | 266 | function perform_action($oEntity) { |
| 274 | $sReason = $this->res['reason']; | 267 | $sReason = $this->res['reason']; |
| @@ -526,16 +519,10 @@ class KTBulkMoveAction extends KTBulkAction { | @@ -526,16 +519,10 @@ class KTBulkMoveAction extends KTBulkAction { | ||
| 526 | return parent::do_performaction(); | 519 | return parent::do_performaction(); |
| 527 | } | 520 | } |
| 528 | 521 | ||
| 529 | - /* | 522 | + /** |
| 530 | * Bulk move | 523 | * Bulk move |
| 531 | - * Author : Jarrett Jordaan | ||
| 532 | - * Modified : 28/04/09 | ||
| 533 | - * | ||
| 534 | * @params : KTDocumentUtil/KTFolderUtil $oEntity | 524 | * @params : KTDocumentUtil/KTFolderUtil $oEntity |
| 535 | * | 525 | * |
| 536 | - * Description : Since its a bulk operation, the move function needs to | ||
| 537 | - * know that. Added extra boolean param to the move | ||
| 538 | - * function. | ||
| 539 | */ | 526 | */ |
| 540 | function perform_action($oEntity) { | 527 | function perform_action($oEntity) { |
| 541 | if(is_a($oEntity, 'Document')) { | 528 | if(is_a($oEntity, 'Document')) { |
| @@ -771,16 +758,10 @@ class KTBulkCopyAction extends KTBulkAction { | @@ -771,16 +758,10 @@ class KTBulkCopyAction extends KTBulkAction { | ||
| 771 | return parent::do_performaction(); | 758 | return parent::do_performaction(); |
| 772 | } | 759 | } |
| 773 | 760 | ||
| 774 | - /* | 761 | + /** |
| 775 | * Bulk copy | 762 | * Bulk copy |
| 776 | - * Author : Jarrett Jordaan | ||
| 777 | - * Modified : 28/04/09 | ||
| 778 | - * | ||
| 779 | * @params : KTDocumentUtil/KTFolderUtil $oEntity | 763 | * @params : KTDocumentUtil/KTFolderUtil $oEntity |
| 780 | - * | ||
| 781 | - * Description : Since its a bulk operation, the copy function needs to | ||
| 782 | - * know that. Added extra boolean param to the copy | ||
| 783 | - * function. | 764 | + * |
| 784 | */ | 765 | */ |
| 785 | function perform_action($oEntity) { | 766 | function perform_action($oEntity) { |
| 786 | if(is_a($oEntity, 'Document')) { | 767 | if(is_a($oEntity, 'Document')) { |
| @@ -1029,16 +1010,10 @@ class KTBulkArchiveAction extends KTBulkAction { | @@ -1029,16 +1010,10 @@ class KTBulkArchiveAction extends KTBulkAction { | ||
| 1029 | return parent::do_performaction(); | 1010 | return parent::do_performaction(); |
| 1030 | } | 1011 | } |
| 1031 | 1012 | ||
| 1032 | - /* | 1013 | + /** |
| 1033 | * Bulk archive | 1014 | * Bulk archive |
| 1034 | - * Author : Jarrett Jordaan | ||
| 1035 | - * Modified : 28/04/09 | ||
| 1036 | - * | ||
| 1037 | * @params : KTDocumentUtil/KTFolderUtil $oEntity | 1015 | * @params : KTDocumentUtil/KTFolderUtil $oEntity |
| 1038 | * | 1016 | * |
| 1039 | - * Description : Since its a bulk operation, the archive function needs | ||
| 1040 | - * to know that. Added extra boolean param to the archive | ||
| 1041 | - * function. | ||
| 1042 | */ | 1017 | */ |
| 1043 | function perform_action($oEntity) { | 1018 | function perform_action($oEntity) { |
| 1044 | if(is_a($oEntity, 'Document')) { | 1019 | if(is_a($oEntity, 'Document')) { |
| @@ -1216,16 +1191,10 @@ class KTBrowseBulkExportAction extends KTBulkAction { | @@ -1216,16 +1191,10 @@ class KTBrowseBulkExportAction extends KTBulkAction { | ||
| 1216 | return $str; | 1191 | return $str; |
| 1217 | } | 1192 | } |
| 1218 | 1193 | ||
| 1219 | - /* | 1194 | + /** |
| 1220 | * Bulk export | 1195 | * Bulk export |
| 1221 | - * Author : Jarrett Jordaan | ||
| 1222 | - * Modified : 28/04/09 | ||
| 1223 | - * | ||
| 1224 | * @params : KTDocumentUtil/KTFolderUtil $oEntity | 1196 | * @params : KTDocumentUtil/KTFolderUtil $oEntity |
| 1225 | * | 1197 | * |
| 1226 | - * Description : Since its a bulk operation, the export function needs | ||
| 1227 | - * to know that. Added extra boolean param to the export | ||
| 1228 | - * function. | ||
| 1229 | */ | 1198 | */ |
| 1230 | function perform_action($oEntity) { | 1199 | function perform_action($oEntity) { |
| 1231 | // TODO find a way to do bulk email | 1200 | // TODO find a way to do bulk email |
| @@ -1489,16 +1458,10 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { | @@ -1489,16 +1458,10 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { | ||
| 1489 | return $result; | 1458 | return $result; |
| 1490 | } | 1459 | } |
| 1491 | 1460 | ||
| 1492 | - /* | 1461 | + /** |
| 1493 | * Bulk checkout | 1462 | * Bulk checkout |
| 1494 | - * Author : Jarrett Jordaan | ||
| 1495 | - * Modified : 28/04/09 | ||
| 1496 | - * | ||
| 1497 | * @params : KTDocumentUtil/KTFolderUtil $oEntity | 1463 | * @params : KTDocumentUtil/KTFolderUtil $oEntity |
| 1498 | * | 1464 | * |
| 1499 | - * Description : Since its a bulk operation, the checkout function needs | ||
| 1500 | - * to know that. Added extra boolean param to the checkout | ||
| 1501 | - * function. | ||
| 1502 | */ | 1465 | */ |
| 1503 | function perform_action($oEntity) { | 1466 | function perform_action($oEntity) { |
| 1504 | // checkout document | 1467 | // checkout document |
plugins/ktcore/admin/workflowsv2.php
| @@ -2365,8 +2365,7 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { | @@ -2365,8 +2365,7 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { | ||
| 2365 | 2365 | ||
| 2366 | if (!empty($sFilter)) { | 2366 | if (!empty($sFilter)) { |
| 2367 | $allowed = array(); | 2367 | $allowed = array(); |
| 2368 | - // Modified Jarrett Jordaan Only notify enabled users | ||
| 2369 | - $q = sprintf('name like "%%%s%%" AND disabled = 0', DBUtil::escapeSimple($sFilter)); | 2368 | + $q = sprintf('name like "%%%s%%" AND disabled = 0', DBUtil::escapeSimple($sFilter)); // notify enabled users |
| 2370 | $aUsers = User::getList($q); | 2369 | $aUsers = User::getList($q); |
| 2371 | $q = sprintf('name like "%%%s%%"', DBUtil::escapeSimple($sFilter)); | 2370 | $q = sprintf('name like "%%%s%%"', DBUtil::escapeSimple($sFilter)); |
| 2372 | $aGroups = Group::getList($q); | 2371 | $aGroups = Group::getList($q); |
plugins/multiselect/templates/ktcore/search2/adv_query_builder.smarty
| @@ -519,8 +519,6 @@ function addFieldTypeSelection(groupid, fid, type, options) | @@ -519,8 +519,6 @@ function addFieldTypeSelection(groupid, fid, type, options) | ||
| 519 | default: | 519 | default: |
| 520 | html += 'unknown: ' + type; | 520 | html += 'unknown: ' + type; |
| 521 | } | 521 | } |
| 522 | - // Jarrett Jordaan | ||
| 523 | - // Closing tags added | ||
| 524 | html += "</nobr></td>"; | 522 | html += "</nobr></td>"; |
| 525 | 523 | ||
| 526 | return {html: html, init: callback}; | 524 | return {html: html, init: callback}; |
setup/migrate/steps/migrateComplete.php
| @@ -164,7 +164,6 @@ class migrateComplete extends Step { | @@ -164,7 +164,6 @@ class migrateComplete extends Step { | ||
| 164 | if($state == "STARTED" || $state == "RUNNING") | 164 | if($state == "STARTED" || $state == "RUNNING") |
| 165 | $running = true; | 165 | $running = true; |
| 166 | } else { | 166 | } else { |
| 167 | - //TODO : Read fomr my.cnf file | ||
| 168 | $mysqlPid = "/var/run/mysqld/mysqld.sock"; | 167 | $mysqlPid = "/var/run/mysqld/mysqld.sock"; |
| 169 | if(file_exists($mysqlPid)) | 168 | if(file_exists($mysqlPid)) |
| 170 | $running = true; | 169 | $running = true; |
setup/migrate/steps/migrateDatabase.php
| @@ -155,31 +155,20 @@ class migrateDatabase extends Step | @@ -155,31 +155,20 @@ class migrateDatabase extends Step | ||
| 155 | unlink($sqlFile); | 155 | unlink($sqlFile); |
| 156 | } | 156 | } |
| 157 | } | 157 | } |
| 158 | - $noFile = true; | ||
| 159 | // Handle failed dump | 158 | // Handle failed dump |
| 160 | if(WINDOWS_OS) { | 159 | if(WINDOWS_OS) { |
| 161 | // Could be permissions, check error code. | 160 | // Could be permissions, check error code. |
| 162 | - if(!$noFile) { | ||
| 163 | - $sqlFile = "C:\\kt-backup-$date.sql"; // Use tmp instead due to permissions | ||
| 164 | - } | 161 | + $sqlFile = "C:\\kt-backup-$date.sql"; // Use tmp instead due to permissions |
| 165 | } else { | 162 | } else { |
| 166 | - if(!$noFile) { | ||
| 167 | - $sqlFile = "/tmp/kt-backup-$date.sql"; // Use tmp instead due to permissions | ||
| 168 | - } | 163 | + $sqlFile = "/tmp/kt-backup-$date.sql"; // Use tmp instead due to permissions |
| 169 | } | 164 | } |
| 170 | $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile; | 165 | $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile; |
| 171 | - if($noFile) { | ||
| 172 | - $this->error[]['error'] = "The KnowledgeTree Setup Wizard was unable to connect to your KnowledgeTree 3.6.1 database."; | ||
| 173 | - $this->error[]['msg'] = "Ensure that your KnowledgeTree Mysql service is running."; | ||
| 174 | - $this->error[]['cmd'] = "Click <b>Next</b> after resolving the above errors."; | ||
| 175 | - $this->temp_variables['manual_export'] = ""; | ||
| 176 | - } else { | ||
| 177 | - $this->error[]['error'] = "Could not export database:"; | ||
| 178 | - $this->error[]['msg'] = "Execute the following command in a $termOrBash."; | ||
| 179 | - $this->error[]['cmd'] = $cmd; | ||
| 180 | - $this->temp_variables['manual_export'] = $sqlFile; | ||
| 181 | - } | ||
| 182 | - | 166 | + $this->error[]['error'] = "The KnowledgeTree Setup Wizard was unable to connect to your KnowledgeTree 3.6.1 database."; |
| 167 | + $this->error[]['msg'] = "Ensure that your KnowledgeTree Mysql service is running."; | ||
| 168 | + $this->error[]['cmd'] = "Click <b>Next</b> after resolving the above errors."; | ||
| 169 | + $this->temp_variables['dumpLocation'] = $sqlFile; | ||
| 170 | + $this->temp_variables['manual_export'] = $sqlFile; | ||
| 171 | + $this->error[]['manual'] = $cmd; | ||
| 183 | return false; | 172 | return false; |
| 184 | } | 173 | } |
| 185 | 174 | ||
| @@ -274,7 +263,7 @@ class migrateDatabase extends Step | @@ -274,7 +263,7 @@ class migrateDatabase extends Step | ||
| 274 | return $this->error; | 263 | return $this->error; |
| 275 | } | 264 | } |
| 276 | 265 | ||
| 277 | - private function storeSilent() { | 266 | + public function storeSilent() { |
| 278 | // TODO | 267 | // TODO |
| 279 | $_SESSION['migrate']['database']['dumpLocation'] = $this->sqlDumpFile; | 268 | $_SESSION['migrate']['database']['dumpLocation'] = $this->sqlDumpFile; |
| 280 | $this->temp_variables['dumpLocation'] = $this->sqlDumpFile; | 269 | $this->temp_variables['dumpLocation'] = $this->sqlDumpFile; |
setup/migrate/steps/migrateServices.php
| @@ -398,7 +398,7 @@ class migrateServices extends Step | @@ -398,7 +398,7 @@ class migrateServices extends Step | ||
| 398 | * @access private | 398 | * @access private |
| 399 | * @return void | 399 | * @return void |
| 400 | */ | 400 | */ |
| 401 | - private function storeSilent() { | 401 | + public function storeSilent() { |
| 402 | $this->temp_variables['alreadyUninstalled'] = $this->alreadyUninstalled; | 402 | $this->temp_variables['alreadyUninstalled'] = $this->alreadyUninstalled; |
| 403 | $this->temp_variables['serviceCheck'] = $this->serviceCheck; | 403 | $this->temp_variables['serviceCheck'] = $this->serviceCheck; |
| 404 | $this->temp_variables['msg'] = "Turn off KnowledgeTree Mysql Instance."; | 404 | $this->temp_variables['msg'] = "Turn off KnowledgeTree Mysql Instance."; |
setup/migrate/templates/database.tpl
| @@ -118,6 +118,16 @@ | @@ -118,6 +118,16 @@ | ||
| 118 | <?php } ?> | 118 | <?php } ?> |
| 119 | </p> | 119 | </p> |
| 120 | <br/> | 120 | <br/> |
| 121 | +<p class="description"> | ||
| 122 | + Manually perform a KnowledgeTree 3.6.1 database export | ||
| 123 | +</p> | ||
| 124 | +<p class="disclaimer"> | ||
| 125 | +<?php | ||
| 126 | +if(isset($error['manual'])) { | ||
| 127 | + echo $error['manual']; | ||
| 128 | + } | ||
| 129 | +?> | ||
| 130 | +</p> | ||
| 121 | <?php | 131 | <?php |
| 122 | } | 132 | } |
| 123 | ?> | 133 | ?> |
setup/migrate/templates/wizard.tpl
| @@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
| 21 | <div id="outer-wrapper" align="left"> | 21 | <div id="outer-wrapper" align="left"> |
| 22 | <div id="header"> | 22 | <div id="header"> |
| 23 | <div id="logo"><?php echo $html->image('dame/installer-header_logo.png'); ?> </div> | 23 | <div id="logo"><?php echo $html->image('dame/installer-header_logo.png'); ?> </div> |
| 24 | - <div id="install_details"> | 24 | + <div id="version_details"> |
| 25 | <span style="font-size:120%;"> <?php if (isset($vars['migrate_version'])) echo $vars['migrate_version']; ?> </span> | 25 | <span style="font-size:120%;"> <?php if (isset($vars['migrate_version'])) echo $vars['migrate_version']; ?> </span> |
| 26 | <span style="font-size:120%;"> <?php if (isset($vars['migrate_version'])) echo $vars['migrate_type']; ?></span> | 26 | <span style="font-size:120%;"> <?php if (isset($vars['migrate_version'])) echo $vars['migrate_type']; ?></span> |
| 27 | </div> | 27 | </div> |
setup/upgrade/steps/upgradeComplete.php
| @@ -88,7 +88,7 @@ class upgradeComplete extends Step { | @@ -88,7 +88,7 @@ class upgradeComplete extends Step { | ||
| 88 | * Set all silent mode varibles | 88 | * Set all silent mode varibles |
| 89 | * | 89 | * |
| 90 | */ | 90 | */ |
| 91 | - protected function storeSilent() { | 91 | + public function storeSilent() { |
| 92 | $v = $this->getDataFromSession('upgradeProperties'); | 92 | $v = $this->getDataFromSession('upgradeProperties'); |
| 93 | $this->temp_variables['sysVersion'] = $this->util->readVersion(); | 93 | $this->temp_variables['sysVersion'] = $this->util->readVersion(); |
| 94 | $this->temp_variables['migrateCheck'] = $this->migrateCheck; | 94 | $this->temp_variables['migrateCheck'] = $this->migrateCheck; |
setup/upgrade/templates/complete.tpl
| @@ -31,11 +31,15 @@ | @@ -31,11 +31,15 @@ | ||
| 31 | <br/> | 31 | <br/> |
| 32 | [START MENU] => [Programs] => [KnowledgeTree 3.7.x] => [services] | 32 | [START MENU] => [Programs] => [KnowledgeTree 3.7.x] => [services] |
| 33 | <br/> | 33 | <br/> |
| 34 | - Right-Click and run [Install Services] as administrator | 34 | + Right-Click and run [Install Services] as administrator, if applicable, or |
| 35 | + <br/> | ||
| 36 | + Click [Install Services] | ||
| 35 | <br/> | 37 | <br/> |
| 36 | [START MENU] => [Programs] => [KnowledgeTree 3.7.x] => [services] | 38 | [START MENU] => [Programs] => [KnowledgeTree 3.7.x] => [services] |
| 37 | <br/> | 39 | <br/> |
| 38 | - Right-Click and run [Start Services] as administrator | 40 | + Right-Click and run [Start Services] as administrator, if applicable, or |
| 41 | + <br/> | ||
| 42 | + Click [Start Services] | ||
| 39 | <br/> | 43 | <br/> |
| 40 | <br/> | 44 | <br/> |
| 41 | <b>Alternatively:</b> | 45 | <b>Alternatively:</b> |
setup/upgrade/templates/wizard.tpl
| @@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
| 21 | <div id="outer-wrapper" align="left"> | 21 | <div id="outer-wrapper" align="left"> |
| 22 | <div id="header"> | 22 | <div id="header"> |
| 23 | <div id="logo"><?php echo $html->image('dame/installer-header_logo.png'); ?></div> | 23 | <div id="logo"><?php echo $html->image('dame/installer-header_logo.png'); ?></div> |
| 24 | - <div id="upgrade_details"> | 24 | + <div id="version_details"> |
| 25 | <span style="font-size:120%;"> <?php echo $vars['upgrade_version']; ?> </span> | 25 | <span style="font-size:120%;"> <?php echo $vars['upgrade_version']; ?> </span> |
| 26 | <span style="font-size:120%;"> <?php echo $vars['upgrade_type']; ?> </span> | 26 | <span style="font-size:120%;"> <?php echo $vars['upgrade_type']; ?> </span> |
| 27 | </div> | 27 | </div> |
setup/wizard/resources/css/wizard.css
| 1 | * { margin: 0; padding: 0; } | 1 | * { margin: 0; padding: 0; } |
| 2 | - | ||
| 3 | body { | 2 | body { |
| 4 | background-attachment:scroll; | 3 | background-attachment:scroll; |
| 5 | background-color:transparent; | 4 | background-color:transparent; |
| @@ -70,7 +69,7 @@ select { | @@ -70,7 +69,7 @@ select { | ||
| 70 | #outer-wrapper { | 69 | #outer-wrapper { |
| 71 | border:1px solid #B7B7B7; | 70 | border:1px solid #B7B7B7; |
| 72 | margin-top:20px; | 71 | margin-top:20px; |
| 73 | - /*width:1024px;*/width:964px; | 72 | + width:964px; |
| 74 | } | 73 | } |
| 75 | 74 | ||
| 76 | #header { | 75 | #header { |
| @@ -87,12 +86,12 @@ select { | @@ -87,12 +86,12 @@ select { | ||
| 87 | #container { | 86 | #container { |
| 88 | background: white url("../graphics/left.png") repeat-y left; | 87 | background: white url("../graphics/left.png") repeat-y left; |
| 89 | overflow:auto; | 88 | overflow:auto; |
| 90 | - /*min-height:630px;height:410px;*/min-height:500px; | 89 | + min-height:500px; |
| 91 | } | 90 | } |
| 92 | 91 | ||
| 93 | #content { | 92 | #content { |
| 94 | margin-left: 220px; | 93 | margin-left: 220px; |
| 95 | - /*height:515px;*/height:500px; | 94 | + height:500px; |
| 96 | } | 95 | } |
| 97 | 96 | ||
| 98 | #content_container { | 97 | #content_container { |
| @@ -105,19 +104,19 @@ select { | @@ -105,19 +104,19 @@ select { | ||
| 105 | border: 1px solid rgb(207, 207, 207); | 104 | border: 1px solid rgb(207, 207, 207); |
| 106 | padding: 5px; | 105 | padding: 5px; |
| 107 | overflow: auto; | 106 | overflow: auto; |
| 108 | - /*min-height: 400px;*/min-height: 300px; | 107 | + min-height: 300px; |
| 109 | } | 108 | } |
| 110 | 109 | ||
| 111 | #step_content_dependencies { | 110 | #step_content_dependencies { |
| 112 | border: 1px solid rgb(207, 207, 207); | 111 | border: 1px solid rgb(207, 207, 207); |
| 113 | - /*padding: 5px;*/padding: 12px; | ||
| 114 | - /*min-height:270px;*/min-height:170px; | 112 | + padding: 12px; |
| 113 | + /min-height:170px; | ||
| 115 | } | 114 | } |
| 116 | 115 | ||
| 117 | #step_content_configuration { | 116 | #step_content_configuration { |
| 118 | border: 1px solid rgb(207, 207, 207); | 117 | border: 1px solid rgb(207, 207, 207); |
| 119 | padding: 5px; | 118 | padding: 5px; |
| 120 | - /*min-height:320px;*//*height:330px*/min-height:130px; | 119 | + min-height:130px; |
| 121 | } | 120 | } |
| 122 | 121 | ||
| 123 | #step_content_services { | 122 | #step_content_services { |
| @@ -129,25 +128,25 @@ select { | @@ -129,25 +128,25 @@ select { | ||
| 129 | #step_content_registration { | 128 | #step_content_registration { |
| 130 | border: 1px solid rgb(207, 207, 207); | 129 | border: 1px solid rgb(207, 207, 207); |
| 131 | padding: 5px; | 130 | padding: 5px; |
| 132 | - /*min-height:320px;*/min-height:100px; | 131 | + min-height:100px; |
| 133 | } | 132 | } |
| 134 | 133 | ||
| 135 | #step_content_registration_confirm { | 134 | #step_content_registration_confirm { |
| 136 | border: 1px solid rgb(207, 207, 207); | 135 | border: 1px solid rgb(207, 207, 207); |
| 137 | padding: 5px; | 136 | padding: 5px; |
| 138 | - /*min-height:400px;*/min-height:300px; | 137 | + min-height:300px; |
| 139 | } | 138 | } |
| 140 | 139 | ||
| 141 | #step_content_install { | 140 | #step_content_install { |
| 142 | border: 1px solid rgb(207, 207, 207); | 141 | border: 1px solid rgb(207, 207, 207); |
| 143 | padding: 5px; | 142 | padding: 5px; |
| 144 | - /*min-height:400px;*/min-height:150px; | 143 | + min-height:150px; |
| 145 | } | 144 | } |
| 146 | 145 | ||
| 147 | #step_content_database { | 146 | #step_content_database { |
| 148 | border: 1px solid rgb(207, 207, 207); | 147 | border: 1px solid rgb(207, 207, 207); |
| 149 | padding: 5px; | 148 | padding: 5px; |
| 150 | - /*min-height:365px;*/min-height:240px; | 149 | + min-height:240px; |
| 151 | } | 150 | } |
| 152 | 151 | ||
| 153 | #step_content_database_confirm { | 152 | #step_content_database_confirm { |
| @@ -164,7 +163,7 @@ select { | @@ -164,7 +163,7 @@ select { | ||
| 164 | 163 | ||
| 165 | .license_agreement { | 164 | .license_agreement { |
| 166 | overflow: scroll; | 165 | overflow: scroll; |
| 167 | - /*height:370px;*/height:270px; | 166 | + height:270px; |
| 168 | overflow-x:hidden; | 167 | overflow-x:hidden; |
| 169 | border:1px solid #CFCFCF; | 168 | border:1px solid #CFCFCF; |
| 170 | } | 169 | } |
| @@ -204,11 +203,11 @@ select { | @@ -204,11 +203,11 @@ select { | ||
| 204 | 203 | ||
| 205 | #logo { | 204 | #logo { |
| 206 | position:relative; | 205 | position:relative; |
| 207 | - /*right:760px;*/right:75%; | ||
| 208 | - /*top:20px;*/top:25%; | 206 | + right:75%; |
| 207 | + top:25%; | ||
| 209 | } | 208 | } |
| 210 | 209 | ||
| 211 | -#install_details { | 210 | +#version_details { |
| 212 | bottom:20px; | 211 | bottom:20px; |
| 213 | position:relative; | 212 | position:relative; |
| 214 | right:10px; | 213 | right:10px; |
| @@ -282,7 +281,7 @@ select { | @@ -282,7 +281,7 @@ select { | ||
| 282 | } | 281 | } |
| 283 | 282 | ||
| 284 | .conf_paths { | 283 | .conf_paths { |
| 285 | - /*width:755px;*/width:100%; | 284 | + width:100%; |
| 286 | } | 285 | } |
| 287 | 286 | ||
| 288 | .errors { | 287 | .errors { |
| @@ -320,7 +319,6 @@ select { | @@ -320,7 +319,6 @@ select { | ||
| 320 | font-size:13px; | 319 | font-size:13px; |
| 321 | font-weight:bold; | 320 | font-weight:bold; |
| 322 | margin-left:5px; | 321 | margin-left:5px; |
| 323 | - /*margin-top:10px;*/ | ||
| 324 | } | 322 | } |
| 325 | 323 | ||
| 326 | .step .radio { | 324 | .step .radio { |
| @@ -368,7 +366,9 @@ select { | @@ -368,7 +366,9 @@ select { | ||
| 368 | .onclick { | 366 | .onclick { |
| 369 | cursor: pointer; | 367 | cursor: pointer; |
| 370 | color: #EC7725; | 368 | color: #EC7725; |
| 371 | - /*width: 150px;*//*width:350px;top:12px;position:relative;*/width:350px;padding-top:12px;position:static; | 369 | + width:350px; |
| 370 | + padding-top:12px; | ||
| 371 | + position:static; | ||
| 372 | } | 372 | } |
| 373 | 373 | ||
| 374 | .description { | 374 | .description { |
| @@ -415,18 +415,10 @@ table#dbconf tr td input{ | @@ -415,18 +415,10 @@ table#dbconf tr td input{ | ||
| 415 | padding: 5px 8px; | 415 | padding: 5px 8px; |
| 416 | } | 416 | } |
| 417 | 417 | ||
| 418 | -/*#section { | ||
| 419 | - | ||
| 420 | -}*/ | ||
| 421 | - | ||
| 422 | .php_ext_details table { | 418 | .php_ext_details table { |
| 423 | - width:745px; | 419 | + width:645px; |
| 424 | } | 420 | } |
| 425 | 421 | ||
| 426 | -/*.php_ext_details table tr { | ||
| 427 | - | ||
| 428 | -}*/ | ||
| 429 | - | ||
| 430 | td.ext_indicator { | 422 | td.ext_indicator { |
| 431 | width:10px; | 423 | width:10px; |
| 432 | } | 424 | } |
| @@ -456,7 +448,7 @@ td.dir_description { | @@ -456,7 +448,7 @@ td.dir_description { | ||
| 456 | } | 448 | } |
| 457 | 449 | ||
| 458 | .php_con_details table { | 450 | .php_con_details table { |
| 459 | - /*width:745px;*/width:675px; | 451 | + width:675px; |
| 460 | } | 452 | } |
| 461 | 453 | ||
| 462 | .error_message { | 454 | .error_message { |
| @@ -515,12 +507,6 @@ td.dir_description { | @@ -515,12 +507,6 @@ td.dir_description { | ||
| 515 | font-size:12pt; | 507 | font-size:12pt; |
| 516 | } | 508 | } |
| 517 | 509 | ||
| 518 | -.demo { | ||
| 519 | - /*left:75px; | ||
| 520 | - position:relative; | ||
| 521 | - width:600px*/ | ||
| 522 | -} | ||
| 523 | - | ||
| 524 | .text_message { | 510 | .text_message { |
| 525 | 511 | ||
| 526 | } | 512 | } |
| @@ -540,7 +526,7 @@ td.dir_description { | @@ -540,7 +526,7 @@ td.dir_description { | ||
| 540 | 526 | ||
| 541 | #loading { | 527 | #loading { |
| 542 | bottom:250px; | 528 | bottom:250px; |
| 543 | - /*left:500px;*/left:400px; | 529 | + left:400px; |
| 544 | position:relative; | 530 | position:relative; |
| 545 | height:0px; | 531 | height:0px; |
| 546 | width:0px; | 532 | width:0px; |
| @@ -563,15 +549,15 @@ td.dir_description { | @@ -563,15 +549,15 @@ td.dir_description { | ||
| 563 | } | 549 | } |
| 564 | 550 | ||
| 565 | .dependency_details { | 551 | .dependency_details { |
| 566 | - /*top:12px;*/padding-top:12px; | ||
| 567 | - /*position:relative;*/position:static; | 552 | + padding-top:12px; |
| 553 | + position:static; | ||
| 568 | width:650px; | 554 | width:650px; |
| 569 | } | 555 | } |
| 570 | 556 | ||
| 571 | .dependencies { | 557 | .dependencies { |
| 572 | - /*position:relative;*/position:static; | 558 | + position:static; |
| 573 | right:30%; | 559 | right:30%; |
| 574 | - /*width:880px;*/width:650px; | 560 | + width:650px; |
| 575 | } | 561 | } |
| 576 | 562 | ||
| 577 | .registration_template { | 563 | .registration_template { |
| @@ -583,7 +569,7 @@ td.dir_description { | @@ -583,7 +569,7 @@ td.dir_description { | ||
| 583 | } | 569 | } |
| 584 | 570 | ||
| 585 | .description_complete { | 571 | .description_complete { |
| 586 | - /*position:relative;*/position:static; | 572 | + position:static; |
| 587 | right:35%; | 573 | right:35%; |
| 588 | width:100%; | 574 | width:100%; |
| 589 | } | 575 | } |
| @@ -603,14 +589,6 @@ td.dir_description { | @@ -603,14 +589,6 @@ td.dir_description { | ||
| 603 | font-family:sans-serif; | 589 | font-family:sans-serif; |
| 604 | } | 590 | } |
| 605 | 591 | ||
| 606 | -.twitter { | ||
| 607 | - | ||
| 608 | -} | ||
| 609 | - | ||
| 610 | -.facebook { | ||
| 611 | - | ||
| 612 | -} | ||
| 613 | - | ||
| 614 | .connect { | 592 | .connect { |
| 615 | float:none; | 593 | float:none; |
| 616 | padding-bottom:0; | 594 | padding-bottom:0; |
setup/wizard/steps/complete.php
| @@ -169,7 +169,6 @@ class complete extends Step { | @@ -169,7 +169,6 @@ class complete extends Step { | ||
| 169 | $this->util->dbUtilities->load($dbconf['dhost'], $dbconf['dport'], $dbconf['dmsusername'], $dbconf['dmsuserpassword'], $dbconf['dname']); | 169 | $this->util->dbUtilities->load($dbconf['dhost'], $dbconf['dport'], $dbconf['dmsusername'], $dbconf['dmsuserpassword'], $dbconf['dname']); |
| 170 | $loaded = $this->util->dbUtilities->getDatabaseLink(); | 170 | $loaded = $this->util->dbUtilities->getDatabaseLink(); |
| 171 | // if we can log in to the database, check access | 171 | // if we can log in to the database, check access |
| 172 | - // TODO check write access? | ||
| 173 | if ($loaded) | 172 | if ($loaded) |
| 174 | { | 173 | { |
| 175 | $this->temp_variables['dbConnectUser'] .= sprintf($html, 'tick', '', 'Database connectivity successful (user: ' . $dbconf['dmsusername'] . ')'); | 174 | $this->temp_variables['dbConnectUser'] .= sprintf($html, 'tick', '', 'Database connectivity successful (user: ' . $dbconf['dmsusername'] . ')'); |
| @@ -257,7 +256,7 @@ class complete extends Step { | @@ -257,7 +256,7 @@ class complete extends Step { | ||
| 257 | * Set all silent mode varibles | 256 | * Set all silent mode varibles |
| 258 | * | 257 | * |
| 259 | */ | 258 | */ |
| 260 | - private function storeSilent() { | 259 | + public function storeSilent() { |
| 261 | $this->temp_variables['services_check'] = $this->services_check; | 260 | $this->temp_variables['services_check'] = $this->services_check; |
| 262 | $this->temp_variables['paths_check'] = $this->paths_check; | 261 | $this->temp_variables['paths_check'] = $this->paths_check; |
| 263 | $this->temp_variables['privileges_check'] = $this->privileges_check; | 262 | $this->temp_variables['privileges_check'] = $this->privileges_check; |
setup/wizard/steps/configuration.php
| @@ -703,17 +703,17 @@ class configuration extends Step | @@ -703,17 +703,17 @@ class configuration extends Step | ||
| 703 | */ | 703 | */ |
| 704 | public function getContentPath() { | 704 | public function getContentPath() { |
| 705 | $configPath = realpath('../../../config/config-path'); | 705 | $configPath = realpath('../../../config/config-path'); |
| 706 | - if($configPath == '') | 706 | + if(!file_exists($configPath)) |
| 707 | $configPath = realpath('../../config/config-path'); | 707 | $configPath = realpath('../../config/config-path'); |
| 708 | - if(!$configPath) return false; | 708 | + if(!file_exists($configPath)) return false; |
| 709 | return $configPath; | 709 | return $configPath; |
| 710 | } | 710 | } |
| 711 | 711 | ||
| 712 | public function getCachePath() { | 712 | public function getCachePath() { |
| 713 | $cachePath = realpath('../../../config/cache-path'); | 713 | $cachePath = realpath('../../../config/cache-path'); |
| 714 | - if($cachePath == '') | 714 | + if(!file_exists($cachePath)) |
| 715 | $cachePath = realpath('../../config/cache-path'); | 715 | $cachePath = realpath('../../config/cache-path'); |
| 716 | - if(!$cachePath) return false; | 716 | + if(!file_exists($cachePath)) return false; |
| 717 | return $cachePath; | 717 | return $cachePath; |
| 718 | } | 718 | } |
| 719 | } | 719 | } |
setup/wizard/steps/database.php
| @@ -150,22 +150,13 @@ class database extends Step | @@ -150,22 +150,13 @@ class database extends Step | ||
| 150 | private $dmsuserpassword = ''; | 150 | private $dmsuserpassword = ''; |
| 151 | 151 | ||
| 152 | /** | 152 | /** |
| 153 | - * Location of database binaries. | ||
| 154 | - * | ||
| 155 | - * @author KnowledgeTree Team | ||
| 156 | - * @access private | ||
| 157 | - * @var string | ||
| 158 | - */ | ||
| 159 | - private $mysqlDir; // TODO:multiple databases | ||
| 160 | - | ||
| 161 | - /** | ||
| 162 | * Name of database binary. | 153 | * Name of database binary. |
| 163 | * | 154 | * |
| 164 | * @author KnowledgeTree Team | 155 | * @author KnowledgeTree Team |
| 165 | * @access private | 156 | * @access private |
| 166 | * @var string | 157 | * @var string |
| 167 | */ | 158 | */ |
| 168 | - private $dbbinary = ''; // TODO:multiple databases | 159 | + private $dbbinary = ''; |
| 169 | 160 | ||
| 170 | /** | 161 | /** |
| 171 | * Database table prefix | 162 | * Database table prefix |
| @@ -230,7 +221,7 @@ class database extends Step | @@ -230,7 +221,7 @@ class database extends Step | ||
| 230 | */ | 221 | */ |
| 231 | protected $silent = true; | 222 | protected $silent = true; |
| 232 | 223 | ||
| 233 | - private $salt = 'installers'; | 224 | + //protected $salt = 'installers'; |
| 234 | 225 | ||
| 235 | /** | 226 | /** |
| 236 | * Main control of database setup | 227 | * Main control of database setup |
| @@ -284,7 +275,8 @@ class database extends Step | @@ -284,7 +275,8 @@ class database extends Step | ||
| 284 | $this->setPostConfig(); // Set any posted variables | 275 | $this->setPostConfig(); // Set any posted variables |
| 285 | return 'next'; | 276 | return 'next'; |
| 286 | } else if($this->edit()) { | 277 | } else if($this->edit()) { |
| 287 | - $this->setDataFromSession("database"); // Set Session Information, since its an edit | 278 | + if($this->setDataFromSession("database")) // Set Session Information, since its an edit |
| 279 | + $this->setDetails(); // Set any posted variables | ||
| 288 | $this->temp_variables['state'] = 'edit'; | 280 | $this->temp_variables['state'] = 'edit'; |
| 289 | 281 | ||
| 290 | return 'landing'; | 282 | return 'landing'; |
| @@ -363,8 +355,8 @@ class database extends Step | @@ -363,8 +355,8 @@ class database extends Step | ||
| 363 | * @return boolean | 355 | * @return boolean |
| 364 | */ | 356 | */ |
| 365 | private function setErrorsFromSession() { | 357 | private function setErrorsFromSession() { |
| 366 | - if(isset($_SESSION[$this->salt]['database']['errors'])) { | ||
| 367 | - $this->error[] = $_SESSION[$this->salt]['database']['errors']; | 358 | + if(isset($_SESSION['installers']['database']['errors'])) { |
| 359 | + $this->error[] = $_SESSION['installers']['database']['errors']; | ||
| 368 | 360 | ||
| 369 | return true; | 361 | return true; |
| 370 | } | 362 | } |
| @@ -382,7 +374,7 @@ class database extends Step | @@ -382,7 +374,7 @@ class database extends Step | ||
| 382 | */ | 374 | */ |
| 383 | public function setPostConfig() { | 375 | public function setPostConfig() { |
| 384 | $this->dtype = $this->getPostSafe("dtype"); | 376 | $this->dtype = $this->getPostSafe("dtype"); |
| 385 | - $this->dtypes = array("0"=>"mysql"); // TODO:multiple databases | 377 | + $this->dtypes = array("0"=>"mysql"); |
| 386 | $this->dhost = $this->getPostSafe("dhost"); | 378 | $this->dhost = $this->getPostSafe("dhost"); |
| 387 | $this->dport = $this->getPostSafe("dport"); | 379 | $this->dport = $this->getPostSafe("dport"); |
| 388 | $this->dname = $this->getPostSafe("dname"); | 380 | $this->dname = $this->getPostSafe("dname"); |
| @@ -408,7 +400,7 @@ class database extends Step | @@ -408,7 +400,7 @@ class database extends Step | ||
| 408 | public function loadDefaults($simplexml) { | 400 | public function loadDefaults($simplexml) { |
| 409 | if($simplexml) { | 401 | if($simplexml) { |
| 410 | $this->temp_variables['dtype'] = ""; | 402 | $this->temp_variables['dtype'] = ""; |
| 411 | - $this->temp_variables['dtypes'] = array("0"=>"mysql"); // TODO:multiple databases | 403 | + $this->temp_variables['dtypes'] = array("0"=>"mysql"); |
| 412 | $this->temp_variables['dname'] = (string) $simplexml->dname; | 404 | $this->temp_variables['dname'] = (string) $simplexml->dname; |
| 413 | $this->temp_variables['duname'] = (string) $simplexml->duname; | 405 | $this->temp_variables['duname'] = (string) $simplexml->duname; |
| 414 | $this->temp_variables['dhost'] = (string) $simplexml->dhost; | 406 | $this->temp_variables['dhost'] = (string) $simplexml->dhost; |
| @@ -416,8 +408,8 @@ class database extends Step | @@ -416,8 +408,8 @@ class database extends Step | ||
| 416 | $this->temp_variables['dpassword'] = ''; | 408 | $this->temp_variables['dpassword'] = ''; |
| 417 | $this->temp_variables['dmsname'] = (string) $simplexml->dmsadminuser; | 409 | $this->temp_variables['dmsname'] = (string) $simplexml->dmsadminuser; |
| 418 | $this->temp_variables['dmsusername'] = (string) $simplexml->dmsuser; | 410 | $this->temp_variables['dmsusername'] = (string) $simplexml->dmsuser; |
| 419 | - $this->temp_variables['dmspassword'] = (string) $simplexml->dmsaupass; | ||
| 420 | - $this->temp_variables['dmsuserpassword'] = (string) $simplexml->dmsupass; | 411 | + $this->temp_variables['dmspassword'] = substr(md5(rand()), 0, 9); |
| 412 | + $this->temp_variables['dmsuserpassword'] = substr(md5(rand()), 0, 9); | ||
| 421 | if(WINDOWS_OS) { | 413 | if(WINDOWS_OS) { |
| 422 | $this->temp_variables['dbbinary'] = 'mysql.exe'; | 414 | $this->temp_variables['dbbinary'] = 'mysql.exe'; |
| 423 | } else { | 415 | } else { |
| @@ -445,7 +437,7 @@ class database extends Step | @@ -445,7 +437,7 @@ class database extends Step | ||
| 445 | $this->temp_variables['state'] = ''; | 437 | $this->temp_variables['state'] = ''; |
| 446 | } | 438 | } |
| 447 | $this->temp_variables['dtype'] = $this->getPostSafe('dtype'); | 439 | $this->temp_variables['dtype'] = $this->getPostSafe('dtype'); |
| 448 | - $this->temp_variables['dtypes'] = array("0"=>"mysql"); // TODO:multiple databases; | 440 | + $this->temp_variables['dtypes'] = array("0"=>"mysql"); |
| 449 | $this->temp_variables['dhost'] = $this->getPostSafe('dhost'); | 441 | $this->temp_variables['dhost'] = $this->getPostSafe('dhost'); |
| 450 | $this->temp_variables['dport'] = $this->getPostSafe('dport'); | 442 | $this->temp_variables['dport'] = $this->getPostSafe('dport'); |
| 451 | $this->temp_variables['dname'] = $this->getPostSafe('dname'); | 443 | $this->temp_variables['dname'] = $this->getPostSafe('dname'); |
| @@ -771,16 +763,34 @@ class database extends Step | @@ -771,16 +763,34 @@ class database extends Step | ||
| 771 | $dbMigrate = $this->util->getDataFromPackage('migrate', 'database'); | 763 | $dbMigrate = $this->util->getDataFromPackage('migrate', 'database'); |
| 772 | $sqlFile = $dbMigrate['dumpLocation']; | 764 | $sqlFile = $dbMigrate['dumpLocation']; |
| 773 | $this->parse_mysql_dump($sqlFile); | 765 | $this->parse_mysql_dump($sqlFile); |
| 774 | - $dropPluginHelper = "TRUNCATE plugin_helper;"; // Remove plugin helper table | ||
| 775 | - $this->util->dbUtilities->query($dropPluginHelper); | 766 | + $this->prepDatabase(); |
| 767 | + | ||
| 768 | + return true; | ||
| 769 | + } | ||
| 770 | + | ||
| 771 | + private function prepDatabase() { | ||
| 772 | + $this->truncatePluginHelper(); | ||
| 773 | + $this->truncateActiveSessions(); | ||
| 776 | $this->addServerPort(); | 774 | $this->addServerPort(); |
| 777 | - $updateExternalBinaries = 'UPDATE config_settings c SET c.value = "default" where c.group_name = "externalBinary";'; // Remove references to old paths | ||
| 778 | - $this->util->dbUtilities->query($updateExternalBinaries); | 775 | + $this->updateConfigSettings(); |
| 779 | $this->reBuildPaths(); | 776 | $this->reBuildPaths(); |
| 780 | $this->writeBinaries(); // Rebuild some of the binaries | 777 | $this->writeBinaries(); // Rebuild some of the binaries |
| 781 | - $this->util->getSystemIdentifier(); // ensure a guid was generated and is stored | ||
| 782 | - | ||
| 783 | - return true; | 778 | + $this->util->getSystemIdentifier(); // ensure a guid was generated and is stored |
| 779 | + } | ||
| 780 | + | ||
| 781 | + private function truncateActiveSessions() { | ||
| 782 | + $dropActiveSessions = "TRUNCATE active_sessions;"; // Remove plugin helper table | ||
| 783 | + $this->util->dbUtilities->query($dropActiveSessions); | ||
| 784 | + } | ||
| 785 | + | ||
| 786 | + private function truncatePluginHelper() { | ||
| 787 | + $dropPluginHelper = "TRUNCATE plugin_helper;"; // Remove plugin helper table | ||
| 788 | + $this->util->dbUtilities->query($dropPluginHelper); | ||
| 789 | + } | ||
| 790 | + | ||
| 791 | + private function updateConfigSettings() { | ||
| 792 | + $updateExternalBinaries = 'UPDATE config_settings c SET c.value = "default" where c.group_name = "externalBinary";'; // Remove references to old paths | ||
| 793 | + $this->util->dbUtilities->query($updateExternalBinaries); | ||
| 784 | } | 794 | } |
| 785 | 795 | ||
| 786 | private function reBuildPaths() { | 796 | private function reBuildPaths() { |
| @@ -876,7 +886,7 @@ class database extends Step | @@ -876,7 +886,7 @@ class database extends Step | ||
| 876 | private function closeMysql() { | 886 | private function closeMysql() { |
| 877 | try { | 887 | try { |
| 878 | $this->util->dbUtilities->close(); | 888 | $this->util->dbUtilities->close(); |
| 879 | - } catch (Exeption $e) { | 889 | + } catch (Exception $e) { |
| 880 | $this->error['con'] = "Could not close: " . $e; | 890 | $this->error['con'] = "Could not close: " . $e; |
| 881 | } | 891 | } |
| 882 | } | 892 | } |
setup/wizard/steps/services.php
| @@ -245,8 +245,7 @@ class services extends Step | @@ -245,8 +245,7 @@ class services extends Step | ||
| 245 | $this->serviceCheck = 'tick'; | 245 | $this->serviceCheck = 'tick'; |
| 246 | } | 246 | } |
| 247 | $this->storeSilent(); // Store info needed for silent mode | 247 | $this->storeSilent(); // Store info needed for silent mode |
| 248 | - if(!empty($errors)) | ||
| 249 | - return false; | 248 | + |
| 250 | return true; | 249 | return true; |
| 251 | } | 250 | } |
| 252 | 251 |
setup/wizard/templates/database.tpl
| @@ -21,7 +21,6 @@ | @@ -21,7 +21,6 @@ | ||
| 21 | $input_size = '45'; | 21 | $input_size = '45'; |
| 22 | $align = 'left'; | 22 | $align = 'left'; |
| 23 | ?> | 23 | ?> |
| 24 | -<!-- TODO: Different Databases--> | ||
| 25 | <?php if($state != 'edit') { ?> | 24 | <?php if($state != 'edit') { ?> |
| 26 | <tr><td>Your current database type is: </td> | 25 | <tr><td>Your current database type is: </td> |
| 27 | <?php if($dtypes) { | 26 | <?php if($dtypes) { |
| @@ -86,7 +85,6 @@ | @@ -86,7 +85,6 @@ | ||
| 86 | <input type="button" name="Next" value="Next" onclick="javascript:{w.showStep(1, 'n');}" class="button_next"/> | 85 | <input type="button" name="Next" value="Next" onclick="javascript:{w.showStep(1, 'n');}" class="button_next"/> |
| 87 | <?php } ?> | 86 | <?php } ?> |
| 88 | </div> | 87 | </div> |
| 89 | - | ||
| 90 | <!-- STEP 2 of the database configuration - Admin user password settings --> | 88 | <!-- STEP 2 of the database configuration - Admin user password settings --> |
| 91 | <div id="database" class="step2" style="display:none;"> | 89 | <div id="database" class="step2" style="display:none;"> |
| 92 | <div class="description"> | 90 | <div class="description"> |
| @@ -114,7 +112,6 @@ An administrative user is required for creating tables within the database. | @@ -114,7 +112,6 @@ An administrative user is required for creating tables within the database. | ||
| 114 | <input type="button" name="Previous" value="Previous" onclick="javascript:{w.showStep(2, 'p');}" class="button_previous"/> | 112 | <input type="button" name="Previous" value="Previous" onclick="javascript:{w.showStep(2, 'p');}" class="button_previous"/> |
| 115 | <input type="button" name="Next" value="Next" onclick="javascript:{w.showStep(2, 'n');}" class="button_next"/> | 113 | <input type="button" name="Next" value="Next" onclick="javascript:{w.showStep(2, 'n');}" class="button_next"/> |
| 116 | </div> | 114 | </div> |
| 117 | - | ||
| 118 | <!-- STEP 3 of the database configuration - default user password settings --> | 115 | <!-- STEP 3 of the database configuration - default user password settings --> |
| 119 | <div id="database" class="step3" style="display:none;"> | 116 | <div id="database" class="step3" style="display:none;"> |
| 120 | <div class="description"> | 117 | <div class="description"> |
setup/wizard/templates/database_confirm.tpl
| 1 | <form id="services_database_registration" action="index.php?step_name=<?php echo $step_name; ?>" method="post"> | 1 | <form id="services_database_registration" action="index.php?step_name=<?php echo $step_name; ?>" method="post"> |
| 2 | <p class="title">Confirming Database Configurations</p> | 2 | <p class="title">Confirming Database Configurations</p> |
| 3 | - | ||
| 4 | <div class="description"> | 3 | <div class="description"> |
| 5 | Confirm whether KnowledgeTree has correctly determined your database settings before proceeding. Print this page for future use. <a href="javascript:window.print()">Click to Print This Page</a> | 4 | Confirm whether KnowledgeTree has correctly determined your database settings before proceeding. Print this page for future use. <a href="javascript:window.print()">Click to Print This Page</a> |
| 6 | </div> | 5 | </div> |
| @@ -41,9 +40,7 @@ | @@ -41,9 +40,7 @@ | ||
| 41 | </tr> | 40 | </tr> |
| 42 | <?php } ?> | 41 | <?php } ?> |
| 43 | </table> | 42 | </table> |
| 44 | - <!--</div>--> | ||
| 45 | <h3><b>Advanced Settings</b></h3> | 43 | <h3><b>Advanced Settings</b></h3> |
| 46 | - | ||
| 47 | <table class="dbconf"> | 44 | <table class="dbconf"> |
| 48 | <tr> | 45 | <tr> |
| 49 | <td width="153px">Host: </td> | 46 | <td width="153px">Host: </td> |
| @@ -68,29 +65,23 @@ | @@ -68,29 +65,23 @@ | ||
| 68 | </tr> | 65 | </tr> |
| 69 | <?php } ?> | 66 | <?php } ?> |
| 70 | </table> | 67 | </table> |
| 71 | - | ||
| 72 | <h3><b>Database Users (System Generated)</b></h3> | 68 | <h3><b>Database Users (System Generated)</b></h3> |
| 73 | - | ||
| 74 | <table class="dbconf"> | 69 | <table class="dbconf"> |
| 75 | - <?php //if (!$silent) { ?> | ||
| 76 | <tr> | 70 | <tr> |
| 77 | <td width="153px">DMS Admin Username: </td> | 71 | <td width="153px">DMS Admin Username: </td> |
| 78 | <td width="15px"> <div id="tooltips" title="Database Administrative User for KnowledgeTree System"> </div> </td> | 72 | <td width="15px"> <div id="tooltips" title="Database Administrative User for KnowledgeTree System"> </div> </td> |
| 79 | <td><?php echo $dmsname; ?></td> | 73 | <td><?php echo $dmsname; ?></td> |
| 80 | </tr> | 74 | </tr> |
| 81 | - <?php //} ?> | ||
| 82 | <tr> | 75 | <tr> |
| 83 | <td>DMS Admin Password: </td> | 76 | <td>DMS Admin Password: </td> |
| 84 | <td> <div id="tooltips" title="Database Administrative User password"> </div> </td> | 77 | <td> <div id="tooltips" title="Database Administrative User password"> </div> </td> |
| 85 | <td><?php echo $dmspassword; ?></td> | 78 | <td><?php echo $dmspassword; ?></td> |
| 86 | </tr> | 79 | </tr> |
| 87 | - <?php //if (!$silent) { ?> | ||
| 88 | <tr> | 80 | <tr> |
| 89 | <td>DMS User Username: </td> | 81 | <td>DMS User Username: </td> |
| 90 | <td> <div id="tooltips" title="Database User for KnowledgeTree System"> </div> </td> | 82 | <td> <div id="tooltips" title="Database User for KnowledgeTree System"> </div> </td> |
| 91 | <td><?php echo $dmsusername; ?></td> | 83 | <td><?php echo $dmsusername; ?></td> |
| 92 | </tr> | 84 | </tr> |
| 93 | - <?php //} ?> | ||
| 94 | <tr> | 85 | <tr> |
| 95 | <td>DMS User Password: </td> | 86 | <td>DMS User Password: </td> |
| 96 | <td> <div id="tooltips" title="Database User password"> </div> </td> | 87 | <td> <div id="tooltips" title="Database User password"> </div> </td> |
setup/wizard/templates/wizard.tpl
| @@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
| 20 | <div id="outer-wrapper" align="left"> | 20 | <div id="outer-wrapper" align="left"> |
| 21 | <div id="header"> | 21 | <div id="header"> |
| 22 | <div id="logo"><?php echo $html->image('dame/installer-header_logo.png'); ?> </div> | 22 | <div id="logo"><?php echo $html->image('dame/installer-header_logo.png'); ?> </div> |
| 23 | - <div id="install_details"> | 23 | + <div id="version_details"> |
| 24 | <span style="font-size:120%;"> <?php echo $vars['install_version']; ?> </span> | 24 | <span style="font-size:120%;"> <?php echo $vars['install_version']; ?> </span> |
| 25 | <span style="font-size:120%;"><?php echo $vars['install_type']; ?></span> | 25 | <span style="font-size:120%;"><?php echo $vars['install_type']; ?></span> |
| 26 | </div> | 26 | </div> |
| @@ -45,7 +45,6 @@ | @@ -45,7 +45,6 @@ | ||
| 45 | </div> | 45 | </div> |
| 46 | <div class="clearing"> </div> | 46 | <div class="clearing"> </div> |
| 47 | </div> | 47 | </div> |
| 48 | - | ||
| 49 | <div id="footer"> | 48 | <div id="footer"> |
| 50 | <?php echo $html->image('dame/powered-by-kt.png', array("height"=>"23px", "width"=>"105px", "style"=>"padding: 5px;")); ?> | 49 | <?php echo $html->image('dame/powered-by-kt.png', array("height"=>"23px", "width"=>"105px", "style"=>"padding: 5px;")); ?> |
| 51 | </div> | 50 | </div> |
templates/ktcore/search2/adv_query_builder.smarty
| @@ -472,8 +472,6 @@ function addFieldTypeSelection(groupid, fid, type, options) | @@ -472,8 +472,6 @@ function addFieldTypeSelection(groupid, fid, type, options) | ||
| 472 | default: | 472 | default: |
| 473 | html += 'unknown: ' + type; | 473 | html += 'unknown: ' + type; |
| 474 | } | 474 | } |
| 475 | - // Jarrett Jordaan | ||
| 476 | - // Closing tags added | ||
| 477 | html += "</nobr></td>"; | 475 | html += "</nobr></td>"; |
| 478 | 476 | ||
| 479 | return {html: html, init: callback}; | 477 | return {html: html, init: callback}; |
webservice/clienttools/client_service.php
| @@ -44,6 +44,18 @@ class client_service{ | @@ -44,6 +44,18 @@ class client_service{ | ||
| 44 | return $var; | 44 | return $var; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | + protected function logTrace($location=NULL,$message=NULL){ | ||
| 48 | + Clienttools_Syslog::logTrace($this->AuthInfo['user'],'SERVICE - '.$location,$message); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + protected function logError($location=NULL,$detail=NULL,$err=NULL){ | ||
| 52 | + Clienttools_Syslog::logError($this->AuthInfo['user'],'SERVICE - '.$location,$detail,$err); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + protected function logInfo($location=NULL,$message=NULL,$debugData=NULL){ | ||
| 56 | + Clienttools_Syslog::logInfo($this->AuthInfo['user'],'SERVICE - '.$location,$message,$debugData); | ||
| 57 | + } | ||
| 58 | + | ||
| 47 | protected function checkPearError($obj,$errMsg,$debug=NULL,$response=NULL){ | 59 | protected function checkPearError($obj,$errMsg,$debug=NULL,$response=NULL){ |
| 48 | if (PEAR::isError($obj)){ | 60 | if (PEAR::isError($obj)){ |
| 49 | if($response===NULL)$response=array('status_code' => 1); | 61 | if($response===NULL)$response=array('status_code' => 1); |
webservice/clienttools/clienttools_syslog.php
| @@ -7,14 +7,22 @@ class Clienttools_Syslog{ | @@ -7,14 +7,22 @@ class Clienttools_Syslog{ | ||
| 7 | private static $errorLogTemplate='[date] | [time] | ERROR | [session] | [user] | [location] | [error_detail] | ([error])'; | 7 | private static $errorLogTemplate='[date] | [time] | ERROR | [session] | [user] | [location] | [error_detail] | ([error])'; |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | + /** | ||
| 11 | + * Parse an array into a string template | ||
| 12 | + * @param $template The template string - array keys in square brackets : [date] | [time] | ERROR | [session] | [user] | [location] | [error_detail] | ([error]) | ||
| 13 | + * @param $data The associative array to parse into template. Keys will replace [keys] in template string. | ||
| 14 | + * @return string The parsed template string | ||
| 15 | + */ | ||
| 10 | private static function parseTemplate($template=NULL,$data=NULL){ | 16 | private static function parseTemplate($template=NULL,$data=NULL){ |
| 11 | $ret=null; | 17 | $ret=null; |
| 12 | if(is_array($data)){ | 18 | if(is_array($data)){ |
| 13 | $txs=array_keys($data); | 19 | $txs=array_keys($data); |
| 20 | + foreach($txs as $idx=>$val){ | ||
| 21 | + $txs[$idx]='['.$val.']'; | ||
| 22 | + } | ||
| 14 | $txd=array_values($data); | 23 | $txd=array_values($data); |
| 15 | $ret=str_replace($txs,$txd,$template); | 24 | $ret=str_replace($txs,$txd,$template); |
| 16 | }; | 25 | }; |
| 17 | -// echo print_r(Array('s'=>$txs,'d'=>$txd),true)."\n\n\n\n\n\n"; | ||
| 18 | return $ret; | 26 | return $ret; |
| 19 | } | 27 | } |
| 20 | 28 | ||
| @@ -29,8 +37,12 @@ class Clienttools_Syslog{ | @@ -29,8 +37,12 @@ class Clienttools_Syslog{ | ||
| 29 | } | 37 | } |
| 30 | 38 | ||
| 31 | 39 | ||
| 40 | + /** | ||
| 41 | + * Write a line to the log file. | ||
| 42 | + * @param $line | ||
| 43 | + * @return void | ||
| 44 | + */ | ||
| 32 | private static function writeLogLine($line=NULL){ | 45 | private static function writeLogLine($line=NULL){ |
| 33 | -// echo('LOGFILE: '.realpath(self::getLogFile())); | ||
| 34 | if($line){ | 46 | if($line){ |
| 35 | $fp=fopen(self::getLogFile(),'a'); | 47 | $fp=fopen(self::getLogFile(),'a'); |
| 36 | fwrite($fp,$line."\n"); | 48 | fwrite($fp,$line."\n"); |
| @@ -43,7 +55,6 @@ class Clienttools_Syslog{ | @@ -43,7 +55,6 @@ class Clienttools_Syslog{ | ||
| 43 | * @return boolean | 55 | * @return boolean |
| 44 | */ | 56 | */ |
| 45 | private static function doErrorLogging(){ | 57 | private static function doErrorLogging(){ |
| 46 | -// $GLOBALS['default']['debugLevel']; //Another less secure way of finding the configured debugLevel | ||
| 47 | return KTConfig::getSingleton()->get('explorerCPSettings/debugLevel')=='error' || self::doDebugLogging(); | 58 | return KTConfig::getSingleton()->get('explorerCPSettings/debugLevel')=='error' || self::doDebugLogging(); |
| 48 | } | 59 | } |
| 49 | 60 | ||
| @@ -55,45 +66,80 @@ class Clienttools_Syslog{ | @@ -55,45 +66,80 @@ class Clienttools_Syslog{ | ||
| 55 | return KTConfig::getSingleton()->get('explorerCPSettings/debugLevel')=='debug'; | 66 | return KTConfig::getSingleton()->get('explorerCPSettings/debugLevel')=='debug'; |
| 56 | } | 67 | } |
| 57 | 68 | ||
| 69 | + /** | ||
| 70 | + * Store a line in the log file.. the message and a json string containing the data information will be stored | ||
| 71 | + * @param $user The logged in user | ||
| 72 | + * @param $location Information about the location from whence the function was called | ||
| 73 | + * @param $message The descriptive message explaining the debug data that follows | ||
| 74 | + * @param $data The debug data - this will be converted to a json string. | ||
| 75 | + * @return void | ||
| 76 | + */ | ||
| 58 | public static function logInfo($user,$location,$message,$data){ | 77 | public static function logInfo($user,$location,$message,$data){ |
| 59 | - $entry=self::parseTemplate(self::$debugLogTemplate,array( | ||
| 60 | - 'date' =>date('Y-m-d'), | ||
| 61 | - 'time' =>date('h:i:s'), | ||
| 62 | - 'user' =>$user, | ||
| 63 | - 'session'=>session_id(), | ||
| 64 | - 'location'=>$location, | ||
| 65 | - 'debug_message'=>$message, | ||
| 66 | - 'debug_data'=>json_encode($data) | ||
| 67 | - )); | ||
| 68 | - | ||
| 69 | - self::writeLogLine($entry); | 78 | + if(self::doDebugLogging()){ |
| 79 | + list($usec, $sec) = explode(" ", microtime()); | ||
| 80 | + $usec=ceil($usec*1000); | ||
| 81 | + $entry=self::parseTemplate(self::$debugLogTemplate,array( | ||
| 82 | + 'date' =>date('Y-m-d'), | ||
| 83 | + 'time' =>date('h:i:s').':'.$usec, | ||
| 84 | + 'user' =>$user, | ||
| 85 | + 'session'=>session_id(), | ||
| 86 | + 'location'=>$location, | ||
| 87 | + 'debug_message'=>$message, | ||
| 88 | + 'debug_data'=>json_encode($data) | ||
| 89 | + )); | ||
| 90 | + | ||
| 91 | + self::writeLogLine($entry); | ||
| 92 | + } | ||
| 70 | } | 93 | } |
| 71 | 94 | ||
| 95 | + /** | ||
| 96 | + * Store a line in the log file.. A simple string to indicate a point in the software | ||
| 97 | + * @param $user The logged in user | ||
| 98 | + * @param $location Information about the location from whence the function was called | ||
| 99 | + * @param $message A string indicating a point reached in the software | ||
| 100 | + * @return void | ||
| 101 | + */ | ||
| 72 | public static function logTrace($user,$location,$message){ | 102 | public static function logTrace($user,$location,$message){ |
| 73 | - $entry=self::parseTemplate(self::$traceLogTemplate,array( | ||
| 74 | - 'date' =>date('Y-m-d'), | ||
| 75 | - 'time' =>date('h:i:s'), | ||
| 76 | - 'user' =>$user, | ||
| 77 | - 'session'=>session_id(), | ||
| 78 | - 'location'=>$location, | ||
| 79 | - 'trace_message'=>$message, | ||
| 80 | - )); | ||
| 81 | - | ||
| 82 | - self::writeLogLine($entry); | 103 | + if(self::doDebugLogging()){ |
| 104 | + list($usec, $sec) = explode(" ", microtime()); | ||
| 105 | + $usec=ceil($usec*1000); | ||
| 106 | + $entry=self::parseTemplate(self::$traceLogTemplate,array( | ||
| 107 | + 'date' =>date('Y-m-d'), | ||
| 108 | + 'time' =>date('h:i:s').':'.$usec, | ||
| 109 | + 'user' =>$user, | ||
| 110 | + 'session'=>session_id(), | ||
| 111 | + 'location'=>$location, | ||
| 112 | + 'trace_message'=>$message, | ||
| 113 | + )); | ||
| 114 | + | ||
| 115 | + self::writeLogLine($entry); | ||
| 116 | + } | ||
| 83 | } | 117 | } |
| 84 | 118 | ||
| 119 | + /** | ||
| 120 | + * Store a line in the log file.. An Error log | ||
| 121 | + * @param $user The logged in user | ||
| 122 | + * @param $location Information about the location from whence the function was called | ||
| 123 | + * @param $detail A string providing information as to the context of the encountered error | ||
| 124 | + * @param $err The exception object - this will be serialized | ||
| 125 | + * @return void | ||
| 126 | + */ | ||
| 85 | public static function logError($user=NULL,$location=NULL,$detail=NULL,$err=NULL){ | 127 | public static function logError($user=NULL,$location=NULL,$detail=NULL,$err=NULL){ |
| 86 | - $entry=self::parseTemplate(self::$errorLogTemplate,array( | ||
| 87 | - 'date' =>date('Y-m-d'), | ||
| 88 | - 'time' =>date('h:i:s'), | ||
| 89 | - 'user' =>$user, | ||
| 90 | - 'session'=>session_id(), | ||
| 91 | - 'location'=>$location, | ||
| 92 | - 'error_detail'=>json_encode($detail), | ||
| 93 | - 'error'=>json_encode($err), | ||
| 94 | - )); | ||
| 95 | - | ||
| 96 | - self::writeLogLine($entry); | 128 | + if(self::doErrorLogging()){ |
| 129 | + list($usec, $sec) = explode(" ", microtime()); | ||
| 130 | + $usec=ceil($usec*1000); | ||
| 131 | + $entry=self::parseTemplate(self::$errorLogTemplate,array( | ||
| 132 | + 'date' =>date('Y-m-d'), | ||
| 133 | + 'time' =>date('h:i:s').':'.$usec, | ||
| 134 | + 'user' =>$user, | ||
| 135 | + 'session'=>session_id(), | ||
| 136 | + 'location'=>$location, | ||
| 137 | + 'error_detail'=>json_encode($detail), | ||
| 138 | + 'error'=>json_encode($err), | ||
| 139 | + )); | ||
| 140 | + | ||
| 141 | + self::writeLogLine($entry); | ||
| 142 | + } | ||
| 97 | 143 | ||
| 98 | } | 144 | } |
| 99 | } | 145 | } |
webservice/clienttools/services/0.9/auth.php
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | class auth extends client_service { | 3 | class auth extends client_service { |
| 4 | 4 | ||
| 5 | public function login(){ | 5 | public function login(){ |
| 6 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 6 | $params=$this->AuthInfo; | 7 | $params=$this->AuthInfo; |
| 7 | 8 | ||
| 8 | $username=$params['user']; | 9 | $username=$params['user']; |
| @@ -71,6 +72,7 @@ class auth extends client_service { | @@ -71,6 +72,7 @@ class auth extends client_service { | ||
| 71 | } | 72 | } |
| 72 | 73 | ||
| 73 | public function japiLogin(){ | 74 | public function japiLogin(){ |
| 75 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 74 | global $default; | 76 | global $default; |
| 75 | 77 | ||
| 76 | $user=$this->KT->get_user_object_by_username($this->AuthInfo['user']); | 78 | $user=$this->KT->get_user_object_by_username($this->AuthInfo['user']); |
| @@ -82,6 +84,7 @@ class auth extends client_service { | @@ -82,6 +84,7 @@ class auth extends client_service { | ||
| 82 | } | 84 | } |
| 83 | 85 | ||
| 84 | public function pickup_session(){ | 86 | public function pickup_session(){ |
| 87 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 85 | $params=$this->AuthInfo; | 88 | $params=$this->AuthInfo; |
| 86 | $app_type=$params['appType']; | 89 | $app_type=$params['appType']; |
| 87 | $session_id=$params['session']; | 90 | $session_id=$params['session']; |
| @@ -98,6 +101,7 @@ class auth extends client_service { | @@ -98,6 +101,7 @@ class auth extends client_service { | ||
| 98 | 101 | ||
| 99 | 102 | ||
| 100 | public function ping(){ | 103 | public function ping(){ |
| 104 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 101 | global $default; | 105 | global $default; |
| 102 | $user=$this->KT->get_user_object_by_username($this->AuthInfo['user']); | 106 | $user=$this->KT->get_user_object_by_username($this->AuthInfo['user']); |
| 103 | $versions=$this->handler->getServerVersions(); | 107 | $versions=$this->handler->getServerVersions(); |
| @@ -120,12 +124,19 @@ class auth extends client_service { | @@ -120,12 +124,19 @@ class auth extends client_service { | ||
| 120 | } | 124 | } |
| 121 | 125 | ||
| 122 | function logout($params){ | 126 | function logout($params){ |
| 127 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 123 | $params=$this->AuthInfo; | 128 | $params=$this->AuthInfo; |
| 124 | $app_type=$params['appType']; | 129 | $app_type=$params['appType']; |
| 125 | $session_id=$params['session']; | 130 | $session_id=$params['session']; |
| 126 | $ip=$_SERVER['REMOTE_ADDR']; | 131 | $ip=$_SERVER['REMOTE_ADDR']; |
| 127 | 132 | ||
| 128 | - $session = $this->KT->get_active_session($session_id, $ip, $app_type); | 133 | + $session=$this->KT->get_session(); |
| 134 | + $this->logInfo((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Logout Session Object (From KT)',$session); | ||
| 135 | + | ||
| 136 | + if(get_class($session)!='KTAPI_UserSession'){ | ||
| 137 | + $session = $this->KT->get_active_session($session_id, $ip, $app_type); | ||
| 138 | + } | ||
| 139 | + $this->logInfo((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Logout Session Object (To Logout)',$session); | ||
| 129 | 140 | ||
| 130 | if (PEAR::isError($session)){ | 141 | if (PEAR::isError($session)){ |
| 131 | return false; | 142 | return false; |
webservice/clienttools/services/0.9/kt.php
| 1 | <?php | 1 | <?php |
| 2 | -class kt extends client_service { | ||
| 3 | - | ||
| 4 | - | 2 | +class kt extends client_service { |
| 5 | 3 | ||
| 6 | -/** | ||
| 7 | - * Get Supported (?) Languages | ||
| 8 | - * | ||
| 9 | - * returns array containing languages, count, & defaultlanguage | ||
| 10 | - * | ||
| 11 | - */ | ||
| 12 | - function get_languages($passthru=false){ | 4 | + /** |
| 5 | + * Get Supported (?) Languages | ||
| 6 | + * | ||
| 7 | + * returns array containing languages, count, & defaultlanguage | ||
| 8 | + * | ||
| 9 | + */ | ||
| 10 | + function get_languages($passthru = false) { | ||
| 11 | + $this->logTrace ((__METHOD__.'('.__FILE__.' '.__LINE__.')'), 'Enter Function' ); | ||
| 13 | global $default; | 12 | global $default; |
| 14 | - $oReg =& KTi18nregistry::getSingleton(); | ||
| 15 | - $aRegisteredLangs=$oReg->geti18nLanguages('knowledgeTree'); | ||
| 16 | - $aLanguageNames=$oReg->getLanguages('knowledgeTree'); | ||
| 17 | - $languages=array(); | ||
| 18 | - | ||
| 19 | - if(!empty($aRegisteredLangs)){ | ||
| 20 | - foreach (array_keys($aRegisteredLangs) as $sLang){ | ||
| 21 | - $languages[]=array( | ||
| 22 | - 'isoCode'=>$sLang, | ||
| 23 | - 'language'=>$aLanguageNames[$sLang] | ||
| 24 | - ); | 13 | + $oReg = & KTi18nregistry::getSingleton (); |
| 14 | + $aRegisteredLangs = $oReg->geti18nLanguages ( 'knowledgeTree' ); | ||
| 15 | + $aLanguageNames = $oReg->getLanguages ( 'knowledgeTree' ); | ||
| 16 | + $languages = array (); | ||
| 17 | + | ||
| 18 | + if (! empty ( $aRegisteredLangs )) { | ||
| 19 | + foreach ( array_keys ( $aRegisteredLangs ) as $sLang ) { | ||
| 20 | + $languages [] = array ('isoCode' => $sLang, 'language' => $aLanguageNames [$sLang] ); | ||
| 25 | } | 21 | } |
| 26 | } | 22 | } |
| 27 | - $response=array('languages'=>$languages, 'count'=>count($languages), 'defaultLanguage'=>$default->defaultLanguage); | ||
| 28 | - if(is_bool($passthru))if($passthru)return $response; | ||
| 29 | - $this->setResponse($response); | 23 | + $response = array ('languages' => $languages, 'count' => count ( $languages ), 'defaultLanguage' => $default->defaultLanguage ); |
| 24 | + if (is_bool ( $passthru )) | ||
| 25 | + if ($passthru) | ||
| 26 | + return $response; | ||
| 27 | + $this->setResponse ( $response ); | ||
| 30 | } | 28 | } |
| 31 | - | ||
| 32 | - | ||
| 33 | - function get_rootfolder_detail($params){ | ||
| 34 | - $params['folderId']='1'; | ||
| 35 | - $this->get_folder_detail($params); | 29 | + |
| 30 | + function get_rootfolder_detail($params) { | ||
| 31 | + $this->logTrace ((__METHOD__.'('.__FILE__.' '.__LINE__.')'), 'Enter Function' ); | ||
| 32 | + $params ['folderId'] = '1'; | ||
| 33 | + $this->get_folder_detail ( $params ); | ||
| 36 | } | 34 | } |
| 37 | - | ||
| 38 | - | ||
| 39 | - function get_folder_detail($params) { | ||
| 40 | - if(isset($params['node'])&&!isset($params['folderId'])){ | ||
| 41 | - $params['node']=split('_',$params['node']); | ||
| 42 | - $params['folderId']=$params['node'][1]; | 35 | + |
| 36 | + function get_folder_detail($params) { | ||
| 37 | + $this->logTrace ((__METHOD__.'('.__FILE__.' '.__LINE__.')'), 'Enter Function' ); | ||
| 38 | + if (isset ( $params ['node'] ) && ! isset ( $params ['folderId'] )) { | ||
| 39 | + $params ['node'] = split ( '_', $params ['node'] ); | ||
| 40 | + $params ['folderId'] = $params ['node'] [1]; | ||
| 43 | } | 41 | } |
| 44 | - $kt=&$this->KT; | ||
| 45 | - | ||
| 46 | - $folder=&$kt->get_folder_by_id($params['folderId']); | ||
| 47 | - if (PEAR::isError($folder)) | ||
| 48 | - { | ||
| 49 | - $this->setError("Could not get folder by Id: {$params['folderId']}"); | ||
| 50 | - $this->setDebug('FolderError',array('kt'=>$kt,'folder'=>$folder)); | 42 | + $kt = &$this->KT; |
| 43 | + | ||
| 44 | + $folder = &$kt->get_folder_by_id ( $params ['folderId'] ); | ||
| 45 | + if (PEAR::isError ( $folder )) { | ||
| 46 | + $this->setError ( "Could not get folder by Id: {$params['folderId']}" ); | ||
| 47 | + $this->setDebug ( 'FolderError', array ('kt' => $kt, 'folder' => $folder ) ); | ||
| 51 | return false; | 48 | return false; |
| 52 | } | 49 | } |
| 53 | - | ||
| 54 | - $detail=$folder->get_detail(); | ||
| 55 | - if (PEAR::isError($detail)){ | ||
| 56 | - $this->setResponse("detail error {$params['node']}"); | 50 | + |
| 51 | + $detail = $folder->get_detail (); | ||
| 52 | + if (PEAR::isError ( $detail )) { | ||
| 53 | + $this->setResponse ( "detail error {$params['node']}" ); | ||
| 57 | return false; | 54 | return false; |
| 58 | } | 55 | } |
| 59 | - | ||
| 60 | - if(strtolower($detail['folder_name'])=='root folder'){ | ||
| 61 | - $detail['folder_name']='KnowledgeTree'; | 56 | + |
| 57 | + if (strtolower ( $detail ['folder_name'] ) == 'root folder') { | ||
| 58 | + $detail ['folder_name'] = 'KnowledgeTree'; | ||
| 62 | } | 59 | } |
| 63 | - | ||
| 64 | - $qtip .= $this->xlate('Folder name').": {$detail['folder_name']}<br>"; | ||
| 65 | - $class='folder'; | ||
| 66 | - | ||
| 67 | - $permissions=$detail['permissions']; | ||
| 68 | - $perms=''; | ||
| 69 | - $canWrite=false; | ||
| 70 | - | ||
| 71 | - for ($j=0; $j < strlen($permissions); $j++){ | ||
| 72 | - switch (strtoupper($permissions{$j})){ | ||
| 73 | - case 'W': | ||
| 74 | - $canWrite=true; | ||
| 75 | - $perms .= $this->xlate('write, '); | ||
| 76 | - break; | ||
| 77 | - case 'R': | ||
| 78 | - $perms .= $this->xlate('read, '); | ||
| 79 | - break; | ||
| 80 | - case 'A': | ||
| 81 | - $perms .= $this->xlate('add folder, '); | ||
| 82 | - break; | 60 | + |
| 61 | + $qtip .= $this->xlate ( 'Folder name' ) . ": {$detail['folder_name']}<br>"; | ||
| 62 | + $class = 'folder'; | ||
| 63 | + | ||
| 64 | + $permissions = $detail ['permissions']; | ||
| 65 | + $perms = ''; | ||
| 66 | + $canWrite = false; | ||
| 67 | + | ||
| 68 | + for($j = 0; $j < strlen ( $permissions ); $j ++) { | ||
| 69 | + switch (strtoupper ( $permissions {$j} )) { | ||
| 70 | + case 'W' : | ||
| 71 | + $canWrite = true; | ||
| 72 | + $perms .= $this->xlate ( 'write, ' ); | ||
| 73 | + break; | ||
| 74 | + case 'R' : | ||
| 75 | + $perms .= $this->xlate ( 'read, ' ); | ||
| 76 | + break; | ||
| 77 | + case 'A' : | ||
| 78 | + $perms .= $this->xlate ( 'add folder, ' ); | ||
| 79 | + break; | ||
| 83 | } | 80 | } |
| 84 | } | 81 | } |
| 85 | - | ||
| 86 | - if (strlen($perms) > 2){ | ||
| 87 | - $perms=substr($perms, 0, strlen($perms)-2); | 82 | + |
| 83 | + if (strlen ( $perms ) > 2) { | ||
| 84 | + $perms = substr ( $perms, 0, strlen ( $perms ) - 2 ); | ||
| 88 | } | 85 | } |
| 89 | - | ||
| 90 | - $qtip .= $this->xlate('Permissions:') . " {$perms}<br>"; | ||
| 91 | - $qtip .= $canWrite ? $this->xlate('You may add content to this folder') : $this->xlate('You may not add content to this folder'); | ||
| 92 | - | ||
| 93 | - $result[]=array( | ||
| 94 | - 'text'=>$detail['folder_name'], | ||
| 95 | - 'id'=>'F_'. $params['folderId'], | ||
| 96 | - 'filename'=>$detail['folder_name'], | ||
| 97 | - 'cls'=>'folder', | ||
| 98 | - 'leaf'=>false, | ||
| 99 | - 'document_type'=>'', | ||
| 100 | - 'item_type'=>'F', | ||
| 101 | - 'permissions'=>$permissions, | ||
| 102 | - 'qtip'=> $qtip | ||
| 103 | - ); | ||
| 104 | - | ||
| 105 | - $this->setResponse($result); | 86 | + |
| 87 | + $qtip .= $this->xlate ( 'Permissions:' ) . " {$perms}<br>"; | ||
| 88 | + $qtip .= $canWrite ? $this->xlate ( 'You may add content to this folder' ) : $this->xlate ( 'You may not add content to this folder' ); | ||
| 89 | + | ||
| 90 | + $result [] = array ('text' => $detail ['folder_name'], 'id' => 'F_' . $params ['folderId'], 'filename' => $detail ['folder_name'], 'cls' => 'folder', 'leaf' => false, 'document_type' => '', 'item_type' => 'F', 'permissions' => $permissions, 'qtip' => $qtip ); | ||
| 91 | + | ||
| 92 | + $this->setResponse ( $result ); | ||
| 106 | return true; | 93 | return true; |
| 107 | } | 94 | } |
| 108 | - | ||
| 109 | - | ||
| 110 | - function get_folder_contents($params){ | ||
| 111 | - $kt=&$this->KT; | ||
| 112 | - | ||
| 113 | - $params['control']='F_'; | ||
| 114 | - $params['node']=substr($params['node'], strlen($params['control'])); | ||
| 115 | - | ||
| 116 | - $folder=&$kt->get_folder_by_id($params['node']); | ||
| 117 | - if(!$this->checkPearError($folder,"[error 1] Folder Not Found: {$params['control']}{$params['node']}",'',array()))return false; | ||
| 118 | - | ||
| 119 | - $types=(isset($params['types']) ? $params['types'] : 'DF'); | ||
| 120 | - $listing=$folder->get_listing(1, $types); | ||
| 121 | - $result=$this->_processListing($listing, 'folderContents', $params); | ||
| 122 | - | ||
| 123 | - $this->setResponse($result); | ||
| 124 | - return true; | 95 | + |
| 96 | + function get_folder_contents($params) { | ||
| 97 | + $this->logTrace ((__METHOD__.'('.__FILE__.' '.__LINE__.')'), 'Enter Function' ); | ||
| 98 | + $kt = &$this->KT; | ||
| 99 | + | ||
| 100 | + $params ['control'] = 'F_'; | ||
| 101 | + $params ['node'] = substr ( $params ['node'], strlen ( $params ['control'] ) ); | ||
| 102 | + | ||
| 103 | + $folder = &$kt->get_folder_by_id ( $params ['node'] ); | ||
| 104 | + if (! $this->checkPearError ( $folder, "[error 1] Folder Not Found: {$params['control']}{$params['node']}", '', array () )) | ||
| 105 | + return false; | ||
| 106 | + | ||
| 107 | + $types = (isset ( $params ['types'] ) ? $params ['types'] : 'DF'); | ||
| 108 | + $listing = $folder->get_listing ( 1, $types ); | ||
| 109 | + $result = $this->_processListing ( $listing, 'folderContents', $params ); | ||
| 110 | + | ||
| 111 | + $this->setResponse ( $result ); | ||
| 112 | + return true; | ||
| 125 | } | 113 | } |
| 126 | - | ||
| 127 | - | ||
| 128 | - /** | ||
| 129 | - * Returns the contents of a folder formatted for a grid view. | ||
| 130 | - * | ||
| 131 | - * @param array $arr | ||
| 132 | - * @return array | ||
| 133 | - */ | ||
| 134 | - function get_folder_contents_for_grid($arr) | ||
| 135 | - { | ||
| 136 | - $kt=&$this->KT; | ||
| 137 | - | ||
| 138 | - $arr['control']='F_'; | ||
| 139 | - $arr['node']=substr($arr['node'], strlen($arr['control'])); | ||
| 140 | - | ||
| 141 | - $folder=&$kt->get_folder_by_id($arr['node']); | ||
| 142 | - if (PEAR::isError($folder)){ | ||
| 143 | - echo '<pre>'.print_r($arr,true).'</pre>'; | ||
| 144 | - $this->addError('Folder Not found'); | 114 | + |
| 115 | + /** | ||
| 116 | + * Returns the contents of a folder formatted for a grid view. | ||
| 117 | + * | ||
| 118 | + * @param array $arr | ||
| 119 | + * @return array | ||
| 120 | + */ | ||
| 121 | + function get_folder_contents_for_grid($arr) { | ||
| 122 | + $this->logTrace ((__METHOD__.'('.__FILE__.' '.__LINE__.')'), 'Enter Function' ); | ||
| 123 | + $kt = &$this->KT; | ||
| 124 | + | ||
| 125 | + $arr ['control'] = 'F_'; | ||
| 126 | + $arr ['node'] = substr ( $arr ['node'], strlen ( $arr ['control'] ) ); | ||
| 127 | + | ||
| 128 | + $folder = &$kt->get_folder_by_id ( $arr ['node'] ); | ||
| 129 | + if (PEAR::isError ( $folder )) { | ||
| 130 | + echo '<pre>' . print_r ( $arr, true ) . '</pre>'; | ||
| 131 | + $this->addError ( 'Folder Not found' ); | ||
| 145 | return false; | 132 | return false; |
| 146 | } | 133 | } |
| 147 | - | ||
| 148 | - $types=(isset($arr['types']) ? $arr['types'] : 'DF'); | ||
| 149 | 134 | ||
| 150 | - $listing=$folder->get_listing(1, $types); | ||
| 151 | - | ||
| 152 | - $result=$this->_processListing($listing, 'grid', $arr); | 135 | + $types = (isset ( $arr ['types'] ) ? $arr ['types'] : 'DF'); |
| 153 | 136 | ||
| 154 | - $this->setResponse(array('totalCount'=>count($listing), 'items'=>$result)); | 137 | + $listing = $folder->get_listing ( 1, $types ); |
| 138 | + | ||
| 139 | + $result = $this->_processListing ( $listing, 'grid', $arr ); | ||
| 140 | + | ||
| 141 | + $this->setResponse ( array ('totalCount' => count ( $listing ), 'items' => $result ) ); | ||
| 155 | 142 | ||
| 156 | return true; | 143 | return true; |
| 157 | } | 144 | } |
| 158 | - | ||
| 159 | - | ||
| 160 | 145 | ||
| 161 | - private function _processListing($listing, $type, $arr){ | ||
| 162 | - $result=array(); | ||
| 163 | - $methodToIncludeItem='_processItemInclusion_'.$type; | ||
| 164 | - | ||
| 165 | - foreach($listing as $item){ | 146 | + private function _processListing($listing, $type, $arr) { |
| 147 | + $this->logTrace ((__METHOD__.'('.__FILE__.' '.__LINE__.')'), 'Enter Function' ); | ||
| 148 | + $result = array (); | ||
| 149 | + $methodToIncludeItem = '_processItemInclusion_' . $type; | ||
| 150 | + | ||
| 151 | + foreach ( $listing as $item ) { | ||
| 166 | /* Trying to fix folder sizes */ | 152 | /* Trying to fix folder sizes */ |
| 167 | - if($item['filesize']<=0){ | ||
| 168 | - $item['filesize']=''; | ||
| 169 | - }else{ | ||
| 170 | - $item['filesize']=serviceHelper::size_readable($item['filesize']); | 153 | + if ($item ['filesize'] <= 0) { |
| 154 | + $item ['filesize'] = ''; | ||
| 155 | + } else { | ||
| 156 | + $item ['filesize'] = serviceHelper::size_readable ( $item ['filesize'] ); | ||
| 171 | } | 157 | } |
| 172 | 158 | ||
| 173 | - $filename=$item['filename']; | ||
| 174 | - $itemType=$item['item_type']; | ||
| 175 | - | ||
| 176 | - $includeMe=true; | ||
| 177 | - $qtip=''; | ||
| 178 | - $canWrite=false; | ||
| 179 | - $immutable=false; | ||
| 180 | - $permissions=$item['permissions']; | ||
| 181 | - $perms=''; | ||
| 182 | - | ||
| 183 | - for ($j=0; $j < strlen($permissions); $j++){ | ||
| 184 | - switch (strtoupper($permissions{$j})){ | ||
| 185 | - case 'W': | ||
| 186 | - $canWrite=true; | ||
| 187 | - $perms .= $this->xlate('write, '); | 159 | + $filename = $item ['filename']; |
| 160 | + $itemType = $item ['item_type']; | ||
| 161 | + | ||
| 162 | + $includeMe = true; | ||
| 163 | + $qtip = ''; | ||
| 164 | + $canWrite = false; | ||
| 165 | + $immutable = false; | ||
| 166 | + $permissions = $item ['permissions']; | ||
| 167 | + $perms = ''; | ||
| 168 | + | ||
| 169 | + for($j = 0; $j < strlen ( $permissions ); $j ++) { | ||
| 170 | + switch (strtoupper ( $permissions {$j} )) { | ||
| 171 | + case 'W' : | ||
| 172 | + $canWrite = true; | ||
| 173 | + $perms .= $this->xlate ( 'write, ' ); | ||
| 188 | break; | 174 | break; |
| 189 | - case 'R': | ||
| 190 | - $perms .= $this->xlate('read, '); | 175 | + case 'R' : |
| 176 | + $perms .= $this->xlate ( 'read, ' ); | ||
| 191 | break; | 177 | break; |
| 192 | - case 'A': | ||
| 193 | - $perms .= $this->xlate('add folder, '); | 178 | + case 'A' : |
| 179 | + $perms .= $this->xlate ( 'add folder, ' ); | ||
| 194 | break; | 180 | break; |
| 195 | } | 181 | } |
| 196 | } | 182 | } |
| 197 | - | ||
| 198 | - if(strlen($perms) > 2){ | ||
| 199 | - $perms=substr($perms, 0, strlen($perms)-2); | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | - if($itemType=='F'){ | ||
| 203 | - $qtip .= $this->xlate('Folder name').": {$filename}<br>"; | ||
| 204 | - $class='folder'; | ||
| 205 | - $qtip .= $this->xlate('Permissions:') . " {$perms}<br>"; | ||
| 206 | - $qtip .= $canWrite ? $this->xlate('You may add content to this folder') : $this->xlate('You may not add content to this folder'); | 183 | + |
| 184 | + if (strlen ( $perms ) > 2) { | ||
| 185 | + $perms = substr ( $perms, 0, strlen ( $perms ) - 2 ); | ||
| 207 | } | 186 | } |
| 187 | + | ||
| 188 | + if ($itemType == 'F') { | ||
| 189 | + $qtip .= $this->xlate ( 'Folder name' ) . ": {$filename}<br>"; | ||
| 190 | + $class = 'folder'; | ||
| 191 | + $qtip .= $this->xlate ( 'Permissions:' ) . " {$perms}<br>"; | ||
| 192 | + $qtip .= $canWrite ? $this->xlate ( 'You may add content to this folder' ) : $this->xlate ( 'You may not add content to this folder' ); | ||
| 193 | + } | ||
| 208 | 194 | ||
| 209 | //documents | 195 | //documents |
| 210 | - else{ | ||
| 211 | - $qtip=''; | ||
| 212 | - $extpos=strrpos($filename, '.') ; | ||
| 213 | - | ||
| 214 | - if($extpos === false){ | ||
| 215 | - $class='file-unknown'; | ||
| 216 | - }else{ | ||
| 217 | - $ext=substr($filename, $extpos); // Get Extension including the dot | ||
| 218 | - $class='file-' . substr($filename, $extpos +1); // Get Extension without the dot | 196 | + else { |
| 197 | + $qtip = ''; | ||
| 198 | + $extpos = strrpos ( $filename, '.' ); | ||
| 199 | + | ||
| 200 | + if ($extpos === false) { | ||
| 201 | + $class = 'file-unknown'; | ||
| 202 | + } else { | ||
| 203 | + $ext = substr ( $filename, $extpos ); // Get Extension including the dot | ||
| 204 | + $class = 'file-' . substr ( $filename, $extpos + 1 ); // Get Extension without the dot | ||
| 219 | } | 205 | } |
| 220 | 206 | ||
| 221 | - $extensions=explode(',', $arr['extensions']); | ||
| 222 | - if(!in_array(strtolower($ext), $extensions) && !in_array('*',$extensions)){ | ||
| 223 | - $includeMe=false; | ||
| 224 | - }else{ | ||
| 225 | - $qtip .= $this->xlate('Filename') . ": {$filename}<br>"; | ||
| 226 | - $qtip .= $this->xlate('File Size') . ": " . serviceHelper::fsize_desc($item['filesize']) . "<br>"; | ||
| 227 | - $qtip .= $this->xlate('Modified') . ": {$item['modified_date']}<br>"; | ||
| 228 | - $qtip .= $this->xlate('Owner') . ": {$item['created_by']}<br>"; | ||
| 229 | - $qtip .= $this->xlate('Version') . ": {$item['version']}<br>"; | ||
| 230 | - if (serviceHelper::bool2str(strtolower($item['is_immutable']))=='true'){ | ||
| 231 | - $canWrite=false; | ||
| 232 | - $immutable=true; | 207 | + $extensions = explode ( ',', $arr ['extensions'] ); |
| 208 | + if (! in_array ( strtolower ( $ext ), $extensions ) && ! in_array ( '*', $extensions )) { | ||
| 209 | + $includeMe = false; | ||
| 210 | + } else { | ||
| 211 | + $qtip .= $this->xlate ( 'Filename' ) . ": {$filename}<br>"; | ||
| 212 | + $qtip .= $this->xlate ( 'File Size' ) . ": " . serviceHelper::fsize_desc ( $item ['filesize'] ) . "<br>"; | ||
| 213 | + $qtip .= $this->xlate ( 'Modified' ) . ": {$item['modified_date']}<br>"; | ||
| 214 | + $qtip .= $this->xlate ( 'Owner' ) . ": {$item['created_by']}<br>"; | ||
| 215 | + $qtip .= $this->xlate ( 'Version' ) . ": {$item['version']}<br>"; | ||
| 216 | + if (serviceHelper::bool2str ( strtolower ( $item ['is_immutable'] ) ) == 'true') { | ||
| 217 | + $canWrite = false; | ||
| 218 | + $immutable = true; | ||
| 233 | } | 219 | } |
| 234 | 220 | ||
| 235 | - if($immutable){ | ||
| 236 | - $qtip .= $this->xlate('Status: Immutable') . '<br>'; | ||
| 237 | - }else if (strtolower($item['checked_out_by']) != 'n/a' && ($item['checked_out_by'] != '')){ | ||
| 238 | - $qtip .= $this->xlate('Status: Checked out by') . " {$item['checked_out_by']}<br>"; | ||
| 239 | - }else{ | ||
| 240 | - $qtip .= $this->xlate('Status: Available') . '<br>'; | 221 | + if ($immutable) { |
| 222 | + $qtip .= $this->xlate ( 'Status: Immutable' ) . '<br>'; | ||
| 223 | + } else if (strtolower ( $item ['checked_out_by'] ) != 'n/a' && ($item ['checked_out_by'] != '')) { | ||
| 224 | + $qtip .= $this->xlate ( 'Status: Checked out by' ) . " {$item['checked_out_by']}<br>"; | ||
| 225 | + } else { | ||
| 226 | + $qtip .= $this->xlate ( 'Status: Available' ) . '<br>'; | ||
| 241 | } | 227 | } |
| 242 | - $qtip .= $this->xlate('Permissions:') . " {$perms}<br>"; | ||
| 243 | - | ||
| 244 | - if($immutable){ | ||
| 245 | - $qtip .= $this->xlate('This document is not editable'); | ||
| 246 | - }else if ($canWrite){ | ||
| 247 | - $qtip .= $this->xlate('You may edit this document'); | ||
| 248 | - }else{ | ||
| 249 | - $qtip .= $this->xlate('This document is not editable'); | 228 | + $qtip .= $this->xlate ( 'Permissions:' ) . " {$perms}<br>"; |
| 229 | + | ||
| 230 | + if ($immutable) { | ||
| 231 | + $qtip .= $this->xlate ( 'This document is not editable' ); | ||
| 232 | + } else if ($canWrite) { | ||
| 233 | + $qtip .= $this->xlate ( 'You may edit this document' ); | ||
| 234 | + } else { | ||
| 235 | + $qtip .= $this->xlate ( 'This document is not editable' ); | ||
| 250 | } | 236 | } |
| 251 | } | 237 | } |
| 252 | - }//end of if for files | ||
| 253 | - if($includeMe){ | ||
| 254 | - $result[]=$this->$methodToIncludeItem($item, $class, $qtip); | 238 | + } //end of if for files |
| 239 | + if ($includeMe) { | ||
| 240 | + $result [] = $this->$methodToIncludeItem ( $item, $class, $qtip ); | ||
| 255 | } | 241 | } |
| 256 | } | 242 | } |
| 257 | return $result; | 243 | return $result; |
| 258 | - } | ||
| 259 | - | ||
| 260 | - | ||
| 261 | - | ||
| 262 | - | ||
| 263 | - private function _processItemInclusion_folderContents($item, $class, $qtip){ | ||
| 264 | - return array ( | ||
| 265 | - 'text'=>htmlspecialchars($item['title']), | ||
| 266 | - 'originaltext'=>$item['title'], | ||
| 267 | - 'id'=>($item['item_type']=='F' ? $item['item_type']."_" : "").$item['id'], | ||
| 268 | - 'filename'=>$item['filename'], | ||
| 269 | - 'cls'=>$class, | ||
| 270 | - 'leaf'=>($item['item_type']=='D'), | ||
| 271 | - 'document_type'=>$item['document_type'], | ||
| 272 | - 'item_type'=>$item['item_type'], | ||
| 273 | - 'permissions'=>$item['permissions'], | ||
| 274 | - 'content_id'=>$item['content_id'], | ||
| 275 | - 'checked_out_by'=>$item['checked_out_by'], | ||
| 276 | - 'qtip'=> $qtip | ||
| 277 | - ); | ||
| 278 | - } | ||
| 279 | - | ||
| 280 | - | ||
| 281 | - private function _processItemInclusion_search($item, $class, $qtip) | ||
| 282 | - { | ||
| 283 | - if ($item['filesize']=='n/a') { | ||
| 284 | - $item['filesize']=-1; | ||
| 285 | - } | ||
| 286 | - return array ( | ||
| 287 | - 'text'=>htmlspecialchars($item['title']), | ||
| 288 | - 'originaltext'=>$item['title'], | ||
| 289 | - 'id'=>$item['document_id'], | ||
| 290 | - 'filename'=>$item['filename'], | ||
| 291 | - 'cls'=>$class, | ||
| 292 | - 'leaf'=>true, | ||
| 293 | - 'document_type'=>$item['document_type'], | ||
| 294 | - 'item_type'=>'D', | ||
| 295 | - 'permissions'=>$item['permissions'], | ||
| 296 | - 'content_id'=>$item['content_id'], | ||
| 297 | - 'filesize'=>$item['filesize'], | ||
| 298 | - 'modified'=>$item['modified_date'], | ||
| 299 | - 'created_date'=>$item['created_date'], | ||
| 300 | - 'checked_out_by'=>$item['checked_out_by'], | ||
| 301 | - 'relevance'=>$item['relevance'], | ||
| 302 | - 'qtip'=> $qtip, | ||
| 303 | - 'version'=>$item['version'] | ||
| 304 | - ); | ||
| 305 | - } | 244 | + } |
| 245 | + | ||
| 246 | + private function _processItemInclusion_folderContents($item, $class, $qtip) { | ||
| 247 | + $this->logTrace ((__METHOD__.'('.__FILE__.' '.__LINE__.')'), 'Enter Function' ); | ||
| 248 | + return array ('text' => htmlspecialchars ( $item ['title'] ), 'originaltext' => $item ['title'], 'id' => ($item ['item_type'] == 'F' ? $item ['item_type'] . "_" : "") . $item ['id'], 'filename' => $item ['filename'], 'cls' => $class, 'leaf' => ($item ['item_type'] == 'D'), 'document_type' => $item ['document_type'], 'item_type' => $item ['item_type'], 'permissions' => $item ['permissions'], 'content_id' => $item ['content_id'], 'checked_out_by' => $item ['checked_out_by'], 'qtip' => $qtip ); | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + private function _processItemInclusion_search($item, $class, $qtip) { | ||
| 252 | + $this->logTrace ((__METHOD__.'('.__FILE__.' '.__LINE__.')'), 'Enter Function' ); | ||
| 253 | + if ($item ['filesize'] == 'n/a') { | ||
| 254 | + $item ['filesize'] = - 1; | ||
| 255 | + } | ||
| 256 | + return array ('text' => htmlspecialchars ( $item ['title'] ), 'originaltext' => $item ['title'], 'id' => $item ['document_id'], 'filename' => $item ['filename'], 'cls' => $class, 'leaf' => true, 'document_type' => $item ['document_type'], 'item_type' => 'D', 'permissions' => $item ['permissions'], 'content_id' => $item ['content_id'], 'filesize' => $item ['filesize'], 'modified' => $item ['modified_date'], 'created_date' => $item ['created_date'], 'checked_out_by' => $item ['checked_out_by'], 'relevance' => $item ['relevance'], 'qtip' => $qtip, 'version' => $item ['version'] ); | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + private function _processItemInclusion_grid($item, $class, $qtip) { | ||
| 260 | + $this->logTrace ((__METHOD__.'('.__FILE__.' '.__LINE__.')'), 'Enter Function' ); | ||
| 261 | + //var_dump($item); | ||
| 262 | + | ||
| 306 | 263 | ||
| 307 | - private function _processItemInclusion_grid($item, $class, $qtip) | ||
| 308 | - { | ||
| 309 | - //var_dump($item); | ||
| 310 | - | ||
| 311 | - if ($item['filesize']=='n/a') { | ||
| 312 | - $item['filesize']=-1; | ||
| 313 | - } | ||
| 314 | - | ||
| 315 | - return array ( | ||
| 316 | - 'text'=>htmlspecialchars($item['title']), | ||
| 317 | - 'originaltext'=>$item['title'], | ||
| 318 | - 'id'=>$item['id'], | ||
| 319 | - 'filename'=>$item['filename'], | ||
| 320 | - 'cls'=>$class, | ||
| 321 | - 'owner'=>$item['created_by'], | ||
| 322 | - 'document_type'=>$item['document_type'], | ||
| 323 | - 'item_type'=>$item['item_type'], | ||
| 324 | - 'permissions'=>$item['permissions'], | ||
| 325 | - 'created_date'=>$item['created_date'], | ||
| 326 | - 'content_id'=>$item['content_id'], | ||
| 327 | - 'filesize'=>$item['filesize'], | ||
| 328 | - 'modified'=>$item['modified_date'], | ||
| 329 | - 'checked_out_by'=>$item['checked_out_by'], | ||
| 330 | - 'version'=>$item['version'] | ||
| 331 | - ); | ||
| 332 | - } | ||
| 333 | - | ||
| 334 | - | 264 | + if ($item ['filesize'] == 'n/a') { |
| 265 | + $item ['filesize'] = - 1; | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + return array ('text' => htmlspecialchars ( $item ['title'] ), 'originaltext' => $item ['title'], 'id' => $item ['id'], 'filename' => $item ['filename'], 'cls' => $class, 'owner' => $item ['created_by'], 'document_type' => $item ['document_type'], 'item_type' => $item ['item_type'], 'permissions' => $item ['permissions'], 'created_date' => $item ['created_date'], 'content_id' => $item ['content_id'], 'filesize' => $item ['filesize'], 'modified' => $item ['modified_date'], 'checked_out_by' => $item ['checked_out_by'], 'version' => $item ['version'] ); | ||
| 269 | + } | ||
| 270 | + | ||
| 335 | public function get_metadata($params) { | 271 | public function get_metadata($params) { |
| 336 | - $kt=&$this->KT; | ||
| 337 | - | ||
| 338 | - if (substr($params['document_id'], 0, 2)=='D_') { | ||
| 339 | - $params['document_id']=substr($params['document_id'], 2); | 272 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); |
| 273 | + $kt = &$this->KT; | ||
| 274 | + | ||
| 275 | + if (substr ( $params ['document_id'], 0, 2 ) == 'D_') { | ||
| 276 | + $params ['document_id'] = substr ( $params ['document_id'], 2 ); | ||
| 340 | } | 277 | } |
| 341 | - | ||
| 342 | - $document_id=(int)$params['document_id']; | ||
| 343 | - if($document_id > 0) { | ||
| 344 | - $document=$kt->get_document_by_id($params['document_id']); | ||
| 345 | - $detail=$document->get_metadata(); | ||
| 346 | - $document_detail=$document->get_detail(); | ||
| 347 | - $title=$document_detail['title']; | ||
| 348 | - $document_type=$document_detail['document_type']; | ||
| 349 | - | ||
| 350 | - }else{ | ||
| 351 | - if(isset($params['document_type'])) { | ||
| 352 | - $document_type=$params['document_type']; | ||
| 353 | - }else{ | ||
| 354 | - $document_type='Default'; | ||
| 355 | - } | ||
| 356 | - $detail=$kt->get_document_type_metadata($document_type); | ||
| 357 | - $title=""; | ||
| 358 | - } | ||
| 359 | - | ||
| 360 | - $result=array(); | ||
| 361 | - $items=array(); | ||
| 362 | - $index=0; | ||
| 363 | - $items[]=array("name"=>"__title", "index"=>0, "value"=>$title, "control_type"=>"string"); | ||
| 364 | - | ||
| 365 | - | 278 | + |
| 279 | + $document_id = ( int ) $params ['document_id']; | ||
| 280 | + if ($document_id > 0) { | ||
| 281 | + $document = $kt->get_document_by_id ( $params ['document_id'] ); | ||
| 282 | + $detail = $document->get_metadata (); | ||
| 283 | + $document_detail = $document->get_detail (); | ||
| 284 | + $title = $document_detail ['title']; | ||
| 285 | + $document_type = $document_detail ['document_type']; | ||
| 286 | + | ||
| 287 | + } else { | ||
| 288 | + if (isset ( $params ['document_type'] )) { | ||
| 289 | + $document_type = $params ['document_type']; | ||
| 290 | + } else { | ||
| 291 | + $document_type = 'Default'; | ||
| 292 | + } | ||
| 293 | + $detail = $kt->get_document_type_metadata ( $document_type ); | ||
| 294 | + $title = ""; | ||
| 295 | + } | ||
| 296 | + | ||
| 297 | + $result = array (); | ||
| 298 | + $items = array (); | ||
| 299 | + $index = 0; | ||
| 300 | + $items [] = array ("name" => "__title", "index" => 0, "value" => $title, "control_type" => "string" ); | ||
| 301 | + | ||
| 366 | // Commented out for timebeing - will be used by 'Save in Format' | 302 | // Commented out for timebeing - will be used by 'Save in Format' |
| 303 | + | ||
| 367 | 304 | ||
| 368 | - if (isset($params['extensions'])) { | ||
| 369 | - | ||
| 370 | - $fileParts=pathinfo($document_detail['filename']); | ||
| 371 | - | ||
| 372 | - $items[]=array("name"=>"__document_extension", "index"=>0, "value"=>strtolower($fileParts['extension']), "control_type"=>"lookup", "selection"=>explode(',', str_replace('.', '', $params['extensions']))); | 305 | + if (isset ( $params ['extensions'] )) { |
| 306 | + | ||
| 307 | + $fileParts = pathinfo ( $document_detail ['filename'] ); | ||
| 308 | + | ||
| 309 | + $items [] = array ("name" => "__document_extension", "index" => 0, "value" => strtolower ( $fileParts ['extension'] ), "control_type" => "lookup", "selection" => explode ( ',', str_replace ( '.', '', $params ['extensions'] ) ) ); | ||
| 373 | } | 310 | } |
| 311 | + | ||
| 312 | + $document_types = $kt->get_documenttypes ( $params ); | ||
| 313 | + $items [] = array ("name" => "__document_type", "index" => 0, "value" => $document_type, "control_type" => "lookup", "selection" => $document_types ); | ||
| 314 | + | ||
| 315 | + foreach ( $detail as $fieldset ) { | ||
| 316 | + foreach ( $fieldset ['fields'] as $field ) { | ||
| 317 | + | ||
| 318 | + $prepArray = array ('fieldset' => $fieldset ['fieldset'], 'name' => $field ['name'], | ||
| 374 | 319 | ||
| 375 | - $document_types=$kt->get_documenttypes($params); | ||
| 376 | - $items[]=array("name"=>"__document_type", "index"=>0, "value"=>$document_type, "control_type"=>"lookup", "selection"=>$document_types); | ||
| 377 | - | ||
| 378 | - foreach ($detail as $fieldset) { | ||
| 379 | - foreach ($fieldset['fields'] as $field) { | 320 | + // Change for value. If blank value is set to 1, change value to '' |
| 321 | + // Overcomes issue of n/a | ||
| 322 | + 'value' => ($document_id > 0 ? ($field ['blankvalue'] == '1' ? '' : $field ['value']) : ''), | ||
| 380 | 323 | ||
| 381 | - $prepArray = array( | ||
| 382 | - 'fieldset' => $fieldset['fieldset'], | ||
| 383 | - 'name' => $field['name'], | ||
| 384 | - | ||
| 385 | - // Change for value. If blank value is set to 1, change value to '' | ||
| 386 | - // Overcomes issue of n/a | ||
| 387 | - 'value' => ($document_id > 0 ? ($field['blankvalue'] == '1' ? '' : $field['value']) : ''), | ||
| 388 | - | ||
| 389 | - 'description' => $field['description'], | ||
| 390 | - 'control_type' => $field['control_type'], | ||
| 391 | - 'selection' => $field['selection'], | ||
| 392 | - 'required' => $field['required'], | ||
| 393 | - 'blankvalue' => $field['blankvalue'], | ||
| 394 | - 'index' => $index | ||
| 395 | - ); | ||
| 396 | - | ||
| 397 | - // Small Adjustment for multiselect to real type | ||
| 398 | - if ($field['control_type'] == 'multiselect') { | ||
| 399 | - $prepArray['control_type'] = $field['options']['type']; | ||
| 400 | - } | ||
| 401 | - | ||
| 402 | - | ||
| 403 | - if (isset($field['options']['ishtml'])) { | ||
| 404 | - $prepArray['ishtml'] = $field['options']['ishtml']; | 324 | + 'description' => $field ['description'], 'control_type' => $field ['control_type'], 'selection' => $field ['selection'], 'required' => $field ['required'], 'blankvalue' => $field ['blankvalue'], 'index' => $index ); |
| 325 | + | ||
| 326 | + // Small Adjustment for multiselect to real type | ||
| 327 | + if ($field ['control_type'] == 'multiselect') { | ||
| 328 | + $prepArray ['control_type'] = $field ['options'] ['type']; | ||
| 329 | + } | ||
| 330 | + | ||
| 331 | + if (isset ( $field ['options'] ['ishtml'] )) { | ||
| 332 | + $prepArray ['ishtml'] = $field ['options'] ['ishtml']; | ||
| 405 | } else { | 333 | } else { |
| 406 | - $prepArray['ishtml'] = '0'; | 334 | + $prepArray ['ishtml'] = '0'; |
| 407 | } | 335 | } |
| 408 | 336 | ||
| 409 | - if (isset($field['options']['maxlength'])) { | ||
| 410 | - $prepArray['maxlength'] = $field['options']['maxlength']; | 337 | + if (isset ( $field ['options'] ['maxlength'] )) { |
| 338 | + $prepArray ['maxlength'] = $field ['options'] ['maxlength']; | ||
| 411 | } else { | 339 | } else { |
| 412 | - $prepArray['maxlength'] = '-1'; | 340 | + $prepArray ['maxlength'] = '-1'; |
| 413 | } | 341 | } |
| 414 | - | ||
| 415 | - $items[] = $prepArray; | ||
| 416 | - $index++; | ||
| 417 | - } | ||
| 418 | - } | ||
| 419 | - | ||
| 420 | - | ||
| 421 | - | ||
| 422 | - $this->setResponse(array('id'=>$title, 'items'=>$items, 'count'=>count($items))); | ||
| 423 | - | 342 | + |
| 343 | + $items [] = $prepArray; | ||
| 344 | + $index ++; | ||
| 345 | + } | ||
| 346 | + } | ||
| 347 | + | ||
| 348 | + $this->setResponse ( array ('id' => $title, 'items' => $items, 'count' => count ( $items ) ) ); | ||
| 349 | + | ||
| 424 | return true; | 350 | return true; |
| 425 | } | 351 | } |
| 426 | - | ||
| 427 | - | 352 | + |
| 428 | public function get_documenttypes($params) { | 353 | public function get_documenttypes($params) { |
| 429 | - | ||
| 430 | - $kt=&$this->KT; | ||
| 431 | - | ||
| 432 | - $detail=$kt->get_documenttypes(); | ||
| 433 | - $result=array(); | ||
| 434 | - $items=array(); | ||
| 435 | - for($i=0;$i<count($detail);$i++) { | ||
| 436 | - if(strtolower(substr($detail[$i], -5)) != 'email') | ||
| 437 | - { | ||
| 438 | - $items[]=array( | ||
| 439 | - 'name'=>$detail[$i] | ||
| 440 | - ); | 354 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); |
| 355 | + | ||
| 356 | + $kt = &$this->KT; | ||
| 357 | + | ||
| 358 | + $detail = $kt->get_documenttypes (); | ||
| 359 | + $result = array (); | ||
| 360 | + $items = array (); | ||
| 361 | + for($i = 0; $i < count ( $detail ); $i ++) { | ||
| 362 | + if (strtolower ( substr ( $detail [$i], - 5 ) ) != 'email') { | ||
| 363 | + $items [] = array ('name' => $detail [$i] ); | ||
| 441 | } | 364 | } |
| 442 | } | 365 | } |
| 443 | - $this->setResponse(array('items'=>$items, 'count'=>count($items))); | 366 | + $this->setResponse ( array ('items' => $items, 'count' => count ( $items ) ) ); |
| 444 | return true; | 367 | return true; |
| 445 | } | 368 | } |
| 446 | - | 369 | + |
| 447 | function update_document_type($params) { | 370 | function update_document_type($params) { |
| 448 | - $kt=&$this->KT; | ||
| 449 | - $document_id=(int)$params['document_id']; | ||
| 450 | - if($document_id > 0) { | ||
| 451 | - $document=$kt->get_document_by_id($document_id); | ||
| 452 | - $document->change_document_type($params['document_type']); | ||
| 453 | - $this->setResponse(array('status_code'=>0)); | ||
| 454 | - return true; | ||
| 455 | - | ||
| 456 | - }else{ | ||
| 457 | - $this->addError("Invalid document Id : {$document_id}"); | ||
| 458 | - $this->setResponse(array('status_code'=>1)); | ||
| 459 | - return false; | ||
| 460 | - } | ||
| 461 | - | 371 | + $kt = &$this->KT; |
| 372 | + $document_id = ( int ) $params ['document_id']; | ||
| 373 | + if ($document_id > 0) { | ||
| 374 | + $document = $kt->get_document_by_id ( $document_id ); | ||
| 375 | + $document->change_document_type ( $params ['document_type'] ); | ||
| 376 | + $this->setResponse ( array ('status_code' => 0 ) ); | ||
| 377 | + return true; | ||
| 378 | + | ||
| 379 | + } else { | ||
| 380 | + $this->addError ( "Invalid document Id : {$document_id}" ); | ||
| 381 | + $this->setResponse ( array ('status_code' => 1 ) ); | ||
| 382 | + return false; | ||
| 383 | + } | ||
| 384 | + | ||
| 462 | } | 385 | } |
| 463 | - | 386 | + |
| 464 | /** | 387 | /** |
| 465 | * Get a url for downloading the specified document | 388 | * Get a url for downloading the specified document |
| 466 | * Parameters: | 389 | * Parameters: |
| @@ -470,91 +393,86 @@ class kt extends client_service { | @@ -470,91 +393,86 @@ class kt extends client_service { | ||
| 470 | * | 393 | * |
| 471 | * @param unknown_type $params | 394 | * @param unknown_type $params |
| 472 | */ | 395 | */ |
| 473 | - function download_document($params,$returnResult=false) { | ||
| 474 | - | ||
| 475 | - $kt=&$this->KT; | ||
| 476 | - $params['session_id']=$params['session_id']?$params['session_id']:$this->AuthInfo['session']; | ||
| 477 | - $params['app_type']=$params['app_type']?$params['app_type']:$this->AuthInfo['appType']; | ||
| 478 | - $params['app_type']='air'; | ||
| 479 | - $multipart=isset($params['multipart'])?(bool)$params['multipart']:false; | ||
| 480 | - $multipart=false; | ||
| 481 | - | ||
| 482 | - $this->Response->addDebug('download_document Parameters',$params); | ||
| 483 | - | ||
| 484 | - | ||
| 485 | - $session_id=$params['session_id']; | ||
| 486 | - | ||
| 487 | - | ||
| 488 | - $document=&$kt->get_document_by_id($params['document_id']); | ||
| 489 | - // $docname='test.txt'; | ||
| 490 | - if (PEAR::isError($document)) | ||
| 491 | - { | ||
| 492 | - $response['message']=$document->getMessage(); | ||
| 493 | - $this->addDebug("download_document - cannot get $document_id - " . $document->getMessage(), $document); | ||
| 494 | - | ||
| 495 | -// $this->setResponse(new SOAP_Value('$this->response=',"{urn:$this->namespace}kt_response", $response)); | ||
| 496 | - $this->setResponse($response); | ||
| 497 | - return; | ||
| 498 | - } | ||
| 499 | - $docname=$document->document->getFileName(); | ||
| 500 | - $result=$document->download(); | ||
| 501 | - if (PEAR::isError($result)) | ||
| 502 | - { | ||
| 503 | - $response['message']=$result->getMessage(); | ||
| 504 | - $this->setResponse(array('status_code'=>1, 'message'=>$result->getMessage())); | 396 | + function download_document($params, $returnResult = false){ |
| 397 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 398 | + | ||
| 399 | + $kt = &$this->KT; | ||
| 400 | + $params ['session_id'] = $params ['session_id'] ? $params ['session_id'] : $this->AuthInfo ['session']; | ||
| 401 | + $params ['app_type'] = $params ['app_type'] ? $params ['app_type'] : $this->AuthInfo ['appType']; | ||
| 402 | + $params ['app_type'] = 'air'; | ||
| 403 | + $multipart = isset ( $params ['multipart'] ) ? ( bool ) $params ['multipart'] : false; | ||
| 404 | + $multipart = false; | ||
| 405 | + | ||
| 406 | + $this->Response->addDebug ( 'download_document Parameters', $params ); | ||
| 407 | + | ||
| 408 | + $session_id = $params ['session_id']; | ||
| 409 | + | ||
| 410 | + $document = &$kt->get_document_by_id ( $params ['document_id'] ); | ||
| 411 | + // $docname='test.txt'; | ||
| 412 | + if (PEAR::isError ( $document )) { | ||
| 413 | + $response ['message'] = $document->getMessage (); | ||
| 414 | + $this->addDebug ( "download_document - cannot get $document_id - " . $document->getMessage (), $document ); | ||
| 415 | + | ||
| 416 | + // $this->setResponse(new SOAP_Value('$this->response=',"{urn:$this->namespace}kt_response", $response)); | ||
| 417 | + $this->setResponse ( $response ); | ||
| 505 | return; | 418 | return; |
| 506 | - } | ||
| 507 | - | ||
| 508 | - $session=&$kt->get_session(); | ||
| 509 | - $download_manager=new KTDownloadManager(); | ||
| 510 | - $download_manager->set_session($session->session); | ||
| 511 | - $download_manager->cleanup(); | ||
| 512 | - $url=$download_manager->allow_download($document,NULL,$multipart); | ||
| 513 | - //http://ktair.dev?code=750f7a09d40a3d855f2897f417baf0bbb9a1f615&d=16&u=evm2pdkkhfagon47eh2b9slqj6 | ||
| 514 | - /* | 419 | + } |
| 420 | + $docname = $document->document->getFileName (); | ||
| 421 | + $result = $document->download (); | ||
| 422 | + if (PEAR::isError ( $result )) { | ||
| 423 | + $response ['message'] = $result->getMessage (); | ||
| 424 | + $this->setResponse ( array ('status_code' => 1, 'message' => $result->getMessage () ) ); | ||
| 425 | + return; | ||
| 426 | + } | ||
| 427 | + | ||
| 428 | + $session = &$kt->get_session (); | ||
| 429 | + $download_manager = new KTDownloadManager ( ); | ||
| 430 | + $download_manager->set_session ( $session->session ); | ||
| 431 | + $download_manager->cleanup (); | ||
| 432 | + $url = $download_manager->allow_download ( $document, NULL, $multipart ); | ||
| 433 | + //http://ktair.dev?code=750f7a09d40a3d855f2897f417baf0bbb9a1f615&d=16&u=evm2pdkkhfagon47eh2b9slqj6 | ||
| 434 | + /* | ||
| 515 | $this->addDebug('url before split',$url); | 435 | $this->addDebug('url before split',$url); |
| 516 | $url=split('\?',$url); | 436 | $url=split('\?',$url); |
| 517 | $this->addDebug('url after split',$url); | 437 | $this->addDebug('url after split',$url); |
| 518 | $url=$url[0].'/ktwebservice/download.php?'.$url[1]; | 438 | $url=$url[0].'/ktwebservice/download.php?'.$url[1]; |
| 519 | $this->addDebug('url after recombo',$url); | 439 | $this->addDebug('url after recombo',$url); |
| 520 | */ | 440 | */ |
| 521 | - | ||
| 522 | - $response['status_code']=0; | ||
| 523 | - $response['message']=$url.'&apptype='.$params['app_type']; | ||
| 524 | - $response['filename']=$docname; | ||
| 525 | - | ||
| 526 | - $this->addDebug('effective params',$params); | ||
| 527 | - | ||
| 528 | - if($returnResult){ | ||
| 529 | - return $response; | ||
| 530 | - }else{ | ||
| 531 | - $this->setResponse($response); | ||
| 532 | - } | ||
| 533 | - } | ||
| 534 | - | ||
| 535 | - /** | ||
| 536 | - * Get download URLS for multiple documents | ||
| 537 | - * params contains: | ||
| 538 | - * app_type | ||
| 539 | - * documents = array of doc_id | ||
| 540 | - * | ||
| 541 | - * @param unknown_type $params | ||
| 542 | - */ | ||
| 543 | - public function download_multiple_documents($params){ | ||
| 544 | - $response=array(); | ||
| 545 | - foreach($params['documents'] as $docId){ | ||
| 546 | - $ret=$this->download_document(array('document_id'=>$docId,'app_type'=>$params['app_type'],'multipart'=>$params['multipart']),true); | ||
| 547 | - $this->Response->addDebug('Trying to create Download Link for '.$docId,$ret); | ||
| 548 | - $rec=array( | ||
| 549 | - 'filename' =>$ret['filename'], | ||
| 550 | - 'url' =>$ret['message'], | ||
| 551 | - 'succeeded' =>$ret['status_code']==0?true:false | ||
| 552 | - ); | ||
| 553 | - if(is_array($ret))$response[$docId]=$rec; | ||
| 554 | - } | ||
| 555 | - $this->setResponse($response); | ||
| 556 | - } | ||
| 557 | - | 441 | + |
| 442 | + $response ['status_code'] = 0; | ||
| 443 | + $response ['message'] = $url . '&apptype=' . $params ['app_type']; | ||
| 444 | + $response ['filename'] = $docname; | ||
| 445 | + | ||
| 446 | + $this->addDebug ( 'effective params', $params ); | ||
| 447 | + | ||
| 448 | + if ($returnResult) { | ||
| 449 | + return $response; | ||
| 450 | + } else { | ||
| 451 | + $this->setResponse ( $response ); | ||
| 452 | + } | ||
| 453 | + } | ||
| 454 | + | ||
| 455 | + /** | ||
| 456 | + * Get download URLS for multiple documents | ||
| 457 | + * params contains: | ||
| 458 | + * app_type | ||
| 459 | + * documents = array of doc_id | ||
| 460 | + * | ||
| 461 | + * @param unknown_type $params | ||
| 462 | + */ | ||
| 463 | + public function download_multiple_documents($params) { | ||
| 464 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 465 | + $response = array (); | ||
| 466 | + foreach ( $params ['documents'] as $docId ) { | ||
| 467 | + $ret = $this->download_document ( array ('document_id' => $docId, 'app_type' => $params ['app_type'], 'multipart' => $params ['multipart'] ), true ); | ||
| 468 | + $this->Response->addDebug ( 'Trying to create Download Link for ' . $docId, $ret ); | ||
| 469 | + $rec = array ('filename' => $ret ['filename'], 'url' => $ret ['message'], 'succeeded' => $ret ['status_code'] == 0 ? true : false ); | ||
| 470 | + if (is_array ( $ret )) | ||
| 471 | + $response [$docId] = $rec; | ||
| 472 | + } | ||
| 473 | + $this->setResponse ( $response ); | ||
| 474 | + } | ||
| 475 | + | ||
| 558 | /** | 476 | /** |
| 559 | * Checkout a Document | 477 | * Checkout a Document |
| 560 | * params contains: | 478 | * params contains: |
| @@ -564,39 +482,36 @@ class kt extends client_service { | @@ -564,39 +482,36 @@ class kt extends client_service { | ||
| 564 | * @param array $params | 482 | * @param array $params |
| 565 | * | 483 | * |
| 566 | */ | 484 | */ |
| 567 | - function checkout_document($params){ | ||
| 568 | - $responseType='kt_response'; | ||
| 569 | - $kt=&$this->KT; | ||
| 570 | - | ||
| 571 | - $document=&$kt->get_document_by_id($params['document_id']); | ||
| 572 | - if (PEAR::isError($document)) | ||
| 573 | - { | ||
| 574 | - $this->addError("checkout_document - cannot get documentid {$params['document_id']} - " . $document->getMessage()); | ||
| 575 | - $this->setResponse(array('status_code'=>1, 'message'=>$document->getMessage())); | 485 | + function checkout_document($params) { |
| 486 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 487 | + $responseType = 'kt_response'; | ||
| 488 | + $kt = &$this->KT; | ||
| 489 | + | ||
| 490 | + $document = &$kt->get_document_by_id ( $params ['document_id'] ); | ||
| 491 | + if (PEAR::isError ( $document )) { | ||
| 492 | + $this->addError ( "checkout_document - cannot get documentid {$params['document_id']} - " . $document->getMessage () ); | ||
| 493 | + $this->setResponse ( array ('status_code' => 1, 'message' => $document->getMessage () ) ); | ||
| 576 | return; | 494 | return; |
| 577 | - } | ||
| 578 | - | ||
| 579 | - $result=$document->checkout($params['reason']); | ||
| 580 | - if (PEAR::isError($result)) | ||
| 581 | - { | ||
| 582 | - $this->addError($result->getMessage()); | ||
| 583 | - $this->setResponse(array('status_code'=>1, 'message'=>$result->getMessage())); | ||
| 584 | - return; | ||
| 585 | - } | ||
| 586 | - | ||
| 587 | - $url=''; | ||
| 588 | - if ($params['download']) | ||
| 589 | - { | ||
| 590 | - $download_manager=new KTDownloadManager(); | ||
| 591 | - $download_manager->set_session($params['session_id']); | ||
| 592 | - $download_manager->cleanup(); | ||
| 593 | - $url=$download_manager->allow_download($document); | ||
| 594 | - } | ||
| 595 | - | ||
| 596 | - $this->setResponse(array('status_code'=>0, 'message'=>$url)); | ||
| 597 | - } | ||
| 598 | - | ||
| 599 | - | 495 | + } |
| 496 | + | ||
| 497 | + $result = $document->checkout ( $params ['reason'] ); | ||
| 498 | + if (PEAR::isError ( $result )) { | ||
| 499 | + $this->addError ( $result->getMessage () ); | ||
| 500 | + $this->setResponse ( array ('status_code' => 1, 'message' => $result->getMessage () ) ); | ||
| 501 | + return; | ||
| 502 | + } | ||
| 503 | + | ||
| 504 | + $url = ''; | ||
| 505 | + if ($params ['download']) { | ||
| 506 | + $download_manager = new KTDownloadManager ( ); | ||
| 507 | + $download_manager->set_session ( $params ['session_id'] ); | ||
| 508 | + $download_manager->cleanup (); | ||
| 509 | + $url = $download_manager->allow_download ( $document ); | ||
| 510 | + } | ||
| 511 | + | ||
| 512 | + $this->setResponse ( array ('status_code' => 0, 'message' => $url ) ); | ||
| 513 | + } | ||
| 514 | + | ||
| 600 | /** | 515 | /** |
| 601 | * Checkin Document //TODO: Find out how upload works | 516 | * Checkin Document //TODO: Find out how upload works |
| 602 | * params contains: | 517 | * params contains: |
| @@ -607,706 +522,692 @@ class kt extends client_service { | @@ -607,706 +522,692 @@ class kt extends client_service { | ||
| 607 | * | 522 | * |
| 608 | * @param array $params | 523 | * @param array $params |
| 609 | */ | 524 | */ |
| 610 | - function checkin_document($params){ | ||
| 611 | - $session_id=$this->AuthInfo['session']; | ||
| 612 | - $document_id=$params['document_id']; | ||
| 613 | - $filename=$params['filename']; | ||
| 614 | - $reason=$params['reason']; | ||
| 615 | - $tempfilename=$params['tempfilename']; | ||
| 616 | - $major_update=$params['major_update']; | ||
| 617 | - $application=$this->AuthInfo['appType']; | ||
| 618 | - | ||
| 619 | - $this->addDebug('Checkin',"checkin_document('$session_id',$document_id,'$filename','$reason','$tempfilename', '$application', $major_update)"); | ||
| 620 | - $kt=&$this->KT; | ||
| 621 | - | ||
| 622 | - // we need to add some security to ensure that people don't frig the checkin process to access restricted files. | 525 | + function checkin_document($params) { |
| 526 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 527 | + $session_id = $this->AuthInfo ['session']; | ||
| 528 | + $document_id = $params ['document_id']; | ||
| 529 | + $filename = $params ['filename']; | ||
| 530 | + $reason = $params ['reason']; | ||
| 531 | + $tempfilename = $params ['tempfilename']; | ||
| 532 | + $major_update = $params ['major_update']; | ||
| 533 | + $application = $this->AuthInfo ['appType']; | ||
| 534 | + | ||
| 535 | + $this->addDebug ( 'Checkin', "checkin_document('$session_id',$document_id,'$filename','$reason','$tempfilename', '$application', $major_update)" ); | ||
| 536 | + $kt = &$this->KT; | ||
| 537 | + | ||
| 538 | + // we need to add some security to ensure that people don't frig the checkin process to access restricted files. | ||
| 623 | // possibly should change 'tempfilename' to be a hash or id of some sort if this is troublesome. | 539 | // possibly should change 'tempfilename' to be a hash or id of some sort if this is troublesome. |
| 624 | - $upload_manager=new KTUploadManager(); | ||
| 625 | - if (!$upload_manager->is_valid_temporary_file($tempfilename)) | ||
| 626 | - { | ||
| 627 | - $this->setResponse(array('status_code'=>12)); | 540 | + $upload_manager = new KTUploadManager ( ); |
| 541 | + if (! $upload_manager->is_valid_temporary_file ( $tempfilename )) { | ||
| 542 | + $this->setResponse ( array ('status_code' => 12 ) ); | ||
| 628 | return; | 543 | return; |
| 629 | - } | ||
| 630 | - | ||
| 631 | - $document=&$kt->get_document_by_id($document_id); | ||
| 632 | - if (PEAR::isError($document)) | ||
| 633 | - { | ||
| 634 | - $this->setResponse(array('status_code'=>13)); | ||
| 635 | } | 544 | } |
| 636 | - | 545 | + |
| 546 | + $document = &$kt->get_document_by_id ( $document_id ); | ||
| 547 | + if (PEAR::isError ( $document )) { | ||
| 548 | + $this->setResponse ( array ('status_code' => 13 ) ); | ||
| 549 | + } | ||
| 550 | + | ||
| 637 | // checkin | 551 | // checkin |
| 638 | - $result=$document->checkin($filename, $reason, $tempfilename, $major_update); | ||
| 639 | - if (PEAR::isError($result)) | ||
| 640 | - { | ||
| 641 | - $this->setResponse(array('status_code'=>14)); | 552 | + $result = $document->checkin ( $filename, $reason, $tempfilename, $major_update ); |
| 553 | + if (PEAR::isError ( $result )) { | ||
| 554 | + $this->setResponse ( array ('status_code' => 14 ) ); | ||
| 642 | } | 555 | } |
| 643 | - | ||
| 644 | - // get status after checkin | 556 | + |
| 557 | + // get status after checkin | ||
| 645 | //$this->response= $this->get_document_detail($session_id, $document_id); | 558 | //$this->response= $this->get_document_detail($session_id, $document_id); |
| 646 | - $detail=$document->get_detail(); | ||
| 647 | - $detail['status_code']=0; | ||
| 648 | - $detail['message']=''; | ||
| 649 | - | ||
| 650 | - $this->setResponse($detail); | ||
| 651 | - } | ||
| 652 | - | ||
| 653 | - | ||
| 654 | - /** | ||
| 655 | - * Upload a document | ||
| 656 | - * | ||
| 657 | - * @param unknown_type $arr | ||
| 658 | - */ | ||
| 659 | - function add_document_with_metadata($arr){ | ||
| 660 | - $session_id=$arr['session_id']; | ||
| 661 | - //error_reporting(E_ALL); | ||
| 662 | - $metadata=array(); | ||
| 663 | - $packed=$arr['metadata']; | ||
| 664 | - | ||
| 665 | - foreach($meta as $item){ | ||
| 666 | - $fieldSet=$item['fieldset']; | ||
| 667 | - unset($item['fieldset']); | ||
| 668 | - $metadata[$fieldSet]['fieldset']=$fieldSet; | ||
| 669 | - $metadata[$fieldSet]['fields'][]=$item; | ||
| 670 | - } | ||
| 671 | - | ||
| 672 | - $kt=&$this->KT; | ||
| 673 | - | ||
| 674 | - $upload_manager=new KTUploadManager(); | ||
| 675 | - if (!$upload_manager->is_valid_temporary_file($arr['tempfilename'])) { | ||
| 676 | - $this->addError('Temporary File Not Valid'); | ||
| 677 | - $this->setResponse(array('status_code'=>1, 'message'=>'Temporary File Not Valid')); | 559 | + $detail = $document->get_detail (); |
| 560 | + $detail ['status_code'] = 0; | ||
| 561 | + $detail ['message'] = ''; | ||
| 562 | + | ||
| 563 | + $this->setResponse ( $detail ); | ||
| 564 | + } | ||
| 565 | + | ||
| 566 | + /** | ||
| 567 | + * Upload a document | ||
| 568 | + * | ||
| 569 | + * @param unknown_type $arr | ||
| 570 | + */ | ||
| 571 | + function add_document_with_metadata($arr) { | ||
| 572 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 573 | + $session_id = $arr ['session_id']; | ||
| 574 | + //error_reporting(E_ALL); | ||
| 575 | + $metadata = array (); | ||
| 576 | + $packed = $arr ['metadata']; | ||
| 577 | + | ||
| 578 | + foreach ( $meta as $item ) { | ||
| 579 | + $fieldSet = $item ['fieldset']; | ||
| 580 | + unset ( $item ['fieldset'] ); | ||
| 581 | + $metadata [$fieldSet] ['fieldset'] = $fieldSet; | ||
| 582 | + $metadata [$fieldSet] ['fields'] [] = $item; | ||
| 583 | + } | ||
| 584 | + | ||
| 585 | + $kt = &$this->KT; | ||
| 586 | + | ||
| 587 | + $upload_manager = new KTUploadManager ( ); | ||
| 588 | + if (! $upload_manager->is_valid_temporary_file ( $arr ['tempfilename'] )) { | ||
| 589 | + $this->addError ( 'Temporary File Not Valid' ); | ||
| 590 | + $this->setResponse ( array ('status_code' => 1, 'message' => 'Temporary File Not Valid' ) ); | ||
| 678 | return false; | 591 | return false; |
| 679 | - } | ||
| 680 | - $this->addDebug('','Exited is_valid_temporary file'); | ||
| 681 | - | ||
| 682 | - $folder=&$kt->get_folder_by_id($arr['folder_id']); | ||
| 683 | - if (PEAR::isError($folder)){ | ||
| 684 | - $this->addError('Could not find Folder '.$arr['folder_id']); | ||
| 685 | - $this->setResponse(array('status_code'=>1, 'message'=>'Could not find Folder '.$arr['folder_id'])); | ||
| 686 | - return false; | ||
| 687 | } | 592 | } |
| 593 | + $this->addDebug ( '', 'Exited is_valid_temporary file' ); | ||
| 688 | 594 | ||
| 689 | - $document=&$folder->add_document($arr['title'], $arr['filename'], $arr['documenttype'], $arr['tempfilename']); | ||
| 690 | - if (PEAR::isError($document)){ | ||
| 691 | - $this->addError("Could not add Document [title:{$title},filename:{$filename},documenttype:{$documenttype},tempfilename:{$tempfilename}]"); | ||
| 692 | - $this->setResponse(array('status_code'=>1, 'message'=>'Could not add Document')); | ||
| 693 | - return false; | 595 | + $folder = &$kt->get_folder_by_id ( $arr ['folder_id'] ); |
| 596 | + if (PEAR::isError ( $folder )) { | ||
| 597 | + $this->addError ( 'Could not find Folder ' . $arr ['folder_id'] ); | ||
| 598 | + $this->setResponse ( array ('status_code' => 1, 'message' => 'Could not find Folder ' . $arr ['folder_id'] ) ); | ||
| 599 | + return false; | ||
| 694 | } | 600 | } |
| 695 | - | ||
| 696 | - | ||
| 697 | - $document_id=$document->get_documentid(); | ||
| 698 | - | ||
| 699 | - $update_result=$this->update_document_metadata($arr['session_id'], $document_id, $metadata, $arr['application'], array()); | ||
| 700 | - | ||
| 701 | - $status_code=$update_result['status_code']; | ||
| 702 | - if ($status_code != 0) | ||
| 703 | - { | ||
| 704 | - $this->delete_document(array('session_id' => $arr['session_id'], 'document_id' => $document_id, 'reason' => 'Rollback because metadata could not be added', 'application' => $arr['application'])); | ||
| 705 | - $this->response= $update_result; | 601 | + |
| 602 | + $document = &$folder->add_document ( $arr ['title'], $arr ['filename'], $arr ['documenttype'], $arr ['tempfilename'] ); | ||
| 603 | + if (PEAR::isError ( $document )) { | ||
| 604 | + $this->addError ( "Could not add Document [title:{$title},filename:{$filename},documenttype:{$documenttype},tempfilename:{$tempfilename}]" ); | ||
| 605 | + $this->setResponse ( array ('status_code' => 1, 'message' => 'Could not add Document' ) ); | ||
| 606 | + return false; | ||
| 706 | } | 607 | } |
| 707 | - | ||
| 708 | - | ||
| 709 | - $result=$document->mergeWithLastMetadataVersion(); | ||
| 710 | - if (PEAR::isError($result)) | ||
| 711 | - { | 608 | + |
| 609 | + $document_id = $document->get_documentid (); | ||
| 610 | + | ||
| 611 | + $update_result = $this->update_document_metadata ( $arr ['session_id'], $document_id, $metadata, $arr ['application'], array () ); | ||
| 612 | + | ||
| 613 | + $status_code = $update_result ['status_code']; | ||
| 614 | + if ($status_code != 0) { | ||
| 615 | + $this->delete_document ( array ('session_id' => $arr ['session_id'], 'document_id' => $document_id, 'reason' => 'Rollback because metadata could not be added', 'application' => $arr ['application'] ) ); | ||
| 616 | + $this->response = $update_result; | ||
| 617 | + } | ||
| 618 | + | ||
| 619 | + $result = $document->mergeWithLastMetadataVersion (); | ||
| 620 | + if (PEAR::isError ( $result )) { | ||
| 712 | // not much we can do, maybe just log! | 621 | // not much we can do, maybe just log! |
| 713 | } | 622 | } |
| 714 | - | ||
| 715 | - $this->response= array('status_code'=>0, 'document_id'=>$document_id); | ||
| 716 | - } | 623 | + |
| 624 | + $this->response = array ('status_code' => 0, 'document_id' => $document_id ); | ||
| 625 | + } | ||
| 717 | 626 | ||
| 718 | - function create_empty_upload_file($params){ | ||
| 719 | - $config=KTConfig::getSingleton(); | ||
| 720 | - $this->addDebug('KTConfig Singleton',$config); | ||
| 721 | - $uploadFolder=$config->get('webservice/uploadDirectory'); | 627 | + function create_empty_upload_file($params) { |
| 628 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 629 | + $config = KTConfig::getSingleton (); | ||
| 630 | + $this->addDebug ( 'KTConfig Singleton', $config ); | ||
| 631 | + $uploadFolder = $config->get ( 'webservice/uploadDirectory' ); | ||
| 722 | 632 | ||
| 723 | - $result = array(); | 633 | + $result = array (); |
| 724 | 634 | ||
| 725 | - if ($file = fopen($uploadFolder."/".$params['filename'], 'w')) { | ||
| 726 | - fclose($file); | ||
| 727 | - $result['status_code'] = '0'; | ||
| 728 | - $result['filename'] = $uploadFolder."/".$params['filename']; | 635 | + if ($file = fopen ( $uploadFolder . "/" . $params ['filename'], 'w' )) { |
| 636 | + fclose ( $file ); | ||
| 637 | + $result ['status_code'] = '0'; | ||
| 638 | + $result ['filename'] = $uploadFolder . "/" . $params ['filename']; | ||
| 729 | } else { | 639 | } else { |
| 730 | - $result['status_code'] = '1'; | ||
| 731 | - $result['filename'] = $uploadFolder."/".$params['filename']; | 640 | + $result ['status_code'] = '1'; |
| 641 | + $result ['filename'] = $uploadFolder . "/" . $params ['filename']; | ||
| 732 | } | 642 | } |
| 733 | - $this->setResponse($result); | 643 | + $this->setResponse ( $result ); |
| 734 | return true; | 644 | return true; |
| 735 | } | 645 | } |
| 736 | - | ||
| 737 | - function get_all_client_policies(){ | ||
| 738 | - $config=KTConfig::getSingleton(); | ||
| 739 | - $this->addDebug('KTConfig Singleton',$config); | 646 | + |
| 647 | + function get_all_client_policies() { | ||
| 648 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 649 | + $config = KTConfig::getSingleton (); | ||
| 650 | + $this->addDebug ( 'KTConfig Singleton', $config ); | ||
| 740 | 651 | ||
| 741 | - $policies=array('allowRememberPassword', 'captureReasonsCheckin', 'captureReasonsCheckout'); | 652 | + $policies = array ('allowRememberPassword', 'captureReasonsCheckin', 'captureReasonsCheckout' ); |
| 742 | 653 | ||
| 743 | - $returnPolicies=array(); | 654 | + $returnPolicies = array (); |
| 744 | 655 | ||
| 745 | - foreach ($policies as $policy_name) | ||
| 746 | - { | ||
| 747 | - $policyInfo=array( | ||
| 748 | - 'name'=>$policy_name, | ||
| 749 | - 'value'=>serviceHelper::bool2str($config->get('addInPolicies/'.$policy_name)), | ||
| 750 | - 'type'=>'boolean' | ||
| 751 | - ); | 656 | + foreach ( $policies as $policy_name ) { |
| 657 | + $policyInfo = array ('name' => $policy_name, 'value' => serviceHelper::bool2str ( $config->get ( 'addInPolicies/' . $policy_name ) ), 'type' => 'boolean' ); | ||
| 752 | 658 | ||
| 753 | - $returnPolicies[$policy_name] =$policyInfo; | 659 | + $returnPolicies [$policy_name] = $policyInfo; |
| 754 | } | 660 | } |
| 755 | 661 | ||
| 756 | - $languages=$this->get_languages(true); | ||
| 757 | - | ||
| 758 | - $metadata=array('totalProperty'=>'resultsCounter', 'root'=>'languages', 'fields'=>array('isoCode', 'language')); | 662 | + $languages = $this->get_languages ( true ); |
| 759 | 663 | ||
| 760 | - $finalArray=array(); | ||
| 761 | - $finalArray['metaData']=$metadata; | ||
| 762 | - $finalArray['policies']=$returnPolicies; | ||
| 763 | - $finalArray['languages']=$languages['languages']; | ||
| 764 | - $finalArray['defaultLanguage']=$languages['defaultLanguage']; | ||
| 765 | - $finalArray['resultsCounter']=$languages['count']; | 664 | + $metadata = array ('totalProperty' => 'resultsCounter', 'root' => 'languages', 'fields' => array ('isoCode', 'language' ) ); |
| 766 | 665 | ||
| 666 | + $finalArray = array (); | ||
| 667 | + $finalArray ['metaData'] = $metadata; | ||
| 668 | + $finalArray ['policies'] = $returnPolicies; | ||
| 669 | + $finalArray ['languages'] = $languages ['languages']; | ||
| 670 | + $finalArray ['defaultLanguage'] = $languages ['defaultLanguage']; | ||
| 671 | + $finalArray ['resultsCounter'] = $languages ['count']; | ||
| 767 | 672 | ||
| 768 | - $this->setResponse($finalArray); | 673 | + $this->setResponse ( $finalArray ); |
| 769 | return true; | 674 | return true; |
| 770 | } | 675 | } |
| 771 | - | ||
| 772 | - function get_all_explorer_policies(){ | ||
| 773 | - $config=KTConfig::getSingleton(); | ||
| 774 | - $this->addDebug('KTConfig Singleton',$config); | 676 | + |
| 677 | + function get_all_explorer_policies() { | ||
| 678 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 679 | + $config = KTConfig::getSingleton (); | ||
| 680 | + $this->addDebug ( 'KTConfig Singleton', $config ); | ||
| 775 | 681 | ||
| 776 | - $policies=array('allowRememberPassword', 'explorerMetadataCapture', 'officeMetadataCapture', 'captureReasonsCheckin', 'captureReasonsCheckout', 'captureReasonsDelete', 'captureReasonsCancelCheckout', 'captureReasonsCopyInKT', 'captureReasonsMoveInKT'); | 682 | + $policies = array ('allowRememberPassword', 'explorerMetadataCapture', 'officeMetadataCapture', 'captureReasonsCheckin', 'captureReasonsCheckout', 'captureReasonsDelete', 'captureReasonsCancelCheckout', 'captureReasonsCopyInKT', 'captureReasonsMoveInKT' ); |
| 777 | 683 | ||
| 778 | - $returnPolicies=array(); | ||
| 779 | - $test = $config->get('clientToolPolicies/allowRememberPassword'); | 684 | + $returnPolicies = array (); |
| 685 | + $test = $config->get ( 'clientToolPolicies/allowRememberPassword' ); | ||
| 780 | global $default; | 686 | global $default; |
| 781 | - $default->log->error('I am here-'.$test); | ||
| 782 | - foreach ($policies as $policy_name) | ||
| 783 | - { | ||
| 784 | - $policyInfo=array( | ||
| 785 | - 'name'=>$policy_name, | ||
| 786 | - 'value'=>serviceHelper::bool2str($config->get('clientToolPolicies/'.$policy_name)), | ||
| 787 | - 'type'=>'boolean' | ||
| 788 | - ); | 687 | + $default->log->error ( 'I am here-' . $test ); |
| 688 | + foreach ( $policies as $policy_name ) { | ||
| 689 | + $policyInfo = array ('name' => $policy_name, 'value' => serviceHelper::bool2str ( $config->get ( 'clientToolPolicies/' . $policy_name ) ), 'type' => 'boolean' ); | ||
| 789 | 690 | ||
| 790 | - $returnPolicies[$policy_name] =$policyInfo; | 691 | + $returnPolicies [$policy_name] = $policyInfo; |
| 791 | } | 692 | } |
| 792 | 693 | ||
| 793 | - $languages=$this->get_languages(true); | ||
| 794 | - | ||
| 795 | - $metadata=array('totalProperty'=>'resultsCounter', 'root'=>'languages', 'fields'=>array('isoCode', 'language')); | 694 | + $languages = $this->get_languages ( true ); |
| 796 | 695 | ||
| 797 | - $finalArray=array(); | ||
| 798 | - $finalArray['metaData']=$metadata; | ||
| 799 | - $finalArray['policies']=$returnPolicies; | ||
| 800 | - $finalArray['languages']=$languages['languages']; | ||
| 801 | - $finalArray['defaultLanguage']=$languages['defaultLanguage']; | ||
| 802 | - $finalArray['resultsCounter']=$languages['count']; | 696 | + $metadata = array ('totalProperty' => 'resultsCounter', 'root' => 'languages', 'fields' => array ('isoCode', 'language' ) ); |
| 803 | 697 | ||
| 698 | + $finalArray = array (); | ||
| 699 | + $finalArray ['metaData'] = $metadata; | ||
| 700 | + $finalArray ['policies'] = $returnPolicies; | ||
| 701 | + $finalArray ['languages'] = $languages ['languages']; | ||
| 702 | + $finalArray ['defaultLanguage'] = $languages ['defaultLanguage']; | ||
| 703 | + $finalArray ['resultsCounter'] = $languages ['count']; | ||
| 804 | 704 | ||
| 805 | - $this->setResponse($finalArray); | 705 | + $this->setResponse ( $finalArray ); |
| 806 | return true; | 706 | return true; |
| 807 | } | 707 | } |
| 808 | 708 | ||
| 809 | - public function switchlang($params){ | ||
| 810 | - setcookie("kt_language", $params['lang'], 2147483647, '/'); | 709 | + public function switchlang($params) { |
| 710 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 711 | + setcookie ( "kt_language", $params ['lang'], 2147483647, '/' ); | ||
| 811 | } | 712 | } |
| 812 | - | ||
| 813 | - | ||
| 814 | - function add_document_params($params){ | ||
| 815 | - $folder_id=$params['folder_id']; | ||
| 816 | - $title=$params['title']; | ||
| 817 | - $filename=$params['filename']; | ||
| 818 | - $documenttype=$params['documenttype']; | ||
| 819 | - $tempfilename=$params['tempfilename']; | ||
| 820 | - $application=$params['application']; | ||
| 821 | - | ||
| 822 | - $this->addDebug('','Entered add_document'); | ||
| 823 | - $kt=&$this->KT; | ||
| 824 | - | ||
| 825 | - $upload_manager=new KTUploadManager(); | ||
| 826 | - if (!$upload_manager->is_valid_temporary_file($tempfilename)) { | ||
| 827 | - $this->addError('Temporary File Not Valid'); | ||
| 828 | - $this->setResponse(array('status_code'=>1)); | 713 | + |
| 714 | + function add_document_params($params) { | ||
| 715 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 716 | + $folder_id = $params ['folder_id']; | ||
| 717 | + $title = $params ['title']; | ||
| 718 | + $filename = $params ['filename']; | ||
| 719 | + $documenttype = $params ['documenttype']; | ||
| 720 | + $tempfilename = $params ['tempfilename']; | ||
| 721 | + $application = $params ['application']; | ||
| 722 | + | ||
| 723 | + $this->addDebug ( '', 'Entered add_document' ); | ||
| 724 | + $kt = &$this->KT; | ||
| 725 | + | ||
| 726 | + $upload_manager = new KTUploadManager ( ); | ||
| 727 | + if (! $upload_manager->is_valid_temporary_file ( $tempfilename )) { | ||
| 728 | + $this->addError ( 'Temporary File Not Valid' ); | ||
| 729 | + $this->setResponse ( array ('status_code' => 1 ) ); | ||
| 829 | return false; | 730 | return false; |
| 830 | - } | ||
| 831 | - $this->addDebug('','Exited is_valid_temporary file'); | ||
| 832 | - | ||
| 833 | - $folder=&$kt->get_folder_by_id($folder_id); | ||
| 834 | - if (PEAR::isError($folder)){ | ||
| 835 | - $this->addError('Could not find Folder '.$folder_id); | ||
| 836 | - $this->setResponse(array('status_code'=>1)); | ||
| 837 | - return false; | ||
| 838 | } | 731 | } |
| 839 | - | ||
| 840 | - $this->addDebug('','Exited get_folder_by_id'); | ||
| 841 | - | ||
| 842 | - $document=&$folder->add_document($title, $filename, $documenttype, $tempfilename); | ||
| 843 | - if (PEAR::isError($document)){ | ||
| 844 | - $this->addError("Could add Document [title:{$title},filename:{$filename},documenttype:{$documenttype},tempfilename:{$tempfilename}]"); | ||
| 845 | - $this->setResponse(array('status_code'=>1)); | ||
| 846 | - return false; | 732 | + $this->addDebug ( '', 'Exited is_valid_temporary file' ); |
| 733 | + | ||
| 734 | + $folder = &$kt->get_folder_by_id ( $folder_id ); | ||
| 735 | + if (PEAR::isError ( $folder )) { | ||
| 736 | + $this->addError ( 'Could not find Folder ' . $folder_id ); | ||
| 737 | + $this->setResponse ( array ('status_code' => 1 ) ); | ||
| 738 | + return false; | ||
| 847 | } | 739 | } |
| 848 | - | ||
| 849 | - $this->addDebug('','Exited folder add_document'); | ||
| 850 | - | ||
| 851 | - $detail=$document->get_detail(); | ||
| 852 | - $detail['status_code']=0; | ||
| 853 | - $detail['message']=''; | ||
| 854 | - | ||
| 855 | - $this->setResponse($detail); | ||
| 856 | - } | 740 | + |
| 741 | + $this->addDebug ( '', 'Exited get_folder_by_id' ); | ||
| 742 | + | ||
| 743 | + $document = &$folder->add_document ( $title, $filename, $documenttype, $tempfilename ); | ||
| 744 | + if (PEAR::isError ( $document )) { | ||
| 745 | + $this->addError ( "Could add Document [title:{$title},filename:{$filename},documenttype:{$documenttype},tempfilename:{$tempfilename}]" ); | ||
| 746 | + $this->setResponse ( array ('status_code' => 1 ) ); | ||
| 747 | + return false; | ||
| 748 | + } | ||
| 749 | + | ||
| 750 | + $this->addDebug ( '', 'Exited folder add_document' ); | ||
| 751 | + | ||
| 752 | + $detail = $document->get_detail (); | ||
| 753 | + $detail ['status_code'] = 0; | ||
| 754 | + $detail ['message'] = ''; | ||
| 755 | + | ||
| 756 | + $this->setResponse ( $detail ); | ||
| 757 | + } | ||
| 857 | 758 | ||
| 858 | - function delete_document($params){ | ||
| 859 | - $session_id = $params['session_id']; | ||
| 860 | - $document_id = $params['document_id']; | ||
| 861 | - $reason = $params['reason']; | ||
| 862 | - $application = $params['application']; | 759 | + function delete_document($params) { |
| 760 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 761 | + $session_id = $params ['session_id']; | ||
| 762 | + $document_id = $params ['document_id']; | ||
| 763 | + $reason = $params ['reason']; | ||
| 764 | + $application = $params ['application']; | ||
| 863 | 765 | ||
| 864 | - $kt=&$this->KT; | ||
| 865 | - | ||
| 866 | - $document=&$kt->get_document_by_id($document_id); | ||
| 867 | - if (PEAR::isError($document)){ | ||
| 868 | - $this->addError("Invalid document {$document_id}"); | ||
| 869 | - $this->setResponse(array('status_code'=>1)); | ||
| 870 | - return false; | ||
| 871 | - } | ||
| 872 | - | ||
| 873 | - $result=$document->delete($reason); | ||
| 874 | - if (PEAR::isError($result)) { | ||
| 875 | - $this->addError("Could not delete document {$document_id}"); | ||
| 876 | - $this->setResponse(array('status_code'=>1)); | ||
| 877 | - return false; | ||
| 878 | - } | ||
| 879 | - $this->setResponse(array('status_code'=>0)); | ||
| 880 | - return true; | ||
| 881 | - } | ||
| 882 | - | ||
| 883 | - | ||
| 884 | - | ||
| 885 | - private function update_document_metadata($session_id, $document_id, $metadata, $application, $sysdata=null){ | ||
| 886 | - $this->addDebug('update_document_metadata','entered update_document_metadata'); | ||
| 887 | - $kt=&$this->KT; | ||
| 888 | - $responseType='kt_document_detail'; | ||
| 889 | - | ||
| 890 | - $document=&$kt->get_document_by_id($document_id); | ||
| 891 | - if (PEAR::isError($document)){ | ||
| 892 | - return array('status_code'=>1, 'error'=>'Error getting document'); | ||
| 893 | - } | ||
| 894 | - | ||
| 895 | - $result=$document->update_metadata($metadata); | ||
| 896 | - if (PEAR::isError($result)){ | ||
| 897 | - return array('status_code'=>1, 'error'=>'Error updating metadata'); | ||
| 898 | - } | ||
| 899 | - | ||
| 900 | - $result=$document->update_sysdata($sysdata); | ||
| 901 | - if (PEAR::isError($result)){ | ||
| 902 | - return array('status_code'=>1, 'error'=>'Error update_sysdata'); | 766 | + $kt = &$this->KT; |
| 767 | + | ||
| 768 | + $document = &$kt->get_document_by_id ( $document_id ); | ||
| 769 | + if (PEAR::isError ( $document )) { | ||
| 770 | + $this->addError ( "Invalid document {$document_id}" ); | ||
| 771 | + $this->setResponse ( array ('status_code' => 1 ) ); | ||
| 772 | + return false; | ||
| 903 | } | 773 | } |
| 904 | - | ||
| 905 | - return array('status_code'=>0); | 774 | + |
| 775 | + $result = $document->delete ( $reason ); | ||
| 776 | + if (PEAR::isError ( $result )) { | ||
| 777 | + $this->addError ( "Could not delete document {$document_id}" ); | ||
| 778 | + $this->setResponse ( array ('status_code' => 1 ) ); | ||
| 779 | + return false; | ||
| 780 | + } | ||
| 781 | + $this->setResponse ( array ('status_code' => 0 ) ); | ||
| 782 | + return true; | ||
| 906 | } | 783 | } |
| 907 | - | ||
| 908 | - function get_client_policy($arr){ | ||
| 909 | - $policy_name=$arr['policy_name']; | ||
| 910 | - | ||
| 911 | - $config=KTConfig::getSingleton(); | ||
| 912 | - | ||
| 913 | - $policy=array( | ||
| 914 | - 'name'=>$policy_name, | ||
| 915 | - 'value'=>serviceHelper::bool2str($config->get($policy_name)), | ||
| 916 | - 'type'=>'boolean' | ||
| 917 | - ); | ||
| 918 | - | ||
| 919 | - $response['policy']=$policy; | ||
| 920 | - $response['message']='Knowledgetree client policies retrieval succeeded.'; | ||
| 921 | - $response['status_code']=0; | ||
| 922 | - | ||
| 923 | - $this->setResponse($response); | 784 | + |
| 785 | + private function update_document_metadata($session_id, $document_id, $metadata, $application, $sysdata = null) { | ||
| 786 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 787 | + $this->addDebug ( 'update_document_metadata', 'entered update_document_metadata' ); | ||
| 788 | + $kt = &$this->KT; | ||
| 789 | + $responseType = 'kt_document_detail'; | ||
| 790 | + | ||
| 791 | + $document = &$kt->get_document_by_id ( $document_id ); | ||
| 792 | + if (PEAR::isError ( $document )) { | ||
| 793 | + return array ('status_code' => 1, 'error' => 'Error getting document' ); | ||
| 794 | + } | ||
| 795 | + | ||
| 796 | + $result = $document->update_metadata ( $metadata ); | ||
| 797 | + if (PEAR::isError ( $result )) { | ||
| 798 | + return array ('status_code' => 1, 'error' => 'Error updating metadata' ); | ||
| 799 | + } | ||
| 800 | + | ||
| 801 | + $result = $document->update_sysdata ( $sysdata ); | ||
| 802 | + if (PEAR::isError ( $result )) { | ||
| 803 | + return array ('status_code' => 1, 'error' => 'Error update_sysdata' ); | ||
| 804 | + } | ||
| 805 | + | ||
| 806 | + return array ('status_code' => 0 ); | ||
| 807 | + } | ||
| 808 | + | ||
| 809 | + function get_client_policy($arr) { | ||
| 810 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 811 | + $policy_name = $arr ['policy_name']; | ||
| 812 | + | ||
| 813 | + $config = KTConfig::getSingleton (); | ||
| 814 | + | ||
| 815 | + $policy = array ('name' => $policy_name, 'value' => serviceHelper::bool2str ( $config->get ( $policy_name ) ), 'type' => 'boolean' ); | ||
| 816 | + | ||
| 817 | + $response ['policy'] = $policy; | ||
| 818 | + $response ['message'] = 'Knowledgetree client policies retrieval succeeded.'; | ||
| 819 | + $response ['status_code'] = 0; | ||
| 820 | + | ||
| 821 | + $this->setResponse ( $response ); | ||
| 924 | return true; | 822 | return true; |
| 925 | } | 823 | } |
| 926 | - | ||
| 927 | - | ||
| 928 | - function search($arr){ | ||
| 929 | - $kt=&$this->KT; | ||
| 930 | - | ||
| 931 | - $listing=processSearchExpression("(GeneralText contains \"".$arr['query']."\")"); | ||
| 932 | - | ||
| 933 | - $result=$this->_processListing($listing, 'search', $arr); | ||
| 934 | - | ||
| 935 | - if(!count($result)) { | ||
| 936 | - $result[]=array( | ||
| 937 | - 'text'=>$this->xlate("No results found"), | ||
| 938 | - 'id'=>($listing[$i]['item_type']=='F' ? $listing[$i]['item_type']."_" : "").$listing[$i]['id'], | ||
| 939 | - 'leaf'=>true, | ||
| 940 | - 'relevance'=>0, | ||
| 941 | - 'qtip'=> $this->xlate("Please retry your search") | ||
| 942 | - ); | ||
| 943 | - }else{ | ||
| 944 | - $result=array_slice($result, 0, 200); | 824 | + |
| 825 | + function search($arr) { | ||
| 826 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 827 | + $kt = &$this->KT; | ||
| 828 | + | ||
| 829 | + $listing = processSearchExpression ( "(GeneralText contains \"" . $arr ['query'] . "\")" ); | ||
| 830 | + | ||
| 831 | + $result = $this->_processListing ( $listing, 'search', $arr ); | ||
| 832 | + | ||
| 833 | + if (! count ( $result )) { | ||
| 834 | + $result [] = array ('text' => $this->xlate ( "No results found" ), 'id' => ($listing [$i] ['item_type'] == 'F' ? $listing [$i] ['item_type'] . "_" : "") . $listing [$i] ['id'], 'leaf' => true, 'relevance' => 0, 'qtip' => $this->xlate ( "Please retry your search" ) ); | ||
| 835 | + } else { | ||
| 836 | + $result = array_slice ( $result, 0, 200 ); | ||
| 945 | } | 837 | } |
| 946 | - | 838 | + |
| 947 | //$this->setResponse($result); | 839 | //$this->setResponse($result); |
| 948 | - $this->setResponse(array('totalCount'=>count($listing), 'items'=>$result)); | ||
| 949 | - | 840 | + $this->setResponse ( array ('totalCount' => count ( $listing ), 'items' => $result ) ); |
| 841 | + | ||
| 950 | return true; | 842 | return true; |
| 951 | } | 843 | } |
| 952 | - | ||
| 953 | - | ||
| 954 | - public function update_metadata($arr){ | ||
| 955 | - $metadata=array(); | ||
| 956 | - $meta=$arr['metadata']; | ||
| 957 | - | ||
| 958 | - $this->addDebug('','Entered add_document_with_metadata'); | ||
| 959 | - $this->addDebug('metadata received',$meta); | ||
| 960 | - | ||
| 961 | - $special=array(); | ||
| 962 | -// foreach($apacked as $packed){ | ||
| 963 | -// foreach($packed as $key=>$val) { | ||
| 964 | -// if(substr($val->name,0,2) != '__') { | ||
| 965 | -// if(!is_array($metadata[$val->fieldset])) { | ||
| 966 | -// $metadata[$val->fieldset]['fieldset']=$val->fieldset; | ||
| 967 | -// $metadata[$val->fieldset]['fields']=array(); | ||
| 968 | -// } | ||
| 969 | -// $metadata[$val->fieldset]['fields'][]=array( | ||
| 970 | -// 'name'=>$val->name, | ||
| 971 | -// 'value'=>$val->value | ||
| 972 | -// ); | ||
| 973 | -// }else{ | ||
| 974 | -// $special[$val->name]=$val->value; | ||
| 975 | -// } | ||
| 976 | -// } | ||
| 977 | -// } | 844 | + |
| 845 | + public function update_metadata($arr) { | ||
| 846 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 847 | + $metadata = array (); | ||
| 848 | + $meta = $arr ['metadata']; | ||
| 849 | + | ||
| 850 | + $this->addDebug ( '', 'Entered add_document_with_metadata' ); | ||
| 851 | + $this->addDebug ( 'metadata received', $meta ); | ||
| 852 | + | ||
| 853 | + $special = array (); | ||
| 854 | + // foreach($apacked as $packed){ | ||
| 855 | + // foreach($packed as $key=>$val) { | ||
| 856 | + // if(substr($val->name,0,2) != '__') { | ||
| 857 | + // if(!is_array($metadata[$val->fieldset])) { | ||
| 858 | + // $metadata[$val->fieldset]['fieldset']=$val->fieldset; | ||
| 859 | + // $metadata[$val->fieldset]['fields']=array(); | ||
| 860 | + // } | ||
| 861 | + // $metadata[$val->fieldset]['fields'][]=array( | ||
| 862 | + // 'name'=>$val->name, | ||
| 863 | + // 'value'=>$val->value | ||
| 864 | + // ); | ||
| 865 | + // }else{ | ||
| 866 | + // $special[$val->name]=$val->value; | ||
| 867 | + // } | ||
| 868 | + // } | ||
| 869 | + // } | ||
| 870 | + | ||
| 978 | 871 | ||
| 979 | /** | 872 | /** |
| 980 | 873 | ||
| 981 | Fatal error: Cannot unset string offsets in on line 981 | 874 | Fatal error: Cannot unset string offsets in on line 981 |
| 982 | */ | 875 | */ |
| 876 | + | ||
| 877 | + // foreach($meta as $item){ | ||
| 878 | + // $isSpecial=substr($item['name'],0,2)=='__'; | ||
| 879 | + // if($isSpecial){ | ||
| 880 | + // $special[$item['name']]=$item['value']; | ||
| 881 | + // }else{ | ||
| 882 | + // $fieldSet=$item['fieldset']; | ||
| 883 | + // unset($item['fieldset']); | ||
| 884 | + // $metadata[$fieldSet]['fieldset']=$fieldSet; | ||
| 885 | + // $metadata[$fieldSet]['fields'][]=$item; | ||
| 886 | + // } | ||
| 887 | + // } | ||
| 888 | + | ||
| 983 | 889 | ||
| 984 | -// foreach($meta as $item){ | ||
| 985 | -// $isSpecial=substr($item['name'],0,2)=='__'; | ||
| 986 | -// if($isSpecial){ | ||
| 987 | -// $special[$item['name']]=$item['value']; | ||
| 988 | -// }else{ | ||
| 989 | -// $fieldSet=$item['fieldset']; | ||
| 990 | -// unset($item['fieldset']); | ||
| 991 | -// $metadata[$fieldSet]['fieldset']=$fieldSet; | ||
| 992 | -// $metadata[$fieldSet]['fields'][]=$item; | ||
| 993 | -// } | ||
| 994 | -// } | ||
| 995 | - | ||
| 996 | - $metadata=array(); | ||
| 997 | - $special=array(); | ||
| 998 | - | ||
| 999 | - foreach($meta as $item){ | ||
| 1000 | - if(substr($item['name'],0,2)=='__'){ | ||
| 1001 | - $special[$item['name']]=$item['value']; | ||
| 1002 | - }else{ | ||
| 1003 | - $metadata[$item['fieldset']]['fieldset']=$item['fieldset']; | ||
| 1004 | - $metadata[$item['fieldset']]['fields'][]=array('name'=>$item['name'],'value'=>$item['value']); | 890 | + $metadata = array (); |
| 891 | + $special = array (); | ||
| 892 | + | ||
| 893 | + foreach ( $meta as $item ) { | ||
| 894 | + if (substr ( $item ['name'], 0, 2 ) == '__') { | ||
| 895 | + $special [$item ['name']] = $item ['value']; | ||
| 896 | + } else { | ||
| 897 | + $metadata [$item ['fieldset']] ['fieldset'] = $item ['fieldset']; | ||
| 898 | + $metadata [$item ['fieldset']] ['fields'] [] = array ('name' => $item ['name'], 'value' => $item ['value'] ); | ||
| 1005 | } | 899 | } |
| 1006 | } | 900 | } |
| 1007 | 901 | ||
| 902 | + $this->addDebug ( 'after processing', array ('metadata' => $metadata, 'special' => $special ) ); | ||
| 1008 | 903 | ||
| 904 | + $document_id = $arr ['document_id']; | ||
| 1009 | 905 | ||
| 1010 | - $this->addDebug('after processing',array('metadata'=>$metadata,'special'=>$special)); | 906 | + $update_result = $this->update_document_metadata ( $arr ['session_id'], $document_id, $metadata, $arr ['application'], array () ); |
| 907 | + $this->addDebug ( '', '$this->response= from update_document_metadata' ); | ||
| 1011 | 908 | ||
| 1012 | - $document_id=$arr['document_id']; | ||
| 1013 | - | ||
| 1014 | - $update_result=$this->update_document_metadata($arr['session_id'], $document_id, $metadata, $arr['application'], array()); | ||
| 1015 | - $this->addDebug('','$this->response= from update_document_metadata'); | ||
| 1016 | - | ||
| 1017 | - $status_code=$update_result['status_code']; | ||
| 1018 | - if ($status_code != 0){ | ||
| 1019 | - $this->setResponse($update_result); | 909 | + $status_code = $update_result ['status_code']; |
| 910 | + if ($status_code != 0) { | ||
| 911 | + $this->setResponse ( $update_result ); | ||
| 1020 | } | 912 | } |
| 1021 | - | ||
| 1022 | - $kt=&$this->KT; | ||
| 1023 | - | ||
| 1024 | - if(!empty($special)) { | ||
| 1025 | - if($document_id > 0) { | ||
| 1026 | - $document=$kt->get_document_by_id($document_id); | ||
| 1027 | - | ||
| 1028 | - if(isset($special['__title'])) { | ||
| 1029 | - $this->addDebug("Renaming to {$special['__title']}"); | ||
| 1030 | - $res=$document->rename($special['__title']); | ||
| 1031 | - } | ||
| 1032 | - } | ||
| 1033 | - } | ||
| 1034 | - | ||
| 1035 | - $this->setResponse(array('status_code'=>0, 'document_id'=>$document_id)); | ||
| 1036 | - } | ||
| 1037 | - | ||
| 1038 | - | ||
| 1039 | - | ||
| 1040 | - function check_document_title($arr){ | ||
| 1041 | - $kt=&$this->KT; | ||
| 1042 | - | ||
| 1043 | - $folder=$kt->get_folder_by_id($arr['folder_id']); | ||
| 1044 | - if(PEAR::isError($folder)) { | ||
| 1045 | - $this->setResponse(array('status_code'=>1, 'reason'=>'No such folder')); | ||
| 1046 | - return false; | ||
| 1047 | - } | ||
| 1048 | - | ||
| 1049 | - $doc=$folder->get_document_by_name($arr['title']); | ||
| 1050 | - if(PEAR::isError($doc)) { | ||
| 1051 | - $this->setResponse(array('status_code'=>1, 'reason'=>'No document with that title '.$arr['title'])); | ||
| 1052 | - return false; | ||
| 1053 | - } | ||
| 1054 | - | ||
| 1055 | - $this->setResponse(array('status_code'=>0)); | ||
| 1056 | - return true; | 913 | + |
| 914 | + $kt = &$this->KT; | ||
| 915 | + | ||
| 916 | + if (! empty ( $special )) { | ||
| 917 | + if ($document_id > 0) { | ||
| 918 | + $document = $kt->get_document_by_id ( $document_id ); | ||
| 919 | + | ||
| 920 | + if (isset ( $special ['__title'] )) { | ||
| 921 | + $this->addDebug ( "Renaming to {$special['__title']}" ); | ||
| 922 | + $res = $document->rename ( $special ['__title'] ); | ||
| 923 | + } | ||
| 924 | + } | ||
| 925 | + } | ||
| 926 | + | ||
| 927 | + $this->setResponse ( array ('status_code' => 0, 'document_id' => $document_id ) ); | ||
| 1057 | } | 928 | } |
| 1058 | - | ||
| 1059 | - | ||
| 1060 | - function cancel_checkout($params){ | ||
| 1061 | - $kt=&$this->KT; | ||
| 1062 | - | ||
| 1063 | - $document=&$kt->get_document_by_id($params['document_id']); | ||
| 1064 | - if (PEAR::isError($document)){ | ||
| 1065 | - $this->setResponse(array('status_code'=>1, 'message'=>$document->getMessage())); | ||
| 1066 | - return false; | ||
| 1067 | - } | ||
| 1068 | - | ||
| 1069 | - $result=$document->undo_checkout($params['reason']); | ||
| 1070 | - if (PEAR::isError($result)){ | ||
| 1071 | - $this->setResponse(array('status_code'=>1, 'message'=>$result->getMessage())); | 929 | + |
| 930 | + function check_document_title($arr) { | ||
| 931 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 932 | + $kt = &$this->KT; | ||
| 933 | + | ||
| 934 | + $folder = $kt->get_folder_by_id ( $arr ['folder_id'] ); | ||
| 935 | + if (PEAR::isError ( $folder )) { | ||
| 936 | + $this->setResponse ( array ('status_code' => 1, 'reason' => 'No such folder' ) ); | ||
| 1072 | return false; | 937 | return false; |
| 1073 | - } | ||
| 1074 | - $response['status_code']=0; | ||
| 1075 | - $this->setResponse($response); | ||
| 1076 | - } | ||
| 1077 | - | ||
| 1078 | - function get_transaction_history($params){ | ||
| 1079 | - $kt=&$this->KT; | ||
| 1080 | - | ||
| 1081 | - $document=&$kt->get_document_by_id($params['document_id']); | ||
| 1082 | - if (PEAR::isError($document)){ | ||
| 1083 | - $this->setResponse(array('status_code'=>1, 'message'=>$document->getMessage())); | ||
| 1084 | - return false; | ||
| 1085 | - } | ||
| 1086 | - | ||
| 1087 | - $versions=$document->get_version_history(); | ||
| 1088 | - $transactions=$document->get_transaction_history(); | ||
| 1089 | - $response['status_code']=0; | ||
| 1090 | - $response['transactions'] = $transactions; | ||
| 1091 | - $response['versions'] = $versions; | ||
| 1092 | - $this->setResponse($response); | ||
| 1093 | - } | 938 | + } |
| 939 | + | ||
| 940 | + $doc = $folder->get_document_by_name ( $arr ['title'] ); | ||
| 941 | + if (PEAR::isError ( $doc )) { | ||
| 942 | + $this->setResponse ( array ('status_code' => 1, 'reason' => 'No document with that title ' . $arr ['title'] ) ); | ||
| 943 | + return false; | ||
| 944 | + } | ||
| 945 | + | ||
| 946 | + $this->setResponse ( array ('status_code' => 0 ) ); | ||
| 947 | + return true; | ||
| 948 | + } | ||
| 1094 | 949 | ||
| 950 | + function cancel_checkout($params) { | ||
| 951 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 952 | + $kt = &$this->KT; | ||
| 953 | + | ||
| 954 | + $document = &$kt->get_document_by_id ( $params ['document_id'] ); | ||
| 955 | + if (PEAR::isError ( $document )) { | ||
| 956 | + $this->setResponse ( array ('status_code' => 1, 'message' => $document->getMessage () ) ); | ||
| 957 | + return false; | ||
| 958 | + } | ||
| 959 | + | ||
| 960 | + $result = $document->undo_checkout ( $params ['reason'] ); | ||
| 961 | + if (PEAR::isError ( $result )) { | ||
| 962 | + $this->setResponse ( array ('status_code' => 1, 'message' => $result->getMessage () ) ); | ||
| 963 | + return false; | ||
| 964 | + } | ||
| 965 | + $response ['status_code'] = 0; | ||
| 966 | + $this->setResponse ( $response ); | ||
| 967 | + } | ||
| 1095 | 968 | ||
| 1096 | - | ||
| 1097 | - public function get_users_groups($params){ | ||
| 1098 | - $kt=&$this->KT; | ||
| 1099 | - $query=$params['query']; | 969 | + function get_transaction_history($params) { |
| 970 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 971 | + $kt = &$this->KT; | ||
| 972 | + | ||
| 973 | + $document = &$kt->get_document_by_id ( $params ['document_id'] ); | ||
| 974 | + if (PEAR::isError ( $document )) { | ||
| 975 | + $this->setResponse ( array ('status_code' => 1, 'message' => $document->getMessage () ) ); | ||
| 976 | + return false; | ||
| 977 | + } | ||
| 978 | + | ||
| 979 | + $versions = $document->get_version_history (); | ||
| 980 | + $transactions = $document->get_transaction_history (); | ||
| 981 | + $response ['status_code'] = 0; | ||
| 982 | + $response ['transactions'] = $transactions; | ||
| 983 | + $response ['versions'] = $versions; | ||
| 984 | + $this->setResponse ( $response ); | ||
| 985 | + } | ||
| 986 | + | ||
| 987 | + public function get_users_groups($params) { | ||
| 988 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 989 | + $kt = &$this->KT; | ||
| 990 | + $query = $params ['query']; | ||
| 1100 | //$start=$params['start']; | 991 | //$start=$params['start']; |
| 1101 | //$page=$params['page']; | 992 | //$page=$params['page']; |
| 993 | + | ||
| 1102 | 994 | ||
| 1103 | - $results=KTAPI_User::getList('name LIKE "%'.$query.'%" AND id>0'); | ||
| 1104 | - $returnArray=array(); | ||
| 1105 | - if (count($results) > 0){ | ||
| 1106 | - foreach ($results as $user){ | ||
| 1107 | - $returnArray[]=array('emailid'=>'u_'.$user->getId(), 'name'=> $user->getName(), 'to'=>preg_replace('/('.$query.')/i', '<b>${0}</b>', $user->getName())); | 995 | + $results = KTAPI_User::getList ( 'name LIKE "%' . $query . '%" AND id>0' ); |
| 996 | + $returnArray = array (); | ||
| 997 | + if (count ( $results ) > 0) { | ||
| 998 | + foreach ( $results as $user ) { | ||
| 999 | + $returnArray [] = array ('emailid' => 'u_' . $user->getId (), 'name' => $user->getName (), 'to' => preg_replace ( '/(' . $query . ')/i', '<b>${0}</b>', $user->getName () ) ); | ||
| 1108 | } | 1000 | } |
| 1109 | } | 1001 | } |
| 1110 | 1002 | ||
| 1111 | - $groups=KTAPI_Group::getList('name LIKE "%'.$query.'%"'); | ||
| 1112 | - if (count($groups) > 0){ | ||
| 1113 | - foreach ($groups as $group){ | ||
| 1114 | - $returnArray[]=array('emailid'=>'g_'.$group->getId(), 'name'=> $group->getName(), 'to'=>preg_replace('/('.$query.')/i', '<b>${0}</b>', $group->getName())); | 1003 | + $groups = KTAPI_Group::getList ( 'name LIKE "%' . $query . '%"' ); |
| 1004 | + if (count ( $groups ) > 0) { | ||
| 1005 | + foreach ( $groups as $group ) { | ||
| 1006 | + $returnArray [] = array ('emailid' => 'g_' . $group->getId (), 'name' => $group->getName (), 'to' => preg_replace ( '/(' . $query . ')/i', '<b>${0}</b>', $group->getName () ) ); | ||
| 1115 | } | 1007 | } |
| 1116 | } | 1008 | } |
| 1117 | 1009 | ||
| 1118 | - $sendArray=array ('emails'=>$returnArray, 'metaData'=>array('count'=>count($finalArray), 'root'=>'emails', fields=>array('name', 'to', 'emailid'))); | ||
| 1119 | - $this->setResponse($sendArray); | 1010 | + $sendArray = array ('emails' => $returnArray, 'metaData' => array ('count' => count ( $finalArray ), 'root' => 'emails', fields => array ('name', 'to', 'emailid' ) ) ); |
| 1011 | + $this->setResponse ( $sendArray ); | ||
| 1120 | return true; | 1012 | return true; |
| 1121 | } | 1013 | } |
| 1122 | - | ||
| 1123 | 1014 | ||
| 1124 | - function send_email($params){ | ||
| 1125 | - $kt=&$this->KT; | 1015 | + function send_email($params) { |
| 1016 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 1017 | + $kt = &$this->KT; | ||
| 1126 | 1018 | ||
| 1127 | - $message=$params['message']; | ||
| 1128 | - $list=$params['users']; | ||
| 1129 | - $list=explode(',', $list); | 1019 | + $message = $params ['message']; |
| 1020 | + $list = $params ['users']; | ||
| 1021 | + $list = explode ( ',', $list ); | ||
| 1130 | 1022 | ||
| 1131 | - $recipientsList=array(); | 1023 | + $recipientsList = array (); |
| 1132 | 1024 | ||
| 1133 | - foreach ($list as $recipient){ | ||
| 1134 | - if (trim($recipient) != ''){ // check that value is present | 1025 | + foreach ( $list as $recipient ) { |
| 1026 | + if (trim ( $recipient ) != '') { // check that value is present | ||
| 1135 | // if @ sign is present, signifies email address | 1027 | // if @ sign is present, signifies email address |
| 1136 | - if(strpos($recipient, '@') === false) { | ||
| 1137 | - $recipient=trim($recipient); | ||
| 1138 | - switch (substr($recipient, 0, 2)){ | ||
| 1139 | - case 'u_': | ||
| 1140 | - $id=substr($recipient, 2); | ||
| 1141 | - $user=KTAPI_User::getById($id); | ||
| 1142 | - if ($user != null){ | ||
| 1143 | - $recipientsList[]=$user; | 1028 | + if (strpos ( $recipient, '@' ) === false) { |
| 1029 | + $recipient = trim ( $recipient ); | ||
| 1030 | + switch (substr ( $recipient, 0, 2 )) { | ||
| 1031 | + case 'u_' : | ||
| 1032 | + $id = substr ( $recipient, 2 ); | ||
| 1033 | + $user = KTAPI_User::getById ( $id ); | ||
| 1034 | + if ($user != null) { | ||
| 1035 | + $recipientsList [] = $user; | ||
| 1144 | } | 1036 | } |
| 1145 | break; | 1037 | break; |
| 1146 | - case 'g_': | ||
| 1147 | - $id=substr($recipient, 2); | ||
| 1148 | - $group=KTAPI_Group::getById($id); | 1038 | + case 'g_' : |
| 1039 | + $id = substr ( $recipient, 2 ); | ||
| 1040 | + $group = KTAPI_Group::getById ( $id ); | ||
| 1149 | if ($group != null) { | 1041 | if ($group != null) { |
| 1150 | - $recipientsList[]=$group; | 1042 | + $recipientsList [] = $group; |
| 1151 | } | 1043 | } |
| 1152 | break; | 1044 | break; |
| 1153 | } | 1045 | } |
| 1154 | - }else{ // Email - just add to list | ||
| 1155 | - $recipientsList[]=trim($recipient); | 1046 | + } else { // Email - just add to list |
| 1047 | + $recipientsList [] = trim ( $recipient ); | ||
| 1156 | } | 1048 | } |
| 1157 | } | 1049 | } |
| 1158 | } | 1050 | } |
| 1159 | 1051 | ||
| 1160 | - $document=$kt->get_document_by_id($params['document']); | ||
| 1161 | - if (count($recipientsList)==0) { | ||
| 1162 | - $this->setResponse(array('status'=>'norecipients')); | 1052 | + $document = $kt->get_document_by_id ( $params ['document'] ); |
| 1053 | + if (count ( $recipientsList ) == 0) { | ||
| 1054 | + $this->setResponse ( array ('status' => 'norecipients' ) ); | ||
| 1163 | return false; | 1055 | return false; |
| 1164 | - }else{ | ||
| 1165 | - $result = $document->email($recipientsList, $message, TRUE); // true to attach document | ||
| 1166 | - if (PEAR::isError($result)) { | ||
| 1167 | - $this->setResponse(array('status'=>$result->getMessage()));; | ||
| 1168 | - return false; | ||
| 1169 | - } | ||
| 1170 | - $this->setResponse(array('status'=>'documentemailed')); | 1056 | + } else { |
| 1057 | + $result = $document->email ( $recipientsList, $message, TRUE ); // true to attach document | ||
| 1058 | + if (PEAR::isError ( $result )) { | ||
| 1059 | + $this->setResponse ( array ('status' => $result->getMessage () ) ); | ||
| 1060 | + ; | ||
| 1061 | + return false; | ||
| 1062 | + } | ||
| 1063 | + $this->setResponse ( array ('status' => 'documentemailed' ) ); | ||
| 1171 | } | 1064 | } |
| 1172 | return true; | 1065 | return true; |
| 1173 | } | 1066 | } |
| 1174 | - | ||
| 1175 | - | ||
| 1176 | - function is_latest_version($params){ | ||
| 1177 | - $kt=&$this->KT; | 1067 | + |
| 1068 | + function is_latest_version($params) { | ||
| 1069 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 1070 | + $kt = &$this->KT; | ||
| 1178 | 1071 | ||
| 1179 | - $documentId=$params['document_id']; | ||
| 1180 | - $contentId=$params['content_id']; | 1072 | + $documentId = $params ['document_id']; |
| 1073 | + $contentId = $params ['content_id']; | ||
| 1181 | 1074 | ||
| 1182 | - $result=$kt->is_latest_version($documentId, $contentId); | 1075 | + $result = $kt->is_latest_version ( $documentId, $contentId ); |
| 1183 | 1076 | ||
| 1184 | - $this->setResponse($result); | 1077 | + $this->setResponse ( $result ); |
| 1185 | return true; | 1078 | return true; |
| 1186 | } | 1079 | } |
| 1187 | 1080 | ||
| 1188 | - function check_permission($params){ | ||
| 1189 | - $kt=&$this->KT; | ||
| 1190 | - | ||
| 1191 | - $user=$kt->get_user(); | ||
| 1192 | - $document=$kt->get_document_by_id($params['document_id']); | ||
| 1193 | - $folder=&$kt->get_folder_by_id($document->ktapi_folder->folderid); | ||
| 1194 | - $folderDetail=$folder->get_detail(); | ||
| 1195 | - $permissions=$folderDetail['permissions']; | ||
| 1196 | - if ($user->getId()==$document->document->getCheckedOutUserID()){ | 1081 | + function check_permission($params) { |
| 1082 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 1083 | + $kt = &$this->KT; | ||
| 1084 | + | ||
| 1085 | + $user = $kt->get_user (); | ||
| 1086 | + $document = $kt->get_document_by_id ( $params ['document_id'] ); | ||
| 1087 | + $folder = &$kt->get_folder_by_id ( $document->ktapi_folder->folderid ); | ||
| 1088 | + $folderDetail = $folder->get_detail (); | ||
| 1089 | + $permissions = $folderDetail ['permissions']; | ||
| 1090 | + if ($user->getId () == $document->document->getCheckedOutUserID ()) { | ||
| 1197 | $permissions .= 'E'; | 1091 | $permissions .= 'E'; |
| 1198 | } | 1092 | } |
| 1199 | 1093 | ||
| 1200 | - $this->setResponse(array('status_code'=>0, 'permissions'=>$permissions)); | 1094 | + $this->setResponse ( array ('status_code' => 0, 'permissions' => $permissions ) ); |
| 1201 | return true; | 1095 | return true; |
| 1202 | } | 1096 | } |
| 1203 | - | ||
| 1204 | - function copydocument($params){ | ||
| 1205 | - $kt=&$this->KT; | ||
| 1206 | - | ||
| 1207 | - $response=$kt->copy_document($params['documentid'], $params['destfolderid'], $params['reason']); | ||
| 1208 | - if ($response['status_code']==0) { | ||
| 1209 | - $this->setResponse(array('status_code'=>0, 'status'=>'itemupdated', 'icon'=>'success', 'title'=>$this->xlate('Document Copied'), 'message'=>$this->xlate('Document has been successfully copied'))); | ||
| 1210 | - return true; | ||
| 1211 | - }else{ | ||
| 1212 | - $this->setResponse(array('status_code'=>1, 'status'=>'error', 'icon'=>'failure', 'title'=>$this->xlate('Unable to copy document'), 'message'=>$this->xlate('Unable to copy document'))); | ||
| 1213 | - return false; | ||
| 1214 | - } | ||
| 1215 | - } | ||
| 1216 | - | ||
| 1217 | - function movedocument($params){ | ||
| 1218 | - $kt=$this->KT; | ||
| 1219 | - | ||
| 1220 | - $response=$kt->move_document($params['documentid'], $params['destfolderid'], $params['reason']); | ||
| 1221 | - if ($response['status_code']==0) { | ||
| 1222 | - $this->setResponse(array('status_code'=>0, 'status'=>'itemupdated', 'icon'=>'success', 'title'=>$this->xlate('Document Moved'), 'message'=>$this->xlate('Document has been successfully moved'))); | ||
| 1223 | - return true; | ||
| 1224 | - }else{ | ||
| 1225 | - $this->setResponse(array('status_code'=>1, 'status'=>'error', 'icon'=>'failure', 'title'=>$this->xlate('Unable to move document'), 'message'=>$this->xlate('Unable to move document'))); | ||
| 1226 | - return false; | ||
| 1227 | - } | ||
| 1228 | - | ||
| 1229 | - } | ||
| 1230 | - | ||
| 1231 | - function copyfolder($params){ | ||
| 1232 | - $kt=&$this->KT; | ||
| 1233 | - | ||
| 1234 | - $response=$kt->copy_folder($params['sourcefolderid'], $params['destfolderid'], $params['reason']); | ||
| 1235 | - if ($response['status_code']==0) { | ||
| 1236 | - $this->setResponse(array('status_code'=>0, 'status'=>'itemupdated', 'icon'=>'success', 'title'=>$this->xlate('Folder Copied'), 'message'=>$this->xlate('Folder has been successfully copied'))); | ||
| 1237 | - return true; | ||
| 1238 | - }else{ | ||
| 1239 | - $this->setResponse(array('status_code'=>1, 'status'=>'error', 'icon'=>'failure', 'title'=>$this->xlate('Unable to copy folder'), 'message'=>$this->xlate('Unable to copy folder'))); | ||
| 1240 | - return false; | ||
| 1241 | - } | ||
| 1242 | - | ||
| 1243 | - } | ||
| 1244 | - | ||
| 1245 | - function movefolder($params){ | ||
| 1246 | - $kt=&$this->KT; | ||
| 1247 | - | ||
| 1248 | - $response=$kt->move_folder($params['sourcefolderid'], $params['destfolderid'], $params['reason']); | ||
| 1249 | - if ($response['status_code']==0) { | ||
| 1250 | - $this->setResponse(array('status_code'=>0, 'status'=>'itemupdated', 'icon'=>'success', 'title'=>$this->xlate('Folder Moved'), 'message'=>$this->xlate('Folder has been successfully moved'))); | ||
| 1251 | - return true; | ||
| 1252 | - }else{ | ||
| 1253 | - $this->setResponse(array('status_code'=>1, 'status'=>'error', 'icon'=>'failure', 'title'=>$this->xlate('Unable to move folder'), 'message'=>$this->xlate('Unable to move folder'))); | ||
| 1254 | - return false; | ||
| 1255 | - } | ||
| 1256 | - } | ||
| 1257 | - | ||
| 1258 | - | ||
| 1259 | - function renamefolder($params){ | ||
| 1260 | - $kt=&$this->KT; | ||
| 1261 | - | ||
| 1262 | - $response=$kt->rename_folder($params['currentfolderid'], $params['newname']); | ||
| 1263 | - if ($response['status_code']==0) { | ||
| 1264 | - $this->setResponse(array('status_code'=>0, 'status'=>'folderupdated', 'icon'=>'success', 'title'=>$this->xlate('Folder Renamed'), 'message'=>$this->xlate('Folder has been successfully renamed'))); | ||
| 1265 | - return true; | ||
| 1266 | - }else{ | ||
| 1267 | - $this->setResponse(array('status_code'=>1, 'status'=>'error', 'icon'=>'failure', 'title'=>$this->xlate('Unable to rename folder'), 'message'=>$this->xlate('Unable to rename folder'))); | ||
| 1268 | - return false; | ||
| 1269 | - } | ||
| 1270 | - } | ||
| 1271 | - | ||
| 1272 | - function addfolder($params) { | ||
| 1273 | - $kt=&$this->KT; | ||
| 1274 | - $this->addDebug('parameters',$params); | ||
| 1275 | - $response=$kt->create_folder($params['currentfolderid'], $params['newname']); | ||
| 1276 | - $this->setResponse($response); | 1097 | + |
| 1098 | + function copydocument($params) { | ||
| 1099 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 1100 | + $kt = &$this->KT; | ||
| 1101 | + | ||
| 1102 | + $response = $kt->copy_document ( $params ['documentid'], $params ['destfolderid'], $params ['reason'] ); | ||
| 1103 | + if ($response ['status_code'] == 0) { | ||
| 1104 | + $this->setResponse ( array ('status_code' => 0, 'status' => 'itemupdated', 'icon' => 'success', 'title' => $this->xlate ( 'Document Copied' ), 'message' => $this->xlate ( 'Document has been successfully copied' ) ) ); | ||
| 1105 | + return true; | ||
| 1106 | + } else { | ||
| 1107 | + $this->setResponse ( array ('status_code' => 1, 'status' => 'error', 'icon' => 'failure', 'title' => $this->xlate ( 'Unable to copy document' ), 'message' => $this->xlate ( 'Unable to copy document' ) ) ); | ||
| 1108 | + return false; | ||
| 1109 | + } | ||
| 1110 | + } | ||
| 1111 | + | ||
| 1112 | + function movedocument($params) { | ||
| 1113 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 1114 | + $kt = $this->KT; | ||
| 1115 | + | ||
| 1116 | + $response = $kt->move_document ( $params ['documentid'], $params ['destfolderid'], $params ['reason'] ); | ||
| 1117 | + if ($response ['status_code'] == 0) { | ||
| 1118 | + $this->setResponse ( array ('status_code' => 0, 'status' => 'itemupdated', 'icon' => 'success', 'title' => $this->xlate ( 'Document Moved' ), 'message' => $this->xlate ( 'Document has been successfully moved' ) ) ); | ||
| 1119 | + return true; | ||
| 1120 | + } else { | ||
| 1121 | + $this->setResponse ( array ('status_code' => 1, 'status' => 'error', 'icon' => 'failure', 'title' => $this->xlate ( 'Unable to move document' ), 'message' => $this->xlate ( 'Unable to move document' ) ) ); | ||
| 1122 | + return false; | ||
| 1123 | + } | ||
| 1124 | + | ||
| 1125 | + } | ||
| 1126 | + | ||
| 1127 | + function copyfolder($params) { | ||
| 1128 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 1129 | + $kt = &$this->KT; | ||
| 1130 | + | ||
| 1131 | + $response = $kt->copy_folder ( $params ['sourcefolderid'], $params ['destfolderid'], $params ['reason'] ); | ||
| 1132 | + if ($response ['status_code'] == 0) { | ||
| 1133 | + $this->setResponse ( array ('status_code' => 0, 'status' => 'itemupdated', 'icon' => 'success', 'title' => $this->xlate ( 'Folder Copied' ), 'message' => $this->xlate ( 'Folder has been successfully copied' ) ) ); | ||
| 1134 | + return true; | ||
| 1135 | + } else { | ||
| 1136 | + $this->setResponse ( array ('status_code' => 1, 'status' => 'error', 'icon' => 'failure', 'title' => $this->xlate ( 'Unable to copy folder' ), 'message' => $this->xlate ( 'Unable to copy folder' ) ) ); | ||
| 1137 | + return false; | ||
| 1138 | + } | ||
| 1139 | + | ||
| 1140 | + } | ||
| 1141 | + | ||
| 1142 | + function movefolder($params) { | ||
| 1143 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 1144 | + $kt = &$this->KT; | ||
| 1145 | + | ||
| 1146 | + $response = $kt->move_folder ( $params ['sourcefolderid'], $params ['destfolderid'], $params ['reason'] ); | ||
| 1147 | + if ($response ['status_code'] == 0) { | ||
| 1148 | + $this->setResponse ( array ('status_code' => 0, 'status' => 'itemupdated', 'icon' => 'success', 'title' => $this->xlate ( 'Folder Moved' ), 'message' => $this->xlate ( 'Folder has been successfully moved' ) ) ); | ||
| 1149 | + return true; | ||
| 1150 | + } else { | ||
| 1151 | + $this->setResponse ( array ('status_code' => 1, 'status' => 'error', 'icon' => 'failure', 'title' => $this->xlate ( 'Unable to move folder' ), 'message' => $this->xlate ( 'Unable to move folder' ) ) ); | ||
| 1152 | + return false; | ||
| 1153 | + } | ||
| 1154 | + } | ||
| 1155 | + | ||
| 1156 | + function renamefolder($params) { | ||
| 1157 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 1158 | + $kt = &$this->KT; | ||
| 1159 | + | ||
| 1160 | + $response = $kt->rename_folder ( $params ['currentfolderid'], $params ['newname'] ); | ||
| 1161 | + if ($response ['status_code'] == 0) { | ||
| 1162 | + $this->setResponse ( array ('status_code' => 0, 'status' => 'folderupdated', 'icon' => 'success', 'title' => $this->xlate ( 'Folder Renamed' ), 'message' => $this->xlate ( 'Folder has been successfully renamed' ) ) ); | ||
| 1163 | + return true; | ||
| 1164 | + } else { | ||
| 1165 | + $this->setResponse ( array ('status_code' => 1, 'status' => 'error', 'icon' => 'failure', 'title' => $this->xlate ( 'Unable to rename folder' ), 'message' => $this->xlate ( 'Unable to rename folder' ) ) ); | ||
| 1166 | + return false; | ||
| 1167 | + } | ||
| 1168 | + } | ||
| 1169 | + | ||
| 1170 | + function addfolder($params) { | ||
| 1171 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 1172 | + $kt = &$this->KT; | ||
| 1173 | + $this->addDebug ( 'parameters', $params ); | ||
| 1174 | + $response = $kt->create_folder ( $params ['currentfolderid'], $params ['newname'] ); | ||
| 1175 | + $this->setResponse ( $response ); | ||
| 1277 | return true; | 1176 | return true; |
| 1278 | - } | ||
| 1279 | - | ||
| 1280 | - function deletefolder($params){ | ||
| 1281 | - $kt=&$this->KT; | ||
| 1282 | - | ||
| 1283 | - $response=$kt->delete_folder($params['folderid'], $params['reason']); | ||
| 1284 | - if ($response['status_code']==0) { | ||
| 1285 | - $this->setResponse(array('status_code'=>0, 'status'=>'folderdeleted', 'icon'=>'success', 'title'=>$this->xlate('Folder Deleted'), 'message'=>$this->xlate('Folder has been successfully deleted'))); | ||
| 1286 | - return true; | ||
| 1287 | - }else{ | ||
| 1288 | - $this->setResponse(array('status_code'=>1, 'status'=>'error', 'icon'=>'failure', 'title'=>$this->xlate('Unable to delete folder'), 'message'=>$this->xlate('Unable to delete folder'))); | ||
| 1289 | - return false; | ||
| 1290 | - } | ||
| 1291 | - } | ||
| 1292 | - | ||
| 1293 | - function candeletefolder($arr){ | ||
| 1294 | - $kt=&$this->KT; | ||
| 1295 | - | ||
| 1296 | - $folder=&$kt->get_folder_by_id($arr['folderid']); | ||
| 1297 | - if (PEAR::isError($folder)){ | ||
| 1298 | - $this->setResponse('error 1'); | ||
| 1299 | - return false; | ||
| 1300 | - } | ||
| 1301 | - | ||
| 1302 | - $listing=$folder->get_listing(1, 'DF'); | ||
| 1303 | - if (count($listing)==0) { | ||
| 1304 | - $this->setResponse(array('status_code'=>0, 'candelete'=>TRUE)); | ||
| 1305 | - return true; | ||
| 1306 | - }else{ | ||
| 1307 | - $this->setResponse(array('status_code'=>0, 'candelete'=>FALSE)); | ||
| 1308 | - return true; | ||
| 1309 | - } | ||
| 1310 | - } | 1177 | + } |
| 1178 | + | ||
| 1179 | + function deletefolder($params) { | ||
| 1180 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 1181 | + $kt = &$this->KT; | ||
| 1182 | + | ||
| 1183 | + $response = $kt->delete_folder ( $params ['folderid'], $params ['reason'] ); | ||
| 1184 | + if ($response ['status_code'] == 0) { | ||
| 1185 | + $this->setResponse ( array ('status_code' => 0, 'status' => 'folderdeleted', 'icon' => 'success', 'title' => $this->xlate ( 'Folder Deleted' ), 'message' => $this->xlate ( 'Folder has been successfully deleted' ) ) ); | ||
| 1186 | + return true; | ||
| 1187 | + } else { | ||
| 1188 | + $this->setResponse ( array ('status_code' => 1, 'status' => 'error', 'icon' => 'failure', 'title' => $this->xlate ( 'Unable to delete folder' ), 'message' => $this->xlate ( 'Unable to delete folder' ) ) ); | ||
| 1189 | + return false; | ||
| 1190 | + } | ||
| 1191 | + } | ||
| 1192 | + | ||
| 1193 | + function candeletefolder($arr) { | ||
| 1194 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 1195 | + $kt = &$this->KT; | ||
| 1196 | + | ||
| 1197 | + $folder = &$kt->get_folder_by_id ( $arr ['folderid'] ); | ||
| 1198 | + if (PEAR::isError ( $folder )) { | ||
| 1199 | + $this->setResponse ( 'error 1' ); | ||
| 1200 | + return false; | ||
| 1201 | + } | ||
| 1202 | + | ||
| 1203 | + $listing = $folder->get_listing ( 1, 'DF' ); | ||
| 1204 | + if (count ( $listing ) == 0) { | ||
| 1205 | + $this->setResponse ( array ('status_code' => 0, 'candelete' => TRUE ) ); | ||
| 1206 | + return true; | ||
| 1207 | + } else { | ||
| 1208 | + $this->setResponse ( array ('status_code' => 0, 'candelete' => FALSE ) ); | ||
| 1209 | + return true; | ||
| 1210 | + } | ||
| 1211 | + } | ||
| 1311 | } | 1212 | } |
| 1312 | ?> | 1213 | ?> |
| 1313 | \ No newline at end of file | 1214 | \ No newline at end of file |
webservice/clienttools/services/0.9/server.php
| 1 | <?php | 1 | <?php |
| 2 | class server extends client_service { | 2 | class server extends client_service { |
| 3 | public function status(){ | 3 | public function status(){ |
| 4 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 4 | $this->setResponse(array('online'=>true)); | 5 | $this->setResponse(array('online'=>true)); |
| 5 | } | 6 | } |
| 6 | 7 | ||
| 7 | public function ping(){ | 8 | public function ping(){ |
| 9 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 8 | $this->addResponse('pong',time()); | 10 | $this->addResponse('pong',time()); |
| 9 | } | 11 | } |
| 10 | 12 | ||
| 11 | public function getToken(){ | 13 | public function getToken(){ |
| 14 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 12 | 15 | ||
| 13 | } | 16 | } |
| 14 | 17 | ||
| 15 | public function phpInfo(){ | 18 | public function phpInfo(){ |
| 19 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 16 | ob_start(); | 20 | ob_start(); |
| 17 | phpinfo(); | 21 | phpinfo(); |
| 18 | $this->addResponse('phpinfo',ob_get_clean()); | 22 | $this->addResponse('phpinfo',ob_get_clean()); |
webservice/clienttools/standardservices/system.php
| 1 | <?php | 1 | <?php |
| 2 | class system extends client_service{ | 2 | class system extends client_service{ |
| 3 | public function checkVersion(){ | 3 | public function checkVersion(){ |
| 4 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 4 | global $default; | 5 | global $default; |
| 5 | $user=$this->KT->get_user_object_by_username($this->AuthInfo['user']); | 6 | $user=$this->KT->get_user_object_by_username($this->AuthInfo['user']); |
| 6 | $versions=$this->handler->getServerVersions(); | 7 | $versions=$this->handler->getServerVersions(); |
| @@ -19,11 +20,14 @@ class system extends client_service{ | @@ -19,11 +20,14 @@ class system extends client_service{ | ||
| 19 | 20 | ||
| 20 | ); | 21 | ); |
| 21 | $this->setResponse($ret); | 22 | $this->setResponse($ret); |
| 23 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Exit Function'); | ||
| 22 | return true; | 24 | return true; |
| 23 | } | 25 | } |
| 24 | 26 | ||
| 25 | public function jsondecode($params){ | 27 | public function jsondecode($params){ |
| 28 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Enter Function'); | ||
| 26 | $this->setResponse(@json_decode(trim($params['code']))); | 29 | $this->setResponse(@json_decode(trim($params['code']))); |
| 30 | + $this->logTrace((__METHOD__.'('.__FILE__.' '.__LINE__.')'),'Exit Function'); | ||
| 27 | } | 31 | } |
| 28 | } | 32 | } |
| 29 | 33 |