Index: Classes/Controller/PreviewController.php =================================================================== --- Classes/Controller/PreviewController.php (revision 4171) +++ Classes/Controller/PreviewController.php (working copy) @@ -42,17 +42,23 @@ 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 @@ 'ContextHelpWindows' => array( 'width' => 600, 'height' => 400 - ) + ), ); $t3LLLcore = array( @@ -217,7 +223,7 @@ $GLOBALS['LANG']->csConvObj->convArray($t3LLLcore, $GLOBALS['LANG']->charSet, 'utf-8'); } - $js .= ' + $js = ' TYPO3.configuration = ' . json_encode($t3Configuration) . '; TYPO3.LLL = { core : ' . json_encode($t3LLLcore) . ' Index: Classes/Controller/ReviewController.php =================================================================== --- Classes/Controller/ReviewController.php (revision 4172) +++ Classes/Controller/ReviewController.php (working copy) @@ -125,6 +125,8 @@ protected function initializeAction() { parent::initializeAction(); + $this->template->setExtDirectStateProvider(); + if (tx_Workspaces_Service_Workspaces::isOldStyleWorkspaceUsed()) { $message = t3lib_div::makeInstance( 't3lib_FlashMessage', @@ -138,8 +140,11 @@ $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( 'TYPO3.Workspaces' Index: Resources/Private/Layouts/popup.html =================================================================== --- Resources/Private/Layouts/popup.html (revision 4171) +++ Resources/Private/Layouts/popup.html (working copy) @@ -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: Resources/Public/JavaScript/preview.js =================================================================== --- Resources/Public/JavaScript/preview.js (revision 4171) +++ Resources/Public/JavaScript/preview.js (working copy) @@ -25,8 +25,22 @@ ***************************************************************/ 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 @@ id: 'controls', width: 600, items: [ - { + { + xtype: 'panel', + width: 460, + items: [{ xtype: 'panel', id: 'slider', - width: 460, layout: 'hbox', items: [ { @@ -95,61 +111,50 @@ } } ] - }, - { - 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 @@ }] }] }] + + }); + + 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: Resources/Public/JavaScript/workspaces.js =================================================================== --- Resources/Public/JavaScript/workspaces.js (revision 4171) +++ Resources/Public/JavaScript/workspaces.js (working copy) @@ -37,7 +37,15 @@ }; 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();