/** * Generates a workspace preview link. * * @param integer $uid The ID of the record to be linked * @return string the full domain including the protocol http:// or https://, but without the trailing '/' */ public function generateWorkspacePreviewLink($uid) { $ttlHours = intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours')); $ttlHours = ($ttlHours ? $ttlHours : 24 * 2) * 3600; $linkParams = array('ADMCMD_prev' => t3lib_BEfunc::compilePreviewKeyword('', $GLOBALS['BE_USER']->user['uid'], $ttlHours, $this->getCurrentWorkspace()), 'id' => $uid); return t3lib_BEfunc::getViewDomain($uid) . '/index.php?' . t3lib_div::implodeArrayForUrl('', $linkParams); }
/** * Basically makes sure that the workspace preview is rendered. * The preview itself consists of three frames, so there are * only the frames-urls we've to generate here * * @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')); $controller = t3lib_div::makeInstance('Tx_Workspaces_Controller_ReviewController', TRUE); /** @var $uriBuilder Tx_Extbase_MVC_Web_Routing_UriBuilder */ $uriBuilder = $this->objectManager->create('Tx_Extbase_MVC_Web_Routing_UriBuilder'); $wsSettingsPath = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'typo3/'; $wsSettingsUri = $uriBuilder->uriFor('singleIndex', array(), 'Tx_Workspaces_Controller_ReviewController', 'workspaces', 'web_workspacesworkspaces'); $wsSettingsParams = '&tx_workspaces_web_workspacesworkspaces[controller]=Review'; $wsSettingsUrl = $wsSettingsPath . $wsSettingsUri . $wsSettingsParams; $viewDomain = t3lib_BEfunc::getViewDomain($this->pageId); $wsBaseUrl = $viewDomain . '/index.php?id=' . $this->pageId . '&L=' . $language; // @todo - handle new pages here // branchpoints are not handled anymore because this feature is not supposed anymore if (tx_Workspaces_Service_Workspaces::isNewPage($this->pageId)) { $wsNewPageUri = $uriBuilder->uriFor('newPage', array(), 'Tx_Workspaces_Controller_PreviewController', 'workspaces', 'web_workspacesworkspaces'); $wsNewPageParams = '&tx_workspaces_web_workspacesworkspaces[controller]=Preview'; $this->view->assign('liveUrl', $wsSettingsPath . $wsNewPageUri . $wsNewPageParams); } else { $this->view->assign('liveUrl', $wsBaseUrl . '&ADMCMD_noBeUser=1'); } $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('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 = {\n\t\t\tvisualPreview: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.visualPreview', true) . "',\n\t\t\tlistView: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.listView', true) . "',\n\t\t\tlivePreview: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.livePreview', true) . "',\n\t\t\tlivePreviewDetail: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.livePreviewDetail', true) . "',\n\t\t\tworkspacePreview: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.workspacePreview', true) . "',\n\t\t\tworkspacePreviewDetail: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.workspacePreviewDetail', true) . "',\n\t\t\tmodeSlider: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.modeSlider', true) . "',\n\t\t\tmodeVbox: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.modeVbox', true) . "',\n\t\t\tmodeHbox: '" . $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:preview.modeHbox', true) . "'\n\t\t};\n"); }
/** * Management of workspace for page ID * Called when $this->id is set. * * @return void */ function workspaceMgm() { // Perform workspace publishing action if buttons are pressed: $errors = $this->publishAction(); // Generate workspace overview: $WSoverview = $this->displayWorkspaceOverview(); // Buttons for publish / swap: $actionLinks = '<br />'; if ($GLOBALS['BE_USER']->workspace !== 0) { if ($this->publishAccess) { $actionLinks .= '<input type="submit" name="_publish" value="' . $GLOBALS['LANG']->getLL('publishPage') . '" onclick="return confirm(\'' . sprintf($GLOBALS['LANG']->getLL('publishPageQuestion'), $GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1 ? $GLOBALS['LANG']->getLL('publishPageQuestionStage') : '') . '\');"/>'; if ($GLOBALS['BE_USER']->workspaceSwapAccess()) { $actionLinks .= '<input type="submit" name="_swap" value="' . $GLOBALS['LANG']->getLL('swapPage') . '" onclick="return confirm(\'' . sprintf($GLOBALS['LANG']->getLL('swapPageQuestion'), $GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1 ? $GLOBALS['LANG']->getLL('publishPageQuestionStage') : '') . '\');" />'; } } else { $actionLinks .= $this->doc->icons(1) . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_user_ws.xml:no_publish_permission'); } } $actionLinks .= '<input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('refresh') . '" />'; $actionLinks .= '<input type="submit" name="_previewLink" value="' . $GLOBALS['LANG']->getLL('previewLink') . '" />'; $actionLinks .= '<input type="checkbox" class="checkbox" name="_previewLink_wholeWorkspace" id="_previewLink_wholeWorkspace" value="1" /><label for="_previewLink_wholeWorkspace">' . $GLOBALS['LANG']->getLL('allowPreviewOfWholeWorkspace') . '</label>'; $actionLinks .= $this->displayWorkspaceOverview_allStageCmd(); if ($actionLinks || count($errors)) { $this->content .= $this->doc->section('', $actionLinks . (count($errors) ? '<h3>' . $GLOABLS['LANG']->getLL('errors') . '</h3><br />' . implode('<br />', $errors) . '<hr />' : ''), 0, 1); } if (t3lib_div::_POST('_previewLink')) { $ttlHours = intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours')); $ttlHours = $ttlHours ? $ttlHours : 24 * 2; if (t3lib_div::_POST('_previewLink_wholeWorkspace')) { $previewUrl = t3lib_BEfunc::getViewDomain($this->id) . '/index.php?ADMCMD_prev=' . t3lib_BEfunc::compilePreviewKeyword('', $GLOBALS['BE_USER']->user['uid'], 60 * 60 * $ttlHours, $GLOBALS['BE_USER']->workspace) . '&id=' . intval($this->id); } else { $params = 'id=' . $this->id . '&ADMCMD_previewWS=' . $GLOBALS['BE_USER']->workspace; $previewUrl = t3lib_BEfunc::getViewDomain($this->id) . '/index.php?ADMCMD_prev=' . t3lib_BEfunc::compilePreviewKeyword($params, $GLOBALS['BE_USER']->user['uid'], 60 * 60 * $ttlHours); } $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('previewUrl'), sprintf($GLOBALS['LANG']->getLL('previewInstruction'), $ttlHours) . '<br /><br /><a target="_blank" href="' . htmlspecialchars($previewUrl) . '">' . $previewUrl . '</a>', 0, 1); } // Output overview content: $this->content .= $this->doc->spacer(15); $this->content .= $this->doc->section($this->details ? $GLOBALS['LANG']->getLL('versionDetails') : $GLOBALS['LANG']->getLL('wsManagement'), $WSoverview, 0, 1); }
/** * Rendering the content for the publish and review panel in the workspace manager * * @return string HTML content */ function moduleContent_publish() { global $LANG; // Initialize: $content = ''; $details = t3lib_div::_GP('details'); // Create additional menus: $menu = ''; if ($GLOBALS['BE_USER']->workspace === 0) { $menu .= t3lib_BEfunc::getFuncMenu(0, 'SET[filter]', $this->MOD_SETTINGS['filter'], $this->MOD_MENU['filter']); $menu .= t3lib_BEfunc::getFuncMenu(0, 'SET[display]', $this->MOD_SETTINGS['display'], $this->MOD_MENU['display']); } $menu .= t3lib_BEfunc::getFuncMenu(0, 'SET[diff]', $this->MOD_SETTINGS['diff'], $this->MOD_MENU['diff']); if ($GLOBALS['BE_USER']->workspace !== 0) { $menu .= t3lib_BEfunc::getFuncCheck(0, 'SET[expandSubElements]', $this->MOD_SETTINGS['expandSubElements'], '', '', 'id="checkExpandSubElements"') . ' <label for="checkExpandSubElements">' . $LANG->getLL('label_showsubelements') . '</label> '; } // Create header: $title = ''; $description = ''; switch ($GLOBALS['BE_USER']->workspace) { case 0: $title = t3lib_iconWorks::getIconImage('sys_workspace', array(), $this->doc->backPath, ' align="top"') . '[' . $LANG->getLL('shortcut_onlineWS') . ']'; $description = $LANG->getLL('workspace_description_live'); break; case -1: $title = t3lib_iconWorks::getIconImage('sys_workspace', array(), $this->doc->backPath, ' align="top"') . '[' . $LANG->getLL('shortcut_offlineWS') . ']'; $description = $LANG->getLL('workspace_description_draft'); break; case -99: $title = $this->doc->icons(3) . '[' . $LANG->getLL('shortcut_noWSfound') . ']'; $description = $LANG->getLL('workspace_description_no_access'); break; default: $title = t3lib_iconWorks::getIconImage('sys_workspace', $GLOBALS['BE_USER']->workspaceRec, $this->doc->backPath, ' align="top"') . '[' . $GLOBALS['BE_USER']->workspace . '] ' . t3lib_BEfunc::getRecordTitle('sys_workspace', $GLOBALS['BE_USER']->workspaceRec, TRUE); $description = $GLOBALS['BE_USER']->workspaceRec['description']; break; } // Buttons for publish / swap: $actionLinks = ''; if ($GLOBALS['BE_USER']->workspace !== 0) { if ($this->publishAccess) { $confirmation = $LANG->JScharCode($LANG->getLL($GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1 ? 'submit_publish_workspace_confirmation_1' : 'submit_publish_workspace_confirmation_2')); $actionLinks .= '<input type="submit" name="_publish" value="' . $LANG->getLL('submit_publish_workspace') . '" onclick="if (confirm(' . $confirmation . ')) window.location.href=\'publish.php?swap=0\';return false"/>'; if ($GLOBALS['BE_USER']->workspaceSwapAccess()) { $confirmation = $LANG->JScharCode($LANG->getLL($GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1 ? 'submit_swap_workspace_confirmation_1' : 'submit_swap_workspace_confirmation_2')); $actionLinks .= '<input type="submit" name="_swap" value="' . $LANG->getLL('submit_swap_workspace') . '" onclick="if (confirm(' . $confirmation . ')) window.location.href=\'publish.php?swap=1\';return false ;" />'; } } else { $actionLinks .= $this->doc->icons(1) . $LANG->getLL('no_publish_permission'); } // Preview of workspace link if (t3lib_div::_POST('_previewLink')) { $ttlHours = intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours')); $ttlHours = $ttlHours ? $ttlHours : 24 * 2; $previewUrl = t3lib_BEfunc::getViewDomain($this->id) . '/index.php?ADMCMD_prev=' . t3lib_BEfunc::compilePreviewKeyword('', $GLOBALS['BE_USER']->user['uid'], 60 * 60 * $ttlHours, $GLOBALS['BE_USER']->workspace) . '&id=' . intval($GLOBALS['BE_USER']->workspaceRec['db_mountpoints']); $actionLinks .= '<br />Any user can browse the workspace frontend using this link for the next ' . $ttlHours . ' hours (does not require backend login):<br /><br /><a target="_blank" href="' . htmlspecialchars($previewUrl) . '">' . $previewUrl . '</a>'; } else { $actionLinks .= '<input type="submit" name="_previewLink" value="Generate Workspace Preview Link" />'; } } $wsAccess = $GLOBALS['BE_USER']->checkWorkspace($GLOBALS['BE_USER']->workspaceRec); // Add header to content variable: $content = ' <table border="0" cellpadding="0" cellspacing="0" id="t3-user-ws-wsinfotable" class="t3-table t3-table-info"> <tr> <td class="t3-col-header" nowrap="nowrap">' . $LANG->getLL('label_workspace') . ' </th> <td nowrap="nowrap">' . $title . '</td> </tr> <tr>' . ($description ? ' <td class="t3-col-header" nowrap="nowrap">' . $LANG->getLL('label_description') . ' </td> <td>' . $description . '</td> </tr>' : '') . ($GLOBALS['BE_USER']->workspace != -99 && !$details ? ' <tr> <td class="t3-col-header" nowrap="nowrap">' . $LANG->getLL('label_options') . ' </td> <td>' . $menu . $actionLinks . '</td> </tr> <tr> <td class="t3-col-header" nowrap="nowrap">' . $LANG->getLL('label_status') . ' </td> <td>' . $LANG->getLL('label_access_level') . ' ' . $GLOBALS['LANG']->getLL('workspace_list_access_' . $wsAccess['_ACCESS']) . '</td> </tr>' : '') . ' </table> <br /> '; // Add publishing and review overview: if ($GLOBALS['BE_USER']->workspace != -99) { if ($details) { $content .= $this->displayVersionDetails($details); } else { $content .= $this->displayWorkspaceOverview(); } $content .= '<br />'; } // Return content: return $content; }