| |
8 |
8 |
# @author Viaro Networks www.viaro.net |
| |
9 |
9 |
# |
| |
10 |
10 |
# Usage: |
| |
11 |
11 |
# ADP File: |
| |
12 |
12 |
# <include src="/packages/contacts/lib/search-contact" keyword="@keyword@" return_url="@return_url@"> |
| |
13 |
13 |
# |
| |
14 |
14 |
# Expects: |
| |
15 |
15 |
# keyword The keyword to search projects |
| |
16 |
16 |
# contacts_url The URL for the contacts package to be used. |
| |
17 |
17 |
# return_url The return_url to return if no project is found. It would be the same page if empty. |
| |
18 |
18 |
|
| |
19 |
19 |
|
| |
20 |
20 |
if { ![exists_and_not_null contacts_url]} { |
| |
21 |
21 |
set contacts_url [ad_conn package_url] |
| |
22 |
22 |
} |
| |
23 |
23 |
|
| |
24 |
24 |
if { ![exists_and_not_null return_url] } { |
| |
25 |
25 |
set return_url [ad_return_url] |
| |
26 |
26 |
} |
| |
27 |
27 |
|
| |
28 |
|
set focus_message "if(this.value=='[_ contacts.search_contact]')this.value='';" |
| |
29 |
|
set blur_message "if(this.value=='')this.value='[_ contacts.search_contact]';" |
| |
|
28 |
# Include for an Ajax dropdown smart search widget that filters search results as you type. |
| |
|
29 |
# Requires ajaxhelper |
| |
30 |
30 |
|
| |
31 |
|
ad_form -name search_contact -form { |
| |
32 |
|
{keyword:text(text) |
| |
33 |
|
{html {size 20 onfocus "$focus_message" onblur "$blur_message" class search_contact}} |
| |
34 |
|
{value "[_ contacts.search_contact]"} |
| |
35 |
|
} |
| |
36 |
|
{return_url:text(hidden) {value $return_url}} |
| |
37 |
|
} -on_submit { |
| |
38 |
|
ad_returnredirect [export_vars -base "$contacts_url" -url {{query $keyword}}] |
| |
39 |
|
} -has_submit {1} |
| |
|
31 |
set js_update_user_select [ah::ajaxupdate \ |
| |
|
32 |
-container "results_box" \ |
| |
|
33 |
-url "${contacts_url}/lookup" \ |
| |
|
34 |
-pars "Form.serialize('searchform')"] |