[Mapbender-commits] r6672 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Aug 2 06:09:51 EDT 2010


Author: christoph
Date: 2010-08-02 10:09:51 +0000 (Mon, 02 Aug 2010)
New Revision: 6672

Modified:
   trunk/mapbender/http/javascripts/mod_tab.js
   trunk/mapbender/http/javascripts/mod_tab_expandable.js
Log:
http://trac.osgeo.org/mapbender/ticket/665

Modified: trunk/mapbender/http/javascripts/mod_tab.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_tab.js	2010-08-02 10:09:11 UTC (rev 6671)
+++ trunk/mapbender/http/javascripts/mod_tab.js	2010-08-02 10:09:51 UTC (rev 6672)
@@ -25,7 +25,10 @@
 });
 
 function localizeTabs() {
-	mb_ajax_json("../php/mod_tab_messages.php", function(obj, status){
+	mb_ajax_json("../php/mod_tab_messages.php", {
+		"sessionName": Mapbender.sessionName,
+		"sessionId": Mapbender.sessionId
+        }, function(obj, status){
 		tabs.setTitles(obj);
 	});
 }
@@ -86,9 +89,9 @@
 
 		//mandatory style entries
 		node.style.position = "absolute";
-		node.style.width = tabWidth;
-		node.style.height = tabHeight;
-		node.style.top = number * tabHeight;
+		node.style.width = parseInt(tabWidth, 10) + "px";
+		node.style.height = parseInt(tabHeight, 10) + "px";
+		node.style.top = parseInt(number * tabHeight, 10) + "px";
 		
 		// open or close on click
 		// see http://www.mapbender.org/index.php/Add_events_via_DOM_in_IE_and_FF
@@ -298,12 +301,12 @@
 				// animation not yet finished, move the tab down
 				else if (currentTabCurrentTop < currentTabNewTop) {
 					var pixel = Math.min(pixelPerIteration, currentTabNewTop - currentTabCurrentTop);
-					this.get(i).getNode().style.top = currentTabCurrentTop + pixel;
+					this.get(i).getNode().style.top = (currentTabCurrentTop + pixel) + "px";
 				}
 				// animation not yet finished, move the tab up
 				else if (currentTabCurrentTop > currentTabNewTop) {
 					var pixel = Math.min(pixelPerIteration, currentTabCurrentTop - currentTabNewTop);
-					this.get(i).getNode().style.top = currentTabCurrentTop - pixel;
+					this.get(i).getNode().style.top = (currentTabCurrentTop - pixel) + "px";
 				}
 				else {
 					var e = new Mb_exception("mod_tab.js: animate: unknown state for tab "+ i + " (currentTop: "+currentTabCurrentTop+", newTop:"+currentTabNewTop+")");
@@ -398,7 +401,7 @@
 		var index = getIndexById(id);
 		if (index !== null) {
 			var obj = document.getElementById(id);
-			var newpos = ((index+1) * tabHeight) + parseInt(tabTopOffset);
+			var newpos = ((index+1) * tabHeight) + parseInt(tabTopOffset, 10);
 			//try to apply for childs of horizontal tabs
 			try{
 				if(obj.tabs){
@@ -407,15 +410,17 @@
 					activeTab.top = ((newpos + 1) + obj.tab_height) + "px";
 					activeTab.left = (tabLeftOffset) + "px";
 					activeTab.width = tabWidth;
-					activeTab.height = (parseInt(that.get(index).height) - 2) - obj.tab_height;
+					activeTab.height = (parseInt(that.get(index).height, 10) - 2) - obj.tab_height;
 				}
 			}
-			catch(e){}
+			catch(e){
+				new Mapbender.Exception(e.message);
+			}
 			obj=obj.style;
 			obj.top = (newpos + 1) + "px";
 			obj.left = (tabLeftOffset) + "px";
-			obj.width = tabWidth;
-			obj.height = (parseInt(that.get(index).height, 10) - 2);
+			obj.width = tabWidth + "px";
+			obj.height = (parseInt(that.get(index).height, 10) - 2) + "px";
 			obj.visibility = 'visible';
 			obj.display = 'block';
 		}
@@ -433,7 +438,7 @@
 		}
 		tabInterval = setInterval(function(){
 			tabs.animate(openOrClose);
-		},1);
+		}, 10);
 	};
 	
 	/**

Modified: trunk/mapbender/http/javascripts/mod_tab_expandable.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_tab_expandable.js	2010-08-02 10:09:11 UTC (rev 6671)
+++ trunk/mapbender/http/javascripts/mod_tab_expandable.js	2010-08-02 10:09:51 UTC (rev 6672)
@@ -25,7 +25,10 @@
 });
 
 function localizeTabs(){
-    mb_ajax_json("../php/mod_tab_messages.php", function(obj, status){
+    mb_ajax_json("../php/mod_tab_messages.php", {
+		"sessionName": Mapbender.sessionName,
+		"sessionId": Mapbender.sessionId
+        }, function(obj, status){
         tabs.setTitles(obj);
     });
 }
@@ -86,9 +89,9 @@
         
         //mandatory style entries
         node.style.position = "absolute";
-        node.style.width = tabWidth;
-        node.style.height = tabHeight;
-        node.style.top = number * tabHeight;
+		node.style.width = parseInt(tabWidth, 10) + "px";
+		node.style.height = parseInt(tabHeight, 10) + "px";
+		node.style.top = parseInt(number * tabHeight, 10) + "px";
         
         this.originalHeight = tabHeight;
         
@@ -316,13 +319,13 @@
                 else 
                     if (currentTabCurrentTop < currentTabNewTop) {
                         var pixel = Math.min(pixelPerIteration, currentTabNewTop - currentTabCurrentTop);
-                        this.get(i).getNode().style.top = currentTabCurrentTop + pixel;
+                        this.get(i).getNode().style.top = (currentTabCurrentTop + pixel) + "px";
                     }
                     // animation not yet finished, move the tab up
                     else 
                         if (currentTabCurrentTop > currentTabNewTop) {
                             var pixel = Math.min(pixelPerIteration, currentTabCurrentTop - currentTabNewTop);
-                            this.get(i).getNode().style.top = currentTabCurrentTop - pixel;
+                            this.get(i).getNode().style.top = (currentTabCurrentTop - pixel) + "px";
                         }
                         else {
                             var e = new Mb_exception("mod_tab.js: animate: unknown state for tab " + i + " (currentTop: " + currentTabCurrentTop + ", newTop:" + currentTabNewTop + ")");
@@ -420,7 +423,7 @@
         var index = getIndexById(id);
         if (index !== null) {
             var obj = document.getElementById(id);
-            var newpos = ((index + 1) * tabHeight) + parseInt(tabTopOffset);
+            var newpos = ((index + 1) * tabHeight) + parseInt(tabTopOffset, 10);
             //try to apply for childs of horizontal tabs
             try {
                 if (obj.tabs) {
@@ -431,7 +434,7 @@
                     activeTab.left = (tabLeftOffset) + "px";
                     activeTab.width = tabWidth;
                     var height = getDocumentHeight() - that.get(0).top();
-                    var diff = height - that.count() * tabHeight - 4;
+                    var diff = height - that.count() * tabHeight - 5;
                     activeTab.height = diff + "px";
                     //(parseInt(that.get(index).height) - 2) - obj.tab_height;
                 }
@@ -441,9 +444,9 @@
             obj = obj.style;
             obj.top = (newpos + 1) + "px";
             obj.left = (tabLeftOffset) + "px";
-            obj.width = tabWidth;
+            obj.width = tabWidth + "px";
             var height = getDocumentHeight() - that.get(0).top();
-            var diff = height - that.count() * tabHeight - 4;
+            var diff = height - that.count() * tabHeight - 5;
             obj.height = diff + "px";
             obj.visibility = 'visible';
             obj.display = 'block';
@@ -462,7 +465,7 @@
         }
         tabInterval = setInterval(function(){
             tabs.animate(openOrClose);
-        }, 1);
+        }, 10);
     };
     
     /**
@@ -525,7 +528,7 @@
     
     var resizeTabs = function(e){
         var height = $(window).scrollTop() + $(window).height() - that.get(0).top();
-        var diff = height - that.count() * tabHeight - 4;
+        var diff = height - that.count() * tabHeight - 5;
         var indexOfOpeningTab = getIndexById(activeTabId);
         var node = that.get(indexOfOpeningTab);
 		if (node === undefined) {
@@ -546,7 +549,12 @@
         }
     };
     
-    $(window).resize(resizeTabs);
+    $(window).resize(function (e) { 
+    	setTimeout(function () {
+    		resizeTabs(e);
+	    	resizeTabs(e);
+    	}, 200);
+    });
 };
 
 VerticalTabArray.prototype = new List();



More information about the Mapbender_commits mailing list