r7523 - in dumbhippo/trunk/server: src/com/dumbhippo/server/views src/com/dumbhippo/web/pages web web/jsp-gnome web/tags/3 web/tags/gnome



Author: marinaz
Date: 2008-11-23 22:43:24 -0600 (Sun, 23 Nov 2008)
New Revision: 7523

Added:
   dumbhippo/trunk/server/src/com/dumbhippo/web/pages/OnlineAccountTypesPage.java
   dumbhippo/trunk/server/web/jsp-gnome/account-type.jsp
   dumbhippo/trunk/server/web/tags/gnome/accountTypeForm.tag
Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/server/views/OnlineAccountTypeView.java
   dumbhippo/trunk/server/web/jsp-gnome/account-type-add.jsp
   dumbhippo/trunk/server/web/jsp-gnome/account-types.jsp
   dumbhippo/trunk/server/web/servlet-info.xml
   dumbhippo/trunk/server/web/tags/3/applicationEditRow.tag
Log:
Allow viewing a list of account types and information about a particular account type.


Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/views/OnlineAccountTypeView.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/views/OnlineAccountTypeView.java	2008-11-03 21:31:39 UTC (rev 7522)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/views/OnlineAccountTypeView.java	2008-11-24 04:43:24 UTC (rev 7523)
@@ -10,6 +10,10 @@
     	this.onlineAccountType = onlineAccountType;
     }
     
+    public OnlineAccountType getOnlineAccountType() {
+    	return onlineAccountType;
+    }
+    
 	/**
 	 *  we are not using lang at the moment
 	 */

Added: dumbhippo/trunk/server/src/com/dumbhippo/web/pages/OnlineAccountTypesPage.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/pages/OnlineAccountTypesPage.java	2008-11-03 21:31:39 UTC (rev 7522)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/pages/OnlineAccountTypesPage.java	2008-11-24 04:43:24 UTC (rev 7523)
@@ -0,0 +1,62 @@
+package com.dumbhippo.web.pages;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.dumbhippo.SortUtils;
+import com.dumbhippo.persistence.OnlineAccountType;
+import com.dumbhippo.server.ExternalAccountSystem;
+import com.dumbhippo.server.HumanVisibleException;
+import com.dumbhippo.server.NotFoundException;
+import com.dumbhippo.server.views.OnlineAccountTypeView;
+import com.dumbhippo.web.ListBean;
+import com.dumbhippo.web.WebEJBUtil;
+
+public class OnlineAccountTypesPage extends AbstractSigninOptionalPage {
+	private ListBean<OnlineAccountTypeView> accountTypesListBean;
+	private OnlineAccountTypeView onlineAccountTypeView;
+	private boolean accountTypeNameValid;
+	
+	private ExternalAccountSystem externalAccounts;
+	
+	public OnlineAccountTypesPage() {
+		externalAccounts = WebEJBUtil.defaultLookup(ExternalAccountSystem.class);
+		accountTypesListBean = null;
+		onlineAccountTypeView = null;
+		accountTypeNameValid = true;
+	}
+	
+    public void setAccountTypeName(String accountTypeName) throws HumanVisibleException {
+    	try {
+    	    onlineAccountTypeView = new OnlineAccountTypeView(externalAccounts.lookupOnlineAccountTypeForName(accountTypeName));	
+    	} catch (NotFoundException e) {
+    		accountTypeNameValid = false;
+    	}
+    }
+    
+    public OnlineAccountTypeView getOnlineAccountType() {
+    	return onlineAccountTypeView;
+    }
+    
+    public boolean isAccountTypeNameValid() {
+    	return accountTypeNameValid;
+    }
+	
+	public ListBean<OnlineAccountTypeView> getAllOnlineAccountTypes() {
+		if (accountTypesListBean != null) {
+			return accountTypesListBean;
+		}
+			
+		List<OnlineAccountTypeView> allTypeViews = new ArrayList<OnlineAccountTypeView>(); 
+		List<OnlineAccountType> allTypes = externalAccounts.getAllOnlineAccountTypes();
+		List<OnlineAccountType> alphabetizedTypes =
+			SortUtils.sortCollection(allTypes.toArray(new OnlineAccountType[allTypes.size()]), "getFullName");
+		
+		for (OnlineAccountType type : alphabetizedTypes) {
+		    allTypeViews.add(new OnlineAccountTypeView(type));
+		}
+		
+		accountTypesListBean = new ListBean<OnlineAccountTypeView>(allTypeViews);
+		return accountTypesListBean;
+	}
+}

Modified: dumbhippo/trunk/server/web/jsp-gnome/account-type-add.jsp
===================================================================
--- dumbhippo/trunk/server/web/jsp-gnome/account-type-add.jsp	2008-11-03 21:31:39 UTC (rev 7522)
+++ dumbhippo/trunk/server/web/jsp-gnome/account-type-add.jsp	2008-11-24 04:43:24 UTC (rev 7523)
@@ -10,13 +10,8 @@
 	<title>Add Account Type</title>
 	<gnome:stylesheet name="site" iefixes="true"/>	
 	<gnome:stylesheet name="account-types"/>	
-	<dh:script modules="dh.actions,dh.textinput,dh.util"/>	
+	<dh:script modules="dh.textinput,dh.util"/>	
 	<script type="text/javascript">
-	    function dhLowerCaseAccountTypeName() {
-            name = document.getElementById("dhAccountTypeName").value;
-            document.getElementById("dhAccountTypeName").value=name.toLowerCase();
-        }	
-        
 	    function dhOnLoad() {
 	        siteName = document.getElementById('dhAccountTypeSiteName');
 	        userInfoType = document.getElementById('dhUserInfoType');	    
@@ -37,56 +32,6 @@
 			<a href="/account-types">View existing types</a>
 		</div>
 	    <hr>
-	    <div id="dhMessage">
-	    </div>
-	    <div>
-		    <h3>Account Type Information</h3>
-		    <table class="dh-application-edit">
-		        <dht3:applicationEditRow id="dhAccountTypeName" name="name" label="Name" onkeyup="dhLowerCaseAccountTypeName()">
-		    		<jsp:attribute name="help">
-		    			A short name uniquely identifying the account type. Can only contain lower-case letters and underscores. (e.g. twitter, remember_the_milk, google_reader_rss)
-		    		</jsp:attribute>
-		    	</dht3:applicationEditRow>
-		    	<dht3:applicationEditRow id="dhAccountTypeFullName" name="fullName" label="Full Name">
-		    		<jsp:attribute name="help">
-		    			A full name for the account type. (e.g. Twitter, Remember the Milk, Netflix RSS Feed)
-		    		</jsp:attribute>
-		    	</dht3:applicationEditRow>
-		    	<dht3:applicationEditRow id="dhAccountTypeSiteName" name="siteName" label="Site Name">
-		    		<jsp:attribute name="help">
-		    			The name of the web site where the user can get this account type. (e.g. Twitter, Remember the Milk)
-		    		</jsp:attribute>
-		    	</dht3:applicationEditRow>
-		    	<dht3:applicationEditRow id="dhAccountTypeSite" name="site" label="Site">
-		    		<jsp:attribute name="help">
-						The url of the web site where the user can get this account type. (e.g. twitter.com, rememberthemilk.com)
-		    		</jsp:attribute>
-		    	</dht3:applicationEditRow>
-		    	<dht3:applicationEditRow id="dhUserInfoType" name="userInfoType" label="User Info Type">
-		    		<jsp:attribute name="help">
-						What is the type of user information being requested. (e.g. Twitter username, e-mail used for Flickr, Rhapsody "Recently Played Tracks" RSS feed URL)
-		    		</jsp:attribute>
-		    	</dht3:applicationEditRow>	    	
-		    	<tr>
-	    			<td class="dh-application-edit-label">
-	    			    Public:
-	    			</td>
-	    			<td>
-	    			    <input type="radio" name="dhAccountTypeStatus" id="dhAccountTypePublic"> <label for="dhAccountTypePublic">Yes</label>
-					    <input type="radio" name="dhAccountTypeStatus" id="dhAccountTypePrivate"  checked="true"> <label for="dhAccountTypePrivate">No</label>		
-	    			</td>
-	    		</tr>
-	    		<tr>
-		            <td></td>
-		            <td class="dh-application-edit-help">
-			            Should this account type be listed on online.gnome.org or are desktop features for it still under development.       
-		            </td>
-	            </tr>		   	    				    		
-		    	<tr>		    	
-		    		<td></td>
-		    		<td><input type="button" value="Save" onclick="dh.actions.createAccountType()"></input></td>
-		    	</tr>
-		    </table>
-	    </div>
+         <gnome:accountTypeForm allowEdit="true"/> 
 	</gnome:page>
 </body>
\ No newline at end of file

Added: dumbhippo/trunk/server/web/jsp-gnome/account-type.jsp
===================================================================
--- dumbhippo/trunk/server/web/jsp-gnome/account-type.jsp	2008-11-03 21:31:39 UTC (rev 7522)
+++ dumbhippo/trunk/server/web/jsp-gnome/account-type.jsp	2008-11-24 04:43:24 UTC (rev 7523)
@@ -0,0 +1,30 @@
+<html>
+<%@ page pageEncoding="UTF-8" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
+<%@ taglib uri="/jsp/dumbhippo.tld" prefix="dh" %>
+<%@ taglib tagdir="/WEB-INF/tags/2" prefix="dht" %>
+<%@ taglib tagdir="/WEB-INF/tags/gnome" prefix="gnome" %>
+
+<dh:bean id="accountTypes" class="com.dumbhippo.web.pages.OnlineAccountTypesPage" scope="request"/>
+<jsp:setProperty name="accountTypes" property="accountTypeName" param="type"/>
+
+<c:if test="${!accountTypes.accountTypeNameValid}">
+	<dht:errorPage>Account with type name '<c:out value="${param['type']}"/>' does not exist.</dht:errorPage>
+</c:if>
+
+<head>
+	<title>Add Account Type</title>
+	<gnome:stylesheet name="site" iefixes="true"/>	
+	<gnome:stylesheet name="account-types"/>	
+	<dh:script modules="dh.actions"/>	      
+</head>
+
+<gnome:page currentPageLink="account-type">
+		<div class="dh-page-shinybox-title-large">View Account Type</div>
+		<div>
+   			This page allows you to view information about an online account type.
+		</div>
+	    <hr>
+	    <gnome:accountTypeForm accountTypeView="${accountTypes.onlineAccountType}" allowEdit="false"/> 
+	</gnome:page>
+</body>
\ No newline at end of file

Modified: dumbhippo/trunk/server/web/jsp-gnome/account-types.jsp
===================================================================
--- dumbhippo/trunk/server/web/jsp-gnome/account-types.jsp	2008-11-03 21:31:39 UTC (rev 7522)
+++ dumbhippo/trunk/server/web/jsp-gnome/account-types.jsp	2008-11-24 04:43:24 UTC (rev 7523)
@@ -6,6 +6,8 @@
 <%@ taglib tagdir="/WEB-INF/tags/3" prefix="dht3" %>
 <%@ taglib tagdir="/WEB-INF/tags/gnome" prefix="gnome" %>
 
+<dh:bean id="accountTypes" class="com.dumbhippo.web.pages.OnlineAccountTypesPage" scope="request"/>
+
 <head>
 	<title>Existing Account Types</title>
 	<gnome:stylesheet name="site" iefixes="true"/>	
@@ -16,11 +18,13 @@
 	    <h3>Existing Account Types</h3>
    		<div class="gnome-learn-more-text">
 		    <p>		    
-		      	This page is coming soon. Please use online-desktop-list gnome org mailing list 
-		      	or irc.gnome.org #online-desktop channel to check if the type you want to create
-		      	already exists or ask to modify the type you already created.
+		      Click on the account type to view or edit information about it.	
 		    </p>
         </div> 
+        <hr>
+        <c:forEach items="${accountTypes.allOnlineAccountTypes.list}" var="accountType">
+		    <div><a href="/account-type?type=${accountType.onlineAccountType.name}"><c:out value="${accountType.onlineAccountType.fullName}"/></a></div>
+		</c:forEach>
 	</gnome:page>
 </body>
 </html>
\ No newline at end of file

Modified: dumbhippo/trunk/server/web/servlet-info.xml
===================================================================
--- dumbhippo/trunk/server/web/servlet-info.xml	2008-11-03 21:31:39 UTC (rev 7522)
+++ dumbhippo/trunk/server/web/servlet-info.xml	2008-11-24 04:43:24 UTC (rev 7523)
@@ -311,7 +311,7 @@
            they are listed below for completeness -->
       <init-param>
           <param-name>noSignin</param-name>
-          <param-value>accounts-learnmore,apple-dashboard-content,application,applications,applications-learnmore,badges,busy,buttons,comingsoon,error,facebook-welcome,files,flash,google-stacker,google-stacker-spec,google-stacker-content,group-files,licenses,mugshot-eula,public-groups,radar-theme,sharelink,sharelink-inactive,signup,summit,tour,unknownlink,upgrade,user-summary,who-are-you,robots.txt,trademark</param-value>
+          <param-value>account-type,account-types,accounts-learnmore,apple-dashboard-content,application,applications,applications-learnmore,badges,busy,buttons,comingsoon,error,facebook-welcome,files,flash,google-stacker,google-stacker-spec,google-stacker-content,group-files,licenses,mugshot-eula,public-groups,radar-theme,sharelink,sharelink-inactive,signup,summit,tour,unknownlink,upgrade,user-summary,who-are-you,robots.txt,trademark</param-value>
       </init-param>
       <init-param>
           <param-name>requiresSigninStealth</param-name>
@@ -319,7 +319,7 @@
       </init-param>
       <init-param>
           <param-name>requiresSignin</param-name>
-          <param-value>account,admin,account-type-add,account-types,application-edit,application-history,chatwindow,chatwindow-disabled,create-group,download,friends,getradar,group-account,group-invitation,group-invitations,home,invitation,invitation-admin,network,network-overview,radar-theme-creator,statistics</param-value>
+          <param-value>account,admin,account-type-add,application-edit,application-history,chatwindow,chatwindow-disabled,create-group,download,friends,getradar,group-account,group-invitation,group-invitations,home,invitation,invitation-admin,network,network-overview,radar-theme-creator,statistics</param-value>
       </init-param>
       <load-on-startup>1</load-on-startup>
    </servlet>   

Modified: dumbhippo/trunk/server/web/tags/3/applicationEditRow.tag
===================================================================
--- dumbhippo/trunk/server/web/tags/3/applicationEditRow.tag	2008-11-03 21:31:39 UTC (rev 7522)
+++ dumbhippo/trunk/server/web/tags/3/applicationEditRow.tag	2008-11-24 04:43:24 UTC (rev 7523)
@@ -13,6 +13,7 @@
 <%@ attribute name="help" required="false" fragment="true"%>
 <%@ attribute name="contents" required="false" fragment="true"%>
 <%@ attribute name="multiline" required="false" type="java.lang.Boolean"%>
+<%@ attribute name="disabled" required="false" type="java.lang.Boolean"%>
 
 <tr class="${rowClass}">
 	<td class="dh-application-edit-label">
@@ -24,16 +25,32 @@
 				<jsp:invoke fragment="contents"/>
 			</c:when>
 			<c:when test="${multiline}">
-			    <textarea id="${id}" name="${name}" onchange="${onchange}"><c:out value="${value}"/></textarea>
+			    <textarea id="${id}" name="${name}" onchange="${onchange} disabled="${disabled}"><c:out value="${value}"/></textarea>
 			</c:when>
 			<c:otherwise>
-			    <jsp:element name="input">
-				    <jsp:attribute name="id">${id}</jsp:attribute>
-				    <jsp:attribute name="name">${name}</jsp:attribute>
-				    <jsp:attribute name="value"><c:out value="${value}"/></jsp:attribute>
-				    <jsp:attribute name="onchange">${onchange}</jsp:attribute>
-				    <jsp:attribute name="onkeyup">${onkeyup}</jsp:attribute>
-			    </jsp:element>
+			    <%-- since it doesn't appear to be possible to have a conditional inside a jsp:element, we must have --%>
+			    <%-- conditional around the whole jsp:element block --%> 
+			    <c:choose>
+			        <c:when test="${(!empty disabled) && disabled}">
+			            <jsp:element name="input">
+				            <jsp:attribute name="id">${id}</jsp:attribute>
+				            <jsp:attribute name="name">${name}</jsp:attribute>
+				            <jsp:attribute name="value"><c:out value="${value}"/></jsp:attribute>
+				            <jsp:attribute name="onchange">${onchange}</jsp:attribute>
+				            <jsp:attribute name="onkeyup">${onkeyup}</jsp:attribute>
+				            <jsp:attribute name="disabled"/>
+			            </jsp:element>
+				    </c:when>        
+                    <c:otherwise>
+			            <jsp:element name="input">
+				            <jsp:attribute name="id">${id}</jsp:attribute>
+				            <jsp:attribute name="name">${name}</jsp:attribute>
+				            <jsp:attribute name="value"><c:out value="${value}"/></jsp:attribute>
+				            <jsp:attribute name="onchange">${onchange}</jsp:attribute>
+				            <jsp:attribute name="onkeyup">${onkeyup}</jsp:attribute>
+			            </jsp:element>                    
+                    </c:otherwise>
+                </c:choose>    
 			</c:otherwise>
 		</c:choose>
 	</td>

Added: dumbhippo/trunk/server/web/tags/gnome/accountTypeForm.tag
===================================================================
--- dumbhippo/trunk/server/web/tags/gnome/accountTypeForm.tag	2008-11-03 21:31:39 UTC (rev 7522)
+++ dumbhippo/trunk/server/web/tags/gnome/accountTypeForm.tag	2008-11-24 04:43:24 UTC (rev 7523)
@@ -0,0 +1,99 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
+<%@ taglib uri="/jsp/dumbhippo.tld" prefix="dh" %>
+<%@ taglib tagdir="/WEB-INF/tags/2" prefix="dht" %>
+<%@ taglib tagdir="/WEB-INF/tags/3" prefix="dht3" %>
+
+<%@ attribute name="accountTypeView" required="false" type="com.dumbhippo.server.views.OnlineAccountTypeView" %>
+<%@ attribute name="allowEdit" required="true" type="java.lang.Boolean" %>
+
+<c:if test="${(accountTypeView == null) && !allowEdit}">
+	<%-- the user should never see this error message, but we should check to make sure this tag is used correctly --%>
+	<dht:errorPage>Have to either submit an account type to view or allow editing for adding a new account type.</dht:errorPage>
+</c:if>
+
+<dh:script modules="dh.actions"/>	
+
+<script type="text/javascript">
+	    function dhLowerCaseAccountTypeName() {
+            name = document.getElementById("dhAccountTypeName").value;
+            document.getElementById("dhAccountTypeName").value=name.toLowerCase();
+        }	
+</script>
+        
+<c:set var="name" value=""/>
+<c:set var="fullName" value=""/>
+<c:set var="siteName" value=""/>
+<c:set var="site" value=""/>
+<c:set var="userInfoType" value=""/>    
+<c:set var="isPublic" value="false"/>  
+<c:set var="disabledAttr" value=""/>
+<c:if test="${accountTypeView != null}">
+    <c:set var="name" value="${accountTypeView.onlineAccountType.name}"/>
+    <c:set var="fullName" value="${accountTypeView.onlineAccountType.fullName}"/>
+    <c:set var="siteName" value="${accountTypeView.onlineAccountType.siteName}"/>
+    <c:set var="site" value="${accountTypeView.onlineAccountType.site}"/>
+    <c:set var="userInfoType" value="${accountTypeView.onlineAccountType.userInfoType}"/>    
+    <c:set var="isPublic" value="${accountTypeView.onlineAccountType.supported}"/> 
+    <%-- TODO: change this once we allow editing of existing accounts--%>
+    <c:set var="disabledAttr" value="disabled"/> 
+</c:if>
+
+<div>
+    <h3>Account Type Information</h3>
+	<table class="dh-application-edit">
+        <dht3:applicationEditRow id="dhAccountTypeName" disabled="${accountTypeView != null}" name="name" label="Name" value="${name}" onkeyup="dhLowerCaseAccountTypeName()">
+		    <jsp:attribute name="help">
+		        A short name uniquely identifying the account type. Can only contain lower-case letters and underscores. (e.g. twitter, remember_the_milk, google_reader_rss)
+		    </jsp:attribute>
+		</dht3:applicationEditRow>
+		<dht3:applicationEditRow id="dhAccountTypeFullName" disabled="${accountTypeView != null}" name="fullName" label="Full Name" value="${fullName}">
+		    <jsp:attribute name="help">
+		        A full name for the account type. (e.g. Twitter, Remember the Milk, Netflix RSS Feed)
+		    </jsp:attribute>
+		</dht3:applicationEditRow>
+		<dht3:applicationEditRow id="dhAccountTypeSiteName" disabled="${accountTypeView != null}" name="siteName" label="Site Name" value="${siteName}">
+		    <jsp:attribute name="help">
+		    	The name of the web site where the user can get this account type. (e.g. Twitter, Remember the Milk)
+		    </jsp:attribute>
+		</dht3:applicationEditRow>
+		<dht3:applicationEditRow id="dhAccountTypeSite" disabled="${accountTypeView != null}" name="site" label="Site" value="${site}">
+		    <jsp:attribute name="help">
+	            The url of the web site where the user can get this account type. (e.g. twitter.com, rememberthemilk.com)
+		    </jsp:attribute>
+		</dht3:applicationEditRow>
+		<dht3:applicationEditRow id="dhUserInfoType" disabled="${accountTypeView != null}" name="userInfoType" label="User Info Type" value="${userInfoType}">
+		    <jsp:attribute name="help">
+			    What is the type of user information being requested. (e.g. Twitter username, e-mail used for Flickr, Rhapsody "Recently Played Tracks" RSS feed URL)
+		    </jsp:attribute>
+		</dht3:applicationEditRow>	    	
+		<tr>
+	        <td class="dh-application-edit-label">
+	    	    Public:
+	    	</td>
+	        <td>
+	    	    <input type="radio" ${disabledAttr} name="dhAccountTypeStatus" id="dhAccountTypePublic" checked="${isPublic}"> <label for="dhAccountTypePublic">Yes</label>
+			    <input type="radio" ${disabledAttr} name="dhAccountTypeStatus" id="dhAccountTypePrivate"  checked="${!isPublic}"> <label for="dhAccountTypePrivate">No</label>		
+	    	</td>
+	    </tr>
+	    <tr>
+		    <td></td>
+		    <td class="dh-application-edit-help">
+			    Should this account type be listed on online.gnome.org or are desktop features for it still under development.       
+		    </td>
+	    </tr>		   	    				    		
+		<tr>		    	
+		    <td></td>
+		    <td>
+		        <c:choose>
+		            <c:when test="${accountTypeView == null}">
+		                <input type="button" value="Save" onclick="dh.actions.createAccountType()"></input>
+		            </c:when>
+		            <c:when test="${allowEdit}">
+		                <%-- TODO: implement this--%>
+		                <%-- <input type="button" value="Save Changes" onclick="dh.actions.updateAccountType()"></input> --%>
+		            </c:when>
+		        </c:choose>
+		    </td>        
+		</tr>
+    </table>
+</div>
\ No newline at end of file



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