Fixed bug #9227: Group field in Flexforms with a single table does not show selected...
authorOliver Hader <oliver.hader@typo3.org>
Thu, 4 Sep 2008 17:46:45 +0000 (17:46 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Thu, 4 Sep 2008 17:46:45 +0000 (17:46 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4063 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tceforms.php

index 476b457..c2066dd 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-09-04  Oliver Hader  <oliver@typo3.org>
+
+       * Fixed bug #9227: Group field in Flexforms with a single table does not show selected items
+
 2008-09-04  Dmitry Dulepov  <dmitry@typo3.org>
 
        * Fixed bug #9263: Default icon for plugins in list_type select (thanks to Steffen Kamper)
index c8d5589..49a190c 100755 (executable)
@@ -2029,8 +2029,8 @@ class t3lib_TCEforms      {
                $maxitems = t3lib_div::intInRange($config['maxitems'],0);
                if (!$maxitems) $maxitems=100000;
                $minitems = t3lib_div::intInRange($config['minitems'],0);
-               $allowed = $config['allowed'];
-               $disallowed = $config['disallowed'];
+               $allowed = trim($config['allowed']);
+               $disallowed = trim($config['disallowed']);
 
                $disabled = '';
                if($this->renderReadonly || $config['readOnly'])  {
@@ -2146,19 +2146,19 @@ class t3lib_TCEforms    {
                        case 'db':      // If the element is of the internal type "db":
 
                                        // Creating string showing allowed types:
-                               $tempFT = t3lib_div::trimExplode(',',$allowed,1);
-                               if (!strcmp(trim($tempFT[0]),'*'))      {
+                               $tempFT = t3lib_div::trimExplode(',', $allowed, true);
+                               if (!strcmp(trim($tempFT[0]), '*')) {
+                                       $onlySingleTableAllowed = false;
                                        $info.='<span class="nobr">&nbsp;&nbsp;&nbsp;&nbsp;'.
                                                        htmlspecialchars($this->getLL('l_allTables')).
                                                        '</span><br />';
-                               } else {
-                                       while(list(,$theT)=each($tempFT))       {
-                                               if ($theT)      {
-                                                       $info.='<span class="nobr">&nbsp;&nbsp;&nbsp;&nbsp;'.
-                                                                       t3lib_iconWorks::getIconImage($theT,array(),$this->backPath,'align="top"').
-                                                                       htmlspecialchars($this->sL($GLOBALS['TCA'][$theT]['ctrl']['title'])).
-                                                                       '</span><br />';
-                                               }
+                               } elseif ($tempFT) {
+                                       $onlySingleTableAllowed = (count($tempFT) == 1);
+                                       foreach ($tempFT as $theT) {
+                                               $info.= '<span class="nobr">&nbsp;&nbsp;&nbsp;&nbsp;' .
+                                                               t3lib_iconWorks::getIconImage($theT, array(), $this->backPath, 'align="top"') .
+                                                               htmlspecialchars($this->sL($GLOBALS['TCA'][$theT]['ctrl']['title'])) .
+                                                               '</span><br />';
                                        }
                                }
 
@@ -2171,6 +2171,10 @@ class t3lib_TCEforms     {
                                foreach($temp_itemArray as $dbRead)     {
                                        $recordParts = explode('|',$dbRead);
                                        list($this_table,$this_uid) = t3lib_BEfunc::splitTable_Uid($recordParts[0]);
+                                       // For the case that no table was found and only a single table is defined to be allowed, use that one:
+                                       if (!$this_table && $onlySingleTableAllowed) {
+                                               $this_table = $allowed;
+                                       }
                                        $itemArray[] = array('table'=>$this_table, 'id'=>$this_uid);
                                        if (!$disabled && $show_thumbs) {
                                                $rr = t3lib_BEfunc::getRecordWSOL($this_table,$this_uid);