Commit 1e69b12a3d437e11ad774279c1e8e665956c766b

Authored by bshuttle
1 parent 16cce222

Bryn Divey 2006-04-25 More work around notifications

Bryn Divey 2006-04-25 Added in document path, actor name, and actor unit...
Bryn Divey 2006-04-25 KTS-857: added fieldsetids to the evilness of the ...
Bryn Divey 2006-04-24 Fixed KTS-873: Error when setting controlled permi...
Bryn Divey 2006-04-24 Undid alt filename on upload Changed URLs in docum...
Bryn Divey 2006-04-24 Rename now displays correct old name
Bryn Divey 2006-04-24 Small dispatcher fixes Fixed folder rename problem
Bryn Divey 2006-04-24 KTS-653: Moving document into the same folder it w...
Bryn Divey 2006-04-24 Fixed KTS-639 (checkin with different filename)


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5333 c91229c3-7414-0410-bfa2-8a42b809f60b
docs/FAQ.txt
... ... @@ -18,7 +18,7 @@ A: Our community forums are a good place to ask questions about
18 18 network, will endeavour to answer your questions.
19 19  
20 20 Click on the link below to access the forums:
21   - http://forum.ktdms.com/
  21 + http://forums.ktdms.com/
22 22  
23 23 Q: Where can I discuss document management best practices, change
24 24 management and training issues?
... ... @@ -30,7 +30,7 @@ A: Our community forums are a good place to discuss best practices for
30 30  
31 31 Click on the link below to access the forums:
32 32  
33   - http://forum.ktdms.com/
  33 + http://forums.ktdms.com/
34 34  
35 35 Q: Where can I report bugs in KnowledgeTree?
36 36  
... ... @@ -42,7 +42,7 @@ A: You can report bugs in KnowledgeTree by accessing our online
42 42  
43 43 Click on the link below to access the ticketing system:
44 44  
45   - http://support.ktdms.com/
  45 + http://issues.ktdms.com/
46 46  
47 47 Q: I want to modify KnowledgeTree or develop new functionality for it.
48 48 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,
54 54  
55 55 Click on the link below to access the Wiki:
56 56  
57   - http://support.ktdms.com/confluence/
  57 + http://issues.ktdms.com/confluence/
58 58  
59 59  
60 60 KnowledgeTree Document Management System
61 61 Web page: http://www.ktdms.com/
62   -Wiki: http://support.ktdms.com/confluence/
63   -Forums: http://forum.ktdms.com/
64   -Bug reporting: http://support.ktdms.com/
  62 +Wiki: http://issues.ktdms.com/confluence/
  63 +Forums: http://forums.ktdms.com/
  64 +Bug reporting: http://issues.ktdms.com/
65 65  
66 66 $Id$
... ...
docs/INSTALL.WIN32.txt
... ... @@ -125,12 +125,12 @@ For the Windows platform, these are:
125 125 . InfoZip unzip and zip - http://www.info-zip.org/
126 126  
127 127 Installing these packages is beyond the scope of this document - please
128   -consult the KnowledgeTree Wiki at http://support.ktdms.com/confluence/
  128 +consult the KnowledgeTree Wiki at http://issues.ktdms.com/confluence/
129 129 to see how others have approached this on your platform.
130 130  
131 131 You can find Windows specific installation instructions here:
132 132  
133   - http://support.ktdms.com/confluence/display/KTWiki/Windows+XP+installation+instructions
  133 + http://issues.ktdms.com/confluence/display/KTWiki/Windows+XP+installation+instructions
134 134  
135 135  
136 136 Troubleshooting
... ... @@ -140,12 +140,12 @@ Please make sure that your KnowledgeTree installation passes all the
140 140 pre- and post-installation checkups first.
141 141  
142 142 Refer to the Frequently Asked Questions list on the KnowledgeTree Wiki
143   -at http://support.ktdms.com/confluence/
  143 +at http://issues.ktdms.com/confluence/
144 144  
145   -Ask on the KnowledgeTree forums on http://forum.ktdms.com/.
  145 +Ask on the KnowledgeTree forums on http://forums.ktdms.com/.
146 146  
147 147 If you have found a bug, please report it to the KnowledgeTree bug
148   -reporting system at http://support.ktdms.com/.
  148 +reporting system at http://issues.ktdms.com/.
149 149  
150 150 Upgrading
151 151 ---------
... ...
docs/INSTALL.txt
... ... @@ -14,9 +14,9 @@ KnowledgeTree Installation Notes
14 14  
15 15 Due to the many different configuration possibilities, these can not
16 16 all be discussed here. Please consult the KnowledgeTree Wiki system
17   - at http://support.ktdms.com/confluence/ to see what others have done
  17 + at http://issues.ktdms.com/confluence/ to see what others have done
18 18 on your platform, and discuss the pros and cons of various options on
19   - the KnowledgeTree Forums at http://forum.ktdms.com/
  19 + the KnowledgeTree Forums at http://forums.ktdms.com/
20 20  
21 21 * Check the pre-installation checkup:
22 22  
... ... @@ -42,7 +42,7 @@ KnowledgeTree Installation Notes
42 42 a password (-p, and you will be asked for the password).
43 43  
44 44 Using other tools is beyond the scope of this document. Consult the
45   - KnowledgeTree Wiki at http://support.ktdms.com/confluence/ to see how
  45 + KnowledgeTree Wiki at http://issues.ktdms.com/confluence/ to see how
46 46 others have approached this on your platform.
47 47  
48 48 * Configure your installation in config/config.ini:
... ... @@ -122,7 +122,7 @@ For the Windows platform, these are:
122 122 . InfoZip unzip and zip - http://www.info-zip.org/
123 123  
124 124 Installing these packages is beyond the scope of this document - please
125   -consult the KnowledgeTree Wiki at http://support.ktdms.com/confluence/
  125 +consult the KnowledgeTree Wiki at http://issues.ktdms.com/confluence/
126 126 to see how others have approached this on your platform. We recommend
127 127 that you use the appropriate package management procedures for
128 128 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
140 140 pre- and post-installation checkups first.
141 141  
142 142 Refer to the Frequently Asked Questions list on the KnowledgeTree Wiki
143   -at http://support.ktdms.com/confluence/
  143 +at http://issues.ktdms.com/confluence/
144 144  
145   -Ask on the KnowledgeTree forums on http://forum.ktdms.com/.
  145 +Ask on the KnowledgeTree forums on http://forums.ktdms.com/.
146 146  
147 147 If you have found a bug, please report it to the KnowledgeTree bug
148   -reporting system at http://support.ktdms.com/.
  148 +reporting system at http://issues.ktdms.com/.
149 149  
150 150 Upgrading
151 151 ---------
... ... @@ -156,8 +156,8 @@ Refer to docs/UPGRADE.txt
156 156  
157 157 KnowledgeTree Document Management System
158 158 Web page: http://www.ktdms.com/
159   -Wiki: http://support.ktdms.com/confluence/
160   -Forums: http://forum.ktdms.com/
161   -Bug reporting: http://support.ktdms.com/
  159 +Wiki: http://issues.ktdms.com/confluence/
  160 +Forums: http://forums.ktdms.com/
  161 +Bug reporting: http://issues.ktdms.com/
162 162  
163 163 $Id$
... ...
docs/README.txt
... ... @@ -42,8 +42,8 @@ For installation instructions please refer to docs/INSTALL.txt
42 42  
43 43 KnowledgeTree Document Management System
44 44 Web page: http://www.ktdms.com/
45   -Wiki: http://support.ktdms.com/confluence/
46   -Forums: http://forum.ktdms.com/
47   -Bug reporting: http://support.ktdms.com/
  45 +Wiki: http://issues.ktdms.com/confluence/
  46 +Forums: http://forums.ktdms.com/
  47 +Bug reporting: http://issues.ktdms.com/
48 48  
49 49 $Id$
... ...
docs/UPGRADE.txt
... ... @@ -90,8 +90,8 @@ directory to "var/Documents before upgrading.
90 90  
91 91 KnowledgeTree Document Management System
92 92 Web page: http://www.ktdms.com/
93   -Wiki: http://support.ktdms.com/confluence/
94   -Forums: http://forum.ktdms.com/
95   -Bug reporting: http://support.ktdms.com/
  93 +Wiki: http://issues.ktdms.com/confluence/
  94 +Forums: http://forums.ktdms.com/
  95 +Bug reporting: http://issues.ktdms.com/
96 96  
97 97 $Id$
... ...
lib/config/config.inc.php
... ... @@ -73,6 +73,7 @@ class KTConfig {
73 73 $c = new Config;
74 74 $root =& $c->parseConfig($filename, "IniCommented");
75 75 $this->aFileRoot[$filename] =& $root;
  76 +
76 77 $conf =& $root->toArray();
77 78 foreach ($conf["root"] as $seck => $secv) {
78 79 $aSectionFile[$seck] = $filename;
... ...
lib/dispatcher.inc.php
... ... @@ -44,7 +44,7 @@ class KTDispatcher {
44 44 var $cancel_var = "kt_cancel";
45 45 var $bAutomaticTransaction = false;
46 46 var $bTransactionStarted = false;
47   - var $oValidator = null;
  47 + var $oValidator = null;
48 48  
49 49 function KTDispatcher() {
50 50 $this->oValidator =& new KTDispatcherValidation($this);
... ... @@ -101,7 +101,7 @@ class KTDispatcher {
101 101 if (isset($oOrigDispatcher->aBreadcrumbs)) {
102 102 $this->aBreadcrumbs = $oOrigDispatcher->aBreadcrumbs;
103 103 }
104   - if (isset($oOrigDispatcher->aBreadcrumbs)) {
  104 + if (isset($oOrigDispatcher->bTransactionStarted)) {
105 105 $this->bTransactionStarted = $oOrigDispatcher->bTransactionStarted;
106 106 }
107 107 if (isset($oOrigDispatcher->oUser)) {
... ... @@ -193,14 +193,14 @@ class KTStandardDispatcher extends KTDispatcher {
193 193 var $aBreadcrumbs = array();
194 194 var $sSection = false;
195 195 var $oPage = false;
196   - var $sHelpPage = null;
  196 + var $sHelpPage = null;
197 197  
198 198 function KTStandardDispatcher() {
199 199 if (empty($GLOBALS['main'])) {
200 200 $GLOBALS['main'] =& new KTPage;
201 201 }
202 202 $this->oPage =& $GLOBALS['main'];
203   - parent::KTDispatcher();
  203 + parent::KTDispatcher();
204 204 }
205 205  
206 206 function permissionDenied () {
... ...
lib/documentmanagement/Document.inc
... ... @@ -39,7 +39,6 @@ DEFINE("ARCHIVED", 4);
39 39 DEFINE("STATUS_INCOMPLETE", 5);
40 40  
41 41 require_once(KT_LIB_DIR . "/foldermanagement/Folder.inc");
42   -
43 42 require_once(KT_LIB_DIR . '/documentmanagement/documentcontentversion.inc.php');
44 43 require_once(KT_LIB_DIR . '/documentmanagement/documentcore.inc.php');
45 44 require_once(KT_LIB_DIR . '/documentmanagement/documentmetadataversion.inc.php');
... ... @@ -396,8 +395,14 @@ class Document {
396 395 // {{{ getByState
397 396 function &getByState($oState) {
398 397 $iStateId = KTUtil::getId($oState);
399   - $sTable = KTUtil::getTableName('documents');
400   - $sQuery = sprintf('SELECT id FROM %s WHERE workflow_state_id = ?', $sTable);
  398 +
  399 + $sDocumentTable = KTUtil::getTableName('documents');
  400 + $sDocumentMetadataTable = KTUtil::getTableName('document_metadata_version');
  401 +
  402 + $sQuery = sprintf("SELECT D.id AS document_id FROM %s AS D
  403 + LEFT JOIN %s AS DM ON D.metadata_version_id = DM.id
  404 + WHERE workflow_state_id = ?", $sDocumentTable, $sDocumentMetadataTable);
  405 +
401 406 $aParams = array($iStateId);
402 407 $aIds = DBUtil::getResultArrayKey(array($sQuery, $aParams), 'document_id');
403 408  
... ... @@ -560,5 +565,16 @@ class Document {
560 565 function clearAllCaches() {
561 566 return KTEntityUtil::clearAllCaches('Document');
562 567 }
  568 +
  569 +
  570 + function getBreadcrumbs() {
  571 + $aBreadcrumbs = KTBrowseUtil::breadcrumbsForDocument($this);
  572 + if(PEAR::isError($aBreadcrumbs)) {
  573 + return false;
  574 + }
  575 + return $aBreadcrumbs;
  576 + }
  577 +
  578 +
563 579 }
564 580 ?>
... ...
lib/documentmanagement/documentutil.inc.php
... ... @@ -75,9 +75,9 @@ class KTDocumentUtil {
75 75 if(is_array($aOptions)) {
76 76 $sFilename = KTUtil::arrayGet($aOptions, 'newfilename', '');
77 77 if(strlen($sFilename)) {
  78 + global $default;
78 79 $oDocument->setFileName($sFilename);
79 80 $default->log->info("renamed document " . $oDocument->getId() . " to " . $sFilename);
80   -
81 81 }
82 82 }
83 83  
... ... @@ -610,6 +610,10 @@ class KTDocumentUtil {
610 610  
611 611 // IF we're deleted ...
612 612 if ($oDocument->getStatusID() == DELETED) { return true; }
  613 +
  614 +
  615 + $oOrigFolder = Folder::get($oDocument->getFolderId());
  616 +
613 617  
614 618 DBUtil::startTransaction();
615 619  
... ... @@ -651,6 +655,12 @@ class KTDocumentUtil {
651 655 $oDocument->setFolderID(1);
652 656  
653 657 DBUtil::commit();
  658 +
  659 +
  660 + // we weren't doing notifications on this one
  661 + $oSubscriptionEvent = new SubscriptionEvent();
  662 + $oSubscriptionEvent->RemoveDocument($oDocument, $oOrigFolder);
  663 +
654 664  
655 665 // document is now deleted: triggers are best-effort.
656 666  
... ...
lib/email/Email.inc
... ... @@ -43,8 +43,8 @@ class Email {
43 43 // create a new phpmailer object.
44 44 require_once(KT_DIR . '/thirdparty/phpmailer/class.phpmailer.php');
45 45 $this->oMailer = new phpmailer();
46   - $this->oMailer->Encoding = 'base64';
47   - $this->oMailer->CharSet = 'utf-8';
  46 + $this->oMailer->Encoding = 'base64';
  47 + $this->oMailer->CharSet = 'utf-8';
48 48 $this->oMailer->isSMTP();
49 49 $this->oMailer->Host = $default->emailServer;
50 50 $this->oMailer->From = (strlen($sFromEmail) == 0) ? $default->emailFrom : $sFromEmail;
... ...
lib/subscriptions/subscriptions.inc.php
... ... @@ -756,7 +756,18 @@ class SubscriptionContent {
756 756 } else {
757 757 $info['actor'] = $oTempUser;
758 758 $info['has_actor'] = true;
759   - $info['actor_name'] = $oTempUser->getName();
  759 +
  760 + $sName = $oTempUser->getName();
  761 + $iUnitId = $oTempUser->getUnitId();
  762 +
  763 + if($iUnitId !== false) {
  764 + $oUnit = Unit::get($iUnitId);
  765 + if(!PEAR::isError($oUnit)) {
  766 + $sName .= sprintf(" (%s)", $oUnit->getName());
  767 + }
  768 + }
  769 +
  770 + $info['actor_name'] = $sName;
760 771 }
761 772 }
762 773  
... ...
lib/users/User.inc
... ... @@ -211,10 +211,8 @@ class User extends KTEntity {
211 211 }
212 212  
213 213 /**
214   - * Static function
215   - * Return the useID for the specified user
  214 + * Return the useID for the user
216 215 *
217   - * @param int the id the user to lookup the unit for
218 216 * @return int the unitID, false otherwise and $_SESSION["errorMessage"] set
219 217 */
220 218 function getUnitId() {
... ...
plugins/ktcore/KTDocumentActions.php
... ... @@ -214,6 +214,7 @@ class KTDocumentCheckInAction extends KTDocumentAction {
214 214 $checkin_fields = array();
215 215 $checkin_fields[] = new KTFileUploadWidget(_kt('File'), _kt('The updated document.'), 'file', "", $this->oPage, true);
216 216 $checkin_fields[] = new KTStringWidget(_kt('Description'), _kt('Describe the changes made to the document.'), 'reason', $sReason, $this->oPage, true);
  217 + $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);
217 218  
218 219 $oTemplate->setData(array(
219 220 'context' => &$this,
... ... @@ -226,6 +227,8 @@ class KTDocumentCheckInAction extends KTDocumentAction {
226 227 $sReason = KTUtil::arrayGet($_REQUEST, 'reason');
227 228 $sReason = $this->oValidator->notEmpty($sReason);
228 229  
  230 + $bForceFilename = KTUtil::arrayGet($_REQUEST, 'forcefilename');
  231 +
229 232 // make sure the user actually selected a file first
230 233 if (strlen($_FILES['file']['name']) == 0) {
231 234 $this->errorRedirectToMain(_kt("No file was uploaded"), 'fDocumentId=' . $this->oDocument->getId() . '&reason=' . $sReason);
... ... @@ -240,23 +243,15 @@ class KTDocumentCheckInAction extends KTDocumentAction {
240 243 $default->log->info("checkInDocumentBL.php uploaded filename=" . $sNewFilename . "; current filename=" . $sCurrentFilename);
241 244  
242 245  
243   - /*
244   - * now allowing this - document's filename is set in 'checkin'
245   - */
246   - if ($this->oDocument->getFileName() != $_FILES['file']['name']) {
247   - $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);
248   - }
249   - /**/
250   -
251   -
252   -
253 246 $aOptions = array();
254 247  
255   - /*
256   - if($sNewFilename != $sCurrentFilename) {
257   - $aOptions['newfilename'] = $sNewFilename;
  248 + if ($this->oDocument->getFileName() != $_FILES['file']['name']) {
  249 + if($bForceFilename) {
  250 + $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);
  251 + } else {
  252 + $aOptions['newfilename'] = $sNewFilename;
  253 + }
258 254 }
259   - */
260 255  
261 256  
262 257 $res = KTDocumentUtil::checkin($this->oDocument, $_FILES['file']['tmp_name'], $sReason, $this->oUser, $aOptions);
... ... @@ -541,10 +536,18 @@ class KTDocumentMoveAction extends KTDocumentAction {
541 536 function do_move() {
542 537 $this->oPage->setBreadcrumbDetails(_kt("move"));
543 538 $oTemplate =& $this->oValidator->validateTemplate('ktcore/action/move_final');
  539 +
  540 + if($this->oDocument->getFolderId() === $this->oFolder->getId()) {
  541 + $this->errorRedirectTo('main', _kt("The document was already in this folder"), sprintf("fDocumentId=%d&fFolderId=%d", $this->oDocument->getId(), $this->oFolder->getId()));
  542 + exit(0);
  543 + }
  544 +
  545 +
544 546 $sFolderPath = join(" » ", $this->oFolder->getPathArray());
545 547 $aNames = $this->oDocumentFolder->getPathArray();
546 548 $aNames[] = $this->oDocument->getName();
547 549 $sDocumentName = join(" » ", $aNames);
  550 +
548 551 $move_fields = array();
549 552 $move_fields[] = new KTStaticTextWidget(_kt('Document to move'), '', 'fDocumentId', $sDocumentName, $this->oPage, false);
550 553 $move_fields[] = new KTStaticTextWidget(_kt('Target folder'), '', 'fFolderId', $sFolderPath, $this->oPage, false);
... ... @@ -576,6 +579,7 @@ class KTDocumentMoveAction extends KTDocumentAction {
576 579 $iOriginalFolderPermissionObjectId = $oOriginalFolder->getPermissionObjectId();
577 580 $iDocumentPermissionObjectId = $this->oDocument->getPermissionObjectId();
578 581  
  582 +
579 583 if ($iDocumentPermissionObjectId === $iOriginalFolderPermissionObjectId) {
580 584 $this->oDocument->setPermissionObjectId($this->oFolder->getPermissionObjectId());
581 585 }
... ...
plugins/ktcore/admin/documentFields.php
... ... @@ -689,17 +689,33 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
689 689 global $default;
690 690 // extract.
691 691  
692   - $oFieldset =& KTFieldset::get($_REQUEST['fFieldsetId']);
693   - $oField =& DocumentField::get($_REQUEST['field_id']);
  692 + $iFieldsetId = KTUtil::arrayGet($_REQUEST, 'fFieldsetId', false);
  693 + $iFieldId = KTUtil::arrayGet($_REQUEST, 'field_id', false);
  694 +
  695 + $oFieldset =& KTFieldset::get($iFieldsetId);
  696 + if(PEAR::isError($oFieldset)) {
  697 + $this->errorRedirectTo('main', _kt('Unable to find fieldset'), sprintf('fFieldId=%d&fFieldsetId=%d', $iFieldsetId, $iFieldId));
  698 + exit(0);
  699 + }
  700 +
  701 + $oField =& DocumentField::get($iFieldId);
  702 + if(PEAR::isError($oField)) {
  703 + $this->errorRedirectTo('main', _kt('Unable to find field'), sprintf('fFieldId=%d&fFieldsetId=%d', $iFieldsetId, $iFieldId));
  704 + exit(0);
  705 + }
  706 +
  707 +
  708 +
  709 +
694 710  
695 711 $this->aBreadcrumbs[] = array(
696 712 'url' => $_SERVER['PHP_SELF'],
697   - 'query' => 'action=edit&fFieldsetId=' . $_REQUEST['fFieldsetId'],
  713 + 'query' => 'action=edit&fFieldsetId=' . $iFieldsetId,
698 714 'name' => $oFieldset->getName()
699 715 );
700 716 $this->aBreadcrumbs[] = array(
701 717 'url' => $_SERVER['PHP_SELF'],
702   - 'query' => 'action=editField&fFieldsetId=' . $_REQUEST['fFieldsetId'] . '&fFieldId=' . $oField->getId(),
  718 + 'query' => 'action=editField&fFieldsetId=' . $iFieldsetId . '&fFieldId=' . $oField->getId(),
703 719 'name' => $oField->getName()
704 720 );
705 721 $this->oPage->setBreadcrumbDetails(_kt('edit lookup tree'));
... ... @@ -728,8 +744,11 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
728 744 $msg = _kt('Changes saved.');
729 745 if ($subaction === "addCategory") {
730 746 $new_category = KTUtil::arrayGet($_REQUEST, 'category_name');
731   - if (empty($new_category)) { return $this->errorRedirectTo("editTree", _kt("Must enter a name for the new category."), array("field_id" => $field_id)); }
732   - else { $this->subact_addCategory($field_id, $current_node, $new_category, $fieldTree);}
  747 + if (empty($new_category)) {
  748 + return $this->errorRedirectTo("editTree", _kt("Must enter a name for the new category."), array("field_id" => $field_id, "fFieldsetId" => $iFieldsetId));
  749 + } else {
  750 + $this->subact_addCategory($field_id, $current_node, $new_category, $fieldTree);
  751 + }
733 752 $msg = _kt('Category added'). ': ' . $new_category;
734 753 }
735 754 if ($subaction === "deleteCategory") {
... ... @@ -751,10 +770,9 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
751 770 $msg = _kt('Keyword moved to base of tree.');
752 771 }
753 772 // now redirect
754   - $query = 'field_id=' . $field_id;
  773 + $query = sprintf('field_id=%d&fFieldsetId=%d', $field_id, $iFieldsetId);
755 774 return $this->successRedirectTo($target, $msg, $query);
756 775 }
757   -
758 776 if ($fieldTree->root === null) {
759 777 return $this->errorRedirectToMain(_kt("Error building tree. Is this a valid tree-lookup field?"));
760 778 }
... ... @@ -835,12 +853,17 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
835 853  
836 854 function _evilTreeRecursion($subnode, $treeToRender)
837 855 {
  856 + // deliver us from evil....
  857 + $iFieldId = $treeToRender->field_id;
  858 + $oField = DocumentField::get($iFieldId);
  859 + $iFieldsetId = $oField->getParentFieldsetId();
  860 +
838 861 $treeStr = "<ul>";
839 862 foreach ($treeToRender->contents[$subnode] as $subnode_id => $subnode_val)
840 863 {
841 864 if ($subnode_id !== "leaves") {
842 865 $treeStr .= '<li class="treenode active"><a class="pathnode inactive" onclick="toggleElementClass(\'active\', this.parentNode); toggleElementClass(\'inactive\', this.parentNode);">' . $treeToRender->mapnodes[$subnode_val]->getName() . '</a>';
843   - $treeStr .= $this->_evilActionHelper($treeToRender->field_id, false, $subnode_val);
  866 + $treeStr .= $this->_evilActionHelper($iFieldsetId, $iFieldId, false, $subnode_val);
844 867 $treeStr .= $this->_evilTreeRecursion($subnode_val, $treeToRender);
845 868 $treeStr .= '</li>';
846 869 }
... ... @@ -849,7 +872,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
849 872 foreach ($subnode_val as $leaf)
850 873 {
851 874 $treeStr .= '<li class="leafnode">' . $treeToRender->lookups[$leaf]->getName();
852   - $treeStr .= $this->_evilActionHelper($treeToRender->field_id, true, $leaf);
  875 + $treeStr .= $this->_evilActionHelper($iFieldsetId, $iFieldId, true, $leaf);
853 876 $treeStr .= '</li>'; }
854 877 }
855 878 }
... ... @@ -862,15 +885,23 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
862 885 // Come up with a better way to do this (? NBM)
863 886 function _evilTreeRenderer($treeToRender) {
864 887 //global $default;
  888 +
865 889 $treeStr = "<!-- this is rendered with an unholy hack. sorry. -->";
866 890 $stack = array();
867 891 $exitstack = array();
868 892  
  893 + // deliver us from evil....
  894 + $iFieldId = $treeToRender->field_id;
  895 + $oField = DocumentField::get($iFieldId);
  896 + $iFieldsetId = $oField->getParentFieldsetId();
  897 + $sBaseQS = sprintf('field_id=%d&fFieldsetId=%d&', $iFieldId, $iFieldsetId);
  898 +
869 899 // since the root is virtual, we need to fake it here.
870 900 // the inner section is generised.
871 901 $treeStr .= '<ul class="kt_treenodes"><li class="treenode active"><a class="pathnode" onclick="toggleElementClass(\'active\', this.parentNode);toggleElementClass(\'inactive\', this.parentNode);">Root</a>';
872   - $treeStr .= ' (<a href="' . KTUtil::addQueryStringSelf('action=editTree&field_id='.$treeToRender->field_id.'&current_node=0') . '">edit</a>)';
  902 + $treeStr .= ' (<a href="' . KTUtil::addQueryStringSelf($sBaseQS . 'action=editTree&current_node=0') . '">edit</a>)';
873 903 $treeStr .= '<ul>';
  904 +
874 905 //$default->log->debug("EVILRENDER: " . print_r($treeToRender, true));
875 906 foreach ($treeToRender->getRoot() as $node_id => $subtree_nodes)
876 907 {
... ... @@ -879,7 +910,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
879 910 if ($node_id !== "leaves") {
880 911 // $default->log->debug("EVILRENDER: " . print_r($subtree_nodes, true));
881 912 $treeStr .= '<li class="treenode active"><a class="pathnode" onclick="toggleElementClass(\'active\', this.parentNode);toggleElementClass(\'inactive\', this.parentNode);">' . $treeToRender->mapnodes[$subtree_nodes]->getName() . '</a>';
882   - $treeStr .= $this->_evilActionHelper($treeToRender->field_id, false, $subtree_nodes);
  913 + $treeStr .= $this->_evilActionHelper($iFieldsetId, $iFieldId, false, $subtree_nodes);
883 914 $treeStr .= $this->_evilTreeRecursion($subtree_nodes, $treeToRender);
884 915 $treeStr .= '</li>';
885 916 }
... ... @@ -888,7 +919,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
888 919 foreach ($subtree_nodes as $leaf)
889 920 {
890 921 $treeStr .= '<li class="leafnode">' . $treeToRender->lookups[$leaf]->getName();
891   - $treeStr .= $this->_evilActionHelper($treeToRender->field_id, true, $leaf);
  922 + $treeStr .= $this->_evilActionHelper($iFieldsetId, $iFieldId, true, $leaf);
892 923 $treeStr .= '</li>';
893 924 }
894 925 }
... ... @@ -899,16 +930,20 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
899 930 return $treeStr;
900 931 }
901 932  
902   - // don't hate me.
903   - function _evilActionHelper($iFieldId, $bIsKeyword, $current_node) {
  933 + // BS: don't hate me.
  934 + // BD: sorry. I hate you.
  935 +
  936 + function _evilActionHelper($iFieldsetId, $iFieldId, $bIsKeyword, $current_node) {
  937 + $sBaseQS = sprintf('fFieldsetId=%d&field_id=%d&', $iFieldsetId, $iFieldId);
  938 +
904 939 $actionStr = " (";
905 940 if ($bIsKeyword === true) {
906   - $actionStr .= '<a href="' . KTUtil::addQueryStringSelf('action=editTree&field_id='.$iFieldId.'&keyword_id='.$current_node.'&subaction=unlinkKeyword') . '">unlink</a>';
  941 + $actionStr .= '<a href="' . KTUtil::addQueryStringSelf($sBaseQS . 'action=editTree&keyword_id='.$current_node.'&subaction=unlinkKeyword') . '">unlink</a>';
907 942 }
908 943 else
909 944 {
910   - $actionStr .= '<a href="' . KTUtil::addQueryStringSelf('action=editTree&field_id=' . $iFieldId . '&current_node=' . $current_node) .'">attach keywords</a> ';
911   - $actionStr .= '| <a href="' . KTUtil::addQueryStringSelf('action=editTree&field_id='.$iFieldId.'&current_node='.$current_node.'&subaction=deleteCategory') . '">delete</a>';
  945 + $actionStr .= '<a href="' . KTUtil::addQueryStringSelf($sBaseQS . 'action=editTree&current_node=' . $current_node) .'">attach keywords</a> ';
  946 + $actionStr .= '| <a href="' . KTUtil::addQueryStringSelf($sBaseQS . 'action=editTree&current_node='.$current_node.'&subaction=deleteCategory') . '">delete</a>';
912 947 }
913 948 $actionStr .= ")";
914 949 return $actionStr;
... ... @@ -934,7 +969,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
934 969 "context" => &$this,
935 970 "fieldset_id" => $fieldset_id,
936 971 "aFields" => $aFields,
937   - "behaviours" => $aBehaviours,
  972 + "behaviours" => $aBehaviours,
938 973 "iMasterFieldId" => $oFieldset->getMasterFieldId(),
939 974 );
940 975 return $oTemplate->render($aTemplateData);
... ...
plugins/ktcore/folder/Rename.php
... ... @@ -70,8 +70,9 @@ class KTFolderRenameAction extends KTFolderAction {
70 70 $sFolderName = KTUtil::arrayGet($_REQUEST, 'foldername');
71 71 $aErrorOptions['defaultmessage'] = _kt("No folder name given");
72 72 $sFolderName = $this->oValidator->validateString($sFolderName, $aErrorOptions);
  73 + $sOldFolderName = $this->oFolder->getName();
73 74  
74   - $oParentFolder =& Folder::get($this->oFolder->iParentID);
  75 + $oParentFolder =& Folder::get($this->oFolder->getParentID());
75 76 if(PEAR::isError($oParentFolder)) {
76 77 $this->errorRedirectToMain(_kt('Unable to retrieve parent folder.'), $aErrorOptions['redirect_to'][1]);
77 78 exit(0);
... ... @@ -89,7 +90,7 @@ class KTFolderRenameAction extends KTFolderAction {
89 90 redirect(KTBrowseUtil::getUrlForFolder($this->oFolder));
90 91 exit(0);
91 92 } else {
92   - $_SESSION['KTInfoMessage'][] = sprintf(_kt('Folder "%s" renamed to "%s".'), $this->oFolder->getName(), $sFolderName);
  93 + $_SESSION['KTInfoMessage'][] = sprintf(_kt('Folder "%s" renamed to "%s".'), $sOldFolderName, $sFolderName);
93 94 }
94 95  
95 96 $this->commitTransaction();
... ...
plugins/ktcore/folder/addDocument.php
... ... @@ -71,7 +71,13 @@ class KTFolderAddDocumentAction extends KTFolderAction {
71 71 $add_fields = array();
72 72 $add_fields[] = new KTFileUploadWidget(_kt('File'), _kt('The contents of the document to be added to the document management system.'), 'file', "", $this->oPage, true, null, null, $aOptions);
73 73 $add_fields[] = new KTStringWidget(_kt('Title'), _kt('The document title is used as the main name of a document throughout KnowledgeTree.'), 'title', "", $this->oPage, true, null, null, $aOptions);
  74 +
  75 +
  76 +
  77 + /* Allows filename change on upload
  78 +
74 79 $add_fields[] = new KTStringWidget(_kt('New Filename'), _kt('If you wish to upload this file under a different filename, enter it here.'), 'altfilename', "", $this->oPage, false, null, null, $aOptions);
  80 + */
75 81  
76 82  
77 83 $aVocab = array('' => _kt('&lt;Please select a document type&gt;'));
... ...
templates/kt3/notifications/subscriptions.AddFolder.smarty
... ... @@ -7,7 +7,7 @@
7 7 {if !$is_broken}
8 8 <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View New Folder{/i18n}</a>
9 9 {else}
10   - <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span>
  10 + <span class="descriptiveText">{i18n}Folder is no longer available{/i18n}</span>
11 11 {/if}
12 12 | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
13 13 </div>
... ...
templates/kt3/notifications/subscriptions.ArchiveDocument.smarty renamed to templates/kt3/notifications/subscriptions.ArchivedDocument.smarty
1 1 <dt class="actionitem subscription">{$info.title}</dt>
2 2 <dd class="actionmessage">
3 3 <!-- could break this up. -->
4   - The document "{$info.object_name}" has been archived by an administrator.
  4 + The document "{$info.object_name}" {if ($info.location_name !== null)} from "{$info.location_name}"{/if} was archived{if ($info.has_actor)}
  5 + by {$info.actor_name}{/if}.
  6 +
5 7 <div class="actionoptions">
6 8 <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
7 9 </div>
... ...
templates/ktcore/document/admin/archivebrowse.smarty
... ... @@ -10,7 +10,7 @@ notification to you.{/i18n}
10 10 <form method="POST" action="{$smarty.server.PHP_SELF}">
11 11 <input type="hidden" name="action" value="confirm_restore" />
12 12 <p class="descriptiveText">{i18n}Use the folder collection and path below to
13   -browse to the folder you wish to move the documents into.{/i18n}</p>
  13 +browse to the folder containing the documents you wish to restore.{/i18n}</p>
14 14  
15 15 <input type="hidden" name="fFolderId" value="{$folder->getId()}" />
16 16 {foreach from=$collection_breadcrumbs item=breadcrumb name=bc}
... ...