[kune-commits] r1419 - in trunk: . src/main/java/cc/kune/client src/main/java/cc/kune/core src/main/java/cc/kune/core/client src/main/java/cc/kune/core/client/actions src/main/java/cc/kune/core/client/actions/xml src/main/java/cc/kune/core/client/rpcservices src/main/java/cc/kune/core/public src/main/java/cc/kune/core/server src/main/java/cc/kune/core/server/content src/main/java/cc/kune/core/server/rpc src/main/java/cc/kune/gspace/client/actions src/main/webapp/others src/test/java/cc/kune/core/client/actions src/test/java/cc/kune/core/client/actions/xml src/test/java/org/ourproject/kune
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Sun Jun 26 05:26:13 CEST 2011
Author: vjrj_
Date: 2011-06-26 05:26:13 +0200 (Sun, 26 Jun 2011)
New Revision: 1419
Added:
trunk/src/main/java/cc/kune/core/client/actions/xml/
trunk/src/main/java/cc/kune/core/client/actions/xml/NewGadgetAction.java
trunk/src/main/java/cc/kune/core/client/actions/xml/WaveExtension.java
trunk/src/main/java/cc/kune/core/client/actions/xml/XMLActionsParser.java
trunk/src/main/java/cc/kune/core/client/actions/xml/XMLGuiActionDescriptor.java
trunk/src/main/java/cc/kune/core/client/actions/xml/XMLKuneClientActions.java
trunk/src/main/java/cc/kune/core/client/actions/xml/XMLRol.java
trunk/src/main/java/cc/kune/core/client/actions/xml/XMLTypeId.java
trunk/src/main/java/cc/kune/core/client/actions/xml/XMLWaveExtension.java
trunk/src/main/java/cc/kune/core/server/content/XMLActionReader.java
trunk/src/main/webapp/others/kune-client-actions.xml
trunk/src/test/java/cc/kune/core/client/actions/xml/
trunk/src/test/java/cc/kune/core/client/actions/xml/XMLKuneClientActionsTest.java
Removed:
trunk/src/main/java/cc/kune/core/client/actions/WaveExtension.java
trunk/src/main/java/cc/kune/core/client/actions/XMLActionsParser.java
trunk/src/main/webapp/others/kune-wave-extensions.xml
trunk/src/test/java/org/ourproject/kune/chat/
Modified:
trunk/.classpath
trunk/pom.xml
trunk/src/main/java/cc/kune/client/KuneGinjector.java
trunk/src/main/java/cc/kune/core/KuneCore.gwt.xml
trunk/src/main/java/cc/kune/core/client/CoreGinModule.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/public/ws.css
trunk/src/main/java/cc/kune/core/server/PlatformServerModule.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/gspace/client/actions/AbstractNewMenu.java
Log:
XML Actions almost finished
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2011-06-25 02:06:47 UTC (rev 1418)
+++ trunk/.classpath 2011-06-26 03:26:13 UTC (rev 1419)
@@ -136,6 +136,7 @@
<classpathentry kind="var" path="M2_REPO/org/yaml/snakeyaml/1.6/snakeyaml-1.6.jar" sourcepath="M2_REPO/org/yaml/snakeyaml/1.6/snakeyaml-1.6-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/testng/testng/6.0.1/testng-6.0.1.jar" sourcepath="M2_REPO/org/testng/testng/6.0.1/testng-6.0.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/tigase/tigase-xmltools/3.3.5/tigase-xmltools-3.3.5.jar" sourcepath="M2_REPO/tigase/tigase-xmltools/3.3.5/tigase-xmltools-3.3.5-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/waveprotocol/util-src/0.3.1-SNAPSHOT/util-src-0.3.1-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/maven/wagon/wagon-provider-api/1.0-alpha-5/wagon-provider-api-1.0-alpha-5.jar" sourcepath="M2_REPO/org/apache/maven/wagon/wagon-provider-api/1.0-alpha-5/wagon-provider-api-1.0-alpha-5-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/waveprotocol/waveinabox-server-0.3/0.3.1-SNAPSHOT/waveinabox-server-0.3-0.3.1-SNAPSHOT.jar"/>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-06-25 02:06:47 UTC (rev 1418)
+++ trunk/pom.xml 2011-06-26 03:26:13 UTC (rev 1419)
@@ -144,6 +144,11 @@
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
+ <repository>
+ <id>tigase</id>
+ <name>Tigase Repository</name>
+ <url>http://maven.tigase.org</url>
+ </repository>
</repositories>
<pluginRepositories>
<!-- cc -->
@@ -528,6 +533,12 @@
<version>6.0.1</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>tigase</groupId>
+ <artifactId>tigase-xmltools</artifactId>
+ <version>3.3.5</version>
+ <!-- <scope>test</scope> -->
+ </dependency>
<!-- If you want to start a selenium server, you will need the following
dependency: -->
<!-- <dependency> -->
Modified: trunk/src/main/java/cc/kune/client/KuneGinjector.java
===================================================================
--- trunk/src/main/java/cc/kune/client/KuneGinjector.java 2011-06-25 02:06:47 UTC (rev 1418)
+++ trunk/src/main/java/cc/kune/client/KuneGinjector.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -32,7 +32,7 @@
import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
import cc.kune.core.client.CoreGinModule;
import cc.kune.core.client.CoreParts;
-import cc.kune.core.client.actions.XMLActionsParser;
+import cc.kune.core.client.actions.xml.XMLActionsParser;
import cc.kune.core.client.auth.RegisterPresenter;
import cc.kune.core.client.auth.SignInPresenter;
import cc.kune.core.client.cookies.CookiesManager;
Modified: trunk/src/main/java/cc/kune/core/KuneCore.gwt.xml
===================================================================
--- trunk/src/main/java/cc/kune/core/KuneCore.gwt.xml 2011-06-25 02:06:47 UTC (rev 1418)
+++ trunk/src/main/java/cc/kune/core/KuneCore.gwt.xml 2011-06-26 03:26:13 UTC (rev 1419)
@@ -14,6 +14,8 @@
<inherits name="cc.kune.gspace.GSpace" />
<inherits name="cc.kune.msgs.KuneMsgs" />
<inherits name="cc.kune.common.KuneCommon" />
+ <!-- Because of XML actions -->
+ <inherits name='com.calclab.emite.core.EmiteCore' />
<inherits name="com.extjs.gxt.ui.GXT" />
<!-- <inherits name="com.jhickman.web.gwt.gxtuibinder.GxtUiBinder" />-->
<inherits name="com.calclab.suco.Suco" />
Modified: trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2011-06-25 02:06:47 UTC (rev 1418)
+++ trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -30,7 +30,7 @@
import cc.kune.common.client.ui.MaskWidget;
import cc.kune.common.client.ui.MaskWidgetView;
import cc.kune.core.client.actions.ActionRegistryByType;
-import cc.kune.core.client.actions.XMLActionsParser;
+import cc.kune.core.client.actions.xml.XMLActionsParser;
import cc.kune.core.client.auth.Register;
import cc.kune.core.client.auth.RegisterPanel;
import cc.kune.core.client.auth.RegisterPresenter;
@@ -107,6 +107,8 @@
import cc.kune.msgs.client.UserMessagesPanel;
import cc.kune.msgs.client.UserMessagesPresenter;
+import com.calclab.emite.core.client.services.Services;
+import com.calclab.emite.core.client.services.gwt.GWTServices;
import com.google.gwt.event.shared.EventBus;
import com.google.inject.Singleton;
import com.gwtplatform.mvp.client.DefaultProxyFailureHandler;
@@ -215,6 +217,7 @@
s(ErrorsDialog.class);
s(XMLActionsParser.class);
+ bind(Services.class).to(GWTServices.class);
}
}
Deleted: trunk/src/main/java/cc/kune/core/client/actions/WaveExtension.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/WaveExtension.java 2011-06-25 02:06:47 UTC (rev 1418)
+++ trunk/src/main/java/cc/kune/core/client/actions/WaveExtension.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -1,78 +0,0 @@
-package cc.kune.core.client.actions;
-
-public class WaveExtension {
- public static class Builder {
- private String gadgetUrl;
- private String iconCss;
- private String iconUrl;
- private String installerUrl;
- private String name;
-
- public Builder() {
- }
-
- public WaveExtension build() {
- return new WaveExtension(this);
- }
-
- public Builder gadgetUrl(final String gadgetUrl) {
- this.gadgetUrl = gadgetUrl;
- return this;
- }
-
- public Builder iconCss(final String iconCss) {
- this.iconCss = iconCss;
- return this;
- }
-
- public Builder iconUrl(final String iconUrl) {
- this.iconUrl = iconUrl;
- return this;
- }
-
- public Builder installerUrl(final String installerUrl) {
- this.installerUrl = installerUrl;
- return this;
- }
-
- public Builder name(final String name) {
- this.name = name;
- return this;
- }
- }
-
- private final String gadgetUrl;
- private final String iconCss;
- private final String iconUrl;
- private final String installerUrl;
- private final String name;
-
- public WaveExtension(final Builder builder) {
- gadgetUrl = builder.gadgetUrl;
- iconCss = builder.iconCss;
- iconUrl = builder.iconUrl;
- installerUrl = builder.installerUrl;
- name = builder.name;
- }
-
- public String getGadgetUrl() {
- return gadgetUrl;
- }
-
- public String getIconCss() {
- return iconCss;
- }
-
- public String getIconUrl() {
- return iconUrl;
- }
-
- public String getInstallerUrl() {
- return installerUrl;
- }
-
- public String getName() {
- return name;
- }
-
-}
Deleted: trunk/src/main/java/cc/kune/core/client/actions/XMLActionsParser.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/XMLActionsParser.java 2011-06-25 02:06:47 UTC (rev 1418)
+++ trunk/src/main/java/cc/kune/core/client/actions/XMLActionsParser.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -1,192 +0,0 @@
-package cc.kune.core.client.actions;
-
-import java.util.HashMap;
-import java.util.Map;
-
-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.actions.ui.descrip.SubMenuDescriptor;
-import cc.kune.common.client.errors.UIException;
-import cc.kune.common.client.notify.NotifyUser;
-import cc.kune.common.client.utils.TextUtils;
-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;
-import com.google.gwt.http.client.RequestCallback;
-import com.google.gwt.http.client.RequestException;
-import com.google.gwt.http.client.Response;
-import com.google.gwt.xml.client.Document;
-import com.google.gwt.xml.client.Element;
-import com.google.gwt.xml.client.Node;
-import com.google.gwt.xml.client.NodeList;
-import com.google.gwt.xml.client.XMLParser;
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-
-public class XMLActionsParser {
-
- public static class GadgetAction extends RolAction {
-
- private final Provider<ContentServiceAsync> contentService;
- private final String gadgetName;
-
- 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 static final String SEP = "»";
-
- private final ActionRegistryByType actionRegistry;
- private final Provider<ContentServiceAsync> contentService;
- private final ErrorHandler errHandler;
- private final Map<String, WaveExtension> extensionsMap;
- private final NewMenusForTypeIdsRegistry newMenusRegistry;
- private final HashMap<String, SubMenuDescriptor> submenus;
-
- @Inject
- 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>();
- submenus = new HashMap<String, SubMenuDescriptor>();
-
- // Based on:
- // http://www.roseindia.net/tutorials/gwt/retrieving-xml-data.shtml
- final RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET,
- "/others/kune-wave-extensions.xml");
- try {
- requestBuilder.sendRequest(null, new RequestCallback() {
- @Override
- public void onError(final Request request, final Throwable ex) {
- onFailed(ex);
- }
-
- @Override
- public void onResponseReceived(final Request request, final Response response) {
- parseXML(response.getText());
- }
- });
- } catch (final RequestException ex) {
- onFailed(ex);
- }
- }
-
- private String get(final Element extension, final String id) {
- final Node child = extension.getElementsByTagName(id).item(0).getFirstChild();
- return child != null ? child.getNodeValue() : "";
- }
-
- private SubMenuDescriptor getSubMenu(final MenuDescriptor menu, final String typeId,
- final String parentS) {
- final String[] path = parentS.split(SEP);
- SubMenuDescriptor current = null;
- for (int i = 0; i < path.length; i++) {
- final String name = path[i];
- final String subpathId = getSubPathId(typeId, path, i);
- SubMenuDescriptor subMenuDescriptor = submenus.get(subpathId);
- if (subMenuDescriptor == null) {
- final GuiActionDescrip parent = (i == 0 ? menu : submenus.get(getSubPathId(typeId, path, i - 1)));
- assert parent != null;
- subMenuDescriptor = new SubMenuDescriptor(parent, name);
- // subMenuDescriptor.setVisible(false);
- submenus.put(subpathId, subMenuDescriptor);
- actionRegistry.addAction(ActionGroups.TOOLBAR, subMenuDescriptor, typeId);
- }
- current = subMenuDescriptor;
- }
- assert current != null;
- return current;
- }
-
- private String getSubPathId(final String typeId, final String[] path, final int i) {
- final StringBuffer id = new StringBuffer().append(typeId);
- for (int j = 0; j <= i; j++) {
- id.append(SEP).append(path[j]);
- }
- return id.toString();
- }
-
- private void onFailed(final Throwable ex) {
- errHandler.process(ex);
- }
-
- private void parseXML(final String text) {
- final Document parse = XMLParser.parse(text);
- 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();
- final String name = get(extension, "name");
- builder.name(name);
- builder.gadgetUrl(get(extension, "gadgetUrl"));
- builder.iconUrl(get(extension, "iconUrl"));
- builder.iconCss(get(extension, "iconCss"));
- builder.installerUrl(get(extension, "installerUrl"));
- extensionsMap.put(name, builder.build());
- }
- final NodeList guiDescriptors = ((Element) parse.getElementsByTagName("guiActionDescriptors").item(0)).getElementsByTagName("guiActionDescriptor");
- for (int i = 0; i < guiDescriptors.getLength(); i++) {
- final Element guiDescriptor = (Element) guiDescriptors.item(i);
- if (Boolean.parseBoolean(get(guiDescriptor, "enabled"))) {
- final String type = get(guiDescriptor, "type");
- if (type.equals("wave-gadget")) {
- 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 String parent = get(guiDescriptor, "parent");
- final SubMenuDescriptor submenu = getSubMenu(menu, typeId, parent);
- final Provider<GuiActionDescrip> menuItemProvider = new Provider<GuiActionDescrip>() {
- @Override
- public GuiActionDescrip get() {
- final MenuItemDescriptor menuItem = new MenuItemDescriptor(action);
- menuItem.withText(name).withToolTip(description);
- menuItem.setParent(TextUtils.notEmpty(parent) ? submenu : menu);
- return menuItem;
- }
- };
- actionRegistry.addAction(ActionGroups.TOOLBAR, menuItemProvider, typeId);
- }
- }
- }
- }
- }
-}
Added: trunk/src/main/java/cc/kune/core/client/actions/xml/NewGadgetAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/xml/NewGadgetAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/actions/xml/NewGadgetAction.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -0,0 +1,56 @@
+package cc.kune.core.client.actions.xml;
+
+import cc.kune.common.client.actions.Action;
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.notify.NotifyUser;
+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.dto.StateContentDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Provider;
+
+public class NewGadgetAction extends RolAction {
+
+ private final String body;
+ private final Provider<ContentServiceAsync> contentService;
+ private final String gadgetName;
+ private final I18nTranslationService i18n;
+ private final Session session;
+ private final StateManager stateManager;
+ private final String title;
+ private final String typeId;
+
+ public NewGadgetAction(final Provider<ContentServiceAsync> contentService,
+ final StateManager stateManager, final Session session, final I18nTranslationService i18n,
+ final AccessRolDTO rol, final boolean authNeeded, final String gadgetName, final String typeId,
+ final String iconUrl, final String title, final String body) {
+ super(rol, authNeeded);
+ this.contentService = contentService;
+ this.stateManager = stateManager;
+ this.i18n = i18n;
+ this.gadgetName = gadgetName;
+ this.session = session;
+ this.typeId = typeId;
+ this.title = title;
+ this.body = body;
+ putValue(Action.SMALL_ICON, iconUrl);
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ contentService.get().addGadget(session.getUserHash(), session.getCurrentStateToken(), gadgetName,
+ typeId, i18n.t(title), i18n.t(body), new AsyncCallbackSimple<StateContentDTO>() {
+ @Override
+ public void onSuccess(final StateContentDTO result) {
+ NotifyUser.info(i18n.t("[%s] created succesfully", title));
+ stateManager.setRetrievedStateAndGo(result);
+ }
+ });
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/src/main/java/cc/kune/core/client/actions/xml/NewGadgetAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/src/main/java/cc/kune/core/client/actions/xml/WaveExtension.java (from rev 1409, trunk/src/main/java/cc/kune/core/client/actions/WaveExtension.java)
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/xml/WaveExtension.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/actions/xml/WaveExtension.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -0,0 +1,78 @@
+package cc.kune.core.client.actions.xml;
+
+public class WaveExtension {
+ public static class Builder {
+ private String gadgetUrl;
+ private String iconCss;
+ private String iconUrl;
+ private String installerUrl;
+ private String name;
+
+ public Builder() {
+ }
+
+ public WaveExtension build() {
+ return new WaveExtension(this);
+ }
+
+ public Builder gadgetUrl(final String gadgetUrl) {
+ this.gadgetUrl = gadgetUrl;
+ return this;
+ }
+
+ public Builder iconCss(final String iconCss) {
+ this.iconCss = iconCss;
+ return this;
+ }
+
+ public Builder iconUrl(final String iconUrl) {
+ this.iconUrl = iconUrl;
+ return this;
+ }
+
+ public Builder installerUrl(final String installerUrl) {
+ this.installerUrl = installerUrl;
+ return this;
+ }
+
+ public Builder name(final String name) {
+ this.name = name;
+ return this;
+ }
+ }
+
+ private final String gadgetUrl;
+ private final String iconCss;
+ private final String iconUrl;
+ private final String installerUrl;
+ private final String name;
+
+ public WaveExtension(final Builder builder) {
+ gadgetUrl = builder.gadgetUrl;
+ iconCss = builder.iconCss;
+ iconUrl = builder.iconUrl;
+ installerUrl = builder.installerUrl;
+ name = builder.name;
+ }
+
+ public String getGadgetUrl() {
+ return gadgetUrl;
+ }
+
+ public String getIconCss() {
+ return iconCss;
+ }
+
+ public String getIconUrl() {
+ return iconUrl;
+ }
+
+ public String getInstallerUrl() {
+ return installerUrl;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+}
Property changes on: trunk/src/main/java/cc/kune/core/client/actions/xml/WaveExtension.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/src/main/java/cc/kune/core/client/actions/xml/XMLActionsParser.java (from rev 1417, trunk/src/main/java/cc/kune/core/client/actions/XMLActionsParser.java)
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/xml/XMLActionsParser.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/actions/xml/XMLActionsParser.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -0,0 +1,146 @@
+package cc.kune.core.client.actions.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+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.actions.ui.descrip.SubMenuDescriptor;
+import cc.kune.common.client.utils.TextUtils;
+import cc.kune.core.client.actions.ActionRegistryByType;
+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.client.state.Session;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.ActionGroups;
+
+import com.calclab.emite.core.client.services.Services;
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.RequestException;
+import com.google.gwt.http.client.Response;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class XMLActionsParser {
+
+ public static final String ACTIONS_XML_LOCATION = "/others/kune-client-actions.xml";
+
+ private static final String SEP = "»";
+
+ private final ActionRegistryByType actionRegistry;
+ private final Provider<ContentServiceAsync> contentService;
+ private final ErrorHandler errHandler;
+ private final I18nTranslationService i18n;
+ private final NewMenusForTypeIdsRegistry newMenusRegistry;
+
+ private final Session session;
+
+ private final StateManager stateManager;
+
+ private final HashMap<String, SubMenuDescriptor> submenus;
+
+ @Inject
+ public XMLActionsParser(final ErrorHandler errHandler, final ActionRegistryByType actionRegistry,
+ final Provider<ContentServiceAsync> contentService, final Session session,
+ final StateManager stateManager, final I18nTranslationService i18n,
+ final NewMenusForTypeIdsRegistry newMenusRegistry, final Services services) {
+ this.errHandler = errHandler;
+ this.actionRegistry = actionRegistry;
+ this.contentService = contentService;
+ this.session = session;
+ this.stateManager = stateManager;
+ this.i18n = i18n;
+ this.newMenusRegistry = newMenusRegistry;
+ submenus = new HashMap<String, SubMenuDescriptor>();
+
+ // Based on:
+ // http://www.roseindia.net/tutorials/gwt/retrieving-xml-data.shtml
+ final RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, ACTIONS_XML_LOCATION);
+ try {
+ requestBuilder.sendRequest(null, new RequestCallback() {
+ @Override
+ public void onError(final Request request, final Throwable ex) {
+ onFailed(ex);
+ }
+
+ @Override
+ public void onResponseReceived(final Request request, final Response response) {
+ parse(new XMLKuneClientActions(services, response.getText()));
+ }
+ });
+ } catch (final RequestException ex) {
+ onFailed(ex);
+ }
+ }
+
+ private SubMenuDescriptor getSubMenu(final MenuDescriptor menu, final String typeId,
+ final String parentS) {
+ final String[] path = parentS.split(SEP);
+ SubMenuDescriptor current = null;
+ for (int i = 0; i < path.length; i++) {
+ final String name = path[i];
+ final String subpathId = getSubPathId(typeId, path, i);
+ SubMenuDescriptor subMenuDescriptor = submenus.get(subpathId);
+ if (subMenuDescriptor == null) {
+ final GuiActionDescrip parent = (i == 0 ? menu : submenus.get(getSubPathId(typeId, path, i - 1)));
+ assert parent != null;
+ subMenuDescriptor = new SubMenuDescriptor(parent, i18n.t(name));
+ // subMenuDescriptor.setVisible(false);
+ submenus.put(subpathId, subMenuDescriptor);
+ actionRegistry.addAction(ActionGroups.TOOLBAR, subMenuDescriptor, typeId);
+ }
+ current = subMenuDescriptor;
+ }
+ assert current != null;
+ return current;
+ }
+
+ private String getSubPathId(final String typeId, final String[] path, final int i) {
+ final StringBuffer id = new StringBuffer().append(typeId);
+ for (int j = 0; j <= i; j++) {
+ id.append(SEP).append(path[j]);
+ }
+ return id.toString();
+ }
+
+ private void onFailed(final Throwable ex) {
+ errHandler.process(ex);
+ }
+
+ private void parse(final XMLKuneClientActions xml) {
+ final Map<String, XMLWaveExtension> extensions = xml.getExtensions();
+ for (final XMLGuiActionDescriptor descrip : xml.getGuiActionDescriptors()) {
+ if (descrip.isEnabled()) {
+ final XMLWaveExtension extension = extensions.get(descrip.getExtensionName());
+ assert extension != null;
+ for (final XMLTypeId typeId : descrip.getTypeIds()) {
+ final String origTypeId = typeId.getOrigTypeId();
+ final String contentIntro = descrip.getNewContentTextIntro();
+ final NewGadgetAction action = new NewGadgetAction(contentService, 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);
+ menuItem.withText(descrip.getDescName()).withToolTip(descrip.getDescription());
+ menuItem.setParent(TextUtils.notEmpty(path) ? submenu : menu);
+ return menuItem;
+ }
+ };
+ actionRegistry.addAction(ActionGroups.TOOLBAR, menuItemProvider, origTypeId);
+ }
+ }
+ }
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/core/client/actions/xml/XMLActionsParser.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/main/java/cc/kune/core/client/actions/xml/XMLGuiActionDescriptor.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/xml/XMLGuiActionDescriptor.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/actions/xml/XMLGuiActionDescriptor.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -0,0 +1,71 @@
+package cc.kune.core.client.actions.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.calclab.emite.core.client.packet.DelegatedPacket;
+import com.calclab.emite.core.client.packet.IPacket;
+
+public class XMLGuiActionDescriptor extends DelegatedPacket {
+
+ private XMLRol rol;
+
+ private List<XMLTypeId> typeIds;
+
+ public XMLGuiActionDescriptor(final IPacket xml) {
+ super(xml);
+ }
+
+ public String getDescName() {
+ return getFirstChild("name").getText();
+ }
+
+ public String getDescription() {
+ return getFirstChild("description").getText();
+ }
+
+ public String getExtensionName() {
+ return getFirstChild("extensionName").getText();
+ }
+
+ public String getNewContentTextIntro() {
+ return getFirstChild("new-content-textintro").getText();
+ }
+
+ public String getNewContentTitle() {
+ return getFirstChild("new-content-title").getText();
+ }
+
+ public String getParticipants() {
+ return getFirstChild("participants").getText();
+ }
+
+ public String getPath() {
+ return getFirstChild("path").getText();
+ }
+
+ public XMLRol getRol() {
+ if (rol == null) {
+ rol = new XMLRol(getFirstChild("rol"));
+ }
+ return rol;
+ }
+
+ public String getType() {
+ return getFirstChild("type").getText();
+ }
+
+ public List<XMLTypeId> getTypeIds() {
+ if (typeIds == null) {
+ typeIds = new ArrayList<XMLTypeId>();
+ for (final IPacket p : getFirstChild("typeIds").getChildren()) {
+ typeIds.add(new XMLTypeId(p));
+ }
+ }
+ return typeIds;
+ }
+
+ public boolean isEnabled() {
+ return Boolean.valueOf(getFirstChild("enabled").getText());
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/core/client/actions/xml/XMLGuiActionDescriptor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/main/java/cc/kune/core/client/actions/xml/XMLKuneClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/xml/XMLKuneClientActions.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/actions/xml/XMLKuneClientActions.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -0,0 +1,41 @@
+package cc.kune.core.client.actions.xml;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.calclab.emite.core.client.packet.DelegatedPacket;
+import com.calclab.emite.core.client.packet.IPacket;
+import com.calclab.emite.core.client.services.Services;
+
+public class XMLKuneClientActions extends DelegatedPacket {
+
+ private Map<String, XMLWaveExtension> extensions;
+ private List<XMLGuiActionDescriptor> guiActionDescriptors;
+
+ public XMLKuneClientActions(final Services services, final String xmlS) {
+ super(services.toXML(xmlS));
+ }
+
+ public Map<String, XMLWaveExtension> getExtensions() {
+ if (extensions == null) {
+ extensions = new HashMap<String, XMLWaveExtension>();
+ for (final IPacket x : getFirstChild("waveExtensions").getChildren()) {
+ final XMLWaveExtension extension = new XMLWaveExtension(x);
+ extensions.put(extension.getExtName(), extension);
+ }
+ }
+ return extensions;
+ }
+
+ public List<XMLGuiActionDescriptor> getGuiActionDescriptors() {
+ if (guiActionDescriptors == null) {
+ guiActionDescriptors = new ArrayList<XMLGuiActionDescriptor>();
+ for (final IPacket x : getFirstChild("guiActionDescriptors").getChildren()) {
+ guiActionDescriptors.add(new XMLGuiActionDescriptor(x));
+ }
+ }
+ return guiActionDescriptors;
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/core/client/actions/xml/XMLKuneClientActions.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/main/java/cc/kune/core/client/actions/xml/XMLRol.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/xml/XMLRol.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/actions/xml/XMLRol.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -0,0 +1,21 @@
+package cc.kune.core.client.actions.xml;
+
+import cc.kune.core.shared.dto.AccessRolDTO;
+
+import com.calclab.emite.core.client.packet.DelegatedPacket;
+import com.calclab.emite.core.client.packet.IPacket;
+
+public class XMLRol extends DelegatedPacket {
+
+ public XMLRol(final IPacket delegate) {
+ super(delegate);
+ }
+
+ public AccessRolDTO getRolRequired() {
+ return AccessRolDTO.valueOf(getFirstChild("rolRequired").getText());
+ }
+
+ public boolean isAuthNeed() {
+ return Boolean.valueOf(getFirstChild("authNeed").getText());
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/core/client/actions/xml/XMLRol.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/main/java/cc/kune/core/client/actions/xml/XMLTypeId.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/xml/XMLTypeId.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/actions/xml/XMLTypeId.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -0,0 +1,20 @@
+package cc.kune.core.client.actions.xml;
+
+import com.calclab.emite.core.client.packet.DelegatedPacket;
+import com.calclab.emite.core.client.packet.IPacket;
+
+public class XMLTypeId extends DelegatedPacket {
+
+ public XMLTypeId(final IPacket delegate) {
+ super(delegate);
+ }
+
+ public String getDestTypeId() {
+ return getAttribute("destTypeId");
+ }
+
+ public String getOrigTypeId() {
+ return getAttribute("origTypeId");
+ }
+
+}
Property changes on: trunk/src/main/java/cc/kune/core/client/actions/xml/XMLTypeId.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/main/java/cc/kune/core/client/actions/xml/XMLWaveExtension.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/xml/XMLWaveExtension.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/actions/xml/XMLWaveExtension.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -0,0 +1,32 @@
+package cc.kune.core.client.actions.xml;
+
+import com.calclab.emite.core.client.packet.DelegatedPacket;
+import com.calclab.emite.core.client.packet.IPacket;
+
+public class XMLWaveExtension extends DelegatedPacket {
+
+ public XMLWaveExtension(final IPacket xml) {
+ super(xml);
+ }
+
+ public String getExtName() {
+ return getFirstChild("name").getText();
+ }
+
+ public String getGadgetUrl() {
+ return getFirstChild("gadgetUrl").getText();
+ }
+
+ public String getIconCss() {
+ return getFirstChild("iconCss").getText();
+ }
+
+ public String getIconUrl() {
+ return getFirstChild("iconUrl").getText();
+ }
+
+ public String getInstallerUrl() {
+ return getFirstChild("installerUrl").getText();
+ }
+
+}
Property changes on: trunk/src/main/java/cc/kune/core/client/actions/xml/XMLWaveExtension.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java 2011-06-25 02:06:47 UTC (rev 1418)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -46,6 +46,9 @@
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 addParticipant(String userHash, StateToken token, String participant) throws DefaultException;
StateContainerDTO addRoom(String user, StateToken parentToken, String name) throws DefaultException;
@@ -80,5 +83,4 @@
StateAbstractDTO setStatusAsAdmin(String userHash, StateToken stateToken, ContentStatus status);
TagCloudResult setTags(String userHash, StateToken token, String tags) 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-06-25 02:06:47 UTC (rev 1418)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -45,6 +45,9 @@
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 addParticipant(String userHash, StateToken token, String authorShortName,
AsyncCallback<Void> asyncCallback) throws DefaultException;
Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css 2011-06-25 02:06:47 UTC (rev 1418)
+++ trunk/src/main/java/cc/kune/core/public/ws.css 2011-06-26 03:26:13 UTC (rev 1419)
@@ -1,5 +1,4 @@
-CHARSET "UTF-8 ";
-body {
+CHARSET "UTF-8 "; body {
background-color: transparent;
color: black;
font-family: 'Ubuntu', Arial;
@@ -271,14 +270,16 @@
}
-.gwt-SplitLayoutPanel .gwt-SplitLayoutPanel-HDragger {
+.gwt-SplitLayoutPanel .gwt-SplitLayoutPanel-HDragger,.gwt-SplitLayoutPanel-HDragger
+ {
background-color: transparent;
background: url("images/spliter-top.png") no-repeat scroll center bottom
transparent;
cursor: col-resize;
}
-.gwt-SplitLayoutPanel .gwt-SplitLayoutPanel-VDragger {
+.gwt-SplitLayoutPanel .gwt-SplitLayoutPanel-VDragger,.gwt-SplitLayoutPanel-VDragger
+ {
background-color: white;
background: none;
cursor: row-resize;
@@ -949,9 +950,11 @@
}
.k-sn-2nd-spanel {
+
}
.k-sn-3rd-panel {
+
}
.k-sn-adminsscroll,.k-sn-collabsscroll,.k-sn-pendingsscroll {
@@ -1127,6 +1130,7 @@
}
.k-tool-panel {
+
}
.k-tool-item {
@@ -1136,6 +1140,7 @@
}
.k-tool-item-focus {
+
}
.k-tool-item-nofocus {
@@ -1143,9 +1148,11 @@
}
.k-tool-item-selected {
+
}
.k-tool-item-notselected {
+
}
.k-def-docbtn span {
@@ -1194,7 +1201,7 @@
-webkit-border-bottom-left-radius: 5px;
-moz-border-radius-bottomleft: 5px;
border-bottom-left-radius: 5px;
- kfilter: alpha(opacity = 90);
+ kfilter: alpha(opacity = 90);
-moz-opacity: 0.90;
-khtml-opacity: 0.90;
opacity: 0.90;
Modified: trunk/src/main/java/cc/kune/core/server/PlatformServerModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/PlatformServerModule.java 2011-06-25 02:06:47 UTC (rev 1418)
+++ trunk/src/main/java/cc/kune/core/server/PlatformServerModule.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -46,6 +46,7 @@
import cc.kune.core.server.content.ContentManagerDefault;
import cc.kune.core.server.content.CreationService;
import cc.kune.core.server.content.CreationServiceDefault;
+import cc.kune.core.server.content.XMLActionReader;
import cc.kune.core.server.i18n.I18nTranslationServiceDefault;
import cc.kune.core.server.manager.ExtMediaDescripManager;
import cc.kune.core.server.manager.FileManager;
@@ -151,6 +152,7 @@
bind(StateService.class).to(StateServiceDefault.class);
bind(I18nTranslationService.class).to(I18nTranslationServiceDefault.class);
bind(SessionService.class).to(SessionServiceDefault.class);
+ bind(XMLActionReader.class);
}
@Override
Modified: trunk/src/main/java/cc/kune/core/server/content/CreationService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/CreationService.java 2011-06-25 02:06:47 UTC (rev 1418)
+++ trunk/src/main/java/cc/kune/core/server/content/CreationService.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -19,7 +19,6 @@
*/
package cc.kune.core.server.content;
-
import cc.kune.domain.Container;
import cc.kune.domain.Content;
import cc.kune.domain.Group;
@@ -28,10 +27,14 @@
public interface CreationService {
- Content createContent(String title, String body, User user, Container container, String typeId);
+ Content createContent(String title, String body, User user, Container container, String typeId);
- Container createFolder(Group group, Long parentFolderId, String name, I18nLanguage language, String contentTypeId);
+ Container createFolder(Group group, Long parentFolderId, String name, I18nLanguage language,
+ String contentTypeId);
- Content saveContent(User editor, Content descriptor, String content);
+ Content createGadget(User user, Container container, String gadgetname, String typeId, String title,
+ String body);
+ Content saveContent(User editor, Content descriptor, String content);
+
}
Modified: trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java 2011-06-25 02:06:47 UTC (rev 1418)
+++ trunk/src/main/java/cc/kune/core/server/content/CreationServiceDefault.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -19,8 +19,14 @@
*/
package cc.kune.core.server.content;
+import java.net.MalformedURLException;
import java.net.URL;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import cc.kune.core.client.actions.xml.XMLKuneClientActions;
+import cc.kune.core.client.actions.xml.XMLWaveExtension;
import cc.kune.core.server.tool.ServerTool;
import cc.kune.core.server.tool.ServerToolRegistry;
import cc.kune.core.server.tool.ServerWaveTool;
@@ -36,16 +42,21 @@
@Singleton
public class CreationServiceDefault implements CreationService {
+ private final XMLKuneClientActions actions;
private final ContainerManager containerManager;
private final ContentManager contentManager;
+ private final Log LOG = LogFactory.getLog(CreationServiceDefault.class);
+
private final ServerToolRegistry tools;
@Inject
public CreationServiceDefault(final ContainerManager containerManager,
- final ContentManager contentManager, final ServerToolRegistry toolRegistry) {
+ final ContentManager contentManager, final ServerToolRegistry toolRegistry,
+ final XMLActionReader xmlActionReader) {
this.containerManager = containerManager;
this.contentManager = contentManager;
this.tools = toolRegistry;
+ this.actions = xmlActionReader.getActions();
}
@Override
@@ -73,6 +84,27 @@
}
@Override
+ public Content createGadget(final User user, final Container container, final String gadgetname,
+ final String typeIdChild, final String title, final String body) {
+ 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);
+ tool.onCreateContent(content, container);
+ return content;
+ }
+
+ @Override
public Content saveContent(final User editor, final Content content, final String body) {
return contentManager.save(editor, content, body);
}
Added: trunk/src/main/java/cc/kune/core/server/content/XMLActionReader.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/XMLActionReader.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/server/content/XMLActionReader.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -0,0 +1,40 @@
+package cc.kune.core.server.content;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.charset.Charset;
+
+import cc.kune.core.client.actions.xml.XMLActionsParser;
+import cc.kune.core.client.actions.xml.XMLKuneClientActions;
+
+import com.calclab.emite.xtesting.ServicesTester;
+import com.google.inject.Singleton;
+
+ at Singleton
+public class XMLActionReader {
+
+ private XMLKuneClientActions actions;
+
+ public XMLActionReader() throws IOException {
+ final File xmlFile = new File("src/main/webapp/" + XMLActionsParser.ACTIONS_XML_LOCATION);
+
+ // Inspired in:
+ // http://stackoverflow.com/questions/326390/how-to-create-a-java-string-from-the-contents-of-a-file
+ final FileInputStream stream = new FileInputStream(xmlFile);
+ try {
+ final FileChannel fc = stream.getChannel();
+ final MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
+ final String xml = Charset.forName("UTF-8").decode(bb).toString();
+ actions = new XMLKuneClientActions(new ServicesTester(), xml);
+ } finally {
+ stream.close();
+ }
+ }
+
+ public XMLKuneClientActions getActions() {
+ return actions;
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/core/server/content/XMLActionReader.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2011-06-25 02:06:47 UTC (rev 1418)
+++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -141,6 +141,21 @@
@Override
@Authenticated
+ @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
+ @Transactional
+ public StateContentDTO addGadget(final String userHash, final StateToken parentToken,
+ final String gadgetname, final String typeId, final String title, final String body)
+ throws DefaultException {
+ final User user = getCurrentUser();
+ final Container container = accessService.accessToContainer(
+ ContentUtils.parseId(parentToken.getFolder()), user, AccessRol.Editor);
+ final Content addedContent = creationService.createGadget(user, container, gadgetname, typeId,
+ title, body);
+ return getState(user, addedContent);
+ }
+
+ @Override
+ @Authenticated
@Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
@Transactional
public void addParticipant(final String userHash, final StateToken token, final String participant)
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/AbstractNewMenu.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/AbstractNewMenu.java 2011-06-25 02:06:47 UTC (rev 1418)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/AbstractNewMenu.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -34,7 +34,7 @@
public AbstractNewMenu(final CoreResources res, final I18nTranslationService i18n,
final AccessRightsClientManager rightsManager) {
super();
- this.withIcon(res.arrowdownsitebar()).withStyles("k-button, k-btn, k-5corners, k-def-docbtn, k-fl").withText(
+ this.withIcon(res.addGreen()).withStyles("k-button, k-btn, k-5corners, k-def-docbtn, k-fl").withText(
"New");
rightsManager.onRightsChanged(true, new AccessRightsChangedHandler() {
Copied: trunk/src/main/webapp/others/kune-client-actions.xml (from rev 1418, trunk/src/main/webapp/others/kune-wave-extensions.xml)
===================================================================
--- trunk/src/main/webapp/others/kune-client-actions.xml (rev 0)
+++ trunk/src/main/webapp/others/kune-client-actions.xml 2011-06-26 03:26:13 UTC (rev 1419)
@@ -0,0 +1,215 @@
+<?xml version="1.0" ?>
+
+<kuneClientActions>
+
+ <!-- List of Wave extensions to use in Kune ===================== -->
+ <waveExtensions>
+
+ <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>waffle</name>
+ <installerUrl>http://www.waffle.dk/install.xml
+ </installerUrl>
+ <gadgetUrl>http://www.waffle.dk/waffle.xml
+ </gadgetUrl>
+ <iconUrl>http://www.waffle.dk/waffleThumb.png
+ </iconUrl>
+ <iconCss></iconCss>
+ </extension>
+
+ <extension>
+ <name>massmob</name>
+ <installerUrl>http://mass-mob.appspot.com/massmob/massmob-extension.xml
+ </installerUrl>
+ <gadgetUrl>http://mass-mob.appspot.com/massmob/org.ourproject.massmob.client.MassmobGadget.gadget.xml
+ </gadgetUrl>
+ <iconUrl>http://mass-mob.appspot.com/logo.png
+ </iconUrl>
+ <iconCss></iconCss>
+ </extension>
+
+ <extension>
+ <name>twitter-search</name>
+ <installerUrl>https://google-wave-resources.googlecode.com/svn/trunk/samples/extensions/gadgets/twitterwidget/installer.xml
+ </installerUrl>
+ <gadgetUrl>http://google-wave-resources.googlecode.com/svn/trunk/samples/extensions/gadgets/twitterwidget/twitterwidget.xml
+ </gadgetUrl>
+ <iconUrl>http://google-wave-resources.googlecode.com/svn/trunk/samples/extensions/gadgets/twitterwidget/icon.jpg
+ </iconUrl>
+ <iconCss></iconCss>
+ </extension>
+
+ <extension>
+ <name>wavetube</name>
+ <installerUrl>http://everybodywave.appspot.com/gadget/WaveTube/xt.xml
+ </installerUrl>
+ <gadgetUrl>http://everybodywave.appspot.com/gadget/WaveTube/main.xml
+ </gadgetUrl>
+ <iconUrl>http://everybodywave.appspot.com/gadget/WaveTube/thumb.png
+ </iconUrl>
+ <iconCss></iconCss>
+ </extension>
+
+ </waveExtensions>
+
+ <!-- Where and how to use the above extensions ================ -->
+
+ <guiActionDescriptors>
+
+ <guiActionDescriptor>
+ <type>wave-gadget</type>
+ <extensionName>massmob</extensionName>
+ <name>New meeting</name>
+ <path>Gadget»Calendar</path>
+ <description>Call and speed-up of events as meeting, smartmobs,
+ flashmobs, protest demonstrations, etc.</description>
+ <new-content-title>New meeting</new-content-title>
+ <new-content-textintro></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" />
+ </typeIds>
+ <rol>
+ <!-- Administrator, Editor, Viewer -->
+ <rolRequired>Editor</rolRequired>
+ <authNeed>true</authNeed>
+ </rol>
+ <!-- only for new waves: anyone, onlymembers, onlyadmins, ask (not
+ used yet) -->
+ <participants>ask</participants>
+ </guiActionDescriptor>
+
+ <guiActionDescriptor>
+ <type>wave-gadget</type>
+ <extensionName>pollo</extensionName>
+ <name>New poll</name>
+ <path>Gadget»Voting</path>
+ <description>Make some poll (allow single and multiple polls))
+ </description>
+ <new-content-title>New poll</new-content-title>
+ <new-content-textintro></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" />
+ </typeIds>
+ <rol>
+ <!-- Administrator, Editor, Viewer -->
+ <rolRequired>Editor</rolRequired>
+ <authNeed>true</authNeed>
+ </rol>
+ <!-- only for new waves: anyone, onlymembers, onlyadmins, ask (not
+ used yet) -->
+ <participants>ask</participants>
+ </guiActionDescriptor>
+
+ <guiActionDescriptor>
+ <type>wave-gadget</type>
+ <extensionName>waffle</extensionName>
+ <name>New meet coordination</name>
+ <path>Gadget»Calendar</path>
+ <description>Users are polled to determine the best time and date
+ to meet
+ </description>
+ <new-content-title>New meet coordination</new-content-title>
+ <new-content-textintro></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" />
+ </typeIds>
+ <rol>
+ <!-- Administrator, Editor, Viewer -->
+ <rolRequired>Editor</rolRequired>
+ <authNeed>true</authNeed>
+ </rol>
+ <!-- only for new waves: anyone, onlymembers, onlyadmins, ask (not
+ used yet) -->
+ <participants>ask</participants>
+ </guiActionDescriptor>
+
+ <guiActionDescriptor>
+ <type>wave-gadget</type>
+ <extensionName>twitter-search</extensionName>
+ <name>New twitter search</name>
+ <path>Gadget»News</path>
+ <description>Shows results from Twitter for a given search term.
+ Participants can edit to specify new term.</description>
+ <new-content-title>Twitter search</new-content-title>
+ <new-content-textintro></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" />
+ </typeIds>
+ <rol>
+ <!-- Administrator, Editor, Viewer -->
+ <rolRequired>Editor</rolRequired>
+ <authNeed>true</authNeed>
+ </rol>
+ <!-- only for new waves: anyone, onlymembers, onlyadmins, ask (not
+ used yet) -->
+ <participants>ask</participants>
+ </guiActionDescriptor>
+
+ <guiActionDescriptor>
+ <type>wave-gadget</type>
+ <extensionName>wavetube</extensionName>
+ <name>New Youtube video</name>
+ <path>Gadget»Media</path>
+ <description>Adds a YouTube player that displays the list of
+ viewers in real time</description>
+ <new-content-title>New Youtube video</new-content-title>
+ <new-content-textintro></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" />
+ </typeIds>
+ <rol>
+ <!-- Administrator, Editor, Viewer -->
+ <rolRequired>Editor</rolRequired>
+ <authNeed>true</authNeed>
+ </rol>
+ <!-- only for new waves: anyone, onlymembers, onlyadmins, ask (not
+ used yet) -->
+ <participants>ask</participants>
+ </guiActionDescriptor>
+
+ <guiActionDescriptor>
+ <type>wave-gadget</type>
+ <extensionName>massmob</extensionName>
+ <name>Add a meeting</name>
+ <path>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>
+
+ </guiActionDescriptors>
+
+</kuneClientActions>
\ No newline at end of file
Property changes on: trunk/src/main/webapp/others/kune-client-actions.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/src/main/webapp/others/kune-wave-extensions.xml
===================================================================
--- trunk/src/main/webapp/others/kune-wave-extensions.xml 2011-06-25 02:06:47 UTC (rev 1418)
+++ trunk/src/main/webapp/others/kune-wave-extensions.xml 2011-06-26 03:26:13 UTC (rev 1419)
@@ -1,223 +0,0 @@
-<?xml version="1.0" ?>
-
-<kuneWaveExtensions>
-
- <!-- List of Wave extensions to use in Kune ===================== -->
-
- <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>waffle</name>
- <installerUrl>http://www.waffle.dk/install.xml
- </installerUrl>
- <gadgetUrl>http://www.waffle.dk/waffle.xml
- </gadgetUrl>
- <iconUrl>http://www.waffle.dk/waffleThumb.png
- </iconUrl>
- <iconCss></iconCss>
- </extension>
-
- <extension>
- <name>massmob</name>
- <installerUrl>http://mass-mob.appspot.com/massmob/massmob-extension.xml
- </installerUrl>
- <gadgetUrl>http://mass-mob.appspot.com/massmob/org.ourproject.massmob.client.MassmobGadget.gadget.xml
- </gadgetUrl>
- <iconUrl>http://mass-mob.appspot.com/logo.png</iconUrl>
- <iconCss></iconCss>
- </extension>
-
- <extension>
- <name>twitter-search</name>
- <installerUrl>https://google-wave-resources.googlecode.com/svn/trunk/samples/extensions/gadgets/twitterwidget/installer.xml
- </installerUrl>
- <gadgetUrl>http://google-wave-resources.googlecode.com/svn/trunk/samples/extensions/gadgets/twitterwidget/twitterwidget.xml
- </gadgetUrl>
- <iconUrl>http://google-wave-resources.googlecode.com/svn/trunk/samples/extensions/gadgets/twitterwidget/icon.jpg
- </iconUrl>
- <iconCss></iconCss>
- </extension>
-
- <extension>
- <name>wavetube</name>
- <installerUrl>http://everybodywave.appspot.com/gadget/WaveTube/xt.xml
- </installerUrl>
- <gadgetUrl>http://everybodywave.appspot.com/gadget/WaveTube/main.xml
- </gadgetUrl>
- <iconUrl>http://everybodywave.appspot.com/gadget/WaveTube/thumb.png
- </iconUrl>
- <iconCss></iconCss>
- </extension>
-
- </extensions>
-
- <!-- Where and how to use the above extensions ================ -->
-
- <guiActionDescriptors>
-
- <guiActionDescriptor>
- <type>wave-gadget</type>
- <extensionName>massmob</extensionName>
- <name>New meeting</name>
- <parent>Gadget»Calendar</parent>
- <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 (not
- used yet) -->
- <participants>ask</participants>
- </guiActionDescriptor>
-
- <guiActionDescriptor>
- <type>wave-gadget</type>
- <extensionName>pollo</extensionName>
- <name>New poll</name>
- <parent>Gadget»Voting</parent>
- <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>
- <name></name>
- <location>
- <rol>
- <!-- Administrator, Editor, Viewer -->
- <rolRequired>Editor</rolRequired>
- <authNeed>true</authNeed>
- </rol>
- </location>
- <!-- only for new waves: anyone, onlymembers, onlyadmins, ask (not
- used yet) -->
- <participants>ask</participants>
- </guiActionDescriptor>
-
- <guiActionDescriptor>
- <type>wave-gadget</type>
- <extensionName>waffle</extensionName>
- <name>New meet coordination</name>
- <parent>Gadget»Calendar</parent>
- <description>Users are polled to determine the best time and date
- to meet
- </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 (not
- used yet) -->
- <participants>ask</participants>
- </guiActionDescriptor>
-
- <guiActionDescriptor>
- <type>wave-gadget</type>
- <extensionName>twitter-search</extensionName>
- <name>New twitter search</name>
- <parent>Gadget»News</parent>
- <description>Shows results from Twitter for a given search term.
- Participants can edit to specify new term.</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 (not
- used yet) -->
- <participants>ask</participants>
- </guiActionDescriptor>
-
- <guiActionDescriptor>
- <type>wave-gadget</type>
- <extensionName>wavetube</extensionName>
- <name>New youtube video</name>
- <parent>Gadget»Media</parent>
- <description>Adds a YouTube player that displays the list of viewers in real time</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 (not
- used yet) -->
- <participants>ask</participants>
- </guiActionDescriptor>
-
-
- <guiActionDescriptor>
- <type>wave-gadget</type>
- <extensionName>massmob</extensionName>
- <name>Add a meeting</name>
- <parent>Gadget»Calendar</parent>
- <description>Call and speed-up of events as meeting, smartmobs,
- flashmobs, protest demonstrations, etc.</description>
- <enabled>false</enabled>
- <typeIds>
- <typeId>docs.doc</typeId>
- </typeIds>
- <name></name>
- <location>
- <rol>
- <!-- Administrator, Editor, Viewer -->
- <rolRequired>Editor</rolRequired>
- <authNeed>true</authNeed>
- </rol>
- </location>
- </guiActionDescriptor>
-
- </guiActionDescriptors>
-
-</kuneWaveExtensions>
\ No newline at end of file
Added: trunk/src/test/java/cc/kune/core/client/actions/xml/XMLKuneClientActionsTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/client/actions/xml/XMLKuneClientActionsTest.java (rev 0)
+++ trunk/src/test/java/cc/kune/core/client/actions/xml/XMLKuneClientActionsTest.java 2011-06-26 03:26:13 UTC (rev 1419)
@@ -0,0 +1,57 @@
+package cc.kune.core.client.actions.xml;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import cc.kune.core.server.content.XMLActionReader;
+
+public class XMLKuneClientActionsTest {
+
+ private XMLKuneClientActions actions;
+
+ @Before
+ public void before() throws IOException {
+ actions = new XMLActionReader().getActions();
+ }
+
+ @Test
+ public void testExtensions() {
+ final Map<String, XMLWaveExtension> extensions = actions.getExtensions();
+ assertTrue(extensions.size() > 0);
+ for (final XMLWaveExtension extension : extensions.values()) {
+ assertTrue(extension.getExtName().length() > 0);
+ assertTrue(extension.getGadgetUrl().length() > 0);
+ assertTrue(extension.getIconUrl().length() > 0 || extension.getIconCss().length() > 0);
+ }
+ }
+
+ @Test
+ public void testGuiActions() {
+ final List<XMLGuiActionDescriptor> guiActionDescriptors = actions.getGuiActionDescriptors();
+ assertTrue(guiActionDescriptors.size() > 0);
+ for (final XMLGuiActionDescriptor descrip : guiActionDescriptors) {
+ assertTrue(descrip.getDescName().length() > 0);
+ assertTrue(descrip.getType().length() > 0);
+ assertTrue(descrip.getExtensionName().length() > 0);
+ assertTrue(descrip.getPath().length() >= 0);
+ assertTrue(descrip.isEnabled() || !descrip.isEnabled());
+ final List<XMLTypeId> typeIds = descrip.getTypeIds();
+ assertTrue(typeIds.size() > 0);
+ for (final XMLTypeId typeId : typeIds) {
+ assertTrue(typeId.getOrigTypeId().length() > 0);
+ assertTrue(typeId.getDestTypeId().length() > 0);
+ }
+ final XMLRol rol = descrip.getRol();
+ assertNotNull(rol);
+ assertTrue(rol.isAuthNeed() || !rol.isAuthNeed());
+ assertTrue(rol.getRolRequired() != null);
+ }
+ }
+}
Property changes on: trunk/src/test/java/cc/kune/core/client/actions/xml/XMLKuneClientActionsTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the kune-commits
mailing list