RFC: #8830: Missing "Save&Close" in template module Info/Modify
authorMartin Kutschker <martin.t.kutschker@blackbox.net>
Sun, 3 Aug 2008 09:49:50 +0000 (09:49 +0000)
committerMartin Kutschker <martin.t.kutschker@blackbox.net>
Sun, 3 Aug 2008 09:49:50 +0000 (09:49 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3931 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/tstemplate/ts/index.php
typo3/sysext/tstemplate_info/class.tx_tstemplateinfo.php
typo3/templates/tstemplate.html

index 2b397fc..d3eff37 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 2008-08-03  Martin Kutschker  <masi@typo3.org>
 
        * Fixed bug #8949: Table parsing doesn't allow tabs as delimiters
+       * Fixed bug #8830: Missing "Save&Close" in template module Info/Modify (thanx to Steffen Kamper)
 
 2008-08-01  Benjamin Mack  <benni@typo3.org>
 
index fc2b75d..e247b1c 100644 (file)
@@ -235,7 +235,9 @@ class SC_mod_web_ts_index extends t3lib_SCbase {
                $buttons = array(
                        'back' => '',
                        'close' => '',
+                       'new' => '',
                        'save' => '',
+                       'save_close' => '',
                        'view' => '',
                        'record_list' => '',
                        'shortcut' => '',
@@ -256,11 +258,22 @@ class SC_mod_web_ts_index extends t3lib_SCbase {
                        }
 
                        if($this->extClassConf['name'] == 'tx_tstemplateinfo') {
-                               if(!empty($this->e) && !t3lib_div::_POST('abort')) {
+                                       // NEW button 
+                               $buttons['new'] = '<input type="image" class="c-inputButton" name="createExtension" value="New"' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/new_el.gif','') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:db_new.php.pagetitle', 1) . '" />';
+                                       
+                               if(!empty($this->e) && !t3lib_div::_POST('abort') && !t3lib_div::_POST('saveclose')) {
+                                               // no NEW-button while edit
+                                       $buttons['new'] = '';
+                                       
                                                // SAVE button
                                        $buttons['save'] = '<input type="image" class="c-inputButton" name="submit" value="Update"' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/savedok.gif','') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" />';
+
+                                               // SAVE AND CLOSE button 
+                                       $buttons['save_close'] = '<input type="image" class="c-inputButton" name="saveclose" value="Save and close"' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/saveandclosedok.gif', '') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc',1) . '" />';
+
                                                // CLOSE button
                                        $buttons['close'] = '<input type="image" class="c-inputButton" name="abort" value="Abort"' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/closedok.gif','') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', 1) . '" />';
+                                                                       
                                }
                        } elseif($this->extClassConf['name'] == 'tx_tstemplateceditor' && count($this->MOD_MENU['constant_editor_cat'])) {
                                        // SAVE button
@@ -343,7 +356,7 @@ class SC_mod_web_ts_index extends t3lib_SCbase {
                        // No template
                $theOutput .= $this->doc->spacer(10);
                $theOutput .= $this->doc->section('<span class="typo3-red">No template</span>', "There was no template on this page!<br />
-                       Create a template record first in order to edit constants!", 0, 0, 0, 1);
+                       Create a template record first in order to edit constants!", 0, 0, 0, 1);
 
                        // New standard?
                if ($newStandardTemplate)       {
@@ -400,7 +413,7 @@ class SC_mod_web_ts_index extends t3lib_SCbase {
                return $menu;
        }
 
-       function createTemplate($id)    {
+       function createTemplate($id, $actTemplateId = 0)        {
                if (t3lib_div::_GP('createExtension'))  {
                        require_once (PATH_t3lib . 'class.t3lib_tcemain.php');
                        $tce = t3lib_div::makeInstance('t3lib_TCEmain');
@@ -408,12 +421,13 @@ class SC_mod_web_ts_index extends t3lib_SCbase {
                        $tce->stripslashes_values = 0;
                        $recData = array();
                        $recData['sys_template']['NEW'] = array(
-                               'pid' => $id,
+                               'pid' => $actTemplateId ? -1 * $actTemplateId : $id,
                                'title' => "+ext",
-                               'sorting' => time()
                        );
+                       
                        $tce->start($recData, array());
                        $tce->process_datamap();
+                       return $tce->substNEWwithIDs['NEW'];
                } elseif (t3lib_div::_GP('newWebsite')) {
                        require_once (PATH_t3lib . 'class.t3lib_tcemain.php');
                        $tce = t3lib_div::makeInstance('t3lib_TCEmain');
index ec4cff0..591cc28 100644 (file)
@@ -164,10 +164,7 @@ class tx_tstemplateinfo extends t3lib_extobjbase {
 
                t3lib_div::loadTCA('sys_template');
 
-               // **************************
-               // Create extension template
-               // **************************
-               $this->pObj->createTemplate($this->pObj->id);
+               
 
 
                // **************************
@@ -184,12 +181,24 @@ class tx_tstemplateinfo extends t3lib_extobjbase {
                // Initialize
                // **************************
                $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);              // initialize
+                
                if ($existTemplate)     {
                        $saveId = ($tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid']);
-
+               }
+               // **************************
+               // Create extension template
+               // **************************
+               $newId = $this->pObj->createTemplate($this->pObj->id, $saveId);
+               if($newId) {
+                       // switch to new template
+                       header('location: index.php?id=' . $this->pObj->id. '&SET[templatesOnPage]=' . $newId);
+               }
+               
+               if ($existTemplate)     {   
                                // Update template ?
                        $POST = t3lib_div::_POST();
-                       if ($POST['submit'] || (t3lib_div::testInt($POST['submit_x']) && t3lib_div::testInt($POST['submit_y']))) {
+                       if ($POST['submit'] || (t3lib_div::testInt($POST['submit_x']) && t3lib_div::testInt($POST['submit_y']))
+                               || $POST['saveclose'] || (t3lib_div::testInt($POST['saveclose_x']) && t3lib_div::testInt($POST['saveclose_y']))) {
                                require_once(PATH_t3lib.'class.t3lib_tcemain.php');
                                        // Set the data to be saved
                                $recData = array();
@@ -334,8 +343,9 @@ class tx_tstemplateinfo extends t3lib_extobjbase {
                        $numberOfRows = 35;
 
                                // If abort pressed, nothing should be edited:
-                       if ($POST['abort'] || (t3lib_div::testInt($POST['abort_x']) && t3lib_div::testInt($POST['abort_y']))) {
-                               unset($e);
+                       if ($POST['abort'] || (t3lib_div::testInt($POST['abort_x']) && t3lib_div::testInt($POST['abort_y']))
+                               || $POST['saveclose'] || (t3lib_div::testInt($POST['saveclose_x']) && t3lib_div::testInt($POST['saveclose_y']))) {
+                               unset($e); 
                        }
 
                        if ($e['title'])        {
@@ -492,4 +502,4 @@ if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/tstempl
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']);
 }
 
-?>
\ No newline at end of file
+?>
index 80e8996..1a326ed 100644 (file)
@@ -27,9 +27,9 @@
 <!-- ###BUTTON_GROUP_WRAP### -->
 
 <!-- ###BUTTON_GROUPS_LEFT### -->
-<!-- ###BUTTON_GROUP1### -->###BACK###<!-- ###BUTTON_GROUP1### -->
+<!-- ###BUTTON_GROUP1### -->###BACK######NEW###<!-- ###BUTTON_GROUP1### -->
 <!-- ###BUTTON_GROUP2### -->###CLOSE###<!-- ###BUTTON_GROUP2### -->
-<!-- ###BUTTON_GROUP3### -->###SAVE###<!-- ###BUTTON_GROUP3### -->
+<!-- ###BUTTON_GROUP3### -->###SAVE######SAVE_CLOSE###<!-- ###BUTTON_GROUP3### -->
 <!-- ###BUTTON_GROUP4### -->###VIEW###<!-- ###BUTTON_GROUP4### -->
 <!-- ###BUTTON_GROUPS_LEFT### -->