| | |
| | | | program/steps/mail/compose.inc | |
| | | | | |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | | | Copyright (C) 2005-2013, The Roundcube Dev Team | |
| | | | | |
| | | | Licensed under the GNU General Public License version 3 or | |
| | | | any later version with exceptions for skins & plugins. | |
| | |
| | | while ($COMPOSE_ID && !is_array($COMPOSE) && $RCMAIL->db->is_replicated() && $retries++ < 5) { |
| | | usleep(500000); |
| | | $RCMAIL->session->reload(); |
| | | if ($_SESSION['compose_data_'.$COMPOSE_ID]) |
| | | if ($_SESSION['compose_data_'.$COMPOSE_ID]) { |
| | | $COMPOSE =& $_SESSION['compose_data_'.$COMPOSE_ID]; |
| | | } |
| | | } |
| | | |
| | | // Nothing below is called during message composition, only at "new/forward/reply/draft" initialization or |
| | | // if a compose-ID is given (i.e. when the compose step is opened in a new window/tab). |
| | | if (!is_array($COMPOSE)) |
| | | { |
| | | if (!is_array($COMPOSE)) { |
| | | // Infinite redirect prevention in case of broken session (#1487028) |
| | | if ($COMPOSE_ID) |
| | | if ($COMPOSE_ID) { |
| | | rcube::raise_error(array('code' => 500, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Invalid compose ID"), true, true); |
| | | } |
| | | |
| | | $COMPOSE_ID = uniqid(mt_rand()); |
| | | $_SESSION['compose_data_'.$COMPOSE_ID] = array( |
| | |
| | | 'fileuploaderror', 'sendmessage', 'savenewresponse', 'responsename', 'responsetext', 'save', |
| | | 'savingresponse', 'restoresavedcomposedata', 'restoremessage', 'delete', 'restore', 'ignore'); |
| | | |
| | | $OUTPUT->set_pagetitle($RCMAIL->gettext('compose')); |
| | | |
| | | $OUTPUT->set_env('compose_id', $COMPOSE['id']); |
| | | $OUTPUT->set_env('session_id', session_id()); |
| | | $OUTPUT->set_pagetitle($RCMAIL->gettext('compose')); |
| | | $OUTPUT->set_env('mailbox', $RCMAIL->storage->get_folder()); |
| | | $OUTPUT->set_env('top_posting', intval($RCMAIL->config->get('reply_mode')) > 0); |
| | | $OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_separator', ','))); |
| | | |
| | | // add config parameters to client script |
| | | if (!empty($CONFIG['drafts_mbox'])) { |
| | | $OUTPUT->set_env('drafts_mailbox', $CONFIG['drafts_mbox']); |
| | | $OUTPUT->set_env('draft_autosave', $CONFIG['draft_autosave']); |
| | | } |
| | | // set current mailbox in client environment |
| | | $OUTPUT->set_env('mailbox', $RCMAIL->storage->get_folder()); |
| | | $OUTPUT->set_env('top_posting', intval($RCMAIL->config->get('reply_mode')) > 0); |
| | | $OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_separator', ','))); |
| | | |
| | | // default font for HTML editor |
| | | $font = rcmail::font_defs($RCMAIL->config->get('default_font')); |
| | |
| | | if ($compose_mode == RCUBE_COMPOSE_EDIT || $compose_mode == RCUBE_COMPOSE_DRAFT) { |
| | | // don't add signature in draft/edit mode, we'll also not remove the old-one |
| | | // but only on page display, later we should be able to change identity/sig (#1489229) |
| | | if ($config_show_sig == 1 || $config_show_sig == 2) |
| | | if ($config_show_sig == 1 || $config_show_sig == 2) { |
| | | $OUTPUT->set_env('show_sig_later', true); |
| | | } |
| | | } |
| | | else if ($config_show_sig == 1) |
| | | $OUTPUT->set_env('show_sig', true); |
| | |
| | | // set line length for body wrapping |
| | | $LINE_LENGTH = $RCMAIL->config->get('line_length', 72); |
| | | |
| | | if (!empty($msg_uid) && empty($COMPOSE['as_attachment'])) |
| | | { |
| | | if (!empty($msg_uid) && empty($COMPOSE['as_attachment'])) { |
| | | $mbox_name = $RCMAIL->storage->get_folder(); |
| | | |
| | | // set format before rcube_message construction |
| | |
| | | $MESSAGE = new rcube_message($msg_uid); |
| | | |
| | | // make sure message is marked as read |
| | | if ($MESSAGE->headers && empty($MESSAGE->headers->flags['SEEN'])) |
| | | if ($MESSAGE->headers && empty($MESSAGE->headers->flags['SEEN'])) { |
| | | $RCMAIL->storage->set_flag($msg_uid, 'SEEN'); |
| | | } |
| | | |
| | | if (!empty($MESSAGE->headers->charset)) |
| | | if (!empty($MESSAGE->headers->charset)) { |
| | | $RCMAIL->storage->set_charset($MESSAGE->headers->charset); |
| | | } |
| | | |
| | | if (!$MESSAGE->headers) { |
| | | // error |
| | |
| | | $COMPOSE['reply_msgid'] = $MESSAGE->headers->messageID; |
| | | $COMPOSE['references'] = trim($MESSAGE->headers->references . " " . $MESSAGE->headers->messageID); |
| | | |
| | | if (!empty($COMPOSE['param']['all'])) |
| | | if (!empty($COMPOSE['param']['all'])) { |
| | | $MESSAGE->reply_all = $COMPOSE['param']['all']; |
| | | } |
| | | |
| | | // Save the sent message in the same folder of the message being replied to |
| | | if ($RCMAIL->config->get('reply_same_folder') && ($sent_folder = $COMPOSE['mailbox']) |
| | |
| | | $OUTPUT->set_env('draft_id', $msg_uid); |
| | | } |
| | | |
| | | if ($in_reply_to = $MESSAGE->headers->get('in-reply-to')) |
| | | if ($in_reply_to = $MESSAGE->headers->get('in-reply-to')) { |
| | | $COMPOSE['reply_msgid'] = '<' . $in_reply_to . '>'; |
| | | } |
| | | |
| | | $COMPOSE['references'] = $MESSAGE->headers->references; |
| | | } |
| | |
| | | if (!empty($COMPOSE['param']['in-reply-to'])) { |
| | | $COMPOSE['reply_msgid'] = '<' . $COMPOSE['param']['in-reply-to'] . '>'; |
| | | } |
| | | |
| | | if (!empty($COMPOSE['param']['references'])) { |
| | | $COMPOSE['references'] = $COMPOSE['param']['references']; |
| | | } |
| | |
| | | $fvalue = array(); |
| | | |
| | | foreach ($to_addresses as $addr_part) { |
| | | if (empty($addr_part['mailto'])) |
| | | if (empty($addr_part['mailto'])) { |
| | | continue; |
| | | } |
| | | |
| | | $mailto = format_email(rcube_utils::idn_to_utf8($addr_part['mailto'])); |
| | | |
| | | if (!in_array($mailto, $a_recipients) |
| | | && ( |
| | | $header == 'to' |
| | | && ($header == 'to' |
| | | || $compose_mode != RCUBE_COMPOSE_REPLY |
| | | || empty($MESSAGE->compose['from_email']) |
| | | || $mailto != $MESSAGE->compose['from_email'] |
| | | ) |
| | | || $mailto != $MESSAGE->compose['from_email']) |
| | | ) { |
| | | if ($addr_part['name'] && $addr_part['mailto'] != $addr_part['name']) |
| | | $string = format_email_recipient($mailto, $addr_part['name']); |
| | |
| | | |
| | | // process $MESSAGE body/attachments, set $MESSAGE_BODY/$HTML_MODE vars and some session data |
| | | $MESSAGE_BODY = rcmail_prepare_message_body(); |
| | | |
| | | |
| | | // register UI objects |
| | | $OUTPUT->add_handlers(array( |
| | | 'composeheaders' => 'rcmail_compose_headers', |
| | | 'composesubject' => 'rcmail_compose_subject', |
| | | 'composebody' => 'rcmail_compose_body', |
| | | 'composeattachmentlist' => 'rcmail_compose_attachment_list', |
| | | 'composeattachmentform' => 'rcmail_compose_attachment_form', |
| | | 'composeattachment' => 'rcmail_compose_attachment_field', |
| | | 'filedroparea' => 'compose_file_drop_area', |
| | | 'priorityselector' => 'rcmail_priority_selector', |
| | | 'editorselector' => 'rcmail_editor_selector', |
| | | 'receiptcheckbox' => 'rcmail_receipt_checkbox', |
| | | 'dsncheckbox' => 'rcmail_dsn_checkbox', |
| | | 'storetarget' => 'rcmail_store_target_selection', |
| | | 'addressbooks' => 'rcmail_addressbook_list', |
| | | 'addresslist' => 'rcmail_contacts_list', |
| | | 'responseslist' => 'rcmail_compose_responses_list', |
| | | )); |
| | | |
| | | $OUTPUT->send('compose'); |
| | | |
| | | |
| | | /****** compose mode functions ********/ |
| | |
| | | if ($f == 'to' && !empty($COMPOSE['param']['to'])) { |
| | | $to_addresses = rcube_mime::decode_address_list($COMPOSE['param']['to'], null, true, null, true); |
| | | $add_addresses = rcube_mime::decode_address_list($val, null, true); |
| | | |
| | | foreach ($add_addresses as $addr) { |
| | | if (!in_array($addr['mailto'], $to_addresses)) { |
| | | $to_addresses[] = $addr['mailto']; |
| | |
| | | } |
| | | |
| | | // clean HTML message body which can be submitted by URL |
| | | if ($COMPOSE['param']['body']) { |
| | | if (!empty($COMPOSE['param']['body'])) { |
| | | $COMPOSE['param']['body'] = rcmail_wash_html($COMPOSE['param']['body'], array('safe' => false, 'inline_html' => true), array()); |
| | | } |
| | | |
| | |
| | | $out = ''; |
| | | $part = strtolower($attrib['part']); |
| | | |
| | | switch ($part) |
| | | { |
| | | switch ($part) { |
| | | case 'from': |
| | | return $form_start . rcmail_compose_header_from($attrib); |
| | | |
| | |
| | | break; |
| | | } |
| | | |
| | | if ($fname && $field_type) |
| | | { |
| | | if ($fname && $field_type) { |
| | | // pass the following attributes to the form class |
| | | $field_attrib = array('name' => $fname, 'spellcheck' => 'false'); |
| | | foreach ($attrib as $attr => $value) |
| | | if (in_array($attr, $allow_attrib)) |
| | | foreach ($attrib as $attr => $value) { |
| | | if (in_array($attr, $allow_attrib)) { |
| | | $field_attrib[$attr] = $value; |
| | | } |
| | | } |
| | | |
| | | // create teaxtarea object |
| | | $input = new $field_type($field_attrib); |
| | | $out = $input->show($MESSAGE->compose[$param]); |
| | | } |
| | | |
| | | if ($form_start) |
| | | if ($form_start) { |
| | | $out = $form_start.$out; |
| | | } |
| | | |
| | | // configure autocompletion |
| | | $RCMAIL->autocomplete_init(); |
| | |
| | | |
| | | // pass the following attributes to the form class |
| | | $field_attrib = array('name' => '_from'); |
| | | foreach ($attrib as $attr => $value) |
| | | if (in_array($attr, array('id', 'class', 'style', 'size', 'tabindex'))) |
| | | foreach ($attrib as $attr => $value) { |
| | | if (in_array($attr, array('id', 'class', 'style', 'size', 'tabindex'))) { |
| | | $field_attrib[$attr] = $value; |
| | | } |
| | | } |
| | | |
| | | if (count($MESSAGE->identities)) |
| | | { |
| | | if (count($MESSAGE->identities)) { |
| | | $a_signatures = array(); |
| | | $identities = array(); |
| | | $separator = intval($RCMAIL->config->get('reply_mode')) > 0 |
| | |
| | | $select_from = new html_select($field_attrib); |
| | | |
| | | // create SELECT element |
| | | foreach ($MESSAGE->identities as $sql_arr) |
| | | { |
| | | foreach ($MESSAGE->identities as $sql_arr) { |
| | | $identity_id = $sql_arr['identity_id']; |
| | | $select_from->add(format_email_recipient($sql_arr['email'], $sql_arr['name']), $identity_id); |
| | | |
| | | // add signature to array |
| | | if (!empty($sql_arr['signature']) && empty($COMPOSE['param']['nosig'])) |
| | | { |
| | | if (!empty($sql_arr['signature']) && empty($COMPOSE['param']['nosig'])) { |
| | | $text = $html = $sql_arr['signature']; |
| | | |
| | | if ($sql_arr['html_signature']) { |
| | |
| | | global $RCMAIL, $compose_mode; |
| | | static $useHtml; |
| | | |
| | | if ($useHtml !== null) |
| | | if ($useHtml !== null) { |
| | | return $useHtml; |
| | | } |
| | | |
| | | $html_editor = intval($RCMAIL->config->get('htmleditor')); |
| | | |
| | |
| | | function rcmail_message_is_html() |
| | | { |
| | | global $RCMAIL, $MESSAGE; |
| | | |
| | | return $RCMAIL->config->get('prefer_html') && ($MESSAGE instanceof rcube_message) && $MESSAGE->has_html_part(true); |
| | | } |
| | | |
| | |
| | | else if ($compose_mode == RCUBE_COMPOSE_FORWARD && $COMPOSE['as_attachment']) { |
| | | $isHtml = rcmail_compose_editor_mode(); |
| | | $body = ''; |
| | | |
| | | rcmail_write_forward_attachments(); |
| | | } |
| | | // reply/edit/draft/forward |
| | |
| | | |
| | | $plugin = $RCMAIL->plugins->exec_hook('message_compose_body', |
| | | array('body' => $body, 'html' => $isHtml, 'mode' => $compose_mode)); |
| | | |
| | | $body = $plugin['body']; |
| | | unset($plugin); |
| | | |
| | |
| | | else { |
| | | $textarea = new html_textarea($attrib); |
| | | $out .= $textarea->show(''); |
| | | |
| | | // quote plain text, inject into textarea |
| | | $table = get_html_translation_table(HTML_SPECIALCHARS); |
| | | $MESSAGE_BODY = strtr($MESSAGE_BODY, $table); |
| | |
| | | $lang = $_SESSION['language']; |
| | | |
| | | // if not found in the list, try with two-letter code |
| | | if (!$spellcheck_langs[$lang]) |
| | | if (!$spellcheck_langs[$lang]) { |
| | | $lang = strtolower(substr($lang, 0, 2)); |
| | | } |
| | | |
| | | if (!$spellcheck_langs[$lang]) |
| | | if (!$spellcheck_langs[$lang]) { |
| | | $lang = 'en'; |
| | | } |
| | | |
| | | $OUTPUT->set_env('spell_langs', $spellcheck_langs); |
| | | $OUTPUT->set_env('spell_lang', $lang); |
| | |
| | | global $RCMAIL, $MESSAGE, $COMPOSE; |
| | | |
| | | // add attachments |
| | | if (!isset($COMPOSE['forward_attachments']) && is_array($MESSAGE->mime_parts)) |
| | | if (!isset($COMPOSE['forward_attachments']) && is_array($MESSAGE->mime_parts)) { |
| | | $cid_map = rcmail_write_compose_attachments($MESSAGE, $bodyIsHtml); |
| | | } |
| | | |
| | | $date = $RCMAIL->format_date($MESSAGE->headers->date, $RCMAIL->config->get('date_long')); |
| | | |
| | |
| | | $prefix .= $RCMAIL->gettext('from') . ': ' . $MESSAGE->get_header('from') . "\n"; |
| | | $prefix .= $RCMAIL->gettext('to') . ': ' . $MESSAGE->get_header('to') . "\n"; |
| | | |
| | | if ($cc = $MESSAGE->headers->get('cc')) |
| | | if ($cc = $MESSAGE->headers->get('cc')) { |
| | | $prefix .= $RCMAIL->gettext('cc') . ': ' . $cc . "\n"; |
| | | if (($replyto = $MESSAGE->headers->get('reply-to')) && $replyto != $MESSAGE->get_header('from')) |
| | | } |
| | | if (($replyto = $MESSAGE->headers->get('reply-to')) && $replyto != $MESSAGE->get_header('from')) { |
| | | $prefix .= $RCMAIL->gettext('replyto') . ': ' . $replyto . "\n"; |
| | | } |
| | | |
| | | $prefix .= "\n"; |
| | | $body = trim($body, "\r\n"); |
| | |
| | | else { |
| | | // set is_safe flag (we need this for html body washing) |
| | | rcmail_check_safe($MESSAGE); |
| | | |
| | | // clean up html tags |
| | | $body = rcmail_wash_html($body, array('safe' => $MESSAGE->is_safe), $cid_map); |
| | | |
| | |
| | | { |
| | | global $MESSAGE, $COMPOSE; |
| | | |
| | | /** |
| | | * add attachments |
| | | * sizeof($MESSAGE->mime_parts can be 1 - e.g. attachment, but no text! |
| | | */ |
| | | // add attachments |
| | | // sizeof($MESSAGE->mime_parts can be 1 - e.g. attachment, but no text! |
| | | if (empty($COMPOSE['forward_attachments']) |
| | | && is_array($MESSAGE->mime_parts) |
| | | && count($MESSAGE->mime_parts) > 0) |
| | | { |
| | | && count($MESSAGE->mime_parts) > 0 |
| | | ) { |
| | | $cid_map = rcmail_write_compose_attachments($MESSAGE, $bodyIsHtml); |
| | | } |
| | | |
| | |
| | | $cid_map = array(); |
| | | $messages = array(); |
| | | |
| | | foreach ((array)$message->mime_parts as $pid => $part) |
| | | { |
| | | foreach ((array)$message->mime_parts as $pid => $part) { |
| | | if ($part->disposition == 'attachment' || ($part->disposition == 'inline' && $bodyIsHtml) || $part->filename) { |
| | | // skip parts that aren't valid attachments |
| | | if ($part->ctype_primary == 'multipart' || $part->mimetype == 'application/ms-tnef') { |
| | | continue; |
| | | } |
| | | |
| | | // skip message attachments in reply mode |
| | | if ($part->ctype_primary == 'message' && $compose_mode == RCUBE_COMPOSE_REPLY) { |
| | | continue; |
| | | } |
| | | |
| | | // skip inline images when forwarding in text mode |
| | | if ($part->content_id && $part->disposition == 'inline' && !$bodyIsHtml && $compose_mode == RCUBE_COMPOSE_FORWARD) { |
| | | continue; |
| | |
| | | } |
| | | else if ($compose_mode != RCUBE_COMPOSE_FORWARD) { |
| | | // skip attachments included in message/rfc822 attachment (#1486487) |
| | | foreach ($messages as $mimeid) |
| | | foreach ($messages as $mimeid) { |
| | | if (strpos($part->mime_id, $mimeid . '.') === 0) { |
| | | continue 2; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (($attachment = $loaded_attachments[rcmail_attachment_name($part) . $part->mimetype]) |
| | | || ($attachment = rcmail_save_attachment($message, $pid))) { |
| | | || ($attachment = rcmail_save_attachment($message, $pid)) |
| | | ) { |
| | | $COMPOSE['attachments'][$attachment['id']] = $attachment; |
| | | |
| | | if ($bodyIsHtml && ($part->content_id || $part->content_location)) { |
| | | $url = sprintf('%s&_id=%s&_action=display-attachment&_file=rcmfile%s', |
| | | $RCMAIL->comm_path, $COMPOSE['id'], $attachment['id']); |
| | | |
| | | if ($part->content_id) |
| | | $cid_map['cid:'.$part->content_id] = $url; |
| | | else |
| | |
| | | $COMPOSE['attachments'][$attachment['id']] = $attachment; |
| | | $url = sprintf('%s&_id=%s&_action=display-attachment&_file=rcmfile%s', |
| | | $RCMAIL->comm_path, $COMPOSE['id'], $attachment['id']); |
| | | |
| | | if ($part->content_id) |
| | | $cid_map['cid:'.$part->content_id] = $url; |
| | | else |
| | |
| | | global $RCMAIL, $COMPOSE, $MESSAGE; |
| | | |
| | | $storage = $RCMAIL->get_storage(); |
| | | $mem_limit = parse_bytes(ini_get('memory_limit')); |
| | | $curr_mem = function_exists('memory_get_usage') ? memory_get_usage() : 16*1024*1024; // safe value: 16MB |
| | | $names = array(); |
| | | |
| | | $loaded_attachments = array(); |
| | |
| | | } |
| | | |
| | | // don't load too big attachments into memory |
| | | if ($mem_limit > 0 && $message->size > $mem_limit - $curr_mem) { |
| | | if (!rcube_utils::mem_check($message->size)) { |
| | | $temp_dir = unslashify($RCMAIL->config->get('temp_dir')); |
| | | $path = tempnam($temp_dir, 'rcmAttmnt'); |
| | | if ($fp = fopen($path, 'w')) { |
| | |
| | | |
| | | $rcmail = rcmail::get_instance(); |
| | | $part = $message->mime_parts[$pid]; |
| | | $mem_limit = parse_bytes(ini_get('memory_limit')); |
| | | $curr_mem = function_exists('memory_get_usage') ? memory_get_usage() : 16*1024*1024; // safe value: 16MB |
| | | $data = $path = null; |
| | | |
| | | // don't load too big attachments into memory |
| | | if ($mem_limit > 0 && $part->size > $mem_limit - $curr_mem) { |
| | | if (!rcube_utils::mem_check($part->size)) { |
| | | $temp_dir = unslashify($rcmail->config->get('temp_dir')); |
| | | $path = tempnam($temp_dir, 'rcmAttmnt'); |
| | | |
| | | if ($fp = fopen($path, 'w')) { |
| | | $message->get_part_content($pid, $fp, true, 0, false); |
| | | fclose($fp); |
| | | } else |
| | | } |
| | | else { |
| | | return false; |
| | | } else { |
| | | } |
| | | } |
| | | else { |
| | | $data = $message->get_part_content($pid, null, true, 0, false); |
| | | } |
| | | |
| | |
| | | if ($attachment['status']) { |
| | | unset($attachment['data'], $attachment['status'], $attachment['content_id'], $attachment['abort']); |
| | | return $attachment; |
| | | } else if ($path) { |
| | | } |
| | | else if ($path) { |
| | | @unlink($path); |
| | | } |
| | | |
| | |
| | | // basename() is not unicode safe and locale dependent |
| | | if (stristr(PHP_OS, 'win') || stristr(PHP_OS, 'netware')) { |
| | | return preg_replace('/^.*[\\\\\\/]/', '', $filename); |
| | | } else { |
| | | } |
| | | else { |
| | | return preg_replace('/^.*[\/]/', '', $filename); |
| | | } |
| | | } |
| | |
| | | |
| | | $attrib['name'] = '_subject'; |
| | | $attrib['spellcheck'] = 'true'; |
| | | $textfield = new html_inputfield($attrib); |
| | | |
| | | $textfield = new html_inputfield($attrib); |
| | | $subject = ''; |
| | | |
| | | // use subject from post |
| | |
| | | } |
| | | |
| | | foreach ($COMPOSE['attachments'] as $id => $a_prop) { |
| | | if (empty($a_prop)) |
| | | if (empty($a_prop)) { |
| | | continue; |
| | | } |
| | | |
| | | $out .= html::tag('li', |
| | | array( |
| | | $out .= html::tag('li', array( |
| | | 'id' => 'rcmfile'.$id, |
| | | 'class' => rcube_utils::file2class($a_prop['mimetype'], $a_prop['name']), |
| | | 'onmouseover' => "rcube_webmail.long_subject_title_ex(this, 0)", |
| | |
| | | ) . rcube::Q($a_prop['name']) |
| | | ); |
| | | |
| | | $jslist['rcmfile'.$id] = array('name' => $a_prop['name'], 'complete' => true, 'mimetype' => $a_prop['mimetype']); |
| | | $jslist['rcmfile'.$id] = array( |
| | | 'name' => $a_prop['name'], |
| | | 'complete' => true, |
| | | 'mimetype' => $a_prop['mimetype'] |
| | | ); |
| | | } |
| | | } |
| | | |
| | |
| | | $max_filesize = $RCMAIL->upload_init(); |
| | | |
| | | $button = new html_inputfield(array('type' => 'button')); |
| | | $content = html::div(null, rcmail_compose_attachment_field()) |
| | | . html::div('hint', $RCMAIL->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))); |
| | | |
| | | $out = html::div($attrib, |
| | | $OUTPUT->form_tag(array('id' => $attrib['id'].'Frm', 'name' => 'uploadform', 'method' => 'post', 'enctype' => 'multipart/form-data'), |
| | | html::div(null, rcmail_compose_attachment_field()) . |
| | | html::div('hint', $RCMAIL->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) . |
| | | (rcube_utils::get_boolean($attrib['buttons']) ? html::div('buttons', |
| | | if (rcube_utils::get_boolean($attrib['buttons'])) { |
| | | $content .= html::div('buttons', |
| | | $button->show($RCMAIL->gettext('close'), array('class' => 'button', 'onclick' => "$('#$attrib[id]').hide()")) . ' ' . |
| | | $button->show($RCMAIL->gettext('upload'), array('class' => 'button mainaction', 'onclick' => rcmail_output::JS_OBJECT_NAME . ".command('send-attachment', this.form)")) |
| | | ) : '') |
| | | ) |
| | | ); |
| | | } |
| | | |
| | | $out = html::div($attrib, $OUTPUT->form_tag(array( |
| | | 'id' => $attrib['id'] . 'Frm', |
| | | 'name' => 'uploadform', |
| | | 'method' => 'post', |
| | | 'enctype' => 'multipart/form-data' |
| | | ), $content |
| | | )); |
| | | |
| | | $OUTPUT->add_gui_object('uploadform', $attrib['id'].'Frm'); |
| | | |
| | | return $out; |
| | | } |
| | | |
| | |
| | | $attrib['multiple'] = 'multiple'; |
| | | |
| | | $field = new html_inputfield($attrib); |
| | | |
| | | return $field->show(); |
| | | } |
| | | |
| | |
| | | unset($attrib['form']); |
| | | |
| | | $attrib['name'] = '_priority'; |
| | | $selector = new html_select($attrib); |
| | | $prio_list = array( |
| | | $RCMAIL->gettext('lowest') => 5, |
| | | $RCMAIL->gettext('low') => 4, |
| | | $RCMAIL->gettext('normal') => 0, |
| | | $RCMAIL->gettext('high') => 2, |
| | | $RCMAIL->gettext('highest') => 1, |
| | | ); |
| | | |
| | | $selector->add(array($RCMAIL->gettext('lowest'), |
| | | $RCMAIL->gettext('low'), |
| | | $RCMAIL->gettext('normal'), |
| | | $RCMAIL->gettext('high'), |
| | | $RCMAIL->gettext('highest')), |
| | | array('5', '4', '0', '2', '1')); |
| | | $selector = new html_select($attrib); |
| | | $selector->add(array_keys($prio_list), array_values($prio_list)); |
| | | |
| | | if (isset($_POST['_priority'])) |
| | | $sel = $_POST['_priority']; |
| | |
| | | |
| | | $attrib['name'] = '_receipt'; |
| | | $attrib['value'] = '1'; |
| | | |
| | | $checkbox = new html_checkbox($attrib); |
| | | |
| | | if (isset($_POST['_receipt'])) |
| | |
| | | |
| | | $attrib['name'] = '_dsn'; |
| | | $attrib['value'] = '1'; |
| | | |
| | | $checkbox = new html_checkbox($attrib); |
| | | |
| | | if (isset($_POST['_dsn'])) |
| | | $dsn_value = $_POST['_dsn']; |
| | | $dsn_value = (int) $_POST['_dsn']; |
| | | else |
| | | $dsn_value = $RCMAIL->config->get('dsn_default'); |
| | | |
| | |
| | | $select->add(rcube::Q($RCMAIL->gettext('plaintoggle')), 'plain'); |
| | | |
| | | return $select->show($useHtml ? 'html' : 'plain'); |
| | | /* |
| | | foreach ($choices as $value => $text) { |
| | | $attrib['id'] = '_' . $value; |
| | | $attrib['value'] = $value; |
| | | $selector .= $radio->show($chosenvalue, $attrib) . html::label($attrib['id'], rcube::Q($RCMAIL->gettext($text))); |
| | | } |
| | | |
| | | return $selector; |
| | | */ |
| | | } |
| | | |
| | | |
| | |
| | | 'folder_filter' => 'mail', |
| | | 'folder_rights' => 'w', |
| | | ))); |
| | | |
| | | return $select->show(isset($_POST['_store_target']) ? $_POST['_store_target'] : $COMPOSE['param']['sent_mbox'], $attrib); |
| | | } |
| | | |
| | |
| | | global $RCMAIL, $MESSAGE_FORM, $COMPOSE; |
| | | |
| | | $form_start = ''; |
| | | if (!$MESSAGE_FORM) |
| | | { |
| | | if (!$MESSAGE_FORM) { |
| | | $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $RCMAIL->task)); |
| | | $hiddenfields->add(array('name' => '_action', 'value' => 'send')); |
| | | $hiddenfields->add(array('name' => '_id', 'value' => $COMPOSE['id'])); |
| | |
| | | |
| | | return $list->show(); |
| | | } |
| | | |
| | | |
| | | // register UI objects |
| | | $OUTPUT->add_handlers(array( |
| | | 'composeheaders' => 'rcmail_compose_headers', |
| | | 'composesubject' => 'rcmail_compose_subject', |
| | | 'composebody' => 'rcmail_compose_body', |
| | | 'composeattachmentlist' => 'rcmail_compose_attachment_list', |
| | | 'composeattachmentform' => 'rcmail_compose_attachment_form', |
| | | 'composeattachment' => 'rcmail_compose_attachment_field', |
| | | 'filedroparea' => 'compose_file_drop_area', |
| | | 'priorityselector' => 'rcmail_priority_selector', |
| | | 'editorselector' => 'rcmail_editor_selector', |
| | | 'receiptcheckbox' => 'rcmail_receipt_checkbox', |
| | | 'dsncheckbox' => 'rcmail_dsn_checkbox', |
| | | 'storetarget' => 'rcmail_store_target_selection', |
| | | 'addressbooks' => 'rcmail_addressbook_list', |
| | | 'addresslist' => 'rcmail_contacts_list', |
| | | 'responseslist' => 'rcmail_compose_responses_list', |
| | | )); |
| | | |
| | | $OUTPUT->send('compose'); |