[TASK] Move workspace preview functionality into versioning / workspace
authorTolleiv Nietsch <info@tolleiv.de>
Thu, 14 Jul 2011 16:26:02 +0000 (18:26 +0200)
committerTolleiv Nietsch <info@tolleiv.de>
Thu, 14 Jul 2011 16:29:32 +0000 (18:29 +0200)
As the whole handling of the ADMCMD_preview is related to
version / workspaces, the according code should go in these
extensions.

Change-Id: Iddb9cf435b8f9617625caefbda78738a0b8bf0fc
Resolves: #27931

typo3/sysext/workspaces/Classes/Service/Workspaces.php

index de901e9..c6d0faa 100644 (file)
@@ -567,11 +567,13 @@ class tx_Workspaces_Service_Workspaces implements t3lib_Singleton {
         * @return string the full domain including the protocol http:// or https://, but without the trailing '/'
         */
        public function generateWorkspacePreviewLink($uid) {
-               $timeToLiveHours = intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours'));
-               $timeToLiveHours = ($timeToLiveHours ? $timeToLiveHours : 24*2) * 3600;
+               $previewObject = t3lib_div::makeInstance('Tx_Version_Preview');
+               $timeToLiveHours = $previewObject->getPreviewLinkLifetime();
+               $previewKeyword = $previewObject->compilePreviewKeyword('', $GLOBALS['BE_USER']->user['uid'], ($timeToLiveHours*3600), $this->getCurrentWorkspace());
+
                $linkParams = array(
-                       'ADMCMD_prev'   => t3lib_BEfunc::compilePreviewKeyword('', $GLOBALS['BE_USER']->user['uid'], $timeToLiveHours, $this->getCurrentWorkspace()),
-                       'id'                    => $uid
+                       'ADMCMD_prev' => $previewKeyword,
+                       'id' => $uid
                );
                return t3lib_BEfunc::getViewDomain($uid) . '/index.php?' . t3lib_div::implodeArrayForUrl('', $linkParams);
        }