diff --git a/docs/FAQ.txt b/docs/FAQ.txt index 306c019..4c1fa32 100644 --- a/docs/FAQ.txt +++ b/docs/FAQ.txt @@ -18,7 +18,7 @@ A: Our community forums are a good place to ask questions about network, will endeavour to answer your questions. Click on the link below to access the forums: - http://forum.ktdms.com/ + http://forums.ktdms.com/ Q: Where can I discuss document management best practices, change management and training issues? @@ -30,7 +30,7 @@ A: Our community forums are a good place to discuss best practices for Click on the link below to access the forums: - http://forum.ktdms.com/ + http://forums.ktdms.com/ Q: Where can I report bugs in KnowledgeTree? @@ -42,7 +42,7 @@ A: You can report bugs in KnowledgeTree by accessing our online Click on the link below to access the ticketing system: - http://support.ktdms.com/ + http://issues.ktdms.com/ Q: I want to modify KnowledgeTree or develop new functionality for it. Where do I find more information on how to go about doing this? @@ -54,13 +54,13 @@ A: You can find out more information about modifying KnowledgeTree, Click on the link below to access the Wiki: - http://support.ktdms.com/confluence/ + http://issues.ktdms.com/confluence/ KnowledgeTree Document Management System Web page: http://www.ktdms.com/ -Wiki: http://support.ktdms.com/confluence/ -Forums: http://forum.ktdms.com/ -Bug reporting: http://support.ktdms.com/ +Wiki: http://issues.ktdms.com/confluence/ +Forums: http://forums.ktdms.com/ +Bug reporting: http://issues.ktdms.com/ $Id$ diff --git a/docs/INSTALL.WIN32.txt b/docs/INSTALL.WIN32.txt index c58f624..a988c4e 100644 --- a/docs/INSTALL.WIN32.txt +++ b/docs/INSTALL.WIN32.txt @@ -125,12 +125,12 @@ For the Windows platform, these are: . InfoZip unzip and zip - http://www.info-zip.org/ Installing these packages is beyond the scope of this document - please -consult the KnowledgeTree Wiki at http://support.ktdms.com/confluence/ +consult the KnowledgeTree Wiki at http://issues.ktdms.com/confluence/ to see how others have approached this on your platform. You can find Windows specific installation instructions here: - http://support.ktdms.com/confluence/display/KTWiki/Windows+XP+installation+instructions + http://issues.ktdms.com/confluence/display/KTWiki/Windows+XP+installation+instructions Troubleshooting @@ -140,12 +140,12 @@ Please make sure that your KnowledgeTree installation passes all the pre- and post-installation checkups first. Refer to the Frequently Asked Questions list on the KnowledgeTree Wiki -at http://support.ktdms.com/confluence/ +at http://issues.ktdms.com/confluence/ -Ask on the KnowledgeTree forums on http://forum.ktdms.com/. +Ask on the KnowledgeTree forums on http://forums.ktdms.com/. If you have found a bug, please report it to the KnowledgeTree bug -reporting system at http://support.ktdms.com/. +reporting system at http://issues.ktdms.com/. Upgrading --------- diff --git a/docs/INSTALL.txt b/docs/INSTALL.txt index 309c19f..4505585 100644 --- a/docs/INSTALL.txt +++ b/docs/INSTALL.txt @@ -14,9 +14,9 @@ KnowledgeTree Installation Notes Due to the many different configuration possibilities, these can not all be discussed here. Please consult the KnowledgeTree Wiki system - at http://support.ktdms.com/confluence/ to see what others have done + at http://issues.ktdms.com/confluence/ to see what others have done on your platform, and discuss the pros and cons of various options on - the KnowledgeTree Forums at http://forum.ktdms.com/ + the KnowledgeTree Forums at http://forums.ktdms.com/ * Check the pre-installation checkup: @@ -42,7 +42,7 @@ KnowledgeTree Installation Notes a password (-p, and you will be asked for the password). Using other tools is beyond the scope of this document. Consult the - KnowledgeTree Wiki at http://support.ktdms.com/confluence/ to see how + KnowledgeTree Wiki at http://issues.ktdms.com/confluence/ to see how others have approached this on your platform. * Configure your installation in config/config.ini: @@ -122,7 +122,7 @@ For the Windows platform, these are: . InfoZip unzip and zip - http://www.info-zip.org/ Installing these packages is beyond the scope of this document - please -consult the KnowledgeTree Wiki at http://support.ktdms.com/confluence/ +consult the KnowledgeTree Wiki at http://issues.ktdms.com/confluence/ to see how others have approached this on your platform. We recommend that you use the appropriate package management procedures for installing these packages on your system to ensure ease of maintenance @@ -140,12 +140,12 @@ Please make sure that your KnowledgeTree installation passes all the pre- and post-installation checkups first. Refer to the Frequently Asked Questions list on the KnowledgeTree Wiki -at http://support.ktdms.com/confluence/ +at http://issues.ktdms.com/confluence/ -Ask on the KnowledgeTree forums on http://forum.ktdms.com/. +Ask on the KnowledgeTree forums on http://forums.ktdms.com/. If you have found a bug, please report it to the KnowledgeTree bug -reporting system at http://support.ktdms.com/. +reporting system at http://issues.ktdms.com/. Upgrading --------- @@ -156,8 +156,8 @@ Refer to docs/UPGRADE.txt KnowledgeTree Document Management System Web page: http://www.ktdms.com/ -Wiki: http://support.ktdms.com/confluence/ -Forums: http://forum.ktdms.com/ -Bug reporting: http://support.ktdms.com/ +Wiki: http://issues.ktdms.com/confluence/ +Forums: http://forums.ktdms.com/ +Bug reporting: http://issues.ktdms.com/ $Id$ diff --git a/docs/README.txt b/docs/README.txt index 8d66164..df0f137 100644 --- a/docs/README.txt +++ b/docs/README.txt @@ -42,8 +42,8 @@ For installation instructions please refer to docs/INSTALL.txt KnowledgeTree Document Management System Web page: http://www.ktdms.com/ -Wiki: http://support.ktdms.com/confluence/ -Forums: http://forum.ktdms.com/ -Bug reporting: http://support.ktdms.com/ +Wiki: http://issues.ktdms.com/confluence/ +Forums: http://forums.ktdms.com/ +Bug reporting: http://issues.ktdms.com/ $Id$ diff --git a/docs/UPGRADE.txt b/docs/UPGRADE.txt index 51beaf3..b7abd26 100644 --- a/docs/UPGRADE.txt +++ b/docs/UPGRADE.txt @@ -90,8 +90,8 @@ directory to "var/Documents before upgrading. KnowledgeTree Document Management System Web page: http://www.ktdms.com/ -Wiki: http://support.ktdms.com/confluence/ -Forums: http://forum.ktdms.com/ -Bug reporting: http://support.ktdms.com/ +Wiki: http://issues.ktdms.com/confluence/ +Forums: http://forums.ktdms.com/ +Bug reporting: http://issues.ktdms.com/ $Id$ diff --git a/lib/config/config.inc.php b/lib/config/config.inc.php index d94fdf2..7ed5bf7 100644 --- a/lib/config/config.inc.php +++ b/lib/config/config.inc.php @@ -73,6 +73,7 @@ class KTConfig { $c = new Config; $root =& $c->parseConfig($filename, "IniCommented"); $this->aFileRoot[$filename] =& $root; + $conf =& $root->toArray(); foreach ($conf["root"] as $seck => $secv) { $aSectionFile[$seck] = $filename; diff --git a/lib/dispatcher.inc.php b/lib/dispatcher.inc.php index c9dea41..1a8af0d 100644 --- a/lib/dispatcher.inc.php +++ b/lib/dispatcher.inc.php @@ -44,7 +44,7 @@ class KTDispatcher { var $cancel_var = "kt_cancel"; var $bAutomaticTransaction = false; var $bTransactionStarted = false; - var $oValidator = null; + var $oValidator = null; function KTDispatcher() { $this->oValidator =& new KTDispatcherValidation($this); @@ -101,7 +101,7 @@ class KTDispatcher { if (isset($oOrigDispatcher->aBreadcrumbs)) { $this->aBreadcrumbs = $oOrigDispatcher->aBreadcrumbs; } - if (isset($oOrigDispatcher->aBreadcrumbs)) { + if (isset($oOrigDispatcher->bTransactionStarted)) { $this->bTransactionStarted = $oOrigDispatcher->bTransactionStarted; } if (isset($oOrigDispatcher->oUser)) { @@ -193,14 +193,14 @@ class KTStandardDispatcher extends KTDispatcher { var $aBreadcrumbs = array(); var $sSection = false; var $oPage = false; - var $sHelpPage = null; + var $sHelpPage = null; function KTStandardDispatcher() { if (empty($GLOBALS['main'])) { $GLOBALS['main'] =& new KTPage; } $this->oPage =& $GLOBALS['main']; - parent::KTDispatcher(); + parent::KTDispatcher(); } function permissionDenied () { diff --git a/lib/documentmanagement/Document.inc b/lib/documentmanagement/Document.inc index 701c165..0354ca6 100644 --- a/lib/documentmanagement/Document.inc +++ b/lib/documentmanagement/Document.inc @@ -39,7 +39,6 @@ DEFINE("ARCHIVED", 4); DEFINE("STATUS_INCOMPLETE", 5); require_once(KT_LIB_DIR . "/foldermanagement/Folder.inc"); - require_once(KT_LIB_DIR . '/documentmanagement/documentcontentversion.inc.php'); require_once(KT_LIB_DIR . '/documentmanagement/documentcore.inc.php'); require_once(KT_LIB_DIR . '/documentmanagement/documentmetadataversion.inc.php'); @@ -396,8 +395,14 @@ class Document { // {{{ getByState function &getByState($oState) { $iStateId = KTUtil::getId($oState); - $sTable = KTUtil::getTableName('documents'); - $sQuery = sprintf('SELECT id FROM %s WHERE workflow_state_id = ?', $sTable); + + $sDocumentTable = KTUtil::getTableName('documents'); + $sDocumentMetadataTable = KTUtil::getTableName('document_metadata_version'); + + $sQuery = sprintf("SELECT D.id AS document_id FROM %s AS D + LEFT JOIN %s AS DM ON D.metadata_version_id = DM.id + WHERE workflow_state_id = ?", $sDocumentTable, $sDocumentMetadataTable); + $aParams = array($iStateId); $aIds = DBUtil::getResultArrayKey(array($sQuery, $aParams), 'document_id'); @@ -560,5 +565,16 @@ class Document { function clearAllCaches() { return KTEntityUtil::clearAllCaches('Document'); } + + + function getBreadcrumbs() { + $aBreadcrumbs = KTBrowseUtil::breadcrumbsForDocument($this); + if(PEAR::isError($aBreadcrumbs)) { + return false; + } + return $aBreadcrumbs; + } + + } ?> diff --git a/lib/documentmanagement/documentutil.inc.php b/lib/documentmanagement/documentutil.inc.php index 5ca3a68..d219528 100644 --- a/lib/documentmanagement/documentutil.inc.php +++ b/lib/documentmanagement/documentutil.inc.php @@ -75,9 +75,9 @@ class KTDocumentUtil { if(is_array($aOptions)) { $sFilename = KTUtil::arrayGet($aOptions, 'newfilename', ''); if(strlen($sFilename)) { + global $default; $oDocument->setFileName($sFilename); $default->log->info("renamed document " . $oDocument->getId() . " to " . $sFilename); - } } @@ -610,6 +610,10 @@ class KTDocumentUtil { // IF we're deleted ... if ($oDocument->getStatusID() == DELETED) { return true; } + + + $oOrigFolder = Folder::get($oDocument->getFolderId()); + DBUtil::startTransaction(); @@ -651,6 +655,12 @@ class KTDocumentUtil { $oDocument->setFolderID(1); DBUtil::commit(); + + + // we weren't doing notifications on this one + $oSubscriptionEvent = new SubscriptionEvent(); + $oSubscriptionEvent->RemoveDocument($oDocument, $oOrigFolder); + // document is now deleted: triggers are best-effort. diff --git a/lib/email/Email.inc b/lib/email/Email.inc index 82b4385..f2f1b53 100644 --- a/lib/email/Email.inc +++ b/lib/email/Email.inc @@ -43,8 +43,8 @@ class Email { // create a new phpmailer object. require_once(KT_DIR . '/thirdparty/phpmailer/class.phpmailer.php'); $this->oMailer = new phpmailer(); - $this->oMailer->Encoding = 'base64'; - $this->oMailer->CharSet = 'utf-8'; + $this->oMailer->Encoding = 'base64'; + $this->oMailer->CharSet = 'utf-8'; $this->oMailer->isSMTP(); $this->oMailer->Host = $default->emailServer; $this->oMailer->From = (strlen($sFromEmail) == 0) ? $default->emailFrom : $sFromEmail; diff --git a/lib/subscriptions/subscriptions.inc.php b/lib/subscriptions/subscriptions.inc.php index 0a48896..c7ed825 100644 --- a/lib/subscriptions/subscriptions.inc.php +++ b/lib/subscriptions/subscriptions.inc.php @@ -756,7 +756,18 @@ class SubscriptionContent { } else { $info['actor'] = $oTempUser; $info['has_actor'] = true; - $info['actor_name'] = $oTempUser->getName(); + + $sName = $oTempUser->getName(); + $iUnitId = $oTempUser->getUnitId(); + + if($iUnitId !== false) { + $oUnit = Unit::get($iUnitId); + if(!PEAR::isError($oUnit)) { + $sName .= sprintf(" (%s)", $oUnit->getName()); + } + } + + $info['actor_name'] = $sName; } } diff --git a/lib/users/User.inc b/lib/users/User.inc index daf9ad0..1f11249 100644 --- a/lib/users/User.inc +++ b/lib/users/User.inc @@ -211,10 +211,8 @@ class User extends KTEntity { } /** - * Static function - * Return the useID for the specified user + * Return the useID for the user * - * @param int the id the user to lookup the unit for * @return int the unitID, false otherwise and $_SESSION["errorMessage"] set */ function getUnitId() { diff --git a/plugins/ktcore/KTDocumentActions.php b/plugins/ktcore/KTDocumentActions.php index db5b438..1398ee5 100644 --- a/plugins/ktcore/KTDocumentActions.php +++ b/plugins/ktcore/KTDocumentActions.php @@ -214,6 +214,7 @@ class KTDocumentCheckInAction extends KTDocumentAction { $checkin_fields = array(); $checkin_fields[] = new KTFileUploadWidget(_kt('File'), _kt('The updated document.'), 'file', "", $this->oPage, true); $checkin_fields[] = new KTStringWidget(_kt('Description'), _kt('Describe the changes made to the document.'), 'reason', $sReason, $this->oPage, true); + $checkin_fields[] = new KTCheckboxWidget(_kt('Force Original Filename'), _kt('If this is checked, the uploaded document must have the same filename as the original.'), 'forcefilename', '1', $this->oPage, true); $oTemplate->setData(array( 'context' => &$this, @@ -226,6 +227,8 @@ class KTDocumentCheckInAction extends KTDocumentAction { $sReason = KTUtil::arrayGet($_REQUEST, 'reason'); $sReason = $this->oValidator->notEmpty($sReason); + $bForceFilename = KTUtil::arrayGet($_REQUEST, 'forcefilename'); + // make sure the user actually selected a file first if (strlen($_FILES['file']['name']) == 0) { $this->errorRedirectToMain(_kt("No file was uploaded"), 'fDocumentId=' . $this->oDocument->getId() . '&reason=' . $sReason); @@ -240,23 +243,15 @@ class KTDocumentCheckInAction extends KTDocumentAction { $default->log->info("checkInDocumentBL.php uploaded filename=" . $sNewFilename . "; current filename=" . $sCurrentFilename); - /* - * now allowing this - document's filename is set in 'checkin' - */ - if ($this->oDocument->getFileName() != $_FILES['file']['name']) { - $this->errorRedirectToMain(_kt("The file name of the uploaded file does not match the file name of the document in the system"), 'fDocumentId=' . $this->oDocument->getId() . '&reason=' . $sReason); - } - /**/ - - - $aOptions = array(); - /* - if($sNewFilename != $sCurrentFilename) { - $aOptions['newfilename'] = $sNewFilename; + if ($this->oDocument->getFileName() != $_FILES['file']['name']) { + if($bForceFilename) { + $this->errorRedirectToMain(_kt("The file name of the uploaded file does not match the file name of the document in the system"), 'fDocumentId=' . $this->oDocument->getId() . '&reason=' . $sReason); + } else { + $aOptions['newfilename'] = $sNewFilename; + } } - */ $res = KTDocumentUtil::checkin($this->oDocument, $_FILES['file']['tmp_name'], $sReason, $this->oUser, $aOptions); @@ -541,10 +536,18 @@ class KTDocumentMoveAction extends KTDocumentAction { function do_move() { $this->oPage->setBreadcrumbDetails(_kt("move")); $oTemplate =& $this->oValidator->validateTemplate('ktcore/action/move_final'); + + if($this->oDocument->getFolderId() === $this->oFolder->getId()) { + $this->errorRedirectTo('main', _kt("The document was already in this folder"), sprintf("fDocumentId=%d&fFolderId=%d", $this->oDocument->getId(), $this->oFolder->getId())); + exit(0); + } + + $sFolderPath = join(" » ", $this->oFolder->getPathArray()); $aNames = $this->oDocumentFolder->getPathArray(); $aNames[] = $this->oDocument->getName(); $sDocumentName = join(" » ", $aNames); + $move_fields = array(); $move_fields[] = new KTStaticTextWidget(_kt('Document to move'), '', 'fDocumentId', $sDocumentName, $this->oPage, false); $move_fields[] = new KTStaticTextWidget(_kt('Target folder'), '', 'fFolderId', $sFolderPath, $this->oPage, false); @@ -576,6 +579,7 @@ class KTDocumentMoveAction extends KTDocumentAction { $iOriginalFolderPermissionObjectId = $oOriginalFolder->getPermissionObjectId(); $iDocumentPermissionObjectId = $this->oDocument->getPermissionObjectId(); + if ($iDocumentPermissionObjectId === $iOriginalFolderPermissionObjectId) { $this->oDocument->setPermissionObjectId($this->oFolder->getPermissionObjectId()); } diff --git a/plugins/ktcore/admin/documentFields.php b/plugins/ktcore/admin/documentFields.php index 43a8c7e..d499af7 100755 --- a/plugins/ktcore/admin/documentFields.php +++ b/plugins/ktcore/admin/documentFields.php @@ -689,17 +689,33 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { global $default; // extract. - $oFieldset =& KTFieldset::get($_REQUEST['fFieldsetId']); - $oField =& DocumentField::get($_REQUEST['field_id']); + $iFieldsetId = KTUtil::arrayGet($_REQUEST, 'fFieldsetId', false); + $iFieldId = KTUtil::arrayGet($_REQUEST, 'field_id', false); + + $oFieldset =& KTFieldset::get($iFieldsetId); + if(PEAR::isError($oFieldset)) { + $this->errorRedirectTo('main', _kt('Unable to find fieldset'), sprintf('fFieldId=%d&fFieldsetId=%d', $iFieldsetId, $iFieldId)); + exit(0); + } + + $oField =& DocumentField::get($iFieldId); + if(PEAR::isError($oField)) { + $this->errorRedirectTo('main', _kt('Unable to find field'), sprintf('fFieldId=%d&fFieldsetId=%d', $iFieldsetId, $iFieldId)); + exit(0); + } + + + + $this->aBreadcrumbs[] = array( 'url' => $_SERVER['PHP_SELF'], - 'query' => 'action=edit&fFieldsetId=' . $_REQUEST['fFieldsetId'], + 'query' => 'action=edit&fFieldsetId=' . $iFieldsetId, 'name' => $oFieldset->getName() ); $this->aBreadcrumbs[] = array( 'url' => $_SERVER['PHP_SELF'], - 'query' => 'action=editField&fFieldsetId=' . $_REQUEST['fFieldsetId'] . '&fFieldId=' . $oField->getId(), + 'query' => 'action=editField&fFieldsetId=' . $iFieldsetId . '&fFieldId=' . $oField->getId(), 'name' => $oField->getName() ); $this->oPage->setBreadcrumbDetails(_kt('edit lookup tree')); @@ -728,8 +744,11 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { $msg = _kt('Changes saved.'); if ($subaction === "addCategory") { $new_category = KTUtil::arrayGet($_REQUEST, 'category_name'); - if (empty($new_category)) { return $this->errorRedirectTo("editTree", _kt("Must enter a name for the new category."), array("field_id" => $field_id)); } - else { $this->subact_addCategory($field_id, $current_node, $new_category, $fieldTree);} + if (empty($new_category)) { + return $this->errorRedirectTo("editTree", _kt("Must enter a name for the new category."), array("field_id" => $field_id, "fFieldsetId" => $iFieldsetId)); + } else { + $this->subact_addCategory($field_id, $current_node, $new_category, $fieldTree); + } $msg = _kt('Category added'). ': ' . $new_category; } if ($subaction === "deleteCategory") { @@ -751,10 +770,9 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { $msg = _kt('Keyword moved to base of tree.'); } // now redirect - $query = 'field_id=' . $field_id; + $query = sprintf('field_id=%d&fFieldsetId=%d', $field_id, $iFieldsetId); return $this->successRedirectTo($target, $msg, $query); } - if ($fieldTree->root === null) { return $this->errorRedirectToMain(_kt("Error building tree. Is this a valid tree-lookup field?")); } @@ -835,12 +853,17 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { function _evilTreeRecursion($subnode, $treeToRender) { + // deliver us from evil.... + $iFieldId = $treeToRender->field_id; + $oField = DocumentField::get($iFieldId); + $iFieldsetId = $oField->getParentFieldsetId(); + $treeStr = "