From abaa5f663a6f2441791e6df603bb6de1ce64894c Mon Sep 17 00:00:00 2001 From: Conrad Vermeulen Date: Fri, 15 Aug 2008 11:00:08 +0000 Subject: [PATCH] KTS-3624 "Once a doc in the DroppedDocuments folder is checked-out and checked back in from there it appears twice on the 'My Dropped Documents' dashlet on the Dashboard." Fixed. Problem appears because code was looking at transactions table only not taking into consideration that they had been listed before. This plugin could be cleaned up some more. --- plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php | 51 +++++++++++++++++++-------------------------------- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php b/plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php index 97bffde..6732d84 100644 --- a/plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php +++ b/plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php @@ -249,7 +249,6 @@ class MyDropDocumentsPage extends KTStandardDispatcher { } $maxcount = 5; - $aDocumentTransactions = array_slice($aDocumentTransactions, 0, $maxcount); $sReturnTable = ''._kt('Recently Dropped Documents').' @@ -264,52 +263,40 @@ class MyDropDocumentsPage extends KTStandardDispatcher { $sOddorEven = ''; $count = 1; + $rendered = array(); foreach ($aDocumentTransactions as $aRow) { - $oDocument = Document::get($aRow[document_id]); - $aParentFolders = explode('/',$oDocument->getFullPath()); - $sPath = ''; + $documentId = $aRow['document_id']; + if (in_array($documentId, $rendered)) + { + continue; + } - for($i = 0; $i < count($aParentFolders); $i++) - { - if ($i > 2) - { - $sPath .= '/'.$aParentFolders[$i]; - } - } + $rendered[] = $documentId; + $oDocument = Document::get($documentId); $sContentType = KTMime::getIconPath($oDocument->getMimeTypeID()); - $aAnchorData = $this->getDocInfo($aRow[document_id]); + $aAnchorData = $this->getDocInfo($documentId); $sLink = $aAnchorData[0]; $sDocName = $aAnchorData[1]; - $sShortDocName = $sDocName; - if(strlen($sPath) > 0) - { - $sDocName = $sPath.'/'.$sDocName; - } - $sFullDocName = $sDocName; $iDocLength = strlen($sDocName); - if ( $iDocLength > 30 ) + $iMax = 40; + if ( $iDocLength > $iMax ) { - $sDocName = substr($sDocName, ($iDocLength - 30), $iDocLength); - $sDocName = '...'.$sDocName; + $sShortDocName = substr($sDocName, 0, $iMax) . '...'; } - if($count%2 == 0) - { - $sOddorEven = 'even'; - } - else - { - $sOddorEven = 'odd'; - } + $sOddorEven = ($count%2 == 0)?'even':'odd'; $sReturnTable .= ''. - ''. - ''. + ''. + ''. ''; - $count ++; + if (++$count > 5) + { + break; + } } $location = 'browse.php?fFolderId='.$iMyDocsFolderID; -- libgit2 0.21.4
'.$sDocName.''.$aRow[datetime].''.$sShortDocName.''.$aRow['datetime'].'