summaryrefslogtreecommitdiff
path: root/modules/upload
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-17 07:12:16 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-17 07:12:16 +0000
commit25b9f686a626fc5424c36555fe4757cb8114d4ea (patch)
tree8640840732e7b9ebcdfaf15a37054714696d4c0f /modules/upload
parent55d9463766e08ebaf9aa08955a418e18fd889353 (diff)
downloadbrdo-25b9f686a626fc5424c36555fe4757cb8114d4ea.tar.gz
brdo-25b9f686a626fc5424c36555fe4757cb8114d4ea.tar.bz2
#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.
Diffstat (limited to 'modules/upload')
-rw-r--r--modules/upload/upload.module18
1 files changed, 10 insertions, 8 deletions
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' => '<div id="attach-wrapper">',
'#suffix' => '</div>',
@@ -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 <iframe> and some browsers have problems with the
+ // 'text/javascript' Content-Type header with iframes. Passing FALSE to
+ // ajax_render() prevents the header from being sent.
+ ajax_render($commands, FALSE);
}