Revision 5058
Added by ben leinfelder about 15 years ago
index.jsp | ||
---|---|---|
50 | 50 |
|
51 | 51 |
function browseAll() { |
52 | 52 |
document.getElementById("searchBox").value = "%"; |
53 |
searchAssessments(); |
|
53 |
searchAssessments(false);
|
|
54 | 54 |
} |
55 | 55 |
|
56 |
function searchAssessments() { |
|
56 |
function searchAssessments(includeItems) {
|
|
57 | 57 |
var searchString = document.getElementById("searchBox").value; |
58 | 58 |
var institution = document.getElementById("institution").value; |
59 | 59 |
var instructor = document.getElementById("instructor").value; |
... | ... | |
80 | 80 |
if (document.getElementById("all").checked) { |
81 | 81 |
operator = "INTERSECT"; |
82 | 82 |
} |
83 |
if (document.getElementById("includeItems").checked) { |
|
84 |
includeItems = true; |
|
85 |
} else { |
|
86 |
includeItems = false; |
|
87 |
} |
|
83 | 88 |
|
84 | 89 |
var metacatURL = "<%=CONTEXT_URL%>/metacat"; |
85 | 90 |
|
86 |
//generate the query |
|
87 |
var queryString =
|
|
91 |
//generate the query for items
|
|
92 |
var itemQueryString =
|
|
88 | 93 |
generateSearchString( |
89 | 94 |
searchTerms, |
95 |
null, |
|
90 | 96 |
operator, |
91 |
true,
|
|
92 |
false);
|
|
97 |
false,
|
|
98 |
true);
|
|
93 | 99 |
|
94 |
//alert("queryString=" + queryString); |
|
95 |
|
|
96 |
callAjax(metacatURL, queryString, "first-assessment", "ajaxSearchResults"); |
|
97 |
|
|
98 |
Effect.Appear('ajaxSearchResults', {duration: 1.5}); |
|
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 |
} |
|
99 | 153 |
} |
100 | 154 |
</script> |
101 | 155 |
</head> |
... | ... | |
221 | 275 |
</td> |
222 | 276 |
<td nowrap="nowrap">Match all</td> |
223 | 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> |
|
224 | 284 |
</table> |
225 | 285 |
</td> |
226 | 286 |
<td valign="bottom" class="borderbottom"> |
227 | 287 |
<table> |
228 | 288 |
<tr> |
229 | 289 |
<td colspan="2"> |
230 |
<input type="button" onclick="javascript:searchAssessments()" value="Search"/> |
|
290 |
<input type="button" onclick="javascript:searchAssessments(true)" value="Search"/>
|
|
231 | 291 |
</td> |
232 | 292 |
</tr> |
233 | 293 |
</table> |
... | ... | |
258 | 318 |
</div> |
259 | 319 |
</td> |
260 | 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> |
|
261 | 329 |
</table> |
262 | 330 |
|
263 | 331 |
<script language="JavaScript"> |
Also available in: Unified diff
search across items as well as assessments
http://bugzilla.ecoinformatics.org/show_bug.cgi?id=4387
note: you can switch this feature off using the checkbox provided in the search form. the search can be slow otherwise