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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jan 18 15:05:49 EST 2010


Author: christoph
Date: 2010-01-18 15:05:48 -0500 (Mon, 18 Jan 2010)
New Revision: 5332

Added:
   trunk/mapbender/http/plugins/mb_twitter.php
   trunk/mapbender/http/plugins/mb_twitter.php~
   trunk/mapbender/http/plugins/mb_twitter_signin.js
   trunk/mapbender/http/plugins/mb_twitter_signin.js~
Log:


Added: trunk/mapbender/http/plugins/mb_twitter.php
===================================================================
--- trunk/mapbender/http/plugins/mb_twitter.php	                        (rev 0)
+++ trunk/mapbender/http/plugins/mb_twitter.php	2010-01-18 20:05:48 UTC (rev 5332)
@@ -0,0 +1,39 @@
+<?php
+# License:
+# Copyright (c) 2009, Open Source Geospatial Foundation
+# This program is dual licensed under the GNU General Public License 
+# and Simplified BSD license.  
+# http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
+
+require_once dirname(__FILE__) . "/../../core/globalSettings.php";
+require_once '../extensions/epicode/EpiCurl.php';
+require_once '../extensions/epicode/EpiOAuth.php';
+require_once '../extensions/epicode/EpiTwitter.php';
+
+$gui_id = Mapbender::session()->get("mb_user_gui");
+$e_id = "twitter_signin";
+
+require_once '../include/dyn_php.php';
+
+$ajaxResponse = new AjaxResponse($_POST);
+
+switch ($ajaxResponse->getMethod()) {
+  case "signin" :
+
+    if (!isset($consumerKey) || !isset($consumerSecret)) {
+      $ajaxResponse->setSuccess(false);
+      $ajaxResponse->setMessage(_mb("Element vars consumerKey and consumerSecret are not set. If you don't have them, get them from Twitter."));
+      $ajaxResponse->send();
+    }
+    $Twitter = new EpiTwitter($consumerKey, $consumerSecret);
+    $url = $Twitter->getAuthenticateUrl();
+    $ajaxResponse->setResult(array("url" => $url)); 
+    $ajaxResponse->setSuccess(true);
+    break;
+  default: 
+    $ajaxResponse->setSuccess(false);
+    $ajaxResponse->setMessage(_mb("An unknown error occured."));
+    break;
+}
+$ajaxResponse->send();
+?>

Added: trunk/mapbender/http/plugins/mb_twitter.php~
===================================================================
--- trunk/mapbender/http/plugins/mb_twitter.php~	                        (rev 0)
+++ trunk/mapbender/http/plugins/mb_twitter.php~	2010-01-18 20:05:48 UTC (rev 5332)
@@ -0,0 +1,38 @@
+<?php
+# License:
+# Copyright (c) 2009, Open Source Geospatial Foundation
+# This program is dual licensed under the GNU General Public License 
+# and Simplified BSD license.  
+# http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
+
+require_once dirname(__FILE__) . "/../php/mb_validateSession.php";
+require_once '../extensions/epicode/EpiCurl.php';
+require_once '../extensions/epicode/EpiOAuth.php';
+require_once '../extensions/epicode/EpiTwitter.php';
+
+$gui_id = Mapbender::session()->get("mb_user_gui");
+
+require_once '../include/dyn_php.php';
+
+$ajaxResponse = new AjaxResponse($_POST);
+
+switch ($ajaxResponse->getMethod()) {
+  case "signin" :
+
+    if (!isset($consumerKey) || !isset($consumerSecret)) {
+      $ajaxResponse->setSuccess(false);
+      $ajaxResponse->setMessage(_mb("Element vars consumerKey and consumerSecret are not set. If you don't have them, get them from Twitter."));
+      $ajaxResponse->send();
+    }
+    $Twitter = new EpiTwitter($consumerKey, $consumerSecret);
+    $url = $Twitter->getAuthenticateUrl();
+    $ajaxResponse->setResult(array("url" => $url)); 
+    $ajaxResponse->setSuccess(true);
+    break;
+  default: 
+    $ajaxResponse->setSuccess(false);
+    $ajaxResponse->setMessage(_mb("An unknown error occured."));
+    break;
+}
+$ajaxResponse->send();
+?>

Added: trunk/mapbender/http/plugins/mb_twitter_signin.js
===================================================================
--- trunk/mapbender/http/plugins/mb_twitter_signin.js	                        (rev 0)
+++ trunk/mapbender/http/plugins/mb_twitter_signin.js	2010-01-18 20:05:48 UTC (rev 5332)
@@ -0,0 +1,22 @@
+var $this = $(this);
+Mapbender.events.init.register(function () {
+	$this.click(function () {
+		var req = new Mapbender.Ajax.Request({
+			url: "../plugins/mb_twitter.php",
+			method: "signin",
+			parameters: {
+			},
+			callback: function (obj, result, message) {
+				if (!result) {
+					alert(message);
+					return;
+				}
+				if (obj.url && typeof obj.url === "string") {
+					alert(obj.url);
+				  window.location.href = obj.url;
+				}
+			}
+		});
+		req.send();
+	});
+});

Added: trunk/mapbender/http/plugins/mb_twitter_signin.js~
===================================================================
--- trunk/mapbender/http/plugins/mb_twitter_signin.js~	                        (rev 0)
+++ trunk/mapbender/http/plugins/mb_twitter_signin.js~	2010-01-18 20:05:48 UTC (rev 5332)
@@ -0,0 +1,22 @@
+var $this = $(this);
+Mapbender.events.init.register(function () {
+	$this.click(function () {
+		var req = new Mapbender.Ajax.Request({
+			url: "../plugins/mb_twitter.php",
+			method: "signin",
+			parameters: {
+			},
+			callback: function (obj, result, message) {
+				if (!result) {
+					alert(message);
+					return;
+				}
+				if (obj.url && typeof obj.url === "string") {
+					alert(obj.url);
+//				  window.location.reload(obj.url);
+				}
+			}
+		});
+		req.send();
+	});
+});



More information about the Mapbender_commits mailing list