[kune-commits] r1414 - in trunk/src/main: java/cc/kune/barters/client java/cc/kune/blogs/client java/cc/kune/blogs/client/actions java/cc/kune/client java/cc/kune/common/client/actions/gwtui java/cc/kune/core/client java/cc/kune/core/client/actions java/cc/kune/core/client/registry java/cc/kune/docs/client java/cc/kune/docs/client/actions java/cc/kune/gspace/client/actions java/cc/kune/gspace/client/tool webapp/others

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Wed Jun 22 18:39:13 CEST 2011


Author: vjrj_
Date: 2011-06-22 18:39:13 +0200 (Wed, 22 Jun 2011)
New Revision: 1414

Added:
   trunk/src/main/java/cc/kune/blogs/client/actions/BlogsNewMenu.java
   trunk/src/main/java/cc/kune/core/client/registry/NewMenusForTypeIdsRegistry.java
   trunk/src/main/java/cc/kune/docs/client/actions/DocsFolderNewMenu.java
   trunk/src/main/java/cc/kune/docs/client/actions/DocsRootNewMenu.java
   trunk/src/main/java/cc/kune/gspace/client/actions/AbstractNewMenu.java
   trunk/src/main/java/cc/kune/gspace/client/actions/NewMenusProvider.java
Modified:
   trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java
   trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java
   trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java
   trunk/src/main/java/cc/kune/client/KuneEntryPoint.java
   trunk/src/main/java/cc/kune/client/OnAppStartFactory.java
   trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java
   trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java
   trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
   trunk/src/main/java/cc/kune/core/client/actions/XMLActionsParser.java
   trunk/src/main/java/cc/kune/core/client/registry/ContentCapabilitiesRegistry.java
   trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java
   trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
   trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java
   trunk/src/main/java/cc/kune/gspace/client/tool/FoldableAbstractClientTool.java
   trunk/src/main/webapp/others/kune-wave-extensions.xml
Log:
New items based in wave extensions

Modified: trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java	2011-06-21 21:29:32 UTC (rev 1413)
+++ trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -50,7 +50,6 @@
     registerRenamableTypes(TYPE_FOLDER, TYPE_BARTER);
     registerTageableTypes(TYPE_BARTER);
     registerTranslatableTypes(TYPE_FOLDER, TYPE_BARTER);
-
     registerIcons();
   }
 

Modified: trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java	2011-06-21 21:29:32 UTC (rev 1413)
+++ trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -51,7 +51,6 @@
     registerRenamableTypes(TYPE_BLOG, TYPE_POST, TYPE_UPLOADEDFILE);
     registerTageableTypes(TYPE_BLOG, TYPE_UPLOADEDFILE, TYPE_POST);
     // registerTranslatableTypes();
-
     registerIcons();
   }
 

Modified: trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java	2011-06-21 21:29:32 UTC (rev 1413)
+++ trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -26,6 +26,7 @@
 import cc.kune.chat.client.actions.ChatAboutContentBtn;
 import cc.kune.core.client.actions.ActionRegistryByType;
 import cc.kune.core.client.i18n.I18nUITranslationService;
+import cc.kune.core.client.registry.NewMenusForTypeIdsRegistry;
 import cc.kune.core.client.resources.CoreResources;
 import cc.kune.core.client.state.Session;
 import cc.kune.core.client.state.StateManager;
@@ -55,8 +56,9 @@
       final Provider<DelPostMenuItem> delContentMenuItem,
       final Provider<RefreshContentMenuItem> refresh,
       final Provider<ContentViewerOptionsMenu> optionsMenuContent,
-      final Provider<ParticipateInContentBtn> participateBtn,
-      final Provider<ChatAboutContentBtn> chatAbout, final Provider<DelBlogMenuItem> delFolderMenuItem,
+      final Provider<ParticipateInContentBtn> participateBtn, final BlogsNewMenu blogNewMenu,
+      final NewMenusForTypeIdsRegistry newMenusRegistry, final Provider<ChatAboutContentBtn> chatAbout,
+      final Provider<DelBlogMenuItem> delFolderMenuItem,
       final Provider<SetAsHomePageMenuItem> setAsHomePage) {
     super(session, stateManager, i18n, registry);
     actionsRegistry.addAction(ActionGroups.VIEW, optionsMenuContent, all);
@@ -71,8 +73,8 @@
     actionsRegistry.addAction(ActionGroups.MENUITEM, openContentMenuItem, containersNoRoot);
     actionsRegistry.addAction(ActionGroups.MENUITEM, delContentMenuItem, contents);
     actionsRegistry.addAction(ActionGroups.MENUITEM, delFolderMenuItem, containersNoRoot);
-    // actionsRegistry.addAction(ActionGroups.MENUITEM, setAsHomePage,
-    // TYPE_BLOG);
+    newMenusRegistry.register(TYPE_BLOG, blogNewMenu.get());
+    actionsRegistry.addAction(ActionGroups.VIEW, blogNewMenu, TYPE_BLOG);
   }
 
   @Override

Added: trunk/src/main/java/cc/kune/blogs/client/actions/BlogsNewMenu.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/actions/BlogsNewMenu.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/blogs/client/actions/BlogsNewMenu.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -0,0 +1,15 @@
+package cc.kune.blogs.client.actions;
+
+import cc.kune.gspace.client.actions.AbstractNewMenu;
+import cc.kune.gspace.client.actions.NewMenusProvider;
+
+import com.google.inject.Inject;
+
+public class BlogsNewMenu extends NewMenusProvider {
+
+  @Inject
+  public BlogsNewMenu(final AbstractNewMenu menu) {
+    super(menu);
+  }
+
+}


Property changes on: trunk/src/main/java/cc/kune/blogs/client/actions/BlogsNewMenu.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/src/main/java/cc/kune/client/KuneEntryPoint.java
===================================================================
--- trunk/src/main/java/cc/kune/client/KuneEntryPoint.java	2011-06-21 21:29:32 UTC (rev 1413)
+++ trunk/src/main/java/cc/kune/client/KuneEntryPoint.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -91,6 +91,7 @@
     ginjector.getCoreParts();
     ginjector.getGSpaceParts();
     ginjector.getPSpaceParts();
+    ginjector.getXmlActionsParser();
     ginjector.getContentViewerSelector().init();
   }
 }

Modified: trunk/src/main/java/cc/kune/client/OnAppStartFactory.java
===================================================================
--- trunk/src/main/java/cc/kune/client/OnAppStartFactory.java	2011-06-21 21:29:32 UTC (rev 1413)
+++ trunk/src/main/java/cc/kune/client/OnAppStartFactory.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -19,22 +19,19 @@
  */
 package cc.kune.client;
 
-import cc.kune.core.client.actions.XMLActionsParser;
 import cc.kune.core.client.init.AppStartEvent;
 import cc.kune.core.client.init.AppStartEvent.AppStartHandler;
 import cc.kune.core.client.state.Session;
 
 import com.google.inject.Inject;
-import com.google.inject.Provider;
 
 public class OnAppStartFactory {
 
   @Inject
-  public OnAppStartFactory(final Session session, final Provider<XMLActionsParser> actionsParser) {
+  public OnAppStartFactory(final Session session) {
     session.onAppStart(true, new AppStartHandler() {
       @Override
       public void onAppStart(final AppStartEvent event) {
-        actionsParser.get();
       }
     });
   }

Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java	2011-06-21 21:29:32 UTC (rev 1413)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -226,6 +226,7 @@
   protected void setToolTipText(final String text) {
     if (text != null) {
       final KeyStroke key = (KeyStroke) descriptor.getValue(Action.ACCELERATOR_KEY);
+      // FIXME This doesn't works... (don't show the tooltip)
       Tooltip.to(iconLabel, key == null ? text : text + key.toString());
       layout();
     }

Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java	2011-06-21 21:29:32 UTC (rev 1413)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -41,9 +41,9 @@
   @Override
   protected void addStyle(final String style) {
     if (notStandAlone) {
-      iconLabel.addStyleName(style);
+      // iconLabel.addStyleName(style);
       button.addStyleName(style);
-      layout();
+      // layout();
     }
   }
 
@@ -56,7 +56,7 @@
     notStandAlone = !((MenuDescriptor) descriptor).isStandalone();
     if (notStandAlone) {
       button = new Button();
-      button.setStylePrimaryName("oc-button");
+      // button.setStylePrimaryName("oc-button");
       iconLabel = new IconLabel("");
       final ImageResource rightIcon = ((MenuDescriptor) descriptor).getRightIcon();
       if (rightIcon != null) {

Modified: trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/CoreGinModule.java	2011-06-21 21:29:32 UTC (rev 1413)
+++ trunk/src/main/java/cc/kune/core/client/CoreGinModule.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -60,6 +60,7 @@
 import cc.kune.core.client.notify.spiner.SpinerPresenter;
 import cc.kune.core.client.notify.spiner.SpinerViewImpl;
 import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
+import cc.kune.core.client.registry.NewMenusForTypeIdsRegistry;
 import cc.kune.core.client.sitebar.ErrorsDialog;
 import cc.kune.core.client.sitebar.SiteUserOptions;
 import cc.kune.core.client.sitebar.SiteUserOptionsPresenter;
@@ -195,6 +196,7 @@
     eagle(TokenMatcher.class);
     s(ActionRegistryByType.class);
     s(ContentCapabilitiesRegistry.class);
+    s(NewMenusForTypeIdsRegistry.class);
     eagle(CoreParts.class);
 
     // SN
@@ -212,7 +214,7 @@
     s(SitebarSignOutLink.class);
 
     s(ErrorsDialog.class);
-    eagle(XMLActionsParser.class);
+    s(XMLActionsParser.class);
   }
 
 }

Modified: trunk/src/main/java/cc/kune/core/client/actions/XMLActionsParser.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/XMLActionsParser.java	2011-06-21 21:29:32 UTC (rev 1413)
+++ trunk/src/main/java/cc/kune/core/client/actions/XMLActionsParser.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -3,13 +3,19 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import cc.kune.common.client.actions.AbstractExtendedAction;
+import cc.kune.common.client.actions.Action;
 import cc.kune.common.client.actions.ActionEvent;
 import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
 import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
+import cc.kune.common.client.errors.UIException;
+import cc.kune.common.client.notify.NotifyUser;
 import cc.kune.core.client.actions.WaveExtension.Builder;
 import cc.kune.core.client.errors.ErrorHandler;
+import cc.kune.core.client.registry.NewMenusForTypeIdsRegistry;
 import cc.kune.core.client.rpcservices.ContentServiceAsync;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.gspace.client.actions.ActionGroups;
 
 import com.google.gwt.http.client.Request;
 import com.google.gwt.http.client.RequestBuilder;
@@ -26,27 +32,40 @@
 
 public class XMLActionsParser {
 
-  public static class GadgetAction extends AbstractExtendedAction {
+  public static class GadgetAction extends RolAction {
 
     private final Provider<ContentServiceAsync> contentService;
+    private final String gadgetName;
 
-    @Inject
-    public GadgetAction(final Provider<ContentServiceAsync> contentService) {
+    public GadgetAction(final Provider<ContentServiceAsync> contentService, final AccessRolDTO rok,
+        final boolean authNeeded, final String gadgetName, final String iconUrl) {
+      super(rok, authNeeded);
       this.contentService = contentService;
+      this.gadgetName = gadgetName;
+      putValue(Action.SMALL_ICON, iconUrl);
     }
 
     @Override
     public void actionPerformed(final ActionEvent event) {
+      NotifyUser.info("Created succesfully");
     }
 
   }
 
+  private final ActionRegistryByType actionRegistry;
+  private final Provider<ContentServiceAsync> contentService;
   private final ErrorHandler errHandler;
   private final Map<String, WaveExtension> extensionsMap;
+  private final NewMenusForTypeIdsRegistry newMenusRegistry;
 
   @Inject
-  public XMLActionsParser(final ErrorHandler errHandler) {
+  public XMLActionsParser(final ErrorHandler errHandler, final ActionRegistryByType actionRegistry,
+      final Provider<ContentServiceAsync> contentService,
+      final NewMenusForTypeIdsRegistry newMenusRegistry) {
     this.errHandler = errHandler;
+    this.actionRegistry = actionRegistry;
+    this.contentService = contentService;
+    this.newMenusRegistry = newMenusRegistry;
     extensionsMap = new HashMap<String, WaveExtension>();
 
     // Based on:
@@ -81,7 +100,7 @@
 
   private void parseXML(final String text) {
     final Document parse = XMLParser.parse(text);
-    final NodeList extensions = parse.getElementsByTagName("extensions");
+    final NodeList extensions = ((Element) parse.getElementsByTagName("extensions").item(0)).getElementsByTagName("extension");
     for (int i = 0; i < extensions.getLength(); i++) {
       final Element extension = (Element) extensions.item(i);
       final Builder builder = new WaveExtension.Builder();
@@ -93,17 +112,40 @@
       builder.installerUrl(get(extension, "installerUrl"));
       extensionsMap.put(name, builder.build());
     }
-    final NodeList guiDescriptors = parse.getElementsByTagName("guiActionDescriptors");
+    final NodeList guiDescriptors = ((Element) parse.getElementsByTagName("guiActionDescriptors").item(0)).getElementsByTagName("guiActionDescriptor");
     for (int i = 0; i < guiDescriptors.getLength(); i++) {
-      final Element extension = (Element) extensions.item(i);
-      final Provider<GuiActionDescrip> provider = new Provider<GuiActionDescrip>() {
-        @Override
-        public GuiActionDescrip get() {
-          // TODO Auto-generated method stub
-          new MenuItemDescriptor(null);
-          return null;
+      final Element guiDescriptor = (Element) guiDescriptors.item(i);
+      if (Boolean.parseBoolean(get(guiDescriptor, "enabled"))) {
+        final String extensionName = get(guiDescriptor, "extensionName");
+        final WaveExtension extension = extensionsMap.get(extensionName);
+        if (extension == null) {
+          throw new UIException("Undefined extension " + extensionName);
         }
-      };
+        final String name = get(guiDescriptor, "name");
+        final String description = get(guiDescriptor, "description");
+        final AccessRolDTO rol = AccessRolDTO.valueOf(get(guiDescriptor, "rolRequired"));
+        final GadgetAction action = new GadgetAction(contentService, rol, Boolean.parseBoolean(get(
+            guiDescriptor, "authNeed")), extension.getGadgetUrl(), extension.getIconUrl());
+        final NodeList typeIds = ((Element) guiDescriptor.getElementsByTagName("typeIds").item(0)).getElementsByTagName("typeId");
+        final int length = typeIds.getLength();
+
+        for (int j = 0; j < length; j++) {
+          final Element typeIdElem = (Element) typeIds.item(j);
+          final String typeId = typeIdElem.getFirstChild().getNodeValue();
+          final MenuDescriptor menu = newMenusRegistry.get(typeId);
+          assert menu != null;
+          final Provider<GuiActionDescrip> menuItemProvider = new Provider<GuiActionDescrip>() {
+            @Override
+            public GuiActionDescrip get() {
+              final MenuItemDescriptor menuItem = new MenuItemDescriptor(action);
+              menuItem.withText(name).withToolTip(description);
+              menuItem.setParent(menu);
+              return menuItem;
+            }
+          };
+          actionRegistry.addAction(ActionGroups.VIEW, menuItemProvider, typeId);
+        }
+      }
     }
   }
 }

Modified: trunk/src/main/java/cc/kune/core/client/registry/ContentCapabilitiesRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/registry/ContentCapabilitiesRegistry.java	2011-06-21 21:29:32 UTC (rev 1413)
+++ trunk/src/main/java/cc/kune/core/client/registry/ContentCapabilitiesRegistry.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -33,6 +33,7 @@
   private final EmptyMessagesRegistry emptyMessagesRegistry;
   private final IconsRegistry iconsRegistry;
   private final LicensableRegistry licensable;
+  private final NewMenusForTypeIdsRegistry newMenus;
   private final PublishModerableRegistry publishModerable;
   private final RateableRegistry rateable;
   private final RenamableRegistry renamable;
@@ -44,16 +45,17 @@
 
   @Inject
   public ContentCapabilitiesRegistry(final AuthorableRegistry authorableRegistry,
-      final AclEditableRegistry aclEditableRegistry, final IconsRegistry iconsRegistry,
-      final CanBeHomepageRegistry canBeHomepage, final ComentableRegistry comentable,
-      final DragableRegistry dragable, final DropableRegistry dropable,
-      final EmailSubscribeAbleRegistry emailSubscribeAble, final LicensableRegistry licensable,
-      final PublishModerableRegistry publishModerable, final RateableRegistry rateable,
-      final TageableRegistry tageable, final RenamableRegistry renamable,
-      final TranslatableRegistry translatable, final VersionableRegistry versionable,
-      final EmptyMessagesRegistry emptyMessagesRegistry, final XmppComentableRegistry xmppComentable,
-      final XmppNotifyCapableRegistry xmppNotifyCapable) {
+      final NewMenusForTypeIdsRegistry newMenus, final AclEditableRegistry aclEditableRegistry,
+      final IconsRegistry iconsRegistry, final CanBeHomepageRegistry canBeHomepage,
+      final ComentableRegistry comentable, final DragableRegistry dragable,
+      final DropableRegistry dropable, final EmailSubscribeAbleRegistry emailSubscribeAble,
+      final LicensableRegistry licensable, final PublishModerableRegistry publishModerable,
+      final RateableRegistry rateable, final TageableRegistry tageable,
+      final RenamableRegistry renamable, final TranslatableRegistry translatable,
+      final VersionableRegistry versionable, final EmptyMessagesRegistry emptyMessagesRegistry,
+      final XmppComentableRegistry xmppComentable, final XmppNotifyCapableRegistry xmppNotifyCapable) {
     this.authorable = authorableRegistry;
+    this.newMenus = newMenus;
     this.aclEditable = aclEditableRegistry;
     this.iconsRegistry = iconsRegistry;
     this.canBeHomepage = canBeHomepage;
@@ -117,6 +119,10 @@
     return licensable;
   }
 
+  public NewMenusForTypeIdsRegistry getNewMenus() {
+    return newMenus;
+  }
+
   public PublishModerableRegistry getPublishModerable() {
     return publishModerable;
   }

Added: trunk/src/main/java/cc/kune/core/client/registry/NewMenusForTypeIdsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/registry/NewMenusForTypeIdsRegistry.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/registry/NewMenusForTypeIdsRegistry.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -0,0 +1,45 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ \*/
+package cc.kune.core.client.registry;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
+
+public class NewMenusForTypeIdsRegistry {
+  private final Map<String, MenuDescriptor> registry;
+
+  public NewMenusForTypeIdsRegistry() {
+    registry = new HashMap<String, MenuDescriptor>();
+  }
+
+  public MenuDescriptor get(final String typeId) {
+    return registry.get(typeId);
+  }
+
+  public int length() {
+    return registry.size();
+  }
+
+  public void register(final String contentTypeId, final MenuDescriptor menu) {
+    registry.put(contentTypeId, menu);
+  }
+}


Property changes on: trunk/src/main/java/cc/kune/core/client/registry/NewMenusForTypeIdsRegistry.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java	2011-06-21 21:29:32 UTC (rev 1413)
+++ trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -51,7 +51,6 @@
     registerRenamableTypes(TYPE_DOCUMENT, TYPE_FOLDER, TYPE_UPLOADEDFILE);
     registerTageableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
     registerTranslatableTypes(TYPE_DOCUMENT, TYPE_FOLDER);
-
     registerIcons();
   }
 

Modified: trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java	2011-06-21 21:29:32 UTC (rev 1413)
+++ trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -26,6 +26,7 @@
 import cc.kune.chat.client.actions.ChatAboutContentBtn;
 import cc.kune.core.client.actions.ActionRegistryByType;
 import cc.kune.core.client.i18n.I18nUITranslationService;
+import cc.kune.core.client.registry.NewMenusForTypeIdsRegistry;
 import cc.kune.core.client.resources.CoreResources;
 import cc.kune.core.client.state.Session;
 import cc.kune.core.client.state.StateManager;
@@ -46,6 +47,7 @@
   final String[] containersNoRoot = { TYPE_FOLDER };
   final String[] contents = { TYPE_DOCUMENT, TYPE_UPLOADEDFILE };
   final String[] contentsModerated = { TYPE_DOCUMENT, TYPE_UPLOADEDFILE };
+  final String[] root = { TYPE_ROOT };
 
   @Inject
   public DocsClientActions(final I18nUITranslationService i18n, final Session session,
@@ -57,7 +59,8 @@
       final Provider<ParticipateInContentBtn> participateBtn,
       final Provider<DelFolderMenuItem> delFolderMenuItem,
       final Provider<ChatAboutContentBtn> chatAbout, final Provider<RefreshContentMenuItem> refresh,
-      final Provider<SetAsHomePageMenuItem> setAsHomePage) {
+      final Provider<SetAsHomePageMenuItem> setAsHomePage, final DocsRootNewMenu rootNewMenu,
+      final NewMenusForTypeIdsRegistry newMenusRegistry, final DocsFolderNewMenu folderNewMenu) {
     super(session, stateManager, i18n, registry);
     actionsRegistry.addAction(ActionGroups.VIEW, optionsMenuContent, all);
     actionsRegistry.addAction(ActionGroups.VIEW, refresh, all);
@@ -72,6 +75,10 @@
     actionsRegistry.addAction(ActionGroups.MENUITEM, delContentMenuItem, contents);
     actionsRegistry.addAction(ActionGroups.MENUITEM, delFolderMenuItem, containersNoRoot);
     actionsRegistry.addAction(ActionGroups.MENUITEM, setAsHomePage, contents);
+    newMenusRegistry.register(TYPE_FOLDER, folderNewMenu.get());
+    newMenusRegistry.register(TYPE_ROOT, rootNewMenu.get());
+    actionsRegistry.addAction(ActionGroups.VIEW, folderNewMenu, containersNoRoot);
+    actionsRegistry.addAction(ActionGroups.VIEW, rootNewMenu, root);
   }
 
   @Override

Added: trunk/src/main/java/cc/kune/docs/client/actions/DocsFolderNewMenu.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/DocsFolderNewMenu.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/docs/client/actions/DocsFolderNewMenu.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -0,0 +1,15 @@
+package cc.kune.docs.client.actions;
+
+import cc.kune.gspace.client.actions.AbstractNewMenu;
+import cc.kune.gspace.client.actions.NewMenusProvider;
+
+import com.google.inject.Inject;
+
+public class DocsFolderNewMenu extends NewMenusProvider {
+
+  @Inject
+  public DocsFolderNewMenu(final AbstractNewMenu menu) {
+    super(menu);
+  }
+
+}


Property changes on: trunk/src/main/java/cc/kune/docs/client/actions/DocsFolderNewMenu.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/src/main/java/cc/kune/docs/client/actions/DocsRootNewMenu.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/DocsRootNewMenu.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/docs/client/actions/DocsRootNewMenu.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -0,0 +1,15 @@
+package cc.kune.docs.client.actions;
+
+import cc.kune.gspace.client.actions.AbstractNewMenu;
+import cc.kune.gspace.client.actions.NewMenusProvider;
+
+import com.google.inject.Inject;
+
+public class DocsRootNewMenu extends NewMenusProvider {
+
+  @Inject
+  public DocsRootNewMenu(final AbstractNewMenu menu) {
+    super(menu);
+  }
+
+}


Property changes on: trunk/src/main/java/cc/kune/docs/client/actions/DocsRootNewMenu.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/src/main/java/cc/kune/gspace/client/actions/AbstractNewMenu.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/AbstractNewMenu.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/AbstractNewMenu.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -0,0 +1,47 @@
+/*
+ *
+ * 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.gspace.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.UserSignInOrSignOutEvent;
+import cc.kune.core.client.state.UserSignInOrSignOutEvent.UserSignInOrSignOutHandler;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Inject;
+
+public class AbstractNewMenu extends MenuDescriptor {
+
+  @Inject
+  public AbstractNewMenu(final CoreResources res, final I18nTranslationService i18n,
+      final Session session) {
+    super();
+    this.withIcon(res.arrowdownsitebar()).withStyles("k-button, k-btn, k-5corners, k-def-docbtn, k-fr").withText(
+        "New");
+    session.onUserSignInOrSignOut(true, new UserSignInOrSignOutHandler() {
+      @Override
+      public void onUserSignInOrSignOut(final UserSignInOrSignOutEvent event) {
+        AbstractNewMenu.this.setVisible(event.isLogged());
+      }
+    });
+  }
+
+}


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

Modified: trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java	2011-06-21 21:29:32 UTC (rev 1413)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -20,8 +20,6 @@
 package cc.kune.gspace.client.actions;
 
 import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.KeyStroke;
-import cc.kune.common.client.actions.Shortcut;
 import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
 import cc.kune.common.client.notify.NotifyUser;
 import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
@@ -96,10 +94,10 @@
     // The name given to this new content
     action.putValue(NEW_NAME, newName);
     action.putValue(ID, id);
-    final KeyStroke shortcut = Shortcut.getShortcut(false, true, false, false, Character.valueOf('N'));
-    shorcutReg.put(shortcut, action);
-    this.withText(title).withToolTip(tooltip).withIcon(icon).withShortcut(shortcut).withStyles(
-        "k-def-docbtn, k-fr");
+    // final KeyStroke shortcut = Shortcut.getShortcut(false, true, false,
+    // false, Character.valueOf('N'));
+    // shorcutReg.put(shortcut, action);
+    this.withText(title).withToolTip(tooltip).withIcon(icon).withStyles("k-def-docbtn, k-fr");
   }
 
 }

Added: trunk/src/main/java/cc/kune/gspace/client/actions/NewMenusProvider.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewMenusProvider.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewMenusProvider.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -0,0 +1,20 @@
+package cc.kune.gspace.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
+
+import com.google.inject.Provider;
+
+public abstract class NewMenusProvider implements Provider<MenuDescriptor> {
+
+  private final AbstractNewMenu menu;
+
+  public NewMenusProvider(final AbstractNewMenu menu) {
+    this.menu = menu;
+  }
+
+  @Override
+  public MenuDescriptor get() {
+    return menu;
+  }
+
+}


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

Modified: trunk/src/main/java/cc/kune/gspace/client/tool/FoldableAbstractClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/tool/FoldableAbstractClientTool.java	2011-06-21 21:29:32 UTC (rev 1413)
+++ trunk/src/main/java/cc/kune/gspace/client/tool/FoldableAbstractClientTool.java	2011-06-22 16:39:13 UTC (rev 1414)
@@ -19,6 +19,7 @@
  */
 package cc.kune.gspace.client.tool;
 
+import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
 import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
 import cc.kune.core.shared.dto.BasicMimeTypeDTO;
 import cc.kune.gspace.client.tool.selector.ToolSelector;
@@ -74,6 +75,10 @@
     contentCapabilitiesRegistry.getLicensable().register(typeIds);
   }
 
+  public void registerNewMenu(final String typeId, final MenuDescriptor menu) {
+    contentCapabilitiesRegistry.getNewMenus().register(typeId, menu);
+  }
+
   protected void registerPublishModerableTypes(final String... typeIds) {
     contentCapabilitiesRegistry.getPublishModerable().register(typeIds);
   }

Modified: trunk/src/main/webapp/others/kune-wave-extensions.xml
===================================================================
--- trunk/src/main/webapp/others/kune-wave-extensions.xml	2011-06-21 21:29:32 UTC (rev 1413)
+++ trunk/src/main/webapp/others/kune-wave-extensions.xml	2011-06-22 16:39:13 UTC (rev 1414)
@@ -7,6 +7,15 @@
 <extensions>
 
   <extension>
+    <name>pollo</name>
+    <installerUrl>http://wavepollo.appspot.com/pollo.xml
+    </installerUrl>
+    <gadgetUrl>http://wavepollo.appspot.com/wavepollo/com.appspot.wavepollo.client.PolloWaveGadget.gadget.xml
+    </gadgetUrl>
+    <iconUrl>https://flinz-pollo.appspot.com/document_graph.png</iconUrl>
+    <iconCss></iconCss>
+  </extension>
+  <extension>
     <name>massmob</name>
     <installerUrl>http://mass-mob.appspot.com/massmob/massmob-extension.xml
     </installerUrl>
@@ -24,13 +33,34 @@
 
   <guiActionDescriptor>
     <extensionName>massmob</extensionName>
-    <name>Create a meeting</name>
+    <name>New meeting</name>
     <description>Call and speed-up of events as meeting, smartmobs,
       flashmobs, protest demonstrations, etc.</description>
     <enabled>true</enabled>
     <typeIds>
       <typeId>docs.folder</typeId>
       <typeId>docs.root</typeId>
+      <typeId>blogs.blog</typeId>
+    </typeIds>
+    <name></name>
+    <location>
+      <rol>
+        <!-- Administrator, Editor, Viewer -->
+        <rolRequired>Editor</rolRequired>
+        <authNeed>true</authNeed>
+      </rol>
+    </location>
+    <!-- only for new waves: anyone, onlymembers, onlyadmins, ask -->
+    <participants>ask</participants>
+  </guiActionDescriptor>
+
+  <guiActionDescriptor>
+    <extensionName>pollo</extensionName>
+    <name>New poll</name>
+    <description>Make some poll (allow single and multiple polls))</description>
+    <enabled>true</enabled>
+    <typeIds>
+      <typeId>docs.folder</typeId>
       <typeId>docs.root</typeId>
       <typeId>blogs.blog</typeId>
     </typeIds>
@@ -51,7 +81,7 @@
     <name>Add a meeting</name>
     <description>Call and speed-up of events as meeting, smartmobs,
       flashmobs, protest demonstrations, etc.</description>
-    <enabled>true</enabled>
+    <enabled>false</enabled>
     <typeIds>
       <typeId>docs.doc</typeId>
     </typeIds>




More information about the kune-commits mailing list