hmmm IMO this macro should be in the xwiki-office/ directory along with the other 2 projects.
WDYT?
Thanks
-Vincent
On Sep 28, 2010, at 5:52 PM, mflorea (SVN) wrote:
> Author: mflorea
> Date: 2010-09-28 17:52:58 +0200 (Tue, 28 Sep 2010)
> New Revision: 31441
>
> Added:
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/pom.xml
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/macro/
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/macro/office/
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/macro/office/OfficeMacro.java
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/macro/
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/macro/office/
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/macro/office/OfficeMacroParameters.java
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/resources/
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/resources/META-INF/
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/resources/META-INF/components.txt
> Modified:
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/pom.xml
> Log:
> XWIKI-5538: Create a macro to view office attachments
>
>
> Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/pom.xml
> ===================================================================
> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/pom.xml 2010-09-28 14:59:38 UTC (rev 31440)
> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/pom.xml 2010-09-28 15:52:58 UTC (rev 31441)
> @@ -116,5 +116,6 @@
> <module>xwiki-rendering-macro-ruby</module>
> <module>xwiki-rendering-macro-python</module>
> <module>xwiki-rendering-macro-php</module>
> + <module>xwiki-rendering-macro-office</module>
> </modules>
> </project>
>
> Added: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/pom.xml
> ===================================================================
> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/pom.xml (rev 0)
> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/pom.xml 2010-09-28 15:52:58 UTC (rev 31441)
> @@ -0,0 +1,58 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +
> +<!--
> + *
> + * 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.
> + *
> +-->
> +
> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0http://maven.apache.org/maven-v4_0_0.xsd">
> + <parent>
> + <artifactId>xwiki-core-rendering-macros-parent</artifactId>
> + <groupId>org.xwiki.platform</groupId>
> + <version>2.5-SNAPSHOT</version>
> + </parent>
> + <modelVersion>4.0.0</modelVersion>
> + <artifactId>xwiki-core-rendering-macro-office</artifactId>
> + <name>XWiki Platform - Core - Rendering - Macro - Office</name>
> + <version>2.5-SNAPSHOT</version>
> + <description>View office attachments (doc, ppt, xls, odt, odp, ods etc.) inside wiki pages without downloading or
> + importing them.</description>
> + <dependencies>
> + <dependency>
> + <groupId>org.xwiki.platform</groupId>
> + <artifactId>xwiki-core-office-viewer</artifactId>
> + <version>${project.version}</version>
> + </dependency>
> + </dependencies>
> + <build>
> + <plugins>
> + <plugin>
> + <!-- Apply the Checkstyle configurations defined in the top level pom.xml file -->
> + <groupId>org.apache.maven.plugins</groupId>
> + <artifactId>maven-checkstyle-plugin</artifactId>
> + </plugin>
> + </plugins>
> + </build>
> + <properties>
> + <!-- Skip Clirr execution since this is the first release of this module. Remove once XE 2.5M2 is released. -->
> + <xwiki.clirr.skip>true</xwiki.clirr.skip>
> + </properties>
> +</project>
>
>
> Property changes on: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/pom.xml
> ___________________________________________________________________
> Added: svn:keywords
> + Author Id Revision HeadURL
> Added: svn:eol-style
> + native
>
> Added: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/macro/office/OfficeMacro.java
> ===================================================================
> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/macro/office/OfficeMacro.java (rev 0)
> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/macro/office/OfficeMacro.java 2010-09-28 15:52:58 UTC (rev 31441)
> @@ -0,0 +1,108 @@
> +/*
> + * 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 org.xwiki.rendering.internal.macro.office;
> +
> +import java.util.Collections;
> +import java.util.List;
> +import java.util.Map;
> +
> +import org.xwiki.bridge.DocumentAccessBridge;
> +import org.xwiki.component.annotation.Component;
> +import org.xwiki.component.annotation.Requirement;
> +import org.xwiki.model.EntityType;
> +import org.xwiki.model.reference.AttachmentReference;
> +import org.xwiki.model.reference.DocumentReference;
> +import org.xwiki.model.reference.EntityReferenceResolver;
> +import org.xwiki.office.viewer.OfficeViewer;
> +import org.xwiki.rendering.block.Block;
> +import org.xwiki.rendering.macro.AbstractMacro;
> +import org.xwiki.rendering.macro.MacroExecutionException;
> +import org.xwiki.rendering.macro.office.OfficeMacroParameters;
> +import org.xwiki.rendering.transformation.MacroTransformationContext;
> +
> +/**
> + * View office attachments (doc, ppt, xls, odt, odp, ods etc.) inside wiki pages without downloading or importing them.
> + *
> + * @version $Id$
> + * @since 2.5M2
> + */
> +@Component("office")
> +public class OfficeMacro extends AbstractMacro<OfficeMacroParameters>
> +{
> + /**
> + * The component used to resolve the attachment string reference relative to the current document reference.
> + */
> + @Requirement("explicit")
> + private EntityReferenceResolver<String> explicitStringEntityReferenceResolver;
> +
> + /**
> + * The component used to get the current document reference.
> + */
> + @Requirement
> + private DocumentAccessBridge documentAccessBridge;
> +
> + /**
> + * The component used to view the office attachments.
> + */
> + @Requirement
> + private OfficeViewer officeViewer;
> +
> + /**
> + * Default constructor.
> + */
> + public OfficeMacro()
> + {
> + super("Office Document Viewer", "View office attachments (doc, ppt, xls, odt, odp, ods etc.) inside "
> + + "wiki pages without downloading or importing them.", OfficeMacroParameters.class);
> +
> + setDefaultCategory(DEFAULT_CATEGORY_CONTENT);
> + }
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see AbstractMacro#execute(Object, String, MacroTransformationContext)
> + */
> + public List<Block> execute(OfficeMacroParameters parameters, String content, MacroTransformationContext context)
> + throws MacroExecutionException
> + {
> + DocumentReference currentDocumentReference = documentAccessBridge.getCurrentDocumentReference();
> + AttachmentReference attachmentReference =
> + new AttachmentReference(explicitStringEntityReferenceResolver.resolve(parameters.getAttachment(),
> + EntityType.ATTACHMENT, currentDocumentReference));
> + Map<String, String> viewParameters =
> + Collections.singletonMap("filterStyles", String.valueOf(parameters.isFilterStyles()));
> + try {
> + return officeViewer.createView(attachmentReference, viewParameters).getChildren();
> + } catch (Exception e) {
> + throw new MacroExecutionException("Failed to view office attachment.", e);
> + }
> + }
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see AbstractMacro#supportsInlineMode()
> + */
> + public boolean supportsInlineMode()
> + {
> + return false;
> + }
> +}
>
>
> Property changes on: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/macro/office/OfficeMacro.java
> ___________________________________________________________________
> Added: svn:keywords
> + Author Id Revision HeadURL
> Added: svn:eol-style
> + native
>
> Added: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/macro/office/OfficeMacroParameters.java
> ===================================================================
> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/macro/office/OfficeMacroParameters.java (rev 0)
> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/macro/office/OfficeMacroParameters.java 2010-09-28 15:52:58 UTC (rev 31441)
> @@ -0,0 +1,89 @@
> +/*
> + * 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 org.xwiki.rendering.macro.office;
> +
> +import org.xwiki.properties.annotation.PropertyDescription;
> +import org.xwiki.properties.annotation.PropertyMandatory;
> +
> +/**
> + * Parameters for the {@link org.xwiki.rendering.internal.macro.office.OfficeMacro}.
> + *
> + * @version $Id$
> + * @since 2.5M2
> + */
> +public class OfficeMacroParameters
> +{
> + /**
> + * The office attachment to be viewed. Use an attachment string reference to specify which office file should be
> + * viewed: {@code file.ppt}, {@code Page(a)file.doc}, {@code Space.Page(a)file.xls} or {@code wiki:Space.Page@file.odt}.
> + */
> + private String attachment;
> +
> + /**
> + * Whether to filter in-line CSS styles present in the HTML content produced by the OpenOffice server. Office
> + * content is usually better integrated in the host wiki page when styles are filtered.
> + * <p>
> + * Styles are filtered by default.
> + */
> + private boolean filterStyles = true;
> +
> + /**
> + * @return a string reference to the office attachment to be viewed
> + */
> + public String getAttachment()
> + {
> + return attachment;
> + }
> +
> + /**
> + * Sets the office attachment to be viewed.
> + *
> + * @param attachment an attachment string reference
> + */
> + @PropertyDescription("The office attachment to be viewed. Use an attachment string reference to specify which "
> + + "office file should be viewed: file.ppt, Page(a)file.doc, Space.Page(a)file.xls or wiki:Space.Page@file.odt.")
> + @PropertyMandatory
> + public void setAttachment(String attachment)
> + {
> + this.attachment = attachment;
> + }
> +
> + /**
> + * @return {@code true} if the CSS styles present in the HTML content produces by the OpenOffice server are
> + * filtered, {@code false} otherwise
> + */
> + public boolean isFilterStyles()
> + {
> + return filterStyles;
> + }
> +
> + /**
> + * Sets whether to filter in-line CSS styles present in the HTML content produced by the OpenOffice server.
> + *
> + * @param filterStyles {@code true} to filter the CSS style present in the HTML content produces by the OpenOffice
> + * server, {@code false} otherwise
> + */
> + @PropertyDescription("Whether to filter in-line CSS styles present in the HTML content produced by the OpenOffice "
> + + "server. Office content is usually better integrated in the host wiki page when styles are filtered.")
> + public void setFilterStyles(boolean filterStyles)
> + {
> + this.filterStyles = filterStyles;
> + }
> +}
>
>
> Property changes on: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/macro/office/OfficeMacroParameters.java
> ___________________________________________________________________
> Added: svn:keywords
> + Author Id Revision HeadURL
> Added: svn:eol-style
> + native
>
> Added: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/resources/META-INF/components.txt
> ===================================================================
> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/resources/META-INF/components.txt (rev 0)
> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/resources/META-INF/components.txt 2010-09-28 15:52:58 UTC (rev 31441)
> @@ -0,0 +1 @@
> +org.xwiki.rendering.internal.macro.office.OfficeMacro
> \ No newline at end of file
>
>
> Property changes on: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/resources/META-INF/components.txt
> ___________________________________________________________________
> Added: svn:eol-style
> + native
On Tue, Sep 28, 2010 at 18:00, Vincent Massol <vincent(a)massol.net> wrote:
> hmmm IMO this macro should be in the xwiki-office/ directory along with the other 2 projects.
>
> WDYT?
+1 it's not really a standard standalone macro but more one of the
office module interfaces
>
> Thanks
> -Vincent
>
> On Sep 28, 2010, at 5:52 PM, mflorea (SVN) wrote:
>
>> Author: mflorea
>> Date: 2010-09-28 17:52:58 +0200 (Tue, 28 Sep 2010)
>> New Revision: 31441
>>
>> Added:
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/pom.xml
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/macro/
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/macro/office/
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/macro/office/OfficeMacro.java
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/macro/
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/macro/office/
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/macro/office/OfficeMacroParameters.java
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/resources/
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/resources/META-INF/
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/resources/META-INF/components.txt
>> Modified:
>> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/pom.xml
>> Log:
>> XWIKI-5538: Create a macro to view office attachments
>>
>>
>> Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/pom.xml
>> ===================================================================
>> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/pom.xml     2010-09-28 14:59:38 UTC (rev 31440)
>> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/pom.xml     2010-09-28 15:52:58 UTC (rev 31441)
>> @@ -116,5 +116,6 @@
>> Â Â <module>xwiki-rendering-macro-ruby</module>
>> Â Â <module>xwiki-rendering-macro-python</module>
>> Â Â <module>xwiki-rendering-macro-php</module>
>> + Â Â <module>xwiki-rendering-macro-office</module>
>> Â </modules>
>> </project>
>>
>> Added: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/pom.xml
>> ===================================================================
>> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/pom.xml              (rev 0)
>> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/pom.xml  2010-09-28 15:52:58 UTC (rev 31441)
>> @@ -0,0 +1,58 @@
>> +<?xml version="1.0" encoding="UTF-8"?>
>> +
>> +<!--
>> + *
>> + * 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.
>> + *
>> +-->
>> +
>> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> + Â xsi:schemaLocation="http://maven.apache.org/POM/4.0.0http://maven.apache.org/maven-v4_0_0.xsd">
>> + Â <parent>
>> + Â Â <artifactId>xwiki-core-rendering-macros-parent</artifactId>
>> + Â Â <groupId>org.xwiki.platform</groupId>
>> + Â Â <version>2.5-SNAPSHOT</version>
>> + Â </parent>
>> + Â <modelVersion>4.0.0</modelVersion>
>> + Â <artifactId>xwiki-core-rendering-macro-office</artifactId>
>> + Â <name>XWiki Platform - Core - Rendering - Macro - Office</name>
>> + Â <version>2.5-SNAPSHOT</version>
>> + Â <description>View office attachments (doc, ppt, xls, odt, odp, ods etc.) inside wiki pages without downloading or
>> + Â Â importing them.</description>
>> + Â <dependencies>
>> + Â Â <dependency>
>> + Â Â Â <groupId>org.xwiki.platform</groupId>
>> + Â Â Â <artifactId>xwiki-core-office-viewer</artifactId>
>> + Â Â Â <version>${project.version}</version>
>> + Â Â </dependency>
>> + Â </dependencies>
>> + Â <build>
>> + Â Â <plugins>
>> + Â Â Â <plugin>
>> + Â Â Â Â <!-- Apply the Checkstyle configurations defined in the top level pom.xml file -->
>> + Â Â Â Â <groupId>org.apache.maven.plugins</groupId>
>> + Â Â Â Â <artifactId>maven-checkstyle-plugin</artifactId>
>> + Â Â Â </plugin>
>> + Â Â </plugins>
>> + Â </build>
>> + Â <properties>
>> + Â Â <!-- Skip Clirr execution since this is the first release of this module. Remove once XE 2.5M2 is released. -->
>> + Â Â <xwiki.clirr.skip>true</xwiki.clirr.skip>
>> + Â </properties>
>> +</project>
>>
>>
>> Property changes on: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/pom.xml
>> ___________________________________________________________________
>> Added: svn:keywords
>> Â + Author Id Revision HeadURL
>> Added: svn:eol-style
>> Â + native
>>
>> Added: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/macro/office/OfficeMacro.java
>> ===================================================================
>> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/macro/office/OfficeMacro.java              (rev 0)
>> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/macro/office/OfficeMacro.java  2010-09-28 15:52:58 UTC (rev 31441)
>> @@ -0,0 +1,108 @@
>> +/*
>> + * 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 org.xwiki.rendering.internal.macro.office;
>> +
>> +import java.util.Collections;
>> +import java.util.List;
>> +import java.util.Map;
>> +
>> +import org.xwiki.bridge.DocumentAccessBridge;
>> +import org.xwiki.component.annotation.Component;
>> +import org.xwiki.component.annotation.Requirement;
>> +import org.xwiki.model.EntityType;
>> +import org.xwiki.model.reference.AttachmentReference;
>> +import org.xwiki.model.reference.DocumentReference;
>> +import org.xwiki.model.reference.EntityReferenceResolver;
>> +import org.xwiki.office.viewer.OfficeViewer;
>> +import org.xwiki.rendering.block.Block;
>> +import org.xwiki.rendering.macro.AbstractMacro;
>> +import org.xwiki.rendering.macro.MacroExecutionException;
>> +import org.xwiki.rendering.macro.office.OfficeMacroParameters;
>> +import org.xwiki.rendering.transformation.MacroTransformationContext;
>> +
>> +/**
>> + * View office attachments (doc, ppt, xls, odt, odp, ods etc.) inside wiki pages without downloading or importing them.
>> + *
>> + * @version $Id$
>> + * @since 2.5M2
>> + */
>> +@Component("office")
>> +public class OfficeMacro extends AbstractMacro<OfficeMacroParameters>
>> +{
>> + Â Â /**
>> + Â Â * The component used to resolve the attachment string reference relative to the current document reference.
>> + Â Â */
>> + Â Â @Requirement("explicit")
>> + Â Â private EntityReferenceResolver<String> explicitStringEntityReferenceResolver;
>> +
>> + Â Â /**
>> + Â Â * The component used to get the current document reference.
>> + Â Â */
>> + Â Â @Requirement
>> + Â Â private DocumentAccessBridge documentAccessBridge;
>> +
>> + Â Â /**
>> + Â Â * The component used to view the office attachments.
>> + Â Â */
>> + Â Â @Requirement
>> + Â Â private OfficeViewer officeViewer;
>> +
>> + Â Â /**
>> + Â Â * Default constructor.
>> + Â Â */
>> + Â Â public OfficeMacro()
>> + Â Â {
>> + Â Â Â Â super("Office Document Viewer", "View office attachments (doc, ppt, xls, odt, odp, ods etc.) inside "
>> + Â Â Â Â Â Â + "wiki pages without downloading or importing them.", OfficeMacroParameters.class);
>> +
>> + Â Â Â Â setDefaultCategory(DEFAULT_CATEGORY_CONTENT);
>> + Â Â }
>> +
>> + Â Â /**
>> + Â Â * {@inheritDoc}
>> + Â Â *
>> + Â Â * @see AbstractMacro#execute(Object, String, MacroTransformationContext)
>> + Â Â */
>> + Â Â public List<Block> execute(OfficeMacroParameters parameters, String content, MacroTransformationContext context)
>> + Â Â Â Â throws MacroExecutionException
>> + Â Â {
>> + Â Â Â Â DocumentReference currentDocumentReference = documentAccessBridge.getCurrentDocumentReference();
>> + Â Â Â Â AttachmentReference attachmentReference =
>> + Â Â Â Â Â Â new AttachmentReference(explicitStringEntityReferenceResolver.resolve(parameters.getAttachment(),
>> + Â Â Â Â Â Â Â Â EntityType.ATTACHMENT, currentDocumentReference));
>> + Â Â Â Â Map<String, String> viewParameters =
>> + Â Â Â Â Â Â Collections.singletonMap("filterStyles", String.valueOf(parameters.isFilterStyles()));
>> + Â Â Â Â try {
>> + Â Â Â Â Â Â return officeViewer.createView(attachmentReference, viewParameters).getChildren();
>> + Â Â Â Â } catch (Exception e) {
>> + Â Â Â Â Â Â throw new MacroExecutionException("Failed to view office attachment.", e);
>> + Â Â Â Â }
>> + Â Â }
>> +
>> + Â Â /**
>> + Â Â * {@inheritDoc}
>> + Â Â *
>> + Â Â * @see AbstractMacro#supportsInlineMode()
>> + Â Â */
>> + Â Â public boolean supportsInlineMode()
>> + Â Â {
>> + Â Â Â Â return false;
>> + Â Â }
>> +}
>>
>>
>> Property changes on: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/internal/macro/office/OfficeMacro.java
>> ___________________________________________________________________
>> Added: svn:keywords
>> Â + Author Id Revision HeadURL
>> Added: svn:eol-style
>> Â + native
>>
>> Added: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/macro/office/OfficeMacroParameters.java
>> ===================================================================
>> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/macro/office/OfficeMacroParameters.java             (rev 0)
>> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/macro/office/OfficeMacroParameters.java 2010-09-28 15:52:58 UTC (rev 31441)
>> @@ -0,0 +1,89 @@
>> +/*
>> + * 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 org.xwiki.rendering.macro.office;
>> +
>> +import org.xwiki.properties.annotation.PropertyDescription;
>> +import org.xwiki.properties.annotation.PropertyMandatory;
>> +
>> +/**
>> + * Parameters for the {@link org.xwiki.rendering.internal.macro.office.OfficeMacro}.
>> + *
>> + * @version $Id$
>> + * @since 2.5M2
>> + */
>> +public class OfficeMacroParameters
>> +{
>> + Â Â /**
>> + Â Â * The office attachment to be viewed. Use an attachment string reference to specify which office file should be
>> + Â Â * viewed: {@code file.ppt}, {@code Page(a)file.doc}, {@code Space.Page(a)file.xls} or {@code wiki:Space.Page@file.odt}.
>> + Â Â */
>> + Â Â private String attachment;
>> +
>> + Â Â /**
>> + Â Â * Whether to filter in-line CSS styles present in the HTML content produced by the OpenOffice server. Office
>> + Â Â * content is usually better integrated in the host wiki page when styles are filtered.
>> + Â Â * <p>
>> + Â Â * Styles are filtered by default.
>> + Â Â */
>> + Â Â private boolean filterStyles = true;
>> +
>> + Â Â /**
>> + Â Â * @return a string reference to the office attachment to be viewed
>> + Â Â */
>> + Â Â public String getAttachment()
>> + Â Â {
>> + Â Â Â Â return attachment;
>> + Â Â }
>> +
>> + Â Â /**
>> + Â Â * Sets the office attachment to be viewed.
>> + Â Â *
>> + Â Â * @param attachment an attachment string reference
>> + Â Â */
>> + Â Â @PropertyDescription("The office attachment to be viewed. Use an attachment string reference to specify which "
>> + Â Â Â Â + "office file should be viewed: file.ppt, Page(a)file.doc, Space.Page(a)file.xls or wiki:Space.Page@file.odt.")
>> + Â Â @PropertyMandatory
>> + Â Â public void setAttachment(String attachment)
>> + Â Â {
>> + Â Â Â Â this.attachment = attachment;
>> + Â Â }
>> +
>> + Â Â /**
>> + Â Â * @return {@code true} if the CSS styles present in the HTML content produces by the OpenOffice server are
>> + Â Â * Â Â Â Â filtered, {@code false} otherwise
>> + Â Â */
>> + Â Â public boolean isFilterStyles()
>> + Â Â {
>> + Â Â Â Â return filterStyles;
>> + Â Â }
>> +
>> + Â Â /**
>> + Â Â * Sets whether to filter in-line CSS styles present in the HTML content produced by the OpenOffice server.
>> + Â Â *
>> + Â Â * @param filterStyles {@code true} to filter the CSS style present in the HTML content produces by the OpenOffice
>> + Â Â * Â Â Â Â Â Â server, {@code false} otherwise
>> + Â Â */
>> + Â Â @PropertyDescription("Whether to filter in-line CSS styles present in the HTML content produced by the OpenOffice "
>> + Â Â Â Â + "server. Office content is usually better integrated in the host wiki page when styles are filtered.")
>> + Â Â public void setFilterStyles(boolean filterStyles)
>> + Â Â {
>> + Â Â Â Â this.filterStyles = filterStyles;
>> + Â Â }
>> +}
>>
>>
>> Property changes on: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/java/org/xwiki/rendering/macro/office/OfficeMacroParameters.java
>> ___________________________________________________________________
>> Added: svn:keywords
>> Â + Author Id Revision HeadURL
>> Added: svn:eol-style
>> Â + native
>>
>> Added: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/resources/META-INF/components.txt
>> ===================================================================
>> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/resources/META-INF/components.txt                 (rev 0)
>> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/resources/META-INF/components.txt     2010-09-28 15:52:58 UTC (rev 31441)
>> @@ -0,0 +1 @@
>> +org.xwiki.rendering.internal.macro.office.OfficeMacro
>> \ No newline at end of file
>>
>>
>> Property changes on: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-office/src/main/resources/META-INF/components.txt
>> ___________________________________________________________________
>> Added: svn:eol-style
>> Â + native
>
> _______________________________________________
> devs mailing list
> devs(a)xwiki.org
> http://lists.xwiki.org/mailman/listinfo/devs
>
--
Thomas Mortagne
Hi devs,
Vincent suggested that I should rename xwiki-officeimporter and
xwiki-officepreview to xwiki-office-importer and xwiki-office-preview
respectively. The rules are:
* module name starts with "xwiki"
* separate words with - (dash) (e.g. xwiki-shared-tests)
* prefer short names (fewer words) (xwiki-csrf instead of xwiki-csrftoken)
* avoid generic words like "service", "manger" (e.g. xwiki-patch instead
of xwiki-patch-service)
I'm +1 for these rules. If you agree I'll rename the office modules.
Thanks,
Marius
Hi devs,
I'm going to create a macro for previewing office attachments. It's main
usage will be:
{{officepreview attachment="presentation.ppt" filterStyles="true"/}}
"officepreview" is a bit long for a macro name. "preview" is shorter but
is too generic and thus can be confusing. "preview" could be the name of
a more generic macro that previews any type of attachment, based on its
mime type (so not just office documents).
"attachment" is the only required parameter. It is also a bit long, but
"file", which is shorter, is confusing. Some users might try to preview
office documents from their file system or from the web.
"filterStyles" is optional, and defaults to false.
The office preview macro will be just a wrapper for the office preview
script service. This means no decorations (e.g. borders, headings, etc.)
will be added around the output of the script service:
{{velocity}}
{{html}}
$services.officepreview.preview($attachmentReference, $filterStyles)
{{/html}}
{{/velocity}}
I'm not sure if the office preview macro should be a wiki macro or a
Java macro. One disadvantage for wiki macros is
http://jira.xwiki.org/jira/browse/XWIKI-4262 . This means that the
attachment string reference must be resolve before calling the office
preview script service. Currently there's no clean way to resolve a
reference relative to a given document in velocity so I would have to
use groovy which raises programming rights issue. Alternative we can
extend the
http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-model/src/main…
.
There's nothing to customize so the power of wiki macros wouldn't be
used. You can create a wiki macro that wraps the office preview macro
and add decorations specific to your needs.
One the other hand, the advantages of a Java macro are not significant
either because the macro is just a simple wrapper for the office preview
script service.
WDYT?
Thanks,
Marius
Hi devs,
I'd like to rename the office-preview module to office-viewer since it
better matches the current provided functionality: view office
attachments (either inside a wiki page or standalone) without
downloading them.
Let me know if you are against this rename.
Thanks,
Marius
As planned i just pre-released XE/XEM 2.4.3 on maven and subversion.
I'm now waiting for as many testers as possible to try and validate
that it does not contains important regression.
You can download XE/XEM on:
- XE jetty+hsqldb:
http://maven.xwiki.org/releases/com/xpn/xwiki/products/xwiki-enterprise-jet…
- XE war: http://maven.xwiki.org/releases/com/xpn/xwiki/products/xwiki-enterprise-web…
- XE xar: http://maven.xwiki.org/releases/com/xpn/xwiki/products/xwiki-enterprise-wik…
- XEM war: http://maven.xwiki.org/releases/com/xpn/xwiki/products/xwiki-enterprise-man…
- XEM xar: http://maven.xwiki.org/releases/com/xpn/xwiki/products/xwiki-enterprise-man…
If nothing is found i will finish the release tomorrow morning (GMT).
Thanks
On Mon, Sep 27, 2010 at 09:34, Thomas Mortagne
<thomas.mortagne(a)xwiki.com> wrote:
> 5.5 for 2.4.3 and 1.5 for 2.4.2.1
>
> 2.4.3 it is. Starting now.
>
> On Fri, Sep 24, 2010 at 15:42, Thomas Mortagne
> <thomas.mortagne(a)xwiki.com> wrote:
>> Hi devs,
>>
>> 2.4 is a blessed branch, now the issue is that there is no parent
>> field anymore because XE has been release with the wrong version of
>> panels applications.
>>
>> This seems pretty blocker to me and deserve to be fixed ASAP, i can
>> see the following solutions:
>>
>> 1. complete new release of XE/XEM 2.4.3
>> 2. release of XE/XEM 2.4.2.1 with the existing core/web 2.4.2
>> 3. re-release XE 2.3.2
>>
>> 1: +1, probably the cleanest but if I don't have to release core i
>> would be more than glad...
>> 2: +0.5, probably the clean solutions that needs the less work IMO.
>> After all technically XE and core have different versions
>> 3: -1, it's already public and downloaded by some users
>>
>> Also whatever the chosen solution before announcing the release i will
>> as much people as possible to validate it.
>>
>> So WDYT ?
>>
>> --
>> Thomas Mortagne
>>
>
>
>
> --
> Thomas Mortagne
>
--
Thomas Mortagne
Hi devs,
I'd like to propose that we always go through Nexus staging from now on for our Main and Bugfix releases. The process would be:
1) Release to a staged repo (with the final version name)
2) Send a testing mail on devs and users lists to allow people to test the release. Note: we don't make the release avail on xwiki.org, just a mail is sent.
3) Wait for 48 hours
4) Promote the staged release to final and finish the release process (xwiki.org update, announcements, etc)
We could start with 2.5.
- Note 1: This means that in our release dates we should allow for 2 days more in order not to be late because of this.
- Note 2: This is not for milestones or RC. Just for final and bugfix releases.
WDYT?
Thanks
-Vincent
Hi devs,
We've been working on improving the editors (content, class, object),
and now I have some pretty important UI changes to commit, but not
everybody seems to agree with them, so I bring up a vote.
The whole improvements can be seen on
http://incubator.myxwiki.org/xwiki/bin/Improvements/ImprovedEdit
Here are the individual voted points:
0 Remove all panels in edit mode
1a Parent and title above the content in wiki/wysiwyg mode
1b The same style in edit mode as in view mode for the parent/title fields
1c AJAX Suggest for the parent field
2a New label for the content textarea ("Content")
2b List of included documents after the Content label
3a Syntax switcher in the top right corner of the content
3b Syntax help in the top right corner of the content
3c Syntax help and switcher only in the wiki editor
4 Better label for the version comment
5a Right float the Minor edit field
5b Put the Minor edit label after the checkbox
6 Move autosave in line with the submit buttons
7 Introduce new AJAX-powered Add Object
i) above the objects
ii) bellow the objects
8 Introduce new AJAX-powered Add Object from this class
i) at the top of the list of existing objects
ii) at the end of the list
9 Move the class switcher in the top right corner
9b Remove the class switcher
10 Introduce new AJAX-powered Add Property
i) at the top of the list of properties
ii) at the end of the list
I vote +1 for all of the above, except 9b (-0), and with options 7i),
8ii), and 10ii)
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
Hi devs,
2.4 is a blessed branch, now the issue is that there is no parent
field anymore because XE has been release with the wrong version of
panels applications.
This seems pretty blocker to me and deserve to be fixed ASAP, i can
see the following solutions:
1. complete new release of XE/XEM 2.4.3
2. release of XE/XEM 2.4.2.1 with the existing core/web 2.4.2
3. re-release XE 2.3.2
1: +1, probably the cleanest but if I don't have to release core i
would be more than glad...
2: +0.5, probably the clean solutions that needs the less work IMO.
After all technically XE and core have different versions
3: -1, it's already public and downloaded by some users
Also whatever the chosen solution before announcing the release i will
as much people as possible to validate it.
So WDYT ?
--
Thomas Mortagne