Fixed bug #17672: CSH - each label fires one request
authorsteffenk <steffenk@709f56b5-9817-0410-a4d7-c38de5d9e867>
Tue, 22 Feb 2011 13:57:27 +0000 (13:57 +0000)
committersteffenk <steffenk@709f56b5-9817-0410-a4d7-c38de5d9e867>
Tue, 22 Feb 2011 13:57:27 +0000 (13:57 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@10529 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/extjs/dataprovider/class.extdirect_dataprovider_contexthelp.php
t3lib/js/extjs/contexthelp.js

index fd61c06..7799fd6 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2011-02-22  Steffen Kamper  <steffen@typo3.org
 
+       * Fixed bug #17672: CSH - each label fires one request
        * Follow-up to #17383: Open forms cannot be saved after "Relogin" (Security Token errors)
        * Fixed bug #17699: ExtDirect API use relative url for ajax.php
 
index 516c5dc..8a29fda 100644 (file)
@@ -48,6 +48,46 @@ class extDirect_DataProvider_ContextHelp {
                        'moreInfo' =>  $helpTextArray['moreInfo']
                );
        }
+
+       /**
+        * Fetch the context help for the given table
+        *
+        * @param  string $table table identifier
+        * @return array complete help information
+        */
+       public function getTableContextHelp($table) {
+               $output = array();
+               if (!isset($GLOBALS['TCA_DESCR'][$table]['columns'])) {
+                       $GLOBALS['LANG']->loadSingleTableDescription($table);
+               }
+               if (is_array($GLOBALS['TCA_DESCR'][$table]) && is_array($GLOBALS['TCA_DESCR'][$table]['columns'])) {
+                       foreach ($GLOBALS['TCA_DESCR'][$table]['columns'] as $field => $data) {
+                               $output[$field] = array(
+                                       'description' => NULL,
+                                       'title' => NULL,
+                                       'moreInfo' => FALSE,
+                                       'id' => $table . '.' . $field,
+                               );
+
+                                       // add alternative title, if defined
+                               if ($data['alttitle']) {
+                                       $output[$field]['title'] = $data['alttitle'];
+                               }
+
+                                       // if we have more information to show
+                               if ($data['image_descr'] || $data['seeAlso'] || $data['details'] || $data['syntax']) {
+                                       $output[$field]['moreInfo'] = TRUE;
+                               }
+
+                                       // add description
+                               if ($data['description']) {
+                                       $output[$field]['description'] = $data['description'];
+                               }
+                       }
+               }
+
+               return $output;
+       }
 }
 
 ?>
index 8def565..14ec81d 100644 (file)
@@ -68,11 +68,15 @@ TYPO3.ContextHelp = function() {
                                        title: ''
                                });
                                        // Load content
-                               TYPO3.CSH.ExtDirect.getContextHelp(table, field, function(response, options) {
-                                       cshHelp.add(response);
-                                       updateTip(response);
-                                               // Need to re-position because the height may have increased
-                                       tip.show();
+                               TYPO3.CSH.ExtDirect.getTableContextHelp(table, function(response, options) {
+                                       Ext.iterate(response, function(key, value){
+                                               cshHelp.add(value);
+                                               if (key === field) {
+                                                       updateTip(value);
+                                                               // Need to re-position because the height may have increased
+                                                       tip.show();
+                                               }
+                                       });
                                }, this);
 
                                // No table was given, use directly title and description