From a84bfa356ab168b0b065efeffb32a603970acd13 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 22 Dec 2011 11:35:38 -0500
Subject: [PATCH] Fix upload form handling

---
 program/steps/addressbook/edit.inc |    6 +++---
 program/steps/mail/compose.inc     |    4 ++--
 program/js/app.js                  |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index 0cc2a1f..1652e44 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -1043,7 +1043,7 @@
         break;
 
       case 'upload-photo':
-        this.upload_contact_photo(props);
+        this.upload_contact_photo(props || this.gui_objects.uploadform);
         break;
 
       case 'delete-photo':
diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc
index eb6aa18..c5ca44d 100644
--- a/program/steps/addressbook/edit.inc
+++ b/program/steps/addressbook/edit.inc
@@ -177,7 +177,7 @@
   global $OUTPUT;
 
   // set defaults
-  $attrib += array('id' => 'rcmUploadbox', 'buttons' => 'yes');
+  $attrib += array('id' => 'rcmUploadform', 'buttons' => 'yes');
 
   // find max filesize value
   $max_filesize = parse_bytes(ini_get('upload_max_filesize'));
@@ -191,7 +191,7 @@
   $button = new html_inputfield(array('type' => 'button'));
 
   $out = html::div($attrib,
-    $OUTPUT->form_tag(array('name' => 'uploadform', 'method' => 'post', 'enctype' => 'multipart/form-data'),
+    $OUTPUT->form_tag(array('id' => $attrib['id'].'Frm', 'name' => 'uploadform', 'method' => 'post', 'enctype' => 'multipart/form-data'),
       $hidden->show() .
       html::div(null, $input->show()) .
       html::div('hint', rcube_label(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) .
@@ -203,7 +203,7 @@
   );
 
   $OUTPUT->add_label('addphoto','replacephoto');
-  $OUTPUT->add_gui_object('uploadbox', $attrib['id']);
+  $OUTPUT->add_gui_object('uploadform', $attrib['id'].'Frm');
   return $out;
 }
 
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 76ff31d..b7a4fcb 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -1276,7 +1276,7 @@
   $button = new html_inputfield(array('type' => 'button'));
 
   $out = html::div($attrib,
-    $OUTPUT->form_tag(array('name' => 'uploadform', 'method' => 'post', 'enctype' => 'multipart/form-data'),
+    $OUTPUT->form_tag(array('id' => $attrib['id'].'Frm', 'name' => 'uploadform', 'method' => 'post', 'enctype' => 'multipart/form-data'),
       html::div(null, rcmail_compose_attachment_field(array('size' => $attrib['attachmentfieldsize']))) .
       html::div('hint', rcube_label(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) .
       (get_boolean($attrib['buttons']) ? html::div('buttons',
@@ -1286,7 +1286,7 @@
     )
   );
 
-  $OUTPUT->add_gui_object('uploadform', $attrib['id']);
+  $OUTPUT->add_gui_object('uploadform', $attrib['id'].'Frm');
   return $out;
 }
 

--
Gitblit v1.9.1