From 4401ce7b23f3bb396b263d2223bdd74bd7ab7b75 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 14 Jul 2021 21:09:28 +0200 Subject: [PATCH 01/15] fix form validation, sync with UpdateDocument --- op/op.CheckInDocument.php | 4 +- views/bootstrap/class.CheckInDocument.php | 54 ++++++++--------------- 2 files changed, 21 insertions(+), 37 deletions(-) diff --git a/op/op.CheckInDocument.php b/op/op.CheckInDocument.php index 94bf8d768..41f4a1407 100644 --- a/op/op.CheckInDocument.php +++ b/op/op.CheckInDocument.php @@ -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) { diff --git a/views/bootstrap/class.CheckInDocument.php b/views/bootstrap/class.CheckInDocument.php index 8fe539ab5..4dbe2b4e4 100644 --- a/views/bootstrap/class.CheckInDocument.php +++ b/views/bootstrap/class.CheckInDocument.php @@ -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(); - - if (document.form1.comment.value == "") msg.push(""); - - if (msg != "") - { - noty({ - text: msg.join('
'), - 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: "", + comment: "", + 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(''."\n", 'js'); + $this->htmlAddHeader(''."\n", 'js'); + $this->htmlAddHeader(''."\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 ""; + $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(); From 9b6f376be852f04dd26093e5846ded72ee806291 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 14 Jul 2021 21:10:21 +0200 Subject: [PATCH 02/15] get access list before checking for workflow mode --- views/bootstrap/class.UpdateDocument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/bootstrap/class.UpdateDocument.php b/views/bootstrap/class.UpdateDocument.php index bb0346167..197202e8a 100644 --- a/views/bootstrap/class.UpdateDocument.php +++ b/views/bootstrap/class.UpdateDocument.php @@ -301,6 +301,7 @@ console.log(element); echo $arrs; } + $docAccess = $document->getReadAccessList($enableadminrevapp, $enableownerrevapp); if($workflowmode == 'advanced') { $mandatoryworkflows = $user->getMandatoryWorkflows(); if($mandatoryworkflows) { @@ -348,7 +349,6 @@ console.log(element); } $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(); From c1a2411882084d4de3e3d52467fa4b5a9f9a7ebf Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 15 Jul 2021 17:43:50 +0200 Subject: [PATCH 03/15] remove plain html for error and warning msgs --- views/bootstrap/class.Bootstrap.php | 16 ++++++++-------- views/bootstrap/class.ImportFS.php | 4 +--- views/bootstrap/class.ObjectCheck.php | 2 +- views/bootstrap/class.Setup2Factor.php | 2 +- views/bootstrap/class.TransferObjects.php | 6 +----- views/bootstrap/class.UpdateDocument.php | 15 +++++++-------- views/bootstrap/class.ViewDocument.php | 6 +----- views/bootstrap4/class.Bootstrap4.php | 16 ++++++++-------- 8 files changed, 28 insertions(+), 39 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index d6c611ede..c6a02bf0c 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -2003,10 +2003,10 @@ $(document).ready(function() { $this->contentStart(); } - print "
"; - print "

".getMLText('error')."!

"; - print htmlspecialchars($error); - print "
"; + $html = ''; + $html .= "

".getMLText('error')."!

"; + $html .= htmlspecialchars($error); + $this->errorMsg($html); if(!$plain) { print "
"; @@ -3151,10 +3151,10 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $this->contentStart(); } - print "
"; - print "

".getMLText('error')."!

"; - print htmlspecialchars($errormsg); - print "
"; + $html = ''; + $html .= "

".getMLText('error')."!

"; + $html .= htmlspecialchars($errormsg); + $this->errorMsg($html); print "
"; $this->contentEnd(); diff --git a/views/bootstrap/class.ImportFS.php b/views/bootstrap/class.ImportFS.php index 18cde7b80..7ef06f0ab 100644 --- a/views/bootstrap/class.ImportFS.php +++ b/views/bootstrap/class.ImportFS.php @@ -94,9 +94,7 @@ class SeedDMS_View_ImportFS extends SeedDMS_Theme_Style { print "\n"; $this->contentContainerEnd(); } else { - echo "
"; - printMLText("dropfolderdir_missing"); - echo "
\n"; + $this->warningMsg(getMLText("dropfolderdir_missing")); } $this->contentEnd(); diff --git a/views/bootstrap/class.ObjectCheck.php b/views/bootstrap/class.ObjectCheck.php index 52af51825..a6d31147f 100644 --- a/views/bootstrap/class.ObjectCheck.php +++ b/views/bootstrap/class.ObjectCheck.php @@ -204,7 +204,7 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Theme_Style { $this->contentHeading(getMLText("objectcheck")); if($repair) { - echo "
".getMLText('repairing_objects')."
"; + $this->infoMsg(getMLText('repairing_objects')); } $this->contentContainerStart(); print ""; diff --git a/views/bootstrap/class.Setup2Factor.php b/views/bootstrap/class.Setup2Factor.php index 59f5f2d2d..6c6cfd2b4 100644 --- a/views/bootstrap/class.Setup2Factor.php +++ b/views/bootstrap/class.Setup2Factor.php @@ -76,7 +76,7 @@ $(document).ready( function() { $this->contentStart(); $this->pageNavigation(getMLText("my_account"), "my_account"); $this->contentHeading(getMLText('2_factor_auth')); - echo "
".getMLText('2_factor_auth_info')."
"; + $this->infoMsg(getMLText('2_factor_auth_info')); $this->rowStart(); $this->contentContainerStart('span6'); diff --git a/views/bootstrap/class.TransferObjects.php b/views/bootstrap/class.TransferObjects.php index 9f409e24b..ddcdb7974 100644 --- a/views/bootstrap/class.TransferObjects.php +++ b/views/bootstrap/class.TransferObjects.php @@ -39,11 +39,7 @@ class SeedDMS_View_TransferObjects extends SeedDMS_Theme_Style { $this->pageNavigation(getMLText("admin_tools"), "admin_tools"); $this->contentHeading(getMLText("transfer_objects")); -?> -
- htmlspecialchars($rmuser->getFullName())));?> -
-warningMsg(getMLText("confirm_transfer_objects", array ("username" => htmlspecialchars($rmuser->getFullName())))); $this->contentContainerStart(); ?> diff --git a/views/bootstrap/class.UpdateDocument.php b/views/bootstrap/class.UpdateDocument.php index 197202e8a..be77bbc42 100644 --- a/views/bootstrap/class.UpdateDocument.php +++ b/views/bootstrap/class.UpdateDocument.php @@ -164,24 +164,23 @@ console.log(element); $lockingUser = $document->getLockingUser(); - print "
"; - - printMLText("update_locked_msg", array("username" => htmlspecialchars($lockingUser->getFullName()), "email" => $lockingUser->getEmail())); + $html = ''; + $html .= getMLText("update_locked_msg", array("username" => htmlspecialchars($lockingUser->getFullName()), "email" => $lockingUser->getEmail())).' '; if ($lockingUser->getID() == $user->getID()) - printMLText("unlock_cause_locking_user"); + $html .= getMLText("unlock_cause_locking_user"); else if ($document->getAccessMode($user) == M_ALL) - printMLText("unlock_cause_access_mode_all"); + $html .= getMLText("unlock_cause_access_mode_all"); else { - printMLText("no_update_cause_locked"); - print "
"; + $html .= getMLText("no_update_cause_locked"); + $this->warningMsg($html); $this->contentEnd(); $this->htmlEndPage(); exit; } - print ""; + $this->warningMsg($html); } $latestContent = $document->getLatestContent(); diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index 240ca35b7..3fefb36e3 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -686,11 +686,7 @@ $(document).ready( function() { if(is_string($txt)) echo $txt; else { -?> -
- $lockingUser->getEmail(), "username" => htmlspecialchars($lockingUser->getFullName())));?> -
-warningMsg(getMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => htmlspecialchars($lockingUser->getFullName())))); } } diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 4cb3ff9da..d7e668aa7 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -2050,10 +2050,10 @@ $(document).ready(function() { $this->contentStart(); } - print "
"; - print "

".getMLText('error')."!

"; - print htmlspecialchars($error); - print "
"; + $html = ''; + $html .= "

".getMLText('error')."!

"; + $html .= htmlspecialchars($error); + $this->errorMsg($html); if(!$plain) { print "
"; @@ -3222,10 +3222,10 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $this->contentStart(); } - print "
"; - print "

".getMLText('error')."!

"; - print htmlspecialchars($errormsg); - print "
"; + $html = ''; + $html .= "

".getMLText('error')."!

"; + $html .= htmlspecialchars($errormsg); + $this->errorMsg($html); print "
"; $this->contentEnd(); From 0072efd2ff43fe0d5f39b54757394f1fc104e322 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 16 Jul 2021 15:55:47 +0200 Subject: [PATCH 04/15] new command 'addfile' for adding attachments --- op/op.Ajax.php | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/op/op.Ajax.php b/op/op.Ajax.php index 6a89526cb..af947601e 100644 --- a/op/op.Ajax.php +++ b/op/op.Ajax.php @@ -830,6 +830,83 @@ switch($command) { } break; /* }}} */ + case 'addfile': /* {{{ */ + if($user) { + if(checkFormKey('addfile')) { + if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval($_POST["documentid"])<1) { + header('Content-Type: application/json'); + echo json_encode(array('success'=>false, 'message'=>getMLText("invalid_doc_id"))); + exit; + } + + $documentid = $_POST["documentid"]; + $document = $dms->getDocument($documentid); + + if (!is_object($document)) { + header('Content-Type: application/json'); + echo json_encode(array('success'=>false, 'message'=>getMLText("invalid_doc_id"))); + exit; + } + + if ($document->getAccessMode($user, 'addDocumentFile') < M_READWRITE) { + header('Content-Type: application/json'); + echo json_encode(array('success'=>false, 'message'=>getMLText("access_denied"))); + exit; + } + + if (!is_uploaded_file($_FILES["userfile"]["tmp_name"]) || $_FILES['userfile']['error']!=0){ + header('Content-Type: application/json'); + echo json_encode(array('success'=>false, 'message'=>getMLText("uploading_failed"))); + exit; + } + if ($_FILES["userfile"]["size"]==0) { + header('Content-Type: application/json'); + echo json_encode(array('success'=>false, 'message'=>getMLText("uploading_zerosize"))); + exit; + } + + $maxuploadsize = SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize); + if ($maxuploadsize && $_FILES["userfile"]["size"] > $maxuploadsize) { + header('Content-Type: application/json'); + echo json_encode(array('success'=>false, 'message'=>getMLText("uploading_maxsize"))); + exit; + } + + $userfiletmp = $_FILES["userfile"]["tmp_name"]; + $userfiletype = $_FILES["userfile"]["type"]; + $userfilename = $_FILES["userfile"]["name"]; + + $fileType = ".".pathinfo($userfilename, PATHINFO_EXTENSION); + + if($settings->_overrideMimeType) { + $finfo = finfo_open(FILEINFO_MIME_TYPE); + $userfiletype = finfo_file($finfo, $userfiletmp); + } + + if (!empty($_POST["name"])) + $name = $_POST["name"]; + else + $name = utf8_basename($userfilename); + $comment = ''; + $version = 0; + $public = false; + $res = $document->addDocumentFile($name, $comment, $user, $userfiletmp, + utf8_basename($userfilename),$fileType, $userfiletype, $version, $public); + if (is_bool($res) && !$res) { + header('Content-Type: application/json'); + echo json_encode(array('success'=>false, 'message'=>getMLText('error_occured'), 'data'=>'')); + } else { + header('Content-Type: application/json'); + echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_added'), 'data'=>$document->getID())); + add_log_line(); + } + } else { + header('Content-Type: application/json'); + echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>'')); + } + } + break; /* }}} */ + case 'indexdocument': case 'indexfolder': /* {{{ */ if($user && $user->isAdmin()) { From 9c66a9350a017deea32935f9ef9fc1c2298206ac Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 16 Jul 2021 15:57:06 +0200 Subject: [PATCH 05/15] show all readable folders in tree, to make writeable subfolder visible --- views/bootstrap/class.MoveDocument.php | 2 +- views/bootstrap/class.MoveFolder.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/views/bootstrap/class.MoveDocument.php b/views/bootstrap/class.MoveDocument.php index 9d628d050..380d4a627 100644 --- a/views/bootstrap/class.MoveDocument.php +++ b/views/bootstrap/class.MoveDocument.php @@ -55,7 +55,7 @@ class SeedDMS_View_MoveDocument extends SeedDMS_Theme_Style { contentContainerStart('warning'); - $this->formField(getMLText("choose_target_folder"), $this->getFolderChooserHtml("form1", M_READWRITE, -1, $target)); + $this->formField(getMLText("choose_target_folder"), $this->getFolderChooserHtml("form1", M_READ, -1, $target)); $this->contentContainerEnd(); $this->formSubmit(getMLText('move')); ?> diff --git a/views/bootstrap/class.MoveFolder.php b/views/bootstrap/class.MoveFolder.php index be0e35ba3..6f4ecc696 100644 --- a/views/bootstrap/class.MoveFolder.php +++ b/views/bootstrap/class.MoveFolder.php @@ -56,7 +56,7 @@ class SeedDMS_View_MoveFolder extends SeedDMS_Theme_Style { contentContainerStart(); - $this->formField(getMLText("choose_target_folder"), $this->getFolderChooserHtml("form1", M_READWRITE, $folder->getID(), $target)); + $this->formField(getMLText("choose_target_folder"), $this->getFolderChooserHtml("form1", M_READ, $folder->getID(), $target)); $this->contentContainerEnd(); $this->formSubmit(getMLText('move_folder')); ?> From a113649be3bea891afa590d0532db9b42468225f Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 16 Jul 2021 16:03:34 +0200 Subject: [PATCH 06/15] add support for drag and drop of attachments --- out/out.ViewDocument.php | 1 + views/bootstrap/class.ViewDocument.php | 221 +++++++++++++++---------- views/bootstrap/styles/application.js | 31 +++- views/bootstrap4/styles/application.js | 31 +++- 4 files changed, 192 insertions(+), 92 deletions(-) diff --git a/out/out.ViewDocument.php b/out/out.ViewDocument.php index e0ecb3c60..0923b4d5b 100644 --- a/out/out.ViewDocument.php +++ b/out/out.ViewDocument.php @@ -70,6 +70,7 @@ if($view) { $view->setParam('document', $document); $view->setParam('accessobject', $accessop); $view->setParam('viewonlinefiletypes', $settings->_viewOnlineFileTypes); + $view->setParam('enableDropUpload', $settings->_enableDropUpload); $view->setParam('enableownerrevapp', $settings->_enableOwnerRevApp); $view->setParam('enableremoverevapp', $settings->_enableRemoveRevApp); $view->setParam('cachedir', $settings->_cacheDir); diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index 3fefb36e3..bae1729f9 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -177,6 +177,8 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style { $dms = $this->params['dms']; $user = $this->params['user']; $document = $this->params['document']; + $enableDropUpload = $this->params['enableDropUpload']; + $maxuploadsize = $this->params['maxuploadsize']; header('Content-Type: application/javascript; charset=UTF-8'); 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')); @@ -189,6 +191,17 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style { $this->printDeleteDocumentButtonJs(); /* Add js for catching click on document in one page mode */ $this->printClickDocumentJs(); + if ($enableDropUpload && $document->getAccessMode($user) >= M_READWRITE) { + echo "SeedDMSUpload.setUrl('".$this->params['settings']->_httpRoot."op/op.Ajax.php');"; + echo "SeedDMSUpload.setAbortBtnLabel('".getMLText("cancel")."');"; + echo "SeedDMSUpload.setEditBtnLabel('');"; + $mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize")); + if($maxuploadsize && $maxuploadsize < $mus2) + echo "SeedDMSUpload.setMaxFileSize($maxuploadsize);\n"; + else + echo "SeedDMSUpload.setMaxFileSize($mus2);\n"; + echo "SeedDMSUpload.setMaxFileSizeMsg('".getMLText("uploading_maxsize")."');"; + } ?> $(document).ready( function() { $("#form1").validate({ @@ -206,6 +219,111 @@ $(document).ready( function() { params['dms']; + $user = $this->params['user']; + $document = $this->params['document']; + $accessobject = $this->params['accessobject']; + $viewonlinefiletypes = $this->params['viewonlinefiletypes']; + $cachedir = $this->params['cachedir']; + $previewwidthdetail = $this->params['previewWidthDetail']; + $previewconverters = $this->params['previewConverters']; + $timeout = $this->params['timeout']; + $xsendfile = $this->params['xsendfile']; + $documentid = $document->getId(); + + $previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile); + $previewer->setConverters($previewconverters); + $latestContent = $this->callHook('documentLatestContent', $document); + if($latestContent === null) + $latestContent = $document->getLatestContent(); + $files = $document->getDocumentFiles($latestContent->getVersion()); + $files = SeedDMS_Core_DMS::filterDocumentFiles($user, $files); + + if (count($files) > 0) { + + print "
"; + print "\n\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n\n\n"; + + foreach($files as $file) { + + $file_exists=file_exists($dms->contentDir . $file->getPath()); + + $responsibleUser = $file->getUser(); + + print ""; + print ""; + + print ""; + print ""; + + print ""; + + print ""; + } + print "\n
".getMLText("file")."".getMLText("comment")."
"; + $previewer->createPreview($file, $previewwidthdetail); + if($file_exists) { + if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) { + if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) { + print "params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\">"; + } + } else { + if($accessobject->check_controller_access('Download', array('action'=>'file'))) { + print "params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\">"; + } + } + } + if($previewer->hasPreview($file)) { + print("params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&file=".$file->getID()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($file->getMimeType())."\">"); + } else { + print "getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">"; + } + if($file_exists) { + if($accessobject->check_controller_access('Download', array('action'=>'run')) || $accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) + print ""; + } + print "
    \n"; + print "
  • ".htmlspecialchars($file->getName())."
  • \n"; + if($file->getName() != $file->getOriginalFileName()) + print "
  • ".htmlspecialchars($file->getOriginalFileName())."
  • \n"; + if ($file_exists) + print "
  • ".SeedDMS_Core_File::format_filesize(filesize($dms->contentDir . $file->getPath())) ." bytes, ".htmlspecialchars($file->getMimeType())."
  • "; + else print "
  • ".htmlspecialchars($file->getMimeType())." - ".getMLText("document_deleted")."
  • "; + + print "
  • ".getMLText("uploaded_by")." getEmail())."\">".htmlspecialchars($responsibleUser->getFullName())."
  • "; + print "
  • ".getLongReadableDate($file->getDate())."
  • "; + if($file->getVersion()) + print "
  • ".getMLText('linked_to_current_version')."
  • "; + else + print "
  • ".getMLText('linked_to_document')."
  • "; + print "
".htmlspecialchars($file->getComment())."
    "; + if (($document->getAccessMode($user) == M_ALL)||($file->getUserID()==$user->getID())) { + print $this->html_link('RemoveDocumentFile', array('documentid'=>$document->getID(), 'fileid'=>$file->getID()), array(), ''.getMLText("delete"), false, true, array('
  • ', '
  • ')); + print $this->html_link('EditDocumentFile', array('documentid'=>$document->getID(), 'fileid'=>$file->getID()), array(), ''.getMLText("edit"), false, true, array('
  • ', '
  • ')); + } + print "
\n"; + + } + else $this->infoMsg(getMLText("no_attached_files")); + } /* }}} */ + function documentInfos() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; @@ -651,6 +769,7 @@ $(document).ready( function() { $document = $this->params['document']; $accessobject = $this->params['accessobject']; $viewonlinefiletypes = $this->params['viewonlinefiletypes']; + $enableDropUpload = $this->params['enableDropUpload']; $enableownerrevapp = $this->params['enableownerrevapp']; $enableremoverevapp = $this->params['enableremoverevapp']; $workflowmode = $this->params['workflowmode']; @@ -1325,102 +1444,28 @@ $(document).ready( function() { -
+
0) { - - print ""; - print "\n\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n\n\n"; - - foreach($files as $file) { - - $file_exists=file_exists($dms->contentDir . $file->getPath()); - - $responsibleUser = $file->getUser(); - - print ""; - print ""; - - print ""; - print ""; - - print ""; - - print ""; - } - print "\n
".getMLText("file")."".getMLText("comment")."
"; - $previewer->createPreview($file, $previewwidthdetail); - if($file_exists) { - if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) { - if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) { - print "params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\">"; - } - } else { - if($accessobject->check_controller_access('Download', array('action'=>'file'))) { - print "params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\">"; - } - } - } - if($previewer->hasPreview($file)) { - print("params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&file=".$file->getID()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($file->getMimeType())."\">"); - } else { - print "getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">"; - } - if($file_exists) { - if($accessobject->check_controller_access('Download', array('action'=>'run')) || $accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) - print ""; - } - print "
    \n"; - print "
  • ".htmlspecialchars($file->getName())."
  • \n"; - if($file->getName() != $file->getOriginalFileName()) - print "
  • ".htmlspecialchars($file->getOriginalFileName())."
  • \n"; - if ($file_exists) - print "
  • ".SeedDMS_Core_File::format_filesize(filesize($dms->contentDir . $file->getPath())) ." bytes, ".htmlspecialchars($file->getMimeType())."
  • "; - else print "
  • ".htmlspecialchars($file->getMimeType())." - ".getMLText("document_deleted")."
  • "; - - print "
  • ".getMLText("uploaded_by")." getEmail())."\">".htmlspecialchars($responsibleUser->getFullName())."
  • "; - print "
  • ".getLongReadableDate($file->getDate())."
  • "; - if($file->getVersion()) - print "
  • ".getMLText('linked_to_current_version')."
  • "; - else - print "
  • ".getMLText('linked_to_document')."
  • "; - print "
".htmlspecialchars($file->getComment())."
    "; - if (($document->getAccessMode($user) == M_ALL)||($file->getUserID()==$user->getID())) { - print $this->html_link('RemoveDocumentFile', array('documentid'=>$document->getID(), 'fileid'=>$file->getID()), array(), ''.getMLText("delete"), false, true, array('
  • ', '
  • ')); - print $this->html_link('EditDocumentFile', array('documentid'=>$document->getID(), 'fileid'=>$file->getID()), array(), ''.getMLText("edit"), false, true, array('
  • ', '
  • ')); - } - print "
\n"; - - } - else $this->infoMsg(getMLText("no_attached_files")); - + $this->rowStart(); + $this->columnStart(9); +?> +
getID()."\"" : "") ?>>
+columnEnd(); + $this->columnStart(3); if($accessobject->check_controller_access('AddFile')) { if ($document->getAccessMode($user) >= M_READWRITE){ - if(0){ + if($enableDropUpload){ ?> -
html_link("AddFile", array('documentid'=>$document->getID()), array(), getMLText('add')); ?>
+
html_link('AddFile', array('documentid'=>$documentid), array('class'=>'alert alert-warning'), getMLText('drop_files_here_or_click'), false, true); ?>
html_link('AddFile', array('documentid'=>$documentid), array('class'=>'btn btn-primary'), getMLText("add"), false, true)."\n"; } - print $this->html_link('AddFile', array('documentid'=>$documentid), array('class'=>'btn btn-primary'), getMLText("add"), false, true)."\n"; } } + $this->columnEnd(); + $this->rowEnd(); ?>