Commit dd53a1d5c0f330f1daf7ad556cc62b0ed35666d2
1 parent
c9355a8e
Reindent
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5673 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
377 additions
and
382 deletions
view.php
| ... | ... | @@ -54,8 +54,8 @@ require_once(KT_LIB_DIR . "/browse/browseutil.inc.php"); |
| 54 | 54 | class ViewDocumentDispatcher extends KTStandardDispatcher { |
| 55 | 55 | |
| 56 | 56 | var $sSection = "view_details"; |
| 57 | - var $sHelpPage = 'ktcore/browse.html'; | |
| 58 | - | |
| 57 | + var $sHelpPage = 'ktcore/browse.html'; | |
| 58 | + | |
| 59 | 59 | var $actions; |
| 60 | 60 | |
| 61 | 61 | function ViewDocumentDispatcher() { |
| ... | ... | @@ -65,467 +65,462 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { |
| 65 | 65 | |
| 66 | 66 | parent::KTStandardDispatcher(); |
| 67 | 67 | } |
| 68 | - | |
| 69 | - function check() { | |
| 70 | - if (!parent::check()) { return false; } | |
| 71 | - | |
| 72 | - | |
| 73 | - | |
| 74 | - return true; | |
| 75 | - } | |
| 76 | - | |
| 68 | + | |
| 69 | + function check() { | |
| 70 | + if (!parent::check()) { return false; } | |
| 71 | + return true; | |
| 72 | + } | |
| 73 | + | |
| 77 | 74 | // FIXME identify the current location somehow. |
| 78 | 75 | function addPortlets($currentaction = null) { |
| 79 | - $this->actions = KTDocumentActionUtil::getDocumentActionsForDocument($this->oDocument, $this->oUser); | |
| 80 | - $oPortlet = new KTActionPortlet(_kt("Document Actions")); | |
| 81 | - $oPortlet->setActions($this->actions, $currentaction); | |
| 82 | - $this->oPage->addPortlet($oPortlet); | |
| 83 | - } | |
| 84 | - | |
| 76 | + $this->actions = KTDocumentActionUtil::getDocumentActionsForDocument($this->oDocument, $this->oUser); | |
| 77 | + $oPortlet = new KTActionPortlet(_kt("Document Actions")); | |
| 78 | + $oPortlet->setActions($this->actions, $currentaction); | |
| 79 | + $this->oPage->addPortlet($oPortlet); | |
| 80 | + } | |
| 81 | + | |
| 85 | 82 | function do_main() { |
| 86 | - // fix legacy, broken items. | |
| 87 | - if (KTUtil::arrayGet($_REQUEST, "fDocumentID", true) !== true) { | |
| 83 | + // fix legacy, broken items. | |
| 84 | + if (KTUtil::arrayGet($_REQUEST, "fDocumentID", true) !== true) { | |
| 88 | 85 | $_REQUEST["fDocumentId"] = KTUtil::arrayGet($_REQUEST, "fDocumentID"); |
| 89 | - unset($_REQUEST["fDocumentID"]); | |
| 90 | - } | |
| 91 | - | |
| 92 | - $document_data = array(); | |
| 93 | - $document_id = KTUtil::arrayGet($_REQUEST, 'fDocumentId'); | |
| 94 | - if ($document_id === null) { | |
| 95 | - $this->oPage->addError('No document was requested. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 96 | - return $this->do_error(); | |
| 97 | - } | |
| 98 | - // try get the document. | |
| 99 | - $oDocument =& Document::get($document_id); | |
| 100 | - if (PEAR::isError($oDocument)) { | |
| 101 | - $this->oPage->addError('The document you attempted to retrieve is invalid. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 102 | - return $this->do_error(); | |
| 103 | - } | |
| 104 | - $document_id = $oDocument->getId(); | |
| 105 | - $document_data["document_id"] = $oDocument->getId(); | |
| 106 | - | |
| 86 | + unset($_REQUEST["fDocumentID"]); | |
| 87 | + } | |
| 88 | + | |
| 89 | + $document_data = array(); | |
| 90 | + $document_id = KTUtil::arrayGet($_REQUEST, 'fDocumentId'); | |
| 91 | + if ($document_id === null) { | |
| 92 | + $this->oPage->addError('No document was requested. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 93 | + return $this->do_error(); | |
| 94 | + } | |
| 95 | + // try get the document. | |
| 96 | + $oDocument =& Document::get($document_id); | |
| 97 | + if (PEAR::isError($oDocument)) { | |
| 98 | + $this->oPage->addError('The document you attempted to retrieve is invalid. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 99 | + return $this->do_error(); | |
| 100 | + } | |
| 101 | + $document_id = $oDocument->getId(); | |
| 102 | + $document_data["document_id"] = $oDocument->getId(); | |
| 103 | + | |
| 107 | 104 | |
| 108 | 105 | if (!KTBrowseUtil::inAdminMode($this->oUser, $oDocument->getFolderId())) { |
| 109 | - if ($oDocument->getStatusID() == ARCHIVED) { | |
| 110 | - $this->oPage->addError(_kt('This document has been archived. Please contact the system administrator to have it restored if it is still needed.')); | |
| 111 | - return $this->do_error(); | |
| 112 | - } else if ($oDocument->getStatusID() == DELETED) { | |
| 113 | - $this->oPage->addError(_kt('This document has been deleted. Please contact the system administrator to have it restored if it is still needed.')); | |
| 114 | - return $this->do_error(); | |
| 106 | + if ($oDocument->getStatusID() == ARCHIVED) { | |
| 107 | + $this->oPage->addError(_kt('This document has been archived. Please contact the system administrator to have it restored if it is still needed.')); | |
| 108 | + return $this->do_error(); | |
| 109 | + } else if ($oDocument->getStatusID() == DELETED) { | |
| 110 | + $this->oPage->addError(_kt('This document has been deleted. Please contact the system administrator to have it restored if it is still needed.')); | |
| 111 | + return $this->do_error(); | |
| 115 | 112 | } else if (!Permission::userHasDocumentReadPermission($oDocument)) { |
| 116 | 113 | $this->oPage->addError(_kt('You are not allowed to view this document')); |
| 117 | 114 | return $this->do_error(); |
| 118 | 115 | } |
| 119 | - } | |
| 120 | - | |
| 121 | - if ($oDocument->getStatusID() == ARCHIVED) { | |
| 122 | - $this->oPage->addError(_kt('This document has been archived.')); | |
| 116 | + } | |
| 117 | + | |
| 118 | + if ($oDocument->getStatusID() == ARCHIVED) { | |
| 119 | + $this->oPage->addError(_kt('This document has been archived.')); | |
| 123 | 120 | } else if ($oDocument->getStatusID() == DELETED) { |
| 124 | - $this->oPage->addError(_kt('This document has been deleted.')); | |
| 121 | + $this->oPage->addError(_kt('This document has been deleted.')); | |
| 125 | 122 | } |
| 126 | 123 | |
| 127 | - $this->oPage->setSecondaryTitle($oDocument->getName()); | |
| 124 | + $this->oPage->setSecondaryTitle($oDocument->getName()); | |
| 128 | 125 | |
| 129 | 126 | $aOptions = array( |
| 130 | 127 | "documentaction" => "viewDocument", |
| 131 | 128 | "folderaction" => "browse", |
| 132 | 129 | ); |
| 133 | - | |
| 134 | - $this->oDocument =& $oDocument; | |
| 130 | + | |
| 131 | + $this->oDocument =& $oDocument; | |
| 135 | 132 | $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForDocument($oDocument, $aOptions)); |
| 136 | - $this->oPage->setBreadcrumbDetails(_kt("document details")); | |
| 137 | - $this->addPortlets("Document Details"); | |
| 138 | - | |
| 139 | - $document_data["document"] = $oDocument; | |
| 140 | - $document_data["document_type"] =& DocumentType::get($oDocument->getDocumentTypeID()); | |
| 141 | - $is_valid_doctype = true; | |
| 142 | - | |
| 143 | - if (PEAR::isError($document_data["document_type"])) { | |
| 144 | - $this->oPage->addError('The document you requested has an invalid <strong>document type</strong>. Unfortunately, this means that we cannot effectively display it.'); | |
| 145 | - $is_valid_doctype = false; | |
| 146 | - } | |
| 147 | - | |
| 148 | - // we want to grab all the md for this doc, since its faster that way. | |
| 149 | - $mdlist =& DocumentFieldLink::getByDocument($oDocument); | |
| 150 | - | |
| 151 | - $field_values = array(); | |
| 152 | - foreach ($mdlist as $oFieldLink) { | |
| 133 | + $this->oPage->setBreadcrumbDetails(_kt("document details")); | |
| 134 | + $this->addPortlets("Document Details"); | |
| 135 | + | |
| 136 | + $document_data["document"] = $oDocument; | |
| 137 | + $document_data["document_type"] =& DocumentType::get($oDocument->getDocumentTypeID()); | |
| 138 | + $is_valid_doctype = true; | |
| 139 | + | |
| 140 | + if (PEAR::isError($document_data["document_type"])) { | |
| 141 | + $this->oPage->addError('The document you requested has an invalid <strong>document type</strong>. Unfortunately, this means that we cannot effectively display it.'); | |
| 142 | + $is_valid_doctype = false; | |
| 143 | + } | |
| 144 | + | |
| 145 | + // we want to grab all the md for this doc, since its faster that way. | |
| 146 | + $mdlist =& DocumentFieldLink::getByDocument($oDocument); | |
| 147 | + | |
| 148 | + $field_values = array(); | |
| 149 | + foreach ($mdlist as $oFieldLink) { | |
| 153 | 150 | $field_values[$oFieldLink->getDocumentFieldID()] = $oFieldLink->getValue(); |
| 154 | - } | |
| 155 | - | |
| 156 | - //var_dump($field_values); | |
| 157 | - | |
| 158 | - $document_data["field_values"] = $field_values; | |
| 159 | - | |
| 160 | - // Fieldset generation. | |
| 161 | - // | |
| 162 | - // we need to create a set of FieldsetDisplay objects | |
| 163 | - // that adapt the Fieldsets associated with this lot | |
| 164 | - // to the view (i.e. ZX3). Unfortunately, we don't have | |
| 165 | - // any of the plumbing to do it, so we handle this here. | |
| 166 | - $fieldsets = array(); | |
| 167 | - | |
| 168 | - // we always have a generic. | |
| 169 | - array_push($fieldsets, new GenericFieldsetDisplay()); | |
| 170 | - | |
| 151 | + } | |
| 152 | + | |
| 153 | + //var_dump($field_values); | |
| 154 | + | |
| 155 | + $document_data["field_values"] = $field_values; | |
| 156 | + | |
| 157 | + // Fieldset generation. | |
| 158 | + // | |
| 159 | + // we need to create a set of FieldsetDisplay objects | |
| 160 | + // that adapt the Fieldsets associated with this lot | |
| 161 | + // to the view (i.e. ZX3). Unfortunately, we don't have | |
| 162 | + // any of the plumbing to do it, so we handle this here. | |
| 163 | + $fieldsets = array(); | |
| 164 | + | |
| 165 | + // we always have a generic. | |
| 166 | + array_push($fieldsets, new GenericFieldsetDisplay()); | |
| 167 | + | |
| 171 | 168 | $fieldsetDisplayReg =& KTFieldsetDisplayRegistry::getSingleton(); |
| 172 | 169 | |
| 173 | 170 | foreach (KTMetadataUtil::fieldsetsForDocument($oDocument) as $oFieldset) { |
| 174 | 171 | $displayClass = $fieldsetDisplayReg->getHandler($oFieldset->getNamespace()); |
| 175 | 172 | array_push($fieldsets, new $displayClass($oFieldset)); |
| 176 | 173 | } |
| 177 | - | |
| 178 | - | |
| 179 | - $checkout_user = 'Unknown user'; | |
| 180 | - if ($oDocument->getIsCheckedOut() == 1) { | |
| 181 | - $oCOU = User::get($oDocument->getCheckedOutUserId()); | |
| 182 | - if (!(PEAR::isError($oCOU) || ($oCOU == false))) { | |
| 183 | - $checkout_user = $oCOU->getName(); | |
| 184 | - } | |
| 185 | - } | |
| 186 | - | |
| 174 | + | |
| 175 | + | |
| 176 | + $checkout_user = 'Unknown user'; | |
| 177 | + if ($oDocument->getIsCheckedOut() == 1) { | |
| 178 | + $oCOU = User::get($oDocument->getCheckedOutUserId()); | |
| 179 | + if (!(PEAR::isError($oCOU) || ($oCOU == false))) { | |
| 180 | + $checkout_user = $oCOU->getName(); | |
| 181 | + } | |
| 182 | + } | |
| 183 | + | |
| 187 | 184 | // is the checkout action active? |
| 188 | 185 | $bCanCheckin = false; |
| 189 | 186 | foreach ($this->actions as $oDocAction) { |
| 190 | - $sActName = $oDocAction->sName; | |
| 187 | + $sActName = $oDocAction->sName; | |
| 191 | 188 | if ($sActName == 'ktcore.actions.document.cancelcheckout') { |
| 192 | 189 | if ($oDocAction->_show()) { |
| 193 | 190 | $bCanCheckin = true; |
| 194 | 191 | } |
| 195 | 192 | } |
| 196 | 193 | } |
| 197 | - | |
| 198 | - | |
| 194 | + | |
| 195 | + | |
| 199 | 196 | $oTemplating =& KTTemplating::getSingleton(); |
| 200 | - $oTemplate = $oTemplating->loadTemplate("kt3/view_document"); | |
| 201 | - $aTemplateData = array( | |
| 197 | + $oTemplate = $oTemplating->loadTemplate("kt3/view_document"); | |
| 198 | + $aTemplateData = array( | |
| 202 | 199 | "context" => $this, |
| 203 | - "sCheckoutUser" => $checkout_user, | |
| 204 | - "isCheckoutUser" => ($this->oUser->getId() == $oDocument->getCheckedOutUserId()), | |
| 205 | - "canCheckin" => $bCanCheckin, | |
| 206 | - "document_id" => $document_id, | |
| 207 | - "document" => $oDocument, | |
| 208 | - "document_data" => $document_data, | |
| 209 | - "fieldsets" => $fieldsets, | |
| 210 | - ); | |
| 211 | - //return '<pre>' . print_r($aTemplateData, true) . '</pre>'; | |
| 212 | - return $oTemplate->render($aTemplateData); | |
| 200 | + "sCheckoutUser" => $checkout_user, | |
| 201 | + "isCheckoutUser" => ($this->oUser->getId() == $oDocument->getCheckedOutUserId()), | |
| 202 | + "canCheckin" => $bCanCheckin, | |
| 203 | + "document_id" => $document_id, | |
| 204 | + "document" => $oDocument, | |
| 205 | + "document_data" => $document_data, | |
| 206 | + "fieldsets" => $fieldsets, | |
| 207 | + ); | |
| 208 | + //return '<pre>' . print_r($aTemplateData, true) . '</pre>'; | |
| 209 | + return $oTemplate->render($aTemplateData); | |
| 213 | 210 | } |
| 214 | - | |
| 215 | - function do_history() { | |
| 216 | - $document_data = array(); | |
| 217 | - $document_id = KTUtil::arrayGet($_REQUEST, 'fDocumentId'); | |
| 218 | - if ($document_id === null) { | |
| 219 | - $this->oPage->addError('No document was requested. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 220 | - return $this->do_error(); | |
| 221 | - } | |
| 222 | - $document_data["document_id"] = $document_id; | |
| 223 | - | |
| 224 | - // try get the document. | |
| 225 | - $oDocument =& Document::get($document_id); | |
| 226 | - if (PEAR::isError($oDocument)) { | |
| 227 | - $this->oPage->addError('The document you attempted to retrieve is invalid. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 228 | - return $this->do_error(); | |
| 229 | - } | |
| 230 | - // fixme check perms | |
| 231 | - | |
| 232 | - $this->oDocument =& $oDocument; | |
| 233 | - | |
| 234 | - $this->oPage->setSecondaryTitle($oDocument->getName()); | |
| 235 | - | |
| 211 | + | |
| 212 | + function do_history() { | |
| 213 | + $document_data = array(); | |
| 214 | + $document_id = KTUtil::arrayGet($_REQUEST, 'fDocumentId'); | |
| 215 | + if ($document_id === null) { | |
| 216 | + $this->oPage->addError('No document was requested. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 217 | + return $this->do_error(); | |
| 218 | + } | |
| 219 | + $document_data["document_id"] = $document_id; | |
| 220 | + | |
| 221 | + // try get the document. | |
| 222 | + $oDocument =& Document::get($document_id); | |
| 223 | + if (PEAR::isError($oDocument)) { | |
| 224 | + $this->oPage->addError('The document you attempted to retrieve is invalid. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 225 | + return $this->do_error(); | |
| 226 | + } | |
| 227 | + // fixme check perms | |
| 228 | + | |
| 229 | + $this->oDocument =& $oDocument; | |
| 230 | + | |
| 231 | + $this->oPage->setSecondaryTitle($oDocument->getName()); | |
| 232 | + | |
| 236 | 233 | $aOptions = array( |
| 237 | 234 | "documentaction" => "viewDocument", |
| 238 | 235 | "folderaction" => "browse", |
| 239 | 236 | ); |
| 240 | 237 | $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForDocument($oDocument, $aOptions)); |
| 241 | - $this->oPage->setBreadcrumbDetails(_kt("history")); | |
| 242 | - $this->addPortlets("History"); | |
| 243 | - | |
| 244 | - $aTransactions = array(); | |
| 245 | - // FIXME create a sane "view user information" page somewhere. | |
| 246 | - // FIXME do we really need to use a raw db-access here? probably... | |
| 247 | - $sQuery = "SELECT DTT.name AS transaction_name, U.name AS user_name, DT.version AS version, DT.comment AS comment, DT.datetime AS datetime " . | |
| 248 | - "FROM " . KTUtil::getTableName("document_transactions") . " AS DT INNER JOIN " . KTUtil::getTableName("users") . " AS U ON DT.user_id = U.id " . | |
| 249 | - "INNER JOIN " . KTUtil::getTableName("transaction_types") . " AS DTT ON DTT.namespace = DT.transaction_namespace " . | |
| 250 | - "WHERE DT.document_id = ? ORDER BY DT.datetime DESC"; | |
| 251 | - $aParams = array($document_id); | |
| 252 | - | |
| 253 | - $res = DBUtil::getResultArray(array($sQuery, $aParams)); | |
| 254 | - if (PEAR::isError($res)) { | |
| 255 | - var_dump($res); // FIXME be graceful on failure. | |
| 256 | - exit(0); | |
| 257 | - } | |
| 258 | - | |
| 259 | - // FIXME roll up view transactions | |
| 260 | - $aTransactions = $res; | |
| 261 | - | |
| 262 | - | |
| 263 | - // render pass. | |
| 264 | - $this->oPage->title = _kt("Document History"); | |
| 238 | + $this->oPage->setBreadcrumbDetails(_kt("history")); | |
| 239 | + $this->addPortlets("History"); | |
| 240 | + | |
| 241 | + $aTransactions = array(); | |
| 242 | + // FIXME create a sane "view user information" page somewhere. | |
| 243 | + // FIXME do we really need to use a raw db-access here? probably... | |
| 244 | + $sQuery = "SELECT DTT.name AS transaction_name, U.name AS user_name, DT.version AS version, DT.comment AS comment, DT.datetime AS datetime " . | |
| 245 | + "FROM " . KTUtil::getTableName("document_transactions") . " AS DT INNER JOIN " . KTUtil::getTableName("users") . " AS U ON DT.user_id = U.id " . | |
| 246 | + "INNER JOIN " . KTUtil::getTableName("transaction_types") . " AS DTT ON DTT.namespace = DT.transaction_namespace " . | |
| 247 | + "WHERE DT.document_id = ? ORDER BY DT.datetime DESC"; | |
| 248 | + $aParams = array($document_id); | |
| 249 | + | |
| 250 | + $res = DBUtil::getResultArray(array($sQuery, $aParams)); | |
| 251 | + if (PEAR::isError($res)) { | |
| 252 | + var_dump($res); // FIXME be graceful on failure. | |
| 253 | + exit(0); | |
| 254 | + } | |
| 255 | + | |
| 256 | + // FIXME roll up view transactions | |
| 257 | + $aTransactions = $res; | |
| 258 | + | |
| 259 | + | |
| 260 | + // render pass. | |
| 261 | + $this->oPage->title = _kt("Document History"); | |
| 265 | 262 | $oTemplating =& KTTemplating::getSingleton(); |
| 266 | - $oTemplate = $oTemplating->loadTemplate("kt3/view_document_history"); | |
| 267 | - $aTemplateData = array( | |
| 263 | + $oTemplate = $oTemplating->loadTemplate("kt3/view_document_history"); | |
| 264 | + $aTemplateData = array( | |
| 268 | 265 | "context" => $this, |
| 269 | - "document_id" => $document_id, | |
| 270 | - "document" => $oDocument, | |
| 271 | - "transactions" => $aTransactions, | |
| 272 | - ); | |
| 273 | - return $oTemplate->render($aTemplateData); | |
| 274 | - } | |
| 275 | - | |
| 276 | - | |
| 277 | - function do_versionhistory() { | |
| 278 | - // this is the list of documents past. | |
| 279 | - $document_data = array(); | |
| 280 | - $document_id = KTUtil::arrayGet($_REQUEST, 'fDocumentId'); | |
| 281 | - if ($document_id === null) { | |
| 282 | - $this->oPage->addError('No document was requested. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 283 | - return $this->do_error(); | |
| 284 | - } | |
| 285 | - $document_data["document_id"] = $document_id; | |
| 286 | - | |
| 287 | - // try get the document. | |
| 288 | - $oDocument =& Document::get($document_id); | |
| 289 | - if (PEAR::isError($oDocument)) { | |
| 290 | - $this->oPage->addError('The document you attempted to retrieve is invalid. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 291 | - return $this->do_error(); | |
| 292 | - } | |
| 293 | - // fixme check perms | |
| 294 | - $this->oPage->setSecondaryTitle($oDocument->getName()); | |
| 295 | - $this->oDocument =& $oDocument; | |
| 296 | - $aOptions = array( | |
| 266 | + "document_id" => $document_id, | |
| 267 | + "document" => $oDocument, | |
| 268 | + "transactions" => $aTransactions, | |
| 269 | + ); | |
| 270 | + return $oTemplate->render($aTemplateData); | |
| 271 | + } | |
| 272 | + | |
| 273 | + | |
| 274 | + function do_versionhistory() { | |
| 275 | + // this is the list of documents past. | |
| 276 | + $document_data = array(); | |
| 277 | + $document_id = KTUtil::arrayGet($_REQUEST, 'fDocumentId'); | |
| 278 | + if ($document_id === null) { | |
| 279 | + $this->oPage->addError('No document was requested. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 280 | + return $this->do_error(); | |
| 281 | + } | |
| 282 | + $document_data["document_id"] = $document_id; | |
| 283 | + | |
| 284 | + // try get the document. | |
| 285 | + $oDocument =& Document::get($document_id); | |
| 286 | + if (PEAR::isError($oDocument)) { | |
| 287 | + $this->oPage->addError('The document you attempted to retrieve is invalid. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 288 | + return $this->do_error(); | |
| 289 | + } | |
| 290 | + // fixme check perms | |
| 291 | + $this->oPage->setSecondaryTitle($oDocument->getName()); | |
| 292 | + $this->oDocument =& $oDocument; | |
| 293 | + $aOptions = array( | |
| 297 | 294 | "documentaction" => "viewDocument", |
| 298 | 295 | "folderaction" => "browse", |
| 299 | 296 | ); |
| 300 | 297 | $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForDocument($oDocument, $aOptions)); |
| 301 | - $this->oPage->setBreadcrumbDetails(_kt("history")); | |
| 302 | - $this->addPortlets("History"); | |
| 303 | - | |
| 304 | - $aMetadataVersions = KTDocumentMetadataVersion::getByDocument($oDocument); | |
| 298 | + $this->oPage->setBreadcrumbDetails(_kt("history")); | |
| 299 | + $this->addPortlets("History"); | |
| 300 | + | |
| 301 | + $aMetadataVersions = KTDocumentMetadataVersion::getByDocument($oDocument); | |
| 305 | 302 | $aVersions = array(); |
| 306 | 303 | foreach ($aMetadataVersions as $oVersion) { |
| 307 | 304 | $aVersions[] = Document::get($oDocument->getId(), $oVersion->getId()); |
| 308 | 305 | } |
| 309 | - | |
| 310 | - // render pass. | |
| 311 | - $this->oPage->title = _kt("Document History"); | |
| 306 | + | |
| 307 | + // render pass. | |
| 308 | + $this->oPage->title = _kt("Document History"); | |
| 312 | 309 | $oTemplating =& KTTemplating::getSingleton(); |
| 313 | - $oTemplate = $oTemplating->loadTemplate("kt3/document/metadata_history"); | |
| 310 | + $oTemplate = $oTemplating->loadTemplate("kt3/document/metadata_history"); | |
| 314 | 311 | |
| 315 | 312 | $aActions = KTDocumentActionUtil::getDocumentActionsByNames(array('ktcore.actions.document.view')); |
| 316 | 313 | $oAction = $aActions[0]; |
| 317 | 314 | $oAction->setDocument($this->oDocument); |
| 318 | - | |
| 319 | - $aTemplateData = array( | |
| 315 | + | |
| 316 | + $aTemplateData = array( | |
| 320 | 317 | "context" => $this, |
| 321 | - "document_id" => $document_id, | |
| 322 | - "document" => $oDocument, | |
| 323 | - "versions" => $aVersions, | |
| 318 | + "document_id" => $document_id, | |
| 319 | + "document" => $oDocument, | |
| 320 | + "versions" => $aVersions, | |
| 324 | 321 | 'downloadaction' => $oAction, |
| 325 | - ); | |
| 326 | - return $oTemplate->render($aTemplateData); | |
| 327 | - } | |
| 328 | - | |
| 329 | - // FIXME refactor out the document-info creation into a single utility function. | |
| 330 | - // this gets in: | |
| 331 | - // fDocumentId (document to compare against) | |
| 332 | - // fComparisonVersion (the metadata_version of the appropriate document) | |
| 333 | - function do_viewComparison() { | |
| 334 | - | |
| 335 | - $document_data = array(); | |
| 336 | - $document_id = KTUtil::arrayGet($_REQUEST, 'fDocumentId'); | |
| 337 | - if ($document_id === null) { | |
| 338 | - $this->oPage->addError('No document was requested. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 339 | - return $this->do_error(); | |
| 340 | - } | |
| 341 | - | |
| 342 | - $document_data["document_id"] = $document_id; | |
| 343 | - | |
| 344 | - $base_version = KTUtil::arrayGet($_REQUEST, 'fBaseVersion'); | |
| 345 | - | |
| 346 | - // try get the document. | |
| 347 | - $oDocument =& Document::get($document_id, $base_version); | |
| 348 | - if (PEAR::isError($oDocument)) { | |
| 349 | - $this->oPage->addError('The base document you attempted to retrieve is invalid. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 350 | - return $this->do_error(); | |
| 351 | - } | |
| 352 | - | |
| 353 | - if (!Permission::userHasDocumentReadPermission($oDocument)) { | |
| 354 | - // FIXME inconsistent. | |
| 355 | - $this->oPage->addError(_kt('You are not allowed to view this document')); | |
| 356 | - return $this->do_error(); | |
| 357 | - } | |
| 358 | - | |
| 359 | - $this->oDocument =& $oDocument; | |
| 360 | - $this->oPage->setSecondaryTitle($oDocument->getName()); | |
| 361 | - $aOptions = array( | |
| 322 | + ); | |
| 323 | + return $oTemplate->render($aTemplateData); | |
| 324 | + } | |
| 325 | + | |
| 326 | + // FIXME refactor out the document-info creation into a single utility function. | |
| 327 | + // this gets in: | |
| 328 | + // fDocumentId (document to compare against) | |
| 329 | + // fComparisonVersion (the metadata_version of the appropriate document) | |
| 330 | + function do_viewComparison() { | |
| 331 | + | |
| 332 | + $document_data = array(); | |
| 333 | + $document_id = KTUtil::arrayGet($_REQUEST, 'fDocumentId'); | |
| 334 | + if ($document_id === null) { | |
| 335 | + $this->oPage->addError('No document was requested. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 336 | + return $this->do_error(); | |
| 337 | + } | |
| 338 | + | |
| 339 | + $document_data["document_id"] = $document_id; | |
| 340 | + | |
| 341 | + $base_version = KTUtil::arrayGet($_REQUEST, 'fBaseVersion'); | |
| 342 | + | |
| 343 | + // try get the document. | |
| 344 | + $oDocument =& Document::get($document_id, $base_version); | |
| 345 | + if (PEAR::isError($oDocument)) { | |
| 346 | + $this->oPage->addError('The base document you attempted to retrieve is invalid. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 347 | + return $this->do_error(); | |
| 348 | + } | |
| 349 | + | |
| 350 | + if (!Permission::userHasDocumentReadPermission($oDocument)) { | |
| 351 | + // FIXME inconsistent. | |
| 352 | + $this->oPage->addError(_kt('You are not allowed to view this document')); | |
| 353 | + return $this->do_error(); | |
| 354 | + } | |
| 355 | + | |
| 356 | + $this->oDocument =& $oDocument; | |
| 357 | + $this->oPage->setSecondaryTitle($oDocument->getName()); | |
| 358 | + $aOptions = array( | |
| 362 | 359 | "documentaction" => "viewDocument", |
| 363 | 360 | "folderaction" => "browse", |
| 364 | 361 | ); |
| 365 | 362 | |
| 366 | 363 | $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForDocument($oDocument, $aOptions)); |
| 367 | - $this->oPage->setBreadcrumbDetails(_kt("compare versions")); | |
| 368 | - | |
| 369 | - $comparison_version = KTUtil::arrayGet($_REQUEST, 'fComparisonVersion'); | |
| 370 | - if ($comparison_version=== null) { | |
| 371 | - $this->oPage->addError('No comparison version was requested. Please <a href="' . KTUtil::addQueryStringSelf('action=history&fDocumentId=' . $document_id) . '">select a version</a>.'); | |
| 372 | - return $this->do_error(); | |
| 373 | - } | |
| 374 | - | |
| 375 | - $oComparison =& Document::get($oDocument->getId(), $comparison_version); | |
| 376 | - if (PEAR::isError($oComparison)) { | |
| 377 | - $this->errorRedirectToMain(_kt('Invalid document to compare against.')); | |
| 378 | - } | |
| 379 | - $comparison_data = array(); | |
| 380 | - $comparison_data['document_id'] = $oComparison->getId(); | |
| 381 | - | |
| 382 | - $document_data["document"] = $oDocument; | |
| 383 | - $comparison_data['document'] = $oComparison; | |
| 384 | - | |
| 385 | - $document_data["document_type"] =& DocumentType::get($oDocument->getDocumentTypeID()); | |
| 386 | - $comparison_data["document_type"] =& DocumentType::get($oComparison->getDocumentTypeID()); | |
| 387 | - | |
| 388 | - // follow twice: once for normal, once for comparison. | |
| 389 | - $is_valid_doctype = true; | |
| 390 | - | |
| 391 | - if (PEAR::isError($document_data["document_type"])) { | |
| 392 | - $this->oPage->addError('The document you requested has an invalid <strong>document type</strong>. Unfortunately, this means that we cannot effectively display it.'); | |
| 393 | - $is_valid_doctype = false; | |
| 394 | - } | |
| 395 | - | |
| 396 | - // we want to grab all the md for this doc, since its faster that way. | |
| 397 | - $mdlist =& DocumentFieldLink::getList(array('metadata_version_id = ?', array($oDocument->getMetadataVersionId()))); | |
| 398 | - | |
| 399 | - $field_values = array(); | |
| 400 | - foreach ($mdlist as $oFieldLink) { | |
| 364 | + $this->oPage->setBreadcrumbDetails(_kt("compare versions")); | |
| 365 | + | |
| 366 | + $comparison_version = KTUtil::arrayGet($_REQUEST, 'fComparisonVersion'); | |
| 367 | + if ($comparison_version=== null) { | |
| 368 | + $this->oPage->addError('No comparison version was requested. Please <a href="' . KTUtil::addQueryStringSelf('action=history&fDocumentId=' . $document_id) . '">select a version</a>.'); | |
| 369 | + return $this->do_error(); | |
| 370 | + } | |
| 371 | + | |
| 372 | + $oComparison =& Document::get($oDocument->getId(), $comparison_version); | |
| 373 | + if (PEAR::isError($oComparison)) { | |
| 374 | + $this->errorRedirectToMain(_kt('Invalid document to compare against.')); | |
| 375 | + } | |
| 376 | + $comparison_data = array(); | |
| 377 | + $comparison_data['document_id'] = $oComparison->getId(); | |
| 378 | + | |
| 379 | + $document_data["document"] = $oDocument; | |
| 380 | + $comparison_data['document'] = $oComparison; | |
| 381 | + | |
| 382 | + $document_data["document_type"] =& DocumentType::get($oDocument->getDocumentTypeID()); | |
| 383 | + $comparison_data["document_type"] =& DocumentType::get($oComparison->getDocumentTypeID()); | |
| 384 | + | |
| 385 | + // follow twice: once for normal, once for comparison. | |
| 386 | + $is_valid_doctype = true; | |
| 387 | + | |
| 388 | + if (PEAR::isError($document_data["document_type"])) { | |
| 389 | + $this->oPage->addError('The document you requested has an invalid <strong>document type</strong>. Unfortunately, this means that we cannot effectively display it.'); | |
| 390 | + $is_valid_doctype = false; | |
| 391 | + } | |
| 392 | + | |
| 393 | + // we want to grab all the md for this doc, since its faster that way. | |
| 394 | + $mdlist =& DocumentFieldLink::getList(array('metadata_version_id = ?', array($oDocument->getMetadataVersionId()))); | |
| 395 | + | |
| 396 | + $field_values = array(); | |
| 397 | + foreach ($mdlist as $oFieldLink) { | |
| 401 | 398 | $field_values[$oFieldLink->getDocumentFieldID()] = $oFieldLink->getValue(); |
| 402 | - } | |
| 403 | - | |
| 404 | - $document_data["field_values"] = $field_values; | |
| 405 | - $mdlist =& DocumentFieldLink::getList(array('metadata_version_id = ?', array($comparison_version))); | |
| 399 | + } | |
| 400 | + | |
| 401 | + $document_data["field_values"] = $field_values; | |
| 402 | + $mdlist =& DocumentFieldLink::getList(array('metadata_version_id = ?', array($comparison_version))); | |
| 406 | 403 | |
| 407 | - $field_values = array(); | |
| 408 | - foreach ($mdlist as $oFieldLink) { | |
| 404 | + $field_values = array(); | |
| 405 | + foreach ($mdlist as $oFieldLink) { | |
| 409 | 406 | $field_values[$oFieldLink->getDocumentFieldID()] = $oFieldLink->getValue(); |
| 410 | - } | |
| 411 | - | |
| 412 | - $comparison_data["field_values"] = $field_values; | |
| 413 | - | |
| 414 | - | |
| 415 | - | |
| 416 | - // Fieldset generation. | |
| 417 | - // | |
| 418 | - // we need to create a set of FieldsetDisplay objects | |
| 419 | - // that adapt the Fieldsets associated with this lot | |
| 420 | - // to the view (i.e. ZX3). Unfortunately, we don't have | |
| 421 | - // any of the plumbing to do it, so we handle this here. | |
| 422 | - $fieldsets = array(); | |
| 423 | - | |
| 424 | - // we always have a generic. | |
| 425 | - array_push($fieldsets, new GenericFieldsetDisplay()); | |
| 426 | - | |
| 427 | - // FIXME can we key this on fieldset namespace? or can we have duplicates? | |
| 428 | - // now we get the other fieldsets, IF there is a valid doctype. | |
| 429 | - | |
| 430 | - if ($is_valid_doctype) { | |
| 431 | - // these are the _actual_ fieldsets. | |
| 432 | - $fieldsetDisplayReg =& KTFieldsetDisplayRegistry::getSingleton(); | |
| 433 | - | |
| 434 | - // and the generics | |
| 435 | - $activesets = KTFieldset::getGenericFieldsets(); | |
| 436 | - foreach ($activesets as $oFieldset) { | |
| 437 | - $displayClass = $fieldsetDisplayReg->getHandler($oFieldset->getNamespace()); | |
| 438 | - array_push($fieldsets, new $displayClass($oFieldset)); | |
| 439 | - } | |
| 440 | - | |
| 441 | - $activesets = KTFieldset::getForDocumentType($oDocument->getDocumentTypeID()); | |
| 442 | - foreach ($activesets as $oFieldset) { | |
| 443 | - $displayClass = $fieldsetDisplayReg->getHandler($oFieldset->getNamespace()); | |
| 444 | - array_push($fieldsets, new $displayClass($oFieldset)); | |
| 445 | - } | |
| 446 | - } | |
| 447 | - | |
| 448 | - // FIXME handle ad-hoc fieldsets. | |
| 449 | - $this->addPortlets(); | |
| 407 | + } | |
| 408 | + | |
| 409 | + $comparison_data["field_values"] = $field_values; | |
| 410 | + | |
| 411 | + // Fieldset generation. | |
| 412 | + // | |
| 413 | + // we need to create a set of FieldsetDisplay objects | |
| 414 | + // that adapt the Fieldsets associated with this lot | |
| 415 | + // to the view (i.e. ZX3). Unfortunately, we don't have | |
| 416 | + // any of the plumbing to do it, so we handle this here. | |
| 417 | + $fieldsets = array(); | |
| 418 | + | |
| 419 | + // we always have a generic. | |
| 420 | + array_push($fieldsets, new GenericFieldsetDisplay()); | |
| 421 | + | |
| 422 | + // FIXME can we key this on fieldset namespace? or can we have duplicates? | |
| 423 | + // now we get the other fieldsets, IF there is a valid doctype. | |
| 424 | + | |
| 425 | + if ($is_valid_doctype) { | |
| 426 | + // these are the _actual_ fieldsets. | |
| 427 | + $fieldsetDisplayReg =& KTFieldsetDisplayRegistry::getSingleton(); | |
| 428 | + | |
| 429 | + // and the generics | |
| 430 | + $activesets = KTFieldset::getGenericFieldsets(); | |
| 431 | + foreach ($activesets as $oFieldset) { | |
| 432 | + $displayClass = $fieldsetDisplayReg->getHandler($oFieldset->getNamespace()); | |
| 433 | + array_push($fieldsets, new $displayClass($oFieldset)); | |
| 434 | + } | |
| 435 | + | |
| 436 | + $activesets = KTFieldset::getForDocumentType($oDocument->getDocumentTypeID()); | |
| 437 | + foreach ($activesets as $oFieldset) { | |
| 438 | + $displayClass = $fieldsetDisplayReg->getHandler($oFieldset->getNamespace()); | |
| 439 | + array_push($fieldsets, new $displayClass($oFieldset)); | |
| 440 | + } | |
| 441 | + } | |
| 442 | + | |
| 443 | + // FIXME handle ad-hoc fieldsets. | |
| 444 | + $this->addPortlets(); | |
| 450 | 445 | $oTemplating =& KTTemplating::getSingleton(); |
| 451 | - $oTemplate = $oTemplating->loadTemplate("kt3/compare_document"); | |
| 452 | - $aTemplateData = array( | |
| 453 | - "context" => $this, | |
| 454 | - "document_id" => $document_id, | |
| 455 | - "document" => $oDocument, | |
| 456 | - "document_data" => $document_data, | |
| 457 | - "comparison_data" => $comparison_data, | |
| 458 | - "comparison_document" => $oComparison, | |
| 459 | - "fieldsets" => $fieldsets, | |
| 460 | - ); | |
| 461 | - //var_dump($aTemplateData["comparison_data"]); | |
| 462 | - return $oTemplate->render($aTemplateData); | |
| 446 | + $oTemplate = $oTemplating->loadTemplate("kt3/compare_document"); | |
| 447 | + $aTemplateData = array( | |
| 448 | + "context" => $this, | |
| 449 | + "document_id" => $document_id, | |
| 450 | + "document" => $oDocument, | |
| 451 | + "document_data" => $document_data, | |
| 452 | + "comparison_data" => $comparison_data, | |
| 453 | + "comparison_document" => $oComparison, | |
| 454 | + "fieldsets" => $fieldsets, | |
| 455 | + ); | |
| 456 | + //var_dump($aTemplateData["comparison_data"]); | |
| 457 | + return $oTemplate->render($aTemplateData); | |
| 458 | + } | |
| 459 | + | |
| 460 | + /* we have a lot of error handling. this one is the absolute final failure. */ | |
| 461 | + function do_error() { | |
| 462 | + return ''; // allow normal rendering of errors. | |
| 463 | + // FIXME show something useful / generic. | |
| 463 | 464 | } |
| 464 | - | |
| 465 | - /* we have a lot of error handling. this one is the absolute final failure. */ | |
| 466 | - function do_error() { | |
| 467 | - return ''; // allow normal rendering of errors. | |
| 468 | - // FIXME show something useful / generic. | |
| 469 | - } | |
| 470 | - | |
| 471 | - function do_startComparison() { | |
| 472 | - $document_data = array(); | |
| 473 | - $document_id = KTUtil::arrayGet($_REQUEST, 'fDocumentId'); | |
| 474 | - if ($document_id === null) { | |
| 475 | - $this->oPage->addError('No document was requested. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 476 | - return $this->do_error(); | |
| 477 | - } | |
| 478 | - $document_data["document_id"] = $document_id; | |
| 479 | - | |
| 480 | - $comparison_version = KTUtil::arrayGet($_REQUEST, 'fComparisonVersion'); | |
| 481 | - if ($comparison_version=== null) { | |
| 482 | - $this->oPage->addError('No comparison version was requested. Please <a href="' . KTUtil::addQueryStringSelf('action=history&fDocumentId='.$document_id) . '">select a version</a>.'); | |
| 483 | - return $this->do_error(); | |
| 484 | - } | |
| 485 | - | |
| 486 | - // try get the document. | |
| 487 | - $oDocument =& Document::get($document_id, $comparison_version); | |
| 488 | - if (PEAR::isError($oDocument)) { | |
| 489 | - $this->oPage->addError('The document you attempted to retrieve is invalid. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 490 | - return $this->do_error(); | |
| 491 | - } | |
| 492 | - if (!Permission::userHasDocumentReadPermission($oDocument)) { | |
| 493 | - // FIXME inconsistent. | |
| 494 | - $this->oPage->addError(_kt('You are not allowed to view this document')); | |
| 495 | - return $this->do_error(); | |
| 496 | - } | |
| 497 | - $this->oDocument =& $oDocument; | |
| 498 | - $this->oPage->setSecondaryTitle($oDocument->getName()); | |
| 499 | - $aOptions = array( | |
| 465 | + | |
| 466 | + function do_startComparison() { | |
| 467 | + $document_data = array(); | |
| 468 | + $document_id = KTUtil::arrayGet($_REQUEST, 'fDocumentId'); | |
| 469 | + if ($document_id === null) { | |
| 470 | + $this->oPage->addError('No document was requested. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 471 | + return $this->do_error(); | |
| 472 | + } | |
| 473 | + $document_data["document_id"] = $document_id; | |
| 474 | + | |
| 475 | + $comparison_version = KTUtil::arrayGet($_REQUEST, 'fComparisonVersion'); | |
| 476 | + if ($comparison_version=== null) { | |
| 477 | + $this->oPage->addError('No comparison version was requested. Please <a href="' . KTUtil::addQueryStringSelf('action=history&fDocumentId='.$document_id) . '">select a version</a>.'); | |
| 478 | + return $this->do_error(); | |
| 479 | + } | |
| 480 | + | |
| 481 | + // try get the document. | |
| 482 | + $oDocument =& Document::get($document_id, $comparison_version); | |
| 483 | + if (PEAR::isError($oDocument)) { | |
| 484 | + $this->oPage->addError('The document you attempted to retrieve is invalid. Please <a href="' . KTBrowseUtil::getBrowseBaseUrl() . '">browse</a> for one.'); | |
| 485 | + return $this->do_error(); | |
| 486 | + } | |
| 487 | + if (!Permission::userHasDocumentReadPermission($oDocument)) { | |
| 488 | + // FIXME inconsistent. | |
| 489 | + $this->oPage->addError(_kt('You are not allowed to view this document')); | |
| 490 | + return $this->do_error(); | |
| 491 | + } | |
| 492 | + $this->oDocument =& $oDocument; | |
| 493 | + $this->oPage->setSecondaryTitle($oDocument->getName()); | |
| 494 | + $aOptions = array( | |
| 500 | 495 | "documentaction" => "viewDocument", |
| 501 | 496 | "folderaction" => "browse", |
| 502 | 497 | ); |
| 503 | 498 | $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForDocument($oDocument, $aOptions)); |
| 504 | - $this->oPage->setBreadcrumbDetails(_kt("Select Document Version to compare against")); | |
| 505 | - | |
| 506 | - $aMetadataVersions = KTDocumentMetadataVersion::getByDocument($oDocument); | |
| 499 | + $this->oPage->setBreadcrumbDetails(_kt("Select Document Version to compare against")); | |
| 500 | + | |
| 501 | + $aMetadataVersions = KTDocumentMetadataVersion::getByDocument($oDocument); | |
| 507 | 502 | $aVersions = array(); |
| 508 | 503 | foreach ($aMetadataVersions as $oVersion) { |
| 509 | 504 | $aVersions[] = Document::get($oDocument->getId(), $oVersion->getId()); |
| 510 | 505 | } |
| 511 | - | |
| 512 | - $oTemplating =& KTTemplating::getSingleton(); | |
| 513 | - $oTemplate = $oTemplating->loadTemplate("ktcore/document/comparison_version_select"); | |
| 514 | - $aTemplateData = array( | |
| 506 | + | |
| 507 | + $oTemplating =& KTTemplating::getSingleton(); | |
| 508 | + $oTemplate = $oTemplating->loadTemplate("ktcore/document/comparison_version_select"); | |
| 509 | + $aTemplateData = array( | |
| 515 | 510 | "context" => $this, |
| 516 | - "document_id" => $document_id, | |
| 517 | - "document" => $oDocument, | |
| 518 | - "versions" => $aVersions, | |
| 511 | + "document_id" => $document_id, | |
| 512 | + "document" => $oDocument, | |
| 513 | + "versions" => $aVersions, | |
| 519 | 514 | 'downloadaction' => $oAction, |
| 520 | - ); | |
| 521 | - return $oTemplate->render($aTemplateData); | |
| 515 | + ); | |
| 516 | + return $oTemplate->render($aTemplateData); | |
| 517 | + } | |
| 518 | + | |
| 519 | + function getUserForId($iUserId) { | |
| 520 | + $u = User::get($iUserId); | |
| 521 | + if (PEAR::isError($u) || ($u == false)) { return _kt('User no longer exists'); } | |
| 522 | + return $u->getName(); | |
| 522 | 523 | } |
| 523 | - | |
| 524 | - function getUserForId($iUserId) { | |
| 525 | - $u = User::get($iUserId); | |
| 526 | - if (PEAR::isError($u) || ($u == false)) { return _kt('User no longer exists'); } | |
| 527 | - return $u->getName(); | |
| 528 | - } | |
| 529 | 524 | } |
| 530 | 525 | |
| 531 | 526 | $oDispatcher = new ViewDocumentDispatcher; | ... | ... |