Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2021-05-31 21:53:08 +02:00
commit 64658c06cd
43 changed files with 620 additions and 633 deletions

View File

@ -214,6 +214,10 @@
- propperly check for translation of html email body (Closes: #510) - propperly check for translation of html email body (Closes: #510)
- set mandatory group reviewer/approver when adding a new document or version - set mandatory group reviewer/approver when adding a new document or version
- fix sending notification mails to group when uploading document via drag&drop - fix sending notification mails to group when uploading document via drag&drop
- guest login can use any user account
- issue warning if document cannot be approved/reviewed anymore, because it has
expired
- much better form validation based on jquery validation
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 5.1.22 Changes in version 5.1.22

View File

@ -58,17 +58,15 @@ class SeedDMS_Controller_Login extends SeedDMS_Controller_Common {
*/ */
if(!$user && $settings->_enableGuestLogin && (int) $settings->_guestID) { if(!$user && $settings->_enableGuestLogin && (int) $settings->_guestID) {
$guestUser = $dms->getUser((int) $settings->_guestID); $guestUser = $dms->getUser((int) $settings->_guestID);
if(!$guestUser) { if($guestUser) {
$this->setErrorMsg("login_error_text"); if(($login != $guestUser->getLogin())) {
return false; if ((!isset($pwd) || strlen($pwd)==0)) {
} $this->setErrorMsg("login_error_text");
if(($login != $guestUser->getLogin())) { return false;
if ((!isset($pwd) || strlen($pwd)==0)) { }
$this->setErrorMsg("login_error_text"); } else {
return false; $user = $guestUser;
} }
} else {
$user = $guestUser;
} }
} }

View File

@ -101,7 +101,7 @@ ALTER TABLE tblDocuments ADD CONSTRAINT `tblDocuments_folder` FOREIGN KEY (`fold
CALL DROPFK('tblDocumentContent', 'tblDocumentContent_document'); CALL DROPFK('tblDocumentContent', 'tblDocumentContent_document');
ALTER TABLE tblDocumentContent DROP PRIMARY KEY; -- ALTER TABLE tblDocumentContent DROP PRIMARY KEY;
ALTER TABLE tblDocumentContent ADD CONSTRAINT `tblDocumentContent_document` FOREIGN KEY (`document`) REFERENCES `tblDocuments` (`id`); ALTER TABLE tblDocumentContent ADD CONSTRAINT `tblDocumentContent_document` FOREIGN KEY (`document`) REFERENCES `tblDocuments` (`id`);

View File

@ -1,3 +1,5 @@
SET SQL_MODE='ALLOW_INVALID_DATES';
START TRANSACTION; START TRANSACTION;
ALTER TABLE tblDocumentLinks ADD CONSTRAINT `tblDocumentLinks_target` FOREIGN KEY (`target`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE; ALTER TABLE tblDocumentLinks ADD CONSTRAINT `tblDocumentLinks_target` FOREIGN KEY (`target`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE;

View File

@ -28,6 +28,8 @@ ALTER TABLE `tblWorkflowDocumentContent` CHANGE `date` `date` datetime NOT NULL;
ALTER TABLE `tblVersion` CHANGE `date` `date` datetime NOT NULL; ALTER TABLE `tblVersion` CHANGE `date` `date` datetime NOT NULL;
UPDATE `tblUsers` SET `theme`='bootstrap' WHERE `theme` != '';
UPDATE tblVersion set major=5, minor=1, subminor=0; UPDATE tblVersion set major=5, minor=1, subminor=0;
COMMIT; COMMIT;

View File

@ -111,6 +111,7 @@ if(!empty($recs)) {
include('update-'.$_GET['version'].'/update.php'); include('update-'.$_GET['version'].'/update.php');
} }
} else { } else {
echo "<h3>Error Messages</h3>";
echo $errorMsg; echo $errorMsg;
} }
echo "<p><a href=\"install.php\" class=\"btn btn-primary\">Go back to installation and recheck.</a></p>"; echo "<p><a href=\"install.php\" class=\"btn btn-primary\">Go back to installation and recheck.</a></p>";

View File

@ -522,7 +522,7 @@ switch($command) {
$notifier->sendDeleteFolderMail($folder, $user); $notifier->sendDeleteFolderMail($folder, $user);
} }
header('Content-Type: application/json'); header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>'')); echo json_encode(array('success'=>true, 'message'=>getMLText('splash_folder_deleted'), 'data'=>''));
add_log_line(); add_log_line();
} else { } else {
header('Content-Type: application/json'); header('Content-Type: application/json');
@ -567,7 +567,7 @@ switch($command) {
} }
header('Content-Type: application/json'); header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>'')); echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_deleted'), 'data'=>''));
add_log_line(); add_log_line();
} else { } else {
header('Content-Type: application/json'); header('Content-Type: application/json');

View File

@ -64,6 +64,9 @@ if (!is_object($version)) {
} }
$comment = $_POST["comment"]; $comment = $_POST["comment"];
if ($settings->_strictFormCheck && !$comment) {
UI::exitError(getMLText("admin_tools"),getMLText("version_comment_missing"));
}
if (($oldcomment = $version->getComment()) != $comment) { if (($oldcomment = $version->getComment()) != $comment) {
if($version->setComment($comment)) { if($version->setComment($comment)) {

View File

@ -44,7 +44,13 @@ if ($action == "addgroup") {
} }
$name = $_POST["name"]; $name = $_POST["name"];
if(!$name) {
UI::exitError(getMLText("admin_tools"),getMLText("group_name_missing"));
}
$comment = $_POST["comment"]; $comment = $_POST["comment"];
if ($settings->_strictFormCheck && !$comment) {
UI::exitError(getMLText("admin_tools"),getMLText("group_comment_missing"));
}
if (is_object($dms->getGroupByName($name))) { if (is_object($dms->getGroupByName($name))) {
UI::exitError(getMLText("admin_tools"),getMLText("group_exists")); UI::exitError(getMLText("admin_tools"),getMLText("group_exists"));

View File

@ -51,13 +51,18 @@ if ($action == "adduser") {
$pwdexpiration = ''; $pwdexpiration = '';
else else
$pwdexpiration = $_POST["pwdexpiration"]; $pwdexpiration = $_POST["pwdexpiration"];
if(!isset($_POST["quota"]))
$quota = 0;
else
$quota = (int) $_POST["quota"];
$name = $_POST["name"]; $name = $_POST["name"];
if(!$name) {
UI::exitError(getMLText("admin_tools"),getMLText("user_name_missing"));
}
$email = $_POST["email"]; $email = $_POST["email"];
if(!$email) {
UI::exitError(getMLText("admin_tools"),getMLText("user_email_missing"));
}
$comment = $_POST["comment"]; $comment = $_POST["comment"];
if ($settings->_strictFormCheck && !$comment) {
UI::exitError(getMLText("admin_tools"),getMLText("user_comment_missing"));
}
$role = $dms->getRole($_POST["role"]); $role = $dms->getRole($_POST["role"]);
$isHidden = (isset($_POST["ishidden"]) && $_POST["ishidden"]==1 ? 1 : 0); $isHidden = (isset($_POST["ishidden"]) && $_POST["ishidden"]==1 ? 1 : 0);
$isDisabled = (isset($_POST["isdisabled"]) && $_POST["isdisabled"]==1 ? 1 : 0); $isDisabled = (isset($_POST["isdisabled"]) && $_POST["isdisabled"]==1 ? 1 : 0);

View File

@ -48,9 +48,10 @@ if (isset($_GET["msg"]) && strlen($_GET["msg"])>0) {
$themes = UI::getStyles(); $themes = UI::getStyles();
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array()); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms));
if($view) { if($view) {
$view->setParam('enableguestlogin', $settings->_enableGuestLogin); $view->setParam('enableguestlogin', $settings->_enableGuestLogin);
$view->setParam('guestid', $settings->_guestID);
$view->setParam('enablepasswordforgotten', $settings->_enablePasswordForgotten); $view->setParam('enablepasswordforgotten', $settings->_enablePasswordForgotten);
$view->setParam('referrer', $refer); $view->setParam('referrer', $refer);
$view->setParam('themes', $themes); $view->setParam('themes', $themes);

View File

@ -40,6 +40,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, 'userfile', 'adddocform'); $this->printFineUploaderJs('../op/op.UploadChunks.php', $partitionsize, $maxuploadsize, $enablemultiupload, 'userfile', 'adddocform');
} }
@ -79,16 +80,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) {
?> ?>
@ -179,6 +170,7 @@ $(document).ready(function() {
$accessop = $this->params['accessobject']; $accessop = $this->params['accessobject'];
$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');
@ -323,6 +332,9 @@ $(document).ready( function() {
$selattrdef = $this->params['selattrdef']; $selattrdef = $this->params['selattrdef'];
$accessop = $this->params['accessobject']; $accessop = $this->params['accessobject'];
$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();
@ -405,7 +417,7 @@ $(document).ready( function() {
$this->columnStart(6); $this->columnStart(6);
?> ?>
<?php if($accessop->check_view_access($this, array('action'=>'form'))) { ?> <?php if($accessop->check_view_access($this, array('action'=>'form'))) { ?>
<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 } ?>
<?php <?php
$this->columnEnd(); $this->columnEnd();

View File

@ -1463,6 +1463,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
function printFileChooserJs() { /* {{{ */ function printFileChooserJs() { /* {{{ */
?> ?>
$(document).ready(function() { $(document).ready(function() {
/* Triggered after the file has been selected */
$(document).on('change', '.btn-file :file', function() { $(document).on('change', '.btn-file :file', function() {
var input = $(this), var input = $(this),
numFiles = input.get(0).files ? input.get(0).files.length : 1, numFiles = input.get(0).files ? input.get(0).files.length : 1,
@ -1490,9 +1491,9 @@ $(document).ready(function() {
<div id="'.$id.'-upload-files"> <div id="'.$id.'-upload-files">
<div id="'.$id.'-upload-file" class="upload-file"> <div id="'.$id.'-upload-file" class="upload-file">
<div class="input-append"> <div class="input-append">
<input type="text" class="form-control" readonly> <input type="text" class="form-control" id="kkll'.$id.'" readonly>
<span class="btn btn-secondary btn-file"> <span class="btn btn-secondary btn-file">
'.getMLText("browse").'&hellip; <input id="'.$id.'" type="file" name="'.$varname.'"'.($multiple ? " multiple" : "").($accept ? ' accept="'.$accept.'"' : "").'> '.getMLText("browse").'&hellip; <input id="'.$id.'" type="file" name="'.$varname.'"'.($multiple ? " multiple" : "").($accept ? ' accept="'.$accept.'"' : "").' data-target-highlight="kkll'.$id.'">
</span> </span>
</div> </div>
</div> </div>
@ -1600,7 +1601,7 @@ $(document).ready(function() {
else else
$folderid = $folder->getID(); $folderid = $folder->getID();
$content = ''; $content = '';
$content .= "<input type=\"hidden\" id=\"".$formid."\" name=\"".$formname."\" value=\"". (($default) ? $default->getID() : "") ."\">"; $content .= "<input type=\"hidden\" id=\"".$formid."\" name=\"".$formname."\" data-target-highlight=\"choosedocsearch".$formid."\" value=\"". (($default) ? $default->getID() : "") ."\">";
$content .= "<div class=\"input-append\">\n"; $content .= "<div class=\"input-append\">\n";
$content .= "<input type=\"text\" id=\"choosedocsearch".$formid."\" data-target=\"".$formid."\" data-provide=\"typeahead\" name=\"docname".$formid."\" value=\"". (($default) ? htmlspecialchars($default->getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\"".($default ? ' title="'.htmlspecialchars($default->getFolder()->getFolderPathPlain().' / '.$default->getName()).'"' : '')." />"; $content .= "<input type=\"text\" id=\"choosedocsearch".$formid."\" data-target=\"".$formid."\" data-provide=\"typeahead\" name=\"docname".$formid."\" value=\"". (($default) ? htmlspecialchars($default->getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\"".($default ? ' title="'.htmlspecialchars($default->getFolder()->getFolderPathPlain().' / '.$default->getName()).'"' : '')." />";
$content .= "<button type=\"button\" class=\"btn\" id=\"cleardocument".$form."\" data-target=\"".$formid."\"><i class=\"fa fa-remove\"></i></button>"; $content .= "<button type=\"button\" class=\"btn\" id=\"cleardocument".$form."\" data-target=\"".$formid."\"><i class=\"fa fa-remove\"></i></button>";
@ -1664,7 +1665,7 @@ function folderSelected<?php echo $formid ?>(id, name) {
$formname = "targetid"; $formname = "targetid";
$formid = md5($formname.$form); $formid = md5($formname.$form);
$content = ''; $content = '';
$content .= "<input type=\"hidden\" id=\"".$formid."\" name=\"".$formname."\" value=\"". (($default) ? $default->getID() : "") ."\">"; $content .= "<input type=\"hidden\" id=\"".$formid."\" name=\"".$formname."\" value=\"". (($default) ? $default->getID() : "") ."\" data-target-highlight=\"choosefoldersearch".$formid."\">";
$content .= "<div class=\"input-append\">\n"; $content .= "<div class=\"input-append\">\n";
$content .= "<input type=\"text\" id=\"choosefoldersearch".$formid."\" data-target=\"".$formid."\" data-provide=\"typeahead\" name=\"targetname".$formid."\" value=\"". (($default) ? htmlspecialchars($default->getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" target=\"".$formid."\"".($default ? ' title="'.htmlspecialchars($default->getFolderPathPlain()).'"' : '')."/>"; $content .= "<input type=\"text\" id=\"choosefoldersearch".$formid."\" data-target=\"".$formid."\" data-provide=\"typeahead\" name=\"targetname".$formid."\" value=\"". (($default) ? htmlspecialchars($default->getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" target=\"".$formid."\"".($default ? ' title="'.htmlspecialchars($default->getFolderPathPlain()).'"' : '')."/>";
$content .= "<button type=\"button\" class=\"btn\" id=\"clearfolder".$formid."\" data-target=\"".$formid."\"><i class=\"fa fa-remove\"></i></button>"; $content .= "<button type=\"button\" class=\"btn\" id=\"clearfolder".$formid."\" data-target=\"".$formid."\"><i class=\"fa fa-remove\"></i></button>";

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());
@ -297,6 +281,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();
@ -335,7 +322,7 @@ $(document).ready( function() {
$this->columnStart(8); $this->columnStart(8);
if($accessop->check_view_access($this, array('action'=>'form'))) { if($accessop->check_view_access($this, array('action'=>'form'))) {
?> ?>
<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();

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'];
@ -112,6 +93,7 @@ $(document).ready( function() {
$enable2factauth = $this->params['enable2factauth']; $enable2factauth = $this->params['enable2factauth'];
$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();
@ -120,9 +102,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)."'/>";
} }
@ -187,13 +169,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

@ -133,9 +133,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();
} /* }}} */ } /* }}} */
@ -150,6 +174,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();
@ -159,7 +186,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(
@ -186,7 +213,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

@ -250,16 +250,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')); ?>
@ -672,9 +669,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) {
?> ?>
@ -156,6 +147,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,44 +36,52 @@ 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'));
$this->printFolderChooserJs("form"); $this->printFolderChooserJs("form");
?> ?>
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());
@ -237,7 +245,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');
@ -282,7 +290,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"));
@ -574,6 +582,9 @@ $(document).ready( function() {
$quota = $this->params['quota']; $quota = $this->params['quota'];
$accessobject = $this->params['accessobject']; $accessobject = $this->params['accessobject'];
$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();
@ -614,7 +625,7 @@ $(document).ready( function() {
$this->columnStart(8); $this->columnStart(8);
?> ?>
<?php if($accessobject->check_view_access($this, array('action'=>'form'))) { ?> <?php if($accessobject->check_view_access($this, array('action'=>'form'))) { ?>
<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>
<?php } ?> <?php } ?>
</div> </div>
<?php <?php

View File

@ -167,7 +167,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
$document = $this->params['document']; $document = $this->params['document'];
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(){ $(document).ready(function(){
$("#filterRecipientsInput").on("keyup", function() { $("#filterRecipientsInput").on("keyup", function() {
@ -184,10 +184,24 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
$latestContent = $document->getLatestContent(); $latestContent = $document->getLatestContent();
$this->printTimelineJs('out.ViewDocument.php?action=timelinedata&documentid='.$latestContent->getDocument()->getID(), 300, '', date('Y-m-d')); $this->printTimelineJs('out.ViewDocument.php?action=timelinedata&documentid='.$latestContent->getDocument()->getID(), 300, '', date('Y-m-d'));
} }
// $this->printDocumentChooserJs("form1");
$this->printDeleteDocumentButtonJs(); $this->printDeleteDocumentButtonJs();
/* Add js for catching click on document in one page mode */ /* Add js for catching click on document in one page mode */
$this->printClickDocumentJs(); $this->printClickDocumentJs();
?>
$(document).ready( function() {
$("#form1").validate({
ignore: [],
rules: {
docid: {
required: true
},
},
messages: {
docid: "<?php printMLText("js_no_document");?>",
},
});
});
<?php
} /* }}} */ } /* }}} */
function documentInfos() { /* {{{ */ function documentInfos() { /* {{{ */
@ -532,9 +546,11 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
$this->columnStart(4); $this->columnStart(4);
if ($file_exists) { if ($file_exists) {
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) { if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) {
print "<a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">"; if($accessobject->check_controller_access('ViewOnline', array('action'=>'run')))
print "<a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">";
} else { } else {
print "<a href=\"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">"; if($accessobject->check_controller_access('Download', array('action'=>'version')))
print "<a href=\"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">";
} }
} }
$previewer->createPreview($latestContent); $previewer->createPreview($latestContent);
@ -543,7 +559,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
} else { } else {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
} }
if ($file_exists) { if ($file_exists && ($accessobject->check_controller_access('ViewOnline', array('action'=>'run')) || $accessobject->check_controller_access('Download', array('action'=>'version')))) {
print "</a>"; print "</a>";
} }
// print "</td>\n"; // print "</td>\n";
@ -587,9 +603,11 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
$this->columnStart(4); $this->columnStart(4);
if ($file_exists){ if ($file_exists){
$items = array(); $items = array();
$items[] = array('link'=>"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'download', 'label'=>'download'); if($accessobject->check_controller_access('Download', array('action'=>'version')))
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) $items[] = array('link'=>"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'download', 'label'=>'download');
$items[] = array('link'=>"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion(), 'icon'=>'eye', 'label'=>'view_online', 'target'=>'_blank'); if($accessobject->check_controller_access('ViewOnline', array('action'=>'run')))
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes)))
$items[] = array('link'=>"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion(), 'icon'=>'eye', 'label'=>'view_online', 'target'=>'_blank');
if($newitems = $this->callHook('extraVersionViews', $latestContent)) if($newitems = $this->callHook('extraVersionViews', $latestContent))
$items = array_merge($items, $newitems); $items = array_merge($items, $newitems);
if($items) { if($items) {
@ -692,6 +710,8 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
$this->htmlAddHeader('<link href="../styles/bootstrap/timeline/timeline.css" rel="stylesheet">'."\n", 'css'); $this->htmlAddHeader('<link href="../styles/bootstrap/timeline/timeline.css" rel="stylesheet">'."\n", 'css');
$this->htmlAddHeader('<script type="text/javascript" src="../styles/bootstrap/timeline/timeline-min.js"></script>'."\n", 'js'); $this->htmlAddHeader('<script type="text/javascript" src="../styles/bootstrap/timeline/timeline-min.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="../styles/bootstrap/timeline/timeline-locales.js"></script>'."\n", 'js'); $this->htmlAddHeader('<script type="text/javascript" src="../styles/bootstrap/timeline/timeline-locales.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);
@ -882,6 +902,8 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
?> ?>
<div class="tab-pane <?php if($currenttab == 'revapp') echo 'active'; ?>" id="revapp" role="tabpanel"> <div class="tab-pane <?php if($currenttab == 'revapp') echo 'active'; ?>" id="revapp" role="tabpanel">
<?php <?php
if($document->hasExpired())
$this->warningMsg(getMLText('cannot_revapp_expired_docs'));
$this->rowStart(); $this->rowStart();
/* Just check fo an exting reviewStatus, even workflow mode is set /* Just check fo an exting reviewStatus, even workflow mode is set
* to traditional_only_approval. There may be old documents which * to traditional_only_approval. There may be old documents which
@ -1753,7 +1775,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
if ($accessobject->check_view_access('AddDocumentLink')){ if ($accessobject->check_view_access('AddDocumentLink')){
?> ?>
<br> <br>
<form action="../op/op.AddDocumentLink.php" name="form1" class="form-horizontal"> <form action="../op/op.AddDocumentLink.php" id="form1" name="form1" class="form-horizontal">
<input type="hidden" name="documentid" value="<?php print $documentid;?>"> <input type="hidden" name="documentid" value="<?php print $documentid;?>">
<?php echo createHiddenFieldWithKey('adddocumentlink'); ?> <?php echo createHiddenFieldWithKey('adddocumentlink'); ?>
<?php $this->contentContainerStart(); ?> <?php $this->contentContainerStart(); ?>

View File

@ -226,9 +226,9 @@ $('body').on('click', '.order-btn', function(ev) {
echo "SeedDMSUpload.setEditBtnLabel('".getMLText("edit_document_props")."');"; echo "SeedDMSUpload.setEditBtnLabel('".getMLText("edit_document_props")."');";
$mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize")); $mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
if($maxuploadsize && $maxuploadsize < $mus2) if($maxuploadsize && $maxuploadsize < $mus2)
echo "SeedDMSUpload.setMaxFileSize($maxuploadsize);"; echo "SeedDMSUpload.setMaxFileSize($maxuploadsize);\n";
else else
echo "SeedDMSUpload.setMaxFileSize($mus2);"; echo "SeedDMSUpload.setMaxFileSize($mus2);\n";
echo "SeedDMSUpload.setMaxFileSizeMsg('".getMLText("uploading_maxsize")."');"; echo "SeedDMSUpload.setMaxFileSizeMsg('".getMLText("uploading_maxsize")."');";
} }

View File

@ -33,33 +33,22 @@ class SeedDMS_View_WorkflowActionsMgr 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(num) function runValidation() {
{ $("#form1").validate({
msg = new Array() rules: {
name: {
if($("#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',
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();
});
$( "#selector" ).change(function() { $( "#selector" ).change(function() {
$('div.ajax').trigger('update', {workflowactionid: $(this).val()}); $('div.ajax').trigger('update', {workflowactionid: $(this).val()});
}); });
@ -106,21 +95,13 @@ $(document).ready( function() {
$selworkflowaction = $this->params['selworkflowaction']; $selworkflowaction = $this->params['selworkflowaction'];
if($selworkflowaction && !$selworkflowaction->isUsed()) { if($selworkflowaction && !$selworkflowaction->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_action"), 'link'=>'../op/op.RemoveWorkflowAction.php?workflowactionid='.$selworkflowaction->getID().'&formtoken='.createFormKey('removeworkflowaction'));
<ul class="dropdown-menu"> self::showButtonwithMenu($button);
<?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
} }
} /* }}} */ } /* }}} */
@ -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 <?php
if($action) { if($action) {
echo createHiddenFieldWithKey('editworkflowaction'); echo createHiddenFieldWithKey('editworkflowaction');
@ -176,6 +157,9 @@ $(document).ready( function() {
$workflowactions = $dms->getAllWorkflowActions(); $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->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation(); $this->globalNavigation();
$this->contentStart(); $this->contentStart();
@ -209,7 +193,7 @@ $(document).ready( function() {
$this->columnEnd(); $this->columnEnd();
$this->columnStart(8); $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>
</div> </div>

View File

@ -33,7 +33,23 @@ class SeedDMS_View_WorkflowMgr 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() {
$("#form1").validate({
rules: {
name: {
required: true
},
initstate: {
required: true
},
},
messages: {
name: "<?php printMLText("js_no_name");?>",
}
});
}
function checkForm(num) function checkForm(num)
{ {
@ -154,8 +170,7 @@ $(document).ready(function() {
} }
} }
?> ?>
<?php $this->contentContainerStart(); ?> <form class="form-horizontal" action="../op/op.WorkflowMgr.php" method="post" enctype="multipart/form-data" id="form1" name="form1">
<form class="form-horizontal" action="../op/op.WorkflowMgr.php" method="post" enctype="multipart/form-data">
<?php <?php
if($workflow) { if($workflow) {
echo createHiddenFieldWithKey('editworkflow'); echo createHiddenFieldWithKey('editworkflow');
@ -169,6 +184,7 @@ $(document).ready(function() {
<input type="hidden" name="action" value="addworkflow"> <input type="hidden" name="action" value="addworkflow">
<?php <?php
} }
$this->contentContainerStart();
$this->formField( $this->formField(
getMLText("workflow_name"), getMLText("workflow_name"),
array( array(
@ -191,10 +207,10 @@ $(document).ready(function() {
'options'=>$options 'options'=>$options
) )
); );
$this->contentContainerEnd();
$this->formSubmit('<i class="fa fa-save"></i> '.getMLText("save")); $this->formSubmit('<i class="fa fa-save"></i> '.getMLText("save"));
?> ?>
</form> </form>
<?php $this->contentContainerEnd(); ?>
<?php <?php
if($workflow) { if($workflow) {
$actions = $dms->getAllWorkflowActions(); $actions = $dms->getAllWorkflowActions();
@ -250,7 +266,7 @@ $(document).ready(function() {
} }
echo "</tbody></table>"; echo "</tbody></table>";
?> ?>
<form class="form-inline" action="../op/op.AddTransitionToWorkflow.php" method="post"> <form class="form-inline" action="../op/op.AddTransitionToWorkflow.php" method="post" id="form2" name="form2">
<?php <?php
echo "<table class=\"table table-condensed\"><thead></thead><tbody>"; echo "<table class=\"table table-condensed\"><thead></thead><tbody>";
echo "<tr>"; echo "<tr>";
@ -294,7 +310,7 @@ $(document).ready(function() {
?> ?>
<?php echo createHiddenFieldWithKey('addtransitiontoworkflow'); ?> <?php echo createHiddenFieldWithKey('addtransitiontoworkflow'); ?>
<input type="hidden" name="workflow" value="<?php print $workflow->getID();?>"> <input type="hidden" name="workflow" value="<?php print $workflow->getID();?>">
<input type="submit" class="btn" value="<?php printMLText("add");?>"> <input type="submit" class="btn btn-primary" value="<?php printMLText("add");?>">
<?php <?php
echo "</td>"; echo "</td>";
echo "</tr>\n"; echo "</tr>\n";
@ -319,6 +335,9 @@ $(document).ready(function() {
$workflows = $this->params['allworkflows']; $workflows = $this->params['allworkflows'];
$workflowstates = $this->params['allworkflowstates']; $workflowstates = $this->params['allworkflowstates'];
$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();
@ -352,7 +371,7 @@ $(document).ready(function() {
$this->columnEnd(); $this->columnEnd();
$this->columnStart(7); $this->columnStart(7);
?> ?>
<div class="ajax" data-view="WorkflowMgr" data-action="form" <?php echo ($selworkflow ? "data-query=\"workflowid=".$selworkflow->getID()."\"" : "") ?>></div> <div class="ajax" data-view="WorkflowMgr" data-action="form" data-afterload="()=>{runValidation();}" <?php echo ($selworkflow ? "data-query=\"workflowid=".$selworkflow->getID()."\"" : "") ?>></div>
<?php <?php
$this->columnEnd(); $this->columnEnd();
$this->rowEnd(); $this->rowEnd();

View File

@ -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();

View File

@ -0,0 +1,34 @@
jQuery.validator.setDefaults({
errorElement: "em",
errorClass: 'help-block',
errorPlacement: function ( error, element ) {
// Add the `error` class to the control-group
$(element).closest('.control-group').addClass('error');
if ( element.prop( "type" ) === "checkbox" ) {
error.insertAfter( element.parent( "label" ) );
} else {
error.insertAfter( element );
}
// Add the span element, if doesn't exists, and apply the icon classes to it.
if ( !element.next( "span" )[ 0 ] ) {
$( "<span class='glyphicon glyphicon-remove form-control-feedback'></span>" ).insertAfter( element );
}
},
invalidHandler: function(e, validator) {
noty({
text: (validator.numberOfInvalids() == 1) ? trans.js_form_error.replace('#', validator.numberOfInvalids()) : trans.js_form_errors.replace('#', validator.numberOfInvalids()),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 3500,
});
},
highlight: function ( element, errorClass, validClass ) {
$( element ).parents( ".control-group" ).addClass( "error" ).removeClass( "success" );
},
unhighlight: function ( element, errorClass, validClass ) {
$( element ).parents( ".control-group" ).addClass( "success" ).removeClass( "error" );
}
});

View File

@ -1086,7 +1086,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
function formField($title, $value, $params=array()) { /* {{{ */ function formField($title, $value, $params=array()) { /* {{{ */
if($title !== null) { if($title !== null) {
echo "<div class=\"form-group row\">"; echo "<div class=\"form-group row\">";
echo " <label class=\"col-sm-4 col-lg-4 pt-0 col-form-label\"".(!empty($params['help']) ? " title=\"".$params['help']."\" style=\"cursor: help;\"" : "").">".$title.":</label>"; echo " <label class=\"col-sm-4 col-lg-4 pt-0 col-form-label\"".(!empty($params['help']) ? " title=\"".$params['help']."\" style=\"cursor: help;\"" : "").(!empty($value['id']) ? ' for="'.$value['id'].'"' : '').">".$title.":</label>";
echo " <div class=\"col-sm-8 col-lg-8\">"; echo " <div class=\"col-sm-8 col-lg-8\">";
} }
if(isset($params['field_wrap'][0])) if(isset($params['field_wrap'][0]))
@ -1386,6 +1386,15 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
function printFileChooserJs() { /* {{{ */ function printFileChooserJs() { /* {{{ */
?> ?>
$(document).ready(function() { $(document).ready(function() {
/* do not use bootstrap4 custom form element because it is difficult to localize
$(document).on('change', '.custom-file-input',function(){
//get the file name
var fileName = $(this).val().replace(/\\/g, '/').replace(/.*\//, '');
//replace the "Choose a file" label
$(this).next('.custom-file-label').html(fileName);
})
*/
/* Triggered after the file has been selected */
$(document).on('change', '.btn-file :file', function() { $(document).on('change', '.btn-file :file', function() {
var input = $(this), var input = $(this),
numFiles = input.get(0).files ? input.get(0).files.length : 1, numFiles = input.get(0).files ? input.get(0).files.length : 1,
@ -1409,14 +1418,23 @@ $(document).ready(function() {
function getFileChooserHtml($varname='userfile', $multiple=false, $accept='') { /* {{{ */ function getFileChooserHtml($varname='userfile', $multiple=false, $accept='') { /* {{{ */
$id = preg_replace('/[^A-Za-z]/', '', $varname); $id = preg_replace('/[^A-Za-z]/', '', $varname);
/* do not use bootstrap4 custom form element because it is difficult to localize
$html = '
<div class="custom-file">
<input type="file" class="custom-file-input" id="'.$id.'" name="'.$varname.'">
<label class="custom-file-label" for="'.$id.'">'.getMLText("browse").'&hellip;'.'</label>
</div>
';
return $html;
*/
$html = ' $html = '
<div id="'.$id.'-upload-files"> <div id="'.$id.'-upload-files">
<div id="'.$id.'-upload-file" class="upload-file"> <div id="'.$id.'-upload-file" class="upload-file">
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control" readonly> <input type="text" class="form-control" id="kkll'.$id.'" readonly>
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-secondary btn-file"> <button class="btn btn-secondary btn-file">
'.getMLText("browse").'&hellip; <input id="'.$id.'" type="file" name="'.$varname.'"'.($multiple ? " multiple" : "").($accept ? ' accept="'.$accept.'"' : "").'"> '.getMLText("browse").'&hellip; <input id="'.$id.'" type="file" name="'.$varname.'"'.($multiple ? " multiple" : "").($accept ? ' accept="'.$accept.'"' : "").' data-target-highlight="kkll'.$id.'">
</button> </button>
</div> </div>
</div> </div>
@ -1528,7 +1546,7 @@ $(document).ready(function() {
else else
$folderid = $folder->getID(); $folderid = $folder->getID();
$content = ''; $content = '';
$content .= "<input type=\"hidden\" id=\"".$formid."\" name=\"".$formname."\" value=\"". (($default) ? $default->getID() : "") ."\">"; $content .= "<input type=\"hidden\" id=\"".$formid."\" name=\"".$formname."\" data-target-highlight=\"choosedocsearch".$formid."\" value=\"". (($default) ? $default->getID() : "") ."\">";
$content .= "<div class=\"input-group\">\n"; $content .= "<div class=\"input-group\">\n";
$content .= "<input class=\"form-control\" type=\"text\" id=\"choosedocsearch".$formid."\" data-target=\"".$formid."\" data-provide=\"typeahead\" name=\"docname".$formid."\"value=\"" . (($default) ? htmlspecialchars($default->getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" />"; $content .= "<input class=\"form-control\" type=\"text\" id=\"choosedocsearch".$formid."\" data-target=\"".$formid."\" data-provide=\"typeahead\" name=\"docname".$formid."\"value=\"" . (($default) ? htmlspecialchars($default->getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" />";
$content .= '<div class="input-group-append">'; $content .= '<div class="input-group-append">';
@ -1595,7 +1613,7 @@ function folderSelected<?php echo $formid ?>(id, name) {
$formname = "targetid"; $formname = "targetid";
$formid = md5($formname.$form); $formid = md5($formname.$form);
$content = ''; $content = '';
$content .= "<input type=\"hidden\" id=\"".$formid."\" name=\"".$formname."\" value=\"". (($default) ? $default->getID() : "") ."\">"; $content .= "<input type=\"hidden\" id=\"".$formid."\" name=\"".$formname."\" value=\"". (($default) ? $default->getID() : "") ."\" data-target-highlight=\"choosefoldersearch".$formid."\">";
$content .= "<div class=\"input-group\">\n"; $content .= "<div class=\"input-group\">\n";
$content .= "<input class=\"form-control\" type=\"text\" id=\"choosefoldersearch".$formid."\" data-target=\"".$formid."\" data-provide=\"typeahead\" name=\"targetname".$formid."\" value=\"". (($default) ? htmlspecialchars($default->getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" target=\"".$formid."\"/>"; $content .= "<input class=\"form-control\" type=\"text\" id=\"choosefoldersearch".$formid."\" data-target=\"".$formid."\" data-provide=\"typeahead\" name=\"targetname".$formid."\" value=\"". (($default) ? htmlspecialchars($default->getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" target=\"".$formid."\"/>";
$content .= '<div class="input-group-append">'; $content .= '<div class="input-group-append">';

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");

View File

@ -0,0 +1,33 @@
jQuery.validator.setDefaults({
errorElement: 'div',
errorClass: 'invalid-feedback',
errorPlacement: function(error, element) {
if(element.parent('.input-group').length) {
error.insertAfter(element.parent());
} else {
error.insertAfter(element);
}
},
invalidHandler: function(e, validator) {
noty({
text: (validator.numberOfInvalids() == 1) ? trans.js_form_error.replace('#', validator.numberOfInvalids()) : trans.js_form_errors.replace('#', validator.numberOfInvalids()),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 3500,
});
},
highlight: function (element, errorClass, validClass) {
if($(element).data('target-highlight'))
$('#'+$(element).data('target-highlight')).addClass('is-invalid');
else
$(element).addClass('is-invalid');
},
unhighlight: function (element, errorClass, validClass) {
if($(element).data('target-highlight'))
$('#'+$(element).data('target-highlight')).removeClass('is-invalid');
else
$(element).removeClass('is-invalid');
}
});

View File

@ -160,6 +160,8 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
require_once("../inc/inc.ClassLdapAuthentication.php"); require_once("../inc/inc.ClassLdapAuthentication.php");
$authobj = new SeedDMS_LdapAuthentication($this->dms, $settings); $authobj = new SeedDMS_LdapAuthentication($this->dms, $settings);
$userobj = $authobj->authenticate($user, $pass); $userobj = $authobj->authenticate($user, $pass);
if($userobj && $this->logger)
$this->logger->log('check_auth: type='.$type.', user='.$user.' authenticated against LDAP', PEAR_LOG_INFO);
} /* }}} */ } /* }}} */
/* Authenticate against SeedDMS database {{{ */ /* Authenticate against SeedDMS database {{{ */
@ -167,6 +169,8 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
require_once("../inc/inc.ClassDbAuthentication.php"); require_once("../inc/inc.ClassDbAuthentication.php");
$authobj = new SeedDMS_DbAuthentication($this->dms, $settings); $authobj = new SeedDMS_DbAuthentication($this->dms, $settings);
$userobj = $authobj->authenticate($user, $pass); $userobj = $authobj->authenticate($user, $pass);
if($userobj && $this->logger)
$this->logger->log('check_auth: type='.$type.', user='.$user.' authenticated against database', PEAR_LOG_INFO);
} /* }}} */ } /* }}} */
if(!$userobj) { if(!$userobj) {