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-18 16:53:09 -0700 (Fri, 18 Sep 2009) $'
10
 * '$Revision: 5058 $'
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
			
79
			var operator = "UNION";
80
			if (document.getElementById("all").checked) {
81
				operator = "INTERSECT";
82
			}
83
			if (document.getElementById("includeItems").checked) {
84
				includeItems = true;
85
			} else {
86
				includeItems = false;
87
			}
88
			
89
			var metacatURL = "<%=CONTEXT_URL%>/metacat";
90
			
91
			//generate the query for items
92
			var itemQueryString = 
93
				generateSearchString(
94
					searchTerms,
95
					null,
96
					operator,
97
					false, 
98
					true);
99
			
100
			//alert("itemQueryString=" + itemQueryString);
101

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

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

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

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

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

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

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

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

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

    
331
<script language="JavaScript">          
332
    insertTemplateClosing("<%=CONTEXT_URL%>");
333
</script>
334
</body>
335
</html>
(17-17/22)