Commit d82791c08dc73a777e315bd232d8df7eea61ef1c

Authored by Michael Joseph
1 parent 237e244a

#3426 provisionally added folder and document counts


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2767 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/browseUI.inc
... ... @@ -212,7 +212,7 @@ function renderFolderResults($aResults, $bTemplateBrowsing = false) {
212 212 $sToRender .= "<td valign=\"bottom\">" . ($oCreator ? $oCreator->getName() : "&nbsp;") . "</td>";
213 213 // modified date (TODO: add to db)
214 214 $sToRender .= "<td valign=\"bottom\">&nbsp;</td>";
215   - // document type (??: display one of the mapped document types?)
  215 + // document type (??: display one of the mapped document types? which one?)
216 216 $sToRender .= "<td valign=\"bottom\">&nbsp;</td>";
217 217 $sToRender .= "</tr>\n";
218 218 }
... ... @@ -308,6 +308,18 @@ function renderDocumentList($aResults, $sNoDocumentsMessage, $sNoPermissionMessa
308 308 }
309 309  
310 310 /**
  311 + * #3426
  312 + * Appends folder and document counts to the last folder path
  313 + */
  314 +function appendCounts($aFolderPath, $iFolderCount, $iDocumentCount) {
  315 + // append to the last path component and return
  316 + $aFolderPath[count($aFolderPath)-1] = $aFolderPath[count($aFolderPath)-1] .
  317 + " ($iFolderCount folder" . ($iFolderCount > 1 ? "s" : "") .
  318 + ", $iDocumentCount document" . ($iDocumentCount > 1 ? "s" : "") . ")";
  319 + return $aFolderPath;
  320 +}
  321 +
  322 +/**
311 323 * Displays the browse page- lists folders and documents
312 324 *
313 325 * @param array the browse results to display
... ... @@ -326,7 +338,10 @@ function renderPage($aResults, $sBrowseType, $sSortBy, $sSortDirection, $bTempla
326 338  
327 339 $sToRender .= "<table border=\"0\" cellpadding=\"5\" width=\"100%\"><tr><td bgcolor=\"$sTDBGColour\">";
328 340 switch ($sBrowseType) {
329   - case "folder" : $sToRender .= displayFolderPathLink(Folder::getFolderPathAsArray($aResults["folders"][0]->getID()), Folder::getFolderPathNamesAsArray($aResults["folders"][0]->getID())); break;
  341 + case "folder" : $sToRender .= displayFolderPathLink(Folder::getFolderPathAsArray($aResults["folders"][0]->getID()),
  342 + appendCounts(Folder::getFolderPathNamesAsArray($aResults["folders"][0]->getID()),
  343 + count($aResults["folders"])-1,
  344 + count($aResults["documents"]))); break;
330 345 case "category" : $sToRender .= displayCategoryPathLink($aResults["categories"]); break;
331 346 case "documentType" : $sToRender .= displayDocumentTypePathLink($aResults["documentTypes"]); break;
332 347 }
... ...