Project

General

Profile

« Previous | Next » 

Revision 4398

add login feature for first. integrates with existing metacat-skin-based login approach.
only show cart for authenticated users.

View differences:

header.jsp
75 75
						Search	
76 76
						</a>
77 77
					</td>
78
					<!--
79 78
					<td valign="top">
80
						<p><a href="http://www.first2.org" target=_top">FIRST Site</a></p>
81
					</td>
82
					-->
83
					<td valign="top">
84 79
						<p><a href="about.jsp" target="_top">About</a></p>
85 80
					</td>
86 81
					<td>
87 82
						<%
88
						String[] docids = 
89
							SessionService.getRegisteredSession(request.getSession().getId()).getDocumentCart().getDocids();
90
						Map fields = 
91
							SessionService.getRegisteredSession(request.getSession().getId()).getDocumentCart().getFields();
83
						boolean loggedIn = SessionService.isSessionRegistered(request.getSession().getId());
84
						String[] docids = null;
85
						Map fields = null;
86
						if (loggedIn) {
87
							docids = 
88
								SessionService.getRegisteredSession(request.getSession().getId()).getDocumentCart().getDocids();
89
							fields = 
90
								SessionService.getRegisteredSession(request.getSession().getId()).getDocumentCart().getFields();
91
							%>
92
							<div id="importantThings">
93
								<a href="cart.jsp" target="_top">
94
									Cart 
95
								</a>
96
								(Items: <%=docids.length %>, Fields: <%=fields.size() %>)
97
							</div>
98
							<!-- for use when downloading merged data -->
99
							<div style="display:none;">
100
								<form id='fieldForm'>
101
									<%
102
									if (loggedIn) {
103
										Iterator fieldIter =  fields.keySet().iterator();
104
										while (fieldIter.hasNext()) {
105
											String key = (String) fieldIter.next();
106
											String value = (String) fields.get(key);
107
										%>
108
											<input type="hidden" name="<%=key %>" value="<%=value %>" />
109
										<%	
110
										}
111
									}	
112
									%>
113
								</form>
114
							</div>
115
						<%	
116
						}
117
						else {
92 118
						%>
93
						<div id="importantThings">
94
							<a href="cart.jsp" target="_top">
95
								Cart 
96
							</a>	
97
							
98
							(Items: <%=docids.length %>, Fields: <%=fields.size() %>)
99
						</div>
119
							<a href="login.jsp" target="_top">Login</a>
120
						<%	
121
						}
122
						%>						
100 123
					</td>
101 124
				</tr>
102 125
				<tr>
103 126
					<td colspan="3">
104
						<!-- for use when downloading merged data -->
105
						<form id='fieldForm'>
106
						<%
107
						Iterator fieldIter =  fields.keySet().iterator();
108
						while (fieldIter.hasNext()) {
109
							String key = (String) fieldIter.next();
110
							String value = (String) fields.get(key);
111
						%>
112
							<input type="hidden" name="<%=key %>" value="<%=value %>" />
113
						<%	
114
						}
115
						%>	
116
						</form>
127
						
117 128
					</td>
118 129
				</tr>
119 130
			</table>

Also available in: Unified diff