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