[BUGFIX] Improve usability of group fields
authorStefan Geith <typo3dev2011@geithware.de>
Fri, 15 Jul 2011 07:35:58 +0000 (09:35 +0200)
committerAndreas Wolf <andreas.wolf@ikt-werk.de>
Tue, 20 Sep 2011 10:30:57 +0000 (12:30 +0200)
If you set
    'disable_controls'=>'list'
you can _once_ upload an image (or file). But because of a missing Delete-Button
you never are able to change this image (or file) later.

Solution is, to add the delete Button, even if the list is not shown.
To remove even the delete button, use
    'disable_controls'=>'list,delete'

Change-Id: Ia13a9a25a64742eb49e64b7f26c085f15ca72b87
Resolves: #22679, #M14430
Releases: 4.6
Reviewed-on: http://review.typo3.org/3347
Reviewed-by: Stefan Neufeind
Reviewed-by: Xavier Perseguers
Reviewed-by: Andreas Wolf
Tested-by: Andreas Wolf
t3lib/class.t3lib_tceforms.php

index 9074618..37340d9 100644 (file)
@@ -2068,8 +2068,9 @@ class t3lib_TCEforms {
 
                $PA['itemFormElID_file'] = $PA['itemFormElID'] . '_files';
 
 
                $PA['itemFormElID_file'] = $PA['itemFormElID'] . '_files';
 
-                       // whether the list controls should be disabled
+                       // whether the list and delete controls should be disabled
                $noList = isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'list');
                $noList = isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'list');
+               $noDelete = isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'delete');
 
                        // if maxitems==1 then automatically replace the current item (in list and file selector)
                if ($maxitems === 1) {
 
                        // if maxitems==1 then automatically replace the current item (in list and file selector)
                if ($maxitems === 1) {
@@ -2143,6 +2144,7 @@ class t3lib_TCEforms {
                                        'readOnly' => $disabled,
                                        'noBrowser' => $noList || (isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'browser')),
                                        'noList' => $noList,
                                        'readOnly' => $disabled,
                                        'noBrowser' => $noList || (isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'browser')),
                                        'noList' => $noList,
+                                       'noDelete' => $noDelete,
                                );
                                $item .= $this->dbFileIcons($PA['itemFormElName'], 'file', implode(',', $tempFT), $itemArray, '', $params, $PA['onFocus']);
 
                                );
                                $item .= $this->dbFileIcons($PA['itemFormElName'], 'file', implode(',', $tempFT), $itemArray, '', $params, $PA['onFocus']);
 
@@ -3633,6 +3635,8 @@ class t3lib_TCEforms {
                                                                t3lib_iconWorks::getSpriteIcon('actions-document-paste-into', array('title' => htmlspecialchars(sprintf($this->getLL('l_clipInsert_' . ($mode == 'db' ? 'db' : 'file')), count($clipElements))))) .
                                                                '</a>';
                        }
                                                                t3lib_iconWorks::getSpriteIcon('actions-document-paste-into', array('title' => htmlspecialchars(sprintf($this->getLL('l_clipInsert_' . ($mode == 'db' ? 'db' : 'file')), count($clipElements))))) .
                                                                '</a>';
                        }
+               }
+               if (!$params['readOnly'] && !$params['noDelete']) {
                        $rOnClick = $rOnClickInline . 'setFormValueManipulate(\'' . $fName . '\',\'Remove\'); return false';
                        $icons['L'][] = '<a href="#" onclick="' . htmlspecialchars($rOnClick) . '">' .
                                                        t3lib_iconWorks::getSpriteIcon('actions-selection-delete', array('title' => htmlspecialchars($this->getLL('l_remove_selected')))) .
                        $rOnClick = $rOnClickInline . 'setFormValueManipulate(\'' . $fName . '\',\'Remove\'); return false';
                        $icons['L'][] = '<a href="#" onclick="' . htmlspecialchars($rOnClick) . '">' .
                                                        t3lib_iconWorks::getSpriteIcon('actions-selection-delete', array('title' => htmlspecialchars($this->getLL('l_remove_selected')))) .