Project

General

Profile

« Previous | Next » 

Revision 3402

Added by Jing Tao over 17 years ago

Add radio buttons of searching some path or all path for default search page

View differences:

lib/style/skins/default/include_searchbox.jsp
66 66
      formObj.submit();
67 67
      return true;
68 68
    }
69
    function checkSearch(submitFormObj) {
70
                var checkBox = document.getElementById("searchAll");
71
                var searchBox = document.getElementById("searchBox");
72
                var searchString = trim(searchBox.value);
73

  
74
                if (searchString=="") {
75
                        if (confirm("Show *all* data in the KNB?")) {
76
          			searchString = "%";
77
        		} else {
78
          			return false;
79
        		}		
80
                }
81

  
82
                //if(document.forms[0].radios[0].checked){
83
		if(!checkBox.checked){
84
                        if(searchString!="%"){
85
                                searchBox.name = "title";
86
                                searchBox.id = "searchBox";
87

  
88
                                submitFormObj.surName.value = searchString;
89
                                submitFormObj.givenName.value = searchString;
90
                                submitFormObj.keyword.value = searchString;
91
                                submitFormObj.organizationName.value = searchString;
92
                                submitFormObj.para.value = searchString;
93
                                submitFormObj.geographicDescription.value = searchString;
94
                                submitFormObj.literalLayout.value = searchString;
95
                                submitFormObj.operator.value="UNION";
96
                                var abs = document.getElementById("abstract");
97
                                abs.value=searchString;
98
                        } else {
99
                                searchBox.name = "anyfield";
100
                                searchBox.id = "searchBox";
101
                                searchBox.value = "%";
102

  
103
                                submitFormObj.surName.value = "";
104
                                submitFormObj.givenName.value = "";
105
                                submitFormObj.keyword.value = "";
106
                                submitFormObj.organizationName.value = "";
107
                                submitFormObj.para.value = "";
108
                                submitFormObj.geographicDescription.value = "";
109
                                submitFormObj.literalLayout.value = "";
110
                                submitFormObj.operator.value="INTERSECT";
111
                                var abs = document.getElementById("abstract");
112
                                abs.value="";
113

  
114
			 }
115
                } else {
116
                        searchBox.name = "anyfield";
117
                        searchBox.id = "searchBox";
118

  
119
                        submitFormObj.surName.value = "";
120
                        submitFormObj.givenName.value = "";
121
                        submitFormObj.keyword.value = "";
122
                        submitFormObj.organizationName.value = "";
123
                        submitFormObj.para.value = "";
124
                        submitFormObj.geographicDescription.value = "";
125
                        submitFormObj.literalLayout.value = "";
126
                        submitFormObj.operator.value="INTERSECT";
127
                        var abs = document.getElementById("abstract");
128
                        abs.value="";
129
                }
130

  
131

  
132
                var radioInput = document.getElementsByName("search");
133
		       radioInput[0].name = "";
134

  
135
                return true;
136
        }
69 137
  </script>
70 138
</head>
71 139

  
......
94 162
          <tr valign="baseline"> 
95 163
            <td colspan="2">
96 164
              <form action="<%=METACAT_URL%>" name="searchForm" method="post" 
97
                target="_top" onSubmit="return allowSearch(this);">
165
                target="_top" onSubmit="return checkSearch(this);">
98 166
                <%=sessionidField%>
99 167
                <%=SIMPLE_SEARCH_METACAT_POST_FIELDS%>
168
                <input type="hidden" name="organizationName">
169
  			    <input type="hidden" name="surName">
170
  			    <input type="hidden" name="givenName">
171
  			    <input type="hidden" name="keyword">
172
  			    <input type="hidden" name="para">
173
  			    <input type="hidden" name="geographicDescription">
174
  			    <input type="hidden" name="literalLayout">
175
  			    <input type="hidden" name="abstract/para" id="abstract">
100 176
                <table width="100%" border="0" cellpadding="5" cellspacing="0">
101 177
                  <tr> 
102 178
                    <td width="94" rowspan="2" align="left" valign="top">
......
123 199
                  <tr valign="middle"> 
124 200
                    <td align="right" class="searchcat"> 
125 201
                      <input type="text" name="anyfield" size="30" 
126
                        maxlength="200">&nbsp;&nbsp;
202
                        maxlength="200" id="searchBox">&nbsp;&nbsp;
127 203
                    </td>
128 204
                    <td width="365" align="left" class="searchcat"> 
129 205
                      <input type="submit" value="Search Data Catalog">
......
135 211
                      
136 212
                    </td>
137 213
                  </tr>
214

  
138 215
                </table>
139 216
              </form>
140 217
            </td>
141 218
          </tr>
219
         <tr valign="baseline" >
220
         
221
             <td colspan="2">
222
                 <table width="100%" border="0" cellpadding="0" cellspacing="0" >
223
                   <from>
224
		            <tr>
225
		               <td width="40">		    
226
			            </td>
227
			            <td width="158">
228
			                 <input name="search" type="radio" checked><span class="text_plain"> Search Title, Abstract, Keywords, Personnel (Quicker)</span></input>
229
		               </td>
230
		           </tr>
231
		            <tr>
232
		                 <td width="40">		    
233
			              </td>
234
			              <td width="158">
235
			                    <input name="search" type="radio" id="searchAll"><span class="text_plain"> Search all fields (Slower)</span></input>
236
		                 </td>
237
		           </tr>
238
		        </form>
239
		      </table>
240
             </td>
241
		  </tr>
242
	  
142 243
<%
143 244
/*
144 245
US Geography

Also available in: Unified diff