Follow up to #5500: Load Inline Elements On Demand (thanks to Steffen Ritter)
authorSusanne Moog <typo3@susannemoog.de>
Mon, 3 May 2010 18:24:15 +0000 (18:24 +0000)
committerSusanne Moog <typo3@susannemoog.de>
Mon, 3 May 2010 18:24:15 +0000 (18:24 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7533 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/jsfunc.inline.js

index aa5cf7d..822d616 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-05-03  Susanne Moog  <typo3@susanne-moog.de>
+
+       * Follow up to #5500: Load Inline Elements On Demand (thanks to Steffen Ritter)
+
 2010-05-03  Benjamin Mack  <benni@typo3.org>
 
        * Release of TYPO3 4.4.0beta2
index 440717f..d0d03d8 100644 (file)
@@ -36,6 +36,7 @@ var inline = {
        lockedAjaxMethod: {},
        sourcesLoaded: {},
        data: {},
+       isLoading: false,
 
        addToDataArray: function(object) {
                $H(object).each(function(pair) {
@@ -50,11 +51,14 @@ var inline = {
                var objectPrefix = this.parseObjectId('full', objectId, 0, 1);
 
                        // if content is not loaded yet, get it now from server
-               if ($(objectId+'_fields') && $(objectId+'_fields').innerHTML.substr(0,16) == '<!--notloaded-->') {
+               if(($(objectId+'_fields') && $("irre-loading-indicator"+objectId)) || inline.isLoading) {
+                       return false;
+               } else if ($(objectId+'_fields') && $(objectId+'_fields').innerHTML.substr(0,16) == '<!--notloaded-->') {
                                // add loading-indicator
                        if ($(objectId+'_label')) {
-                               $(objectId+'_label').insert({before:'<span id="irre-loading-indicator" class="loading-indicator">&nbsp;</span>'});
+                               $(objectId+'_label').insert({before:'<span id="irre-loading-indicator'+objectId+'" class="loading-indicator">&nbsp;</span>'});
                        }
+                       inline.isLoading = true;
                        return this.getRecordDetails(objectId, returnURL);      
                }               
                
@@ -151,8 +155,8 @@ var inline = {
                        options = {
                                method:         'post',
                                parameters:     urlParams,
-                               onSuccess:      function(xhr) { inline.processAjaxResponse(method, xhr); },
-                               onFailure:      function(xhr) { inline.showAjaxFailure(method, xhr); }
+                               onSuccess:      function(xhr) { inline.isLoading = false; inline.processAjaxResponse(method, xhr); },
+                               onFailure:      function(xhr) { inline.isLoading = false; inline.showAjaxFailure(method, xhr); }
                        };
 
                        new Ajax.Request(url, options);
@@ -371,8 +375,8 @@ var inline = {
                        return;
                objectDiv.update(htmlData);
                        // remove loading-indicator
-               if ($('irre-loading-indicator')) 
-                       $('irre-loading-indicator').remove();
+               if ($('irre-loading-indicator'+objectId)) 
+                       $('irre-loading-indicator'+objectId).remove();
                        // now that the content is loaded, set the expandState
                this.expandCollapseRecord(objectId, expandSingle);
        },