[kune-commits] r1493 - in trunk/src: main/java/cc/kune/chat/client/actions main/java/cc/kune/common/client/ui/dialogs main/java/cc/kune/core/server main/java/cc/kune/core/server/auth main/java/cc/kune/core/server/content main/java/cc/kune/core/server/rpc main/java/cc/kune/core/shared/dto main/java/cc/kune/domain main/java/cc/kune/gspace/client/actions main/java/cc/kune/lists/client main/java/cc/kune/lists/client/actions main/java/cc/kune/lists/client/rpc main/java/cc/kune/lists/server main/java/cc/kune/lists/server/rpc main/java/cc/kune/meets/shared main/java/cc/kune/wave/server test/java/cc/kune/core/server/integration test/java/cc/kune/core/server/integration/content test/java/cc/kune/core/server/integration/socialnet test/java/cc/kune/lists/server test/java/cc/kune/wave/server
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Sat Aug 13 17:59:11 CEST 2011
Author: vjrj_
Date: 2011-08-13 17:59:10 +0200 (Sat, 13 Aug 2011)
New Revision: 1493
Added:
trunk/src/main/java/cc/kune/gspace/client/actions/RefreshCurrentStateAction.java
trunk/src/main/java/cc/kune/lists/client/actions/NewListAction.java
trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java
trunk/src/main/java/cc/kune/lists/client/actions/NewListPostIconBtn.java
trunk/src/main/java/cc/kune/lists/client/actions/NewListPostIconMenuItem.java
trunk/src/main/java/cc/kune/lists/client/actions/OptionsListMenu.java
trunk/src/main/java/cc/kune/lists/client/actions/RefreshListMenuItem.java
trunk/src/main/java/cc/kune/lists/client/actions/SetListOpenessAction.java
trunk/src/main/java/cc/kune/lists/client/actions/SetListOpenessMenuItem.java
trunk/src/main/java/cc/kune/lists/client/actions/SubscriteToListAction.java
trunk/src/main/java/cc/kune/lists/client/rpc/
trunk/src/main/java/cc/kune/lists/client/rpc/ListsService.java
trunk/src/main/java/cc/kune/lists/client/rpc/ListsServiceAsync.java
trunk/src/main/java/cc/kune/lists/server/rpc/
trunk/src/main/java/cc/kune/lists/server/rpc/ListsRPC.java
trunk/src/main/java/cc/kune/wave/server/KuneWaveUtils.java
trunk/src/test/java/cc/kune/lists/server/ListsServiceTest.java
Removed:
trunk/src/main/java/cc/kune/lists/client/actions/NewWaveIconBtn.java
trunk/src/main/java/cc/kune/lists/client/actions/NewWaveMenuItem.java
Modified:
trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/PromptTopDialog.java
trunk/src/main/java/cc/kune/core/server/KuneRackModule.java
trunk/src/main/java/cc/kune/core/server/PlatformServerModule.java
trunk/src/main/java/cc/kune/core/server/auth/Authorizated.java
trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
trunk/src/main/java/cc/kune/core/shared/dto/GroupDTO.java
trunk/src/main/java/cc/kune/core/shared/dto/GroupListDTO.java
trunk/src/main/java/cc/kune/domain/GroupList.java
trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java
trunk/src/main/java/cc/kune/lists/client/ListsGinModule.java
trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java
trunk/src/main/java/cc/kune/lists/client/actions/NewListBtn.java
trunk/src/main/java/cc/kune/lists/client/actions/NewListMenuItem.java
trunk/src/main/java/cc/kune/lists/client/actions/SubscribeToListBtn.java
trunk/src/main/java/cc/kune/lists/server/ListsServerTool.java
trunk/src/main/java/cc/kune/meets/shared/MeetingsConstants.java
trunk/src/main/java/cc/kune/wave/server/KuneAgent.java
trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java
trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java
trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java
trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java
trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceGetTest.java
trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkMembersTest.java
trunk/src/test/java/cc/kune/lists/server/ListsServerToolTest.java
trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java
Log:
NEW - # 93: List tool
http://kune.ourproject.org/issues/ticket/93
Modified: trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -42,7 +42,6 @@
import com.google.inject.Provider;
public class NewRoomBtn extends ButtonDescriptor {
-
public static class NewRoomAction extends RolAction {
private static final String CANCEL_ID = "k-nrbt-cancel";
@@ -91,7 +90,8 @@
final String groupShortName = session.getCurrentState().getGroup().getShortName();
contentService.get().addRoom(session.getUserHash(),
session.getContainerState().getRootContainer().getStateToken(),
- groupShortName + "-" + diag.getText(), new AsyncCallbackSimple<StateContainerDTO>() {
+ groupShortName + "-" + diag.getTextFieldValue(),
+ new AsyncCallbackSimple<StateContainerDTO>() {
@Override
public void onSuccess(final StateContainerDTO state) {
stateManager.setRetrievedStateAndGo(state);
Modified: trunk/src/main/java/cc/kune/common/client/ui/dialogs/PromptTopDialog.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/PromptTopDialog.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/PromptTopDialog.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -25,14 +25,15 @@
public static class Builder extends BasicTopDialog.Builder {
- private boolean allowBlank;
- private int maxLength;
+ private boolean allowBlank = false;
+ private int maxLength = 0;
private String maxLengthText;
- private int minLength;
+ private int minLength = 0;
private String minLengthText;
private String regex;
private String regexText;
private String textboxId;
+ private int width = 0;
public Builder(final String dialogId, final String promptText, final boolean autohide,
final boolean modal) {
@@ -85,6 +86,12 @@
this.textboxId = textboxId;
return this;
}
+
+ @Override
+ public Builder width(final int width) {
+ this.width = width;
+ return this;
+ }
}
private final TextField<String> textField;
@@ -97,8 +104,15 @@
textField.getMessages().setMinLengthText(builder.minLengthText);
textField.getMessages().setMaxLengthText(builder.maxLengthText);
textField.setId(builder.textboxId);
- textField.setMinLength(builder.minLength);
- textField.setMaxLength(builder.maxLength);
+ if (builder.width != 0) {
+ textField.setWidth(builder.width);
+ }
+ if (builder.minLength != 0) {
+ textField.setMinLength(builder.minLength);
+ }
+ if (builder.maxLength != 0) {
+ textField.setMaxLength(builder.maxLength);
+ }
textField.setAllowBlank(builder.allowBlank);
super.getInnerPanel().add(textField);
}
@@ -107,7 +121,7 @@
textField.focus();
}
- public String getText() {
+ public String getTextFieldValue() {
return textField.getValue();
}
@@ -115,7 +129,7 @@
return textField.isValid();
}
- public void setText(final String text) {
+ public void setTextFieldValue(final String text) {
textField.setValue(text);
}
Modified: trunk/src/main/java/cc/kune/core/server/KuneRackModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/KuneRackModule.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/core/server/KuneRackModule.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -55,6 +55,7 @@
import cc.kune.core.server.rest.TestJSONService;
import cc.kune.core.server.rest.UserJSONService;
import cc.kune.docs.server.DocumentServerModule;
+import cc.kune.lists.client.rpc.ListsService;
import cc.kune.lists.server.ListsServerModule;
import cc.kune.meets.server.MeetingServerModule;
import cc.kune.tasks.server.TaskServerModule;
@@ -140,7 +141,7 @@
new ForwardFilter("/ws/ws.html"));
builder.installGWTServices("^/ws/", SiteService.class, GroupService.class, ContentService.class,
- UserService.class, SocialNetworkService.class, I18nService.class);
+ UserService.class, SocialNetworkService.class, I18nService.class, ListsService.class);
builder.installRESTServices("^/ws/json/", TestJSONService.class, GroupJSONService.class,
UserJSONService.class, I18nTranslationJSONService.class, ContentJSONService.class);
builder.installServlet("^/ws/servlets/", FileUploadManager.class, FileDownloadManager.class,
Modified: trunk/src/main/java/cc/kune/core/server/PlatformServerModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/PlatformServerModule.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/core/server/PlatformServerModule.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -97,6 +97,8 @@
import cc.kune.core.server.xmpp.XmppManagerDefault;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.domain.SocialNetwork;
+import cc.kune.lists.client.rpc.ListsService;
+import cc.kune.lists.server.rpc.ListsRPC;
import cc.kune.wave.server.KuneWaveManager;
import cc.kune.wave.server.KuneWaveManagerDefault;
import cc.kune.wave.server.ParticipantUtils;
@@ -141,6 +143,7 @@
bind(UserService.class).to(UserRPC.class);
bind(SocialNetworkService.class).to(SocialNetworkRPC.class);
bind(I18nService.class).to(I18nRPC.class);
+ bind(ListsService.class).to(ListsRPC.class);
}
private void bindServices() {
Modified: trunk/src/main/java/cc/kune/core/server/auth/Authorizated.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/auth/Authorizated.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/core/server/auth/Authorizated.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -28,26 +28,27 @@
/**
* Use in RPC methods, for instance: <code>
- * Authorizated(authLevelRequired = AuthLevelRequired.COLLAB, checkContent = true) </code>
+ * Authorizated({@link #accessRolRequired} = {@link AccessRol#Administrator}, {@link #mustCheckMembership} = true) </code>
*
- * The first parameter in the method must be the userHash, the second the group
- * shortName, and if you want to check also the content access, the 3rd
- * parameter must be a content id (string)
+ * The first parameter in the method must be the userHash and if you want to
+ * check also the second parameter should be the token of the Content (use
+ * {@link ActionLevel#content}) or Container ({@link ActionLevel#container})
+ * etc.
*
*/
@BindingAnnotation
@Retention(RetentionPolicy.RUNTIME)
public @interface Authorizated {
- AccessRol accessRolRequired() default AccessRol.Viewer;
+ AccessRol accessRolRequired() default AccessRol.Viewer;
- /**
- * If the action is over a "group", "tool", "container" or over the content.
- *
- * @return
- */
- ActionLevel actionLevel() default ActionLevel.content;
+ /**
+ * If the action is over a "group", "tool", "container" or over the content.
+ *
+ * @return
+ */
+ ActionLevel actionLevel() default ActionLevel.content;
- boolean mustCheckMembership() default true;
+ boolean mustCheckMembership() default true;
}
Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -29,7 +29,6 @@
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.search.Query;
-import org.waveprotocol.wave.model.waveref.InvalidWaveRefException;
import org.waveprotocol.wave.model.waveref.WaveRef;
import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder;
@@ -58,6 +57,7 @@
import cc.kune.domain.finders.I18nLanguageFinder;
import cc.kune.domain.finders.UserFinder;
import cc.kune.wave.server.KuneWaveManager;
+import cc.kune.wave.server.KuneWaveUtils;
import cc.kune.wave.server.ParticipantUtils;
import com.google.inject.Inject;
@@ -107,8 +107,8 @@
public void addParticipant(final User user, final Long contentId, final String participant) {
final Content content = finder.getContent(contentId);
if (content.isWave()) {
- kuneWaveManager.addParticipant(getWaveRef(content), content.getAuthors().get(0).getShortName(),
- user.getShortName(), participant);
+ kuneWaveManager.addParticipants(KuneWaveUtils.getWaveRef(content),
+ content.getAuthors().get(0).getShortName(), user.getShortName(), participant);
}
}
@@ -183,14 +183,6 @@
}
}
- private WaveRef getWaveRef(final Content content) {
- try {
- return JavaWaverefEncoder.decodeWaveRefFromPath(String.valueOf(content.getWaveId()));
- } catch (final InvalidWaveRefException e) {
- throw new DefaultException("Error getting the wave");
- }
- }
-
@Override
public Content moveContent(final Content content, final Container newContainer) {
if (newContainer.equals(content.getContainer())) {
@@ -248,7 +240,7 @@
content.getLastRevision().setTitle(newTitleWithoutNL);
if (content.isWave()) {
final String author = content.getAuthors().get(0).getShortName();
- kuneWaveManager.setTitle(getWaveRef(content), newTitle, author);
+ kuneWaveManager.setTitle(KuneWaveUtils.getWaveRef(content), newTitle, author);
}
setModifiedTime(content);
return content;
Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -249,12 +249,20 @@
return getUserSession().getUser();
}
- private StateContainerDTO getState(final User user, final Container container) {
+ public StateContainerDTO getState(final Container container) {
+ return getState(getCurrentUser(), container);
+ }
+
+ public StateContentDTO getState(final Content content) {
+ return getState(getCurrentUser(), content);
+ }
+
+ public StateContainerDTO getState(final User user, final Container container) {
final StateContainer state = stateService.create(user, container);
return mapState(state, user);
}
- private StateContentDTO getState(final User user, final Content content) {
+ public StateContentDTO getState(final User user, final Content content) {
final StateContent state = stateService.create(user, content);
return mapState(state, user);
}
Modified: trunk/src/main/java/cc/kune/core/shared/dto/GroupDTO.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/dto/GroupDTO.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/core/shared/dto/GroupDTO.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -121,11 +121,12 @@
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + (defaultLicense == null ? 0 : defaultLicense.hashCode());
- result = prime * result + (id == null ? 0 : id.hashCode());
- result = prime * result + (longName == null ? 0 : longName.hashCode());
+ // result = prime * result + (defaultLicense == null ? 0 :
+ // defaultLicense.hashCode());
+ // result = prime * result + (id == null ? 0 : id.hashCode());
+ // result = prime * result + (longName == null ? 0 : longName.hashCode());
result = prime * result + (shortName == null ? 0 : shortName.hashCode());
- result = prime * result + (groupType == null ? 0 : groupType.hashCode());
+ // result = prime * result + (groupType == null ? 0 : groupType.hashCode());
return result;
}
Modified: trunk/src/main/java/cc/kune/core/shared/dto/GroupListDTO.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/dto/GroupListDTO.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/core/shared/dto/GroupListDTO.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -38,6 +38,17 @@
this.list = list;
}
+ public boolean checkIfIncludes(final GroupDTO group, final String mode) {
+ if (mode.equals(NOBODY)) {
+ return false;
+ }
+ if (mode.equals(EVERYONE)) {
+ return true;
+ }
+ boolean contains = list.contains(group);
+ return contains;
+ }
+
public Set<GroupDTO> getList() {
return list;
}
@@ -46,6 +57,10 @@
return mode;
}
+ public boolean includes(final GroupDTO group) {
+ return checkIfIncludes(group, mode);
+ }
+
public void setList(final Set<GroupDTO> list) {
this.list = list;
}
Modified: trunk/src/main/java/cc/kune/domain/GroupList.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/GroupList.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/domain/GroupList.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -68,12 +68,8 @@
}
public void add(final Group group) {
- // No group duplicate
+ list.add(group);
// TODO: Get this outside Domain?
- if (!list.contains(group)) {
- list.add(group);
- }
- // TODO: Get this outside Domain?
if (getMode() == GroupListMode.NOBODY) {
setMode(GroupListMode.NORMAL);
}
@@ -90,6 +86,10 @@
}
}
+ public void clear() {
+ list.clear();
+ }
+
public ArrayList<Group> duplicate() {
return new ArrayList<Group>(list);
}
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -19,36 +19,18 @@
*/
package cc.kune.gspace.client.actions;
-import cc.kune.common.client.actions.AbstractExtendedAction;
-import cc.kune.common.client.actions.ActionEvent;
import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
import cc.kune.core.client.resources.nav.NavResources;
-import cc.kune.core.client.state.StateManager;
import cc.kune.core.shared.i18n.I18nTranslationService;
import com.google.inject.Inject;
public class RefreshContentMenuItem extends MenuItemDescriptor {
- public static class GoParentContainerAction extends AbstractExtendedAction {
-
- private final StateManager stateManager;
-
- @Inject
- public GoParentContainerAction(final StateManager stateManager) {
- this.stateManager = stateManager;
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- stateManager.refreshCurrentStateWithoutCache();
- }
-
- }
-
@Inject
- public RefreshContentMenuItem(final I18nTranslationService i18n, final GoParentContainerAction action,
- final ContentViewerOptionsMenu optionsMenu, final NavResources res) {
+ public RefreshContentMenuItem(final I18nTranslationService i18n,
+ final RefreshCurrentStateAction action, final ContentViewerOptionsMenu optionsMenu,
+ final NavResources res) {
super(action);
this.withText(i18n.t("Reload current page")).withIcon(res.refresh()).withParent(optionsMenu, false);
}
Added: trunk/src/main/java/cc/kune/gspace/client/actions/RefreshCurrentStateAction.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/RefreshCurrentStateAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/RefreshCurrentStateAction.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -0,0 +1,23 @@
+package cc.kune.gspace.client.actions;
+
+import cc.kune.common.client.actions.AbstractExtendedAction;
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.core.client.state.StateManager;
+
+import com.google.inject.Inject;
+
+public class RefreshCurrentStateAction extends AbstractExtendedAction {
+
+ private final StateManager stateManager;
+
+ @Inject
+ public RefreshCurrentStateAction(final StateManager stateManager) {
+ this.stateManager = stateManager;
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ stateManager.refreshCurrentStateWithoutCache();
+ }
+
+}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/lists/client/ListsGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/ListsGinModule.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/lists/client/ListsGinModule.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -22,11 +22,13 @@
import cc.kune.common.client.ExtendedGinModule;
import cc.kune.lists.client.actions.ListsClientActions;
import cc.kune.lists.client.actions.ListsNewMenu;
+import cc.kune.lists.client.actions.OptionsListMenu;
public class ListsGinModule extends ExtendedGinModule {
@Override
protected void configure() {
+ s(OptionsListMenu.class);
s(ListsNewMenu.class);
s(ListsClientTool.class);
s(ListsClientActions.class);
Modified: trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -20,8 +20,8 @@
package cc.kune.lists.client.actions;
import static cc.kune.lists.shared.ListsConstants.TYPE_LIST;
+import static cc.kune.lists.shared.ListsConstants.TYPE_POST;
import static cc.kune.lists.shared.ListsConstants.TYPE_ROOT;
-import static cc.kune.lists.shared.ListsConstants.TYPE_POST;
import cc.kune.chat.client.actions.ChatAboutContentBtn;
import cc.kune.core.client.actions.ActionRegistryByType;
import cc.kune.core.client.i18n.I18nUITranslationService;
@@ -31,9 +31,7 @@
import cc.kune.core.client.state.StateManager;
import cc.kune.gspace.client.actions.AbstractFoldableToolActions;
import cc.kune.gspace.client.actions.ActionGroups;
-import cc.kune.gspace.client.actions.ContentViewerOptionsMenu;
import cc.kune.gspace.client.actions.ParticipateInContentBtn;
-import cc.kune.gspace.client.actions.RefreshContentMenuItem;
import cc.kune.gspace.client.actions.SetAsHomePageMenuItem;
import com.google.inject.Inject;
@@ -50,11 +48,13 @@
@Inject
public ListsClientActions(final I18nUITranslationService i18n, final Session session,
final StateManager stateManager, final ActionRegistryByType registry, final CoreResources res,
- final Provider<GoParentFolderBtn> folderGoUp, final Provider<NewWaveMenuItem> newWaveItem,
- final Provider<NewWaveIconBtn> newWaveIconBtn, final Provider<NewListMenuItem> newListMenuItem,
- final Provider<NewListBtn> newListBtn, final Provider<OpenFolderMenuItem> openContentMenuItem,
- final Provider<RefreshContentMenuItem> refresh, final Provider<SubscribeToListBtn> subscribeBtn,
- final Provider<ContentViewerOptionsMenu> optionsMenuContent,
+ final Provider<GoParentFolderBtn> folderGoUp, final Provider<NewListPostIconMenuItem> newPostItem,
+ final Provider<NewListPostIconBtn> newPostIconBtn,
+ final Provider<NewListMenuItem> newListMenuItem, final Provider<NewListBtn> newListBtn,
+ final Provider<OpenFolderMenuItem> openContentMenuItem,
+ final Provider<RefreshListMenuItem> refresh, final Provider<SubscribeToListBtn> subscribeBtn,
+ final Provider<OptionsListMenu> optionsMenuContent,
+ final Provider<SetListOpenessMenuItem> listOpenessMenuItem,
final Provider<ParticipateInContentBtn> participateBtn, final ListsNewMenu listNewMenu,
final NewMenusForTypeIdsRegistry newMenusRegistry, final Provider<ChatAboutContentBtn> chatAbout,
final Provider<DelListMenuItem> delFolderMenuItem,
@@ -64,8 +64,9 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, listNewMenu, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all);
actionsRegistry.addAction(ActionGroups.TOOLBAR, subscribeBtn, containersNoRoot);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, newWaveItem, containersNoRoot);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, newWaveIconBtn, noRoot);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, listOpenessMenuItem, containersNoRoot);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, newPostItem, containersNoRoot);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, newPostIconBtn, noRoot);
actionsRegistry.addAction(ActionGroups.TOOLBAR, newListMenuItem, TYPE_ROOT);
actionsRegistry.addAction(ActionGroups.TOOLBAR, newListBtn, TYPE_ROOT);
actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, contents);
Added: trunk/src/main/java/cc/kune/lists/client/actions/NewListAction.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/NewListAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/lists/client/actions/NewListAction.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -0,0 +1,90 @@
+package cc.kune.lists.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.client.ui.dialogs.PromptTopDialog;
+import cc.kune.common.client.ui.dialogs.PromptTopDialog.Builder;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
+import cc.kune.core.client.state.ContentCache;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.viewers.FolderViewerPresenter;
+import cc.kune.lists.client.rpc.ListsServiceAsync;
+import cc.kune.lists.shared.ListsConstants;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+
+ at Singleton
+public class NewListAction extends RolAction {
+ private static final String CANCEL_ID = "k-nla-cancel";
+ private static final String CREATE_ID = "k-nla-create";
+ private static final String ID = "k-nla-dialog";
+ private static final String TEXTBOX_ID = "k-nla-textbox";
+
+ private final ContentCache cache;
+ private final FolderViewerPresenter folderViewer;
+ private final I18nTranslationService i18n;
+ private final Provider<ListsServiceAsync> listsService;
+ private final Session session;
+ private final StateManager stateManager;
+
+ @Inject
+ public NewListAction(final Session session, final StateManager stateManager,
+ final I18nTranslationService i18n, final Provider<ListsServiceAsync> listsService,
+ final ContentCache cache, final FolderViewerPresenter folderViewer) {
+ super(AccessRolDTO.Administrator, true);
+ this.session = session;
+ this.stateManager = stateManager;
+ this.i18n = i18n;
+ this.listsService = listsService;
+ this.cache = cache;
+ this.folderViewer = folderViewer;
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ final Builder builder = new PromptTopDialog.Builder(ID, "Name of the new list?", false, true);
+ builder.width("300px").height("50px").firstButtonTitle(i18n.t("Create")).sndButtonTitle(
+ i18n.t("Cancel")).firstButtonId(CREATE_ID).sndButtonId(CANCEL_ID).width(270);
+ builder.textboxId(TEXTBOX_ID);
+ final PromptTopDialog diag = builder.build();
+ diag.showCentered();
+ diag.focusOnTextBox();
+ diag.getSecondBtn().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ diag.hide();
+ }
+ });
+ diag.getFirstBtn().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ NotifyUser.showProgressProcessing();
+ diag.hide();
+ listsService.get().createList(session.getUserHash(), session.getCurrentStateToken(),
+ diag.getTextFieldValue(), ListsConstants.TYPE_LIST, true,
+ new AsyncCallbackSimple<StateContainerDTO>() {
+ @Override
+ public void onSuccess(final StateContainerDTO state) {
+ stateManager.setRetrievedStateAndGo(state);
+ NotifyUser.hideProgress();
+
+ NotifyUser.info(i18n.t("List created"));
+ folderViewer.highlightTitle();
+ }
+ });
+ cache.removeContent(session.getCurrentStateToken());
+ }
+ });
+
+ }
+
+}
Modified: trunk/src/main/java/cc/kune/lists/client/actions/NewListBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/NewListBtn.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/lists/client/actions/NewListBtn.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -19,20 +19,19 @@
*/
package cc.kune.lists.client.actions;
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
import cc.kune.core.client.resources.nav.NavResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.gspace.client.actions.NewContainerBtn;
-import cc.kune.lists.shared.ListsConstants;
import com.google.inject.Inject;
-public class NewListBtn extends NewContainerBtn {
+public class NewListBtn extends ButtonDescriptor {
@Inject
- public NewListBtn(final I18nTranslationService i18n, final NewContainerAction action,
- final NavResources res) {
- super(i18n, action, res.listadd(), i18n.t("New list"), i18n.t("Create a new list"),
- i18n.t("New list"), ListsConstants.TYPE_LIST);
+ public NewListBtn(final I18nTranslationService i18n, final NewListAction action, final NavResources res) {
+ super(action);
+ withText(i18n.t("New list")).withToolTip(i18n.t("Create a new list")).withIcon(res.listadd()).withStyles(
+ "k-def-docbtn, k-fl");
}
}
Modified: trunk/src/main/java/cc/kune/lists/client/actions/NewListMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/NewListMenuItem.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/lists/client/actions/NewListMenuItem.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -19,20 +19,22 @@
*/
package cc.kune.lists.client.actions;
+import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
import cc.kune.core.client.resources.nav.NavResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.gspace.client.actions.NewContainerMenuItem;
-import cc.kune.lists.shared.ListsConstants;
import com.google.inject.Inject;
-public class NewListMenuItem extends NewContainerMenuItem {
+public class NewListMenuItem extends MenuItemDescriptor {
@Inject
- public NewListMenuItem(final I18nTranslationService i18n, final NewContainerAction action,
+ public NewListMenuItem(final I18nTranslationService i18n, final NewListAction action,
final NavResources res, final ListsNewMenu newMenu) {
- super(i18n, action, res.listadd(), i18n.t("New list"), i18n.t("Create a list"), i18n.t("New list"),
- ListsConstants.TYPE_LIST, newMenu.get());
+ super(action);
+ setParent(newMenu.get(), false);
+ withText(i18n.t("New list")).withToolTip(i18n.t("Create a new list")).withIcon(res.listadd()).withStyles(
+ "k-def-docbtn, k-fl");
+
}
}
Added: trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -0,0 +1,100 @@
+package cc.kune.lists.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.notify.NotifyLevel;
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.client.ui.dialogs.PromptTopDialog;
+import cc.kune.common.client.ui.dialogs.PromptTopDialog.Builder;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.client.auth.SignIn;
+import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
+import cc.kune.core.client.state.ContentCache;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.SiteTokens;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.client.state.TokenUtils;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.core.shared.dto.StateContentDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.viewers.FolderViewerPresenter;
+import cc.kune.lists.client.rpc.ListsServiceAsync;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+
+ at Singleton
+public class NewListPostAction extends RolAction {
+ private static final String CANCEL_ID = "k-nlistpa-cancel";
+ private static final String CREATE_ID = "k-nlistpa-create";
+ private static final String ID = "k-nlistpa-dialog";
+ private static final String TEXTBOX_ID = "k-nlistpa-textbox";
+
+ private final ContentCache cache;
+ private final FolderViewerPresenter folderViewer;
+ private final I18nTranslationService i18n;
+ private final Provider<ListsServiceAsync> listsService;
+ private final Session session;
+ private final Provider<SignIn> signIn;
+ private final StateManager stateManager;
+
+ @Inject
+ public NewListPostAction(final Session session, final StateManager stateManager,
+ final I18nTranslationService i18n, final Provider<ListsServiceAsync> listsService,
+ final ContentCache cache, final FolderViewerPresenter folderViewer, final Provider<SignIn> signIn) {
+ super(AccessRolDTO.Viewer, false);
+ this.session = session;
+ this.stateManager = stateManager;
+ this.i18n = i18n;
+ this.listsService = listsService;
+ this.cache = cache;
+ this.folderViewer = folderViewer;
+ this.signIn = signIn;
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ if (session.isLogged()) {
+ final Builder builder = new PromptTopDialog.Builder(ID, "Title of the new post?", false, true);
+ builder.width("300px").height("50px").firstButtonTitle(i18n.t("Post")).sndButtonTitle(
+ i18n.t("Cancel")).firstButtonId(CREATE_ID).sndButtonId(CANCEL_ID).width(270);
+ builder.textboxId(TEXTBOX_ID);
+ final PromptTopDialog diag = builder.build();
+ diag.showCentered();
+ diag.focusOnTextBox();
+ diag.getSecondBtn().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ diag.hide();
+ }
+ });
+ diag.getFirstBtn().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ NotifyUser.showProgressProcessing();
+ diag.hide();
+ listsService.get().newPost(session.getUserHash(),
+ session.getCurrentStateToken().copy().clearDocument(), diag.getTextFieldValue(),
+ new AsyncCallbackSimple<StateContentDTO>() {
+ @Override
+ public void onSuccess(final StateContentDTO state) {
+ stateManager.setRetrievedStateAndGo(state);
+ NotifyUser.hideProgress();
+ NotifyUser.info(i18n.t("Post created. Edit it"));
+ folderViewer.highlightTitle();
+ }
+ });
+ cache.removeContent(session.getCurrentStateToken());
+ }
+ });
+ } else {
+ signIn.get().setErrorMessage(i18n.t("Sign in or create an account to susbscribe to this list"),
+ NotifyLevel.info);
+ stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGNIN,
+ session.getCurrentStateToken().toString()));
+ }
+ }
+
+}
Copied: trunk/src/main/java/cc/kune/lists/client/actions/NewListPostIconBtn.java (from rev 1491, trunk/src/main/java/cc/kune/lists/client/actions/NewWaveIconBtn.java)
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/NewListPostIconBtn.java (rev 0)
+++ trunk/src/main/java/cc/kune/lists/client/actions/NewListPostIconBtn.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -0,0 +1,39 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.lists.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Inject;
+
+public class NewListPostIconBtn extends ButtonDescriptor {
+
+ @Inject
+ public NewListPostIconBtn(final I18nTranslationService i18n, final NewListPostAction action,
+ final NavResources res, final GlobalShortcutRegister shorcutReg) {
+ super(action);
+ this.withText(i18n.t("New post")).withToolTip(i18n.t("Create a new post")).withIcon(res.newemail()).withStyles(
+ "k-def-docbtn, k-fl");
+ }
+
+}
Added: trunk/src/main/java/cc/kune/lists/client/actions/NewListPostIconMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/NewListPostIconMenuItem.java (rev 0)
+++ trunk/src/main/java/cc/kune/lists/client/actions/NewListPostIconMenuItem.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -0,0 +1,38 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.lists.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
+import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Inject;
+
+public class NewListPostIconMenuItem extends MenuItemDescriptor {
+
+ @Inject
+ public NewListPostIconMenuItem(final I18nTranslationService i18n, final NewListPostAction action,
+ final NavResources res, final GlobalShortcutRegister shorcutReg, final ListsNewMenu menu) {
+ super(menu.get(), false, action);
+ this.withText(i18n.t("New post")).withToolTip(i18n.t("Create a new post")).withIcon(res.newemail()).withStyles(
+ "k-def-docbtn, k-fr");
+ }
+}
Deleted: trunk/src/main/java/cc/kune/lists/client/actions/NewWaveIconBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/NewWaveIconBtn.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/lists/client/actions/NewWaveIconBtn.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -1,41 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 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 cc.kune.lists.client.actions;
-
-import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
-import cc.kune.core.client.resources.nav.NavResources;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.gspace.client.actions.NewContentAction;
-import cc.kune.gspace.client.actions.NewContentBtn;
-import cc.kune.lists.shared.ListsConstants;
-
-import com.google.inject.Inject;
-
-public class NewWaveIconBtn extends NewContentBtn {
-
- @Inject
- public NewWaveIconBtn(final I18nTranslationService i18n, final NewContentAction action,
- final NavResources res, final GlobalShortcutRegister shorcutReg) {
- super(i18n, action, res.newemail(), shorcutReg, "", i18n.t("Create a new post"), i18n.t("New post"),
- ListsConstants.TYPE_POST);
- withStyles("k-btn-min, k-fl");
- }
-
-}
Deleted: trunk/src/main/java/cc/kune/lists/client/actions/NewWaveMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/NewWaveMenuItem.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/lists/client/actions/NewWaveMenuItem.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -1,40 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 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 cc.kune.lists.client.actions;
-
-import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
-import cc.kune.core.client.resources.nav.NavResources;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.gspace.client.actions.NewContentAction;
-import cc.kune.gspace.client.actions.NewContentMenuItem;
-import cc.kune.lists.shared.ListsConstants;
-
-import com.google.inject.Inject;
-
-public class NewWaveMenuItem extends NewContentMenuItem {
-
- @Inject
- public NewWaveMenuItem(final I18nTranslationService i18n, final NewContentAction action,
- final NavResources res, final GlobalShortcutRegister shorcutReg, final ListsNewMenu listsNewMenu) {
- super(i18n, action, res.newemail(), shorcutReg, i18n.t("New post"), i18n.t("Create a new post"),
- i18n.t("New post"), ListsConstants.TYPE_POST, listsNewMenu.get());
- }
-
-}
Added: trunk/src/main/java/cc/kune/lists/client/actions/OptionsListMenu.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/OptionsListMenu.java (rev 0)
+++ trunk/src/main/java/cc/kune/lists/client/actions/OptionsListMenu.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -0,0 +1,36 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.lists.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
+import cc.kune.core.client.resources.CoreResources;
+
+import com.google.inject.Inject;
+
+public class OptionsListMenu extends MenuDescriptor {
+
+ @Inject
+ public OptionsListMenu(final CoreResources res) {
+ super();
+ this.withIcon(res.arrowdownsitebar()).withStyles(
+ "k-def-docbtn, k-fr, k-noborder, k-no-backimage, k-nobackcolor");
+ }
+
+}
Added: trunk/src/main/java/cc/kune/lists/client/actions/RefreshListMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/RefreshListMenuItem.java (rev 0)
+++ trunk/src/main/java/cc/kune/lists/client/actions/RefreshListMenuItem.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -0,0 +1,38 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.lists.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.RefreshCurrentStateAction;
+
+import com.google.inject.Inject;
+
+public class RefreshListMenuItem extends MenuItemDescriptor {
+
+ @Inject
+ public RefreshListMenuItem(final I18nTranslationService i18n, final RefreshCurrentStateAction action,
+ final OptionsListMenu optionsMenu, final NavResources res) {
+ super(action);
+ this.withText(i18n.t("Reload this")).withIcon(res.refresh()).withParent(optionsMenu, false);
+ }
+
+}
Added: trunk/src/main/java/cc/kune/lists/client/actions/SetListOpenessAction.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/SetListOpenessAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/lists/client/actions/SetListOpenessAction.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -0,0 +1,57 @@
+package cc.kune.lists.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.lists.client.rpc.ListsServiceAsync;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class SetListOpenessAction extends RolAction {
+
+ public static final String ISPUBLIC = "stla-ispublic";
+
+ private final I18nTranslationService i18n;
+ private final Provider<ListsServiceAsync> listService;
+ private final Session session;
+ private final StateManager stateManager;
+
+ @Inject
+ public SetListOpenessAction(final I18nTranslationService i18n, final StateManager stateManager,
+ final Session session, final Provider<ListsServiceAsync> listService) {
+ super(AccessRolDTO.Administrator, true);
+ this.i18n = i18n;
+ this.stateManager = stateManager;
+ this.session = session;
+ this.listService = listService;
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ NotifyUser.showProgress();
+ final boolean setPublic = !isPublic();
+ listService.get().setPublic(session.getUserHash(), session.getCurrentStateToken(), setPublic,
+ new AsyncCallbackSimple<StateContainerDTO>() {
+ @Override
+ public void onSuccess(final StateContainerDTO result) {
+ NotifyUser.info(setPublic ? i18n.t("This list is now public")
+ : i18n.t("This list is now restricted to the public"));
+ stateManager.setRetrievedState(result);
+ stateManager.refreshCurrentState();
+ NotifyUser.hideProgress();
+ }
+ });
+ }
+
+ private Boolean isPublic() {
+ return (Boolean) getValue(ISPUBLIC);
+ }
+
+}
Added: trunk/src/main/java/cc/kune/lists/client/actions/SetListOpenessMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/SetListOpenessMenuItem.java (rev 0)
+++ trunk/src/main/java/cc/kune/lists/client/actions/SetListOpenessMenuItem.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -0,0 +1,29 @@
+package cc.kune.lists.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.dto.GroupListDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Inject;
+
+public class SetListOpenessMenuItem extends MenuItemDescriptor {
+
+ @Inject
+ public SetListOpenessMenuItem(final I18nTranslationService i18n, final SetListOpenessAction action,
+ final Session session, final CoreResources res, final OptionsListMenu menu) {
+ super(action);
+ setParent(menu, false);
+ final Boolean isPublic = session.getContainerState().getAccessLists().getViewers().getMode().equals(
+ GroupListDTO.EVERYONE);
+ action.putValue(SetListOpenessAction.ISPUBLIC, isPublic);
+ if (!isPublic) {
+ withText(i18n.t("Make this list public"));
+ withIcon(res.everybody());
+ } else {
+ withText(i18n.t("Make this list not public"));
+ withIcon(res.nobody());
+ }
+ }
+}
Modified: trunk/src/main/java/cc/kune/lists/client/actions/SubscribeToListBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/SubscribeToListBtn.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/lists/client/actions/SubscribeToListBtn.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -1,40 +1,30 @@
package cc.kune.lists.client.actions;
-import cc.kune.common.client.actions.ActionEvent;
import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
-import cc.kune.common.client.notify.NotifyUser;
-import cc.kune.common.client.utils.TextUtils;
-import cc.kune.core.client.actions.RolAction;
import cc.kune.core.client.resources.CoreResources;
-import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.core.client.state.Session;
import cc.kune.core.shared.i18n.I18nTranslationService;
import com.google.inject.Inject;
public class SubscribeToListBtn extends ButtonDescriptor {
- public static class SubscriteToListAction extends RolAction {
-
- private final I18nTranslationService i18n;
-
- @Inject
- public SubscriteToListAction(final I18nTranslationService i18n) {
- super(AccessRolDTO.Editor, true);
- this.i18n = i18n;
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- NotifyUser.info(i18n.t(TextUtils.IN_DEVELOPMENT));
- }
-
- }
-
@Inject
public SubscribeToListBtn(final I18nTranslationService i18n, final SubscriteToListAction action,
- final CoreResources res) {
+ final Session session, final CoreResources res) {
super(action);
- withText(i18n.t("Subscribe")).withIcon(res.add()).withToolTip(
- i18n.t("Subscribe yourself to this list"));
+ final Boolean areYouMember = session.isLogged()
+ && session.getContainerState().getAccessLists().getEditors().getList().contains(
+ session.getCurrentUserInfo().getUserGroup());
+ action.putValue(SubscriteToListAction.ISMEMBER, areYouMember);
+ if (!areYouMember) {
+ withText(i18n.t("Subscribe"));
+ withIcon(res.add());
+ withToolTip(i18n.t("Subscribe to this list"));
+ } else {
+ withText(i18n.t("Unsubscribe"));
+ withIcon(res.remove());
+ withToolTip(i18n.t("Unsubscribe to this list"));
+ }
}
}
Added: trunk/src/main/java/cc/kune/lists/client/actions/SubscriteToListAction.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/SubscriteToListAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/lists/client/actions/SubscriteToListAction.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -0,0 +1,89 @@
+package cc.kune.lists.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.notify.ConfirmAskEvent;
+import cc.kune.common.client.notify.NotifyLevel;
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.client.utils.OnAcceptCallback;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.client.auth.SignIn;
+import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.SiteTokens;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.client.state.TokenUtils;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.lists.client.rpc.ListsServiceAsync;
+
+import com.google.gwt.event.shared.EventBus;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class SubscriteToListAction extends RolAction {
+
+ public static final String ISMEMBER = "stla-ismember";
+
+ private final EventBus eventBus;
+ private final I18nTranslationService i18n;
+ private final Provider<ListsServiceAsync> listService;
+ private final Session session;
+ private final Provider<SignIn> signIn;
+ private final StateManager stateManager;
+
+ @Inject
+ public SubscriteToListAction(final Provider<SignIn> signIn, final I18nTranslationService i18n,
+ final StateManager stateManager, final Session session,
+ final Provider<ListsServiceAsync> listService, final EventBus eventBus) {
+ super(AccessRolDTO.Viewer, false);
+ this.signIn = signIn;
+ this.i18n = i18n;
+ this.stateManager = stateManager;
+ this.session = session;
+ this.listService = listService;
+ this.eventBus = eventBus;
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ if (session.isLogged()) {
+ if (isMember()) {
+ ConfirmAskEvent.fire(eventBus, i18n.t("Please confirm"), i18n.t("Are you sure?"), i18n.t("Yes"),
+ i18n.t("No"), null, null, new OnAcceptCallback() {
+ @Override
+ public void onSuccess() {
+ performAction();
+ }
+ });
+ } else {
+ performAction();
+ }
+ } else {
+ signIn.get().setErrorMessage(i18n.t("Sign in or create an account to susbscribe to this list"),
+ NotifyLevel.info);
+ stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGNIN,
+ session.getCurrentStateToken().toString()));
+ }
+ }
+
+ private Boolean isMember() {
+ return (Boolean) getValue(ISMEMBER);
+ }
+
+ private void performAction() {
+ NotifyUser.showProgress();
+ final boolean subcribe = !isMember();
+ listService.get().subscribeToList(session.getUserHash(), session.getCurrentStateToken(),
+ Boolean.valueOf(subcribe), new AsyncCallbackSimple<StateContainerDTO>() {
+ @Override
+ public void onSuccess(final StateContainerDTO result) {
+ NotifyUser.info(subcribe ? i18n.t("Subscribed") : i18n.t("Unsubscribed"));
+ stateManager.setRetrievedState(result);
+ stateManager.refreshCurrentState();
+ NotifyUser.hideProgress();
+ }
+ });
+ }
+
+}
Added: trunk/src/main/java/cc/kune/lists/client/rpc/ListsService.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/rpc/ListsService.java (rev 0)
+++ trunk/src/main/java/cc/kune/lists/client/rpc/ListsService.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -0,0 +1,22 @@
+package cc.kune.lists.client.rpc;
+
+import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.core.shared.dto.StateContentDTO;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
+
+ at RemoteServiceRelativePath("ListsService")
+public interface ListsService extends RemoteService {
+
+ StateContainerDTO createList(String hash, StateToken parentToken, String name, String description,
+ boolean isPublic);
+
+ public StateContentDTO newPost(final String userHash, final StateToken parentToken, final String title);
+
+ StateContainerDTO setPublic(String hash, StateToken token, Boolean isPublic);
+
+ StateContainerDTO subscribeToList(String hash, StateToken token, Boolean subscribe);
+
+}
\ No newline at end of file
Added: trunk/src/main/java/cc/kune/lists/client/rpc/ListsServiceAsync.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/rpc/ListsServiceAsync.java (rev 0)
+++ trunk/src/main/java/cc/kune/lists/client/rpc/ListsServiceAsync.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -0,0 +1,23 @@
+package cc.kune.lists.client.rpc;
+
+import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.core.shared.dto.StateContentDTO;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+public interface ListsServiceAsync {
+
+ void createList(String hash, StateToken parentToken, String name, String description,
+ boolean isPublic, AsyncCallback<StateContainerDTO> callback);
+
+ void newPost(String userHash, StateToken parentToken, String title,
+ AsyncCallback<StateContentDTO> callback);
+
+ void setPublic(String hash, StateToken token, Boolean isPublic,
+ AsyncCallback<StateContainerDTO> callback);
+
+ void subscribeToList(String hash, StateToken token, Boolean subscribe,
+ AsyncCallback<StateContainerDTO> callback);
+
+}
Modified: trunk/src/main/java/cc/kune/lists/server/ListsServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/server/ListsServerTool.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/lists/server/ListsServerTool.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -22,35 +22,77 @@
import static cc.kune.lists.shared.ListsConstants.NAME;
import static cc.kune.lists.shared.ListsConstants.ROOT_NAME;
import static cc.kune.lists.shared.ListsConstants.TYPE_LIST;
+import static cc.kune.lists.shared.ListsConstants.TYPE_POST;
import static cc.kune.lists.shared.ListsConstants.TYPE_ROOT;
-import static cc.kune.lists.shared.ListsConstants.TYPE_POST;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Set;
import cc.kune.core.server.AbstractServerTool;
+import cc.kune.core.server.UserSession;
import cc.kune.core.server.content.ContainerManager;
import cc.kune.core.server.content.ContentManager;
import cc.kune.core.server.manager.ToolConfigurationManager;
import cc.kune.core.server.tool.ServerToolTarget;
+import cc.kune.core.shared.domain.ContentStatus;
import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.domain.Container;
+import cc.kune.domain.Content;
import cc.kune.domain.Group;
import cc.kune.domain.User;
+import cc.kune.wave.server.KuneWaveManager;
+import cc.kune.wave.server.KuneWaveUtils;
import com.google.inject.Inject;
+import com.google.inject.Provider;
public class ListsServerTool extends AbstractServerTool {
+ private final Provider<UserSession> userSessionProvider;
+ private final KuneWaveManager waveManager;
+
@Inject
public ListsServerTool(final ContentManager contentManager, final ContainerManager containerManager,
- final ToolConfigurationManager configurationManager, final I18nTranslationService i18n) {
+ final ToolConfigurationManager configurationManager, final I18nTranslationService i18n,
+ final Provider<UserSession> userSessionProvider, final KuneWaveManager waveManager) {
super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_POST), Arrays.asList(TYPE_LIST),
Arrays.asList(TYPE_LIST), Arrays.asList(TYPE_ROOT), contentManager, containerManager,
configurationManager, i18n, ServerToolTarget.forGroups);
+ this.userSessionProvider = userSessionProvider;
+ this.waveManager = waveManager;
}
+ private Group getUserGroup() {
+ return userSessionProvider.get().getUser().getUserGroup();
+ }
+
@Override
public Group initGroup(final User user, final Group group, final Object... otherVars) {
createRoot(group);
return group;
}
+
+ @Override
+ public void onCreateContent(final Content content, final Container parent) {
+ content.setStatus(ContentStatus.publishedOnline);
+ content.setPublishedOn(new Date());
+ final Set<Group> admins = parent.getAccessLists().getAdmins().getList();
+ final Set<Group> editors = parent.getAccessLists().getEditors().getList();
+ final ArrayList<String> members = new ArrayList<String>();
+ for (final Group admin : admins) {
+ members.add(admin.getShortName());
+ }
+ for (final Group editor : editors) {
+ members.add(editor.getShortName());
+ }
+ members.add(getUserGroup().getShortName());
+ Collections.sort(members);
+ waveManager.addParticipants(KuneWaveUtils.getWaveRef(content),
+ content.getAuthors().get(0).getShortName(), getUserGroup().getShortName(),
+ members.toArray(new String[members.size()]));
+ }
+
}
Added: trunk/src/main/java/cc/kune/lists/server/rpc/ListsRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/server/rpc/ListsRPC.java (rev 0)
+++ trunk/src/main/java/cc/kune/lists/server/rpc/ListsRPC.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -0,0 +1,122 @@
+package cc.kune.lists.server.rpc;
+
+import cc.kune.core.client.errors.AccessViolationException;
+import cc.kune.core.server.UserSession;
+import cc.kune.core.server.auth.ActionLevel;
+import cc.kune.core.server.auth.Authenticated;
+import cc.kune.core.server.auth.Authorizated;
+import cc.kune.core.server.content.ContainerManager;
+import cc.kune.core.server.content.ContentUtils;
+import cc.kune.core.server.rpc.ContentRPC;
+import cc.kune.core.server.rpc.RPC;
+import cc.kune.core.shared.domain.AccessRol;
+import cc.kune.core.shared.domain.GroupListMode;
+import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.core.shared.dto.StateContentDTO;
+import cc.kune.domain.AccessLists;
+import cc.kune.domain.Container;
+import cc.kune.domain.Group;
+import cc.kune.lists.client.rpc.ListsService;
+import cc.kune.lists.shared.ListsConstants;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.persist.Transactional;
+
+public class ListsRPC implements ListsService, RPC {
+ private final ContainerManager contentManager;
+ private final ContentRPC contentRPC;
+ private final Provider<UserSession> userSessionProvider;
+
+ @Inject
+ public ListsRPC(final ContentRPC contentRPC, final Provider<UserSession> userSessionProvider,
+ final ContainerManager contentManager) {
+ this.contentRPC = contentRPC;
+ this.userSessionProvider = userSessionProvider;
+ this.contentManager = contentManager;
+ }
+
+ @Override
+ @Authenticated
+ @Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.container)
+ @Transactional
+ public StateContainerDTO createList(final String userHash, final StateToken parentToken,
+ final String title, final String description, final boolean isPublic) {
+ final StateContainerDTO result = contentRPC.addFolder(userHash, parentToken, title,
+ ListsConstants.TYPE_LIST);
+ // Not public list, don't permit subscriptions neither view posts
+ return contentRPC.getState(setContainerAcl(result.getStateToken(), isPublic));
+ }
+
+ private Group getUserGroup() {
+ return userSessionProvider.get().getUser().getUserGroup();
+ }
+
+ @Override
+ @Authenticated
+ @Authorizated(accessRolRequired = AccessRol.Viewer, actionLevel = ActionLevel.container)
+ @Transactional
+ public StateContentDTO newPost(final String userHash, final StateToken parentToken, final String title) {
+ final StateContentDTO content = contentRPC.addContent(userHash, parentToken, title,
+ ListsConstants.TYPE_POST);
+ return content;
+ }
+
+ private Container setContainerAcl(final StateToken token, final boolean isPublic) {
+ final Container container = contentManager.find(ContentUtils.parseId(token.getFolder()));
+ final AccessLists acl = new AccessLists();
+ acl.getAdmins().setMode(GroupListMode.NORMAL);
+ acl.getAdmins().add(getUserGroup());
+ acl.getEditors().setMode(isPublic ? GroupListMode.EVERYONE : GroupListMode.NOBODY);
+ setViewersAcl(isPublic, acl);
+ contentManager.setAccessList(container, acl);
+ return container;
+ }
+
+ @Override
+ @Authenticated
+ @Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.container)
+ @Transactional
+ public StateContainerDTO setPublic(final String hash, final StateToken token, final Boolean isPublic) {
+ final Container container = setPublicAcl(token, isPublic);
+ return contentRPC.getState(container);
+ }
+
+ private Container setPublicAcl(final StateToken token, final boolean isPublic) {
+ final Container container = contentManager.find(ContentUtils.parseId(token.getFolder()));
+ final AccessLists acl = container.getAccessLists();
+ setViewersAcl(isPublic, acl);
+ contentManager.setAccessList(container, acl);
+ return container;
+ }
+
+ private void setViewersAcl(final boolean isPublic, final AccessLists acl) {
+ acl.getViewers().clear();
+ acl.getViewers().setMode(isPublic ? GroupListMode.EVERYONE : GroupListMode.NOBODY);
+ }
+
+ @Override
+ @Authenticated
+ @Authorizated(accessRolRequired = AccessRol.Viewer, actionLevel = ActionLevel.container)
+ @Transactional
+ public StateContainerDTO subscribeToList(final String userHash, final StateToken token,
+ final Boolean subscribe) {
+ final Container container = contentManager.find(ContentUtils.parseId(token.getFolder()));
+ final AccessLists acl = container.getAccessLists();
+ if (subscribe) {
+ if (!acl.getAdmins().includes(getUserGroup())
+ && acl.getViewers().getMode().equals(GroupListMode.NOBODY)) {
+ // Not public list, don't permit subscriptions neither view posts
+ throw new AccessViolationException();
+ } else {
+ acl.getEditors().add(getUserGroup());
+ }
+ } else {
+ acl.getEditors().remove(getUserGroup());
+ }
+ contentManager.setAccessList(container, acl);
+ return contentRPC.getState(container);
+ }
+
+}
Modified: trunk/src/main/java/cc/kune/meets/shared/MeetingsConstants.java
===================================================================
--- trunk/src/main/java/cc/kune/meets/shared/MeetingsConstants.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/meets/shared/MeetingsConstants.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -22,7 +22,7 @@
public final class MeetingsConstants {
public static final String NAME = "meets";
- public static final String ROOT_NAME = "meets";
+ public static final String ROOT_NAME = "meetings";
public static final String TYPE_MEETING = NAME + "." + "meet";
public static final String TYPE_ROOT = NAME + "." + "root";
Modified: trunk/src/main/java/cc/kune/wave/server/KuneAgent.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/KuneAgent.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/wave/server/KuneAgent.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -63,8 +63,8 @@
}
@Override
- public void addParticipant(final WaveRef waveName, final String author, final String userWhoAdd,
- final String newParticipant) {
+ public void addParticipants(final WaveRef waveName, final String author, final String userWhoAdd,
+ final String... newParticipants) {
// TODO Auto-generated method stub
}
Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -33,7 +33,7 @@
void addGadget(WaveRef waveName, String author, String gadgetUrl);
- void addParticipant(WaveRef waveName, String author, String userWhoAdd, String newParticipant);
+ void addParticipants(WaveRef waveName, String author, String userWhoAdd, String... newParticipant);
WaveRef createWave(String message, ParticipantId participants);
Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -186,22 +186,30 @@
}
@Override
- public void addParticipant(final WaveRef waveName, final String author, final String userWhoAdds,
- final String newLocalParticipant) {
+ public void addParticipants(final WaveRef waveName, final String author, final String userWhoAdds,
+ final String... newLocalParticipants) {
final Wavelet wavelet = fetchWave(waveName, author);
- final String newPartWithDomain = participantUtils.of(newLocalParticipant).toString();
- for (final String current : wavelet.getParticipants()) {
- if (current.equals(newPartWithDomain)) {
- // Current user is a participant already (issue #73)
- return;
+ final OperationQueue opQueue = new OperationQueue();
+
+ for (final String newLocalParticipant : newLocalParticipants) {
+ final String newPartWithDomain = participantUtils.of(newLocalParticipant).toString();
+ boolean mustAdd = true;
+ for (final String current : wavelet.getParticipants()) {
+ if (current.equals(newPartWithDomain)) {
+ // Current user is a participant already (issue #73)
+ mustAdd = false;
+ break;
+ }
}
+ if (mustAdd) {
+ opQueue.addParticipantToWavelet(wavelet, newPartWithDomain);
+ }
}
- final String whoAdd = wavelet.getParticipants().contains(participantUtils.of(userWhoAdds)) ? userWhoAdds
- : author;
- final OperationQueue opQueue = new OperationQueue();
- opQueue.addParticipantToWavelet(wavelet, newPartWithDomain);
- doOperation(whoAdd, opQueue, "add participant");
-
+ if (opQueue.getPendingOperations().size() > 0) {
+ final String whoAdd = wavelet.getParticipants().contains(participantUtils.of(userWhoAdds)) ? userWhoAdds
+ : author;
+ doOperation(whoAdd, opQueue, "add participant");
+ }
}
@Override
Added: trunk/src/main/java/cc/kune/wave/server/KuneWaveUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/KuneWaveUtils.java (rev 0)
+++ trunk/src/main/java/cc/kune/wave/server/KuneWaveUtils.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -0,0 +1,18 @@
+package cc.kune.wave.server;
+
+import org.waveprotocol.wave.model.waveref.InvalidWaveRefException;
+import org.waveprotocol.wave.model.waveref.WaveRef;
+import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder;
+
+import cc.kune.core.client.errors.DefaultException;
+import cc.kune.domain.Content;
+
+public class KuneWaveUtils {
+ public static WaveRef getWaveRef(final Content content) {
+ try {
+ return JavaWaverefEncoder.decodeWaveRefFromPath(String.valueOf(content.getWaveId()));
+ } catch (final InvalidWaveRefException e) {
+ throw new DefaultException("Error getting the wave");
+ }
+ }
+}
Modified: trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -23,64 +23,64 @@
import java.io.IOException;
-
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.rpcservices.UserService;
import cc.kune.core.server.UserSession;
import cc.kune.core.server.properties.KuneBasicProperties;
+import cc.kune.core.shared.dto.UserInfoDTO;
import com.google.inject.Inject;
public abstract class IntegrationTest {
- @Inject
- KuneBasicProperties properties;
- @Inject
- protected UserSession session;
- protected String token;
- @Inject
- UserService userService;
+ @Inject
+ KuneBasicProperties properties;
+ @Inject
+ protected UserSession session;
+ protected String token;
+ @Inject
+ UserService userService;
- protected String doLogin() throws DefaultException, IOException {
- waveLogin();
- return userService.login(getSiteAdminShortName(), properties.getAdminPassword(), token).getUserHash();
- }
+ protected UserInfoDTO doLogin() throws DefaultException, IOException {
+ waveLogin();
+ return userService.login(getSiteAdminShortName(), properties.getAdminPassword(), token);
+ }
- protected String doLoginWithDummyUser() throws DefaultException, IOException {
- waveLogin();
- return userService.login("dummy", properties.getAdminPassword(), token).getUserHash();
- }
+ protected String doLoginWithDummyUser() throws DefaultException, IOException {
+ waveLogin();
+ return userService.login("dummy", properties.getAdminPassword(), token).getUserHash();
+ }
- protected void doLogout() throws DefaultException {
- userService.logout(getHash());
- }
+ protected void doLogout() throws DefaultException {
+ userService.logout(getHash());
+ }
- protected String getDefLicense() {
- return properties.getDefaultLicense();
- }
+ protected String getDefLicense() {
+ return properties.getDefaultLicense();
+ }
- protected String getDefSiteGroupName() {
- return properties.getDefaultSiteShortName();
- }
+ protected String getDefSiteGroupName() {
+ return properties.getDefaultSiteShortName();
+ }
- public String getHash() {
- return session.getHash();
- }
+ public String getHash() {
+ return session.getHash();
+ }
- protected String getSiteAdminShortName() {
- return properties.getAdminShortName();
- }
+ protected String getSiteAdminShortName() {
+ return properties.getAdminShortName();
+ }
- protected void waveLogin() throws IOException {
- token = "somesampletoken";
- // final ClientAuthenticator authenticator = new
- // ClientAuthenticator("http://localhost:8080"
- // + SessionManager.SIGN_IN_URL);
- // final HttpCookie cookie =
- // authenticator.authenticate("admin at localhost",
- // "easyeasy".toCharArray());
- // token = cookie.getValue();
- assertNotNull(token);
- }
+ protected void waveLogin() throws IOException {
+ token = "somesampletoken";
+ // final ClientAuthenticator authenticator = new
+ // ClientAuthenticator("http://localhost:8080"
+ // + SessionManager.SIGN_IN_URL);
+ // final HttpCookie cookie =
+ // authenticator.authenticate("admin at localhost",
+ // "easyeasy".toCharArray());
+ // token = cookie.getValue();
+ assertNotNull(token);
+ }
}
Modified: trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -30,6 +30,7 @@
import org.waveprotocol.box.server.waveserver.WaveServerImpl;
import org.waveprotocol.wave.federation.noop.NoOpFederationModule;
+import cc.kune.barters.server.BarterServerModule;
import cc.kune.chat.server.ChatServerModule;
import cc.kune.core.server.KunePersistenceService;
import cc.kune.core.server.PlatformServerModule;
@@ -37,6 +38,9 @@
import cc.kune.core.server.init.FinderRegistry;
import cc.kune.core.server.properties.PropertiesFileName;
import cc.kune.docs.server.DocumentServerModule;
+import cc.kune.lists.server.ListsServerModule;
+import cc.kune.meets.server.MeetingServerModule;
+import cc.kune.tasks.server.TaskServerModule;
import cc.kune.wave.server.CustomSettingsBinder;
import cc.kune.wiki.server.WikiServerModule;
@@ -59,9 +63,10 @@
final NoOpFederationModule federationModule = injector.getInstance(NoOpFederationModule.class);
final Injector childInjector = injector.createChildInjector(wavePersistModule,
FinderRegistry.init(new JpaPersistModule(TestConstants.PERSISTENCE_UNIT)),
- new RobotApiModule(), new PlatformServerModule(), new DocumentServerModule(),
- new ChatServerModule(), new ServerModule(false), federationModule, new WikiServerModule(),
- new AbstractModule() {
+ new ListsServerModule(), new RobotApiModule(), new PlatformServerModule(),
+ new DocumentServerModule(), new ChatServerModule(), new ServerModule(false), federationModule,
+ new WikiServerModule(), new TaskServerModule(), new BarterServerModule(),
+ new MeetingServerModule(), new AbstractModule() {
@Override
protected void configure() {
bindScope(SessionScoped.class, Scopes.SINGLETON);
Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceGetTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceGetTest.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceGetTest.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -36,99 +36,100 @@
public class ContentServiceGetTest extends ContentServiceIntegrationTest {
- @Test
- public void contentOfUserWithNoHomePage() throws Exception {
- final String userHash = doLogin();
- final StateAbstractDTO response = contentService.getContent(userHash, new StateToken(getSiteAdminShortName()));
- assertTrue(response instanceof StateNoContentDTO);
- }
+ @Test
+ public void contentOfUserWithNoHomePage() throws Exception {
+ final String userHash = doLogin().getUserHash();
+ final StateAbstractDTO response = contentService.getContent(userHash, new StateToken(
+ getSiteAdminShortName()));
+ assertTrue(response instanceof StateNoContentDTO);
+ }
- @Test
- public void contentWithLoggedUserIsEditable() throws Exception {
- final String userHash = doLogin();
- final StateContentDTO response = (StateContentDTO) contentService.getContent(userHash,
- getSiteDefaultContent().getStateToken());
- assertNotNull(response.getContentRights());
- assertTrue(response.getContentRights().isEditable());
- assertTrue(response.getAccessLists().getAdmins().getList().size() == 1);
- }
+ @Test
+ public void contentWithLoggedUserIsEditable() throws Exception {
+ final String userHash = doLogin().getUserHash();
+ final StateContentDTO response = (StateContentDTO) contentService.getContent(userHash,
+ getSiteDefaultContent().getStateToken());
+ assertNotNull(response.getContentRights());
+ assertTrue(response.getContentRights().isEditable());
+ assertTrue(response.getAccessLists().getAdmins().getList().size() == 1);
+ }
- @Before
- public void create() {
- new IntegrationTestHelper(this);
- }
+ @Before
+ public void create() {
+ new IntegrationTestHelper(this);
+ }
- @Test
- public void defaultCountentShouldExist() throws Exception {
- final StateContentDTO content = (StateContentDTO) contentService.getContent(null, new StateToken());
- assertNotNull(content);
- assertNotNull(content.getGroup());
- assertNotNull(content.getContainer());
- assertNotNull(content.getContainer().getId());
- assertNotNull(content.getToolName());
- assertNotNull(content.getDocumentId());
- assertNotNull(content.getRateByUsers());
- assertNotNull(content.getRate());
- }
+ @Test
+ public void defaultCountentShouldExist() throws Exception {
+ final StateContentDTO content = (StateContentDTO) contentService.getContent(null, new StateToken());
+ assertNotNull(content);
+ assertNotNull(content.getGroup());
+ assertNotNull(content.getContainer());
+ assertNotNull(content.getContainer().getId());
+ assertNotNull(content.getToolName());
+ assertNotNull(content.getDocumentId());
+ assertNotNull(content.getRateByUsers());
+ assertNotNull(content.getRate());
+ }
- @Test
- public void defContentOfUserWithNoHomePage() throws Exception {
- final String userHash = doLogin();
- final StateAbstractDTO response = contentService.getContent(userHash, new StateToken());
- assertTrue(response.getStateToken().equals(getSiteDefaultContent().getStateToken()));
- }
+ @Test
+ public void defContentOfUserWithNoHomePage() throws Exception {
+ final String userHash = doLogin().getUserHash();
+ final StateAbstractDTO response = contentService.getContent(userHash, new StateToken());
+ assertTrue(response.getStateToken().equals(getSiteDefaultContent().getStateToken()));
+ }
- @Test
- public void noContentNotLogged() throws Exception {
- final StateContentDTO response = (StateContentDTO) contentService.getContent(null, new StateToken());
- assertNotNull(response);
- }
+ @Test
+ public void noContentNotLogged() throws Exception {
+ final StateContentDTO response = (StateContentDTO) contentService.getContent(null, new StateToken());
+ assertNotNull(response);
+ }
- @Test(expected = ContentNotFoundException.class)
- public void nonExistentContent() throws Exception {
- contentService.getContent(null, new StateToken("foo foo foo"));
- }
+ @Test(expected = ContentNotFoundException.class)
+ public void nonExistentContent() throws Exception {
+ contentService.getContent(null, new StateToken("foo foo foo"));
+ }
- @Test(expected = ContentNotFoundException.class)
- public void nonExistentContent2() throws Exception {
- contentService.getContent(null, new StateToken("site.foofoo"));
- }
+ @Test(expected = ContentNotFoundException.class)
+ public void nonExistentContent2() throws Exception {
+ contentService.getContent(null, new StateToken("site.foofoo"));
+ }
- @Test(expected = ContentNotFoundException.class)
- public void nonExistentContent3() throws Exception {
- contentService.getContent(null, new StateToken("site.docs.foofoo"));
- }
+ @Test(expected = ContentNotFoundException.class)
+ public void nonExistentContent3() throws Exception {
+ contentService.getContent(null, new StateToken("site.docs.foofoo"));
+ }
- @Test(expected = ContentNotFoundException.class)
- public void nonExistentContent4() throws Exception {
- final StateContainerDTO stateDTO = getSiteDefaultContent();
- contentService.getContent(null, stateDTO.getStateToken().copy().setDocument("dadaas"));
- }
+ @Test(expected = ContentNotFoundException.class)
+ public void nonExistentContent4() throws Exception {
+ final StateContainerDTO stateDTO = getSiteDefaultContent();
+ contentService.getContent(null, stateDTO.getStateToken().copy().setDocument("dadaas"));
+ }
- @Test(expected = ContentNotFoundException.class)
- public void nonExistentContent5() throws Exception {
- contentService.getContent(null, new StateToken("comm3.docs.19"));
- }
+ @Test(expected = ContentNotFoundException.class)
+ public void nonExistentContent5() throws Exception {
+ contentService.getContent(null, new StateToken("comm3.docs.19"));
+ }
- @Test
- public void notLoggedUserShouldNotEditDefaultDoc() throws Exception {
- final StateContentDTO content = (StateContentDTO) contentService.getContent(null, new StateToken());
- assertFalse(content.getContentRights().isAdministrable());
- assertFalse(content.getContentRights().isEditable());
- assertTrue(content.getContentRights().isVisible());
- assertFalse(content.getContainerRights().isAdministrable());
- assertFalse(content.getContainerRights().isEditable());
- assertTrue(content.getContainerRights().isVisible());
- }
+ @Test
+ public void notLoggedUserShouldNotEditDefaultDoc() throws Exception {
+ final StateContentDTO content = (StateContentDTO) contentService.getContent(null, new StateToken());
+ assertFalse(content.getContentRights().isAdministrable());
+ assertFalse(content.getContentRights().isEditable());
+ assertTrue(content.getContentRights().isVisible());
+ assertFalse(content.getContainerRights().isAdministrable());
+ assertFalse(content.getContainerRights().isEditable());
+ assertTrue(content.getContainerRights().isVisible());
+ }
- @Test
- public void unknownContent() throws Exception {
- final StateContainerDTO content = (StateContainerDTO) contentService.getContent(null, new StateToken(
- "site.docs"));
- assertNotNull(content);
- assertNotNull(content.getGroup());
- assertNotNull(content.getContainer());
- assertNotNull(content.getContainer().getId());
- assertNotNull(content.getToolName());
- }
+ @Test
+ public void unknownContent() throws Exception {
+ final StateContainerDTO content = (StateContainerDTO) contentService.getContent(null,
+ new StateToken("site.docs"));
+ assertNotNull(content);
+ assertNotNull(content.getGroup());
+ assertNotNull(content.getContainer());
+ assertNotNull(content.getContainer().getId());
+ assertNotNull(content.getToolName());
+ }
}
Modified: trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkMembersTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkMembersTest.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkMembersTest.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -20,6 +20,8 @@
package cc.kune.core.server.integration.socialnet;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import java.util.Set;
@@ -31,6 +33,7 @@
import cc.kune.core.server.integration.IntegrationTestHelper;
import cc.kune.core.server.manager.GroupManager;
import cc.kune.core.server.manager.SocialNetworkManager;
+import cc.kune.domain.AccessLists;
import cc.kune.domain.Group;
import com.google.inject.Inject;
@@ -54,6 +57,19 @@
}
@Test
+ public void testAdminAddTwice() throws Exception {
+ doLogin();
+ final Set<Group> result = groupFinder.findAdminInGroups(group.getId());
+ final AccessLists acl = group.getSocialNetwork().getAccessLists();
+ assertTrue(acl.getAdmins().includes(group));
+ assertFalse(acl.getEditors().includes(group));
+ acl.addAdmin(group);
+ acl.addAdmin(group);
+ acl.addAdmin(group);
+ assertEquals(2, result.size());
+ }
+
+ @Test
public void testAdminMembersOfGroupFinder() throws Exception {
doLogin();
final Set<Group> result = groupFinder.findAdminInGroups(group.getId());
Modified: trunk/src/test/java/cc/kune/lists/server/ListsServerToolTest.java
===================================================================
--- trunk/src/test/java/cc/kune/lists/server/ListsServerToolTest.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/test/java/cc/kune/lists/server/ListsServerToolTest.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -20,8 +20,8 @@
package cc.kune.lists.server;
import static cc.kune.lists.shared.ListsConstants.TYPE_LIST;
+import static cc.kune.lists.shared.ListsConstants.TYPE_POST;
import static cc.kune.lists.shared.ListsConstants.TYPE_ROOT;
-import static cc.kune.lists.shared.ListsConstants.TYPE_POST;
import org.junit.Before;
import org.junit.Test;
@@ -35,7 +35,7 @@
@Before
public void before() {
- serverTool = new ListsServerTool(null, null, null, null);
+ serverTool = new ListsServerTool(null, null, null, null, null, null);
}
@Test
Added: trunk/src/test/java/cc/kune/lists/server/ListsServiceTest.java
===================================================================
--- trunk/src/test/java/cc/kune/lists/server/ListsServiceTest.java (rev 0)
+++ trunk/src/test/java/cc/kune/lists/server/ListsServiceTest.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -0,0 +1,122 @@
+package cc.kune.lists.server;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import cc.kune.core.client.errors.AccessViolationException;
+import cc.kune.core.client.errors.DefaultException;
+import cc.kune.core.client.rpcservices.ContentService;
+import cc.kune.core.server.integration.IntegrationTest;
+import cc.kune.core.server.integration.IntegrationTestHelper;
+import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.core.shared.dto.AccessListsDTO;
+import cc.kune.core.shared.dto.GroupDTO;
+import cc.kune.core.shared.dto.StateAbstractDTO;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.core.shared.dto.StateContentDTO;
+import cc.kune.core.shared.dto.UserInfoDTO;
+import cc.kune.lists.client.rpc.ListsService;
+import cc.kune.lists.shared.ListsConstants;
+
+import com.google.inject.Inject;
+
+public class ListsServiceTest extends IntegrationTest {
+ private StateContainerDTO closeList;
+ @Inject
+ ContentService contentService;
+ @Inject
+ ListsService listsService;
+ private StateContainerDTO openList;
+ private GroupDTO userGroup;
+
+ @Before
+ public void init() throws DefaultException, IOException {
+ new IntegrationTestHelper(this);
+ final UserInfoDTO userInfoDTO = doLogin();
+ userGroup = userInfoDTO.getUserGroup();
+ final StateAbstractDTO rootList = contentService.getContent(getHash(), new StateToken(
+ getDefSiteGroupName(), ListsConstants.ROOT_NAME));
+ openList = listsService.createList(getHash(), rootList.getStateToken(), "test list", "", true);
+ closeList = listsService.createList(getHash(), rootList.getStateToken(), "test list", "", false);
+ }
+
+ @Test(expected = AccessViolationException.class)
+ public void postToCloseShouldFailTest() throws DefaultException, IOException {
+ doLogout();
+ doLoginWithDummyUser();
+ listsService.newPost(getHash(), closeList.getStateToken(), "lalala");
+ }
+
+ @Test
+ public void postToOpenByOthersTest() throws DefaultException, IOException {
+ doLogout();
+ doLoginWithDummyUser();
+ final StateContentDTO newPost = listsService.newPost(getHash(), openList.getStateToken(), "lalala");
+ // FIXME: check participation
+ assertNotNull(newPost);
+ }
+
+ @Test
+ public void postToOpenCloseAndLaterOpenByOthersTest() throws DefaultException, IOException {
+ listsService.setPublic(token, openList.getStateToken(), false);
+ listsService.setPublic(token, openList.getStateToken(), true);
+ doLogout();
+ doLoginWithDummyUser();
+ final StateContentDTO newPost = listsService.newPost(getHash(), openList.getStateToken(), "lalala");
+ assertNotNull(newPost);
+ }
+
+ @Test
+ public void subscribeSeveralToCloseTest() throws DefaultException, IOException {
+ subscribeUnsubsSeveral(closeList);
+ }
+
+ @Test
+ public void subscribeSeveralToPublicTest() {
+ subscribeUnsubsSeveral(openList);
+ }
+
+ @Test(expected = AccessViolationException.class)
+ public void subscribeToCloseShouldFailTest() throws DefaultException, IOException {
+ doLogout();
+ doLoginWithDummyUser();
+ listsService.subscribeToList(getHash(), closeList.getStateToken(), true);
+ }
+
+ @Test(expected = AccessViolationException.class)
+ public void subscribeToOpenAndLaterCloseListShouldFailTest() throws DefaultException, IOException {
+ listsService.setPublic(token, openList.getStateToken(), false);
+ doLogout();
+ doLoginWithDummyUser();
+ listsService.subscribeToList(getHash(), openList.getStateToken(), true);
+ }
+
+ private void subscribeUnsubsSeveral(final StateContainerDTO list) {
+ final AccessListsDTO initialAcl = list.getAccessLists();
+ assertTrue(initialAcl.getAdmins().includes(userGroup));
+ assertFalse(initialAcl.getEditors().getList().contains(userGroup));
+
+ StateContainerDTO state = listsService.subscribeToList(getHash(), list.getStateToken(), true);
+ AccessListsDTO acl = state.getAccessLists();
+ assertTrue(acl.getEditors().includes(userGroup));
+ assertTrue(acl.getAdmins().includes(userGroup));
+
+ state = listsService.subscribeToList(getHash(), list.getStateToken(), false);
+ acl = state.getAccessLists();
+ assertFalse(acl.getEditors().includes(userGroup));
+ assertTrue(acl.getAdmins().includes(userGroup));
+
+ state = listsService.subscribeToList(getHash(), list.getStateToken(), true);
+ acl = state.getAccessLists();
+ assertTrue(acl.getEditors().includes(userGroup));
+ assertTrue(acl.getEditors().getList().contains(userGroup));
+ assertTrue(acl.getAdmins().includes(userGroup));
+ }
+
+}
Modified: trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java 2011-08-12 18:33:43 UTC (rev 1492)
+++ trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java 2011-08-13 15:59:10 UTC (rev 1493)
@@ -62,7 +62,7 @@
doLogin();
final WaveRef waveletName = createTestWave();
assertNotNull(waveletName);
- manager.addParticipant(waveletName, getSiteAdminShortName(), whoAdds, NEW_PARTICIPANT);
+ manager.addParticipants(waveletName, getSiteAdminShortName(), whoAdds, NEW_PARTICIPANT);
final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName());
assertNotNull(fetchWavelet);
assertEquals(2, fetchWavelet.getParticipants().size());
@@ -75,10 +75,12 @@
doLogin();
final WaveRef waveletName = createTestWave();
assertNotNull(waveletName);
- manager.addParticipant(waveletName, getSiteAdminShortName(), getSiteAdminShortName(),
+ manager.addParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName(),
NEW_PARTICIPANT);
- manager.addParticipant(waveletName, getSiteAdminShortName(), getSiteAdminShortName(),
- NEW_PARTICIPANT);
+ manager.addParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName(),
+ NEW_PARTICIPANT, NEW_PARTICIPANT);
+ manager.addParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName(),
+ NEW_PARTICIPANT, NEW_PARTICIPANT, NEW_PARTICIPANT);
final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName());
assertNotNull(fetchWavelet);
assertEquals(2, fetchWavelet.getParticipants().size());
More information about the kune-commits
mailing list