uniqueSubmitCallback: function(r)
{
- var elt,
- d = r.response;
+ var d = r.response;
if (!d) {
return;
if (d.success) {
this.addAttach(d.atc.num, d.atc.name, d.atc.type, d.atc.size);
}
- if (DIMP.conf_compose.attach_limit != -1 &&
- $('attach_list').childElements().size() > DIMP.conf_compose.attach_limit) {
- $('upload').enable();
- elt = new Element('DIV', [ DIMP.text_compose.atc_limit ]);
- } else {
- elt = new Element('INPUT', { type: 'file', name: 'file_1' });
- }
- $('upload_wait').next().show();
- $('upload_wait').replace(elt.writeAttribute('id', 'upload'));
+
+ $('upload_wait').hide();
+ this.initAttachList();
this.resizeMsgArea();
break;
}
n.fade({
afterFinish: function() {
n.remove();
+ this.initAttachList();
this.resizeMsgArea();
}.bind(this),
duration: 0.4
DimpCore.doAction('deleteAttach', { atc_indices: ids, imp_compose: $F('composeCache') });
},
+ initAttachList: function()
+ {
+ var u = $('upload'),
+ u_parent = u.up();
+
+ if (DIMP.conf_compose.attach_limit != -1 &&
+ $('attach_list').childElements().size() >= DIMP.conf_compose.attach_limit) {
+ $('upload_limit').show();
+ } else if (!u_parent.visible()) {
+ $('upload_limit').hide();
+
+ if (Prototype.Browser.IE) {
+ // Trick to allow us to clear the file input on IE without
+ // creating a new node. Need to re-add the event handler
+ // however, as it won't survive this assignment.
+ u.stopObserving();
+ u_parent.innerHTML = u_parent.innerHTML;
+ u = $('upload');
+ u.observe('change', this.changeHandler.bindAsEventListener(this));
+ }
+
+ u.clear().up().show().next().show();
+ }
+ },
+
resizeMsgArea: function()
{
var mah, rows,
{
var u = $('upload');
this.uniqueSubmit('addAttachment');
- u.next().hide();
- u.replace(new Element('SPAN', { id: 'upload_wait' }).insert(DIMP.text_compose.uploading + ' (' + $F(u) + ')'));
+ u.up().hide().next().hide();
+ $('upload_wait').update(DIMP.text_compose.uploading + ' (' + $F(u) + ')').show();
},
attachmentComplete: function()
<tr class="atcrow">
<td class="label"><span class="iconImg attachmentImg"></span>: </td>
<td id="attach_cell">
- <input type="file" id="upload" name="file_1" />
+ <span id="upload_limit" style="display:none"><?php echo _("The attachment limit has been reached.") ?></span>
+ <span id="upload_wait" style="display:none"></span>
+ <span>
+ <input type="file" id="upload" name="file_1" />
+ </span>
<?php if (strpos($save_attach, 'prompt') !== false): ?>
<label style="display:none"><input type="checkbox" class="checkbox" name="save_attachments_select"<?php if (strpos($save_attach, 'yes') !== false) echo ' checked="checked"' ?> /> <?php echo _("Save Attachments in sent folder") ?></label><br />
<?php endif; ?>
/* Gettext strings used in compose page. */
$code['text_compose'] = array(
- 'atc_limit' => _("The attachment limit has been reached."),
'cancel' => _("Cancelling this message will permanently discard its contents and will delete auto-saved drafts.\nAre you sure you want to do this?"),
'nosubject' => _("The message does not have a Subject entered.") . "\n" . _("Send message without a Subject?"),
'remove' => _("Remove"),