Ejemplo n.º 1
0
 /**
  * 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");
 }
    /**
     * Create the workspace information
     *
     * @return string HTML containing workspace info
     */
    protected function getWorkspaceInfo()
    {
        if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces') && ($GLOBALS['BE_USER']->workspace !== 0 || $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.onlineWorkspaceInfo'))) {
            $wsTitle = htmlspecialchars(\tx_Workspaces_Service_Workspaces::getWorkspaceTitle($GLOBALS['BE_USER']->workspace));
            $workspaceInfo = '
				<div class="bgColor4 workspace-info">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-toolbar-menu-workspace', array('title' => $wsTitle, 'onclick' => 'top.goToModule(\'web_WorkspacesWorkspaces\');', 'style' => 'cursor:pointer;')) . $wsTitle . '</div>
			';
        }
        return $workspaceInfo;
    }
Ejemplo n.º 3
0
 /**
  * Generates a view link for a page.
  *
  * @param string $table
  * @param string $uid
  * @return void
  */
 public function viewSingleRecord($table, $uid)
 {
     return tx_Workspaces_Service_Workspaces::viewSingleRecord($table, $uid);
 }
Ejemplo n.º 4
0
 /**
  * @param $parameter
  * @return
  */
 public function setWorkspace($parameter)
 {
     $workspaceId = intval($parameter->workSpaceId);
     $GLOBALS['BE_USER']->setWorkspace($workspaceId);
     return array('title' => tx_Workspaces_Service_Workspaces::getWorkspaceTitle($workspaceId), 'id' => $workspaceId);
 }
 /**
  * Creates the selector for workspaces
  *
  * @return	string		workspace selector as HTML select
  */
 public function render()
 {
     $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.workspace', true);
     $this->addJavascriptToBackend();
     $availableWorkspaces = tx_Workspaces_Service_Workspaces::getAvailableWorkspaces();
     $workspaceMenu = array();
     $stateCheckedIcon = t3lib_iconWorks::getSpriteIcon('status-status-checked');
     $stateUncheckedIcon = t3lib_iconWorks::getSpriteIcon('empty-empty', array('title' => $GLOBALS['LANG']->getLL('bookmark_inactive')));
     $workspaceMenu[] = '<a href="#" class="toolbar-item">' . t3lib_iconWorks::getSpriteIcon('apps-toolbar-menu-workspace', array('title' => $title)) . '</a>';
     $workspaceMenu[] = '<ul class="toolbar-item-menu" style="display: none;">';
     if (count($availableWorkspaces)) {
         foreach ($availableWorkspaces as $workspaceId => $label) {
             $selected = '';
             $icon = $stateUncheckedIcon;
             if ((int) $GLOBALS['BE_USER']->workspace === $workspaceId) {
                 $selected = ' class="selected"';
                 $icon = $stateCheckedIcon;
             }
             $workspaceMenu[] = '<li' . $selected . '>' . $icon . ' <a href="backend.php?changeWorkspace=' . intval($workspaceId) . '" id="ws-' . intval($workspaceId) . '" class="ws">' . $label . '</a></li>';
         }
     } else {
         $workspaceMenu[] = '<li>' . $stateUncheckedIcon . ' ' . $GLOBALS['LANG']->getLL('bookmark_noWSfound', true) . '</li>';
     }
     if ($GLOBALS['BE_USER']->check('modules', 'web_WorkspacesWorkspaces')) {
         // go to workspace module link
         $workspaceMenu[] = '<li class="divider">' . $stateUncheckedIcon . ' ' . '<a href="javascript:top.goToModule(\'web_WorkspacesWorkspaces\');" target="content" id="goToWsModule">' . ' ' . $GLOBALS['LANG']->getLL('bookmark_workspace', true) . '</a></li>';
     }
     $workspaceMenu[] = '</ul>';
     return implode(LF, $workspaceMenu);
 }
Ejemplo n.º 6
0
 /**
  * Initializes the controller before invoking an action method.
  *
  * @return void
  */
 protected function initializeAction()
 {
     parent::initializeAction();
     $this->template->setExtDirectStateProvider();
     if (tx_Workspaces_Service_Workspaces::isOldStyleWorkspaceUsed()) {
         $message = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:warning.oldStyleWorkspaceInUser'), '', t3lib_FlashMessage::WARNING);
         t3lib_FlashMessageQueue::addMessage($message);
     }
     $this->pageRenderer->loadExtJS();
     $this->pageRenderer->enableExtJSQuickTips();
     $states = $GLOBALS['BE_USER']->uc['moduleData']['Workspaces']['States'];
     $this->pageRenderer->addInlineSetting('Workspaces', 'States', $states);
     // Load  JavaScript:
     $this->pageRenderer->addExtDirectCode(array('TYPO3.Workspaces'));
     $this->pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/ux/flashmessages.js');
     $this->pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/ux/Ext.grid.RowExpander.js');
     $this->pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/ux/Ext.app.SearchField.js');
     $this->pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/ux/Ext.ux.FitToParent.js');
     $resourcePath = t3lib_extMgm::extRelPath('workspaces') . 'Resources/Public/JavaScript/';
     $this->pageRenderer->addCssFile($resourcePath . 'gridfilters/css/GridFilters.css');
     $this->pageRenderer->addCssFile($resourcePath . 'gridfilters/css/RangeMenu.css');
     $jsFiles = array('gridfilters/menu/RangeMenu.js', 'gridfilters/menu/ListMenu.js', 'gridfilters/GridFilters.js', 'gridfilters/filter/Filter.js', 'gridfilters/filter/StringFilter.js', 'gridfilters/filter/DateFilter.js', 'gridfilters/filter/ListFilter.js', 'gridfilters/filter/NumericFilter.js', 'gridfilters/filter/BooleanFilter.js', 'gridfilters/filter/BooleanFilter.js', 'configuration.js', 'helpers.js', 'actions.js', 'component.js', 'toolbar.js', 'grid.js', 'workspaces.js');
     foreach ($jsFiles as $jsFile) {
         $this->pageRenderer->addJsFile($resourcePath . $jsFile);
     }
 }
Ejemplo n.º 7
0
 /**
  * Generates grid list array from given versions.
  *
  * @param array $versions
  * @param string $filterTxt
  * @return void
  */
 protected function generateDataArray(array $versions, $filterTxt)
 {
     /** @var $stagesObj Tx_Workspaces_Service_Stages */
     $stagesObj = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages');
     /** @var $workspacesObj Tx_Workspaces_Service_Workspaces */
     $workspacesObj = t3lib_div::makeInstance('Tx_Workspaces_Service_Workspaces');
     $availableWorkspaces = $workspacesObj->getAvailableWorkspaces();
     $workspaceAccess = $GLOBALS['BE_USER']->checkWorkspace($GLOBALS['BE_USER']->workspace);
     $swapStage = $workspaceAccess['publish_access'] & 1 ? Tx_Workspaces_Service_Stages::STAGE_PUBLISH_ID : 0;
     $swapAccess = $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace) && $GLOBALS['BE_USER']->workspaceSwapAccess();
     $this->initializeWorkspacesCachingFramework();
     // check for dataArray in cache
     if ($this->getDataArrayFromCache($versions, $filterTxt) == FALSE) {
         $stagesObj = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages');
         foreach ($versions as $table => $records) {
             $versionArray = array('table' => $table);
             foreach ($records as $record) {
                 $origRecord = t3lib_BEFunc::getRecord($table, $record['t3ver_oid']);
                 $versionRecord = t3lib_BEFunc::getRecord($table, $record['uid']);
                 if (isset($GLOBALS['TCA'][$table]['columns']['hidden'])) {
                     $recordState = $this->workspaceState($versionRecord['t3ver_state'], $origRecord['hidden'], $versionRecord['hidden']);
                 } else {
                     $recordState = $this->workspaceState($versionRecord['t3ver_state']);
                 }
                 $isDeletedPage = $table == 'pages' && $recordState == 'deleted';
                 $viewUrl = tx_Workspaces_Service_Workspaces::viewSingleRecord($table, $record['t3ver_oid'], $origRecord);
                 $pctChange = $this->calculateChangePercentage($table, $origRecord, $versionRecord);
                 $versionArray['uid'] = $record['uid'];
                 $versionArray['workspace'] = $versionRecord['t3ver_id'];
                 $versionArray['label_Workspace'] = htmlspecialchars($versionRecord[$GLOBALS['TCA'][$table]['ctrl']['label']]);
                 $versionArray['label_Live'] = htmlspecialchars($origRecord[$GLOBALS['TCA'][$table]['ctrl']['label']]);
                 $versionArray['label_Stage'] = htmlspecialchars($stagesObj->getStageTitle($versionRecord['t3ver_stage']));
                 $versionArray['change'] = $pctChange;
                 $versionArray['path_Live'] = htmlspecialchars(t3lib_BEfunc::getRecordPath($record['livepid'], '', 999));
                 $versionArray['path_Workspace'] = htmlspecialchars(t3lib_BEfunc::getRecordPath($record['wspid'], '', 999));
                 $versionArray['workspace_Title'] = htmlspecialchars(tx_Workspaces_Service_Workspaces::getWorkspaceTitle($versionRecord['t3ver_wsid']));
                 $versionArray['workspace_Tstamp'] = $versionRecord['tstamp'];
                 $versionArray['workspace_Formated_Tstamp'] = t3lib_BEfunc::datetime($versionRecord['tstamp']);
                 $versionArray['t3ver_oid'] = $record['t3ver_oid'];
                 $versionArray['livepid'] = $record['livepid'];
                 $versionArray['stage'] = $versionRecord['t3ver_stage'];
                 $versionArray['icon_Live'] = t3lib_iconWorks::mapRecordTypeToSpriteIconClass($table, $origRecord);
                 $versionArray['icon_Workspace'] = t3lib_iconWorks::mapRecordTypeToSpriteIconClass($table, $versionRecord);
                 $versionArray['allowedAction_nextStage'] = $stagesObj->isNextStageAllowedForUser($versionRecord['t3ver_stage']);
                 $versionArray['allowedAction_prevStage'] = $stagesObj->isPrevStageAllowedForUser($versionRecord['t3ver_stage']);
                 if ($swapAccess && $swapStage != 0 && $versionRecord['t3ver_stage'] == $swapStage) {
                     $versionArray['allowedAction_swap'] = $stagesObj->isNextStageAllowedForUser($swapStage);
                 } else {
                     if ($swapAccess && $swapStage == 0) {
                         $versionArray['allowedAction_swap'] = TRUE;
                     } else {
                         $versionArray['allowedAction_swap'] = FALSE;
                     }
                 }
                 $versionArray['allowedAction_delete'] = TRUE;
                 // preview and editing of a deleted page won't work ;)
                 $versionArray['allowedAction_view'] = !$isDeletedPage && $viewUrl;
                 $versionArray['allowedAction_edit'] = !$isDeletedPage;
                 $versionArray['allowedAction_editVersionedPage'] = !$isDeletedPage;
                 $versionArray['state_Workspace'] = $recordState;
                 if ($filterTxt == '' || $this->isFilterTextInVisibleColumns($filterTxt, $versionArray)) {
                     $this->dataArray[] = $versionArray;
                 }
             }
         }
         $this->sortDataArray();
         $this->setDataArrayIntoCache($versions, $filterTxt);
     }
     $this->sortDataArray();
 }
Ejemplo n.º 8
0
 /**
  * @test
  **/
 public function movedElementsCanBeFoundUsingTheirLiveUID()
 {
     $this->importDataSet(dirname(__FILE__) . '/fixtures/dbDefaultWorkspaces.xml');
     $this->importDataSet(dirname(__FILE__) . '/fixtures/dbMovedContent.xml');
     // Test if the placeholder can be found when we ask using recursion (same result)
     $service = new tx_Workspaces_Service_Workspaces();
     $result = $service->selectVersionsInWorkspace(91, 0, -99, 3, 99);
     $this->assertEquals(1, sizeof($result), "Wrong amount of versions found within workspace 91");
     $this->assertEquals(1, sizeof($result['pages']), "Wrong amount of page versions found within workspace 91");
     $this->assertEquals(103, $result['pages'][0]['uid'], "Wrong move-to pointer found for page 3 in workspace 91");
 }