[TASK] remove workspace previewInfo in frontend
authorTolleiv <info@tolleiv.de>
Thu, 3 Mar 2011 09:04:57 +0000 (04:04 -0500)
committerSusanne Moog <typo3@susannemoog.de>
Mon, 28 Mar 2011 19:53:50 +0000 (21:53 +0200)
The preview info should not contain workspace related code.
The proposed patch removes all output from tslib_fe::previewInfo
and adds the possibility to hook in it and render a specific
message. The followup implements this for the regular preview.

Change-Id: Ie3c05a1837bb2e11cdb66c72114218ae6e12c973
Related: #13571
Fixes: #M17844
Reviewed-on: http://review.typo3.org/1003
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
typo3/sysext/cms/tslib/class.tslib_fe.php

index 1949163..9fccf9e 100644 (file)
@@ -3823,26 +3823,15 @@ if (version == "n3") {
         * @return      void
         */
        function previewInfo()  {
-               if ($this->fePreview && (!isset($this->config['config']['disablePreviewNotification']) || intval($this->config['config']['disablePreviewNotification']) !== 1)) {
-                               if ($this->fePreview === 2) {
-                                       $onclickForStoppingPreview = 'document.location="'.t3lib_div::getIndpEnv('TYPO3_SITE_URL').'index.php?ADMCMD_prev=LOGOUT&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')).'";return false;';
-                                       $text = 'Preview of workspace "'.$this->whichWorkspace(TRUE).'" ('.$this->whichWorkspace().')';
-                                       $html = $this->doWorkspacePreview() ? '<br/><input name="_" type="submit" value="Stop preview" onclick="'.htmlspecialchars($onclickForStoppingPreview).'" />' : '';
-                               } else {
-                                       $text = 'PREVIEW!';
-                                       $html = '';
-                               }
-
-                               $stdMsg = '<div id="typo3-previewInfo" style="position: absolute; top: 20px; right: 20px; border: 2px solid #000; padding: 5px 5px; background: #f00; font: 1em Verdana; color: #000; font-weight: bold; z-index: 10001">'.htmlspecialchars($text).$html.'</div>';
-
-                               if ($this->fePreview === 2) {
-                                       $temp_content = $this->config['config']['message_preview_workspace'] ?
-                                               @sprintf($this->config['config']['message_preview_workspace'], $this->whichWorkspace(TRUE),$this->whichWorkspace()) :
-                                               $stdMsg;
-                               } else {
-                                       $temp_content = $this->config['config']['message_preview'] ? $this->config['config']['message_preview'] : $stdMsg;
+               if ($this->fePreview !== 0) {
+                       $previewInfo = '';
+                       if (isset($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_previewInfo']) && is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_previewInfo'])) {
+                               $_params = array('pObj' => &$this);
+                               foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_previewInfo'] as $_funcRef) {
+                                       $previewInfo .= t3lib_div::callUserFunction($_funcRef,$_params,$this);
                                }
-                               echo $temp_content;
+                       }
+                       $this->content = str_ireplace('</body>',  $previewInfo . '</body>', $this->content);
                }
        }