mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
first pass at add content from xforms ui
- added an add content panel to the file picker which enables browsing the local disk to select content to upload. the file is uploaded without requiring a browser refresh by targeting a hidden iframe. the server response includes a js call which notifies the form that the upload is complete. - added annotations to ajax methods to enable specifying the response mime type of the method. needed for uploadFile which returns html rather than xml - minor cleanup in schemaformbuilder - added mapping between xsl-fo mimetypes and those in mimetype map git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4576 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -22,9 +22,6 @@ import javax.xml.transform.Result;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.sax.SAXResult;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.w3c.dom.*;
|
||||
@@ -33,9 +30,7 @@ import org.apache.fop.apps.FOUserAgent;
|
||||
import org.apache.fop.apps.Fop;
|
||||
import org.apache.fop.apps.FOPException;
|
||||
import org.apache.fop.apps.FopFactory;
|
||||
import org.apache.fop.apps.FormattingResults;
|
||||
import org.apache.fop.apps.MimeConstants;
|
||||
import org.apache.fop.apps.PageSequenceResults;
|
||||
|
||||
/**
|
||||
* A rendering engine which uses xsl-fo templates to generate renditions of
|
||||
@@ -49,6 +44,33 @@ public class XSLFORenderingEngine
|
||||
|
||||
private static final Log LOGGER = LogFactory.getLog(XSLFORenderingEngine.class);
|
||||
|
||||
private static final Map<String, String> MIME_TYPES =
|
||||
new HashMap<String, String>();
|
||||
static
|
||||
{
|
||||
MIME_TYPES.put(MimeConstants.MIME_PDF, MimeConstants.MIME_PDF);
|
||||
|
||||
MIME_TYPES.put(MimeConstants.MIME_POSTSCRIPT, MimeConstants.MIME_POSTSCRIPT);
|
||||
MIME_TYPES.put(MimeConstants.MIME_EPS, MimeConstants.MIME_POSTSCRIPT);
|
||||
|
||||
MIME_TYPES.put(MimeConstants.MIME_PLAIN_TEXT, MimeConstants.MIME_PLAIN_TEXT);
|
||||
|
||||
MIME_TYPES.put(MimeConstants.MIME_RTF, MimeConstants.MIME_RTF);
|
||||
MIME_TYPES.put(MimeConstants.MIME_RTF_ALT1, MimeConstants.MIME_RTF);
|
||||
MIME_TYPES.put(MimeConstants.MIME_RTF_ALT2, MimeConstants.MIME_RTF);
|
||||
|
||||
MIME_TYPES.put(MimeConstants.MIME_MIF, MimeConstants.MIME_MIF);
|
||||
MIME_TYPES.put("application/x-mif", MimeConstants.MIME_MIF);
|
||||
|
||||
MIME_TYPES.put(MimeConstants.MIME_SVG, MimeConstants.MIME_SVG);
|
||||
MIME_TYPES.put("image/svg", MimeConstants.MIME_SVG);
|
||||
|
||||
MIME_TYPES.put(MimeConstants.MIME_GIF, MimeConstants.MIME_GIF);
|
||||
MIME_TYPES.put(MimeConstants.MIME_PNG, MimeConstants.MIME_PNG);
|
||||
MIME_TYPES.put(MimeConstants.MIME_JPEG, MimeConstants.MIME_JPEG);
|
||||
MIME_TYPES.put(MimeConstants.MIME_TIFF, MimeConstants.MIME_TIFF);
|
||||
};
|
||||
|
||||
public XSLFORenderingEngine()
|
||||
{
|
||||
super();
|
||||
@@ -72,16 +94,21 @@ public class XSLFORenderingEngine
|
||||
RenderingEngine.RenderingException
|
||||
{
|
||||
Result result = null;
|
||||
String mimetype = MIME_TYPES.get(ret.getMimetypeForRendition());
|
||||
if (mimetype == null)
|
||||
{
|
||||
throw new RenderingEngine.RenderingException("mimetype " + ret.getMimetypeForRendition() +
|
||||
" is not supported by " + this.getName());
|
||||
}
|
||||
try
|
||||
{
|
||||
final FopFactory fopFactory = FopFactory.newInstance();
|
||||
final FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
|
||||
final Fop fop = fopFactory.newFop(ret.getMimetypeForRendition(),
|
||||
final Fop fop = fopFactory.newFop(mimetype,
|
||||
foUserAgent,
|
||||
out);
|
||||
// Resulting SAX events (the generated FO) must be piped through to FOP
|
||||
result = new SAXResult(fop.getDefaultHandler());
|
||||
|
||||
}
|
||||
catch (FOPException fope)
|
||||
{
|
||||
|
Reference in New Issue
Block a user