kune-commits
Threads by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 1587 discussions
Author: vjrj
Date: 2008-08-09 20:40:32 +0200 (Sat, 09 Aug 2008)
New Revision: 839
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/dto/ChatUserParamsDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/CustomPropertiesDTO.java
Modified:
trunk/src/main/java/org/ourproject/kune/app/public/Kune.html
trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
trunk/src/main/java/org/ourproject/kune/app/public/css/workspace.css
trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserInfoDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/CustomProperties.java
trunk/src/main/java/org/ourproject/kune/platf/server/mapper/DozerMapper.java
trunk/src/main/java/org/ourproject/kune/platf/server/mapper/Mapper.java
trunk/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java
trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfo.java
trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfoServiceDefault.java
trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPanel.java
trunk/src/main/resources/dozerBeanMapping.xml
trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java
Log:
Complete - task 1: User parameters Server
Modified: trunk/src/main/java/org/ourproject/kune/app/public/Kune.html
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/Kune.html 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/main/java/org/ourproject/kune/app/public/Kune.html 2008-08-09 18:40:32 UTC (rev 839)
@@ -18,7 +18,24 @@
<link rel="shortcut icon" href="images/favicon.ico" />
<title>Kune</title>
+<style type="text/css">
+#kuneprogresspanel {
+ position: absolute;
+ top: 2px;
+ left: 2px;
+ z-index: 30000;
+}
+
+.kune-Progress {
+ background: #E5FF80;
+ border: 1px solid #E5FF80;
+ white-space: nowrap;
+ height: 16px;
+ padding: 0 3px;
+}
+
+</style>
</head>
<body>
<script type="text/javascript" language="javascript"
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-08-09 18:40:32 UTC (rev 839)
@@ -1908,21 +1908,6 @@
/* Sitebar */
-#kuneprogresspanel {
- position: absolute;
- top: 2px;
- left: 2px;
- z-index: 30000;
-}
-
-.kune-Progress {
- background: #E5FF80;
- border: 1px solid #E5FF80;
- white-space: nowrap;
- height: 16px;
- padding: 0 3px;
-}
-
.kune-SiteBarPanel .kune-IconHyperlink {
white-space: nowrap;
}
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/workspace.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/workspace.css 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/workspace.css 2008-08-09 18:40:32 UTC (rev 839)
@@ -1,20 +1,5 @@
/* Sitebar */
-#kuneprogresspanel {
- position: absolute;
- top: 2px;
- left: 2px;
- z-index: 30000;
-}
-
-.kune-Progress {
- background: #E5FF80;
- border: 1px solid #E5FF80;
- white-space: nowrap;
- height: 16px;
- padding: 0 3px;
-}
-
.kune-SiteBarPanel .kune-IconHyperlink {
white-space: nowrap;
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/dto/ChatUserParamsDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/ChatUserParamsDTO.java 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/ChatUserParamsDTO.java 2008-08-09 18:40:32 UTC (rev 839)
@@ -0,0 +1,61 @@
+package org.ourproject.kune.platf.client.dto;
+
+import com.calclab.emite.client.im.roster.RosterManager;
+import com.calclab.emite.client.im.roster.RosterManager.SubscriptionMode;
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+public class ChatUserParamsDTO implements IsSerializable {
+
+ private String avatar;
+
+ private boolean publishRoster;
+
+ private SubscriptionMode subscriptionMode;
+
+ private String chatColor;
+
+ public ChatUserParamsDTO() {
+ this(null, false, SubscriptionMode.autoAcceptAll, null);
+ };
+
+ public ChatUserParamsDTO(final String avatar, final boolean publishRoster, final SubscriptionMode subscriptionMode,
+ final String chatColor) {
+ this.avatar = avatar;
+ this.publishRoster = publishRoster;
+ this.subscriptionMode = subscriptionMode;
+ this.chatColor = chatColor;
+ }
+
+ public String getAvatar() {
+ return avatar;
+ }
+
+ public String getChatColor() {
+ return chatColor;
+ }
+
+ public RosterManager.SubscriptionMode getSubscriptionMode() {
+ return subscriptionMode;
+ }
+
+ public boolean isPublishRoster() {
+ return publishRoster;
+ }
+
+ public void setAvatar(final String avatar) {
+ this.avatar = avatar;
+ }
+
+ public void setChatColor(final String chatColor) {
+ this.chatColor = chatColor;
+ }
+
+ public void setPublishRoster(final boolean publishRoster) {
+ this.publishRoster = publishRoster;
+ }
+
+ public void setSubscriptionMode(final RosterManager.SubscriptionMode subscriptionMode) {
+ this.subscriptionMode = subscriptionMode;
+ }
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/dto/CustomPropertiesDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/CustomPropertiesDTO.java 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/CustomPropertiesDTO.java 2008-08-09 18:40:32 UTC (rev 839)
@@ -0,0 +1,37 @@
+package org.ourproject.kune.platf.client.dto;
+
+import java.util.HashMap;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+public class CustomPropertiesDTO implements IsSerializable {
+
+ private HashMap<Class<?>, Object> data;
+
+ public CustomPropertiesDTO() {
+ data = new HashMap<Class<?>, Object>();
+ }
+
+ public HashMap<Class<?>, Object> getData() {
+ return data;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getData(final Class<T> type) {
+ return (T) data.get(type);
+ }
+
+ public <T> boolean hasPropertie(final Class<T> type) {
+ return data.containsKey(type);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T setData(final Class<T> type, final T value) {
+ return (T) data.put(type, value);
+ }
+
+ public void setData(final HashMap<Class<?>, Object> data) {
+ this.data = data;
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserInfoDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserInfoDTO.java 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserInfoDTO.java 2008-08-09 18:40:32 UTC (rev 839)
@@ -34,6 +34,7 @@
private I18nCountryDTO country;
private List<GroupDTO> groupsIsAdmin;
private List<GroupDTO> groupsIsCollab;
+ private CustomPropertiesDTO customProperties;
public String getChatName() {
return chatName;
@@ -47,6 +48,10 @@
return country;
}
+ public CustomPropertiesDTO getCustomProperties() {
+ return customProperties;
+ }
+
public List<GroupDTO> getGroupsIsAdmin() {
return groupsIsAdmin;
}
@@ -88,6 +93,10 @@
this.country = country;
}
+ public void setCustomProperties(final CustomPropertiesDTO customProperties) {
+ this.customProperties = customProperties;
+ }
+
public void setGroupsIsAdmin(final List<GroupDTO> groupsIsAdmin) {
this.groupsIsAdmin = groupsIsAdmin;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java 2008-08-09 18:40:32 UTC (rev 839)
@@ -71,7 +71,7 @@
logException(e);
Site.error(i18n.t("You don't have rights to do that"));
} catch (final SessionExpiredException e) {
- logException(e, true);
+ logException(e);
doSessionExpired();
} catch (final UserMustBeLoggedException e) {
logException(e);
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/CustomProperties.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/CustomProperties.java 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/CustomProperties.java 2008-08-09 18:40:32 UTC (rev 839)
@@ -22,12 +22,16 @@
private Long id;
@Lob
- private final HashMap<Class<?>, Object> data;
+ private HashMap<Class<?>, Object> data;
public CustomProperties() {
data = new HashMap<Class<?>, Object>();
}
+ public HashMap<Class<?>, Object> getData() {
+ return data;
+ }
+
@SuppressWarnings("unchecked")
public <T> T getData(final Class<T> type) {
return (T) data.get(type);
@@ -46,6 +50,10 @@
return (T) data.put(type, value);
}
+ public void setData(final HashMap<Class<?>, Object> data) {
+ this.data = data;
+ }
+
public void setId(final Long id) {
this.id = id;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/mapper/DozerMapper.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/mapper/DozerMapper.java 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/mapper/DozerMapper.java 2008-08-09 18:40:32 UTC (rev 839)
@@ -21,12 +21,15 @@
package org.ourproject.kune.platf.server.mapper;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import net.sf.dozer.util.mapping.DozerBeanMapperSingletonWrapper;
import net.sf.dozer.util.mapping.MapperIF;
+import org.ourproject.kune.platf.client.dto.CustomPropertiesDTO;
import org.ourproject.kune.platf.client.dto.SearchResultDTO;
+import org.ourproject.kune.platf.server.domain.CustomProperties;
import org.ourproject.kune.platf.server.manager.impl.SearchResult;
import com.google.inject.Singleton;
@@ -53,6 +56,20 @@
return dest;
}
+ public CustomPropertiesDTO mapProperties(final CustomProperties customProperties) throws ClassNotFoundException {
+ final CustomPropertiesDTO customPropertiesDTO = new CustomPropertiesDTO();
+ final HashMap<Class<?>, Object> dataMapped = new HashMap<Class<?>, Object>();
+ for (final Class<?> c : customProperties.getData().keySet()) {
+ final Object object = customProperties.getData(c);
+ final Class<?> destClassName = Class.forName("org.ourproject.kune.platf.client.dto." + c.getSimpleName()
+ + "DTO");
+ final Object objectMapped = map(object, destClassName);
+ dataMapped.put(destClassName, objectMapped);
+ }
+ customPropertiesDTO.setData(dataMapped);
+ return customPropertiesDTO;
+ }
+
@SuppressWarnings("unchecked")
public <K, T> SearchResultDTO<T> mapSearchResult(final SearchResult<K> result, final Class<T> type) {
final SearchResultDTO<T> resultDTO = new SearchResultDTO<T>();
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/mapper/Mapper.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/mapper/Mapper.java 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/mapper/Mapper.java 2008-08-09 18:40:32 UTC (rev 839)
@@ -22,7 +22,9 @@
import java.util.List;
+import org.ourproject.kune.platf.client.dto.CustomPropertiesDTO;
import org.ourproject.kune.platf.client.dto.SearchResultDTO;
+import org.ourproject.kune.platf.server.domain.CustomProperties;
import org.ourproject.kune.platf.server.manager.impl.SearchResult;
public interface Mapper {
@@ -30,5 +32,7 @@
<T> List<T> mapList(List<?> list, Class<T> type);
+ CustomPropertiesDTO mapProperties(CustomProperties customProperties) throws ClassNotFoundException;
+
<K, T> SearchResultDTO<T> mapSearchResult(SearchResult<K> result, Class<T> type);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java 2008-08-09 18:40:32 UTC (rev 839)
@@ -111,7 +111,14 @@
private UserInfoDTO loadUserInfo(final User user) throws DefaultException {
final UserInfo userInfo = userInfoService.buildInfo(user, getUserSession().getHash());
- return mapper.map(userInfo, UserInfoDTO.class);
+ final UserInfoDTO map = mapper.map(userInfo, UserInfoDTO.class);
+ try {
+ map.setCustomProperties(mapper.mapProperties(userInfo.getCustomProperties()));
+ } catch (final ClassNotFoundException e) {
+ e.printStackTrace();
+ throw new DefaultException("Class not found during mapping userInfo");
+ }
+ return map;
}
private UserInfoDTO loginUser(final User user) throws DefaultException {
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfo.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfo.java 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfo.java 2008-08-09 18:40:32 UTC (rev 839)
@@ -21,6 +21,7 @@
import java.util.List;
+import org.ourproject.kune.platf.server.domain.CustomProperties;
import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.domain.I18nCountry;
import org.ourproject.kune.platf.server.domain.I18nLanguage;
@@ -36,6 +37,7 @@
private String userHash;
private I18nLanguage language;
private I18nCountry country;
+ private CustomProperties customProperties;
public String getChatName() {
return chatName;
@@ -49,6 +51,10 @@
return country;
}
+ public CustomProperties getCustomProperties() {
+ return customProperties;
+ }
+
public List<Group> getGroupsIsAdmin() {
return groupsIsAdmin;
}
@@ -89,6 +95,10 @@
this.country = country;
}
+ public void setCustomProperties(final CustomProperties customProperties) {
+ this.customProperties = customProperties;
+ }
+
public void setGroupsIsAdmin(final List<Group> groupsIsAdmin) {
this.groupsIsAdmin = groupsIsAdmin;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfoServiceDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfoServiceDefault.java 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfoServiceDefault.java 2008-08-09 18:40:32 UTC (rev 839)
@@ -53,6 +53,7 @@
info.setLanguage(language);
info.setCountry(user.getCountry());
info.setUserHash(userHash);
+ info.setCustomProperties(user.getCustomProperties());
final Group userGroup = user.getUserGroup();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPanel.java 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPanel.java 2008-08-09 18:40:32 UTC (rev 839)
@@ -143,7 +143,7 @@
groupsPanel.addListener(new PanelListenerAdapter() {
public void onActivate(final Panel panel) {
- dialog.setTitle(i18n.t("Search users & groups"));
+ dialog.setTitle(i18n.t("Search users and groups"));
presenter.doSearch(SiteSearcherType.group_user);
}
});
Modified: trunk/src/main/resources/dozerBeanMapping.xml
===================================================================
--- trunk/src/main/resources/dozerBeanMapping.xml 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/main/resources/dozerBeanMapping.xml 2008-08-09 18:40:32 UTC (rev 839)
@@ -287,5 +287,19 @@
<b>name</b>
</field>
</mapping>
+
+ <mapping>
+ <class-a>org.ourproject.kune.platf.client.dto.ChatUserParamsDTO</class-a>
+ <class-b>org.ourproject.kune.platf.server.domain.ChatUserParams</class-b>
+ </mapping>
+ <mapping>
+ <class-a>org.ourproject.kune.platf.client.dto.CustomPropertiesDTO</class-a>
+ <class-b>org.ourproject.kune.platf.server.domain.CustomProperties</class-b>
+ <field>
+ <a>data</a>
+ <b>data</b>
+ </field>
+ </mapping>
+
</mappings>
\ No newline at end of file
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java 2008-08-09 14:49:34 UTC (rev 838)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java 2008-08-09 18:40:32 UTC (rev 839)
@@ -10,21 +10,26 @@
import org.junit.Before;
import org.junit.Test;
+import org.ourproject.kune.platf.client.dto.ChatUserParamsDTO;
import org.ourproject.kune.platf.client.dto.CommentDTO;
import org.ourproject.kune.platf.client.dto.ContainerDTO;
import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO;
import org.ourproject.kune.platf.client.dto.ContentDTO;
+import org.ourproject.kune.platf.client.dto.CustomPropertiesDTO;
import org.ourproject.kune.platf.client.dto.GroupDTO;
import org.ourproject.kune.platf.client.dto.GroupListDTO;
import org.ourproject.kune.platf.client.dto.LicenseDTO;
import org.ourproject.kune.platf.client.dto.LinkDTO;
import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.UserInfoDTO;
import org.ourproject.kune.platf.server.TestDomainHelper;
import org.ourproject.kune.platf.server.TestHelper;
import org.ourproject.kune.platf.server.access.AccessRights;
+import org.ourproject.kune.platf.server.domain.ChatUserParams;
import org.ourproject.kune.platf.server.domain.Comment;
import org.ourproject.kune.platf.server.domain.Container;
import org.ourproject.kune.platf.server.domain.Content;
+import org.ourproject.kune.platf.server.domain.CustomProperties;
import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.domain.GroupList;
import org.ourproject.kune.platf.server.domain.GroupListMode;
@@ -33,7 +38,9 @@
import org.ourproject.kune.platf.server.domain.User;
import org.ourproject.kune.platf.server.manager.GroupManager;
import org.ourproject.kune.platf.server.state.State;
+import org.ourproject.kune.platf.server.users.UserInfo;
+import com.calclab.emite.client.im.roster.RosterManager.SubscriptionMode;
import com.google.inject.Inject;
public class MapperTest {
@@ -42,6 +49,30 @@
@Inject
GroupManager groupManager;
+ @Test
+ public void customPropertiesInUserInfoMappping() {
+ final UserInfo userInfo = new UserInfo();
+ final ChatUserParams userChatParams = new ChatUserParams("avatar", true, SubscriptionMode.autoAcceptAll,
+ "color");
+ final CustomProperties customProperties = new CustomProperties();
+ customProperties.setData(ChatUserParams.class, userChatParams);
+ userInfo.setCustomProperties(customProperties);
+ final UserInfoDTO map = mapper.map(userInfo, UserInfoDTO.class);
+ final ChatUserParamsDTO data = map.getCustomProperties().getData(ChatUserParamsDTO.class);
+ assertEquals("avatar", data.getAvatar());
+ }
+
+ @Test
+ public void customPropertiesMappping() throws ClassNotFoundException {
+ final ChatUserParams userChatParams = new ChatUserParams("avatar", true, SubscriptionMode.autoAcceptAll,
+ "color");
+ final CustomProperties customProperties = new CustomProperties();
+ customProperties.setData(ChatUserParams.class, userChatParams);
+ final CustomPropertiesDTO map = mapper.mapProperties(customProperties);
+ final ChatUserParamsDTO data = map.getData(ChatUserParamsDTO.class);
+ assertEquals("avatar", data.getAvatar());
+ }
+
@Before
public void inject() {
TestHelper.inject(this);
1
0
r838 - in trunk/src: main/java/org/ourproject/kune/platf/server/domain test/java/org/ourproject/kune/platf/server/manager
by vjrj 09 Aug '08
by vjrj 09 Aug '08
09 Aug '08
Author: vjrj
Date: 2008-08-09 16:49:34 +0200 (Sat, 09 Aug 2008)
New Revision: 838
Added:
trunk/src/main/java/org/ourproject/kune/platf/server/domain/ChatUserParams.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/CustomProperties.java
Removed:
trunk/src/main/java/org/ourproject/kune/platf/server/domain/UserParams.java
Modified:
trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java
trunk/src/test/java/org/ourproject/kune/platf/server/manager/UserManagerTest.java
Log:
Incomplete - task 1: User parameters Server
Added: trunk/src/main/java/org/ourproject/kune/platf/server/domain/ChatUserParams.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/ChatUserParams.java 2008-08-08 23:52:38 UTC (rev 837)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/ChatUserParams.java 2008-08-09 14:49:34 UTC (rev 838)
@@ -0,0 +1,64 @@
+package org.ourproject.kune.platf.server.domain;
+
+import java.io.Serializable;
+
+import com.calclab.emite.client.im.roster.RosterManager;
+import com.calclab.emite.client.im.roster.RosterManager.SubscriptionMode;
+
+public class ChatUserParams implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String avatar;
+
+ private boolean publishRoster;
+
+ private SubscriptionMode subscriptionMode;
+
+ private String chatColor;
+
+ public ChatUserParams() {
+ this(null, false, SubscriptionMode.autoAcceptAll, null);
+ };
+
+ public ChatUserParams(final String avatar, final boolean publishRoster, final SubscriptionMode subscriptionMode,
+ final String chatColor) {
+ this.avatar = avatar;
+ this.publishRoster = publishRoster;
+ this.subscriptionMode = subscriptionMode;
+ this.chatColor = chatColor;
+ }
+
+ public String getAvatar() {
+ return avatar;
+ }
+
+ public String getChatColor() {
+ return chatColor;
+ }
+
+ public RosterManager.SubscriptionMode getSubscriptionMode() {
+ return subscriptionMode;
+ }
+
+ public boolean isPublishRoster() {
+ return publishRoster;
+ }
+
+ public void setAvatar(final String avatar) {
+ this.avatar = avatar;
+ }
+
+ public void setChatColor(final String chatColor) {
+ this.chatColor = chatColor;
+ }
+
+ public void setPublishRoster(final boolean publishRoster) {
+ this.publishRoster = publishRoster;
+ }
+
+ public void setSubscriptionMode(final RosterManager.SubscriptionMode subscriptionMode) {
+ this.subscriptionMode = subscriptionMode;
+ }
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/server/domain/CustomProperties.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/CustomProperties.java 2008-08-08 23:52:38 UTC (rev 837)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/CustomProperties.java 2008-08-09 14:49:34 UTC (rev 838)
@@ -0,0 +1,52 @@
+package org.ourproject.kune.platf.server.domain;
+
+import java.util.HashMap;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.Table;
+
+import org.hibernate.search.annotations.DocumentId;
+import org.hibernate.search.annotations.Indexed;
+
+@Entity
+@Indexed
+@Table(name = "customproperties")
+public class CustomProperties implements HasId {
+
+ @Id
+ @DocumentId
+ @GeneratedValue
+ private Long id;
+
+ @Lob
+ private final HashMap<Class<?>, Object> data;
+
+ public CustomProperties() {
+ data = new HashMap<Class<?>, Object>();
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getData(final Class<T> type) {
+ return (T) data.get(type);
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public <T> boolean hasPropertie(final Class<T> type) {
+ return data.containsKey(type);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T setData(final Class<T> type, final T value) {
+ return (T) data.put(type, value);
+ }
+
+ public void setId(final Long id) {
+ this.id = id;
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java 2008-08-08 23:52:38 UTC (rev 837)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java 2008-08-09 14:49:34 UTC (rev 838)
@@ -98,6 +98,9 @@
@NotNull
private TimeZone timezone;
+ @OneToOne(cascade = CascadeType.ALL)
+ private final CustomProperties customProperties;
+
public User() {
this(null, null, null, null, null, null, null);
}
@@ -112,6 +115,7 @@
this.language = language;
this.country = country;
this.timezone = timezone;
+ customProperties = new CustomProperties();
}
@Finder(query = "from User")
@@ -135,6 +139,10 @@
return country;
}
+ public CustomProperties getCustomProperties() {
+ return customProperties;
+ }
+
public String getEmail() {
return email;
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/server/domain/UserParams.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/UserParams.java 2008-08-08 23:52:38 UTC (rev 837)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/UserParams.java 2008-08-09 14:49:34 UTC (rev 838)
@@ -1,80 +0,0 @@
-package org.ourproject.kune.platf.server.domain;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.hibernate.search.annotations.DocumentId;
-import org.hibernate.search.annotations.Indexed;
-import org.hibernate.validator.NotNull;
-
-import com.calclab.emite.client.im.roster.RosterManager;
-import com.calclab.emite.client.im.roster.RosterManager.SubscriptionMode;
-
-@Entity
-@Indexed
-@Table(name = "usersparams")
-public class UserParams {
-
- @Id
- @DocumentId
- @GeneratedValue
- private Long id;
-
- private String avatar;
-
- @NotNull
- private boolean publishRoster;
-
- @NotNull
- private SubscriptionMode subscriptionMode;
-
- @NotNull
- private String chatColor;
-
- public UserParams(final String avatar, final boolean publishRoster, final SubscriptionMode subscriptionMode,
- final String chatColor) {
- this.avatar = avatar;
- this.publishRoster = publishRoster;
- this.subscriptionMode = subscriptionMode;
- this.chatColor = chatColor;
- }
-
- public String getAvatar() {
- return avatar;
- }
-
- public String getChatColor() {
- return chatColor;
- }
-
- public Long getId() {
- return id;
- }
-
- public RosterManager.SubscriptionMode getSubscriptionMode() {
- return subscriptionMode;
- }
-
- public boolean isPublishRoster() {
- return publishRoster;
- }
-
- public void setAvatar(final String avatar) {
- this.avatar = avatar;
- }
-
- public void setChatColor(final String chatColor) {
- this.chatColor = chatColor;
- }
-
- public void setPublishRoster(final boolean publishRoster) {
- this.publishRoster = publishRoster;
- }
-
- public void setSubscriptionMode(final RosterManager.SubscriptionMode subscriptionMode) {
- this.subscriptionMode = subscriptionMode;
- }
-
-}
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/UserManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/UserManagerTest.java 2008-08-08 23:52:38 UTC (rev 837)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/UserManagerTest.java 2008-08-09 14:49:34 UTC (rev 838)
@@ -15,12 +15,15 @@
import org.junit.Test;
import org.ourproject.kune.platf.client.errors.I18nNotFoundException;
import org.ourproject.kune.platf.server.PersistenceTest;
+import org.ourproject.kune.platf.server.domain.ChatUserParams;
+import org.ourproject.kune.platf.server.domain.CustomProperties;
import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.domain.I18nCountry;
import org.ourproject.kune.platf.server.domain.I18nLanguage;
import org.ourproject.kune.platf.server.domain.User;
import org.ourproject.kune.platf.server.manager.impl.SearchResult;
+import com.calclab.emite.client.im.roster.RosterManager.SubscriptionMode;
import com.google.inject.Inject;
public class UserManagerTest extends PersistenceTest {
@@ -46,99 +49,116 @@
@After
public void close() {
- if (getTransaction().isActive()) {
- getTransaction().rollback();
- }
+ if (getTransaction().isActive()) {
+ getTransaction().rollback();
+ }
}
@Test
public void emailCorrect() {
- user = new User("test1", "test1 name", "test(a)example.com", "some passwd", english, gb, getTimeZone());
- persist(user);
+ user = new User("test1", "test1 name", "test(a)example.com", "some passwd", english, gb, getTimeZone());
+ persist(user);
}
@Test(expected = InvalidStateException.class)
public void emailEmpty() {
- user = new User("test1", "test1 name", "", "some passwd", english, gb, getTimeZone());
- persist(user);
+ user = new User("test1", "test1 name", "", "some passwd", english, gb, getTimeZone());
+ persist(user);
}
@Test(expected = InvalidStateException.class)
public void emailIncorrect() {
- user = new User("test1", "test1 name", "falseEmail@", "some passwd", english, gb, getTimeZone());
- persist(user);
+ user = new User("test1", "test1 name", "falseEmail@", "some passwd", english, gb, getTimeZone());
+ persist(user);
}
@Before
public void insertData() throws Exception {
- openTransaction();
- assertEquals(0, userFinder.getAll().size());
- assertEquals(0, groupFinder.getAll().size());
- english = new I18nLanguage(new Long(1819), "English", "English", "en");
- languageManager.persist(english);
- gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom", "western", ",");
- countryManager.persist(gb);
- user = new User(USER_SHORT_NAME, USER_LONG_NAME, USER_EMAIL, USER_PASSWORD, english, gb, getTimeZone());
- persist(user);
+ openTransaction();
+ assertEquals(0, userFinder.getAll().size());
+ assertEquals(0, groupFinder.getAll().size());
+ english = new I18nLanguage(new Long(1819), "English", "English", "en");
+ languageManager.persist(english);
+ gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom", "western", ",");
+ countryManager.persist(gb);
+ user = new User(USER_SHORT_NAME, USER_LONG_NAME, USER_EMAIL, USER_PASSWORD, english, gb, getTimeZone());
+ persist(user);
}
@Test
public void loginIncorrect() {
- final User result = userManager.login("test", "test");
- assertNull(result);
+ final User result = userManager.login("test", "test");
+ assertNull(result);
}
@Test
public void loginWithEmailCorrect() {
- final User result = userManager.login(USER_EMAIL, USER_PASSWORD);
- assertNotNull(result.getId());
+ final User result = userManager.login(USER_EMAIL, USER_PASSWORD);
+ assertNotNull(result.getId());
}
@Test
public void loginWithNickCorrect() {
- final User result = userManager.login(USER_SHORT_NAME, USER_PASSWORD);
- assertNotNull(result.getId());
+ final User result = userManager.login(USER_SHORT_NAME, USER_PASSWORD);
+ assertNotNull(result.getId());
}
@Test(expected = InvalidStateException.class)
public void passwdLengthIncorrect() {
- user = new User("test1", "test1 name", "test(a)example.com", "pass", english, gb, getTimeZone());
- persist(user);
+ user = new User("test1", "test1 name", "test(a)example.com", "pass", english, gb, getTimeZone());
+ persist(user);
}
@Test(expected = EntityExistsException.class)
public void testUserExist() throws I18nNotFoundException {
- final User user1 = userManager.createUser("test", "test 1 name", "test1(a)example.com", "some password", "en",
- "GB", "GMT");
- persist(user1);
- final User user2 = userManager.createUser("test", "test 1 name", "test1(a)example.com", "some password", "en",
- "GB", "GMT");
- persist(user2);
+ final User user1 = userManager.createUser("test", "test 1 name", "test1(a)example.com", "some password", "en",
+ "GB", "GMT");
+ persist(user1);
+ final User user2 = userManager.createUser("test", "test 1 name", "test1(a)example.com", "some password", "en",
+ "GB", "GMT");
+ persist(user2);
}
@Test(expected = InvalidStateException.class)
public void userNameLengthIncorrect() {
- user = new User("test1", "te", "test(a)example.com", "some passwd", english, gb, getTimeZone());
- persist(user);
+ user = new User("test1", "te", "test(a)example.com", "some passwd", english, gb, getTimeZone());
+ persist(user);
}
@Test
+ public void userSaveAndGetCustomProperties() {
+ final User user1 = userManager.createUser("test", "test 1 name", "test1(a)example.com", "some password", "en",
+ "GB", "GMT");
+ final ChatUserParams userChatParams = new ChatUserParams("avatar", true, SubscriptionMode.autoAcceptAll,
+ "color");
+ user1.getCustomProperties().setData(ChatUserParams.class, userChatParams);
+ persist(user1);
+ final User find = userManager.find(user1.getId());
+ final CustomProperties customProperties = find.getCustomProperties();
+ assertEquals("avatar", customProperties.getData(ChatUserParams.class).getAvatar());
+ assertEquals("color", customProperties.getData(ChatUserParams.class).getChatColor());
+ assertEquals(SubscriptionMode.autoAcceptAll, customProperties.getData(ChatUserParams.class)
+ .getSubscriptionMode());
+ assertEquals(true, customProperties.getData(ChatUserParams.class).isPublishRoster());
+ }
+
+ @Test
public void userSearch() throws Exception, ParseException {
- userManager.reIndex();
- final SearchResult<User> result = userManager.search(USER_SHORT_NAME);
- assertEquals(1, (long) result.getSize());
- assertEquals(USER_SHORT_NAME, result.getList().get(0).getShortName());
- rollbackTransaction();
+ userManager.reIndex();
+ final SearchResult<User> result = userManager.search(USER_SHORT_NAME);
+ assertEquals(1, (long) result.getSize());
+ assertEquals(USER_SHORT_NAME, result.getList().get(0).getShortName());
+ rollbackTransaction();
}
@Test(expected = InvalidStateException.class)
public void userShortNameIncorrect() {
- user = new User("test1A", "test1 name", "test(a)example.com", "some passwd", english, gb, getTimeZone());
- persist(user);
+ user = new User("test1A", "test1 name", "test(a)example.com", "some passwd", english, gb, getTimeZone());
+ persist(user);
}
private TimeZone getTimeZone() {
- return TimeZone.getDefault();
+ return TimeZone.getDefault();
}
}
1
0
r837 - in trunk/src/main/java/org/ourproject/kune: platf/client/services workspace/client/ui/newtmp/sitebar/siteoptions workspace/client/ui/newtmp/sitebar/siteusermenu
by vjrj 08 Aug '08
by vjrj 08 Aug '08
08 Aug '08
Author: vjrj
Date: 2008-08-09 01:52:38 +0200 (Sat, 09 Aug 2008)
New Revision: 837
Modified:
trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java
Log:
Complete - task 23: SiteBar Menus (options, user menu)
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java 2008-08-08 23:16:06 UTC (rev 836)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java 2008-08-08 23:52:38 UTC (rev 837)
@@ -232,7 +232,7 @@
@Resource("org/ourproject/kune/platf/public/images/button-help-light.png")
AbstractImagePrototype buttonHelpLight();
- @Resource("org/ourproject/kune/platf/public/images/button-sitebar-arrow-down.gif")
+ @Resource("org/ourproject/kune/platf/public/images/arrowdown.gif")
AbstractImagePrototype buttonSitebarArrowDown();
@Resource("org/ourproject/kune/platf/public/images/by80x15.png")
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java 2008-08-08 23:16:06 UTC (rev 836)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java 2008-08-08 23:52:38 UTC (rev 837)
@@ -21,8 +21,8 @@
final I18nUITranslationService i18n, final Provider<I18nTranslator> translatorProvider) {
final PushButton optionsButton = new PushButton("");
// optionsButton.setText(i18n.t("Options"));
- optionsButton.setHTML("<div style=\"text-align: center;\">" + i18n.t("Options")
- + "<img style=\"vertical-align: middle;\" src=\"images/arrowdown.png\" /></div>");
+ optionsButton.setHTML(i18n.t("Options")
+ + "<img style=\"vertical-align: middle;\" src=\"images/arrowdown.png\" />");
optionsButton.setStyleName("k-sitebar-labellink");
ws.getSiteBar().addSeparator();
ws.getSiteBar().add(optionsButton);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java 2008-08-08 23:16:06 UTC (rev 836)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java 2008-08-08 23:52:38 UTC (rev 837)
@@ -51,8 +51,7 @@
}
public void setLoggedUserName(final String name) {
- loggedUserMenu.setHTML("<div style=\"text-align: center;\">" + name
- + "<img style=\"vertical-align: middle;\" src=\"images/arrowdown.png\" /></div>");
+ loggedUserMenu.setHTML(name + "<img style=\"vertical-align: middle;\" src=\"images/arrowdown.png\" />");
}
public void setParticipation(final MenuItemCollection<GroupDTO> participateInGroups) {
1
0
Author: vjrj
Date: 2008-08-09 01:16:06 +0200 (Sat, 09 Aug 2008)
New Revision: 836
Added:
trunk/src/main/java/org/ourproject/kune/platf/public/images/arrowdown.gif
trunk/src/main/java/org/ourproject/kune/platf/public/images/arrowdown.png
trunk/src/main/java/org/ourproject/kune/platf/public/images/group-def-icon.gif
trunk/src/main/java/org/ourproject/kune/platf/public/images/kune-preferences.gif
trunk/src/main/java/org/ourproject/kune/platf/public/images/kuneicon16.gif
Removed:
trunk/src/main/java/org/ourproject/kune/platf/public/images/button-sitebar-arrow-down.gif
Modified:
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitenewgroup/SiteNewGroupLinkPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignInLinkPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java
trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java
Log:
Complete - task 23: SiteBar Menus (options, user menu)
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-08 17:48:55 UTC (rev 835)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-08 23:16:06 UTC (rev 836)
@@ -632,6 +632,12 @@
}
});
+ $(StateManager.class).addSiteToken(SiteToken.translate.toString(), new Slot<StateToken>() {
+ public void onEvent(final StateToken previousStateToken) {
+ $(I18nTranslator.class).doShowTranslator();
+ }
+ });
+
final KunePlatform platform = $(KunePlatform.class);
$(Application.class).init(platform.getIndexedTools());
$(Application.class).subscribeActions(platform.getActions());
Copied: trunk/src/main/java/org/ourproject/kune/platf/public/images/arrowdown.gif (from rev 827, trunk/src/main/java/org/ourproject/kune/platf/public/images/button-sitebar-arrow-down.gif)
===================================================================
(Binary files differ)
Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/arrowdown.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/arrowdown.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/src/main/java/org/ourproject/kune/platf/public/images/button-sitebar-arrow-down.gif
===================================================================
(Binary files differ)
Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/group-def-icon.gif
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/group-def-icon.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/kune-preferences.gif
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/kune-preferences.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/kuneicon16.gif
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/kuneicon16.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java 2008-08-08 17:48:55 UTC (rev 835)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java 2008-08-08 23:16:06 UTC (rev 836)
@@ -171,7 +171,7 @@
unTransCenterPanel.add(unTransGrid);
transCenterPanel.add(transGrid);
final Frame recommFrame = new Frame("html/i18n-recom.html");
- // recommFrame.setHeight("220");
+ recommFrame.setHeight("auto");
recommendationPanel.add(recommFrame);
center.add(unTransCenterPanel);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-08-08 17:48:55 UTC (rev 835)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-08-08 23:16:06 UTC (rev 836)
@@ -136,20 +136,23 @@
private GridItem<GroupDTO> createDefMemberMenu(final GroupDTO group, final GridGroup gridGroup) {
final CustomMenu<GroupDTO> menu = new CustomMenu<GroupDTO>(group);
final String longName = group.getLongName();
- final String toolTip = i18n.t(group.getType().equals(GroupType.PERSONAL) ? "User nickname: [%s]"
- : "Group short name: [%s]", group.getShortName());
- final GridItem<GroupDTO> gridItem = new GridItem<GroupDTO>(group, gridGroup, group.getShortName(), imageUtils
- .getImageHtml(ImageDescriptor.groupDefIcon), longName, longName, " ", longName, toolTip, menu);
- if (!group.getType().equals(GroupType.PERSONAL)) {
+ boolean isPersonal = group.getType().equals(GroupType.PERSONAL);
+ final String toolTip = i18n.t(isPersonal ? "User nickname: [%s]" : "Group short name: [%s]", group
+ .getShortName());
+ final String imageHtml = isPersonal ? imageUtils.getImageHtml(ImageDescriptor.personDef) : imageUtils
+ .getImageHtml(ImageDescriptor.groupDefIcon);
+ final GridItem<GroupDTO> gridItem = new GridItem<GroupDTO>(group, gridGroup, group.getShortName(), imageHtml,
+ longName, longName, " ", longName, toolTip, menu);
+ if (!isPersonal) {
menu.addMenuItemList(otherOperations);
}
- if (session.isLogged() && !group.getType().equals(GroupType.PERSONAL)) {
+ if (session.isLogged() && !isPersonal) {
menu.addMenuItemList(otherLoggedOperations);
}
- if (group.getType().equals(GroupType.PERSONAL)) {
+ if (isPersonal) {
menu.addMenuItemList(otherOperationsUsers);
}
- if (session.isLogged() && group.getType().equals(GroupType.PERSONAL)) {
+ if (session.isLogged() && isPersonal) {
menu.addMenuItemList(otherLoggedOperationsUsers);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitenewgroup/SiteNewGroupLinkPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitenewgroup/SiteNewGroupLinkPanel.java 2008-08-08 17:48:55 UTC (rev 835)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitenewgroup/SiteNewGroupLinkPanel.java 2008-08-08 23:16:06 UTC (rev 836)
@@ -16,6 +16,5 @@
ws.getSiteBar().addSeparator();
ws.getSiteBar().add(newGroupHyperlink);
ws.getSiteBar().addSpacer();
- ws.getSiteBar().addSpacer();
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java 2008-08-08 17:48:55 UTC (rev 835)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java 2008-08-08 23:16:06 UTC (rev 836)
@@ -20,10 +20,14 @@
public SiteOptionsPanel(final SiteOptionsPresenter presenter, final WorkspaceSkeleton ws,
final I18nUITranslationService i18n, final Provider<I18nTranslator> translatorProvider) {
final PushButton optionsButton = new PushButton("");
- optionsButton.setText(i18n.t("Options"));
+ // optionsButton.setText(i18n.t("Options"));
+ optionsButton.setHTML("<div style=\"text-align: center;\">" + i18n.t("Options")
+ + "<img style=\"vertical-align: middle;\" src=\"images/arrowdown.png\" /></div>");
optionsButton.setStyleName("k-sitebar-labellink");
ws.getSiteBar().addSeparator();
ws.getSiteBar().add(optionsButton);
+ ws.getSiteBar().addSpacer();
+ ws.getSiteBar().addSpacer();
final Menu optionsMenu = new Menu();
optionsButton.addClickListener(new ClickListener() {
public void onClick(final Widget sender) {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignInLinkPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignInLinkPanel.java 2008-08-08 17:48:55 UTC (rev 835)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignInLinkPanel.java 2008-08-08 23:16:06 UTC (rev 836)
@@ -15,6 +15,7 @@
signInHyperlink.setText(i18n.t("Sign in to collaborate"));
signInHyperlink.setTargetHistoryToken(SiteToken.signin.toString());
ws.getSiteBar().add(signInHyperlink);
+ ws.getSiteBar().addSpacer();
}
public void setVisible(final boolean visible) {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java 2008-08-08 17:48:55 UTC (rev 835)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java 2008-08-08 23:16:06 UTC (rev 836)
@@ -35,7 +35,7 @@
}
});
final Item userPreferences = new Item(i18n.t("Your preferences"));
- userPreferences.setIcon("");
+ userPreferences.setIcon("images/kune-preferences.gif");
userPreferences.addListener(new BaseItemListenerAdapter() {
@Override
public void onClick(final BaseItem item, final EventObject e) {
@@ -51,7 +51,8 @@
}
public void setLoggedUserName(final String name) {
- loggedUserMenu.setText(name);
+ loggedUserMenu.setHTML("<div style=\"text-align: center;\">" + name
+ + "<img style=\"vertical-align: middle;\" src=\"images/arrowdown.png\" /></div>");
}
public void setParticipation(final MenuItemCollection<GroupDTO> participateInGroups) {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java 2008-08-08 17:48:55 UTC (rev 835)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java 2008-08-08 23:16:06 UTC (rev 836)
@@ -47,11 +47,12 @@
}
private void addPartipation(final GroupDTO group) {
- participateInGroups.add(new MenuItem<GroupDTO>("", group.getShortName(), new Slot<GroupDTO>() {
- public void onEvent(final GroupDTO param) {
- stateManager.gotoToken(group.getShortName());
- }
- }));
+ participateInGroups.add(new MenuItem<GroupDTO>("images/group-def-icon.gif", group.getShortName(),
+ new Slot<GroupDTO>() {
+ public void onEvent(final GroupDTO param) {
+ stateManager.gotoToken(group.getShortName());
+ }
+ }));
}
private void onUserSignIn(final UserInfoDTO userInfoDTO) {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java 2008-08-08 17:48:55 UTC (rev 835)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java 2008-08-08 23:16:06 UTC (rev 836)
@@ -39,9 +39,7 @@
public void addInTools(final Widget widget) {
entityTools.add(widget);
- entityTools.expand();
- // entitySummary.expand();
- mainPanel.syncSize();
+ entityTools.render(widget.getElement());
if (entityTools.isRendered()) {
entityTools.doLayout(false);
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java 2008-08-08 17:48:55 UTC (rev 835)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java 2008-08-08 23:16:06 UTC (rev 836)
@@ -25,7 +25,7 @@
bindScope(SessionScoped.class, Scopes.SINGLETON);
// test: use memory
// test_db: use mysql
- bindConstant().annotatedWith(JpaUnit.class).to("test_db");
+ bindConstant().annotatedWith(JpaUnit.class).to("test");
bindConstant().annotatedWith(PropertiesFileName.class).to("kune.properties");
bind(HttpServletRequest.class).to(HttpServletRequestMocked.class);
}
1
0
Author: vjrj
Date: 2008-08-08 19:48:55 +0200 (Fri, 08 Aug 2008)
New Revision: 835
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/ui/MenuItemCollection.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/CustomMenu.java
Removed:
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenu.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItemCollection.java
Modified:
trunk/src/main/java/org/ourproject/kune/platf/client/dto/ParticipationDataDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserInfoDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridItem.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
trunk/src/main/java/org/ourproject/kune/platf/server/ParticipationData.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfo.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslator.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteBottomTrayButton.java
trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java
trunk/src/main/resources/dozerBeanMapping.xml
trunk/src/test/java/org/ourproject/kune/platf/integration/site/UserServiceTest.java
Log:
Incomplete - task 23: SiteBar Menus (options, user menu)
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/ParticipationDataDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/ParticipationDataDTO.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/ParticipationDataDTO.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -25,32 +25,32 @@
public class ParticipationDataDTO implements IsSerializable {
- private List<LinkDTO> groupsIsAdmin;
- private List<LinkDTO> groupsIsCollab;
+ private List<GroupDTO> groupsIsAdmin;
+ private List<GroupDTO> groupsIsCollab;
public ParticipationDataDTO() {
- this(null, null);
+ this(null, null);
}
- public ParticipationDataDTO(final List<LinkDTO> groupsIsAdmin, final List<LinkDTO> groupsIsCollab) {
- this.groupsIsAdmin = groupsIsAdmin;
- this.groupsIsCollab = groupsIsCollab;
+ public ParticipationDataDTO(final List<GroupDTO> groupsIsAdmin, final List<GroupDTO> groupsIsCollab) {
+ this.groupsIsAdmin = groupsIsAdmin;
+ this.groupsIsCollab = groupsIsCollab;
}
- public List<LinkDTO> getGroupsIsAdmin() {
- return groupsIsAdmin;
+ public List<GroupDTO> getGroupsIsAdmin() {
+ return groupsIsAdmin;
}
- public void setGroupsIsAdmin(final List<LinkDTO> groupsIsAdmin) {
- this.groupsIsAdmin = groupsIsAdmin;
+ public List<GroupDTO> getGroupsIsCollab() {
+ return groupsIsCollab;
}
- public List<LinkDTO> getGroupsIsCollab() {
- return groupsIsCollab;
+ public void setGroupsIsAdmin(final List<GroupDTO> groupsIsAdmin) {
+ this.groupsIsAdmin = groupsIsAdmin;
}
- public void setGroupsIsCollab(final List<LinkDTO> groupsIsCollab) {
- this.groupsIsCollab = groupsIsCollab;
+ public void setGroupsIsCollab(final List<GroupDTO> groupsIsCollab) {
+ this.groupsIsCollab = groupsIsCollab;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserInfoDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserInfoDTO.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserInfoDTO.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -32,88 +32,88 @@
private String userHash;
private I18nLanguageDTO language;
private I18nCountryDTO country;
- private List<LinkDTO> groupsIsAdmin;
- private List<LinkDTO> groupsIsCollab;
+ private List<GroupDTO> groupsIsAdmin;
+ private List<GroupDTO> groupsIsCollab;
- public String getName() {
- return name;
- }
-
- public void setName(final String name) {
- this.name = name;
- }
-
public String getChatName() {
- return chatName;
+ return chatName;
}
public String getChatPassword() {
- return chatPassword;
+ return chatPassword;
}
- public void setChatPassword(final String password) {
- this.chatPassword = password;
+ public I18nCountryDTO getCountry() {
+ return country;
+ }
+ public List<GroupDTO> getGroupsIsAdmin() {
+ return groupsIsAdmin;
}
- public void setChatName(final String chatName) {
- this.chatName = chatName;
+ public List<GroupDTO> getGroupsIsCollab() {
+ return groupsIsCollab;
}
- public List<LinkDTO> getGroupsIsAdmin() {
- return groupsIsAdmin;
+ public String getHomePage() {
+ return homePage;
}
- public void setGroupsIsAdmin(final List<LinkDTO> groupsIsAdmin) {
- this.groupsIsAdmin = groupsIsAdmin;
+ public I18nLanguageDTO getLanguage() {
+ return language;
}
- public List<LinkDTO> getGroupsIsCollab() {
- return groupsIsCollab;
+ public String getName() {
+ return name;
}
- public void setGroupsIsCollab(final List<LinkDTO> groupsIsCollab) {
- this.groupsIsCollab = groupsIsCollab;
+ public String getShortName() {
+ return shortName;
}
- public String getHomePage() {
- return homePage;
+ public String getUserHash() {
+ return userHash;
}
- public void setHomePage(final String homePage) {
- this.homePage = homePage;
+ public void setChatName(final String chatName) {
+ this.chatName = chatName;
}
- public String getShortName() {
- return shortName;
+ public void setChatPassword(final String password) {
+ this.chatPassword = password;
+
}
- public void setShortName(final String shortName) {
- this.shortName = shortName;
+ public void setCountry(final I18nCountryDTO country) {
+ this.country = country;
}
- public String getUserHash() {
- return userHash;
+ public void setGroupsIsAdmin(final List<GroupDTO> groupsIsAdmin) {
+ this.groupsIsAdmin = groupsIsAdmin;
}
- public void setUserHash(final String userHash) {
- this.userHash = userHash;
+ public void setGroupsIsCollab(final List<GroupDTO> groupsIsCollab) {
+ this.groupsIsCollab = groupsIsCollab;
}
- public I18nLanguageDTO getLanguage() {
- return language;
+ public void setHomePage(final String homePage) {
+ this.homePage = homePage;
}
public void setLanguage(final I18nLanguageDTO language) {
- this.language = language;
+ this.language = language;
}
- public I18nCountryDTO getCountry() {
- return country;
+ public void setName(final String name) {
+ this.name = name;
}
- public void setCountry(final I18nCountryDTO country) {
- this.country = country;
+ public void setShortName(final String shortName) {
+ this.shortName = shortName;
}
+ public void setUserHash(final String userHash) {
+ this.userHash = userHash;
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -327,8 +327,9 @@
register(SingletonScope.class, new Factory<SiteUserMenu>(SiteUserMenu.class) {
public SiteUserMenu create() {
- final SiteUserMenuPresenter presenter = new SiteUserMenuPresenter($(Session.class));
- final SiteUserMenuPanel panel = new SiteUserMenuPanel(presenter, ws);
+ final SiteUserMenuPresenter presenter = new SiteUserMenuPresenter($(Session.class),
+ $(StateManager.class));
+ final SiteUserMenuPanel panel = new SiteUserMenuPanel(presenter, ws, i18n);
presenter.init(panel);
return presenter;
}
@@ -356,7 +357,7 @@
register(SingletonScope.class, new Factory<SiteOptions>(SiteOptions.class) {
public SiteOptions create() {
final SiteOptionsPresenter presenter = new SiteOptionsPresenter();
- final SiteOptionsPanel panel = new SiteOptionsPanel(presenter, ws);
+ final SiteOptionsPanel panel = new SiteOptionsPanel(presenter, ws, i18n, $$(I18nTranslator.class));
presenter.init(panel);
return presenter;
}
@@ -601,6 +602,7 @@
$(SiteSignInLink.class);
$(SiteSignOutLink.class);
$(SiteNewGroupLink.class);
+ $(SiteOptions.class);
$(SiteSearch.class);
$(SiteLogo.class);
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/MenuItemCollection.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/MenuItemCollection.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/MenuItemCollection.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -0,0 +1,31 @@
+/*
+ *
+ * ((e)) emite: A pure gwt (Google Web Toolkit) xmpp (jabber) library
+ *
+ * (c) 2008 The emite development team (see CREDITS for details)
+ * This file is part of emite.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.platf.client.ui;
+
+import java.util.ArrayList;
+
+
+public class MenuItemCollection<T> extends ArrayList<MenuItem<T>> {
+
+ private static final long serialVersionUID = 1L;
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/CustomMenu.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/CustomMenu.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/CustomMenu.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -0,0 +1,83 @@
+/*
+ *
+ * ((e)) emite: A pure gwt (Google Web Toolkit) xmpp (jabber) library
+ *
+ * (c) 2008 The emite development team (see CREDITS for details)
+ * This file is part of emite.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.platf.client.ui.gridmenu;
+
+import java.util.Iterator;
+
+import org.ourproject.kune.platf.client.ui.MenuItem;
+import org.ourproject.kune.platf.client.ui.MenuItemCollection;
+
+
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.DeferredCommand;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.widgets.menu.BaseItem;
+import com.gwtext.client.widgets.menu.Item;
+import com.gwtext.client.widgets.menu.Menu;
+import com.gwtext.client.widgets.menu.event.BaseItemListenerAdapter;
+
+public class CustomMenu<T> {
+ private final T param;
+ private final Menu menu;
+
+ /**
+ *
+ * @param param
+ * the uniq id (for instance a group short name, a xmpp uri
+ * of the object asociated with this menu
+ *
+ */
+ public CustomMenu(final T param) {
+ this.param = param;
+ menu = new Menu();
+ }
+
+ public void addMenuItem(final MenuItem<T> menuItem) {
+ final Item item = new Item(menuItem.getTitle());
+ item.setIcon(menuItem.getIcon());
+ menu.addItem(item);
+ item.addListener(new BaseItemListenerAdapter() {
+ public void onClick(final BaseItem item, final EventObject e) {
+ DeferredCommand.addCommand(new Command() {
+ public void execute() {
+ menuItem.fire(param);
+ }
+ });
+ }
+ });
+ }
+
+ @SuppressWarnings("unchecked")
+ public void addMenuItemList(final MenuItemCollection list) {
+ for (final Iterator iterator = list.iterator(); iterator.hasNext();) {
+ final MenuItem item = (MenuItem) iterator.next();
+ addMenuItem(item);
+ }
+ }
+
+ public void showMenu(final EventObject e) {
+ if (menu.getItems().length > 0) {
+ menu.showAt(e.getXY());
+ }
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridItem.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridItem.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridItem.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -1,5 +1,6 @@
package org.ourproject.kune.platf.client.ui.gridmenu;
+
public class GridItem<T> {
private GridGroup group;
@@ -11,11 +12,11 @@
private String tooltip;
private String tooltipTitle;
private T item;
- private GridMenu<T> menu;
+ private CustomMenu<T> menu;
public GridItem(final T item, final GridGroup group, final String id, final String iconHtml, final String title,
final String titleHtml, final String endIconHtml, final String tooltipTitle, final String tooltip,
- final GridMenu<T> menu) {
+ final CustomMenu<T> menu) {
this.item = item;
this.group = group;
this.id = id;
@@ -48,7 +49,7 @@
return item;
}
- public GridMenu<T> getMenu() {
+ public CustomMenu<T> getMenu() {
return menu;
}
@@ -88,7 +89,7 @@
this.item = item;
}
- public void setMenu(final GridMenu<T> menu) {
+ public void setMenu(final CustomMenu<T> menu) {
this.menu = menu;
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenu.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenu.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenu.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -1,81 +0,0 @@
-/*
- *
- * ((e)) emite: A pure gwt (Google Web Toolkit) xmpp (jabber) library
- *
- * (c) 2008 The emite development team (see CREDITS for details)
- * This file is part of emite.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.platf.client.ui.gridmenu;
-
-import java.util.Iterator;
-
-import org.ourproject.kune.platf.client.ui.MenuItem;
-
-import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.DeferredCommand;
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.widgets.menu.BaseItem;
-import com.gwtext.client.widgets.menu.Item;
-import com.gwtext.client.widgets.menu.Menu;
-import com.gwtext.client.widgets.menu.event.BaseItemListenerAdapter;
-
-public class GridMenu<T> {
- private final T param;
- private final Menu menu;
-
- /**
- *
- * @param param
- * the uniq id (for instance a group short name, a xmpp uri
- * of the object asociated with this menu
- *
- */
- public GridMenu(final T param) {
- this.param = param;
- menu = new Menu();
- }
-
- public void addMenuItem(final MenuItem<T> menuItem) {
- final Item item = new Item(menuItem.getTitle());
- item.setIcon(menuItem.getIcon());
- menu.addItem(item);
- item.addListener(new BaseItemListenerAdapter() {
- public void onClick(final BaseItem item, final EventObject e) {
- DeferredCommand.addCommand(new Command() {
- public void execute() {
- menuItem.fire(param);
- }
- });
- }
- });
- }
-
- @SuppressWarnings("unchecked")
- public void addMenuItemList(final GridMenuItemCollection list) {
- for (final Iterator iterator = list.iterator(); iterator.hasNext();) {
- final MenuItem item = (MenuItem) iterator.next();
- addMenuItem(item);
- }
- }
-
- public void showMenu(final EventObject e) {
- if (menu.getItems().length > 0) {
- menu.showAt(e.getXY());
- }
- }
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItemCollection.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItemCollection.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItemCollection.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -1,32 +0,0 @@
-/*
- *
- * ((e)) emite: A pure gwt (Google Web Toolkit) xmpp (jabber) library
- *
- * (c) 2008 The emite development team (see CREDITS for details)
- * This file is part of emite.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.platf.client.ui.gridmenu;
-
-import java.util.ArrayList;
-
-import org.ourproject.kune.platf.client.ui.MenuItem;
-
-public class GridMenuItemCollection<T> extends ArrayList<MenuItem<T>> {
-
- private static final long serialVersionUID = 1L;
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.HashMap;
+
import com.allen_sauer.gwt.log.client.Log;
import com.calclab.suco.client.signal.Signal;
import com.calclab.suco.client.signal.Slot;
@@ -52,7 +53,7 @@
private static final String END_ICON_HTML = "endIconHtmlField";
private static final String TOOLTIP = "tooltipField";
private static final String TOOLTIPTITLE = "tooltipTitleField";
- private final HashMap<String, GridMenu<T>> menuMap;
+ private final HashMap<String, CustomMenu<T>> menuMap;
private final HashMap<T, Record> recordMap;
private RecordDef recordDef;
private GroupingStore store;
@@ -107,7 +108,7 @@
bottomBar = new Toolbar();
super.setBottomToolbar(bottomBar);
}
- menuMap = new HashMap<String, GridMenu<T>>();
+ menuMap = new HashMap<String, CustomMenu<T>>();
recordMap = new HashMap<T, Record>();
super.addListener(new BoxComponentListenerAdapter() {
@Override
@@ -391,7 +392,7 @@
private void showMenu(final int rowIndex, final EventObject e) {
final Record record = store.getRecordAt(rowIndex);
- final GridMenu<T> menu = menuMap.get(record.getAsString(ID));
+ final CustomMenu<T> menu = menuMap.get(record.getAsString(ID));
if (menu != null) {
menu.showMenu(e);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/ParticipationData.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/ParticipationData.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/ParticipationData.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -21,34 +21,34 @@
import java.util.List;
-import org.ourproject.kune.platf.server.users.Link;
+import org.ourproject.kune.platf.server.domain.Group;
public class ParticipationData {
- private List<Link> groupsIsAdmin;
- private List<Link> groupsIsCollab;
+ private List<Group> groupsIsAdmin;
+ private List<Group> groupsIsCollab;
public ParticipationData() {
this(null, null);
}
- public ParticipationData(final List<Link> groupsIsAdmin, final List<Link> groupsIsCollab) {
+ public ParticipationData(final List<Group> groupsIsAdmin, final List<Group> groupsIsCollab) {
this.groupsIsAdmin = groupsIsAdmin;
this.groupsIsCollab = groupsIsCollab;
}
- public List<Link> getGroupsIsAdmin() {
+ public List<Group> getGroupsIsAdmin() {
return groupsIsAdmin;
}
- public void setGroupsIsAdmin(final List<Link> groupsIsAdmin) {
- this.groupsIsAdmin = groupsIsAdmin;
+ public List<Group> getGroupsIsCollab() {
+ return groupsIsCollab;
}
- public List<Link> getGroupsIsCollab() {
- return groupsIsCollab;
+ public void setGroupsIsAdmin(final List<Group> groupsIsAdmin) {
+ this.groupsIsAdmin = groupsIsAdmin;
}
- public void setGroupsIsCollab(final List<Link> groupsIsCollab) {
+ public void setGroupsIsCollab(final List<Group> groupsIsCollab) {
this.groupsIsCollab = groupsIsCollab;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -20,8 +20,6 @@
package org.ourproject.kune.platf.server.manager.impl;
-import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import javax.persistence.EntityManager;
@@ -42,7 +40,6 @@
import org.ourproject.kune.platf.server.domain.SocialNetwork;
import org.ourproject.kune.platf.server.domain.User;
import org.ourproject.kune.platf.server.manager.SocialNetworkManager;
-import org.ourproject.kune.platf.server.users.Link;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -147,28 +144,7 @@
final Long groupId = group.getId();
final List<Group> adminInGroups = finder.findAdminInGroups(groupId);
final List<Group> collabInGroups = finder.findCollabInGroups(groupId);
- final List<Link> groupsIsAdmin = new ArrayList<Link>();
- final List<Link> groupsIsCollab = new ArrayList<Link>();
- Iterator<Group> iter = adminInGroups.iterator();
- while (iter.hasNext()) {
- final Group g = iter.next();
- if (group.getId() != g.getId()) {
- // Don't self participation of group in same group
- groupsIsAdmin
- .add(new Link(g.getShortName(), g.getLongName(), "", g.getDefaultContent().getStateToken()));
- }
-
- }
- iter = collabInGroups.iterator();
- while (iter.hasNext()) {
- final Group g = iter.next();
- if (group.getId() != g.getId()) {
- groupsIsCollab.add(new Link(g.getShortName(), g.getLongName(), "", g.getDefaultContent()
- .getStateToken()));
- }
- }
-
- return new ParticipationData(groupsIsAdmin, groupsIsCollab);
+ return new ParticipationData(adminInGroups, collabInGroups);
}
public SocialNetworkRequestResult requestToJoin(final User user, final Group inGroup) throws DefaultException,
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfo.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfo.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfo.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -21,6 +21,7 @@
import java.util.List;
+import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.domain.I18nCountry;
import org.ourproject.kune.platf.server.domain.I18nLanguage;
@@ -30,90 +31,90 @@
private String chatName;
private String chatPassword;
private String homePage;
- private List<Link> groupsIsAdmin;
- private List<Link> groupsIsCollab;
+ private List<Group> groupsIsAdmin;
+ private List<Group> groupsIsCollab;
private String userHash;
private I18nLanguage language;
private I18nCountry country;
- public String getHomePage() {
- return homePage;
+ public String getChatName() {
+ return chatName;
}
- public void setHomePage(final String homePage) {
- this.homePage = homePage;
+ public String getChatPassword() {
+ return chatPassword;
}
- public String getName() {
- return name;
+ public I18nCountry getCountry() {
+ return country;
}
- public void setName(final String name) {
- this.name = name;
+ public List<Group> getGroupsIsAdmin() {
+ return groupsIsAdmin;
}
- public String getChatName() {
- return chatName;
+ public List<Group> getGroupsIsCollab() {
+ return groupsIsCollab;
}
- public void setChatName(final String chatName) {
- this.chatName = chatName;
+ public String getHomePage() {
+ return homePage;
}
- public String getChatPassword() {
- return chatPassword;
+ public I18nLanguage getLanguage() {
+ return language;
}
- public void setChatPassword(final String chatPassword) {
- this.chatPassword = chatPassword;
+ public String getName() {
+ return name;
}
- public List<Link> getGroupsIsCollab() {
- return groupsIsCollab;
+ public String getShortName() {
+ return shortName;
}
- public void setGroupsIsCollab(final List<Link> groupsIsCollab) {
- this.groupsIsCollab = groupsIsCollab;
+ public String getUserHash() {
+ return userHash;
}
- public List<Link> getGroupsIsAdmin() {
- return groupsIsAdmin;
+ public void setChatName(final String chatName) {
+ this.chatName = chatName;
}
- public void setGroupsIsAdmin(final List<Link> groupsIsAdmin) {
- this.groupsIsAdmin = groupsIsAdmin;
+ public void setChatPassword(final String chatPassword) {
+ this.chatPassword = chatPassword;
}
- public String getShortName() {
- return shortName;
+ public void setCountry(final I18nCountry country) {
+ this.country = country;
}
- public void setShortName(final String shortName) {
- this.shortName = shortName;
+ public void setGroupsIsAdmin(final List<Group> groupsIsAdmin) {
+ this.groupsIsAdmin = groupsIsAdmin;
}
- public void setUserHash(final String userHash) {
- this.userHash = userHash;
+ public void setGroupsIsCollab(final List<Group> groupsIsCollab) {
+ this.groupsIsCollab = groupsIsCollab;
}
- public String getUserHash() {
- return userHash;
+ public void setHomePage(final String homePage) {
+ this.homePage = homePage;
}
- public I18nLanguage getLanguage() {
- return language;
+ public void setLanguage(final I18nLanguage language) {
+ this.language = language;
}
- public void setLanguage(final I18nLanguage language) {
- this.language = language;
+ public void setName(final String name) {
+ this.name = name;
}
- public I18nCountry getCountry() {
- return country;
+ public void setShortName(final String shortName) {
+ this.shortName = shortName;
}
- public void setCountry(final I18nCountry country) {
- this.country = country;
+ public void setUserHash(final String userHash) {
+ this.userHash = userHash;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslator.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslator.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslator.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -21,6 +21,6 @@
public interface I18nTranslator {
- void show();
+ void doShowTranslator();
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPresenter.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPresenter.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -25,6 +25,7 @@
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.workspace.client.sitebar.Site;
+import com.calclab.suco.client.signal.Slot0;
import com.google.gwt.user.client.rpc.AsyncCallback;
public class I18nTranslatorPresenter implements I18nTranslator {
@@ -38,6 +39,11 @@
this.session = session;
this.i18nService = i18nService;
this.i18n = i18n;
+ session.onUserSignOut(new Slot0() {
+ public void onEvent() {
+ view.hideTranslatorAndIcon();
+ }
+ });
}
public void doClose() {
@@ -89,8 +95,4 @@
this.view = view;
}
- public void show() {
- view.show();
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorView.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorView.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -23,10 +23,12 @@
public interface I18nTranslatorView extends View {
- void show();
+ void close();
void hide();
- void close();
+ void hideTranslatorAndIcon();
+ void show();
+
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -92,6 +92,16 @@
dialog.hide();
}
+ public void hideTranslatorAndIcon() {
+ if (dialog.isRendered()) {
+ dialog.hide();
+ }
+ if (traybarButton != null) {
+ traybarButton.destroy();
+ traybarButton = null;
+ }
+ }
+
public void show() {
if (dialog == null) {
dialog = createDialog();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteBottomTrayButton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteBottomTrayButton.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteBottomTrayButton.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -30,4 +30,8 @@
ws.getSiteTraybar().addButton(traybarButton);
}
+ public void destroy() {
+ traybarButton.destroy();
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarPresenter.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarPresenter.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -193,7 +193,8 @@
} else {
view.showLoggedUserName(user.getShortName(), user.getHomePage());
view.setLogoutLinkVisible(true);
- view.setGroupsIsMember(user.getGroupsIsAdmin(), user.getGroupsIsCollab());
+ // view.setGroupsIsMember(user.getGroupsIsAdmin(),
+ // user.getGroupsIsCollab());
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -23,7 +23,6 @@
import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
import org.ourproject.kune.platf.client.dto.GroupDTO;
-import org.ourproject.kune.platf.client.dto.LinkDTO;
import org.ourproject.kune.platf.client.dto.ParticipationDataDTO;
import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
@@ -84,25 +83,17 @@
final ParticipationDataDTO participation = state.getParticipation();
final AccessRightsDTO rights = state.getGroupRights();
view.clear();
- final List<LinkDTO> groupsIsAdmin = participation.getGroupsIsAdmin();
- final List<LinkDTO> groupsIsCollab = participation.getGroupsIsCollab();
+ final List<GroupDTO> groupsIsAdmin = participation.getGroupsIsAdmin();
+ final List<GroupDTO> groupsIsCollab = participation.getGroupsIsCollab();
final int numAdmins = groupsIsAdmin.size();
final int numCollaborators = groupsIsCollab.size();
if (numAdmins == 0) {
collabCategory = collabOnlyCategory;
}
- for (final LinkDTO link : groupsIsAdmin) {
- // FIXME: return GroupDTO not LinkDTO from server
- final GroupDTO group = new GroupDTO();
- group.setShortName(link.getShortName());
- group.setLongName(link.getLongName());
+ for (final GroupDTO group : groupsIsAdmin) {
view.addItem(createGridItem(adminCategory, group, rights, unJoinMenuItem));
}
- for (final LinkDTO link : groupsIsCollab) {
- // FIXME: return GroupDTO not LinkDTO from server
- final GroupDTO group = new GroupDTO();
- group.setShortName(link.getShortName());
- group.setLongName(link.getLongName());
+ for (final GroupDTO group : groupsIsCollab) {
view.addItem(createGridItem(collabCategory, group, rights, unJoinMenuItem));
}
if (numAdmins > 0 || numCollaborators > 0) {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -12,11 +12,11 @@
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.ui.MenuItem;
+import org.ourproject.kune.platf.client.ui.MenuItemCollection;
+import org.ourproject.kune.platf.client.ui.gridmenu.CustomMenu;
import org.ourproject.kune.platf.client.ui.gridmenu.GridButton;
import org.ourproject.kune.platf.client.ui.gridmenu.GridGroup;
import org.ourproject.kune.platf.client.ui.gridmenu.GridItem;
-import org.ourproject.kune.platf.client.ui.gridmenu.GridMenu;
-import org.ourproject.kune.platf.client.ui.gridmenu.GridMenuItemCollection;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.sitebar.Site;
@@ -39,11 +39,11 @@
private final StateManager stateManager;
private final Provider<SocialNetworkServiceAsync> snServiceProvider;
private final Session session;
- private final GridMenuItemCollection<GroupDTO> otherOperations;
- private final GridMenuItemCollection<GroupDTO> otherLoggedOperations;
+ private final MenuItemCollection<GroupDTO> otherOperations;
+ private final MenuItemCollection<GroupDTO> otherLoggedOperations;
private final ImageUtils imageUtils;
- private final GridMenuItemCollection<GroupDTO> otherOperationsUsers;
- private final GridMenuItemCollection<GroupDTO> otherLoggedOperationsUsers;
+ private final MenuItemCollection<GroupDTO> otherOperationsUsers;
+ private final MenuItemCollection<GroupDTO> otherLoggedOperationsUsers;
public SocialNetworkPresenter(final I18nUITranslationService i18n, final StateManager stateManager,
final ImageUtils imageUtils, final Session session,
@@ -55,33 +55,33 @@
this.snServiceProvider = snServiceProvider;
createButtons();
createMenuActions();
- otherOperationsUsers = new GridMenuItemCollection<GroupDTO>();
- otherLoggedOperationsUsers = new GridMenuItemCollection<GroupDTO>();
- otherOperations = new GridMenuItemCollection<GroupDTO>();
- otherLoggedOperations = new GridMenuItemCollection<GroupDTO>();
+ otherOperationsUsers = new MenuItemCollection<GroupDTO>();
+ otherLoggedOperationsUsers = new MenuItemCollection<GroupDTO>();
+ otherOperations = new MenuItemCollection<GroupDTO>();
+ otherLoggedOperations = new MenuItemCollection<GroupDTO>();
}
public void addGroupOperation(final MenuItem<GroupDTO> operation, final boolean mustBeLogged) {
- GridMenuItemCollection<GroupDTO> collection;
+ MenuItemCollection<GroupDTO> collection;
collection = mustBeLogged ? otherLoggedOperations : otherOperations;
collection.add(operation);
}
public void addUserOperation(final MenuItem<GroupDTO> operation, final boolean mustBeLogged) {
- GridMenuItemCollection<GroupDTO> collection;
+ MenuItemCollection<GroupDTO> collection;
collection = mustBeLogged ? otherLoggedOperationsUsers : otherOperationsUsers;
collection.add(operation);
}
public void removeGroupOperation(final MenuItem<GroupDTO> operation, final boolean mustBeLogged) {
- GridMenuItemCollection<GroupDTO> collection;
+ MenuItemCollection<GroupDTO> collection;
collection = mustBeLogged ? otherLoggedOperations : otherOperations;
collection.remove(operation);
}
public void removeUserOperation(final MenuItem<GroupDTO> operation, final boolean mustBeLogged) {
- GridMenuItemCollection<GroupDTO> collection;
+ MenuItemCollection<GroupDTO> collection;
collection = mustBeLogged ? otherLoggedOperationsUsers : otherOperationsUsers;
collection.remove(operation);
}
@@ -89,7 +89,7 @@
protected GridItem<GroupDTO> createGridItem(final GridGroup groupCategory, final GroupDTO group,
final AccessRightsDTO rights, final MenuItem<GroupDTO>... gridMenuItems) {
final GridItem<GroupDTO> gridItem = createDefMemberMenu(group, groupCategory);
- final GridMenu<GroupDTO> menu = gridItem.getMenu();
+ final CustomMenu<GroupDTO> menu = gridItem.getMenu();
if (rights.isAdministrable()) {
for (final MenuItem<GroupDTO> item : gridMenuItems) {
menu.addMenuItem(item);
@@ -134,7 +134,7 @@
}
private GridItem<GroupDTO> createDefMemberMenu(final GroupDTO group, final GridGroup gridGroup) {
- final GridMenu<GroupDTO> menu = new GridMenu<GroupDTO>(group);
+ final CustomMenu<GroupDTO> menu = new CustomMenu<GroupDTO>(group);
final String longName = group.getLongName();
final String toolTip = i18n.t(group.getType().equals(GroupType.PERSONAL) ? "User nickname: [%s]"
: "Group short name: [%s]", group.getShortName());
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPanel.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -1,9 +1,52 @@
package org.ourproject.kune.workspace.client.ui.newtmp.sitebar.siteoptions;
+import org.ourproject.kune.workspace.client.i18n.I18nTranslator;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
+import com.calclab.suco.client.container.Provider;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.PushButton;
+import com.google.gwt.user.client.ui.Widget;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.widgets.menu.BaseItem;
+import com.gwtext.client.widgets.menu.Item;
+import com.gwtext.client.widgets.menu.Menu;
+import com.gwtext.client.widgets.menu.event.BaseItemListenerAdapter;
+
public class SiteOptionsPanel implements SiteOptionsView {
- public SiteOptionsPanel(final SiteOptionsPresenter presenter, final WorkspaceSkeleton ws) {
+ public SiteOptionsPanel(final SiteOptionsPresenter presenter, final WorkspaceSkeleton ws,
+ final I18nUITranslationService i18n, final Provider<I18nTranslator> translatorProvider) {
+ final PushButton optionsButton = new PushButton("");
+ optionsButton.setText(i18n.t("Options"));
+ optionsButton.setStyleName("k-sitebar-labellink");
+ ws.getSiteBar().addSeparator();
+ ws.getSiteBar().add(optionsButton);
+ final Menu optionsMenu = new Menu();
+ optionsButton.addClickListener(new ClickListener() {
+ public void onClick(final Widget sender) {
+ optionsMenu.showAt(sender.getAbsoluteLeft(), sender.getAbsoluteTop() + 10);
+ }
+ });
+ final Item linkHelpInTrans = new Item(i18n.t("Help with the translation"), new BaseItemListenerAdapter() {
+ @Override
+ public void onClick(BaseItem item, EventObject e) {
+ super.onClick(item, e);
+ translatorProvider.get().doShowTranslator();
+ }
+ }, "images/language.gif");
+
+ final Item linkKuneBugs = new Item(i18n.t("Report kune bugs"), new BaseItemListenerAdapter() {
+ @Override
+ public void onClick(BaseItem item, EventObject e) {
+ super.onClick(item, e);
+ Window.open("http://code.google.com/p/kune/issues/list", "_blank", null);
+ }
+ }, "images/kuneicon16.gif");
+ optionsMenu.addItem(linkHelpInTrans);
+ optionsMenu.addItem(linkKuneBugs);
+
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPresenter.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteoptions/SiteOptionsPresenter.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -4,19 +4,17 @@
public class SiteOptionsPresenter implements SiteOptions {
-private SiteOptionsView view;
+ private SiteOptionsView view;
-public SiteOptionsPresenter() {
-}
+ public SiteOptionsPresenter() {
+ }
-public void init(SiteOptionsView view) {
-this.view = view;
-}
-
-
public View getView() {
- return view;
+ return view;
}
-}
+ public void init(final SiteOptionsView view) {
+ this.view = view;
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -1,39 +1,72 @@
package org.ourproject.kune.workspace.client.ui.newtmp.sitebar.siteusermenu;
-import java.util.List;
-
-import org.ourproject.kune.platf.client.dto.LinkDTO;
+import org.ourproject.kune.platf.client.dto.GroupDTO;
+import org.ourproject.kune.platf.client.ui.MenuItemCollection;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.PushButton;
import com.google.gwt.user.client.ui.Widget;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.widgets.menu.BaseItem;
+import com.gwtext.client.widgets.menu.Item;
import com.gwtext.client.widgets.menu.Menu;
+import com.gwtext.client.widgets.menu.MenuItem;
+import com.gwtext.client.widgets.menu.event.BaseItemListenerAdapter;
public class SiteUserMenuPanel implements SiteUserMenuView {
private final PushButton loggedUserMenu;
private final Widget separator;
private final Menu userMenu;
+ private final Menu userParticipation;
- public SiteUserMenuPanel(final SiteUserMenuPresenter presenter, final WorkspaceSkeleton ws) {
+ public SiteUserMenuPanel(final SiteUserMenuPresenter presenter, final WorkspaceSkeleton ws,
+ final I18nUITranslationService i18n) {
loggedUserMenu = new PushButton("");
+ loggedUserMenu.setStyleName("k-sitebar-labellink");
ws.getSiteBar().add(loggedUserMenu);
separator = ws.getSiteBar().addSeparator();
userMenu = new Menu();
loggedUserMenu.addClickListener(new ClickListener() {
public void onClick(final Widget sender) {
- userMenu.showAt(sender.getAbsoluteLeft(), sender.getAbsoluteTop());
+ userMenu.showAt(sender.getAbsoluteLeft(), sender.getAbsoluteTop() + 10);
}
});
+ final Item userPreferences = new Item(i18n.t("Your preferences"));
+ userPreferences.setIcon("");
+ userPreferences.addListener(new BaseItemListenerAdapter() {
+ @Override
+ public void onClick(final BaseItem item, final EventObject e) {
+ super.onClick(item, e);
+ presenter.onUserPreferences();
+ }
+ });
+ userMenu.addItem(userPreferences);
+ userParticipation = new Menu();
+ final MenuItem userParticipationItem = new MenuItem(i18n.t("Your groups"), userParticipation);
+ userParticipationItem.setIcon("");
+ userMenu.addItem(userParticipationItem);
}
public void setLoggedUserName(final String name) {
loggedUserMenu.setText(name);
}
- public void setUseGroupsIsMember(final List<LinkDTO> groupsIsAdmin, final List<LinkDTO> groupsIsCollab) {
- // TODO Auto-generated method stub
+ public void setParticipation(final MenuItemCollection<GroupDTO> participateInGroups) {
+ for (final org.ourproject.kune.platf.client.ui.MenuItem<GroupDTO> groupItem : participateInGroups) {
+ userParticipation.removeAll();
+ final Item item = new Item(groupItem.getTitle(), new BaseItemListenerAdapter() {
+ @Override
+ public void onClick(BaseItem item, EventObject e) {
+ super.onClick(item, e);
+ groupItem.fire(null);
+ }
+ });
+ item.setIcon(groupItem.getIcon());
+ userParticipation.addItem(item);
+ }
}
public void setVisible(final boolean visible) {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -1,8 +1,12 @@
package org.ourproject.kune.workspace.client.ui.newtmp.sitebar.siteusermenu;
import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.dto.GroupDTO;
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.ui.MenuItem;
+import org.ourproject.kune.platf.client.ui.MenuItemCollection;
import com.calclab.suco.client.signal.Slot;
import com.calclab.suco.client.signal.Slot0;
@@ -10,14 +14,17 @@
public class SiteUserMenuPresenter implements SiteUserMenu {
private SiteUserMenuView view;
+ private final MenuItemCollection<GroupDTO> participateInGroups;
+ private final StateManager stateManager;
- public SiteUserMenuPresenter(final Session session) {
+ public SiteUserMenuPresenter(final Session session, final StateManager stateManager) {
+ this.stateManager = stateManager;
+ participateInGroups = new MenuItemCollection<GroupDTO>();
session.onUserSignIn(new Slot<UserInfoDTO>() {
public void onEvent(final UserInfoDTO userInfoDTO) {
- view.setVisible(true);
- view.setLoggedUserName(userInfoDTO.getShortName());
- view.setUseGroupsIsMember(userInfoDTO.getGroupsIsAdmin(), userInfoDTO.getGroupsIsCollab());
+ onUserSignIn(userInfoDTO);
}
+
});
session.onUserSignOut(new Slot0() {
public void onEvent() {
@@ -35,4 +42,29 @@
this.view = view;
}
+ public void onUserPreferences() {
+ // TODO Auto-generated method stub
+ }
+
+ private void addPartipation(final GroupDTO group) {
+ participateInGroups.add(new MenuItem<GroupDTO>("", group.getShortName(), new Slot<GroupDTO>() {
+ public void onEvent(final GroupDTO param) {
+ stateManager.gotoToken(group.getShortName());
+ }
+ }));
+ }
+
+ private void onUserSignIn(final UserInfoDTO userInfoDTO) {
+ view.setVisible(true);
+ view.setLoggedUserName(userInfoDTO.getShortName());
+ participateInGroups.clear();
+ for (final GroupDTO group : userInfoDTO.getGroupsIsAdmin()) {
+ addPartipation(group);
+ }
+ for (final GroupDTO group : userInfoDTO.getGroupsIsCollab()) {
+ addPartipation(group);
+ }
+ view.setParticipation(participateInGroups);
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuView.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuView.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -1,15 +1,14 @@
package org.ourproject.kune.workspace.client.ui.newtmp.sitebar.siteusermenu;
-import java.util.List;
-
import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.LinkDTO;
+import org.ourproject.kune.platf.client.dto.GroupDTO;
+import org.ourproject.kune.platf.client.ui.MenuItemCollection;
public interface SiteUserMenuView extends View {
void setLoggedUserName(String name);
- void setUseGroupsIsMember(List<LinkDTO> groupsIsAdmin, List<LinkDTO> groupsIsCollab);
+ void setParticipation(MenuItemCollection<GroupDTO> participateInGroups);
void setVisible(boolean visible);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -39,6 +39,8 @@
public void addInTools(final Widget widget) {
entityTools.add(widget);
+ entityTools.expand();
+ // entitySummary.expand();
mainPanel.syncSize();
if (entityTools.isRendered()) {
entityTools.doLayout(false);
Modified: trunk/src/main/resources/dozerBeanMapping.xml
===================================================================
--- trunk/src/main/resources/dozerBeanMapping.xml 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/main/resources/dozerBeanMapping.xml 2008-08-08 17:48:55 UTC (rev 835)
@@ -179,18 +179,6 @@
<class-a>org.ourproject.kune.platf.client.dto.UserInfoDTO</class-a>
<class-b>org.ourproject.kune.platf.server.users.UserInfo</class-b>
<field>
- <a>groupsIsAdmin</a>
- <b>groupsIsAdmin</b>
- <a-hint>org.ourproject.kune.platf.client.dto.LinkDTO</a-hint>
- <b-hint>org.ourproject.kune.platf.server.users.Link</b-hint>
- </field>
- <field>
- <a>groupsIsCollab</a>
- <b>groupsIsCollab</b>
- <a-hint>org.ourproject.kune.platf.client.dto.LinkDTO</a-hint>
- <b-hint>org.ourproject.kune.platf.server.users.Link</b-hint>
- </field>
- <field>
<a>language</a>
<b>language</b>
<a-hint>
@@ -219,18 +207,6 @@
<class-b>
org.ourproject.kune.platf.server.ParticipationData
</class-b>
- <field>
- <a>groupsIsAdmin</a>
- <b>groupsIsAdmin</b>
- <a-hint>org.ourproject.kune.platf.client.dto.LinkDTO</a-hint>
- <b-hint>org.ourproject.kune.platf.server.users.Link</b-hint>
- </field>
- <field>
- <a>groupsIsCollab</a>
- <b>groupsIsCollab</b>
- <a-hint>org.ourproject.kune.platf.client.dto.LinkDTO</a-hint>
- <b-hint>org.ourproject.kune.platf.server.users.Link</b-hint>
- </field>
</mapping>
<mapping>
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/site/UserServiceTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/site/UserServiceTest.java 2008-08-08 04:20:12 UTC (rev 834)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/site/UserServiceTest.java 2008-08-08 17:48:55 UTC (rev 835)
@@ -8,9 +8,9 @@
import org.junit.Before;
import org.junit.Test;
+import org.ourproject.kune.platf.client.dto.GroupDTO;
import org.ourproject.kune.platf.client.dto.I18nCountryDTO;
import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.LinkDTO;
import org.ourproject.kune.platf.client.dto.TimeZoneDTO;
import org.ourproject.kune.platf.client.dto.UserDTO;
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
@@ -20,10 +20,10 @@
import org.ourproject.kune.platf.integration.IntegrationTest;
import org.ourproject.kune.platf.integration.IntegrationTestHelper;
import org.ourproject.kune.platf.server.UserSession;
+import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.manager.I18nLanguageManager;
import org.ourproject.kune.platf.server.mapper.Mapper;
import org.ourproject.kune.platf.server.properties.DatabaseProperties;
-import org.ourproject.kune.platf.server.users.Link;
import org.ourproject.kune.platf.server.users.UserInfo;
import org.ourproject.kune.platf.server.users.UserInfoService;
import org.ourproject.kune.workspace.client.sitebar.rpc.UserService;
@@ -50,78 +50,77 @@
@Test(expected = EmailAddressInUseException.class)
public void createUserExistingEmailFails() throws Exception {
- assertNull(session.getUser().getId());
- final UserDTO user = new UserDTO("test", "test", "123456", properties.getAdminEmail(), lang, country, timezone,
- null, true, SubscriptionMode.manual, "blue");
- userService.createUser(user);
+ assertNull(session.getUser().getId());
+ final UserDTO user = new UserDTO("test", "test", "123456", properties.getAdminEmail(), lang, country, timezone,
+ null, true, SubscriptionMode.manual, "blue");
+ userService.createUser(user);
}
@Test(expected = GroupNameInUseException.class)
public void createUserExistingNameFails() throws Exception {
- assertNull(session.getUser().getId());
- final UserDTO user = new UserDTO("test", properties.getAdminShortName(), "123456", "example(a)example.com", lang,
- country, timezone, null, true, SubscriptionMode.manual, "blue");
- userService.createUser(user);
+ assertNull(session.getUser().getId());
+ final UserDTO user = new UserDTO("test", properties.getAdminShortName(), "123456", "example(a)example.com", lang,
+ country, timezone, null, true, SubscriptionMode.manual, "blue");
+ userService.createUser(user);
}
@Before
public void init() {
- new IntegrationTestHelper(this);
- lang = new I18nLanguageDTO();
- country = new I18nCountryDTO();
- timezone = new TimeZoneDTO();
- lang.setCode("en");
- country.setCode("GB");
- timezone.setId("GMT");
+ new IntegrationTestHelper(this);
+ lang = new I18nLanguageDTO();
+ country = new I18nCountryDTO();
+ timezone = new TimeZoneDTO();
+ lang.setCode("en");
+ country.setCode("GB");
+ timezone.setId("GMT");
}
@Test(expected = SessionExpiredException.class)
public void testReloadUserInfoNotLogged() throws Exception {
- assertNull(session.getUser().getId());
- userService.reloadUserInfo("AndOldUserHash");
+ assertNull(session.getUser().getId());
+ userService.reloadUserInfo("AndOldUserHash");
}
@Test
public void testSiteEmailLogin() throws Exception {
- assertNull(session.getUser().getId());
- userService.login(properties.getAdminEmail(), properties.getAdminPassword());
- assertNotNull(session.getUser().getId());
+ assertNull(session.getUser().getId());
+ userService.login(properties.getAdminEmail(), properties.getAdminPassword());
+ assertNotNull(session.getUser().getId());
}
@Test
public void testSiteNameLogin() throws Exception {
- assertNull(session.getUser().getId());
- userService.login(properties.getAdminShortName(), properties.getAdminPassword());
- assertNotNull(session.getUser().getId());
+ assertNull(session.getUser().getId());
+ userService.login(properties.getAdminShortName(), properties.getAdminPassword());
+ assertNotNull(session.getUser().getId());
}
@Test
public void testUserInfo() throws Exception {
- doLogin();
- final UserInfo userInfo = userInfoService.buildInfo(session.getUser(), session.getHash());
+ doLogin();
+ final UserInfo userInfo = userInfoService.buildInfo(session.getUser(), session.getHash());
- final UserInfoDTO userInfoDTO = mapper.map(userInfo, UserInfoDTO.class);
- assertEquals(userInfo.getName(), userInfoDTO.getName());
- assertEquals(userInfo.getChatName(), userInfoDTO.getChatName());
- assertEquals(userInfo.getChatPassword(), userInfoDTO.getChatPassword());
- final List<Link> adminsGroup = userInfo.getGroupsIsAdmin();
- final List<LinkDTO> adminsGroupDTO = userInfoDTO.getGroupsIsAdmin();
- assertEqualListsLink(adminsGroupDTO, adminsGroup);
+ final UserInfoDTO userInfoDTO = mapper.map(userInfo, UserInfoDTO.class);
+ assertEquals(userInfo.getName(), userInfoDTO.getName());
+ assertEquals(userInfo.getChatName(), userInfoDTO.getChatName());
+ assertEquals(userInfo.getChatPassword(), userInfoDTO.getChatPassword());
+ final List<Group> adminsGroup = userInfo.getGroupsIsAdmin();
+ final List<GroupDTO> adminsGroupDTO = userInfoDTO.getGroupsIsAdmin();
+ assertEqualGroupLists(adminsGroupDTO, adminsGroup);
}
- private void assertEqualListsLink(final List<LinkDTO> listDTO, final List<Link> list) {
- assertEquals(listDTO.size(), list.size());
- for (int i = 0; i < listDTO.size(); i++) {
- final Object object = listDTO.get(i);
- assertEquals(LinkDTO.class, object.getClass());
- final LinkDTO d = (LinkDTO) object;
- final Link l = list.get(i);
- assertNotNull(d);
- assertNotNull(l);
- final LinkDTO map = mapper.map(l, LinkDTO.class);
- assertEquals(map.getShortName(), d.getShortName());
- assertEquals(map.getLink(), d.getLink());
- }
+ private void assertEqualGroupLists(final List<GroupDTO> listDTO, final List<Group> list) {
+ assertEquals(listDTO.size(), list.size());
+ for (int i = 0; i < listDTO.size(); i++) {
+ final Object object = listDTO.get(i);
+ assertEquals(GroupDTO.class, object.getClass());
+ final GroupDTO d = (GroupDTO) object;
+ final Group l = list.get(i);
+ assertNotNull(d);
+ assertNotNull(l);
+ final GroupDTO map = mapper.map(l, GroupDTO.class);
+ assertEquals(map.getShortName(), d.getShortName());
+ }
}
}
1
0
Author: vjrj
Date: 2008-08-08 06:20:12 +0200 (Fri, 08 Aug 2008)
New Revision: 834
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupType.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkRequestResult.java
trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizated.java
trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizatedMethodInterceptor.java
trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherType.java
trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java
Removed:
trunk/img/emite-groups-logo.svg
trunk/img/emite-groups.png
trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupType.java
trunk/src/main/java/org/ourproject/kune/platf/server/mapper/GroupTypeConverter.java
Modified:
trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java
trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
trunk/src/main/java/org/ourproject/kune/app/public/css/workspace.css
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java
trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkService.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java
trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/SocialNetworkManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java
trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/search/GroupLiveSearchPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/search/UserLiveSearcherPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/entitylogo/EntityLogoPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Entity.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java
trunk/src/main/resources/dozerBeanMapping.xml
trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java
trunk/src/test/java/org/ourproject/kune/platf/integration/kuneservice/GroupServiceTest.java
trunk/src/test/java/org/ourproject/kune/platf/server/manager/GroupManagerTest.java
trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java
trunk/src/test/java/org/ourproject/kune/testhelper/ctx/DomainContext.java
Log:
Complete - task 37: Resolve SN Rights problems
Enums use in UI. Some SN adjusts.
Deleted: trunk/img/emite-groups-logo.svg
===================================================================
--- trunk/img/emite-groups-logo.svg 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/img/emite-groups-logo.svg 2008-08-08 04:20:12 UTC (rev 834)
@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://web.resource.org/cc/"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="42"
- height="42"
- id="svg2533"
- sodipodi:version="0.32"
- inkscape:version="0.45.1"
- version="1.0"
- inkscape:export-filename="/Users/vjrj/Desktop/emite-groups.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90"
- sodipodi:docbase="/Users/vjrj/Desktop"
- sodipodi:docname="emite-groups-logo.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape">
- <defs
- id="defs2535" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="9.45"
- inkscape:cx="29.482892"
- inkscape:cy="20"
- inkscape:current-layer="layer1"
- showgrid="true"
- inkscape:grid-bbox="true"
- inkscape:document-units="px"
- width="42px"
- height="42px"
- inkscape:window-width="756"
- inkscape:window-height="581"
- inkscape:window-x="354"
- inkscape:window-y="104" />
- <metadata
- id="metadata2538">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- id="layer1"
- inkscape:label="Layer 1"
- inkscape:groupmode="layer">
- <text
- xml:space="preserve"
- style="font-size:23.88686371px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:125%;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;fill-rule:nonzero;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Emblem"
- x="-0.14885554"
- y="28.014141"
- id="text2516"
- sodipodi:linespacing="125%"><tspan
- sodipodi:role="line"
- id="tspan2518"
- x="-0.14885554"
- y="28.014141"
- dy="0 0 -0.57697296"><tspan
- style="fill:#ff6600"
- id="tspan2520">((</tspan>e<tspan
- style="fill:#ff6600"
- id="tspan2522"
- dy="0.57697296">))</tspan></tspan></text>
- <g
- id="g2551"
- transform="matrix(0.126788,0,0,0.126788,107.24045,44.350445)">
- <g
- transform="matrix(1.7831728,0,0,1.7831728,-79.227654,-1724.5839)"
- id="g2524">
- <text
- xml:space="preserve"
- style="font-size:49.60492325px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:89.99999762%;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;opacity:1;fill:#784421;fill-opacity:1;fill-rule:nonzero;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Emblem"
- x="-219.35106"
- y="817.05505"
- id="text2526"
- sodipodi:linespacing="89.999998%"
- transform="scale(0.9684286,1.0326006)"><tspan
- sodipodi:role="line"
- x="-219.35106"
- y="817.05505"
- id="tspan2528">emite</tspan></text>
- <text
- xml:space="preserve"
- style="font-size:23.32044411px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:89.99999762%;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;opacity:1;fill:#784421;fill-opacity:1;fill-rule:nonzero;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Emblem"
- x="-217.47432"
- y="839.24841"
- id="text2530"
- sodipodi:linespacing="89.999998%"
- transform="scale(0.9684286,1.0326006)"><tspan
- sodipodi:role="line"
- x="-217.47432"
- y="839.24841"
- id="tspan2532">xmpp & gwt</tspan></text>
- </g>
- <text
- inkscape:export-ydpi="32.508678"
- inkscape:export-xdpi="32.508678"
- inkscape:export-filename="/home/vjrj/proyectos/ourproject.org/kune/dev/emite/emite/img/emite-ui.png"
- transform="scale(0.9684286,1.0326006)"
- sodipodi:linespacing="89.999998%"
- id="text2534"
- y="-133.38048"
- x="-471.8595"
- style="font-size:34.96242523px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:89.99999762%;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;opacity:1;fill:#666666;fill-opacity:1;fill-rule:nonzero;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Emblem"
- xml:space="preserve"><tspan
- id="tspan2536"
- y="-133.38048"
- x="-471.8595"
- sodipodi:role="line">ui application</tspan></text>
- </g>
- </g>
-</svg>
Deleted: trunk/img/emite-groups.png
===================================================================
(Binary files differ)
Modified: trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -46,6 +46,5 @@
public void onModuleLoadCont() {
Kune.create();
- // RootPanel.getBodyElement().setClassName("kunebody");
}
}
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-08-08 04:20:12 UTC (rev 834)
@@ -2699,25 +2699,9 @@
background-image: url(img/language.gif) !important;
}
-.chat-icon {
- background-image: url(img/chat.gif) !important;
-}
-.group-icon {
- background-image: url(img/group.gif) !important;
-}
-.user-icon {
- background-image: url(img/user.gif) !important;
-}
-.userf-icon {
- background-image: url(img/userf.gif) !important;
-}
-
-
-
-
/* RTE Text editor */
.kune-TexEditorPanel-TextArea {
margin: 3px;
@@ -3484,13 +3468,13 @@
}
.k-toolselectoritem-notsel a {
- color: blue;
+ color: #0000FF;
padding: 0 9px;
text-decoration: none;
}
.k-toolselectoritem-notsel a:hover {
- text-decoration: none;
+ text-decoration: underline;
}
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-08-08 04:20:12 UTC (rev 834)
@@ -618,11 +618,11 @@
}
.k-toolselectoritem-notsel a {
- color: blue;
+ color: #0000FF;
padding: 0 9px;
text-decoration: none;
}
.k-toolselectoritem-notsel a:hover {
- text-decoration: none;
+ text-decoration: underline;
}
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/workspace.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/workspace.css 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/workspace.css 2008-08-08 04:20:12 UTC (rev 834)
@@ -790,19 +790,3 @@
.i18n-icon {
background-image: url(img/language.gif) !important;
}
-
-.chat-icon {
- background-image: url(img/chat.gif) !important;
-}
-
-.group-icon {
- background-image: url(img/group.gif) !important;
-}
-
-.user-icon {
- background-image: url(img/user.gif) !important;
-}
-
-.userf-icon {
- background-image: url(img/userf.gif) !important;
-}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -35,7 +35,6 @@
public class ChatClientNewModule extends AbstractModule {
public ChatClientNewModule() {
- super(ChatClientNewModule.class);
}
@Override
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -65,7 +65,7 @@
initData.getChatRoomHost());
chat = new ChatEngineXmpp(emiteUIDialog, chatOptions, i18n, ws);
groupMembersSummaryProvider.get().addUserOperation(
- new MenuItem<GroupDTO>("images/chat-basic.gif", i18n.t("Start a chat with this member"),
+ new MenuItem<GroupDTO>("images/new-chat.gif", i18n.t("Start a chat with this member"),
new Slot<GroupDTO>() {
public void onEvent(final GroupDTO group) {
emiteUIDialog.show();
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -82,7 +82,8 @@
if (traybarButton == null) {
traybarButton = new ToolbarButton();
traybarButton.setTooltip(i18n.t("Show/hide the chat window"));
- traybarButton.setIcon("images/emite-chat.gif");
+ // traybarButton.setIcon("images/emite-chat.gif");
+ traybarButton.setIcon("images/e-icon.gif");
traybarButton.addListener(new ButtonListenerAdapter() {
@Override
public void onClick(final Button button, final EventObject e) {
@@ -92,9 +93,18 @@
emiteDialog.show();
}
}
-
});
ws.getSiteTraybar().addButton(traybarButton);
+ emiteDialog.onChatAttended(new Slot<String>() {
+ public void onEvent(final String parameter) {
+ traybarButton.setIcon("images/e-icon.gif");
+ }
+ });
+ emiteDialog.onChatUnattendedWithActivity(new Slot<String>() {
+ public void onEvent(final String parameter) {
+ traybarButton.setIcon("images/e-icon-a.gif");
+ }
+ });
}
emiteDialog.setEnableStatusUI(true);
emiteDialog.hide();
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -45,7 +45,6 @@
public class DocumentClientNewModule extends AbstractModule {
public DocumentClientNewModule() {
- super(DocumentClientNewModule.class);
}
@Override
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -24,7 +24,6 @@
import java.util.HashMap;
import org.ourproject.kune.platf.client.dispatch.ActionEvent;
-import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.tool.ClientTool;
import com.calclab.suco.client.signal.Slot0;
@@ -33,7 +32,7 @@
ClientTool getTool(String toolName);
- void init(StateManager stateManager, HashMap<String, ClientTool> tools);
+ void init(HashMap<String, ClientTool> tools);
void onApplicationStart(Slot0 slot);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -32,7 +32,6 @@
import org.ourproject.kune.platf.client.rpc.SiteServiceAsync;
import org.ourproject.kune.platf.client.services.KuneErrorHandler;
import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.tool.ClientTool;
import org.ourproject.kune.platf.client.ui.WindowUtils;
import org.ourproject.kune.platf.client.utils.PrefetchUtilities;
@@ -54,7 +53,6 @@
private final Session session;
private final Signal0 onApplicationStart;
private final Signal0 onApplicationStop;
- private StateManager stateManager;
public ApplicationDefault(final Session session, final KuneErrorHandler errorHandler, final WorkspaceSkeleton ws) {
this.session = session;
@@ -76,8 +74,7 @@
return tools.get(toolName);
}
- public void init(final StateManager stateManager, final HashMap<String, ClientTool> tools) {
- this.stateManager = stateManager;
+ public void init(final HashMap<String, ClientTool> tools) {
this.tools = tools;
}
@@ -127,7 +124,6 @@
checkChatDomain(initData.getChatDomain());
session.setInitData(initData);
session.setCurrentUserInfo(initData.getUserInfo());
- stateManager.reload();
RootPanel.get("kuneinitialcurtain").setVisible(false);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -20,20 +20,16 @@
package org.ourproject.kune.platf.client.dto;
+
import com.google.gwt.user.client.rpc.IsSerializable;
public class GroupDTO implements IsSerializable {
- public static final String ORGANIZATION = "ORGANIZATION";
- public static final String COMMUNITY = "COMMUNITY";
- public static final String PROJECT = "PROJECT";
- public static final String ORPHANED_PROJECT = "ORPHANED_PROJECT";
- public static final String PERSONAL = "PERSONAL";
private Long id;
private String shortName;
private String longName;
private String publicDesc;
- private String type;
+ private GroupType type;
private String defaultToolName;
private Long defaultFolderId;
private Long defaultContentId;
@@ -42,10 +38,10 @@
private String tags;
public GroupDTO() {
- this(null, null, null, ORGANIZATION);
+ this(null, null, null, GroupType.ORGANIZATION);
}
- public GroupDTO(final String shortName, final String longName, final String publicDesc, final String type) {
+ public GroupDTO(final String shortName, final String longName, final String publicDesc, final GroupType type) {
this.shortName = shortName;
this.longName = longName;
this.publicDesc = publicDesc;
@@ -158,7 +154,7 @@
return tags;
}
- public String getType() {
+ public GroupType getType() {
return type;
}
@@ -217,7 +213,7 @@
this.tags = tags;
}
- public void setType(final String type) {
+ public void setType(final GroupType type) {
this.type = type;
}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupType.java (from rev 827, trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupType.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupType.java 2008-08-05 01:27:25 UTC (rev 827)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupType.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -0,0 +1,26 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.platf.client.dto;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+public enum GroupType implements IsSerializable {
+ ORGANIZATION, COMMUNITY, PROJECT, ORPHANED_PROJECT, PERSONAL
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDTO.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDTO.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -23,10 +23,6 @@
public class SocialNetworkDTO implements IsSerializable {
- public static final String REQ_JOIN_WAITING_MODERATION = "MODERATED";
- public static final String REQ_JOIN_ACEPTED = "ACEPTED";
- public static final String REQ_JOIN_DENIED = "DENIED";
-
AccessListsDTO accessLists;
GroupListDTO pendingCollaborators;
@@ -40,14 +36,14 @@
return accessLists;
}
- public void setAccessLists(final AccessListsDTO accessLists) {
- this.accessLists = accessLists;
- }
-
public GroupListDTO getPendingCollaborators() {
return pendingCollaborators;
}
+ public void setAccessLists(final AccessListsDTO accessLists) {
+ this.accessLists = accessLists;
+ }
+
public void setPendingCollaborators(final GroupListDTO pendingCollaborators) {
this.pendingCollaborators = pendingCollaborators;
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkRequestResult.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkRequestResult.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkRequestResult.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -0,0 +1,7 @@
+package org.ourproject.kune.platf.client.dto;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+public enum SocialNetworkRequestResult implements IsSerializable {
+ accepted, denied, moderated
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkService.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkService.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -21,6 +21,7 @@
import org.ourproject.kune.platf.client.dto.ParticipationDataDTO;
import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
+import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult;
import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
import org.ourproject.kune.platf.client.errors.DefaultException;
@@ -50,7 +51,7 @@
ParticipationDataDTO getParticipation(String hash, String groupShortName) throws DefaultException;
- String requestJoinGroup(String hash, String groupShortName) throws DefaultException;
+ SocialNetworkRequestResult requestJoinGroup(String hash, String groupShortName) throws DefaultException;
SocialNetworkResultDTO setAdminAsCollab(String hash, String groupShortName, String groupToSetCollabShortName)
throws DefaultException;
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -24,12 +24,13 @@
import com.calclab.suco.client.container.Container;
import com.calclab.suco.client.container.DelegatedContainer;
import com.calclab.suco.client.modules.Module;
+import com.calclab.suco.client.modules.ModuleManager.ProviderRegisterStrategy;
public class Kune extends DelegatedContainer {
public static Kune create(final Module... modules) {
final Container container = Suco.create(modules);
- Suco.add(container, new KuneModule());
+ Suco.install(container, ProviderRegisterStrategy.registerOnlyIfNotRegistered, new KuneModule());
return container.getInstance(Kune.class);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -37,6 +37,7 @@
import com.calclab.suco.client.signal.Signal0;
import com.calclab.suco.client.signal.Slot0;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException;
public class KuneErrorHandler {
private final Session session;
@@ -83,6 +84,8 @@
logException(e);
Site.error(i18n.t("Group not found"));
stateManagerProvider.get().gotoToken("");
+ } catch (final IncompatibleRemoteServiceException e) {
+ Site.error(i18n.t("Your browser is outdated from the server software. Please reload this page."));
} catch (final ContentNotFoundException e) {
logException(e);
Site.error(i18n.t("Content not found"));
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -133,6 +133,7 @@
import com.calclab.emiteuimodule.client.EmiteUIModule;
import com.calclab.suco.client.container.Container;
import com.calclab.suco.client.modules.AbstractModule;
+import com.calclab.suco.client.modules.ModuleManager.ProviderRegisterStrategy;
import com.calclab.suco.client.provider.Factory;
import com.calclab.suco.client.scopes.SingletonScope;
import com.calclab.suco.client.signal.Slot;
@@ -143,9 +144,6 @@
import com.google.gwt.user.client.rpc.ServiceDefTarget;
public class KuneModule extends AbstractModule {
- public KuneModule() {
- super(KuneModule.class);
- }
@Override
public void onLoad() {
@@ -594,7 +592,8 @@
}
});
- load(new EmiteUIModule(), new DocumentClientNewModule(), new ChatClientNewModule());
+ install(ProviderRegisterStrategy.registerOnlyIfNotRegistered, new EmiteUIModule(),
+ new DocumentClientNewModule(), new ChatClientNewModule());
$(SitePublicSpaceLink.class);
$(SiteMessage.class);
@@ -632,7 +631,7 @@
});
final KunePlatform platform = $(KunePlatform.class);
- $(Application.class).init($(StateManager.class), platform.getIndexedTools());
+ $(Application.class).init(platform.getIndexedTools());
$(Application.class).subscribeActions(platform.getActions());
$(Application.class).start();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -67,7 +67,7 @@
panel.add(widget);
if (panel.isRendered()) {
panel.syncSize();
- panel.doLayout();
+ panel.doLayout(false);
}
doLayoutIfNeeded();
}
@@ -127,4 +127,8 @@
add(panel, widget);
doLayoutIfNeeded();
}
+
+ public void syncSize() {
+ mainPanel.syncSize();
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -22,8 +22,10 @@
import com.gwtext.client.dd.DropTarget;
import com.gwtext.client.dd.DropTargetConfig;
import com.gwtext.client.util.Format;
+import com.gwtext.client.widgets.Component;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.Toolbar;
+import com.gwtext.client.widgets.event.BoxComponentListenerAdapter;
import com.gwtext.client.widgets.grid.CellMetadata;
import com.gwtext.client.widgets.grid.ColumnConfig;
import com.gwtext.client.widgets.grid.ColumnModel;
@@ -107,6 +109,12 @@
}
menuMap = new HashMap<String, GridMenu<T>>();
recordMap = new HashMap<T, Record>();
+ super.addListener(new BoxComponentListenerAdapter() {
+ @Override
+ public void onRender(final Component component) {
+ // Log.warn("Render grid -------------------");
+ }
+ });
createGrid(emptyText, gridDragConfiguration, gridDropConfiguration);
}
@@ -168,6 +176,7 @@
public void doLayout(final boolean shallow) {
// Grid rendered problems with shallow false
super.doLayout();
+ grid.doLayout();
}
public void doLayoutIfNeeded() {
@@ -195,9 +204,7 @@
}
public void removeAll() {
- if (grid != null) {
- store.removeAll();
- }
+ store.removeAll();
recordMap.clear();
menuMap.clear();
}
@@ -223,12 +230,10 @@
@Override
public void setWidth(final int width) {
- if (grid != null) {
- // grid.setWidth(width - 27);
- grid.setWidth(width - 27);
- // super.setWidth(width - 11);
- doLayoutIfNeeded();
- }
+ // grid.setWidth(width - 27);
+ grid.setWidth(width - 27);
+ // super.setWidth(width - 11);
+ doLayoutIfNeeded();
}
public void sort() {
@@ -455,4 +460,5 @@
final Record record = store.getRecordAt(rowIndex);
onDoubleClick.fire(record.getAsString(ID));
}
+
}
Added: trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizated.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizated.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizated.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -0,0 +1,44 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package org.ourproject.kune.platf.server.auth;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import org.ourproject.kune.platf.server.access.AccessType;
+
+import com.google.inject.BindingAnnotation;
+
+/**
+ * Use in RPC methods, for instance: <code>
+ * Authorizated(authLevelRequired = AuthLevelRequired.COLLAB, checkContent = true) </code>
+ *
+ * The first parameter in the method must be the userHash, the second parameter
+ * must be a content token
+ *
+ */
+@BindingAnnotation
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface ContentAuthorizated {
+
+ AccessType accessTypeRequired() default AccessType.READ;
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizatedMethodInterceptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizatedMethodInterceptor.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizatedMethodInterceptor.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -0,0 +1,85 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.platf.server.auth;
+
+import javax.persistence.NoResultException;
+
+import org.aopalliance.intercept.MethodInterceptor;
+import org.aopalliance.intercept.MethodInvocation;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.errors.AccessViolationException;
+import org.ourproject.kune.platf.client.errors.ContentNotFoundException;
+import org.ourproject.kune.platf.server.UserSession;
+import org.ourproject.kune.platf.server.access.AccessService;
+import org.ourproject.kune.platf.server.access.AccessType;
+import org.ourproject.kune.platf.server.domain.Content;
+import org.ourproject.kune.platf.server.domain.Group;
+import org.ourproject.kune.platf.server.domain.User;
+import org.ourproject.kune.platf.server.manager.GroupManager;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class ContentAuthorizatedMethodInterceptor implements MethodInterceptor {
+
+ @Inject
+ Provider<UserSession> userSessionProvider;
+ @Inject
+ Provider<GroupManager> groupManagerProvider;
+ @Inject
+ Provider<AccessService> accessServiceProvider;
+
+ public Object invoke(final MethodInvocation invocation) throws Throwable {
+ final Object[] arguments = invocation.getArguments();
+ final String groupShortName = (String) arguments[1];
+
+ final UserSession userSession = userSessionProvider.get();
+ final GroupManager groupManager = groupManagerProvider.get();
+ final AccessService accessService = accessServiceProvider.get();
+
+ final ContentAuthorizated authoAnnotation = invocation.getStaticPart().getAnnotation(ContentAuthorizated.class);
+ final AccessType accessType = authoAnnotation.accessTypeRequired();
+
+ final User user = userSession.getUser();
+ Group group = Group.NO_GROUP;
+ try {
+ group = groupManager.findByShortName(groupShortName);
+ } catch (final NoResultException e) {
+ // continue, and check later
+ }
+ final StateToken contentToken = (StateToken) arguments[2];
+ final Long contentId = parseId(contentToken.getDocument());
+
+ final Content content = accessService.accessToContent(contentId, user, accessType);
+ if (!content.getContainer().getOwner().equals(group)) {
+ throw new AccessViolationException();
+ }
+ final Object result = invocation.proceed();
+ return result;
+ }
+
+ private Long parseId(final String documentId) throws ContentNotFoundException {
+ try {
+ return new Long(documentId);
+ } catch (final NumberFormatException e) {
+ throw new ContentNotFoundException();
+ }
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -42,6 +42,7 @@
import org.hibernate.search.annotations.Store;
import org.hibernate.validator.Length;
import org.hibernate.validator.Pattern;
+import org.ourproject.kune.platf.client.dto.GroupType;
import com.google.inject.name.Named;
import com.wideplay.warp.persist.dao.Finder;
Deleted: trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupType.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupType.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupType.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -1,24 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.platf.server.domain;
-
-public enum GroupType {
- ORGANIZATION, COMMUNITY, PROJECT, ORPHANED_PROJECT, PERSONAL
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -24,11 +24,11 @@
import javax.persistence.NoResultException;
+import org.ourproject.kune.platf.client.dto.GroupType;
import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
import org.ourproject.kune.platf.server.content.ContentManager;
import org.ourproject.kune.platf.server.domain.Content;
import org.ourproject.kune.platf.server.domain.Group;
-import org.ourproject.kune.platf.server.domain.GroupType;
import org.ourproject.kune.platf.server.domain.I18nCountry;
import org.ourproject.kune.platf.server.domain.I18nLanguage;
import org.ourproject.kune.platf.server.domain.I18nTranslation;
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/SocialNetworkManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/SocialNetworkManager.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/SocialNetworkManager.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -20,6 +20,7 @@
package org.ourproject.kune.platf.server.manager;
+import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult;
import org.ourproject.kune.platf.client.errors.AccessViolationException;
import org.ourproject.kune.platf.client.errors.DefaultException;
import org.ourproject.kune.platf.server.ParticipationData;
@@ -47,7 +48,7 @@
ParticipationData findParticipation(User user, Group group) throws DefaultException;
- String requestToJoin(User user, Group inGroup) throws DefaultException;
+ SocialNetworkRequestResult requestToJoin(User user, Group inGroup) throws DefaultException;
void setAdminAsCollab(User userLogged, Group group, Group inGroup) throws DefaultException;
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -30,6 +30,7 @@
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.search.Query;
+import org.ourproject.kune.platf.client.dto.GroupType;
import org.ourproject.kune.platf.client.errors.AccessViolationException;
import org.ourproject.kune.platf.client.errors.EmailAddressInUseException;
import org.ourproject.kune.platf.client.errors.GroupNameInUseException;
@@ -38,7 +39,6 @@
import org.ourproject.kune.platf.server.domain.AdmissionType;
import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.domain.GroupListMode;
-import org.ourproject.kune.platf.server.domain.GroupType;
import org.ourproject.kune.platf.server.domain.License;
import org.ourproject.kune.platf.server.domain.SocialNetwork;
import org.ourproject.kune.platf.server.domain.User;
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -26,7 +26,8 @@
import javax.persistence.EntityManager;
-import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
+import org.ourproject.kune.platf.client.dto.GroupType;
+import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult;
import org.ourproject.kune.platf.client.errors.AccessViolationException;
import org.ourproject.kune.platf.client.errors.AlreadyGroupMemberException;
import org.ourproject.kune.platf.client.errors.AlreadyUserMemberException;
@@ -38,7 +39,6 @@
import org.ourproject.kune.platf.server.domain.AdmissionType;
import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.domain.GroupListMode;
-import org.ourproject.kune.platf.server.domain.GroupType;
import org.ourproject.kune.platf.server.domain.SocialNetwork;
import org.ourproject.kune.platf.server.domain.User;
import org.ourproject.kune.platf.server.manager.SocialNetworkManager;
@@ -171,7 +171,7 @@
return new ParticipationData(groupsIsAdmin, groupsIsCollab);
}
- public String requestToJoin(final User user, final Group inGroup) throws DefaultException,
+ public SocialNetworkRequestResult requestToJoin(final User user, final Group inGroup) throws DefaultException,
UserMustBeLoggedException {
final SocialNetwork sn = inGroup.getSocialNetwork();
if (!User.isKnownUser(user)) {
@@ -185,7 +185,7 @@
checkGroupIsNotAlreadyAMember(userGroup, sn);
if (isModerated(admissionType)) {
sn.addPendingCollaborator(userGroup);
- return SocialNetworkDTO.REQ_JOIN_WAITING_MODERATION;
+ return SocialNetworkRequestResult.moderated;
} else if (isOpen(admissionType)) {
if (inGroup.getType().equals(GroupType.ORPHANED_PROJECT)) {
sn.addAdmin(userGroup);
@@ -195,9 +195,9 @@
} else {
sn.addCollaborator(userGroup);
}
- return SocialNetworkDTO.REQ_JOIN_ACEPTED;
+ return SocialNetworkRequestResult.accepted;
} else if (isClosed(admissionType)) {
- return SocialNetworkDTO.REQ_JOIN_DENIED;
+ return SocialNetworkRequestResult.denied;
} else {
throw new DefaultException("State not expected in SocialNetworkManagerDefault class");
}
@@ -233,7 +233,12 @@
if (sn.isAdmin(groupToUnJoin)) {
if (sn.getAccessLists().getAdmins().getList().size() == 1) {
- throw new LastAdminInGroupException();
+ if (sn.getAccessLists().getEditors().getList().size() > 0) {
+ throw new LastAdminInGroupException();
+ } else {
+ inGroup.setType(GroupType.ORPHANED_PROJECT);
+ inGroup.setAdmissionType(AdmissionType.Open);
+ }
}
sn.removeAdmin(groupToUnJoin);
} else if (sn.isCollab(groupToUnJoin)) {
Deleted: trunk/src/main/java/org/ourproject/kune/platf/server/mapper/GroupTypeConverter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/mapper/GroupTypeConverter.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/mapper/GroupTypeConverter.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -1,66 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.platf.server.mapper;
-
-import java.text.MessageFormat;
-import java.util.HashMap;
-
-import net.sf.dozer.util.mapping.MappingException;
-import net.sf.dozer.util.mapping.converters.CustomConverter;
-
-import org.ourproject.kune.platf.server.domain.GroupType;
-
-public class GroupTypeConverter implements CustomConverter {
- private final HashMap<String, GroupType> stringToEnum;
- private final HashMap<GroupType, String> enumToString;
-
- public GroupTypeConverter() {
- this.stringToEnum = new HashMap<String, GroupType>();
- this.enumToString = new HashMap<GroupType, String>();
- add(GroupType.PERSONAL);
- add(GroupType.PROJECT);
- add(GroupType.COMMUNITY);
- add(GroupType.ORGANIZATION);
- add(GroupType.ORPHANED_PROJECT);
- }
-
- @SuppressWarnings("unchecked")
- public Object convert(final Object destination, final Object source, final Class destinationClass,
- final Class sourceClass) {
- if (source == null) {
- return null;
- } else if (sourceClass.equals(String.class) && destinationClass.equals(GroupType.class)) {
- return stringToEnum.get(source);
- } else if (sourceClass.equals(GroupType.class) && destinationClass.equals(String.class)) {
- return enumToString.get(source);
- } else {
- final String msg = MessageFormat.format("couldn't map {0} ({1}) to {2} ({3})", source, sourceClass,
- destination, destinationClass);
- throw new MappingException(msg);
- }
-
- }
-
- private void add(final GroupType mode) {
- enumToString.put(mode, mode.toString());
- stringToEnum.put(mode.toString(), mode);
- }
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -21,6 +21,7 @@
import org.ourproject.kune.platf.client.dto.ParticipationDataDTO;
import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
+import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult;
import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
import org.ourproject.kune.platf.client.errors.DefaultException;
import org.ourproject.kune.platf.client.rpc.SocialNetworkService;
@@ -160,7 +161,8 @@
@Authenticated
@Transactional(type = TransactionType.READ_WRITE)
- public String requestJoinGroup(final String hash, final String groupShortName) throws DefaultException {
+ public SocialNetworkRequestResult requestJoinGroup(final String hash, final String groupShortName)
+ throws DefaultException {
final UserSession userSession = getUserSession();
final User user = userSession.getUser();
final Group group = groupManager.findByShortName(groupShortName);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -21,6 +21,7 @@
import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.dto.GroupDTO;
+import org.ourproject.kune.platf.client.dto.GroupType;
import org.ourproject.kune.platf.client.dto.LicenseDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.errors.GroupNameInUseException;
@@ -151,15 +152,15 @@
view.setMessage(message, type);
}
- private String getTypeOfGroup() {
+ private GroupType getTypeOfGroup() {
if (view.isProject()) {
- return GroupDTO.PROJECT;
+ return GroupType.PROJECT;
} else if (view.isOrphanedProject()) {
- return GroupDTO.ORPHANED_PROJECT;
+ return GroupType.ORPHANED_PROJECT;
} else if (view.isOrganization()) {
- return GroupDTO.ORGANIZATION;
+ return GroupType.ORGANIZATION;
} else {
- return GroupDTO.COMMUNITY;
+ return GroupType.COMMUNITY;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherPanel.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherPanel.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -49,12 +49,12 @@
private static final int PAGINATION_SIZE = 10;
private final EntityLiveSearcherPresenter presenter;
private BasicDialog dialog;
- private final int searchType;
+ private final EntityLiveSearcherType searchType;
private FormPanel searchForm;
private final I18nTranslationService i18n;
- public EntityLiveSearcherPanel(final EntityLiveSearcherPresenter presenter, final int searchType,
- final I18nTranslationService i18n) {
+ public EntityLiveSearcherPanel(final EntityLiveSearcherPresenter presenter,
+ final EntityLiveSearcherType searchType, final I18nTranslationService i18n) {
this.presenter = presenter;
this.searchType = searchType;
this.i18n = i18n;
@@ -77,9 +77,9 @@
dialog.center();
}
- private void createGroupSearchDialog(final int searchType) {
+ private void createGroupSearchDialog(final EntityLiveSearcherType searchType) {
String title;
- if (searchType == EntityLiveSearcherView.SEARCH_GROUPS) {
+ if (searchType.equals(EntityLiveSearcherType.groups)) {
title = i18n.t("Search existing users and groups");
} else {
title = i18n.t("Search existing users");
@@ -90,10 +90,10 @@
DataProxy dataProxy = null;
switch (searchType) {
- case EntityLiveSearcherView.SEARCH_GROUPS:
+ case groups:
dataProxy = new HttpProxy("/kune/json/GroupJSONService/search", Connection.POST);
break;
- case EntityLiveSearcherView.SEARCH_USERS:
+ case users:
dataProxy = new HttpProxy("/kune/json/UserJSONService/search", Connection.POST);
break;
default:
Added: trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherType.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherType.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherType.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -0,0 +1,5 @@
+package org.ourproject.kune.workspace.client.search;
+
+public enum EntityLiveSearcherType {
+ groups, users
+}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherView.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherView.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -23,13 +23,10 @@
public interface EntityLiveSearcherView extends View {
- final public static int SEARCH_GROUPS = 1;
- final public static int SEARCH_USERS = 2;
+ void center();
- void show();
-
void hide();
- void center();
+ void show();
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/GroupLiveSearchPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/GroupLiveSearchPanel.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/GroupLiveSearchPanel.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -24,7 +24,7 @@
public class GroupLiveSearchPanel extends EntityLiveSearcherPanel {
public GroupLiveSearchPanel(final EntityLiveSearcherPresenter presenter, final I18nTranslationService i18n) {
- super(presenter, EntityLiveSearcherView.SEARCH_GROUPS, i18n);
+ super(presenter, EntityLiveSearcherType.groups, i18n);
}
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/UserLiveSearcherPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/UserLiveSearcherPanel.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/UserLiveSearcherPanel.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -24,7 +24,7 @@
public class UserLiveSearcherPanel extends EntityLiveSearcherPanel {
public UserLiveSearcherPanel(final EntityLiveSearcherPresenter presenter, final I18nTranslationService i18n) {
- super(presenter, EntityLiveSearcherView.SEARCH_USERS, i18n);
+ super(presenter, EntityLiveSearcherType.users, i18n);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -5,6 +5,7 @@
import org.ourproject.kune.platf.client.dto.AccessListsDTO;
import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
import org.ourproject.kune.platf.client.dto.GroupDTO;
+import org.ourproject.kune.platf.client.dto.GroupType;
import org.ourproject.kune.platf.client.dto.LinkDTO;
import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
@@ -173,7 +174,7 @@
}
private void setState(final StateDTO state) {
- if (state.getGroup().getType().equals(GroupDTO.PERSONAL)) {
+ if (state.getGroup().getType().equals(GroupType.PERSONAL)) {
view.setVisible(false);
} else {
setGroupMembers(state.getGroupMembers(), state.getGroupRights());
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -2,7 +2,8 @@
import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
import org.ourproject.kune.platf.client.dto.GroupDTO;
-import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
+import org.ourproject.kune.platf.client.dto.GroupType;
+import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult;
import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
@@ -106,16 +107,18 @@
session.getCurrentState().getGroup().getShortName(), new AsyncCallbackSimple<Object>() {
public void onSuccess(final Object result) {
Site.hideProgress();
- final String resultType = (String) result;
- if (resultType == SocialNetworkDTO.REQ_JOIN_ACEPTED) {
+ final SocialNetworkRequestResult resultType = (SocialNetworkRequestResult) result;
+ switch (resultType) {
+ case accepted:
Site.info(i18n.t("You are now member of this group"));
stateManager.reload();
- }
- if (resultType == SocialNetworkDTO.REQ_JOIN_DENIED) {
+ break;
+ case denied:
Site.important(i18n.t("Sorry this is a closed group"));
- }
- if (resultType == SocialNetworkDTO.REQ_JOIN_WAITING_MODERATION) {
+ break;
+ case moderated:
Site.info(i18n.t("Requested. Waiting for admins decision"));
+ break;
}
}
});
@@ -133,20 +136,20 @@
private GridItem<GroupDTO> createDefMemberMenu(final GroupDTO group, final GridGroup gridGroup) {
final GridMenu<GroupDTO> menu = new GridMenu<GroupDTO>(group);
final String longName = group.getLongName();
- final String toolTip = i18n.t(group.getType().equals(GroupDTO.PERSONAL) ? "User nickname: [%s]"
+ final String toolTip = i18n.t(group.getType().equals(GroupType.PERSONAL) ? "User nickname: [%s]"
: "Group short name: [%s]", group.getShortName());
final GridItem<GroupDTO> gridItem = new GridItem<GroupDTO>(group, gridGroup, group.getShortName(), imageUtils
.getImageHtml(ImageDescriptor.groupDefIcon), longName, longName, " ", longName, toolTip, menu);
- if (!group.getType().equals(GroupDTO.PERSONAL)) {
+ if (!group.getType().equals(GroupType.PERSONAL)) {
menu.addMenuItemList(otherOperations);
}
- if (session.isLogged() && !group.getType().equals(GroupDTO.PERSONAL)) {
+ if (session.isLogged() && !group.getType().equals(GroupType.PERSONAL)) {
menu.addMenuItemList(otherLoggedOperations);
}
- if (group.getType().equals(GroupDTO.PERSONAL)) {
+ if (group.getType().equals(GroupType.PERSONAL)) {
menu.addMenuItemList(otherOperationsUsers);
}
- if (session.isLogged() && group.getType().equals(GroupDTO.PERSONAL)) {
+ if (session.isLogged() && group.getType().equals(GroupType.PERSONAL)) {
menu.addMenuItemList(otherLoggedOperationsUsers);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/entitylogo/EntityLogoPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/entitylogo/EntityLogoPanel.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/entitylogo/EntityLogoPanel.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -88,7 +88,7 @@
public EntityLogoPanel(final I18nTranslationService i18n, final WorkspaceSkeleton ws) {
this.i18n = i18n;
- ws.getEntityMainHeader().add(this);
+ ws.addToEntityMainHeader(this);
}
public void setLogo(final Image image) {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Entity.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Entity.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Entity.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -3,7 +3,9 @@
import org.ourproject.kune.platf.client.ui.DefaultBorderLayout;
import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
+import com.google.gwt.user.client.ui.Widget;
import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.layout.FitLayout;
public class Entity extends DefaultBorderLayout {
@@ -14,6 +16,7 @@
public Entity() {
entityMainHeader = new Panel();
entityMainHeader.setBorder(false);
+ entityMainHeader.setLayout(new FitLayout());
entitySummary = new EntitySummary();
entityWorkspace = new EntityWorkspace();
add(entityMainHeader, DefaultBorderLayout.Position.NORTH, 65);
@@ -21,8 +24,9 @@
add(entitySummary.getPanel(), DefaultBorderLayout.Position.EAST, true, 150);
}
- public Panel getEntityMainHeader() {
- return entityMainHeader;
+ public void addToEntityMainHeader(final Widget widget) {
+ entityMainHeader.add(widget);
+ doLayoutIfNeeded();
}
public EntitySummary getEntitySummary() {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -6,6 +6,7 @@
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.Toolbar;
import com.gwtext.client.widgets.event.ContainerListener;
+import com.gwtext.client.widgets.layout.FitLayout;
public class EntitySummary {
private final Panel entityTools;
@@ -16,13 +17,14 @@
public EntitySummary() {
mainPanel = new DefaultBorderLayout();
entityTools = new Panel();
+ entityTools.setLayout(new FitLayout());
entityTools.setAutoHeight(true);
entitySummary = new Panel();
- entitySummary.setCls("k-entity-summary");
entityTools.setBorder(false);
entitySummary.setBorder(false);
entityTools.setAutoScroll(false);
entitySummary.setAutoScroll(true);
+ entitySummary.setCls("k-entity-summary");
trayBar = mainPanel.createBottomBar(entitySummary, "k-site-traybar");
mainPanel.add(entityTools, DefaultBorderLayout.Position.NORTH);
mainPanel.add(entitySummary, DefaultBorderLayout.Position.CENTER);
@@ -31,15 +33,16 @@
public void addInSummary(final Widget widget) {
entitySummary.add(widget);
+ entitySummary.syncSize();
mainPanel.doLayoutIfNeeded();
}
public void addInTools(final Widget widget) {
entityTools.add(widget);
+ mainPanel.syncSize();
if (entityTools.isRendered()) {
entityTools.doLayout(false);
}
- mainPanel.doLayoutIfNeeded();
}
public void addListener(final ContainerListener listener) {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -5,6 +5,7 @@
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.Widget;
import com.gwtext.client.core.ExtElement;
import com.gwtext.client.widgets.MessageBox;
import com.gwtext.client.widgets.Panel;
@@ -35,8 +36,8 @@
new Viewport(container);
}
- public Panel getEntityMainHeader() {
- return entity.getEntityMainHeader();
+ public void addToEntityMainHeader(final Widget widget) {
+ entity.addToEntityMainHeader(widget);
}
public EntitySummary getEntitySummary() {
Modified: trunk/src/main/resources/dozerBeanMapping.xml
===================================================================
--- trunk/src/main/resources/dozerBeanMapping.xml 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/main/resources/dozerBeanMapping.xml 2008-08-08 04:20:12 UTC (rev 834)
@@ -41,12 +41,7 @@
<mapping>
<class-a>org.ourproject.kune.platf.client.dto.GroupDTO</class-a>
- <class-b>org.ourproject.kune.platf.server.domain.Group</class-b>
- <field
- custom-converter="org.ourproject.kune.platf.server.mapper.GroupTypeConverter">
- <a>type</a>
- <b>type</b>
- </field>
+ <class-b>org.ourproject.kune.platf.server.domain.Group</class-b>
</mapping>
<mapping>
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -25,7 +25,7 @@
bindScope(SessionScoped.class, Scopes.SINGLETON);
// test: use memory
// test_db: use mysql
- bindConstant().annotatedWith(JpaUnit.class).to("test");
+ bindConstant().annotatedWith(JpaUnit.class).to("test_db");
bindConstant().annotatedWith(PropertiesFileName.class).to("kune.properties");
bind(HttpServletRequest.class).to(HttpServletRequestMocked.class);
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/kuneservice/GroupServiceTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/kuneservice/GroupServiceTest.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/kuneservice/GroupServiceTest.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -5,6 +5,7 @@
import org.junit.Before;
import org.junit.Test;
import org.ourproject.kune.platf.client.dto.GroupDTO;
+import org.ourproject.kune.platf.client.dto.GroupType;
import org.ourproject.kune.platf.client.dto.LicenseDTO;
import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
import org.ourproject.kune.platf.client.rpc.GroupService;
@@ -13,7 +14,6 @@
import org.ourproject.kune.platf.server.UserSession;
import org.ourproject.kune.platf.server.domain.AdmissionType;
import org.ourproject.kune.platf.server.domain.Group;
-import org.ourproject.kune.platf.server.domain.GroupType;
import com.google.inject.Inject;
@@ -33,7 +33,7 @@
doLogin();
final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", "Public Desc",
- GroupDTO.COMMUNITY);
+ GroupType.COMMUNITY);
final LicenseDTO license = new LicenseDTO();
license.setShortName("by-sa");
@@ -51,7 +51,7 @@
@Test(expected = Exception.class)
public void createGroupNotLogged() throws Exception {
final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", "Public Desc",
- GroupDTO.PROJECT);
+ GroupType.PROJECT);
service.createNewGroup(session.getHash(), group);
}
@@ -59,7 +59,7 @@
public void createGroupNullUserHash() throws Exception {
doLogin();
final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", "Public Desc",
- GroupDTO.PROJECT);
+ GroupType.PROJECT);
service.createNewGroup(null, group);
}
@@ -68,7 +68,7 @@
doLogin();
final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", "Public Desc",
- GroupDTO.PROJECT);
+ GroupType.PROJECT);
final LicenseDTO license = new LicenseDTO();
license.setShortName("by-sa");
@@ -88,7 +88,7 @@
doLogin();
final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", "Public Desc",
- GroupDTO.ORGANIZATION);
+ GroupType.ORGANIZATION);
final LicenseDTO license = new LicenseDTO();
license.setShortName("by-sa");
@@ -108,7 +108,7 @@
doLogin();
final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", "Public Desc",
- GroupDTO.ORPHANED_PROJECT);
+ GroupType.ORPHANED_PROJECT);
final LicenseDTO license = new LicenseDTO();
license.setShortName("by-sa");
Added: trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -0,0 +1,31 @@
+package org.ourproject.kune.platf.server.auth;
+
+import java.lang.reflect.AccessibleObject;
+
+import org.aopalliance.intercept.MethodInvocation;
+import org.junit.Before;
+import org.mockito.Mockito;
+import org.ourproject.kune.platf.integration.IntegrationTest;
+import org.ourproject.kune.platf.integration.IntegrationTestHelper;
+
+public class AuthorizatedMethodInterceptorTest extends IntegrationTest {
+
+ private AuthorizatedMethodInterceptor auth;
+ private MethodInvocation invocation;
+ private Authorizated authAnnotation;
+
+ @Before
+ public void before() {
+ auth = new AuthorizatedMethodInterceptor();
+ new IntegrationTestHelper(auth, this);
+ invocation = Mockito.mock(MethodInvocation.class);
+ final AccessibleObject accessibleObject = Mockito.mock(AccessibleObject.class);
+ Mockito.stub(invocation.getMethod()).toReturn(this.getClass().getMethods()[0]);
+ Mockito.stub(invocation.getStaticPart()).toReturn(accessibleObject);
+ authAnnotation = Mockito.mock(Authorizated.class);
+ Mockito.stub(accessibleObject.getAnnotation(Authorizated.class)).toReturn(authAnnotation);
+ // AccessType accessType = authoAnnotation.accessTypeRequired();
+ // boolean checkContent = authoAnnotation.checkContent();
+ }
+
+}
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/GroupManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/GroupManagerTest.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/GroupManagerTest.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -9,13 +9,13 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.ourproject.kune.platf.client.dto.GroupType;
import org.ourproject.kune.platf.client.errors.EmailAddressInUseException;
import org.ourproject.kune.platf.client.errors.GroupNameInUseException;
import org.ourproject.kune.platf.client.errors.I18nNotFoundException;
import org.ourproject.kune.platf.server.PersistenceTest;
import org.ourproject.kune.platf.server.domain.AccessLists;
import org.ourproject.kune.platf.server.domain.Group;
-import org.ourproject.kune.platf.server.domain.GroupType;
import org.ourproject.kune.platf.server.domain.I18nCountry;
import org.ourproject.kune.platf.server.domain.I18nLanguage;
import org.ourproject.kune.platf.server.domain.License;
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -7,7 +7,8 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
+import org.ourproject.kune.platf.client.dto.GroupType;
+import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult;
import org.ourproject.kune.platf.client.errors.AccessViolationException;
import org.ourproject.kune.platf.client.errors.AlreadyGroupMemberException;
import org.ourproject.kune.platf.client.errors.LastAdminInGroupException;
@@ -180,11 +181,22 @@
}
@Test(expected = LastAdminInGroupException.class)
- public void lastAdminUnjoinGroupFails() throws Exception {
+ public void lastAdminUnjoinGroupWithCollabsFails() throws Exception {
socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
socialNetworkManager.unJoinGroup(admin.getUserGroup(), group);
}
+ @Test
+ public void lastAdminUnjoinGroupWithoutCollabsOrphaned() throws Exception {
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.unJoinGroup(admin.getUserGroup(), group);
+ assertEquals(GroupType.ORPHANED_PROJECT, group.getType());
+ assertEquals(0, group.getSocialNetwork().getAccessLists().getAdmins().getList().size());
+ assertEquals(0, group.getSocialNetwork().getAccessLists().getEditors().getList().size());
+ }
+
@Test(expected = AccessViolationException.class)
public void notAdminTryDeleteMember() throws Exception {
socialNetworkManager.requestToJoin(user, group);
@@ -197,8 +209,8 @@
public void requestJoinAClosedGroupDeny() throws Exception {
group.setAdmissionType(AdmissionType.Closed);
- final String result = socialNetworkManager.requestToJoin(user, group);
- assertEquals(result, SocialNetworkDTO.REQ_JOIN_DENIED);
+ final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, group);
+ assertEquals(result, SocialNetworkRequestResult.denied);
closeTransaction();
}
@@ -206,8 +218,8 @@
public void requestJoinAModeratedGroupAddUserGroupToPending() throws Exception {
group.setAdmissionType(AdmissionType.Moderated);
- final String result = socialNetworkManager.requestToJoin(user, group);
- assertEquals(result, SocialNetworkDTO.REQ_JOIN_WAITING_MODERATION);
+ final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, group);
+ assertEquals(result, SocialNetworkRequestResult.moderated);
assertTrue(group.getSocialNetwork().getPendingCollaborators().getList().contains(userGroup));
closeTransaction();
}
@@ -216,8 +228,8 @@
public void requestJoinAOpenGroupAddUserGroupToEditors() throws Exception {
group.setAdmissionType(AdmissionType.Open);
- final String result = socialNetworkManager.requestToJoin(user, group);
- assertEquals(result, SocialNetworkDTO.REQ_JOIN_ACEPTED);
+ final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, group);
+ assertEquals(result, SocialNetworkRequestResult.accepted);
assertTrue(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup));
assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getMode(), GroupListMode.NORMAL);
closeTransaction();
@@ -227,8 +239,8 @@
public void requestJoinAOrphanedGroupAddUserGroupToAdmins() throws Exception {
orphanedGroup.setAdmissionType(AdmissionType.Open);
- final String result = socialNetworkManager.requestToJoin(user, orphanedGroup);
- assertEquals(result, SocialNetworkDTO.REQ_JOIN_ACEPTED);
+ final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, orphanedGroup);
+ assertEquals(result, SocialNetworkRequestResult.accepted);
assertTrue(orphanedGroup.getSocialNetwork().getAccessLists().getAdmins().getList().contains(userGroup));
assertEquals(orphanedGroup.getSocialNetwork().getAccessLists().getAdmins().getMode(), GroupListMode.NORMAL);
@@ -240,8 +252,8 @@
public void requestJoinTwiceAOrphanedGroupAddUserGroupToAdmins() throws Exception {
orphanedGroup.setAdmissionType(AdmissionType.Open);
- final String result = socialNetworkManager.requestToJoin(user, orphanedGroup);
- assertEquals(SocialNetworkDTO.REQ_JOIN_ACEPTED, result);
+ final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, orphanedGroup);
+ assertEquals(SocialNetworkRequestResult.accepted, result);
socialNetworkManager.requestToJoin(user, orphanedGroup);
}
Modified: trunk/src/test/java/org/ourproject/kune/testhelper/ctx/DomainContext.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/testhelper/ctx/DomainContext.java 2008-08-07 12:07:05 UTC (rev 833)
+++ trunk/src/test/java/org/ourproject/kune/testhelper/ctx/DomainContext.java 2008-08-08 04:20:12 UTC (rev 834)
@@ -3,9 +3,9 @@
import java.util.HashMap;
import java.util.TimeZone;
+import org.ourproject.kune.platf.client.dto.GroupType;
import org.ourproject.kune.platf.server.domain.AccessLists;
import org.ourproject.kune.platf.server.domain.Group;
-import org.ourproject.kune.platf.server.domain.GroupType;
import org.ourproject.kune.platf.server.domain.I18nCountry;
import org.ourproject.kune.platf.server.domain.I18nLanguage;
import org.ourproject.kune.platf.server.domain.SocialNetwork;
1
0
07 Aug '08
Author: vjrj
Date: 2008-08-07 14:07:05 +0200 (Thu, 07 Aug 2008)
New Revision: 833
Added:
trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizated.java
trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizatedMethodInterceptor.java
Modified:
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
trunk/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java
trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRightsService.java
trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRightsServiceDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/rpc/GroupRPC.java
trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
Log:
Group authorization annotation for check authRights in methods
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-06 04:21:36 UTC (rev 832)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-07 12:07:05 UTC (rev 833)
@@ -501,7 +501,7 @@
public GroupMembersSummary create() {
final GroupMembersSummaryPresenter presenter = new GroupMembersSummaryPresenter(i18n,
$(StateManager.class), $(ImageUtils.class), $(Session.class),
- $$(SocialNetworkServiceAsync.class), $$(UserLiveSearcher.class), $(WsThemePresenter.class));
+ $$(SocialNetworkServiceAsync.class), $$(GroupLiveSearcher.class), $(WsThemePresenter.class));
final GroupMembersSummaryView view = new GroupMembersSummaryPanel(presenter, i18n, ws);
presenter.init(view);
return presenter;
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java 2008-08-06 04:21:36 UTC (rev 832)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java 2008-08-07 12:07:05 UTC (rev 833)
@@ -31,6 +31,8 @@
import org.ourproject.kune.platf.client.rpc.SiteService;
import org.ourproject.kune.platf.client.rpc.SocialNetworkService;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.server.access.AccessRightsService;
+import org.ourproject.kune.platf.server.access.AccessRightsServiceDefault;
import org.ourproject.kune.platf.server.access.AccessService;
import org.ourproject.kune.platf.server.access.AccessServiceDefault;
import org.ourproject.kune.platf.server.access.FinderService;
@@ -39,6 +41,8 @@
import org.ourproject.kune.platf.server.auth.AuthenticatedMethodInterceptor;
import org.ourproject.kune.platf.server.auth.Authorizated;
import org.ourproject.kune.platf.server.auth.AuthorizatedMethodInterceptor;
+import org.ourproject.kune.platf.server.auth.GroupAuthorizated;
+import org.ourproject.kune.platf.server.auth.GroupAuthorizatedMethodInterceptor;
import org.ourproject.kune.platf.server.auth.SessionService;
import org.ourproject.kune.platf.server.auth.SessionServiceDefault;
import org.ourproject.kune.platf.server.content.CommentManager;
@@ -94,55 +98,58 @@
public class PlatformServerModule extends AbstractExtendedModule {
@Override
protected void configure() {
- install(PersistenceService.usingJpa().across(UnitOfWork.TRANSACTION).buildModule());
- bind(KunePersistenceService.class);
+ install(PersistenceService.usingJpa().across(UnitOfWork.TRANSACTION).buildModule());
+ bind(KunePersistenceService.class);
- bindManagers();
- bindRPC();
- bindServices();
- bind(KuneProperties.class).to(KunePropertiesDefault.class);
- bind(Mapper.class).to(DozerMapper.class);
- bind(ToolRegistry.class);
+ bindManagers();
+ bindRPC();
+ bindServices();
+ bind(KuneProperties.class).to(KunePropertiesDefault.class);
+ bind(Mapper.class).to(DozerMapper.class);
+ bind(ToolRegistry.class);
- bindInterceptor(Matchers.any(), Matchers.annotatedWith(Authenticated.class),
- outermostCall(new AuthenticatedMethodInterceptor()));
- bindInterceptor(Matchers.any(), Matchers.annotatedWith(Authorizated.class),
- outermostCall(new AuthorizatedMethodInterceptor()));
+ bindInterceptor(Matchers.any(), Matchers.annotatedWith(Authenticated.class),
+ outermostCall(new AuthenticatedMethodInterceptor()));
+ bindInterceptor(Matchers.any(), Matchers.annotatedWith(Authorizated.class),
+ outermostCall(new AuthorizatedMethodInterceptor()));
+ bindInterceptor(Matchers.any(), Matchers.annotatedWith(GroupAuthorizated.class),
+ outermostCall(new GroupAuthorizatedMethodInterceptor()));
}
private void bindManagers() {
- bind(UserManager.class).to(UserManagerDefault.class);
- bind(GroupManager.class).to(GroupManagerDefault.class);
- bind(ContentManager.class).to(ContentManagerDefault.class);
- bind(ToolConfigurationManager.class).to(ToolConfigurationManagerDefault.class);
- bind(ContainerManager.class).to(ContainerManagerDefault.class);
- bind(LicenseManager.class).to(LicenseManagerDefault.class);
- bind(SocialNetworkManager.class).to(SocialNetworkManagerDefault.class);
- bind(XmppManager.class).to(XmppManagerDefault.class);
- bind(RateManager.class).to(RateManagerDefault.class);
- bind(I18nCountryManager.class).to(I18nCountryManagerDefault.class);
- bind(I18nLanguageManager.class).to(I18nLanguageManagerDefault.class);
- bind(I18nTranslationManager.class).to(I18nTranslationManagerDefault.class);
- bind(TagManager.class).to(TagManagerDefault.class);
- bind(CommentManager.class).to(CommentManagerDefault.class);
+ bind(UserManager.class).to(UserManagerDefault.class);
+ bind(GroupManager.class).to(GroupManagerDefault.class);
+ bind(ContentManager.class).to(ContentManagerDefault.class);
+ bind(ToolConfigurationManager.class).to(ToolConfigurationManagerDefault.class);
+ bind(ContainerManager.class).to(ContainerManagerDefault.class);
+ bind(LicenseManager.class).to(LicenseManagerDefault.class);
+ bind(SocialNetworkManager.class).to(SocialNetworkManagerDefault.class);
+ bind(XmppManager.class).to(XmppManagerDefault.class);
+ bind(RateManager.class).to(RateManagerDefault.class);
+ bind(I18nCountryManager.class).to(I18nCountryManagerDefault.class);
+ bind(I18nLanguageManager.class).to(I18nLanguageManagerDefault.class);
+ bind(I18nTranslationManager.class).to(I18nTranslationManagerDefault.class);
+ bind(TagManager.class).to(TagManagerDefault.class);
+ bind(CommentManager.class).to(CommentManagerDefault.class);
}
private void bindRPC() {
- bind(SiteService.class).to(SiteRPC.class);
- bind(GroupService.class).to(GroupRPC.class);
- bind(ContentService.class).to(ContentRPC.class);
- bind(UserService.class).to(UserRPC.class);
- bind(SocialNetworkService.class).to(SocialNetworkRPC.class);
- bind(I18nService.class).to(I18nRPC.class);
+ bind(SiteService.class).to(SiteRPC.class);
+ bind(GroupService.class).to(GroupRPC.class);
+ bind(ContentService.class).to(ContentRPC.class);
+ bind(UserService.class).to(UserRPC.class);
+ bind(SocialNetworkService.class).to(SocialNetworkRPC.class);
+ bind(I18nService.class).to(I18nRPC.class);
}
private void bindServices() {
- bind(UserInfoService.class).to(UserInfoServiceDefault.class);
- bind(CreationService.class).to(CreationServiceDefault.class);
- bind(AccessService.class).to(AccessServiceDefault.class);
- bind(FinderService.class).to(FinderServiceDefault.class);
- bind(StateService.class).to(StateServiceDefault.class);
- bind(I18nTranslationService.class).to(I18nTranslationServiceDefault.class);
- bind(SessionService.class).to(SessionServiceDefault.class);
+ bind(UserInfoService.class).to(UserInfoServiceDefault.class);
+ bind(CreationService.class).to(CreationServiceDefault.class);
+ bind(AccessRightsService.class).to(AccessRightsServiceDefault.class);
+ bind(AccessService.class).to(AccessServiceDefault.class);
+ bind(FinderService.class).to(FinderServiceDefault.class);
+ bind(StateService.class).to(StateServiceDefault.class);
+ bind(I18nTranslationService.class).to(I18nTranslationServiceDefault.class);
+ bind(SessionService.class).to(SessionServiceDefault.class);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRightsService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRightsService.java 2008-08-06 04:21:36 UTC (rev 832)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRightsService.java 2008-08-07 12:07:05 UTC (rev 833)
@@ -23,7 +23,7 @@
import org.ourproject.kune.platf.server.domain.AccessLists;
import org.ourproject.kune.platf.server.domain.User;
-interface AccessRightsService {
+public interface AccessRightsService {
public AccessRights get(User user, AccessLists lists);
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRightsServiceDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRightsServiceDefault.java 2008-08-06 04:21:36 UTC (rev 832)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRightsServiceDefault.java 2008-08-07 12:07:05 UTC (rev 833)
@@ -29,52 +29,55 @@
import org.ourproject.kune.platf.server.domain.SocialNetwork;
import org.ourproject.kune.platf.server.domain.User;
+import com.google.inject.Singleton;
+
+@Singleton
public class AccessRightsServiceDefault implements AccessRightsService {
// TODO: check performance
- public AccessRights get(final User user, final AccessLists lists) {
- return get(user.getUserGroup(), lists);
- }
-
public AccessRights get(final Group userGroup, final AccessLists accessList) {
- boolean isAdministrable = false;
- boolean isEditable = false;
- boolean isVisible = false;
+ boolean isAdministrable = false;
+ boolean isEditable = false;
+ boolean isVisible = false;
- // FIXME, future: admin users can admin, edit, view everything
- // (not now while we are doing tests)
- isVisible = isEditable = isAdministrable = canAccess(userGroup, accessList, AccessRol.Administrator);
- if (!isEditable) {
- isVisible = isEditable = canAccess(userGroup, accessList, AccessRol.Editor);
- }
- if (!isVisible) {
- isVisible = accessList.getViewers().isEmpty() || canAccess(userGroup, accessList, AccessRol.Viewer);
- }
+ // FIXME, future: admin users can admin, edit, view everything
+ // (not now while we are doing tests)
+ isVisible = isEditable = isAdministrable = canAccess(userGroup, accessList, AccessRol.Administrator);
+ if (!isEditable) {
+ isVisible = isEditable = canAccess(userGroup, accessList, AccessRol.Editor);
+ }
+ if (!isVisible) {
+ isVisible = accessList.getViewers().isEmpty() || canAccess(userGroup, accessList, AccessRol.Viewer);
+ }
- return new AccessRights(isAdministrable, isEditable, isVisible);
+ return new AccessRights(isAdministrable, isEditable, isVisible);
}
+ public AccessRights get(final User user, final AccessLists lists) {
+ return get(user.getUserGroup(), lists);
+ }
+
private boolean canAccess(final Group searchedGroup, final AccessLists lists, final AccessRol rol) {
- GroupList list = lists.getList(rol);
- return depthFirstSearch(new HashSet<Group>(), searchedGroup, list, rol);
+ final GroupList list = lists.getList(rol);
+ return depthFirstSearch(new HashSet<Group>(), searchedGroup, list, rol);
}
/*
* http://en.wikipedia.org/wiki/Depth-first_search
*/
private boolean depthFirstSearch(final HashSet<Group> visited, final Group searchedGroup, final GroupList list,
- final AccessRol rol) {
- if (list.includes(searchedGroup)) {
- return true;
- }
- ArrayList<Group> noVisitedYet = list.duplicate();
- noVisitedYet.removeAll(visited);
- for (Group group : noVisitedYet) {
- visited.add(group);
- SocialNetwork socialNetwork = group.getSocialNetwork();
- GroupList groupList = socialNetwork.getAccessLists().getList(rol);
- return depthFirstSearch(visited, searchedGroup, groupList, rol);
- }
- return false;
+ final AccessRol rol) {
+ if (list.includes(searchedGroup)) {
+ return true;
+ }
+ final ArrayList<Group> noVisitedYet = list.duplicate();
+ noVisitedYet.removeAll(visited);
+ for (final Group group : noVisitedYet) {
+ visited.add(group);
+ final SocialNetwork socialNetwork = group.getSocialNetwork();
+ final GroupList groupList = socialNetwork.getAccessLists().getList(rol);
+ return depthFirstSearch(visited, searchedGroup, groupList, rol);
+ }
+ return false;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java 2008-08-06 04:21:36 UTC (rev 832)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java 2008-08-07 12:07:05 UTC (rev 833)
@@ -41,6 +41,7 @@
private final AccessRightsService accessRightsService;
private final Group groupFinder;
+ @Inject
public AccessServiceDefault(final FinderService finder, final AccessRightsService accessRightsService,
final Group groupFinder) {
this.finder = finder;
@@ -48,11 +49,6 @@
this.groupFinder = groupFinder;
}
- @Inject
- public AccessServiceDefault(final FinderService finder, final Group groupFinder) {
- this(finder, new AccessRightsServiceDefault(), groupFinder);
- }
-
public Content accessToContent(final Long contentId, final User user, final AccessType accessType)
throws DefaultException {
final Content descriptor = finder.getContent(contentId);
Added: trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizated.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizated.java 2008-08-06 04:21:36 UTC (rev 832)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizated.java 2008-08-07 12:07:05 UTC (rev 833)
@@ -0,0 +1,24 @@
+package org.ourproject.kune.platf.server.auth;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import org.ourproject.kune.platf.server.access.AccessType;
+
+import com.google.inject.BindingAnnotation;
+
+/**
+ * Use in RPC methods, for instance: <code>
+ * GroupAuthorizated(authLevelRequired = AuthLevelRequired.COLLAB) </code>
+ *
+ * The first parameter in the method must be the userHash, the second the group
+ * shortName
+ *
+ */
+@BindingAnnotation
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface GroupAuthorizated {
+
+ AccessType accessTypeRequired() default AccessType.READ;
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizatedMethodInterceptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizatedMethodInterceptor.java 2008-08-06 04:21:36 UTC (rev 832)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizatedMethodInterceptor.java 2008-08-07 12:07:05 UTC (rev 833)
@@ -0,0 +1,89 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.platf.server.auth;
+
+import javax.persistence.NoResultException;
+
+import org.aopalliance.intercept.MethodInterceptor;
+import org.aopalliance.intercept.MethodInvocation;
+import org.ourproject.kune.platf.client.errors.AccessViolationException;
+import org.ourproject.kune.platf.server.UserSession;
+import org.ourproject.kune.platf.server.access.AccessRights;
+import org.ourproject.kune.platf.server.access.AccessRightsService;
+import org.ourproject.kune.platf.server.access.AccessType;
+import org.ourproject.kune.platf.server.domain.Group;
+import org.ourproject.kune.platf.server.domain.User;
+import org.ourproject.kune.platf.server.manager.GroupManager;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class GroupAuthorizatedMethodInterceptor implements MethodInterceptor {
+
+ @Inject
+ Provider<UserSession> userSessionProvider;
+ @Inject
+ Provider<GroupManager> groupManagerProvider;
+ @Inject
+ Provider<AccessRightsService> accessRightsServiceProvider;
+
+ public Object invoke(final MethodInvocation invocation) throws Throwable {
+ final Object[] arguments = invocation.getArguments();
+ final String groupShortName = (String) arguments[1];
+
+ final UserSession userSession = userSessionProvider.get();
+ final GroupManager groupManager = groupManagerProvider.get();
+
+ final GroupAuthorizated authoAnnotation = invocation.getStaticPart().getAnnotation(GroupAuthorizated.class);
+ final AccessType accessType = authoAnnotation.accessTypeRequired();
+
+ final User user = userSession.getUser();
+
+ Group group = Group.NO_GROUP;
+ try {
+ group = groupManager.findByShortName(groupShortName);
+ } catch (final NoResultException e) {
+ throw new AccessViolationException();
+ }
+
+ if (!correctMember(user, group, accessType)) {
+ throw new AccessViolationException();
+ }
+
+ final Object result = invocation.proceed();
+ return result;
+ }
+
+ private boolean correctMember(final User user, final Group group, final AccessType memberType)
+ throws AccessViolationException {
+ final AccessRightsService accessRightsService = accessRightsServiceProvider.get();
+ final AccessRights accessRights = accessRightsService.get(user, group.getSocialNetwork().getAccessLists());
+
+ switch (memberType) {
+ case ADMIN:
+ return accessRights.isAdministrable();
+ case EDIT:
+ return accessRights.isEditable();
+ default:
+ return accessRights.isVisible();
+ }
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2008-08-06 04:21:36 UTC (rev 832)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2008-08-07 12:07:05 UTC (rev 833)
@@ -64,135 +64,131 @@
@Inject
public GroupManagerDefault(final Provider<EntityManager> provider, final Group finder, final User userFinder,
- final KuneProperties kuneProperties, final DatabaseProperties properties, final ToolRegistry registry,
- final License licenseFinder) {
- super(provider, Group.class);
- this.finder = finder;
- this.userFinder = userFinder;
- this.kuneProperties = kuneProperties;
- this.properties = properties;
- this.registry = registry;
- this.licenseFinder = licenseFinder;
+ final KuneProperties kuneProperties, final DatabaseProperties properties, final ToolRegistry registry,
+ final License licenseFinder) {
+ super(provider, Group.class);
+ this.finder = finder;
+ this.userFinder = userFinder;
+ this.kuneProperties = kuneProperties;
+ this.properties = properties;
+ this.registry = registry;
+ this.licenseFinder = licenseFinder;
}
- public Group getDefaultGroup() {
- final String shortName = properties.getDefaultSiteShortName();
- return findByShortName(shortName);
+ public void changeWsTheme(final User user, final Group group, final String theme) throws AccessViolationException {
+ // TODO: check theme
+ group.setWorkspaceTheme(theme);
}
- public Group findByShortName(final String shortName) {
- return finder.findByShortName(shortName);
+ public Group createGroup(final Group group, final User user) throws GroupNameInUseException,
+ UserMustBeLoggedException {
+ final String defaultSiteWorkspaceTheme = kuneProperties.get(KuneProperties.WS_THEMES_DEF);
+ if (User.isKnownUser(user)) {
+ if (group.getType().equals(GroupType.COMMUNITY)) {
+ group.setAdmissionType(AdmissionType.Open);
+ } else if (group.getType().equals(GroupType.ORGANIZATION)) {
+ group.setAdmissionType(AdmissionType.Moderated);
+ } else if (group.getType().equals(GroupType.PROJECT)) {
+ group.setAdmissionType(AdmissionType.Moderated);
+ } else if (group.getType().equals(GroupType.ORPHANED_PROJECT)) {
+ group.setAdmissionType(AdmissionType.Open);
+ }
+ final String licName = group.getDefaultLicense().getShortName();
+ final License license = licenseFinder.findByShortName(licName);
+ group.setDefaultLicense(license);
+ group.setWorkspaceTheme(defaultSiteWorkspaceTheme);
+ initSocialNetwork(group, user.getUserGroup());
+ initGroup(user, group);
+ return group;
+ } else {
+ throw new UserMustBeLoggedException();
+ }
+
}
- public List<Group> findAdminInGroups(final Long groupId) {
- return finder.findAdminInGroups(groupId);
+ public Group createUserGroup(final User user) throws GroupNameInUseException, EmailAddressInUseException {
+ final String defaultSiteWorkspaceTheme = kuneProperties.get(KuneProperties.WS_THEMES_DEF);
+ final String licenseDefId = properties.getDefaultLicense();
+ final License licenseDef = licenseFinder.findByShortName(licenseDefId);
+ final Group group = new Group(user.getShortName(), user.getName(), licenseDef, GroupType.PERSONAL);
+ User userSameEmail = null;
+ try {
+ userSameEmail = userFinder.getByEmail(user.getEmail());
+ } catch (final NoResultException e) {
+ // Ok, no more with this email
+ }
+ if (userSameEmail != null) {
+ throw new EmailAddressInUseException();
+ }
+ group.setAdmissionType(AdmissionType.Closed);
+ group.setWorkspaceTheme(defaultSiteWorkspaceTheme);
+ user.setUserGroup(group);
+ initSocialNetwork(group, group);
+ try {
+ initGroup(user, group);
+ super.persist(user, User.class);
+ } catch (final EntityExistsException e) {
+ throw new GroupNameInUseException();
+ }
+ return group;
}
- public List<Group> findCollabInGroups(final Long groupId) {
- return finder.findCollabInGroups(groupId);
+ public List<Group> findAdminInGroups(final Long groupId) {
+ return finder.findAdminInGroups(groupId);
}
- public Group createUserGroup(final User user) throws GroupNameInUseException, EmailAddressInUseException {
- String defaultSiteWorkspaceTheme = kuneProperties.get(KuneProperties.WS_THEMES_DEF);
- final String licenseDefId = properties.getDefaultLicense();
- final License licenseDef = licenseFinder.findByShortName(licenseDefId);
- final Group group = new Group(user.getShortName(), user.getName(), licenseDef, GroupType.PERSONAL);
- User userSameEmail = null;
- try {
- userSameEmail = userFinder.getByEmail(user.getEmail());
- } catch (NoResultException e) {
- // Ok, no more with this email
- }
- if (userSameEmail != null) {
- throw new EmailAddressInUseException();
- }
- group.setAdmissionType(AdmissionType.Closed);
- group.setWorkspaceTheme(defaultSiteWorkspaceTheme);
- user.setUserGroup(group);
- initSocialNetwork(group, group);
- try {
- initGroup(user, group);
- super.persist(user, User.class);
- } catch (final EntityExistsException e) {
- throw new GroupNameInUseException();
- }
- return group;
+ public Group findByShortName(final String shortName) {
+ return finder.findByShortName(shortName);
}
- public Group createGroup(final Group group, final User user) throws GroupNameInUseException,
- UserMustBeLoggedException {
- String defaultSiteWorkspaceTheme = kuneProperties.get(KuneProperties.WS_THEMES_DEF);
- if (User.isKnownUser(user)) {
- if (group.getType().equals(GroupType.COMMUNITY)) {
- group.setAdmissionType(AdmissionType.Open);
- } else if (group.getType().equals(GroupType.ORGANIZATION)) {
- group.setAdmissionType(AdmissionType.Moderated);
- } else if (group.getType().equals(GroupType.PROJECT)) {
- group.setAdmissionType(AdmissionType.Moderated);
- } else if (group.getType().equals(GroupType.ORPHANED_PROJECT)) {
- group.setAdmissionType(AdmissionType.Open);
- }
- String licName = group.getDefaultLicense().getShortName();
- License license = licenseFinder.findByShortName(licName);
- group.setDefaultLicense(license);
- group.setWorkspaceTheme(defaultSiteWorkspaceTheme);
- initSocialNetwork(group, user.getUserGroup());
- initGroup(user, group);
- return group;
- } else {
- throw new UserMustBeLoggedException();
- }
-
+ public List<Group> findCollabInGroups(final Long groupId) {
+ return finder.findCollabInGroups(groupId);
}
- public void changeWsTheme(final User user, final Group group, final String theme) throws AccessViolationException {
- if (group.getSocialNetwork().isAdmin(user.getUserGroup())) {
- group.setWorkspaceTheme(theme);
- // Check themes...
- } else {
- throw new AccessViolationException();
- }
+ public Group getDefaultGroup() {
+ final String shortName = properties.getDefaultSiteShortName();
+ return findByShortName(shortName);
}
public Group getGroupOfUserWithId(final Long userId) {
- return userId != null ? find(User.class, userId).getUserGroup() : null;
+ return userId != null ? find(User.class, userId).getUserGroup() : null;
}
public SearchResult<Group> search(final String search) {
- return this.search(search, null, null);
+ return this.search(search, null, null);
}
public SearchResult<Group> search(final String search, final Integer firstResult, final Integer maxResults) {
- MultiFieldQueryParser parser = new MultiFieldQueryParser(
- new String[] { "longName", "shortName", "publicDesc" }, new StandardAnalyzer());
- Query query;
- try {
- query = parser.parse(search);
- } catch (ParseException e) {
- throw new RuntimeException("Error parsing search");
- }
- return super.search(query, firstResult, maxResults);
+ final MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[] { "longName", "shortName",
+ "publicDesc" }, new StandardAnalyzer());
+ Query query;
+ try {
+ query = parser.parse(search);
+ } catch (final ParseException e) {
+ throw new RuntimeException("Error parsing search");
+ }
+ return super.search(query, firstResult, maxResults);
}
- private void initSocialNetwork(final Group group, final Group userGroup) {
- final SocialNetwork network = group.getSocialNetwork();
- final AccessLists lists = network.getAccessLists();
- lists.getEditors().setMode(GroupListMode.NOBODY);
- lists.getViewers().setMode(GroupListMode.EVERYONE);
- if (!group.getType().equals(GroupType.ORPHANED_PROJECT)) {
- network.addAdmin(userGroup);
- }
+ private void initGroup(final User user, final Group group) throws GroupNameInUseException {
+ try {
+ persist(group);
+ } catch (final EntityExistsException e) {
+ throw new GroupNameInUseException();
+ }
+ for (final ServerTool tool : registry.all()) {
+ tool.initGroup(user, group);
+ }
}
- private void initGroup(final User user, final Group group) throws GroupNameInUseException {
- try {
- persist(group);
- } catch (final EntityExistsException e) {
- throw new GroupNameInUseException();
- }
- for (final ServerTool tool : registry.all()) {
- tool.initGroup(user, group);
- }
+ private void initSocialNetwork(final Group group, final Group userGroup) {
+ final SocialNetwork network = group.getSocialNetwork();
+ final AccessLists lists = network.getAccessLists();
+ lists.getEditors().setMode(GroupListMode.NOBODY);
+ lists.getViewers().setMode(GroupListMode.EVERYONE);
+ if (!group.getType().equals(GroupType.ORPHANED_PROJECT)) {
+ network.addAdmin(userGroup);
+ }
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2008-08-06 04:21:36 UTC (rev 832)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2008-08-07 12:07:05 UTC (rev 833)
@@ -34,6 +34,7 @@
import org.ourproject.kune.platf.client.errors.LastAdminInGroupException;
import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
import org.ourproject.kune.platf.server.ParticipationData;
+import org.ourproject.kune.platf.server.access.AccessRightsService;
import org.ourproject.kune.platf.server.domain.AdmissionType;
import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.domain.GroupListMode;
@@ -51,11 +52,14 @@
public class SocialNetworkManagerDefault extends DefaultManager<SocialNetwork, Long> implements SocialNetworkManager {
private final Group finder;
+ private final AccessRightsService accessRightsService;
@Inject
- public SocialNetworkManagerDefault(final Provider<EntityManager> provider, final Group finder) {
+ public SocialNetworkManagerDefault(final Provider<EntityManager> provider, final Group finder,
+ final AccessRightsService accessRightsService) {
super(provider, SocialNetwork.class);
this.finder = finder;
+ this.accessRightsService = accessRightsService;
}
public void acceptJoinGroup(final User userLogged, final Group group, final Group inGroup) throws DefaultException,
@@ -252,7 +256,7 @@
}
private void checkUserLoggedIsAdmin(final User userLogged, final SocialNetwork sn) throws AccessViolationException {
- if (!sn.isAdmin(userLogged.getUserGroup())) {
+ if (!accessRightsService.get(userLogged, sn.getAccessLists()).isAdministrable()) {
throw new AccessViolationException();
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/GroupRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/GroupRPC.java 2008-08-06 04:21:36 UTC (rev 832)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/GroupRPC.java 2008-08-07 12:07:05 UTC (rev 833)
@@ -29,7 +29,7 @@
import org.ourproject.kune.platf.server.UserSession;
import org.ourproject.kune.platf.server.access.AccessType;
import org.ourproject.kune.platf.server.auth.Authenticated;
-import org.ourproject.kune.platf.server.auth.Authorizated;
+import org.ourproject.kune.platf.server.auth.GroupAuthorizated;
import org.ourproject.kune.platf.server.content.ContentManager;
import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.domain.User;
@@ -60,7 +60,7 @@
}
@Authenticated
- @Authorizated(accessTypeRequired = AccessType.ADMIN)
+ @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
@Transactional(type = TransactionType.READ_WRITE, rollbackOn = DefaultException.class)
public void changeGroupWsTheme(final String userHash, final String groupShortName, final String theme)
throws DefaultException {
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java 2008-08-06 04:21:36 UTC (rev 832)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java 2008-08-07 12:07:05 UTC (rev 833)
@@ -27,7 +27,7 @@
import org.ourproject.kune.platf.server.UserSession;
import org.ourproject.kune.platf.server.access.AccessType;
import org.ourproject.kune.platf.server.auth.Authenticated;
-import org.ourproject.kune.platf.server.auth.Authorizated;
+import org.ourproject.kune.platf.server.auth.GroupAuthorizated;
import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.domain.User;
import org.ourproject.kune.platf.server.manager.GroupManager;
@@ -58,7 +58,7 @@
}
@Authenticated
- @Authorizated(accessTypeRequired = AccessType.ADMIN)
+ @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
@Transactional(type = TransactionType.READ_WRITE)
public SocialNetworkResultDTO AcceptJoinGroup(final String hash, final String groupShortName,
final String groupToAcceptShortName) throws DefaultException {
@@ -71,7 +71,7 @@
}
@Authenticated
- @Authorizated(accessTypeRequired = AccessType.ADMIN)
+ @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
@Transactional(type = TransactionType.READ_WRITE)
public SocialNetworkResultDTO addAdminMember(final String hash, final String groupShortName,
final String groupToAddShortName) throws DefaultException {
@@ -84,7 +84,7 @@
}
@Authenticated
- @Authorizated(accessTypeRequired = AccessType.ADMIN)
+ @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
@Transactional(type = TransactionType.READ_WRITE)
public SocialNetworkResultDTO addCollabMember(final String hash, final String groupShortName,
final String groupToAddShortName) throws DefaultException {
@@ -97,7 +97,7 @@
}
@Authenticated
- @Authorizated(accessTypeRequired = AccessType.ADMIN)
+ @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
@Transactional(type = TransactionType.READ_WRITE)
public SocialNetworkResultDTO addViewerMember(final String hash, final String groupShortName,
final String groupToAddShortName) throws DefaultException {
@@ -110,7 +110,7 @@
}
@Authenticated
- @Authorizated(accessTypeRequired = AccessType.ADMIN)
+ @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
@Transactional(type = TransactionType.READ_WRITE)
public SocialNetworkResultDTO deleteMember(final String hash, final String groupShortName,
final String groupToDeleleShortName) throws DefaultException {
@@ -123,7 +123,7 @@
}
@Authenticated
- @Authorizated(accessTypeRequired = AccessType.ADMIN)
+ @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
@Transactional(type = TransactionType.READ_WRITE)
public SocialNetworkResultDTO denyJoinGroup(final String hash, final String groupShortName,
final String groupToDenyShortName) throws DefaultException {
@@ -137,7 +137,7 @@
@Authenticated(mandatory = false)
// At least you can access as Viewer to the Group
- @Authorizated(accessTypeRequired = AccessType.READ)
+ @GroupAuthorizated(accessTypeRequired = AccessType.READ)
@Transactional(type = TransactionType.READ_ONLY)
public SocialNetworkDTO getGroupMembers(final String hash, final String groupShortName) throws DefaultException {
final UserSession userSession = getUserSession();
@@ -148,7 +148,7 @@
@Authenticated(mandatory = false)
// At least you can access as Viewer to the Group
- @Authorizated(accessTypeRequired = AccessType.READ)
+ @GroupAuthorizated(accessTypeRequired = AccessType.READ)
@Transactional(type = TransactionType.READ_ONLY)
public ParticipationDataDTO getParticipation(final String hash, final String groupShortName)
throws DefaultException {
@@ -168,7 +168,7 @@
}
@Authenticated
- @Authorizated(accessTypeRequired = AccessType.ADMIN)
+ @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
@Transactional(type = TransactionType.READ_WRITE)
public SocialNetworkResultDTO setAdminAsCollab(final String hash, final String groupShortName,
final String groupToSetCollabShortName) throws DefaultException {
@@ -181,7 +181,7 @@
}
@Authenticated
- @Authorizated(accessTypeRequired = AccessType.ADMIN)
+ @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
@Transactional(type = TransactionType.READ_WRITE)
public SocialNetworkResultDTO setCollabAsAdmin(final String hash, final String groupShortName,
final String groupToSetAdminShortName) throws DefaultException {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java 2008-08-06 04:21:36 UTC (rev 832)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java 2008-08-07 12:07:05 UTC (rev 833)
@@ -18,7 +18,7 @@
import org.ourproject.kune.platf.client.ui.gridmenu.GridButton;
import org.ourproject.kune.platf.client.ui.gridmenu.GridGroup;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
-import org.ourproject.kune.workspace.client.search.UserLiveSearcher;
+import org.ourproject.kune.workspace.client.search.GroupLiveSearcher;
import org.ourproject.kune.workspace.client.sitebar.Site;
import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
@@ -42,7 +42,7 @@
public GroupMembersSummaryPresenter(final I18nUITranslationService i18n, final StateManager stateManager,
final ImageUtils imageUtils, final Session session,
final Provider<SocialNetworkServiceAsync> snServiceProvider,
- final Provider<UserLiveSearcher> userLiveSearcherProvider, final WsThemePresenter wsThemePresenter) {
+ final Provider<GroupLiveSearcher> liveSearcherProvider, final WsThemePresenter wsThemePresenter) {
super(i18n, stateManager, imageUtils, session, snServiceProvider);
this.i18n = i18n;
this.stateManager = stateManager;
@@ -73,12 +73,12 @@
addMember = new GridButton("images/add-green.gif", "", i18n
.t("Add a group or a person as member of this group"), new Slot<String>() {
public void onEvent(final String parameter) {
- userLiveSearcherProvider.get().onSelection(new Slot<LinkDTO>() {
+ liveSearcherProvider.get().onSelection(new Slot<LinkDTO>() {
public void onEvent(final LinkDTO link) {
view.confirmAddCollab(link.getShortName(), link.getLongName());
}
});
- userLiveSearcherProvider.get().show();
+ liveSearcherProvider.get().show();
}
});
super.addGroupOperation(gotoGroupMenuItem, false);
1
0
06 Aug '08
Author: vjrj
Date: 2008-08-06 06:21:36 +0200 (Wed, 06 Aug 2008)
New Revision: 832
Modified:
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummary.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
Log:
Some adjusts in SN and chat. Search fixed.
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java 2008-08-06 02:36:00 UTC (rev 831)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java 2008-08-06 04:21:36 UTC (rev 832)
@@ -51,7 +51,7 @@
public ChatContent create() {
final WorkspaceDeckPanel panel = new WorkspaceDeckPanel();
final ChatContentPresenter presenter = new ChatContentPresenter($(EmiteUIDialog.class), panel,
- $p(ChatInfo.class), $p(ChatRoom.class));
+ $$(ChatInfo.class), $$(ChatRoom.class));
return presenter;
}
});
@@ -59,7 +59,7 @@
register(SingletonScope.class, new Factory<ChatContext>(ChatContext.class) {
public ChatContext create() {
final WorkspaceDeckPanel panel = new WorkspaceDeckPanel();
- final ChatContextPresenter presenter = new ChatContextPresenter(panel, $p(RoomsAdmin.class));
+ final ChatContextPresenter presenter = new ChatContextPresenter(panel, $$(RoomsAdmin.class));
return presenter;
}
});
@@ -84,8 +84,8 @@
register(SingletonScope.class, new Factory<RoomsAdmin>(RoomsAdmin.class) {
public RoomsAdmin create() {
final RoomsAdminPresenter presenter = new RoomsAdminPresenter($(ContextItems.class),
- $(I18nUITranslationService.class), $p(StateManager.class), $(Session.class),
- $p(ContentServiceAsync.class));
+ $(I18nUITranslationService.class), $$(StateManager.class), $(Session.class),
+ $$(ContentServiceAsync.class));
return presenter;
}
});
@@ -93,8 +93,8 @@
register(SingletonScope.class, new Factory<ChatClientTool>(ChatClientTool.class) {
public ChatClientTool create() {
return new ChatClientTool($(Session.class), $(Application.class), $(I18nUITranslationService.class),
- $(EmiteUIDialog.class), $(WorkspaceSkeleton.class), $p(GroupMembersSummary.class),
- $(ToolSelector.class), $(WsThemePresenter.class), $p(ChatContent.class), $p(ChatContext.class));
+ $(EmiteUIDialog.class), $(WorkspaceSkeleton.class), $$(GroupMembersSummary.class),
+ $(ToolSelector.class), $(WsThemePresenter.class), $$(ChatContent.class), $$(ChatContext.class));
}
});
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-08-06 02:36:00 UTC (rev 831)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-08-06 04:21:36 UTC (rev 832)
@@ -64,13 +64,18 @@
final ChatOptions chatOptions = new ChatOptions(initData.getChatHttpBase(), initData.getChatDomain(),
initData.getChatRoomHost());
chat = new ChatEngineXmpp(emiteUIDialog, chatOptions, i18n, ws);
- groupMembersSummaryProvider.get().addGroupOperation(
+ groupMembersSummaryProvider.get().addUserOperation(
new MenuItem<GroupDTO>("images/chat-basic.gif", i18n.t("Start a chat with this member"),
new Slot<GroupDTO>() {
public void onEvent(final GroupDTO group) {
- emiteUIDialog.chat(XmppURI.jid(group.getShortName() + "@"
- + initData.getChatDomain()));
emiteUIDialog.show();
+ if (emiteUIDialog.isLoggedIn()) {
+ emiteUIDialog.chat(XmppURI.jid(group.getShortName() + "@"
+ + initData.getChatDomain()));
+ } else {
+ ws.showAlertMessage(i18n.t("Error"), i18n
+ .t("To start a chat you need to be 'online'."));
+ }
}
}), true);
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-08-06 02:36:00 UTC (rev 831)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-08-06 04:21:36 UTC (rev 832)
@@ -57,9 +57,13 @@
}
public void joinRoom(final String roomName, final String userAlias) {
- final XmppURI roomURI = XmppURI.uri(roomName + "@" + chatOptions.roomHost + "/"
- + chatOptions.userOptions.getUserJid().getNode());
- emiteDialog.joinRoom(roomURI);
+ if (emiteDialog.isLoggedIn()) {
+ final XmppURI roomURI = XmppURI.uri(roomName + "@" + chatOptions.roomHost + "/"
+ + chatOptions.userOptions.getUserJid().getNode());
+ emiteDialog.joinRoom(roomURI);
+ } else {
+ ws.showAlertMessage(i18n.t("Error"), i18n.t("To join a chatroom you need to be 'online'."));
+ }
}
public void login(final String jid, final String passwd) {
@@ -92,6 +96,7 @@
});
ws.getSiteTraybar().addButton(traybarButton);
}
+ emiteDialog.setEnableStatusUI(true);
emiteDialog.hide();
emiteDialog.onChatAttended(new Slot<String>() {
public void onEvent(final String parameter) {
@@ -111,6 +116,7 @@
final UserChatOptions userChatOptions = getUserChatOptions("reset(a)example.com", "");
emiteDialog.refreshUserInfo(userChatOptions);
chatOptions.userOptions = userChatOptions;
+ emiteDialog.setEnableStatusUI(false);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java 2008-08-06 02:36:00 UTC (rev 831)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java 2008-08-06 04:21:36 UTC (rev 832)
@@ -56,14 +56,14 @@
register(SingletonScope.class, new Factory<DocumentClientTool>(DocumentClientTool.class) {
public DocumentClientTool create() {
return new DocumentClientTool(i18n, $(ToolSelector.class), $(WsThemePresenter.class),
- $(WorkspaceSkeleton.class), $p(DocumentContent.class), $p(DocumentContext.class));
+ $(WorkspaceSkeleton.class), $$(DocumentContent.class), $$(DocumentContext.class));
}
});
register(SingletonScope.class, new Factory<AdminContext>(AdminContext.class) {
public AdminContext create() {
final AdminContextPresenter presenter = new AdminContextPresenter($(Session.class),
- $p(TagsSummary.class));
+ $$(TagsSummary.class));
final AdminContextView view = new AdminContextPanel(presenter, i18n);
presenter.init(view);
return presenter;
@@ -74,16 +74,16 @@
public DocumentContent create() {
final WorkspaceDeckPanel panel = new WorkspaceDeckPanel();
final DocumentContentPresenter presenter = new DocumentContentPresenter(panel, $(Session.class),
- $(RateIt.class), $p(DocumentReader.class), $p(DocumentReaderControl.class),
- $p(TextEditor.class), $p(FolderViewer.class), $p(FolderEditor.class));
+ $(RateIt.class), $$(DocumentReader.class), $$(DocumentReaderControl.class),
+ $$(TextEditor.class), $$(FolderViewer.class), $$(FolderEditor.class));
return presenter;
}
});
register(SingletonScope.class, new Factory<DocumentContext>(DocumentContext.class) {
public DocumentContext create() {
final WorkspaceDeckPanel view = new WorkspaceDeckPanel();
- final DocumentContextPresenter presenter = new DocumentContextPresenter(view, $p(FolderContext.class),
- $p(AdminContext.class));
+ final DocumentContextPresenter presenter = new DocumentContextPresenter(view, $$(FolderContext.class),
+ $$(AdminContext.class));
return presenter;
}
});
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-06 02:36:00 UTC (rev 831)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-06 04:21:36 UTC (rev 832)
@@ -157,7 +157,7 @@
register(SingletonScope.class, new Factory<Session>(Session.class) {
public Session create() {
- return new SessionDefault(Cookies.getCookie(Site.USERHASH), $p(UserServiceAsync.class));
+ return new SessionDefault(Cookies.getCookie(Site.USERHASH), $$(UserServiceAsync.class));
}
}, new Factory<I18nServiceAsync>(I18nServiceAsync.class) {
public I18nServiceAsync create() {
@@ -243,7 +243,7 @@
register(SingletonScope.class, new Factory<KuneErrorHandler>(KuneErrorHandler.class) {
public KuneErrorHandler create() {
- return new KuneErrorHandler($(Session.class), i18n, $p(WorkspaceSkeleton.class), $p(StateManager.class));
+ return new KuneErrorHandler($(Session.class), i18n, $$(WorkspaceSkeleton.class), $$(StateManager.class));
}
});
@@ -294,7 +294,7 @@
register(SingletonScope.class, new Factory<SiteProgress>(SiteProgress.class) {
public SiteProgress create() {
final SiteProgressPresenter presenter = new SiteProgressPresenter();
- final SiteProgressPanel panel = new SiteProgressPanel(presenter, $p(SitePublicSpaceLink.class));
+ final SiteProgressPanel panel = new SiteProgressPanel(presenter, $$(SitePublicSpaceLink.class));
presenter.init(panel);
return presenter;
}
@@ -302,7 +302,7 @@
register(SingletonScope.class, new Factory<Site>(Site.class) {
public Site create() {
- return new Site(i18n, $(SiteProgress.class), $p(SiteMessage.class));
+ return new Site(i18n, $(SiteProgress.class), $$(SiteMessage.class));
}
});
@@ -339,7 +339,7 @@
register(SingletonScope.class, new Factory<SiteSignOutLink>(SiteSignOutLink.class) {
public SiteSignOutLink create() {
final SiteSignOutLinkPresenter presenter = new SiteSignOutLinkPresenter($(Session.class),
- $p(UserServiceAsync.class), $p(KuneErrorHandler.class));
+ $$(UserServiceAsync.class), $$(KuneErrorHandler.class));
final SiteSignOutLinkPanel panel = new SiteSignOutLinkPanel(presenter, i18n, ws);
presenter.init(panel);
return presenter;
@@ -375,7 +375,7 @@
register(SingletonScope.class, new Factory<SiteSearcher>(SiteSearcher.class) {
public SiteSearcher create() {
- final SiteSearcherPresenter presenter = new SiteSearcherPresenter($p(StateManager.class));
+ final SiteSearcherPresenter presenter = new SiteSearcherPresenter($$(StateManager.class));
final SiteSearcherView view = new SiteSearcherPanel(presenter, i18n, ws);
presenter.init(view);
return presenter;
@@ -394,7 +394,7 @@
register(SingletonScope.class, new Factory<SiteSearch>(SiteSearch.class) {
public SiteSearch create() {
- final SiteSearchPresenter presenter = new SiteSearchPresenter($p(SiteSearcher.class));
+ final SiteSearchPresenter presenter = new SiteSearchPresenter($$(SiteSearcher.class));
final SiteSearchPanel panel = new SiteSearchPanel(presenter, ws, i18n);
presenter.init(panel);
return presenter;
@@ -423,8 +423,8 @@
register(SingletonScope.class, new Factory<NewGroup>(NewGroup.class) {
public NewGroup create() {
final NewGroupPresenter presenter = new NewGroupPresenter(i18n, $(Session.class),
- $(StateManager.class), $p(GroupServiceAsync.class));
- final NewGroupPanel view = new NewGroupPanel(presenter, i18n, $p(LicenseChoose.class));
+ $(StateManager.class), $$(GroupServiceAsync.class));
+ final NewGroupPanel view = new NewGroupPanel(presenter, i18n, $$(LicenseChoose.class));
presenter.init(view);
return presenter;
}
@@ -442,7 +442,7 @@
register(SingletonScope.class, new Factory<WsThemePresenter>(WsThemePresenter.class) {
public WsThemePresenter create() {
- final WsThemePresenter presenter = new WsThemePresenter($(Session.class), $p(GroupServiceAsync.class),
+ final WsThemePresenter presenter = new WsThemePresenter($(Session.class), $$(GroupServiceAsync.class),
$(StateManager.class));
final WsThemePanel panel = new WsThemePanel(ws, presenter, i18n);
presenter.init(panel);
@@ -490,7 +490,7 @@
register(SingletonScope.class, new Factory<RateIt>(RateIt.class) {
public RateIt create() {
final RateItPresenter presenter = new RateItPresenter(i18n, $(Session.class),
- $p(ContentServiceAsync.class), $(StateManager.class));
+ $$(ContentServiceAsync.class), $(StateManager.class));
final RateItPanel panel = new RateItPanel(presenter, i18n, ws);
presenter.init(panel);
return presenter;
@@ -501,7 +501,7 @@
public GroupMembersSummary create() {
final GroupMembersSummaryPresenter presenter = new GroupMembersSummaryPresenter(i18n,
$(StateManager.class), $(ImageUtils.class), $(Session.class),
- $p(SocialNetworkServiceAsync.class), $p(UserLiveSearcher.class), $(WsThemePresenter.class));
+ $$(SocialNetworkServiceAsync.class), $$(UserLiveSearcher.class), $(WsThemePresenter.class));
final GroupMembersSummaryView view = new GroupMembersSummaryPanel(presenter, i18n, ws);
presenter.init(view);
return presenter;
@@ -522,7 +522,7 @@
public ParticipationSummary create() {
final ParticipationSummaryPresenter presenter = new ParticipationSummaryPresenter(i18n,
$(StateManager.class), $(ImageUtils.class), $(Session.class),
- $p(SocialNetworkServiceAsync.class), $(WsThemePresenter.class));
+ $$(SocialNetworkServiceAsync.class), $(WsThemePresenter.class));
final ParticipationSummaryView view = new ParticipationSummaryPanel(presenter, i18n, ws);
presenter.init(view);
return presenter;
@@ -532,7 +532,7 @@
register(SingletonScope.class, new Factory<TagsSummary>(TagsSummary.class) {
public TagsSummary create() {
final TagsSummaryPresenter presenter = new TagsSummaryPresenter($(Session.class),
- $p(SiteSearcher.class), $(StateManager.class), $(WsThemePresenter.class));
+ $$(SiteSearcher.class), $(StateManager.class), $(WsThemePresenter.class));
final TagsSummaryPanel panel = new TagsSummaryPanel(presenter, i18n, ws);
presenter.init(panel);
return presenter;
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java 2008-08-06 02:36:00 UTC (rev 831)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java 2008-08-06 04:21:36 UTC (rev 832)
@@ -55,7 +55,7 @@
private final Provider<UserServiceAsync> userServiceProvider;
public SessionDefault(final String userHash, final Provider<UserServiceAsync> userServiceProvider) {
- this.userHash = userHash;
+ this.userHash = userHash == null || userHash.equals("null") ? null : userHash;
this.userServiceProvider = userServiceProvider;
languagesArray = null;
this.onInitDataReceived = new Signal<InitDataDTO>("initDataReceived");
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2008-08-06 02:36:00 UTC (rev 831)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2008-08-06 04:21:36 UTC (rev 832)
@@ -232,7 +232,7 @@
}
public void sort() {
- store.sort(GROUP);
+ store.sort(GROUP, SortDir.ASC);
}
public void updateItem(final GridItem<T> gridItem) {
@@ -311,7 +311,7 @@
final ArrayReader reader = new ArrayReader(1, recordDef);
store = new GroupingStore(proxy, reader);
- store.setSortInfo(new SortState(GROUP, SortDir.DESC));
+ store.setSortInfo(new SortState(GROUP, SortDir.ASC));
store.setGroupField(GROUP);
store.setGroupOnSort(true);
store.load();
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java 2008-08-06 02:36:00 UTC (rev 831)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java 2008-08-06 04:21:36 UTC (rev 832)
@@ -33,22 +33,11 @@
public abstract class DefaultManager<T, K> {
private final Provider<EntityManager> provider;
- private final Provider<FullTextEntityManager> fullTextEntityManagerProvider;
private final Class<T> entityClass;
public DefaultManager(final Provider<EntityManager> provider, final Class<T> entityClass) {
this.provider = provider;
this.entityClass = entityClass;
- fullTextEntityManagerProvider = new Provider<FullTextEntityManager>() {
- private FullTextEntityManager searchManager;
-
- public FullTextEntityManager get() {
- if (searchManager == null) {
- searchManager = Search.createFullTextEntityManager(getEntityManager());
- }
- return searchManager;
- }
- };
}
public T find(final Long primaryKey) {
@@ -75,7 +64,8 @@
@SuppressWarnings("unchecked")
public void reIndex() {
- final FullTextEntityManager fullTextEm = fullTextEntityManagerProvider.get();
+ // Inject this?
+ final FullTextEntityManager fullTextEm = Search.createFullTextEntityManager(getEntityManager());
fullTextEm.purgeAll(entityClass);
fullTextEm.getTransaction().commit();
fullTextEm.getTransaction().begin();
@@ -93,7 +83,8 @@
@SuppressWarnings("unchecked")
public SearchResult<T> search(final Query query, final Integer firstResult, final Integer maxResults) {
- final FullTextQuery emQuery = fullTextEntityManagerProvider.get().createFullTextQuery(query, entityClass);
+ final FullTextQuery emQuery = Search.createFullTextEntityManager(getEntityManager()).createFullTextQuery(query,
+ entityClass);
if (firstResult != null && maxResults != null) {
emQuery.setFirstResult(firstResult);
emQuery.setMaxResults(maxResults);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummary.java 2008-08-06 02:36:00 UTC (rev 831)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummary.java 2008-08-06 04:21:36 UTC (rev 832)
@@ -27,6 +27,10 @@
void addGroupOperation(MenuItem<GroupDTO> operation, boolean mustBeLogged);
+ void addUserOperation(MenuItem<GroupDTO> operation, boolean mustBeLogged);
+
void removeGroupOperation(MenuItem<GroupDTO> operation, boolean mustBeLogged);
+ void removeUserOperation(MenuItem<GroupDTO> operation, boolean mustBeLogged);
+
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java 2008-08-06 02:36:00 UTC (rev 831)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java 2008-08-06 04:21:36 UTC (rev 832)
@@ -81,7 +81,8 @@
userLiveSearcherProvider.get().show();
}
});
- super.addGroupOperation(gotoMemberMenuItem, false);
+ super.addGroupOperation(gotoGroupMenuItem, false);
+ super.addUserOperation(gotoMemberMenuItem, false);
}
public void addCollab(final String groupShortName) {
@@ -102,6 +103,10 @@
this.view = view;
}
+ public void onDoubleClick(final String groupShortName) {
+ stateManager.gotoToken(groupShortName);
+ }
+
private boolean isMember(final boolean userIsAdmin, final boolean userIsCollab) {
return userIsAdmin || userIsCollab;
}
@@ -175,8 +180,4 @@
}
}
- public void onDoubleClick(String groupShortName) {
- stateManager.gotoToken(groupShortName);
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-08-06 02:36:00 UTC (rev 831)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-08-06 04:21:36 UTC (rev 832)
@@ -41,6 +41,8 @@
private final GridMenuItemCollection<GroupDTO> otherOperations;
private final GridMenuItemCollection<GroupDTO> otherLoggedOperations;
private final ImageUtils imageUtils;
+ private final GridMenuItemCollection<GroupDTO> otherOperationsUsers;
+ private final GridMenuItemCollection<GroupDTO> otherLoggedOperationsUsers;
public SocialNetworkPresenter(final I18nUITranslationService i18n, final StateManager stateManager,
final ImageUtils imageUtils, final Session session,
@@ -52,8 +54,11 @@
this.snServiceProvider = snServiceProvider;
createButtons();
createMenuActions();
+ otherOperationsUsers = new GridMenuItemCollection<GroupDTO>();
+ otherLoggedOperationsUsers = new GridMenuItemCollection<GroupDTO>();
otherOperations = new GridMenuItemCollection<GroupDTO>();
otherLoggedOperations = new GridMenuItemCollection<GroupDTO>();
+
}
public void addGroupOperation(final MenuItem<GroupDTO> operation, final boolean mustBeLogged) {
@@ -62,12 +67,24 @@
collection.add(operation);
}
+ public void addUserOperation(final MenuItem<GroupDTO> operation, final boolean mustBeLogged) {
+ GridMenuItemCollection<GroupDTO> collection;
+ collection = mustBeLogged ? otherLoggedOperationsUsers : otherOperationsUsers;
+ collection.add(operation);
+ }
+
public void removeGroupOperation(final MenuItem<GroupDTO> operation, final boolean mustBeLogged) {
GridMenuItemCollection<GroupDTO> collection;
collection = mustBeLogged ? otherLoggedOperations : otherOperations;
collection.remove(operation);
}
+ public void removeUserOperation(final MenuItem<GroupDTO> operation, final boolean mustBeLogged) {
+ GridMenuItemCollection<GroupDTO> collection;
+ collection = mustBeLogged ? otherLoggedOperationsUsers : otherOperationsUsers;
+ collection.remove(operation);
+ }
+
protected GridItem<GroupDTO> createGridItem(final GridGroup groupCategory, final GroupDTO group,
final AccessRightsDTO rights, final MenuItem<GroupDTO>... gridMenuItems) {
final GridItem<GroupDTO> gridItem = createDefMemberMenu(group, groupCategory);
@@ -116,15 +133,23 @@
private GridItem<GroupDTO> createDefMemberMenu(final GroupDTO group, final GridGroup gridGroup) {
final GridMenu<GroupDTO> menu = new GridMenu<GroupDTO>(group);
final String longName = group.getLongName();
+ final String toolTip = i18n.t(group.getType().equals(GroupDTO.PERSONAL) ? "User nickname: [%s]"
+ : "Group short name: [%s]", group.getShortName());
final GridItem<GroupDTO> gridItem = new GridItem<GroupDTO>(group, gridGroup, group.getShortName(), imageUtils
- .getImageHtml(ImageDescriptor.groupDefIcon), longName, longName, " ", longName, i18n.t(
- "User name: [%s]", group.getShortName()), menu);
- if (otherOperations != null) {
+ .getImageHtml(ImageDescriptor.groupDefIcon), longName, longName, " ", longName, toolTip, menu);
+ if (!group.getType().equals(GroupDTO.PERSONAL)) {
menu.addMenuItemList(otherOperations);
}
- if (session.isLogged() && otherOperations != null) {
+ if (session.isLogged() && !group.getType().equals(GroupDTO.PERSONAL)) {
menu.addMenuItemList(otherLoggedOperations);
}
+ if (group.getType().equals(GroupDTO.PERSONAL)) {
+ menu.addMenuItemList(otherOperationsUsers);
+ }
+ if (session.isLogged() && group.getType().equals(GroupDTO.PERSONAL)) {
+ menu.addMenuItemList(otherLoggedOperationsUsers);
+ }
+
return gridItem;
}
@@ -147,21 +172,21 @@
removeMemberAction(groupDTO);
}
});
- changeToCollabMenuItem = new MenuItem<GroupDTO>("images/arrow-down-green.gif", i18n
- .t("Change to collaborator"), new Slot<GroupDTO>() {
- public void onEvent(final GroupDTO group) {
- Site.showProgressProcessing();
- snServiceProvider.get().setAdminAsCollab(session.getUserHash(),
- session.getCurrentState().getGroup().getShortName(), group.getShortName(),
- new AsyncCallbackSimple<SocialNetworkResultDTO>() {
- public void onSuccess(final SocialNetworkResultDTO result) {
- Site.hideProgress();
- Site.info(i18n.t("Type of member changed"));
- stateManager.setSocialNetwork(result);
- }
- });
- }
- });
+ changeToCollabMenuItem = new MenuItem<GroupDTO>("images/arrow-down-green.gif",
+ i18n.t("Change to collaborator"), new Slot<GroupDTO>() {
+ public void onEvent(final GroupDTO group) {
+ Site.showProgressProcessing();
+ snServiceProvider.get().setAdminAsCollab(session.getUserHash(),
+ session.getCurrentState().getGroup().getShortName(), group.getShortName(),
+ new AsyncCallbackSimple<SocialNetworkResultDTO>() {
+ public void onSuccess(final SocialNetworkResultDTO result) {
+ Site.hideProgress();
+ Site.info(i18n.t("Type of member changed"));
+ stateManager.setSocialNetwork(result);
+ }
+ });
+ }
+ });
removeMemberMenuItem = new MenuItem<GroupDTO>("images/del.gif", i18n.t("Remove this member"),
new Slot<GroupDTO>() {
public void onEvent(final GroupDTO group) {
1
0
r831 - in trunk/src/test/java/org/ourproject/kune/platf: integration server server/auth
by vjrj 06 Aug '08
by vjrj 06 Aug '08
06 Aug '08
Author: vjrj
Date: 2008-08-06 04:36:00 +0200 (Wed, 06 Aug 2008)
New Revision: 831
Added:
trunk/src/test/java/org/ourproject/kune/platf/server/auth/
trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptorTest.java
Modified:
trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java
Log:
Incomplete - task 38: Auth*MethodInterceptors Tests
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java 2008-08-05 17:43:43 UTC (rev 830)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java 2008-08-06 02:36:00 UTC (rev 831)
@@ -18,24 +18,26 @@
public class IntegrationTestHelper {
public static Injector createInjector() {
- final Injector injector = Guice.createInjector(new PlatformServerModule(), new DocumentServerModule(),
- new ChatServerModule(), new AbstractModule() {
- @Override
- protected void configure() {
- bindScope(SessionScoped.class, Scopes.SINGLETON);
- // test: use memory
- // test_db: use mysql
- bindConstant().annotatedWith(JpaUnit.class).to("test");
- bindConstant().annotatedWith(PropertiesFileName.class).to("kune.properties");
- bind(HttpServletRequest.class).to(HttpServletRequestMocked.class);
- }
- });
- return injector;
+ final Injector injector = Guice.createInjector(new PlatformServerModule(), new DocumentServerModule(),
+ new ChatServerModule(), new AbstractModule() {
+ @Override
+ protected void configure() {
+ bindScope(SessionScoped.class, Scopes.SINGLETON);
+ // test: use memory
+ // test_db: use mysql
+ bindConstant().annotatedWith(JpaUnit.class).to("test");
+ bindConstant().annotatedWith(PropertiesFileName.class).to("kune.properties");
+ bind(HttpServletRequest.class).to(HttpServletRequestMocked.class);
+ }
+ });
+ return injector;
}
- public IntegrationTestHelper(final Object test) {
- final Injector injector = createInjector();
- injector.getInstance(KunePersistenceService.class).start();
- injector.injectMembers(test);
+ public IntegrationTestHelper(final Object... tests) {
+ final Injector injector = createInjector();
+ injector.getInstance(KunePersistenceService.class).start();
+ for (final Object test : tests) {
+ injector.injectMembers(test);
+ }
}
}
Added: trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptorTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptorTest.java 2008-08-05 17:43:43 UTC (rev 830)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptorTest.java 2008-08-06 02:36:00 UTC (rev 831)
@@ -0,0 +1,81 @@
+package org.ourproject.kune.platf.server.auth;
+
+import java.lang.reflect.AccessibleObject;
+
+import org.aopalliance.intercept.MethodInvocation;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.ourproject.kune.platf.client.errors.SessionExpiredException;
+import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
+import org.ourproject.kune.platf.integration.IntegrationTest;
+import org.ourproject.kune.platf.integration.IntegrationTestHelper;
+
+public class AuthenticatedMethodInterceptorTest extends IntegrationTest {
+
+ private AuthenticatedMethodInterceptor auth;
+ private MethodInvocation invocation;
+ private Authenticated authAnnotation;
+
+ @Before
+ public void before() {
+ auth = new AuthenticatedMethodInterceptor();
+ new IntegrationTestHelper(auth, this);
+ invocation = Mockito.mock(MethodInvocation.class);
+ final AccessibleObject accessibleObject = Mockito.mock(AccessibleObject.class);
+ Mockito.stub(invocation.getMethod()).toReturn(this.getClass().getMethods()[0]);
+ Mockito.stub(invocation.getStaticPart()).toReturn(accessibleObject);
+ authAnnotation = Mockito.mock(Authenticated.class);
+ Mockito.stub(accessibleObject.getAnnotation(Authenticated.class)).toReturn(authAnnotation);
+ }
+
+ @Test(expected = UserMustBeLoggedException.class)
+ public void hashNullAndMandatoryMustDoNothing() throws Throwable {
+ Mockito.stub(authAnnotation.mandatory()).toReturn(true);
+ final Object[] result = { null };
+ Mockito.stub(invocation.getArguments()).toReturn(result);
+ auth.invoke(invocation);
+ }
+
+ @Test
+ public void hashNullAndNotMandatoryMustDoNothing() throws Throwable {
+ Mockito.stub(authAnnotation.mandatory()).toReturn(false);
+ final Object[] result = { null };
+ Mockito.stub(invocation.getArguments()).toReturn(result);
+ auth.invoke(invocation);
+ }
+
+ @Test
+ public void hashNullAsStringAndNotMandatoryMustDoNothing() throws Throwable {
+ Mockito.stub(authAnnotation.mandatory()).toReturn(false);
+ final Object[] result = { "null" };
+ Mockito.stub(invocation.getArguments()).toReturn(result);
+ auth.invoke(invocation);
+ }
+
+ @Test(expected = SessionExpiredException.class)
+ public void otherHashAndMandatoryAndLoggedMustSessionExp() throws Throwable {
+ doLogin();
+ Mockito.stub(authAnnotation.mandatory()).toReturn(true);
+ final Object[] result = { "other-hash" };
+ Mockito.stub(invocation.getArguments()).toReturn(result);
+ auth.invoke(invocation);
+ }
+
+ @Test
+ public void sameHashAndMandatoryAndLoggedMustSessionExp() throws Throwable {
+ doLogin();
+ Mockito.stub(authAnnotation.mandatory()).toReturn(true);
+ final Object[] result = { getHash() };
+ Mockito.stub(invocation.getArguments()).toReturn(result);
+ auth.invoke(invocation);
+ }
+
+ @Test(expected = SessionExpiredException.class)
+ public void someHashAndMandatoryAndNotLoggedMustSessionExp() throws Throwable {
+ Mockito.stub(authAnnotation.mandatory()).toReturn(true);
+ final Object[] result = { "some-hash" };
+ Mockito.stub(invocation.getArguments()).toReturn(result);
+ auth.invoke(invocation);
+ }
+}
1
0
Author: vjrj
Date: 2008-08-05 19:43:43 +0200 (Tue, 05 Aug 2008)
New Revision: 830
Added:
trunk/TROUBLESHOOT
trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
Removed:
trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.java
Modified:
trunk/DEV-GUIDE
trunk/INSTALL
trunk/script/deploy_gwt.sh
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java
trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java
trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java
Log:
new TROUBLESHOOT file, and INSTALL instructions improved
Complete - task 21: Session timeout problems (cookies issue?)
Modified: trunk/DEV-GUIDE
===================================================================
--- trunk/DEV-GUIDE 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/DEV-GUIDE 2008-08-05 17:43:43 UTC (rev 830)
@@ -3,8 +3,24 @@
Development Environment
--------------------------------------------------------------------------------
-See INSTALL for dev specific instructions
+Install kune (see INSTALL file).
+
+mvn eclipse:eclipse generates .project and download necessary code jars.
+
+GWT Hosted Mode:
+
+We have a "Run configuration" (Run > Open Run Dialog) in eclipse with Project: "org.ourproject.kune" with Main class: "com.google.gwt.dev.GWTShell", with this program arguments (or similar): "-noserver -out gwt-out /kune/?locale=en&log_level=INFO -port 8080" and in the "Classpath User Entries":
+ - gwt-dev-[linux|mac|windows].jar
+ - java - /org.ourproject.kune/src/main
+ - org.ourproject.kune (default classpath)
+
+before run hosted mode compile once with:
+ mvn gwt:compile
+and deploy with:
+ script/deploy_gwt.sh
+and then we run jetty (with "mvn jetty:run" also you can run server in debug mode, see TROUBLESHOOT).
+
Code
--------------------------------------------------------------------------------
We use some eclipse code preferences for kune project:
Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/INSTALL 2008-08-05 17:43:43 UTC (rev 830)
@@ -4,19 +4,17 @@
For development:
- Install java-jdk (>= 1.5), maven2, mysql (>= 5.0) and for example eclipse
-- Install gwt 1.4.60 and follow Appendix A for maven+gwt configuration
+- Install gwt 1.5rc1 and follow Appendix A for maven+gwt configuration
- Compile with maven:
# (in the trunk directory)
mvn compile
mvn gwt:compile
- Copy the target to src directory (only for test):
- mkdir -p src/main/webapp/gwt/org.ourproject.kune.app.Kune
- unison -batch -auto -ui text target/org.ourproject.kune-0.0.2/org.ourproject.kune.app.Kune/ src/main/webapp/gwt/org.ourproject.kune.app.Kune
+ bin/deploy_gwt.sh
(if you're using windows as dev plaftorm... you will have to write your own script ;). the idea is to
- copy everything from src/main/webapp/gwt/org.ourproject.kune.app.Kune to
- src/main/webapp/gwt/org.ourproject.kune.app.Kune)
+ copy everything from target/kune-0.0.VERSIONHERE/org.ourproject.kune.app.Kune to src/main/webapp/gwt/org.ourproject.kune.app.Kune)
- Make two databases in your mysql:
@@ -35,24 +33,19 @@
sudo chown yourUser:yourUser /var/lib/lucene/kune_dev/indexes
sudo chown yourUser:yourUser /var/lib/lucene/kune_test/indexes
- (in case you are using windows as dev platform you only have to create a couple of folders
- anywhere you like and then specify them in persistence.xml, as follows:
- <property name="hibernate.search.default.indexBase" value="C:\kune\kune-index"/>
+ In case you are using windows as dev platform you only have to create a couple of folders anywhere you like and then specify them in persistence.xml, as follows:
+ <property name="hibernate.search.default.indexBase" value="C:\kune\kune-index"/>
do the same with every persistence unit defined inside.
- )
-- Install and run a openfire jabber server (see Appendix B for proper configuration of openfire)
+- Install and run a openfire jabber server (see Appendix B for proper configuration of openfire) or ejabberd.
- Run jetty:
mvn jetty:run -Ddatabase.migrator.should.run=false # without liquibase db migraton (liquibase.should.run=false in new version)
once started (and initialized the db), you can stop a run jetty with de db migrator to insert initial data and migrate:
mvn jetty:run
-- And conect to http://yourIP:8080/kune
+- And connect to http://yourIP:8080/kune
-- For development with eclipse:
- mvn eclipse:eclipse
-
Appendix A: Configuration of maven
--------------------------------------------------------------------------------
Example of .m2/settings.xml:
@@ -144,4 +137,3 @@
--------------------------------------------------------------------------------
mvn package -Dmaven.test.skip=true -o
-
Added: trunk/TROUBLESHOOT
===================================================================
--- trunk/TROUBLESHOOT 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/TROUBLESHOOT 2008-08-05 17:43:43 UTC (rev 830)
@@ -0,0 +1,5 @@
+Server: debug with jetty in eclipse:
+http://docs.codehaus.org/display/JETTY/Debugging+with+the+Maven+Jetty+Plugin+inside+Eclipse
+
+Client code: you can debug with gwt hosted mode in eclipse (see DEV-GUIDE for hosted mode instructions).
+
Modified: trunk/script/deploy_gwt.sh
===================================================================
--- trunk/script/deploy_gwt.sh 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/script/deploy_gwt.sh 2008-08-05 17:43:43 UTC (rev 830)
@@ -1,4 +1,7 @@
#!/bin/bash
+
+mkdir -p src/main/webapp/gwt/org.ourproject.kune.app.Kune
+
find target/kune-0.0.4/org.ourproject.kune.app.Kune/ -name .DS_Store -exec rm {} \;
script/css-compact-and-tidy.css
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -18,9 +18,9 @@
import org.ourproject.kune.platf.client.rpc.SocialNetworkService;
import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
import org.ourproject.kune.platf.client.state.ContentProvider;
-import org.ourproject.kune.platf.client.state.ContentProviderImpl;
+import org.ourproject.kune.platf.client.state.ContentProviderDefault;
import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.state.SessionImpl;
+import org.ourproject.kune.platf.client.state.SessionDefault;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.state.StateManagerDefault;
import org.ourproject.kune.platf.client.tool.ToolSelector;
@@ -157,7 +157,7 @@
register(SingletonScope.class, new Factory<Session>(Session.class) {
public Session create() {
- return new SessionImpl(Cookies.getCookie(Site.USERHASH), $p(UserServiceAsync.class));
+ return new SessionDefault(Cookies.getCookie(Site.USERHASH), $p(UserServiceAsync.class));
}
}, new Factory<I18nServiceAsync>(I18nServiceAsync.class) {
public I18nServiceAsync create() {
@@ -230,7 +230,7 @@
}
}, new Factory<ContentProvider>(ContentProvider.class) {
public ContentProvider create() {
- return new ContentProviderImpl($(ContentServiceAsync.class));
+ return new ContentProviderDefault($(ContentServiceAsync.class));
}
}, new Factory<StateManager>(StateManager.class) {
public StateManager create() {
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java (from rev 827, trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java 2008-08-05 01:27:25 UTC (rev 827)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -0,0 +1,60 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package org.ourproject.kune.platf.client.state;
+
+import java.util.HashMap;
+
+import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.workspace.client.sitebar.Site;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+public class ContentProviderDefault implements ContentProvider {
+
+ private final ContentServiceAsync server;
+ private final HashMap<StateToken, StateDTO> cache;
+
+ public ContentProviderDefault(final ContentServiceAsync server) {
+ this.server = server;
+ this.cache = new HashMap<StateToken, StateDTO>();
+ }
+
+ public void cache(final StateToken encodeState, final StateDTO content) {
+ cache.put(encodeState, content);
+ }
+
+ public void getContent(final String user, final StateToken newState, final AsyncCallback<StateDTO> callback) {
+ Site.showProgressLoading();
+ final StateDTO catched = getCached(newState);
+ if (catched != null) {
+ callback.onSuccess(catched);
+ } else {
+ server.getContent(user, newState.getGroup(), newState, callback);
+ }
+ }
+
+ private StateDTO getCached(final StateToken newState) {
+ return cache.remove(newState);
+ }
+
+}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -1,60 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-package org.ourproject.kune.platf.client.state;
-
-import java.util.HashMap;
-
-import org.ourproject.kune.platf.client.dto.StateDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-import org.ourproject.kune.workspace.client.sitebar.Site;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-public class ContentProviderImpl implements ContentProvider {
-
- private final ContentServiceAsync server;
- private final HashMap<StateToken, StateDTO> cache;
-
- public ContentProviderImpl(final ContentServiceAsync server) {
- this.server = server;
- this.cache = new HashMap<StateToken, StateDTO>();
- }
-
- public void cache(final StateToken encodeState, final StateDTO content) {
- cache.put(encodeState, content);
- }
-
- public void getContent(final String user, final StateToken newState, final AsyncCallback<StateDTO> callback) {
- Site.showProgressLoading();
- final StateDTO catched = getCached(newState);
- if (catched != null) {
- callback.onSuccess(catched);
- } else {
- server.getContent(user, newState.getGroup(), newState, callback);
- }
- }
-
- private StateDTO getCached(final StateToken newState) {
- return cache.remove(newState);
- }
-
-}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java (from rev 827, trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.java 2008-08-05 01:27:25 UTC (rev 827)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -0,0 +1,196 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package org.ourproject.kune.platf.client.state;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.ourproject.kune.platf.client.dto.I18nCountryDTO;
+import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
+import org.ourproject.kune.platf.client.dto.I18nLanguageSimpleDTO;
+import org.ourproject.kune.platf.client.dto.InitDataDTO;
+import org.ourproject.kune.platf.client.dto.LicenseDTO;
+import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.UserInfoDTO;
+import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
+import org.ourproject.kune.workspace.client.sitebar.rpc.UserServiceAsync;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.calclab.suco.client.container.Provider;
+import com.calclab.suco.client.signal.Signal;
+import com.calclab.suco.client.signal.Signal0;
+import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot0;
+
+public class SessionDefault implements Session {
+ private String userHash;
+ private InitDataDTO initData;
+ private UserInfoDTO currentUserInfo;
+ private Object[][] languagesArray;
+ private Object[][] countriesArray;
+ private Object[][] timezonesArray;
+ private StateDTO currentState;
+ private I18nLanguageDTO currentLanguage;
+ private final Signal<InitDataDTO> onInitDataReceived;
+ private final Signal<UserInfoDTO> onUserSignIn;
+ private final Signal0 onUserSignOut;
+ private final Provider<UserServiceAsync> userServiceProvider;
+
+ public SessionDefault(final String userHash, final Provider<UserServiceAsync> userServiceProvider) {
+ this.userHash = userHash;
+ this.userServiceProvider = userServiceProvider;
+ languagesArray = null;
+ this.onInitDataReceived = new Signal<InitDataDTO>("initDataReceived");
+ this.onUserSignIn = new Signal<UserInfoDTO>("onUserSignIn");
+ this.onUserSignOut = new Signal0("onUserSignOut");
+ }
+
+ public void check(final AsyncCallbackSimple<?> callback) {
+ Log.debug("Checking session (userhash: " + getUserHash() + ")");
+ userServiceProvider.get().onlyCheckSession(getUserHash(), callback);
+ }
+
+ public List<I18nCountryDTO> getCountries() {
+ return initData.getCountries();
+ }
+
+ public Object[][] getCountriesArray() {
+ if (countriesArray == null) {
+ countriesArray = mapCountries();
+ }
+ return countriesArray;
+ }
+
+ public I18nLanguageDTO getCurrentLanguage() {
+ return currentLanguage;
+ }
+
+ public StateDTO getCurrentState() {
+ return currentState;
+ }
+
+ public UserInfoDTO getCurrentUserInfo() {
+ return currentUserInfo;
+ }
+
+ public List<I18nLanguageSimpleDTO> getLanguages() {
+ return initData.getLanguages();
+ }
+
+ public Object[][] getLanguagesArray() {
+ if (languagesArray == null) {
+ languagesArray = mapLangs();
+ }
+ return languagesArray;
+ }
+
+ public List<LicenseDTO> getLicenses() {
+ return initData.getLicenses();
+ }
+
+ public Object[][] getTimezones() {
+ if (timezonesArray == null) {
+ mapTimezones();
+ }
+ return timezonesArray;
+ }
+
+ public String getUserHash() {
+ return userHash;
+ }
+
+ public boolean isLogged() {
+ return userHash != null;
+ }
+
+ public void onInitDataReceived(final Slot<InitDataDTO> slot) {
+ onInitDataReceived.add(slot);
+ }
+
+ public void onUserSignIn(final Slot<UserInfoDTO> slot) {
+ onUserSignIn.add(slot);
+ }
+
+ public void onUserSignOut(final Slot0 slot) {
+ onUserSignOut.add(slot);
+ }
+
+ public void setCurrent(final StateDTO currentState) {
+ this.currentState = currentState;
+ }
+
+ public void setCurrentLanguage(final I18nLanguageDTO currentLanguage) {
+ this.currentLanguage = currentLanguage;
+ }
+
+ public void setCurrentState(final StateDTO currentState) {
+ this.currentState = currentState;
+ }
+
+ public void setCurrentUserInfo(final UserInfoDTO currentUserInfo) {
+ this.currentUserInfo = currentUserInfo;
+ if (currentUserInfo != null) {
+ onUserSignIn.fire(currentUserInfo);
+ } else {
+ onUserSignOut.fire();
+ }
+ }
+
+ public void setInitData(final InitDataDTO initData) {
+ this.initData = initData;
+ onInitDataReceived.fire(initData);
+ }
+
+ public void setUserHash(final String userHash) {
+ this.userHash = userHash;
+ }
+
+ private Object[][] mapCountries() {
+ final Object[][] objs = new Object[initData.getCountries().size()][1];
+ int i = 0;
+ for (final Iterator<I18nCountryDTO> iterator = initData.getCountries().iterator(); iterator.hasNext();) {
+ final I18nCountryDTO country = iterator.next();
+ final Object[] obj = new Object[] { country.getCode(), country.getEnglishName() };
+ objs[i++] = obj;
+ }
+ return objs;
+ }
+
+ private Object[][] mapLangs() {
+ final Object[][] objs = new Object[initData.getLanguages().size()][1];
+ int i = 0;
+ for (final Iterator<I18nLanguageSimpleDTO> iterator = initData.getLanguages().iterator(); iterator.hasNext();) {
+ final I18nLanguageSimpleDTO language = iterator.next();
+ final Object[] obj = new Object[] { language.getCode(), language.getEnglishName() };
+ objs[i++] = obj;
+ }
+ return objs;
+ }
+
+ private void mapTimezones() {
+ timezonesArray = new Object[initData.getTimezones().length][1];
+ for (int i = 0; i < getTimezones().length; i++) {
+ final Object[] obj = new Object[] { initData.getTimezones()[i] };
+ timezonesArray[i] = obj;
+ }
+ }
+
+}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -1,196 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-package org.ourproject.kune.platf.client.state;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.ourproject.kune.platf.client.dto.I18nCountryDTO;
-import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.I18nLanguageSimpleDTO;
-import org.ourproject.kune.platf.client.dto.InitDataDTO;
-import org.ourproject.kune.platf.client.dto.LicenseDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
-import org.ourproject.kune.platf.client.dto.UserInfoDTO;
-import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
-import org.ourproject.kune.workspace.client.sitebar.rpc.UserServiceAsync;
-
-import com.allen_sauer.gwt.log.client.Log;
-import com.calclab.suco.client.container.Provider;
-import com.calclab.suco.client.signal.Signal;
-import com.calclab.suco.client.signal.Signal0;
-import com.calclab.suco.client.signal.Slot;
-import com.calclab.suco.client.signal.Slot0;
-
-public class SessionImpl implements Session {
- private String userHash;
- private InitDataDTO initData;
- private UserInfoDTO currentUserInfo;
- private Object[][] languagesArray;
- private Object[][] countriesArray;
- private Object[][] timezonesArray;
- private StateDTO currentState;
- private I18nLanguageDTO currentLanguage;
- private final Signal<InitDataDTO> onInitDataReceived;
- private final Signal<UserInfoDTO> onUserSignIn;
- private final Signal0 onUserSignOut;
- private final Provider<UserServiceAsync> userServiceProvider;
-
- public SessionImpl(final String userHash, final Provider<UserServiceAsync> userServiceProvider) {
- this.userHash = userHash;
- this.userServiceProvider = userServiceProvider;
- languagesArray = null;
- this.onInitDataReceived = new Signal<InitDataDTO>("initDataReceived");
- this.onUserSignIn = new Signal<UserInfoDTO>("onUserSignIn");
- this.onUserSignOut = new Signal0("onUserSignOut");
- }
-
- public void check(final AsyncCallbackSimple<?> callback) {
- Log.debug("Checking session (userhash: " + getUserHash() + ")");
- userServiceProvider.get().onlyCheckSession(getUserHash(), callback);
- }
-
- public List<I18nCountryDTO> getCountries() {
- return initData.getCountries();
- }
-
- public Object[][] getCountriesArray() {
- if (countriesArray == null) {
- countriesArray = mapCountries();
- }
- return countriesArray;
- }
-
- public I18nLanguageDTO getCurrentLanguage() {
- return currentLanguage;
- }
-
- public StateDTO getCurrentState() {
- return currentState;
- }
-
- public UserInfoDTO getCurrentUserInfo() {
- return currentUserInfo;
- }
-
- public List<I18nLanguageSimpleDTO> getLanguages() {
- return initData.getLanguages();
- }
-
- public Object[][] getLanguagesArray() {
- if (languagesArray == null) {
- languagesArray = mapLangs();
- }
- return languagesArray;
- }
-
- public List<LicenseDTO> getLicenses() {
- return initData.getLicenses();
- }
-
- public Object[][] getTimezones() {
- if (timezonesArray == null) {
- mapTimezones();
- }
- return timezonesArray;
- }
-
- public String getUserHash() {
- return userHash;
- }
-
- public boolean isLogged() {
- return userHash != null;
- }
-
- public void onInitDataReceived(final Slot<InitDataDTO> slot) {
- onInitDataReceived.add(slot);
- }
-
- public void onUserSignIn(final Slot<UserInfoDTO> slot) {
- onUserSignIn.add(slot);
- }
-
- public void onUserSignOut(final Slot0 slot) {
- onUserSignOut.add(slot);
- }
-
- public void setCurrent(final StateDTO currentState) {
- this.currentState = currentState;
- }
-
- public void setCurrentLanguage(final I18nLanguageDTO currentLanguage) {
- this.currentLanguage = currentLanguage;
- }
-
- public void setCurrentState(final StateDTO currentState) {
- this.currentState = currentState;
- }
-
- public void setCurrentUserInfo(final UserInfoDTO currentUserInfo) {
- this.currentUserInfo = currentUserInfo;
- if (currentUserInfo != null) {
- onUserSignIn.fire(currentUserInfo);
- } else {
- onUserSignOut.fire();
- }
- }
-
- public void setInitData(final InitDataDTO initData) {
- this.initData = initData;
- onInitDataReceived.fire(initData);
- }
-
- public void setUserHash(final String userHash) {
- this.userHash = userHash;
- }
-
- private Object[][] mapCountries() {
- final Object[][] objs = new Object[initData.getCountries().size()][1];
- int i = 0;
- for (final Iterator<I18nCountryDTO> iterator = initData.getCountries().iterator(); iterator.hasNext();) {
- final I18nCountryDTO country = iterator.next();
- final Object[] obj = new Object[] { country.getCode(), country.getEnglishName() };
- objs[i++] = obj;
- }
- return objs;
- }
-
- private Object[][] mapLangs() {
- final Object[][] objs = new Object[initData.getLanguages().size()][1];
- int i = 0;
- for (final Iterator<I18nLanguageSimpleDTO> iterator = initData.getLanguages().iterator(); iterator.hasNext();) {
- final I18nLanguageSimpleDTO language = iterator.next();
- final Object[] obj = new Object[] { language.getCode(), language.getEnglishName() };
- objs[i++] = obj;
- }
- return objs;
- }
-
- private void mapTimezones() {
- timezonesArray = new Object[initData.getTimezones().length][1];
- for (int i = 0; i < getTimezones().length; i++) {
- final Object[] obj = new Object[] { initData.getTimezones()[i] };
- timezonesArray[i] = obj;
- }
- }
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -68,9 +68,8 @@
if (panel.isRendered()) {
panel.syncSize();
panel.doLayout();
- doLayoutIfNeeded();
}
- // doLayoutIfNeeded();
+ doLayoutIfNeeded();
}
public void addStyle(final String style) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -23,6 +23,8 @@
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.ourproject.kune.platf.client.errors.SessionExpiredException;
import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
import org.ourproject.kune.platf.server.UserSession;
@@ -32,6 +34,8 @@
public class AuthenticatedMethodInterceptor implements MethodInterceptor {
+ public static final Log log = LogFactory.getLog(AuthenticatedMethodInterceptor.class);
+
@Inject
Provider<UserSession> userSessionProvider;
@@ -42,33 +46,40 @@
Provider<SessionService> sessionServiceProvider;
public Object invoke(final MethodInvocation invocation) throws Throwable {
- Object[] arguments = invocation.getArguments();
- String userHash = (String) arguments[0];
+ final Object[] arguments = invocation.getArguments();
+ // Some browsers getCookie returns "null" as String instead of null
+ final String userHash = arguments[0] == null || arguments[0].equals("null") ? null : (String) arguments[0];
- UserSession userSession = userSessionProvider.get();
- SessionService sessionService = sessionServiceProvider.get();
+ log.info("Method: " + invocation.getMethod().getName());
+ log.info("Userhash received: " + userHash);
+ log.info("--------------------------------------------------------------------------------");
+ final UserSession userSession = userSessionProvider.get();
+ final SessionService sessionService = sessionServiceProvider.get();
- Authenticated authAnnotation = invocation.getStaticPart().getAnnotation(Authenticated.class);
- boolean mandatory = authAnnotation.mandatory();
+ final Authenticated authAnnotation = invocation.getStaticPart().getAnnotation(Authenticated.class);
+ final boolean mandatory = authAnnotation.mandatory();
- if (userHash == null && mandatory) {
- sessionService.getNewSession();
- throw new UserMustBeLoggedException();
- } else if (userSession.isUserNotLoggedIn() && mandatory) {
- sessionService.getNewSession();
- throw new SessionExpiredException();
- } else if (userSession.isUserNotLoggedIn() && userHash == null) {
- // Ok, do nothing
- } else if (userSession.isUserNotLoggedIn() && userHash != null) {
- sessionService.getNewSession();
- throw new SessionExpiredException();
- } else if (!userSession.getHash().equals(userHash)) {
- userSession.logout();
- sessionService.getNewSession();
- throw new SessionExpiredException();
- }
- Object result = invocation.proceed();
- return result;
+ if (userHash == null && mandatory) {
+ sessionService.getNewSession();
+ throw new UserMustBeLoggedException();
+ } else if (userSession.isUserNotLoggedIn() && mandatory) {
+ sessionService.getNewSession();
+ log.info("Session expired (not logged in server and mandatory)");
+ throw new SessionExpiredException();
+ } else if (userSession.isUserNotLoggedIn() && userHash == null) {
+ // Ok, do nothing
+ } else if (userSession.isUserNotLoggedIn() && userHash != null) {
+ sessionService.getNewSession();
+ log.info("Session expired (not logged in server)");
+ throw new SessionExpiredException();
+ } else if (!userSession.getHash().equals(userHash)) {
+ userSession.logout();
+ sessionService.getNewSession();
+ log.info("Session expired (userHash different in server)");
+ throw new SessionExpiredException();
+ }
+ final Object result = invocation.proceed();
+ return result;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -63,7 +63,7 @@
private void execute(final Filter filter, final ServletRequest request, final ServletResponse response)
throws IOException, ServletException {
- log.debug("RACK FILTER: " + filter.getClass().getSimpleName());
+ // log.debug("RACK FILTER: " + filter.getClass().getSimpleName());
filter.doFilter(request, response, this);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -39,12 +39,12 @@
}
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
- throws IOException, ServletException {
- long start = System.currentTimeMillis();
- log.debug("REQUEST: " + RackHelper.getURI(request));
- chain.doFilter(request, response);
- long finish = System.currentTimeMillis();
- log.debug("TOTAL TIME: " + (finish - start) + " miliseconds");
+ throws IOException, ServletException {
+ // final long start = System.currentTimeMillis();
+ log.debug("REQUEST: " + RackHelper.getURI(request));
+ chain.doFilter(request, response);
+ // final long finish = System.currentTimeMillis();
+ // log.debug("TOTAL TIME: " + (finish - start) + " miliseconds");
}
public void init(final FilterConfig filterConfig) throws ServletException {
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -43,22 +43,23 @@
private final DelegatedRemoteServlet servlet;
public GWTServiceFilter(final Class<? extends RemoteService> serviceClass) {
- this.serviceClass = serviceClass;
- this.servlet = new DelegatedRemoteServlet();
+ this.serviceClass = serviceClass;
+ this.servlet = new DelegatedRemoteServlet();
}
+ public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
+ throws IOException, ServletException {
+ log.info("--------------------------------------------------------------------------------");
+ log.debug("SERVICE: " + RackHelper.getURI(request) + " - " + serviceClass.getSimpleName());
+ final RemoteService service = getInstance(serviceClass);
+ servlet.setService(service);
+ servlet.doPost((HttpServletRequest) request, (HttpServletResponse) response);
+ }
+
@Override
public void init(final FilterConfig filterConfig) throws ServletException {
- super.init(filterConfig);
- servlet.setServletContext(filterConfig.getServletContext());
+ super.init(filterConfig);
+ servlet.setServletContext(filterConfig.getServletContext());
}
- public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
- throws IOException, ServletException {
- log.debug("SERVICE: " + RackHelper.getURI(request) + " - " + serviceClass.getSimpleName());
- RemoteService service = getInstance(serviceClass);
- servlet.setService(service);
- servlet.doPost((HttpServletRequest) request, (HttpServletResponse) response);
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -36,6 +36,9 @@
public void addInTools(final Widget widget) {
entityTools.add(widget);
+ if (entityTools.isRendered()) {
+ entityTools.doLayout(false);
+ }
mainPanel.doLayoutIfNeeded();
}
1
0