[icinga-checkins] icinga.org: icinga-web/master: * Fixed portlet resize issue (fixes #383)

git at icinga.org git at icinga.org
Tue Jul 27 17:17:03 CEST 2010


Module: icinga-web
Branch: master
Commit: 4f9fb2445518f7073ddc2b603d72662f37081050
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=4f9fb2445518f7073ddc2b603d72662f37081050

Author: Marius Hein <marius.hein at netways.de>
Date:   Tue Jul 27 17:02:45 2010 +0200

* Fixed portlet resize issue (fixes #383)

---

 app/config/icinga.xml                              |    2 +-
 app/modules/Cronks/lib/js/Portlet.js               |   61 ++++++++++++++++++
 .../Cronks/templates/System/PortalViewSuccess.php  |   66 ++++----------------
 etc/make/files.mk                                  |    3 +-
 4 files changed, 76 insertions(+), 56 deletions(-)

diff --git a/app/config/icinga.xml b/app/config/icinga.xml
index c8042b5..daa2fc4 100755
--- a/app/config/icinga.xml
+++ b/app/config/icinga.xml
@@ -92,7 +92,7 @@
 			<!-- Cronks -->
 			<parameter>%core.root_dir%/lib/ext3/examples/ux/Portal.js</parameter>
 			<parameter>%core.root_dir%/lib/ext3/examples/ux/PortalColumn.js</parameter>
-			<parameter>%core.root_dir%/lib/ext3/examples/ux/Portlet.js</parameter>
+			<parameter>%core.module_dir%/Cronks/lib/js/Portlet.js</parameter>
 			<parameter>%core.root_dir%/lib/ext3/examples/ux/GroupTabPanel.js</parameter>
 			<parameter>%core.root_dir%/lib/ext3/examples/ux/GroupTab.js</parameter>
 			
diff --git a/app/modules/Cronks/lib/js/Portlet.js b/app/modules/Cronks/lib/js/Portlet.js
new file mode 100644
index 0000000..4e081ec
--- /dev/null
+++ b/app/modules/Cronks/lib/js/Portlet.js
@@ -0,0 +1,61 @@
+/*!
+ * Ext JS Library 3.2.1
+ * Copyright(c) 2006-2010 Ext JS, Inc.
+ * licensing at extjs.com
+ * http://www.extjs.com/license
+ */
+
+/*
+ * Resizer implementation based on user_xm
+ * http://www.sencha.com/forum/showthread.php?18593-Portlet-vertical-resizing/page2
+ */
+
+Ext.ux.Portlet = Ext.extend(Ext.Panel, {
+    anchor: '100%',
+    frame: true,
+    collapsible: true,
+    draggable: true,
+    cls: 'x-portlet',
+    //resizer properties
+    heightIncrement:16,
+    pinned:false,
+    duration: .6,
+    easing: 'backIn',
+    transparent:false,
+
+    onRender : function(ct, position) {
+        Ext.ux.Portlet.superclass.onRender.call(this,ct,position);
+
+        //2008.1.11 xm
+        var createProxyProtoType=Ext.Element.prototype.createProxy;
+        Ext.Element.prototype.createProxy=function(config){
+	        return Ext.DomHelper.append(this.dom, config, true);
+	    };
+
+        this.resizer = new Ext.Resizable(this.el, {
+            animate: true,
+            duration: this.duration,
+            easing: this.easing,
+            handles: 's',
+            transparent:this.transparent,
+            heightIncrement:this.heightIncrement,
+            minHeight: this.minHeight || 100,
+            pinned: this.pinned
+        });
+        this.resizer.on('resize', this.onResizer, this);
+
+        Ext.Element.prototype.createProxy=createProxyProtoType;
+        //2008.1.11 xm
+    },
+
+    onResizer : function(oResizable, iWidth, iHeight, e) {
+        this.setHeight(iHeight);
+    },
+
+    onCollapse : function(doAnim, animArg) {
+        this.el.setHeight('');
+        Ext.ux.Portlet.superclass.onCollapse.call(this, doAnim, animArg);
+    }
+});
+
+Ext.reg('portlet', Ext.ux.Portlet);
\ No newline at end of file
diff --git a/app/modules/Cronks/templates/System/PortalViewSuccess.php b/app/modules/Cronks/templates/System/PortalViewSuccess.php
index c124958..28c6824 100755
--- a/app/modules/Cronks/templates/System/PortalViewSuccess.php
+++ b/app/modules/Cronks/templates/System/PortalViewSuccess.php
@@ -14,49 +14,10 @@ Cronk.util.initEnvironment("<?php echo $parentid = $rd->getParameter('parentid')
 
 			Ext.apply(pub, {
 
-				createResizer : function (portlet) {
-					// Adding an resizer
-					portlet.on('render', function(ct,position) {
-
-						var createProxyProtoType=Ext.Element.prototype.createProxy;
-				        Ext.Element.prototype.createProxy=function(config){
-					        return Ext.DomHelper.append(ct.getEl(), config, true);
-					    };
-
-						this.resizer = new Ext.Resizable(this.el, {
-				            animate: true,
-				            duration: this.duration,
-				            easing: this.easing,
-				            handles: 's',
-				            transparent:this.transparent,
-				            heightIncrement:this.heightIncrement,
-				            minHeight: this.minHeight || 100,
-				            pinned: this.pinned
-				        });
-
-				        this.resizer.on('resize', function(oResizable, iWidth, iHeight, e) {
-				        	this.setHeight(iHeight);
-				        	
-				        }, this,{buffer:true});
-
-				        Ext.Element.prototype.createProxy=createProxyProtoType;
-
-					});
-					portlet.on('resize',function() {
-						Ext.each(portlet.findByType('container'),function(item) {
-			        		var bottomMargin = 15;
-			        		item.setHeight(portlet.getInnerHeight()-bottomMargin);
-			        	})	
-						
-					},this)
-				
-					
-				},
 				initPortlet : function(portlet) {
 					Cronk.Registry.add(portlet.initialConfig);
 					portlet.on('afterlayout',function(ct) {
-						AppKit.log(ct);
-				
+						
 						var params = ct.initialConfig.params;
 						params["stateuid"] = ct.stateuid;
 						params["p[stateuid]"] = ct.stateuid,
@@ -69,17 +30,20 @@ Cronk.util.initEnvironment("<?php echo $parentid = $rd->getParameter('parentid')
 						});
 						
 						portlet.getUpdater().refresh();
-					},this,{single:true})
+					},this,{single:true});
+
 					portlet.on("add",function(el,resp) {
 						Ext.each(portlet.findByType('container'),function(item) {
-        					var bottomMargin = 8;
-        					item.setHeight(portlet.getInnerHeight()-bottomMargin);
-        					item.staef
+        					item.setHeight(portlet.getInnerHeight());
         				})	
-					})
+					});
 
-				
-					PortalHandler.createResizer(portlet);
+					portlet.on('resize',function() {
+						Ext.each(portlet.findByType('container'),function(item) {
+			        		item.setHeight(portlet.getInnerHeight());
+			        	})
+
+					},this);
 				},
 				
 				createPortletDragZone : function (p) {
@@ -145,13 +109,7 @@ Cronk.util.initEnvironment("<?php echo $parentid = $rd->getParameter('parentid')
 									xtype: 'portlet',
 									tools: tools,
 									height: 200,
-									border: true,
-									// Resizer properties
-									heightIncrement:16,
-								    pinned:true,
-								    duration: .6,
-								    transparent:false
-								   
+									border: true
 								});
 								
 								PortalHandler.initPortlet(portlet);
diff --git a/etc/make/files.mk b/etc/make/files.mk
index a951033..1854d42 100755
--- a/etc/make/files.mk
+++ b/etc/make/files.mk
@@ -484,6 +484,7 @@ inc-install-files:
 	$(INSTALL) -m 644 $(INSTALL_OPTS) app/modules/Cronks/lib/js/grid/ColumnRenderer.js $(DESTDIR)$(prefix)/app/modules/Cronks/lib/js/grid/ColumnRenderer.js
 	$(INSTALL) -m 644 $(INSTALL_OPTS) app/modules/Cronks/lib/js/grid/GridPanel.js $(DESTDIR)$(prefix)/app/modules/Cronks/lib/js/grid/GridPanel.js
 	$(INSTALL) -m 644 $(INSTALL_OPTS) app/modules/Cronks/lib/js/grid/MetaGridCreator.js $(DESTDIR)$(prefix)/app/modules/Cronks/lib/js/grid/MetaGridCreator.js
+	$(INSTALL) -m 644 $(INSTALL_OPTS) app/modules/Cronks/lib/js/Portlet.js $(DESTDIR)$(prefix)/app/modules/Cronks/lib/js/Portlet.js
 	$(INSTALL) -m 644 $(INSTALL_OPTS) app/modules/Cronks/lib/js/rmd160.js $(DESTDIR)$(prefix)/app/modules/Cronks/lib/js/rmd160.js
 	$(INSTALL) -m 644 $(INSTALL_OPTS) app/modules/Cronks/lib/js/SlidingTabs.js $(DESTDIR)$(prefix)/app/modules/Cronks/lib/js/SlidingTabs.js
 	$(INSTALL) -m 644 $(INSTALL_OPTS) app/modules/Cronks/lib/js/Tabhelper.js $(DESTDIR)$(prefix)/app/modules/Cronks/lib/js/Tabhelper.js
@@ -8080,6 +8081,6 @@ inc-install-files:
 	$(INSTALL) -m 644 $(INSTALL_OPTS) pub/styles/Icinga.css $(DESTDIR)$(prefix)/pub/styles/Icinga.css
 	$(INSTALL) -m 644 $(INSTALL_OPTS) pub/styles/silk-icons.css $(DESTDIR)$(prefix)/pub/styles/silk-icons.css
 	$(INSTALL) -m 644 $(INSTALL_OPTS) pub/styles/statusmap.css $(DESTDIR)$(prefix)/pub/styles/statusmap.css
-INC_FILES=7095
+INC_FILES=7096
 INC_DIRS=984
 # INSTALL_FILES_END





More information about the icinga-checkins mailing list