Projeto

Geral

Perfil

issue_98_perda_formatcao.patch

Alexandre Luiz Correia, 18/04/2019 14:10 h

Baixar (14,8 KB)

Ver diferenças:

expressoMail1_2/inc/class.imap_functions.inc.php
1502 1502

  
1503 1503
		// Layout problem: Change html elements
1504 1504
		// with absolute position to relate position, CASE INSENSITIVE.
1505
                $body = str_replace("\x00", '', $body);
1506
                $body = @mb_eregi_replace("POSITION: ABSOLUTE;","",$body);
1505
        $body = str_replace("\x00", '', $body);
1506
        $body = @mb_eregi_replace("POSITION: ABSOLUTE;","",$body);
1507 1507

  
1508
		$tag_list = Array('head','blink','object','frame',
1508
		$tag_list = array('blink','object','frame',
1509 1509
			'iframe','layer','ilayer','plaintext','script','base',
1510
			'applet','embed','frameset','xml','xmp','style');
1510
			'applet','embed','frameset','xml','xmp');
1511 1511

  
1512 1512
		$blocked_tags = array();
1513 1513
		foreach($tag_list as $index => $tag) {
expressoMail1_2/js/draw_api.js
2017 2017
	//td.setAttribute("colSpan","2");
2018 2018
	newBody = newBody.replace("<body","<span");
2019 2019
	newBody = newBody.replace("<BODY","<span");
2020
	while ( ( /<span[^>]*><span[^>]*>/ig ).test( newBody ) )
2020
	while ( ( /<span[^>]*><span[^>]*>/ig ).test( newBody ) ){
2021 2021
		newBody = newBody.replace( /(<span[^>]*>)<span[^>]*>/ig, '$1' );
2022
	}
2022 2023

  
2023
	var _body = document.createElement( 'div' );
2024
	_body.id = 'body_' + ID;
2025
	_body.innerHTML = newBody;
2026
	_body.style.fontSize = '16px';
2024
	var bodyMessage = $("<iframe/>");
2025
	bodyMessage.attr('id','body_' + ID);
2026
	bodyMessage.attr('width','100%');
2027
	bodyMessage.attr('height','100%');
2028
	bodyMessage.attr('frameborder','0');
2027 2029

  
2028
	var _elements = _body.getElementsByTagName( '*' );
2029
	for( var i = 0; i < _elements.length; i++ )
2030
		if ( _elements[ i ].attributes && _elements[ i ].attributes.getNamedItem( 'id' ) )
2031
			_elements[ i ].attributes.removeNamedItem( 'id' );
2030
	bodyMessage.on('load', function(){
2031
		$(this).contents().find('body').html( newBody );
2032
	});
2032 2033

  
2033
	div.appendChild( _body );
2034
	div.appendChild( $(bodyMessage)[0] );
2034 2035

  
2035 2036
	function mailto( link )
2036 2037
	{
expressoMail1_2/js/main.js
1157 1157
		data.cco = data.cco.replace(/&lt;/gi,"<");
1158 1158
		data.cco = data.cco.replace(/&gt;/gi,">");
1159 1159
	}
1160
	if (document.getElementById("subject_" + border_ID))
1160
	if (document.getElementById("subject_" + border_ID)){
1161 1161
		data.subject = document.getElementById("subject_" + border_ID).innerHTML;
1162
	if (document.getElementById("body_" + border_ID))
1163
		data.body = document.getElementById("body_" + border_ID).innerHTML;
1162
	}
1163
	
1164
	if( $("#body_" + border_ID ) ){
1165

  
1166
		var messageBody = $("#body_" + border_ID).contents().find("html").clone(true);
1167

  
1168
		// Clean styles
1169
		$(messageBody).find("style").each( function(){
1170
			
1171
			var contentStyle = $(this).html();
1172
		
1173
			contentStyle = contentStyle.replace(/\/*/gi, '' );
1174
			contentStyle = contentStyle.replace(/\*\//gi, '' );
1175

  
1176
			$(this).html( "/*" + contentStyle + "*/" );
1177
		});
1178

  
1179
		// Clean link
1180
		$(messageBody).find("link").each( function(){
1181
			
1182
			var tagLink = $(this);
1183

  
1184
			$.each( this.attributes, function(){
1185
				
1186
				this.value = this.value.replace( /##/gi, '');
1187
				
1188
				$(tagLink).attr( this.name, "##" + this.value + "##" );
1189
			});
1190
		});
1191

  
1192
		data.body = $(messageBody).html();
1193
	}
1164 1194

  
1165 1195
	if (Element('date_' + border_ID)){
1166 1196
		data.date = Element('date_' + border_ID).innerHTML;
......
1169 1199
	if (Element('date_day_' + border_ID)){
1170 1200
		data.date_day = Element('date_day_' + border_ID).value;
1171 1201
	}
1202
	
1172 1203
	if (Element('date_hour_' + border_ID)){
1173 1204
		data.date_hour = Element('date_hour_' + border_ID).value;
1174 1205
	}
1175
	if(typeof(preferences.signature) == 'undefined')
1206
	
1207
	if( typeof(preferences.signature) == 'undefined' ){
1176 1208
		preferences.signature = "";
1209
	}
1177 1210

  
1178 1211
	var signature = preferences.type_signature == 'html' ? preferences.signature : preferences.signature.replace(/\n/g, "<br>");
1179 1212

  
......
1192 1225
				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>");
1193 1226
			}
1194 1227
			else{
1195
			body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'></body></html>");
1228
				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'></body></html>");
1196 1229
			}
1197 1230
			body.contentWindow.document.close();
1198 1231
			body.contentWindow.document.designMode = "on";
......
1227 1260
			// Insert the signature automaticaly at message body if use_signature preference is set
1228 1261
			if ( ( !preferences.auto_signature ) && preferences.use_signature == "1") {
1229 1262
				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>" + block_quoted_body + "</body></html>");
1230
			}
1231
			else {
1232
			body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+block_quoted_body+"</body></html>");
1263
			} else {
1264
				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+block_quoted_body+"</body></html>");
1233 1265
			}
1234 1266
			body.contentWindow.document.close();
1235 1267
			body.contentWindow.document.designMode = "on";
......
1280 1312
			// Insert the signature automaticaly at message body if use_signature preference is set
1281 1313
			if ( ( !preferences.auto_signature ) && preferences.use_signature == "1") {
1282 1314
				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>");
1283
			}
1284
			else {
1285
			body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'></body></html>");
1315
			} else {
1316
				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'></body></html>");
1286 1317
			}
1287 1318
			body.contentWindow.document.close();
1288 1319
			body.contentWindow.document.designMode = "on";
......
1310 1341
			// delete user email from to_all array.
1311 1342
			data.to_all = new Array();
1312 1343
			var j = 0;
1313
				for(i = 0; i < _array_to_all.length; i++) {
1314
				if(_array_to_all[i].lastIndexOf(Element("user_email").value) == "-1"){
1315
					data.to_all[j++] = _array_to_all[i];
1316
				}
1317
		}
1318
			if (data.to_all != get_lang("undisclosed-recipient"))
1344
            for(i = 0; i < _array_to_all.length; i++) {
1345
                if(_array_to_all[i].lastIndexOf(Element("user_email").value) == "-1"){
1346
                    data.to_all[j++] = _array_to_all[i];
1347
                }
1348
            }
1349
			if (data.to_all != get_lang("undisclosed-recipient")){
1319 1350
				data.to_all = data.to_all.join(",");
1320
			else
1351
			} else {
1321 1352
				data.to_all = "";
1353
			}
1322 1354
			title = "Re: " + data.subject;
1323 1355
			Element("to_" + new_border_ID).value = data.to;
1324 1356
			Element("to_" + new_border_ID).value += ', ' + data.to_all;
......
1336 1368
			// Insert the signature automaticaly at message body if use_signature preference is set
1337 1369
			if ( ( !preferences.auto_signature ) && preferences.use_signature == "1") {
1338 1370
				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>" + block_quoted_body + "</body></html>");
1339
			}
1340
			else {
1341
			body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+block_quoted_body+"</body></html>");
1371
			} else {
1372
                body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+block_quoted_body+"</body></html>");
1342 1373
			}
1343 1374
			body.contentWindow.document.close();
1344 1375
			body.contentWindow.document.designMode = "on";
1345 1376
			//Focus
1346
			if (is_ie)
1347
				window.setTimeout('document.getElementById("body_'+new_border_ID+'").contentWindow.focus();', 300);
1348
			else
1349
				body.contentWindow.focus();
1377
			if (is_ie){
1378
                window.setTimeout('document.getElementById("body_'+new_border_ID+'").contentWindow.focus();', 300);
1379
			} else {
1380
                body.contentWindow.focus();
1381
			}
1350 1382
			config_events( body.contentWindow.document, 'onkeyup', function( e )
1351 1383
			{
1352 1384
				if ( e.keyCode == 13 )
......
1422 1454
			// Insert the signature automaticaly at message body if use_signature preference is set
1423 1455
			if ( ( !preferences.auto_signature ) && preferences.use_signature == "1") {
1424 1456
				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>" + make_forward_body(data.body, data.to, data.date, data.subject, data.to_all, data.cc) + "</body></html>");
1425
			}
1426
			else {
1427
			body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+make_forward_body(data.body, data.to, data.date, data.subject, data.to_all, data.cc)+"</body></html>");
1457
			} else {
1458
                body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+make_forward_body(data.body, data.to, data.date, data.subject, data.to_all, data.cc)+"</body></html>");
1428 1459
			}
1429 1460
			body.contentWindow.document.close();
1430 1461
			body.contentWindow.document.designMode = "on";
......
1468 1499
			// Insert the signature automaticaly at message body if use_signature preference is set
1469 1500
			if ( ( !preferences.auto_signature ) && preferences.use_signature == "1") {
1470 1501
				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>");
1471
			}
1472
			else {
1473
			body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'></body></html>");
1502
			} else {
1503
                body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'></body></html>");
1474 1504
			}
1475 1505
			body.contentWindow.document.close();
1476 1506
			body.contentWindow.document.designMode = "on";
......
2428 2458
	var date                = Element('date_'+border_ID);
2429 2459
	var subject             = Element('subject_'+border_ID);
2430 2460
	var attachments         = Element('attachments_'+border_ID);
2431
	var body                = Element('body_'+border_ID);
2432
	
2461
	var body                = $('#body_'+border_ID).contents().find("html");
2462

  
2433 2463
	if(!is_ie)
2434 2464
	{
2435 2465
		var link = location.href.replace(/\/expressoMail1_2\/(.*)/, "");
2436
		var tab_tags = body.getElementsByTagName("IMG");
2466
		var tab_tags = $(body)[0].getElementsByTagName("IMG");
2437 2467
		for(var i = 0; i < tab_tags.length;i++)
2438 2468
		{
2439 2469
			var _img = document.createElement("IMG");
......
2505 2535
			html += "<tr><td width=7%><font size='2'>" + get_lang('Subject')+ ": </font></td><td><font size='2'>"+subject.innerHTML+"</font></td></tr>";
2506 2536
			html += show_attachs; //to show the names of the attachments
2507 2537
			html += "</tbody></table><hr>";
2508
			window_print.document.write(html + body.innerHTML);
2538
			window_print.document.write(html + $(body).html() );
2509 2539
			if(!is_ie){
2510 2540
				var tab_tags = window_print.document.getElementsByTagName("IMG");
2511 2541
				for(var i = 0; i < tab_tags.length;i++)
expressoMail1_2/js/rich_text_editor.js
34 34
	document.getElementById('fontsize').selectedIndex = 0;
35 35
}
36 36

  
37
cRichTextEditor.prototype.createElementEditor = function(pObj)
38
{
39
		iframe = document.createElement("IFRAME");
40
		iframe.id = pObj;
41
		iframe.name = pObj;
42
		iframe.width = "100%";
43
		iframe.height = 300;
44
		iframe.setAttribute("unselectable","on");
45
		iframe.setAttribute("tabIndex","1");
46
		iframe.setAttribute( 'frameborder', '0' );
47

  
48
		config_events( iframe, 'onload', function( )
49
		{
50
			if ( iframe.contentWindow.document.body && iframe.contentWindow.document.body.contentEditable ) {
51
				
52
				if(mobile_device)
53
					iframe.contentWindow.document.body.contentEditable = true;
54
				else
55
					iframe.contentWindow.document.designMode = "on";
56
			}
57
			
58
			if ( iframe.contentWindow.document.documentElement ){
59
				iframe.contentWindow.document.documentElement.style.background = '#fff';
60
				iframe.contentWindow.document.documentElement.style.fontSize = '16px';
37
cRichTextEditor.prototype.createElementEditor = function (pObj) {
38

  
39
	var IDEditor = this.id;
40

  
41
	var iframe = $("<iframe/>")
42
	iframe.attr('id', pObj);
43
	iframe.attr('name', pObj);
44
	iframe.attr('width', "100%");
45
	iframe.attr('unselectable', 'on');
46
	iframe.attr('tabIndex', '1');
47
	iframe.attr('frameborder', '0');
48

  
49
	var resizeIframe = function(){
50

  
51
		var idTag = 'div_message_scroll_' + IDEditor;
52
		var heightIframe = parseFloat($("div[id=" + idTag + "]").height() * 0.69);
53
		iframe.attr('height', heightIframe);
54
	};
55

  
56
	config_events($(iframe)[0], 'onload', function () {
57
		if ($(iframe)[0].contentWindow.document.body && $(iframe)[0].contentWindow.document.body.contentEditable) {
58
			if (mobile_device) {
59
				$(iframe)[0].contentWindow.document.body.contentEditable = true;
60
			} else {
61
				$(iframe)[0].contentWindow.document.designMode = "on";
61 62
			}
62
		});
63

  
64
		var div_iframe = $('<div style="border: 2px solid; border-color: #111 #b2b2c1 #b2b2c1 #111;">').append( iframe );
65
		if ( preferences.auto_signature ) div_iframe.append( $('<iframe id="signature_ro_'+this.id+'" width="100%" frameborder="0">') );
66
		parentDiv.appendChild( div_iframe[0] );
67

  
68
		var source = document.createElement( 'input' );
69
		source.id = 'viewsource_rt_checkbox_' + this.id;
70
		source.type = "checkbox";
71
		source.setAttribute("tabIndex","-1");
72
		source.onclick = function( )
73
		{
74
			RichTextEditor.viewsource(this.checked);
75
		};
76
		source = parentDiv.appendChild(
77
			document.createElement( 'span' ).appendChild( source ).parentNode
78
		).appendChild(
79
			document.createTextNode( get_lang( 'View HTML source' ) + '.' )
80
		).parentNode;
63
		}
64

  
65
		if ($(iframe)[0].contentWindow.document.documentElement) {
66
			$(iframe)[0].contentWindow.document.documentElement.style.background = '#fff';
67
			$(iframe)[0].contentWindow.document.documentElement.style.fontSize = '16px';
68
		}
69

  
70
		resizeIframe();
71

  
72
	});
73

  
74
	var div_iframe = $('<div style="border: 2px solid; border-color: #111 #b2b2c1 #b2b2c1 #111;">').append($(iframe)[0]);
75

  
76
	if (preferences.auto_signature) { div_iframe.append($('<iframe id="signature_ro_' + this.id + '" width="100%" frameborder="0">')) };
77

  
78
	parentDiv.appendChild(div_iframe[0]);
79

  
80
	$(window).on("resize", function () { resizeIframe(); });
81

  
82
	var source = document.createElement('input');
83
	source.id = 'viewsource_rt_checkbox_' + this.id;
84
	source.type = "checkbox";
85
	source.setAttribute("tabIndex", "-1");
86
	source.onclick = function () {
87
		RichTextEditor.viewsource(this.checked);
88
	};
89
	source = parentDiv.appendChild(
90
		document.createElement('span').appendChild(source).parentNode
91
	).appendChild(
92
		document.createTextNode(get_lang('View HTML source') + '.')
93
	).parentNode;
81 94
}
82 95

  
83 96
cRichTextEditor.prototype.loadStyle = function(tag, css_file) {