From e37ebc6d0bac87aaab5e36571718dc4b230c70bb Mon Sep 17 00:00:00 2001 From: vjrj_ Date: Sun, 8 Apr 2012 19:05:06 +0000 Subject: [PATCH] Perms in Events fixed. Lists and post deletion. Wave updated. --- .classpath | 181 +++++- .project | 110 ++-- DEV-GUIDE | 3 + debian/changelog | 2 +- dev-utils/wave.patch | 335 ++++++++--- pom.xml | 31 +- src/main/java/cc/kune/KuneDev.gwt.xml | 6 +- src/main/java/cc/kune/KuneProd.gwt.xml | 4 +- .../client/actions/DelBartersMenuItem.java | 6 +- .../client/actions/DelFolderMenuItem.java | 6 +- .../kune/barters/server/BarterServerTool.java | 7 +- .../blogs/client/actions/DelBlogMenuItem.java | 6 +- .../blogs/client/actions/DelPostMenuItem.java | 6 +- .../java/cc/kune/common/KuneCommon.gwt.xml | 3 +- .../client/actions/ActionRegistryByType.java | 7 +- .../kune/core/client/errors/ErrorHandler.java | 1 + .../kune/core/server/UserSessionManager.java | 4 +- .../core/server/content/XMLActionReader.java | 6 +- .../file/FileDownloadManagerUtils.java | 8 + .../server/state/StateServiceDefault.java | 21 +- .../docs/client/actions/DelDocMenuItem.java | 6 +- .../client/actions/DelFolderMenuItem.java | 6 +- .../client/actions/DelMeetingMenuItem.java | 6 +- .../kune/events/server/EventsServerTool.java | 3 +- .../cc/kune/events/server/EventsServlet.java | 1 - .../DelContainerForAdminsMenuItem.java | 60 ++ ...va => DelContainerForEditorsMenuItem.java} | 8 +- .../actions/DelContentForAdminsMenuItem.java | 59 ++ ...java => DelContentForEditorsMenuItem.java} | 8 +- .../cc/kune/lists/client/ListsClientTool.java | 2 +- .../lists/client/actions/DelListMenuItem.java | 13 +- .../lists/client/actions/DelPostMenuItem.java | 13 +- .../client/actions/ListsClientActions.java | 2 + .../cc/kune/lists/server/rpc/ListsRPC.java | 6 +- .../client/actions/DelFolderMenuItem.java | 6 +- .../tasks/client/actions/DelTaskMenuItem.java | 6 +- .../kune/wave/client/KuneFullDomRenderer.java | 2 + .../server/CustomGadgetProviderServlet.java | 83 +++ .../java/cc/kune/wave/server/WaveMain.java | 5 +- .../client/actions/DelFolderMenuItem.java | 6 +- .../wiki/client/actions/DelWikiMenuItem.java | 6 +- src/main/webapp/others/jsongadgets.json | 550 ++++++++++++++++++ .../common/shared/utils/TextUtilsTest.java | 40 ++ .../server/integration/IntegrationTest.java | 2 +- .../server/KuneWaveServiceDefaultTest.java | 82 +-- 45 files changed, 1436 insertions(+), 298 deletions(-) create mode 100644 src/main/java/cc/kune/gspace/client/actions/DelContainerForAdminsMenuItem.java rename src/main/java/cc/kune/gspace/client/actions/{DelContainerMenuItem.java => DelContainerForEditorsMenuItem.java} (84%) create mode 100644 src/main/java/cc/kune/gspace/client/actions/DelContentForAdminsMenuItem.java rename src/main/java/cc/kune/gspace/client/actions/{DelContentMenuItem.java => DelContentForEditorsMenuItem.java} (83%) create mode 100644 src/main/java/cc/kune/wave/server/CustomGadgetProviderServlet.java create mode 100644 src/main/webapp/others/jsongadgets.json create mode 100644 src/test/java/cc/kune/common/shared/utils/TextUtilsTest.java diff --git a/.classpath b/.classpath index cfb1f2a1d..6bd7619e9 100644 --- a/.classpath +++ b/.classpath @@ -1,10 +1,173 @@ - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.project b/.project index f1159bc2f..efa41e788 100644 --- a/.project +++ b/.project @@ -1,66 +1,46 @@ - - kune - kune free/open/libre collaboration platform. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. - - - - - com.google.gdt.eclipse.core.webAppProjectValidator - - - - - com.google.gwt.eclipse.core.gwtProjectValidator - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder - - - - - com.instantiations.assist.eclipse.coverage.instrumentationBuilder - - - - - org.eclipse.recommenders.rcp.analysis.RecommendersBuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.ajdt.ui.ajnature - com.google.gwt.eclipse.core.gwtNature - edu.umd.cs.findbugs.plugin.eclipse.findbugsNature - com.instantiations.assist.eclipse.coverage.codeCoverageNature - org.eclipse.recommenders.rcp.analysis.RecommendersNature - - + kune + kune free/open/libre collaboration platform. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + + + com.google.gdt.eclipse.core.webAppProjectValidator + + + com.google.gwt.eclipse.core.gwtProjectValidator + + + org.eclipse.wst.common.project.facet.core.builder + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.wst.validation.validationbuilder + + + edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder + + + com.instantiations.assist.eclipse.coverage.instrumentationBuilder + + + org.eclipse.recommenders.rcp.analysis.RecommendersBuilder + + + org.eclipse.m2e.core.maven2Builder + + + + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.ajdt.ui.ajnature + com.google.gwt.eclipse.core.gwtNature + edu.umd.cs.findbugs.plugin.eclipse.findbugsNature + com.instantiations.assist.eclipse.coverage.codeCoverageNature + org.eclipse.recommenders.rcp.analysis.RecommendersNature + + \ No newline at end of file diff --git a/DEV-GUIDE b/DEV-GUIDE index d043eca15..8d0a39e50 100644 --- a/DEV-GUIDE +++ b/DEV-GUIDE @@ -335,6 +335,9 @@ Check also trunk/HOWTO_ADD_A_NEW_TOOL to instructions of how to add a new tool i == Google Wave == +Wave Client Development Environment Set Up (if you want to work only in the Apache Wave part): +http://www.waveprotocol.org/code/client-development-environment-set-up + David Hearnden recommendations of Wave code development (read in an informal Wave conversation): "Being written in Java, we strongly recommend following the principles outlined in Effective Java. On top of that, patterns that aid testability (dependency injection, etc) are quite important. But beyond that, I don't know if there are any other patterns or practices that would be universal across the whole thing. The web client and the server run in very different environments, so the appropriate patterns change (e.g., the client-only code doesn't have to worry about thread safety, but should worry about excessive short-lived object creation)." diff --git a/debian/changelog b/debian/changelog index cb1dc8581..15d542176 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ kune (0.1.0+b7) oneiric; urgency=low - * Improved openfire connection, debian init andº wave offline render and cache. + * Improved openfire connection, debian init and wave offline render and cache. -- Vicente J. Ruiz Jurado Mon, 02 Apr 2012 22:51:59 +0200 diff --git a/dev-utils/wave.patch b/dev-utils/wave.patch index 2a6a5b221..8ef459e1c 100644 --- a/dev-utils/wave.patch +++ b/dev-utils/wave.patch @@ -1,25 +1,28 @@ diff --git a/.classpath b/.classpath -index dbfd956..1ab7f02 100644 +index d8def03..d80d62a 100644 --- a/.classpath +++ b/.classpath -@@ -37,7 +37,7 @@ - - - -- -+ - - - -@@ -67,7 +67,7 @@ - - - -- -+ - - - +@@ -5,7 +5,7 @@ + + + +- ++ + + + +@@ -75,8 +75,8 @@ + + + +- +- +- ++ ++ ++ + + diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs index d34cf38..02223a6 100644 --- a/.settings/org.eclipse.jdt.ui.prefs @@ -88,10 +91,10 @@ index d34cf38..02223a6 100644 +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/src/org/waveprotocol/box/server/ServerMain.java b/src/org/waveprotocol/box/server/ServerMain.java -index 7ce78fb..abc5a4e 100644 +index 13a2d55..3d375fc 100644 --- a/src/org/waveprotocol/box/server/ServerMain.java +++ b/src/org/waveprotocol/box/server/ServerMain.java -@@ -211,23 +211,23 @@ public class ServerMain { +@@ -212,28 +212,28 @@ public class ServerMain { } private static void initializeServlets(Injector injector, ServerRpcProvider server) { @@ -127,9 +130,15 @@ index 7ce78fb..abc5a4e 100644 + server.addServlet("/profile/*", injector.getInstance(FetchProfilesServlet.class)); + server.addServlet("/waveref/*", injector.getInstance(WaveRefServlet.class)); + boolean enableImport = injector + .getInstance(Key.get(Boolean.class, Names.named(CoreSettings.ENABLE_IMPORT))); + if (enableImport) +- server.addServlet("/import", ImportServlet.class); ++ server.addServlet("/import", injector.getInstance(ImportServlet.class)); + String gadgetHostName = injector -@@ -236,9 +236,9 @@ public class ServerMain { +@@ -242,9 +242,9 @@ public class ServerMain { injector.getInstance(Key.get(Integer.class, Names.named(CoreSettings.GADGET_SERVER_PORT))); Map initParams = Collections.singletonMap("HostHeader", gadgetHostName + ":" + port); @@ -141,7 +150,7 @@ index 7ce78fb..abc5a4e 100644 } private static void initializeRobots(Injector injector, WaveBus waveBus) { -@@ -247,10 +247,10 @@ public class ServerMain { +@@ -253,10 +253,10 @@ public class ServerMain { } private static void initializeRobotAgents(Injector injector, ServerRpcProvider server) { @@ -512,6 +521,19 @@ index b136c88..9f1b2ab 100644 group.addClickButton(), new ToolbarClickButton.Listener() { @Override public void onClicked() { +diff --git a/src/org/waveprotocol/wave/client/StageThree.java b/src/org/waveprotocol/wave/client/StageThree.java +index 5a8de4d..b748193 100644 +--- a/src/org/waveprotocol/wave/client/StageThree.java ++++ b/src/org/waveprotocol/wave/client/StageThree.java +@@ -155,7 +155,7 @@ public interface StageThree { + String sessionId = stageTwo.getSessionId(); + + SelectionExtractor selectionExtractor = new SelectionExtractor(clock, address, sessionId); +- return EditSession.install(views, documents, selectionExtractor, focus, panel); ++ return EditSession.install(views, documents, selectionExtractor, focus, panel, getLocalDomain()); + } + + protected EditToolbar createEditToolbar() { diff --git a/src/org/waveprotocol/wave/client/doodad/link/Link.java b/src/org/waveprotocol/wave/client/doodad/link/Link.java index f5fb0e4..6b7899c 100644 --- a/src/org/waveprotocol/wave/client/doodad/link/Link.java @@ -549,81 +571,196 @@ index f5fb0e4..6b7899c 100644 return rawLinkValue; } +diff --git a/src/org/waveprotocol/wave/client/editor/Editors.java b/src/org/waveprotocol/wave/client/editor/Editors.java +index fa306d1..2c75370 100644 +--- a/src/org/waveprotocol/wave/client/editor/Editors.java ++++ b/src/org/waveprotocol/wave/client/editor/Editors.java +@@ -45,15 +45,19 @@ import org.waveprotocol.wave.model.util.CollectionUtils; + */ + public final class Editors { + ++ private static String localDomain; ++ + private Editors() { + } + + /** + * Creates an editor. ++ * @param localDomain + * + * @return New Editor instance + */ + public static Editor create() { ++ Editors.localDomain = "kk"; + Element e = Document.get().createDivElement(); + e.setClassName("editor"); + return UserAgent.isMobileWebkit() ? // \u2620 +@@ -105,7 +109,7 @@ public final class Editors { + LineRendering.registerLines(ROOT_HANDLER_REGISTRY); + + Caption.register(ROOT_HANDLER_REGISTRY); +- ChunkyElementHandler.register("br", ROOT_HANDLER_REGISTRY); ++ ChunkyElementHandler.register("br", ROOT_HANDLER_REGISTRY); + AnnotationPaint.register(ROOT_HANDLER_REGISTRY); + ImgDoodad.register(ROOT_HANDLER_REGISTRY); + +diff --git a/src/org/waveprotocol/wave/client/editor/content/misc/AnnotationPaint.java b/src/org/waveprotocol/wave/client/editor/content/misc/AnnotationPaint.java +index bb62b1a..6ad01a4 100644 +--- a/src/org/waveprotocol/wave/client/editor/content/misc/AnnotationPaint.java ++++ b/src/org/waveprotocol/wave/client/editor/content/misc/AnnotationPaint.java +@@ -82,11 +82,21 @@ public class AnnotationPaint { + /** Full tag name including namespace for boundary nodes */ + public static final String BOUNDARY_FULL_TAGNAME = "l:b"; + ++ private static AnnotationSpreadRenderer paintRenderer; ++ ++ /** ++ * Init the localDomain (used to render local links properly) ++ * @param localDomain ++ */ ++ public static void init(String localDomain) { ++ paintRenderer.setLocalDomain(localDomain); ++ } ++ + /** +- * Registers subclass with ContentElement ++ * Registers subclass with ContentElement + */ + public static void register(ElementHandlerRegistry registry) { +- AnnotationSpreadRenderer paintRenderer = new AnnotationSpreadRenderer(); ++ paintRenderer = new AnnotationSpreadRenderer(); + registry.registerRenderingMutationHandler(SPREAD_FULL_TAGNAME, paintRenderer); + registry.registerNiceHtmlRenderer(SPREAD_FULL_TAGNAME, PasteFormatRenderers.SHALLOW_CLONE_RENDERER); + +diff --git a/src/org/waveprotocol/wave/client/editor/content/misc/AnnotationSpreadRenderer.java b/src/org/waveprotocol/wave/client/editor/content/misc/AnnotationSpreadRenderer.java +index 5a88f48..f69de0d 100644 +--- a/src/org/waveprotocol/wave/client/editor/content/misc/AnnotationSpreadRenderer.java ++++ b/src/org/waveprotocol/wave/client/editor/content/misc/AnnotationSpreadRenderer.java +@@ -22,6 +22,7 @@ import com.google.gwt.dom.client.Element; + import com.google.gwt.user.client.DOM; + import com.google.gwt.user.client.Event; + import com.google.gwt.user.client.EventListener; ++import com.google.gwt.user.client.Window; + + import org.waveprotocol.wave.client.common.scrub.Scrub; + import org.waveprotocol.wave.client.common.util.DomHelper; +@@ -33,9 +34,9 @@ import org.waveprotocol.wave.client.editor.content.ContentElement; + import org.waveprotocol.wave.client.editor.content.misc.AnnotationPaint.EventHandler; + import org.waveprotocol.wave.client.editor.content.misc.AnnotationPaint.MutationHandler; + import org.waveprotocol.wave.client.scheduler.Scheduler; +-import org.waveprotocol.wave.client.scheduler.SchedulerInstance; + import org.waveprotocol.wave.client.scheduler.Scheduler.Priority; + import org.waveprotocol.wave.client.scheduler.Scheduler.Task; ++import org.waveprotocol.wave.client.scheduler.SchedulerInstance; + import org.waveprotocol.wave.model.util.ReadableStringMap.ProcV; + + import java.util.HashSet; +@@ -72,11 +73,13 @@ class AnnotationSpreadRenderer extends RenderingMutationHandler { + } + }; + ++ private String domain; ++ + private static MutationHandler getMutationHandler(ContentElement element) { + String handlerId = element.getAttribute(AnnotationPaint.MUTATION_LISTENER_ATTR); + return handlerId == null ? null : AnnotationPaint.mutationHandlerRegistry.get(handlerId); + } +- ++ + @Override + public void onActivationStart(ContentElement element) { + fanoutAttrs(element); +@@ -108,9 +111,9 @@ class AnnotationSpreadRenderer extends RenderingMutationHandler { + if (newValue != null) { + String scrubbedValue = Scrub.scrub(newValue); + implNodelet.setAttribute("href", scrubbedValue); +- if (scrubbedValue.startsWith("#")) { ++ if (scrubbedValue.startsWith("#") || (domain != null && scrubbedValue.matches("^http([s]|)://" + domain + "/.*"))) { + implNodelet.removeAttribute("target"); +- } else { ++ } else { + implNodelet.setAttribute("target", "_blank"); + } + } else { +@@ -217,4 +220,13 @@ class AnnotationSpreadRenderer extends RenderingMutationHandler { + public void onDescendantsMutated(ContentElement element) { + scheduleMutationNotification(element); + } ++ ++ /** ++ * Sets the local domain (used to render local links properly) ++ * ++ * @param localDomain the new local domain ++ */ ++ public void setLocalDomain(String localDomain) { ++ domain = localDomain; ++ } + } diff --git a/src/org/waveprotocol/wave/client/gadget/renderer/GadgetWidget.java b/src/org/waveprotocol/wave/client/gadget/renderer/GadgetWidget.java -index 7088f80..1e38273 100644 +index 1e38273..7088f80 100644 --- a/src/org/waveprotocol/wave/client/gadget/renderer/GadgetWidget.java +++ b/src/org/waveprotocol/wave/client/gadget/renderer/GadgetWidget.java -@@ -906,6 +906,7 @@ public class GadgetWidget extends ObservableSupplementedWave.ListenerImpl +@@ -906,7 +906,6 @@ public class GadgetWidget extends ObservableSupplementedWave.ListenerImpl String url = cleanUrl(metadata.getIframeUrl(view)); if (url.equals(iframeUrl) && ((token == null) || token.isEmpty())) { log("Received metadata matches the cached information."); -+ constructGadgetSizeFromMetadata(metadata, view, url); +- constructGadgetSizeFromMetadata(metadata, view, url); return; } // NOTE(user): Technically we should not save iframe URLs for gadgets with security tokens, -@@ -921,6 +922,10 @@ public class GadgetWidget extends ObservableSupplementedWave.ListenerImpl +@@ -922,10 +921,6 @@ public class GadgetWidget extends ObservableSupplementedWave.ListenerImpl if ("".equals(ui.getTitleLabelText()) && metadata.hasTitle()) { ui.setTitleLabelText(metadata.getTitle()); } -+ constructGadgetSizeFromMetadata(metadata, view, url); -+ } -+ -+ private void constructGadgetSizeFromMetadata(GadgetMetadata metadata, String view, String url) { +- constructGadgetSizeFromMetadata(metadata, view, url); +- } +- +- private void constructGadgetSizeFromMetadata(GadgetMetadata metadata, String view, String url) { int height = (int) (metadata.hasHeight() ? metadata.getHeight() : metadata.getPreferredHeight(view)); int width = +diff --git a/src/org/waveprotocol/wave/client/wavepanel/impl/edit/EditSession.java b/src/org/waveprotocol/wave/client/wavepanel/impl/edit/EditSession.java +index b4f141b..a8a5b90 100644 +--- a/src/org/waveprotocol/wave/client/wavepanel/impl/edit/EditSession.java ++++ b/src/org/waveprotocol/wave/client/wavepanel/impl/edit/EditSession.java +@@ -30,6 +30,7 @@ import org.waveprotocol.wave.client.editor.Editor; + import org.waveprotocol.wave.client.editor.EditorSettings; + import org.waveprotocol.wave.client.editor.Editors; + import org.waveprotocol.wave.client.editor.content.ContentDocument; ++import org.waveprotocol.wave.client.editor.content.misc.AnnotationPaint; + import org.waveprotocol.wave.client.editor.keys.KeyBindingRegistry; + import org.waveprotocol.wave.client.util.ClientFlags; + import org.waveprotocol.wave.client.wave.DocumentRegistry; +@@ -92,7 +93,7 @@ public final class EditSession + + public static EditSession install(ModelAsViewProvider views, + DocumentRegistry documents, +- SelectionExtractor selectionExtractor, FocusFramePresenter focus, WavePanelImpl panel) { ++ SelectionExtractor selectionExtractor, FocusFramePresenter focus, WavePanelImpl panel, String localDomain) { + EditSession edit = new EditSession(views, documents, panel.getGwtPanel(), selectionExtractor); + focus.addListener(edit); + if (panel.hasContents()) { +@@ -103,6 +104,7 @@ public final class EditSession + // Warms up the editor code (e.g., internal statics) by creating and throwing + // away an editor, in order to reduce the latency of starting the first edit + // session. ++ AnnotationPaint.init(localDomain); + Editors.create(); + + return edit; diff --git a/src/org/waveprotocol/wave/client/wavepanel/impl/toolbar/EditToolbar.java b/src/org/waveprotocol/wave/client/wavepanel/impl/toolbar/EditToolbar.java -index 73a6cfc..b8d4428 100644 +index 3a470e0..b8d4428 100644 --- a/src/org/waveprotocol/wave/client/wavepanel/impl/toolbar/EditToolbar.java +++ b/src/org/waveprotocol/wave/client/wavepanel/impl/toolbar/EditToolbar.java -@@ -56,9 +56,11 @@ import org.waveprotocol.wave.client.widget.toolbar.buttons.ToolbarClickButton; - import org.waveprotocol.wave.client.widget.toolbar.buttons.ToolbarToggleButton; - import org.waveprotocol.wave.media.model.AttachmentIdGenerator; - import org.waveprotocol.wave.media.model.AttachmentIdGeneratorImpl; -+import org.waveprotocol.wave.model.document.util.DocHelper; - import org.waveprotocol.wave.model.document.util.FocusedRange; - import org.waveprotocol.wave.model.document.util.LineContainers; - import org.waveprotocol.wave.model.document.util.Point; -+import org.waveprotocol.wave.model.document.util.Range; - import org.waveprotocol.wave.model.document.util.XmlStringBuilder; - import org.waveprotocol.wave.model.id.IdGenerator; - import org.waveprotocol.wave.model.id.WaveId; -@@ -425,18 +427,27 @@ public class EditToolbar { - Window.alert("Select some text to create a link."); - return; - } -- String rawLinkValue = -- Window.prompt("Enter link: URL or Wave ID.", WaveRefConstants.WAVE_URI_PREFIX); -- // user hit "ESC" or "cancel" -- if (rawLinkValue == null) { -- return; -- } - try { -- String linkAnnotationValue = Link.normalizeLink(rawLinkValue); -+ // We try to create a link with the current selection, if fails, we ask for a link -+ Range rg = range.asRange(); -+ String text = DocHelper.getText(editor.getDocument(), rg.getStart(), rg.getEnd()); -+ String linkAnnotationValue = Link.normalizeLink(text); - EditorAnnotationUtil.setAnnotationOverSelection(editor, Link.KEY, +@@ -436,7 +436,7 @@ public class EditToolbar { linkAnnotationValue); } catch (InvalidLinkException e) { -- Window.alert(e.getLocalizedMessage()); -+ String rawLinkValue = + String rawLinkValue = +- Window.prompt("Enter link: URL or Wave ID.", WaveRefConstants.WAVE_URI_PREFIX); + Window.prompt("Enter link: URL or Wave ID.", "http://"); -+ // user hit "ESC" or "cancel" -+ if (rawLinkValue == null) { -+ return; -+ } -+ try { -+ String linkAnnotationValue = Link.normalizeLink(rawLinkValue); -+ EditorAnnotationUtil.setAnnotationOverSelection(editor, Link.KEY, -+ linkAnnotationValue); -+ } catch (InvalidLinkException e2) { -+ Window.alert(e2.getLocalizedMessage()); -+ } - } - } - }); + // user hit "ESC" or "cancel" + if (rawLinkValue == null) { + return; diff --git a/src/org/waveprotocol/wave/client/wavepanel/impl/toolbar/gadget/GadgetInfoWidget.ui.xml b/src/org/waveprotocol/wave/client/wavepanel/impl/toolbar/gadget/GadgetInfoWidget.ui.xml index c8b7a81..5f41486 100644 --- a/src/org/waveprotocol/wave/client/wavepanel/impl/toolbar/gadget/GadgetInfoWidget.ui.xml @@ -679,6 +816,35 @@ index c8b7a81..5f41486 100644
+diff --git a/src/org/waveprotocol/wave/client/wavepanel/render/FullDomRenderer.java b/src/org/waveprotocol/wave/client/wavepanel/render/FullDomRenderer.java +index 7bf5d6e..4b5aa25 100644 +--- a/src/org/waveprotocol/wave/client/wavepanel/render/FullDomRenderer.java ++++ b/src/org/waveprotocol/wave/client/wavepanel/render/FullDomRenderer.java +@@ -24,6 +24,7 @@ import org.waveprotocol.wave.client.state.ThreadReadStateMonitor; + import org.waveprotocol.wave.client.uibuilder.HtmlClosure; + import org.waveprotocol.wave.client.uibuilder.HtmlClosureCollection; + import org.waveprotocol.wave.client.uibuilder.UiBuilder; ++import org.waveprotocol.wave.client.wavepanel.view.IntrinsicBlipMetaView; + import org.waveprotocol.wave.client.wavepanel.view.ViewIdMapper; + import org.waveprotocol.wave.client.wavepanel.view.dom.full.AnchorViewBuilder; + import org.waveprotocol.wave.client.wavepanel.view.dom.full.BlipMetaViewBuilder; +@@ -48,6 +49,7 @@ import org.waveprotocol.wave.model.wave.ParticipantId; + + import java.util.Collections; + import java.util.Comparator; ++import java.util.EnumSet; + import java.util.List; + + /** +@@ -220,6 +222,8 @@ public final class FullDomRenderer implements RenderingRules { + }; + + BlipMetaViewBuilder metaUi = BlipMetaViewBuilder.create(viewIdMapper.metaOf(blip), document); ++ if (blip.isRoot()) ++ metaUi.disable(BlipMetaViewBuilder.DELETE_MENU_OPTIONS_SET); + blipPopulator.render(blip, metaUi); + + return BlipViewBuilder.create(viewIdMapper.blipOf(blip), metaUi, threadsUi, convsUi); diff --git a/src/org/waveprotocol/wave/client/wavepanel/view/dom/BlipMenuItemDomImpl.java b/src/org/waveprotocol/wave/client/wavepanel/view/dom/BlipMenuItemDomImpl.java index 4b97489..1507f83 100644 --- a/src/org/waveprotocol/wave/client/wavepanel/view/dom/BlipMenuItemDomImpl.java @@ -760,21 +926,24 @@ index 57294ec..72b1a86 100644 .contentContainer, .replies, .privateReplies{word-wrap: break-word;} diff --git a/src/org/waveprotocol/wave/client/wavepanel/view/dom/full/BlipMetaViewBuilder.java b/src/org/waveprotocol/wave/client/wavepanel/view/dom/full/BlipMetaViewBuilder.java -index 9ec4aaf..6ccc1d1 100644 +index 9ec4aaf..aaac5be 100644 --- a/src/org/waveprotocol/wave/client/wavepanel/view/dom/full/BlipMetaViewBuilder.java +++ b/src/org/waveprotocol/wave/client/wavepanel/view/dom/full/BlipMetaViewBuilder.java -@@ -81,16 +81,26 @@ public final class BlipMetaViewBuilder implements UiBuilder, IntrinsicBlipMetaVi +@@ -81,16 +81,27 @@ public final class BlipMetaViewBuilder implements UiBuilder, IntrinsicBlipMetaVi private final static Map MENU_LABELS = new EnumMap(MenuOption.class); +- private final static StringMap MENU_OPTIONS = CollectionUtils.createStringMap(); + private final static Map MENU_ICONS = + new EnumMap(MenuOption.class); -+ - private final static StringMap MENU_OPTIONS = CollectionUtils.createStringMap(); ++ private final static StringMap MENU_OPTIONS = CollectionUtils.createStringMap(); ++ public final static Set DELETE_MENU_OPTIONS_SET = EnumSet.of(IntrinsicBlipMetaView.MenuOption.DELETE); ++ public static final String OPTION_ID_ATTRIBUTE = "o"; public static final String OPTION_SELECTED_ATTRIBUTE = "s"; - +- ++ static { + BlipIconResources.Css css = BlipIconResources.Loader.res.css(); + MENU_ICONS.put(MenuOption.EDIT, EscapeUtils.fromSafeConstant(css.edit())); @@ -790,7 +959,7 @@ index 9ec4aaf..6ccc1d1 100644 MENU_LABELS.put(MenuOption.EDIT, EscapeUtils.fromSafeConstant("Edit")); MENU_LABELS.put(MenuOption.REPLY, EscapeUtils.fromSafeConstant("Reply")); MENU_LABELS.put(MenuOption.DELETE, EscapeUtils.fromSafeConstant("Delete")); -@@ -245,6 +255,7 @@ public final class BlipMetaViewBuilder implements UiBuilder, IntrinsicBlipMetaVi +@@ -245,6 +256,7 @@ public final class BlipMetaViewBuilder implements UiBuilder, IntrinsicBlipMetaVi out.append(EscapeUtils.fromSafeConstant("|")); String style = selected.contains(option) // ? css.menuOption() + css.menuOptionSelected() : css.menuOption(); diff --git a/pom.xml b/pom.xml index e6428e3f0..bfe6c98b8 100644 --- a/pom.xml +++ b/pom.xml @@ -22,8 +22,8 @@ UTF-8 1.6.1 2.0.1 - 0.3.14 - 8.0.1.v20110908 + 0.3.15 + 8.1.1.v20120215 true @@ -429,6 +429,12 @@ commons-logging commons-logging 1.1 + + + servlet-api + javax.servlet + + commons-fileupload @@ -446,14 +452,13 @@ liquibase-plugin 1.8.1.0 - - javax.servlet - servlet-api - - 2.5 - - provided - + + + + + + + org.jukito @@ -713,6 +718,12 @@ gwtrpccommlayer 0.0.1-SNAPSHOT + + + + + + diff --git a/src/main/java/cc/kune/KuneDev.gwt.xml b/src/main/java/cc/kune/KuneDev.gwt.xml index a2cc10719..156c7c526 100644 --- a/src/main/java/cc/kune/KuneDev.gwt.xml +++ b/src/main/java/cc/kune/KuneDev.gwt.xml @@ -20,10 +20,10 @@ - + - - + + - + + diff --git a/src/main/java/cc/kune/barters/client/actions/DelBartersMenuItem.java b/src/main/java/cc/kune/barters/client/actions/DelBartersMenuItem.java index 1be450cf2..d641f3733 100644 --- a/src/main/java/cc/kune/barters/client/actions/DelBartersMenuItem.java +++ b/src/main/java/cc/kune/barters/client/actions/DelBartersMenuItem.java @@ -21,14 +21,14 @@ import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.resources.CoreResources; -import cc.kune.gspace.client.actions.DelContentMenuItem; +import cc.kune.gspace.client.actions.DelContentForEditorsMenuItem; import com.google.inject.Inject; -public class DelBartersMenuItem extends DelContentMenuItem { +public class DelBartersMenuItem extends DelContentForEditorsMenuItem { @Inject - public DelBartersMenuItem(final I18nTranslationService i18n, final DelContentAction action, final CoreResources res) { + public DelBartersMenuItem(final I18nTranslationService i18n, final DelContentForEditorsAction action, final CoreResources res) { super(i18n, action, res); } } diff --git a/src/main/java/cc/kune/barters/client/actions/DelFolderMenuItem.java b/src/main/java/cc/kune/barters/client/actions/DelFolderMenuItem.java index 441087154..c41628de7 100644 --- a/src/main/java/cc/kune/barters/client/actions/DelFolderMenuItem.java +++ b/src/main/java/cc/kune/barters/client/actions/DelFolderMenuItem.java @@ -21,14 +21,14 @@ import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.resources.CoreResources; -import cc.kune.gspace.client.actions.DelContainerMenuItem; +import cc.kune.gspace.client.actions.DelContainerForEditorsMenuItem; import com.google.inject.Inject; -public class DelFolderMenuItem extends DelContainerMenuItem { +public class DelFolderMenuItem extends DelContainerForEditorsMenuItem { @Inject - public DelFolderMenuItem(final I18nTranslationService i18n, final DelContainerAction action, final CoreResources res) { + public DelFolderMenuItem(final I18nTranslationService i18n, final DelContainerForEditorAction action, final CoreResources res) { super(i18n, action, res); } diff --git a/src/main/java/cc/kune/barters/server/BarterServerTool.java b/src/main/java/cc/kune/barters/server/BarterServerTool.java index 44ffbaed4..ef8613c0c 100644 --- a/src/main/java/cc/kune/barters/server/BarterServerTool.java +++ b/src/main/java/cc/kune/barters/server/BarterServerTool.java @@ -19,8 +19,8 @@ */ package cc.kune.barters.server; -import static cc.kune.barters.shared.BartersToolConstants.TOOL_NAME; import static cc.kune.barters.shared.BartersToolConstants.ROOT_NAME; +import static cc.kune.barters.shared.BartersToolConstants.TOOL_NAME; import static cc.kune.barters.shared.BartersToolConstants.TYPE_BARTER; import static cc.kune.barters.shared.BartersToolConstants.TYPE_FOLDER; import static cc.kune.barters.shared.BartersToolConstants.TYPE_ROOT; @@ -57,8 +57,8 @@ public class BarterServerTool extends AbstractServerTool implements ServerWaveTo public BarterServerTool(final ContentManager contentManager, final ContainerManager containerManager, final ToolConfigurationManager configurationManager, final I18nTranslationService i18n, final CreationService creationService) { - super(TOOL_NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_BARTER), Arrays.asList(TYPE_ROOT, TYPE_FOLDER), - Arrays.asList(TYPE_FOLDER), Arrays.asList(TYPE_ROOT, TYPE_FOLDER), contentManager, + super(TOOL_NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_BARTER), Arrays.asList(TYPE_ROOT, + TYPE_FOLDER), Arrays.asList(TYPE_FOLDER), Arrays.asList(TYPE_ROOT, TYPE_FOLDER), contentManager, containerManager, creationService, configurationManager, i18n, ServerToolTarget.forUsers); gadgetUrl = UrlUtils.of(BARTER_GADGET); } @@ -92,6 +92,7 @@ protected void setContainerAcl(final Container container) { bartersAcl.getAdmins().setMode(GroupListMode.NORMAL); bartersAcl.getAdmins().add(container.getOwner()); bartersAcl.getEditors().setMode(GroupListMode.NORMAL); + bartersAcl.getEditors().add(container.getOwner()); bartersAcl.getViewers().setMode(GroupListMode.EVERYONE); setAccessList(container, bartersAcl); } diff --git a/src/main/java/cc/kune/blogs/client/actions/DelBlogMenuItem.java b/src/main/java/cc/kune/blogs/client/actions/DelBlogMenuItem.java index 0f3e494fa..873b2e54d 100644 --- a/src/main/java/cc/kune/blogs/client/actions/DelBlogMenuItem.java +++ b/src/main/java/cc/kune/blogs/client/actions/DelBlogMenuItem.java @@ -21,14 +21,14 @@ import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.resources.CoreResources; -import cc.kune.gspace.client.actions.DelContainerMenuItem; +import cc.kune.gspace.client.actions.DelContainerForEditorsMenuItem; import com.google.inject.Inject; -public class DelBlogMenuItem extends DelContainerMenuItem { +public class DelBlogMenuItem extends DelContainerForEditorsMenuItem { @Inject - public DelBlogMenuItem(final I18nTranslationService i18n, final DelContainerAction action, final CoreResources res) { + public DelBlogMenuItem(final I18nTranslationService i18n, final DelContainerForEditorAction action, final CoreResources res) { super(i18n, action, res); } diff --git a/src/main/java/cc/kune/blogs/client/actions/DelPostMenuItem.java b/src/main/java/cc/kune/blogs/client/actions/DelPostMenuItem.java index bd9b61a06..b47c3d1aa 100644 --- a/src/main/java/cc/kune/blogs/client/actions/DelPostMenuItem.java +++ b/src/main/java/cc/kune/blogs/client/actions/DelPostMenuItem.java @@ -21,14 +21,14 @@ import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.resources.CoreResources; -import cc.kune.gspace.client.actions.DelContentMenuItem; +import cc.kune.gspace.client.actions.DelContentForEditorsMenuItem; import com.google.inject.Inject; -public class DelPostMenuItem extends DelContentMenuItem { +public class DelPostMenuItem extends DelContentForEditorsMenuItem { @Inject - public DelPostMenuItem(final I18nTranslationService i18n, final DelContentAction action, final CoreResources res) { + public DelPostMenuItem(final I18nTranslationService i18n, final DelContentForEditorsAction action, final CoreResources res) { super(i18n, action, res); } } diff --git a/src/main/java/cc/kune/common/KuneCommon.gwt.xml b/src/main/java/cc/kune/common/KuneCommon.gwt.xml index e526eab88..db2857c32 100644 --- a/src/main/java/cc/kune/common/KuneCommon.gwt.xml +++ b/src/main/java/cc/kune/common/KuneCommon.gwt.xml @@ -7,7 +7,8 @@ - + diff --git a/src/main/java/cc/kune/core/client/actions/ActionRegistryByType.java b/src/main/java/cc/kune/core/client/actions/ActionRegistryByType.java index 4aba31e0e..e9a2952a4 100644 --- a/src/main/java/cc/kune/core/client/actions/ActionRegistryByType.java +++ b/src/main/java/cc/kune/core/client/actions/ActionRegistryByType.java @@ -41,7 +41,6 @@ * */ public class ActionRegistryByType { - private static final String GENERIC_GROUP_ACTION = "kgengroup"; private static final String GENERIC_TYPE_ID = "kgentype"; private static final String KEY_SEPARATOR = "-"; @@ -57,10 +56,6 @@ private void add(final GuiActionDescCollection collection, final GuiActionDescri collection.add(descrip); } - // public void addAction(final Provider action) { - // addAction(GENERIC_GROUP_ACTION, action, GENERIC_TYPE_ID); - // } - public void addAction(@Nonnull final String tool, final String actionsGroupId, final GuiActionDescrip descrip, final String typeId) { addAction(tool, actionsGroupId, new Provider() { @@ -127,6 +122,8 @@ public GuiActionDescCollection getCurrentActions(final String tool, final Ob final GuiActionDescrip descrip = descripProv.get(); final AbstractAction action = descrip.getAction(); if (action instanceof RolAction) { + // Log.debug("Must add action?: " + action + ", isLogged: " + isLogged + + // ", r: " + rights); if (mustAdd((RolAction) action, isLogged, rights)) { add(collection, descrip, targetItem); } diff --git a/src/main/java/cc/kune/core/client/errors/ErrorHandler.java b/src/main/java/cc/kune/core/client/errors/ErrorHandler.java index 1cbd2253e..1eb5e888f 100644 --- a/src/main/java/cc/kune/core/client/errors/ErrorHandler.java +++ b/src/main/java/cc/kune/core/client/errors/ErrorHandler.java @@ -154,6 +154,7 @@ public void process(final Throwable caught) { eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.info, i18n.t(TextUtils.IN_DEVELOPMENT))); } else { logException(caught, true); + // FIXME: Remore "with our servers" eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error, i18n.t("Oops! Something has gone wrong with our servers. Retry later, please."))); final String error = "Other kind of exception received in ErrorHandler (" + caught.getMessage() diff --git a/src/main/java/cc/kune/core/server/UserSessionManager.java b/src/main/java/cc/kune/core/server/UserSessionManager.java index ea42dc172..0942e2a4c 100644 --- a/src/main/java/cc/kune/core/server/UserSessionManager.java +++ b/src/main/java/cc/kune/core/server/UserSessionManager.java @@ -45,9 +45,9 @@ public UserSessionManager(final UserManager manager, final Provider this.manager = manager; this.userSessionProv = userSessionProv; final HashSessionManager hSessionManager = (HashSessionManager) jettySessionManager; - hSessionManager.setMaxInactiveInterval(-1); + // hSessionManager.setMaxInactiveInterval(-1); // this prevent saving the session?? - hSessionManager.setUsingCookies(true); + // hSessionManager.setUsingCookies(true); hSessionManager.setSavePeriod(5); // For now the implementation of this can be very inaccurate (if we // login/logout several times with different clients) and not scalable diff --git a/src/main/java/cc/kune/core/server/content/XMLActionReader.java b/src/main/java/cc/kune/core/server/content/XMLActionReader.java index 781ff50f9..1318fe927 100644 --- a/src/main/java/cc/kune/core/server/content/XMLActionReader.java +++ b/src/main/java/cc/kune/core/server/content/XMLActionReader.java @@ -21,10 +21,8 @@ import java.io.IOException; import java.io.InputStream; -import java.io.StringWriter; import java.util.List; -import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.waveprotocol.box.server.CoreSettings; @@ -48,9 +46,7 @@ public XMLActionReader(@Named(CoreSettings.RESOURCE_BASES) final List re try { final InputStream iStream = FileDownloadManagerUtils.getInputStreamInResourceBases(resourceBases, XMLActionsConstants.ACTIONS_XML_LOCATION_PATH_ABS); - final StringWriter writer = new StringWriter(); - IOUtils.copy(iStream, writer, "UTF-8"); - final String xml = writer.toString(); + final String xml = FileDownloadManagerUtils.getInpuStreamAsString(iStream); actions = new XMLKuneClientActions(new ServicesTester(), xml); } catch (final IOException e) { LOG.error("Error reading extension actions", e); diff --git a/src/main/java/cc/kune/core/server/manager/file/FileDownloadManagerUtils.java b/src/main/java/cc/kune/core/server/manager/file/FileDownloadManagerUtils.java index b7293688f..f41d46d96 100644 --- a/src/main/java/cc/kune/core/server/manager/file/FileDownloadManagerUtils.java +++ b/src/main/java/cc/kune/core/server/manager/file/FileDownloadManagerUtils.java @@ -26,10 +26,12 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.StringWriter; import java.util.List; import javax.servlet.http.HttpServletResponse; +import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -37,6 +39,12 @@ public class FileDownloadManagerUtils { public static final Log LOG = LogFactory.getLog(FileDownloadManagerUtils.class); + public static String getInpuStreamAsString(final InputStream iStream) throws IOException { + final StringWriter writer = new StringWriter(); + IOUtils.copy(iStream, writer, "UTF-8"); + return writer.toString(); + } + public static InputStream getInputStreamInResourceBases(final List resourceBases, final String filename) { InputStream in = null; diff --git a/src/main/java/cc/kune/core/server/state/StateServiceDefault.java b/src/main/java/cc/kune/core/server/state/StateServiceDefault.java index 094ccf21b..b906a3118 100644 --- a/src/main/java/cc/kune/core/server/state/StateServiceDefault.java +++ b/src/main/java/cc/kune/core/server/state/StateServiceDefault.java @@ -21,9 +21,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.waveprotocol.wave.model.waveref.InvalidWaveRefException; import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder; import cc.kune.common.shared.i18n.I18nTranslationService; +import cc.kune.common.shared.utils.TextUtils; import cc.kune.core.server.access.AccessRightsService; import cc.kune.core.server.manager.GroupManager; import cc.kune.core.server.manager.SocialNetworkManager; @@ -107,12 +109,13 @@ public StateContent create(final User userLogged, final Content content) { final char[] text = revision.getBody(); final String textBody = text == null ? null : new String(text); if (content.isWave()) { - final String waveId = content.getWaveId(); - state.setWaveRef(waveId); + final String waveRef = content.getWaveId(); + state.setWaveRef(waveRef); try { // FIXME if we remove the authors this fails... final Wavelet wavelet = kuneWaveService.fetchWave( - JavaWaverefEncoder.decodeWaveRefFromPath(waveId), content.getAuthors().get(0).getShortName()); + JavaWaverefEncoder.decodeWaveRefFromPath(waveRef), + content.getAuthors().get(0).getShortName()); // final String currentContent = wavelet.getRootBlip().getContent(); state.setContent(renderedWaves.getOrRender(wavelet)); @@ -126,12 +129,18 @@ public StateContent create(final User userLogged, final Content content) { state.setIsParticipant(userLogged != User.UNKNOWN_USER ? kuneWaveService.isParticipant(wavelet, userLogged.getShortName()) : false); } catch (final Exception e) { - LOG.error("Error accessing wave " + waveId, e); + LOG.error("Error accessing wave " + waveRef, e); + String waveUrl = null; + try { + waveUrl = TextUtils.generateHtmlLink( + JavaWaverefEncoder.encodeToUriPathSegment(JavaWaverefEncoder.decodeWaveRefFromPath(waveRef)), + waveRef, false); + } catch (final InvalidWaveRefException invalidEx) { + } state.setContent(i18n.t("Error accessing this document. " + "Please contact the administrators providing this reference ([%s]) " - + "and any other relevant info.", waveId)); + + "and any other relevant info.", (waveUrl == null ? waveRef : waveUrl))); state.setTitle(revision.getTitle()); - // throw new DefaultException("Error retriving Wave"); } } else { state.setContent(textBody); diff --git a/src/main/java/cc/kune/docs/client/actions/DelDocMenuItem.java b/src/main/java/cc/kune/docs/client/actions/DelDocMenuItem.java index fc330b872..91c6c7a68 100644 --- a/src/main/java/cc/kune/docs/client/actions/DelDocMenuItem.java +++ b/src/main/java/cc/kune/docs/client/actions/DelDocMenuItem.java @@ -21,14 +21,14 @@ import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.resources.CoreResources; -import cc.kune.gspace.client.actions.DelContentMenuItem; +import cc.kune.gspace.client.actions.DelContentForEditorsMenuItem; import com.google.inject.Inject; -public class DelDocMenuItem extends DelContentMenuItem { +public class DelDocMenuItem extends DelContentForEditorsMenuItem { @Inject - public DelDocMenuItem(final I18nTranslationService i18n, final DelContentAction action, final CoreResources res) { + public DelDocMenuItem(final I18nTranslationService i18n, final DelContentForEditorsAction action, final CoreResources res) { super(i18n, action, res); } } diff --git a/src/main/java/cc/kune/docs/client/actions/DelFolderMenuItem.java b/src/main/java/cc/kune/docs/client/actions/DelFolderMenuItem.java index 9e009b944..09c10ea90 100644 --- a/src/main/java/cc/kune/docs/client/actions/DelFolderMenuItem.java +++ b/src/main/java/cc/kune/docs/client/actions/DelFolderMenuItem.java @@ -21,14 +21,14 @@ import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.resources.CoreResources; -import cc.kune.gspace.client.actions.DelContainerMenuItem; +import cc.kune.gspace.client.actions.DelContainerForEditorsMenuItem; import com.google.inject.Inject; -public class DelFolderMenuItem extends DelContainerMenuItem { +public class DelFolderMenuItem extends DelContainerForEditorsMenuItem { @Inject - public DelFolderMenuItem(final I18nTranslationService i18n, final DelContainerAction action, final CoreResources res) { + public DelFolderMenuItem(final I18nTranslationService i18n, final DelContainerForEditorAction action, final CoreResources res) { super(i18n, action, res); } diff --git a/src/main/java/cc/kune/events/client/actions/DelMeetingMenuItem.java b/src/main/java/cc/kune/events/client/actions/DelMeetingMenuItem.java index 6150b6c2a..97780ed1a 100644 --- a/src/main/java/cc/kune/events/client/actions/DelMeetingMenuItem.java +++ b/src/main/java/cc/kune/events/client/actions/DelMeetingMenuItem.java @@ -21,14 +21,14 @@ import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.resources.CoreResources; -import cc.kune.gspace.client.actions.DelContentMenuItem; +import cc.kune.gspace.client.actions.DelContentForEditorsMenuItem; import com.google.inject.Inject; -public class DelMeetingMenuItem extends DelContentMenuItem { +public class DelMeetingMenuItem extends DelContentForEditorsMenuItem { @Inject - public DelMeetingMenuItem(final I18nTranslationService i18n, final DelContentAction action, final CoreResources res) { + public DelMeetingMenuItem(final I18nTranslationService i18n, final DelContentForEditorsAction action, final CoreResources res) { super(i18n, action, res); } } diff --git a/src/main/java/cc/kune/events/server/EventsServerTool.java b/src/main/java/cc/kune/events/server/EventsServerTool.java index 12e06d2f8..04982fbd6 100644 --- a/src/main/java/cc/kune/events/server/EventsServerTool.java +++ b/src/main/java/cc/kune/events/server/EventsServerTool.java @@ -19,8 +19,8 @@ */ package cc.kune.events.server; -import static cc.kune.events.shared.EventsToolConstants.TOOL_NAME; import static cc.kune.events.shared.EventsToolConstants.ROOT_NAME; +import static cc.kune.events.shared.EventsToolConstants.TOOL_NAME; import static cc.kune.events.shared.EventsToolConstants.TYPE_MEETING; import static cc.kune.events.shared.EventsToolConstants.TYPE_ROOT; @@ -95,6 +95,7 @@ protected void setContainerAcl(final Container container) { meetsAcl.getAdmins().setMode(GroupListMode.NORMAL); meetsAcl.getAdmins().add(container.getOwner()); meetsAcl.getEditors().setMode(GroupListMode.NORMAL); + meetsAcl.getEditors().add(container.getOwner()); meetsAcl.getViewers().setMode(GroupListMode.EVERYONE); setAccessList(container, meetsAcl); } diff --git a/src/main/java/cc/kune/events/server/EventsServlet.java b/src/main/java/cc/kune/events/server/EventsServlet.java index 8362d0fa8..e86cca720 100644 --- a/src/main/java/cc/kune/events/server/EventsServlet.java +++ b/src/main/java/cc/kune/events/server/EventsServlet.java @@ -109,7 +109,6 @@ protected void doGet(final HttpServletRequest req, final HttpServletResponse res final OutputStream out = resp.getOutputStream(); final CalendarOutputter outputter = new CalendarOutputter(); outputter.output(calendar, out); - } catch (final ContentNotFoundException e) { return404(resp); return; diff --git a/src/main/java/cc/kune/gspace/client/actions/DelContainerForAdminsMenuItem.java b/src/main/java/cc/kune/gspace/client/actions/DelContainerForAdminsMenuItem.java new file mode 100644 index 000000000..e28a085ea --- /dev/null +++ b/src/main/java/cc/kune/gspace/client/actions/DelContainerForAdminsMenuItem.java @@ -0,0 +1,60 @@ +/* + * + * 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 . + * + */ +package cc.kune.gspace.client.actions; + +import cc.kune.common.client.actions.ActionEvent; +import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor; +import cc.kune.common.shared.i18n.I18nTranslationService; +import cc.kune.core.client.actions.RolAction; +import cc.kune.core.client.resources.CoreResources; +import cc.kune.core.client.rpcservices.ContentServiceHelper; +import cc.kune.core.shared.domain.utils.StateToken; +import cc.kune.core.shared.dto.AbstractContentSimpleDTO; +import cc.kune.core.shared.dto.AccessRolDTO; + +import com.google.inject.Inject; + +public class DelContainerForAdminsMenuItem extends MenuItemDescriptor { + + public static class DelContainerForAdminsAction extends RolAction { + + private final ContentServiceHelper contentService; + + @Inject + public DelContainerForAdminsAction(final ContentServiceHelper contentService) { + super(AccessRolDTO.Administrator, true); + this.contentService = contentService; + } + + @Override + public void actionPerformed(final ActionEvent event) { + final StateToken token = ((AbstractContentSimpleDTO) event.getTarget()).getStateToken(); + contentService.delContent(token); + } + + } + + public DelContainerForAdminsMenuItem(final I18nTranslationService i18n, + final DelContainerForAdminsAction action, final CoreResources res) { + super(action); + this.withText(i18n.t("Delete")).withIcon(res.cancel()); + } + +} diff --git a/src/main/java/cc/kune/gspace/client/actions/DelContainerMenuItem.java b/src/main/java/cc/kune/gspace/client/actions/DelContainerForEditorsMenuItem.java similarity index 84% rename from src/main/java/cc/kune/gspace/client/actions/DelContainerMenuItem.java rename to src/main/java/cc/kune/gspace/client/actions/DelContainerForEditorsMenuItem.java index fde7e8467..5312ca92a 100644 --- a/src/main/java/cc/kune/gspace/client/actions/DelContainerMenuItem.java +++ b/src/main/java/cc/kune/gspace/client/actions/DelContainerForEditorsMenuItem.java @@ -31,14 +31,14 @@ import com.google.inject.Inject; -public class DelContainerMenuItem extends MenuItemDescriptor { +public class DelContainerForEditorsMenuItem extends MenuItemDescriptor { - public static class DelContainerAction extends RolAction { + public static class DelContainerForEditorAction extends RolAction { private final ContentServiceHelper contentService; @Inject - public DelContainerAction(final ContentServiceHelper contentService) { + public DelContainerForEditorAction(final ContentServiceHelper contentService) { super(AccessRolDTO.Editor, true); this.contentService = contentService; } @@ -51,7 +51,7 @@ public void actionPerformed(final ActionEvent event) { } - public DelContainerMenuItem(final I18nTranslationService i18n, final DelContainerAction action, + public DelContainerForEditorsMenuItem(final I18nTranslationService i18n, final DelContainerForEditorAction action, final CoreResources res) { super(action); this.withText(i18n.t("Delete")).withIcon(res.cancel()); diff --git a/src/main/java/cc/kune/gspace/client/actions/DelContentForAdminsMenuItem.java b/src/main/java/cc/kune/gspace/client/actions/DelContentForAdminsMenuItem.java new file mode 100644 index 000000000..b7ea933a9 --- /dev/null +++ b/src/main/java/cc/kune/gspace/client/actions/DelContentForAdminsMenuItem.java @@ -0,0 +1,59 @@ +/* + * + * 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 . + * + */ +package cc.kune.gspace.client.actions; + +import cc.kune.common.client.actions.ActionEvent; +import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor; +import cc.kune.common.shared.i18n.I18nTranslationService; +import cc.kune.core.client.actions.RolAction; +import cc.kune.core.client.resources.CoreResources; +import cc.kune.core.client.rpcservices.ContentServiceHelper; +import cc.kune.core.shared.dto.AbstractContentSimpleDTO; +import cc.kune.core.shared.dto.AccessRolDTO; + +import com.google.inject.Inject; + +public class DelContentForAdminsMenuItem extends MenuItemDescriptor { + + public static class DelContentForAdminsAction extends RolAction { + + private final ContentServiceHelper contentService; + + @Inject + public DelContentForAdminsAction(final ContentServiceHelper contentService) { + super(AccessRolDTO.Administrator, true); + this.contentService = contentService; + + } + + @Override + public void actionPerformed(final ActionEvent event) { + contentService.delContent(((AbstractContentSimpleDTO) event.getTarget()).getStateToken()); + } + + } + + public DelContentForAdminsMenuItem(final I18nTranslationService i18n, + final DelContentForAdminsAction action, final CoreResources res) { + super(action); + this.withText(i18n.t("Delete")).withIcon(res.cancel()); + } + +} diff --git a/src/main/java/cc/kune/gspace/client/actions/DelContentMenuItem.java b/src/main/java/cc/kune/gspace/client/actions/DelContentForEditorsMenuItem.java similarity index 83% rename from src/main/java/cc/kune/gspace/client/actions/DelContentMenuItem.java rename to src/main/java/cc/kune/gspace/client/actions/DelContentForEditorsMenuItem.java index d32f4fde6..caebf0b5d 100644 --- a/src/main/java/cc/kune/gspace/client/actions/DelContentMenuItem.java +++ b/src/main/java/cc/kune/gspace/client/actions/DelContentForEditorsMenuItem.java @@ -30,14 +30,14 @@ import com.google.inject.Inject; -public class DelContentMenuItem extends MenuItemDescriptor { +public class DelContentForEditorsMenuItem extends MenuItemDescriptor { - public static class DelContentAction extends RolAction { + public static class DelContentForEditorsAction extends RolAction { private final ContentServiceHelper contentService; @Inject - public DelContentAction(final ContentServiceHelper contentService) { + public DelContentForEditorsAction(final ContentServiceHelper contentService) { super(AccessRolDTO.Editor, true); this.contentService = contentService; @@ -50,7 +50,7 @@ public void actionPerformed(final ActionEvent event) { } - public DelContentMenuItem(final I18nTranslationService i18n, final DelContentAction action, + public DelContentForEditorsMenuItem(final I18nTranslationService i18n, final DelContentForEditorsAction action, final CoreResources res) { super(action); this.withText(i18n.t("Delete")).withIcon(res.cancel()); diff --git a/src/main/java/cc/kune/lists/client/ListsClientTool.java b/src/main/java/cc/kune/lists/client/ListsClientTool.java index d87356e8f..88b3765c4 100644 --- a/src/main/java/cc/kune/lists/client/ListsClientTool.java +++ b/src/main/java/cc/kune/lists/client/ListsClientTool.java @@ -19,8 +19,8 @@ */ package cc.kune.lists.client; -import static cc.kune.lists.shared.ListsToolConstants.TOOL_NAME; import static cc.kune.lists.shared.ListsToolConstants.ROOT_NAME; +import static cc.kune.lists.shared.ListsToolConstants.TOOL_NAME; import static cc.kune.lists.shared.ListsToolConstants.TYPE_LIST; import static cc.kune.lists.shared.ListsToolConstants.TYPE_POST; import static cc.kune.lists.shared.ListsToolConstants.TYPE_ROOT; diff --git a/src/main/java/cc/kune/lists/client/actions/DelListMenuItem.java b/src/main/java/cc/kune/lists/client/actions/DelListMenuItem.java index 628a128eb..2ed09735d 100644 --- a/src/main/java/cc/kune/lists/client/actions/DelListMenuItem.java +++ b/src/main/java/cc/kune/lists/client/actions/DelListMenuItem.java @@ -21,15 +21,16 @@ import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.resources.CoreResources; -import cc.kune.gspace.client.actions.DelContainerMenuItem; +import cc.kune.gspace.client.actions.DelContainerForAdminsMenuItem; import com.google.inject.Inject; -public class DelListMenuItem extends DelContainerMenuItem { +public class DelListMenuItem extends DelContainerForAdminsMenuItem { - @Inject - public DelListMenuItem(final I18nTranslationService i18n, final DelContainerAction action, final CoreResources res) { - super(i18n, action, res); - } + @Inject + public DelListMenuItem(final I18nTranslationService i18n, final DelContainerForAdminsAction action, + final CoreResources res) { + super(i18n, action, res); + } } diff --git a/src/main/java/cc/kune/lists/client/actions/DelPostMenuItem.java b/src/main/java/cc/kune/lists/client/actions/DelPostMenuItem.java index 077427593..cecdc707f 100644 --- a/src/main/java/cc/kune/lists/client/actions/DelPostMenuItem.java +++ b/src/main/java/cc/kune/lists/client/actions/DelPostMenuItem.java @@ -21,14 +21,15 @@ import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.resources.CoreResources; -import cc.kune.gspace.client.actions.DelContentMenuItem; +import cc.kune.gspace.client.actions.DelContentForAdminsMenuItem; import com.google.inject.Inject; -public class DelPostMenuItem extends DelContentMenuItem { +public class DelPostMenuItem extends DelContentForAdminsMenuItem { - @Inject - public DelPostMenuItem(final I18nTranslationService i18n, final DelContentAction action, final CoreResources res) { - super(i18n, action, res); - } + @Inject + public DelPostMenuItem(final I18nTranslationService i18n, final DelContentForAdminsAction action, + final CoreResources res) { + super(i18n, action, res); + } } diff --git a/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java b/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java index 8b7bb2d36..5a3a30ac1 100644 --- a/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java +++ b/src/main/java/cc/kune/lists/client/actions/ListsClientActions.java @@ -89,6 +89,7 @@ public ListsClientActions(final I18nUITranslationService i18n, final Session ses final Provider writeToParticipants, final ListsNewMenu listNewMenu, final PostNewMenu postNewMenu, final NewMenusForTypeIdsRegistry newMenusRegistry, final Provider chatAbout, final Provider delFolderMenuItem, + final Provider delPostMenuItem, final Provider setAsHomePage) { super(session, stateManager, i18n, registry); actionsRegistry.addAction(TOOL_NAME, ActionGroups.TOPBAR, optionsMenuContainer, containers); @@ -120,6 +121,7 @@ public ListsClientActions(final I18nUITranslationService i18n, final Session ses actionsRegistry.addAction(TOOL_NAME, ActionGroups.ITEM_MENU, openContentMenuItem, contents); actionsRegistry.addAction(TOOL_NAME, ActionGroups.ITEM_MENU, openContentMenuItem, containersNoRoot); actionsRegistry.addAction(TOOL_NAME, ActionGroups.ITEM_MENU, delFolderMenuItem, containersNoRoot); + actionsRegistry.addAction(TOOL_NAME, ActionGroups.ITEM_MENU, delPostMenuItem, contents); actionsRegistry.addAction(TOOL_NAME, ActionGroups.ITEM_MENU, addAllMenuItem, contents); actionsRegistry.addAction(TOOL_NAME, ActionGroups.ITEM_MENU, addAdminMembersMenuItem, contents); actionsRegistry.addAction(TOOL_NAME, ActionGroups.ITEM_MENU, addCollabMembersMenuItem, contents); diff --git a/src/main/java/cc/kune/lists/server/rpc/ListsRPC.java b/src/main/java/cc/kune/lists/server/rpc/ListsRPC.java index 70cdad78d..f21540dbe 100644 --- a/src/main/java/cc/kune/lists/server/rpc/ListsRPC.java +++ b/src/main/java/cc/kune/lists/server/rpc/ListsRPC.java @@ -56,7 +56,7 @@ public ListsRPC(final ContentRPC contentRPC, final UserSessionManager userSessio } private String composeListName(final StateToken parentToken, final String listname) { - // FIXME In the future use tabs here + // FIXME In the future use tags here return parentToken.getGroup() + "-" + listname; } @@ -65,9 +65,9 @@ private String composeListName(final StateToken parentToken, final String listna @Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.container) @KuneTransactional public StateContainerDTO createList(final String userHash, final StateToken parentToken, - final String listaName, final String description, final boolean isPublic) { + final String listName, final String description, final boolean isPublic) { final StateContainerDTO result = contentRPC.addFolder(userHash, parentToken, - composeListName(parentToken, listaName), ListsToolConstants.TYPE_LIST); + composeListName(parentToken, listName), ListsToolConstants.TYPE_LIST); // Not public list, don't permit subscriptions neither view posts return contentRPC.getState(setContainerAcl(result.getStateToken(), isPublic)); } diff --git a/src/main/java/cc/kune/tasks/client/actions/DelFolderMenuItem.java b/src/main/java/cc/kune/tasks/client/actions/DelFolderMenuItem.java index 7c25007a8..f8d931b19 100644 --- a/src/main/java/cc/kune/tasks/client/actions/DelFolderMenuItem.java +++ b/src/main/java/cc/kune/tasks/client/actions/DelFolderMenuItem.java @@ -21,14 +21,14 @@ import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.resources.CoreResources; -import cc.kune.gspace.client.actions.DelContainerMenuItem; +import cc.kune.gspace.client.actions.DelContainerForEditorsMenuItem; import com.google.inject.Inject; -public class DelFolderMenuItem extends DelContainerMenuItem { +public class DelFolderMenuItem extends DelContainerForEditorsMenuItem { @Inject - public DelFolderMenuItem(final I18nTranslationService i18n, final DelContainerAction action, final CoreResources res) { + public DelFolderMenuItem(final I18nTranslationService i18n, final DelContainerForEditorAction action, final CoreResources res) { super(i18n, action, res); } diff --git a/src/main/java/cc/kune/tasks/client/actions/DelTaskMenuItem.java b/src/main/java/cc/kune/tasks/client/actions/DelTaskMenuItem.java index 483ed58c2..4f214f9be 100644 --- a/src/main/java/cc/kune/tasks/client/actions/DelTaskMenuItem.java +++ b/src/main/java/cc/kune/tasks/client/actions/DelTaskMenuItem.java @@ -21,14 +21,14 @@ import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.resources.CoreResources; -import cc.kune.gspace.client.actions.DelContentMenuItem; +import cc.kune.gspace.client.actions.DelContentForEditorsMenuItem; import com.google.inject.Inject; -public class DelTaskMenuItem extends DelContentMenuItem { +public class DelTaskMenuItem extends DelContentForEditorsMenuItem { @Inject - public DelTaskMenuItem(final I18nTranslationService i18n, final DelContentAction action, final CoreResources res) { + public DelTaskMenuItem(final I18nTranslationService i18n, final DelContentForEditorsAction action, final CoreResources res) { super(i18n, action, res); } } diff --git a/src/main/java/cc/kune/wave/client/KuneFullDomRenderer.java b/src/main/java/cc/kune/wave/client/KuneFullDomRenderer.java index f071491dc..fa36cde69 100644 --- a/src/main/java/cc/kune/wave/client/KuneFullDomRenderer.java +++ b/src/main/java/cc/kune/wave/client/KuneFullDomRenderer.java @@ -233,6 +233,8 @@ public int compare(Conversation o1, Conversation o2) { }; BlipMetaViewBuilder metaUi = BlipMetaViewBuilder.create(viewIdMapper.metaOf(blip), document); + if (blip.isRoot()) + metaUi.disable(BlipMetaViewBuilder.DELETE_MENU_OPTIONS_SET); blipPopulator.render(blip, metaUi); return BlipViewBuilder.create(viewIdMapper.blipOf(blip), metaUi, threadsUi, convsUi); diff --git a/src/main/java/cc/kune/wave/server/CustomGadgetProviderServlet.java b/src/main/java/cc/kune/wave/server/CustomGadgetProviderServlet.java new file mode 100644 index 000000000..05126c977 --- /dev/null +++ b/src/main/java/cc/kune/wave/server/CustomGadgetProviderServlet.java @@ -0,0 +1,83 @@ +/** + * Copyright 2012 Apache Wave + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package cc.kune.wave.server; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.List; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.inject.Singleton; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.waveprotocol.box.server.CoreSettings; +import org.waveprotocol.box.server.persistence.file.FileAccountStore; + +import cc.kune.core.server.manager.file.FileDownloadManagerUtils; + +import com.google.common.base.Function; +import com.google.common.collect.MapMaker; +import com.google.inject.Inject; +import com.google.inject.name.Named; + +/** + * The servlet for fetching available gadgets from a json file on the server. + */ +@SuppressWarnings("serial") +@Singleton +public class CustomGadgetProviderServlet extends HttpServlet { + + private static final Logger LOG = Logger.getLogger(FileAccountStore.class.getName()); + private final ConcurrentMap jsonCache; + + @Inject + public CustomGadgetProviderServlet(@Named(CoreSettings.RESOURCE_BASES) final List resourceBases) { + jsonCache = new MapMaker().expireAfterWrite(5, TimeUnit.MINUTES).makeComputingMap( + new Function() { + @Override + public String apply(final String key) { + String jsonString = ""; + try { + jsonString = FileDownloadManagerUtils.getInpuStreamAsString(FileDownloadManagerUtils.getInputStreamInResourceBases( + resourceBases, "/others/jsongadgets.json")); + } catch (final IOException e) { + LOG.log(Level.WARNING, "Error while loading gadgets json", e); + } + return jsonString; + } + }); + } + + @Override + protected void doGet(final HttpServletRequest request, final HttpServletResponse response) + throws IOException { + final String jsonString = jsonCache.get(""); + if (jsonString.equals("")) { + response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, + "Error loading json data from file"); + } else { + final PrintWriter out = response.getWriter(); + out.print(jsonCache.get("")); + out.flush(); + } + } +} diff --git a/src/main/java/cc/kune/wave/server/WaveMain.java b/src/main/java/cc/kune/wave/server/WaveMain.java index 6baf542ed..4c5cc88bc 100644 --- a/src/main/java/cc/kune/wave/server/WaveMain.java +++ b/src/main/java/cc/kune/wave/server/WaveMain.java @@ -159,8 +159,8 @@ public static void run(Module coreSettings) throws PersistenceException, PersistenceModule persistenceModule = settingsInjector.getInstance(PersistenceModule.class); Injector injector = settingsInjector.createChildInjector(new ServerModule(enableFederation, listenerCount, - waveletLoadCount, deltaPersistCount), - new RobotApiModule(), federationModule, persistenceModule); + waveletLoadCount, deltaPersistCount), new RobotApiModule(), federationModule, + persistenceModule); ServerRpcProvider server = injector.getInstance(ServerRpcProvider.class); WaveBus waveBus = injector.getInstance(WaveBus.class); @@ -211,6 +211,7 @@ private static void initializeServer(Injector injector, String waveDomain) } private static void initializeServlets(Injector injector, ServerRpcProvider server) { + server.addServlet("/gadget/gadgetlist", injector.getInstance(CustomGadgetProviderServlet.class)); server.addServlet("/attachment/*", injector.getInstance(AttachmentServlet.class)); server.addServlet(SessionManager.SIGN_IN_URL, injector.getInstance(AuthenticationServlet.class)); diff --git a/src/main/java/cc/kune/wiki/client/actions/DelFolderMenuItem.java b/src/main/java/cc/kune/wiki/client/actions/DelFolderMenuItem.java index dd73218de..8ab47d6f8 100644 --- a/src/main/java/cc/kune/wiki/client/actions/DelFolderMenuItem.java +++ b/src/main/java/cc/kune/wiki/client/actions/DelFolderMenuItem.java @@ -21,14 +21,14 @@ import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.resources.CoreResources; -import cc.kune.gspace.client.actions.DelContainerMenuItem; +import cc.kune.gspace.client.actions.DelContainerForEditorsMenuItem; import com.google.inject.Inject; -public class DelFolderMenuItem extends DelContainerMenuItem { +public class DelFolderMenuItem extends DelContainerForEditorsMenuItem { @Inject - public DelFolderMenuItem(final I18nTranslationService i18n, final DelContainerAction action, final CoreResources res) { + public DelFolderMenuItem(final I18nTranslationService i18n, final DelContainerForEditorAction action, final CoreResources res) { super(i18n, action, res); } diff --git a/src/main/java/cc/kune/wiki/client/actions/DelWikiMenuItem.java b/src/main/java/cc/kune/wiki/client/actions/DelWikiMenuItem.java index 2119a8cc8..f1d753121 100644 --- a/src/main/java/cc/kune/wiki/client/actions/DelWikiMenuItem.java +++ b/src/main/java/cc/kune/wiki/client/actions/DelWikiMenuItem.java @@ -21,14 +21,14 @@ import cc.kune.common.shared.i18n.I18nTranslationService; import cc.kune.core.client.resources.CoreResources; -import cc.kune.gspace.client.actions.DelContentMenuItem; +import cc.kune.gspace.client.actions.DelContentForEditorsMenuItem; import com.google.inject.Inject; -public class DelWikiMenuItem extends DelContentMenuItem { +public class DelWikiMenuItem extends DelContentForEditorsMenuItem { @Inject - public DelWikiMenuItem(final I18nTranslationService i18n, final DelContentAction action, final CoreResources res) { + public DelWikiMenuItem(final I18nTranslationService i18n, final DelContentForEditorsAction action, final CoreResources res) { super(i18n, action, res); } } diff --git a/src/main/webapp/others/jsongadgets.json b/src/main/webapp/others/jsongadgets.json new file mode 100644 index 000000000..ce77ff060 --- /dev/null +++ b/src/main/webapp/others/jsongadgets.json @@ -0,0 +1,550 @@ +[ +{"name":"MindMap ConceptDraw", +"desc":"ConceptDraw MINDMAP offers a variety of presentation, input, and output solutions that make creating and sharing map content simple and effective.", +"primaryCategory":"PRODUCTIVITY", +"secondaryCategory":"TEAM", +"gadgetUrl":"http://goo.gl/m7HXR", +"author":"ConceptDraw", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Map", +"desc":"Collaborate on a map of placemarks, paths, and shapes with other participants. Great for planning events and trips.", +"primaryCategory":"MAP", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/0YlHY", +"author":"Google", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Map Cluster", +"desc":"Add your location to the map, and see where everyone else is from, using a cluster visualization.", +"primaryCategory":"MAP", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/TE5LJ", +"author":"Google", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Yes/No/Mini", +"desc":"A miniature version of the Yes/No/Maybe gadget.", +"primaryCategory":"VOTING", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/WnAkm", +"author":"Zachary 'Gamer_Z.' Yaro", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Yes/No/Maybe/+", +"desc":"Same as Google's Yes/No/Maybe, only you can edit the titles and add new ones.", +"primaryCategory":"VOTING", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/fydAe", +"author":"everybodywave", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Yes/No/Maybe", +"desc":"Use this to ask friends if they want to join you for a party, to get their opinion on a topic, or even to petition their support for a movement.", +"primaryCategory":"VOTING", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/24YOf", +"author":"everybodywave", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Code Snippet", +"desc":"Paste and edit snippets of code within your waves, including syntax highlighting for over 20 languages. Uses SyntaxHighlighter by Alex Gorbatchev.", +"primaryCategory":"UTILITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/0cQcc", +"author":" Harry Denholm, Ishani.org", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Image", +"desc":"Lets you insert, resize and annotate any image from the web.", +"primaryCategory":"IMAGE", +"secondaryCategory":"UTILITY", +"gadgetUrl":"http://goo.gl/wCw4o", +"author":"everybodywave", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"WaveTube", +"desc":"A collaborative YouTube player for Wave.", +"primaryCategory":"VIDEO", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/4k9f3", +"author":"everybodywave", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Napkin", +"desc":"The Napkin Gadget is a blank canvas for collaborative doodling.", +"primaryCategory":"UTILITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/FMBPf", +"author":"Marcin Szczepanski", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"HTML", +"desc":"Insert HTML code directly in to a wave.", +"primaryCategory":"UTILITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/bN5AD", +"author":"MBTE Sweden AB", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"iFrame", +"desc":"Insert IFRAME directly in to a wave.", +"primaryCategory":"UTILITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/jvA7z", +"author":"MBTE Sweden AB", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"iFrame - no borders", +"desc":"Insert iFrame DISCRETLY into a wave.", +"primaryCategory":"UTILITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/z46Sg", +"author":"Pooja Srinivas", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"No Edit", +"desc":"Kindly readers to not edit your blip.", +"primaryCategory":"UTILITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/0gEjd", +"author":"everybodywave", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"No Edit - with no text", +"desc":"DISCRETLY prevent the edition of your blip.", +"primaryCategory":"UTILITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/cNgLA", +"author":"Pooja Srinivas", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Word Cloud", +"desc":"Add words and ideas into a collaborative word cloud.", +"primaryCategory":"UTILITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/juj3U", +"author":"everybodywave", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Views tracker", +"desc":"A small gadget that when added to a wave tracks wave views. You can display the number of views with Views Display gadget.", +"primaryCategory":"UTILITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/wIQKU", +"author":"Yuri Zelikov ", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Views display", +"desc":"A display for the views tracker gadget. When added to a wave with the tracker gadget - displays how many times the wave was viewed.", +"primaryCategory":"UTILITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/hPDJD", +"author":"Yuri ", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Like Button", +"desc":"A like button similar to those in Google Reader, Google Buzz, and other Google products.", +"primaryCategory":"VOTING", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/7wkly", +"author":"Zachary 'Gamer_Z.' Yaro", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Pinwand", +"desc":"Collaborate on a virtual pinwand. Add text, images, video, comments and many more.", +"primaryCategory":"OTHER", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/0PmBc", +"author":"Michael Hielscher", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"I Like It!", +"desc":"Adds a favorites button to your wave, so that you and everyone else in the wave can indicate that they like the wave - with a cute smiley face!", +"primaryCategory":"VOTING", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/aXybB", +"author":"Jaken", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Diagram Editor", +"desc":"Create cool diagrams (UML, BPMN, EPC, FMC, etc.) together with your friends in Google Wave!", +"primaryCategory":"PRODUCTIVITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/HvuA4", +"author":"processWave.org", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Word Network", +"desc":"Collaborate on a linking words together and organizing concepts. Double Click on any word to link it to another or double click on the background to c...", +"primaryCategory":"PRODUCTIVITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/6vwxY", +"author":"antimatter15", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Google Fight!", +"desc":"Google Fights - the title should explain it all. Another gadget by www.processWave.org.", +"primaryCategory":"UTILITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/Mg26y", +"author":"Michael Goderbauer", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Poll", +"desc":"Poll participants for their opinion. Supports both single and multiple selection polls, and optionally allows votes to be changed after they're cast.", +"primaryCategory":"VOTING", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/0G7qU", +"author":"Eric Williams", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Chart", +"desc":"Lets you insert various charts into wave.", +"primaryCategory":"PRODUCTIVITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/Tb7Q3", +"author":"everybodywave", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Retro Chat", +"desc":"Chat room gadget for old-fashioned IMing in Wave.", +"primaryCategory":"PRODUCTIVITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/AW0Vm", +"author":"Charles Lehner", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Picasa", +"desc":"Add a Picasa photo album to a wave.", +"primaryCategory":"IMAGE", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/NUYIs", +"author":"Genliang Guan, University of Sydney", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Goo.gl URL Shortener", +"desc":"Shorten url with goo.gl, the new Google url shortener.(http://goo.gl/)", +"primaryCategory":"UTILITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/oRonD", +"author":"haru1ban", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"PacMan", +"desc":"Play Pacman inside a Wave.", +"primaryCategory":"GAME", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/RFzqt", +"author":"www.schulz.dk", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Sudoku", +"desc":"A cool game to share with your friends. Solve challenging Sudoku boards together and see who is the best Sudoku player!", +"primaryCategory":"GAME", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/FxORa", +"author":"LabPixies", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"AccuWeather", +"desc":"The AccuWeather Wave Gadget is the perfect companion for trip planning. Select a location and date, and the gadget will return a forecast.", +"primaryCategory":"UTILITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/iODX9", +"author":"AccuWeather.com", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Decing", +"desc":"Need to make a decision? Arrange a secret vote inside of a wave. Participants' votes are not shared to others.", +"primaryCategory":"VOTING", +"secondaryCategory":"TEAM", +"gadgetUrl":"http://goo.gl/MghBe", +"author":"Decing.com", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Grocery List", +"desc":"Use this for your grocery list needs - share with your family, sort the list automatically, print and take it to the store, and more!", +"primaryCategory":"UTILITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/kna0V", +"author":"Quaker", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Likey", +"desc":"A simple like/dislike Wave gadget that can be added to a blip for intuitive user rating.", +"primaryCategory":"VOTING", +"secondaryCategory":"PRODUCTIVITY", +"gadgetUrl":"http://goo.gl/KrlJE", +"author":"Ben Griffiths", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Paginator", +"desc":"The Paginator is a compact reading aid Gadget for Google Wave which paginates large amounts of text and bookmarks the wave viewer's current location", +"primaryCategory":"UTILITY", +"secondaryCategory":"PRODUCTIVITY", +"gadgetUrl":"http://goo.gl/Ol9GW", +"author":"Dan Smith", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Piano", +"desc":"A real-time piano gadget.", +"primaryCategory":"MUSIC", +"secondaryCategory":"GAME", +"gadgetUrl":"http://goo.gl/x9vHX", +"author":"everybodywave", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Team ", +"desc":"Lets you create a list of wave participants in a particular order.", +"primaryCategory":"TEAM", +"secondaryCategory":"PRODUCTIVITY", +"gadgetUrl":"http://goo.gl/VJnId", +"author":"everybodywave", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Vector Editor", +"desc":"This gadget is useful for creating graphics. Shapes can be added, resized, moved, and rotated. The application supports Lines, Freeform, Polygons, Rec...", +"primaryCategory":"PRODUCTIVITY", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/VSkn5", +"author":"antimatter15", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Ratings", +"desc":"Add your vote from 1-5 stars, and see the total votes from others.", +"primaryCategory":"VOTING", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/uQ9vi", +"author":"Google", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Colcrop", +"desc":"Cover as many cells as possible, by choosing adjacent colors. Play against a participant or the computer. Computer Level 4 is pretty hard to defeat.", +"primaryCategory":"GAME", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/Vh9ME", +"author":"Alexis Vuillemin", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"Bones", +"desc":"Bones provides graphical dice that any participant in a wave can set up to be rolled by themselves or others. Results are shared with everyone.", +"primaryCategory":"UTILITY", +"secondaryCategory":"TEAM", +"gadgetUrl":"http://goo.gl/GbhWR", +"author":"10x10 Room", +"submittedBy":"Jeremy", +"imageUrl":""}, + +{"name":"lmnowave", +"desc":"Solve crossword puzzles with friends in Google Wave.", +"primaryCategory":"GAME", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/heXs7", +"author":"Dan Vanderkam", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"FlickrWave", +"desc":"Display individual Flickr photos or browse photos from a user's stream, favorites, a photoset or a group.", +"primaryCategory":"IMAGE", +"secondaryCategory":"VIDEO", +"gadgetUrl":"http://goo.gl/OSEZF", +"author":"Mark Probst", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Verbol VoiceChat", +"desc":"Lets you record any thoughts you have into the wave, listen to what others are saying or have said, and reply to them. V3.12.3.", +"primaryCategory":"VOICE", +"secondaryCategory":"PRODUCTIVITY", +"gadgetUrl":"http://goo.gl/Iklq2", +"author":"Family Systems and PhoneFromHere", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Scrumpoker", +"desc":"ScrumPoker for consensus-based estimation.", +"primaryCategory":"PRODUCTIVITY", +"secondaryCategory":"TEAM", +"gadgetUrl":"http://goo.gl/JuBfO", +"author":"MasteringWave", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Hostel WithMe", +"desc":"In partnership with HostelWorld.com. Find the best budget accommodation together with your friends.", +"primaryCategory":"TRAVEL", +"secondaryCategory":"SEARCH", +"gadgetUrl":"http://goo.gl/pXAkD", +"author":"rucksack.com", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Take-Out", +"desc":"Helps organize take-out orders for a group. Great for coordinating food or coffee runs for your office!", +"primaryCategory":"UTILITY", +"secondaryCategory":"TEAM", +"gadgetUrl":"http://goo.gl/4yFIQ", +"author":"Kip Holcomb", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Travel WithMe", +"desc":"Travel WithMe allows groups of people to plan trips together in real time.", +"primaryCategory":"TRAVEL", +"secondaryCategory":"TEAM", +"gadgetUrl":"http://goo.gl/fdpJO", +"author":"rucksack.com", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Twitter Search", +"desc":"Shows results from Twitter for a given search term. Users can edit to specify new term.", +"primaryCategory":"SEARCH", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/1U79x", +"author":"Google", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Waffle", +"desc":"The easy way to plan an event. Just add a Waffle to your wave, choose a few dates - now, all wave participants can vote immediately!", +"primaryCategory":"SEARCH", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/VsXSf", +"author":"Mikkel Staunsholm (www.waffle.dk)", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Trippy", +"desc":"Co-create an itinerary: choose points of interest -- including Lonely Planet recommendations, organize, share, print, or export to My Maps!", +"primaryCategory":"TRAVEL", +"secondaryCategory":"TEAM", +"gadgetUrl":"http://goo.gl/HgDlU", +"author":"Lonely Planet", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Conference", +"desc":"Click to insert a Ribbit Conference gadget to your toolbar.", +"primaryCategory":"VOICE", +"secondaryCategory":"PRODUCTIVITY", +"gadgetUrl":"http://goo.gl/UVZ4i", +"author":"Ribbit Corporation", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"TimeBridge Conferencing", +"desc":"Instantly add phone and web conferencing to your wave with the TimeBridge Conferencing Gadget. Just plug the gadget into your wave and go!", +"primaryCategory":"VOICE", +"secondaryCategory":"PRODUCTIVITY", +"gadgetUrl":"http://goo.gl/FPVh7", +"author":"Ribbit Corporation", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Plus One", +"desc":"A small, simple gadget to collect votes. Use it to rate anything!", +"primaryCategory":"VOTING", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/aDH3v", +"author":"Peter Frost", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Time-Me!", +"desc":"A stopwatch with support for multiple split-times!", +"primaryCategory":"TIME", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/Zm3ch", +"author":"Owl Order", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Time-manager", +"desc":"Insert a small timer into your waves. Click on it to start/stop counting. Total time will be saved.", +"primaryCategory":"TIME", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://goo.gl/48odp", +"author":"Fedor Indutny", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"When do we meet?", +"desc":"Find a date for a business meeting, party, or vacation by collaboratively marking each participant's free days in a shared calendar.", +"primaryCategory":"TIME", +"secondaryCategory":"TEAM", +"gadgetUrl":"http://goo.gl/qQ7n0", +"author":"Robert Bamler", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"List", +"desc":"Insert little tables inside your wavelet. You can extend the columns, make them sorted, etc...", +"primaryCategory":"UTILITY", +"secondaryCategory":"PRODUCTIVITY", +"gadgetUrl":"http://goo.gl/O6swn", +"author":"Teun Duynstee", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"FavJumpr", +"desc":"A little Flickr game where you have to jump from one's user's favorites to another's by selecting the one you like best.", +"primaryCategory":"GAME", +"secondaryCategory":"IMAGE", +"gadgetUrl":"http://goo.gl/DVySN", +"author":"Mark Probst", +"submittedBy":"Yuri", +"imageUrl":""}, + +{"name":"Wave Chess", +"desc":"Play Chess in Google Wave.", +"primaryCategory":"GAME", +"secondaryCategory":"OTHER", +"gadgetUrl":"http://wave-chess.appspot.com/wavechess/com.google.wave.chess.client.ChessGadget.gadget.xml", +"author":"Google", +"submittedBy":"Yuri", +"imageUrl":""} + ] \ No newline at end of file diff --git a/src/test/java/cc/kune/common/shared/utils/TextUtilsTest.java b/src/test/java/cc/kune/common/shared/utils/TextUtilsTest.java new file mode 100644 index 000000000..430159e58 --- /dev/null +++ b/src/test/java/cc/kune/common/shared/utils/TextUtilsTest.java @@ -0,0 +1,40 @@ +/* + * + * Copyright (C) 2007-2012 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 . + * + */ + +package cc.kune.common.shared.utils; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class TextUtilsTest { + + private static final String DOMAIN_REGEXP = "^http([s]|)://localhost/.*"; + + @Test + public void testUrlDomain() { + assertTrue("http://localhost/kk".matches(DOMAIN_REGEXP)); + assertTrue("https://localhost/kk".matches(DOMAIN_REGEXP)); + assertFalse("http://localhost:9898/kk".matches(DOMAIN_REGEXP)); + assertFalse("http://localhost".matches(DOMAIN_REGEXP)); + assertFalse("ftp://localhost/kk".matches(DOMAIN_REGEXP)); + } +} diff --git a/src/test/java/cc/kune/core/server/integration/IntegrationTest.java b/src/test/java/cc/kune/core/server/integration/IntegrationTest.java index 2e7ca0c54..f2877ae70 100644 --- a/src/test/java/cc/kune/core/server/integration/IntegrationTest.java +++ b/src/test/java/cc/kune/core/server/integration/IntegrationTest.java @@ -59,7 +59,7 @@ protected String doLoginWithDummyUser() throws DefaultException, IOException { @After public void doLogout() throws DefaultException { - if (session.isUserLoggedIn()) { + if (session != null && session.isUserLoggedIn()) { session.logout(); } } diff --git a/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java b/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java index ad104bb69..57b701f66 100644 --- a/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java +++ b/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java @@ -74,20 +74,20 @@ public void addAndDelMainParticipant() throws IOException { doLogin(); createTestWave(new SimpleArgCallback() { @Override - public void onCallback(final WaveRef waveletName) { - assertNotNull(waveletName); - manager.addParticipants(waveletName, getSiteAdminShortName(), NEW_PARTICIPANT); + public void onCallback(final WaveRef waveRef) { + assertNotNull(waveRef); + manager.addParticipants(waveRef, getSiteAdminShortName(), NEW_PARTICIPANT); - final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); + final Wavelet fetchWavelet = manager.fetchWave(waveRef, getSiteAdminShortName()); assertNotNull(fetchWavelet); assertEquals(2, fetchWavelet.getParticipants().size()); assertTrue(manager.isParticipant(fetchWavelet, NEW_PARTICIPANT)); assertTrue(manager.isParticipant(fetchWavelet, getSiteAdminShortName())); // Del all - manager.delParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName()); + manager.delParticipants(waveRef, getSiteAdminShortName(), getSiteAdminShortName()); // This fails because we don't have a way to access to than wave now ... // @domain don't work neither - final Wavelet fetchedAfterDeleted = manager.fetchWave(waveletName, ""); + final Wavelet fetchedAfterDeleted = manager.fetchWave(waveRef, ""); assertNotNull(fetchedAfterDeleted); } }); @@ -98,21 +98,21 @@ public void addAndDelParticipantTwice() throws IOException { doLogin(); createTestWave(new SimpleArgCallback() { @Override - public void onCallback(final WaveRef waveletName) { - assertNotNull(waveletName); - manager.addParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName(), + public void onCallback(final WaveRef waveRef) { + assertNotNull(waveRef); + manager.addParticipants(waveRef, getSiteAdminShortName(), getSiteAdminShortName(), NEW_PARTICIPANT); - manager.addParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName(), + manager.addParticipants(waveRef, getSiteAdminShortName(), getSiteAdminShortName(), NEW_PARTICIPANT, NEW_PARTICIPANT); - manager.addParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName(), + manager.addParticipants(waveRef, getSiteAdminShortName(), getSiteAdminShortName(), NEW_PARTICIPANT, NEW_PARTICIPANT, NEW_PARTICIPANT); - final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); + final Wavelet fetchWavelet = manager.fetchWave(waveRef, getSiteAdminShortName()); assertNotNull(fetchWavelet); assertEquals(2, fetchWavelet.getParticipants().size()); assertTrue(manager.isParticipant(fetchWavelet, NEW_PARTICIPANT)); assertTrue(manager.isParticipant(fetchWavelet, getSiteAdminShortName())); // Del main editor - manager.delParticipants(waveletName, getSiteAdminShortName(), NEW_PARTICIPANT, NEW_PARTICIPANT, + manager.delParticipants(waveRef, getSiteAdminShortName(), NEW_PARTICIPANT, NEW_PARTICIPANT, getSiteAdminShortName(), getSiteAdminShortName()); } }); @@ -124,27 +124,27 @@ public void addAndRemoveParticipant() throws IOException { final String whoDels = getSiteAdminShortName(); createTestWave(new SimpleArgCallback() { @Override - public void onCallback(final WaveRef waveletName) { - assertNotNull(waveletName); - manager.addParticipants(waveletName, getSiteAdminShortName(), whoDels, NEW_PARTICIPANT, + public void onCallback(final WaveRef waveRef) { + assertNotNull(waveRef); + manager.addParticipants(waveRef, getSiteAdminShortName(), whoDels, NEW_PARTICIPANT, NEW_PARTICIPANT2); - final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); + final Wavelet fetchWavelet = manager.fetchWave(waveRef, getSiteAdminShortName()); assertNotNull(fetchWavelet); assertEquals(3, fetchWavelet.getParticipants().size()); assertTrue(manager.isParticipant(fetchWavelet, NEW_PARTICIPANT)); assertTrue(manager.isParticipant(fetchWavelet, NEW_PARTICIPANT2)); assertTrue(manager.isParticipant(fetchWavelet, getSiteAdminShortName())); - manager.delParticipants(waveletName, whoDels, NEW_PARTICIPANT, NEW_PARTICIPANT2); - final Wavelet fetchDelWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); + manager.delParticipants(waveRef, whoDels, NEW_PARTICIPANT, NEW_PARTICIPANT2); + final Wavelet fetchDelWavelet = manager.fetchWave(waveRef, getSiteAdminShortName()); assertNotNull(fetchDelWavelet); assertEquals(1, fetchDelWavelet.getParticipants().size()); assertTrue(manager.isParticipant(fetchDelWavelet, getSiteAdminShortName())); assertFalse(manager.isParticipant(fetchDelWavelet, NEW_PARTICIPANT)); assertFalse(manager.isParticipant(fetchDelWavelet, NEW_PARTICIPANT2)); - manager.addParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName(), + manager.addParticipants(waveRef, getSiteAdminShortName(), getSiteAdminShortName(), NEW_PARTICIPANT); // Del all (the last, the whoDels...) - manager.delParticipants(waveletName, whoDels, NEW_PARTICIPANT, getSiteAdminShortName()); + manager.delParticipants(waveRef, whoDels, NEW_PARTICIPANT, getSiteAdminShortName()); } }); } @@ -168,10 +168,10 @@ public void addGadgetAndCheckProperties() throws DefaultException, IOException { final URL gadgetUrl = new URL(TEST_GADGET); createTestWave(new SimpleArgCallback() { @Override - public void onCallback(final WaveRef waveletName) { - assertNotNull(waveletName); - manager.addGadget(waveletName, getSiteAdminShortName(), gadgetUrl); - final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); + public void onCallback(final WaveRef waveRef) { + assertNotNull(waveRef); + manager.addGadget(waveRef, getSiteAdminShortName(), gadgetUrl); + final Wavelet fetchWavelet = manager.fetchWave(waveRef, getSiteAdminShortName()); final Gadget gadget = getFirstGadget(fetchWavelet, TEST_GADGET); assertEquals(gadget.getUrl(), TEST_GADGET); assertEquals(2, gadget.getProperties().size()); @@ -185,8 +185,8 @@ public void onCallback(final WaveRef waveletName) { } // Removing some property newProps.put(SOME_PROPERTY, null); - manager.setGadgetProperty(waveletName, getSiteAdminShortName(), gadgetUrl, newProps); - final Wavelet updatedWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); + manager.setGadgetProperty(waveRef, getSiteAdminShortName(), gadgetUrl, newProps); + final Wavelet updatedWavelet = manager.fetchWave(waveRef, getSiteAdminShortName()); final Gadget gadgetUpdated = getFirstGadget(updatedWavelet, TEST_GADGET); assertEquals(gadgetUpdated.getUrl(), TEST_GADGET); assertEquals(3, updatedWavelet.getRootBlip().getElements().size()); @@ -215,10 +215,10 @@ private void addParticipant(final String whoAdds) throws IOException { doLogin(); createTestWave(new SimpleArgCallback() { @Override - public void onCallback(final WaveRef waveletName) { - assertNotNull(waveletName); - manager.addParticipants(waveletName, getSiteAdminShortName(), whoAdds, NEW_PARTICIPANT); - final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); + public void onCallback(final WaveRef waveRef) { + assertNotNull(waveRef); + manager.addParticipants(waveRef, getSiteAdminShortName(), whoAdds, NEW_PARTICIPANT); + final Wavelet fetchWavelet = manager.fetchWave(waveRef, getSiteAdminShortName()); assertNotNull(fetchWavelet); assertEquals(2, fetchWavelet.getParticipants().size()); assertTrue(manager.isParticipant(fetchWavelet, NEW_PARTICIPANT)); @@ -247,9 +247,9 @@ public void createWave() throws DefaultException, IOException { doLogin(); manager.createWave(RICHTEXT_MESSAGE, new SimpleArgCallback() { @Override - public void onCallback(final WaveRef waveletName) { - assertNotNull(waveletName); - final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); + public void onCallback(final WaveRef waveRef) { + assertNotNull(waveRef); + final Wavelet fetchWavelet = manager.fetchWave(waveRef, getSiteAdminShortName()); assertNotNull(fetchWavelet); assertTrue(fetchWavelet.getRootBlip().getAnnotations().size() > 0); assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE)); @@ -276,9 +276,9 @@ public void createWaveWithTitle() throws DefaultException, IOException { doLogin(); createTestWave(new SimpleArgCallback() { @Override - public void onCallback(final WaveRef waveletName) { - assertNotNull(waveletName); - final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); + public void onCallback(final WaveRef waveRef) { + assertNotNull(waveRef); + final Wavelet fetchWavelet = manager.fetchWave(waveRef, getSiteAdminShortName()); assertNotNull(fetchWavelet); assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE)); assertEquals(TITLE, fetchWavelet.getTitle()); @@ -319,10 +319,10 @@ public void setTitle() throws DefaultException, IOException { doLogin(); createTestWave(new SimpleArgCallback() { @Override - public void onCallback(final WaveRef waveletName) { - assertNotNull(waveletName); - manager.setTitle(waveletName, TITLENEW, getSiteAdminShortName()); - final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); + public void onCallback(final WaveRef waveRef) { + assertNotNull(waveRef); + manager.setTitle(waveRef, TITLENEW, getSiteAdminShortName()); + final Wavelet fetchWavelet = manager.fetchWave(waveRef, getSiteAdminShortName()); assertNotNull(fetchWavelet); assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE)); assertEquals(TITLENEW, fetchWavelet.getTitle());