r7311 - in dumbhippo/trunk/server: src/com/dumbhippo/web/pages src/com/dumbhippo/web/servlets web/css3 web/jsp3



Author: marinaz
Date: 2008-02-11 18:12:05 -0600 (Mon, 11 Feb 2008)
New Revision: 7311

Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/web/pages/WhoAreYouPage.java
   dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java
   dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookSigninServlet.java
   dumbhippo/trunk/server/web/css3/who-are-you-iefixes.css
   dumbhippo/trunk/server/web/css3/who-are-you-positions.css
   dumbhippo/trunk/server/web/jsp3/who-are-you.jsp
Log:
Allow logging in to Mugshot from Facebook.

Display a link for getting logged in through Facebook on the Mugshot login page.

Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/pages/WhoAreYouPage.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/pages/WhoAreYouPage.java	2008-02-11 23:27:31 UTC (rev 7310)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/pages/WhoAreYouPage.java	2008-02-12 00:12:05 UTC (rev 7311)
@@ -37,4 +37,11 @@
 			return null;
 		}
 	}
+	
+	public String getFacebookApplicationName() {
+        String applicationName = "mugshot";
+        if (config.getBaseUrlMugshot().toExternalForm().contains("dogfood"))
+        	applicationName = "mugshot-test";
+        return applicationName;
+	}
 }

Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java	2008-02-11 23:27:31 UTC (rev 7310)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java	2008-02-12 00:12:05 UTC (rev 7311)
@@ -393,9 +393,9 @@
 					xml.closeElement();
 				}
 	
-				String floatStyle = "";
-				String labelWidth = "180";
-				String leftSideWidth = "width:490px;";
+				String floatStyle = "float:left;";
+				String labelWidth = "120";
+				String leftSideWidth = "width:430px;";
 				String categoryNameLeftMargin = "margin-left:0px;";
 				if (user.getAccount().isPublicPage()) {
 				    xml.appendTextNode("span", "Updates to the information below will be reflected in ",
@@ -406,10 +406,6 @@
 			    } else {
 				    xml.appendTextNode("span", "Fill in the information for accounts you want to display updates from.",
 			    	                   "style", "margin-left:22px;");		
-				    floatStyle="float:left;";
-				    labelWidth="120";
-				    leftSideWidth = "width:430px;";
-				    categoryNameLeftMargin = "margin-left:0px;";
 			    }
 			    ExternalAccountCategory currentCategory = null;
 			    boolean hadInitialInfo = false;
@@ -472,19 +468,27 @@
 			    xml.closeElement(); // fb:editor-buttonset
 			    xml.closeElement(); // fb:editor 		    
 			    xml.closeElement(); // div with the form
-			    
-			    if (!user.getAccount().isPublicPage()) {
-			    	xml.openElement("div", "style", "width:184px;float:left;color:#333333;background-color:#EDF2F3;border-style:solid;border-width:1px;border-color:#C2D1D4;margin-top:34px;padding:8px;");
+
+		    	xml.openElement("div", "style", "width:184px;float:left;color:#333333;background-color:#EDF2F3;border-style:solid;border-width:1px;border-color:#C2D1D4;margin-top:34px;padding:8px;");
+			    // there didn't seem to be a way to get buttons in fb:editor to open in a new window, which is what we want here, so we are using 
+			    // our own form and buttons 
+			    // original top and left border color on facebook is #D8DFEA, but it looks too light to me
+			    String buttonStyle = "background-color:#3B5998;color:#ffffff;width:184px;border-width:1px;padding-top:2px;padding-bottom:2px;margin-top:8px;margin-bottom:8px;border-top-color:#728199;border-left-color:#728199;border-right-color:#0E1F5B;border-bottom-color:#0E1F5B;";
+		    	if (user.getAccount().isPublicPage()) {
 			    	xml.openElement("span", "style", "font-weight:bold;");
+			    	xml.append("Want to log in to your Mugshot account?");
+			    	xml.closeElement();
+				    xml.append(" Following this link will log you in.");
+				    xml.openElement("form", "action", baseUrl + "/facebook-signin", "target", "_blank", "method", "GET");
+				    xml.appendEmptyNode("input", "type", "submit", "value", "Log In To My Mugshot Account", "style", buttonStyle);
+				    xml.closeElement();		
+			    } else {
+			    	xml.openElement("span", "style", "font-weight:bold;");
 			    	xml.append("Do you already have a Mugshot account?");
 			    	xml.closeElement();
 				    xml.append(" Don't fill in this stuff, just verify" +
 				    		   " your Mugshot account by following this link.");
 				    xml.openElement("form", "action", baseUrl + "/facebook-add", "target", "_blank", "method", "GET");
-				    // there didn't seem to be a way to get buttons in fb:editor to open in a new window, which is what we want here, so we are using 
-				    // our own form and buttons 
-				    // original top and left border color on facebook is #D8DFEA, but it looks too light to me
-				    String buttonStyle = "background-color:#3B5998;color:#ffffff;width:184px;border-width:1px;padding-top:2px;padding-bottom:2px;margin-top:8px;margin-bottom:8px;border-top-color:#728199;border-left-color:#728199;border-right-color:#0E1F5B;border-bottom-color:#0E1F5B;";
 				    xml.appendEmptyNode("input", "type", "submit", "value", "Verify My Mugshot Account", "style", buttonStyle);
 				    xml.closeElement();		
 				    // divider line
@@ -496,17 +500,16 @@
 				    xml.append(" It's free and easy and helps you see all your friends' activities in one place, share links, and read feeds in a social setting.");
 		            xml.openElement("form", "action", baseUrl + "/facebook-signin", "target", "_blank", "method", "GET");
 		            xml.appendEmptyNode("input", "type", "submit", "value", "Create My Mugshot Account", "style", buttonStyle);
-		            xml.closeElement();	
-			    	xml.closeElement();
+		            xml.closeElement();				    				    	
 			    }
+		    	xml.closeElement();
 	        }
 		} else {
-			if (errorMessage == null)
-				errorMessage = "We could not get an existing or create a new user.";
-			logger.error("Displaying a really bad error message on Facebook: {}", errorMessage);
-			xml.openElement("fb:error");
-			xml.appendTextNode("fb:message", "Getting Mugshot Information Failed");			
-			xml.append(errorMessage);
+			// TODO: verify that we didn't get the user information from Facebook, otherwise
+			// log an error
+			xml.openElement("fb:explanation");
+			xml.appendTextNode("fb:message", "Log in to Facebook first");			
+			xml.append("You need to be logged in to Facebook to use the Mugshot application.");
 			xml.closeElement();
 		}		
 		response.setContentType("text/html");

Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookSigninServlet.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookSigninServlet.java	2008-02-11 23:27:31 UTC (rev 7310)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookSigninServlet.java	2008-02-12 00:12:05 UTC (rev 7311)
@@ -95,24 +95,26 @@
 			    		if (sess != null)
 			    			sess.invalidate();
 			    		SigninBean.initializeAuthentication(request, response, client);
-			    		ac.getOwner().getAccount().setPublicPage(true);
-			    		String regularCountString = config.getProperty(HippoProperty.NEW_USER_INVITATION_COUNT);
-			    		int regularCount = Integer.parseInt(regularCountString);
-			    		ac.getOwner().getAccount().setInvitations(regularCount);
-			    		// set a better name for a Facebook user, since now the user can edit it, and
-			    		// we won't be needing to get it from Facebook again
-			    		if (ac.getOwner().getNickname().contains("Facebook user")) {
-				            FacebookWebServices ws = new FacebookWebServices(REQUEST_TIMEOUT, config);
-			                FacebookAccount facebookAccount = facebookTracker.getFacebookAccount(facebookUserId);                    
-			                if (facebookAccount != null) {
-			                    String name = ws.getName(facebookAccount);
-			                    if (name.trim().length() > 0) {
-			                    	name = name.trim();
-			                    	ac.getOwner().setNickname(name);
-			            		    DataService.currentSessionRW().changed(UserDMO.class, ac.getOwner().getGuid(), "name");
-			            		    revisionControl.persistRevision(new UserNameChangedRevision(ac.getOwner(), new Date(), name));
-			                    }
-			                }		    		
+			    		if (!ac.getOwner().getAccount().isPublicPage()) {
+				    		ac.getOwner().getAccount().setPublicPage(true);
+				    		String regularCountString = config.getProperty(HippoProperty.NEW_USER_INVITATION_COUNT);
+				    		int regularCount = Integer.parseInt(regularCountString);
+				    		ac.getOwner().getAccount().setInvitations(regularCount);
+				    		// set a better name for a Facebook user, since now the user can edit it, and
+				    		// we won't be needing to get it from Facebook again
+				    		if (ac.getOwner().getNickname().contains("Facebook user")) {
+					            FacebookWebServices ws = new FacebookWebServices(REQUEST_TIMEOUT, config);
+				                FacebookAccount facebookAccount = facebookTracker.getFacebookAccount(facebookUserId);                    
+				                if (facebookAccount != null) {
+				                    String name = ws.getName(facebookAccount);
+				                    if (name.trim().length() > 0) {
+				                    	name = name.trim();
+				                    	ac.getOwner().setNickname(name);
+				            		    DataService.currentSessionRW().changed(UserDMO.class, ac.getOwner().getGuid(), "name");
+				            		    revisionControl.persistRevision(new UserNameChangedRevision(ac.getOwner(), new Date(), name));
+				                    }
+				                }		    		
+				    		}
 			    		}
 			    		return redirectToNextPage(request, response, "/account", null);
 			        } else {

Modified: dumbhippo/trunk/server/web/css3/who-are-you-iefixes.css
===================================================================
--- dumbhippo/trunk/server/web/css3/who-are-you-iefixes.css	2008-02-11 23:27:31 UTC (rev 7310)
+++ dumbhippo/trunk/server/web/css3/who-are-you-iefixes.css	2008-02-12 00:12:05 UTC (rev 7311)
@@ -1,5 +1,9 @@
 @CHARSET "UTF-8";
 
+#dhLoginForm {
+	width:        370px;	
+}	
+
 #dhPasswordHelp {
 	margin-right: 10px;
 }
\ No newline at end of file

Modified: dumbhippo/trunk/server/web/css3/who-are-you-positions.css
===================================================================
--- dumbhippo/trunk/server/web/css3/who-are-you-positions.css	2008-02-11 23:27:31 UTC (rev 7310)
+++ dumbhippo/trunk/server/web/css3/who-are-you-positions.css	2008-02-12 00:12:05 UTC (rev 7311)
@@ -7,7 +7,7 @@
 
 #dhLoginForm {
     position:           relative;
-	width:				310px;	
+	width:				350px;	
 	border:				1px solid #cccccc;
 	margin-top:         20px;
 	margin-bottom:      5px;   

Modified: dumbhippo/trunk/server/web/jsp3/who-are-you.jsp
===================================================================
--- dumbhippo/trunk/server/web/jsp3/who-are-you.jsp	2008-02-11 23:27:31 UTC (rev 7310)
+++ dumbhippo/trunk/server/web/jsp3/who-are-you.jsp	2008-02-12 00:12:05 UTC (rev 7311)
@@ -41,7 +41,8 @@
 	        <div>
 		        <c:if test="${!empty whoareyou.aimBotScreenName}">
 			        <%-- c:if on one line here to avoid weird link text spacing --%>
-		            <a href="aim:GoIM?screenname=${whoareyou.aimBotScreenName}&message=Hey+Bot!+Send+me+a+login+link!"><c:if test="${!empty whoareyou.aimPresenceKey}"><img src="http://api.oscar.aol.com/SOA/key=${whoareyou.aimPresenceKey}/presence/${whoareyou.aimBotScreenName}"; border="0"/> </c:if>AIM log in</a> |
+		            <a href="aim:GoIM?screenname=${whoareyou.aimBotScreenName}&message=Hey+Bot!+Send+me+a+login+link!" title="Get a log in link via AIM if you have already added AIM to your Mugshot account"><c:if test="${!empty whoareyou.aimPresenceKey}"><img src="http://api.oscar.aol.com/SOA/key=${whoareyou.aimPresenceKey}/presence/${whoareyou.aimBotScreenName}"; border="0" style="vertical-align: text-bottom;"/> </c:if>AIM log in</a> |
+		            <a href="http://apps.facebook.com/${whoareyou.facebookApplicationName}"; title="Log in through Facebook if you have already added Facebook to your Mugshot account"><dh:png src="images3/${buildStamp}/favicon_facebook.png" style="width: 16; height: 16; vertical-align: text-bottom;"/> Facebook log in</a> |
 	            </c:if>
 		        <a id="dhLoginTogglePasswordLink" href="javascript:dh.login.togglePasswordBox()"><%-- filled in by javascript --%></a>&nbsp; [alt-p]
 	        </div>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]