[kune-commits] r970 - in trunk: . src/main/java/org/ourproject/kune src/main/java/org/ourproject/kune/app src/main/java/org/ourproject/kune/app/client src/main/java/org/ourproject/kune/app/server src/main/java/org/ourproject/kune/blogs/client src/main/java/org/ourproject/kune/blogs/client/cnt src/main/java/org/ourproject/kune/blogs/server src/main/java/org/ourproject/kune/docs/client src/main/java/org/ourproject/kune/docs/server src/main/java/org/ourproject/kune/gallery src/main/java/org/ourproject/kune/gallery/client src/main/java/org/ourproject/kune/gallery/client/cnt src/main/java/org/ourproject/kune/gallery/client/ctx src/main/java/org/ourproject/kune/gallery/server src/main/java/org/ourproject/kune/platf/client/tool src/main/java/org/ourproject/kune/platf/client/ui/download src/main/java/org/ourproject/kune/platf/client/ui/upload src/main/java/org/ourproject/kune/platf/server/manager/file src/main/java/org/ourproject/kune/platf/server/tool src/main/java/org/ourproject/kune/wiki/client src/main/java/org/ourproject/kune/wiki/client/cnt src/main/java/org/ourproject/kune/wiki/server src/main/java/org/ourproject/kune/workspace/client src/main/java/org/ourproject/kune/workspace/client/skel src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload src/test/java/org/ourproject/kune/platf/server/manager/file

vjrj vjrj at ourproject.org
Wed Nov 26 14:41:11 CET 2008


Author: vjrj
Date: 2008-11-26 14:41:04 +0100 (Wed, 26 Nov 2008)
New Revision: 970

Added:
   trunk/HOWTO_ADD_A_NEW_TOOL
   trunk/src/main/java/org/ourproject/kune/gallery/
   trunk/src/main/java/org/ourproject/kune/gallery/Kune-Gallery.gwt.xml
   trunk/src/main/java/org/ourproject/kune/gallery/client/
   trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java
   trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java
   trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java
   trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/
   trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContent.java
   trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPanel.java
   trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPresenter.java
   trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentView.java
   trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewer.java
   trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPanel.java
   trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPresenter.java
   trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerView.java
   trunk/src/main/java/org/ourproject/kune/gallery/client/ctx/
   trunk/src/main/java/org/ourproject/kune/gallery/client/ctx/GalleryContext.java
   trunk/src/main/java/org/ourproject/kune/gallery/client/ctx/GalleryContextPresenter.java
   trunk/src/main/java/org/ourproject/kune/gallery/public/
   trunk/src/main/java/org/ourproject/kune/gallery/server/
   trunk/src/main/java/org/ourproject/kune/gallery/server/GalleryServerModule.java
   trunk/src/main/java/org/ourproject/kune/gallery/server/GalleryServerTool.java
Modified:
   trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml
   trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java
   trunk/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java
   trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java
   trunk/src/main/java/org/ourproject/kune/blogs/client/cnt/BlogFolderContentPresenter.java
   trunk/src/main/java/org/ourproject/kune/blogs/server/BlogServerTool.java
   trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
   trunk/src/main/java/org/ourproject/kune/docs/server/DocumentServerTool.java
   trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/download/FileParams.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/AbstractUploader.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderDialog.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderView.java
   trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java
   trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java
   trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerAbstract.java
   trunk/src/main/java/org/ourproject/kune/platf/server/tool/ServerTool.java
   trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientTool.java
   trunk/src/main/java/org/ourproject/kune/wiki/client/cnt/WikiFolderContentPresenter.java
   trunk/src/main/java/org/ourproject/kune/wiki/server/WikiServerTool.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java
   trunk/src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload/FileUploaderPresenterTest.java
   trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManagerTest.java
   trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerTest.java
Log:
Gallery new tool.

Incomplete - task UI tools & workspace refactorization

Added: trunk/HOWTO_ADD_A_NEW_TOOL
===================================================================
--- trunk/HOWTO_ADD_A_NEW_TOOL	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/HOWTO_ADD_A_NEW_TOOL	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,32 @@
+Here we try to describe a easy way to add a new Tool of type "Foldeable", that is, a tool with a folder/files structure. For other kind of tools (like, for instance a rich Web Calendar tool), better start from scratch creating the NewTool{ClientTool|ClientActions|ServerTool} classes and implementing the specific functionality.
+
+The stpes (substitute 'wiki' and 'Wiki' for the new tool name):
+
+cd src/main/java/org/ourproject/kune/
+rsync -r -C docs/ wiki
+cd wiki/
+find . -name '*.java' | xargs rename 's/Document/Wiki/g'
+find . -name '*.java' | xargs rename 's/Docs/Wiki/g'
+find . -name '*.java' | xargs rename 's/Doc/Wiki/g'
+find . -name '*.xml' | xargs rename 's/Docs/Wiki/g'
+find  . -name *java | xargs perl -p -i -e 's/Documents/Wiki/g'
+find  . -name *java | xargs perl -p -i -e 's/Document/Wiki/g'
+find  . -name *java | xargs perl -p -i -e 's/Docs/Wiki/g'
+find  . -name *java | xargs perl -p -i -e 's/Doc/Wiki/g'
+find  . -name *java | xargs perl -p -i -e 's/\.docs\./\.wiki\./g'
+find  . -name *java | xargs perl -p -i -e 's/documents/wiki/g'
+find  . -name *java | xargs perl -p -i -e 's/docs/wiki/g'
+
+Edit WikiClientTool and WikiServerTool and WikiClientActions with the specific actions and types the tool will have.
+
+Add
+  <inherits name='org.ourproject.kune.wiki.Kune-Wiki' />
+to Kune.gwt.xml
+
+Add 
+  builder.use(new WikiServerModule()); 
+to KuneRackModule.java.
+
+Add the WikiClientModule to KuneEntryPoint.
+
+

Modified: trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml	2008-11-26 13:41:04 UTC (rev 970)
@@ -16,6 +16,7 @@
     <inherits name='org.ourproject.kune.blogs.Kune-Blogs' />
     <inherits name='org.ourproject.kune.wiki.Kune-Wiki' />
     <inherits name='org.ourproject.kune.chat.Kune-Chat' />
+    <inherits name='org.ourproject.kune.gallery.Kune-Gallery' />
 
     <!-- gwt-ext -->
     <inherits name='com.gwtext.GwtExt' />

Modified: trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -22,6 +22,7 @@
 import org.ourproject.kune.blogs.client.BlogClientModule;
 import org.ourproject.kune.chat.client.ChatClientModule;
 import org.ourproject.kune.docs.client.DocumentClientModule;
+import org.ourproject.kune.gallery.client.GalleryClientModule;
 import org.ourproject.kune.platf.client.services.KuneCoreModule;
 import org.ourproject.kune.platf.client.services.KuneModule;
 import org.ourproject.kune.platf.client.services.KunePlatformModule;
@@ -57,6 +58,6 @@
     public void onModuleLoadCont() {
         Suco.install(new KuneCoreModule(), new KuneRegistryModule(), new KunePlatformModule(),
                 new KuneWorkspaceModule(), new EmiteUIModule(), new DocumentClientModule(), new BlogClientModule(),
-                new WikiClientModule(), new ChatClientModule(), new KuneModule());
+                new WikiClientModule(), new ChatClientModule(), new GalleryClientModule(), new KuneModule());
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -22,6 +22,7 @@
 import org.ourproject.kune.blogs.server.BlogServerModule;
 import org.ourproject.kune.chat.server.ChatServerModule;
 import org.ourproject.kune.docs.server.DocumentServerModule;
+import org.ourproject.kune.gallery.server.GalleryServerModule;
 import org.ourproject.kune.platf.client.rpc.ContentService;
 import org.ourproject.kune.platf.client.rpc.GroupService;
 import org.ourproject.kune.platf.client.rpc.I18nService;
@@ -114,6 +115,7 @@
         builder.use(new BlogServerModule());
         builder.use(new WikiServerModule());
         builder.use(new ChatServerModule());
+        builder.use(new GalleryServerModule());
         builder.use(new RESTServicesModule());
         builder.use(configModule);
     }

Modified: trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -27,11 +27,11 @@
 import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
 
 public class BlogClientTool extends FoldableAbstractClientTool {
-    public static final String TYPE_ROOT = "blogs.root";
-    public static final String TYPE_BLOG = "blogs.blog";
-    public static final String TYPE_POST = "blogs.post";
-    public static final String TYPE_UPLOADEDFILE = "blogs.uploaded";
     public static final String NAME = "blogs";
+    public static final String TYPE_ROOT = NAME + "." + "root";
+    public static final String TYPE_BLOG = NAME + "." + "blog";
+    public static final String TYPE_POST = NAME + "." + "post";
+    public static final String TYPE_UPLOADEDFILE = NAME + "." + FoldableAbstractClientTool.UPLOADEDFILE_SUFFIX;
 
     public BlogClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
             final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws,

Modified: trunk/src/main/java/org/ourproject/kune/blogs/client/cnt/BlogFolderContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/blogs/client/cnt/BlogFolderContentPresenter.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/blogs/client/cnt/BlogFolderContentPresenter.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -20,7 +20,6 @@
 package org.ourproject.kune.blogs.client.cnt;
 
 import org.ourproject.kune.blogs.client.BlogClientTool;
-import org.ourproject.kune.chat.client.ChatClientTool;
 import org.ourproject.kune.platf.client.actions.ActionRegistry;
 import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar;
 import org.ourproject.kune.platf.client.dto.StateContainerDTO;
@@ -48,7 +47,7 @@
 
     @Override
     protected void setState(StateContainerDTO state) {
-        if (state.getTypeId().equals(ChatClientTool.TYPE_ROOT)) {
+        if (state.getTypeId().equals(BlogClientTool.TYPE_ROOT)) {
             if (state.getRootContainer().getChilds().size() == 0) {
                 view.setInfo(i18n.t("This group has no blogs."));
             } else {

Modified: trunk/src/main/java/org/ourproject/kune/blogs/server/BlogServerTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/blogs/server/BlogServerTool.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/blogs/server/BlogServerTool.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -39,12 +39,12 @@
 import com.google.inject.Inject;
 
 public class BlogServerTool implements ServerTool {
-    public static final String TYPE_ROOT = "blogs.root";
-    public static final String TYPE_BLOG = "blogs.blog";
-    public static final String TYPE_POST = "blogs.post";
-    public static final String TYPE_UPLOADEDFILE = "blogs.uploaded";
+    public static final String NAME = "blogs";
+    public static final String TYPE_ROOT = NAME + "." + "root";
+    public static final String TYPE_BLOG = NAME + "." + "blog";
+    public static final String TYPE_POST = NAME + "." + "post";
+    public static final String TYPE_UPLOADEDFILE = NAME + "." + ServerTool.UPLOADEDFILE_SUFFIX;
 
-    public static final String NAME = "blogs";
     public static final String ROOT_NAME = "blogs";
 
     private final ContentManager contentManager;
@@ -92,14 +92,14 @@
         final Container blog = containerManager.createFolder(group, rootFolder, i18n.t("Blog sample"), language,
                 TYPE_BLOG);
 
-        final Content descriptor = contentManager.createContent(i18n.t("A post sample"), "", user, blog,
+        final Content content = contentManager.createContent(i18n.t("A post sample"), "", user, blog,
                 BlogServerTool.TYPE_POST);
-        descriptor.addAuthor(user);
-        descriptor.setLanguage(language);
-        descriptor.setTypeId(TYPE_POST);
-        descriptor.setStatus(ContentStatus.publishedOnline);
+        content.addAuthor(user);
+        content.setLanguage(language);
+        content.setTypeId(TYPE_POST);
+        content.setStatus(ContentStatus.publishedOnline);
 
-        contentManager.save(user, descriptor,
+        contentManager.save(user, content,
                 i18n.t("This is only a post sample. You can edit it, and rename this post and this blog"));
         return group;
     }

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -27,12 +27,12 @@
 import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
 
 public class DocumentClientTool extends FoldableAbstractClientTool {
-    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_UPLOADEDFILE = "docs.uploaded";
     public static final String NAME = "docs";
+    public static final String TYPE_ROOT = NAME + "." + "root";
+    public static final String TYPE_FOLDER = NAME + "." + "folder";
+    public static final String TYPE_DOCUMENT = NAME + "." + "doc";
+    public static final String TYPE_GALLERY = NAME + "." + "gallery";
+    public static final String TYPE_UPLOADEDFILE = NAME + "." + FoldableAbstractClientTool.UPLOADEDFILE_SUFFIX;
 
     public DocumentClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
             final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws,

Modified: trunk/src/main/java/org/ourproject/kune/docs/server/DocumentServerTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/server/DocumentServerTool.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/docs/server/DocumentServerTool.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -19,6 +19,8 @@
  */
 package org.ourproject.kune.docs.server;
 
+import java.util.Date;
+
 import org.ourproject.kune.platf.client.errors.ContainerNotPermittedException;
 import org.ourproject.kune.platf.client.errors.ContentNotPermittedException;
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
@@ -40,17 +42,18 @@
 import com.google.inject.Inject;
 
 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 NAME = "docs";
+    public static final String TYPE_ROOT = NAME + "." + "root";
+    public static final String TYPE_FOLDER = NAME + "." + "folder";
+    public static final String TYPE_DOCUMENT = NAME + "." + "doc";
+    public static final String TYPE_GALLERY = NAME + "." + "gallery";
+    public static final String TYPE_UPLOADEDFILE = NAME + "." + ServerTool.UPLOADEDFILE_SUFFIX;
+
     public static final String TYPE_BLOG = "docs.blog";
     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";
     public static final String ROOT_NAME = "documents";
 
     private final ContentManager contentManager;
@@ -94,13 +97,14 @@
         group.setToolConfig(NAME, config);
         configurationManager.persist(config);
         final String longName = group.getLongName();
-        final Content descriptor = contentManager.createContent(i18n.t("About [%s]", longName), "", user, rootFolder,
+        final Content content = contentManager.createContent(i18n.t("About [%s]", longName), "", user, rootFolder,
                 DocumentServerTool.TYPE_DOCUMENT);
-        descriptor.addAuthor(user);
-        descriptor.setLanguage(user.getLanguage());
-        descriptor.setTypeId(TYPE_DOCUMENT);
-        descriptor.setStatus(ContentStatus.publishedOnline);
-        group.setDefaultContent(descriptor);
+        content.addAuthor(user);
+        content.setLanguage(user.getLanguage());
+        content.setTypeId(TYPE_DOCUMENT);
+        content.setStatus(ContentStatus.publishedOnline);
+        content.setPublishedOn(new Date());
+        group.setDefaultContent(content);
         return group;
     }
 

Added: trunk/src/main/java/org/ourproject/kune/gallery/Kune-Gallery.gwt.xml
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/Kune-Gallery.gwt.xml	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/Kune-Gallery.gwt.xml	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,5 @@
+<!DOCTYPE document SYSTEM "src/main/java/gwt-module.dtd">
+<module>
+        <inherits name='org.ourproject.kune.platf.Kune-Platform' />
+        <inherits name='org.ourproject.kune.workspace.Kune-Workspace' />
+</module>

Added: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,109 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */package org.ourproject.kune.gallery.client;
+
+import static org.ourproject.kune.gallery.client.GalleryClientTool.TYPE_ALBUM;
+import static org.ourproject.kune.gallery.client.GalleryClientTool.TYPE_ROOT;
+import static org.ourproject.kune.gallery.client.GalleryClientTool.TYPE_UPLOADEDFILE;
+
+import org.ourproject.kune.gallery.client.cnt.GalleryViewer;
+import org.ourproject.kune.platf.client.actions.ContentActionRegistry;
+import org.ourproject.kune.platf.client.actions.ContextActionRegistry;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.platf.client.rpc.GroupServiceAsync;
+import org.ourproject.kune.platf.client.services.KuneErrorHandler;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
+import org.ourproject.kune.platf.client.ui.upload.FileUploader;
+import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper;
+import org.ourproject.kune.workspace.client.AbstractFoldableContentActions;
+import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
+import org.ourproject.kune.workspace.client.cxt.ContextPropEditor;
+import org.ourproject.kune.workspace.client.editor.TextEditor;
+import org.ourproject.kune.workspace.client.entitylogo.EntityLogo;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+
+import com.calclab.suco.client.ioc.Provider;
+
+public class GalleryClientActions extends AbstractFoldableContentActions {
+    public GalleryClientActions(final I18nUITranslationService i18n, final ContextNavigator contextNavigator,
+            final Session session, final StateManager stateManager,
+            final DeferredCommandWrapper deferredCommandWrapper,
+            final Provider<ContentServiceAsync> contentServiceProvider,
+            final Provider<GroupServiceAsync> groupServiceProvider, final Provider<FileUploader> fileUploaderProvider,
+            final ContentActionRegistry contentActionRegistry, final ContextActionRegistry contextActionRegistry,
+            final Provider<FileDownloadUtils> fileDownloadProvider, final EntityLogo entityLogo,
+            final Provider<TextEditor> textEditorProvider, final KuneErrorHandler errorHandler,
+            final GalleryViewer documentViewer, final Provider<ContextPropEditor> contextProvEditorProvider) {
+        super(session, stateManager, i18n, errorHandler, deferredCommandWrapper, groupServiceProvider,
+                contentServiceProvider, fileUploaderProvider, contextNavigator, contentActionRegistry,
+                contextActionRegistry, fileDownloadProvider, textEditorProvider, contextProvEditorProvider,
+                documentViewer, entityLogo);
+    }
+
+    @Override
+    protected void createActions() {
+        final String[] all = { TYPE_ROOT, TYPE_ALBUM, TYPE_UPLOADEDFILE };
+        final String[] containers = { TYPE_ROOT, TYPE_ALBUM };
+        final String[] contentsModerated = { TYPE_UPLOADEDFILE };
+        final String[] containersNoRoot = { TYPE_ALBUM };
+        final String[] contents = { TYPE_UPLOADEDFILE };
+
+        String parentMenuTitle = i18n.t("File");
+        String parentMenuTitleCtx = i18n.t("Album");
+
+        createNewContainerAction(TYPE_ALBUM, "images/nav/gallery_add.png", i18n.t("New sub-album"), parentMenuTitleCtx,
+                i18n.t("New"), i18n.t("New sub-album"), Position.ctx, TYPE_ALBUM);
+        createNewContainerAction(TYPE_ALBUM, "images/nav/gallery_add.png", i18n.t("New album"), parentMenuTitleCtx,
+                i18n.t("New"), i18n.t("New album"), Position.ctx, TYPE_ROOT);
+
+        createContentModeratedActions(parentMenuTitle, contentsModerated);
+
+        createContentRenameAction(parentMenuTitle, i18n.t("Rename"), contents);
+        createRenameContentInCtxAction(parentMenuTitleCtx, i18n.t("Rename"), containersNoRoot);
+
+        // final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupCxt =
+        // createSetAsDefContent(parentMenuTitleCtx);
+
+        createRefreshCntAction(parentMenuTitle, contents);
+        createRefreshCxtAction(parentMenuTitleCtx, containers);
+
+        createSetAsDefContent(parentMenuTitle, contents);
+
+        // createUploadAction(i18n.t("Upload file"), "images/nav/upload.png",
+        // i18n.t("Upload some files (images, PDFs, ...)"), null, containers);
+
+        createDownloadActions(TYPE_UPLOADEDFILE);
+
+        createGoAction(all);
+
+        createGoHomeAction(containers);
+
+        createTranslateAction(TYPE_ALBUM, TYPE_UPLOADEDFILE);
+
+        createDelContainerAction("Delete folder", parentMenuTitleCtx, containersNoRoot);
+        createDelContentAction(parentMenuTitle, i18n.t("Delete"), contents);
+    }
+
+    @Override
+    protected void createPostSessionInitActions() {
+        super.createUploadMediaAction(TYPE_ALBUM);
+    }
+}

Added: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,119 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */package org.ourproject.kune.gallery.client;
+
+import org.ourproject.kune.gallery.client.cnt.GalleryFolderContent;
+import org.ourproject.kune.gallery.client.cnt.GalleryFolderContentPanel;
+import org.ourproject.kune.gallery.client.cnt.GalleryFolderContentPresenter;
+import org.ourproject.kune.gallery.client.cnt.GalleryFolderContentView;
+import org.ourproject.kune.gallery.client.cnt.GalleryViewer;
+import org.ourproject.kune.gallery.client.cnt.GalleryViewerPanel;
+import org.ourproject.kune.gallery.client.cnt.GalleryViewerPresenter;
+import org.ourproject.kune.gallery.client.cnt.GalleryViewerView;
+import org.ourproject.kune.gallery.client.ctx.GalleryContext;
+import org.ourproject.kune.gallery.client.ctx.GalleryContextPresenter;
+import org.ourproject.kune.platf.client.actions.ContentActionRegistry;
+import org.ourproject.kune.platf.client.actions.ContextActionRegistry;
+import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar;
+import org.ourproject.kune.platf.client.app.ToolGroup;
+import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.platf.client.rpc.GroupServiceAsync;
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.services.KuneErrorHandler;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.tool.ToolSelector;
+import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
+import org.ourproject.kune.platf.client.ui.upload.FileUploader;
+import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper;
+import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
+import org.ourproject.kune.workspace.client.cxt.ContextPropEditor;
+import org.ourproject.kune.workspace.client.editor.TextEditor;
+import org.ourproject.kune.workspace.client.entitylogo.EntityLogo;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
+
+import com.calclab.suco.client.ioc.decorator.Singleton;
+import com.calclab.suco.client.ioc.module.AbstractModule;
+import com.calclab.suco.client.ioc.module.Factory;
+
+public class GalleryClientModule extends AbstractModule {
+
+    @Override
+    public void onInstall() {
+
+        register(ToolGroup.class, new Factory<GalleryClientTool>(GalleryClientTool.class) {
+            @Override
+            public GalleryClientTool create() {
+                $(GalleryClientActions.class);
+                return new GalleryClientTool($(I18nUITranslationService.class), $(ToolSelector.class),
+                        $(WsThemePresenter.class), $(WorkspaceSkeleton.class), $(ContentCapabilitiesRegistry.class));
+            }
+        });
+
+        register(ToolGroup.class, new Factory<GalleryClientActions>(GalleryClientActions.class) {
+            @Override
+            public GalleryClientActions create() {
+                return new GalleryClientActions($(I18nUITranslationService.class), $(ContextNavigator.class),
+                        $(Session.class), $(StateManager.class), $(DeferredCommandWrapper.class),
+                        $$(ContentServiceAsync.class), $$(GroupServiceAsync.class), $$(FileUploader.class),
+                        $(ContentActionRegistry.class), $(ContextActionRegistry.class), $$(FileDownloadUtils.class),
+                        $(EntityLogo.class), $$(TextEditor.class), $(KuneErrorHandler.class), $(GalleryViewer.class),
+                        $$(ContextPropEditor.class));
+            }
+        });
+
+        register(ToolGroup.class, new Factory<GalleryContext>(GalleryContext.class) {
+            @Override
+            public GalleryContext create() {
+                final GalleryContextPresenter presenter = new GalleryContextPresenter($(StateManager.class),
+                        $$(ContextNavigator.class), $$(ContextPropEditor.class));
+                return presenter;
+            }
+        });
+
+        register(Singleton.class, new Factory<GalleryViewer>(GalleryViewer.class) {
+            @Override
+            public GalleryViewer create() {
+                final GalleryViewerPresenter presenter = new GalleryViewerPresenter($(StateManager.class),
+                        $(Session.class), $(I18nUITranslationService.class), $(ActionContentToolbar.class),
+                        $(ContentActionRegistry.class), $$(FileDownloadUtils.class));
+                final GalleryViewerView view = new GalleryViewerPanel($(WorkspaceSkeleton.class),
+                        $(I18nTranslationService.class));
+                presenter.init(view);
+                return presenter;
+            }
+        });
+
+        register(ToolGroup.class, new Factory<GalleryFolderContent>(GalleryFolderContent.class) {
+            @Override
+            public GalleryFolderContent create() {
+                final GalleryFolderContentPresenter presenter = new GalleryFolderContentPresenter(
+                        $(StateManager.class), $(Session.class), $(ActionContentToolbar.class),
+                        $(ContentActionRegistry.class), $(I18nTranslationService.class));
+                final GalleryFolderContentView view = new GalleryFolderContentPanel($(WorkspaceSkeleton.class),
+                        $(I18nTranslationService.class));
+                presenter.init(view);
+                return presenter;
+            }
+        });
+    }
+}

Added: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,62 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.gallery.client;
+
+import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry;
+import org.ourproject.kune.platf.client.tool.FoldableAbstractClientTool;
+import org.ourproject.kune.platf.client.tool.ToolSelector;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
+
+public class GalleryClientTool extends FoldableAbstractClientTool {
+    public static final String NAME = "gallery";
+    public static final String TYPE_ROOT = NAME + "." + "root";
+    public static final String TYPE_ALBUM = NAME + "." + "album";
+    public static final String TYPE_UPLOADEDFILE = NAME + "." + FoldableAbstractClientTool.UPLOADEDFILE_SUFFIX;
+
+    public GalleryClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
+            final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws,
+            ContentCapabilitiesRegistry contentCapabilitiesRegistry) {
+        super(NAME, i18n.t("gallery"), toolSelector, wsThemePresenter, ws, contentCapabilitiesRegistry);
+
+        // registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
+        registerAuthorableTypes(TYPE_UPLOADEDFILE);
+        registerDragableTypes(TYPE_ALBUM, TYPE_UPLOADEDFILE);
+        registerDropableTypes(TYPE_ROOT, TYPE_ALBUM);
+        registerPublishModerableTypes(TYPE_UPLOADEDFILE);
+        registerRateableTypes(TYPE_UPLOADEDFILE);
+        registerRenamableTypes(TYPE_ALBUM, TYPE_UPLOADEDFILE);
+        registerTageableTypes(TYPE_UPLOADEDFILE);
+        registerTranslatableTypes(TYPE_ALBUM, TYPE_UPLOADEDFILE);
+
+        registerIcons();
+    }
+
+    public String getName() {
+        return NAME;
+    }
+
+    protected void registerIcons() {
+        registerContentTypeIcon(TYPE_ALBUM, "images/nav/gallery.png");
+        registerUploadTypesAndMimes(TYPE_UPLOADEDFILE);
+    }
+
+}

Added: trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContent.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContent.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContent.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,23 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.gallery.client.cnt;
+
+public interface GalleryFolderContent {
+}

Added: trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPanel.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPanel.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,33 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.gallery.client.cnt;
+
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.workspace.client.cnt.FoldableContentPanel;
+import org.ourproject.kune.workspace.client.site.Site;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+public class GalleryFolderContentPanel extends FoldableContentPanel implements GalleryFolderContentView {
+
+    public GalleryFolderContentPanel(WorkspaceSkeleton ws, I18nTranslationService i18n) {
+        super(ws, i18n);
+        super.setLabel("Folder properties, translations ..." + Site.IN_DEVELOPMENT);
+    }
+}

Added: trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPresenter.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPresenter.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,63 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.gallery.client.cnt;
+
+import org.ourproject.kune.gallery.client.GalleryClientTool;
+import org.ourproject.kune.platf.client.actions.ActionRegistry;
+import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar;
+import org.ourproject.kune.platf.client.dto.ContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.cnt.FoldableContentPresenter;
+
+public class GalleryFolderContentPresenter extends FoldableContentPresenter implements GalleryFolderContent {
+
+    private GalleryFolderContentView view;
+    private final I18nTranslationService i18n;
+
+    public GalleryFolderContentPresenter(StateManager stateManager, Session session, ActionContentToolbar toolbar,
+            final ActionRegistry<StateToken> actionRegistry, I18nTranslationService i18n) {
+        super(GalleryClientTool.NAME, stateManager, session, toolbar, actionRegistry);
+        this.i18n = i18n;
+    }
+
+    public void init(final GalleryFolderContentView view) {
+        super.init(view);
+        this.view = view;
+    }
+
+    @Override
+    protected void setState(StateContainerDTO state) {
+        if (state.getTypeId().equals(GalleryClientTool.TYPE_ROOT)) {
+            ContainerDTO rootContainer = state.getRootContainer();
+            if (rootContainer.getChilds().size() == 0 && rootContainer.getContents().size() == 0) {
+                view.setInfo(i18n.t("This gallery has no content"));
+            } else {
+                view.setInfo("");
+            }
+        } else {
+            view.setInfo("");
+        }
+        super.setState(state);
+    }
+}

Added: trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentView.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentView.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,25 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.gallery.client.cnt;
+
+import org.ourproject.kune.workspace.client.cnt.AbstractContentView;
+
+public interface GalleryFolderContentView extends AbstractContentView {
+}

Added: trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewer.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewer.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewer.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,25 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.gallery.client.cnt;
+
+import org.ourproject.kune.workspace.client.cnt.FoldableContent;
+
+public interface GalleryViewer extends FoldableContent {
+}

Added: trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPanel.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPanel.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,30 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.gallery.client.cnt;
+
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.workspace.client.cnt.FoldableContentPanel;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+public class GalleryViewerPanel extends FoldableContentPanel implements GalleryViewerView {
+    public GalleryViewerPanel(final WorkspaceSkeleton ws, I18nTranslationService i18n) {
+        super(ws, i18n);
+    }
+}

Added: trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPresenter.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPresenter.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,83 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.gallery.client.cnt;
+
+import org.ourproject.kune.gallery.client.GalleryClientTool;
+import org.ourproject.kune.platf.client.actions.ContentActionRegistry;
+import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar;
+import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
+import org.ourproject.kune.platf.client.ui.download.ImageSize;
+import org.ourproject.kune.workspace.client.cnt.FoldableContentPresenter;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+
+import com.calclab.suco.client.ioc.Provider;
+
+public class GalleryViewerPresenter extends FoldableContentPresenter implements GalleryViewer {
+    private GalleryViewerView view;
+    private final Provider<FileDownloadUtils> downloadProvider;
+
+    public GalleryViewerPresenter(StateManager stateManager, Session session, I18nUITranslationService i18n,
+            ActionContentToolbar toolbar, ContentActionRegistry actionRegistry,
+            Provider<FileDownloadUtils> downloadProvider) {
+        super(GalleryClientTool.NAME, stateManager, session, toolbar, actionRegistry);
+        this.downloadProvider = downloadProvider;
+    }
+
+    public void init(GalleryViewerView view) {
+        super.init(view);
+        this.view = view;
+    }
+
+    @Override
+    protected void setState(StateContentDTO state) {
+        super.setState(state);
+        setContent(state, GalleryClientTool.TYPE_UPLOADEDFILE);
+    }
+
+    private void setContent(StateContentDTO state, String uploadedfileType) {
+        String typeId = state.getTypeId();
+        String contentBody = state.getContent();
+        StateToken token = state.getStateToken();
+        BasicMimeTypeDTO mimeType = state.getMimeType();
+        if (typeId.equals(uploadedfileType)) {
+            if (mimeType != null) {
+                FileDownloadUtils fileDownloadUtils = downloadProvider.get();
+                if (mimeType.getType().equals("image")) {
+                    view.showImage(fileDownloadUtils.getImageUrl(token), fileDownloadUtils.getImageResizedUrl(token,
+                            ImageSize.sized));
+                } else if (mimeType.toString().equals("text/plain") || mimeType.toString().equals("application/pdf")) {
+                    view.setContent(contentBody);
+                } else {
+                    view.setContent("");
+                }
+            } else {
+                view.setContent("");
+            }
+        } else {
+            view.setContent(contentBody);
+        }
+        view.attach();
+    }
+}

Added: trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerView.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerView.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,30 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.gallery.client.cnt;
+
+import org.ourproject.kune.workspace.client.cnt.AbstractContentView;
+
+public interface GalleryViewerView extends AbstractContentView {
+
+    void setContent(String content);
+
+    void showImage(String imageUrl, String imageResizedUrl);
+
+}

Added: trunk/src/main/java/org/ourproject/kune/gallery/client/ctx/GalleryContext.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/ctx/GalleryContext.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/ctx/GalleryContext.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,24 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.gallery.client.ctx;
+
+public interface GalleryContext {
+
+}

Added: trunk/src/main/java/org/ourproject/kune/gallery/client/ctx/GalleryContextPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/ctx/GalleryContextPresenter.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/ctx/GalleryContextPresenter.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,36 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.gallery.client.ctx;
+
+import org.ourproject.kune.gallery.client.GalleryClientTool;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
+import org.ourproject.kune.workspace.client.cxt.ContextPropEditor;
+import org.ourproject.kune.workspace.client.cxt.FoldableContextPresenter;
+
+import com.calclab.suco.client.ioc.Provider;
+
+public class GalleryContextPresenter extends FoldableContextPresenter implements GalleryContext {
+    public GalleryContextPresenter(final StateManager stateManager,
+            final Provider<ContextNavigator> contextNavigatorProvider,
+            final Provider<ContextPropEditor> contextPropEditorProvider) {
+        super(GalleryClientTool.NAME, stateManager, contextNavigatorProvider, contextPropEditorProvider);
+    }
+}

Added: trunk/src/main/java/org/ourproject/kune/gallery/server/GalleryServerModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/server/GalleryServerModule.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/server/GalleryServerModule.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,29 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.gallery.server;
+
+import com.google.inject.Binder;
+import com.google.inject.Module;
+
+public class GalleryServerModule implements Module {
+    public void configure(final Binder binder) {
+        binder.bind(GalleryServerTool.class).asEagerSingleton();
+    }
+}

Added: trunk/src/main/java/org/ourproject/kune/gallery/server/GalleryServerTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/server/GalleryServerTool.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/gallery/server/GalleryServerTool.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -0,0 +1,125 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.gallery.server;
+
+import org.ourproject.kune.platf.client.errors.ContainerNotPermittedException;
+import org.ourproject.kune.platf.client.errors.ContentNotPermittedException;
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.server.content.ContainerManager;
+import org.ourproject.kune.platf.server.domain.Container;
+import org.ourproject.kune.platf.server.domain.Content;
+import org.ourproject.kune.platf.server.domain.Group;
+import org.ourproject.kune.platf.server.domain.ToolConfiguration;
+import org.ourproject.kune.platf.server.domain.User;
+import org.ourproject.kune.platf.server.manager.ToolConfigurationManager;
+import org.ourproject.kune.platf.server.tool.ServerTool;
+import org.ourproject.kune.platf.server.tool.ServerToolRegistry;
+import org.ourproject.kune.platf.server.tool.ServerToolTarget;
+
+import com.google.inject.Inject;
+
+public class GalleryServerTool implements ServerTool {
+    public static final String NAME = "gallery";
+    public static final String TYPE_ROOT = NAME + "." + "root";
+    public static final String TYPE_ALBUM = NAME + "." + "album";
+    public static final String TYPE_UPLOADEDFILE = NAME + "." + ServerTool.UPLOADEDFILE_SUFFIX;
+
+    public static final String ROOT_NAME = "gallery";
+
+    private final ToolConfigurationManager configurationManager;
+    private final ContainerManager containerManager;
+    private final I18nTranslationService i18n;
+
+    @Inject
+    public GalleryServerTool(final ContainerManager containerManager,
+            final ToolConfigurationManager configurationManager, final I18nTranslationService translationService) {
+        this.containerManager = containerManager;
+        this.configurationManager = configurationManager;
+        this.i18n = translationService;
+    }
+
+    public void checkTypesBeforeContainerCreation(String parentTypeId, String typeId) {
+        checkContainerTypeId(parentTypeId, typeId);
+    }
+
+    public void checkTypesBeforeContentCreation(String parentTypeId, String typeId) {
+        checkContentTypeId(parentTypeId, typeId);
+    }
+
+    public String getName() {
+        return NAME;
+    }
+
+    public String getRootName() {
+        return ROOT_NAME;
+    }
+
+    public ServerToolTarget getTarget() {
+        return ServerToolTarget.forBoth;
+    }
+
+    public Group initGroup(final User user, final Group group) {
+        final ToolConfiguration config = new ToolConfiguration();
+        final Container rootFolder = containerManager.createRootFolder(group, NAME, ROOT_NAME, TYPE_ROOT);
+        config.setRoot(rootFolder);
+        group.setToolConfig(NAME, config);
+        configurationManager.persist(config);
+
+        containerManager.createFolder(group, rootFolder, i18n.t("Album sample"), user.getLanguage(), TYPE_ALBUM);
+        return group;
+    }
+
+    public void onCreateContainer(final Container container, final Container parent) {
+    }
+
+    public void onCreateContent(final Content content, final Container parent) {
+    }
+
+    @Inject
+    public void register(final ServerToolRegistry registry) {
+        registry.register(this);
+    }
+
+    void checkContainerTypeId(final String parentTypeId, final String typeId) {
+        if (typeId.equals(TYPE_ALBUM)) {
+            // ok valid container
+            if ((typeId.equals(TYPE_ALBUM) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_ALBUM)))) {
+                // ok
+            } else {
+                throw new ContainerNotPermittedException();
+            }
+        } else {
+            throw new ContainerNotPermittedException();
+        }
+    }
+
+    void checkContentTypeId(final String parentTypeId, final String typeId) {
+        if (typeId.equals(TYPE_UPLOADEDFILE)) {
+            // ok valid content
+            if (typeId.equals(TYPE_UPLOADEDFILE) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_ALBUM))) {
+                // ok
+            } else {
+                throw new ContentNotPermittedException();
+            }
+        } else {
+            throw new ContentNotPermittedException();
+        }
+    }
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -6,6 +6,8 @@
 import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
 
 public abstract class FoldableAbstractClientTool extends AbstractClientTool {
+    public static final String UPLOADEDFILE_SUFFIX = "uploaded";
+
     protected final ContentCapabilitiesRegistry contentCapabilitiesRegistry;
 
     public FoldableAbstractClientTool(String shortName, String longName, ToolSelector toolSelector,
@@ -71,18 +73,6 @@
         contentCapabilitiesRegistry.getTranslatable().register(typeIds);
     }
 
-    protected void registerVersionableTypes(String... typeIds) {
-        contentCapabilitiesRegistry.getVersionable().register(typeIds);
-    }
-
-    protected void registerXmppComentableTypes(String... typeIds) {
-        contentCapabilitiesRegistry.getXmppComentable().register(typeIds);
-    }
-
-    protected void registerXmppNotifyCapableTypes(String... typeIds) {
-        contentCapabilitiesRegistry.getXmppNotificyCapable().register(typeIds);
-    }
-
     protected void registerUploadTypesAndMimes(String typeUploadedfile) {
         registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("image"), "images/nav/picture.png");
         registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("video"), "images/nav/film.png");
@@ -98,4 +88,16 @@
                 "images/nav/page_pps.png");
         registerContentTypeIcon(typeUploadedfile, "images/nav/page.png");
     }
+
+    protected void registerVersionableTypes(String... typeIds) {
+        contentCapabilitiesRegistry.getVersionable().register(typeIds);
+    }
+
+    protected void registerXmppComentableTypes(String... typeIds) {
+        contentCapabilitiesRegistry.getXmppComentable().register(typeIds);
+    }
+
+    protected void registerXmppNotifyCapableTypes(String... typeIds) {
+        contentCapabilitiesRegistry.getXmppNotificyCapable().register(typeIds);
+    }
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/download/FileParams.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/download/FileParams.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/download/FileParams.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -24,4 +24,5 @@
     String DOWNLOAD = "download";
     String IMGSIZE = "imgsize";
     String FILENAME = "filename";
+    String TYPE_ID = "typeid";
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/AbstractUploader.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/AbstractUploader.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/AbstractUploader.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -24,11 +24,12 @@
 
 public class AbstractUploader {
 
-    public UrlParam[] genUploadParams(final String userhash, final String currentStateToken) {
+    public UrlParam[] genUploadParams(final String userhash, final String currentStateToken, final String typeId) {
         // Warning take into account param[size]
-        final UrlParam param[] = new UrlParam[2];
+        final UrlParam param[] = new UrlParam[3];
         param[0] = new UrlParam(FileParams.HASH, userhash);
         param[1] = new UrlParam(FileParams.TOKEN, currentStateToken);
+        param[2] = new UrlParam(FileParams.TYPE_ID, typeId);
         return param;
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderDialog.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderDialog.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderDialog.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -92,8 +92,8 @@
         setPermittedExtensions(exts);
     }
 
-    public void setUploadParams(final String userhash, final String currentStateToken) {
-        dialog.setBaseParams(genUploadParams(userhash, currentStateToken));
+    public void setUploadParams(final String userhash, final String currentStateToken, final String typeId) {
+        dialog.setBaseParams(genUploadParams(userhash, currentStateToken, typeId));
     }
 
     public void show() {

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderPresenter.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderPresenter.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -20,6 +20,7 @@
 
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.tool.FoldableAbstractClientTool;
 import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
 
 import com.calclab.suco.client.ioc.Provider;
@@ -40,14 +41,16 @@
     public boolean checkFolderChange() {
         final StateToken currentFolderStateToken = session.getCurrentStateToken().clone().clearDocument();
         if (sameContainer()) {
-            view.setUploadParams(session.getUserHash(), currentFolderStateToken.toString());
+            view.setUploadParams(session.getUserHash(), currentFolderStateToken.toString(),
+                    currentFolderStateToken.getTool() + "." + FoldableAbstractClientTool.UPLOADEDFILE_SUFFIX);
             return true;
         }
         if (view.hasUploadingFiles()) {
             return false;
         } else {
             currentUploadStateToken = currentFolderStateToken;
-            view.setUploadParams(session.getUserHash(), currentFolderStateToken.toString());
+            view.setUploadParams(session.getUserHash(), currentFolderStateToken.toString(),
+                    currentFolderStateToken.getTool() + "." + FoldableAbstractClientTool.UPLOADEDFILE_SUFFIX);
             return true;
         }
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderView.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderView.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -30,7 +30,7 @@
 
     void setPermittedExtensions(String extensions);
 
-    void setUploadParams(String userhash, String currentUploadStateToken);
+    void setUploadParams(String userhash, String currentUploadStateToken, String typeId);
 
     void show();
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -90,8 +90,8 @@
     @Authenticated
     @Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
     @Transactional(type = TransactionType.READ_WRITE)
-    protected void createUploadedFile(String userHash, StateToken stateToken, String fileName, FileItem file)
-            throws Exception {
+    protected void createUploadedFile(String userHash, StateToken stateToken, String fileName, FileItem file,
+            String typeId) throws Exception {
         String mimeTypeS = file.getContentType();
         File tmpOrigFile = File.createTempFile("logoOrig", "");
         file.write(tmpOrigFile);

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -25,7 +25,6 @@
 import net.sf.json.JSONObject;
 
 import org.apache.commons.fileupload.FileItem;
-import org.ourproject.kune.docs.server.DocumentServerTool;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
 import org.ourproject.kune.platf.client.ui.download.ImageSize;
@@ -92,16 +91,16 @@
     }
 
     @Override
-    protected void createUploadedFile(String userHash, StateToken stateToken, String fileName, FileItem file)
-            throws Exception {
-        createUploadedFileWrapped(userHash, stateToken, fileName, file);
+    protected void createUploadedFile(String userHash, StateToken stateToken, String fileName, FileItem file,
+            String typeId) throws Exception {
+        createUploadedFileWrapped(userHash, stateToken, fileName, file, typeId);
     }
 
     @Authenticated
     @Authorizated(accessRolRequired = AccessRol.Editor, actionLevel = ActionLevel.container)
     @Transactional(type = TransactionType.READ_WRITE)
     Content createUploadedFileWrapped(final String userHash, final StateToken stateToken, final String fileName,
-            final FileItem fileUploadItem) throws Exception {
+            final FileItem fileUploadItem, String typeId) throws Exception {
         final String relDir = FileUtils.toDir(stateToken);
         final String absDir = kuneProperties.get(KuneProperties.UPLOAD_LOCATION) + relDir;
         fileManager.mkdir(absDir);
@@ -127,7 +126,7 @@
                     user, AccessRol.Editor);
             final String preview = "Preview of this file (in development)";
             final Content content = contentManager.createContent(FileUtils.getFileNameWithoutExtension(file.getName(),
-                    extension), preview, user, container, DocumentServerTool.TYPE_UPLOADEDFILE);
+                    extension), preview, user, container, typeId);
             content.setMimeType(basicMimeType);
             content.setFilename(file.getName());
             return content;

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerAbstract.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerAbstract.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerAbstract.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -59,8 +59,8 @@
     protected void beforeRespond(final HttpServletResponse response, final Writer w) throws IOException {
     }
 
-    protected void createUploadedFile(String userHash, StateToken stateToken, String fileName, FileItem file)
-            throws Exception {
+    protected void createUploadedFile(String userHash, StateToken stateToken, String fileName, FileItem file,
+            String typeId) throws Exception {
     }
 
     @Override
@@ -88,6 +88,7 @@
             final List fileItems = upload.parseRequest(req);
             String userHash = null;
             StateToken stateToken = null;
+            String typeId = null;
             String fileName = null;
             FileItem file = null;
             for (final Iterator iterator = fileItems.iterator(); iterator.hasNext();) {
@@ -102,13 +103,17 @@
                     if (name.equals(FileParams.TOKEN)) {
                         stateToken = new StateToken(value);
                     }
+                    if (name.equals(FileParams.TYPE_ID)) {
+                        typeId = value;
+                    }
                 } else {
                     fileName = item.getName();
-                    log.info("file: " + fileName + " fieldName: " + item.getFieldName() + " size: " + item.getSize());
+                    log.info("file: " + fileName + " fieldName: " + item.getFieldName() + " size: " + item.getSize()
+                            + " typeId: " + typeId);
                     file = item;
                 }
             }
-            createUploadedFile(userHash, stateToken, fileName, file);
+            createUploadedFile(userHash, stateToken, fileName, file, typeId);
             onSuccess(response);
         } catch (final FileUploadException e) {
             onFileUploadException(response);

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/tool/ServerTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/tool/ServerTool.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/tool/ServerTool.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -32,6 +32,9 @@
  */
 public interface ServerTool {
 
+    /* Same constant in client */
+    public static final String UPLOADEDFILE_SUFFIX = "uploaded";
+
     void checkTypesBeforeContainerCreation(String parentTypeId, String typeId);
 
     void checkTypesBeforeContentCreation(String parentTypeId, String typeId);

Modified: trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientTool.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientTool.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -27,11 +27,11 @@
 import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
 
 public class WikiClientTool extends FoldableAbstractClientTool {
-    public static final String TYPE_ROOT = "wiki.root";
-    public static final String TYPE_FOLDER = "wiki.folder";
-    public static final String TYPE_WIKIPAGE = "wiki.wikipage";
-    public static final String TYPE_UPLOADEDFILE = "wiki.uploaded";
     public static final String NAME = "wiki";
+    public static final String TYPE_ROOT = NAME + "." + "root";
+    public static final String TYPE_FOLDER = NAME + "." + "folder";
+    public static final String TYPE_WIKIPAGE = NAME + "." + "wikipage";
+    public static final String TYPE_UPLOADEDFILE = NAME + "." + FoldableAbstractClientTool.UPLOADEDFILE_SUFFIX;
 
     public WikiClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
             final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws,

Modified: trunk/src/main/java/org/ourproject/kune/wiki/client/cnt/WikiFolderContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/wiki/client/cnt/WikiFolderContentPresenter.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/wiki/client/cnt/WikiFolderContentPresenter.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -19,7 +19,6 @@
  */
 package org.ourproject.kune.wiki.client.cnt;
 
-import org.ourproject.kune.chat.client.ChatClientTool;
 import org.ourproject.kune.platf.client.actions.ActionRegistry;
 import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar;
 import org.ourproject.kune.platf.client.dto.ContainerDTO;
@@ -49,7 +48,7 @@
 
     @Override
     protected void setState(StateContainerDTO state) {
-        if (state.getTypeId().equals(ChatClientTool.TYPE_ROOT)) {
+        if (state.getTypeId().equals(WikiClientTool.TYPE_ROOT)) {
             ContainerDTO rootContainer = state.getRootContainer();
             if (rootContainer.getChilds().size() == 0 && rootContainer.getContents().size() == 0) {
                 view.setInfo(i18n.t("This wiki has no pages."));

Modified: trunk/src/main/java/org/ourproject/kune/wiki/server/WikiServerTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/wiki/server/WikiServerTool.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/wiki/server/WikiServerTool.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -19,6 +19,8 @@
  */
 package org.ourproject.kune.wiki.server;
 
+import java.util.Date;
+
 import org.ourproject.kune.platf.client.errors.ContainerNotPermittedException;
 import org.ourproject.kune.platf.client.errors.ContentNotPermittedException;
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
@@ -40,12 +42,12 @@
 import com.google.inject.Inject;
 
 public class WikiServerTool implements ServerTool {
-    public static final String TYPE_ROOT = "wiki.root";
-    public static final String TYPE_FOLDER = "wiki.folder";
-    public static final String TYPE_WIKIPAGE = "wiki.wikipage";
-    public static final String TYPE_UPLOADEDFILE = "wiki.uploaded";
+    public static final String NAME = "wiki";
+    public static final String TYPE_ROOT = NAME + "." + "root";
+    public static final String TYPE_FOLDER = NAME + "." + "folder";
+    public static final String TYPE_WIKIPAGE = NAME + "." + "wikipage";
+    public static final String TYPE_UPLOADEDFILE = NAME + "." + ServerTool.UPLOADEDFILE_SUFFIX;
 
-    public static final String NAME = "wiki";
     public static final String ROOT_NAME = "wiki";
 
     private final ContentManager contentManager;
@@ -111,6 +113,8 @@
     }
 
     public void onCreateContent(final Content content, final Container parent) {
+        content.setStatus(ContentStatus.publishedOnline);
+        content.setPublishedOn(new Date());
     }
 
     @Inject

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -1,7 +1,5 @@
 package org.ourproject.kune.workspace.client;
 
-import static org.ourproject.kune.docs.client.DocumentClientTool.TYPE_UPLOADEDFILE;
-
 import org.ourproject.kune.platf.client.actions.ActionEnableCondition;
 import org.ourproject.kune.platf.client.actions.ActionMenuItemDescriptor;
 import org.ourproject.kune.platf.client.actions.ActionToolbarButtonAndItemDescriptor;
@@ -199,8 +197,8 @@
         downloadCtx.setTextDescription(i18n.t("Download"));
         downloadCtx.setIconUrl("images/nav/download.png");
 
-        contentActionRegistry.addAction(download, TYPE_UPLOADEDFILE);
-        contextActionRegistry.addAction(downloadCtx, TYPE_UPLOADEDFILE);
+        contentActionRegistry.addAction(download, typeUploadedfile);
+        contextActionRegistry.addAction(downloadCtx, typeUploadedfile);
     }
 
     protected ActionToolbarButtonDescriptor<StateToken> createEditAction(String... registerInTypes) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -80,7 +80,7 @@
         anchorLayoutPanel.add(entityTools, new AnchorLayoutData("100%"));
         // height: is 25 * number of tools :-( finding a way to make this
         // automatic
-        anchorLayoutPanel.add(entitySummary, new AnchorLayoutData("100% -" + 4 * 25));
+        anchorLayoutPanel.add(entitySummary, new AnchorLayoutData("100% -" + 5 * 25));
         mainFitPanel.add(anchorLayoutPanel);
     }
 

Modified: trunk/src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload/FileUploaderPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload/FileUploaderPresenterTest.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload/FileUploaderPresenterTest.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -6,6 +6,7 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
+import org.ourproject.kune.docs.client.DocumentClientTool;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.ui.upload.FileUploaderPresenter;
@@ -29,46 +30,53 @@
 
     @Test
     public void testFirstAddFromDocInSameContainer() {
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.tool.1.1"));
+        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.1.1"));
         assertTrue(presenter.checkFolderChange());
-        Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.tool.1");
+        Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.docs.1",
+                DocumentClientTool.TYPE_UPLOADEDFILE);
     }
 
     @Test
     public void testFirstAddInSameContainer() {
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.tool.1"));
+        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.1"));
         assertTrue(presenter.checkFolderChange());
-        Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.tool.1");
+        Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.docs.1",
+                DocumentClientTool.TYPE_UPLOADEDFILE);
     }
 
     @Test
     public void testSomeAddsInDiffContainersButNotUploading() {
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.tool.1"));
+        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.1"));
         assertTrue(presenter.checkFolderChange());
         Mockito.stub(view.hasUploadingFiles()).toReturn(false);
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.tool.2"));
+        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.2"));
         assertTrue(presenter.checkFolderChange());
-        Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.tool.1");
-        Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.tool.2");
+        Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.docs.1",
+                DocumentClientTool.TYPE_UPLOADEDFILE);
+        Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.docs.2",
+                DocumentClientTool.TYPE_UPLOADEDFILE);
     }
 
     @Test
     public void testSomeAddsInDiffContainersButUploading() {
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.tool.1"));
+        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.1"));
         assertTrue(presenter.checkFolderChange());
         Mockito.stub(view.hasUploadingFiles()).toReturn(true);
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.tool.2"));
+        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.2"));
         assertFalse(presenter.checkFolderChange());
-        Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.tool.1");
-        Mockito.verify(view, Mockito.never()).setUploadParams(SOMEUSER_HASH, "group.tool.2");
+        Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.docs.1",
+                DocumentClientTool.TYPE_UPLOADEDFILE);
+        Mockito.verify(view, Mockito.never()).setUploadParams(SOMEUSER_HASH, "group.docs.2",
+                DocumentClientTool.TYPE_UPLOADEDFILE);
     }
 
     @Test
     public void testSomeAddsInSameContainer() {
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.tool.1"));
+        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.1"));
         assertTrue(presenter.checkFolderChange());
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.tool.1"));
+        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.1"));
         assertTrue(presenter.checkFolderChange());
-        Mockito.verify(view, Mockito.times(2)).setUploadParams(SOMEUSER_HASH, "group.tool.1");
+        Mockito.verify(view, Mockito.times(2)).setUploadParams(SOMEUSER_HASH, "group.docs.1",
+                DocumentClientTool.TYPE_UPLOADEDFILE);
     }
 }

Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManagerTest.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManagerTest.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -44,7 +44,7 @@
 
     @Test(expected = SessionExpiredException.class)
     public void testSessionExp() throws Exception {
-        manager.createUploadedFile("otherhash", null, null, null);
+        manager.createUploadedFile("otherhash", null, null, null, null);
     }
 
     @Ignore
@@ -56,6 +56,6 @@
 
     @Test(expected = UserMustBeLoggedException.class)
     public void testUserMustBeAuth() throws Exception {
-        manager.createUploadedFile(null, null, null, null);
+        manager.createUploadedFile(null, null, null, null, null);
     }
 }

Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerTest.java	2008-11-25 16:52:11 UTC (rev 969)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerTest.java	2008-11-26 13:41:04 UTC (rev 970)
@@ -21,11 +21,11 @@
 
     @Test(expected = SessionExpiredException.class)
     public void testSessionExp() throws Exception {
-        fileUploadManager.createUploadedFile("otherhash", null, null, null);
+        fileUploadManager.createUploadedFile("otherhash", null, null, null, null);
     }
 
     @Test(expected = UserMustBeLoggedException.class)
     public void testUserMustBeAuth() throws Exception {
-        fileUploadManager.createUploadedFile(null, null, null, null);
+        fileUploadManager.createUploadedFile(null, null, null, null, null);
     }
 }




More information about the kune-commits mailing list