Exemplo n.º 1
0
    /**
     * 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'] ? htmlspecialchars($GLOBALS['BE_USER']->workspaceRec['description']) : '<em>[' . $LANG->getLL('shortcut_noWSfound') . ']</em>';
                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_div::getIndpEnv('TYPO3_SITE_URL') . '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') . '&nbsp;</th>
				<td nowrap="nowrap">' . $title . '</td>
			</tr>
			<tr>
				<td class="t3-col-header" nowrap="nowrap">' . $LANG->getLL('label_description') . '&nbsp;</td>
				<td>' . $description . '</td>
			</tr>' . ($GLOBALS['BE_USER']->workspace != -99 && !$details ? '
			<tr>
				<td class="t3-col-header" nowrap="nowrap">' . $LANG->getLL('label_options') . '&nbsp;</td>
				<td>' . $menu . $actionLinks . '</td>
			</tr>
			<tr>
				<td class="t3-col-header" nowrap="nowrap">' . $LANG->getLL('label_status') . '&nbsp;</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;
    }