rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpie...@apache.org
Subject svn commit: r1234001 - in /incubator/rave/trunk: rave-components/rave-core/src/main/java/org/apache/rave/portal/model/ rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/ rave-components/rave-core/src/main/java/org/apache/rave/po...
Date Fri, 20 Jan 2012 16:53:53 GMT
Author: mpierce
Date: Fri Jan 20 16:53:52 2012
New Revision: 1234001

URL: http://svn.apache.org/viewvc?rev=1234001&view=rev
Log:
(RAVE-72) Committing patch contributed by Jennifer Lin

Modified:
    incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Widget.java
    incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/WidgetRepository.java
    incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/impl/JpaWidgetRepository.java
    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/repository/impl/JpaWidgetRepositoryTest.java
    incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/service/impl/DefaultWidgetServiceTest.java
    incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/WidgetStoreController.java
    incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ModelKeys.java
    incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/WidgetStoreControllerTest.java
    incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties
    incubator/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/store.jsp
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_store.js

Modified: incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Widget.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Widget.java?rev=1234001&r1=1234000&r2=1234001&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Widget.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Widget.java Fri Jan 20 16:53:52 2012
@@ -53,7 +53,10 @@ import java.util.List;
         @NamedQuery(name = Widget.WIDGET_COUNT_BY_STATUS,
                 query = Widget.SELECT_COUNT_W_FROM_WIDGET_W + Widget.WHERE_CLAUSE_STATUS),
 
-        @NamedQuery(name = Widget.WIDGET_GET_BY_URL, query = Widget.SELECT_W_FROM_WIDGET_W + Widget.WHERE_CLAUSE_URL)
+        @NamedQuery(name = Widget.WIDGET_GET_BY_URL, query = Widget.SELECT_W_FROM_WIDGET_W + Widget.WHERE_CLAUSE_URL) ,
+
+        @NamedQuery(name = Widget.WIDGET_GET_BY_TAG, query = Widget.SELECT_W_FROM_WIDGET_W + Widget.JOIN_TAGS+Widget.ORDER_BY_TITLE_ASC),
+        @NamedQuery(name = Widget.WIDGET_COUNT_BY_TAG, query = Widget.SELECT_COUNT_W_FROM_WIDGET_W + Widget.JOIN_TAGS)
 })
 public class Widget implements BasicEntity, Serializable {
     private static final long serialVersionUID = 1L;
@@ -62,6 +65,7 @@ public class Widget implements BasicEnti
     public static final String PARAM_STATUS = "widgetStatus";
     public static final String PARAM_URL = "url";
     public static final String PARAM_OWNER = "owner";
+     public static final String PARAM_TAG = "keyword";
 
     public static final String WIDGET_GET_ALL = "Widget.getAll";
     public static final String WIDGET_COUNT_ALL = "Widget.countAll";
@@ -72,6 +76,8 @@ public class Widget implements BasicEnti
     public static final String WIDGET_GET_BY_STATUS = "Widget.getByStatus";
     public static final String WIDGET_COUNT_BY_STATUS = "Widget.countByStatus";
     public static final String WIDGET_GET_BY_URL = "Widget.getByUrl";
+    public static final String WIDGET_GET_BY_TAG = "Widget.getByTag";
+    public static final String WIDGET_COUNT_BY_TAG = "Widget.countByTag";
 
     static final String SELECT_W_FROM_WIDGET_W = "SELECT w FROM Widget w ";
     static final String SELECT_COUNT_W_FROM_WIDGET_W = "SELECT count(w) FROM Widget w ";
@@ -81,8 +87,12 @@ public class Widget implements BasicEnti
     static final String WHERE_CLAUSE_STATUS = " WHERE w.widgetStatus = :" + PARAM_STATUS;
     static final String WHERE_CLAUSE_URL = " WHERE w.url = :" + PARAM_URL;
     static final String WHERE_CLAUSE_OWNER = " WHERE w.owner = :" + PARAM_OWNER;
+    static final String WIDGET_TAG_BY_KEYWORD=" (select t.widgetId from WidgetTag t where lower(t.tag.keyword)=:"+PARAM_TAG+")";
+    static final String JOIN_TAGS=" WHERE w.entityId in"+WIDGET_TAG_BY_KEYWORD;
+
     static final String ORDER_BY_TITLE_ASC = " ORDER BY w.title ASC ";
 
+
     @Id
     @Column(name = "entity_id")
     @GeneratedValue(strategy = GenerationType.TABLE, generator = "widgetIdGenerator")

Modified: incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/WidgetRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/WidgetRepository.java?rev=1234001&r1=1234000&r2=1234001&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/WidgetRepository.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/WidgetRepository.java Fri Jan 20 16:53:52 2012
@@ -149,4 +149,23 @@ public interface WidgetRepository extend
      * @return Mapping of {@link WidgetRating} objects keyed off of the widget's entityId
      */
     Map<Long, WidgetRating> getUsersWidgetRatings(long userId);
+
+    /**
+	  * Gets a List of {@link Widget}'s by performing a tag search
+	  *
+     * @param tagKeyWord free text tag keyword
+     * @param offset     start point within the resultSet (for paging)
+     * @param pageSize   maximum number of items to be returned (for paging)
+     * @return valid list of widgets, can be empty
+     */
+     List<Widget> getWidgetsByTag(String tagKeyWord, int offset, int pageSize);
+ 
+    /**
+     * Counts the total number of {@link Widget}'s that match tag keyword. Useful for paging.
+     *
+     * @param  tagKeyword  tag keyword text
+     * @return total number of {@link Widget}'s that match tag key word
+     */
+     int getCountByTag(String tagKeyword);
+
 }
\ No newline at end of file

Modified: incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/impl/JpaWidgetRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/impl/JpaWidgetRepository.java?rev=1234001&r1=1234000&r2=1234001&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/impl/JpaWidgetRepository.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/impl/JpaWidgetRepository.java Fri Jan 20 16:53:52 2012
@@ -21,6 +21,7 @@ package org.apache.rave.portal.repositor
 
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.openjpa.jdbc.kernel.exps.ToLowerCase;
 import org.apache.rave.persistence.jpa.AbstractJpaRepository;
 import org.apache.rave.portal.model.*;
 import org.apache.rave.portal.model.util.WidgetStatistics;
@@ -252,6 +253,23 @@ public class JpaWidgetRepository extends
         return map;
     }
 
+    @Override
+    public List<Widget> getWidgetsByTag(String tagKeyword, int offset, int pageSize) {
+        if (tagKeyword!=null) tagKeyword =tagKeyword.toLowerCase();
+        TypedQuery<Widget> query = manager.createNamedQuery(Widget.WIDGET_GET_BY_TAG, Widget.class);
+        query.setParameter(Widget.PARAM_TAG, tagKeyword.toLowerCase());
+        return getPagedResultList(query, offset, pageSize);
+    }
+
+    @Override
+    public int getCountByTag(String tagKeyword) {
+        if (tagKeyword!=null) tagKeyword =tagKeyword.toLowerCase();
+        Query query = manager.createNamedQuery(Widget.WIDGET_COUNT_BY_TAG);
+        query.setParameter(Widget.PARAM_TAG,tagKeyword);
+        Number countResult = (Number) query.getSingleResult();
+        return countResult.intValue();
+    }
+
     /**
      * Sets input as free text search term to a query
      *

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=1234001&r1=1234000&r2=1234001&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 Fri Jan 20 16:53:52 2012
@@ -156,4 +156,15 @@ public interface WidgetService {
      */
     @PreAuthorize("hasPermission(#widget.entityId, 'org.apache.rave.portal.model.Widget', 'update')")
     void updateWidget(Widget widget);
+
+/**
+     * Gets a SearchResult for {@link Widget}'s by performing a tag keyword search
+     *
+     * @param tagKeyWord  tag keyword
+     * @param offset     start point within the resultSet (for paging)
+     * @param pageSize   maximum number of items to be returned (for paging)
+     * @return SearchResult
+     */
+    SearchResult<Widget> getWidgetsByTag(String tagKeyWord, int offset, int pageSize);
+
 }

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=1234001&r1=1234000&r2=1234001&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 Fri Jan 20 16:53:52 2012
@@ -123,7 +123,7 @@ public class DefaultWidgetService implem
         final User user = userRepository.get(ownerId);
         final int count = widgetRepository.getCountByOwner(user, offset, pageSize);
         final List<Widget> widgets = widgetRepository.getByOwner(user, offset, pageSize);
-        final SearchResult<Widget> searchResult = new SearchResult<Widget>(widgets,  count);
+        final SearchResult<Widget> searchResult = new SearchResult<Widget>(widgets, count);
         searchResult.setOffset(offset);
         searchResult.setPageSize(pageSize);
         return searchResult;
@@ -164,4 +164,14 @@ public class DefaultWidgetService implem
         widgetRepository.save(widget);
     }
 
+    @Override
+    public SearchResult<Widget> getWidgetsByTag(String tagKeyWord, int offset, int pageSize) {
+
+        int count = widgetRepository.getCountByTag(tagKeyWord);
+        List<Widget> widgets = widgetRepository.getWidgetsByTag(tagKeyWord, offset, pageSize);
+        SearchResult<Widget> searchResult = new SearchResult<Widget>(widgets, count);
+        searchResult.setOffset(offset);
+        searchResult.setPageSize(pageSize);
+        return searchResult;
+    }
 }

Modified: incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/repository/impl/JpaWidgetRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/repository/impl/JpaWidgetRepositoryTest.java?rev=1234001&r1=1234000&r2=1234001&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/repository/impl/JpaWidgetRepositoryTest.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/repository/impl/JpaWidgetRepositoryTest.java Fri Jan 20 16:53:52 2012
@@ -43,6 +43,7 @@ import java.util.Map;
 import static junit.framework.Assert.*;
 import static org.hamcrest.CoreMatchers.*;
 import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Test class for {@link org.apache.rave.portal.repository.impl.JpaWidgetRepository}
@@ -355,9 +356,31 @@ public class JpaWidgetRepositoryTest {
         widget = repository.get(1L);
         assertNotNull(widget);
         assertEquals(widget.getTags().iterator().next().getTag().getKeyword(), "wikipedia");
-
-
     }
 
+    @Test
+    public void getWidgetsByTag() {
+      String tag = "news";
+        List<Widget> widgets = repository.getWidgetsByTag(tag, 0, 10);
+        assertTrue(widgets.size() == 1);
+        assertTrue(widgets.iterator().next().getEntityId() == 3);
+        assertTrue(repository.getCountByTag(tag) == 1);
+
+        tag = "wikipedia";
+        widgets = repository.getWidgetsByTag(tag, 0, 10);
+        assertTrue(widgets.size() == 1);
+        assertTrue(widgets.iterator().next().getEntityId() == 1);
+        assertTrue(repository.getCountByTag(tag) == 1);
+
+        tag = "aaanews";
+        widgets = repository.getWidgetsByTag(tag, 0, 10);
+        assertTrue(widgets.size() == 0);
+        assertTrue(repository.getCountByTag(tag) == 0);
+
+        widgets = repository.getWidgetsByTag("NEWS", 0, 10);
+        assertTrue(widgets.size() == 1);
+        assertTrue(widgets.iterator().next().getEntityId() == 3);
+        assertTrue(repository.getCountByTag("NEWS") == 1);
+    }
 
 }

Modified: incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/service/impl/DefaultWidgetServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/service/impl/DefaultWidgetServiceTest.java?rev=1234001&r1=1234000&r2=1234001&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/service/impl/DefaultWidgetServiceTest.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/service/impl/DefaultWidgetServiceTest.java Fri Jan 20 16:53:52 2012
@@ -35,19 +35,9 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
-import static org.easymock.EasyMock.createMock;
-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;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.easymock.EasyMock.*;
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
 
 /**
  * Test for {@link DefaultWidgetService}
@@ -74,7 +64,7 @@ public class DefaultWidgetServiceTest {
 
         List<Widget> result = widgetService.getAllWidgets().getResultSet();
         assertThat(result, is(sameInstance(widgets)));
-        
+
         verify(widgetRepository);
     }
 
@@ -295,7 +285,7 @@ public class DefaultWidgetServiceTest {
         Widget savedWidget = widgetService.registerNewWidget(widget);
         assertNotNull(savedWidget);
         assertEquals(widget.getEntityId(), savedWidget.getEntityId());
-        
+
         verify(widgetRepository);
     }
 
@@ -342,8 +332,11 @@ public class DefaultWidgetServiceTest {
     public void allWidgetStatistics() {
         expect(widgetRepository.getAllWidgetStatistics(1L)).andReturn(new HashMap<Long, WidgetStatistics>());
         replay(widgetRepository);
-    
+
         widgetService.getAllWidgetStatistics(1L);
         verify(widgetRepository);
     }
+
+
+
 }

Modified: incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/WidgetStoreController.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/WidgetStoreController.java?rev=1234001&r1=1234000&r2=1234001&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/WidgetStoreController.java (original)
+++ incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/WidgetStoreController.java Fri Jan 20 16:53:52 2012
@@ -36,6 +36,7 @@ import org.springframework.beans.factory
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.WebDataBinder;
 import org.springframework.web.bind.annotation.*;
 
 @Controller
@@ -52,14 +53,18 @@ public class WidgetStoreController {
 
     private final PortalPreferenceService preferenceService;
 
+    private final TagService tagService;
+
 
     @Autowired
     public WidgetStoreController(WidgetService widgetService, NewWidgetValidator validator,
-                                 UserService userService, PortalPreferenceService preferenceService) {
+                                 UserService userService, PortalPreferenceService preferenceService,
+                                 TagService tagService) {
         this.widgetService = widgetService;
         this.widgetValidator = validator;
         this.userService = userService;
         this.preferenceService = preferenceService;
+        this.tagService=tagService;
 
     }
 
@@ -79,6 +84,7 @@ public class WidgetStoreController {
                 widgetService.getPublishedWidgets(offset, getPageSize()));
         model.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId);
         model.addAttribute(ModelKeys.WIDGETS_STATISTICS, widgetService.getAllWidgetStatistics(user.getEntityId()));
+        model.addAttribute(ModelKeys.TAGS, tagService.getAllTags());
         return ViewNames.STORE;
     }
 
@@ -90,6 +96,7 @@ public class WidgetStoreController {
                 widgetService.getWidgetsByOwner(user.getEntityId(), offset, getPageSize()));
         model.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId);
         model.addAttribute(ModelKeys.WIDGETS_STATISTICS, widgetService.getAllWidgetStatistics(user.getEntityId()));
+        model.addAttribute(ModelKeys.TAGS, tagService.getAllTags());
         return ViewNames.STORE;
     }
 
@@ -105,10 +112,10 @@ public class WidgetStoreController {
     public String viewWidget(Model model, @PathVariable long widgetId, @RequestParam long referringPageId) {
         model.addAttribute(ModelKeys.WIDGET, widgetService.getWidget(widgetId));
         model.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId);
-
         final User user = userService.getAuthenticatedUser();
         model.addAttribute(ModelKeys.WIDGET_STATISTICS, widgetService.getWidgetStatistics(widgetId, user.getEntityId()));
         model.addAttribute(ModelKeys.USER_PROFILE, user);
+        model.addAttribute(ModelKeys.TAGS, tagService.getAllTags());
         return ViewNames.WIDGET;
     }
 
@@ -132,7 +139,31 @@ public class WidgetStoreController {
         model.addAttribute(ModelKeys.SEARCH_TERM, searchTerm);
         model.addAttribute(ModelKeys.OFFSET, offset);
         model.addAttribute(ModelKeys.WIDGETS_STATISTICS, widgetService.getAllWidgetStatistics(user.getEntityId()));
+        model.addAttribute(ModelKeys.TAGS, tagService.getAllTags());
+       return ViewNames.STORE;
+    }
 
+    /**
+     * Performs a search in the widget store by tag keyword
+     *
+     * @param model           {@link Model} map
+     * @param referringPageId the source {@link org.apache.rave.portal.model.Page } ID
+     * @param keyword     free text tag keyword
+     * @param offset          offset within the total amount of results (to enable paging)
+     * @return the view name of the main store page
+     */
+    @RequestMapping(method = RequestMethod.GET, value = "tag")
+    public String viewTagResult(Model model, @RequestParam long referringPageId,
+                                   @RequestParam String keyword,
+                                   @RequestParam(required = false, defaultValue = "0") int offset) {
+        User user = userService.getAuthenticatedUser();
+        model.addAttribute(ModelKeys.WIDGETS,
+                widgetService.getWidgetsByTag(keyword, offset, getPageSize()));
+         model.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId);
+        model.addAttribute(ModelKeys.OFFSET, offset);
+        model.addAttribute(ModelKeys.WIDGETS_STATISTICS, widgetService.getAllWidgetStatistics(user.getEntityId()));
+        model.addAttribute(ModelKeys.TAGS, tagService.getAllTags());
+        model.addAttribute(ModelKeys.SELECTED_TAG, keyword);
         return ViewNames.STORE;
     }
 
@@ -188,4 +219,6 @@ public class WidgetStoreController {
             return MAXIMUM_WIDGETS_PER_PAGE;
         }
     }
+
+
 }

Modified: incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ModelKeys.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ModelKeys.java?rev=1234001&r1=1234000&r2=1234001&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ModelKeys.java (original)
+++ incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ModelKeys.java Fri Jan 20 16:53:52 2012
@@ -43,4 +43,5 @@ public class ModelKeys {
     public static final String USER_MAP = "userMap";
     public static final String PORTAL_SETTINGS = "portalSettings";
     public static final String TAGS="tags" ;
+    public static final String SELECTED_TAG="selectedTag" ;
 }
\ No newline at end of file

Modified: incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/WidgetStoreControllerTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/WidgetStoreControllerTest.java?rev=1234001&r1=1234000&r2=1234001&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/WidgetStoreControllerTest.java (original)
+++ incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/WidgetStoreControllerTest.java Fri Jan 20 16:53:52 2012
@@ -68,7 +68,7 @@ public class WidgetStoreControllerTest {
     private static final long REFERRER_ID = 35L;
     private WidgetStoreController controller;
     private WidgetService widgetService;
-
+    private TagService tagService;
     private User validUser;
     private WidgetStatistics widgetStatistics;
     private Map<Long, WidgetStatistics> allWidgetStatisticsMap;
@@ -83,6 +83,7 @@ public class WidgetStoreControllerTest {
         allWidgetStatisticsMap.put(WIDGET_ID, widgetStatistics);
 
         widgetService = createMock(WidgetService.class);
+        tagService = createMock(TagService.class);
 
         UserService userService = createMock(UserService.class);
         expect(userService.getAuthenticatedUser()).andReturn(validUser);
@@ -94,7 +95,7 @@ public class WidgetStoreControllerTest {
 
         NewWidgetValidator widgetValidator = new NewWidgetValidator(widgetService);
         controller = new WidgetStoreController(widgetService, widgetValidator, userService,
-                preferenceService);
+                preferenceService, tagService);
     }
 
     @Test
@@ -116,6 +117,8 @@ public class WidgetStoreControllerTest {
         assertThat(model.containsAttribute(ModelKeys.WIDGETS_STATISTICS), is(true));
         assertThat((Long) model.asMap().get(ModelKeys.REFERRING_PAGE_ID), is(equalTo(REFERRER_ID)));
         assertThat(widgets, is(sameInstance(emptyResult.getResultSet())));
+        assertThat(model.containsAttribute(ModelKeys.TAGS), is(true));
+
     }
 
     @Test
@@ -136,6 +139,8 @@ public class WidgetStoreControllerTest {
         assertThat(model.containsAttribute(ModelKeys.WIDGETS_STATISTICS), is(true));
         assertThat((Long) model.asMap().get(ModelKeys.REFERRING_PAGE_ID), is(equalTo(REFERRER_ID)));
         assertThat(widgets, is(sameInstance(emptyResult.getResultSet())));
+        assertThat(model.containsAttribute(ModelKeys.TAGS), is(true));
+
     }
 
     @Test
@@ -155,6 +160,7 @@ public class WidgetStoreControllerTest {
         assertThat(model.containsAttribute(ModelKeys.WIDGET_STATISTICS), is(true));
         assertThat(((Widget) model.asMap().get(ModelKeys.WIDGET)), is(sameInstance(w)));
         assertNull(model.asMap().get("widgetRating"));
+
     }
 
     @Test
@@ -187,6 +193,8 @@ public class WidgetStoreControllerTest {
         assertThat(model.containsAttribute(ModelKeys.WIDGETS_STATISTICS), is(true));
         assertEquals(offset, modelMap.get(ModelKeys.OFFSET));
         assertEquals(result, modelMap.get(ModelKeys.WIDGETS));
+        assertThat(model.containsAttribute(ModelKeys.TAGS), is(true));
+
     }
 
     @Test

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=1234001&r1=1234000&r2=1234001&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 Fri Jan 20 16:53:52 2012
@@ -116,6 +116,7 @@ page.store.list.search.noresult=No widge
 page.store.list.search.result.x.to.y=Showing {0} - {1} of {2} widgets that match ''{3}''
 page.store.list.widgets.mine=My Widgets
 page.store.list.widgets.all=All Widgets
+page.store.list.widgets.tag=By Tag:
 
 page.userprofile.title=Update user profile
 page.userprofile.button=Update profile

Modified: incubator/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties?rev=1234001&r1=1234000&r2=1234001&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties Fri Jan 20 16:53:52 2012
@@ -125,6 +125,7 @@ page.store.list.search.noresult=Geen wid
 page.store.list.search.result.x.to.y={0} - {1} van {2} widgets getoond welke overeenkomen met ''{3}''
 page.store.list.widgets.mine=Mijn widgets
 page.store.list.widgets.all=Alle widgets
+page.store.list.widgets.tag= Door  Tag:
 
 page.userprofile.title=Update gebruikersprofiel
 page.userprofile.button=Update profiel

Modified: incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/store.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/store.jsp?rev=1234001&r1=1234000&r2=1234001&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/store.jsp (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/store.jsp Fri Jan 20 16:53:52 2012
@@ -56,227 +56,254 @@
 
 <div id="content" class="pageContent">
 
-    <section class="storeSearch">
-        <form action="<c:url value="/app/store/search"/>" method="GET">
-            <fieldset>
-                <input type="hidden" name="referringPageId" value="${referringPageId}">
-
-                <h2>
-                    <label for="searchTerm"><fmt:message key="page.store.search"/></label>
-                </h2>
-                <p>
-                    <input type="search" id="searchTerm" name="searchTerm" value="<c:out value="${searchTerm}"/>"/>
-                    <fmt:message key="page.store.search.button" var="searchButtonText"/>
-
-                    <input type="submit" value="${searchButtonText}"/>
-                    <c:if test="${not empty searchTerm}">
-                        <a href="<spring:url value="/app/store?referringPageId=${referringPageId}"/>">
-                            <fmt:message key="admin.clearsearch"/></a>
-                    </c:if>
-                </p>
-            </fieldset>
-        </form>
-
-        <div>
-            <a href="<spring:url value="/app/store/mine?referringPageId=${referringPageId}"/>"><fmt:message key="page.store.list.widgets.mine"/></a>
-        </div>
-        <div>
-            <a href="<spring:url value="/app/store?referringPageId=${referringPageId}"/>"><fmt:message key="page.store.list.widgets.all"/></a>
-        </div>
-    </section>
-
-    <section class="storeBox">
-        <c:choose>
-            <c:when test="${empty searchTerm and (empty widgets or widgets.totalResults eq 0)}">
-                <%-- Empty db --%>
-                <fmt:message key="page.store.list.noresult" var="listheader"/>
-            </c:when>
-            <c:when test="${empty searchTerm}">
-                <fmt:message key="page.store.list.result.x.to.y" var="listheader">
-                    <fmt:param value="${widgets.offset + 1}"/>
-                    <fmt:param value="${widgets.offset + fn:length(widgets.resultSet)}"/>
-                    <fmt:param value="${widgets.totalResults}"/>
-                </fmt:message>
-            </c:when>
-            <c:when test="${not empty searchTerm and widgets.totalResults eq 0}">
-                <fmt:message key="page.store.list.search.noresult" var="listheader">
-                    <fmt:param><c:out value="${searchTerm}"/></fmt:param>
-                </fmt:message>
-            </c:when>
-            <c:otherwise>
-                <fmt:message key="page.store.list.search.result.x.to.y" var="listheader">
-                    <fmt:param value="${widgets.offset + 1}"/>
-                    <fmt:param value="${widgets.offset + fn:length(widgets.resultSet)}"/>
-                    <fmt:param value="${widgets.totalResults}"/>
-                    <fmt:param><c:out value="${searchTerm}"/></fmt:param>
-                </fmt:message>
-            </c:otherwise>
-        </c:choose>
-        <h2>${listheader}</h2>
-            <%--@elvariable id="widgets" type="org.apache.rave.portal.model.util.SearchResult"--%>
-        <c:if test="${widgets.totalResults gt 0}">
-            <c:if test="${widgets.numberOfPages gt 1}">
-
-                <ul class="paging">
-                    <c:forEach var="i" begin="1" end="${widgets.numberOfPages}">
-                        <c:url var="pageUrl" value="">
-                            <c:param name="referringPageId" value="${referringPageId}"/>
-                            <c:param name="searchTerm" value="${searchTerm}"/>
-                            <c:param name="offset" value="${(i - 1) * widgets.pageSize}"/>
-                        </c:url>
-
-                        <li>
-                            <c:choose>
-                                <c:when test="${i eq widgets.currentPage}">
-                                    <span class="currentPage">${i}</span>
-                                </c:when>
-                                <c:otherwise>
-                                    <a href="<c:out value="${pageUrl}"/>">${i}</a>
-                                </c:otherwise>
-                            </c:choose>
-                        </li>
+<section class="storeSearch">
+    <form action="<c:url value="/app/store/search"/>" method="GET">
+        <fieldset>
+            <input type="hidden" name="referringPageId" value="${referringPageId}">
+            <h2>
+                <label for="searchTerm"><fmt:message key="page.store.search"/></label>
+            </h2>
+            <p>
+                <input type="search" id="searchTerm" name="searchTerm" value="<c:out value="${searchTerm}"/>"/>
+                <fmt:message key="page.store.search.button" var="searchButtonText"/>
+                <input type="submit" value="${searchButtonText}"/>
+                <c:if test="${not empty searchTerm}">
+                    <a href="<spring:url value="/app/store?referringPageId=${referringPageId}"/>">
+                        <fmt:message key="admin.clearsearch"/></a>
+                </c:if>
+            </p>
+            <c:if test="${not empty tags}">
+                <fmt:message key="page.store.list.widgets.tag"/>
+                <select name="tagList" id="tagList" style="width:100px" >
+                    <option value="  "></option>
+                    <c:forEach var="tag" items="${tags}">
+                        <c:choose>
+                            <c:when test="${selectedTag==tag.keyword}">
+                                <option selected>
+                            </c:when>
+                            <c:otherwise>
+                                <option>
+                            </c:otherwise>
+                        </c:choose>
+                        <c:out value="${tag.keyword}"/>
+                        </option>
                     </c:forEach>
-                </ul>
-
+                </select>
             </c:if>
+        </fieldset>
+    </form>
 
-            <ul class="storeItems">
-                    <%--@elvariable id="widget" type="org.apache.rave.portal.model.Widget"--%>
-                <c:forEach var="widget"
-                           items="${widgets.resultSet}">
-                    <%--@elvariable id="widgetsStatistics" type="org.apache.rave.portal.model.util.WidgetStatistics"--%>
-                    <c:set var="widgetStatistics" value="${widgetsStatistics[widget.entityId]}" />
-                    <li class="storeItem">
-
-                        <div class="storeItemLeft">
-                            <c:if test="${not empty widget.thumbnailUrl}">
-                                <img class="storeWidgetThumbnail" src="${widget.thumbnailUrl}"
-                                     title="<c:out value="${widget.title}"/>" alt=""
-                                     width="120" height="60"/>
-                            </c:if>
-
-                            <div id="widgetAdded_${widget.entityId}" class="storeButton">
-                                <button class="storeItemButton"
-                                        id="addWidget_${widget.entityId}"
-                                        onclick="rave.api.rpc.addWidgetToPage({widgetId: ${widget.entityId}, pageId: ${referringPageId}, buttonId: this.id});">
-                                    <fmt:message key="page.widget.addToPage"/>
-                                </button>
-                            </div>
+    <div>
+        <a href="<spring:url value="/app/store/mine?referringPageId=${referringPageId}"/>"><fmt:message
+                key="page.store.list.widgets.mine"/></a>
+    </div>
+    <div>
+        <a href="<spring:url value="/app/store?referringPageId=${referringPageId}"/>"><fmt:message
+                key="page.store.list.widgets.all"/></a>
+    </div>
+</section>
+
+<section class="storeBox">
+    <c:choose>
+        <c:when test="${empty searchTerm and (empty widgets or widgets.totalResults eq 0)}">
+            <%-- Empty db --%>
+            <fmt:message key="page.store.list.noresult" var="listheader"/>
+        </c:when>
+        <c:when test="${empty searchTerm}">
+            <fmt:message key="page.store.list.result.x.to.y" var="listheader">
+                <fmt:param value="${widgets.offset + 1}"/>
+                <fmt:param value="${widgets.offset + fn:length(widgets.resultSet)}"/>
+                <fmt:param value="${widgets.totalResults}"/>
+            </fmt:message>
+        </c:when>
+        <c:when test="${not empty searchTerm and widgets.totalResults eq 0}">
+            <fmt:message key="page.store.list.search.noresult" var="listheader">
+                <fmt:param><c:out value="${searchTerm}"/></fmt:param>
+            </fmt:message>
+        </c:when>
+        <c:otherwise>
+            <fmt:message key="page.store.list.search.result.x.to.y" var="listheader">
+                <fmt:param value="${widgets.offset + 1}"/>
+                <fmt:param value="${widgets.offset + fn:length(widgets.resultSet)}"/>
+                <fmt:param value="${widgets.totalResults}"/>
+                <fmt:param><c:out value="${searchTerm}"/></fmt:param>
+            </fmt:message>
+        </c:otherwise>
+    </c:choose>
+    <h2>${listheader}</h2>
+    <%--@elvariable id="widgets" type="org.apache.rave.portal.model.util.SearchResult"--%>
+    <c:if test="${widgets.totalResults gt 0}">
+        <c:if test="${widgets.numberOfPages gt 1}">
+
+            <ul class="paging">
+                <c:forEach var="i" begin="1" end="${widgets.numberOfPages}">
+                    <c:url var="pageUrl" value="">
+                        <c:param name="referringPageId" value="${referringPageId}"/>
+                        <c:param name="searchTerm" value="${searchTerm}"/>
+                        <c:param name="offset" value="${(i - 1) * widgets.pageSize}"/>
+                    </c:url>
+
+                    <li>
+                        <c:choose>
+                            <c:when test="${i eq widgets.currentPage}">
+                                <span class="currentPage">${i}</span>
+                            </c:when>
+                            <c:otherwise>
+                                <a href="<c:out value="${pageUrl}"/>">${i}</a>
+                            </c:otherwise>
+                        </c:choose>
+                    </li>
+                </c:forEach>
+            </ul>
+
+        </c:if>
 
+        <ul class="storeItems">
+            </br>
+                <%--@elvariable id="widget" type="org.apache.rave.portal.model.Widget"--%>
+            <c:forEach var="widget"
+                       items="${widgets.resultSet}">
+                <%--@elvariable id="widgetsStatistics" type="org.apache.rave.portal.model.util.WidgetStatistics"--%>
+                <c:set var="widgetStatistics" value="${widgetsStatistics[widget.entityId]}"/>
+                <li class="storeItem">
+
+                    <div class="storeItemLeft">
+                        <c:if test="${not empty widget.thumbnailUrl}">
+                            <img class="storeWidgetThumbnail" src="${widget.thumbnailUrl}"
+                                 title="<c:out value="${widget.title}"/>" alt=""
+                                 width="120" height="60"/>
+                        </c:if>
+
+                        <div id="widgetAdded_${widget.entityId}" class="storeButton">
+                            <button class="storeItemButton"
+                                    id="addWidget_${widget.entityId}"
+                                    onclick="rave.api.rpc.addWidgetToPage({widgetId: ${widget.entityId}, pageId: ${referringPageId}, buttonId: this.id});">
+                                <fmt:message key="page.widget.addToPage"/>
+                            </button>
                         </div>
 
-                        <div class="storeItemCenter">
+                    </div>
+
+                    <div class="storeItemCenter">
 
-                            <a id="widget-${widget.entityId}-title"
-                               class="secondaryPageItemTitle"
-                               href="<spring:url value="/app/store/widget/${widget.entityId}" />?referringPageId=${referringPageId}">
-                                <c:out value="${widget.title}"/>
-                            </a>
-                            <c:if test="${widget.disableRendering}">
-                                <div class="storeWidgetDisabled">
-                                    <span class="widget-disabled-icon-store ui-icon ui-icon-alert" title="<fmt:message key="widget.chrome.disabled"/>"></span>
-                                    <c:out value="${widget.disableRenderingMessage}" escapeXml="true" />
-                                </div>
-                            </c:if>
-                            <c:if test="${not empty widget.author}">
-                                <div class="storeWidgetAuthor"><fmt:message key="widget.author"/>: <c:out
-                                        value="${widget.author}"/></div>
-                            </c:if>
-                            <c:if test="${not empty widget.description}">
-                                <div class="storeWidgetDesc"><c:out
-                                        value="${fn:substring(widget.description, 0, 200)}..."/></div>
-                            </c:if>
-                            <div class="widgetRating">
-                                <fmt:message key="page.widget.rate"/>
-
-                                <div id="rating-${widget.entityId}" class="ratingButtons">
-                                    <form>
-				    					<input type="hidden" id="rate-${widget.entityId}"
-							 				   value="${widgetsStatistics[widget.entityId]!=null?widgetsStatistics[widget.entityId].userRating:"-1"}">
-				    				</form>
-                                    <input type="radio" id="like-${widget.entityId}" class="widgetLikeButton"
-                                            name="rating-${widget.entityId}"${widgetsStatistics[widget.entityId].userRating==10?" checked='true'":""}>
-                                    <label for="like-${widget.entityId}"></label>
-                                    <input type="radio" id="dislike-${widget.entityId}" class="widgetDislikeButton"
-                                            name="rating-${widget.entityId}"${widgetsStatistics[widget.entityId].userRating==0?" checked='true'":""}>
-                                    <label for="dislike-${widget.entityId}"> </label>
+                        <a id="widget-${widget.entityId}-title"
+                           class="secondaryPageItemTitle"
+                           href="<spring:url value="/app/store/widget/${widget.entityId}" />?referringPageId=${referringPageId}">
+                            <c:out value="${widget.title}"/>
+                        </a>
+                        <c:if test="${widget.disableRendering}">
+                            <div class="storeWidgetDisabled">
+                                <span class="widget-disabled-icon-store ui-icon ui-icon-alert"
+                                      title="<fmt:message key="widget.chrome.disabled"/>"></span>
+                                <c:out value="${widget.disableRenderingMessage}" escapeXml="true"/>
+                            </div>
+                        </c:if>
+                        <c:if test="${not empty widget.author}">
+                            <div class="storeWidgetAuthor"><fmt:message key="widget.author"/>: <c:out
+                                    value="${widget.author}"/></div>
+                        </c:if>
+                        <c:if test="${not empty widget.description}">
+                            <div class="storeWidgetDesc"><c:out
+                                    value="${fn:substring(widget.description, 0, 200)}..."/></div>
+                        </c:if>
+                        <div class="widgetRating">
+                            <fmt:message key="page.widget.rate"/>
+
+                            <div id="rating-${widget.entityId}" class="ratingButtons">
+                                <form>
+                                    <input type="hidden" id="rate-${widget.entityId}"
+                                           value="${widgetsStatistics[widget.entityId]!=null?widgetsStatistics[widget.entityId].userRating:"-1"}">
+                                </form>
+                                <input type="radio" id="like-${widget.entityId}" class="widgetLikeButton"
+                                       name="rating-${widget.entityId}"${widgetsStatistics[widget.entityId].userRating==10?" checked='true'":""}>
+                                <label for="like-${widget.entityId}"></label>
+                                <input type="radio" id="dislike-${widget.entityId}" class="widgetDislikeButton"
+                                       name="rating-${widget.entityId}"${widgetsStatistics[widget.entityId].userRating==0?" checked='true'":""}>
+                                <label for="dislike-${widget.entityId}"> </label>
 
-                                    <!-- Displaying the likes and dislikes rating along with total votes -->
+                                <!-- Displaying the likes and dislikes rating along with total votes -->
 
-                                </div>
                             </div>
-                            <c:if test="${not empty widget.tags}">
-                                <table class="widgetTags">
-                                    <tr>
-                                        <td>
-                                            <fmt:message key="page.widget.tags.title"/>
-                                        </td>
-                                        <c:forEach var="tag" items="${widget.tags}">
-                                            <td class="storeWidgetDesc"><c:out value="${tag.tag.keyword}"/></td>
-                                        </c:forEach>
-                                    </tr>
-                                </table>
-                            </c:if>
-                            <ul class="horizontal-list">
-                            	<!-- display total likes -->
-                                <li>
-                                  	<c:set var="widgetLikes">
-                                   		${widgetsStatistics[widget.entityId]!=null?widgetsStatistics[widget.entityId].totalLike:"0"}
-                                   	</c:set>
-                                   	<fmt:message key="page.widget.rate.likes"/><label id="totalLikes-${widget.entityId}" data-rave-widget-likes="${widgetLikes}">${widgetLikes}</label>
-                                </li>
-                                <!-- display total dislikes  -->
-                                <li>
-                                  	<c:set var="widgetDislikes">
-                                   		${widgetsStatistics[widget.entityId]!=null?widgetsStatistics[widget.entityId].totalDislike:"0"}
-                                   	</c:set>
-                                   	<fmt:message key="page.widget.rate.dislikes"/><label id="totalDislikes-${widget.entityId}" data-rave-widget-dislikes="${widgetDislikes}">${widgetDislikes}</label>
-                            	</li>
-                            	<li class="widgetUserCount">
-                                	<c:set var="widgetUserCountGreaterThanZero" value="${widgetStatistics != null && widgetStatistics.totalUserCount > 0}" />
-                                	<c:if test="${widgetUserCountGreaterThanZero}"><a href="javascript:void(0);" onclick="rave.displayUsersOfWidget(${widget.entityId});"></c:if>
-                                    	<fmt:formatNumber groupingUsed="true" value="${widgetStatistics!=null?widgetStatistics.totalUserCount:0}" />&nbsp;<fmt:message key="page.widget.usercount"/>
-                                	<c:if test="${widgetUserCountGreaterThanZero}"></a></c:if>
-                            	</li>
-                            </ul>
                         </div>
-
-                        <div class="clear-float"></div>
+                        <c:if test="${not empty widget.tags}">
+                            <table class="widgetTags">
+                                <tr>
+                                    <td>
+                                        <fmt:message key="page.widget.tags.title"/>
+                                    </td>
+                                    <c:forEach var="tag" items="${widget.tags}">
+                                        <td class="storeWidgetDesc"><c:out value="${tag.tag.keyword}"/></td>
+                                    </c:forEach>
+                                </tr>
+                            </table>
+                        </c:if>
+                        <ul class="horizontal-list">
+                            <!-- display total likes -->
+                            <li>
+                                <c:set var="widgetLikes">
+                                    ${widgetsStatistics[widget.entityId]!=null?widgetsStatistics[widget.entityId].totalLike:"0"}
+                                </c:set>
+                                <fmt:message key="page.widget.rate.likes"/><label id="totalLikes-${widget.entityId}"
+                                                                                  data-rave-widget-likes="${widgetLikes}">${widgetLikes}</label>
+                            </li>
+                            <!-- display total dislikes  -->
+                            <li>
+                                <c:set var="widgetDislikes">
+                                    ${widgetsStatistics[widget.entityId]!=null?widgetsStatistics[widget.entityId].totalDislike:"0"}
+                                </c:set>
+                                <fmt:message key="page.widget.rate.dislikes"/><label
+                                    id="totalDislikes-${widget.entityId}"
+                                    data-rave-widget-dislikes="${widgetDislikes}">${widgetDislikes}</label>
+                            </li>
+                            <li class="widgetUserCount">
+                                <c:set var="widgetUserCountGreaterThanZero"
+                                       value="${widgetStatistics != null && widgetStatistics.totalUserCount > 0}"/>
+                                <c:if test="${widgetUserCountGreaterThanZero}"><a href="javascript:void(0);"
+                                                                                  onclick="rave.displayUsersOfWidget(${widget.entityId});"></c:if>
+                                <fmt:formatNumber groupingUsed="true"
+                                                  value="${widgetStatistics!=null?widgetStatistics.totalUserCount:0}"/>&nbsp;<fmt:message
+                                        key="page.widget.usercount"/>
+                                <c:if test="${widgetUserCountGreaterThanZero}"></a></c:if>
+                            </li>
+                        </ul>
+                    </div>
+
+                    <div class="clear-float"></div>
+                </li>
+            </c:forEach>
+        </ul>
+
+        <c:if test="${widgets.numberOfPages gt 1}">
+
+            <ul class="paging">
+                <c:forEach var="i" begin="1" end="${widgets.numberOfPages}">
+                    <c:url var="pageUrl" value="">
+                        <c:param name="referringPageId" value="${referringPageId}"/>
+                        <c:param name="searchTerm" value="${searchTerm}"/>
+                        <c:param name="offset" value="${(i - 1) * widgets.pageSize}"/>
+                    </c:url>
+
+                    <li>
+                        <c:choose>
+                            <c:when test="${i eq widgets.currentPage}">
+                                <span class="currentPage">${i}</span>
+                            </c:when>
+                            <c:otherwise>
+                                <a href="<c:out value="${pageUrl}"/>">${i}</a>
+                            </c:otherwise>
+                        </c:choose>
                     </li>
                 </c:forEach>
             </ul>
 
-            <c:if test="${widgets.numberOfPages gt 1}">
-
-                <ul class="paging">
-                    <c:forEach var="i" begin="1" end="${widgets.numberOfPages}">
-                        <c:url var="pageUrl" value="">
-                            <c:param name="referringPageId" value="${referringPageId}"/>
-                            <c:param name="searchTerm" value="${searchTerm}"/>
-                            <c:param name="offset" value="${(i - 1) * widgets.pageSize}"/>
-                        </c:url>
-
-                        <li>
-                            <c:choose>
-                                <c:when test="${i eq widgets.currentPage}">
-                                    <span class="currentPage">${i}</span>
-                                </c:when>
-                                <c:otherwise>
-                                    <a href="<c:out value="${pageUrl}"/>">${i}</a>
-                                </c:otherwise>
-                            </c:choose>
-                        </li>
-                    </c:forEach>
-                </ul>
-
-            </c:if>
         </c:if>
-    </section>
+    </c:if>
+</section>
 
 </div>
 
-    <script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.4.min.js"></script>
-    <script src="//ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/jquery-ui.min.js"></script>
+<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.4.min.js"></script>
+<script src="//ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/jquery-ui.min.js"></script>
 <!--[if lt IE 9]><script src=//css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js></script><![endif]-->
 <script src="<spring:url value="/script/rave.js"/>"></script>
 <script src="<spring:url value="/script/rave_api.js"/>"></script>
@@ -286,5 +313,8 @@
     $(function () {
         rave.setContext("<spring:url value="/app/" />");
         rave.store.init();
+        rave.store.initWidgetsTag('<c:out value="${referringPageId}"/>');
     });
+
+
 </script>
\ No newline at end of file

Modified: incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_store.js
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_store.js?rev=1234001&r1=1234000&r2=1234001&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_store.js (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_store.js Fri Jan 20 16:53:52 2012
@@ -156,15 +156,26 @@ rave.store = rave.store || (function() {
                 })
             }
         })
-
-
     }
 
+    function initWidgetsTag(referringPageId) {
+           // tag list box
+           $("#tagList").change(function() {
+               var selected = $("#tagList option:selected").text();
+               selected=$.trim(selected)
+               if (selected.length > 1) {
+                   document.location.href = rave.getContext() + "store/tag?keyword=" + selected
+                           +"&referringPageId="+referringPageId;
+               }
+           });
+
+       }
 
     return {
         init: initRatings,
         initComments: initComments,
-        initTags: initTags
+        initTags: initTags,
+        initWidgetsTag:initWidgetsTag
     };                             
     
 }());
\ No newline at end of file



Mime
View raw message