Commit 6fb73b0998c30f6370d95698c481b032b7dd8069
1 parent
590534d1
Merged in from DEV trunk...
KTS-2917 "If the fieldset names are too long there is no way to get to the edit button on the main Fieldset page" Fixed. Fieldset name is now truncated to a better size. Committed By: Jonathan Byrne Reviewed By: Jalaloedien Abrahams KTS-2717 "Changing folder permissions to allow for a new user group to perform the delete action does not work" Fixed. On overriding permissions for the folder the copy permissions action wasn't taking existing documents in the folder into account. Committed by: Megan Watson Reviewed by: Conrad Vermeulen KTS-2432 "Dynamic Condition Doesnt Work in 3.4.3" Fixed. On adding / editing a document it now checks if dynamic conditions exist and updates the permission object. Committed by: Megan Watson Reviewed by: Conrad Vermeulen KTC-227 "Widget broken" Fixed. Html tags are now interpreted properly on the conditional metadata admin page. Committed By: Jonathan Byrne Reviewed By: Jalaloedien Abrahams KTS-3048 "External Dependencies missing after upgrade" In Progess. Updated the upgrade config functions. Committed By: Kevin Fourie Reviewed By: Conrad Vermeulen git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8093 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
8 changed files
with
91 additions
and
46 deletions
config/dmsDefaults.php
| ... | ... | @@ -76,6 +76,16 @@ if (!defined('KT_LIB_DIR')) { |
| 76 | 76 | define('KT_LIB_DIR', KT_DIR . '/lib'); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | +// If not defined, set KT_INSTALL_DIR based on my usual location in the tree | |
| 80 | +if (!defined('KT_INSTALL_DIR')) { | |
| 81 | + $installLoc = realpath(dirname(__FILE__) . '/../..'); | |
| 82 | + if (substr(PHP_OS, 0, 3) == 'WIN') { | |
| 83 | + $installLoc = str_replace('\\','/',$installLoc); | |
| 84 | + } | |
| 85 | + define('KT_INSTALL_DIR', $installLoc); | |
| 86 | +} | |
| 87 | + | |
| 88 | + | |
| 79 | 89 | // PATH_SEPARATOR added in PHP 4.3.0 |
| 80 | 90 | if (!defined('PATH_SEPARATOR')) { |
| 81 | 91 | if (substr(PHP_OS, 0, 3) == 'WIN') { | ... | ... |
lib/documentmanagement/documentutil.inc.php
| ... | ... | @@ -558,12 +558,12 @@ class KTDocumentUtil { |
| 558 | 558 | DBUtil::startTransaction(); |
| 559 | 559 | $oDocument =& KTDocumentUtil::_add($oFolder, $sFilename, $oUser, $aOptions); |
| 560 | 560 | |
| 561 | - // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Document created'))); | |
| 561 | + $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Document created'))); | |
| 562 | 562 | if (PEAR::isError($oDocument)) { |
| 563 | 563 | return $oDocument; |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | - // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Scanning file'))); | |
| 566 | + $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Scanning file'))); | |
| 567 | 567 | $oKTTriggerRegistry = KTTriggerRegistry::getSingleton(); |
| 568 | 568 | $aTriggers = $oKTTriggerRegistry->getTriggers('content', 'scan'); |
| 569 | 569 | $iTrigger = 0; |
| ... | ... | @@ -582,22 +582,8 @@ class KTDocumentUtil { |
| 582 | 582 | // NEW SEARCH |
| 583 | 583 | |
| 584 | 584 | Indexer::index($oDocument); |
| 585 | - /* | |
| 586 | - $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Transforming file'))); | |
| 587 | - $oKTTriggerRegistry = KTTriggerRegistry::getSingleton(); | |
| 588 | - $aTriggers = $oKTTriggerRegistry->getTriggers('content', 'transform'); | |
| 589 | - foreach ($aTriggers as $aTrigger) { | |
| 590 | - $sTrigger = $aTrigger[0]; | |
| 591 | - if ($aTrigger[1]) { | |
| 592 | - require_once($aTrigger[1]); | |
| 593 | - } | |
| 594 | - $oTrigger = new $sTrigger; | |
| 595 | - $oTrigger->setDocument($oDocument); | |
| 596 | - // $oUploadChannel->sendMessage(new KTUploadGenericMessage(sprintf(_kt(" (trigger %s)"), $sTrigger))); | |
| 597 | - $oTrigger->transform(); | |
| 598 | - }*/ | |
| 599 | 585 | |
| 600 | - // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Creating transaction'))); | |
| 586 | + $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Creating transaction'))); | |
| 601 | 587 | $aOptions = array('user' => $oUser); |
| 602 | 588 | //create the document transaction record |
| 603 | 589 | $oDocumentTransaction = new DocumentTransaction($oDocument, _kt('Document created'), 'ktcore.transactions.create', $aOptions); |
| ... | ... | @@ -607,7 +593,7 @@ class KTDocumentUtil { |
| 607 | 593 | return $res; |
| 608 | 594 | } |
| 609 | 595 | |
| 610 | - // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Sending subscriptions'))); | |
| 596 | + $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Sending subscriptions'))); | |
| 611 | 597 | // fire subscription alerts for the checked in document |
| 612 | 598 | $oSubscriptionEvent = new SubscriptionEvent(); |
| 613 | 599 | $oFolder = Folder::get($oDocument->getFolderID()); |
| ... | ... | @@ -630,6 +616,20 @@ class KTDocumentUtil { |
| 630 | 616 | KTDocumentUtil::updateSearchableText($oDocument, true); |
| 631 | 617 | |
| 632 | 618 | DBUtil::commit(); |
| 619 | + | |
| 620 | + $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Checking permissions...'))); | |
| 621 | + | |
| 622 | + // Check if there are any dynamic conditions / permissions that need to be updated on the document | |
| 623 | + // If there are dynamic conditions then update the permissions on the document | |
| 624 | + // The dynamic condition test fails unless the document exists in the DB therefore update permissions after committing the transaction. | |
| 625 | + include_once(KT_LIB_DIR.'/permissions/permissiondynamiccondition.inc.php'); | |
| 626 | + $iPermissionObjectId = $oFolder->getPermissionObjectID(); | |
| 627 | + $dynamicCondition = KTPermissionDynamicCondition::getByPermissionObjectId($iPermissionObjectId); | |
| 628 | + | |
| 629 | + if(!PEAR::isError($dynamicCondition) && !empty($dynamicCondition)){ | |
| 630 | + $res = KTPermissionUtil::updatePermissionLookup($oDocument); | |
| 631 | + } | |
| 632 | + | |
| 633 | 633 | $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('All done...'))); |
| 634 | 634 | |
| 635 | 635 | return $oDocument; | ... | ... |
lib/permissions/permissiondynamiccondition.inc.php
| ... | ... | @@ -5,32 +5,32 @@ |
| 5 | 5 | * KnowledgeTree Open Source Edition |
| 6 | 6 | * Document Management Made Simple |
| 7 | 7 | * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited |
| 8 | - * | |
| 8 | + * | |
| 9 | 9 | * This program is free software; you can redistribute it and/or modify it under |
| 10 | 10 | * the terms of the GNU General Public License version 3 as published by the |
| 11 | 11 | * Free Software Foundation. |
| 12 | - * | |
| 12 | + * | |
| 13 | 13 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 14 | 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 15 | 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 16 | 16 | * details. |
| 17 | - * | |
| 17 | + * | |
| 18 | 18 | * You should have received a copy of the GNU General Public License |
| 19 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, |
| 22 | 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 23 | - * | |
| 23 | + * | |
| 24 | 24 | * The interactive user interfaces in modified source and object code versions |
| 25 | 25 | * of this program must display Appropriate Legal Notices, as required under |
| 26 | 26 | * Section 5 of the GNU General Public License version 3. |
| 27 | - * | |
| 27 | + * | |
| 28 | 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 29 | 29 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 30 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 30 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 31 | 31 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 32 | - * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | - * copyright notice. | |
| 32 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | + * copyright notice. | |
| 34 | 34 | * Contributor( s): ______________________________________ |
| 35 | 35 | * |
| 36 | 36 | */ |
| ... | ... | @@ -89,6 +89,15 @@ class KTPermissionDynamicCondition extends KTEntity { |
| 89 | 89 | )); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | + function &getByPermissionObjectId($iPermissionObjectId) { | |
| 93 | + return KTEntityUtil::getByDict('KTPermissionDynamicCondition', array( | |
| 94 | + 'permission_object_id' => $iPermissionObjectId, | |
| 95 | + ), array( | |
| 96 | + 'multi' => true, | |
| 97 | + )); | |
| 98 | + } | |
| 99 | + | |
| 100 | + | |
| 92 | 101 | function &getByPermissionObjectAndCondition($oPermissionObject, $oCondition) { |
| 93 | 102 | $iPermissionObjectId = KTUtil::getId($oPermissionObject); |
| 94 | 103 | $iConditionId = KTUtil::getId($oCondition); |
| ... | ... | @@ -142,7 +151,7 @@ class KTPermissionDynamicCondition extends KTEntity { |
| 142 | 151 | array($iConditionId), |
| 143 | 152 | ); |
| 144 | 153 | $aIds = DBUtil::getResultArrayKey($aQuery, 'id'); |
| 145 | - | |
| 154 | + | |
| 146 | 155 | |
| 147 | 156 | $sParam = DBUtil::paramArray($aIds); |
| 148 | 157 | ... | ... |
lib/permissions/permissionutil.inc.php
| ... | ... | @@ -431,7 +431,7 @@ class KTPermissionUtil { |
| 431 | 431 | */ |
| 432 | 432 | |
| 433 | 433 | |
| 434 | - if (is_null($oPermLookup)) { | |
| 434 | + //if (is_null($oPermLookup)) { | |
| 435 | 435 | $aMapPermDesc = array(); |
| 436 | 436 | foreach ($aMapPermAllowed as $iPermissionId => $aAllowed) { |
| 437 | 437 | $oLookupPD = KTPermissionUtil::getOrCreateDescriptor($aAllowed); |
| ... | ... | @@ -439,7 +439,7 @@ class KTPermissionUtil { |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | $oPermLookup = KTPermissionLookupAssignment::findOrCreateLookupByPermissionDescriptorMap($aMapPermDesc); |
| 442 | - } | |
| 442 | + //} | |
| 443 | 443 | |
| 444 | 444 | $oFolderOrDocument->setPermissionLookupID($oPermLookup->getID()); |
| 445 | 445 | $oFolderOrDocument->update(); |
| ... | ... | @@ -600,7 +600,8 @@ class KTPermissionUtil { |
| 600 | 600 | |
| 601 | 601 | $sQuery = "UPDATE $default->documents_table SET |
| 602 | 602 | permission_object_id = ? WHERE permission_object_id = ? AND |
| 603 | - parent_folder_ids LIKE ?"; | |
| 603 | + (parent_folder_ids LIKE ? OR folder_id = ?)"; | |
| 604 | + $aParams[] = $iFolderID; | |
| 604 | 605 | DBUtil::runQuery(array($sQuery, $aParams)); |
| 605 | 606 | |
| 606 | 607 | Document::clearAllCaches(); | ... | ... |
lib/upgrades/UpgradeFunctions.inc.php
| ... | ... | @@ -1038,17 +1038,18 @@ class UpgradeFunctions { |
| 1038 | 1038 | $ini->addItem('webservice', 'validateSessionCount', 'false'); |
| 1039 | 1039 | |
| 1040 | 1040 | // externalBinary Section |
| 1041 | + $ini->delSection('externalBinary'); | |
| 1041 | 1042 | if(OS_WINDOWS){ |
| 1042 | - $ini->addItem('externalBinary', 'xls2csv', 'xls2csv', '', 'The following are external binaries that may be used by various parts of knowledgeTree.'); | |
| 1043 | - $ini->addItem('externalBinary', 'pdftotext', 'pdftotext'); | |
| 1044 | - $ini->addItem('externalBinary', 'catppt', 'catppt'); | |
| 1045 | - $ini->addItem('externalBinary', 'pstotext', 'pstotext'); | |
| 1046 | - $ini->addItem('externalBinary', 'catdoc', 'catdoc'); | |
| 1047 | - $ini->addItem('externalBinary', 'antiword', 'antiword.exe'); | |
| 1048 | - $ini->addItem('externalBinary', 'python', 'python.bat'); | |
| 1049 | - $ini->addItem('externalBinary', 'java', 'java.exe'); | |
| 1050 | - $ini->addItem('externalBinary', 'php', 'php.exe'); | |
| 1051 | - $ini->addItem('externalBinary', 'df', 'df.exe'); | |
| 1043 | + $ini->addItem('externalBinary', 'xls2csv', KT_INSTALL_DIR . '/bin/catdoc/xls2csv.exe', '', 'The following are external binaries that may be used by various parts of knowledgeTree.'); | |
| 1044 | + $ini->addItem('externalBinary', 'pdftotext', KT_INSTALL_DIR . '/bin/xpdf/pdftotext.exe'); | |
| 1045 | + $ini->addItem('externalBinary', 'catppt', KT_INSTALL_DIR . '/bin/catdoc/catppt.exe'); | |
| 1046 | + $ini->addItem('externalBinary', 'pstotext', KT_INSTALL_DIR . '/pstotext'); | |
| 1047 | + $ini->addItem('externalBinary', 'catdoc', KT_INSTALL_DIR . '/bin/catdoc/catdoc.exe'); | |
| 1048 | + $ini->addItem('externalBinary', 'antiword', KT_INSTALL_DIR . '/bin/antiword/antiword.exe'); | |
| 1049 | + $ini->addItem('externalBinary', 'python', KT_INSTALL_DIR . '/python.bat'); | |
| 1050 | + $ini->addItem('externalBinary', 'java', KT_INSTALL_DIR . '/java/jre/bin/java.exe'); | |
| 1051 | + $ini->addItem('externalBinary', 'php', KT_INSTALL_DIR . '/php/php.exe'); | |
| 1052 | + $ini->addItem('externalBinary', 'df', KT_INSTALL_DIR . '/bin/gnuwin32/df.exe'); | |
| 1052 | 1053 | |
| 1053 | 1054 | } else { |
| 1054 | 1055 | $ini->addItem('externalBinary', 'xls2csv', 'xls2csv', '', 'The following are external binaries that may be used by various parts of knowledgeTree.'); |
| ... | ... | @@ -1056,7 +1057,7 @@ class UpgradeFunctions { |
| 1056 | 1057 | $ini->addItem('externalBinary', 'catppt', 'catppt'); |
| 1057 | 1058 | $ini->addItem('externalBinary', 'pstotext', 'pstotext'); |
| 1058 | 1059 | $ini->addItem('externalBinary', 'catdoc', 'catdoc'); |
| 1059 | - $ini->addItem('externalBinary', 'antiword', 'antiword.exe'); | |
| 1060 | + $ini->addItem('externalBinary', 'antiword', ''); | |
| 1060 | 1061 | $ini->addItem('externalBinary', 'python', 'python'); |
| 1061 | 1062 | $ini->addItem('externalBinary', 'java', 'java'); |
| 1062 | 1063 | $ini->addItem('externalBinary', 'php', 'php'); | ... | ... |
plugins/ktcore/admin/fieldsets/conditional.inc.php
| ... | ... | @@ -111,12 +111,15 @@ class ConditionalFieldsetManagementDispatcher extends BasicFieldsetManagementDis |
| 111 | 111 | // now prep for the warnings. |
| 112 | 112 | if ($this->oMasterfield) { |
| 113 | 113 | if (!empty($this->aFreeFields)) { |
| 114 | - $this->addErrorMessage(_kt("All fields must be assigned to an order in the conditional system. To correct this, please use the \"manage field ordering\" link below. <strong>This fieldset will display as a normal, non-conditional fieldset until this problem is corrected.</strong>")); | |
| 114 | + $this->addErrorMessage(_kt("Al fields must be assigned to an order in the conditional system. To correct this, please use the \"manage field ordering\" link below. <b>This fieldset will display as a normal, non-conditional fieldset until this problem is corrected.</b>")); | |
| 115 | + $this->oPage->booleanLink = true; | |
| 115 | 116 | } else if ($this->bIncomplete) { |
| 116 | - $this->addErrorMessage(sprintf(_kt("This fieldset is incomplete: %s <strong>This fieldset will display as a normal, non-conditional fieldset until this problem is corrected.</strong>"), $sIncomplete)); | |
| 117 | + $this->addErrorMessage(sprintf(_kt("This fieldset is incomplete: %s <b>This fieldset will display as a normal, non-conditional fieldset until this problem is corrected.</b>"), $sIncomplete)); | |
| 118 | + $this->oPage->booleanLink = true; | |
| 117 | 119 | } |
| 118 | 120 | } else { |
| 119 | - $this->addErrorMessage(_kt("A conditional fieldset must have a master field before it can be used. To correct this, please use the \"manage field ordering\" link below. <strong>This fieldset will display as a normal, non-conditional fieldset until this problem is corrected.</strong>")); | |
| 121 | + $this->addErrorMessage(_kt("A conditional fieldset must have a master field before it can be used. To correct this, please use the \"manage field ordering\" link below. <b>This fieldset will display as a normal, non-conditional fieldset until this problem is corrected.</b>")); | |
| 122 | + $this->oPage->booleanLink = true; | |
| 120 | 123 | } |
| 121 | 124 | |
| 122 | 125 | } | ... | ... |
plugins/ktcore/document/edit.php
| ... | ... | @@ -49,6 +49,7 @@ require_once(KT_LIB_DIR . '/permissions/permissionutil.inc.php'); |
| 49 | 49 | require_once(KT_LIB_DIR . "/widgets/forms.inc.php"); |
| 50 | 50 | require_once(KT_LIB_DIR . "/metadata/fieldsetregistry.inc.php"); |
| 51 | 51 | require_once(KT_LIB_DIR . "/util/sanitize.inc"); |
| 52 | +require_once(KT_LIB_DIR.'/permissions/permissiondynamiccondition.inc.php'); | |
| 52 | 53 | |
| 53 | 54 | // {{{ KTDocumentEditAction |
| 54 | 55 | class KTDocumentEditAction extends KTDocumentAction { |
| ... | ... | @@ -233,6 +234,16 @@ class KTDocumentEditAction extends KTDocumentAction { |
| 233 | 234 | $oDocumentTransaction = & new DocumentTransaction($this->oDocument, _kt('Document metadata updated'), 'ktcore.transactions.update'); |
| 234 | 235 | $oDocumentTransaction->create(); |
| 235 | 236 | |
| 237 | + // Check if there are any dynamic conditions / permissions that need to be updated on the document | |
| 238 | + // If there are dynamic conditions then update the permissions on the document | |
| 239 | + // The dynamic condition test fails unless the changes exists in the DB therefore update permissions after committing the transaction. | |
| 240 | + $iPermissionObjectId = $this->oDocument->getPermissionObjectID(); | |
| 241 | + $dynamicCondition = KTPermissionDynamicCondition::getByPermissionObjectId($iPermissionObjectId); | |
| 242 | + | |
| 243 | + if(!PEAR::isError($dynamicCondition) && !empty($dynamicCondition)){ | |
| 244 | + $res = KTPermissionUtil::updatePermissionLookup($this->oDocument); | |
| 245 | + } | |
| 246 | + | |
| 236 | 247 | redirect(KTBrowseUtil::getUrlForDocument($this->oDocument->getId())); |
| 237 | 248 | exit(0); |
| 238 | 249 | } |
| ... | ... | @@ -369,6 +380,16 @@ class KTDocumentEditAction extends KTDocumentAction { |
| 369 | 380 | $ret = $oTrigger->postValidate(); |
| 370 | 381 | } |
| 371 | 382 | |
| 383 | + // Check if there are any dynamic conditions / permissions that need to be updated on the document | |
| 384 | + // If there are dynamic conditions then update the permissions on the document | |
| 385 | + // The dynamic condition test fails unless the changes exists in the DB therefore update permissions after committing the transaction. | |
| 386 | + $iPermissionObjectId = $this->oDocument->getPermissionObjectID(); | |
| 387 | + $dynamicCondition = KTPermissionDynamicCondition::getByPermissionObjectId($iPermissionObjectId); | |
| 388 | + | |
| 389 | + if(!PEAR::isError($dynamicCondition) && !empty($dynamicCondition)){ | |
| 390 | + $res = KTPermissionUtil::updatePermissionLookup($this->oDocument); | |
| 391 | + } | |
| 392 | + | |
| 372 | 393 | $this->successRedirectToMain(sprintf(_kt("You have selected a new document type: %s. "), $data['type']->getName())); |
| 373 | 394 | } |
| 374 | 395 | } | ... | ... |