[icinga-checkins] icinga.org: icinga-web/mhein/extlayout: * Moved and cleaned up libs and namespaces 3

git at icinga.org git at icinga.org
Mon Apr 19 17:51:28 CEST 2010


Module: icinga-web
Branch: mhein/extlayout
Commit: 250f57b57286fbf75b2b7707d31b79c87c9ce29d
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=250f57b57286fbf75b2b7707d31b79c87c9ce29d

Author: Marius Hein <marius.hein at netways.de>
Date:   Mon Apr 19 12:01:58 2010 +0200

* Moved and cleaned up libs and namespaces 3

---

 app/modules/AppKit/lib/js/AppKit.js                |  247 +++++++++++++-------
 app/modules/AppKit/lib/js/Layout.js                |    4 +-
 .../Cronks/templates/System/CronkPortalSuccess.php |    6 +-
 app/templates/ExtJsViewport.php                    |    2 +-
 pub/styles/Icinga.css                              |    4 +-
 5 files changed, 164 insertions(+), 99 deletions(-)

diff --git a/app/modules/AppKit/lib/js/AppKit.js b/app/modules/AppKit/lib/js/AppKit.js
index 392600a..af0c5a3 100644
--- a/app/modules/AppKit/lib/js/AppKit.js
+++ b/app/modules/AppKit/lib/js/AppKit.js
@@ -1,104 +1,171 @@
 Ext.ns('AppKit', 'APPKIT.lib');
 
 (function() {
+	
+	AppKit = (function() {
+		var pub = function() { pub.superclass.constructor.call(this); };
 		
-	AppKit = new (Ext.extend(
-		AppKit = function() {
-
-			AppKit.superclass.constructor.call(this);
-			var stateProvider = null;
-			var stateInitialData = null;
-
-		}, Ext.util.Observable, {
-
-		ready : false,
+		var stateProvider = null;
+		var stateInitialData = null;
 		
-		c : {
-			domain: document.location.host || document.domain,
-			path: document.location.pathname.replace(/\/$/, ''),
-			issecure: (document.location.protocol.indexOf('https') == 0) ? true : false
-		},
-
-		initEnvironment : function() {
-			Ext.BLANK_IMAGE_URL = this.c.path + '/images/ajax/s.gif';
+		var growlStackElement = null;
+		var growlTemplate = new Ext.Template([
+			'<div class="growl-msg-message">',
+				'<div>{header}</div>',
+				'<div>{message}</div>',
+			'</div>'
+		]);
+		
+		Ext.extend(pub, Ext.util.Observable, {
 			
-			Ext.QuickTips.init();
+			constructor: function() {
+				this.superclass.constructor.call(this);
+			},
 			
-			stateProvider = new Ext.ux.state.HttpProvider({
-				url: String.format(this.c.path + '/appkit/ext/applicationState'),
-				id: 1,
-				readBaseParams: { cmd: 'read' },
-				saveBaseParams: { cmd: 'write' }
-			});
+			ready : false,
 			
-			Ext.state.Manager.setProvider(stateProvider);
+			c : {
+				domain: document.location.host || document.domain,
+				path: document.location.pathname.replace(/\/$/, ''),
+				issecure: (document.location.protocol.indexOf('https') == 0) ? true : false
+			},
+	
+			initEnvironment : function() {
+				Ext.BLANK_IMAGE_URL = this.c.path + '/images/ajax/s.gif';
+				
+				Ext.QuickTips.init();
+				
+				this.growlStack();
+				
+				stateProvider = new Ext.ux.state.HttpProvider({
+					url: String.format(this.c.path + '/appkit/ext/applicationState'),
+					id: 1,
+					readBaseParams: { cmd: 'read' },
+					saveBaseParams: { cmd: 'write' }
+				});
+				
+				Ext.state.Manager.setProvider(stateProvider);
+				
+				if (stateInitialData) {
+					stateProvider.initState(stateInitialData);
+				}
+				
+				this.ready = true;
+				
+				this.fireEvent('appkit-ready');
+			},
 			
-			if (stateInitialData) {
-				stateProvider.initState(stateInitialData);
-			}
+			/**
+			 * Set the initial application state
+			 * before init!
+			 */
+			setInitialState : function(s) {
+				stateInitialData = s;
+				this.fireEvent('appkit-statedata');
+	
+				if (!this.ready) {
+					this.initEnvironment();
+				}
+			},
 			
-			this.ready = true;
+			/**
+			 * General log implementation
+			 */
+			log : function() {
+				if (typeof console !== "undefined" && console.log) {
+					console.log[console.firebug ? 'apply' : 'call'](console,Array.prototype.slice.call(arguments));
+				}
+			},
 			
-			this.fireEvent('appkit-ready');
-		},
-		
-		/**
-		 * Set the initial application state
-		 * before init!
-		 */
-		setInitialState : function(s) {
-			stateInitialData = s;
-			this.fireEvent('appkit-statedata');
-
-			if (!this.ready) {
-				this.initEnvironment();
-			}
-		},
-		
-		/**
-		 * General log implementation
-		 */
-		log : function() {
-			if (typeof console !== "undefined" && console.log) {
-				console.log[console.firebug ? 'apply' : 'call'](console,Array.prototype.slice.call(arguments));
-			}
-		},
+			/**
+			 * log calee arguments
+			 */
+			logargs : function(context) {
+				this.log(context,arguments.callee.caller.arguments);
+			},
+	
+			/**
+			 * Sets the window location
+			 */
+	        changeLocation : function(sUrl) {
+	                if (window.location.replace) {
+	                        window.location.replace(sUrl);
+	                }
+	                else {
+	                        window.location.href = sUrl;
+	                }
+	
+	                return true;
+	        },
+	
+			
+			pageLoadingMask : function(time, remove) {
+	                remove = (remove || false);
+	                time = (time || 2000);
+	                
+	                var ids = ['icinga-portal-loading-mask', 'icinga-portal-loading']
+	                
+	                if (remove) {
+	                        Ext.iterate(ids, function(v) {
+	                                Ext.get(v).fadeOut({remove: true});
+	                        });
+	                }
+	                else {
+	                        Ext.iterate(ids, function(v) {
+	                                Ext.DomHelper.append(Ext.getBody(), {tag: 'div', id: v});
+	                        });
+	                        
+	                        if (time > 0) {
+	                        	setTimeout(AppKit.pageLoadingMask.createDelegate(this, [0, true]), time);
+	                        }
+	                }
+	        },
+	        
+	        growlStack : function() {
+	        	if (!growlStackElement) {
+	        		growlStackElement = Ext.DomHelper.insertFirst(Ext.getBody(), {
+	        			id: 'growl-msg-stack'
+	        		}, true);
+	        	}
+	        	
+	        	growlStackElement.alignTo(Ext.getDoc(), 'tr-tr', [-18, 10]);
+	        	
+	        	return growlStackElement;
+	        },
+	        
+	        growlPopupBox : function(message, title, icon) {
+	        	
+	        	var box = growlTemplate.append(this.growlStack(), {
+	        		header: title,
+	        		message: message
+	        	}, true);
+	        	
+	        	return box.boxWrap('x-box');
+	        },
+	        
+	        notifyMessage : function(title, msg) {
+	        	var la = Ext.toArray(arguments);
+	        	var title = la.shift();
+	        	
+	        	var c = {
+	        		time: 2
+	        	};
+	        	
+	        	if (Ext.isObject(la[ la.length -1 ])) {
+	        		Ext.apply(c, la.pop());
+	        		console.log(c);
+	        	}
+	        	
+	        	var nm = String.format.apply(this, la);
+	        	
+	        	var ele = this.growlPopupBox(nm, title);
+	        	
+	        	ele.slideIn('r').pause(c.time).ghost('r', {remove:true});
+	        }
+			
+		});
 		
-		/**
-		 * log calee arguments
-		 */
-		logargs : function(context) {
-			this.log(context,arguments.callee.caller.arguments);
-		},
-
-		/**
-		 * Sets the window location
-		 */
-                changeLocation : function(sUrl) {
-                        if (window.location.replace) {
-                                window.location.replace(sUrl);
-                        }
-                        else {
-                                window.location.href = sUrl;
-                        }
-
-                        return true;
-                },
-
-		pageLoadingMask : function(remove) {
-                        remove = (remove || false);
-                        var ids = ['icinga-portal-loading-mask', 'icinga-portal-loading']
-                        if (remove) {
-                                Ext.iterate(ids, function(v) {
-                                        Ext.get(v).fadeOut({remove: true});
-                                });
-                        }
-                        else {
-                                Ext.iterate(ids, function(v) {
-                                        Ext.DomHelper.append(Ext.getBody(), {tag: 'div', id: v});
-                                });
-                        }
-                }
-	}))();
+		return new pub();
+	})();
 	
 })();
diff --git a/app/modules/AppKit/lib/js/Layout.js b/app/modules/AppKit/lib/js/Layout.js
index 748cb60..8018cc6 100644
--- a/app/modules/AppKit/lib/js/Layout.js
+++ b/app/modules/AppKit/lib/js/Layout.js
@@ -13,7 +13,7 @@ Ext.onReady(function() {
 		var queue = [];
 		
 		var pub = {};
-		var contentel = Ext.get('content');
+		var contentel = 'content';
 		var viewport = null;
 		var center = null;
 		var north = null;
@@ -113,6 +113,8 @@ Ext.onReady(function() {
 						}
 					}]
 				});
+				
+				north.doLayout();
 			}
 			
 		});
diff --git a/app/modules/Cronks/templates/System/CronkPortalSuccess.php b/app/modules/Cronks/templates/System/CronkPortalSuccess.php
index 2484618..24595a2 100644
--- a/app/modules/Cronks/templates/System/CronkPortalSuccess.php
+++ b/app/modules/Cronks/templates/System/CronkPortalSuccess.php
@@ -4,11 +4,7 @@
 <script type="text/javascript">
 Ext.onReady(function() {
 
-	AppKit.pageLoadingMask();
-	
-	setTimeout(function() {
-		AppKit.pageLoadingMask(true);
-	}, 2500);
+	AppKit.pageLoadingMask(2500);
 
 	Cronk.items.Portal = Ext.create({
 		xtype: 'panel',
diff --git a/app/templates/ExtJsViewport.php b/app/templates/ExtJsViewport.php
index 7854997..c8ad67f 100644
--- a/app/templates/ExtJsViewport.php
+++ b/app/templates/ExtJsViewport.php
@@ -15,7 +15,7 @@
 		<?php echo $slots['nav']; ?>
 	</head>
 	<body>
-		<div id="content">
+		<div id="content" class="x-hidden">
 			<?php  (isset($title)) ? '<h1>'. $title. '</h1>' : null ?>
 			<?php echo $inner; ?>
 		</div>
diff --git a/pub/styles/Icinga.css b/pub/styles/Icinga.css
index 1988952..4161c54 100644
--- a/pub/styles/Icinga.css
+++ b/pub/styles/Icinga.css
@@ -130,12 +130,12 @@ div.cronk-data-view .x-view-selected .thumb{
 
 /** JS Message stack **/
 
-div.ext-msg-message {
+div.growl-msg-message {
 	position: relative;
 	z-index: 999;	
 }
 
-div#ext-msg-stack {
+div#growl-msg-stack {
 	position:absolute;
     /* left: 35%;
     top: 10px; */





More information about the icinga-checkins mailing list