Changeset 3845 in subversion for trunk/roundcubemail/program/steps/mail/func.inc
- Timestamp:
- Jul 30, 2010 12:58:27 PM (3 years ago)
- File:
-
- 1 edited
-
trunk/roundcubemail/program/steps/mail/func.inc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/steps/mail/func.inc
r3840 r3845 987 987 $body = rcmail_print_body($part, array('safe' => $safe_mode, 'plain' => !$CONFIG['prefer_html'])); 988 988 989 if ($part->ctype_secondary == 'html') 990 $out .= html::div('message-htmlpart', rcmail_html4inline($body, $attrib['id'], 'div.rcmBody')); 989 if ($part->ctype_secondary == 'html') { 990 $body = rcmail_html4inline($body, $attrib['id'], 'rcmBody', $color); 991 $div_attr = array('class' => 'message-htmlpart'); 992 if ($color) 993 $div_attr['style'] = 'background-color: '.$color; 994 995 $out .= html::div($div_attr, $body); 996 } 991 997 else 992 998 $out .= html::div('message-part', $body); … … 1047 1053 * modify a HTML message that it can be displayed inside a HTML page 1048 1054 */ 1049 function rcmail_html4inline($body, $container_id, $body_id='' )1055 function rcmail_html4inline($body, $container_id, $body_id='', &$body_color='') 1050 1056 { 1051 1057 $last_style_pos = 0; … … 1058 1064 1059 1065 // replace all css definitions with #container [def] 1060 $styles = rcmail_mod_css_styles(substr($body, $pos, $pos2-$pos), $container_id.($body_id ? ' '.$body_id : '')); 1066 $styles = rcmail_mod_css_styles(substr($body, $pos, $pos2-$pos), 1067 $container_id.($body_id ? ' div.'.$body_id : '')); 1061 1068 1062 1069 $body = substr($body, 0, $pos) . $styles . substr($body, $pos2); … … 1094 1101 '<?', 1095 1102 '?>', 1096 '<div class=" rcmBody"\\1>',1103 '<div class="'.$body_id.'"\\1>', 1097 1104 '</div>', 1098 1105 ), 1099 1106 $body); 1100 1107 1108 // Get rcmBody's bgcolor attribute, we'll set the color to the body container 1109 // as background-color, bgcolor doesn't work with a div 1110 if (preg_match('/<div class="' . preg_quote($body_id, '/') . '" ([^>]+)>/', $out, $m)) { 1111 if (preg_match('/bgcolor=["\']*([a-z0-9#]+)["\']*/', $m[0], $mb)) { 1112 $body_color = $mb[1]; 1113 } 1114 } 1101 1115 // make sure there's 'rcmBody' div, we need it for proper css modification 1102 1116 // its name is hardcoded in rcmail_message_body() also 1103 if (!preg_match('/<div class="rcmBody"/', $out))1104 $out = '<div class=" rcmBody">' . $out . '</div>';1117 else 1118 $out = '<div class="' . $body_id . '">' . $out . '</div>'; 1105 1119 1106 1120 return $out;
Note: See TracChangeset
for help on using the changeset viewer.
