svncommit
2007-12-10 4315b0086b14cd5266b4cb824c3bd95aa550240c
added ability to insert attached images in HTML editor

1 files renamed
1 files added
27 files modified
65 ■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
index.php 2 ●●● patch | view | raw | blame | history
program/js/app.js 1 ●●●● patch | view | raw | blame | history
program/js/editor.js 4 ●●●● patch | view | raw | blame | history
program/js/editor_images.js 20 ●●●●● patch | view | raw | blame | history
program/js/tiny_mce/license.txt patch | view | raw | blame | history
program/js/tiny_mce/plugins/media/css/content.css patch | view | raw | blame | history
program/js/tiny_mce/plugins/media/css/media.css patch | view | raw | blame | history
program/js/tiny_mce/plugins/media/editor_plugin_src.js patch | view | raw | blame | history
program/js/tiny_mce/plugins/media/jscripts/embed.js patch | view | raw | blame | history
program/js/tiny_mce/plugins/media/jscripts/media.js patch | view | raw | blame | history
program/js/tiny_mce/plugins/media/langs/en.js patch | view | raw | blame | history
program/js/tiny_mce/plugins/readme.txt patch | view | raw | blame | history
program/js/tiny_mce/plugins/table/css/cell.css patch | view | raw | blame | history
program/js/tiny_mce/plugins/table/css/row.css patch | view | raw | blame | history
program/js/tiny_mce/plugins/table/css/table.css patch | view | raw | blame | history
program/js/tiny_mce/themes/advanced/css/editor_popup.css patch | view | raw | blame | history
program/js/tiny_mce/themes/advanced/editor_template_src.js 2 ●●● patch | view | raw | blame | history
program/js/tiny_mce/themes/advanced/image.htm patch | view | raw | blame | history
program/js/tiny_mce/tiny_mce_popup.js patch | view | raw | blame | history
program/js/tiny_mce/tiny_mce_src.js patch | view | raw | blame | history
program/js/tiny_mce/utils/editable_selects.js patch | view | raw | blame | history
program/js/tiny_mce/utils/form_utils.js patch | view | raw | blame | history
program/js/tiny_mce/utils/mclayer.js patch | view | raw | blame | history
program/js/tiny_mce/utils/mctabs.js patch | view | raw | blame | history
program/js/tiny_mce/utils/validate.js patch | view | raw | blame | history
program/steps/mail/compose.inc 18 ●●●●● patch | view | raw | blame | history
program/steps/mail/sendmail.inc 16 ●●●● patch | view | raw | blame | history
program/steps/settings/edit_identity.inc 1 ●●●● patch | view | raw | blame | history
CHANGELOG
@@ -4,6 +4,7 @@
2007/12/10 (estadtherr)
----------
- Upgrade to TinyMCE 2.1.3
- Allow inserting image attachments into HTML messages while composing
2007/12/10 (thomasb)
----------
index.php
@@ -283,7 +283,7 @@
  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')
program/js/app.js
@@ -1884,7 +1884,6 @@
  // upload attachment file
  this.upload_file = function(form)
    {
    if (!form)
      return false;
      
program/js/editor.js
@@ -29,8 +29,8 @@
                 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'
               });
  }
program/js/editor_images.js
New file
@@ -0,0 +1,20 @@
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]);
   }
};
program/js/tiny_mce/license.txt
program/js/tiny_mce/plugins/media/css/content.css
program/js/tiny_mce/plugins/media/css/media.css
program/js/tiny_mce/plugins/media/editor_plugin_src.js
program/js/tiny_mce/plugins/media/jscripts/embed.js
program/js/tiny_mce/plugins/media/jscripts/media.js
program/js/tiny_mce/plugins/media/langs/en.js
program/js/tiny_mce/plugins/readme.txt
program/js/tiny_mce/plugins/table/css/cell.css
program/js/tiny_mce/plugins/table/css/row.css
program/js/tiny_mce/plugins/table/css/table.css
program/js/tiny_mce/themes/advanced/css/editor_popup.css
program/js/tiny_mce/themes/advanced/editor_template_src.js
@@ -1420,7 +1420,7 @@
    _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,
program/js/tiny_mce/themes/advanced/image.htm
program/js/tiny_mce/tiny_mce_popup.js
program/js/tiny_mce/tiny_mce_src.js
program/js/tiny_mce/utils/editable_selects.js
program/js/tiny_mce/utils/form_utils.js
program/js/tiny_mce/utils/mclayer.js
program/js/tiny_mce/utils/mctabs.js
program/js/tiny_mce/utils/validate.js
program/steps/mail/compose.inc
@@ -42,6 +42,18 @@
    }
  }
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;
@@ -99,7 +111,6 @@
    {
    $_SESSION['compose']['draft_uid'] = $msg_uid;
    }
  }
/****** compose mode functions ********/
@@ -153,7 +164,6 @@
      $allow_attrib = array('id', 'class', 'style', 'size', 'tabindex');
      $field_type = 'textfield';
      break;
    }
 
  if ($fname && !empty($_POST[$fname]))
@@ -322,7 +332,6 @@
  return $out;
  }
  
function rcmail_compose_body($attrib)
@@ -683,7 +692,6 @@
  }
function rcmail_compose_attachment_form($attrib)
  {
  global $OUTPUT, $SESS_HIDDEN_FIELD;
@@ -859,7 +867,6 @@
  'receiptcheckbox' => 'rcmail_receipt_checkbox',
));
/****** get contacts for this user and add them to client scripts ********/
require_once('include/rcube_contacts.inc');
@@ -876,7 +883,6 @@
  
  $OUTPUT->set_env('contacts', $a_contacts);
  }
parse_template('compose');
?>
program/steps/mail/sendmail.inc
@@ -248,8 +248,21 @@
// 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']))
@@ -381,6 +394,5 @@
  $OUTPUT->command('sent_successfully', rcube_label('messagesent'));
  $OUTPUT->send('iframe');
  }
?>
program/steps/settings/edit_identity.inc
@@ -43,7 +43,6 @@
  $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'," .