[kune-commits] r871 - in trunk/src:
main/java/org/ourproject/kune/chat/client/cnt
main/java/org/ourproject/kune/chat/client/ctx
main/java/org/ourproject/kune/chat/server
main/java/org/ourproject/kune/docs/client
main/java/org/ourproject/kune/docs/client/cnt
main/java/org/ourproject/kune/docs/server
main/java/org/ourproject/kune/platf/client/actions
main/java/org/ourproject/kune/platf/client/dto
main/java/org/ourproject/kune/platf/client/errors
main/java/org/ourproject/kune/platf/client/rpc
main/java/org/ourproject/kune/platf/client/state
main/java/org/ourproject/kune/platf/client/ui/dialogs
main/java/org/ourproject/kune/platf/server/content
main/java/org/ourproject/kune/platf/server/rpc
main/java/org/ourproject/kune/platf/server/state
main/java/org/ourproject/kune/platf/server/tool
main/java/org/ourproject/kune/workspace/client/ctxnav
main/java/org/ourproject/kune/workspace/client/title
test/java/org/ourproject/kune/platf/integration/content
vjrj
vjrj at ourproject.org
Mon Sep 15 06:13:10 CEST 2008
Author: vjrj
Date: 2008-09-15 06:12:48 +0200 (Mon, 15 Sep 2008)
New Revision: 871
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonSeparator.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollectionSet.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEnableCondition.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContainerNotPermittedException.java
Modified:
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java
trunk/src/main/java/org/ourproject/kune/chat/server/ChatServerTool.java
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/server/DocumentServerTool.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/InitDataDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java
trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploader.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploaderDialog.java
trunk/src/main/java/org/ourproject/kune/platf/server/content/CreationService.java
trunk/src/main/java/org/ourproject/kune/platf/server/content/CreationServiceDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java
trunk/src/main/java/org/ourproject/kune/platf/server/state/State.java
trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/tool/ServerTool.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java
trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java
trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceGetTest.java
trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
Log:
better context support, more complete action definitions, some server fixes
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -53,7 +53,7 @@
}
public void onEnterRoom() {
- final String roomName = state.getFolder().getName();
+ final String roomName = state.getContainer().getName();
emiteUIDialog.joinRoom(XmppURI.uri(roomName));
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -43,7 +43,7 @@
public void setState(final StateDTO state) {
final RoomsAdmin rooms = roomAdminsProvider.get();
- rooms.showRoom(state.getStateToken(), state.getFolder(), state.getFolderRights());
+ rooms.showRoom(state.getStateToken(), state.getContainer(), state.getContainerRights());
view.show(rooms.getView());
}
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/server/ChatServerTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/server/ChatServerTool.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/chat/server/ChatServerTool.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -21,6 +21,7 @@
package org.ourproject.kune.chat.server;
import org.ourproject.kune.chat.client.ChatClientTool;
+import org.ourproject.kune.platf.client.errors.ContainerNotPermittedException;
import org.ourproject.kune.platf.server.content.ContainerManager;
import org.ourproject.kune.platf.server.domain.Container;
import org.ourproject.kune.platf.server.domain.Content;
@@ -44,40 +45,49 @@
@Inject
public ChatServerTool(final ToolConfigurationManager configurationManager, final ContainerManager containerManager) {
- this.configurationManager = configurationManager;
- this.containerManager = containerManager;
+ this.configurationManager = configurationManager;
+ this.containerManager = containerManager;
}
public String getName() {
- return NAME;
+ return NAME;
}
- public void onCreateContainer(final Container container, final Container parent) {
- if (!parent.getTypeId().equals(TYPE_ROOT)) {
- throw new RuntimeException();
- }
- container.setTypeId(TYPE_ROOM);
+ public Group initGroup(final User user, final Group group) {
+ final ToolConfiguration config = new ToolConfiguration();
+ final Container container = containerManager.createRootFolder(group, NAME, ROOT_NAME, TYPE_ROOT);
+ config.setRoot(container);
+ group.setToolConfig(NAME, config);
+ configurationManager.persist(config);
+ return group;
}
- public void onCreateContent(final Content content, final Container parent) {
- if (parent.getTypeId().equals(TYPE_ROOM)) {
- throw new RuntimeException();
- }
- content.setTypeId(TYPE_CHAT);
+ public void onCreateContainer(final Container container, final Container parent, final String typeId) {
+ checkTypeId(parent.getTypeId(), typeId);
+ container.setTypeId(typeId);
}
- public Group initGroup(final User user, final Group group) {
- ToolConfiguration config = new ToolConfiguration();
- Container container = containerManager.createRootFolder(group, NAME, ROOT_NAME, TYPE_ROOT);
- config.setRoot(container);
- group.setToolConfig(NAME, config);
- configurationManager.persist(config);
- return group;
+ public void onCreateContent(final Content content, final Container parent) {
+ if (parent.getTypeId().equals(TYPE_ROOM)) {
+ throw new RuntimeException();
+ }
+ content.setTypeId(TYPE_CHAT);
}
@Inject
public void register(final ToolRegistry registry) {
- registry.register(this);
+ registry.register(this);
}
+ private void checkTypeId(final String parentTypeId, final String typeId) {
+ if (typeId.equals(TYPE_ROOM)) {
+ if (!parentTypeId.equals(TYPE_ROOT)) {
+ throw new ContainerNotPermittedException();
+ }
+ // ok valid container
+ } else {
+ throw new ContainerNotPermittedException();
+ }
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -21,9 +21,14 @@
package org.ourproject.kune.docs.client;
import org.ourproject.kune.docs.client.ctx.DocumentContext;
+import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionButtonSeparator;
import org.ourproject.kune.platf.client.actions.ActionDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionEnableCondition;
+import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
import org.ourproject.kune.platf.client.actions.ActionPosition;
import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+import org.ourproject.kune.platf.client.dto.InitDataDTO;
import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
@@ -95,30 +100,17 @@
}
private void createActions() {
- final ActionDescriptor<StateToken> addFolder = new ActionDescriptor<StateToken>(AccessRolDTO.Editor,
- ActionPosition.topbarAndItemMenu, new Slot<StateToken>() {
- public void onEvent(final StateToken parameter) {
- contentServiceProvider.get().addFolder(session.getUserHash(),
- session.getCurrentState().getGroup().getShortName(), new Long(parameter.getFolder()),
- i18n.t("New folder"), new AsyncCallbackSimple<StateDTO>() {
- public void onSuccess(final StateDTO state) {
- contextNavigator.setState(state);
- stateManager.setRetrievedState(state);
- contextNavigator.editItem(state.getStateToken());
- }
- });
- }
- });
- addFolder.setTextDescription(i18n.t("New folder"));
- addFolder.setParentMenuTitle(i18n.t("New"));
- addFolder.setIconUrl("images/nav/folder_add.png");
+ final ActionMenuDescriptor<StateToken> addFolder = createFolderAction(TYPE_FOLDER, "images/nav/folder_add.png",
+ i18n.t("New folder"), i18n.t("File"), i18n.t("New"));
+ final ActionMenuDescriptor<StateToken> addGallery = createFolderAction(TYPE_GALLERY, "images/nav/gallery.png",
+ i18n.t("New gallery"), i18n.t("File"), i18n.t("New"));
- final ActionDescriptor<StateToken> addDoc = new ActionDescriptor<StateToken>(AccessRolDTO.Editor,
+ final ActionMenuDescriptor<StateToken> addDoc = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Editor,
ActionPosition.topbarAndItemMenu, new Slot<StateToken>() {
public void onEvent(final StateToken token) {
contentServiceProvider.get().addContent(session.getUserHash(),
session.getCurrentState().getGroup().getShortName(),
- session.getCurrentState().getFolder().getId(), i18n.t("New document"),
+ session.getCurrentState().getContainer().getId(), i18n.t("New document"),
new AsyncCallbackSimple<StateDTO>() {
public void onSuccess(final StateDTO state) {
contextNavigator.setState(state);
@@ -130,22 +122,24 @@
}
});
addDoc.setTextDescription(i18n.t("New document"));
- addDoc.setParentMenuTitle(i18n.t("New"));
+ addDoc.setParentMenuTitle(i18n.t("File"));
+ addDoc.setParentSubMenuTitle(i18n.t("New"));
addDoc.setIconUrl("images/nav/page_add.png");
- final ActionDescriptor<StateToken> delContainer = new ActionDescriptor<StateToken>(AccessRolDTO.Administrator,
- ActionPosition.itemMenu, new Slot<StateToken>() {
+ final ActionMenuDescriptor<StateToken> delContainer = new ActionMenuDescriptor<StateToken>(
+ AccessRolDTO.Administrator, ActionPosition.topbarAndItemMenu, new Slot<StateToken>() {
public void onEvent(final StateToken token) {
Site.info("Sorry, in development");
}
});
- delContainer.setTextDescription(i18n.t("Delete"));
+ delContainer.setParentMenuTitle(i18n.t("File"));
+ delContainer.setTextDescription(i18n.t("Delete folder"));
delContainer.setMustBeConfirmed(true);
delContainer.setConfirmationTitle(i18n.t("Please confirm"));
delContainer.setConfirmationText(i18n.t("You will delete it and also all its contents. Are you sure?"));
- final ActionDescriptor<StateToken> delContent = new ActionDescriptor<StateToken>(AccessRolDTO.Administrator,
- ActionPosition.itemMenu, new Slot<StateToken>() {
+ final ActionMenuDescriptor<StateToken> delContent = new ActionMenuDescriptor<StateToken>(
+ AccessRolDTO.Administrator, ActionPosition.topbarAndItemMenu, new Slot<StateToken>() {
public void onEvent(final StateToken token) {
contentServiceProvider.get().delContent(session.getUserHash(),
session.getCurrentState().getGroup().getShortName(), token.getDocument(),
@@ -157,7 +151,8 @@
});
}
});
- delContent.setTextDescription(i18n.t("Delete"));
+ delContent.setParentMenuTitle(i18n.t("File"));
+ delContent.setTextDescription(i18n.t("Delete document"));
delContent.setMustBeConfirmed(true);
delContent.setConfirmationTitle(i18n.t("Please confirm"));
delContent.setConfirmationText(i18n.t("Are you sure?"));
@@ -179,7 +174,31 @@
});
rename.setTextDescription(i18n.t("Rename"));
- final ActionDescriptor<StateToken> refresh = new ActionDescriptor<StateToken>(AccessRolDTO.Viewer,
+ final ActionButtonDescriptor<StateToken> goGroupHome = new ActionButtonDescriptor<StateToken>(
+ AccessRolDTO.Viewer, ActionPosition.topbar, new Slot<StateToken>() {
+ public void onEvent(final StateToken token) {
+ stateManager.gotoToken(token.getGroup());
+ }
+ });
+ goGroupHome.setIconUrl("images/group-home.png");
+ goGroupHome.setLeftSeparator(ActionButtonSeparator.fill);
+ goGroupHome.setRightSeparator(ActionButtonSeparator.separator);
+ goGroupHome.setEnableCondition(new ActionEnableCondition<StateToken>() {
+ public boolean mustBeEnabled(final StateToken param) {
+ return !param.equals(session.getCurrentState().getStateToken());
+ }
+ });
+
+ final ActionMenuDescriptor<StateToken> setAsDefGroupContent = new ActionMenuDescriptor<StateToken>(
+ AccessRolDTO.Administrator, ActionPosition.itemMenu, new Slot<StateToken>() {
+ public void onEvent(final StateToken token) {
+ Site.info("In development");
+ }
+ });
+ setAsDefGroupContent.setTextDescription(i18n.t("Set this as the group default page"));
+ setAsDefGroupContent.setIconUrl("images/group-home.png");
+
+ final ActionButtonDescriptor<StateToken> refresh = new ActionButtonDescriptor<StateToken>(AccessRolDTO.Viewer,
ActionPosition.topbar, new Slot<StateToken>() {
public void onEvent(StateToken stateToken) {
stateManager.reload();
@@ -189,38 +208,87 @@
refresh.setIconUrl("images/nav/refresh.png");
refresh.setToolTip(i18n.t("Refresh"));
- final ActionDescriptor<StateToken> uploadFile = new ActionDescriptor<StateToken>(AccessRolDTO.Editor,
- ActionPosition.bootombarAndItemMenu, new Slot<StateToken>() {
- public void onEvent(final StateToken token) {
- fileUploaderProvider.get().show();
- }
- });
- uploadFile.setTextDescription(i18n.t("Upload file"));
- uploadFile.setIconUrl("images/nav/upload.png");
- uploadFile.setToolTip(i18n.t("Upload some files (images, PDFs, etc)"));
+ final ActionDescriptor<StateToken> uploadFile = createUploadAction(i18n.t("Upload file"),
+ "images/nav/upload.png", i18n.t("Upload some files (images, PDFs, ...)"), null);
- contextNavigator.addAction(TYPE_FOLDER, go);
+ session.onInitDataReceived(new Slot<InitDataDTO>() {
+ public void onEvent(final InitDataDTO parameter) {
+ final ActionDescriptor<StateToken> uploadMedia = createUploadAction(i18n.t("Upload media"),
+ "images/nav/upload.png", i18n.t("Upload some media (images, videos)"), session
+ .getGalleryPermittedExtensions());
+ contextNavigator.addAction(TYPE_GALLERY, uploadMedia);
+ }
+ });
+
+ // contextNavigator.addAction(TYPE_FOLDER, go);
contextNavigator.addAction(TYPE_FOLDER, addDoc);
contextNavigator.addAction(TYPE_FOLDER, addFolder);
contextNavigator.addAction(TYPE_FOLDER, delContainer);
contextNavigator.addAction(TYPE_FOLDER, rename);
+ contextNavigator.addAction(TYPE_FOLDER, goGroupHome);
contextNavigator.addAction(TYPE_FOLDER, refresh);
contextNavigator.addAction(TYPE_FOLDER, uploadFile);
contextNavigator.addAction(TYPE_BLOG, uploadFile);
- contextNavigator.addAction(TYPE_GALLERY, uploadFile);
+ contextNavigator.addAction(TYPE_BLOG, setAsDefGroupContent);
+ contextNavigator.addAction(TYPE_GALLERY, goGroupHome);
+
contextNavigator.addAction(TYPE_ROOT, addDoc);
contextNavigator.addAction(TYPE_ROOT, addFolder);
+ contextNavigator.addAction(TYPE_ROOT, addGallery);
+ contextNavigator.addAction(TYPE_ROOT, goGroupHome);
contextNavigator.addAction(TYPE_ROOT, refresh);
contextNavigator.addAction(TYPE_ROOT, uploadFile);
- contextNavigator.addAction(TYPE_DOCUMENT, go);
+ // contextNavigator.addAction(TYPE_DOCUMENT, go);
contextNavigator.addAction(TYPE_DOCUMENT, delContent);
contextNavigator.addAction(TYPE_DOCUMENT, rename);
+ contextNavigator.addAction(TYPE_DOCUMENT, goGroupHome);
contextNavigator.addAction(TYPE_DOCUMENT, refresh);
+ contextNavigator.addAction(TYPE_DOCUMENT, setAsDefGroupContent);
}
+ private ActionMenuDescriptor<StateToken> createFolderAction(final String contentTypeId, final String iconUrl,
+ final String textDescription, final String parentMenuTitle, final String parentMenuSubtitle) {
+ final ActionMenuDescriptor<StateToken> addFolder;
+ addFolder = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Editor, ActionPosition.topbarAndItemMenu,
+ new Slot<StateToken>() {
+ public void onEvent(final StateToken parameter) {
+ contentServiceProvider.get().addFolder(session.getUserHash(),
+ session.getCurrentState().getGroup().getShortName(), new Long(parameter.getFolder()),
+ textDescription, contentTypeId, new AsyncCallbackSimple<StateDTO>() {
+ public void onSuccess(final StateDTO state) {
+ contextNavigator.setState(state);
+ stateManager.setRetrievedState(state);
+ contextNavigator.editItem(state.getStateToken());
+ }
+ });
+ }
+ });
+ addFolder.setTextDescription(textDescription);
+ addFolder.setParentMenuTitle(parentMenuTitle);
+ addFolder.setParentSubMenuTitle(parentMenuSubtitle);
+ addFolder.setIconUrl(iconUrl);
+ return addFolder;
+ }
+
+ private ActionDescriptor<StateToken> createUploadAction(final String textDescription, final String iconUrl,
+ final String toolTip, final String permitedExtensions) {
+ final ActionButtonDescriptor<StateToken> uploadFile;
+ uploadFile = new ActionButtonDescriptor<StateToken>(AccessRolDTO.Editor, ActionPosition.bootombarAndItemMenu,
+ new Slot<StateToken>() {
+ public void onEvent(final StateToken token) {
+ fileUploaderProvider.get().setPermittedExtensions(permitedExtensions);
+ fileUploaderProvider.get().show();
+ }
+ });
+ uploadFile.setTextDescription(textDescription);
+ uploadFile.setIconUrl(iconUrl);
+ uploadFile.setToolTip(toolTip);
+ return uploadFile;
+ }
+
private void registerDragDropTypes() {
contextNavigator.registerDraggableType(TYPE_DOCUMENT);
contextNavigator.registerDraggableType(TYPE_FOLDER);
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -139,7 +139,7 @@
view.setContent(editor.getView());
} else {
final FolderEditor editor = folderEditorProvider.get();
- editor.setFolder(content.getFolder());
+ editor.setFolder(content.getContainer());
view.setContent(editor.getView());
}
onEditing.fire();
@@ -197,7 +197,7 @@
docReaderProvider.get().show();
} else {
final FolderViewer viewer = folderViewerProvider.get();
- viewer.setFolder(content.getFolder());
+ viewer.setFolder(content.getContainer());
view.setContent(viewer.getView());
}
}
Modified: trunk/src/main/java/org/ourproject/kune/docs/server/DocumentServerTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/server/DocumentServerTool.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/docs/server/DocumentServerTool.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -20,6 +20,7 @@
package org.ourproject.kune.docs.server;
+import org.ourproject.kune.platf.client.errors.ContainerNotPermittedException;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
import org.ourproject.kune.platf.server.content.ContainerManager;
import org.ourproject.kune.platf.server.content.ContentManager;
@@ -81,8 +82,9 @@
return group;
}
- public void onCreateContainer(final Container container, final Container parent) {
- container.setTypeId(TYPE_FOLDER);
+ public void onCreateContainer(final Container container, final Container parent, final String typeId) {
+ checkTypeId(parent.getTypeId(), typeId);
+ container.setTypeId(typeId);
}
public void onCreateContent(final Content content, final Container parent) {
@@ -94,4 +96,15 @@
registry.register(this);
}
+ private void checkTypeId(final String parentTypeId, final String typeId) {
+ if (typeId.equals(TYPE_FOLDER) || typeId.equals(TYPE_GALLERY)) {
+ // ok valid container
+ if (typeId.equals(TYPE_GALLERY) && !parentTypeId.equals(TYPE_ROOT)) {
+ throw new ContainerNotPermittedException();
+ }
+ } else {
+ throw new ContainerNotPermittedException();
+ }
+ }
+
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonDescriptor.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonDescriptor.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -0,0 +1,40 @@
+package org.ourproject.kune.platf.client.actions;
+
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+
+import com.calclab.suco.client.signal.Slot;
+
+public class ActionButtonDescriptor<T> extends ActionDescriptor<T> {
+
+ private ActionButtonSeparator leftSeparator;
+ private ActionButtonSeparator rightSeparator;
+
+ public ActionButtonDescriptor(final AccessRolDTO accessRolDTO, final ActionPosition actionPosition,
+ final Slot<T> onPerformCall) {
+ super(accessRolDTO, actionPosition, onPerformCall);
+ }
+
+ public ActionButtonSeparator getLeftSeparator() {
+ return leftSeparator;
+ }
+
+ public ActionButtonSeparator getRightSeparator() {
+ return rightSeparator;
+ }
+
+ public boolean hasLeftSeparator() {
+ return leftSeparator != null;
+ }
+
+ public boolean hasRightSeparator() {
+ return rightSeparator != null;
+ }
+
+ public void setLeftSeparator(final ActionButtonSeparator leftSeparator) {
+ this.leftSeparator = leftSeparator;
+ }
+
+ public void setRightSeparator(final ActionButtonSeparator rightSeparator) {
+ this.rightSeparator = rightSeparator;
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonSeparator.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonSeparator.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonSeparator.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -0,0 +1,5 @@
+package org.ourproject.kune.platf.client.actions;
+
+public enum ActionButtonSeparator {
+ spacer, separator, fill
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollectionSet.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollectionSet.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollectionSet.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -0,0 +1,21 @@
+package org.ourproject.kune.platf.client.actions;
+
+
+public class ActionCollectionSet<T> {
+
+ private final ActionCollection<T> toolbarActions;
+ private final ActionCollection<T> itemActions;
+
+ public ActionCollectionSet() {
+ toolbarActions = new ActionCollection<T>();
+ itemActions = new ActionCollection<T>();
+ }
+
+ public ActionCollection<T> getItemActions() {
+ return itemActions;
+ }
+
+ public ActionCollection<T> getToolbarActions() {
+ return toolbarActions;
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -3,7 +3,6 @@
import org.ourproject.kune.platf.client.dto.AccessRolDTO;
import org.ourproject.kune.platf.client.services.ImageDescriptor;
-import com.allen_sauer.gwt.log.client.Log;
import com.calclab.suco.client.signal.Slot;
public class ActionDescriptor<T> {
@@ -17,11 +16,6 @@
private String confirmationTitle;
private String confirmationText;
- private boolean isMenuAction;
- private String parentMenuTitle;
- private String parentMenuIconUrl;
- private String parentSubMenuTitle;
-
private final Slot<T> onPerformCall;
private final Slot<T> onNotConfirmed;
@@ -29,6 +23,8 @@
private ActionPosition actionPosition;
+ private ActionEnableCondition<T> enableCondition;
+
public ActionDescriptor(final AccessRolDTO accessRolDTO, final ActionPosition actionPosition,
final Slot<T> onPerformCall) {
accessRol = accessRolDTO;
@@ -36,9 +32,14 @@
this.onPerformCall = onPerformCall;
mustBeConfirmed = false;
onNotConfirmed = null;
- isMenuAction = false;
}
+ public ActionDescriptor(final AccessRolDTO accessRolDTO, final ActionPosition actionPosition,
+ final Slot<T> onPerformCall, final ActionEnableCondition<T> enableCondition) {
+ this(accessRolDTO, actionPosition, onPerformCall);
+ this.enableCondition = enableCondition;
+ }
+
@SuppressWarnings("unchecked")
public void fireOnNotConfirmed(final Object parameter) {
if (onNotConfirmed != null) {
@@ -67,6 +68,10 @@
return confirmationTitle;
}
+ public ActionEnableCondition<T> getEnableCondition() {
+ return enableCondition;
+ }
+
public ImageDescriptor getIconDescriptor() {
return iconDescriptor;
}
@@ -75,18 +80,6 @@
return iconUrl;
}
- public String getParentMenuIconUrl() {
- return parentMenuIconUrl;
- }
-
- public String getParentMenuTitle() {
- return parentMenuTitle;
- }
-
- public String getParentSubMenuTitle() {
- return parentSubMenuTitle;
- }
-
public String getText() {
return textDescription;
}
@@ -95,10 +88,6 @@
return toolTip;
}
- public boolean isMenuAction() {
- return isMenuAction;
- }
-
public boolean isMustBeConfirmed() {
return mustBeConfirmed;
}
@@ -119,6 +108,10 @@
this.confirmationTitle = confirmationTitle;
}
+ public void setEnableCondition(final ActionEnableCondition<T> enableCondition) {
+ this.enableCondition = enableCondition;
+ }
+
public void setIconDescriptor(final ImageDescriptor iconDescriptor) {
this.iconDescriptor = iconDescriptor;
}
@@ -131,22 +124,6 @@
this.mustBeConfirmed = mustBeConfirmed;
}
- public void setParentMenuIconUrl(final String parentMenuIconUrl) {
- this.parentMenuIconUrl = parentMenuIconUrl;
- }
-
- public void setParentMenuTitle(final String parentMenuTitle) {
- isMenuAction = true;
- this.parentMenuTitle = parentMenuTitle;
- }
-
- public void setParentSubMenuTitle(final String parentSubMenuTitle) {
- if (parentMenuTitle == null) {
- Log.warn("Please set parentMenuTitle before");
- }
- this.parentSubMenuTitle = parentSubMenuTitle;
- }
-
public void setTextDescription(final String textDescription) {
this.textDescription = textDescription;
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEnableCondition.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEnableCondition.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEnableCondition.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -0,0 +1,5 @@
+package org.ourproject.kune.platf.client.actions;
+
+public interface ActionEnableCondition<T> {
+ boolean mustBeEnabled(T param);
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuDescriptor.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuDescriptor.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -0,0 +1,45 @@
+package org.ourproject.kune.platf.client.actions;
+
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.calclab.suco.client.signal.Slot;
+
+public class ActionMenuDescriptor<T> extends ActionDescriptor<T> {
+
+ private String parentMenuTitle;
+ private String parentMenuIconUrl;
+ private String parentSubMenuTitle;
+
+ public ActionMenuDescriptor(final AccessRolDTO accessRolDTO, final ActionPosition actionPosition,
+ final Slot<T> onPerformCall) {
+ super(accessRolDTO, actionPosition, onPerformCall);
+ }
+
+ public String getParentMenuIconUrl() {
+ return parentMenuIconUrl;
+ }
+
+ public String getParentMenuTitle() {
+ return parentMenuTitle;
+ }
+
+ public String getParentSubMenuTitle() {
+ return parentSubMenuTitle;
+ }
+
+ public void setParentMenuIconUrl(final String parentMenuIconUrl) {
+ this.parentMenuIconUrl = parentMenuIconUrl;
+ }
+
+ public void setParentMenuTitle(final String parentMenuTitle) {
+ this.parentMenuTitle = parentMenuTitle;
+ }
+
+ public void setParentSubMenuTitle(final String parentSubMenuTitle) {
+ if (parentMenuTitle == null) {
+ Log.warn("Please set parentMenuTitle before");
+ }
+ this.parentSubMenuTitle = parentSubMenuTitle;
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/InitDataDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/InitDataDTO.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/InitDataDTO.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -36,6 +36,8 @@
private String defaultWsTheme;
private String[] wsThemes;
private String siteLogoUrl;
+ private String galleryPermittedExtensions;
+ private String maxFileSizeInMb;
public String getChatDomain() {
return chatDomain;
@@ -57,6 +59,10 @@
return defaultWsTheme;
}
+ public String getGalleryPermittedExtensions() {
+ return galleryPermittedExtensions;
+ }
+
public ArrayList<I18nLanguageSimpleDTO> getLanguages() {
return languages;
}
@@ -65,6 +71,10 @@
return licenses;
}
+ public String getMaxFileSizeInMb() {
+ return maxFileSizeInMb;
+ }
+
public String getSiteDomain() {
return siteDomain;
}
@@ -109,6 +119,10 @@
this.defaultWsTheme = defaultWsTheme;
}
+ public void setGalleryPermittedExtensions(final String galleryPermittedExtensions) {
+ this.galleryPermittedExtensions = galleryPermittedExtensions;
+ }
+
public void setLanguages(final ArrayList<I18nLanguageSimpleDTO> languages) {
this.languages = languages;
}
@@ -117,6 +131,10 @@
this.licenses = licenses;
}
+ public void setMaxFileSizeInMb(final String maxFileSizeInMb) {
+ this.maxFileSizeInMb = maxFileSizeInMb;
+ }
+
public void setSiteDomain(final String siteDomain) {
this.siteDomain = siteDomain;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateDTO.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateDTO.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -32,11 +32,12 @@
private String title;
private String toolName;
private GroupDTO group;
- private ContainerDTO folder;
+ private ContainerDTO container;
+ private ContainerDTO rootContainer;
private SocialNetworkDTO socialNetwork;
private AccessListsDTO accessLists;
private AccessRightsDTO contentRights;
- private AccessRightsDTO folderRights;
+ private AccessRightsDTO containerRights;
private AccessRightsDTO groupRights;
private ContentStatusDTO status;
private boolean isRateable;
@@ -72,6 +73,10 @@
return authors;
}
+ public ContainerDTO getContainer() {
+ return container;
+ }
+
public String getContent() {
return content;
}
@@ -88,14 +93,10 @@
return documentId;
}
- public ContainerDTO getFolder() {
- return folder;
+ public AccessRightsDTO getContainerRights() {
+ return containerRights;
}
- public AccessRightsDTO getFolderRights() {
- return folderRights;
- }
-
public GroupDTO getGroup() {
return this.group;
}
@@ -136,6 +137,10 @@
return rateByUsers;
}
+ public ContainerDTO getRootContainer() {
+ return rootContainer;
+ }
+
public SocialNetworkDTO getSocialNetwork() {
return socialNetwork;
}
@@ -185,6 +190,14 @@
this.authors = authors;
}
+ public void setContainer(final ContainerDTO container) {
+ this.container = container;
+ }
+
+ public void setContainerRights(final AccessRightsDTO containerRights) {
+ this.containerRights = containerRights;
+ }
+
public void setContent(final String content) {
this.content = content;
}
@@ -201,14 +214,6 @@
this.documentId = docRef;
}
- public void setFolder(final ContainerDTO folder) {
- this.folder = folder;
- }
-
- public void setFolderRights(final AccessRightsDTO folderRights) {
- this.folderRights = folderRights;
- }
-
public void setGroup(final GroupDTO group) {
this.group = group;
}
@@ -253,6 +258,10 @@
this.rateByUsers = rateByUsers;
}
+ public void setRootContainer(final ContainerDTO rootContainer) {
+ this.rootContainer = rootContainer;
+ }
+
public void setSocialNetwork(final SocialNetworkDTO socialNetwork) {
this.socialNetwork = socialNetwork;
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContainerNotPermittedException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContainerNotPermittedException.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContainerNotPermittedException.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -0,0 +1,26 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package org.ourproject.kune.platf.client.errors;
+
+
+public class ContainerNotPermittedException extends DefaultException {
+ private static final long serialVersionUID = 1L;
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -45,7 +45,8 @@
StateDTO addContent(String user, String groupShortName, Long parentFolderId, String name) throws DefaultException;
- StateDTO addFolder(String hash, String groupShortName, Long parentFolderId, String title) throws DefaultException;
+ StateDTO addFolder(String hash, String groupShortName, Long parentFolderId, String typeId, String title)
+ throws DefaultException;
StateDTO addRoom(String user, String groupShortName, Long parentFolderId, String name) throws DefaultException;
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -34,19 +34,19 @@
public interface ContentServiceAsync {
void addAuthor(String userHash, String groupShortName, String documentId, String authorShortName,
- AsyncCallback<?> asyncCallback);
+ AsyncCallback<?> asyncCallback);
void addComment(String userHash, String groupShortName, String documentId, Long parentCommentId,
- String commentText, AsyncCallback<CommentDTO> asyncCallback);
+ String commentText, AsyncCallback<CommentDTO> asyncCallback);
void addComment(String userHash, String groupShortName, String documentId, String commentText,
- AsyncCallback<CommentDTO> asyncCallback);
+ AsyncCallback<CommentDTO> asyncCallback);
void addContent(String user, String groupShortName, Long parentFolderId, String name,
- AsyncCallback<StateDTO> callback);
+ AsyncCallback<StateDTO> callback);
- void addFolder(String hash, String groupShortName, Long parentFolderId, String title,
- AsyncCallback<StateDTO> callback);
+ void addFolder(String hash, String groupShortName, Long parentFolderId, String title, String typeId,
+ AsyncCallback<StateDTO> callback);
void addRoom(String user, String groupShortName, Long parentFolderId, String name, AsyncCallback<StateDTO> callback);
@@ -57,29 +57,29 @@
void getSummaryTags(String userHash, String groupShortName, AsyncCallback<List<TagResultDTO>> asyncCallback);
void markCommentAsAbuse(String userHash, String groupShortName, String documentId, Long commentId,
- AsyncCallback<CommentDTO> asyncCallback);
+ AsyncCallback<CommentDTO> asyncCallback);
void rateContent(String userHash, String groupShortName, String documentId, Double value,
- AsyncCallback<?> asyncCallback);
+ AsyncCallback<?> asyncCallback);
void removeAuthor(String userHash, String groupShortName, String documentId, String authorShortName,
- AsyncCallback<?> asyncCallback);
+ AsyncCallback<?> asyncCallback);
void rename(String userHash, String groupShortName, String token, String newName,
- AsyncCallback<String> asyncCallback);
+ AsyncCallback<String> asyncCallback);
void save(String user, String groupShortName, String documentId, String content,
- AsyncCallback<Integer> asyncCallback);
+ AsyncCallback<Integer> asyncCallback);
void setLanguage(String userHash, String groupShortName, String documentId, String languageCode,
- AsyncCallback<I18nLanguageDTO> asyncCallback);
+ AsyncCallback<I18nLanguageDTO> asyncCallback);
void setPublishedOn(String userHash, String groupShortName, String documentId, Date publishedOn,
- AsyncCallback<?> asyncCallback);
+ AsyncCallback<?> asyncCallback);
void setTags(String userHash, String groupShortName, String documentId, String tags,
- AsyncCallback<List<TagResultDTO>> asyncCallback);
+ AsyncCallback<List<TagResultDTO>> asyncCallback);
void voteComment(String userHash, String groupShortName, String documentId, Long commentId, boolean votePositive,
- AsyncCallback<CommentDTO> asyncCallback);
+ AsyncCallback<CommentDTO> asyncCallback);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -70,6 +70,8 @@
UserInfoDTO getCurrentUserInfo();
+ String getGalleryPermittedExtensions();
+
String getUserHash();
void onInitDataReceived(Slot<InitDataDTO> slot);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -91,6 +91,10 @@
return currentUserInfo;
}
+ public String getGalleryPermittedExtensions() {
+ return initData.getGalleryPermittedExtensions();
+ }
+
public List<I18nLanguageSimpleDTO> getLanguages() {
return initData.getLanguages();
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploader.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploader.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploader.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -4,7 +4,7 @@
void hide();
- void setPermittedExtensions(String[] extensions);
+ void setPermittedExtensions(String extensions);
void show();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploaderDialog.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploaderDialog.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploaderDialog.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -1,6 +1,7 @@
package org.ourproject.kune.platf.client.ui.dialogs;
import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.ui.KuneStringUtils;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.site.Site;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
@@ -81,8 +82,8 @@
dialog.hide();
}
- public void setPermittedExtensions(final String[] extensions) {
- dialog.setPermittedExtensions(extensions);
+ public void setPermittedExtensions(final String extensions) {
+ dialog.setPermittedExtensions((String[]) KuneStringUtils.splitTags(extensions).toArray());
}
public void show() {
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/CreationService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/CreationService.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/CreationService.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -28,10 +28,10 @@
public interface CreationService {
- Content saveContent(User editor, Content descriptor, String content);
-
Content createContent(String title, String body, User user, Container container);
- Container createFolder(Group group, Long parentFolderId, String name, I18nLanguage language);
+ Container createFolder(Group group, Long parentFolderId, String name, I18nLanguage language, String contentTypeId);
+ Content saveContent(User editor, Content descriptor, String content);
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/CreationServiceDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/CreationServiceDefault.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/CreationServiceDefault.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -38,30 +38,30 @@
@Inject
public CreationServiceDefault(final ContainerManager containerManager, final ContentManager contentManager,
- final ToolRegistry toolRegistry) {
- this.containerManager = containerManager;
- this.contentManager = contentManager;
- this.tools = toolRegistry;
+ final ToolRegistry toolRegistry) {
+ this.containerManager = containerManager;
+ this.contentManager = contentManager;
+ this.tools = toolRegistry;
}
public Content createContent(final String title, final String body, final User user, final Container container) {
- String toolName = container.getToolName();
- Content content = contentManager.createContent(title, body, user, container);
- tools.get(toolName).onCreateContent(content, container);
- return content;
+ final String toolName = container.getToolName();
+ final Content content = contentManager.createContent(title, body, user, container);
+ tools.get(toolName).onCreateContent(content, container);
+ return content;
}
public Container createFolder(final Group group, final Long parentFolderId, final String name,
- final I18nLanguage language) {
- Container parent = containerManager.find(parentFolderId);
- String toolName = parent.getToolName();
- Container child = containerManager.createFolder(group, parent, name, language);
- tools.get(toolName).onCreateContainer(child, parent);
- return child;
+ final I18nLanguage language, final String typeId) {
+ final Container parent = containerManager.find(parentFolderId);
+ final String toolName = parent.getToolName();
+ final Container child = containerManager.createFolder(group, parent, name, language);
+ tools.get(toolName).onCreateContainer(child, parent, typeId);
+ return child;
}
public Content saveContent(final User editor, final Content descriptor, final String content) {
- return contentManager.save(editor, descriptor, content);
+ return contentManager.save(editor, descriptor, content);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -25,6 +25,7 @@
import javax.persistence.NoResultException;
+import org.ourproject.kune.chat.server.ChatServerTool;
import org.ourproject.kune.chat.server.managers.ChatConnection;
import org.ourproject.kune.chat.server.managers.XmppManager;
import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
@@ -162,12 +163,12 @@
@Authorizated(accessTypeRequired = AccessType.EDIT)
@Transactional(type = TransactionType.READ_WRITE)
public StateDTO addFolder(final String userHash, final String groupShortName, final Long parentFolderId,
- final String title) throws DefaultException {
+ final String title, final String contentTypeId) throws DefaultException {
final Group group = groupManager.findByShortName(groupShortName);
final UserSession userSession = getUserSession();
final User user = userSession.getUser();
final boolean userIsLoggedIn = userSession.isUserLoggedIn();
- final State state = createFolder(groupShortName, parentFolderId, title);
+ final State state = createFolder(groupShortName, parentFolderId, title, contentTypeId);
completeState(user, userIsLoggedIn, group, state);
return mapState(state, user, group);
}
@@ -187,7 +188,7 @@
xmppManager.createRoom(connection, roomName, userShortName + userHash);
xmppManager.disconnect(connection);
try {
- final State state = createFolder(groupShortName, parentFolderId, roomName);
+ final State state = createFolder(groupShortName, parentFolderId, roomName, ChatServerTool.TYPE_ROOM);
completeState(user, userIsLoggedIn, group, state);
return mapState(state, user, group);
} catch (final ContentNotFoundException e) {
@@ -394,21 +395,17 @@
state.setParticipation(socialNetworkManager.findParticipation(user, group));
}
- private State createFolder(final String groupShortName, final Long parentFolderId, final String title)
- throws DefaultException {
+ private State createFolder(final String groupShortName, final Long parentFolderId, final String title,
+ final String typeId) throws DefaultException {
final UserSession userSession = getUserSession();
final User user = userSession.getUser();
final Group group = groupManager.findByShortName(groupShortName);
Access access = accessService.getFolderAccess(group, parentFolderId, user, AccessType.EDIT);
- final Container container = creationService.createFolder(group, parentFolderId, title, user.getLanguage());
- final String toolName = container.getToolName();
- // Trying not to enter in new folder:
- // final StateToken token = new StateToken(group.getShortName(),
- // toolName, container.getId().toString(), null);
- final StateToken token = new StateToken(group.getShortName(), toolName, parentFolderId.toString(), null);
- access = accessService.getAccess(user, token, group, AccessType.READ);
+ final Container container = creationService.createFolder(group, parentFolderId, title, user.getLanguage(),
+ typeId);
+ access = accessService.getAccess(user, container.getStateToken(), group, AccessType.EDIT);
final State state = stateService.create(access);
return state;
}
@@ -421,14 +418,21 @@
return userSessionProvider.get();
}
+ private void mapContentRightsInstate(final User user, final AccessLists groupAccessList, final ContentDTO siblingDTO) {
+ final Content sibling = contentManager.find(siblingDTO.getId());
+ final AccessLists lists = sibling.hasAccessList() ? sibling.getAccessLists() : groupAccessList;
+ siblingDTO.setRights(mapper.map(rightsService.get(user, lists), AccessRightsDTO.class));
+ }
+
private StateDTO mapState(final State state, final User user, final Group group) {
final StateDTO stateDTO = mapper.map(state, StateDTO.class);
- final AccessLists groupAccesList = group.getSocialNetwork().getAccessLists();
- for (final ContentDTO siblingDTO : stateDTO.getFolder().getContents()) {
- final Content sibling = contentManager.find(siblingDTO.getId());
- final AccessLists lists = sibling.hasAccessList() ? sibling.getAccessLists() : groupAccesList;
- siblingDTO.setRights(mapper.map(rightsService.get(user, lists), AccessRightsDTO.class));
+ final AccessLists groupAccessList = group.getSocialNetwork().getAccessLists();
+ for (final ContentDTO siblingDTO : stateDTO.getRootContainer().getContents()) {
+ mapContentRightsInstate(user, groupAccessList, siblingDTO);
}
+ for (final ContentDTO siblingDTO : stateDTO.getContainer().getContents()) {
+ mapContentRightsInstate(user, groupAccessList, siblingDTO);
+ }
return stateDTO;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/state/State.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/state/State.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/state/State.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -43,9 +43,10 @@
private String toolName;
private Group group;
private Container container;
+ private Container rootContainer;
private AccessLists accessLists;
private AccessRights contentRights;
- private AccessRights folderRights;
+ private AccessRights containerRights;
private AccessRights groupRights;
private ContentStatus status;
private boolean isRateable;
@@ -74,6 +75,14 @@
return authors;
}
+ public Container getContainer() {
+ return container;
+ }
+
+ public AccessRights getContainerRights() {
+ return containerRights;
+ }
+
public String getContent() {
return content;
}
@@ -90,14 +99,6 @@
return documentId;
}
- public Container getFolder() {
- return container;
- }
-
- public AccessRights getFolderRights() {
- return folderRights;
- }
-
public Group getGroup() {
return group;
}
@@ -138,6 +139,10 @@
return rateByUsers;
}
+ public Container getRootContainer() {
+ return rootContainer;
+ }
+
public StateToken getStateToken() {
return stateToken;
}
@@ -174,6 +179,14 @@
this.authors = authors;
}
+ public void setContainer(final Container container) {
+ this.container = container;
+ }
+
+ public void setContainerRights(final AccessRights containerRights) {
+ this.containerRights = containerRights;
+ }
+
public void setContent(final String content) {
this.content = content;
}
@@ -190,14 +203,6 @@
this.documentId = docRef;
}
- public void setFolder(final Container container) {
- this.container = container;
- }
-
- public void setFolderRights(final AccessRights folderRights) {
- this.folderRights = folderRights;
- }
-
public void setGroup(final Group group) {
this.group = group;
}
@@ -250,6 +255,10 @@
}
}
+ public void setRootContainer(final Container rootContainer) {
+ this.rootContainer = rootContainer;
+ }
+
public void setStateToken(final StateToken stateToken) {
this.stateToken = stateToken;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -54,6 +54,11 @@
state.setLanguage(container.getLanguage());
state.setStateToken(container.getStateToken());
}
+ if (!container.isRoot()) {
+ state.setRootContainer(container.getAbsolutePath().get(0));
+ } else {
+ state.setRootContainer(container);
+ }
final Revision revision = content.getLastRevision();
final char[] text = revision.getBody();
state.setContent(text == null ? null : new String(text));
@@ -64,10 +69,10 @@
}
state.setToolName(container.getToolName());
state.setGroup(container.getOwner());
- state.setFolder(container);
+ state.setContainer(container);
state.setAccessLists(access.getContentAccessLists());
state.setContentRights(access.getContentRights());
- state.setFolderRights(access.getFolderRights());
+ state.setContainerRights(access.getFolderRights());
state.setGroupRights(access.getGroupRights());
License contentLicense = content.getLicense();
if (contentLicense == null) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/tool/ServerTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/tool/ServerTool.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/tool/ServerTool.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -33,13 +33,13 @@
*/
public interface ServerTool {
+ public void onCreateContainer(Container container, Container parent, String typeId);
+
+ public void onCreateContent(Content content, Container parent);
+
public void register(ToolRegistry registry);
String getName();
Group initGroup(User user, Group group);
-
- public void onCreateContent(Content content, Container parent);
-
- public void onCreateContainer(Container container, Container parent);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -23,8 +23,11 @@
import java.util.ArrayList;
import java.util.HashMap;
+import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionButtonSeparator;
import org.ourproject.kune.platf.client.actions.ActionCollection;
import org.ourproject.kune.platf.client.actions.ActionDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
import org.ourproject.kune.platf.client.actions.ActionPosition;
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
@@ -38,9 +41,11 @@
import com.gwtext.client.core.EventObject;
import com.gwtext.client.data.Node;
import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.ToolbarButton;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
import com.gwtext.client.widgets.form.TextField;
+import com.gwtext.client.widgets.layout.FitLayout;
import com.gwtext.client.widgets.menu.BaseItem;
import com.gwtext.client.widgets.menu.Item;
import com.gwtext.client.widgets.menu.Menu;
@@ -60,7 +65,7 @@
private final HashMap<String, Menu> toolbarMenus;
private final WorkspaceSkeleton ws;
private final ContextNavigatorPresenter presenter;
- private final ArrayList<ToolbarButton> buttons;
+ private final ArrayList<Widget> removableToolbarItems;
private final HashMap<String, Item> menuItems;
public ContextNavigatorPanel(final ContextNavigatorPresenter presenter, final I18nTranslationService i18n,
@@ -70,11 +75,11 @@
contextMenus = new HashMap<String, Menu>();
toolbarMenus = new HashMap<String, Menu>();
- buttons = new ArrayList<ToolbarButton>();
+ removableToolbarItems = new ArrayList<Widget>();
menuItems = new HashMap<String, Item>();
}
- public void addButtonAction(final ActionDescriptor<StateToken> action) {
+ public void addButtonAction(final ActionButtonDescriptor<StateToken> action) {
final ActionPosition pos = action.getActionPosition();
final ToolbarButton button = new ToolbarButton();
final String text = action.getText();
@@ -89,8 +94,16 @@
});
button.setIcon(action.getIconUrl());
button.setTooltip(action.getToolTip());
- getToolbar(pos).add(button);
- buttons.add(button);
+
+ final Toolbar toolbar = getToolbar(pos);
+ if (action.hasLeftSeparator()) {
+ removableToolbarItems.add(add(toolbar, action.getLeftSeparator()));
+ }
+ toolbar.add(button);
+ if (action.hasRightSeparator()) {
+ removableToolbarItems.add(add(toolbar, action.getRightSeparator()));
+ }
+ removableToolbarItems.add(button);
}
public void addItem(final ContextNavigatorItem item) {
@@ -151,18 +164,19 @@
}
- public void addMenuAction(final ActionDescriptor<StateToken> action, final boolean enable) {
+ public void addMenuAction(final ActionMenuDescriptor<StateToken> action, final boolean enable) {
final String menuTitle = action.getParentMenuTitle();
final String menuSubTitle = action.getParentSubMenuTitle();
final ActionPosition pos = action.getActionPosition();
final String itemKey = genMenuKey(pos, menuTitle, menuSubTitle, action.getText());
Item item = menuItems.get(itemKey);
if (item == null) {
- item = createMenuItem(pos, menuTitle, menuSubTitle, action);
+ item = createToolbarMenu(pos, menuTitle, menuSubTitle, action);
menuItems.put(itemKey, item);
} else {
}
- if (enable) {
+ if (enable) { // && action.getEnableCondition().mustBeEnabled(param))
+ // ) {
item.enable();
} else {
item.disable();
@@ -179,9 +193,17 @@
contextMenus.clear();
toolbarMenus.clear();
menuItems.clear();
- buttons.clear();
+ removableToolbarItems.clear();
}
+ public void clearRemovableActions() {
+ for (final Widget widget : removableToolbarItems) {
+ widget.removeFromParent();
+ }
+ removableToolbarItems.clear();
+ doLayoutIfNeeded();
+ }
+
public void disableAllMenuItems() {
for (final Item item : menuItems.values()) {
item.disable();
@@ -193,14 +215,6 @@
treeEditor.startEdit(getNode(id));
}
- public void removeAllButtons() {
- for (final ToolbarButton button : buttons) {
- button.removeFromParent();
- }
- buttons.clear();
- doLayoutIfNeeded();
- }
-
public void selectItem(final String id) {
final TreeNode item = getNode(id);
if (item != null) {
@@ -221,9 +235,10 @@
node.setText(text);
}
- public void setRootItem(final String id, final String text, final StateToken stateToken) {
+ public void setRootItem(final String id, final String text, final StateToken stateToken,
+ final ActionCollection<StateToken> actions) {
if (treePanel == null || treePanel.getNodeById(id) == null) {
- createTreePanel(id, text, stateToken);
+ createTreePanel(id, text, stateToken, actions);
}
}
@@ -231,6 +246,18 @@
getToolbar(toolbar).add(widget);
}
+ private Widget add(final Toolbar toolbar, final ActionButtonSeparator separator) {
+ switch (separator) {
+ case fill:
+ return toolbar.addFill();
+ case separator:
+ return toolbar.addSeparator();
+ case spacer:
+ default:
+ return toolbar.addSpacer();
+ }
+ }
+
private void createItemMenu(final String nodeId, final ActionCollection<StateToken> actionCollection,
final StateToken stateToken) {
DeferredCommand.addCommand(new Command() {
@@ -259,8 +286,8 @@
});
}
- private Item createMenuItem(final ActionPosition toolBarPos, final String menuTitle, final String menuSubTitle,
- final ActionDescriptor<StateToken> action) {
+ private Item createToolbarMenu(final ActionPosition toolBarPos, final String menuTitle, final String menuSubTitle,
+ final ActionMenuDescriptor<StateToken> action) {
final Item item = new Item(action.getText(), new BaseItemListenerAdapter() {
@Override
public void onClick(BaseItem item, EventObject e) {
@@ -314,7 +341,8 @@
return menu;
}
- private void createTreePanel(final String rootId, final String text, final StateToken stateToken) {
+ private void createTreePanel(final String rootId, final String text, final StateToken stateToken,
+ final ActionCollection<StateToken> actions) {
if (treePanel != null) {
clear();
}
@@ -330,10 +358,11 @@
root.setText(text);
root.setHref("#" + stateToken);
root.expand();
+ createItemMenu(rootId, actions, stateToken);
treePanel.addListener(new TreePanelListenerAdapter() {
public void onContextMenu(final TreeNode node, final EventObject e) {
final Menu menu = contextMenus.get(node.getId());
- if (menu != null) {
+ if (menu != null && menu.getItems().length != 0) {
menu.showAt(e.getXY());
} else {
Log.info("Empty item menu");
@@ -345,9 +374,12 @@
treePanel.setRootNode(root);
final TextField field = new TextField();
treeEditor = new TreeEditor(treePanel, field);
- // final Panel panel = new Panel();
- // panel.setBorder(false);
- // panel.add(treePanel);
+ final Panel panel = new Panel();
+ panel.setLayout(new FitLayout());
+ panel.setBorder(false);
+ panel.setAutoScroll(true);
+ panel.add(treePanel);
+
ws.getEntityWorkspace().setContext(treePanel);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -24,9 +24,12 @@
import java.util.HashMap;
import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
import org.ourproject.kune.platf.client.actions.ActionCollection;
+import org.ourproject.kune.platf.client.actions.ActionCollectionSet;
import org.ourproject.kune.platf.client.actions.ActionDescriptor;
import org.ourproject.kune.platf.client.actions.ActionManager;
+import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
import org.ourproject.kune.platf.client.dto.ContainerDTO;
import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO;
@@ -177,7 +180,7 @@
public void selectItem(final StateToken stateToken) {
view.selectItem(genId(stateToken));
- view.removeAllButtons();
+ view.clearRemovableActions();
view.disableAllMenuItems();
setActions(actionsByItem.get(stateToken), true);
}
@@ -187,54 +190,55 @@
}
public void setState(final StateDTO state) {
- final ContainerDTO container = state.getFolder();
+ final ContainerDTO container = state.getContainer();
final StateToken stateToken = state.getStateToken();
- createTreePath(stateToken, container.getAbsolutePath(), state.getFolderRights());
+ final AccessRightsDTO containerRights = state.getContainerRights();
- ActionCollection<StateToken> selectedToolbarActions;
+ // If root sended (container is not a root folder) process root (add
+ // childs to view)
+ final ContainerDTO root = state.getRootContainer();
+ if (root != null) {
+ final ActionCollectionSet<StateToken> set = createItemActions(containerRights, root.getTypeId());
+ view.setRootItem(genId(root.getStateToken()), i18n.t(root.getName()), root.getStateToken(), set
+ .getItemActions());
+ setActions(set.getToolbarActions(), false);
+ createChildItems(root, containerRights);
+ actionsByItem.put(root.getStateToken(), set.getToolbarActions());
+ }
+ // Do the path to our current content
+ createTreePath(stateToken, container.getAbsolutePath(), containerRights);
+
+ // Process our current content/container
if (state.hasDocument()) {
- selectedToolbarActions = addItem(state.getTitle(), state.getTypeId(), state.getStatus(), stateToken,
- container.getStateToken(), state.getContentRights(), false);
+ addItem(state.getTitle(), state.getTypeId(), state.getStatus(), stateToken, container.getStateToken(),
+ state.getContentRights(), false);
} else {
- selectedToolbarActions = addItem(container.getName(), container.getTypeId(),
- ContentStatusDTO.publishedOnline, container.getStateToken(), container.getStateToken().clone()
- .setFolder(container.getParentFolderId()), state.getFolderRights(), false);
+ addItem(container.getName(), container.getTypeId(), ContentStatusDTO.publishedOnline, container
+ .getStateToken(), container.getStateToken().clone().setFolder(container.getParentFolderId()),
+ containerRights, false);
}
- for (final ContentDTO content : container.getContents()) {
- addItem(content.getTitle(), content.getTypeId(), content.getStatus(), content.getStateToken(), content
- .getStateToken().clone().clearDocument(), content.getRights(), false);
- }
+ // Process container childs
+ createChildItems(container, containerRights);
- for (final ContainerSimpleDTO siblingFolder : container.getChilds()) {
- addItem(siblingFolder.getName(), siblingFolder.getTypeId(), ContentStatusDTO.publishedOnline, siblingFolder
- .getStateToken(), siblingFolder.getStateToken().clone()
- .setFolder(siblingFolder.getParentFolderId()), state.getFolderRights(), false);
- }
-
- actionsByItem.put(stateToken, selectedToolbarActions);
-
+ // Finaly
selectItem(stateToken);
}
- private ActionCollection<StateToken> addItem(final String title, final String contentTypeId,
- final ContentStatusDTO status, final StateToken stateToken, final StateToken parentStateToken,
- final AccessRightsDTO rights, final boolean isNodeSelected) {
- final ActionCollection<StateToken> toolbarActions = new ActionCollection<StateToken>();
- final ActionCollection<StateToken> itemActions = new ActionCollection<StateToken>();
+ private void addItem(final String title, final String contentTypeId, final ContentStatusDTO status,
+ final StateToken stateToken, final StateToken parentStateToken, final AccessRightsDTO rights,
+ final boolean isNodeSelected) {
- createItemActions(rights, contentTypeId, toolbarActions, itemActions);
+ final ActionCollectionSet<StateToken> set = createItemActions(rights, contentTypeId);
+ setActions(set.getToolbarActions(), isNodeSelected);
- setActions(toolbarActions, isNodeSelected);
-
final ContextNavigatorItem item = new ContextNavigatorItem(genId(stateToken), genId(parentStateToken),
getContentTypeIcon(contentTypeId), title, status, stateToken, isDraggable(contentTypeId, rights
- .isAdministrable()), isDroppable(contentTypeId, rights.isAdministrable()), itemActions);
+ .isAdministrable()), isDroppable(contentTypeId, rights.isAdministrable()), set.getItemActions());
view.addItem(item);
-
- return toolbarActions;
+ actionsByItem.put(stateToken, set.getToolbarActions());
}
private void clear() {
@@ -242,8 +246,21 @@
actionsByItem.clear();
}
- private void createItemActions(final AccessRightsDTO rights, final String contentTypeId,
- final ActionCollection<StateToken> toolbarActionas, final ActionCollection<StateToken> itemActions) {
+ private void createChildItems(final ContainerDTO container, final AccessRightsDTO containerRights) {
+ for (final ContentDTO content : container.getContents()) {
+ addItem(content.getTitle(), content.getTypeId(), content.getStatus(), content.getStateToken(), content
+ .getStateToken().clone().clearDocument(), content.getRights(), false);
+ }
+
+ for (final ContainerSimpleDTO siblingFolder : container.getChilds()) {
+ addItem(siblingFolder.getName(), siblingFolder.getTypeId(), ContentStatusDTO.publishedOnline, siblingFolder
+ .getStateToken(), siblingFolder.getStateToken().clone()
+ .setFolder(siblingFolder.getParentFolderId()), containerRights, false);
+ }
+ }
+
+ private ActionCollectionSet<StateToken> createItemActions(final AccessRightsDTO rights, final String contentTypeId) {
+ final ActionCollectionSet<StateToken> set = new ActionCollectionSet<StateToken>();
boolean add = false;
for (final ActionDescriptor<StateToken> action : actions.get(contentTypeId)) {
@@ -261,21 +278,22 @@
if (add) {
switch (action.getActionPosition()) {
case topbarAndItemMenu:
- itemActions.add(action);
+ set.getItemActions().add(action);
case topbar:
- toolbarActionas.add(action);
+ set.getToolbarActions().add(action);
break;
case bootombarAndItemMenu:
- itemActions.add(action);
+ set.getItemActions().add(action);
case bottombar:
- toolbarActionas.add(action);
+ set.getToolbarActions().add(action);
break;
case itemMenu:
- itemActions.add(action);
+ set.getItemActions().add(action);
break;
}
}
}
+ return set;
}
private void createTreePath(final StateToken state, final ContainerSimpleDTO[] absolutePath,
@@ -289,8 +307,7 @@
addItem(folder.getName(), folder.getTypeId(), ContentStatusDTO.publishedOnline, folderStateToken,
parentStateToken, rights, false);
} else {
- // create root folder
- view.setRootItem(genId(folderStateToken), i18n.t(folder.getName()), folderStateToken);
+ // Root must be already created
}
}
}
@@ -314,11 +331,11 @@
private void setActions(final ActionCollection<StateToken> actions, final boolean isNodeSelected) {
for (final ActionDescriptor<StateToken> action : actions) {
- if (action.isMenuAction()) {
- view.addMenuAction(action, isNodeSelected);
+ if (action instanceof ActionMenuDescriptor) {
+ view.addMenuAction((ActionMenuDescriptor<StateToken>) action, isNodeSelected);
} else {
if (isNodeSelected) {
- view.addButtonAction(action);
+ view.addButtonAction((ActionButtonDescriptor<StateToken>) action);
}
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -21,16 +21,18 @@
package org.ourproject.kune.workspace.client.ctxnav;
import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.actions.ActionDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionCollection;
+import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
import org.ourproject.kune.platf.client.dto.StateToken;
public interface ContextNavigatorView extends View {
- void addButtonAction(ActionDescriptor<StateToken> action);
+ void addButtonAction(ActionButtonDescriptor<StateToken> action);
void addItem(ContextNavigatorItem contextNavigatorItem);
- void addMenuAction(ActionDescriptor<StateToken> action, boolean enable);
+ void addMenuAction(ActionMenuDescriptor<StateToken> action, boolean enable);
void clear();
@@ -38,12 +40,12 @@
void editItem(String id);
- void removeAllButtons();
+ void clearRemovableActions();
void selectItem(String id);
void setItemText(String id, String text);
- void setRootItem(String id, String text, StateToken stateToken);
+ void setRootItem(String id, String text, StateToken stateToken, ActionCollection<StateToken> actions);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -118,7 +118,7 @@
setContentDateVisible(true);
setContentDate(state.getPublishedOn());
} else {
- if (state.getFolder().getParentFolderId() == null) {
+ if (state.getContainer().getParentFolderId() == null) {
// We translate root folder names (documents, chat room,
// etcetera)
setContentTitle(i18n.t(state.getTitle()), false);
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -7,6 +7,7 @@
import org.junit.Before;
import org.junit.Test;
+import org.ourproject.kune.docs.client.DocumentClientTool;
import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
import org.ourproject.kune.platf.client.dto.ContainerDTO;
import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO;
@@ -31,7 +32,7 @@
@Test(expected = UserMustBeLoggedException.class)
public void noLoggedInShouldThrowIllegalAccess() throws ContentNotFoundException, Exception {
defaultContent = getDefaultContent();
- final Long folderId = defaultContent.getFolder().getId();
+ final Long folderId = defaultContent.getContainer().getId();
contentService.addContent(session.getHash(), groupName, folderId, "a name");
}
@@ -39,20 +40,20 @@
public void testAddContent() throws Exception {
doLogin();
defaultContent = getDefaultContent();
- assertEquals(1, defaultContent.getFolder().getContents().size());
+ assertEquals(1, defaultContent.getContainer().getContents().size());
final AccessRightsDTO cntRights = defaultContent.getContentRights();
- final AccessRightsDTO ctxRights = defaultContent.getFolderRights();
+ final AccessRightsDTO ctxRights = defaultContent.getContainerRights();
final AccessRightsDTO groupRights = defaultContent.getGroupRights();
final String title = "New Content Title";
- final StateDTO added = contentService.addContent(session.getHash(), groupName, defaultContent.getFolder()
+ final StateDTO added = contentService.addContent(session.getHash(), groupName, defaultContent.getContainer()
.getId(), title);
assertNotNull(added);
- final List<ContentDTO> contents = added.getFolder().getContents();
+ final List<ContentDTO> contents = added.getContainer().getContents();
assertEquals(title, added.getTitle());
assertEquals(2, contents.size());
assertEquals(cntRights, added.getContentRights());
- assertEquals(ctxRights, added.getFolderRights());
+ assertEquals(ctxRights, added.getContainerRights());
assertEquals(groupRights, added.getGroupRights());
assertNotNull(added.getGroupMembers());
assertNotNull(added.getParticipation());
@@ -61,7 +62,7 @@
final StateToken newState = added.getStateToken();
final StateDTO sameAgain = contentService.getContent(session.getHash(), groupName, newState);
assertNotNull(sameAgain);
- assertEquals(2, sameAgain.getFolder().getContents().size());
+ assertEquals(2, sameAgain.getContainer().getContents().size());
}
@@ -69,15 +70,20 @@
public void testAddFolder() throws Exception {
doLogin();
defaultContent = getDefaultContent();
- final ContainerDTO parent = defaultContent.getFolder();
+ final ContainerDTO parent = defaultContent.getContainer();
final String title = "folder name";
- final StateDTO newState = contentService.addFolder(session.getHash(), groupName, parent.getId(), title);
+ final StateDTO newState = contentService.addFolder(session.getHash(), groupName, parent.getId(), title,
+ DocumentClientTool.TYPE_FOLDER);
assertNotNull(newState);
assertNotNull(newState.getGroupMembers());
assertNotNull(newState.getParticipation());
assertNotNull(newState.getAccessLists());
+ assertNotNull(newState.getContainerRights());
+ assertNotNull(newState.getGroupRights());
+ assertNotNull(newState.getRootContainer().getContents().get(0).getRights());
+ assertNotNull(newState.getContainer().getContents().get(0).getRights());
- final ContainerDTO parentAgain = getDefaultContent().getFolder();
+ final ContainerDTO parentAgain = getDefaultContent().getContainer();
final ContainerSimpleDTO child = parentAgain.getChilds().get(0);
assertEquals(parent.getId(), child.getParentFolderId());
@@ -89,7 +95,7 @@
public void testAddRoom() throws Exception {
doLogin();
defaultContent = getDefaultContent();
- final ContainerDTO parent = defaultContent.getFolder();
+ final ContainerDTO parent = defaultContent.getContainer();
final String roomName = "testroom";
final StateDTO newState = contentService.addRoom(session.getHash(), groupName, parent.getId(), roomName);
assertNotNull(newState);
@@ -99,15 +105,17 @@
public void testAddTwoFolders() throws Exception {
doLogin();
defaultContent = getDefaultContent();
- final ContainerDTO parent = defaultContent.getFolder();
+ final ContainerDTO parent = defaultContent.getContainer();
final String title = "folder name";
- final StateDTO newState = contentService.addFolder(session.getHash(), groupName, parent.getId(), title);
+ final StateDTO newState = contentService.addFolder(session.getHash(), groupName, parent.getId(), title,
+ DocumentClientTool.TYPE_FOLDER);
assertNotNull(newState);
- final StateDTO newState2 = contentService.addFolder(session.getHash(), groupName, parent.getId(), title);
+ final StateDTO newState2 = contentService.addFolder(session.getHash(), groupName, parent.getId(), title,
+ DocumentClientTool.TYPE_FOLDER);
assertNotNull(newState2);
- final ContainerDTO parentAgain = getDefaultContent().getFolder();
+ final ContainerDTO parentAgain = getDefaultContent().getContainer();
assertEquals(parent.getId(), parentAgain.getId());
assertEquals(2, parentAgain.getChilds().size());
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceGetTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceGetTest.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceGetTest.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -35,8 +35,8 @@
final StateDTO content = contentService.getContent(null, groupName, new StateToken());
assertNotNull(content);
assertNotNull(content.getGroup());
- assertNotNull(content.getFolder());
- assertNotNull(content.getFolder().getId());
+ assertNotNull(content.getContainer());
+ assertNotNull(content.getContainer().getId());
assertNotNull(content.getToolName());
assertNotNull(content.getDocumentId());
assertNotNull(content.getRateByUsers());
@@ -81,9 +81,9 @@
assertFalse(content.getContentRights().isAdministrable());
assertFalse(content.getContentRights().isEditable());
assertTrue(content.getContentRights().isVisible());
- assertFalse(content.getFolderRights().isAdministrable());
- assertFalse(content.getFolderRights().isEditable());
- assertTrue(content.getFolderRights().isVisible());
+ assertFalse(content.getContainerRights().isAdministrable());
+ assertFalse(content.getContainerRights().isEditable());
+ assertTrue(content.getContainerRights().isVisible());
}
@Test
@@ -91,8 +91,8 @@
final StateDTO content = contentService.getContent(null, groupName, new StateToken("site.docs"));
assertNotNull(content);
assertNotNull(content.getGroup());
- assertNotNull(content.getFolder());
- assertNotNull(content.getFolder().getId());
+ assertNotNull(content.getContainer());
+ assertNotNull(content.getContainer().getId());
assertNotNull(content.getToolName());
}
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java 2008-09-13 10:27:22 UTC (rev 870)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java 2008-09-15 04:12:48 UTC (rev 871)
@@ -6,8 +6,8 @@
import org.junit.Before;
import org.junit.Test;
+import org.ourproject.kune.docs.client.DocumentClientTool;
import org.ourproject.kune.platf.client.dto.ContainerDTO;
-import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO;
import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.dto.TagResultDTO;
@@ -60,13 +60,14 @@
public void folderRename() throws Exception {
doLogin();
defaultContent = getDefaultContent();
- final ContainerDTO folder = defaultContent.getFolder();
+ final ContainerDTO folder = defaultContent.getContainer();
final String oldTitle = "some title";
String newTitle = "folder new name";
- final StateDTO newState = contentService.addFolder(session.getHash(), groupShortName, folder.getId(), oldTitle);
+ final StateDTO newState = contentService.addFolder(session.getHash(), groupShortName, folder.getId(), oldTitle,
+ DocumentClientTool.TYPE_FOLDER);
- final ContainerSimpleDTO newFolder = newState.getFolder().getChilds().get(0);
+ final ContainerDTO newFolder = newState.getContainer();
assertEquals(oldTitle, newFolder.getName());
@@ -80,7 +81,7 @@
newFolder.getId().toString(), null);
StateDTO folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
- assertEquals(newTitle, folderAgain.getFolder().getName());
+ assertEquals(newTitle, folderAgain.getContainer().getName());
newTitle = "folder last name";
@@ -88,7 +89,7 @@
folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
- assertEquals(newTitle, folderAgain.getFolder().getName());
+ assertEquals(newTitle, folderAgain.getContainer().getName());
}
@@ -96,7 +97,7 @@
public void folderRenameOtherGroupFails() throws Exception {
doLogin();
defaultContent = getDefaultContent();
- final ContainerDTO folder = defaultContent.getFolder();
+ final ContainerDTO folder = defaultContent.getContainer();
final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(), folder
.getId().toString(), null);
@@ -108,7 +109,7 @@
public void folderRootRenameMustFail() throws Exception {
doLogin();
defaultContent = getDefaultContent();
- final ContainerDTO folder = defaultContent.getFolder();
+ final ContainerDTO folder = defaultContent.getContainer();
final String newTitle = "folder new name";
final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(), folder
@@ -117,7 +118,7 @@
assertEquals(newTitle, result);
- final ContainerDTO folderAgain = getDefaultContent().getFolder();
+ final ContainerDTO folderAgain = getDefaultContent().getContainer();
assertEquals(newTitle, folderAgain.getName());
}
@@ -161,13 +162,14 @@
public void tokenRename() throws Exception {
doLogin();
defaultContent = getDefaultContent();
- final ContainerDTO folder = defaultContent.getFolder();
+ final ContainerDTO folder = defaultContent.getContainer();
final String oldTitle = "some title";
String newTitle = "folder new name";
- final StateDTO newState = contentService.addFolder(session.getHash(), groupShortName, folder.getId(), oldTitle);
+ final StateDTO newState = contentService.addFolder(session.getHash(), groupShortName, folder.getId(), oldTitle,
+ DocumentClientTool.TYPE_FOLDER);
- final ContainerSimpleDTO newFolder = newState.getFolder().getChilds().get(0);
+ final ContainerDTO newFolder = newState.getContainer();
assertEquals(oldTitle, newFolder.getName());
@@ -182,7 +184,7 @@
final StateDTO folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
- assertEquals(newTitle, folderAgain.getFolder().getName());
+ assertEquals(newTitle, folderAgain.getContainer().getName());
}
}
More information about the kune-commits
mailing list