Bug #18152 ยป 20080207_RFC_7431.diff
typo3/sysext/version/cm1/index.php (working copy) | ||
---|---|---|
function main() {
|
||
global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
|
||
// Template markers
|
||
$markers = array(
|
||
'CSH' => '',
|
||
'FUNC_MENU' => '',
|
||
'WS_MENU' => '',
|
||
'CONTENT' => ''
|
||
);
|
||
|
||
// Setting module configuration:
|
||
$this->MCONF = $GLOBALS['MCONF'];
|
||
|
||
... | ... | |
$this->doc->backPath = $BACK_PATH;
|
||
$this->doc->setModuleTemplate('templates/version.html');
|
||
$this->doc->docType = 'xhtml_trans';
|
||
$this->doc->form='<form action="" method="post">';
|
||
// Add styles
|
||
$this->doc->inDocStylesArray[$GLOBALS['MCONF']['name']] = '
|
||
... | ... | |
if ($record['pid']==-1) {
|
||
$record = t3lib_BEfunc::getRecord($this->table,$record['t3ver_oid']);
|
||
}
|
||
|
||
$this->recordFound = is_array($record);
|
||
|
||
$pidValue = $this->table==='pages' ? $this->uid : $record['pid'];
|
||
// Checking access etc.
|
||
if (is_array($record) && $TCA[$this->table]['ctrl']['versioningWS']) {
|
||
if ($this->recordFound && $TCA[$this->table]['ctrl']['versioningWS']) {
|
||
$this->doc->form='<form action="" method="post">';
|
||
$this->uid = $record['uid']; // Might have changed if new live record was found!
|
||
// Access check!
|
||
... | ... | |
$this->content.=$this->doc->spacer(10);
|
||
|
||
// Setting up the buttons and markers for docheader
|
||
// Setting up the buttons and markers for docheader
|
||
$docHeaderButtons = $this->getButtons();
|
||
$markers = array(
|
||
'CSH' => $docHeaderButtons['csh'],
|
||
'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
|
||
'WS_MENU' => $this->workspaceMenu(),
|
||
'CONTENT' => $this->content
|
||
);
|
||
$markers['CSH'] = $docHeaderButtons['csh'];
|
||
$markers['FUNC_MENU'] = t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
|
||
$markers['WS_MENU'] = $this->workspaceMenu();
|
||
$markers['CONTENT'] = $this->content;
|
||
} else {
|
||
// If no access or id value, create empty document
|
||
$this->content = $this->doc->section($LANG->getLL('clickAPage_header'), $LANG->getLL('clickAPage_content'), 0, 1);
|
||
|
||
// Build the <body> for the module
|
||
$this->content = $this->doc->startPage($LANG->getLL('title'));
|
||
$this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
|
||
$this->content.= $this->doc->endPage();
|
||
$this->content = $this->doc->insertStylesAndJS($this->content);
|
||
} else {
|
||
// If no access or id value, create empty document:
|
||
$this->content.=$this->doc->startPage($LANG->getLL('title'));
|
||
$this->content.=$this->doc->section($LANG->getLL('clickAPage_header'),$LANG->getLL('clickAPage_content'),0,1);
|
||
$this->content.=$this->doc->endPage();
|
||
$this->content = $this->doc->insertStylesAndJS($this->content);
|
||
// Setting up the buttons and markers for docheader
|
||
$docHeaderButtons = $this->getButtons();
|
||
$markers['CONTENT'] = $this->content;
|
||
}
|
||
// Build the <body> for the module
|
||
$this->content = $this->doc->startPage($LANG->getLL('title'));
|
||
$this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
|
||
$this->content.= $this->doc->endPage();
|
||
$this->content = $this->doc->insertStylesAndJS($this->content);
|
||
}
|
||
/**
|
||
... | ... | |
// CSH
|
||
//$buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_txversionM1', '', $GLOBALS['BACK_PATH']);
|
||
|
||
// View page
|
||
$buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->pageinfo['uid'], $BACK_PATH, t3lib_BEfunc::BEgetRootLine($this->pageinfo['uid']))) . '">' .
|
||
'<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/zoom.gif') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '" hspace="3" alt="" />' .
|
||
'</a>';
|
||
// Shortcut
|
||
if ($BE_USER->mayMakeShortcut()) {
|
||
$buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
|
||
}
|
||
|
||
// If access to Web>List for user, then link to that module.
|
||
if ($BE_USER->check('modules','web_list')) {
|
||
$href = $BACK_PATH . 'db_list.php?id=' . $this->pageinfo['uid'] . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
|
||
$buttons['record_list'] = '<a href="' . htmlspecialchars($href) . '">' .
|
||
'<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/list.gif') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', 1) . '" alt="" />' .
|
||
if ($this->recordFound && $TCA[$this->table]['ctrl']['versioningWS']) {
|
||
// View page
|
||
$buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->pageinfo['uid'], $BACK_PATH, t3lib_BEfunc::BEgetRootLine($this->pageinfo['uid']))) . '">' .
|
||
'<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/zoom.gif') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '" hspace="3" alt="" />' .
|
||
'</a>';
|
||
|
||
// Shortcut
|
||
if ($BE_USER->mayMakeShortcut()) {
|
||
$buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
|
||
}
|
||
|
||
// If access to Web>List for user, then link to that module.
|
||
if ($BE_USER->check('modules','web_list')) {
|
||
$href = $BACK_PATH . 'db_list.php?id=' . $this->pageinfo['uid'] . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
|
||
$buttons['record_list'] = '<a href="' . htmlspecialchars($href) . '">' .
|
||
'<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/list.gif') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', 1) . '" alt="" />' .
|
||
'</a>';
|
||
}
|
||
}
|
||
return $buttons;
|
||
}
|