Roo/Document.js
authorAlan Knowles <alan@akbkhome.com>
Wed, 23 Jun 2010 05:58:14 +0000 (13:58 +0800)
committerAlan Knowles <alan@akbkhome.com>
Wed, 23 Jun 2010 05:58:14 +0000 (13:58 +0800)
Roo/Document.js

index 718b31e..121ca34 100644 (file)
@@ -285,33 +285,35 @@ Roo.apply(Roo.XComponent,
            modal: false
           
         });
-        var n = -1;
+        var total = mods.length();
+        
         var _this = this;
         var progressRun = function() {
-            n++;
-            if (n >= mods.length) {
+            if (mods.length) {
                 Roo.MessageBox.hide();
                 _this.topModule.fireEvent('built', _this.topModule);
-                return;
+                return;    
             }
             
-            var m = mods[n];
+            var m = mods.unshift();
             
+            if (typeof(m) == 'function') {
+                m.call(this);
+                return progressRun.defer(10, _this);
+            } 
             
             Roo.MessageBox.updateProgress(
-                (n+1)/mods.length,  "Building Interface " + (n+1) + 
-                    " of " + mods.length + 
+                (total  - mods.length)/total,  "Building Interface " + (total  - mods.length) + 
+                    " of " + total + 
                     (m.name ? (' - ' + m.name) : '')
                     );
             
-            if (typeof(m) == 'function') {
-                m.call(this);
-                return progressRun.defer(10, _this);    
-
-            } 
+         
+            
             var disabled = (typeof(m.module.disabled) == 'function') ?
                 m.module.disabled.call(m.module.disabled) : m.module.disabled;    
             }
+            
             if (disabled) {
                 return progressRun(); // we do not update the display!
             }