Commit ecbdc085361089bf05bd74767365b52c915d0f26

Authored by Michael Joseph
1 parent 63d59b7d

(#2778) don't allow a document to be deleted if its checked out


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2399 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc
@@ -336,13 +336,24 @@ function renderNonEditableLinkedDocuments($oDocument) { @@ -336,13 +336,24 @@ function renderNonEditableLinkedDocuments($oDocument) {
336 return $sToRender; 336 return $sToRender;
337 } 337 }
338 338
  339 +function displayButton($sControllerLink, $sQueryString, $sImageName, $bActive, $sInactiveTooltip = "") {
  340 + $sImage = "<img border=\"0\" src=\"$default->graphicsUrl/widgets/docactions/";
  341 + if ($bActive) {
  342 + $sImage .= "$sImageName.gif\"";
  343 + } else {
  344 + $sImage .= "disabled-$sImageName.gif\" alt=\"$sInactiveTooltip\"";
  345 + }
  346 + $sImage .= "/>";
  347 + return generateControllerLink($sControllerLink, $sQueryString, $sImage);
  348 +}
  349 +
339 function displayActionButtons($oDocument, $bEdit) { 350 function displayActionButtons($oDocument, $bEdit) {
340 global $default; 351 global $default;
341 352
342 $iDummyButtons = 2; 353 $iDummyButtons = 2;
343 354
344 // view 355 // view
345 - $sToRender .= "<tr><td align=\"left\"><a onClick=\"alert('This will download a copy of the document and is not the same as Checking Out a document. Changes to this downloaded file will not be managed in the DMS.'); return true;\" href=\"" . generateControllerLink("downloadDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/view.gif\" border=\"0\" /></a></td></tr>\n"; 356 + $sToRender .= "<tr><td align=\"left\"><a onClick=\"alert('This will download a copy of the document and is not the same as Checking Out a document. Changes to this downloaded file will not be managed in the DMS.'); return true;\" href=\"" . generateControllerLink("downloadDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/view.gif\" border=\"0\" alt=\"View the document\"/></a></td></tr>\n";
346 if ($bEdit) { 357 if ($bEdit) {
347 // display the check in button if the document is checked out and you checked the document out 358 // display the check in button if the document is checked out and you checked the document out
348 if ($oDocument->getIsCheckedOut() && ($oDocument->getCheckedOutUserID() == $_SESSION["userID"])) { 359 if ($oDocument->getIsCheckedOut() && ($oDocument->getCheckedOutUserID() == $_SESSION["userID"])) {
@@ -357,7 +368,7 @@ function displayActionButtons($oDocument, $bEdit) { @@ -357,7 +368,7 @@ function displayActionButtons($oDocument, $bEdit) {
357 } 368 }
358 369
359 $sToRender .= "<tr><td align=\"left\"><a href=\"" . generateControllerLink("emailDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/email.gif\" border=\"0\" /></a></td></tr>\n"; 370 $sToRender .= "<tr><td align=\"left\"><a href=\"" . generateControllerLink("emailDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/email.gif\" border=\"0\" /></a></td></tr>\n";
360 - if ($bEdit) { 371 + if ($bEdit && !$oDocument->getIsCheckedOut()) {
361 $sToRender .= "<tr><td align=\"left\"><a href=\"" . generateControllerLink("deleteDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/delete.gif\" border=\"0\" /></a></td></tr>\n"; 372 $sToRender .= "<tr><td align=\"left\"><a href=\"" . generateControllerLink("deleteDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/delete.gif\" border=\"0\" /></a></td></tr>\n";
362 } else { 373 } else {
363 $iDummyButtons++; 374 $iDummyButtons++;