From 8e4d7a531b57ed7fa18a8fe0dd29eebdb528b9b3 Mon Sep 17 00:00:00 2001
From: Brad Shuttleworth
Date: Mon, 24 Apr 2006 08:54:48 +0000
Subject: [PATCH] Bryn Divey 2006-04-24 Changed subscriptions to include full pathname and... Bryn Divey 2006-04-21 Added document title to version comparison. Change... Bryn Divey 2006-04-21 Fixed the error message displayed when an existing... Bryn Divey 2006-04-21 Removed upload thingie to merge Bryn Divey 2006-04-21 Allowing checkin with different filename Bryn Divey 2006-04-21 Rename on upload Bryn Divey 2006-04-20 Fixed the lookup tree display in IE
---
lib/dashboard/Notification.inc.php | 4 +---
lib/documentmanagement/MDTree.inc | 17 ++++++++++++-----
lib/documentmanagement/documentutil.inc.php | 51 ++++++++++++++++++++++++++++++++-------------------
lib/subscriptions/subscriptions.inc.php | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------
lib/widgets/fieldsetDisplay.inc.php | 7 +++++--
plugins/ktcore/KTDocumentActions.php | 37 ++++++++++++++++++++++++++++++++++---
plugins/ktcore/admin/documentFields.php | 6 +++---
plugins/ktcore/folder/addDocument.php | 9 ++++++++-
resources/css/kt-framing.css | 11 +++++++++++
resources/css/kt-ie-icons.css | 29 ++++++++++++++++++++++++++++-
templates/kt3/fieldsets/generic_versioned.smarty | 18 +++++++++++++-----
templates/kt3/fieldsets/simple_versioned.smarty | 2 +-
templates/kt3/notifications/subscriptions.AddDocument.smarty | 3 ++-
templates/kt3/notifications/subscriptions.AddFolder.smarty | 5 +++--
templates/kt3/notifications/subscriptions.CheckInDocument.smarty | 3 ++-
templates/kt3/notifications/subscriptions.CheckOutDocument.smarty | 3 ++-
templates/kt3/notifications/subscriptions.ModifyDocument.smarty | 3 ++-
templates/kt3/notifications/subscriptions.MoveDocument.smarty | 3 ++-
templates/kt3/notifications/subscriptions.RemoveChildDocument.smarty | 3 ++-
templates/kt3/notifications/subscriptions.RemoveChildFolder.smarty | 3 ++-
templates/kt3/notifications/subscriptions.RemoveSubscribedDocument.smarty | 3 ++-
templates/kt3/notifications/subscriptions.RemoveSubscribedFolder.smarty | 3 ++-
22 files changed, 221 insertions(+), 106 deletions(-)
diff --git a/lib/dashboard/Notification.inc.php b/lib/dashboard/Notification.inc.php
index 1027665..2b7fae4 100644
--- a/lib/dashboard/Notification.inc.php
+++ b/lib/dashboard/Notification.inc.php
@@ -138,9 +138,7 @@ class KTNotificationHandler {
function handleNotification($oKTNotification) {
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate("kt3/notifications/generic");
- $aTemplateData = array(
- "context" => $oKTNotification,
- );
+ $aTemplateData = array("context" => $oKTNotification,);
return $oTemplate->render($aTemplateData);
}
diff --git a/lib/documentmanagement/MDTree.inc b/lib/documentmanagement/MDTree.inc
index d1b8228..e57a371 100644
--- a/lib/documentmanagement/MDTree.inc
+++ b/lib/documentmanagement/MDTree.inc
@@ -268,8 +268,11 @@ class MDTree {
$extraclass = '';
if (array_key_exists($subnode_val, $this->activenodes)) {
$extraclass = ' active';
- }
- $treeStr .= '';
}
@@ -300,7 +303,7 @@ class MDTree {
// $treeStr .= print_r($this->activenodes,true);
// the inner section is generised.
- //$treeStr .= '- Root';
+
$treeStr .= '
';
//$default->log->debug("EVILRENDER: " . print_r($treeToRender, true));
foreach ($treeToRender->getRoot() as $node_id => $subtree_nodes)
@@ -309,10 +312,14 @@ class MDTree {
// leaves are handled differently.
if ($node_id !== "leaves") {
$extraclass = '';
+
if (array_key_exists($subtree_nodes, $this->activenodes)) {
$extraclass = ' active';
- }
- $treeStr .= '';
}
diff --git a/lib/documentmanagement/documentutil.inc.php b/lib/documentmanagement/documentutil.inc.php
index 9572b8d..5ca3a68 100644
--- a/lib/documentmanagement/documentutil.inc.php
+++ b/lib/documentmanagement/documentutil.inc.php
@@ -47,7 +47,7 @@ require_once(KT_LIB_DIR . "/foldermanagement/Folder.inc");
require_once(KT_LIB_DIR . '/workflow/workflowutil.inc.php');
class KTDocumentUtil {
- function checkin($oDocument, $sFilename, $sCheckInComment, $oUser) {
+ function checkin($oDocument, $sFilename, $sCheckInComment, $oUser, $aOptions = false) {
$oStorage =& KTStorageManagerUtil::getSingleton();
$iFileSize = filesize($sFilename);
@@ -72,6 +72,15 @@ class KTDocumentUtil {
$oDocument->setMinorVersionNumber($oDocument->getMinorVersionNumber()+1);
$oDocument->setFileSize($iFileSize);
+ if(is_array($aOptions)) {
+ $sFilename = KTUtil::arrayGet($aOptions, 'newfilename', '');
+ if(strlen($sFilename)) {
+ $oDocument->setFileName($sFilename);
+ $default->log->info("renamed document " . $oDocument->getId() . " to " . $sFilename);
+
+ }
+ }
+
$bSuccess = $oDocument->update();
if ($bSuccess !== true) {
if (PEAR::isError($bSuccess)) {
@@ -385,31 +394,35 @@ class KTDocumentUtil {
// {{{ _in_add
function &_in_add($oFolder, $sFilename, $oUser, $aOptions) {
if (KTDocumentUtil::fileExists($oFolder, $sFilename)) {
- $oDoc = Document::getByFilenameAndFolder($sFilename, $oFolder->getId());
- if (PEAR::isError($oDoc)) {
+ $oDoc = Document::getByFilenameAndFolder($sFilename, $oFolder->getId());
+ if (PEAR::isError($oDoc)) {
return PEAR::raiseError(_kt("Document with that filename already exists in this folder, and appears to be invalid. Please contact the system administrator."));
- } else {
- if ($oDoc->getStatusID != LIVE) {
- return PEAR::raiseError(_kt("Document with that filename already exists in this folder, but it has been archived or deleted and is still available for restoration. To prevent it being overwritten, you are not allowed to add a document with the same title or filename."));
- } else {
- return PEAR::raiseError(_kt("Document with that filename already exists in this folder."));
- }
- }
+ } else {
+ if ($oDoc->getStatusID() != LIVE) {
+ $sError = _kt("Document with that filename already exists in this folder, but it has been archived or deleted and is still available for restoration. To prevent it being overwritten, you are not allowed to add a document with the same title or filename.");
+ } else {
+ $sError = _kt("Document with that filename already exists in this folder.");
+ }
+
+ $sError .= _kt(' Document') . ': ' . $oDoc->getName() . ' (ID:' . $oDoc->getId() . ')';
+ return PEAR::raiseError($sError);
+ }
}
$sName = KTUtil::arrayGet($aOptions, 'description', $sFilename);
if (KTDocumentUtil::nameExists($oFolder, $sName)) {
- $oDoc = Document::getByNameAndFolder($sName, $oFolder->getId());
- if (PEAR::isError($oDoc)) {
+ $oDoc = Document::getByNameAndFolder($sName, $oFolder->getId());
+ if (PEAR::isError($oDoc)) {
return PEAR::raiseError(_kt("Document with that title already exists in this folder, and appears to be invalid. Please contact the system administrator."));
- } else {
- if ($oDoc->getStatusID != LIVE) {
+ } else {
+ if ($oDoc->getStatusID != LIVE) {
return PEAR::raiseError(_kt("Document with that title already exists in this folder, but it has been archived or deleted and is still available for restoration. To prevent it being overwritten, you are not allowed to add a document with the same title or filename."));
- } else {
- return PEAR::raiseError(_kt("Document with that title already exists in this folder."));
- }
- }
-
+ } else {
+ return PEAR::raiseError(_kt("Document with that title already exists in this folder."));
+ }
+ }
+
}
+
$oUploadChannel =& KTUploadChannel::getSingleton();
$oUploadChannel->sendMessage(new KTUploadNewFile($sFilename));
$oDocument =& KTDocumentUtil::_add($oFolder, $sFilename, $oUser, $aOptions);
diff --git a/lib/subscriptions/subscriptions.inc.php b/lib/subscriptions/subscriptions.inc.php
index 0fc33a4..0a48896 100644
--- a/lib/subscriptions/subscriptions.inc.php
+++ b/lib/subscriptions/subscriptions.inc.php
@@ -94,11 +94,11 @@ class SubscriptionEvent {
foreach ($aUsers as $oSubscriber) {
// notification object first.
- $aNotificationOptions = array();
- $aNotificationOptions['target_user'] = $oSubscriber->getID();
+ $aNotificationOptions = array();
+ $aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oAddedFolder->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oAddedFolder->getId(); // parent folder_id, in this case.
$aNotificationOptions['event_type'] = "AddFolder";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -125,7 +125,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null - is this valid?
$aNotificationOptions['target_name'] = $oAddedDocument->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oAddedDocument->getId(); // parent folder_id, in this case.
$aNotificationOptions['event_type'] = "AddDocument";
@@ -155,20 +155,20 @@ class SubscriptionEvent {
// notification object first.
$aNotificationOptions = array();
$aNotificationOptions['target_user'] = $oSubscriber->getID();
- $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
- $aNotificationOptions['target_name'] = $oRemovedFolder->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
- $aNotificationOptions['object_id'] = $oParentFolder->getId(); // parent folder_id, since the removed one is removed.
- $aNotificationOptions['event_type'] = "RemoveSubscribedFolder";
+ $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
+ $aNotificationOptions['target_name'] = $oRemovedFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
+ $aNotificationOptions['object_id'] = $oParentFolder->getId(); // parent folder_id, since the removed one is removed.
+ $aNotificationOptions['event_type'] = "RemoveSubscribedFolder";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
// now the email content.
// FIXME this needs to be handled entirely within notifications from now on.
if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
$emailContent = $content->getEmailAlertContent($oNotification);
- $emailSubject = $content->getEmailAlertSubject($oNotification);
- $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);
- $oEmail->send();
+ $emailSubject = $content->getEmailAlertSubject($oNotification);
+ $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);
+ $oEmail->send();
}
// now grab each oSubscribers oSubscription, and delete.
@@ -188,7 +188,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oRemovedFolder->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oParentFolder->getId(); // parent folder_id, since the removed one is removed.
$aNotificationOptions['event_type'] = "RemoveChildFolder";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -220,7 +220,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oRemovedDocument->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oParentFolder->getId(); // parent folder_id, since the removed one is removed.
$aNotificationOptions['event_type'] = "RemoveSubscribedDocument";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -251,7 +251,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oRemovedDocument->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oParentFolder->getId(); // parent folder_id, since the removed one is removed.
$aNotificationOptions['event_type'] = "RemoveChildDocument";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -279,7 +279,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oModifiedDocument->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
$aNotificationOptions['event_type'] = "ModifyDocument";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -304,7 +304,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oModifiedDocument->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
$aNotificationOptions['event_type'] = "ModifyDocument";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -331,7 +331,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oModifiedDocument->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
$aNotificationOptions['event_type'] = "CheckInDocument";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -356,7 +356,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oModifiedDocument->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
$aNotificationOptions['event_type'] = "CheckInDocument";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -384,7 +384,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oModifiedDocument->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
$aNotificationOptions['event_type'] = "CheckOutDocument";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -409,7 +409,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oModifiedDocument->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
$aNotificationOptions['event_type'] = "CheckOutDocument";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -436,7 +436,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oMovedDocument->getName();
- $aNotificationOptions['location_name'] = $oToFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oToFolder->getId(); // parent folder_id, in this case.
$aNotificationOptions['event_type'] = "MovedDocument";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -461,7 +461,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oMovedDocument->getName();
- $aNotificationOptions['location_name'] = $oToFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oToFolder->getId(); // parent folder_id, in this case.
$aNotificationOptions['event_type'] = "MovedDocument";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -485,7 +485,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oMovedDocument->getName();
- $aNotificationOptions['location_name'] = $oToFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oToFolder->getId(); // parent folder_id, in this case.
$aNotificationOptions['event_type'] = "MovedDocument";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -512,7 +512,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oModifiedDocument->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
$aNotificationOptions['event_type'] = "ArchivedDocument";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -537,7 +537,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oModifiedDocument->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
$aNotificationOptions['event_type'] = "ArchivedDocument";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -565,7 +565,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oModifiedDocument->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
$aNotificationOptions['event_type'] = "RestoreArchivedDocument";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -590,7 +590,7 @@ class SubscriptionEvent {
$aNotificationOptions['target_user'] = $oSubscriber->getID();
$aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
$aNotificationOptions['target_name'] = $oModifiedDocument->getName();
- $aNotificationOptions['location_name'] = $oParentFolder->getName();
+ $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
$aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
$aNotificationOptions['event_type'] = "RestoreArchivedDocument";
$oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
@@ -692,31 +692,30 @@ class SubscriptionContent {
function getEmailAlertSubject($oKTNotification) {
$info = $this->_getSubscriptionData($oKTNotification);
- return $info["title"];
+ return $info["title"];
}
function getNotificationAlertContent($oKTNotification) {
$info = $this->_getSubscriptionData($oKTNotification);
- $oTemplating =& KTTemplating::getSingleton();
-
- $oTemplate = $oTemplating->loadTemplate("kt3/notifications/subscriptions." . $info['event_type']);
- // if, for some reason, this doesn't actually work, use the "generic" title.
- if (PEAR::isError($oTemplate)) {
- $oTemplate = $oTemplating->loadTemplate("kt3/notifications/subscriptions.generic");
- }
- // FIXME we need to specify the i18n by user.
-
- $isBroken = false;
- if (PEAR::isError($info['object']) || ($info['object'] === false) || is_null($info['object'])) {
- $isBroken = true;
- }
-
- $aTemplateData = array(
- "context" => $oKTNotification,
- "info" => $info,
- "is_broken" => $isBroken,
- );
- return $oTemplate->render($aTemplateData);
+ $oTemplating =& KTTemplating::getSingleton();
+
+ $oTemplate = $oTemplating->loadTemplate("kt3/notifications/subscriptions." . $info['event_type']);
+ // if, for some reason, this doesn't actually work, use the "generic" title.
+ if (PEAR::isError($oTemplate)) {
+ $oTemplate = $oTemplating->loadTemplate("kt3/notifications/subscriptions.generic");
+ }
+ // FIXME we need to specify the i18n by user.
+
+ $isBroken = false;
+ if (PEAR::isError($info['object']) || ($info['object'] === false) || is_null($info['object'])) {
+ $isBroken = true;
+ }
+
+ $aTemplateData = array("context" => $oKTNotification,
+ "info" => $info,
+ "is_broken" => $isBroken,
+ );
+ return $oTemplate->render($aTemplateData);
}
// no separate subject function, its rolled into get...Content()
@@ -752,11 +751,12 @@ class SubscriptionContent {
if ($info['actor_id'] !== null) {
$oTempUser = User::get($info['actor_id']);
if (PEAR::isError($oTempUser) || ($oTempUser == false)) {
- // no-act
- $info['actor'] = null;
+ // no-act
+ $info['actor'] = null;
} else {
$info['actor'] = $oTempUser;
- $info['has_actor'] = true;
+ $info['has_actor'] = true;
+ $info['actor_name'] = $oTempUser->getName();
}
}
diff --git a/lib/widgets/fieldsetDisplay.inc.php b/lib/widgets/fieldsetDisplay.inc.php
index b99cd22..5504702 100644
--- a/lib/widgets/fieldsetDisplay.inc.php
+++ b/lib/widgets/fieldsetDisplay.inc.php
@@ -287,8 +287,11 @@ class GenericFieldsetDisplay extends KTFieldsetDisplay {
"document_data" => $aDocumentData,
"document" => $aDocumentData["document"],
- "filename" => $document->getFileName(),
- "comparison_filename" => $comparison_document->getFileName(),
+ "title" => $document->getName(),
+ "comparison_title" => $comparison_document->getName(),
+
+ "filename" => $document->getFileName(),
+ "comparison_filename" => $comparison_document->getFileName(),
"creator" => $creator,
"creation_date" => $creation_date,
diff --git a/plugins/ktcore/KTDocumentActions.php b/plugins/ktcore/KTDocumentActions.php
index 7a372c4..db5b438 100644
--- a/plugins/ktcore/KTDocumentActions.php
+++ b/plugins/ktcore/KTDocumentActions.php
@@ -233,12 +233,33 @@ class KTDocumentCheckInAction extends KTDocumentAction {
// and that the filename matches
global $default;
- $default->log->info("checkInDocumentBL.php uploaded filename=" . $_FILES['file']['name'] . "; current filename=" . $this->oDocument->getFileName());
+
+ $sCurrentFilename = $this->oDocument->getFileName();
+ $sNewFilename = $_FILES['file']['name'];
+
+ $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);
}
+ /**/
+
+
- $res = KTDocumentUtil::checkin($this->oDocument, $_FILES['file']['tmp_name'], $sReason, $this->oUser);
+ $aOptions = array();
+
+ /*
+ if($sNewFilename != $sCurrentFilename) {
+ $aOptions['newfilename'] = $sNewFilename;
+ }
+ */
+
+
+ $res = KTDocumentUtil::checkin($this->oDocument, $_FILES['file']['tmp_name'], $sReason, $this->oUser, $aOptions);
if (PEAR::isError($res)) {
$this->errorRedirectToMain(_kt("An error occurred while trying to check in the document"), 'fDocumentId=' . $this->oDocument->getId() . '&reason=' . $sReason);
}
@@ -970,8 +991,18 @@ class KTDocumentWorkflowAction extends KTDocumentAction {
$oUser =& User::get($_SESSION['userID']);
$res = KTWorkflowUtil::performTransitionOnDocument($oTransition, $oDocument, $oUser, $sComments);
- $this->successRedirectToMain(_kt('Transition performed'),
+
+ if(!Permission::userHasDocumentReadPermission($oDocument)) {
+ $this->successRedirectTo(
+ 'browse',
+ _kt('Transition performed') . '. ' . _kt('You no longer have permission to view this document'),
+ array('fFolderId' => $oDocument->getFolderId())
+ );
+
+ } else {
+ $this->successRedirectToMain(_kt('Transition performed'),
array('fDocumentId' => $oDocument->getId()));
+ }
}
}
// }}}
diff --git a/plugins/ktcore/admin/documentFields.php b/plugins/ktcore/admin/documentFields.php
index b266c6b..43a8c7e 100755
--- a/plugins/ktcore/admin/documentFields.php
+++ b/plugins/ktcore/admin/documentFields.php
@@ -839,7 +839,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
foreach ($treeToRender->contents[$subnode] as $subnode_id => $subnode_val)
{
if ($subnode_id !== "leaves") {
- $treeStr .= '- ' . $treeToRender->mapnodes[$subnode_val]->getName() . '';
+ $treeStr .= '
- ' . $treeToRender->mapnodes[$subnode_val]->getName() . '';
$treeStr .= $this->_evilActionHelper($treeToRender->field_id, false, $subnode_val);
$treeStr .= $this->_evilTreeRecursion($subnode_val, $treeToRender);
$treeStr .= '
';
@@ -868,7 +868,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
// since the root is virtual, we need to fake it here.
// the inner section is generised.
- $treeStr .= '- Root';
+ $treeStr .= '
- Root';
$treeStr .= ' (edit)';
$treeStr .= '
';
//$default->log->debug("EVILRENDER: " . print_r($treeToRender, true));
@@ -878,7 +878,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
// leaves are handled differently.
if ($node_id !== "leaves") {
// $default->log->debug("EVILRENDER: " . print_r($subtree_nodes, true));
- $treeStr .= '- ' . $treeToRender->mapnodes[$subtree_nodes]->getName() . '';
+ $treeStr .= '
- ' . $treeToRender->mapnodes[$subtree_nodes]->getName() . '';
$treeStr .= $this->_evilActionHelper($treeToRender->field_id, false, $subtree_nodes);
$treeStr .= $this->_evilTreeRecursion($subtree_nodes, $treeToRender);
$treeStr .= '
';
diff --git a/plugins/ktcore/folder/addDocument.php b/plugins/ktcore/folder/addDocument.php
index 1c7afbd..b5d24b6 100644
--- a/plugins/ktcore/folder/addDocument.php
+++ b/plugins/ktcore/folder/addDocument.php
@@ -71,6 +71,7 @@ class KTFolderAddDocumentAction extends KTFolderAction {
$add_fields = array();
$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);
$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);
+ $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);
$aVocab = array('' => _kt('<Please select a document type>'));
@@ -120,7 +121,13 @@ class KTFolderAddDocumentAction extends KTFolderAction {
$aFile = $this->oValidator->validateFile($_FILES['file'], $aErrorOptions);
$sTitle = $this->oValidator->validateString($_REQUEST['title'], $aErrorOptions);
-
+ $sAltFilename = KTUtil::arrayGet($_REQUEST, 'altfilename', '');
+
+ if(strlen(trim($sAltFilename))) {
+ $aFile['name'] = $sAltFilename;
+ }
+
+
$iFolderId = $this->oFolder->getId();
/*
// this is now done in ::add
diff --git a/resources/css/kt-framing.css b/resources/css/kt-framing.css
index 8cf30b5..fec36f0 100644
--- a/resources/css/kt-framing.css
+++ b/resources/css/kt-framing.css
@@ -487,8 +487,19 @@ a.main_nav_item {
border-width: 1px;
}
.metadata.versioned dd .current.different {
+ background-color: #fff2b8;
+/*
padding-left: 25px;
background: transparent url(../../thirdparty/icon-theme/16x16/status/dialog-information.png) center left no-repeat;
+*/
+}
+
+.metadata.versioned dd .previous.different {
+ background-color: #e9dda8;
+/*
+ padding-left: 25px;
+ background: transparent url(../../thirdparty/icon-theme/16x16/status/dialog-information.png) center left no-repeat;
+*/
}
.document_details .document_history thead th {
diff --git a/resources/css/kt-ie-icons.css b/resources/css/kt-ie-icons.css
index 6a3adc9..7a1a971 100644
--- a/resources/css/kt-ie-icons.css
+++ b/resources/css/kt-ie-icons.css
@@ -32,4 +32,31 @@
/* IE is woefully unable to */
#portletbar { width: 200px; }
#portlet-search-text { width: 150px; }
-#content { padding-left: 220px; }
\ No newline at end of file
+#content { padding-left: 220px; }
+
+
+
+/* NO CHILD SELECTORS IN IE! */
+
+.kt_treenodes li.treenode a.pathnode
+{
+ padding-left: 15px;
+}
+
+.kt_treenodes li.treenode.active a.pathnode {
+ background: transparent url(../graphics/minus.png) center left no-repeat;
+
+}
+
+.kt_treenodes li.treenode.inactive a.pathnode {
+ background: transparent url(../graphics/plus.png) center left no-repeat;
+}
+
+
+.kt_treenodes li.active ul {
+ display: block;
+}
+
+.kt_treenodes li.inactive ul {
+ display: none;
+}
diff --git a/templates/kt3/fieldsets/generic_versioned.smarty b/templates/kt3/fieldsets/generic_versioned.smarty
index eb5832e..7e36f15 100644
--- a/templates/kt3/fieldsets/generic_versioned.smarty
+++ b/templates/kt3/fieldsets/generic_versioned.smarty
@@ -5,12 +5,20 @@
document.{/i18n}
+ - {i18n}Document Title{/i18n}
+ -
+ {capture assign="oldval"}{$comparison_title}{/capture}
+ {capture assign="newval"}{$title}{/capture}
+
{$newval}
+ {$oldval}
+
+
- {i18n}Document Filename{/i18n}
-
{capture assign="oldval"}{$comparison_filename} ({$context->_sizeHelper($comparison_document->getSize())}){/capture}
{capture assign="newval"}{$filename} ({$context->_sizeHelper($document->getSize())}){/capture}
{$newval}
- {$oldval}
+ {$oldval}
- {i18n}File is a{/i18n}
@@ -18,7 +26,7 @@
{capture assign="oldval"}{$context->_mimeHelper($comparison_document->getMimeTypeID())}{/capture}
{capture assign="newval"}{$context->_mimeHelper($document->getMimeTypeID())}{/capture}
{$newval}
- {$oldval}
+ {$oldval}
- {i18n}Created by{/i18n}
@@ -31,7 +39,7 @@
{capture assign="oldval"}{$comparison_last_modified_by} ({$comparison_last_modified_date}){/capture}
{capture assign="newval"}{$last_modified_by} ({$last_modified_date}){/capture}
{$newval}
- {$oldval}
+ {$oldval}
@@ -40,7 +48,7 @@
{capture assign="oldval"}{$comparison_document_type}{/capture}
{capture assign="newval"}{$document_type}{/capture}
{$newval}
- {$oldval}
+ {$oldval}
- {i18n}Workflow status{/i18n}
@@ -56,7 +64,7 @@
{i18n}No workflow{/i18n}
{/if}{/capture}
{$newval}
- {$oldval}
+ {$oldval}
- {i18n}Document ID{/i18n}
-
diff --git a/templates/kt3/fieldsets/simple_versioned.smarty b/templates/kt3/fieldsets/simple_versioned.smarty
index c294653..d0b2f0f 100644
--- a/templates/kt3/fieldsets/simple_versioned.smarty
+++ b/templates/kt3/fieldsets/simple_versioned.smarty
@@ -14,7 +14,7 @@
{if ($aFieldPair.current_value !== null)}{$aFieldPair.current_value}
{else}{i18n}no value in this version{/i18n}{/if}
-
+
{if ($aFieldPair.previous_value !== null)}{$aFieldPair.previous_value}
{else}{i18n}no value in this version{/i18n}{/if}
diff --git a/templates/kt3/notifications/subscriptions.AddDocument.smarty b/templates/kt3/notifications/subscriptions.AddDocument.smarty
index 78b8b88..adf25aa 100644
--- a/templates/kt3/notifications/subscriptions.AddDocument.smarty
+++ b/templates/kt3/notifications/subscriptions.AddDocument.smarty
@@ -1,7 +1,8 @@
- {$info.title}
-
- The document "{$info.object_name}" was added{if ($info.location_name !== null)} to "{$info.location_name}"{/if}.
+ The document "{$info.object_name}" was added{if ($info.location_name !== null)} to "{$info.location_name}"{/if}{if ($info.has_actor)}
+ by {$info.actor_name}{/if}.
{if !$is_broken}
{i18n}View Document{/i18n}
diff --git a/templates/kt3/notifications/subscriptions.AddFolder.smarty b/templates/kt3/notifications/subscriptions.AddFolder.smarty
index 9387aa7..f4faafa 100644
--- a/templates/kt3/notifications/subscriptions.AddFolder.smarty
+++ b/templates/kt3/notifications/subscriptions.AddFolder.smarty
@@ -1,13 +1,14 @@
- {$info.title}
-
- The folder "{$info.object_name}" was added{if ($info.location_name !== null)} to "{$info.location_name}"{/if}.
+ The folder "{$info.object_name}" was added{if ($info.location_name !== null)} to "{$info.location_name}"{/if}{if ($info.has_actor)}
+ by {$info.actor_name}{/if}.
diff --git a/templates/kt3/notifications/subscriptions.CheckInDocument.smarty b/templates/kt3/notifications/subscriptions.CheckInDocument.smarty
index f3b6c5e..55f15b0 100644
--- a/templates/kt3/notifications/subscriptions.CheckInDocument.smarty
+++ b/templates/kt3/notifications/subscriptions.CheckInDocument.smarty
@@ -1,7 +1,8 @@
- {$info.title}
-
- The document "{$info.object_name}" has been checked in, in the folder "{$info.location_name}".
+ The document "{$info.object_name}" has been checked in{if ($info.has_actor)}
+ by {$info.actor_name}{/if}, in the folder "{$info.location_name}".
{if !$is_broken}
{i18n}View Document{/i18n}
diff --git a/templates/kt3/notifications/subscriptions.CheckOutDocument.smarty b/templates/kt3/notifications/subscriptions.CheckOutDocument.smarty
index deff053..70cc896 100644
--- a/templates/kt3/notifications/subscriptions.CheckOutDocument.smarty
+++ b/templates/kt3/notifications/subscriptions.CheckOutDocument.smarty
@@ -1,7 +1,8 @@
- {$info.title}
-
- The document "{$info.object_name}" has been checked out, in the folder "{$info.location_name}".
+ The document "{$info.object_name}" has been checked out{if ($info.has_actor)}
+ by {$info.actor_name}{/if}, in the folder "{$info.location_name}".
{if !$is_broken}
{i18n}View Document{/i18n}
diff --git a/templates/kt3/notifications/subscriptions.ModifyDocument.smarty b/templates/kt3/notifications/subscriptions.ModifyDocument.smarty
index 1efba26..fa45a5f 100644
--- a/templates/kt3/notifications/subscriptions.ModifyDocument.smarty
+++ b/templates/kt3/notifications/subscriptions.ModifyDocument.smarty
@@ -1,7 +1,8 @@
- {$info.title}
-
- The document "{$info.object_name}" has been changed in the folder "{$info.location_name}". {$info.object}
+ The document "{$info.object_name}" has been changed in the folder "{$info.location_name}"{if ($info.has_actor)}
+ by {$info.actor_name}{/if}. {$info.object}
{if !$is_broken}
{i18n}View Document{/i18n}
diff --git a/templates/kt3/notifications/subscriptions.MoveDocument.smarty b/templates/kt3/notifications/subscriptions.MoveDocument.smarty
index ee907e4..c99be90 100644
--- a/templates/kt3/notifications/subscriptions.MoveDocument.smarty
+++ b/templates/kt3/notifications/subscriptions.MoveDocument.smarty
@@ -1,7 +1,8 @@
- {$info.title}
-
- The document "{$info.object_name}" has been moved to the folder "{$info.location_name}".
+ The document "{$info.object_name}" has been moved to the folder "{$info.location_name}"{if ($info.has_actor)}
+ by {$info.actor_name}{/if}.
{if !$is_broken}
{i18n}View New Location{/i18n}
diff --git a/templates/kt3/notifications/subscriptions.RemoveChildDocument.smarty b/templates/kt3/notifications/subscriptions.RemoveChildDocument.smarty
index faf85ff..4cbb4aa 100644
--- a/templates/kt3/notifications/subscriptions.RemoveChildDocument.smarty
+++ b/templates/kt3/notifications/subscriptions.RemoveChildDocument.smarty
@@ -1,7 +1,8 @@
- {$info.title}
-
- The document "{$info.object_name}" has been removed from the folder "{$info.location_name}", to which you are subscribed.
+ The document "{$info.object_name}" has been removed from the folder "{$info.location_name}" (to which you are subscribed){if ($info.has_actor)}
+ by {$info.actor_name}{/if}.
{if !$is_broken}
diff --git a/templates/kt3/notifications/subscriptions.RemoveChildFolder.smarty b/templates/kt3/notifications/subscriptions.RemoveChildFolder.smarty
index 2ea07aa..be1c33e 100644
--- a/templates/kt3/notifications/subscriptions.RemoveChildFolder.smarty
+++ b/templates/kt3/notifications/subscriptions.RemoveChildFolder.smarty
@@ -1,7 +1,8 @@
- {$info.title}
-
- The folder "{$info.object_name}" was removed{if ($info.location_name !== null)} from "{$info.location_name}"{/if}.
+ The folder "{$info.object_name}" was removed{if ($info.location_name !== null)} from "{$info.location_name}"{/if}{if ($info.has_actor)}
+ by {$info.actor_name}{/if}.
{if !$is_broken}
{i18n}View Folder{/i18n}
diff --git a/templates/kt3/notifications/subscriptions.RemoveSubscribedDocument.smarty b/templates/kt3/notifications/subscriptions.RemoveSubscribedDocument.smarty
index a70e7f3..8e312f0 100644
--- a/templates/kt3/notifications/subscriptions.RemoveSubscribedDocument.smarty
+++ b/templates/kt3/notifications/subscriptions.RemoveSubscribedDocument.smarty
@@ -1,7 +1,8 @@
- {$info.title}
-
- The document "{$info.object_name}" to which you were subscribed, has been removed.
+ The document "{$info.object_name}" to which you were subscribed, has been removed{if ($info.has_actor)}
+ by {$info.actor_name}{/if}.
diff --git a/templates/kt3/notifications/subscriptions.RemoveSubscribedFolder.smarty b/templates/kt3/notifications/subscriptions.RemoveSubscribedFolder.smarty
index 5299a4d..b828c93 100644
--- a/templates/kt3/notifications/subscriptions.RemoveSubscribedFolder.smarty
+++ b/templates/kt3/notifications/subscriptions.RemoveSubscribedFolder.smarty
@@ -1,7 +1,8 @@
- {$info.title}
-
- The folder "{$info.object_name}" to which you were subscribed, was removed.
+ The folder "{$info.object_name}" to which you were subscribed, was removed{if ($info.has_actor)}
+ by {$info.actor_name}{/if}.
--
libgit2 0.21.4