Project

General

Profile

metacat / lib / style / skins / first / index.jsp @ 5067

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: 2009-09-21 12:41:21 -0700 (Mon, 21 Sep 2009) $'
10
 * '$Revision: 5061 $'
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>FIRST Assessment Metadata Repository</title>
35
<link rel="stylesheet" type="text/css"
36
	href="<%=STYLE_SKINS_URL%>/first/first.css">
37
<script language="JavaScript" type="text/JavaScript"
38
	src="<%=STYLE_SKINS_URL%>/first/first.js"></script>
39
<script language="JavaScript" type="text/JavaScript"
40
	src="<%=STYLE_SKINS_URL%>/first/search.js"></script>
41
<script language="JavaScript" type="text/JavaScript"
42
	src="<%=STYLE_COMMON_URL%>/branding.js"></script>
43
<script language="Javascript" type="text/JavaScript"
44
	src="<%=STYLE_COMMON_URL%>/prototype-1.5.1.1/prototype.js">
45
</script>
46
<script language="Javascript" type="text/JavaScript"
47
	src="<%=STYLE_COMMON_URL%>/effects.js">
48
</script>
49
<script language="Javascript">
50

    
51
		function browseAll() {
52
			document.getElementById("searchBox").value = "%";
53
			document.getElementById("includeItems").checked = false;
54
			searchAssessments(false);
55
		}
56
		
57
		function searchAssessments(includeItems) {
58
			var searchString = document.getElementById("searchBox").value;
59
			var institution = document.getElementById("institution").value;
60
			var instructor = document.getElementById("instructor").value;
61
			var course = document.getElementById("course").value;
62
			var year = document.getElementById("year").value;
63
			var otherField = document.getElementById("otherField").value;
64
			var otherValue = document.getElementById("otherValue").value;
65
			//keywords
66
			//var keywordThesaurus1 = document.getElementById("keywordThesaurus1").value;
67
			var keyword1 = document.getElementById("keyword1").value;
68

    
69
			
70
			var searchTerms = new Object();
71
			searchTerms["anyValue"] = searchString;
72
			searchTerms["institution/organizationName"] = institution;
73
			searchTerms["instructor/individualName/surName"] = instructor;
74
			searchTerms["course/lom/general/title/string"] = course;
75
			searchTerms["course/year"] = year;
76
			searchTerms[otherField] = otherValue;
77
			//TODO: implement thesaurus matching (compound INTERSECTION)
78
			searchTerms["keyword"] = keyword1;
79
			searchTerms["fieldentry"] = keyword1;
80
			
81
			var operator = "UNION";
82
			if (document.getElementById("all").checked) {
83
				operator = "INTERSECT";
84
			}
85
			if (document.getElementById("includeItems").checked) {
86
				includeItems = true;
87
			} else {
88
				includeItems = false;
89
			}
90
			
91
			var metacatURL = "<%=CONTEXT_URL%>/metacat";
92
			
93
			//generate the query for items
94
			var itemQueryString = 
95
				generateSearchString(
96
					searchTerms,
97
					null,
98
					operator,
99
					false, 
100
					true);
101
			
102
			//alert("itemQueryString=" + itemQueryString);
103

    
104
			loadAssessments = function(transport) {
105
				
106
				//harvest the itemIds
107
				var itemIds = new Object();
108
				var itemIdForm = document.getElementById("itemIdForm");
109
				if (itemIdForm) {
110
					var itemIdObj = itemIdForm.itemIds;
111
					//alert("itemIdObj=" + itemIdObj);
112

    
113
					if (itemIdObj.length > 1) {
114
						for (var i=0; i < itemIdObj.length; i++) {
115
							itemIds[i] = itemIdObj[i].value;
116
						}
117
					} else {
118
						itemIds[0] = itemIdObj.value;
119
					}
120
				}
121
				
122
				//generate the assessment query with item ids included
123
				var queryString = 
124
					generateSearchString(
125
							searchTerms,
126
							itemIds,
127
							operator,
128
							true, 
129
							false);
130
	
131
				//alert("queryString=" + queryString);
132
	
133
				//load the assessments
134
				callAjax(metacatURL, queryString, "first-assessment", "ajaxSearchResults", null);
135
				Effect.Appear('ajaxSearchResults', {duration: 1.5});
136
			};
137

    
138
			//do we search using the items or not?
139
			if (includeItems) {
140
				//load the items (which calls the function above)
141
				callAjax(metacatURL, itemQueryString, "first-item", "itemSearchResults", loadAssessments);
142
			} else {
143
				//generate the assessment query with item ids included
144
				var queryString = 
145
					generateSearchString(
146
							searchTerms,
147
							null,
148
							operator,
149
							true, 
150
							false);
151
				// just load the assessments
152
				callAjax(metacatURL, queryString, "first-assessment", "ajaxSearchResults", null);
153
				Effect.Appear('ajaxSearchResults', {duration: 1.5});
154
			}	
155
		}
156
   </script>
157
</head>
158
<body>
159
<script language="JavaScript">
160
          insertTemplateOpening("<%=CONTEXT_URL%>");
161
          insertSearchBox("<%=CONTEXT_URL%>");
162
      </script>
163

    
164
<table width="100%" border="0" cellspacing="20" cellpadding="0">
165
	<tr>
166
		<th colspan="2">
167
			Search
168
		</th>
169
	</tr>		
170
	<tr>
171
		<td>
172
			<form method="POST" action="<%=SERVLET_URL%>" target="_top" id="searchForm">
173
			
174
			<table class="tables" cellpadding="8" cellspacing="0">
175
				<tr class="sectheader">
176

    
177
					<td class="borderbottom" align="left" colspan="2">
178
						Any field:
179
						<input size="30" name="searchstring" type="text" value="" id="searchBox">
180
					</td>
181

    
182
				</tr>
183
				<tr>
184
					<td valign="top" align="left" class="borderbottom">
185
							
186
						<input name="query" type="hidden"> 
187
						<input name="qformat" value="first" type="hidden"> 
188
						<input type="hidden" name="action" value="squery"> 								
189
						
190
						<table>
191
							<tr>
192
								<td>Institution: </td>
193
								<td><input name="institution" id="institution" type="text" size="14"/></td>
194
							</tr>
195
							<tr>
196
								<td>Course: </td>
197
								<td><input name="course" id="course" type="text" size="14"/></td>
198
							</tr>
199
							<tr>
200
								<td>Instructor: </td>
201
								<td><input name="instructor" id="instructor" type="text" size="14"/></td>
202
							</tr>
203
							<tr>
204
								<td>Year: </td>
205
								<td><input name="year" id="year" type="text" size="4"/></td>
206
							</tr>
207
							
208
						</table>
209
					</td>
210
					<td valign="top" class="borderbottom">
211
						<table>
212
							<tr>
213
								<td>
214
									<select id="otherField" name="otherField">
215
										<option value="assessment/title">Assessment Title</option>
216
										<option value="assessment/type">Assessment Type</option>
217
										<option value="assessment/duration">Assessment Duration</option>
218
										<option value="assessment/grading/@group">Group Grading</option>
219
										<option value="assessment/grading/@size">Group Size</option>
220
										<option value="assessment/grading">Group Grading Approach</option>
221

    
222
										<option value="course/lom/general/identifier/entry">Course Id</option>
223
										<option value="course/lom/general/title/string">Course Title</option>
224
										<option value="course/lom/general/description/string">Course Description</option>
225
										<option value="course/term">Course Term</option>
226
										<option value="course/year">Course Year</option>
227
										<option value="course/coverage/rangeOfDates/beginDate/calendarDate">Course Start Date</option>
228
										<option value="course/coverage/rangeOfDates/endDate/calendarDate">Course End Date</option>
229

    
230
										<option value="institution/organizationName">Institution Name</option>
231
										<option value="instructor/individualName/surName">Instructor Surname</option>
232
										<option value="instructor/organizationName">Instructor Organization</option>
233

    
234
									</select>
235
								</td>
236
								<td><input name="otherValue" id="otherValue" type="text" size="14"/></td>
237
							</tr>
238
							<tr>
239
								<td>
240
									Keyword:
241
								</td>
242
								<td><input name="keyword1" id="keyword1" type="text" size="14"/></td>
243
							</tr>
244
							
245
						</table>
246
					</td>
247
				</tr>
248
				<tr>
249
					<td valign="top" class="borderbottom">
250
						<table>
251
							<tr>
252
								<td nowrap="nowrap">
253
									<input name="anyAll" id="any" value="UNION" type="radio" checked="checked"/>
254
								</td>
255
								<td nowrap="nowrap">Match any</td>
256
							</tr>
257
							<tr>		
258
								<td nowrap="nowrap">
259
									<input name="anyAll" id="all" value="INTERSECT" type="radio"/>
260
								</td>	
261
								<td nowrap="nowrap">Match all</td>
262
							</tr>
263
							<tr>		
264
								<td nowrap="nowrap">
265
									<input name="includeItems" id="includeItems" checked="checked" type="checkbox"/>
266
								</td>	
267
								<td nowrap="nowrap">Search across Items</td>
268
							</tr>
269
						</table>
270
					</td>
271
					<td valign="bottom" class="borderbottom">
272
						<table>
273
							<tr>
274
								<td colspan="2">
275
									<input type="button" onclick="javascript:searchAssessments(true)" value="Search"/>
276
								</td>
277
							</tr>
278
						</table>
279
					</td>
280
				</tr>
281
			</table>
282
			</form>
283
			
284
		</td>
285
		<td colspan="1" valign="top">
286
			<div align="left">
287
				<p align="left">This tool allows you to search for Assessments either by keyword,
288
				or with a structured search that targets particular facets of an assessment.
289
				<br />
290
				<br />
291
				You can use the '%' character as a wildcard in your searches (e.g.,
292
				'%biology%' would locate any phrase with the word biology embedded within it).
293
				</p>
294
				<a href="javascript:browseAll()">Browse All Assessments...</a>
295
			</div>
296
		</td>
297
	</tr>
298
	<tr>
299
		<td valign="top" colspan="2">	
300
			<div id="ajaxSearchResults" style="display:none;">
301
				Loading search results 
302
				<img src="<%=CONTEXT_URL%>/style/images/spinner.gif" border="none"/>
303
			</div>
304
		</td>
305
	</tr>
306
	<tr>
307
		<td valign="top" colspan="2">	
308
			<div id="itemSearchResults" style="display:none;">
309
				Loading Assessment Item results 
310
				<img src="<%=CONTEXT_URL%>/style/images/spinner.gif" border="none"/>
311
			</div>
312
		</td>
313
	</tr>
314
</table>
315

    
316
<script language="JavaScript">          
317
    insertTemplateClosing("<%=CONTEXT_URL%>");
318
</script>
319
</body>
320
</html>