Author: vjrj_ Date: 2011-11-07 13:22:34 +0100 (Mon, 07 Nov 2011) New Revision: 1588 Added: trunk/src/main/java/cc/kune/blogs/client/actions/PostNewMenu.java trunk/src/main/java/cc/kune/core/client/actions/xml/AddGadgetAction.java trunk/src/main/java/cc/kune/docs/client/actions/DocsNewMenu.java trunk/src/main/java/cc/kune/lists/client/actions/PostNewMenu.java trunk/src/main/java/cc/kune/tasks/client/actions/NewFolderBtn.java trunk/src/main/java/cc/kune/tasks/client/actions/TasksFolderNewMenu.java trunk/src/main/java/cc/kune/wiki/client/actions/WikiPageNewMenu.java Removed: trunk/src/main/java/cc/kune/tasks/client/actions/NewFolderMenuItem.java Modified: trunk/TODO trunk/src/main/java/cc/kune/blogs/client/BlogsGinModule.java trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java trunk/src/main/java/cc/kune/core/client/actions/xml/NewGadgetAction.java trunk/src/main/java/cc/kune/core/client/actions/xml/XMLActionsParser.java trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java trunk/src/main/java/cc/kune/core/server/content/CreationService.java trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java trunk/src/main/java/cc/kune/docs/client/DocsGinModule.java trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java trunk/src/main/java/cc/kune/gspace/client/actions/GotoTokenAction.java trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java trunk/src/main/java/cc/kune/lists/client/ListsGinModule.java trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java trunk/src/main/java/cc/kune/tasks/client/TasksGinModule.java trunk/src/main/java/cc/kune/tasks/client/actions/NewTaskMenuItem.java trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java trunk/src/main/java/cc/kune/wave/server/KuneAgent.java trunk/src/main/java/cc/kune/wave/server/KuneWaveService.java trunk/src/main/java/cc/kune/wave/server/KuneWaveServiceDefault.java trunk/src/main/java/cc/kune/wiki/client/WikiGinModule.java trunk/src/main/java/cc/kune/wiki/client/actions/WikiClientActions.java trunk/src/main/webapp/others/kune-client-actions.xml trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java Log: CLOSE - # 137: Adding 'New' Documents, Folders and Gadgets button to all pages http://kune.ourproject.org/issues/ticket/137 Modified: trunk/TODO =================================================================== --- trunk/TODO 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/TODO 2011-11-07 12:22:34 UTC (rev 1588) @@ -18,6 +18,7 @@ http://www.plupload.com/example_all_runtimes.php http://gxt-multiupload-demo.appspot.com/ http://code.google.com/p/gxt-multi-upload/ +http://code.google.com/p/gwtupload/ ** TODO workaround websocket issues *** compatibilities | jetty M2 | new wesocket | socketio | Modified: trunk/src/main/java/cc/kune/blogs/client/BlogsGinModule.java =================================================================== --- trunk/src/main/java/cc/kune/blogs/client/BlogsGinModule.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/blogs/client/BlogsGinModule.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -21,6 +21,7 @@ import cc.kune.blogs.client.actions.BlogsClientActions; import cc.kune.blogs.client.actions.BlogsNewMenu; +import cc.kune.blogs.client.actions.PostNewMenu; import cc.kune.common.client.ExtendedGinModule; public class BlogsGinModule extends ExtendedGinModule { @@ -28,6 +29,7 @@ @Override protected void configure() { s(BlogsNewMenu.class); + s(PostNewMenu.class); s(BlogsClientTool.class); s(BlogsClientActions.class); } Modified: trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java =================================================================== --- trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -24,6 +24,7 @@ import static cc.kune.blogs.shared.BlogsConstants.TYPE_ROOT; import static cc.kune.blogs.shared.BlogsConstants.TYPE_UPLOADEDFILE; import cc.kune.chat.client.actions.ChatAboutContentBtn; +import cc.kune.common.client.actions.ui.descrip.MenuDescriptor; import cc.kune.core.client.actions.ActionRegistryByType; import cc.kune.core.client.i18n.I18nUITranslationService; import cc.kune.core.client.registry.NewMenusForTypeIdsRegistry; @@ -59,13 +60,14 @@ final Provider<RefreshContentMenuItem> refresh, final Provider<ContentViewerOptionsMenu> optionsMenuContent, final Provider<ParticipateInContentBtn> participateBtn, final BlogsNewMenu blogNewMenu, - final NewMenusForTypeIdsRegistry newMenusRegistry, final Provider<ChatAboutContentBtn> chatAbout, - final Provider<DelBlogMenuItem> delFolderMenuItem, + final PostNewMenu postNewMenu, final NewMenusForTypeIdsRegistry newMenusRegistry, + final Provider<ChatAboutContentBtn> chatAbout, final Provider<DelBlogMenuItem> delFolderMenuItem, final Provider<SetAsHomePageMenuItem> setAsHomePage) { super(session, stateManager, i18n, registry); actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all); actionsRegistry.addAction(ActionGroups.TOOLBAR, newPostIconBtn, noRoot); - actionsRegistry.addAction(ActionGroups.TOOLBAR, blogNewMenu, TYPE_BLOG); + actionsRegistry.addAction(ActionGroups.TOOLBAR, blogNewMenu, containersNoRoot); + actionsRegistry.addAction(ActionGroups.TOOLBAR, postNewMenu, contents); actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all); actionsRegistry.addAction(ActionGroups.TOOLBAR, newPostItem, containersNoRoot); actionsRegistry.addAction(ActionGroups.TOOLBAR, newBlogBtn, TYPE_ROOT); @@ -78,6 +80,9 @@ actionsRegistry.addAction(ActionGroups.ITEM_MENU, delContentMenuItem, contents); actionsRegistry.addAction(ActionGroups.ITEM_MENU, delFolderMenuItem, containersNoRoot); newMenusRegistry.register(TYPE_BLOG, blogNewMenu.get()); + newMenusRegistry.register(TYPE_POST, + (MenuDescriptor) postNewMenu.get().withText(i18n.t("Add Gadget"))); + newMenusRegistry.register(TYPE_UPLOADEDFILE, postNewMenu.get()); } @Override Added: trunk/src/main/java/cc/kune/blogs/client/actions/PostNewMenu.java =================================================================== --- trunk/src/main/java/cc/kune/blogs/client/actions/PostNewMenu.java (rev 0) +++ trunk/src/main/java/cc/kune/blogs/client/actions/PostNewMenu.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -0,0 +1,34 @@ +/* + * + * 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.blogs.client.actions; + +import cc.kune.gspace.client.actions.AbstractNewMenu; +import cc.kune.gspace.client.actions.NewMenuProvider; + +import com.google.inject.Inject; + +public class PostNewMenu extends NewMenuProvider { + + @Inject + public PostNewMenu(final AbstractNewMenu menu) { + super(menu); + } + +} Added: trunk/src/main/java/cc/kune/core/client/actions/xml/AddGadgetAction.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/actions/xml/AddGadgetAction.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/actions/xml/AddGadgetAction.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -0,0 +1,72 @@ +/* + * + * 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.actions.xml; + +import cc.kune.common.client.actions.Action; +import cc.kune.common.client.actions.ActionEvent; +import cc.kune.core.client.actions.RolAction; +import cc.kune.core.client.rpcservices.AsyncCallbackSimple; +import cc.kune.core.client.rpcservices.ContentServiceAsync; +import cc.kune.core.client.state.Session; +import cc.kune.core.client.state.StateManager; +import cc.kune.core.shared.dto.AccessRolDTO; +import cc.kune.core.shared.i18n.I18nTranslationService; +import cc.kune.gspace.client.viewers.ContentViewerPresenter; + +import com.google.inject.Provider; + +public class AddGadgetAction extends RolAction { + + private final Provider<ContentServiceAsync> contentService; + private final ContentViewerPresenter contentViewer; + private final String gadgetName; + private final I18nTranslationService i18n; + private final Session session; + private final StateManager stateManager; + + public AddGadgetAction(final Provider<ContentServiceAsync> contentService, + final ContentViewerPresenter contentViewerPresenter, final StateManager stateManager, + final Session session, final I18nTranslationService i18n, final AccessRolDTO rol, + final boolean authNeeded, final String gadgetName, final String iconUrl) { + super(rol, authNeeded); + this.contentService = contentService; + this.contentViewer = contentViewerPresenter; + this.stateManager = stateManager; + this.i18n = i18n; + this.gadgetName = gadgetName; + this.session = session; + + putValue(Action.SMALL_ICON, iconUrl); + } + + @Override + public void actionPerformed(final ActionEvent event) { + contentService.get().addGadgetToContent(session.getUserHash(), session.getCurrentStateToken(), + gadgetName, new AsyncCallbackSimple<Void>() { + @Override + public void onSuccess(final Void result) { + // NotifyUser.info(i18n.t("[%s] created succesfully", title)); + // stateManager.setRetrievedStateAndGo(result); + // contentViewer.blinkTitle(); + } + }); + } + +} \ No newline at end of file Modified: trunk/src/main/java/cc/kune/core/client/actions/xml/NewGadgetAction.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/actions/xml/NewGadgetAction.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/core/client/actions/xml/NewGadgetAction.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -66,7 +66,7 @@ @Override public void actionPerformed(final ActionEvent event) { - contentService.get().addGadget(session.getUserHash(), session.getCurrentStateToken(), gadgetName, + contentService.get().addNewContentWithGadget(session.getUserHash(), session.getCurrentStateToken(), gadgetName, typeId, i18n.t(title), i18n.t(body), new AsyncCallbackSimple<StateContentDTO>() { @Override public void onSuccess(final StateContentDTO result) { Modified: trunk/src/main/java/cc/kune/core/client/actions/xml/XMLActionsParser.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/actions/xml/XMLActionsParser.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/core/client/actions/xml/XMLActionsParser.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.Map; +import cc.kune.common.client.actions.AbstractAction; 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; @@ -101,6 +102,27 @@ } } + private Provider<GuiActionDescrip> createMenuItem(final XMLGuiActionDescriptor descrip, + final String origTypeId, final AbstractAction action) { + final String path = descrip.getPath(); + final MenuDescriptor menu = newMenusRegistry.get(origTypeId); + assert menu != null; + final SubMenuDescriptor submenu = getSubMenu(menu, origTypeId, path); + final Provider<GuiActionDescrip> menuItemProvider = new Provider<GuiActionDescrip>() { + @Override + public GuiActionDescrip get() { + final MenuItemDescriptor menuItem = new MenuItemDescriptor(action); + // Warning: getDescription returns \n we have to replace this to + // spaces before use i18n in the tooltips (anyway tooltips are not + // working in menu items) + menuItem.withText(i18n.t(descrip.getDescName())).withToolTip(descrip.getDescription()); + menuItem.setParent(TextUtils.notEmpty(path) ? submenu : menu, false); + return menuItem; + } + }; + return menuItemProvider; + } + private SubMenuDescriptor getSubMenu(final MenuDescriptor menu, final String typeId, final String parentS) { final String[] path = parentS.split(SEP); @@ -144,27 +166,21 @@ for (final XMLTypeId typeId : descrip.getTypeIds()) { final String origTypeId = typeId.getOrigTypeId(); final String contentIntro = descrip.getNewContentTextIntro(); - final NewGadgetAction action = new NewGadgetAction(contentService, contentViewer, - stateManager, session, i18n, descrip.getRol().getRolRequired(), - descrip.getRol().isAuthNeed(), extension.getExtName(), typeId.getDestTypeId(), - extension.getIconUrl(), descrip.getNewContentTitle(), TextUtils.empty(contentIntro) ? "" - : contentIntro); - final String path = descrip.getPath(); - final MenuDescriptor menu = newMenusRegistry.get(origTypeId); - assert menu != null; - final SubMenuDescriptor submenu = getSubMenu(menu, origTypeId, path); - final Provider<GuiActionDescrip> menuItemProvider = new Provider<GuiActionDescrip>() { - @Override - public GuiActionDescrip get() { - final MenuItemDescriptor menuItem = new MenuItemDescriptor(action); - // Warning: getDescription returns \n we have to replace this to - // spaces before use i18n in the tooltips (anyway tooltips are not - // working in menu items) - menuItem.withText(i18n.t(descrip.getDescName())).withToolTip(descrip.getDescription()); - menuItem.setParent(TextUtils.notEmpty(path) ? submenu : menu, false); - return menuItem; - } - }; + final String destTypeId = typeId.getDestTypeId(); + AbstractAction action; + if (origTypeId.equals(destTypeId)) { + // We are adding a gadget in a doc (nor creating a gadget in a + // container) + action = new AddGadgetAction(contentService, contentViewer, stateManager, session, i18n, + descrip.getRol().getRolRequired(), descrip.getRol().isAuthNeed(), + extension.getExtName(), extension.getIconUrl()); + } else { + action = new NewGadgetAction(contentService, contentViewer, stateManager, session, i18n, + descrip.getRol().getRolRequired(), descrip.getRol().isAuthNeed(), + extension.getExtName(), destTypeId, extension.getIconUrl(), + descrip.getNewContentTitle(), TextUtils.empty(contentIntro) ? "" : contentIntro); + } + final Provider<GuiActionDescrip> menuItemProvider = createMenuItem(descrip, origTypeId, action); actionRegistry.addAction(ActionGroups.TOOLBAR, menuItemProvider, origTypeId); } } Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -46,9 +46,11 @@ StateContainerDTO addFolder(String hash, StateToken parentToken, String typeId, String title) throws DefaultException; - StateContentDTO addGadget(String userHash, StateToken currentStateToken, String gadgetName, - String typeId, String title, String body); + void addGadgetToContent(String userHash, StateToken currentStateToken, String gadgetName); + StateContentDTO addNewContentWithGadget(String userHash, StateToken currentStateToken, + String gadgetName, String typeId, String title, String body); + void addParticipant(String userHash, StateToken token, String participant) throws DefaultException; StateContainerDTO addRoom(String user, StateToken parentToken, String name) throws DefaultException; Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -45,9 +45,12 @@ void addFolder(String hash, StateToken parentToken, String title, String typeId, AsyncCallback<StateContainerDTO> callback); - void addGadget(String userHash, StateToken currentStateToken, String gadgetName, String typeId, - String title, String body, AsyncCallback<StateContentDTO> asyncCallback); + void addGadgetToContent(String userHash, StateToken currentStateToken, String gadgetName, + AsyncCallback<Void> asyncCallback); + void addNewContentWithGadget(String userHash, StateToken currentStateToken, String gadgetName, + String typeId, String title, String body, AsyncCallback<StateContentDTO> asyncCallback); + void addParticipant(String userHash, StateToken token, String authorShortName, AsyncCallback<Void> asyncCallback) throws DefaultException; Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -103,6 +103,11 @@ content.addAuthor(author); } + public void addGadgetToContent(final User user, final Content content, final URL gadgetUrl) { + kuneWaveManager.addGadget(KuneWaveUtils.getWaveRef(content), + participantUtils.of(user.getShortName()).toString(), gadgetUrl); + } + @Override public void addParticipant(final User user, final Long contentId, final String participant) { final Content content = finder.getContent(contentId); Modified: trunk/src/main/java/cc/kune/core/server/content/CreationService.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/content/CreationService.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/core/server/content/CreationService.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -27,6 +27,8 @@ public interface CreationService { + void addGadgetToContent(User user, Content content, String gadgetName); + Content createContent(String title, String body, User user, Container container, String typeId); Container createFolder(Group group, Long parentFolderId, String name, I18nLanguage language, Modified: trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -59,6 +59,12 @@ } @Override + public void addGadgetToContent(final User user, final Content content, final String gadgetName) { + final URL gadgetUrl = getGadgetUrl(gadgetName); + contentManager.addGadgetToContent(user, content, gadgetUrl); + } + + @Override public Content createContent(final String title, final String body, final User user, final Container container, final String typeId) { final String toolName = container.getToolName(); @@ -88,17 +94,8 @@ final String toolName = container.getToolName(); final ServerTool tool = tools.get(toolName); tool.checkTypesBeforeContentCreation(container.getTypeId(), typeIdChild); - final XMLWaveExtension extension = actions.getExtensions().get(gadgetname); - assert extension != null; - URL gadgetUrl = null; - final String urlS = extension.getGadgetUrl(); - try { - gadgetUrl = new URL(urlS); - } catch (final MalformedURLException e) { - LOG.error("Parsing gadget URL: " + urlS, e); - } final Content content = contentManager.createContent(title, body, user, container, typeIdChild, - gadgetUrl); + getGadgetUrl(gadgetname)); tool.onCreateContent(content, container); return content; } @@ -110,6 +107,19 @@ return containerManager.createRootFolder(group, name, rootName, typeRoot); } + private URL getGadgetUrl(final String gadgetname) { + URL gadgetUrl = null; + final XMLWaveExtension extension = actions.getExtensions().get(gadgetname); + assert extension != null; + final String urlS = extension.getGadgetUrl(); + try { + gadgetUrl = new URL(urlS); + } catch (final MalformedURLException e) { + LOG.error("Parsing gadget URL: " + urlS, e); + } + return gadgetUrl; + } + @Override public Content saveContent(final User editor, final Content content, final String body) { return contentManager.save(editor, content, body); Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -141,9 +141,21 @@ @Override @Authenticated + @Authorizated(actionLevel = ActionLevel.content, accessRolRequired = AccessRol.Editor, mustCheckMembership = false) + @Transactional + public void addGadgetToContent(final String userHash, final StateToken currentStateToken, + final String gadgetName) throws DefaultException { + final User user = getCurrentUser(); + final Content content = accessService.accessToContent( + ContentUtils.parseId(currentStateToken.getDocument()), user, AccessRol.Editor); + creationService.addGadgetToContent(user, content, gadgetName); + } + + @Override + @Authenticated @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor, mustCheckMembership = false) @Transactional - public StateContentDTO addGadget(final String userHash, final StateToken parentToken, + public StateContentDTO addNewContentWithGadget(final String userHash, final StateToken parentToken, final String gadgetname, final String typeId, final String title, final String body) throws DefaultException { final User user = getCurrentUser(); Modified: trunk/src/main/java/cc/kune/docs/client/DocsGinModule.java =================================================================== --- trunk/src/main/java/cc/kune/docs/client/DocsGinModule.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/docs/client/DocsGinModule.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -22,6 +22,7 @@ import cc.kune.common.client.ExtendedGinModule; import cc.kune.docs.client.actions.DocsClientActions; import cc.kune.docs.client.actions.DocsFolderNewMenu; +import cc.kune.docs.client.actions.DocsNewMenu; public class DocsGinModule extends ExtendedGinModule { @@ -30,5 +31,6 @@ s(DocsClientTool.class); s(DocsClientActions.class); s(DocsFolderNewMenu.class); + s(DocsNewMenu.class); } } Modified: trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java =================================================================== --- trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -24,6 +24,7 @@ import static cc.kune.docs.shared.DocsConstants.TYPE_ROOT; import static cc.kune.docs.shared.DocsConstants.TYPE_UPLOADEDFILE; import cc.kune.chat.client.actions.ChatAboutContentBtn; +import cc.kune.common.client.actions.ui.descrip.MenuDescriptor; import cc.kune.core.client.actions.ActionRegistryByType; import cc.kune.core.client.i18n.I18nUITranslationService; import cc.kune.core.client.registry.NewMenusForTypeIdsRegistry; @@ -61,13 +62,15 @@ final Provider<DelFolderMenuItem> delFolderMenuItem, final Provider<ChatAboutContentBtn> chatAbout, final Provider<RefreshContentMenuItem> refresh, final Provider<SetAsHomePageMenuItem> setAsHomePage, - final NewMenusForTypeIdsRegistry newMenusRegistry, final DocsFolderNewMenu docsNewMenu) { + final NewMenusForTypeIdsRegistry newMenusRegistry, final DocsFolderNewMenu foldersNewMenu, + final DocsNewMenu docsNewMenu) { super(session, stateManager, i18n, registry); actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all); actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all); actionsRegistry.addAction(ActionGroups.TOOLBAR, newDocIconBtn, all); actionsRegistry.addAction(ActionGroups.TOOLBAR, newFolderBtn, containers); - actionsRegistry.addAction(ActionGroups.TOOLBAR, docsNewMenu, containers); + actionsRegistry.addAction(ActionGroups.TOOLBAR, foldersNewMenu, containers); + actionsRegistry.addAction(ActionGroups.TOOLBAR, docsNewMenu, contents); actionsRegistry.addAction(ActionGroups.TOOLBAR, newDocMenuItem, containers); actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, contents); actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, containers); @@ -79,8 +82,11 @@ actionsRegistry.addAction(ActionGroups.ITEM_MENU, delContentMenuItem, contents); actionsRegistry.addAction(ActionGroups.ITEM_MENU, delFolderMenuItem, containersNoRoot); actionsRegistry.addAction(ActionGroups.ITEM_MENU, setAsHomePage, contents); - newMenusRegistry.register(TYPE_FOLDER, docsNewMenu.get()); - newMenusRegistry.register(TYPE_ROOT, docsNewMenu.get()); + newMenusRegistry.register(TYPE_FOLDER, foldersNewMenu.get()); + newMenusRegistry.register(TYPE_ROOT, foldersNewMenu.get()); + newMenusRegistry.register(TYPE_DOCUMENT, + (MenuDescriptor) docsNewMenu.get().withText(i18n.t("Add Gadget"))); + newMenusRegistry.register(TYPE_UPLOADEDFILE, docsNewMenu.get()); } @Override Added: trunk/src/main/java/cc/kune/docs/client/actions/DocsNewMenu.java =================================================================== --- trunk/src/main/java/cc/kune/docs/client/actions/DocsNewMenu.java (rev 0) +++ trunk/src/main/java/cc/kune/docs/client/actions/DocsNewMenu.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -0,0 +1,36 @@ +/* + * + * 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.docs.client.actions; + +import javax.annotation.Nonnull; + +import cc.kune.gspace.client.actions.AbstractNewMenu; +import cc.kune.gspace.client.actions.NewMenuProvider; + +import com.google.inject.Inject; + +public class DocsNewMenu extends NewMenuProvider { + + @Inject + public DocsNewMenu(final @Nonnull AbstractNewMenu menu) { + super(menu); + } + +} Modified: trunk/src/main/java/cc/kune/gspace/client/actions/GotoTokenAction.java =================================================================== --- trunk/src/main/java/cc/kune/gspace/client/actions/GotoTokenAction.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/gspace/client/actions/GotoTokenAction.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -34,13 +34,15 @@ private final StateManager stateManager; private final StateToken token; - public GotoTokenAction(final Object icon, final String name, final StateToken token, - final String style, final StateManager stateManager, final EventBus eventBus) { + public GotoTokenAction(final Object icon, final String name, final String tooltip, + final StateToken token, final String style, final StateManager stateManager, + final EventBus eventBus) { super(); this.token = token; this.stateManager = stateManager; putValue(Action.NAME, name); putValue(Action.SMALL_ICON, icon); + putValue(Action.TOOLTIP, tooltip); stateManager.onSocialNetworkChanged(true, new SocialNetworkChangedHandler() { @Override public void onSocialNetworkChanged(final SocialNetworkChangedEvent event) { Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java =================================================================== --- trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -82,7 +82,8 @@ final String title = pos == 0 ? i18n.t(name) : name; final ButtonDescriptor btn = new ButtonDescriptor(new GotoTokenAction( iconsRegistry.getContentTypeIcon(container.getTypeId()), TextUtils.ellipsis(title, 15), - container.getStateToken(), style, stateManager, eventBus)); + i18n.t("Click to go here or drop contents here to move them"), container.getStateToken(), style, + stateManager, eventBus)); if (title.length() > 15) { btn.withToolTip(title); } Modified: trunk/src/main/java/cc/kune/lists/client/ListsGinModule.java =================================================================== --- trunk/src/main/java/cc/kune/lists/client/ListsGinModule.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/lists/client/ListsGinModule.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -23,6 +23,7 @@ import cc.kune.lists.client.actions.ListsClientActions; import cc.kune.lists.client.actions.ListsNewMenu; import cc.kune.lists.client.actions.OptionsListMenu; +import cc.kune.lists.client.actions.PostNewMenu; public class ListsGinModule extends ExtendedGinModule { @@ -30,6 +31,7 @@ protected void configure() { s(OptionsListMenu.class); s(ListsNewMenu.class); + s(PostNewMenu.class); s(ListsClientTool.class); s(ListsClientActions.class); } Modified: trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java =================================================================== --- trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -23,6 +23,7 @@ import static cc.kune.lists.shared.ListsConstants.TYPE_POST; import static cc.kune.lists.shared.ListsConstants.TYPE_ROOT; import cc.kune.chat.client.actions.ChatAboutContentBtn; +import cc.kune.common.client.actions.ui.descrip.MenuDescriptor; import cc.kune.core.client.actions.ActionRegistryByType; import cc.kune.core.client.i18n.I18nUITranslationService; import cc.kune.core.client.registry.NewMenusForTypeIdsRegistry; @@ -57,14 +58,15 @@ final Provider<ShowSubscribersOfListBtn> subscribersCount, final Provider<SetListOpenessMenuItem> listOpenessMenuItem, final Provider<ParticipateInContentBtn> participateBtn, final ListsNewMenu listNewMenu, - final NewMenusForTypeIdsRegistry newMenusRegistry, final Provider<ChatAboutContentBtn> chatAbout, - final Provider<DelListMenuItem> delFolderMenuItem, + final PostNewMenu postNewMenu, final NewMenusForTypeIdsRegistry newMenusRegistry, + final Provider<ChatAboutContentBtn> chatAbout, final Provider<DelListMenuItem> delFolderMenuItem, final Provider<SetAsHomePageMenuItem> setAsHomePage) { super(session, stateManager, i18n, registry); actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all); actionsRegistry.addAction(ActionGroups.TOOLBAR, newPostIconBtn, noRoot); actionsRegistry.addAction(ActionGroups.TOOLBAR, newListBtn, TYPE_ROOT); actionsRegistry.addAction(ActionGroups.TOOLBAR, listNewMenu, containersNoRoot); + actionsRegistry.addAction(ActionGroups.TOOLBAR, postNewMenu, contents); actionsRegistry.addAction(ActionGroups.TOOLBAR, subscribeBtn, containersNoRoot); actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all); actionsRegistry.addAction(ActionGroups.TOOLBAR, listOpenessMenuItem, containersNoRoot); @@ -81,6 +83,8 @@ actionsRegistry.addAction(ActionGroups.ITEM_MENU, delFolderMenuItem, containersNoRoot); newMenusRegistry.register(TYPE_LIST, listNewMenu.get()); newMenusRegistry.register(TYPE_ROOT, listNewMenu.get()); + newMenusRegistry.register(TYPE_POST, + (MenuDescriptor) postNewMenu.get().withText(i18n.t("Add Gadget"))); } @Override Added: trunk/src/main/java/cc/kune/lists/client/actions/PostNewMenu.java =================================================================== --- trunk/src/main/java/cc/kune/lists/client/actions/PostNewMenu.java (rev 0) +++ trunk/src/main/java/cc/kune/lists/client/actions/PostNewMenu.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -0,0 +1,34 @@ +/* + * + * 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.lists.client.actions; + +import cc.kune.gspace.client.actions.AbstractNewMenu; +import cc.kune.gspace.client.actions.NewMenuProvider; + +import com.google.inject.Inject; + +public class PostNewMenu extends NewMenuProvider { + + @Inject + public PostNewMenu(final AbstractNewMenu menu) { + super(menu); + } + +} Modified: trunk/src/main/java/cc/kune/tasks/client/TasksGinModule.java =================================================================== --- trunk/src/main/java/cc/kune/tasks/client/TasksGinModule.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/tasks/client/TasksGinModule.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -21,12 +21,14 @@ import cc.kune.common.client.ExtendedGinModule; import cc.kune.tasks.client.actions.TasksClientActions; +import cc.kune.tasks.client.actions.TasksFolderNewMenu; import cc.kune.tasks.client.actions.TasksNewMenu; public class TasksGinModule extends ExtendedGinModule { @Override protected void configure() { + s(TasksFolderNewMenu.class); s(TasksNewMenu.class); s(TasksClientTool.class); s(TasksClientActions.class); Copied: trunk/src/main/java/cc/kune/tasks/client/actions/NewFolderBtn.java (from rev 1556, trunk/src/main/java/cc/kune/tasks/client/actions/NewFolderMenuItem.java) =================================================================== --- trunk/src/main/java/cc/kune/tasks/client/actions/NewFolderBtn.java (rev 0) +++ trunk/src/main/java/cc/kune/tasks/client/actions/NewFolderBtn.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -0,0 +1,38 @@ +/* + * + * 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.tasks.client.actions; + +import cc.kune.core.client.resources.nav.NavResources; +import cc.kune.core.shared.i18n.I18nTranslationService; +import cc.kune.gspace.client.actions.NewContainerBtn; +import cc.kune.tasks.shared.TasksConstants; + +import com.google.inject.Inject; + +public class NewFolderBtn extends NewContainerBtn { + + @Inject + public NewFolderBtn(final I18nTranslationService i18n, final NewContainerAction action, + final NavResources res) { + super(i18n, action, res.taskfolderadd(), i18n.t("New task folder"), i18n.t("Create a new folder"), + i18n.t("New task folder"), TasksConstants.TYPE_FOLDER); + } + +} Deleted: trunk/src/main/java/cc/kune/tasks/client/actions/NewFolderMenuItem.java =================================================================== --- trunk/src/main/java/cc/kune/tasks/client/actions/NewFolderMenuItem.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/tasks/client/actions/NewFolderMenuItem.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -1,38 +0,0 @@ -/* - * - * 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.tasks.client.actions; - -import cc.kune.core.client.resources.nav.NavResources; -import cc.kune.core.shared.i18n.I18nTranslationService; -import cc.kune.gspace.client.actions.NewContainerMenuItem; -import cc.kune.tasks.shared.TasksConstants; - -import com.google.inject.Inject; - -public class NewFolderMenuItem extends NewContainerMenuItem { - - @Inject - public NewFolderMenuItem(final I18nTranslationService i18n, final NewContainerAction action, - final NavResources res, final TasksNewMenu newMenu) { - super(i18n, action, res.taskfolderadd(), i18n.t("New task folder"), i18n.t("Create a new folder"), - i18n.t("New task folder"), TasksConstants.TYPE_FOLDER, newMenu.get()); - } - -} Modified: trunk/src/main/java/cc/kune/tasks/client/actions/NewTaskMenuItem.java =================================================================== --- trunk/src/main/java/cc/kune/tasks/client/actions/NewTaskMenuItem.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/tasks/client/actions/NewTaskMenuItem.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -32,7 +32,7 @@ @Inject public NewTaskMenuItem(final I18nTranslationService i18n, final NewContentAction action, - final NavResources res, final GlobalShortcutRegister shorcutReg, final TasksNewMenu tasksNewMenu) { + final NavResources res, final GlobalShortcutRegister shorcutReg, final TasksFolderNewMenu tasksNewMenu) { super(i18n, action, res.taskadd(), shorcutReg, i18n.t("New task"), i18n.t("Create a new task"), i18n.t("New task"), TasksConstants.TYPE_TASK, tasksNewMenu.get()); } Modified: trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java =================================================================== --- trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/tasks/client/actions/TasksClientActions.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -23,6 +23,7 @@ import static cc.kune.tasks.shared.TasksConstants.TYPE_ROOT; import static cc.kune.tasks.shared.TasksConstants.TYPE_TASK; import cc.kune.chat.client.actions.ChatAboutContentBtn; +import cc.kune.common.client.actions.ui.descrip.MenuDescriptor; import cc.kune.core.client.actions.ActionRegistryByType; import cc.kune.core.client.i18n.I18nUITranslationService; import cc.kune.core.client.registry.NewMenusForTypeIdsRegistry; @@ -52,14 +53,14 @@ public TasksClientActions(final I18nUITranslationService i18n, final Session session, final StateManager stateManager, final ActionRegistryByType registry, final CoreResources res, final Provider<GoParentFolderBtn> folderGoUp, final Provider<NewTaskMenuItem> newTaskItem, - final Provider<NewTaskIconBtn> newTaskIconBtn, - final Provider<NewFolderMenuItem> newFolderMenuItem, + final Provider<NewTaskIconBtn> newTaskIconBtn, final Provider<NewFolderBtn> newFolderBtn, final Provider<OpenFolderMenuItem> openContentMenuItem, final Provider<MarkAsDoneTaskMenuItem> marksAsDoneMenuItem, final Provider<MarkAsNotDoneTaskMenuItem> marksAsNotDoneMenuItem, final Provider<RefreshContentMenuItem> refresh, final Provider<ContentViewerOptionsMenu> optionsMenuContent, - final Provider<ParticipateInContentBtn> participateBtn, final TasksNewMenu taskNewMenu, + final Provider<ParticipateInContentBtn> participateBtn, + final TasksFolderNewMenu taskFolderNewMenu, final TasksNewMenu taskNewMenu, final NewMenusForTypeIdsRegistry newMenusRegistry, final Provider<ChatAboutContentBtn> chatAbout, final Provider<DelFolderMenuItem> delFolderMenuItem, final Provider<SetAsHomePageMenuItem> setAsHomePage) { @@ -67,9 +68,11 @@ actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all); actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all); actionsRegistry.addAction(ActionGroups.TOOLBAR, newTaskIconBtn, all); - actionsRegistry.addAction(ActionGroups.TOOLBAR, taskNewMenu, containers); - actionsRegistry.addAction(ActionGroups.TOOLBAR, newTaskItem, containers); - actionsRegistry.addAction(ActionGroups.TOOLBAR, newFolderMenuItem, containers); + // actionsRegistry.addAction(ActionGroups.TOOLBAR, taskFolderNewMenu, + // containers); + actionsRegistry.addAction(ActionGroups.TOOLBAR, taskNewMenu, contents); + actionsRegistry.addAction(ActionGroups.TOOLBAR, newFolderBtn, containers); + // actionsRegistry.addAction(ActionGroups.TOOLBAR, newTaskItem, containers); actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, contents); actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, containers); actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents); @@ -83,8 +86,12 @@ actionsRegistry.addAction(ActionGroups.ITEM_MENU, marksAsNotDoneMenuItem, ContentStatus.inTheDustbin, TYPE_TASK); actionsRegistry.addAction(ActionGroups.ITEM_MENU, delFolderMenuItem, containersNoRoot); - newMenusRegistry.register(TYPE_FOLDER, taskNewMenu.get()); - newMenusRegistry.register(TYPE_ROOT, taskNewMenu.get()); + // Currently new menu in folders has no sense (because we have buttons for + // the same contents) + // newMenusRegistry.register(TYPE_FOLDER, taskFolderNewMenu.get()); + // newMenusRegistry.register(TYPE_ROOT, taskFolderNewMenu.get()); + newMenusRegistry.register(TYPE_TASK, + (MenuDescriptor) taskNewMenu.get().withText(i18n.t("Add Gadget"))); } @Override Copied: trunk/src/main/java/cc/kune/tasks/client/actions/TasksFolderNewMenu.java (from rev 1556, trunk/src/main/java/cc/kune/tasks/client/actions/TasksNewMenu.java) =================================================================== --- trunk/src/main/java/cc/kune/tasks/client/actions/TasksFolderNewMenu.java (rev 0) +++ trunk/src/main/java/cc/kune/tasks/client/actions/TasksFolderNewMenu.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -0,0 +1,34 @@ +/* + * + * 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.tasks.client.actions; + +import cc.kune.gspace.client.actions.AbstractNewMenu; +import cc.kune.gspace.client.actions.NewMenuProvider; + +import com.google.inject.Inject; + +public class TasksFolderNewMenu extends NewMenuProvider { + + @Inject + public TasksFolderNewMenu(final AbstractNewMenu menu) { + super(menu); + } + +} Modified: trunk/src/main/java/cc/kune/wave/server/KuneAgent.java =================================================================== --- trunk/src/main/java/cc/kune/wave/server/KuneAgent.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/wave/server/KuneAgent.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -57,7 +57,7 @@ // } @Override - public void addGadget(final WaveRef waveName, final String author, final String gadgetUrl) { + public void addGadget(final WaveRef waveName, final String author, final URL gadgetUrl) { // TODO Auto-generated method stub } Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveService.java =================================================================== --- trunk/src/main/java/cc/kune/wave/server/KuneWaveService.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/wave/server/KuneWaveService.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -33,7 +33,7 @@ public static final String NO_TITLE = ""; public static final URL WITHOUT_GADGET = null; - void addGadget(WaveRef waveName, String author, String gadgetUrl); + void addGadget(WaveRef waveName, String author, URL gadgetUrl); void addParticipants(WaveRef waveName, String author, String userWhoAdd, String... newParticipants); Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveServiceDefault.java =================================================================== --- trunk/src/main/java/cc/kune/wave/server/KuneWaveServiceDefault.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/wave/server/KuneWaveServiceDefault.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -162,11 +162,11 @@ } @Override - public void addGadget(final WaveRef waveName, final String author, final String gadgetUrl) { + public void addGadget(final WaveRef waveName, final String author, final URL gadgetUrl) { // See DocumentModifyServiceTest final List<Element> elementsIn = Lists.newArrayListWithCapacity(1); final Map<String, String> properties = Maps.newHashMap(); - properties.put(Gadget.URL, gadgetUrl); + properties.put(Gadget.URL, gadgetUrl.toString()); properties.put(Gadget.AUTHOR, participantUtils.of(author).getAddress()); final Gadget gadget = new Gadget(properties); @@ -307,6 +307,17 @@ return createWave(title, message, NO_WAVE_TO_COPY, gadgetUrl, participantsArray); } + // public void appendGadget(final WaveRef waveName, URL gadgetUrl, final + // String author, boolean toRoot) { + // final Wavelet wavelet = fetchWave(waveName, author); + // final OperationQueue opQueue = new OperationQueue(); + // opQueue. + // final Gadget gadget = new Gadget(gadgetUrl.toString()); + // Blip blip = toRoot? wavelet.getRootBlip(): + // opQueue.appendBlipToWavelet(wavelet, author); + // blip.append(gadget); + // } + @Override public void delParticipants(final WaveRef waveName, final String whoDel, final String... participants) { final Wavelet wavelet = fetchWave(waveName, whoDel); Modified: trunk/src/main/java/cc/kune/wiki/client/WikiGinModule.java =================================================================== --- trunk/src/main/java/cc/kune/wiki/client/WikiGinModule.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/wiki/client/WikiGinModule.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -22,6 +22,7 @@ import cc.kune.common.client.ExtendedGinModule; import cc.kune.wiki.client.actions.WikiClientActions; import cc.kune.wiki.client.actions.WikiFolderNewMenu; +import cc.kune.wiki.client.actions.WikiPageNewMenu; public class WikiGinModule extends ExtendedGinModule { @@ -30,6 +31,7 @@ s(WikiClientTool.class); s(WikiClientActions.class); s(WikiFolderNewMenu.class); + s(WikiPageNewMenu.class); } } Modified: trunk/src/main/java/cc/kune/wiki/client/actions/WikiClientActions.java =================================================================== --- trunk/src/main/java/cc/kune/wiki/client/actions/WikiClientActions.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/java/cc/kune/wiki/client/actions/WikiClientActions.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -24,6 +24,7 @@ import static cc.kune.wiki.shared.WikiConstants.TYPE_UPLOADEDFILE; import static cc.kune.wiki.shared.WikiConstants.TYPE_WIKIPAGE; import cc.kune.chat.client.actions.ChatAboutContentBtn; +import cc.kune.common.client.actions.ui.descrip.MenuDescriptor; import cc.kune.core.client.actions.ActionRegistryByType; import cc.kune.core.client.i18n.I18nUITranslationService; import cc.kune.core.client.registry.NewMenusForTypeIdsRegistry; @@ -60,15 +61,20 @@ final Provider<DelFolderMenuItem> delFolderMenuItem, final Provider<NewFolderBtn> newFolderBtn, final Provider<ChatAboutContentBtn> chatAbout, final Provider<RefreshContentMenuItem> refresh, final Provider<SetAsHomePageMenuItem> setAsHomePage, - final NewMenusForTypeIdsRegistry newMenusRegistry, final WikiFolderNewMenu folderNewMenu) { + final NewMenusForTypeIdsRegistry newMenusRegistry, final WikiFolderNewMenu folderNewMenu, + final WikiPageNewMenu wikipageNewMenu) { super(session, stateManager, i18n, registry); actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all); actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all); actionsRegistry.addAction(ActionGroups.TOOLBAR, newWikiIconBtn, all); actionsRegistry.addAction(ActionGroups.TOOLBAR, newFolderBtn, containers); - actionsRegistry.addAction(ActionGroups.TOOLBAR, folderNewMenu, containers); - actionsRegistry.addAction(ActionGroups.TOOLBAR, newWikiMenuItem, containers); - actionsRegistry.addAction(ActionGroups.TOOLBAR, newFolderMenuItem, containers); + // actionsRegistry.addAction(ActionGroups.TOOLBAR, folderNewMenu, + // containers); + actionsRegistry.addAction(ActionGroups.TOOLBAR, wikipageNewMenu, contents); + // actionsRegistry.addAction(ActionGroups.TOOLBAR, newWikiMenuItem, + // containers); + // actionsRegistry.addAction(ActionGroups.TOOLBAR, newFolderMenuItem, + // containers); actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, contents); actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, containers); actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents); @@ -78,8 +84,13 @@ actionsRegistry.addAction(ActionGroups.ITEM_MENU, delContentMenuItem, contents); actionsRegistry.addAction(ActionGroups.ITEM_MENU, delFolderMenuItem, containersNoRoot); actionsRegistry.addAction(ActionGroups.ITEM_MENU, setAsHomePage, contents); - newMenusRegistry.register(TYPE_FOLDER, folderNewMenu.get()); - newMenusRegistry.register(TYPE_ROOT, folderNewMenu.get()); + // Currently new menu in folders has no sense (because we have buttons for + // the same contents) + // newMenusRegistry.register(TYPE_FOLDER, folderNewMenu.get()); + // newMenusRegistry.register(TYPE_ROOT, folderNewMenu.get()); + newMenusRegistry.register(TYPE_WIKIPAGE, + (MenuDescriptor) wikipageNewMenu.get().withText(i18n.t("Add Gadget"))); + newMenusRegistry.register(TYPE_UPLOADEDFILE, wikipageNewMenu.get()); } @Override Added: trunk/src/main/java/cc/kune/wiki/client/actions/WikiPageNewMenu.java =================================================================== --- trunk/src/main/java/cc/kune/wiki/client/actions/WikiPageNewMenu.java (rev 0) +++ trunk/src/main/java/cc/kune/wiki/client/actions/WikiPageNewMenu.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -0,0 +1,34 @@ +/* + * + * 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.wiki.client.actions; + +import cc.kune.gspace.client.actions.AbstractNewMenu; +import cc.kune.gspace.client.actions.NewMenuProvider; + +import com.google.inject.Inject; + +public class WikiPageNewMenu extends NewMenuProvider { + + @Inject + public WikiPageNewMenu(final AbstractNewMenu menu) { + super(menu); + } + +} Modified: trunk/src/main/webapp/others/kune-client-actions.xml =================================================================== --- trunk/src/main/webapp/others/kune-client-actions.xml 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/main/webapp/others/kune-client-actions.xml 2011-11-07 12:22:34 UTC (rev 1588) @@ -228,6 +228,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -255,6 +261,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -282,6 +294,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -308,6 +326,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -337,6 +361,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -350,25 +380,6 @@ <guiActionDescriptor> <type>wave-gadget</type> - <extensionName>massmob</extensionName> - <name>Add a meeting</name> - <path>New Gadget»Calendar</path> - <description>Call and speed-up of events as meeting, smartmobs, - flashmobs, protest demonstrations, etc. - </description> - <enabled>false</enabled> - <typeIds> - <typeId origTypeId="docs.folder" destTypeId="docs.doc"/> - </typeIds> - <rol> - <!-- Administrator, Editor, Viewer --> - <rolRequired>Editor</rolRequired> - <authNeed>true</authNeed> - </rol> - </guiActionDescriptor> - - <guiActionDescriptor> - <type>wave-gadget</type> <extensionName>waffle</extensionName> <name>New meet coordination</name> <path>New Gadget»Calendar</path> @@ -383,6 +394,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -405,15 +422,24 @@ the web. </description> <new-content-title>New image</new-content-title> - <new-content-textintro>Edit this to insert, resize and annotate any - image from the web. The image can be annotated (double click on - it) by any participant of this document</new-content-textintro> + <new-content-textintro>Edit this to insert, resize and annotate + any + image from the web. The image can be annotated (double click + on + it) by any participant of this document + </new-content-textintro> <enabled>true</enabled> <typeIds> <typeId origTypeId="docs.folder" destTypeId="docs.doc"/> <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -441,6 +467,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -468,6 +500,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -495,6 +533,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -524,6 +568,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -553,6 +603,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -579,6 +635,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -609,6 +671,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -637,6 +705,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -663,6 +737,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -691,6 +771,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> @@ -722,6 +808,12 @@ <typeId origTypeId="docs.root" destTypeId="docs.doc"/> <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/> <typeId origTypeId="lists.list" destTypeId="lists.post"/> + <!-- Add gadget in docs directly: --> + <typeId origTypeId="docs.doc" destTypeId="docs.doc"/> + <typeId origTypeId="blogs.post" destTypeId="blogs.post"/> + <typeId origTypeId="lists.post" destTypeId="lists.post"/> + <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/> + <typeId origTypeId="tasks.task" destTypeId="tasks.task"/> </typeIds> <rol> <!-- Administrator, Editor, Viewer --> Modified: trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java =================================================================== --- trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java 2011-11-07 00:11:05 UTC (rev 1587) +++ trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java 2011-11-07 12:22:34 UTC (rev 1588) @@ -79,7 +79,7 @@ doLogin(); final WaveRef waveletName = createTestWave(); assertNotNull(waveletName); - manager.addGadget(waveletName, getSiteAdminShortName(), TEST_GADGET); + manager.addGadget(waveletName, getSiteAdminShortName(), new URL(TEST_GADGET)); } private void addParticipant(final String whoAdds) throws IOException {