Author: wesleyhales
Date: 2007-11-28 11:05:30 -0500 (Wed, 28 Nov 2007)
New Revision: 9169
Added:
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/basestyles.css
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/style.css
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalObjectDisplayNameAction.java
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/displayNameObject.xhtml
Log:
JBPORTAL-1805 Let a user define multiple display-name for a portal object in the admin
portlet
Added:
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/basestyles.css
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/basestyles.css
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/basestyles.css 2007-11-28
16:05:30 UTC (rev 9169)
@@ -0,0 +1,79 @@
+.zero {
+ margin:0;
+ padding:0;
+}
+
+.align-center {
+ text-align: center;
+}
+
+.align-center-margin {
+ margin: 0 auto 0 auto;
+}
+
+.float-left {
+ float: left;
+}
+
+.float-right {
+ float: right;
+}
+
+.align-left {
+ text-align: left;
+}
+
+.align-right {
+ text-align: right;
+}
+
+.half-width {
+ width: 49%;
+}
+
+.quarter-width {
+ width: 24.9%;
+}
+
+.three-quarter-width {
+ width: 74.9%;
+}
+
+.full-width {
+ width: 100%;
+}
+
+.third-width {
+ width: 32.9%;
+}
+
+.two-third-width {
+ width: 65.9%;
+}
+
+.third-width-pad5 {
+ width: 32.5%;
+ padding: 5px;
+}
+
+.two-third-width-pad5 {
+ width: 65.5%;
+ padding: 5px;
+}
+
+.tenpx-top-bottom {
+ margin: 10px 0 10px 0;
+}
+
+.clear {
+ clear: both;
+}
+
+.pad5 {
+ padding: 5px;
+}
+
+.pad10 {
+ padding: 10px
+}
+
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/style.css
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/style.css 2007-11-28
15:41:20 UTC (rev 9168)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/style.css 2007-11-28
16:05:30 UTC (rev 9169)
@@ -1,5 +1,7 @@
/* Redefine spacing for tables. */
+@import url(basestyles.css);
+
a {
color: #446688;
text-decoration: none;
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalObjectDisplayNameAction.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalObjectDisplayNameAction.java 2007-11-28
15:41:20 UTC (rev 9168)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalObjectDisplayNameAction.java 2007-11-28
16:05:30 UTC (rev 9169)
@@ -157,9 +157,10 @@
return null;
}
- public void removeDisplayName()
+ public void editDisplayName()
{
- String locale =
(String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("locale");
+ String locale = getFacesParam("locale");
+ String editAction = getFacesParam("editAction");
PortalObject portalObject = getSelectedObject();
LocalizedString displayName = portalObject.getDisplayName();
@@ -168,17 +169,37 @@
{
Map<Locale, LocalizedString.Value> oldMap = displayName.getValues();
Collection<LocalizedString.Value> values = oldMap.values();
- for (LocalizedString.Value value : values)
+ if (editAction.equals("delete"))
{
- if (!value.getLocale().toString().equals(locale.toString()))
+ for (LocalizedString.Value value : values)
{
+ if (!value.getLocale().toString().equals(locale.toString()))
+ {
+ map.put(value.getLocale(), value.getString());
+ }
+ }
+ }
+ if (editAction.equals("rename"))
+ {
+ for (LocalizedString.Value value : values)
+ {
map.put(value.getLocale(), value.getString());
+ if (value.getLocale().toString().equals(locale.toString()))
+ {
+ newText = value.getString();
+ newLocale = value.getLocale().getLanguage();
+ }
}
}
}
LocalizedString newLocalizedString = new LocalizedString(map, Locale.ENGLISH);
selectedObject.setDisplayName(newLocalizedString);
}
+
+
+ public String getFacesParam(String param){
+ return
(String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(param);
+ }
/*
public void setCurrentLocales(Map currentLocales)
@@ -200,6 +221,8 @@
return "editDisplayNames";
}
+
+
private String convertLocaleDisplayName(String str)
{
if (str.length() > 0)
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/displayNameObject.xhtml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/displayNameObject.xhtml 2007-11-28
15:41:20 UTC (rev 9168)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/displayNameObject.xhtml 2007-11-28
16:05:30 UTC (rev 9169)
@@ -6,26 +6,11 @@
xmlns:c="http://java.sun.com/jstl/core">
<ui:composition template="/WEB-INF/jsf/objectTemplate.xhtml">
<ui:param name="portalObjectScreen" value="Rename"/>
+
<ui:define name="content">
- <h3>Add Display Name</h3>
-
- <h:form>
-
- <p class="portlet-area-header">Current Display
Names</p>
- <div class="portlet-area-body">
- <ul>
- <c:forEach items="#{addDisplayNameAction.currentLocales}"
var="value">
- <!--We should be able to do something like with el,
- but it's not working so I printed out all languages :)-->
- <li>#{value.localeDisplayName} - #{value.text} <h:commandLink
action="#{addDisplayNameAction.removeDisplayName}">
- <h:outputText styleClass="actionDelete"
value="Delete"/>
- <f:param name="locale"
value="#{value.locale}"/>
- </h:commandLink></li>
- </c:forEach>
- </ul>
- </div>
- </h:form>
- <h:form id="displayNameForm">
+ <h3 class="zero pad10 clear">Add Display Name</h3>
+ <div class="float-left third-width-pad5">
+ <h:form id="displayNameForm">
<p class="portlet-area-header">Add Display Names</p>
<div class="portlet-area-body">
<h:inputText id="newName"
value="#{addDisplayNameAction.newText}" required="true"/>
@@ -34,7 +19,49 @@
</h:selectOneMenu>
<h:commandButton value="Add Name"
action="#{addDisplayNameAction.addDisplayName}"
styleClass="portlet-form-button"/>
</div>
- </h:form>
+ </h:form>
+ </div>
+
+ <div class="float-left two-third-width-pad5">
+ <h:form>
+ <p class="portlet-area-header">Current Display
Names</p>
+ <div class="portlet-area-body">
+
+ <table class="full-width">
+ <tr>
+ <th>Locale</th>
+ <th>Display Name</th>
+ <th>Delete</th>
+ <th>Rename</th>
+ </tr>
+
+ <c:forEach items="#{addDisplayNameAction.currentLocales}"
var="value">
+ <tr>
+
+ <td>#{value.localeDisplayName}</td>
+ <td>#{value.text}</td>
+ <td>
+ <h:commandLink
action="#{addDisplayNameAction.editDisplayName}">
+ <h:outputText styleClass="actionDelete"
value="Delete"/>
+ <f:param name="locale"
value="#{value.locale}"/>
+ <f:param name="editAction"
value="delete"/>
+ </h:commandLink>
+ </td>
+ <td><h:commandLink
action="#{addDisplayNameAction.editDisplayName}">
+ <h:outputText styleClass="actionRename"
value="Rename"/>
+ <f:param name="locale"
value="#{value.locale}"/>
+ <f:param name="editAction"
value="rename"/>
+ </h:commandLink></td>
+ </tr>
+ </c:forEach>
+ </table>
+ </div>
+ </h:form>
+ </div>
+
+
+ <br class="clear"/>
+
</ui:define>
</ui:composition>
</div>