switch to jquery validation of forms

This commit is contained in:
Uwe Steinmann 2021-05-27 21:57:12 +02:00
parent 3a3b4ec953
commit c75ae806ae
22 changed files with 375 additions and 508 deletions

View File

@ -39,6 +39,7 @@ class SeedDMS_View_AddDocument extends SeedDMS_Theme_Style {
$enablemultiupload = $this->params['enablemultiupload']; $enablemultiupload = $this->params['enablemultiupload'];
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'));
if($enablelargefileupload) { if($enablelargefileupload) {
$this->printFineUploaderJs('../op/op.UploadChunks.php', $partitionsize, $maxuploadsize, $enablemultiupload); $this->printFineUploaderJs('../op/op.UploadChunks.php', $partitionsize, $maxuploadsize, $enablemultiupload);
} }
@ -73,16 +74,6 @@ $(document).ready(function() {
$("#adddocform").validate({ $("#adddocform").validate({
debug: false, debug: false,
ignore: ":hidden:not(.do_validate)", ignore: ":hidden:not(.do_validate)",
invalidHandler: function(e, validator) {
noty({
text: (validator.numberOfInvalids() == 1) ? "<?php printMLText("js_form_error");?>".replace('#', validator.numberOfInvalids()) : "<?php printMLText("js_form_errors");?>".replace('#', validator.numberOfInvalids()),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
});
},
<?php <?php
if($enablelargefileupload) { if($enablelargefileupload) {
?> ?>
@ -165,6 +156,7 @@ $(document).ready(function() {
$folderid = $folder->getId(); $folderid = $folder->getId();
$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.'/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');
if($enablelargefileupload) { if($enablelargefileupload) {
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/fine-uploader/jquery.fine-uploader.min.js"></script>'."\n", 'js'); $this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/fine-uploader/jquery.fine-uploader.min.js"></script>'."\n", 'js');
$this->htmlAddHeader($this->getFineUploaderTemplate(), 'js'); $this->htmlAddHeader($this->getFineUploaderTemplate(), 'js');

View File

@ -34,37 +34,21 @@ class SeedDMS_View_AddEvent extends SeedDMS_Theme_Style {
function js() { /* {{{ */ function js() { /* {{{ */
$strictformcheck = $this->params['strictformcheck']; $strictformcheck = $this->params['strictformcheck'];
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 checkForm()
{
msg = new Array();
if (document.form1.name.value == "") msg.push("<?php printMLText("js_no_name");?>");
<?php
if ($strictformcheck) {
?>
if (document.form1.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
<?php
}
?>
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', '#form1', function(ev){ $("#form1").validate({
if(checkForm()) return; rules: {
ev.preventDefault(); from: {
required: true
},
to: {
required: true
}
},
messages: {
name: "<?php printMLText("js_no_name");?>",
},
}); });
}); });
<?php <?php
@ -72,6 +56,9 @@ $(document).ready(function() {
function show() { /* {{{ */ function show() { /* {{{ */
$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("calendar")); $this->htmlStartPage(getMLText("calendar"));
$this->globalNavigation(); $this->globalNavigation();
$this->contentStart(); $this->contentStart();

View File

@ -36,6 +36,7 @@ class SeedDMS_View_AddFile extends SeedDMS_Theme_Style {
$partitionsize = $this->params['partitionsize']; $partitionsize = $this->params['partitionsize'];
$maxuploadsize = $this->params['maxuploadsize']; $maxuploadsize = $this->params['maxuploadsize'];
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'));
if($enablelargefileupload) if($enablelargefileupload)
$this->printFineUploaderJs('../op/op.UploadChunks.php', $partitionsize, $maxuploadsize); $this->printFineUploaderJs('../op/op.UploadChunks.php', $partitionsize, $maxuploadsize);
@ -60,22 +61,6 @@ $(document).ready( function() {
$("#form1").validate({ $("#form1").validate({
debug: false, debug: false,
ignore: ":hidden:not(.do_validate)", ignore: ":hidden:not(.do_validate)",
invalidHandler: function(e, validator) {
noty({
text: (validator.numberOfInvalids() == 1) ? "<?php printMLText("js_form_error");?>".replace('#', validator.numberOfInvalids()) : "<?php printMLText("js_form_errors");?>".replace('#', validator.numberOfInvalids()),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
});
},
highlight: function(e, errorClass, validClass) {
$(e).parent().parent().removeClass(validClass).addClass(errorClass);
},
unhighlight: function(e, errorClass, validClass) {
$(e).parent().parent().removeClass(errorClass).addClass(validClass);
},
<?php <?php
if($enablelargefileupload) { if($enablelargefileupload) {
?> ?>
@ -129,6 +114,7 @@ $(document).ready( function() {
$maxuploadsize = $this->params['maxuploadsize']; $maxuploadsize = $this->params['maxuploadsize'];
$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.'/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');
if($enablelargefileupload) { if($enablelargefileupload) {
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/fine-uploader/jquery.fine-uploader.min.js"></script>'."\n", 'js'); $this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/fine-uploader/jquery.fine-uploader.min.js"></script>'."\n", 'js');
$this->htmlAddHeader($this->getFineUploaderTemplate(), 'js'); $this->htmlAddHeader($this->getFineUploaderTemplate(), 'js');

View File

@ -34,25 +34,10 @@ class SeedDMS_View_AddSubFolder extends SeedDMS_Theme_Style {
function js() { /* {{{ */ function js() { /* {{{ */
$strictformcheck = $this->params['strictformcheck']; $strictformcheck = $this->params['strictformcheck'];
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'));
?> ?>
$(document).ready( function() { $(document).ready( function() {
$("#form1").validate({ $("#form1").validate({
invalidHandler: function(e, validator) {
noty({
text: (validator.numberOfInvalids() == 1) ? "<?php printMLText("js_form_error");?>".replace('#', validator.numberOfInvalids()) : "<?php printMLText("js_form_errors");?>".replace('#', validator.numberOfInvalids()),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
});
},
highlight: function(e, errorClass, validClass) {
$(e).parent().parent().removeClass(validClass).addClass(errorClass);
},
unhighlight: function(e, errorClass, validClass) {
$(e).parent().parent().removeClass(errorClass).addClass(validClass);
},
messages: { messages: {
name: "<?php printMLText("js_no_name");?>", name: "<?php printMLText("js_no_name");?>",
comment: "<?php printMLText("js_no_comment");?>" comment: "<?php printMLText("js_no_comment");?>"
@ -70,6 +55,7 @@ $(document).ready( function() {
$orderby = $this->params['orderby']; $orderby = $this->params['orderby'];
$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.'/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("folder_title", array("foldername" => htmlspecialchars($folder->getName())))); $this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
$this->globalNavigation($folder); $this->globalNavigation($folder);

View File

@ -33,59 +33,39 @@ class SeedDMS_View_ApproveDocument 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.approvalStatus.value == "") msg.push("<?php printMLText("js_no_approval_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.approvalGroup.value == "") msg.push("<?php printMLText("js_no_approval_group");?>");
if (document.formgrp.approvalStatus.value == "") msg.push("<?php printMLText("js_no_approval_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: {
ev.preventDefault(); comment: {
required: true
},
approvalStatus: {
required: true
},
},
messages: {
comment: "<?php printMLText("js_no_comment");?>",
approvalStatus: "<?php printMLText("js_no_approval_status");?>",
},
}); });
$('body').on('submit', '#formgrp', function(ev){ $("#formgrp").validate({
if(checkGrpForm()) return; rules: {
ev.preventDefault(); comment: {
required: true
},
approvalStatus: {
required: true
},
},
messages: {
comment: "<?php printMLText("js_no_comment");?>",
approvalStatus: "<?php printMLText("js_no_approval_status");?>",
},
}); });
}); });
<?php <?php
$this->printFileChooserJs(); $this->printFileChooserJs();
} /* }}} */ } /* }}} */
@ -105,6 +85,9 @@ $(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();
@ -139,6 +122,7 @@ $(document).ready(function() {
array( array(
'element'=>'textarea', 'element'=>'textarea',
'name'=>'comment', 'name'=>'comment',
'required'=>true,
'rows'=>4, 'rows'=>4,
'cols'=>80 'cols'=>80
) )

View File

@ -39,14 +39,23 @@ class SeedDMS_View_AttributeMgr extends SeedDMS_Theme_Style {
function js() { /* {{{ */ function js() { /* {{{ */
$selattrdef = $this->params['selattrdef']; $selattrdef = $this->params['selattrdef'];
header('Content-Type: application/javascript; charset=UTF-8'); header('Content-Type: application/javascript; charset=UTF-8');
parent::jsTranslations(array('cancel', 'splash_move_document', 'confirm_move_document', 'move_document', 'confirm_transfer_link_document', 'transfer_content', 'link_document', 'splash_move_folder', 'confirm_move_folder', 'move_folder')); parent::jsTranslations(array('js_form_error', 'js_form_errors', 'cancel', 'splash_move_document', 'confirm_move_document', 'move_document', 'confirm_transfer_link_document', 'transfer_content', 'link_document', 'splash_move_folder', 'confirm_move_folder', 'move_folder'));
?> ?>
$(document).ready( function() { function runValidation() {
$('body').on('submit', '#form', function(ev){ $("#form1").validate({
// if(checkForm()) return; rules: {
// ev.preventDefault(); name: {
required: true
}
},
messages: {
name: "<?php printMLText("js_no_name");?>",
},
}); });
}
$(document).ready( function() {
$( "#selector" ).change(function() { $( "#selector" ).change(function() {
$('div.ajax').trigger('update', {attrdefid: $(this).val()}); $('div.ajax').trigger('update', {attrdefid: $(this).val()});
window.history.pushState({"html":"","pageTitle":""},"", '../out/out.AttributeMgr.php?attrdefid=' + $(this).val()); window.history.pushState({"html":"","pageTitle":""},"", '../out/out.AttributeMgr.php?attrdefid=' + $(this).val());
@ -180,7 +189,7 @@ $(document).ready( function() {
function showAttributeForm($attrdef) { /* {{{ */ function showAttributeForm($attrdef) { /* {{{ */
?> ?>
<form class="form-horizontal" action="../op/op.AttributeMgr.php" method="post"> <form class="form-horizontal" action="../op/op.AttributeMgr.php" id="form1" name="form1" method="post">
<?php <?php
if($attrdef) { if($attrdef) {
echo createHiddenFieldWithKey('editattrdef'); echo createHiddenFieldWithKey('editattrdef');
@ -322,6 +331,9 @@ $(document).ready( function() {
$attrdefs = $this->params['attrdefs']; $attrdefs = $this->params['attrdefs'];
$selattrdef = $this->params['selattrdef']; $selattrdef = $this->params['selattrdef'];
$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();
@ -401,7 +413,7 @@ $(document).ready( function() {
$this->columnEnd(); $this->columnEnd();
$this->columnStart(6); $this->columnStart(6);
?> ?>
<div class="ajax" data-view="AttributeMgr" data-action="form" <?php echo ($selattrdef ? "data-query=\"attrdefid=".$selattrdef->getID()."\"" : "") ?>></div> <div class="ajax" data-view="AttributeMgr" data-action="form" data-afterload="()=>{runValidation();}" <?php echo ($selattrdef ? "data-query=\"attrdefid=".$selattrdef->getID()."\"" : "") ?>></div>
<?php <?php
$this->columnEnd(); $this->columnEnd();
$this->rowEnd(); $this->rowEnd();

View File

@ -228,6 +228,7 @@ class SeedDMS_View_Calendar extends SeedDMS_Theme_Style {
$user = $this->params['user']; $user = $this->params['user'];
$strictformcheck = $this->params['strictformcheck']; $strictformcheck = $this->params['strictformcheck'];
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'));
?> ?>
$(document).ready(function() { $(document).ready(function() {
@ -307,16 +308,6 @@ class SeedDMS_View_Calendar extends SeedDMS_Theme_Style {
$('#calendar').fullCalendar('refetchEvents'); $('#calendar').fullCalendar('refetchEvents');
}, "json"); }, "json");
}, },
invalidHandler: function(e, validator) {
noty({
text: (validator.numberOfInvalids() == 1) ? "<?php printMLText("js_form_error");?>".replace('#', validator.numberOfInvalids()) : "<?php printMLText("js_form_errors");?>".replace('#', validator.numberOfInvalids()),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
});
},
messages: { messages: {
name: "<?php printMLText("js_no_name");?>", name: "<?php printMLText("js_no_name");?>",
comment: "<?php printMLText("js_no_comment");?>" comment: "<?php printMLText("js_no_comment");?>"
@ -382,6 +373,7 @@ $(document).ready(function() {
$user = $this->params['user']; $user = $this->params['user'];
$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.'/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->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/moment/moment.min.js"></script>'."\n", 'js'); $this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/moment/moment.min.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/fullcalendar/fullcalendar.min.js"></script>'."\n", 'js'); $this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/fullcalendar/fullcalendar.min.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/fullcalendar/locale-all.js"></script>'."\n", 'js'); $this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/fullcalendar/locale-all.js"></script>'."\n", 'js');

View File

@ -33,83 +33,42 @@ class SeedDMS_View_DefaultKeywords 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 checkForm() function runValidation() {
{ $("#form").validate({
msg = new Array(); rules: {
name: {
if($("#form .name").val() == "") msg.push("<?php printMLText("js_no_name");?>"); required: true
if (msg != "") },
{ },
noty({ messages: {
text: msg.join('<br />'), name: "<?php printMLText("js_no_name");?>",
type: 'error', }
dismissQueue: true, });
layout: 'topRight', $(".formk").validate({
theme: 'defaultTheme', rules: {
_timeout: 1500, keywords: {
}); required: true
return false; },
} },
else messages: {
return true; keywords: "<?php printMLText("js_no_name");?>",
} }
});
function checkFormName() $(".formn").validate({
{ rules: {
msg = new Array(); keywords: {
required: true
if($(".formn .name").val() == "") msg.push("<?php printMLText("js_no_name");?>"); },
if (msg != "") },
{ messages: {
noty({ keywords: "<?php printMLText("js_no_name");?>",
text: msg.join('<br />'), }
type: 'error', });
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
_timeout: 1500,
});
return false;
}
else
return true;
}
function checkKeywordForm()
{
msg = new Array();
if($(".formk .keywords").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;
} }
$(document).ready( function() { $(document).ready( function() {
$('body').on('submit', '#form', function(ev){
if(checkForm()) return;
ev.preventDefault();
});
$('body').on('submit', '.formk', function(ev){
if(checkKeywordForm()) return;
ev.preventDefault();
});
$('body').on('submit', '.formn', function(ev){
if(checkFormName()) return;
ev.preventDefault();
});
$( "#selector" ).change(function() { $( "#selector" ).change(function() {
$('div.ajax').trigger('update', {categoryid: $(this).val()}); $('div.ajax').trigger('update', {categoryid: $(this).val()});
}); });
@ -199,7 +158,7 @@ $(document).ready( function() {
else else
foreach ($lists as $list) { foreach ($lists as $list) {
?> ?>
<form class="form-inline form mb-3" style="display: inline-block;" method="post" action="../op/op.DefaultKeywords.php"> <form class="form-inline form formn mb-3" style="display: inline-block;" method="post" action="../op/op.DefaultKeywords.php">
<?php echo createHiddenFieldWithKey('editkeywords'); ?> <?php echo createHiddenFieldWithKey('editkeywords'); ?>
<input type="Hidden" name="categoryid" value="<?php echo $category->getID()?>"> <input type="Hidden" name="categoryid" value="<?php echo $category->getID()?>">
<input type="Hidden" name="keywordsid" value="<?php echo $list["id"]?>"> <input type="Hidden" name="keywordsid" value="<?php echo $list["id"]?>">
@ -242,6 +201,9 @@ $(document).ready( function() {
$categories = $this->params['categories']; $categories = $this->params['categories'];
$selcategory = $this->params['selcategory']; $selcategory = $this->params['selcategory'];
$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();
@ -278,7 +240,7 @@ $(document).ready( function() {
$this->columnEnd(); $this->columnEnd();
$this->columnStart(8); $this->columnStart(8);
?> ?>
<div class="ajax" data-view="DefaultKeywords" data-action="form" <?php echo ($selcategory ? "data-query=\"categoryid=".$selcategory->getId()."\"" : "") ?>></div> <div class="ajax" data-view="DefaultKeywords" data-action="form" data-afterload="()=>{runValidation();}" <?php echo ($selcategory ? "data-query=\"categoryid=".$selcategory->getId()."\"" : "") ?>></div>
</div> </div>
<?php <?php
$this->columnEnd(); $this->columnEnd();

View File

@ -34,38 +34,24 @@ class SeedDMS_View_EditComment extends SeedDMS_Theme_Style {
function js() { /* {{{ */ function js() { /* {{{ */
$strictformcheck = $this->params['strictformcheck']; $strictformcheck = $this->params['strictformcheck'];
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 checkForm()
{
msg = new Array();
<?php
if ($strictformcheck) { if ($strictformcheck) {
?> ?>
if (document.form1.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>"); function runValidation() {
$("#form1").validate({
rules: {
comment: {
required: true
},
},
messages: {
comment: "<?php printMLText("js_no_comment");?>",
}
});
}
runValidation();
<?php <?php
} }
?>
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', '#form1', function(ev){
if(checkForm()) return;
ev.preventDefault();
});
});
<?php
} /* }}} */ } /* }}} */
function show() { /* {{{ */ function show() { /* {{{ */
@ -76,6 +62,9 @@ $(document).ready(function() {
$version = $this->params['version']; $version = $this->params['version'];
$strictformcheck = $this->params['strictformcheck']; $strictformcheck = $this->params['strictformcheck'];
$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();

View File

@ -34,20 +34,11 @@ class SeedDMS_View_EditDocument extends SeedDMS_Theme_Style {
function js() { /* {{{ */ function js() { /* {{{ */
$strictformcheck = $this->params['strictformcheck']; $strictformcheck = $this->params['strictformcheck'];
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'));
$this->printKeywordChooserJs('form1'); $this->printKeywordChooserJs('form1');
?> ?>
$(document).ready( function() { $(document).ready( function() {
$("#form1").validate({ $("#form1").validate({
invalidHandler: function(e, validator) {
noty({
text: (validator.numberOfInvalids() == 1) ? "<?php printMLText("js_form_error");?>".replace('#', validator.numberOfInvalids()) : "<?php printMLText("js_form_errors");?>".replace('#', validator.numberOfInvalids()),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
});
},
messages: { messages: {
name: "<?php printMLText("js_no_name");?>", name: "<?php printMLText("js_no_name");?>",
comment: "<?php printMLText("js_no_comment");?>", comment: "<?php printMLText("js_no_comment");?>",
@ -75,6 +66,7 @@ $(document).ready( function() {
$orderby = $this->params['orderby']; $orderby = $this->params['orderby'];
$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.'/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);

View File

@ -34,25 +34,10 @@ class SeedDMS_View_EditFolder extends SeedDMS_Theme_Style {
function js() { /* {{{ */ function js() { /* {{{ */
$strictformcheck = $this->params['strictformcheck']; $strictformcheck = $this->params['strictformcheck'];
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'));
?> ?>
$(document).ready(function() { $(document).ready(function() {
$("#form1").validate({ $("#form1").validate({
invalidHandler: function(e, validator) {
noty({
text: (validator.numberOfInvalids() == 1) ? "<?php printMLText("js_form_error");?>".replace('#', validator.numberOfInvalids()) : "<?php printMLText("js_form_errors");?>".replace('#', validator.numberOfInvalids()),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
});
},
highlight: function(e, errorClass, validClass) {
$(e).parent().parent().removeClass(validClass).addClass(errorClass);
},
unhighlight: function(e, errorClass, validClass) {
$(e).parent().parent().removeClass(errorClass).addClass(validClass);
},
messages: { messages: {
name: "<?php printMLText("js_no_name");?>", name: "<?php printMLText("js_no_name");?>",
comment: "<?php printMLText("js_no_comment");?>" comment: "<?php printMLText("js_no_comment");?>"
@ -72,6 +57,7 @@ $(document).ready(function() {
$orderby = $this->params['orderby']; $orderby = $this->params['orderby'];
$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.'/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("folder_title", array("foldername" => htmlspecialchars($folder->getName())))); $this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
$this->globalNavigation($folder); $this->globalNavigation($folder);

View File

@ -33,25 +33,10 @@ class SeedDMS_View_EditUserData 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'));
?> ?>
$(document).ready( function() { $(document).ready( function() {
$("#form").validate({ $("#form").validate({
invalidHandler: function(e, validator) {
noty({
text: (validator.numberOfInvalids() == 1) ? "<?php printMLText("js_form_error");?>".replace('#', validator.numberOfInvalids()) : "<?php printMLText("js_form_errors");?>".replace('#', validator.numberOfInvalids()),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
});
},
highlight: function(e, errorClass, validClass) {
$(e).parent().parent().removeClass(validClass).addClass(errorClass);
},
unhighlight: function(e, errorClass, validClass) {
$(e).parent().parent().removeClass(errorClass).addClass(validClass);
},
rules: { rules: {
currentpwd: { currentpwd: {
required: true required: true
@ -93,6 +78,7 @@ $(document).ready( function() {
$httproot = $this->params['httproot']; $httproot = $this->params['httproot'];
$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.'/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("edit_user_details")); $this->htmlStartPage(getMLText("edit_user_details"));
$this->globalNavigation(); $this->globalNavigation();

View File

@ -33,7 +33,30 @@ class SeedDMS_View_ForcePasswordChange 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() {
$("#form").validate({
rules: {
currentpwd: {
required: true
},
pwd: {
required: true
},
pwdconf: {
equalTo: "#pwd"
}
},
messages: {
currentpwd: "<?php printMLText("js_no_pwd");?>",
pwd: "<?php printMLText("js_no_pwd");?>",
pwdconf: "<?php printMLText("js_pwd_not_conf");?>",
}
});
}
runValidation();
function checkForm() function checkForm()
{ {
msg = new Array(); msg = new Array();
@ -57,10 +80,10 @@ function checkForm()
} }
$(document).ready( function() { $(document).ready( function() {
$('body').on('submit', '#form', function(ev){ // $('body').on('submit', '#form', function(ev){
if(checkForm()) return; // if(checkForm()) return;
ev.preventDefault(); // ev.preventDefault();
}); // });
}); });
<?php <?php
} /* }}} */ } /* }}} */
@ -70,16 +93,19 @@ $(document).ready( function() {
$user = $this->params['user']; $user = $this->params['user'];
$passwordstrength = $this->params['passwordstrength']; $passwordstrength = $this->params['passwordstrength'];
$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("sign_in"), "forcepasswordchange"); $this->htmlStartPage(getMLText("sign_in"), "forcepasswordchange");
$this->globalBanner(); $this->globalBanner();
$this->contentStart(); $this->contentStart();
$this->contentHeading(getMLText('password_expiration')); $this->contentHeading(getMLText('password_expiration'));
$this->warningMsg(getMLText('password_expiration_text')); $this->warningMsg(getMLText('password_expiration_text'));
$this->contentContainerStart();
?> ?>
<form class="form-horizontal" action="../op/op.EditUserData.php" method="post" id="form" name="form1"> <form class="form-horizontal" action="../op/op.EditUserData.php" method="post" id="form" name="form1">
<?php echo createHiddenFieldWithKey('edituserdata'); ?> <?php echo createHiddenFieldWithKey('edituserdata'); ?>
<?php <?php
$this->contentContainerStart();
$this->formField( $this->formField(
getMLText("current_password"), getMLText("current_password"),
array( array(
@ -111,6 +137,7 @@ $(document).ready( function() {
'autocomplete'=>'off', 'autocomplete'=>'off',
) )
); );
$this->contentContainerEnd();
$this->formSubmit("<i class=\"fa fa-save\"></i> ".getMLText('submit_password')); $this->formSubmit("<i class=\"fa fa-save\"></i> ".getMLText('submit_password'));
?> ?>
<input type="hidden" name="fullname" value="<?php print htmlspecialchars($user->getFullName());?>" /> <input type="hidden" name="fullname" value="<?php print htmlspecialchars($user->getFullName());?>" />
@ -119,7 +146,6 @@ $(document).ready( function() {
</form> </form>
<?php <?php
$this->contentContainerEnd();
$tmpfoot = array(); $tmpfoot = array();
$tmpfoot[] = "<a href=\"../op/op.Logout.php\">" . getMLText("logout") . "</a>\n"; $tmpfoot[] = "<a href=\"../op/op.Logout.php\">" . getMLText("logout") . "</a>\n";
print "<p>"; print "<p>";

View File

@ -41,64 +41,48 @@ class SeedDMS_View_GroupMgr extends SeedDMS_Theme_Style {
$strictformcheck = $this->params['strictformcheck']; $strictformcheck = $this->params['strictformcheck'];
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 checkForm1() { function runValidation() {
msg = new Array(); $("#form_1").validate({
rules: {
if($("#name").val() == "") msg.push("<?php printMLText("js_no_name");?>"); name: {
required: true
},
<?php <?php
if ($strictformcheck) { if ($strictformcheck) {
?> ?>
if($("#comment").val() == "") msg.push("<?php printMLText("js_no_comment");?>"); comment: {
required: true
},
<?php <?php
} }
?> ?>
if (msg != "") { },
noty({ messages: {
text: msg.join('<br />'), name: "<?php printMLText("js_no_name");?>",
type: 'error', <?php
dismissQueue: true, if ($strictformcheck) {
layout: 'topRight', ?>
theme: 'defaultTheme', comment: "<?php printMLText("js_no_comment");?>",
_timeout: 1500, <?php
}); }
return false; ?>
} else }
return true; });
$("#form_2").validate({
rules: {
userid: {
required: true
},
},
messages: {
userid: "<?php printMLText("js_select_user");?>",
}
});
} }
function checkForm2() {
msg = "";
if($("#userid").val() == -1) msg += "<?php printMLText("js_select_user");?>\n";
if (msg != "") {
noty({
text: msg,
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
_timeout: 1500,
});
return false;
} else
return true;
}
$(document).ready( function() { $(document).ready( function() {
$('body').on('submit', '#form_1', function(ev){
if(checkForm1())
return;
ev.preventDefault();
});
$('body').on('submit', '#form_2', function(ev){
if(checkForm2())
return;
ev.preventDefault();
});
$( "#selector" ).change(function() { $( "#selector" ).change(function() {
$('div.ajax').trigger('update', {groupid: $(this).val()}); $('div.ajax').trigger('update', {groupid: $(this).val()});
window.history.pushState({"html":"","pageTitle":""},"", '../out/out.GroupMgr.php?groupid=' + $(this).val()); window.history.pushState({"html":"","pageTitle":""},"", '../out/out.GroupMgr.php?groupid=' + $(this).val());
@ -296,6 +280,9 @@ $(document).ready( function() {
$allGroups = $this->params['allgroups']; $allGroups = $this->params['allgroups'];
$strictformcheck = $this->params['strictformcheck']; $strictformcheck = $this->params['strictformcheck'];
$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();
@ -331,7 +318,7 @@ $(document).ready( function() {
$this->columnEnd(); $this->columnEnd();
$this->columnStart(8); $this->columnStart(8);
?> ?>
<div class="ajax" data-view="GroupMgr" data-action="form" <?php echo ($selgroup ? "data-query=\"groupid=".$selgroup->getID()."\"" : "") ?>></div> <div class="ajax" data-view="GroupMgr" data-action="form" data-afterload="()=>{runValidation();}" <?php echo ($selgroup ? "data-query=\"groupid=".$selgroup->getID()."\"" : "") ?>></div>
<?php <?php
$this->columnEnd(); $this->columnEnd();
$this->rowEnd(); $this->rowEnd();

View File

@ -32,65 +32,44 @@
class SeedDMS_View_Login extends SeedDMS_Theme_Style { class SeedDMS_View_Login extends SeedDMS_Theme_Style {
function js() { /* {{{ */ function js() { /* {{{ */
$dms = $this->params['dms'];
$enableguestlogin = $this->params['enableguestlogin'];
$guest = null;
if($enableguestlogin) {
$guestid = $this->params['guestid'];
$guest = $dms->getUser((int) $guestid);
}
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'));
?> ?>
document.form1.login.focus(); document.form1.login.focus();
function checkForm()
{
msg = new Array()
if($("#login").val() == "") msg.push("<?php printMLText("js_no_login");?>");
if($("#pwd").val() == "") msg.push("<?php printMLText("js_no_pwd");?>");
if (msg != "") {
noty({
text: msg.join('<br />'),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
_timeout: 1500,
});
return false;
}
else
return true;
}
function guestLogin()
{
theme = $("#themeselector").val();
lang = $("#languageselector").val();
url = "../op/op.Login.php?login=guest";
if(theme)
url += "&sesstheme=" + theme;
if(lang)
url += "&lang=" + lang;
if (document.form1.referuri) {
url += "&referuri=" + escape(document.form1.referuri.value);
}
document.location.href = url;
}
$(document).ready( function() { $(document).ready( function() {
/* <?php
$('body').on('submit', '#form', function(ev){ if($guest) {
if(checkForm()) return; ?>
ev.preventDefault(); function guestLogin()
}); {
*/ theme = $("#themeselector").val();
lang = $("#languageselector").val();
url = "../op/op.Login.php?login=<?= $guest->getLogin() ?>";
if(theme)
url += "&sesstheme=" + theme;
if(lang)
url += "&lang=" + lang;
if (document.form1.referuri) {
url += "&referuri=" + escape(document.form1.referuri.value);
}
document.location.href = url;
}
$('body').on('click', '#guestlogin', function(ev){ $('body').on('click', '#guestlogin', function(ev){
ev.preventDefault(); ev.preventDefault();
guestLogin(); guestLogin();
}); });
<?php
}
?>
$("#form").validate({ $("#form").validate({
invalidHandler: function(e, validator) {
noty({
text: (validator.numberOfInvalids() == 1) ? "<?php printMLText("js_form_error");?>".replace('#', validator.numberOfInvalids()) : "<?php printMLText("js_form_errors");?>".replace('#', validator.numberOfInvalids()),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
});
},
messages: { messages: {
login: "<?php printMLText("js_no_login");?>", login: "<?php printMLText("js_no_login");?>",
pwd: "<?php printMLText("js_no_pwd");?>" pwd: "<?php printMLText("js_no_pwd");?>"
@ -101,7 +80,9 @@ $(document).ready( function() {
} /* }}} */ } /* }}} */
function show() { /* {{{ */ function show() { /* {{{ */
$dms = $this->params['dms'];
$enableguestlogin = $this->params['enableguestlogin']; $enableguestlogin = $this->params['enableguestlogin'];
$guestid = $this->params['guestid'];
$enablepasswordforgotten = $this->params['enablepasswordforgotten']; $enablepasswordforgotten = $this->params['enablepasswordforgotten'];
$refer = $this->params['referrer']; $refer = $this->params['referrer'];
$themes = $this->params['themes']; $themes = $this->params['themes'];
@ -111,6 +92,7 @@ $(document).ready( function() {
$enableThemeSelector = $this->params['enablethemeselector']; $enableThemeSelector = $this->params['enablethemeselector'];
$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.'/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("sign_in"), "login"); $this->htmlStartPage(getMLText("sign_in"), "login");
$this->globalBanner(); $this->globalBanner();
@ -119,9 +101,9 @@ $(document).ready( function() {
if($msg) if($msg)
$this->errorMsg(htmlspecialchars($msg)); $this->errorMsg(htmlspecialchars($msg));
?> ?>
<?php $this->contentContainerStart(); ?>
<form class="form-horizontal" action="../op/op.Login.php" method="post" name="form1" id="form"> <form class="form-horizontal" action="../op/op.Login.php" method="post" name="form1" id="form">
<?php <?php
$this->contentContainerStart();
if ($refer) { if ($refer) {
echo "<input type='hidden' name='referuri' value='".htmlspecialchars($refer)."'/>"; echo "<input type='hidden' name='referuri' value='".htmlspecialchars($refer)."'/>";
} }
@ -172,13 +154,13 @@ $(document).ready( function() {
$html $html
); );
} }
$this->contentContainerEnd();
$this->formSubmit(getMLText('submit_login')); $this->formSubmit(getMLText('submit_login'));
?> ?>
</form> </form>
<?php <?php
$this->contentContainerEnd();
$tmpfoot = array(); $tmpfoot = array();
if ($enableguestlogin) if ($enableguestlogin && $guestid && $dms->getUser((int) $guestid))
$tmpfoot[] = "<a href=\"\" id=\"guestlogin\">" . getMLText("guest_login") . "</a>\n"; $tmpfoot[] = "<a href=\"\" id=\"guestlogin\">" . getMLText("guest_login") . "</a>\n";
if ($enablepasswordforgotten) if ($enablepasswordforgotten)
$tmpfoot[] = "<a href=\"../out/out.PasswordForgotten.php\">" . getMLText("password_forgotten") . "</a>\n"; $tmpfoot[] = "<a href=\"../out/out.PasswordForgotten.php\">" . getMLText("password_forgotten") . "</a>\n";

View File

@ -132,9 +132,33 @@ class SeedDMS_View_ManageNotify 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'));
// $this->printFolderChooserJs("form1"); ?>
// $this->printDocumentChooserJs("form2"); $(document).ready( function() {
$("#form1").validate({
ignore: [],
rules: {
targetid: {
required: true
},
},
messages: {
targetid: "<?php printMLText("js_no_folder");?>",
},
});
$("#form2").validate({
ignore: [],
rules: {
docid: {
required: true
},
},
messages: {
docid: "<?php printMLText("js_no_document");?>",
},
});
});
<?php
$this->printClickDocumentJs(); $this->printClickDocumentJs();
$this->printClickFolderJs(); $this->printClickFolderJs();
} /* }}} */ } /* }}} */
@ -148,6 +172,9 @@ class SeedDMS_View_ManageNotify extends SeedDMS_Theme_Style {
$this->timeout = $this->params['timeout']; $this->timeout = $this->params['timeout'];
$this->xsendfile = $this->params['xsendfile']; $this->xsendfile = $this->params['xsendfile'];
$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("my_account")); $this->htmlStartPage(getMLText("my_account"));
$this->globalNavigation(); $this->globalNavigation();
$this->contentStart(); $this->contentStart();
@ -157,7 +184,7 @@ class SeedDMS_View_ManageNotify extends SeedDMS_Theme_Style {
$this->columnStart(6); $this->columnStart(6);
$this->contentHeading(getMLText("edit_folder_notify")); $this->contentHeading(getMLText("edit_folder_notify"));
print "<form class=\"form-horizontal\" method=\"post\" action=\"../op/op.ManageNotify.php?type=folder&action=add\" name=\"form1\">"; print "<form class=\"form-horizontal\" method=\"post\" action=\"../op/op.ManageNotify.php?type=folder&action=add\" id=\"form1\" name=\"form1\">";
$this->contentContainerStart(); $this->contentContainerStart();
$this->formField(getMLText("choose_target_folder"), $this->getFolderChooserHtml("form1", M_READ)); $this->formField(getMLText("choose_target_folder"), $this->getFolderChooserHtml("form1", M_READ));
$this->formField( $this->formField(
@ -184,7 +211,7 @@ class SeedDMS_View_ManageNotify extends SeedDMS_Theme_Style {
$this->columnEnd(); $this->columnEnd();
$this->columnStart(6); $this->columnStart(6);
$this->contentHeading(getMLText("edit_document_notify")); $this->contentHeading(getMLText("edit_document_notify"));
print "<form method=\"post\" action=\"../op/op.ManageNotify.php?type=document&action=add\" name=\"form2\">"; print "<form method=\"post\" action=\"../op/op.ManageNotify.php?type=document&action=add\" id=\"form2\" name=\"form2\">";
/* 'form1' must be passed to printDocumentChooser() because the typeahead /* 'form1' must be passed to printDocumentChooser() because the typeahead
* function is currently hardcoded on this value */ * function is currently hardcoded on this value */
$this->contentContainerStart(); $this->contentContainerStart();

View File

@ -33,30 +33,19 @@ class SeedDMS_View_PasswordForgotten 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 checkForm()
{
msg = new Array();
if (document.form1.login.value == "") msg.push("<?php printMLText("js_no_login");?>");
if (document.form1.email.value == "") msg.push("<?php printMLText("js_no_email");?>");
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', '#form1', function(ev){ $("#form1").validate({
if(checkForm()) return; rules: {
ev.preventDefault(); email: {
email: true
}
},
messages: {
login: "<?php printMLText("js_no_login");?>",
email: "<?php printMLText("js_no_email");?>"
},
}); });
}); });
document.form1.email.focus(); document.form1.email.focus();
@ -66,6 +55,9 @@ document.form1.email.focus();
function show() { /* {{{ */ function show() { /* {{{ */
$referrer = $this->params['referrer']; $referrer = $this->params['referrer'];
$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("password_forgotten"), "passwordforgotten"); $this->htmlStartPage(getMLText("password_forgotten"), "passwordforgotten");
$this->globalBanner(); $this->globalBanner();
$this->contentStart(); $this->contentStart();

View File

@ -33,59 +33,39 @@ class SeedDMS_View_ReviewDocument 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.reviewStatus.value == "") msg.push("<?php printMLText("js_no_review_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.reviewGroup.value == "") msg.push("<?php printMLText("js_no_review_group");?>");
if (document.formgrp.reviewStatus.value == "") msg.push("<?php printMLText("js_no_review_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: {
ev.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: {
ev.preventDefault(); comment: {
required: true
},
reviewStatus: {
required: true
},
},
messages: {
comment: "<?php printMLText("js_no_comment");?>",
reviewStatus: "<?php printMLText("js_no_review_status");?>",
},
}); });
}); });
<?php <?php
$this->printFileChooserJs(); $this->printFileChooserJs();
} /* }}} */ } /* }}} */
@ -104,6 +84,9 @@ $(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();
@ -138,6 +121,7 @@ $(document).ready(function() {
array( array(
'element'=>'textarea', 'element'=>'textarea',
'name'=>'comment', 'name'=>'comment',
'required'=>true,
'rows'=>4, 'rows'=>4,
'cols'=>80 'cols'=>80
) )

View File

@ -248,16 +248,13 @@ class SeedDMS_View_Settings extends SeedDMS_Theme_Style {
$this->pageNavigation(getMLText("admin_tools"), "admin_tools"); $this->pageNavigation(getMLText("admin_tools"), "admin_tools");
$this->contentHeading(getMLText("settings")); $this->contentHeading(getMLText("settings"));
$this->rowStart();
$this->columnStart(8);
?> ?>
<form action="../op/op.Settings.php" method="post" enctype="multipart/form-data" name="form0" > <form action="../op/op.Settings.php" method="post" enctype="multipart/form-data" name="form0" >
<?php echo createHiddenFieldWithKey('savesettings'); ?> <?php echo createHiddenFieldWithKey('savesettings'); ?>
<input type="hidden" name="action" value="saveSettings" /> <input type="hidden" name="action" value="saveSettings" />
<input type="hidden" id="currenttab" name="currenttab" value="<?php echo $currenttab ? $currenttab : 'site'; ?>" /> <input type="hidden" id="currenttab" name="currenttab" value="<?php echo $currenttab ? $currenttab : 'site'; ?>" />
<?php
if(!is_writeable($settings->_configFilePath)) {
$this->warningMsg(getMLText("settings_notwritable"));
}
?>
<ul class="nav nav-pills" id="settingstab" role="tablist"> <ul class="nav nav-pills" id="settingstab" role="tablist">
<?php $this->showPaneHeader('site', getMLText('settings_Site'), (!$currenttab || $currenttab == 'site')); ?> <?php $this->showPaneHeader('site', getMLText('settings_Site'), (!$currenttab || $currenttab == 'site')); ?>
@ -649,9 +646,24 @@ if(is_writeable($settings->_configFilePath)) {
} }
?> ?>
</form> </form>
<?php <?php
$this->columnEnd();
$this->columnStart(4);
if(!is_writeable($settings->_configFilePath)) {
$this->warningMsg(getMLText("settings_notwritable"));
}
if($settings->_enableGuestLogin && $settings->_guestID) {
$guest = $dms->getUser((int) $settings->_guestID);
if(!$guest) {
$this->warningMsg(getMLText("settings_invalid_guestid"));
} elseif($guest->isDisabled()) {
$this->warningMsg(getMLText("settings_guestid_is_disabled"));
} elseif($guest->isAdmin()) {
$this->warningMsg(getMLText("settings_guestid_is_admin"));
}
}
$this->columnEnd(4);
$this->rowEnd(4);
$this->contentEnd(); $this->contentEnd();
$this->htmlEndPage(); $this->htmlEndPage();
} /* }}} */ } /* }}} */

View File

@ -38,6 +38,7 @@ class SeedDMS_View_UpdateDocument extends SeedDMS_Theme_Style {
$partitionsize = $this->params['partitionsize']; $partitionsize = $this->params['partitionsize'];
$maxuploadsize = $this->params['maxuploadsize']; $maxuploadsize = $this->params['maxuploadsize'];
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'));
$this->printDropFolderChooserJs("form1"); $this->printDropFolderChooserJs("form1");
$this->printSelectPresetButtonJs(); $this->printSelectPresetButtonJs();
$this->printInputPresetButtonJs(); $this->printInputPresetButtonJs();
@ -71,16 +72,6 @@ $(document).ready( function() {
$("#form1").validate({ $("#form1").validate({
debug: false, debug: false,
ignore: ":hidden:not(.do_validate)", ignore: ":hidden:not(.do_validate)",
invalidHandler: function(e, validator) {
noty({
text: (validator.numberOfInvalids() == 1) ? "<?php printMLText("js_form_error");?>".replace('#', validator.numberOfInvalids()) : "<?php printMLText("js_form_errors");?>".replace('#', validator.numberOfInvalids()),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
});
},
<?php <?php
if($enablelargefileupload) { if($enablelargefileupload) {
?> ?>
@ -154,6 +145,7 @@ console.log(element);
$documentid = $document->getId(); $documentid = $document->getId();
$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.'/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');
if($enablelargefileupload) { if($enablelargefileupload) {
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/fine-uploader/jquery.fine-uploader.min.js"></script>'."\n", 'js'); $this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/fine-uploader/jquery.fine-uploader.min.js"></script>'."\n", 'js');
$this->htmlAddHeader($this->getFineUploaderTemplate(), 'js'); $this->htmlAddHeader($this->getFineUploaderTemplate(), 'js');

View File

@ -36,43 +36,51 @@ class SeedDMS_View_UsrMgr extends SeedDMS_Theme_Style {
$strictformcheck = $this->params['strictformcheck']; $strictformcheck = $this->params['strictformcheck'];
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 checkForm() function runValidation() {
{ $("#form1").validate({
msg = new Array(); rules: {
login: {
if($("#login").val() == "") msg.push("<?php printMLText("js_no_login");?>"); required: true
if(($("#userid").val() == "0") && ($("#pwd").val() == "")) msg.push("<?php printMLText("js_no_pwd");?>"); },
if(($("#pwd").val() != $("#pwdconf").val())&&($("#pwd").val() != "")&&($("#pwdconf").val() != "")) msg.push("<?php printMLText("js_pwd_not_conf");?>"); name: {
if($("#name").val() == "") msg.push("<?php printMLText("js_no_name");?>"); required: true
if($("#email").val() == "") msg.push("<?php printMLText("js_no_email");?>"); },
<?php <?php
if ($strictformcheck) { if ($strictformcheck) {
?> ?>
if($("#comment").val() == "") msg.push("<?php printMLText("js_no_comment");?>"); comment: {
required: true
},
<?php <?php
} }
?> ?>
if (msg != "") { email: {
noty({ required: true,
text: msg.join('<br />'), email: true
type: 'error', },
dismissQueue: true, pwdconf: {
layout: 'topRight', equalTo: "#pwd"
theme: 'defaultTheme', }
_timeout: 1500, },
}); messages: {
return false; login: "<?php printMLText("js_no_login");?>",
name: "<?php printMLText("js_no_name");?>",
<?php
if ($strictformcheck) {
?>
comment: "<?php printMLText("js_no_comment");?>",
<?php
} }
else ?>
return true; email: "<?php printMLText("js_no_email");?>",
pwdconf: "<?php printMLText("js_pwd_not_conf");?>",
}
});
} }
$(document).ready( function() { $(document).ready( function() {
$('body').on('submit', '#form', function(ev){
if(checkForm()) return;
ev.preventDefault();
});
$( "#selector" ).change(function() { $( "#selector" ).change(function() {
$('div.ajax').trigger('update', {userid: $(this).val()}); $('div.ajax').trigger('update', {userid: $(this).val()});
window.history.pushState({"html":"","pageTitle":""},"", '../out/out.UsrMgr.php?userid=' + $(this).val()); window.history.pushState({"html":"","pageTitle":""},"", '../out/out.UsrMgr.php?userid=' + $(this).val());
@ -212,7 +220,7 @@ $(document).ready( function() {
$workflowmode = $this->params['workflowmode']; $workflowmode = $this->params['workflowmode'];
$quota = $this->params['quota']; $quota = $this->params['quota'];
?> ?>
<form class="form-horizontal" action="../op/op.UsrMgr.php" method="post" enctype="multipart/form-data" name="form" id="form"> <form class="form-horizontal" action="../op/op.UsrMgr.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<?php <?php
if($currUser) { if($currUser) {
echo createHiddenFieldWithKey('edituser'); echo createHiddenFieldWithKey('edituser');
@ -257,7 +265,7 @@ $(document).ready( function() {
'name'=>'pwdconf', 'name'=>'pwdconf',
) )
); );
if($passwordexpiration > 0) { if($passwordexpiration > 0 && (!$currUser || !$currUser->isAdmin())) {
$options = array(); $options = array();
if($currUser) if($currUser)
$options[] = array('', getMLText("keep")); $options[] = array('', getMLText("keep"));
@ -523,6 +531,9 @@ $(document).ready( function() {
$workflowmode = $this->params['workflowmode']; $workflowmode = $this->params['workflowmode'];
$quota = $this->params['quota']; $quota = $this->params['quota'];
$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();
@ -558,7 +569,7 @@ $(document).ready( function() {
$this->columnEnd(); $this->columnEnd();
$this->columnStart(4); $this->columnStart(4);
?> ?>
<div class="ajax" data-view="UsrMgr" data-action="form" <?php echo ($seluser ? "data-query=\"userid=".$seluser->getID()."\"" : "") ?>></div> <div class="ajax" data-view="UsrMgr" data-action="form" data-afterload="()=>{runValidation();}" <?php echo ($seluser ? "data-query=\"userid=".$seluser->getID()."\"" : "") ?>></div>
</div> </div>
<?php <?php
$this->columnEnd(); $this->columnEnd();

View File

@ -23,6 +23,7 @@ chzn_template_func = function (state) {
var $newstate = $(html); var $newstate = $(html);
return $newstate; return $newstate;
}; };
function escapeHtml(text) { function escapeHtml(text) {
var map = { var map = {
'&': '&amp;', '&': '&amp;',
@ -245,7 +246,6 @@ function initMost() {
} }
$(document).ready( function() { $(document).ready( function() {
// $('.dropdown-menu a.dropdown-toggle').on('click', function(e) {
$('body').on('click', '.dropdown-menu a.dropdown-toggle', function (e) { $('body').on('click', '.dropdown-menu a.dropdown-toggle', function (e) {
if (!$(this).next().hasClass('show')) { if (!$(this).next().hasClass('show')) {
$(this).parents('.dropdown-menu').first().find('.show').removeClass("show"); $(this).parents('.dropdown-menu').first().find('.show').removeClass("show");