[Mapbender-commits] r5697 - trunk/mapbender/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sun Feb 28 10:38:00 EST 2010


Author: christoph
Date: 2010-02-28 10:38:00 -0500 (Sun, 28 Feb 2010)
New Revision: 5697

Modified:
   trunk/mapbender/http/plugins/mb_twitter_signin.js
   trunk/mapbender/http/plugins/mb_twitter_update.js
Log:
update

Modified: trunk/mapbender/http/plugins/mb_twitter_signin.js
===================================================================
--- trunk/mapbender/http/plugins/mb_twitter_signin.js	2010-02-28 14:49:04 UTC (rev 5696)
+++ trunk/mapbender/http/plugins/mb_twitter_signin.js	2010-02-28 15:38:00 UTC (rev 5697)
@@ -53,6 +53,7 @@
 
 
 var TwitterSignin = function (options) {
+	var that = this;
 	this.isSignedIn = function () {
 		var req = new Mapbender.Ajax.Request({
 			url: "../plugins/mb_twitter.php",
@@ -70,6 +71,9 @@
 					alert(message);
 					$this.text(translatedI18nObject.logOut);
 				}
+				else {
+					$this.text(translatedI18nObject.logIn);
+				}
 				$this.mapbender("signedIn", obj.signedIn);
 			}
 		});
@@ -102,10 +106,10 @@
 	
 	$this.click(function () {
 		
-		
+		var method = that.signedIn ? "signout" : "signin";
 		var req = new Mapbender.Ajax.Request({
 			url: "../plugins/mb_twitter.php",
-			method: "signin",
+			method: method,
 			parameters: {
 			},
 			callback: function (obj, result, message) {
@@ -113,9 +117,15 @@
 					alert(message);
 					return;
 				}
-				if (obj.url && typeof obj.url === "string") {
+				
+				if (method === "signin" && obj.url && typeof obj.url === "string") {
 				  window.location.href = obj.url;
 				}
+				else if (method === "signout") {
+					var newUrl = window.location.href.replace(/oauth_token\=[0-9a-zA-Z]+/g, "");
+					window.location.href = newUrl;
+				
+				}
 			}
 		});
 		req.send();
@@ -147,4 +157,4 @@
 			}
 		});
 	});	
-});
\ No newline at end of file
+});

Modified: trunk/mapbender/http/plugins/mb_twitter_update.js
===================================================================
--- trunk/mapbender/http/plugins/mb_twitter_update.js	2010-02-28 14:49:04 UTC (rev 5696)
+++ trunk/mapbender/http/plugins/mb_twitter_update.js	2010-02-28 15:38:00 UTC (rev 5697)
@@ -36,6 +36,17 @@
 		name: options.id,
 		go: function () {
  			options.$target.each(function () {
+				var $twitterStatus, m;
+				var cancel = function () {
+			
+						$twitterStatus.hide("slow", function () {
+							m.remove();					
+							$(this).remove();	
+						});
+				};
+				$(this).mapbender(function () {
+					this.events.afterMapRequest.register(cancel);
+				});
 	 			$(this).css("cursor", "pointer")
 	 			.mousedown(function (e) {
 					mb_disableThisButton(options.id);
@@ -46,9 +57,9 @@
 					
 					var pix = map.getMousePosition(e);
 					var p = map.convertPixelToReal(pix);
-					var m = new Mapbender.Marker(p, map);
+					m = new Mapbender.Marker(p, map);
 
-					var $twitterStatus = $("<div style='z-index:999;position:absolute;top:" + 
+					$twitterStatus = $("<div style='z-index:999;position:absolute;top:" + 
 						(pix.y + parseInt(this.style.top, 10)) + "px;" + 
 						"left:" + (offset + parseInt(this.style.left, 10)) + "px;width:"+(width-2*offset)+"px;display:none'>" + 
 						"<div style='width:100%;height:10px;background-position:" + (pix.x-offset-10) + "px 0px;background-image:url(http://s.twimg.com/a/1266605807/images/arr2.gif);background-repeat:no-repeat;'/>" + 
@@ -79,9 +90,7 @@
 					});
 					var $cancel = $("#twitter_cancel");
 					$cancel.click(function () {
-						$twitterStatus.hide("slow", function () {
-							m.remove();						
-						});
+						return cancel();
 					});
 					return false;
 	 			});



More information about the Mapbender_commits mailing list