[icinga-checkins] icinga.org: icinga-web/mhein/default: * PortalColumns determind its column when dragging over

git at icinga.org git at icinga.org
Mon Jan 18 17:36:07 CET 2010


Module: icinga-web
Branch: mhein/default
Commit: 0280679d910cc08094727756be5b08deef1c2337
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=0280679d910cc08094727756be5b08deef1c2337

Author: Marius Hein <marius.hein at netways.de>
Date:   Mon Jan 18 17:35:37 2010 +0100

* PortalColumns determind its column when dragging over

---

 .../Cronks/templates/System/PortalViewSuccess.php  |   44 +++++++++++++++++++-
 1 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/app/modules/Cronks/templates/System/PortalViewSuccess.php b/app/modules/Cronks/templates/System/PortalViewSuccess.php
index b02a296..cafc7ca 100644
--- a/app/modules/Cronks/templates/System/PortalViewSuccess.php
+++ b/app/modules/Cronks/templates/System/PortalViewSuccess.php
@@ -51,8 +51,46 @@
 		function createPortletDragZone(p) {
 				var cdz = new Ext.dd.DropTarget(p.getEl(), {
 					ddGroup: 'cronk',
+					grid: undefined,
+					ac: undefined,
 					
-					notifyDrop: function(dd, e, data){
+					notifyOut : function(){
+				        delete this.grid;
+				        delete this.ac;
+				    },
+					
+					notifyOver: function(dd, e, data) {
+						
+//						console.log("--- START ---");
+						
+						if (!this.grid) {
+							this.grid = p.dd.getGrid();
+						}
+						
+						var xy = e.getXY();
+						
+//						console.log(xy);
+//						console.log(this.grid.columnX);
+						
+						Ext.iterate(this.grid.columnX, function (item, index, arry) {
+							
+//						console.log(item);
+// 	
+							if (xy[0] >= item.x && xy[0] < item.x+item.w ) {
+								this.ac = index;
+								return false;
+							}
+							
+					}, this);
+						
+//						console.log(this.ac);
+//						
+//						console.log("--- STOP ---");
+
+						return Ext.dd.DropTarget.prototype.notifyOver.call(this, dd, e, data);
+					},
+					
+					notifyDrop: function(dd, e, data) {
 						
 						var id = AppKit.Ext.genRandomId('cronk-');
 						
@@ -118,7 +156,9 @@
 						});
 						
 						// Add them to the portal
-						p.items.get(0).add(portlet);
+						p.items.get(this.ac || 0).add(portlet);
+						
+						this.ac = undefined;
 						
 						// Bubble the render event
 						p.doLayout();





More information about the icinga-checkins mailing list