Commit e78b444e24d118d7af95bc5db3c94e3c09a51ecb
1 parent
adddb847
Patch from Bryn Divey <brynmor@jamwarehouse.com>
Bryn Divey 2006-01-30 Fixed KTS-173 (Cancel is a link). Think I got them a...
Bryn Divey 2006-01-30 Fixed KTS-110 and KTS-206 (work around deleted doc...
Bryn Divey 2006-01-30 Fixed KTS-231, KTS-232 (discussion problems). Have...
Bryn Divey 2006-01-30 Fixed KTS-178 (checkout notification broken)
Bryn Divey 2006-01-30 KTS-209 (Adding <Please select document type> into...
Bryn Divey 2006-01-30 Completed KTS-97 (confirmation on user delete)
Bryn Divey 2006-01-30 Finished KTS-211 (disable document type)
Bryn Divey 2006-01-30 Merge
Bryn Divey 2006-01-27 Merge
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4710 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
21 changed files
with
176 additions
and
39 deletions
edit.php
| @@ -83,9 +83,18 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher { | @@ -83,9 +83,18 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher { | ||
| 83 | $this->addBreadcrumbs(); | 83 | $this->addBreadcrumbs(); |
| 84 | $this->oPage->setBreadcrumbDetails(_('Change Document Type')); | 84 | $this->oPage->setBreadcrumbDetails(_('Change Document Type')); |
| 85 | 85 | ||
| 86 | - $oDocumentType = DocumentType::get($oDocument->getDocumentTypeID()); | ||
| 87 | $aDocTypes = DocumentType::getList(); | 86 | $aDocTypes = DocumentType::getList(); |
| 88 | - | 87 | + |
| 88 | + | ||
| 89 | + $aDocTypes = array(); | ||
| 90 | + foreach (DocumentType::getList() as $oDocumentType) { | ||
| 91 | + if(!$oDocumentType->getDisabled()) { | ||
| 92 | + $aDocTypes[] = $oDocumentType; | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + $oDocumentType = DocumentType::get($oDocument->getDocumentTypeID()); | ||
| 97 | + | ||
| 89 | $oTemplating =& KTTemplating::getSingleton(); | 98 | $oTemplating =& KTTemplating::getSingleton(); |
| 90 | $oTemplate =& $oTemplating->loadTemplate("ktcore/document/change_type"); | 99 | $oTemplate =& $oTemplating->loadTemplate("ktcore/document/change_type"); |
| 91 | $aTemplateData = array( | 100 | $aTemplateData = array( |
lib/dashboard/Notification.inc.php
| @@ -201,6 +201,7 @@ class KTSubscriptionNotification extends KTNotificationHandler { | @@ -201,6 +201,7 @@ class KTSubscriptionNotification extends KTNotificationHandler { | ||
| 201 | // resolve the object type based on the alert type. | 201 | // resolve the object type based on the alert type. |
| 202 | function _getEventObject($sAlertType, $id) { | 202 | function _getEventObject($sAlertType, $id) { |
| 203 | $t = KTUtil::arrayGet($this->_eventObjectMap, $sAlertType ,''); | 203 | $t = KTUtil::arrayGet($this->_eventObjectMap, $sAlertType ,''); |
| 204 | + | ||
| 204 | if ($t == 'document') { | 205 | if ($t == 'document') { |
| 205 | $o = Document::get($id); | 206 | $o = Document::get($id); |
| 206 | if (PEAR::isError($o) || ($o == false)) { return null; | 207 | if (PEAR::isError($o) || ($o == false)) { return null; |
| @@ -283,6 +284,7 @@ class KTSubscriptionNotification extends KTNotificationHandler { | @@ -283,6 +284,7 @@ class KTSubscriptionNotification extends KTNotificationHandler { | ||
| 283 | $info = $this->_getSubscriptionData($oKTNotification); | 284 | $info = $this->_getSubscriptionData($oKTNotification); |
| 284 | 285 | ||
| 285 | $object_type = $this->_getEventObjectType($info['event_type']); | 286 | $object_type = $this->_getEventObjectType($info['event_type']); |
| 287 | + | ||
| 286 | if ($object_type == '') { | 288 | if ($object_type == '') { |
| 287 | $_SESSION['KTErrorMessage'][] = 'This notification has no "target". Please report as a bug that this subscription should only have a clear action.' . $object_type; | 289 | $_SESSION['KTErrorMessage'][] = 'This notification has no "target". Please report as a bug that this subscription should only have a clear action.' . $object_type; |
| 288 | exit(redirect(generateControllerLink('dashboard'))); | 290 | exit(redirect(generateControllerLink('dashboard'))); |
lib/documentmanagement/DocumentType.inc
| @@ -30,10 +30,13 @@ class DocumentType extends KTEntity { | @@ -30,10 +30,13 @@ class DocumentType extends KTEntity { | ||
| 30 | var $iId; | 30 | var $iId; |
| 31 | /** document type name */ | 31 | /** document type name */ |
| 32 | var $sName; | 32 | var $sName; |
| 33 | + /** disabled boolean */ | ||
| 34 | + var $bDisabled; | ||
| 33 | 35 | ||
| 34 | var $_aFieldToSelect = array( | 36 | var $_aFieldToSelect = array( |
| 35 | 'iId' => 'id', | 37 | 'iId' => 'id', |
| 36 | 'sName' => 'name', | 38 | 'sName' => 'name', |
| 39 | + 'bDisabled' => 'disabled' | ||
| 37 | ); | 40 | ); |
| 38 | 41 | ||
| 39 | /** | 42 | /** |
| @@ -47,6 +50,7 @@ class DocumentType extends KTEntity { | @@ -47,6 +50,7 @@ class DocumentType extends KTEntity { | ||
| 47 | //object not created yet | 50 | //object not created yet |
| 48 | $this->iId = -1; | 51 | $this->iId = -1; |
| 49 | $this->sName = $sNewName; | 52 | $this->sName = $sNewName; |
| 53 | + $this->bDisabled = false; | ||
| 50 | } | 54 | } |
| 51 | 55 | ||
| 52 | /** | 56 | /** |
| @@ -79,9 +83,36 @@ class DocumentType extends KTEntity { | @@ -79,9 +83,36 @@ class DocumentType extends KTEntity { | ||
| 79 | $this->sName = $sNewValue; | 83 | $this->sName = $sNewValue; |
| 80 | } | 84 | } |
| 81 | 85 | ||
| 86 | + | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * Get the document type's disabled status | ||
| 90 | + * | ||
| 91 | + * @return Boolean document type's disabled status | ||
| 92 | + * | ||
| 93 | + */ | ||
| 94 | + function getDisabled() { | ||
| 95 | + return $this->bDisabled; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + /** | ||
| 99 | + * Set the document type's disabled status | ||
| 100 | + * | ||
| 101 | + * @param document type's new disabled status | ||
| 102 | + * | ||
| 103 | + */ | ||
| 104 | + function setDisabled($bNewValue) { | ||
| 105 | + $this->bDisabled = ($bNewValue) ? true : false; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + | ||
| 109 | + | ||
| 110 | + | ||
| 111 | + | ||
| 82 | function _fieldValues () { | 112 | function _fieldValues () { |
| 83 | return array( | 113 | return array( |
| 84 | 'name' => $this->sName, | 114 | 'name' => $this->sName, |
| 115 | + 'disabled' => $this->bDisabled, | ||
| 85 | ); | 116 | ); |
| 86 | } | 117 | } |
| 87 | 118 | ||
| @@ -155,6 +186,7 @@ class DocumentType extends KTEntity { | @@ -155,6 +186,7 @@ class DocumentType extends KTEntity { | ||
| 155 | if ($sql->next_record()) { | 186 | if ($sql->next_record()) { |
| 156 | $oDocumentType = & new DocumentType($sql->f("name")); | 187 | $oDocumentType = & new DocumentType($sql->f("name")); |
| 157 | $oDocumentType->iId = $sql->f("id"); | 188 | $oDocumentType->iId = $sql->f("id"); |
| 189 | + $oDocumentType->bDisabled = $sql->f("disabled"); | ||
| 158 | return $oDocumentType; | 190 | return $oDocumentType; |
| 159 | } | 191 | } |
| 160 | $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = document_types"; | 192 | $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = document_types"; |
lib/subscriptions/subscriptions.inc.php
| @@ -291,7 +291,7 @@ class SubscriptionEvent { | @@ -291,7 +291,7 @@ class SubscriptionEvent { | ||
| 291 | } | 291 | } |
| 292 | } | 292 | } |
| 293 | } | 293 | } |
| 294 | - function CheckinDocument($oModifiedDocument, $oParentFolder) { | 294 | + function CheckInDocument($oModifiedDocument, $oParentFolder) { |
| 295 | $content = new SubscriptionContent(); // needed for i18n | 295 | $content = new SubscriptionContent(); // needed for i18n |
| 296 | // OK: two actions: document registrants, folder registrants. | 296 | // OK: two actions: document registrants, folder registrants. |
| 297 | $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]); | 297 | $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]); |
| @@ -305,7 +305,7 @@ class SubscriptionEvent { | @@ -305,7 +305,7 @@ class SubscriptionEvent { | ||
| 305 | $aNotificationOptions['target_name'] = $oModifiedDocument->getName(); | 305 | $aNotificationOptions['target_name'] = $oModifiedDocument->getName(); |
| 306 | $aNotificationOptions['location_name'] = $oParentFolder->getName(); | 306 | $aNotificationOptions['location_name'] = $oParentFolder->getName(); |
| 307 | $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case. | 307 | $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case. |
| 308 | - $aNotificationOptions['event_type'] = "CheckinDocument"; | 308 | + $aNotificationOptions['event_type'] = "CheckInDocument"; |
| 309 | $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions); | 309 | $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions); |
| 310 | 310 | ||
| 311 | // now the email content. | 311 | // now the email content. |
| @@ -330,7 +330,7 @@ class SubscriptionEvent { | @@ -330,7 +330,7 @@ class SubscriptionEvent { | ||
| 330 | $aNotificationOptions['target_name'] = $oModifiedDocument->getName(); | 330 | $aNotificationOptions['target_name'] = $oModifiedDocument->getName(); |
| 331 | $aNotificationOptions['location_name'] = $oParentFolder->getName(); | 331 | $aNotificationOptions['location_name'] = $oParentFolder->getName(); |
| 332 | $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case. | 332 | $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case. |
| 333 | - $aNotificationOptions['event_type'] = "CheckinDocument"; | 333 | + $aNotificationOptions['event_type'] = "CheckInDocument"; |
| 334 | $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions); | 334 | $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions); |
| 335 | 335 | ||
| 336 | // now the email content. | 336 | // now the email content. |
| @@ -344,7 +344,7 @@ class SubscriptionEvent { | @@ -344,7 +344,7 @@ class SubscriptionEvent { | ||
| 344 | } | 344 | } |
| 345 | } | 345 | } |
| 346 | } | 346 | } |
| 347 | - function CheckoutDocument($oModifiedDocument, $oParentFolder) { | 347 | + function CheckOutDocument($oModifiedDocument, $oParentFolder) { |
| 348 | $content = new SubscriptionContent(); // needed for i18n | 348 | $content = new SubscriptionContent(); // needed for i18n |
| 349 | // OK: two actions: document registrants, folder registrants. | 349 | // OK: two actions: document registrants, folder registrants. |
| 350 | $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]); | 350 | $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]); |
| @@ -358,7 +358,7 @@ class SubscriptionEvent { | @@ -358,7 +358,7 @@ class SubscriptionEvent { | ||
| 358 | $aNotificationOptions['target_name'] = $oModifiedDocument->getName(); | 358 | $aNotificationOptions['target_name'] = $oModifiedDocument->getName(); |
| 359 | $aNotificationOptions['location_name'] = $oParentFolder->getName(); | 359 | $aNotificationOptions['location_name'] = $oParentFolder->getName(); |
| 360 | $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case. | 360 | $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case. |
| 361 | - $aNotificationOptions['event_type'] = "CheckoutDocument"; | 361 | + $aNotificationOptions['event_type'] = "CheckOutDocument"; |
| 362 | $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions); | 362 | $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions); |
| 363 | 363 | ||
| 364 | // now the email content. | 364 | // now the email content. |
| @@ -383,7 +383,7 @@ class SubscriptionEvent { | @@ -383,7 +383,7 @@ class SubscriptionEvent { | ||
| 383 | $aNotificationOptions['target_name'] = $oModifiedDocument->getName(); | 383 | $aNotificationOptions['target_name'] = $oModifiedDocument->getName(); |
| 384 | $aNotificationOptions['location_name'] = $oParentFolder->getName(); | 384 | $aNotificationOptions['location_name'] = $oParentFolder->getName(); |
| 385 | $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case. | 385 | $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case. |
| 386 | - $aNotificationOptions['event_type'] = "CheckoutDocument"; | 386 | + $aNotificationOptions['event_type'] = "CheckOutDocument"; |
| 387 | $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions); | 387 | $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions); |
| 388 | 388 | ||
| 389 | // now the email content. | 389 | // now the email content. |
lib/validation/dispatchervalidation.inc.php
| @@ -40,7 +40,8 @@ class KTDispatcherValidation { | @@ -40,7 +40,8 @@ class KTDispatcherValidation { | ||
| 40 | $aFunc = array($entity_name, KTUtil::arrayGet($aOptions, 'method', 'get')); | 40 | $aFunc = array($entity_name, KTUtil::arrayGet($aOptions, 'method', 'get')); |
| 41 | $oEntity =& call_user_func($aFunc, $iId); | 41 | $oEntity =& call_user_func($aFunc, $iId); |
| 42 | if (PEAR::isError($oEntity) || ($oEntity === false)) { | 42 | if (PEAR::isError($oEntity) || ($oEntity === false)) { |
| 43 | - $this->oDispatcher->errorPage(sprintf(_("Invalid identifier provided for: %s"), $entity_name)); | 43 | + $aOptions['message'] = KTUtil::arrayGet($aOptions, 'message', sprintf(_("Invalid identifier provided for: %s"), $entity_name)); |
| 44 | + $this->handleError($aOptions); | ||
| 44 | } | 45 | } |
| 45 | return $oEntity; | 46 | return $oEntity; |
| 46 | } | 47 | } |
plugins/ktcore/admin/documentTypes.php
| @@ -62,6 +62,36 @@ class KTDocumentTypeDispatcher extends KTAdminDispatcher { | @@ -62,6 +62,36 @@ class KTDocumentTypeDispatcher extends KTAdminDispatcher { | ||
| 62 | exit(0); | 62 | exit(0); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | + function do_disable() { | ||
| 66 | + $oDocumentType =& DocumentType::get($_REQUEST['fDocumentTypeId']); | ||
| 67 | + | ||
| 68 | + $oDocumentType->setDisabled(true); | ||
| 69 | + $res = $oDocumentType->update(); | ||
| 70 | + | ||
| 71 | + if (PEAR::isError($res) || ($res === false)) { | ||
| 72 | + $this->errorRedirectTo('main', _('Could not disable document type'), 'fDocumentTypeId=' . $oDocumentType->getId()); | ||
| 73 | + exit(0); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + $this->successRedirectToMain(_('Document type disabled')); | ||
| 77 | + exit(0); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + function do_enable() { | ||
| 81 | + $oDocumentType =& DocumentType::get($_REQUEST['fDocumentTypeId']); | ||
| 82 | + | ||
| 83 | + $oDocumentType->setDisabled(false); | ||
| 84 | + $res = $oDocumentType->update(); | ||
| 85 | + | ||
| 86 | + if (PEAR::isError($res) || ($res === false)) { | ||
| 87 | + $this->errorRedirectTo('main', _('Could not enable document type'), 'fDocumentTypeId=' . $oDocumentType->getId()); | ||
| 88 | + exit(0); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + $this->successRedirectToMain(_('Document type enabled')); | ||
| 92 | + exit(0); | ||
| 93 | + } | ||
| 94 | + | ||
| 65 | function do_edit() { | 95 | function do_edit() { |
| 66 | 96 | ||
| 67 | $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _('Document Type Management')); | 97 | $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _('Document Type Management')); |
plugins/ktcore/folder/BulkImport.php
| @@ -25,10 +25,13 @@ class KTBulkImportFolderAction extends KTFolderAction { | @@ -25,10 +25,13 @@ class KTBulkImportFolderAction extends KTFolderAction { | ||
| 25 | $add_fields = array(); | 25 | $add_fields = array(); |
| 26 | $add_fields[] = new KTStringWidget(_('Path'), _('The path containing the documents to be added to the document management system.'), 'path', "", $this->oPage, true); | 26 | $add_fields[] = new KTStringWidget(_('Path'), _('The path containing the documents to be added to the document management system.'), 'path', "", $this->oPage, true); |
| 27 | 27 | ||
| 28 | - $aVocab = array(); | 28 | + $aVocab = array('' => _('<Please select a document type>')); |
| 29 | foreach (DocumentType::getList() as $oDocumentType) { | 29 | foreach (DocumentType::getList() as $oDocumentType) { |
| 30 | - $aVocab[$oDocumentType->getId()] = $oDocumentType->getName(); | 30 | + if(!$oDocumentType->getDisabled()) { |
| 31 | + $aVocab[$oDocumentType->getId()] = $oDocumentType->getName(); | ||
| 32 | + } | ||
| 31 | } | 33 | } |
| 34 | + | ||
| 32 | $fieldOptions = array("vocab" => $aVocab); | 35 | $fieldOptions = array("vocab" => $aVocab); |
| 33 | $add_fields[] = new KTLookupWidget(_('Document Type'), 'FIXME', 'fDocumentTypeId', null, $this->oPage, true, "add-document-type", $fieldErrors, $fieldOptions); | 36 | $add_fields[] = new KTLookupWidget(_('Document Type'), 'FIXME', 'fDocumentTypeId', null, $this->oPage, true, "add-document-type", $fieldErrors, $fieldOptions); |
| 34 | 37 |
plugins/ktcore/folder/BulkUpload.php
| @@ -40,9 +40,11 @@ class KTBulkUploadFolderAction extends KTFolderAction { | @@ -40,9 +40,11 @@ class KTBulkUploadFolderAction extends KTFolderAction { | ||
| 40 | $add_fields = array(); | 40 | $add_fields = array(); |
| 41 | $add_fields[] = new KTFileUploadWidget(_('Archive file'), _('The archive file containing the documents you wish to add to the document management system.'), 'file', "", $this->oPage, true); | 41 | $add_fields[] = new KTFileUploadWidget(_('Archive file'), _('The archive file containing the documents you wish to add to the document management system.'), 'file', "", $this->oPage, true); |
| 42 | 42 | ||
| 43 | - $aVocab = array(); | 43 | + $aVocab = array('' => _('<Please select a document type>')); |
| 44 | foreach (DocumentType::getList() as $oDocumentType) { | 44 | foreach (DocumentType::getList() as $oDocumentType) { |
| 45 | - $aVocab[$oDocumentType->getId()] = $oDocumentType->getName(); | 45 | + if(!$oDocumentType->getDisabled()) { |
| 46 | + $aVocab[$oDocumentType->getId()] = $oDocumentType->getName(); | ||
| 47 | + } | ||
| 46 | } | 48 | } |
| 47 | $fieldOptions = array("vocab" => $aVocab); | 49 | $fieldOptions = array("vocab" => $aVocab); |
| 48 | $add_fields[] = new KTLookupWidget(_('Document Type'), 'FIXME', 'fDocumentTypeId', null, $this->oPage, true, "add-document-type", $fieldErrors, $fieldOptions); | 50 | $add_fields[] = new KTLookupWidget(_('Document Type'), 'FIXME', 'fDocumentTypeId', null, $this->oPage, true, "add-document-type", $fieldErrors, $fieldOptions); |
plugins/ktcore/folder/addDocument.php
| @@ -44,10 +44,13 @@ class KTFolderAddDocumentAction extends KTFolderAction { | @@ -44,10 +44,13 @@ class KTFolderAddDocumentAction extends KTFolderAction { | ||
| 44 | $add_fields[] = new KTStringWidget(_('Title'), _('The document title is used as the main name of a document throughout KnowledgeTree.'), 'title', "", $this->oPage, true); | 44 | $add_fields[] = new KTStringWidget(_('Title'), _('The document title is used as the main name of a document throughout KnowledgeTree.'), 'title', "", $this->oPage, true); |
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | - $aVocab = array(); | 47 | + $aVocab = array('' => _('<Please select a document type>')); |
| 48 | foreach (DocumentType::getList() as $oDocumentType) { | 48 | foreach (DocumentType::getList() as $oDocumentType) { |
| 49 | - $aVocab[$oDocumentType->getId()] = $oDocumentType->getName(); | 49 | + if(!$oDocumentType->getDisabled()) { |
| 50 | + $aVocab[$oDocumentType->getId()] = $oDocumentType->getName(); | ||
| 51 | + } | ||
| 50 | } | 52 | } |
| 53 | + | ||
| 51 | $fieldOptions = array("vocab" => $aVocab); | 54 | $fieldOptions = array("vocab" => $aVocab); |
| 52 | $add_fields[] = new KTLookupWidget(_('Document Type'), _('Document Types, defined by the administrator, are used to categorise documents. Please select a Document Type from the list below.'), 'fDocumentTypeId', null, $this->oPage, true, "add-document-type", $fieldErrors, $fieldOptions); | 55 | $add_fields[] = new KTLookupWidget(_('Document Type'), _('Document Types, defined by the administrator, are used to categorise documents. Please select a Document Type from the list below.'), 'fDocumentTypeId', null, $this->oPage, true, "add-document-type", $fieldErrors, $fieldOptions); |
| 53 | 56 | ||
| @@ -96,7 +99,8 @@ class KTFolderAddDocumentAction extends KTFolderAction { | @@ -96,7 +99,8 @@ class KTFolderAddDocumentAction extends KTFolderAction { | ||
| 96 | } | 99 | } |
| 97 | } | 100 | } |
| 98 | 101 | ||
| 99 | - $this->oDocumentType = $this->oValidator->validateDocumentType($_REQUEST['fDocumentTypeId']); | 102 | + $aErrorOptions['message'] = _("Please select a valid document type"); |
| 103 | + $this->oDocumentType = $this->oValidator->validateDocumentType($_REQUEST['fDocumentTypeId'], $aErrorOptions); | ||
| 100 | 104 | ||
| 101 | $aOptions = array( | 105 | $aOptions = array( |
| 102 | 'contents' => new KTFSFileLike($aFile['tmp_name']), | 106 | 'contents' => new KTFSFileLike($aFile['tmp_name']), |
plugins/ktstandard/KTDiscussion.php
| @@ -130,6 +130,7 @@ class KTDocumentDiscussionAction extends KTDocumentAction { | @@ -130,6 +130,7 @@ class KTDocumentDiscussionAction extends KTDocumentAction { | ||
| 130 | $iCommentId = $oThread->getFirstCommentId(); | 130 | $iCommentId = $oThread->getFirstCommentId(); |
| 131 | $oComment = DiscussionComment::get($iCommentId); | 131 | $oComment = DiscussionComment::get($iCommentId); |
| 132 | 132 | ||
| 133 | + // breadcrumbs... | ||
| 133 | $this->aBreadcrumbs[] = array( | 134 | $this->aBreadcrumbs[] = array( |
| 134 | 'name' => _('discussion'), | 135 | 'name' => _('discussion'), |
| 135 | 'url' => $_SERVER['PHP_SELF'] . sprintf('?fDocumentId=%d', $this->oDocument->getId()), | 136 | 'url' => $_SERVER['PHP_SELF'] . sprintf('?fDocumentId=%d', $this->oDocument->getId()), |
| @@ -138,6 +139,7 @@ class KTDocumentDiscussionAction extends KTDocumentAction { | @@ -138,6 +139,7 @@ class KTDocumentDiscussionAction extends KTDocumentAction { | ||
| 138 | 'name' => $oComment->getSubject(), | 139 | 'name' => $oComment->getSubject(), |
| 139 | ); | 140 | ); |
| 140 | $this->oPage->setBreadcrumbDetails(_("viewing comments")); | 141 | $this->oPage->setBreadcrumbDetails(_("viewing comments")); |
| 142 | + | ||
| 141 | $oTemplate =& $this->oValidator->validateTemplate('ktstandard/action/discussion_thread'); | 143 | $oTemplate =& $this->oValidator->validateTemplate('ktstandard/action/discussion_thread'); |
| 142 | 144 | ||
| 143 | // Fields for new thread creation | 145 | // Fields for new thread creation |
| @@ -153,6 +155,10 @@ class KTDocumentDiscussionAction extends KTDocumentAction { | @@ -153,6 +155,10 @@ class KTDocumentDiscussionAction extends KTDocumentAction { | ||
| 153 | KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oDocument)) { | 155 | KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oDocument)) { |
| 154 | $closeFields[] = new KTTextWidget(_("Reason"), _("Describe the reason for closing this thread"), "reason", "", $this->oPage, true, null, null, array("cols" => 50, "rows" => 5)); | 156 | $closeFields[] = new KTTextWidget(_("Reason"), _("Describe the reason for closing this thread"), "reason", "", $this->oPage, true, null, null, array("cols" => 50, "rows" => 5)); |
| 155 | } | 157 | } |
| 158 | + | ||
| 159 | + // increment views | ||
| 160 | + $oThread->incrementNumberOfViews(); | ||
| 161 | + $oThread->update(); | ||
| 156 | 162 | ||
| 157 | $aTemplateData = array( | 163 | $aTemplateData = array( |
| 158 | 'context' => &$this, | 164 | 'context' => &$this, |
| @@ -190,6 +196,7 @@ class KTDocumentDiscussionAction extends KTDocumentAction { | @@ -190,6 +196,7 @@ class KTDocumentDiscussionAction extends KTDocumentAction { | ||
| 190 | // Start the transaction comment creation | 196 | // Start the transaction comment creation |
| 191 | $this->startTransaction(); | 197 | $this->startTransaction(); |
| 192 | 198 | ||
| 199 | + // Create comment | ||
| 193 | $oComment = DiscussionComment::createFromArray(array( | 200 | $oComment = DiscussionComment::createFromArray(array( |
| 194 | 'threadid' => $oThread->getId(), | 201 | 'threadid' => $oThread->getId(), |
| 195 | 'userid' => $this->oUser->getId(), | 202 | 'userid' => $this->oUser->getId(), |
| @@ -199,11 +206,17 @@ class KTDocumentDiscussionAction extends KTDocumentAction { | @@ -199,11 +206,17 @@ class KTDocumentDiscussionAction extends KTDocumentAction { | ||
| 199 | $aErrorOptions['message'] = _("There was an error adding the comment to the thread"); | 206 | $aErrorOptions['message'] = _("There was an error adding the comment to the thread"); |
| 200 | $this->oValidator->notError($oComment, $aErrorOptions); | 207 | $this->oValidator->notError($oComment, $aErrorOptions); |
| 201 | 208 | ||
| 209 | + // Update thread | ||
| 202 | $oThread->setLastCommentId($oComment->getId()); | 210 | $oThread->setLastCommentId($oComment->getId()); |
| 211 | + $oThread->incrementNumberOfReplies(); | ||
| 212 | + | ||
| 203 | $res = $oThread->update(); | 213 | $res = $oThread->update(); |
| 214 | + | ||
| 204 | $aErrorOptions['message'] = _("There was an error updating the thread with the new comment"); | 215 | $aErrorOptions['message'] = _("There was an error updating the thread with the new comment"); |
| 205 | $this->oValidator->notError($res, $aErrorOptions); | 216 | $this->oValidator->notError($res, $aErrorOptions); |
| 206 | 217 | ||
| 218 | + | ||
| 219 | + | ||
| 207 | // Thread and comment created correctly, commit to database | 220 | // Thread and comment created correctly, commit to database |
| 208 | $this->commitTransaction(); | 221 | $this->commitTransaction(); |
| 209 | 222 |
resources/css/kt-framing.css
| @@ -341,6 +341,24 @@ a.main_nav_item { | @@ -341,6 +341,24 @@ a.main_nav_item { | ||
| 341 | font-weight: normal; | 341 | font-weight: normal; |
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | +#content a.ktCancelLink { | ||
| 345 | + border: 1px solid #888; | ||
| 346 | + background: #eee; | ||
| 347 | + color: black; | ||
| 348 | + font-weight: normal; | ||
| 349 | + font-size: 90%; | ||
| 350 | + padding: 2px 0.65em 1px 0.65em; | ||
| 351 | + text-transform: lowercase; | ||
| 352 | + text-decoration: none; | ||
| 353 | +} | ||
| 354 | + | ||
| 355 | +#content a.ktCancelLink:hover { | ||
| 356 | + color: black; | ||
| 357 | + text-decoration: none; | ||
| 358 | + border: 1px solid #888; | ||
| 359 | + cursor: default; | ||
| 360 | +} | ||
| 361 | + | ||
| 344 | #content .field | 362 | #content .field |
| 345 | { | 363 | { |
| 346 | margin-bottom: 1.5em; | 364 | margin-bottom: 1.5em; |
| @@ -656,7 +674,8 @@ The text will be hidden for screen view. The generic fahrner-ish approach comes | @@ -656,7 +674,8 @@ The text will be hidden for screen view. The generic fahrner-ish approach comes | ||
| 656 | width: 16px; | 674 | width: 16px; |
| 657 | cursor: pointer; | 675 | cursor: pointer; |
| 658 | } | 676 | } |
| 659 | - | 677 | + |
| 678 | + | ||
| 660 | /* FIXME when available icon-naming-conformant sets have better coverage, make these more accurate. */ | 679 | /* FIXME when available icon-naming-conformant sets have better coverage, make these more accurate. */ |
| 661 | .ktAction.ktDelete { background: transparent url(../../thirdparty/icon-theme/16x16/mimetypes/x-directory-trash.png) top left no-repeat; } | 680 | .ktAction.ktDelete { background: transparent url(../../thirdparty/icon-theme/16x16/mimetypes/x-directory-trash.png) top left no-repeat; } |
| 662 | .ktAction.ktEdit { background: transparent url(../../thirdparty/icon-theme/16x16/actions/document-properties.png) top left no-repeat; } | 681 | .ktAction.ktEdit { background: transparent url(../../thirdparty/icon-theme/16x16/actions/document-properties.png) top left no-repeat; } |
sql/mysql/install/structure.sql
| @@ -414,6 +414,7 @@ CREATE TABLE `document_type_fieldsets_link` ( | @@ -414,6 +414,7 @@ CREATE TABLE `document_type_fieldsets_link` ( | ||
| 414 | CREATE TABLE `document_types_lookup` ( | 414 | CREATE TABLE `document_types_lookup` ( |
| 415 | `id` int(11) NOT NULL default '0', | 415 | `id` int(11) NOT NULL default '0', |
| 416 | `name` char(100) default NULL, | 416 | `name` char(100) default NULL, |
| 417 | + `disabled` int(1) NOT NULL default '0', | ||
| 417 | UNIQUE KEY `id` (`id`), | 418 | UNIQUE KEY `id` (`id`), |
| 418 | UNIQUE KEY `name` (`name`) | 419 | UNIQUE KEY `name` (`name`) |
| 419 | ) TYPE=InnoDB; | 420 | ) TYPE=InnoDB; |
templates/kt3/notifications/subscriptions.CheckinDocument.smarty renamed to templates/kt3/notifications/subscriptions.CheckInDocument.smarty
templates/kt3/notifications/subscriptions.CheckoutDocument.smarty renamed to templates/kt3/notifications/subscriptions.CheckOutDocument.smarty
templates/ktcore/document/admin/deletedlist.smarty
| 1 | +{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} | ||
| 2 | +{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} | ||
| 3 | +{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} | ||
| 4 | + | ||
| 5 | +{$context->oPage->requireJSResource('resources/js/toggleselect.js')} | ||
| 6 | + | ||
| 1 | <h2>{i18n}Deleted Documents{/i18n}</h2> | 7 | <h2>{i18n}Deleted Documents{/i18n}</h2> |
| 2 | 8 | ||
| 3 | <p class="descriptiveText">{i18n}Documents which are deleted by users are hidden from view | 9 | <p class="descriptiveText">{i18n}Documents which are deleted by users are hidden from view |
| @@ -5,10 +11,6 @@ but still available for restoration. Since "soft deletes" consume system resour | @@ -5,10 +11,6 @@ but still available for restoration. Since "soft deletes" consume system resour | ||
| 5 | is possible to <strong>expunge</strong> these documents. Alternatively, you | 11 | is possible to <strong>expunge</strong> these documents. Alternatively, you |
| 6 | can <strong>restore</strong> them as necessary.{/i18n}</p> | 12 | can <strong>restore</strong> them as necessary.{/i18n}</p> |
| 7 | 13 | ||
| 8 | -<p class="descriptiveText"><strong>FIXME</strong> its probably very useful to add | ||
| 9 | -more information about the documents below - e.g. when was it deleted (last modified?)</p> | ||
| 10 | - | ||
| 11 | -<p class="descriptiveText"><strong>FIXME</strong> Have a "select all" toggler here.</p> | ||
| 12 | 14 | ||
| 13 | {if (!empty($documents))} | 15 | {if (!empty($documents))} |
| 14 | 16 | ||
| @@ -16,18 +18,20 @@ more information about the documents below - e.g. when was it deleted (last modi | @@ -16,18 +18,20 @@ more information about the documents below - e.g. when was it deleted (last modi | ||
| 16 | 18 | ||
| 17 | <input type="hidden" name="action" value="branchConfirm" /> | 19 | <input type="hidden" name="action" value="branchConfirm" /> |
| 18 | 20 | ||
| 19 | -<table class="listing"> | 21 | +<table class="kt_collection"> |
| 20 | <thead> | 22 | <thead> |
| 21 | <tr> | 23 | <tr> |
| 22 | - <th> </th> | 24 | + <th style="width:2em"><input type="checkbox" onclick="toggleSelectFor(this, 'selected_docs')" title="toggle all"/></th> |
| 23 | <th>{i18n}Document Name{/i18n}</th> | 25 | <th>{i18n}Document Name{/i18n}</th> |
| 26 | + <th>{i18n}Last Modification{/i18n}</th> | ||
| 24 | </tr> | 27 | </tr> |
| 25 | - </thead> | 28 | + </thead> |
| 26 | <tbody> | 29 | <tbody> |
| 27 | {foreach item=oDoc from=$documents} | 30 | {foreach item=oDoc from=$documents} |
| 28 | <tr> | 31 | <tr> |
| 29 | <td><input type="checkbox" name="selected_docs[]" value="{$oDoc->getId()}"/></td> | 32 | <td><input type="checkbox" name="selected_docs[]" value="{$oDoc->getId()}"/></td> |
| 30 | <td>{$oDoc->getName()}</td> | 33 | <td>{$oDoc->getName()}</td> |
| 34 | + <td>{$oDoc->getLastModifiedDate()}</td> | ||
| 31 | </tr> | 35 | </tr> |
| 32 | {/foreach} | 36 | {/foreach} |
| 33 | </tbody> | 37 | </tbody> |
templates/ktcore/document/admin/force_checkin_confirm.smarty
| @@ -30,6 +30,6 @@ | @@ -30,6 +30,6 @@ | ||
| 30 | <div class="form_actions"> | 30 | <div class="form_actions"> |
| 31 | <input type="submit" value="{i18n}Force Checkin{/i18n}" /> | 31 | <input type="submit" value="{i18n}Force Checkin{/i18n}" /> |
| 32 | <!-- FIXME separate this even further. --> | 32 | <!-- FIXME separate this even further. --> |
| 33 | - <p><a href="?action=main">{i18n}Cancel{/i18n}</a></p> | 33 | + <p><a href="?action=main" class="ktCancelLink">{i18n}Cancel{/i18n}</a></p> |
| 34 | </div> | 34 | </div> |
| 35 | </form> | 35 | </form> |
templates/ktcore/document/change_type.smarty
| @@ -13,6 +13,7 @@ is incorrect, you can change it here.{/i18n}</p> | @@ -13,6 +13,7 @@ is incorrect, you can change it here.{/i18n}</p> | ||
| 13 | <option value="{$oDocType->getId()}" {if ($oDocType->getId() == $document_type->getId())}selected="true"{/if}>{$oDocType->getName()}</option> | 13 | <option value="{$oDocType->getId()}" {if ($oDocType->getId() == $document_type->getId())}selected="true"{/if}>{$oDocType->getName()}</option> |
| 14 | {/foreach} | 14 | {/foreach} |
| 15 | </select> | 15 | </select> |
| 16 | + | ||
| 16 | <div class="form_actions"> | 17 | <div class="form_actions"> |
| 17 | <input type="submit" name="submit" value="{i18n}Change Document Type{/i18n}" /> | 18 | <input type="submit" name="submit" value="{i18n}Change Document Type{/i18n}" /> |
| 18 | </div> | 19 | </div> |
templates/ktcore/documenttypes/list.smarty
| @@ -28,24 +28,37 @@ its details, or click on the delete button to remove it from the | @@ -28,24 +28,37 @@ its details, or click on the delete button to remove it from the | ||
| 28 | system.{/i18n}</p> | 28 | system.{/i18n}</p> |
| 29 | 29 | ||
| 30 | <table class="listing" cellspacing="0" cellpadding="0"> | 30 | <table class="listing" cellspacing="0" cellpadding="0"> |
| 31 | + | ||
| 31 | <thead> | 32 | <thead> |
| 32 | <tr> | 33 | <tr> |
| 33 | - <th colspan="2">{i18n}Document Type{/i18n}</th> | 34 | + <th colspan="3">{i18n}Document Type{/i18n}</th> |
| 34 | </tr> | 35 | </tr> |
| 35 | </thead> | 36 | </thead> |
| 37 | + | ||
| 36 | <tbody> | 38 | <tbody> |
| 39 | + | ||
| 37 | {foreach from=$document_types item=oDocumentType} | 40 | {foreach from=$document_types item=oDocumentType} |
| 38 | -<tr><td> | ||
| 39 | -{ if $oDocumentType->isUsed() } | ||
| 40 | - | ||
| 41 | -{ else } | ||
| 42 | -<a href="?action=delete&fDocumentTypeId={$oDocumentType->getId()}" class="ktAction ktDelete">{i18n}Delete Type{/i18n}</a> | ||
| 43 | -{/if} | 41 | +<tr> |
| 42 | + | ||
| 43 | +<td> | ||
| 44 | + { $oDocumentType->getName() } | ||
| 45 | + </a> | ||
| 44 | </td> | 46 | </td> |
| 47 | + | ||
| 45 | <td> | 48 | <td> |
| 46 | -<a href="?action=edit&fDocumentTypeId={$oDocumentType->getId()}"> { $oDocumentType->getName() } | ||
| 47 | -</a> | ||
| 48 | -</td></tr> | 49 | + <a href="?action=edit&fDocumentTypeId={$oDocumentType->getId()}">Edit</a> |
| 50 | +</td> | ||
| 51 | + | ||
| 52 | +<td> | ||
| 53 | +{if $oDocumentType->getDisabled()} | ||
| 54 | + <a href="?action=enable&fDocumentTypeId={$oDocumentType->getId()}">{i18n}Enable{/i18n}</a> | ||
| 55 | +{else} | ||
| 56 | + <a href="?action=disable&fDocumentTypeId={$oDocumentType->getId()}">{i18n}Disable{/i18n}</a> | ||
| 57 | +{/if} | ||
| 58 | +</td> | ||
| 59 | + | ||
| 60 | + | ||
| 61 | +</tr> | ||
| 49 | </tbody> | 62 | </tbody> |
| 50 | {/foreach} | 63 | {/foreach} |
| 51 | </table> | 64 | </table> |
templates/ktcore/principals/roleadmin.smarty
| @@ -35,7 +35,7 @@ | @@ -35,7 +35,7 @@ | ||
| 35 | 35 | ||
| 36 | <div class="form_actions"> | 36 | <div class="form_actions"> |
| 37 | <input type="submit" value="{i18n}update role information{/i18n}" /> | 37 | <input type="submit" value="{i18n}update role information{/i18n}" /> |
| 38 | - <a href="?action=main" class="ktAction ktCancel">{i18n}Cancel{/i18n}</a> | 38 | + <a href="?action=main" class="ktCancelLink">{i18n}Cancel{/i18n}</a> |
| 39 | </div class="form_actions"> | 39 | </div class="form_actions"> |
| 40 | </fieldset> | 40 | </fieldset> |
| 41 | </form> | 41 | </form> |
templates/ktcore/principals/useradmin.smarty
| @@ -53,7 +53,7 @@ very slow if you have many users.{/i18n}</p> | @@ -53,7 +53,7 @@ very slow if you have many users.{/i18n}</p> | ||
| 53 | <td>{$oUser->getName()}</td> | 53 | <td>{$oUser->getName()}</td> |
| 54 | <td>{$oUser->getUsername()}</td> | 54 | <td>{$oUser->getUsername()}</td> |
| 55 | <td><a href="?action=editUser&user_id={$oUser->getId()}" class="ktAction ktEdit">{i18n}Edit{/i18n}</a></td> | 55 | <td><a href="?action=editUser&user_id={$oUser->getId()}" class="ktAction ktEdit">{i18n}Edit{/i18n}</a></td> |
| 56 | - <td><a href="?action=deleteuser&user_id={$oUser->getId()}" class="ktAction ktDelete">{i18n}Delete{/i18n}</a></td> | 56 | + <td><a onclick="javascript:return confirm('{i18n}Are you sure you wish to delete this user?{/i18n}');" href="?action=deleteuser&user_id={$oUser->getId()}" class="ktAction ktDelete">{i18n}Delete{/i18n}</a></td> |
| 57 | <td><a href="?action=editgroups&user_id={$oUser->getId()}">{i18n}Groups{/i18n}</a></td> | 57 | <td><a href="?action=editgroups&user_id={$oUser->getId()}">{i18n}Groups{/i18n}</a></td> |
| 58 | </tr> | 58 | </tr> |
| 59 | {/foreach} | 59 | {/foreach} |
templates/ktstandard/action/discussion_comment_list_item.smarty
| @@ -11,12 +11,15 @@ dl.kt-discussion-comment > dt { | @@ -11,12 +11,15 @@ dl.kt-discussion-comment > dt { | ||
| 11 | 11 | ||
| 12 | <dl class="kt-discussion-comment"> | 12 | <dl class="kt-discussion-comment"> |
| 13 | <dt>{i18n}Posted{/i18n}</dt> | 13 | <dt>{i18n}Posted{/i18n}</dt> |
| 14 | - {capture name=$name} | 14 | + |
| 15 | + {capture assign=name} | ||
| 15 | {$creator->getName()} | 16 | {$creator->getName()} |
| 16 | {/capture} | 17 | {/capture} |
| 17 | - {capture name=$date} | 18 | + |
| 19 | + {capture assign=date} | ||
| 18 | {$comment->getDate()} | 20 | {$comment->getDate()} |
| 19 | {/capture} | 21 | {/capture} |
| 22 | + | ||
| 20 | <dd>{i18n arg_name=$name arg_date=$date}by #name# at #date#{/i18n}</dd> | 23 | <dd>{i18n arg_name=$name arg_date=$date}by #name# at #date#{/i18n}</dd> |
| 21 | <dt>Subject</dt> | 24 | <dt>Subject</dt> |
| 22 | <dd>{$comment->getSubject()}</dd> | 25 | <dd>{$comment->getSubject()}</dd> |