提交 6402b3b0 编写于 作者: N nilspreusker

added new RenderInfo value 'HTML_REFERENCE' for contentRepresentations that...

added new RenderInfo value 'HTML_REFERENCE' for contentRepresentations that just provide a reference URL instead of the actual HTML content, updated UI and REST-API accordingly
上级 a3eb902a
......@@ -19,8 +19,13 @@ public enum RenderInfo {
CODE,
/* The UI will attempt to render images as HTML image tags. */
IMAGE,
/* The UI will attempt to render HTML artifact representations as HTML. */
/* ContentRepresentations that use the HTML RenderInfo should return HTML as
* content, the UI will attempt to render HTML in an iframe. */
HTML,
/* ContentRepresentations that use the HTML_REFERENCE RenderInfo should return
* a URL as content, the UI will then use this URL as "src" attribute in the
* iframe it uses to render the ContentRepresentation */
HTML_REFERENCE,
/*
* The UI will not attempt to render binary content-representations, it will
* however display an icon based on the mimeType property of the
......
......@@ -13,7 +13,7 @@
background: none repeat scroll 0 0 #F9F9F9;
}
.artifact-image, .artifact-html, .artifact-binary, .artifact-code, .artifact-text-plain {
.artifact-image, .artifact-html, .artifact-html-reference, .artifact-binary, .artifact-code, .artifact-text-plain {
overflow: auto;
}
......@@ -21,7 +21,7 @@
margin: 1.2em;
}
.artifact-html iframe {
.artifact-html iframe, .artifact-html-reference iframe {
border: 0;
width: 100%;
}
......
......@@ -215,7 +215,9 @@
if(responseJson.renderInfo == "IMAGE") {
tabContent = '<div class="artifact-image"><img id="' + responseJson.contentRepresentationId + '" src="' + Activiti.service.REST_PROXY_URI_RELATIVE + "content?connectorId=" + encodeURIComponent(responseJson.connectorId) + "&artifactId=" + encodeURIComponent(responseJson.artifactId) + "&contentRepresentationId=" + encodeURIComponent(responseJson.contentRepresentationId) + '" border=0></img></div>';
} else if (responseJson.renderInfo == "HTML") {
tabContent = '<div class="artifact-html"><iframe src ="' + Activiti.service.REST_PROXY_URI_RELATIVE + "content?connectorId=" + encodeURIComponent(responseJson.connectorId) + "&artifactId=" + encodeURIComponent(responseJson.artifactId) + "&contentRepresentationId=" + encodeURIComponent(responseJson.contentRepresentationId) + '" width="100%" height="100%"><p>Your browser does not support iframes.</p></iframe></div>';
tabContent = '<div class="artifact-html"><iframe src ="' + Activiti.service.REST_PROXY_URI_RELATIVE + "content?connectorId=" + encodeURIComponent(responseJson.connectorId) + "&artifactId=" + encodeURIComponent(responseJson.artifactId) + "&contentRepresentationId=" + encodeURIComponent(responseJson.contentRepresentationId) + '"><p>Your browser does not support iframes.</p></iframe></div>';
} else if (responseJson.renderInfo == "HTML_REFERENCE") {
tabContent = '<div class="artifact-html-reference"><iframe src ="' + responseJson.url + '"><p>Your browser does not support iframes.</p></iframe></div>';
} else if (responseJson.renderInfo == "BINARY") {
// TODO: show some information but no content for binary
tabContent = '<div class="artifact-binary"><p>No preview available...</p></div>';
......
......@@ -49,6 +49,7 @@ public class ContentRepresentationGet extends ActivitiWebScript {
// For images and HTML we don't need to send the content, the URL will be put together in the UI
// and the content will be requested via ContentGet.
break;
case HTML_REFERENCE:
case BINARY:
case CODE:
case TEXT_PLAIN:
......
......@@ -10,9 +10,11 @@
<#-- For images we don't need to send the content since it will be requested through a URL and the content.get webscript. -->
<#elseif renderInfo == "HTML">
<#-- For HTML we don't need to send the content since it will be requested through a URL and the content.get webscript. -->
<#elseif renderInfo == "HTML_REFERENCE">
"url": "${content}"
<#else>
<#-- Content for "BINARY", "CODE" or "TEXT_PLAIN" needs to be HTML escaped. -->
"content": "${content?html}"
"content": "${content?html}"
</#if>
}
</#escape>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册