pass more data to view, do not use $_GET in view anymore

This commit is contained in:
Uwe Steinmann 2021-02-09 11:16:20 +01:00
parent e7b40e21f3
commit 248d106852
2 changed files with 8 additions and 7 deletions

View File

@ -70,7 +70,7 @@ if (!$accessop->mayApprove()){
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
}
$approvals = $latestContent->getApprovalStatus();
$approvals = $content->getApprovalStatus();
if(!$approvals) {
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("no_action"));
}
@ -80,6 +80,8 @@ $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if($view) {
$view->setParam('folder', $folder);
$view->setParam('document', $document);
$view->setParam('version', $content);
$view->setParam('approveid', (int) $_GET['approveid']);
$view->setParam('accessobject', $accessop);
$view($_GET);
exit;

View File

@ -94,12 +94,12 @@ $(document).ready(function() {
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$content = $this->params['version'];
$approveid = $this->params['approveid'];
$latestContent = $document->getLatestContent();
$approvals = $latestContent->getApprovalStatus();
$approvals = $content->getApprovalStatus();
foreach($approvals as $approval) {
if($approval['approveID'] == $_GET['approveid']) {
if($approval['approveID'] == $approveid) {
$approvalStatus = $approval;
break;
}
@ -167,10 +167,9 @@ $(document).ready(function() {
<input type='hidden' name='approvalGroup' value="<?php echo $approvalStatus['required']; ?>" />
<?php endif; ?>
<input type='hidden' name='documentid' value='<?php echo $document->getId() ?>'/>
<input type='hidden' name='version' value='<?php echo $latestContent->getVersion(); ?>'/>
<input type='hidden' name='version' value='<?php echo $content->getVersion(); ?>'/>
</form>
<?php
$this->contentContainerEnd();
$this->contentEnd();
$this->htmlEndPage();