From 25b9f686a626fc5424c36555fe4757cb8114d4ea Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Mon, 17 Aug 2009 07:12:16 +0000 Subject: #544418 by merlinofchaos, sun, drewish, quicksketch, et al: Integrate CTools AJAX framework with Drupal to extend (and replace) existing ahah framework. Everything about AJAX/AHAH is more betterer now. --- modules/upload/upload.module | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'modules/upload') diff --git a/modules/upload/upload.module b/modules/upload/upload.module index b04b92894..772e329ed 100644 --- a/modules/upload/upload.module +++ b/modules/upload/upload.module @@ -60,7 +60,7 @@ function upload_permission() { */ function upload_node_links($node, $build_mode) { $links = array(); - + // Display a link with the number of attachments $num_files = 0; foreach ($node->files as $file) { @@ -236,7 +236,7 @@ function upload_form_alter(&$form, $form_state, $form_id) { '#weight' => 30, ); - // Wrapper for fieldset contents (used by ahah.js). + // Wrapper for fieldset contents (used by ajax.js). $form['attachments']['wrapper'] = array( '#prefix' => '
', '#suffix' => '
', @@ -582,7 +582,7 @@ function _upload_form($node) { '#type' => 'submit', '#value' => t('Attach'), '#name' => 'attach', - '#ahah' => array( + '#ajax' => array( 'path' => 'upload/js', 'wrapper' => 'attach-wrapper', 'progress' => array('type' => 'bar', 'message' => t('Please wait...')), @@ -692,9 +692,11 @@ function upload_js() { $form = form_builder('upload_js', $form, $form_state); $output = theme('status_messages') . drupal_render($form); - // We send the updated file attachments form. - // Don't call drupal_json(). ahah.js uses an iframe and - // the header output by drupal_json() causes problems in some browsers. - print drupal_to_js(array('status' => TRUE, 'data' => $output)); - exit; + $commands = array(); + $commands[] = ajax_command_replace(NULL, $output); + + // AJAX uploads use an