incubator-rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlu...@apache.org
Subject svn commit: r1230175 [2/2] - 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/r...
Date Wed, 11 Jan 2012 18:18:49 GMT
Modified: incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/api/rest/WidgetApi.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/api/rest/WidgetApi.java?rev=1230175&r1=1230174&r2=1230175&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/api/rest/WidgetApi.java (original)
+++ incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/api/rest/WidgetApi.java Wed Jan 11 18:18:48 2012
@@ -19,13 +19,8 @@
 
 package org.apache.rave.portal.web.api.rest;
 
-import org.apache.rave.portal.model.Person;
-import org.apache.rave.portal.model.User;
-import org.apache.rave.portal.model.WidgetComment;
-import org.apache.rave.portal.model.WidgetRating;
-import org.apache.rave.portal.service.UserService;
-import org.apache.rave.portal.service.WidgetCommentService;
-import org.apache.rave.portal.service.WidgetRatingService;
+import org.apache.rave.portal.model.*;
+import org.apache.rave.portal.service.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -34,7 +29,6 @@ import org.springframework.stereotype.Co
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -48,12 +42,18 @@ public class WidgetApi extends AbstractR
     private final WidgetCommentService widgetCommentService;
     private final WidgetRatingService widgetRatingService;
     private final UserService userService;
-    
+    private final TagService tagService;
+    private final WidgetTagService widgetTagService;
+
+
     @Autowired
-    public WidgetApi(WidgetRatingService widgetRatingService, WidgetCommentService widgetCommentService, UserService userService) {
+    public WidgetApi(WidgetRatingService widgetRatingService, WidgetCommentService widgetCommentService, UserService userService,
+                     TagService tagService, WidgetTagService widgetTagService) {
         this.widgetCommentService = widgetCommentService;
         this.widgetRatingService = widgetRatingService;
         this.userService = userService;
+        this.tagService = tagService;
+        this.widgetTagService = widgetTagService;
     }
 
     @RequestMapping(method = RequestMethod.GET)
@@ -61,35 +61,35 @@ public class WidgetApi extends AbstractR
         logger.debug("GET received for all widgets");
         throw new UnsupportedOperationException("Not yet implemented");
     }
-    
+
     @RequestMapping(method = RequestMethod.POST, value = "/{widgetId}/comments")
     public void createWidgetComment(@PathVariable long widgetId,
-                                 @RequestParam String text,
-                                 HttpServletResponse response) {
+                                    @RequestParam String text,
+                                    HttpServletResponse response) {
         WidgetComment widgetComment = new WidgetComment();
         widgetComment.setWidgetId(widgetId);
         widgetComment.setUser(userService.getAuthenticatedUser());
         widgetComment.setText(text);
         widgetComment.setCreatedDate(new Date());
         widgetComment.setLastModifiedDate(new Date());
-        
+
         widgetCommentService.saveWidgetComment(widgetComment);
-        
+
         response.setStatus(HttpStatus.NO_CONTENT.value());
     }
-    
+
     @RequestMapping(method = RequestMethod.GET, value = "/{widgetId}/comments/{widgetCommentId}")
     public WidgetComment getWidgetComment(@PathVariable long widgetId,
                                           @PathVariable long widgetCommentId) {
         return widgetCommentService.getWidgetComment(widgetCommentId);
     }
-    
+
     @RequestMapping(method = RequestMethod.POST, value = "/{widgetId}/comments/{widgetCommentId}")
     public void updateWidgetComment(@PathVariable long widgetId,
                                     @PathVariable long widgetCommentId,
                                     @RequestParam String text,
                                     HttpServletResponse response) {
-        
+
         WidgetComment widgetComment = widgetCommentService.getWidgetComment(widgetCommentId);
         if (widgetComment == null) {
             widgetComment = new WidgetComment();
@@ -99,37 +99,37 @@ public class WidgetApi extends AbstractR
             widgetComment.setLastModifiedDate(new Date());
         }
         widgetComment.setText(text);
-        
+
         widgetCommentService.saveWidgetComment(widgetComment);
-        
+
         response.setStatus(HttpStatus.NO_CONTENT.value());
     }
-    
+
     @RequestMapping(method = RequestMethod.DELETE, value = "/{widgetId}/comments/{widgetCommentId}")
     public void deleteWidgetComment(@PathVariable long widgetId,
                                     @PathVariable long widgetCommentId,
                                     HttpServletResponse response) {
         widgetCommentService.removeWidgetComment(widgetCommentId);
-        
+
         response.setStatus(HttpStatus.NO_CONTENT.value());
     }
-    
-    
+
+
     @RequestMapping(value = "/{widgetId}/rating", method = RequestMethod.DELETE)
-    public void deleteWidgetRating(@PathVariable long widgetId, 
-                            HttpServletResponse response) {
+    public void deleteWidgetRating(@PathVariable long widgetId,
+                                   HttpServletResponse response) {
         logger.debug("DELETE WidgetRating received for /api/rest/widgets/{}", widgetId);
 
         widgetRatingService.removeWidgetRating(widgetId, userService.getAuthenticatedUser().getEntityId());
-        
+
         // send a 204 back for success since there is no content being returned
         response.setStatus(HttpStatus.NO_CONTENT.value());
     }
-    
+
     @RequestMapping(value = "/{widgetId}/rating", method = RequestMethod.POST)
     public void setWidgetRating(@PathVariable long widgetId,
-                                    @RequestParam(value = "score") Integer score,
-                                    HttpServletResponse response) {
+                                @RequestParam(value = "score") Integer score,
+                                HttpServletResponse response) {
         logger.debug("POST WidgetRating received for /api/rest/widgets/{} score: {}", widgetId, score);
 
         WidgetRating widgetRating = new WidgetRating();
@@ -137,7 +137,7 @@ public class WidgetApi extends AbstractR
         widgetRating.setUserId(userService.getAuthenticatedUser().getEntityId());
         widgetRating.setWidgetId(widgetId);
         widgetRatingService.saveWidgetRating(widgetRating);
-        
+
         // send a 204 back for success since there is no content being returned
         response.setStatus(HttpStatus.NO_CONTENT.value());
     }
@@ -147,4 +147,48 @@ public class WidgetApi extends AbstractR
     public List<Person> getAllUsers(@PathVariable long widgetId) {
         return userService.getAllByAddedWidget(widgetId);
     }
+
+    @RequestMapping(method = RequestMethod.POST, value = "/{widgetId}/tags")
+    public void createWidgetTag(@PathVariable long widgetId,
+                                @RequestParam String tagText,
+                                HttpServletResponse response) {
+        logger.debug("add tags " + tagText + " to widget " + widgetId);
+        if (tagText != null && !tagText.trim().isEmpty()) {
+            WidgetTag existed = widgetTagService.getWidgetTagByWidgetIdAndKeyword(widgetId, tagText);
+            if (existed == null) {
+                WidgetTag widgetTag = new WidgetTag();
+                widgetTag.setWidgetId(widgetId);
+                widgetTag.setUser(userService.getAuthenticatedUser());
+                widgetTag.setCreatedDate(new Date());
+                widgetTag.setTag(getTag(tagText));
+                widgetTagService.saveWidgetTag(widgetTag);
+                logger.debug("widget tag is saved.");
+
+            }
+
+        }
+
+        response.setStatus(HttpStatus.NO_CONTENT.value());
+    }
+
+    @ResponseBody
+    @RequestMapping(method = RequestMethod.GET, value = "/{widgetId}/tags")
+    public List<Tag> getTags(@PathVariable long widgetId) {
+        return tagService.getAvailableTagsByWidgetId(widgetId);
+    }
+
+    @ResponseBody
+    @RequestMapping(method = RequestMethod.GET, value = "/tags")
+    public List<Tag> getAllTags() {
+        return tagService.getAllTags();
+    }
+
+    private Tag getTag(String keyword) {
+        Tag tag = tagService.getTagByKeyword(keyword);
+        if (tag == null) {
+            tag = new Tag();
+            tag.setKeyword(keyword);
+        }
+        return tag;
+    }
 }

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=1230175&r1=1230174&r2=1230175&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 Wed Jan 11 18:18:48 2012
@@ -23,7 +23,9 @@ import org.apache.rave.portal.model.Port
 import org.apache.rave.portal.model.User;
 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.PortalPreferenceService;
+import org.apache.rave.portal.service.TagService;
 import org.apache.rave.portal.service.UserService;
 import org.apache.rave.portal.service.WidgetService;
 import org.apache.rave.portal.web.util.ModelKeys;
@@ -34,11 +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.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.*;
 
 @Controller
 @RequestMapping(value = {"/store/*", "/store"})
@@ -54,6 +52,7 @@ public class WidgetStoreController {
 
     private final PortalPreferenceService preferenceService;
 
+
     @Autowired
     public WidgetStoreController(WidgetService widgetService, NewWidgetValidator validator,
                                  UserService userService, PortalPreferenceService preferenceService) {
@@ -61,6 +60,7 @@ public class WidgetStoreController {
         this.widgetValidator = validator;
         this.userService = userService;
         this.preferenceService = preferenceService;
+
     }
 
     /**
@@ -82,13 +82,13 @@ public class WidgetStoreController {
         return ViewNames.STORE;
     }
 
-    @RequestMapping(method = RequestMethod.GET, value="mine")
+    @RequestMapping(method = RequestMethod.GET, value = "mine")
     public String viewMine(Model model, @RequestParam long referringPageId,
-                       @RequestParam(required = false, defaultValue = "0") int offset) {
+                           @RequestParam(required = false, defaultValue = "0") int offset) {
         User user = userService.getAuthenticatedUser();
         model.addAttribute(ModelKeys.WIDGETS,
                 widgetService.getWidgetsByOwner(user.getEntityId(), offset, getPageSize()));
-                model.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId);
+        model.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId);
         model.addAttribute(ModelKeys.WIDGETS_STATISTICS, widgetService.getAllWidgetStatistics(user.getEntityId()));
         return ViewNames.STORE;
     }

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=1230175&r1=1230174&r2=1230175&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 Wed Jan 11 18:18:48 2012
@@ -42,4 +42,5 @@ public class ModelKeys {
     public static final String TOKENCHECK = "tokencheck";
     public static final String USER_MAP = "userMap";
     public static final String PORTAL_SETTINGS = "portalSettings";
+    public static final String TAGS="tags" ;
 }
\ No newline at end of file

Modified: incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/api/rest/WidgetApiTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/api/rest/WidgetApiTest.java?rev=1230175&r1=1230174&r2=1230175&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/api/rest/WidgetApiTest.java (original)
+++ incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/api/rest/WidgetApiTest.java Wed Jan 11 18:18:48 2012
@@ -20,21 +20,18 @@
 package org.apache.rave.portal.web.api.rest;
 
 import org.apache.rave.portal.model.*;
-import org.apache.rave.portal.service.UserService;
-import org.apache.rave.portal.service.WidgetCommentService;
-import org.apache.rave.portal.service.WidgetRatingService;
+import org.apache.rave.portal.service.*;
 import org.junit.Before;
 import org.junit.Test;
 import org.springframework.http.HttpStatus;
 import org.springframework.mock.web.MockHttpServletResponse;
 
 import javax.servlet.http.HttpServletResponse;
-import java.awt.*;
-import java.util.*;
+import java.util.ArrayList;
 import java.util.List;
 
-import static org.hamcrest.CoreMatchers.*;
 import static org.easymock.EasyMock.*;
+import static org.hamcrest.CoreMatchers.*;
 import static org.junit.Assert.*;
 
 public class WidgetApiTest {
@@ -42,24 +39,33 @@ public class WidgetApiTest {
     private WidgetCommentService widgetCommentService;
     private WidgetRatingService widgetRatingService;
     private UserService userService;
+    private WidgetTagService widgetTagService;
+    private TagService tagService;
     private MockHttpServletResponse response;
 
     private final Long VALID_USER_ID = 5L;
     private final Long VALID_WIDGET_ID = 10L;
-    
+
     private User user;
+    private List<Tag> tagList;
 
     @Before
     public void setup() {
         widgetCommentService = createMock(WidgetCommentService.class);
         widgetRatingService = createMock(WidgetRatingService.class);
         userService = createMock(UserService.class);
+        tagService = createMock(TagService.class);
+        widgetTagService = createMock(WidgetTagService.class);
 
         user = new User();
         user.setEntityId(VALID_USER_ID);
 
+        tagList = new ArrayList<Tag>();
+        tagList.add(new Tag(1L, "tag1"));
+        tagList.add(new Tag(2L, "tag2"));
+
         response = createMock(MockHttpServletResponse.class);
-        widgetApi = new WidgetApi(widgetRatingService, widgetCommentService, userService);
+        widgetApi = new WidgetApi(widgetRatingService, widgetCommentService, userService, tagService, widgetTagService);
     }
 
     @Test(expected = UnsupportedOperationException.class)
@@ -190,11 +196,97 @@ public class WidgetApiTest {
         List<Person> persons = new ArrayList<Person>();
         persons.add(new Person());
         persons.add(new Person());
-        
+
         expect(userService.getAllByAddedWidget(VALID_WIDGET_ID)).andReturn(persons);
         replay(userService);
         assertThat(widgetApi.getAllUsers(VALID_WIDGET_ID), sameInstance(persons));
 
         verify(userService);
     }
+    
+    @Test
+    public void getTags() {
+        expect(tagService.getAvailableTagsByWidgetId(VALID_WIDGET_ID)).andReturn(tagList);
+        replay(tagService);
+        
+        assertThat(widgetApi.getTags(VALID_WIDGET_ID), is(tagList));
+        verify(tagService);
+    }
+
+    @Test
+    public void getAllTags() {
+        expect(tagService.getAllTags()).andReturn(tagList);
+        replay(tagService);
+
+        assertThat(widgetApi.getAllTags(), is(tagList));
+        verify(tagService);
+    }
+
+    @Test
+    public void createWidgetTag_newTag() {
+        final String TAG_TEXT = "mytag";
+        Tag tag = new Tag(1L, TAG_TEXT);
+        WidgetTag widgetTag = new WidgetTag();
+        widgetTag.setTag(tag);
+                        
+        expect(widgetTagService.getWidgetTagByWidgetIdAndKeyword(VALID_WIDGET_ID, TAG_TEXT)).andReturn(null);
+        expect(userService.getAuthenticatedUser()).andReturn(user);
+        expect(tagService.getTagByKeyword(TAG_TEXT)).andReturn(null);
+        widgetTagService.saveWidgetTag(widgetTag);
+        expectLastCall();
+        replay(widgetTagService, userService, tagService);
+        widgetApi.createWidgetTag(VALID_WIDGET_ID, TAG_TEXT, response);
+        verify(widgetTagService, userService, tagService);
+    }
+
+    @Test
+    public void createWidgetTag_newTag_existsForOtherWidget() {
+        final String TAG_TEXT = "mytag";
+        Tag tag = new Tag(1L, TAG_TEXT);
+        WidgetTag widgetTag = new WidgetTag();
+        widgetTag.setTag(tag);
+
+        expect(widgetTagService.getWidgetTagByWidgetIdAndKeyword(VALID_WIDGET_ID, TAG_TEXT)).andReturn(null);
+        expect(userService.getAuthenticatedUser()).andReturn(user);
+        expect(tagService.getTagByKeyword(TAG_TEXT)).andReturn(tag);
+        widgetTagService.saveWidgetTag(widgetTag);
+        expectLastCall();
+        replay(widgetTagService, userService, tagService);
+        widgetApi.createWidgetTag(VALID_WIDGET_ID, TAG_TEXT, response);
+        verify(widgetTagService, userService, tagService);
+    }
+
+    @Test
+    public void createWidgetTag_nullText() {
+        final String TAG_TEXT = null;
+        Tag tag = new Tag(1L, TAG_TEXT);
+        WidgetTag widgetTag = new WidgetTag();
+        widgetTag.setTag(tag);
+
+        widgetApi.createWidgetTag(VALID_WIDGET_ID, TAG_TEXT, response);
+    }
+
+    @Test
+    public void createWidgetTag_emptyText() {
+        final String TAG_TEXT = "      ";
+        Tag tag = new Tag(1L, TAG_TEXT);
+        WidgetTag widgetTag = new WidgetTag();
+        widgetTag.setTag(tag);
+
+        widgetApi.createWidgetTag(VALID_WIDGET_ID, TAG_TEXT, response);
+    }
+
+    @Test
+    public void createWidgetTag_existingTag() {
+        final String TAG_TEXT = "mytag";
+        Tag tag = new Tag(1L, TAG_TEXT);
+        WidgetTag widgetTag = new WidgetTag();
+        widgetTag.setEntityId(9L);
+        widgetTag.setTag(tag);
+
+        expect(widgetTagService.getWidgetTagByWidgetIdAndKeyword(VALID_WIDGET_ID, TAG_TEXT)).andReturn(widgetTag);
+        replay(widgetTagService);
+        widgetApi.createWidgetTag(VALID_WIDGET_ID, TAG_TEXT, response);
+        verify(widgetTagService);
+    }
 }

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=1230175&r1=1230174&r2=1230175&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 Wed Jan 11 18:18:48 2012
@@ -25,6 +25,7 @@ import org.apache.rave.portal.model.Widg
 import org.apache.rave.portal.model.util.SearchResult;
 import org.apache.rave.portal.model.util.WidgetStatistics;
 import org.apache.rave.portal.service.PortalPreferenceService;
+import org.apache.rave.portal.service.TagService;
 import org.apache.rave.portal.service.UserService;
 import org.apache.rave.portal.service.WidgetService;
 import org.apache.rave.portal.web.util.ModelKeys;
@@ -92,7 +93,8 @@ public class WidgetStoreControllerTest {
         replay(preferenceService);
 
         NewWidgetValidator widgetValidator = new NewWidgetValidator(widgetService);
-        controller = new WidgetStoreController(widgetService, widgetValidator, userService, preferenceService);
+        controller = new WidgetStoreController(widgetService, widgetValidator, userService,
+                preferenceService);
     }
 
     @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=1230175&r1=1230174&r2=1230175&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 Wed Jan 11 18:18:48 2012
@@ -124,7 +124,9 @@ page.widget.comments=Comments
 page.widget.comment.edit=Edit Comment
 page.widget.usercount=users
 page.widget.rate.likes=Likes: 
-page.widget.rate.dislikes=Dislikes: 
+page.widget.rate.dislikes=Dislikes:
+page.widget.tags.title=Tags:
+page.widget.tags.add=Add New Tag:
 
 page.addwidget.title=Add new widget
 page.addwidget.form.header=Widget

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=1230175&r1=1230174&r2=1230175&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 Wed Jan 11 18:18:48 2012
@@ -134,6 +134,10 @@ page.widget.comment.edit=Bewerk opmerkin
 page.widget.usercount=gebruikers
 page.widget.rate.likes=Leuk: 
 page.widget.rate.dislikes=Niet leuk: 
+page.widget.tags.title=Labels:
+page.widget.tags.add=Nieuwe tag toevoegen:
+page.widget.tags.or=--of--
+page.widget.tags.select=Selecteer uit lijst:
 
 page.addwidget.title=Voeg nieuwe widget toe
 page.addwidget.form.header=Widget

Modified: incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/db/initial_data.sql
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/db/initial_data.sql?rev=1230175&r1=1230174&r2=1230175&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/db/initial_data.sql (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/db/initial_data.sql Wed Jan 11 18:18:48 2012
@@ -37,6 +37,8 @@ set @granted_authority_seq = 'granted_au
 set @widget_comment_seq = 'widget_comment';
 set @widget_rating_seq = 'widget_rating';
 set @portal_preference_seq = 'portal_preference';
+set @tag_seq = 'tag';
+set @widget_tag_seq = 'widget_tag';
 
 
 CREATE TABLE IF NOT EXISTS RAVE_PORTAL_SEQUENCES (seq_name VARCHAR(255) PRIMARY KEY NOT NULL, seq_count BIGINT(19));
@@ -54,6 +56,9 @@ INSERT INTO RAVE_PORTAL_SEQUENCES(seq_na
 INSERT INTO RAVE_PORTAL_SEQUENCES(seq_name, seq_count) values (@widget_rating_seq, 1);
 INSERT INTO RAVE_PORTAL_SEQUENCES(seq_name, seq_count) values (@granted_authority_seq, 1);
 INSERT INTO RAVE_PORTAL_SEQUENCES(seq_name, seq_count) values (@portal_preference_seq, 1);
+INSERT INTO RAVE_PORTAL_SEQUENCES(seq_name, seq_count) values (@tag_seq, 1);
+INSERT INTO RAVE_PORTAL_SEQUENCES(seq_name, seq_count) values (@widget_tag_seq, 1);
+
   -- ***********************************************************************************
   -- start page layout data, required to make the portal work ---
 set @one_col_id = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @page_layout_seq);

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=1230175&r1=1230174&r2=1230175&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 Wed Jan 11 18:18:48 2012
@@ -188,10 +188,10 @@
                             </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}" 
+				    					<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"
@@ -200,11 +200,23 @@
                                     <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 -->
-                                    
+
                                 </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>

Modified: incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp?rev=1230175&r1=1230174&r2=1230175&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp Wed Jan 11 18:18:48 2012
@@ -62,8 +62,9 @@
     <div class="widget-content">
 
         <h2>
-            <c:set var="widgetHasTitleUrl" value="${not empty widget.titleUrl}" />
-            <c:if test="${widgetHasTitleUrl}"><a href="<c:out value="${widget.titleUrl}"/>"rel="external"></c:if>
+            <c:set var="widgetHasTitleUrl" value="${not empty widget.titleUrl}"/>
+            <c:if test="${widgetHasTitleUrl}"><a href="<c:out value="${widget.titleUrl}"/>" rel="external">
+            </c:if>
             <span id="widget-${widget.entityId}-title"><c:out value="${widget.title}"/></span>
             <c:if test="${widgetHasTitleUrl}"></a></c:if>
         </h2>
@@ -105,8 +106,9 @@
             </c:choose>
             <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" />
+                    <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}">
@@ -141,13 +143,35 @@
                 </div>
             </div>
             <div 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.totalUserCount}" />&nbsp;<fmt:message key="page.widget.usercount"/>
+                <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.totalUserCount}"/>&nbsp;<fmt:message
+                        key="page.widget.usercount"/>
                 <c:if test="${widgetUserCountGreaterThanZero}"></a></c:if>
             </div>
         </div>
 
+        <%--//Tag section--%>
+        <div class="widgetTags">
+            <c:if test="${not empty widget.tags}">
+                <fmt:message key="page.widget.tags.title"/>
+                <table id="tagsRow">
+                    <tr>
+                        <c:forEach var="tag" items="${widget.tags}">
+                        <td class="storeWidgetDesc"><c:out value="${tag.tag.keyword}"/></td>
+                        </c:forEach>
+                     </tr>
+                </table>
+            </c:if>
+
+            <div id="tagInput">
+                <fmt:message key="page.widget.tags.add"/> </br>
+                <input id="tags">
+                <button id="tag-new-${widget.entityId}" class="tagNewButton"></button>
+            </div>
+        </div>
         <div class="widgetComments">
             <div class="new-comment">
                 <h3><fmt:message key="page.widget.comments"/></h3>
@@ -156,29 +180,29 @@
             </div>
             <c:if test="${not empty widget.comments}">
                 <ul class="comments">
-                <c:forEach var="comment" items="${widget.comments}">
-                    <li class="comment">
+                    <c:forEach var="comment" items="${widget.comments}">
+                        <li class="comment">
 
-                       <fmt:formatDate value="${comment.createdDate}" type="both" var="commentDate"/>
-                        <c:choose>
-                            <c:when test="${not empty comment.user.displayName}">
-                                <c:out value="${comment.user.displayName}"/>
-                            </c:when>
-                            <c:otherwise><c:out value="${comment.user.username}"/></c:otherwise>
-                        </c:choose>
-                        <c:out value=" - ${commentDate} "/>
-
-                        <c:if test="${userProfile.entityId eq comment.user.entityId}">
-                            <button id="comment-delete-${comment.entityId}" class="commentDeleteButton"
-                                    value="Delete" data-widgetid="<c:out value="${comment.widgetId}"/>"></button>
-                            <button id="comment-edit-${comment.entityId}" class="commentEditButton" value="Edit"
-                                    data-widgetid="<c:out value="${comment.widgetId}"/>"></button>
-                        </c:if>
+                            <fmt:formatDate value="${comment.createdDate}" type="both" var="commentDate"/>
+                            <c:choose>
+                                <c:when test="${not empty comment.user.displayName}">
+                                    <c:out value="${comment.user.displayName}"/>
+                                </c:when>
+                                <c:otherwise><c:out value="${comment.user.username}"/></c:otherwise>
+                            </c:choose>
+                            <c:out value=" - ${commentDate} "/>
+
+                            <c:if test="${userProfile.entityId eq comment.user.entityId}">
+                                <button id="comment-delete-${comment.entityId}" class="commentDeleteButton"
+                                        value="Delete" data-widgetid="<c:out value="${comment.widgetId}"/>"></button>
+                                <button id="comment-edit-${comment.entityId}" class="commentEditButton" value="Edit"
+                                        data-widgetid="<c:out value="${comment.widgetId}"/>"></button>
+                            </c:if>
 
-                        <p class="commentText"><c:out value="${comment.text}"/></p>
+                            <p class="commentText"><c:out value="${comment.text}"/></p>
 
-                    </li>
-                </c:forEach>
+                        </li>
+                    </c:forEach>
                 </ul>
             </c:if>
         </div>
@@ -199,9 +223,11 @@
 <script src="<spring:url value="/script/rave_api.js"/>"></script>
 <script src="<spring:url value="/script/rave_store.js"/>"></script>
 <script>
-    $(function() {
+    $(function () {
         rave.setContext("<spring:url value="/app/" />");
         rave.store.init();
         rave.store.initComments();
+        rave.store.initTags("<c:out value="${widget.entityId}"/>");
+
     });
 </script>
\ 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=1230175&r1=1230174&r2=1230175&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 Wed Jan 11 18:18:48 2012
@@ -25,15 +25,15 @@ body {
     color: #000000;
     font-size: 62.5%;
     font-family: Arial, Helvetica, sans-serif;
-    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#D7D7D3", endColorstr="#EBEBEB");
-    background: -moz-linear-gradient(center top , #D7D7D3 0%, #EBEBEB 50%) repeat scroll 0 0 transparent;
+    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = "#D7D7D3", endColorstr = "#EBEBEB");
+    background: -moz-linear-gradient(center top, #D7D7D3 0%, #EBEBEB 50%) repeat scroll 0 0 transparent;
     background: -webkit-gradient(linear, left top, left bottom, from(#D7D7D3), to(#EBEBEB));
-    margin:0;
+    margin: 0;
 }
 
 /* general html fields */
 
-header, nav, article, section, footer{
+header, nav, article, section, footer {
     display: block;
     margin: 0;
     padding: 0;
@@ -97,7 +97,7 @@ a img {
 .horizontal-list li, .paging li {
     display: inline;
     list-style: none;
-    padding:0 10px;
+    padding: 0 10px;
 }
 
 .horizontal-list li:last-child, .paging li:last-child {
@@ -151,6 +151,7 @@ header a:hover {
     background-color: #666666;
     text-decoration: none;
 }
+
 header h1 {
     text-align: center;
     text-transform: none;
@@ -164,13 +165,14 @@ header h1 {
 }
 
 .header-mobile {
-    height:auto;
+    height: auto;
 }
 
 .topnav {
     float: right;
     margin-right: 2%;
 }
+
 /* content */
 #content {
     background-color: transparent;
@@ -195,21 +197,21 @@ header h1 {
 
 .widget-mobile {
     box-shadow: none;
-    border-radius: 0 0 0 0;    
+    border-radius: 0 0 0 0;
     padding: 0;
 }
 
 .widget-wrapper-transitional {
     position: absolute;
     z-index: 1000;
-    left:0.25%;
+    left: 0.25%;
     top: 51px;
 }
 
 .widget-wrapper-canvas {
     position: absolute;
     z-index: 1000;
-    left:0.25%;
+    left: 0.25%;
     top: 72px;
     width: 99.5%;
     height: 100%;
@@ -229,8 +231,8 @@ header h1 {
 .widget-title-bar {
     color: #FFFFFF;
     background: #767676; /* IE 7*/
-    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#999999", endColorstr="#666666");
-    background: -moz-linear-gradient(center top , #999 0%, #666 25%) repeat scroll 0 0 transparent;
+    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = "#999999", endColorstr = "#666666");
+    background: -moz-linear-gradient(center top, #999 0%, #666 25%) repeat scroll 0 0 transparent;
     background: -webkit-gradient(linear, left top, left bottom, from(#999), to(#666));
     border-radius: 5px 5px 0 0;
     padding: 2px;
@@ -388,7 +390,7 @@ header h1 {
     clear: both;
 }
 
-.columns_2_2,  .columns_3_3, .columns_3nwn_3, .columns_4_4, .columns_3nwn_1_bottom_3, .columns_3nwn_1_bottom_4 {
+.columns_2_2, .columns_3_3, .columns_3nwn_3, .columns_4_4, .columns_3nwn_1_bottom_3, .columns_3nwn_1_bottom_4 {
     margin-right: 0;
 }
 
@@ -515,7 +517,7 @@ ul.storeItems {
     margin: 1em auto;
 }
 
-ul.storeItems li{
+ul.storeItems li {
     list-style: none;
 }
 
@@ -536,7 +538,7 @@ ul.storeItems li{
     margin-bottom: 1em;
 }
 
-.storeWidgetDesc{
+.storeWidgetDesc {
     margin: 1em 0;
 }
 
@@ -613,7 +615,7 @@ label.formradio {
 }
 
 input.long, textarea.long {
-    width:400px;
+    width: 400px;
 }
 
 .checkboxlist {
@@ -634,7 +636,7 @@ span.error, label.error {
 }
 
 .warn {
-  font-weight: bold;
+    font-weight: bold;
 }
 
 /* End of form fields */
@@ -685,7 +687,7 @@ span.error, label.error {
 
 .rave-ui-tab-mobile {
     border: none;
-    background-color: #FFFFFF;    
+    background-color: #FFFFFF;
     color: #767676;
     font-weight: normal;
     font-style: normal;
@@ -698,28 +700,44 @@ span.error, label.error {
 
 .rave-ui-tab-mobile:hover, .rave-ui-tab-mobile a:hover {
     color: #000000;
-    border: none;    
+    border: none;
     background-color: #FFFFFF;
 }
 
 .rave-ui-tab-selected-mobile, .rave-ui-tab-selected-mobile:hover {
     border: 1px solid #B4C4CF;
     border-bottom: 1px solid #FFFFFF;
-    background-color: #FFFFFF;        
+    background-color: #FFFFFF;
     color: #000000;
     font-style: normal;
     font-weight: bold;
 }
 
 #dialog {
-    width:400px;
+    width: 400px;
     display: none;
 }
-#dialog label { display:block; }
-#dialog input { display:block; }
-#dialog label { margin-top: 0.5em; }
-#dialog input { width: 95%; }
-#dialog textarea { width: 95%; }
+
+#dialog label {
+    display: block;
+}
+
+#dialog input {
+    display: block;
+}
+
+#dialog label {
+    margin-top: 0.5em;
+}
+
+#dialog input {
+    width: 95%;
+}
+
+#dialog textarea {
+    width: 95%;
+}
+
 #add_page {
     cursor: pointer;
     width: 18px;
@@ -734,8 +752,8 @@ span.error, label.error {
 }
 
 #pageContent, .pageContent {
-    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#D7D7D3", endColorstr="#EBEBEB");
-    background: -moz-linear-gradient(center top , #D7D7D3 0%, #EBEBEB 50%) repeat scroll 0 0 transparent;
+    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = "#D7D7D3", endColorstr = "#EBEBEB");
+    background: -moz-linear-gradient(center top, #D7D7D3 0%, #EBEBEB 50%) repeat scroll 0 0 transparent;
     background: -webkit-gradient(linear, left top, left bottom, from(#D7D7D3), to(#EBEBEB));
 }
 
@@ -763,7 +781,7 @@ span.error, label.error {
     margin: 20px auto;
     padding: 20px;
     text-align: center;
-    width: 300px;  
+    width: 300px;
     font-size: 1.25em;
 }
 
@@ -780,6 +798,7 @@ span.error, label.error {
     zoom: 1;
     *display: inline;
 }
+
 .page-menu {
     border: 1px solid black;
     position: absolute;
@@ -791,15 +810,19 @@ span.error, label.error {
     z-index: 1000;
     cursor: pointer;
 }
+
 .page-menu-item {
     padding: 3px;
 }
+
 .page-menu-item:hover {
     background-color: #B4C4CF;
 }
+
 .page-menu-item-disabled {
     color: #D3D3D3;
 }
+
 #pageMenuButton {
     cursor: pointer;
     margin-right: 10px;
@@ -814,6 +837,7 @@ span.error, label.error {
     zoom: 1;
     *display: inline;
 }
+
 .widget-menu {
     border: 1px solid black;
     position: absolute;
@@ -825,13 +849,16 @@ span.error, label.error {
     z-index: 1000;
     cursor: pointer;
 }
+
 .widget-menu-item {
     padding: 3px;
     color: #000000;
 }
+
 .widget-menu-item:hover {
     background-color: #B4C4CF;
 }
+
 .widget-menu-item-disabled {
     color: #D3D3D3;
 }
@@ -844,16 +871,23 @@ span.error, label.error {
     cursor: pointer;
 }
 
+.widget-tags-select {
+
+    font-family: Arial, Helvetica, sans-serif;
+    font-size: 11px;
+}
+
 #errorStack {
     display: none;
     width: 30%;
-    margin:auto;
+    margin: auto;
 }
 
 .errorMessage {
     text-align: center;
     font-size: 150%;
 }
+
 .errorLogo {
     text-align: center;
 }
@@ -862,8 +896,8 @@ span.error, label.error {
 .admincontent {
     margin: 0 auto;
     width: 80%;
-    padding:1em 20px;
-    font-size:1.1em;
+    padding: 1em 20px;
+    font-size: 1.1em;
 }
 
 .admincontent p {
@@ -871,8 +905,8 @@ span.error, label.error {
 }
 
 .admincontent .searchbox {
-    float:right;
-    margin-top:1em;
+    float: right;
+    margin-top: 1em;
 }
 
 .admincontent .goback {
@@ -880,15 +914,15 @@ span.error, label.error {
 }
 
 .searchbox form, .searchbox fieldset {
-    display:inline;
-    height:1em;
-    margin:0;
-    padding:0;
+    display: inline;
+    height: 1em;
+    margin: 0;
+    padding: 0;
 }
 
 .admincontent h2 {
     margin-top: 0;
-    padding-top:1em;
+    padding-top: 1em;
     border: none;
 }
 
@@ -903,7 +937,7 @@ span.error, label.error {
     border-radius: 4px;
 }
 
-.admincontent table th,.admincontent table td {
+.admincontent table th, .admincontent table td {
     padding: 5px 5px 4px;
     line-height: 1.5em;
     text-align: left;
@@ -964,12 +998,12 @@ span.error, label.error {
 
 .admincontent th a, .admincontent th a:visited {
     color: #FFFFFF;
-    text-decoration:none;
+    text-decoration: none;
 }
 
 .admincontent td a, .admincontent td a:visited {
     color: #000000;
-    text-decoration:none;
+    text-decoration: none;
 }
 
 .admincontent tbody tr:hover a, .admincontent table a:hover {
@@ -978,12 +1012,12 @@ span.error, label.error {
 }
 
 .admincontent .leftcolumn {
-    float:left;
+    float: left;
     width: 70%;
 }
 
 .admincontent .rightcolumn {
-    float:right;
+    float: right;
     width: 30%;
 }
 
@@ -992,6 +1026,7 @@ span.error, label.error {
     margin: 1em 0;
     width: 100%;
 }
+
 .admincontent figure.screenshot img {
     max-width: 100%;
 }
@@ -1004,8 +1039,8 @@ span.error, label.error {
 }
 
 .formbox {
-    border:1px solid #B4C4CF;
-    margin:1em 10px;
+    border: 1px solid #B4C4CF;
+    margin: 1em 10px;
     padding: 0 10px;
 }
 
@@ -1101,7 +1136,6 @@ span.error, label.error {
     font-size: 14px;
 }
 
-
 @media all and (max-width: 900px) {
     .storeSearch {
         width: 100%;
@@ -1169,7 +1203,7 @@ span.error, label.error {
         padding: 1em 10px;
     }
 
-    .detailWidgetInfo, .detailWidgetPreview, .widgetComments {
+    .detailWidgetInfo, .detailWidgetPreview, .widgetComments, .widgetTags {
         width: 98%;
         padding: 0 1%;
     }
@@ -1221,4 +1255,4 @@ span.error, label.error {
         width: 80%;
         padding: 1em 5px;
     }
-}
\ No newline at end of file
+}

Modified: incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_api.js
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_api.js?rev=1230175&r1=1230174&r2=1230175&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_api.js (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_api.js Wed Jan 11 18:18:48 2012
@@ -174,6 +174,35 @@ rave.api = rave.api || (function() {
             })
         }
 
+        function createWidgetTag(args) {
+            $.ajax({
+                type:'POST',
+                url:rave.getContext() + path + "widgets/" + args.widgetId + "/tags?tagText=" + escape(args.text),
+                success:function (result) {
+                    if (typeof args.successCallback == 'function') {
+                        args.successCallback();
+                    }
+                },
+                error:handleError
+            })
+        }
+
+        function getTags(args) {
+            $.ajax({
+                type:'GET',
+                url:rave.getContext() + path + "widgets/"+args.widgetId  + "/tags",
+                dataType:"json",
+                success:function (data) {
+                    if (typeof args.successCallback == 'function') {
+                        args.successCallback(data);
+                    }
+                }
+            });
+
+
+        }
+
+
         return {
             updateWidgetRating: updateWidgetRating,
             deleteWidgetRating: deleteWidgetRating,
@@ -184,7 +213,9 @@ rave.api = rave.api || (function() {
             updateWidgetComment : updateWidgetComment,
             deleteWidgetComment : deleteWidgetComment,
             deletePage : deletePage,
-            getUsersForWidget: getUsersForWidget
+            getUsersForWidget: getUsersForWidget,
+            createWidgetTag: createWidgetTag,
+            getTags: getTags
         };
     })();
 

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=1230175&r1=1230174&r2=1230175&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 Wed Jan 11 18:18:48 2012
@@ -127,10 +127,44 @@ rave.store = rave.store || (function() {
             });
         });
     }
-    
+
+    function initTags(widgetId) {
+
+        $(".tagNewButton").button({
+            icons:{primary:"ui-icon-disk"},
+            text:false
+        }).click(function () {
+                var widgetId = this.id.substring("tag-new-".length);
+                rave.api.rest.createWidgetTag({widgetId:widgetId,
+                    text:$("#tags").get(0).value,
+                    successCallback:function () {
+                        window.location.reload();
+                    }});
+            });
+//    load the tag by widgetId
+        rave.api.rest.getTags({ widgetId:widgetId,
+            successCallback:function (data) {
+                var result = ($.map(data, function (tag) {
+                    return {
+                        label:tag.keyword,
+                        value:tag.keyword
+                    }
+                }));
+
+                $("#tags").autocomplete({
+                    source:result
+                })
+            }
+        })
+
+
+    }
+
+
     return {
         init: initRatings,
-        initComments: initComments
-    };
+        initComments: initComments,
+        initTags: initTags
+    };                             
     
 }());
\ No newline at end of file



Mime
View raw message