index.php

来自「Typo3, 开源里边最强大的」· PHP 代码 · 共 1,589 行 · 第 1/5 页

PHP
1,589
字号
										if ($rec_on['t3ver_state']==1)	{	// New record:											$diffCode.= $this->doc->icons(1).$LANG->getLL('label_newrecord').'<br/>';											$diffCode.= $diffHTML;										} elseif ($rec_off['t3ver_state']==2)	{											$diffCode.= $this->doc->icons(2).'Deleted element<br/>';											$diffCode.= $this->doc->icons(2).$LANG->getLL('label_deletedrecord').'<br/>';										} else {											$diffCode.= ($diffPct<0 ? 'N/A' : ($diffPct ? $diffPct.'% change:' : ''));											$diffCode.= ($diffPct<0 ? $LANG->getLL('label_notapplicable') : ($diffPct ? sprintf($LANG->getLL('label_percentchange'), $diffPct) : ''));											$diffCode.= $diffHTML;										}									} else $diffCode = '';									switch($vType) {										case 'element':											$swapLabel = ' ['.$LANG->getLL('label_element').']';											$swapClass = 'ver-element';	// Do not translate!											$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 = ' ['.$LANG->getLL('label_page').']';											$swapClass = 'ver-page';	// Do not translate!											$warnAboutVersions_page = !$this->showWorkspaceCol;		// This value is true only if multiple workspaces are shown and we need the opposite here.										break;										case 'branch':											$swapLabel = ' ['.$LANG->getLL('label_branch').']';												$swapClass = 'ver-branch';	// Do not translate!											$warnAboutVersions_next = !$this->showWorkspaceCol;		// This value is true only if multiple workspaces are shown and we need the opposite here.										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).$LANG->getLL('label_otherversions').' '.$versionsInOtherWS : '';									$multipleWarning = (!$mainCell && $GLOBALS['BE_USER']->workspace!==0? '<br/>'.$this->doc->icons(3).'<b>'.$LANG->getLL('label_multipleversions').'</b>' : '');									$verWarning = $warnAboutVersions || ($warnAboutVersions_nonPages && $GLOBALS['TCA'][$table]['ctrl']['versioning_followPages'])? '<br/>'.$this->doc->icons(3).'<b>'.$LANG->getLL('label_nestedversions').'</b>' : '';									$verElement = $icon.										'<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(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.										t3lib_BEfunc::getRecordTitle($table,$rec_off,TRUE).										'</a>'.										$versionsInOtherWSWarning.										$multipleWarning.										$verWarning;									if ($diffCode)	{										$verElement = '										<table border="0" cellpadding="0" cellspacing="0" class="ver-verElement">											<tr>												<td nowrap="nowrap" width="180">'.$verElement.'&nbsp;&nbsp;</td>												<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">											'.$mainCell.$verCell.'											<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>											<td nowrap="nowrap">'.htmlspecialchars($this->formatCount($rec_off['t3ver_count'])).'</td>'.		// Lifecycle												($this->showWorkspaceCol ? '											<td nowrap="nowrap">'.htmlspecialchars($this->formatWorkspace($rec_off['t3ver_wsid'])).'</td>' : '').'										</tr>';										// Reset the main cell:									$mainCell = '';								}							}						}					}						// Call recursively for sub-rows:					$tableRows = $this->displayWorkspaceOverview_list($pArray[$k.'.'], $tableRows, $c+1, $warnAboutVersions_next);				}			}		}		return $tableRows;	}	/**	 * Create indentation, icon and title for the page tree identification for the list.	 *	 * @param	integer		Page UID (record will be looked up again)	 * @param	string		Page title	 * @param	integer		Depth counter from displayWorkspaceOverview_list() used to indent the icon and title	 * @return	string		HTML content	 */	function displayWorkspaceOverview_pageTreeIconTitle($pageUid, $title, $indentCount)	{		$pRec = t3lib_BEfunc::getRecord('pages',$pageUid);		return '<img src="clear.gif" width="1" height="1" hspace="'.($indentCount * $this->pageTreeIndent).'" align="top" alt="" />'.	// Indenting page tree					t3lib_iconWorks::getIconImage('pages',$pRec,$this->doc->backPath,' align="top" title="'.t3lib_BEfunc::getRecordIconAltText($pRec,'pages').'"').					htmlspecialchars(t3lib_div::fixed_lgd_cs($title,$this->pageTreeIndent_titleLgd)).					'&nbsp;&nbsp;';	}	/**	 * 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_stageCmd($table,&$rec_off)	{		global $LANG;		switch((int)$rec_off['t3ver_stage'])	{			case 0:				$sId = 1;				$sLabel = $LANG->getLL('stage_editing');				$color = '#666666';	// TODO Use CSS? 				$label = $LANG->getLL('label_commentforreviewer');				$titleAttrib = $LANG->getLL('label_sendtoreview');			break;			case 1:				$sId = 10;				$sLabel = $LANG->getLL('label_review');				$color = '#6666cc';	// TODO Use CSS?				$label = $LANG->getLL('label_commentforpublisher');				$titleAttrib = $LANG->getLL('label_approveforpublishing');			break;			case 10:				$sLabel = $LANG->getLL('label_publish');				$color = '#66cc66';	// TODO Use CSS?			break;			case -1:				$sLabel = $this->doc->icons(2).$LANG->getLL('label_rejected');				$sId = 0;				$color = '#ff0000';	// TODO Use CSS?				$label = $LANG->getLL('stage_label_user_comment');				$titleAttrib = $LANG->getLL('label_resetstage');			break;			default:				$sLabel = $LANG->getLL('label_undefined');				$sId = 0;				$color = '';			break;		}#debug($sId);		$raiseOk = !$GLOBALS['BE_USER']->workspaceCannotEditOfflineVersion($table,$rec_off);		if ($raiseOk && $rec_off['t3ver_stage']!=-1)	{			$onClick = 'var commentTxt=window.prompt("'.$LANG->getLL('explain_reject').'","");							if (commentTxt!=null) {window.location.href="'.$this->doc->issueCommand(							'&cmd['.$table.']['.$rec_off['uid'].'][version][action]=setStage'.							'&cmd['.$table.']['.$rec_off['uid'].'][version][stageId]=-1'							).'&cmd['.$table.']['.$rec_off['uid'].'][version][comment]="+escape(commentTxt);}'.							' return false;';				// Reject:			$actionLinks.=				'<a href="#" onclick="'.htmlspecialchars($onClick).'">'.				'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/down.gif','width="14" height="14"').' alt="" align="top" title="'.$LANG->getLL('label_reject').'" />'.				'</a>';		} else {				// Reject:			$actionLinks.=				'<img src="'.$this->doc->backPath.'gfx/clear.gif" width="14" height="14" alt="" align="top" title="" />';		}		// TODO Use CSS?		$actionLinks.= '<span style="background-color: '.$color.'; color: white;">'.$sLabel.'</span>';			// Raise		if ($raiseOk)	{			$onClick = 'var commentTxt=window.prompt("'.$label.'","");							if (commentTxt!=null) {window.location.href="'.$this->doc->issueCommand(							'&cmd['.$table.']['.$rec_off['uid'].'][version][action]=setStage'.							'&cmd['.$table.']['.$rec_off['uid'].'][version][stageId]='.$sId							).'&cmd['.$table.']['.$rec_off['uid'].'][version][comment]="+escape(commentTxt);}'.							' return false;';			if ($rec_off['t3ver_stage']!=10)	{				$actionLinks.=					'<a href="#" onclick="'.htmlspecialchars($onClick).'">'.					'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/up.gif','width="14" height="14"').' alt="" align="top" title="'.htmlspecialchars($titleAttrib).'" />'.					'</a>';				$this->stageIndex[$sId][$table][] = $rec_off['uid'];			}		}		return $actionLinks;	}	/**	 * Links to publishing etc of a version	 *	 * @param	string		Table name	 * @param	array		Online record	 * @param	array		Offline record (version)	 * @param	string		Swap type, "branch", "page" or "element"	 * @return	string		HTML content, mainly link tags and images.	 */	function displayWorkspaceOverview_commandLinks($table,&$rec_on,&$rec_off,$vType)	{		global	$LANG;		if ($this->publishAccess && (!($GLOBALS['BE_USER']->workspaceRec['publish_access']&1) || (int)$rec_off['t3ver_stage']===10))	{			$actionLinks =				'<a href="'.htmlspecialchars($this->doc->issueCommand(						'&cmd['.$table.']['.$rec_on['uid'].'][version][action]=swap'.						'&cmd['.$table.']['.$rec_on['uid'].'][version][swapWith]='.$rec_off['uid']						)).'">'.				'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/insert1.gif','width="14" height="14"').' alt="" align="top" title="' . $LANG->getLL('img_title_publish') . '" />'.				'</a>';			if ($GLOBALS['BE_USER']->workspaceSwapAccess() && (int)$rec_on['t3ver_state']!==1 && (int)$rec_off['t3ver_state']!==2)	{				$actionLinks.=					'<a href="'.htmlspecialchars($this->doc->issueCommand(							'&cmd['.$table.']['.$rec_on['uid'].'][version][action]=swap'.							'&cmd['.$table.']['.$rec_on['uid'].'][version][swapWith]='.$rec_off['uid'].							'&cmd['.$table.']['.$rec_on['uid'].'][version][swapIntoWS]=1'							)).'">'.					'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/swap.png','width="14" height="14"').' alt="" align="top" title="' . $LANG->getLL('img_title_swap') . '" />'.					'</a>';			}		}		if (!$GLOBALS['BE_USER']->workspaceCannotEditOfflineVersion($table,$rec_off))	{			if ($GLOBALS['BE_USER']->workspace!==0)	{					// Release				$confirm = $LANG->JScharCode($LANG->getLL('remove_from_ws_confirmation'));				$actionLinks.=					'<a href="'.htmlspecialchars($this->doc->issueCommand('&cmd['.$table.']['.$rec_off['uid'].'][version][action]=clearWSID')).'" onclick="return confirm(' . $confirm . ');">'.					'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/group_clear.gif','width="14" height="14"').' alt="" align="top" title="' . $LANG->getLL('img_title_remove_from_ws') . '" />'.					'</a>';			}				// Edit			if ($table==='pages' && $vType!=='element')	{				$tempUid = ($vType==='branch' || $GLOBALS['BE_USER']->workspace===0 ? $rec_off['uid'] : $rec_on['uid']);				$actionLinks.=					'<a href="#" onclick="top.loadEditId('.$tempUid.');top.goToModule(\''.$this->pageModule.'\'); return false;">'.					'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,t3lib_extMgm::extRelPath('cms').'layout/layout.gif','width="14" height="12"').' title="' . $LANG->getLL('img_title_edit_page') . '" alt="" />'.					'</a>';			} else {				$params = '&edit['.$table.']['.$rec_off['uid'].']=edit';				$actionLinks.=					'<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->doc->backPath)).'">'.					'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/edit2.gif','width="12" height="12"').' title="' . $LANG->getLL('img_title_edit_element') . '" alt="" />'.					'</a>';			}		}			// History/Log		$actionLinks.=			'<a href="'.htmlspecialchars($this->doc->backPath.'show_rechis.php?element='.rawurlencode($table.':'.$rec_off['uid']).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.			'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/history2.gif','width="13" height="12"').' title="' . $LANG->getLL('img_title_show_log') . '" alt="" />'.			'</a>';			// View		if ($table==='pages')	{			$tempUid = ($vType==='branch' || $GLOBALS['BE_USER']->workspace===0 ? $rec_off['uid'] : $rec_on['uid']);			$actionLinks.=				'<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($tempUid,$this->doc->backPath,t3lib_BEfunc::BEgetRootLine($tempUid))).'">'.				'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/zoom.gif','width="12" height="12"').' title="" alt="" />'.				'</a>';		}		return $actionLinks;	}	/**	 * Links to publishing etc of a version	 *	 * @param	string		Table name	 * @param	array		Record array	 * @param	integer		The uid of the online version of $uid. If zero it means we are drawing a row for the online version itself while a value means we are drawing display for an offline version.	 * @return	string		HTML content, mainly link tags and images.	 */	function displayWorkspaceOverview_commandLinksSub($table,$rec,$origId)	{		global $LANG;		$uid = $rec['uid'];		if ($origId || $GLOBALS['BE_USER']->workspace===0)	{			if (!$GLOBALS['BE_USER']->workspaceCannotEditRecord($table,$rec))	{					// Edit				if ($table==='pages')	{					$actionLinks.=						'<a href="#" onclick="top.loadEditId('.$uid.');top.goToModule(\''.$this->pageModule.'\'); return false;">'.						'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,t3lib_extMgm::extRelPath('cms').'layout/layout.gif','width="14" height="12"').' title="' . $LANG->getLL('img_title_edit_page') . '" alt="" />'.						'</a>';				} else {					$params = '&edit['.$table.']['.$uid.']=edit';					$actionLinks.=						'<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->doc->backPath)).'">'.						'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/edit2.gif','width="12" height="12"').' title="' . $LANG->getLL('img_title_edit_element') . '" alt="" />'.						'</a>';				}			}				// History/Log			$actionLinks.=				'<a href="'.htmlspecialchars($this->doc->backPath.'show_rechis.php?element='.rawurlencode($table.':'.$uid).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.				'<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/history2.gif','width="13" height="12"').' title="' . $LANG->getLL('img_title_show_log') . '" alt="" />'.				'</a>';		}			// View		if ($table==='pages')	{			$actionLinks.=

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?