workspace == 0) {
// Get Current page record:
$curPage = t3lib_BEfunc::getRecord('pages', $id);
// If the selected page is not online, find the right ID
$onlineId = ($curPage['pid']==-1 ? $curPage['t3ver_oid'] : $id);
// Select all versions of online version:
$versions = t3lib_BEfunc::selectVersionsOfRecord('pages', $onlineId, 'uid,pid,t3ver_label,t3ver_oid,t3ver_wsid,t3ver_id');
// If more than one was found...:
if (count($versions) > 1) {
$selectorLabel = '' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:versionSelect.label', TRUE) . ' ';
// Create selector box entries:
$opt = array();
foreach ($versions as $vRow) {
if ($vRow['uid'] == $onlineId) {
// Live version
$label = '[' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:versionSelect.live', TRUE) . ']';
} else {
$label = $vRow['t3ver_label'] . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:versionId', TRUE) . ' ' . $vRow['t3ver_id'] .
($vRow['t3ver_wsid'] != 0 ? ' ' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:workspaceId', TRUE) . ' ' . $vRow['t3ver_wsid'] : '') . ')';
}
$opt[] = '' .
htmlspecialchars($label) . ' ';
}
// Add management link:
$management = ' ';
// Create onchange handler:
$onChange = "window.location.href=this.options[this.selectedIndex].value;";
// Controls:
if ($id == $onlineId) {
$controls .= ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.online', TRUE) .
' ';
} elseif (!$noAction) {
$controls .= '' . t3lib_iconWorks::getSpriteIcon('actions-version-swap-version', array(
'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.swapPage', TRUE),
'style' => 'margin-left:5px;vertical-align:bottom;'
)) . '' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.swap', TRUE) . ' ';
}
// Write out HTML code:
return '
' . $selectorLabel . '
' . implode('', $opt) . '
' . $controls . '
' . $management . '
';
}
} elseif ($GLOBALS['BE_USER']->workspace !== 0) {
// Write out HTML code:
switch ($GLOBALS['BE_USER']->workspace) {
case 0:
$wsTitle = $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:live', TRUE);
break;
case -1:
$wsTitle = $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:draft', TRUE);
break;
default:
$wsTitle = $GLOBALS['BE_USER']->workspaceRec['title'];
break;
}
if (t3lib_BEfunc::isPidInVersionizedBranch($id) == 'branchpoint') {
return '
' . $selectorLabel . '
Workspace: "' . htmlspecialchars($wsTitle) . '"
' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:versionSelect.inBranch', TRUE) . '
';
} else {
// Get Current page record:
$curPage = t3lib_BEfunc::getRecord('pages', $id);
// If the selected page is not online, find the right ID
$onlineId = ($curPage['pid']==-1 ? $curPage['t3ver_oid'] : $id);
// The version of page:
$verPage = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, 'pages', $onlineId);
if (!$verPage) {
if (!count(t3lib_BEfunc::countVersionsOfRecordsOnPage($GLOBALS['BE_USER']->workspace, $onlineId))) {
if ($GLOBALS['BE_USER']->workspaceVersioningTypeAccess(0)) {
$onClick = $GLOBALS['TBE_TEMPLATE']->issueCommand('&cmd[pages][' . $onlineId . '][version][action]=new&cmd[pages][' . $onlineId . '][version][treeLevels]=0',
t3lib_div::linkThisScript(array(
'id' => $onlineId
)));
$onClick = 'window.location.href=\'' . $onClick . '\'; return false;';
// Write out HTML code:
return '
';
}
}
} elseif ($verPage['t3ver_swapmode']==0) {
$onClick = $GLOBALS['TBE_TEMPLATE']->issueCommand('&cmd[pages][' . $onlineId . '][version][action]=swap&cmd[pages][' .
$onlineId . '][version][swapWith]=' . $verPage['uid'],
t3lib_div::linkThisScript(array(
'id' => $onlineId
)));
$onClick = 'window.location.href=\'' . $onClick . '\'; return false;';
// Write out HTML code:
return '
';
}
}
}
}
}
if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/version/class.tx_version_gui.php'])) {
include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/version/class.tx_version_gui.php']);
}
?>