Author: vjrj_ Date: 2012-02-29 02:04:27 +0100 (Wed, 29 Feb 2012) New Revision: 1720 Added: trunk/src/main/java/cc/kune/core/client/errors/InvalidSNOperationException.java trunk/src/main/java/cc/kune/core/client/sn/AdminsGroupSNDropController.java trunk/src/main/java/cc/kune/core/client/sn/AllMembersGroupSNDropController.java trunk/src/main/java/cc/kune/core/client/sn/CollabsGroupSNDropController.java trunk/src/main/java/cc/kune/core/client/sn/GroupSNDropController.java trunk/src/main/java/cc/kune/core/client/sn/actions/SocialNetClientUtils.java trunk/src/main/java/cc/kune/core/server/manager/impl/GroupServerUtils.java trunk/src/main/java/cc/kune/core/shared/dto/EmailNotificationFrequency.java trunk/src/main/java/cc/kune/core/shared/dto/SocialNetworkSubGroup.java trunk/src/test/java/cc/kune/core/shared/dto/ Removed: trunk/src/main/java/cc/kune/core/shared/domain/dto/EmailNotificationFrequency.java Modified: trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java trunk/src/main/java/cc/kune/core/client/CoreGinModule.java trunk/src/main/java/cc/kune/core/client/dnd/AbstractDropController.java trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.ui.xml trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToAdminAction.java trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToCollabAction.java trunk/src/main/java/cc/kune/core/public/ws.css trunk/src/main/java/cc/kune/core/server/KuneRackModule.java trunk/src/main/java/cc/kune/core/server/content/ContentManager.java trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java trunk/src/main/java/cc/kune/core/server/manager/impl/KuneWaveManagerDefault.java trunk/src/main/java/cc/kune/core/server/manager/impl/SocialNetworkManagerDefault.java trunk/src/main/java/cc/kune/core/server/notifier/NotificationSender.java trunk/src/main/java/cc/kune/core/server/notifier/NotificationSenderDefault.java trunk/src/main/java/cc/kune/core/server/notifier/NotificationService.java trunk/src/main/java/cc/kune/core/server/notifier/PendingNotificationSender.java trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java trunk/src/main/java/cc/kune/core/shared/dto/UserDTO.java trunk/src/main/java/cc/kune/core/shared/dto/UserSimpleDTO.java trunk/src/main/java/cc/kune/domain/User.java trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPanel.java trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralView.java trunk/src/main/java/cc/kune/lists/client/ListsClientTool.java trunk/src/main/java/cc/kune/tasks/client/TasksClientTool.java trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveServiceDefault.java trunk/src/main/java/cc/kune/wiki/client/WikiClientTool.java Log: CLOSED - # 198: Add Drag and Drop from users to contents and vice versa http://kune.ourproject.org/issues/ticket/198 Modified: trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java =================================================================== --- trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -51,7 +51,7 @@ // registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE); registerAuthorableTypes(TYPE_BARTER); registerDragableTypes(TYPE_BARTER, TYPE_FOLDER); - registerDropableTypes(TYPE_ROOT, TYPE_FOLDER); + registerDropableTypes(TYPE_ROOT, TYPE_FOLDER, TYPE_BARTER); // registerPublishModerableTypes(); registerRateableTypes(TYPE_BARTER); registerRenamableTypes(TYPE_FOLDER, TYPE_BARTER); Modified: trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java =================================================================== --- trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -52,7 +52,7 @@ // registerAclEditableTypes(); registerAuthorableTypes(TYPE_POST, TYPE_UPLOADEDFILE); registerDragableTypes(TYPE_UPLOADEDFILE); - registerDropableTypes(TYPE_ROOT); + registerDropableTypes(TYPE_ROOT, TYPE_POST); registerPublishModerableTypes(TYPE_POST, TYPE_UPLOADEDFILE); registerRateableTypes(TYPE_POST, TYPE_UPLOADEDFILE); registerRenamableTypes(TYPE_BLOG, TYPE_POST, TYPE_UPLOADEDFILE); Modified: trunk/src/main/java/cc/kune/core/client/CoreGinModule.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -85,6 +85,7 @@ import cc.kune.core.client.sn.UserSNPresenter; import cc.kune.core.client.sn.actions.AddBuddieSearchPanel; import cc.kune.core.client.sn.actions.AddMemberSearchPanel; +import cc.kune.core.client.sn.actions.SocialNetClientUtils; import cc.kune.core.client.sn.actions.registry.GroupSNAdminsMenuItemsRegistry; import cc.kune.core.client.sn.actions.registry.GroupSNCollabsMenuItemsRegistry; import cc.kune.core.client.sn.actions.registry.GroupSNConfActions; @@ -231,6 +232,7 @@ s(UserSNConfActions.class); s(AddBuddieSearchPanel.class); s(AddMemberSearchPanel.class); + s(SocialNetClientUtils.class); s(SiteUserOptionsPresenter.class); s(SiteUserOptions.class, SiteUserOptionsPresenter.class); Modified: trunk/src/main/java/cc/kune/core/client/dnd/AbstractDropController.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/dnd/AbstractDropController.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/client/dnd/AbstractDropController.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -116,7 +116,7 @@ public void onPreviewDrop(final DragContext context) throws VetoDragException { for (final Widget widget : context.selectedWidgets) { if (acceptedTypes.contains(widget.getClass())) { - onPreviewAllowed(this); + onPreviewAllowed(widget, this); } else { throw new VetoDragException(); } @@ -187,10 +187,14 @@ /** * On preview allowed. * + * @param widget + * * @param dropController * the drop controller + * @throws VetoDragException */ - public void onPreviewAllowed(final SimpleDropController dropController) { + public void onPreviewAllowed(final Widget widget, final SimpleDropController dropController) + throws VetoDragException { dropController.getDropTarget().removeStyleName("k-drop-allowed-hover"); } Modified: trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -110,6 +110,10 @@ NotifyUser.showAlertMessage(i18n.t("Warning"), i18n.t("Sorry, you are the last admin of this group." + " Look for someone to substitute you appropriately as admin before leaving this group.")); + + } else if (caught instanceof InvalidSNOperationException) { + logException(caught); + eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error, i18n.t("Invalid operation"))); } else if (caught instanceof AlreadyGroupMemberException) { logException(caught); eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error, Added: trunk/src/main/java/cc/kune/core/client/errors/InvalidSNOperationException.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/errors/InvalidSNOperationException.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/errors/InvalidSNOperationException.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -0,0 +1,33 @@ +/* + * + * 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.core.client.errors; + +public class InvalidSNOperationException extends DefaultException { + + private static final long serialVersionUID = -3027252154297955075L; + + public InvalidSNOperationException() { + super(); + } + + public InvalidSNOperationException(final String message) { + super(message); + } +} Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -29,6 +29,7 @@ import cc.kune.core.shared.domain.utils.StateToken; import cc.kune.core.shared.dto.ContentSimpleDTO; import cc.kune.core.shared.dto.I18nLanguageDTO; +import cc.kune.core.shared.dto.SocialNetworkSubGroup; import cc.kune.core.shared.dto.StateAbstractDTO; import cc.kune.core.shared.dto.StateContainerDTO; import cc.kune.core.shared.dto.StateContentDTO; @@ -59,6 +60,9 @@ Boolean addParticipant(String userHash, StateToken token, String participant) throws DefaultException; + Boolean addParticipants(String userHash, StateToken token, String groupName, + SocialNetworkSubGroup subGroup) throws DefaultException; + StateContainerDTO addRoom(String user, StateToken parentToken, String name) throws DefaultException; StateContentDTO delContent(String userHash, StateToken token) throws DefaultException; Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -28,6 +28,7 @@ import cc.kune.core.shared.domain.utils.StateToken; import cc.kune.core.shared.dto.ContentSimpleDTO; import cc.kune.core.shared.dto.I18nLanguageDTO; +import cc.kune.core.shared.dto.SocialNetworkSubGroup; import cc.kune.core.shared.dto.StateAbstractDTO; import cc.kune.core.shared.dto.StateContainerDTO; import cc.kune.core.shared.dto.StateContentDTO; @@ -58,6 +59,9 @@ void addParticipant(String userHash, StateToken token, String participant, AsyncCallback<Boolean> asyncCallback); + void addParticipants(String userHash, StateToken token, String groupName, + SocialNetworkSubGroup subGroup, AsyncCallback<Boolean> callback); + void addRoom(String user, StateToken parentToken, String name, AsyncCallback<StateContainerDTO> callback); Modified: trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -31,7 +31,6 @@ import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.avatar.SmallAvatarDecorator; import cc.kune.core.client.dnd.KuneDragController; -import cc.kune.core.client.dnd.NotImplementedDropManager; import cc.kune.core.client.ui.BasicDragableThumb; import cc.kune.core.shared.domain.utils.StateToken; import cc.kune.gspace.client.armor.GSpaceArmor; @@ -58,7 +57,7 @@ private final static int AVATARLABELMAXSIZE = 4; private final static int AVATARSIZE = 22; private final static String CATEG_HEIGHT = "84px"; - private final static String CATEG_MIN_HEIGHT = "55px"; + private final static String CATEG_MIN_HEIGHT = "57px"; private static AbstractSNPanelUiBinder uiBinder = GWT.create(AbstractSNPanelUiBinder.class); protected final ActionSimplePanel actions; protected final GSpaceArmor armor; @@ -80,6 +79,8 @@ @UiField DockLayoutPanel firstCategoryPanel; @UiField + ScrollPanel firstCategoryScroll; + @UiField Label firstDeckLabel; @UiField FlowPanel mainPanel; @@ -111,15 +112,12 @@ public AbstractSNPanel(final I18nTranslationService i18n, final GuiProvider guiProvider, final GSpaceArmor armor, final Provider<SmallAvatarDecorator> avatarDecorator, - final KuneDragController dragController, final NotImplementedDropManager notDrop) { + final KuneDragController dragController) { this.armor = armor; this.avatarDecoratorProv = avatarDecorator; this.dragController = dragController; widget = uiBinder.createAndBindUi(this); actions = new ActionSimplePanel(guiProvider, i18n); - notDrop.register(firstCategoryFlow); - notDrop.register(sndCategoryFlow); - notDrop.register(trdCategoryFlow); } @Override @@ -135,7 +133,8 @@ } public BasicDragableThumb createThumb(final String text, final String avatarUrl, final String tooltip, - final String tooltipTitle, final GuiActionDescCollection menuitems, final StateToken token) { + final String tooltipTitle, final GuiActionDescCollection menuitems, final StateToken token, + final boolean dragable) { final BasicDragableThumb thumb = new BasicDragableThumb(avatarUrl, AVATARSIZE, text, AVATARLABELMAXSIZE, false, token); @@ -161,7 +160,9 @@ thumb.addClickHandler(clickHand); thumb.setTooltip(tooltipTitle, tooltip); thumb.setLabelVisible(false); - dragController.makeDraggable(thumb); + if (dragable) { + dragController.makeDraggable(thumb); + } return thumb; } Modified: trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.ui.xml =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.ui.xml 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.ui.xml 2012-02-29 01:04:27 UTC (rev 1720) @@ -25,7 +25,7 @@ </g:FlowPanel> </g:north> <g:center> - <g:ScrollPanel width="100%" addStyleNames="k-sn-adminsscroll"> + <g:ScrollPanel width="100%" addStyleNames="k-sn-adminsscroll" ui:field="firstCategoryScroll"> <g:FlowPanel addStyleNames="k-sn-adminsflow" ui:field="firstCategoryFlow" /> </g:ScrollPanel> Added: trunk/src/main/java/cc/kune/core/client/sn/AdminsGroupSNDropController.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/AdminsGroupSNDropController.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/sn/AdminsGroupSNDropController.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -0,0 +1,21 @@ +package cc.kune.core.client.sn; + +import cc.kune.common.shared.i18n.I18nTranslationService; +import cc.kune.core.client.dnd.KuneDragController; +import cc.kune.core.client.rpcservices.ContentServiceAsync; +import cc.kune.core.client.sn.actions.SocialNetClientUtils; +import cc.kune.core.client.state.Session; +import cc.kune.core.shared.dto.SocialNetworkSubGroup; + +import com.google.inject.Inject; + +public class AdminsGroupSNDropController extends GroupSNDropController { + + @Inject + public AdminsGroupSNDropController(final KuneDragController dragController, + final ContentServiceAsync contentService, final Session session, + final I18nTranslationService i18n, final SocialNetClientUtils sNClientUtils) { + super(dragController, SocialNetworkSubGroup.admins, contentService, session, i18n, sNClientUtils); + } + +} Added: trunk/src/main/java/cc/kune/core/client/sn/AllMembersGroupSNDropController.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/AllMembersGroupSNDropController.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/sn/AllMembersGroupSNDropController.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -0,0 +1,21 @@ +package cc.kune.core.client.sn; + +import cc.kune.common.shared.i18n.I18nTranslationService; +import cc.kune.core.client.dnd.KuneDragController; +import cc.kune.core.client.rpcservices.ContentServiceAsync; +import cc.kune.core.client.sn.actions.SocialNetClientUtils; +import cc.kune.core.client.state.Session; +import cc.kune.core.shared.dto.SocialNetworkSubGroup; + +import com.google.inject.Inject; + +public class AllMembersGroupSNDropController extends GroupSNDropController { + + @Inject + public AllMembersGroupSNDropController(final KuneDragController dragController, + final ContentServiceAsync contentService, final Session session, + final I18nTranslationService i18n, final SocialNetClientUtils sNClientUtils) { + super(dragController, SocialNetworkSubGroup.all, contentService, session, i18n, sNClientUtils); + } + +} Added: trunk/src/main/java/cc/kune/core/client/sn/CollabsGroupSNDropController.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/CollabsGroupSNDropController.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/sn/CollabsGroupSNDropController.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -0,0 +1,21 @@ +package cc.kune.core.client.sn; + +import cc.kune.common.shared.i18n.I18nTranslationService; +import cc.kune.core.client.dnd.KuneDragController; +import cc.kune.core.client.rpcservices.ContentServiceAsync; +import cc.kune.core.client.sn.actions.SocialNetClientUtils; +import cc.kune.core.client.state.Session; +import cc.kune.core.shared.dto.SocialNetworkSubGroup; + +import com.google.inject.Inject; + +public class CollabsGroupSNDropController extends GroupSNDropController { + + @Inject + public CollabsGroupSNDropController(final KuneDragController dragController, + final ContentServiceAsync contentService, final Session session, + final I18nTranslationService i18n, final SocialNetClientUtils sNClientUtils) { + super(dragController, SocialNetworkSubGroup.collabs, contentService, session, i18n, sNClientUtils); + } + +} Added: trunk/src/main/java/cc/kune/core/client/sn/GroupSNDropController.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/GroupSNDropController.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/sn/GroupSNDropController.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -0,0 +1,78 @@ +package cc.kune.core.client.sn; + +import cc.kune.common.client.notify.NotifyUser; +import cc.kune.common.shared.i18n.I18nTranslationService; +import cc.kune.core.client.dnd.AbstractDropController; +import cc.kune.core.client.dnd.KuneDragController; +import cc.kune.core.client.rpcservices.AsyncCallbackSimple; +import cc.kune.core.client.rpcservices.ContentServiceAsync; +import cc.kune.core.client.sn.actions.SocialNetClientUtils; +import cc.kune.core.client.state.Session; +import cc.kune.core.client.ui.BasicDragableThumb; +import cc.kune.core.shared.dto.SocialNetworkSubGroup; +import cc.kune.gspace.client.viewers.items.FolderItemWidget; + +import com.allen_sauer.gwt.dnd.client.VetoDragException; +import com.allen_sauer.gwt.dnd.client.drop.SimpleDropController; +import com.google.gwt.user.client.ui.Widget; + +public class GroupSNDropController extends AbstractDropController { + + private final ContentServiceAsync contentService; + private final I18nTranslationService i18n; + private final Session session; + private final SocialNetClientUtils sNClientUtils; + private final SocialNetworkSubGroup subGroup; + + public GroupSNDropController(final KuneDragController dragController, + final SocialNetworkSubGroup subGroup, final ContentServiceAsync contentService, + final Session session, final I18nTranslationService i18n, final SocialNetClientUtils sNClientUtils) { + super(dragController); + this.subGroup = subGroup; + this.contentService = contentService; + this.session = session; + this.i18n = i18n; + this.sNClientUtils = sNClientUtils; + registerType(FolderItemWidget.class); + registerType(BasicDragableThumb.class); + } + + @Override + public void onDropAllowed(final Widget widget, final SimpleDropController dropController) { + if (widget instanceof FolderItemWidget) { + contentService.addParticipants(session.getUserHash(), ((FolderItemWidget) widget).getToken(), + session.getCurrentGroupShortName(), subGroup, new AsyncCallbackSimple<Boolean>() { + @Override + public void onSuccess(final Boolean result) { + NotifyUser.info(result ? i18n.t("Shared with members") + : i18n.t("All these members are already partipating")); + } + }); + } + if (widget instanceof BasicDragableThumb) { + final String shortName = ((BasicDragableThumb) widget).getToken().getGroup(); + if (subGroup.equals(SocialNetworkSubGroup.admins)) { + sNClientUtils.changeToAdmin(shortName); + } + if (subGroup.equals(SocialNetworkSubGroup.collabs)) { + sNClientUtils.changeToCollab(shortName); + } + } + } + + @Override + public void onPreviewAllowed(final Widget widget, final SimpleDropController dropController) + throws VetoDragException { + if (widget instanceof FolderItemWidget) { + if (!((FolderItemWidget) widget).getToken().isComplete()) { + throw new VetoDragException(); + } + } + if (widget instanceof BasicDragableThumb) { + if (!session.getCurrentState().getGroupRights().isAdministrable()) { + throw new VetoDragException(); + } + } + super.onPreviewAllowed(widget, dropController); + } +} Modified: trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -26,7 +26,6 @@ import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.avatar.SmallAvatarDecorator; import cc.kune.core.client.dnd.KuneDragController; -import cc.kune.core.client.dnd.NotImplementedDropManager; import cc.kune.core.client.sn.GroupSNPresenter.GroupSNView; import cc.kune.core.client.ui.BasicDragableThumb; import cc.kune.core.shared.dto.GroupDTO; @@ -41,8 +40,10 @@ @Inject public GroupSNPanel(final I18nTranslationService i18n, final GuiProvider guiProvider, final GSpaceArmor armor, final Provider<SmallAvatarDecorator> avatarDecorator, - final KuneDragController dragController, final NotImplementedDropManager notDrop) { - super(i18n, guiProvider, armor, avatarDecorator, dragController, notDrop); + final KuneDragController dragController, final AdminsGroupSNDropController adminsDropController, + final CollabsGroupSNDropController collabsDropController, + final AllMembersGroupSNDropController allMembersDropController) { + super(i18n, guiProvider, armor, avatarDecorator, dragController); setVisibleImpl(false); mainTitle.setText(i18n.t("Group members")); Tooltip.to(mainTitle, i18n.t("Users and groups collaborating in this group")); @@ -60,31 +61,36 @@ bottomActionsToolbar.setStyleName("k-sn-bottomPanel-actions"); armor.getEntityToolsNorth().add(widget); deck.showWidget(2); + adminsDropController.init(firstCategoryScroll); + adminsDropController.init(firstCategoryLabel); + collabsDropController.init(sndCategoryScroll); + collabsDropController.init(sndCategoryLabel); + allMembersDropController.init(mainTitle); } @Override public void addAdmin(final GroupDTO group, final String avatarUrl, final String tooltip, - final String tooltipTitle, final GuiActionDescCollection menu) { + final String tooltipTitle, final GuiActionDescCollection menu, final boolean dragable) { final BasicDragableThumb thumb = createThumb(group.getCompoundName(), avatarUrl, tooltip, - tooltipTitle, menu, group.getStateToken()); + tooltipTitle, menu, group.getStateToken(), dragable); firstCategoryFlow.add(group.isPersonal() ? (Widget) decorateAvatarWithXmppStatus( group.getShortName(), thumb) : thumb); } @Override public void addCollab(final GroupDTO group, final String avatarUrl, final String tooltip, - final String tooltipTitle, final GuiActionDescCollection menu) { + final String tooltipTitle, final GuiActionDescCollection menu, final boolean dragable) { final BasicDragableThumb thumb = createThumb(group.getCompoundName(), avatarUrl, tooltip, - tooltipTitle, menu, group.getStateToken()); + tooltipTitle, menu, group.getStateToken(), dragable); sndCategoryFlow.add(group.isPersonal() ? (Widget) decorateAvatarWithXmppStatus(group.getShortName(), thumb) : thumb); } @Override public void addPending(final GroupDTO group, final String avatarUrl, final String tooltip, - final String tooltipTitle, final GuiActionDescCollection menu) { + final String tooltipTitle, final GuiActionDescCollection menu, final boolean dragable) { final BasicDragableThumb thumb = createThumb(group.getCompoundName(), avatarUrl, tooltip, - tooltipTitle, menu, group.getStateToken()); + tooltipTitle, menu, group.getStateToken(), dragable); trdCategoryFlow.add(thumb); } Modified: trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -60,13 +60,13 @@ public interface GroupSNView extends View { void addAdmin(GroupDTO group, String avatarUrl, String tooltip, String tooltipTitle, - GuiActionDescCollection menu); + GuiActionDescCollection menu, boolean dragable); void addCollab(GroupDTO group, String avatarUrl, String tooltip, String tooltipTitle, - GuiActionDescCollection menu); + GuiActionDescCollection menu, boolean dragable); void addPending(GroupDTO group, String avatarUrl, String tooltip, String tooltipTitle, - GuiActionDescCollection menu); + GuiActionDescCollection menu, boolean dragable); void clear(); @@ -199,19 +199,20 @@ getView().showOrphan(); } else { final boolean userIsAdmin = rights.isAdministrable(); + final boolean userIsEditor = rights.isEditable(); final boolean userCanView = rights.isVisible(); getView().setAdminsVisible(true, areMany(numAdmins)); if (userCanView) { for (final GroupDTO admin : adminsList) { final String avatar = getAvatar(admin); getView().addAdmin(admin, avatar, admin.getCompoundName(), "", - createMenuItems(admin, adminsMenuItemsRegistry, admin.getCompoundName())); + createMenuItems(admin, adminsMenuItemsRegistry, admin.getCompoundName()), userIsEditor); } getView().setCollabsVisible(numCollabs > 0, areMany(numCollabs)); for (final GroupDTO collab : collabList) { final String avatar = getAvatar(collab); getView().addCollab(collab, avatar, collab.getCompoundName(), "", - createMenuItems(collab, collabsMenuItemsRegistry, collab.getCompoundName())); + createMenuItems(collab, collabsMenuItemsRegistry, collab.getCompoundName()), userIsEditor); } if (userIsAdmin) { getView().setPendingVisible(numPendings > 0, areMany(numPendings)); @@ -223,7 +224,7 @@ pendingCollab.getCompoundName(), "", createMenuItems(pendingCollab, pendingsMenuItemsRegistry, - pendingCollab.getCompoundName())); + pendingCollab.getCompoundName()), userIsEditor); } } else { getView().setPendingVisible(false, false); Modified: trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -48,7 +48,7 @@ public UserSNPanel(final I18nTranslationService i18n, final GuiProvider guiProvider, final GSpaceArmor armor, final Provider<SmallAvatarDecorator> avatarDecorator, final KuneDragController dragController, final NotImplementedDropManager notDrop) { - super(i18n, guiProvider, armor, avatarDecorator, dragController, notDrop); + super(i18n, guiProvider, armor, avatarDecorator, dragController); this.i18n = i18n; setVisibleImpl(false); @@ -71,21 +71,24 @@ noBuddies.addStyleName("kune-Margin-Medium-l"); noPublic = new Label(i18n.t(CoreMessages.BUDDIES_NOT_PUBLIC)); noPublic.addStyleName("kune-Margin-Medium-l"); + notDrop.register(firstCategoryScroll); + notDrop.register(sndCategoryScroll); + notDrop.register(trdCategoryScroll); } @Override public void addBuddie(final UserSimpleDTO user, final String avatarUrl, final String tooltip, - final String tooltipTitle, final GuiActionDescCollection menu) { + final String tooltipTitle, final GuiActionDescCollection menu, final boolean dragable) { final BasicDragableThumb thumb = createThumb(user.getShortName(), avatarUrl, tooltip, tooltipTitle, - menu, user.getStateToken()); + menu, user.getStateToken(), dragable); firstCategoryFlow.add((Widget) decorateAvatarWithXmppStatus(user.getShortName(), thumb)); } @Override public void addParticipation(final GroupDTO group, final String avatarUrl, final String tooltip, - final String tooltipTitle, final GuiActionDescCollection menu) { + final String tooltipTitle, final GuiActionDescCollection menu, final boolean dragable) { sndCategoryFlow.add(createThumb(group.getCompoundName(), avatarUrl, tooltip, tooltipTitle, menu, - group.getStateToken())); + group.getStateToken(), dragable)); } @Override Modified: trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -60,10 +60,10 @@ public interface UserSNView extends View { void addBuddie(UserSimpleDTO user, String avatarUrl, String tooltip, String tooltipTitle, - GuiActionDescCollection menu); + GuiActionDescCollection menu, boolean dragable); void addParticipation(GroupDTO group, String avatarUrl, String tooltip, String tooltipTitle, - GuiActionDescCollection menu); + GuiActionDescCollection menu, boolean dragable); void addTextToBuddieList(String text); @@ -180,7 +180,8 @@ for (final UserSimpleDTO user : buddies) { final String avatarUrl = downloadProvider.get().getUserAvatar(user); getView().addBuddie(user, avatarUrl, user.getCompoundName(), "", - createMenuItems(user, userMenuItemsRegistry, user.getCompoundName())); + createMenuItems(user, userMenuItemsRegistry, user.getCompoundName()), + state.getGroupRights().isAdministrable()); } final boolean hasLocalBuddies = buddies.size() > 0; final int numExtBuddies = userBuddiesData.getOtherExtBuddies(); @@ -212,11 +213,13 @@ final int numCollaborators = groupsIsCollab.size(); for (final GroupDTO group : groupsIsAdmin) { getView().addParticipation(group, getAvatar(group), group.getCompoundName(), "", - createMenuItems(group, userMenuItemsRegistry, group.getCompoundName())); + createMenuItems(group, userMenuItemsRegistry, group.getCompoundName()), + state.getGroupRights().isAdministrable()); } for (final GroupDTO group : groupsIsCollab) { getView().addParticipation(group, getAvatar(group), group.getCompoundName(), "", - createMenuItems(group, userMenuItemsRegistry, group.getCompoundName())); + createMenuItems(group, userMenuItemsRegistry, group.getCompoundName()), + state.getGroupRights().isAdministrable()); } final int totalGroups = numAdmins + numCollaborators; // getView().setParticipationCount(totalGroups); Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToAdminAction.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToAdminAction.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToAdminAction.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -22,50 +22,26 @@ import cc.kune.common.client.actions.AbstractExtendedAction; import cc.kune.common.client.actions.Action; import cc.kune.common.client.actions.ActionEvent; -import cc.kune.common.client.notify.NotifyUser; import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.resources.CoreResources; -import cc.kune.core.client.rpcservices.AsyncCallbackSimple; -import cc.kune.core.client.rpcservices.SocialNetworkServiceAsync; -import cc.kune.core.client.state.Session; -import cc.kune.core.client.state.StateManager; import cc.kune.core.shared.dto.GroupDTO; -import cc.kune.core.shared.dto.SocialNetworkDataDTO; import com.google.inject.Inject; -import com.google.inject.Provider; public class ChangeToAdminAction extends AbstractExtendedAction { - private final I18nTranslationService i18n; - private final Session session; - private final Provider<SocialNetworkServiceAsync> snServiceProvider; - private final StateManager stateManager; + private final SocialNetClientUtils snClientUtils; @Inject - public ChangeToAdminAction(final StateManager stateManager, final Session session, - final I18nTranslationService i18n, final CoreResources res, - final Provider<SocialNetworkServiceAsync> snServiceProvider) { - this.stateManager = stateManager; - this.session = session; - this.i18n = i18n; - this.snServiceProvider = snServiceProvider; + public ChangeToAdminAction(final I18nTranslationService i18n, final CoreResources res, + final SocialNetClientUtils snClientUtils) { + this.snClientUtils = snClientUtils; putValue(NAME, i18n.t("Change to administrator")); putValue(Action.SMALL_ICON, res.arrowUpGreen()); } @Override public void actionPerformed(final ActionEvent event) { - NotifyUser.showProgress(); - snServiceProvider.get().setCollabAsAdmin(session.getUserHash(), - session.getCurrentState().getStateToken(), ((GroupDTO) event.getTarget()).getShortName(), - new AsyncCallbackSimple<SocialNetworkDataDTO>() { - @Override - public void onSuccess(final SocialNetworkDataDTO result) { - NotifyUser.hideProgress(); - NotifyUser.info(i18n.t("Member type changed")); - stateManager.setSocialNetwork(result); - } - }); + snClientUtils.changeToAdmin(((GroupDTO) event.getTarget()).getShortName()); } } \ No newline at end of file Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToCollabAction.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToCollabAction.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToCollabAction.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -22,50 +22,26 @@ import cc.kune.common.client.actions.AbstractExtendedAction; import cc.kune.common.client.actions.Action; import cc.kune.common.client.actions.ActionEvent; -import cc.kune.common.client.notify.NotifyUser; import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.resources.CoreResources; -import cc.kune.core.client.rpcservices.AsyncCallbackSimple; -import cc.kune.core.client.rpcservices.SocialNetworkServiceAsync; -import cc.kune.core.client.state.Session; -import cc.kune.core.client.state.StateManager; import cc.kune.core.shared.dto.GroupDTO; -import cc.kune.core.shared.dto.SocialNetworkDataDTO; import com.google.inject.Inject; -import com.google.inject.Provider; public class ChangeToCollabAction extends AbstractExtendedAction { - private final I18nTranslationService i18n; - private final Session session; - private final Provider<SocialNetworkServiceAsync> snServiceProvider; - private final StateManager stateManager; + private final SocialNetClientUtils sNClientUtils; @Inject - public ChangeToCollabAction(final StateManager stateManager, final Session session, - final I18nTranslationService i18n, final CoreResources res, - final Provider<SocialNetworkServiceAsync> snServiceProvider) { - this.stateManager = stateManager; - this.session = session; - this.i18n = i18n; - this.snServiceProvider = snServiceProvider; + public ChangeToCollabAction(final I18nTranslationService i18n, final CoreResources res, + final SocialNetClientUtils sNClientUtils) { + this.sNClientUtils = sNClientUtils; putValue(NAME, i18n.t("Change to collaborator")); putValue(Action.SMALL_ICON, res.arrowDownGreen()); } @Override public void actionPerformed(final ActionEvent event) { - NotifyUser.showProgress(); - snServiceProvider.get().setAdminAsCollab(session.getUserHash(), - session.getCurrentState().getStateToken(), ((GroupDTO) event.getTarget()).getShortName(), - new AsyncCallbackSimple<SocialNetworkDataDTO>() { - @Override - public void onSuccess(final SocialNetworkDataDTO result) { - NotifyUser.hideProgress(); - NotifyUser.info(i18n.t("Member type changed")); - stateManager.setSocialNetwork(result); - } - }); + sNClientUtils.changeToCollab(((GroupDTO) event.getTarget()).getShortName()); } } \ No newline at end of file Added: trunk/src/main/java/cc/kune/core/client/sn/actions/SocialNetClientUtils.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/actions/SocialNetClientUtils.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/sn/actions/SocialNetClientUtils.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -0,0 +1,59 @@ +package cc.kune.core.client.sn.actions; + +import cc.kune.common.client.notify.NotifyUser; +import cc.kune.common.shared.i18n.I18nTranslationService; +import cc.kune.core.client.rpcservices.AsyncCallbackSimple; +import cc.kune.core.client.rpcservices.SocialNetworkServiceAsync; +import cc.kune.core.client.state.Session; +import cc.kune.core.client.state.StateManager; +import cc.kune.core.shared.dto.SocialNetworkDataDTO; + +import com.google.inject.Inject; +import com.google.inject.Provider; + +public class SocialNetClientUtils { + + private final I18nTranslationService i18n; + private final Session session; + private final Provider<SocialNetworkServiceAsync> snServiceProvider; + private final StateManager stateManager; + + @Inject + public SocialNetClientUtils(final StateManager stateManager, final Session session, + final I18nTranslationService i18n, final Provider<SocialNetworkServiceAsync> snServiceProvider) { + this.stateManager = stateManager; + this.session = session; + this.i18n = i18n; + this.snServiceProvider = snServiceProvider; + } + + public void changeToAdmin(final String shortName) { + NotifyUser.showProgress(); + snServiceProvider.get().setCollabAsAdmin(session.getUserHash(), + session.getCurrentState().getStateToken(), shortName, + new AsyncCallbackSimple<SocialNetworkDataDTO>() { + @Override + public void onSuccess(final SocialNetworkDataDTO result) { + SocialNetClientUtils.this.onSuccess(result); + } + }); + } + + public void changeToCollab(final String shortName) { + NotifyUser.showProgress(); + snServiceProvider.get().setAdminAsCollab(session.getUserHash(), + session.getCurrentState().getStateToken(), shortName, + new AsyncCallbackSimple<SocialNetworkDataDTO>() { + @Override + public void onSuccess(final SocialNetworkDataDTO result) { + SocialNetClientUtils.this.onSuccess(result); + } + }); + } + + private void onSuccess(final SocialNetworkDataDTO result) { + NotifyUser.hideProgress(); + NotifyUser.info(i18n.t("Member type changed")); + stateManager.setSocialNetwork(result); + } +} Modified: trunk/src/main/java/cc/kune/core/public/ws.css =================================================================== --- trunk/src/main/java/cc/kune/core/public/ws.css 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/public/ws.css 2012-02-29 01:04:27 UTC (rev 1720) @@ -820,7 +820,7 @@ } .k-sn-maintitle { - margin: 5px; + margin: 3px; } .k-sn-maintitle { Modified: trunk/src/main/java/cc/kune/core/server/KuneRackModule.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/KuneRackModule.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/server/KuneRackModule.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -43,6 +43,7 @@ import cc.kune.core.server.manager.file.FileGwtUploadServlet; import cc.kune.core.server.manager.file.FileUploadManager; import cc.kune.core.server.manager.file.UserLogoDownloadManager; +import cc.kune.core.server.manager.impl.GroupServerUtils; import cc.kune.core.server.properties.KuneProperties; import cc.kune.core.server.properties.KunePropertiesDefault; import cc.kune.core.server.rack.RackBuilder; @@ -127,6 +128,7 @@ // http://code.google.com/p/google-gin/issues/detail?id=60 requestStaticInjection(KuneWaveServerUtils.class); requestStaticInjection(CalendarServerUtils.class); + requestStaticInjection(GroupServerUtils.class); } }; } Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManager.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/content/ContentManager.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/server/content/ContentManager.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -27,8 +27,10 @@ import cc.kune.core.server.manager.SearchResult; import cc.kune.core.shared.domain.ContentStatus; import cc.kune.core.shared.domain.RateResult; +import cc.kune.core.shared.dto.SocialNetworkSubGroup; import cc.kune.domain.Container; import cc.kune.domain.Content; +import cc.kune.domain.Group; import cc.kune.domain.I18nLanguage; import cc.kune.domain.User; @@ -51,6 +53,8 @@ boolean addParticipant(User user, Long contentId, String participant); + boolean addParticipants(User user, Long contentId, Group group, SocialNetworkSubGroup whichOnes); + Content createGadget(User user, Container container, String gadgetname, String typeIdChild, String title, String body, Map<String, String> gadgetProperties); Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -23,8 +23,10 @@ import java.net.URL; import java.util.Collections; import java.util.Date; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import javax.persistence.EntityManager; @@ -49,14 +51,17 @@ import cc.kune.core.server.manager.TagUserContentManager; import cc.kune.core.server.manager.file.FileUtils; import cc.kune.core.server.manager.impl.DefaultManager; +import cc.kune.core.server.manager.impl.GroupServerUtils; import cc.kune.core.server.manager.impl.ServerManagerException; import cc.kune.core.server.tool.ServerTool; import cc.kune.core.server.tool.ServerToolRegistry; import cc.kune.core.server.utils.FilenameUtils; import cc.kune.core.shared.domain.ContentStatus; import cc.kune.core.shared.domain.RateResult; +import cc.kune.core.shared.dto.SocialNetworkSubGroup; import cc.kune.domain.Container; import cc.kune.domain.Content; +import cc.kune.domain.Group; import cc.kune.domain.I18nLanguage; import cc.kune.domain.Rate; import cc.kune.domain.Revision; @@ -132,13 +137,37 @@ @Override public boolean addParticipant(final User user, final Long contentId, final String participant) { final Content content = finder.getContent(contentId); + return addParticipants(user, content, participant); + } + + /** + * Adds the participant to a wave + * + * @param user + * the user + * @param content + * the content + * @param participant + * the participant + * @return true, if successful added (not already participant) + */ + private boolean addParticipants(final User user, final Content content, final String... participants) { if (content.isWave()) { return kuneWaveManager.addParticipants(KuneWaveServerUtils.getWaveRef(content), - getContentAuthor(content), user.getShortName(), participant); + getContentAuthor(content), user.getShortName(), participants); } return false; } + @Override + public boolean addParticipants(final User user, final Long contentId, final Group group, + final SocialNetworkSubGroup whichOnes) { + final Set<String> members = new HashSet<String>(); + GroupServerUtils.getAllUserMembersAsString(members, group, SocialNetworkSubGroup.admins); + final Content content = finder.getContent(contentId); + return addParticipants(user, content, members.toArray(new String[members.size()])); + } + protected Content createContent(final String title, final String body, final User author, final Container container, final String typeId) { return createContent(title, body, author, container, typeId, KuneWaveService.WITHOUT_GADGET, Added: trunk/src/main/java/cc/kune/core/server/manager/impl/GroupServerUtils.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/manager/impl/GroupServerUtils.java (rev 0) +++ trunk/src/main/java/cc/kune/core/server/manager/impl/GroupServerUtils.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -0,0 +1,68 @@ +package cc.kune.core.server.manager.impl; + +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.Set; + +import javax.persistence.NoResultException; + +import cc.kune.core.shared.dto.SocialNetworkSubGroup; +import cc.kune.domain.Group; +import cc.kune.domain.User; +import cc.kune.domain.finders.UserFinder; + +import com.google.inject.Inject; + +public class GroupServerUtils { + @Inject + private static UserFinder userFinder; + + public static void getAllUserMembers(final Set<User> users, final Group ofGroup, + final SocialNetworkSubGroup subGroup) { + final Collection<Group> members = GroupServerUtils.getGroupMembers(ofGroup, subGroup); + for (final Group member : members) { + if (member.isPersonal()) { + final String shortName = member.getShortName(); + try { + final User user = userFinder.findByShortName(shortName); + users.add(user); + } catch (final NoResultException e) { + } + } else { + // Is a group, so go recursively + getAllUserMembers(users, member, subGroup); + } + } + } + + public static void getAllUserMembersAsString(final Set<String> users, final Group ofGroup, + final SocialNetworkSubGroup subGroup) { + final Collection<Group> members = GroupServerUtils.getGroupMembers(ofGroup, subGroup); + for (final Group member : members) { + if (member.isPersonal()) { + final String shortName = member.getShortName(); + try { + users.add(shortName); + } catch (final NoResultException e) { + } + } else { + // Is a group, so go recursively + getAllUserMembersAsString(users, member, subGroup); + } + } + } + + public static final Collection<Group> getGroupMembers(final Group ofGroup, + final SocialNetworkSubGroup subGroup) { + final Collection<Group> members = new LinkedHashSet<Group>(); + if (subGroup.equals(SocialNetworkSubGroup.admins) || subGroup.equals(SocialNetworkSubGroup.all)) { + final Set<Group> admins = ofGroup.getSocialNetwork().getAccessLists().getAdmins().getList(); + members.addAll(admins); + } + if (subGroup.equals(SocialNetworkSubGroup.collabs) || subGroup.equals(SocialNetworkSubGroup.all)) { + final Set<Group> collabs = ofGroup.getSocialNetwork().getAccessLists().getEditors().getList(); + members.addAll(collabs); + } + return members; + } +} Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/KuneWaveManagerDefault.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/manager/impl/KuneWaveManagerDefault.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/server/manager/impl/KuneWaveManagerDefault.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -20,7 +20,7 @@ package cc.kune.core.server.manager.impl; import java.util.ArrayList; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Set; @@ -32,10 +32,12 @@ import cc.kune.core.server.manager.UserManager; import cc.kune.core.server.properties.KuneProperties; import cc.kune.core.shared.domain.AccessRol; +import cc.kune.core.shared.dto.SocialNetworkSubGroup; import cc.kune.domain.Group; import cc.kune.domain.User; import cc.kune.domain.UserBuddiesData; import cc.kune.domain.finders.GroupFinder; +import cc.kune.domain.finders.UserFinder; import cc.kune.wave.server.KuneWaveServerUtils; import cc.kune.wave.server.ParticipantUtils; import cc.kune.wave.server.kspecific.KuneWaveService; @@ -49,17 +51,19 @@ private final GroupFinder groupFinder; private final KuneProperties kuneProperties; private final ParticipantUtils participantUtils; + private final UserFinder userFinder; private final UserManager userManager; private final KuneWaveService waveService; @Inject public KuneWaveManagerDefault(final KuneWaveService waveService, final ParticipantUtils participantUtils, final KuneProperties kuneProperties, - final GroupFinder groupFinder, final UserManager userManager) { + final GroupFinder groupFinder, final UserFinder userFinder, final UserManager userManager) { this.waveService = waveService; this.participantUtils = participantUtils; this.kuneProperties = kuneProperties; this.groupFinder = groupFinder; + this.userFinder = userFinder; this.userManager = userManager; } @@ -71,8 +75,8 @@ for (final String part : participants) { partIds.add(participantUtils.of(part)); } - return KuneWaveServerUtils.getUrl(waveService.createWave(title, body, KuneWaveService.DO_NOTHING_CBACK, - partIds.toArray(new ParticipantId[0]))); + return KuneWaveServerUtils.getUrl(waveService.createWave(title, body, + KuneWaveService.DO_NOTHING_CBACK, partIds.toArray(new ParticipantId[0]))); } @Override @@ -84,12 +88,12 @@ public String writeTo(final User user, final String groupName, final boolean onlyToAdmins, final String title, final String message) { final Group group = groupFinder.findByShortName(groupName); - final Set<Group> toList = new HashSet<Group>(); - toList.add(user.getUserGroup()); + final Set<User> toList = new LinkedHashSet<User>(); + toList.add(user); if (group.isPersonal()) { final UserBuddiesData userBuddies = userManager.getUserBuddies(groupName); if (userBuddies.contains(user.getShortName())) { - toList.add(group); + toList.add(userFinder.findByShortName(group.getShortName())); } else { throw new AccessViolationException("You cannot write to non buddies"); } @@ -97,14 +101,10 @@ if (!AccessRightsUtils.correctMember(user, group, AccessRol.Editor)) { throw new AccessViolationException("You cannot write because you are not a member"); } - if (onlyToAdmins) { - toList.addAll(group.getSocialNetwork().getAccessLists().getAdmins().getList()); - } else { - toList.addAll(group.getSocialNetwork().getAccessLists().getAdmins().getList()); - toList.addAll(group.getSocialNetwork().getAccessLists().getEditors().getList()); - } + GroupServerUtils.getAllUserMembers(toList, group, onlyToAdmins ? SocialNetworkSubGroup.admins + : SocialNetworkSubGroup.all); } - return KuneWaveServerUtils.getUrl(waveService.createWave(title, message, KuneWaveService.DO_NOTHING_CBACK, - participantUtils.listFrom(toList))); + return KuneWaveServerUtils.getUrl(waveService.createWave(title, message, + KuneWaveService.DO_NOTHING_CBACK, participantUtils.listFrom(toList))); } } Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/SocialNetworkManagerDefault.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/manager/impl/SocialNetworkManagerDefault.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/server/manager/impl/SocialNetworkManagerDefault.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -27,6 +27,7 @@ import cc.kune.core.client.errors.AlreadyGroupMemberException; import cc.kune.core.client.errors.AlreadyUserMemberException; import cc.kune.core.client.errors.DefaultException; +import cc.kune.core.client.errors.InvalidSNOperationException; import cc.kune.core.client.errors.LastAdminInGroupException; import cc.kune.core.client.errors.UserMustBeLoggedException; import cc.kune.core.server.access.AccessRightsService; @@ -314,7 +315,7 @@ sn.removeAdmin(group); sn.addCollaborator(group); } else { - throw new DefaultException("Person/Group is not an admin"); + throw new InvalidSNOperationException("Person/Group is not an admin"); } } @@ -327,7 +328,7 @@ sn.removeCollaborator(group); sn.addAdmin(group); } else { - throw new DefaultException("Person/Group is not a collaborator"); + throw new InvalidSNOperationException("Person/Group is not a collaborator"); } } Modified: trunk/src/main/java/cc/kune/core/server/notifier/NotificationSender.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/notifier/NotificationSender.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/server/notifier/NotificationSender.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -1,6 +1,6 @@ package cc.kune.core.server.notifier; -import cc.kune.core.shared.domain.dto.EmailNotificationFrequency; +import cc.kune.core.shared.dto.EmailNotificationFrequency; /** * The Interface PendingNotificationSender. Used to send pending notifications Modified: trunk/src/main/java/cc/kune/core/server/notifier/NotificationSenderDefault.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/notifier/NotificationSenderDefault.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/server/notifier/NotificationSenderDefault.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -13,7 +13,7 @@ import cc.kune.core.server.mail.MailService; import cc.kune.core.server.properties.KuneProperties; import cc.kune.core.server.xmpp.XmppManager; -import cc.kune.core.shared.domain.dto.EmailNotificationFrequency; +import cc.kune.core.shared.dto.EmailNotificationFrequency; import cc.kune.domain.User; import cc.kune.wave.server.kspecific.KuneWaveService; Modified: trunk/src/main/java/cc/kune/core/server/notifier/NotificationService.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/notifier/NotificationService.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/server/notifier/NotificationService.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -4,16 +4,14 @@ import java.util.HashSet; import java.util.Set; -import javax.persistence.NoResultException; - -import org.apache.commons.collections.CollectionUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import cc.kune.core.server.mail.FormatedString; +import cc.kune.core.server.manager.impl.GroupServerUtils; +import cc.kune.core.shared.dto.SocialNetworkSubGroup; import cc.kune.domain.Group; import cc.kune.domain.User; -import cc.kune.domain.finders.UserFinder; import com.google.inject.Inject; import com.google.inject.Singleton; @@ -24,59 +22,28 @@ public static final Log LOG = LogFactory.getLog(NotificationService.class); private final NotificationHtmlHelper helper; private final PendingNotificationSender sender; - private final UserFinder userFinder; @Inject - NotificationService(final PendingNotificationSender sender, final NotificationHtmlHelper helper, - final UserFinder userFinder) { + NotificationService(final PendingNotificationSender sender, final NotificationHtmlHelper helper) { this.sender = sender; this.helper = helper; - this.userFinder = userFinder; } private FormatedString createPlainSubject(final String subject) { return FormatedString.build(subject); } - @SuppressWarnings("unchecked") - private void getAllUserMembers(final Set<User> users, final Group groupToNotify, - final boolean onlyAdmins) { - final Collection<Group> members; - final Set<Group> admins = groupToNotify.getSocialNetwork().getAccessLists().getAdmins().getList(); - if (onlyAdmins) { - members = admins; - } else { - final Set<Group> collabs = groupToNotify.getSocialNetwork().getAccessLists().getEditors().getList(); - members = CollectionUtils.union(admins, collabs); - } - for (final Group member : members) { - if (member.isPersonal()) { - final String shortName = member.getShortName(); - try { - final User user = userFinder.findByShortName(shortName); - users.add(user); - } catch (final NoResultException e) { - LOG.error(String.format("This personal group %s is not a local user", shortName)); - } - } else { - // Is a group, so go recursively - getAllUserMembers(users, member, onlyAdmins); - } - } - - } - public void notifyGroup(final Group groupToNotify, final Group groupSender, final String subject, final String message) { final Set<User> members = new HashSet<User>(); - getAllUserMembers(members, groupToNotify, false); + GroupServerUtils.getAllUserMembers(members, groupToNotify, SocialNetworkSubGroup.all); notifyToAll(groupSender, subject, message, members); } public void notifyGroupAdmins(final Group groupToNotify, final Group groupSender, final String subject, final String message) { final Set<User> adminMembers = new HashSet<User>(); - getAllUserMembers(adminMembers, groupToNotify, true); + GroupServerUtils.getAllUserMembers(adminMembers, groupToNotify, SocialNetworkSubGroup.admins); notifyToAll(groupSender, subject, message, adminMembers); } Modified: trunk/src/main/java/cc/kune/core/server/notifier/PendingNotificationSender.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/notifier/PendingNotificationSender.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/server/notifier/PendingNotificationSender.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -4,7 +4,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; import cc.kune.core.server.mail.FormatedString; -import cc.kune.core.shared.domain.dto.EmailNotificationFrequency; +import cc.kune.core.shared.dto.EmailNotificationFrequency; import cc.kune.domain.User; import com.google.inject.Inject; Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -60,6 +60,7 @@ import cc.kune.core.shared.domain.utils.StateToken; import cc.kune.core.shared.dto.ContentSimpleDTO; import cc.kune.core.shared.dto.I18nLanguageDTO; +import cc.kune.core.shared.dto.SocialNetworkSubGroup; import cc.kune.core.shared.dto.StateAbstractDTO; import cc.kune.core.shared.dto.StateContainerDTO; import cc.kune.core.shared.dto.StateContentDTO; @@ -194,6 +195,18 @@ @Override @Authenticated + @Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = true) + @Transactional + public Boolean addParticipants(final String userHash, final StateToken token, final String groupName, + final SocialNetworkSubGroup subGroup) throws DefaultException { + final Long contentId = ContentUtils.parseId(token.getDocument()); + final Group group = groupManager.findByShortName(groupName); + final User user = getCurrentUser(); + return contentManager.addParticipants(user, contentId, group, subGroup); + } + + @Override + @Authenticated @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Administrator) @Transactional public StateContainerDTO addRoom(final String userHash, final StateToken parentToken, Deleted: trunk/src/main/java/cc/kune/core/shared/domain/dto/EmailNotificationFrequency.java =================================================================== --- trunk/src/main/java/cc/kune/core/shared/domain/dto/EmailNotificationFrequency.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/shared/domain/dto/EmailNotificationFrequency.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -1,29 +0,0 @@ -/* - * - * Copyright (C) 2007-2009 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.core.shared.domain.dto; - -import com.google.gwt.user.client.rpc.IsSerializable; - -public enum EmailNotificationFrequency implements IsSerializable { - daily, // at most daily, (not used yet) - hourly, // at most hourly (not used yet) - immediately, // almost immediately (currently used) - no // I don't need email notifications (currently used) -} Copied: trunk/src/main/java/cc/kune/core/shared/dto/EmailNotificationFrequency.java (from rev 1717, trunk/src/main/java/cc/kune/core/shared/domain/dto/EmailNotificationFrequency.java) =================================================================== --- trunk/src/main/java/cc/kune/core/shared/dto/EmailNotificationFrequency.java (rev 0) +++ trunk/src/main/java/cc/kune/core/shared/dto/EmailNotificationFrequency.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -0,0 +1,29 @@ +/* + * + * Copyright (C) 2007-2009 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.core.shared.dto; + +import com.google.gwt.user.client.rpc.IsSerializable; + +public enum EmailNotificationFrequency implements IsSerializable { + daily, // at most daily, (not used yet) + hourly, // at most hourly (not used yet) + immediately, // almost immediately (currently used) + no // I don't need email notifications (currently used) +} Added: trunk/src/main/java/cc/kune/core/shared/dto/SocialNetworkSubGroup.java =================================================================== --- trunk/src/main/java/cc/kune/core/shared/dto/SocialNetworkSubGroup.java (rev 0) +++ trunk/src/main/java/cc/kune/core/shared/dto/SocialNetworkSubGroup.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -0,0 +1,35 @@ +/* + * + * Copyright (C) 2007-2009 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.core.shared.dto; + +import com.google.gwt.user.client.rpc.IsSerializable; + +/** + * The Enum SocialNetworkSubGroup is a way to indicate a part of a group + * SNetwork. + */ +public enum SocialNetworkSubGroup implements IsSerializable { + /** The admins members only */ + admins, + /** all members */ + all, + /** The collabs members only */ + collabs +} Modified: trunk/src/main/java/cc/kune/core/shared/dto/UserDTO.java =================================================================== --- trunk/src/main/java/cc/kune/core/shared/dto/UserDTO.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/shared/dto/UserDTO.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -19,7 +19,6 @@ */ package cc.kune.core.shared.dto; -import cc.kune.core.shared.domain.dto.EmailNotificationFrequency; import com.google.gwt.user.client.rpc.IsSerializable; Modified: trunk/src/main/java/cc/kune/core/shared/dto/UserSimpleDTO.java =================================================================== --- trunk/src/main/java/cc/kune/core/shared/dto/UserSimpleDTO.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/core/shared/dto/UserSimpleDTO.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -19,7 +19,6 @@ */ package cc.kune.core.shared.dto; -import cc.kune.core.shared.domain.dto.EmailNotificationFrequency; import cc.kune.core.shared.domain.utils.StateToken; import com.google.gwt.user.client.rpc.IsSerializable; Modified: trunk/src/main/java/cc/kune/domain/User.java =================================================================== --- trunk/src/main/java/cc/kune/domain/User.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/domain/User.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -46,8 +46,8 @@ import org.hibernate.validator.Pattern; import cc.kune.core.shared.domain.UserSNetVisibility; -import cc.kune.core.shared.domain.dto.EmailNotificationFrequency; import cc.kune.core.shared.domain.utils.StateToken; +import cc.kune.core.shared.dto.EmailNotificationFrequency; import cc.kune.domain.utils.HasId; @Entity Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java =================================================================== --- trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -24,6 +24,9 @@ import cc.kune.core.client.dnd.FolderContentDropController; import cc.kune.core.client.sitebar.search.SitebarSearchPanel; import cc.kune.core.client.sitebar.search.SitebarSearchPresenter; +import cc.kune.core.client.sn.AdminsGroupSNDropController; +import cc.kune.core.client.sn.AllMembersGroupSNDropController; +import cc.kune.core.client.sn.CollabsGroupSNDropController; import cc.kune.core.client.sn.actions.WriteToBuddyHeaderButton; import cc.kune.gspace.client.actions.ContentViewerOptionsMenu; import cc.kune.gspace.client.actions.GiveUsFeedbackBtn; @@ -140,6 +143,9 @@ s(ContentDropController.class); s(FolderContainerDropController.class); s(FolderContentDropController.class); + s(AdminsGroupSNDropController.class); + s(CollabsGroupSNDropController.class); + s(AllMembersGroupSNDropController.class); bindPresenter(EntityLicensePresenter.class, EntityLicensePresenter.EntityLicenseView.class, EntityLicensePanel.class, EntityLicensePresenter.EntityLicenseProxy.class); bindPresenter(TagsSummaryPresenter.class, TagsSummaryPresenter.TagsSummaryView.class, Modified: trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPanel.java =================================================================== --- trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPanel.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPanel.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -24,7 +24,7 @@ import cc.kune.core.client.i18n.I18nUITranslationService; import cc.kune.core.client.resources.CoreResources; import cc.kune.core.client.ui.DefaultFormUtils; -import cc.kune.core.shared.domain.dto.EmailNotificationFrequency; +import cc.kune.core.shared.dto.EmailNotificationFrequency; import cc.kune.core.shared.dto.I18nLanguageSimpleDTO; import cc.kune.gspace.client.i18n.LanguageSelectorPanel; Modified: trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralView.java =================================================================== --- trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralView.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralView.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -19,7 +19,7 @@ */ package cc.kune.gspace.client.options.general; -import cc.kune.core.shared.domain.dto.EmailNotificationFrequency; +import cc.kune.core.shared.dto.EmailNotificationFrequency; import cc.kune.core.shared.dto.I18nLanguageSimpleDTO; import com.google.gwt.event.dom.client.HasClickHandlers; Modified: trunk/src/main/java/cc/kune/lists/client/ListsClientTool.java =================================================================== --- trunk/src/main/java/cc/kune/lists/client/ListsClientTool.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/lists/client/ListsClientTool.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -51,7 +51,7 @@ // registerAclEditableTypes(); registerAuthorableTypes(TYPE_POST); registerDragableTypes(); - registerDropableTypes(); + registerDropableTypes(TYPE_POST); registerPublishModerableTypes(); registerRateableTypes(TYPE_POST); registerRenamableTypes(TYPE_LIST, TYPE_POST); Modified: trunk/src/main/java/cc/kune/tasks/client/TasksClientTool.java =================================================================== --- trunk/src/main/java/cc/kune/tasks/client/TasksClientTool.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/tasks/client/TasksClientTool.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -53,7 +53,7 @@ // registerAclEditableTypes(); registerAuthorableTypes(TYPE_TASK); registerDragableTypes(TYPE_TASK, TYPE_FOLDER); - registerDropableTypes(TYPE_ROOT, TYPE_FOLDER); + registerDropableTypes(TYPE_ROOT, TYPE_FOLDER, TYPE_TASK); registerPublishModerableTypes(TYPE_TASK); registerRateableTypes(TYPE_TASK); registerRenamableTypes(TYPE_FOLDER, TYPE_TASK); Modified: trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java =================================================================== --- trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -28,7 +28,7 @@ import cc.kune.core.client.errors.DefaultException; import cc.kune.core.server.properties.KuneBasicProperties; -import cc.kune.domain.Group; +import cc.kune.domain.User; import com.google.inject.Inject; import com.google.inject.Singleton; @@ -68,9 +68,9 @@ return address.contains(getAtDomain()); } - public ParticipantId[] listFrom(final Set<Group> list) { + public ParticipantId[] listFrom(final Set<User> list) { final ParticipantId[] array = new ParticipantId[list.size()]; - final Iterator<Group> iterator = list.iterator(); + final Iterator<User> iterator = list.iterator(); for (int i = 0; i < list.size(); i++) { array[i] = of(iterator.next().getShortName()); } Modified: trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveServiceDefault.java =================================================================== --- trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveServiceDefault.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveServiceDefault.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -195,22 +195,22 @@ boolean added = false; final Wavelet wavelet = fetchWave(waveName, author); final Participants currentParticipants = wavelet.getParticipants(); - // Removing duplicates + final String whoAdd = wavelet.getParticipants().contains(participantUtils.of(userWhoAdds)) ? userWhoAdds + : author; + final OperationQueue opQueue = new OperationQueue(); for (final String participant : toSet(newLocalParticipants)) { final String newPartWithDomain = participantUtils.of(participant).toString(); + // Removing duplicates if (!currentParticipants.contains(newPartWithDomain)) { // FIXME This is very costly. Seems like only one participant per // opQueue is added (try to // fix this in WAVE) - final OperationQueue opQueue = new OperationQueue(); LOG.debug("Adding as participant: " + newPartWithDomain); opQueue.addParticipantToWavelet(wavelet, newPartWithDomain); - final String whoAdd = wavelet.getParticipants().contains(participantUtils.of(userWhoAdds)) ? userWhoAdds - : author; - doOperation(whoAdd, opQueue, "add participant"); added = true; } } + doOperation(whoAdd, opQueue, "add participant"); return added; } @@ -340,17 +340,17 @@ final Participants currentParticipants = wavelet.getParticipants(); final Set<String> set = toSet(participantsToDel); LOG.debug("Removing participants: " + set.toString()); + final OperationQueue opQueue = new OperationQueue(); for (final String participant : set) { // FIXME Seems like only one participant per opQueue is added (try to fix // this in WAVE) final String partWithDomain = participantUtils.of(participant).toString(); if (currentParticipants.contains(partWithDomain)) { - final OperationQueue opQueue = new OperationQueue(); LOG.debug("Removing as participant: " + partWithDomain); opQueue.removeParticipantFromWavelet(wavelet, partWithDomain); - doOperation(whoDel, opQueue, "del participant"); } } + doOperation(whoDel, opQueue, "del participant"); } private void doOperation(final String author, final OperationQueue opQueue, final String logComment) { Modified: trunk/src/main/java/cc/kune/wiki/client/WikiClientTool.java =================================================================== --- trunk/src/main/java/cc/kune/wiki/client/WikiClientTool.java 2012-02-28 18:56:19 UTC (rev 1719) +++ trunk/src/main/java/cc/kune/wiki/client/WikiClientTool.java 2012-02-29 01:04:27 UTC (rev 1720) @@ -52,7 +52,7 @@ registerAuthorableTypes(TYPE_WIKIPAGE, TYPE_UPLOADEDFILE); registerDragableTypes(TYPE_WIKIPAGE, TYPE_FOLDER, TYPE_UPLOADEDFILE); - registerDropableTypes(TYPE_ROOT, TYPE_FOLDER); + registerDropableTypes(TYPE_ROOT, TYPE_FOLDER, TYPE_WIKIPAGE); registerRateableTypes(TYPE_UPLOADEDFILE, TYPE_WIKIPAGE); registerRenamableTypes(TYPE_FOLDER, TYPE_UPLOADEDFILE, TYPE_WIKIPAGE); registerTageableTypes(TYPE_UPLOADEDFILE, TYPE_WIKIPAGE);