From: Michael M Slusarz Date: Fri, 30 Oct 2009 22:12:45 +0000 (-0600) Subject: func_replace -> raw_params X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f5dbc94f39b6d89dd296881e91666cbaa6116bfe;p=horde.git func_replace -> raw_params --- diff --git a/framework/Ajax/lib/Horde/Ajax/Imple/AutoCompleter.php b/framework/Ajax/lib/Horde/Ajax/Imple/AutoCompleter.php index 691cf12d6..2b21ea439 100644 --- a/framework/Ajax/lib/Horde/Ajax/Imple/AutoCompleter.php +++ b/framework/Ajax/lib/Horde/Ajax/Imple/AutoCompleter.php @@ -38,7 +38,11 @@ abstract class Horde_Ajax_Imple_AutoCompleter extends Horde_Ajax_Imple_Base '"' . $this->_params['triggerId'] . '"' ); - $config = $this->_attach(array('tokens' => array(',', ';'))); + $config = $this->_attach(array( + 'raw_params' = array(), + 'tokens' => array(',', ';') + )); + if (isset($config['ajax'])) { Horde::addScriptFile('autocomplete.js', 'horde'); @@ -74,11 +78,14 @@ abstract class Horde_Ajax_Imple_AutoCompleter extends Horde_Ajax_Imple_Base return; } + foreach ($config['raw_params'] as $name => $val) { + $config['params'][$name] = 1; + } + $js_params = Horde_Serialize::serialize($config['params'], Horde_Serialize::JSON); - if (!empty($config['func_replace'])) { - foreach ($config['func_replace'] as $key => $val) { - $js_params = str_replace($key, $val, $js_params); - } + + foreach ($config['raw_params'] as $name => $val) { + $js_params = str_replace('"' . $name . '":1', '"' . $name . '":' . $val, $js_params); } Horde::addScriptFile('effects.js', 'horde'); @@ -100,10 +107,9 @@ abstract class Horde_Ajax_Imple_AutoCompleter extends Horde_Ajax_Imple_Base * function name. * * Additional Options: - * 'func_replace' - (array) Replaces keys with values. Useful for adding - * functions to javascript parameters output. * 'params' - (array) The list of javascript parameters to pass to the * autocomplete libraries. + * 'raw_params' - (array) Adds raw javascript to the 'params' array. * 'var' - (string) If set, the autocomplete object will be assigned to * this variable. *