From bde984981549b485e0b463196583f971a1d94108 Mon Sep 17 00:00:00 2001 From: nbm Date: Mon, 21 Nov 2005 13:56:33 +0000 Subject: [PATCH] Make the TitleColumn class easier to inherit from and override tiny bits of the functionality. --- lib/browse/BrowseColumns.inc.php | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/lib/browse/BrowseColumns.inc.php b/lib/browse/BrowseColumns.inc.php index 8349e84..da0dd01 100644 --- a/lib/browse/BrowseColumns.inc.php +++ b/lib/browse/BrowseColumns.inc.php @@ -50,6 +50,10 @@ class BrowseColumn { } class TitleColumn extends BrowseColumn { + var $aOptions = array(); + function setOptions($aOptions) { + $this->aOptions = $aOptions; + } // unlike others, this DOESN'T give its name. function renderHeader($sReturnURL) { $text = "Title"; @@ -59,22 +63,41 @@ class TitleColumn extends BrowseColumn { return ''.$text.''; } + + function renderFolderLink($aDataRow) { + $outStr = ''; + $outStr .= $aDataRow["folder"]->getName(); + $outStr .= ''; + return $outStr; + } + + function renderDocumentLink($aDataRow) { + $outStr = 'getFilename().'">'; + $outStr .= $aDataRow["document"]->getName(); + $outStr .= ''; + return $outStr; + } + + function buildDocumentLink($aDataRow) { + $baseurl = KTUtil::arrayGet($this->aOptions, "documenturl", "documentmanagement/view.php"); + return $baseurl . '?fDocumentId=' . $aDataRow["document"]->getId(); + } + + function buildFolderLink($aDataRow) { + $baseurl = KTUtil::arrayGet($this->aOptions, "folderurl", ""); + return $baseurl . '?fFolderId='.$aDataRow["folder"]->getId(); + } // use inline, since its just too heavy to even _think_ about using smarty. function renderData($aDataRow) { $outStr = ''; if ($aDataRow["type"] == "folder") { $outStr .= ''; - $outStr .= 'getId().'">'; - $outStr .= $aDataRow["folder"]->getName(); - $outStr .= ''; + $outStr .= $this->renderFolderLink($aDataRow); $outStr .= ''; } else { $outStr .= 'getMimeTypeId()).'">'; - $outStr .= 'getId().'" title="'.$aDataRow["document"]->getFilename().'">'; - $outStr .= $aDataRow["document"]->getName(); - - $outStr .= ''; + $outStr .= $this->renderDocumentLink($aDataRow); $outStr .= ' (' . $this->prettySize($aDataRow["document"]->getSize()) . ')'; $outStr .= ''; } @@ -185,4 +208,4 @@ class SelectionColumn extends BrowseColumn { } } -?> \ No newline at end of file +?> -- libgit2 0.21.4