[kune-commits] r1412 - in trunk/src/main/java: cc/kune/common/client/notify cc/kune/common/public cc/kune/core/client/rpcservices cc/kune/core/client/services cc/kune/core/client/sitebar/spaces cc/kune/core/public cc/kune/core/server cc/kune/core/server/manager cc/kune/core/server/manager/file cc/kune/core/server/manager/impl cc/kune/core/server/rpc cc/kune/core/shared/dto cc/kune/domain cc/kune/gspace/client cc/kune/gspace/client/options/logo cc/kune/gspace/client/options/style cc/kune/gspace/client/resources cc/kune/gspace/client/style cc/kune/gspace/client/themes cc/kune/pspace/client org/ourproject/kune/gallery/client org/ourproject/kune/wiki/client org/ourproject/kune/workspace/client

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Tue Jun 21 22:03:39 CEST 2011


Author: vjrj_
Date: 2011-06-21 22:03:39 +0200 (Tue, 21 Jun 2011)
New Revision: 1412

Added:
   trunk/src/main/java/cc/kune/core/server/manager/file/EntityBackgroundDownloadManager.java
   trunk/src/main/java/cc/kune/core/server/manager/file/EntityBackgroundUploadManager.java
   trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsUploadButton.java
   trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityUploaderForm.java
Modified:
   trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java
   trunk/src/main/java/cc/kune/common/public/kune-common.css
   trunk/src/main/java/cc/kune/core/client/rpcservices/GroupService.java
   trunk/src/main/java/cc/kune/core/client/rpcservices/GroupServiceAsync.java
   trunk/src/main/java/cc/kune/core/client/services/FileDownloadUtils.java
   trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java
   trunk/src/main/java/cc/kune/core/public/ws.css
   trunk/src/main/java/cc/kune/core/server/KuneRackModule.java
   trunk/src/main/java/cc/kune/core/server/manager/FileManager.java
   trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java
   trunk/src/main/java/cc/kune/core/server/manager/file/FileGwtUploadAbstractServlet.java
   trunk/src/main/java/cc/kune/core/server/manager/file/FileManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/manager/file/FileUploadManager.java
   trunk/src/main/java/cc/kune/core/server/manager/file/FileUtils.java
   trunk/src/main/java/cc/kune/core/server/manager/file/ImageUtilsDefault.java
   trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java
   trunk/src/main/java/cc/kune/core/shared/dto/GroupDTO.java
   trunk/src/main/java/cc/kune/domain/Group.java
   trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java
   trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java
   trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.ui.xml
   trunk/src/main/java/cc/kune/gspace/client/options/logo/CurrentLogoChangedEvent.java
   trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsLogoPanel.java
   trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsLogoPresenter.java
   trunk/src/main/java/cc/kune/gspace/client/options/logo/GroupOptionsLogoPresenter.java
   trunk/src/main/java/cc/kune/gspace/client/options/logo/UserOptionsLogoPresenter.java
   trunk/src/main/java/cc/kune/gspace/client/options/style/EntityOptionsStyleConfPanel.java
   trunk/src/main/java/cc/kune/gspace/client/options/style/EntityOptionsStyleConfPresenter.java
   trunk/src/main/java/cc/kune/gspace/client/options/style/EntityOptionsStyleConfView.java
   trunk/src/main/java/cc/kune/gspace/client/options/style/GroupOptionsStyleConfPanel.java
   trunk/src/main/java/cc/kune/gspace/client/options/style/GroupOptionsStyleConfPresenter.java
   trunk/src/main/java/cc/kune/gspace/client/options/style/UserOptionsStyleConfPanel.java
   trunk/src/main/java/cc/kune/gspace/client/options/style/UserOptionsStyleConfPresenter.java
   trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmor.css
   trunk/src/main/java/cc/kune/gspace/client/style/GSpaceBackManager.java
   trunk/src/main/java/cc/kune/gspace/client/style/GSpaceBackManagerImpl.java
   trunk/src/main/java/cc/kune/gspace/client/themes/GSpaceThemeManager.java
   trunk/src/main/java/cc/kune/pspace/client/PSpaceInDevelopment.ui.xml
   trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java
   trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientActions.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/OldAbstractFoldableContentActions.java
Log:
Group Background management

Modified: trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -20,6 +20,7 @@
 package cc.kune.common.client.notify;
 
 import cc.kune.common.client.utils.SimpleResponseCallback;
+import cc.kune.common.client.utils.TextUtils;
 import cc.kune.core.client.notify.msgs.UserNotifyEvent;
 import cc.kune.core.client.notify.spiner.ProgressHideEvent;
 import cc.kune.core.client.notify.spiner.ProgressShowEvent;
@@ -51,6 +52,11 @@
     eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error, message, closeable));
   }
 
+  public static void error(final String message, final String additionalMessage) {
+    eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error, message
+        + (TextUtils.empty(additionalMessage) ? "" : ": " + additionalMessage)));
+  }
+
   public static void error(final String message, final String title, final boolean closeable) {
     eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error, message, title, closeable));
   }

Modified: trunk/src/main/java/cc/kune/common/public/kune-common.css
===================================================================
--- trunk/src/main/java/cc/kune/common/public/kune-common.css	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/common/public/kune-common.css	2011-06-21 20:03:39 UTC (rev 1412)
@@ -211,7 +211,7 @@
   float: right;
 }
 
-.oc-clean {
+.oc-clean,.k-clear,.oc-clear,.k-clean {
   clear: both;
 }
 

Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/GroupService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/GroupService.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/GroupService.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -32,23 +32,23 @@
 @RemoteServiceRelativePath("GroupService")
 public interface GroupService extends RemoteService {
 
-    void changeDefLicense(final String userHash, final StateToken groupToken, final LicenseDTO license);
+  void changeDefLicense(final String userHash, final StateToken groupToken, final LicenseDTO license);
 
-    void changeGroupWsTheme(String userHash, StateToken groupToken, String theme) throws DefaultException;
+  void changeGroupWsTheme(String userHash, StateToken groupToken, String theme) throws DefaultException;
 
-    GroupDTO clearGroupBackImage(String userHash, StateToken token);
+  GroupDTO clearGroupBackImage(String userHash, StateToken token);
 
-    StateToken createNewGroup(String userHash, GroupDTO group, String publicDesc, String tags, String[] enabledTools)
-            throws DefaultException;
+  StateToken createNewGroup(String userHash, GroupDTO group, String publicDesc, String tags,
+      String[] enabledTools) throws DefaultException;
 
-    GroupDTO getGroup(String userHash, StateToken token);
+  GroupDTO getGroup(String userHash, StateToken token);
 
-    GroupDTO setGroupBackImage(String userHash, StateToken token);
+  void setGroupNewMembersJoiningPolicy(String userHash, StateToken groupToken,
+      AdmissionType admissionPolicy);
 
-    void setGroupNewMembersJoiningPolicy(String userHash, StateToken groupToken, AdmissionType admissionPolicy);
+  void setSocialNetworkVisibility(String userHash, StateToken groupToken,
+      SocialNetworkVisibility visibility);
 
-    void setSocialNetworkVisibility(String userHash, StateToken groupToken, SocialNetworkVisibility visibility);
+  void setToolEnabled(String userHash, StateToken groupToken, String toolName, boolean enabled);
 
-    void setToolEnabled(String userHash, StateToken groupToken, String toolName, boolean enabled);
-
 }

Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/GroupServiceAsync.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/GroupServiceAsync.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/GroupServiceAsync.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -29,27 +29,26 @@
 
 public interface GroupServiceAsync {
 
-    void changeDefLicense(final String userHash, final StateToken groupToken, final LicenseDTO license,
-            AsyncCallback<Void> asyncCallback);
+  void changeDefLicense(final String userHash, final StateToken groupToken, final LicenseDTO license,
+      AsyncCallback<Void> asyncCallback);
 
-    void changeGroupWsTheme(String userHash, StateToken groupToken, String theme, AsyncCallback<Void> callback);
+  void changeGroupWsTheme(String userHash, StateToken groupToken, String theme,
+      AsyncCallback<Void> callback);
 
-    void clearGroupBackImage(String userHash, StateToken token, AsyncCallback<GroupDTO> asyncCallback);
+  void clearGroupBackImage(String userHash, StateToken token, AsyncCallback<GroupDTO> asyncCallback);
 
-    void createNewGroup(String userHash, GroupDTO group, String publicDesc, String tags, String[] enabledTools,
-            AsyncCallback<StateToken> callback);
+  void createNewGroup(String userHash, GroupDTO group, String publicDesc, String tags,
+      String[] enabledTools, AsyncCallback<StateToken> callback);
 
-    void getGroup(String userHash, StateToken token, AsyncCallback<GroupDTO> asyncCallback);
+  void getGroup(String userHash, StateToken token, AsyncCallback<GroupDTO> asyncCallback);
 
-    void setGroupBackImage(String userHash, StateToken token, AsyncCallback<GroupDTO> asyncCallback);
+  void setGroupNewMembersJoiningPolicy(String userHash, StateToken groupToken,
+      AdmissionType admissionPolicy, AsyncCallback<Void> asyncCallback);
 
-    void setGroupNewMembersJoiningPolicy(String userHash, StateToken groupToken, AdmissionType admissionPolicy,
-            AsyncCallback<Void> asyncCallback);
+  void setSocialNetworkVisibility(String userHash, StateToken token, SocialNetworkVisibility visibility,
+      AsyncCallback<Void> asyncCallback);
 
-    void setSocialNetworkVisibility(String userHash, StateToken token, SocialNetworkVisibility visibility,
-            AsyncCallback<Void> asyncCallback);
+  void setToolEnabled(String userHash, StateToken groupToken, String toolName, boolean enabled,
+      AsyncCallback<Void> asyncCallback);
 
-    void setToolEnabled(String userHash, StateToken groupToken, String toolName, boolean enabled,
-            AsyncCallback<Void> asyncCallback);
-
 }

Modified: trunk/src/main/java/cc/kune/core/client/services/FileDownloadUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/services/FileDownloadUtils.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/client/services/FileDownloadUtils.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -33,6 +33,7 @@
 
 public class FileDownloadUtils {
 
+  private static final String BACKDOWNLOADSERVLET = "servlets/EntityBackgroundDownloadManager";
   private static final String DOWNLOADSERVLET = "servlets/FileDownloadManager";
   protected static final String GROUP_NO_AVATAR_IMAGE = "images/group-def-icon.png";
   private static final String LOGODOWNLOADSERVLET = "servlets/EntityLogoDownloadManager";
@@ -67,6 +68,16 @@
     DOM.setElementAttribute(RootPanel.get("__download").getElement(), "src", url);
   }
 
+  public String getBackgroundImageUrl(final StateToken token) {
+    return new Url(GWT.getModuleBaseURL() + BACKDOWNLOADSERVLET, new UrlParam(FileConstants.TOKEN,
+        token.toString())).toString();
+  }
+
+  public String getBackgroundResizedUrl(final StateToken token, final ImageSize imageSize) {
+    return new Url(GWT.getModuleBaseURL() + BACKDOWNLOADSERVLET, new UrlParam(FileConstants.TOKEN,
+        token.toString()), new UrlParam(FileConstants.IMGSIZE, imageSize.toString())).toString();
+  }
+
   public String getGroupLogo(final GroupDTO group) {
     return group.hasLogo() ? getLogoImageUrl(group.getStateToken())
         : group.isPersonal() ? PERSON_NO_AVATAR_IMAGE : GROUP_NO_AVATAR_IMAGE;

Modified: trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -28,6 +28,7 @@
 import cc.kune.core.client.state.TokenUtils;
 import cc.kune.core.client.state.UserSignOutEvent;
 import cc.kune.gspace.client.GSpaceArmor;
+import cc.kune.gspace.client.style.GSpaceBackManager;
 
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
@@ -69,6 +70,7 @@
   }
 
   private final GSpaceArmor armor;
+  private final GSpaceBackManager backManager;
   private Space currentSpace;
   private String groupToken;
   private String homeToken;
@@ -81,12 +83,13 @@
   @Inject
   public SpaceSelectorPresenter(final EventBus eventBus, final StateManager stateManager,
       final SpaceSelectorView view, final SpaceSelectorProxy proxy, final GSpaceArmor armor,
-      final Session session, final Provider<SignIn> signIn) {
+      final Session session, final Provider<SignIn> signIn, final GSpaceBackManager backManager) {
     super(eventBus, view, proxy);
     this.stateManager = stateManager;
     this.armor = armor;
     this.session = session;
     this.signIn = signIn;
+    this.backManager = backManager;
     currentSpace = null;
     homeToken = SiteTokens.HOME;
     userToken = SiteTokens.WAVEINBOX;
@@ -124,6 +127,7 @@
 
   private void onGroupSpaceSelect() {
     armor.selectGroupSpace();
+    backManager.restoreBackImage();
     getView().setHomeBtnDown(false);
     getView().setUserBtnDown(false);
     getView().setGroupBtnDown(true);
@@ -133,6 +137,7 @@
 
   private void onHomeSpaceSelect() {
     armor.selectHomeSpace();
+    backManager.clearBackImage();
     getView().setHomeBtnDown(true);
     getView().setUserBtnDown(false);
     getView().setGroupBtnDown(false);
@@ -142,6 +147,7 @@
 
   private void onPublicSpaceSelect() {
     armor.selectPublicSpace();
+    backManager.restoreBackImage();
     getView().setHomeBtnDown(false);
     getView().setUserBtnDown(false);
     getView().setGroupBtnDown(false);
@@ -204,6 +210,7 @@
   private void onUserSpaceSelect() {
     if (session.isLogged()) {
       armor.selectUserSpace();
+      backManager.clearBackImage();
       getView().setHomeBtnDown(false);
       getView().setUserBtnDown(true);
       getView().setGroupBtnDown(false);

Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/public/ws.css	2011-06-21 20:03:39 UTC (rev 1412)
@@ -1,5 +1,6 @@
-CHARSET          "UTF-8         "; body {
-  background-color: white;
+CHARSET          "UTF-8         ";
+body {
+  background-color: transparent;
   color: black;
   font-family: 'Ubuntu', Arial;
   font-size: small;

Modified: trunk/src/main/java/cc/kune/core/server/KuneRackModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/KuneRackModule.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/server/KuneRackModule.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -33,6 +33,8 @@
 import cc.kune.core.client.rpcservices.SocialNetworkService;
 import cc.kune.core.client.rpcservices.UserService;
 import cc.kune.core.server.init.FinderRegistry;
+import cc.kune.core.server.manager.file.EntityBackgroundDownloadManager;
+import cc.kune.core.server.manager.file.EntityBackgroundUploadManager;
 import cc.kune.core.server.manager.file.EntityLogoDownloadManager;
 import cc.kune.core.server.manager.file.EntityLogoUploadManager;
 import cc.kune.core.server.manager.file.FileDownloadManager;
@@ -139,7 +141,8 @@
     builder.installRESTServices("^/ws/json/", TestJSONService.class, GroupJSONService.class,
         UserJSONService.class, I18nTranslationJSONService.class, ContentJSONService.class);
     builder.installServlet("^/ws/servlets/", FileUploadManager.class, FileDownloadManager.class,
-        EntityLogoUploadManager.class, EntityLogoDownloadManager.class, FileGwtUploadServlet.class);
+        EntityLogoUploadManager.class, EntityLogoDownloadManager.class, FileGwtUploadServlet.class,
+        EntityBackgroundDownloadManager.class, EntityBackgroundUploadManager.class);
 
     builder.at("^/ws/(.*)$").install(new ForwardFilter("^/ws/(.*)$", "/ws/{0}"));
   }

Modified: trunk/src/main/java/cc/kune/core/server/manager/FileManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/FileManager.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/server/manager/FileManager.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -24,31 +24,39 @@
 
 public interface FileManager {
 
-    /**
-     * Create a new file adding a numeric sequence if the file already exists
-     * 
-     * @param dir
-     *            the directory (use File.separator for dir delimiters)
-     * @param fileName
-     *            (the new file name)
-     * @return if 'file.txt' exists it creates 'file 1.txt' and if 'file 1.txt'
-     *         exists it creates 'file 2.txt' and so on
-     * @throws IOException
-     */
-    File createFileWithSequentialName(String dir, String fileName) throws IOException;
+  /**
+   * Create a new file adding a numeric sequence if the file already exists
+   * 
+   * @param dir
+   *          the directory (use File.separator for dir delimiters)
+   * @param fileName
+   *          (the new file name)
+   * @return if 'file.txt' exists it creates 'file 1.txt' and if 'file 1.txt'
+   *         exists it creates 'file 2.txt' and so on
+   * @throws IOException
+   */
+  File createFileWithSequentialName(String dir, String fileName) throws IOException;
 
-    /**
-     * @param dir
-     *            the directory (use File.separator for dir delimiters)
-     * @return true if and only if the directory was created, along with all
-     *         necessary parent directories; false otherwise
-     */
-    boolean mkdir(String dir);
+  /**
+   * @param dir
+   *          the directory (use File.separator for dir delimiters)
+   * @return true if and only if the directory was created, along with all
+   *         necessary parent directories; false otherwise
+   */
+  boolean mkdir(String dir);
 
-    /**
-     * @param dir
-     *            the directory (use File.separator for dir delimiters)
-     */
-    boolean rmdir(String dir) throws IOException;
+  /**
+   * @param dir
+   *          the directory (use File.separator for dir delimiters)
+   * @param file
+   *          the file to remove
+   */
+  boolean rm(String dir, String file);
 
+  /**
+   * @param dir
+   *          the directory (use File.separator for dir delimiters)
+   */
+  boolean rmdir(String dir) throws IOException;
+
 }

Modified: trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -32,46 +32,46 @@
 
 public interface GroupManager extends Manager<Group, Long> {
 
-    void changeDefLicense(User user, Group group, String licenseShortName);
+  void changeDefLicense(User user, Group group, String licenseShortName);
 
-    void changeWsTheme(User user, Group group, String theme) throws AccessViolationException;
+  void changeWsTheme(User user, Group group, String theme) throws AccessViolationException;
 
-    void clearGroupBackImage(Group group);
+  void clearGroupBackImage(Group group);
 
-    Group createGroup(Group group, User user, String publicDescrip) throws GroupNameInUseException,
-            UserMustBeLoggedException;
+  Group createGroup(Group group, User user, String publicDescrip) throws GroupNameInUseException,
+      UserMustBeLoggedException;
 
-    Group createUserGroup(User user) throws GroupNameInUseException, EmailAddressInUseException;
+  Group createUserGroup(User user) throws GroupNameInUseException, EmailAddressInUseException;
 
-    Group createUserGroup(User user, boolean wantPersonalHomepage) throws GroupNameInUseException,
-            EmailAddressInUseException;
+  Group createUserGroup(User user, boolean wantPersonalHomepage) throws GroupNameInUseException,
+      EmailAddressInUseException;
 
-    List<Group> findAdminInGroups(Long groupId);
+  List<Group> findAdminInGroups(Long groupId);
 
-    Group findByShortName(String groupName);
+  Group findByShortName(String groupName);
 
-    List<Group> findCollabInGroups(Long groupId);
+  List<Group> findCollabInGroups(Long groupId);
 
-    List<String> findEnabledTools(Long id);
+  List<String> findEnabledTools(Long id);
 
-    /**
-     * IMPORTANT: returns null if userId is null
-     * 
-     * @param userId
-     * @return
-     */
-    Group getGroupOfUserWithId(Long userId);
+  /**
+   * IMPORTANT: returns null if userId is null
+   * 
+   * @param userId
+   * @return
+   */
+  Group getGroupOfUserWithId(Long userId);
 
-    Group getSiteDefaultGroup();
+  Group getSiteDefaultGroup();
 
-    SearchResult<Group> search(String search);
+  SearchResult<Group> search(String search);
 
-    SearchResult<Group> search(String search, Integer firstResult, Integer maxResults);
+  SearchResult<Group> search(String search, Integer firstResult, Integer maxResults);
 
-    void setDefaultContent(String groupShortName, Content content);
+  void setDefaultContent(String groupShortName, Content content);
 
-    void setGroupBackImage(Group group, Content content);
+  void setGroupBackgroundImage(Group group, String backgroundFileName, String mime);
 
-    void setToolEnabled(User userLogged, String groupShortName, String toolName, boolean enabled);
+  void setToolEnabled(User userLogged, String groupShortName, String toolName, boolean enabled);
 
 }

Added: trunk/src/main/java/cc/kune/core/server/manager/file/EntityBackgroundDownloadManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/file/EntityBackgroundDownloadManager.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/server/manager/file/EntityBackgroundDownloadManager.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -0,0 +1,120 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ \*/
+package cc.kune.core.server.manager.file;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import cc.kune.core.client.errors.ContentNotFoundException;
+import cc.kune.core.client.services.FileConstants;
+import cc.kune.core.client.services.ImageSize;
+import cc.kune.core.server.manager.GroupManager;
+import cc.kune.core.server.properties.KuneProperties;
+import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.domain.Group;
+
+import com.google.inject.Inject;
+
+/**
+ * Some snippets from:
+ * http://www.onjava.com/pub/a/onjava/excerpt/jebp_3/index1.html?page=1
+ * 
+ */
+
+public class EntityBackgroundDownloadManager extends HttpServlet {
+
+  static final String APPLICATION_X_DOWNLOAD = "application/x-download";
+
+  public static final Log LOG = LogFactory.getLog(FileDownloadManager.class);
+  static final String RESP_HEADER_ATTACHMENT_FILENAME = "attachment; filename=\"";
+  static final String RESP_HEADER_CONTEND_DISP = "Content-Disposition";
+
+  static final String RESP_HEADER_END = "\"";
+
+  private static final long serialVersionUID = -1160659289588014049L;
+
+  @Inject
+  FileUtils fileUtils;
+  @Inject
+  GroupManager groupManager;
+  @Inject
+  KuneProperties kuneProperties;
+
+  String buildResponse(final StateToken statetoken, final String filename, final String mimeType,
+      final ImageSize imgsize, final HttpServletResponse resp) throws FileNotFoundException, IOException {
+    final String absDir = kuneProperties.get(KuneProperties.UPLOAD_LOCATION)
+        + FileUtils.groupToDir(statetoken.getGroup());
+    String absFilename = absDir + filename;
+
+    if (imgsize != null) {
+      final String imgsizePrefix = "." + imgsize;
+      final String extension = FileUtils.getFileNameExtension(filename, true);
+      final String filenameWithoutExtension = FileUtils.getFileNameWithoutExtension(filename, extension);
+      final String filenameResized = filenameWithoutExtension + imgsizePrefix + extension;
+      if (fileUtils.exist(absDir + filenameResized)) {
+        absFilename = absDir + filenameResized;
+      }
+    }
+
+    final File file = new File(absFilename);
+
+    resp.setContentLength((int) file.length());
+
+    final String contentType = mimeType.toString();
+
+    resp.setContentType(contentType);
+    LOG.info("Content type returned: " + contentType);
+
+    resp.setHeader(RESP_HEADER_CONTEND_DISP, RESP_HEADER_ATTACHMENT_FILENAME + filename
+        + RESP_HEADER_END);
+    return absFilename;
+  }
+
+  @Override
+  protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
+      throws ServletException, IOException {
+
+    final StateToken stateToken = new StateToken(req.getParameter(FileConstants.TOKEN));
+    final String imageSizeS = req.getParameter(FileConstants.IMGSIZE);
+    final ImageSize imgsize = imageSizeS == null ? null : ImageSize.valueOf(imageSizeS);
+
+    try {
+      final Group group = groupManager.findByShortName(stateToken.getGroup());
+
+      final String absFilename = buildResponse(stateToken, group.getBackgroundImage(),
+          group.getBackgroundMime(), imgsize, resp);
+      final OutputStream out = resp.getOutputStream();
+      FileDownloadManagerUtils.returnFile(absFilename, out);
+    } catch (final ContentNotFoundException e) {
+      FileDownloadManagerUtils.returnNotFound(resp);
+      return;
+    }
+  }
+}


Property changes on: trunk/src/main/java/cc/kune/core/server/manager/file/EntityBackgroundDownloadManager.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/src/main/java/cc/kune/core/server/manager/file/EntityBackgroundUploadManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/file/EntityBackgroundUploadManager.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/server/manager/file/EntityBackgroundUploadManager.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -0,0 +1,103 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ \*/
+package cc.kune.core.server.manager.file;
+
+import java.io.File;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import cc.kune.core.server.auth.ActionLevel;
+import cc.kune.core.server.auth.Authenticated;
+import cc.kune.core.server.auth.Authorizated;
+import cc.kune.core.server.manager.FileManager;
+import cc.kune.core.server.manager.GroupManager;
+import cc.kune.core.server.properties.KuneProperties;
+import cc.kune.core.shared.domain.AccessRol;
+import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.domain.BasicMimeType;
+import cc.kune.domain.Group;
+
+import com.google.inject.Inject;
+import com.google.inject.persist.Transactional;
+
+public class EntityBackgroundUploadManager extends FileGwtUploadAbstractServlet {
+
+  public static final Log LOG = LogFactory.getLog(FileGwtUploadServlet.class);
+  private static final long serialVersionUID = 1L;
+  private final FileManager fileManager;
+  private final GroupManager groupManager;
+  private final I18nTranslationService i18n;
+
+  @Inject
+  public EntityBackgroundUploadManager(final KuneProperties kuneProperties,
+      final GroupManager groupManager, final I18nTranslationService i18n, final FileManager fileManager) {
+    super(kuneProperties);
+    this.groupManager = groupManager;
+    this.i18n = i18n;
+    this.fileManager = fileManager;
+  }
+
+  @Override
+  @Authenticated
+  @Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
+  @Transactional
+  protected String createUploadedFile(final String userHash, final StateToken stateToken,
+      final String fileName, final FileItem origFile, final String typeId) {
+    try {
+      final String mimeTypeS = origFile.getContentType();
+      final BasicMimeType mimeType = new BasicMimeType(mimeTypeS);
+      if (!mimeType.getType().equals("image")) {
+        return "Trying to set a non image (" + mimeTypeS + ") as group background";
+      }
+      final Group group = groupManager.findByShortName(stateToken.getGroup());
+
+      if (group == Group.NO_GROUP) {
+        LOG.error("Group not found trying to set the background");
+        return i18n.t("Error uploading file");
+      }
+
+      final String relDir = FileUtils.groupToDir(group.getShortName());
+      final String absDir = kuneProperties.get(KuneProperties.UPLOAD_LOCATION) + relDir;
+      fileManager.mkdir(absDir);
+
+      File destFile = null;
+      final String filenameUTF8 = new String(origFile.getName().getBytes(), UTF8);
+      destFile = fileManager.createFileWithSequentialName(absDir, filenameUTF8);
+      origFile.write(destFile);
+
+      final String extension = FileUtils.getFileNameExtension(filenameUTF8, false);
+      ImageUtilsDefault.generateThumbs(absDir, filenameUTF8, extension, false,
+          Integer.parseInt(kuneProperties.get(KuneProperties.IMAGES_RESIZEWIDTH)),
+          Integer.parseInt(kuneProperties.get(KuneProperties.IMAGES_THUMBSIZE)),
+          Integer.parseInt(kuneProperties.get(KuneProperties.IMAGES_CROPSIZE)),
+          Integer.parseInt(kuneProperties.get(KuneProperties.IMAGES_ICONSIZE)));
+
+      LOG.info("Mimetype: " + mimeType);
+      groupManager.setGroupBackgroundImage(group, filenameUTF8, mimeTypeS);
+
+    } catch (final Exception e) {
+      return i18n.t("Error uploading file");
+    }
+    return i18n.t("Success uploading");
+  }
+}


Property changes on: trunk/src/main/java/cc/kune/core/server/manager/file/EntityBackgroundUploadManager.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/src/main/java/cc/kune/core/server/manager/file/FileGwtUploadAbstractServlet.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/file/FileGwtUploadAbstractServlet.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/server/manager/file/FileGwtUploadAbstractServlet.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -34,12 +34,18 @@
 import cc.kune.core.server.properties.KuneProperties;
 import cc.kune.core.shared.domain.utils.StateToken;
 
+import com.google.inject.servlet.RequestScoped;
+
+ at RequestScoped
 public abstract class FileGwtUploadAbstractServlet extends UploadAction {
 
   public static final Log LOG = LogFactory.getLog(FileGwtUploadAbstractServlet.class);
   private static final long serialVersionUID = 1L;
+  protected static final String UTF8 = "UTF-8";
+  protected final KuneProperties kuneProperties;
 
   public FileGwtUploadAbstractServlet(final KuneProperties kuneProperties) {
+    this.kuneProperties = kuneProperties;
     this.maxSize = Integer.valueOf(kuneProperties.get(KuneProperties.UPLOAD_MAX_FILE_SIZE_IN_KS));
     this.uploadDelay = Integer.valueOf(kuneProperties.get(KuneProperties.UPLOAD_DELAY_FOR_TEST));
   }

Modified: trunk/src/main/java/cc/kune/core/server/manager/file/FileManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/file/FileManagerDefault.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/server/manager/file/FileManagerDefault.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -22,7 +22,6 @@
 import java.io.File;
 import java.io.IOException;
 
-
 import cc.kune.core.server.manager.FileManager;
 
 import com.google.inject.Singleton;
@@ -30,34 +29,43 @@
 @Singleton
 public class FileManagerDefault implements FileManager {
 
-    public File createFileWithSequentialName(final String dir, final String fileName) throws IOException {
-        String fileNameProposal = String.valueOf(fileName);
-        File file = new File(dir, fileNameProposal);
-        while (file.exists()) {
-            fileNameProposal = FileUtils.getNextSequentialFileName(fileNameProposal, true);
-            // @PMD:REVIEWED:AvoidInstantiatingObjectsInLoops: by vjrj on
-            // 21/05/09 13:15
-            file = new File(dir, fileNameProposal);
-        }
-        if (file.createNewFile()) {
-            return file;
-        } else {
-            throw new IOException("Cannot create sequential file name");
-        }
+  @Override
+  public File createFileWithSequentialName(final String dir, final String fileName) throws IOException {
+    String fileNameProposal = String.valueOf(fileName);
+    File file = new File(dir, fileNameProposal);
+    while (file.exists()) {
+      fileNameProposal = FileUtils.getNextSequentialFileName(fileNameProposal, true);
+      // @PMD:REVIEWED:AvoidInstantiatingObjectsInLoops: by vjrj on
+      // 21/05/09 13:15
+      file = new File(dir, fileNameProposal);
     }
-
-    public boolean mkdir(final String dir) {
-        return new File(dir).mkdirs();
+    if (file.createNewFile()) {
+      return file;
+    } else {
+      throw new IOException("Cannot create sequential file name");
     }
+  }
 
-    public boolean rmdir(final String dir) throws IOException {
-        final File file = new File(dir);
-        if (!file.isDirectory()) {
-            throw new IOException("rmdir: " + dir + ": Not a directory");
-        }
-        if (file.listFiles().length != 0) {
-            throw new IOException("rmdir: " + dir + ": Directory not empty");
-        }
-        return file.delete();
+  @Override
+  public boolean mkdir(final String dir) {
+    return new File(dir).mkdirs();
+  }
+
+  @Override
+  public boolean rm(final String dir, final String fileName) {
+    final File file = new File(dir, fileName);
+    return file.delete();
+  }
+
+  @Override
+  public boolean rmdir(final String dir) throws IOException {
+    final File file = new File(dir);
+    if (!file.isDirectory()) {
+      throw new IOException("rmdir: " + dir + ": Not a directory");
     }
+    if (file.listFiles().length != 0) {
+      throw new IOException("rmdir: " + dir + ": Directory not empty");
+    }
+    return file.delete();
+  }
 }

Modified: trunk/src/main/java/cc/kune/core/server/manager/file/FileUploadManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/file/FileUploadManager.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/server/manager/file/FileUploadManager.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -20,14 +20,11 @@
 package cc.kune.core.server.manager.file;
 
 import java.io.File;
-import java.io.FileNotFoundException;
 
-import magick.MagickException;
 import net.sf.json.JSONObject;
 
 import org.apache.commons.fileupload.FileItem;
 
-import cc.kune.core.client.services.ImageSize;
 import cc.kune.core.server.UserSession;
 import cc.kune.core.server.access.AccessService;
 import cc.kune.core.server.auth.ActionLevel;
@@ -53,129 +50,109 @@
 @RequestScoped
 public class FileUploadManager extends FileJsonUploadManagerAbstract {
 
-    private static final long serialVersionUID = -7209922761735338754L;
-    @Inject
-    AccessService accessService;
-    @Inject
-    ContentManager contentManager;
-    @Inject
-    FileManager fileManager;
-    @Inject
-    I18nTranslationService i18n;
-    @Inject
-    UserSession userSession;
+  private static final long serialVersionUID = -7209922761735338754L;
+  @Inject
+  AccessService accessService;
+  @Inject
+  ContentManager contentManager;
+  @Inject
+  FileManager fileManager;
+  @Inject
+  I18nTranslationService i18n;
+  @Inject
+  UserSession userSession;
 
-    @Override
-    protected void beforePostStart() {
-    }
+  @Override
+  protected void beforePostStart() {
+  }
 
-    @Override
-    protected JSONObject createJsonResponse(final boolean success, final String message) {
-        /**
-         * 
-         * http://max-bazhenov.com/dev/upload-dialog-2.0/index.php
-         * 
-         * Server side handler.
-         * 
-         * The files in the queue are posted one at a time, the file field name
-         * is 'file'. The handler should return json encoded object with
-         * following properties: { success: true|false, // required error:
-         * 'Error or success message' // optional, also can be named 'message' }
-         */
+  @Override
+  protected JSONObject createJsonResponse(final boolean success, final String message) {
+    /**
+     * 
+     * http://max-bazhenov.com/dev/upload-dialog-2.0/index.php
+     * 
+     * Server side handler.
+     * 
+     * The files in the queue are posted one at a time, the file field name is
+     * 'file'. The handler should return json encoded object with following
+     * properties: { success: true|false, // required error: 'Error or success
+     * message' // optional, also can be named 'message' }
+     */
 
-        JSONObject response = null;
-        try {
-            response = new JSONObject();
-            response.put("success", success);
-            response.put("error", message);
-            response.put("code", "232");
-        } catch (final Exception e) {
-            LOG.error("Error building response");
-        }
-        return response;
+    JSONObject response = null;
+    try {
+      response = new JSONObject();
+      response.put("success", success);
+      response.put("error", message);
+      response.put("code", "232");
+    } catch (final Exception e) {
+      LOG.error("Error building response");
     }
+    return response;
+  }
 
-    @Override
-    protected void createUploadedFile(final String userHash, final StateToken stateToken, final String fileName,
-            final FileItem file, final String typeId) throws Exception {
-        createUploadedFileWrapped(userHash, stateToken, fileName, file, typeId);
-    }
+  @Override
+  protected void createUploadedFile(final String userHash, final StateToken stateToken,
+      final String fileName, final FileItem file, final String typeId) throws Exception {
+    createUploadedFileWrapped(userHash, stateToken, fileName, file, typeId);
+  }
 
-    @Authenticated
-    @Authorizated(accessRolRequired = AccessRol.Editor, actionLevel = ActionLevel.container, mustCheckMembership = false)
-    @Transactional
-    Content createUploadedFileWrapped(final String userHash, final StateToken stateToken, final String fileName,
-            final FileItem fileUploadItem, final String typeId) throws Exception {
-        final String relDir = FileUtils.toDir(stateToken);
-        final String absDir = kuneProperties.get(KuneProperties.UPLOAD_LOCATION) + relDir;
-        fileManager.mkdir(absDir);
+  @Authenticated
+  @Authorizated(accessRolRequired = AccessRol.Editor, actionLevel = ActionLevel.container, mustCheckMembership = false)
+  @Transactional
+  Content createUploadedFileWrapped(final String userHash, final StateToken stateToken,
+      final String fileName, final FileItem fileUploadItem, final String typeId) throws Exception {
+    final String relDir = FileUtils.toDir(stateToken);
+    final String absDir = kuneProperties.get(KuneProperties.UPLOAD_LOCATION) + relDir;
+    fileManager.mkdir(absDir);
 
-        File file = null;
-        try {
-            final String filenameUTF8 = new String(fileName.getBytes(), UTF8);
-            file = fileManager.createFileWithSequentialName(absDir, filenameUTF8);
-            fileUploadItem.write(file);
+    File file = null;
+    try {
+      final String filenameUTF8 = new String(fileName.getBytes(), UTF8);
+      file = fileManager.createFileWithSequentialName(absDir, filenameUTF8);
+      fileUploadItem.write(file);
 
-            final String mimetype = fileUploadItem.getContentType();
-            final BasicMimeType basicMimeType = new BasicMimeType(mimetype);
-            LOG.info("Mimetype: " + basicMimeType);
-            final String extension = FileUtils.getFileNameExtension(file.getName(), false);
+      final String mimetype = fileUploadItem.getContentType();
+      final BasicMimeType basicMimeType = new BasicMimeType(mimetype);
+      LOG.info("Mimetype: " + basicMimeType);
+      final String extension = FileUtils.getFileNameExtension(file.getName(), false);
 
-            String preview = "";
+      String preview = "";
 
-            if (basicMimeType.isImage()) {
-                generateThumbs(absDir, file.getName(), extension, false);
-            } else if (basicMimeType.isPdf()) {
-                generateThumbs(absDir, file.getName(), "png", true);
-            } else if (basicMimeType.isText()) {
-                final String textPreview = new String(FileUtils.getBytesFromFile(file));
-                preview = "<pre>" + StringW.wordWrap(textPreview) + "</pre>";
-            }
+      if (basicMimeType.isImage()) {
+        generateThumbs(absDir, file.getName(), extension, false);
+      } else if (basicMimeType.isPdf()) {
+        generateThumbs(absDir, file.getName(), "png", true);
+      } else if (basicMimeType.isText()) {
+        final String textPreview = new String(FileUtils.getBytesFromFile(file));
+        preview = "<pre>" + StringW.wordWrap(textPreview) + "</pre>";
+      }
 
-            // Persist
-            final User user = userSession.getUser();
-            final Container container = accessService.accessToContainer(ContentUtils.parseId(stateToken.getFolder()),
-                    user, AccessRol.Editor);
-            final Content content = contentManager.createContent(
-                    FileUtils.getFileNameWithoutExtension(file.getName(), extension), preview, user, container, typeId);
-            content.setMimeType(basicMimeType);
-            content.setFilename(file.getName());
-            return content;
-        } catch (final Exception e) {
-            if (file != null && file.exists()) {
-                logFileDel(file.delete());
-            }
-            throw e;
-        }
+      // Persist
+      final User user = userSession.getUser();
+      final Container container = accessService.accessToContainer(
+          ContentUtils.parseId(stateToken.getFolder()), user, AccessRol.Editor);
+      final Content content = contentManager.createContent(
+          FileUtils.getFileNameWithoutExtension(file.getName(), extension), preview, user, container,
+          typeId);
+      content.setMimeType(basicMimeType);
+      content.setFilename(file.getName());
+      return content;
+    } catch (final Exception e) {
+      if (file != null && file.exists()) {
+        logFileDel(file.delete());
+      }
+      throw e;
     }
+  }
 
-    private void generateThumbs(final String absDir, final String filename, final String extension, final boolean isPdf) {
-        try {
-            final String fileOrig = absDir + filename;
-            final String withoutExtension = FileUtils.getFileNameWithoutExtension(filename, extension);
-
-            final String resizeName = absDir + withoutExtension + "." + ImageSize.sized + "." + extension;
-            final String thumbName = absDir + withoutExtension + "." + ImageSize.thumb + "." + extension;
-            final String iconName = absDir + withoutExtension + "." + ImageSize.ico + "." + extension;
-            final String previewName = absDir + withoutExtension + "." + extension;
-
-            final int resizeWidth = Integer.parseInt(kuneProperties.get(KuneProperties.IMAGES_RESIZEWIDTH));
-            final int thumbSize = Integer.parseInt(kuneProperties.get(KuneProperties.IMAGES_THUMBSIZE));
-            final int cropSize = Integer.parseInt(kuneProperties.get(KuneProperties.IMAGES_CROPSIZE));
-            final int iconSize = Integer.parseInt(kuneProperties.get(KuneProperties.IMAGES_ICONSIZE));
-
-            ImageUtilsDefault.scaleImageToMax(fileOrig, resizeName, resizeWidth);
-            ImageUtilsDefault.createThumb(fileOrig, thumbName, thumbSize, cropSize);
-            ImageUtilsDefault.createThumb(fileOrig, iconName, iconSize);
-            if (isPdf) {
-                ImageUtilsDefault.createThumbFromPdf(fileOrig, previewName);
-            }
-        } catch (final NumberFormatException e) {
-            LOG.error("Image sizes in kune.properties are not integers", e);
-        } catch (final MagickException e) {
-            LOG.info("Problem generating image thumb for " + filename, e);
-        } catch (final FileNotFoundException e) {
-            LOG.info("Original image not found generating image thumb for " + filename, e);
-        }
-    }
+  private void generateThumbs(final String absDir, final String filename, final String extension,
+      final boolean isPdf) {
+    ImageUtilsDefault.generateThumbs(absDir, filename, extension, isPdf,
+        Integer.parseInt(kuneProperties.get(KuneProperties.IMAGES_RESIZEWIDTH)),
+        Integer.parseInt(kuneProperties.get(KuneProperties.IMAGES_THUMBSIZE)),
+        Integer.parseInt(kuneProperties.get(KuneProperties.IMAGES_CROPSIZE)),
+        Integer.parseInt(kuneProperties.get(KuneProperties.IMAGES_ICONSIZE)));
+  }
 }

Modified: trunk/src/main/java/cc/kune/core/server/manager/file/FileUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/file/FileUtils.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/server/manager/file/FileUtils.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -28,109 +28,113 @@
 
 public class FileUtils {
 
-    public static final String SLASH = File.separator;
+  public static final String SLASH = File.separator;
 
-    /**
-     * Snippet from:
-     * http://www.java-tips.org/java-se-tips/java.io/reading-a-file
-     * -into-a-byte-array.html
-     */
-    public static byte[] getBytesFromFile(final File file) throws IOException {
-        final InputStream iStream = new FileInputStream(file);
+  /**
+   * Snippet from: http://www.java-tips.org/java-se-tips/java.io/reading-a-file
+   * -into-a-byte-array.html
+   */
+  public static byte[] getBytesFromFile(final File file) throws IOException {
+    final InputStream iStream = new FileInputStream(file);
 
-        // Get the size of the file
-        final long length = file.length();
+    // Get the size of the file
+    final long length = file.length();
 
-        if (length > Integer.MAX_VALUE) {
-            // File is too large
-        }
+    if (length > Integer.MAX_VALUE) {
+      // File is too large
+    }
 
-        // Create the byte array to hold the data
-        final byte[] bytes = new byte[(int) length];
+    // Create the byte array to hold the data
+    final byte[] bytes = new byte[(int) length];
 
-        // Read in the bytes
-        int offset = 0;
-        int numRead = 0;
-        while (offset < bytes.length && (numRead = iStream.read(bytes, offset, bytes.length - offset)) >= 0) {
-            offset += numRead;
-        }
-
-        // Ensure all the bytes have been read in
-        if (offset < bytes.length) {
-            throw new IOException("Could not completely read file " + file.getName());
-        }
-
-        // Close the input stream and return bytes
-        iStream.close();
-        return bytes;
+    // Read in the bytes
+    int offset = 0;
+    int numRead = 0;
+    while (offset < bytes.length && (numRead = iStream.read(bytes, offset, bytes.length - offset)) >= 0) {
+      offset += numRead;
     }
 
-    /**
-     * For filename extension info see:
-     * http://en.wikipedia.org/wiki/File_name_extension
-     * 
-     * @param filename
-     * @return
-     */
-    public static String getFileNameExtension(final String filename, final boolean withDot) {
-        // also we can use FilenameUtils
-        if (filename == null) {
-            return "";
-        }
-        final int dotIndex = filename.lastIndexOf('.');
-        if (dotIndex == -1 || dotIndex == 0) {
-            return "";
-        } else {
-            if (withDot) {
-                final String ext = filename.substring(dotIndex);
-                return ext.length() == 1 ? "" : ext;
-            } else {
-                return filename.substring(dotIndex + 1);
-            }
-        }
+    // Ensure all the bytes have been read in
+    if (offset < bytes.length) {
+      throw new IOException("Could not completely read file " + file.getName());
     }
 
-    public static String getFileNameWithoutExtension(final String fileName, final String extension) {
-        final int extlength = extension.length();
-        if (extlength > 0) {
-            final boolean withDot = extension.charAt(0) == '.';
-            return fileName.substring(0, fileName.length() - extlength - (withDot ? 0 : 1));
-        } else {
-            return fileName;
-        }
+    // Close the input stream and return bytes
+    iStream.close();
+    return bytes;
+  }
+
+  /**
+   * For filename extension info see:
+   * http://en.wikipedia.org/wiki/File_name_extension
+   * 
+   * @param filename
+   * @return
+   */
+  public static String getFileNameExtension(final String filename, final boolean withDot) {
+    // also we can use FilenameUtils
+    if (filename == null) {
+      return "";
     }
+    final int dotIndex = filename.lastIndexOf('.');
+    if (dotIndex == -1 || dotIndex == 0) {
+      return "";
+    } else {
+      if (withDot) {
+        final String ext = filename.substring(dotIndex);
+        return ext.length() == 1 ? "" : ext;
+      } else {
+        return filename.substring(dotIndex + 1);
+      }
+    }
+  }
 
-    public static String getNextSequentialFileName(final String fileName) {
-        final int lastSpace = fileName.lastIndexOf(" ");
-        if (lastSpace != -1) {
-            final String suffix = fileName.substring(lastSpace + 1);
-            try {
-                final Integer i = Integer.valueOf(suffix);
-                return fileName.substring(0, lastSpace + 1) + (i + 1);
-            } catch (final NumberFormatException e) {
-            }
-        }
-        return fileName + " 1";
+  public static String getFileNameWithoutExtension(final String fileName, final String extension) {
+    final int extlength = extension.length();
+    if (extlength > 0) {
+      final boolean withDot = extension.charAt(0) == '.';
+      return fileName.substring(0, fileName.length() - extlength - (withDot ? 0 : 1));
+    } else {
+      return fileName;
     }
+  }
 
-    public static String getNextSequentialFileName(final String fileName, final boolean preserveExtension) {
-        if (!preserveExtension) {
-            return getNextSequentialFileName(fileName);
-        }
-        final int dotIndex = fileName.lastIndexOf(".");
-        if (dotIndex == -1 || dotIndex == 0) {
-            return getNextSequentialFileName(fileName);
-        } else {
-            final String ext = fileName.substring(dotIndex);
-            return getNextSequentialFileName(fileName.substring(0, dotIndex)) + ext;
-        }
+  public static String getNextSequentialFileName(final String fileName) {
+    final int lastSpace = fileName.lastIndexOf(" ");
+    if (lastSpace != -1) {
+      final String suffix = fileName.substring(lastSpace + 1);
+      try {
+        final Integer i = Integer.valueOf(suffix);
+        return fileName.substring(0, lastSpace + 1) + (i + 1);
+      } catch (final NumberFormatException e) {
+      }
     }
+    return fileName + " 1";
+  }
 
-    public static String toDir(final StateToken stateToken) {
-        return SLASH + stateToken.getGroup() + SLASH + stateToken.getTool() + SLASH + stateToken.getFolder() + SLASH;
+  public static String getNextSequentialFileName(final String fileName, final boolean preserveExtension) {
+    if (!preserveExtension) {
+      return getNextSequentialFileName(fileName);
     }
+    final int dotIndex = fileName.lastIndexOf(".");
+    if (dotIndex == -1 || dotIndex == 0) {
+      return getNextSequentialFileName(fileName);
+    } else {
+      final String ext = fileName.substring(dotIndex);
+      return getNextSequentialFileName(fileName.substring(0, dotIndex)) + ext;
+    }
+  }
 
-    public boolean exist(final String file) {
-        return new File(file).exists();
-    }
+  public static String groupToDir(final String groupName) {
+    return SLASH + groupName + SLASH;
+  }
+
+  public static String toDir(final StateToken stateToken) {
+    return SLASH + stateToken.getGroup() + SLASH + stateToken.getTool() + SLASH + stateToken.getFolder()
+        + SLASH;
+  }
+
+  public boolean exist(final String file) {
+    return new File(file).exists();
+  }
 }

Modified: trunk/src/main/java/cc/kune/core/server/manager/file/ImageUtilsDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/file/ImageUtilsDefault.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/server/manager/file/ImageUtilsDefault.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -28,173 +28,212 @@
 import magick.MagickException;
 import magick.MagickImage;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import cc.kune.core.client.services.ImageSize;
+
 public class ImageUtilsDefault {
 
-    /**
-     * http://en.wikipedia.org/wiki/Thumbnail
-     * 
-     * @throws FileNotFoundException
-     * 
-     */
-    public static void createThumb(String fileOrig, String fileDest, int cropDimension) throws MagickException,
-            FileNotFoundException {
-        createThumb(fileOrig, fileDest, cropDimension, cropDimension);
-    }
+  public static final Log LOG = LogFactory.getLog(ImageUtilsDefault.class);
 
-    public static void createThumb(String fileOrig, String fileDest, int thumbDimension, int cropDimension)
-            throws MagickException, FileNotFoundException {
-        checkExist(fileOrig);
-        if (thumbDimension < cropDimension) {
-            throw new IndexOutOfBoundsException("Thumb dimension must be bigger than crop dimension");
-        }
-        MagickImage imageOrig = readImage(fileOrig);
-        Dimension origDimension = imageOrig.getDimension();
-        int origHeight = origDimension.height;
-        int origWidth = origDimension.width;
-        Dimension proportionalDim = calculatePropDim(origWidth, origHeight, thumbDimension, true);
-        MagickImage scaled = scaleImage(imageOrig, proportionalDim.width, proportionalDim.height);
-        int x = calculateCenteredCoordinate(proportionalDim.width, cropDimension);
-        int y = calculateCenteredCoordinate(proportionalDim.height, cropDimension);
-        cropImage(scaled, fileDest, x, y, cropDimension, cropDimension);
-    }
+  static int calculateCenteredCoordinate(final int size, final int crop) {
+    final int i = (size - crop) / 2;
+    return i < 0 ? 0 : i;
+  }
 
-    /**
-     * convert -density 300 -quality 100 -resize 720x file.pdf result.png
-     * 
-     * @param pdfFile
-     * @param newPngFile
-     * @return
-     * @throws MagickException
-     */
-    static public boolean createThumbFromPdf(String pdfFile, String newPngFile) throws MagickException {
-        MagickImage pdf = readImage(pdfFile);
-        MagickImage pdf1 = pdf.breakFrames()[0];
-        return writeImage(pdf1, newPngFile);
-    }
+  static Dimension calculatePropDim(final int origWidth, final int origHeight, final int maxSize) {
+    return calculatePropDim(origWidth, origHeight, maxSize, true);
+  }
 
-    public static boolean cropImage(String fileOrig, String fileDest, int x, int y, int width, int height)
-            throws MagickException, FileNotFoundException {
-        Rectangle rectangle = new Rectangle(x, y, width, height);
-        return cropImage(fileOrig, fileDest, rectangle);
+  static Dimension calculatePropDim(final int origWidth, final int origHeight, final int maxSize,
+      final boolean toShortest) {
+    final boolean higher = origHeight > origWidth;
+    final int propHeight = origHeight * maxSize / origWidth;
+    final int propWidth = origWidth * maxSize / origHeight;
+    final double height = toShortest ? (higher ? propHeight : maxSize) : (higher ? maxSize : propHeight);
+    final double width = toShortest ? (!higher ? propWidth : maxSize) : (!higher ? maxSize : propWidth);
+    if ((higher && origHeight <= maxSize) || (!higher && origWidth <= maxSize)) {
+      return new Dimension(origWidth, origHeight);
     }
+    return new Dimension((int) width, (int) height);
+  }
 
-    public static boolean cropImage(String fileOrig, String fileDest, Rectangle rectangle) throws MagickException,
-            FileNotFoundException {
-        checkExist(fileOrig);
-        return cropImage(readImage(fileOrig), fileDest, rectangle);
+  private static void checkExist(final String fileOrig) throws FileNotFoundException {
+    final File file = new File(fileOrig);
+    if (!file.exists()) {
+      throw new FileNotFoundException();
     }
+  }
 
-    public static Dimension getDimension(String file) throws MagickException {
-        MagickImage imageOrig = readImage(file);
-        return imageOrig.getDimension();
-    }
+  private static ImageInfo createEmptyImageInfo() throws MagickException {
+    final ImageInfo imageInfo = new ImageInfo();
+    return imageInfo;
+  }
 
-    /**
-     * FIXME: Not working, returns null always (bug)
-     * 
-     */
-    public static String getPage(String file) throws MagickException {
-        ImageInfo imageInfo = new ImageInfo(file);
-        new MagickImage(imageInfo);
-        return imageInfo.getPage();
-    }
+  private static ImageInfo createEmptyImageInfoWithNoPage() throws MagickException {
+    final ImageInfo imageInfo = createEmptyImageInfo();
+    imageInfo.setPage("0x0+0+0");
+    return imageInfo;
+  }
 
-    public static boolean scaleImage(String fileOrig, String fileDest, Dimension dimension) throws MagickException,
-            FileNotFoundException {
-        checkExist(fileOrig);
-        MagickImage imageOrig = readImage(fileOrig);
-        return scaleImage(imageOrig, fileDest, (int) dimension.getWidth(), (int) dimension.getHeight());
-    }
+  /**
+   * http://en.wikipedia.org/wiki/Thumbnail
+   * 
+   * @throws FileNotFoundException
+   * 
+   */
+  public static void createThumb(final String fileOrig, final String fileDest, final int cropDimension)
+      throws MagickException, FileNotFoundException {
+    createThumb(fileOrig, fileDest, cropDimension, cropDimension);
+  }
 
-    public static boolean scaleImage(String fileOrig, String fileDest, int width, int height) throws MagickException,
-            FileNotFoundException {
-        checkExist(fileOrig);
-        MagickImage imageOrig = readImage(fileOrig);
-        return scaleImage(imageOrig, fileDest, width, height);
+  public static void createThumb(final String fileOrig, final String fileDest, final int thumbDimension,
+      final int cropDimension) throws MagickException, FileNotFoundException {
+    checkExist(fileOrig);
+    if (thumbDimension < cropDimension) {
+      throw new IndexOutOfBoundsException("Thumb dimension must be bigger than crop dimension");
     }
+    final MagickImage imageOrig = readImage(fileOrig);
+    final Dimension origDimension = imageOrig.getDimension();
+    final int origHeight = origDimension.height;
+    final int origWidth = origDimension.width;
+    final Dimension proportionalDim = calculatePropDim(origWidth, origHeight, thumbDimension, true);
+    final MagickImage scaled = scaleImage(imageOrig, proportionalDim.width, proportionalDim.height);
+    final int x = calculateCenteredCoordinate(proportionalDim.width, cropDimension);
+    final int y = calculateCenteredCoordinate(proportionalDim.height, cropDimension);
+    cropImage(scaled, fileDest, x, y, cropDimension, cropDimension);
+  }
 
-    public static boolean scaleImageToMax(String fileOrig, String fileDest, int maxSize) throws MagickException,
-            FileNotFoundException {
-        checkExist(fileOrig);
-        MagickImage imageOrig = readImage(fileOrig);
-        Dimension origDimension = imageOrig.getDimension();
-        int origHeight = origDimension.height;
-        int origWidth = origDimension.width;
-        Dimension proportionalDim = calculatePropDim(origWidth, origHeight, maxSize, false);
-        MagickImage scaled = scaleImage(imageOrig, proportionalDim.width, proportionalDim.height);
+  /**
+   * convert -density 300 -quality 100 -resize 720x file.pdf result.png
+   * 
+   * @param pdfFile
+   * @param newPngFile
+   * @return
+   * @throws MagickException
+   */
+  static public boolean createThumbFromPdf(final String pdfFile, final String newPngFile)
+      throws MagickException {
+    final MagickImage pdf = readImage(pdfFile);
+    final MagickImage pdf1 = pdf.breakFrames()[0];
+    return writeImage(pdf1, newPngFile);
+  }
 
-        return writeImage(scaled, fileDest);
-    }
+  private static boolean cropImage(final MagickImage fileOrig, final String fileDest, final int x,
+      final int y, final int width, final int height) throws MagickException {
+    final Rectangle rectangle = new Rectangle(x, y, width, height);
+    return cropImage(fileOrig, fileDest, rectangle);
+  }
 
-    static int calculateCenteredCoordinate(int size, int crop) {
-        int i = (size - crop) / 2;
-        return i < 0 ? 0 : i;
-    }
+  private static boolean cropImage(final MagickImage fileOrig, final String fileDest,
+      final Rectangle rectangle) throws MagickException {
+    final MagickImage cropped = fileOrig.cropImage(rectangle);
+    cropped.setFileName(fileDest);
+    final ImageInfo imageInfo = createEmptyImageInfoWithNoPage();
+    return cropped.writeImage(imageInfo);
+  }
 
-    static Dimension calculatePropDim(int origWidth, int origHeight, int maxSize) {
-        return calculatePropDim(origWidth, origHeight, maxSize, true);
-    }
+  public static boolean cropImage(final String fileOrig, final String fileDest, final int x,
+      final int y, final int width, final int height) throws MagickException, FileNotFoundException {
+    final Rectangle rectangle = new Rectangle(x, y, width, height);
+    return cropImage(fileOrig, fileDest, rectangle);
+  }
 
-    static Dimension calculatePropDim(int origWidth, int origHeight, int maxSize, boolean toShortest) {
-        boolean higher = origHeight > origWidth;
-        int propHeight = origHeight * maxSize / origWidth;
-        int propWidth = origWidth * maxSize / origHeight;
-        double height = toShortest ? (higher ? propHeight : maxSize) : (higher ? maxSize : propHeight);
-        double width = toShortest ? (!higher ? propWidth : maxSize) : (!higher ? maxSize : propWidth);
-        if ((higher && origHeight <= maxSize) || (!higher && origWidth <= maxSize)) {
-            return new Dimension(origWidth, origHeight);
-        }
-        return new Dimension((int) width, (int) height);
-    }
+  public static boolean cropImage(final String fileOrig, final String fileDest, final Rectangle rectangle)
+      throws MagickException, FileNotFoundException {
+    checkExist(fileOrig);
+    return cropImage(readImage(fileOrig), fileDest, rectangle);
+  }
 
-    private static void checkExist(String fileOrig) throws FileNotFoundException {
-        File file = new File(fileOrig);
-        if (!file.exists()) {
-            throw new FileNotFoundException();
-        }
-    }
+  public static void generateThumbs(final String absDir, final String filename, final String extension,
+      final boolean isPdf, final int resizeWidth, final int thumbSize, final int cropSize,
+      final int iconSize) {
+    try {
+      final String fileOrig = absDir + filename;
+      final String withoutExtension = FileUtils.getFileNameWithoutExtension(filename, extension);
 
-    private static ImageInfo createEmptyImageInfo() throws MagickException {
-        ImageInfo imageInfo = new ImageInfo();
-        return imageInfo;
-    }
+      final String resizeName = absDir + withoutExtension + "." + ImageSize.sized + "." + extension;
+      final String thumbName = absDir + withoutExtension + "." + ImageSize.thumb + "." + extension;
+      final String iconName = absDir + withoutExtension + "." + ImageSize.ico + "." + extension;
+      final String previewName = absDir + withoutExtension + "." + extension;
 
-    private static ImageInfo createEmptyImageInfoWithNoPage() throws MagickException {
-        ImageInfo imageInfo = createEmptyImageInfo();
-        imageInfo.setPage("0x0+0+0");
-        return imageInfo;
+      scaleImageToMax(fileOrig, resizeName, resizeWidth);
+      createThumb(fileOrig, thumbName, thumbSize, cropSize);
+      createThumb(fileOrig, iconName, iconSize);
+      if (isPdf) {
+        createThumbFromPdf(fileOrig, previewName);
+      }
+    } catch (final NumberFormatException e) {
+      LOG.error("Image sizes in kune.properties are not integers", e);
+    } catch (final MagickException e) {
+      LOG.info("Problem generating image thumb for " + filename, e);
+    } catch (final FileNotFoundException e) {
+      LOG.info("Original image not found generating image thumb for " + filename, e);
     }
+  }
 
-    private static boolean cropImage(MagickImage fileOrig, String fileDest, int x, int y, int width, int height)
-            throws MagickException {
-        Rectangle rectangle = new Rectangle(x, y, width, height);
-        return cropImage(fileOrig, fileDest, rectangle);
-    }
+  public static Dimension getDimension(final String file) throws MagickException {
+    final MagickImage imageOrig = readImage(file);
+    return imageOrig.getDimension();
+  }
 
-    private static boolean cropImage(MagickImage fileOrig, String fileDest, Rectangle rectangle) throws MagickException {
-        MagickImage cropped = fileOrig.cropImage(rectangle);
-        cropped.setFileName(fileDest);
-        ImageInfo imageInfo = createEmptyImageInfoWithNoPage();
-        return cropped.writeImage(imageInfo);
-    }
+  /**
+   * FIXME: Not working, returns null always (bug)
+   * 
+   */
+  public static String getPage(final String file) throws MagickException {
+    final ImageInfo imageInfo = new ImageInfo(file);
+    new MagickImage(imageInfo);
+    return imageInfo.getPage();
+  }
 
-    private static MagickImage readImage(String file) throws MagickException {
-        ImageInfo imageInfo = new ImageInfo(file);
-        return new MagickImage(imageInfo);
-    }
+  private static MagickImage readImage(final String file) throws MagickException {
+    final ImageInfo imageInfo = new ImageInfo(file);
+    return new MagickImage(imageInfo);
+  }
 
-    private static MagickImage scaleImage(MagickImage imageOrig, int width, int height) throws MagickException {
-        return imageOrig.scaleImage(width, height);
-    }
+  private static MagickImage scaleImage(final MagickImage imageOrig, final int width, final int height)
+      throws MagickException {
+    return imageOrig.scaleImage(width, height);
+  }
 
-    private static boolean scaleImage(MagickImage imageOrig, String fileDest, int width, int height)
-            throws MagickException {
-        MagickImage imageDest = scaleImage(imageOrig, width, height);
-        return writeImage(imageDest, fileDest);
-    }
+  private static boolean scaleImage(final MagickImage imageOrig, final String fileDest, final int width,
+      final int height) throws MagickException {
+    final MagickImage imageDest = scaleImage(imageOrig, width, height);
+    return writeImage(imageDest, fileDest);
+  }
 
-    private static boolean writeImage(MagickImage imageDest, String fileDest) throws MagickException {
-        imageDest.setFileName(fileDest);
-        return imageDest.writeImage(createEmptyImageInfo());
-    }
+  public static boolean scaleImage(final String fileOrig, final String fileDest,
+      final Dimension dimension) throws MagickException, FileNotFoundException {
+    checkExist(fileOrig);
+    final MagickImage imageOrig = readImage(fileOrig);
+    return scaleImage(imageOrig, fileDest, (int) dimension.getWidth(), (int) dimension.getHeight());
+  }
+
+  public static boolean scaleImage(final String fileOrig, final String fileDest, final int width,
+      final int height) throws MagickException, FileNotFoundException {
+    checkExist(fileOrig);
+    final MagickImage imageOrig = readImage(fileOrig);
+    return scaleImage(imageOrig, fileDest, width, height);
+  }
+
+  public static boolean scaleImageToMax(final String fileOrig, final String fileDest, final int maxSize)
+      throws MagickException, FileNotFoundException {
+    checkExist(fileOrig);
+    final MagickImage imageOrig = readImage(fileOrig);
+    final Dimension origDimension = imageOrig.getDimension();
+    final int origHeight = origDimension.height;
+    final int origWidth = origDimension.width;
+    final Dimension proportionalDim = calculatePropDim(origWidth, origHeight, maxSize, false);
+    final MagickImage scaled = scaleImage(imageOrig, proportionalDim.width, proportionalDim.height);
+
+    return writeImage(scaled, fileDest);
+  }
+
+  private static boolean writeImage(final MagickImage imageDest, final String fileDest)
+      throws MagickException {
+    imageDest.setFileName(fileDest);
+    return imageDest.writeImage(createEmptyImageInfo());
+  }
 }

Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -33,12 +33,13 @@
 import org.hibernate.exception.ConstraintViolationException;
 
 import cc.kune.core.client.errors.AccessViolationException;
-import cc.kune.core.client.errors.DefaultException;
 import cc.kune.core.client.errors.EmailAddressInUseException;
 import cc.kune.core.client.errors.GroupNameInUseException;
 import cc.kune.core.client.errors.UserMustBeLoggedException;
+import cc.kune.core.server.manager.FileManager;
 import cc.kune.core.server.manager.GroupManager;
 import cc.kune.core.server.manager.LicenseManager;
+import cc.kune.core.server.manager.file.FileUtils;
 import cc.kune.core.server.properties.DatabaseProperties;
 import cc.kune.core.server.properties.KuneProperties;
 import cc.kune.core.server.tool.ServerTool;
@@ -66,6 +67,7 @@
 @Singleton
 public class GroupManagerDefault extends DefaultManager<Group, Long> implements GroupManager {
 
+  private final FileManager fileManager;
   private final GroupFinder finder;
   private final I18nTranslationService i18n;
   private final KuneProperties kuneProperties;
@@ -81,7 +83,8 @@
       final UserFinder userFinder, final KuneProperties kuneProperties,
       final DatabaseProperties properties, final ServerToolRegistry registry,
       final LicenseManager licenseManager, final LicenseFinder licenseFinder,
-      final ServerToolRegistry serverToolRegistry, final I18nTranslationService i18n) {
+      final FileManager fileManager, final ServerToolRegistry serverToolRegistry,
+      final I18nTranslationService i18n) {
     super(provider, Group.class);
     this.finder = finder;
     this.userFinder = userFinder;
@@ -90,6 +93,7 @@
     this.registry = registry;
     this.licenseManager = licenseManager;
     this.licenseFinder = licenseFinder;
+    this.fileManager = fileManager;
     this.serverToolRegistry = serverToolRegistry;
     this.i18n = i18n;
   }
@@ -112,7 +116,12 @@
 
   @Override
   public void clearGroupBackImage(final Group group) {
-    group.setGroupBackImage(null);
+    final String file = group.getBackgroundImage();
+    if (file != null) {
+      fileManager.rm(FileUtils.groupToDir(group.getShortName()), file);
+    }
+    group.setBackgroundImage(null);
+    group.setBackgroundMime(null);
   }
 
   @Override
@@ -271,12 +280,11 @@
   }
 
   @Override
-  public void setGroupBackImage(final Group group, final Content content) {
-    if (content.getMimeType().isImage()) {
-      group.setGroupBackImage(content);
-    } else {
-      throw new DefaultException("Trying to set not a image as group logo");
-    }
+  public void setGroupBackgroundImage(final Group group, final String backgroundFileName,
+      final String mime) {
+    clearGroupBackImage(group);
+    group.setBackgroundImage(backgroundFileName);
+    group.setBackgroundMime(mime);
   }
 
   @Override

Modified: trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -26,7 +26,6 @@
 import cc.kune.core.server.auth.Authenticated;
 import cc.kune.core.server.auth.Authorizated;
 import cc.kune.core.server.content.ContentManager;
-import cc.kune.core.server.content.ContentUtils;
 import cc.kune.core.server.manager.GroupManager;
 import cc.kune.core.server.mapper.Mapper;
 import cc.kune.core.shared.domain.AccessRol;
@@ -36,7 +35,6 @@
 import cc.kune.core.shared.dto.GroupDTO;
 import cc.kune.core.shared.dto.LicenseDTO;
 import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.domain.Content;
 import cc.kune.domain.Group;
 import cc.kune.domain.User;
 import cc.kune.wave.server.KuneWaveManagerDefault;
@@ -130,17 +128,6 @@
   }
 
   @Override
-  @Authenticated
-  @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
-  @Transactional
-  public GroupDTO setGroupBackImage(final String userHash, final StateToken token) {
-    final Group group = groupManager.findByShortName(token.getGroup());
-    final Content content = contentManager.find(ContentUtils.parseId(token.getDocument()));
-    groupManager.setGroupBackImage(group, content);
-    return mapper.map(group, GroupDTO.class);
-  }
-
-  @Override
   @Authenticated(mandatory = true)
   @Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
   @Transactional

Modified: trunk/src/main/java/cc/kune/core/shared/dto/GroupDTO.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/dto/GroupDTO.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/core/shared/dto/GroupDTO.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -26,163 +26,163 @@
 
 public class GroupDTO implements IsSerializable {
 
-    AdmissionType admissionType;
-    private ContentSimpleDTO defaultContent;
-    private LicenseDTO defaultLicense;
-    private ContentSimpleDTO groupBackImage;
-    private GroupType groupType;
-    private boolean hasLogo;
-    private Long id;
-    private String longName;
-    private String shortName;
-    private StateToken stateToken;
-    private String workspaceTheme;
+  AdmissionType admissionType;
+  private String backgroundImage;
+  private ContentSimpleDTO defaultContent;
+  private LicenseDTO defaultLicense;
+  private GroupType groupType;
+  private boolean hasLogo;
+  private Long id;
+  private String longName;
+  private String shortName;
+  private StateToken stateToken;
+  private String workspaceTheme;
 
-    public GroupDTO() {
-        this(null, null, GroupType.ORGANIZATION);
-    }
+  public GroupDTO() {
+    this(null, null, GroupType.ORGANIZATION);
+  }
 
-    public GroupDTO(final String shortName, final String longName, final GroupType type) {
-        this.shortName = shortName;
-        this.longName = longName;
-        this.groupType = type;
-    }
+  public GroupDTO(final String shortName, final String longName, final GroupType type) {
+    this.shortName = shortName;
+    this.longName = longName;
+    this.groupType = type;
+  }
 
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final GroupDTO other = (GroupDTO) obj;
-        if (shortName == null) {
-            if (other.shortName != null) {
-                return false;
-            }
-        } else if (!shortName.equals(other.shortName)) {
-            return false;
-        }
-        return true;
+  @Override
+  public boolean equals(final Object obj) {
+    if (this == obj) {
+      return true;
     }
-
-    public AdmissionType getAdmissionType() {
-        return admissionType;
+    if (obj == null) {
+      return false;
     }
-
-    public ContentSimpleDTO getDefaultContent() {
-        return defaultContent;
+    if (getClass() != obj.getClass()) {
+      return false;
     }
-
-    public LicenseDTO getDefaultLicense() {
-        return defaultLicense;
+    final GroupDTO other = (GroupDTO) obj;
+    if (shortName == null) {
+      if (other.shortName != null) {
+        return false;
+      }
+    } else if (!shortName.equals(other.shortName)) {
+      return false;
     }
+    return true;
+  }
 
-    public ContentSimpleDTO getGroupBackImage() {
-        return groupBackImage;
-    }
+  public AdmissionType getAdmissionType() {
+    return admissionType;
+  }
 
-    public GroupType getGroupType() {
-        return groupType;
-    }
+  public String getBackgroundImage() {
+    return backgroundImage;
+  }
 
-    public boolean getHasLogo() {
-        return hasLogo;
-    }
+  public ContentSimpleDTO getDefaultContent() {
+    return defaultContent;
+  }
 
-    public Long getId() {
-        return id;
-    }
+  public LicenseDTO getDefaultLicense() {
+    return defaultLicense;
+  }
 
-    public String getLongName() {
-        return longName;
-    }
+  public GroupType getGroupType() {
+    return groupType;
+  }
 
-    public String getShortName() {
-        return shortName;
-    }
+  public boolean getHasLogo() {
+    return hasLogo;
+  }
 
-    public StateToken getStateToken() {
-        if (stateToken == null) {
-            stateToken = new StateToken(shortName);
-        }
-        return stateToken;
-    }
+  public Long getId() {
+    return id;
+  }
 
-    public String getWorkspaceTheme() {
-        return workspaceTheme;
-    }
+  public String getLongName() {
+    return longName;
+  }
 
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + (defaultLicense == null ? 0 : defaultLicense.hashCode());
-        result = prime * result + (id == null ? 0 : id.hashCode());
-        result = prime * result + (longName == null ? 0 : longName.hashCode());
-        result = prime * result + (shortName == null ? 0 : shortName.hashCode());
-        result = prime * result + (groupType == null ? 0 : groupType.hashCode());
-        return result;
-    }
+  public String getShortName() {
+    return shortName;
+  }
 
-    public boolean hasLogo() {
-        return getHasLogo();
+  public StateToken getStateToken() {
+    if (stateToken == null) {
+      stateToken = new StateToken(shortName);
     }
+    return stateToken;
+  }
 
-    public boolean isNotPersonal() {
-        return !isPersonal();
-    }
+  public String getWorkspaceTheme() {
+    return workspaceTheme;
+  }
 
-    public boolean isPersonal() {
-        return groupType.equals(GroupType.PERSONAL);
-    }
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + (defaultLicense == null ? 0 : defaultLicense.hashCode());
+    result = prime * result + (id == null ? 0 : id.hashCode());
+    result = prime * result + (longName == null ? 0 : longName.hashCode());
+    result = prime * result + (shortName == null ? 0 : shortName.hashCode());
+    result = prime * result + (groupType == null ? 0 : groupType.hashCode());
+    return result;
+  }
 
-    public void setAdmissionType(final AdmissionType admissionType) {
-        this.admissionType = admissionType;
-    }
+  public boolean hasLogo() {
+    return getHasLogo();
+  }
 
-    public void setDefaultContent(final ContentSimpleDTO defaultContent) {
-        this.defaultContent = defaultContent;
-    }
+  public boolean isNotPersonal() {
+    return !isPersonal();
+  }
 
-    public void setDefaultLicense(final LicenseDTO defaultLicense) {
-        this.defaultLicense = defaultLicense;
-    }
+  public boolean isPersonal() {
+    return groupType.equals(GroupType.PERSONAL);
+  }
 
-    public void setGroupBackImage(final ContentSimpleDTO groupBackImage) {
-        this.groupBackImage = groupBackImage;
-    }
+  public void setAdmissionType(final AdmissionType admissionType) {
+    this.admissionType = admissionType;
+  }
 
-    public void setGroupType(final GroupType groupType) {
-        this.groupType = groupType;
-    }
+  public void setBackgroundImage(final String backgroundImage) {
+    this.backgroundImage = backgroundImage;
+  }
 
-    public void setHasLogo(final boolean hasLogo) {
-        this.hasLogo = hasLogo;
-    }
+  public void setDefaultContent(final ContentSimpleDTO defaultContent) {
+    this.defaultContent = defaultContent;
+  }
 
-    public void setId(final Long id) {
-        this.id = id;
-    }
+  public void setDefaultLicense(final LicenseDTO defaultLicense) {
+    this.defaultLicense = defaultLicense;
+  }
 
-    public void setLongName(final String name) {
-        this.longName = name;
-    }
+  public void setGroupType(final GroupType groupType) {
+    this.groupType = groupType;
+  }
 
-    public void setShortName(final String shortName) {
-        this.shortName = shortName;
-    }
+  public void setHasLogo(final boolean hasLogo) {
+    this.hasLogo = hasLogo;
+  }
 
-    public void setWorkspaceTheme(final String workspaceTheme) {
-        this.workspaceTheme = workspaceTheme;
-    }
+  public void setId(final Long id) {
+    this.id = id;
+  }
 
-    @Override
-    public String toString() {
-        return "GroupDTO[" + shortName + "]";
-    }
+  public void setLongName(final String name) {
+    this.longName = name;
+  }
+
+  public void setShortName(final String shortName) {
+    this.shortName = shortName;
+  }
+
+  public void setWorkspaceTheme(final String workspaceTheme) {
+    this.workspaceTheme = workspaceTheme;
+  }
+
+  @Override
+  public String toString() {
+    return "GroupDTO[" + shortName + "]";
+  }
 }

Modified: trunk/src/main/java/cc/kune/domain/Group.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/Group.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/domain/Group.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -55,258 +55,268 @@
 @Table(name = "groups")
 public class Group implements HasId {
 
-    // see: http://docs.codehaus.org/display/PICO/Good+Citizen:
-    // Never expect or return null
-    public static final Group NO_GROUP = null;
-    // public static final String PROPS_ID = "groupprops";
+  // see: http://docs.codehaus.org/display/PICO/Good+Citizen:
+  // Never expect or return null
+  public static final Group NO_GROUP = null;
+  // public static final String PROPS_ID = "groupprops";
 
-    @Enumerated(EnumType.STRING)
-    @Column(nullable = false)
-    AdmissionType admissionType;
+  @Enumerated(EnumType.STRING)
+  @Column(nullable = false)
+  AdmissionType admissionType;
 
-    @Basic(optional = false)
-    private final Long createdOn;
+  private String backgroundImage;
 
-    @OneToOne
-    private Content defaultContent;
+  private String backgroundMime;
 
-    @OneToOne
-    private License defaultLicense;
+  @Basic(optional = false)
+  private final Long createdOn;
 
-    @OneToOne
-    private Content groupBackImage;
+  @OneToOne
+  private Content defaultContent;
 
-    @Enumerated(EnumType.STRING)
-    @Column(nullable = false)
-    GroupType groupType;
+  @OneToOne
+  private License defaultLicense;
 
-    @Id
-    @DocumentId
-    @GeneratedValue
-    private Long id;
+  @Enumerated(EnumType.STRING)
+  @Column(nullable = false)
+  GroupType groupType;
 
-    @Lob
-    private byte[] logo;
+  @Id
+  @DocumentId
+  @GeneratedValue
+  private Long id;
 
-    @Embedded
-    private BasicMimeType logoMime;
+  @Lob
+  private byte[] logo;
 
-    @Field(index = Index.TOKENIZED, store = Store.NO)
-    @Column(unique = true)
-    @Length(min = 3, max = 50, message = "The longName must be between 3 and 50 characters of length")
-    private String longName;
+  @Embedded
+  private BasicMimeType logoMime;
 
-    @Field(index = Index.UN_TOKENIZED, store = Store.NO)
-    @Column(unique = true)
-    @Length(min = 3, max = 15, message = "The shortname must be between 3 and 15 characters of length")
-    @Pattern(regex = "^[a-z0-9]+$", message = "The name must be between 3 and 15 lowercase characters. It can only contain Western characters, numbers, and dashes")
-    private String shortName;
+  @Field(index = Index.TOKENIZED, store = Store.NO)
+  @Column(unique = true)
+  @Length(min = 3, max = 50, message = "The longName must be between 3 and 50 characters of length")
+  private String longName;
 
-    @OneToOne(cascade = CascadeType.ALL)
-    private SocialNetwork socialNetwork;
+  @Field(index = Index.UN_TOKENIZED, store = Store.NO)
+  @Column(unique = true)
+  @Length(min = 3, max = 15, message = "The shortname must be between 3 and 15 characters of length")
+  @Pattern(regex = "^[a-z0-9]+$", message = "The name must be between 3 and 15 lowercase characters. It can only contain Western characters, numbers, and dashes")
+  private String shortName;
 
-    @OneToMany
-    private final Map<String, ToolConfiguration> toolsConfig;
+  @OneToOne(cascade = CascadeType.ALL)
+  private SocialNetwork socialNetwork;
 
-    private String workspaceTheme;
+  @OneToMany
+  private final Map<String, ToolConfiguration> toolsConfig;
 
-    public Group() {
-        this(null, null, null, null);
-    }
+  private String workspaceTheme;
 
-    public Group(final String shortName, final String longName) {
-        this(shortName, longName, null, GroupType.PROJECT);
-    }
+  public Group() {
+    this(null, null, null, null);
+  }
 
-    public Group(final String shortName, final String longName, final License defaultLicense, final GroupType type) {
-        this.shortName = shortName;
-        this.longName = longName;
-        this.toolsConfig = new HashMap<String, ToolConfiguration>();
-        this.socialNetwork = new SocialNetwork();
-        this.defaultLicense = defaultLicense;
-        this.groupType = type;
-        this.admissionType = AdmissionType.Moderated;
-        this.createdOn = System.currentTimeMillis();
-    }
+  public Group(final String shortName, final String longName) {
+    this(shortName, longName, null, GroupType.PROJECT);
+  }
 
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final Group other = (Group) obj;
-        if (shortName == null) {
-            if (other.shortName != null) {
-                return false;
-            }
-        } else if (!shortName.equals(other.shortName)) {
-            return false;
-        }
-        return true;
-    }
+  public Group(final String shortName, final String longName, final License defaultLicense,
+      final GroupType type) {
+    this.shortName = shortName;
+    this.longName = longName;
+    this.toolsConfig = new HashMap<String, ToolConfiguration>();
+    this.socialNetwork = new SocialNetwork();
+    this.defaultLicense = defaultLicense;
+    this.groupType = type;
+    this.admissionType = AdmissionType.Moderated;
+    this.createdOn = System.currentTimeMillis();
+  }
 
-    public boolean existToolConfig(final String toolName) {
-        return toolsConfig.get(toolName) != null;
+  @Override
+  public boolean equals(final Object obj) {
+    if (this == obj) {
+      return true;
     }
-
-    @Transient
-    public AccessLists getAccessLists() {
-        return getSocialNetwork().getAccessLists();
+    if (obj == null) {
+      return false;
     }
-
-    public AdmissionType getAdmissionType() {
-        return admissionType;
+    if (getClass() != obj.getClass()) {
+      return false;
     }
-
-    public Long getCreatedOn() {
-        return createdOn;
+    final Group other = (Group) obj;
+    if (shortName == null) {
+      if (other.shortName != null) {
+        return false;
+      }
+    } else if (!shortName.equals(other.shortName)) {
+      return false;
     }
+    return true;
+  }
 
-    public Content getDefaultContent() {
-        return defaultContent;
-    }
+  public boolean existToolConfig(final String toolName) {
+    return toolsConfig.get(toolName) != null;
+  }
 
-    public License getDefaultLicense() {
-        return defaultLicense;
-    }
+  @Transient
+  public AccessLists getAccessLists() {
+    return getSocialNetwork().getAccessLists();
+  }
 
-    public Content getGroupBackImage() {
-        return groupBackImage;
-    }
+  public AdmissionType getAdmissionType() {
+    return admissionType;
+  }
 
-    public GroupType getGroupType() {
-        return groupType;
-    }
+  public String getBackgroundImage() {
+    return backgroundImage;
+  }
 
-    public boolean getHasLogo() {
-        return hasLogo();
-    }
+  public String getBackgroundMime() {
+    return backgroundMime;
+  }
 
-    @Override
-    public Long getId() {
-        return id;
-    }
+  public Long getCreatedOn() {
+    return createdOn;
+  }
 
-    public byte[] getLogo() {
-        return logo;
-    }
+  public Content getDefaultContent() {
+    return defaultContent;
+  }
 
-    public BasicMimeType getLogoMime() {
-        return logoMime;
-    }
+  public License getDefaultLicense() {
+    return defaultLicense;
+  }
 
-    public String getLongName() {
-        return longName;
-    }
+  public GroupType getGroupType() {
+    return groupType;
+  }
 
-    public Container getRoot(final String toolName) {
-        return toolsConfig.get(toolName).getRoot();
-    }
+  public boolean getHasLogo() {
+    return hasLogo();
+  }
 
-    public String getShortName() {
-        return shortName;
-    }
+  @Override
+  public Long getId() {
+    return id;
+  }
 
-    public SocialNetwork getSocialNetwork() {
-        return socialNetwork;
-    }
+  public byte[] getLogo() {
+    return logo;
+  }
 
-    @Transient
-    public StateToken getStateToken() {
-        return new StateToken(shortName);
-    }
+  public BasicMimeType getLogoMime() {
+    return logoMime;
+  }
 
-    public ToolConfiguration getToolConfiguration(final String name) {
-        return toolsConfig.get(name);
-    }
+  public String getLongName() {
+    return longName;
+  }
 
-    public Map<String, ToolConfiguration> getToolsConfig() {
-        return toolsConfig;
-    }
+  public Container getRoot(final String toolName) {
+    return toolsConfig.get(toolName).getRoot();
+  }
 
-    public String getWorkspaceTheme() {
-        return workspaceTheme;
-    }
+  public String getShortName() {
+    return shortName;
+  }
 
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + (shortName == null ? 0 : shortName.hashCode());
-        return result;
-    }
+  public SocialNetwork getSocialNetwork() {
+    return socialNetwork;
+  }
 
-    @Transient
-    public boolean hasLogo() {
-        return (logo != null && logo.length > 0 && logoMime != null);
-    }
+  @Transient
+  public StateToken getStateToken() {
+    return new StateToken(shortName);
+  }
 
-    public boolean isPersonal() {
-        return getGroupType().equals(GroupType.PERSONAL);
-    }
+  public ToolConfiguration getToolConfiguration(final String name) {
+    return toolsConfig.get(name);
+  }
 
-    public void setAdmissionType(final AdmissionType admissionType) {
-        this.admissionType = admissionType;
-    }
+  public Map<String, ToolConfiguration> getToolsConfig() {
+    return toolsConfig;
+  }
 
-    public void setDefaultContent(final Content defaultContent) {
-        this.defaultContent = defaultContent;
-    }
+  public String getWorkspaceTheme() {
+    return workspaceTheme;
+  }
 
-    public void setDefaultLicense(final License defaultLicense) {
-        this.defaultLicense = defaultLicense;
-    }
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + (shortName == null ? 0 : shortName.hashCode());
+    return result;
+  }
 
-    public void setGroupBackImage(final Content groupBackImage) {
-        this.groupBackImage = groupBackImage;
-    }
+  @Transient
+  public boolean hasLogo() {
+    return (logo != null && logo.length > 0 && logoMime != null);
+  }
 
-    public void setGroupType(final GroupType groupType) {
-        this.groupType = groupType;
-    }
+  public boolean isPersonal() {
+    return getGroupType().equals(GroupType.PERSONAL);
+  }
 
-    @Override
-    public void setId(final Long id) {
-        this.id = id;
-    }
+  public void setAdmissionType(final AdmissionType admissionType) {
+    this.admissionType = admissionType;
+  }
 
-    public void setLogo(final byte[] logo) {
-        this.logo = logo;
-    }
+  public void setBackgroundImage(final String backgroundImage) {
+    this.backgroundImage = backgroundImage;
+  }
 
-    public void setLogoMime(final BasicMimeType logoMime) {
-        this.logoMime = logoMime;
-    }
+  public void setBackgroundMime(final String backgroundMime) {
+    this.backgroundMime = backgroundMime;
+  }
 
-    public void setLongName(final String longName) {
-        this.longName = longName;
-    }
+  public void setDefaultContent(final Content defaultContent) {
+    this.defaultContent = defaultContent;
+  }
 
-    public void setShortName(final String shortName) {
-        this.shortName = shortName;
-    }
+  public void setDefaultLicense(final License defaultLicense) {
+    this.defaultLicense = defaultLicense;
+  }
 
-    public void setSocialNetwork(final SocialNetwork socialNetwork) {
-        this.socialNetwork = socialNetwork;
-    }
+  public void setGroupType(final GroupType groupType) {
+    this.groupType = groupType;
+  }
 
-    public ToolConfiguration setToolConfig(final String name, final ToolConfiguration config) {
-        toolsConfig.put(name, config);
-        return config;
-    }
+  @Override
+  public void setId(final Long id) {
+    this.id = id;
+  }
 
-    public void setWorkspaceTheme(final String workspaceTheme) {
-        this.workspaceTheme = workspaceTheme;
-    }
+  public void setLogo(final byte[] logo) {
+    this.logo = logo;
+  }
 
-    @Override
-    public String toString() {
-        return "Group[" + shortName + "]";
-    }
+  public void setLogoMime(final BasicMimeType logoMime) {
+    this.logoMime = logoMime;
+  }
+
+  public void setLongName(final String longName) {
+    this.longName = longName;
+  }
+
+  public void setShortName(final String shortName) {
+    this.shortName = shortName;
+  }
+
+  public void setSocialNetwork(final SocialNetwork socialNetwork) {
+    this.socialNetwork = socialNetwork;
+  }
+
+  public ToolConfiguration setToolConfig(final String name, final ToolConfiguration config) {
+    toolsConfig.put(name, config);
+    return config;
+  }
+
+  public void setWorkspaceTheme(final String workspaceTheme) {
+    this.workspaceTheme = workspaceTheme;
+  }
+
+  @Override
+  public String toString() {
+    return "Group[" + shortName + "]";
+  }
 }
\ No newline at end of file

Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -26,6 +26,8 @@
 
 public interface GSpaceArmor {
 
+  void clearBackImage();
+
   ForIsWidget getDocContainer();
 
   ForIsWidget getDocFooter();
@@ -64,5 +66,7 @@
 
   void selectUserSpace();
 
+  void setBackImage(String url);
+
   void setContentVisible(boolean visible);
 }
\ No newline at end of file

Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -19,6 +19,8 @@
  */
 package cc.kune.gspace.client;
 
+import org.cobogw.gwt.user.client.CSS;
+
 import cc.kune.common.client.actions.ui.ActionFlowPanel;
 import cc.kune.common.client.actions.ui.IsActionExtensible;
 
@@ -96,7 +98,6 @@
   public GSpaceArmorImpl(final Provider<ActionFlowPanel> toolbarProv) {
     initWidget(uiBinder.createAndBindUi(this));
     groupSpace.setWidgetMinSize(splitEast, 150);
-    tabs.setStyleName("k-spaces");
     homeSpace.add(RootPanel.get("k-home-wrapper"));
     DOM.setStyleAttribute((Element) groupSpace.getWidgetContainerElement(splitEast), "overflow",
         "visible");
@@ -110,9 +111,15 @@
     getDocFooter().add(footerToolbar);
     entityToolsNorth.getElement().getStyle().setPosition(Position.RELATIVE);
     // entityToolsSouth.setVisible(false);
+    mainpanel.getWidgetContainerElement(tabs).addClassName("k-spaces");
   }
 
   @Override
+  public void clearBackImage() {
+    DOM.setStyleAttribute(mainpanel.getElement(), CSS.A.BACKGROUND, "transparent");
+  }
+
+  @Override
   public ForIsWidget getDocContainer() {
     return docContainer;
   }
@@ -208,6 +215,12 @@
   }
 
   @Override
+  public void setBackImage(final String url) {
+    final String bodyProp = "#FFFFFF url('" + url + "') fixed no-repeat top left";
+    DOM.setStyleAttribute(mainpanel.getElement(), CSS.A.BACKGROUND, bodyProp);
+  }
+
+  @Override
   public void setContentVisible(final boolean visible) {
     // NotifyUser.info("Visible: " + visible);
     // docContainer.getElement().getStyle().setOpacity(visible ? 1d : .0d);

Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.ui.xml	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.ui.xml	2011-06-21 20:03:39 UTC (rev 1412)
@@ -22,12 +22,12 @@
         barUnit='PX' barHeight='0' ui:field="tabs">
         <g:tab>
           <g:header size='0' />
-          <g:SimplePanel ui:field="homeSpace" width="100%"
+          <g:SimplePanel styleName="k-space" ui:field="homeSpace" width="100%"
             height="100%"></g:SimplePanel>
         </g:tab>
         <g:tab>
           <g:header size='0' />
-          <g:FlowPanel ui:field="userSpace" width="100%"
+          <g:FlowPanel ui:field="userSpace" styleName="k-space" width="100%"
             height="100%">
             <!-- <g:Frame url="/" styleName="{style.frame}" -->
             <!-- ui:field="frame" width="100%" height="100%" /> -->
@@ -35,7 +35,7 @@
         </g:tab>
         <g:tab>
           <g:header size='0' />
-          <g:SplitLayoutPanel width="100%" height="100%"
+          <g:SplitLayoutPanel width="100%" height="100%" styleName="k-space"
             ui:field="groupSpace">
             <g:center size="1.0">
               <g:DockLayoutPanel unit="PX" ui:field="splitCenter">
@@ -109,7 +109,7 @@
         </g:tab>
         <g:tab>
           <g:header size='0' />
-          <g:SimplePanel ui:field="publicSpace" width="100%"
+          <g:SimplePanel ui:field="publicSpace" width="100%" styleName="k-space"
             height="100%"></g:SimplePanel>
         </g:tab>
       </g:TabLayoutPanel>

Modified: trunk/src/main/java/cc/kune/gspace/client/options/logo/CurrentLogoChangedEvent.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/logo/CurrentLogoChangedEvent.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/options/logo/CurrentLogoChangedEvent.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -26,49 +26,49 @@
 
 public class CurrentLogoChangedEvent extends GwtEvent<CurrentLogoChangedEvent.CurrentLogoChangedHandler> {
 
-    public interface CurrentLogoChangedHandler extends EventHandler {
-        public void onCurrentLogoChanged(CurrentLogoChangedEvent event);
-    }
+  public interface CurrentLogoChangedHandler extends EventHandler {
+    public void onCurrentLogoChanged(CurrentLogoChangedEvent event);
+  }
 
-    public interface HasCurrentLogoChangedHandlers extends HasHandlers {
-        HandlerRegistration addCurrentLogoChangedHandler(CurrentLogoChangedHandler handler);
-    }
+  public interface HasCurrentLogoChangedHandlers extends HasHandlers {
+    HandlerRegistration addCurrentLogoChangedHandler(CurrentLogoChangedHandler handler);
+  }
 
-    private static final Type<CurrentLogoChangedHandler> TYPE = new Type<CurrentLogoChangedHandler>();
+  private static final Type<CurrentLogoChangedHandler> TYPE = new Type<CurrentLogoChangedHandler>();
 
-    public static void fire(final HasHandlers source) {
-        source.fireEvent(new CurrentLogoChangedEvent());
-    }
+  public static void fire(final HasHandlers source) {
+    source.fireEvent(new CurrentLogoChangedEvent());
+  }
 
-    public static Type<CurrentLogoChangedHandler> getType() {
-        return TYPE;
-    }
+  public static Type<CurrentLogoChangedHandler> getType() {
+    return TYPE;
+  }
 
-    public CurrentLogoChangedEvent() {
-    }
+  public CurrentLogoChangedEvent() {
+  }
 
-    @Override
-    protected void dispatch(final CurrentLogoChangedHandler handler) {
-        handler.onCurrentLogoChanged(this);
-    }
+  @Override
+  protected void dispatch(final CurrentLogoChangedHandler handler) {
+    handler.onCurrentLogoChanged(this);
+  }
 
-    @Override
-    public boolean equals(final Object obj) {
-        return super.equals(obj);
-    }
+  @Override
+  public boolean equals(final Object obj) {
+    return super.equals(obj);
+  }
 
-    @Override
-    public Type<CurrentLogoChangedHandler> getAssociatedType() {
-        return TYPE;
-    }
+  @Override
+  public Type<CurrentLogoChangedHandler> getAssociatedType() {
+    return TYPE;
+  }
 
-    @Override
-    public int hashCode() {
-        return super.hashCode();
-    }
+  @Override
+  public int hashCode() {
+    return super.hashCode();
+  }
 
-    @Override
-    public String toString() {
-        return "CurrentLogoChangedEvent[" + "]";
-    }
+  @Override
+  public String toString() {
+    return "CurrentLogoChangedEvent[" + "]";
+  }
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsLogoPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsLogoPanel.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsLogoPanel.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -19,12 +19,10 @@
  \*/
 package cc.kune.gspace.client.options.logo;
 
-import gwtupload.client.IFileInput.FileInputType;
 import gwtupload.client.IUploader.OnCancelUploaderHandler;
 import gwtupload.client.IUploader.OnChangeUploaderHandler;
 import gwtupload.client.IUploader.OnFinishUploaderHandler;
 import gwtupload.client.IUploader.OnStartUploaderHandler;
-import gwtupload.client.MultiUploader;
 import cc.kune.common.client.ui.IconLabel;
 import cc.kune.common.client.utils.OnAcceptCallback;
 import cc.kune.core.client.resources.CoreMessages;
@@ -33,46 +31,17 @@
 import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.options.EntityOptionsView;
 
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.HasClickHandlers;
 import com.google.gwt.event.shared.EventBus;
 import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.ui.Button;
 import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.DecoratorPanel;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Hidden;
 import com.google.gwt.user.client.ui.IsWidget;
-import com.google.gwt.user.client.ui.Label;
 
 public class EntityOptionsLogoPanel extends Composite implements EntityOptionsLogoView {
 
-  public class UploadButton extends Composite implements HasClickHandlers {
-    DecoratorPanel widget = new DecoratorPanel();
-
-    public UploadButton() {
-      final DecoratorPanel widget = new DecoratorPanel();
-      final Button btn = new Button(i18n.t("Choose"));
-      btn.addStyleName("k-button");
-      initWidget(widget);
-      widget.setWidget(btn);
-      widget.setHeight("50px");
-    }
-
-    @Override
-    public HandlerRegistration addClickHandler(final ClickHandler handler) {
-      return addDomHandler(handler, ClickEvent.getType());
-    }
-  }
-
   public static final String ICON_UPLD_SERVLET = "servlets/EntityLogoUploadManager";
-  private final Label dialogInfoLabel;
+  private final EntityUploaderForm uploader;
   private final I18nTranslationService i18n;
   private final IconLabel tabTitle;
-  private final Hidden tokenField;
-  private final MultiUploader uploader;
-  private final Hidden userhashField;
 
   public EntityOptionsLogoPanel(final EventBus eventBus, final I18nTranslationService i18n,
       final String panelId, final String buttonId, final String inputId, final NavResources res) {
@@ -80,29 +49,11 @@
     this.i18n = i18n;
     tabTitle = new IconLabel(res.picture(), "");
 
-    final UploadButton btn = new UploadButton();
-    uploader = new MultiUploader(FileInputType.CUSTOM.with(btn));
-    uploader.setServletPath(ICON_UPLD_SERVLET);
-    uploader.setMaximumFiles(1);
-    dialogInfoLabel = new Label();
-    dialogInfoLabel.setWordWrap(true);
-    dialogInfoLabel.addStyleName("kune-Margin-20-tb");
-    uploader.setValidExtensions("png", "jpg", "gif", "jpeg", "bmp");
+    uploader = new EntityUploaderForm(ICON_UPLD_SERVLET, i18n.t("Choose"));
 
-    userhashField = new Hidden(FileConstants.HASH, FileConstants.HASH);
-    tokenField = new Hidden(FileConstants.TOKEN, FileConstants.TOKEN);
-
-    final FlowPanel holder = new FlowPanel();
-
-    uploader.add(userhashField);
-    uploader.add(tokenField);
-    holder.add(dialogInfoLabel);
-    holder.add(uploader);
-
-    initWidget(holder);
+    initWidget(uploader);
     setHeight(String.valueOf(EntityOptionsView.HEIGHT) + "px");
     setWidth(String.valueOf(EntityOptionsView.WIDTH) + "px");
-    // uploader.setHeight("100px");
 
     addStyleName("k-overflow-y-auto");
     addStyleName("k-tab-panel");
@@ -144,7 +95,7 @@
 
   @Override
   public void setNormalGroupsLabels() {
-    dialogInfoLabel.setText(i18n.t("Select an image in your computer as the logo for this group. "
+    uploader.setLabelText(i18n.t("Select an image in your computer as the logo for this group. "
         + "For best results use a [%d]x[%d] pixel image. We will automatically resize bigger images.",
         FileConstants.LOGO_DEF_HEIGHT, FileConstants.LOGO_DEF_HEIGHT));
     tabTitle.setText(CoreMessages.ENT_LOGO_SELECTOR_NORMAL_TITLE);
@@ -152,7 +103,7 @@
 
   @Override
   public void setPersonalGroupsLabels() {
-    dialogInfoLabel.setText(i18n.t("Select an image in your computer as your avatar. "
+    uploader.setLabelText(i18n.t("Select an image in your computer as your avatar. "
         + "For best results use a [%d]x[%d] pixel image. We will automatically resize bigger images.",
         FileConstants.LOGO_DEF_HEIGHT, FileConstants.LOGO_DEF_HEIGHT));
     tabTitle.setText(CoreMessages.ENT_LOGO_SELECTOR_PERSON_TITLE);
@@ -160,8 +111,7 @@
 
   @Override
   public void setUploadParams(final String userHash, final String token) {
-    userhashField.setValue(userHash);
-    tokenField.setValue(token);
+    uploader.setUploadParams(userHash, token);
   }
 
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsLogoPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsLogoPresenter.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsLogoPresenter.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -26,7 +26,7 @@
 import cc.kune.common.client.notify.NotifyUser;
 import cc.kune.core.client.rpcservices.UserServiceAsync;
 import cc.kune.core.client.state.Session;
-import cc.kune.core.client.ws.entheader.EntityHeader;
+import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.options.EntityOptions;
 
 import com.google.gwt.event.shared.EventBus;
@@ -34,21 +34,21 @@
 import com.google.inject.Provider;
 
 public abstract class EntityOptionsLogoPresenter implements GroupOptionsLogo, UserOptionsLogo {
-  private final EntityHeader entityLogo;
   private final EntityOptions entityOptions;
   protected final EventBus eventBus;
+  private final I18nTranslationService i18n;
   protected final Session session;
   protected final Provider<UserServiceAsync> userService;
   protected EntityOptionsLogoView view;
 
   public EntityOptionsLogoPresenter(final EventBus eventBus, final Session session,
-      final EntityHeader entityLogo, final EntityOptions entityOptions,
-      final Provider<UserServiceAsync> userService) {
+      final EntityOptions entityOptions, final Provider<UserServiceAsync> userService,
+      final I18nTranslationService i18n) {
     this.eventBus = eventBus;
     this.session = session;
-    this.entityLogo = entityLogo;
     this.entityOptions = entityOptions;
     this.userService = userService;
+    this.i18n = i18n;
   }
 
   public IsWidget getView() {
@@ -66,7 +66,6 @@
       }
     });
     view.addOnFinishUploadHandler(new OnFinishUploaderHandler() {
-
       @Override
       public void onFinish(final IUploader uploader) {
         onSubmitComplete(uploader);
@@ -87,7 +86,7 @@
   }
 
   public void onSubmitFailed(final String responseText) {
-    NotifyUser.error("Error setting the logo: " + responseText);
+    NotifyUser.error(i18n.t("Error setting the logo", responseText));
   }
 
   protected abstract void setState();

Added: trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsUploadButton.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsUploadButton.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsUploadButton.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -0,0 +1,27 @@
+package cc.kune.gspace.client.options.logo;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DecoratorPanel;
+
+public class EntityOptionsUploadButton extends Composite implements HasClickHandlers {
+  DecoratorPanel widget = new DecoratorPanel();
+
+  public EntityOptionsUploadButton(final String text) {
+    final DecoratorPanel widget = new DecoratorPanel();
+    final Button btn = new Button(text);
+    btn.addStyleName("k-button");
+    initWidget(widget);
+    widget.setWidget(btn);
+    widget.setHeight("50px");
+  }
+
+  @Override
+  public HandlerRegistration addClickHandler(final ClickHandler handler) {
+    return addDomHandler(handler, ClickEvent.getType());
+  }
+}
\ No newline at end of file


Property changes on: trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsUploadButton.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityUploaderForm.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityUploaderForm.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityUploaderForm.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -0,0 +1,75 @@
+package cc.kune.gspace.client.options.logo;
+
+import gwtupload.client.IFileInput.FileInputType;
+import gwtupload.client.IUploader.OnCancelUploaderHandler;
+import gwtupload.client.IUploader.OnChangeUploaderHandler;
+import gwtupload.client.IUploader.OnFinishUploaderHandler;
+import gwtupload.client.IUploader.OnStartUploaderHandler;
+import gwtupload.client.MultiUploader;
+import cc.kune.core.client.services.FileConstants;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.Hidden;
+import com.google.gwt.user.client.ui.Label;
+
+public class EntityUploaderForm extends Composite {
+
+  private final Label dialogInfoLabel;
+  private final Hidden tokenField;
+  private final MultiUploader uploader;
+  private final Hidden userhashField;
+
+  public EntityUploaderForm(final String servlet, final String btnText) {
+    final EntityOptionsUploadButton btn = new EntityOptionsUploadButton(btnText);
+    uploader = new MultiUploader(FileInputType.CUSTOM.with(btn));
+    uploader.setServletPath(servlet);
+    uploader.setMaximumFiles(1);
+    dialogInfoLabel = new Label();
+    dialogInfoLabel.setWordWrap(true);
+    dialogInfoLabel.addStyleName("kune-Margin-20-tb");
+    uploader.setValidExtensions("png", "jpg", "gif", "jpeg", "bmp");
+
+    userhashField = new Hidden(FileConstants.HASH, FileConstants.HASH);
+    tokenField = new Hidden(FileConstants.TOKEN, FileConstants.TOKEN);
+
+    final FlowPanel holder = new FlowPanel();
+
+    uploader.add(userhashField);
+    uploader.add(tokenField);
+    holder.add(dialogInfoLabel);
+    holder.add(uploader);
+    initWidget(holder);
+  }
+
+  public HandlerRegistration addOnCancelUploadHandler(final OnCancelUploaderHandler handler) {
+    return uploader.addOnCancelUploadHandler(handler);
+  }
+
+  public HandlerRegistration addOnChangeUploadHandler(final OnChangeUploaderHandler handler) {
+    return uploader.addOnChangeUploadHandler(handler);
+  }
+
+  public HandlerRegistration addOnFinishUploadHandler(final OnFinishUploaderHandler handler) {
+    return uploader.addOnFinishUploadHandler(handler);
+  }
+
+  public HandlerRegistration addOnStartUploadHandler(final OnStartUploaderHandler handler) {
+    return uploader.addOnStartUploadHandler(handler);
+  }
+
+  public void reset() {
+    uploader.reset();
+  }
+
+  public void setLabelText(final String text) {
+    dialogInfoLabel.setText(text);
+  }
+
+  public void setUploadParams(final String userHash, final String token) {
+    userhashField.setValue(userHash);
+    tokenField.setValue(token);
+  }
+
+}


Property changes on: trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityUploaderForm.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/src/main/java/cc/kune/gspace/client/options/logo/GroupOptionsLogoPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/logo/GroupOptionsLogoPresenter.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/options/logo/GroupOptionsLogoPresenter.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -24,7 +24,7 @@
 import cc.kune.core.client.state.GroupChangedEvent.GroupChangedHandler;
 import cc.kune.core.client.state.Session;
 import cc.kune.core.client.state.StateManager;
-import cc.kune.core.client.ws.entheader.EntityHeader;
+import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.options.GroupOptions;
 
 import com.google.gwt.event.shared.EventBus;
@@ -35,9 +35,10 @@
 
   @Inject
   public GroupOptionsLogoPresenter(final EventBus eventBus, final Session session,
-      final EntityHeader entityLogo, final GroupOptions entityOptions, final StateManager stateManager,
-      final Provider<UserServiceAsync> userService, final GroupOptionsLogoView view) {
-    super(eventBus, session, entityLogo, entityOptions, userService);
+      final GroupOptions entityOptions, final StateManager stateManager,
+      final Provider<UserServiceAsync> userService, final GroupOptionsLogoView view,
+      final I18nTranslationService i18n) {
+    super(eventBus, session, entityOptions, userService, i18n);
     init(view);
     stateManager.onGroupChanged(true, new GroupChangedHandler() {
       @Override

Modified: trunk/src/main/java/cc/kune/gspace/client/options/logo/UserOptionsLogoPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/logo/UserOptionsLogoPresenter.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/options/logo/UserOptionsLogoPresenter.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -27,8 +27,8 @@
 import cc.kune.core.client.state.StateManager;
 import cc.kune.core.client.state.UserSignInEvent;
 import cc.kune.core.client.state.UserSignInEvent.UserSignInHandler;
-import cc.kune.core.client.ws.entheader.EntityHeader;
 import cc.kune.core.shared.dto.GroupDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.options.UserOptions;
 
 import com.google.gwt.event.shared.EventBus;
@@ -39,9 +39,10 @@
 
   @Inject
   public UserOptionsLogoPresenter(final EventBus eventBus, final Session session,
-      final EntityHeader entityLogo, final UserOptions entityOptions, final StateManager stateManager,
-      final Provider<UserServiceAsync> userService, final UserOptionsLogoView view) {
-    super(eventBus, session, entityLogo, entityOptions, userService);
+      final UserOptions entityOptions, final StateManager stateManager,
+      final Provider<UserServiceAsync> userService, final UserOptionsLogoView view,
+      final I18nTranslationService i18n) {
+    super(eventBus, session, entityOptions, userService, i18n);
     init(view);
     session.onUserSignIn(true, new UserSignInHandler() {
       @Override

Modified: trunk/src/main/java/cc/kune/gspace/client/options/style/EntityOptionsStyleConfPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/style/EntityOptionsStyleConfPanel.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/options/style/EntityOptionsStyleConfPanel.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -19,22 +19,25 @@
  */
 package cc.kune.gspace.client.options.style;
 
+import gwtupload.client.IUploader.OnCancelUploaderHandler;
+import gwtupload.client.IUploader.OnChangeUploaderHandler;
+import gwtupload.client.IUploader.OnFinishUploaderHandler;
+import gwtupload.client.IUploader.OnStartUploaderHandler;
 import cc.kune.common.client.notify.NotifyUser;
 import cc.kune.common.client.tooltip.Tooltip;
 import cc.kune.common.client.ui.BasicThumb;
 import cc.kune.common.client.ui.IconLabel;
 import cc.kune.common.client.utils.TextUtils;
 import cc.kune.core.client.resources.CoreResources;
-import cc.kune.core.client.services.FileDownloadUtils;
-import cc.kune.core.client.services.ImageSize;
-import cc.kune.core.shared.domain.utils.StateToken;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.options.EntityOptionsView;
+import cc.kune.gspace.client.options.logo.EntityUploaderForm;
 import cc.kune.gspace.client.themes.GSpaceThemeSelectorPanel;
 
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.gwt.user.client.ui.Button;
 import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.Image;
@@ -44,42 +47,50 @@
 
 public class EntityOptionsStyleConfPanel extends FlowPanel implements EntityOptionsStyleConfView {
 
+  public static final String ICON_UPLD_SERVLET = "servlets/EntityBackgroundUploadManager";
   private final Image backImage;
   private final Button clearBtn;
   private final Label currentBackLabel;
-  private final FileDownloadUtils downUtils;
   private final Label noBackLabel;
   private final IconLabel tabTitle;
+  private final EntityUploaderForm uploader;
 
-  public EntityOptionsStyleConfPanel(final I18nTranslationService i18n,
-      final FileDownloadUtils downUtils, final CoreResources res,
+  public EntityOptionsStyleConfPanel(final I18nTranslationService i18n, final CoreResources res,
       final GSpaceThemeSelectorPanel styleSelector) {
-    this.downUtils = downUtils;
+    ;
     tabTitle = new IconLabel(res.themeChoose(), i18n.t("Style"));
     super.setHeight(String.valueOf(EntityOptionsView.HEIGHT) + "px");
     super.setWidth(String.valueOf(EntityOptionsView.WIDTH) + "px");
 
-    final FlowPanel wsHP = new FlowPanel();
+    final FlowPanel flow = new FlowPanel();
     final Label wsThemeInfo = new Label(i18n.t("Change this workspace theme:"));
-    wsThemeInfo.addStyleName("kune-Margin-20-tb");
+    flow.addStyleName("kune-Margin-20-tb");
+    wsThemeInfo.addStyleName("k-fl");
     styleSelector.addStyleName("k-fl");
-    wsHP.add(wsThemeInfo);
-    wsHP.add(styleSelector);
-    add(wsHP);
-    final VerticalPanel backPanel = new VerticalPanel();
+    styleSelector.addStyleName("kune-Margin-10-trbl");
+    flow.add(wsThemeInfo);
+    flow.add(styleSelector);
     currentBackLabel = new Label(i18n.t("Current background image: "));
-    noBackLabel = new Label(i18n.t("Also you can upload any image and select it later as background."));
+    noBackLabel = new Label(i18n.t("Also you can upload a background:"));
+    currentBackLabel.addStyleName("k-clear");
+    noBackLabel.addStyleName("k-clear");
+    uploader = new EntityUploaderForm(ICON_UPLD_SERVLET, i18n.t("Choose"));
+    uploader.addStyleName("k-fl");
     backImage = new Image();
     backImage.addStyleName("kune-Margin-Medium-trbl");
     noBackLabel.addStyleName("kune-Margin-Medium-tb");
     clearBtn = new Button(i18n.t("Clear"));
+    clearBtn.setStyleName("k-button");
+    clearBtn.addStyleName("k-fl");
     Tooltip.to(clearBtn, i18n.t("Remove current background image"));
-    // backPanel.add(noBackLabel);
-    backPanel.add(currentBackLabel);
-    backPanel.add(backImage);
-    backPanel.add(clearBtn);
-    backPanel.addStyleName("oc-clean");
-    // add(backPanel);
+    flow.add(noBackLabel);
+    flow.add(currentBackLabel);
+    flow.add(backImage);
+    flow.add(uploader);
+    flow.add(clearBtn);
+    flow.addStyleName("oc-clean");
+    backImage.addStyleName("k-fr");
+    add(flow);
     final Label wsInfo = new Label(i18n.t("Select and configure the public space theme of this group:"));
     wsInfo.addStyleName("kune-Margin-Medium-tb");
     // add(wsInfo);
@@ -106,6 +117,26 @@
   }
 
   @Override
+  public HandlerRegistration addOnCancelUploadHandler(final OnCancelUploaderHandler handler) {
+    return uploader.addOnCancelUploadHandler(handler);
+  }
+
+  @Override
+  public HandlerRegistration addOnChangeUploadHandler(final OnChangeUploaderHandler handler) {
+    return uploader.addOnChangeUploadHandler(handler);
+  }
+
+  @Override
+  public HandlerRegistration addOnFinishUploadHandler(final OnFinishUploaderHandler handler) {
+    return uploader.addOnFinishUploadHandler(handler);
+  }
+
+  @Override
+  public HandlerRegistration addOnStartUploadHandler(final OnStartUploaderHandler handler) {
+    return uploader.addOnStartUploadHandler(handler);
+  }
+
+  @Override
   public void clearBackImage() {
     setBackImageVisibleImpl(false);
   }
@@ -121,8 +152,14 @@
   }
 
   @Override
-  public void setBackImage(final StateToken token) {
-    backImage.setUrl(downUtils.getImageResizedUrl(token, ImageSize.thumb));
+  public void reset() {
+    uploader.reset();
+  }
+
+  @Override
+  public void setBackImage(final String url) {
+    // backImage.setUrl(downUtils.getImageResizedUrl(token, ImageSize.thumb));
+    backImage.setUrl(url);
     setBackImageVisibleImpl(true);
   }
 
@@ -132,4 +169,9 @@
     clearBtn.setVisible(visible);
     noBackLabel.setVisible(!visible);
   }
+
+  @Override
+  public void setUploadParams(final String userHash, final String token) {
+    uploader.setUploadParams(userHash, token);
+  }
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/options/style/EntityOptionsStyleConfPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/style/EntityOptionsStyleConfPresenter.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/options/style/EntityOptionsStyleConfPresenter.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -19,15 +19,24 @@
  */
 package cc.kune.gspace.client.options.style;
 
+import gwtupload.client.IUploadStatus.Status;
+import gwtupload.client.IUploader;
+import gwtupload.client.IUploader.OnFinishUploaderHandler;
+import gwtupload.client.IUploader.OnStartUploaderHandler;
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.client.utils.TextUtils;
 import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
 import cc.kune.core.client.rpcservices.GroupServiceAsync;
+import cc.kune.core.client.services.FileDownloadUtils;
+import cc.kune.core.client.services.ImageSize;
 import cc.kune.core.client.state.Session;
 import cc.kune.core.client.state.StateChangedEvent;
 import cc.kune.core.client.state.StateChangedEvent.StateChangedHandler;
 import cc.kune.core.client.state.StateManager;
-import cc.kune.core.shared.dto.ContentSimpleDTO;
+import cc.kune.core.shared.domain.utils.StateToken;
 import cc.kune.core.shared.dto.GroupDTO;
 import cc.kune.core.shared.dto.StateAbstractDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.options.EntityOptions;
 import cc.kune.gspace.client.style.ClearBackImageEvent;
 import cc.kune.gspace.client.style.GSpaceBackManager;
@@ -44,7 +53,9 @@
   private final GSpaceBackManager backManager;
   private final EntityOptions entityOptions;
   private final EventBus eventBus;
+  private final FileDownloadUtils fileDownloadUtils;
   private final Provider<GroupServiceAsync> groupService;
+  private final I18nTranslationService i18n;
   private final Session session;
   private final StateManager stateManager;
   private EntityOptionsStyleConfView view;
@@ -52,22 +63,26 @@
   protected EntityOptionsStyleConfPresenter(final EventBus eventBus, final Session session,
       final StateManager stateManager, final EntityOptions entityOptions,
       final Provider<GroupServiceAsync> groupService, final GSpaceBackManager backManager,
-      final GSpaceThemeSelectorPresenter styleSelector) {
+      final GSpaceThemeSelectorPresenter styleSelector, final I18nTranslationService i18n,
+      final FileDownloadUtils fileDownloadUtils) {
     this.eventBus = eventBus;
     this.session = session;
     this.stateManager = stateManager;
     this.entityOptions = entityOptions;
     this.groupService = groupService;
     this.backManager = backManager;
+    this.i18n = i18n;
+    this.fileDownloadUtils = fileDownloadUtils;
   }
 
-  public void clearBackImage() {
+  private void clearBackImage() {
     groupService.get().clearGroupBackImage(session.getUserHash(), session.getCurrentStateToken(),
         new AsyncCallbackSimple<GroupDTO>() {
           @Override
           public void onSuccess(final GroupDTO result) {
             view.clearBackImage();
             backManager.clearBackImage();
+            ClearBackImageEvent.fire(eventBus);
           }
         });
   }
@@ -79,7 +94,7 @@
   public void init(final EntityOptionsStyleConfView view) {
     this.view = view;
     entityOptions.addTab(view, view.getTabTitle());
-    setBackImage(session.getCurrentState().getGroup().getGroupBackImage());
+    setState();
     view.getClearBtn().addClickHandler(new ClickHandler() {
       @Override
       public void onClick(final ClickEvent event) {
@@ -89,15 +104,15 @@
     stateManager.onStateChanged(true, new StateChangedHandler() {
       @Override
       public void onStateChanged(final StateChangedEvent event) {
-        final StateAbstractDTO state = event.getState();
-        final ContentSimpleDTO backImage = state.getGroup().getGroupBackImage();
-        setBackImage(backImage);
+        setState();
       }
     });
     eventBus.addHandler(SetBackImageEvent.getType(), new SetBackImageEvent.SetBackImageHandler() {
       @Override
       public void onSetBackImage(final SetBackImageEvent event) {
-        view.setBackImage(event.getToken());
+        final StateToken token = event.getToken();
+        backManager.setBackImage(token);
+        setBackImage(event.getToken());
       }
     });
     eventBus.addHandler(ClearBackImageEvent.getType(), new ClearBackImageEvent.ClearBackImageHandler() {
@@ -106,13 +121,49 @@
         view.clearBackImage();
       }
     });
+    view.addOnStartUploadHandler(new OnStartUploaderHandler() {
+      @Override
+      public void onStart(final IUploader uploader) {
+        setState();
+      }
+    });
+    view.addOnFinishUploadHandler(new OnFinishUploaderHandler() {
+      @Override
+      public void onFinish(final IUploader uploader) {
+        onSubmitComplete(uploader);
+      }
+    });
   }
 
-  private void setBackImage(final ContentSimpleDTO backImage) {
-    if (backImage == null) {
+  private void onSubmitComplete(final IUploader uploader) {
+    final String response = uploader.getServerInfo().message;
+    if (uploader.getStatus() == Status.SUCCESS) {
+      if (!TextUtils.empty(response)) {
+        NotifyUser.info(response);
+      }
+      SetBackImageEvent.fire(eventBus, session.getCurrentState().getGroup().getStateToken());
+    } else {
+      onSubmitFailed(response);
+    }
+  }
+
+  private void onSubmitFailed(final String responseText) {
+    NotifyUser.error(i18n.t("Error setting the background"), responseText);
+  }
+
+  private void setBackImage(final StateToken token) {
+    view.setBackImage(fileDownloadUtils.getBackgroundResizedUrl(token, ImageSize.thumb));
+  }
+
+  private void setState() {
+    final StateAbstractDTO state = session.getCurrentState();
+    final GroupDTO group = state.getGroup();
+    if (group.getBackgroundImage() == null) {
       view.clearBackImage();
     } else {
-      view.setBackImage(backImage.getStateToken());
+      setBackImage(group.getStateToken());
     }
+    view.setUploadParams(session.getUserHash(), session.getCurrentStateToken().toString());
   }
+
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/options/style/EntityOptionsStyleConfView.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/style/EntityOptionsStyleConfView.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/options/style/EntityOptionsStyleConfView.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -19,17 +19,31 @@
  */
 package cc.kune.gspace.client.options.style;
 
-import cc.kune.core.shared.domain.utils.StateToken;
+import gwtupload.client.IUploader;
+import gwtupload.client.IUploader.OnCancelUploaderHandler;
 import cc.kune.gspace.client.options.EntityOptionsTabView;
 
 import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.event.shared.HandlerRegistration;
 
 public interface EntityOptionsStyleConfView extends EntityOptionsTabView {
 
-    public void clearBackImage();
+  HandlerRegistration addOnCancelUploadHandler(OnCancelUploaderHandler handler);
 
-    HasClickHandlers getClearBtn();
+  HandlerRegistration addOnChangeUploadHandler(IUploader.OnChangeUploaderHandler handler);
 
-    public void setBackImage(final StateToken token);
+  HandlerRegistration addOnFinishUploadHandler(IUploader.OnFinishUploaderHandler handler);
 
+  HandlerRegistration addOnStartUploadHandler(IUploader.OnStartUploaderHandler handler);
+
+  public void clearBackImage();
+
+  HasClickHandlers getClearBtn();
+
+  void reset();
+
+  public void setBackImage(final String url);
+
+  void setUploadParams(String userHash, String token);
+
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/options/style/GroupOptionsStyleConfPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/style/GroupOptionsStyleConfPanel.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/options/style/GroupOptionsStyleConfPanel.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -20,7 +20,6 @@
 package cc.kune.gspace.client.options.style;
 
 import cc.kune.core.client.resources.CoreResources;
-import cc.kune.core.client.services.FileDownloadUtils;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.themes.GSpaceThemeSelectorPanel;
 
@@ -30,10 +29,9 @@
     GroupOptionsStyleConfView {
 
   @Inject
-  public GroupOptionsStyleConfPanel(final I18nTranslationService i18n,
-      final FileDownloadUtils downUtils, final CoreResources res,
+  public GroupOptionsStyleConfPanel(final I18nTranslationService i18n, final CoreResources res,
       final GSpaceThemeSelectorPanel styleSelector) {
-    super(i18n, downUtils, res, styleSelector);
+    super(i18n, res, styleSelector);
   }
 
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/options/style/GroupOptionsStyleConfPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/style/GroupOptionsStyleConfPresenter.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/options/style/GroupOptionsStyleConfPresenter.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -20,10 +20,10 @@
 package cc.kune.gspace.client.options.style;
 
 import cc.kune.core.client.rpcservices.GroupServiceAsync;
+import cc.kune.core.client.services.FileDownloadUtils;
 import cc.kune.core.client.state.Session;
-import cc.kune.core.client.state.StateChangedEvent;
-import cc.kune.core.client.state.StateChangedEvent.StateChangedHandler;
 import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.options.GroupOptions;
 import cc.kune.gspace.client.style.GSpaceBackManager;
 import cc.kune.gspace.client.themes.GSpaceThemeSelectorPresenter;
@@ -39,17 +39,11 @@
   public GroupOptionsStyleConfPresenter(final EventBus eventBus, final Session session,
       final StateManager stateManager, final GroupOptions entityOptions,
       final Provider<GroupServiceAsync> groupService, final GSpaceBackManager backManager,
-      final GroupOptionsStyleConfView view, final GSpaceThemeSelectorPresenter styleSelector) {
-    super(eventBus, session, stateManager, entityOptions, groupService, backManager, styleSelector);
+      final GroupOptionsStyleConfView view, final GSpaceThemeSelectorPresenter styleSelector,
+      final I18nTranslationService i18n, final FileDownloadUtils fileDownUtils) {
+    super(eventBus, session, stateManager, entityOptions, groupService, backManager, styleSelector,
+        i18n, fileDownUtils);
     init(view);
-    stateManager.onStateChanged(true, new StateChangedHandler() {
-
-      @Override
-      public void onStateChanged(final StateChangedEvent event) {
-        // final String theme = state.getGroup().getWorkspaceTheme();
-        // themeSelector.select(theme);
-      }
-    });
   }
 
 }
\ No newline at end of file

Modified: trunk/src/main/java/cc/kune/gspace/client/options/style/UserOptionsStyleConfPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/style/UserOptionsStyleConfPanel.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/options/style/UserOptionsStyleConfPanel.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -20,7 +20,6 @@
 package cc.kune.gspace.client.options.style;
 
 import cc.kune.core.client.resources.CoreResources;
-import cc.kune.core.client.services.FileDownloadUtils;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.themes.GSpaceThemeSelectorPanel;
 
@@ -30,9 +29,9 @@
     UserOptionsStyleConfView {
 
   @Inject
-  public UserOptionsStyleConfPanel(final I18nTranslationService i18n, final FileDownloadUtils downUtils,
-      final CoreResources res, final GSpaceThemeSelectorPanel styleSelector) {
-    super(i18n, downUtils, res, styleSelector);
+  public UserOptionsStyleConfPanel(final I18nTranslationService i18n, final CoreResources res,
+      final GSpaceThemeSelectorPanel styleSelector) {
+    super(i18n, res, styleSelector);
   }
 
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/options/style/UserOptionsStyleConfPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/style/UserOptionsStyleConfPresenter.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/options/style/UserOptionsStyleConfPresenter.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -20,11 +20,10 @@
 package cc.kune.gspace.client.options.style;
 
 import cc.kune.core.client.rpcservices.GroupServiceAsync;
+import cc.kune.core.client.services.FileDownloadUtils;
 import cc.kune.core.client.state.Session;
 import cc.kune.core.client.state.StateManager;
-import cc.kune.core.client.state.UserSignInEvent;
-import cc.kune.core.client.state.UserSignInEvent.UserSignInHandler;
-import cc.kune.core.shared.dto.UserInfoDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.options.UserOptions;
 import cc.kune.gspace.client.style.GSpaceBackManager;
 import cc.kune.gspace.client.themes.GSpaceThemeSelectorPresenter;
@@ -42,30 +41,10 @@
   public UserOptionsStyleConfPresenter(final EventBus eventBus, final Session session,
       final StateManager stateManager, final UserOptions entityOptions,
       final Provider<GroupServiceAsync> groupService, final GSpaceBackManager backManager,
-      final UserOptionsStyleConfView view, final GSpaceThemeSelectorPresenter styleSelector) {
-    super(eventBus, session, stateManager, entityOptions, groupService, backManager, styleSelector);
-    // this.themeSelector = themeSelector;
-    // themeSelector.addThemeSelected(new Listener<WsTheme>() {
-    // public void onEvent(final WsTheme theme) {
-    // themeManager.changeTheme(session.getCurrentUser().getStateToken(),
-    // theme);
-    // }
-    // });
-    final UserInfoDTO userInfo = session.getCurrentUserInfo();
-    if (userInfo != null) {
-      setSelector(userInfo);
-    }
+      final UserOptionsStyleConfView view, final GSpaceThemeSelectorPresenter styleSelector,
+      final I18nTranslationService i18n, final FileDownloadUtils fileDownUtils) {
+    super(eventBus, session, stateManager, entityOptions, groupService, backManager, styleSelector,
+        i18n, fileDownUtils);
     init(view);
-    session.onUserSignIn(true, new UserSignInHandler() {
-      @Override
-      public void onUserSignIn(final UserSignInEvent event) {
-        // setSelector(userInfo);
-      }
-    });
   }
-
-  private void setSelector(final UserInfoDTO userInfo) {
-    // themeSelector.select(userInfo.getUserGroup().getWorkspaceTheme());
-  }
-
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmor.css
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmor.css	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmor.css	2011-06-21 20:03:39 UTC (rev 1412)
@@ -7,17 +7,31 @@
 
 .mainPanel {
   border-top: 2px solid white;
-  border-bottom: 7px solid white;
-  border-right: 7px solid white;
-  border-left: 7px solid white;
+/*  border-bottom: 7px solid transparent;
+  border-right: 17px solid transparent;
+  border-left: 17px solid transparent; */
 }
 
+.k-spaces {
+  margin: 5px 17px 7px 17px;
+  border-collapse: separate;
+}
+
+.k-space {
+}
+
 .floatRight {
   float: right;
 }
 
 .siteBar {
   overflow: hidden;
+  background-color: #fff !important;
+  padding: 0px 5px;
+  /*kfilter: alpha(opacity =       38) !important;
+  -moz-opacity: 0.38 !important;
+  -khtml-opacity: 0.38 !important;
+  opacity: 0.38 !important; */
 }
 
 .entityHeader {

Modified: trunk/src/main/java/cc/kune/gspace/client/style/GSpaceBackManager.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/style/GSpaceBackManager.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/style/GSpaceBackManager.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -23,8 +23,9 @@
 
 public interface GSpaceBackManager {
 
-    void clearBackImage();
+  void clearBackImage();
 
-    void setBackImage(StateToken token);
+  void restoreBackImage();
 
+  void setBackImage(StateToken token);
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/style/GSpaceBackManagerImpl.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/style/GSpaceBackManagerImpl.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/style/GSpaceBackManagerImpl.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -19,46 +19,50 @@
  */
 package cc.kune.gspace.client.style;
 
-import org.cobogw.gwt.user.client.CSS;
+import javax.annotation.Nonnull;
 
 import cc.kune.core.client.services.FileDownloadUtils;
 import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.gspace.client.GSpaceArmor;
 
-import com.google.gwt.event.shared.EventBus;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.RootPanel;
 import com.google.inject.Inject;
 
 public class GSpaceBackManagerImpl implements GSpaceBackManager {
 
-    private static final StateToken NO_TOKEN = new StateToken("none.none.0.0");
-    private final FileDownloadUtils downloadUtils;
-    private final EventBus eventBus;
-    private StateToken lastToken;
+  private static final StateToken NO_TOKEN = new StateToken("none.none.0.0");
+  private final FileDownloadUtils downloadUtils;
+  private final GSpaceArmor gSpaceArmor;
+  private StateToken lastToken;
 
-    @Inject
-    public GSpaceBackManagerImpl(final EventBus eventBus, final FileDownloadUtils downloadUtils) {
-        this.eventBus = eventBus;
-        this.downloadUtils = downloadUtils;
-        lastToken = NO_TOKEN;
+  @Inject
+  public GSpaceBackManagerImpl(final FileDownloadUtils downloadUtils, final GSpaceArmor gSpaceArmor) {
+    this.downloadUtils = downloadUtils;
+    this.gSpaceArmor = gSpaceArmor;
+    lastToken = NO_TOKEN;
+  }
+
+  @Override
+  public void clearBackImage() {
+    if (!lastToken.equals(NO_TOKEN)) {
+      gSpaceArmor.clearBackImage();
+      lastToken = NO_TOKEN;
     }
+  }
 
-    @Override
-    public void clearBackImage() {
-        if (!lastToken.equals(NO_TOKEN)) {
-            DOM.setStyleAttribute(RootPanel.getBodyElement(), CSS.A.BACKGROUND, "transparent");
-            lastToken = NO_TOKEN;
-        }
-        ClearBackImageEvent.fire(eventBus);
+  @Override
+  public void restoreBackImage() {
+    if (!lastToken.equals(NO_TOKEN)) {
+      gSpaceArmor.setBackImage(downloadUtils.getBackgroundImageUrl(lastToken));
     }
+  }
 
-    @Override
-    public void setBackImage(final StateToken token) {
-        if (!token.equals(lastToken)) {
-            final String bodyProp = "#FFFFFF url('" + downloadUtils.getImageUrl(token) + "') fixed no-repeat top left";
-            DOM.setStyleAttribute(RootPanel.getBodyElement(), CSS.A.BACKGROUND, bodyProp);
-            lastToken = token;
-        }
-        SetBackImageEvent.fire(eventBus, token);
+  @Override
+  public void setBackImage(final @Nonnull StateToken token) {
+    final StateToken tokenNoGroup = token.clearDocument().clearDocument();
+    if (!tokenNoGroup.equals(lastToken)) {
+      gSpaceArmor.setBackImage(downloadUtils.getBackgroundImageUrl(tokenNoGroup));
+      lastToken = tokenNoGroup;
     }
+
+  }
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/themes/GSpaceThemeManager.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/themes/GSpaceThemeManager.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/gspace/client/themes/GSpaceThemeManager.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -27,13 +27,13 @@
 import cc.kune.core.client.init.AppStartEvent.AppStartHandler;
 import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
 import cc.kune.core.client.rpcservices.GroupServiceAsync;
+import cc.kune.core.client.state.GroupChangedEvent;
+import cc.kune.core.client.state.GroupChangedEvent.GroupChangedHandler;
 import cc.kune.core.client.state.Session;
-import cc.kune.core.client.state.StateChangedEvent;
-import cc.kune.core.client.state.StateChangedEvent.StateChangedHandler;
 import cc.kune.core.client.state.StateManager;
 import cc.kune.core.shared.domain.utils.StateToken;
-import cc.kune.core.shared.dto.ContentSimpleDTO;
 import cc.kune.core.shared.dto.GSpaceTheme;
+import cc.kune.core.shared.dto.GroupDTO;
 import cc.kune.core.shared.dto.InitDataDTO;
 import cc.kune.core.shared.dto.StateAbstractDTO;
 import cc.kune.gspace.client.resources.GSpaceArmorResources;
@@ -69,10 +69,10 @@
       public void onAppStart(final AppStartEvent event) {
         final InitDataDTO initdata = session.getInitData();
         themes = initdata.getgSpaceThemes();
-        stateManager.onStateChanged(true, new StateChangedHandler() {
+        stateManager.onGroupChanged(true, new GroupChangedHandler() {
           @Override
-          public void onStateChanged(final StateChangedEvent event) {
-            setState(event.getState());
+          public void onGroupChanged(final GroupChangedEvent event) {
+            setState(session.getCurrentState());
           }
         });
       }
@@ -117,11 +117,12 @@
 
   private void setState(final StateAbstractDTO state) {
     setTheme(themes.get(state.getGroup().getWorkspaceTheme()));
-    final ContentSimpleDTO groupBackImage = state.getGroup().getGroupBackImage();
+    final GroupDTO group = state.getGroup();
+    final String groupBackImage = group.getBackgroundImage();
     if (groupBackImage == null) {
       wsBackManager.clearBackImage();
     } else {
-      wsBackManager.setBackImage(groupBackImage.getStateToken());
+      wsBackManager.setBackImage(state.getGroup().getStateToken());
     }
   }
 

Modified: trunk/src/main/java/cc/kune/pspace/client/PSpaceInDevelopment.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/pspace/client/PSpaceInDevelopment.ui.xml	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/cc/kune/pspace/client/PSpaceInDevelopment.ui.xml	2011-06-21 20:03:39 UTC (rev 1412)
@@ -5,7 +5,7 @@
     .container {
       margin: 10px;
       font-family: 'Ubuntu', Arial;
-      background-color: white;
+      background-color: transparent;
     }
 
     .entityLogo {

Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -46,68 +46,71 @@
 import com.calclab.suco.client.ioc.Provider;
 
 public class GalleryClientActions extends OldAbstractFoldableContentActions {
-    public GalleryClientActions(final I18nUITranslationService i18n, final ContextNavigator contextNavigator,
-            final Session session, final StateManager stateManager, final SchedulerManager deferredCommandWrapper,
-            final Provider<ContentServiceAsync> contentServiceProvider,
-            final Provider<GroupServiceAsync> groupServiceProvider, final Provider<FileUploader> fileUploaderProvider,
-            final ContentActionRegistry contentActionRegistry, final ContextActionRegistry contextActionRegistry,
-            final Provider<FileDownloadUtils> fileDownloadProvider, final EntityHeader entityLogo,
-            final Provider<ContentEditor> textEditorProvider, final ErrorHandler errorHandler,
-            final GalleryViewer documentViewer, final Provider<ContextPropEditor> contextProvEditorProvider,
-            final GSpaceBackManager wsBackManager) {
-        super(session, stateManager, i18n, errorHandler, deferredCommandWrapper, groupServiceProvider,
-                contentServiceProvider, fileUploaderProvider, contextNavigator, contentActionRegistry,
-                contextActionRegistry, fileDownloadProvider, textEditorProvider, contextProvEditorProvider,
-                documentViewer, entityLogo, wsBackManager);
-    }
+  public GalleryClientActions(final I18nUITranslationService i18n,
+      final ContextNavigator contextNavigator, final Session session, final StateManager stateManager,
+      final SchedulerManager deferredCommandWrapper,
+      final Provider<ContentServiceAsync> contentServiceProvider,
+      final Provider<GroupServiceAsync> groupServiceProvider,
+      final Provider<FileUploader> fileUploaderProvider,
+      final ContentActionRegistry contentActionRegistry,
+      final ContextActionRegistry contextActionRegistry,
+      final Provider<FileDownloadUtils> fileDownloadProvider, final EntityHeader entityLogo,
+      final Provider<ContentEditor> textEditorProvider, final ErrorHandler errorHandler,
+      final GalleryViewer documentViewer, final Provider<ContextPropEditor> contextProvEditorProvider,
+      final GSpaceBackManager wsBackManager) {
+    super(session, stateManager, i18n, errorHandler, deferredCommandWrapper, groupServiceProvider,
+        contentServiceProvider, fileUploaderProvider, contextNavigator, contentActionRegistry,
+        contextActionRegistry, fileDownloadProvider, textEditorProvider, contextProvEditorProvider,
+        documentViewer, entityLogo, wsBackManager);
+  }
 
-    @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 };
+  @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 };
 
-        final String parentMenuTitle = i18n.t("File");
-        final String parentMenuTitleCtx = i18n.t("Album");
+    final String parentMenuTitle = i18n.t("File");
+    final 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);
+    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);
 
-        createContentRenameAction(parentMenuTitle, i18n.t("Rename"), contents);
-        createContentModeratedActions(parentMenuTitle, contentsModerated);
-        createRenameContentInCtxAction(parentMenuTitleCtx, i18n.t("Rename"), containersNoRoot);
+    createContentRenameAction(parentMenuTitle, i18n.t("Rename"), contents);
+    createContentModeratedActions(parentMenuTitle, contentsModerated);
+    createRenameContentInCtxAction(parentMenuTitleCtx, i18n.t("Rename"), containersNoRoot);
 
-        // final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupCxt =
-        // createSetAsDefContent(parentMenuTitleCtx);
+    // final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupCxt =
+    // createSetAsDefContent(parentMenuTitleCtx);
 
-        createRefreshCntAction(parentMenuTitle, contents);
-        createRefreshCxtAction(parentMenuTitleCtx, containers);
+    createRefreshCntAction(parentMenuTitle, contents);
+    createRefreshCxtAction(parentMenuTitleCtx, containers);
 
-        createSetAsDefContent(parentMenuTitle, contents);
-        createSetGroupBackImageAction(parentMenuTitle, TYPE_UPLOADEDFILE);
+    createSetAsDefContent(parentMenuTitle, contents);
+    // createSetGroupBackImageAction(parentMenuTitle, TYPE_UPLOADEDFILE);
 
-        // createUploadAction(i18n.t("Upload file"), "images/nav/upload.png",
-        // i18n.t("Upload some files (images, PDFs, ...)"), null, containers);
+    // createUploadAction(i18n.t("Upload file"), "images/nav/upload.png",
+    // i18n.t("Upload some files (images, PDFs, ...)"), null, containers);
 
-        createDownloadActions(TYPE_UPLOADEDFILE);
+    createDownloadActions(TYPE_UPLOADEDFILE);
 
-        createGoAction(all);
+    createGoAction(all);
 
-        createGoHomeAction(containers);
+    createGoHomeAction(containers);
 
-        // createTranslateAction(TYPE_ALBUM, TYPE_UPLOADEDFILE);
+    // createTranslateAction(TYPE_ALBUM, TYPE_UPLOADEDFILE);
 
-        createDelContainerAction("Delete folder", parentMenuTitleCtx, containersNoRoot);
-        createDelContentAction(parentMenuTitle, i18n.t("Delete"), contents);
-        createShowDeletedItems(parentMenuTitleCtx, all);
-    }
+    createDelContainerAction("Delete folder", parentMenuTitleCtx, containersNoRoot);
+    createDelContentAction(parentMenuTitle, i18n.t("Delete"), contents);
+    createShowDeletedItems(parentMenuTitleCtx, all);
+  }
 
-    @Override
-    protected void createPostSessionInitActions() {
-        super.createUploadMediaAction(TYPE_ALBUM);
-    }
+  @Override
+  protected void createPostSessionInitActions() {
+    super.createUploadMediaAction(TYPE_ALBUM);
+  }
 }

Modified: trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientActions.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientActions.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -47,69 +47,72 @@
 import com.calclab.suco.client.ioc.Provider;
 
 public class WikiClientActions extends OldAbstractFoldableContentActions {
-    public WikiClientActions(final I18nUITranslationService i18n, final ContextNavigator contextNavigator,
-            final Session session, final StateManager stateManager, final SchedulerManager deferredCommandWrapper,
-            final Provider<ContentServiceAsync> contentServiceProvider,
-            final Provider<GroupServiceAsync> groupServiceProvider, final Provider<FileUploader> fileUploaderProvider,
-            final ContentActionRegistry contentActionRegistry, final ContextActionRegistry contextActionRegistry,
-            final Provider<FileDownloadUtils> fileDownloadProvider, final EntityHeader entityLogo,
-            final Provider<ContentEditor> textEditorProvider, final ErrorHandler errorHandler,
-            final WikiViewer documentViewer, final Provider<ContextPropEditor> contextProvEditorProvider,
-            final GSpaceBackManager wsBackManager) {
-        super(session, stateManager, i18n, errorHandler, deferredCommandWrapper, groupServiceProvider,
-                contentServiceProvider, fileUploaderProvider, contextNavigator, contentActionRegistry,
-                contextActionRegistry, fileDownloadProvider, textEditorProvider, contextProvEditorProvider,
-                documentViewer, entityLogo, wsBackManager);
-    }
+  public WikiClientActions(final I18nUITranslationService i18n, final ContextNavigator contextNavigator,
+      final Session session, final StateManager stateManager,
+      final SchedulerManager deferredCommandWrapper,
+      final Provider<ContentServiceAsync> contentServiceProvider,
+      final Provider<GroupServiceAsync> groupServiceProvider,
+      final Provider<FileUploader> fileUploaderProvider,
+      final ContentActionRegistry contentActionRegistry,
+      final ContextActionRegistry contextActionRegistry,
+      final Provider<FileDownloadUtils> fileDownloadProvider, final EntityHeader entityLogo,
+      final Provider<ContentEditor> textEditorProvider, final ErrorHandler errorHandler,
+      final WikiViewer documentViewer, final Provider<ContextPropEditor> contextProvEditorProvider,
+      final GSpaceBackManager wsBackManager) {
+    super(session, stateManager, i18n, errorHandler, deferredCommandWrapper, groupServiceProvider,
+        contentServiceProvider, fileUploaderProvider, contextNavigator, contentActionRegistry,
+        contextActionRegistry, fileDownloadProvider, textEditorProvider, contextProvEditorProvider,
+        documentViewer, entityLogo, wsBackManager);
+  }
 
-    @Override
-    protected void createActions() {
-        final String[] all = { TYPE_ROOT, TYPE_FOLDER, TYPE_WIKIPAGE, TYPE_UPLOADEDFILE };
-        final String[] containers = { TYPE_ROOT, TYPE_FOLDER };
-        // final String[] contentsModerated = { };
-        final String[] containersNoRoot = { TYPE_FOLDER };
-        final String[] contents = { TYPE_WIKIPAGE, TYPE_UPLOADEDFILE };
+  @Override
+  protected void createActions() {
+    final String[] all = { TYPE_ROOT, TYPE_FOLDER, TYPE_WIKIPAGE, TYPE_UPLOADEDFILE };
+    final String[] containers = { TYPE_ROOT, TYPE_FOLDER };
+    // final String[] contentsModerated = { };
+    final String[] containersNoRoot = { TYPE_FOLDER };
+    final String[] contents = { TYPE_WIKIPAGE, TYPE_UPLOADEDFILE };
 
-        final String parentMenuTitle = i18n.t("Wikipage");
-        final String parentMenuTitleCtx = i18n.t("Wiki");
+    final String parentMenuTitle = i18n.t("Wikipage");
+    final String parentMenuTitleCtx = i18n.t("Wiki");
 
-        createNewContainerAction(TYPE_FOLDER, "images/nav/folder_add.png", i18n.t("New folder"), parentMenuTitleCtx,
-                i18n.t("New"), i18n.t("New folder"), Position.ctx, TYPE_ROOT, TYPE_FOLDER);
+    createNewContainerAction(TYPE_FOLDER, "images/nav/folder_add.png", i18n.t("New folder"),
+        parentMenuTitleCtx, i18n.t("New"), i18n.t("New folder"), Position.ctx, TYPE_ROOT, TYPE_FOLDER);
 
-        createNewContentAction(TYPE_WIKIPAGE, "images/nav/wikipage_add.png", i18n.t("New wikipage"),
-                parentMenuTitleCtx, Position.ctx, TYPE_ROOT, TYPE_FOLDER);
+    createNewContentAction(TYPE_WIKIPAGE, "images/nav/wikipage_add.png", i18n.t("New wikipage"),
+        parentMenuTitleCtx, Position.ctx, TYPE_ROOT, TYPE_FOLDER);
 
-        // createContentModeratedActions(parentMenuTitle, contentsModerated);
-        createTranslateAction(parentMenuTitle, TYPE_FOLDER, TYPE_WIKIPAGE);
-        createContentRenameAction(parentMenuTitle, i18n.t("Rename"), contents);
-        createRenameContentInCtxAction(parentMenuTitleCtx, i18n.t("Rename"), containersNoRoot);
-        createEditAction(parentMenuTitle, TYPE_WIKIPAGE);
+    // createContentModeratedActions(parentMenuTitle, contentsModerated);
+    createTranslateAction(parentMenuTitle, TYPE_FOLDER, TYPE_WIKIPAGE);
+    createContentRenameAction(parentMenuTitle, i18n.t("Rename"), contents);
+    createRenameContentInCtxAction(parentMenuTitleCtx, i18n.t("Rename"), containersNoRoot);
+    createEditAction(parentMenuTitle, TYPE_WIKIPAGE);
 
-        // final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupCxt =
-        // createSetAsDefContent(parentMenuTitleCtx);
+    // final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupCxt =
+    // createSetAsDefContent(parentMenuTitleCtx);
 
-        createRefreshCntAction(parentMenuTitle, contents);
-        createRefreshCxtAction(parentMenuTitleCtx, containers);
+    createRefreshCntAction(parentMenuTitle, contents);
+    createRefreshCxtAction(parentMenuTitleCtx, containers);
 
-        createSetAsDefContent(parentMenuTitle, contents);
-        createSetGroupBackImageAction(parentMenuTitle, TYPE_UPLOADEDFILE);
+    createSetAsDefContent(parentMenuTitle, contents);
+    // createSetGroupBackImageAction(parentMenuTitle, TYPE_UPLOADEDFILE);
 
-        createUploadAction(i18n.t("Upload file"), "images/nav/upload.png",
-                i18n.t("Upload some files (images, PDFs, ...)"), null, containers);
+    createUploadAction(i18n.t("Upload file"), "images/nav/upload.png",
+        i18n.t("Upload some files (images, PDFs, ...)"), null, containers);
 
-        createDownloadActions(TYPE_UPLOADEDFILE);
+    createDownloadActions(TYPE_UPLOADEDFILE);
 
-        createGoAction(all);
+    createGoAction(all);
 
-        createGoHomeAction(containers);
+    createGoHomeAction(containers);
 
-        createDelContainerAction("Delete folder", parentMenuTitleCtx, containersNoRoot);
-        createDelContentAction(parentMenuTitle, i18n.t("Delete"), contents);
-        createShowDeletedItems(parentMenuTitleCtx, all);
-    }
+    createDelContainerAction("Delete folder", parentMenuTitleCtx, containersNoRoot);
+    createDelContentAction(parentMenuTitle, i18n.t("Delete"), contents);
+    createShowDeletedItems(parentMenuTitleCtx, all);
+  }
 
-    @Override
-    protected void createPostSessionInitActions() {
-        // super.createUploadMediaAction();
-    }
+  @Override
+  protected void createPostSessionInitActions() {
+    // super.createUploadMediaAction();
+  }
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/OldAbstractFoldableContentActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/OldAbstractFoldableContentActions.java	2011-06-18 21:57:55 UTC (rev 1411)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/OldAbstractFoldableContentActions.java	2011-06-21 20:03:39 UTC (rev 1412)
@@ -55,7 +55,6 @@
 import cc.kune.core.shared.domain.utils.StateToken;
 import cc.kune.core.shared.dto.AccessRolDTO;
 import cc.kune.core.shared.dto.ContentSimpleDTO;
-import cc.kune.core.shared.dto.GroupDTO;
 import cc.kune.core.shared.dto.InitDataDTO;
 import cc.kune.core.shared.dto.StateAbstractDTO;
 import cc.kune.core.shared.dto.StateContainerDTO;
@@ -70,603 +69,616 @@
 
 public abstract class OldAbstractFoldableContentActions {
 
-    protected enum Position {
-        cnt, ctx
-    }
+  protected enum Position {
+    cnt, ctx
+  }
 
-    public static final ActionToolbarPosition CONTENT_BOTTOMBAR = new ActionToolbarPosition("afca-ctn-bottom");
+  public static final ActionToolbarPosition CONTENT_BOTTOMBAR = new ActionToolbarPosition(
+      "afca-ctn-bottom");
 
-    public static final ActionToolbarPosition CONTENT_TOPBAR = new ActionToolbarPosition("afca-ctn-top");
-    public static final ActionToolbarPosition CONTEXT_BOTTOMBAR = new ActionToolbarPosition("afca-ctx-bottom");
-    public static final ActionToolbarPosition CONTEXT_TOPBAR = new ActionToolbarPosition("afca-ctx-top");
-    private static final String PUBLICATION_MENU = "Publication";
+  public static final ActionToolbarPosition CONTENT_TOPBAR = new ActionToolbarPosition("afca-ctn-top");
+  public static final ActionToolbarPosition CONTEXT_BOTTOMBAR = new ActionToolbarPosition(
+      "afca-ctx-bottom");
+  public static final ActionToolbarPosition CONTEXT_TOPBAR = new ActionToolbarPosition("afca-ctx-top");
+  private static final String PUBLICATION_MENU = "Publication";
 
-    protected final ContentActionRegistry contentActionRegistry;
-    protected final Provider<ContentServiceAsync> contentServiceProvider;
-    protected final ContextActionRegistry contextActionRegistry;
-    protected final ContextNavigator contextNavigator;
-    protected final Provider<ContextPropEditor> contextPropEditorProvider;
-    protected final SchedulerManager deferredCommandWrapper;
-    protected final EntityHeader entityLogo;
-    protected final ErrorHandler errorHandler;
-    protected final Provider<FileDownloadUtils> fileDownloadProvider;
-    protected final Provider<FileUploader> fileUploaderProvider;
-    protected final FoldableContent foldableContent;
-    protected final Provider<GroupServiceAsync> groupServiceProvider;
-    protected final I18nUITranslationService i18n;
+  protected final ContentActionRegistry contentActionRegistry;
+  protected final Provider<ContentServiceAsync> contentServiceProvider;
+  protected final ContextActionRegistry contextActionRegistry;
+  protected final ContextNavigator contextNavigator;
+  protected final Provider<ContextPropEditor> contextPropEditorProvider;
+  protected final SchedulerManager deferredCommandWrapper;
+  protected final EntityHeader entityLogo;
+  protected final ErrorHandler errorHandler;
+  protected final Provider<FileDownloadUtils> fileDownloadProvider;
+  protected final Provider<FileUploader> fileUploaderProvider;
+  protected final FoldableContent foldableContent;
+  protected final Provider<GroupServiceAsync> groupServiceProvider;
+  protected final I18nUITranslationService i18n;
 
-    protected final Session session;
-    protected final StateManager stateManager;
-    protected final Provider<ContentEditor> textEditorProvider;
+  protected final Session session;
+  protected final StateManager stateManager;
+  protected final Provider<ContentEditor> textEditorProvider;
 
-    private final GSpaceBackManager wsBackManager;
+  private final GSpaceBackManager wsBackManager;
 
-    public OldAbstractFoldableContentActions(final Session session, final StateManager stateManager,
-            final I18nUITranslationService i18n, final ErrorHandler errorHandler,
-            final SchedulerManager deferredCommandWrapper, final Provider<GroupServiceAsync> groupServiceProvider,
-            final Provider<ContentServiceAsync> contentServiceProvider,
-            final Provider<FileUploader> fileUploaderProvider, final ContextNavigator contextNavigator,
-            final ContentActionRegistry contentActionRegistry, final ContextActionRegistry contextActionRegistry,
-            final Provider<FileDownloadUtils> fileDownloadProvider, final Provider<ContentEditor> textEditorProvider,
-            final Provider<ContextPropEditor> contextPropEditorProvider, final FoldableContent foldableContent,
-            final EntityHeader entityLogo, final GSpaceBackManager wsBackManager) {
-        this.session = session;
-        this.stateManager = stateManager;
-        this.i18n = i18n;
-        this.errorHandler = errorHandler;
-        this.deferredCommandWrapper = deferredCommandWrapper;
-        this.groupServiceProvider = groupServiceProvider;
-        this.contentServiceProvider = contentServiceProvider;
-        this.fileUploaderProvider = fileUploaderProvider;
-        this.contextNavigator = contextNavigator;
-        this.contentActionRegistry = contentActionRegistry;
-        this.contextActionRegistry = contextActionRegistry;
-        this.fileDownloadProvider = fileDownloadProvider;
-        this.textEditorProvider = textEditorProvider;
-        this.contextPropEditorProvider = contextPropEditorProvider;
-        this.foldableContent = foldableContent;
-        this.entityLogo = entityLogo;
-        this.wsBackManager = wsBackManager;
-        createActions();
-        session.onInitDataReceived(new Listener<InitDataDTO>() {
-            @Override
-            public void onEvent(final InitDataDTO parameter) {
-                createPostSessionInitActions();
-            }
-        });
-    }
+  public OldAbstractFoldableContentActions(final Session session, final StateManager stateManager,
+      final I18nUITranslationService i18n, final ErrorHandler errorHandler,
+      final SchedulerManager deferredCommandWrapper,
+      final Provider<GroupServiceAsync> groupServiceProvider,
+      final Provider<ContentServiceAsync> contentServiceProvider,
+      final Provider<FileUploader> fileUploaderProvider, final ContextNavigator contextNavigator,
+      final ContentActionRegistry contentActionRegistry,
+      final ContextActionRegistry contextActionRegistry,
+      final Provider<FileDownloadUtils> fileDownloadProvider,
+      final Provider<ContentEditor> textEditorProvider,
+      final Provider<ContextPropEditor> contextPropEditorProvider,
+      final FoldableContent foldableContent, final EntityHeader entityLogo,
+      final GSpaceBackManager wsBackManager) {
+    this.session = session;
+    this.stateManager = stateManager;
+    this.i18n = i18n;
+    this.errorHandler = errorHandler;
+    this.deferredCommandWrapper = deferredCommandWrapper;
+    this.groupServiceProvider = groupServiceProvider;
+    this.contentServiceProvider = contentServiceProvider;
+    this.fileUploaderProvider = fileUploaderProvider;
+    this.contextNavigator = contextNavigator;
+    this.contentActionRegistry = contentActionRegistry;
+    this.contextActionRegistry = contextActionRegistry;
+    this.fileDownloadProvider = fileDownloadProvider;
+    this.textEditorProvider = textEditorProvider;
+    this.contextPropEditorProvider = contextPropEditorProvider;
+    this.foldableContent = foldableContent;
+    this.entityLogo = entityLogo;
+    this.wsBackManager = wsBackManager;
+    createActions();
+    session.onInitDataReceived(new Listener<InitDataDTO>() {
+      @Override
+      public void onEvent(final InitDataDTO parameter) {
+        createPostSessionInitActions();
+      }
+    });
+  }
 
-    protected abstract void createActions();
+  protected abstract void createActions();
 
-    protected void createContentModeratedActions(final String parentMenuTitle, final String... contentsModerated) {
-        createSetStatusAction(AccessRolDTO.Administrator, i18n.t("Published online"), ContentStatus.publishedOnline,
-                contentsModerated);
-        createSetStatusAction(AccessRolDTO.Editor, i18n.t("Editing in progress"), ContentStatus.editingInProgress,
-                contentsModerated);
-        createSetStatusAction(AccessRolDTO.Administrator, i18n.t("Rejected"), ContentStatus.rejected, contentsModerated);
-        createSetStatusAction(AccessRolDTO.Editor, i18n.t("Submitted for publish"),
-                ContentStatus.submittedForEvaluation, contentsModerated);
-        createSetStatusAction(AccessRolDTO.Administrator, i18n.t("In the rubbish bin"), ContentStatus.inTheDustbin,
-                contentsModerated);
-    }
+  protected void createContentModeratedActions(final String parentMenuTitle,
+      final String... contentsModerated) {
+    createSetStatusAction(AccessRolDTO.Administrator, i18n.t("Published online"),
+        ContentStatus.publishedOnline, contentsModerated);
+    createSetStatusAction(AccessRolDTO.Editor, i18n.t("Editing in progress"),
+        ContentStatus.editingInProgress, contentsModerated);
+    createSetStatusAction(AccessRolDTO.Administrator, i18n.t("Rejected"), ContentStatus.rejected,
+        contentsModerated);
+    createSetStatusAction(AccessRolDTO.Editor, i18n.t("Submitted for publish"),
+        ContentStatus.submittedForEvaluation, contentsModerated);
+    createSetStatusAction(AccessRolDTO.Administrator, i18n.t("In the rubbish bin"),
+        ContentStatus.inTheDustbin, contentsModerated);
+  }
 
-    protected void createContentRenameAction(final String parentMenuTitle, final String textDescription,
-            final String... registerInTypes) {
-        final ActionToolbarMenuAndItemDescriptor<StateToken> renameCtn = new ActionToolbarMenuAndItemDescriptor<StateToken>(
-                AccessRolDTO.Editor, CONTENT_TOPBAR, new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken stateToken) {
-                        contextNavigator.editItem(stateToken);
-                    }
-                });
-        renameCtn.setTextDescription(textDescription);
-        renameCtn.setParentMenuTitle(parentMenuTitle);
-        renameCtn.setEnableCondition(notDeleted());
+  protected void createContentRenameAction(final String parentMenuTitle, final String textDescription,
+      final String... registerInTypes) {
+    final ActionToolbarMenuAndItemDescriptor<StateToken> renameCtn = new ActionToolbarMenuAndItemDescriptor<StateToken>(
+        AccessRolDTO.Editor, CONTENT_TOPBAR, new Listener<StateToken>() {
+          @Override
+          public void onEvent(final StateToken stateToken) {
+            contextNavigator.editItem(stateToken);
+          }
+        });
+    renameCtn.setTextDescription(textDescription);
+    renameCtn.setParentMenuTitle(parentMenuTitle);
+    renameCtn.setEnableCondition(notDeleted());
 
-        // contentActionRegistry.addAction(renameCtn, registerInTypes);
-    }
+    // contentActionRegistry.addAction(renameCtn, registerInTypes);
+  }
 
-    protected void createDelContainerAction(final String text, final String parentMenuTitle,
-            final String... registerInTypes) {
-        final ActionToolbarMenuAndItemDescriptor<StateToken> delContainer = new ActionToolbarMenuAndItemDescriptor<StateToken>(
-                AccessRolDTO.Administrator, CONTENT_TOPBAR, new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken token) {
-                        OldNotifyUser.info("Sorry, in development");
-                    }
-                });
-        delContainer.setParentMenuTitle(parentMenuTitle);
-        delContainer.setTextDescription(i18n.t(text));
-        delContainer.setMustBeConfirmed(true);
-        delContainer.setConfirmationTitle(i18n.t("Please confirm"));
-        delContainer.setConfirmationText(i18n.t("You will delete it with all its contents. Are you sure?"));
-        contextActionRegistry.addAction(delContainer, registerInTypes);
-    }
+  protected void createDelContainerAction(final String text, final String parentMenuTitle,
+      final String... registerInTypes) {
+    final ActionToolbarMenuAndItemDescriptor<StateToken> delContainer = new ActionToolbarMenuAndItemDescriptor<StateToken>(
+        AccessRolDTO.Administrator, CONTENT_TOPBAR, new Listener<StateToken>() {
+          @Override
+          public void onEvent(final StateToken token) {
+            OldNotifyUser.info("Sorry, in development");
+          }
+        });
+    delContainer.setParentMenuTitle(parentMenuTitle);
+    delContainer.setTextDescription(i18n.t(text));
+    delContainer.setMustBeConfirmed(true);
+    delContainer.setConfirmationTitle(i18n.t("Please confirm"));
+    delContainer.setConfirmationText(i18n.t("You will delete it with all its contents. Are you sure?"));
+    contextActionRegistry.addAction(delContainer, registerInTypes);
+  }
 
-    protected void createDelContentAction(final String parentMenuTitle, final String textDescription,
-            final String... registerInTypes) {
-        final ActionToolbarMenuAndItemDescriptor<StateToken> delContent = new ActionToolbarMenuAndItemDescriptor<StateToken>(
-                AccessRolDTO.Administrator, CONTENT_TOPBAR, new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken token) {
-                        contentServiceProvider.get().delContent(session.getUserHash(), token,
-                                new AsyncCallbackSimple<StateContentDTO>() {
-                                    @Override
-                                    public void onSuccess(final StateContentDTO state) {
-                                        session.setCurrentState(state);
-                                        final StateToken parent = token.copy().clearDocument();
-                                        stateManager.gotoStateToken(parent);
-                                        contextNavigator.clear();
-                                        contextNavigator.refreshState();
-                                    }
-                                });
-                    }
+  protected void createDelContentAction(final String parentMenuTitle, final String textDescription,
+      final String... registerInTypes) {
+    final ActionToolbarMenuAndItemDescriptor<StateToken> delContent = new ActionToolbarMenuAndItemDescriptor<StateToken>(
+        AccessRolDTO.Administrator, CONTENT_TOPBAR, new Listener<StateToken>() {
+          @Override
+          public void onEvent(final StateToken token) {
+            contentServiceProvider.get().delContent(session.getUserHash(), token,
+                new AsyncCallbackSimple<StateContentDTO>() {
+                  @Override
+                  public void onSuccess(final StateContentDTO state) {
+                    session.setCurrentState(state);
+                    final StateToken parent = token.copy().clearDocument();
+                    stateManager.gotoStateToken(parent);
+                    contextNavigator.clear();
+                    contextNavigator.refreshState();
+                  }
                 });
-        delContent.setParentMenuTitle(parentMenuTitle);
-        delContent.setTextDescription(textDescription);
-        delContent.setMustBeConfirmed(true);
-        delContent.setConfirmationTitle(i18n.t("Please confirm"));
-        delContent.setConfirmationText(i18n.t("Are you sure?"));
-        delContent.setEnableCondition(notDefAndNotDeleted());
-        // contentActionRegistry.addAction(delContent, registerInTypes);
-    }
+          }
+        });
+    delContent.setParentMenuTitle(parentMenuTitle);
+    delContent.setTextDescription(textDescription);
+    delContent.setMustBeConfirmed(true);
+    delContent.setConfirmationTitle(i18n.t("Please confirm"));
+    delContent.setConfirmationText(i18n.t("Are you sure?"));
+    delContent.setEnableCondition(notDefAndNotDeleted());
+    // contentActionRegistry.addAction(delContent, registerInTypes);
+  }
 
-    protected void createDownloadActions(final String typeUploadedfile) {
-        final ActionToolbarButtonDescriptor<StateToken> download = new ActionToolbarButtonDescriptor<StateToken>(
-                AccessRolDTO.Viewer, CONTENT_TOPBAR, new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken token) {
-                        downloadContent(token);
-                    }
-                });
-        download.setMustBeAuthenticated(false);
-        download.setTextDescription(i18n.t("Download"));
-        download.setToolTip(i18n.t("Download this file"));
-        download.setIconUrl("images/nav/download.png");
+  protected void createDownloadActions(final String typeUploadedfile) {
+    final ActionToolbarButtonDescriptor<StateToken> download = new ActionToolbarButtonDescriptor<StateToken>(
+        AccessRolDTO.Viewer, CONTENT_TOPBAR, new Listener<StateToken>() {
+          @Override
+          public void onEvent(final StateToken token) {
+            downloadContent(token);
+          }
+        });
+    download.setMustBeAuthenticated(false);
+    download.setTextDescription(i18n.t("Download"));
+    download.setToolTip(i18n.t("Download this file"));
+    download.setIconUrl("images/nav/download.png");
 
-        final ActionMenuItemDescriptor<StateToken> downloadCtx = new ActionMenuItemDescriptor<StateToken>(
-                AccessRolDTO.Viewer, new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken token) {
-                        downloadContent(token);
-                    }
-                });
-        downloadCtx.setMustBeAuthenticated(false);
-        downloadCtx.setTextDescription(i18n.t("Download"));
-        downloadCtx.setIconUrl("images/nav/download.png");
+    final ActionMenuItemDescriptor<StateToken> downloadCtx = new ActionMenuItemDescriptor<StateToken>(
+        AccessRolDTO.Viewer, new Listener<StateToken>() {
+          @Override
+          public void onEvent(final StateToken token) {
+            downloadContent(token);
+          }
+        });
+    downloadCtx.setMustBeAuthenticated(false);
+    downloadCtx.setTextDescription(i18n.t("Download"));
+    downloadCtx.setIconUrl("images/nav/download.png");
 
-        // contentActionRegistry.addAction(download, typeUploadedfile);
-        contextActionRegistry.addAction(downloadCtx, typeUploadedfile);
-    }
+    // contentActionRegistry.addAction(download, typeUploadedfile);
+    contextActionRegistry.addAction(downloadCtx, typeUploadedfile);
+  }
 
-    protected ActionToolbarButtonDescriptor<StateToken> createEditAction(final String fileMenuTitle,
-            final String... registerInTypes) {
-        final ActionToolbarButtonDescriptor<StateToken> editContent = new ActionToolbarButtonDescriptor<StateToken>(
-                AccessRolDTO.Editor, CONTENT_TOPBAR, new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken stateToken) {
-                        OldNotifyUser.showProgressProcessing();
-                        session.check(new AsyncCallbackSimple<Void>() {
-                            @Override
-                            public void onSuccess(final Void result) {
-                                final ContentEditor editor = textEditorProvider.get();
-                                foldableContent.detach();
-                                contextNavigator.detach();
-                                contextPropEditorProvider.get().attach();
-                                editor.edit(session.getContentState().getContent(), new Listener<String>() {
-                                    @Override
-                                    public void onEvent(final String html) {
-                                        OldNotifyUser.showProgressSaving();
-                                        contentServiceProvider.get().save(session.getUserHash(), stateToken, html,
-                                                new AsyncCallback<Void>() {
-                                                    @Override
-                                                    public void onFailure(final Throwable caught) {
-                                                        OldNotifyUser.hideProgress();
-                                                        if (caught instanceof SessionExpiredException) {
-                                                            errorHandler.doSessionExpired();
-                                                        } else {
-                                                            OldNotifyUser.error(i18n.t("Error saving document. Retrying..."));
-                                                            errorHandler.process(caught);
-                                                            editor.onSaveFailed();
-                                                        }
-                                                    }
+  protected ActionToolbarButtonDescriptor<StateToken> createEditAction(final String fileMenuTitle,
+      final String... registerInTypes) {
+    final ActionToolbarButtonDescriptor<StateToken> editContent = new ActionToolbarButtonDescriptor<StateToken>(
+        AccessRolDTO.Editor, CONTENT_TOPBAR, new Listener<StateToken>() {
+          @Override
+          public void onEvent(final StateToken stateToken) {
+            OldNotifyUser.showProgressProcessing();
+            session.check(new AsyncCallbackSimple<Void>() {
+              @Override
+              public void onSuccess(final Void result) {
+                final ContentEditor editor = textEditorProvider.get();
+                foldableContent.detach();
+                contextNavigator.detach();
+                contextPropEditorProvider.get().attach();
+                editor.edit(session.getContentState().getContent(), new Listener<String>() {
+                  @Override
+                  public void onEvent(final String html) {
+                    OldNotifyUser.showProgressSaving();
+                    contentServiceProvider.get().save(session.getUserHash(), stateToken, html,
+                        new AsyncCallback<Void>() {
+                          @Override
+                          public void onFailure(final Throwable caught) {
+                            OldNotifyUser.hideProgress();
+                            if (caught instanceof SessionExpiredException) {
+                              errorHandler.doSessionExpired();
+                            } else {
+                              OldNotifyUser.error(i18n.t("Error saving document. Retrying..."));
+                              errorHandler.process(caught);
+                              editor.onSaveFailed();
+                            }
+                          }
 
-                                                    @Override
-                                                    public void onSuccess(final Void param) {
-                                                        OldNotifyUser.hideProgress();
-                                                        session.getContentState().setContent(html);
-                                                        editor.onSavedSuccessful();
-                                                    }
-                                                });
-                                    }
-                                }, new Listener0() {
-                                    @Override
-                                    public void onEvent() {
-                                        // onClose
-                                        deferredCommandWrapper.addCommand(new ScheduledCommand() {
-                                            @Override
-                                            public void execute() {
-                                                foldableContent.attach();
-                                                contextPropEditorProvider.get().detach();
-                                                contextNavigator.attach();
-                                                if (session.inSameToken(stateToken)) {
-                                                    contextNavigator.refreshState();
-                                                    foldableContent.refreshState();
-                                                }
-                                            }
-                                        });
-                                    }
-                                });
-                                editor.setFileMenuTitle(fileMenuTitle);
-                                OldNotifyUser.hideProgress();
-                            }
+                          @Override
+                          public void onSuccess(final Void param) {
+                            OldNotifyUser.hideProgress();
+                            session.getContentState().setContent(html);
+                            editor.onSavedSuccessful();
+                          }
                         });
-                    }
+                  }
+                }, new Listener0() {
+                  @Override
+                  public void onEvent() {
+                    // onClose
+                    deferredCommandWrapper.addCommand(new ScheduledCommand() {
+                      @Override
+                      public void execute() {
+                        foldableContent.attach();
+                        contextPropEditorProvider.get().detach();
+                        contextNavigator.attach();
+                        if (session.inSameToken(stateToken)) {
+                          contextNavigator.refreshState();
+                          foldableContent.refreshState();
+                        }
+                      }
+                    });
+                  }
                 });
-        editContent.setTextDescription(i18n.tWithNT("Edit", "used in button"));
-        editContent.setIconUrl("images/content_edit.png");
-        editContent.setLeftSeparator(ActionToolbarButtonSeparator.spacer);
-        editContent.setEnableCondition(notDeleted());
-        // contentActionRegistry.addAction(editContent, registerInTypes);
-        return editContent;
-    }
+                editor.setFileMenuTitle(fileMenuTitle);
+                OldNotifyUser.hideProgress();
+              }
+            });
+          }
+        });
+    editContent.setTextDescription(i18n.tWithNT("Edit", "used in button"));
+    editContent.setIconUrl("images/content_edit.png");
+    editContent.setLeftSeparator(ActionToolbarButtonSeparator.spacer);
+    editContent.setEnableCondition(notDeleted());
+    // contentActionRegistry.addAction(editContent, registerInTypes);
+    return editContent;
+  }
 
-    protected ActionMenuItemDescriptor<StateToken> createGoAction(final String... registerInTypes) {
-        final ActionMenuItemDescriptor<StateToken> go = new ActionMenuItemDescriptor<StateToken>(AccessRolDTO.Viewer,
-                new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken token) {
-                        stateManager.gotoStateToken(token);
-                    }
-                });
-        go.setMustBeAuthenticated(false);
-        go.setTextDescription(i18n.t("Open"));
-        go.setIconUrl("images/nav/go.png");
-        contextActionRegistry.addAction(go, registerInTypes);
-        return go;
-    }
+  protected ActionMenuItemDescriptor<StateToken> createGoAction(final String... registerInTypes) {
+    final ActionMenuItemDescriptor<StateToken> go = new ActionMenuItemDescriptor<StateToken>(
+        AccessRolDTO.Viewer, new Listener<StateToken>() {
+          @Override
+          public void onEvent(final StateToken token) {
+            stateManager.gotoStateToken(token);
+          }
+        });
+    go.setMustBeAuthenticated(false);
+    go.setTextDescription(i18n.t("Open"));
+    go.setIconUrl("images/nav/go.png");
+    contextActionRegistry.addAction(go, registerInTypes);
+    return go;
+  }
 
-    protected ActionToolbarButtonDescriptor<StateToken> createGoHomeAction(final String... registerInTypes) {
-        final ActionToolbarButtonDescriptor<StateToken> goGroupHome = new ActionToolbarButtonDescriptor<StateToken>(
-                AccessRolDTO.Viewer, CONTEXT_TOPBAR, new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken token) {
-                        stateManager.gotoHistoryToken(token.getGroup());
-                    }
-                });
-        goGroupHome.setMustBeAuthenticated(false);
-        goGroupHome.setIconUrl("images/group-home.png");
-        goGroupHome.setEnableCondition(new ActionEnableCondition<StateToken>() {
-            @Override
-            public boolean mustBeEnabled(final StateToken token) {
-                final StateToken defContentToken = session.getCurrentState().getGroup().getDefaultContent().getStateToken();
-                return !session.getCurrentStateToken().equals(defContentToken);
-            }
+  protected ActionToolbarButtonDescriptor<StateToken> createGoHomeAction(final String... registerInTypes) {
+    final ActionToolbarButtonDescriptor<StateToken> goGroupHome = new ActionToolbarButtonDescriptor<StateToken>(
+        AccessRolDTO.Viewer, CONTEXT_TOPBAR, new Listener<StateToken>() {
+          @Override
+          public void onEvent(final StateToken token) {
+            stateManager.gotoHistoryToken(token.getGroup());
+          }
         });
-        goGroupHome.setLeftSeparator(ActionToolbarButtonSeparator.fill);
-        contextActionRegistry.addAction(goGroupHome, registerInTypes);
-        return goGroupHome;
-    }
+    goGroupHome.setMustBeAuthenticated(false);
+    goGroupHome.setIconUrl("images/group-home.png");
+    goGroupHome.setEnableCondition(new ActionEnableCondition<StateToken>() {
+      @Override
+      public boolean mustBeEnabled(final StateToken token) {
+        final StateToken defContentToken = session.getCurrentState().getGroup().getDefaultContent().getStateToken();
+        return !session.getCurrentStateToken().equals(defContentToken);
+      }
+    });
+    goGroupHome.setLeftSeparator(ActionToolbarButtonSeparator.fill);
+    contextActionRegistry.addAction(goGroupHome, registerInTypes);
+    return goGroupHome;
+  }
 
-    protected void createNewContainerAction(final String contentTypeId, final String iconUrl,
-            final String textDescription, final String parentMenuTitle, final String parentMenuSubtitle,
-            final String defaultName, final Position position, final String... registerInTypes) {
-        final ActionToolbarMenuAndItemDescriptor<StateToken> addFolder;
-        addFolder = new ActionToolbarMenuAndItemDescriptor<StateToken>(AccessRolDTO.Editor, CONTEXT_TOPBAR,
-                new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken stateToken) {
-                        OldNotifyUser.showProgressProcessing();
-                        contentServiceProvider.get().addFolder(session.getUserHash(), stateToken, defaultName,
-                                contentTypeId, new AsyncCallbackSimple<StateContainerDTO>() {
-                                    @Override
-                                    public void onSuccess(final StateContainerDTO state) {
-                                        contextNavigator.setEditOnNextStateChange(true);
-                                        stateManager.setRetrievedStateAndGo(state);
-                                    }
-                                });
-                    }
+  protected void createNewContainerAction(final String contentTypeId, final String iconUrl,
+      final String textDescription, final String parentMenuTitle, final String parentMenuSubtitle,
+      final String defaultName, final Position position, final String... registerInTypes) {
+    final ActionToolbarMenuAndItemDescriptor<StateToken> addFolder;
+    addFolder = new ActionToolbarMenuAndItemDescriptor<StateToken>(AccessRolDTO.Editor, CONTEXT_TOPBAR,
+        new Listener<StateToken>() {
+          @Override
+          public void onEvent(final StateToken stateToken) {
+            OldNotifyUser.showProgressProcessing();
+            contentServiceProvider.get().addFolder(session.getUserHash(), stateToken, defaultName,
+                contentTypeId, new AsyncCallbackSimple<StateContainerDTO>() {
+                  @Override
+                  public void onSuccess(final StateContainerDTO state) {
+                    contextNavigator.setEditOnNextStateChange(true);
+                    stateManager.setRetrievedStateAndGo(state);
+                  }
                 });
-        addFolder.setTextDescription(textDescription);
-        addFolder.setParentMenuTitle(parentMenuTitle);
-        addFolder.setParentSubMenuTitle(parentMenuSubtitle);
-        addFolder.setIconUrl(iconUrl);
-        register(addFolder, position, registerInTypes);
-    }
+          }
+        });
+    addFolder.setTextDescription(textDescription);
+    addFolder.setParentMenuTitle(parentMenuTitle);
+    addFolder.setParentSubMenuTitle(parentMenuSubtitle);
+    addFolder.setIconUrl(iconUrl);
+    register(addFolder, position, registerInTypes);
+  }
 
-    protected ActionToolbarMenuAndItemDescriptor<StateToken> createNewContentAction(final String typeId,
-            final String iconUrl, final String description, final String parentMenuTitle, final Position position,
-            final String... registerInTypes) {
-        final ActionToolbarMenuAndItemDescriptor<StateToken> addContent = new ActionToolbarMenuAndItemDescriptor<StateToken>(
-                AccessRolDTO.Editor, CONTEXT_TOPBAR, new Listener0() {
-                    @Override
-                    public void onEvent() {
-                        OldNotifyUser.showProgressProcessing();
-                        contentServiceProvider.get().addContent(session.getUserHash(),
-                                session.getCurrentState().getStateToken(), description, typeId,
-                                new AsyncCallbackSimple<StateContentDTO>() {
-                                    @Override
-                                    public void onSuccess(final StateContentDTO state) {
-                                        contextNavigator.setEditOnNextStateChange(true);
-                                        stateManager.setRetrievedStateAndGo(state);
-                                    }
-                                });
-                    }
+  protected ActionToolbarMenuAndItemDescriptor<StateToken> createNewContentAction(final String typeId,
+      final String iconUrl, final String description, final String parentMenuTitle,
+      final Position position, final String... registerInTypes) {
+    final ActionToolbarMenuAndItemDescriptor<StateToken> addContent = new ActionToolbarMenuAndItemDescriptor<StateToken>(
+        AccessRolDTO.Editor, CONTEXT_TOPBAR, new Listener0() {
+          @Override
+          public void onEvent() {
+            OldNotifyUser.showProgressProcessing();
+            contentServiceProvider.get().addContent(session.getUserHash(),
+                session.getCurrentState().getStateToken(), description, typeId,
+                new AsyncCallbackSimple<StateContentDTO>() {
+                  @Override
+                  public void onSuccess(final StateContentDTO state) {
+                    contextNavigator.setEditOnNextStateChange(true);
+                    stateManager.setRetrievedStateAndGo(state);
+                  }
                 });
-        addContent.setTextDescription(description);
-        addContent.setParentMenuTitle(parentMenuTitle);
-        addContent.setParentSubMenuTitle(i18n.t("New"));
-        addContent.setIconUrl(iconUrl);
-        register(addContent, position, registerInTypes);
-        return addContent;
-    }
+          }
+        });
+    addContent.setTextDescription(description);
+    addContent.setParentMenuTitle(parentMenuTitle);
+    addContent.setParentSubMenuTitle(i18n.t("New"));
+    addContent.setIconUrl(iconUrl);
+    register(addContent, position, registerInTypes);
+    return addContent;
+  }
 
-    protected abstract void createPostSessionInitActions();
+  protected abstract void createPostSessionInitActions();
 
-    protected ActionToolbarMenuDescriptor<StateToken> createRefreshCntAction(final String parentMenuTitle,
-            final String... registerInTypes) {
-        final ActionToolbarMenuDescriptor<StateToken> refreshCnt = new ActionToolbarMenuDescriptor<StateToken>(
-                AccessRolDTO.Editor, CONTENT_TOPBAR, new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken stateToken) {
-                        stateManager.reload();
-                        contextNavigator.selectItem(stateToken);
-                    }
-                });
-        refreshCnt.setMustBeAuthenticated(false);
-        refreshCnt.setParentMenuTitle(parentMenuTitle);
-        refreshCnt.setTextDescription(i18n.t("Refresh"));
-        refreshCnt.setIconUrl("images/nav/refresh.png");
-        // contentActionRegistry.addAction(refreshCnt, registerInTypes);
-        return refreshCnt;
-    }
+  protected ActionToolbarMenuDescriptor<StateToken> createRefreshCntAction(final String parentMenuTitle,
+      final String... registerInTypes) {
+    final ActionToolbarMenuDescriptor<StateToken> refreshCnt = new ActionToolbarMenuDescriptor<StateToken>(
+        AccessRolDTO.Editor, CONTENT_TOPBAR, new Listener<StateToken>() {
+          @Override
+          public void onEvent(final StateToken stateToken) {
+            stateManager.reload();
+            contextNavigator.selectItem(stateToken);
+          }
+        });
+    refreshCnt.setMustBeAuthenticated(false);
+    refreshCnt.setParentMenuTitle(parentMenuTitle);
+    refreshCnt.setTextDescription(i18n.t("Refresh"));
+    refreshCnt.setIconUrl("images/nav/refresh.png");
+    // contentActionRegistry.addAction(refreshCnt, registerInTypes);
+    return refreshCnt;
+  }
 
-    protected ActionToolbarMenuDescriptor<StateToken> createRefreshCxtAction(final String parentMenuTitleCtx,
-            final String... registerInTypes) {
-        final ActionToolbarMenuDescriptor<StateToken> refreshCtx = new ActionToolbarMenuDescriptor<StateToken>(
-                AccessRolDTO.Editor, CONTEXT_TOPBAR, new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken stateToken) {
-                        stateManager.reload();
-                        contextNavigator.selectItem(stateToken);
-                    }
-                });
-        refreshCtx.setMustBeAuthenticated(false);
-        refreshCtx.setParentMenuTitle(parentMenuTitleCtx);
-        refreshCtx.setTextDescription(i18n.t("Refresh"));
-        refreshCtx.setIconUrl("images/nav/refresh.png");
-        contextActionRegistry.addAction(refreshCtx, registerInTypes);
-        return refreshCtx;
-    }
+  protected ActionToolbarMenuDescriptor<StateToken> createRefreshCxtAction(
+      final String parentMenuTitleCtx, final String... registerInTypes) {
+    final ActionToolbarMenuDescriptor<StateToken> refreshCtx = new ActionToolbarMenuDescriptor<StateToken>(
+        AccessRolDTO.Editor, CONTEXT_TOPBAR, new Listener<StateToken>() {
+          @Override
+          public void onEvent(final StateToken stateToken) {
+            stateManager.reload();
+            contextNavigator.selectItem(stateToken);
+          }
+        });
+    refreshCtx.setMustBeAuthenticated(false);
+    refreshCtx.setParentMenuTitle(parentMenuTitleCtx);
+    refreshCtx.setTextDescription(i18n.t("Refresh"));
+    refreshCtx.setIconUrl("images/nav/refresh.png");
+    contextActionRegistry.addAction(refreshCtx, registerInTypes);
+    return refreshCtx;
+  }
 
-    protected ActionToolbarMenuAndItemDescriptor<StateToken> createRenameContentInCtxAction(
-            final String parentMenuTitleCtx, final String textDescription, final String... registerInTypes) {
-        final ActionToolbarMenuAndItemDescriptor<StateToken> renameCtx = new ActionToolbarMenuAndItemDescriptor<StateToken>(
-                AccessRolDTO.Editor, CONTEXT_TOPBAR, new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken stateToken) {
-                        contextNavigator.editItem(stateToken);
-                    }
-                });
-        renameCtx.setTextDescription(textDescription);
-        renameCtx.setParentMenuTitle(parentMenuTitleCtx);
-        contextActionRegistry.addAction(renameCtx, registerInTypes);
-        return renameCtx;
-    }
+  protected ActionToolbarMenuAndItemDescriptor<StateToken> createRenameContentInCtxAction(
+      final String parentMenuTitleCtx, final String textDescription, final String... registerInTypes) {
+    final ActionToolbarMenuAndItemDescriptor<StateToken> renameCtx = new ActionToolbarMenuAndItemDescriptor<StateToken>(
+        AccessRolDTO.Editor, CONTEXT_TOPBAR, new Listener<StateToken>() {
+          @Override
+          public void onEvent(final StateToken stateToken) {
+            contextNavigator.editItem(stateToken);
+          }
+        });
+    renameCtx.setTextDescription(textDescription);
+    renameCtx.setParentMenuTitle(parentMenuTitleCtx);
+    contextActionRegistry.addAction(renameCtx, registerInTypes);
+    return renameCtx;
+  }
 
-    protected ActionToolbarMenuDescriptor<StateToken> createSetAsDefContent(final String parentMenuTitle,
-            final String... registerInTypes) {
-        final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupContent;
-        setAsDefGroupContent = new ActionToolbarMenuDescriptor<StateToken>(AccessRolDTO.Administrator, CONTENT_TOPBAR,
-                new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken token) {
-                        OldNotifyUser.showProgressProcessing();
-                        contentServiceProvider.get().setAsDefaultContent(session.getUserHash(), token,
-                                new AsyncCallbackSimple<ContentSimpleDTO>() {
-                                    @Override
-                                    public void onSuccess(final ContentSimpleDTO defContent) {
-                                        session.getCurrentState().getGroup().setDefaultContent(defContent);
-                                        OldNotifyUser.hideProgress();
-                                        OldNotifyUser.info(i18n.t("Content selected as the group homepage"));
-                                    }
-                                });
-                    }
+  protected ActionToolbarMenuDescriptor<StateToken> createSetAsDefContent(final String parentMenuTitle,
+      final String... registerInTypes) {
+    final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupContent;
+    setAsDefGroupContent = new ActionToolbarMenuDescriptor<StateToken>(AccessRolDTO.Administrator,
+        CONTENT_TOPBAR, new Listener<StateToken>() {
+          @Override
+          public void onEvent(final StateToken token) {
+            OldNotifyUser.showProgressProcessing();
+            contentServiceProvider.get().setAsDefaultContent(session.getUserHash(), token,
+                new AsyncCallbackSimple<ContentSimpleDTO>() {
+                  @Override
+                  public void onSuccess(final ContentSimpleDTO defContent) {
+                    session.getCurrentState().getGroup().setDefaultContent(defContent);
+                    OldNotifyUser.hideProgress();
+                    OldNotifyUser.info(i18n.t("Content selected as the group homepage"));
+                  }
                 });
-        setAsDefGroupContent.setTextDescription(i18n.t("Set this as the default group page"));
-        setAsDefGroupContent.setIconUrl("images/group-home.png");
-        setAsDefGroupContent.setEnableCondition(notDefAndNotDeleted());
-        setAsDefGroupContent.setParentMenuTitle(parentMenuTitle);
-        // contentActionRegistry.addAction(setAsDefGroupContent,
-        // registerInTypes);
-        return setAsDefGroupContent;
-    }
+          }
+        });
+    setAsDefGroupContent.setTextDescription(i18n.t("Set this as the default group page"));
+    setAsDefGroupContent.setIconUrl("images/group-home.png");
+    setAsDefGroupContent.setEnableCondition(notDefAndNotDeleted());
+    setAsDefGroupContent.setParentMenuTitle(parentMenuTitle);
+    // contentActionRegistry.addAction(setAsDefGroupContent,
+    // registerInTypes);
+    return setAsDefGroupContent;
+  }
 
-    protected void createSetGroupBackImageAction(final String parentMenuTitle, final String... registerInTypes) {
-        final ActionToolbarMenuAndItemDescriptor<StateToken> setGroupBackImage = new ActionToolbarMenuAndItemDescriptor<StateToken>(
-                AccessRolDTO.Administrator, CONTENT_TOPBAR, new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken token) {
-                        groupServiceProvider.get().setGroupBackImage(session.getUserHash(), token,
-                                new AsyncCallbackSimple<GroupDTO>() {
-                                    @Override
-                                    public void onSuccess(final GroupDTO newGroup) {
-                                        if (session.getCurrentState().getGroup().getShortName().equals(
-                                                newGroup.getShortName())) {
-                                            session.getCurrentState().setGroup(newGroup);
-                                            wsBackManager.clearBackImage();
-                                            wsBackManager.setBackImage(newGroup.getGroupBackImage().getStateToken());
-                                        }
-                                    }
-                                });
-                    }
-                });
-        setGroupBackImage.setParentMenuTitle(parentMenuTitle);
-        setGroupBackImage.setTextDescription(i18n.t("Set this as the group background image"));
-        setGroupBackImage.setIconUrl("images/nav/picture.png");
-        setGroupBackImage.setEnableCondition(new ActionEnableCondition<StateToken>() {
-            @Override
-            public boolean mustBeEnabled(final StateToken token) {
-                return session.getContentState().getMimeType().isImage();
+  //
+  // protected void createSetGroupBackImageAction(final String parentMenuTitle,
+  // final String... registerInTypes) {
+  // final ActionToolbarMenuAndItemDescriptor<StateToken> setGroupBackImage =
+  // new ActionToolbarMenuAndItemDescriptor<StateToken>(
+  // AccessRolDTO.Administrator, CONTENT_TOPBAR, new Listener<StateToken>() {
+  // @Override
+  // public void onEvent(final StateToken token) {
+  // groupServiceProvider.get().setGroupBackImage(session.getUserHash(), token,
+  // new AsyncCallbackSimple<GroupDTO>() {
+  // @Override
+  // public void onSuccess(final GroupDTO newGroup) {
+  // if (session.getCurrentState().getGroup().getShortName().equals(
+  // newGroup.getShortName())) {
+  // session.getCurrentState().setGroup(newGroup);
+  // wsBackManager.clearBackImage();
+  // wsBackManager.setBackImage(newGroup.getGroupBackImage().getStateToken());
+  // }
+  // }
+  // });
+  // }
+  // });
+  // setGroupBackImage.setParentMenuTitle(parentMenuTitle);
+  // setGroupBackImage.setTextDescription(i18n.t("Set this as the group background image"));
+  // setGroupBackImage.setIconUrl("images/nav/picture.png");
+  // setGroupBackImage.setEnableCondition(new
+  // ActionEnableCondition<StateToken>() {
+  // @Override
+  // public boolean mustBeEnabled(final StateToken token) {
+  // return session.getContentState().getMimeType().isImage();
+  // }
+  // });
+  // // contentActionRegistry.addAction(setGroupBackImage, registerInTypes);
+  // }
+
+  protected void createSetStatusAction(final AccessRolDTO rol, final String textDescription,
+      final ContentStatus status, final String[] contentsModerated) {
+    final ActionToolbarMenuRadioDescriptor<StateToken> action = new ActionToolbarMenuRadioDescriptor<StateToken>(
+        rol, CONTENT_TOPBAR, new Listener<StateToken>() {
+          @Override
+          public void onEvent(final StateToken stateToken) {
+            setContentStatus(status, stateToken);
+          }
+        }, "ContentRadioStatus", new RadioMustBeChecked() {
+          @Override
+          public boolean mustBeChecked() {
+            if (session.getContainerState() instanceof StateContentDTO) {
+              final ContentStatus currentStatus = session.getContentState().getStatus();
+              return status.equals(currentStatus);
             }
+            return false;
+          }
         });
-        // contentActionRegistry.addAction(setGroupBackImage, registerInTypes);
-    }
+    action.setTextDescription(textDescription);
+    action.setParentMenuTitle(PUBLICATION_MENU);
+    action.setParentMenuIconUrl("images/anybody.png");
+    // contentActionRegistry.addAction(action, contentsModerated);
+  }
 
-    protected void createSetStatusAction(final AccessRolDTO rol, final String textDescription,
-            final ContentStatus status, final String[] contentsModerated) {
-        final ActionToolbarMenuRadioDescriptor<StateToken> action = new ActionToolbarMenuRadioDescriptor<StateToken>(
-                rol, CONTENT_TOPBAR, new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken stateToken) {
-                        setContentStatus(status, stateToken);
-                    }
-                }, "ContentRadioStatus", new RadioMustBeChecked() {
-                    @Override
-                    public boolean mustBeChecked() {
-                        if (session.getContainerState() instanceof StateContentDTO) {
-                            final ContentStatus currentStatus = session.getContentState().getStatus();
-                            return status.equals(currentStatus);
-                        }
-                        return false;
-                    }
-                });
-        action.setTextDescription(textDescription);
-        action.setParentMenuTitle(PUBLICATION_MENU);
-        action.setParentMenuIconUrl("images/anybody.png");
-        // contentActionRegistry.addAction(action, contentsModerated);
-    }
+  protected void createShowDeletedItems(final String parentMenuTitle, final String... registerInTypes) {
+    final ActionToolbarMenuCheckItemDescriptor<StateToken> showDeletedItems = new ActionToolbarMenuCheckItemDescriptor<StateToken>(
+        AccessRolDTO.Editor, CONTEXT_TOPBAR, new Listener0() {
+          @Override
+          public void onEvent() {
+            final boolean mustShow = !session.getCurrentUserInfo().getShowDeletedContent();
+            session.getCurrentUserInfo().setShowDeletedContent(mustShow);
+            if (!mustShow && session.isCurrentStateAContent()
+                && session.getContentState().getStatus().equals(ContentStatus.inTheDustbin)) {
+              stateManager.gotoHistoryToken(session.getCurrentStateToken().getGroup());
+            }
+            contextNavigator.clear();
+            contextNavigator.refreshState();
+          }
+        }, new ActionCheckedCondition() {
+          @Override
+          public boolean mustBeChecked() {
+            return session.getShowDeletedContent();
+          }
+        });
+    showDeletedItems.setParentMenuTitle(parentMenuTitle);
+    showDeletedItems.setTextDescription("Show deleted items");
+    showDeletedItems.setMustBeAuthenticated(true);
+    contextActionRegistry.addAction(showDeletedItems, registerInTypes);
+  }
 
-    protected void createShowDeletedItems(final String parentMenuTitle, final String... registerInTypes) {
-        final ActionToolbarMenuCheckItemDescriptor<StateToken> showDeletedItems = new ActionToolbarMenuCheckItemDescriptor<StateToken>(
-                AccessRolDTO.Editor, CONTEXT_TOPBAR, new Listener0() {
-                    @Override
-                    public void onEvent() {
-                        final boolean mustShow = !session.getCurrentUserInfo().getShowDeletedContent();
-                        session.getCurrentUserInfo().setShowDeletedContent(mustShow);
-                        if (!mustShow && session.isCurrentStateAContent()
-                                && session.getContentState().getStatus().equals(ContentStatus.inTheDustbin)) {
-                            stateManager.gotoHistoryToken(session.getCurrentStateToken().getGroup());
-                        }
-                        contextNavigator.clear();
-                        contextNavigator.refreshState();
-                    }
-                }, new ActionCheckedCondition() {
-                    @Override
-                    public boolean mustBeChecked() {
-                        return session.getShowDeletedContent();
-                    }
-                });
-        showDeletedItems.setParentMenuTitle(parentMenuTitle);
-        showDeletedItems.setTextDescription("Show deleted items");
-        showDeletedItems.setMustBeAuthenticated(true);
-        contextActionRegistry.addAction(showDeletedItems, registerInTypes);
-    }
+  protected ActionToolbarMenuDescriptor<StateToken> createTranslateAction(final String fileMenuTitle,
+      final String... registerInTypes) {
+    final ActionToolbarMenuDescriptor<StateToken> translateContent = new ActionToolbarMenuDescriptor<StateToken>(
+        AccessRolDTO.Editor, CONTENT_TOPBAR, new Listener<StateToken>() {
+          @Override
+          public void onEvent(final StateToken stateToken) {
+            OldNotifyUser.important(i18n.t("Sorry, this functionality is currently in development"));
+          }
+        });
+    translateContent.setParentMenuTitle(fileMenuTitle);
+    translateContent.setTextDescription(i18n.tWithNT("Translate", "used in button"));
+    translateContent.setToolTip(i18n.t("Translate this document to other languages"));
+    translateContent.setIconUrl("images/language.gif");
+    translateContent.setEnableCondition(notDeleted());
+    // contentActionRegistry.addAction(translateContent, registerInTypes);
+    return translateContent;
+  }
 
-    protected ActionToolbarMenuDescriptor<StateToken> createTranslateAction(final String fileMenuTitle,
-            final String... registerInTypes) {
-        final ActionToolbarMenuDescriptor<StateToken> translateContent = new ActionToolbarMenuDescriptor<StateToken>(
-                AccessRolDTO.Editor, CONTENT_TOPBAR, new Listener<StateToken>() {
-                    @Override
-                    public void onEvent(final StateToken stateToken) {
-                        OldNotifyUser.important(i18n.t("Sorry, this functionality is currently in development"));
-                    }
-                });
-        translateContent.setParentMenuTitle(fileMenuTitle);
-        translateContent.setTextDescription(i18n.tWithNT("Translate", "used in button"));
-        translateContent.setToolTip(i18n.t("Translate this document to other languages"));
-        translateContent.setIconUrl("images/language.gif");
-        translateContent.setEnableCondition(notDeleted());
-        // contentActionRegistry.addAction(translateContent, registerInTypes);
-        return translateContent;
-    }
+  protected ActionToolbarButtonAndItemDescriptor<StateToken> createUploadAction(
+      final String textDescription, final String iconUrl, final String toolTip,
+      final String permitedExtensions, final String... registerInTypes) {
+    final ActionToolbarButtonAndItemDescriptor<StateToken> uploadFile;
+    uploadFile = new ActionToolbarButtonAndItemDescriptor<StateToken>(AccessRolDTO.Editor,
+        CONTEXT_BOTTOMBAR, new Listener0() {
+          @Override
+          public void onEvent() {
+            if (permitedExtensions != null) {
+              // FIXME: can't be reset ...
+              // fileUploaderProvider.get().setPermittedExtensions(permitedExtensions);
+            } else {
+              // FIXME: can't be reset ...
+              // fileUploaderProvider.get().resetPermittedExtensions();
+            }
+            fileUploaderProvider.get().show();
+          }
+        });
+    uploadFile.setTextDescription(textDescription);
+    uploadFile.setIconUrl(iconUrl);
+    uploadFile.setToolTip(toolTip);
+    contextActionRegistry.addAction(uploadFile, registerInTypes);
+    return uploadFile;
+  }
 
-    protected ActionToolbarButtonAndItemDescriptor<StateToken> createUploadAction(final String textDescription,
-            final String iconUrl, final String toolTip, final String permitedExtensions,
-            final String... registerInTypes) {
-        final ActionToolbarButtonAndItemDescriptor<StateToken> uploadFile;
-        uploadFile = new ActionToolbarButtonAndItemDescriptor<StateToken>(AccessRolDTO.Editor, CONTEXT_BOTTOMBAR,
-                new Listener0() {
-                    @Override
-                    public void onEvent() {
-                        if (permitedExtensions != null) {
-                            // FIXME: can't be reset ...
-                            // fileUploaderProvider.get().setPermittedExtensions(permitedExtensions);
-                        } else {
-                            // FIXME: can't be reset ...
-                            // fileUploaderProvider.get().resetPermittedExtensions();
-                        }
-                        fileUploaderProvider.get().show();
-                    }
-                });
-        uploadFile.setTextDescription(textDescription);
-        uploadFile.setIconUrl(iconUrl);
-        uploadFile.setToolTip(toolTip);
-        contextActionRegistry.addAction(uploadFile, registerInTypes);
-        return uploadFile;
-    }
+  protected ActionToolbarButtonAndItemDescriptor<StateToken> createUploadMediaAction(
+      final String... registerInTypes) {
+    final ActionToolbarButtonAndItemDescriptor<StateToken> uploadMedia = createUploadAction(
+        i18n.t("Upload media"), "images/nav/upload.png",
+        i18n.t("Upload some media (images, videos...)"), session.getGalleryPermittedExtensions());
+    contextActionRegistry.addAction(uploadMedia, registerInTypes);
+    return uploadMedia;
+  }
 
-    protected ActionToolbarButtonAndItemDescriptor<StateToken> createUploadMediaAction(final String... registerInTypes) {
-        final ActionToolbarButtonAndItemDescriptor<StateToken> uploadMedia = createUploadAction(i18n.t("Upload media"),
-                "images/nav/upload.png", i18n.t("Upload some media (images, videos...)"),
-                session.getGalleryPermittedExtensions());
-        contextActionRegistry.addAction(uploadMedia, registerInTypes);
-        return uploadMedia;
-    }
+  protected void downloadContent(final StateToken token) {
+    fileDownloadProvider.get().downloadFile(token);
+  }
 
-    protected void downloadContent(final StateToken token) {
-        fileDownloadProvider.get().downloadFile(token);
-    }
+  private ActionEnableCondition<StateToken> notDefAndNotDeleted() {
+    return new ActionEnableCondition<StateToken>() {
+      @Override
+      public boolean mustBeEnabled(final StateToken token) {
+        final boolean isNotDefContentToken = !session.getCurrentState().getGroup().getDefaultContent().getStateToken().equals(
+            session.getCurrentStateToken());
+        return isNotDefContentToken && notDeleted().mustBeEnabled(token);
+      }
+    };
+  }
 
-    private ActionEnableCondition<StateToken> notDefAndNotDeleted() {
-        return new ActionEnableCondition<StateToken>() {
-            @Override
-            public boolean mustBeEnabled(final StateToken token) {
-                final boolean isNotDefContentToken = !session.getCurrentState().getGroup().getDefaultContent().getStateToken().equals(
-                        session.getCurrentStateToken());
-                return isNotDefContentToken && notDeleted().mustBeEnabled(token);
-            }
-        };
-    }
+  private ActionEnableCondition<StateToken> notDeleted() {
+    return new ActionEnableCondition<StateToken>() {
+      @Override
+      public boolean mustBeEnabled(final StateToken token) {
+        final boolean isNotDeleted = !(session.isCurrentStateAContent() && session.getContentState().getStatus().equals(
+            ContentStatus.inTheDustbin));
+        return isNotDeleted;
+      }
+    };
+  }
 
-    private ActionEnableCondition<StateToken> notDeleted() {
-        return new ActionEnableCondition<StateToken>() {
-            @Override
-            public boolean mustBeEnabled(final StateToken token) {
-                final boolean isNotDeleted = !(session.isCurrentStateAContent() && session.getContentState().getStatus().equals(
-                        ContentStatus.inTheDustbin));
-                return isNotDeleted;
-            }
-        };
+  private void register(final ActionToolbarMenuAndItemDescriptor<StateToken> action,
+      final Position position, final String... registerInTypes) {
+    if (position.equals(Position.ctx)) {
+      contextActionRegistry.addAction(action, registerInTypes);
+    } else if (position.equals(Position.cnt)) {
+      // contentActionRegistry.addAction(action, registerInTypes);
     }
+  }
 
-    private void register(final ActionToolbarMenuAndItemDescriptor<StateToken> action, final Position position,
-            final String... registerInTypes) {
-        if (position.equals(Position.ctx)) {
-            contextActionRegistry.addAction(action, registerInTypes);
-        } else if (position.equals(Position.cnt)) {
-            // contentActionRegistry.addAction(action, registerInTypes);
+  private void setContentStatus(final ContentStatus status, final StateToken stateToken) {
+    final AsyncCallbackSimple<StateAbstractDTO> callback = new AsyncCallbackSimple<StateAbstractDTO>() {
+      @Override
+      public void onSuccess(final StateAbstractDTO state) {
+        if (session.inSameToken(stateToken)) {
+          session.setCurrentState(state);
+          // publicLink.setState(state);
+          foldableContent.refreshState();
         }
+        contextNavigator.setItemStatus(stateToken, status);
+      }
+    };
+    if (status.equals(ContentStatus.publishedOnline) || status.equals(ContentStatus.rejected)
+        || status.equals(ContentStatus.inTheDustbin)) {
+      contentServiceProvider.get().setStatusAsAdmin(session.getUserHash(), stateToken, status, callback);
+    } else {
+      contentServiceProvider.get().setStatus(session.getUserHash(), stateToken, status, callback);
     }
+  }
 
-    private void setContentStatus(final ContentStatus status, final StateToken stateToken) {
-        final AsyncCallbackSimple<StateAbstractDTO> callback = new AsyncCallbackSimple<StateAbstractDTO>() {
-            @Override
-            public void onSuccess(final StateAbstractDTO state) {
-                if (session.inSameToken(stateToken)) {
-                    session.setCurrentState(state);
-                    // publicLink.setState(state);
-                    foldableContent.refreshState();
-                }
-                contextNavigator.setItemStatus(stateToken, status);
-            }
-        };
-        if (status.equals(ContentStatus.publishedOnline) || status.equals(ContentStatus.rejected)
-                || status.equals(ContentStatus.inTheDustbin)) {
-            contentServiceProvider.get().setStatusAsAdmin(session.getUserHash(), stateToken, status, callback);
-        } else {
-            contentServiceProvider.get().setStatus(session.getUserHash(), stateToken, status, callback);
-        }
-    }
-
 }




More information about the kune-commits mailing list