Skip to content

Instantly share code, notes, and snippets.

@OlivierJaquemet
Last active February 9, 2018 11:40
Show Gist options
  • Save OlivierJaquemet/1cbe3220749d08af21f5e5429e69bb73 to your computer and use it in GitHub Desktop.
Save OlivierJaquemet/1cbe3220749d08af21f5e5429e69bb73 to your computer and use it in GitHub Desktop.
JPlatform URL Media template JSP allowing Knightlab Timeline to be inserted and displayed in Jalios JPlatform
# 1. Copy JSP in your JPlatform webapp
# 2. Declare this JPlatform URL media template with the following properties (adapte th JSP path) :
# Knightlab Timeline
media.template.default.URL.knightlab-timeline.enabled: true
media.template.default.URL.knightlab-timeline.regex: ^https://cdn\\.knightlab\\.com/libs/timeline3/latest/embed/index.html\\?.*
media.template.default.URL.knightlab-timeline.jsp: /jcore/media/url/mediaTemplateKnightlabTimeline.jsp
<%--
@Summary: Template used to display a Knightlab Timeline from Google Spreadsheet
see https://timeline.knightlab.com/
--%><%@ page import="java.util.regex.Matcher" %><%
%><%@ page import="java.util.regex.Pattern" %><%
%><%@ include file='/jcore/doInitPage.jspf' %><%
%><%@ include file='/jcore/media/mediaTemplateInit.jspf' %><%
if (Util.isEmpty(url)){
return;
}
String cssClass = encodeForHTMLAttribute(getUntrustedStringParameter("class", "embed-responsive-16by9"));
String cssStyle = encodeForHTMLAttribute(getUntrustedStringParameter("style", ""));
cssClass = cssClass != null ? "class=\"github-gist embed-responsive "+cssClass+"\"" : "class=\"github-gist embed-responsive embed-responsive-16by9\"";
cssStyle = cssStyle != null ? "style=\""+cssStyle+"\"" : "";
%>
<div <%= cssClass %> <%= cssStyle %>>
<iframe class="embed-responsive-item"
src="<%= encodeForHTMLAttribute(url) %>"
frameborder="0"
allowfullscreen></iframe>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment