Revision 4290
Added by ben leinfelder about 16 years ago
index.jsp | ||
---|---|---|
37 | 37 |
<script language="JavaScript" type="text/JavaScript" |
38 | 38 |
src="<%=STYLE_SKINS_URL%>/first/first.js"></script> |
39 | 39 |
<script language="JavaScript" type="text/JavaScript" |
40 |
src="<%=STYLE_SKINS_URL%>/first/search.js"></script> |
|
41 |
<script language="JavaScript" type="text/JavaScript" |
|
40 | 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> |
|
41 | 46 |
<script language="Javascript"> |
42 | 47 |
function trim(stringToTrim) { |
43 | 48 |
return stringToTrim.replace(/^\s*/, '').replace(/\s*$/,''); |
... | ... | |
64 | 69 |
} |
65 | 70 |
} |
66 | 71 |
|
72 |
//generate the query |
|
67 | 73 |
var queryString = |
68 |
"<pathquery version=\"1.2\">" |
|
69 |
+"<querytitle>Web-Search</querytitle>"; |
|
70 |
|
|
71 |
/** assessments **/ |
|
72 |
if (searchAssessmentsCheckBox.checked == true) { |
|
73 |
queryString += |
|
74 |
"<returndoctype>edml://ecoinformatics.org/edml</returndoctype>" |
|
75 |
|
|
76 |
//assessment fields |
|
77 |
+"<returnfield>assessment/duration</returnfield>" |
|
78 |
+"<returnfield>assessment/@title</returnfield>" |
|
79 |
+"<returnfield>assessment/@id</returnfield>" |
|
80 |
+"<returnfield>lom/general/title/string</returnfield>" |
|
81 |
+"<returnfield>lom/general/keyword/string</returnfield>" |
|
82 |
+"<returnfield>individualName/surName</returnfield>" |
|
83 |
+"<returnfield>organizationName</returnfield>"; |
|
84 |
} |
|
85 |
|
|
86 |
/** questions **/ |
|
87 |
if (searchQuestionsCheckBox.checked == true) { |
|
88 |
queryString += |
|
89 |
"<returndoctype>http://www.imsglobal.org/xsd/ims_qtiasiv1p2</returndoctype>" |
|
90 |
|
|
91 |
//question (qti) fields |
|
92 |
+"<returnfield>item/@title</returnfield>" |
|
93 |
+"<returnfield>item/@ident</returnfield>" |
|
94 |
+"<returnfield>qtimetadata/qtimetadatafield/fieldlabel</returnfield>" |
|
95 |
+"<returnfield>qtimetadata/qtimetadatafield/fieldentry</returnfield>" |
|
96 |
//classification |
|
97 |
+"<returnfield>fieldlabel</returnfield>" |
|
98 |
+"<returnfield>fieldentry</returnfield>" |
|
99 |
+"<returnfield>objectives/material/mattext</returnfield>" |
|
100 |
//question content |
|
101 |
+"<returnfield>presentation/flow/material/mattext</returnfield>" |
|
102 |
+"<returnfield>response_label/@ident</returnfield>" |
|
103 |
+"<returnfield>response_label/material/mattext</returnfield>"; |
|
104 |
} |
|
105 |
|
|
106 |
queryString += |
|
107 |
"<querygroup operator=\"UNION\">" |
|
108 |
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">" |
|
109 |
+"<value>" + searchString + "</value>" |
|
110 |
+"</queryterm>" |
|
111 |
+"</querygroup>" |
|
112 |
+"</pathquery>"; |
|
74 |
generateSearchString( |
|
75 |
searchString, |
|
76 |
searchAssessmentsCheckBox.checked, |
|
77 |
searchQuestionsCheckBox.checked); |
|
113 | 78 |
|
114 | 79 |
//set the form value |
115 | 80 |
submitFormObj.query.value = queryString; |
81 |
|
|
82 |
submitFormObj.qformat.value = "first"; |
|
83 |
|
|
116 | 84 |
//alert(submitFormObj.query.value); |
117 | 85 |
return true; |
118 | 86 |
} |
... | ... | |
129 | 97 |
submitFormObj.submit(); |
130 | 98 |
} |
131 | 99 |
} |
100 |
|
|
101 |
function searchAssessments(){ |
|
102 |
var searchString = document.getElementById("searchBox").value; |
|
103 |
var metacatURL = "<%=CONTEXT_URL%>/metacat"; |
|
104 |
|
|
105 |
//generate the query |
|
106 |
var queryString = |
|
107 |
generateSearchString( |
|
108 |
searchString, |
|
109 |
true, |
|
110 |
false); |
|
111 |
|
|
112 |
callAjax(metacatURL, queryString, "first-assessment"); |
|
113 |
} |
|
132 | 114 |
</script> |
133 | 115 |
</head> |
134 | 116 |
<body> |
... | ... | |
191 | 173 |
<input name="enableediting" value="false" type="hidden"> |
192 | 174 |
<input type="hidden" name="action" value="squery"> |
193 | 175 |
<input value="Search" type="submit"> |
176 |
<a href="javascript:searchAssessments()"> |
|
177 |
Dynamic Search |
|
178 |
</a> |
|
194 | 179 |
</span> |
195 | 180 |
</form> |
196 | 181 |
<form> |
... | ... | |
227 | 212 |
</td> |
228 | 213 |
</tr> |
229 | 214 |
</table> |
215 |
<div id="ajaxResults">Loading Search results...</div> |
|
230 | 216 |
<br /> |
231 | 217 |
<br /> |
232 | 218 |
|
Also available in: Unified diff
refactor search methods into common search.js file.
start on making ajax-based search from the index page.
state of things: now merging across assessments and including question-level metadata