rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ja...@apache.org
Subject svn commit: r1186745 - in /incubator/rave/trunk: rave-components/rave-core/src/main/java/org/apache/rave/portal/service/ rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/ rave-components/rave-core/src/test/java/org/apache/rav...
Date Thu, 20 Oct 2011 11:32:12 GMT
Author: jasha
Date: Thu Oct 20 11:32:12 2011
New Revision: 1186745

URL: http://svn.apache.org/viewvc?rev=1186745&view=rev
Log:
RAVE-301 basic widget admin functionality (no search yet)

Added:
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/views/admin/widgetdetail.jsp
      - copied, changed from r1186623, incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/views/admin/userdetail.jsp
Modified:
    incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/WidgetService.java
    incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/DefaultWidgetService.java
    incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/service/WidgetServiceTest.java
    incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/admin/WidgetController.java
    incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ViewNames.java
    incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/admin/WidgetControllerTest.java
    incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/views/admin/widgets.jsp
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/css/default.css

Modified: incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/WidgetService.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/WidgetService.java?rev=1186745&r1=1186744&r2=1186745&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/WidgetService.java
(original)
+++ incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/WidgetService.java
Thu Oct 20 11:32:12 2011
@@ -101,4 +101,11 @@ public interface WidgetService {
      * @return Widget if it is new and can be stored, otherwise {@literal null}
      */
     Widget registerNewWidget(Widget widget);
+
+    /**
+     * Updates {@link Widget}
+     *
+     * @param widget to save
+     */
+    void updateWidget(Widget widget);
 }

Modified: incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/DefaultWidgetService.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/DefaultWidgetService.java?rev=1186745&r1=1186744&r2=1186745&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/DefaultWidgetService.java
(original)
+++ incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/DefaultWidgetService.java
Thu Oct 20 11:32:12 2011
@@ -126,4 +126,9 @@ public class DefaultWidgetService implem
         }
         return widgetRepository.save(widget);
     }
+
+    @Override
+    public void updateWidget(Widget widget) {
+        widgetRepository.save(widget);
+    }
 }

Modified: incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/service/WidgetServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/service/WidgetServiceTest.java?rev=1186745&r1=1186744&r2=1186745&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/service/WidgetServiceTest.java
(original)
+++ incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/service/WidgetServiceTest.java
Thu Oct 20 11:32:12 2011
@@ -33,6 +33,7 @@ import java.util.List;
 import static org.easymock.EasyMock.createNiceMock;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.nullValue;
 import static org.hamcrest.CoreMatchers.sameInstance;
@@ -41,6 +42,7 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Test for {@link DefaultWidgetService}
@@ -210,4 +212,19 @@ public class WidgetServiceTest {
         Widget noWidget = service.registerNewWidget(widget);
         assertNull("Widget already exists", noWidget);
     }
+
+    @Test
+    public void updateWidget() {
+        final String widgetUrl =
+                        "http://hosting.gmodules.com/ig/gadgets/file/112581010116074801021/hamster.xml";
+        Widget widget = new Widget();
+        widget.setUrl(widgetUrl);
+        expect(repository.save(widget)).andReturn(widget).once();
+        replay(repository);
+
+        service.updateWidget(widget);
+        verify(repository);
+
+        assertTrue("Save called", true);
+    }
 }

Modified: incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/admin/WidgetController.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/admin/WidgetController.java?rev=1186745&r1=1186744&r2=1186745&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/admin/WidgetController.java
(original)
+++ incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/admin/WidgetController.java
Thu Oct 20 11:32:12 2011
@@ -19,22 +19,80 @@
 
 package org.apache.rave.portal.web.controller.admin;
 
+import org.apache.rave.portal.model.Widget;
+import org.apache.rave.portal.model.WidgetStatus;
+import org.apache.rave.portal.model.util.SearchResult;
+import org.apache.rave.portal.service.WidgetService;
+import org.apache.rave.portal.web.util.ModelKeys;
 import org.apache.rave.portal.web.util.ViewNames;
+import org.apache.rave.portal.web.validator.NewWidgetValidator;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.SessionAttributes;
+
+import static org.apache.rave.portal.model.WidgetStatus.values;
 
 /**
  * Admin controller to manipulate Widget data
  */
 @Controller
+@SessionAttributes({"widget"})
 public class WidgetController {
 
+    private static final String SELECTED_ITEM = "widgets";
+
+    @Autowired
+    private WidgetService widgetService;
+
+    @Autowired
+    private NewWidgetValidator widgetValidator;
+
     @RequestMapping(value = "/admin/widgets", method = RequestMethod.GET)
-    public String viewWidgets(Model model) {
-        AdminControllerUtil.addNavigationMenusToModel("widgets", model);
+    public String viewWidgets(@RequestParam(required = false, defaultValue = "0") int offset,
Model model) {
+        AdminControllerUtil.addNavigationMenusToModel(SELECTED_ITEM, model);
+        final SearchResult<Widget> widgets =
+                widgetService.getLimitedListOfWidgets(offset, AdminControllerUtil.DEFAULT_PAGE_SIZE);
+        model.addAttribute(ModelKeys.SEARCHRESULT, widgets);
         return ViewNames.ADMIN_WIDGETS;
     }
 
+    @RequestMapping(value = "/admin/widgetdetail/{widgetid}", method = RequestMethod.GET)
+    public String viewWidgetDetail(@PathVariable("widgetid") Long widgetid, Model model)
{
+        AdminControllerUtil.addNavigationMenusToModel(SELECTED_ITEM, model);
+        model.addAttribute(widgetService.getWidget(widgetid));
+        return ViewNames.ADMIN_WIDGETDETAIL;
+    }
+
+    @RequestMapping(value = "/admin/widgetdetail/update", method = RequestMethod.POST)
+    public String updateWidgetDetail(@ModelAttribute("widget") Widget widget, BindingResult
result) {
+        widgetValidator.validate(widget, result);
+        if (result.hasErrors()) {
+            return ViewNames.ADMIN_WIDGETDETAIL;
+        }
+        widgetService.updateWidget(widget);
+        return "redirect:" + widget.getEntityId();
+    }
+
+    @ModelAttribute("widgetStatus")
+    public WidgetStatus[] getWidgetStatusValues() {
+        return values();
+    }
+
+
+    // setters for unit tests
+    
+    void setWidgetService(WidgetService widgetService) {
+        this.widgetService = widgetService;
+    }
+
+    void setWidgetValidator(NewWidgetValidator widgetValidator) {
+        this.widgetValidator = widgetValidator;
+    }
 }

Modified: incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ViewNames.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ViewNames.java?rev=1186745&r1=1186744&r2=1186745&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ViewNames.java
(original)
+++ incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ViewNames.java
Thu Oct 20 11:32:12 2011
@@ -35,6 +35,7 @@ public class ViewNames {
     public static final String ADMIN_USERS = "admin/users";
     public static final String ADMIN_USERDETAIL = "admin/userdetail";
     public static final String ADMIN_WIDGETS = "admin/widgets";
+    public static final String ADMIN_WIDGETDETAIL = "admin/widgetdetail";
 
     public static final String REDIRECT = "redirect:/";
 }

Modified: incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/admin/WidgetControllerTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/admin/WidgetControllerTest.java?rev=1186745&r1=1186744&r2=1186745&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/admin/WidgetControllerTest.java
(original)
+++ incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/admin/WidgetControllerTest.java
Thu Oct 20 11:32:12 2011
@@ -19,14 +19,30 @@
 
 package org.apache.rave.portal.web.controller.admin;
 
+import org.apache.rave.portal.model.Widget;
+import org.apache.rave.portal.model.util.SearchResult;
+import org.apache.rave.portal.service.WidgetService;
+import org.apache.rave.portal.web.util.ModelKeys;
 import org.apache.rave.portal.web.util.ViewNames;
+import org.apache.rave.portal.web.validator.NewWidgetValidator;
 import org.junit.Before;
 import org.junit.Test;
 import org.springframework.ui.ExtendedModelMap;
 import org.springframework.ui.Model;
+import org.springframework.validation.BeanPropertyBindingResult;
+import org.springframework.validation.BindingResult;
+
+import java.util.ArrayList;
+import java.util.List;
 
 import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
 
 /**
  * Test for {@link WidgetController}
@@ -34,20 +50,92 @@ import static junit.framework.Assert.ass
 public class WidgetControllerTest {
 
     private static final String TABS = "tabs";
+    public static final int DEFAULT_OFFSET = 0;
+    public static final int DEFAULT_PAGESIZE = AdminControllerUtil.DEFAULT_PAGE_SIZE;
 
     private WidgetController controller;
+    private WidgetService service;
+    private NewWidgetValidator validator;
 
     @Test
     public void adminWidgets() throws Exception {
         Model model = new ExtendedModelMap();
-        String adminWidgetsView = controller.viewWidgets(model);
+
+        SearchResult<Widget> widgetSearchResult = populateWidgetSearchResult();
+        expect(service.getLimitedListOfWidgets(DEFAULT_OFFSET, DEFAULT_PAGESIZE)).andReturn(widgetSearchResult);
+        replay(service);
+        String adminWidgetsView = controller.viewWidgets(DEFAULT_OFFSET, model);
+        verify(service);
         assertEquals(ViewNames.ADMIN_WIDGETS, adminWidgetsView);
+        assertEquals(widgetSearchResult, model.asMap().get(ModelKeys.SEARCHRESULT));
         assertTrue(model.containsAttribute(TABS));
     }
 
+    @Test
+    public void viewAdminWidgetDetail() throws Exception {
+        Model model = new ExtendedModelMap();
+        Widget widget = new Widget();
+        final long entityId = 123L;
+        widget.setEntityId(entityId);
+        widget.setTitle("My widget");
+
+        expect(service.getWidget(entityId)).andReturn(widget);
+        replay(service);
+        String adminWidgetDetailView = controller.viewWidgetDetail(entityId, model);
+        verify(service);
+
+        assertEquals(ViewNames.ADMIN_WIDGETDETAIL, adminWidgetDetailView);
+        assertTrue(model.containsAttribute(TABS));
+        assertEquals(widget, model.asMap().get("widget"));
+    }
+
+    @Test
+    public void updateWidget_valid() {
+        Widget widget = new Widget(123L, "http://example.com/widget");
+        widget.setTitle("Widget title");
+        widget.setType("OpenSocial");
+        BindingResult errors = new BeanPropertyBindingResult(widget, "widget");
+
+        service.updateWidget(widget);
+        expectLastCall();
+        replay(service);
+        String view = controller.updateWidgetDetail(widget, errors);
+        verify(service);
+
+        assertFalse("No errors", errors.hasErrors());
+        assertEquals("redirect:123", view);
+
+    }
+
+    @Test
+    public void updateWidget_invalid() {
+        Widget widget = new Widget(123L, "http://broken/url");
+        BindingResult errors = new BeanPropertyBindingResult(widget, "widget");
+
+        String view = controller.updateWidgetDetail(widget, errors);
+
+        assertTrue("Errors", errors.hasErrors());
+        assertEquals(ViewNames.ADMIN_WIDGETDETAIL, view);
+
+    }
 
     @Before
     public void setUp() throws Exception {
         controller = new WidgetController();
+        service = createMock(WidgetService.class);
+        controller.setWidgetService(service);
+        validator = new NewWidgetValidator();
+        controller.setWidgetValidator(validator);
+    }
+
+
+    private static SearchResult<Widget> populateWidgetSearchResult() {
+        List<Widget> widgetList = new ArrayList<Widget>();
+        for (int i = 0; i < DEFAULT_PAGESIZE; i++) {
+            Widget widget = new Widget();
+            widget.setTitle("Widget " + i);
+            widgetList.add(widget);
+        }
+        return new SearchResult<Widget>(widgetList, 25);
     }
 }

Modified: incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties?rev=1186745&r1=1186744&r2=1186745&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties Thu
Oct 20 11:32:12 2011
@@ -128,6 +128,10 @@ admin.userdata.enabled=Account enabled
 admin.userdata.expired=Account expired
 admin.userdata.locked=Account locked
 admin.userdata.authorities=Authorities:
+admin.widgetdetail.title=Rave admin interface - Widget detail
+admin.widgetdetail.goback=\u00AB Back to widgets
+admin.widgetdetail.editdata=Edit widget data
+admin.widgetdetail.updatebutton=Update widget
 admin.clearsearch=Clear search
 
 admin.list.noresult=No results found
@@ -153,6 +157,7 @@ widget.type.required=Choose a widget typ
 widget.url=Location (URL)
 widget.url.malformed=URL is malformed
 widget.url.required=URL is required
+widget.widgetStatus=Status
 widget.widgetStatus.PREVIEW=This widget is waiting for approval by the site administrator.
 widget.widgetStatus.PUBLISHED=
 

Copied: incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/views/admin/widgetdetail.jsp
(from r1186623, incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/views/admin/userdetail.jsp)
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/views/admin/widgetdetail.jsp?p2=incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/views/admin/widgetdetail.jsp&p1=incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/views/admin/userdetail.jsp&r1=1186623&r2=1186745&rev=1186745&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/views/admin/userdetail.jsp
(original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/views/admin/widgetdetail.jsp
Thu Oct 20 11:32:12 2011
@@ -25,79 +25,129 @@
 <%@ taglib tagdir="/WEB-INF/tags" prefix="rave" %>
 <fmt:setBundle basename="messages"/>
 
-<fmt:message key="admin.userdetail.title" var="pagetitle"/>
-
-<c:set var="canChangeUserStatus" value="${user.username ne loggedInUser}"/>
+<fmt:message key="admin.widgetdetail.title" var="pagetitle"/>
 
 <rave:rave_generic_page pageTitle="${pagetitle}">
     <rave:header pageTitle="${pagetitle}"/>
     <rave:admin_tabsheader/>
-    <div id="pageContent">
+    <div class="pageContent">
         <article class="admincontent">
             <ul class="horizontal-list goback">
-                <li><a href="<spring:url value="/app/admin/users"/>"><fmt:message
key="admin.userdetail.goback"/></a>
+                <li><a href="<spring:url value="/app/admin/widgets"/>"><fmt:message
key="admin.widgetdetail.goback"/></a>
                 </li>
             </ul>
-            <h2><c:out value="${user.username}"/></h2>
+            <h2><c:out value="${widget.title}"/></h2>
 
             <div class="rightcolumn">
-
+                <c:if test="${not empty widget.screenshotUrl or not empty widget.thumbnailUrl}">
+                    <section class="formbox">
+                        <c:if test="${not empty widget.screenshotUrl}">
+                            <figure class="screenshot">
+                                <img src="<c:out value="${widget.screenshotUrl}"/>"
alt="">
+                                <figcaption><fmt:message key="widget.screenshotUrl"/></figcaption>
+                            </figure>
+                        </c:if>
+
+                        <c:if test="${not empty widget.thumbnailUrl}">
+                            <figure>
+                                <img src="<c:out value="${widget.thumbnailUrl}"/>"
alt="">
+                                <figcaption><fmt:message key="widget.thumbnailUrl"/></figcaption>
+                            </figure>
+                        </c:if>
+                    </section>
+                </c:if>
             </div>
 
             <div class="leftcolumn">
                 <section class="formbox">
-                    <h3><fmt:message key="admin.userdetail.editdata"/></h3>
-                    <form:form id="updateUserProfile" action="update" commandName="user"
method="POST">
+                    <h3><fmt:message key="admin.widgetdetail.editdata"/></h3>
+                    <form:form id="updateWidget" action="update" commandName="widget"
method="POST">
                         <form:errors cssClass="error" element="p"/>
                         <fieldset>
+                            <p><fmt:message key="form.some.fields.required"/></p>
+
+                            <p>
+                                <form:label path="title"><fmt:message key="widget.title"/>
*</form:label>
+                                <form:input path="title" cssClass="long" required="required"
autofocus="autofocus"/>
+                                <form:errors path="title" cssClass="error"/>
+                            </p>
+
                             <p>
-                                <label for="email"><fmt:message key="page.general.email"/></label>
-                                <spring:bind path="email">
-                                    <input type="email" name="email" id="email" value="<c:out
value="${status.value}"/>"
-                                           class="long"/>
+                                <spring:bind path="url">
+                                    <label for="url"><fmt:message key="widget.url"/>
*</label>
+                                    <input type="url" name="url" id="url"
+                                           placeholder="http://example.com/widget.xml" required="required"
+                                           class="long" value="<c:out value="${widget.url}"/>"/>
                                 </spring:bind>
+                                <form:errors path="url" cssClass="error"/>
+                            </p>
+
+                            <p>
+                                <label for="type1"><fmt:message key="widget.type"/>
*</label>
+                                <label for="type1" class="formradio"><form:radiobutton
path="type" value="OpenSocial"/>
+                                    <fmt:message key="widget.type.OpenSocial"/></label>
+                                <label for="type2" class="formradio"><form:radiobutton
path="type" value="W3C"/>
+                                    <fmt:message key="widget.type.W3C"/></label>
+                                <form:errors path="type" cssClass="error"/>
+                            </p>
+
+                            <p>
+                                <form:label path="description"><fmt:message key="widget.description"/></form:label>
+                                <form:textarea path="description" cssClass="long"/>
+                                <form:errors path="description" cssClass="error"/>
                             </p>
 
                             <p>
-                                <label for="openIdField"><fmt:message key="page.userprofile.openid.url"/></label>
-                                <spring:bind path="openId">
-                                    <input type="url" id="openIdField" name="openId"
-                                           value="<c:out value="${status.value}"/>"
class="long"/>
+                                <form:label path="widgetStatus"><fmt:message key="widget.widgetStatus"/></form:label>
+                                <form:select path="widgetStatus" items="${widgetStatus}"/>
+                            </p>
+
+                            <p>
+                                <spring:bind path="thumbnailUrl">
+                                    <label for="thumbnailUrl"><fmt:message key="widget.thumbnailUrl"/></label>
+                                    <input type="url" name="thumbnailUrl" id="thumbnailUrl"
+                                           placeholder="http://example.com/thumbnail.png"
class="long"
+                                           value="<c:out value="${widget.thumbnailUrl}"/>"/>
                                 </spring:bind>
-                                <form:errors path="openId" cssClass="error"/>
+                                <form:errors path="thumbnailUrl" cssClass="error"/>
+                            </p>
+
+                            <p>
+                                <spring:bind path="screenshotUrl">
+                                    <label for="screenshotUrl"><fmt:message key="widget.screenshotUrl"/></label>
+                                    <input type="url" name="screenshotUrl" id="screenshotUrl"
+                                           placeholder="http://example.com/screenshot.png"
class="long"
+                                           value="<c:out value="${widget.screenshotUrl}"/>"/>
+                                </spring:bind>
+                                <form:errors path="screenshotUrl" cssClass="error"/>
+                            </p>
+
+                            <p>
+                                <spring:bind path="titleUrl">
+                                    <label for="titleUrl"><fmt:message key="widget.titleUrl"/></label>
+                                    <input type="url" name="titleUrl" id="titleUrl"
+                                           class="long" value="<c:out value="${widget.titleUrl}"/>"/>
+                                </spring:bind>
+                                <form:errors path="titleUrl" cssClass="error"/>
+                            </p>
+
+                            <p>
+                                <form:label path="author"><fmt:message key="widget.author"/></form:label>
+                                <form:input path="author" cssClass="long"/>
+                                <form:errors path="author" cssClass="error"/>
+                            </p>
+                            <p>
+                                <spring:bind path="authorEmail">
+                                    <label for="authorEmail"><fmt:message key="widget.authorEmail"/></label>
+                                    <input type="email" name="authorEmail" id="authorEmail"
class="long"
+                                            value="<c:out value="${widget.authorEmail}"/>"/>
+                                </spring:bind>
+                                <form:errors path="titleUrl" cssClass="error"/>
                             </p>
 
-                            <div>
-                                <span class="label"><fmt:message key="admin.userdata.accountstatus"/></span>
-                                <ul class="checkboxlist">
-                                    <li>
-                                        <fmt:message key="admin.userdata.enabled" var="labelEnabled"/>
-                                        <form:checkbox path="enabled" label="${labelEnabled}"
-                                                       disabled="${canChangeUserStatus ne
true}"/>
-                                    </li>
-                                    <li>
-                                        <fmt:message key="admin.userdata.expired" var="labelExpired"/>
-                                        <form:checkbox path="expired" label="${labelExpired}"
-                                                       disabled="${canChangeUserStatus ne
true}"/>
-                                    </li>
-                                    <li>
-                                        <fmt:message key="admin.userdata.locked" var="labelLocked"/>
-                                        <form:checkbox path="locked" label="${labelLocked}"
-                                                       disabled="${canChangeUserStatus ne
true}"/>
-                                    </li>
-                                </ul>
-                            </div>
-                        </fieldset>
-                        <fieldset>
-                            <span class="label"><fmt:message key="admin.userdata.authorities"/></span>
-                            <%--@elvariable id="authorities" type="org.apache.rave.portal.model.util.SearchResult<org.apache.rave.portal.model.Authority>"--%>
-                            <ul class="checkboxlist">
-                                <form:checkboxes path="authorities" items="${authorities.resultSet}"
-                                                 itemLabel="authority" itemValue="authority"
element="li" />
-                            </ul>
                         </fieldset>
                         <fieldset>
-                            <fmt:message key="page.userprofile.button" var="updateButtonText"/>
+                            <fmt:message key="admin.widgetdetail.updatebutton" var="updateButtonText"/>
                             <input type="submit" value="${updateButtonText}"/>
                         </fieldset>
                     </form:form>

Modified: incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/views/admin/widgets.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/views/admin/widgets.jsp?rev=1186745&r1=1186744&r2=1186745&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/views/admin/widgets.jsp
(original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/views/admin/widgets.jsp
Thu Oct 20 11:32:12 2011
@@ -23,12 +23,54 @@
 <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
 <%@ taglib tagdir="/WEB-INF/tags" prefix="rave" %>
 <fmt:setBundle basename="messages"/>
+<%--@elvariable id="searchResult" type="org.apache.rave.portal.model.util.SearchResult<org.apache.rave.portal.model.Widget>"--%>
 
 <fmt:message key="admin.widgets.title" var="pagetitle"/>
 <rave:rave_generic_page pageTitle="${pagetitle}">
     <rave:header pageTitle="${pagetitle}"/>
     <rave:admin_tabsheader/>
-    <div id="pageContent">
-        <p>Content goes here</p>
+    <div class="pageContent">
+        <article class="admincontent">
+            <%--<ul class="horizontal-list searchbox">
+                <li>
+                    Searchform goes here
+                </li>
+                <c:if test="${not empty searchTerm}">
+                    <li><a href="<spring:url value="/app/admin/widgets"/>"><fmt:message
key="admin.clearsearch"/></a></li>
+                </c:if>
+            </ul>--%>
+            <rave:admin_listheader/>
+            <rave:admin_paging/>
+
+            <table class="datatable widgetstable">
+                <thead>
+                <tr>
+                    <th class="largetextcell"><fmt:message key="widget.title"/></th>
+                    <th class="textcell"><fmt:message key="widget.type"/></th>
+                    <th class="textcell"><fmt:message key="widget.widgetStatus"/></th>
+                </tr>
+                </thead>
+                <tbody>
+                    <c:forEach var="widget" items="${searchResult.resultSet}">
+                        <spring:url value="/app/admin/widgetdetail/${widget.entityId}"
var="detaillink"/>
+                        <tr data-detaillink="${detaillink}">
+                            <td><a href="${detaillink}"><c:out value="${widget.title}"/></a></td>
+                            <td><a href="${detaillink}"><fmt:message key="widget.type.${widget.type}"
/></a></td>
+                            <td><a href="${detaillink}"><c:out value="${widget.widgetStatus}"/></a></td>
+                        </tr>
+                    </c:forEach>
+                </tbody>
+            </table>
+
+            <rave:admin_paging/>
+
+        </article>
     </div>
+
+    <script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.min.js"></script>
+    <script src="<spring:url value="/script/rave_admin.js"/>"></script>
+    <script>$(function() {
+        rave.admin.initAdminUi();
+    });</script>
+
 </rave:rave_generic_page>
\ No newline at end of file

Modified: incubator/rave/trunk/rave-portal-resources/src/main/webapp/css/default.css
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/css/default.css?rev=1186745&r1=1186744&r2=1186745&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/css/default.css (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/css/default.css Thu Oct 20
11:32:12 2011
@@ -739,6 +739,22 @@ span.error, label.error {
     width: 30%;
 }
 
+.admincontent figure {
+    display: block;
+    margin: 1em 0;
+    width: 100%;
+}
+.admincontent figure.screenshot img {
+    max-width: 100%;
+}
+
+.admincontent figcaption {
+    display: block;
+    margin: 0 0 1em 0;
+    padding: 0;
+    font-style: italic;
+}
+
 .formbox {
     border:1px solid #B4C4CF;
     margin:1em 10px;



Mime
View raw message