thomascube
2011-08-29 f7b58afb94ba5da1dd7b1e2fa7b67c398b4d3d1e
Make list of mimetypes that open in preview window configurable (#1487625)

4 files modified
18 ■■■■■ changed files
CHANGELOG 2 ●●●●● patch | view | raw | blame | history
config/main.inc.php.dist 5 ●●●●● patch | view | raw | blame | history
program/js/app.js 7 ●●●● patch | view | raw | blame | history
program/steps/mail/show.inc 4 ●●●● patch | view | raw | blame | history
CHANGELOG
@@ -1,6 +1,8 @@
CHANGELOG Roundcube Webmail
===========================
- Make list of mimetypes that open in preview window configurable (#1487625)
- Added plugin hook 'message_part_get' for attachment downloads
- Localize forwarded message header (#1488058)
- Added unique connection identifier to IMAP debug messages
- Added 'priority' column on messages list (#1486782)
config/main.inc.php.dist
@@ -326,6 +326,11 @@
// 3 - one identity with possibility to edit all params but not email address
$rcmail_config['identities_level'] = 0;
// Mimetypes supported by the browser.
// attachments of these types will open in a preview window
// either a comma-separated list or an array: 'text/plain,text/html,text/xml,image/jpeg,image/gif,image/png,application/pdf'
$rcmail_config['client_mimetypes'] = null;  # null == default
// mime magic database
$rcmail_config['mime_magic'] = '/usr/share/misc/magic';
program/js/app.js
@@ -41,11 +41,6 @@
  this.identifier_expr = new RegExp('[^0-9a-z\-_]', 'gi');
  // mimetypes supported by the browser (default settings)
  this.mimetypes = new Array('text/plain', 'text/html', 'text/xml',
    'image/jpeg', 'image/gif', 'image/png',
    'application/x-javascript', 'application/pdf', 'application/x-shockwave-flash');
  // default environment vars
  this.env.keep_alive = 60;        // seconds
  this.env.request_timeout = 180;  // seconds
@@ -749,7 +744,7 @@
        var qstring = '_mbox='+urlencode(this.env.mailbox)+'&_uid='+this.env.uid+'&_part='+props.part;
        // open attachment in frame if it's of a supported mimetype
        if (this.env.uid && props.mimetype && $.inArray(props.mimetype, this.mimetypes)>=0) {
        if (this.env.uid && props.mimetype && this.env.mimetypes && $.inArray(props.mimetype, this.env.mimetypes)>=0) {
          if (props.mimetype == 'text/html')
            qstring += '&_safe=1';
          this.attachment_win = window.open(this.env.comm_path+'&_action=get&'+qstring+'&_frame=1', 'rcubemailattachment');
program/steps/mail/show.inc
@@ -52,6 +52,10 @@
  $OUTPUT->set_env('delimiter', $IMAP->get_hierarchy_delimiter());
  $OUTPUT->set_env('mailbox', $mbox_name);
  // mimetypes supported by the browser (default settings)
  $mimetypes = $RCMAIL->config->get('client_mimetypes', 'text/plain,text/html,text/xml,image/jpeg,image/gif,image/png,application/x-javascript,application/pdf,application/x-shockwave-flash');
  $OUTPUT->set_env('mimetypes', is_string($mimetypes) ? explode(',', $mimetypes) : (array)$mimetypes);
  if ($CONFIG['trash_mbox'])
    $OUTPUT->set_env('trash_mailbox', $CONFIG['trash_mbox']);
  if ($CONFIG['flag_for_deletion'])