7527: Docheaders: Wizard New Record/New page (db_new.php): No docheader
authorPatrick Broens <patrick@netcreators.com>
Mon, 3 Mar 2008 15:40:36 +0000 (15:40 +0000)
committerPatrick Broens <patrick@netcreators.com>
Mon, 3 Mar 2008 15:40:36 +0000 (15:40 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3359 709f56b5-9817-0410-a4d7-c38de5d9e867

typo3/db_new.php
typo3/stylesheet.css
typo3/templates/db_new.html [new file with mode: 0644]

index f049b3a..edcee6e 100755 (executable)
@@ -180,14 +180,17 @@ class SC_db_new {
                $this->pagesOnly = t3lib_div::_GP('pagesOnly');
 
                        // Create instance of template class for output
-               $this->doc = t3lib_div::makeInstance('mediumDoc');
+               $this->doc = t3lib_div::makeInstance('template');
                $this->doc->backPath = $BACK_PATH;
+               $this->doc->setModuleTemplate('templates/db_new.html');
                $this->doc->docType= 'xhtml_trans';
                $this->doc->JScode='';
+               
+                       // Setting up the context sensitive menu:
+               $this->doc->getContextMenuCode();
 
                        // Creating content
                $this->content='';
-               $this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:db_new.php.pagetitle'));
                $this->content.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:db_new.php.pagetitle'));
 
                        // Id a positive id is supplied, ask for the page record with permission information contained:
@@ -254,8 +257,16 @@ class SC_db_new {
 
 
                                // Set header-HTML and return_url
-                       $this->code = $this->doc->getHeader('pages',$this->pageinfo,$this->pageinfo['_thePath']).'<br />
-                       ';
+                       if (is_array($this->pageinfo) && $this->pageinfo['uid'])        {
+                               $iconImgTag = t3lib_iconWorks::getIconImage('pages', $this->pageinfo, $this->backPath, 'title="' . htmlspecialchars($this->pageinfo['_thePath']) . '"');
+                               $title = strip_tags($this->pageinfo[$GLOBALS['TCA']['pages']['ctrl']['label']]);
+                       } else {
+                               $iconImgTag = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/i/_icon_website.gif') . ' title="' . htmlspecialchars($this->pageinfo['_thePath']) . '" alt="" />';
+                               $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
+                       }
+       
+                       $this->code = '<span class="typo3-moduleHeader">' . $this->doc->wrapClickMenuOnIcon($iconImgTag, 'pages', $this->pageinfo['uid']) . htmlspecialchars(t3lib_div::fixed_lgd_cs($title, 45)) . '</span><br />';
+
                        $this->R_URI = $this->returnUrl;
 
                                // GENERATE the HTML-output depending on mode (pagesOnly is the page wizard)
@@ -265,17 +276,79 @@ class SC_db_new {
                                $this->pagesOnly();
                        }
 
-                               // Create go-back link.
-                       if ($this->R_URI)       {
-                               $this->code.='<br />
-               <a href="'.htmlspecialchars($this->R_URI).'" class="typo3-goBack">'.
-               '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/goback.gif','width="14" height="14"').' alt="" />'.
-               $LANG->getLL('goBack',1).
-               '</a>';
-                       }
                                // Add all the content to an output section
                        $this->content.=$this->doc->section('',$this->code);
+                       
+                                                       // Setting up the buttons and markers for docheader
+                       $docHeaderButtons = $this->getButtons();
+                       $markers['CSH'] = $docHeaderButtons['csh'];
+                       
+                       $markers['CONTENT'] = $this->content;
+                       
+                               // Build the <body> for the module
+                       $this->content = $this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:db_new.php.pagetitle'));
+                       $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
+                       $this->content.= $this->doc->endPage();
+                       $this->content = $this->doc->insertStylesAndJS($this->content);
+               }
+       }
+       
+       /**
+        * Create the panel of buttons for submitting the form or otherwise perform operations.
+        *
+        * @return      array   all available buttons as an assoc. array
+        */
+       private function getButtons()   {
+               global $LANG, $BACK_PATH;
+               
+               $buttons = array(
+                       'csh' => '',
+                       'back' => '',
+                       'view' => '',
+                       'new_page' => '',
+                       'record_list' => ''
+               );
+                       
+                       
+               if (!$this->pagesOnly)  {       // Regular new element:
+                               // New page
+                       if ($this->showNewRecLink('pages'))     {
+                               $buttons['new_page'] = '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('pagesOnly' => '1'))) . '">' .
+                                       '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/new_page.gif') . ' alt="" />' .
+                                       '</a>';
+                       }
+                               // CSH
+                       $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'new_regular', $GLOBALS['BACK_PATH']);
+               } elseif($this->showNewRecLink('pages')) {      // Pages only wizard
+                               // CSH
+                       $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'new_pages', $GLOBALS['BACK_PATH']);
+               }
+
+                       // Back
+               if ($this->R_URI) {
+                       $buttons['back'] = '<a href="' . htmlspecialchars($this->R_URI) . '" class="typo3-goBack">' .
+                               '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/goback.gif') . ' alt="" />' .
+                               '</a>';
+               }
+
+               if (is_array($this->pageinfo) && $this->pageinfo['uid']) {
+                               // View
+                       $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->pageinfo['uid'], $this->backPath, t3lib_BEfunc::BEgetRootLine($this->pageinfo['uid']))) . '">' .
+                               '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/zoom.gif') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '" alt="" />' .
+                               '</a>';
+                               
+                               // Record list
+                       if ($GLOBALS['BE_USER']->check('modules', 'web_list')) {
+                               $href = $this->backPath . '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($this->backPath, 'gfx/list.gif') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', 1) . '" alt="" />' .
+                                       '</a>';
+                       }
                }
+               
+
+
+               return $buttons;
        }
 
        /**
@@ -291,9 +364,6 @@ class SC_db_new {
                        <h3>'.htmlspecialchars($LANG->getLL('selectPosition')).':</h3>
                ';
                $this->code.= $posMap->positionTree($this->id,$this->pageinfo,$this->perms_clause,$this->R_URI);
-
-                               // Add CSH:
-               $this->code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'new_pages', $GLOBALS['BACK_PATH'],'<br/>');
        }
 
        /**
@@ -439,25 +509,6 @@ class SC_db_new {
                        '.implode('',$tRows).'
                        </table>
                ';
-
-                       // Create a link to the new-pages wizard.
-               if ($this->showNewRecLink('pages'))     {
-                       $this->code.='
-
-                               <!--
-                                       Link; create new page:
-                               -->
-                               <div id="typo3-newPageLink">
-                                       <a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('pagesOnly'=>'1'))).'">'.
-                                       '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/new_page.gif','width="13" height="12"').' alt="" />'.
-                                       htmlspecialchars($LANG->getLL('createNewPage')).
-                                       '</a>
-                               </div>
-                               ';
-               }
-
-                       // Add CSH:
-               $this->code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'new_regular', $GLOBALS['BACK_PATH'],'<br/>');
        }
 
        /**
@@ -466,8 +517,6 @@ class SC_db_new {
         * @return      void
         */
        function printContent() {
-               $this->content.= $this->doc->endPage();
-               $this->content = $this->doc->insertStylesAndJS($this->content);
                echo $this->content;
        }
 
@@ -566,4 +615,4 @@ $SOBE = t3lib_div::makeInstance('SC_db_new');
 $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();
-?>
\ No newline at end of file
+?>
index 1950ac8..ae9e8ca 100755 (executable)
@@ -142,7 +142,8 @@ body#typo3-mod-web-info-index-php,
 body#typo3-mod-web-func-index-php,
 body#ext-version-cm1-index-php,
 body#typo3-pagetree,
-body#ext-cms-layout-db-new-content-el-php {
+body#ext-cms-layout-db-new-content-el-php,
+body#typo3-db-new-php {
        padding: 0;
        margin: 0;
        overflow: hidden;
diff --git a/typo3/templates/db_new.html b/typo3/templates/db_new.html
new file mode 100644 (file)
index 0000000..7e64973
--- /dev/null
@@ -0,0 +1,34 @@
+<!-- ###FULLDOC### begin -->\r
+<div class="typo3-fullDoc">\r
+       <!-- Page header with buttons, path details and csh -->\r
+       <div id="typo3-docheader">\r
+               <div id="typo3-docheader-row1">\r
+                       <div class="buttonsleft">###BUTTONLIST_LEFT###</div>\r
+                       <div class="buttonsright">###BUTTONLIST_RIGHT###</div>\r
+               </div>\r
+               <div id="typo3-docheader-row2">\r
+                       <div class="pagepath">###CSH######PAGEPATH###</div>\r
+                       <div class="infooptions">###PAGEINFO###</div>\r
+               </div>\r
+       </div>\r
+       <!-- Content of module, for instance listing, info or editing -->\r
+       <div id="typo3-docbody">\r
+               ###CONTENT###\r
+       </div>\r
+</div>\r
+<!-- ###FULLDOC### end -->\r
+\r
+<!-- ###BUTTON_GROUP_WRAP### -->\r
+       <!-- Wrapper for button group -->\r
+       <div class="buttongroup">###BUTTONS###</div>\r
+<!-- ###BUTTON_GROUP_WRAP### -->\r
+\r
+<!-- ###BUTTON_GROUPS_LEFT### -->\r
+<!-- ###BUTTON_GROUP1### -->###BACK###<!-- ###BUTTON_GROUP1### -->\r
+<!-- ###BUTTON_GROUP2### -->###NEW_PAGE###<!-- ###BUTTON_GROUP2### -->\r
+<!-- ###BUTTON_GROUP3### -->###VIEW###<!-- ###BUTTON_GROUP3### -->\r
+<!-- ###BUTTON_GROUPS_LEFT### -->\r
+\r
+<!-- ###BUTTON_GROUPS_RIGHT### -->\r
+<!-- ###BUTTON_GROUP1### -->###RECORD_LIST###<!-- ###BUTTON_GROUP1### -->\r
+<!-- ###BUTTON_GROUPS_RIGHT### -->\r