Add button to clone file upload fields for mutli-file uploads

pull/1/head
thomascube 13 years ago
parent e193a0272e
commit f5521a4a6d

@ -1110,5 +1110,12 @@ div.message-part blockquote blockquote blockquote {
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
} }
#uploadform a.iconlink {
margin-left: 1em;
text-indent: -1000px;
}
#uploadform form div {
margin: 4px 0;
}

@ -533,6 +533,17 @@ function rcube_mail_ui()
return; return;
} }
// add icons to clone file input field
if (rcmail.env.action = 'compose' && !$dialog.data('extended')) {
$('<a>')
.addClass('iconlink add')
.attr('href', '#add')
.html('Add')
.appendTo($('input[type="file"]', $dialog).parent())
.click(add_uploadfile);
$dialog.data('extended', true);
}
$dialog.dialog({ $dialog.dialog({
modal: true, modal: true,
resizable: false, resizable: false,
@ -543,14 +554,27 @@ function rcube_mail_ui()
catch(e){ } // ignore errors catch(e){ } // ignore errors
$dialog.dialog('destroy').hide(); $dialog.dialog('destroy').hide();
$('div.addline', $dialog).remove();
}, },
width: 480 width: 480
}).show(); }).show();
if (!document.all) if (!document.all)
$('input[type=file]', $dialog).click(); $('input[type=file]', $dialog).first().click();
}
function add_uploadfile(e)
{
var div = $(this).parent();
var clone = div.clone().addClass('addline').insertAfter(div);
clone.children('.iconlink').click(add_uploadfile);
clone.children('input').val('');
if (!document.all)
$('input[type=file]', clone).click();
} }
/** /**
* *
*/ */

Loading…
Cancel
Save