Project

General

Profile

1 6543 leinfelder
<%@ page language="java"%>
2 7390 leinfelder
<%@page import="org.dataone.client.D1Client"%>
3
<%@page import="java.net.URL"%>
4 6543 leinfelder
<%
5
	/**
6
	 *  '$RCSfile$'
7
	 *      Authors: Matt Jones
8
	 *    Copyright: 2008 Regents of the University of California and the
9
	 *               National Center for Ecological Analysis and Synthesis
10
	 *  For Details: http://www.nceas.ucsb.edu/
11
	 *
12
	 *   '$Author$'
13
	 *     '$Date$'
14
	 * '$Revision$'
15
	 *
16
	 * This is an HTML document for loading an xml document into Oracle
17
	 *
18
	 * This program is free software; you can redistribute it and/or modify
19
	 * it under the terms of the GNU General Public License as published by
20
	 * the Free Software Foundation; either version 2 of the License, or
21
	 * (at your option) any later version.
22
	 *
23
	 * This program is distributed in the hope that it will be useful,
24
	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
	 * GNU General Public License for more details.
27
	 *
28
	 * You should have received a copy of the GNU General Public License
29
	 * along with this program; if not, write to the Free Software
30
	 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
	 */
32
%>
33
34
<%@ include file="../../common/common-settings.jsp"%>
35
<%@ include file="../../common/configure-check.jsp"%>
36
<%@page import="edu.ucsb.nceas.metacat.service.SessionService"%>
37
<%
38
39 7390 leinfelder
//get the CN environment, dynamically
40
String cnURL = D1Client.getCN().getNodeBaseServiceUrl();
41
String portalURL = cnURL.substring(0, cnURL.lastIndexOf(new URL(cnURL).getPath())) + "/portal";
42
//String portalURL =  "https://cn.dataone.org/portal";
43
44 6543 leinfelder
// what was the given DataONE identity?
45
String d1Identity = request.getParameter("d1Identity");
46
String token = request.getParameter("token");
47
48
// look up the username from the given session
49
String sessionId = request.getParameter("sessionId");
50
if (sessionId == null) {
51 6545 leinfelder
	if (request.getSession() != null) {
52
		sessionId = request.getSession().getId();
53
	}
54 6543 leinfelder
}
55 6545 leinfelder
if (sessionId == null || !SessionService.getInstance().isSessionRegistered(sessionId)) {
56 6543 leinfelder
	// redirect to the login page
57
	response.sendRedirect(STYLE_SKINS_URL + "/dev/login.html");
58
	return;
59
}
60
String userName = SessionService.getInstance().getRegisteredSession(sessionId).getUserName();
61
%>
62
63
<html>
64
<head>
65
<title>Map legacy account to DataONE</title>
66
67
<link rel="stylesheet" type="text/css" href="<%=STYLE_COMMON_URL%>/jquery/jqueryui/css/smoothness/jquery-ui-1.8.6.custom.css">
68
<link rel="stylesheet" type="text/css" href="dataone.css" />
69
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/jquery/jquery.js"></script>
70
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/jquery/jqueryui/js/jquery-ui-1.8.6.custom.min.js"></script>
71
<script type="text/javascript">
72
var portalURL = "https://cn-dev.dataone.org/portal/identity";
73
74
function lookupToken() {
75
	var data = $('#tokenFrame').contents();
76
	$('#mapForm [name="token"]').val(data);
77
	alert('Loaded token: ' + data);
78
79
80
}
81
function lookupSubject() {
82
	var subjectFrame = $('#subjectFrame');
83
	var data = $('#subjectFrame').val();
84
	$('#mapForm [name="primarySubject"]').val(data);
85
	alert('Loaded subject: ' + data);
86
}
87
function initTabs() {
88
	$(function() {
89
		$("#tabs").tabs();
90
		$("#tabs").tabs("add", "#mapping", "Legacy account mapping");
91
	});
92
}
93
function init() {
94
	initTabs();
95
	//lookupToken();
96
	//lookupSubject();
97
}
98
</script>
99
100
</head>
101
<body onload="init()">
102
<!-- dataone logo header -->
103
<div class="logoheader">
104
	<h1></h1>
105
</div>
106
107
<div id="tabs">
108
	<!-- place holder for tabs -->
109
	<ul></ul>
110
111
	<div id="mapping">
112 6547 leinfelder
		<p>Use this form to connect your old KNB account to your new DataONE identity.
113
		You will need to be logged into both systems at the same time in order for the mapping to take place.
114
		</p>
115 6543 leinfelder
116 6547 leinfelder
		Your current KNB account:
117 6543 leinfelder
		<div>
118
		<%=userName %>
119
		</div>
120
		<br/>
121 6547 leinfelder
122
		Will be mapped to this DataONE account*:
123 7390 leinfelder
		<iframe id="subjectFrame" frameborder="0" marginwidth="0" height="30" width="100%" src="<%=portalURL %>/identity?action=getSubject">
124 6543 leinfelder
		</iframe>
125 6547 leinfelder
126
		<hr/>
127
128
		1. Use this temporary DataONE token*:
129 7390 leinfelder
		<iframe id="tokenFrame" frameborder="0" marginwidth="0" height="30" width="100%" src="<%=portalURL %>/identity?action=getToken">
130 6547 leinfelder
		</iframe>
131
		<br/>
132 6543 leinfelder
133 6547 leinfelder
134
135 6543 leinfelder
		<form action="performMapping.jsp" target="right" method="POST" id="mapForm">
136 6547 leinfelder
			2. Enter your DataONE token:
137 6543 leinfelder
			<br/>
138
			<input type="text" name="token" size="50">
139
			<input type="hidden" name="secondarySubject" value="<%=userName %>">
140
			<input type="hidden" name="action" value="mapIdentity">
141
			<input type="submit" value="Map Identity">
142
		</form>
143 6547 leinfelder
144
		<hr/>
145
146
		<p>
147
			*If you do not see your DataONE account or DataONE token here, then you must first authenticate using CILogon.
148
		</p>
149
		<p>
150 7390 leinfelder
			<a href="<%=portalURL %>/startRequest?target=<%=STYLE_SKINS_URL%>/dataone/index.jsp">Begin Login</a>
151 6547 leinfelder
		</p>
152 6543 leinfelder
	</div>
153
154
</div>
155
</body>
156
</html>