summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2006-08-30 18:56:31 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2006-08-30 18:56:31 +0000
commit6bbc4d7bf16864eec4b26be731c0026d9d893a13 (patch)
tree0bac96afc39a089af1298198be902d47e7c782bd
parent5dc27bcb93db939584576194414e33d330cb7b38 (diff)
downloadbrdo-6bbc4d7bf16864eec4b26be731c0026d9d893a13.tar.gz
brdo-6bbc4d7bf16864eec4b26be731c0026d9d893a13.tar.bz2
- Fix upload.js after edit[] patch (note: uploading is still broken, with or without JS)
-rw-r--r--misc/upload.js9
-rw-r--r--modules/upload/upload.module4
2 files changed, 7 insertions, 6 deletions
diff --git a/misc/upload.js b/misc/upload.js
index 1c28bcfa3..4365749cf 100644
--- a/misc/upload.js
+++ b/misc/upload.js
@@ -13,10 +13,11 @@ function uploadAutoAttach() {
for (i = 0; input = inputs[i]; i++) {
if (input && hasClass(input, 'upload')) {
var uri = input.value;
- // Extract the button ID based on a substring of the input name: edit[foo][bar] -> foo-bar
- var button = input.name.substr(5, input.name.length - 6).replace('][', '-');
- var wrapper = button + '-wrapper';
- var hide = button + '-hide';
+ // Extract the base name from the id (edit-attach-url -> attach).
+ var base = input.id.substring(5, input.id.length - 4);
+ var button = base + '-button';
+ var wrapper = base + '-wrapper';
+ var hide = base + '-hide';
var upload = new jsUpload(uri, button, wrapper, hide);
}
}
diff --git a/modules/upload/upload.module b/modules/upload/upload.module
index 481e177dc..d0ed472b2 100644
--- a/modules/upload/upload.module
+++ b/modules/upload/upload.module
@@ -801,9 +801,9 @@ function _upload_form($node) {
'#suffix' => '</div>',
);
$form['new']['upload'] = array('#type' => 'file', '#title' => t('Attach new file'), '#size' => 40);
- $form['new']['attach'] = array('#type' => 'button', '#value' => t('Attach'), '#name'=> 'attach', '#attributes' => array('id' => 'attach'));
+ $form['new']['attach'] = array('#type' => 'button', '#value' => t('Attach'), '#name' => 'attach', '#attributes' => array('id' => 'attach-button'));
// The class triggers the js upload behaviour.
- $form['attach'] = array('#type' => 'hidden', '#value' => url('upload/js', NULL, NULL, TRUE), '#attributes' => array('class' => 'upload'));
+ $form['attach-url'] = array('#type' => 'hidden', '#value' => url('upload/js', NULL, NULL, TRUE), '#attributes' => array('class' => 'upload'));
}
// Needed for JS