cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gkossakow...@apache.org
Subject svn commit: r674328 - in /cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main: java/org/apache/cocoon/tools/maven/daisy/export/strategy/CocoonExportStrategy.java resources/org/apache/cocoon/tools/maven/daisy/export/strategy/cocoon-doc-2-xdoc.xslt
Date Sun, 06 Jul 2008 18:22:12 GMT
Author: gkossakowski
Date: Sun Jul  6 11:22:12 2008
New Revision: 674328

URL: http://svn.apache.org/viewvc?rev=674328&view=rev
Log:
Added support for MultiMediaObjects inclusion. Currently, only Flash parts are handled correctly.

Modified:
    cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/java/org/apache/cocoon/tools/maven/daisy/export/strategy/CocoonExportStrategy.java
    cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/resources/org/apache/cocoon/tools/maven/daisy/export/strategy/cocoon-doc-2-xdoc.xslt

Modified: cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/java/org/apache/cocoon/tools/maven/daisy/export/strategy/CocoonExportStrategy.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/java/org/apache/cocoon/tools/maven/daisy/export/strategy/CocoonExportStrategy.java?rev=674328&r1=674327&r2=674328&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/java/org/apache/cocoon/tools/maven/daisy/export/strategy/CocoonExportStrategy.java
(original)
+++ cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/java/org/apache/cocoon/tools/maven/daisy/export/strategy/CocoonExportStrategy.java
Sun Jul  6 11:22:12 2008
@@ -44,6 +44,7 @@
         //   documentTypeId ==  5 --> CocoonDocument
         //   documentTypeId == 13 --> NewsItem
         //   documentTypeId == 12 --> SitemapComponent
+        //   documentTypeId == 14 --> WebpageWithSidebar
         if(documentTypeId == 2 || documentTypeId == 5 || documentTypeId == 10 || documentTypeId
== 12 || documentTypeId == 13 || documentTypeId == 14) {
             transformDocument(doc, editUrl, author, si, "org/apache/cocoon/tools/maven/daisy/export/strategy/cocoon-doc-2-xdoc.xslt");
         }
@@ -59,6 +60,19 @@
                 throw new DaisyClientException("Problems occurred while accessing the Daisy
repository.", e);
             }
         }
+        //   documentTypeId ==  9 --> MultiMediaObject (flash hopefully)
+        else if(documentTypeId == 9) {
+            si.relativeName = PATH_RESOURCES_FLASH + DaisyDocumentProxy.createUniqeFileName(doc)
+ ".swf";
+            log.info("Trying to export flash object" + si.relativeName);
+            try {
+                // partTypeId == 13 --> MultiMediaData
+                si.data = doc.getDocument().getPart(13).getData();
+            } catch (PartNotFoundException e) {
+                throw new DaisyClientException("Problems occurred while accessing the Daisy
repository.", e);
+            } catch (RepositoryException e) {
+                throw new DaisyClientException("Problems occurred while accessing the Daisy
repository.", e);
+            }
+        }
         else {
             log.warn("Document id=" + doc.getDocId() + " not streamed because there is no
available serialization strategy. documentTypeId=" + documentTypeId);
             return null;

Modified: cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/resources/org/apache/cocoon/tools/maven/daisy/export/strategy/cocoon-doc-2-xdoc.xslt
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/resources/org/apache/cocoon/tools/maven/daisy/export/strategy/cocoon-doc-2-xdoc.xslt?rev=674328&r1=674327&r2=674328&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/resources/org/apache/cocoon/tools/maven/daisy/export/strategy/cocoon-doc-2-xdoc.xslt
(original)
+++ cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/resources/org/apache/cocoon/tools/maven/daisy/export/strategy/cocoon-doc-2-xdoc.xslt
Sun Jul  6 11:22:12 2008
@@ -21,8 +21,8 @@
 <xsl:stylesheet version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:p="http://outerx.org/daisy/1.0#publisher"
-                xmlns:d="http://outerx.org/daisy/1.0"
                 xmlns:ns="http://outerx.org/daisy/1.0"
+                xmlns:d="http://outerx.org/daisy/1.0"
                 exclude-result-prefixes="p d ns">
 
   <xsl:output method="xml"/>
@@ -232,6 +232,73 @@
       </div>
     </div>
   </xsl:template>
+  
+  <!--+
+    | MultiMediaObject (typeId=9)
+    +-->
+  <xsl:template match="d:document[@typeId='9']">
+    <object>
+      <xsl:apply-templates select="d:fields/d:field[(@name = 'MultiMediaObjectHeight')
or (@name = 'MultiMediaObjectWidth')]" mode="object"/>
+      <xsl:apply-templates select="d:parts/d:part[@name = 'MultiMediaData']" mode="object"/>
+      <xsl:apply-templates select="d:fields/d:field[starts-with(@name, 'MultiMediaObject')
and
+        ((@name != 'MultiMediaObjectHeight') or (@name != 'MultiMediaObjectWidth')) ]" mode="object"/>
+      <embed>
+        <xsl:apply-templates select="d:parts/d:part[@name = 'MultiMediaData']" mode="embed"/>
+        <xsl:apply-templates select="d:fields/d:field[starts-with(@name, 'MultiMediaObject')]"
mode="embed"/>
+      </embed>
+    </object>
+    <br/>
+  </xsl:template>
+  
+  <!--+
+    | MultiMediaData part (typeId=13)
+    +-->
+  <xsl:template match="d:part[@typeId='13']">
+    
+  </xsl:template>
+  
+<!--  <xsl:template match="d:part" mode="object">
+    <xsl:variable name="filePath" select="concat($documentBasePath, $document/@id, '/version/',
$document/@dataVersionId, '/part/', $document/d:parts/d:part[@name = 'MultiMediaData']/@typeId,
'/data', $fileName, '?branch=', $document/@branch, '&amp;language=', $document/@language)"/>
+    
+    <xsl:choose>
+      <xsl:when test="@mimeType = 'application/x-shockwave-flash'">
+        <xsl:attribute name="classid">clsid:D27CDB6E-AE6D-11cf-96B8-444553540000</xsl:attribute>
+        <xsl:attribute name="codebase">http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0</xsl:attribute>
+        <param name="movie" value="{$filePath}"/>
+      </xsl:when>
+    </xsl:choose>   
+    <xsl:attribute name="type">
+      <xsl:value-of select="@mimeType" />
+    </xsl:attribute>
+  </xsl:template>
+  
+  <xsl:template match="d:part" mode="embed">
+    <xsl:attribute name="src">
+      <xsl:value-of select="$filePath"/>
+    </xsl:attribute>
+  </xsl:template>
+  
+  <xsl:template match="d:field" mode="object">
+    <xsl:variable name="fieldName" select="substring-after(@name,'MultiMediaObject')"/>
+    <xsl:choose>
+      <xsl:when test="(($fieldName = 'Height') or ($fieldName = 'Width'))">
+        <xsl:attribute name="{$fieldName}">
+          <xsl:value-of select="@valueFormatted"/>
+        </xsl:attribute>
+      </xsl:when>
+      <xsl:otherwise>
+        <param name="{$fieldName}" value="{@valueFormatted}"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template match="d:field" mode="embed">
+    <xsl:variable name="fieldName" select="substring-after(@name,'MultiMediaObject')"/>
+    
+    <xsl:attribute name="{$fieldName}">
+      <xsl:value-of select="@valueFormatted"/>
+    </xsl:attribute>
+  </xsl:template>-->
 
   <!--+
       | Add link to Daisy page at the bottom of each page



Mime
View raw message