Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2021-12-15 17:19:23 +01:00
commit 5e386597c3
4 changed files with 55 additions and 23 deletions

View File

@ -218,6 +218,9 @@
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- certain fields in configuration can be disabled for editing, also works for - certain fields in configuration can be disabled for editing, also works for
configuration fields of extensions configuration fields of extensions
- send notification mail to owner of document and uploader of a version
- new mail body for changing a version comment
- add hook documentListPreview
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 5.1.24 Changes in version 5.1.24

View File

@ -50,8 +50,9 @@ class SeedDMS_NotificationService {
const RECV_REVIEWER = 3; const RECV_REVIEWER = 3;
const RECV_APPROVER = 4; const RECV_APPROVER = 4;
const RECV_WORKFLOW = 5; const RECV_WORKFLOW = 5;
const RECV_REVISOR = 6; const RECV_UPLOADER = 6;
const RECV_RECIPIENT = 7; const RECV_REVISOR = 7;
const RECV_RECIPIENT = 8;
public function __construct($logger = null, $settings = null) { /* {{{ */ public function __construct($logger = null, $settings = null) { /* {{{ */
$this->services = array(); $this->services = array();
@ -421,6 +422,10 @@ class SeedDMS_NotificationService {
if($user->getID() != $document->getOwner()->getID() && if($user->getID() != $document->getOwner()->getID() &&
false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users'])) false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users']))
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); $this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
/* Send mail to uploader of version */
if($user->getID() != $version->getUser()->getID() && false === SeedDMS_Core_DMS::inList($version->getUser(), $nl['users']))
$this->toIndividual($user, $version->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
} /* }}} */ } /* }}} */
/** /**
@ -546,6 +551,9 @@ class SeedDMS_NotificationService {
false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users']))
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); $this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
/* Send mail to uploader of version */
if($user->getID() != $content->getUser()->getID() && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
} /* }}} */ } /* }}} */
/** /**
@ -767,8 +775,8 @@ class SeedDMS_NotificationService {
$document = $content->getDocument(); $document = $content->getDocument();
$notifyList = $document->getNotifyList(); $notifyList = $document->getNotifyList();
$folder = $document->getFolder(); $folder = $document->getFolder();
$subject = "document_comment_changed_email_subject"; $subject = "version_comment_changed_email_subject";
$message = "document_comment_changed_email_body"; $message = "version_comment_changed_email_body";
$params = array(); $params = array();
$params['name'] = $document->getName(); $params['name'] = $document->getName();
$params['version'] = $content->getVersion(); $params['version'] = $content->getVersion();
@ -965,7 +973,11 @@ class SeedDMS_NotificationService {
* owner and the owner is not already in the list of notifiers. * owner and the owner is not already in the list of notifiers.
*/ */
if($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users'])) if($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users']))
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); $this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
/* Send mail to uploader of version */
if($user->getID() != $content->getUser()->getID() && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
} /* }}} */ } /* }}} */
public function sendNewDocumentNotifyMail($document, $user, $obj) { /* {{{ */ public function sendNewDocumentNotifyMail($document, $user, $obj) { /* {{{ */
@ -1062,7 +1074,11 @@ class SeedDMS_NotificationService {
* owner and the owner is not already in the list of notifiers. * owner and the owner is not already in the list of notifiers.
*/ */
if($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users'])) if($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users']))
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); $this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
/* Send mail to uploader of version */
if($user->getID() != $content->getUser()->getID() && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
} /* }}} */ } /* }}} */
public function sendSubmittedApprovalMail($content, $user, $approvelog) { /* {{{ */ public function sendSubmittedApprovalMail($content, $user, $approvelog) { /* {{{ */
@ -1090,8 +1106,11 @@ class SeedDMS_NotificationService {
* owner and the owner is not already in the list of notifiers. * owner and the owner is not already in the list of notifiers.
*/ */
if($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users'])) if($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users']))
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); $this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
/* Send mail to uploader of version */
if($user->getID() != $content->getUser()->getID() && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
} /* }}} */ } /* }}} */
public function sendDeleteApprovalMail($content, $user, $approver) { /* {{{ */ public function sendDeleteApprovalMail($content, $user, $approver) { /* {{{ */

View File

@ -3030,15 +3030,20 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= "<td>"; $content .= "<td>";
if (file_exists($dms->contentDir . $latestContent->getPath())) { if (file_exists($dms->contentDir . $latestContent->getPath())) {
if($accessop->check_controller_access('Download', array('action'=>'version'))) $previewhtml = $this->callHook('documentListPreview', $previewer, $document, $latestContent);
$content .= "<a draggable=\"false\" href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$docID."&version=".$version."\">"; if(is_string($previewhtml))
if($previewer->hasPreview($latestContent)) { $content .= $previewhtml;
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; else {
} else { if($accessop->check_controller_access('Download', array('action'=>'version')))
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" ".($previewwidth ? "width=\"".$previewwidth."\"" : "")."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; $content .= "<a draggable=\"false\" href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$docID."&version=".$version."\">";
if($previewer->hasPreview($latestContent)) {
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
} else {
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" ".($previewwidth ? "width=\"".$previewwidth."\"" : "")."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
}
if($accessop->check_controller_access('Download', array('action'=>'version')))
$content .= "</a>";
} }
if($accessop->check_controller_access('Download', array('action'=>'version')))
$content .= "</a>";
} else } else
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; $content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
$content .= "</td>"; $content .= "</td>";

View File

@ -3016,15 +3016,20 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= "<td>"; $content .= "<td>";
if (file_exists($dms->contentDir . $latestContent->getPath())) { if (file_exists($dms->contentDir . $latestContent->getPath())) {
if($accessop->check_controller_access('Download', array('action'=>'version'))) $previewhtml = $this->callHook('documentListPreview', $previewer, $document, $latestContent);
$content .= "<a draggable=\"false\" href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$docID."&version=".$version."\">"; if(is_string($previewhtml))
if($previewer->hasPreview($latestContent)) { $content .= $previewhtml;
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; else {
} else { if($accessop->check_controller_access('Download', array('action'=>'version')))
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" ".($previewwidth ? "width=\"".$previewwidth."\"" : "")."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; $content .= "<a draggable=\"false\" href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$docID."&version=".$version."\">";
if($previewer->hasPreview($latestContent)) {
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
} else {
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" ".($previewwidth ? "width=\"".$previewwidth."\"" : "")."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
}
if($accessop->check_controller_access('Download', array('action'=>'version')))
$content .= "</a>";
} }
if($accessop->check_controller_access('Download', array('action'=>'version')))
$content .= "</a>";
} else } else
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; $content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
$content .= "</td>"; $content .= "</td>";