Roo/Document.js
authorAlan Knowles <alan@akbkhome.com>
Wed, 23 Jun 2010 04:35:02 +0000 (12:35 +0800)
committerAlan Knowles <alan@akbkhome.com>
Wed, 23 Jun 2010 04:35:02 +0000 (12:35 +0800)
Roo/Document.js

index e69de29..f4485f7 100644 (file)
@@ -0,0 +1,119 @@
+/*
+ * Original code for Roojs - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.Documents
+ * @extends Roo.data.Observable
+ * 
+ * Document and interface builder class..
+ * 
+ * MyApp = new Roo.Document({
+ *     loadingIndicator : 'loading' 
+ * });
+ * 
+ * MyApp.on('beforeload', function() {
+ *      MyApp.register()
+ * 
+ * 
+ * 
+ */
+Roo.Document = function(cfg) {
+     
+    this.addEvents({ 
+        'ready' : true,
+        'beforeload' : true, // fired after page ready, before module building.
+        'load' : true, // fired after module building
+        'authrefreshed' : true // fire on auth updated?? - should be on Login?!?!?
+        
+    });
+    Roo.util.Observable.call(this,cfg);
+    var _this = this;
+    Roo.onReady(function() {
+        _this.fireEvent('ready');
+    },null,false);
+    
+    this.on('ready', onReady, this);
+    this.on('load', onLoad, this);  
+    
+}
+Roo.extend(Roo.Document, Roo.util.Observable, {
+    /**
+     * @property  buildCompleted
+     * True when the builder has completed building the interface.
+     * @type Boolean
+     */
+    buildCompleted : false,
+     /**
+     * @property  loadingIndicator
+     * ID of loading indictor element.
+     * @type String
+     */
+    loadingIndicator : false,
+    
+    
+    
+    onReady : 
+    listeners : {
+        'ready' : function()
+        {
+            // kludge to fix firebug debugger
+            if (typeof(console) == 'undefined') {
+                console = { log : function() {  } };
+            }
+            
+            // remove loader..
+            if (Roo.get('loading')) {
+                Roo.get('loading').remove();
+            }
+            
+            Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
+            
+            // link errors...
+            
+            if (AppLinkError.length) {
+                Ext.MessageBox.alert("Error", AppLinkError, function() {
+                    Pman.Login.onLoad();
+                });
+                return;
+            }
+            
+            
+            // reset password!!!!
+            if (showNewPass.length) {
+                Pman.PasswordChange.show(  { passwordReset : showNewPass },
+                    function(data) {
+                        // fail and success we do  a load...
+                        Pman.Login.onLoad();
+                    }
+                );
+                return;
+            }
+             
+            Pman.Login.onLoad();
+            
+        },
+        'load' : function()
+        {
+            if (Roo.get('loading-logo-tile')) {
+                Roo.get('loading-logo-tile').remove();
+            }
+            if (Roo.get('loading-logo-tile-top')) {
+                Roo.get('loading-logo-tile-top').remove();
+            }
+            if (Roo.get('loading-logo-bottom')) {
+                Roo.get('loading-logo-bottom').remove();
+            }
+            if (Roo.get('loading-logo-center')) {
+                Roo.get('loading-logo-center').remove();
+            }
+        }   
+        
+    },
+   
+    
+    
+});
\ No newline at end of file