You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by mi...@apache.org on 2006/03/13 14:56:06 UTC
svn commit: r385554 - in /lenya/trunk/src/modules/opendocument:
java/src/org/apache/lenya/cms/site/usecases/UploadOpenDocument.java
sitemap.xmap usecases/upload.jx
Author: michi
Date: Mon Mar 13 05:56:06 2006
New Revision: 385554
URL: http://svn.apache.org/viewcvs?rev=385554&view=rev
Log:
opendocument links fixed
Modified:
lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/UploadOpenDocument.java
lenya/trunk/src/modules/opendocument/sitemap.xmap
lenya/trunk/src/modules/opendocument/usecases/upload.jx
Modified: lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/UploadOpenDocument.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/UploadOpenDocument.java?rev=385554&r1=385553&r2=385554&view=diff
==============================================================================
--- lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/UploadOpenDocument.java (original)
+++ lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/UploadOpenDocument.java Mon Mar 13 05:56:06 2006
@@ -36,13 +36,9 @@
*/
public class UploadOpenDocument extends DocumentUsecase {
- protected static final String PARENT_ID = "parentId";
-
protected static final String ODT_EXTENSION = ".odt";
- protected static final String DEFAULT_INDEX = "index";
-
- protected static final String ODT_MIME = "application/vnd.oasis.opendocument.text";
+ protected static final String ODT_MIME_TYPE = "application/vnd.oasis.opendocument.text";
/**
* @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
@@ -57,11 +53,11 @@
protected void doExecute() throws Exception {
if (getLogger().isDebugEnabled())
getLogger().debug("ODT::uploadODT() called");
- Document parent = getSourceDocument();
- String sourceURI = parent.getSourceURI();
- String destination = sourceURI.substring(0, sourceURI
- .lastIndexOf(".xml"))
- + ODT_EXTENSION;
+ Document source = getSourceDocument();
+ String destination = source.getSourceURI();
+ if (source.getSourceExtension().equals("xml")) {
+ destination = destination.substring(0, destination.lastIndexOf(".xml")) + ODT_EXTENSION;
+ }
Part file = getPart("file");
String mimeType = file.getMimeType();
@@ -69,10 +65,10 @@
if (file.isRejected()) {
String[] params = { Integer.toString(file.getSize()) };
addErrorMessage("upload-size-exceeded", params);
- } else if (ODT_MIME.equals(mimeType)){
+ } else if (ODT_MIME_TYPE.equals(mimeType)){
saveResource(destination, file);
} else {
- addErrorMessage("The mime type of the document you want to upload does not match the mime type: \""+ODT_MIME+"\"");
+ addErrorMessage("The mime type of the document you want to upload does not match the mime type: \""+ODT_MIME_TYPE+"\"");
}
}
Modified: lenya/trunk/src/modules/opendocument/sitemap.xmap
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/sitemap.xmap?rev=385554&r1=385553&r2=385554&view=diff
==============================================================================
--- lenya/trunk/src/modules/opendocument/sitemap.xmap (original)
+++ lenya/trunk/src/modules/opendocument/sitemap.xmap Mon Mar 13 05:56:06 2006
@@ -49,7 +49,10 @@
<!-- Fixme The path of the odt file should be get with the input module, like for the xml file.
Write a special DocumentIdToPathMapper, permit a Resource to have its own Mapper-->
<map:match pattern="*.xml">
+ <map:generate src="zip:lenya://lenya/pubs/{page-envelope:publication-id}/content/{page-envelope:area}{page-envelope:document-id}/index_{page-envelope:document-language}.odt!/content.xml"/>
+<!--
<map:generate src="zip:lenyadoc://{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-language}/{page-envelope:document-id}!/content.xml"/>
+-->
<!--
<map:transform src="fallback://lenya/modules/opendocument/xslt/main_html.xsl">
@@ -62,8 +65,12 @@
<map:transform src="fallback://lenya/modules/opendocument/xslt/opendocument2xhtml.xsl"/>
<map:serialize type="xml"/>
</map:match>
+
<map:match pattern="**.odt">
+ <map:read src="lenya://lenya/pubs/{page-envelope:publication-id}/content/{page-envelope:area}{page-envelope:document-id}/index_{page-envelope:document-language}.odt" mime-type="application/vnd.oasis.opendocument.text"/>
+<!--
<map:read src="lenyadoc://{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-language}/{page-envelope:document-id}" mime-type="application/vnd.oasis.opendocument.text"/>
+-->
</map:match>
</map:pipeline>
Modified: lenya/trunk/src/modules/opendocument/usecases/upload.jx
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/usecases/upload.jx?rev=385554&r1=385553&r2=385554&view=diff
==============================================================================
--- lenya/trunk/src/modules/opendocument/usecases/upload.jx (original)
+++ lenya/trunk/src/modules/opendocument/usecases/upload.jx Mon Mar 13 05:56:06 2006
@@ -38,7 +38,7 @@
</tr>
<tr>
<td colspan="2">
- <strong><i18n:text>HEADSUP:</i18n:text> <i18n:text>The existing document will be deleted!</i18n:text></strong>
+ <strong><i18n:text>HEADSUP:</i18n:text> <i18n:text>The existing document will be overwritten!</i18n:text></strong>
</td>
</tr>
<tr>
@@ -55,11 +55,11 @@
<td/>
<td>
<input i18n:attr="value" name="submit" type="submit"
- value="New Asset"/>
+ value="Upload ODT"/>
</td>
</tr>
</table>
</form>
</div>
</page:body>
-</page:page>
\ No newline at end of file
+</page:page>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org