mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-14 13:42:04 +00:00
use jquery validation
This commit is contained in:
parent
8f5a699f0c
commit
13d1e92434
|
@ -33,34 +33,22 @@ class SeedDMS_View_WorkflowStatesMgr 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 runValidation() {
|
||||||
function checkForm(num)
|
$("#form1").validate({
|
||||||
{
|
rules: {
|
||||||
msg = new Array();
|
name: {
|
||||||
|
required: true
|
||||||
if($("#name").val() == "") msg.push("<?php printMLText("js_no_name");?>");
|
},
|
||||||
if (msg != "")
|
},
|
||||||
{
|
messages: {
|
||||||
noty({
|
name: "<?php printMLText("js_no_name");?>",
|
||||||
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', '#form1', function(ev){
|
|
||||||
if(checkForm()) return;
|
|
||||||
ev.preventDefault();
|
|
||||||
});
|
|
||||||
$( "#selector" ).change(function() {
|
$( "#selector" ).change(function() {
|
||||||
$('div.ajax').trigger('update', {workflowstateid: $(this).val()});
|
$('div.ajax').trigger('update', {workflowstateid: $(this).val()});
|
||||||
});
|
});
|
||||||
|
@ -107,21 +95,13 @@ $(document).ready(function() {
|
||||||
$selworkflowstate = $this->params['selworkflowstate'];
|
$selworkflowstate = $this->params['selworkflowstate'];
|
||||||
|
|
||||||
if($selworkflowstate && !$selworkflowstate->isUsed()) {
|
if($selworkflowstate && !$selworkflowstate->isUsed()) {
|
||||||
?>
|
$button = array(
|
||||||
<div class="btn-group">
|
'label'=>getMLText('action'),
|
||||||
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
|
'menuitems'=>array(
|
||||||
<?php echo getMLText('action'); ?>
|
)
|
||||||
<span class="caret"></span>
|
);
|
||||||
</a>
|
$button['menuitems'][] = array('label'=>'<i class="fa fa-remove"></i> '.getMLText("rm_workflow_state"), 'link'=>'../op/op.RemoveWorkflowState.php?workflowstateid='.$selworkflowstate->getID().'&formtoken='.createFormKey('removeworkflowstate'));
|
||||||
<ul class="dropdown-menu">
|
self::showButtonwithMenu($button);
|
||||||
<?php
|
|
||||||
if(!$selworkflowstate->isUsed()) {
|
|
||||||
echo '<li><a href="../op/op.RemoveWorkflowState.php?workflowstateid='.$selworkflowstate->getID().'&formtoken='.createFormKey('removeworkflowstate').'"><i class="fa fa-remove"></i> '.getMLText("rm_workflow_state").'</a><li>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
@ -132,7 +112,7 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<form action="../op/op.WorkflowStatesMgr.php" method="post" class="form-horizontal">
|
<form action="../op/op.WorkflowStatesMgr.php" method="post" class="form-horizontal" id="form1" name="form1">
|
||||||
<?php
|
<?php
|
||||||
if($state) {
|
if($state) {
|
||||||
echo createHiddenFieldWithKey('editworkflowstate');
|
echo createHiddenFieldWithKey('editworkflowstate');
|
||||||
|
@ -189,6 +169,9 @@ $(document).ready(function() {
|
||||||
|
|
||||||
$workflowstates = $dms->getAllWorkflowStates();
|
$workflowstates = $dms->getAllWorkflowStates();
|
||||||
|
|
||||||
|
$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->htmlStartPage(getMLText("admin_tools"));
|
||||||
$this->globalNavigation();
|
$this->globalNavigation();
|
||||||
$this->contentStart();
|
$this->contentStart();
|
||||||
|
@ -222,7 +205,7 @@ $(document).ready(function() {
|
||||||
$this->columnEnd();
|
$this->columnEnd();
|
||||||
$this->columnStart(8);
|
$this->columnStart(8);
|
||||||
?>
|
?>
|
||||||
<div class="ajax" data-view="WorkflowStatesMgr" data-action="form" <?php echo ($selworkflowstate ? "data-query=\"workflowstateid=".$selworkflowstate->getID()."\"" : "") ?>></div>
|
<div class="ajax" data-view="WorkflowStatesMgr" data-action="form" data-afterload="()=>{runValidation();}" <?php echo ($selworkflowstate ? "data-query=\"workflowstateid=".$selworkflowstate->getID()."\"" : "") ?>></div>
|
||||||
<?php
|
<?php
|
||||||
$this->columnEnd();
|
$this->columnEnd();
|
||||||
$this->rowEnd();
|
$this->rowEnd();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user