diff --git a/browse.php b/browse.php index 61dc8d3..968802b 100755 --- a/browse.php +++ b/browse.php @@ -418,7 +418,7 @@ class BrowseDispatcher extends KTStandardDispatcher { $_SESSION["KTErrorMessage"][] = _kt("The following folders can not be moved") . ": " . $folderStr; } if (!empty($documentStr)) { - $_SESSION["KTErrorMessage"][] = _kt("The following documents can not be moved") . ": " . $documentStr; + $_SESSION["KTErrorMessage"][] = _kt("The following documents can not be moved as they are either checked out, or controlled by a workflow") . ": " . $documentStr; } } diff --git a/lib/subscriptions/subscriptions.inc.php b/lib/subscriptions/subscriptions.inc.php index 90026a3..4dbdbee 100644 --- a/lib/subscriptions/subscriptions.inc.php +++ b/lib/subscriptions/subscriptions.inc.php @@ -424,81 +424,82 @@ class SubscriptionEvent { } } } + function MoveDocument($oMovedDocument, $oToFolder, $oFromFolder) { $content = new SubscriptionContent(); // needed for i18n - // OK: two actions: document registrants, folder registrants. + // OK: two actions: document registrants, folder registrants. $aUsers = $this->_getSubscribers($oMovedDocument->getId(), $this->subscriptionTypes["Document"]); - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. - foreach ($aUsers as $oSubscriber) { - - // 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'] = $oMovedDocument->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); + $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. + + foreach ($aUsers as $oSubscriber) { + // 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'] = $oMovedDocument->getName(); + $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oToFolder->getId()); + $aNotificationOptions['object_id'] = $oToFolder->getId(); // parent folder_id, in this case. + $aNotificationOptions['event_type'] = "MovedDocument"; + $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(); - } - } + // 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(); + } + } $aUsers = $this->_getSubscribers($oFromFolder->getId(), $this->subscriptionTypes["Folder"]); - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. - foreach ($aUsers as $oSubscriber) { - - // 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'] = $oMovedDocument->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); - - // 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(); - } - } - + $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. + foreach ($aUsers as $oSubscriber) { + + // 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'] = $oMovedDocument->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); + + // 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(); + } + } + $aUsers = $this->_getSubscribers($oToFolder->getId(), $this->subscriptionTypes["Folder"]); - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. - foreach ($aUsers as $oSubscriber) { - - // 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'] = $oMovedDocument->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); - - // 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(); - } - } + $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. + foreach ($aUsers as $oSubscriber) { + + // 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'] = $oMovedDocument->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); + + // 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(); + } + } } function ArchivedDocument($oModifiedDocument, $oParentFolder) { $content = new SubscriptionContent(); // needed for i18n diff --git a/plugins/ktcore/admin/groupManagement.php b/plugins/ktcore/admin/groupManagement.php index 03365a4..85aea4c 100755 --- a/plugins/ktcore/admin/groupManagement.php +++ b/plugins/ktcore/admin/groupManagement.php @@ -151,12 +151,23 @@ class KTGroupAdminDispatcher extends KTAdminDispatcher { } else { $oGroup->setUnitId($unit_id); } - + $res = $oGroup->update(); if (($res == false) || (PEAR::isError($res))) { return $this->errorRedirectToMain(_kt('Failed to set group details.')); } + + if (!Permission::userIsSystemAdministrator($_SESSION['userID'])) { + $this->rollbackTransaction(); + $this->errorRedirectTo('editGroup', _kt('For security purposes, you cannot remove your own administration priviledges.'), sprintf('group_id=%d', $oGroup->getId())); + exit(0); + } + $this->commitTransaction(); - $this->successRedirectToMain(_kt('Group details updated.')); + if($unit_id == 0 && $is_unitadmin) { + $this->successRedirectToMain(_kt('Group details updated.') . _kt(' Note: group is set as unit administrator, but is not assigned to a unit.')); + } else { + $this->successRedirectToMain(_kt('Group details updated.')); + } } // }}} @@ -309,6 +320,12 @@ class KTGroupAdminDispatcher extends KTAdminDispatcher { $msg = ''; if (!empty($usersAdded)) { $msg .= ' ' . _kt('Added') . ': ' . join(', ', $usersAdded) . ',
'; } if (!empty($usersRemoved)) { $msg .= ' ' . _kt('Removed') . ': ' . join(', ',$usersRemoved) . '.'; } + + if (!Permission::userIsSystemAdministrator($_SESSION['userID'])) { + $this->rollbackTransaction(); + $this->errorRedirectTo('manageUsers', _kt('For security purposes, you cannot remove your own administration priviledges.'), sprintf('group_id=%d', $oGroup->getId())); + exit(0); + } $this->commitTransaction(); $this->successRedirectToMain($msg); @@ -504,7 +521,12 @@ class KTGroupAdminDispatcher extends KTAdminDispatcher { //if (($res == false) || (PEAR::isError($res))) { return $this->errorRedirectToMain('Failed to create group "' . $group_name . '"'); } // do i need to "create" $this->commitTransaction(); - $this->successRedirectToMain(sprintf(_kt('Group "%s" created.'), $group_name)); + + if($unit_id == 0 && $is_unitadmin) { + $this->successRedirectToMain(sprintf(_kt('Group "%s" created.'), $group_name) . _kt(' Note: group is set as unit administrator, but is not assigned to a unit.')); + } else { + $this->successRedirectToMain(sprintf(_kt('Group "%s" created.'), $group_name)); + } } // }}} diff --git a/plugins/ktcore/admin/userManagement.php b/plugins/ktcore/admin/userManagement.php index a1b12f4..c78fc2f 100755 --- a/plugins/ktcore/admin/userManagement.php +++ b/plugins/ktcore/admin/userManagement.php @@ -556,6 +556,13 @@ var $sHelpPage = 'ktcore/admin/manage users.html'; $msg = ''; if (!empty($groupsAdded)) { $msg .= ' ' . _kt('Added to groups') . ': ' . implode(', ', $groupsAdded) . '
'; } if (!empty($groupsRemoved)) { $msg .= ' ' . _kt('Removed from groups') . ': ' . implode(', ',$groupsRemoved) . '.'; } + + if (!Permission::userIsSystemAdministrator($_SESSION['userID'])) { + $this->rollbackTransaction(); + $this->errorRedirectTo('editgroups', _kt('For security purposes, you cannot remove your own administration priviledges.'), sprintf('user_id=%d', $oUser->getId())); + exit(0); + } + $this->commitTransaction(); $this->successRedirectToMain($msg); diff --git a/templates/ktcore/metadata/listFieldsets.smarty b/templates/ktcore/metadata/listFieldsets.smarty index e55f8ec..e209de1 100644 --- a/templates/ktcore/metadata/listFieldsets.smarty +++ b/templates/ktcore/metadata/listFieldsets.smarty @@ -43,7 +43,7 @@ {if $aFields} {foreach from=$aFields item=oField name=fields} -{$oField->getName()}{if (!$smarty.foreach.fields.last)}, {/if} +{$oField->getName()}{if (!$smarty.foreach.fields.last)}
{/if} {/foreach} {else} @@ -58,7 +58,7 @@ {foreach from=$aDocumentTypes item=oDocumentType name=doctypes} {capture assign=docid}{$oDocumentType->getId()}{/capture} -{$oDocumentType->getName()}{if (!$smarty.foreach.doctypes.last)}, {/if} +{$oDocumentType->getName()}{if (!$smarty.foreach.doctypes.last)}
{/if} {/foreach}