You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2009/03/09 05:43:27 UTC
svn commit: r751581 - in
/geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main:
java/org/apache/geronimo/console/databasemanager/wizard/
webapp/WEB-INF/view/dbwizard/
Author: gawor
Date: Mon Mar 9 04:43:26 2009
New Revision: 751581
URL: http://svn.apache.org/viewvc?rev=751581&view=rev
Log:
ensure username and password fields always appear next to each other so that web browsers don't autofill the wrong field. Based on patch from Ivan (GERONIMO-4561)
Modified:
geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java
geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/dbwizard/basicParams.jsp
geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/dbwizard/edit.jsp
Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java?rev=751581&r1=751580&r2=751581&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java (original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java Mon Mar 9 04:43:26 2009
@@ -43,6 +43,7 @@
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -86,8 +87,8 @@
import org.apache.geronimo.connector.deployment.jsr88.SinglePool;
import org.apache.geronimo.connector.outbound.PoolingAttributes;
import org.apache.geronimo.console.BasePortlet;
-import org.apache.geronimo.console.databasemanager.ManagementHelper;
import org.apache.geronimo.console.ajax.ProgressInfo;
+import org.apache.geronimo.console.databasemanager.ManagementHelper;
import org.apache.geronimo.console.util.PortletManager;
import org.apache.geronimo.converter.DatabaseConversionStatus;
import org.apache.geronimo.converter.JDBCPool;
@@ -179,6 +180,7 @@
private static final String LOCAL = "LOCAL";
private static final String XA = "XA";
private static final String NONE = "NONE";
+ private static final String[] ORDERED_PROPERTY_NAMES = { "property-DatabaseName", "property-CreateDatabase", "property-UserName", "property-Password" };
private PortletRequestDispatcher listView;
private PortletRequestDispatcher editView;
@@ -669,6 +671,7 @@
Object value = factory.getConfigProperty(cp.getName());
data.properties.put("property-" + cp.getName(), value == null ? null : value.toString());
}
+ data.sort();
}
} catch (Exception e) {
log.error("Unable to look up connection property", e);
@@ -791,6 +794,7 @@
if (more) {
data.loadPropertyNames();
}
+ data.sort();
renderRequest.setAttribute("ConfigParams", map);
}
editView.include(renderRequest, renderResponse);
@@ -1304,7 +1308,7 @@
private String dbtype;
private String user;
private String password;
- private Map<String, String> properties = new HashMap<String, String>(); // Configuration for non-Generic drivers
+ private Map<String, String> properties = new LinkedHashMap<String, String>(); // Configuration for non-Generic drivers
private Map<String, Object> urlProperties = new HashMap<String, Object>(); // URL substitution for Generic drivers
private Map<String, String> propertyNames; //todo: store these in the ConfigParam instead
private String driverClass;
@@ -1370,7 +1374,7 @@
if (importSource != null && importSource.equals("")) importSource = null;
transactionType = request.getParameter("transactionType");
if (transactionType != null && "".equals(transactionType)) {
- if(dbtype.endsWith("XA")){
+ if (dbtype != null && dbtype.endsWith("XA")) {
transactionType = XA;
} else {
transactionType = LOCAL;
@@ -1387,6 +1391,7 @@
propertyNames.put(key, getPropertyName(key));
}
}
+ sort();
deployError = request.getParameter("deployError");
if (deployError != null && deployError.equals("")) deployError = null;
}
@@ -1461,6 +1466,22 @@
if (deployError != null) response.setRenderParameter("deployError", deployError);
}
+
+ public void sort() {
+ Map<String, String> sortedProperties = new LinkedHashMap<String, String>();
+
+ for (String propertyName : ORDERED_PROPERTY_NAMES) {
+ if (properties.containsKey(propertyName)) {
+ sortedProperties.put(propertyName, properties.get(propertyName));
+ properties.remove(propertyName);
+ }
+ }
+
+ sortedProperties.putAll(properties);
+
+ properties = sortedProperties;
+ }
+
public String getName() {
return name;
}
Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/dbwizard/basicParams.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/dbwizard/basicParams.jsp?rev=751581&r1=751580&r2=751581&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/dbwizard/basicParams.jsp (original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/dbwizard/basicParams.jsp Mon Mar 9 04:43:26 2009
@@ -95,7 +95,7 @@
<!-- ENTRY FIELD: Username -->
<tr>
<th><div align="right"><fmt:message key="dbwizard.common.DBUserName"/>:</div></th>
- <td><input name="user" type="text" size="20" value="${pool.user}"></td>
+ <td><input name="user" type="text" size="20" value="${pool.user}" autocomplete="off"></td>
</tr>
<tr>
<td></td>
@@ -104,11 +104,11 @@
<!-- ENTRY FIELD: Password -->
<tr>
<th><div align="right"><fmt:message key="dbwizard.common.DBPassword"/>:</div></th>
- <td><input name="password" type="password" size="20" value="${pool.password}"></td>
+ <td><input name="password" type="password" size="20" value="${pool.password}" autocomplete="off"></td>
</tr>
<tr>
<th><div align="right"><fmt:message key="dbwizard.common.confirmPassword"/>:</div></th>
- <td><input name="confirm-password" type="password" size="20" value="${pool.password}"></td>
+ <td><input name="confirm-password" type="password" size="20" value="${pool.password}" autocomplete="off"></td>
</tr>
<tr>
<td></td>
Modified: geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/dbwizard/edit.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/dbwizard/edit.jsp?rev=751581&r1=751580&r2=751581&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/dbwizard/edit.jsp (original)
+++ geronimo/server/branches/2.1/plugins/system-database/sysdb-portlets/src/main/webapp/WEB-INF/view/dbwizard/edit.jsp Mon Mar 9 04:43:26 2009
@@ -222,7 +222,7 @@
<!-- ENTRY FIELD: Username -->
<tr>
<th><div align="right"><fmt:message key="dbwizard.common.DBUserName"/>:</div></th>
- <td><input name="user" type="text" size="20" value="${pool.user}"></td>
+ <td><input name="user" type="text" size="20" value="${pool.user}" autocomplete="off"></td>
</tr>
<tr>
<td></td>
@@ -231,11 +231,11 @@
<!-- ENTRY FIELD: Password -->
<tr>
<th><div align="right"><fmt:message key="dbwizard.common.DBPassword"/>:</div></th>
- <td><input name="password" type="password" size="20" value="${pool.password}"></td>
+ <td><input name="password" type="password" size="20" value="${pool.password}" autocomplete="off"></td>
</tr>
<tr>
<th><div align="right"><fmt:message key="dbwizard.common.confirmPassword"/>:</div></th>
- <td><input name="confirm-password" type="password" size="20" value="${pool.password}"></td>
+ <td><input name="confirm-password" type="password" size="20" value="${pool.password}" autocomplete="off"></td>
</tr>
<script language="JavaScript">
<portlet:namespace/>passwordFields = <portlet:namespace/>passwordFields.concat(new Array("password"));
@@ -286,12 +286,13 @@
<c:forEach var="prop" items="${pool.properties}">
<tr>
<th><div align="right">${pool.propertyNames[prop.key]}:</div></th>
- <td><input name="${prop.key}" type="<c:choose><c:when test="${fn:containsIgnoreCase(prop.key, 'password')}">password</c:when><c:otherwise>text</c:otherwise></c:choose>" size="20" value="${prop.value}"></td>
+ <td><input name="${prop.key}" <c:choose><c:when test="${fn:containsIgnoreCase(prop.key, 'password')}">type="password" autocomplete="off"</c:when><c:otherwise>type="text"</c:otherwise></c:choose> size="20" value="${prop.value}"></td>
+
</tr>
<c:if test="${fn:containsIgnoreCase(prop.key, 'password')}">
<tr>
<th><div align="right"><fmt:message key="dbwizard.common.confirmPassword"/>:</div></th>
- <td><input name="confirm-${prop.key}" type="password" size="20" value="${prop.value}"></td>
+ <td><input name="confirm-${prop.key}" type="password" size="20" value="${prop.value}" autocomplete="off"></td>
</tr>
<script language="JavaScript">
<portlet:namespace/>passwordFields = <portlet:namespace/>passwordFields.concat(new Array("${prop.key}"));