mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 00:45:34 +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"]) {
|
||||
$attributes = $_POST["attributes"];
|
||||
if(isset($_POST["attributes_version"]) && $_POST["attributes_version"]) {
|
||||
$attributes = $_POST["attributes_version"];
|
||||
foreach($attributes as $attrdefid=>$attribute) {
|
||||
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
||||
if($attribute) {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
//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
|
||||
* @package SeedDMS
|
||||
|
@ -30,39 +30,18 @@ class SeedDMS_View_CheckInDocument extends SeedDMS_Theme_Style {
|
|||
function js() { /* {{{ */
|
||||
$strictformcheck = $this->params['strictformcheck'];
|
||||
header('Content-Type: application/javascript; charset=UTF-8');
|
||||
parent::jsTranslations(array('js_form_error', 'js_form_errors'));
|
||||
$this->printSelectPresetButtonJs();
|
||||
$this->printInputPresetButtonJs();
|
||||
$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() {
|
||||
$('body').on('submit', '#form1', function(ev){
|
||||
if(checkForm()) return;
|
||||
event.preventDefault();
|
||||
$("#form1").validate({
|
||||
messages: {
|
||||
name: "<?php printMLText("js_no_name");?>",
|
||||
comment: "<?php printMLText("js_no_comment");?>",
|
||||
keywords: "<?php printMLText("js_no_keywords");?>"
|
||||
}
|
||||
});
|
||||
$('#presetexpdate').on('change', function(ev){
|
||||
if($(this).val() == 'date')
|
||||
|
@ -86,12 +65,16 @@ $(document).ready(function() {
|
|||
$enableadminrevapp = $this->params['enableadminrevapp'];
|
||||
$enableownerrevapp = $this->params['enableownerrevapp'];
|
||||
$enableselfrevapp = $this->params['enableselfrevapp'];
|
||||
$enableselfreceipt = $this->params['enableselfreceipt'];
|
||||
$enablereceiptworkflow = $this->params['enablereceiptworkflow'];
|
||||
$enableselfreceipt = $this->params['enableselfreceipt'];
|
||||
$workflowmode = $this->params['workflowmode'];
|
||||
$presetexpiration = $this->params['presetexpiration'];
|
||||
$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->globalNavigation($folder);
|
||||
$this->contentStart();
|
||||
|
@ -114,6 +97,7 @@ $(document).ready(function() {
|
|||
{
|
||||
printMLText("no_update_cause_locked");
|
||||
print "</div>";
|
||||
$this->contentEnd();
|
||||
$this->htmlEndPage();
|
||||
exit;
|
||||
}
|
||||
|
@ -140,8 +124,8 @@ $(document).ready(function() {
|
|||
|
||||
$latestContent = $document->getLatestContent();
|
||||
$reviewStatus = $latestContent->getReviewStatus();
|
||||
$approvalStatus = $latestContent->getApprovalStatus();
|
||||
$receiptStatus = $latestContent->getReceiptStatus();
|
||||
$approvalStatus = $latestContent->getApprovalStatus();
|
||||
if($workflowmode == 'advanced') {
|
||||
if($status = $latestContent->getStatus()) {
|
||||
if($status["status"] == S_IN_WORKFLOW) {
|
||||
|
@ -193,7 +177,7 @@ $(document).ready(function() {
|
|||
);
|
||||
$this->formField(
|
||||
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));
|
||||
|
@ -206,11 +190,11 @@ $(document).ready(function() {
|
|||
} elseif(is_string($arr)) {
|
||||
echo $arr;
|
||||
} 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)) {
|
||||
foreach($arrs as $arr) {
|
||||
$this->formField($arr[0], $arr[1], isset($arr[2]) ? $arr[2] : null);
|
||||
|
@ -219,6 +203,7 @@ $(document).ready(function() {
|
|||
echo $arrs;
|
||||
}
|
||||
|
||||
$docAccess = $document->getReadAccessList($enableadminrevapp, $enableownerrevapp);
|
||||
if($workflowmode == 'advanced') {
|
||||
$mandatoryworkflows = $user->getMandatoryWorkflows();
|
||||
if($mandatoryworkflows) {
|
||||
|
@ -266,7 +251,6 @@ $(document).ready(function() {
|
|||
}
|
||||
$this->warningMsg(getMLText("add_doc_workflow_warning"));
|
||||
} elseif($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
|
||||
$docAccess = $document->getReadAccessList($enableadminrevapp, $enableownerrevapp);
|
||||
if($workflowmode == 'traditional') {
|
||||
$this->contentSubHeading(getMLText("assign_reviewers"));
|
||||
$res=$user->getMandatoryReviewers();
|
||||
|
|
Loading…
Reference in New Issue
Block a user