From 1a9c7c213d11d461386fbbc7ca46bc4b5c2c86b8 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 30 Jan 2018 07:59:15 +0100 Subject: [PATCH] use same form for ind and grp The two forms differ in just minor things which can easily be set by a parameter --- views/bootstrap/class.ApproveDocument.php | 106 ++++--------- views/bootstrap/class.ReviewDocument.php | 183 ++++++++-------------- 2 files changed, 93 insertions(+), 196 deletions(-) diff --git a/views/bootstrap/class.ApproveDocument.php b/views/bootstrap/class.ApproveDocument.php index c55f06024..d9c739257 100644 --- a/views/bootstrap/class.ApproveDocument.php +++ b/views/bootstrap/class.ApproveDocument.php @@ -37,8 +37,8 @@ class SeedDMS_View_ApproveDocument extends SeedDMS_Bootstrap_Style { function checkIndForm() { msg = new Array(); - if (document.form1.approvalStatus.value == "") msg.push(""); - if (document.form1.comment.value == "") msg.push(""); + if (document.formind.approvalStatus.value == "") msg.push(""); + if (document.formind.comment.value == "") msg.push(""); if (msg != "") { noty({ text: msg.join('
'), @@ -56,9 +56,9 @@ function checkIndForm() function checkGrpForm() { msg = new Array(); -// if (document.form2.approvalGroup.value == "") msg.push(""); - if (document.form2.approvalStatus.value == "") msg.push(""); - if (document.form2.comment.value == "") msg.push(""); +// if (document.formgrp.approvalGroup.value == "") msg.push(""); + if (document.formgrp.approvalStatus.value == "") msg.push(""); + if (document.formgrp.comment.value == "") msg.push(""); if (msg != "") { noty({ @@ -75,11 +75,11 @@ function checkGrpForm() return true; } $(document).ready(function() { - $('body').on('submit', '#form1', function(ev){ + $('body').on('submit', '#formind', function(ev){ if(checkIndForm()) return; ev.preventDefault(); }); - $('body').on('submit', '#form2', function(ev){ + $('body').on('submit', '#formgrp', function(ev){ if(checkGrpForm()) return; ev.preventDefault(); }); @@ -112,24 +112,24 @@ $(document).ready(function() { $this->contentContainerStart(); // Display the Approval form. - if ($approvalStatus['type'] == 0) { - if($approvalStatus["status"]!=0) { + $approvaltype = ($approvalStatus['type'] == 0) ? 'ind' : 'grp'; + if($approvalStatus["status"]!=0) { - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - $indUser = $dms->getUser($approvalStatus["userID"]); - print ""; - print "
".getMLText("status")."".getMLText("comment")."".getMLText("last_update")."
"; - printApprovalStatusText($approvalStatus["status"]); - print "".htmlspecialchars($approvalStatus["comment"])."".$approvalStatus["date"]." - ". $indUser->getFullname() ."

\n"; - } + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + $indUser = $dms->getUser($approvalStatus["userID"]); + print ""; + print "
".getMLText("status")."".getMLText("comment")."".getMLText("last_update")."
"; + printApprovalStatusText($approvalStatus["status"]); + print "".htmlspecialchars($approvalStatus["comment"])."".$approvalStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."

\n"; + } ?> -
+ @@ -141,57 +141,6 @@ $(document).ready(function() { - - -
printFileChooser('approvalfile', false); -?> -
: -
- - - - -
-
-"; - print "".getMLText("status").""; - print "".getMLText("comment").""; - print "".getMLText("last_update").""; - print ""; - print ""; - printApprovalStatusText($approvalStatus["status"]); - print ""; - print "".htmlspecialchars($approvalStatus["comment"]).""; - $indUser = $dms->getUser($approvalStatus["userID"]); - print "".$approvalStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) .""; - print "
\n"; - } - -?> -
- - - - - - - @@ -207,15 +156,16 @@ $(document).ready(function() { +
: -
: -printFileChooser('approvalfile', false); ?>
+
+ + - + - -
contentContainerEnd(); $this->contentEnd(); diff --git a/views/bootstrap/class.ReviewDocument.php b/views/bootstrap/class.ReviewDocument.php index 11c6ea31a..51dee6311 100644 --- a/views/bootstrap/class.ReviewDocument.php +++ b/views/bootstrap/class.ReviewDocument.php @@ -37,8 +37,8 @@ class SeedDMS_View_ReviewDocument extends SeedDMS_Bootstrap_Style { function checkIndForm() { msg = new Array(); - if (document.form1.reviewStatus.value == "") msg.push(""); - if (document.form1.comment.value == "") msg.push(""); + if (document.formind.reviewStatus.value == "") msg.push(""); + if (document.formind.comment.value == "") msg.push(""); if (msg != "") { noty({ text: msg.join('
'), @@ -55,10 +55,10 @@ function checkIndForm() } function checkGrpForm() { - msg = ""; - if (document.form2.reviewGroup.value == "") msg += "\n"; - if (document.form2.reviewStatus.value == "") msg += "\n"; - if (document.form2.comment.value == "") msg += "\n"; + msg = new Array(); +// if (document.formgrp.reviewGroup.value == "") msg.push(""); + if (document.formgrp.reviewStatus.value == "") msg.push(""); + if (document.formgrp.comment.value == "") msg.push(""); if (msg != "") { noty({ @@ -75,11 +75,11 @@ function checkGrpForm() return true; } $(document).ready(function() { - $('body').on('submit', '#form1', function(ev){ + $('body').on('submit', '#formind', function(ev){ if(checkIndForm()) return; ev.preventDefault(); }); - $('body').on('submit', '#form2', function(ev){ + $('body').on('submit', '#formgrp', function(ev){ if(checkGrpForm()) return; ev.preventDefault(); }); @@ -110,118 +110,65 @@ $(document).ready(function() { $this->contentContainerStart(); // Display the Review form. - if ($reviewStatus['type'] == 0) { - if($reviewStatus["status"]!=0) { + $reviewtype = ($reviewStatus['type'] == 0) ? 'ind' : 'grp'; + if($reviewStatus["status"]!=0) { - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - $indUser = $dms->getUser($reviewStatus["userID"]); - print ""; - print "
".getMLText("status")."".getMLText("comment")."".getMLText("last_update")."
"; - printReviewStatusText($reviewStatus["status"]); - print "".htmlspecialchars($reviewStatus["comment"])."".$reviewStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."

\n"; - } -?> -
- - - - - - - - - - - - - - - - - - -
:
: -printFileChooser('reviewfile', false); -?> -
: - -
- - - -
-"; - print "".getMLText("status").""; - print "".getMLText("comment").""; - print "".getMLText("last_update").""; - print ""; - print ""; - printReviewStatusText($reviewStatus["status"]); - print ""; - print "".htmlspecialchars($reviewStatus["comment"]).""; - $indUser = $dms->getUser($reviewStatus["userID"]); - print "".$reviewStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) .""; - print "
\n"; - } -?> -
- - - - - - - - - - - - - - - - - - -
:
: -printFileChooser('reviewfile', false); -?> -
: - -
- - '/> - - -
-"; + print "".getMLText("status").""; + print "".getMLText("comment").""; + print "".getMLText("last_update").""; + print ""; + print ""; + printReviewStatusText($reviewStatus["status"]); + print ""; + print "".htmlspecialchars($reviewStatus["comment"]).""; + $indUser = $dms->getUser($reviewStatus["userID"]); + print "".$reviewStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) .""; + print "
\n"; } +?> +
+ + + + + + + + + + + + + + + + + + +
:
: +printFileChooser('reviewfile', false); +?> +
: + +
+ + + '/> + + + +
+contentContainerEnd(); $this->contentEnd(); $this->htmlEndPage();