From f5521a4a6d2132f8fe49c66858326e00e9a68b84 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 30 Dec 2011 11:02:24 -0500
Subject: [PATCH] Add button to clone file upload fields for mutli-file uploads
---
skins/larry/mail.css | 7 +++++++
skins/larry/ui.js | 26 +++++++++++++++++++++++++-
2 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/skins/larry/mail.css b/skins/larry/mail.css
index 4640822..efee660 100644
--- a/skins/larry/mail.css
+++ b/skins/larry/mail.css
@@ -1110,5 +1110,12 @@
border-bottom: 1px solid #ddd;
}
+#uploadform a.iconlink {
+ margin-left: 1em;
+ text-indent: -1000px;
+}
+#uploadform form div {
+ margin: 4px 0;
+}
diff --git a/skins/larry/ui.js b/skins/larry/ui.js
index c24915e..8038aa7 100644
--- a/skins/larry/ui.js
+++ b/skins/larry/ui.js
@@ -532,6 +532,17 @@
$dialog.dialog('close');
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({
modal: true,
@@ -543,14 +554,27 @@
catch(e){ } // ignore errors
$dialog.dialog('destroy').hide();
+ $('div.addline', $dialog).remove();
},
width: 480
}).show();
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();
+ }
+
+
/**
*
*/
--
Gitblit v1.9.1