public function render() { // need the checkout $checkOut = $GLOBALS['VC']->checkout($this->_file->getPath(), $this->_revision); // Pretty-print the checked out copy */ if ($this->_file->mimeType == 'application/octet-stream') { $this->_view->mimeType = 'text/plain'; } else { $this->_view->mimeType = $this->_file->mimeType; } $this->_view->title = $this->_file->getFileName(); $this->_view->pretty = Chora::pretty($this->_view->mimeType, $checkOut); if ($this->_view->mimeType == 'text/html') { $this->_view->pretty->setConfigParam('inline', true); } return $this->_view->render('app/views/file/html.html.php'); }
Chora::fatal(sprintf(_("Revision Not Found: %s is not a valid revision"), $r), '400 Bad Request'); } /* Retrieve the actual checkout. */ try { $checkOut = $VC->checkout($file->getPath(), $r); } catch (Horde_Vcs_Exception $e) { Chora::fatal($e); } /* Get the MIME type of the file, or at least our best guess at it. */ $mime_type = Horde_Mime_Magic::filenameToMIME($fullname); if ($mime_type == 'application/octet-stream') { $mime_type = 'text/plain'; } if (!$plain) { /* Pretty-print the checked out copy */ $pretty = Chora::pretty($mime_type, $checkOut); if (strpos($mime_type, 'text/plain') !== false) { $data = $pretty->render('inline'); $data = reset($data); $rendered = '<div class="fixed">' . $GLOBALS['injector']->getInstance('Horde_Core_Factory_TextFilter')->filter($data['data'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) . '</div>'; } elseif (strpos($mime_type, 'image/') !== false) { $rendered = Horde::img(Horde::selfUrl(true)->add('p', 1), '', '', ''); } elseif ($pretty->canRender('inline')) { $data = $pretty->render('inline'); $data = reset($data); $rendered = $data['data']; } else { $rendered = Horde::link(Horde::selfUrl(true)->add('p', 1)) . Horde::img('download.png') . ' ' . sprintf(_("Download revision %s"), $r) . '</a>'; } /* Get this revision's attributes in printable form. */ $log = $file->getLog($r);