示例#1
0
 /**
  * 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);
 }
 function mkPreviewLinks()
 {
     $previewUrls = array();
     foreach ($this->pageIds as $pageId) {
         $ttlHours = intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours'));
         $ttlHours = $ttlHours ? $ttlHours : 24 * 2;
         $params = 'id=' . $pageId . '&L=' . $this->sysLang . '&ADMCMD_previewWS=' . $this->workspaceId;
         $previewUrls[$pageId] = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'index.php?ADMCMD_prev=' . t3lib_BEfunc::compilePreviewKeyword($params, $GLOBALS['BE_USER']->user['uid'], 60 * 60 * $ttlHours);
     }
     return $previewUrls;
 }
示例#3
0
 /**
  * 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_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($this->id);
         } else {
             $params = 'id=' . $this->id . '&ADMCMD_previewWS=' . $GLOBALS['BE_USER']->workspace;
             $previewUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . '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);
 }
示例#4
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;
    }