Project

General

Profile

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:38:47 -0700 (Mon, 21 Sep 2009) $'
10
 * '$Revision: 5060 $'
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
			searchAssessments(false);
54
		}
55
		
56
		function searchAssessments(includeItems) {
57
			var searchString = document.getElementById("searchBox").value;
58
			var institution = document.getElementById("institution").value;
59
			var instructor = document.getElementById("instructor").value;
60
			var course = document.getElementById("course").value;
61
			var year = document.getElementById("year").value;
62
			var otherField = document.getElementById("otherField").value;
63
			var otherValue = document.getElementById("otherValue").value;
64
			//keywords
65
			//var keywordThesaurus1 = document.getElementById("keywordThesaurus1").value;
66
			var keyword1 = document.getElementById("keyword1").value;
67

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

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

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

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

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

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

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

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

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

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

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