summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-06-29 19:27:26 +0000
committeralecpl <alec@alec.pl>2010-06-29 19:27:26 +0000
commit087c7dc5d2e58e4aa99f1ffdb9b8f01c6121ce1d (patch)
tree566cbf7451768406f431d597a6c20f87a317e6e5 /program
parent02cc63c515488aede560facf0d4ae59792776c84 (diff)
- Improved compose screen: resizable body and attachments list, vertical splitter, options menu
- Removed productname/version element, changed footer size to 20px
Diffstat (limited to 'program')
-rw-r--r--program/js/app.js33
-rw-r--r--program/js/editor.js18
-rw-r--r--program/js/googiespell.js42
-rw-r--r--program/steps/mail/compose.inc43
4 files changed, 60 insertions, 76 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 4c0e1841f..4f2ef85e8 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -225,7 +225,7 @@ function rcube_webmail()
}
}
else if (this.env.action == 'compose') {
- this.enable_command('add-attachment', 'send-attachment', 'remove-attachment', 'send', true);
+ this.enable_command('send-attachment', 'remove-attachment', 'send', true);
if (this.env.spellcheck) {
this.env.spellcheck.spelling_state_observer = function(s){ ref.set_spellcheck_state(s); };
@@ -872,9 +872,6 @@ function rcube_webmail()
clearTimeout(this.request_timer);
break;
- case 'add-attachment':
- this.show_attachment_form(true);
-
case 'send-attachment':
// Reset the auto-save timer
self.clearTimeout(this.save_timer);
@@ -3068,32 +3065,6 @@ function rcube_webmail()
return true;
};
- this.show_attachment_form = function(a)
- {
- if (!this.gui_objects.uploadbox)
- return false;
-
- var elm, list;
- if (elm = this.gui_objects.uploadbox) {
- if (a && (list = this.gui_objects.attachmentlist)) {
- var pos = $(list).offset();
- elm.style.top = (pos.top + list.offsetHeight + 10) + 'px';
- elm.style.left = pos.left + 'px';
- }
-
- $(elm).toggle();
- }
-
- // clear upload form
- try {
- if (!a && this.gui_objects.attachmentform != this.gui_objects.messageform)
- this.gui_objects.attachmentform.reset();
- }
- catch(e){} // ignore errors
-
- return true;
- };
-
// upload attachment file
this.upload_file = function(form)
{
@@ -3156,8 +3127,6 @@ function rcube_webmail()
form.setAttribute('enctype', 'multipart/form-data');
form.submit();
- // hide upload form
- this.show_attachment_form(false);
// display upload indicator and cancel button
var content = this.get_label('uploading');
if (this.env.loadingicon)
diff --git a/program/js/editor.js b/program/js/editor.js
index bd9c00cdc..a5e3af3d5 100644
--- a/program/js/editor.js
+++ b/program/js/editor.js
@@ -103,8 +103,7 @@ function rcmail_toggle_editor(select, textAreaId, flagElement)
else
ishtml = select.value == 'html';
- if (ishtml)
- {
+ if (ishtml) {
rcmail.display_spellcheck_controls(false);
rcmail.plain2html(composeElement.value, textAreaId);
@@ -113,25 +112,24 @@ function rcmail_toggle_editor(select, textAreaId, flagElement)
setTimeout("rcmail_editor_tabindex();", 500);
if (flagElement && (flag = rcube_find_object(flagElement)))
flag.value = '1';
- }
- else
- {
+ }
+ else {
var thisMCE = tinyMCE.get(textAreaId);
var existingHtml = thisMCE.getContent();
if (existingHtml) {
if (!confirm(rcmail.get_label('editorwarning'))) {
if (select.tagName == 'SELECT')
- select.value = 'html';
+ select.value = 'html';
return false;
- }
+ }
rcmail.html2plain(existingHtml, textAreaId);
- }
+ }
tinyMCE.execCommand('mceRemoveControl', false, textAreaId);
rcmail.display_spellcheck_controls(true);
if (flagElement && (flag = rcube_find_object(flagElement)))
flag.value = '0';
- }
-};
+ }
+}
diff --git a/program/js/googiespell.js b/program/js/googiespell.js
index 51acb732f..a9879f361 100644
--- a/program/js/googiespell.js
+++ b/program/js/googiespell.js
@@ -767,6 +767,27 @@ this.hideLangWindow = function() {
$(this.switch_lan_pic).removeClass().addClass('googie_lang_3d_on');
};
+this.showLangWindow = function(elm) {
+ if (this.show_menu_observer)
+ this.show_menu_observer(this);
+
+ this.createLangWindow();
+ $('body').append(this.language_window);
+
+ var pos = $(elm).offset(),
+ height = $(elm).height(),
+ width = $(elm).width(),
+ h = $(this.language_window).height(),
+ pageheight = $(document).height(),
+ left = this.change_lang_pic_placement == 'right' ?
+ pos.left - 100 + width : pos.left + width,
+ top = pos.top + h < pageheight ? pos.top + height : pos.top - h - 4;
+
+ $(this.language_window).css({'visibility': 'visible', 'top' : top+'px','left' : left+'px'});
+
+ this.highlightCurSel();
+};
+
this.deHighlightCurSel = function() {
$(this.lang_cur_elm).removeClass().addClass('googie_list_onout');
};
@@ -776,32 +797,15 @@ this.highlightCurSel = function() {
GOOGIE_CUR_LANG = GOOGIE_DEFAULT_LANG;
for (var i=0; i < this.lang_elms.length; i++) {
if ($(this.lang_elms[i]).attr('googieId') == GOOGIE_CUR_LANG) {
- this.lang_elms[i].className = "googie_list_selected";
+ this.lang_elms[i].className = 'googie_list_selected';
this.lang_cur_elm = this.lang_elms[i];
}
else {
- this.lang_elms[i].className = "googie_list_onout";
+ this.lang_elms[i].className = 'googie_list_onout';
}
}
};
-this.showLangWindow = function(elm) {
- if (this.show_menu_observer)
- this.show_menu_observer(this);
-
- this.createLangWindow();
- $('body').append(this.language_window);
-
- var pos = $(elm).offset(),
- top = pos.top + $(elm).height(),
- left = this.change_lang_pic_placement == 'right' ?
- pos.left - 100 + $(elm).width() : pos.left + $(elm).width();
-
- $(this.language_window).css({'visibility': 'visible', 'top' : top+'px','left' : left+'px'});
-
- this.highlightCurSel();
-};
-
this.createChangeLangPic = function() {
var img = $('<img>')
.attr({src: this.img_dir + 'change_lang.gif', 'alt': 'Change language', 'googie_action_btn': '1'}),
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index a0b68d2f0..f59582bfe 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -188,8 +188,11 @@ if (!empty($msg_uid))
}
}
-/****** compose mode functions ********/
+// process $MESSAGE body/attachments, set $MESSAGE_BODY/$HTML_MODE vars and some session data
+$MESSAGE_BODY = rcmail_prepare_message_body();
+
+/****** compose mode functions ********/
function rcmail_compose_headers($attrib)
{
@@ -318,7 +321,6 @@ function rcmail_compose_headers($attrib)
}
-
function rcmail_compose_header_from($attrib)
{
global $IMAP, $MESSAGE, $DB, $USER, $OUTPUT, $compose_mode;
@@ -416,17 +418,9 @@ function rcmail_compose_header_from($attrib)
}
-function rcmail_compose_body($attrib)
+function rcmail_prepare_message_body()
{
- global $RCMAIL, $CONFIG, $OUTPUT, $MESSAGE, $compose_mode, $LINE_LENGTH;
-
- list($form_start, $form_end) = get_form_tags($attrib);
- unset($attrib['form']);
-
- if (empty($attrib['id']))
- $attrib['id'] = 'rcmComposeBody';
-
- $attrib['name'] = '_message';
+ global $RCMAIL, $CONFIG, $MESSAGE, $compose_mode, $LINE_LENGTH, $HTML_MODE;
if ($CONFIG['htmleditor'] || (($compose_mode == RCUBE_COMPOSE_DRAFT || $compose_mode == RCUBE_COMPOSE_EDIT) && $MESSAGE->has_html_part()))
$isHtml = true;
@@ -494,6 +488,25 @@ function rcmail_compose_body($attrib)
}
}
+ $HTML_MODE = $isHtml;
+
+ return $body;
+}
+
+function rcmail_compose_body($attrib)
+{
+ global $RCMAIL, $CONFIG, $OUTPUT, $MESSAGE, $compose_mode, $LINE_LENGTH, $HTML_MODE, $MESSAGE_BODY;
+
+ list($form_start, $form_end) = get_form_tags($attrib);
+ unset($attrib['form']);
+
+ if (empty($attrib['id']))
+ $attrib['id'] = 'rcmComposeBody';
+
+ $attrib['name'] = '_message';
+
+ $isHtml = $HTML_MODE;
+
$out = $form_start ? "$form_start\n" : '';
$saveid = new html_hiddenfield(array('name' => '_draft_saveid', 'value' => $compose_mode==RCUBE_COMPOSE_DRAFT ? str_replace(array('<','>'), "", $MESSAGE->headers->messageID) : ''));
@@ -508,7 +521,7 @@ function rcmail_compose_body($attrib)
// If desired, set this textarea to be editable by TinyMCE
if ($isHtml) $attrib['class'] = 'mce_editor';
$textarea = new html_textarea($attrib);
- $out .= $textarea->show($body);
+ $out .= $textarea->show($MESSAGE_BODY);
$out .= $form_end ? "\n$form_end" : '';
$OUTPUT->set_env('composebody', $attrib['id']);
@@ -908,7 +921,7 @@ function rcmail_compose_attachment_list($attrib)
$out = "\n";
$jslist = array();
-
+
if (is_array($_SESSION['compose']['attachments']))
{
if ($attrib['deleteicon']) {
@@ -972,7 +985,7 @@ function rcmail_compose_attachment_form($attrib)
html::div(null, rcmail_compose_attachment_field(array('size' => $attrib[attachmentfieldsize]))) .
html::div('hint', rcube_label(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) .
html::div('buttons',
- $button->show(rcube_label('close'), array('class' => 'button', 'onclick' => "$('#$attrib[id]').hide()")) . ' ' .
+// $button->show(rcube_label('close'), array('class' => 'button', 'onclick' => "$('#$attrib[id]').hide()")) . ' ' .
$button->show(rcube_label('upload'), array('class' => 'button mainaction', 'onclick' => JS_OBJECT_NAME . ".command('send-attachment', this.form)"))
)
)