Fixed bug #12457: Split view und grid don't use StateProvider yet
authortolleiv <tolleiv@743128fe-103e-dd11-99c4-001b210b3e58>
Tue, 22 Feb 2011 23:52:10 +0000 (23:52 +0000)
committertolleiv <tolleiv@743128fe-103e-dd11-99c4-001b210b3e58>
Tue, 22 Feb 2011 23:52:10 +0000 (23:52 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/CoreProjects/workspaces/workspaces/trunk@4175 743128fe-103e-dd11-99c4-001b210b3e58

typo3/sysext/workspaces/ChangeLog
typo3/sysext/workspaces/Classes/Controller/PreviewController.php
typo3/sysext/workspaces/Classes/Controller/ReviewController.php
typo3/sysext/workspaces/Resources/Private/Layouts/popup.html
typo3/sysext/workspaces/Resources/Public/JavaScript/preview.js
typo3/sysext/workspaces/Resources/Public/JavaScript/workspaces.js

index dd2d256..2eed64b 100644 (file)
@@ -1,5 +1,6 @@
 2011-02-22  Tolleiv Nietsch  <typo3@tolleiv.de>
 
+       * Fixed bug #12457: Split view und grid don't use StateProvider yet
        * Fixed bug #12855: Generate preview link visible in Live-Workspace and on non-content pages
 
 2011-02-21  Marco Bresch <typo3@starfinanz.de>
index e34d84b..c304ca3 100644 (file)
@@ -42,17 +42,23 @@ class Tx_Workspaces_Controller_PreviewController extends Tx_Workspaces_Controlle
        protected function initializeAction() {
                parent::initializeAction();
 
+               $this->template->setExtDirectStateProvider();
+
                $resourcePath = t3lib_extMgm::extRelPath('workspaces') . 'Resources/Public/';
                $GLOBALS['TBE_STYLES']['extJS']['theme'] = $resourcePath . 'StyleSheet/preview.css';
                $this->pageRenderer->loadExtJS();
                $this->pageRenderer->enableExtJSQuickTips();
-               $this->pageRenderer->enableExtJsDebug();
+
 
                        // Load  JavaScript:
                $this->pageRenderer->addExtDirectCode(array(
-                       'TYPO3.Workspaces'
+                       'TYPO3.Workspaces',
+                       'TYPO3.ExtDirectStateProvider'
                ));
 
+               $states = $GLOBALS['BE_USER']->uc['moduleData']['Workspaces']['States'];
+               $this->pageRenderer->addInlineSetting('Workspaces', 'States', $states);
+
                $this->pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/ux/flashmessages.js');
                $this->pageRenderer->addJsFile($this->backPath . 'js/extjs/iframepanel.js');
 
@@ -177,7 +183,7 @@ class Tx_Workspaces_Controller_PreviewController extends Tx_Workspaces_Controlle
                        'ContextHelpWindows' => array(
                                'width' => 600,
                                'height' => 400
-                       )
+                       ),
                );
 
                $t3LLLcore = array(
@@ -217,7 +223,7 @@ class Tx_Workspaces_Controller_PreviewController extends Tx_Workspaces_Controlle
                        $GLOBALS['LANG']->csConvObj->convArray($t3LLLcore, $GLOBALS['LANG']->charSet, 'utf-8');
                }
 
-               $js .= '
+               $js = '
                TYPO3.configuration = ' . json_encode($t3Configuration) . ';
                TYPO3.LLL = {
                        core : ' . json_encode($t3LLLcore) . '
index 98b7de4..1e2646c 100644 (file)
@@ -125,6 +125,8 @@ class Tx_Workspaces_Controller_ReviewController extends Tx_Workspaces_Controller
        protected function initializeAction() {
                parent::initializeAction();
 
+               $this->template->setExtDirectStateProvider();
+
                if (tx_Workspaces_Service_Workspaces::isOldStyleWorkspaceUsed()) {
                        $message = t3lib_div::makeInstance(
                                't3lib_FlashMessage',
@@ -138,7 +140,10 @@ class Tx_Workspaces_Controller_ReviewController extends Tx_Workspaces_Controller
 
                $this->pageRenderer->loadExtJS();
                $this->pageRenderer->enableExtJSQuickTips();
-               $this->pageRenderer->enableExtJsDebug();
+
+               $states = $GLOBALS['BE_USER']->uc['moduleData']['Workspaces']['States'];
+               $this->pageRenderer->addInlineSetting('Workspaces', 'States', $states);
+
 
                        // Load  JavaScript:
                $this->pageRenderer->addExtDirectCode(array(
index 89dd194..6c70211 100644 (file)
@@ -8,7 +8,8 @@
 
        function resize(height) {
                        // poor way to avoid that we require any scrollbars within the frames
-               var finalHeight = height * 1.1;
+               var currentHeight = isNaN(Ext.getCmp('wsContainer').getHeight()) ? 0 : Ext.getCmp('wsContainer').getHeight();
+               var finalHeight = Math.max(currentHeight, height * 1.1);
                Ext.getCmp('visualPanel').setHeight(finalHeight);
                Ext.getCmp('wsContainer').setHeight(finalHeight);
                Ext.getCmp('wsPanel').setHeight(finalHeight);
index 5f71dd2..8c84457 100644 (file)
  ***************************************************************/
 
 Ext.onReady(function() {
+
+       Ext.state.Manager.setProvider(new TYPO3.state.ExtDirectProvider({
+               key: 'moduleData.Workspaces.States',
+               autoRead: false
+       }));
+
+       if (Ext.isObject(TYPO3.settings.Workspaces.States)) {
+               Ext.state.Manager.getProvider().initState(TYPO3.settings.Workspaces.States);
+       }
+
+
        var iconClsChecked = 't3-icon t3-icon-status t3-icon-status-status t3-icon-status-checked';
        var iconClsEmpty = 't3-icon t3-icon-empty t3-icon-empty-empty t3-icon-empty';
+       var viewMode = 0;
+
+
        var viewport = new Ext.Viewport({
                layout: 'border',
                items: [{
@@ -39,10 +53,12 @@ Ext.onReady(function() {
                                id: 'controls',
                                width: 600,
                                items: [
-                                               {
+                                       {
+                                               xtype: 'panel',
+                                               width: 460,
+                                               items: [{
                                                        xtype: 'panel',
                                                        id: 'slider',
-                                                       width: 460,
                                                        layout: 'hbox',
                                                        items: [
                                                                {
@@ -95,61 +111,50 @@ Ext.onReady(function() {
                                                                        }
                                                                }
                                                        ]
-                                               },
-                                               {
-                                                       xtype: 'toolbar',
-                                                       id: 'visual-mode-toolbar',
-                                                       items: [{
-                                                               iconCls: 'x-btn-icon t3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-options-view',
-                                                               id: 'visual-mode-options',
-                                                               menu: {
-                                                                       id: 'visual-mode-selector',
-                                                                       items: [{
-                                                                               text: TYPO3.LLL.Workspaces.modeSlider,
-                                                                               id: 'visual-mode-selector-slider',
-                                                                               iconCls: iconClsChecked,
-                                                                               handler: function(){
-                                                                                       Ext.getCmp('visualPanel-hbox').hide();
-                                                                                       Ext.getCmp('visualPanel-vbox').hide();
-                                                                                       Ext.getCmp('visualPanel').show();
-                                                                                       Ext.getCmp('slider').show();
-                                                                                       Ext.select('#visual-mode-selector ul li a img.t3-icon-status-checked').removeClass(iconClsChecked.split(" "))
-                                                                                       Ext.getCmp('visual-mode-selector-slider').setIconClass(iconClsChecked);
-                                                                                       Ext.getCmp('visual-mode-selector-hbox').setIconClass(iconClsEmpty);
-                                                                                       Ext.getCmp('visual-mode-selector-vbox').setIconClass(iconClsEmpty);
-                                                                               }
-                                                                       },{
-                                                                               text: TYPO3.LLL.Workspaces.modeVbox,
-                                                                               id: 'visual-mode-selector-vbox',
-                                                                               iconCls: iconClsEmpty,
-                                                                               handler: function() {
-                                                                                       Ext.getCmp('visualPanel-hbox').hide();
-                                                                                       Ext.getCmp('visualPanel-vbox').show();
-                                                                                       Ext.getCmp('visualPanel').hide();
-                                                                                       Ext.getCmp('slider').hide();
-                                                                                       Ext.select('#visual-mode-selector ul li a img.t3-icon-status-checked').removeClass(iconClsChecked.split(" "))
-                                                                                       Ext.getCmp('visual-mode-selector-slider').setIconClass(iconClsEmpty);
-                                                                                       Ext.getCmp('visual-mode-selector-vbox').setIconClass(iconClsChecked)
-                                                                                       Ext.getCmp('visual-mode-selector-hbox').setIconClass(iconClsEmpty);
-                                                                               }
-                                                                       },{
-                                                                               text: TYPO3.LLL.Workspaces.modeHbox,
-                                                                               id: 'visual-mode-selector-hbox',
-                                                                               iconCls: iconClsEmpty,
-                                                                               handler: function(){
-                                                                                       Ext.getCmp('visualPanel-hbox').show();
-                                                                                       Ext.getCmp('visualPanel-vbox').hide();
-                                                                                       Ext.getCmp('visualPanel').hide();
-                                                                                       Ext.getCmp('slider').hide();
-                                                                                       Ext.select('#visual-mode-selector ul li a img.t3-icon-status-checked').removeClass(iconClsChecked.split(" "))
-                                                                                       Ext.getCmp('visual-mode-selector-slider').setIconClass(iconClsEmpty);
-                                                                                       Ext.getCmp('visual-mode-selector-vbox').setIconClass(iconClsEmpty);
-                                                                                       Ext.getCmp('visual-mode-selector-hbox').setIconClass(iconClsChecked);
-                                                                               }
-                                                                       }]
+                                               }]
+                                       },
+                                       {
+                                               id: 'visual-mode-toolbar',
+                                               items: [{
+                                                       xtype: 'button',
+                                                       iconCls: 'x-btn-icon t3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-options-view',
+                                                       id: 'visual-mode-options',
+                                                       menu: {
+                                                               id: 'visual-mode-selector',
+                                                               stateful: true,
+                                                               stateId: 'WorkspacePreviewModeSelect',
+                                                               stateEvents: ['itemclick'],
+                                                               items: [{
+                                                                       text: TYPO3.LLL.Workspaces.modeSlider,
+                                                                       id: 'visual-mode-selector-slider',
+                                                                       checked: false,
+                                                                       group: 'mode',
+                                                                       checkHandler: modeChange
+                                                               },{
+                                                                       text: TYPO3.LLL.Workspaces.modeVbox,
+                                                                       id: 'visual-mode-selector-vbox',
+                                                                       checked: false,
+                                                                       group: 'mode',
+                                                                       checkHandler: modeChange
+
+                                                               },{
+                                                                       text: TYPO3.LLL.Workspaces.modeHbox,
+                                                                       id: 'visual-mode-selector-hbox',
+                                                                       checked: false,
+                                                                       group: 'mode',
+                                                                       checkHandler: modeChange
+                                                               }],
+                                                               getState:function() {
+                                                                       return {viewMode: viewMode};
+                                                               },
+                                                               applyState: function(state) {
+                                                                       viewMode = state.viewMode;
+                                                                       modeChange(null, true, viewMode);
                                                                }
-                                                       }]
+                                                       }
                                                }]
+                                       }
+                               ]
                        }],
                        items: [{
                                title: TYPO3.LLL.Workspaces.visualPreview,
@@ -267,5 +272,57 @@ Ext.onReady(function() {
                                }]
                        }]
                }]
+
+
        });
+
+       function modeChange(item, checked, mode) {
+               if (checked) {
+                       var id ,
+                               ids = ['visual-mode-selector-slider', 'visual-mode-selector-hbox', 'visual-mode-selector-vbox'],
+                               panelHbox = Ext.getCmp('visualPanel-hbox'),
+                               panelVbox = Ext.getCmp('visualPanel-vbox'),
+                               panelSlider = Ext.getCmp('visualPanel'),
+                               slider = Ext.getCmp('slider'),
+                               itemSlider = Ext.getCmp('visual-mode-selector-slider'),
+                               itemHbox = Ext.getCmp('visual-mode-selector-hbox'),
+                               itemVbox = Ext.getCmp('visual-mode-selector-vbox');
+
+                       if (item) {
+                               mode = ids.indexOf(item.id);
+                       }
+
+                       Ext.select('#visual-mode-selector ul li a img.t3-icon-status-checked').removeClass(iconClsChecked.split(" "));
+
+                       if (mode === 0) {
+                               panelHbox.hide();
+                               panelVbox.hide();
+                               panelSlider.show();
+                               slider.show();
+                               viewMode = 0;
+                               itemSlider.setIconClass(iconClsChecked);
+                               itemHbox.setIconClass(iconClsEmpty);
+                               itemVbox.setIconClass(iconClsEmpty);
+                       } else if (mode === 1) {
+                               panelHbox.show();
+                               panelVbox.hide();
+                               panelSlider.hide();
+                               slider.hide();
+                               viewMode = 1;
+                               itemSlider.setIconClass(iconClsEmpty);
+                               itemHbox.setIconClass(iconClsChecked);
+                               itemVbox.setIconClass(iconClsEmpty);
+                       } else if (mode === 2) {
+                               panelHbox.hide();
+                               panelVbox.show();
+                               panelSlider.hide();
+                               slider.hide();
+                               viewMode = 2;
+                               itemSlider.setIconClass(iconClsEmpty);
+                               itemHbox.setIconClass(iconClsEmpty);
+                               itemVbox.setIconClass(iconClsChecked);
+                       }
+
+               }
+       }
 });
\ No newline at end of file
index 2bb1527..f222582 100644 (file)
@@ -37,7 +37,15 @@ TYPO3.Workspaces.App = {
 };
 
 Ext.onReady(function() {
-       Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
+       Ext.state.Manager.setProvider(new TYPO3.state.ExtDirectProvider({
+               key: 'moduleData.Workspaces.States',
+               autoRead: false
+       }));
+
+       if (Ext.isObject(TYPO3.settings.Workspaces.States)) {
+               Ext.state.Manager.getProvider().initState(TYPO3.settings.Workspaces.States);
+       }
+
        // Quicktips initialisieren
        Ext.QuickTips.init();