From 640eec398e8b5493b3d1721f916ea34706e22ddd Mon Sep 17 00:00:00 2001 From: ewinslow Date: Mon, 14 Feb 2011 23:41:14 +0000 Subject: Refs #2102: Replaced input/autocomplete with jQuery UI autocomplete (untested) git-svn-id: http://code.elgg.org/elgg/trunk@8240 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/input/autocomplete.php | 86 +++++------------------------------- 1 file changed, 11 insertions(+), 75 deletions(-) (limited to 'views/default') diff --git a/views/default/input/autocomplete.php b/views/default/input/autocomplete.php index 1b2652c16..8fe5ab664 100644 --- a/views/default/input/autocomplete.php +++ b/views/default/input/autocomplete.php @@ -7,95 +7,31 @@ * * @todo This currently only works for ONE AUTOCOMPLETE TEXT FIELD on a page. * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field * @uses $vars['match_on'] Array | str What to match on. all|array(groups|users|friends|subtype) * @uses $vars['match_owner'] Bool. Match only entities that are owned by logged in user. * */ -global $autocomplete_js_loaded; +$defaults = array( + 'class' => '', + 'value' => '', +); -$internalname = $vars['internalname']; -$value = $vars['value']; +$vars = array_merge($defaults, $vars); -if(!$value) { - $value= ''; -} - -if($vars['internal_id']) { - $id_autocomplete = $vars['internal_id']; -} +$vars['class'] = trim("elgg-input-autocomplete {$vars['class']}"); $ac_url_params = http_build_query(array( 'match_on' => $vars['match_on'], 'match_owner' => $vars['match_owner'], )); -$ac_url = elgg_get_site_url() . 'pg/livesearch?' . $ac_url_params; -if (!isset($autocomplete_js_loaded)) { - $autocomplete_js_loaded = false; -} +elgg_register_js('js/lib/autocomplete.js', 'autocomplete', 'footer'); ?> - - - - - - - - - - - +elgg.autocomplete.url = ""; + + /> - $autocomplete_js_loaded = true; -} else { - ?> - - - -