added ability to insert attached images in HTML editor
1 files renamed
1 files added
27 files modified
| | |
| | | 2007/12/10 (estadtherr) |
| | | ---------- |
| | | - Upgrade to TinyMCE 2.1.3 |
| | | - Allow inserting image attachments into HTML messages while composing |
| | | |
| | | 2007/12/10 (thomasb) |
| | | ---------- |
| | |
| | | if ($_action=='upload') |
| | | include('program/steps/mail/upload.inc'); |
| | | |
| | | if ($_action=='compose' || $_action=='remove-attachment') |
| | | if ($_action=='compose' || $_action=='remove-attachment' || $_action=='display-attachment') |
| | | include('program/steps/mail/compose.inc'); |
| | | |
| | | if ($_action=='addcontact') |
| | |
| | | // upload attachment file |
| | | this.upload_file = function(form) |
| | | { |
| | | |
| | | if (!form) |
| | | return false; |
| | | |
| | |
| | | theme_advanced_toolbar_align : 'left', |
| | | extended_valid_elements : 'font[face|size|color|style],span[id|class|align|style]', |
| | | content_css : skin_path + '/editor_content.css', |
| | | popups_css : skin_path + '/editor_popup.css', |
| | | editor_css : skin_path + '/editor_ui.css' |
| | | editor_css : skin_path + '/editor_ui.css', |
| | | external_image_list_url : 'program/js/editor_images.js' |
| | | }); |
| | | } |
| | | |
New file |
| | |
| | | |
| | | var rc_client = tinyMCEPopup.windowOpener.rcube_webmail_client; |
| | | if (rc_client.gui_objects.attachmentlist) |
| | | { |
| | | var tinyMCEImageList = new Array(); |
| | | var attachElems = rc_client.gui_objects.attachmentlist.getElementsByTagName("li"); |
| | | for (i = 0; i < attachElems.length; i++) |
| | | { |
| | | var liElem = attachElems[i]; |
| | | var fname = attachElems[i].id; |
| | | for (j = 0; j < liElem.childNodes.length; j++) |
| | | { |
| | | if (liElem.childNodes[j].nodeName == "#text") |
| | | { |
| | | fname = liElem.childNodes[j].nodeValue; |
| | | } |
| | | } |
| | | tinyMCEImageList.push([fname, rc_client.env.comm_path+'&_action=display-attachment&_file='+attachElems[i].id]); |
| | | } |
| | | }; |
| | |
| | |
|
| | | _insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) {
|
| | | tinyMCE.execCommand("mceInsertContent", false, tinyMCE.createTagHTML('img', {
|
| | | src : tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], src), // Force absolute
|
| | | src : tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, src), // Force absolute |
| | | mce_src : src,
|
| | | alt : alt,
|
| | | border : border,
|
| | |
| | | } |
| | | } |
| | | |
| | | if ($_action=='display-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_GET['_file'], $regs)) |
| | | { |
| | | $id = $regs[1]; |
| | | if (is_array($_SESSION['compose']['attachments'][$id])) |
| | | { |
| | | $apath = $_SESSION['compose']['attachments'][$id]['path']; |
| | | header('Content-Type: ' . $_SESSION['compose']['attachments'][$id]['mimetype']); |
| | | header('Content-Length: ' . filesize($apath)); |
| | | readfile($apath); |
| | | } |
| | | exit; |
| | | } |
| | | |
| | | $MESSAGE_FORM = NULL; |
| | | $MESSAGE = NULL; |
| | |
| | | { |
| | | $_SESSION['compose']['draft_uid'] = $msg_uid; |
| | | } |
| | | |
| | | } |
| | | |
| | | /****** compose mode functions ********/ |
| | |
| | | $allow_attrib = array('id', 'class', 'style', 'size', 'tabindex'); |
| | | $field_type = 'textfield'; |
| | | break; |
| | | |
| | | } |
| | | |
| | | if ($fname && !empty($_POST[$fname])) |
| | |
| | | |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | |
| | | function rcmail_compose_body($attrib) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | function rcmail_compose_attachment_form($attrib) |
| | | { |
| | | global $OUTPUT, $SESS_HIDDEN_FIELD; |
| | |
| | | 'receiptcheckbox' => 'rcmail_receipt_checkbox', |
| | | )); |
| | | |
| | | |
| | | /****** get contacts for this user and add them to client scripts ********/ |
| | | |
| | | require_once('include/rcube_contacts.inc'); |
| | |
| | | |
| | | $OUTPUT->set_env('contacts', $a_contacts); |
| | | } |
| | | |
| | | |
| | | parse_template('compose'); |
| | | ?> |
| | |
| | | |
| | | // add stored attachments, if any |
| | | if (is_array($_SESSION['compose']['attachments'])) |
| | | foreach ($_SESSION['compose']['attachments'] as $attachment) |
| | | foreach ($_SESSION['compose']['attachments'] as $id => $attachment) |
| | | { |
| | | $dispurl = '/\ssrc\s*=\s*[\'"]?\S+display-attachment\S+file=rcmfile' . $id . '[\'"]?/'; |
| | | $match = preg_match($dispurl, $message_body); |
| | | if ($isHtml && ($match > 0)) |
| | | { |
| | | $message_body = preg_replace($dispurl, ' src="'.$attachment['name'].'"', $message_body); |
| | | $MAIL_MIME->setHTMLBody($message_body); |
| | | $MAIL_MIME->addHTMLImage($attachment['path'], $attachment['mimetype'], $attachment['name']); |
| | | } |
| | | else |
| | | { |
| | | $MAIL_MIME->addAttachment($attachment['path'], $attachment['mimetype'], $attachment['name'], true, 'base64', 'attachment', $message_charset); |
| | | } |
| | | } |
| | | |
| | | // add submitted attachments |
| | | if (is_array($_FILES['_attachments']['tmp_name'])) |
| | |
| | | $OUTPUT->command('sent_successfully', rcube_label('messagesent')); |
| | | $OUTPUT->send('iframe'); |
| | | } |
| | | |
| | | |
| | | ?> |
| | |
| | | $OUTPUT->add_script("tinyMCE.init({ mode : 'specific_textareas'," . |
| | | "apply_source_formatting : true," . |
| | | "content_css : '\$__skin_path' + '/editor_content.css'," . |
| | | "popups_css : '\$__skin_path' + '/editor_popups.css'," . |
| | | "editor_css : '\$__skin_path' + '/editor_ui.css'," . |
| | | "theme : 'advanced'," . |
| | | "theme_advanced_toolbar_location : 'top'," . |