move display of form into own function

This commit is contained in:
Uwe Steinmann 2023-06-18 13:58:14 +02:00
parent 42d7d7c096
commit 0be0f90881
3 changed files with 92 additions and 83 deletions

View File

@ -80,6 +80,7 @@ if($view) {
$view->setParam('folder', $folder);
$view->setParam('document', $document);
$view->setParam('version', $content);
$view->setParam('reviewid', (int) $_GET['reviewid']);
$view->setParam('accessobject', $accessop);
$view($_GET);
exit;

View File

@ -13,11 +13,6 @@
* @version Release: @package_version@
*/
/**
* Include parent class
*/
//require_once("class.Bootstrap.php");
/**
* Class which outputs the html page for ApproveDocument view
*
@ -31,7 +26,7 @@
*/
class SeedDMS_View_ApproveDocument extends SeedDMS_Theme_Style {
function js() { /* {{{ */
public function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
parent::jsTranslations(array('js_form_error', 'js_form_errors'));
?>
@ -69,48 +64,10 @@ $(document).ready(function() {
$this->printFileChooserJs();
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
protected function showForm($approvalStatus) { /* {{{ */
$document = $this->params['document'];
$content = $this->params['version'];
$approveid = $this->params['approveid'];
$approvals = $content->getApprovalStatus();
foreach($approvals as $approval) {
if($approval['approveID'] == $approveid) {
$approvalStatus = $approval;
break;
}
}
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
$this->contentHeading(getMLText("add_approval"));
// Display the Approval form.
$approvaltype = ($approvalStatus['type'] == 0) ? 'ind' : 'grp';
if($approvalStatus["status"]!=0) {
print "<table class=\"table table-condensed table-sm\"><thead><tr>";
print "<th>".getMLText("status")."</th>";
print "<th>".getMLText("comment")."</th>";
print "<th>".getMLText("last_update")."</th>";
print "</tr></thead><tbody><tr>";
print "<td>";
printApprovalStatusText($approvalStatus["status"]);
print "</td>";
print "<td>".htmlspecialchars($approvalStatus["comment"])."</td>";
$indUser = $dms->getUser($approvalStatus["userID"]);
print "<td>".$approvalStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."</td>";
print "</tr></tbody></table><br>\n";
}
?>
<form class="form-horizontal" method="post" action="../op/op.ApproveDocument.php" id="form<?= $approvaltype ?>" name="form<?= $approvaltype ?>" enctype="multipart/form-data">
<?php echo createHiddenFieldWithKey('approvedocument'); ?>
@ -155,6 +112,50 @@ $(document).ready(function() {
<input type='hidden' name='version' value='<?php echo $content->getVersion(); ?>'/>
</form>
<?php
} /* }}} */
public function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$content = $this->params['version'];
$approveid = $this->params['approveid'];
$approvals = $content->getApprovalStatus();
foreach($approvals as $approval) {
if($approval['approveID'] == $approveid) {
$approvalStatus = $approval;
break;
}
}
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
$this->contentHeading(getMLText("add_approval"));
// Display the Approval form.
if($approvalStatus["status"]!=0) {
print "<table class=\"table table-condensed table-sm\"><thead><tr>";
print "<th>".getMLText("status")."</th>";
print "<th>".getMLText("comment")."</th>";
print "<th>".getMLText("last_update")."</th>";
print "</tr></thead><tbody><tr>";
print "<td>";
printApprovalStatusText($approvalStatus["status"]);
print "</td>";
print "<td>".htmlspecialchars($approvalStatus["comment"])."</td>";
$indUser = $dms->getUser($approvalStatus["userID"]);
print "<td>".$approvalStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."</td>";
print "</tr></tbody></table><br>\n";
}
$this->showForm($approvalStatus);
$this->contentEnd();
$this->htmlEndPage();
} /* }}} */

View File

@ -69,47 +69,10 @@ $(document).ready(function() {
$this->printFileChooserJs();
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
protected function showForm($reviewStatus) { /* {{{ */
$document = $this->params['document'];
$content = $this->params['version'];
$reviews = $content->getReviewStatus();
foreach($reviews as $review) {
if($review['reviewID'] == $_GET['reviewid']) {
$reviewStatus = $review;
break;
}
}
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
$this->contentHeading(getMLText("submit_review"));
// Display the Review form.
$reviewtype = ($reviewStatus['type'] == 0) ? 'ind' : 'grp';
if($reviewStatus["status"]!=0) {
print "<table class=\"table table-condensed table-sm\"><thead><tr>";
print "<th>".getMLText("status")."</th>";
print "<th>".getMLText("comment")."</th>";
print "<th>".getMLText("last_update")."</th>";
print "</tr></thead><tbody><tr>";
print "<td>";
printReviewStatusText($reviewStatus["status"]);
print "</td>";
print "<td>".htmlspecialchars($reviewStatus["comment"])."</td>";
$indUser = $dms->getUser($reviewStatus["userID"]);
print "<td>".$reviewStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."</td>";
print "</tr></tbody></table><br>\n";
}
?>
<form class="form-horizontal" method="post" action="../op/op.ReviewDocument.php" id="form<?= $reviewtype ?>" name="form<?= $reviewtype ?>" enctype="multipart/form-data">
<?php echo createHiddenFieldWithKey('reviewdocument'); ?>
@ -154,6 +117,50 @@ $(document).ready(function() {
<input type='hidden' name='version' value='<?php echo $content->getVersion() ?>'/>
</form>
<?php
} /* }}} */
public function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$content = $this->params['version'];
$reviewid = $this->params['reviewid'];
$reviews = $content->getReviewStatus();
foreach($reviews as $review) {
if($review['reviewID'] == $reviewid) {
$reviewStatus = $review;
break;
}
}
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
$this->contentHeading(getMLText("submit_review"));
// Display the Review form.
if($reviewStatus["status"]!=0) {
print "<table class=\"table table-condensed table-sm\"><thead><tr>";
print "<th>".getMLText("status")."</th>";
print "<th>".getMLText("comment")."</th>";
print "<th>".getMLText("last_update")."</th>";
print "</tr></thead><tbody><tr>";
print "<td>";
printReviewStatusText($reviewStatus["status"]);
print "</td>";
print "<td>".htmlspecialchars($reviewStatus["comment"])."</td>";
$indUser = $dms->getUser($reviewStatus["userID"]);
print "<td>".$reviewStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."</td>";
print "</tr></tbody></table><br>\n";
}
$this->showForm($reviewStatus);
$this->contentEnd();
$this->htmlEndPage();
} /* }}} */