[2551] | 1 | // Objeto Map, talvez o ideal fosse adicionar este objeto à Api do egroupware, e carregá-lo |
---|
| 2 | // aqui no expressoMail. |
---|
| 3 | function Map() |
---|
| 4 | { |
---|
| 5 | this.keys = new Array(); |
---|
| 6 | this.values = new Array(); |
---|
| 7 | } |
---|
| 8 | |
---|
| 9 | Map.prototype.add = function(key, value) |
---|
| 10 | { |
---|
| 11 | this.keys.push(key); |
---|
| 12 | this.values.push(value); |
---|
| 13 | }; |
---|
| 14 | |
---|
| 15 | Map.prototype.get = function(key) |
---|
| 16 | { |
---|
| 17 | result = new Array(); |
---|
| 18 | for (i = 0; i < this.keys.length; i++) |
---|
| 19 | { |
---|
| 20 | if (this.keys[i] == key) |
---|
| 21 | { |
---|
| 22 | result.push(this.values[i]); |
---|
| 23 | } |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | if (result.length == 0) |
---|
| 27 | { |
---|
| 28 | return null; |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | return result; |
---|
| 32 | }; |
---|
| 33 | |
---|
| 34 | var translatedFolders = new Map(); |
---|
| 35 | |
---|
[2715] | 36 | /* Class draw_message */ |
---|
| 37 | function draw_message(){ |
---|
[2718] | 38 | var id=0; |
---|
[2551] | 39 | } |
---|
[2718] | 40 | draw_message.prototype.createNxtPrevButtons = function(msg_folder,folder_id){ |
---|
[2694] | 41 | var next_previous_msg_td = createAndSet("TD",[ "noWrap", "align", "width" ], [ "true", "right", "40px"]); |
---|
| 42 | var img_next_msg = createAndSet("IMG", [ 'id', 'src', 'title' ], [ |
---|
[2718] | 43 | 'msg_opt_next_' + this.id, |
---|
[2694] | 44 | URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/down.button.png', |
---|
| 45 | get_lang('Next') ]); |
---|
[2551] | 46 | img_next_msg.style.cursor = 'pointer'; |
---|
| 47 | |
---|
| 48 | var folder = document.getElementById(folder_id); |
---|
| 49 | if (folder){ // mensagem local criptografada nao tem ID da pasta local |
---|
| 50 | if (folder.nextSibling){ |
---|
[2714] | 51 | var nextMsgBox = folder.nextSibling.name?folder.nextSibling.name:msg_folder; |
---|
[2551] | 52 | |
---|
| 53 | if (nextMsgBox == "INBOX/decifradas")// teste para ver se a mensagem vem da pasta oculta decifradas |
---|
| 54 | nextMsgBox = get_current_folder(); |
---|
| 55 | |
---|
| 56 | img_next_msg.onclick = function() |
---|
| 57 | { |
---|
[2714] | 58 | openTab.type[currentTab] = 2; |
---|
| 59 | if ( nextMsgBox == undefined ) |
---|
| 60 | nextMsgBox = current_folder; |
---|
| 61 | var allHeaders = folderHeaders[nextMsgBox]; |
---|
| 62 | for (i in allHeaders) |
---|
| 63 | if (allHeaders[i].msg_number == folder.nextSibling.id){ |
---|
| 64 | var nextHeader = allHeaders[i]; |
---|
| 65 | break; |
---|
| 66 | } |
---|
| 67 | proxy_mensagens.get_msg(nextHeader,nextMsgBox,true,show_msg,currentTab); |
---|
[2551] | 68 | }; |
---|
| 69 | } |
---|
| 70 | else |
---|
| 71 | { |
---|
[2630] | 72 | img_next_msg.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/down.gray.button.png'; |
---|
[2551] | 73 | img_next_msg.style.cursor = 'default'; |
---|
| 74 | } |
---|
| 75 | } |
---|
| 76 | else |
---|
| 77 | { |
---|
[2630] | 78 | img_next_msg.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/down.gray.button.png'; |
---|
[2551] | 79 | img_next_msg.style.cursor = 'default'; |
---|
[2714] | 80 | if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(msg_folder == "INBOX/decifradas")) // testa se a mensagem e local |
---|
[2551] | 81 | { |
---|
| 82 | img_next_msg.onclick = function() |
---|
| 83 | { |
---|
[2718] | 84 | delete_border(this.id); |
---|
[2551] | 85 | }; |
---|
| 86 | } |
---|
| 87 | } |
---|
| 88 | var img_space = document.createElement("SPAN"); |
---|
[2694] | 89 | img_space.innerHTML = " "; |
---|
[2718] | 90 | var img_previous_msg = createAndSet("IMG",['id','src','title'],['msg_opt_previous_' + this.id, |
---|
[2694] | 91 | URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/up.button.png', |
---|
| 92 | get_lang('Previous')]); |
---|
[2551] | 93 | img_previous_msg.style.cursor = 'pointer'; |
---|
| 94 | |
---|
| 95 | if (!folder){ |
---|
[2718] | 96 | delete_border(this.id); |
---|
[2551] | 97 | return; |
---|
| 98 | } |
---|
[2718] | 99 | if (folder){ // mensagem local criptografada nao tem this.id da pasta local |
---|
[2551] | 100 | if (folder.previousSibling) |
---|
| 101 | { |
---|
[2714] | 102 | var previousMsgBox = folder.previousSibling.name?folder.previousSibling.name:msg_folder; |
---|
[2551] | 103 | |
---|
| 104 | if (previousMsgBox == "INBOX/decifradas") // teste para ver se a mensagem vem da pasta oculta decifradas |
---|
| 105 | previousMsgBox = get_current_folder(); |
---|
| 106 | |
---|
| 107 | img_previous_msg.onclick = function() |
---|
| 108 | { |
---|
[2714] | 109 | openTab.type[currentTab] = 2; |
---|
| 110 | if ( previousMsgBox == undefined ) |
---|
| 111 | previousMsgBox = current_folder; |
---|
| 112 | var allHeaders = folderHeaders[previousMsgBox]; |
---|
| 113 | for (i in allHeaders) |
---|
| 114 | if (allHeaders[i].msg_number == folder.previousSibling.id){ |
---|
| 115 | var previousHeader = allHeaders[i]; |
---|
| 116 | break; |
---|
| 117 | } |
---|
| 118 | proxy_mensagens.get_msg(previousHeader,previousMsgBox,true,show_msg,currentTab); |
---|
[2551] | 119 | }; |
---|
| 120 | } |
---|
| 121 | else |
---|
| 122 | { |
---|
[2630] | 123 | img_previous_msg.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/up.gray.button.png'; |
---|
[2551] | 124 | img_previous_msg.style.cursor = 'default'; |
---|
| 125 | } |
---|
| 126 | } |
---|
| 127 | else |
---|
| 128 | { |
---|
[2630] | 129 | img_previous_msg.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/up.gray.button.png'; |
---|
[2551] | 130 | img_previous_msg.style.cursor = 'default'; |
---|
[2714] | 131 | if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(msg_folder == "INBOX/decifradas")) // testa se a mensagem e local |
---|
[2551] | 132 | { |
---|
| 133 | img_previous_msg.onclick = function() |
---|
| 134 | { |
---|
[2718] | 135 | delete_border(this.id); |
---|
[2551] | 136 | }; |
---|
| 137 | } |
---|
| 138 | } |
---|
| 139 | next_previous_msg_td.appendChild(img_previous_msg); |
---|
| 140 | next_previous_msg_td.appendChild(img_space); |
---|
| 141 | next_previous_msg_td.appendChild(img_next_msg); |
---|
[2694] | 142 | return next_previous_msg_td; |
---|
| 143 | |
---|
[2715] | 144 | }; |
---|
[2699] | 145 | var idx_cc = 0; |
---|
[2718] | 146 | draw_message.prototype.draw_plugin_cc = function(addrs) |
---|
[2699] | 147 | { |
---|
| 148 | expresso.connector.loadScript("jscode/ccQuickAdd"); |
---|
[2722] | 149 | var id=this.id; |
---|
[2694] | 150 | |
---|
[2699] | 151 | var array_addrs = ''; |
---|
| 152 | var array_name = ''; |
---|
| 153 | var cc_data = new Array(); |
---|
| 154 | if(typeof(addrs.name) != 'undefined') { |
---|
| 155 | array_name = LTrim(addrs.name).split(" "); |
---|
| 156 | array_addrs = new Array(addrs.email); |
---|
| 157 | } |
---|
| 158 | else { |
---|
| 159 | array_addrs = (typeof addrs == 'object' ? addrs.toString().split("\" ") : addrs.split("\" ")); |
---|
| 160 | array_name = LTrim(array_addrs[0]).replace('"','').split(" "); |
---|
| 161 | } |
---|
| 162 | |
---|
| 163 | var _split = array_name[0].split('@'); |
---|
| 164 | cc_data[0] = _split[0]; |
---|
| 165 | cc_data[1] = _split[0]; |
---|
| 166 | cc_data[2] = ''; |
---|
| 167 | |
---|
| 168 | for (i=1; i < array_name.length; i++) |
---|
| 169 | cc_data[2] += array_name[i] + " "; |
---|
| 170 | |
---|
| 171 | |
---|
| 172 | if(array_addrs.length > 1) |
---|
| 173 | cc_data[3] = array_addrs[1] ? array_addrs[1].replace("<",'').replace(">",'') : ''; |
---|
| 174 | else |
---|
| 175 | cc_data[3] = array_addrs[0]; |
---|
| 176 | |
---|
| 177 | var sm_envelope_img1 = '<img style="cursor:'+ (is_ie ? 'hand' : 'pointer') +'" title="' + get_lang("Add Contact") + |
---|
| 178 | '" onclick="ccQuickAddOne.showList(\''+cc_data+'\')" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/user_card.png">'; |
---|
[2722] | 179 | var to_addybook_add = "<SPAN id='insert_plugin_"+idx_cc+"_"+id+"'>"; |
---|
[2699] | 180 | to_addybook_add += addrs; |
---|
| 181 | to_addybook_add += sm_envelope_img1; |
---|
| 182 | idx_cc++; |
---|
| 183 | to_addybook_add += "</SPAN>"; |
---|
| 184 | return to_addybook_add; |
---|
[2715] | 185 | }; |
---|
[2699] | 186 | |
---|
| 187 | |
---|
[2718] | 188 | draw_message.prototype.show_signature_certificate_data = function(){ |
---|
| 189 | var _height = Element("div_message_scroll_"+this.id).style.height; |
---|
| 190 | _height = parseInt(_height.replace("px","")); |
---|
| 191 | var _offset = 130; |
---|
| 192 | if (this.value == 'more_cert'){ |
---|
| 193 | //this.innerHTML += "<b><u>Mais Informaï¿Åï¿Åes</u></b>"; |
---|
| 194 | this.value = 'hide_cert'; |
---|
| 195 | Element("div_message_scroll_"+this.id).style.height = (_height + _offset)+"px"; |
---|
| 196 | Element('tr_signature_'+this.id).style.display = 'none'; |
---|
| 197 | Element('td_signature_'+this.id).style.display = 'none'; |
---|
[2694] | 198 | |
---|
[2718] | 199 | } |
---|
| 200 | else{ |
---|
| 201 | //this.innerHTML += "Mais Informaï¿Åï¿Åes"; |
---|
| 202 | this.value = 'more_cert'; |
---|
| 203 | Element("div_message_scroll_"+this.id).style.height = (_height - _offset)+"px"; |
---|
| 204 | Element('tr_signature_'+this.id).style.display = ''; |
---|
| 205 | Element('td_signature_'+this.id).style.display = ''; |
---|
| 206 | } |
---|
| 207 | }; |
---|
[2694] | 208 | |
---|
[2718] | 209 | draw_message.prototype.putSignature = function(info_msg,tdx){ |
---|
[2708] | 210 | var tr_signature = document.createElement("TR"); |
---|
| 211 | var td_signature = document.createElement("TD"); |
---|
| 212 | td_signature.className = 'tr_message_header'; |
---|
[2718] | 213 | tr_signature.id = 'tr_signature_'+this.id; |
---|
[2708] | 214 | td_signature.colSpan = "5"; |
---|
| 215 | tr_signature.style.display = 'none'; |
---|
[2694] | 216 | |
---|
[2708] | 217 | for (i=0; i < info_msg.signature.length; i++) |
---|
| 218 | td_signature.innerHTML += '<span>'+info_msg.signature[i]+'</span> <br /> '; |
---|
| 219 | td_signature.innerHTML += '<hr></hr>'; |
---|
| 220 | var signature_status_pos = info_msg.signature[0].indexOf('Message untouched'); |
---|
[2718] | 221 | td_signature.id = "td_signature_"+this.id; |
---|
[2708] | 222 | if(signature_status_pos < 0 ) |
---|
| 223 | { |
---|
[2718] | 224 | tdx.innerHTML += ' <img style="cursor:pointer" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/signed_error.gif" title="'+get_lang("Details")+'" onclick="show_signature_certificate_data(\'' + this.id + '\')">'; |
---|
[2708] | 225 | tr_signature.style.display = ''; |
---|
| 226 | } |
---|
| 227 | else |
---|
| 228 | { |
---|
[2718] | 229 | tdx.innerHTML += ' <img style="cursor:pointer" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/signed_table.gif" title="'+get_lang("Details")+'" onclick="show_signature_certificate_data(\'' + this.id + '\')">'; |
---|
[2708] | 230 | } |
---|
| 231 | tr_signature.appendChild(td_signature); |
---|
| 232 | return tr_signature; |
---|
[2715] | 233 | }; |
---|
| 234 | draw_message.prototype.make_options_message = function(info_msg, tbody_message){ |
---|
[2701] | 235 | var tr0 = document.createElement("TR"); |
---|
| 236 | tr0.className = "tr_message_header"; |
---|
| 237 | var td0 = document.createElement("TD"); |
---|
| 238 | var table_message_options = createAndSet("TABLE",['border','width','class'],["0","100%",'table_message']); |
---|
| 239 | var tbody_message_options = document.createElement("TBODY"); |
---|
| 240 | var tr = document.createElement("TR"); |
---|
| 241 | var td = document.createElement("TD"); |
---|
| 242 | td.setAttribute("noWrap","true"); |
---|
| 243 | var _name = ''; |
---|
[2694] | 244 | var menuHidden = Element("folderscol").style.display == 'none' ? true : false; |
---|
| 245 | |
---|
[2718] | 246 | var folder_id = info_msg.msg_number; |
---|
[2694] | 247 | var folder = document.getElementById(folder_id); |
---|
| 248 | if (!folder){ |
---|
[2718] | 249 | delete_border(this.id); |
---|
[2701] | 250 | return false; |
---|
[2694] | 251 | } |
---|
| 252 | |
---|
[2718] | 253 | var next_previous_msg_td = this.createNxtPrevButtons(info_msg.msg_folder,folder_id); |
---|
[2694] | 254 | if (typeof(next_previous_msg_td) == 'undefined') |
---|
[2701] | 255 | return false; |
---|
[2694] | 256 | |
---|
[2551] | 257 | |
---|
| 258 | var _maxChar = menuHidden ? 40 : 15; |
---|
| 259 | |
---|
| 260 | if (info_msg.from.name) |
---|
| 261 | { |
---|
| 262 | var spanName = document.createElement("SPAN"); |
---|
| 263 | spanName.innerHTML = info_msg.from.name; |
---|
| 264 | _name = spanName.innerHTML.length > _maxChar ? spanName.innerHTML.substring(0,_maxChar) + "..." : spanName.innerHTML; |
---|
| 265 | } |
---|
| 266 | else |
---|
| 267 | _name = info_msg.from.email.length > _maxChar ? info_msg.from.email.substring(0,_maxChar) + "..." : info_msg.from.email; |
---|
[2722] | 268 | var id = this.id; |
---|
[2714] | 269 | td.innerHTML = _name.bold() + ', ' + info_msg.udate; |
---|
| 270 | if (info_msg.attachment.names.length > 0) |
---|
[2722] | 271 | td.innerHTML += " <img style='cursor:pointer' onclick='javascript:Element(\"option_hide_more_"+id+"\").onclick()' src ='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/clip.gif' title='"+info_msg.attachment.names+"'>"; |
---|
[2551] | 272 | |
---|
| 273 | if (typeof(info_msg.signature) == 'string') |
---|
[2694] | 274 | { |
---|
[2551] | 275 | if (info_msg.signature != "void") |
---|
[2630] | 276 | td.innerHTML += ' <img style="cursor:pointer" onclick="alert(\''+ get_lang("This message is signed, and you can trust.") + info_msg.signature +'\');" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/signed.gif">'; |
---|
[2551] | 277 | else |
---|
[2630] | 278 | td.innerHTML += " <img style='cursor:pointer' onclick='alert(\""+get_lang("This message is signed, but it is invalid. You should not trust on it.")+"\");' title='"+get_lang("Voided message")+"' src='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/invalid.gif'>"; |
---|
[2551] | 279 | } |
---|
| 280 | |
---|
| 281 | if (info_msg.DispositionNotificationTo) |
---|
| 282 | { |
---|
[2630] | 283 | td.innerHTML += ' <img style="cursor:pointer" alt="'+ get_lang('Message with read notification') + '" title="'+ get_lang('Message with read notification') + '" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/notification.gif">'; |
---|
[2551] | 284 | } |
---|
| 285 | |
---|
| 286 | // NORMAL MSG |
---|
| 287 | if(info_msg.Draft != 'X') |
---|
| 288 | { |
---|
[2694] | 289 | var options = createAndSet("TD",['noWrap','width','align'],['true','30%','right']); |
---|
[2722] | 290 | var option_hide_more = createAndSet("SPAN",['class','value','id'],['message_options','more_options','option_hide_more_'+id],get_lang('show details')); |
---|
[2551] | 291 | option_hide_more.onclick = function(){ |
---|
[2714] | 292 | try{ |
---|
[2722] | 293 | var _height = Element("div_message_scroll_"+id).style.height; |
---|
[2714] | 294 | } |
---|
| 295 | catch(e){ |
---|
| 296 | return; |
---|
| 297 | } |
---|
[2551] | 298 | _height = parseInt(_height.replace("px","")); |
---|
| 299 | var _offset = 35; |
---|
[2699] | 300 | if (this.value != 'hide_options'){ |
---|
[2622] | 301 | this.innerHTML = "<b><u>"+get_lang('hide details')+"</u></b>"; |
---|
[2551] | 302 | this.value = 'hide_options'; |
---|
[2722] | 303 | Element("div_message_scroll_"+id).style.height = (_height - _offset)+"px"; |
---|
| 304 | Element('table_msg_details_'+id).style.display = ''; |
---|
[2551] | 305 | |
---|
| 306 | } |
---|
| 307 | else{ |
---|
[2622] | 308 | this.innerHTML = get_lang('show details'); |
---|
[2551] | 309 | this.value = 'more_options'; |
---|
[2722] | 310 | Element("div_message_scroll_"+id).style.height = (_height + _offset)+"px"; |
---|
| 311 | Element('table_msg_details_'+id).style.display = 'none'; |
---|
[2551] | 312 | } |
---|
| 313 | }; |
---|
[2694] | 314 | var option_mark = createAndSet("TD",['width','align'],['50%','left']); |
---|
[2551] | 315 | |
---|
| 316 | var option_mark_as_unseen = '<span class="message_options" onclick="changeLinkState(this,\'seen\');set_messages_flag(\'unseen\','+ |
---|
| 317 | folder_id+');write_msg(\''+get_lang('Message marked as ')+get_lang("Unseen")+ |
---|
| 318 | '.\');">'+get_lang("Unseen")+'</span>, '; |
---|
| 319 | |
---|
| 320 | if (info_msg.Flagged == "F") |
---|
| 321 | var option_mark_important = '<span class="message_options" onclick="changeLinkState(this,\'important\');set_messages_flag(\'unflagged\','+ |
---|
| 322 | folder_id+');write_msg(\''+get_lang('Message marked as ')+get_lang("Normal")+ |
---|
| 323 | '.\');">'+get_lang("Normal")+'</span>'; |
---|
| 324 | else |
---|
| 325 | var option_mark_important = '<span class="message_options" onclick="changeLinkState(this,\'normal\');set_messages_flag(\'flagged\','+folder_id+');write_msg(\''+get_lang('Message marked as ')+get_lang("Important")+ |
---|
| 326 | '.\');">'+get_lang("Important")+'</span>'; |
---|
| 327 | option_mark.innerHTML = option_mark_as_unseen+option_mark_important; |
---|
| 328 | |
---|
[2718] | 329 | var option_forward = createAndSet("SPAN",['id','class'],['msg_opt_forward_'+this.id, 'message_options'],get_lang('Forward')); |
---|
| 330 | option_forward.onclick = function(){new_message('forward', this.id);}; |
---|
[2694] | 331 | appendChilds(options,option_hide_more,createAndSet('SPAN',false,false,' | '),option_forward); |
---|
[2699] | 332 | |
---|
[2718] | 333 | var option_reply_options = createAndSet("IMG",['id', 'src', 'value'],['msg_opt_reply_options_'+this.id,URL_SERVER+'expressoMail1_2/templates/default/images/down.png','show']); |
---|
[2622] | 334 | option_reply_options.onmouseover = function(){ |
---|
[2630] | 335 | option_reply_options.src= URL_SERVER+'expressoMail1_2/templates/default/images/over.png'; |
---|
[2622] | 336 | }; |
---|
| 337 | option_reply_options.onmouseout = function(){ |
---|
| 338 | if (this.value == 'show') |
---|
| 339 | { |
---|
[2630] | 340 | option_reply_options.src= URL_SERVER+'expressoMail1_2/templates/default/images/down.png'; |
---|
[2622] | 341 | } |
---|
| 342 | else |
---|
| 343 | { |
---|
[2630] | 344 | option_reply_options.src= URL_SERVER+'expressoMail1_2/templates/default/images/pressed.png'; |
---|
[2622] | 345 | } |
---|
| 346 | }; |
---|
| 347 | option_reply_options.onclick = function(){ |
---|
[2699] | 348 | if (this.value != 'hide'){ |
---|
[2622] | 349 | this.value = 'hide'; |
---|
[2630] | 350 | option_reply_options.src= URL_SERVER+'expressoMail1_2/templates/default/images/pressed.png'; |
---|
[2718] | 351 | Element('tr_other_options_'+this.id).style.display = ''; |
---|
[2622] | 352 | |
---|
| 353 | } |
---|
| 354 | else{ |
---|
| 355 | this.value = 'show'; |
---|
[2630] | 356 | option_reply_options.src= URL_SERVER+'expressoMail1_2/templates/default/images/down.png'; |
---|
[2718] | 357 | Element('tr_other_options_'+this.id).style.display = 'none'; |
---|
[2622] | 358 | } |
---|
| 359 | }; |
---|
[2551] | 360 | |
---|
[2718] | 361 | var _option_reply = createAndSet("SPAN",['id','class'],['msg_opt_reply_'+this.id,'message_options'],get_lang('Reply')); |
---|
| 362 | _option_reply.onclick = function(){new_message('reply_with_history', this.id);}; |
---|
[2694] | 363 | |
---|
| 364 | appendChilds(options,createAndSet('SPAN',false,false,' | '),option_reply_options,_option_reply); |
---|
| 365 | appendChilds(tr,td,option_mark,options,next_previous_msg_td); |
---|
[2551] | 366 | tbody_message_options.appendChild(tr); |
---|
| 367 | |
---|
| 368 | ////////// OTHER OPTIONS //////////////////// |
---|
[2718] | 369 | var _tr_other_options = createAndSet("TR",['id'],['tr_other_options_' + this.id]); |
---|
[2694] | 370 | _tr_other_options.style.display = 'none'; |
---|
[2551] | 371 | |
---|
| 372 | var div_other_options = document.createElement("DIV"); |
---|
| 373 | |
---|
| 374 | var option_mark_as = '<span>'+get_lang("Mark as")+'</span>: '; |
---|
| 375 | var option_mark_as_unseen = '<span class="message_options" onclick="proxy_mensagens.proxy_set_messages_flag(\'unseen\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Unseen")+'.\');">'+get_lang("Unseen")+'</span>, '; |
---|
| 376 | var option_mark_as_important = '<span class="message_options" onclick="proxy_mensagens.proxy_set_messages_flag(\'flagged\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Important")+'.\');">'+get_lang("Important")+'</span>, '; |
---|
| 377 | var option_mark_as_normal = '<span class="message_options" onclick="proxy_mensagens.proxy_set_messages_flag(\'unflagged\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Normal")+'.\');">'+get_lang("Normal")+'</span> | '; |
---|
| 378 | |
---|
[2718] | 379 | var option_reply_without_history = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=new_message("reply_without_history","'+this.id+'");>'+get_lang("Reply without history")+'</span>'; |
---|
| 380 | var option_reply_to_all = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=new_message("reply_to_all_with_history","'+this.id+'");>'+get_lang("Reply to all")+'</span> | '; |
---|
[2551] | 381 | |
---|
[2718] | 382 | var option_reply_to_all_without_history = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=new_message("reply_to_all_without_history","'+this.id+'");>'+get_lang("Reply to all without history")+'</span> | </div>'; |
---|
[2624] | 383 | |
---|
| 384 | div_other_options.innerHTML = option_reply_to_all + option_reply_to_all_without_history + option_reply_without_history; |
---|
[2551] | 385 | if (use_spam_filter) { |
---|
| 386 | if(info_msg.msg_folder == 'INBOX'+cyrus_delimiter+'Spam') |
---|
[2694] | 387 | div_other_options.innerHTML += ' | <span class="reply_options" onclick="nospam('+info_msg.msg_number+',\'null\', \''+info_msg.msg_folder+'\')";>'+get_lang("Not Spam")+'</span>'; |
---|
[2551] | 388 | else |
---|
[2694] | 389 | div_other_options.innerHTML += ' | <span class="reply_options" onclick="spam(\''+info_msg.msg_folder+'\', '+info_msg.msg_number+',\'null\')";>'+get_lang("Mark as Spam")+'</span>'; |
---|
[2551] | 390 | } |
---|
| 391 | |
---|
[2694] | 392 | var td_other_options = createAndSet("TD",['colSpan','align','noWrap'],['3','right','true']); |
---|
[2551] | 393 | td_other_options.appendChild(div_other_options); |
---|
| 394 | |
---|
[2694] | 395 | _tr_other_options.appendChild(td_other_options); |
---|
| 396 | tbody_message_options.appendChild(_tr_other_options); |
---|
[2551] | 397 | ////////// END OTHER OPTIONS //////////////// |
---|
| 398 | table_message_options.appendChild(tbody_message_options); |
---|
| 399 | td0.appendChild(table_message_options); |
---|
| 400 | tr0.appendChild(td0); |
---|
| 401 | tbody_message.appendChild(tr0); |
---|
[2708] | 402 | if (info_msg.signature && info_msg.signature.length > 0) |
---|
| 403 | { |
---|
[2718] | 404 | tbody_message.appendChild(putSignature(this.id,info_msg,td)); |
---|
[2708] | 405 | } |
---|
[2551] | 406 | } |
---|
| 407 | else // IF DRAFT |
---|
| 408 | { |
---|
[2694] | 409 | var options = createAndSet('TD',['width','noWrap','align'],['1%','true','right']); |
---|
[2718] | 410 | var option_hide_more = createAndSet("SPAN",['class','value','id'],['message_options','more_options','option_hide_more_'+this.id],get_lang('Show details')); |
---|
[2551] | 411 | option_hide_more.onclick = function(){ |
---|
[2722] | 412 | var _height = Element("div_message_scroll_"+id).style.height; |
---|
[2551] | 413 | _height = parseInt(_height.replace("px","")); |
---|
| 414 | var _offset = 35; |
---|
[2699] | 415 | if (this.value != 'hide_options'){ |
---|
[2667] | 416 | this.innerHTML = "<b><u>"+get_lang('Hide details')+"</u></b>"; |
---|
[2551] | 417 | this.value = 'hide_options'; |
---|
[2722] | 418 | Element("div_message_scroll_"+id).style.height = (_height - _offset)+"px"; |
---|
| 419 | Element('table_msg_details_'+id).style.display = ''; |
---|
[2551] | 420 | } |
---|
| 421 | else{ |
---|
[2667] | 422 | this.innerHTML = get_lang('show details'); |
---|
[2551] | 423 | this.value = 'more_options'; |
---|
[2722] | 424 | Element("div_message_scroll_"+id).style.height = (_height + _offset)+"px"; |
---|
| 425 | Element('table_msg_details_'+id).style.display = 'none'; |
---|
[2551] | 426 | } |
---|
| 427 | }; |
---|
[2694] | 428 | var option_edit = createAndSet('SPAN',['class'],['message_options'], get_lang('Edit')); |
---|
[2718] | 429 | option_edit.onclick= function () { new_message('edit',this.id); }; |
---|
[2694] | 430 | appendChilds(options, option_hide_more, createAndSet('SPAN',false,false," | "), option_edit); |
---|
| 431 | |
---|
| 432 | tbody_message_options.appendChild(appendChilds(tr, td, options, next_previous_msg_td)); |
---|
[2551] | 433 | table_message_options.appendChild(tbody_message_options); |
---|
| 434 | td0.appendChild(table_message_options); |
---|
| 435 | tr0.appendChild(td0); |
---|
| 436 | tbody_message.appendChild(tr0); |
---|
| 437 | } |
---|
[2701] | 438 | return true; |
---|
[2715] | 439 | }; |
---|
[2714] | 440 | |
---|
[2715] | 441 | draw_message.prototype.draw_message_header = function(header,border_id){ |
---|
[2718] | 442 | this.id = border_id; |
---|
[2701] | 443 | var defaultWidth = document.body.offsetWidth - 37; |
---|
| 444 | if(Element("folderscol").style.display != 'none') |
---|
| 445 | defaultWidth -= Element("folderscol").offsetWidth; |
---|
[2551] | 446 | |
---|
[2714] | 447 | var table_message = createAndSet("TABLE",['id','border','width'],['table_message_'+border_id,"0",defaultWidth]); |
---|
| 448 | table_message.id = 'table_message_'+border_id; |
---|
[2701] | 449 | var tbody_message = document.createElement("TBODY"); |
---|
[2715] | 450 | if (!this.make_options_message(header,tbody_message)) |
---|
[2701] | 451 | return; |
---|
| 452 | |
---|
[2714] | 453 | table_message.appendChild(tbody_message); |
---|
| 454 | var content = document.getElementById('content_id_' + border_id); |
---|
| 455 | content.appendChild(table_message); |
---|
| 456 | loading_img = content.appendChild(loading_img); |
---|
[2715] | 457 | }; |
---|
[2705] | 458 | |
---|
[2714] | 459 | |
---|
[2718] | 460 | draw_message.prototype.draw_message_body = function (info_msg){ |
---|
[2714] | 461 | var defaultWidth = document.body.offsetWidth - 37; |
---|
| 462 | if(Element("folderscol").style.display != 'none') |
---|
| 463 | defaultWidth -= Element("folderscol").offsetWidth; |
---|
| 464 | |
---|
[2718] | 465 | var table_message = Element('table_message_'+this.id); |
---|
[2714] | 466 | var tbody_message = table_message.childNodes[0]; |
---|
| 467 | |
---|
[2551] | 468 | var tbody_message_others_options = document.createElement("TBODY"); |
---|
| 469 | var tr1 = document.createElement("TR"); |
---|
| 470 | tr1.className = "tr_message_header"; |
---|
[2694] | 471 | var td1 = createAndSet('TD',['width'],['7%'],get_lang("From: ")); |
---|
[2551] | 472 | td1.appendChild(deny_email(info_msg.from.email)); |
---|
[2722] | 473 | var id=this.id; |
---|
[2551] | 474 | |
---|
| 475 | if (info_msg.sender){ |
---|
| 476 | var tr111 = document.createElement("TR"); |
---|
| 477 | tr111.className = "tr_message_header"; |
---|
[2694] | 478 | var td111 = createAndSet('TD',['noWrap'],['true'],get_lang("Sent by")+": "); |
---|
[2551] | 479 | td111.appendChild(deny_email(info_msg.sender.email)); |
---|
| 480 | var sender = document.createElement("TD"); |
---|
[2694] | 481 | sender.className = "header_message_field"; |
---|
[2722] | 482 | sender.id = "sender_"+id; |
---|
| 483 | sender.innerHTML += this.draw_plugin_cc(info_msg.sender.full); |
---|
| 484 | var sender_values = createAndSet("INPUT",['id','type','value'],["sender_values_"+id,"HIDDEN",info_msg.sender.full]); |
---|
[2694] | 485 | |
---|
| 486 | tbody_message_others_options.appendChild(appendChilds(tr111, td111, sender, sender_values)); |
---|
[2551] | 487 | } |
---|
| 488 | |
---|
[2718] | 489 | var from = createAndSet('TD',['id','class'],["from_"+this.id,"header_message_field"],info_msg.from.full); |
---|
[2694] | 490 | |
---|
[2551] | 491 | if (info_msg.Draft != "X"){ |
---|
[2722] | 492 | from.innerHTML += this.draw_plugin_cc(info_msg.from); |
---|
[2551] | 493 | tbody_message_others_options.appendChild(tr1); |
---|
| 494 | } |
---|
[2718] | 495 | var from_values = createAndSet('INPUT',['id','type','value'],["from_values_"+this.id,"HIDDEN",info_msg.from.full]); |
---|
| 496 | var local_message = createAndSet("INPUT",['id','name','type','value'],["is_local_"+this.id,"is_local","HIDDEN",(info_msg.local_message)?"1":"0"]); |
---|
[2694] | 497 | appendChilds(tr1,td1,from,from_values,local_message); |
---|
[2551] | 498 | |
---|
| 499 | if (info_msg.reply_to){ |
---|
| 500 | var tr11 = document.createElement("TR"); |
---|
| 501 | tr11.className = "tr_message_header"; |
---|
[2699] | 502 | var _td11 = createAndSet('TD',['noWrap'],['true'],get_lang("Reply to")+": "); |
---|
[2722] | 503 | var _reply_to = createAndSet('TD',['id', 'class'],["reply_to_"+id, "header_message_field"],this.draw_plugin_cc(info_msg.reply_to)); |
---|
| 504 | var _reply_to_values = createAndSet('INPUT',['id', 'type', 'value'],["reply_to_values_"+id,"HIDDEN",info_msg.reply_to]); |
---|
[2699] | 505 | tbody_message_others_options.appendChild(appendChilds(tr11,_td11,_reply_to,_reply_to_values)); |
---|
[2551] | 506 | } |
---|
| 507 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 508 | var tr2 = document.createElement("TR"); |
---|
| 509 | tr2.className = "tr_message_header"; |
---|
| 510 | var td2 = document.createElement("TD"); |
---|
| 511 | td2.innerHTML = get_lang("To: "); |
---|
| 512 | var to = document.createElement("TD"); |
---|
[2722] | 513 | to.id = "to_"+id; |
---|
[2551] | 514 | |
---|
[2722] | 515 | var _to_values = createAndSet('INPUT',['id', 'type', 'value'],["to_values_"+id, "HIDDEN", info_msg.toaddress2]); |
---|
[2551] | 516 | // Salva a pasta da mensagem |
---|
[2722] | 517 | var _input_cfolder = createAndSet('INPUT',['id', 'name', 'type', 'value'],["input_folder_"+id, "input_folder", "hidden", info_msg.msg_folder]); |
---|
[2699] | 518 | td2.appendChild(_input_cfolder); |
---|
| 519 | |
---|
[2722] | 520 | toaddress_array[id] = info_msg.toaddress2.split(","); |
---|
| 521 | if (toaddress_array[id].length > 1){ |
---|
| 522 | to.innerHTML += this.draw_plugin_cc(toaddress_array[id][0]); |
---|
| 523 | var _div_toaddrs = createAndSet('SPAN',['id','style'],["div_toaddress_"+id,'display: inline']," (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+id+"','to');>"+get_lang('more')+"</a>)"); |
---|
[2699] | 524 | to.appendChild(_div_toaddrs); |
---|
[2551] | 525 | } |
---|
| 526 | else { |
---|
[2722] | 527 | to.innerHTML += this.draw_plugin_cc(toaddress_array[id]); |
---|
[2551] | 528 | } |
---|
| 529 | to.className = "header_message_field"; |
---|
[2699] | 530 | tbody_message_others_options.appendChild(appendChilds(tr2,td2,to,_to_values)); |
---|
[2551] | 531 | |
---|
| 532 | if (info_msg.cc){ |
---|
| 533 | var tr3 = document.createElement("TR"); |
---|
| 534 | tr3.className = "tr_message_header"; |
---|
| 535 | var td3 = document.createElement("TD"); |
---|
| 536 | td3.innerHTML = "CC: "; |
---|
[2718] | 537 | var cc = createAndSet("TD",['id', 'class'],["cc_"+this.id,"header_message_field"]); |
---|
[2551] | 538 | |
---|
[2718] | 539 | var cc_values = createAndSet("INPUT",['id', 'type', 'value'],["cc_values_"+this.id, "HIDDEN", info_msg.cc]); |
---|
| 540 | ccaddress_array[this.id] = info_msg.cc.split(","); |
---|
| 541 | if (ccaddress_array[this.id].length > 1){ |
---|
[2551] | 542 | var div_ccaddress = document.createElement("SPAN"); |
---|
[2718] | 543 | div_ccaddress.id = "div_ccaddress_"+this.id; |
---|
| 544 | var div_ccaddress_full = createAndSet("SPAN",['id', 'style'],["div_ccaddress_full_"+this.id, "display: inline"]); |
---|
[2722] | 545 | cc.innerHTML = this.draw_plugin_cc(ccaddress_array[this.id][0]); |
---|
[2718] | 546 | div_ccaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+this.id+"','cc');>"+get_lang('more')+"</a>)"; |
---|
[2551] | 547 | cc.appendChild(div_ccaddress); |
---|
| 548 | } |
---|
| 549 | else{ |
---|
[2722] | 550 | cc.innerHTML = this.draw_plugin_cc(info_msg.cc); |
---|
[2551] | 551 | } |
---|
[2694] | 552 | tbody_message_others_options.appendChild(appendChilds(tr3,td3,cc,cc_values)); |
---|
[2551] | 553 | } |
---|
| 554 | |
---|
| 555 | if (info_msg.bcc) |
---|
| 556 | { |
---|
[2715] | 557 | tbody_message_others_options.appendChild(this.getBcc(info_msg.bcc)); |
---|
[2551] | 558 | } |
---|
| 559 | |
---|
| 560 | var tr4 = document.createElement("TR"); |
---|
| 561 | tr4.className = "tr_message_header"; |
---|
| 562 | var td4 = document.createElement("TD"); |
---|
| 563 | td4.innerHTML = get_lang("Date: "); |
---|
[2718] | 564 | var date = createAndSet('TD',['id','class'],["date_"+this.id,"header_message_field"],info_msg.fulldate); |
---|
| 565 | var date_day = createAndSet('INPUT',['id', 'type', 'value'],["date_day_"+this.id, "HIDDEN", info_msg.msg_day]); |
---|
| 566 | var date_hour = createAndSet('INPUT',['id', 'type', 'value'],["date_hour_"+this.id, "HIDDEN", info_msg.msg_hour]); |
---|
[2694] | 567 | tbody_message_others_options.appendChild(appendChilds(tr4,td4,date,date_day,date_hour)); |
---|
[2551] | 568 | |
---|
| 569 | var tr5 = document.createElement("TR"); |
---|
| 570 | tr5.className = "tr_message_header"; |
---|
| 571 | var td5 = document.createElement("TD"); |
---|
| 572 | td5.innerHTML = get_lang("Subject"); |
---|
[2718] | 573 | var subject = createAndSet('TD',['id', 'class'],["subject_"+this.id, "header_message_field"],info_msg.subject); |
---|
[2694] | 574 | tbody_message_others_options.appendChild(appendChilds(tr5,td5,subject)); |
---|
[2551] | 575 | if (info_msg.attachments.length > 0){ |
---|
| 576 | var tr6 = document.createElement("TR"); |
---|
| 577 | tr6.className = "tr_message_header"; |
---|
| 578 | var td6 = document.createElement("TD"); |
---|
| 579 | td6.innerHTML = get_lang("Attachments: "); |
---|
| 580 | |
---|
| 581 | var attachments = document.createElement("TD"); |
---|
| 582 | attachments.align='left'; |
---|
[2699] | 583 | td6.vAlign = "top"; |
---|
| 584 | |
---|
[2551] | 585 | var zipped_attachments = ''; |
---|
| 586 | if(info_msg.attachments.length >= 1) { |
---|
[2699] | 587 | var zipped_attachments = createAndSet("TABLE",['style','cellPadding','cellSpacing'],['margin-bottom: 4px','0','0']); |
---|
[2551] | 588 | var td = document.createElement("TD"); |
---|
| 589 | if(info_msg.attachments.length > 1) { |
---|
| 590 | var link_attachment = document.createElement("A"); |
---|
| 591 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
| 592 | link_attachment.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 593 | else |
---|
| 594 | link_attachment.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 595 | link_attachment.innerHTML = " "+info_msg.attachments.length+' '+get_lang('files')+' :: '+get_lang('Download all atachments'); |
---|
| 596 | link_attachment.innerHTML += '<BR>'; |
---|
| 597 | td.appendChild(link_attachment); |
---|
| 598 | } |
---|
| 599 | var tr = document.createElement("TR"); |
---|
| 600 | if(parseInt(preferences.remove_attachments_function)) |
---|
| 601 | { |
---|
| 602 | var del_attachments = document.createElement("A"); |
---|
| 603 | del_attachments.setAttribute("href", "javascript:remove_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 604 | del_attachments.innerHTML = get_lang('remove all attachments'); |
---|
| 605 | del_attachments.appendChild(document.createElement('BR')); |
---|
| 606 | td.appendChild(del_attachments); |
---|
| 607 | tr.appendChild(td); |
---|
| 608 | } |
---|
| 609 | tr.appendChild(td); |
---|
| 610 | zipped_attachments.appendChild(tr); |
---|
| 611 | attachments.appendChild(zipped_attachments); |
---|
| 612 | } |
---|
| 613 | |
---|
[2718] | 614 | attachments.id = "attachments_" + this.id; |
---|
[2551] | 615 | for (var i=0; i<info_msg.attachments.length; i++){ |
---|
| 616 | var link_attachment = document.createElement("A"); |
---|
| 617 | link_attachment.setAttribute("href", proxy_mensagens.link_anexo(info_msg,i)); |
---|
[2705] | 618 | //link_attachment.setAttribute("href", "javascript:download_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"',"+i+",'"+info_msg.attachments[i].pid+"','"+info_msg.attachments[i].encoding+"')"); |
---|
[2551] | 619 | link_attachment.innerHTML = url_decode(info_msg.attachments[i].name); |
---|
[2705] | 620 | link_attachment.innerHTML += " "+borkb(info_msg.attachments[i].fsize); |
---|
[2551] | 621 | |
---|
| 622 | if((url_decode(info_msg.attachments[i].name).indexOf(".ics")!=-1) || (url_decode(info_msg.attachments[i].name).indexOf(".vcard")!=-1)){ |
---|
| 623 | //Link para importar calendário |
---|
[2699] | 624 | var link_import_attachment = createAndSet("IMG",['src','onclick','title','align','style'],["templates/"+template+"/images/new.png","javascript:import_calendar('"+info_msg.msg_folder+"&msg_number="+info_msg.msg_number+"&msg_part="+info_msg.attachments[i].pid+"&idx_file="+i+"&encoding="+info_msg.attachments[i].encoding+"');",get_lang("Import to calendar"),"top","cursor: pointer"]); |
---|
[2551] | 625 | var space = document.createElement("span"); |
---|
| 626 | space.innerHTML = " "; |
---|
[2694] | 627 | appendChilds(attachments,link_attachment,space,link_import_attachment); |
---|
[2551] | 628 | } |
---|
| 629 | else { |
---|
| 630 | link_attachment.innerHTML += '<BR>'; |
---|
| 631 | attachments.appendChild(link_attachment); |
---|
| 632 | } |
---|
| 633 | } |
---|
| 634 | tr6.appendChild(td6); |
---|
| 635 | tr6.appendChild(attachments); |
---|
| 636 | tbody_message_others_options.appendChild(tr6); |
---|
| 637 | } |
---|
| 638 | |
---|
| 639 | |
---|
| 640 | // BEGIN MAKE THE SCROLL HEIGHT |
---|
| 641 | var bar = document.getElementById("toolbar"); |
---|
| 642 | var offset = 0; |
---|
| 643 | if(bar.style.visibility != 'hidden') |
---|
| 644 | offset = bar.offsetHeight ? bar.offsetHeight : bar.clientHeight; |
---|
| 645 | var div = document.createElement("DIV"); |
---|
[2718] | 646 | div.id = "div_message_scroll_"+this.id; |
---|
[2551] | 647 | div.style.background = 'WHITE'; |
---|
| 648 | div.style.height = document.body.clientHeight - offset - 125; |
---|
| 649 | div.style.overflow = "auto"; |
---|
| 650 | div.style.width = defaultWidth - (is_ie ? 5 : 0); |
---|
| 651 | // END MAKE THE SCROLL HEIGHT |
---|
[2694] | 652 | |
---|
[2718] | 653 | var table_msg_details = createAndSet("TABLE",['id','width','class'],['table_msg_details_' + this.id,defaultWidth - 30,'table_message']); |
---|
[2705] | 654 | table_msg_details.style.display = 'none'; |
---|
| 655 | table_msg_details.appendChild(tbody_message_others_options); |
---|
| 656 | div.appendChild(table_msg_details); |
---|
| 657 | |
---|
[2551] | 658 | var tr = document.createElement("TR"); |
---|
| 659 | var td = document.createElement("TD"); |
---|
| 660 | td.colSpan = '2'; |
---|
[2694] | 661 | |
---|
[2718] | 662 | var newBody = this.blockImage(info_msg,this.id,td); |
---|
[2551] | 663 | |
---|
| 664 | td.appendChild(div); |
---|
| 665 | tr.appendChild(td); |
---|
| 666 | tbody_message.appendChild(tr); |
---|
| 667 | |
---|
| 668 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 669 | //Make the body message. |
---|
| 670 | /////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 671 | var tr = document.createElement("TR"); |
---|
| 672 | tr.className = "tr_message_body"; |
---|
| 673 | var td = document.createElement("TD"); |
---|
| 674 | //td.setAttribute("colSpan","2"); |
---|
| 675 | newBody = newBody.replace("<body","<span"); |
---|
| 676 | newBody = newBody.replace("<BODY","<span"); |
---|
[2718] | 677 | div.innerHTML+= "<span id='body_"+this.id+"' style='font-size:16px;'>"+newBody+"</span><br><br>"; |
---|
[2551] | 678 | function mailto( link ) |
---|
| 679 | { |
---|
| 680 | var mail = link.href.substr( 7 ); |
---|
| 681 | link.onclick = function( ) |
---|
| 682 | { |
---|
| 683 | new_message_to( mail ); |
---|
| 684 | return false; |
---|
| 685 | }; |
---|
| 686 | } |
---|
| 687 | var links = div.getElementsByTagName( 'a' ); |
---|
| 688 | for ( var i = 0; i < links.length; i++ ) |
---|
| 689 | if ( links.item( i ).href.indexOf( 'mailto:' ) === 0 ) |
---|
| 690 | mailto( links.item( i ) ); |
---|
| 691 | else |
---|
| 692 | { |
---|
| 693 | if ( links.item( i ).href.indexOf( 'javascript:' ) !== 0 ) |
---|
| 694 | links.item( i ).setAttribute( 'target', '_blank' ); |
---|
| 695 | } |
---|
[2705] | 696 | |
---|
| 697 | if ((info_msg.thumbs)&&(info_msg.thumbs.length > 0)){ |
---|
| 698 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 699 | //Make the thumbs of the message. |
---|
| 700 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[2715] | 701 | div.appendChild(this.getThumbs(info_msg.attachments, info_msg.thumbs, info_msg.msg_number, info_msg.msg_folder)); |
---|
[2705] | 702 | } |
---|
| 703 | |
---|
[2714] | 704 | |
---|
[2718] | 705 | var msg_number = createAndSet("INPUT",['id','type','value'],["msg_number_" + this.id, "hidden", info_msg.msg_number]); |
---|
| 706 | var content = document.getElementById('content_id_' + this.id); |
---|
[2714] | 707 | loading_img = content.removeChild( loading_img ); |
---|
| 708 | content.style.height = document.body.clientHeight - offset - 90; |
---|
[2705] | 709 | content.appendChild(msg_number); |
---|
[2551] | 710 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[2705] | 711 | |
---|
| 712 | //Exibe o cabecalho da mensagem totalmente aberto caso esteja setado nas preferencias do usuario |
---|
| 713 | if (preferences.show_head_msg_full == 1) |
---|
| 714 | { |
---|
| 715 | option_hide_more.onclick(); |
---|
| 716 | |
---|
[2718] | 717 | if (Element('div_toaddress_'+this.id) != null) |
---|
[2705] | 718 | { |
---|
[2718] | 719 | show_div_address_full(this.id,'to'); |
---|
[2705] | 720 | } |
---|
[2718] | 721 | if (Element('div_ccaddress_'+this.id) != null) |
---|
[2705] | 722 | { |
---|
[2718] | 723 | show_div_address_full(this.id,'cc'); |
---|
[2705] | 724 | } |
---|
| 725 | } |
---|
| 726 | |
---|
[2715] | 727 | }; |
---|
| 728 | |
---|
| 729 | draw_message.prototype.getThumbs = function(attachments, thumbs, msg_number, msg_folder){ |
---|
[2551] | 730 | var table_message_thumbs = document.createElement("TABLE"); |
---|
| 731 | table_message_thumbs.width = "80%"; |
---|
| 732 | table_message_thumbs.style.borderTop = "2px solid rgb(170, 170, 170)"; |
---|
| 733 | var tbody_message_thumbs = document.createElement("TBODY"); |
---|
| 734 | var tr = document.createElement("TR"); |
---|
| 735 | tr.className = "tr_message_body"; |
---|
| 736 | var td = document.createElement("TD"); |
---|
| 737 | td.setAttribute("colSpan","2"); |
---|
[2705] | 738 | td.id = "body_thumbs_"+msg_number; |
---|
| 739 | td.innerHTML += " <font color='DARKBLUE' size='2'><b>"+attachments.length+" "+get_lang("attachment")+(attachments.length > 1 ? "s" : "")+" "+get_lang("in this message")+"</font></b>"; |
---|
[2551] | 740 | var _link_attachments = ''; |
---|
[2705] | 741 | if(thumbs.length > 1){ |
---|
[2551] | 742 | _link_attachments = document.createElement("A"); |
---|
| 743 | _link_attachments.className = "message_options"; |
---|
| 744 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
[2705] | 745 | _link_attachments.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+msg_folder+"','"+msg_number+"')"); |
---|
[2551] | 746 | else |
---|
[2705] | 747 | _link_attachments.setAttribute("href", "javascript:download_all_attachments('"+msg_folder+"','"+msg_number+"')"); |
---|
[2551] | 748 | _link_attachments.innerHTML = get_lang('Download all atachments'); |
---|
| 749 | } |
---|
| 750 | |
---|
| 751 | if(_link_attachments){ |
---|
| 752 | td.innerHTML += " :: "; |
---|
| 753 | td.appendChild(_link_attachments); |
---|
| 754 | } |
---|
| 755 | |
---|
[2630] | 756 | td.innerHTML += "<BR><img src='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/menu/ktip.png'>"+get_lang("<b>Tip:</b> For faster save, click over the image with <u>right button</u>."); |
---|
[2551] | 757 | td.innerHTML += "<BR>"; |
---|
| 758 | |
---|
[2705] | 759 | for (var i=0; i<thumbs.length; i++){ |
---|
[2551] | 760 | if ((i % 4) == 0) |
---|
| 761 | td.innerHTML += "<BR>"; |
---|
[2705] | 762 | td.innerHTML += thumbs[i]; |
---|
[2551] | 763 | td.innerHTML += " "; |
---|
| 764 | } |
---|
| 765 | tr.appendChild(td); |
---|
| 766 | tbody_message_thumbs.appendChild(tr); |
---|
| 767 | table_message_thumbs.appendChild(tbody_message_thumbs); |
---|
[2705] | 768 | return table_message_thumbs; |
---|
[2715] | 769 | }; |
---|
[2551] | 770 | |
---|
[2715] | 771 | draw_message.prototype.getBcc = function(bccField){ |
---|
[2705] | 772 | /* |
---|
| 773 | * @AUTHOR Rodrigo Souza dos Santos |
---|
| 774 | * @MODIFY-DATE 2008/09/11 |
---|
| 775 | * @BRIEF Adding routine to create bcc (blind carbon copy) field if there is one. |
---|
| 776 | */ |
---|
| 777 | var tr3 = document.createElement("tr"); |
---|
| 778 | tr3.className = "tr_message_header"; |
---|
| 779 | var td3 = document.createElement("td"); |
---|
| 780 | td3.innerHTML = get_lang("BCC") + " : "; |
---|
| 781 | var cco = document.createElement("td"); |
---|
[2718] | 782 | cco.id = "cco_"+this.id; |
---|
[2551] | 783 | |
---|
[2718] | 784 | var cco_values = createAndSet("INPUT",['id', 'type', 'value'],["cco_values_"+this.id,"hidden",bccField]); |
---|
| 785 | ccoaddress_array[this.id] = bccField.split(","); |
---|
| 786 | if (ccoaddress_array[this.id].length > 1){ |
---|
[2705] | 787 | var div_ccoaddress = document.createElement("SPAN"); |
---|
[2718] | 788 | div_ccoaddress.id = "div_ccoaddress_"+this.id; |
---|
| 789 | var div_ccoaddress_full = createAndSet("SPAN",['id', 'style'],["div_ccoaddress_full_"+this.id, "display:inline"]); |
---|
[2705] | 790 | /* |
---|
| 791 | * The function below is ugly, doesn't possible use this. |
---|
| 792 | * The problem is that the code's function was written |
---|
| 793 | * on a hardcode concept. |
---|
| 794 | */ |
---|
[2718] | 795 | //cco.innerHTML = this.draw_plugin_cc(ccoaddress_array[this.id][0]); |
---|
| 796 | cco.innerHTML = ccoaddress_array[this.id][0]; |
---|
| 797 | div_ccoaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+this.id+"','cco');>"+get_lang('more')+"</a>)"; |
---|
[2705] | 798 | cco.appendChild(div_ccoaddress); |
---|
[2551] | 799 | } |
---|
[2705] | 800 | else{ |
---|
| 801 | /* |
---|
| 802 | * The function below is ugly, it is not possible to use this. |
---|
| 803 | * The problem is that the code's function was written |
---|
| 804 | * on a hardcode concept. |
---|
| 805 | */ |
---|
[2718] | 806 | //cco.innerHTML = this.draw_plugin_cc(info_msg.cco); |
---|
[2705] | 807 | cco.innerHTML = bccField; |
---|
| 808 | } |
---|
| 809 | cco.className = "header_message_field"; |
---|
| 810 | return appendChilds(tr3,td3,cco,cco_values); |
---|
[2715] | 811 | }; |
---|
[2551] | 812 | |
---|
[2715] | 813 | draw_message.prototype.blockImage = function(info_msg,ID,td){ |
---|
[2699] | 814 | var imgTag = info_msg.body.match(/(<img[^>]*src[^>=]*=['"]?[^'">]*["']?[^>]*>)|(<[^>]*(style[^=>]*=['"][^>]*background(-image)?:[^:;>]*url\()[^>]*>)/gi); |
---|
| 815 | |
---|
| 816 | var newBody = info_msg.body; |
---|
| 817 | if(!info_msg.showImg && imgTag) |
---|
| 818 | { |
---|
| 819 | var domains = ''; |
---|
| 820 | var blocked = false; |
---|
| 821 | var forbidden = true; |
---|
| 822 | |
---|
| 823 | if (preferences.notification_domains != null && typeof(preferences.notification_domains) != 'undefined') |
---|
| 824 | { |
---|
| 825 | domains = preferences.notification_domains.split(','); |
---|
| 826 | for(var j = 0; j < imgTag.length; j++) |
---|
| 827 | { |
---|
| 828 | for (var i = 0; i < domains.length; i++) |
---|
| 829 | { |
---|
| 830 | if (imgTag[j].match(/cid:([\w\d]){5,}/) || imgTag[j].match(/src=\"\.\/inc\/show_embedded_attach\.php/g)) |
---|
| 831 | { |
---|
| 832 | forbidden = false; |
---|
| 833 | continue; |
---|
| 834 | } |
---|
| 835 | imgSource = imgTag[j].match(/=['"](http:\/\/)+[^'"\/]*/); |
---|
| 836 | if (imgSource && imgSource.toString().substr(5).match(domains[i])) |
---|
| 837 | forbidden = false; |
---|
| 838 | } |
---|
| 839 | if (forbidden) |
---|
| 840 | { |
---|
| 841 | newBody = newBody.replace(imgTag[j],"<img src='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/forbidden.jpg'>"); |
---|
| 842 | blocked=true; |
---|
| 843 | } |
---|
| 844 | } |
---|
| 845 | if (blocked) |
---|
| 846 | { |
---|
| 847 | var showImgLink = document.createElement('DIV'); |
---|
| 848 | showImgLink.id="show_img_link_"+ID; |
---|
| 849 | showImgLink.onclick = function(){show_msg_img(info_msg.msg_number,info_msg.msg_folder)}; |
---|
| 850 | showImgLink.className="show_img_link"; |
---|
| 851 | showImgLink.innerHTML = get_lang("Show images from")+": "+info_msg.from.email; |
---|
| 852 | td.appendChild(showImgLink); |
---|
| 853 | } |
---|
| 854 | } |
---|
| 855 | } |
---|
| 856 | return newBody; |
---|
| 857 | |
---|
[2715] | 858 | }; |
---|
[2699] | 859 | |
---|
[2715] | 860 | draw_msg = new draw_message(); |
---|
| 861 | |
---|
[2551] | 862 | function changeLinkState(el,state){ |
---|
| 863 | el.innerHTML = get_lang(state); |
---|
| 864 | switch (state){ |
---|
| 865 | case 'important': |
---|
| 866 | { |
---|
[2553] | 867 | el.onclick = function(){changeLinkState(el,'normal');set_messages_flag('unflagged',currentTab.substr(0,currentTab.indexOf("_r"))); write_msg(get_lang('Message marked as ')+get_lang("Normal"))}; |
---|
[2551] | 868 | break; |
---|
| 869 | } |
---|
| 870 | case 'normal': |
---|
| 871 | { |
---|
[2553] | 872 | el.onclick = function(){ changeLinkState(el,'important');set_messages_flag('flagged',currentTab.substr(0,currentTab.indexOf("_r")));write_msg(get_lang('Message marked as ')+get_lang("Important"))}; |
---|
[2551] | 873 | break; |
---|
| 874 | } |
---|
| 875 | case 'unseen': |
---|
| 876 | { |
---|
[2553] | 877 | el.onclick = function(){ changeLinkState(el,'seen');set_messages_flag('unseen',currentTab.substr(0,currentTab.indexOf("_r")));write_msg(get_lang('Message marked as ')+get_lang("unseen"))}; |
---|
[2551] | 878 | break; |
---|
| 879 | |
---|
| 880 | } |
---|
| 881 | case 'seen': |
---|
| 882 | { |
---|
[2553] | 883 | el.onclick = function(){ changeLinkState(el,'unseen');set_messages_flag('seen',currentTab.substr(0,currentTab.indexOf("_r")));write_msg(get_lang('Message marked as ')+get_lang("seen"))}; |
---|
[2551] | 884 | break; |
---|
| 885 | |
---|
| 886 | } |
---|
| 887 | default: |
---|
| 888 | { |
---|
| 889 | break; |
---|
| 890 | } |
---|
| 891 | } |
---|
| 892 | } |
---|
| 893 | function constructMenuNewMessage(ID,tbody_message,table_message,content) |
---|
| 894 | { |
---|
| 895 | table_message.width = "100%"; |
---|
| 896 | |
---|
| 897 | var tr0 = document.createElement("TR"); |
---|
| 898 | tr0.className = "tr_message_header"; |
---|
| 899 | var td0 = document.createElement("TD"); |
---|
| 900 | td0.colSpan = '3'; |
---|
| 901 | |
---|
| 902 | var table_menu_new_message = document.createElement("TABLE"); |
---|
| 903 | table_menu_new_message.width = "100%"; |
---|
| 904 | table_menu_new_message.border = '0'; |
---|
| 905 | table_menu_new_message.className = 'table_message'; |
---|
| 906 | var tbody_menu_new_message = document.createElement("TBODY"); |
---|
| 907 | var tr_menu_new_message = document.createElement("TR"); |
---|
| 908 | var td_menu_new_message = document.createElement("TD"); |
---|
| 909 | td_menu_new_message.setAttribute("noWrap","true"); |
---|
| 910 | |
---|
| 911 | if ((preferences.save_in_folder == '-1') || (preferences.save_in_folder == '')){ |
---|
| 912 | //var option_send = '<span class="message_options" onclick=send_message("'+ID+'","null","null");>'+get_lang("Send")+'</span> | '; |
---|
| 913 | var option_send = '<input type="button" id="send_button_'+ID+'" class="em_button_like_span" tabindex="1" value="'+get_lang("Send")+'" onclick=send_message("'+ID+'","null","null");>' + ' | '; |
---|
| 914 | if(!expresso_offline) |
---|
| 915 | var option_send_and_file= '<span class="message_options" onclick=wfolders.makeWindow("'+ID+'","send_and_file");>'+get_lang("Send and file")+'</span> | '; |
---|
| 916 | else |
---|
| 917 | var option_send_and_file=''; |
---|
| 918 | } |
---|
| 919 | else{ |
---|
| 920 | //var option_send = '<span class="message_options" onclick="send_message(\''+ID+'\',\''+preferences.save_in_folder+'\',\'null\');">'+get_lang("Send")+'</span> | '; |
---|
| 921 | var option_send = '<input type="button" id="send_button_'+ID+'" class="em_button_like_span" tabindex="1" value="'+get_lang("Send")+'" onclick="send_message(\''+ID+'\',\''+preferences.save_in_folder+'\',\'null\');">' + ' | '; |
---|
| 922 | var option_send_and_file=''; |
---|
| 923 | wfolders.alert = true; |
---|
| 924 | } |
---|
| 925 | // var option_save_as = '<span class="message_options" onclick=wfolders.makeWindow("'+ID+'","save");>'+get_lang("Save as")+'</span> | '; |
---|
| 926 | if (!expresso_offline) { |
---|
| 927 | var option_save = '<span id="save_message_options_'+ID+'" class="message_options" onclick="openTab.toPreserve['+ID+'] = true; save_msg('+ID+');">'+get_lang("Save")+'</span> | '; |
---|
| 928 | var option_search = '<span class="message_options" onclick=openListUsers("'+ID+'");>'+get_lang("Search")+'</span>'; |
---|
| 929 | } |
---|
| 930 | else { |
---|
| 931 | var option_save = '<input type="hidden" id="save_message_options_'+ID+'">'; |
---|
| 932 | var option_search = ''; |
---|
| 933 | } |
---|
| 934 | td_menu_new_message.innerHTML = option_send + option_send_and_file + option_save + option_search; |
---|
| 935 | |
---|
| 936 | tr_menu_new_message.appendChild(td_menu_new_message); |
---|
| 937 | tbody_menu_new_message.appendChild(tr_menu_new_message); |
---|
| 938 | table_menu_new_message.appendChild(tbody_menu_new_message); |
---|
| 939 | |
---|
| 940 | content.appendChild(table_menu_new_message); |
---|
| 941 | tr0.appendChild(td0); |
---|
| 942 | tbody_message.appendChild(tr0); |
---|
| 943 | //////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 944 | } |
---|
| 945 | function constructFromField(tbody_message,ID) |
---|
| 946 | { |
---|
| 947 | var tr1_1 = document.createElement("TR"); |
---|
| 948 | tr1_1.style.display = 'none'; |
---|
| 949 | var td1_1 = document.createElement("TD"); |
---|
| 950 | td1_1.innerHTML = get_lang("From")+":"; |
---|
| 951 | td1_1.setAttribute("noWrap","true"); |
---|
| 952 | td1_1.style.width = "1%"; |
---|
| 953 | |
---|
| 954 | var td_from = document.createElement("TD"); |
---|
| 955 | td_from.setAttribute("noWrap","true"); |
---|
| 956 | td_from.style.width = "100%"; |
---|
| 957 | |
---|
| 958 | var sel_from = document.createElement('SELECT'); |
---|
| 959 | sel_from.id = "from_"+ID; |
---|
| 960 | sel_from.name = "input_from"; |
---|
| 961 | sel_from.style.width = "70%"; |
---|
| 962 | sel_from.setAttribute("wrap","soft"); |
---|
| 963 | td_from.appendChild(sel_from); |
---|
| 964 | tr1_1.appendChild(td1_1); |
---|
| 965 | tr1_1.appendChild(td_from); |
---|
| 966 | tbody_message.appendChild(tr1_1); |
---|
| 967 | if(!expresso_offline) |
---|
| 968 | draw_from_field(sel_from,tr1_1); |
---|
| 969 | var tr1 = document.createElement("TR"); |
---|
| 970 | var td1 = document.createElement("TD"); |
---|
| 971 | td1.innerHTML = get_lang("To")+":"; |
---|
| 972 | td1.setAttribute("noWrap","true"); |
---|
| 973 | td1.style.width = "1%"; |
---|
| 974 | |
---|
| 975 | var td_to = document.createElement("TD"); |
---|
| 976 | td_to.setAttribute("noWrap","true"); |
---|
| 977 | td_to.style.width = "100%"; |
---|
| 978 | |
---|
| 979 | var input_to = document.createElement('TEXTAREA'); |
---|
| 980 | input_to.id = "to_"+ID; |
---|
| 981 | input_to.name = "input_to"; |
---|
| 982 | input_to.setAttribute("tabIndex","1"); |
---|
| 983 | input_to.style.width = "100%"; |
---|
| 984 | input_to.setAttribute("wrap","soft"); |
---|
| 985 | input_to.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus', this.id);}; |
---|
| 986 | input_to.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; |
---|
| 987 | if (!is_ie) |
---|
| 988 | { |
---|
| 989 | input_to.rows = 2; |
---|
| 990 | input_to.onkeypress = function (e) |
---|
| 991 | { |
---|
| 992 | if ((e.keyCode) == 120) //F9 |
---|
| 993 | { |
---|
| 994 | emQuickSearch(input_to.value, 'to', ID); |
---|
| 995 | } |
---|
| 996 | else |
---|
| 997 | { |
---|
| 998 | if (((e.keyCode == 13) || ((e.keyCode == 38)||(e.keyCode == 40))) && (document.getElementById('tipDiv').style.visibility!='hidden')) |
---|
| 999 | { |
---|
| 1000 | e.preventDefault(); |
---|
| 1001 | search_contacts(e.keyCode,this.id); |
---|
| 1002 | } |
---|
| 1003 | } |
---|
| 1004 | }; |
---|
| 1005 | input_to.onkeyup = function (e) |
---|
| 1006 | { |
---|
| 1007 | if ((e.keyCode != 13) && (e.keyCode != 38) && (e.keyCode != 40)) |
---|
| 1008 | { |
---|
| 1009 | search_contacts(e.keyCode,this.id); |
---|
| 1010 | } |
---|
| 1011 | }; |
---|
| 1012 | } |
---|
| 1013 | else |
---|
| 1014 | { |
---|
| 1015 | input_to.rows = 3; |
---|
| 1016 | input_to.onkeyup = function (e) |
---|
| 1017 | { |
---|
| 1018 | if ((window.event.keyCode) == 120) //F9 |
---|
| 1019 | { |
---|
| 1020 | emQuickSearch(input_to.value, 'to', ID); |
---|
| 1021 | } |
---|
| 1022 | else |
---|
| 1023 | { |
---|
| 1024 | search_contacts(window.event.keyCode,this.id); |
---|
| 1025 | } |
---|
| 1026 | }; |
---|
| 1027 | } |
---|
| 1028 | td_to.appendChild(input_to); |
---|
| 1029 | |
---|
| 1030 | var forwarded_local_message = document.createElement("INPUT"); //Hidden para indicar se é um forward de uma mensagem local |
---|
| 1031 | forwarded_local_message.id = "is_local_forward"+ID; |
---|
| 1032 | forwarded_local_message.name = "is_local_forward"; |
---|
| 1033 | forwarded_local_message.type = "HIDDEN"; |
---|
| 1034 | forwarded_local_message.value = "0"; |
---|
| 1035 | td_to.appendChild(forwarded_local_message); |
---|
| 1036 | //////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1037 | |
---|
| 1038 | |
---|
| 1039 | if (!expresso_offline) { |
---|
| 1040 | var img_search = document.createElement("IMG"); |
---|
[2630] | 1041 | img_search.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/search.gif'; |
---|
[2551] | 1042 | img_search.title = get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.'); |
---|
| 1043 | img_search.onclick = function () {emQuickSearch(document.getElementById('to_'+ID).value, 'to', ID);}; |
---|
| 1044 | } |
---|
| 1045 | else { |
---|
| 1046 | var img_search = document.createElement("SPAN"); |
---|
| 1047 | } |
---|
| 1048 | |
---|
| 1049 | var span_search = document.createElement("SPAN"); |
---|
| 1050 | span_search.innerHTML = get_lang('Search'); |
---|
| 1051 | |
---|
| 1052 | var td1_img_search = document.createElement("TD"); |
---|
| 1053 | td1_img_search.setAttribute("noWrap","true"); |
---|
| 1054 | var td1_span_search = document.createElement("TD"); |
---|
| 1055 | td1_span_search.setAttribute("noWrap","true"); |
---|
| 1056 | |
---|
| 1057 | td1_img_search.appendChild(img_search); |
---|
| 1058 | td1_span_search.appendChild(span_search); |
---|
| 1059 | |
---|
| 1060 | tr1.appendChild(td1); |
---|
| 1061 | tr1.appendChild(td_to); |
---|
| 1062 | tr1.appendChild(td1_img_search); |
---|
| 1063 | |
---|
| 1064 | tbody_message.appendChild(tr1); |
---|
| 1065 | } |
---|
| 1066 | |
---|
[2561] | 1067 | function draw_new_message(border_ID) |
---|
| 1068 | { |
---|
| 1069 | Tooltip.init(); |
---|
| 1070 | |
---|
[2551] | 1071 | var ID = create_border("",border_ID); |
---|
| 1072 | if (ID === false){ |
---|
| 1073 | return false; |
---|
| 1074 | } |
---|
| 1075 | expresso.connector.hold_session = true; |
---|
| 1076 | |
---|
| 1077 | var footer_menu = Element("footer_menu"); |
---|
| 1078 | if (footer_menu) { |
---|
| 1079 | footer_menu.style.display = 'none'; |
---|
| 1080 | } |
---|
| 1081 | |
---|
| 1082 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1083 | var form = document.createElement("FORM"); |
---|
| 1084 | form.name = "form_message_"+ID; |
---|
| 1085 | form.method = "POST"; |
---|
| 1086 | form.onsubmit = function(){return false;}; |
---|
| 1087 | if(!is_ie) |
---|
| 1088 | form.enctype="multipart/form-data"; |
---|
| 1089 | else |
---|
| 1090 | form.encoding="multipart/form-data"; |
---|
| 1091 | |
---|
| 1092 | var content = Element('content_id_' + ID); |
---|
| 1093 | var table_message = document.createElement("TABLE"); |
---|
| 1094 | var tbody_message = document.createElement("TBODY"); |
---|
| 1095 | |
---|
| 1096 | constructMenuNewMessage(ID,tbody_message,table_message,content); |
---|
| 1097 | |
---|
| 1098 | constructFromField(tbody_message,ID); |
---|
| 1099 | |
---|
| 1100 | |
---|
| 1101 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1102 | var tr2 = document.createElement("TR"); |
---|
| 1103 | tr2.id = "tr_cc_"+ID; |
---|
| 1104 | tr2.style.display = 'none'; |
---|
| 1105 | var td2 = document.createElement("TD"); |
---|
| 1106 | td2.innerHTML = "Cc:"; |
---|
| 1107 | td2.setAttribute("noWrap","true"); |
---|
| 1108 | td2.style.width = "1%"; |
---|
| 1109 | |
---|
| 1110 | var td_cc = document.createElement("TD"); |
---|
| 1111 | td_cc.setAttribute("noWrap","true"); |
---|
| 1112 | td_cc.style.width = "100%"; |
---|
| 1113 | |
---|
| 1114 | var input_cc = document.createElement('TEXTAREA'); |
---|
| 1115 | input_cc.id = "cc_"+ID; |
---|
| 1116 | input_cc.name = "input_cc"; |
---|
| 1117 | input_cc.setAttribute("tabIndex","1"); |
---|
| 1118 | input_cc.style.width = "100%"; |
---|
| 1119 | input_cc.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus',this.id);}; |
---|
| 1120 | input_cc.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; |
---|
| 1121 | if (!is_ie) |
---|
| 1122 | { |
---|
| 1123 | input_cc.rows = 2; |
---|
| 1124 | input_cc.onkeypress = function (e) |
---|
| 1125 | { |
---|
| 1126 | if ((e.keyCode) == 120) //F9 |
---|
| 1127 | { |
---|
| 1128 | emQuickSearch(input_cc.value, 'cc', ID); |
---|
| 1129 | } |
---|
| 1130 | else |
---|
| 1131 | { |
---|
| 1132 | if (((e.keyCode == 13) || ((e.keyCode == 38)||(e.keyCode == 40))) && (document.getElementById('tipDiv').style.visibility!='hidden')) |
---|
| 1133 | { |
---|
| 1134 | e.preventDefault(); |
---|
| 1135 | search_contacts(e.keyCode,this.id); |
---|
| 1136 | } |
---|
| 1137 | } |
---|
| 1138 | }; |
---|
| 1139 | input_cc.onkeyup = function (e) |
---|
| 1140 | { |
---|
| 1141 | if ((e.keyCode != 13) && (e.keyCode != 38) && (e.keyCode != 40)) |
---|
| 1142 | { |
---|
| 1143 | search_contacts(e.keyCode,this.id); |
---|
| 1144 | } |
---|
| 1145 | }; |
---|
| 1146 | } |
---|
| 1147 | else if (is_ie) |
---|
| 1148 | { |
---|
| 1149 | input_cc.rows = 3; |
---|
| 1150 | input_cc.onkeyup = function (e) |
---|
| 1151 | { |
---|
| 1152 | if ((window.event.keyCode) == 120) //F9 |
---|
| 1153 | { |
---|
| 1154 | emQuickSearch(input_cc.value, 'cc', ID); |
---|
| 1155 | } |
---|
| 1156 | else |
---|
| 1157 | { |
---|
| 1158 | search_contacts(window.event.keyCode,this.id); |
---|
| 1159 | } |
---|
| 1160 | }; |
---|
| 1161 | } |
---|
| 1162 | |
---|
| 1163 | td_cc.appendChild(input_cc); |
---|
| 1164 | var img_search = document.createElement("IMG"); |
---|
[2630] | 1165 | img_search.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/search.gif'; |
---|
[2551] | 1166 | img_search.onclick = function () {emQuickSearch(document.getElementById('cc_'+ID).value, 'cc', ID)}; |
---|
| 1167 | img_search.title = get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.'); |
---|
| 1168 | var span_search = document.createElement("SPAN"); |
---|
| 1169 | span_search.innerHTML = get_lang('Search'); |
---|
| 1170 | |
---|
| 1171 | var td2_img_search = document.createElement("TD"); |
---|
| 1172 | td2_img_search.setAttribute("noWrap","true"); |
---|
| 1173 | var td2_span_search = document.createElement("TD"); |
---|
| 1174 | td2_span_search.setAttribute("noWrap","true"); |
---|
| 1175 | |
---|
| 1176 | td2_img_search.appendChild(img_search); |
---|
| 1177 | td2_span_search.appendChild(span_search); |
---|
| 1178 | |
---|
| 1179 | tr2.appendChild(td2); |
---|
| 1180 | tr2.appendChild(td_cc); |
---|
| 1181 | tr2.appendChild(td2_img_search); |
---|
| 1182 | tbody_message.appendChild(tr2); |
---|
| 1183 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1184 | var tr3 = document.createElement("TR"); |
---|
| 1185 | tr3.id = "tr_cco_"+ID; |
---|
| 1186 | tr3.style.display = 'none'; |
---|
| 1187 | var td3 = document.createElement("TD"); |
---|
| 1188 | td3.setAttribute("noWrap","true"); |
---|
| 1189 | td3.innerHTML = get_lang("CCo")+":"; |
---|
| 1190 | td3.style.width = "1%"; |
---|
| 1191 | |
---|
| 1192 | var td_cco = document.createElement("TD"); |
---|
| 1193 | td_cco.setAttribute("noWrap","true"); |
---|
| 1194 | td_cco.style.width = "100%"; |
---|
| 1195 | |
---|
| 1196 | var input_cco = document.createElement('TEXTAREA'); |
---|
| 1197 | input_cco.id = "cco_"+ID; |
---|
| 1198 | input_cco.name = "input_cco"; |
---|
| 1199 | input_cco.setAttribute("tabIndex","1"); |
---|
| 1200 | input_cco.style.width = "100%"; |
---|
| 1201 | input_cco.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus',this.id);}; |
---|
| 1202 | input_cco.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; |
---|
| 1203 | |
---|
| 1204 | if (!is_ie) |
---|
| 1205 | { |
---|
| 1206 | input_cco.rows = 2; |
---|
| 1207 | input_cco.onkeypress = function (e) |
---|
| 1208 | { |
---|
| 1209 | if ((e.keyCode) == 120) //F9 |
---|
| 1210 | { |
---|
| 1211 | emQuickSearch(input_cco.value, 'cco', ID); |
---|
| 1212 | } |
---|
| 1213 | else |
---|
| 1214 | { |
---|
| 1215 | if (((e.keyCode == 13) || ((e.keyCode == 38)||(e.keyCode == 40))) && (document.getElementById('tipDiv').style.visibility!='hidden')) |
---|
| 1216 | { |
---|
| 1217 | e.preventDefault(); |
---|
| 1218 | search_contacts(e.keyCode,this.id); |
---|
| 1219 | } |
---|
| 1220 | } |
---|
| 1221 | }; |
---|
| 1222 | input_cco.onkeyup = function (e) |
---|
| 1223 | { |
---|
| 1224 | if ((e.keyCode != 13) && (e.keyCode != 38) && (e.keyCode != 40)) |
---|
| 1225 | { |
---|
| 1226 | search_contacts(e.keyCode,this.id); |
---|
| 1227 | } |
---|
| 1228 | }; |
---|
| 1229 | } |
---|
| 1230 | else if (is_ie) |
---|
| 1231 | { |
---|
| 1232 | input_cco.rows = 3; |
---|
| 1233 | input_cco.onkeyup = function (e) |
---|
| 1234 | { |
---|
| 1235 | if ((window.event.keyCode) == 120) //F9 |
---|
| 1236 | { |
---|
| 1237 | emQuickSearch(input_cco.value, 'cco', ID); |
---|
| 1238 | } |
---|
| 1239 | else |
---|
| 1240 | { |
---|
| 1241 | search_contacts(window.event.keyCode,this.id); |
---|
| 1242 | } |
---|
| 1243 | }; |
---|
| 1244 | } |
---|
| 1245 | |
---|
| 1246 | td_cco.appendChild(input_cco); |
---|
| 1247 | var img_search = document.createElement("IMG"); |
---|
[2630] | 1248 | img_search.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/search.gif'; |
---|
[2551] | 1249 | img_search.title = get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.'); |
---|
| 1250 | img_search.onclick = function () {emQuickSearch(document.getElementById('cco_'+ID).value, 'cco', ID);}; |
---|
| 1251 | var span_search = document.createElement("SPAN"); |
---|
| 1252 | span_search.innerHTML = get_lang('Search'); |
---|
| 1253 | |
---|
| 1254 | var td3_img_search = document.createElement("TD"); |
---|
| 1255 | td3_img_search.setAttribute("noWrap","true"); |
---|
| 1256 | var td3_span_search = document.createElement("TD"); |
---|
| 1257 | td3_span_search.setAttribute("noWrap","true"); |
---|
| 1258 | |
---|
| 1259 | td3_img_search.appendChild(img_search); |
---|
| 1260 | td3_span_search.appendChild(span_search); |
---|
| 1261 | |
---|
| 1262 | tr3.appendChild(td3); |
---|
| 1263 | tr3.appendChild(td_cco); |
---|
| 1264 | tr3.appendChild(td3_img_search); |
---|
| 1265 | tbody_message.appendChild(tr3); |
---|
| 1266 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1267 | var tr_link = document.createElement("TR"); |
---|
| 1268 | tr_link.id = "tr_link_"+ID; |
---|
| 1269 | var td1_link = document.createElement("TD"); |
---|
| 1270 | var td2_link = document.createElement("TD"); |
---|
| 1271 | td1_link.innerHTML = " "; |
---|
| 1272 | var a_cc_link = document.createElement('A'); |
---|
| 1273 | a_cc_link.innerHTML = get_lang('Add CC'); |
---|
| 1274 | a_cc_link.id = "a_cc_link_"+ID; |
---|
| 1275 | a_cc_link.setAttribute("href","javascript:void(0)"); |
---|
| 1276 | a_cc_link.setAttribute("tabIndex","-1"); |
---|
| 1277 | a_cc_link.onclick = function () { |
---|
| 1278 | this.style.display='none'; |
---|
| 1279 | document.getElementById('tr_cc_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none'; |
---|
| 1280 | input_cc.focus(); |
---|
| 1281 | return false; |
---|
| 1282 | }; |
---|
| 1283 | td2_link.appendChild(a_cc_link); |
---|
| 1284 | var space = document.createElement("span"); |
---|
| 1285 | space.id ="space_link_"+ID; |
---|
| 1286 | space.innerHTML=" | "; |
---|
| 1287 | td2_link.appendChild(space); |
---|
| 1288 | var a_cco_link = document.createElement('A'); |
---|
| 1289 | a_cco_link.innerHTML = get_lang('Add BCC'); |
---|
| 1290 | a_cco_link.id = "a_cco_link_"+ID; |
---|
| 1291 | a_cco_link.setAttribute("href","javascript:void(0)"); |
---|
| 1292 | a_cco_link.setAttribute("tabIndex","-1"); |
---|
| 1293 | a_cco_link.onclick = function () { |
---|
| 1294 | this.style.display='none'; |
---|
| 1295 | document.getElementById('tr_cco_'+ID).style.display=''; |
---|
| 1296 | document.getElementById('space_link_'+ID).style.display='none'; |
---|
| 1297 | input_cco.focus(); |
---|
| 1298 | return false; |
---|
| 1299 | }; |
---|
| 1300 | td2_link.appendChild(a_cco_link); |
---|
| 1301 | tr_link.appendChild(td1_link); |
---|
| 1302 | tr_link.appendChild(td2_link); |
---|
| 1303 | tbody_message.appendChild(tr_link); |
---|
| 1304 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1305 | var tr4 = document.createElement("TR"); |
---|
| 1306 | var td4 = document.createElement("TD"); |
---|
| 1307 | //td4.setAttribute("noWrap","true"); |
---|
| 1308 | td4.innerHTML = get_lang("Subject")+":"; |
---|
| 1309 | var td_subject = document.createElement("TD"); |
---|
| 1310 | var input_subject = document.createElement('input'); |
---|
| 1311 | input_subject.id = "subject_"+ID; |
---|
| 1312 | input_subject.name = "input_subject"; |
---|
| 1313 | input_subject.setAttribute("tabIndex","1"); |
---|
| 1314 | input_subject.style.width = "90%"; |
---|
| 1315 | input_subject.setAttribute("autocomplete","off"); |
---|
| 1316 | td_subject.appendChild(input_subject); |
---|
| 1317 | tr4.appendChild(td4); |
---|
| 1318 | tr4.appendChild(td_subject); |
---|
| 1319 | tbody_message.appendChild(tr4); |
---|
| 1320 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1321 | var tr5 = document.createElement("TR"); |
---|
| 1322 | var td5 = document.createElement("TD"); |
---|
| 1323 | td5.innerHTML = " "; |
---|
| 1324 | var td_return_receipt = document.createElement("TD"); |
---|
| 1325 | td_return_receipt.setAttribute("noWrap","true"); |
---|
| 1326 | td_return_receipt.innerHTML = get_lang("Return receipt")+":"; |
---|
| 1327 | if (is_ie) |
---|
| 1328 | { |
---|
| 1329 | var input_return_receipt = document.createElement('input name=input_return_receipt'); |
---|
| 1330 | } |
---|
| 1331 | else |
---|
| 1332 | { |
---|
| 1333 | var input_return_receipt = document.createElement('input'); |
---|
| 1334 | input_return_receipt.name = "input_return_receipt"; |
---|
| 1335 | } |
---|
| 1336 | input_return_receipt.type = "checkbox"; |
---|
| 1337 | input_return_receipt.className = "checkbox"; |
---|
| 1338 | input_return_receipt.id = "return_receipt_"+ID; |
---|
| 1339 | input_return_receipt.setAttribute("tabIndex","-1"); |
---|
| 1340 | td_return_receipt.appendChild(input_return_receipt); |
---|
| 1341 | |
---|
| 1342 | // Workaround para resolver problema ao enviar e-mails |
---|
| 1343 | if((preferences.use_assinar_criptografar != '0')) |
---|
| 1344 | { |
---|
| 1345 | if(parseInt(preferences.use_signature_digital_cripto)==1) |
---|
| 1346 | { |
---|
| 1347 | td_return_receipt.innerHTML += " " + get_lang("Digitally sign message?")+""; |
---|
| 1348 | |
---|
| 1349 | if (is_ie) |
---|
| 1350 | { |
---|
| 1351 | var input_return_digital = document.createElement('input name=input_return_digital'); |
---|
| 1352 | } |
---|
| 1353 | else |
---|
| 1354 | { |
---|
| 1355 | var input_return_digital = document.createElement('input'); |
---|
| 1356 | input_return_digital.name = "input_return_digital"; |
---|
| 1357 | } |
---|
| 1358 | |
---|
| 1359 | input_return_digital.type = "checkbox"; |
---|
| 1360 | input_return_digital.className = "checkbox"; |
---|
| 1361 | input_return_digital.id = "return_digital_"+ID; |
---|
| 1362 | input_return_digital.setAttribute("tabIndex","-1"); |
---|
| 1363 | if(parseInt(preferences.use_signature_digital)==1) |
---|
| 1364 | { |
---|
| 1365 | input_return_digital.defaultChecked=true; |
---|
| 1366 | } |
---|
| 1367 | td_return_receipt.appendChild(input_return_digital); |
---|
| 1368 | td_return_receipt.innerHTML += " " + get_lang("Digitally crypt message?")+""; |
---|
| 1369 | |
---|
| 1370 | if (is_ie) |
---|
| 1371 | { |
---|
| 1372 | var input_return_cripto = document.createElement('input name=input_return_cripto'); |
---|
| 1373 | } |
---|
| 1374 | else |
---|
| 1375 | { |
---|
| 1376 | var input_return_cripto = document.createElement('input'); |
---|
| 1377 | input_return_cripto.name = "input_return_cripto"; |
---|
| 1378 | } |
---|
| 1379 | |
---|
| 1380 | input_return_cripto.type = "checkbox"; |
---|
| 1381 | input_return_cripto.className = "checkbox"; |
---|
| 1382 | input_return_cripto.id = "return_cripto_"+ID; |
---|
| 1383 | input_return_cripto.setAttribute("tabIndex","-1"); |
---|
| 1384 | input_return_cripto.defaultChecked=false; |
---|
| 1385 | |
---|
| 1386 | if(parseInt(preferences.use_signature_cripto)==1) |
---|
| 1387 | { |
---|
| 1388 | input_return_cripto.defaultChecked=true; |
---|
| 1389 | } |
---|
| 1390 | |
---|
| 1391 | td_return_receipt.appendChild(input_return_cripto); |
---|
| 1392 | } |
---|
[2681] | 1393 | |
---|
[2551] | 1394 | } |
---|
[2681] | 1395 | td_return_receipt.innerHTML += ""; |
---|
| 1396 | |
---|
[2551] | 1397 | tr5.appendChild(td5); |
---|
| 1398 | tr5.appendChild(td_return_receipt); |
---|
| 1399 | tbody_message.appendChild(tr5); |
---|
| 1400 | if (parseInt(preferences.use_important_flag)) |
---|
| 1401 | { |
---|
| 1402 | var trn = document.createElement("TR"); |
---|
| 1403 | var tdn = document.createElement("TD"); |
---|
| 1404 | tdn.innerHTML = " "; |
---|
| 1405 | var td_important_msg = document.createElement("TD"); |
---|
| 1406 | td_important_msg.setAttribute("noWrap","true"); |
---|
| 1407 | td_important_msg.innerHTML = get_lang("Important message")+":"; |
---|
| 1408 | var input_important_message = document.createElement('input'); |
---|
| 1409 | input_important_message.type = "checkbox"; |
---|
| 1410 | input_important_message.className = "checkbox"; |
---|
| 1411 | input_important_message.id = "important_message_"+ID; |
---|
| 1412 | input_important_message.name = "input_important_message"; |
---|
| 1413 | input_important_message.setAttribute("tabIndex","-1"); |
---|
| 1414 | td_important_msg.appendChild(input_important_message); |
---|
| 1415 | trn.appendChild(tdn); |
---|
| 1416 | trn.appendChild(td_important_msg); |
---|
| 1417 | tbody_message.appendChild(trn); |
---|
| 1418 | } |
---|
| 1419 | |
---|
| 1420 | var add_files = document.createElement("A"); |
---|
| 1421 | add_files.setAttribute("href", "javascript:void(0)"); |
---|
| 1422 | add_files.onclick = function () { addFile(ID); return false;}; |
---|
| 1423 | add_files.innerHTML = get_lang("Attachments: add+"); |
---|
| 1424 | add_files.setAttribute("tabIndex","-1"); |
---|
| 1425 | var divfiles = document.createElement("DIV"); |
---|
| 1426 | divfiles.id = "divFiles_"+ID; |
---|
| 1427 | var tr5 = document.createElement("TR"); |
---|
| 1428 | var td5_link = document.createElement("TD"); |
---|
| 1429 | var td5_input = document.createElement("TD"); |
---|
| 1430 | td5_input.innerHTML = " "; |
---|
| 1431 | td5_link.setAttribute("valign","top"); |
---|
| 1432 | td5_link.setAttribute("colSpan","2"); |
---|
| 1433 | td5_link.appendChild(add_files); |
---|
| 1434 | tr5.appendChild(td5_input); |
---|
| 1435 | tr5.appendChild(td5_link); |
---|
| 1436 | tbody_message.appendChild(tr5); |
---|
| 1437 | var tr6 = document.createElement("TR"); |
---|
| 1438 | var td6_link = document.createElement("TD"); |
---|
| 1439 | var td6_input = document.createElement("TD"); |
---|
| 1440 | tr6.appendChild(td6_link); |
---|
| 1441 | td6_input.appendChild(divfiles); |
---|
| 1442 | tr6.appendChild(td6_input); |
---|
| 1443 | tbody_message.appendChild(tr6); |
---|
| 1444 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1445 | var tr5 = document.createElement("TR"); |
---|
| 1446 | var td5 = document.createElement("TD"); |
---|
| 1447 | td5.innerHTML = " "; |
---|
| 1448 | var td_body = document.createElement("TD"); |
---|
| 1449 | td_body.setAttribute("colSpan","2"); |
---|
| 1450 | var div_body_position = document.createElement("DIV"); |
---|
| 1451 | div_body_position.id = "body_position_" + ID; |
---|
| 1452 | td_body.appendChild(div_body_position); |
---|
| 1453 | tr5.appendChild(td5); |
---|
| 1454 | tr5.appendChild(td_body); |
---|
| 1455 | tbody_message.appendChild(tr5); |
---|
| 1456 | // BEGIN MAKE THE SCROLL HEIGHT |
---|
| 1457 | var defaultWidth = document.body.clientWidth - (is_ie ? 200 : 195); |
---|
| 1458 | var _bar = document.getElementById("toolbar"); |
---|
| 1459 | var _offset = 0; |
---|
| 1460 | if(_bar.style.visibility != 'hidden') |
---|
| 1461 | _offset = _bar.offsetHeight ? _bar.offsetHeight : _bar.clientHeight; |
---|
| 1462 | var _div = document.createElement("DIV"); |
---|
| 1463 | _div.id = "div_message_scroll_"+ID; |
---|
| 1464 | _div.style.height = document.body.clientHeight - _offset - 105; |
---|
| 1465 | content.style.height = document.body.clientHeight - _offset - 80; |
---|
| 1466 | _div.style.overflow = "auto"; |
---|
| 1467 | _div.style.width = defaultWidth; |
---|
| 1468 | // END MAKE THE SCROLL HEIGHT |
---|
| 1469 | |
---|
| 1470 | // Hide the contac tips and re-position the pallete color. |
---|
| 1471 | _div.onscroll = function() { |
---|
| 1472 | var intElemScrollTop = Element("div_message_scroll_"+ID).scrollTop; |
---|
| 1473 | if (!is_ie) |
---|
| 1474 | ColorPalette.repos(intElemScrollTop); |
---|
| 1475 | Tooltip.scrollChanged(); |
---|
| 1476 | }; |
---|
| 1477 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1478 | _div.appendChild(form); |
---|
| 1479 | content.appendChild(_div); |
---|
| 1480 | table_message.appendChild(tbody_message); |
---|
| 1481 | form.appendChild(table_message); |
---|
| 1482 | expresso.connector.loadScript("jscode/rich_text_editor"); |
---|
| 1483 | RichTextEditor.loadEditor(ID); |
---|
| 1484 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1485 | return ID; |
---|
| 1486 | } |
---|
| 1487 | |
---|
| 1488 | // Verify if any user is sharing his name/email address |
---|
| 1489 | // for use in the new messages's "From " field. |
---|
| 1490 | function draw_from_field(sel_from,tr1_1){ |
---|
| 1491 | |
---|
| 1492 | var el_shared_users = Element("el_shared_users"); |
---|
| 1493 | // The element was loaded and populated...so return. |
---|
| 1494 | if(el_shared_users){ |
---|
| 1495 | // Nothing to work...so return. |
---|
| 1496 | if(el_shared_users.options.length == 0) |
---|
| 1497 | return; |
---|
| 1498 | tr1_1.style.display = ''; |
---|
| 1499 | for (var x = 0; x < el_shared_users.options.length; x++) { |
---|
| 1500 | var _option = document.createElement("OPTION"); |
---|
| 1501 | _option.text = el_shared_users.options[x].text; |
---|
| 1502 | _option.value = el_shared_users.options[x].value; |
---|
| 1503 | sel_from.options[sel_from.options.length] = _option; |
---|
| 1504 | } |
---|
| 1505 | return; |
---|
| 1506 | } |
---|
| 1507 | // Get the shared folders..... |
---|
| 1508 | var sharedFolders = new Array(); |
---|
| 1509 | for(var i = 0; i < folders.length; i++) { |
---|
| 1510 | var x = folders[i].folder_id; |
---|
| 1511 | if (folders[i].folder_parent == 'user'){ |
---|
| 1512 | sharedFolders[sharedFolders.length] = x; |
---|
| 1513 | } |
---|
| 1514 | } |
---|
| 1515 | |
---|
| 1516 | var matchUser = '#'; |
---|
| 1517 | var sharedUsers = new Array(); |
---|
| 1518 | // Filter the shared folders (only root folders) ..... |
---|
| 1519 | for(var i = 0; i < sharedFolders.length; i++) { |
---|
| 1520 | if(!sharedFolders[i].match(matchUser)) { |
---|
| 1521 | matchUser = sharedFolders[i]; |
---|
| 1522 | sharedUsers[sharedUsers.length] = matchUser.substring(("user"+cyrus_delimiter).length,matchUser.length); |
---|
| 1523 | } |
---|
| 1524 | } |
---|
| 1525 | |
---|
| 1526 | // Handler function for cExecute |
---|
| 1527 | var h_user = function(data) { |
---|
| 1528 | if(data.length > 0) { |
---|
| 1529 | tr1_1.style.display = ''; |
---|
| 1530 | var _option = document.createElement("OPTION"); |
---|
| 1531 | _option.text = '"'+data.myname+'" <'+Element("user_email").value+'>'; |
---|
| 1532 | _option.value = data.myname+";"+Element("user_email").value; |
---|
| 1533 | sel_from.options[sel_from.options.length] = _option; |
---|
| 1534 | |
---|
| 1535 | var options = ''; |
---|
| 1536 | for (var x = 0; x < data.length; x++) { |
---|
| 1537 | var _option = document.createElement("OPTION"); |
---|
| 1538 | _option.text = '"'+data[x].cn[0] + '" <'+data[x].mail[0]+'>'; |
---|
| 1539 | _option.value = data[x].cn[0] + ';'+data[x].mail[0]+';'+data[x].save_shared[0]+';'+data[x].uid[0]; |
---|
| 1540 | sel_from.options[sel_from.options.length] = _option; |
---|
| 1541 | } |
---|
| 1542 | } |
---|
| 1543 | var shared_users_from = Element("el_shared_users"); |
---|
| 1544 | if(!shared_users_from) { |
---|
| 1545 | shared_users_from = sel_from.cloneNode(true); |
---|
| 1546 | shared_users_from.id = "el_shared_users"; |
---|
| 1547 | shared_users_from.style.display = 'none'; |
---|
| 1548 | document.body.appendChild(shared_users_from); |
---|
| 1549 | } |
---|
| 1550 | }; |
---|
| 1551 | // First time, so execute..... |
---|
| 1552 | cExecute ("expressoMail1_2.ldap_functions.getSharedUsersFrom&uids="+sharedUsers.join(';'), h_user); |
---|
| 1553 | } |
---|
| 1554 | |
---|
| 1555 | function changeBgColorToON(all_messages, begin, end){ |
---|
| 1556 | for (begin; begin<=end; begin++) |
---|
| 1557 | { |
---|
| 1558 | add_className(all_messages[begin], 'selected_msg'); |
---|
| 1559 | Element("check_box_message_" + all_messages[begin].id).checked = true; |
---|
| 1560 | } |
---|
| 1561 | } |
---|
| 1562 | function updateBoxBgColor(box){ |
---|
| 1563 | // Set first TR Class |
---|
| 1564 | var _className = 'tr_msg_read2'; |
---|
| 1565 | for(var i = 0; i < box.length;i++){ |
---|
| 1566 | if(exist_className(box[i],_className)) |
---|
| 1567 | remove_className(box[i], _className); |
---|
| 1568 | _className = (_className == 'tr_msg_read2' ? 'tr_msg_read' : 'tr_msg_read2'); |
---|
| 1569 | if(!exist_className(box[i],_className)) |
---|
| 1570 | add_className( box[i], _className); |
---|
| 1571 | } |
---|
| 1572 | } |
---|
| 1573 | |
---|
| 1574 | function changeBgColor(event, msg_number){ |
---|
| 1575 | actual_tr = Element(msg_number); |
---|
| 1576 | |
---|
| 1577 | if (event.shiftKey) |
---|
| 1578 | { |
---|
| 1579 | last_tr = Element(last_message_selected); |
---|
| 1580 | if(!last_tr) |
---|
| 1581 | last_tr = actual_tr; |
---|
| 1582 | |
---|
| 1583 | all_messages = actual_tr.parentNode.childNodes; |
---|
| 1584 | |
---|
| 1585 | for (var i=0; i < all_messages.length; i++) |
---|
| 1586 | { |
---|
| 1587 | if (actual_tr.id == all_messages[i].id) |
---|
| 1588 | first_order = i; |
---|
| 1589 | if (last_tr.id == all_messages[i].id) |
---|
| 1590 | last_order = i; |
---|
| 1591 | } |
---|
| 1592 | |
---|
| 1593 | if (parseInt(first_order) > parseInt(last_order)) |
---|
| 1594 | changeBgColorToON(all_messages, last_order, first_order); |
---|
| 1595 | else |
---|
| 1596 | changeBgColorToON(all_messages, first_order, last_order); |
---|
| 1597 | } |
---|
| 1598 | else{ |
---|
| 1599 | //if ( exist_className(actual_tr, 'selected_msg') ) |
---|
| 1600 | if ( Element('check_box_message_' + msg_number).checked ) |
---|
| 1601 | add_className(actual_tr, 'selected_msg'); |
---|
| 1602 | else |
---|
| 1603 | remove_className(actual_tr, 'selected_msg'); |
---|
| 1604 | } |
---|
| 1605 | last_message_selected = msg_number; |
---|
| 1606 | } |
---|
| 1607 | |
---|
| 1608 | function deny_email(email){ |
---|
| 1609 | expresso.connector.loadScript("jscode/filter"); |
---|
| 1610 | expresso.connector.loadScript("jscode/filters"); |
---|
| 1611 | var dn_em = document.createElement("SPAN"); |
---|
| 1612 | dn_em.id = "tt_d"; |
---|
[2667] | 1613 | dn_em.onclick = function(){filter_rules.new_rule(url_encode(email));}; |
---|
[2551] | 1614 | dn_em.setAttribute("title",get_lang("Block Sender")); |
---|
| 1615 | dn_em.style.cursor = "pointer"; |
---|
[2667] | 1616 | dn_em.innerHTML = "<img align='top' onclick=filter.new_rule('"+url_encode(email)+"') src='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/deny.gif'>"; |
---|
[2551] | 1617 | return dn_em; |
---|
| 1618 | |
---|
| 1619 | } |
---|
| 1620 | |
---|
| 1621 | |
---|
| 1622 | function show_div_address_full(id, type) { |
---|
| 1623 | var div_address_full = Element("div_"+type+"address_full_"+id); |
---|
| 1624 | if(!div_address_full) { |
---|
| 1625 | div_address_full = document.createElement("SPAN"); |
---|
| 1626 | div_address_full.id = "div_"+type+"address_full_"+id; |
---|
| 1627 | div_address_full.style.display="none"; |
---|
| 1628 | var _address = eval(type+"address_array['"+id+"']"); |
---|
| 1629 | var isOverLimit = (_address.length > 100); |
---|
| 1630 | |
---|
| 1631 | if(isOverLimit) { |
---|
| 1632 | alert("Esse campo possui muitos endereços ("+_address.length+" destinatários).\r\n"+ |
---|
| 1633 | "Para evitar o travamento do navegador, o botão 'Adicionar Contato' foi desabilitado!"); |
---|
| 1634 | } |
---|
| 1635 | |
---|
| 1636 | for(var idx = 1 ; idx < _address.length;idx++) { |
---|
[2722] | 1637 | div_address_full.innerHTML += isOverLimit ? '<br>'+_address[idx] : ','+this.draw_plugin_cc(_address[idx]); |
---|
[2551] | 1638 | } |
---|
| 1639 | div_address_full.innerHTML += " (<a STYLE='color: RED;' onclick=document.getElementById('div_"+type+"address_full_"+id+"').style.display='none';document.getElementById('div_"+type+"address_"+id+"').style.display='';>"+get_lang('less')+"</a>)"; |
---|
| 1640 | Element(type+"_"+id).appendChild(div_address_full); |
---|
| 1641 | } |
---|
| 1642 | Element('div_'+type+'address_'+id).style.display='none'; |
---|
| 1643 | div_address_full.style.display=''; |
---|
| 1644 | } |
---|
| 1645 | function draw_footer_box(num_msgs){ |
---|
| 1646 | folder = get_current_folder(); |
---|
| 1647 | var span_R = Element("table_message"); |
---|
| 1648 | var span_options = Element("span_options"); |
---|
| 1649 | if(!span_options) { |
---|
| 1650 | span_options = document.createElement("TD"); |
---|
| 1651 | span_options.style.fontSize = "12"; |
---|
| 1652 | span_options.id = "span_options"; |
---|
| 1653 | span_R.appendChild(span_options); |
---|
| 1654 | } |
---|
| 1655 | |
---|
| 1656 | var change_font_color = 'onmouseover="var last_class = this.className;'+ |
---|
| 1657 | 'if (this.className != \'message_options_over\')'+ |
---|
| 1658 | 'this.className=\'message_options_active\'; '+ |
---|
| 1659 | 'this.onmouseout=function(){this.className=last_class;}"'; |
---|
| 1660 | |
---|
| 1661 | span_options.innerHTML = |
---|
| 1662 | '<span class="message_options_trash"><span ' + change_font_color + ' title="'+get_lang("Delete")+'" class="message_options" onclick=proxy_mensagens.delete_msgs(\'null\',\'selected\',\'null\')>'+get_lang("Delete")+'</span></span>'+ |
---|
| 1663 | '<span class="message_options_move"><span ' + change_font_color + ' title="'+get_lang("Move")+'" class="message_options" onclick=wfolders.makeWindow(\"\",\"move_to\")>'+get_lang("Move")+'</span></span>'+ |
---|
| 1664 | ((expresso_offline)?" ":'<span class="message_options_print"><span ' + change_font_color + ' title="'+get_lang("Print")+'" class="message_options" onclick=print_all()>'+get_lang("Print")+'</span></span>')+ |
---|
| 1665 | // '<span class="message_options_print"><span ' + change_font_color + ' title="'+get_lang("Print")+'" class="message_options" onclick=print_all()>'+get_lang("Print")+'</span></span>'+ |
---|
| 1666 | ((expresso_offline)?" ":'<span class="message_options_export"><span ' + change_font_color + ' title="'+get_lang("Export")+'" class="message_options" onclick="proxy_mensagens.export_all_messages()">'+get_lang("Export")+'</span></span>') + |
---|
| 1667 | ((expresso_offline)?" ":'<span class="message_options_import"><span ' + change_font_color + ' title="'+get_lang("Import")+'" class="message_options" onclick="import_window()">'+get_lang("Import")+'</span></span>'); |
---|
| 1668 | if(preferences.use_local_messages==1 && !expresso_offline) |
---|
| 1669 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
| 1670 | span_options.innerHTML += ' <span title="'+get_lang("Unarchive")+'" class="message_options" onclick="expresso_local_messages.unarchive_msgs(\''+folder+'\',null)">'+get_lang("Unarchive")+'</span>'; |
---|
| 1671 | else |
---|
| 1672 | span_options.innerHTML += ' <span title="'+get_lang("Archive")+'" class="message_options" onclick="archive_msgs(\''+folder+'\',null)">'+get_lang("Archive")+'</span>'; |
---|
| 1673 | if (use_spam_filter) { |
---|
| 1674 | if ( current_folder == 'INBOX'+cyrus_delimiter+'Spam' ) { |
---|
| 1675 | span_options.innerHTML += ' | <span ' + change_font_color + ' title="'+get_lang("Not Spam")+'" class="message_options" onclick="nospam(\'selected\',\'null\',\'null\')">'+get_lang("Not Spam")+'</span>'; |
---|
| 1676 | } |
---|
| 1677 | else { |
---|
| 1678 | span_options.innerHTML += ' | <span ' + change_font_color + ' title="'+get_lang("Mark as Spam")+'" class="message_options" onclick="spam(\'null\', \'selected\',\'null\')">'+get_lang("Mark as Spam")+'</span>'; |
---|
| 1679 | } |
---|
| 1680 | } |
---|
| 1681 | var span_D = Element("span_D"); |
---|
| 1682 | if(!span_D){ |
---|
| 1683 | span_D = document.createElement("TD"); |
---|
| 1684 | span_D.align = "right"; |
---|
| 1685 | span_D.style.fontSize = "12"; |
---|
| 1686 | span_D.id = "span_D"; |
---|
| 1687 | span_R.appendChild(span_D); |
---|
| 1688 | } |
---|
| 1689 | span_D.innerHTML = |
---|
| 1690 | get_lang("List")+': '+ |
---|
| 1691 | '<span ' + change_font_color + ' id="span_flag_SORTARRIVAL" class="'+(search_box_type == 'ALL' ? 'message_options_over' : 'message_options')+'" title="'+get_lang("All")+'" onclick="if(\'ALL\' == \''+search_box_type+'\') return false;sort_box(\'ALL\',\''+sort_box_type+'\')">'+get_lang("All")+'</span>, '+ |
---|
| 1692 | '<span ' + change_font_color + ' id="span_flag_UNSEEN" class="'+(search_box_type == 'UNSEEN' ? 'message_options_over' : 'message_options')+'" title="'+get_lang("l_unseen")+'" onclick="if(\'UNSEEN\' == \''+search_box_type+'\') return false;sort_box(\'UNSEEN\',\''+sort_box_type+'\')">'+get_lang("l_unseen")+'</span>, '+ |
---|
| 1693 | '<span ' + change_font_color + ' id="span_flag_SEEN" class="'+(search_box_type == 'SEEN' ? 'message_options_over' : 'message_options')+'" title="'+get_lang("l_seen")+'" onclick="if(\'SEEN\' == \''+search_box_type+'\') return false;sort_box(\'SEEN\',\''+sort_box_type+'\')">'+get_lang("l_seen")+'</span>, '+ |
---|
| 1694 | '<span ' + change_font_color + ' id="span_flag_ANSWERED" class="'+(search_box_type == 'ANSWERED' ? 'message_options_over' : 'message_options')+'" title="'+get_lang("l_answered")+'" onclick="if(\'ANSWERED\' == \''+search_box_type+'\') return false;sort_box(\'ANSWERED\',\''+sort_box_type+'\')">'+get_lang("l_answered")+'</span>, '+ |
---|
| 1695 | '<span ' + change_font_color + ' id="span_flag_FLAGGED" class="'+(search_box_type == 'FLAGGED' ? 'message_options_over' : 'message_options')+'" title="'+get_lang("l_important")+'" onclick="if(\'FLAGGED\' == \''+search_box_type+'\') return false;sort_box(\'FLAGGED\',\''+sort_box_type+'\')">'+get_lang("l_important")+'</span> '; |
---|
| 1696 | draw_paging(num_msgs); |
---|
| 1697 | Element("tot_m").innerHTML = num_msgs; |
---|
[2579] | 1698 | }; |
---|