Index: jQueryHelper.php =================================================================== --- jQueryHelper.php (revisione 22023) +++ jQueryHelper.php (copia locale) @@ -34,6 +34,33 @@ * */ +function jq_get_callbacks() +{ + static $callbacks; + if (!$callbacks) + { + $callbacks = array_merge(array( + 'uninitialized', 'loading', 'loaded', 'interactive', 'complete', 'failure', 'success' + ), range(100, 599)); + } + + return $callbacks; +} + +function jq_get_ajax_options() +{ + static $ajax_options; + if (!$ajax_options) + { + $ajax_options = array_merge(array( + 'before', 'after', 'condition', 'url', 'asynchronous', 'method', + 'insertion', 'position', 'form', 'with', 'update', 'script' + ), jq_get_callbacks()); + } + + return $ajax_options; +} + function jq_add_plugins_by_name($args = array()) { /* * When adding the capability to use a new plugin you must @@ -723,11 +750,11 @@ jq_add_plugins_by_name(array("ui")); if (!isset($options['with'])) { - $options['with'] = "'id=' + encodeURIComponent(element.id)"; + $options['with'] = "'id=' + ui.draggable.attr('id')"; } if (!isset($options['drop'])) { - $options['drop'] = "function(element){".jq_remote_function($options)."}"; + $options['drop'] = "function(event, ui){".jq_remote_function($options)."}"; } // For backwards compatibility with prototype @@ -735,8 +762,8 @@ { $options['hoverClass'] = $options['hoverclass']; } - $options['hoverClass'] = json_encode('hoverclass'); - + $options['hoverClass'] = json_encode($options['hoverClass']); + foreach (jq_get_ajax_options() as $key) { unset($options[$key]); @@ -746,7 +773,7 @@ { $options['accept'] = json_encode($options['accept']); } - $options = jq_options_for_javascript($options); + $options = _options_for_javascript($options); $selector = json_encode($selector); return javascript_tag("jQuery($selector).droppable($options);"); }