RFC #7431: Docheaders: Module Web > Versioning : No docheader when no page has been...
authorPatrick Broens <patrick@netcreators.com>
Sun, 17 Feb 2008 13:59:42 +0000 (13:59 +0000)
committerPatrick Broens <patrick@netcreators.com>
Sun, 17 Feb 2008 13:59:42 +0000 (13:59 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3181 709f56b5-9817-0410-a4d7-c38de5d9e867

typo3/sysext/version/cm1/index.php

index f5b6bf6..d09ecc4 100755 (executable)
@@ -183,6 +183,14 @@ class tx_version_cm1 extends t3lib_SCbase {
        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'];
                
@@ -193,7 +201,6 @@ class tx_version_cm1 extends t3lib_SCbase {
                $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']] = '
@@ -225,10 +232,14 @@ class tx_version_cm1 extends t3lib_SCbase {
                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!
@@ -281,27 +292,25 @@ class tx_version_cm1 extends t3lib_SCbase {
 
                        $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
-                       );
-                       
-                               // 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);
+                       $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->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);
+                               // If no access or id value, create empty document
+                       $this->content = $this->doc->section($LANG->getLL('clickAPage_header'), $LANG->getLL('clickAPage_content'), 0, 1);
+                       
+                               // 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);
        }
 
        /**
@@ -330,22 +339,24 @@ class tx_version_cm1 extends t3lib_SCbase {
                        // 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;
        }