mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-29 04:57:20 +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() { /* {{{ */
|
function js() { /* {{{ */
|
||||||
header('Content-Type: application/javascript; charset=UTF-8');
|
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() {
|
$(document).ready(function() {
|
||||||
$('body').on('submit', '#formind', function(ev){
|
$("#formind").validate({
|
||||||
if(checkIndForm()) return;
|
rules: {
|
||||||
event.preventDefault();
|
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){
|
$("#formgrp").validate({
|
||||||
if(checkGrpForm()) return;
|
rules: {
|
||||||
event.preventDefault();
|
comment: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
reviewStatus: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
comment: "<?php printMLText("js_no_comment");?>",
|
||||||
|
reviewStatus: "<?php printMLText("js_no_review_status");?>",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
<?php
|
<?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->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
|
||||||
$this->globalNavigation($folder);
|
$this->globalNavigation($folder);
|
||||||
$this->contentStart();
|
$this->contentStart();
|
||||||
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
|
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
|
||||||
$this->contentHeading(getMLText("submit_revision"));
|
$this->contentHeading(getMLText("submit_revision"));
|
||||||
$this->contentContainerStart();
|
|
||||||
|
|
||||||
// Display the Revision form.
|
// Display the Revision form.
|
||||||
$revisiontype = ($revisionStatus['type'] == 0) ? 'ind' : 'grp';
|
$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 ?>">
|
<form class="form-horizontal" method="post" action="../op/op.ReviseDocument.php" id="form<?= $revisiontype ?>" name="form<?= $revisiontype ?>">
|
||||||
<?php echo createHiddenFieldWithKey('revisedocument'); ?>
|
<?php echo createHiddenFieldWithKey('revisedocument'); ?>
|
||||||
<?php
|
<?php
|
||||||
|
$this->contentContainerStart();
|
||||||
$this->formField(
|
$this->formField(
|
||||||
getMLText("comment"),
|
getMLText("comment"),
|
||||||
array(
|
array(
|
||||||
|
@ -153,6 +137,7 @@ $(document).ready(function() {
|
||||||
'options'=>$options,
|
'options'=>$options,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
$this->contentContainerEnd();
|
||||||
$this->formSubmit(getMLText('submit_revision'), $revisiontype.'Revision');
|
$this->formSubmit(getMLText('submit_revision'), $revisiontype.'Revision');
|
||||||
?>
|
?>
|
||||||
<input type='hidden' name='revisionType' value='<?= $revisiontype ?>'/>
|
<input type='hidden' name='revisionType' value='<?= $revisiontype ?>'/>
|
||||||
|
@ -163,7 +148,6 @@ $(document).ready(function() {
|
||||||
<input type='hidden' name='version' value='<?php echo $content->getVersion() ?>'/>
|
<input type='hidden' name='version' value='<?php echo $content->getVersion() ?>'/>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
$this->contentContainerEnd();
|
|
||||||
$this->contentEnd();
|
$this->contentEnd();
|
||||||
$this->htmlEndPage();
|
$this->htmlEndPage();
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user