Commit 1db37d4cf8a13418698db367e4046e633acf7d76

Authored by Brad Shuttleworth
1 parent cec56dac

fix for KTS-185


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4681 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 11 additions and 30 deletions
edit.php
... ... @@ -53,38 +53,13 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher {
53 53 }
54 54  
55 55 function addBreadcrumbs() {
56   - $folder_id = $this->oDocument->getFolderId(); // conveniently, will be 0 if not possible.
57   - if ($folder_id == 0) { $folder_id = 1; }
58 56  
59   - // here we need the folder object to do the breadcrumbs.
60   - $oFolder =& Folder::get($folder_id);
61   - if (PEAR::isError($oFolder)) {
62   - $this->oPage->addError(_("invalid folder"));
63   - $folder_id = 1;
64   - $oFolder =& Folder::get($folder_id);
65   - }
66   -
67   - // do the breadcrumbs.
68   -
69   - // skip root.
70   - $folder_path_names = array_slice($oFolder->getPathArray(), 1);
71   - $folder_path_ids = array_slice(explode(',', $oFolder->getParentFolderIds()), 1);
72   -
73   - $parents = count($folder_path_ids);
74   -
75   - if ($parents != 0) {
76   - foreach (range(0,$parents) as $index) {
77   - $this->aBreadcrumbs[] = array("url" => KTBrowseUtil::getUrlForFolder($folder_path_ids[$index]), "name" => $folder_path_names[$index]);
78   - }
79   - }
  57 + $aOptions = array(
  58 + "documentaction" => "editDocument",
  59 + "folderaction" => "browse",
  60 + );
80 61  
81   - // now add this folder, _if we aren't in 1_.
82   - if ($folder_id != 1) {
83   - $this->aBreadcrumbs[] = array("url" => KTBrowseUtil::getUrlForFolder($folder_id), "name" => $oFolder->getName());
84   - }
85   -
86   - // now add the document
87   - $this->aBreadcrumbs[] = array("name" => $this->oDocument->getName());
  62 + $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForDocument($this->oDocument, $aOptions));
88 63 }
89 64  
90 65 function errorPage($errorMessage) {
... ... @@ -93,6 +68,7 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher {
93 68 }
94 69  
95 70 function do_selectType() {
  71 +
96 72 $document_id = KTUtil::arrayGet($_REQUEST, 'fDocumentId');
97 73 if (empty($document_id)) {
98 74 $this->errorPage(_("No document specified for editing."));
... ... @@ -102,6 +78,11 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher {
102 78 $this->errorPage(_("Invalid Document."));
103 79 }
104 80  
  81 + $this->oDocument = $oDocument;
  82 +
  83 + $this->addBreadcrumbs();
  84 + $this->oPage->setBreadcrumbDetails(_('Change Document Type'));
  85 +
105 86 $oDocumentType = DocumentType::get($oDocument->getDocumentTypeID());
106 87 $aDocTypes = DocumentType::getList();
107 88  
... ...