[976] | 1 | var openTab = { |
---|
[607] | 2 | 'type' : [], // 8 types of tabs, further info. see expressolivre.org/dev/wiki/mail/Documentacao |
---|
[320] | 3 | 'content_id' : [], |
---|
[607] | 4 | 'imapUid' : [], // Stores the imap email number of current tab |
---|
| 5 | 'countFile' : [0,0,0,0,0,0,0,0,0,0], // Stores the number of files attached in current tab |
---|
| 6 | 'imapBox' : [], // Stores the folder name |
---|
[646] | 7 | 'toPreserve' : [], // Check if the message should be removed from draft after send |
---|
| 8 | 'autosave_timer' : [] // The timeout timer for autosave function |
---|
[607] | 9 | }; |
---|
| 10 | var tabTypes = { |
---|
| 11 | 'new':4, |
---|
| 12 | 'forward':6, |
---|
| 13 | 'reply_with_history':7, |
---|
| 14 | 'reply_to_all_with_history':7, |
---|
| 15 | 'reply_without_history':7, |
---|
| 16 | 'reply_to_all_without_history':7, |
---|
| 17 | 'edit':5 |
---|
| 18 | } |
---|
| 19 | var currentTab,numBox = 0; // Open Tab and num of mailboxes opened at context |
---|
[320] | 20 | |
---|
[2] | 21 | function draw_tree_folders(folders){ |
---|
| 22 | // Check if the tree folders alredy exist. |
---|
[51] | 23 | if (Element('dftree_tree_folders')){ |
---|
[2] | 24 | var update_tree_folders = function(data){ |
---|
[345] | 25 | build_quota(data); |
---|
[790] | 26 | var unseen_in_mailbox = 0; |
---|
| 27 | var unseen_in_shared_folders = 0; |
---|
[2] | 28 | for (var i=0; i<data.length; i++){ |
---|
[790] | 29 | if ( data[i].folder_unseen > 0 ) |
---|
| 30 | { |
---|
| 31 | unseen_in_mailbox = parseInt( unseen_in_mailbox + data[ i ].folder_unseen ); |
---|
| 32 | if ( data[i].folder_id.indexOf( 'INBOX' ) !== 0 ) |
---|
| 33 | unseen_in_shared_folders = parseInt( unseen_in_shared_folders + data[ i ].folder_unseen ); |
---|
| 34 | } |
---|
| 35 | |
---|
[2] | 36 | var folder_unseen = Element('dftree_'+data[i].folder_id+'_unseen'); |
---|
| 37 | |
---|
| 38 | if ((folder_unseen) && (data[i].folder_unseen > 0)) |
---|
| 39 | { |
---|
| 40 | folder_unseen.innerHTML = data[i].folder_unseen; |
---|
| 41 | } |
---|
| 42 | else if (data[i].folder_unseen > 0) |
---|
| 43 | { |
---|
[96] | 44 | tree_folders.getNodeById(data[i].folder_id).alter({caption:lang_folder(data[i].folder_name) + '<font style=color:red> (</font><span id="dftree_'+data[i].folder_id+'_unseen" style=color:red>'+data[i].folder_unseen+'</span><font style=color:red>)</font>'}); |
---|
[2] | 45 | tree_folders.getNodeById(data[i].folder_id)._refresh(); |
---|
| 46 | } |
---|
| 47 | else if (data[i].folder_unseen <= 0) |
---|
| 48 | { |
---|
[96] | 49 | tree_folders.getNodeById(data[i].folder_id).alter({caption:lang_folder(data[i].folder_name)}); |
---|
[2] | 50 | tree_folders.getNodeById(data[i].folder_id)._refresh(); |
---|
| 51 | } |
---|
| 52 | |
---|
[790] | 53 | if(data[i].folder_id == current_folder){ |
---|
[51] | 54 | var old_new_m = isNaN(parseInt(Element('new_m').innerHTML)) ? parseInt(Element('new_m').firstChild.innerHTML) : parseInt(Element('new_m').innerHTML); |
---|
[320] | 55 | // if(!isNaN(old_new_m) && old_new_m < data[i].folder_unseen){ |
---|
| 56 | // Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) + (parseInt(data[i].folder_unseen)-old_new_m); |
---|
| 57 | // } |
---|
[51] | 58 | Element('new_m').innerHTML = data[i].folder_unseen ? '<font color="RED">'+data[i].folder_unseen+'</font>' : 0; |
---|
[345] | 59 | draw_paging(Element('tot_m').innerHTML); |
---|
[2] | 60 | } |
---|
| 61 | } |
---|
[790] | 62 | |
---|
| 63 | var display_unseen_in_mailbox = tree_folders.getNodeById( 'root' ); |
---|
| 64 | //if ( unseen_in_mailbox ) |
---|
| 65 | // display_unseen_in_mailbox.alter({caption:'<font style=color:red>[</font><span id="dftree_root_unseen" style="color:red">' + unseen_in_mailbox +'</span><font style=color:red>]</font> ' + get_lang("My Folders")}); |
---|
| 66 | //else |
---|
| 67 | display_unseen_in_mailbox.alter({caption:get_lang("My Folders")}); |
---|
| 68 | display_unseen_in_mailbox._refresh(); |
---|
| 69 | |
---|
| 70 | var display_unseen_in_shared_folders = tree_folders.getNodeById( 'user' ); |
---|
| 71 | if ( display_unseen_in_shared_folders ) |
---|
| 72 | { |
---|
| 73 | if ( unseen_in_shared_folders ) |
---|
| 74 | display_unseen_in_shared_folders.alter({caption:'<font style=color:red>[</font><span id="dftree_user_unseen" style="color:red">' + unseen_in_shared_folders +'</span><font style=color:red>]</font> ' + get_lang("Shared folders")}); |
---|
| 75 | else |
---|
| 76 | display_unseen_in_shared_folders.alter({caption:get_lang("Shared folders")}); |
---|
| 77 | display_unseen_in_shared_folders._refresh(); |
---|
| 78 | } |
---|
[2] | 79 | } |
---|
[689] | 80 | cExecute ("$this.imap_functions.get_folders_list&folder="+current_folder, update_tree_folders); |
---|
[790] | 81 | |
---|
| 82 | |
---|
[689] | 83 | /** |
---|
| 84 | * Pastas locais |
---|
| 85 | */ |
---|
| 86 | if(preferences.use_local_messages==1) { |
---|
| 87 | var local_folders = expresso_local_messages.list_local_folders(); |
---|
| 88 | var has_changes = false; |
---|
| 89 | for (var i in local_folders) { //Coloca as pastas locais. |
---|
| 90 | var folder_unseen = Element('dftree_local_'+local_folders[i][0]+'_unseen'); |
---|
| 91 | |
---|
| 92 | if ((folder_unseen) && (local_folders[i][1] > 0)) |
---|
| 93 | { |
---|
| 94 | folder_unseen.innerHTML = local_folders[i][1]; |
---|
| 95 | has_changes = true; |
---|
| 96 | } |
---|
| 97 | else if (local_folders[i][1] > 0) |
---|
| 98 | { |
---|
| 99 | tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(local_folders[i][0]) + '<font style=color:red> (</font><span id="dftree_local_'+local_folders[i][0]+'_unseen" style=color:red>'+local_folders[i][1]+'</span><font style=color:red>)</font>'}); |
---|
| 100 | tree_folders.getNodeById("local_"+local_folders[i][0])._refresh(); |
---|
| 101 | has_changes = true; |
---|
| 102 | } |
---|
| 103 | else if (local_folders[i][1] <= 0) |
---|
| 104 | { |
---|
| 105 | tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(local_folders[i][0])}); |
---|
| 106 | tree_folders.getNodeById("local_"+local_folders[i][0])._refresh(); |
---|
| 107 | has_changes = true; |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | if("local_"+local_folders[i][0] == get_current_folder()){ |
---|
| 111 | var old_new_m = isNaN(parseInt(Element('new_m').innerHTML)) ? parseInt(Element('new_m').firstChild.innerHTML) : parseInt(Element('new_m').innerHTML); |
---|
| 112 | if(!isNaN(old_new_m) && old_new_m < local_folders[i][1]){ |
---|
| 113 | Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) + (parseInt(local_folders[i][1])-old_new_m); |
---|
| 114 | } |
---|
| 115 | Element('new_m').innerHTML = local_folders[i][1] ? '<font color="RED">'+local_folders[i][1]+'</font>' : 0; |
---|
| 116 | draw_paging(Element('tot_m').innerHTML); |
---|
| 117 | has_changes = true; |
---|
| 118 | } |
---|
| 119 | } |
---|
| 120 | if(has_changes) |
---|
| 121 | tree_folders.getNodeById("local_root").open(); |
---|
| 122 | |
---|
| 123 | } |
---|
| 124 | |
---|
[2] | 125 | return; |
---|
| 126 | } |
---|
| 127 | else{ |
---|
| 128 | tree_folders = new dFTree({name: 'tree_folders'}); |
---|
| 129 | |
---|
[53] | 130 | var n_root = new dNode({id:'root', caption: get_lang("My Folders")}); |
---|
[2] | 131 | tree_folders.add(n_root,'anything'); //Places the root; second argument can be anything. |
---|
[51] | 132 | |
---|
[790] | 133 | var unseen_in_mailbox = 0; |
---|
| 134 | var unseen_in_shared_folders = 0; |
---|
[2] | 135 | for (var i=0; i<folders.length; i++){ |
---|
| 136 | if (folders[i].folder_unseen > 0) |
---|
[320] | 137 | { |
---|
[790] | 138 | unseen_in_mailbox = parseInt( unseen_in_mailbox + folders[ i ].folder_unseen ); |
---|
| 139 | if ( folders[i].folder_id.indexOf( 'INBOX' ) !== 0 ) |
---|
| 140 | unseen_in_shared_folders = parseInt( unseen_in_shared_folders + folders[ i ].folder_unseen ); |
---|
| 141 | |
---|
[96] | 142 | var nn = new dNode({id:folders[i].folder_id, caption:lang_folder(folders[i].folder_name) + '<font style=color:red> (</font><span id="dftree_'+folders[i].folder_id+'_unseen" style=color:red>'+folders[i].folder_unseen+'</span><font style=color:red>)</font>', onClick:"change_folder('"+folders[i].folder_id+"','"+folders[i].folder_name+"')", plusSign:folders[i].folder_hasChildren}); |
---|
[320] | 143 | |
---|
| 144 | if( folders[i].folder_name.toLowerCase() == 'inbox' ) |
---|
| 145 | Element('new_m').innerHTML = '<font style="color:red">' + folders[i].folder_unseen + '</font>'; |
---|
| 146 | } |
---|
[2] | 147 | else |
---|
[96] | 148 | var nn = new dNode({id:folders[i].folder_id, caption:lang_folder(folders[i].folder_name), onClick:"change_folder('"+folders[i].folder_id+"','"+folders[i].folder_name+"')", plusSign:folders[i].folder_hasChildren}); |
---|
[2] | 149 | |
---|
| 150 | if (folders[i].folder_parent == '') |
---|
| 151 | folders[i].folder_parent = 'root'; |
---|
| 152 | else if (folders[i].folder_parent == 'user'){ |
---|
| 153 | if (!tree_folders.getNodeById('user')){ |
---|
[53] | 154 | var n_root_shared_folders = new dNode({id:'user', caption:get_lang("Shared folders"), plusSign:true}); |
---|
[2] | 155 | tree_folders.add(n_root_shared_folders,'root'); |
---|
| 156 | } |
---|
| 157 | } |
---|
| 158 | tree_folders.add(nn,folders[i].folder_parent); |
---|
| 159 | } |
---|
[689] | 160 | //tree_local_folders = new dFTree({name: 'tree_local_folders'}); |
---|
| 161 | /** |
---|
| 162 | * Pastas locais |
---|
| 163 | */ |
---|
| 164 | if (preferences.use_local_messages==1) { |
---|
| 165 | if (!window.google || !google.gears) { |
---|
| 166 | temp = confirm(get_lang("To use local messages you have to install google gears. Would you like to be redirected to gears installation page?")); |
---|
| 167 | if (temp) { |
---|
| 168 | location.href = "http://gears.google.com/?action=install&message="+ |
---|
| 169 | get_lang("To use local messages, install Google Gears")+"&return=" + document.location.href; |
---|
| 170 | } |
---|
| 171 | else { |
---|
| 172 | preferences.use_local_messages=0; |
---|
| 173 | } |
---|
| 174 | } |
---|
| 175 | else{ |
---|
| 176 | var root_local = new dNode({ |
---|
| 177 | id: "local_root", |
---|
[710] | 178 | caption: get_lang('local folders') |
---|
[689] | 179 | }); |
---|
| 180 | tree_folders.add(root_local, "root"); //coloca root local |
---|
| 181 | var local_folders = expresso_local_messages.list_local_folders(); |
---|
| 182 | for (var i in local_folders) { //Coloca as pastas locais. |
---|
| 183 | if (local_folders[i][1] > 0) |
---|
| 184 | var nodeLocal = new dNode({ |
---|
| 185 | id: "local_" + local_folders[i][0], |
---|
| 186 | caption: lang_folder(local_folders[i][0]) + '<font style=color:red> (</font><span id="local_unseen" style=color:red>' + local_folders[i][1] + '</span><font style=color:red>)</font>', |
---|
| 187 | onClick: "change_folder('local_" + local_folders[i][0] + "','" + local_folders[i][0] + "')", |
---|
| 188 | plusSign: 0 |
---|
| 189 | }); |
---|
| 190 | else |
---|
| 191 | var nodeLocal = new dNode({ |
---|
| 192 | id: "local_" + local_folders[i][0], |
---|
| 193 | caption: lang_folder(local_folders[i][0]), |
---|
| 194 | onClick: "change_folder('local_" + local_folders[i][0] + "','" + local_folders[i][0] + "')", |
---|
| 195 | plusSign: 0 |
---|
| 196 | }); |
---|
| 197 | tree_folders.add(nodeLocal, "local_root"); |
---|
| 198 | } |
---|
| 199 | } |
---|
| 200 | } |
---|
| 201 | |
---|
[2] | 202 | tree_folders.draw(Element('content_folders')); |
---|
| 203 | n_root.changeState(); |
---|
[790] | 204 | |
---|
| 205 | var trash_span=document.getElementById('lINBOX/'+trashfolder+'tree_folders'); |
---|
| 206 | var draft_span=document.getElementById('lINBOX/'+draftsfolder+'tree_folders'); |
---|
| 207 | var sent_span=document.getElementById('lINBOX/'+sentfolder+'tree_folders'); |
---|
| 208 | var spam_span=document.getElementById('lINBOX/'+spamfolder+'tree_folders'); |
---|
| 209 | |
---|
| 210 | if (trash_span) |
---|
| 211 | trash_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_trash.png)"; |
---|
| 212 | |
---|
| 213 | if (draft_span) |
---|
| 214 | draft_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_draft.png)" |
---|
| 215 | |
---|
| 216 | if (sent_span) |
---|
| 217 | sent_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_sent.png)"; |
---|
| 218 | |
---|
| 219 | if (spam_span) |
---|
| 220 | spam_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_spam.png)"; |
---|
| 221 | |
---|
| 222 | tree_folders.getNodeById('INBOX')._select(); |
---|
[2] | 223 | draw_paging(Element('tot_m').innerHTML); |
---|
[320] | 224 | // Draw right menu folders. |
---|
| 225 | /* |
---|
| 226 | var treeroot = document.getElementById('chroottree_folders'); |
---|
| 227 | for (var linkBox = treeroot.firstChild; linkBox != null; linkBox = linkBox.nextSibling) |
---|
| 228 | _dragArea.makeMenuBox(linkBox); |
---|
| 229 | */ |
---|
[790] | 230 | |
---|
| 231 | var display_unseen_in_mailbox = tree_folders.getNodeById( 'root' ); |
---|
| 232 | //if ( unseen_in_mailbox ) |
---|
| 233 | // display_unseen_in_mailbox.alter({caption:'<font style=color:red>[</font><span id="dftree_root_unseen" style="color:red">' + unseen_in_mailbox +'</span><font style=color:red>]</font> ' + get_lang("My Folders")}); |
---|
| 234 | //else |
---|
| 235 | display_unseen_in_mailbox.alter({caption:get_lang("My Folders")}); |
---|
| 236 | display_unseen_in_mailbox._refresh(); |
---|
| 237 | |
---|
| 238 | var display_unseen_in_shared_folders = tree_folders.getNodeById( 'user' ); |
---|
| 239 | if ( display_unseen_in_shared_folders ) |
---|
| 240 | { |
---|
| 241 | if ( unseen_in_shared_folders ) |
---|
| 242 | display_unseen_in_shared_folders.alter({caption:'<font style=color:red>[</font><span id="dftree_user_unseen" style="color:red">' + unseen_in_shared_folders +'</span><font style=color:red>]</font> ' + get_lang("Shared folders")}); |
---|
| 243 | else |
---|
| 244 | display_unseen_in_shared_folders.alter({caption:get_lang("Shared folders")}); |
---|
| 245 | display_unseen_in_shared_folders._refresh(); |
---|
| 246 | } |
---|
[2] | 247 | } |
---|
[790] | 248 | |
---|
[2] | 249 | var folder_create = ""; |
---|
| 250 | var nm1 = ""; |
---|
| 251 | if(tree_folders._folderPr.length > 0){ |
---|
| 252 | var nm_folder = ""; |
---|
| 253 | for(var i=0; i < tree_folders._folderPr.length; i++){ |
---|
| 254 | nm_folder = tree_folders._folderPr[i].split(cyrus_delimiter); |
---|
| 255 | if(nm_folder[0] == "INBOX"){ |
---|
| 256 | if(nm1 == ""){ |
---|
| 257 | nm1 = nm_folder[1]; |
---|
| 258 | folder_create = "INBOX" + cyrus_delimiter + nm_folder[1] + ";"; |
---|
| 259 | }else{ |
---|
| 260 | if( nm1 != nm_folder[1]){ |
---|
| 261 | folder_create += "INBOX" + cyrus_delimiter + nm_folder[1] + ";"; |
---|
| 262 | nm1 = nm_folder[1]; |
---|
| 263 | } |
---|
| 264 | } |
---|
| 265 | } |
---|
| 266 | } |
---|
| 267 | } |
---|
| 268 | if(folder_create != ""){ |
---|
[53] | 269 | if(confirm(get_lang("There are folders with invalid format. Do you want to fix them?"))){ |
---|
[2] | 270 | var handler_correct_folders = function(data){ |
---|
| 271 | //Timeout to release HTTPRequest , loadScript and update tree folders. |
---|
| 272 | if(data) |
---|
| 273 | setTimeout("connector.loadScript('TreeShow');ttreeBox.update_folder();",500); |
---|
| 274 | } |
---|
| 275 | cExecute("$this.imap_functions.create_extra_mailbox",handler_correct_folders,"nw_folders="+folder_create); |
---|
| 276 | } |
---|
| 277 | } |
---|
| 278 | } |
---|
| 279 | |
---|
| 280 | function update_menu(data){ |
---|
[446] | 281 | /* |
---|
| 282 | * @AUTHOR Rodrigo Souza dos Santos |
---|
| 283 | * @DATE 2008/09/15 |
---|
| 284 | * @BRIEF When occurs a error in imap server show the message that is in file "error.html". |
---|
| 285 | */ |
---|
| 286 | if ( data && data.imap_error ) |
---|
| 287 | { |
---|
[790] | 288 | connector.newRequest('error.html', 'templates/'+template+'/error.html', 'GET', |
---|
[446] | 289 | function(data) |
---|
| 290 | { |
---|
| 291 | var target = document.getElementById('divAppbox'); |
---|
| 292 | if ( target ) |
---|
| 293 | target.innerHTML = data; |
---|
| 294 | } |
---|
| 295 | ); |
---|
| 296 | return false; |
---|
| 297 | } |
---|
| 298 | |
---|
[2] | 299 | draw_tree_folders(data); |
---|
| 300 | if(data) { |
---|
[345] | 301 | build_quota(data); |
---|
[790] | 302 | var f_unseen = Element('dftree_'+current_folder+'_unseen'); |
---|
[2] | 303 | if(f_unseen && f_unseen.innerHTML) |
---|
| 304 | Element('new_m').innerHTML = '<font face="Verdana" size="1" color="RED">'+f_unseen.innerHTML+'</font>'; |
---|
| 305 | else |
---|
[320] | 306 | { |
---|
| 307 | if( parseInt(Element('new_m').innerHTML) == 0 ) |
---|
| 308 | Element('new_m').innerHTML = 0; |
---|
| 309 | } |
---|
[2] | 310 | folders = data; |
---|
[607] | 311 | cExecute ("$this.imap_functions.get_range_msgs2&folder=INBOX&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type=SORTARRIVAL&search_box_type=ALL&sort_box_reverse=1", handler_draw_box); |
---|
[2] | 312 | } |
---|
| 313 | } |
---|
| 314 | |
---|
| 315 | var handler_draw_box = function(data){ |
---|
[320] | 316 | draw_box(data, 'INBOX', true); |
---|
| 317 | //alternate_border(0); |
---|
[2] | 318 | } |
---|
| 319 | |
---|
| 320 | // Action on change folders. |
---|
| 321 | function change_folder(folder, folder_name){ |
---|
[607] | 322 | if (openTab.imapBox[0] != folder) |
---|
[2] | 323 | { |
---|
| 324 | current_folder = folder; |
---|
| 325 | var handler_draw_box = function(data) |
---|
| 326 | { |
---|
| 327 | if(!verify_session(data)) |
---|
| 328 | return; |
---|
[320] | 329 | alternate_border(0); |
---|
[163] | 330 | Element("border_id_0").innerHTML = " " + lang_folder(folder_name) + ' <font face="Verdana" size="1" color="#505050">[<span id="new_m"> </span> / <span id="tot_m"></span>]</font>'; |
---|
[320] | 331 | draw_box(data, folder, true); |
---|
[2] | 332 | draw_paging(data.num_msgs); |
---|
| 333 | Element("tot_m").innerHTML = data.num_msgs; |
---|
| 334 | update_menu(); |
---|
[320] | 335 | return true; |
---|
[2] | 336 | } |
---|
[689] | 337 | proxy_mensagens.messages_list(current_folder,1,preferences.max_email_per_page,sort_box_type,search_box_type,sort_box_reverse,handler_draw_box); |
---|
| 338 | // cExecute ("$this.imap_functions.get_range_msgs2&folder="+current_folder+"&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type="+sort_box_type+ "&search_box_type="+ search_box_type +"&sort_box_reverse="+sort_box_reverse+"", handler_draw_box); |
---|
| 339 | } |
---|
| 340 | else |
---|
[320] | 341 | alternate_border(0); |
---|
| 342 | } |
---|
| 343 | |
---|
| 344 | function open_folder(folder, folder_name){ |
---|
[790] | 345 | if (current_folder!= folder) { |
---|
[320] | 346 | current_folder = folder; |
---|
[325] | 347 | var handler_draw_box = function(data){ |
---|
[345] | 348 | if(!verify_session(data)) |
---|
| 349 | return false; |
---|
| 350 | numBox++; |
---|
| 351 | create_border(folder_name,numBox.toString()); |
---|
| 352 | draw_box(data, current_folder, false); |
---|
| 353 | alternate_border(numBox); |
---|
| 354 | return true; |
---|
[320] | 355 | } |
---|
[345] | 356 | cExecute ("$this.imap_functions.get_range_msgs2&folder="+current_folder+"&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type="+sort_box_type+ "&search_box_type="+ search_box_type +"&sort_box_reverse="+sort_box_reverse+"", handler_draw_box); |
---|
[2] | 357 | } |
---|
| 358 | else |
---|
[345] | 359 | alternate_border(numBox); |
---|
| 360 | return true; |
---|
[2] | 361 | } |
---|
| 362 | |
---|
| 363 | var lastPage = 1; |
---|
| 364 | var numPages = 5; |
---|
| 365 | var last_folder = 'INBOX'; |
---|
| 366 | function draw_paging(num_msgs){ |
---|
| 367 | num_msgs = parseInt(num_msgs); |
---|
| 368 | total_pages = 1; |
---|
| 369 | |
---|
[790] | 370 | if(last_folder != current_folder){ |
---|
[2] | 371 | lastPage = 1; |
---|
| 372 | current_page = 1; |
---|
[790] | 373 | last_folder = current_folder; |
---|
[2] | 374 | } |
---|
| 375 | |
---|
| 376 | if(num_msgs > parseInt(preferences.max_email_per_page)) { |
---|
| 377 | total_pages = parseInt(num_msgs/preferences.max_email_per_page); |
---|
| 378 | if((num_msgs/preferences.max_email_per_page) > total_pages) |
---|
| 379 | total_pages++; |
---|
| 380 | } |
---|
| 381 | |
---|
| 382 | if(total_pages == 1) { |
---|
| 383 | if(span_paging = document.getElementById("span_paging")) { |
---|
| 384 | span_paging.parentNode.removeChild(span_paging); |
---|
| 385 | } |
---|
| 386 | return; |
---|
| 387 | } |
---|
| 388 | |
---|
| 389 | span_paging = document.getElementById("span_paging"); |
---|
| 390 | if(!span_paging){ |
---|
| 391 | span_paging = document.createElement("DIV"); |
---|
| 392 | span_paging.id = "span_paging"; |
---|
| 393 | span_paging.align="right"; |
---|
| 394 | document.getElementById("div_menu_c3").appendChild(span_paging); |
---|
| 395 | } |
---|
| 396 | span_paging.style.width="100%"; |
---|
| 397 | span_paging.innerHTML=""; |
---|
| 398 | msg_range_begin = 1; |
---|
| 399 | msg_range_end = preferences.max_email_per_page; |
---|
| 400 | if(current_page != 1) { |
---|
| 401 | lnk_page = document.createElement("A"); |
---|
[689] | 402 | lnk_page.setAttribute("href", "javascript:current_page=1;kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+",function handler(data){draw_box(data, get_current_folder());});"); |
---|
[2] | 403 | } |
---|
| 404 | else { |
---|
| 405 | lnk_page = document.createElement("SPAN"); |
---|
| 406 | } |
---|
| 407 | span_paging.appendChild(lnk_page); |
---|
| 408 | |
---|
| 409 | lnk_page.innerHTML = "<<"; |
---|
| 410 | lnk_page.title = get_lang("First"); |
---|
| 411 | span_paging.innerHTML += " "; |
---|
| 412 | |
---|
| 413 | if(current_page == lastPage + numPages) |
---|
| 414 | lastPage = current_page - 1; |
---|
| 415 | else if((lastPage != 1 && lastPage == current_page) || current_page == total_pages) |
---|
| 416 | lastPage = current_page - (numPages - 1); |
---|
| 417 | else if(current_page == 1) |
---|
| 418 | lastPage = 1; |
---|
| 419 | |
---|
| 420 | if(lastPage < 1) |
---|
| 421 | lastPage = 1; |
---|
| 422 | else if(lastPage > 1 && (lastPage > (total_pages -(numPages - 1)))) |
---|
| 423 | lastPage = total_pages -(numPages - 1); |
---|
| 424 | |
---|
| 425 | var hasMarked = false; |
---|
| 426 | |
---|
| 427 | for(i = lastPage; i <= total_pages; i++) { |
---|
| 428 | |
---|
| 429 | if(current_page == i || (i == total_pages && !hasMarked)) { |
---|
| 430 | lnk_page = document.createElement("SPAN"); |
---|
| 431 | span_paging.appendChild(lnk_page); |
---|
| 432 | lnk_page.innerHTML = " <b>"+i+"</b> "; |
---|
| 433 | hasMarked = true; |
---|
| 434 | continue; |
---|
| 435 | } |
---|
| 436 | else{ |
---|
| 437 | lnk_page = document.createElement("A"); |
---|
| 438 | span_paging.appendChild(lnk_page); |
---|
| 439 | msg_range_begin = ((i*preferences.max_email_per_page)-(preferences.max_email_per_page-1)); |
---|
| 440 | msg_range_end = (i*preferences.max_email_per_page); |
---|
[689] | 441 | lnk_page.setAttribute("href", "javascript:current_page="+i+";kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+",function handler(data){draw_box(data, get_current_folder());});"); |
---|
[2] | 442 | } |
---|
| 443 | |
---|
| 444 | lnk_page.innerHTML = " ... "; |
---|
| 445 | |
---|
| 446 | if(i == (lastPage + numPages)) |
---|
| 447 | break; |
---|
| 448 | else if(lastPage == 1 || i != lastPage) |
---|
| 449 | lnk_page.innerHTML = " "+i+" "; |
---|
| 450 | |
---|
| 451 | span_paging.innerHTML += " "; |
---|
| 452 | } |
---|
| 453 | |
---|
| 454 | if(current_page != total_pages) { |
---|
| 455 | lnk_page = document.createElement("A"); |
---|
| 456 | msg_range_begin = ((total_pages*preferences.max_email_per_page)-(preferences.max_email_per_page-1)); |
---|
| 457 | msg_range_end = (total_pages*preferences.max_email_per_page); |
---|
[689] | 458 | lnk_page.setAttribute("href", "javascript:current_page="+total_pages+";kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+",function handler(data){draw_box(data, get_current_folder());});"); |
---|
[2] | 459 | } |
---|
| 460 | else { |
---|
| 461 | lnk_page = document.createElement("SPAN"); |
---|
| 462 | } |
---|
| 463 | span_paging.innerHTML += " "; |
---|
| 464 | span_paging.appendChild(lnk_page); |
---|
| 465 | |
---|
| 466 | lnk_page.title = get_lang("Last"); |
---|
| 467 | lnk_page.innerHTML = ">>"; |
---|
| 468 | } |
---|
| 469 | |
---|
| 470 | |
---|
| 471 | // Draw the inbox and another folders |
---|
[320] | 472 | function draw_box(headers_msgs, msg_folder, alternate){ |
---|
| 473 | if (alternate) |
---|
| 474 | kill_current_box(); |
---|
[2] | 475 | |
---|
| 476 | if(is_ie) |
---|
| 477 | document.getElementById("border_table").width = "99.5%"; |
---|
| 478 | |
---|
[607] | 479 | openTab.content_id[numBox] = document.getElementById("content_id_"+numBox); |
---|
| 480 | openTab.imapBox[numBox] = msg_folder; |
---|
[790] | 481 | openTab.type[numBox] = 0; |
---|
[2] | 482 | |
---|
[320] | 483 | table_message_header_box = document.getElementById("table_message_header_box_"+numBox); |
---|
[2] | 484 | if (table_message_header_box == null){ |
---|
| 485 | var table_element = document.createElement("TABLE"); |
---|
| 486 | var tbody_element = document.createElement("TBODY"); |
---|
[320] | 487 | table_element.setAttribute("id", "table_message_header_box_"+numBox); |
---|
[2] | 488 | table_element.className = "table_message_header_box"; |
---|
| 489 | |
---|
| 490 | tr_element = document.createElement("TR"); |
---|
| 491 | tr_element.className = "message_header"; |
---|
| 492 | td_element1 = document.createElement("TD"); |
---|
| 493 | td_element1.setAttribute("width", "1%"); |
---|
| 494 | chk_box_element = document.createElement("INPUT"); |
---|
| 495 | chk_box_element.id = "chk_box_select_all_messages"; |
---|
| 496 | chk_box_element.setAttribute("type", "checkbox"); |
---|
| 497 | chk_box_element.className = "checkbox"; |
---|
| 498 | chk_box_element.onclick = function(){select_all_messages(this.checked);}; |
---|
| 499 | chk_box_element.onmouseover = function () {this.title=get_lang('Select all messages.')}; |
---|
| 500 | chk_box_element.onkeydown = function (e){ |
---|
| 501 | if (is_ie) |
---|
| 502 | { |
---|
| 503 | if ((window.event.keyCode) == 46) |
---|
[689] | 504 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 505 | } |
---|
| 506 | else |
---|
| 507 | { |
---|
| 508 | if ((e.keyCode) == 46) |
---|
[689] | 509 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 510 | } |
---|
| 511 | }; |
---|
| 512 | |
---|
| 513 | td_element1.appendChild(chk_box_element); |
---|
| 514 | |
---|
| 515 | td_element2 = document.createElement("TD"); |
---|
[1035] | 516 | td_element2.setAttribute("width", "7%"); |
---|
[2] | 517 | td_element3 = document.createElement("TD"); |
---|
[1035] | 518 | td_element3.setAttribute("width", "29%"); |
---|
[51] | 519 | td_element3.onclick = function () {sort_box(search_box_type,'SORTFROM');}; |
---|
[320] | 520 | td_element3.id = "message_header_SORTFROM_"+numBox; |
---|
[2] | 521 | td_element3.align = "left"; |
---|
| 522 | td_element3.innerHTML = get_lang("Who"); |
---|
| 523 | |
---|
| 524 | td_element4 = document.createElement("TD"); |
---|
[1035] | 525 | td_element4.setAttribute("width", "38%"); |
---|
[51] | 526 | td_element4.onclick = function () {sort_box(search_box_type,'SORTSUBJECT');}; |
---|
[320] | 527 | td_element4.id = "message_header_SORTSUBJECT_"+numBox; |
---|
[2] | 528 | td_element4.align = "left"; |
---|
| 529 | td_element4.innerHTML = get_lang("Subject"); |
---|
| 530 | |
---|
| 531 | td_element5 = document.createElement("TD"); |
---|
| 532 | td_element5.setAttribute("width", "14%"); |
---|
[51] | 533 | td_element5.onclick = function () {sort_box(search_box_type,'SORTARRIVAL');}; |
---|
[320] | 534 | td_element5.id = "message_header_SORTARRIVAL_"+numBox; |
---|
[2] | 535 | td_element5.align = "center"; |
---|
| 536 | td_element5.innerHTML = get_lang("Date"); |
---|
| 537 | td_element6 = document.createElement("TD"); |
---|
| 538 | td_element6.setAttribute("width", "14%"); |
---|
[51] | 539 | td_element6.onclick = function () {sort_box(search_box_type,'SORTSIZE');} |
---|
[320] | 540 | td_element6.id = "message_header_SORTSIZE_"+numBox; |
---|
[2] | 541 | td_element6.align = "left"; |
---|
| 542 | td_element6.innerHTML = get_lang("Size"); |
---|
[994] | 543 | |
---|
[2] | 544 | tr_element.appendChild(td_element1); |
---|
[994] | 545 | tr_element.appendChild(td_element2); |
---|
[998] | 546 | var td_element21 = document.createElement("TD"); |
---|
[999] | 547 | td_element21.innerHTML = " "; |
---|
[998] | 548 | var td_element22 = document.createElement("TD"); |
---|
[999] | 549 | td_element22.innerHTML = " "; |
---|
[998] | 550 | var td_element23 = document.createElement("TD"); |
---|
| 551 | td_element23.innerHTML = " "; |
---|
| 552 | tr_element.appendChild(td_element21); |
---|
| 553 | tr_element.appendChild(td_element22); |
---|
| 554 | tr_element.appendChild(td_element23); |
---|
[2] | 555 | tr_element.appendChild(td_element3); |
---|
| 556 | tr_element.appendChild(td_element4); |
---|
| 557 | tr_element.appendChild(td_element5); |
---|
| 558 | tr_element.appendChild(td_element6); |
---|
| 559 | tbody_element.appendChild(tr_element); |
---|
| 560 | table_element.appendChild(tbody_element); |
---|
[607] | 561 | openTab.content_id[numBox].appendChild(table_element); |
---|
[2] | 562 | } |
---|
| 563 | draw_header_box(); |
---|
| 564 | var table_element = document.createElement("TABLE"); |
---|
[994] | 565 | var tbody_element = document.createElement("TBODY"); |
---|
[2] | 566 | table_element.id = "table_box"; |
---|
| 567 | table_element.className = "table_box"; |
---|
| 568 | table_element.borderColorDark = "#bbbbbb"; |
---|
| 569 | table_element.frame = "void"; |
---|
| 570 | table_element.rules = "rows"; |
---|
| 571 | table_element.cellPadding = "0"; |
---|
| 572 | table_element.cellSpacing = "0"; |
---|
| 573 | |
---|
| 574 | table_element.onkeydown = function (e){ |
---|
| 575 | if (is_ie) |
---|
| 576 | { |
---|
| 577 | if ((window.event.keyCode) == 46) |
---|
| 578 | { |
---|
| 579 | //delete_all_selected_msgs_imap(); |
---|
[689] | 580 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 581 | } |
---|
| 582 | } |
---|
| 583 | else |
---|
| 584 | { |
---|
| 585 | if ((e.keyCode) == 46) |
---|
| 586 | { |
---|
| 587 | //delete_all_selected_msgs_imap(); |
---|
[689] | 588 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 589 | } |
---|
| 590 | } |
---|
| 591 | }; |
---|
| 592 | if (is_ie) |
---|
| 593 | table_element.style.cursor = "hand"; |
---|
| 594 | |
---|
| 595 | tbody_element.setAttribute("id", "tbody_box"); |
---|
| 596 | table_element.appendChild(tbody_element); |
---|
[994] | 597 | |
---|
[320] | 598 | var _divScroll = document.getElementById("divScrollMain_"+numBox); |
---|
| 599 | |
---|
[2] | 600 | var bar = document.getElementById("toolbar"); |
---|
| 601 | var offset = 0; |
---|
| 602 | |
---|
| 603 | if(!_divScroll){ |
---|
| 604 | _divScroll = document.createElement("DIV"); |
---|
[320] | 605 | _divScroll.id = "divScrollMain_"+numBox; |
---|
[2] | 606 | } |
---|
| 607 | |
---|
[790] | 608 | _divScroll.style.overflowY = "auto"; |
---|
| 609 | _divScroll.style.overflowX = "hidden"; |
---|
| 610 | _divScroll.style.width ="100%"; |
---|
| 611 | |
---|
| 612 | if (is_mozilla){ |
---|
[2] | 613 | _divScroll.style.overflow = "-moz-scrollbars-vertical"; |
---|
| 614 | _divScroll.style.width ="99.3%"; |
---|
| 615 | } |
---|
[58] | 616 | // Inicio: Redimensiona DIV SCROLL |
---|
| 617 | var bar = Element("toolbar"); |
---|
| 618 | var offset = 0; |
---|
| 619 | if(bar.style.visibility != 'hidden') |
---|
| 620 | offset = (bar.offsetHeight ? bar.offsetHeight : bar.clientHeight); |
---|
| 621 | var screenHeight = document.body.clientHeight ? document.body.clientHeight : document.body.offsetHeight; |
---|
| 622 | var defaultHeight = screenHeight - offset; |
---|
| 623 | _divScroll.style.height = defaultHeight - 110; |
---|
[59] | 624 | Element('content_folders').style.height = defaultHeight - (is_ie ? 165 : 150); |
---|
[58] | 625 | // Fim: Redimensiona DIV SCROLL |
---|
[2] | 626 | _divScroll.appendChild(table_element); |
---|
[607] | 627 | openTab.content_id[numBox].appendChild(_divScroll); |
---|
[2] | 628 | |
---|
| 629 | var f_unseen = 0; |
---|
[139] | 630 | |
---|
| 631 | if (headers_msgs.num_msgs == 0){ |
---|
| 632 | td_info = document.createElement("H3"); |
---|
| 633 | td_info.setAttribute("height", "25%"); |
---|
| 634 | td_info.setAttribute("background", "#FFF"); |
---|
| 635 | td_info.setAttribute("id", "msg_info"); |
---|
| 636 | td_info.align = "center"; |
---|
| 637 | td_info.innerHTML = get_lang("This mail box is empty"); |
---|
| 638 | tbody_element.appendChild(td_info); |
---|
| 639 | } |
---|
| 640 | |
---|
| 641 | |
---|
[2] | 642 | for (var i=0; i < headers_msgs.length; i++){ |
---|
| 643 | if ((headers_msgs[i].Unseen == 'U') || (headers_msgs[i].Recent == 'N')) |
---|
| 644 | f_unseen++; |
---|
| 645 | tr_element = this.make_tr_message(headers_msgs[i], msg_folder); |
---|
[976] | 646 | if (tr_element){ |
---|
[790] | 647 | tbody_element.appendChild(tr_element); |
---|
[976] | 648 | add_className(tr_element, i%2 != 0 ? 'tr_msg_read2' : 'tr_msg_read'); |
---|
| 649 | } |
---|
[2] | 650 | _dragArea.makeDragged(tr_element, headers_msgs[i].msg_number, headers_msgs[i].subject, true); |
---|
| 651 | } |
---|
| 652 | |
---|
[128] | 653 | if ((preferences.use_shortcuts == '1') && (headers_msgs[0])) |
---|
[320] | 654 | select_msg(headers_msgs[0].msg_number, 'null', true); |
---|
[128] | 655 | |
---|
[2] | 656 | var tdFolders = Element("folderscol"); |
---|
| 657 | tdFolders.style.display = preferences.hide_folders == '1' ? "none" : ""; |
---|
[790] | 658 | if ( !currentTab ) |
---|
| 659 | alternate_border(numBox); |
---|
[46] | 660 | draw_footer_box(headers_msgs.num_msgs); |
---|
[2] | 661 | Element('main_table').style.display = ''; |
---|
| 662 | if(debug) { |
---|
| 663 | var _eTime = new Date(); |
---|
| 664 | _eTime = _eTime.getTime(); |
---|
| 665 | alert("Carregou em "+(_eTime - _bTime)+" ms"); |
---|
| 666 | } |
---|
| 667 | var msg_folder = Element('msg_folder').value; |
---|
| 668 | var msg_number = Element('msg_number').value; |
---|
| 669 | if(!msg_folder && msg_number) { |
---|
| 670 | new_message('new','null'); |
---|
| 671 | } |
---|
| 672 | else if(msg_folder && msg_number){ |
---|
| 673 | cExecute("$this.imap_functions.get_info_msg&msg_number="+ msg_number + "&msg_folder=" + msg_folder, show_msg); |
---|
| 674 | Element('msg_folder').value = ''; |
---|
| 675 | Element('msg_number').value = ''; |
---|
| 676 | } |
---|
| 677 | |
---|
| 678 | if(!is_ie) { |
---|
| 679 | var scripts = new Array("ccQuickAdd", |
---|
| 680 | "color_palette", |
---|
| 681 | "filter", |
---|
| 682 | "filters", |
---|
| 683 | "html2xhtml", |
---|
| 684 | "preferences", |
---|
| 685 | "QuickCatalogSearch", |
---|
[37] | 686 | "QuickSearchUser", |
---|
[2] | 687 | "rich_text_editor", |
---|
| 688 | "sharemailbox", |
---|
| 689 | "search", |
---|
| 690 | "TreeS", |
---|
| 691 | "TreeShow"); |
---|
| 692 | |
---|
[51] | 693 | connector.loadAllScripts(scripts); |
---|
[2] | 694 | } |
---|
| 695 | } |
---|
[790] | 696 | |
---|
[673] | 697 | function change_tr_properties(tr_element, newUid, newSubject){ |
---|
| 698 | var td_who = document.getElementById('td_who_'+tr_element.id); |
---|
| 699 | td_who.nextSibling.innerHTML = newSubject; |
---|
| 700 | tr_element.id = newUid; |
---|
| 701 | for (var i=2; i < 6; i++) |
---|
| 702 | tr_element.childNodes[i].id = tr_element.childNodes[i].id.replace(message_id,newUid); |
---|
| 703 | tr_element.onclick = function () { cExecute("$this.imap_functions.get_info_msg&msg_number="+newUid+"&msg_folder="+current_folder,show_msg); }; |
---|
| 704 | } |
---|
[2] | 705 | |
---|
| 706 | function make_tr_message(headers_msgs, msg_folder){ |
---|
[320] | 707 | var tr_element = document.createElement('tr'); |
---|
[2] | 708 | tr_element.style.height = preferences.line_height; |
---|
| 709 | var _fontSize = preferences.font_size ? preferences.font_size : "11"; |
---|
| 710 | tr_element.id = headers_msgs.msg_number; |
---|
[163] | 711 | |
---|
[614] | 712 | if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')){ |
---|
[673] | 713 | if ((headers_msgs.Flagged == 'F') || (headers_msgs.Importance.toLowerCase().indexOf("high")!=-1 && preferences.use_important_flag == 'True')) |
---|
[614] | 714 | add_className(tr_element, 'flagged_msg'); |
---|
[163] | 715 | add_className(tr_element, 'tr_msg_unread'); |
---|
[614] | 716 | } |
---|
| 717 | else{ |
---|
[673] | 718 | if ((headers_msgs.Flagged == 'F') || (headers_msgs.Importance.toLowerCase().indexOf("high")!=-1 && preferences.use_important_flag == 'True')) |
---|
[614] | 719 | add_className(tr_element,'flagged_msg'); |
---|
| 720 | } |
---|
[2] | 721 | |
---|
[790] | 722 | if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')) |
---|
| 723 | add_className(tr_element, 'tr_msg_unread'); |
---|
| 724 | |
---|
| 725 | if (headers_msgs.Flagged == 'F') |
---|
| 726 | add_className(tr_element,'flagged_msg'); |
---|
| 727 | |
---|
[2] | 728 | td_element1 = document.createElement("TD"); |
---|
[997] | 729 | td_element1.className = "td_msg"; |
---|
[2] | 730 | td_element1.setAttribute("width", "1%"); |
---|
| 731 | chk_box_element = document.createElement("INPUT"); |
---|
| 732 | chk_box_element.setAttribute("type", "checkbox"); |
---|
| 733 | chk_box_element.className = "checkbox"; |
---|
| 734 | chk_box_element.setAttribute("id", "check_box_message_"+headers_msgs.msg_number); |
---|
| 735 | chk_box_element.onclick = function(e){ |
---|
| 736 | if (is_ie) |
---|
| 737 | changeBgColor(window.event,headers_msgs.msg_number); |
---|
| 738 | else |
---|
| 739 | changeBgColor(e,headers_msgs.msg_number); |
---|
| 740 | }; |
---|
| 741 | td_element1.appendChild(chk_box_element); |
---|
| 742 | |
---|
| 743 | td_element2 = document.createElement("TD"); |
---|
[997] | 744 | td_element2.className = "td_msg"; |
---|
[2] | 745 | td_element2.setAttribute("width", "2%"); |
---|
| 746 | if (headers_msgs.attachment && headers_msgs.attachment.number_attachments > 0) |
---|
[994] | 747 | td_element2.innerHTML = "<img src ='templates/"+template+"/images/clip.gif' title='" + url_decode(headers_msgs.attachment.names) + "'>"; |
---|
[2] | 748 | |
---|
| 749 | td_element21 = document.createElement("TD"); |
---|
[997] | 750 | td_element21.className = "td_msg"; |
---|
[2] | 751 | td_element21.setAttribute("width", "1%"); |
---|
| 752 | td_element21.id = "td_message_answered_"+headers_msgs.msg_number; |
---|
| 753 | |
---|
[1035] | 754 | if (headers_msgs.attachment && headers_msgs.attachment.number_attachments > 0) { |
---|
| 755 | attach_name = headers_msgs.attachment.names.split(", "); |
---|
| 756 | for(var item in attach_name) |
---|
| 757 | { |
---|
| 758 | if (url_decode(attach_name[item]) != 'smime.p7s' && url_decode(attach_name[item]) != 'smime.p7m'){ |
---|
| 759 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/clip.gif' title='" + url_decode(attach_name[item]) + "'>"; |
---|
| 760 | break; |
---|
| 761 | } |
---|
| 762 | } |
---|
| 763 | } |
---|
| 764 | |
---|
[2] | 765 | if ((headers_msgs.Forwarded == 'F') || (headers_msgs.Draft == 'X' && headers_msgs.Answered == 'A')){ |
---|
[994] | 766 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/forwarded.gif' title='"+get_lang('Forwarded')+"'>"; |
---|
[2] | 767 | headers_msgs.Draft = '' |
---|
| 768 | headers_msgs.Answered = ''; |
---|
[1035] | 769 | headers_msgs.Forwarded = 'F'; |
---|
[2] | 770 | } |
---|
| 771 | else if (headers_msgs.Draft == 'X') |
---|
[994] | 772 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/draft.gif' title='"+get_lang('Draft')+"'>"; |
---|
[2] | 773 | else if (headers_msgs.Answered == 'A') |
---|
[994] | 774 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/answered.gif' title='"+get_lang('Answered')+"'>"; |
---|
[998] | 775 | else |
---|
| 776 | td_element21.innerHTML = " "; |
---|
[2] | 777 | |
---|
| 778 | td_element22 = document.createElement("TD"); |
---|
[997] | 779 | td_element22.className = "td_msg"; |
---|
[2] | 780 | td_element22.setAttribute("width", "1%"); |
---|
[1035] | 781 | td_element22.id = "td_message_signed_"+headers_msgs.msg_number; |
---|
[2] | 782 | |
---|
[1035] | 783 | //td_element23 = document.createElement("TD"); |
---|
| 784 | //td_element23.setAttribute("width", "1%"); |
---|
| 785 | //td_element23.id = "td_message_signed_"+headers_msgs.msg_number; |
---|
| 786 | switch(headers_msgs.ContentType) |
---|
| 787 | { |
---|
| 788 | case "signature": |
---|
| 789 | { |
---|
| 790 | td_element22.innerHTML = "<img src ='templates/"+template+"/images/signed_msg.gif' title='" + get_lang('Signed message') + "'>"; |
---|
| 791 | break; |
---|
| 792 | } |
---|
| 793 | case "cipher": |
---|
| 794 | { |
---|
| 795 | td_element22.innerHTML = "<img src ='templates/"+template+"/images/lock.gif' title='" + get_lang('Crypted message') + "'>"; |
---|
| 796 | break; |
---|
| 797 | } |
---|
| 798 | default: |
---|
| 799 | { |
---|
| 800 | break; |
---|
| 801 | } |
---|
| 802 | } |
---|
| 803 | |
---|
| 804 | td_element23 = document.createElement("TD"); |
---|
| 805 | td_element23.className = "td_msg" |
---|
| 806 | td_element23.setAttribute("width", "1%"); |
---|
| 807 | td_element23.id = "td_message_important_"+headers_msgs.msg_number; |
---|
| 808 | |
---|
[790] | 809 | if (headers_msgs.Flagged == 'F' || (headers_msgs.Importance.toLowerCase().indexOf("high") != -1 && preferences.use_important_flag == 'True')) |
---|
| 810 | { |
---|
[1035] | 811 | td_element23.innerHTML = "<img src ='templates/"+template+"/images/important.gif' title='"+get_lang('Important')+"'>"; |
---|
[790] | 812 | } |
---|
[2] | 813 | else |
---|
[1035] | 814 | td_element23.innerHTML = " "; |
---|
[790] | 815 | |
---|
[1035] | 816 | td_element24 = document.createElement("TD"); |
---|
| 817 | td_element24.className = "td_msg"; |
---|
| 818 | td_element24.setAttribute("width", "1%"); |
---|
| 819 | td_element24.id = "td_message_sent_"+headers_msgs.msg_number; |
---|
| 820 | td_element24.innerHTML = " "; |
---|
[2] | 821 | // preload image |
---|
| 822 | var _img_sent = new Image(); |
---|
[790] | 823 | _img_sent.src = "templates/"+template+"/images/sent.gif"; |
---|
[2] | 824 | |
---|
| 825 | td_element3 = document.createElement("TD"); |
---|
[997] | 826 | td_element3.className = "td_msg"; |
---|
[27] | 827 | td_element3.id = "td_who_"+ headers_msgs.msg_number; |
---|
[2] | 828 | td_element3.setAttribute("width", "30%"); |
---|
[689] | 829 | var _onclick = function(){InfoContact.hide();proxy_mensagens.get_msg(headers_msgs.msg_number, msg_folder,true, show_msg);}; |
---|
[2] | 830 | td_element3.onclick = _onclick; |
---|
| 831 | td_element3.innerHTML = ' '; |
---|
| 832 | |
---|
[790] | 833 | if (typeof(headers_msgs.from) == 'undefined') |
---|
| 834 | return false; |
---|
[456] | 835 | if(headers_msgs.from.email.toLowerCase() == Element("user_email").value) |
---|
| 836 | { |
---|
[2] | 837 | td_element3.onmouseover = function () {this.title=headers_msgs.to.email;}; |
---|
| 838 | if (headers_msgs.Draft == 'X') |
---|
| 839 | td_element3.innerHTML += "<span style=\"color:red\">("+get_lang("Draft")+") </span>"; |
---|
[456] | 840 | else{ |
---|
| 841 | if(headers_msgs.to.email.toLowerCase() != Element("user_email").value) |
---|
[1035] | 842 | td_element24.innerHTML = "<img valign='center' src ='templates/"+template+"/images/sent.gif' title='"+get_lang('Sent')+"'>"; |
---|
[2] | 843 | |
---|
| 844 | if ((headers_msgs.to)&&(headers_msgs.to.name != null)) |
---|
| 845 | td_element3.innerHTML += headers_msgs.to.name; |
---|
| 846 | else if (headers_msgs.to){ |
---|
| 847 | td_element3.innerHTML += headers_msgs.to.email; |
---|
| 848 | } |
---|
| 849 | } |
---|
| 850 | } |
---|
| 851 | else{ |
---|
| 852 | if (headers_msgs.Draft == 'X'){ |
---|
| 853 | td_element3.innerHTML = "<span style=\"color:red\">("+get_lang("Draft")+") </span>"; |
---|
| 854 | } |
---|
[1075] | 855 | else{ |
---|
| 856 | var spanSender = document.createElement("SPAN"); |
---|
| 857 | spanSender.onmouseover = function (event) {this.style.textDecoration = "underline";try {InfoContact.begin(this,headers_msgs.from.email)} catch(e){};}; |
---|
| 858 | spanSender.onmouseout = function (){ try {this.style.textDecoration = "none"; clearTimeout(InfoContact.timeout);} catch(e){}}; |
---|
| 859 | spanSender.innerHTML = headers_msgs.from.name != null ? headers_msgs.from.name : headers_msgs.from.email; |
---|
| 860 | if (spanSender.innerHTML.indexOf(" ") == '-1' && spanSender.innerHTML.length > 25){ |
---|
| 861 | spanSender.innerHTML = spanSender.innerHTML.substring(0,25) + "..."; |
---|
| 862 | } |
---|
| 863 | else if (spanSender.innerHTML.length > 40 ){ |
---|
| 864 | spanSender.innerHTML = spanSender.innerHTML.substring(0,40) + "..."; |
---|
| 865 | } |
---|
| 866 | td_element3.appendChild(spanSender); |
---|
[2] | 867 | } |
---|
[1075] | 868 | } |
---|
[2] | 869 | td_element4 = document.createElement("TD"); |
---|
[994] | 870 | td_element4.className = "td_msg"; |
---|
[2] | 871 | td_element4.setAttribute("width", "40%"); |
---|
| 872 | td_element4.onclick = _onclick; |
---|
| 873 | td_element4.innerHTML = !is_ie ? "<a id='a_message_"+tr_element.id+"'> " : " "; |
---|
| 874 | |
---|
| 875 | if ((headers_msgs.subject)&&(headers_msgs.subject.length > 50)) |
---|
| 876 | td_element4.innerHTML += headers_msgs.subject.substring(0,50) + "..."; |
---|
| 877 | else |
---|
| 878 | td_element4.innerHTML += headers_msgs.subject; |
---|
| 879 | |
---|
| 880 | if(!is_ie){ |
---|
| 881 | td_element4.innerHTML += "</a>"; |
---|
[72] | 882 | tr_element.onmouseover = function(){}; |
---|
[2] | 883 | } |
---|
[72] | 884 | |
---|
[2] | 885 | |
---|
| 886 | td_element5 = document.createElement("TD"); |
---|
[994] | 887 | td_element5.className = "td_msg"; |
---|
[2] | 888 | td_element5.setAttribute("width", "14%"); |
---|
| 889 | td_element5.onclick = _onclick; |
---|
| 890 | td_element5.setAttribute("align", "center"); |
---|
| 891 | td_element5.innerHTML = headers_msgs.udate; |
---|
| 892 | |
---|
| 893 | td_element6 = document.createElement("TD"); |
---|
[994] | 894 | td_element6.className = "td_msg"; |
---|
[2] | 895 | td_element6.setAttribute("width", "14%"); |
---|
| 896 | td_element6.onclick = _onclick; |
---|
| 897 | td_element6.setAttribute("noWrap","true"); |
---|
| 898 | td_element6.setAttribute("align", "center"); |
---|
| 899 | |
---|
| 900 | td_element3.style.fontSize= _fontSize; |
---|
| 901 | td_element4.style.fontSize= _fontSize; |
---|
| 902 | td_element5.style.fontSize= _fontSize; |
---|
| 903 | td_element6.style.fontSize= _fontSize; |
---|
| 904 | msg_size = headers_msgs.Size; |
---|
| 905 | if (msg_size < 1048576 && msg_size > 1024) |
---|
| 906 | td_element6.innerHTML = this.round(msg_size / 1024, 0) + ' Kb'; |
---|
| 907 | else if(msg_size > 1024) |
---|
| 908 | td_element6.innerHTML = this.round(msg_size / (1024*1024), 1) + ' Mb'; |
---|
| 909 | else |
---|
| 910 | td_element6.innerHTML = "1 Kb"; |
---|
| 911 | |
---|
| 912 | tr_element.appendChild(td_element1); |
---|
| 913 | tr_element.appendChild(td_element2); |
---|
| 914 | tr_element.appendChild(td_element21); |
---|
| 915 | tr_element.appendChild(td_element22); |
---|
| 916 | tr_element.appendChild(td_element23); |
---|
[1035] | 917 | tr_element.appendChild(td_element24); |
---|
[2] | 918 | tr_element.appendChild(td_element3); |
---|
| 919 | tr_element.appendChild(td_element4); |
---|
| 920 | tr_element.appendChild(td_element5); |
---|
| 921 | tr_element.appendChild(td_element6); |
---|
| 922 | return tr_element; |
---|
| 923 | } |
---|
| 924 | |
---|
[51] | 925 | function sort_box(search, sort){ |
---|
| 926 | var message_header = Element("message_header_"+search); |
---|
[2] | 927 | var handler_draw_box = function(data){ |
---|
[790] | 928 | draw_box(data, current_folder,true); |
---|
[2] | 929 | draw_paging(Element('tot_m').innerHTML); |
---|
[406] | 930 | //Mostrar as msgs nao lidas de acordo com o filtro de relevancia |
---|
| 931 | var msgs_unseen = 0; |
---|
| 932 | for(i in data){ |
---|
| 933 | if(data[i].Unseen == 'U') |
---|
| 934 | msgs_unseen++; |
---|
[427] | 935 | } |
---|
[470] | 936 | Element("new_m").innerHTML = '<font style="color:'+(msgs_unseen == 0 ? '': 'red')+'">' + msgs_unseen + '</font>'; |
---|
[2] | 937 | } |
---|
| 938 | |
---|
[51] | 939 | if(sort_box_type == sort && search_box_type == search){ |
---|
[46] | 940 | sort_box_reverse = sort_box_reverse ? 0 : 1; |
---|
[51] | 941 | } |
---|
| 942 | else if(sort_box_type != sort){ |
---|
[163] | 943 | if ( (sort == 'SORTFROM') || (sort == 'SORTSUBJECT') ) |
---|
| 944 | sort_box_reverse = 0; |
---|
| 945 | else |
---|
| 946 | sort_box_reverse = 1; |
---|
[51] | 947 | } |
---|
[156] | 948 | |
---|
[46] | 949 | // Global variable. |
---|
[51] | 950 | sort_box_type = sort; |
---|
| 951 | search_box_type = search; |
---|
[46] | 952 | |
---|
[689] | 953 | proxy_mensagens.messages_list(current_folder,1,preferences.max_email_per_page,sort,search,sort_box_reverse,handler_draw_box); |
---|
[2] | 954 | current_page = 1; |
---|
[406] | 955 | //Comentado para nao sobrepor o numero de msgs nao lidas ao utilizar os filtros |
---|
| 956 | //update_menu(); |
---|
[2] | 957 | } |
---|
| 958 | function draw_header_box(){ |
---|
| 959 | switch(sort_box_type){ |
---|
| 960 | case 'SORTFROM': |
---|
| 961 | type_name = get_lang("Who"); |
---|
| 962 | break; |
---|
| 963 | case 'SORTSUBJECT': |
---|
| 964 | type_name = get_lang("Subject"); |
---|
| 965 | break; |
---|
| 966 | case 'SORTARRIVAL': |
---|
| 967 | type_name = get_lang("Date"); |
---|
| 968 | break; |
---|
| 969 | case 'SORTSIZE': |
---|
| 970 | type_name = get_lang("Size"); |
---|
| 971 | break; |
---|
| 972 | default: |
---|
| 973 | type_name = get_lang("Date"); |
---|
[72] | 974 | break; |
---|
[2] | 975 | } |
---|
[320] | 976 | document.getElementById("message_header_SORTFROM_"+numBox).innerHTML = get_lang("Who"); |
---|
| 977 | document.getElementById("message_header_SORTSUBJECT_"+numBox).innerHTML = get_lang("Subject"); |
---|
| 978 | document.getElementById("message_header_SORTARRIVAL_"+numBox).innerHTML = get_lang("Date"); |
---|
| 979 | document.getElementById("message_header_SORTSIZE_"+numBox).innerHTML = get_lang("Size"); |
---|
[790] | 980 | document.getElementById("message_header_"+(sort_box_type.lastIndexOf("SORT") != "-1" ? sort_box_type : "SORTARRIVAL")+"_"+numBox ).innerHTML = "<B>"+type_name+"</B><img src ='templates/"+template+"/images/arrow_"+(sort_box_reverse == 1 ? 'desc' : 'asc')+"endant.gif'>"; |
---|
[2] | 981 | } |
---|
| 982 | function draw_message(info_msg, ID){ |
---|
| 983 | var content = document.getElementById('content_id_' + ID); |
---|
[65] | 984 | var defaultWidth = document.body.offsetWidth - 37; |
---|
[2] | 985 | |
---|
| 986 | var menuHidden = Element("folderscol").style.display == 'none' ? true : false; |
---|
| 987 | if(!menuHidden) |
---|
| 988 | defaultWidth -= Element("folderscol").offsetWidth; |
---|
| 989 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 990 | //Make the next/previous buttom. |
---|
| 991 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 992 | var next_previous_msg_td = document.createElement("TD"); |
---|
| 993 | next_previous_msg_td.setAttribute("noWrap","true"); |
---|
| 994 | next_previous_msg_td.align = "right"; |
---|
| 995 | next_previous_msg_td.width = "40px"; |
---|
| 996 | var img_next_msg = document.createElement("IMG"); |
---|
[128] | 997 | img_next_msg.id = 'msg_opt_next_' + ID; |
---|
[790] | 998 | img_next_msg.src = './templates/'+template+'/images/down.button.png'; |
---|
[2] | 999 | img_next_msg.title = get_lang('Next'); |
---|
| 1000 | img_next_msg.style.cursor = 'pointer'; |
---|
[569] | 1001 | |
---|
| 1002 | // Old |
---|
| 1003 | //img_next_msg.onclick = function () {cExecute ("$this.imap_functions.get_info_next_msg&msg_number="+ info_msg.msg_number + "&msg_folder="+ info_msg.msg_folder + "&sort_box_type="+ sort_box_type + "&search_box_type="+ search_box_type +"&sort_box_reverse="+ sort_box_reverse +"&reuse_border="+ID, show_msg)}; |
---|
[1035] | 1004 | var folder_id = 0; |
---|
| 1005 | folder_id = info_msg.original_ID ? info_msg.original_ID: info_msg.msg_number; |
---|
| 1006 | var folder = document.getElementById(folder_id); |
---|
[607] | 1007 | if (!folder){ |
---|
| 1008 | delete_border(ID); |
---|
| 1009 | return; |
---|
| 1010 | } |
---|
[1035] | 1011 | if (folder){ // mensagem local criptografada nao tem ID da pasta local |
---|
| 1012 | if (folder.nextSibling){ |
---|
| 1013 | var nextMsgBox = folder.nextSibling.name?folder.nextSibling.name:info_msg.msg_folder; |
---|
| 1014 | |
---|
| 1015 | if (nextMsgBox == "INBOX/decifradas")// teste para ver se a mensagem vem da pasta oculta decifradas |
---|
| 1016 | nextMsgBox = get_current_folder(); |
---|
| 1017 | |
---|
| 1018 | img_next_msg.onclick = function() |
---|
| 1019 | { |
---|
| 1020 | currentTab = ID; |
---|
| 1021 | openTab.type[ID] = 2; |
---|
| 1022 | proxy_mensagens.get_msg(parseInt(folder.nextSibling.id),nextMsgBox,true,show_msg); |
---|
| 1023 | //cExecute("$this.imap_functions.get_info_msg&msg_number="+folder.nextSibling.id+"&msg_folder="+nextMsgBox, show_msg); |
---|
| 1024 | }; |
---|
| 1025 | } |
---|
| 1026 | else |
---|
| 1027 | { |
---|
| 1028 | img_next_msg.src = "./templates/"+template+"/images/down.gray.button.png"; |
---|
| 1029 | img_next_msg.style.cursor = 'default'; |
---|
| 1030 | |
---|
| 1031 | } |
---|
| 1032 | } |
---|
| 1033 | else |
---|
| 1034 | { |
---|
| 1035 | img_next_msg.src = "./templates/"+template+"/images/down.gray.button.png"; |
---|
| 1036 | img_next_msg.style.cursor = 'default'; |
---|
| 1037 | if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(info_msg.msg_folder == "INBOX/decifradas")) // testa se a mensagem e local |
---|
[569] | 1038 | { |
---|
[1035] | 1039 | img_next_msg.onclick = function() |
---|
| 1040 | { |
---|
| 1041 | /*current_page++; |
---|
| 1042 | msg_range_end = (current_page*preferences.max_email_per_page); |
---|
| 1043 | msg_range_begin = (msg_range_end-(preferences.max_email_per_page)+1); |
---|
| 1044 | kill_current_box(); |
---|
| 1045 | cExecute ('$this.imap_functions.get_range_msgs2&folder='+current_folder+'&msg_range_begin='+msg_range_begin+'&msg_range_end='+msg_range_end+'&sort_box_reverse=1', function handler(data){draw_box(data, current_folder);}) */ |
---|
| 1046 | delete_border(ID); |
---|
| 1047 | }; |
---|
| 1048 | } |
---|
| 1049 | } |
---|
[2] | 1050 | var img_space = document.createElement("SPAN"); |
---|
| 1051 | img_space.innerHTML = " "; |
---|
| 1052 | var img_previous_msg = document.createElement("IMG"); |
---|
[128] | 1053 | img_previous_msg.id = 'msg_opt_previous_' + ID; |
---|
[790] | 1054 | img_previous_msg.src = './templates/'+template+'/images/up.button.png'; |
---|
[2] | 1055 | img_previous_msg.title = get_lang('Previous'); |
---|
| 1056 | img_previous_msg.style.cursor = 'pointer'; |
---|
[569] | 1057 | |
---|
| 1058 | //Old |
---|
| 1059 | //img_previous_msg.onclick = function () {cExecute ("$this.imap_functions.get_info_previous_msg&msgs_number="+ info_msg.msg_number + "&folder="+ info_msg.msg_folder + "&sort_box_type="+ sort_box_type+ "&search_box_type="+ search_box_type + "&sort_box_reverse="+ sort_box_reverse +"&reuse_border="+ID, show_msg)} |
---|
[1035] | 1060 | //folder = document.getElementById(ID.substr(0, ID.indexOf('_'))); |
---|
[607] | 1061 | if (!folder){ |
---|
[569] | 1062 | delete_border(ID); |
---|
[607] | 1063 | return; |
---|
| 1064 | } |
---|
[1035] | 1065 | if (folder){ // mensagem local criptografada nao tem ID da pasta local |
---|
| 1066 | if (folder.previousSibling) |
---|
| 1067 | { |
---|
| 1068 | var previousMsgBox = folder.previousSibling.name?folder.previousSibling.name:info_msg.msg_folder; |
---|
| 1069 | |
---|
| 1070 | if (previousMsgBox == "INBOX/decifradas") // teste para ver se a mensagem vem da pasta oculta decifradas |
---|
| 1071 | previousMsgBox = get_current_folder(); |
---|
| 1072 | |
---|
| 1073 | img_previous_msg.onclick = function() |
---|
| 1074 | { |
---|
| 1075 | currentTab = ID; |
---|
| 1076 | openTab.type[ID] = 2; |
---|
| 1077 | //cExecute("$this.imap_functions.get_info_msg&msg_number="+folder.previousSibling.id+"&msg_folder=" + previousMsgBox, show_msg); |
---|
| 1078 | proxy_mensagens.get_msg(parseInt(folder.previousSibling.id),previousMsgBox,true,show_msg); |
---|
| 1079 | }; |
---|
| 1080 | } |
---|
| 1081 | else |
---|
| 1082 | { |
---|
| 1083 | img_previous_msg.src = "./templates/"+template+"/images/up.gray.button.png"; |
---|
| 1084 | img_previous_msg.style.cursor = 'default'; |
---|
| 1085 | } |
---|
[569] | 1086 | } |
---|
| 1087 | else |
---|
[1035] | 1088 | { |
---|
| 1089 | img_previous_msg.src = "./templates/"+template+"/images/up.gray.button.png"; |
---|
| 1090 | img_previous_msg.style.cursor = 'default'; |
---|
| 1091 | if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(info_msg.msg_folder == "INBOX/decifradas")) // testa se a mensagem e local |
---|
| 1092 | { |
---|
| 1093 | img_previous_msg.onclick = function() |
---|
| 1094 | { |
---|
| 1095 | delete_border(ID); |
---|
| 1096 | }; |
---|
| 1097 | } |
---|
| 1098 | } |
---|
[2] | 1099 | next_previous_msg_td.appendChild(img_previous_msg); |
---|
| 1100 | next_previous_msg_td.appendChild(img_space); |
---|
| 1101 | next_previous_msg_td.appendChild(img_next_msg); |
---|
| 1102 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1103 | //Make the header message. |
---|
| 1104 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1105 | var table_message = document.createElement("TABLE"); |
---|
| 1106 | var tbody_message = document.createElement("TBODY"); |
---|
| 1107 | table_message.border = "0"; |
---|
| 1108 | table_message.width = defaultWidth ; |
---|
| 1109 | |
---|
| 1110 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1111 | //Make the options message. |
---|
| 1112 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1113 | var tr0 = document.createElement("TR"); |
---|
| 1114 | tr0.className = "tr_message_header"; |
---|
| 1115 | var td0 = document.createElement("TD"); |
---|
| 1116 | var table_message_options = document.createElement("TABLE"); |
---|
| 1117 | table_message_options.width = "100%"; |
---|
| 1118 | table_message_options.border = '0'; |
---|
| 1119 | table_message_options.className = 'table_message'; |
---|
| 1120 | var tbody_message_options = document.createElement("TBODY"); |
---|
| 1121 | var tr = document.createElement("TR"); |
---|
| 1122 | var td = document.createElement("TD"); |
---|
| 1123 | td.setAttribute("noWrap","true"); |
---|
| 1124 | var _name = ''; |
---|
| 1125 | var _maxChar = menuHidden ? 40 : 15; |
---|
| 1126 | if (info_msg.from.name) |
---|
| 1127 | _name = info_msg.from.name.length > _maxChar ? info_msg.from.name.substring(0,_maxChar) + "..." : info_msg.from.name; |
---|
| 1128 | else |
---|
| 1129 | _name = info_msg.from.email.length > _maxChar ? info_msg.from.email.substring(0,_maxChar) + "..." : info_msg.from.email; |
---|
| 1130 | |
---|
| 1131 | td.innerHTML = _name.bold() + ', ' + info_msg.smalldate; |
---|
| 1132 | if (info_msg.attachments.length > 0) |
---|
[790] | 1133 | td.innerHTML += " <img style='cursor:pointer' onclick='javascript:Element(\"option_hide_more_"+ID+"\").onclick()' src ='templates/"+template+"/images/clip.gif' title='"+info_msg.attachments.names+"'>"; |
---|
[2] | 1134 | |
---|
[91] | 1135 | if (typeof(info_msg.signature) == 'string') |
---|
| 1136 | { |
---|
[109] | 1137 | if (info_msg.signature != "void") |
---|
[790] | 1138 | td.innerHTML += ' <img style="cursor:pointer" onclick="alert(\''+ get_lang("This message is signed, and you can trust.") + info_msg.signature +'\');" src="templates/'+template+'/images/signed.gif">'; |
---|
[91] | 1139 | else |
---|
[790] | 1140 | 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='templates/"+template+"/images/invalid.gif'>"; |
---|
[91] | 1141 | } |
---|
| 1142 | |
---|
[320] | 1143 | if (info_msg.DispositionNotificationTo) |
---|
| 1144 | { |
---|
[790] | 1145 | td.innerHTML += ' <img style="cursor:pointer" alt="'+ get_lang('Message with read notification') + '" title="'+ get_lang('Message with read notification') + '" src="templates/'+template+'/images/notification.gif">'; |
---|
[320] | 1146 | } |
---|
| 1147 | |
---|
[2] | 1148 | // NORMAL MSG |
---|
| 1149 | if(info_msg.Draft != 'X') |
---|
| 1150 | { |
---|
| 1151 | var options = document.createElement("TD"); |
---|
[790] | 1152 | options.width = "30%"; |
---|
[2] | 1153 | options.setAttribute("noWrap","true"); |
---|
| 1154 | var option_hide_more = document.createElement("SPAN"); |
---|
| 1155 | option_hide_more.className = 'message_options'; |
---|
[24] | 1156 | options.align = 'right'; |
---|
[2] | 1157 | option_hide_more.value = 'more_options'; |
---|
| 1158 | option_hide_more.id = 'option_hide_more_'+ID; |
---|
| 1159 | option_hide_more.onclick = function(){ |
---|
| 1160 | var _height = Element("div_message_scroll_"+ID).style.height; |
---|
| 1161 | _height = parseInt(_height.replace("px","")); |
---|
| 1162 | var _offset = 35; |
---|
| 1163 | if (this.value == 'more_options'){ |
---|
[24] | 1164 | this.innerHTML = "<b><u>"+get_lang('Options')+"</u></b>"; |
---|
[2] | 1165 | this.value = 'hide_options'; |
---|
| 1166 | Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px"; |
---|
| 1167 | Element('table_message_others_options_'+ID).style.display = ''; |
---|
| 1168 | Element('tr_other_options_'+ID).style.display = ''; |
---|
| 1169 | |
---|
| 1170 | } |
---|
| 1171 | else{ |
---|
[24] | 1172 | this.innerHTML = get_lang('Options'); |
---|
[2] | 1173 | this.value = 'more_options'; |
---|
| 1174 | Element("div_message_scroll_"+ID).style.height = (_height + _offset)+"px"; |
---|
| 1175 | Element('table_message_others_options_'+ID).style.display = 'none'; |
---|
| 1176 | Element('tr_other_options_'+ID).style.display = 'none'; |
---|
| 1177 | } |
---|
| 1178 | }; |
---|
[790] | 1179 | var option_mark = document.createElement('TD'); |
---|
| 1180 | option_mark.align = "left"; |
---|
| 1181 | option_mark.width = "50%"; |
---|
[1035] | 1182 | var option_mark_as_unseen = '<span class="message_options" onclick="set_messages_flag(\'unseen\','+folder_id+');write_msg(\''+get_lang('Message marked as ')+get_lang("Unseen")+'.\');">'+get_lang("Unseen")+'</span>, '; |
---|
| 1183 | var option_mark_as_important = '<span class="message_options" onclick="set_messages_flag(\'flagged\','+folder_id+');write_msg(\''+get_lang('Message marked as ')+get_lang("Important")+'.\');">'+get_lang("Important")+'</span>, '; |
---|
| 1184 | var option_mark_as_normal = '<span class="message_options" onclick="set_messages_flag(\'unflagged\','+folder_id+');write_msg(\''+get_lang('Message marked as ')+get_lang("Normal")+'.\');">'+get_lang("Normal")+'</span>'; |
---|
[790] | 1185 | option_mark.innerHTML = option_mark_as_unseen+option_mark_as_important+option_mark_as_normal; |
---|
[24] | 1186 | option_hide_more.innerHTML = get_lang('Options'); |
---|
[2] | 1187 | options.appendChild(option_hide_more); |
---|
| 1188 | |
---|
[24] | 1189 | var space0 = document.createElement("SPAN"); |
---|
[790] | 1190 | space0.innerHTML = ' | '; |
---|
[2] | 1191 | var space1 = document.createElement("SPAN"); |
---|
[790] | 1192 | space1.innerHTML = ' | '; |
---|
[2] | 1193 | var space2 = document.createElement("SPAN"); |
---|
[790] | 1194 | space2.innerHTML = ' | '; |
---|
[2] | 1195 | var space3 = document.createElement("SPAN"); |
---|
[790] | 1196 | space3.innerHTML = ' | '; |
---|
[2] | 1197 | var space4 = document.createElement("SPAN"); |
---|
[790] | 1198 | space4.innerHTML = ' | '; |
---|
[2] | 1199 | |
---|
| 1200 | var option_forward = document.createElement("SPAN"); |
---|
[128] | 1201 | option_forward.id = 'msg_opt_forward_'+ID; |
---|
[2] | 1202 | option_forward.className = 'message_options'; |
---|
| 1203 | option_forward.onclick = function(){new_message('forward', ID);}; |
---|
[197] | 1204 | option_forward.innerHTML = get_lang('Forward'); |
---|
[2] | 1205 | options.appendChild(space1); |
---|
| 1206 | options.appendChild(option_forward); |
---|
| 1207 | var option_reply = document.createElement("SPAN"); |
---|
[128] | 1208 | option_reply.id = 'msg_opt_reply_'+ID; |
---|
[2] | 1209 | option_reply.className = 'message_options'; |
---|
| 1210 | option_reply.onclick = function(){new_message('reply_with_history', ID);}; |
---|
[197] | 1211 | option_reply.innerHTML = get_lang('Reply'); |
---|
[2] | 1212 | options.appendChild(space2); |
---|
| 1213 | options.appendChild(option_reply); |
---|
[790] | 1214 | /* TODO, template == default ? what hell you're doing*/ |
---|
| 1215 | if (template == "default"){ |
---|
| 1216 | var option_delete = document.createElement("SPAN"); |
---|
| 1217 | option_delete.id = 'msg_opt_delete_'+ID; |
---|
| 1218 | option_delete.className = 'message_options'; |
---|
| 1219 | option_delete.onclick = function(){proxy_mensagens.delete_msgs(info_msg.msg_folder, info_msg.msg_number, ID);}; |
---|
| 1220 | option_delete.innerHTML = get_lang('Delete'); |
---|
| 1221 | options.appendChild(space3); |
---|
| 1222 | options.appendChild(option_delete); |
---|
| 1223 | } |
---|
[2] | 1224 | |
---|
| 1225 | tr.appendChild(td); |
---|
[790] | 1226 | tr.appendChild(option_mark); |
---|
[2] | 1227 | tr.appendChild(options); |
---|
| 1228 | tr.appendChild(next_previous_msg_td); |
---|
| 1229 | tbody_message_options.appendChild(tr); |
---|
| 1230 | |
---|
| 1231 | ////////// OTHER OPTIONS //////////////////// |
---|
| 1232 | var tr_other_options = document.createElement("TR"); |
---|
| 1233 | tr_other_options.id = 'tr_other_options_' + ID; |
---|
| 1234 | tr_other_options.style.display = 'none'; |
---|
| 1235 | |
---|
| 1236 | var td_other_options = document.createElement("TD"); |
---|
| 1237 | td_other_options.colSpan = '3'; |
---|
| 1238 | //td_other_options.align = 'right'; |
---|
| 1239 | //td_other_options.setAttribute("noWrap","true"); |
---|
| 1240 | var div_other_options = document.createElement("DIV"); |
---|
| 1241 | |
---|
| 1242 | var option_mark_as = '<span>'+get_lang("Mark as")+'</span>: '; |
---|
[689] | 1243 | 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>, '; |
---|
| 1244 | 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>, '; |
---|
| 1245 | 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> | '; |
---|
[2] | 1246 | |
---|
| 1247 | var option_move = '<span class="message_options" onclick=wfolders.makeWindow("'+ID+'","move_to");>'+get_lang("Move")+'</span> | '; |
---|
[790] | 1248 | var option_reply_to_all = '<span onmouseover="this.className=\'message_options_active\'" onmouseout="this.className=\'message_options\'" class="message_options" onclick=new_message("reply_to_all_with_history","'+ID+'");>'+get_lang("Reply to all")+'</span> | '; |
---|
| 1249 | var option_reply_without_history = '<span onmouseover="this.className=\'message_options_active\'" onmouseout="this.className=\'message_options\'" class="message_options" onclick=new_message("reply_without_history","'+ID+'");>'+get_lang("Reply without history")+'</span> | '; |
---|
| 1250 | var option_reply_to_all_without_history = '<span onmouseover="this.className=\'message_options_active\'" onmouseout="this.className=\'message_options\'" class="message_options" onclick=new_message("reply_to_all_without_history","'+ID+'");>'+get_lang("Reply to all without history")+'</span> </div>'; |
---|
| 1251 | var option_source_msg =""; //= '<span class="message_options" onclick=source_msg("'+ID+'","'+url_encode(info_msg.msg_folder)+'");>'+get_lang("Message Font")+'</span>'; |
---|
[2] | 1252 | |
---|
[790] | 1253 | div_other_options.innerHTML = option_reply_to_all + option_reply_without_history + option_reply_to_all_without_history + option_source_msg; |
---|
[69] | 1254 | if (use_spam_filter) { |
---|
[75] | 1255 | if(info_msg.msg_folder == 'INBOX'+cyrus_delimiter+'Spam') |
---|
| 1256 | div_other_options.innerHTML += ' | <span class="message_options" onclick="nospam('+info_msg.msg_number+',\'null\', \''+info_msg.msg_folder+'\')";>'+get_lang("Not Spam")+'</span>'; |
---|
[69] | 1257 | else |
---|
[106] | 1258 | div_other_options.innerHTML += ' | <span class="message_options" onclick="spam(\''+info_msg.msg_folder+'\', '+info_msg.msg_number+',\'null\')";>'+get_lang("Mark as Spam")+'</span>'; |
---|
[69] | 1259 | } |
---|
[320] | 1260 | |
---|
[2] | 1261 | td_other_options.appendChild(div_other_options); |
---|
| 1262 | //td_other_options.innerHTML = option_print + option_reply_to_all + option_source_msg; |
---|
| 1263 | |
---|
| 1264 | tr_other_options.appendChild(td_other_options); |
---|
| 1265 | tbody_message_options.appendChild(tr_other_options); |
---|
| 1266 | ////////// END OTHER OPTIONS //////////////// |
---|
[1035] | 1267 | |
---|
| 1268 | ////////// BEGIN SIGNATURE ////////////////// |
---|
| 1269 | if (info_msg.signature && info_msg.signature.length > 0) |
---|
| 1270 | { |
---|
| 1271 | var tr_signature = document.createElement("TR"); |
---|
| 1272 | var td_signature = document.createElement("TD"); |
---|
| 1273 | td_signature.className = 'tr_message_header'; |
---|
| 1274 | tr_signature.id = 'tr_signature_'+ID; |
---|
| 1275 | td_signature.colSpan = "5"; |
---|
| 1276 | tr_signature.style.display = 'none'; |
---|
| 1277 | |
---|
| 1278 | for (i in info_msg.signature) |
---|
| 1279 | td_signature.innerHTML += '<span>'+info_msg.signature[i]+'</span> <br /> '; |
---|
| 1280 | var signature_status_pos = info_msg.signature[0].indexOf(get_lang('Message untouched')); |
---|
| 1281 | td_signature.id = "td_signature_"+ID; |
---|
| 1282 | if(signature_status_pos < 0 ) |
---|
| 1283 | { |
---|
| 1284 | td.innerHTML += ' <img style="cursor:pointer" src="templates/'+template+'/images/signed_error.gif" title="'+get_lang("Details")+'">'; |
---|
| 1285 | tr_signature.style.display = ''; |
---|
| 1286 | } |
---|
| 1287 | else |
---|
| 1288 | { |
---|
| 1289 | td.innerHTML += ' <img style="cursor:pointer" src="templates/'+template+'/images/signed_table.gif" title="'+get_lang("Details")+'">'; |
---|
| 1290 | } |
---|
| 1291 | td.onclick = function(){ |
---|
| 1292 | var _height = Element("div_message_scroll_"+ID).style.height; |
---|
| 1293 | _height = parseInt(_height.replace("px","")); |
---|
| 1294 | var _offset = 130; |
---|
| 1295 | if (this.value == 'more_cert'){ |
---|
| 1296 | //this.innerHTML += "<b><u>Mais Informaᅵᅵes</u></b>"; |
---|
| 1297 | this.value = 'hide_cert'; |
---|
| 1298 | Element("div_message_scroll_"+ID).style.height = (_height + _offset)+"px"; |
---|
| 1299 | Element('tr_signature_'+ID).style.display = 'none'; |
---|
| 1300 | Element('td_signature_'+ID).style.display = 'none'; |
---|
| 1301 | |
---|
| 1302 | } |
---|
| 1303 | else{ |
---|
| 1304 | //this.innerHTML += "Mais Informaᅵᅵes"; |
---|
| 1305 | this.value = 'more_cert'; |
---|
| 1306 | Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px"; |
---|
| 1307 | Element('tr_signature_'+ID).style.display = ''; |
---|
| 1308 | Element('td_signature_'+ID).style.display = ''; |
---|
| 1309 | } |
---|
| 1310 | }; |
---|
| 1311 | |
---|
| 1312 | tr_signature.appendChild(td_signature); |
---|
| 1313 | tbody_message_options.appendChild(tr_signature); |
---|
| 1314 | /******************************************* Old signature ***********************************************/ |
---|
| 1315 | //if (info_msg.signature != "void") |
---|
| 1316 | // td.innerHTML += ' <img style="cursor:pointer" onclick="alert(\''+ get_lang("This message is signed, and you can trust.") + info_msg.signature +'\');" src="'+tpl_img_path+'/signed.gif">'; |
---|
| 1317 | //else |
---|
| 1318 | // 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='"+tpl_img_path+"/invalid.gif'>"; |
---|
| 1319 | /***************************************** ********/ |
---|
| 1320 | } |
---|
| 1321 | //////////// END SIGNATURE //////////////// |
---|
| 1322 | |
---|
[2] | 1323 | table_message_options.appendChild(tbody_message_options); |
---|
| 1324 | td0.appendChild(table_message_options); |
---|
| 1325 | tr0.appendChild(td0); |
---|
| 1326 | tbody_message.appendChild(tr0); |
---|
| 1327 | } |
---|
| 1328 | // IF DRAFT |
---|
| 1329 | else |
---|
| 1330 | { |
---|
| 1331 | var options = document.createElement("TD"); |
---|
| 1332 | options.width = "1%"; |
---|
| 1333 | options.setAttribute("noWrap","true"); |
---|
[197] | 1334 | var option_edit = '<span class="message_options" onclick="new_message(\'edit\',\''+ID+'\');">'+get_lang('Edit')+'</span> | '; |
---|
| 1335 | var option_print = '<span class="message_options" onclick="print_msg(\''+info_msg.msg_folder+'\',\''+info_msg.msg_number+'\',\''+ID+'\');">'+get_lang('Print')+'</span> | '; |
---|
[689] | 1336 | var option_delete = '<span class="message_options" onclick="proxy_mensagens.delete_msgs(\''+info_msg.msg_folder+'\',\''+info_msg.msg_number+'\',\''+ID+'\');">'+get_lang('Delete')+'</span> | '; |
---|
[271] | 1337 | var option_hide_more = document.createElement("SPAN"); |
---|
| 1338 | option_hide_more.className = 'message_options'; |
---|
| 1339 | options.align = 'right'; |
---|
| 1340 | option_hide_more.value = 'more_options'; |
---|
| 1341 | option_hide_more.id = 'option_hide_more_'+ID; |
---|
| 1342 | option_hide_more.innerHTML = get_lang('Options'); |
---|
| 1343 | option_hide_more.onclick = function(){ |
---|
| 1344 | var _height = Element("div_message_scroll_"+ID).style.height; |
---|
| 1345 | _height = parseInt(_height.replace("px","")); |
---|
| 1346 | var _offset = 35; |
---|
| 1347 | if (this.value == 'more_options'){ |
---|
| 1348 | this.innerHTML = "<b><u>"+get_lang('Options')+"</u></b>"; |
---|
| 1349 | this.value = 'hide_options'; |
---|
| 1350 | Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px"; |
---|
| 1351 | Element('table_message_others_options_'+ID).style.display = ''; |
---|
| 1352 | } |
---|
| 1353 | else{ |
---|
| 1354 | this.innerHTML = get_lang('Options'); |
---|
| 1355 | this.value = 'more_options'; |
---|
| 1356 | Element("div_message_scroll_"+ID).style.height = (_height + _offset)+"px"; |
---|
| 1357 | Element('table_message_others_options_'+ID).style.display = 'none'; |
---|
| 1358 | } |
---|
| 1359 | }; |
---|
[2] | 1360 | options.innerHTML = option_edit + option_print + option_delete; |
---|
[271] | 1361 | options.appendChild(option_hide_more); |
---|
[2] | 1362 | tr.appendChild(td); |
---|
| 1363 | tr.appendChild(options); |
---|
| 1364 | tr.appendChild(next_previous_msg_td); |
---|
| 1365 | tbody_message_options.appendChild(tr); |
---|
| 1366 | table_message_options.appendChild(tbody_message_options); |
---|
| 1367 | td0.appendChild(table_message_options); |
---|
| 1368 | tr0.appendChild(td0); |
---|
| 1369 | tbody_message.appendChild(tr0); |
---|
| 1370 | } |
---|
| 1371 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1372 | // END options message. |
---|
| 1373 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1374 | |
---|
| 1375 | var table_message_others_options = document.createElement("TABLE"); |
---|
| 1376 | table_message_others_options.id = 'table_message_others_options_' + ID; |
---|
| 1377 | table_message_others_options.width = defaultWidth - 30; |
---|
| 1378 | table_message_others_options.style.display = 'none'; |
---|
| 1379 | table_message_others_options.className = "table_message"; |
---|
| 1380 | var tbody_message_others_options = document.createElement("TBODY"); |
---|
| 1381 | var tr1 = document.createElement("TR"); |
---|
| 1382 | tr1.className = "tr_message_header"; |
---|
| 1383 | var td1 = document.createElement("TD"); |
---|
[83] | 1384 | td1.innerHTML = get_lang("From: "); |
---|
[271] | 1385 | td1.appendChild(deny_email(info_msg.from.email)); |
---|
[2] | 1386 | td1.width = "7%"; |
---|
| 1387 | |
---|
| 1388 | if (info_msg.sender){ |
---|
| 1389 | var tr111 = document.createElement("TR"); |
---|
| 1390 | tr111.className = "tr_message_header"; |
---|
| 1391 | var td111 = document.createElement("TD"); |
---|
| 1392 | td111.innerHTML = get_lang("Sent by")+": "; |
---|
[271] | 1393 | td111.appendChild(deny_email(info_msg.sender.email)); |
---|
[2] | 1394 | td111.setAttribute("noWrap","true"); |
---|
| 1395 | var sender = document.createElement("TD"); |
---|
| 1396 | sender.id = "sender_"+ID; |
---|
| 1397 | var sender_values = document.createElement("INPUT"); |
---|
| 1398 | sender_values.id = "sender_values_"+ID; |
---|
| 1399 | sender_values.type = "HIDDEN"; |
---|
| 1400 | sender_values.value = info_msg.sender.full; //Veio do IMAP, sem images nem links. |
---|
| 1401 | sender.innerHTML += draw_plugin_cc(ID, info_msg.sender.full); |
---|
| 1402 | sender.className = "header_message_field"; |
---|
| 1403 | tr111.appendChild(td111); |
---|
| 1404 | tr111.appendChild(sender); |
---|
| 1405 | tr111.appendChild(sender_values); |
---|
| 1406 | tbody_message_others_options.appendChild(tr111); |
---|
| 1407 | } |
---|
| 1408 | |
---|
| 1409 | var from = document.createElement("TD"); |
---|
| 1410 | from.id = "from_"+ID; |
---|
| 1411 | from.innerHTML = info_msg.from.full; |
---|
| 1412 | if (info_msg.Draft != "X"){ |
---|
| 1413 | from.innerHTML += draw_plugin_cc(ID, info_msg.from); |
---|
| 1414 | tbody_message_others_options.appendChild(tr1); |
---|
| 1415 | } |
---|
| 1416 | from.className = "header_message_field"; |
---|
| 1417 | var from_values = document.createElement("INPUT"); |
---|
| 1418 | from_values.id = "from_values_"+ID; |
---|
| 1419 | from_values.type = "HIDDEN"; |
---|
| 1420 | from_values.value = info_msg.from.full; //Veio do IMAP, sem images nem links. |
---|
[790] | 1421 | |
---|
[689] | 1422 | var local_message = document.createElement("INPUT"); |
---|
| 1423 | local_message.id = "is_local_"+ID; |
---|
| 1424 | local_message.name = "is_local"; |
---|
| 1425 | local_message.type = "HIDDEN"; |
---|
| 1426 | local_message.value = (info_msg.local_message)?"1":"0"; |
---|
[790] | 1427 | |
---|
[2] | 1428 | tr1.appendChild(td1); |
---|
| 1429 | tr1.appendChild(from); |
---|
| 1430 | tr1.appendChild(from_values); |
---|
[689] | 1431 | tr1.appendChild(local_message); |
---|
| 1432 | |
---|
[790] | 1433 | |
---|
| 1434 | |
---|
[2] | 1435 | if (info_msg.reply_to){ |
---|
| 1436 | var tr11 = document.createElement("TR"); |
---|
| 1437 | tr11.className = "tr_message_header"; |
---|
| 1438 | var td11 = document.createElement("TD"); |
---|
| 1439 | td11.innerHTML = get_lang("Reply to")+": "; |
---|
| 1440 | td11.setAttribute("noWrap","true"); |
---|
| 1441 | var reply_to = document.createElement("TD"); |
---|
| 1442 | reply_to.id = "reply_to_"+ID; |
---|
| 1443 | |
---|
| 1444 | var reply_to_values = document.createElement("INPUT"); |
---|
| 1445 | reply_to_values.id = "reply_to_values_"+ID; |
---|
| 1446 | reply_to_values.type = "HIDDEN"; |
---|
| 1447 | reply_to_values.value = info_msg.reply_to; //Veio do IMAP, sem images nem links. |
---|
| 1448 | reply_to.innerHTML = draw_plugin_cc(ID, info_msg.reply_to); |
---|
| 1449 | reply_to.className = "header_message_field"; |
---|
| 1450 | tr11.appendChild(td11); |
---|
| 1451 | tr11.appendChild(reply_to); |
---|
| 1452 | tr11.appendChild(reply_to_values); |
---|
| 1453 | tbody_message_others_options.appendChild(tr11); |
---|
| 1454 | } |
---|
| 1455 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1456 | var tr2 = document.createElement("TR"); |
---|
| 1457 | tr2.className = "tr_message_header"; |
---|
| 1458 | var td2 = document.createElement("TD"); |
---|
[83] | 1459 | td2.innerHTML = get_lang("To: "); |
---|
[2] | 1460 | var to = document.createElement("TD"); |
---|
| 1461 | to.id = "to_"+ID; |
---|
| 1462 | |
---|
| 1463 | var to_values = document.createElement("INPUT"); |
---|
| 1464 | to_values.id = "to_values_"+ID; |
---|
| 1465 | to_values.type = "HIDDEN"; |
---|
[63] | 1466 | to_values.value = info_msg.toaddress2; //Veio do IMAP, sem images nem links. |
---|
| 1467 | |
---|
| 1468 | // Salva a pasta da mensagem |
---|
| 1469 | var input_current_folder = document.createElement('input'); |
---|
| 1470 | input_current_folder.id = "input_folder_"+ID; |
---|
| 1471 | input_current_folder.name = "input_folder"; |
---|
| 1472 | input_current_folder.type = "hidden"; |
---|
| 1473 | input_current_folder.value = info_msg.msg_folder; |
---|
| 1474 | td2.appendChild(input_current_folder); |
---|
| 1475 | // fim |
---|
[2] | 1476 | toaddress_array[ID] = info_msg.toaddress2.split(","); |
---|
| 1477 | if (toaddress_array[ID].length > 1){ |
---|
| 1478 | to.innerHTML += draw_plugin_cc(ID, toaddress_array[ID][0]); |
---|
| 1479 | var div_toaddress = document.createElement("SPAN"); |
---|
| 1480 | div_toaddress.id = "div_toaddress_"+ID; |
---|
| 1481 | div_toaddress.style.display=""; |
---|
[13] | 1482 | div_toaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','to');>"+get_lang('more')+"</a>)"; |
---|
[2] | 1483 | to.appendChild(div_toaddress); |
---|
| 1484 | } |
---|
| 1485 | else { |
---|
| 1486 | to.innerHTML += draw_plugin_cc(ID,toaddress_array[ID]); |
---|
| 1487 | } |
---|
| 1488 | to.className = "header_message_field"; |
---|
| 1489 | tr2.appendChild(td2); |
---|
| 1490 | tr2.appendChild(to); |
---|
| 1491 | tr2.appendChild(to_values); |
---|
| 1492 | tbody_message_others_options.appendChild(tr2); |
---|
| 1493 | |
---|
| 1494 | if (info_msg.cc){ |
---|
| 1495 | var tr3 = document.createElement("TR"); |
---|
| 1496 | tr3.className = "tr_message_header"; |
---|
| 1497 | var td3 = document.createElement("TD"); |
---|
| 1498 | td3.innerHTML = "CC: "; |
---|
| 1499 | var cc = document.createElement("TD"); |
---|
| 1500 | cc.id = "cc_"+ID; |
---|
| 1501 | |
---|
| 1502 | var cc_values = document.createElement("INPUT"); |
---|
| 1503 | cc_values.id = "cc_values_"+ID; |
---|
| 1504 | cc_values.type = "HIDDEN"; |
---|
| 1505 | cc_values.value = info_msg.cc; |
---|
| 1506 | |
---|
[13] | 1507 | ccaddress_array[ID] = info_msg.cc.split(","); |
---|
| 1508 | if (ccaddress_array[ID].length > 1){ |
---|
[2] | 1509 | var div_ccaddress = document.createElement("SPAN"); |
---|
| 1510 | div_ccaddress.id = "div_ccaddress_"+ID; |
---|
| 1511 | var div_ccaddress_full = document.createElement("SPAN"); |
---|
[13] | 1512 | div_ccaddress_full.id = "div_ccaddress_full_"+ID; |
---|
[2] | 1513 | div_ccaddress.style.display=""; |
---|
[13] | 1514 | cc.innerHTML = draw_plugin_cc(ID, ccaddress_array[ID][0]); |
---|
| 1515 | div_ccaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','cc');>"+get_lang('more')+"</a>)"; |
---|
| 1516 | cc.appendChild(div_ccaddress); |
---|
[2] | 1517 | } |
---|
| 1518 | else{ |
---|
| 1519 | cc.innerHTML = draw_plugin_cc(ID, info_msg.cc); |
---|
| 1520 | } |
---|
| 1521 | cc.className = "header_message_field"; |
---|
| 1522 | tr3.appendChild(td3); |
---|
| 1523 | tr3.appendChild(cc); |
---|
| 1524 | tr3.appendChild(cc_values); |
---|
| 1525 | tbody_message_others_options.appendChild(tr3); |
---|
| 1526 | } |
---|
[427] | 1527 | |
---|
| 1528 | /* |
---|
| 1529 | * @AUTHOR Rodrigo Souza dos Santos |
---|
| 1530 | * @MODIFY-DATE 2008/09/11 |
---|
| 1531 | * @BRIEF Adding routine to create bcc field if there is one. |
---|
| 1532 | */ |
---|
| 1533 | if (info_msg.bcc) |
---|
| 1534 | { |
---|
| 1535 | var tr3 = document.createElement("tr"); |
---|
| 1536 | tr3.className = "tr_message_header"; |
---|
| 1537 | var td3 = document.createElement("td"); |
---|
| 1538 | td3.innerHTML = get_lang("BCC") + " : "; |
---|
| 1539 | var cco = document.createElement("td"); |
---|
| 1540 | cco.id = "cco_"+ID; |
---|
| 1541 | |
---|
| 1542 | var cco_values = document.createElement("input"); |
---|
| 1543 | cco_values.id = "cco_values_"+ID; |
---|
| 1544 | cco_values.type = "hidden"; |
---|
| 1545 | cco_values.value = info_msg.cco; |
---|
| 1546 | |
---|
| 1547 | ccoaddress_array[ID] = info_msg.bcc.split(","); |
---|
| 1548 | if (ccoaddress_array[ID].length > 1){ |
---|
| 1549 | var div_ccoaddress = document.createElement("SPAN"); |
---|
| 1550 | div_ccoaddress.id = "div_ccoaddress_"+ID; |
---|
| 1551 | var div_ccoaddress_full = document.createElement("SPAN"); |
---|
| 1552 | div_ccoaddress_full.id = "div_ccoaddress_full_"+ID; |
---|
| 1553 | div_ccoaddress.style.display=""; |
---|
| 1554 | |
---|
| 1555 | /* |
---|
[790] | 1556 | * The function below is ugly, doesn't possible use this. |
---|
[427] | 1557 | * The problem is that the code's function was written |
---|
| 1558 | * on a hardcode concept. |
---|
| 1559 | */ |
---|
| 1560 | //cco.innerHTML = draw_plugin_cc(ID, ccoaddress_array[ID][0]); |
---|
| 1561 | cco.innerHTML = ccoaddress_array[ID][0]; |
---|
| 1562 | div_ccoaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','cco');>"+get_lang('more')+"</a>)"; |
---|
| 1563 | cco.appendChild(div_ccoaddress); |
---|
| 1564 | } |
---|
| 1565 | else{ |
---|
| 1566 | /* |
---|
[790] | 1567 | * The function below is ugly, it is not possible to use this. |
---|
[427] | 1568 | * The problem is that the code's function was written |
---|
| 1569 | * on a hardcode concept. |
---|
| 1570 | */ |
---|
| 1571 | //cco.innerHTML = draw_plugin_cc(ID, info_msg.cco); |
---|
| 1572 | cco.innerHTML = info_msg.bcc; |
---|
| 1573 | } |
---|
| 1574 | cco.className = "header_message_field"; |
---|
| 1575 | tr3.appendChild(td3); |
---|
| 1576 | tr3.appendChild(cco); |
---|
| 1577 | tr3.appendChild(cco_values); |
---|
| 1578 | tbody_message_others_options.appendChild(tr3); |
---|
| 1579 | } |
---|
| 1580 | |
---|
[2] | 1581 | var tr4 = document.createElement("TR"); |
---|
| 1582 | tr4.className = "tr_message_header"; |
---|
| 1583 | var td4 = document.createElement("TD"); |
---|
[83] | 1584 | td4.innerHTML = get_lang("Date: "); |
---|
[2] | 1585 | var date = document.createElement("TD"); |
---|
| 1586 | date.id = "date_"+ID; |
---|
| 1587 | date.innerHTML = info_msg.fulldate; |
---|
| 1588 | var date_day = document.createElement("INPUT"); |
---|
| 1589 | date_day.id = "date_day_"+ID; |
---|
| 1590 | date_day.type = "HIDDEN"; |
---|
| 1591 | date_day.value = info_msg.msg_day; |
---|
| 1592 | var date_hour = document.createElement("INPUT"); |
---|
| 1593 | date_hour.id = "date_hour_"+ID; |
---|
| 1594 | date_hour.type = "HIDDEN"; |
---|
| 1595 | date_hour.value = info_msg.msg_hour |
---|
| 1596 | date.className = "header_message_field"; |
---|
| 1597 | tr4.appendChild(td4); |
---|
| 1598 | tr4.appendChild(date); |
---|
| 1599 | tr4.appendChild(date_day); |
---|
| 1600 | tr4.appendChild(date_hour); |
---|
| 1601 | tbody_message_others_options.appendChild(tr4); |
---|
| 1602 | |
---|
| 1603 | var tr5 = document.createElement("TR"); |
---|
| 1604 | tr5.className = "tr_message_header"; |
---|
| 1605 | var td5 = document.createElement("TD"); |
---|
[83] | 1606 | td5.innerHTML = get_lang("Subject"); |
---|
[2] | 1607 | var subject = document.createElement("TD"); |
---|
| 1608 | subject.id = "subject_"+ID; |
---|
| 1609 | subject.innerHTML = info_msg.subject; |
---|
| 1610 | subject.className = "header_message_field"; |
---|
| 1611 | tr5.appendChild(td5); |
---|
| 1612 | tr5.appendChild(subject); |
---|
| 1613 | tbody_message_others_options.appendChild(tr5); |
---|
| 1614 | if (info_msg.attachments.length > 0){ |
---|
| 1615 | var tr6 = document.createElement("TR"); |
---|
| 1616 | tr6.className = "tr_message_header"; |
---|
| 1617 | var td6 = document.createElement("TD"); |
---|
[83] | 1618 | td6.innerHTML = get_lang("Attachments: "); |
---|
[673] | 1619 | |
---|
[2] | 1620 | var attachments = document.createElement("TD"); |
---|
| 1621 | td6.vAlign = "top"; |
---|
| 1622 | attachments.align='left'; |
---|
| 1623 | var zipped_attachments = ''; |
---|
[673] | 1624 | if(info_msg.attachments.length >= 1) { |
---|
| 1625 | var zipped_attachments = document.createElement("TABLE"); |
---|
[2] | 1626 | zipped_attachments.style.marginBottom = "4px"; |
---|
| 1627 | zipped_attachments.cellPadding="0"; |
---|
| 1628 | zipped_attachments.cellSpacing="0"; |
---|
[673] | 1629 | var td = document.createElement("TD"); |
---|
| 1630 | if(info_msg.attachments.length > 1) { |
---|
| 1631 | var link_attachment = document.createElement("A"); |
---|
[1000] | 1632 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
| 1633 | link_attachment.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 1634 | else |
---|
| 1635 | link_attachment.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
[673] | 1636 | link_attachment.innerHTML = " "+info_msg.attachments.length+' '+get_lang('files')+' :: '+get_lang('Download all atachments'); |
---|
| 1637 | link_attachment.innerHTML += '<BR>'; |
---|
| 1638 | td.appendChild(link_attachment); |
---|
| 1639 | } |
---|
[2] | 1640 | var tr = document.createElement("TR"); |
---|
[673] | 1641 | if(preferences.remove_attachments_function) |
---|
| 1642 | { |
---|
| 1643 | var del_attachments = document.createElement("A"); |
---|
| 1644 | del_attachments.setAttribute("href", "javascript:remove_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 1645 | del_attachments.innerHTML = get_lang('remove all attachments'); |
---|
| 1646 | del_attachments.appendChild(document.createElement('BR')); |
---|
| 1647 | td.appendChild(del_attachments); |
---|
| 1648 | tr.appendChild(td); |
---|
[613] | 1649 | } |
---|
[2] | 1650 | tr.appendChild(td); |
---|
| 1651 | zipped_attachments.appendChild(tr); |
---|
| 1652 | attachments.appendChild(zipped_attachments); |
---|
[673] | 1653 | } |
---|
[790] | 1654 | |
---|
[2] | 1655 | attachments.id = "attachments_" + ID; |
---|
| 1656 | for (var i=0; i<info_msg.attachments.length; i++){ |
---|
| 1657 | var link_attachment = document.createElement("A"); |
---|
[689] | 1658 | link_attachment.setAttribute("href", proxy_mensagens.link_anexo(info_msg,i)); |
---|
| 1659 | // 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+"')"); |
---|
[2] | 1660 | link_attachment.innerHTML = url_decode(info_msg.attachments[i].name); |
---|
| 1661 | msg_size = info_msg.attachments[i].fsize; |
---|
| 1662 | if (msg_size < 1048576 && msg_size > 1024) |
---|
| 1663 | link_attachment.innerHTML += ' (' + this.round(msg_size / 1024, 0) + ' Kb)'; |
---|
| 1664 | else if(msg_size > 1024) |
---|
| 1665 | link_attachment.innerHTML += ' (' + this.round(msg_size / (1024*1024), 1) + ' Mb)'; |
---|
| 1666 | else |
---|
| 1667 | link_attachment.innerHTML += ' (' + msg_size + ' bytes)'; |
---|
[620] | 1668 | if((url_decode(info_msg.attachments[i].name).indexOf(".ics")!=-1) || (url_decode(info_msg.attachments[i].name).indexOf(".vcard")!=-1)){ |
---|
| 1669 | //Link para importar calendário |
---|
[673] | 1670 | var link_import_attachment = new Image(); |
---|
[790] | 1671 | link_import_attachment.src = "templates/"+template+"/images/new.png"; |
---|
[673] | 1672 | link_import_attachment.setAttribute("onclick","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+"');"); |
---|
| 1673 | link_import_attachment.title = get_lang("Import to calendar"); |
---|
| 1674 | link_import_attachment.align = "top"; |
---|
| 1675 | link_import_attachment.style.cursor = "pointer"; |
---|
[620] | 1676 | var space = document.createElement("span"); |
---|
[673] | 1677 | space.innerHTML = " "; |
---|
[620] | 1678 | attachments.appendChild(link_attachment); |
---|
| 1679 | attachments.appendChild(space); |
---|
| 1680 | attachments.appendChild(link_import_attachment); |
---|
| 1681 | } |
---|
| 1682 | else { |
---|
[790] | 1683 | link_attachment.innerHTML += '<BR>'; |
---|
| 1684 | attachments.appendChild(link_attachment); |
---|
[620] | 1685 | } |
---|
[2] | 1686 | } |
---|
| 1687 | tr6.appendChild(td6); |
---|
| 1688 | tr6.appendChild(attachments); |
---|
| 1689 | tbody_message_others_options.appendChild(tr6); |
---|
| 1690 | } |
---|
| 1691 | |
---|
[59] | 1692 | |
---|
[2] | 1693 | // BEGIN MAKE THE SCROLL HEIGHT |
---|
| 1694 | var bar = document.getElementById("toolbar"); |
---|
| 1695 | var offset = 0; |
---|
[790] | 1696 | if(bar.style.visibility != 'hidden') |
---|
| 1697 | offset = bar.offsetHeight ? bar.offsetHeight : bar.clientHeight; |
---|
[2] | 1698 | var div = document.createElement("DIV"); |
---|
| 1699 | div.id = "div_message_scroll_"+ID; |
---|
| 1700 | div.style.background = 'WHITE'; |
---|
| 1701 | div.style.height = document.body.clientHeight - offset - 125; |
---|
[790] | 1702 | content.style.height = document.body.clientHeight - offset - 90; |
---|
[2] | 1703 | div.style.overflow = "auto"; |
---|
| 1704 | div.style.width = defaultWidth - (is_ie ? 5 : 0); |
---|
| 1705 | // END MAKE THE SCROLL HEIGHT |
---|
| 1706 | table_message_others_options.appendChild(tbody_message_others_options); |
---|
| 1707 | var tr = document.createElement("TR"); |
---|
| 1708 | var td = document.createElement("TD"); |
---|
| 1709 | td.colSpan = '2'; |
---|
| 1710 | div.appendChild(table_message_others_options); |
---|
[790] | 1711 | var imgTag = info_msg.body.match(/(<img[^>]*src[^=]*=['"][^'"]*["'][^>]*>)|(<td[^>]*background[^=]*=['"][^'"]*["'][^>]*>)/gi); |
---|
| 1712 | var newBody = info_msg.body; |
---|
| 1713 | if(!info_msg.showImg && imgTag) |
---|
| 1714 | { |
---|
| 1715 | var domains = ''; |
---|
| 1716 | var blocked = false; |
---|
| 1717 | var forbidden = true; |
---|
| 1718 | if (preferences.notification_domains != undefined && preferences.notification_domains != "") |
---|
| 1719 | domains = preferences.notification_domains.split(','); |
---|
| 1720 | for(var j = 0; j < imgTag.length; j++) |
---|
| 1721 | { |
---|
| 1722 | for (var i = 0; i < domains.length; i++) |
---|
| 1723 | { |
---|
| 1724 | imgSource = imgTag[j].match(/=['"](http:\/\/)+[^'"\/]*/); |
---|
| 1725 | if (imgSource && imgSource.toString().substr(5).match(domains[i])) |
---|
| 1726 | forbidden = false; |
---|
| 1727 | } |
---|
| 1728 | if (forbidden) |
---|
| 1729 | { |
---|
| 1730 | newBody = newBody.replace(imgTag[j],"<img src='templates/"+template+"/images/forbidden.png'>"); |
---|
| 1731 | blocked=true; |
---|
| 1732 | } |
---|
| 1733 | } |
---|
| 1734 | if (blocked) |
---|
| 1735 | { |
---|
| 1736 | var showImgLink = document.createElement('DIV'); |
---|
| 1737 | showImgLink.id="show_img_link"; |
---|
[1000] | 1738 | showImgLink.onclick = function(){show_msg_img(info_msg.msg_number,info_msg.msg_folder)}; |
---|
[790] | 1739 | showImgLink.className="show_img_link"; |
---|
| 1740 | showImgLink.innerHTML = get_lang("Show images from")+": "+info_msg.from.email; |
---|
| 1741 | td.appendChild(showImgLink); |
---|
| 1742 | } |
---|
| 1743 | } |
---|
[2] | 1744 | td.appendChild(div); |
---|
| 1745 | tr.appendChild(td) |
---|
| 1746 | tbody_message.appendChild(tr); |
---|
| 1747 | |
---|
| 1748 | |
---|
| 1749 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1750 | //Make the body message. |
---|
[790] | 1751 | /////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[2] | 1752 | var tr = document.createElement("TR"); |
---|
| 1753 | tr.className = "tr_message_body"; |
---|
| 1754 | var td = document.createElement("TD"); |
---|
| 1755 | //td.setAttribute("colSpan","2"); |
---|
[790] | 1756 | newBody = newBody.replace("<body","<span"); |
---|
| 1757 | newBody = newBody.replace("<BODY","<span"); |
---|
| 1758 | div.innerHTML+= "<span id='body_"+ID+"'>"+newBody+"</span><br><br>"; |
---|
[2] | 1759 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1760 | //Make the thumbs of the message. |
---|
| 1761 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1762 | if ((info_msg.thumbs)&&(info_msg.thumbs.length > 0)){ |
---|
| 1763 | var table_message_thumbs = document.createElement("TABLE"); |
---|
| 1764 | table_message_thumbs.width = "80%"; |
---|
| 1765 | table_message_thumbs.style.borderTop = "2px solid rgb(170, 170, 170)"; |
---|
| 1766 | var tbody_message_thumbs = document.createElement("TBODY"); |
---|
| 1767 | var tr = document.createElement("TR"); |
---|
| 1768 | tr.className = "tr_message_body"; |
---|
| 1769 | var td = document.createElement("TD"); |
---|
| 1770 | td.setAttribute("colSpan","2"); |
---|
| 1771 | td.id = "body_thumbs_"+ID; |
---|
| 1772 | td.innerHTML += " <font color='DARKBLUE' size='2'><b>"+info_msg.attachments.length+" "+get_lang("attachment")+(info_msg.attachments.length > 1 ? "s" : "")+" "+get_lang("in this message")+"</font></b>"; |
---|
| 1773 | var _link_attachments = ''; |
---|
| 1774 | if(info_msg.thumbs.length > 1){ |
---|
| 1775 | _link_attachments = document.createElement("A"); |
---|
| 1776 | _link_attachments.className = "message_options"; |
---|
[1000] | 1777 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
| 1778 | _link_attachments.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 1779 | else |
---|
| 1780 | _link_attachments.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
[2] | 1781 | _link_attachments.innerHTML = get_lang('Download all atachments'); |
---|
| 1782 | } |
---|
| 1783 | |
---|
| 1784 | if(_link_attachments){ |
---|
| 1785 | td.innerHTML += " :: "; |
---|
| 1786 | td.appendChild(_link_attachments); |
---|
| 1787 | } |
---|
| 1788 | |
---|
[790] | 1789 | td.innerHTML += "<BR><img src='templates/"+template+"/images/menu/ktip.png'>"+get_lang("<b>Tip:</b> For faster save, click over the image with <u>right button</u>."); |
---|
[2] | 1790 | td.innerHTML += "<BR>"; |
---|
| 1791 | |
---|
| 1792 | for (var i=0; i<info_msg.thumbs.length; i++){ |
---|
| 1793 | if ((i % 4) == 0) |
---|
| 1794 | td.innerHTML += "<BR>"; |
---|
| 1795 | td.innerHTML += info_msg.thumbs[i]; |
---|
| 1796 | td.innerHTML += " "; |
---|
| 1797 | } |
---|
| 1798 | tr.appendChild(td); |
---|
| 1799 | tbody_message_thumbs.appendChild(tr); |
---|
| 1800 | table_message_thumbs.appendChild(tbody_message_thumbs); |
---|
| 1801 | div.appendChild(table_message_thumbs); |
---|
| 1802 | } |
---|
| 1803 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1804 | table_message.appendChild(tbody_message); |
---|
| 1805 | content.appendChild(table_message); |
---|
| 1806 | var msg_number = document.createElement('INPUT'); |
---|
| 1807 | msg_number.id = "msg_number_" + ID; |
---|
| 1808 | msg_number.type = "hidden"; |
---|
| 1809 | msg_number.value = info_msg.msg_number; |
---|
| 1810 | content.appendChild(msg_number); |
---|
| 1811 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1812 | } |
---|
[790] | 1813 | |
---|
[271] | 1814 | function draw_new_message(border_ID){ |
---|
| 1815 | var ID = create_border("",border_ID); |
---|
[352] | 1816 | if (ID == false) |
---|
| 1817 | return false; |
---|
[2] | 1818 | hold_session = true; |
---|
| 1819 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1820 | var form = document.createElement("FORM"); |
---|
| 1821 | form.name = "form_message_"+ID; |
---|
| 1822 | form.method = "POST"; |
---|
| 1823 | form.onsubmit = function(){return false;} |
---|
| 1824 | if(!is_ie) |
---|
| 1825 | form.enctype="multipart/form-data"; |
---|
| 1826 | else |
---|
| 1827 | form.encoding="multipart/form-data"; |
---|
| 1828 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1829 | //ConstructMenuNewMessage(ID); |
---|
| 1830 | //////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1831 | var content = Element('content_id_' + ID); |
---|
| 1832 | var table_message = document.createElement("TABLE"); |
---|
| 1833 | table_message.width = "100%"; |
---|
| 1834 | var tbody_message = document.createElement("TBODY"); |
---|
| 1835 | var tr0 = document.createElement("TR"); |
---|
| 1836 | tr0.className = "tr_message_header"; |
---|
| 1837 | var td0 = document.createElement("TD"); |
---|
| 1838 | td0.colSpan = '3'; |
---|
| 1839 | |
---|
| 1840 | var table_menu_new_message = document.createElement("TABLE"); |
---|
| 1841 | table_menu_new_message.width = "100%"; |
---|
| 1842 | table_menu_new_message.border = '0'; |
---|
| 1843 | table_menu_new_message.className = 'table_message'; |
---|
| 1844 | var tbody_menu_new_message = document.createElement("TBODY"); |
---|
| 1845 | var tr_menu_new_message = document.createElement("TR"); |
---|
| 1846 | var td_menu_new_message = document.createElement("TD"); |
---|
| 1847 | td_menu_new_message.setAttribute("noWrap","true"); |
---|
| 1848 | |
---|
| 1849 | if ((preferences.save_in_folder == '-1') || (preferences.save_in_folder == '')){ |
---|
[220] | 1850 | //var option_send = '<span class="message_options" onclick=send_message("'+ID+'","null","null");>'+get_lang("Send")+'</span> | '; |
---|
[249] | 1851 | 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");>' + ' | '; |
---|
[61] | 1852 | var option_send_and_file= '<span class="message_options" onclick=wfolders.makeWindow("'+ID+'","send_and_file");>'+get_lang("Send and file")+'</span> | '; |
---|
[2] | 1853 | } |
---|
| 1854 | else{ |
---|
[249] | 1855 | //var option_send = '<span class="message_options" onclick="send_message(\''+ID+'\',\''+preferences.save_in_folder+'\',\'null\');">'+get_lang("Send")+'</span> | '; |
---|
| 1856 | 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\');">' + ' | '; |
---|
[2] | 1857 | var option_send_and_file=''; |
---|
| 1858 | wfolders.alert = true; |
---|
| 1859 | } |
---|
[271] | 1860 | // var option_save_as = '<span class="message_options" onclick=wfolders.makeWindow("'+ID+'","save");>'+get_lang("Save as")+'</span> | '; |
---|
[607] | 1861 | var option_save = '<span id="save_message_options_'+ID+'" class="message_options" onclick="openTab.toPreserve['+ID+'] = true; save_msg('+ID+');">'+get_lang("Save")+'</span> | '; |
---|
[2] | 1862 | var option_search = '<span class="message_options" onclick=openListUsers("'+ID+'");>'+get_lang("Search")+'</span>'; |
---|
| 1863 | td_menu_new_message.innerHTML = option_send + option_send_and_file + option_save + option_search; |
---|
| 1864 | |
---|
| 1865 | tr_menu_new_message.appendChild(td_menu_new_message); |
---|
| 1866 | tbody_menu_new_message.appendChild(tr_menu_new_message); |
---|
| 1867 | table_menu_new_message.appendChild(tbody_menu_new_message); |
---|
| 1868 | |
---|
| 1869 | content.appendChild(table_menu_new_message); |
---|
| 1870 | tr0.appendChild(td0); |
---|
| 1871 | tbody_message.appendChild(tr0); |
---|
| 1872 | //////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1873 | var tr1_1 = document.createElement("TR"); |
---|
| 1874 | tr1_1.style.display = 'none'; |
---|
| 1875 | var td1_1 = document.createElement("TD"); |
---|
| 1876 | td1_1.innerHTML = get_lang("From")+":"; |
---|
| 1877 | td1_1.setAttribute("noWrap","true"); |
---|
| 1878 | td1_1.style.width = "1%"; |
---|
| 1879 | |
---|
| 1880 | var td_from = document.createElement("TD"); |
---|
| 1881 | td_from.setAttribute("noWrap","true"); |
---|
| 1882 | td_from.style.width = "100%"; |
---|
[63] | 1883 | |
---|
[2] | 1884 | var sel_from = document.createElement('SELECT'); |
---|
| 1885 | sel_from.id = "from_"+ID; |
---|
| 1886 | sel_from.name = "input_from"; |
---|
| 1887 | sel_from.style.width = "70%"; |
---|
| 1888 | sel_from.setAttribute("wrap","soft"); |
---|
| 1889 | td_from.appendChild(sel_from); |
---|
| 1890 | tr1_1.appendChild(td1_1); |
---|
| 1891 | tr1_1.appendChild(td_from); |
---|
| 1892 | tbody_message.appendChild(tr1_1); |
---|
| 1893 | //////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1894 | var tr1 = document.createElement("TR"); |
---|
| 1895 | var td1 = document.createElement("TD"); |
---|
| 1896 | td1.innerHTML = get_lang("To")+":"; |
---|
| 1897 | td1.setAttribute("noWrap","true"); |
---|
| 1898 | td1.style.width = "1%"; |
---|
| 1899 | |
---|
| 1900 | var td_to = document.createElement("TD"); |
---|
| 1901 | td_to.setAttribute("noWrap","true"); |
---|
| 1902 | td_to.style.width = "100%"; |
---|
| 1903 | |
---|
| 1904 | var input_to = document.createElement('TEXTAREA'); |
---|
| 1905 | input_to.id = "to_"+ID; |
---|
| 1906 | input_to.name = "input_to"; |
---|
| 1907 | input_to.setAttribute("tabIndex","1"); |
---|
| 1908 | input_to.style.width = "100%"; |
---|
| 1909 | input_to.setAttribute("wrap","soft"); |
---|
| 1910 | input_to.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus', this.id);}; |
---|
| 1911 | input_to.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; |
---|
| 1912 | if (!is_ie) |
---|
| 1913 | { |
---|
| 1914 | input_to.rows = 2; |
---|
| 1915 | input_to.onkeypress = function (e) |
---|
[320] | 1916 | { |
---|
| 1917 | if ((e.keyCode) == 120) //F9 |
---|
| 1918 | { |
---|
| 1919 | emQuickSearch(input_to.value, 'to', ID); |
---|
| 1920 | } |
---|
| 1921 | else |
---|
| 1922 | { |
---|
| 1923 | if (((e.keyCode == 13) || ((e.keyCode == 38)||(e.keyCode == 40))) && (document.getElementById('tipDiv').style.visibility!='hidden')) |
---|
| 1924 | { |
---|
| 1925 | e.preventDefault(); |
---|
| 1926 | search_contacts(e.keyCode,this.id); |
---|
| 1927 | } |
---|
| 1928 | } |
---|
| 1929 | } |
---|
| 1930 | input_to.onkeyup = function (e) |
---|
| 1931 | { |
---|
| 1932 | if ((e.keyCode != 13) && (e.keyCode != 38) && (e.keyCode != 40)) |
---|
| 1933 | { |
---|
| 1934 | search_contacts(e.keyCode,this.id); |
---|
| 1935 | } |
---|
| 1936 | } |
---|
[2] | 1937 | } |
---|
| 1938 | else |
---|
| 1939 | { |
---|
| 1940 | input_to.rows = 3; |
---|
| 1941 | input_to.onkeyup = function (e) |
---|
[320] | 1942 | { |
---|
| 1943 | if ((window.event.keyCode) == 120) //F9 |
---|
| 1944 | { |
---|
| 1945 | emQuickSearch(input_to.value, 'to', ID); |
---|
| 1946 | } |
---|
| 1947 | else |
---|
| 1948 | { |
---|
| 1949 | search_contacts(window.event.keyCode,this.id); |
---|
| 1950 | } |
---|
| 1951 | } |
---|
[2] | 1952 | } |
---|
| 1953 | td_to.appendChild(input_to); |
---|
| 1954 | |
---|
[689] | 1955 | var forwarded_local_message = document.createElement("INPUT"); //Hidden para indicar se é um forward de uma mensagem local |
---|
| 1956 | forwarded_local_message.id = "is_local_forward"+ID; |
---|
| 1957 | forwarded_local_message.name = "is_local_forward"; |
---|
| 1958 | forwarded_local_message.type = "HIDDEN"; |
---|
| 1959 | forwarded_local_message.value = "0"; |
---|
| 1960 | td_to.appendChild(forwarded_local_message); |
---|
| 1961 | |
---|
[2] | 1962 | var img_search = document.createElement("IMG"); |
---|
[790] | 1963 | img_search.src = "./templates/"+template+"/images/search.gif"; |
---|
[53] | 1964 | img_search.title = get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.'); |
---|
[2] | 1965 | img_search.onclick = function () {emQuickSearch(document.getElementById('to_'+ID).value, 'to', ID);}; |
---|
| 1966 | var span_search = document.createElement("SPAN"); |
---|
| 1967 | span_search.innerHTML = get_lang('Search'); |
---|
| 1968 | |
---|
| 1969 | var td1_img_search = document.createElement("TD"); |
---|
| 1970 | td1_img_search.setAttribute("noWrap","true"); |
---|
| 1971 | var td1_span_search = document.createElement("TD"); |
---|
| 1972 | td1_span_search.setAttribute("noWrap","true"); |
---|
| 1973 | |
---|
| 1974 | td1_img_search.appendChild(img_search); |
---|
| 1975 | td1_span_search.appendChild(span_search); |
---|
| 1976 | |
---|
| 1977 | tr1.appendChild(td1); |
---|
| 1978 | tr1.appendChild(td_to); |
---|
| 1979 | tr1.appendChild(td1_img_search); |
---|
| 1980 | |
---|
| 1981 | tbody_message.appendChild(tr1); |
---|
| 1982 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1983 | var tr2 = document.createElement("TR"); |
---|
| 1984 | tr2.id = "tr_cc_"+ID; |
---|
| 1985 | tr2.style.display = 'none'; |
---|
| 1986 | var td2 = document.createElement("TD"); |
---|
| 1987 | td2.innerHTML = "Cc:"; |
---|
| 1988 | td2.setAttribute("noWrap","true"); |
---|
| 1989 | td2.style.width = "1%"; |
---|
| 1990 | |
---|
| 1991 | var td_cc = document.createElement("TD"); |
---|
| 1992 | td_cc.setAttribute("noWrap","true"); |
---|
| 1993 | td_cc.style.width = "100%"; |
---|
| 1994 | |
---|
| 1995 | var input_cc = document.createElement('TEXTAREA'); |
---|
| 1996 | input_cc.id = "cc_"+ID; |
---|
| 1997 | input_cc.name = "input_cc"; |
---|
| 1998 | input_cc.setAttribute("tabIndex","1"); |
---|
| 1999 | input_cc.style.width = "100%"; |
---|
| 2000 | input_cc.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus',this.id);}; |
---|
| 2001 | input_cc.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; |
---|
[320] | 2002 | if (!is_ie) |
---|
| 2003 | { |
---|
| 2004 | input_cc.rows = 2; |
---|
| 2005 | input_cc.onkeypress = function (e) |
---|
| 2006 | { |
---|
| 2007 | if ((e.keyCode) == 120) //F9 |
---|
| 2008 | { |
---|
| 2009 | emQuickSearch(input_cc.value, 'cc', ID); |
---|
| 2010 | } |
---|
| 2011 | else |
---|
| 2012 | { |
---|
| 2013 | if (((e.keyCode == 13) || ((e.keyCode == 38)||(e.keyCode == 40))) && (document.getElementById('tipDiv').style.visibility!='hidden')) |
---|
| 2014 | { |
---|
| 2015 | e.preventDefault(); |
---|
| 2016 | search_contacts(e.keyCode,this.id); |
---|
| 2017 | } |
---|
| 2018 | } |
---|
| 2019 | } |
---|
| 2020 | input_cc.onkeyup = function (e) |
---|
| 2021 | { |
---|
| 2022 | if ((e.keyCode != 13) && (e.keyCode != 38) && (e.keyCode != 40)) |
---|
| 2023 | { |
---|
| 2024 | search_contacts(e.keyCode,this.id); |
---|
| 2025 | } |
---|
| 2026 | } |
---|
| 2027 | } |
---|
| 2028 | else if (is_ie) |
---|
| 2029 | { |
---|
| 2030 | input_cc.rows = 3; |
---|
| 2031 | input_cc.onkeyup = function (e) |
---|
| 2032 | { |
---|
| 2033 | if ((window.event.keyCode) == 120) //F9 |
---|
| 2034 | { |
---|
| 2035 | emQuickSearch(input_cc.value, 'cc', ID); |
---|
| 2036 | } |
---|
| 2037 | else |
---|
| 2038 | { |
---|
| 2039 | search_contacts(window.event.keyCode,this.id); |
---|
| 2040 | } |
---|
| 2041 | } |
---|
| 2042 | } |
---|
| 2043 | |
---|
[2] | 2044 | td_cc.appendChild(input_cc); |
---|
| 2045 | var img_search = document.createElement("IMG"); |
---|
[790] | 2046 | img_search.src = "./templates/"+template+"/images/search.gif"; |
---|
[2] | 2047 | img_search.onclick = function () {emQuickSearch(document.getElementById('cc_'+ID).value, 'cc', ID)} |
---|
[53] | 2048 | img_search.title = get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.'); |
---|
[2] | 2049 | var span_search = document.createElement("SPAN"); |
---|
| 2050 | span_search.innerHTML = get_lang('Search'); |
---|
| 2051 | |
---|
| 2052 | var td2_img_search = document.createElement("TD"); |
---|
| 2053 | td2_img_search.setAttribute("noWrap","true"); |
---|
| 2054 | var td2_span_search = document.createElement("TD"); |
---|
| 2055 | td2_span_search.setAttribute("noWrap","true"); |
---|
| 2056 | |
---|
| 2057 | td2_img_search.appendChild(img_search); |
---|
| 2058 | td2_span_search.appendChild(span_search); |
---|
| 2059 | |
---|
| 2060 | tr2.appendChild(td2); |
---|
| 2061 | tr2.appendChild(td_cc); |
---|
| 2062 | tr2.appendChild(td2_img_search); |
---|
| 2063 | tbody_message.appendChild(tr2); |
---|
| 2064 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2065 | var tr3 = document.createElement("TR"); |
---|
| 2066 | tr3.id = "tr_cco_"+ID; |
---|
| 2067 | tr3.style.display = 'none'; |
---|
| 2068 | var td3 = document.createElement("TD"); |
---|
| 2069 | td3.setAttribute("noWrap","true"); |
---|
| 2070 | td3.innerHTML = get_lang("CCo")+":"; |
---|
| 2071 | td3.style.width = "1%"; |
---|
| 2072 | |
---|
| 2073 | var td_cco = document.createElement("TD"); |
---|
| 2074 | td_cco.setAttribute("noWrap","true"); |
---|
| 2075 | td_cco.style.width = "100%"; |
---|
| 2076 | |
---|
| 2077 | var input_cco = document.createElement('TEXTAREA'); |
---|
| 2078 | input_cco.id = "cco_"+ID; |
---|
| 2079 | input_cco.name = "input_cco"; |
---|
| 2080 | input_cco.setAttribute("tabIndex","1"); |
---|
| 2081 | input_cco.style.width = "100%"; |
---|
| 2082 | input_cco.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus',this.id);}; |
---|
| 2083 | input_cco.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);}; |
---|
[320] | 2084 | |
---|
[2] | 2085 | if (!is_ie) |
---|
[320] | 2086 | { |
---|
| 2087 | input_cco.rows = 2; |
---|
| 2088 | input_cco.onkeypress = function (e) |
---|
| 2089 | { |
---|
| 2090 | if ((e.keyCode) == 120) //F9 |
---|
| 2091 | { |
---|
| 2092 | emQuickSearch(input_cco.value, 'cco', ID); |
---|
| 2093 | } |
---|
| 2094 | else |
---|
| 2095 | { |
---|
| 2096 | if (((e.keyCode == 13) || ((e.keyCode == 38)||(e.keyCode == 40))) && (document.getElementById('tipDiv').style.visibility!='hidden')) |
---|
| 2097 | { |
---|
| 2098 | e.preventDefault(); |
---|
| 2099 | search_contacts(e.keyCode,this.id); |
---|
| 2100 | } |
---|
| 2101 | } |
---|
| 2102 | } |
---|
| 2103 | input_cco.onkeyup = function (e) |
---|
| 2104 | { |
---|
| 2105 | if ((e.keyCode != 13) && (e.keyCode != 38) && (e.keyCode != 40)) |
---|
| 2106 | { |
---|
| 2107 | search_contacts(e.keyCode,this.id); |
---|
| 2108 | } |
---|
| 2109 | } |
---|
| 2110 | } |
---|
| 2111 | else if (is_ie) |
---|
| 2112 | { |
---|
| 2113 | input_cco.rows = 3; |
---|
| 2114 | input_cco.onkeyup = function (e) |
---|
| 2115 | { |
---|
| 2116 | if ((window.event.keyCode) == 120) //F9 |
---|
| 2117 | { |
---|
| 2118 | emQuickSearch(input_cco.value, 'cco', ID); |
---|
| 2119 | } |
---|
| 2120 | else |
---|
| 2121 | { |
---|
| 2122 | search_contacts(window.event.keyCode,this.id); |
---|
| 2123 | } |
---|
| 2124 | } |
---|
| 2125 | } |
---|
| 2126 | |
---|
[2] | 2127 | td_cco.appendChild(input_cco); |
---|
| 2128 | var img_search = document.createElement("IMG"); |
---|
[790] | 2129 | img_search.src = "./templates/"+template+"/images/search.gif"; |
---|
[53] | 2130 | img_search.title = get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.'); |
---|
[2] | 2131 | img_search.onclick = function () {emQuickSearch(document.getElementById('cco_'+ID).value, 'cco', ID);}; |
---|
| 2132 | var span_search = document.createElement("SPAN"); |
---|
| 2133 | span_search.innerHTML = get_lang('Search'); |
---|
| 2134 | |
---|
| 2135 | var td3_img_search = document.createElement("TD"); |
---|
| 2136 | td3_img_search.setAttribute("noWrap","true"); |
---|
| 2137 | var td3_span_search = document.createElement("TD"); |
---|
| 2138 | td3_span_search.setAttribute("noWrap","true"); |
---|
| 2139 | |
---|
| 2140 | td3_img_search.appendChild(img_search); |
---|
| 2141 | td3_span_search.appendChild(span_search); |
---|
| 2142 | |
---|
| 2143 | tr3.appendChild(td3); |
---|
| 2144 | tr3.appendChild(td_cco); |
---|
| 2145 | tr3.appendChild(td3_img_search); |
---|
| 2146 | tbody_message.appendChild(tr3); |
---|
| 2147 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2148 | var tr_link = document.createElement("TR"); |
---|
| 2149 | tr_link.id = "tr_link_"+ID; |
---|
| 2150 | var td1_link = document.createElement("TD"); |
---|
| 2151 | var td2_link = document.createElement("TD"); |
---|
| 2152 | td1_link.innerHTML = " "; |
---|
| 2153 | var a_cc_link = document.createElement('A'); |
---|
| 2154 | a_cc_link.innerHTML = get_lang('Add CC'); |
---|
| 2155 | a_cc_link.id = "a_cc_link_"+ID; |
---|
| 2156 | a_cc_link.setAttribute("href","javascript:void(0)"); |
---|
| 2157 | a_cc_link.setAttribute("tabIndex","-1"); |
---|
[320] | 2158 | a_cc_link.onclick = function () {this.style.display='none';document.getElementById('tr_cc_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none';input_cc.focus(); return false;} |
---|
[2] | 2159 | td2_link.appendChild(a_cc_link); |
---|
| 2160 | var space = document.createElement("span"); |
---|
| 2161 | space.id ="space_link_"+ID; |
---|
| 2162 | space.innerHTML=" | "; |
---|
| 2163 | td2_link.appendChild(space); |
---|
| 2164 | var a_cco_link = document.createElement('A'); |
---|
| 2165 | a_cco_link.innerHTML = get_lang('Add BCC'); |
---|
| 2166 | a_cco_link.id = "a_cco_link_"+ID; |
---|
| 2167 | a_cco_link.setAttribute("href","javascript:void(0)"); |
---|
| 2168 | a_cco_link.setAttribute("tabIndex","-1"); |
---|
[320] | 2169 | a_cco_link.onclick = function () {this.style.display='none';document.getElementById('tr_cco_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none';input_cco.focus(); return false;} |
---|
[2] | 2170 | td2_link.appendChild(a_cco_link); |
---|
| 2171 | tr_link.appendChild(td1_link); |
---|
| 2172 | tr_link.appendChild(td2_link); |
---|
| 2173 | tbody_message.appendChild(tr_link); |
---|
| 2174 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2175 | var tr4 = document.createElement("TR"); |
---|
| 2176 | var td4 = document.createElement("TD"); |
---|
| 2177 | //td4.setAttribute("noWrap","true"); |
---|
| 2178 | td4.innerHTML = get_lang("Subject")+":"; |
---|
| 2179 | var td_subject = document.createElement("TD"); |
---|
| 2180 | var input_subject = document.createElement('input'); |
---|
| 2181 | input_subject.id = "subject_"+ID; |
---|
| 2182 | input_subject.name = "input_subject"; |
---|
| 2183 | input_subject.setAttribute("tabIndex","1"); |
---|
| 2184 | input_subject.style.width = "90%"; |
---|
| 2185 | input_subject.setAttribute("autocomplete","off"); |
---|
| 2186 | td_subject.appendChild(input_subject); |
---|
| 2187 | tr4.appendChild(td4); |
---|
| 2188 | tr4.appendChild(td_subject); |
---|
| 2189 | tbody_message.appendChild(tr4); |
---|
| 2190 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2191 | var tr5 = document.createElement("TR"); |
---|
| 2192 | var td5 = document.createElement("TD"); |
---|
| 2193 | td5.innerHTML = " "; |
---|
| 2194 | var td_return_receipt = document.createElement("TD"); |
---|
| 2195 | td_return_receipt.setAttribute("noWrap","true"); |
---|
| 2196 | td_return_receipt.innerHTML = get_lang("Return receipt")+":"; |
---|
| 2197 | var input_return_receipt = document.createElement('input'); |
---|
| 2198 | input_return_receipt.type = "checkbox"; |
---|
| 2199 | input_return_receipt.className = "checkbox"; |
---|
| 2200 | input_return_receipt.id = "return_receipt_"+ID; |
---|
| 2201 | input_return_receipt.name = "input_return_receipt"; |
---|
| 2202 | input_return_receipt.setAttribute("tabIndex","-1"); |
---|
[1035] | 2203 | td_return_receipt.appendChild(input_return_receipt); |
---|
| 2204 | |
---|
| 2205 | |
---|
| 2206 | //alert("preferences.use_assinar_criptografar " + preferences.use_assinar_criptografar); |
---|
| 2207 | //alert("preferences.use_signature_digital_cripto " + preferences.use_signature_digital_cripto); |
---|
| 2208 | //alert("preferences.use_signature_digital " + preferences.use_signature_digital); |
---|
| 2209 | //alert("preferences.use_signature_cripto " + preferences.use_signature_cripto); |
---|
| 2210 | |
---|
| 2211 | if(preferences.use_assinar_criptografar==1) |
---|
| 2212 | { |
---|
| 2213 | if(preferences.use_signature_digital_cripto==1) |
---|
| 2214 | { |
---|
| 2215 | td_return_receipt.innerHTML += " " + get_lang("Digitally sign message?")+""; |
---|
| 2216 | var input_return_digital = document.createElement('input'); |
---|
| 2217 | input_return_digital.type = "checkbox"; |
---|
| 2218 | input_return_digital.className = "checkbox"; |
---|
| 2219 | input_return_digital.id = "return_digital_"+ID; |
---|
| 2220 | input_return_digital.name = "input_return_digital"; |
---|
| 2221 | input_return_digital.setAttribute("tabIndex","-1"); |
---|
| 2222 | if(preferences.use_signature_digital==1) |
---|
| 2223 | { |
---|
| 2224 | input_return_digital.defaultChecked=true; |
---|
| 2225 | } |
---|
| 2226 | td_return_receipt.appendChild(input_return_digital); |
---|
| 2227 | //descomentariar a linha abaixo para criptografia |
---|
| 2228 | td_return_receipt.innerHTML += " " + get_lang("Digitally crypt message?")+""; |
---|
| 2229 | var input_return_cripto = document.createElement('input'); |
---|
| 2230 | input_return_cripto.type = "checkbox"; |
---|
| 2231 | input_return_cripto.className = "checkbox"; |
---|
| 2232 | input_return_cripto.id = "return_cripto_"+ID; |
---|
| 2233 | input_return_cripto.name = "input_return_cripto"; |
---|
| 2234 | input_return_cripto.setAttribute("tabIndex","-1"); |
---|
| 2235 | //input_return_cripto.style.display = "none"; |
---|
| 2236 | input_return_cripto.defaultChecked=false; |
---|
| 2237 | //Descomentariar o bloco abaixo para criptografia |
---|
| 2238 | |
---|
| 2239 | if(preferences.use_signature_cripto==1) |
---|
| 2240 | { |
---|
| 2241 | input_return_cripto.defaultChecked=true; |
---|
| 2242 | } |
---|
| 2243 | |
---|
| 2244 | td_return_receipt.appendChild(input_return_cripto); |
---|
| 2245 | |
---|
| 2246 | } |
---|
| 2247 | } |
---|
| 2248 | |
---|
[2] | 2249 | tr5.appendChild(td5); |
---|
| 2250 | tr5.appendChild(td_return_receipt); |
---|
| 2251 | tbody_message.appendChild(tr5); |
---|
[673] | 2252 | if (preferences.use_important_flag) |
---|
| 2253 | { |
---|
| 2254 | var trn = document.createElement("TR"); |
---|
| 2255 | var tdn = document.createElement("TD"); |
---|
| 2256 | tdn.innerHTML = " "; |
---|
| 2257 | var td_important_msg = document.createElement("TD"); |
---|
| 2258 | td_important_msg.setAttribute("noWrap","true"); |
---|
| 2259 | td_important_msg.innerHTML = get_lang("Important message")+":"; |
---|
| 2260 | var input_important_message = document.createElement('input'); |
---|
| 2261 | input_important_message.type = "checkbox"; |
---|
| 2262 | input_important_message.className = "checkbox"; |
---|
| 2263 | input_important_message.id = "important_message_"+ID; |
---|
| 2264 | input_important_message.name = "input_important_message"; |
---|
| 2265 | input_important_message.setAttribute("tabIndex","-1"); |
---|
| 2266 | td_important_msg.appendChild(input_important_message); |
---|
| 2267 | trn.appendChild(tdn); |
---|
| 2268 | trn.appendChild(td_important_msg); |
---|
| 2269 | tbody_message.appendChild(trn); |
---|
| 2270 | } |
---|
[790] | 2271 | |
---|
[2] | 2272 | var add_files = document.createElement("A"); |
---|
| 2273 | add_files.setAttribute("href", "javascript:void(0)"); |
---|
[320] | 2274 | add_files.onclick = function () { addFile(ID); return false;}; |
---|
[2] | 2275 | add_files.innerHTML = get_lang("Attachments: add+"); |
---|
| 2276 | add_files.setAttribute("tabIndex","-1"); |
---|
| 2277 | var divfiles = document.createElement("DIV"); |
---|
| 2278 | divfiles.id = "divFiles_"+ID; |
---|
| 2279 | var tr5 = document.createElement("TR"); |
---|
| 2280 | var td5_link = document.createElement("TD"); |
---|
| 2281 | var td5_input = document.createElement("TD"); |
---|
| 2282 | td5_input.innerHTML = " " |
---|
| 2283 | td5_link.setAttribute("valign","top"); |
---|
| 2284 | td5_link.setAttribute("colSpan","2"); |
---|
| 2285 | td5_link.appendChild(add_files); |
---|
| 2286 | tr5.appendChild(td5_input); |
---|
| 2287 | tr5.appendChild(td5_link); |
---|
| 2288 | tbody_message.appendChild(tr5); |
---|
| 2289 | var tr6 = document.createElement("TR"); |
---|
| 2290 | var td6_link = document.createElement("TD"); |
---|
| 2291 | var td6_input = document.createElement("TD"); |
---|
| 2292 | tr6.appendChild(td6_link); |
---|
| 2293 | td6_input.appendChild(divfiles); |
---|
| 2294 | tr6.appendChild(td6_input); |
---|
| 2295 | tbody_message.appendChild(tr6); |
---|
| 2296 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2297 | var tr5 = document.createElement("TR"); |
---|
| 2298 | var td5 = document.createElement("TD"); |
---|
| 2299 | td5.innerHTML = " "; |
---|
| 2300 | var td_body = document.createElement("TD"); |
---|
| 2301 | td_body.setAttribute("colSpan","2"); |
---|
| 2302 | var div_body_position = document.createElement("DIV"); |
---|
| 2303 | div_body_position.id = "body_position_" + ID; |
---|
| 2304 | td_body.appendChild(div_body_position); |
---|
| 2305 | tr5.appendChild(td5); |
---|
| 2306 | tr5.appendChild(td_body); |
---|
| 2307 | tbody_message.appendChild(tr5); |
---|
| 2308 | // BEGIN MAKE THE SCROLL HEIGHT |
---|
| 2309 | var defaultWidth = document.body.clientWidth - (is_ie ? 200 : 195); |
---|
| 2310 | var _bar = document.getElementById("toolbar"); |
---|
| 2311 | var _offset = 0; |
---|
| 2312 | if(_bar.style.visibility != 'hidden') |
---|
| 2313 | _offset = _bar.offsetHeight ? _bar.offsetHeight : _bar.clientHeight; |
---|
| 2314 | var _div = document.createElement("DIV"); |
---|
| 2315 | _div.id = "div_message_scroll_"+ID; |
---|
| 2316 | _div.style.height = document.body.clientHeight - _offset - 105; |
---|
| 2317 | content.style.height = document.body.clientHeight - _offset - 80; |
---|
| 2318 | _div.style.overflow = "auto"; |
---|
| 2319 | _div.style.width = defaultWidth; |
---|
| 2320 | // END MAKE THE SCROLL HEIGHT |
---|
| 2321 | |
---|
| 2322 | // Hide the contac tips and re-position the pallete color. |
---|
| 2323 | _div.onscroll = function() { |
---|
| 2324 | var intElemScrollTop = Element("div_message_scroll_"+ID).scrollTop; |
---|
| 2325 | if (!is_ie) |
---|
| 2326 | ColorPalette.repos(intElemScrollTop); |
---|
| 2327 | Tooltip.scrollChanged(); |
---|
| 2328 | }; |
---|
| 2329 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2330 | _div.appendChild(form); |
---|
| 2331 | content.appendChild(_div); |
---|
| 2332 | table_message.appendChild(tbody_message); |
---|
| 2333 | form.appendChild(table_message); |
---|
| 2334 | connector.loadScript("rich_text_editor"); |
---|
| 2335 | RichTextEditor.loadEditor(ID); |
---|
| 2336 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2337 | draw_from_field(sel_from,tr1_1); |
---|
| 2338 | return ID; |
---|
| 2339 | } |
---|
| 2340 | |
---|
| 2341 | // Verify if any user is sharing his name/email address |
---|
| 2342 | // for use in the new messages's "From " field. |
---|
| 2343 | function draw_from_field(sel_from,tr1_1){ |
---|
| 2344 | |
---|
| 2345 | var el_shared_users = Element("el_shared_users"); |
---|
| 2346 | // The element was loaded and populated...so return. |
---|
| 2347 | if(el_shared_users){ |
---|
[371] | 2348 | // Nothing to work...so return. |
---|
| 2349 | if(el_shared_users.options.length == 0) |
---|
| 2350 | return; |
---|
[2] | 2351 | tr1_1.style.display = ''; |
---|
| 2352 | for (var x = 0; x < el_shared_users.options.length; x++) { |
---|
| 2353 | var _option = document.createElement("OPTION"); |
---|
| 2354 | _option.text = el_shared_users.options[x].text; |
---|
| 2355 | _option.value = el_shared_users.options[x].value; |
---|
| 2356 | sel_from.options[sel_from.options.length] = _option ; |
---|
| 2357 | } |
---|
| 2358 | return; |
---|
| 2359 | } |
---|
| 2360 | // Get the shared folders..... |
---|
| 2361 | var RegExp_name = new RegExp("(user)"+cyrus_delimiter+"(.*)$", "i"); |
---|
| 2362 | var sharedFolders = new Array(); |
---|
| 2363 | for(var i = 0; i < folders.length; i++) { |
---|
| 2364 | var x = folders[i].folder_id; |
---|
| 2365 | if (RegExp_name.test(x)){ |
---|
| 2366 | sharedFolders[sharedFolders.length] = x; |
---|
| 2367 | } |
---|
| 2368 | } |
---|
| 2369 | |
---|
| 2370 | var matchUser = '#'; |
---|
| 2371 | var sharedUsers = new Array(); |
---|
| 2372 | // Filter the shared folders (only root folders) ..... |
---|
| 2373 | for(var i = 0; i < sharedFolders.length; i++) { |
---|
| 2374 | if(!sharedFolders[i].match(matchUser)) { |
---|
| 2375 | matchUser = sharedFolders[i]; |
---|
| 2376 | sharedUsers[sharedUsers.length] = matchUser.substring(("user"+cyrus_delimiter).length,matchUser.length); |
---|
| 2377 | } |
---|
| 2378 | } |
---|
| 2379 | |
---|
| 2380 | // Handler function for cExecute |
---|
| 2381 | var h_user = function(data) { |
---|
[371] | 2382 | if(data.length > 0) { |
---|
| 2383 | tr1_1.style.display = ''; |
---|
[2] | 2384 | var _option = document.createElement("OPTION"); |
---|
[371] | 2385 | _option.text = '"'+data.myname+'" <'+Element("user_email").value+'>'; |
---|
| 2386 | _option.value = data.myname+";"+Element("user_email").value; |
---|
| 2387 | sel_from.options[sel_from.options.length] = _option; |
---|
| 2388 | |
---|
| 2389 | var options = ''; |
---|
| 2390 | for (var x = 0; x < data.length; x++) { |
---|
| 2391 | var _option = document.createElement("OPTION"); |
---|
| 2392 | _option.text = '"'+data[x].cn[0] + '" <'+data[x].mail[0]+'>'; |
---|
| 2393 | _option.value = data[x].cn[0] + ';'+data[x].mail[0]; |
---|
| 2394 | sel_from.options[sel_from.options.length] = _option ; |
---|
| 2395 | } |
---|
[2] | 2396 | } |
---|
| 2397 | var shared_users_from = Element("el_shared_users"); |
---|
| 2398 | if(!shared_users_from) { |
---|
| 2399 | shared_users_from = sel_from.cloneNode(true); |
---|
| 2400 | shared_users_from.id = "el_shared_users"; |
---|
| 2401 | shared_users_from.style.display = 'none'; |
---|
| 2402 | document.body.appendChild(shared_users_from); |
---|
| 2403 | } |
---|
| 2404 | } |
---|
| 2405 | // First time, so execute..... |
---|
| 2406 | cExecute ("$this.ldap_functions.getSharedUsersFrom&uids="+sharedUsers.join(';'), h_user); |
---|
| 2407 | } |
---|
| 2408 | |
---|
| 2409 | function changeBgColorToON(all_messages, begin, end){ |
---|
[163] | 2410 | for (begin; begin<=end; begin++) |
---|
| 2411 | { |
---|
| 2412 | add_className(all_messages[begin], 'selected_msg'); |
---|
[2] | 2413 | Element("check_box_message_" + all_messages[begin].id).checked = true; |
---|
| 2414 | } |
---|
| 2415 | } |
---|
[976] | 2416 | function updateBoxBgColor(box){ |
---|
| 2417 | // Set first TR Class |
---|
| 2418 | var _className = 'tr_msg_read2'; |
---|
| 2419 | for(var i = 0; i < box.length;i++){ |
---|
| 2420 | if(exist_className(box[i],_className)) |
---|
| 2421 | remove_className(box[i], _className); |
---|
| 2422 | _className = (_className == 'tr_msg_read2' ? 'tr_msg_read' : 'tr_msg_read2'); |
---|
| 2423 | if(!exist_className(box[i],_className)) |
---|
| 2424 | add_className( box[i], _className); |
---|
| 2425 | } |
---|
| 2426 | } |
---|
[2] | 2427 | |
---|
| 2428 | function changeBgColor(event, msg_number){ |
---|
[163] | 2429 | actual_tr = Element(msg_number); |
---|
[2] | 2430 | |
---|
[163] | 2431 | if (event.shiftKey) |
---|
| 2432 | { |
---|
| 2433 | last_tr = Element(last_message_selected); |
---|
[2] | 2434 | if(!last_tr) |
---|
| 2435 | last_tr = actual_tr; |
---|
| 2436 | |
---|
| 2437 | all_messages = actual_tr.parentNode.childNodes; |
---|
[163] | 2438 | |
---|
| 2439 | for (var i=0; i < all_messages.length; i++) |
---|
| 2440 | { |
---|
| 2441 | if (actual_tr.id == all_messages[i].id) |
---|
[2] | 2442 | first_order = i; |
---|
[163] | 2443 | if (last_tr.id == all_messages[i].id) |
---|
[2] | 2444 | last_order = i; |
---|
| 2445 | } |
---|
[163] | 2446 | |
---|
| 2447 | if (parseInt(first_order) > parseInt(last_order)) |
---|
| 2448 | changeBgColorToON(all_messages, last_order, first_order); |
---|
| 2449 | else |
---|
| 2450 | changeBgColorToON(all_messages, first_order, last_order); |
---|
[2] | 2451 | } |
---|
| 2452 | else{ |
---|
[163] | 2453 | //if ( exist_className(actual_tr, 'selected_msg') ) |
---|
| 2454 | if ( Element('check_box_message_' + msg_number).checked ) |
---|
| 2455 | add_className(actual_tr, 'selected_msg'); |
---|
| 2456 | else |
---|
| 2457 | remove_className(actual_tr, 'selected_msg'); |
---|
[2] | 2458 | } |
---|
| 2459 | last_message_selected = msg_number; |
---|
| 2460 | } |
---|
| 2461 | |
---|
| 2462 | function build_quota(data){ |
---|
| 2463 | id = "content_quota"; |
---|
| 2464 | q_limit = data['quota_limit']; |
---|
| 2465 | var div = document.getElementById(id); |
---|
| 2466 | if(!q_limit){ |
---|
[88] | 2467 | div.innerHTML = '<span><font size="2" style="color:red"><strong>'+get_lang("Without Quota")+'</strong></font></span>'; |
---|
[2] | 2468 | } |
---|
| 2469 | else{ |
---|
[345] | 2470 | if(div) |
---|
[356] | 2471 | div.innerHTML = ''; |
---|
[2] | 2472 | value = data['quota_percent']; |
---|
| 2473 | q_used = data['quota_used']; |
---|
| 2474 | table = document.getElementById("table_quota"); |
---|
| 2475 | if(table) |
---|
| 2476 | table.parentNode.removeChild(table); |
---|
| 2477 | table = document.createElement("TABLE"); |
---|
| 2478 | tbody = document.createElement("TBODY"); |
---|
| 2479 | table.appendChild(tbody); |
---|
| 2480 | table.id = "table_quota"; |
---|
| 2481 | table.width="102"; |
---|
| 2482 | table.border="0"; |
---|
| 2483 | table.cellSpacing = 0; |
---|
| 2484 | table.cellPadding = 0; |
---|
| 2485 | |
---|
| 2486 | //tr1 = document.createElement("TR"); |
---|
| 2487 | td11 = document.createElement("TD"); |
---|
| 2488 | td11.align="center"; |
---|
| 2489 | td11.setAttribute("noWrap","true"); |
---|
| 2490 | td11.innerHTML += ' ' + value+"% ("+q_used+"M/"+q_limit+"M)"; |
---|
| 2491 | //tr1.appendChild(td11); |
---|
| 2492 | |
---|
| 2493 | tr2 = document.createElement("TR"); |
---|
| 2494 | td21 = document.createElement("TD"); |
---|
| 2495 | td21.setAttribute("noWrap","true"); |
---|
| 2496 | td21.height="15"; |
---|
| 2497 | td22 = document.createElement("TD"); |
---|
[790] | 2498 | td21.setAttribute("background","templates/"+template+"/images/dsunused.gif"); |
---|
[2] | 2499 | table221 = document.createElement("TABLE"); |
---|
| 2500 | tbody221 = document.createElement("TBODY"); |
---|
| 2501 | table221.appendChild(tbody221); |
---|
| 2502 | table221.style.width=value+"%"; |
---|
| 2503 | td21.width="102"; |
---|
| 2504 | table221.border="0"; |
---|
| 2505 | table221.cellSpacing = 0; |
---|
| 2506 | table221.cellPadding = 0; |
---|
| 2507 | tr221 = document.createElement("TR"); |
---|
| 2508 | td221 = document.createElement("TD"); |
---|
| 2509 | td221.height="15"; |
---|
| 2510 | if(value > 90) { |
---|
| 2511 | if(value >= 100) |
---|
[53] | 2512 | write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages.")); |
---|
[2] | 2513 | else |
---|
| 2514 | write_msg(get_lang("Warning: Your Mailbox is almost full!")); |
---|
[790] | 2515 | td221.setAttribute("background","templates/"+template+"/images/dsalert.gif"); |
---|
[2] | 2516 | } |
---|
| 2517 | else if(value > 80) |
---|
[790] | 2518 | td221.setAttribute("background","templates/"+template+"/images/dswarn.gif"); |
---|
[2] | 2519 | else |
---|
[790] | 2520 | td221.setAttribute("background","templates/"+template+"/images/dsused.gif"); |
---|
[2] | 2521 | |
---|
| 2522 | tr221.appendChild(td221); |
---|
| 2523 | tbody221.appendChild(tr221); |
---|
| 2524 | td21.appendChild(table221); |
---|
| 2525 | tr2.appendChild(td21); |
---|
| 2526 | tr2.appendChild(td11); |
---|
| 2527 | |
---|
| 2528 | //tr2.appendChild(td1); |
---|
| 2529 | |
---|
| 2530 | tbody.appendChild(tr2); //Desenho |
---|
| 2531 | //tbody.appendChild(tr1); //Letras |
---|
| 2532 | div.appendChild(table); |
---|
| 2533 | } |
---|
| 2534 | } |
---|
| 2535 | |
---|
| 2536 | function draw_quota(data){ |
---|
| 2537 | build_quota(data); |
---|
| 2538 | } |
---|
| 2539 | |
---|
[345] | 2540 | function update_quota(folder_id){ |
---|
[325] | 2541 | cExecute ("$this.imap_functions.get_quota&folder_id="+folder_id,build_quota); |
---|
[2] | 2542 | } |
---|
| 2543 | |
---|
| 2544 | function draw_search(headers_msgs){ |
---|
| 2545 | Element("border_id_0").innerHTML = " " + get_lang('Search Result') + " "; |
---|
| 2546 | |
---|
| 2547 | var tbody = Element('tbody_box'); |
---|
| 2548 | for (var i=0; i<(headers_msgs.length); i++){ |
---|
| 2549 | var tr = this.make_tr_message(headers_msgs[i], headers_msgs[i].msg_folder); |
---|
[790] | 2550 | if (tr) |
---|
| 2551 | tbody.appendChild(tr); |
---|
[2] | 2552 | } |
---|
| 2553 | } |
---|
| 2554 | |
---|
| 2555 | function draw_search_header_box(){ |
---|
| 2556 | var table_message_header_box = Element("table_message_header_box"); |
---|
| 2557 | table_message_header_box.parentNode.removeChild(table_message_header_box); |
---|
| 2558 | |
---|
| 2559 | var content_id_0 = Element("content_id_0"); |
---|
| 2560 | var table_element = document.createElement("TABLE"); |
---|
| 2561 | var tbody_element = document.createElement("TBODY"); |
---|
| 2562 | table_element.setAttribute("id", "table_message_header_box"); |
---|
| 2563 | table_element.className = "table_message_header_box"; |
---|
| 2564 | tr_element = document.createElement("TR"); |
---|
| 2565 | tr_element.className = "message_header"; |
---|
| 2566 | td_element1 = document.createElement("TD"); |
---|
| 2567 | td_element1.setAttribute("width", "1%"); |
---|
| 2568 | chk_box_element = document.createElement("INPUT"); |
---|
| 2569 | chk_box_element.id = "chk_box_select_all_messages"; |
---|
| 2570 | chk_box_element.setAttribute("type", "checkbox"); |
---|
| 2571 | chk_box_element.className = "checkbox"; |
---|
| 2572 | chk_box_element.onclick = function(){select_all_messages(this.checked);}; |
---|
| 2573 | chk_box_element.onmouseover = function () {this.title=get_lang('Select all messages.')}; |
---|
| 2574 | chk_box_element.onkeydown = function (e){ |
---|
| 2575 | if (is_ie) |
---|
| 2576 | { |
---|
| 2577 | if ((window.event.keyCode) == 46) |
---|
| 2578 | { |
---|
| 2579 | //delete_all_selected_msgs_imap(); |
---|
[689] | 2580 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 2581 | } |
---|
| 2582 | } |
---|
| 2583 | else |
---|
| 2584 | { |
---|
| 2585 | if ((e.keyCode) == 46) |
---|
| 2586 | { |
---|
| 2587 | //delete_all_selected_msgs_imap(); |
---|
[689] | 2588 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 2589 | } |
---|
| 2590 | } |
---|
| 2591 | }; |
---|
| 2592 | |
---|
| 2593 | td_element1.appendChild(chk_box_element); |
---|
| 2594 | td_element2 = document.createElement("TD"); |
---|
| 2595 | td_element2.setAttribute("width", "3%"); |
---|
| 2596 | td_element3 = document.createElement("TD"); |
---|
| 2597 | td_element3.setAttribute("width", "30%"); |
---|
| 2598 | td_element3.id = "message_header_SORTFROM"; |
---|
| 2599 | td_element3.align = "left"; |
---|
| 2600 | td_element3.innerHTML = get_lang("From"); |
---|
| 2601 | td_element4 = document.createElement("TD"); |
---|
| 2602 | td_element4.setAttribute("width", "49%"); |
---|
| 2603 | td_element4.id = "message_header_SORTSUBJECT"; |
---|
| 2604 | td_element4.align = "left"; |
---|
| 2605 | td_element4.innerHTML = get_lang("Subject"); |
---|
| 2606 | td_element5 = document.createElement("TD"); |
---|
| 2607 | td_element5.setAttribute("width", "10%"); |
---|
| 2608 | td_element5.id = "message_header_SORTARRIVAL"; |
---|
| 2609 | td_element5.align = "center"; |
---|
| 2610 | td_element5.innerHTML = "<B>"+get_lang("Date")+"</B>"; |
---|
[790] | 2611 | td_element5.innerHTML += "<img src ='templates/"+template+"/images/arrow_descendant.gif'>"; |
---|
[2] | 2612 | td_element6 = document.createElement("TD"); |
---|
| 2613 | td_element6.setAttribute("width", "10%"); |
---|
| 2614 | td_element6.id = "message_header_SORTSIZE"; |
---|
| 2615 | td_element6.align = "right"; |
---|
| 2616 | td_element6.innerHTML = get_lang("Size"); |
---|
| 2617 | tr_element.appendChild(td_element1); |
---|
| 2618 | tr_element.appendChild(td_element2); |
---|
| 2619 | tr_element.appendChild(td_element3); |
---|
| 2620 | tr_element.appendChild(td_element4); |
---|
| 2621 | tr_element.appendChild(td_element5); |
---|
| 2622 | tr_element.appendChild(td_element6); |
---|
| 2623 | |
---|
| 2624 | tbody_element.appendChild(tr_element); |
---|
| 2625 | table_element.appendChild(tbody_element); |
---|
| 2626 | content_id_0.appendChild(table_element); |
---|
| 2627 | } |
---|
| 2628 | |
---|
| 2629 | function draw_search_division(msg){ |
---|
| 2630 | var tbody = Element('tbody_box'); |
---|
| 2631 | var tr = document.createElement("TR"); |
---|
| 2632 | var td = document.createElement("TD"); |
---|
| 2633 | td.colSpan = '7'; |
---|
| 2634 | td.width = '100%'; |
---|
| 2635 | |
---|
| 2636 | var action_info_table = document.createElement("TABLE"); |
---|
| 2637 | var action_info_tbody = document.createElement("TBODY"); |
---|
| 2638 | |
---|
| 2639 | action_info_table.className = "action_info_table"; |
---|
| 2640 | action_info_table.width = "100%"; |
---|
| 2641 | |
---|
| 2642 | var action_info_tr = document.createElement("TR"); |
---|
| 2643 | |
---|
| 2644 | var action_info_th1 = document.createElement("TH"); |
---|
| 2645 | action_info_th1.width = "40%"; |
---|
| 2646 | action_info_th1.innerHTML = " "; |
---|
| 2647 | |
---|
| 2648 | var action_info_th2 = document.createElement("TH"); |
---|
| 2649 | |
---|
| 2650 | action_info_th2.innerHTML = msg; |
---|
| 2651 | action_info_th2.className = "action_info_th"; |
---|
| 2652 | action_info_th2.setAttribute("noWrap", "true"); |
---|
| 2653 | |
---|
| 2654 | var action_info_th3 = document.createElement("TH"); |
---|
| 2655 | action_info_th3.width = "40%"; |
---|
| 2656 | action_info_th3.innerHTML = " "; |
---|
| 2657 | |
---|
| 2658 | action_info_tr.appendChild(action_info_th1); |
---|
| 2659 | action_info_tr.appendChild(action_info_th2); |
---|
| 2660 | action_info_tr.appendChild(action_info_th3); |
---|
| 2661 | action_info_tbody.appendChild(action_info_tr); |
---|
| 2662 | action_info_table.appendChild(action_info_tbody); |
---|
| 2663 | |
---|
| 2664 | td.appendChild(action_info_table); |
---|
| 2665 | tr.appendChild(td); |
---|
| 2666 | tbody.appendChild(tr); |
---|
| 2667 | } |
---|
| 2668 | |
---|
| 2669 | function draw_search_box(){ |
---|
| 2670 | var content_id_0 = Element("content_id_0"); |
---|
| 2671 | var table = document.createElement("TABLE"); |
---|
| 2672 | table.id = "table_box"; |
---|
| 2673 | table.width = 'auto'; |
---|
| 2674 | var tbody = document.createElement("TBODY"); |
---|
| 2675 | tbody.id = "tbody_box"; |
---|
| 2676 | |
---|
| 2677 | table.className = "table_box"; |
---|
| 2678 | table.setAttribute("frame", "below"); |
---|
| 2679 | table.setAttribute("rules", "none"); |
---|
| 2680 | table.setAttribute("cellpadding", "0"); |
---|
| 2681 | table.onkeydown = function (e){ |
---|
| 2682 | if (is_ie) |
---|
| 2683 | { |
---|
| 2684 | if ((window.event.keyCode) == 46) |
---|
| 2685 | { |
---|
| 2686 | //delete_all_selected_msgs_imap(); |
---|
[689] | 2687 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 2688 | } |
---|
| 2689 | } |
---|
| 2690 | else |
---|
| 2691 | { |
---|
| 2692 | if ((e.keyCode) == 46) |
---|
| 2693 | { |
---|
| 2694 | //delete_all_selected_msgs_imap(); |
---|
[689] | 2695 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 2696 | } |
---|
| 2697 | } |
---|
| 2698 | }; |
---|
| 2699 | if (is_ie) |
---|
| 2700 | table.style.cursor = "hand"; |
---|
| 2701 | |
---|
| 2702 | table.appendChild(tbody); |
---|
| 2703 | content_id_0.appendChild(table); |
---|
| 2704 | } |
---|
| 2705 | var idx_cc = 0; |
---|
[790] | 2706 | function draw_plugin_cc(ID, addrs) |
---|
| 2707 | { |
---|
[2] | 2708 | connector.loadScript("ccQuickAdd"); |
---|
| 2709 | |
---|
| 2710 | var array_addrs = ''; |
---|
| 2711 | var array_name = ''; |
---|
| 2712 | var cc_data = new Array(); |
---|
| 2713 | if(typeof(addrs.name) != 'undefined') { |
---|
| 2714 | array_name = LTrim(addrs.name).split(" "); |
---|
| 2715 | array_addrs = new Array(addrs.email); |
---|
| 2716 | } |
---|
| 2717 | else { |
---|
| 2718 | array_addrs = (typeof addrs == 'object' ? addrs.toString().split("\" ") : addrs.split("\" ")); |
---|
| 2719 | array_name = LTrim(array_addrs[0]).replace('"','').split(" "); |
---|
| 2720 | } |
---|
| 2721 | |
---|
| 2722 | var _split = array_name[0].split('@'); |
---|
| 2723 | cc_data[0] = _split[0]; |
---|
| 2724 | cc_data[1] = _split[0]; |
---|
| 2725 | cc_data[2] = ''; |
---|
| 2726 | |
---|
| 2727 | for (i=1; i < array_name.length; i++) |
---|
| 2728 | cc_data[2] += array_name[i] + " "; |
---|
| 2729 | |
---|
| 2730 | |
---|
| 2731 | if(array_addrs.length > 1) |
---|
| 2732 | cc_data[3] = array_addrs[1] ? array_addrs[1].replace("<",'').replace(">",'') : ''; |
---|
| 2733 | else |
---|
| 2734 | cc_data[3] = array_addrs[0]; |
---|
| 2735 | |
---|
[106] | 2736 | var sm_envelope_img1 = '<img style="cursor:'+ (is_ie ? 'hand' : 'pointer') +'" title="' + get_lang("Add Contact") + |
---|
[790] | 2737 | '" onclick="ccQuickAddOne.showList(\''+cc_data+'\')" src="./templates/'+template+'/images/user_card.png">'; |
---|
[2] | 2738 | var to_addybook_add = "<SPAN id='insert_plugin_"+idx_cc+"_"+ID+"'>"; |
---|
| 2739 | to_addybook_add += addrs; |
---|
| 2740 | to_addybook_add += sm_envelope_img1; |
---|
| 2741 | idx_cc++; |
---|
| 2742 | to_addybook_add += "</SPAN>"; |
---|
| 2743 | return to_addybook_add; |
---|
| 2744 | } |
---|
| 2745 | function deny_email(email){ |
---|
| 2746 | connector.loadScript("filter"); |
---|
[375] | 2747 | connector.loadScript("filters"); |
---|
[2] | 2748 | var dn_em = document.createElement("SPAN"); |
---|
| 2749 | dn_em.id = "tt_d"; |
---|
| 2750 | dn_em.onclick = function(){filter_rules.new_rule(email);}; |
---|
[106] | 2751 | dn_em.setAttribute("title",get_lang("Block Sender")); |
---|
[2] | 2752 | dn_em.style.cursor = "pointer"; |
---|
[790] | 2753 | dn_em.innerHTML = "<img align='top' onclick=filter.new_rule('"+email+"') src='./templates/"+template+"/images/deny.gif'>"; |
---|
[2] | 2754 | return dn_em; |
---|
| 2755 | |
---|
| 2756 | } |
---|
[13] | 2757 | function show_div_address_full(id, type) { |
---|
| 2758 | var div_address_full = Element("div_"+type+"address_full_"+id); |
---|
| 2759 | if(!div_address_full) { |
---|
| 2760 | div_address_full = document.createElement("SPAN"); |
---|
| 2761 | div_address_full.id = "div_"+type+"address_full_"+id; |
---|
| 2762 | div_address_full.style.display="none"; |
---|
| 2763 | var _address = eval(type+"address_array['"+id+"']"); |
---|
| 2764 | var isOverLimit = (_address.length > 100); |
---|
[2] | 2765 | |
---|
| 2766 | if(isOverLimit) { |
---|
[446] | 2767 | alert("Esse campo possui muitos endereços ("+_address.length+" destinatários).\r\n"+ |
---|
| 2768 | "Para evitar o travamento do navegador, o botão 'Adicionar Contato' foi desabilitado!"); |
---|
[2] | 2769 | } |
---|
[13] | 2770 | |
---|
| 2771 | for(var idx = 1 ; idx < _address.length;idx++) { |
---|
| 2772 | div_address_full.innerHTML += isOverLimit ? '<br>'+_address[idx] : ','+draw_plugin_cc(id,_address[idx]); |
---|
[2] | 2773 | } |
---|
[13] | 2774 | 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>)"; |
---|
| 2775 | Element(type+"_"+id).appendChild(div_address_full); |
---|
[2] | 2776 | } |
---|
[13] | 2777 | Element('div_'+type+'address_'+id).style.display='none'; |
---|
| 2778 | div_address_full.style.display=''; |
---|
[46] | 2779 | } |
---|
| 2780 | function draw_footer_box(num_msgs){ |
---|
[689] | 2781 | folder = get_current_folder(); |
---|
[58] | 2782 | var span_R = Element("table_message"); |
---|
| 2783 | var span_options = Element("span_options"); |
---|
| 2784 | if(!span_options) { |
---|
| 2785 | span_options = document.createElement("TD"); |
---|
| 2786 | span_options.style.fontSize = "12"; |
---|
| 2787 | span_options.id = "span_options"; |
---|
[59] | 2788 | span_R.appendChild(span_options); |
---|
| 2789 | } |
---|
[69] | 2790 | |
---|
[790] | 2791 | var change_font_color = 'onmouseover="var last_class = this.className;'+ |
---|
[848] | 2792 | 'if (this.className != \'message_options_over\')'+ |
---|
| 2793 | 'this.className=\'message_options_active\'; '+ |
---|
[790] | 2794 | 'this.onmouseout=function(){this.className=last_class;}"'; |
---|
| 2795 | |
---|
| 2796 | span_options.innerHTML = |
---|
| 2797 | '<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>'+ |
---|
| 2798 | '<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>'+ |
---|
| 2799 | '<span class="message_options_print"><span ' + change_font_color + ' title="'+get_lang("Print")+'" class="message_options" onclick=print_all()>'+get_lang("Print")+'</span></span>'+ |
---|
[1000] | 2800 | '<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>' + |
---|
[790] | 2801 | '<span class="message_options_import"><span ' + change_font_color + ' title="'+get_lang("Import")+'" class="message_options" onclick="import_window()">'+get_lang("Import")+'</span></span>'; |
---|
[1000] | 2802 | if(preferences.use_local_messages==1) |
---|
| 2803 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
| 2804 | span_options.innerHTML += ' <span title="'+get_lang("Unarchive")+'" class="message_options" onclick="expresso_local_messages.unarchive_msgs(\''+folder+'\',null)">'+get_lang("Unarchive")+'</span>'; |
---|
| 2805 | else |
---|
| 2806 | span_options.innerHTML += ' <span title="'+get_lang("Archive")+'" class="message_options" onclick="archive_msgs(\''+folder+'\',null)">'+get_lang("Archive")+'</span>'; |
---|
[69] | 2807 | if (use_spam_filter) { |
---|
[790] | 2808 | if ( current_folder == 'INBOX'+cyrus_delimiter+'Spam' ) { |
---|
| 2809 | 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>'; |
---|
[69] | 2810 | } |
---|
| 2811 | else { |
---|
[790] | 2812 | 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>'; |
---|
[69] | 2813 | } |
---|
| 2814 | } |
---|
[58] | 2815 | var span_D = Element("span_D"); |
---|
| 2816 | if(!span_D){ |
---|
| 2817 | span_D = document.createElement("TD"); |
---|
| 2818 | span_D.align = "right"; |
---|
| 2819 | span_D.style.fontSize = "12"; |
---|
| 2820 | span_D.id = "span_D"; |
---|
| 2821 | span_R.appendChild(span_D); |
---|
| 2822 | } |
---|
[46] | 2823 | span_D.innerHTML = |
---|
[58] | 2824 | get_lang("List")+': '+ |
---|
[790] | 2825 | '<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>, '+ |
---|
| 2826 | '<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>, '+ |
---|
| 2827 | '<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>, '+ |
---|
| 2828 | '<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>, '+ |
---|
| 2829 | '<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> '; |
---|
[46] | 2830 | draw_paging(num_msgs); |
---|
| 2831 | Element("tot_m").innerHTML = num_msgs; |
---|
[997] | 2832 | } |
---|