[FEATURE] Include preview link in notification
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Mon, 3 Oct 2011 19:40:47 +0000 (21:40 +0200)
committerOliver Hader <oliver@typo3.org>
Mon, 3 Oct 2011 21:03:55 +0000 (23:03 +0200)
Until now there haven't been a preview link in the notification mails.

With this feature there are two new markers that can be used in the
notification template. One marker for the workspace preview link and
one marker for the splitted workspace preview link.
Additionally this feature adds a hook, so it is possible for a
developer to add severall additional markers.

Belongs to change 1054
Resolves: #13518

Change-Id: I8443718f61dcdb066a8935f424ee6bb1a86bd0fc
Reviewed-on: http://review.typo3.org/1057
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/version/Resources/Private/Language/locallang_emails.xlf
typo3/sysext/version/class.tx_version_tcemain.php

index 2fa852c..93009ea 100644 (file)
@@ -27,6 +27,11 @@ the stage has changed for the element(s) "###RECORD_TITLE###" (###ELEMENT_NAME##
 User Comment:
 "###COMMENT###"
 
+Preview:
+###PREVIEW_LINK###
+
+###SPLITTED_PREVIEW_LINK###
+
 State was changed by ###USER_FULLNAME### (username: ###USER_USERNAME###)</target>
                        </trans-unit>
                </body>
index 6fc2190..0445e75 100644 (file)
@@ -483,6 +483,30 @@ class tx_version_tcemain {
                                        '###USER_USERNAME###' => $tcemainObj->BE_USER->user['username']
                                );
 
+                                       // add marker for preview links if workspace extension is loaded
+                               if (t3lib_extMgm::isLoaded('workspaces')) {
+                                       $this->workspaceService = t3lib_div::makeInstance('tx_Workspaces_Service_Workspaces');
+                                               // only generate the link if the marker is in the template - prevents database from getting to much entries
+                                       if (t3lib_div::isFirstPartOfStr($emailConfig['message'], 'LLL:')) {
+                                               $tempEmailMessage = $GLOBALS['LANG']->sL($emailConfig['message']);
+                                       } else {
+                                               $tempEmailMessage = $emailConfig['message'];
+                                       }
+                                       if (strpos($tempEmailMessage, '###PREVIEW_LINK###') !== FALSE) {
+                                               $markers['###PREVIEW_LINK###'] = $this->workspaceService->generateWorkspacePreviewLink($elementUid);
+                                       }
+                                       unset($tempEmailMessage);
+
+                                       $markers['###SPLITTED_PREVIEW_LINK###'] = $this->workspaceService->generateWorkspaceSplittedPreviewLink($elementUid, TRUE);
+                               }
+
+                                       // Hook for preprocessing of the content for formmails:
+                               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/version/class.tx_version_tcemain.php']['notifyStageChange-postModifyMarkers'])) {
+                                       foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/version/class.tx_version_tcemain.php']['notifyStageChange-postModifyMarkers'] as $_classRef) {
+                                               $_procObj = &t3lib_div::getUserObj($_classRef);
+                                               $markers = $_procObj->postModifyMarkers($markers, $this);
+                                       }
+                               }
 
                                        // sending the emails the old way with sprintf(),
                                        // because it was set explicitly in TSconfig