2 namespace TYPO3\CMS\Workspaces\Controller;
35 parent::initializeView($view);
37 $this->view->getModuleTemplate()->setFlashMessageQueue($this->controllerContext->getFlashMessageQueue());
45 $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
47 $moduleName = $currentRequest->getPluginName();
48 $getVars = $this->request->getArguments();
50 if (count($getVars) === 0) {
51 $modulePrefix = strtolower(
'tx_' .
$extensionName .
'_' . $moduleName);
52 $getVars = array(
'id',
'M', $modulePrefix);
54 $shortcutButton = $buttonBar->makeShortcutButton()
55 ->setModuleName($moduleName)
56 ->setGetVariables($getVars);
57 $buttonBar->addButton($shortcutButton);
66 public function indexAction()
70 $this->view->assign(
'showGrid', !(
$GLOBALS[
'BE_USER']->workspace === 0 && !
$GLOBALS[
'BE_USER']->isAdmin()));
71 $this->view->assign(
'showAllWorkspaceTab',
true);
75 $this->view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation($pageRecord);
78 $this->view->assign(
'showLegend', !(
$GLOBALS[
'BE_USER']->workspace === 0 && !
$GLOBALS[
'BE_USER']->isAdmin()));
79 $wsList = $wsService->getAvailableWorkspaces();
80 $activeWorkspace =
$GLOBALS[
'BE_USER']->workspace;
81 $performWorkspaceSwitch =
false;
85 if (!
$GLOBALS[
'BE_USER']->isAdmin()) {
86 $wsCur = array($activeWorkspace =>
true);
87 $wsList = array_intersect_key($wsList, $wsCur);
91 if (in_array($switchWs, array_keys($wsList)) && $activeWorkspace != $switchWs) {
92 $activeWorkspace = $switchWs;
93 $GLOBALS[
'BE_USER']->setWorkspace($activeWorkspace);
94 $performWorkspaceSwitch =
true;
101 $this->pageRenderer->addInlineSetting(
'Workspaces',
'isLiveWorkspace', (
int)
$GLOBALS[
'BE_USER']->workspace === 0);
102 $this->pageRenderer->addInlineSetting(
'Workspaces',
'workspaceTabs', $this->
prepareWorkspaceTabs($wsList, $activeWorkspace));
103 $this->pageRenderer->addInlineSetting(
'Workspaces',
'activeWorkspaceId', $activeWorkspace);
104 $this->pageRenderer->addInlineSetting(
'FormEngine',
'moduleUrl', BackendUtility::getModuleUrl(
'record_edit'));
105 $this->view->assign(
'performWorkspaceSwitch', $performWorkspaceSwitch);
106 $this->view->assign(
'workspaceList', $wsList);
107 $this->view->assign(
'activeWorkspaceUid', $activeWorkspace);
110 $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
111 $iconFactory = $this->view->getModuleTemplate()->getIconFactory();
112 $showButton = $buttonBar->makeLinkButton()
114 ->setOnClick(
'TYPO3.Workspaces.Actions.generateWorkspacePreviewLinksForAllLanguages();return false;')
115 ->setTitle($this->
getLanguageService()->sL(
'LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:tooltip.generatePagePreview',
true))
116 ->setIcon($iconFactory->getIcon(
'module-workspaces-action-preview-link',
Icon::SIZE_SMALL));
117 $buttonBar->addButton($showButton);
119 $this->view->assign(
'showPreviewLink', $wsService->canCreatePreviewLink(
GeneralUtility::_GP(
'id'), $activeWorkspace));
120 $GLOBALS[
'BE_USER']->setAndSaveSessionData(
'tx_workspace_activeWorkspace', $activeWorkspace);
132 $wsList = $wsService->getAvailableWorkspaces();
134 if (!
$GLOBALS[
'BE_USER']->isAdmin()) {
135 $activeWorkspace =
$GLOBALS[
'BE_USER']->workspace;
136 $wsCur = array($activeWorkspace =>
true);
137 $wsList = array_intersect_key($wsList, $wsCur);
143 $this->view->assign(
'showGrid',
true);
144 $this->view->assign(
'showLegend',
true);
145 $this->view->assign(
'showAllWorkspaceTab',
true);
146 $this->view->assign(
'workspaceList', $wsList);
148 $this->view->assign(
'showPreviewLink',
false);
151 $this->pageRenderer->addInlineSetting(
'Workspaces',
'allView',
'1');
163 $wsList = $wsService->getAvailableWorkspaces();
164 $activeWorkspace =
$GLOBALS[
'BE_USER']->workspace;
165 $wsCur = array($activeWorkspace =>
true);
166 $wsList = array_intersect_key($wsList, $wsCur);
168 $this->view->assign(
'showGrid',
true);
169 $this->view->assign(
'showAllWorkspaceTab',
false);
170 $this->view->assign(
'workspaceList', $wsList);
172 $this->pageRenderer->addInlineSetting(
'Workspaces',
'singleView',
'1');
182 parent::initializeAction();
183 $this->pageRenderer->addJsFile(
'sysext/backend/Resources/Public/JavaScript/ExtDirect.StateProvider.js');
185 $flashMessage =
GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS[
'LANG']->sL(
'LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:warning.oldStyleWorkspaceInUser'),
'', \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
189 $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
190 $defaultFlashMessageQueue->enqueue($flashMessage);
192 $this->pageRenderer->loadExtJS();
193 $states =
$GLOBALS[
'BE_USER']->uc[
'moduleData'][
'Workspaces'][
'States'];
194 $this->pageRenderer->addInlineSetting(
'Workspaces',
'States', $states);
196 $this->pageRenderer->addExtDirectCode(array(
199 $this->pageRenderer->addJsFile(
'sysext/backend/Resources/Public/JavaScript/extjs/ux/Ext.grid.RowExpander.js');
200 $this->pageRenderer->addJsFile(
'sysext/backend/Resources/Public/JavaScript/extjs/ux/Ext.app.SearchField.js');
201 $this->pageRenderer->addJsFile(
'sysext/backend/Resources/Public/JavaScript/extjs/ux/Ext.ux.FitToParent.js');
202 $resourcePath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath(
'workspaces') .
'Resources/Public/JavaScript/';
205 $this->pageRenderer->addCssFile($resourcePath .
'gridfilters/css/GridFilters.css');
206 $this->pageRenderer->addCssFile($resourcePath .
'gridfilters/css/RangeMenu.css');
209 $resourcePath .
'gridfilters/menu/RangeMenu.js',
210 $resourcePath .
'gridfilters/menu/ListMenu.js',
211 $resourcePath .
'gridfilters/GridFilters.js',
212 $resourcePath .
'gridfilters/filter/Filter.js',
213 $resourcePath .
'gridfilters/filter/StringFilter.js',
214 $resourcePath .
'gridfilters/filter/DateFilter.js',
215 $resourcePath .
'gridfilters/filter/ListFilter.js',
216 $resourcePath .
'gridfilters/filter/NumericFilter.js',
217 $resourcePath .
'gridfilters/filter/BooleanFilter.js',
218 $resourcePath .
'gridfilters/filter/BooleanFilter.js',
224 $resourcePath .
'Component/RowDetailTemplate.js',
225 $resourcePath .
'Component/RowExpander.js',
226 $resourcePath .
'Component/TabPanel.js',
227 $resourcePath .
'Store/mainstore.js',
228 $resourcePath .
'configuration.js',
229 $resourcePath .
'helpers.js',
230 $resourcePath .
'actions.js',
231 $resourcePath .
'component.js',
232 $resourcePath .
'toolbar.js',
233 $resourcePath .
'grid.js',
234 $resourcePath .
'workspaces.js'
237 $javaScriptFiles = array_merge($filters, $custom, $resources);
239 foreach ($javaScriptFiles as $javaScriptFile) {
240 $this->pageRenderer->addJsFile($javaScriptFile);
243 $this->pageRenderer->addInlineLanguageLabelFile($localizationResource);
245 $this->pageRenderer->addInlineSetting(
'RecordHistory',
'moduleUrl', BackendUtility::getModuleUrl(
'record_history'));
261 'title' => $workspaceList[$activeWorkspace],
262 'itemId' =>
'workspace-' . $activeWorkspace,
263 'workspaceId' => $activeWorkspace,
269 'title' =>
'All workspaces',
275 foreach ($workspaceList as $workspaceId => $workspaceTitle) {
276 if ($workspaceId === $activeWorkspace) {
280 'title' => $workspaceTitle,
281 'itemId' =>
'workspace-' . $workspaceId,
282 'workspaceId' => $workspaceId,
299 'id' => (
int)$this->pageId,
300 'workspace' => (
int)$workspaceId,
305 $this->uriBuilder->reset()->uriFor(
'fullIndex');
306 $parameters = array_merge($parameters, $this->uriBuilder->getArguments());
308 return BackendUtility::getModuleUrl(
'web_WorkspacesWorkspaces', $parameters);