xwiki-devs
Threads by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
October 2009
- 43 participants
- 147 discussions
Hi Everyone, Hi Marius,
Here is the code that I embeded in the Xwiki page, I just only include
js/xwiki/mail/mail.nocache.js
just once:
{{velocity}}
$xwiki.jsfx.use("js/xwiki/mail/mail.nocache.js", true)
{{html}}
<div id="DR_TreeView"></div>
{{/html}}
{{/velocity}}
or
{{velocity}}
$xwiki.jsfx.use("js/xwiki/mail/mail.nocache.js", true)
{{/velocity}}
{{html}}
<div id="DR_TreeView"></div>
{{/html}}
This will result at the top of the page that have the clickable Mail example
functioning well, at the bottom it follows two unclickable Mail example,
just like html displayed. And follows 6 xwe.onInjectionDone('xwe') sep . It
seems although I used $xwiki.jsfx.use, the JavaScript code still parsed as
wiki syntax and display as text. So what should I do?
You said "to include the JavaScript code so that it ends up in your HTML
page's head not body".
1
0
[xwiki-devs] [xwiki-notifications] r24354 - platform/xwiki-plugins/trunk/skinx/src/main/java/com/xpn/xwiki/plugin/skinx
by Caleb James DeLisle 10 Oct '09
by Caleb James DeLisle 10 Oct '09
10 Oct '09
Hey Sergiu,
line 58 is failing checkstyle for being 2 characters too long.
* @return HTML code linking to the pulled resource (eg: <script type="text/javascript" src="/this/url.js"></script>)
Thanks again,
Caleb
sdumitriu (SVN) wrote:
> Author: sdumitriu
> Date: 2009-10-10 01:04:21 +0200 (Sat, 10 Oct 2009)
> New Revision: 24354
>
> Added:
> platform/xwiki-plugins/trunk/skinx/src/main/java/com/xpn/xwiki/plugin/skinx/AbstractResourceSkinExtensionPlugin.java
> Modified:
> platform/xwiki-plugins/trunk/skinx/src/main/java/com/xpn/xwiki/plugin/skinx/CssResourceSkinExtensionPlugin.java
> platform/xwiki-plugins/trunk/skinx/src/main/java/com/xpn/xwiki/plugin/skinx/JsResourceSkinExtensionPlugin.java
> Log:
> XSKINX-29: Refactor duplicate code
> Refactor JsResourceSkinExtensionPlugin and CssResourceSkinExtensionPlugin.
> Patch from Caleb James DeLisle, applied with several changes.
>
>
> Added: platform/xwiki-plugins/trunk/skinx/src/main/java/com/xpn/xwiki/plugin/skinx/AbstractResourceSkinExtensionPlugin.java
> ===================================================================
> --- platform/xwiki-plugins/trunk/skinx/src/main/java/com/xpn/xwiki/plugin/skinx/AbstractResourceSkinExtensionPlugin.java (rev 0)
> +++ platform/xwiki-plugins/trunk/skinx/src/main/java/com/xpn/xwiki/plugin/skinx/AbstractResourceSkinExtensionPlugin.java 2009-10-09 23:04:21 UTC (rev 24354)
> @@ -0,0 +1,102 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package com.xpn.xwiki.plugin.skinx;
> +
> +import java.util.Collections;
> +import java.util.Set;
> +
> +import com.xpn.xwiki.XWikiContext;
> +import com.xpn.xwiki.XWikiException;
> +
> +/**
> + * Skin Extension plugin to use extension files from JAR resources.
> + * @version $Id$
> + */
> +public abstract class AbstractResourceSkinExtensionPlugin extends AbstractSkinExtensionPlugin
> +{
> + /**
> + * XWiki plugin constructor.
> + *
> + * @param name The name of the plugin, which can be used for retrieving the plugin API from velocity. Unused.
> + * @param className The canonical classname of the plugin. Unused.
> + * @param context The current request context.
> + * @see com.xpn.xwiki.plugin.XWikiDefaultPlugin#XWikiDefaultPlugin(String,String,com.xpn.xwiki.XWikiContext)
> + */
> + public AbstractResourceSkinExtensionPlugin(String name, String className, XWikiContext context)
> + {
> + super(name, className, context);
> + }
> +
> + /**
> + * Get the action which the url should specify for calling this resource.
> + *
> + * @return String Action name.
> + */
> + protected abstract String getAction();
> +
> + /**
> + * Takes a URL string and outputs a link which will cause the browser to load the url.
> + *
> + * @param url String representation of the url to load (eg: "/this/url.js")
> + * @return HTML code linking to the pulled resource (eg: <script type="text/javascript" src="/this/url.js"></script>)
> + */
> + protected abstract String generateLink(String url);
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see AbstractSkinExtensionPlugin#getLink(String, XWikiContext)
> + */
> + public String getLink(String resourceName, XWikiContext context)
> + {
> + // If the current user has access to Main.WebHome, we will use this document in the URL
> + // to serve the resource. This way, the resource can be efficiently cached, since it has a
> + // common URL for any page.
> + try {
> + String page = context.getWiki().getDefaultWeb(context) + "." + context.getWiki().getDefaultPage(context);
> + if (!context.getWiki().getRightService().hasAccessLevel("view", context.getUser(), page, context)) {
> + page = context.getDoc().getFullName();
> + }
> + return generateLink(context.getWiki().getURL(page, getAction(),
> + "resource=" + resourceName + parametersAsQueryString(resourceName, context), context));
> + } catch (XWikiException e) {
> + // Do nothing here; we can't access the wiki, so don't link to this resource at all.
> + return "";
> + }
> + }
> +
> + /**
> + * {@inheritDoc}
> + * <p>
> + * There is no support for always used resource-based extensions yet.
> + * </p>
> + *
> + * @see AbstractSkinExtensionPlugin#getAlwaysUsedExtensions(XWikiContext)
> + */
> + @Override
> + public Set<String> getAlwaysUsedExtensions(XWikiContext context)
> + {
> + // There is no mean to define an always used extension for something else than a document extension now,
> + // so for resources-based extensions, we return an emtpy set.
> + // An idea for the future could be to have an API for plugins and components to register always used resources
> + // extensions.
> + return Collections.emptySet();
> + }
> +}
>
>
> Property changes on: platform/xwiki-plugins/trunk/skinx/src/main/java/com/xpn/xwiki/plugin/skinx/AbstractResourceSkinExtensionPlugin.java
> ___________________________________________________________________
> Name: svn:keywords
> + Id
> Name: svn:eol-style
> + native
>
> Modified: platform/xwiki-plugins/trunk/skinx/src/main/java/com/xpn/xwiki/plugin/skinx/CssResourceSkinExtensionPlugin.java
> ===================================================================
> --- platform/xwiki-plugins/trunk/skinx/src/main/java/com/xpn/xwiki/plugin/skinx/CssResourceSkinExtensionPlugin.java 2009-10-09 18:28:50 UTC (rev 24353)
> +++ platform/xwiki-plugins/trunk/skinx/src/main/java/com/xpn/xwiki/plugin/skinx/CssResourceSkinExtensionPlugin.java 2009-10-09 23:04:21 UTC (rev 24354)
> @@ -20,11 +20,7 @@
> */
> package com.xpn.xwiki.plugin.skinx;
>
> -import java.util.Collections;
> -import java.util.Set;
> -
> import com.xpn.xwiki.XWikiContext;
> -import com.xpn.xwiki.XWikiException;
>
> /**
> * Skin Extension plugin to use css files from JAR resources.
> @@ -32,7 +28,7 @@
> * @version $Id$
> * @since 1.3
> */
> -public class CssResourceSkinExtensionPlugin extends AbstractSkinExtensionPlugin
> +public class CssResourceSkinExtensionPlugin extends AbstractResourceSkinExtensionPlugin
> {
> /**
> * XWiki plugin constructor.
> @@ -45,7 +41,6 @@
> public CssResourceSkinExtensionPlugin(String name, String className, XWikiContext context)
> {
> super(name, className, context);
> - init(context);
> }
>
> /**
> @@ -61,47 +56,22 @@
>
> /**
> * {@inheritDoc}
> - *
> - * @see AbstractSkinExtensionPlugin#getLink(String, XWikiContext)
> + *
> + * @see AbstractSkinExtensionPlugin#getAction()
> */
> - @Override
> - public String getLink(String documentName, XWikiContext context)
> + protected String getAction()
> {
> - String result = "";
> - // If the current user has access to Main.WebHome, we will use this document in the URL
> - // to serve the css resource. This way, the resource can be efficiently cached, since it has a
> - // common URL for any page.
> - try {
> - String page = context.getWiki().getDefaultWeb(context) + "." + context.getWiki().getDefaultPage(context);
> - if (!context.getWiki().getRightService().hasAccessLevel("view", context.getUser(), page, context)) {
> - page = context.getDoc().getFullName();
> - }
> - String url =
> - context.getWiki().getURL(page, "ssx",
> - "resource=" + documentName + parametersAsQueryString(documentName, context), context);
> - result = "<link rel='stylesheet' type='text/css' href='" + url + "'/>";
> - } catch (XWikiException e) {
> - // Do nothing here; we can't access the wiki, so don't link to this resource at all.
> - }
> - return result;
> + return "ssx";
> }
>
> /**
> * {@inheritDoc}
> - * <p>
> - * There is no support for always used resource-based extensions yet.
> - * </p>
> - *
> - * @see AbstractSkinExtensionPlugin#getAlwaysUsedExtensions(XWikiContext)
> + *
> + * @see AbstractSkinExtensionPlugin#generateLink()
> */
> - @Override
> - public Set<String> getAlwaysUsedExtensions(XWikiContext context)
> + protected String generateLink(String url)
> {
> - // There is no mean to define an always used extension for something else than a document extension now,
> - // so for resources-based extensions, we return an emtpy set.
> - // An idea for the future could be to have an API for plugins and components to register always used resources
> - // extensions.
> - return Collections.emptySet();
> + return "<link rel='stylesheet' type='text/css' href='" + url + "'/>\n";
> }
>
> /**
>
> Modified: platform/xwiki-plugins/trunk/skinx/src/main/java/com/xpn/xwiki/plugin/skinx/JsResourceSkinExtensionPlugin.java
> ===================================================================
> --- platform/xwiki-plugins/trunk/skinx/src/main/java/com/xpn/xwiki/plugin/skinx/JsResourceSkinExtensionPlugin.java 2009-10-09 18:28:50 UTC (rev 24353)
> +++ platform/xwiki-plugins/trunk/skinx/src/main/java/com/xpn/xwiki/plugin/skinx/JsResourceSkinExtensionPlugin.java 2009-10-09 23:04:21 UTC (rev 24354)
> @@ -20,11 +20,7 @@
> */
> package com.xpn.xwiki.plugin.skinx;
>
> -import java.util.Collections;
> -import java.util.Set;
> -
> import com.xpn.xwiki.XWikiContext;
> -import com.xpn.xwiki.XWikiException;
>
> /**
> * Skin Extension plugin that allows pulling javascript files from JAR resources.
> @@ -32,7 +28,7 @@
> * @version $Id$
> * @since 1.3
> */
> -public class JsResourceSkinExtensionPlugin extends AbstractSkinExtensionPlugin
> +public class JsResourceSkinExtensionPlugin extends AbstractResourceSkinExtensionPlugin
> {
> /**
> * XWiki plugin constructor.
> @@ -44,57 +40,42 @@
> */
> public JsResourceSkinExtensionPlugin(String name, String className, XWikiContext context)
> {
> - super("jsrx", className, context);
> - init(context);
> + super(name, className, context);
> }
>
> /**
> * {@inheritDoc}
> *
> - * @see AbstractSkinExtensionPlugin#getLink(String, XWikiContext)
> + * @see com.xpn.xwiki.plugin.XWikiDefaultPlugin#getName()
> */
> @Override
> - public String getLink(String documentName, XWikiContext context)
> + public String getName()
> {
> - String result = "";
> - // If the current user has access to Main.WebHome, we will use this document in the URL
> - // to serve the js resource. This way, the resource can be efficiently cached, since it has a
> - // common URL for any page.
> - try {
> - String page = context.getWiki().getDefaultWeb(context) + "." + context.getWiki().getDefaultPage(context);
> - if (!context.getWiki().getRightService().hasAccessLevel("view", context.getUser(), page, context)) {
> - page = context.getDoc().getFullName();
> - }
> - String url =
> - context.getWiki().getURL(page, "jsx",
> - "resource=" + documentName + parametersAsQueryString(documentName, context), context);
> - result = "<script type=\"text/javascript\" src=\"" + url + "\"></script>";
> - } catch (XWikiException e) {
> - // Do nothing here; we can't access the wiki, so don't link to this resource at all.
> - }
> - return result;
> + return "jsrx";
> }
>
> /**
> * {@inheritDoc}
> - * <p>
> - * There is no support for always used resource-based extensions yet.
> - * </p>
> - *
> - * @see AbstractSkinExtensionPlugin#getAlwaysUsedExtensions(XWikiContext)
> + *
> + * @see AbstractSkinExtensionPlugin#getAction()
> */
> - @Override
> - public Set<String> getAlwaysUsedExtensions(XWikiContext context)
> + protected String getAction()
> {
> - // There is no mean to define an always used extension for something else than a document extension now,
> - // so for resources-based extensions, we return an emtpy set.
> - // An idea for the future could be to have an API for plugins and components to register always used resources
> - // extensions.
> - return Collections.emptySet();
> + return "jsx";
> }
>
> /**
> * {@inheritDoc}
> + *
> + * @see AbstractSkinExtensionPlugin#generateLink()
> + */
> + protected String generateLink(String url)
> + {
> + return "<script type=\"text/javascript\" src=\"" + url + "\"></script>\n";
> + }
> +
> + /**
> + * {@inheritDoc}
> * <p>
> * We must override this method since the plugin manager only calls it for classes that provide their own
> * implementation, and not an inherited one.
>
> _______________________________________________
> notifications mailing list
> notifications(a)xwiki.org
> http://lists.xwiki.org/mailman/listinfo/notifications
>
2
1
Could we get this one in the paper cut list ?
http://jira.xwiki.org/jira/browse/XWIKI-831
The patch in this jira both fixes:
- the ability to add version instead of overriding (the current behavior
can result in data loss)
- the setting of contentAuthor (this is the paper cut as it forces to
resave all pages which require prog rights)
These bugs do lead to productivity loss. If I just sum the time it takes
to do the resaves I'm sure this amounts in days since the beginning of
the year
Ludovic
--
Ludovic Dubost
Blog: http://blog.ludovic.org/
XWiki: http://www.xwiki.com
Skype: ldubost GTalk: ldubost
1
0
Re: [xwiki-devs] [xwiki-notifications] r24335 - in platform/web/trunk: standard/src/main/webapp/templates wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/editor wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/image/ui wysiwyg/src/main/java/com/xpn/xw
by Asiri Rathnayake 09 Oct '09
by Asiri Rathnayake 09 Oct '09
09 Oct '09
Hi,
> > + /**
> > + * {@inheritDoc}
> > + */
> > + public String getSpace()
> > + {
> > + return config.getParameter("space", "Main");
> > + }
> > +
> > + /**
> > + * {@inheritDoc}
> > + */
> > + public String getWiki()
> > + {
> > + return config.getParameter("wiki", "xwiki");
> > + }
>
> Actually I don't see a good reason for which I made these functions public.
> We
> should make them protected.
>
+1, I'll do it.
>
> > +
> > + /**
> > + * {@inheritDoc}
> > + */
> > + protected String getFileHelpLabel()
> > + {
> > + return Strings.INSTANCE.importOfficeFileHelpLabel();
> > + }
> > +
> > + /**
> > + * {@inheritDoc}
> > + */
> > + protected void onAttachmentUploaded(Attachment attach, final
> AsyncCallback<Boolean> async)
> > + {
> > +
> > + String fullPageName = getSpace() + "." + getPage();
>
> you should use the ResourceName class to build wiki names, since it's the
> client
> wiki reference serializer/deserializer.
> > +
> WysiwygService.Singleton.getInstance().officeToXHTML(fullPageName,
> getHTMLCleaningParams(),
>
Actually this code will go away when I introduce the new
officeToXHTML(Attachment....) method.
> + // Display the error and avoid submit operation from
> continuing.
> > + displayError(thrown.getMessage());
> > + async.onSuccess(false);
>
> As a convention, we used the onFailure to signal an error on the server or
> in
> the server-client communication (like a GWT failure in the RPC call), while
> the
> submit async.onSuccess(false) is an "application error", a way in which a
> wizard
> step prevents the submit to be done because, for example, the user didn't
> insert
> valid data in the wizard form and another chance is being given to him.
>
> Now, which are the cases in which the importer service fails (throws
> exception)?
> is it correct to do this conversion here (from a server error / exception
> to a
> "validation" error)? or you should rather call async.onFailure()? this only
> depends on the logic of the service function failure.
>
Thanks. I will look into this and fix it.
> + */
> > + public EnumSet<NavigationDirection> getValidDirections()
> > + {
> > + return EnumSet.of(NavigationDirection.FINISH);
>
> We also return CANCEL here, even if a button for it is not displayed and
> it's
> always possible (through the dialog's close button), but in case we will
> ever
> want to display a button, or want to prevent the cancel in certain steps.
>
Ok, I will fix this.
>
> > + public void init(Object data, AsyncCallback< ?> cb)
> > + {
> > + textArea.setHTML("");
> > + textArea.setFocus(true);
>
> I seriously doubt this works, you should a FocusCommand(), look at its
> comment
> for reasons.
>
Ok.
>
> > + protected Map<String, String> getHTMLCleaningParams()
> > + {
> > + Map<String, String> params = new HashMap<String, String>();
> > + params.put("filterStyles", "strict");
> > + // For Office2007: Office2007 generates an xhtml document (when
> copied) which has attributes and tags of
> > + // several namespaces. But the document itself doesn't contain
> the namespace definitions, which causes
> > + // the HTMLCleaner (the DomSerializer) to fail while performing
> it's operations. As a workaround we
> > + // force HTMLCleaner to avoid parsing of namespace information.
> > + params.put("namespacesAware", Boolean.toString(false));
> > + return params;
> > + }
>
> Is this the same function as in the other class?
>
Yes, I am reluctant to introduce a super class or a utility class to wrap up
this functionality. Not sure if I should do it or not.
> + return requestedStep;
>
> Maybe we could create a super class for this, it's the same everywhere.
>
+1.
> Also,
>
> svn propset svn:keywords "Author Id Revision HeadURL" <new-file-path>
>
> for all new added files.
>
> check
>
> http://dev.xwiki.org/xwiki/bin/view/Community/DevelopmentPractices#HSubvers…
> for how to configure this for your svn client. Note that, even if correctly
> configured, the settings will not be considered by the eclipse plugin (I
> didn't
> manage to make them work), you'll have to do a command-line svn add for
> that to
> work right.
>
Ok, thanks for the tip.
- Asiri
1
0
Hi Asiri,
see below
On 10/09/2009 02:32 PM, asiri (SVN) wrote:
> Author: asiri
> Date: 2009-10-09 13:32:44 +0200 (Fri, 09 Oct 2009)
> New Revision: 24335
>
> Added:
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImportMenuExtension.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImportPlugin.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImportPluginFactory.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImportOfficeFileWizardStep.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImportOfficePasteWizardStep.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImportWizard.java
> platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/client/editor/import.gif
> platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/client/editor/import_office_file.gif
> platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/client/editor/import_office_paste.gif
> Removed:
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImporterListener.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImporterPlugin.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImporterPluginFactory.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/AbstractImporter.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ClipboardImporter.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/FileImporter.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImporterDialog.java
> platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/client/editor/importer.gif
> Modified:
> platform/web/trunk/standard/src/main/webapp/templates/macros.vm
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/editor/Images.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/editor/Strings.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/editor/WysiwygEditorFactory.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/image/ui/ImageUploadWizardStep.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/link/ui/AttachmentUploadWizardStep.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/widget/wizard/util/AbstractFileUploadWizardStep.java
> platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/client/editor/Strings.properties
> platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/public/stylesheets/importer.css
> Log:
> XWIKI-4469: Move officeimporter plugin functionality to wysiwyg top-level menu.
>
> * Implemented, need to re-integrate the "Filter Styles" checkbox. Will be done shortly.
>
> Modified: platform/web/trunk/standard/src/main/webapp/templates/macros.vm
> ===================================================================
> --- platform/web/trunk/standard/src/main/webapp/templates/macros.vm 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/standard/src/main/webapp/templates/macros.vm 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -2211,9 +2211,9 @@
> displayTabs: true,
> defaultEditor: "wysiwyg",
> #end
> - plugins: '$xwiki.getXWikiPreference("wysiwyg.plugins", "submit line separator text valign list indent history format symbol link image table macro importer#if($full&& $request.sync) sync#end")',
> - menu: '$xwiki.getXWikiPreference("wysiwyg.menu", "link image table macro")',
> - toolbar: '$xwiki.getXWikiPreference("wysiwyg.toolbar", "bold italic underline strikethrough | subscript superscript | unorderedlist orderedlist | outdent indent | undo redo | format | hr symbol | link unlink | importer")',
> + plugins: '$xwiki.getXWikiPreference("wysiwyg.plugins", "submit line separator text valign list indent history format symbol link image table macro import#if($full&& $request.sync) sync#end")',
> + menu: '$xwiki.getXWikiPreference("wysiwyg.menu", "link image table macro import")',
> + toolbar: '$xwiki.getXWikiPreference("wysiwyg.toolbar", "bold italic underline strikethrough | subscript superscript | unorderedlist orderedlist | outdent indent | undo redo | format | hr symbol | link unlink")',
> wiki: '$!{editedDocument.wiki.replace("'", "\'")}',
> space: '$!{editedDocument.space.replace("'", "\'")}',
> page: '$!{editedDocument.name.replace("'", "\'")}',
>
> Modified: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/editor/Images.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/editor/Images.java 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/editor/Images.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -53,8 +53,17 @@
> @Resource("image.gif")
> AbstractImagePrototype image();
>
> - @Resource("importer.gif")
> - AbstractImagePrototype importer();
> + @Resource("import.gif")
> + AbstractImagePrototype importMenuEntryIcon();
> +
> + @Resource("import.gif")
> + AbstractImagePrototype importWizardIcon();
> +
> + @Resource("import_office_file.gif")
> + AbstractImagePrototype importOfficeFileMenuEntryIcon();
> +
> + @Resource("import_office_paste.gif")
> + AbstractImagePrototype importOfficePasteMenuEntryIcon();
>
> @Resource("indent.gif")
> AbstractImagePrototype indent();
>
> Modified: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/editor/Strings.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/editor/Strings.java 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/editor/Strings.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -361,32 +361,30 @@
>
> String tableInsertDialogTitle();
>
> - String tableInsertStrictPositiveIntegerRequired();
> -
> - String importerToolTip();
> -
> - String importerCaption();
> -
> - String importerClipboardTabCaption();
> -
> - String importerClipboardTabInfoLabel();
> -
> - String importerClipboardTabHelpLabel();
> -
> - String importerFileTabCaption();
> -
> - String importerFileTabInfoLabel();
> -
> - String importerFileTabHelpLabel();
> + String tableInsertStrictPositiveIntegerRequired();
>
> - String importerFileTabNotAvailableLabel();
> + String importMenuEntryCaption();
> +
> + String importWizardTitle();
> +
> + String importWizardImportButtonCaption();
> +
> + String importOfficeFileMenuItemCaption();
> +
> + String importOfficeFileFeatureNotAvailable();
> +
> + String importOfficeFileWizardStepTitle();
> +
> + String importOfficeFileHelpLabel();
> +
> + String importOfficePasteMenuItemCaption();
> +
> + String importOfficePasteWizardStepTitle();
> +
> + String importOfficePasteInfoLabel();
> +
> + String importOfficePasteHelpLabel();
>
> - String importerFilterStylesCheckBoxCaption();
> -
> - String importerImportButtonCaption();
> -
> - String importerCancelButtonCaption();
> -
> String wizardCancel();
>
> String wizardPrevious();
>
> Modified: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/editor/WysiwygEditorFactory.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/editor/WysiwygEditorFactory.java 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/editor/WysiwygEditorFactory.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -26,7 +26,7 @@
> import com.xpn.xwiki.wysiwyg.client.plugin.format.FormatPluginFactory;
> import com.xpn.xwiki.wysiwyg.client.plugin.history.HistoryPluginFactory;
> import com.xpn.xwiki.wysiwyg.client.plugin.image.ImagePluginFactory;
> -import com.xpn.xwiki.wysiwyg.client.plugin.importer.ImporterPluginFactory;
> +import com.xpn.xwiki.wysiwyg.client.plugin.importer.ImportPluginFactory;
> import com.xpn.xwiki.wysiwyg.client.plugin.indent.IndentPluginFactory;
> import com.xpn.xwiki.wysiwyg.client.plugin.internal.DefaultPluginFactoryManager;
> import com.xpn.xwiki.wysiwyg.client.plugin.justify.JustifyPluginFactory;
> @@ -100,7 +100,7 @@
> pfm.addPluginFactory(LinkPluginFactory.getInstance());
> pfm.addPluginFactory(TablePluginFactory.getInstance());
> pfm.addPluginFactory(ImagePluginFactory.getInstance());
> - pfm.addPluginFactory(ImporterPluginFactory.getInstance());
> + pfm.addPluginFactory(ImportPluginFactory.getInstance());
> pfm.addPluginFactory(MacroPluginFactory.getInstance());
> // add additional PluginFactory for other plug-ins
> }
>
> Modified: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/image/ui/ImageUploadWizardStep.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/image/ui/ImageUploadWizardStep.java 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/image/ui/ImageUploadWizardStep.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -86,12 +86,13 @@
> * {@inheritDoc}
> */
> @Override
> - protected void onAttachmentUploaded(Attachment attach)
> + protected void onAttachmentUploaded(Attachment attach, AsyncCallback<Boolean> async)
> {
> // upload is done successfully, commit the data in the image config
> imageData.setImageURL(attach.getDownloadUrl());
> ResourceName ref = new ResourceName(attach.getReference(), true);
> imageData.setReference(ref.getRelativeTo(editedResource).toString());
> + async.onSuccess(true);
> }
>
> /**
>
> Added: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImportMenuExtension.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImportMenuExtension.java (rev 0)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImportMenuExtension.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -0,0 +1,103 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package com.xpn.xwiki.wysiwyg.client.plugin.importer;
> +
> +import com.google.gwt.user.client.Command;
> +import com.xpn.xwiki.wysiwyg.client.editor.Images;
> +import com.xpn.xwiki.wysiwyg.client.editor.Strings;
> +import com.xpn.xwiki.wysiwyg.client.plugin.internal.MenuItemUIExtension;
> +import com.xpn.xwiki.wysiwyg.client.widget.MenuBar;
> +import com.xpn.xwiki.wysiwyg.client.widget.MenuItem;
> +
> +/**
> + * Provides access to various content importers through the top-level wysiwyg menu.
> + *
> + * @version $Id$
> + * @since 2.0.1
> + */
> +public class ImportMenuExtension extends MenuItemUIExtension
> +{
> + /**
> + * The top level menu entry.
> + */
> + private MenuItem importMenuEntry;
> +
> + /**
> + * The sub-menu that gets expanded once clicked on importMenuEntry.
> + */
> + private MenuBar importMenu;
> +
> + /**
> + * Creates a new import menu extension.
> + *
> + * @param importPlugin import plugin instance.
> + */
> + public ImportMenuExtension(final ImportPlugin importPlugin)
> + {
> + super("menu");
> +
> + // Office File Import.
> + MenuItem importOfficeFileMenuItem =
> + new MenuItem(Strings.INSTANCE.importOfficeFileMenuItemCaption(), new Command()
> + {
> + public void execute()
> + {
> + importPlugin.onImportOfficeFile();
> + }
> + });
> + importOfficeFileMenuItem.setIcon(Images.INSTANCE.importOfficeFileMenuEntryIcon().createElement());
> +
> + // Office Paste Import.
> + MenuItem importOfficePasteMenuItem =
> + new MenuItem(Strings.INSTANCE.importOfficePasteMenuItemCaption(), new Command()
> + {
> + public void execute()
> + {
> + importPlugin.onImportOfficePaste();
> +
> + }
> + });
> + importOfficePasteMenuItem.setIcon(Images.INSTANCE.importOfficePasteMenuEntryIcon().createElement());
> +
> + importMenu = new MenuBar(true);
> + importMenu.setAnimationEnabled(false);
> + importMenu.addItem(importOfficeFileMenuItem);
> + importMenu.addItem(importOfficePasteMenuItem);
> +
> + importMenuEntry = new MenuItem(Strings.INSTANCE.importMenuEntryCaption(), importMenu);
> + importMenuEntry.setIcon(Images.INSTANCE.importMenuEntryIcon().createElement());
> +
> + addFeature(ImportPluginFactory.getInstance().getPluginName(), importMenuEntry);
> + }
> +
> + /**
> + * Cleans up this menu extension on destroy.
> + */
> + public void destroy()
> + {
> + importMenu.clearItems();
> + importMenu = null;
> +
> + importMenuEntry.getParentMenu().removeItem(importMenuEntry);
> + importMenuEntry = null;
> +
> + this.clearFeatures();
> + }
> +}
>
> Copied: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImportPlugin.java (from rev 24287, platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImporterPlugin.java)
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImportPlugin.java (rev 0)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImportPlugin.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -0,0 +1,122 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package com.xpn.xwiki.wysiwyg.client.plugin.importer;
> +
> +import com.google.gwt.user.client.Window;
> +import com.xpn.xwiki.wysiwyg.client.Wysiwyg;
> +import com.xpn.xwiki.wysiwyg.client.editor.Strings;
> +import com.xpn.xwiki.wysiwyg.client.plugin.importer.ui.ImportWizard;
> +import com.xpn.xwiki.wysiwyg.client.plugin.importer.ui.ImportWizard.ImportWizardStep;
> +import com.xpn.xwiki.wysiwyg.client.plugin.internal.AbstractPlugin;
> +import com.xpn.xwiki.wysiwyg.client.util.Config;
> +import com.xpn.xwiki.wysiwyg.client.widget.rta.RichTextArea;
> +import com.xpn.xwiki.wysiwyg.client.widget.rta.cmd.Command;
> +import com.xpn.xwiki.wysiwyg.client.widget.wizard.Wizard;
> +import com.xpn.xwiki.wysiwyg.client.widget.wizard.WizardListener;
> +
> +/**
> + * Plugin responsible for importing external content into wysiwyg editor.
> + *
> + * @version $Id$
> + */
> +public class ImportPlugin extends AbstractPlugin implements WizardListener
> +{
> + /**
> + * Import wizard.
> + */
> + private Wizard importWizard;
> +
> + /**
> + * Import menu extension.
> + */
> + private ImportMenuExtension importMenuExtension;
> +
> + /**
> + * {@inheritDoc}
> + */
> + public void init(Wysiwyg wysiwyg, RichTextArea textArea, Config config)
> + {
> + super.init(wysiwyg, textArea, config);
> + this.importMenuExtension = new ImportMenuExtension(this);
> + getUIExtensionList().add(importMenuExtension);
> + }
> +
> + /**
> + * Method invoked by {@link ImportMenuExtension} when "Import -> Office File" menu item is clicked.
> + */
> + public void onImportOfficeFile()
> + {
> + boolean isOpenOfficeServerConnected =
> + getConfig().getParameter("openofficeServerConnected", "false").equals("true");
> + if (isOpenOfficeServerConnected) {
> + getImportWizard().start(ImportWizardStep.OFFICE_FILE.toString(), null);
> + } else {
> + Window.alert(Strings.INSTANCE.importOfficeFileFeatureNotAvailable());
> + }
> + }
> +
> + /**
> + * Method invoked by {@link ImportMenuExtension} when "Import -> Office Content" menu item is clicked.
> + */
> + public void onImportOfficePaste()
> + {
> + getImportWizard().start(ImportWizardStep.OFFICE_PASTE.toString(), null);
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public void onCancel(Wizard sender)
> + {
> + getTextArea().setFocus(true);
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public void onFinish(Wizard sender, Object result)
> + {
> + getTextArea().setFocus(true);
> + getTextArea().getCommandManager().execute(Command.INSERT_HTML, result.toString());
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public void destroy()
> + {
> + importMenuExtension.destroy();
> + super.destroy();
> + }
> +
> + /**
> + * Creates and returns the import wizard.
> + *
> + * @return import wizard instance.
> + */
> + private Wizard getImportWizard()
> + {
> + if (null == importWizard) {
> + importWizard = new ImportWizard(getConfig());
> + importWizard.addWizardListener(this);
> + }
> + return importWizard;
> + }
> +}
>
> Copied: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImportPluginFactory.java (from rev 24287, platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImporterPluginFactory.java)
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImportPluginFactory.java (rev 0)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImportPluginFactory.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -0,0 +1,63 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package com.xpn.xwiki.wysiwyg.client.plugin.importer;
> +
> +import com.xpn.xwiki.wysiwyg.client.plugin.Plugin;
> +import com.xpn.xwiki.wysiwyg.client.plugin.internal.AbstractPluginFactory;
> +
> +/**
> + * {@link PluginFactory} class for the office importer wysiwyg plugin.
> + *
> + * @version $Id$
> + */
> +public final class ImportPluginFactory extends AbstractPluginFactory
> +{
> + /**
> + * Private instance of the plugin factory. Plugin factory is a singleton.
> + */
> + private static ImportPluginFactory instance;
> +
> + /**
> + * Private constructor.
> + */
> + private ImportPluginFactory()
> + {
> + super("import");
> + }
> +
> + /**
> + * @return The singleton instance of the plugin factory.
> + */
> + public static synchronized ImportPluginFactory getInstance()
> + {
> + if (null == instance) {
> + instance = new ImportPluginFactory();
> + }
> + return instance;
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public Plugin newInstance()
> + {
> + return new ImportPlugin();
> + }
> +}
>
> Deleted: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImporterListener.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImporterListener.java 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImporterListener.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -1,44 +0,0 @@
> -/*
> - * See the NOTICE file distributed with this work for additional
> - * information regarding copyright ownership.
> - *
> - * This is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU Lesser General Public License as
> - * published by the Free Software Foundation; either version 2.1 of
> - * the License, or (at your option) any later version.
> - *
> - * This software 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
> - * Lesser General Public License for more details.
> - *
> - * You should have received a copy of the GNU Lesser General Public
> - * License along with this software; if not, write to the Free
> - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> - * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> - */
> -
> -package com.xpn.xwiki.wysiwyg.client.plugin.importer;
> -
> -/**
> - * The interface allowing a controller to listen to office import events.
> - *
> - * @version $Id$
> - * @since 2.0.1
> - */
> -public interface ImporterListener
> -{
> - /**
> - * This method will be invoked when an office import operation completes successfully.
> - *
> - * @param result the result of import operation.
> - */
> - void onSuccess(String result);
> -
> - /**
> - * This method will be invoked when an office import operation fails for some reason.
> - *
> - * @param error a message explaining the error.
> - */
> - void onFailure(String error);
> -}
>
> Deleted: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImporterPlugin.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImporterPlugin.java 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImporterPlugin.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -1,138 +0,0 @@
> -/*
> - * See the NOTICE file distributed with this work for additional
> - * information regarding copyright ownership.
> - *
> - * This is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU Lesser General Public License as
> - * published by the Free Software Foundation; either version 2.1 of
> - * the License, or (at your option) any later version.
> - *
> - * This software 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
> - * Lesser General Public License for more details.
> - *
> - * You should have received a copy of the GNU Lesser General Public
> - * License along with this software; if not, write to the Free
> - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> - * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> - */
> -package com.xpn.xwiki.wysiwyg.client.plugin.importer;
> -
> -import com.google.gwt.event.dom.client.ClickEvent;
> -import com.google.gwt.event.dom.client.ClickHandler;
> -import com.google.gwt.user.client.Window;
> -import com.google.gwt.user.client.ui.PushButton;
> -import com.xpn.xwiki.wysiwyg.client.Wysiwyg;
> -import com.xpn.xwiki.wysiwyg.client.editor.Images;
> -import com.xpn.xwiki.wysiwyg.client.editor.Strings;
> -import com.xpn.xwiki.wysiwyg.client.plugin.importer.ui.ImporterDialog;
> -import com.xpn.xwiki.wysiwyg.client.plugin.internal.AbstractPlugin;
> -import com.xpn.xwiki.wysiwyg.client.plugin.internal.FocusWidgetUIExtension;
> -import com.xpn.xwiki.wysiwyg.client.util.Config;
> -import com.xpn.xwiki.wysiwyg.client.widget.CompositeDialogBox;
> -import com.xpn.xwiki.wysiwyg.client.widget.rta.RichTextArea;
> -import com.xpn.xwiki.wysiwyg.client.widget.rta.cmd.Command;
> -
> -/**
> - * Office Importer wysiwyg plugin.
> - *
> - * @version $Id$
> - */
> -public class ImporterPlugin extends AbstractPlugin implements ClickHandler, ImporterListener
> -{
> - /**
> - * Import button placed on the tool bar.
> - */
> - private PushButton importPushButton;
> -
> - /**
> - * Importer dialog used to communicate with the user.
> - */
> - private CompositeDialogBox importerDialog;
> -
> - /**
> - * The toolbar extension used to add the link buttons to the toolbar.
> - */
> - private final FocusWidgetUIExtension toolBarExtension = new FocusWidgetUIExtension("toolbar");
> -
> - /**
> - * {@inheritDoc}
> - */
> - public void init(Wysiwyg wysiwyg, RichTextArea textArea, Config config)
> - {
> - super.init(wysiwyg, textArea, config);
> -
> - if (getTextArea().getCommandManager().isSupported(Command.INSERT_HTML)) {
> - importPushButton = new PushButton(Images.INSTANCE.importer().createImage());
> - saveRegistration(importPushButton.addClickHandler(this));
> - importPushButton.setTitle(Strings.INSTANCE.importerToolTip());
> - toolBarExtension.addFeature("importer", importPushButton);
> - }
> -
> - if (toolBarExtension.getFeatures().length> 0) {
> - getUIExtensionList().add(toolBarExtension);
> - }
> - }
> -
> - /**
> - * {@inheritDoc}
> - */
> - public void destroy()
> - {
> - if (importPushButton != null) {
> - importPushButton.removeFromParent();
> - importPushButton = null;
> - }
> - if (importerDialog != null) {
> - importerDialog.hide();
> - importerDialog.removeFromParent();
> - importerDialog = null;
> - }
> - if (toolBarExtension.getFeatures().length> 0) {
> - toolBarExtension.clearFeatures();
> - }
> - super.destroy();
> - }
> -
> - /**
> - * {@inheritDoc}
> - *
> - * @see ClickHandler#onClick(ClickEvent)
> - */
> - public void onClick(ClickEvent event)
> - {
> - if (event.getSource() == importPushButton) {
> - getImporterDialog().center();
> - }
> - }
> -
> - /**
> - * @return The importer dialog instance.
> - */
> - private CompositeDialogBox getImporterDialog()
> - {
> - if (null == importerDialog) {
> - importerDialog = new ImporterDialog(getConfig(), this);
> - }
> - return importerDialog;
> - }
> -
> - /**
> - * {@inheritDoc}
> - */
> - public void onFailure(String error)
> - {
> - Window.alert(error);
> - importerDialog.hide();
> - }
> -
> - /**
> - * {@inheritDoc}
> - */
> - public void onSuccess(String result)
> - {
> - getTextArea().getCommandManager().execute(Command.INSERT_HTML, result);
> - importerDialog.hide();
> - }
> -}
>
> Deleted: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImporterPluginFactory.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImporterPluginFactory.java 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ImporterPluginFactory.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -1,63 +0,0 @@
> -/*
> - * See the NOTICE file distributed with this work for additional
> - * information regarding copyright ownership.
> - *
> - * This is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU Lesser General Public License as
> - * published by the Free Software Foundation; either version 2.1 of
> - * the License, or (at your option) any later version.
> - *
> - * This software 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
> - * Lesser General Public License for more details.
> - *
> - * You should have received a copy of the GNU Lesser General Public
> - * License along with this software; if not, write to the Free
> - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> - * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> - */
> -package com.xpn.xwiki.wysiwyg.client.plugin.importer;
> -
> -import com.xpn.xwiki.wysiwyg.client.plugin.Plugin;
> -import com.xpn.xwiki.wysiwyg.client.plugin.internal.AbstractPluginFactory;
> -
> -/**
> - * {@link PluginFactory} class for the office importer wysiwyg plugin.
> - *
> - * @version $Id$
> - */
> -public final class ImporterPluginFactory extends AbstractPluginFactory
> -{
> - /**
> - * Private instance of the plugin factory. Plugin factory is a singleton.
> - */
> - private static ImporterPluginFactory instance;
> -
> - /**
> - * Private constructor.
> - */
> - private ImporterPluginFactory()
> - {
> - super("importer");
> - }
> -
> - /**
> - * @return The singleton instance of the plugin factory.
> - */
> - public static synchronized ImporterPluginFactory getInstance()
> - {
> - if (null == instance) {
> - instance = new ImporterPluginFactory();
> - }
> - return instance;
> - }
> -
> - /**
> - * {@inheritDoc}
> - */
> - public Plugin newInstance()
> - {
> - return new ImporterPlugin();
> - }
> -}
>
> Deleted: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/AbstractImporter.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/AbstractImporter.java 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/AbstractImporter.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -1,187 +0,0 @@
> -/*
> - * See the NOTICE file distributed with this work for additional
> - * information regarding copyright ownership.
> - *
> - * This is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU Lesser General Public License as
> - * published by the Free Software Foundation; either version 2.1 of
> - * the License, or (at your option) any later version.
> - *
> - * This software 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
> - * Lesser General Public License for more details.
> - *
> - * You should have received a copy of the GNU Lesser General Public
> - * License along with this software; if not, write to the Free
> - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> - * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> - */
> -
> -package com.xpn.xwiki.wysiwyg.client.plugin.importer.ui;
> -
> -import java.util.HashMap;
> -import java.util.Map;
> -
> -import com.google.gwt.event.dom.client.ClickEvent;
> -import com.google.gwt.event.dom.client.ClickHandler;
> -import com.google.gwt.user.client.ui.Button;
> -import com.google.gwt.user.client.ui.CheckBox;
> -import com.google.gwt.user.client.ui.Composite;
> -import com.google.gwt.user.client.ui.FlowPanel;
> -import com.google.gwt.user.client.ui.Panel;
> -import com.xpn.xwiki.wysiwyg.client.WysiwygService;
> -import com.xpn.xwiki.wysiwyg.client.WysiwygServiceAsync;
> -import com.xpn.xwiki.wysiwyg.client.editor.Strings;
> -import com.xpn.xwiki.wysiwyg.client.plugin.importer.ImporterListener;
> -import com.xpn.xwiki.wysiwyg.client.util.Config;
> -
> -/**
> - * Base class for both file / clipboard importers.
> - *
> - * @version $Id$
> - * @since 2.0.1
> - */
> -public abstract class AbstractImporter extends Composite implements ClickHandler
> -{
> - /**
> - * CSS style name for indicating busy waiting.
> - */
> - protected static final String STYLE_LOADING = "loading";
> -
> - /**
> - * Wysiwyg configuration.
> - */
> - protected Config config;
> -
> - /**
> - * The importer listener.
> - */
> - protected ImporterListener importerListener;
> -
> - /**
> - * {@link WysiwygServiceAsync} used for invoking remote GWT RPC calls.
> - */
> - protected WysiwygServiceAsync wysiwygService;
> -
> - /**
> - * Base panel which sits on top of the composite.
> - */
> - private Panel basePanel;
> -
> - /**
> - * The content panel sitting on top of the base panel.
> - */
> - private Panel contentPanel;
> -
> - /**
> - * Filter Styles check box.
> - */
> - private CheckBox filterStylesCheckBox;
> -
> - /**
> - * Import button.
> - */
> - private Button importButton;
> -
> - /**
> - * Creates a new importer.
> - *
> - * @param wysiwygConfig wysiwyg configuration.
> - * @param importerListener import process listner.
> - */
> - public AbstractImporter(Config wysiwygConfig, ImporterListener importerListener)
> - {
> - this.config = wysiwygConfig;
> - this.importerListener = importerListener;
> - this.wysiwygService = WysiwygService.Singleton.getInstance();
> -
> - // Create the content panel.
> - this.contentPanel = createContentPanel();
> -
> - // Append the button panel.
> - contentPanel.add(createButtonPanel());
> -
> - // Finally add the content panel to base panel.
> - this.basePanel = new FlowPanel();
> - basePanel.add(contentPanel);
> - initWidget(basePanel);
> - }
> -
> - /**
> - * Creates the button panel.
> - *
> - * @return the button panel.
> - */
> - private Panel createButtonPanel()
> - {
> - Panel buttonPanel = new FlowPanel();
> - filterStylesCheckBox = new CheckBox(Strings.INSTANCE.importerFilterStylesCheckBoxCaption());
> - buttonPanel.add(filterStylesCheckBox);
> - importButton = new Button(Strings.INSTANCE.importerImportButtonCaption());
> - importButton.addStyleName("xImporterImportButton");
> - importButton.addClickHandler(this);
> - buttonPanel.add(importButton);
> - // Add a clear floats panel.
> - Panel fakeClearPanel = new FlowPanel();
> - fakeClearPanel.addStyleName("clearfloats");
> - buttonPanel.add(fakeClearPanel);
> - return buttonPanel;
> - }
> -
> - /**
> - * {@inheritDoc}
> - */
> - public void onClick(ClickEvent event)
> - {
> - if (event.getSource() == importButton) {
> - onImportButtonClick();
> - }
> - }
> -
> - /**
> - * Delegate method for creating content panel.
> - *
> - * @return content panel.
> - */
> - protected abstract Panel createContentPanel();
> -
> - /**
> - * Delegate method for handling the import operation.
> - */
> - protected abstract void onImportButtonClick();
> -
> - /**
> - * Prepares the cleaning parameters map.
> - *
> - * @return a {@link Map} with cleaning parameters for office importer.
> - */
> - protected Map<String, String> getHTMLCleaningParams()
> - {
> - Map<String, String> params = new HashMap<String, String>();
> - if (filterStylesCheckBox.getValue()) {
> - params.put("filterStyles", "strict");
> - }
> - // For Office2007: Office2007 generates an xhtml document (when copied) which has attributes and tags of
> - // several namespaces. But the document itself doesn't contain the namespace definitions, which causes
> - // the HTMLCleaner (the DomSerializer) to fail while performing it's operations. As a workaround we
> - // force HTMLCleaner to avoid parsing of namespace information.
> - params.put("namespacesAware", Boolean.toString(false));
> - return params;
> - }
> -
> - /**
> - * Sets / Unsets this importer UI to 'busy' mode.
> - *
> - * @param busy busy or not.
> - */
> - protected void setBusy(boolean busy)
> - {
> - contentPanel.setVisible(!busy);
> - if (busy) {
> - basePanel.addStyleName(STYLE_LOADING);
> - } else {
> - basePanel.removeStyleName(STYLE_LOADING);
> - }
> - }
> -}
>
> Deleted: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ClipboardImporter.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ClipboardImporter.java 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ClipboardImporter.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -1,195 +0,0 @@
> -/*
> - * See the NOTICE file distributed with this work for additional
> - * information regarding copyright ownership.
> - *
> - * This is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU Lesser General Public License as
> - * published by the Free Software Foundation; either version 2.1 of
> - * the License, or (at your option) any later version.
> - *
> - * This software 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
> - * Lesser General Public License for more details.
> - *
> - * You should have received a copy of the GNU Lesser General Public
> - * License along with this software; if not, write to the Free
> - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> - * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> - */
> -package com.xpn.xwiki.wysiwyg.client.plugin.importer.ui;
> -
> -import com.google.gwt.event.dom.client.LoadEvent;
> -import com.google.gwt.event.dom.client.LoadHandler;
> -import com.google.gwt.user.client.DeferredCommand;
> -import com.google.gwt.user.client.rpc.AsyncCallback;
> -import com.google.gwt.user.client.ui.FlowPanel;
> -import com.google.gwt.user.client.ui.InlineLabel;
> -import com.google.gwt.user.client.ui.Label;
> -import com.google.gwt.user.client.ui.Panel;
> -import com.xpn.xwiki.wysiwyg.client.editor.Strings;
> -import com.xpn.xwiki.wysiwyg.client.plugin.importer.ImporterListener;
> -import com.xpn.xwiki.wysiwyg.client.util.Config;
> -import com.xpn.xwiki.wysiwyg.client.util.FocusCommand;
> -import com.xpn.xwiki.wysiwyg.client.util.Selectable;
> -import com.xpn.xwiki.wysiwyg.client.widget.rta.RichTextArea;
> -import com.xpn.xwiki.wysiwyg.client.widget.rta.SelectionPreserver;
> -
> -/**
> - * Office Importer for importing clipboard content.
> - *
> - * @version $Id$
> - */
> -public class ClipboardImporter extends AbstractImporter implements Selectable, LoadHandler, AsyncCallback<String>
> -{
> - /**
> - * The text area where the user can paste his content.
> - */
> - private RichTextArea textArea;
> -
> - /**
> - * Preserves the selection inside the {@link #textArea} while this tab is hidden.
> - */
> - private SelectionPreserver selectionPreserver;
> -
> - /**
> - * Flag indicating if this tab is selected.
> - */
> - private boolean selected;
> -
> - /**
> - * Flag indicating if the text area is loaded.
> - */
> - private boolean loaded;
> -
> - /**
> - * Default constructor.
> - *
> - * @param wysiwygConfig wysiwyg configuration.
> - * @param importerListener importer listener.
> - */
> - public ClipboardImporter(Config wysiwygConfig, ImporterListener importerListener)
> - {
> - super(wysiwygConfig, importerListener);
> - }
> -
> - /**
> - * {@inheritDoc}
> - */
> - protected Panel createContentPanel()
> - {
> - Panel contentPanel = new FlowPanel();
> -
> - // Info label.
> - Panel infoLabel = new FlowPanel();
> - infoLabel.setStyleName("xInfoLabel");
> - infoLabel.add(new InlineLabel(Strings.INSTANCE.importerClipboardTabInfoLabel()));
> - InlineLabel mandatoryLabel = new InlineLabel(Strings.INSTANCE.mandatory());
> - mandatoryLabel.addStyleName("xMandatory");
> - infoLabel.add(mandatoryLabel);
> - contentPanel.add(infoLabel);
> -
> - // Help label.
> - Label helpLabel = new Label(Strings.INSTANCE.importerClipboardTabHelpLabel());
> - helpLabel.setStyleName("xHelpLabel");
> - contentPanel.add(helpLabel);
> -
> - // Text area panel.
> - textArea = new RichTextArea();
> - textArea.addLoadHandler(this);
> - textArea.addStyleName("xImporterClipboardTabEditor");
> - selectionPreserver = new SelectionPreserver(textArea);
> - contentPanel.add(textArea);
> -
> - return contentPanel;
> - }
> -
> - /**
> - * {@inheritDoc}
> - */
> - protected void onImportButtonClick()
> - {
> - String htmlPaste = textArea.getHTML().trim();
> - if (!htmlPaste.equals("")) {
> - setBusy(true);
> - wysiwygService.cleanOfficeHTML(htmlPaste, "wysiwyg", getHTMLCleaningParams(), this);
> - }
> - }
> -
> - /**
> - * {@inheritDoc}
> - */
> - public void onFailure(Throwable thrown)
> - {
> - this.importerListener.onFailure(thrown.getMessage());
> - setBusy(false);
> - textArea.setHTML("");
> - }
> -
> - /**
> - * {@inheritDoc}
> - */
> - public void onSuccess(String result)
> - {
> - this.importerListener.onSuccess(result);
> - setBusy(false);
> - textArea.setHTML("");
> - }
> -
> - /**
> - * {@inheritDoc}
> - *
> - * @see LoadHandler#onLoad(LoadEvent)
> - */
> - public void onLoad(LoadEvent event)
> - {
> - if (event.getSource() == textArea) {
> - loaded = true;
> - maybeFocusTextArea();
> - }
> - }
> -
> - /**
> - * {@inheritDoc}
> - *
> - * @see Selectable#setSelected(boolean)
> - */
> - public void setSelected(boolean selected)
> - {
> - if (this.selected != selected) {
> - this.selected = selected;
> - if (selected) {
> - maybeFocusTextArea();
> - } else {
> - selectionPreserver.saveSelection();
> - }
> - }
> - }
> -
> - /**
> - * {@inheritDoc}
> - *
> - * @see Selectable#isSelected()
> - */
> - public boolean isSelected()
> - {
> - return selected;
> - }
> -
> - /**
> - * Focuses the text area if it is loaded and the tab is selected.
> - */
> - private void maybeFocusTextArea()
> - {
> - if (loaded&& selected) {
> - DeferredCommand.addCommand(new FocusCommand(textArea)
> - {
> - public void execute()
> - {
> - super.execute();
> - selectionPreserver.restoreSelection();
> - }
> - });
> - }
> - }
> -}
>
> Deleted: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/FileImporter.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/FileImporter.java 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/FileImporter.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -1,183 +0,0 @@
> -/*
> - * See the NOTICE file distributed with this work for additional
> - * information regarding copyright ownership.
> - *
> - * This is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU Lesser General Public License as
> - * published by the Free Software Foundation; either version 2.1 of
> - * the License, or (at your option) any later version.
> - *
> - * This software 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
> - * Lesser General Public License for more details.
> - *
> - * You should have received a copy of the GNU Lesser General Public
> - * License along with this software; if not, write to the Free
> - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> - * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> - */
> -package com.xpn.xwiki.wysiwyg.client.plugin.importer.ui;
> -
> -import com.google.gwt.user.client.rpc.AsyncCallback;
> -import com.google.gwt.user.client.ui.FileUpload;
> -import com.google.gwt.user.client.ui.FlowPanel;
> -import com.google.gwt.user.client.ui.FormPanel;
> -import com.google.gwt.user.client.ui.InlineLabel;
> -import com.google.gwt.user.client.ui.Label;
> -import com.google.gwt.user.client.ui.Panel;
> -import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent;
> -import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler;
> -import com.xpn.xwiki.wysiwyg.client.editor.Strings;
> -import com.xpn.xwiki.wysiwyg.client.plugin.importer.ImporterListener;
> -import com.xpn.xwiki.wysiwyg.client.util.Config;
> -
> -/**
> - * Office Importer for importing office documents.
> - *
> - * @version $Id$
> - */
> -public class FileImporter extends AbstractImporter implements SubmitCompleteHandler, AsyncCallback<String>
> -{
> - /**
> - * Style identifier for help message labels.
> - */
> - private static final String HELP_LABEL_STYLE = "xHelpLabel";
> -
> - /**
> - * A {@link FormPanel} to hold the fileUpload widget.
> - */
> - private FormPanel formPanel;
> -
> - /**
> - * The {@link FileUpload} widget.
> - */
> - private FileUpload fileUpload;
> -
> - /**
> - * The name of the current wiki page.
> - */
> - private String fullPageName;
> -
> - /**
> - * A flag indicating if openoffice server is available or not.
> - */
> - private boolean isOpenOfficeServerConnected;
> -
> - /**
> - * Default constructor.
> - *
> - * @param config wysiwyg configuration.
> - * @param importerListener importer listener.
> - */
> - public FileImporter(Config config, ImporterListener importerListener)
> - {
> - super(config, importerListener);
> - }
> -
> - /**
> - * {@inheritDoc}
> - */
> - protected Panel createContentPanel()
> - {
> - // Read current wysiwyg configuration.
> - String currentSpace = config.getParameter("space", "Main");
> - String currentPage = config.getParameter("page", "WebHome");
> - this.fullPageName = currentSpace + "." + currentPage;
> - this.isOpenOfficeServerConnected = config.getParameter("openofficeServerConnected", "false").equals("true");
> - String uploadURL = "../../upload/" + currentSpace + "/" + currentPage;
> -
> - return isOpenOfficeServerConnected ? createMainUI(uploadURL) : createFeatureNotAvailableUI();
> - }
> -
> - /**
> - * {@inheritDoc}
> - */
> - protected void onImportButtonClick()
> - {
> - if (isOpenOfficeServerConnected) {
> - String fileName = fileUpload.getFilename().trim();
> - if (!fileName.equals("")) {
> - setBusy(true);
> - formPanel.submit();
> - }
> - }
> - }
> -
> - /**
> - * Creates a panel that displays a message indicating that this feature is not available.
> - *
> - * @return feature not available message panel.
> - */
> - private Panel createFeatureNotAvailableUI()
> - {
> - Panel container = new FlowPanel();
> - Label featureNotAvailableLabel = new Label(Strings.INSTANCE.importerFileTabNotAvailableLabel());
> - featureNotAvailableLabel.setStyleName(HELP_LABEL_STYLE);
> - container.add(featureNotAvailableLabel);
> - return container;
> - }
> -
> - /**
> - * Creates the main UI panel.
> - *
> - * @param uploadURL file upload url.
> - * @return main ui panel.
> - */
> - private Panel createMainUI(String uploadURL)
> - {
> - Panel contentPanel = new FlowPanel();
> - // Info label.
> - Panel infoLabel = new FlowPanel();
> - infoLabel.setStyleName("xInfoLabel");
> - infoLabel.add(new InlineLabel(Strings.INSTANCE.importerFileTabInfoLabel()));
> - InlineLabel mandatoryLabel = new InlineLabel(Strings.INSTANCE.mandatory());
> - mandatoryLabel.addStyleName("xMandatory");
> - infoLabel.add(mandatoryLabel);
> - contentPanel.add(infoLabel);
> -
> - // Help label.
> - Label helpLabel = new Label(Strings.INSTANCE.importerFileTabHelpLabel());
> - helpLabel.setStyleName(HELP_LABEL_STYLE);
> - contentPanel.add(helpLabel);
> -
> - // Form panel.
> - formPanel = new FormPanel();
> - formPanel.setAction(uploadURL);
> - formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
> - formPanel.setMethod(FormPanel.METHOD_POST);
> - fileUpload = new FileUpload();
> - fileUpload.setName("filepath");
> - formPanel.add(fileUpload);
> - formPanel.addSubmitCompleteHandler(this);
> - contentPanel.add(formPanel);
> -
> - return contentPanel;
> - }
> -
> - /**
> - * {@inheritDoc}
> - */
> - public void onSubmitComplete(SubmitCompleteEvent event)
> - {
> - wysiwygService.officeToXHTML(fullPageName, getHTMLCleaningParams(), this);
> - }
> -
> - /**
> - * {@inheritDoc}
> - */
> - public void onFailure(Throwable thrown)
> - {
> - this.importerListener.onFailure(thrown.getMessage());
> - setBusy(false);
> - }
> -
> - /**
> - * {@inheritDoc}
> - */
> - public void onSuccess(String result)
> - {
> - this.importerListener.onSuccess(result);
> - setBusy(false);
> - }
> -}
>
> Added: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImportOfficeFileWizardStep.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImportOfficeFileWizardStep.java (rev 0)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImportOfficeFileWizardStep.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -0,0 +1,192 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package com.xpn.xwiki.wysiwyg.client.plugin.importer.ui;
> +
> +import java.util.EnumSet;
> +import java.util.HashMap;
> +import java.util.Map;
> +
> +import com.google.gwt.user.client.rpc.AsyncCallback;
> +import com.xpn.xwiki.wysiwyg.client.WysiwygService;
> +import com.xpn.xwiki.wysiwyg.client.editor.Strings;
> +import com.xpn.xwiki.wysiwyg.client.util.Attachment;
> +import com.xpn.xwiki.wysiwyg.client.util.Config;
> +import com.xpn.xwiki.wysiwyg.client.widget.wizard.NavigationListener.NavigationDirection;
> +import com.xpn.xwiki.wysiwyg.client.widget.wizard.util.AbstractFileUploadWizardStep;
> +
> +/**
> + * Wizard step responsible for importing the content of an office document into the wysiwyg editor.
> + *
> + * @version $Id$
> + * @since 2.0.1
> + */
> +public class ImportOfficeFileWizardStep extends AbstractFileUploadWizardStep
> +{
> + /**
> + * Wysiwyg configuration object.
> + */
> + private Config config;
> +
> + /**
> + * Result of the import operation.
> + */
> + private Object result;
> +
> + /**
> + * Instantiates the office document import wizard step.
> + *
> + * @param config wysiwyg configuration.
> + */
> + public ImportOfficeFileWizardStep(Config config)
> + {
> + this.config = config;
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public String getPage()
> + {
> + return config.getParameter("page", "WebHome");
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public String getSpace()
> + {
> + return config.getParameter("space", "Main");
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public String getWiki()
> + {
> + return config.getParameter("wiki", "xwiki");
> + }
Actually I don't see a good reason for which I made these functions public. We
should make them protected.
> +
> + /**
> + * {@inheritDoc}
> + */
> + protected String getFileHelpLabel()
> + {
> + return Strings.INSTANCE.importOfficeFileHelpLabel();
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + protected void onAttachmentUploaded(Attachment attach, final AsyncCallback<Boolean> async)
> + {
> +
> + String fullPageName = getSpace() + "." + getPage();
you should use the ResourceName class to build wiki names, since it's the client
wiki reference serializer/deserializer.
> + WysiwygService.Singleton.getInstance().officeToXHTML(fullPageName, getHTMLCleaningParams(),
> + new AsyncCallback<String>()
> + {
> + public void onSuccess(String result)
> + {
> + setResult(result);
> +
> + // Resume the wizard step submit operation.
> + async.onSuccess(true);
> + }
> +
> + public void onFailure(Throwable thrown)
> + {
> + setResult(null);
> +
> + // Display the error and avoid submit operation from continuing.
> + displayError(thrown.getMessage());
> + async.onSuccess(false);
As a convention, we used the onFailure to signal an error on the server or in
the server-client communication (like a GWT failure in the RPC call), while the
submit async.onSuccess(false) is an "application error", a way in which a wizard
step prevents the submit to be done because, for example, the user didn't insert
valid data in the wizard form and another chance is being given to him.
Now, which are the cases in which the importer service fails (throws exception)?
is it correct to do this conversion here (from a server error / exception to a
"validation" error)? or you should rather call async.onFailure()? this only
depends on the logic of the service function failure.
> + }
> + });
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public Object getResult()
> + {
> + return this.result;
> + }
> +
> + /**
> + * Sets the result of this wizard step.
> + *
> + * @param result the result.
> + */
> + private void setResult(Object result)
> + {
> + this.result = result;
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public String getNextStep()
> + {
> + return null;
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public String getDirectionName(NavigationDirection direction)
> + {
> + if (direction == NavigationDirection.FINISH) {
> + return Strings.INSTANCE.importWizardImportButtonCaption();
> + }
> + return null;
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public String getStepTitle()
> + {
> + return Strings.INSTANCE.importOfficeFileWizardStepTitle();
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public EnumSet<NavigationDirection> getValidDirections()
> + {
> + return EnumSet.of(NavigationDirection.FINISH);
We also return CANCEL here, even if a button for it is not displayed and it's
always possible (through the dialog's close button), but in case we will ever
want to display a button, or want to prevent the cancel in certain steps.
> + }
> +
> + /**
> + * Prepares the cleaning parameters map.
> + *
> + * @return a {@link Map} with cleaning parameters for office importer.
> + */
> + protected Map<String, String> getHTMLCleaningParams()
> + {
> + Map<String, String> params = new HashMap<String, String>();
> + params.put("filterStyles", "strict");
> + // For Office2007: Office2007 generates an xhtml document (when copied) which has attributes and tags of
> + // several namespaces. But the document itself doesn't contain the namespace definitions, which causes
> + // the HTMLCleaner (the DomSerializer) to fail while performing it's operations. As a workaround we
> + // force HTMLCleaner to avoid parsing of namespace information.
> + params.put("namespacesAware", Boolean.toString(false));
> + return params;
> + }
> +}
>
> Added: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImportOfficePasteWizardStep.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImportOfficePasteWizardStep.java (rev 0)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImportOfficePasteWizardStep.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -0,0 +1,209 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package com.xpn.xwiki.wysiwyg.client.plugin.importer.ui;
> +
> +import java.util.EnumSet;
> +import java.util.HashMap;
> +import java.util.Map;
> +
> +import com.google.gwt.user.client.rpc.AsyncCallback;
> +import com.google.gwt.user.client.ui.FlowPanel;
> +import com.google.gwt.user.client.ui.InlineLabel;
> +import com.google.gwt.user.client.ui.Label;
> +import com.google.gwt.user.client.ui.Panel;
> +import com.google.gwt.user.client.ui.Widget;
> +import com.xpn.xwiki.wysiwyg.client.WysiwygService;
> +import com.xpn.xwiki.wysiwyg.client.editor.Strings;
> +import com.xpn.xwiki.wysiwyg.client.widget.rta.RichTextArea;
> +import com.xpn.xwiki.wysiwyg.client.widget.wizard.WizardStep;
> +import com.xpn.xwiki.wysiwyg.client.widget.wizard.NavigationListener.NavigationDirection;
> +
> +/**
> + * Wizard step responsible for importing copy-pasted office content.
> + *
> + * @version $Id$
> + * @since 2.0.1
> + */
> +public class ImportOfficePasteWizardStep implements WizardStep
> +{
> + /**
> + * Main UI of this wizard.
> + */
> + private Panel mainPanel;
> +
> + /**
> + * The text area where the user can paste his content.
> + */
> + private RichTextArea textArea;
> +
> + /**
> + * Storage for the result of the import operation.
> + */
> + private Object result;
> +
> + /**
> + * Creates an instance of {@link ImportOfficePasteWizardStep}.
> + */
> + public ImportOfficePasteWizardStep()
> + {
> + mainPanel = new FlowPanel();
> +
> + // Info label.
> + Panel infoLabel = new FlowPanel();
> + infoLabel.setStyleName("xInfoLabel");
> + infoLabel.add(new InlineLabel(Strings.INSTANCE.importOfficePasteInfoLabel()));
> + InlineLabel mandatoryLabel = new InlineLabel(Strings.INSTANCE.mandatory());
> + mandatoryLabel.addStyleName("xMandatory");
> + infoLabel.add(mandatoryLabel);
> + mainPanel.add(infoLabel);
> +
> + // Help label.
> + Label helpLabel = new Label(Strings.INSTANCE.importOfficePasteHelpLabel());
> + helpLabel.setStyleName("xHelpLabel");
> + mainPanel.add(helpLabel);
> +
> + // Text area panel.
> + textArea = new RichTextArea();
> + textArea.addStyleName("xImportOfficeContentEditor");
> + mainPanel.add(textArea);
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public Widget display()
> + {
> + return this.mainPanel;
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public void init(Object data, AsyncCallback< ?> cb)
> + {
> + textArea.setHTML("");
> + textArea.setFocus(true);
I seriously doubt this works, you should a FocusCommand(), look at its comment
for reasons.
> + cb.onSuccess(null);
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public EnumSet<NavigationDirection> getValidDirections()
> + {
> + return EnumSet.of(NavigationDirection.FINISH);
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public String getDirectionName(NavigationDirection direction)
> + {
> + if (direction == NavigationDirection.FINISH) {
> + return Strings.INSTANCE.importWizardImportButtonCaption();
> + }
> + return null;
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public String getNextStep()
> + {
> + return null;
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public Object getResult()
> + {
> + return this.result;
> + }
> +
> + /**
> + * Sets the result of this wizard step.
> + *
> + * @param result the result.
> + */
> + private void setResult(Object result)
> + {
> + this.result = result;
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public String getStepTitle()
> + {
> + return Strings.INSTANCE.importOfficePasteWizardStepTitle();
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public void onCancel()
> + {
> + textArea.setHTML("");
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public void onSubmit(final AsyncCallback<Boolean> async)
> + {
> + String officeHTML = textArea.getHTML();
> + if (officeHTML.trim().equals("")) {
> + async.onSuccess(false);
> + } else {
> + WysiwygService.Singleton.getInstance().cleanOfficeHTML(officeHTML, "wysiwyg", getHTMLCleaningParams(),
> + new AsyncCallback<String>()
> + {
> + public void onSuccess(String result)
> + {
> + setResult(result);
> + async.onSuccess(true);
> + }
> +
> + public void onFailure(Throwable thrown)
> + {
> + async.onFailure(thrown);
> + }
> + });
> + }
> + }
> +
> + /**
> + * Prepares the cleaning parameters map.
> + *
> + * @return a {@link Map} with cleaning parameters for office importer.
> + */
> + protected Map<String, String> getHTMLCleaningParams()
> + {
> + Map<String, String> params = new HashMap<String, String>();
> + params.put("filterStyles", "strict");
> + // For Office2007: Office2007 generates an xhtml document (when copied) which has attributes and tags of
> + // several namespaces. But the document itself doesn't contain the namespace definitions, which causes
> + // the HTMLCleaner (the DomSerializer) to fail while performing it's operations. As a workaround we
> + // force HTMLCleaner to avoid parsing of namespace information.
> + params.put("namespacesAware", Boolean.toString(false));
> + return params;
> + }
Is this the same function as in the other class?
> +}
>
> Added: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImportWizard.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImportWizard.java (rev 0)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImportWizard.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -0,0 +1,128 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +
> +package com.xpn.xwiki.wysiwyg.client.plugin.importer.ui;
> +
> +import java.util.HashMap;
> +import java.util.Map;
> +
> +import com.xpn.xwiki.wysiwyg.client.editor.Images;
> +import com.xpn.xwiki.wysiwyg.client.editor.Strings;
> +import com.xpn.xwiki.wysiwyg.client.util.Config;
> +import com.xpn.xwiki.wysiwyg.client.widget.wizard.Wizard;
> +import com.xpn.xwiki.wysiwyg.client.widget.wizard.WizardStep;
> +import com.xpn.xwiki.wysiwyg.client.widget.wizard.WizardStepProvider;
> +
> +/**
> + * Import wizard responsible for performing various content import operation into wysiwyg editor.
> + *
> + * @version $Id$
> + * @since 2.0.1
> + */
> +public class ImportWizard extends Wizard implements WizardStepProvider
> +{
> + /**
> + * Enumeration of steps comprising the import wizard.
> + *
> + * @version $Id$
> + * @since 2.0.1
> + */
> + public static enum ImportWizardStep
> + {
> + /**
> + * Office file import wizard step.
> + */
> + OFFICE_FILE,
> +
> + /**
> + * Office paste import wizard step.
> + */
> + OFFICE_PASTE
> + };
> +
> + /**
> + * Map with the instantiated steps to return. Will be lazily initialized upon request.
> + */
> + private Map<ImportWizardStep, WizardStep> stepsMap = new HashMap<ImportWizardStep, WizardStep>();
> +
> + /**
> + * The wysiwyg configuration.
> + */
> + private Config config;
> +
> + /**
> + * Instantiates the import wizard.
> + *
> + * @param config wysiwyg configuration.
> + */
> + public ImportWizard(Config config)
> + {
> + super(Strings.INSTANCE.importWizardTitle(), Images.INSTANCE.importWizardIcon().createImage());
> + this.config = config;
> + this.setProvider(this);
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public WizardStep getStep(String name)
> + {
> + ImportWizardStep requestedStep = parseStepName(name);
> + WizardStep step = stepsMap.get(requestedStep);
> + if (null == step) {
> + switch (requestedStep) {
> + case OFFICE_FILE:
> + step = new ImportOfficeFileWizardStep(this.config);
> + break;
> + case OFFICE_PASTE:
> + step = new ImportOfficePasteWizardStep();
> + break;
> + default:
> + // nothing here, leave it null
> + break;
> + }
> + // if something has been created, add it in the map
> + if (step != null) {
> + stepsMap.put(requestedStep, step);
> + }
> + }
> + // return the found or newly created step
> + return step;
> + }
> +
> + /**
> + * Parses the specified step name in a {@link ImportWizardStep} value.
> + *
> + * @param name the name of the step to parse
> + * @return the {@link ImportWizardStep} {@code enum} value corresponding to the passed name, or {@code null} if no
> + * such value exists.
> + */
> + private ImportWizardStep parseStepName(String name)
> + {
> + // let's be careful about this
> + ImportWizardStep requestedStep = null;
> + try {
> + requestedStep = ImportWizardStep.valueOf(name);
> + } catch (IllegalArgumentException e) {
> + // nothing, just leave it null if it cannot be found in the enum
> + }
> + return requestedStep;
Maybe we could create a super class for this, it's the same everywhere.
> + }
> +}
>
> Deleted: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImporterDialog.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImporterDialog.java 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/importer/ui/ImporterDialog.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -1,92 +0,0 @@
> -/*
> - * See the NOTICE file distributed with this work for additional
> - * information regarding copyright ownership.
> - *
> - * This is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU Lesser General Public License as
> - * published by the Free Software Foundation; either version 2.1 of
> - * the License, or (at your option) any later version.
> - *
> - * This software 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
> - * Lesser General Public License for more details.
> - *
> - * You should have received a copy of the GNU Lesser General Public
> - * License along with this software; if not, write to the Free
> - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> - * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> - */
> -package com.xpn.xwiki.wysiwyg.client.plugin.importer.ui;
> -
> -import com.google.gwt.user.client.ui.FlowPanel;
> -import com.google.gwt.user.client.ui.TabPanel;
> -import com.xpn.xwiki.wysiwyg.client.editor.Images;
> -import com.xpn.xwiki.wysiwyg.client.editor.Strings;
> -import com.xpn.xwiki.wysiwyg.client.plugin.importer.ImporterListener;
> -import com.xpn.xwiki.wysiwyg.client.util.Config;
> -import com.xpn.xwiki.wysiwyg.client.util.TabPanelSelector;
> -import com.xpn.xwiki.wysiwyg.client.widget.ComplexDialogBox;
> -
> -/**
> - * Office Importer wysiwyg dialog box.
> - *
> - * @version $Id$
> - */
> -public class ImporterDialog extends ComplexDialogBox
> -{
> - /**
> - * Container panel.
> - */
> - private FlowPanel mainPanel;
> -
> - /**
> - * Tab panel.
> - */
> - private TabPanel tabPanel;
> -
> - /**
> - * File import tab.
> - */
> - private FileImporter fileImporter;
> -
> - /**
> - * Clipboard (copy-paste) import tab.
> - */
> - private ClipboardImporter clipboardImporter;
> -
> - /**
> - * Default constructor.
> - *
> - * @param wysiwygConfig the wysiwyg configuration object.
> - * @param importerListener the import process listener.
> - */
> - public ImporterDialog(Config wysiwygConfig, ImporterListener importerListener)
> - {
> - // Dialog box.
> - super(false, true);
> - getDialog().setIcon(Images.INSTANCE.importer().createImage());
> - getDialog().setCaption(Strings.INSTANCE.importerCaption());
> - addStyleName("xImporterDialog");
> - getHeader().clear();
> -
> - // Main container panel.
> - mainPanel = new FlowPanel();
> - mainPanel.addStyleName("xImporterPanel");
> -
> - // Tab panel.
> - tabPanel = new TabPanel();
> - TabPanelSelector tabPanelSelector = new TabPanelSelector();
> - tabPanel.addBeforeSelectionHandler(tabPanelSelector);
> - tabPanel.addSelectionHandler(tabPanelSelector);
> - clipboardImporter = new ClipboardImporter(wysiwygConfig, importerListener);
> - tabPanel.add(clipboardImporter, Strings.INSTANCE.importerClipboardTabCaption());
> - fileImporter = new FileImporter(wysiwygConfig, importerListener);
> - tabPanel.add(fileImporter, Strings.INSTANCE.importerFileTabCaption());
> - tabPanel.selectTab(0);
> - tabPanel.addStyleName("xImporterTabPanel");
> - mainPanel.add(tabPanel);
> -
> - getBody().add(mainPanel);
> - }
> -}
>
> Modified: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/link/ui/AttachmentUploadWizardStep.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/link/ui/AttachmentUploadWizardStep.java 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/plugin/link/ui/AttachmentUploadWizardStep.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -132,7 +132,7 @@
> * {@inheritDoc}
> */
> @Override
> - protected void onAttachmentUploaded(Attachment attach)
> + protected void onAttachmentUploaded(Attachment attach, AsyncCallback<Boolean> async)
> {
> // commit the attachment data in the link config
> // commit relative reference
> @@ -140,5 +140,6 @@
> // FIXME: move the reference setting logic in a controller
> linkData.setReference("attach:" + ref.getRelativeTo(editedResource).toString());
> linkData.setUrl(attach.getDownloadUrl());
> + async.onSuccess(true);
> }
> }
>
> Modified: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/widget/wizard/util/AbstractFileUploadWizardStep.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/widget/wizard/util/AbstractFileUploadWizardStep.java 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/client/widget/wizard/util/AbstractFileUploadWizardStep.java 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -260,8 +260,7 @@
> displayError(Strings.INSTANCE.fileUploadSubmitError());
> async.onSuccess(false);
> } else {
> - onAttachmentUploaded(result);
> - async.onSuccess(true);
> + onAttachmentUploaded(result, async);
> }
> }
>
> @@ -276,8 +275,11 @@
> * Notifies the successful completion of a file upload, to be overridden by subclasses to provide specific behavior.
> *
> * @param attach the successfully uploaded attachment
> + * @param async the call-back used to indicate the completion of this method. It's required that the sub-classes
> + * invoke async.onSuccess(true); method once they are done with processing the attachment. Without this
> + * method being invoked, the submission of this wizard step will not complete.
> */
> - protected abstract void onAttachmentUploaded(Attachment attach);
> + protected abstract void onAttachmentUploaded(Attachment attach, AsyncCallback<Boolean> async);
>
> /**
> * @return the wiki of the document to upload this file to, or null if the default wiki should be used.
>
> Modified: platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/client/editor/Strings.properties
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/client/editor/Strings.properties 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/client/editor/Strings.properties 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -180,19 +180,20 @@
> macroCategoryUsed=Previously Inserted Macros
> macroNoMacroSelected=Please select a macro from the list below.
>
> -importerToolTip=Import Office Content
> -importerCaption=Office Importer
> -importerClipboardTabCaption=Clipboard
> -importerClipboardTabInfoLabel=Content
> -importerClipboardTabHelpLabel=Paste the content copied from the office document in the area below.
> -importerFileTabCaption=File
> -importerFileTabInfoLabel=File path
> -importerFileTabHelpLabel=Choose the office document to import. The file will be uploaded and attached to the current wiki document and its content imported in this wiki document.
> -importerFileTabNotAvailableLabel=This feature requires an active OpenOffice server which we could not locate, please contact your system administrator to resolve this issue.
> -importerFilterStylesCheckBoxCaption=Filter styles
> -importerImportButtonCaption=Import
> -importerCancelButtonCaption=Cancel
> +importMenuEntryCaption=Import
> +importWizardTitle=Import External Content
> +importWizardImportButtonCaption=Import
>
> +importOfficeFileMenuItemCaption=Office Document
> +importOfficeFileFeatureNotAvailable=This feature requires an active openoffice server which we could not locate, please contact your administrator to resolve this issue.
> +importOfficeFileWizardStepTitle=Import Office Document
> +importOfficeFileHelpLabel=Choose the office document to import. The file will be uploaded and attached to the current wiki document and its content imported in this wiki document.
> +
> +importOfficePasteMenuItemCaption=Office Content (Copy / Paste)
> +importOfficePasteWizardStepTitle=Import Office Content (Copy / Paste)
> +importOfficePasteInfoLabel=Content
> +importOfficePasteHelpLabel=Paste the content copied from the office document in the area below and click import.
> +
> wizardCancel=Cancel
> wizardPrevious=Previous
> wizardNext=Next
>
> Added: platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/client/editor/import.gif
> ===================================================================
> (Binary files differ)
>
>
> Property changes on: platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/client/editor/import.gif
> ___________________________________________________________________
> Name: svn:mime-type
> + application/octet-stream
>
> Added: platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/client/editor/import_office_file.gif
> ===================================================================
> (Binary files differ)
>
>
> Property changes on: platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/client/editor/import_office_file.gif
> ___________________________________________________________________
> Name: svn:mime-type
> + application/octet-stream
>
> Added: platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/client/editor/import_office_paste.gif
> ===================================================================
> (Binary files differ)
>
>
> Property changes on: platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/client/editor/import_office_paste.gif
> ___________________________________________________________________
> Name: svn:mime-type
> + application/octet-stream
>
> Deleted: platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/client/editor/importer.gif
> ===================================================================
> (Binary files differ)
>
> Modified: platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/public/stylesheets/importer.css
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/public/stylesheets/importer.css 2009-10-09 10:17:25 UTC (rev 24334)
> +++ platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/public/stylesheets/importer.css 2009-10-09 11:32:44 UTC (rev 24335)
> @@ -1,21 +1,5 @@
> -.xImporterPanel {
> - width: 100%;
> - height: 100%;
> - /* hidden overflow since the IE browsers detect badly the size of some tables */
> - overflow: hidden;
> -}
> -
> -.xImporterTabPanel {
> - width: 459px;
> - height: auto;
> -}
> -
> -.xImporterClipboardTabEditor {
> - height: 240px;
> -}
> -
> -.xImporterDialog .xDialogFooter .gwt-CheckBox {
> - float: left;
> - padding-top: 0;
> - margin-bottom: 0;
> +.xImportOfficeContentEditor {
> + width: 450px;
> + height: 250px;
> + border: 1px solid;
> }
> \ No newline at end of file
Also,
svn propset svn:keywords "Author Id Revision HeadURL" <new-file-path>
for all new added files.
check
http://dev.xwiki.org/xwiki/bin/view/Community/DevelopmentPractices#HSubvers…
for how to configure this for your svn client. Note that, even if correctly
configured, the settings will not be considered by the eclipse plugin (I didn't
manage to make them work), you'll have to do a command-line svn add for that to
work right.
Happy coding,
Anca
>
> _______________________________________________
> notifications mailing list
> notifications(a)xwiki.org
> http://lists.xwiki.org/mailman/listinfo/notifications
1
0
[xwiki-devs] Managed to load the Mail example xwiki page, thanks to Marius.I still have some questions.
by Leon Wang 09 Oct '09
by Leon Wang 09 Oct '09
09 Oct '09
Hi Marius,
Thank you for your help! I am quite touched you actually tried to load the
Mail example in Xwiki page. I followed your code in the 1.6 version. Here is
the screenshot link:
http://picasaweb.google.com/lh/sredir?uname=freeleons&target=PHOTO&id=53904…
It seems works on Firefox (It is clickable but still something broken
maybe it is the sizing not right) it does not work on Google Chrome at all.
At the top of the page Firefox can display it well Chrome will display
nothing. At the bottom of the page both on Chrome and Firefox will display
these:
//
xwe.onInjectionDone('xwe')
//
//
xwe.onInjectionDone('xwe')
//
//
xwe.onInjectionDone('xwe')
//
//
xwe.onInjectionDone('xwe')
//
Here is the screenshot:
http://picasaweb.google.com/lh/sredir?uname=freeleons&target=PHOTO&id=53904…
It completely broken and nothing clickable. Later I found the srollbar
disable because this line in the Mail source
code: Window.enableScrolling(false);
Thank you for your help so I can get this far. Do you know why the the Mail
appear both at the very top of the page and also at the very bottom of the
page, and the bottom is completely broken? The mail.nocache.js successfully
loaded according to firebug.
And here is my code:
public void onModuleLoad() {
loadingUI();
}
private void loadingUI(){
String hookId = "DR_TreeView";
Element hook = DOM.getElementById(hookId);
if (hook == null) {
return;
}
// Prepare the DOM
Element container = DOM.createDiv();
String containerId = hookId + "_container";
container.setId(containerId);
hook.getParentElement().replaceChild(container, hook);
DockPanel outer = initialUI();
RootPanel.get(containerId).add(outer);
// Call the window resized handler to get the initial sizes setup.
Doing
// this in a deferred command causes it to occur after all widgets'
sizes
// have been computed by the browser.
DeferredCommand.addCommand(new Command() {
public void execute() {
onWindowResized(Window.getClientWidth(),
Window.getClientHeight());
}
});
onWindowResized(Window.getClientWidth(), Window.getClientHeight());
}
Thank you a lot!
-Leon
2
1
Hi, there,
I'm running the sanity check script on mysql 5.0.54 and there are some
queries return results. To correct these problems, should I simply just
delete these results or I need to do something else before the deletion?
Take an example, for the following query:
select * from xwikiproperties,xwikilargestrings where
xwp_classtype='com.xpn.xwiki.objects.StringListProperty' and
xwp_name=xwl_name and xwp_id=xwl_id
+---------+-----------------+--------------------------------------+---------+-----------------+---------------------------------------------
| XWP_ID | XWP_NAME | XWP_CLASSTYPE | XWL_ID | XWL_NAME | XWL_VALUE
+---------+-----------------+--------------------------------------+---------+-----------------+---------------------------------------------
| -1877168607 | subscribedDocuments |
com.xpn.xwiki.objects.StringListProperty | -1877168607 | subscribedDocuments
| Main.WebSearch|Main.Categories
| 261169163 | subscribedDocuments | com.xpn.xwiki.objects.StringListProperty
| 261169163 | subscribedDocuments | Service
Measurements.WebHome|IMProcess.WebHome
| 683557787 | subscribedWebs | com.xpn.xwiki.objects.StringListProperty |
683557787 | subscribedWebs | Replication
| 683557787 | subscribedDocuments | com.xpn.xwiki.objects.StringListProperty
| 683557787 | subscribedDocuments | IIS.WebHome
I've got couple hundred lines of records like this. If I delete all these
records, what kind of impact will be to my content?
Thank you very much for your help
--
View this message in context: http://n2.nabble.com/Help-About-Sanity-Check-tp3670302p3670302.html
Sent from the XWiki- Dev mailing list archive at Nabble.com.
2
2
Re: [xwiki-devs] [xwiki-notifications] r22900 - in platform: core/trunk/xwiki-core/src/main/resources xwiki-applications/trunk/watchlist/src/main/resources/XWiki xwiki-plugins/trunk/watchlist xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist
by Sergiu Dumitriu 08 Oct '09
by Sergiu Dumitriu 08 Oct '09
08 Oct '09
jvdrean (SVN) wrote:
> Author: jvdrean
> Date: 2009-08-25 15:03:08 +0200 (Tue, 25 Aug 2009)
> New Revision: 22900
>
> Added:
> platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListEvent.java
> platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListEventManager.java
> platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListEventType.java
> platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListJob.java
> platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListJobManager.java
> platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListNotifier.java
> platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListStore.java
> Removed:
> platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListJob.java
> Modified:
> platform/core/trunk/xwiki-core/src/main/resources/ApplicationResources.properties
> platform/xwiki-applications/trunk/watchlist/src/main/resources/XWiki/WatchListManager.xml
> platform/xwiki-applications/trunk/watchlist/src/main/resources/XWiki/WatchListMessage.xml
> platform/xwiki-plugins/trunk/watchlist/pom.xml
> platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListPlugin.java
> platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListPluginApi.java
> Log:
> XPWATCHLIST-55 : Make the watchlist plugin use the activitystream plugin to retrieve events
> XPWATCHLIST-23 : Put the classes and objects diffs in the emails.
> XPWATCHLIST-34 : Exception in log for user not having watch list data
> XPWATCHLIST-35 : Watch list should support registering for full wikis
> XPWATCHLIST-40 : Watch list should support any interval for its notifications
> XPWATCHLIST-27 : WatchList send an exception by mail
>
> Modified: platform/core/trunk/xwiki-core/src/main/resources/ApplicationResources.properties
> ===================================================================
> --- platform/core/trunk/xwiki-core/src/main/resources/ApplicationResources.properties 2009-08-25 12:55:58 UTC (rev 22899)
> +++ platform/core/trunk/xwiki-core/src/main/resources/ApplicationResources.properties 2009-08-25 13:03:08 UTC (rev 22900)
> @@ -837,6 +837,10 @@
> watchlist.delete.ko=An error occurred while removing {0} from watchlist
> watchlist.create.object=Created WatchList storage object
> watchlist.save.object=Updated WatchList
> +watchlist.event.create=On {0}, the document has been created by {1}
> +watchlist.event.delete=On {0}, the document has been deleted by {1}
> +watchlist.event.update=On {0}, the document has been modified by {1}
> +watchlist.event.update.multiple=Between {0} and {1}, the document has been modified {2} times, by {3} user(s): {4}
/\ /\ /\
Replaced user(s) with: user{3,choice,0#s|1#|2#s}.
> Added: platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListEvent.java
> ===================================================================
> --- platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListEvent.java (rev 0)
> +++ platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListEvent.java 2009-08-25 13:03:08 UTC (rev 22900)
> @@ -0,0 +1,504 @@
Why do we need both prefixedSpace and prefixedFullName? Can't we obtain
the first from the latter?
> + /**
> + * Prefixed space in which the event happened.
> + */
> + private final String prefixedSpace;
> +
> + /**
> + * Prefixed document fullName in which the event happened.
> + */
> + private final String prefixedFullName;
I prefer enums for this. Is there a good reason why this is a String?
> + /**
> + * Type of the event (example: "update").
> + */
> + private String type;
> +
I don't like three lists that must be iterated in parallel. Why not a
single lists with a custom data object?
> +
> + /**
> + * List of versions affected by this event. It will contain only one entry if the event is not a composite event.
> + */
> + private List<String> versions;
> +
> + /**
> + * List of authors for this event. It will contain only one entry if the event is not a composite event.
> + */
> + private List<String> authors;
> +
> + /**
> + * List of dates for this event. It will contain only one entry if the event is not a composite event.
> + */
> + private List<Date> dates;
> +
> + /**
> + * Constructor.
> + *
> + * @param activityEvent activity stream event to wrap
> + */
> + public WatchListEvent(ActivityEvent activityEvent)
> + {
> + this.activityEvents.add(activityEvent);
> + type = activityEvent.getType();
> + prefixedSpace = activityEvent.getWiki() + WatchListStore.WIKI_SPACE_SEP + activityEvent.getSpace();
> + prefixedFullName = activityEvent.getWiki() + WatchListStore.WIKI_SPACE_SEP + activityEvent.getPage();
I'd move this piece of code in a separate method.
> + int hash = 3;
> + if (ActivityEventType.UPDATE.equals(activityEvent)) {
> + hashCode = 42 * hash + prefixedFullName.hashCode() + activityEvent.getType().hashCode();
> + } else {
> + hashCode =
> + 42 * hash + prefixedFullName.hashCode() + activityEvent.getType().hashCode()
> + + activityEvent.getDate().hashCode();
> + }
> + }
> +
> + /**
> + * Add another event associated to this event.
> + *
> + * @param event The event to add.
> + */
> + public void addEvent(WatchListEvent event)
> + {
> + if (ActivityEventType.DELETE.equals(event.getType())) {
> + // If the document has been deleted, reset this event
> + activityEvents.clear();
> + type = event.getType();
> + versions.clear();
> + versions = null;
> + authors.clear();
> + authors = null;
> + previousVersion = null;
> + htmlDiff = null;
> + } else if (ActivityEventType.UPDATE.equals(event.getType()) && ActivityEventType.DELETE.equals(getType())) {
> + // If an update event had been fired before a delete, discard it
> + return;
> + }
> +
> + activityEvents.add(event.getActivityEvent());
> + }
The following methods are not threadsafe at all. Should they be?
Why don't we build these lists as we add events? The current usage
patterns probably don't add new events after retrieving the list of
dates/authors, but this code has a dependency on the order in which
methods are called, which is not good.
> + /**
> + * @return Get all the dates of a composite event, if this event is not a composite this list will contain single
> + * entry.
> + */
> + public List<Date> getDates()
> + {
> + if (dates == null) {
> + dates = new ArrayList<Date>();
I don't think this is needed, since isComposite simply checks the size
of the list. It brings a marginal performance gain with the cost of
increased code complexity.
> + if (!isComposite()) {
> + dates.add(getDate());
> + } else {
> + for (ActivityEvent event : activityEvents) {
> + dates.add(event.getDate());
> + }
> + }
> + }
> +
> + return dates;
> + }
> +
> + public List<String> getAuthors()
> +
> + public List<String> getVersions()
> +
> +
> + /**
> + * @param classAttr The class of the div to create
> + * @return a HTML div element
> + */
> + private Div createDiffDiv(String classAttr)
> + {
Oh no, please don't use jakarta-ecs. It's a dead project.
> + Div div = new Div();
> + div.setClass(classAttr);
> + div.setStyle(HTML_STYLE_PLACEHOLDER_PREFIX + classAttr);
> +
> + return div;
> + }
> +
> +
> + /**
> + * Overriding of the default equals method.
> + *
> + * @param obj the ActivityEvent to be compared with
> + * @return True if the two events have been generated by the same document and are equals or conflicting
> + */
> + @Override
> + public boolean equals(Object obj)
> + {
> + if (this == obj) {
> + return true;
> + }
> +
> + if (!(obj instanceof WatchListEvent)) {
> + return false;
> + }
This is not correct, any implementation of equals must be commutative:
this.equals(event) must return the same as event.equals(this).
> + // At first this method was returning true when the documents were the same and the events were the same type.
> + // Since we don't want to keep update events for documents that have been deleted this method has been modified
> + // to a point were it performs something different from a equals(), it returns true when obj is a delete event
> + // and 'this' is an update event. See WatchListEventManager#WatchListEventManager(Date, XWikiContext).
> + // TODO: refactoring.
> + WatchListEvent event = ((WatchListEvent) obj);
> + return prefixedFullName.equals(event.getPrefixedFullName()) && WatchListEventType.UPDATE.equals(getType())
> + && (WatchListEventType.UPDATE.equals(event.getType()) || WatchListEventType.DELETE.equals(event.getType()));
> + }
> +}
> Added: platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListJob.java
> ===================================================================
> --- platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListJob.java (rev 0)
> +++ platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListJob.java 2009-08-25 13:03:08 UTC (rev 22900)
> @@ -0,0 +1,257 @@
> +
> +/**
Why "abstract"? The documentation does not provide any information, the
fact that it implements a Job can be seen from the list of implements.
> + * WatchList abstract implementation of Quartz's Job.
> + *
> + * @version $Id$
> + */
> +public class WatchListJob extends AbstractJob implements Job
> +{
These two methods are pretty generic, they should be moved somewhere
else, in the core.
> + /**
> + * Initialize container context.
> + *
> + * @param context The XWiki context.
> + * @throws ServletException If the container initialization fails.
> + */
> + protected void initializeComponents(XWikiContext context) throws ServletException
> +
> + /**
> + * Clean the container context.
> + */
> + protected void cleanupComponents()
> Modified: platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListPluginApi.java
> ===================================================================
> --- platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListPluginApi.java 2009-08-25 12:55:58 UTC (rev 22899)
> +++ platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListPluginApi.java 2009-08-25 13:03:08 UTC (rev 22900)
> @@ -22,6 +22,7 @@
This change:
> -public class WatchListPluginApi extends PluginApi
> +public class WatchListPluginApi extends PluginApi<WatchListPlugin>
> {
means that we don't need getWatchlistPlugin anymore, but getProtectedPlugin.
> - return getWatchListPlugin().getWatchedSpaces(getXWikiContext().getUser(),
> - getXWikiContext()).contains(context.getDatabase() + ":" + context.getDoc().getSpace());
> + return getWatchListPlugin().getStore().getWatchedElements(context.getUser(), ElementType.SPACE, context)
> + .contains(context.getDatabase() + WatchListStore.WIKI_SPACE_SEP + context.getDoc().getSpace());
> }
> Added: platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListStore.java
> ===================================================================
> --- platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListStore.java (rev 0)
> +++ platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/xwiki/plugin/watchlist/WatchListStore.java 2009-08-25 13:03:08 UTC (rev 22900)
> @@ -0,0 +1,621 @@
@SuppressWarnings should only be used when there's no other way. It's
better to fix the warning.
> +@SuppressWarnings("serial")
> +public class WatchListStore implements EventListener
> +{
These two are very generic, I think they should be defined in the XWiki
Syntax.
> + /**
> + * Character used to separated wiki and space in XWiki model.
> + */
> + public static final String WIKI_SPACE_SEP = ":";
> +
> + /**
> + * Character used to separated space and page in XWiki model.
> + */
> + public static final String SPACE_PAGE_SEP = ".";
Enums are supposed to elliminate (or at least reduce) elseif
programming. This could go in a method of the enum.
> + private String getWatchListClassPropertyForType(ElementType type)
> + {
> + if (ElementType.WIKI.equals(type)) {
> + return WATCHLIST_CLASS_WIKIS_PROP;
> + } else if (ElementType.SPACE.equals(type)) {
> + return WATCHLIST_CLASS_SPACES_PROP;
> + } else if (ElementType.DOCUMENT.equals(type)) {
> + return WATCHLIST_CLASS_DOCUMENTS_PROP;
> + } else {
> + return StringUtils.EMPTY;
> + }
> + }
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
1
0
[xwiki-devs] [Proposal] Create a xlet repository for contributed apps/macros/plugins/etc.
by Jerome Velociter 08 Oct '09
by Jerome Velociter 08 Oct '09
08 Oct '09
Hi all,
The subject has been discussed already, see for example
http://markmail.org/message/h5e2qinrhsf2slww
The idea is to create a new top level project for modules (modules in
the sense of everything applications, macros, components, plugins, skin
extensions, etc.) that are not part of any products (or the platform)
and that are not necessarily contributed by the XWiki development team.
The difference with the sandbox is that sandbox is a place for modules
being incubated, and that are not in a finished state. Thus, I think one
of the rule for introducing new modules in the xlet repository would be
that a functional version of the module should be released and available
for download (for example on code.xwiki.org)
The name "xlet" is the name we've use historically to talk about this
repository, this is open for discussion. (personally I like the name -
we have to agree this is how we want to name a XWiki "pluggable module"
in the large sense).
Here is my +1 for the above
I would also like to propose that we create a new category of JIRA
projects : "XWiki Contributed Xlets" (or equivalent name) for such
projects that desire to track issues for their released module, and have
the tracker hosted by XWiki.org. I believe this will make easier to have
real release cycles for such modules (for example, we can link to the
JIRA project from the code.xwiki.org "module" page so that users can
report issues instead of using the comments, we can use JIRAs changelog
for release notes on the download page, etc.)
And my +1 for this second proposal
Please, let me know what you think
Jerome.
7
28
Hi,
In order to fix issue http://jira.xwiki.org/jira/browse/XWIKI-4428
I've had to dive very deep and fix Sun's URLClassLoader which has a
large number of problems. To do so I had to rewrite several classes
and I've taken sources from Emory Utilities (http://dcl.mathcs.emory.edu/php/loadPage.php?content=util/features.html#cla…
) and modified them slightly (since they were missing the ability to
support custom URL Stream handlers).
So I have a new URIClassLoader that extends URLClassLoader + a set of
associated classes (stream handlers and url connection implementations).
I'd like to commit this in a new xwiki-classloader module, dedicated
to classloading code (same as we have xwiki-xml for ex).
Let me know if you need more details.
Here's my +1
Thanks
-Vincent
6
8