mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-10-11 03:23:17 +00:00
fix form validation, sync with UpdateDocument
This commit is contained in:
parent
74d1b11250
commit
4401ce7b23
|
@ -186,8 +186,8 @@ else
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_POST["attributes"]) && $_POST["attributes"]) {
|
if(isset($_POST["attributes_version"]) && $_POST["attributes_version"]) {
|
||||||
$attributes = $_POST["attributes"];
|
$attributes = $_POST["attributes_version"];
|
||||||
foreach($attributes as $attrdefid=>$attribute) {
|
foreach($attributes as $attrdefid=>$attribute) {
|
||||||
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
//require_once("class.Bootstrap.php");
|
//require_once("class.Bootstrap.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class which outputs the html page for Document view
|
* Class which outputs the html page for CheckInDocument view
|
||||||
*
|
*
|
||||||
* @category DMS
|
* @category DMS
|
||||||
* @package SeedDMS
|
* @package SeedDMS
|
||||||
|
@ -30,39 +30,18 @@ class SeedDMS_View_CheckInDocument 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->printSelectPresetButtonJs();
|
$this->printSelectPresetButtonJs();
|
||||||
$this->printInputPresetButtonJs();
|
$this->printInputPresetButtonJs();
|
||||||
$this->printCheckboxPresetButtonJs();
|
$this->printCheckboxPresetButtonJs();
|
||||||
?>
|
?>
|
||||||
function checkForm()
|
|
||||||
{
|
|
||||||
msg = new Array();
|
|
||||||
<?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;
|
messages: {
|
||||||
event.preventDefault();
|
name: "<?php printMLText("js_no_name");?>",
|
||||||
|
comment: "<?php printMLText("js_no_comment");?>",
|
||||||
|
keywords: "<?php printMLText("js_no_keywords");?>"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
$('#presetexpdate').on('change', function(ev){
|
$('#presetexpdate').on('change', function(ev){
|
||||||
if($(this).val() == 'date')
|
if($(this).val() == 'date')
|
||||||
|
@ -86,12 +65,16 @@ $(document).ready(function() {
|
||||||
$enableadminrevapp = $this->params['enableadminrevapp'];
|
$enableadminrevapp = $this->params['enableadminrevapp'];
|
||||||
$enableownerrevapp = $this->params['enableownerrevapp'];
|
$enableownerrevapp = $this->params['enableownerrevapp'];
|
||||||
$enableselfrevapp = $this->params['enableselfrevapp'];
|
$enableselfrevapp = $this->params['enableselfrevapp'];
|
||||||
$enableselfreceipt = $this->params['enableselfreceipt'];
|
|
||||||
$enablereceiptworkflow = $this->params['enablereceiptworkflow'];
|
$enablereceiptworkflow = $this->params['enablereceiptworkflow'];
|
||||||
|
$enableselfreceipt = $this->params['enableselfreceipt'];
|
||||||
$workflowmode = $this->params['workflowmode'];
|
$workflowmode = $this->params['workflowmode'];
|
||||||
$presetexpiration = $this->params['presetexpiration'];
|
$presetexpiration = $this->params['presetexpiration'];
|
||||||
$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/additional-methods.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();
|
||||||
|
@ -114,6 +97,7 @@ $(document).ready(function() {
|
||||||
{
|
{
|
||||||
printMLText("no_update_cause_locked");
|
printMLText("no_update_cause_locked");
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
$this->contentEnd();
|
||||||
$this->htmlEndPage();
|
$this->htmlEndPage();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -140,8 +124,8 @@ $(document).ready(function() {
|
||||||
|
|
||||||
$latestContent = $document->getLatestContent();
|
$latestContent = $document->getLatestContent();
|
||||||
$reviewStatus = $latestContent->getReviewStatus();
|
$reviewStatus = $latestContent->getReviewStatus();
|
||||||
$approvalStatus = $latestContent->getApprovalStatus();
|
|
||||||
$receiptStatus = $latestContent->getReceiptStatus();
|
$receiptStatus = $latestContent->getReceiptStatus();
|
||||||
|
$approvalStatus = $latestContent->getApprovalStatus();
|
||||||
if($workflowmode == 'advanced') {
|
if($workflowmode == 'advanced') {
|
||||||
if($status = $latestContent->getStatus()) {
|
if($status = $latestContent->getStatus()) {
|
||||||
if($status["status"] == S_IN_WORKFLOW) {
|
if($status["status"] == S_IN_WORKFLOW) {
|
||||||
|
@ -193,7 +177,7 @@ $(document).ready(function() {
|
||||||
);
|
);
|
||||||
$this->formField(
|
$this->formField(
|
||||||
getMLText("expires"),
|
getMLText("expires"),
|
||||||
$this->getDateChooser(($expts ? date('Y-m-d', $expts) : ''), "expdate", $this->params['session']->getLanguage())
|
$this->getDateChooser(($expts ? getReadableDate($expts) : ''), "expdate", $this->params['session']->getLanguage())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all));
|
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all));
|
||||||
|
@ -206,11 +190,11 @@ $(document).ready(function() {
|
||||||
} elseif(is_string($arr)) {
|
} elseif(is_string($arr)) {
|
||||||
echo $arr;
|
echo $arr;
|
||||||
} else {
|
} else {
|
||||||
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, $document->getAttribute($attrdef)));
|
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, $document->getAttribute($attrdef), 'attributes_version'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$arrs = $this->callHook('addDocumentContentAttributes', $folder);
|
$arrs = $this->callHook('addDocumentContentAttributes', $document);
|
||||||
if(is_array($arrs)) {
|
if(is_array($arrs)) {
|
||||||
foreach($arrs as $arr) {
|
foreach($arrs as $arr) {
|
||||||
$this->formField($arr[0], $arr[1], isset($arr[2]) ? $arr[2] : null);
|
$this->formField($arr[0], $arr[1], isset($arr[2]) ? $arr[2] : null);
|
||||||
|
@ -219,6 +203,7 @@ $(document).ready(function() {
|
||||||
echo $arrs;
|
echo $arrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$docAccess = $document->getReadAccessList($enableadminrevapp, $enableownerrevapp);
|
||||||
if($workflowmode == 'advanced') {
|
if($workflowmode == 'advanced') {
|
||||||
$mandatoryworkflows = $user->getMandatoryWorkflows();
|
$mandatoryworkflows = $user->getMandatoryWorkflows();
|
||||||
if($mandatoryworkflows) {
|
if($mandatoryworkflows) {
|
||||||
|
@ -266,7 +251,6 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
$this->warningMsg(getMLText("add_doc_workflow_warning"));
|
$this->warningMsg(getMLText("add_doc_workflow_warning"));
|
||||||
} elseif($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
|
} elseif($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
|
||||||
$docAccess = $document->getReadAccessList($enableadminrevapp, $enableownerrevapp);
|
|
||||||
if($workflowmode == 'traditional') {
|
if($workflowmode == 'traditional') {
|
||||||
$this->contentSubHeading(getMLText("assign_reviewers"));
|
$this->contentSubHeading(getMLText("assign_reviewers"));
|
||||||
$res=$user->getMandatoryReviewers();
|
$res=$user->getMandatoryReviewers();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user