Commit c99e712a11bd03dd1985300666f4a7ab00771551

Authored by Bryn Divey
1 parent b57433fa

These fixes bring us to 3.0.3rc1


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5422 c91229c3-7414-0410-bfa2-8a42b809f60b
browse.php
... ... @@ -418,7 +418,7 @@ class BrowseDispatcher extends KTStandardDispatcher {
418 418 $_SESSION["KTErrorMessage"][] = _kt("The following folders can not be moved") . ": " . $folderStr;
419 419 }
420 420 if (!empty($documentStr)) {
421   - $_SESSION["KTErrorMessage"][] = _kt("The following documents can not be moved") . ": " . $documentStr;
  421 + $_SESSION["KTErrorMessage"][] = _kt("The following documents can not be moved as they are either checked out, or controlled by a workflow") . ": " . $documentStr;
422 422 }
423 423 }
424 424  
... ...
lib/subscriptions/subscriptions.inc.php
... ... @@ -424,81 +424,82 @@ class SubscriptionEvent {
424 424 }
425 425 }
426 426 }
  427 +
427 428 function MoveDocument($oMovedDocument, $oToFolder, $oFromFolder) {
428 429 $content = new SubscriptionContent(); // needed for i18n
429   - // OK: two actions: document registrants, folder registrants.
  430 + // OK: two actions: document registrants, folder registrants.
430 431 $aUsers = $this->_getSubscribers($oMovedDocument->getId(), $this->subscriptionTypes["Document"]);
431   - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
432   - foreach ($aUsers as $oSubscriber) {
433   -
434   - // notification object first.
435   - $aNotificationOptions = array();
436   - $aNotificationOptions['target_user'] = $oSubscriber->getID();
437   - $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
438   - $aNotificationOptions['target_name'] = $oMovedDocument->getName();
439   - $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
440   - $aNotificationOptions['object_id'] = $oToFolder->getId(); // parent folder_id, in this case.
441   - $aNotificationOptions['event_type'] = "MovedDocument";
442   - $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
  432 + $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
  433 +
  434 + foreach ($aUsers as $oSubscriber) {
  435 + // notification object first.
  436 + $aNotificationOptions = array();
  437 + $aNotificationOptions['target_user'] = $oSubscriber->getID();
  438 + $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
  439 + $aNotificationOptions['target_name'] = $oMovedDocument->getName();
  440 + $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oToFolder->getId());
  441 + $aNotificationOptions['object_id'] = $oToFolder->getId(); // parent folder_id, in this case.
  442 + $aNotificationOptions['event_type'] = "MovedDocument";
  443 + $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
443 444  
444   - // now the email content.
445   - // FIXME this needs to be handled entirely within notifications from now on.
446   - if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
447   - $emailContent = $content->getEmailAlertContent($oNotification);
448   - $emailSubject = $content->getEmailAlertSubject($oNotification);
449   - $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);
450   - $oEmail->send();
451   - }
452   - }
  445 + // now the email content.
  446 + // FIXME this needs to be handled entirely within notifications from now on.
  447 + if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
  448 + $emailContent = $content->getEmailAlertContent($oNotification);
  449 + $emailSubject = $content->getEmailAlertSubject($oNotification);
  450 + $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);
  451 + $oEmail->send();
  452 + }
  453 + }
453 454  
454 455  
455 456 $aUsers = $this->_getSubscribers($oFromFolder->getId(), $this->subscriptionTypes["Folder"]);
456   - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
457   - foreach ($aUsers as $oSubscriber) {
458   -
459   - // notification object first.
460   - $aNotificationOptions = array();
461   - $aNotificationOptions['target_user'] = $oSubscriber->getID();
462   - $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
463   - $aNotificationOptions['target_name'] = $oMovedDocument->getName();
464   - $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
465   - $aNotificationOptions['object_id'] = $oToFolder->getId(); // parent folder_id, in this case.
466   - $aNotificationOptions['event_type'] = "MovedDocument";
467   - $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
468   -
469   - // now the email content.
470   - // FIXME this needs to be handled entirely within notifications from now on.
471   - if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
472   - $emailContent = $content->getEmailAlertContent($oNotification);
473   - $emailSubject = $content->getEmailAlertSubject($oNotification);
474   - $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);
475   - $oEmail->send();
476   - }
477   - }
478   -
  457 + $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
  458 + foreach ($aUsers as $oSubscriber) {
  459 +
  460 + // notification object first.
  461 + $aNotificationOptions = array();
  462 + $aNotificationOptions['target_user'] = $oSubscriber->getID();
  463 + $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
  464 + $aNotificationOptions['target_name'] = $oMovedDocument->getName();
  465 + $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
  466 + $aNotificationOptions['object_id'] = $oToFolder->getId(); // parent folder_id, in this case.
  467 + $aNotificationOptions['event_type'] = "MovedDocument";
  468 + $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
  469 +
  470 + // now the email content.
  471 + // FIXME this needs to be handled entirely within notifications from now on.
  472 + if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
  473 + $emailContent = $content->getEmailAlertContent($oNotification);
  474 + $emailSubject = $content->getEmailAlertSubject($oNotification);
  475 + $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);
  476 + $oEmail->send();
  477 + }
  478 + }
  479 +
479 480 $aUsers = $this->_getSubscribers($oToFolder->getId(), $this->subscriptionTypes["Folder"]);
480   - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
481   - foreach ($aUsers as $oSubscriber) {
482   -
483   - // notification object first.
484   - $aNotificationOptions = array();
485   - $aNotificationOptions['target_user'] = $oSubscriber->getID();
486   - $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
487   - $aNotificationOptions['target_name'] = $oMovedDocument->getName();
488   - $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
489   - $aNotificationOptions['object_id'] = $oToFolder->getId(); // parent folder_id, in this case.
490   - $aNotificationOptions['event_type'] = "MovedDocument";
491   - $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
492   -
493   - // now the email content.
494   - // FIXME this needs to be handled entirely within notifications from now on.
495   - if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
496   - $emailContent = $content->getEmailAlertContent($oNotification);
497   - $emailSubject = $content->getEmailAlertSubject($oNotification);
498   - $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);
499   - $oEmail->send();
500   - }
501   - }
  481 + $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
  482 + foreach ($aUsers as $oSubscriber) {
  483 +
  484 + // notification object first.
  485 + $aNotificationOptions = array();
  486 + $aNotificationOptions['target_user'] = $oSubscriber->getID();
  487 + $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
  488 + $aNotificationOptions['target_name'] = $oMovedDocument->getName();
  489 + $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
  490 + $aNotificationOptions['object_id'] = $oToFolder->getId(); // parent folder_id, in this case.
  491 + $aNotificationOptions['event_type'] = "MovedDocument";
  492 + $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
  493 +
  494 + // now the email content.
  495 + // FIXME this needs to be handled entirely within notifications from now on.
  496 + if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
  497 + $emailContent = $content->getEmailAlertContent($oNotification);
  498 + $emailSubject = $content->getEmailAlertSubject($oNotification);
  499 + $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);
  500 + $oEmail->send();
  501 + }
  502 + }
502 503 }
503 504 function ArchivedDocument($oModifiedDocument, $oParentFolder) {
504 505 $content = new SubscriptionContent(); // needed for i18n
... ...
plugins/ktcore/admin/groupManagement.php
... ... @@ -151,12 +151,23 @@ class KTGroupAdminDispatcher extends KTAdminDispatcher {
151 151 } else {
152 152 $oGroup->setUnitId($unit_id);
153 153 }
154   -
  154 +
155 155 $res = $oGroup->update();
156 156 if (($res == false) || (PEAR::isError($res))) { return $this->errorRedirectToMain(_kt('Failed to set group details.')); }
  157 +
  158 + if (!Permission::userIsSystemAdministrator($_SESSION['userID'])) {
  159 + $this->rollbackTransaction();
  160 + $this->errorRedirectTo('editGroup', _kt('For security purposes, you cannot remove your own administration priviledges.'), sprintf('group_id=%d', $oGroup->getId()));
  161 + exit(0);
  162 + }
  163 +
157 164  
158 165 $this->commitTransaction();
159   - $this->successRedirectToMain(_kt('Group details updated.'));
  166 + if($unit_id == 0 && $is_unitadmin) {
  167 + $this->successRedirectToMain(_kt('Group details updated.') . _kt(' Note: group is set as unit administrator, but is not assigned to a unit.'));
  168 + } else {
  169 + $this->successRedirectToMain(_kt('Group details updated.'));
  170 + }
160 171 }
161 172 // }}}
162 173  
... ... @@ -309,6 +320,12 @@ class KTGroupAdminDispatcher extends KTAdminDispatcher {
309 320 $msg = '';
310 321 if (!empty($usersAdded)) { $msg .= ' ' . _kt('Added') . ': ' . join(', ', $usersAdded) . ', <br />'; }
311 322 if (!empty($usersRemoved)) { $msg .= ' ' . _kt('Removed') . ': ' . join(', ',$usersRemoved) . '.'; }
  323 +
  324 + if (!Permission::userIsSystemAdministrator($_SESSION['userID'])) {
  325 + $this->rollbackTransaction();
  326 + $this->errorRedirectTo('manageUsers', _kt('For security purposes, you cannot remove your own administration priviledges.'), sprintf('group_id=%d', $oGroup->getId()));
  327 + exit(0);
  328 + }
312 329  
313 330 $this->commitTransaction();
314 331 $this->successRedirectToMain($msg);
... ... @@ -504,7 +521,12 @@ class KTGroupAdminDispatcher extends KTAdminDispatcher {
504 521 //if (($res == false) || (PEAR::isError($res))) { return $this->errorRedirectToMain('Failed to create group "' . $group_name . '"'); }
505 522 // do i need to "create"
506 523 $this->commitTransaction();
507   - $this->successRedirectToMain(sprintf(_kt('Group "%s" created.'), $group_name));
  524 +
  525 + if($unit_id == 0 && $is_unitadmin) {
  526 + $this->successRedirectToMain(sprintf(_kt('Group "%s" created.'), $group_name) . _kt(' Note: group is set as unit administrator, but is not assigned to a unit.'));
  527 + } else {
  528 + $this->successRedirectToMain(sprintf(_kt('Group "%s" created.'), $group_name));
  529 + }
508 530 }
509 531 // }}}
510 532  
... ...
plugins/ktcore/admin/userManagement.php
... ... @@ -556,6 +556,13 @@ var $sHelpPage = &#39;ktcore/admin/manage users.html&#39;;
556 556 $msg = '';
557 557 if (!empty($groupsAdded)) { $msg .= ' ' . _kt('Added to groups') . ': ' . implode(', ', $groupsAdded) . ' <br />'; }
558 558 if (!empty($groupsRemoved)) { $msg .= ' ' . _kt('Removed from groups') . ': ' . implode(', ',$groupsRemoved) . '.'; }
  559 +
  560 + if (!Permission::userIsSystemAdministrator($_SESSION['userID'])) {
  561 + $this->rollbackTransaction();
  562 + $this->errorRedirectTo('editgroups', _kt('For security purposes, you cannot remove your own administration priviledges.'), sprintf('user_id=%d', $oUser->getId()));
  563 + exit(0);
  564 + }
  565 +
559 566  
560 567 $this->commitTransaction();
561 568 $this->successRedirectToMain($msg);
... ...
templates/ktcore/metadata/listFieldsets.smarty
... ... @@ -43,7 +43,7 @@
43 43 {if $aFields}
44 44  
45 45 {foreach from=$aFields item=oField name=fields}
46   -{$oField->getName()}{if (!$smarty.foreach.fields.last)}, {/if}
  46 +{$oField->getName()}{if (!$smarty.foreach.fields.last)}<br/> {/if}
47 47 {/foreach}
48 48  
49 49 {else}
... ... @@ -58,7 +58,7 @@
58 58 {foreach from=$aDocumentTypes item=oDocumentType name=doctypes}
59 59  
60 60 {capture assign=docid}{$oDocumentType->getId()}{/capture}
61   -<a href="{ktLink base="admin.php" subpath="/documents/typemanagement" query="action=edit&fDocumentTypeId=`$docid`"}">{$oDocumentType->getName()}</a>{if (!$smarty.foreach.doctypes.last)}, {/if}
  61 +<a href="{ktLink base="admin.php" subpath="/documents/typemanagement" query="action=edit&fDocumentTypeId=`$docid`"}">{$oDocumentType->getName()}</a>{if (!$smarty.foreach.doctypes.last)}<br/> {/if}
62 62  
63 63 {/foreach}
64 64  
... ...