mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
use jquery validation
This commit is contained in:
parent
9ae4a01705
commit
4d931b74e5
|
@ -33,33 +33,22 @@ class SeedDMS_View_WorkflowActionsMgr extends SeedDMS_Theme_Style {
|
|||
|
||||
function js() { /* {{{ */
|
||||
header('Content-Type: application/javascript; charset=UTF-8');
|
||||
parent::jsTranslations(array('js_form_error', 'js_form_errors'));
|
||||
?>
|
||||
function checkForm(num)
|
||||
{
|
||||
msg = new Array()
|
||||
|
||||
if($("#name").val() == "") msg.push("<?php printMLText("js_no_name");?>");
|
||||
if (msg != "")
|
||||
{
|
||||
noty({
|
||||
text: msg.join('<br />'),
|
||||
type: 'error',
|
||||
dismissQueue: true,
|
||||
layout: 'topRight',
|
||||
theme: 'defaultTheme',
|
||||
_timeout: 1500,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
function runValidation() {
|
||||
$("#form1").validate({
|
||||
rules: {
|
||||
name: {
|
||||
required: true
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
name: "<?php printMLText("js_no_name");?>",
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready( function() {
|
||||
$('body').on('submit', '#form', function(ev){
|
||||
if(checkForm()) return;
|
||||
ev.preventDefault();
|
||||
});
|
||||
$( "#selector" ).change(function() {
|
||||
$('div.ajax').trigger('update', {workflowactionid: $(this).val()});
|
||||
});
|
||||
|
@ -106,21 +95,13 @@ $(document).ready( function() {
|
|||
$selworkflowaction = $this->params['selworkflowaction'];
|
||||
|
||||
if($selworkflowaction && !$selworkflowaction->isUsed()) {
|
||||
?>
|
||||
<div class="btn-group">
|
||||
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<?php echo getMLText('action'); ?>
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<?php
|
||||
if(!$selworkflowaction->isUsed()) {
|
||||
echo '<li><a href="../op/op.RemoveWorkflowAction.php?workflowactionid='.$selworkflowaction->getID().'&formtoken='.createFormKey('removeworkflowaction').'"><i class="fa fa-remove"></i> '.getMLText("rm_workflow_action").'</a><li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
$button = array(
|
||||
'label'=>getMLText('action'),
|
||||
'menuitems'=>array(
|
||||
)
|
||||
);
|
||||
$button['menuitems'][] = array('label'=>'<i class="fa fa-remove"></i> '.getMLText("rm_workflow_action"), 'link'=>'../op/op.RemoveWorkflowAction.php?workflowactionid='.$selworkflowaction->getID().'&formtoken='.createFormKey('removeworkflowaction'));
|
||||
self::showButtonwithMenu($button);
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
|
@ -131,7 +112,7 @@ $(document).ready( function() {
|
|||
}
|
||||
}
|
||||
?>
|
||||
<form action="../op/op.WorkflowActionsMgr.php" method="post" class="form-horizontal">
|
||||
<form action="../op/op.WorkflowActionsMgr.php" method="post" class="form-horizontal" id="form1" name="form1">
|
||||
<?php
|
||||
if($action) {
|
||||
echo createHiddenFieldWithKey('editworkflowaction');
|
||||
|
@ -176,6 +157,9 @@ $(document).ready( function() {
|
|||
|
||||
$workflowactions = $dms->getAllWorkflowActions();
|
||||
|
||||
$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("admin_tools"));
|
||||
$this->globalNavigation();
|
||||
$this->contentStart();
|
||||
|
@ -209,7 +193,7 @@ $(document).ready( function() {
|
|||
$this->columnEnd();
|
||||
$this->columnStart(8);
|
||||
?>
|
||||
<div class="ajax" data-view="WorkflowActionsMgr" data-action="form" <?php echo ($selworkflowaction ? "data-query=\"workflowactionid=".$selworkflowaction->getID()."\"" : "") ?>></div>
|
||||
<div class="ajax" data-view="WorkflowActionsMgr" data-action="form" data-afterload="()=>{runValidation();}" <?php echo ($selworkflowaction ? "data-query=\"workflowactionid=".$selworkflowaction->getID()."\"" : "") ?>></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user