mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 23:42:11 +00:00
use jquery validatation
This commit is contained in:
parent
33616f2c92
commit
012c3b7d22
|
@ -33,55 +33,36 @@ class SeedDMS_View_ReviseDocument extends SeedDMS_Theme_Style {
|
|||
|
||||
function js() { /* {{{ */
|
||||
header('Content-Type: application/javascript; charset=UTF-8');
|
||||
parent::jsTranslations(array('js_form_error', 'js_form_errors'));
|
||||
?>
|
||||
function checkIndForm()
|
||||
{
|
||||
msg = new Array();
|
||||
if (document.formind.revisionStatus.value == "") msg.push("<?php printMLText("js_no_revision_status");?>");
|
||||
if (document.formind.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
|
||||
if (msg != "") {
|
||||
noty({
|
||||
text: msg.join('<br />'),
|
||||
type: 'error',
|
||||
dismissQueue: true,
|
||||
layout: 'topRight',
|
||||
theme: 'defaultTheme',
|
||||
_timeout: 1500,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
function checkGrpForm()
|
||||
{
|
||||
msg = new Array();
|
||||
if (document.formgrp.revisionGroup.value == "") msg.push("<?php printMLText("js_no_revision_group");?>");
|
||||
if (document.formgrp.revisionSatus.value == "") msg.push("<?php printMLText("js_no_revision_status");?>");
|
||||
if (document.formgrp.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
|
||||
if (msg != "")
|
||||
{
|
||||
noty({
|
||||
text: msg.join('<br />'),
|
||||
type: 'error',
|
||||
dismissQueue: true,
|
||||
layout: 'topRight',
|
||||
theme: 'defaultTheme',
|
||||
_timeout: 1500,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
$(document).ready(function() {
|
||||
$('body').on('submit', '#formind', function(ev){
|
||||
if(checkIndForm()) return;
|
||||
event.preventDefault();
|
||||
$("#formind").validate({
|
||||
rules: {
|
||||
comment: {
|
||||
required: true
|
||||
},
|
||||
reviewStatus: {
|
||||
required: true
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
comment: "<?php printMLText("js_no_comment");?>",
|
||||
reviewStatus: "<?php printMLText("js_no_review_status");?>",
|
||||
},
|
||||
});
|
||||
$('body').on('submit', '#formgrp', function(ev){
|
||||
if(checkGrpForm()) return;
|
||||
event.preventDefault();
|
||||
$("#formgrp").validate({
|
||||
rules: {
|
||||
comment: {
|
||||
required: true
|
||||
},
|
||||
reviewStatus: {
|
||||
required: true
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
comment: "<?php printMLText("js_no_comment");?>",
|
||||
reviewStatus: "<?php printMLText("js_no_review_status");?>",
|
||||
},
|
||||
});
|
||||
});
|
||||
<?php
|
||||
|
@ -103,12 +84,14 @@ $(document).ready(function() {
|
|||
}
|
||||
}
|
||||
|
||||
$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_revision"));
|
||||
$this->contentContainerStart();
|
||||
|
||||
// Display the Revision form.
|
||||
$revisiontype = ($revisionStatus['type'] == 0) ? 'ind' : 'grp';
|
||||
|
@ -131,6 +114,7 @@ $(document).ready(function() {
|
|||
<form class="form-horizontal" method="post" action="../op/op.ReviseDocument.php" id="form<?= $revisiontype ?>" name="form<?= $revisiontype ?>">
|
||||
<?php echo createHiddenFieldWithKey('revisedocument'); ?>
|
||||
<?php
|
||||
$this->contentContainerStart();
|
||||
$this->formField(
|
||||
getMLText("comment"),
|
||||
array(
|
||||
|
@ -153,6 +137,7 @@ $(document).ready(function() {
|
|||
'options'=>$options,
|
||||
)
|
||||
);
|
||||
$this->contentContainerEnd();
|
||||
$this->formSubmit(getMLText('submit_revision'), $revisiontype.'Revision');
|
||||
?>
|
||||
<input type='hidden' name='revisionType' value='<?= $revisiontype ?>'/>
|
||||
|
@ -163,7 +148,6 @@ $(document).ready(function() {
|
|||
<input type='hidden' name='version' value='<?php echo $content->getVersion() ?>'/>
|
||||
</form>
|
||||
<?php
|
||||
$this->contentContainerEnd();
|
||||
$this->contentEnd();
|
||||
$this->htmlEndPage();
|
||||
} /* }}} */
|
||||
|
|
Loading…
Reference in New Issue
Block a user