r7524 - in dumbhippo/trunk/server: src/com/dumbhippo/server src/com/dumbhippo/server/impl src/com/dumbhippo/web/pages web/css-gnome web/javascript/dh web/jsp-gnome web/tags/gnome
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r7524 - in dumbhippo/trunk/server: src/com/dumbhippo/server src/com/dumbhippo/server/impl src/com/dumbhippo/web/pages web/css-gnome web/javascript/dh web/jsp-gnome web/tags/gnome
- Date: Mon, 24 Nov 2008 16:08:15 -0600 (CST)
Author: marinaz
Date: 2008-11-24 16:08:14 -0600 (Mon, 24 Nov 2008)
New Revision: 7524
Modified:
dumbhippo/trunk/server/src/com/dumbhippo/server/ExternalAccountSystem.java
dumbhippo/trunk/server/src/com/dumbhippo/server/HttpMethods.java
dumbhippo/trunk/server/src/com/dumbhippo/server/impl/ExternalAccountSystemBean.java
dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java
dumbhippo/trunk/server/src/com/dumbhippo/web/pages/OnlineAccountTypesPage.java
dumbhippo/trunk/server/web/css-gnome/account-types.css
dumbhippo/trunk/server/web/javascript/dh/actions.js
dumbhippo/trunk/server/web/jsp-gnome/account-type-add.jsp
dumbhippo/trunk/server/web/jsp-gnome/account-type.jsp
dumbhippo/trunk/server/web/jsp-gnome/account-types.jsp
dumbhippo/trunk/server/web/jsp-gnome/accounts-learnmore.jsp
dumbhippo/trunk/server/web/jsp-gnome/application-edit.jsp
dumbhippo/trunk/server/web/jsp-gnome/application-history.jsp
dumbhippo/trunk/server/web/jsp-gnome/application.jsp
dumbhippo/trunk/server/web/jsp-gnome/applications.jsp
dumbhippo/trunk/server/web/tags/gnome/accountTypeForm.tag
Log:
Allow editing account type information by account type creators or administrators. Allow removing an account type if no accounts of this type have been created.
Add actions.js module to several jsp files to ensure that Log In/Log Out links on these pages work.
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/ExternalAccountSystem.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/ExternalAccountSystem.java 2008-11-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/ExternalAccountSystem.java 2008-11-24 22:08:14 UTC (rev 7524)
@@ -117,4 +117,9 @@
public List<OnlineAccountType> lookupOnlineAccountTypesForSite(String siteUrl);
public OnlineAccountType createOnlineAccountType(UserViewpoint viewpoint, String name, String fullName, String siteName, String siteUrl, String userInfoType) throws ValidationException;
+
+ public long getNumberOfOnlineAccountsForType(Viewpoint viewpoint, OnlineAccountType onlineAccountType);
+
+ public void removeOnlineAccountType(Viewpoint viewpoint, OnlineAccountType onlineAccountType) throws IllegalArgumentException;
+
}
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/HttpMethods.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/HttpMethods.java 2008-11-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/HttpMethods.java 2008-11-24 22:08:14 UTC (rev 7524)
@@ -489,4 +489,14 @@
@HttpParams( { "name", "fullName", "siteName", "site", "userInfoType", "isSupported" })
public void doCreateAccountType(XmlBuilder xml, UserViewpoint viewpoint, String name, String fullName, String siteName, String site, String userInfoType, boolean isSupported)
throws XmlMethodException;
+
+ @HttpContentTypes(HttpResponseData.XMLMETHOD)
+ @HttpParams( { "name", "fullName", "siteName", "site", "userInfoType", "isSupported" })
+ public void doUpdateAccountType(XmlBuilder xml, UserViewpoint viewpoint, String name, String fullName, String siteName, String site, String userInfoType, boolean isSupported)
+ throws XmlMethodException;
+
+ @HttpContentTypes(HttpResponseData.XMLMETHOD)
+ @HttpParams( { "name" })
+ public void doRemoveAccountType(XmlBuilder xml, UserViewpoint viewpoint, String name)
+ throws XmlMethodException;
}
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/ExternalAccountSystemBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/ExternalAccountSystemBean.java 2008-11-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/ExternalAccountSystemBean.java 2008-11-24 22:08:14 UTC (rev 7524)
@@ -240,6 +240,24 @@
return type;
}
+ public long getNumberOfOnlineAccountsForType(Viewpoint viewpoint, OnlineAccountType onlineAccountType) {
+ Query q = em.createQuery("SELECT COUNT(e) FROM ExternalAccount e WHERE " +
+ "e.onlineAccountType = :onlineAccountType");
+ q.setParameter("onlineAccountType", onlineAccountType);
+ Number num = (Number) q.getSingleResult();
+ return num.longValue();
+ }
+
+ public void removeOnlineAccountType(Viewpoint viewpoint, OnlineAccountType onlineAccountType) throws IllegalArgumentException {
+ // ideally, we would allow removing an account type if all the accounts of this type have sentiment indifferent,
+ // but this would involve removing the accounts as well, and everything that relates to them
+ if (getNumberOfOnlineAccountsForType(viewpoint, onlineAccountType) == 0) {
+ em.remove(onlineAccountType);
+ } else {
+ throw new IllegalArgumentException("There are online accounts that have this type, so the tyoe can't be removed.");
+ }
+ }
+
public Set<ExternalAccountView> getExternalAccountViews(Viewpoint viewpoint, User user) {
// Right now we ignore the viewpoint, so this method is pretty pointless.
// but if people use it, future code will work properly.
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java 2008-11-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java 2008-11-24 22:08:14 UTC (rev 7524)
@@ -2766,7 +2766,7 @@
}
if (userInfoType.trim().length() == 0)
- throw new XmlMethodException(XmlMethodErrorCode.INVALID_ARGUMENT, "Account type with this full name already exists.");
+ throw new XmlMethodException(XmlMethodErrorCode.INVALID_ARGUMENT, "Account type must have a user info type specified.");
// TODO: create a warning if account types for this site already exist
// List<OnlineAccountType> accountTypes = externalAccountSystem.lookupOnlineAccountTypesForSite(site);
@@ -2777,4 +2777,59 @@
throw new XmlMethodException(XmlMethodErrorCode.INVALID_ARGUMENT, e.getMessage());
}
}
+
+ public void doUpdateAccountType(XmlBuilder xml, UserViewpoint viewpoint, String name, String fullName, String siteName, String site, String userInfoType, boolean isSupported)
+ throws XmlMethodException {
+
+ OnlineAccountType onlineAccountType = null;
+ try {
+ onlineAccountType = externalAccountSystem.lookupOnlineAccountTypeForName(name);
+ } catch (NotFoundException e) {
+ throw new XmlMethodException(XmlMethodErrorCode.INVALID_ARGUMENT, "Account type with name " + name + " does not exist.");
+ }
+
+ try {
+ OnlineAccountType onlineAccountTypeWithFullName = externalAccountSystem.lookupOnlineAccountTypeForFullName(fullName);
+ if (!onlineAccountType.equals(onlineAccountTypeWithFullName)) {
+ throw new XmlMethodException(XmlMethodErrorCode.INVALID_ARGUMENT, "Another account type with this full name already exists.");
+ }
+ } catch (NotFoundException e) {
+ // nothing to do
+ }
+
+ try {
+ OnlineAccountType onlineAccountTypeWithUserInfoType = externalAccountSystem.lookupOnlineAccountTypeForUserInfoType(userInfoType);
+ if (!onlineAccountType.equals(onlineAccountTypeWithUserInfoType)) {
+ throw new XmlMethodException(XmlMethodErrorCode.INVALID_ARGUMENT, "Another account type with this user info type already exists.");
+ }
+ } catch (NotFoundException e) {
+ // nothing to do
+ }
+
+ if (userInfoType.trim().length() == 0)
+ throw new XmlMethodException(XmlMethodErrorCode.INVALID_ARGUMENT, "Account type must have a user info type specified.");
+
+ try {
+ onlineAccountType.setFullName(fullName);
+ onlineAccountType.setSiteName(siteName);
+ onlineAccountType.setSite(site);
+ onlineAccountType.setUserInfoType(userInfoType);
+ onlineAccountType.setSupported(isSupported);
+ } catch (ValidationException e) {
+ throw new XmlMethodException(XmlMethodErrorCode.INVALID_ARGUMENT, e.getMessage());
+ }
+ }
+
+ public void doRemoveAccountType(XmlBuilder xml, UserViewpoint viewpoint, String name)
+ throws XmlMethodException {
+
+ try {
+ OnlineAccountType onlineAccountType = externalAccountSystem.lookupOnlineAccountTypeForName(name);
+ externalAccountSystem.removeOnlineAccountType(viewpoint, onlineAccountType);
+ } catch (NotFoundException e) {
+ throw new XmlMethodException(XmlMethodErrorCode.INVALID_ARGUMENT, "Account type with name " + name + " does not exist.");
+ } catch (IllegalArgumentException e) {
+ throw new XmlMethodException(XmlMethodErrorCode.INVALID_ARGUMENT, e.getMessage());
+ }
+ }
}
Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/pages/OnlineAccountTypesPage.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/pages/OnlineAccountTypesPage.java 2008-11-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/pages/OnlineAccountTypesPage.java 2008-11-24 22:08:14 UTC (rev 7524)
@@ -7,8 +7,10 @@
import com.dumbhippo.persistence.OnlineAccountType;
import com.dumbhippo.server.ExternalAccountSystem;
import com.dumbhippo.server.HumanVisibleException;
+import com.dumbhippo.server.IdentitySpider;
import com.dumbhippo.server.NotFoundException;
import com.dumbhippo.server.views.OnlineAccountTypeView;
+import com.dumbhippo.server.views.UserViewpoint;
import com.dumbhippo.web.ListBean;
import com.dumbhippo.web.WebEJBUtil;
@@ -16,19 +18,35 @@
private ListBean<OnlineAccountTypeView> accountTypesListBean;
private OnlineAccountTypeView onlineAccountTypeView;
private boolean accountTypeNameValid;
+ private boolean allowEdit;
+ private boolean allowRemoval;
private ExternalAccountSystem externalAccounts;
+ private IdentitySpider identitySpider;
+
public OnlineAccountTypesPage() {
externalAccounts = WebEJBUtil.defaultLookup(ExternalAccountSystem.class);
+ identitySpider = WebEJBUtil.defaultLookup(IdentitySpider.class);
accountTypesListBean = null;
onlineAccountTypeView = null;
accountTypeNameValid = true;
+ allowEdit = false;
+ allowRemoval = false;
}
public void setAccountTypeName(String accountTypeName) throws HumanVisibleException {
try {
- onlineAccountTypeView = new OnlineAccountTypeView(externalAccounts.lookupOnlineAccountTypeForName(accountTypeName));
+ onlineAccountTypeView = new OnlineAccountTypeView(externalAccounts.lookupOnlineAccountTypeForName(accountTypeName));
+ if ((getViewpoint() instanceof UserViewpoint) &&
+ (identitySpider.isAdministrator(((UserViewpoint)getViewpoint()).getViewer()) ||
+ ((UserViewpoint)getViewpoint()).getViewer().equals(onlineAccountTypeView.getOnlineAccountType().getCreator()))) {
+ allowEdit = true;
+ }
+ if (allowEdit &&
+ externalAccounts.getNumberOfOnlineAccountsForType(getViewpoint(), onlineAccountTypeView.getOnlineAccountType()) == 0) {
+ allowRemoval = true;
+ }
} catch (NotFoundException e) {
accountTypeNameValid = false;
}
@@ -38,6 +56,14 @@
return onlineAccountTypeView;
}
+ public boolean isAllowEdit() {
+ return allowEdit;
+ }
+
+ public boolean isAllowRemoval() {
+ return allowRemoval;
+ }
+
public boolean isAccountTypeNameValid() {
return accountTypeNameValid;
}
Modified: dumbhippo/trunk/server/web/css-gnome/account-types.css
===================================================================
--- dumbhippo/trunk/server/web/css-gnome/account-types.css 2008-11-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/web/css-gnome/account-types.css 2008-11-24 22:08:14 UTC (rev 7524)
@@ -16,6 +16,11 @@
.dh-application-edit-control textarea {
font-family: Luxi Sans, Arial, sans-serif;
}
+
+/* this ensures that the text in the form is easy to read even if the fields are disabled */
+.dh-application-edit-control input {
+ color: black;
+}
.dh-application-edit-help {
font-style: italic;
Modified: dumbhippo/trunk/server/web/javascript/dh/actions.js
===================================================================
--- dumbhippo/trunk/server/web/javascript/dh/actions.js 2008-11-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/web/javascript/dh/actions.js 2008-11-24 22:08:14 UTC (rev 7524)
@@ -369,4 +369,36 @@
function(type, msg, http) {
alert(msg);
});
-}
\ No newline at end of file
+}
+
+dh.actions.updateAccountType = function() {
+ name = document.getElementById("dhAccountTypeName").value
+ fullName = document.getElementById("dhAccountTypeFullName").value
+ siteName = document.getElementById("dhAccountTypeSiteName").value
+ site = document.getElementById("dhAccountTypeSite").value
+ userInfoType = document.getElementById("dhUserInfoType").value
+ public = document.getElementById("dhAccountTypePublic").checked
+ dh.server.doXmlMethod("updateaccounttype",
+ { "name" : name, "fullName" : fullName, "siteName" : siteName, "site" : site,
+ "userInfoType" : userInfoType, "isSupported" : public },
+ function(type, data, http) {
+ alert("Account type updated!");
+ dh.util.refresh();
+ },
+ function(type, msg, http) {
+ alert(msg);
+ });
+}
+
+dh.actions.removeAccountType = function() {
+ name = document.getElementById("dhAccountTypeName").value
+ dh.server.doXmlMethod("removeaccounttype",
+ { "name" : name },
+ function(type, data, http) {
+ alert("Account type removed!");
+ window.open("/account-types", "_self");
+ },
+ function(type, msg, http) {
+ alert(msg);
+ });
+}
\ No newline at end of file
Modified: dumbhippo/trunk/server/web/jsp-gnome/account-type-add.jsp
===================================================================
--- dumbhippo/trunk/server/web/jsp-gnome/account-type-add.jsp 2008-11-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/web/jsp-gnome/account-type-add.jsp 2008-11-24 22:08:14 UTC (rev 7524)
@@ -10,7 +10,8 @@
<title>Add Account Type</title>
<gnome:stylesheet name="site" iefixes="true"/>
<gnome:stylesheet name="account-types"/>
- <dh:script modules="dh.textinput,dh.util"/>
+ <gnome:faviconIncludes/>
+ <dh:script modules="dh.textinput,dh.util,dh.actions"/>
<script type="text/javascript">
function dhOnLoad() {
siteName = document.getElementById('dhAccountTypeSiteName');
@@ -26,10 +27,10 @@
<body onload="dhOnLoad()">
<gnome:page currentPageLink="account-type-add">
- <div class="dh-page-shinybox-title-large">Add Account Type</div>
+ <h3>Add Account Type</h3>
<div>
This page allows you to create a new online account type.
- <a href="/account-types">View existing types</a>
+ You can view existing account types <a href="/account-types">here</a>.
</div>
<hr>
<gnome:accountTypeForm allowEdit="true"/>
Modified: dumbhippo/trunk/server/web/jsp-gnome/account-type.jsp
===================================================================
--- dumbhippo/trunk/server/web/jsp-gnome/account-type.jsp 2008-11-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/web/jsp-gnome/account-type.jsp 2008-11-24 22:08:14 UTC (rev 7524)
@@ -13,18 +13,29 @@
</c:if>
<head>
- <title>Add Account Type</title>
+ <title>View 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>
+ <h3>View Account Type</h3>
<div>
- This page allows you to view information about an online account type.
+ <c:choose>
+ <c:when test="${accountTypes.allowEdit}">
+ This page allows you to view and edit information about an online account type.
+ </c:when>
+ <c:otherwise>
+ This page allows you to view information about an online account type. Feel free to use <a href="http://mail.gnome.org/mailman/listinfo/online-desktop-list">online-desktop-list gnome org mailing list</a>
+ or irc.gnome.org #online-desktop channel to request a change in the settings for this account type.
+ </c:otherwise>
+ </c:choose>
+ <c:if test="${accountTypes.allowRemoval}">
+ You can remove this account type because no accounts of this type have been created so far.
+ </c:if>
</div>
<hr>
- <gnome:accountTypeForm accountTypeView="${accountTypes.onlineAccountType}" allowEdit="false"/>
+ <gnome:accountTypeForm accountTypeView="${accountTypes.onlineAccountType}" allowEdit="${accountTypes.allowEdit}" allowRemoval="${accountTypes.allowRemoval}"/>
</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-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/web/jsp-gnome/account-types.jsp 2008-11-24 22:08:14 UTC (rev 7524)
@@ -11,6 +11,8 @@
<head>
<title>Existing Account Types</title>
<gnome:stylesheet name="site" iefixes="true"/>
+ <gnome:stylesheet name="account-types"/>
+ <dh:script modules="dh.actions"/>
</head>
<body>
@@ -18,7 +20,7 @@
<h3>Existing Account Types</h3>
<div class="gnome-learn-more-text">
<p>
- Click on the account type to view or edit information about it.
+ Click on the account type to view or edit information about it. You can add new account types <a href="/account-type-add">here</a>.
</p>
</div>
<hr>
Modified: dumbhippo/trunk/server/web/jsp-gnome/accounts-learnmore.jsp
===================================================================
--- dumbhippo/trunk/server/web/jsp-gnome/accounts-learnmore.jsp 2008-11-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/web/jsp-gnome/accounts-learnmore.jsp 2008-11-24 22:08:14 UTC (rev 7524)
@@ -9,6 +9,7 @@
<head>
<title>Accounts Service</title>
<gnome:stylesheet name="site" iefixes="true"/>
+ <dh:script modules="dh.actions"/>
</head>
<body>
@@ -50,10 +51,14 @@
<li>You do not need to do own GConf and GNOME Keyring manipulations.
<li>You do not need to create a custom dialog for getting the username and a password.
</ul>
- You can find a sample usage of the Online Accounts service in the <a href="http://svn.gnome.org/svn/bigboard/trunk/">code for the Bigboard sidebar</a>.
- You can add new account types by using <a href="/account-type-add">this form</a>, after which they will show up on the <a href="/account">account page</a>.
- The new account types will be available on the desktop once you restart the desktop-data-engine and web-login-driver processes. Please check in with us
- to see if the account type you want to create already exists. Feel free use <a href="http://mail.gnome.org/mailman/listinfo/online-desktop-list">online-desktop-list gnome org mailing list</a>
+ You can find a sample usage of the Online Accounts service in the <a href="http://svn.gnome.org/svn/bigboard/trunk/">code for the Bigboard sidebar</a>
+ or in <a href="http://twitux.svn.sourceforge.net">Twitux</a>.
+ You can view a list of existing account types <a href="/account-types">here</a>. You can add new account types by using <a href="/account-type-add">this form</a>,
+ after which they will show up on the <a href="/account">account page</a> if you mark them as public.
+ The new public account types will be available on the desktop once you restart the desktop-data-engine and web-login-driver processes.
+ You will be able to edit account types you create, but you need to let us know if you want some account type that already exists to be changed
+ (for example, switched to be public).
+ Feel free to use <a href="http://mail.gnome.org/mailman/listinfo/online-desktop-list">online-desktop-list gnome org mailing list</a>
or irc.gnome.org #online-desktop channel for any questions.
</p>
</div>
Modified: dumbhippo/trunk/server/web/jsp-gnome/application-edit.jsp
===================================================================
--- dumbhippo/trunk/server/web/jsp-gnome/application-edit.jsp 2008-11-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/web/jsp-gnome/application-edit.jsp 2008-11-24 22:08:14 UTC (rev 7524)
@@ -20,7 +20,7 @@
<title>Edit Application - <c:out value="${appinfo.name}"/></title>
<gnome:stylesheet name="site" iefixes="true"/>
<gnome:stylesheet name="applications"/>
- <dh:script module="dh.util"/>
+ <dh:script modules="dh.util,dh.actions"/>
<script type="text/javascript">
dhIconCounter = 0;
dhIconSizes = ["unspecified", "16x16", "22x22", "24x24", "32x32", "48x48", "64x64", "128x128", "scalable"];
Modified: dumbhippo/trunk/server/web/jsp-gnome/application-history.jsp
===================================================================
--- dumbhippo/trunk/server/web/jsp-gnome/application-history.jsp 2008-11-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/web/jsp-gnome/application-history.jsp 2008-11-24 22:08:14 UTC (rev 7524)
@@ -23,7 +23,7 @@
<title>Application History - <c:out value="${appView.application.name}"/></title>
<gnome:stylesheet name="site" iefixes="true"/>
<gnome:stylesheet name="applications"/>
- <dh:script modules="dh.util,dh.server"/>
+ <dh:script modules="dh.util,dh.server,dh.actions"/>
<script type="text/javascript">
function dhRevertApplication() {
var applicationId = <dh:jsString value="${appView.application.id}"/>;
Modified: dumbhippo/trunk/server/web/jsp-gnome/application.jsp
===================================================================
--- dumbhippo/trunk/server/web/jsp-gnome/application.jsp 2008-11-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/web/jsp-gnome/application.jsp 2008-11-24 22:08:14 UTC (rev 7524)
@@ -20,7 +20,7 @@
<title>Application Statistics - <c:out value="${appView.application.name}"/></title>
<gnome:stylesheet name="site" iefixes="true"/>
<gnome:stylesheet name="applications"/>
- <dh:script modules="dh.control,dh.util,dh.event"/>
+ <dh:script modules="dh.control,dh.util,dh.event,dh.actions"/>
<script type="text/javascript">
dhApplicationId = <dh:jsString value="${appView.application.id}"/>;
dhApplicationPackageNames = <dh:jsString value="${appView.application.packageNames}"/>;
Modified: dumbhippo/trunk/server/web/jsp-gnome/applications.jsp
===================================================================
--- dumbhippo/trunk/server/web/jsp-gnome/applications.jsp 2008-11-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/web/jsp-gnome/applications.jsp 2008-11-24 22:08:14 UTC (rev 7524)
@@ -14,6 +14,7 @@
<title>Application Statistics</title>
<gnome:stylesheet name="site" iefixes="true"/>
<gnome:stylesheet name="applications"/>
+ <dh:script modules="dh.actions"/>
</head>
<body>
Modified: dumbhippo/trunk/server/web/tags/gnome/accountTypeForm.tag
===================================================================
--- dumbhippo/trunk/server/web/tags/gnome/accountTypeForm.tag 2008-11-24 04:43:24 UTC (rev 7523)
+++ dumbhippo/trunk/server/web/tags/gnome/accountTypeForm.tag 2008-11-24 22:08:14 UTC (rev 7524)
@@ -5,6 +5,7 @@
<%@ attribute name="accountTypeView" required="false" type="com.dumbhippo.server.views.OnlineAccountTypeView" %>
<%@ attribute name="allowEdit" required="true" type="java.lang.Boolean" %>
+<%@ attribute name="allowRemoval" required="false" 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 --%>
@@ -25,43 +26,50 @@
<c:set var="siteName" value=""/>
<c:set var="site" value=""/>
<c:set var="userInfoType" value=""/>
-<c:set var="isPublic" value="false"/>
+<c:set var="publicCheckedAttr" value=""/>
+<c:set var="privateCheckedAttr" value="checked"/>
<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="userInfoType" value="${accountTypeView.onlineAccountType.userInfoType}"/>
+ <c:if test="${accountTypeView.onlineAccountType.supported}">
+ <c:set var="publicCheckedAttr" value="checked"/>
+ <c:set var="privateCheckedAttr" value=""/>
+ </c:if>
+</c:if>
+
+<c:if test="${!allowEdit}">
<c:set var="disabledAttr" value="disabled"/>
</c:if>
<div>
<h3>Account Type Information</h3>
<table class="dh-application-edit">
+ <%-- we never allow changing an existing account type name --%>
<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}">
+ <dht3:applicationEditRow id="dhAccountTypeFullName" disabled="${!allowEdit}" 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}">
+ <dht3:applicationEditRow id="dhAccountTypeSiteName" disabled="${!allowEdit}" 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}">
+ <dht3:applicationEditRow id="dhAccountTypeSite" disabled="${!allowEdit}" 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}">
+ <dht3:applicationEditRow id="dhUserInfoType" disabled="${!allowEdit}" 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>
@@ -71,8 +79,8 @@
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>
+ <input type="radio" ${disabledAttr} name="dhAccountTypeStatus" id="dhAccountTypePublic" ${publicCheckedAttr}"> <label for="dhAccountTypePublic">Yes</label>
+ <input type="radio" ${disabledAttr} name="dhAccountTypeStatus" id="dhAccountTypePrivate" ${privateCheckedAttr}"> <label for="dhAccountTypePrivate">No</label>
</td>
</tr>
<tr>
@@ -89,10 +97,12 @@
<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> --%>
+ <input type="button" value="Save Changes" onclick="dh.actions.updateAccountType()"></input>
</c:when>
</c:choose>
+ <c:if test="${allowRemoval}">
+ <input type="button" value="Remove Account Type" onclick="dh.actions.removeAccountType()"></input>
+ </c:if>
</td>
</tr>
</table>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]