Commit bde984981549b485e0b463196583f971a1d94108

Authored by nbm
1 parent 63aa2640

Make the TitleColumn class easier to inherit from and override tiny bits

of the functionality.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4086 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/browse/BrowseColumns.inc.php
... ... @@ -50,6 +50,10 @@ class BrowseColumn {
50 50 }
51 51  
52 52 class TitleColumn extends BrowseColumn {
  53 + var $aOptions = array();
  54 + function setOptions($aOptions) {
  55 + $this->aOptions = $aOptions;
  56 + }
53 57 // unlike others, this DOESN'T give its name.
54 58 function renderHeader($sReturnURL) {
55 59 $text = "Title";
... ... @@ -59,22 +63,41 @@ class TitleColumn extends BrowseColumn {
59 63 return '<a href="' . $href . '">'.$text.'</a>';
60 64  
61 65 }
  66 +
  67 + function renderFolderLink($aDataRow) {
  68 + $outStr = '<a href="' . $this->buildFolderLink($aDataRow) . '">';
  69 + $outStr .= $aDataRow["folder"]->getName();
  70 + $outStr .= '</a>';
  71 + return $outStr;
  72 + }
  73 +
  74 + function renderDocumentLink($aDataRow) {
  75 + $outStr = '<a href="' . $this->buildDocumentLink($aDataRow) . '" title="' . $aDataRow["document"]->getFilename().'">';
  76 + $outStr .= $aDataRow["document"]->getName();
  77 + $outStr .= '</a>';
  78 + return $outStr;
  79 + }
  80 +
  81 + function buildDocumentLink($aDataRow) {
  82 + $baseurl = KTUtil::arrayGet($this->aOptions, "documenturl", "documentmanagement/view.php");
  83 + return $baseurl . '?fDocumentId=' . $aDataRow["document"]->getId();
  84 + }
  85 +
  86 + function buildFolderLink($aDataRow) {
  87 + $baseurl = KTUtil::arrayGet($this->aOptions, "folderurl", "");
  88 + return $baseurl . '?fFolderId='.$aDataRow["folder"]->getId();
  89 + }
62 90  
63 91 // use inline, since its just too heavy to even _think_ about using smarty.
64 92 function renderData($aDataRow) {
65 93 $outStr = '';
66 94 if ($aDataRow["type"] == "folder") {
67 95 $outStr .= '<span class="contenttype folder">';
68   - $outStr .= '<a href="?fFolderId='.$aDataRow["folder"]->getId().'">';
69   - $outStr .= $aDataRow["folder"]->getName();
70   - $outStr .= '</a>';
  96 + $outStr .= $this->renderFolderLink($aDataRow);
71 97 $outStr .= '</span>';
72 98 } else {
73 99 $outStr .= '<span class="contenttype '.$this->_mimeHelper($aDataRow["document"]->getMimeTypeId()).'">';
74   - $outStr .= '<a href="documentmanagement/view.php?fDocumentId='.$aDataRow["document"]->getId().'" title="'.$aDataRow["document"]->getFilename().'">';
75   - $outStr .= $aDataRow["document"]->getName();
76   -
77   - $outStr .= '</a>';
  100 + $outStr .= $this->renderDocumentLink($aDataRow);
78 101 $outStr .= ' (' . $this->prettySize($aDataRow["document"]->getSize()) . ')';
79 102 $outStr .= '</span>';
80 103 }
... ... @@ -185,4 +208,4 @@ class SelectionColumn extends BrowseColumn {
185 208 }
186 209 }
187 210  
188   -?>
189 211 \ No newline at end of file
  212 +?>
... ...