Project

General

Profile

« Previous | Next » 

Revision 5788

add login/logout page and links - only logged in users can use the data cart

View differences:

lib/style/skins/semtools/include_header.jsp
1 1
<%@ page    language="java" %>
2
<%@page import="edu.ucsb.nceas.metacat.util.AuthUtil"%>
2 3
<!--
3 4
  *  '$RCSfile$'
4 5
  *      Authors: Matt Jones, CHad Berkley
......
48 49
				    <td align="center" valign="middle" class="sectionheader">
49 50
				    	<a target="_top" href="<%=STYLE_SKINS_URL%>/semtools/index.jsp">Home</a></td>
50 51
					<td align="center" valign="middle" class="sectionheader">
51
				    	<a target="_top" href="<%=STYLE_SKINS_URL%>/semtools/ontologies.jsp">Ontologies</a></td>
52
						<%
53
							boolean loggedIn = AuthUtil.isUserLoggedIn(request);
54
							if (loggedIn) {
55
						%>
56
							<a href="<%=SERVLET_URL%>?action=logout&qformat=semtools" target="_top">Logout</a>
57
						<%
58
							} else {
59
						%>
60
							<a target="_top" href="<%=STYLE_SKINS_URL%>/semtools/login.jsp">Login</a>
61
						<%
62
							}
63
						%>
64
				    </td>
52 65
					<td align="center" valign="middle" class="sectionheader">
53
						<a target="_new" href="http://bioportal.bioontology.org/">BioPortal</a></td>
66
						<a target="_top" href="<%=STYLE_SKINS_URL%>/semtools/ontologies.jsp">Ontologies</a></td>
67
					<td align="center" valign="middle" class="sectionheader">
68
						<a target="_new" href="http://bioportal.bioontology.org/">BioPortal</a></td>	
54 69
				</tr>
55 70
			</table>
56 71
		</td>
lib/style/skins/semtools/index.jsp
1 1
<%@ page language="java"%>
2
<%@page import="edu.ucsb.nceas.metacat.util.AuthUtil"%>
2 3
<%
3 4
/**
4 5
 * 
......
633 634
				<tr>
634 635
					<th>
635 636
						<p>
636
						Cart
637
						<!-- <input type="button" value="Refresh" onclick="loadCart()"/> -->
638
						<input type="button" value="Remove all" onclick="clearCart(); loadCart()"/>
637
						Cart 
638
						<%
639
							boolean loggedIn = AuthUtil.isUserLoggedIn(request);
640
							if (loggedIn) {
641
						%>
642
							<!-- <input type="button" value="Refresh" onclick="loadCart()"/> -->
643
							<input type="button" value="Remove all" onclick="clearCart(); loadCart()"/>
644
						<%
645
							} else {
646
						%>
647
							(<a target="_top" href="<%=STYLE_SKINS_URL%>/semtools/login.jsp">Login</a> to edit cart)
648
						<%
649
							}
650
						%>
639 651
						</p>
640 652
					</th>
641 653
				</tr>
lib/style/skins/semtools/login.jsp
1
<%@ page language="java"%>
2
<%
3
	 /**
4
	 * 
5
	 * '$RCSfile$'
6
	 * Copyright: 2008 Regents of the University of California and the
7
	 *             National Center for Ecological Analysis and Synthesis
8
	 *    '$Author: leinfelder $'
9
	 *      '$Date: 2008-09-25 16:11:55 -0700 (Thu, 25 Sep 2008) $'
10
	 * '$Revision: 4393 $'
11
	 * 
12
	 * This program is free software; you can redistribute it and/or modify
13
	 * it under the terms of the GNU General Public License as published by
14
	 * the Free Software Foundation; either version 2 of the License, or
15
	 * (at your option) any later version.
16
	 * 
17
	 * This program is distributed in the hope that it will be useful,
18
	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
	 * GNU General Public License for more details.
21
	
22
	 * You should have received a copy of the GNU General Public License
23
	 * along with this program; if not, write to the Free Software
24
	 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
	 */
26
%>
27

  
28
<%@ include file="../../common/common-settings.jsp"%>
29
<%@ include file="../../common/configure-check.jsp"%>
30

  
31
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
32
<html>
33
<head>
34
<title>Semtools Login</title>
35
<link rel="stylesheet" type="text/css" href="<%=STYLE_SKINS_URL%>/semtools/semtools.css">
36
<link rel="stylesheet" type="text/css" href="<%=STYLE_COMMON_URL%>/jquery/jqueryui/css/smoothness/jquery-ui-1.8.6.custom.css">
37

  
38
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/jquery/jquery.js"></script>
39
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/jquery/jsTree/_lib/jquery.cookie.js"></script>
40
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/jquery/jsTree/jquery.jstree.js"></script>
41
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/jquery/jqueryui/js/jquery-ui-1.8.6.custom.min.js"></script>
42
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/jquery/busy/jquery.busy.js"></script>
43

  
44
<script language="javascript" type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/search.js"></script>
45
<script language="javascript" type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/semtools.js"></script>
46
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/branding.js"></script>
47
<script language="Javascript">
48
function submitform(formObj) {
49

  
50
	if (trim(formObj.elements["loginAction"].value)!="Login") {
51
		return true;
52
	}
53
	
54
	//trim username & passwd:
55
	var username = trim(formObj.elements["uid"].value);
56
	var organization  = trim(formObj.elements["organization"].value);
57
	var password      = trim(formObj.elements["password"].value);
58
	
59
	if (username=="") {
60
		alert("You must type a username. \n");
61
		formObj.elements["uid"].focus();
62
		return false;
63
	}
64
	
65
	if (organization=="") {
66
		alert("You must select an organization. \n");
67
		formObj.elements["organization"].focus();
68
		return false;
69
	}
70
	
71
	if (password=="") {
72
		alert("You must type a password. \n");
73
		formObj.elements["password"].focus();
74
		return false;
75
	}
76
	
77
	formObj.username.value="uid="+formObj.elements["uid"].value+",o="+formObj.elements["organization"].value+",dc=ecoinformatics,dc=org";
78
	return true;
79
}
80

  
81
function trim(stringToTrim) {
82
	return stringToTrim.replace(/^\s*/, '').replace(/\s*$/,'');
83
}
84
</script>
85
</head>
86
<body>
87
<script language="JavaScript">
88
          insertTemplateOpening("<%=CONTEXT_URL%>");
89
          insertSearchBox("<%=CONTEXT_URL%>");
90
      </script>
91

  
92
<table class="group group_border onehundred_percent" border="0" cellpadding="0">
93
	<tr>
94
		<th colspan="1">Login</th>
95
	</tr>
96
	<tr>
97
		<td>
98
			<p>
99
				Please login by entering your username, affiliation and password. Only registered users will be able to access the data cart.
100
			</p>
101
		</td>
102
	</tr>
103
	<tr>
104
		<td>
105
			<form name="loginform" id="loginform" method="post"
106
				action="<%=SERVLET_URL%>" target="_top"
107
				onsubmit="return submitform(this);">
108
				<input type="hidden" name="action" value="login" />
109
				<input type="hidden" name="username" value="" /> 
110
				<input type="hidden" name="qformat" value="semtools" />
111
	
112
			<table>
113
				<tr valign="middle">
114
					<td align="left" valign="middle" class="text_plain">Username:</td>
115
	
116
					<td width="173" align="right" class="text_plain"
117
						style="padding-top: 2px; padding-bottom: 2px;">
118
						<input name="uid" type="text" style="width: 140px;" value=""></td>
119
				</tr>
120
	
121
				<tr valign="middle">
122
					<td height="28" align="left" valign="middle" class="text_plain">Organization:</td>
123
	
124
					<td align="right" class="text_plain"
125
						style="padding-top: 2px; padding-bottom: 2px;">
126
						<select name="organization" style="width: 140px;">
127
							<option value="" selected>&#8212; choose one &#8212;</option>
128
							<option value="NCEAS">NCEAS</option>
129
							<option value="MSU">MSU</option>
130
							<option value="LTER">LTER</option>
131
							<option value="UCNRS">UCNRS</option>
132
							<option value="PISCO">PISCO</option>
133
							<option value="OBFS">OBFS</option>
134
							<option value="OSUBS">OSUBS</option>
135
							<option value="SAEON">SAEON</option>
136
							<option value="SANParks">SANParks</option>
137
							<option value="SDSC">SDSC</option>
138
							<option value="KU">KU</option>
139
							<option value="unaffiliated">unaffiliated</option>
140
						</select>
141
					</td>
142
				</tr>
143
	
144
				<tr valign="middle">
145
					<td width="85" align="left" valign="middle" class="text_plain">Password:</td>
146
	
147
					<td width="150" align="right">
148
						<input name="password" type="password" maxlength="50" style="width: 140px;" value="">
149
					</td>
150
				</tr>
151
				<tr>
152
					<td colspan="2" align=right class="buttonBG_login">
153
						<input type="submit" name="loginAction" value="Login" class="button_login">
154
					</td>
155
				</tr>
156
			</table>
157
			</form>
158
		</td>
159
	</tr>
160
</table>
161

  
162
<script language="JavaScript">          
163
    insertTemplateClosing("<%=CONTEXT_URL%>");
164
</script>
165
</body>
166
</html>
0 167

  
lib/style/skins/semtools/semtools.xml
1 1
<?xml version="1.0"?>
2 2
<style-set name="semtools">
3
<!-- general login & search -->
4
  <default-style>/style/common/ascii-treeview.xsl</default-style>
3
	<!-- general login & search -->
4
	<default-style>/style/common/ascii-treeview.xsl</default-style>
5 5

  
6
  <doctype publicid="-//NCEAS//resultset//EN">
7
    <target publicid="-//W3C//HTML//EN">/style/skins/semtools/resultset.xsl</target>
8
  </doctype>
6
	<doctype publicid="-//NCEAS//resultset//EN">
7
	  <target publicid="-//W3C//HTML//EN">/style/skins/semtools/resultset.xsl</target>
8
	</doctype>
9 9
  
10 10
  	<doctype publicid="-//NCEAS//log//EN">
11 11
		<target publicid="-//W3C//HTML//EN">/style/common/log.xsl</target>
12 12
	</doctype>
13
	
14
	<!-- login -->
15
	<doctype publicid="-//NCEAS//login//EN">
16
	  <target publicid="-//W3C//HTML//EN">/style/skins/semtools/login.xsl</target>
17
	</doctype>
13 18
  
14
  <!-- Annotation rendering -->  
15
  <doctype publicid="http://ecoinformatics.org/sms/annotation.0.9">
16
    <target publicid="-//W3C//HTML//EN">/style/skins/semtools/annotation.xsl</target>
17
  </doctype>
19
	<!-- Annotation rendering -->  
20
	<doctype publicid="http://ecoinformatics.org/sms/annotation.0.9">
21
	  <target publicid="-//W3C//HTML//EN">/style/skins/semtools/annotation.xsl</target>
22
	</doctype>
18 23

  
19
<!-- eml-2.1.1 modules -->
20
  <doctype publicid="eml://ecoinformatics.org/eml-2.1.1">
21
    <target publicid="-//W3C//HTML//EN">/style/skins/semtools/semtools.xsl</target>
22
  </doctype>  
23
<!-- eml-2.1.0 modules -->
24
  <doctype publicid="eml://ecoinformatics.org/eml-2.1.0">
25
    <target publicid="-//W3C//HTML//EN">/style/skins/semtools/semtools.xsl</target>
26
  </doctype>
24
	<!-- eml-2.1.1 modules -->
25
	<doctype publicid="eml://ecoinformatics.org/eml-2.1.1">
26
	  <target publicid="-//W3C//HTML//EN">/style/skins/semtools/semtools.xsl</target>
27
	</doctype>  
28
	<!-- eml-2.1.0 modules -->
29
	<doctype publicid="eml://ecoinformatics.org/eml-2.1.0">
30
	  <target publicid="-//W3C//HTML//EN">/style/skins/semtools/semtools.xsl</target>
31
	</doctype>
27 32

  
28
<!-- eml-2.0.1 modules -->
29
  <doctype publicid="eml://ecoinformatics.org/eml-2.0.1">
30
    <target publicid="-//W3C//HTML//EN">/style/skins/semtools/semtools.xsl</target>
31
  </doctype>
33
	<!-- eml-2.0.1 modules -->
34
	<doctype publicid="eml://ecoinformatics.org/eml-2.0.1">
35
	  <target publicid="-//W3C//HTML//EN">/style/skins/semtools/semtools.xsl</target>
36
	</doctype>
32 37

  
33
<!-- eml-2.0.0 modules -->
34
  <doctype publicid="eml://ecoinformatics.org/eml-2.0.0">
35
    <!-- target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.1/eml.xsl</target -->
36
    <target publicid="-//W3C//HTML//EN">/style/skins/semtools/semtools.xsl</target>
37
  </doctype>
38
	<!-- eml-2.0.0 modules -->
39
	<doctype publicid="eml://ecoinformatics.org/eml-2.0.0">
40
	  <target publicid="-//W3C//HTML//EN">/style/skins/semtools/semtools.xsl</target>
41
	</doctype>
42
	  
43
	<!-- eml-2.0.0beta6 modules -->
44
	<doctype publicid="-//ecoinformatics.org//eml-access-2.0.0beta6//EN">
45
	  <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-access-2.0.0beta6.xsl</target>
46
	</doctype>
47
	<doctype publicid="-//ecoinformatics.org//eml-attribute-2.0.0beta6//EN">
48
	  <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-attribute-2.0.0beta6.xsl</target>
49
	</doctype>
50
	<doctype publicid="-//ecoinformatics.org//eml-constraint-2.0.0beta6//EN">
51
	  <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-constraint-2.0.0beta6.xsl</target>
52
	</doctype>
53
	<doctype publicid="-//ecoinformatics.org//eml-coverage-2.0.0beta6//EN">
54
	  <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-coverage-2.0.0beta6.xsl</target>
55
	</doctype>
56
	<doctype publicid="-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN">
57
	  <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-dataset-2.0.0beta6.xsl</target>
58
	</doctype>
59
	<doctype publicid="-//ecoinformatics.org//eml-entity-2.0.0beta6//EN">
60
	  <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-entity-2.0.0beta6.xsl</target>
61
	</doctype>
62
	<doctype publicid="-//ecoinformatics.org//eml-literature-2.0.0beta6//EN">
63
	  <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-literature-2.0.0beta6.xsl</target>
64
	</doctype>
65
	<doctype publicid="-//ecoinformatics.org//eml-physical-2.0.0beta6//EN">
66
	  <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-physical-2.0.0beta6.xsl</target>
67
	</doctype>
68
	<doctype publicid="-//ecoinformatics.org//eml-project-2.0.0beta6//EN">
69
	  <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-project-2.0.0beta6.xsl</target>
70
	</doctype>
71
	<doctype publicid="-//ecoinformatics.org//eml-protocol-2.0.0beta6//EN">
72
	  <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-protocol-2.0.0beta6.xsl</target>
73
	</doctype>
74
	<doctype publicid="-//ecoinformatics.org//eml-software-2.0.0beta6//EN">
75
	  <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-software-2.0.0beta6.xsl</target>
76
	</doctype>
38 77
  
39
<!-- eml-2.0.0beta6 modules -->
40
  <doctype publicid="-//ecoinformatics.org//eml-access-2.0.0beta6//EN">
41
    <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-access-2.0.0beta6.xsl</target>
42
  </doctype>
43
  <doctype publicid="-//ecoinformatics.org//eml-attribute-2.0.0beta6//EN">
44
    <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-attribute-2.0.0beta6.xsl</target>
45
  </doctype>
46
  <doctype publicid="-//ecoinformatics.org//eml-constraint-2.0.0beta6//EN">
47
    <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-constraint-2.0.0beta6.xsl</target>
48
  </doctype>
49
  <doctype publicid="-//ecoinformatics.org//eml-coverage-2.0.0beta6//EN">
50
    <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-coverage-2.0.0beta6.xsl</target>
51
  </doctype>
52
  <doctype publicid="-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN">
53
    <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-dataset-2.0.0beta6.xsl</target>
54
  </doctype>
55
  <doctype publicid="-//ecoinformatics.org//eml-entity-2.0.0beta6//EN">
56
    <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-entity-2.0.0beta6.xsl</target>
57
  </doctype>
58
  <doctype publicid="-//ecoinformatics.org//eml-literature-2.0.0beta6//EN">
59
    <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-literature-2.0.0beta6.xsl</target>
60
  </doctype>
61
  <doctype publicid="-//ecoinformatics.org//eml-physical-2.0.0beta6//EN">
62
    <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-physical-2.0.0beta6.xsl</target>
63
  </doctype>
64
  <doctype publicid="-//ecoinformatics.org//eml-project-2.0.0beta6//EN">
65
    <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-project-2.0.0beta6.xsl</target>
66
  </doctype>
67
  <doctype publicid="-//ecoinformatics.org//eml-protocol-2.0.0beta6//EN">
68
    <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-protocol-2.0.0beta6.xsl</target>
69
  </doctype>
70
  <doctype publicid="-//ecoinformatics.org//eml-software-2.0.0beta6//EN">
71
    <target publicid="-//W3C//HTML//EN">/style/common/eml-2.0.0beta6/eml-software-2.0.0beta6.xsl</target>
72
  </doctype>
73
  
74 78
</style-set>
lib/style/skins/semtools/login.xsl
1
<?xml version="1.0"?>
2
<!--
3
	*  '$RCSfile$'
4
	*      Authors: Jivka Bojilova
5
	*    Copyright: 2000 Regents of the University of California and the
6
	*               National Center for Ecological Analysis and Synthesis
7
	*  For Details: http://www.nceas.ucsb.edu/
8
	*
9
	*   '$Author: leinfelder $'
10
	*     '$Date: 2008-06-17 13:29:31 -0700 (Tue, 17 Jun 2008) $'
11
	* '$Revision: 4007 $'
12
	* 
13
	* This program is free software; you can redistribute it and/or modify
14
	* it under the terms of the GNU General Public License as published by
15
	* the Free Software Foundation; either version 2 of the License, or
16
	* (at your option) any later version.
17
	*
18
	* This program is distributed in the hope that it will be useful,
19
	* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
	* GNU General Public License for more details.
22
	*
23
	* You should have received a copy of the GNU General Public License
24
	* along with this program; if not, write to the Free Software
25
	* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
	*
27
	* This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
28
	* convert an XML file with information about login action
29
	* into an HTML format suitable for rendering with modern web browsers.
30
-->
31

  
32
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
33

  
34
	<xsl:output method="html" />
35
	<xsl:param name="qformat">default</xsl:param>
36
	<xsl:param name="contextURL" />
37
	<xsl:param name="cgi-prefix" />
38

  
39
	<xsl:template match="/">
40
		<html>
41
			<head>
42
				<link rel="stylesheet" type="text/css"
43
					href="{$contextURL}/style/skins/{$qformat}/{$qformat}.css" />
44
				<script language="Javascript" type="text/JavaScript"
45
					src="{$contextURL}/style/skins/{$qformat}/{$qformat}.js" />
46
				<script language="Javascript" type="text/JavaScript"
47
					src="{$contextURL}/style/common/branding.js" />
48
				<script language="JavaScript">
49
					<![CDATA[
50
					function search(url){
51
						location.href = url;
52
       				}]]>
53
				</script>
54
			</head>
55

  
56
			<script language="JavaScript">
57
				<![CDATA[
58
				insertTemplateOpening("]]><xsl:value-of select="$contextURL" /><![CDATA[");
59
          		insertSearchBox("]]><xsl:value-of select="$contextURL" /><![CDATA[");
60
          		]]>
61
			</script>
62
			
63
			<body>
64
				<table width="100%" border="0" cellspacing="20" cellpadding="0">					
65
					<tr>
66
						<th>
67
							Login
68
						</th>
69
					</tr>
70
					
71
					<xsl:choose>
72
						<xsl:when test="count(login) &gt; 0">
73
							<tr>
74
								<td>
75
									<script language="JavaScript">
76
										<![CDATA[timerId=setTimeout(search(']]><xsl:value-of select="$contextURL" /><![CDATA[/style/skins/]]><xsl:value-of select="$qformat" /><![CDATA['), 2000);]]>
77
									</script>
78
									<p class="text_plain">
79
										Welcome <xsl:value-of select="login/name" />. 
80
										You will be automatically redirected to the search page.
81
									</p>
82
								</td>
83
							</tr>		
84
						</xsl:when>
85
						<xsl:otherwise>
86
							<xsl:if test="count(unauth_login) &gt; 0">
87
								<tr>
88
									<td>
89
										<p class="text_plain">
90
											<xsl:value-of select="unauth_login/message" />
91
										</p>
92
									</td>
93
								</tr>	
94
							</xsl:if>
95
							<tr>
96
								<td>
97
									<p class="text_plain">
98
										Return to the
99
										<a href="{$contextURL}/style/skins/{$qformat}/login.jsp" target="_top">login page</a>.
100
									</p>
101
								</td>
102
							</tr>		
103
						</xsl:otherwise>
104
					</xsl:choose>	
105
				</table>
106
			</body>
107
			
108
			<script language="JavaScript">
109
				<![CDATA[
110
				insertTemplateClosing("]]><xsl:value-of select="$contextURL" /><![CDATA[");
111
				]]>
112
			</script>
113
		</html>
114
	</xsl:template>
115

  
116
</xsl:stylesheet>
0 117

  

Also available in: Unified diff