Commit c30a132d8a0c9ab99f601a102bf21c23689e3caa

Authored by kevin_fourie
1 parent 330fdac7

Merged in from STABLE trunk...

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.

Committed By: Conrad Vermeulen
Reviewed By: Megan Waston


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.5.3-Release-Branch@9182 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php
@@ -249,7 +249,6 @@ class MyDropDocumentsPage extends KTStandardDispatcher { @@ -249,7 +249,6 @@ class MyDropDocumentsPage extends KTStandardDispatcher {
249 } 249 }
250 250
251 $maxcount = 5; 251 $maxcount = 5;
252 - $aDocumentTransactions = array_slice($aDocumentTransactions, 0, $maxcount);  
253 252
254 $sReturnTable = '<span class="descriptiveText">'._kt('Recently Dropped Documents').'</span> 253 $sReturnTable = '<span class="descriptiveText">'._kt('Recently Dropped Documents').'</span>
255 <table width="100%" class="kt_collection drop_box" cellspacing="0"> 254 <table width="100%" class="kt_collection drop_box" cellspacing="0">
@@ -264,52 +263,40 @@ class MyDropDocumentsPage extends KTStandardDispatcher { @@ -264,52 +263,40 @@ class MyDropDocumentsPage extends KTStandardDispatcher {
264 263
265 $sOddorEven = ''; 264 $sOddorEven = '';
266 $count = 1; 265 $count = 1;
  266 + $rendered = array();
267 foreach ($aDocumentTransactions as $aRow) 267 foreach ($aDocumentTransactions as $aRow)
268 { 268 {
269 - $oDocument = Document::get($aRow[document_id]);  
270 - $aParentFolders = explode('/',$oDocument->getFullPath());  
271 - $sPath = ''; 269 + $documentId = $aRow['document_id'];
  270 + if (in_array($documentId, $rendered))
  271 + {
  272 + continue;
  273 + }
272 274
273 - for($i = 0; $i < count($aParentFolders); $i++)  
274 - {  
275 - if ($i > 2)  
276 - {  
277 - $sPath .= '/'.$aParentFolders[$i];  
278 - }  
279 - } 275 + $rendered[] = $documentId;
  276 + $oDocument = Document::get($documentId);
280 277
281 $sContentType = KTMime::getIconPath($oDocument->getMimeTypeID()); 278 $sContentType = KTMime::getIconPath($oDocument->getMimeTypeID());
282 - $aAnchorData = $this->getDocInfo($aRow[document_id]); 279 + $aAnchorData = $this->getDocInfo($documentId);
283 $sLink = $aAnchorData[0]; 280 $sLink = $aAnchorData[0];
284 $sDocName = $aAnchorData[1]; 281 $sDocName = $aAnchorData[1];
285 - $sShortDocName = $sDocName;  
286 - if(strlen($sPath) > 0)  
287 - {  
288 - $sDocName = $sPath.'/'.$sDocName;  
289 - }  
290 282
291 - $sFullDocName = $sDocName;  
292 $iDocLength = strlen($sDocName); 283 $iDocLength = strlen($sDocName);
293 - if ( $iDocLength > 30 ) 284 + $iMax = 40;
  285 + if ( $iDocLength > $iMax )
294 { 286 {
295 - $sDocName = substr($sDocName, ($iDocLength - 30), $iDocLength);  
296 - $sDocName = '...'.$sDocName; 287 + $sShortDocName = substr($sDocName, 0, $iMax) . '...';
297 } 288 }
298 289
299 - if($count%2 == 0)  
300 - {  
301 - $sOddorEven = 'even';  
302 - }  
303 - else  
304 - {  
305 - $sOddorEven = 'odd';  
306 - } 290 + $sOddorEven = ($count%2 == 0)?'even':'odd';
307 291
308 $sReturnTable .= '<tr class="'.$sOddorEven.'">'. 292 $sReturnTable .= '<tr class="'.$sOddorEven.'">'.
309 - '<td width="100%"><span class="contenttype '.$sContentType.'"><a title="'.$sShortDocName.'" href='.$sLink.'>'.$sDocName.'</a></span></td>'.  
310 - '<td width="1%">'.$aRow[datetime].'</td>'. 293 + '<td width="100%"><span class="contenttype '.$sContentType.'"><a title="'.$sDocName.'" href='.$sLink.'>'.$sShortDocName.'</a></span></td>'.
  294 + '<td width="1%">'.$aRow['datetime'].'</td>'.
311 '</tr>'; 295 '</tr>';
312 - $count ++; 296 + if (++$count > 5)
  297 + {
  298 + break;
  299 + }
313 } 300 }
314 301
315 $location = 'browse.php?fFolderId='.$iMyDocsFolderID; 302 $location = 'browse.php?fFolderId='.$iMyDocsFolderID;