4 |
## $Id$ |
## $Id$ |
5 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
6 |
## $Log$ |
## $Log$ |
7 |
|
## Revision 1.6 2003/04/08 17:48:31 jonen |
8 |
|
## + bugfix again |
9 |
|
## |
10 |
|
## Revision 1.5 2003/04/08 17:33:22 jonen |
11 |
|
## + fixed problems with hidden form fields(current base URL) at the 'simple search form' |
12 |
|
## |
13 |
## Revision 1.4 2003/04/06 01:41:07 jonen |
## Revision 1.4 2003/04/06 01:41:07 jonen |
14 |
## - removed duplicated decode functions |
## - removed duplicated decode functions |
15 |
## |
## |
266 |
} |
} |
267 |
|
|
268 |
|
|
269 |
|
/** |
270 |
|
* This function builds the simple search TD |
271 |
|
* |
272 |
|
* @return ContainerWidget |
273 |
|
*/ |
274 |
|
function _build_simple_search_form() { |
275 |
|
|
276 |
|
//if there is only 1 item enabled for search |
277 |
|
//then the search looks simple. |
278 |
|
$fields = $this->_get_searchable_fields(); |
279 |
|
$cnt = count($fields); |
280 |
|
if ($cnt == 0) { |
281 |
|
return NULL; |
282 |
|
} |
283 |
|
|
284 |
|
$container = new ContainerWidget; |
285 |
|
|
286 |
|
if ($cnt == 1) { |
287 |
|
//user only has 1 field to show. |
288 |
|
list($name, $field) = each($fields); |
289 |
|
$container->push("Find ".$name." "); |
290 |
|
} else { |
291 |
|
//user has many fields to show. |
292 |
|
$container->push("Find ", |
293 |
|
form_select($this->_vars["search_fieldVar"], $fields, $this->search_field())); |
294 |
|
} |
295 |
|
|
296 |
|
if ($this->get_simple_search_modifier()) { |
297 |
|
//the user wants the search modifier turned on. |
298 |
|
$container->push($this->_build_simple_search_modifier()); |
299 |
|
} |
300 |
|
|
301 |
|
$container->push(form_text($this->_vars["search_valueVar"], $this->search_value_filter($this->search_value()), "20", "100", array("style"=>"vertical-align:middle;")), |
302 |
|
form_submit($this->get_form_name(), "Search", array("style"=>"vertical-align:middle;"))); |
303 |
|
|
304 |
|
if ($this->is_advanced_search_enabled()) { |
305 |
|
$span = html_span(html_a("ass","Advanced Search", "title")); |
306 |
|
$container->push(" ", $span); |
307 |
|
} |
308 |
|
|
309 |
|
if ($cnt == 1) { |
310 |
|
$container->push(form_hidden($this->_vars["search_fieldVar"], $field)); |
311 |
|
} |
312 |
|
|
313 |
|
// find variables attached at base URL and add them as hidden fields, |
314 |
|
// so the search method will reach its starting point at deep frameworks |
315 |
|
$base_url = $this->build_base_url(); |
316 |
|
$url_vars = split("&", $base_url); |
317 |
|
$tmp = split("\?", $url_vars[0]); |
318 |
|
$url_vars[0] = $tmp[1]; |
319 |
|
if(is_array($url_vars)) { |
320 |
|
foreach($url_vars as $value) { |
321 |
|
$var = split("=", $value); |
322 |
|
if($var[0] && $var[1]) { |
323 |
|
$container->push(form_hidden($var[0], $var[1])); |
324 |
|
} |
325 |
|
} |
326 |
|
} |
327 |
|
|
328 |
|
$container->push(form_close() ); |
329 |
|
return $container; |
330 |
|
} |
331 |
|
|
332 |
|
|
333 |
} |
} |