index.php

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

PHP
1,589
字号
		global $SOBE;		$this->content.= $this->doc->endPage();		echo $this->content;	}	/*********************************	 *	 * Module content: Publish	 *	 *********************************/	/**	 * 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');			}		}		$wsAccess = $GLOBALS['BE_USER']->checkWorkspace($GLOBALS['BE_USER']->workspaceRec);			// Add header to content variable:		$content = '		<table border="0" cellpadding="1" cellspacing="1" class="lrPadding" style="border: 1px solid black;">			<tr>				<td class="bgColor2" nowrap="nowrap"><b>' . $LANG->getLL('label_workspace') . '</b>&nbsp;</td>				<td class="bgColor4" nowrap="nowrap">'.$title.'</td>			</tr>			<tr>				<td class="bgColor2" nowrap="nowrap"><b>' . $LANG->getLL('label_description') . '</b>&nbsp;</td>				<td class="bgColor4">'.$description.'</td>			</tr>'.($GLOBALS['BE_USER']->workspace!=-99 && !$details ? '			<tr>				<td class="bgColor2" nowrap="nowrap"><b>' . $LANG->getLL('label_options') . '</b>&nbsp;</td>				<td class="bgColor4">'.$menu.$actionLinks.'</td>			</tr>			<tr>				<td class="bgColor2" nowrap="nowrap"><b>' . $LANG->getLL('label_status') . '</b>&nbsp;</td>				<td class="bgColor4">'.$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;	}	/**	 * Display details for a single version from workspace	 *	 * @param	string		Version identification, made of table and uid	 * @return	string		HTML string	 */	function displayVersionDetails($details)	{		return 'TODO: Show details for version "'.$details.'"<hr/><a href="index.php">BACK</a>';	}	/**	 * Rendering the overview of versions in the current workspace	 *	 * @return	string		HTML (table)	 */	function displayWorkspaceOverview()	{		global	$LANG;			// 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);			// Need 'admin' field for t3lib_iconWorks::getIconImage()		$this->be_user_Array_full = $this->be_user_Array = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,admin,workspace_perms');		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->MOD_SETTINGS['display'];		// Set wsid to the value from the menu (displaying content of other workspaces)			$filter = $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);			// Traverse versions and build page-display array:		$pArray = array();		$wmArray = array();	// is page in web mount?		$rlArray = array();	// root line of page		$pagePermsClause = $GLOBALS['BE_USER']->getPagePermsClause(1);		foreach($versions as $table => $records)	{			if (is_array($records)) {				foreach($records as $rec)	{					$pageIdField = $table==='pages' ? 't3ver_oid' : 'realpid';					$pageId = $rec[$pageIdField];					if (!isset($wmArray[$pageId]))	{						$wmArray[$pageId] = $GLOBALS['BE_USER']->isInWebMount($pageId,$pagePermsClause);					}					if ($wmArray[$pageId])	{						if (!isset($rlArray[$pageId]))	{							$rlArray[$pageId] = t3lib_BEfunc::BEgetRootLine($pageId, 'AND 1=1');						}						$this->displayWorkspaceOverview_setInPageArray(							$pArray,							$rlArray[$pageId],							$table,							$rec						);					}				}			}		}			// Make header of overview:		$tableRows = array();		$tableRows[] = '			<tr class="bgColor5 tableheader">				<td nowrap="nowrap" width="100">' . $LANG->getLL('label_pagetree') . '</td>				<td nowrap="nowrap" colspan="2">' . $LANG->getLL('label_live_version') . '</td>				<td nowrap="nowrap" colspan="2">' . $LANG->getLL('label_draft_versions') . '</td>				<td nowrap="nowrap">' . $LANG->getLL('label_stage') . '</td>				<td nowrap="nowrap">' . $LANG->getLL('label_publish') . '</td>				<td>' . $LANG->getLL('label_lifecycle') . '</td>				'.($this->showWorkspaceCol ? '<td>' . $LANG->getLL('label_workspace') . '</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>';		return $table.$this->markupNewOriginals();	}	/**	 * Rendering the content for the publish / review overview:	 * (Made for internal recursive calling)	 *	 * @param	array		Hierarchical storage of the elements to display (see displayWorkspaceOverview() / displayWorkspaceOverview_setInPageArray())	 * @param	array		Existing array of table rows to add to	 * @param	array		Depth counter	 * @param	boolean		If set, a warning is shown if versions are found (internal flag)	 * @return	array		Table rows, see displayWorkspaceOverview()	 */	function displayWorkspaceOverview_list($pArray, $tableRows=array(), $c=0, $warnAboutVersions=FALSE)	{		global $TCA, $LANG;			// Initialize:		$fullColSpan = ($this->showWorkspaceCol?9:8);			// Traverse $pArray		if (is_array($pArray))	{			foreach($pArray as $k => $v)	{				if (t3lib_div::testInt($k))	{						// If there are elements on this level, output a divider row which just creates a little visual space.					if (is_array($pArray[$k.'_']))	{						$tableRows[] = '							<tr>								<td colspan="'.$fullColSpan.'"><img src="clear.gif" width="1" height="3" alt="" /></td>							</tr>';					}						// Printing a level from the page tree with no additional content:						// If there are NO elements on this level OR if there are NO pages on a level with elements, then show page tree icon and title (otherwise it is shown with the display of the elements)					if (!is_array($pArray[$k.'_']) || !is_array($pArray[$k.'_']['pages']))	{						$tableRows[] = '							<tr class="bgColor4-20">								<td nowrap="nowrap" colspan="'.$fullColSpan.'">'.									$this->displayWorkspaceOverview_pageTreeIconTitle($k,$pArray[$k],$c).									'</td>							</tr>';					}						// If there ARE elements on this level, print them:					$warnAboutVersions_next = $warnAboutVersions;					$warnAboutVersions_nonPages = FALSE;					$warnAboutVersions_page = FALSE;					if (is_array($pArray[$k.'_']))	{						foreach($pArray[$k.'_'] 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'], 2, '', '+edit,view,info,delete');								}									// MAIN CELL / Online version display:									// Create the main cells which will span over the number of versions there is. If the table is "pages" then it will show the page tree icon and title (which was not shown by the code above)								$verLinkUrl = t3lib_extMgm::isLoaded('version') && $TCA[$table]['ctrl']['versioningWS'];								$origElement = $icon.									($verLinkUrl ? '<a href="'.htmlspecialchars($this->doc->backPath.t3lib_extMgm::extRelPath('version').'cm1/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 = $table==='pages' ? '											<td class="bgColor4-20" nowrap="nowrap"'.$mainCell_rowSpan.'>'.											$this->displayWorkspaceOverview_pageTreeIconTitle($k,$pArray[$k],$c).											'</td>' : '											<td class="bgColor"'.$mainCell_rowSpan.'></td>';								$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:									$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';	// Do not translate!										} else {											$vType = 'page';	// Do not translate!										}									} else {										$vType = 'element';	// Do not translate!									}									// 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, 2, '', '+edit,' . ($table == 'pages' ? 'view,info,' : '') . 'delete');									// Prepare diff-code:									if ($this->MOD_SETTINGS['diff'])	{										$diffCode = '';										list($diffHTML,$diffPct) = $this->createDiffView($table, $rec_off, $rec_on);

⌨️ 快捷键说明

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