getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
}
$documentid = $_GET["documentid"];
$document = getDocument($documentid);
if (!is_object($document)) {
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
}
$folder = $document->getFolder();
$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName()."";
if ($document->getAccessMode($user) < M_READ) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
}
if (!isset($_GET["version"]) || !is_numeric($_GET["version"]) || intval($_GET["version"])<1) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
}
$version = $_GET["version"];
$content = $document->getContentByVersion($version);
if (!is_object($content)) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
}
// operation is admitted only for last deocument version
$latestContent = $document->getLatestContent();
if ($latestContent->getVersion()!=$version) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
}
// verify if document has expired
if ($document->hasExpired()){
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
}
// retrieve the approval status for the current user.
$approvalStatus = $user->getApprovalStatus($documentid, $version);
if (count($approvalStatus["indstatus"]) == 0 && count($approvalStatus["grpstatus"]) == 0) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("no_action"));
}
$indApprover = true;
if (count($approvalStatus["indstatus"])==0){
$indApprover = false;
}
else if ($approvalStatus["indstatus"][0]["status"]==-2) {
$indApprover = false;
}
$grpApprover=false;
foreach ($approvalStatus["grpstatus"] as $grpStatus) {
if (($grpStatus["status"]!=-2)&&(isset($grpStatus["status"]))) {
$grpApprover=true;
}
}
if (!$indApprover && !$grpApprover) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("no_action"));
}
UI::htmlStartPage(getMLText("document_title", array("documentname" => $document->getName())));
UI::globalNavigation($folder);
UI::pageNavigation($docPathHTML, "view_document");
UI::contentHeading(getMLText("submit_approval"));
?>
";
print " ".getMLText("status")." ";
print "".getMLText("comment")." ";
print "".getMLText("last_update")." ";
print "