Changeset 0be8bd1 in github
- Timestamp:
- Jun 26, 2012 5:49:47 AM (11 months ago)
- Branches:
- master, HEAD
- Children:
- d901205
- Parents:
- 7ab9c17
- Files:
-
- 4 edited
-
program/js/app.js (modified) (10 diffs)
-
program/steps/addressbook/edit.inc (modified) (2 diffs)
-
skins/larry/addressbook.css (modified) (1 diff)
-
skins/larry/templates/contactedit.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
program/js/app.js
r2950ce4 r0be8bd1 4716 4716 if (form && form.elements._photo.value) { 4717 4717 this.async_upload_form(form, 'upload-photo', function(e) { 4718 rcmail.set_busy(false, null, rcmail. photo_upload_id);4718 rcmail.set_busy(false, null, rcmail.file_upload_id); 4719 4719 }); 4720 4720 4721 4721 // display upload indicator 4722 this. photo_upload_id = this.set_busy(true, 'uploading');4722 this.file_upload_id = this.set_busy(true, 'uploading'); 4723 4723 } 4724 4724 }; … … 4735 4735 this.photo_upload_end = function() 4736 4736 { 4737 this.set_busy(false, null, this. photo_upload_id);4738 delete this. photo_upload_id;4737 this.set_busy(false, null, this.file_upload_id); 4738 delete this.file_upload_id; 4739 4739 }; 4740 4740 … … 6255 6255 var files = e.target.files || e.dataTransfer.files, 6256 6256 formdata = window.FormData ? new FormData() : null, 6257 fieldname = this.env.filedrop.fieldname || '_file',6257 fieldname = (this.env.filedrop.fieldname || '_file') + (this.env.filedrop.single ? '' : '[]'), 6258 6258 boundary = '------multipartformboundary' + (new Date).getTime(), 6259 6259 dashdash = '--', crlf = '\r\n', … … 6270 6270 6271 6271 // add to attachments list 6272 ref.add2attachment_list(ts, { name:'', html:content, classname:'uploading', complete:false }); 6272 if (!ref.add2attachment_list(ts, { name:'', html:content, classname:'uploading', complete:false })) 6273 ref.file_upload_id = ref.set_busy(true, 'uploading'); 6273 6274 6274 6275 // complete multipart content and post request … … 6278 6279 type: 'POST', 6279 6280 dataType: 'json', 6280 url: ref.url(ref.env.filedrop.action||'upload', { _id:ref.env.compose_id|| '', _uploadid:ts, _remote:1 }),6281 url: ref.url(ref.env.filedrop.action||'upload', { _id:ref.env.compose_id||ref.env.cid||'', _uploadid:ts, _remote:1 }), 6281 6282 contentType: formdata ? false : 'multipart/form-data; boundary=' + boundary, 6282 6283 processData: false, … … 6290 6291 // get contents of all dropped files 6291 6292 var last = this.env.filedrop.single ? 0 : files.length - 1; 6292 for (var i=0, f; i<= last && (f = files[i]); i++) {6293 for (var j=0, i=0, f; j <= last && (f = files[i]); i++) { 6293 6294 if (!f.name) f.name = f.fileName; 6294 6295 if (!f.size) f.size = f.fileSize; … … 6307 6308 // do it the easy way with FormData (FF 4+, Chrome 5+, Safari 5+) 6308 6309 if (formdata) { 6309 formdata.append(fieldname + '[]', f);6310 if ( i== last)6310 formdata.append(fieldname, f); 6311 if (j == last) 6311 6312 return submit_data(); 6312 6313 } … … 6316 6317 6317 6318 // closure to pass file properties to async callback function 6318 reader.onload = (function(file, i) {6319 reader.onload = (function(file, j) { 6319 6320 return function(e) { 6320 multipart += 'Content-Disposition: form-data; name="' + fieldname + ' []"';6321 multipart += 'Content-Disposition: form-data; name="' + fieldname + '"'; 6321 6322 multipart += '; filename="' + (f.name_bin || file.name) + '"' + crlf; 6322 6323 multipart += 'Content-Length: ' + file.size + crlf; … … 6325 6326 multipart += dashdash + boundary + crlf; 6326 6327 6327 if ( i== last) // we're done, submit the data6328 if (j == last) // we're done, submit the data 6328 6329 return submit_data(); 6329 6330 } 6330 })(f, i);6331 })(f,j); 6331 6332 reader.readAsBinaryString(f); 6332 6333 } 6333 6334 // Firefox 3 6334 6335 else if (f.getAsBinary) { 6335 multipart += 'Content-Disposition: form-data; name="' + fieldname + ' []"';6336 multipart += 'Content-Disposition: form-data; name="' + fieldname + '"'; 6336 6337 multipart += '; filename="' + (f.name_bin || f.name) + '"' + crlf; 6337 6338 multipart += 'Content-Length: ' + f.size + crlf; … … 6340 6341 multipart += dashdash + boundary +crlf; 6341 6342 6342 if ( i== last)6343 if (j == last) 6343 6344 return submit_data(); 6344 6345 } 6346 6347 j++; 6345 6348 } 6346 6349 }; -
program/steps/addressbook/edit.inc
r041c93c r0be8bd1 263 263 264 264 265 /** 266 * Register container as active area to drop photos onto 267 */ 268 function rcmail_photo_drop_area($attrib) 269 { 270 global $OUTPUT; 271 272 if ($attrib['id']) { 273 $OUTPUT->add_gui_object('filedrop', $attrib['id']); 274 $OUTPUT->set_env('filedrop', array('action' => 'upload-photo', 'fieldname' => '_photo', 'single' => 1, 'filter' => '^image/.+')); 275 } 276 } 277 278 265 279 $OUTPUT->add_handlers(array( 266 280 'contactedithead' => 'rcmail_contact_edithead', … … 269 283 'photouploadform' => 'rcmail_upload_photo_form', 270 284 'sourceselector' => 'rcmail_source_selector', 285 'filedroparea' => 'rcmail_photo_drop_area', 271 286 )); 272 287 -
skins/larry/addressbook.css
r0f3ae42 r0be8bd1 161 161 #contactpic img { 162 162 width: 112px; 163 visibility: inherit; 164 } 165 166 #contactpic.droptarget { 167 background-image: url(images/filedrop.png); 168 background-position: center; 169 background-repeat: no-repeat; 170 } 171 172 #contactpic.droptarget.hover { 173 background-color: #d9ecf4; 174 box-shadow: 0 0 5px 2px rgba(71,135,177, 0.9); 175 -moz-box-shadow: 0 0 5px 2px rgba(71,135,177, 0.9); 176 -webkit-box-shadow: 0 0 5px 2px rgba(71,135,177, 0.9); 177 -o-box-shadow: 0 0 5px 2px rgba(71,135,177, 0.9); 178 } 179 180 #contactpic.droptarget.active img { 181 opacity: 0.15; 182 } 183 184 #contactpic.droptarget.hover img { 185 opacity: 0.05; 163 186 } 164 187 -
skins/larry/templates/contactedit.html
r71e9efb r0be8bd1 20 20 <roundcube:object name="contactphoto" id="contactpic" placeholder="/images/contactpic.png" /> 21 21 <roundcube:if condition="env:photocol" /> 22 <roundcube:object name="fileDropArea" id="contactpic" /> 22 23 <div class="formlinks"> 23 24 <roundcube:button command="upload-photo" id="uploadformlink" type="link" label="replacephoto" class="iconlink upload disabled" classAct="iconlink upload active" onclick="UI.show_uploadform();return false" condition="env:photocol" /><br/>
Note: See TracChangeset
for help on using the changeset viewer.
