blob: 232774b99c72b95654516ed26d51bab68da000ef [file] [log] [blame]
[comment encoding = UTF-8 /]
[comment
<%--
Copyright (c) 2011, 2012 IBM Corporation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
and Eclipse Distribution License v. 1.0 which accompanies this distribution.
The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
and the Eclipse Distribution License is available at
http://www.eclipse.org/org/documents/edl-v10.php.
Contributors:
Andrii Berezovskyi - initial implementation of a sample delegated UI client
--%>
/]
[module generateResourceCreatorClientJsp('http://org.eclipse.lyo/oslc4j/adaptorInterface')]
[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceServices/]
[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
[import org::eclipse::lyo::oslc4j::codegenerator::services::resourcePropertyServices/]
[import org::eclipse::lyo::oslc4j::codegenerator::services::jspServices/]
[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
[template public generateResourceCreatorClientJsp(anAdaptorInterface: AdaptorInterface)]
[file (resourceCreatorClientJspFullFileName(anAdaptorInterface), false, 'UTF-8')]
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html><%--
Copyright (c) 2011, 2012 IBM Corporation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
and Eclipse Distribution License v. 1.0 which accompanies this distribution.
The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
and the Eclipse Distribution License is available at
http://www.eclipse.org/org/documents/edl-v10.php.
Contributors:
Andrii Berezovskyi - initial implementation of a sample delegated UI client
This file is generated by org.eclipse.lyo.oslc4j.codegenerator
--%>
<%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider" %>
<%--
[protected ('imports')]
--%>
<%--
[/protected]
--%>
<%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %>
<%
String creationDialogUri = request.getParameter("creationUri");
creationDialogUri += "#oslc-core-postMessage-1.0";
%>
<%--
[protected ('getRequestAttributes')]
--%>
<%--
[/protected]
--%>
<html>
<head>
<title>Creation Dialog client</title>
<link href="<c:url value="/static/css/bootstrap-4.0.0-beta.min.css"/>" rel="stylesheet">
<link href="<c:url value="/static/css/adaptor.css"/>" rel="stylesheet">
<script src="<c:url value="/static/js/jquery-3.2.1.min.js"/>"></script>
<script src="<c:url value="/static/js/popper-1.11.0.min.js"/>"></script>
<script src="<c:url value="/static/js/bootstrap-4.0.0-beta.min.js"/>"></script>
</head>
<body>
<nav class="navbar sticky-top navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href="<c:url value="/services/catalog/singleton"/>">[anAdaptorInterface.name/]</a>
</div>
</nav>
<div class="container">
<div class="page-header">
<h1>Creation Dialog client</h1>
</div>
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-primary">
<div class="panel-heading">Creation Dialog frame</div>
<div class="panel-body">
<iframe src="<%= creationDialogUri %>" id="delegatedUI"></iframe>
</div>
<div class="panel-footer">
<p>URI: <em style="word-wrap:break-word;"><%= creationDialogUri %></em></p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-success">
<div class="panel-heading">Creation Dialog results</div>
<div class="panel-body" id="results">
<ul></ul>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="text-muted">
OSLC Adaptor was generated using <a href="http://eclipse.org/lyo">Eclipse Lyo</a> 2.3.0.M2.
</p>
</div>
</footer>
<script type="text/javascript">
$(function () {
function handleMessage(message) {
var results = JSON.parse(message);
var firstResult = {
label: results['['/]"oslc:results"[']'/]['['/]0[']'/]['['/]"oslc:label"[']'/],
uri: results['['/]"oslc:results"[']'/]['['/]0[']'/]['['/]"rdf:resource"[']'/]
};
handleOslcSelection(firstResult);
}
function handleOslcSelection(resource) {
$("#results ul").append('<li><a href="' + resource.uri + '"><span>' + resource.label + '</span></a></li>');
}
window.addEventListener('message', function (e) {
var HEADER = "oslc-response:";
if (e.source == document.getElementById("delegatedUI").contentWindow
&& e.data.indexOf(HEADER) == 0) {
handleMessage(e.data.slice(HEADER.length));
}
}, false);
});
</script>
</body>
</html>
[/file]
[/template]