Commit cc6e5c8067543455e567f56de89c2b9f2d691de9

Authored by nbm
1 parent bd675621

Use breadcrumbsForDocument instead of local (and broken) version.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4150 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/view.php
... ... @@ -38,41 +38,6 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
38 38 $this->oPage->addPortlet($oPortlet);
39 39 }
40 40  
41   - function addBreadcrumbs() {
42   - $folder_id = $this->oDocument->getFolderId(); // conveniently, will be 0 if not possible.
43   - if ($folder_id == 0) { $folder_id = 1; }
44   -
45   - // here we need the folder object to do the breadcrumbs.
46   - $oFolder =& Folder::get($folder_id);
47   - if (PEAR::isError($oFolder)) {
48   - $this->oPage->addError("invalid folder");
49   - $folder_id = 1;
50   - $oFolder =& Folder::get($folder_id);
51   - }
52   -
53   - // do the breadcrumbs.
54   -
55   - // skip root.
56   - $folder_path_names = array_slice($oFolder->getPathArray(), 1);
57   - $folder_path_ids = array_slice(explode(',', $oFolder->getParentFolderIds()), 1);
58   -
59   - $parents = count($folder_path_ids);
60   -
61   - if ($parents != 0) {
62   - foreach (range(0,$parents) as $index) {
63   - $this->aBreadcrumbs[] = array("url" => "../browse.php?fFolderId=" . $folder_path_ids[$index], "name" => $folder_path_names[$index]);
64   - }
65   - }
66   -
67   - // now add this folder, _if we aren't in 1_.
68   - if ($folder_id != 1) {
69   - $this->aBreadcrumbs[] = array("url" => "../browse.php?fFolderId=" . $folder_id, "name" => $oFolder->getName());
70   - }
71   -
72   - // now add the document
73   - $this->aBreadcrumbs[] = array("name" => $this->oDocument->getName());
74   - }
75   -
76 41 function do_main() {
77 42 // fix legacy, broken items.
78 43 if (KTUtil::arrayGet($_REQUEST, "fDocumentID", true) !== true) {
... ... @@ -101,7 +66,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
101 66 }
102 67  
103 68 $this->oDocument =& $oDocument;
104   - $this->addBreadcrumbs();
  69 + $this->aBreadcrumbs += KTBrowseUtil::breadcrumbsForDocument($oDocument);
105 70 $this->oPage->setBreadcrumbDetails("document details");
106 71 $this->addPortlets("Document Details");
107 72  
... ... @@ -179,7 +144,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
179 144 // fixme check perms
180 145  
181 146 $this->oDocument =& $oDocument;
182   - $this->addBreadcrumbs();
  147 + $this->aBreadcrumbs += KTBrowseUtil::breadcrumbsForDocument($oDocument);
183 148 $this->oPage->setBreadcrumbDetails("history");
184 149 $this->addPortlets("History");
185 150  
... ... @@ -240,7 +205,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
240 205 return $this->do_error();
241 206 }
242 207 $this->oDocument =& $oDocument;
243   - $this->addBreadcrumbs();
  208 + $this->aBreadcrumbs += KTBrowseUtil::breadcrumbsForDocument($oDocument);
244 209 $this->oPage->setBreadcrumbDetails("compare versions");
245 210  
246 211 $comparison_version = KTUtil::arrayGet($_REQUEST, 'fComparisonVersion');
... ...