pass version nr to controller instead content object

This commit is contained in:
Uwe Steinmann 2019-02-06 13:11:14 +01:00
parent 8db66fa33b
commit 211eae5587
2 changed files with 8 additions and 16 deletions

View File

@ -58,16 +58,14 @@ if (isset($_GET["version"])) { /* {{{ */
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
}
$version = $_GET["version"];
$content = $document->getContentByVersion($version);
if (!is_object($content)) {
$controller->setParam('document', $document);
$controller->setParam('version', $version);
$controller->setParam('type', 'version');
if(!$controller->run()) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
}
$controller->setParam('content', $content);
$controller->setParam('type', 'version');
$controller->run();
} /* }}} */
elseif (isset($_GET["file"])) { /* {{{ */

View File

@ -53,18 +53,12 @@ if(isset($_GET["version"])) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
}
if(intval($version)<1)
$content = $document->getLatestContent();
else
$content = $document->getContentByVersion($version);
if (!is_object($content)) {
$controller->setParam('document', $document);
$controller->setParam('version', intval($version));
$controller->setParam('type', 'version');
if(!$controller->run()) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
}
$controller->setParam('content', $content);
$controller->setParam('type', 'version');
$controller->run();
} elseif(isset($_GET["file"])) {
$fileid = $_GET["file"];