Changeset 5604 for trunk/expressoMail1_2/js/draw_api.js
- Timestamp:
- 03/02/12 03:48:47 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/draw_api.js
r5600 r5604 1341 1341 return $(DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : $(this).find(".td_msg_subject").text(), type: "messages"})); 1342 1342 }, 1343 cursorAt: { cursor: "move", top: 5, left: 56},1343 cursorAt: {cursor: "move", top: 5, left: 56}, 1344 1344 refreshPositions: true , 1345 1345 scroll: true, … … 2966 2966 ['=', 'folderName', current_folder], 2967 2967 ['=','messageNumber',folder_id]], 2968 criteria : { deepness: 2}});2968 criteria : {deepness: 2}} ); 2969 2969 2970 2970 if(labels.length != 0){ … … 3421 3421 var form = document.createElement("FORM"); 3422 3422 form.name = "form_message_"+ID; 3423 form.id = "form_message_"+ID; 3423 3424 form.method = "POST"; 3425 form.action = "message:detail"; 3424 3426 form.onsubmit = function(){return false;} 3425 3427 if(!is_ie) … … 3427 3429 else 3428 3430 form.encoding="multipart/form-data"; 3431 3432 var aba_id = document.createElement("INPUT"); 3433 aba_id.style.display='none'; 3434 aba_id.name = "abaID"; 3435 aba_id.value = ID; 3436 form.appendChild(aba_id); 3429 3437 ///////////////////////////////////////////////////////////////////////////////////////////////////////// 3430 3438 //ConstructMenuNewMessage(ID); … … 4007 4015 }; 4008 4016 4009 var add_files = document.createElement("A"); 4010 add_files.setAttribute("href", "javascript:void(0)"); 4011 add_files.onclick = function () { 4012 var obj = addFile(ID); 4013 if (preferences.auto_save_draft == 1 && obj) { 4014 if ( obj.addEventListener ){ 4015 obj.addEventListener('click', save_onchange_attachment_handler, false); 4016 } 4017 } 4018 return false; 4019 }; 4020 4021 add_files.innerHTML = get_lang("Attachments: add+"); 4022 add_files.setAttribute("tabIndex","-1"); 4023 4024 var add_msgs = document.createElement("A"); 4025 add_msgs.setAttribute("href", "javascript:void(0)"); 4026 add_msgs.setAttribute("tabIndex","-1"); 4027 is_ie ? add_msgs.setAttribute("className", 'message-attach-link') : add_msgs.setAttribute("class", 'message-attach-link'); 4028 add_msgs.innerHTML = get_lang("Messages: add+"); 4029 var divfiles = document.createElement("DIV"); 4030 divfiles.id = "divFiles_"+ID; 4031 4032 jQuery(add_msgs).click(function(event){ 4017 4018 var tr5 = document.createElement("TR"); 4019 var td5_link = document.createElement("TD"); 4020 var td5_input = document.createElement("TD"); 4021 td5_input.innerHTML = " " 4022 td5_link.setAttribute("valign","top"); 4023 $(td5_link).append('<div id="message-attach-dialog" title="'+get_lang('Select messages to attach...')+'"> </div>'); 4024 $(td5_link).prepend(DataLayer.render("../prototype/modules/mail/templates/attachment.ejs", {ID:ID})); 4025 tr5.appendChild(td5_input); 4026 tr5.appendChild(td5_link); 4027 4028 tbody_message.appendChild(tr5); 4029 var tr6 = document.createElement("TR"); 4030 var td6_link = document.createElement("TD"); 4031 var td6_input = document.createElement("TD"); 4032 tr6.appendChild(td6_link); 4033 4034 tr6.appendChild(td6_input); 4035 tbody_message.appendChild(tr6); 4036 4037 var tr7 = document.createElement("TR"); 4038 //var td5 = document.createElement("TD"); 4039 //td5.innerHTML = " "; 4040 var td_body = document.createElement("TD"); 4041 td_body.setAttribute("colSpan","2"); 4042 var div_body_position = document.createElement("DIV"); 4043 div_body_position.id = "body_position_" + ID; 4044 td_body.appendChild(div_body_position); 4045 //tr5.appendChild(td5); 4046 tr7.appendChild(td_body); 4047 tbody_message.appendChild(tr7); 4048 var _div = document.createElement("DIV"); 4049 _div.id = "div_message_scroll_"+ID; 4050 _div.style.overflow = "auto"; 4051 _div.style.width = "100%"; 4052 4053 // Hide the contac tips and re-position the pallete color. 4054 _div.onscroll = function() { 4055 var intElemScrollTop = Element("div_message_scroll_"+ID).scrollTop; 4056 if (!is_ie) 4057 ColorPalette.repos(intElemScrollTop); 4058 Tooltip.scrollChanged(); 4059 }; 4060 ////////////////////////////////////////////////////////////////////////////////////////////////////// 4061 _div.appendChild(form); 4062 content.appendChild(_div); 4063 table_message.appendChild(tbody_message); 4064 form.appendChild(table_message); 4065 4066 var attDisposition = document.createElement("INPUT"); 4067 attDisposition.style.display='none'; 4068 attDisposition.id = 'attDisposition'+ID; 4069 attDisposition.name = 'attDisposition'+ID; 4070 attDisposition.value = 'attachment'; 4071 form.appendChild(attDisposition); 4072 4073 RichTextEditor.loadEditor(ID); 4074 4075 var rich_button = document.createElement("button"); 4076 4077 if(preferences.plain_text_editor == 1){ 4078 var texto = get_lang("Rich Text"); 4079 }else{ 4080 var texto = get_lang("Simple Text"); 4081 } 4082 4083 rich_button.innerHTML = texto; 4084 rich_button.className = "button small rich-button"; 4085 rich_button.name = "textplain_rt_checkbox_"+ID; 4086 4087 ////////////////////////////////////////////////////////////////////////////////////////////////////// 4088 if(!expresso_offline) 4089 draw_from_field(sel_from,tr1_1); 4090 4091 resizeWindow(); 4092 4093 if ( ! expresso_offline ) 4094 { 4095 if ( mobile_device ) 4096 { 4097 text_plain.click( ); 4098 text_plain.parentNode.style.display = 'none'; 4099 } 4100 } 4101 //var a_cc_link2 = document.createElement("button"); 4102 4103 $("#another_adress_"+ID).append(a_cc_link); 4104 4105 if(a_cco_link != undefined) 4106 $("#another_adress_"+ID).append(a_cco_link); 4107 4108 $("#another_adress_"+ID).append(rich_button); 4109 4110 $("#to_"+ID).elastic().unbind('blur'); 4111 $(".another_adress").button(); 4112 $(".rich-button").button(); 4113 $(".rich-button").click(function(){ 4114 //TO-DO : Se o usuário clicar varias vezes no botão, a função de iniciar o ckeditor se perde e morre. 4115 $(this).button({disabled: true}); 4116 if($(this).find("span:first-child").html() == get_lang("Rich text")){ 4117 $(this).find("span:first-child").html(get_lang("Simple Text")); 4118 }else{ 4119 $(this).find("span:first-child").html(get_lang("Rich Text")); 4120 } 4121 4122 var check = $("#"+$(this).attr("name")).attr("checked"); 4123 $("#"+$(this).attr("name")).attr("checked", (!check ? true : false)); 4124 $("#"+$(this).attr("name")).trigger('click'); 4125 $("#"+$(this).attr("name")).attr("checked", (!check ? true : false)); 4126 //$(this).button({ disabled: false }); 4127 if (RichTextEditor.plain[id] != true) 4128 setTimeout("RichTextEditor.focus("+ID+")",100); 4129 else 4130 $('#body_'+ID).focus(); 4131 }); 4132 4133 if($("#send_and_custom_save_"+ID)[0]) 4134 $("#send_and_custom_save_"+ID).button({ 4135 icons : { 4136 primary :"expressomail-icon-save_and_send" 4137 } 4138 }) 4139 $("#content_id_"+ID).find(".adress_button").button().click(function(){ 4140 emQuickSearch($("#"+($(this).attr("name"))+"_"+ID).val(), $(this).attr("name"), ID, undefined, true); 4141 }); 4142 4143 $("#send_button_"+ID).button({ 4144 icons : { 4145 primary : "expressomail-icon-send" 4146 } 4147 }).next().button({ 4148 icons : { 4149 primary : "expressomail-icon-save" 4150 } 4151 }); 4152 $("#content_id_"+ID).find("[name=return_receipt_"+ID+"]").button({ 4153 icons : { 4154 primary : "expressomail-icon-read-confirmation" 4155 } 4156 }); 4157 $("#important_message_options_"+ID).button({ 4158 icons : { 4159 primary : "expressomail-icon-important" 4160 } 4161 }); 4162 $("#return_digital_options_"+ID).button({ 4163 icons : { 4164 primary : "expressomail-icon-signature" 4165 } 4166 }); 4167 $("#return_cripto_options_"+ID).button({ 4168 icons : { 4169 primary : "expressomail-icon-encryption" 4170 } 4171 }); 4172 4173 $("#content_id_"+ID).find(".send_option").click(function(){ 4174 var check = $("#"+$(this).attr("name")).attr("checked"); 4175 $("#"+$(this).attr("name")).attr("checked", (!check ? true : false)); 4176 $(this).toggleClass("expressomail-button-icon-ative"); 4177 }); 4178 4179 var fileUploadMSG = $('#fileupload_msg'+ID); 4180 var maxAttachmentSise = (preferences.max_attachment_size !== "" && preferences.max_attachment_size != 0) ? (parseInt(preferences.max_attachment_size.replace('M', '')) * 1048576 ) : false; 4181 4182 fileUploadMSG.fileupload({ 4183 sequentialUploads: true, 4184 add: function (e, data) { 4185 if(!maxAttachmentSise || data.files[0].size < maxAttachmentSise) { 4186 setTimeout(function() { 4187 $('#attDisposition'+ID).val('attachment'); 4188 data.submit(); 4189 }, 5000); 4190 } 4191 }, 4192 change: function (e, data) { 4193 $.each(data.files, function (index, file) { 4194 var attach = {}; 4195 attach.fullFileName = file.name; 4196 attach.fileName = file.name; 4197 if(file.name.length > 10) 4198 attach.fileName = file.name.substr(0, 18) + "..." + file.name.substr(file.name.length-9, file.name.length); 4199 attach.fileSize = formatBytes(file.size); 4200 if(maxAttachmentSise && file.size > maxAttachmentSise) 4201 attach.error = 'Tamanho de arquivo nao permitido!!' 4202 4203 fileUploadMSG.find('.attachments-list').append(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); 4204 4205 if(!maxAttachmentSise || file.size < maxAttachmentSise){ 4206 fileUploadMSG.find('.fileinput-button.new').append(data.fileInput[0]).removeClass('new'); 4207 fileUploadMSG.find('.attachments-list').find('[type=file]').addClass('hidden'); 4208 }else 4209 fileUploadMSG.find(' .fileinput-button.new').removeClass('new'); 4210 4211 fileUploadMSG.find(' .attachments-list').find('.button.close').button({ 4212 icons: { 4213 primary: "ui-icon-close" 4214 }, 4215 text: false 4216 }).click(function(){ 4217 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 4218 fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); 4219 delAttachment(ID, idAttach) 4220 $(this).parent().remove(); 4221 }); 4222 4223 })}, 4224 4225 done: function(e, data){ 4226 if(!!data.result && data.result != "[]"){ 4227 var newAttach = jQuery.parseJSON(data.result); 4228 fileUploadMSG.find('.in-progress:first').parents('p').append('<input type="hidden" name="fileId[]" value="'+newAttach['mailAttachment'][0][0].id+'"/>'); 4229 addAttachment(ID,newAttach['mailAttachment'][0][0].id); 4230 4231 }else { 4232 fileUploadMSG.find(' .progress.on-complete:first').removeClass('on-complete').parents('p').find('.status-upload').addClass('ui-icon ui-icon-cancel'); 4233 } 4234 fileUploadMSG.find(' .in-progress:first').remove(); 4235 4236 4237 } 4238 }); 4239 4240 fileUploadMSG.find("span.message-attach-link").click(function(event){ 4033 4241 jQuery('#message-attach-dialog').html(DataLayer.render("../prototype/modules/attach_message/attach_message.ejs", {})); 4034 4242 jQuery('#message-attach-dialog').dialog({ … … 4043 4251 jQuery.getScript("../prototype/modules/attach_message/attach_message.js", function(){ 4044 4252 jQuery('#message-attach-dialog').dialog('open'); 4045 4046 4253 jQuery('#message-attach-attach-btn').click(function(event){ 4047 //alert(dump(selectedMessages));../4048 4254 jQuery.each(selectedMessages, function(folder_name, messages) { 4049 4050 var isOffline = /^local_messages/.test(folder_name);4051 4052 4255 jQuery.each(selectedMessages[folder_name], function(message_number, message) { 4053 4256 if (message) { 4054 var subject = onceOpenedMessages[folder_name][message_number].subject; 4055 var text_input = '<input type="text" name="message_attachments['+folder_name+']['+message_number+']" value="'+subject+'"/>'; 4056 text_input += '<a href="javascript:void(0)" onclick="javascript:this.parentNode.parentNode.removeChild(this.parentNode);">' + get_lang("Remove")+'</a>'; 4057 if( isOffline ) 4058 text_input += '<input type="hidden" name="message_attachments_content['+folder_name+']['+message_number+']" value="'+Base64.encode( onceOpenedMessages[folder_name][message_number].eml )+'"/>'; 4059 jQuery(divfiles).append('<div>'+text_input+'</div>'); 4257 var att = new Object(); 4258 att.foder = folder_name; 4259 att.uid = message_number; 4260 att.name = onceOpenedMessages[folder_name][message_number].subject + '.eml'; 4261 var idATT = JSON.stringify(att); 4262 addAttachment( ID , idATT); 4263 var attach = {}; 4264 attach.fileName = att.name 4265 attach.fileSize = formatBytes(onceOpenedMessages[folder_name][message_number].size); 4266 var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); 4267 upload.find('.status-upload').remove(); 4268 upload.find('.in-progress').remove(); 4269 upload.find('p').append('<input type="hidden" name="fileId[]" value=\''+idATT+'\'/>'); 4270 fileUploadMSG.find('.attachments-list').append(upload); 4271 4060 4272 } 4061 4273 … … 4064 4276 4065 4277 jQuery('#message-attach-dialog').dialog('close'); 4278 4279 //botao fechar 4280 $('.attachments-list').find('.button.close').button({ 4281 icons: { 4282 primary: "ui-icon-close" 4283 }, 4284 text: false 4285 }).click(function(){ 4286 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 4287 fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]'); 4288 delAttachment(ID,idAttach); 4289 $(this).parent().remove(); 4290 }); 4291 4066 4292 }); 4067 4293 jQuery('#message-attach-cancel-btn').click(function(event){ 4068 4294 jQuery('#message-attach-dialog').dialog('close'); 4069 }); 4295 }); 4070 4296 }); 4297 4071 4298 }); 4072 var tr5 = document.createElement("TR"); 4073 var td5_link = document.createElement("TD"); 4074 var td5_input = document.createElement("TD"); 4075 td5_input.innerHTML = " " 4076 //td5_input.style.width = "1%"; 4077 td5_link.setAttribute("valign","top"); 4078 //td5_link.setAttribute("colSpan","2"); 4079 td5_link.appendChild(add_files); 4080 td5_link.appendChild(add_msgs); 4081 $(td5_link).append('<div id="message-attach-dialog" title="'+get_lang('Select messages to attach...')+'"> </div>'); 4082 tr5.appendChild(td5_input); 4083 tr5.appendChild(td5_link); 4084 tbody_message.appendChild(tr5); 4085 var tr6 = document.createElement("TR"); 4086 var td6_link = document.createElement("TD"); 4087 var td6_input = document.createElement("TD"); 4088 //td6_link.style.width = "1%"; 4089 tr6.appendChild(td6_link); 4090 td6_input.appendChild(divfiles); 4091 tr6.appendChild(td6_input); 4092 tbody_message.appendChild(tr6); 4093 ////////////////////////////////////////////////////////////////////////////////////////////////////// 4094 var tr5 = document.createElement("TR"); 4095 //var td5 = document.createElement("TD"); 4096 //td5.innerHTML = " "; 4097 var td_body = document.createElement("TD"); 4098 td_body.setAttribute("colSpan","2"); 4099 var div_body_position = document.createElement("DIV"); 4100 div_body_position.id = "body_position_" + ID; 4101 td_body.appendChild(div_body_position); 4102 //tr5.appendChild(td5); 4103 tr5.appendChild(td_body); 4104 tbody_message.appendChild(tr5); 4105 var _div = document.createElement("DIV"); 4106 _div.id = "div_message_scroll_"+ID; 4107 _div.style.overflow = "auto"; 4108 _div.style.width = "100%"; 4109 4110 // Hide the contac tips and re-position the pallete color. 4111 _div.onscroll = function() { 4112 var intElemScrollTop = Element("div_message_scroll_"+ID).scrollTop; 4113 if (!is_ie) 4114 ColorPalette.repos(intElemScrollTop); 4115 Tooltip.scrollChanged(); 4116 }; 4117 ////////////////////////////////////////////////////////////////////////////////////////////////////// 4118 _div.appendChild(form); 4119 content.appendChild(_div); 4120 table_message.appendChild(tbody_message); 4121 form.appendChild(table_message); 4122 RichTextEditor.loadEditor(ID); 4123 4124 var rich_button = document.createElement("button"); 4125 4126 if(preferences.plain_text_editor == 1){ 4127 var texto = get_lang("Rich Text"); 4128 }else{ 4129 var texto = get_lang("Simple Text"); 4130 } 4131 4132 rich_button.innerHTML = texto; 4133 rich_button.className = "button small rich-button"; 4134 rich_button.name = "textplain_rt_checkbox_"+ID; 4135 4136 ////////////////////////////////////////////////////////////////////////////////////////////////////// 4137 if(!expresso_offline) 4138 draw_from_field(sel_from,tr1_1); 4139 4140 resizeWindow(); 4141 4142 if ( ! expresso_offline ) 4143 { 4144 if ( mobile_device ) 4145 { 4146 text_plain.click( ); 4147 text_plain.parentNode.style.display = 'none'; 4148 } 4149 } 4150 //var a_cc_link2 = document.createElement("button"); 4151 4152 $("#another_adress_"+ID).append(a_cc_link); 4153 4154 if(a_cco_link != undefined) 4155 $("#another_adress_"+ID).append(a_cco_link); 4156 4157 $("#another_adress_"+ID).append(rich_button); 4158 4159 $("#to_"+ID).elastic().unbind('blur'); 4160 //$(".mail_fields"); 4161 //$(".mail_fields").css("width","100%"); 4162 4163 $(".another_adress").button(); 4164 $(".rich-button").button(); 4165 $(".rich-button").click(function(){ 4166 //TO-DO : Se o usuário clicar varias vezes no botão, a função de iniciar o ckeditor se perde e morre. 4167 $(this).button({disabled: true}); 4168 if($(this).find("span:first-child").html() == get_lang("Rich text")){ 4169 $(this).find("span:first-child").html(get_lang("Simple Text")); 4170 }else{ 4171 $(this).find("span:first-child").html(get_lang("Rich Text")); 4172 } 4173 4174 var check = $("#"+$(this).attr("name")).attr("checked"); 4175 $("#"+$(this).attr("name")).attr("checked", (!check ? true : false)); 4176 $("#"+$(this).attr("name")).trigger('click'); 4177 $("#"+$(this).attr("name")).attr("checked", (!check ? true : false)); 4178 //$(this).button({ disabled: false }); 4179 if (RichTextEditor.plain[id] != true) 4180 setTimeout("RichTextEditor.focus("+ID+")",100); 4181 else 4182 $('#body_'+ID).focus(); 4183 }); 4184 4185 if($("#send_and_custom_save_"+ID)[0]) 4186 $("#send_and_custom_save_"+ID).button({ 4187 icons : { 4188 primary :"expressomail-icon-save_and_send" 4189 } 4190 }) 4191 $("#content_id_"+ID).find(".adress_button").button().click(function(){ 4192 emQuickSearch($("#"+($(this).attr("name"))+"_"+ID).val(), $(this).attr("name"), ID, undefined, true); 4193 }); 4194 4195 $("#send_button_"+ID).button({ 4196 icons : { 4197 primary : "expressomail-icon-send" 4198 } 4199 }).next().button({ 4200 icons : { 4201 primary : "expressomail-icon-save" 4202 } 4203 }); 4204 $("#content_id_"+ID).find("[name=return_receipt_"+ID+"]").button({ 4205 icons : { 4206 primary : "expressomail-icon-read-confirmation" 4207 } 4208 }); 4209 $("#important_message_options_"+ID).button({ 4210 icons : { 4211 primary : "expressomail-icon-important" 4212 } 4213 }); 4214 $("#return_digital_options_"+ID).button({ 4215 icons : { 4216 primary : "expressomail-icon-signature" 4217 } 4218 }); 4219 $("#return_cripto_options_"+ID).button({ 4220 icons : { 4221 primary : "expressomail-icon-encryption" 4222 } 4223 }); 4224 4225 $("#content_id_"+ID).find(".send_option").click(function(){ 4226 var check = $("#"+$(this).attr("name")).attr("checked"); 4227 $("#"+$(this).attr("name")).attr("checked", (!check ? true : false)); 4228 $(this).toggleClass("expressomail-button-icon-ative"); 4229 }); 4230 4299 // 4231 4300 return ID; 4232 4301 }
Note: See TracChangeset
for help on using the changeset viewer.