📄 index.php
字号:
if ($diff_1 && $diff_2) { $diff_1_record = t3lib_BEfunc::getRecord($this->table, $diff_1); $diff_2_record = t3lib_BEfunc::getRecord($this->table, $diff_2); if (is_array($diff_1_record) && is_array($diff_2_record)) { t3lib_div::loadTCA($this->table); $t3lib_diff_Obj = t3lib_div::makeInstance('t3lib_diff'); $tRows=array(); $tRows[] = ' <tr class="bgColor5 tableheader"> <td>Fieldname:</td> <td width="98%">Colored diff-view:</td> </tr> '; foreach($diff_1_record as $fN => $fV) { if ($TCA[$this->table]['columns'][$fN] && $TCA[$this->table]['columns'][$fN]['config']['type']!='passthrough' && !t3lib_div::inList('t3ver_label',$fN)) { if (strcmp($diff_1_record[$fN],$diff_2_record[$fN])) { $diffres = $t3lib_diff_Obj->makeDiffDisplay( t3lib_BEfunc::getProcessedValue($this->table,$fN,$diff_2_record[$fN],0,1), t3lib_BEfunc::getProcessedValue($this->table,$fN,$diff_1_record[$fN],0,1) ); $tRows[] = ' <tr class="bgColor4"> <td>'.$fN.'</td> <td width="98%">'.$diffres.'</td> </tr> '; } } } if (count($tRows)>1) { $content.='<table border="0" cellpadding="1" cellspacing="1" width="100%">'.implode('',$tRows).'</table><br/><br/>'; } else { $content.='Records matches completely on all editable fields!'; } } else $content.='ERROR: Records could strangely not be found!'; } else { $content.='ERROR: You didn\'t select two sources for diffing!'; } } // Element: $record = t3lib_BEfunc::getRecord($this->table,$this->uid); $recordIcon = t3lib_iconWorks::getIconImage($this->table,$record,$this->doc->backPath,'class="absmiddle"'); $recTitle = t3lib_BEfunc::getRecordTitle($this->table,$record,TRUE); // Display versions: $content.=' '.$recordIcon.$recTitle.' <form name="theform" action="'.str_replace('&sendToReview=1','',$this->REQUEST_URI).'" method="post"> <table border="0" cellspacing="1" cellpadding="1">'; $content.=' <tr class="bgColor5 tableheader"> <td> </td> <td> </td> <td>Title</td> <td>UID</td> <td title="t3ver_oid - Reference to live version UID">oid</td> <td title="t3ver_id - Version number, incremental integer">id</td> <td title="t3ver_wsid - Workspace ID. There can be only one version of an element per ID (except ID zero).">wsid</td> <td title="t3ver_state - Special states of a version: 1=Placeholder for "New". 2=Marked deleted.">state</td> <td title="t3ver_stage - Publishing stage: Editing (0), review (1), publish (10), rejected (-1).">stage</td> <td title="t3ver_count - Life cycle counter. Incremented each time element is unpublished.">count</td> <td>pid</td> <td>t3ver_label</td> <td colspan="2"><input type="submit" name="do_diff" value="Diff" /></td> </tr>'; $versions = t3lib_BEfunc::selectVersionsOfRecord($this->table, $this->uid, '*', $GLOBALS['BE_USER']->workspace); foreach($versions as $row) { $adminLinks = $this->adminLinks($this->table,$row); $content.=' <tr class="'.($row['uid']!=$this->uid ? 'bgColor4' : 'bgColor2 tableheader').'"> <td>'.($row['uid']!=$this->uid ? '<a href="'.$this->doc->issueCommand('&cmd['.$this->table.']['.$this->uid.'][version][swapWith]='.$row['uid'].'&cmd['.$this->table.']['.$this->uid.'][version][action]=swap').'">'. '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/insert1.gif','width="14" height="14"').' alt="" title="SWAP with current" />'. '</a>' /* ( $this->table == 'pages' ? '<a href="'.$this->doc->issueCommand('&cmd['.$this->table.']['.$this->uid.'][version][action]=swap&cmd['.$this->table.']['.$this->uid.'][version][swapWith]='.$row['uid'].'&cmd['.$this->table.']['.$this->uid.'][version][swapContent]=1').'">'. '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/insert2.gif','width="14" height="14"').' alt="" title="Publish page AND content!" />'. '</a>'. '<a href="'.$this->doc->issueCommand('&cmd['.$this->table.']['.$this->uid.'][version][action]=swap&cmd['.$this->table.']['.$this->uid.'][version][swapWith]='.$row['uid'].'&cmd['.$this->table.']['.$this->uid.'][version][swapContent]=ALL').'">'. '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/insert4.gif','width="14" height="14"').' alt="" title="Publish page AND content! - AND ALL SUBPAGES!" />'. '</a>' : '') */ : '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/blinkarrow_left.gif','width="5" height="9"').' alt="" title="CURRENT ONLINE VERSION!"/>').'</td> <td nowrap="nowrap">'.$adminLinks.'</td> <td nowrap="nowrap">'.t3lib_BEfunc::getRecordTitle($this->table,$row,TRUE).'</td> <td>'.$row['uid'].'</td> <td>'.$row['t3ver_oid'].'</td> <td>'.$row['t3ver_id'].'</td> <td>'.$row['t3ver_wsid'].'</td> <td>'.$row['t3ver_state'].'</td> <td>'.$row['t3ver_stage'].'</td> <td>'.$row['t3ver_count'].'</td> <td>'.$row['pid'].'</td> <td nowrap="nowrap"><a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit['.$this->table.']['.$row['uid'].']=edit&columnsOnly=t3ver_label',$this->doc->backPath)).'"><img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/edit2.gif','width="11" height="12"').' alt="" title="Edit"/></a>'.htmlspecialchars($row['t3ver_label']).'</td> <td class="version-diff-1"><input type="radio" name="diff_1" value="'.$row['uid'].'"'.($diff_1==$row['uid'] ? ' checked="checked"':'').'/></td> <td class="version-diff-2"><input type="radio" name="diff_2" value="'.$row['uid'].'"'.($diff_2==$row['uid'] ? ' checked="checked"':'').'/></td> </tr>'; // Show sub-content if the table is pages AND it is not the online branch (because that will mostly render the WHOLE tree below - not smart;) if ($this->table == 'pages' && $row['uid']!=$this->uid) { $sub = $this->pageSubContent($row['uid']); if ($sub) { $content.=' <tr> <td></td> <td></td> <td colspan="10">'.$sub.'</td> <td colspan="2"></td> </tr>'; } } } $content.='</table></form>'; $this->content.=$this->doc->section('',$content,0,1); // Create new: $content=' <form action="'.$this->doc->backPath.'tce_db.php" method="post"> Label: <input type="text" name="cmd['.$this->table.']['.$this->uid.'][version][label]" /><br/> '.($this->table == 'pages' ? '<select name="cmd['.$this->table.']['.$this->uid.'][version][treeLevels]"> '.($GLOBALS['BE_USER']->workspaceVersioningTypeAccess(0) ? '<option value="0">Page: Page + content</option>' : '').' '.($GLOBALS['BE_USER']->workspaceVersioningTypeAccess(1) ? '<option value="100">Branch: All subpages</option>' : '').' '.($GLOBALS['BE_USER']->workspaceVersioningTypeAccess(-1) ? '<option value="-1">Element: Just record</option>' : '').' </select>' : '').' <br/><input type="hidden" name="cmd['.$this->table.']['.$this->uid.'][version][action]" value="new" /> <input type="hidden" name="prErr" value="1" /> <input type="hidden" name="redirect" value="'.htmlspecialchars($this->REQUEST_URI).'" /> <input type="submit" name="_" value="Create new version" /> </form> '; $this->content.=$this->doc->spacer(15); $this->content.=$this->doc->section('Create new version',$content,0,1); } /** * Recursively look for children for page version with $pid * * @param integer UID of page record for which to look up sub-elements following that version * @param integer Counter, do not set (limits to 100 levels) * @return string Table with content if any */ function pageSubContent($pid,$c=0) { global $TCA; $tableNames = t3lib_div::removeArrayEntryByValue(array_keys($TCA),'pages'); $tableNames[] = 'pages'; foreach($tableNames as $tN) { // Basically list ALL tables - not only those being copied might be found! #if ($TCA[$tN]['ctrl']['versioning_followPages'] || $tN=='pages') { $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $tN, 'pid='.intval($pid).t3lib_BEfunc::deleteClause($tN), '', ($TCA[$tN]['ctrl']['sortby'] ? $TCA[$tN]['ctrl']['sortby'] : '')); if ($GLOBALS['TYPO3_DB']->sql_num_rows($mres)) { $content.=' <tr> <td colspan="4" class="'.($TCA[$tN]['ctrl']['versioning_followPages'] ? 'bgColor6' : ($tN=='pages' ? 'bgColor5' : 'bgColor-10')).'"'.(!$TCA[$tN]['ctrl']['versioning_followPages'] && $tN!='pages' ? ' style="color: #666666; font-style:italic;"':'').'>'.$tN.'</td> </tr>'; while ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres)) { $ownVer = $this->lookForOwnVersions($tN,$subrow['uid']); $content.=' <tr> <td>'.$this->adminLinks($tN,$subrow).'</td> <td>'.$subrow['uid'].'</td> '.($ownVer>1 ? '<td style="font-weight: bold; background-color: yellow;"><a href="index.php?table='.rawurlencode($tN).'&uid='.$subrow['uid'].'">'.($ownVer-1).'</a></td>' : '<td></td>').' <td width="98%">'.t3lib_BEfunc::getRecordTitle($tN,$subrow,TRUE).'</td> </tr>'; if ($tN == 'pages' && $c<100) { $sub = $this->pageSubContent($subrow['uid'],$c+1); if ($sub) { $content.=' <tr> <td></td> <td></td> <td></td> <td width="98%">'.$sub.'</td> </tr>'; } } } } #} } return $content ? '<table border="1" cellpadding="1" cellspacing="0" width="100%">'.$content.'</table>' : ''; } /** * Look for number of versions of a record * * @param string Table name * @param integer Record uid * @return integer Number of versions for record, false if none. */ function lookForOwnVersions($table,$uid) { global $TCA; $versions = t3lib_BEfunc::selectVersionsOfRecord($table, $uid, 'uid'); if (is_array($versions)) { return count($versions); } return FALSE; } /** * Administrative links for a table / record * * @param string Table name * @param array Record for which administrative links are generated. * @return string HTML link tags. */ function adminLinks($table,$row) { global $BE_USER; // Edit link: $adminLink = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit['.$table.']['.$row['uid'].']=edit',$this->doc->backPath)).'">'. '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/edit2.gif','width="11" height="12"').' alt="" title="Edit"/>'. '</a>'; // Delete link: $adminLink.= '<a href="'.htmlspecialchars($this->doc->issueCommand('&cmd['.$table.']['.$row['uid'].'][delete]=1')).'">'. '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/garbage.gif','width="11" height="12"').' alt="" title="Delete"/>'. '</a>'; if ($table == 'pages') { // If another page module was specified, replace the default Page module with the new one $newPageModule = trim($BE_USER->getTSConfigVal('options.overridePageModule')); $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout'; // Perform some acccess checks: $a_wl = $BE_USER->check('modules','web_list'); $a_wp = t3lib_extMgm::isLoaded('cms') && $BE_USER->check('modules',$pageModule); $adminLink.='<a href="#" onclick="top.loadEditId('.$row['uid'].');top.goToModule(\''.$pageModule.'\'); return false;">'. '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,t3lib_extMgm::extRelPath('cms').'layout/layout.gif','width="14" height="12"').' title="" alt="" />'. '</a>'; $adminLink.='<a href="#" onclick="top.loadEditId('.$row['uid'].');top.goToModule(\'web_list\'); return false;">'. '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'mod/web/list/list.gif','width="14" height="12"').' title="" alt="" />'. '</a>'; // "View page" icon is added: $adminLink.='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($row['uid'],$this->doc->backPath,t3lib_BEfunc::BEgetRootLine($row['uid']))).'">'. '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/zoom.gif','width="12" height="12"').' title="" alt="" />'. '</a>'; } else { if ($row['pid']==-1) { $getVars = '&ADMCMD_vPrev['.rawurlencode($table.':'.$row['t3ver_oid']).']='.$row['uid']; // "View page" icon is added: $adminLink.='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($row['_REAL_PID'],$this->doc->backPath,t3lib_BEfunc::BEgetRootLine($row['_REAL_PID']),'','',$getVars)).'">'. '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/zoom.gif','width="12" height="12"').' title="" alt="" />'. '</a>'; } } return $adminLink; } /****************************** * * Workspace management * ******************************/ /** * Management of workspace for page ID * Called when $this->id is set. * * @return void */ function workspaceMgm() { $menu = ''; if ($GLOBALS['BE_USER']->workspace===0) { $menu.= t3lib_BEfunc::getFuncMenu($this->id,'SET[filter]',$this->MOD_SETTINGS['filter'],$this->MOD_MENU['filter']); $menu.= t3lib_BEfunc::getFuncMenu($this->id,'SET[display]',$this->MOD_SETTINGS['display'],$this->MOD_MENU['display']); } if (!$this->details && $GLOBALS['BE_USER']->workspace && !$this->diffOnly) { $menu.= t3lib_BEfunc::getFuncCheck($this->id,'SET[diff]',$this->MOD_SETTINGS['diff'],'','','id="checkDiff"').' <label for="checkDiff">Show difference view</label>'; } if ($menu) { $this->content.=$this->doc->section('',$menu,0,1); } // 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="Publish page" onclick="return confirm(\'Are you sure you want to publish all content '.($GLOBALS['BE_USER']->workspaceRec['publish_access']&1 ? 'in "Publish" stage ':'').'from this page?\');"/>'; if ($GLOBALS['BE_USER']->workspaceSwapAccess()) { $actionLinks.= '<input type="submit" name="_swap" value="Swap page" onclick="return confirm(\'Are you sure you want to publish (swap) all content '.($GLOBALS['BE_USER']->workspaceRec['publish_access']&1 ? 'in "Publish" stage ':'').'from this page?\');" />'; } } else { $actionLinks.= $this->doc->icons(1).'You are not permitted to publish from this workspace'; } } $actionLinks.= '<input type="submit" name="_" value="Refresh" />'; $actionLinks.= '<input type="submit" name="_previewLink" value="Preview Link" />'; $actionLinks.= $this->displayWorkspaceOverview_allStageCmd(); if ($actionLinks || count($errors)) { $this->content.= $this->doc->section('',$actionLinks.(count($errors) ? '<h3>Errors:</h3><br/>'.implode('<br/>',$errors).'<hr/>' : ''),0,1); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -