Project

General

Profile

« Previous | Next » 

Revision 3550

include both assessments and questions in the results of a search (driven by option in search form)

View differences:

index.html
42 42

  
43 43
        function checkSearch(submitFormObj) {
44 44
			var searchString = trim(submitFormObj.searchstring.value);
45
 			var checkBox = document.getElementById("searchAll");
45
 			var searchAssessmentsCheckBox = document.getElementById("searchAssessments");
46
 			var searchQuestionsCheckBox = document.getElementById("searchQuestions");
46 47

  
48
			//check the doctype checkboxes for at least one
49
			if ( !(searchAssessmentsCheckBox.checked || searchQuestionsCheckBox.checked) ) {
50
				alert("Please select at least one item type for your search");
51
				searchAssessmentsCheckBox.focus();
52
				return false;
53
			}
54
			
47 55
			if (searchString=="") {
48
				if (confirm("Show *all* data?")) {
56
				if (confirm("No search terms were entered.\nContinue with a wildcardsearch?")) {
49 57
					searchString = "%";
50 58
				} 
51 59
				else {
52 60
          			return false;
53 61
				}
54 62
			}
55

  
56
			if(!checkBox.checked && searchString!="%"){
57
				submitFormObj.query.value = "<pathquery version=\"1.2\">"
58
                                                      +"<querytitle>Web-Search</querytitle>"
63
			
64
			var queryString = 
65
				"<pathquery version=\"1.2\">"
66
					+"<querytitle>Web-Search</querytitle>";
67
					
68
					/** assessments **/
69
					if (searchAssessmentsCheckBox.checked == true) {
70
						queryString +=
71
							"<returndoctype>edml://ecoinformatics.org/edml</returndoctype>"
72
							
73
							//assessment fields
74
			                +"<returnfield>assessment/duration</returnfield>"
75
			                +"<returnfield>assessment/@assessmentTitle</returnfield>"
76
			                +"<returnfield>assessment/@assessmentId</returnfield>"
77
			                +"<returnfield>lom/general/title/string</returnfield>"
78
			                +"<returnfield>lom/general/keyword/string</returnfield>"
79
			                +"<returnfield>individualName/surName</returnfield>"
80
			                +"<returnfield>organizationName</returnfield>";
81
					}
82
										
83
					/** questions **/
84
					if (searchQuestionsCheckBox.checked == true) {
85
						queryString +=
86
							"<returndoctype>http://www.imsglobal.org/xsd/ims_qtiasiv1p2</returndoctype>"
87
							
88
							//question (qti) fields
89
							+"<returnfield>item/@title</returnfield>"
90
							+"<returnfield>item/@ident</returnfield>"
91
			                +"<returnfield>qtimetadata/qtimetadatafield/fieldlabel</returnfield>"
92
			                +"<returnfield>qtimetadata/qtimetadatafield/fieldentry</returnfield>"
93
							//classification
94
							+"<returnfield>fieldlabel</returnfield>"
95
							+"<returnfield>fieldentry</returnfield>"
96
							+"<returnfield>objectives/material/mattext</returnfield>"
97
							//question content
98
							+"<returnfield>presentation/flow/material/mattext</returnfield>"
99
							+"<returnfield>response_label/@ident</returnfield>"
100
							+"<returnfield>response_label/flow_mat/material/mattext</returnfield>";
101
					}		
59 102
                                                      
60
                                                      +"<returndoctype>edml://ecoinformatics.org/edml</returndoctype>"
61
                                                      
62
                                                      +"<returnfield>qtimetadata/qtimetadatafield/fieldlabel</returnfield>"
63
                                                      +"<returnfield>qtimetadata/qtimetadatafield/fieldentry</returnfield>"
64
                                                      +"<returnfield>assessment/duration</returnfield>"
65
                                                      +"<returnfield>assessment/@assessmentTitle</returnfield>"
66
                                                      +"<returnfield>assessment/@assessmentId</returnfield>"
67
                                                      +"<returnfield>lom/general/title/string</returnfield>"
68
                                                      +"<returnfield>lom/general/keyword/string</returnfield>"
69
                                                      +"<returnfield>individualName/surName</returnfield>"
70
                                                      +"<returnfield>organizationName</returnfield>"
71
                                                      
72
                                                      +"<querygroup operator=\"INTERSECT\">"
73
                                                           +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
74
                                                                   +"<value>%</value>"
75
                                                                   +"<pathexpr>organizationName</pathexpr>"
76
                                                           +"</queryterm>"
77
                                                           +"<querygroup operator=\"UNION\">"
78
                                                                   +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
79
                                                                           +"<value>" + searchString + "</value>"
80
                                                                           +"<pathexpr>assessment/@title</pathexpr>"
81
                                                                   +"</queryterm>"
82
                                                                   +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
83
                                                                           +"<value>" + searchString + "</value>"
84
                                                                           +"<pathexpr>surName</pathexpr>"
85
                                                                   +"</queryterm>"
86
                                                                   +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
87
                                                                           +"<value>" + searchString + "</value>"
88
                                                                           +"<pathexpr>givenName</pathexpr>"
89
                                                                   +"</queryterm>"
90
                                                                   +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
91
                                                                           +"<value>" + searchString + "</value>"
92
                                                                           +"<pathexpr>lom/general/keyword/string</pathexpr>"
93
                                                                   +"</queryterm>"
94
                                                           +"</querygroup>"
95
                                                     +"</querygroup>"
96
                                             +"</pathquery>";
97
                } else {
98
                        queryTermString = "";
99
                        if(searchString != "%"){
100
							queryTermString = "<queryterm searchmode=\"contains\" casesensitive=\"false\">"
101
								+"<value>" + searchString + "</value>"
102
								+"</queryterm>";
103
                        }
104
                        submitFormObj.query.value = "<pathquery version=\"1.2\">"
105
                                                           +"<querytitle>Web-Search</querytitle>"
106
                                                                                                                      
107
                                                           +"<returndoctype>edml://ecoinformatics.org/edml</returndoctype>"
108
                                                           
109
                                                           +"<returnfield>qtimetadata/qtimetadatafield/fieldlabel</returnfield>"
110
                                                           +"<returnfield>qtimetadata/qtimetadatafield/fieldentry</returnfield>"
111
                                                           +"<returnfield>assessment/duration</returnfield>"
112
                                                           +"<returnfield>assessment/@assessmentTitle</returnfield>"
113
                                                           +"<returnfield>assessment/@assessmentId</returnfield>"
114
                                                           +"<returnfield>lom/general/title/string</returnfield>"
115
                                                           +"<returnfield>lom/general/keyword/string</returnfield>"
116
                                                           +"<returnfield>individualName/surName</returnfield>"
117
                                                           +"<returnfield>organizationName</returnfield>"
118
                                                           
119
                                                           +"<querygroup operator=\"INTERSECT\">"
120
                                                                +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
121
                                                                        +"<value>%</value>"
122
                                                                        +"<pathexpr>organizationName</pathexpr>"
123
                                                                +"</queryterm>"
124
                                                                + queryTermString
125
                                                           +"</querygroup>"
126
                                                    +"</pathquery>";
127

  
128
                }
129
                return true;
103
			queryString +=
104
                    "<querygroup operator=\"UNION\">"
105
                            +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
106
                                    +"<value>" + searchString + "</value>"
107
                            +"</queryterm>"
108
                    +"</querygroup>"
109
				+"</pathquery>";
110
				
111
			//set the form value	
112
    		submitFormObj.query.value = queryString;
113
    		//alert(submitFormObj.query.value);	
114
			return true;
130 115
        }
131 116

  
132
        function searchAll(){
133
                var checkBox = document.getElementById("searchCheckBox");
134
                if(checkBox.checked == true){
135
                        alert("You have selected to search all possible existing fields. This search will take longer.");
136
                }
137
        }
117
		function browseAll(){
118
			var submitFormObj = document.getElementById("searchForm");
119
			var searchAssessmentsCheckBox = document.getElementById("searchAssessments");
120
			var searchQuestionsCheckBox = document.getElementById("searchQuestions");
121
			
122
			searchAssessmentsCheckBox.checked = true;
123
			searchQuestionsCheckBox.checked = true;
124
			
125
			if (checkSearch(submitFormObj)) {
126
				submitFormObj.submit();
127
			}
128
		}
138 129
   </script>
139 130
</head>
140 131
<body>
......
180 171
			<table class="tables" cellpadding="8" cellspacing="0">
181 172
				<tr class="sectheader">
182 173
					<td class="borderbottom" align="left">
183
						<p align="center">Search assessments and courses</p>
174
						<p align="center">Search Assessments and Questions</p>
184 175
					</td>
185 176
				</tr>
186 177
				<tr class="sectbody"></tr>
......
188 179
				<tr>
189 180
					<td colspan="2" align="left">
190 181
						<form method="POST" action="@servlet-path@" target="_top"
191
							onSubmit="return checkSearch(this)">
182
							onSubmit="return checkSearch(this)" id="searchForm">
192 183
							<span class="searchresultsdividerPale"> 
193 184
								<input value="UNION" name="operator" type="hidden"> &nbsp; 
194 185
								<input size="14" name="searchstring" type="text" value="" id="searchBox"> 
......
200 191
							</span>
201 192
						</form>
202 193
						<form>
203
							<input name="search" type="radio" checked>
204
							Search Titles, Keywords, Instructors (Quicker) 
194
							<input name="search" type="checkbox" id="searchAssessments" checked="checked">
195
							<label for="searchAssessments">Include Assessments</label>
205 196
							<br/>
206
							<input name="search" type="radio" id="searchAll"> 
207
							Search all fields (Slower) 
197
							<input name="search" type="checkbox" id="searchQuestions"> 
198
							<label for="searchQuestions">Include Questions</label>
208 199
							<br />
209 200
						</form>
210 201
						<div align="center">
211
							<p align="left">This tool allows you to search for assessments.
212
							When you type text in the box and click on
213
							the "Search" button, the search will only be conducted within the
202
							<p align="left">This tool allows you to search for Assessments and Questions.
203
							By default, the search will be conducted over all Assessment fields.
204
							These include (but are not limited to):
214 205
							course and assessment titles and descriptions, instructor name, and keyword fields. 
215
							Checking the "Search All Fields" box will search on these and all other existing fields. 
206
							Expanding the search to include Questions will include additional results for question matches
207
							(much like a question bank). 
216 208
							<br />
217 209
							<br />
218 210
							You can use the '%' character as a wildcard in your searches (e.g.,
......
224 216
				<tr>
225 217
					<td class="borderbottom">
226 218
						<div align="center">
227
							<a href="@servlet-path@?action=query&amp;operator=INTERSECT&amp;anyfield=%25&amp;organizationName=%25&amp;qformat=first&amp;enableediting=false&amp;returndoctype=edml://ecoinformatics.org/edml&amp;returnfield=assessment/@assessmentTitle&amp;returnfield=assessment/@assessmentTitle&amp;returnfield=lom/general/title/string&amp;returnfield=lom/general/keyword/string&amp;returnfield=individualName/surName&amp;returnfield=organizationName">
228
							Browse existing FIRST assessments
219
							<a href="javascript:browseAll()">
220
							Browse All FIRST items
229 221
							</a> 
230 222
							<br />
231 223
						</div>

Also available in: Unified diff