Author: julien(a)jboss.com
Date: 2007-03-10 16:53:58 -0500 (Sat, 10 Mar 2007)
New Revision: 6626
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml
trunk/widget/src/main/org/jboss/portal/widget/google/GGWidget.java
trunk/widget/src/resources/widget-war/WEB-INF/jsp/edit.jsp
Log:
- implemented GG enums
- better formatting of GG editor
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml
===================================================================
---
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml 2007-03-10
20:58:50 UTC (rev 6625)
+++
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml 2007-03-10
21:53:58 UTC (rev 6626)
@@ -99,7 +99,6 @@
</tr>
<tr>
<td class="label">
- <span class="portlet-form-field-label">Portlet
content:</span>
</td>
<td class="widget">
<div align="left">
Modified: trunk/widget/src/main/org/jboss/portal/widget/google/GGWidget.java
===================================================================
--- trunk/widget/src/main/org/jboss/portal/widget/google/GGWidget.java 2007-03-10 20:58:50
UTC (rev 6625)
+++ trunk/widget/src/main/org/jboss/portal/widget/google/GGWidget.java 2007-03-10 21:53:58
UTC (rev 6626)
@@ -24,6 +24,7 @@
import org.jboss.portal.common.util.LocalizedString;
import org.jboss.portal.common.util.UUIDGenerator;
+import org.jboss.portal.common.text.FastURLEncoder;
import org.jboss.portal.widget.Widget;
import java.util.Iterator;
@@ -144,7 +145,7 @@
tmp.append("&synd=open");
tmp.append("&w=").append(width);
tmp.append("&h=").append(height);
- tmp.append("&title=").append(title.getDefaultString());
+
tmp.append("&title=").append(FastURLEncoder.DEFAULT_ENCODER.encode(title.getDefaultString()));
tmp.append("&border=%23ffffff%7C3px%2C1px+none+%23999999"); //
"&border=%23ffffff%7C3px%2C1px+solid+%23999999"
tmp.append("&output=js");
@@ -152,11 +153,12 @@
for (Iterator i = prefsInfo.getPreferencesInfo().iterator();i.hasNext();)
{
GGPreferenceInfo prefInfo = (GGPreferenceInfo)i.next();
- String[] values = (String[])parameters.get(prefInfo.getName());
+ String prefName = prefInfo.getName();
+ String[] values = (String[])parameters.get(prefName);
String value = values != null ? values[0] : prefInfo.getDefaultValue();
if (value != null)
{
-
tmp.append("&_up").append(prefInfo.getName()).append("=").append(prefInfo.getDefaultValue());
+
tmp.append("&up_").append(FastURLEncoder.DEFAULT_ENCODER.encode(prefName)).append("=").append(FastURLEncoder.DEFAULT_ENCODER.encode(value));
}
}
Modified: trunk/widget/src/resources/widget-war/WEB-INF/jsp/edit.jsp
===================================================================
--- trunk/widget/src/resources/widget-war/WEB-INF/jsp/edit.jsp 2007-03-10 20:58:50 UTC
(rev 6625)
+++ trunk/widget/src/resources/widget-war/WEB-INF/jsp/edit.jsp 2007-03-10 21:53:58 UTC
(rev 6626)
@@ -6,6 +6,7 @@
<%@ page import="org.jboss.portal.widget.google.type.DataType" %>
<%@ page import="org.jboss.portal.widget.google.GGWidgetCategoryInfo" %>
<%@ page import="org.jboss.portal.widget.google.provider.GGQuery" %>
+<%@ page import="org.jboss.portal.widget.google.type.EnumType" %>
<%@ page language="java"%>
<%@ taglib
uri="http://java.sun.com/portlet" prefix="p" %>
<%@ page isELIgnored="false" %>
@@ -53,7 +54,7 @@
}
%>
</select>
- <input type="submit"/>
+ <input type="submit" value="Search Gadgets"/>
</form>
<%
@@ -63,23 +64,51 @@
<p>You have selected the widget <%= selWidget.getTitle().getDefaultString()
%></p>
<p>
<form action="<p:actionURL><p:param name="meta_action"
value="select"/><p:param name="uri" value="<%=
selWidget.getId() %>"/></p:actionURL>" method="post">
+ <table>
+ <tbody>
<%
for (Iterator i =
selWidget.getPreferencesInfo().getPreferencesInfo().iterator(); i.hasNext();)
{
GGPreferenceInfo prefInfo = (GGPreferenceInfo)i.next();
+ %>
+ <tr>
+ <td><%= prefInfo.getName() %>:</td>
+ <%
switch (prefInfo.getType().getOrdinal())
{
case DataType.ENUM:
- // Todo
+ %>
+ <td><select name="param.<%= prefInfo.getName()
%>">
+ <%
+ EnumType e = (EnumType)prefInfo.getType();
+ for (int j = 0;j < e.getSize();j++)
+ {
+ EnumType.Value value = e.getValue(j);
+ boolean selected =
value.getValue().equals(prefInfo.getDefaultValue());
+ %>
+ <option <%= selected ?
"selected=\"selected\"" : "" %> value="<%=
value.getValue() %>"><%= value.getDisplayValue() != null ?
value.getDisplayValue() : value.getValue() %></option>
+ <%
+ }
+ %>
+ </select></td>
+ <%
break;
default:
%>
- <div><%= prefInfo.getName() %>: <input type="text"
name="param.<%= prefInfo.getName() %>" value="<%=
prefInfo.getDefaultValue() != null ? prefInfo.getDefaultValue() : ""
%>"/></div>
+ <td><input type="text" name="param.<%=
prefInfo.getName() %>" value="<%= prefInfo.getDefaultValue() != null ?
prefInfo.getDefaultValue() : "" %>"/></td>
<%
+ break;
}
+ %>
+ </tr>
+ <%
}
%>
- <input type="submit"/>
+ <tr>
+ <td colspan="2"><input type="submit"
value="Add"/></td>
+ </tr>
+ </tbody>
+ </table>
</form>
</p>
<%