* @copyright Copyright (C) 2002-2005 Markus Westphal, * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, * 2010-2012 Uwe Steinmann * @version Release: @package_version@ */ /** * Include parent class */ require_once("class.Bootstrap.php"); /** * Class which outputs the html page for AddDocument view * * @category DMS * @package SeedDMS * @author Markus Westphal, Malcolm Cowe, Uwe Steinmann * @copyright Copyright (C) 2002-2005 Markus Westphal, * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, * 2010-2012 Uwe Steinmann * @version Release: @package_version@ */ class SeedDMS_View_AddDocument extends SeedDMS_Bootstrap_Style { function js() { /* {{{ */ $strictformcheck = $this->params['strictformcheck']; $dropfolderdir = $this->params['dropfolderdir']; header('Content-Type: application/javascript; charset=UTF-8'); ?> function checkForm() { msg = new Array(); //if (document.form1.userfile[].value == "") msg += "\n"; if(!document.form1.name.disabled){ if (document.form1.name.value == "") msg.push(""); } if (document.form1.comment.value == "") msg.push(""); if (document.form1.keywords.value == "") msg.push(""); if (msg != ""){ noty({ text: msg.join('
'), type: 'error', dismissQueue: true, layout: 'topRight', theme: 'defaultTheme', _timeout: 1500, }); return false; } return true; } $(document).ready(function() { $('body').on('submit', '#form1', function(ev){ if(checkForm()) return; ev.preventDefault(); }); $('#new-file').click(function(event) { $("#upload-file").clone().appendTo("#upload-files").removeAttr("id").children('div').children('input').val(''); }); jQuery.validator.addMethod("alternatives", function(value, element, params) { if(value == '' && params.val() == '') return false; return true; }, ""); $("#form1").validate({ invalidHandler: function(e, validator) { noty({ text: (validator.numberOfInvalids() == 1) ? "".replace('#', validator.numberOfInvalids()) : "".replace('#', validator.numberOfInvalids()), type: 'error', dismissQueue: true, layout: 'topRight', theme: 'defaultTheme', timeout: 1500, }); }, rules: { 'userfile[]': { alternatives: $('#dropfolderfileform1') }, dropfolderfileform1: { alternatives: $(".btn-file input") } }, messages: { name: "", comment: "", keywords: "" }, errorPlacement: function( error, element ) { if ( element.is( ":file" ) ) { error.appendTo( element.parent().parent().parent()); console.log(element); } else { error.appendTo( element.parent()); } } }); }); printKeywordChooserJs("form1"); if($dropfolderdir) { $this->printDropFolderChooserJs("form1"); } } /* }}} */ function show() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; $folder = $this->params['folder']; $enablelargefileupload = $this->params['enablelargefileupload']; $enableadminrevapp = $this->params['enableadminrevapp']; $enableownerrevapp = $this->params['enableownerrevapp']; $enableselfrevapp = $this->params['enableselfrevapp']; $strictformcheck = $this->params['strictformcheck']; $dropfolderdir = $this->params['dropfolderdir']; $workflowmode = $this->params['workflowmode']; $presetexpiration = $this->params['presetexpiration']; $sortusersinlist = $this->params['sortusersinlist']; $orderby = $this->params['orderby']; $folderid = $folder->getId(); $this->htmlAddHeader(''."\n", 'js'); $this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName())))); $this->globalNavigation($folder); $this->contentStart(); $this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder); $msg = getMLText("max_upload_size").": ".ini_get( "upload_max_filesize"); if($enablelargefileupload) { $msg .= "

".sprintf(getMLText('link_alt_updatedocument'), "out.AddMultiDocument.php?folderid=".$folderid."&showtree=".showtree())."

"; } $this->warningMsg($msg); $this->contentHeading(getMLText("add_document")); $this->contentContainerStart(); // Retrieve a list of all users and groups that have review / approve // privileges. $docAccess = $folder->getReadAccessList($enableadminrevapp, $enableownerrevapp); ?>
isAdmin()) { ?> getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_all)); if($attrdefs) { foreach($attrdefs as $attrdef) { ?> getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all)); if($attrdefs) { foreach($attrdefs as $attrdef) { ?>
contentSubHeading(getMLText("document_infos")); ?>
:
:
: printKeywordChooserHtml("form1");?>
:
: printSequenceChooser($folder->getDocuments('s')); if($orderby != 's') echo "
".getMLText('order_by_sequence_off'); ?>
:
getName()); ?> printAttributeEditField($attrdef, '') ?>
:  
contentSubHeading(getMLText("version_info")); ?>
:
: printFileChooser('userfile[]', false); ?>
: printDropFolderChooserHtml("form1");?>
:
getName()); ?> printAttributeEditField($attrdef, '', 'attributes_version') ?>
:
getMandatoryWorkflows(); if($mandatoryworkflows) { if(count($mandatoryworkflows) == 1) { ?> getName()); ?>
warningMsg(getMLText("add_doc_workflow_warning")); ?>
contentSubHeading(getMLText("assign_reviewers")); ?>
:
getMandatoryReviewers(); ?> 0) { $u = $dms->getUser($r['reviewerUserID']); $tmp[] = htmlspecialchars($u->getFullName().' ('.$u->getLogin().')'); } } if($tmp) { echo '
'.getMLText('mandatory_reviewers').': '; echo implode(', ', $tmp); echo "
\n"; } } /* Check for mandatory reviewer without access */ foreach($res as $r) { if($r['reviewerUserID']) { $hasAccess = false; foreach ($docAccess["users"] as $usr) { if ($r['reviewerUserID']==$usr->getID()) $hasAccess = true; } if(!$hasAccess) { $noAccessUser = $dms->getUser($r['reviewerUserID']); echo "
".getMLText("mandatory_reviewer_no_access", array('user'=>htmlspecialchars($noAccessUser->getFullName()." (".$noAccessUser->getLogin().")")))."
"; } } } ?>
:
0) { $u = $dms->getGroup($r['reviewerGroupID']); $tmp[] = htmlspecialchars($u->getName()); } } if($tmp) { echo '
'.getMLText('mandatory_reviewergroups').': '; echo implode(', ', $tmp); echo "
\n"; } } /* Check for mandatory reviewer group without access */ foreach($res as $r) { if ($r['reviewerGroupID']) { $hasAccess = false; foreach ($docAccess["groups"] as $grp) { if ($r['reviewerGroupID']==$grp->getID()) $hasAccess = true; } if(!$hasAccess) { $noAccessGroup = $dms->getGroup($r['reviewerGroupID']); echo "
".getMLText("mandatory_reviewergroup_no_access", array('group'=>htmlspecialchars($noAccessGroup->getName())))."
"; } } } ?>
contentSubHeading(getMLText("assign_approvers")); ?>
:
0) { $u = $dms->getUser($r['approverUserID']); $tmp[] = htmlspecialchars($u->getFullName().' ('.$u->getLogin().')'); } } if($tmp) { echo '
'.getMLText('mandatory_approvers').': '; echo implode(', ', $tmp); echo "
\n"; } } /* Check for mandatory approvers without access */ foreach($res as $r) { if($r['approverUserID']) { $hasAccess = false; foreach ($docAccess["users"] as $usr) { if ($r['approverUserID']==$usr->getID()) $hasAccess = true; } if(!$hasAccess) { $noAccessUser = $dms->getUser($r['approverUserID']); echo "
".getMLText("mandatory_approver_no_access", array('user'=>htmlspecialchars($noAccessUser->getFullName()." (".$noAccessUser->getLogin().")")))."
"; } } } ?>
:
0) { $u = $dms->getGroup($r['approverGroupID']); $tmp[] = htmlspecialchars($u->getName()); } } if($tmp) { echo '
'.getMLText('mandatory_approvergroups').': '; echo implode(', ', $tmp); echo "
\n"; } } /* Check for mandatory approver groups without access */ foreach($res as $r) { if ($r['approverGroupID']) { $hasAccess = false; foreach ($docAccess["groups"] as $grp) { if ($r['approverGroupID']==$grp->getID()) $hasAccess = true; } if(!$hasAccess) { $noAccessGroup = $dms->getGroup($r['approverGroupID']); echo "
".getMLText("mandatory_approvergroup_no_access", array('group'=>htmlspecialchars($noAccessGroup->getName())))."
"; } } } ?>
contentSubHeading(getMLText("add_document_notify")); ?>
:
:

">

contentContainerEnd(); $this->contentEnd(); $this->htmlEndPage(); } /* }}} */ } ?>