Replace prompt() with jQuery UI dialog (#1485135)

pull/1/head
thomascube 13 years ago
parent 9b28484859
commit ac9ba4480d

@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail CHANGELOG Roundcube Webmail
=========================== ===========================
- Replace prompt() with jQuery UI dialog (#1485135)
- Fix navigation in messages search results - Fix navigation in messages search results
- Improved handling of some malformed values encoded with quoted-printable (#1488232) - Improved handling of some malformed values encoded with quoted-printable (#1488232)
- Add possibility to do LDAP bind before searching for bind DN - Add possibility to do LDAP bind before searching for bind DN

@ -907,7 +907,7 @@ function rcube_webmail()
if (!this.gui_objects.messageform) if (!this.gui_objects.messageform)
break; break;
if (!this.check_compose_input()) if (!props.nocheck && !this.check_compose_input(command))
break; break;
// Reset the auto-save timer // Reset the auto-save timer
@ -2960,7 +2960,7 @@ function rcube_webmail()
}; };
// checks the input fields before sending a message // checks the input fields before sending a message
this.check_compose_input = function() this.check_compose_input = function(cmd)
{ {
// check input fields // check input fields
var ed, input_to = $("[name='_to']"), var ed, input_to = $("[name='_to']"),
@ -2995,16 +2995,29 @@ function rcube_webmail()
// display localized warning for missing subject // display localized warning for missing subject
if (input_subject.val() == '') { if (input_subject.val() == '') {
var subject = prompt(this.get_label('nosubjectwarning'), this.get_label('nosubject')); var myprompt = $('<div class="prompt">').html('<div class="message">' + this.get_label('nosubjectwarning') + '</div>').appendTo(document.body);
var prompt_value = $('<input>').attr('type', 'text').attr('size', 30).appendTo(myprompt).val(this.get_label('nosubject'));
// user hit cancel, so don't send var buttons = {};
if (!subject && subject !== '') { buttons[this.get_label('cancel')] = function(){
input_subject.focus(); input_subject.focus();
$(this).dialog('close');
};
buttons[this.get_label('sendmessage')] = function(){
input_subject.val(prompt_value.val());
$(this).dialog('close');
ref.command(cmd, { nocheck:true }); // repeat command which triggered this
};
myprompt.dialog({
modal: true,
resizable: false,
buttons: buttons,
close: function(event, ui) { $(this).remove() }
});
prompt_value.select();
return false; return false;
} }
else
input_subject.val((subject ? subject : this.get_label('nosubject')));
}
// Apply spellcheck changes if spell checker is active // Apply spellcheck changes if spell checker is active
this.stop_spellchecking(); this.stop_spellchecking();

@ -124,7 +124,7 @@ if (!is_array($COMPOSE))
$OUTPUT->add_label('nosubject', 'nosenderwarning', 'norecipientwarning', 'nosubjectwarning', 'cancel', $OUTPUT->add_label('nosubject', 'nosenderwarning', 'norecipientwarning', 'nosubjectwarning', 'cancel',
'nobodywarning', 'notsentwarning', 'notuploadedwarning', 'savingmessage', 'sendingmessage', 'nobodywarning', 'notsentwarning', 'notuploadedwarning', 'savingmessage', 'sendingmessage',
'messagesaved', 'converting', 'editorwarning', 'searching', 'uploading', 'uploadingmany', 'messagesaved', 'converting', 'editorwarning', 'searching', 'uploading', 'uploadingmany',
'fileuploaderror'); 'fileuploaderror', 'sendmessage');
$OUTPUT->set_env('compose_id', $COMPOSE['id']); $OUTPUT->set_env('compose_id', $COMPOSE['id']);
@ -139,6 +139,9 @@ $OUTPUT->set_env('sig_above', $RCMAIL->config->get('sig_above', false));
$OUTPUT->set_env('top_posting', $RCMAIL->config->get('top_posting', false)); $OUTPUT->set_env('top_posting', $RCMAIL->config->get('top_posting', false));
$OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_separator', ','))); $OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_separator', ',')));
// use jquery UI for showing prompt() dialogs
$RCMAIL->plugins->load_plugin('jqueryui');
// get reference message and set compose mode // get reference message and set compose mode
if ($msg_uid = $COMPOSE['param']['draft_uid']) { if ($msg_uid = $COMPOSE['param']['draft_uid']) {
$RCMAIL->imap->set_mailbox($CONFIG['drafts_mbox']); $RCMAIL->imap->set_mailbox($CONFIG['drafts_mbox']);

Loading…
Cancel
Save