📄 index.php
字号:
if (t3lib_div::_POST('_previewLink')) { $params = 'id='.$this->id.'&ADMCMD_view=1&ADMCMD_editIcons=1&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']); $this->content.= $this->doc->section('Preview Url:','You can preview this page from the workspace using this link for the next 48 hours (does not require backend login):<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 ? 'Details for version' : 'Workspace management', $WSoverview,0,1); } /** * Rendering the overview of versions in the current workspace * * @return string HTML (table) * @see typo3/mod/user/ws/index.php for sister function! */ function displayWorkspaceOverview() { // Initialize variables: $this->showWorkspaceCol = $GLOBALS['BE_USER']->workspace===0 && $this->MOD_SETTINGS['display']<=-98; // Get usernames and groupnames $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid'); $groupArray = array_keys($be_group_Array); $this->be_user_Array = t3lib_BEfunc::getUserNames(); if (!$GLOBALS['BE_USER']->isAdmin()) $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array,$groupArray,1); // Initialize Workspace ID and filter-value: if ($GLOBALS['BE_USER']->workspace===0) { $wsid = $this->details ? -99 : $this->MOD_SETTINGS['display']; // Set wsid to the value from the menu (displaying content of other workspaces) $filter = $this->details ? 0 : $this->MOD_SETTINGS['filter']; } else { $wsid = $GLOBALS['BE_USER']->workspace; $filter = 0; } // Initialize workspace object and request all pending versions: $wslibObj = t3lib_div::makeInstance('wslib'); // Selecting ALL versions belonging to the workspace: $versions = $wslibObj->selectVersionsInWorkspace($wsid, $filter, -99, $this->uid); // $this->uid is the page id of LIVE record. // Traverse versions and build page-display array: $pArray = array(); foreach($versions as $table => $records) { foreach($records as $rec) { $pageIdField = $table==='pages' ? 't3ver_oid' : 'realpid'; $this->displayWorkspaceOverview_setInPageArray( $pArray, $table, $rec ); } } // Make header of overview: $tableRows = array(); if (count($pArray)) { $tableRows[] = ' <tr class="bgColor5 tableheader"> '.($this->diffOnly?'':'<td nowrap="nowrap" colspan="2">Live Version:</td>').' <td nowrap="nowrap" colspan="2">Draft Versions:</td> <td nowrap="nowrap"'.($this->diffOnly?' colspan="2"':' colspan="4"').'>Controls:</td> </tr>'; // Add lines from overview: $tableRows = array_merge($tableRows, $this->displayWorkspaceOverview_list($pArray)); $table = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding workspace-overview">'.implode('',$tableRows).'</table>'; } else $table = ''; $linkBack = t3lib_div::_GP('returnUrl') ? '<a href="'.htmlspecialchars(t3lib_div::_GP('returnUrl')).'" class="typo3-goBack"><img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/goback.gif','width="14" height="14"').' alt="" />Click here to go back</a><br/><br/>' : ''; $resetDiffOnly = $this->diffOnly ? '<a href="index.php?id='.intval($this->id).'" class="typo3-goBack">Show all information</a><br/><br/>' : ''; $versionSelector = $GLOBALS['BE_USER']->workspace ? $this->doc->getVersionSelector($this->id) : ''; return $versionSelector.$linkBack.$resetDiffOnly.$table.$this->markupNewOriginals(); } /** * Rendering the content for the publish / review overview: * (Made for internal recursive calling) * * @param array Storage of the elements to display (see displayWorkspaceOverview() / displayWorkspaceOverview_setInPageArray()) * @return array Table rows, see displayWorkspaceOverview() */ function displayWorkspaceOverview_list($pArray) { global $TCA; // If there ARE elements on this level, print them: $warnAboutVersions_nonPages = FALSE; $warnAboutVersions_page = FALSE; if (is_array($pArray)) { foreach($pArray as $table => $oidArray) { foreach($oidArray as $oid => $recs) { // Get CURRENT online record and icon based on "t3ver_oid": $rec_on = t3lib_BEfunc::getRecord($table,$oid); $icon = t3lib_iconWorks::getIconImage($table, $rec_on, $this->doc->backPath,' align="top" title="'.t3lib_BEfunc::getRecordIconAltText($rec_on,$table).'"'); if ($GLOBALS['BE_USER']->workspace===0) { // Only edit online records if in ONLINE workspace: $icon = $this->doc->wrapClickMenuOnIcon($icon, $table, $rec_on['uid'], 1, '', '+edit,view,info,delete'); } // Online version display: // Create the main cells which will span over the number of versions there is. $verLinkUrl = $TCA[$table]['ctrl']['versioningWS']; $origElement = $icon. ($verLinkUrl ? '<a href="'.htmlspecialchars('index.php?table='.$table.'&uid='.$rec_on['uid']).'">' : ''). t3lib_BEfunc::getRecordTitle($table,$rec_on,TRUE). ($verLinkUrl ? '</a>' : ''); $mainCell_rowSpan = count($recs)>1 ? ' rowspan="'.count($recs).'"' : ''; $mainCell = ' <td align="center"'.$mainCell_rowSpan.'>'.$this->formatVerId($rec_on['t3ver_id']).'</td> <td nowrap="nowrap"'.$mainCell_rowSpan.'>'. $origElement. '###SUB_ELEMENTS###'. // For substitution with sub-elements, if any. '</td>'; // Offline versions display: // Traverse the versions of the element foreach($recs as $rec) { // Get the offline version record and icon: $rec_off = t3lib_BEfunc::getRecord($table,$rec['uid']); // Prepare swap-mode values: if ($table==='pages' && $rec_off['t3ver_swapmode']!=-1) { if ($rec_off['t3ver_swapmode']>0) { $vType = 'branch'; } else { $vType = 'page'; } } else { $vType = 'element'; } // Get icon $icon = t3lib_iconWorks::getIconImage($table, $rec_off, $this->doc->backPath, ' align="top" title="'.t3lib_BEfunc::getRecordIconAltText($rec_off,$table).'"'); $tempUid = ($table != 'pages' || $vType==='branch' || $GLOBALS['BE_USER']->workspace===0 ? $rec_off['uid'] : $rec_on['uid']); $icon = $this->doc->wrapClickMenuOnIcon($icon, $table, $tempUid, 1, '', '+edit,' . ($table == 'pages' ? 'view,info,' : '') . 'delete'); // Prepare diff-code: if ($this->MOD_SETTINGS['diff'] || $this->diffOnly) { $diffCode = ''; list($diffHTML,$diffPct) = $this->createDiffView($table, $rec_off, $rec_on); if ($rec_on['t3ver_state']==1) { // New record: $diffCode.= $this->doc->icons(1).'New element<br/>'; // TODO Localize? $diffCode.= $diffHTML; } elseif ($rec_off['t3ver_state']==2) { $diffCode.= $this->doc->icons(2).'Deleted element<br/>'; } else { $diffCode.= ($diffPct<0 ? 'N/A' : ($diffPct ? $diffPct.'% change:' : '')); $diffCode.= $diffHTML; } } else $diffCode = ''; switch($vType) { case 'element': $swapLabel = ' [Element]'; $swapClass = 'ver-element'; $warnAboutVersions_nonPages = $warnAboutVersions_page; // Setting this if sub elements are found with a page+content (must be rendered prior to this of course!) break; case 'page': $swapLabel = ' [Page]'; $swapClass = 'ver-page'; $warnAboutVersions_page = !$this->showWorkspaceCol; // This value is true only if multiple workspaces are shown and we need the opposite here. break; case 'branch': $swapLabel = ' [Branch]'; $swapClass = 'ver-branch'; break; } // Modify main cell based on first version shown: $subElements = array(); if ($table==='pages' && $rec_off['t3ver_swapmode']!=-1 && $mainCell) { // For "Page" and "Branch" swap modes where $mainCell is still carrying content (only first version) $subElements['on'] = $this->subElements($rec_on['uid'], $rec_off['t3ver_swapmode']); $subElements['off'] = $this->subElements($rec_off['uid'],$rec_off['t3ver_swapmode'],$rec_on['uid']); } $mainCell = str_replace('###SUB_ELEMENTS###', $subElements['on'], $mainCell); // Create version element: $versionsInOtherWS = $this->versionsInOtherWS($table, $rec_on['uid']); $versionsInOtherWSWarning = $versionsInOtherWS && $GLOBALS['BE_USER']->workspace!==0 ? '<br/>'.$this->doc->icons(2).'Other version(s) in workspace '.$versionsInOtherWS : ''; $multipleWarning = (!$mainCell && $GLOBALS['BE_USER']->workspace!==0? '<br/>'.$this->doc->icons(3).'<b>Multiple versions in same workspace!</b>' : ''); $verWarning = $warnAboutVersions || ($warnAboutVersions_nonPages && $GLOBALS['TCA'][$table]['ctrl']['versioning_followPages'])? '<br/>'.$this->doc->icons(3).'<b>Version inside version!</b>' : ''; $verElement = $icon. (!$this->details ? '<a href="'.htmlspecialchars($this->doc->backPath.t3lib_extMgm::extRelPath('version').'cm1/index.php?id='.($table==='pages'?$rec_on['uid']:$rec_on['pid']).'&details='.rawurlencode($table.':'.$rec_off['uid']).'&returnUrl='.rawurlencode($this->REQUEST_URI)).'">' : ''). t3lib_BEfunc::getRecordTitle($table,$rec_off,TRUE). (!$this->details ? '</a>' : ''). $versionsInOtherWSWarning. $multipleWarning. $verWarning; $ctrlTable = ' <td nowrap="nowrap">'.$this->showStageChangeLog($table,$rec_off['uid'],$this->displayWorkspaceOverview_stageCmd($table,$rec_off)).'</td> <td nowrap="nowrap" class="'.$swapClass.'">'. $this->displayWorkspaceOverview_commandLinks($table,$rec_on,$rec_off,$vType). htmlspecialchars($swapLabel). ' </td> '.(!$this->diffOnly?'<td nowrap="nowrap"><b>Lifecycle:</b> '.htmlspecialchars($this->formatCount($rec_off['t3ver_count'])).'</td>'. // Lifecycle ($this->showWorkspaceCol ? ' <td nowrap="nowrap"> <b>Workspace:</b> '.htmlspecialchars($this->formatWorkspace($rec_off['t3ver_wsid'])).'</td>' : ''):''); if ($diffCode) { $verElement = $verElement.' <br/><b>Difference to live element:</b> <table border="0" cellpadding="0" cellspacing="0" class="ver-verElement"> <tr> <td class="c-diffCell">'.$diffCode.'</td> </tr> </table>'; } // Create version cell: $verCell = ' <td align="center">'.$this->formatVerId($rec_off['t3ver_id']).'</td> <td nowrap="nowrap">'. $verElement. $subElements['off']. '</td> '; // Compile table row: $tableRows[] = ' <tr class="bgColor4"> '. ($this->diffOnly?'':$mainCell). $verCell. $ctrlTable. ' </tr>'; // Reset the main cell: $mainCell = ''; } } } } return $tableRows; } /** * Building up of the $pArray * (Internal) * * @param array Array that is built up with the page tree structure * @param string Table name * @param array Table row * @return void $pArray is passed by reference and modified internally */ function displayWorkspaceOverview_setInPageArray(&$pArray,$table,$row) { if (!$this->details || $this->details==$table.':'.$row['uid']) { $pArray[$table][$row['t3ver_oid']][] = $row; } } /** * Links to stage change of a version * * @param string Table name * @param array Offline record (version) * @return string HTML content, mainly link tags and images. */ function displayWorkspaceOverview_allStageCmd() { $table = t3lib_div::_GP('table'); if ($table && $table!='pages') { $uid = t3lib_div::_GP('uid'); if ($rec_off = t3lib_BEfunc::getRecordWSOL($table,$uid)) { $uid = $rec_off['_ORIG_uid']; } } else $table = ''; if ($table) { if ($uid && $this->recIndex[$table][$uid]) { $sId = $this->recIndex[$table][$uid]; switch($sId) { case 1: $label = 'Comment for Reviewer:'; break; case 10: $label = 'Comment for Publisher:'; break; } } else $sId = 0; } else { if (count($this->stageIndex[1])) { // Review: $sId = 1; $color = '#666666'; $label = 'Sending %s item(s) to review. Comment for Reviewer:'; $titleAttrib = 'Send all to Review'; } elseif(count($this->stageIndex[10])) { // Publish: $sId = 10; $color = '#6666cc'; $label = 'Approving %s item(s) to publishing. Comment for Publisher:'; $titleAttrib = 'Approve all for Publishing'; } else { $sId = 0; } } if ($sId>0) { $issueCmd = ''; $itemCount = 0; if ($table && $uid && $this->recIndex[$table][$uid]) { $issueCmd.='&cmd['.$table.']['.$uid.'][version][action]=setStage'; $issueCmd.='&cmd['.$table.']['.$uid.'][version][stageId]='.$this->recIndex[$table][$uid]; } else { foreach($this->stageIndex[$sId] as $table => $uidArray) { $issueCmd.='&cmd['.$table.']['.implode(',',$uidArray).'][version][action]=setStage'; $issueCmd.='&cmd['.$table.']['.implode(',',$uidArray).'][version][stageId]='.$sId; $itemCount+=count($uidArray); } } $onClick = 'var commentTxt=window.prompt("'.sprintf($label,$itemCount).'",""); if (commentTxt!=null) {window.location.href="'.$this->doc->issueCommand($issueCmd,$this->REQUEST_URI).'&generalComment="+escape(commentTxt);}'; if (t3lib_div::_GP('sendToReview')) { $onClick.= ' else {window.location.href = "'.$this->REQUEST_URI.'"}'; $actionLinks.= $this->doc->wrapScriptTags($onClick); } else { $onClick.= ' return false;'; $actionLinks.= '<input type="submit" name="_" value="'.htmlspecialchars($titleAttrib).'" onclick="'.htmlspecialchars($onClick).'" />'; } } elseif (t3lib_div::_GP('sendToReview')) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -