diff --git a/CHANGELOG b/CHANGELOG index 2369e1050..9a810c0b5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -178,6 +178,8 @@ - allow inline editing of document name - import of users does not issue an error if a group column isn't set - removing a document version will not remove attachments of the document anymore +- make document details page like like view document page +- fix selection of documents/folders -------------------------------------------------------------------------------- Changes in version 5.1.19 diff --git a/out/out.DocumentVersionDetail.php b/out/out.DocumentVersionDetail.php index b578456ae..931e8a171 100644 --- a/out/out.DocumentVersionDetail.php +++ b/out/out.DocumentVersionDetail.php @@ -77,6 +77,7 @@ if($view) { $view->setParam('enableversionmodification', $settings->_enableVersionModification); $view->setParam('previewWidthDetail', $settings->_previewWidthDetail); $view->setParam('previewConverters', isset($settings->_converters['preview']) ? $settings->_converters['preview'] : array()); + $view->setParam('pdfConverters', isset($settings->_converters['pdf']) ? $settings->_converters['pdf'] : array()); $view->setParam('showFullPreview', $settings->_showFullPreview); $view->setParam('convertToPdf', $settings->_convertToPdf); $view->setParam('cachedir', $settings->_cacheDir); diff --git a/styles/bootstrap/application.js b/styles/bootstrap/application.js index 91b40c5ff..9061a1445 100644 --- a/styles/bootstrap/application.js +++ b/styles/bootstrap/application.js @@ -36,13 +36,13 @@ function escapeHtml(text) { } function treeFolderSelected(formid, nodeid, nodename) { - $('#targetid'+formid).val(nodeid); + $('#'+formid).val(nodeid); $('#choosefoldersearch'+formid).val(nodename); $('#folderChooser'+formid).modal('hide'); } function treeDocumentSelected(formid, nodeid, nodename) { - $('#docid'+formid).val(nodeid); + $('#'+formid).val(nodeid); $('#choosedocsearch'+formid).val(nodename); $('#docChooser'+formid).modal('hide'); } @@ -446,12 +446,18 @@ $(document).ready( function() { for(var key in param1) { if(key == 'callback') callback = param1[key]; - else - url += "&"+key+"="+param1[key]; + else { + if($.isArray(param1[key])) { + if(param1[key].length > 0) + url += "&"+key+"[]="+param1[key].join("&"+key+"[]="); + } else + url += "&"+key+"="+param1[key]; + } } } else { url += "&"+param1; } + console.log(url); if(!element.data('no-spinner')) element.prepend('
'); $.get(url, function(data) { diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 25b33c402..3dcd4c5d0 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1384,7 +1384,7 @@ $(document).ready(function() { else $folderid = $folder->getID(); $content = ''; - $content .= "getID() : "") ."\">"; + $content .= "getID() : "") ."\">"; $content .= "
\n"; $content .= "getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" />"; if(!$skiptree) @@ -1423,7 +1423,7 @@ $(document).ready(function() { $formid = md5($formname.$form); ?> function documentSelected(id, name) { - $('#docid').val(id); + $('#').val(id); $('#choosedocsearch').val(name); $('#docChooser').modal('hide'); } @@ -1448,7 +1448,7 @@ function folderSelected(id, name) { $formname = "targetid"; $formid = md5($formname.$form); $content = ''; - $content .= "getID() : "") ."\">"; + $content .= "getID() : "") ."\">"; $content .= "
\n"; $content .= "getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" target=\"".$formid."\"/>"; $content .= ""; @@ -1490,7 +1490,7 @@ function folderSelected(id, name) { $formid = md5($formname.$form); ?> function folderSelected(id, name) { - $('#targetid').val(id); + $('#').val(id); $('#choosefoldersearch').val(name); $('#folderChooser').modal('hide'); } @@ -1498,7 +1498,7 @@ function folderSelected(id, name) { $(document).ready(function() { $('#clearfolder').click(function(ev) { $('#choosefoldersearch').val(''); - $('#targetid').val(''); + $('#').val(''); }); }); */ diff --git a/views/bootstrap/class.DocumentVersionDetail.php b/views/bootstrap/class.DocumentVersionDetail.php index 856fdf10b..62e27b273 100644 --- a/views/bootstrap/class.DocumentVersionDetail.php +++ b/views/bootstrap/class.DocumentVersionDetail.php @@ -36,50 +36,100 @@ require_once("SeedDMS/Preview.php"); */ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Bootstrap_Style { + /** + * Output a single attribute in the document info section + * + * @param object $attribute attribute + */ + protected function printAttribute($attribute) { /* {{{ */ + $attrdef = $attribute->getAttributeDefinition(); +?> + + getName()); ?>: + getAttributeValue($attribute); ?> + +params['dms']; $document = $this->params['document']; $timeout = $this->params['timeout']; $xsendfile = $this->params['xsendfile']; $showfullpreview = $this->params['showFullPreview']; $converttopdf = $this->params['convertToPdf']; + $pdfconverters = $this->params['pdfConverters']; $cachedir = $this->params['cachedir']; $version = $this->params['version']; if(!$showfullpreview) return; - switch($version->getMimeType()) { - case 'audio/mpeg': - case 'audio/mp3': - case 'audio/ogg': - case 'audio/wav': - $this->contentHeading(getMLText("preview")); -?> - -contentHeading(getMLText("preview")); -?> - -contentHeading(getMLText("preview")); -?> - -callHook('preDocumentPreview', $version); + if(is_string($txt)) + echo $txt; + $txt = $this->callHook('documentPreview', $version); + if(is_string($txt)) + echo $txt; + else { + switch($version->getMimeType()) { + case 'audio/mpeg': + case 'audio/mp3': + case 'audio/ogg': + case 'audio/wav': + $this->contentHeading(getMLText("preview")); + ?> + + contentHeading(getMLText("preview")); + ?> + + contentHeading(getMLText("preview")); + ?> + + contentHeading(getMLText("preview")); + ?> + + callHook('additionalDocumentPreview', $version); + if(is_string($txt)) + echo $txt; + break; + } } + $txt = $this->callHook('postDocumentPreview', $version); + if(is_string($txt)) + echo $txt; + if($converttopdf) { $pdfpreviewer = new SeedDMS_Preview_PdfPreviewer($cachedir, $timeout, $xsendfile); + $pdfpreviewer->setConverters($pdfconverters); if($pdfpreviewer->hasConverter($version->getMimeType())) { - $this->contentHeading(getMLText("preview")); + $this->contentHeading(getMLText("preview_pdf")); ?> - + params['user']; $folder = $this->params['folder']; $document = $this->params['document']; + $accessop = $this->params['accessobject']; $version = $this->params['version']; $accessop = $this->params['accessobject']; $viewonlinefiletypes = $this->params['viewonlinefiletypes']; @@ -176,13 +227,17 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Bootstrap_Style { $attributes = $document->getAttributes(); if($attributes) { foreach($attributes as $attribute) { - $attrdef = $attribute->getAttributeDefinition(); -?> - - getName()); ?>: - getValueAsArray())); ?> - -callHook('showDocumentAttribute', $document, $attribute); + if(is_array($arr)) { + echo ""; + echo "".$arr[0].":"; + echo "".$arr[1].""; + echo ""; + } elseif(is_string($arr)) { + echo $arr; + } else { + $this->printAttribute($attribute); + } } } ?> @@ -202,11 +257,10 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Bootstrap_Style { $this->contentContainerStart(); print ""; print "\n\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; + print "\n"; +// print "\n"; + print "\n"; + print "\n"; print "\n\n\n"; print "\n"; print "\n"; print "\n"; - print ""; - print ""; + print ""; + print ""; print "\n
".getMLText("file")."".getMLText("comment")."".getMLText("status")."".htmlspecialchars($version->getOriginalFileName())."".getMLText("comment")."".getMLText("status")."
    "; @@ -221,72 +275,96 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Bootstrap_Style { print "
    \n"; - print "
  • ".$version->getOriginalFileName()."
  • \n"; print "
  • ".getMLText('version').": ".$version->getVersion()."
  • \n"; - if ($file_exists) print "
  • ". formatted_size(filesize($dms->contentDir . $version->getPath())) ." ".htmlspecialchars($version->getMimeType())."
  • "; + if ($file_exists) + print "
  • ". SeedDMS_Core_File::format_filesize($version->getFileSize()) .", ".htmlspecialchars($version->getMimeType())."
  • "; else print "
  • ".getMLText("document_deleted")."
  • "; $updatingUser = $version->getUser(); print "
  • ".getMLText("uploaded_by")." getEmail()."\">".htmlspecialchars($updatingUser->getFullName())."
  • "; print "
  • ".getLongReadableDate($version->getDate())."
  • "; + + print "
\n"; + $txt = $this->callHook('showVersionComment', $version); + if($txt) { + echo $txt; + } else { + if($version->getComment()) + print "

".htmlspecialchars($version->getComment())."

"; + } + print "
    \n"; + $attributes = $version->getAttributes(); + if($attributes) { + foreach($attributes as $attribute) { + $arr = $this->callHook('showDocumentContentAttribute', $version, $attribute); + if(is_array($arr)) { + print "
  • ".$arr[0].": ".$arr[1]."
  • \n"; + } else { + $attrdef = $attribute->getAttributeDefinition(); + print "
  • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $attribute->getValueAsArray()))."
  • \n"; + } + } + } print "
".htmlspecialchars($version->getComment())."".getOverallStatusText($status["status"]).""; + print getOverallStatusText($status["status"]); + if ( $status["status"]==S_DRAFT_REV || $status["status"]==S_DRAFT_APP || $status["status"]==S_IN_WORKFLOW || $status["status"]==S_EXPIRED ){ + print "
hasExpired()?" class=\"warning\" ":"").">".(!$document->getExpires() ? getMLText("does_not_expire") : getMLText("expires").": ".getReadableDate($document->getExpires())).""; + } + print "
"; //if (($document->getAccessMode($user) >= M_READWRITE)) { - print "
\n"; $this->contentContainerEnd(); - $this->contentContainerStart(); - print "\n"; + print "
"; + print "
"; - if (is_array($reviewStatus) && count($reviewStatus)>0) { + if (is_array($reviewStatus) && count($reviewStatus)>0) { /* {{{ */ - print "
\n"; - + print "".getMLText('reviewers').""; + print "
\n"; - $this->contentSubHeading(getMLText("reviewers")); - print "
\n"; print "\n"; - print "\n"; - print "\n"; - print ""; - print "\n"; + print "\n"; + print "\n"; +// print ""; + print "\n"; print "\n"; foreach ($reviewStatus as $r) { @@ -298,7 +376,7 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Bootstrap_Style { $reqName = getMLText("unknown_user")." '".$r["required"]."'"; } else { - $reqName = htmlspecialchars($required->getFullName()); + $reqName = " ".htmlspecialchars($required->getFullName()." (".$required->getLogin().")"); } break; case 1: // Reviewer is a group. @@ -307,32 +385,40 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Bootstrap_Style { $reqName = getMLText("unknown_group")." '".$r["required"]."'"; } else { - $reqName = htmlspecialchars($required->getName()); + $reqName = " ".htmlspecialchars($required->getName()); } break; } - print "\n"; + print "\n"; print "\n"; - print ""; - print "\n"; + print (is_object($updateUser) ? htmlspecialchars($updateUser->getFullName()." (".$updateUser->getLogin().")") : "unknown user id '".$r["userID"]."'")."
"; + print htmlspecialchars($r["comment"]); + if($r['file']) { + echo "
"; + echo " ".getMLText('download').""; + } + print "\n"; print "\n"; print "\n"; } - } + print "
".getMLText("name")."".getMLText("last_update")."".getMLText("comment")."".getMLText("status")."".getMLText("name")."".getMLText("last_update")."".getMLText("comment")."".getMLText("status")."
".$reqName."
  • ".$r["date"]."
  • "; + print "
".$r["date"]." - "; + /* $updateUser is the user who has done the review */ $updateUser = $dms->getUser($r["userID"]); - print "
  • ".(is_object($updateUser) ? $updateUser->getFullName() : "unknown user id '".$r["userID"]."'")."
  • ".$r["comment"]."".getReviewStatusText($r["status"])."
    \n"; + } /* }}} */ - if (is_array($approvalStatus) && count($approvalStatus)>0) { + print "
    \n"; + print "
    "; - print "\n"; - $this->contentSubHeading(getMLText("approvers")); - print "\n"; - + if (is_array($approvalStatus) && count($approvalStatus)>0) { /* {{{ */ + + print "".getMLText('approvers').""; + print "\n"; print "\n"; - print "\n"; - print "\n"; - print ""; - print "\n"; + print "\n"; + print "\n"; +// print ""; + print "\n"; print "\n"; foreach ($approvalStatus as $a) { @@ -344,7 +430,7 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Bootstrap_Style { $reqName = getMLText("unknown_user")." '".$r["required"]."'"; } else { - $reqName = htmlspecialchars($required->getFullName()); + $reqName = " ".htmlspecialchars($required->getFullName()." (".$required->getLogin().")"); } break; case 1: // Approver is a group. @@ -353,38 +439,39 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Bootstrap_Style { $reqName = getMLText("unknown_group")." '".$r["required"]."'"; } else { - $reqName = htmlspecialchars($required->getName()); + $reqName = " ".htmlspecialchars($required->getName()); } break; } - print "\n"; + print "\n"; print "\n"; - print ""; - print "\n"; + print (is_object($updateUser) ? htmlspecialchars($updateUser->getFullName()." (".$updateUser->getLogin().")") : "unknown user id '".$a["userID"]."'")."
    "; + print htmlspecialchars($a["comment"]); + if($a['file']) { + echo "
    "; + echo " ".getMLText('download').""; + } + echo "\n"; print "\n"; print "\n"; } - } + print "
    ".getMLText("name")."".getMLText("last_update")."".getMLText("comment")."".getMLText("status")."".getMLText("name")."".getMLText("last_update")."".getMLText("comment")."".getMLText("status")."
    ".$reqName."
    • ".$a["date"]."
    • "; + print "
    ".$a["date"]." - "; + /* $updateUser is the user who has done the approval */ $updateUser = $dms->getUser($a["userID"]); - print "
  • ".(is_object($updateUser) ? htmlspecialchars($updateUser->getFullName()) : "unknown user id '".$a["userID"]."'")."
  • ".$a["comment"]."".getApprovalStatusText($a["status"])."
    \n"; + } /* }}} */ - print "\n"; + print "
    \n"; + print "
    \n"; - $this->contentContainerEnd(); - - $tmpfiles = $document->getDocumentFiles($version->getVersion()); - /* Do the regular filtering by isPublic and access rights */ - $tmpfiles = SeedDMS_Core_DMS::filterDocumentFiles($user, $tmpfiles); - /* Also filter only those files belonging to this version and skip files - * belonging to the document (version = 0) + /* Get attachments exclusively for this version, without those + * attached to the document */ - $files = array(); - foreach($tmpfiles as $file) { - if($file->getVersion() == $version->getVersion()) - $files[] = $file; - } + $files = $document->getDocumentFiles($version->getVersion(), false); + /* Do the regular filtering by isPublic and access rights */ + $files = SeedDMS_Core_DMS::filterDocumentFiles($user, $files); - if (count($files) > 0) { + if (count($files) > 0) { /* {{{ */ $this->contentHeading(getMLText("linked_files")); $this->contentContainerStart(); @@ -399,8 +486,6 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Bootstrap_Style { print "\n\n\n"; foreach($files as $file) { - if($file->getVersion() != $version->getVersion()) - continue; $file_exists=file_exists($dms->contentDir . $file->getPath()); @@ -459,7 +544,7 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Bootstrap_Style { print "\n\n"; $this->contentContainerEnd(); - } + } /* }}} */ if($user->isAdmin() || $user->getId() == $document->getOwner()->getId()) { $this->contentHeading(getMLText("status")); diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index 2349b022e..9ec16628e 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -670,8 +670,6 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { $this->printVersionAttributes($folder, $latestContent); print "\n"; -// print "".htmlspecialchars($latestContent->getComment()).""; - print ""; print getOverallStatusText($status["status"]); if ( $status["status"]==S_DRAFT_REV || $status["status"]==S_DRAFT_APP || $status["status"]==S_IN_WORKFLOW || $status["status"]==S_EXPIRED ){ @@ -681,8 +679,8 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { print ""; - print ""; + print "