From 7f61dbbcad9a077ca6bd23e29486ff8c2dfeebe3 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 15 Dec 2021 10:28:00 +0100 Subject: [PATCH 1/4] new mail body for change of version comment --- inc/inc.ClassNotificationService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/inc.ClassNotificationService.php b/inc/inc.ClassNotificationService.php index ab38b9f76..1679dbf5d 100644 --- a/inc/inc.ClassNotificationService.php +++ b/inc/inc.ClassNotificationService.php @@ -765,8 +765,8 @@ class SeedDMS_NotificationService { $document = $content->getDocument(); $notifyList = $document->getNotifyList(); $folder = $document->getFolder(); - $subject = "document_comment_changed_email_subject"; - $message = "document_comment_changed_email_body"; + $subject = "version_comment_changed_email_subject"; + $message = "version_comment_changed_email_body"; $params = array(); $params['name'] = $document->getName(); $params['version'] = $content->getVersion(); From ad2ea730317de17ce02096d2ff60b6dd565b4751 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 15 Dec 2021 10:28:34 +0100 Subject: [PATCH 2/4] send mail to uploader of a version --- inc/inc.ClassNotificationService.php | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/inc/inc.ClassNotificationService.php b/inc/inc.ClassNotificationService.php index 1679dbf5d..d77e33d84 100644 --- a/inc/inc.ClassNotificationService.php +++ b/inc/inc.ClassNotificationService.php @@ -50,6 +50,7 @@ class SeedDMS_NotificationService { const RECV_REVIEWER = 3; const RECV_APPROVER = 4; const RECV_WORKFLOW = 5; + const RECV_UPLOADER = 6; public function __construct($logger = null, $settings = null) { /* {{{ */ $this->services = array(); @@ -419,6 +420,10 @@ class SeedDMS_NotificationService { if($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users'])) $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); } /* }}} */ /** @@ -544,6 +549,9 @@ class SeedDMS_NotificationService { false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) $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); } /* }}} */ /** @@ -963,7 +971,11 @@ class SeedDMS_NotificationService { * 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'])) - $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) { /* {{{ */ @@ -1060,7 +1072,11 @@ class SeedDMS_NotificationService { * 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'])) - $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) { /* {{{ */ @@ -1088,8 +1104,11 @@ class SeedDMS_NotificationService { * 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'])) - $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) { /* {{{ */ From 52a9a41d5c3a377156d091a4bf690d98387b509d Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 15 Dec 2021 17:17:23 +0100 Subject: [PATCH 3/4] add hook documentListPreview --- views/bootstrap/class.Bootstrap.php | 21 +++++++++++++-------- views/bootstrap4/class.Bootstrap4.php | 21 +++++++++++++-------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 8fe421235..a106f29e9 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -2908,15 +2908,20 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $content .= ""; if (file_exists($dms->contentDir . $latestContent->getPath())) { - if($accessop->check_controller_access('Download', array('action'=>'version'))) - $content .= "params['settings']->_httpRoot."op/op.Download.php?documentid=".$docID."&version=".$version."\">"; - if($previewer->hasPreview($latestContent)) { - $content .= "params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; - } else { - $content .= "getMimeIcon($latestContent->getFileType())."\" ".($previewwidth ? "width=\"".$previewwidth."\"" : "")."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + $previewhtml = $this->callHook('documentListPreview', $previewer, $document, $latestContent); + if(is_string($previewhtml)) + $content .= $previewhtml; + else { + if($accessop->check_controller_access('Download', array('action'=>'version'))) + $content .= "params['settings']->_httpRoot."op/op.Download.php?documentid=".$docID."&version=".$version."\">"; + if($previewer->hasPreview($latestContent)) { + $content .= "params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } else { + $content .= "getMimeIcon($latestContent->getFileType())."\" ".($previewwidth ? "width=\"".$previewwidth."\"" : "")."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } + if($accessop->check_controller_access('Download', array('action'=>'version'))) + $content .= ""; } - if($accessop->check_controller_access('Download', array('action'=>'version'))) - $content .= ""; } else $content .= "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; $content .= ""; diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index a19107e8f..3588bb8a2 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -2976,15 +2976,20 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $content .= ""; if (file_exists($dms->contentDir . $latestContent->getPath())) { - if($accessop->check_controller_access('Download', array('action'=>'version'))) - $content .= "params['settings']->_httpRoot."op/op.Download.php?documentid=".$docID."&version=".$version."\">"; - if($previewer->hasPreview($latestContent)) { - $content .= "params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; - } else { - $content .= "getMimeIcon($latestContent->getFileType())."\" ".($previewwidth ? "width=\"".$previewwidth."\"" : "")."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + $previewhtml = $this->callHook('documentListPreview', $previewer, $document, $latestContent); + if(is_string($previewhtml)) + $content .= $previewhtml; + else { + if($accessop->check_controller_access('Download', array('action'=>'version'))) + $content .= "params['settings']->_httpRoot."op/op.Download.php?documentid=".$docID."&version=".$version."\">"; + if($previewer->hasPreview($latestContent)) { + $content .= "params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } else { + $content .= "getMimeIcon($latestContent->getFileType())."\" ".($previewwidth ? "width=\"".$previewwidth."\"" : "")."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } + if($accessop->check_controller_access('Download', array('action'=>'version'))) + $content .= ""; } - if($accessop->check_controller_access('Download', array('action'=>'version'))) - $content .= ""; } else $content .= "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; $content .= ""; From 7e34fa066353d89133b4fd67b2d19aeb55bc076a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 15 Dec 2021 17:17:51 +0100 Subject: [PATCH 4/4] add changes for 5.1.25 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 577fc757d..1d0b75dbd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,9 @@ -------------------------------------------------------------------------------- - certain fields in configuration can be disabled for editing, also works for 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