Commit 83878ccb994156997092f0f06160899b88d26d1b

Authored by Michael Joseph
1 parent ae64315d

added optional template browsing support


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2764 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/browseUI.inc
... ... @@ -192,7 +192,7 @@ function renderDocumentTypeResults($aResults) {
192 192 *
193 193 * @param array the browse result objects
194 194 */
195   -function renderFolderResults($aResults) {
  195 +function renderFolderResults($aResults, $bTemplateBrowsing = false) {
196 196 global $default, $browse_no_sub_folders, $browse_no_documents, $browse_no_document_permission;
197 197 $sToRender = "";
198 198  
... ... @@ -220,7 +220,7 @@ function renderFolderResults($aResults) {
220 220 $sToRender .= "<tr><td colspan=\"5\">" . $browse_no_sub_folders . "</td></tr>";
221 221 }
222 222  
223   - $sToRender .= "<tr><td>" . renderDocumentList($aResults, $browse_no_documents, $browse_no_document_permission) . "</td></tr>\n";
  223 + $sToRender .= "<tr><td>" . renderDocumentList($aResults, $browse_no_documents, $browse_no_document_permission, false, $bTemplateBrowsing) . "</td></tr>\n";
224 224  
225 225 return $sToRender;
226 226 }
... ... @@ -277,7 +277,7 @@ function renderSortHeadings($sSortBy, $sSortDirection) {
277 277 * @param string the message to display if the current user doesn't have permission to view the documents
278 278 * @param boolean whether to display the complete path to the document or not
279 279 */
280   -function renderDocumentList($aResults, $sNoDocumentsMessage, $sNoPermissionMessage, $bDisplayFullPath = false) {
  280 +function renderDocumentList($aResults, $sNoDocumentsMessage, $sNoPermissionMessage, $bDisplayFullPath = false, $bTemplateBrowsing = false) {
281 281 global $default;
282 282  
283 283 $iFolderCount = count($aResults["folders"]) - 1;
... ... @@ -286,7 +286,8 @@ function renderDocumentList($aResults, $sNoDocumentsMessage, $sNoPermissionMessa
286 286 for ($i=0; $i<count($aResults["documents"]); $i++) {
287 287 // in order for candy striping to work we need to take the number of folders
288 288 // into account when alternating
289   - $sToRender .= "<tr bgcolor=\"" . getColour($i+$iFolderCount) . "\" width=\"100%\"><td valign=\"bottom\">" . displayDocumentLink($aResults["documents"][$i], $bDisplayFullPath) . "</td>";
  289 + $sToRender .= "<tr bgcolor=\"" . getColour($i+$iFolderCount) . "\" width=\"100%\"><td valign=\"bottom\">" . ($bTemplateBrowsing ? displayDocumentLinkForTemplateBrowsing($aResults["documents"][$i], $bDisplayFullPath) : displayDocumentLink($aResults["documents"][$i], $bDisplayFullPath)) . "</td>";
  290 +
290 291 $sToRender .= "<td valign=\"bottom\">" . $aResults["documents"][$i]->getFileName() . "</td>";
291 292 $oCreator = User::get($aResults["documents"][$i]->getCreatorID());
292 293 $sToRender .= "<td valign=\"bottom\">" . ($oCreator ? $oCreator->getName() : "") . "</td>";
... ... @@ -314,7 +315,8 @@ function renderDocumentList($aResults, $sNoDocumentsMessage, $sNoPermissionMessa
314 315 * @param string the field to sort the results by
315 316 * @param string the direction to sort
316 317 */
317   -function renderPage($aResults, $sBrowseType, $sSortBy, $sSortDirection) {
  318 +
  319 +function renderPage($aResults, $sBrowseType, $sSortBy, $sSortDirection, $bTemplateBrowsing = false) {
318 320 global $default, $browse_collection_heading;
319 321  
320 322 $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
... ... @@ -340,7 +342,7 @@ function renderPage($aResults, $sBrowseType, $sSortBy, $sSortDirection) {
340 342 $sToRender .= renderSortHeadings($sSortBy, $sSortDirection);
341 343 $sToRender .= "<tr><td>\n";
342 344 switch ($sBrowseType) {
343   - case "folder" : $sToRender .= renderFolderResults($aResults, $sSortBy, $sSortDirection); break;
  345 + case "folder" : $sToRender .= renderFolderResults($aResults, $sSortBy, $sSortDirection, $bTemplateBrowsing); break;
344 346 case "category" : $sToRender .= renderCategoryResults($aResults); break;
345 347 case "documentType" : $sToRender .= renderDocumentTypeResults($aResults); break;
346 348 }
... ...