allow to upload a file with each review/approval

Conflicts:
	op/op.ApproveDocument.php
	op/op.ReviewDocument.php
This commit is contained in:
Uwe Steinmann 2015-06-11 21:30:56 +02:00
parent 5bac2e9a4e
commit fcddfb0162
4 changed files with 44 additions and 5 deletions

View File

@ -84,6 +84,12 @@ if (!isset($_POST["approvalStatus"]) || !is_numeric($_POST["approvalStatus"]) ||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_approval_status")); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_approval_status"));
} }
if($_FILES["approvalfile"]["tmp_name"]) {
if (is_uploaded_file($_FILES["approvalfile"]["tmp_name"]) && $_FILES['approvalfile']['error']!=0){
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_failed"));
}
}
$controller->setParam('document', $document); $controller->setParam('document', $document);
$controller->setParam('content', $latestContent); $controller->setParam('content', $latestContent);
$controller->setParam('approvalstatus', $_POST["approvalStatus"]); $controller->setParam('approvalstatus', $_POST["approvalStatus"]);
@ -93,8 +99,13 @@ if ($_POST["approvalType"] == "grp") {
} else { } else {
$group = null; $group = null;
} }
if($_FILES["approvalfile"]["tmp_name"])
$file = $_FILES["approvalfile"]["tmp_name"];
else
$file = '';
$controller->setParam('group', $group); $controller->setParam('group', $group);
$controller->setParam('comment', $_POST["comment"]); $controller->setParam('comment', $_POST["comment"]);
$controller->setParam('file', $file);
if(!$controller->run()) { if(!$controller->run()) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText($controller->getErrorMsg())); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText($controller->getErrorMsg()));
} }

View File

@ -83,6 +83,12 @@ if (!isset($_POST["reviewStatus"]) || !is_numeric($_POST["reviewStatus"]) ||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_review_status")); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_review_status"));
} }
if($_FILES["reviewfile"]["tmp_name"]) {
if (is_uploaded_file($_FILES["reviewfile"]["tmp_name"]) && $_FILES['reviewfile']['error']!=0){
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_failed"));
}
}
$controller->setParam('document', $document); $controller->setParam('document', $document);
$controller->setParam('content', $latestContent); $controller->setParam('content', $latestContent);
$controller->setParam('reviewstatus', $_POST["reviewStatus"]); $controller->setParam('reviewstatus', $_POST["reviewStatus"]);
@ -92,8 +98,13 @@ if ($_POST["reviewType"] == "grp") {
} else { } else {
$group = null; $group = null;
} }
if($_FILES["reviewfile"]["tmp_name"])
$file = $_FILES["reviewfile"]["tmp_name"];
else
$file = '';
$controller->setParam('group', $group); $controller->setParam('group', $group);
$controller->setParam('comment', $_POST["comment"]); $controller->setParam('comment', $_POST["comment"]);
$controller->setParam('file', $file);
if(!$controller->run()) { if(!$controller->run()) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText($controller->getErrorMsg())); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText($controller->getErrorMsg()));
} }

View File

@ -118,12 +118,21 @@ function checkGrpForm()
print "</tr></tbody></table><br>\n"; print "</tr></tbody></table><br>\n";
} }
?> ?>
<form method="post" action="../op/op.ApproveDocument.php" name="form1" onsubmit="return checkIndForm();"> <form method="post" action="../op/op.ApproveDocument.php" name="form1" enctype="multipart/form-data" onsubmit="return checkIndForm();">
<?php echo createHiddenFieldWithKey('approvedocument'); ?> <?php echo createHiddenFieldWithKey('approvedocument'); ?>
<table> <table>
<tr><td><?php printMLText("comment")?>:</td> <tr>
<td><textarea name="comment" cols="80" rows="4"></textarea> <td><?php printMLText("comment")?>:</td>
</td></tr> <td><textarea name="comment" cols="80" rows="4"></textarea></td>
</tr>
<tr>
<td><?php printMLText("approval_file")?>:</td>
<td>
<?php
$this->printFileChooser('approvalfile', false);
?>
</td>
</tr>
<tr><td><?php printMLText("approval_status")?>:</td> <tr><td><?php printMLText("approval_status")?>:</td>
<td><select name="approvalStatus"> <td><select name="approvalStatus">
<?php if($approvalStatus['status'] != 1) { ?> <?php if($approvalStatus['status'] != 1) { ?>

View File

@ -109,13 +109,21 @@ function checkGrpForm()
print "</tr></tbody></table><br>"; print "</tr></tbody></table><br>";
} }
?> ?>
<form method="post" action="../op/op.ReviewDocument.php" name="form1" onsubmit="return checkIndForm();"> <form method="post" action="../op/op.ReviewDocument.php" name="form1" enctype="multipart/form-data" onsubmit="return checkIndForm();">
<?php echo createHiddenFieldWithKey('reviewdocument'); ?> <?php echo createHiddenFieldWithKey('reviewdocument'); ?>
<table class="table-condensed"> <table class="table-condensed">
<tr> <tr>
<td><?php printMLText("comment")?>:</td> <td><?php printMLText("comment")?>:</td>
<td><textarea name="comment" cols="80" rows="4"></textarea></td> <td><textarea name="comment" cols="80" rows="4"></textarea></td>
</tr> </tr>
<tr>
<td><?php printMLText("review_file")?>:</td>
<td>
<?php
$this->printFileChooser('reviewfile', false);
?>
</td>
</tr>
<tr> <tr>
<td><?php printMLText("review_status")?></td> <td><?php printMLText("review_status")?></td>
<td> <td>