[kune-commits] r876 - in trunk: img img/nav-icons
src/main/java/org/ourproject/kune/app/public/css
src/main/java/org/ourproject/kune/docs/client
src/main/java/org/ourproject/kune/docs/client/actions
src/main/java/org/ourproject/kune/docs/client/cnt
src/main/java/org/ourproject/kune/docs/server
src/main/java/org/ourproject/kune/platf/client/actions
src/main/java/org/ourproject/kune/platf/client/actions/toolbar
src/main/java/org/ourproject/kune/platf/client/rpc
src/main/java/org/ourproject/kune/platf/client/services
src/main/java/org/ourproject/kune/platf/public/images/nav
src/main/java/org/ourproject/kune/platf/server/content
src/main/java/org/ourproject/kune/platf/server/domain
src/main/java/org/ourproject/kune/platf/server/init
src/main/java/org/ourproject/kune/platf/server/manager
src/main/java/org/ourproject/kune/platf/server/manager/impl
src/main/java/org/ourproject/kune/platf/server/rpc
src/main/java/org/ourproject/kune/workspace/client/ctxnav
src/test/java/org/ourproject/kune/platf/client
src/test/java/org/ourproject/kune/platf/client/actions
src/test/java/org/ourproject/kune/platf/integration/content
src/test/java/org/ourproject/kune/platf/server/manager
src/test/java/org/ourproject/kune/platf/server/manager/impl
vjrj
vjrj at ourproject.org
Sat Sep 20 01:33:39 CEST 2008
Author: vjrj
Date: 2008-09-20 01:33:06 +0200 (Sat, 20 Sep 2008)
New Revision: 876
Added:
trunk/img/nav-icons/wiki.png
trunk/img/nav-icons/wiki_add.png
trunk/img/nav-icons/wikipage.png
trunk/img/nav-icons/wikipage_add.png
trunk/img/wiki.svg
trunk/src/main/java/org/ourproject/kune/docs/client/actions/
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentEditAction.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentEditInProgressAction.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentPublishAction.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentRejectAction.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSetStatusAction.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSubmitForPublishAction.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentTranslationAction.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentTrashAction.java
trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/wiki.png
trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/wiki_add.png
trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/wikipage.png
trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/wikipage_add.png
trunk/src/test/java/org/ourproject/kune/platf/client/actions/
trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java
trunk/src/test/java/org/ourproject/kune/platf/server/manager/impl/
trunk/src/test/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerTest.java
Removed:
trunk/src/main/java/org/ourproject/kune/docs/client/ContentEditAction.java
trunk/src/main/java/org/ourproject/kune/docs/client/ContentTranslationAction.java
trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java
Modified:
trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.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/ActionRegistry.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ContentActionRegistry.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ContextActionRegistry.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.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/services/KuneErrorHandler.java
trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java
trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/SocialNetworkManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/UserManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java
trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.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/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
Log:
Incomplete - task 53: SocialNetworkManager.getParticipation bug: personal groups showed ...
Incomplete - task 54: ContextNav refactoring (less bussiness logic in view) and tests
Added: trunk/img/nav-icons/wiki.png
===================================================================
(Binary files differ)
Property changes on: trunk/img/nav-icons/wiki.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/img/nav-icons/wiki_add.png
===================================================================
(Binary files differ)
Property changes on: trunk/img/nav-icons/wiki_add.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/img/nav-icons/wikipage.png
===================================================================
(Binary files differ)
Property changes on: trunk/img/nav-icons/wikipage.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/img/nav-icons/wikipage_add.png
===================================================================
(Binary files differ)
Property changes on: trunk/img/nav-icons/wikipage_add.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/img/wiki.svg
===================================================================
--- trunk/img/wiki.svg 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/img/wiki.svg 2008-09-19 23:33:06 UTC (rev 876)
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16px"
+ height="16px"
+ id="svg2160"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/Users/vjrj/Desktop"
+ sodipodi:docname="wiki.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/Users/vjrj/Desktop/wikipage_add.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs2162">
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3201">
+ <stop
+ style="stop-color:#ff9900;stop-opacity:1"
+ offset="0"
+ id="stop3203" />
+ <stop
+ style="stop-color:#ffc400;stop-opacity:0;"
+ offset="1"
+ id="stop3205" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3201"
+ id="linearGradient3207"
+ x1="9.0366335"
+ y1="7.9007425"
+ x2="-6.7049499"
+ y2="14.666832"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3201"
+ id="linearGradient3417"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.6797384,0,0,0.6722173,4.432061,3.547779)"
+ x1="9.0366335"
+ y1="7.9007425"
+ x2="-6.7049499"
+ y2="14.666832" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3201"
+ id="linearGradient3485"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.6797384,0,0,0.6722173,4.432061,3.547779)"
+ x1="9.0366335"
+ y1="7.9007425"
+ x2="-6.7049499"
+ y2="14.666832" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="22.197802"
+ inkscape:cx="8"
+ inkscape:cy="8"
+ inkscape:current-layer="layer3"
+ showgrid="true"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="1409"
+ inkscape:window-height="914"
+ inkscape:window-x="31"
+ inkscape:window-y="86" />
+ <metadata
+ id="metadata2165">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:groupmode="layer"
+ id="layer3"
+ inkscape:label="wikipage"
+ style="display:inline">
+ <image
+ style="display:inline"
+ y="0"
+ x="0"
+ id="image3267"
+ height="16"
+ width="16"
+ sodipodi:absref="/Users/vjrj/Desktop/page_add.png"
+ xlink:href="page_add.png" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="blank"
+ style="display:none">
+ <image
+ style="display:inline"
+ y="0"
+ x="-8.8817842e-16"
+ id="image2226"
+ height="16"
+ width="16"
+ sodipodi:absref="/Users/vjrj/Desktop/page.png"
+ xlink:href="page.png"
+ inkscape:export-filename="/Users/vjrj/Desktop/wikipage.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90" />
+ </g>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ style="display:inline">
+ <g
+ id="g3481"
+ transform="translate(19,-7.4782179)">
+ <image
+ inkscape:export-ydpi="90"
+ inkscape:export-xdpi="90"
+ inkscape:export-filename="/Users/vjrj/Desktop/wikiicon.png"
+ xlink:href="wiki.png"
+ sodipodi:absref="/Users/vjrj/Desktop/wiki.png"
+ width="16"
+ height="16"
+ id="image3413"
+ x="0"
+ y="0" />
+ <path
+ inkscape:export-ydpi="90"
+ inkscape:export-xdpi="90"
+ inkscape:export-filename="/Users/vjrj/Desktop/wikiicon.png"
+ sodipodi:nodetypes="cccccc"
+ id="path3362"
+ d="M 13.130693,6.917851 L 10.889575,11.9505 L 10.209836,7.9171915 L 8.170622,11.9505 L 7.490883,8.2253455 L 6.811146,9.261626"
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:url(#linearGradient3485);stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" />
+ </g>
+ <image
+ y="-0.49554455"
+ x="13.559901"
+ id="image3478"
+ height="16"
+ width="16"
+ sodipodi:absref="/Users/vjrj/Desktop/add-small.png"
+ xlink:href="add-small.png" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer4"
+ inkscape:label="w_of_wikipage"
+ style="display:inline">
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:url(#linearGradient3207);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ d="M 12.79703,5.013366 L 9.5,12.5 L 8.5,6.4999997 L 5.5,12.5 L 4.5,6.9584154 L 3.5,8.4999997"
+ id="path2229"
+ sodipodi:nodetypes="cccccc"
+ inkscape:export-filename="/Users/vjrj/Desktop/wikipage.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90" />
+ </g>
+</svg>
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-09-19 23:33:06 UTC (rev 876)
@@ -3463,8 +3463,16 @@
}
/* others */
-.k-linethrough {
+.k-textlinethrough {
text-decoration: line-through;
}
+.k-textnormal {
+ text-decoration: inherit;
+}
+.k-textunderline {
+ text-decoration: underline;
+}
+
+
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-09-19 23:33:06 UTC (rev 876)
@@ -628,6 +628,14 @@
}
/* others */
-.k-linethrough {
+.k-textlinethrough {
text-decoration: line-through;
}
+
+.k-textnormal {
+ text-decoration: inherit;
+}
+
+.k-textunderline {
+ text-decoration: underline;
+}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/ContentEditAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ContentEditAction.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ContentEditAction.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -1,21 +0,0 @@
-package org.ourproject.kune.docs.client;
-
-import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionPosition;
-import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
-
-import com.calclab.suco.client.signal.Slot;
-
-public class ContentEditAction extends ActionButtonDescriptor<StateToken> {
-
- public ContentEditAction(final I18nUITranslationService i18n) {
- super(AccessRolDTO.Editor, ActionPosition.topbar, new Slot<StateToken>() {
- public void onEvent(final StateToken stateToken) {
- }
- });
- this.setTextDescription(i18n.tWithNT("Edit", "used in button"));
- // this.setIconUrl("images/");
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/ContentTranslationAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ContentTranslationAction.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ContentTranslationAction.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -1,24 +0,0 @@
-package org.ourproject.kune.docs.client;
-
-import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionPosition;
-import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
-import org.ourproject.kune.workspace.client.site.Site;
-
-import com.calclab.suco.client.signal.Slot;
-
-public class ContentTranslationAction extends ActionButtonDescriptor<StateToken> {
-
- public ContentTranslationAction(final I18nUITranslationService i18n) {
- super(AccessRolDTO.Editor, ActionPosition.topbar, new Slot<StateToken>() {
- public void onEvent(final StateToken stateToken) {
- Site.important(i18n.t("Sorry, this functionality is currently in development"));
- }
- });
- this.setTextDescription(i18n.tWithNT("Translate", "used in button"));
- this.setToolTip(i18n.t("Translate this document to other languages"));
- // this.setIconUrl("images/");
- }
-}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -1,5 +1,12 @@
package org.ourproject.kune.docs.client;
+import org.ourproject.kune.docs.client.actions.ContentEditAction;
+import org.ourproject.kune.docs.client.actions.ContentEditInProgressAction;
+import org.ourproject.kune.docs.client.actions.ContentPublishAction;
+import org.ourproject.kune.docs.client.actions.ContentRejectAction;
+import org.ourproject.kune.docs.client.actions.ContentSubmitForPublishAction;
+import org.ourproject.kune.docs.client.actions.ContentTranslationAction;
+import org.ourproject.kune.docs.client.actions.ContentTrashAction;
import org.ourproject.kune.docs.client.cnt.DocumentContent;
import org.ourproject.kune.docs.client.cnt.DocumentContentPanel;
import org.ourproject.kune.docs.client.cnt.DocumentContentPresenter;
@@ -66,6 +73,28 @@
}
});
+ register(SingletonScope.class, new Factory<ContentPublishAction>(ContentPublishAction.class) {
+ public ContentPublishAction create() {
+ return new ContentPublishAction($(Session.class), $$(ContentServiceAsync.class), i18n);
+ }
+ }, new Factory<ContentRejectAction>(ContentRejectAction.class) {
+ public ContentRejectAction create() {
+ return new ContentRejectAction($(Session.class), $$(ContentServiceAsync.class), i18n);
+ }
+ }, new Factory<ContentEditInProgressAction>(ContentEditInProgressAction.class) {
+ public ContentEditInProgressAction create() {
+ return new ContentEditInProgressAction($(Session.class), $$(ContentServiceAsync.class), i18n);
+ }
+ }, new Factory<ContentSubmitForPublishAction>(ContentSubmitForPublishAction.class) {
+ public ContentSubmitForPublishAction create() {
+ return new ContentSubmitForPublishAction($(Session.class), $$(ContentServiceAsync.class), i18n);
+ }
+ }, new Factory<ContentTrashAction>(ContentTrashAction.class) {
+ public ContentTrashAction create() {
+ return new ContentTrashAction($(Session.class), $$(ContentServiceAsync.class), i18n);
+ }
+ });
+
register(SingletonScope.class, new Factory<ContentEditAction>(ContentEditAction.class) {
public ContentEditAction create() {
return new ContentEditAction(i18n);
@@ -91,6 +120,15 @@
$(ContentActionRegistry.class).addAction(DocumentClientTool.TYPE_DOCUMENT, $(ContentEditAction.class));
$(ContentActionRegistry.class).addAction(DocumentClientTool.TYPE_DOCUMENT,
$(ContentTranslationAction.class));
+ $(ContentActionRegistry.class).addAction(DocumentClientTool.TYPE_DOCUMENT,
+ $(ContentPublishAction.class));
+ $(ContentActionRegistry.class)
+ .addAction(DocumentClientTool.TYPE_DOCUMENT, $(ContentRejectAction.class));
+ $(ContentActionRegistry.class).addAction(DocumentClientTool.TYPE_DOCUMENT,
+ $(ContentSubmitForPublishAction.class));
+ $(ContentActionRegistry.class).addAction(DocumentClientTool.TYPE_DOCUMENT,
+ $(ContentEditInProgressAction.class));
+ $(ContentActionRegistry.class).addAction(DocumentClientTool.TYPE_DOCUMENT, $(ContentTrashAction.class));
presenter.init(panel);
return presenter;
}
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-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -56,10 +56,12 @@
public class DocumentClientTool extends AbstractClientTool {
public static final String TYPE_ROOT = "docs.root";
public static final String TYPE_FOLDER = "docs.folder";
+ public static final String TYPE_DOCUMENT = "docs.doc";
public static final String TYPE_GALLERY = "docs.gallery";
public static final String TYPE_BLOG = "docs.blog";
- public static final String TYPE_DOCUMENT = "docs.doc";
public static final String TYPE_POST = "docs.post";
+ public static final String TYPE_WIKI = "docs.wiki";
+ public static final String TYPE_WIKIPAGE = "docs.wikipage";
public static final String TYPE_UPLOADEDFILE = "docs.uploaded";
public static final String NAME = "docs";
@@ -71,7 +73,6 @@
private final Session session;
private final Provider<ContentServiceAsync> contentServiceProvider;
private final Provider<FileUploader> fileUploaderProvider;
- private final ContentActionRegistry contentActionRegistry;
private final ContextActionRegistry contextActionRegistry;
private final DragDropContentRegistry dragDropContentRegistry;
private final ContentIconsRegistry contentIconsRegistry;
@@ -92,7 +93,6 @@
this.stateManager = stateManager;
this.contentServiceProvider = contentServiceProvider;
this.fileUploaderProvider = fileUploaderProvider;
- this.contentActionRegistry = contentActionRegistry;
this.contextActionRegistry = contextActionRegistry;
this.dragDropContentRegistry = dragDropContentRegistry;
this.contentIconsRegistry = contentIconsRegistry;
@@ -116,11 +116,13 @@
}
private void createActions() {
-
final ActionMenuDescriptor<StateToken> addFolder = createFolderAction(TYPE_FOLDER, "images/nav/folder_add.png",
- i18n.t("New folder"), i18n.t("Folder"), i18n.t("New"));
+ i18n.t("New folder"), i18n.t("Folder"), i18n.t("New"), i18n.t("New folder"));
final ActionMenuDescriptor<StateToken> addGallery = createFolderAction(TYPE_GALLERY,
- "images/nav/gallery_add.png", i18n.t("New gallery"), i18n.t("Folder"), i18n.t("New"));
+ "images/nav/gallery_add.png", i18n.t("New gallery"), i18n.t("Folder"), i18n.t("New"), i18n
+ .t("New gallery"));
+ final ActionMenuDescriptor<StateToken> addWiki = createFolderAction(TYPE_WIKI, "images/nav/wiki_add.png", i18n
+ .t("New wiki"), i18n.t("Folder"), i18n.t("New"), i18n.t("wiki"));
final ActionMenuDescriptor<StateToken> addDoc = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Editor,
ActionPosition.topbarAndItemMenu, new Slot<StateToken>() {
@@ -258,7 +260,6 @@
contextActionRegistry.addAction(TYPE_FOLDER, go);
contextActionRegistry.addAction(TYPE_FOLDER, addDoc);
contextActionRegistry.addAction(TYPE_FOLDER, addFolder);
- contentActionRegistry.addAction(TYPE_FOLDER, delContainer);
contextActionRegistry.addAction(TYPE_FOLDER, delContainer);
contextActionRegistry.addAction(TYPE_FOLDER, rename);
contextActionRegistry.addAction(TYPE_FOLDER, goGroupHome);
@@ -274,15 +275,19 @@
contextActionRegistry.addAction(TYPE_GALLERY, goGroupHome);
contextActionRegistry.addAction(TYPE_GALLERY, refresh);
+ contextActionRegistry.addAction(TYPE_WIKI, go);
+ contextActionRegistry.addAction(TYPE_WIKI, goGroupHome);
+ contextActionRegistry.addAction(TYPE_WIKI, refresh);
+
contextActionRegistry.addAction(TYPE_ROOT, addDoc);
contextActionRegistry.addAction(TYPE_ROOT, addFolder);
contextActionRegistry.addAction(TYPE_ROOT, addGallery);
+ contextActionRegistry.addAction(TYPE_ROOT, addWiki);
contextActionRegistry.addAction(TYPE_ROOT, goGroupHome);
contextActionRegistry.addAction(TYPE_ROOT, refresh);
contextActionRegistry.addAction(TYPE_ROOT, uploadFile);
contextActionRegistry.addAction(TYPE_DOCUMENT, go);
- contentActionRegistry.addAction(TYPE_DOCUMENT, delContent);
contextActionRegistry.addAction(TYPE_DOCUMENT, delContent);
contextActionRegistry.addAction(TYPE_DOCUMENT, rename);
contextActionRegistry.addAction(TYPE_DOCUMENT, goGroupHome);
@@ -291,15 +296,15 @@
}
private ActionMenuDescriptor<StateToken> createFolderAction(final String contentTypeId, final String iconUrl,
- final String textDescription, final String parentMenuTitle, final String parentMenuSubtitle) {
+ final String textDescription, final String parentMenuTitle, final String parentMenuSubtitle,
+ final String defaultName) {
final ActionMenuDescriptor<StateToken> addFolder;
addFolder = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Editor, ActionPosition.topbarAndItemMenu,
new Slot<StateToken>() {
public void onEvent(final StateToken stateToken) {
Site.showProgressProcessing();
- contentServiceProvider.get().addFolder(session.getUserHash(), stateToken, textDescription,
+ contentServiceProvider.get().addFolder(session.getUserHash(), stateToken, defaultName,
contentTypeId, new AsyncCallbackSimple<StateDTO>() {
-
public void onSuccess(final StateDTO state) {
contextNavigator.setEditOnNextStateChange(true);
stateManager.setRetrievedState(state);
@@ -348,6 +353,8 @@
contentIconsRegistry.registerContentTypeIcon(TYPE_GALLERY, "images/nav/gallery.png");
contentIconsRegistry.registerContentTypeIcon(TYPE_DOCUMENT, "images/nav/page.png");
contentIconsRegistry.registerContentTypeIcon(TYPE_POST, "images/nav/post.png");
+ contentIconsRegistry.registerContentTypeIcon(TYPE_WIKI, "images/nav/wiki.png");
+ contentIconsRegistry.registerContentTypeIcon(TYPE_WIKIPAGE, "images/nav/wikipage.png");
}
}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentEditAction.java (from rev 874, trunk/src/main/java/org/ourproject/kune/docs/client/ContentEditAction.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ContentEditAction.java 2008-09-18 15:37:09 UTC (rev 874)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentEditAction.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -0,0 +1,21 @@
+package org.ourproject.kune.docs.client.actions;
+
+import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionPosition;
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+
+import com.calclab.suco.client.signal.Slot;
+
+public class ContentEditAction extends ActionButtonDescriptor<StateToken> {
+
+ public ContentEditAction(final I18nUITranslationService i18n) {
+ super(AccessRolDTO.Editor, ActionPosition.topbar, new Slot<StateToken>() {
+ public void onEvent(final StateToken stateToken) {
+ }
+ });
+ this.setTextDescription(i18n.tWithNT("Edit", "used in button"));
+ // this.setIconUrl("images/");
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentEditInProgressAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentEditInProgressAction.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentEditInProgressAction.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -0,0 +1,20 @@
+/**
+ *
+ */
+package org.ourproject.kune.docs.client.actions;
+
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+
+import com.calclab.suco.client.provider.Provider;
+
+public class ContentEditInProgressAction extends ContentSetStatusAction {
+ public ContentEditInProgressAction(final Session session, final Provider<ContentServiceAsync> provider,
+ final I18nUITranslationService i18n) {
+ super(session, provider, i18n, AccessRolDTO.Administrator, i18n.t("Editing in progress"),
+ ContentStatusDTO.editingInProgress);
+ }
+}
\ No newline at end of file
Added: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentPublishAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentPublishAction.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentPublishAction.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -0,0 +1,20 @@
+/**
+ *
+ */
+package org.ourproject.kune.docs.client.actions;
+
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+
+import com.calclab.suco.client.provider.Provider;
+
+public class ContentPublishAction extends ContentSetStatusAction {
+ public ContentPublishAction(final Session session, final Provider<ContentServiceAsync> provider,
+ final I18nUITranslationService i18n) {
+ super(session, provider, i18n, AccessRolDTO.Administrator, i18n.t("Published online"),
+ ContentStatusDTO.publishedOnline);
+ }
+}
\ No newline at end of file
Added: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentRejectAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentRejectAction.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentRejectAction.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -0,0 +1,19 @@
+/**
+ *
+ */
+package org.ourproject.kune.docs.client.actions;
+
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+
+import com.calclab.suco.client.provider.Provider;
+
+public class ContentRejectAction extends ContentSetStatusAction {
+ public ContentRejectAction(final Session session, final Provider<ContentServiceAsync> provider,
+ final I18nUITranslationService i18n) {
+ super(session, provider, i18n, AccessRolDTO.Administrator, i18n.t("Rejected"), ContentStatusDTO.rejected);
+ }
+}
\ No newline at end of file
Added: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSetStatusAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSetStatusAction.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSetStatusAction.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -0,0 +1,39 @@
+package org.ourproject.kune.docs.client.actions;
+
+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.ContentStatusDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+
+import com.calclab.suco.client.provider.Provider;
+import com.calclab.suco.client.signal.Slot;
+
+public abstract class ContentSetStatusAction extends ActionMenuDescriptor<StateToken> {
+
+ public ContentSetStatusAction(final Session session, final Provider<ContentServiceAsync> contentServiceProvider,
+ final I18nUITranslationService i18n, final AccessRolDTO rol, final String textDescription,
+ final ContentStatusDTO status) {
+ super(rol, ActionPosition.topbarAndItemMenu, new Slot<StateToken>() {
+ public void onEvent(final StateToken stateToken) {
+ final AsyncCallbackSimple<Object> callback = new AsyncCallbackSimple<Object>() {
+ public void onSuccess(final Object result) {
+ session.getCurrentState().setStatus(status);
+ }
+ };
+ if (status.equals(ContentStatusDTO.publishedOnline) || status.equals(ContentStatusDTO.rejected)) {
+ contentServiceProvider.get().setStatusAsAdmin(session.getUserHash(), stateToken, status, callback);
+ } else {
+ contentServiceProvider.get().setStatus(session.getUserHash(), stateToken, status, callback);
+ }
+ }
+ });
+ this.setTextDescription(textDescription);
+ this.setParentMenuTitle(i18n.t("File"));
+ this.setParentSubMenuTitle(i18n.t("Change the status"));
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSubmitForPublishAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSubmitForPublishAction.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSubmitForPublishAction.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -0,0 +1,20 @@
+/**
+ *
+ */
+package org.ourproject.kune.docs.client.actions;
+
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+
+import com.calclab.suco.client.provider.Provider;
+
+public class ContentSubmitForPublishAction extends ContentSetStatusAction {
+ public ContentSubmitForPublishAction(final Session session, final Provider<ContentServiceAsync> provider,
+ final I18nUITranslationService i18n) {
+ super(session, provider, i18n, AccessRolDTO.Administrator, i18n.t("Submitted for publish"),
+ ContentStatusDTO.publishedOnline);
+ }
+}
\ No newline at end of file
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentTranslationAction.java (from rev 874, trunk/src/main/java/org/ourproject/kune/docs/client/ContentTranslationAction.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ContentTranslationAction.java 2008-09-18 15:37:09 UTC (rev 874)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentTranslationAction.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -0,0 +1,24 @@
+package org.ourproject.kune.docs.client.actions;
+
+import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionPosition;
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.site.Site;
+
+import com.calclab.suco.client.signal.Slot;
+
+public class ContentTranslationAction extends ActionButtonDescriptor<StateToken> {
+
+ public ContentTranslationAction(final I18nUITranslationService i18n) {
+ super(AccessRolDTO.Editor, ActionPosition.topbar, new Slot<StateToken>() {
+ public void onEvent(final StateToken stateToken) {
+ Site.important(i18n.t("Sorry, this functionality is currently in development"));
+ }
+ });
+ this.setTextDescription(i18n.tWithNT("Translate", "used in button"));
+ this.setToolTip(i18n.t("Translate this document to other languages"));
+ // this.setIconUrl("images/");
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentTrashAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentTrashAction.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentTrashAction.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -0,0 +1,20 @@
+/**
+ *
+ */
+package org.ourproject.kune.docs.client.actions;
+
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+
+import com.calclab.suco.client.provider.Provider;
+
+public class ContentTrashAction extends ContentSetStatusAction {
+ public ContentTrashAction(final Session session, final Provider<ContentServiceAsync> provider,
+ final I18nUITranslationService i18n) {
+ super(session, provider, i18n, AccessRolDTO.Administrator, i18n.t("In the dustbin"),
+ ContentStatusDTO.inTheDustbin);
+ }
+}
\ No newline at end of file
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-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -62,14 +62,14 @@
private final I18nUITranslationService i18n;
private final KuneErrorHandler errorHandler;
private final ActionToolbar toolbar;
- private final ActionRegistry actionRegistry;
+ private final ActionRegistry<StateToken> actionRegistry;
public DocumentContentPresenter(final StateManager stateManager, final I18nUITranslationService i18n,
final KuneErrorHandler errorHandler, final Session session, final RateIt rateIt,
final Provider<DocumentReader> docReaderProvider, final Provider<TextEditor> textEditorProvider,
final Provider<FolderViewer> folderViewerProvider,
final Provider<ContentServiceAsync> contentServiceProvider, final ActionToolbar toolbar,
- final ActionRegistry actionRegistry) {
+ final ActionRegistry<StateToken> actionRegistry) {
this.stateManager = stateManager;
this.i18n = i18n;
this.errorHandler = errorHandler;
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-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/docs/server/DocumentServerTool.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -26,6 +26,7 @@
import org.ourproject.kune.platf.server.content.ContentManager;
import org.ourproject.kune.platf.server.domain.Container;
import org.ourproject.kune.platf.server.domain.Content;
+import org.ourproject.kune.platf.server.domain.ContentStatus;
import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.domain.ToolConfiguration;
import org.ourproject.kune.platf.server.domain.User;
@@ -38,10 +39,12 @@
public class DocumentServerTool implements ServerTool {
public static final String TYPE_ROOT = "docs.root";
public static final String TYPE_FOLDER = "docs.folder";
+ public static final String TYPE_DOCUMENT = "docs.doc";
public static final String TYPE_GALLERY = "docs.gallery";
public static final String TYPE_BLOG = "docs.blog";
- public static final String TYPE_DOCUMENT = "docs.doc";
public static final String TYPE_POST = "docs.post";
+ public static final String TYPE_WIKI = "docs.wiki";
+ public static final String TYPE_WIKIPAGE = "docs.wikipage";
public static final String TYPE_UPLOADEDFILE = "docs.uploaded";
public static final String NAME = "docs";
@@ -78,6 +81,7 @@
descriptor.addAuthor(user);
descriptor.setLanguage(user.getLanguage());
descriptor.setTypeId(TYPE_DOCUMENT);
+ descriptor.setStatus(ContentStatus.publishedOnline);
group.setDefaultContent(descriptor);
return group;
}
@@ -97,11 +101,14 @@
}
private void checkTypeId(final String parentTypeId, final String typeId) {
- if (typeId.equals(TYPE_FOLDER) || typeId.equals(TYPE_GALLERY)) {
+ if (typeId.equals(TYPE_FOLDER) || typeId.equals(TYPE_GALLERY) || typeId.equals(TYPE_WIKI)) {
// ok valid container
if (typeId.equals(TYPE_GALLERY) && !parentTypeId.equals(TYPE_ROOT)) {
throw new ContainerNotPermittedException();
}
+ if (typeId.equals(TYPE_WIKI) && !parentTypeId.equals(TYPE_ROOT)) {
+ throw new ContainerNotPermittedException();
+ }
} else {
throw new ContainerNotPermittedException();
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -3,35 +3,34 @@
import java.util.HashMap;
import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-public class ActionRegistry {
+public class ActionRegistry<T> {
- private final HashMap<String, ActionCollection<StateToken>> actions;
+ private final HashMap<String, ActionCollection<T>> actions;
public ActionRegistry() {
- actions = new HashMap<String, ActionCollection<StateToken>>();
+ actions = new HashMap<String, ActionCollection<T>>();
}
- public void addAction(final String contentTypeId, final ActionDescriptor<StateToken> action) {
- final ActionCollection<StateToken> actionColl = getActions(contentTypeId);
+ public void addAction(final String contentTypeId, final ActionDescriptor<T> action) {
+ final ActionCollection<T> actionColl = getActions(contentTypeId);
actionColl.add(action);
}
- public boolean checkEnabling(final ActionDescriptor<StateToken> action, final StateToken stateToken) {
- final ActionEnableCondition<StateToken> enableCondition = action.getEnableCondition();
- return enableCondition != null ? enableCondition.mustBeEnabled(stateToken) : true;
+ public boolean checkEnabling(final ActionDescriptor<T> action, final T T) {
+ final ActionEnableCondition<T> enableCondition = action.getEnableCondition();
+ return enableCondition != null ? enableCondition.mustBeEnabled(T) : true;
}
- public void removeAction(final String contentTypeId, final ActionDescriptor<StateToken> action) {
+ public void removeAction(final String contentTypeId, final ActionDescriptor<T> action) {
actions.get(contentTypeId).remove(action);
}
- public ActionCollectionSet<StateToken> selectCurrentActions(final AccessRightsDTO rights, final String contentTypeId) {
- final ActionCollectionSet<StateToken> set = new ActionCollectionSet<StateToken>();
+ public ActionCollectionSet<T> selectCurrentActions(final AccessRightsDTO rights, final String contentTypeId) {
+ final ActionCollectionSet<T> set = new ActionCollectionSet<T>();
boolean add = false;
- for (final ActionDescriptor<StateToken> action : getActions(contentTypeId)) {
+ for (final ActionDescriptor<T> action : getActions(contentTypeId)) {
switch (action.getAccessRol()) {
case Administrator:
add = rights.isAdministrable();
@@ -64,10 +63,10 @@
return set;
}
- private ActionCollection<StateToken> getActions(final String contentTypeId) {
- ActionCollection<StateToken> actionColl = actions.get(contentTypeId);
+ private ActionCollection<T> getActions(final String contentTypeId) {
+ ActionCollection<T> actionColl = actions.get(contentTypeId);
if (actionColl == null) {
- actionColl = new ActionCollection<StateToken>();
+ actionColl = new ActionCollection<T>();
actions.put(contentTypeId, actionColl);
}
return actionColl;
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ContentActionRegistry.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ContentActionRegistry.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ContentActionRegistry.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -1,5 +1,7 @@
package org.ourproject.kune.platf.client.actions;
-public class ContentActionRegistry extends ActionRegistry {
+import org.ourproject.kune.platf.client.dto.StateToken;
+public class ContentActionRegistry extends ActionRegistry<StateToken> {
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ContextActionRegistry.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ContextActionRegistry.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ContextActionRegistry.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -1,5 +1,7 @@
package org.ourproject.kune.platf.client.actions;
-public class ContextActionRegistry extends ActionRegistry {
+import org.ourproject.kune.platf.client.dto.StateToken;
+public class ContextActionRegistry extends ActionRegistry<StateToken> {
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -62,7 +62,7 @@
button.addListener(new ButtonListenerAdapter() {
@Override
public void onClick(final Button button, final EventObject e) {
- actionManagerProvider.get().doAction(action, session.getCurrentState().getStateToken());
+ actionManagerProvider.get().doAction(action, session.getCurrentStateToken());
}
});
if (iconUrl != null) {
@@ -143,7 +143,7 @@
final Item item = new Item(action.getText(), new BaseItemListenerAdapter() {
@Override
public void onClick(BaseItem item, EventObject e) {
- actionManagerProvider.get().doAction(action, session.getCurrentState().getStateToken());
+ actionManagerProvider.get().doAction(action, session.getCurrentStateToken());
}
});
item.setIcon(action.getIconUrl());
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -13,10 +13,10 @@
public class ActionToolbarPresenter implements ActionToolbar {
private final ActionToolbarPanel toolbar;
private final Session session;
- private final ActionRegistry actionRegistry;
+ private final ActionRegistry<StateToken> actionRegistry;
public ActionToolbarPresenter(final Session session, final ActionToolbarPanel actionToolbarPanel,
- final ActionRegistry actionRegistry) {
+ final ActionRegistry<StateToken> actionRegistry) {
this.session = session;
toolbar = actionToolbarPanel;
this.actionRegistry = actionRegistry;
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-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -25,6 +25,7 @@
import org.ourproject.kune.platf.client.dto.CommentDTO;
import org.ourproject.kune.platf.client.dto.ContentDTO;
+import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
@@ -72,6 +73,10 @@
void setPublishedOn(String userHash, StateToken token, Date date) throws DefaultException;
+ void setStatus(String userHash, StateToken stateToken, ContentStatusDTO status);
+
+ void setStatusAsAdmin(String userHash, StateToken stateToken, ContentStatusDTO status);
+
List<TagResultDTO> setTags(String userHash, StateToken token, String tags) throws DefaultException;
CommentDTO voteComment(String userHash, StateToken token, Long commentId, boolean votePositive)
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-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -25,6 +25,7 @@
import org.ourproject.kune.platf.client.dto.CommentDTO;
import org.ourproject.kune.platf.client.dto.ContentDTO;
+import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
@@ -72,6 +73,11 @@
void setPublishedOn(String userHash, StateToken token, Date publishedOn, AsyncCallback<?> asyncCallback);
+ void setStatus(String userHash, StateToken stateToken, ContentStatusDTO status, AsyncCallback<?> asyncCallback);
+
+ void setStatusAsAdmin(String userHash, StateToken stateToken, ContentStatusDTO status,
+ AsyncCallback<?> asyncCallback);
+
void setTags(String userHash, StateToken token, String tags, AsyncCallback<List<TagResultDTO>> asyncCallback);
void voteComment(String userHash, StateToken token, Long commentId, boolean votePositive,
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -22,6 +22,7 @@
import org.ourproject.kune.platf.client.errors.AccessViolationException;
import org.ourproject.kune.platf.client.errors.AlreadyGroupMemberException;
import org.ourproject.kune.platf.client.errors.AlreadyUserMemberException;
+import org.ourproject.kune.platf.client.errors.ContainerNotPermittedException;
import org.ourproject.kune.platf.client.errors.ContentNotFoundException;
import org.ourproject.kune.platf.client.errors.GroupNotFoundException;
import org.ourproject.kune.platf.client.errors.LastAdminInGroupException;
@@ -96,6 +97,10 @@
logException(e);
Site.error(i18n.t("Content not found"));
stateManagerProvider.get().gotoToken("");
+ } catch (final ContainerNotPermittedException e) {
+ logException(e);
+ Site.error(i18n.t("Action not permitted in this location"));
+ stateManagerProvider.get().gotoToken("");
} catch (final LastAdminInGroupException e) {
logException(e);
getWorkspaceSkeleton().showAlertMessage(
Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/wiki.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/wiki.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/wiki_add.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/wiki_add.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/wikipage.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/wikipage.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/wikipage_add.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/wikipage_add.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManager.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManager.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -25,6 +25,7 @@
import org.ourproject.kune.platf.client.errors.DefaultException;
import org.ourproject.kune.platf.server.domain.Container;
import org.ourproject.kune.platf.server.domain.Content;
+import org.ourproject.kune.platf.server.domain.ContentStatus;
import org.ourproject.kune.platf.server.domain.I18nLanguage;
import org.ourproject.kune.platf.server.domain.User;
import org.ourproject.kune.platf.server.manager.Manager;
@@ -32,34 +33,36 @@
public interface ContentManager extends Manager<Content, Long> {
- public void addAuthor(User user, Long contentId, String authorShortName) throws DefaultException;
+ void addAuthor(User user, Long contentId, String authorShortName) throws DefaultException;
- public Content createContent(String title, String body, User author, Container container);
+ Content createContent(String title, String body, User author, Container container);
- public void delContent(User user, Long contentId) throws DefaultException;
+ void delContent(User user, Long contentId) throws DefaultException;
- public Double getRateAvg(Content content);
+ Double getRateAvg(Content content);
- public Long getRateByUsers(Content content);
+ Long getRateByUsers(Content content);
- public Double getRateContent(User user, Content content);
+ Double getRateContent(User user, Content content);
- public void rateContent(User rater, Long contentId, Double value) throws DefaultException;
+ void rateContent(User rater, Long contentId, Double value) throws DefaultException;
- public void removeAuthor(User user, Long contentId, String authorShortName) throws DefaultException;
+ void removeAuthor(User user, Long contentId, String authorShortName) throws DefaultException;
- public String renameContent(User user, Long contentId, String newName) throws DefaultException;
+ String renameContent(User user, Long contentId, String newName) throws DefaultException;
- public Content save(User editor, Content descriptor, String content);
+ Content save(User editor, Content descriptor, String content);
- public I18nLanguage setLanguage(User user, Long contentId, String languageCode) throws DefaultException;
+ SearchResult<Content> search(String search);
- public void setPublishedOn(User user, Long contentId, Date publishedOn) throws DefaultException;
+ SearchResult<Content> search(String search, Integer firstResult, Integer maxResults);
- public void setTags(User user, Long contentId, String tags) throws DefaultException;
+ I18nLanguage setLanguage(User user, Long contentId, String languageCode) throws DefaultException;
- SearchResult<Content> search(String search);
+ void setPublishedOn(User user, Long contentId, Date publishedOn) throws DefaultException;
- SearchResult<Content> search(String search, Integer firstResult, Integer maxResults);
+ void setStatus(Long contentId, ContentStatus contentStatus);
+ void setTags(User user, Long contentId, String tags) throws DefaultException;
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -188,6 +188,11 @@
content.setPublishedOn(publishedOn);
}
+ public void setStatus(final Long contentId, final ContentStatus status) {
+ final Content content = finder.getContent(contentId);
+ content.setStatus(status);
+ }
+
public void setTags(final User user, final Long contentId, final String tags) throws DefaultException {
final Content content = finder.getContent(contentId);
final ArrayList<String> tagsStripped = KuneStringUtils.splitTags(tags);
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -126,7 +126,7 @@
this.createdOn = System.currentTimeMillis();
this.lastRevision = new Revision(this);
accessLists = null;
- status = ContentStatus.publishedOnline;
+ status = ContentStatus.editingInProgress;
}
public void addAuthor(final User user) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -28,6 +28,7 @@
import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
import org.ourproject.kune.platf.server.content.ContentManager;
import org.ourproject.kune.platf.server.domain.Content;
+import org.ourproject.kune.platf.server.domain.ContentStatus;
import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.domain.I18nCountry;
import org.ourproject.kune.platf.server.domain.I18nLanguage;
@@ -149,6 +150,7 @@
+ "into other languages.<br><br>Thank you,<br>"
+ "<br>--<br><span style=\"font-style: italic;\">" + "The kune development team</span><br>");
contentManager.renameContent(user, defaultContent.getId(), "Welcome to kune demo");
+ contentManager.setStatus(defaultContent.getId(), ContentStatus.publishedOnline);
}
private void createLicenses() {
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/SocialNetworkManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/SocialNetworkManager.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/SocialNetworkManager.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -32,8 +32,6 @@
void acceptJoinGroup(User userLogged, Group group, Group inGroup) throws DefaultException;
- void addAdmin(User user, Group group);
-
void addGroupToAdmins(User userLogged, Group group, Group inGroup) throws DefaultException;
void addGroupToCollabs(User userLogged, Group group, Group inGroup) throws DefaultException;
@@ -44,10 +42,10 @@
void denyJoinGroup(User userLogged, Group group, Group inGroup) throws DefaultException;
- SocialNetwork find(User user, Group group) throws DefaultException;
-
ParticipationData findParticipation(User user, Group group) throws DefaultException;
+ SocialNetwork get(User userLogged, Group group) throws DefaultException;
+
SocialNetworkRequestResult requestToJoin(User user, Group inGroup) throws DefaultException;
void setAdminAsCollab(User userLogged, Group group, Group inGroup) throws DefaultException;
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/UserManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/UserManager.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/UserManager.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -25,8 +25,6 @@
import org.ourproject.kune.platf.server.manager.impl.SearchResult;
public interface UserManager {
- User login(String nickOrEmail, String passwd);
-
/**
* CreateUser new method with language country and timezone params
*
@@ -42,20 +40,22 @@
* @throws I18nNotFoundException
*/
User createUser(String shortName, String longName, String email, String passwd, String language, String country,
- String timezone) throws I18nNotFoundException;
+ String timezone) throws I18nNotFoundException;
/**
- * IMPORTANT: if userId == null, it returns User.NONE
+ * IMPORTANT: if userId == null, it returns User.UNKNOWN_USER
*
* @param userId
* @return
*/
User find(Long userId);
+ User login(String nickOrEmail, String passwd);
+
+ void reIndex();
+
SearchResult<User> search(String search);
SearchResult<User> search(String search, Integer firstResult, Integer maxResults);
- void reIndex();
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -111,7 +111,7 @@
final String defaultSiteWorkspaceTheme = kuneProperties.get(KuneProperties.WS_THEMES_DEF);
final String licenseDefId = properties.getDefaultLicense();
final License licenseDef = licenseFinder.findByShortName(licenseDefId);
- final Group group = new Group(user.getShortName(), user.getName(), licenseDef, GroupType.PERSONAL);
+ final Group userGroup = new Group(user.getShortName(), user.getName(), licenseDef, GroupType.PERSONAL);
User userSameEmail = null;
try {
userSameEmail = userFinder.getByEmail(user.getEmail());
@@ -121,17 +121,17 @@
if (userSameEmail != null) {
throw new EmailAddressInUseException();
}
- group.setAdmissionType(AdmissionType.Closed);
- group.setWorkspaceTheme(defaultSiteWorkspaceTheme);
- user.setUserGroup(group);
- initSocialNetwork(group, group);
+ userGroup.setAdmissionType(AdmissionType.Closed);
+ userGroup.setWorkspaceTheme(defaultSiteWorkspaceTheme);
+ user.setUserGroup(userGroup);
+ initSocialNetwork(userGroup, userGroup);
try {
- initGroup(user, group);
+ initGroup(user, userGroup);
super.persist(user, User.class);
} catch (final EntityExistsException e) {
throw new GroupNameInUseException();
}
- return group;
+ return userGroup;
}
public List<Group> findAdminInGroups(final Long groupId) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -72,11 +72,6 @@
}
}
- public void addAdmin(final User user, final Group group) {
- final SocialNetwork sn = group.getSocialNetwork();
- sn.addAdmin(user.getUserGroup());
- }
-
public void addGroupToAdmins(final User userLogged, final Group group, final Group inGroup) throws DefaultException {
checkGroupAddingToSelf(group, inGroup);
final SocialNetwork sn = inGroup.getSocialNetwork();
@@ -131,35 +126,36 @@
}
}
- public SocialNetwork find(final User user, final Group group) throws AccessViolationException {
- final SocialNetwork sn = group.getSocialNetwork();
- if (!sn.getAccessLists().getViewers().includes(user.getUserGroup())) {
- throw new AccessViolationException();
- }
- return sn;
- }
-
- public ParticipationData findParticipation(final User user, final Group group) throws AccessViolationException {
- find(user, group); // check access
+ public ParticipationData findParticipation(final User userLogged, final Group group)
+ throws AccessViolationException {
+ get(userLogged, group); // check access
final Long groupId = group.getId();
final List<Group> adminInGroups = finder.findAdminInGroups(groupId);
// Don't show self user group
- adminInGroups.remove(user.getUserGroup());
+ adminInGroups.remove(userLogged.getUserGroup());
final List<Group> collabInGroups = finder.findCollabInGroups(groupId);
return new ParticipationData(adminInGroups, collabInGroups);
}
- public SocialNetworkRequestResult requestToJoin(final User user, final Group inGroup) throws DefaultException,
- UserMustBeLoggedException {
+ public SocialNetwork get(final User petitioner, final Group group) throws AccessViolationException {
+ final SocialNetwork sn = group.getSocialNetwork();
+ if (!sn.getAccessLists().getViewers().includes(petitioner.getUserGroup())) {
+ throw new AccessViolationException();
+ }
+ return sn;
+ }
+
+ public SocialNetworkRequestResult requestToJoin(final User userLogged, final Group inGroup)
+ throws DefaultException, UserMustBeLoggedException {
final SocialNetwork sn = inGroup.getSocialNetwork();
- if (!User.isKnownUser(user)) {
+ if (!User.isKnownUser(userLogged)) {
throw new UserMustBeLoggedException();
}
final AdmissionType admissionType = inGroup.getAdmissionType();
if (admissionType == null) {
throw new RuntimeException();
}
- final Group userGroup = user.getUserGroup();
+ final Group userGroup = userLogged.getUserGroup();
checkGroupIsNotAlreadyAMember(userGroup, sn);
if (isModerated(admissionType)) {
sn.addPendingCollaborator(userGroup);
@@ -226,6 +222,11 @@
}
}
+ void addAdmin(final User newAdmin, final Group group) {
+ final SocialNetwork sn = group.getSocialNetwork();
+ sn.addAdmin(newAdmin.getUserGroup());
+ }
+
private void checkGroupAddingToSelf(final Group group, final Group inGroup) throws DefaultException {
if (group.equals(inGroup)) {
throwGroupMemberException(group);
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-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -31,6 +31,7 @@
import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
import org.ourproject.kune.platf.client.dto.CommentDTO;
import org.ourproject.kune.platf.client.dto.ContentDTO;
+import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
@@ -57,6 +58,7 @@
import org.ourproject.kune.platf.server.domain.Comment;
import org.ourproject.kune.platf.server.domain.Container;
import org.ourproject.kune.platf.server.domain.Content;
+import org.ourproject.kune.platf.server.domain.ContentStatus;
import org.ourproject.kune.platf.server.domain.Group;
import org.ourproject.kune.platf.server.domain.User;
import org.ourproject.kune.platf.server.manager.GroupManager;
@@ -364,6 +366,23 @@
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Editor)
@Transactional(type = TransactionType.READ_WRITE)
+ public void setStatus(final String userHash, final StateToken token, final ContentStatusDTO status) {
+ if (status.equals(ContentStatusDTO.publishedOnline) || status.equals(ContentStatusDTO.rejected)) {
+ throw new AccessViolationException();
+ }
+ contentManager.setStatus(parseId(token.getDocument()), ContentStatus.valueOf(status.toString()));
+ }
+
+ @Authenticated
+ @Authorizated(accessRolRequired = AccessRol.Administrator)
+ @Transactional(type = TransactionType.READ_WRITE)
+ public void setStatusAsAdmin(final String userHash, final StateToken token, final ContentStatusDTO status) {
+ contentManager.setStatus(parseId(token.getDocument()), ContentStatus.valueOf(status.toString()));
+ }
+
+ @Authenticated
+ @Authorizated(accessRolRequired = AccessRol.Editor)
+ @Transactional(type = TransactionType.READ_WRITE)
public List<TagResultDTO> setTags(final String userHash, final StateToken token, final String tags)
throws DefaultException {
final Long contentId = parseId(token.getDocument());
@@ -398,7 +417,7 @@
}
state.setGroupTags(tagManager.getSummaryByGroup(group));
- state.setGroupMembers(socialNetworkManager.find(user, group));
+ state.setGroupMembers(socialNetworkManager.get(user, group));
state.setParticipation(socialNetworkManager.findParticipation(user, group));
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -208,7 +208,7 @@
}
private SocialNetworkDTO getGroupMembers(final User user, final Group group) throws DefaultException {
- return mapper.map(socialNetworkManager.find(user, group), SocialNetworkDTO.class);
+ return mapper.map(socialNetworkManager.get(user, group), SocialNetworkDTO.class);
}
private ParticipationDataDTO getParticipation(final User user, final Group group) throws DefaultException {
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-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -85,18 +85,6 @@
child.setHref("#" + item.getStateToken().toString());
child.setAllowDrag(item.isDraggable());
child.setAllowDrop(item.isDroppable());
- switch (item.getContentStatus()) {
- case publishedOnline:
- child.enable();
- break;
- case inTheDustbin:
- case rejected:
- child.setCls("k-linethrough");
- case editingInProgress:
- case submittedForEvaluation:
- child.disable();
- break;
- }
createItemMenu(nodeId, item.getActionCollection(), item.getStateToken());
final TreeNode parent = treePanel.getNodeById(item.getParentId());
if (parent != null) {
@@ -124,6 +112,19 @@
child.setLeaf(true);
}
parent.appendChild(child);
+ switch (item.getContentStatus()) {
+ case publishedOnline:
+ child.setCls("k-textnormal");
+ break;
+ case inTheDustbin:
+ case rejected:
+ child.setCls("k-textlinethrough");
+ break;
+ case editingInProgress:
+ case submittedForEvaluation:
+ child.setCls("k-textunderline");
+ break;
+ }
} else {
Log.error("Error building file tree, parent folder not found");
}
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-18 17:24:02 UTC (rev 875)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -61,13 +61,13 @@
private boolean editOnNextStateChange;
private final ContentIconsRegistry contentIconsRegistry;
private final DragDropContentRegistry dragDropContentRegistry;
- private final ActionRegistry actionRegistry;
+ private final ActionRegistry<StateToken> actionRegistry;
private final ActionToolbar toolbar;
public ContextNavigatorPresenter(final StateManager stateManager, final Session session,
final Provider<ContentServiceAsync> contentServiceProvider, final I18nUITranslationService i18n,
final EntityTitle entityTitle, final ContentIconsRegistry contentIconsRegistry,
- final DragDropContentRegistry dragDropContentRegistry, final ActionRegistry actionRegistry,
+ final DragDropContentRegistry dragDropContentRegistry, final ActionRegistry<StateToken> actionRegistry,
final ActionToolbar toolbar) {
this.stateManager = stateManager;
this.session = session;
Added: trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -0,0 +1,96 @@
+package org.ourproject.kune.platf.client.actions;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+
+import com.calclab.suco.client.signal.Slot;
+
+public class ActionRegistryTest {
+
+ private static final String DEF_CONTENT_TYPE_ID = "test";
+ private ActionRegistry<StateToken> registry;
+ private ActionDescriptor<StateToken> adminAction;
+ private ActionDescriptor<StateToken> editorAction;
+ private ActionDescriptor<StateToken> viewerAction;
+
+ @Before
+ public void before() {
+ registry = new ActionRegistry<StateToken>();
+ adminAction = new ActionDescriptor<StateToken>(AccessRolDTO.Administrator, ActionPosition.topbarAndItemMenu,
+ new Slot<StateToken>() {
+ public void onEvent(final StateToken parameter) {
+ }
+ });
+ editorAction = new ActionDescriptor<StateToken>(AccessRolDTO.Editor, ActionPosition.topbarAndItemMenu,
+ new Slot<StateToken>() {
+ public void onEvent(final StateToken parameter) {
+ }
+ });
+
+ viewerAction = new ActionDescriptor<StateToken>(AccessRolDTO.Viewer, ActionPosition.topbarAndItemMenu,
+ new Slot<StateToken>() {
+ public void onEvent(final StateToken parameter) {
+ }
+ });
+ }
+
+ @Test
+ public void testAddWhenAdmin() {
+ addDefActions();
+ checkActionLists(3, 3, new AccessRightsDTO(true, true, true));
+ }
+
+ @Test
+ public void testAddWhenEditor() {
+ addDefActions();
+ checkActionLists(2, 2, new AccessRightsDTO(false, true, true));
+ }
+
+ @Test
+ public void testAddWhenViewer() {
+ addDefActions();
+ checkActionLists(1, 1, new AccessRightsDTO(false, false, true));
+ }
+
+ @Test
+ public void testEnablingFalse() {
+ adminAction.setEnableCondition(new ActionEnableCondition<StateToken>() {
+ public boolean mustBeEnabled(final StateToken param) {
+ return false;
+ }
+ });
+ registry.addAction(DEF_CONTENT_TYPE_ID, adminAction);
+ assertTrue(!registry.checkEnabling(adminAction, new StateToken()));
+ }
+
+ @Test
+ public void testEnablingTrue() {
+ adminAction.setEnableCondition(new ActionEnableCondition<StateToken>() {
+ public boolean mustBeEnabled(final StateToken param) {
+ return true;
+ }
+ });
+ registry.addAction(DEF_CONTENT_TYPE_ID, adminAction);
+ assertTrue(registry.checkEnabling(adminAction, new StateToken()));
+ }
+
+ private void addDefActions() {
+ registry.addAction(DEF_CONTENT_TYPE_ID, adminAction);
+ registry.addAction(DEF_CONTENT_TYPE_ID, editorAction);
+ registry.addAction(DEF_CONTENT_TYPE_ID, viewerAction);
+ }
+
+ private void checkActionLists(final int expectedToolActions, final int expectedItemActions,
+ final AccessRightsDTO accessRightsDTO) {
+ assertEquals(expectedItemActions, registry.selectCurrentActions(accessRightsDTO, DEF_CONTENT_TYPE_ID)
+ .getToolbarActions().size());
+ assertEquals(expectedItemActions, registry.selectCurrentActions(accessRightsDTO, DEF_CONTENT_TYPE_ID)
+ .getItemActions().size());
+ }
+}
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-18 17:24:02 UTC (rev 875)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -58,6 +58,14 @@
}
@Test
+ public void defAdminDontShowAsParticipation() throws Exception {
+ doLogin();
+ final StateDTO content = contentService.getContent(getHash(), new StateToken(getSiteAdminShortName()));
+ assertEquals(0, content.getParticipation().getGroupsIsCollab().size());
+ assertEquals(1, content.getParticipation().getGroupsIsAdmin().size());
+ }
+
+ @Test
public void folderRename() throws Exception {
doLogin();
defaultContent = getDefaultContent();
Deleted: trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java 2008-09-18 17:24:02 UTC (rev 875)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -1,342 +0,0 @@
-package org.ourproject.kune.platf.server.manager;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.ourproject.kune.platf.client.dto.GroupType;
-import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult;
-import org.ourproject.kune.platf.client.errors.AccessViolationException;
-import org.ourproject.kune.platf.client.errors.AlreadyGroupMemberException;
-import org.ourproject.kune.platf.client.errors.LastAdminInGroupException;
-import org.ourproject.kune.platf.server.PersistenceTest;
-import org.ourproject.kune.platf.server.domain.AdmissionType;
-import org.ourproject.kune.platf.server.domain.Group;
-import org.ourproject.kune.platf.server.domain.GroupListMode;
-import org.ourproject.kune.platf.server.domain.User;
-import org.ourproject.kune.testhelper.ctx.DomainContext;
-
-import com.google.inject.Inject;
-
-public class SocialNetworkManagerTest extends PersistenceTest {
- @Inject
- private SocialNetworkManager socialNetworkManager;
- private Group group;
- private Group userGroup;
- private Group orphanedGroup;
- private User user;
- private User admin;
- private User otherUser;
- private DomainContext ctx;
-
- @Test
- public void acceptJoinGroup() throws Exception {
- socialNetworkManager.requestToJoin(user, group);
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
-
- assertFalse(group.getSocialNetwork().getPendingCollaborators().getList().contains(userGroup));
- assertTrue(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup));
- assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getList().size(), 1);
- assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getMode(), GroupListMode.NORMAL);
- assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
- closeTransaction();
- }
-
- @Test(expected = Exception.class)
- public void acceptJoinNotPendingGroupFails() throws Exception {
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
- }
-
- @Test(expected = AlreadyGroupMemberException.class)
- public void addAdminAsAdminFails() throws Exception {
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.addGroupToAdmins(admin, admin.getUserGroup(), group);
- }
-
- @Test(expected = AlreadyGroupMemberException.class)
- public void addAdminAsCollabFails() throws Exception {
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.addGroupToCollabs(admin, admin.getUserGroup(), group);
- }
-
- @Test(expected = AlreadyGroupMemberException.class)
- public void addAdminAsViewerFails() throws Exception {
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.addGroupToViewers(admin, admin.getUserGroup(), group);
- }
-
- @Test(expected = Exception.class)
- public void addAdminNotAdminFails() throws Exception {
- socialNetworkManager.addGroupToAdmins(otherUser, userGroup, group);
- }
-
- @Test(expected = Exception.class)
- public void addCollabNotAdminFails() throws Exception {
- socialNetworkManager.addGroupToCollabs(otherUser, userGroup, group);
- }
-
- @Test
- public void addPendingAsCollabDirectly() throws Exception {
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.requestToJoin(user, group);
- socialNetworkManager.addGroupToCollabs(admin, userGroup, group);
- assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
- closeTransaction();
- }
-
- @Test
- public void addPendingAsCollabDirectlyAsAdmin() throws Exception {
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.requestToJoin(user, group);
- socialNetworkManager.addGroupToAdmins(admin, userGroup, group);
- assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
- closeTransaction();
- }
-
- @Test(expected = Exception.class)
- public void addViewerNotAdminFails() throws Exception {
- socialNetworkManager.addGroupToViewers(otherUser, userGroup, group);
- }
-
- @After
- public void close() {
- if (getTransaction().isActive()) {
- rollbackTransaction();
- }
- }
-
- @Test
- public void deleteMember() throws Exception {
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.requestToJoin(user, group);
- socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
- assertTrue(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup));
- socialNetworkManager.deleteMember(admin, userGroup, group);
- assertFalse(group.getSocialNetwork().getPendingCollaborators().getList().contains(userGroup));
- assertFalse(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup));
- assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getMode(), GroupListMode.NOBODY);
- assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getList().size(), 0);
- assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
- closeTransaction();
- }
-
- @Test(expected = Exception.class)
- public void deleteNotMemberFails() throws Exception {
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.deleteMember(admin, userGroup, group);
- }
-
- @Test
- public void denyJoinGroup() throws Exception {
- socialNetworkManager.requestToJoin(user, group);
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.denyJoinGroup(admin, userGroup, group);
-
- assertFalse(group.getSocialNetwork().getPendingCollaborators().getList().contains(userGroup));
- assertFalse(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup));
- assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getList().size(), 0);
- assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
- closeTransaction();
- }
-
- @Test(expected = AccessViolationException.class)
- public void denyJoinGroupNotAdminFails() throws Exception {
- socialNetworkManager.requestToJoin(user, group);
- socialNetworkManager.denyJoinGroup(otherUser, userGroup, group);
- }
-
- @Test(expected = Exception.class)
- public void denyNotPendingFails() throws Exception {
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.denyJoinGroup(admin, userGroup, group);
- }
-
- @Test(expected = RuntimeException.class)
- public void ilegalAdmissionType() throws Exception {
- group.setAdmissionType(null);
- socialNetworkManager.requestToJoin(user, group);
- }
-
- @Before
- public void init() {
- openTransaction();
- ctx = new DomainContext();
- ctx.createUsers("user1");
- ctx.createUsers("admin");
- ctx.createUsers("otheruser");
- ctx.createGroups("group1");
- ctx.createOrphanGroup("grouporph");
- user = ctx.getUser("user1");
- group = ctx.getGroup("group1");
- orphanedGroup = ctx.getGroup("grouporph");
- userGroup = user.getUserGroup();
- admin = ctx.getUser("admin");
- otherUser = ctx.getUser("otheruser");
- assertSocialNetworkIsEmpty();
- }
-
- @Test(expected = LastAdminInGroupException.class)
- public void lastAdminUnjoinGroupWithCollabsFails() throws Exception {
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.requestToJoin(user, group);
- socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
- socialNetworkManager.unJoinGroup(admin.getUserGroup(), group);
- }
-
- @Test
- public void lastAdminUnjoinGroupWithoutCollabsOrphaned() throws Exception {
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.unJoinGroup(admin.getUserGroup(), group);
- assertEquals(GroupType.ORPHANED_PROJECT, group.getType());
- assertEquals(0, group.getSocialNetwork().getAccessLists().getAdmins().getList().size());
- assertEquals(0, group.getSocialNetwork().getAccessLists().getEditors().getList().size());
- }
-
- @Test(expected = AccessViolationException.class)
- public void notAdminTryDeleteMember() throws Exception {
- socialNetworkManager.requestToJoin(user, group);
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
- socialNetworkManager.deleteMember(otherUser, userGroup, group);
- }
-
- @Test
- public void requestJoinAClosedGroupDeny() throws Exception {
- group.setAdmissionType(AdmissionType.Closed);
-
- final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, group);
- assertEquals(result, SocialNetworkRequestResult.denied);
- closeTransaction();
- }
-
- @Test
- public void requestJoinAModeratedGroupAddUserGroupToPending() throws Exception {
- group.setAdmissionType(AdmissionType.Moderated);
-
- final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, group);
- assertEquals(result, SocialNetworkRequestResult.moderated);
- assertTrue(group.getSocialNetwork().getPendingCollaborators().getList().contains(userGroup));
- closeTransaction();
- }
-
- @Test
- public void requestJoinAOpenGroupAddUserGroupToEditors() throws Exception {
- group.setAdmissionType(AdmissionType.Open);
-
- final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, group);
- assertEquals(result, SocialNetworkRequestResult.accepted);
- assertTrue(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup));
- assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getMode(), GroupListMode.NORMAL);
- closeTransaction();
- }
-
- @Test
- public void requestJoinAOrphanedGroupAddUserGroupToAdmins() throws Exception {
- orphanedGroup.setAdmissionType(AdmissionType.Open);
-
- final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, orphanedGroup);
- assertEquals(result, SocialNetworkRequestResult.accepted);
- assertTrue(orphanedGroup.getSocialNetwork().getAccessLists().getAdmins().getList().contains(userGroup));
- assertEquals(orphanedGroup.getSocialNetwork().getAccessLists().getAdmins().getMode(), GroupListMode.NORMAL);
-
- // FIXME Check change group type to PROJECT
- closeTransaction();
- }
-
- @Test(expected = AlreadyGroupMemberException.class)
- public void requestJoinTwiceAOrphanedGroupAddUserGroupToAdmins() throws Exception {
- orphanedGroup.setAdmissionType(AdmissionType.Open);
-
- final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, orphanedGroup);
- assertEquals(SocialNetworkRequestResult.accepted, result);
- socialNetworkManager.requestToJoin(user, orphanedGroup);
- }
-
- @Test
- public void requestToJoinTwiceDontDuplicatePending() throws Exception {
- group.setAdmissionType(AdmissionType.Moderated);
-
- socialNetworkManager.requestToJoin(user, group);
- socialNetworkManager.requestToJoin(user, group);
- assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 1);
- closeTransaction();
- }
-
- @Test(expected = Exception.class)
- public void setAdminAnonMemberFails() throws Exception {
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.requestToJoin(user, group);
- socialNetworkManager.setAdminAsCollab(admin, userGroup, group);
- }
-
- @Test
- public void setAdminAsCollab() throws Exception {
- socialNetworkManager.requestToJoin(user, group);
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
- socialNetworkManager.setCollabAsAdmin(admin, userGroup, group);
- socialNetworkManager.setAdminAsCollab(admin, userGroup, group);
-
- assertFalse(group.getSocialNetwork().getPendingCollaborators().getList().contains(userGroup));
- assertTrue(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup));
- assertFalse(group.getSocialNetwork().getAccessLists().getAdmins().getList().contains(userGroup));
- assertEquals(group.getSocialNetwork().getAccessLists().getAdmins().getList().size(), 1);
- assertEquals(group.getSocialNetwork().getAccessLists().getAdmins().getMode(), GroupListMode.NORMAL);
- assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getList().size(), 1);
- assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getMode(), GroupListMode.NORMAL);
- assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
- closeTransaction();
- }
-
- @Test(expected = AccessViolationException.class)
- public void setAdminAsCollabNotAdminFails() throws Exception {
- socialNetworkManager.requestToJoin(user, group);
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
- socialNetworkManager.setCollabAsAdmin(otherUser, userGroup, group);
- }
-
- @Test(expected = Exception.class)
- public void setAdminNotCollabFails() throws Exception {
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.requestToJoin(user, group);
- socialNetworkManager.setCollabAsAdmin(admin, userGroup, group);
- }
-
- @Test
- public void setCollabAsAdmin() throws Exception {
- socialNetworkManager.requestToJoin(user, group);
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
- socialNetworkManager.setCollabAsAdmin(admin, userGroup, group);
-
- assertFalse(group.getSocialNetwork().getPendingCollaborators().getList().contains(userGroup));
- assertFalse(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup));
- assertTrue(group.getSocialNetwork().getAccessLists().getAdmins().getList().contains(userGroup));
- assertEquals(group.getSocialNetwork().getAccessLists().getAdmins().getList().size(), 2);
- assertEquals(group.getSocialNetwork().getAccessLists().getAdmins().getMode(), GroupListMode.NORMAL);
- assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getList().size(), 0);
- assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getMode(), GroupListMode.NOBODY);
- assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
- closeTransaction();
- }
-
- @Test(expected = AccessViolationException.class)
- public void setCollabAsAdminNotAdminFails() throws Exception {
- socialNetworkManager.requestToJoin(user, group);
- socialNetworkManager.addAdmin(admin, group);
- socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
- socialNetworkManager.setCollabAsAdmin(otherUser, userGroup, group);
- }
-
- private void assertSocialNetworkIsEmpty() {
- assertEquals(group.getSocialNetwork().getAccessLists().getAdmins().getList().size(), 0);
- assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getList().size(), 0);
- assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
- }
-}
Copied: trunk/src/test/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerTest.java (from rev 863, trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java)
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java 2008-09-08 01:25:13 UTC (rev 863)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerTest.java 2008-09-19 23:33:06 UTC (rev 876)
@@ -0,0 +1,363 @@
+package org.ourproject.kune.platf.server.manager.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.ourproject.kune.platf.client.dto.GroupType;
+import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult;
+import org.ourproject.kune.platf.client.errors.AccessViolationException;
+import org.ourproject.kune.platf.client.errors.AlreadyGroupMemberException;
+import org.ourproject.kune.platf.client.errors.LastAdminInGroupException;
+import org.ourproject.kune.platf.server.ParticipationData;
+import org.ourproject.kune.platf.server.PersistenceTest;
+import org.ourproject.kune.platf.server.domain.AdmissionType;
+import org.ourproject.kune.platf.server.domain.Group;
+import org.ourproject.kune.platf.server.domain.GroupListMode;
+import org.ourproject.kune.platf.server.domain.User;
+import org.ourproject.kune.testhelper.ctx.DomainContext;
+
+import com.google.inject.Inject;
+
+public class SocialNetworkManagerTest extends PersistenceTest {
+ @Inject
+ private SocialNetworkManagerDefault socialNetworkManager;
+ private Group group;
+ private Group userGroup;
+ private Group orphanedGroup;
+ private User user;
+ private User admin;
+ private User otherUser;
+ private DomainContext ctx;
+
+ @Test
+ public void acceptJoinGroup() throws Exception {
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
+
+ assertFalse(group.getSocialNetwork().getPendingCollaborators().getList().contains(userGroup));
+ assertTrue(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup));
+ assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getList().size(), 1);
+ assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getMode(), GroupListMode.NORMAL);
+ assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
+ closeTransaction();
+ }
+
+ @Test(expected = Exception.class)
+ public void acceptJoinNotPendingGroupFails() throws Exception {
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
+ }
+
+ @Test(expected = AlreadyGroupMemberException.class)
+ public void addAdminAsAdminFails() throws Exception {
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.addGroupToAdmins(admin, admin.getUserGroup(), group);
+ }
+
+ @Test(expected = AlreadyGroupMemberException.class)
+ public void addAdminAsCollabFails() throws Exception {
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.addGroupToCollabs(admin, admin.getUserGroup(), group);
+ }
+
+ @Test(expected = AlreadyGroupMemberException.class)
+ public void addAdminAsViewerFails() throws Exception {
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.addGroupToViewers(admin, admin.getUserGroup(), group);
+ }
+
+ @Test(expected = Exception.class)
+ public void addAdminNotAdminFails() throws Exception {
+ socialNetworkManager.addGroupToAdmins(otherUser, userGroup, group);
+ }
+
+ @Test(expected = Exception.class)
+ public void addCollabNotAdminFails() throws Exception {
+ socialNetworkManager.addGroupToCollabs(otherUser, userGroup, group);
+ }
+
+ @Test
+ public void addPendingAsCollabDirectly() throws Exception {
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.addGroupToCollabs(admin, userGroup, group);
+ assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
+ closeTransaction();
+ }
+
+ @Test
+ public void addPendingAsCollabDirectlyAsAdmin() throws Exception {
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.addGroupToAdmins(admin, userGroup, group);
+ assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
+ closeTransaction();
+ }
+
+ @Test(expected = Exception.class)
+ public void addViewerNotAdminFails() throws Exception {
+ socialNetworkManager.addGroupToViewers(otherUser, userGroup, group);
+ }
+
+ @After
+ public void close() {
+ if (getTransaction().isActive()) {
+ rollbackTransaction();
+ }
+ }
+
+ @Test
+ public void deleteMember() throws Exception {
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
+ assertTrue(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup));
+ socialNetworkManager.deleteMember(admin, userGroup, group);
+ assertFalse(group.getSocialNetwork().getPendingCollaborators().getList().contains(userGroup));
+ assertFalse(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup));
+ assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getMode(), GroupListMode.NOBODY);
+ assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getList().size(), 0);
+ assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
+ closeTransaction();
+ }
+
+ @Test(expected = Exception.class)
+ public void deleteNotMemberFails() throws Exception {
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.deleteMember(admin, userGroup, group);
+ }
+
+ @Test
+ public void denyJoinGroup() throws Exception {
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.denyJoinGroup(admin, userGroup, group);
+
+ assertFalse(group.getSocialNetwork().getPendingCollaborators().getList().contains(userGroup));
+ assertFalse(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup));
+ assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getList().size(), 0);
+ assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
+ closeTransaction();
+ }
+
+ @Test(expected = AccessViolationException.class)
+ public void denyJoinGroupNotAdminFails() throws Exception {
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.denyJoinGroup(otherUser, userGroup, group);
+ }
+
+ @Test(expected = Exception.class)
+ public void denyNotPendingFails() throws Exception {
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.denyJoinGroup(admin, userGroup, group);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void ilegalAdmissionType() throws Exception {
+ group.setAdmissionType(null);
+ socialNetworkManager.requestToJoin(user, group);
+ }
+
+ @Before
+ public void init() {
+ openTransaction();
+ ctx = new DomainContext();
+ ctx.createUsers("user1");
+ ctx.createUsers("admin");
+ ctx.createUsers("otheruser");
+ ctx.createGroups("group1");
+ ctx.createOrphanGroup("grouporph");
+ user = ctx.getUser("user1");
+ group = ctx.getGroup("group1");
+ orphanedGroup = ctx.getGroup("grouporph");
+ userGroup = user.getUserGroup();
+ admin = ctx.getUser("admin");
+ otherUser = ctx.getUser("otheruser");
+ assertSocialNetworkIsEmpty();
+ }
+
+ @Test(expected = LastAdminInGroupException.class)
+ public void lastAdminUnjoinGroupWithCollabsFails() throws Exception {
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
+ socialNetworkManager.unJoinGroup(admin.getUserGroup(), group);
+ }
+
+ @Test
+ public void lastAdminUnjoinGroupWithoutCollabsOrphaned() throws Exception {
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.unJoinGroup(admin.getUserGroup(), group);
+ assertEquals(GroupType.ORPHANED_PROJECT, group.getType());
+ assertEquals(0, group.getSocialNetwork().getAccessLists().getAdmins().getList().size());
+ assertEquals(0, group.getSocialNetwork().getAccessLists().getEditors().getList().size());
+ }
+
+ @Test(expected = AccessViolationException.class)
+ public void notAdminTryDeleteMember() throws Exception {
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
+ socialNetworkManager.deleteMember(otherUser, userGroup, group);
+ }
+
+ @Test
+ public void participationDontShowSelfGroup() {
+ group.getSocialNetwork().getAccessLists().getViewers().setMode(GroupListMode.EVERYONE);
+ user.getUserGroup().getSocialNetwork().getAccessLists().getViewers().setMode(GroupListMode.EVERYONE);
+ assertEquals(GroupListMode.EVERYONE, group.getSocialNetwork().getAccessLists().getViewers().getMode());
+ ParticipationData part = socialNetworkManager.findParticipation(User.UNKNOWN_USER, group);
+ assertFalse(part.getGroupsIsAdmin().contains(group));
+ assertFalse(part.getGroupsIsCollab().contains(group));
+
+ socialNetworkManager.addAdmin(admin, group);
+ part = socialNetworkManager.findParticipation(admin, group);
+ assertFalse(part.getGroupsIsAdmin().contains(group));
+ assertFalse(part.getGroupsIsCollab().contains(group));
+
+ socialNetworkManager.addAdmin(user, user.getUserGroup());
+ part = socialNetworkManager.findParticipation(User.UNKNOWN_USER, user.getUserGroup());
+ assertFalse(part.getGroupsIsAdmin().contains(user.getUserGroup()));
+ assertFalse(part.getGroupsIsCollab().contains(user.getUserGroup()));
+ }
+
+ @Test
+ public void requestJoinAClosedGroupDeny() throws Exception {
+ group.setAdmissionType(AdmissionType.Closed);
+
+ final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, group);
+ assertEquals(result, SocialNetworkRequestResult.denied);
+ closeTransaction();
+ }
+
+ @Test
+ public void requestJoinAModeratedGroupAddUserGroupToPending() throws Exception {
+ group.setAdmissionType(AdmissionType.Moderated);
+
+ final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, group);
+ assertEquals(result, SocialNetworkRequestResult.moderated);
+ assertTrue(group.getSocialNetwork().getPendingCollaborators().getList().contains(userGroup));
+ closeTransaction();
+ }
+
+ @Test
+ public void requestJoinAOpenGroupAddUserGroupToEditors() throws Exception {
+ group.setAdmissionType(AdmissionType.Open);
+
+ final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, group);
+ assertEquals(result, SocialNetworkRequestResult.accepted);
+ assertTrue(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup));
+ assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getMode(), GroupListMode.NORMAL);
+ closeTransaction();
+ }
+
+ @Test
+ public void requestJoinAOrphanedGroupAddUserGroupToAdmins() throws Exception {
+ orphanedGroup.setAdmissionType(AdmissionType.Open);
+
+ final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, orphanedGroup);
+ assertEquals(result, SocialNetworkRequestResult.accepted);
+ assertTrue(orphanedGroup.getSocialNetwork().getAccessLists().getAdmins().getList().contains(userGroup));
+ assertEquals(orphanedGroup.getSocialNetwork().getAccessLists().getAdmins().getMode(), GroupListMode.NORMAL);
+
+ // FIXME Check change group type to PROJECT
+ closeTransaction();
+ }
+
+ @Test(expected = AlreadyGroupMemberException.class)
+ public void requestJoinTwiceAOrphanedGroupAddUserGroupToAdmins() throws Exception {
+ orphanedGroup.setAdmissionType(AdmissionType.Open);
+
+ final SocialNetworkRequestResult result = socialNetworkManager.requestToJoin(user, orphanedGroup);
+ assertEquals(SocialNetworkRequestResult.accepted, result);
+ socialNetworkManager.requestToJoin(user, orphanedGroup);
+ }
+
+ @Test
+ public void requestToJoinTwiceDontDuplicatePending() throws Exception {
+ group.setAdmissionType(AdmissionType.Moderated);
+
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.requestToJoin(user, group);
+ assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 1);
+ closeTransaction();
+ }
+
+ @Test(expected = Exception.class)
+ public void setAdminAnonMemberFails() throws Exception {
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.setAdminAsCollab(admin, userGroup, group);
+ }
+
+ @Test
+ public void setAdminAsCollab() throws Exception {
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
+ socialNetworkManager.setCollabAsAdmin(admin, userGroup, group);
+ socialNetworkManager.setAdminAsCollab(admin, userGroup, group);
+
+ assertFalse(group.getSocialNetwork().getPendingCollaborators().getList().contains(userGroup));
+ assertTrue(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup));
+ assertFalse(group.getSocialNetwork().getAccessLists().getAdmins().getList().contains(userGroup));
+ assertEquals(group.getSocialNetwork().getAccessLists().getAdmins().getList().size(), 1);
+ assertEquals(group.getSocialNetwork().getAccessLists().getAdmins().getMode(), GroupListMode.NORMAL);
+ assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getList().size(), 1);
+ assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getMode(), GroupListMode.NORMAL);
+ assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
+ closeTransaction();
+ }
+
+ @Test(expected = AccessViolationException.class)
+ public void setAdminAsCollabNotAdminFails() throws Exception {
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
+ socialNetworkManager.setCollabAsAdmin(otherUser, userGroup, group);
+ }
+
+ @Test(expected = Exception.class)
+ public void setAdminNotCollabFails() throws Exception {
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.setCollabAsAdmin(admin, userGroup, group);
+ }
+
+ @Test
+ public void setCollabAsAdmin() throws Exception {
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
+ socialNetworkManager.setCollabAsAdmin(admin, userGroup, group);
+
+ assertFalse(group.getSocialNetwork().getPendingCollaborators().getList().contains(userGroup));
+ assertFalse(group.getSocialNetwork().getAccessLists().getEditors().getList().contains(userGroup));
+ assertTrue(group.getSocialNetwork().getAccessLists().getAdmins().getList().contains(userGroup));
+ assertEquals(group.getSocialNetwork().getAccessLists().getAdmins().getList().size(), 2);
+ assertEquals(group.getSocialNetwork().getAccessLists().getAdmins().getMode(), GroupListMode.NORMAL);
+ assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getList().size(), 0);
+ assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getMode(), GroupListMode.NOBODY);
+ assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
+ closeTransaction();
+ }
+
+ @Test(expected = AccessViolationException.class)
+ public void setCollabAsAdminNotAdminFails() throws Exception {
+ socialNetworkManager.requestToJoin(user, group);
+ socialNetworkManager.addAdmin(admin, group);
+ socialNetworkManager.acceptJoinGroup(admin, userGroup, group);
+ socialNetworkManager.setCollabAsAdmin(otherUser, userGroup, group);
+ }
+
+ private void assertSocialNetworkIsEmpty() {
+ assertEquals(group.getSocialNetwork().getAccessLists().getAdmins().getList().size(), 0);
+ assertEquals(group.getSocialNetwork().getAccessLists().getEditors().getList().size(), 0);
+ assertEquals(group.getSocialNetwork().getPendingCollaborators().getList().size(), 0);
+ }
+}
More information about the kune-commits
mailing list