modified so as to support also the new page opening instead of the iFrame
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/VREApp-Integration-portlet@176569 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5cc3727870
commit
a5d0334494
|
@ -0,0 +1,5 @@
|
|||
div.vre-app-integration-portlet > div.portlet-borderless-container {
|
||||
background: transparent;
|
||||
padding: 4px 10px 0;
|
||||
border-radius: 5px;
|
||||
}
|
|
@ -1,62 +1,68 @@
|
|||
<%@include file="/html/init.jsp" %>
|
||||
<%@include file="/html/init.jsp"%>
|
||||
|
||||
<liferay-portlet:actionURL portletConfiguration="true" var="configurationURL" />
|
||||
<liferay-portlet:actionURL portletConfiguration="true"
|
||||
var="configurationURL" />
|
||||
|
||||
<%
|
||||
String appURL_cfg = GetterUtil.getString(portletPreferences.getValue("appURL", StringPool.BLANK));
|
||||
String appURLTokenParam_cfg = GetterUtil.getString(portletPreferences.getValue("appURLTokenParam", StringPool.BLANK));
|
||||
Integer iFrameHeightParam_cfg = GetterUtil.getInteger(portletPreferences.getValue("iFrameHeightParam", "1000"));
|
||||
|
||||
String appURL_cfg = GetterUtil.getString(portletPreferences.getValue("appURL", StringPool.BLANK));
|
||||
String appURLTokenParam_cfg = GetterUtil
|
||||
.getString(portletPreferences.getValue("appURLTokenParam", StringPool.BLANK));
|
||||
Integer iFrameHeightParam_cfg = GetterUtil
|
||||
.getInteger(portletPreferences.getValue("iFrameHeightParam", "1000"));
|
||||
boolean newWindowPreference_cfg = GetterUtil
|
||||
.getBoolean(portletPreferences.getValue("newWindowPreference", StringPool.FALSE));
|
||||
String applicationNameParam_cfg = GetterUtil
|
||||
.getString(portletPreferences.getValue("applicationNameParam", "the Application"));
|
||||
if (applicationNameParam_cfg.equals(""))
|
||||
applicationNameParam_cfg = "the Application";
|
||||
%>
|
||||
|
||||
<aui:form action="<%= configurationURL %>" method="post" name="fm">
|
||||
<aui:input name="<%= Constants.CMD %>" type="hidden" value="<%= Constants.UPDATE %>" />
|
||||
<aui:form action="<%=configurationURL%>" method="post" name="fm">
|
||||
<aui:input name="<%=Constants.CMD%>" type="hidden"
|
||||
value="<%=Constants.UPDATE%>" />
|
||||
|
||||
<!-- Application URL -->
|
||||
<aui:field-wrapper cssClass="field-group">
|
||||
<aui:input style="width: 100%;"
|
||||
name="preferences--appURL--"
|
||||
type="text"
|
||||
cssClass="text long-field"
|
||||
showRequiredLabel="true"
|
||||
label="Application URL"
|
||||
inlineField="true"
|
||||
inlineLabel="left"
|
||||
<aui:input style="width: 100%;" name="preferences--appURL--"
|
||||
type="text" cssClass="text long-field" showRequiredLabel="true"
|
||||
label="Application URL" inlineField="true" inlineLabel="left"
|
||||
placeholder="Application URL"
|
||||
helpMessage="Actual endpoint of the external web-application (must start with https://)"
|
||||
value="<%= appURL_cfg %>"
|
||||
required="true" />
|
||||
value="<%=appURL_cfg%>" required="true" />
|
||||
</aui:field-wrapper>
|
||||
|
||||
<!-- Application URL Parameter name -->
|
||||
<aui:field-wrapper cssClass="field-group">
|
||||
<aui:input
|
||||
type="text"
|
||||
name="preferences--appURLTokenParam--"
|
||||
cssClass="text medium-field"
|
||||
label="Application URL Parameter name"
|
||||
inlineField="true"
|
||||
inlineLabel="left"
|
||||
placeholder="Parameter name"
|
||||
helpMessage="Name of the Parameter (e.g gcube-token) expected by the web-application in the URL"
|
||||
value="<%= appURLTokenParam_cfg %>"/>
|
||||
<aui:input type="text" name="preferences--appURLTokenParam--"
|
||||
cssClass="text medium-field" label="Application URL Parameter name"
|
||||
inlineField="true" inlineLabel="left" placeholder="Parameter name"
|
||||
helpMessage="Name of the Security Token Parameter (e.g gcube-token) expected by the web-application in the URL"
|
||||
value="<%=appURLTokenParam_cfg%>" />
|
||||
</aui:field-wrapper>
|
||||
|
||||
<!-- Application URL Parameter name -->
|
||||
<aui:field-wrapper cssClass="field-group">
|
||||
<aui:input
|
||||
type="text"
|
||||
name="preferences--iFrameHeightParam--"
|
||||
<p class="lead">Display options (default iFrame):</p>
|
||||
<aui:input type="text" name="preferences--iFrameHeightParam--"
|
||||
cssClass="text medium-field"
|
||||
label="iFrame height as integer in pixels"
|
||||
inlineField="true"
|
||||
inlineLabel="left"
|
||||
placeholder="in Pixels"
|
||||
label="iFrame height as integer in pixels" inlineField="true"
|
||||
inlineLabel="left" placeholder="in Pixels"
|
||||
helpMessage="Enter the height in pixels of the iFrame Height (default 1000)"
|
||||
value="<%= iFrameHeightParam_cfg %>"/>
|
||||
value="<%=iFrameHeightParam_cfg%>" />
|
||||
|
||||
</aui:field-wrapper>
|
||||
<aui:field-wrapper cssClass="field-group">
|
||||
<aui:input name="preferences--newWindowPreference--" type="checkbox"
|
||||
label="Use a new tab instead of the iFrame"
|
||||
helpMessage="If checked will use a new tab instead of the iFrame (beware of the popup blocker)"
|
||||
value="<%=newWindowPreference_cfg%>" />
|
||||
<aui:input type="text" name="preferences--applicationNameParam--"
|
||||
cssClass="text medium-field"
|
||||
label="In case of new window enter the App name" inlineField="true"
|
||||
inlineLabel="left" placeholder="The name of the application (e.g. Galaxy, ShareLatex)"
|
||||
helpMessage="Enter the name of the application (e.g. Galaxy, ShareLatex etc.)"
|
||||
value="<%=applicationNameParam_cfg%>" />
|
||||
|
||||
|
||||
</aui:field-wrapper>
|
||||
<aui:button-row>
|
||||
<aui:button type="submit" />
|
||||
</aui:button-row>
|
||||
|
|
|
@ -1,54 +1,68 @@
|
|||
<%@include file="/html/init.jsp" %>
|
||||
|
||||
<%@include file="/html/init.jsp"%>
|
||||
|
||||
<!-- Inherit Generic public web-app portlet configuration parameters -->
|
||||
<%
|
||||
String appURL_view = GetterUtil.getString(portletPreferences.getValue("appURL", StringPool.BLANK));
|
||||
String appURLTokenParam_view = GetterUtil.getString(portletPreferences.getValue("appURLTokenParam", StringPool.BLANK));
|
||||
Integer iFrameHeight = GetterUtil.getInteger(portletPreferences.getValue("iFrameHeightParam", "1000"));
|
||||
pageContext.setAttribute("iFrameHeight", iFrameHeight);
|
||||
String appURL_view = GetterUtil.getString(portletPreferences.getValue("appURL", StringPool.BLANK));
|
||||
String appURLTokenParam_view = GetterUtil
|
||||
.getString(portletPreferences.getValue("appURLTokenParam", StringPool.BLANK));
|
||||
Integer iFrameHeight = GetterUtil.getInteger(portletPreferences.getValue("iFrameHeightParam", "1000"));
|
||||
pageContext.setAttribute("iFrameHeight", iFrameHeight);
|
||||
|
||||
Object securityTokenObj = request.getAttribute("securityToken");
|
||||
String securityToken = "";
|
||||
if(securityToken != null){
|
||||
boolean newWindowPreference = GetterUtil.getBoolean(portletPreferences.getValue("newWindowPreference", StringPool.FALSE));
|
||||
pageContext.setAttribute("newWindowPreference", newWindowPreference);
|
||||
|
||||
String applicationNameParam_view = GetterUtil.getString(portletPreferences.getValue("applicationNameParam", "the Application"));
|
||||
pageContext.setAttribute("applicationNameParam_view", applicationNameParam_view);
|
||||
|
||||
Object securityTokenObj = request.getAttribute("securityToken");
|
||||
String securityToken = "";
|
||||
if (securityToken != null) {
|
||||
securityToken = securityTokenObj.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/* handle the case where the page is called with GET parameters needing to be forwarded*/
|
||||
String completeURL = PortalUtil.getCurrentCompleteURL(request);
|
||||
String queryString = "";
|
||||
if (completeURL.indexOf("?") > 0) {
|
||||
queryString = completeURL.substring(completeURL.indexOf("?")+1);
|
||||
/* handle the case where the page is called with GET parameters needing to be forwarded*/
|
||||
String completeURL = PortalUtil.getCurrentCompleteURL(request);
|
||||
String queryString = "";
|
||||
if (completeURL.indexOf("?") > 0) {
|
||||
queryString = completeURL.substring(completeURL.indexOf("?") + 1);
|
||||
queryString = queryString.trim();
|
||||
}
|
||||
}
|
||||
|
||||
/* handle the case where the appURL provided has GET parameters needing to be forwarded*/
|
||||
if (appURL_view.indexOf("?") > 0) {
|
||||
/* handle the case where the appURL provided has GET parameters needing to be forwarded*/
|
||||
if (appURL_view.indexOf("?") > 0) {
|
||||
if (queryString != null && !queryString.equals("")) { //not empty
|
||||
queryString += "&" + appURL_view.substring(appURL_view.indexOf("?")+1);
|
||||
queryString += "&" + appURL_view.substring(appURL_view.indexOf("?") + 1);
|
||||
} else {
|
||||
queryString = appURL_view.substring(appURL_view.indexOf("?")+1);
|
||||
queryString = appURL_view.substring(appURL_view.indexOf("?") + 1);
|
||||
}
|
||||
appURL_view = appURL_view.substring(0, appURL_view.indexOf("?"));
|
||||
queryString = queryString.trim();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String applicationURL = appURL_view;
|
||||
if (! appURLTokenParam_view.equals("")) {
|
||||
String applicationURL = appURL_view;
|
||||
if (!appURLTokenParam_view.equals("")) {
|
||||
applicationURL += "?" + appURLTokenParam_view + "=" + securityToken;
|
||||
if (queryString != null && !queryString.equals("")) {
|
||||
applicationURL += "&" + queryString;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
if (queryString != null && !queryString.equals("")) {
|
||||
applicationURL += "?" + queryString;
|
||||
}
|
||||
}
|
||||
pageContext.setAttribute("applicationURL", applicationURL);
|
||||
}
|
||||
pageContext.setAttribute("applicationURL", applicationURL);
|
||||
pageContext.setAttribute("newWindow", true);
|
||||
%>
|
||||
|
||||
|
||||
<iframe id="iFrameProxy" src="${applicationURL}" width="100%" marginwidth="0"
|
||||
marginheight="0" frameborder="0" height="${iFrameHeight}" style="overflow-x: hidden;"> </iframe>
|
||||
|
||||
<c:choose>
|
||||
<c:when test="${not newWindowPreference}">
|
||||
<iframe id="iFrameProxy" src="${applicationURL}" width="100%"
|
||||
marginwidth="0" marginheight="0" frameborder="0"
|
||||
height="${iFrameHeight}" style="overflow-x: hidden;"> </iframe>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<p class="lead">If no new window appears, please click <a href="${applicationURL}" target="_blank">here</a> to open <a href="${applicationURL}" target="_blank">${applicationNameParam_view}</a></p>
|
||||
<script>
|
||||
window.open('${applicationURL}');
|
||||
</script>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
|
Loading…
Reference in New Issue