Fixed bug #9819: Workspace preview window
authortolleiv <tolleiv@743128fe-103e-dd11-99c4-001b210b3e58>
Tue, 14 Dec 2010 16:00:43 +0000 (16:00 +0000)
committertolleiv <tolleiv@743128fe-103e-dd11-99c4-001b210b3e58>
Tue, 14 Dec 2010 16:00:43 +0000 (16:00 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/CoreProjects/workspaces/workspaces/trunk@3360 743128fe-103e-dd11-99c4-001b210b3e58

typo3/sysext/workspaces/ChangeLog
typo3/sysext/workspaces/Classes/Controller/PreviewController.php
typo3/sysext/workspaces/Classes/Service/Fehooks.php [new file with mode: 0644]
typo3/sysext/workspaces/Resources/Private/Language/locallang.xml
typo3/sysext/workspaces/Resources/Private/Layouts/popup.html
typo3/sysext/workspaces/Resources/Private/Templates/Preview/Preview.html [new file with mode: 0644]
typo3/sysext/workspaces/Resources/Public/JavaScript/preview.js
typo3/sysext/workspaces/ext_localconf.php

index 531289d..d01e699 100644 (file)
@@ -1,3 +1,7 @@
+2010-12-14  Tolleiv Nietsch <typo3q@tolleiv.de>
+
+       * Fixed bug #9819: Workspace preview window
+
 2010-12-05  Steffen Gebert  <steffen@steffen-gebert.de>
 
        * Fixed bug #11290: PHP notices from XCLASS inclusions
@@ -71,7 +75,7 @@
 
 2010-11-17  Tolleiv Nietsch <info@tolleiv.de>
 
-       * Fixed bug: #10896 php-warnings after merge into Core - missing argument 
+       * Fixed bug: #10896 php-warnings after merge into Core - missing argument
        * Fixed bug: #10895 php-warnings after merge into Core - array_merge on non-array
 
 2010-11-17  Steffen Ritter  <info@rs-websystems.de>
index bcd9780..af4f3f5 100644 (file)
@@ -72,6 +72,7 @@ class Tx_Workspaces_Controller_PreviewController extends Tx_Workspaces_Controlle
         * @return void
         */
        public function indexAction() {
+               // @todo language doesn't always come throught the L parameter
                // @todo Evaluate how the intval() call can be used with Extbase validators/filters
                $language = intval(t3lib_div::_GP('L'));
 
@@ -102,6 +103,15 @@ class Tx_Workspaces_Controller_PreviewController extends Tx_Workspaces_Controlle
                $this->view->assign('wsUrl', $wsBaseUrl . '&ADMCMD_view=1&ADMCMD_editIcons=1&ADMCMD_previewWS=' . $GLOBALS['BE_USER']->workspace);
                $this->view->assign('wsSettingsUrl', $wsSettingsUrl);
                $this->view->assign('wsHelpUrl', $wsHelpUrl);
+               $this->view->assign('backendDomain', t3lib_div::getIndpEnv('TYPO3_HOST_ONLY'));
+               $GLOBALS['BE_USER']->setAndSaveSessionData('workspaces.backend_domain', t3lib_div::getIndpEnv('TYPO3_HOST_ONLY'));
+               $this->pageRenderer->addJsInlineCode("workspaces.preview.lll" , "TYPO3.LLL.Workspaces = {
+                       visualPreview: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.visualPreview', true) . "',
+                       listView: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.listView', true) . "',
+                       helpView: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.helpView', true) . "',
+                       livePreview: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.livePreview', true) . "',
+                       workspacePreview: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.workspacePreview', true) . "'
+               };\n");
        }
 
        /**
diff --git a/typo3/sysext/workspaces/Classes/Service/Fehooks.php b/typo3/sysext/workspaces/Classes/Service/Fehooks.php
new file mode 100644 (file)
index 0000000..bd4d49b
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * @author Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)
+ * @package Workspaces
+ * @subpackage Service
+ */
+class tx_Workspaces_Service_Fehooks {
+
+       /**
+        * @param tslib_fe $pObj
+        * @return void
+        */
+       public function hook_eofe($params, $pObj) {
+               if ($pObj->fePreview != 2) {
+                       return;
+               }
+
+               echo $GLOBALS['TSFE']->cObj->cObjGetSingle(
+                       'FLUIDTEMPLATE',
+                       array(
+                               'file' => 'EXT:workspaces/Resources/Private/Templates/Preview/Preview.html',
+                               'variables.' => array(
+                                       'backendDomain' => 'TEXT',
+                                       'backendDomain.' => array('value' => $GLOBALS['BE_USER']->getSessionData('workspaces.backend_domain'))
+                               )
+                       )
+               );
+       }
+}
\ No newline at end of file
index b3202e0..88d9589 100644 (file)
                        <label index="warning.oldStyleWorkspaceInUser">It seems that you're still using old-style workspace. Please use the update scripts in the TYPO3 Install Tool to run the necessary updates. If you continue using this module without migrating your workspace you might loose data.</label>
                        <label index="info.newpage">New Page!</label>
                        <label index="info.newpage.detail">The previewed page has been created in a workspace and has no live counterpart.</label>
+                       <label index="preview.visualPreview">Visual preview</label>
+                       <label index="preview.listView">List view</label>
+                       <label index="preview.helpView">Help</label>
+                       <label index="preview.livePreview">Live</label>
+                       <label index="preview.workspacePreview">Workspace</label>
                </languageKey>
        </data>
 </T3locallang>
\ No newline at end of file
index fc86011..ddd83a1 100644 (file)
@@ -5,4 +5,13 @@
        var wsUrl = '{wsUrl}';
        var wsSettingsUrl = '{wsSettingsUrl}';
        var wsHelpUrl = '{wsHelpUrl}';
+       document.domain = '{backendDomain}';
+
+       function resize(height) {
+                       // poor way to avoid that we require any scrollbars within the frames 
+               var finalHeight = height * 1.1;
+               Ext.getCmp('visualPanel').setHeight(finalHeight);
+               Ext.getCmp('wsPanel').setHeight(finalHeight);
+               Ext.getCmp('livePanel').setHeight(finalHeight);
+       }
 </script>
diff --git a/typo3/sysext/workspaces/Resources/Private/Templates/Preview/Preview.html b/typo3/sysext/workspaces/Resources/Private/Templates/Preview/Preview.html
new file mode 100644 (file)
index 0000000..0fc2d04
--- /dev/null
@@ -0,0 +1,6 @@
+<script type="text/javascript">
+       document.domain =  '{backendDomain}';
+
+       // @todo redirect to split module if this is opened standalone
+        parent.resize(document.height);
+</script>
\ No newline at end of file
index c3e0cf2..4c5b2e0 100644 (file)
 Ext.onReady(function() {
        var viewport = new Ext.Viewport({
                layout: 'border',
-               items: [
-               {
+               items: [{
                        xtype: 'tabpanel',
                        region: 'center', // a center region is ALWAYS required for border layout
                        id: 'preview',
                        activeTab: 0,
-                       items: [
-                               {
-                                       title: 'Workspace preview',
-                                       id: 'workspaceRegion',
-                                       layout: 'fit',
-                                       items: [{
-                                               xtype: 'iframePanel',
-                                               id: 'wsPanel',
-                                               doMask: false,
-                                               src: wsUrl
-                                       }]
-                               }, {
-                                       title: 'Live site',
-                                       id: 'liveRegion',
+                       items: [{
+                               title: TYPO3.LLL.Workspaces.visualPreview,
+                               layout: 'fit',
+                               items: [{
                                        layout: 'fit',
+                                       x: 0, y:0,
+                                       anchor: '100% 100%',
+                                       autoScroll: true,
                                        items: [{
-                                               xtype: 'iframePanel',
-                                               id: 'livePanel',
-                                               doMask: false,
-                                               src: liveUrl
-                                       }]
-                               },{
-                                       title: 'List view',
-                                       id: 'wsSettings',
-                                       layout: 'fit',
-                                       items:  [{
-                                               xtype: 'iframePanel',
-                                               id: 'settingsPanel',
-                                               doMask: false,
-                                               src: wsSettingsUrl
-                                       }]
-                               },{
-                                       title: 'Help',
-                                       id: 'wsHelp',
-                                       layout: 'fit',
-                                       items:  [{
-                                               xtype: 'iframePanel',
-                                               id: 'settingsPanel',
-                                               doMask: false,
-                                               src: wsHelpUrl
+                                               layout: 'absolute',
+                                               id: 'visualPanel',
+                                               items: [{
+                                                       x: 0, y:0,
+                                                       anchor: '100% 100%',
+                                                       id: 'wsContainer',
+                                                       layout: 'absolute',
+                                                       autoScroll: false,
+                                                       items:[{
+                                                               xtype: 'iframePanel',
+                                                               x: 0, y:0,
+                                                               id: 'wsPanel',
+                                                               doMask: false,
+                                                               src: wsUrl,
+                                                               autoScroll: false
+                                                       }]
+                                               },{
+                                                       x: 0, y:0,
+                                                       anchor: '100% 0%',
+                                                       id: 'liveContainer',
+                                                       layout: 'absolute',
+                                                       bodyStyle: 'height:0px;border-bottom: 2px solid red;',
+                                                       autoScroll: false,
+                                                       items:[{
+                                                               xtype: 'iframePanel',
+                                                               x: 0, y:0,
+                                                               id: 'livePanel',
+                                                               doMask: false,
+                                                               src: liveUrl,
+                                                               autoScroll: false
+                                                       }]
+                                               }]
                                        }]
+                               }]
+                       },{
+                               title: TYPO3.LLL.Workspaces.listView,
+                               id: 'wsSettings',
+                               layout: 'fit',
+                               items:  [{
+                                       xtype: 'iframePanel',
+                                       id: 'settingsPanel',
+                                       doMask: false,
+                                       src: wsSettingsUrl
+                               }]
+                       },{
+                               title: TYPO3.LLL.Workspaces.helpView,
+                               id: 'wsHelp',
+                               layout: 'fit',
+                               items:  [{
+                                       xtype: 'iframePanel',
+                                       id: 'settingsPanel',
+                                       doMask: false,
+                                       src: wsHelpUrl
+                               }]
+                       }],
+                       tbar: [
+                               '->', '-',
+                               {
+                                       xtype: 'tbtext',
+                                       text: TYPO3.LLL.Workspaces.livePreview
+                               },
+                               {
+                                       xtype: 'slider',
+                                       id: 'sizeSlider',
+                                       style: 'margin: 0 5px;',
+                                       maxValue: 100,
+                                       minValue: 0,
+                                       value: 100,
+                                       width: 200,
+                                       listeners: {
+                                               change: {
+                                                       fn: function resizeFromValue(slider, newValue, thumb) {
+                                                               var height = Ext.getCmp('wsPanel').getHeight();
+                                                               Ext.getCmp('liveContainer').setHeight(height * (100-newValue) / 100);
+                                                               Ext.getCmp('visualPanel').setHeight(height);
+                                                       }
+                                               }
+                                       }
+                               },
+                               {
+                                       xtype: 'tbtext',
+                                       text: TYPO3.LLL.Workspaces.workspacePreview
                                }
                        ]
                }]
index 177b299..dacffe2 100644 (file)
@@ -18,4 +18,6 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['tx_Workspaces_S
 
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']['workspaces'] = 'EXT:workspaces/Classes/Service/Tcemain.php:tx_Workspaces_Service_Tcemain';
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['viewOnClickClass']['workspaces'] = 'EXT:workspaces/Classes/Service/Tcemain.php:tx_Workspaces_Service_Befunc';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_eofe']['workspaces'] = 'EXT:workspaces/Classes/Service/Fehooks.php:tx_Workspaces_Service_Fehooks->hook_eofe';
+
 ?>
\ No newline at end of file