[5533] | 1 | /** |
---|
| 2 | * Estrutura que guarda em cache as mensagens abertas, a exemplo da estrutura utilizada |
---|
| 3 | * na funcionalidade de anexar mensagens. |
---|
| 4 | * Isto reduz a necessidade de acessar estruturas da tela para obter informações sobre |
---|
| 5 | * as mensagens, como tem sido para encaminhar, responder, etc. |
---|
| 6 | * Manter os dados 'limpos' em uma estrutura 'somente-leitura' permite maior flexibilidade |
---|
| 7 | * para mudar a tela e menos processamento de limpeza de dados (por exemplo retirar tags de |
---|
| 8 | * formatação, etc.) |
---|
| 9 | */ |
---|
[6667] | 10 | |
---|
| 11 | focusIn = ""; |
---|
| 12 | canMakeBox = true; |
---|
[6670] | 13 | fastSearch = false; |
---|
[6762] | 14 | var selectedMessages = {}; |
---|
| 15 | var allMsgsSelected = false; |
---|
[6667] | 16 | |
---|
[6762] | 17 | |
---|
| 18 | |
---|
[5533] | 19 | onceOpenedHeadersMessages = {}; |
---|
[6592] | 20 | var cache = new Array(); |
---|
[5533] | 21 | var openTab = { |
---|
[607] | 22 | 'type' : [], // 8 types of tabs, further info. see expressolivre.org/dev/wiki/mail/Documentacao |
---|
[320] | 23 | 'content_id' : [], |
---|
[607] | 24 | 'imapUid' : [], // Stores the imap email number of current tab |
---|
| 25 | 'countFile' : [0,0,0,0,0,0,0,0,0,0], // Stores the number of files attached in current tab |
---|
| 26 | 'imapBox' : [], // Stores the folder name |
---|
[646] | 27 | 'toPreserve' : [], // Check if the message should be removed from draft after send |
---|
[4821] | 28 | 'condition' : [] // Will store the search condition if the tab is the result of a search |
---|
[607] | 29 | }; |
---|
[5459] | 30 | |
---|
| 31 | var autoSaveControl = { |
---|
| 32 | 'timer' : [], // The timeout timer for autosave function |
---|
| 33 | 'status' : [] // The status autosave |
---|
| 34 | }; |
---|
| 35 | |
---|
[607] | 36 | var tabTypes = { |
---|
| 37 | 'new':4, |
---|
| 38 | 'forward':6, |
---|
| 39 | 'reply_with_history':7, |
---|
[3143] | 40 | 'reply_to_all_with_history':8, |
---|
| 41 | 'reply_without_history':9, |
---|
| 42 | 'reply_to_all_without_history':10, |
---|
[607] | 43 | 'edit':5 |
---|
[5459] | 44 | }; |
---|
[5302] | 45 | |
---|
[607] | 46 | var currentTab,numBox = 0; // Open Tab and num of mailboxes opened at context |
---|
[1747] | 47 | // Objeto Map, talvez o ideal fosse adicionar este objeto à Api do egroupware, e carregá-lo |
---|
| 48 | // aqui no expressoMail. |
---|
| 49 | |
---|
[2] | 50 | function draw_tree_folders(folders){ |
---|
| 51 | // Check if the tree folders alredy exist. |
---|
[51] | 52 | if (Element('dftree_tree_folders')){ |
---|
[1121] | 53 | if (!expresso_offline) { |
---|
| 54 | var update_tree_folders = function(data){ |
---|
[5754] | 55 | draw_quota(data); |
---|
[1121] | 56 | var unseen_in_mailbox = 0; |
---|
| 57 | var unseen_in_shared_folders = 0; |
---|
| 58 | for (var i=0; i<data.length; i++){ |
---|
| 59 | if ( data[i].folder_unseen > 0 ) |
---|
| 60 | { |
---|
| 61 | unseen_in_mailbox = parseInt( unseen_in_mailbox + data[ i ].folder_unseen ); |
---|
| 62 | if ( data[i].folder_id.indexOf( 'INBOX' ) !== 0 ) |
---|
| 63 | unseen_in_shared_folders = parseInt( unseen_in_shared_folders + data[ i ].folder_unseen ); |
---|
| 64 | } |
---|
[3035] | 65 | |
---|
[1121] | 66 | var folder_unseen = Element('dftree_'+data[i].folder_id+'_unseen'); |
---|
[3035] | 67 | |
---|
[1121] | 68 | if ((folder_unseen) && (data[i].folder_unseen > 0)) |
---|
| 69 | { |
---|
| 70 | folder_unseen.innerHTML = data[i].folder_unseen; |
---|
| 71 | } |
---|
| 72 | else if (data[i].folder_unseen > 0) |
---|
| 73 | { |
---|
| 74 | 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>'}); |
---|
| 75 | tree_folders.getNodeById(data[i].folder_id)._refresh(); |
---|
| 76 | } |
---|
| 77 | else if (data[i].folder_unseen <= 0) |
---|
| 78 | { |
---|
[5134] | 79 | if(tree_folders.getNodeById(data[i].folder_id)){ |
---|
[1121] | 80 | tree_folders.getNodeById(data[i].folder_id).alter({caption:lang_folder(data[i].folder_name)}); |
---|
| 81 | tree_folders.getNodeById(data[i].folder_id)._refresh(); |
---|
| 82 | } |
---|
[5134] | 83 | } |
---|
[1121] | 84 | |
---|
[3035] | 85 | if(data[i].folder_id == current_folder){ |
---|
[1121] | 86 | var old_new_m = isNaN(parseInt(Element('new_m').innerHTML)) ? parseInt(Element('new_m').firstChild.innerHTML) : parseInt(Element('new_m').innerHTML); |
---|
| 87 | Element('new_m').innerHTML = data[i].folder_unseen ? '<font color="RED">'+data[i].folder_unseen+'</font>' : 0; |
---|
| 88 | draw_paging(Element('tot_m').innerHTML); |
---|
| 89 | } |
---|
[790] | 90 | } |
---|
| 91 | |
---|
[1121] | 92 | var display_unseen_in_mailbox = tree_folders.getNodeById( 'root' ); |
---|
[3035] | 93 | display_unseen_in_mailbox.alter({caption:get_lang("My Folders")}); |
---|
[1121] | 94 | display_unseen_in_mailbox._refresh(); |
---|
[3035] | 95 | |
---|
[1121] | 96 | var display_unseen_in_shared_folders = tree_folders.getNodeById( 'user' ); |
---|
| 97 | if ( display_unseen_in_shared_folders ) |
---|
[2] | 98 | { |
---|
[1121] | 99 | if ( unseen_in_shared_folders ) |
---|
| 100 | 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")}); |
---|
| 101 | else |
---|
| 102 | display_unseen_in_shared_folders.alter({caption:get_lang("Shared folders")}); |
---|
| 103 | display_unseen_in_shared_folders._refresh(); |
---|
[2] | 104 | } |
---|
| 105 | } |
---|
[1121] | 106 | cExecute ("$this.imap_functions.get_folders_list&folder="+current_folder, update_tree_folders); |
---|
[2] | 107 | } |
---|
[3035] | 108 | |
---|
[2] | 109 | return; |
---|
| 110 | } |
---|
| 111 | else{ |
---|
[1121] | 112 | if (!expresso_offline) { |
---|
| 113 | tree_folders = new dFTree({name: 'tree_folders'}); |
---|
[3035] | 114 | |
---|
[1121] | 115 | var n_root = new dNode({id:'root', caption: get_lang("My Folders")}); |
---|
| 116 | tree_folders.add(n_root,'anything'); //Places the root; second argument can be anything. |
---|
[3035] | 117 | |
---|
[1121] | 118 | var unseen_in_mailbox = 0; |
---|
| 119 | var unseen_in_shared_folders = 0; |
---|
| 120 | for (var i=0; i<folders.length; i++){ |
---|
| 121 | if (folders[i].folder_unseen > 0) |
---|
| 122 | { |
---|
| 123 | unseen_in_mailbox = parseInt( unseen_in_mailbox + folders[ i ].folder_unseen ); |
---|
| 124 | if ( folders[i].folder_id.indexOf( 'INBOX' ) !== 0 ) |
---|
| 125 | unseen_in_shared_folders = parseInt( unseen_in_shared_folders + folders[ i ].folder_unseen ); |
---|
[790] | 126 | |
---|
[3035] | 127 | 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}); |
---|
| 128 | |
---|
[1121] | 129 | if( folders[i].folder_name.toLowerCase() == 'inbox' ) |
---|
| 130 | Element('new_m').innerHTML = '<font style="color:red">' + folders[i].folder_unseen + '</font>'; |
---|
[2] | 131 | } |
---|
[1121] | 132 | else |
---|
[3035] | 133 | 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}); |
---|
| 134 | |
---|
[1121] | 135 | if (folders[i].folder_parent == '') |
---|
| 136 | folders[i].folder_parent = 'root'; |
---|
[3035] | 137 | else if (folders[i].folder_parent == 'user'){ |
---|
| 138 | |
---|
[1121] | 139 | if (!tree_folders.getNodeById('user')){ |
---|
[4738] | 140 | tmpFolderId = folders[i].folder_id.split(cyrus_delimiter).pop(); |
---|
[3035] | 141 | var n_root_shared_folders = new dNode({id:'user', caption:get_lang("Shared folders"), plusSign:true}); |
---|
[1121] | 142 | tree_folders.add(n_root_shared_folders,'root'); |
---|
| 143 | } |
---|
| 144 | } |
---|
| 145 | tree_folders.add(nn,folders[i].folder_parent); |
---|
[2] | 146 | } |
---|
| 147 | } |
---|
[3178] | 148 | |
---|
| 149 | |
---|
| 150 | |
---|
| 151 | var handlerChannel = function(data){ |
---|
[3183] | 152 | if (data == null || typeof(data) == 'string') |
---|
[3178] | 153 | return; |
---|
| 154 | /* |
---|
| 155 | * RSS NEWS |
---|
| 156 | */ |
---|
| 157 | var root_rss = new dNode({ |
---|
| 158 | id: "news_root", |
---|
| 159 | caption: get_lang('News') |
---|
| 160 | }); |
---|
| 161 | tree_folders.add(root_rss, "root"); |
---|
| 162 | for(i=0; i < data.length; i++) |
---|
| 163 | { |
---|
| 164 | var nodeNews = new dNode({ |
---|
| 165 | id: "NEWS/"+data[i].name, |
---|
| 166 | caption: data[i].name, |
---|
| 167 | onClick: "open_rss('"+data[i].rss_url+"')", |
---|
| 168 | plusSign: 0 |
---|
| 169 | }); |
---|
| 170 | tree_folders.add(nodeNews,"news_root"); |
---|
| 171 | } |
---|
| 172 | var noden=document.getElementById('lnews_roottree_folders'); |
---|
| 173 | noden.style.backgroundImage="url(templates/"+template+"/images/menu/rss.png)"; |
---|
[5533] | 174 | |
---|
| 175 | |
---|
| 176 | |
---|
[3178] | 177 | } |
---|
[3267] | 178 | // cExecute('$this.rss.getChannels',handlerChannel); |
---|
[3178] | 179 | |
---|
| 180 | |
---|
[689] | 181 | /** |
---|
| 182 | * Pastas locais |
---|
| 183 | */ |
---|
[1121] | 184 | if (preferences.use_local_messages==1 || expresso_offline) { |
---|
[5134] | 185 | //verifica se gears esta installado ou o offline |
---|
| 186 | if( (!window.google || !google.gears) && |
---|
| 187 | !expresso_local_messages.installGears() ){ |
---|
| 188 | preferences.use_local_messages = 0; |
---|
[689] | 189 | } |
---|
[5134] | 190 | else if( !expresso_local_messages.is_offline_installed() ) |
---|
| 191 | preferences.use_local_messages = 0; |
---|
[689] | 192 | else{ |
---|
[3035] | 193 | if (expresso_offline) |
---|
[1701] | 194 | tree_folders = new dFTree({ |
---|
| 195 | name: 'tree_folders' |
---|
| 196 | }); |
---|
| 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 | } |
---|
[3035] | 211 | if (local_folders[i][1] > 0) |
---|
[1701] | 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] |
---|
[689] | 217 | }); |
---|
[3035] | 218 | else |
---|
[1701] | 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 | }); |
---|
[1518] | 225 | tree_folders.add(nodeLocal, node_root); |
---|
| 226 | } |
---|
[689] | 227 | } |
---|
[3035] | 228 | } |
---|
[5584] | 229 | |
---|
| 230 | /*tree_folders.draw(Element('content_folders')); |
---|
[1121] | 231 | if (!expresso_offline) { |
---|
[5134] | 232 | n_root.changeState(); |
---|
| 233 | tree_folders.getNodeById('INBOX')._select(); |
---|
[1121] | 234 | } |
---|
| 235 | else { |
---|
| 236 | root_local.changeState(); |
---|
| 237 | tree_folders.getNodeById('local_Inbox')._select(); |
---|
[5584] | 238 | }*/ |
---|
| 239 | |
---|
[5306] | 240 | var trash_span = document.getElementById(mount_url_folder(["lINBOX",special_folders["Trash"]]) + 'tree_folders'); |
---|
[5533] | 241 | var draft_span = document.getElementById(mount_url_folder(["lINBOX",special_folders["Drafts"]]) + 'tree_folders'); |
---|
| 242 | var sent_span = document.getElementById(mount_url_folder(["lINBOX",special_folders["Sent"]]) + 'tree_folders'); |
---|
| 243 | var spam_span = document.getElementById(mount_url_folder(["lINBOX",special_folders["Spam"]]) + 'tree_folders'); |
---|
[3287] | 244 | //local folders |
---|
[5306] | 245 | var sent_local_conf = this.preferences.save_in_folder.replace(mount_url_folder(["INBOX",""]),"local_"); |
---|
[3287] | 246 | var sent_local_conf_span=document.getElementById('l'+sent_local_conf+'tree_folders'); |
---|
[5211] | 247 | var trash_local_span=document.getElementById('llocal_'+special_folders['Trash']+'tree_folders'); |
---|
| 248 | var draft_local_span=document.getElementById('llocal_'+special_folders['Drafts']+'tree_folders'); |
---|
| 249 | var sent_span_default=document.getElementById('llocal_'+special_folders['Sent']+'tree_folders'); |
---|
[790] | 250 | |
---|
[3287] | 251 | |
---|
[790] | 252 | if (trash_span) |
---|
| 253 | trash_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_trash.png)"; |
---|
| 254 | |
---|
| 255 | if (draft_span) |
---|
| 256 | draft_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_draft.png)" |
---|
| 257 | |
---|
| 258 | if (sent_span) |
---|
| 259 | sent_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_sent.png)"; |
---|
| 260 | if (spam_span) |
---|
| 261 | spam_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_spam.png)"; |
---|
| 262 | |
---|
[3287] | 263 | if (sent_span_default) |
---|
| 264 | sent_span_default.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_sent.png)"; |
---|
| 265 | //Local folders |
---|
[1121] | 266 | |
---|
[3287] | 267 | if (sent_local_conf_span) |
---|
| 268 | sent_local_conf_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_sent.png)"; |
---|
| 269 | if (trash_local_span) |
---|
| 270 | trash_local_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_trash.png)"; |
---|
| 271 | if (draft_local_span) |
---|
| 272 | draft_local_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_draft.png)" |
---|
| 273 | if (sent_span_default) |
---|
| 274 | sent_span_default.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_sent.png)"; |
---|
| 275 | |
---|
| 276 | |
---|
[2] | 277 | draw_paging(Element('tot_m').innerHTML); |
---|
[5306] | 278 | if(document.getElementById(mount_url_folder(["nINBOX",special_folders["Trash"]])+"tree_folders")) |
---|
[1752] | 279 | { |
---|
| 280 | var trash = document.createElement("SPAN"); |
---|
| 281 | trash.id = 'empty_trash'; |
---|
[1965] | 282 | trash.className = 'clean_folder'; |
---|
[1752] | 283 | trash.style.cursor = 'pointer'; |
---|
| 284 | trash.onclick = function () {empty_trash_imap();}; |
---|
| 285 | trash.innerHTML = "["+get_lang("Clean")+"]"; |
---|
[1965] | 286 | trash.title=get_lang("Empty trash"); |
---|
[1752] | 287 | trash.onmouseover = function() {trash.style.color="red";}; |
---|
[1965] | 288 | trash.onmouseout= function() {trash.style.color="#666666";}; |
---|
[5306] | 289 | document.getElementById(mount_url_folder(["nINBOX",special_folders["Trash"]])+"tree_folders").appendChild(trash); |
---|
[1752] | 290 | } |
---|
[5306] | 291 | if(document.getElementById(mount_url_folder(["nINBOX",special_folders["Spam"]])+"tree_folders")) |
---|
[1965] | 292 | { |
---|
[3035] | 293 | var spam = document.createElement("SPAN"); |
---|
| 294 | spam.id = 'empty_spam'; |
---|
| 295 | spam.className = 'clean_folder'; |
---|
| 296 | spam.style.cursor = 'pointer'; |
---|
| 297 | spam.style.padding = '0 0 0 6px'; |
---|
| 298 | spam.onclick = function () {empty_spam_imap();}; |
---|
| 299 | spam.innerHTML = "["+get_lang("Clean")+"]"; |
---|
| 300 | spam.title=get_lang("Empty Spam Folder"); |
---|
| 301 | spam.onmouseover = function() {spam.style.color="red";}; |
---|
| 302 | spam.onmouseout= function() {spam.style.color="#666666";}; |
---|
[5306] | 303 | document.getElementById(mount_url_folder(["nINBOX",special_folders["Spam"]])+"tree_folders").appendChild(spam); |
---|
[3035] | 304 | } |
---|
[1752] | 305 | |
---|
[1121] | 306 | if(!expresso_offline) |
---|
| 307 | var display_unseen_in_mailbox = tree_folders.getNodeById( 'root' ); |
---|
| 308 | else |
---|
| 309 | var display_unseen_in_mailbox = tree_folders.getNodeById( 'local_root' ); |
---|
[3035] | 310 | display_unseen_in_mailbox.alter({caption:get_lang("My Folders")}); |
---|
[790] | 311 | display_unseen_in_mailbox._refresh(); |
---|
| 312 | |
---|
| 313 | var display_unseen_in_shared_folders = tree_folders.getNodeById( 'user' ); |
---|
| 314 | if ( display_unseen_in_shared_folders ) |
---|
| 315 | { |
---|
| 316 | if ( unseen_in_shared_folders ) |
---|
| 317 | 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")}); |
---|
| 318 | else |
---|
| 319 | display_unseen_in_shared_folders.alter({caption:get_lang("Shared folders")}); |
---|
| 320 | display_unseen_in_shared_folders._refresh(); |
---|
| 321 | } |
---|
[2] | 322 | } |
---|
[790] | 323 | |
---|
[1121] | 324 | if (!expresso_offline) { |
---|
| 325 | var folder_create = ""; |
---|
| 326 | var nm1 = ""; |
---|
| 327 | if(tree_folders._folderPr.length > 0){ |
---|
| 328 | var nm_folder = ""; |
---|
| 329 | for(var i=0; i < tree_folders._folderPr.length; i++){ |
---|
| 330 | nm_folder = tree_folders._folderPr[i].split(cyrus_delimiter); |
---|
| 331 | if(nm_folder[0] == "INBOX"){ |
---|
| 332 | if(nm1 == ""){ |
---|
[2] | 333 | nm1 = nm_folder[1]; |
---|
[1121] | 334 | folder_create = "INBOX" + cyrus_delimiter + nm_folder[1] + ";"; |
---|
| 335 | }else{ |
---|
| 336 | if( nm1 != nm_folder[1]){ |
---|
| 337 | folder_create += "INBOX" + cyrus_delimiter + nm_folder[1] + ";"; |
---|
| 338 | nm1 = nm_folder[1]; |
---|
| 339 | } |
---|
[2] | 340 | } |
---|
| 341 | } |
---|
| 342 | } |
---|
| 343 | } |
---|
| 344 | } |
---|
[5950] | 345 | |
---|
| 346 | outOfficeVerify(); |
---|
[5533] | 347 | } |
---|
[3178] | 348 | |
---|
[5533] | 349 | function draw_tree_labels(){ |
---|
| 350 | labels = DataLayer.get('label',{criteria:{order: 'name'}}); |
---|
[5566] | 351 | if(!$("#MyMarckersList").length) |
---|
| 352 | var myLabels = $('#content_folders').append("<div id='MyMarckersList' class='acc-list list-label' ></div>").find("#MyMarckersList"); |
---|
| 353 | else |
---|
| 354 | var myLabels = $("#MyMarckersList"); |
---|
| 355 | myLabels.html("<div class='my-labels'>" + |
---|
[5533] | 356 | "<img src='../prototype/modules/mail/img/tag.png'/>" + |
---|
[5584] | 357 | "<a class='title-my-labels' tabindex='0' role='button' aria-expanded='false' title='"+get_lang("My Labels")+"'>"+get_lang("My Labels")+"</a>" + |
---|
[5533] | 358 | |
---|
| 359 | "<span class='status-list-labels ui-icon ui-icon-triangle-1-s'></span>" + |
---|
| 360 | "</div>" |
---|
| 361 | ) |
---|
| 362 | .append(DataLayer.render("../prototype/modules/mail/templates/label_list.ejs", {labels: labels} )) |
---|
[5612] | 363 | .find("li.label-item").css({"background-color":"#ffffff", "border-color":"#CCCCCC", "color":"#444444"}).click(function(event,ui){ |
---|
[5623] | 364 | if($(event.target).is('.square-color')){ |
---|
| 365 | $(this).each(function(){ |
---|
| 366 | configureLabels({selectedItem: $(this).attr('class').match(/label-item-([\d]+[()a-zA-Z]*)/)[1]}); |
---|
| 367 | var id_label_item = $(this).attr('class').match(/label-item-([\d]+[()a-zA-Z]*)/)[1]; |
---|
| 368 | $(".label-list-container .label-list").find(".label-item-"+id_label_item).trigger("click"); |
---|
| 369 | }); |
---|
| 370 | } else { |
---|
| 371 | var labelId = $(this).attr('class').match(/label-item-([\d]+[()a-zA-Z]*)/)[1]; |
---|
| 372 | search_emails("UNDELETED KEYWORD \"$Label"+labelId+"\""); |
---|
[5612] | 373 | } |
---|
[5624] | 374 | }).find(".square-color").css("display",""); |
---|
| 375 | |
---|
[5713] | 376 | $("#MyMarckersList a.title-my-labels").click(function() { |
---|
| 377 | if($("#MyMarckersList ul.label-list").css("display") == "none"){ |
---|
| 378 | $("#MyMarckersList ul.label-list").show(); |
---|
| 379 | }else{ |
---|
| 380 | $("#MyMarckersList ul.label-list").hide(); |
---|
| 381 | } |
---|
[5533] | 382 | $('#MyMarckersList .status-list-labels').toggleClass("ui-icon-triangle-1-s"); |
---|
[5713] | 383 | $('#MyMarckersList .status-list-labels').toggleClass("ui-icon-triangle-1-n"); |
---|
[5533] | 384 | }); |
---|
[5713] | 385 | |
---|
[5533] | 386 | if (!labels){ |
---|
[5713] | 387 | $(".my-labels").hide(); |
---|
[5533] | 388 | } |
---|
[2] | 389 | } |
---|
| 390 | |
---|
[1938] | 391 | function draw_tree_local_folders() { |
---|
| 392 | /** |
---|
| 393 | * Pastas locais |
---|
| 394 | */ |
---|
[4826] | 395 | if(preferences.use_local_messages==1 || expresso_offline) { |
---|
| 396 | var local_folders = expresso_local_messages.list_local_folders(); |
---|
| 397 | var has_changes = false; |
---|
| 398 | for (var i in local_folders) { //Coloca as pastas locais. |
---|
[3035] | 399 | |
---|
[4826] | 400 | var new_caption = local_folders[i][0]; |
---|
| 401 | if(local_folders[i][0].indexOf("/")!="-1") { |
---|
| 402 | final_pos = local_folders[i][0].lastIndexOf("/"); |
---|
| 403 | new_caption = local_folders[i][0].substr(final_pos+1); |
---|
| 404 | } |
---|
[3035] | 405 | |
---|
[4826] | 406 | var folder_unseen = Element('dftree_local_'+local_folders[i][0]+'_unseen'); |
---|
[3035] | 407 | |
---|
[4826] | 408 | if ((folder_unseen) && (local_folders[i][1] > 0)) |
---|
| 409 | { |
---|
| 410 | folder_unseen.innerHTML = local_folders[i][1]; |
---|
| 411 | has_changes = true; |
---|
| 412 | } |
---|
| 413 | else if (local_folders[i][1] > 0) |
---|
| 414 | { |
---|
| 415 | 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>'}); |
---|
| 416 | tree_folders.getNodeById("local_"+local_folders[i][0])._refresh(); |
---|
| 417 | has_changes = true; |
---|
| 418 | } |
---|
| 419 | else if (local_folders[i][1] <= 0) |
---|
| 420 | { |
---|
| 421 | tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(new_caption)}); |
---|
| 422 | tree_folders.getNodeById("local_"+local_folders[i][0])._refresh(); |
---|
| 423 | has_changes = true; |
---|
| 424 | } |
---|
[1938] | 425 | |
---|
[3035] | 426 | if("local_"+local_folders[i][0] == get_current_folder()){ |
---|
[4826] | 427 | var old_new_m = isNaN(parseInt(Element('new_m').innerHTML)) ? parseInt(Element('new_m').firstChild.innerHTML) : parseInt(Element('new_m').innerHTML); |
---|
| 428 | if(!isNaN(old_new_m) && old_new_m < local_folders[i][1]){ |
---|
| 429 | Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) + (parseInt(local_folders[i][1])-old_new_m); |
---|
| 430 | } |
---|
| 431 | Element('new_m').innerHTML = local_folders[i][1] ? '<font color="RED">'+local_folders[i][1]+'</font>' : 0; |
---|
| 432 | draw_paging(Element('tot_m').innerHTML); |
---|
| 433 | has_changes = true; |
---|
[1938] | 434 | } |
---|
| 435 | } |
---|
[4826] | 436 | if(has_changes) |
---|
| 437 | tree_folders.getNodeById("local_root").open(); |
---|
| 438 | } |
---|
| 439 | } |
---|
[1938] | 440 | |
---|
[4826] | 441 | |
---|
| 442 | function update_local_box(){ |
---|
| 443 | msg_range_end = (current_page*preferences.max_email_per_page); |
---|
| 444 | msg_range_begin = (msg_range_end-(preferences.max_email_per_page)+1); |
---|
| 445 | folder=get_current_folder(); |
---|
| 446 | var msgs = expresso_local_messages.get_local_range_msgs(folder.substr(6),msg_range_begin,preferences.max_email_per_page,sort_box_type,sort_box_reverse,search_box_type,preferences.preview_msg_subject,preferences.preview_msg_tip); |
---|
| 447 | alternate_border(0); |
---|
| 448 | draw_box(msgs, folder, true); |
---|
| 449 | draw_paging(msgs.num_msgs); |
---|
| 450 | Element("tot_m").innerHTML = msgs.num_msgs; |
---|
| 451 | update_menu(); |
---|
[1938] | 452 | } |
---|
| 453 | |
---|
[2] | 454 | function update_menu(data){ |
---|
[446] | 455 | /* |
---|
| 456 | * @AUTHOR Rodrigo Souza dos Santos |
---|
| 457 | * @DATE 2008/09/15 |
---|
| 458 | * @BRIEF When occurs a error in imap server show the message that is in file "error.html". |
---|
| 459 | */ |
---|
| 460 | if ( data && data.imap_error ) |
---|
| 461 | { |
---|
[1964] | 462 | if(preferences.use_local_messages==1 && expresso_local_messages.is_offline_installed){ |
---|
| 463 | conf = confirm(get_lang("The expresso imap server is currently down, expresso noticed you have offline mail module installed, would you like to use it?")); |
---|
| 464 | if(conf) { |
---|
| 465 | window.onresize = function() { |
---|
| 466 | var target = document.getElementById('divAppbox'); |
---|
| 467 | target.style.height= document.body.clientHeight - 83; |
---|
| 468 | } |
---|
| 469 | var target = document.getElementById('divAppbox'); |
---|
| 470 | document.getElementById("divAppboxHeader").innerHTML=""; |
---|
| 471 | target.style.height= document.body.clientHeight - 83; |
---|
| 472 | expresso_local_messages.set_as_logged(account_id,0,true); |
---|
| 473 | target.innerHTML = "<iframe src='offline.php?inside=1' width='100%' height='100%' frameBorder='0'></iframe>"; |
---|
| 474 | return false; |
---|
| 475 | } |
---|
| 476 | } |
---|
[790] | 477 | connector.newRequest('error.html', 'templates/'+template+'/error.html', 'GET', |
---|
[446] | 478 | function(data) |
---|
| 479 | { |
---|
| 480 | var target = document.getElementById('divAppbox'); |
---|
| 481 | if ( target ) |
---|
| 482 | target.innerHTML = data; |
---|
| 483 | } |
---|
| 484 | ); |
---|
| 485 | return false; |
---|
| 486 | } |
---|
[5486] | 487 | |
---|
| 488 | |
---|
[2] | 489 | if(data) { |
---|
[5486] | 490 | draw_tree_folders(data); |
---|
[5754] | 491 | draw_quota(data); |
---|
[790] | 492 | var f_unseen = Element('dftree_'+current_folder+'_unseen'); |
---|
[2] | 493 | if(f_unseen && f_unseen.innerHTML) |
---|
| 494 | Element('new_m').innerHTML = '<font face="Verdana" size="1" color="RED">'+f_unseen.innerHTML+'</font>'; |
---|
| 495 | else |
---|
[320] | 496 | { |
---|
| 497 | if( parseInt(Element('new_m').innerHTML) == 0 ) |
---|
[3035] | 498 | Element('new_m').innerHTML = 0; |
---|
[320] | 499 | } |
---|
[2] | 500 | folders = data; |
---|
| 501 | } |
---|
[5486] | 502 | draw_new_tree_folder(); |
---|
[5533] | 503 | draw_tree_labels(); |
---|
[5754] | 504 | if(Element("table_quota")) |
---|
| 505 | connector.loadScript("InfoQuota"); |
---|
[5821] | 506 | |
---|
| 507 | if(preferences.enable_quickadd_telephonenumber) |
---|
| 508 | connector.loadScript("QuickAddTelephone"); |
---|
[2] | 509 | } |
---|
| 510 | |
---|
| 511 | var handler_draw_box = function(data){ |
---|
[320] | 512 | draw_box(data, 'INBOX', true); |
---|
| 513 | //alternate_border(0); |
---|
[2] | 514 | } |
---|
| 515 | |
---|
| 516 | // Action on change folders. |
---|
| 517 | function change_folder(folder, folder_name){ |
---|
[607] | 518 | if (openTab.imapBox[0] != folder) |
---|
[2] | 519 | { |
---|
| 520 | current_folder = folder; |
---|
| 521 | var handler_draw_box = function(data) |
---|
| 522 | { |
---|
| 523 | if(!verify_session(data)) |
---|
| 524 | return; |
---|
[320] | 525 | alternate_border(0); |
---|
[5431] | 526 | var title = lang_folder(folder_name); |
---|
[5443] | 527 | if (title.length > 18) title = title.substring(0,18) + "..."; |
---|
[5431] | 528 | Element("border_id_0").innerHTML = " " + title + ' <font face="Verdana" size="1" color="#505050">[<span id="new_m"> </span> / <span id="tot_m"></span>]</font>'; |
---|
[320] | 529 | draw_box(data, folder, true); |
---|
[2] | 530 | draw_paging(data.num_msgs); |
---|
| 531 | Element("tot_m").innerHTML = data.num_msgs; |
---|
[5486] | 532 | $("#new_m").html(($(".selected").find(".folder_unseen").html() != "0" && $(".selected").find(".folder_unseen").html() != null)? $(".selected").find(".folder_unseen").html() : "0").css("color", "red"); |
---|
| 533 | //update_menu(); |
---|
[5754] | 534 | $(".folders-loading").removeClass("folders-loading"); |
---|
[320] | 535 | return true; |
---|
[2] | 536 | } |
---|
[1752] | 537 | proxy_mensagens.messages_list(current_folder,1,preferences.max_email_per_page,sort_box_type,search_box_type,sort_box_reverse,preferences.preview_msg_subject,preferences.preview_msg_tip,handler_draw_box); |
---|
[6762] | 538 | var handler_populateSelectedMsgs = function(data){ |
---|
| 539 | populateSelectedMsgs(data); |
---|
| 540 | } |
---|
| 541 | cExecute ("$this.imap_functions.get_msgs&folder="+current_folder+"&sort_box_type=SORTARRIVAL&search_box_type=ALL&sort_box_reverse=1", handler_populateSelectedMsgs); |
---|
| 542 | |
---|
[689] | 543 | } |
---|
[5516] | 544 | else{ |
---|
[5754] | 545 | $(".folders-loading").removeClass("folders-loading"); |
---|
[320] | 546 | alternate_border(0); |
---|
[5516] | 547 | } |
---|
[320] | 548 | } |
---|
| 549 | |
---|
| 550 | function open_folder(folder, folder_name){ |
---|
[790] | 551 | if (current_folder!= folder) { |
---|
[320] | 552 | current_folder = folder; |
---|
[325] | 553 | var handler_draw_box = function(data){ |
---|
[345] | 554 | if(!verify_session(data)) |
---|
| 555 | return false; |
---|
| 556 | numBox++; |
---|
| 557 | create_border(folder_name,numBox.toString()); |
---|
| 558 | draw_box(data, current_folder, false); |
---|
| 559 | alternate_border(numBox); |
---|
| 560 | return true; |
---|
[320] | 561 | } |
---|
[345] | 562 | 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] | 563 | } |
---|
| 564 | else |
---|
[345] | 565 | alternate_border(numBox); |
---|
| 566 | return true; |
---|
[2] | 567 | } |
---|
| 568 | |
---|
| 569 | var lastPage = 1; |
---|
| 570 | var numPages = 5; |
---|
| 571 | var last_folder = 'INBOX'; |
---|
[3035] | 572 | function draw_paging(num_msgs){ |
---|
[2] | 573 | num_msgs = parseInt(num_msgs); |
---|
| 574 | total_pages = 1; |
---|
| 575 | |
---|
[790] | 576 | if(last_folder != current_folder){ |
---|
[2] | 577 | lastPage = 1; |
---|
| 578 | current_page = 1; |
---|
[790] | 579 | last_folder = current_folder; |
---|
[2] | 580 | } |
---|
| 581 | |
---|
[3035] | 582 | if(num_msgs > parseInt(preferences.max_email_per_page)) { |
---|
[2] | 583 | total_pages = parseInt(num_msgs/preferences.max_email_per_page); |
---|
| 584 | if((num_msgs/preferences.max_email_per_page) > total_pages) |
---|
[3035] | 585 | total_pages++; |
---|
[2] | 586 | } |
---|
| 587 | |
---|
| 588 | if(total_pages == 1) { |
---|
[3393] | 589 | if(span_paging = document.getElementById("span_paging")) { |
---|
[2] | 590 | span_paging.parentNode.removeChild(span_paging); |
---|
| 591 | } |
---|
| 592 | return; |
---|
| 593 | } |
---|
[3393] | 594 | span_paging = document.getElementById("span_paging"); |
---|
[2] | 595 | if(!span_paging){ |
---|
| 596 | span_paging = document.createElement("DIV"); |
---|
[3393] | 597 | span_paging.id = "span_paging"; |
---|
[1247] | 598 | span_paging.className = "boxHeaderText"; |
---|
[2] | 599 | span_paging.align="right"; |
---|
[3035] | 600 | document.getElementById("div_menu_c3").appendChild(span_paging); |
---|
[2] | 601 | } |
---|
[3035] | 602 | span_paging.style.width="100%"; |
---|
[2] | 603 | span_paging.innerHTML=""; |
---|
| 604 | msg_range_begin = 1; |
---|
| 605 | msg_range_end = preferences.max_email_per_page; |
---|
| 606 | if(current_page != 1) { |
---|
| 607 | lnk_page = document.createElement("A"); |
---|
[5134] | 608 | //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+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){alternate_border(0); draw_box(data, get_current_folder());});"); |
---|
| 609 | lnk_page.setAttribute("href", "javascript:current_page=1; 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+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){alternate_border(0); draw_box(data, get_current_folder());});"); |
---|
[2] | 610 | } |
---|
| 611 | else { |
---|
| 612 | lnk_page = document.createElement("SPAN"); |
---|
| 613 | } |
---|
| 614 | span_paging.appendChild(lnk_page); |
---|
| 615 | |
---|
| 616 | lnk_page.innerHTML = "<<"; |
---|
| 617 | lnk_page.title = get_lang("First"); |
---|
| 618 | span_paging.innerHTML += " "; |
---|
[3369] | 619 | |
---|
[2] | 620 | if(current_page == lastPage + numPages) |
---|
[3369] | 621 | lastPage = current_page - 1; |
---|
| 622 | else if((lastPage != 1 && lastPage == current_page) || current_page == total_pages) |
---|
[2] | 623 | lastPage = current_page - (numPages - 1); |
---|
| 624 | else if(current_page == 1) |
---|
| 625 | lastPage = 1; |
---|
| 626 | |
---|
| 627 | if(lastPage < 1) |
---|
| 628 | lastPage = 1; |
---|
| 629 | else if(lastPage > 1 && (lastPage > (total_pages -(numPages - 1)))) |
---|
| 630 | lastPage = total_pages -(numPages - 1); |
---|
| 631 | |
---|
| 632 | var hasMarked = false; |
---|
| 633 | |
---|
| 634 | for(i = lastPage; i <= total_pages; i++) { |
---|
[3369] | 635 | |
---|
| 636 | if(current_page == i || (i == total_pages && !hasMarked)) { |
---|
[5285] | 637 | lnk_page = document.createElement("SPAN"); |
---|
[2] | 638 | span_paging.appendChild(lnk_page); |
---|
[5285] | 639 | lnk_page.style.color = "red"; |
---|
[2] | 640 | lnk_page.innerHTML = " <b>"+i+"</b> "; |
---|
| 641 | hasMarked = true; |
---|
| 642 | continue; |
---|
| 643 | } |
---|
[3369] | 644 | else{ |
---|
[2] | 645 | lnk_page = document.createElement("A"); |
---|
| 646 | span_paging.appendChild(lnk_page); |
---|
| 647 | msg_range_begin = ((i*preferences.max_email_per_page)-(preferences.max_email_per_page-1)); |
---|
| 648 | msg_range_end = (i*preferences.max_email_per_page); |
---|
[5134] | 649 | //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+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){alternate_border(0); draw_box(data, get_current_folder());});"); |
---|
| 650 | lnk_page.setAttribute("href", "javascript:current_page="+i+"; 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+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){alternate_border(0); draw_box(data, get_current_folder());});"); |
---|
[2] | 651 | } |
---|
| 652 | lnk_page.innerHTML = " ... "; |
---|
| 653 | if(i == (lastPage + numPages)) |
---|
[3035] | 654 | break; |
---|
| 655 | else if(lastPage == 1 || i != lastPage) |
---|
[2] | 656 | lnk_page.innerHTML = " "+i+" "; |
---|
[3369] | 657 | span_paging.innerHTML += " "; |
---|
[2] | 658 | } |
---|
[3035] | 659 | |
---|
[2] | 660 | if(current_page != total_pages) { |
---|
| 661 | lnk_page = document.createElement("A"); |
---|
| 662 | msg_range_begin = ((total_pages*preferences.max_email_per_page)-(preferences.max_email_per_page-1)); |
---|
[3369] | 663 | msg_range_end = (total_pages*preferences.max_email_per_page); |
---|
[5134] | 664 | //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+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){alternate_border(0); draw_box(data, get_current_folder());});"); |
---|
| 665 | lnk_page.setAttribute("href", "javascript:current_page="+total_pages+"; 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+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){alternate_border(0); draw_box(data, get_current_folder());});"); |
---|
[2] | 666 | } |
---|
| 667 | else { |
---|
| 668 | lnk_page = document.createElement("SPAN"); |
---|
| 669 | } |
---|
| 670 | span_paging.innerHTML += " "; |
---|
| 671 | span_paging.appendChild(lnk_page); |
---|
| 672 | |
---|
| 673 | lnk_page.title = get_lang("Last"); |
---|
| 674 | lnk_page.innerHTML = ">>"; |
---|
| 675 | } |
---|
| 676 | |
---|
[4062] | 677 | // stores the percentages of the cells |
---|
[5410] | 678 | //var colSizes = [ ["24","24","12","12","12","16","16","20%","58%","11%","11%"], ["16","16","12","12","12","20%","20%","*","10%","10%"] ]; |
---|
[5533] | 679 | //var colSizes = [ ["2%","2%","1%","1%","1%","1%","2%","2%","20%","46%","11%","11%"], ["16","16","12","12","12","20%","20%","*","10%","10%"] ]; |
---|
[5753] | 680 | var colSizes = [ ["3%","2%","1%","1%","1%","1%","2%","2%","2%","20%","45%","11%","11%"], ["2%","1%","1%","1%","1%","1%","1%","20%","20%","33%","10%","9%"] ]; |
---|
[4062] | 681 | // stores the alignments of the cells |
---|
| 682 | var colAligns = [ ['','','','','','','','left','left','center','center'], ['','','','','','left','left','left','center','center'] ]; |
---|
| 683 | var objCell = null; |
---|
| 684 | var adjCell = null; |
---|
| 685 | var cellClick = null; |
---|
| 686 | var cellResized = false; |
---|
| 687 | var maxWidth=0; |
---|
[4080] | 688 | var minWidth=0; |
---|
[4062] | 689 | var bodyWidth=0; |
---|
[4072] | 690 | var cssForResizing=false; |
---|
[2] | 691 | |
---|
[4062] | 692 | function changeCursorState(ev) { |
---|
| 693 | if (cellResized) |
---|
| 694 | cellResized = false; |
---|
| 695 | var el = ev.target||ev.srcElement; |
---|
| 696 | if (el.tagName != "TD") |
---|
| 697 | el=getFirstParentOfType(el, "TD") |
---|
| 698 | el.style.cursor ="hand"; |
---|
| 699 | el.style.cursor ="pointer"; |
---|
[4072] | 700 | if (!cssForResizing) |
---|
| 701 | return; |
---|
[4062] | 702 | var cellMouseX = (ev.clientX-parseInt(getColumnPosition(el, ev))); |
---|
| 703 | var cellWidth = el.offsetWidth; |
---|
| 704 | var tbl = getFirstParentOfType(el,"TABLE"); |
---|
| 705 | if (tbl.emptyBody) |
---|
| 706 | return; |
---|
[4461] | 707 | if ((((cellWidth-cellMouseX)<15)||((el.style.cursor=="col-resize")&&(detectLeftButton())))&&((el.className=="th_resizable")&&(el.cellIndex+1<el.parentNode.cells.length))){ |
---|
| 708 | if (tbl) tbl.style.cursor = "col-resize"; |
---|
| 709 | el.style.cursor ="col-resize"; |
---|
[4062] | 710 | } |
---|
| 711 | else{ |
---|
| 712 | if (tbl) tbl.style.cursor = "pointer"; |
---|
| 713 | el.style.cursor ="hand"; |
---|
| 714 | el.style.cursor ="pointer"; |
---|
| 715 | } |
---|
| 716 | } |
---|
| 717 | |
---|
[4493] | 718 | function getStyle(el,styleProp) { |
---|
[4072] | 719 | var x = document.getElementById(el); |
---|
| 720 | if (x.currentStyle) |
---|
| 721 | var y = x.currentStyle[styleProp]; |
---|
| 722 | else if (window.getComputedStyle) |
---|
| 723 | var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp); |
---|
| 724 | return y; |
---|
| 725 | } |
---|
| 726 | |
---|
[4062] | 727 | function resizeColumn(ev) { |
---|
| 728 | if (!objCell || !adjCell) { |
---|
| 729 | stopColResize(ev); |
---|
| 730 | return; |
---|
| 731 | } |
---|
| 732 | if (document.getElementById("table_message_header_box_"+numBox).emptyBody) |
---|
| 733 | return; |
---|
[4461] | 734 | if (objCell.style.cursor == "col-resize" && detectLeftButton(ev)) { |
---|
[4062] | 735 | var cellIndex = objCell.cellIndex; |
---|
| 736 | var adjIndex = adjCell.cellIndex; |
---|
[4080] | 737 | var cellOffset = parseInt(getColumnPosition(objCell, ev)); |
---|
| 738 | var cellWidth = (ev.clientX-cellOffset); |
---|
[4062] | 739 | |
---|
| 740 | var tbl = getMessagesTable(objCell); |
---|
| 741 | var trM = tbl.rows; |
---|
| 742 | var tblType = ( (tbl.id=="table_box") ? 0 : 1); |
---|
| 743 | |
---|
[4080] | 744 | if (cellWidth < minWidth) |
---|
| 745 | cellWidth = minWidth; |
---|
[4062] | 746 | var adjWidth = maxWidth - cellWidth; |
---|
[4080] | 747 | if (adjWidth < minWidth) { |
---|
| 748 | cellWidth = (cellWidth+adjWidth)-minWidth; |
---|
| 749 | adjWidth = minWidth; |
---|
[4062] | 750 | } |
---|
| 751 | |
---|
| 752 | colSizes[tblType][adjIndex] = (colSizes[tblType][adjIndex]=="*" ? "*" : getPct(is_ie ? adjWidth : adjWidth-2)); |
---|
| 753 | colSizes[tblType][cellIndex] = (colSizes[tblType][cellIndex]=="*" ? "*" : getPct(cellWidth)); |
---|
| 754 | |
---|
[4080] | 755 | document.getElementById("table_message_ruler").style.left = cellOffset+cellWidth; |
---|
[4062] | 756 | } |
---|
| 757 | ev.returnValue = false; |
---|
| 758 | return (false); |
---|
| 759 | } |
---|
| 760 | |
---|
| 761 | function getPct(tdWidth) { |
---|
| 762 | var suf = tdWidth.toString().substr(tdWidth.length-1,1); |
---|
| 763 | if ( suf != "%" && suf != "*") |
---|
| 764 | return (Math.round((tdWidth/bodyWidth)*10000)/100).toString()+"%"; |
---|
| 765 | else |
---|
| 766 | return tdWidth; |
---|
| 767 | } |
---|
| 768 | |
---|
| 769 | function detectLeftButton(ev) { |
---|
| 770 | ev = ev || window.event; |
---|
| 771 | var button = ev.which || ev.button; |
---|
| 772 | return (button == 1); |
---|
| 773 | } |
---|
| 774 | |
---|
| 775 | function startColResize(ev) { |
---|
| 776 | var el = ev.target||ev.srcElement; |
---|
| 777 | if (el.tagName != "TD") |
---|
| 778 | el=getFirstParentOfType(el, "TD") |
---|
| 779 | if (is_ie) |
---|
| 780 | ev.cancelBubble = true; |
---|
| 781 | else |
---|
| 782 | ev.stopPropagation(); |
---|
| 783 | if (!el) return; |
---|
| 784 | if (!is_ie) ev.preventDefault(); |
---|
| 785 | if (document.getElementById("table_message_header_box_"+numBox).emptyBody) |
---|
| 786 | return; |
---|
[4461] | 787 | if (el.style.cursor == "col-resize" && detectLeftButton(ev)) { |
---|
[4062] | 788 | var incIndex = ( (el.parentNode.cells.length > el.cellIndex + 1) ? 1 : -1 ); |
---|
| 789 | var msgTable = getMessagesTable(el); |
---|
| 790 | var bodyRows = msgTable.rows; |
---|
| 791 | objCell = el; |
---|
| 792 | adjCell = el.parentNode.cells[el.cellIndex+incIndex]; |
---|
| 793 | var tbl = getFirstParentOfType(el, "TABLE"); |
---|
| 794 | if (is_ie) { |
---|
| 795 | tbl.detachEvent("onmousemove",changeCursorState); |
---|
| 796 | document.attachEvent("onmousemove",resizeColumn); |
---|
| 797 | document.attachEvent("onmouseup",stopColResize); |
---|
| 798 | document.attachEvent("onselect",selectCancel); |
---|
| 799 | tbl.attachEvent("onselectstart",selectCancel); |
---|
| 800 | } |
---|
| 801 | else { |
---|
| 802 | tbl.removeEventListener("mousemove",changeCursorState,false); |
---|
| 803 | document.addEventListener("mousemove",resizeColumn,false); |
---|
| 804 | document.addEventListener("mouseup",stopColResize,false); |
---|
| 805 | document.addEventListener("select",selectCancel,false); |
---|
| 806 | tbl.addEventListener("selectstart",selectCancel,false); |
---|
| 807 | } |
---|
| 808 | cellClick = objCell.onclick; |
---|
| 809 | objCell.onclick = ""; |
---|
| 810 | maxWidth = objCell.offsetWidth+adjCell.offsetWidth; |
---|
| 811 | bodyWidth = msgTable.offsetWidth; |
---|
[4080] | 812 | minWidth = Math.round(bodyWidth/80); |
---|
[4062] | 813 | document.getElementById("table_message_ruler").style.display = "block"; |
---|
| 814 | document.getElementById("table_message_ruler").style.left = ev.clientX; |
---|
| 815 | if (document.getElementById("content_id_"+numBox)==null) |
---|
[4807] | 816 | document.getElementById("table_message_ruler").style.height = document.getElementById("content_id_"+currentTab).offsetHeight; |
---|
[4062] | 817 | else |
---|
| 818 | document.getElementById("table_message_ruler").style.height = document.getElementById("content_id_"+numBox).offsetHeight; |
---|
| 819 | } |
---|
| 820 | } |
---|
| 821 | |
---|
| 822 | function stopColResize(ev) { |
---|
| 823 | if (!objCell) |
---|
| 824 | return; |
---|
| 825 | if (is_ie) |
---|
| 826 | ev.cancelBubble = true; |
---|
| 827 | else |
---|
| 828 | ev.stopPropagation(); |
---|
| 829 | var tbl = getFirstParentOfType(objCell, "TABLE"); |
---|
| 830 | if (is_ie) { |
---|
| 831 | tbl.detachEvent("onselectstart",selectCancel); |
---|
| 832 | document.detachEvent("onselect",selectCancel); |
---|
| 833 | document.detachEvent("onmousemove",resizeColumn); |
---|
| 834 | document.detachEvent("onmouseup",stopColResize); |
---|
| 835 | tbl.attachEvent("onmousemove",changeCursorState); |
---|
| 836 | } |
---|
| 837 | else { |
---|
| 838 | tbl.removeEventListener("selectstart",selectCancel,false); |
---|
| 839 | document.removeEventListener("select",selectCancel,false); |
---|
| 840 | document.removeEventListener("mousemove",resizeColumn,false); |
---|
| 841 | document.removeEventListener("mouseup",stopColResize,false); |
---|
| 842 | tbl.addEventListener("mousemove",changeCursorState,false); |
---|
| 843 | } |
---|
| 844 | var trM = getMessagesTable(objCell).rows; |
---|
| 845 | var adjIndex = adjCell.cellIndex; |
---|
| 846 | document.getElementById("table_message_ruler").style.display = "none"; |
---|
| 847 | maxWidth = 0; |
---|
| 848 | objCell.onclick = cellClick; |
---|
| 849 | objCell = null; |
---|
| 850 | adjCell = null; |
---|
| 851 | cellResized = true; |
---|
[4072] | 852 | setColSizesCookie(); |
---|
| 853 | syncColumns(); |
---|
[4062] | 854 | } |
---|
| 855 | |
---|
| 856 | function getMessagesTable(el) { |
---|
| 857 | var hT; |
---|
| 858 | if (el.tagName == "TABLE") |
---|
| 859 | hT = el; |
---|
| 860 | else |
---|
| 861 | hT = getFirstParentOfType(el,"TABLE"); |
---|
[5134] | 862 | return (hT.parentNode.nextSibling.childNodes[0].className !== "local-messages-search-warning"? |
---|
| 863 | hT.parentNode.nextSibling.childNodes[0] : hT.parentNode.nextSibling.childNodes[1]); |
---|
[4062] | 864 | } |
---|
| 865 | |
---|
| 866 | function getColumnPosition(oNode, pNode){ |
---|
| 867 | if (!pNode && !is_webkit){ |
---|
| 868 | var pos = getOffset(oNode); |
---|
| 869 | return [pos.left, pos.top]; |
---|
| 870 | } |
---|
| 871 | pNode = pNode||document.body; |
---|
| 872 | |
---|
| 873 | var oCurrentNode = oNode; |
---|
| 874 | var iLeft = 0; |
---|
| 875 | var iTop = 0; |
---|
| 876 | |
---|
| 877 | while ((oCurrentNode)&&(oCurrentNode != pNode)){ |
---|
| 878 | iLeft+=oCurrentNode.offsetLeft-oCurrentNode.scrollLeft; |
---|
| 879 | iTop+=oCurrentNode.offsetTop-oCurrentNode.scrollTop; |
---|
| 880 | oCurrentNode=oCurrentNode.offsetParent; |
---|
| 881 | } |
---|
| 882 | |
---|
| 883 | return [iLeft, iTop]; |
---|
| 884 | } |
---|
| 885 | |
---|
| 886 | function getFirstParentOfType(obj, tag){ |
---|
| 887 | while (obj&&obj.tagName != tag&&obj.tagName != "BODY"){ |
---|
| 888 | obj=obj.parentNode; |
---|
| 889 | } |
---|
| 890 | return obj; |
---|
| 891 | } |
---|
| 892 | |
---|
| 893 | function syncColumns() { |
---|
| 894 | var thisCell; |
---|
| 895 | var tbl = (document.getElementById("content_id_"+numBox)==null ? 1 : 0); |
---|
| 896 | if (objCell) |
---|
| 897 | thisCell = objCell; |
---|
| 898 | else |
---|
| 899 | thisCell = document.getElementById("table_message_header_box_"+numBox).rows[0].cells[0]; |
---|
[4189] | 900 | var emptyBody = document.getElementById("table_message_header_box_"+numBox).emptyBody; |
---|
[4062] | 901 | var tbH = getFirstParentOfType(thisCell,"TABLE"); |
---|
| 902 | var tbM = getMessagesTable(thisCell); |
---|
| 903 | var trM = tbM.rows; |
---|
[4813] | 904 | var _mouse_over; |
---|
| 905 | var _mouse_out; |
---|
| 906 | var _cell; |
---|
[4062] | 907 | for (var r=0;r<trM.length;r++) { |
---|
| 908 | for (var c=0;c<trM[r].cells.length;c++) { |
---|
[4813] | 909 | _cell = trM[r].cells[c]; |
---|
| 910 | _cell.setAttribute("width",colSizes[tbl][c]); |
---|
[4062] | 911 | if (is_mozilla && !is_webkit) { |
---|
[4810] | 912 | if (!emptyBody) { |
---|
[6752] | 913 | document.getElementById("colgroup_main_"+numBox).childNodes[c].setAttribute("width",colSizes[tbl][c]); |
---|
[4810] | 914 | } |
---|
[6752] | 915 | document.getElementById("colgroup_head_"+numBox).childNodes[c].setAttribute("width",colSizes[tbl][c]); |
---|
[4810] | 916 | if (tbH.rows[0].cells[c].className=="th_resizable") { |
---|
[4813] | 917 | // lots of stupid fixes for FF to redraw cell content |
---|
[4814] | 918 | if (_cell.childNodes && _cell.childNodes.length>1) { |
---|
[4813] | 919 | _mouse_over = _cell.childNodes[1].onmouseover; |
---|
| 920 | _mouse_out = _cell.childNodes[1].onmouseout; |
---|
| 921 | } |
---|
| 922 | _cell.innerHTML = trM[r].cells[c].innerHTML; |
---|
[4814] | 923 | if (_cell.childNodes && _cell.childNodes.length>1) { |
---|
[4813] | 924 | _cell.childNodes[1].onmouseover = _mouse_over; |
---|
| 925 | _cell.childNodes[1].onmouseout = _mouse_out; |
---|
| 926 | } |
---|
| 927 | tbH.rows[0].cells[c].innerHTML = tbH.rows[0].cells[c].innerHTML; |
---|
| 928 | } |
---|
[4062] | 929 | } |
---|
[4080] | 930 | else { |
---|
[4813] | 931 | tbH.rows[0].cells[c].setAttribute("width",_cell.offsetWidth); |
---|
[6752] | 932 | } |
---|
[4062] | 933 | } |
---|
| 934 | } |
---|
[6232] | 935 | |
---|
[5280] | 936 | //bug do firefox ao redefinir os tamanhos das colunas |
---|
[6232] | 937 | if (is_mozilla && !is_webkit){ |
---|
| 938 | if(trM[r]) |
---|
| 939 | for (var c=0;c<trM[r].cells.length;c++) |
---|
| 940 | document.getElementById("colgroup_main_"+numBox).childNodes[c].setAttribute("width",colSizes[tbl][c]); |
---|
| 941 | |
---|
| 942 | } |
---|
[6549] | 943 | if (is_webkit || is_ie){ |
---|
| 944 | var arrHeader = $('.message_header td'); |
---|
| 945 | var arrBody = $('#tbody_box :first td'); |
---|
| 946 | for(i=0;i<arrHeader.length;i++){ |
---|
[6642] | 947 | if(arrBody[i] !== undefined && arrBody[i].width !== undefined) |
---|
[6549] | 948 | arrHeader[i].width = arrBody[i].width; |
---|
| 949 | } |
---|
| 950 | } |
---|
[4062] | 951 | } |
---|
| 952 | |
---|
| 953 | function resizeMailList() { |
---|
[4143] | 954 | if (document.getElementById("table_message_header_box_"+numBox)==null) |
---|
| 955 | return false; |
---|
[4062] | 956 | var innerWidth = (window.innerWidth?window.innerWidth:document.body.clientWidth); |
---|
| 957 | var scrollWidth = (innerWidth - 20 - getColumnPosition(Element("exmail_main_body"),"BODY")[0]); |
---|
| 958 | document.getElementById("table_message_header_box_"+numBox).style.width = (scrollWidth-2)+'px'; |
---|
| 959 | if (document.getElementById("table_resultsearch_"+numBox)==null) |
---|
| 960 | document.getElementById("table_box").style.width = scrollWidth+'px'; |
---|
| 961 | else |
---|
| 962 | document.getElementById("table_resultsearch_"+numBox).style.width = scrollWidth+'px'; |
---|
| 963 | syncColumns(); |
---|
[5725] | 964 | //Alinhamento das colunas data e tamanho na pesquisa |
---|
| 965 | if ( numBox > 0){ |
---|
| 966 | if (is_mozilla && !is_webkit){ |
---|
| 967 | $('#table_message_header_box_'+numBox).attr('style','width:99.5%'); |
---|
| 968 | } |
---|
| 969 | else if (is_webkit){ |
---|
| 970 | $('#table_message_header_box_'+numBox).removeAttr('style'); |
---|
| 971 | $('#table_message_header_box_'+numBox).css('table-layout','auto'); |
---|
| 972 | } |
---|
| 973 | else{ |
---|
| 974 | $('#table_message_header_box_'+numBox).css('table-layout','auto'); |
---|
| 975 | } |
---|
| 976 | } |
---|
| 977 | $('#table_resultsearch_'+numBox).removeAttr('style'); |
---|
[4062] | 978 | } |
---|
| 979 | |
---|
| 980 | function selectCancel(ev) { |
---|
| 981 | return (false); |
---|
| 982 | } |
---|
| 983 | |
---|
| 984 | function buildColGroup(tbl) { |
---|
| 985 | var col_element; |
---|
| 986 | var colgr_element = document.createElement("COLGROUP"); |
---|
| 987 | if (tbl==null) tbl = 0; |
---|
| 988 | for (i=0;i<colSizes[tbl].length;i++) { |
---|
| 989 | col_element = document.createElement("COL"); |
---|
| 990 | col_element.setAttribute("align", colAligns[tbl][i]); |
---|
| 991 | colgr_element.appendChild(col_element); |
---|
| 992 | } |
---|
| 993 | return (colgr_element); |
---|
| 994 | } |
---|
| 995 | |
---|
| 996 | function createTDElement(table_list,col_index,class_name,td_align,td_id) { |
---|
| 997 | var td_element = document.createElement("TD"); |
---|
| 998 | td_element.setAttribute("width",colSizes[table_list][col_index]); |
---|
| 999 | if (class_name) td_element.className = class_name; |
---|
| 1000 | if (td_align) td_element.align = td_align; |
---|
| 1001 | if (td_id) td_element.id = td_id; |
---|
| 1002 | return (td_element); |
---|
| 1003 | } |
---|
| 1004 | |
---|
[4072] | 1005 | function prepareColSizesArray() { |
---|
| 1006 | var colSizesCookie = getColSizesCookie(); |
---|
| 1007 | if (colSizesCookie) { |
---|
| 1008 | try { |
---|
| 1009 | var colSizesA = colSizesCookie.split(":"); |
---|
| 1010 | colSizes = [colSizesA[0].split(","),colSizesA[1].split(",")]; |
---|
| 1011 | } |
---|
| 1012 | catch(e) {} |
---|
| 1013 | } |
---|
| 1014 | } |
---|
[4493] | 1015 | |
---|
[4072] | 1016 | function setColSizesCookie() { |
---|
| 1017 | var str = "maillist_colsizes=" + colSizes[0].join() + ":" + colSizes[1].join(); |
---|
| 1018 | var date = new Date(); |
---|
| 1019 | date.setTime(date.getTime()+(365*24*60*60*1000)); |
---|
| 1020 | str += ("; expires="+date.toGMTString()); |
---|
| 1021 | document.cookie = str; |
---|
| 1022 | } |
---|
[4493] | 1023 | |
---|
[4072] | 1024 | function getColSizesCookie() { |
---|
| 1025 | var search = "maillist_colsizes="; |
---|
| 1026 | if (document.cookie.length > 0) { |
---|
| 1027 | var offset = document.cookie.indexOf(search); |
---|
| 1028 | if (offset != -1) { |
---|
| 1029 | offset += search.length; |
---|
| 1030 | var end = document.cookie.indexOf(";", offset); |
---|
| 1031 | if (end == -1) |
---|
| 1032 | end = document.cookie.length; |
---|
| 1033 | return document.cookie.substring(offset, end); |
---|
| 1034 | } |
---|
| 1035 | } |
---|
| 1036 | return null; |
---|
| 1037 | } |
---|
| 1038 | |
---|
[6762] | 1039 | |
---|
| 1040 | /*Cria a div que permite a seleção de todas as mensagens*/ |
---|
| 1041 | function drawSelectMsgsTable(){ |
---|
| 1042 | var div = $('<div>'); |
---|
| 1043 | div.attr('class','select-all-messages'); |
---|
| 1044 | $('#content_id_'+currentTab).first().prepend(div); |
---|
[6769] | 1045 | div.css('display','none'); |
---|
[6762] | 1046 | } |
---|
| 1047 | |
---|
| 1048 | /*Atualiza o array de mensagens selecionadas*/ |
---|
| 1049 | function updateSelectedMsgs(selected,msg_number){ |
---|
| 1050 | var folder = get_current_folder().split(cyrus_delimiter); |
---|
| 1051 | folder = folder.indexOf('INBOX') != -1 ? get_lang(folder[folder.length - 1]) : folder ; |
---|
| 1052 | var div = $('.select-all-messages'); |
---|
| 1053 | var totalSelected = function(){ |
---|
| 1054 | var total = 0; |
---|
| 1055 | for(var obj in selectedMessages) |
---|
| 1056 | if (selectedMessages[obj] == true) |
---|
| 1057 | total++; |
---|
| 1058 | return total; |
---|
| 1059 | }; |
---|
| 1060 | /*Seleciona as mensagens ao navegar pelas páginas*/ |
---|
| 1061 | if (allMsgsSelected && msg_number == undefined){ |
---|
| 1062 | $('.checkbox').each(function(){ |
---|
| 1063 | $(this).attr('checked', true); |
---|
| 1064 | $(this).parent().parent().addClass('selected_msg'); |
---|
| 1065 | }); |
---|
| 1066 | } |
---|
| 1067 | else if (msg_number == undefined){ |
---|
| 1068 | for(var obj in selectedMessages){ |
---|
| 1069 | if (selectedMessages[obj] == true){ |
---|
| 1070 | $('#check_box_message_'+obj).attr('checked', true); |
---|
| 1071 | $('#check_box_message_'+obj).parent().parent().addClass('selected_msg'); |
---|
| 1072 | } |
---|
| 1073 | } |
---|
| 1074 | } |
---|
| 1075 | if (selected && msg_number != undefined){ |
---|
| 1076 | selectedMessages[msg_number] = true; |
---|
| 1077 | $(this).parent().parent().addClass('selected_msg'); |
---|
| 1078 | } |
---|
| 1079 | else if(!selected && msg_number != undefined){ |
---|
| 1080 | selectedMessages[msg_number] = false; |
---|
| 1081 | $(this).parent().parent().removeClass('selected_msg'); |
---|
| 1082 | allMsgsSelected = false; |
---|
| 1083 | } |
---|
| 1084 | |
---|
| 1085 | /*Mensagens selecionadas uma a uma via checkbox |
---|
| 1086 | if (selected){ |
---|
| 1087 | selectedMessages[msg_number] = true; |
---|
| 1088 | } |
---|
| 1089 | else{ |
---|
| 1090 | selectedMessages[msg_number] = false; |
---|
| 1091 | $('#check_box_message_'+msg_number).attr('checked', false); |
---|
| 1092 | $('#check_box_message_'+msg_number).parent().parent().removeClass('selected_msg'); |
---|
| 1093 | $('#check_box_message_'+msg_number).parent().parent().removeClass('selected_shortcut_msg'); |
---|
| 1094 | allMsgsSelected = false; |
---|
| 1095 | |
---|
| 1096 | } */ |
---|
| 1097 | /*Se foram selecionadas algumas mensagens*/ |
---|
| 1098 | if (totalSelected() > 0 && !allMsgsSelected){ |
---|
| 1099 | var link = "<a class='select-link'>Limpar seleção?</a>"; |
---|
| 1100 | var info = "Foram selecionadas "+totalSelected()+" mensagens em "+folder+". "+link; |
---|
| 1101 | div.html("<span>"+info+"<span>"); |
---|
| 1102 | div.show(); |
---|
[6769] | 1103 | $('.select-link').bind('click',function(){ |
---|
| 1104 | selectAllFolderMsgs(); |
---|
| 1105 | $('.select-link').unbind('click'); |
---|
| 1106 | }); |
---|
[6762] | 1107 | } |
---|
| 1108 | else if (allMsgsSelected){ |
---|
| 1109 | var link = "<a class='select-link'>Limpar seleção?</a>"; |
---|
| 1110 | var info = "Todas as "+$('#tot_m').text()+" mensagens em "+folder+" foram selecionadas. "+link; |
---|
| 1111 | div.html("<span>"+info+"<span>"); |
---|
| 1112 | div.show(); |
---|
[6769] | 1113 | $('.select-link').bind('click',function(){ |
---|
| 1114 | selectAllFolderMsgs(); |
---|
| 1115 | $('.select-link').unbind('click'); |
---|
| 1116 | }); |
---|
[6762] | 1117 | } |
---|
[6769] | 1118 | resizeWindow(); |
---|
[6762] | 1119 | } |
---|
| 1120 | |
---|
| 1121 | /*Seleciona ou desseleciona todas as mensagens da pasta*/ |
---|
| 1122 | function selectAllFolderMsgs(select){ |
---|
| 1123 | var folder = get_current_folder().split(cyrus_delimiter); |
---|
| 1124 | folder = folder.indexOf('INBOX') != -1 ? get_lang(folder[folder.length - 1]) : folder ; |
---|
| 1125 | var div = $('.select-all-messages'); |
---|
| 1126 | if (select){ |
---|
| 1127 | allMsgsSelected = true; |
---|
| 1128 | var link = "<a class='select-link'>Limpar seleção?</a>"; |
---|
| 1129 | var info = "Todas as "+$('#tot_m').text()+" mensagens em "+folder+" foram selecionadas. "+link; |
---|
| 1130 | div.html("<span>"+info+"<span>"); |
---|
| 1131 | div.show(); |
---|
[6769] | 1132 | $('.select-link').bind('click',function(){ |
---|
| 1133 | selectAllFolderMsgs(); |
---|
| 1134 | $('.select-link').unbind('click'); |
---|
| 1135 | }); |
---|
[6762] | 1136 | for(var obj in selectedMessages){ |
---|
| 1137 | selectedMessages[obj] = true; |
---|
| 1138 | } |
---|
| 1139 | |
---|
| 1140 | }else{ |
---|
| 1141 | allMsgsSelected = false; |
---|
| 1142 | for(var obj in selectedMessages){ |
---|
[6769] | 1143 | $("#content_id_0").find('input[type="checkbox"]').removeAttr("checked"); |
---|
[6762] | 1144 | selectedMessages[obj] = false; |
---|
| 1145 | } |
---|
| 1146 | div.hide(); |
---|
| 1147 | } |
---|
[6769] | 1148 | resizeWindow(); |
---|
[6762] | 1149 | } |
---|
| 1150 | /*Carrega o array de mensagens da pasta*/ |
---|
| 1151 | function populateSelectedMsgs(data){ |
---|
| 1152 | for(obj in selectedMessages){ |
---|
| 1153 | delete selectedMessages[obj]; |
---|
| 1154 | } |
---|
| 1155 | $.each(data, function(index, value){ |
---|
| 1156 | if(value != undefined){ |
---|
| 1157 | selectedMessages[value] = false; |
---|
| 1158 | } |
---|
| 1159 | }); |
---|
| 1160 | delete selectedMessages[undefined]; |
---|
| 1161 | } |
---|
| 1162 | |
---|
| 1163 | |
---|
[2] | 1164 | // Draw the inbox and another folders |
---|
[320] | 1165 | function draw_box(headers_msgs, msg_folder, alternate){ |
---|
[5533] | 1166 | /* |
---|
[4087] | 1167 | * When the paging response is not in the correct folder you need to change folder |
---|
| 1168 | * This occurs when the Ajax response is not fast enough and the user click in outher |
---|
| 1169 | * folder before finishing the Ajax request |
---|
| 1170 | */ |
---|
| 1171 | if (msg_folder != headers_msgs['folder']) { |
---|
| 1172 | |
---|
| 1173 | if (headers_msgs['folder']) { |
---|
| 1174 | array_folder = headers_msgs['folder'].split('/'); |
---|
| 1175 | |
---|
| 1176 | if (array_folder.length > 1) { |
---|
| 1177 | name_folder = array_folder[1]; |
---|
| 1178 | } |
---|
| 1179 | else { |
---|
| 1180 | name_folder = headers_msgs['folder']; |
---|
| 1181 | } |
---|
| 1182 | current_folder = headers_msgs['folder']; |
---|
| 1183 | Element("border_id_0").innerHTML = " " + lang_folder(name_folder) + ' <font face="Verdana" size="1" color="#505050">[<span id="new_m"> </span> / <span id="tot_m"></span>]</font>'; |
---|
| 1184 | |
---|
| 1185 | Element('new_m').innerHTML = headers_msgs['tot_unseen'] ? '<font color="RED">'+headers_msgs['tot_unseen']+'</font>' : 0; |
---|
| 1186 | Element("tot_m").innerHTML = headers_msgs['num_msgs']; |
---|
| 1187 | |
---|
| 1188 | tree_folders.getNodeById(headers_msgs['folder'])._select(); |
---|
| 1189 | } |
---|
| 1190 | } |
---|
[5533] | 1191 | /** |
---|
| 1192 | * Preenche a estrutura de cache de mensagens para posterior consulta de |
---|
| 1193 | * informações sobre as mensagens no escopo global. |
---|
| 1194 | */ |
---|
| 1195 | for (var i=0; i<headers_msgs.length; i++) { |
---|
| 1196 | if (!onceOpenedHeadersMessages[current_folder]) |
---|
| 1197 | onceOpenedHeadersMessages[current_folder] = {}; |
---|
| 1198 | onceOpenedHeadersMessages[current_folder][headers_msgs[i].msg_number] = headers_msgs[i]; |
---|
| 1199 | } |
---|
| 1200 | |
---|
[320] | 1201 | if (alternate) |
---|
| 1202 | kill_current_box(); |
---|
[3035] | 1203 | |
---|
[2] | 1204 | if(is_ie) |
---|
| 1205 | document.getElementById("border_table").width = "99.5%"; |
---|
| 1206 | |
---|
[5134] | 1207 | numBox = 0; //As pastas sempre estarão na aba 0 |
---|
| 1208 | |
---|
[3035] | 1209 | openTab.content_id[numBox] = document.getElementById("content_id_"+numBox); |
---|
[3178] | 1210 | openTab.content_id[numBox].innerHTML = ""; |
---|
[607] | 1211 | openTab.imapBox[numBox] = msg_folder; |
---|
[790] | 1212 | openTab.type[numBox] = 0; |
---|
[3035] | 1213 | |
---|
[320] | 1214 | table_message_header_box = document.getElementById("table_message_header_box_"+numBox); |
---|
[4072] | 1215 | if (table_message_header_box == null) { |
---|
[2] | 1216 | var table_element = document.createElement("TABLE"); |
---|
[4062] | 1217 | var colgr_element = buildColGroup(); |
---|
| 1218 | colgr_element.setAttribute("id","colgroup_head_"+numBox); |
---|
[2] | 1219 | var tbody_element = document.createElement("TBODY"); |
---|
[4062] | 1220 | //add events for column resizing |
---|
| 1221 | if (is_ie) { |
---|
| 1222 | table_element.attachEvent("onmousemove",changeCursorState); |
---|
| 1223 | table_element.attachEvent("onmousedown",startColResize); |
---|
| 1224 | } |
---|
| 1225 | else { |
---|
| 1226 | table_element.addEventListener("mousemove",changeCursorState,false); |
---|
| 1227 | table_element.addEventListener("mousedown",startColResize,false); |
---|
| 1228 | } |
---|
[320] | 1229 | table_element.setAttribute("id", "table_message_header_box_"+numBox); |
---|
[2] | 1230 | table_element.className = "table_message_header_box"; |
---|
[4062] | 1231 | if (!is_ie) |
---|
| 1232 | table_element.style.width = "98.8%"; |
---|
| 1233 | //if table is empty |
---|
| 1234 | table_element.emptyBody = false; |
---|
[3035] | 1235 | |
---|
[2] | 1236 | tr_element = document.createElement("TR"); |
---|
| 1237 | tr_element.className = "message_header"; |
---|
[4062] | 1238 | |
---|
| 1239 | td_element1 = createTDElement(0,0); |
---|
[2] | 1240 | chk_box_element = document.createElement("INPUT"); |
---|
| 1241 | chk_box_element.id = "chk_box_select_all_messages"; |
---|
| 1242 | chk_box_element.setAttribute("type", "checkbox"); |
---|
| 1243 | chk_box_element.className = "checkbox"; |
---|
| 1244 | chk_box_element.onclick = function(){select_all_messages(this.checked);}; |
---|
[6762] | 1245 | chk_box_element.onmouseover = function () {this.title=get_lang('Select all messages from this page.'); }; |
---|
[2] | 1246 | chk_box_element.onkeydown = function (e){ |
---|
| 1247 | if (is_ie) |
---|
| 1248 | { |
---|
| 1249 | if ((window.event.keyCode) == 46) |
---|
[689] | 1250 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1251 | } |
---|
| 1252 | else |
---|
| 1253 | { |
---|
| 1254 | if ((e.keyCode) == 46) |
---|
[689] | 1255 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1256 | } |
---|
| 1257 | }; |
---|
[3035] | 1258 | |
---|
[2] | 1259 | td_element1.appendChild(chk_box_element); |
---|
[3035] | 1260 | |
---|
[4062] | 1261 | td_element2 = createTDElement(0,1); |
---|
[5533] | 1262 | td_element3 = createTDElement(0,8,"th_resizable","left","message_header_SORTFROM_"+numBox); |
---|
[51] | 1263 | td_element3.onclick = function () {sort_box(search_box_type,'SORTFROM');}; |
---|
[4771] | 1264 | td_element3.innerHTML = get_lang("From"); |
---|
[3035] | 1265 | |
---|
[5533] | 1266 | td_element4 = createTDElement(0,9,"th_resizable","left","message_header_SORTSUBJECT_"+numBox); |
---|
[51] | 1267 | td_element4.onclick = function () {sort_box(search_box_type,'SORTSUBJECT');}; |
---|
[2] | 1268 | td_element4.innerHTML = get_lang("Subject"); |
---|
[3035] | 1269 | |
---|
[5533] | 1270 | td_element5 = createTDElement(0,10,"th_resizable","center","message_header_SORTARRIVAL_"+numBox); |
---|
[51] | 1271 | td_element5.onclick = function () {sort_box(search_box_type,'SORTARRIVAL');}; |
---|
[2] | 1272 | td_element5.innerHTML = get_lang("Date"); |
---|
[4062] | 1273 | |
---|
[6542] | 1274 | td_element6 = createTDElement(0,11,"th_resizable","center","message_header_SORTSIZE_"+numBox); |
---|
[51] | 1275 | td_element6.onclick = function () {sort_box(search_box_type,'SORTSIZE');} |
---|
[2] | 1276 | td_element6.innerHTML = get_lang("Size"); |
---|
[3035] | 1277 | |
---|
[2] | 1278 | tr_element.appendChild(td_element1); |
---|
[3035] | 1279 | tr_element.appendChild(td_element2); |
---|
[4062] | 1280 | |
---|
| 1281 | var td_element21 = createTDElement(0,2); |
---|
| 1282 | td_element21.innerHTML = " "; |
---|
| 1283 | |
---|
| 1284 | var td_element22 = createTDElement(0,3); |
---|
| 1285 | td_element22.innerHTML = " "; |
---|
| 1286 | |
---|
| 1287 | var td_element23 = createTDElement(0,4); |
---|
| 1288 | td_element23.innerHTML = " "; |
---|
| 1289 | |
---|
| 1290 | var td_element24 = createTDElement(0,5); |
---|
| 1291 | td_element24.innerHTML = " "; |
---|
[5533] | 1292 | |
---|
| 1293 | |
---|
| 1294 | var td_element25 = createTDElement(0,7); |
---|
[4062] | 1295 | td_element25.innerHTML = " "; |
---|
[5533] | 1296 | |
---|
| 1297 | var td_element27 = createTDElement(0,8); |
---|
| 1298 | td_element25.innerHTML = " "; |
---|
| 1299 | |
---|
| 1300 | var td_element26 = createTDElement(0,6); |
---|
| 1301 | td_element26.innerHTML = " "; |
---|
| 1302 | |
---|
[4062] | 1303 | |
---|
[998] | 1304 | tr_element.appendChild(td_element21); |
---|
| 1305 | tr_element.appendChild(td_element22); |
---|
| 1306 | tr_element.appendChild(td_element23); |
---|
[4062] | 1307 | tr_element.appendChild(td_element24); |
---|
[5533] | 1308 | tr_element.appendChild(td_element26); |
---|
| 1309 | tr_element.appendChild(td_element27); |
---|
[4062] | 1310 | tr_element.appendChild(td_element25); |
---|
[5533] | 1311 | |
---|
[2] | 1312 | tr_element.appendChild(td_element3); |
---|
| 1313 | tr_element.appendChild(td_element4); |
---|
| 1314 | tr_element.appendChild(td_element5); |
---|
| 1315 | tr_element.appendChild(td_element6); |
---|
[4062] | 1316 | |
---|
[2] | 1317 | tbody_element.appendChild(tr_element); |
---|
| 1318 | table_element.appendChild(tbody_element); |
---|
[4062] | 1319 | table_element.appendChild(colgr_element); |
---|
| 1320 | |
---|
| 1321 | var _divScroll = document.getElementById("divScrollHead_"+numBox); |
---|
| 1322 | |
---|
| 1323 | if(!_divScroll){ |
---|
| 1324 | _divScroll = document.createElement("DIV"); |
---|
| 1325 | _divScroll.id = "divScrollHead_"+numBox; |
---|
[4072] | 1326 | } |
---|
[4062] | 1327 | |
---|
| 1328 | _divScroll.style.overflowY = "hidden"; |
---|
| 1329 | _divScroll.style.overflowX = "hidden"; |
---|
| 1330 | _divScroll.style.width ="100%"; |
---|
| 1331 | |
---|
| 1332 | if (is_mozilla){ |
---|
| 1333 | _divScroll.style.width ="99.3%"; |
---|
| 1334 | } |
---|
| 1335 | |
---|
| 1336 | _divScroll.appendChild(table_element); |
---|
| 1337 | openTab.content_id[numBox].appendChild(_divScroll); |
---|
| 1338 | |
---|
[4109] | 1339 | var table_layout = (getStyle("table_message_header_box_"+numBox,"table-layout") || getStyle("table_message_header_box_"+numBox,"tableLayout")); |
---|
[4072] | 1340 | cssForResizing = (table_layout=="fixed"); |
---|
| 1341 | if (cssForResizing) |
---|
| 1342 | prepareColSizesArray(); |
---|
[4062] | 1343 | } |
---|
[2] | 1344 | draw_header_box(); |
---|
| 1345 | var table_element = document.createElement("TABLE"); |
---|
[4062] | 1346 | var colgr_element = buildColGroup(); |
---|
| 1347 | colgr_element.setAttribute("id","colgroup_main_"+numBox); |
---|
| 1348 | |
---|
[3035] | 1349 | var tbody_element = document.createElement("TBODY"); |
---|
[2] | 1350 | table_element.id = "table_box"; |
---|
| 1351 | table_element.className = "table_box"; |
---|
| 1352 | table_element.borderColorDark = "#bbbbbb"; |
---|
| 1353 | table_element.frame = "void"; |
---|
| 1354 | table_element.rules = "rows"; |
---|
| 1355 | table_element.cellPadding = "0"; |
---|
| 1356 | table_element.cellSpacing = "0"; |
---|
[3035] | 1357 | |
---|
[2] | 1358 | table_element.onkeydown = function (e){ |
---|
| 1359 | if (is_ie) |
---|
| 1360 | { |
---|
| 1361 | if ((window.event.keyCode) == 46) |
---|
| 1362 | { |
---|
| 1363 | //delete_all_selected_msgs_imap(); |
---|
[689] | 1364 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1365 | } |
---|
| 1366 | } |
---|
| 1367 | else |
---|
| 1368 | { |
---|
| 1369 | if ((e.keyCode) == 46) |
---|
| 1370 | { |
---|
| 1371 | //delete_all_selected_msgs_imap(); |
---|
[689] | 1372 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1373 | } |
---|
| 1374 | } |
---|
| 1375 | }; |
---|
| 1376 | if (is_ie) |
---|
| 1377 | table_element.style.cursor = "hand"; |
---|
[3035] | 1378 | |
---|
[2] | 1379 | tbody_element.setAttribute("id", "tbody_box"); |
---|
| 1380 | table_element.appendChild(tbody_element); |
---|
[4062] | 1381 | table_element.appendChild(colgr_element); |
---|
[3035] | 1382 | |
---|
[320] | 1383 | var _divScroll = document.getElementById("divScrollMain_"+numBox); |
---|
| 1384 | |
---|
[3035] | 1385 | if(!_divScroll){ |
---|
[2] | 1386 | _divScroll = document.createElement("DIV"); |
---|
[320] | 1387 | _divScroll.id = "divScrollMain_"+numBox; |
---|
[2] | 1388 | } |
---|
[3035] | 1389 | |
---|
[4062] | 1390 | _divScroll.style.overflowY = "scroll"; |
---|
[790] | 1391 | _divScroll.style.overflowX = "hidden"; |
---|
| 1392 | _divScroll.style.width ="100%"; |
---|
[3035] | 1393 | |
---|
[790] | 1394 | if (is_mozilla){ |
---|
[2] | 1395 | _divScroll.style.overflow = "-moz-scrollbars-vertical"; |
---|
[4062] | 1396 | _divScroll.style.width ="100%"; |
---|
[2] | 1397 | } |
---|
| 1398 | _divScroll.appendChild(table_element); |
---|
[607] | 1399 | openTab.content_id[numBox].appendChild(_divScroll); |
---|
[6762] | 1400 | |
---|
[2] | 1401 | var f_unseen = 0; |
---|
[139] | 1402 | |
---|
[4062] | 1403 | document.getElementById("table_message_header_box_"+numBox).emptyBody = false; |
---|
[6762] | 1404 | |
---|
[4189] | 1405 | if (headers_msgs.num_msgs == 0) |
---|
| 1406 | showEmptyBoxMsg(tbody_element); |
---|
| 1407 | |
---|
[2] | 1408 | for (var i=0; i < headers_msgs.length; i++){ |
---|
| 1409 | if ((headers_msgs[i].Unseen == 'U') || (headers_msgs[i].Recent == 'N')) |
---|
[3035] | 1410 | f_unseen++; |
---|
[3493] | 1411 | tr_element = make_tr_message(headers_msgs[i], msg_folder, headers_msgs.offsetToGMT); |
---|
[976] | 1412 | if (tr_element){ |
---|
[790] | 1413 | tbody_element.appendChild(tr_element); |
---|
[3035] | 1414 | add_className(tr_element, i%2 != 0 ? 'tr_msg_read2' : 'tr_msg_read'); |
---|
[976] | 1415 | } |
---|
[5486] | 1416 | //_dragArea.makeDragged(tr_element, headers_msgs[i].msg_number, headers_msgs[i].subject, true); |
---|
| 1417 | $(tr_element).draggable({ |
---|
[5499] | 1418 | start : function(){ |
---|
| 1419 | if($(".shared-folders").length){ |
---|
| 1420 | $(".shared-folders").parent().find('.folder:not(".shared-folders")').droppable({ |
---|
| 1421 | over : function(a, b){ |
---|
| 1422 | //SETA BORDA EM VOLTA DA PASTA |
---|
[5765] | 1423 | over = $(this); |
---|
| 1424 | $(this).addClass("folder-over"); |
---|
| 1425 | if(($(this)[0] != $(this).parent().find(".head_folder")[0])) |
---|
| 1426 | if($(this).prev()[0]) |
---|
| 1427 | if($(this).parent().find(".expandable-hitarea")[0] == $(this).prev()[0]){ |
---|
| 1428 | setTimeout(function(){ |
---|
| 1429 | if(over.hasClass("folder-over")) |
---|
| 1430 | over.prev().trigger("click"); |
---|
| 1431 | }, 500); |
---|
| 1432 | |
---|
| 1433 | } |
---|
[5499] | 1434 | }, |
---|
| 1435 | out : function(){ |
---|
| 1436 | //RETIRA BORDA EM VOLTA DA PASTA |
---|
[5765] | 1437 | $(this).removeClass("folder-over"); |
---|
[5499] | 1438 | }, |
---|
| 1439 | //accept: ".draggin_mail", |
---|
| 1440 | drop : function(event, ui){ |
---|
| 1441 | $(this).css("border", ""); |
---|
| 1442 | if($(this).parent().attr('id') == undefined){ |
---|
| 1443 | var folder_to = 'INBOX'; |
---|
| 1444 | var to_folder_title = get_lang("Inbox"); |
---|
| 1445 | }else{ |
---|
| 1446 | var folder_to = $(this).parent().attr('id'); |
---|
| 1447 | var to_folder_title = $(this).attr('title'); |
---|
| 1448 | } |
---|
| 1449 | var folder_to_move = ui.draggable.parent().attr('id'); |
---|
| 1450 | var border_id = ui.draggable.find("input[type=hidden]").attr("name"); |
---|
| 1451 | // Mensagens : SE O DROP VIER DA LISTA DE MENSAGENS : |
---|
| 1452 | if(folder_to_move == "tbody_box"){ |
---|
| 1453 | move_msgs2(get_current_folder(), 'selected', 0, folder_to, to_folder_title,true); |
---|
| 1454 | return refresh(); |
---|
| 1455 | } |
---|
| 1456 | } |
---|
| 1457 | }); |
---|
| 1458 | } |
---|
| 1459 | }, |
---|
| 1460 | stop :function(){ |
---|
| 1461 | $(".shared-folders").parent().find(".folder").droppable("destroy"); |
---|
| 1462 | }, |
---|
[5754] | 1463 | //helper: 'clone', |
---|
| 1464 | helper: function(event){ |
---|
[5533] | 1465 | $(this).find("input:checkbox").attr("checked", true); |
---|
[6223] | 1466 | if ( $("#tbody_box .selected_shortcut_msg").length > 1) { |
---|
| 1467 | $("#tbody_box .selected_shortcut_msg").find('.checkbox').attr('checked',true); |
---|
| 1468 | } |
---|
| 1469 | if($("#table_box").find("tr input:checked").length > 1 ) |
---|
| 1470 | return $("<tr><td>"+DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : (($("#table_box").find("tr input:checked")).length+" mensagens selecionadas"), type: "messages"})+"</td></tr>"); |
---|
[5486] | 1471 | if( $(this).find(".td_msg_subject").text().length > 18 ) |
---|
[5754] | 1472 | return $("<tr><td>"+DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : $(this).find(".td_msg_subject").text().substring(0,18) + "...", type: "messages"})+"</td></tr>"); |
---|
[5486] | 1473 | else |
---|
[5754] | 1474 | return $("<tr><td>"+DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : $(this).find(".td_msg_subject").text(), type: "messages"})+"</td></tr>"); |
---|
| 1475 | }, |
---|
| 1476 | iframeFix: true, |
---|
| 1477 | delay: 150, |
---|
[6265] | 1478 | cursorAt: {top: 5, left: 56}, |
---|
[5754] | 1479 | refreshPositions: true, |
---|
[5486] | 1480 | containment: "#divAppbox" |
---|
[5718] | 1481 | }).bind('contextmenu',function(event){ |
---|
[5841] | 1482 | if (!(($(event.target).find('img').length > 0) && ($(event.target).hasClass('td-label')))){ |
---|
| 1483 | if($(this).find("input:checkbox").attr("checked") != "checked"){ |
---|
| 1484 | $(this).find("input:checkbox").trigger('click'); |
---|
| 1485 | $(this).addClass("selected_msg"); |
---|
| 1486 | } |
---|
[5718] | 1487 | } |
---|
[5486] | 1488 | }); |
---|
[2] | 1489 | } |
---|
[3035] | 1490 | |
---|
[128] | 1491 | if ((preferences.use_shortcuts == '1') && (headers_msgs[0])) |
---|
[320] | 1492 | select_msg(headers_msgs[0].msg_number, 'null', true); |
---|
[5302] | 1493 | |
---|
[6762] | 1494 | |
---|
[2] | 1495 | var tdFolders = Element("folderscol"); |
---|
| 1496 | tdFolders.style.display = preferences.hide_folders == '1' ? "none" : ""; |
---|
[790] | 1497 | if ( !currentTab ) |
---|
| 1498 | alternate_border(numBox); |
---|
[3035] | 1499 | draw_footer_box(headers_msgs.num_msgs); |
---|
[2] | 1500 | Element('main_table').style.display = ''; |
---|
[3035] | 1501 | if(is_ie6) // Stupid Fixing on IE6. |
---|
| 1502 | setTimeout("resizeWindow()",1); |
---|
| 1503 | else |
---|
| 1504 | resizeWindow(); |
---|
[2] | 1505 | if(debug) { |
---|
| 1506 | var _eTime = new Date(); |
---|
| 1507 | _eTime = _eTime.getTime(); |
---|
| 1508 | alert("Carregou em "+(_eTime - _bTime)+" ms"); |
---|
| 1509 | } |
---|
[5533] | 1510 | |
---|
[2] | 1511 | var msg_folder = Element('msg_folder').value; |
---|
[3035] | 1512 | var msg_number = Element('msg_number').value; |
---|
[2] | 1513 | if(!msg_folder && msg_number) { |
---|
| 1514 | new_message('new','null'); |
---|
| 1515 | } |
---|
| 1516 | else if(msg_folder && msg_number){ |
---|
[6275] | 1517 | $.ajax({ |
---|
| 1518 | url: 'controller.php?' + $.param( {action: '$this.imap_functions.get_info_msg', |
---|
| 1519 | msg_number: msg_number, |
---|
| 1520 | msg_folder: msg_folder, |
---|
| 1521 | decoded: true } ), |
---|
| 1522 | success: function( data ){ |
---|
| 1523 | data = connector.unserialize( data ); |
---|
| 1524 | |
---|
| 1525 | if( data ) |
---|
| 1526 | show_msg( data ); |
---|
[6469] | 1527 | }, |
---|
| 1528 | beforeSend: function( jqXHR, settings ){ |
---|
| 1529 | connector.showProgressBar(); |
---|
| 1530 | }, |
---|
| 1531 | complete: function( jqXHR, settings ){ |
---|
| 1532 | connector.hideProgressBar(); |
---|
[6275] | 1533 | } |
---|
| 1534 | |
---|
| 1535 | }); |
---|
[2] | 1536 | Element('msg_folder').value = ''; |
---|
| 1537 | Element('msg_number').value = ''; |
---|
| 1538 | } |
---|
[3068] | 1539 | var scripts = new Array("InfoContact", |
---|
[3220] | 1540 | "TreeShow"); |
---|
[3068] | 1541 | connector.loadAllScripts(scripts); |
---|
[3369] | 1542 | // Loading Quota View Folder Component (if exists...) |
---|
[3157] | 1543 | if(Element("table_quota")) |
---|
[3158] | 1544 | connector.loadScript("InfoQuota"); |
---|
[5533] | 1545 | |
---|
[4062] | 1546 | // creates the dotted ruler which helps user to visualize resizing of columns |
---|
| 1547 | var ruler_element = document.getElementById("table_message_ruler"); |
---|
| 1548 | if (ruler_element == null) { |
---|
| 1549 | ruler_element = document.createElement("DIV"); |
---|
| 1550 | ruler_element.setAttribute("id", "table_message_ruler"); |
---|
| 1551 | ruler_element.className = "table_message_ruler"; |
---|
| 1552 | ruler_element.style.top = getColumnPosition(document.getElementById("content_id_0"),"BODY")[1]; |
---|
| 1553 | document.getElementById("exmail_main_body").appendChild(ruler_element); |
---|
| 1554 | } |
---|
[6762] | 1555 | drawSelectMsgsTable(); |
---|
| 1556 | updateSelectedMsgs(); |
---|
[6769] | 1557 | resizeWindow(); |
---|
[2] | 1558 | } |
---|
[790] | 1559 | |
---|
[4189] | 1560 | function showEmptyBoxMsg(tbody_element) { |
---|
| 1561 | document.getElementById("table_message_header_box_"+numBox).emptyBody = true; |
---|
[4752] | 1562 | var div_pasta = document.getElementById("div_msg_info"); |
---|
[4934] | 1563 | if (!div_pasta){ |
---|
[4752] | 1564 | div_info = document.createElement("div"); |
---|
| 1565 | div_info.setAttribute("id", "div_msg_info"); |
---|
| 1566 | div_info.setAttribute("background", "#FFF"); |
---|
| 1567 | h3_info = document.createElement("h3"); |
---|
| 1568 | h3_info.style.padding = "10px"; |
---|
| 1569 | h3_info.setAttribute("id", "msg_info"); |
---|
| 1570 | h3_info.align = "center"; |
---|
| 1571 | h3_info.innerHTML = get_lang("This mail box is empty"); |
---|
| 1572 | div_info.appendChild(h3_info); |
---|
| 1573 | tbody_element.parentNode.parentNode.appendChild(div_info); |
---|
| 1574 | } |
---|
[4189] | 1575 | } |
---|
| 1576 | |
---|
[6109] | 1577 | function html_entities(string) { |
---|
[6213] | 1578 | return String(string).replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); |
---|
[6109] | 1579 | } |
---|
| 1580 | |
---|
[3493] | 1581 | // Passar o parâmetro offset para esta função |
---|
| 1582 | function make_tr_message(headers_msgs, msg_folder, offsetToGMT){ |
---|
[6109] | 1583 | headers_msgs.subject = html_entities(headers_msgs.subject); |
---|
[5533] | 1584 | if (typeof offsetToGMT == 'undefined') |
---|
| 1585 | { |
---|
| 1586 | // In older local messages headers_msgs.offsetToGMT is undefined. |
---|
| 1587 | offsetToGMT = typeof headers_msgs.offsetToGMT != 'undefined'?headers_msgs.offsetToGMT:0; |
---|
| 1588 | } |
---|
[320] | 1589 | var tr_element = document.createElement('tr'); |
---|
[3069] | 1590 | if(typeof(preferences.line_height) != 'undefined') |
---|
| 1591 | tr_element.style.height = preferences.line_height; |
---|
[2] | 1592 | tr_element.id = headers_msgs.msg_number; |
---|
[163] | 1593 | |
---|
[1752] | 1594 | tr_element.msg_sample = ""; |
---|
| 1595 | //if(headers_msgs.msg_sample && headers_msgs.msg_sample.preview_msg_subject != "") |
---|
[5134] | 1596 | if(headers_msgs.msg_sample && preferences.preview_msg_subject == "1" && headers_msgs.msg_sample.body !== "") |
---|
[1752] | 1597 | { |
---|
[4820] | 1598 | if (cssForResizing) //Colunas redimensionaveis - nao trunca |
---|
[5134] | 1599 | tr_element.msg_sample = Base64.decode(headers_msgs.msg_sample.body).substr(0,180) + "..."; //trecho do body que sera exibido com o assunto; |
---|
[4820] | 1600 | else |
---|
[5134] | 1601 | tr_element.msg_sample = Base64.decode(headers_msgs.msg_sample.body).substr(0,120) + "..."; //trecho do body que sera exibido com o assunto; |
---|
[1752] | 1602 | } |
---|
| 1603 | |
---|
| 1604 | tr_element.tip = ""; |
---|
[5134] | 1605 | if(headers_msgs.msg_sample && preferences.preview_msg_tip == "1" && headers_msgs.msg_sample.body !== "") |
---|
[1752] | 1606 | { |
---|
[5134] | 1607 | tr_element.tip = Base64.decode(headers_msgs.msg_sample.body).substr(3,300) + "..."; //trecho do body que sera exibido no tool-tip; |
---|
[1752] | 1608 | } |
---|
| 1609 | |
---|
[614] | 1610 | if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')){ |
---|
[4839] | 1611 | if ((headers_msgs.Flagged == 'F') || headers_msgs.Importance.toLowerCase().indexOf("high")!=-1 ) |
---|
[614] | 1612 | add_className(tr_element, 'flagged_msg'); |
---|
[163] | 1613 | add_className(tr_element, 'tr_msg_unread'); |
---|
[614] | 1614 | } |
---|
| 1615 | else{ |
---|
[5134] | 1616 | if ((headers_msgs.Flagged == 'F') || ( headers_msgs.Importance !== undefined && headers_msgs.Importance.toLowerCase().indexOf("high")!=-1 ) ) |
---|
[614] | 1617 | add_className(tr_element,'flagged_msg'); |
---|
| 1618 | } |
---|
[2] | 1619 | |
---|
[790] | 1620 | if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')) |
---|
| 1621 | add_className(tr_element, 'tr_msg_unread'); |
---|
[3035] | 1622 | |
---|
[790] | 1623 | if (headers_msgs.Flagged == 'F') |
---|
| 1624 | add_className(tr_element,'flagged_msg'); |
---|
| 1625 | |
---|
[4062] | 1626 | td_element1 = createTDElement(0,0,"td_msg"); |
---|
[2] | 1627 | chk_box_element = document.createElement("INPUT"); |
---|
| 1628 | chk_box_element.setAttribute("type", "checkbox"); |
---|
| 1629 | chk_box_element.className = "checkbox"; |
---|
| 1630 | chk_box_element.setAttribute("id", "check_box_message_"+headers_msgs.msg_number); |
---|
[6153] | 1631 | |
---|
| 1632 | $(chk_box_element).click(function(e){ |
---|
[6762] | 1633 | updateSelectedMsgs($(this).is(':checked'),headers_msgs.msg_number); |
---|
[2] | 1634 | changeBgColor(e,headers_msgs.msg_number); |
---|
[6153] | 1635 | }); |
---|
| 1636 | |
---|
[2] | 1637 | td_element1.appendChild(chk_box_element); |
---|
[3035] | 1638 | |
---|
[4062] | 1639 | td_element2 = createTDElement(0,1,"td_msg"); |
---|
[5359] | 1640 | if (headers_msgs.attachment == 1) |
---|
| 1641 | td_element2.innerHTML = "<img src ='templates/"+template+"/images/clip.gif' >"; |
---|
[3035] | 1642 | |
---|
[4062] | 1643 | td_element21 = createTDElement(0,2,"td_msg",null,"td_message_answered_"+headers_msgs.msg_number); |
---|
[2] | 1644 | |
---|
| 1645 | if ((headers_msgs.Forwarded == 'F') || (headers_msgs.Draft == 'X' && headers_msgs.Answered == 'A')){ |
---|
[3993] | 1646 | td_element21.onclick=function(){search_emails(headers_msgs.subject.replace(/^(re: ?|fw: ?|enc: ?|res: ?|fwd: ?)*/gi,''),true);}; |
---|
[6528] | 1647 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/forwarded.png' title='"+get_lang('Forwarded')+"'>"; |
---|
[3035] | 1648 | headers_msgs.Draft = '' |
---|
[2] | 1649 | headers_msgs.Answered = ''; |
---|
[1035] | 1650 | headers_msgs.Forwarded = 'F'; |
---|
[2] | 1651 | } |
---|
| 1652 | else if (headers_msgs.Draft == 'X') |
---|
[6528] | 1653 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/draft.png' title='"+get_lang('Draft')+"'>"; |
---|
[3993] | 1654 | else if (headers_msgs.Answered == 'A'){ |
---|
| 1655 | td_element21.onclick=function(){search_emails(headers_msgs.subject.replace(/^(re: ?|fw: ?|enc: ?|res: ?|fwd: ?)*/gi,''),true);}; |
---|
[6528] | 1656 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/answered.png' title='"+get_lang('Answered')+"'>"; |
---|
[3993] | 1657 | }else |
---|
[998] | 1658 | td_element21.innerHTML = " "; |
---|
[2] | 1659 | |
---|
[4062] | 1660 | td_element22 = createTDElement(0,1,"td_msg",null,"td_message_signed_"+headers_msgs.msg_number); |
---|
[3035] | 1661 | switch(headers_msgs.ContentType) |
---|
[1035] | 1662 | { |
---|
[3035] | 1663 | case "signature": |
---|
[1035] | 1664 | { |
---|
| 1665 | td_element22.innerHTML = "<img src ='templates/"+template+"/images/signed_msg.gif' title='" + get_lang('Signed message') + "'>"; |
---|
| 1666 | break; |
---|
| 1667 | } |
---|
[3035] | 1668 | case "cipher": |
---|
[1035] | 1669 | { |
---|
| 1670 | td_element22.innerHTML = "<img src ='templates/"+template+"/images/lock.gif' title='" + get_lang('Crypted message') + "'>"; |
---|
| 1671 | break; |
---|
| 1672 | } |
---|
[3035] | 1673 | default: |
---|
[1035] | 1674 | { |
---|
| 1675 | break; |
---|
| 1676 | } |
---|
| 1677 | } |
---|
| 1678 | |
---|
[4062] | 1679 | td_element23 = createTDElement(0,4,"td_msg",null,"td_message_important_"+headers_msgs.msg_number); |
---|
[1035] | 1680 | |
---|
[5134] | 1681 | if ( (headers_msgs.Flagged == 'F') || ( headers_msgs.Importance !== undefined && headers_msgs.Importance.toLowerCase().indexOf("high") != -1 )) |
---|
[790] | 1682 | { |
---|
[5569] | 1683 | td_element23.innerHTML = "<img src ='templates/"+template+"/images/important.png' title='"+get_lang('Important')+"'>"; |
---|
[790] | 1684 | } |
---|
[2] | 1685 | else |
---|
[1035] | 1686 | td_element23.innerHTML = " "; |
---|
[790] | 1687 | |
---|
[4062] | 1688 | td_element24 = createTDElement(0,5,"td_msg",null,"td_message_sent_"+headers_msgs.msg_number); |
---|
[1035] | 1689 | td_element24.innerHTML = " "; |
---|
[2] | 1690 | // preload image |
---|
| 1691 | var _img_sent = new Image(); |
---|
[790] | 1692 | _img_sent.src = "templates/"+template+"/images/sent.gif"; |
---|
[2] | 1693 | |
---|
[3018] | 1694 | |
---|
| 1695 | |
---|
[5533] | 1696 | td_element25 = createTDElement(0,7,"td_msg",null,"td_message_unseen_"+headers_msgs.msg_number); |
---|
[3035] | 1697 | if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')) |
---|
| 1698 | td_element25.innerHTML = "<img src ='templates/"+template+"/images/unseen.gif' title='"+get_lang('Unseen')+"'>"; |
---|
| 1699 | else |
---|
| 1700 | td_element25.innerHTML = "<img src ='templates/"+template+"/images/seen.gif' title='"+get_lang('Seen')+"'>"; |
---|
[3018] | 1701 | |
---|
| 1702 | |
---|
[5533] | 1703 | td_element3 = createTDElement(0,8,"td_msg td_resizable","left","td_from_"+ headers_msgs.msg_number); |
---|
[689] | 1704 | var _onclick = function(){InfoContact.hide();proxy_mensagens.get_msg(headers_msgs.msg_number, msg_folder,true, show_msg);}; |
---|
[2] | 1705 | td_element3.onclick = _onclick; |
---|
| 1706 | td_element3.innerHTML = ' '; |
---|
[3035] | 1707 | |
---|
[3245] | 1708 | test = true; |
---|
[5211] | 1709 | if(msg_folder.indexOf(special_folders['Sent']) !=-1 ||msg_folder.indexOf(preferences.save_in_folder) !=-1 || msg_folder.replace("local_","INBOX"+cyrus_delimiter).indexOf(preferences.save_in_folder) !=-1) |
---|
[3245] | 1710 | test = false; |
---|
[5240] | 1711 | |
---|
| 1712 | if( (msg_folder.indexOf(special_folders['Sent']) !=-1) && (headers_msgs.from != undefined) && headers_msgs.from.email.toLowerCase() == Element("user_email").value.toLowerCase() && (preferences.from_to_sent == "1") && !(msg_folder.substr(0,5) == "user/")) |
---|
[3035] | 1713 | { |
---|
[6211] | 1714 | td_element3.onmouseover = function () { |
---|
| 1715 | var title_to = ''; |
---|
| 1716 | $.each(headers_msgs.to, function(index, value) { |
---|
| 1717 | if(index == (headers_msgs.to.length - 1)){ |
---|
| 1718 | title_to = title_to + value.email; |
---|
| 1719 | } |
---|
| 1720 | else { |
---|
| 1721 | title_to = title_to + value.email + ', '; |
---|
| 1722 | } |
---|
| 1723 | }); |
---|
| 1724 | this.title = title_to; |
---|
| 1725 | }; |
---|
[5790] | 1726 | |
---|
[2] | 1727 | if (headers_msgs.Draft == 'X') |
---|
| 1728 | td_element3.innerHTML += "<span style=\"color:red\">("+get_lang("Draft")+") </span>"; |
---|
[3035] | 1729 | else{ |
---|
[6211] | 1730 | if(headers_msgs.to[0].email != null && headers_msgs.to[0].email.toLowerCase() != Element("user_email").value) |
---|
[6123] | 1731 | td_element24.innerHTML = "<img align='center' src ='templates/"+template+"/images/sent.gif' title='"+get_lang('Sent')+"'>"; |
---|
[4072] | 1732 | |
---|
[3831] | 1733 | if (headers_msgs.to) { |
---|
[6211] | 1734 | if (headers_msgs.to[0].name != null) |
---|
| 1735 | td_element3.innerHTML += headers_msgs.to[0].name; |
---|
| 1736 | else if(headers_msgs.to[0].email != null) { |
---|
| 1737 | td_element3.innerHTML += headers_msgs.to[0].email; |
---|
[3831] | 1738 | } |
---|
| 1739 | else { |
---|
| 1740 | td_element3.innerHTML += get_lang("without destination"); |
---|
| 1741 | } |
---|
[2] | 1742 | } |
---|
| 1743 | } |
---|
| 1744 | } |
---|
| 1745 | else{ |
---|
| 1746 | if (headers_msgs.Draft == 'X'){ |
---|
| 1747 | td_element3.innerHTML = "<span style=\"color:red\">("+get_lang("Draft")+") </span>"; |
---|
| 1748 | } |
---|
[3035] | 1749 | else{ |
---|
[1247] | 1750 | var spanSender = document.createElement("SPAN"); |
---|
[6138] | 1751 | spanSender.setAttribute('class','span-sender'); |
---|
[6265] | 1752 | spanSender.onmouseover = function (event) {/*this.style.textDecoration = "underline";*/try {InfoContact.begin(this,headers_msgs.reply_toaddress)} catch(e){};}; |
---|
| 1753 | spanSender.onmouseout = function (){try {/*this.style.textDecoration = "none";*/clearTimeout(InfoContact.timeout);} catch(e){}}; |
---|
[5158] | 1754 | folder = special_folders['Sent']; |
---|
| 1755 | current = get_current_folder(); |
---|
| 1756 | if ((preferences.from_to_sent == "1") && (current.substr(current.length - folder.length, folder.length) == folder)){ |
---|
[6218] | 1757 | spanSender.onmouseover = function () { |
---|
| 1758 | var title_to = ''; |
---|
| 1759 | $.each(headers_msgs.to, function(index, value) { |
---|
| 1760 | if(index == (headers_msgs.to.length - 1)){ |
---|
| 1761 | title_to = title_to + value.email; |
---|
| 1762 | } |
---|
| 1763 | else { |
---|
| 1764 | title_to = title_to + value.email + ', '; |
---|
| 1765 | } |
---|
| 1766 | }); |
---|
| 1767 | this.title = title_to; |
---|
| 1768 | }; |
---|
[5158] | 1769 | if (headers_msgs.to) { |
---|
[6218] | 1770 | if (headers_msgs.to[0].name != null){ |
---|
| 1771 | spanSender.innerHTML += headers_msgs.to[0].name; |
---|
| 1772 | }else if(headers_msgs.to[0].email != null) { |
---|
| 1773 | spanSender.innerHTML += headers_msgs.to[0].email; |
---|
[5158] | 1774 | } |
---|
| 1775 | } |
---|
| 1776 | }else if(headers_msgs.from !== undefined){ |
---|
[1247] | 1777 | spanSender.innerHTML = headers_msgs.from.name != null ? headers_msgs.from.name : headers_msgs.from.email; |
---|
[5158] | 1778 | } |
---|
[1247] | 1779 | if (spanSender.innerHTML.indexOf(" ") == '-1' && spanSender.innerHTML.length > 25){ |
---|
| 1780 | spanSender.innerHTML = spanSender.innerHTML.substring(0,25) + "..."; |
---|
| 1781 | } |
---|
| 1782 | else if (spanSender.innerHTML.length > 40 ){ |
---|
| 1783 | spanSender.innerHTML = spanSender.innerHTML.substring(0,40) + "..."; |
---|
[3035] | 1784 | } |
---|
| 1785 | td_element3.appendChild(spanSender); |
---|
[2] | 1786 | } |
---|
[3035] | 1787 | } |
---|
[4062] | 1788 | |
---|
[5533] | 1789 | td_element4 = createTDElement(0,9,"td_msg td_resizable","left"); |
---|
[5486] | 1790 | td_element4.className += " td_msg_subject"; |
---|
[2] | 1791 | td_element4.onclick = _onclick; |
---|
[1752] | 1792 | td_element4.innerHTML = !is_ie ? "<a nowrap id='a_message_"+tr_element.id+"'> " : " "; |
---|
[3035] | 1793 | |
---|
[2] | 1794 | if ((headers_msgs.subject)&&(headers_msgs.subject.length > 50)) |
---|
[1752] | 1795 | { |
---|
[4820] | 1796 | if (cssForResizing) |
---|
| 1797 | //Colunas redimensionaveis - nao trunca |
---|
| 1798 | td_element4.innerHTML += headers_msgs.subject + "<span style=\"color:#b3b3b3;\"> " + tr_element.msg_sample +"</span>"; |
---|
| 1799 | else { |
---|
| 1800 | //Modificacao para evitar que o truncamento do assunto quebre uma NCR - #1189 |
---|
| 1801 | pos = headers_msgs.subject.indexOf("&",45); |
---|
| 1802 | if ((pos > 0) && (pos <= 50) && ((headers_msgs.subject.charAt(pos+5) == ";") || (headers_msgs.subject.charAt(pos+6) == ";"))) |
---|
| 1803 | td_element4.innerHTML += headers_msgs.subject.substring(0,pos+6) + "..." + "<span style=\"color:#b3b3b3;\"> " + tr_element.msg_sample +"</span>"; |
---|
| 1804 | else |
---|
| 1805 | td_element4.innerHTML += headers_msgs.subject.substring(0,50) + "..." + "<span style=\"color:#b3b3b3;\"> " + tr_element.msg_sample +"</span>";//modificacao feita para exibir o trecho do body ao lado do assunto da mensagem; |
---|
| 1806 | } |
---|
[1752] | 1807 | } |
---|
[2] | 1808 | else |
---|
[1752] | 1809 | { |
---|
| 1810 | td_element4.innerHTML += headers_msgs.subject + "<span style=\"color:#b3b3b3;\"> " + tr_element.msg_sample + "</span>";//modificacao feita para exibir o trecho do body ao lado do assunto da mensagem; |
---|
| 1811 | } |
---|
[3035] | 1812 | |
---|
[1752] | 1813 | td_element4.title=tr_element.tip; |
---|
[2] | 1814 | if(!is_ie){ |
---|
| 1815 | td_element4.innerHTML += "</a>"; |
---|
| 1816 | } |
---|
[5533] | 1817 | |
---|
| 1818 | td_element5 = createTDElement(0,10,"td_msg td_resizable","center"); |
---|
| 1819 | td_element5.onclick = _onclick; |
---|
| 1820 | |
---|
| 1821 | td_element27 = createTDElement(0,7,"td_msg",null,"td_message_labels_"+headers_msgs.msg_number); |
---|
| 1822 | $(td_element27).addClass("td-label"); |
---|
[2] | 1823 | |
---|
[5533] | 1824 | if (headers_msgs.labels) { |
---|
| 1825 | td_element27.innerHTML = '<img src="../prototype/modules/mail/img/tag.png">'; |
---|
[5586] | 1826 | updateLabelsColumn(headers_msgs); |
---|
[5533] | 1827 | } |
---|
| 1828 | |
---|
[6123] | 1829 | td_element26 = createTDElement(0,6,"td_msg","center","td_message_followup_"+headers_msgs.msg_number); |
---|
[5533] | 1830 | $(td_element26).addClass("td-followup-flag"); |
---|
[5717] | 1831 | td_element26.innerHTML = '<div class="flag-edited" style="width:8px;height:6px;"><img src="../prototype/modules/mail/img/flagEditor.png"></div>'; |
---|
[5533] | 1832 | |
---|
| 1833 | if (headers_msgs.followupflagged) { |
---|
[5738] | 1834 | if(headers_msgs.followupflagged.followupflag.id < 7){ |
---|
| 1835 | var nameFollowupflag = get_lang(headers_msgs.followupflagged.followupflag.name); |
---|
| 1836 | }else{ |
---|
| 1837 | var nameFollowupflag = headers_msgs.followupflagged.followupflag.name; |
---|
| 1838 | } |
---|
| 1839 | $(td_element26).attr('title', nameFollowupflag) |
---|
[5533] | 1840 | .find(".flag-edited").css("background",headers_msgs.followupflagged.backgroundColor); |
---|
| 1841 | if(headers_msgs.followupflagged.isDone == "1"){ |
---|
| 1842 | $(td_element26).find(".flag-edited").find("img") |
---|
| 1843 | .attr("src", "../prototype/modules/mail/img/flagChecked.png") |
---|
| 1844 | .css("margin-left","-3px"); |
---|
| 1845 | } |
---|
| 1846 | } else { |
---|
| 1847 | $(td_element26).find(".flag-edited").css("background","#cccccc"); |
---|
| 1848 | } |
---|
| 1849 | |
---|
| 1850 | /** |
---|
| 1851 | * Clique para aplicar sinalizador |
---|
| 1852 | */ |
---|
| 1853 | $(td_element26).click(function() { |
---|
| 1854 | var messageClickedId = $(this).attr('id').match(/td_message_followup_([\d]+)/)[1]; |
---|
[5861] | 1855 | |
---|
[5882] | 1856 | var followupColor = $('#td_message_followup_' + messageClickedId).find(".flag-edited").css('backgroundColor'); |
---|
| 1857 | |
---|
[5861] | 1858 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1859 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
[5867] | 1860 | .html('<img alt="Carregando" title="Carregando" style="margin-left:-3px; margin-top:-4px; width:13px; height:13px;" src="../prototype/modules/mail/img/ajax-loader.gif" />'); |
---|
| 1861 | |
---|
| 1862 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1863 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "transparent"); |
---|
[5882] | 1864 | |
---|
| 1865 | |
---|
[5867] | 1866 | /** |
---|
[5533] | 1867 | * Hack: |
---|
| 1868 | * headers_msgs.followupflagged.id não vai funcionar porque já foi feito DataLayer.commit() |
---|
| 1869 | * por isso o id deve ser obtido do banco |
---|
| 1870 | * também para verificar se há ou não sinalizador nesta mensagem |
---|
| 1871 | */ |
---|
[5605] | 1872 | |
---|
| 1873 | DataLayer.remove('followupflagged', false); |
---|
[5533] | 1874 | var flagged = DataLayer.get('followupflagged', {filter: [ |
---|
| 1875 | 'AND', |
---|
| 1876 | ['=', 'messageNumber', messageClickedId], |
---|
| 1877 | ['=', 'folderName', msg_folder] |
---|
| 1878 | ]}); |
---|
[5540] | 1879 | |
---|
| 1880 | if (!flagged) { |
---|
[5533] | 1881 | /** |
---|
| 1882 | * Aplica followupflag de Acompanhamento |
---|
| 1883 | */ |
---|
| 1884 | headers_msgs.followupflagged = { |
---|
| 1885 | uid : User.me.id, |
---|
| 1886 | folderName : msg_folder, |
---|
| 1887 | messageNumber : messageClickedId, |
---|
| 1888 | alarmTime : false, |
---|
| 1889 | backgroundColor : '#FF2016', |
---|
[6152] | 1890 | followupflagId: '1' |
---|
[5533] | 1891 | }; |
---|
| 1892 | headers_msgs.followupflagged.id = DataLayer.put('followupflagged', headers_msgs.followupflagged); |
---|
[6047] | 1893 | DataLayer.commit(false, false, function(data){ |
---|
[6384] | 1894 | var fail = 'success'; |
---|
[6047] | 1895 | $.each(data, function(index, value) { |
---|
[6384] | 1896 | if(typeof value === 'string'){ |
---|
| 1897 | fail = value; |
---|
[6047] | 1898 | } |
---|
| 1899 | }); |
---|
| 1900 | |
---|
[5861] | 1901 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1902 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1903 | .html('<img src="../prototype/modules/mail/img/flagEditor.png">'); |
---|
[6384] | 1904 | |
---|
[6641] | 1905 | |
---|
| 1906 | if(fail != 'success'){ |
---|
| 1907 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1908 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "#CCCCCC"); |
---|
| 1909 | MsgsCallbackFollowupflag[fail](); |
---|
| 1910 | }else{ |
---|
| 1911 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1912 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).attr('title', get_lang('Follow up')).find(".flag-edited").css("background", headers_msgs.followupflagged.backgroundColor); |
---|
| 1913 | updateCacheFollowupflag(messageClickedId, msg_folder, true); |
---|
| 1914 | } |
---|
[5625] | 1915 | }); |
---|
[5533] | 1916 | |
---|
[6463] | 1917 | |
---|
[5625] | 1918 | } else if (onceOpenedHeadersMessages[msg_folder][messageClickedId]['followupflagged'].followupflag.name == 'Follow up') { |
---|
[5533] | 1919 | /** |
---|
[5540] | 1920 | * Remove followupflag de Acompanhamento |
---|
[5533] | 1921 | */ |
---|
| 1922 | $(this).find(".flag-edited").css("background", "#cccccc"); |
---|
[5708] | 1923 | DataLayer.remove('followupflagged', flagged[0].id ); |
---|
[5649] | 1924 | DataLayer.commit(false, false, function(){ |
---|
| 1925 | updateCacheFollowupflag(messageClickedId, msg_folder, false); |
---|
| 1926 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
[5861] | 1927 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1928 | .html('<img src="../prototype/modules/mail/img/flagEditor.png">'); |
---|
| 1929 | |
---|
| 1930 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
[5929] | 1931 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).attr('title', '').find(".flag-edited").css("background", '#CCC'); |
---|
[5861] | 1932 | |
---|
[5649] | 1933 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1934 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1935 | .find("img").attr("src", "../prototype/modules/mail/img/flagEditor.png").css("margin-left","0"); |
---|
| 1936 | }); |
---|
| 1937 | |
---|
[5533] | 1938 | } else { |
---|
[5882] | 1939 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1940 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1941 | .html('<img src="../prototype/modules/mail/img/flagEditor.png">'); |
---|
| 1942 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1943 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", followupColor); |
---|
[5533] | 1944 | $(tr_element).addClass('selected_msg').find(':checkbox').trigger('click'); |
---|
| 1945 | configureFollowupflag(); |
---|
| 1946 | } |
---|
| 1947 | |
---|
[5540] | 1948 | |
---|
[5533] | 1949 | }); |
---|
| 1950 | |
---|
[3057] | 1951 | var norm = function (arg) {return (arg < 10 ? '0'+arg : arg);}; |
---|
| 1952 | var weekDays = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; |
---|
[3493] | 1953 | |
---|
| 1954 | var today = new Date(); |
---|
[3927] | 1955 | today.setHours(23); |
---|
| 1956 | today.setMinutes(59); |
---|
| 1957 | today.setSeconds(59); |
---|
| 1958 | today.setMilliseconds(999) |
---|
[3493] | 1959 | |
---|
[3512] | 1960 | var udate_local = null; |
---|
| 1961 | var date_msg = null; |
---|
[3493] | 1962 | |
---|
[3512] | 1963 | // old local messages can capture headers_msgs.udate as "hh:mm" or "dd/mm/yyyy" |
---|
[5134] | 1964 | if ( (headers_msgs.udate !== undefined) && (headers_msgs.udate.toString().match(/\d{2}:\d{2}/) || headers_msgs.udate.toString().match(/\d{2}\/\d{2}\/\d{4}/)) ) |
---|
[3512] | 1965 | { |
---|
| 1966 | temp_msg_day = headers_msgs.msg_day.split('/'); |
---|
| 1967 | temp_msg_hour = headers_msgs.msg_hour.split(':'); |
---|
| 1968 | date_msg = new Date(temp_msg_day[2], temp_msg_day[1]-1, temp_msg_day[0], temp_msg_hour[0], temp_msg_hour[1]); |
---|
| 1969 | } |
---|
| 1970 | else |
---|
| 1971 | { |
---|
| 1972 | // The new date implementation |
---|
| 1973 | // Using offset between user defined timezone and GMT |
---|
| 1974 | // Date object converts time to local timezone, so we have to adjust it |
---|
| 1975 | udate_local = headers_msgs.udate*1000 + offsetToGMT*1000 + today.getTimezoneOffset()*60*1000; |
---|
| 1976 | date_msg = new Date(udate_local); |
---|
| 1977 | } |
---|
| 1978 | |
---|
[5808] | 1979 | if (preferences.show_date_numerical == 0 || typeof(preferences.show_date_numerical) == 'undefined') { |
---|
| 1980 | if (today.getTime() - date_msg.getTime() < 86400000) |
---|
| 1981 | td_element5.innerHTML = norm(date_msg.getHours()) + ':' + norm(date_msg.getMinutes()); |
---|
[3057] | 1982 | else |
---|
[5808] | 1983 | if (today.getTime() - date_msg.getTime() < 172800000) |
---|
| 1984 | td_element5.innerHTML = get_lang('Yesterday'); |
---|
| 1985 | else if (today.getTime() - date_msg.getTime() < 259200000) |
---|
[3057] | 1986 | td_element5.innerHTML = get_lang(weekDays[date_msg.getDay()]); |
---|
[5808] | 1987 | else{ |
---|
| 1988 | td_element5.innerHTML = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 1989 | td_element5.title = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 1990 | td_element5.alt = td_element5.title; |
---|
| 1991 | } |
---|
| 1992 | }else{ |
---|
| 1993 | td_element5.innerHTML = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 1994 | td_element5.title = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 1995 | td_element5.alt = td_element5.title; |
---|
| 1996 | } |
---|
[5533] | 1997 | td_element6 = createTDElement(0,11,"td_msg td_resizable","center"); |
---|
[2] | 1998 | td_element6.onclick = _onclick; |
---|
| 1999 | td_element6.setAttribute("noWrap","true"); |
---|
[3028] | 2000 | td_element6.innerHTML = borkb(headers_msgs.Size); |
---|
| 2001 | |
---|
[2] | 2002 | tr_element.appendChild(td_element1); |
---|
| 2003 | tr_element.appendChild(td_element2); |
---|
| 2004 | tr_element.appendChild(td_element21); |
---|
| 2005 | tr_element.appendChild(td_element22); |
---|
| 2006 | tr_element.appendChild(td_element23); |
---|
[5533] | 2007 | tr_element.appendChild(td_element24); |
---|
| 2008 | tr_element.appendChild(td_element26); |
---|
| 2009 | tr_element.appendChild(td_element27); |
---|
[3035] | 2010 | tr_element.appendChild(td_element25); |
---|
[5533] | 2011 | |
---|
[2] | 2012 | tr_element.appendChild(td_element3); |
---|
| 2013 | tr_element.appendChild(td_element4); |
---|
| 2014 | tr_element.appendChild(td_element5); |
---|
| 2015 | tr_element.appendChild(td_element6); |
---|
| 2016 | return tr_element; |
---|
| 2017 | } |
---|
| 2018 | |
---|
[51] | 2019 | function sort_box(search, sort){ |
---|
[4062] | 2020 | if (cellResized) |
---|
| 2021 | return; |
---|
[51] | 2022 | var message_header = Element("message_header_"+search); |
---|
[2] | 2023 | var handler_draw_box = function(data){ |
---|
[790] | 2024 | draw_box(data, current_folder,true); |
---|
[406] | 2025 | //Mostrar as msgs nao lidas de acordo com o filtro de relevancia |
---|
[3392] | 2026 | var msgs_unseen = 0; |
---|
| 2027 | draw_paging(data.num_msgs); |
---|
| 2028 | Element("new_m").innerHTML = '<font style="color:'+(data.tot_unseen == 0 ? '': 'red')+'">' + data.tot_unseen + '</font>'; |
---|
| 2029 | Element("tot_m").innerHTML = data.num_msgs; |
---|
[427] | 2030 | } |
---|
[2] | 2031 | |
---|
[51] | 2032 | if(sort_box_type == sort && search_box_type == search){ |
---|
[46] | 2033 | sort_box_reverse = sort_box_reverse ? 0 : 1; |
---|
[51] | 2034 | } |
---|
| 2035 | else if(sort_box_type != sort){ |
---|
[163] | 2036 | if ( (sort == 'SORTFROM') || (sort == 'SORTSUBJECT') ) |
---|
| 2037 | sort_box_reverse = 0; |
---|
| 2038 | else |
---|
| 2039 | sort_box_reverse = 1; |
---|
[51] | 2040 | } |
---|
[3035] | 2041 | |
---|
[46] | 2042 | // Global variable. |
---|
[51] | 2043 | sort_box_type = sort; |
---|
| 2044 | search_box_type = search; |
---|
[46] | 2045 | |
---|
[1752] | 2046 | proxy_mensagens.messages_list(current_folder,1,preferences.max_email_per_page,sort,search,sort_box_reverse,preferences.preview_msg_subject,preferences.preview_msg_tip,handler_draw_box); |
---|
[2] | 2047 | current_page = 1; |
---|
[406] | 2048 | //Comentado para nao sobrepor o numero de msgs nao lidas ao utilizar os filtros |
---|
| 2049 | //update_menu(); |
---|
[2] | 2050 | } |
---|
[4493] | 2051 | |
---|
[2] | 2052 | function draw_header_box(){ |
---|
| 2053 | switch(sort_box_type){ |
---|
| 2054 | case 'SORTFROM': |
---|
[4771] | 2055 | type_name = get_lang("From"); |
---|
[2] | 2056 | break; |
---|
| 2057 | case 'SORTSUBJECT': |
---|
| 2058 | type_name = get_lang("Subject"); |
---|
| 2059 | break; |
---|
| 2060 | case 'SORTARRIVAL': |
---|
| 2061 | type_name = get_lang("Date"); |
---|
| 2062 | break; |
---|
| 2063 | case 'SORTSIZE': |
---|
| 2064 | type_name = get_lang("Size"); |
---|
[3035] | 2065 | break; |
---|
[2] | 2066 | default: |
---|
| 2067 | type_name = get_lang("Date"); |
---|
[72] | 2068 | break; |
---|
[2] | 2069 | } |
---|
[5158] | 2070 | folder = special_folders['Sent']; |
---|
| 2071 | current = get_current_folder(); |
---|
| 2072 | if ((preferences.from_to_sent == "1") && (current.substr(current.length - folder.length, folder.length) == folder)) { |
---|
| 2073 | document.getElementById("message_header_SORTFROM_"+numBox).innerHTML = get_lang("To"); |
---|
| 2074 | }else{ |
---|
[4771] | 2075 | document.getElementById("message_header_SORTFROM_"+numBox).innerHTML = get_lang("From"); |
---|
[5158] | 2076 | } |
---|
[320] | 2077 | document.getElementById("message_header_SORTSUBJECT_"+numBox).innerHTML = get_lang("Subject"); |
---|
| 2078 | document.getElementById("message_header_SORTARRIVAL_"+numBox).innerHTML = get_lang("Date"); |
---|
[3035] | 2079 | document.getElementById("message_header_SORTSIZE_"+numBox).innerHTML = get_lang("Size"); |
---|
[790] | 2080 | 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] | 2081 | } |
---|
[5134] | 2082 | function verifyOption(name, id){ |
---|
| 2083 | var str = name + '' + id; |
---|
| 2084 | if(!Element(str).style.display == ""){ |
---|
| 2085 | var option_reply_options = document.getElementById('msg_opt_reply_options_'+id); |
---|
| 2086 | option_reply_options.value = 'show'; |
---|
| 2087 | option_reply_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2088 | Element('tr_other_options_'+id).style.display = 'none'; |
---|
| 2089 | var option_more_options = document.getElementById('msg_opt_more_options_'+id); |
---|
| 2090 | option_more_options.value = 'show'; |
---|
| 2091 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2092 | Element('tr_other_more_options_'+id).style.display = 'none'; |
---|
| 2093 | var option_mark_as_options = document.getElementById('msg_opt_mark_options_'+id); |
---|
| 2094 | option_mark_as_options.value = 'show'; |
---|
| 2095 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2096 | Element('tr_other_mark_options_'+id).style.display = 'none'; |
---|
| 2097 | } |
---|
| 2098 | } |
---|
[5308] | 2099 | |
---|
| 2100 | /*Busca a primeira mensagem na pagina*/ |
---|
| 2101 | function firstRow(){ |
---|
| 2102 | var thisCell; |
---|
| 2103 | if (objCell) |
---|
| 2104 | thisCell = objCell; |
---|
| 2105 | else |
---|
| 2106 | thisCell = document.getElementById("table_message_header_box_0").rows[0].cells[0]; |
---|
| 2107 | var tbM = getMessagesTable(thisCell); |
---|
| 2108 | proxy_mensagens.get_msg(tbM.rows[0].getAttribute('id'),get_current_folder(),true,show_msg); |
---|
| 2109 | } |
---|
| 2110 | |
---|
| 2111 | /*Busca a ultima mensagem na pagina*/ |
---|
| 2112 | function lastRow(){ |
---|
| 2113 | var thisCell; |
---|
| 2114 | if (objCell) |
---|
| 2115 | thisCell = objCell; |
---|
| 2116 | else |
---|
| 2117 | thisCell = document.getElementById("table_message_header_box_0").rows[0].cells[0]; |
---|
| 2118 | var tbM = getMessagesTable(thisCell); |
---|
| 2119 | proxy_mensagens.get_msg(tbM.rows[tbM.rows.length - 1].getAttribute('id'),get_current_folder(),true,show_msg); |
---|
| 2120 | } |
---|
| 2121 | |
---|
[5367] | 2122 | var msg_selected; |
---|
[2] | 2123 | function draw_message(info_msg, ID){ |
---|
[6487] | 2124 | // remove a flag $FilteredMessage da mensagem ao ser lida |
---|
| 2125 | if(info_msg.Unseen == "U"){ |
---|
| 2126 | $.each(fromRules, function(index, value) { |
---|
| 2127 | if(value == info_msg.msg_folder){ |
---|
| 2128 | cExecute ("$this.imap_functions.removeFlagMessagesFilter&folder="+info_msg.msg_folder+"&msg_number="+info_msg.msg_number, function(){}); |
---|
| 2129 | return false; |
---|
| 2130 | } |
---|
| 2131 | }); |
---|
| 2132 | } |
---|
[2] | 2133 | var content = document.getElementById('content_id_' + ID); |
---|
[3035] | 2134 | |
---|
[2] | 2135 | var menuHidden = Element("folderscol").style.display == 'none' ? true : false; |
---|
| 2136 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2137 | //Make the next/previous buttom. |
---|
| 2138 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2139 | var next_previous_msg_td = document.createElement("TD"); |
---|
| 2140 | next_previous_msg_td.setAttribute("noWrap","true"); |
---|
| 2141 | next_previous_msg_td.align = "right"; |
---|
[5735] | 2142 | next_previous_msg_td.style.fontSize = "10px"; |
---|
[2] | 2143 | next_previous_msg_td.width = "40px"; |
---|
| 2144 | var img_next_msg = document.createElement("IMG"); |
---|
[128] | 2145 | img_next_msg.id = 'msg_opt_next_' + ID; |
---|
[790] | 2146 | img_next_msg.src = './templates/'+template+'/images/down.button.png'; |
---|
[5249] | 2147 | if(preferences.use_shortcuts == '1') |
---|
| 2148 | img_next_msg.title = get_lang('Next Shortcut:Control + Down'); |
---|
| 2149 | else |
---|
| 2150 | img_next_msg.title = get_lang('Next'); |
---|
[2] | 2151 | img_next_msg.style.cursor = 'pointer'; |
---|
[569] | 2152 | |
---|
[4820] | 2153 | var folder_id = ID.match(/\d+/)[0]; |
---|
| 2154 | var folder; |
---|
[3394] | 2155 | |
---|
[4820] | 2156 | //Correção para fazer funcionar e-mails assinados no formato encapsulado. |
---|
| 2157 | // folder_id = info_msg.original_ID ? info_msg.original_ID: info_msg.msg_number; |
---|
| 2158 | //if ((folder = document.getElementById(info_msg.msg_number)) == null) |
---|
[4493] | 2159 | if ((folder = Element(info_msg.original_ID)) == null) |
---|
| 2160 | folder = Element(info_msg.msg_number); |
---|
| 2161 | |
---|
[5134] | 2162 | |
---|
[3035] | 2163 | if (folder){ // mensagem local criptografada nao tem ID da pasta local |
---|
| 2164 | if (folder.nextSibling){ |
---|
| 2165 | var nextMsgBox = folder.nextSibling.name?folder.nextSibling.name:info_msg.msg_folder; |
---|
[1035] | 2166 | |
---|
[5134] | 2167 | if (nextMsgBox == "INBOX" + cyrus_delimiter + "decifradas")// teste para ver se a mensagem vem da pasta oculta decifradas |
---|
[3035] | 2168 | nextMsgBox = get_current_folder(); |
---|
[1035] | 2169 | |
---|
[3035] | 2170 | img_next_msg.onclick = function() |
---|
| 2171 | { |
---|
| 2172 | currentTab = ID; |
---|
| 2173 | openTab.type[ID] = 2; |
---|
| 2174 | proxy_mensagens.get_msg(folder.nextSibling.id,nextMsgBox,true,show_msg); |
---|
[5308] | 2175 | //select_msg('null', 'down', true); |
---|
[5367] | 2176 | if (!msg_selected){ |
---|
| 2177 | select_msg('null', 'down', true); |
---|
| 2178 | msg_selected = true; |
---|
| 2179 | } |
---|
[3035] | 2180 | }; |
---|
| 2181 | } |
---|
[5308] | 2182 | /*Ultima mensagem de cada página, exceto a ultima*/ |
---|
| 2183 | else if( (current_page < total_pages) ){ |
---|
| 2184 | |
---|
| 2185 | img_next_msg.onclick = function() |
---|
| 2186 | { |
---|
| 2187 | |
---|
| 2188 | current_page++; |
---|
| 2189 | var tot_msgs = parseInt(Element("tot_m").innerHTML); |
---|
| 2190 | var range_begin = preferences.max_email_per_page*( current_page - 1 ) + 1; |
---|
| 2191 | var range_end; |
---|
| 2192 | if ( range_begin + parseInt(preferences.max_email_per_page - 1) > tot_msgs ) |
---|
| 2193 | range_end = tot_msgs; |
---|
| 2194 | else |
---|
| 2195 | range_end = range_begin + parseInt(preferences.max_email_per_page - 1); |
---|
| 2196 | var creatBoxProximo = function (data){ |
---|
| 2197 | draw_box(data, get_current_folder()); |
---|
| 2198 | firstRow(); |
---|
| 2199 | }; |
---|
[5321] | 2200 | proxy_mensagens.messages_list(get_current_folder(),range_begin,range_end,sort_box_type,search_box_type,sort_box_reverse,'','', creatBoxProximo); |
---|
[5308] | 2201 | |
---|
| 2202 | }; |
---|
| 2203 | } |
---|
[3035] | 2204 | else |
---|
| 2205 | { |
---|
| 2206 | img_next_msg.src = "./templates/"+template+"/images/down.gray.button.png"; |
---|
| 2207 | img_next_msg.style.cursor = 'default'; |
---|
[1035] | 2208 | |
---|
[3035] | 2209 | } |
---|
| 2210 | } |
---|
| 2211 | else |
---|
| 2212 | { |
---|
| 2213 | img_next_msg.src = "./templates/"+template+"/images/down.gray.button.png"; |
---|
[1035] | 2214 | img_next_msg.style.cursor = 'default'; |
---|
[4726] | 2215 | // testa se a mensagem e local |
---|
| 2216 | if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(info_msg.msg_folder == "INBOX" + cyrus_delimiter + "decifradas")) // testa se a mensagem e local |
---|
[569] | 2217 | { |
---|
[3035] | 2218 | img_next_msg.onclick = function() |
---|
| 2219 | { |
---|
| 2220 | delete_border(ID); |
---|
| 2221 | }; |
---|
| 2222 | } |
---|
| 2223 | } |
---|
[2] | 2224 | var img_space = document.createElement("SPAN"); |
---|
| 2225 | img_space.innerHTML = " "; |
---|
| 2226 | var img_previous_msg = document.createElement("IMG"); |
---|
[128] | 2227 | img_previous_msg.id = 'msg_opt_previous_' + ID; |
---|
[790] | 2228 | img_previous_msg.src = './templates/'+template+'/images/up.button.png'; |
---|
[5249] | 2229 | if(preferences.use_shortcuts == '1') |
---|
| 2230 | img_previous_msg.title = get_lang('Previous Shortcut:Control + Up'); |
---|
| 2231 | else |
---|
| 2232 | img_previous_msg.title = get_lang('Previous'); |
---|
[2] | 2233 | img_previous_msg.style.cursor = 'pointer'; |
---|
[569] | 2234 | |
---|
[5134] | 2235 | |
---|
[3035] | 2236 | if (folder){ // mensagem local criptografada nao tem ID da pasta local |
---|
| 2237 | if (folder.previousSibling) |
---|
| 2238 | { |
---|
| 2239 | var previousMsgBox = folder.previousSibling.name?folder.previousSibling.name:info_msg.msg_folder; |
---|
[1035] | 2240 | |
---|
[4726] | 2241 | if (previousMsgBox == "INBOX" + cyrus_delimiter + "decifradas") // teste para ver se a mensagem vem da pasta oculta decifradas |
---|
[3035] | 2242 | previousMsgBox = get_current_folder(); |
---|
[1035] | 2243 | |
---|
[3035] | 2244 | img_previous_msg.onclick = function() |
---|
| 2245 | { |
---|
| 2246 | currentTab = ID; |
---|
| 2247 | openTab.type[ID] = 2; |
---|
| 2248 | proxy_mensagens.get_msg(folder.previousSibling.id,previousMsgBox,true,show_msg); |
---|
[5308] | 2249 | //select_msg('null', 'up', false); |
---|
[5367] | 2250 | if (!msg_selected){ |
---|
| 2251 | select_msg('null', 'up', true); |
---|
| 2252 | msg_selected = true; |
---|
| 2253 | } |
---|
[3035] | 2254 | }; |
---|
| 2255 | } |
---|
[5308] | 2256 | //primeira mensagem de cada página, exceto a primeira |
---|
| 2257 | else if(current_page > 1){ |
---|
| 2258 | |
---|
| 2259 | img_previous_msg.onclick = function() |
---|
| 2260 | { |
---|
| 2261 | |
---|
| 2262 | current_page--; |
---|
| 2263 | var range_begin = (current_page - 1)*preferences.max_email_per_page + 1; |
---|
| 2264 | var range_end = current_page*preferences.max_email_per_page; |
---|
| 2265 | var creatBoxAnterior = function (data){ |
---|
| 2266 | draw_box(data, get_current_folder()); |
---|
| 2267 | lastRow(); |
---|
| 2268 | }; |
---|
| 2269 | proxy_mensagens.messages_list(get_current_folder(),range_begin,range_end,sort_box_type,search_box_type,sort_box_reverse,'','', creatBoxAnterior); |
---|
| 2270 | }; |
---|
| 2271 | } |
---|
[3035] | 2272 | else |
---|
| 2273 | { |
---|
| 2274 | img_previous_msg.src = "./templates/"+template+"/images/up.gray.button.png"; |
---|
| 2275 | img_previous_msg.style.cursor = 'default'; |
---|
| 2276 | } |
---|
[569] | 2277 | } |
---|
| 2278 | else |
---|
[1035] | 2279 | { |
---|
| 2280 | img_previous_msg.src = "./templates/"+template+"/images/up.gray.button.png"; |
---|
| 2281 | img_previous_msg.style.cursor = 'default'; |
---|
[4726] | 2282 | // testa se a mensagem e local |
---|
| 2283 | if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(info_msg.msg_folder == "INBOX" + cyrus_delimiter + "decifradas")) // testa se a mensagem e local |
---|
[3035] | 2284 | { |
---|
| 2285 | img_previous_msg.onclick = function() |
---|
| 2286 | { |
---|
| 2287 | delete_border(ID); |
---|
| 2288 | }; |
---|
| 2289 | } |
---|
| 2290 | } |
---|
[2] | 2291 | next_previous_msg_td.appendChild(img_previous_msg); |
---|
| 2292 | next_previous_msg_td.appendChild(img_space); |
---|
| 2293 | next_previous_msg_td.appendChild(img_next_msg); |
---|
| 2294 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2295 | //Make the header message. |
---|
| 2296 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2297 | var table_message = document.createElement("TABLE"); |
---|
| 2298 | var tbody_message = document.createElement("TBODY"); |
---|
| 2299 | table_message.border = "0"; |
---|
[4493] | 2300 | //table_message.width = "100%"; |
---|
| 2301 | //k! |
---|
| 2302 | table_message.setAttribute("class", "expressomail-message-body"); |
---|
| 2303 | table_message.setAttribute("className", "expressomail-message-body"); |
---|
[2] | 2304 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2305 | //Make the options message. |
---|
| 2306 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2307 | var tr0 = document.createElement("TR"); |
---|
| 2308 | tr0.className = "tr_message_header"; |
---|
| 2309 | var td0 = document.createElement("TD"); |
---|
| 2310 | var table_message_options = document.createElement("TABLE"); |
---|
| 2311 | table_message_options.width = "100%"; |
---|
| 2312 | table_message_options.border = '0'; |
---|
| 2313 | table_message_options.className = 'table_message'; |
---|
| 2314 | var tbody_message_options = document.createElement("TBODY"); |
---|
| 2315 | var tr = document.createElement("TR"); |
---|
| 2316 | var td = document.createElement("TD"); |
---|
| 2317 | td.setAttribute("noWrap","true"); |
---|
[5735] | 2318 | td.style.fontSize = "10px"; |
---|
[2] | 2319 | var _name = ''; |
---|
| 2320 | var _maxChar = menuHidden ? 40 : 15; |
---|
[3035] | 2321 | |
---|
[2] | 2322 | if (info_msg.from.name) |
---|
[1416] | 2323 | { |
---|
| 2324 | var spanName = document.createElement("SPAN"); |
---|
| 2325 | spanName.innerHTML = info_msg.from.name; |
---|
| 2326 | _name = spanName.innerHTML.length > _maxChar ? spanName.innerHTML.substring(0,_maxChar) + "..." : spanName.innerHTML; |
---|
| 2327 | } |
---|
| 2328 | else |
---|
[2] | 2329 | _name = info_msg.from.email.length > _maxChar ? info_msg.from.email.substring(0,_maxChar) + "..." : info_msg.from.email; |
---|
| 2330 | |
---|
| 2331 | td.innerHTML = _name.bold() + ', ' + info_msg.smalldate; |
---|
[4493] | 2332 | //k! |
---|
[3035] | 2333 | if (info_msg.attachments && info_msg.attachments.length > 0) |
---|
[3369] | 2334 | td.innerHTML += " <img style='cursor:pointer' onclick='javascript:Element(\"option_hide_more_"+ID+"\").onclick()' src ='templates/"+template+"/images/clip.gif' title='"+info_msg.attachments[0].name+"'>"; |
---|
[3035] | 2335 | |
---|
[91] | 2336 | if (typeof(info_msg.signature) == 'string') |
---|
[3035] | 2337 | { |
---|
[109] | 2338 | if (info_msg.signature != "void") |
---|
[790] | 2339 | 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] | 2340 | else |
---|
[790] | 2341 | 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] | 2342 | } |
---|
[4072] | 2343 | |
---|
[320] | 2344 | if (info_msg.DispositionNotificationTo) |
---|
| 2345 | { |
---|
[3798] | 2346 | td.innerHTML += ' <img id="disposition_notification_'+ID+'" style="cursor:pointer" alt="'+ get_lang('Message with read notification') + '" title="'+ get_lang('Message with read notification') + '" src="templates/'+template+'/images/notification.gif">'; |
---|
[320] | 2347 | } |
---|
[3035] | 2348 | |
---|
[5134] | 2349 | if (info_msg.Flagged == 'F') |
---|
| 2350 | { |
---|
[5569] | 2351 | td.innerHTML += ' <img id="disposition_important_'+ID+'" style="cursor:pointer" alt="'+ get_lang('Important message') + '" title="'+ get_lang('Important message') + '" src="templates/'+template+'/images/important.png">'; |
---|
[5134] | 2352 | } |
---|
[2] | 2353 | // NORMAL MSG |
---|
| 2354 | if(info_msg.Draft != 'X') |
---|
| 2355 | { |
---|
| 2356 | var options = document.createElement("TD"); |
---|
[790] | 2357 | options.width = "30%"; |
---|
[2] | 2358 | options.setAttribute("noWrap","true"); |
---|
[5735] | 2359 | options.style.fontSize = "10px"; |
---|
[5134] | 2360 | |
---|
| 2361 | //BEGIN: DESENHA MOSTRA DETALHES, OCULTAR DETALHES |
---|
[2] | 2362 | var option_hide_more = document.createElement("SPAN"); |
---|
| 2363 | option_hide_more.className = 'message_options'; |
---|
[4826] | 2364 | option_hide_more.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2365 | option_hide_more.onmouseout=function () {this.className='message_options'}; |
---|
[24] | 2366 | options.align = 'right'; |
---|
[2] | 2367 | option_hide_more.value = 'more_options'; |
---|
| 2368 | option_hide_more.id = 'option_hide_more_'+ID; |
---|
| 2369 | option_hide_more.onclick = function(){ |
---|
| 2370 | if (this.value == 'more_options'){ |
---|
[3021] | 2371 | this.innerHTML = "<b><u>"+get_lang('Hide details')+"</u></b>"; |
---|
[2] | 2372 | this.value = 'hide_options'; |
---|
| 2373 | Element('table_message_others_options_'+ID).style.display = ''; |
---|
| 2374 | } |
---|
| 2375 | else{ |
---|
[3021] | 2376 | this.innerHTML = get_lang('Show details'); |
---|
[2] | 2377 | this.value = 'more_options'; |
---|
| 2378 | Element('table_message_others_options_'+ID).style.display = 'none'; |
---|
| 2379 | } |
---|
[3018] | 2380 | resizeWindow(); |
---|
[2] | 2381 | }; |
---|
[5134] | 2382 | //END: DESENHA MOSTRA DETALHES, OCULTAR DETALHES |
---|
| 2383 | |
---|
| 2384 | //OPCAO PARA MARCAR COMO |
---|
| 2385 | var option_mark_as = document.createElement("SPAN"); |
---|
| 2386 | option_mark_as.innerHTML = "<b>"+get_lang('Mark as')+"</b>"; |
---|
| 2387 | option_mark_as.className = 'message_options'; |
---|
| 2388 | option_mark_as.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2389 | option_mark_as.onmouseout=function () {this.className='message_options'}; |
---|
| 2390 | option_mark_as.onclick = function(){ |
---|
| 2391 | verifyOption('tr_other_mark_options_', ID); |
---|
| 2392 | var thi = document.getElementById('msg_opt_mark_options_'+ID); |
---|
| 2393 | if (thi.value != 'hide'){ |
---|
| 2394 | thi.value = 'hide'; |
---|
| 2395 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2396 | Element('tr_other_mark_options_'+ID).style.display = ''; |
---|
| 2397 | |
---|
| 2398 | } |
---|
| 2399 | else{ |
---|
| 2400 | thi.value = 'show'; |
---|
| 2401 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2402 | Element('tr_other_mark_options_'+ID).style.display = 'none'; |
---|
| 2403 | } |
---|
| 2404 | }; |
---|
| 2405 | //DESENHA OPCOES DO MARCAR COMO |
---|
[3036] | 2406 | var option_mark_as_unseen = document.createElement("SPAN"); |
---|
[5134] | 2407 | option_mark_as_unseen.className = "reply_options"; |
---|
[4826] | 2408 | option_mark_as_unseen.onclick = function () {changeLinkState(this,'seen'); |
---|
[3716] | 2409 | proxy_mensagens.proxy_set_message_flag(folder_id,'unseen'); |
---|
[3036] | 2410 | write_msg(get_lang('Message marked as ')+get_lang("Unseen")); |
---|
| 2411 | }; |
---|
[5134] | 2412 | option_mark_as_unseen.onmouseover=function () {this.className='reply_options_active'}; |
---|
| 2413 | option_mark_as_unseen.onmouseout=function () {this.className='reply_options'}; |
---|
[3036] | 2414 | option_mark_as_unseen.innerHTML = get_lang("Unseen"); |
---|
[3021] | 2415 | |
---|
[3036] | 2416 | var option_mark_important = document.createElement("SPAN"); |
---|
[5134] | 2417 | option_mark_important.className = 'reply_options'; |
---|
| 2418 | option_mark_important.onmouseover=function () {this.className='reply_options_active';}; |
---|
| 2419 | option_mark_important.onmouseout=function () {this.className='reply_options'}; |
---|
[3036] | 2420 | |
---|
| 2421 | if (info_msg.Flagged == "F"){ |
---|
[4072] | 2422 | option_mark_important.onclick = function() { |
---|
[3806] | 2423 | var _this = this; |
---|
| 2424 | proxy_mensagens.proxy_set_message_flag(folder_id,'unflagged', function(success){ |
---|
| 2425 | if (success) { |
---|
| 2426 | changeLinkState(_this, 'important'); |
---|
| 2427 | write_msg(get_lang('Message marked as ') + get_lang("Normal")); |
---|
| 2428 | } |
---|
| 2429 | } ); |
---|
[4072] | 2430 | |
---|
[3036] | 2431 | }; |
---|
| 2432 | option_mark_important.innerHTML = get_lang("Normal"); |
---|
| 2433 | } |
---|
| 2434 | else{ |
---|
[4826] | 2435 | option_mark_important.onclick = function() {changeLinkState(this,'normal'); |
---|
[3716] | 2436 | proxy_mensagens.proxy_set_message_flag(folder_id,'flagged'); |
---|
[3036] | 2437 | write_msg(get_lang('Message marked as ')+get_lang("Important")); |
---|
| 2438 | }; |
---|
| 2439 | option_mark_important.innerHTML = get_lang("Important"); |
---|
| 2440 | } |
---|
[5134] | 2441 | //option_mark.appendChild(option_mark_as_unseen); |
---|
| 2442 | //option_mark.appendChild(option_mark_important); |
---|
| 2443 | |
---|
| 2444 | |
---|
[3021] | 2445 | option_hide_more.innerHTML = get_lang('Show details'); |
---|
[5134] | 2446 | option_hide_more.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'O') : get_lang('Show details'); |
---|
| 2447 | |
---|
| 2448 | var space3 = document.createElement("SPAN"); |
---|
| 2449 | space3.innerHTML = ' | '; |
---|
| 2450 | |
---|
| 2451 | var option_mark_as_options = document.createElement('IMG'); |
---|
| 2452 | option_mark_as_options.id = 'msg_opt_mark_options_'+ID; |
---|
| 2453 | option_mark_as_options.src = '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2454 | option_mark_as_options.value = 'show'; |
---|
| 2455 | |
---|
| 2456 | option_mark_as_options.onmouseover = function(){ |
---|
| 2457 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/over.png'; |
---|
| 2458 | option_mark_as.className = 'message_options_active'; |
---|
| 2459 | }; |
---|
| 2460 | option_mark_as_options.onmouseout = function(){ |
---|
| 2461 | option_mark_as.className = 'message_options'; |
---|
| 2462 | if (this.value == 'show') |
---|
| 2463 | { |
---|
| 2464 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2465 | } |
---|
| 2466 | else |
---|
| 2467 | { |
---|
| 2468 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2469 | } |
---|
| 2470 | }; |
---|
| 2471 | option_mark_as_options.onclick = function(){ |
---|
| 2472 | verifyOption('tr_other_mark_options_', ID); |
---|
| 2473 | if (this.value != 'hide'){ |
---|
| 2474 | this.value = 'hide'; |
---|
| 2475 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2476 | Element('tr_other_mark_options_'+ID).style.display = ''; |
---|
| 2477 | |
---|
| 2478 | } |
---|
| 2479 | else{ |
---|
| 2480 | this.value = 'show'; |
---|
| 2481 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2482 | Element('tr_other_mark_options_'+ID).style.display = 'none'; |
---|
| 2483 | } |
---|
| 2484 | }; |
---|
| 2485 | |
---|
[2] | 2486 | options.appendChild(option_hide_more); |
---|
[5134] | 2487 | options.appendChild(space3); |
---|
| 2488 | options.appendChild(option_mark_as_options); |
---|
| 2489 | options.appendChild(option_mark_as); |
---|
| 2490 | //FIM OPCAO PARA MARCAR COMO |
---|
[3021] | 2491 | |
---|
[24] | 2492 | var space0 = document.createElement("SPAN"); |
---|
[790] | 2493 | space0.innerHTML = ' | '; |
---|
[2] | 2494 | var space1 = document.createElement("SPAN"); |
---|
[790] | 2495 | space1.innerHTML = ' | '; |
---|
[2] | 2496 | var space2 = document.createElement("SPAN"); |
---|
[790] | 2497 | space2.innerHTML = ' | '; |
---|
[2] | 2498 | |
---|
[5134] | 2499 | //OPCAO PARA MAIS ACOES |
---|
| 2500 | var option_more = document.createElement("SPAN"); |
---|
| 2501 | option_more.id = 'msg_opt_more_actions_'+ID; |
---|
| 2502 | option_more.className = 'message_options'; |
---|
| 2503 | //option_more.onclick = function(){new_message('forward', ID);}; |
---|
| 2504 | option_more.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2505 | option_more.onmouseout=function () {this.className='message_options'}; |
---|
| 2506 | option_more.onclick = function(){ |
---|
| 2507 | verifyOption('tr_other_more_options_', ID); |
---|
| 2508 | if (option_more_options.value != 'hide'){ |
---|
| 2509 | option_more_options.value = 'hide'; |
---|
| 2510 | option_more_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2511 | Element('tr_other_more_options_'+ID).style.display = ''; |
---|
| 2512 | |
---|
| 2513 | } |
---|
| 2514 | else{ |
---|
| 2515 | option_more_options.value = 'show'; |
---|
| 2516 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2517 | Element('tr_other_more_options_'+ID).style.display = 'none'; |
---|
| 2518 | } |
---|
| 2519 | }; |
---|
| 2520 | option_more.innerHTML = get_lang('More Actions'); |
---|
| 2521 | |
---|
| 2522 | //CRIA IMG DE MAIS ACOES |
---|
| 2523 | var option_more_options = document.createElement('IMG'); |
---|
| 2524 | option_more_options.id = 'msg_opt_more_options_'+ID; |
---|
| 2525 | option_more_options.src = '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2526 | option_more_options.value = 'show'; |
---|
| 2527 | |
---|
| 2528 | option_more_options.onmouseover = function(){ |
---|
| 2529 | option_more.className = 'message_options_active'; |
---|
| 2530 | option_more_options.src= '../expressoMail1_2/templates/default/images/over.png'; |
---|
| 2531 | }; |
---|
| 2532 | option_more_options.onmouseout = function(){ |
---|
| 2533 | option_more.className = 'message_options'; |
---|
| 2534 | if (this.value == 'show') |
---|
| 2535 | { |
---|
| 2536 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2537 | } |
---|
| 2538 | else |
---|
| 2539 | { |
---|
| 2540 | option_more_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2541 | } |
---|
| 2542 | }; |
---|
| 2543 | option_more_options.onclick = function(){ |
---|
| 2544 | verifyOption('tr_other_more_options_',ID); |
---|
| 2545 | |
---|
| 2546 | if (this.value != 'hide'){ |
---|
| 2547 | this.value = 'hide'; |
---|
| 2548 | option_more_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2549 | Element('tr_other_more_options_'+ID).style.display = ''; |
---|
| 2550 | |
---|
| 2551 | } |
---|
| 2552 | else{ |
---|
| 2553 | this.value = 'show'; |
---|
| 2554 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2555 | Element('tr_other_more_options_'+ID).style.display = 'none'; |
---|
| 2556 | } |
---|
| 2557 | }; |
---|
[2] | 2558 | options.appendChild(space1); |
---|
[5134] | 2559 | options.appendChild(option_more_options); |
---|
| 2560 | options.appendChild(option_more); |
---|
| 2561 | //FIM OPCAO PARA MAIS ACOES |
---|
| 2562 | |
---|
| 2563 | //OPCAO PARA RESPONDER |
---|
[2] | 2564 | var option_reply = document.createElement("SPAN"); |
---|
[128] | 2565 | option_reply.id = 'msg_opt_reply_'+ID; |
---|
[2] | 2566 | option_reply.className = 'message_options'; |
---|
| 2567 | option_reply.onclick = function(){new_message('reply_with_history', ID);}; |
---|
[197] | 2568 | option_reply.innerHTML = get_lang('Reply'); |
---|
[4826] | 2569 | option_reply.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2570 | option_reply.onmouseout=function () {this.className='message_options'}; |
---|
[5134] | 2571 | option_reply.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'R') : get_lang('Reply'); |
---|
[3036] | 2572 | |
---|
[2] | 2573 | options.appendChild(space2); |
---|
[3021] | 2574 | |
---|
| 2575 | var option_reply_options = document.createElement('IMG'); |
---|
| 2576 | option_reply_options.id = 'msg_opt_reply_options_'+ID; |
---|
| 2577 | option_reply_options.src = '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2578 | option_reply_options.value = 'show'; |
---|
| 2579 | |
---|
| 2580 | option_reply_options.onmouseover = function(){ |
---|
| 2581 | option_reply_options.src= '../expressoMail1_2/templates/default/images/over.png'; |
---|
| 2582 | }; |
---|
| 2583 | option_reply_options.onmouseout = function(){ |
---|
| 2584 | if (this.value == 'show') |
---|
| 2585 | { |
---|
| 2586 | option_reply_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2587 | } |
---|
| 2588 | else |
---|
| 2589 | { |
---|
| 2590 | option_reply_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2591 | } |
---|
| 2592 | }; |
---|
| 2593 | option_reply_options.onclick = function(){ |
---|
[5134] | 2594 | verifyOption('tr_other_options_', ID); |
---|
[3021] | 2595 | if (this.value != 'hide'){ |
---|
| 2596 | this.value = 'hide'; |
---|
| 2597 | option_reply_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2598 | Element('tr_other_options_'+ID).style.display = ''; |
---|
| 2599 | |
---|
| 2600 | } |
---|
| 2601 | else{ |
---|
| 2602 | this.value = 'show'; |
---|
| 2603 | option_reply_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2604 | Element('tr_other_options_'+ID).style.display = 'none'; |
---|
| 2605 | } |
---|
| 2606 | }; |
---|
| 2607 | options.appendChild(option_reply_options); |
---|
[2] | 2608 | options.appendChild(option_reply); |
---|
[5134] | 2609 | //FIM OPCAO PARA RESPONDER |
---|
| 2610 | |
---|
| 2611 | //OPCAO PARA ENCAMINHAR |
---|
| 2612 | var option_forward = document.createElement("SPAN"); |
---|
| 2613 | option_forward.id = 'msg_opt_forward_'+ID; |
---|
| 2614 | option_forward.className = 'message_options'; |
---|
| 2615 | option_forward.innerHTML = get_lang('Forward'); |
---|
| 2616 | option_forward.onclick = function(){new_message('forward', ID);}; |
---|
| 2617 | option_forward.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2618 | option_forward.onmouseout=function () {this.className='message_options'}; |
---|
| 2619 | option_forward.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'E') : get_lang('Forward'); |
---|
| 2620 | |
---|
| 2621 | var space9 = document.createElement("SPAN"); |
---|
| 2622 | space9.innerHTML = ' | '; |
---|
| 2623 | |
---|
| 2624 | options.appendChild(space9); |
---|
| 2625 | options.appendChild(option_forward); |
---|
| 2626 | //FIM DA OPCAO PARA ENCAMINHAR |
---|
| 2627 | |
---|
| 2628 | //OPCAO PARA DELETAR |
---|
| 2629 | var option_delete = document.createElement("SPAN"); |
---|
| 2630 | option_delete.id = 'msg_opt_delete_'+ID; |
---|
| 2631 | option_delete.className = 'message_options'; |
---|
| 2632 | option_delete.onclick = function(){proxy_mensagens.delete_msgs('null','selected','null');}; |
---|
| 2633 | option_delete.innerHTML = get_lang('Delete'); |
---|
| 2634 | option_delete.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2635 | option_delete.onmouseout=function () {this.className='message_options'}; |
---|
| 2636 | option_delete.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'Delete') : get_lang('Delete'); |
---|
[3035] | 2637 | |
---|
[5134] | 2638 | var space6 = document.createElement("SPAN"); |
---|
| 2639 | space6.innerHTML = ' | '; |
---|
| 2640 | |
---|
| 2641 | options.appendChild(space6); |
---|
| 2642 | options.appendChild(option_delete); |
---|
| 2643 | //FIM OPCAO PARA DELETAR |
---|
| 2644 | |
---|
[2] | 2645 | tr.appendChild(td); |
---|
[5134] | 2646 | //tr.appendChild(option_mark); |
---|
[2] | 2647 | tr.appendChild(options); |
---|
| 2648 | tr.appendChild(next_previous_msg_td); |
---|
| 2649 | tbody_message_options.appendChild(tr); |
---|
[3035] | 2650 | |
---|
[2] | 2651 | ////////// OTHER OPTIONS //////////////////// |
---|
| 2652 | var tr_other_options = document.createElement("TR"); |
---|
[5134] | 2653 | var tr_other_mark_options = document.createElement("TR"); |
---|
| 2654 | var tr_other_more_options = document.createElement("TR"); |
---|
| 2655 | |
---|
| 2656 | tr_other_mark_options.id = 'tr_other_mark_options_' + ID; |
---|
| 2657 | tr_other_mark_options.style.display = 'none'; |
---|
| 2658 | tr_other_mark_options.style.backgroundColor = '#205C8E'; |
---|
[2] | 2659 | tr_other_options.id = 'tr_other_options_' + ID; |
---|
| 2660 | tr_other_options.style.display = 'none'; |
---|
[5134] | 2661 | tr_other_options.style.backgroundColor = '#205C8E'; |
---|
| 2662 | tr_other_more_options.id = 'tr_other_more_options_' + ID; |
---|
| 2663 | tr_other_more_options.style.display = 'none'; |
---|
| 2664 | tr_other_more_options.style.backgroundColor = '#205C8E'; |
---|
[3035] | 2665 | |
---|
[2] | 2666 | var td_other_options = document.createElement("TD"); |
---|
[5134] | 2667 | var td_other_mark_options = document.createElement("TD"); |
---|
| 2668 | var td_other_more_options = document.createElement("TD"); |
---|
| 2669 | |
---|
[2] | 2670 | td_other_options.colSpan = '3'; |
---|
[5134] | 2671 | td_other_mark_options.colSpan = '3'; |
---|
| 2672 | td_other_more_options.colSpan = '3'; |
---|
| 2673 | |
---|
[2] | 2674 | var div_other_options = document.createElement("DIV"); |
---|
[5134] | 2675 | var div_other_mark_options = document.createElement("DIV"); |
---|
| 2676 | var div_other_more_options = document.createElement("DIV"); |
---|
[2] | 2677 | |
---|
[5134] | 2678 | //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>, '; |
---|
| 2679 | //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>, '; |
---|
| 2680 | //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> | '; |
---|
[5754] | 2681 | var block_user = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick ="block_user_email(\''+info_msg.from.email+'\');">'+get_lang("Block Sender")+'</span> | '; |
---|
[5134] | 2682 | //var option_forward = '<span onclick="new_message(\'forward\',\''+ ID+'\');" onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options">'+get_lang("Forward")+'</span> | '; |
---|
| 2683 | var option_move = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=wfolders.makeWindow("'+ID+'","move_to");>'+get_lang("Move")+'</span> | '; |
---|
| 2684 | var option_print = '<span onclick="print_all()" onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options">'+get_lang("Print")+'</span> | '; |
---|
| 2685 | var option_export = '<span onclick="proxy_mensagens.export_all_messages()" onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options">'+get_lang("Export")+'</span> | '; |
---|
[3035] | 2686 | |
---|
[5134] | 2687 | option_reply_to_all__title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'T') : ''; |
---|
| 2688 | var option_reply_to_all = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick="new_message(\'reply_to_all_with_history\',\''+ID+'\');" title="'+option_reply_to_all__title+'">'+get_lang("Reply to all")+'</span> | '; |
---|
[3021] | 2689 | var option_reply_without_history = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=new_message("reply_without_history","'+ID+'");>'+get_lang("Reply without history")+'</span> | '; |
---|
[5134] | 2690 | var option_reply_to_all_without_history = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=new_message("reply_to_all_without_history","'+ID+'");>'+get_lang("Reply to all without history")+'</span> | '; |
---|
[2] | 2691 | |
---|
[5134] | 2692 | var report_error = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=reports_window("'+currentTab+'");>'+get_lang("Report error")+'</span> | '; |
---|
| 2693 | |
---|
[5754] | 2694 | div_other_more_options.innerHTML += option_move + option_print + option_export + block_user + report_error; |
---|
[5134] | 2695 | |
---|
| 2696 | div_other_options.innerHTML += option_reply_without_history + option_reply_to_all_without_history + option_reply_to_all; |
---|
[69] | 2697 | if (use_spam_filter) { |
---|
[5134] | 2698 | if(info_msg.msg_folder == 'INBOX'+cyrus_delimiter+'Spam' || (info_msg.msg_folder.match(/^user/) && info_msg.msg_folder.match(/Spam$/))){ |
---|
| 2699 | div_other_mark_options.innerHTML += '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick="nospam('+info_msg.msg_number+',\'null\', \''+info_msg.msg_folder+'\');">'+get_lang("Not Spam")+'</span> | '; |
---|
[69] | 2700 | } |
---|
[5134] | 2701 | else{ |
---|
| 2702 | div_other_mark_options.innerHTML += '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick="spam(\''+info_msg.msg_folder+'\', '+info_msg.msg_number+',\'null\');">'+get_lang("Is Spam")+'</span> | '; |
---|
| 2703 | } |
---|
| 2704 | } |
---|
| 2705 | var space5 = document.createElement("SPAN"); |
---|
| 2706 | space5.innerHTML = ' | '; |
---|
[4830] | 2707 | |
---|
[5134] | 2708 | div_other_mark_options.appendChild(option_mark_as_unseen); |
---|
| 2709 | var space4 = document.createElement("SPAN"); |
---|
| 2710 | space4.innerHTML = ' | '; |
---|
| 2711 | div_other_mark_options.appendChild(space4); |
---|
| 2712 | div_other_mark_options.appendChild(option_mark_important); |
---|
| 2713 | var space7 = document.createElement("SPAN"); |
---|
| 2714 | space7.innerHTML = ' | '; |
---|
| 2715 | div_other_mark_options.appendChild(space7); |
---|
[4830] | 2716 | |
---|
[3021] | 2717 | td_other_options.align = 'right'; |
---|
| 2718 | td_other_options.style.paddingTop = '3px'; |
---|
[2] | 2719 | td_other_options.appendChild(div_other_options); |
---|
[3021] | 2720 | |
---|
[5134] | 2721 | td_other_mark_options.align = 'right'; |
---|
| 2722 | td_other_mark_options.style.paddingTop = '3px'; |
---|
| 2723 | td_other_mark_options.appendChild(div_other_mark_options); |
---|
| 2724 | |
---|
| 2725 | td_other_more_options.align = 'right'; |
---|
| 2726 | td_other_more_options.style.paddingTop = '3px'; |
---|
| 2727 | td_other_more_options.appendChild(div_other_more_options); |
---|
[3021] | 2728 | |
---|
[5134] | 2729 | |
---|
[2] | 2730 | tr_other_options.appendChild(td_other_options); |
---|
| 2731 | tbody_message_options.appendChild(tr_other_options); |
---|
[5134] | 2732 | |
---|
| 2733 | tr_other_more_options.appendChild(td_other_more_options); |
---|
| 2734 | tbody_message_options.appendChild(tr_other_more_options); |
---|
| 2735 | |
---|
| 2736 | tr_other_mark_options.appendChild(td_other_mark_options); |
---|
| 2737 | tbody_message_options.appendChild(tr_other_mark_options); |
---|
[2] | 2738 | ////////// END OTHER OPTIONS //////////////// |
---|
[1035] | 2739 | |
---|
[3035] | 2740 | ////////// BEGIN SIGNATURE ////////////////// |
---|
[1035] | 2741 | if (info_msg.signature && info_msg.signature.length > 0) |
---|
| 2742 | { |
---|
[3352] | 2743 | var tr_signature = document.createElement("TR"); |
---|
| 2744 | var td_signature = document.createElement("TD"); |
---|
| 2745 | td_signature.className = 'tr_message_header'; |
---|
| 2746 | tr_signature.id = 'tr_signature_'+ID; |
---|
| 2747 | td_signature.colSpan = "5"; |
---|
| 2748 | tr_signature.style.display = 'none'; |
---|
| 2749 | for (i in info_msg.signature) |
---|
| 2750 | { |
---|
| 2751 | if(typeof(info_msg.signature[i]) == 'object') |
---|
| 2752 | { |
---|
| 2753 | var aux = ''; |
---|
| 2754 | for (ii in info_msg.signature[i]) |
---|
| 2755 | { |
---|
| 2756 | if(info_msg.signature[i][ii].indexOf("###") > -1) |
---|
| 2757 | { |
---|
| 2758 | aux += get_lang(info_msg.signature[i][ii].substring(0,info_msg.signature[i][ii].indexOf("###"))) + info_msg.signature[i][ii].substring(info_msg.signature[i][ii].indexOf("###")+3); |
---|
| 2759 | } |
---|
| 2760 | else |
---|
| 2761 | { |
---|
| 2762 | aux += info_msg.signature[i][ii]; |
---|
| 2763 | } |
---|
| 2764 | } |
---|
| 2765 | td_signature.innerHTML += "<a onclick=\"javascript:alert('" + aux + "')\"><b><font color=\"#0000FF\">" + get_lang("More") + "...</font></b></a>"; |
---|
| 2766 | continue; |
---|
| 2767 | } |
---|
| 2768 | if(info_msg.signature[i].indexOf("#@#") > -1) |
---|
| 2769 | { |
---|
| 2770 | td_signature.innerHTML += '<span style=color:red><strong>'+get_lang(info_msg.signature[i].substring(0,info_msg.signature[i].indexOf("#@#")))+'</strong> '+info_msg.signature[i].substring(info_msg.signature[i].indexOf("#@#")+3)+'</span> <br /> '; |
---|
| 2771 | } |
---|
[4934] | 2772 | if(info_msg.signature[i].indexOf("###") > -1) |
---|
| 2773 | { |
---|
| 2774 | td_signature.innerHTML += '<span><strong>'+get_lang(info_msg.signature[i].substring(0,info_msg.signature[i].indexOf("###")))+'</strong> '+info_msg.signature[i].substring(info_msg.signature[i].indexOf("###")+3)+'</span> <br /> '; |
---|
| 2775 | } |
---|
[3352] | 2776 | } |
---|
| 2777 | var signature_status_pos = info_msg.signature[0].indexOf('Message untouched'); |
---|
| 2778 | td_signature.id = "td_signature_"+ID; |
---|
| 2779 | if(signature_status_pos < 0 ) |
---|
| 2780 | { |
---|
| 2781 | td.innerHTML += ' <img style="cursor:pointer" src="templates/'+template+'/images/signed_error.gif" title="'+get_lang("Details")+'">'; |
---|
| 2782 | tr_signature.style.display = ''; |
---|
| 2783 | } |
---|
| 2784 | else |
---|
| 2785 | { |
---|
| 2786 | td.innerHTML += ' <img style="cursor:pointer" src="templates/'+template+'/images/signed_table.gif" title="'+get_lang("Details")+'">'; |
---|
| 2787 | } |
---|
| 2788 | td.onclick = function(){ |
---|
| 2789 | var _height = Element("div_message_scroll_"+ID).style.height; |
---|
| 2790 | _height = parseInt(_height.replace("px","")); |
---|
| 2791 | var _offset = 130; |
---|
| 2792 | if (this.value == 'more_cert'){ |
---|
| 2793 | this.value = 'hide_cert'; |
---|
| 2794 | Element("div_message_scroll_"+ID).style.height = (_height + _offset)+"px"; |
---|
| 2795 | Element('tr_signature_'+ID).style.display = 'none'; |
---|
| 2796 | Element('td_signature_'+ID).style.display = 'none'; |
---|
[1035] | 2797 | |
---|
[3352] | 2798 | } |
---|
| 2799 | else{ |
---|
| 2800 | this.value = 'more_cert'; |
---|
| 2801 | Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px"; |
---|
| 2802 | Element('tr_signature_'+ID).style.display = ''; |
---|
| 2803 | Element('td_signature_'+ID).style.display = ''; |
---|
| 2804 | } |
---|
[1035] | 2805 | }; |
---|
| 2806 | |
---|
[3352] | 2807 | tr_signature.appendChild(td_signature); |
---|
| 2808 | tbody_message_options.appendChild(tr_signature); |
---|
[1035] | 2809 | } |
---|
| 2810 | //////////// END SIGNATURE //////////////// |
---|
| 2811 | |
---|
[2] | 2812 | table_message_options.appendChild(tbody_message_options); |
---|
| 2813 | td0.appendChild(table_message_options); |
---|
| 2814 | tr0.appendChild(td0); |
---|
| 2815 | tbody_message.appendChild(tr0); |
---|
| 2816 | } |
---|
| 2817 | // IF DRAFT |
---|
| 2818 | else |
---|
| 2819 | { |
---|
| 2820 | var options = document.createElement("TD"); |
---|
[5417] | 2821 | //options.width = "1%"; |
---|
[2] | 2822 | options.setAttribute("noWrap","true"); |
---|
[3021] | 2823 | var option_edit = ' | <span class="message_options" onclick="new_message(\'edit\',\''+ID+'\');">'+get_lang('Edit')+'</span>'; |
---|
| 2824 | var option_print = ' | <span class="message_options" onclick="print_msg(\''+info_msg.msg_folder+'\',\''+info_msg.msg_number+'\',\''+ID+'\');">'+get_lang('Print')+'</span>'; |
---|
[271] | 2825 | var option_hide_more = document.createElement("SPAN"); |
---|
| 2826 | option_hide_more.className = 'message_options'; |
---|
| 2827 | options.align = 'right'; |
---|
| 2828 | option_hide_more.value = 'more_options'; |
---|
| 2829 | option_hide_more.id = 'option_hide_more_'+ID; |
---|
[3021] | 2830 | option_hide_more.innerHTML = get_lang('Show details'); |
---|
[271] | 2831 | option_hide_more.onclick = function(){ |
---|
| 2832 | var _height = Element("div_message_scroll_"+ID).style.height; |
---|
| 2833 | _height = parseInt(_height.replace("px","")); |
---|
| 2834 | var _offset = 35; |
---|
| 2835 | if (this.value == 'more_options'){ |
---|
[3021] | 2836 | this.innerHTML = "<b><u>"+get_lang('Hide details')+"</u></b>"; |
---|
[271] | 2837 | this.value = 'hide_options'; |
---|
| 2838 | Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px"; |
---|
| 2839 | Element('table_message_others_options_'+ID).style.display = ''; |
---|
| 2840 | } |
---|
| 2841 | else{ |
---|
[3021] | 2842 | this.innerHTML = get_lang('Show details'); |
---|
[271] | 2843 | this.value = 'more_options'; |
---|
| 2844 | Element("div_message_scroll_"+ID).style.height = (_height + _offset)+"px"; |
---|
| 2845 | Element('table_message_others_options_'+ID).style.display = 'none'; |
---|
| 2846 | } |
---|
| 2847 | }; |
---|
| 2848 | options.appendChild(option_hide_more); |
---|
[3021] | 2849 | options_actions = document.createElement('SPAN'); |
---|
| 2850 | options_actions.innerHTML = option_edit + option_print; |
---|
| 2851 | options.appendChild(options_actions); |
---|
[2] | 2852 | tr.appendChild(td); |
---|
| 2853 | tr.appendChild(options); |
---|
| 2854 | tr.appendChild(next_previous_msg_td); |
---|
| 2855 | tbody_message_options.appendChild(tr); |
---|
| 2856 | table_message_options.appendChild(tbody_message_options); |
---|
| 2857 | td0.appendChild(table_message_options); |
---|
| 2858 | tr0.appendChild(td0); |
---|
| 2859 | tbody_message.appendChild(tr0); |
---|
[4072] | 2860 | |
---|
[3798] | 2861 | var important_message = document.createElement("INPUT"); |
---|
| 2862 | important_message.id = "is_important_"+ID; |
---|
| 2863 | important_message.name = "is_important"; |
---|
| 2864 | important_message.type = "HIDDEN"; |
---|
| 2865 | important_message.value = (info_msg.Importance == "" || info_msg.Importance == "Normal") ? "0": "1"; |
---|
[4072] | 2866 | |
---|
[3798] | 2867 | options.appendChild(important_message); |
---|
[2] | 2868 | } |
---|
| 2869 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2870 | // END options message. |
---|
| 2871 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2872 | |
---|
| 2873 | var table_message_others_options = document.createElement("TABLE"); |
---|
| 2874 | table_message_others_options.id = 'table_message_others_options_' + ID; |
---|
[3018] | 2875 | table_message_others_options.width = "100%"; |
---|
[2] | 2876 | table_message_others_options.style.display = 'none'; |
---|
[5134] | 2877 | if(navigator.appName.indexOf('Internet Explorer')>0){ |
---|
| 2878 | table_message_others_options.className = "table_message_options_ie"; |
---|
| 2879 | }else{ |
---|
| 2880 | table_message_others_options.className = "table_message_options"; |
---|
| 2881 | } |
---|
| 2882 | |
---|
[2] | 2883 | var tbody_message_others_options = document.createElement("TBODY"); |
---|
| 2884 | var tr1 = document.createElement("TR"); |
---|
| 2885 | tr1.className = "tr_message_header"; |
---|
| 2886 | var td1 = document.createElement("TD"); |
---|
[83] | 2887 | td1.innerHTML = get_lang("From: "); |
---|
[271] | 2888 | td1.appendChild(deny_email(info_msg.from.email)); |
---|
[2] | 2889 | td1.width = "7%"; |
---|
[3035] | 2890 | |
---|
[2] | 2891 | if (info_msg.sender){ |
---|
| 2892 | var tr111 = document.createElement("TR"); |
---|
| 2893 | tr111.className = "tr_message_header"; |
---|
| 2894 | var td111 = document.createElement("TD"); |
---|
| 2895 | td111.innerHTML = get_lang("Sent by")+": "; |
---|
[271] | 2896 | td111.appendChild(deny_email(info_msg.sender.email)); |
---|
[2] | 2897 | td111.setAttribute("noWrap","true"); |
---|
| 2898 | var sender = document.createElement("TD"); |
---|
| 2899 | sender.id = "sender_"+ID; |
---|
| 2900 | var sender_values = document.createElement("INPUT"); |
---|
| 2901 | sender_values.id = "sender_values_"+ID; |
---|
| 2902 | sender_values.type = "HIDDEN"; |
---|
| 2903 | sender_values.value = info_msg.sender.full; //Veio do IMAP, sem images nem links. |
---|
| 2904 | sender.innerHTML += draw_plugin_cc(ID, info_msg.sender.full); |
---|
| 2905 | sender.className = "header_message_field"; |
---|
| 2906 | tr111.appendChild(td111); |
---|
| 2907 | tr111.appendChild(sender); |
---|
| 2908 | tr111.appendChild(sender_values); |
---|
| 2909 | tbody_message_others_options.appendChild(tr111); |
---|
| 2910 | } |
---|
[3035] | 2911 | |
---|
[2] | 2912 | var from = document.createElement("TD"); |
---|
| 2913 | from.id = "from_"+ID; |
---|
| 2914 | from.innerHTML = info_msg.from.full; |
---|
| 2915 | if (info_msg.Draft != "X"){ |
---|
| 2916 | from.innerHTML += draw_plugin_cc(ID, info_msg.from); |
---|
| 2917 | tbody_message_others_options.appendChild(tr1); |
---|
| 2918 | } |
---|
| 2919 | from.className = "header_message_field"; |
---|
| 2920 | var from_values = document.createElement("INPUT"); |
---|
| 2921 | from_values.id = "from_values_"+ID; |
---|
| 2922 | from_values.type = "HIDDEN"; |
---|
| 2923 | from_values.value = info_msg.from.full; //Veio do IMAP, sem images nem links. |
---|
[790] | 2924 | |
---|
[689] | 2925 | var local_message = document.createElement("INPUT"); |
---|
| 2926 | local_message.id = "is_local_"+ID; |
---|
| 2927 | local_message.name = "is_local"; |
---|
| 2928 | local_message.type = "HIDDEN"; |
---|
| 2929 | local_message.value = (info_msg.local_message)?"1":"0"; |
---|
[790] | 2930 | |
---|
[2] | 2931 | tr1.appendChild(td1); |
---|
| 2932 | tr1.appendChild(from); |
---|
| 2933 | tr1.appendChild(from_values); |
---|
[689] | 2934 | tr1.appendChild(local_message); |
---|
| 2935 | |
---|
[2] | 2936 | if (info_msg.reply_to){ |
---|
| 2937 | var tr11 = document.createElement("TR"); |
---|
| 2938 | tr11.className = "tr_message_header"; |
---|
| 2939 | var td11 = document.createElement("TD"); |
---|
| 2940 | td11.innerHTML = get_lang("Reply to")+": "; |
---|
| 2941 | td11.setAttribute("noWrap","true"); |
---|
| 2942 | var reply_to = document.createElement("TD"); |
---|
| 2943 | reply_to.id = "reply_to_"+ID; |
---|
[3035] | 2944 | |
---|
[2] | 2945 | var reply_to_values = document.createElement("INPUT"); |
---|
| 2946 | reply_to_values.id = "reply_to_values_"+ID; |
---|
| 2947 | reply_to_values.type = "HIDDEN"; |
---|
| 2948 | reply_to_values.value = info_msg.reply_to; //Veio do IMAP, sem images nem links. |
---|
| 2949 | reply_to.innerHTML = draw_plugin_cc(ID, info_msg.reply_to); |
---|
| 2950 | reply_to.className = "header_message_field"; |
---|
| 2951 | tr11.appendChild(td11); |
---|
| 2952 | tr11.appendChild(reply_to); |
---|
| 2953 | tr11.appendChild(reply_to_values); |
---|
| 2954 | tbody_message_others_options.appendChild(tr11); |
---|
| 2955 | } |
---|
| 2956 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2957 | var tr2 = document.createElement("TR"); |
---|
| 2958 | tr2.className = "tr_message_header"; |
---|
| 2959 | var td2 = document.createElement("TD"); |
---|
[5134] | 2960 | td2.width = "7%"; |
---|
[83] | 2961 | td2.innerHTML = get_lang("To: "); |
---|
[2] | 2962 | var to = document.createElement("TD"); |
---|
| 2963 | to.id = "to_"+ID; |
---|
| 2964 | |
---|
| 2965 | var to_values = document.createElement("INPUT"); |
---|
| 2966 | to_values.id = "to_values_"+ID; |
---|
| 2967 | to_values.type = "HIDDEN"; |
---|
[3035] | 2968 | to_values.value = info_msg.toaddress2; //Veio do IMAP, sem images nem links. |
---|
[63] | 2969 | // Salva a pasta da mensagem |
---|
[3035] | 2970 | var input_current_folder = document.createElement('input'); |
---|
[63] | 2971 | input_current_folder.id = "input_folder_"+ID; |
---|
| 2972 | input_current_folder.name = "input_folder"; |
---|
| 2973 | input_current_folder.type = "hidden"; |
---|
| 2974 | input_current_folder.value = info_msg.msg_folder; |
---|
[3035] | 2975 | td2.appendChild(input_current_folder); |
---|
[63] | 2976 | // fim |
---|
[3847] | 2977 | // ALEXANDRE LUIZ CORREIA |
---|
| 2978 | if(info_msg.toaddress2 != null ) |
---|
| 2979 | { |
---|
| 2980 | toaddress_array[ID] = info_msg.toaddress2.split(","); |
---|
[4072] | 2981 | |
---|
[3847] | 2982 | if (toaddress_array[ID].length > 1) |
---|
| 2983 | { |
---|
| 2984 | to.innerHTML += draw_plugin_cc(ID, toaddress_array[ID][0]); |
---|
| 2985 | var div_toaddress = document.createElement("SPAN"); |
---|
| 2986 | div_toaddress.id = "div_toaddress_"+ID; |
---|
| 2987 | div_toaddress.style.display=""; |
---|
| 2988 | div_toaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','to');>"+get_lang('more')+"</a>)"; |
---|
| 2989 | to.appendChild(div_toaddress); |
---|
[4072] | 2990 | } |
---|
[3847] | 2991 | else |
---|
| 2992 | { |
---|
| 2993 | toAdd = toaddress_array[ID].toString() |
---|
| 2994 | if( trim(toAdd) != "" ) { |
---|
| 2995 | toAdd = toAdd.replace("<","<").replace(">",">"); |
---|
| 2996 | } else { |
---|
| 2997 | toAdd = get_lang("without destination"); |
---|
| 2998 | } |
---|
[4072] | 2999 | |
---|
[3847] | 3000 | to.innerHTML += draw_plugin_cc(ID,toAdd); |
---|
[3770] | 3001 | } |
---|
[4072] | 3002 | |
---|
[3847] | 3003 | to.className = "header_message_field"; |
---|
| 3004 | tr2.appendChild(td2); |
---|
| 3005 | tr2.appendChild(to); |
---|
| 3006 | tr2.appendChild(to_values); |
---|
[2] | 3007 | } |
---|
[4072] | 3008 | |
---|
[2] | 3009 | tbody_message_others_options.appendChild(tr2); |
---|
| 3010 | |
---|
| 3011 | if (info_msg.cc){ |
---|
| 3012 | var tr3 = document.createElement("TR"); |
---|
| 3013 | tr3.className = "tr_message_header"; |
---|
| 3014 | var td3 = document.createElement("TD"); |
---|
| 3015 | td3.innerHTML = "CC: "; |
---|
| 3016 | var cc = document.createElement("TD"); |
---|
| 3017 | cc.id = "cc_"+ID; |
---|
| 3018 | |
---|
| 3019 | var cc_values = document.createElement("INPUT"); |
---|
| 3020 | cc_values.id = "cc_values_"+ID; |
---|
| 3021 | cc_values.type = "HIDDEN"; |
---|
| 3022 | cc_values.value = info_msg.cc; |
---|
[3035] | 3023 | |
---|
| 3024 | ccaddress_array[ID] = info_msg.cc.split(","); |
---|
[13] | 3025 | if (ccaddress_array[ID].length > 1){ |
---|
[2] | 3026 | var div_ccaddress = document.createElement("SPAN"); |
---|
| 3027 | div_ccaddress.id = "div_ccaddress_"+ID; |
---|
| 3028 | var div_ccaddress_full = document.createElement("SPAN"); |
---|
[3035] | 3029 | div_ccaddress_full.id = "div_ccaddress_full_"+ID; |
---|
[2] | 3030 | div_ccaddress.style.display=""; |
---|
[13] | 3031 | cc.innerHTML = draw_plugin_cc(ID, ccaddress_array[ID][0]); |
---|
| 3032 | div_ccaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','cc');>"+get_lang('more')+"</a>)"; |
---|
| 3033 | cc.appendChild(div_ccaddress); |
---|
[2] | 3034 | } |
---|
| 3035 | else{ |
---|
| 3036 | cc.innerHTML = draw_plugin_cc(ID, info_msg.cc); |
---|
| 3037 | } |
---|
| 3038 | cc.className = "header_message_field"; |
---|
| 3039 | tr3.appendChild(td3); |
---|
| 3040 | tr3.appendChild(cc); |
---|
| 3041 | tr3.appendChild(cc_values); |
---|
| 3042 | tbody_message_others_options.appendChild(tr3); |
---|
| 3043 | } |
---|
[427] | 3044 | |
---|
| 3045 | /* |
---|
| 3046 | * @AUTHOR Rodrigo Souza dos Santos |
---|
| 3047 | * @MODIFY-DATE 2008/09/11 |
---|
| 3048 | * @BRIEF Adding routine to create bcc field if there is one. |
---|
| 3049 | */ |
---|
| 3050 | if (info_msg.bcc) |
---|
| 3051 | { |
---|
| 3052 | var tr3 = document.createElement("tr"); |
---|
| 3053 | tr3.className = "tr_message_header"; |
---|
| 3054 | var td3 = document.createElement("td"); |
---|
| 3055 | td3.innerHTML = get_lang("BCC") + " : "; |
---|
| 3056 | var cco = document.createElement("td"); |
---|
| 3057 | cco.id = "cco_"+ID; |
---|
| 3058 | |
---|
| 3059 | var cco_values = document.createElement("input"); |
---|
| 3060 | cco_values.id = "cco_values_"+ID; |
---|
| 3061 | cco_values.type = "hidden"; |
---|
[1638] | 3062 | cco_values.value = info_msg.bcc; |
---|
[427] | 3063 | |
---|
[3035] | 3064 | ccoaddress_array[ID] = info_msg.bcc.split(","); |
---|
[427] | 3065 | if (ccoaddress_array[ID].length > 1){ |
---|
| 3066 | var div_ccoaddress = document.createElement("SPAN"); |
---|
| 3067 | div_ccoaddress.id = "div_ccoaddress_"+ID; |
---|
| 3068 | var div_ccoaddress_full = document.createElement("SPAN"); |
---|
[3035] | 3069 | div_ccoaddress_full.id = "div_ccoaddress_full_"+ID; |
---|
[427] | 3070 | div_ccoaddress.style.display=""; |
---|
| 3071 | |
---|
| 3072 | //cco.innerHTML = draw_plugin_cc(ID, ccoaddress_array[ID][0]); |
---|
| 3073 | cco.innerHTML = ccoaddress_array[ID][0]; |
---|
| 3074 | div_ccoaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','cco');>"+get_lang('more')+"</a>)"; |
---|
| 3075 | cco.appendChild(div_ccoaddress); |
---|
| 3076 | } |
---|
| 3077 | else{ |
---|
| 3078 | //cco.innerHTML = draw_plugin_cc(ID, info_msg.cco); |
---|
| 3079 | cco.innerHTML = info_msg.bcc; |
---|
| 3080 | } |
---|
| 3081 | cco.className = "header_message_field"; |
---|
| 3082 | tr3.appendChild(td3); |
---|
| 3083 | tr3.appendChild(cco); |
---|
| 3084 | tr3.appendChild(cco_values); |
---|
| 3085 | tbody_message_others_options.appendChild(tr3); |
---|
| 3086 | } |
---|
| 3087 | |
---|
[2] | 3088 | var tr4 = document.createElement("TR"); |
---|
| 3089 | tr4.className = "tr_message_header"; |
---|
| 3090 | var td4 = document.createElement("TD"); |
---|
[83] | 3091 | td4.innerHTML = get_lang("Date: "); |
---|
[2] | 3092 | var date = document.createElement("TD"); |
---|
| 3093 | date.id = "date_"+ID; |
---|
| 3094 | date.innerHTML = info_msg.fulldate; |
---|
| 3095 | var date_day = document.createElement("INPUT"); |
---|
| 3096 | date_day.id = "date_day_"+ID; |
---|
| 3097 | date_day.type = "HIDDEN"; |
---|
| 3098 | date_day.value = info_msg.msg_day; |
---|
| 3099 | var date_hour = document.createElement("INPUT"); |
---|
| 3100 | date_hour.id = "date_hour_"+ID; |
---|
| 3101 | date_hour.type = "HIDDEN"; |
---|
| 3102 | date_hour.value = info_msg.msg_hour |
---|
| 3103 | date.className = "header_message_field"; |
---|
| 3104 | tr4.appendChild(td4); |
---|
| 3105 | tr4.appendChild(date); |
---|
| 3106 | tr4.appendChild(date_day); |
---|
| 3107 | tr4.appendChild(date_hour); |
---|
| 3108 | tbody_message_others_options.appendChild(tr4); |
---|
[3035] | 3109 | |
---|
[2] | 3110 | var tr5 = document.createElement("TR"); |
---|
| 3111 | tr5.className = "tr_message_header"; |
---|
| 3112 | var td5 = document.createElement("TD"); |
---|
[83] | 3113 | td5.innerHTML = get_lang("Subject"); |
---|
[2] | 3114 | var subject = document.createElement("TD"); |
---|
| 3115 | subject.id = "subject_"+ID; |
---|
[6109] | 3116 | subject.innerHTML = html_entities(info_msg.subject); |
---|
[2] | 3117 | subject.className = "header_message_field"; |
---|
[5804] | 3118 | if(defaultCalendar == "expressoCalendar" && $("#expressoCalendarid")[0]){ |
---|
[5392] | 3119 | var new_event_logo = document.createElement("IMG"); |
---|
| 3120 | new_event_logo.title = "Criar evento a partir deste email"; |
---|
| 3121 | new_event_logo.alt = "Criar evento a partir deste email"; |
---|
| 3122 | new_event_logo.src = "./templates/default/images/calendar_add.png"; |
---|
| 3123 | new_event_logo.style.cursor = "pointer"; |
---|
| 3124 | new_event_logo.style.marginLeft = "5px"; |
---|
| 3125 | new_event_logo.onclick = function(){ |
---|
[5619] | 3126 | import_implements_calendar(); |
---|
| 3127 | |
---|
| 3128 | |
---|
[5392] | 3129 | DataLayer.dispatchPath = "../prototype/"; |
---|
| 3130 | var path = "../prototype/modules/calendar/"; |
---|
[5409] | 3131 | |
---|
| 3132 | var startEvent = new Date(); |
---|
| 3133 | if(startEvent.toString('mm') < 30) |
---|
| 3134 | startEvent.add({minutes: (30 - parseInt(startEvent.toString('mm')))}); |
---|
| 3135 | else |
---|
| 3136 | startEvent.add({hours: 1, minutes: '-'+startEvent.toString('mm')}); |
---|
| 3137 | var endEvent = function(date){ |
---|
| 3138 | if(!!User.preferences.defaultCalendar){ |
---|
[5592] | 3139 | return new Date(parseInt(date.getTime()) + |
---|
| 3140 | (!!Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration ? |
---|
[5409] | 3141 | (Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration * 60000) : |
---|
| 3142 | (User.preferences.defaultDuration * 60000) |
---|
[5592] | 3143 | )); |
---|
[5409] | 3144 | }else |
---|
[5592] | 3145 | return new Date(parseInt(date.getTime()) + (User.preferences.defaultDuration * 60000)); |
---|
[5409] | 3146 | }; |
---|
[5592] | 3147 | |
---|
| 3148 | var emails = $("#to_values_"+ID).val().split(','); |
---|
| 3149 | |
---|
| 3150 | |
---|
| 3151 | //Normalização dos dados evita ter que reemplementar toda as funcionalidades do calendar |
---|
[5392] | 3152 | eventDetails({ |
---|
[5592] | 3153 | |
---|
| 3154 | acl: {inviteGuests: true, organization: true ,participationRequired: false, read: true, write: true}, |
---|
| 3155 | alarms: [], |
---|
| 3156 | allDay: false, |
---|
| 3157 | attachments: [], |
---|
[6332] | 3158 | isAttendee: true, |
---|
[6393] | 3159 | attendee: '',//TODOOOOOO, |
---|
[5592] | 3160 | calendar: User.preferences.defaultCalendar ? User.preferences.defaultCalendar : Calendar.calendars[0], |
---|
| 3161 | calendars: Calendar.calendars, |
---|
| 3162 | category: '', |
---|
[5658] | 3163 | 'class': '1', |
---|
[5592] | 3164 | delegatedFrom: {}, |
---|
| 3165 | endDate: startEvent.toString(User.preferences.dateFormat), |
---|
| 3166 | startDate: endEvent(startEvent).toString(User.preferences.dateFormat), |
---|
| 3167 | startHour: startEvent.toString(User.preferences.hourFormat), |
---|
| 3168 | endHour: endEvent(startEvent).toString(User.preferences.hourFormat), |
---|
[6393] | 3169 | timezone: User.preferences.defaultCalendar ? Calendar.signatureOf[User.preferences.defaultCalendar].calendar.timezone : User.preferences.timezone, |
---|
[5392] | 3170 | summary : $("#subject_"+ID).text(), |
---|
| 3171 | description : $("#body_" + ID).text(), |
---|
[5409] | 3172 | startTime: startEvent.getTime(), |
---|
[5592] | 3173 | endTime: endEvent(startEvent), |
---|
| 3174 | timezones: Timezone.timezones, |
---|
| 3175 | me: {name: User.me.name, mail: User.me.mail, acl: 'rowi', status: '1', delegatedFrom: '0', id: User.me.id}, |
---|
| 3176 | organizer: {name: User.me.name, mail: User.me.mail, acl: 'rowi', status: '1', delegatedFrom: '0' , id: User.me.id}, |
---|
| 3177 | statusParticipants: {accepted: 0, cancelled: 0, tentative: 0, unanswered:emails.length}, |
---|
| 3178 | location: '', |
---|
| 3179 | attendee: $.map(emails, function( mail ){ |
---|
[6599] | 3180 | var contact = false; |
---|
[5592] | 3181 | var decoded = Encoder.htmlDecode(mail); |
---|
| 3182 | var newAttendeeName = ""; |
---|
[5389] | 3183 | |
---|
[6599] | 3184 | var name = decoded.match(/"([^"]*)"/) ? decoded.match(/"([^"]*)"/)[1] : ''; |
---|
| 3185 | var mail = decoded.match(/<([^<]*)>[\s]*$/) ? decoded.match(/<([^<]*)>[\s]*$/)[1].toLowerCase() : decoded; |
---|
| 3186 | |
---|
| 3187 | |
---|
| 3188 | var user = DataLayer.get('user', ["=", "mail", mail], true); |
---|
[5592] | 3189 | |
---|
| 3190 | if( $.type(user) == "array") |
---|
[6580] | 3191 | user = user[0]; |
---|
[5392] | 3192 | |
---|
[6599] | 3193 | if(user != ''){ |
---|
| 3194 | //user = {name : name , mail : mail}; |
---|
| 3195 | if(User.me.mail == user.mail) |
---|
| 3196 | return(null); |
---|
| 3197 | user.isExternal = (!!user && !(!!user.isExternal)) ? 0 : 1; |
---|
[6580] | 3198 | |
---|
[6599] | 3199 | return DataLayer.merge({ |
---|
| 3200 | name: user.name, |
---|
| 3201 | mail: user.mail, |
---|
| 3202 | acl: 'r', |
---|
| 3203 | delegatedFrom: '0', |
---|
| 3204 | status: '4', |
---|
| 3205 | isExternal: user.isExternal |
---|
| 3206 | }, !!user.id ? {id : DataLayer.put('participant', {user: user.id, isExternal: user.isExternal})} : {id: DataLayer.put('participant', {user: user})}); |
---|
| 3207 | }else if(mail.match(/[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])/)){ |
---|
| 3208 | |
---|
| 3209 | var userId = DataLayer.put('user', { |
---|
| 3210 | name: name, |
---|
| 3211 | mail: mail, |
---|
| 3212 | isExternal: '1' |
---|
| 3213 | }); |
---|
| 3214 | var newAttendeeId = DataLayer.put('participant', { |
---|
| 3215 | user: userId, |
---|
| 3216 | isExternal: '1' |
---|
| 3217 | }); |
---|
[5592] | 3218 | |
---|
[6599] | 3219 | return { |
---|
| 3220 | id: newAttendeeId, |
---|
| 3221 | name: name, |
---|
| 3222 | mail: mail, |
---|
| 3223 | acl: 'r', |
---|
| 3224 | delegatedFrom: '0', |
---|
| 3225 | status: '4', |
---|
| 3226 | isExternal: '1' |
---|
| 3227 | }; |
---|
| 3228 | |
---|
| 3229 | }else |
---|
| 3230 | return (null); |
---|
[5592] | 3231 | }) |
---|
[5392] | 3232 | |
---|
[5592] | 3233 | }, true, path, true); |
---|
[5392] | 3234 | } |
---|
| 3235 | subject.appendChild(new_event_logo); |
---|
[5389] | 3236 | } |
---|
[2] | 3237 | tr5.appendChild(td5); |
---|
| 3238 | tr5.appendChild(subject); |
---|
| 3239 | tbody_message_others_options.appendChild(tr5); |
---|
[4493] | 3240 | //k! |
---|
[5535] | 3241 | |
---|
| 3242 | |
---|
[5866] | 3243 | var update_labeleds_msg = function(){ |
---|
| 3244 | //TODO Mudar quando API abstrair atualizações no cache |
---|
| 3245 | DataLayer.remove('labeled', false); |
---|
[6109] | 3246 | //DataLayer.get('labeled'); |
---|
[5866] | 3247 | var labels = DataLayer.get("labeled", {filter: [ |
---|
| 3248 | 'AND', |
---|
| 3249 | ['=', 'folderName', current_folder], |
---|
| 3250 | ['=','messageNumber',folder_id]], |
---|
| 3251 | criteria : {deepness: 2}} ); |
---|
[5535] | 3252 | |
---|
[5866] | 3253 | if(labels.length != 0){ |
---|
| 3254 | var tr8 = document.createElement("TR"); |
---|
| 3255 | tr8.className = "tr_message_header"; |
---|
| 3256 | var td8 = document.createElement("TD"); |
---|
| 3257 | td8.innerHTML = get_lang("Labels: "); |
---|
| 3258 | var markers = document.createElement("TD"); |
---|
| 3259 | markers.id = "markers_"+ID; |
---|
[5535] | 3260 | |
---|
[5866] | 3261 | for(var i=0; i<labels.length; i++){ |
---|
| 3262 | fontColor = labels[i].label.fontColor; |
---|
| 3263 | borderColor = labels[i].label.borderColor; |
---|
| 3264 | backgroundColor = labels[i].label.backgroundColor; |
---|
| 3265 | nameLabel = labels[i].label.name; |
---|
| 3266 | id = labels[i].id; |
---|
| 3267 | markers.innerHTML+= "<div style='height: 15px; background:"+backgroundColor+"; float: left; -webkit-border-radius: 3px; -moz-border-radius: 3px; margin:0 0 1px 1px; border: 1px solid "+borderColor+"'><span style='color: "+fontColor+"; margin: 5px;'>"+nameLabel+"</span><span class='removeLabeledMsg' id='"+id+"' title='"+get_lang("Remove Label")+"'>x</span></div>"; |
---|
| 3268 | |
---|
| 3269 | } |
---|
| 3270 | $(markers).find('span.removeLabeledMsg').click(function(event){ |
---|
| 3271 | var id_labeled = $(event.target).attr("id"); |
---|
| 3272 | //TODO Mudar quando API abstrair atualizações no cache |
---|
[6109] | 3273 | //DataLayer.remove('labeled', false); |
---|
| 3274 | //DataLayer.get('labeled'); |
---|
[5866] | 3275 | DataLayer.remove('labeled', id_labeled); |
---|
| 3276 | DataLayer.commit(false, false, function(){ |
---|
| 3277 | var index_folder = id_labeled.lastIndexOf('/'); |
---|
| 3278 | var folder_name = id_labeled.slice(0,index_folder); |
---|
| 3279 | var index_number = id_labeled.lastIndexOf('#'); |
---|
| 3280 | var msg_number = id_labeled.slice(index_folder + 1,index_number); |
---|
| 3281 | updateLabelsColumn({msg_number:msg_number, boxname:folder_name, labels:false}); |
---|
| 3282 | update_labeleds_msg(); |
---|
| 3283 | tbody_message_others_options.removeChild(tr8); |
---|
| 3284 | }); |
---|
| 3285 | |
---|
| 3286 | }); |
---|
| 3287 | markers.className = "header_message_field"; |
---|
| 3288 | tr8.appendChild(td8); |
---|
| 3289 | tr8.appendChild(markers); |
---|
| 3290 | tbody_message_others_options.appendChild(tr8); |
---|
[5535] | 3291 | } |
---|
| 3292 | } |
---|
[5967] | 3293 | |
---|
[4493] | 3294 | if ( info_msg.attachments && info_msg.attachments.length > 0 ) |
---|
| 3295 | { |
---|
[5134] | 3296 | //Código no padrão expresso 2.2 |
---|
| 3297 | var tr6 = document.createElement("TR"); |
---|
| 3298 | tr6.className = "tr_message_header"; |
---|
| 3299 | var td6 = document.createElement("TD"); |
---|
| 3300 | td6.innerHTML = get_lang("Attachments: "); |
---|
[4493] | 3301 | |
---|
| 3302 | |
---|
[5134] | 3303 | var attachments = document.createElement("TD"); |
---|
| 3304 | td6.valign = "top"; |
---|
| 3305 | attachments.align = 'left'; |
---|
| 3306 | if(info_msg.attachments.length >= 1){ |
---|
[4820] | 3307 | if(info_msg.attachments.length > 1) { |
---|
| 3308 | var link_attachment = document.createElement("A"); |
---|
| 3309 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
| 3310 | link_attachment.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3311 | else |
---|
| 3312 | link_attachment.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3313 | link_attachment.innerHTML = " "+info_msg.attachments.length+' '+get_lang('files')+' :: '+get_lang('Download all atachments'); |
---|
[5134] | 3314 | attachments.appendChild(link_attachment); |
---|
[4820] | 3315 | } |
---|
| 3316 | if(parseInt(preferences.remove_attachments_function)) |
---|
| 3317 | { |
---|
[5134] | 3318 | attachments.appendChild(document.createTextNode(' ')); |
---|
| 3319 | var del_attachments = document.createElement("A"); |
---|
| 3320 | del_attachments.setAttribute("href", "javascript:remove_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3321 | del_attachments.innerHTML = get_lang('remove all attachments'); |
---|
| 3322 | attachments.appendChild(del_attachments); |
---|
[4820] | 3323 | } |
---|
[5134] | 3324 | attachments.appendChild(document.createElement('BR')); |
---|
| 3325 | } |
---|
| 3326 | attachments.id = "attachments_" + ID; |
---|
[4493] | 3327 | for (var i=0; i<info_msg.attachments.length; i++) |
---|
| 3328 | { |
---|
[5134] | 3329 | var link_attachment = document.createElement("a"); |
---|
[689] | 3330 | link_attachment.setAttribute("href", proxy_mensagens.link_anexo(info_msg,i)); |
---|
[4493] | 3331 | link_attachment.innerHTML = url_decode(info_msg.attachments[i].name) + " ("+borkb(info_msg.attachments[i].fsize)+")"; |
---|
[5134] | 3332 | //link_attachment.innerHTML += " ("+borkb(info_msg.attachments[i].fsize)+")"; |
---|
[4072] | 3333 | |
---|
[4493] | 3334 | //k trocar por match??? |
---|
| 3335 | if((url_decode(info_msg.attachments[i].name).indexOf(".ics")!=-1) || (url_decode(info_msg.attachments[i].name).indexOf(".vcard")!=-1)) |
---|
[3519] | 3336 | { |
---|
[620] | 3337 | //Link para importar calendário |
---|
[673] | 3338 | var link_import_attachment = new Image(); |
---|
[790] | 3339 | link_import_attachment.src = "templates/"+template+"/images/new.png"; |
---|
[3519] | 3340 | 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+"'); return false;"); |
---|
[673] | 3341 | link_import_attachment.title = get_lang("Import to calendar"); |
---|
[3035] | 3342 | link_import_attachment.align = "top"; |
---|
[3519] | 3343 | link_import_attachment.style.marginLeft = "5px"; |
---|
[673] | 3344 | link_import_attachment.style.cursor = "pointer"; |
---|
[3519] | 3345 | link_attachment.appendChild(link_import_attachment); |
---|
[620] | 3346 | } |
---|
[4820] | 3347 | |
---|
[5134] | 3348 | if((url_decode(info_msg.attachments[i].name).indexOf(".eml") != -1)) |
---|
| 3349 | { |
---|
| 3350 | //Link para importar calendário |
---|
| 3351 | var link_open_msg = new Image(); |
---|
| 3352 | link_open_msg.src = "templates/"+template+"/images/email.png"; |
---|
| 3353 | //link_open_msg.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+"'); return false;"); |
---|
| 3354 | link_open_msg.setAttribute("onclick","javascript:open_msg_part('"+info_msg.msg_folder+"&msg_number="+info_msg.msg_number+"&msg_part="+info_msg.attachments[i].pid+"'); return false;"); |
---|
| 3355 | link_open_msg.title = get_lang("Open message"); |
---|
| 3356 | link_open_msg.align = "top"; |
---|
| 3357 | link_open_msg.style.marginLeft = "5px"; |
---|
| 3358 | link_open_msg.style.cursor = "pointer"; |
---|
| 3359 | link_attachment.appendChild(link_open_msg); |
---|
[2] | 3360 | } |
---|
[4493] | 3361 | |
---|
[5134] | 3362 | link_attachment.innerHTML += '<br/>'; |
---|
| 3363 | attachments.appendChild(link_attachment); |
---|
| 3364 | } |
---|
[2] | 3365 | tr6.appendChild(td6); |
---|
[5134] | 3366 | tr6.appendChild(attachments); |
---|
[2] | 3367 | tbody_message_others_options.appendChild(tr6); |
---|
[4820] | 3368 | } |
---|
[5134] | 3369 | |
---|
[4493] | 3370 | //k!! |
---|
[6463] | 3371 | |
---|
[2] | 3372 | var div = document.createElement("DIV"); |
---|
| 3373 | div.id = "div_message_scroll_"+ID; |
---|
[5134] | 3374 | div.style.background = 'WHITE'; |
---|
| 3375 | div.style.overflow = "auto"; |
---|
[2] | 3376 | table_message_others_options.appendChild(tbody_message_others_options); |
---|
| 3377 | var tr = document.createElement("TR"); |
---|
[5134] | 3378 | tr.className = "tr_message_header"; |
---|
[2] | 3379 | var td = document.createElement("TD"); |
---|
[5134] | 3380 | td.colspan = '2'; |
---|
[5083] | 3381 | td.style.fontSize = '10pt'; |
---|
| 3382 | td.style.fontFamily = 'Arial,Verdana'; |
---|
| 3383 | td.style.verticalAlign = 'top'; |
---|
| 3384 | td.style.height = '100%'; |
---|
[2] | 3385 | div.appendChild(table_message_others_options); |
---|
[3018] | 3386 | var imgTag = info_msg.body.match(/(<img[^>]*src[^>=]*=['"]?[^'">]*["']?[^>]*>)|(<[^>]*(style[^=>]*=['"][^>]*background(-image)?:[^:;>]*url\()[^>]*>)/gi); |
---|
[790] | 3387 | var newBody = info_msg.body; |
---|
| 3388 | if(!info_msg.showImg && imgTag) |
---|
| 3389 | { |
---|
| 3390 | var domains = ''; |
---|
| 3391 | var blocked = false; |
---|
| 3392 | var forbidden = true; |
---|
[1637] | 3393 | |
---|
| 3394 | if (preferences.notification_domains != null && typeof(preferences.notification_domains) != 'undefined') |
---|
| 3395 | { |
---|
[790] | 3396 | domains = preferences.notification_domains.split(','); |
---|
[1637] | 3397 | for(var j = 0; j < imgTag.length; j++) |
---|
[790] | 3398 | { |
---|
[1637] | 3399 | for (var i = 0; i < domains.length; i++) |
---|
| 3400 | { |
---|
[5134] | 3401 | if (imgTag[j].match(/cid:([\w\d]){5,}/) || imgTag[j].match(/src=\"\.\/inc\/get_archive\.php/g)) |
---|
[3018] | 3402 | { |
---|
| 3403 | forbidden = false; |
---|
| 3404 | continue; |
---|
| 3405 | } |
---|
[1637] | 3406 | imgSource = imgTag[j].match(/=['"](http:\/\/)+[^'"\/]*/); |
---|
| 3407 | if (imgSource && imgSource.toString().substr(5).match(domains[i])) |
---|
| 3408 | forbidden = false; |
---|
| 3409 | } |
---|
| 3410 | if (forbidden) |
---|
| 3411 | { |
---|
[5134] | 3412 | newBody = newBody.replace(imgTag[j],"<img src='templates/"+template+"/images/forbidden.png'>"); |
---|
[1637] | 3413 | blocked=true; |
---|
| 3414 | } |
---|
[790] | 3415 | } |
---|
[1637] | 3416 | if (blocked) |
---|
[790] | 3417 | { |
---|
[1637] | 3418 | var showImgLink = document.createElement('DIV'); |
---|
[1711] | 3419 | showImgLink.id="show_img_link_"+ID; |
---|
[1637] | 3420 | showImgLink.onclick = function(){show_msg_img(info_msg.msg_number,info_msg.msg_folder)}; |
---|
| 3421 | showImgLink.className="show_img_link"; |
---|
| 3422 | showImgLink.innerHTML = get_lang("Show images from")+": "+info_msg.from.email; |
---|
| 3423 | td.appendChild(showImgLink); |
---|
[790] | 3424 | } |
---|
| 3425 | } |
---|
| 3426 | } |
---|
[2] | 3427 | td.appendChild(div); |
---|
| 3428 | tr.appendChild(td) |
---|
| 3429 | tbody_message.appendChild(tr); |
---|
| 3430 | |
---|
| 3431 | |
---|
[3035] | 3432 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[2] | 3433 | //Make the body message. |
---|
[790] | 3434 | /////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[2] | 3435 | var tr = document.createElement("TR"); |
---|
| 3436 | tr.className = "tr_message_body"; |
---|
| 3437 | var td = document.createElement("TD"); |
---|
| 3438 | //td.setAttribute("colSpan","2"); |
---|
[5301] | 3439 | |
---|
| 3440 | //Comentado pois estes replaces e a tentativa de remover as tags <span> vazias faz com que seja |
---|
| 3441 | //eliminado os estilos aplicados no corpo do texto quando utilizado o Firefox. |
---|
| 3442 | //newBody = newBody.replace("<body","<span"); |
---|
| 3443 | //newBody = newBody.replace("<BODY","<span"); |
---|
| 3444 | //while ( ( /<span[^>]*><span[^>]*>/ig ).test( newBody ) ) |
---|
| 3445 | // newBody = newBody.replace( /(<span[^>]*>)<span[^>]*>/ig, '$1' ); |
---|
[3018] | 3446 | |
---|
[3035] | 3447 | var _body = document.createElement( 'div' ); |
---|
| 3448 | _body.id = 'body_' + ID; |
---|
| 3449 | _body.innerHTML = newBody; |
---|
[5476] | 3450 | _body.style.marginLeft = '5px'; |
---|
[3018] | 3451 | |
---|
[3035] | 3452 | var _elements = _body.getElementsByTagName( '*' ); |
---|
| 3453 | for( var i = 0; i < _elements.length; i++ ) |
---|
| 3454 | if ( _elements[ i ].attributes && _elements[ i ].attributes.getNamedItem( 'id' ) ) |
---|
[5369] | 3455 | _elements[ i ].attributes.removeNamedItem( 'id' ); |
---|
| 3456 | |
---|
[3035] | 3457 | div.appendChild( _body ); |
---|
[5370] | 3458 | |
---|
| 3459 | //window.setTimeout(function() { $("#div_message_scroll_"+ID).focus() },250); |
---|
[3018] | 3460 | |
---|
[3035] | 3461 | function mailto( link ) |
---|
| 3462 | { |
---|
| 3463 | var mail = link.href.substr( 7 ); |
---|
| 3464 | link.onclick = function( ) |
---|
| 3465 | { |
---|
| 3466 | new_message_to( mail ); |
---|
| 3467 | return false; |
---|
| 3468 | }; |
---|
| 3469 | } |
---|
| 3470 | var links = div.getElementsByTagName( 'a' ); |
---|
| 3471 | for ( var i = 0; i < links.length; i++ ){ |
---|
| 3472 | try{ |
---|
| 3473 | if ( links.item( i ).href.indexOf( 'mailto:' ) === 0 ){ |
---|
| 3474 | mailto( links.item( i ) ); |
---|
| 3475 | } |
---|
| 3476 | else{ |
---|
[4072] | 3477 | var anchor_pattern = "http://"+location.host+location.pathname+"#"; |
---|
| 3478 | |
---|
| 3479 | if ( ( links.item( i ).href.indexOf( 'javascript:' ) !== 0 ) && |
---|
[3393] | 3480 | (links.item( i ).href.indexOf(anchor_pattern) !== 0) ) //se não for âncora |
---|
| 3481 | links.item( i ).setAttribute( 'target', '_blank' ); |
---|
[3035] | 3482 | } |
---|
| 3483 | }catch(e){ |
---|
| 3484 | } |
---|
[3369] | 3485 | } |
---|
[3035] | 3486 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[2] | 3487 | //Make the thumbs of the message. |
---|
| 3488 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[4493] | 3489 | //k |
---|
| 3490 | |
---|
[4820] | 3491 | if ((info_msg.thumbs)&&(info_msg.thumbs.length > 0)){ |
---|
[5134] | 3492 | var thumbs = jQuery.parseJSON(info_msg.thumbs); |
---|
| 3493 | var div_thumbs = document.createElement("div"); |
---|
| 3494 | |
---|
[4493] | 3495 | div_thumbs.setAttribute("class", "expressomail-thumbs"); |
---|
| 3496 | div_thumbs.setAttribute("className", "expressomail-thumbs"); //for IE |
---|
| 3497 | |
---|
| 3498 | var div_thumbs_lbl = document.createElement("DIV"); |
---|
| 3499 | div_thumbs_lbl.setAttribute("class", "expressomail-thumbs-label"); |
---|
| 3500 | div_thumbs_lbl.setAttribute("className", "expressomail-thumbs-label"); //for IE |
---|
| 3501 | |
---|
| 3502 | var div_thumbs_lbl_sp = document.createElement("SPAN"); |
---|
| 3503 | div_thumbs_lbl_sp.setAttribute("class", "message_options"); |
---|
| 3504 | div_thumbs_lbl_sp.setAttribute("className", "message_options"); //for IE |
---|
| 3505 | var div_thumbs_lbl_st = document.createElement("STRONG"); |
---|
| 3506 | div_thumbs_lbl_st.innerHTML = info_msg.attachments.length+" "+get_lang("attachment")+(info_msg.attachments.length > 1 ? "s" : "")+" "+get_lang("in this message"); |
---|
| 3507 | var div_thumbs_lbl_a = document.createElement("A"); |
---|
| 3508 | |
---|
[4820] | 3509 | if(info_msg.thumbs.length > 1){ |
---|
| 3510 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
[4493] | 3511 | div_thumbs_lbl_a.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
[3035] | 3512 | else |
---|
[4493] | 3513 | div_thumbs_lbl_a.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3514 | div_thumbs_lbl_a.innerHTML = get_lang('Download all atachments'); |
---|
| 3515 | } else { |
---|
| 3516 | div_thumbs_lbl_a.setAttribute("style", "display:none; visibility:hidden;"); |
---|
[2] | 3517 | } |
---|
[3035] | 3518 | |
---|
[4493] | 3519 | div_thumbs_lbl_sp.appendChild(div_thumbs_lbl_st); |
---|
| 3520 | div_thumbs_lbl_sp.appendChild(document.createTextNode(' :: ')); |
---|
| 3521 | div_thumbs_lbl_sp.appendChild(div_thumbs_lbl_a); |
---|
| 3522 | div_thumbs_lbl.appendChild(div_thumbs_lbl_sp); |
---|
[4820] | 3523 | |
---|
[4493] | 3524 | var div_thumbs_lbl_sp2 = document.createElement("SPAN"); |
---|
| 3525 | div_thumbs_lbl_sp2.setAttribute("class", "message_tips"); |
---|
| 3526 | div_thumbs_lbl_sp2.setAttribute("className", "message_tips"); //for IE |
---|
| 3527 | div_thumbs_lbl_sp2.innerHTML = get_lang("<strong>Tip:</strong> <span>For faster save, click over the image with <em>right button</em>.</span>"); |
---|
[4820] | 3528 | |
---|
[4493] | 3529 | var ul_thumbs_list = document.createElement("UL"); |
---|
| 3530 | ul_thumbs_list.setAttribute("class", "expressomail-thumbs-list"); |
---|
| 3531 | ul_thumbs_list.setAttribute("className", "expressomail-thumbs-list"); //for IE |
---|
[3035] | 3532 | |
---|
[5134] | 3533 | var msg = info_msg.msg_number; |
---|
| 3534 | var fdr = info_msg.msg_folder; |
---|
| 3535 | var i = 0; |
---|
| 3536 | //verifica se está no novo padrão de montagem das mensagens ou no antigo, necessário |
---|
| 3537 | //para exibir as imagens no arquivamento local arquivamento local. |
---|
| 3538 | if(thumbs){ |
---|
| 3539 | jQuery.each(thumbs, function(i, thumb) { |
---|
| 3540 | if(fdr.indexOf("local_") >= 0){ |
---|
| 3541 | var href = info_msg.array_attach[i].url + '&image=true'; |
---|
| 3542 | var src = info_msg.array_attach[i].url+ '&image=thumbnail'; |
---|
| 3543 | i++; |
---|
| 3544 | }else{ |
---|
| 3545 | var href = './inc/get_archive.php?msgFolder=' + fdr + '&msgNumber=' + msg + '&indexPart=' + thumb.pid + '&image=true'; |
---|
| 3546 | //var href = thumb.url; |
---|
| 3547 | var src = 'inc/get_archive.php?msgFolder=' + fdr + '&msgNumber=' + msg + '&indexPart=' + thumb.pid + '&image=thumbnail'; |
---|
| 3548 | } |
---|
| 3549 | var msgid= fdr+";;"+msg+";;"+i+";;"+thumb.pid+";;"+thumb.encoding; |
---|
| 3550 | var image_info = '{"folder":"'+fdr+'","message":"'+msg+'","thumbIndex":"'+i+'","pid":"'+thumb.pid+'","encoding":"'+thumb.encoding+'","type":"'+thumb.type+'"}'; |
---|
| 3551 | |
---|
| 3552 | var image= '<img id="' + msgid + '" title="' + |
---|
| 3553 | get_lang('Click here do view (+)') + '" src="' + src + '" style="width:auto;height:100%;" />'; |
---|
| 3554 | |
---|
| 3555 | var content = '<a title="'+thumb.name+ '" rel="thumbs'+ID+'" class="expressomail-thumbs-link" onMouseDown="save_image(event,this,\'' +thumb.type+'\')" href="'+href+'" onclick="window.open(\''+href+'\',\'mywindow\',\'width=700,height=600,scrollbars=yes\');return false;">'+image+'</a>'; |
---|
| 3556 | content += '<input id="thumb_'+ID+'_'+i+'" type="hidden" value="' +escape(image_info) +'" />'; |
---|
| 3557 | jQuery(ul_thumbs_list).append('<li>'+content+'</li>'); |
---|
| 3558 | |
---|
| 3559 | }); |
---|
[4493] | 3560 | |
---|
| 3561 | div_thumbs.appendChild(div_thumbs_lbl); |
---|
| 3562 | div_thumbs.appendChild(div_thumbs_lbl_sp2); |
---|
| 3563 | div_thumbs.appendChild(ul_thumbs_list); |
---|
| 3564 | |
---|
[5134] | 3565 | }else{ |
---|
| 3566 | div_thumbs.appendChild(div_thumbs_lbl); |
---|
| 3567 | div_thumbs.appendChild(div_thumbs_lbl_sp2); |
---|
| 3568 | div_thumbs.innerHTML = div_thumbs.innerHTML + info_msg.thumbs; |
---|
| 3569 | |
---|
| 3570 | |
---|
| 3571 | } |
---|
| 3572 | |
---|
[4493] | 3573 | div.appendChild(div_thumbs); |
---|
[2] | 3574 | } |
---|
[4493] | 3575 | //k!! |
---|
[2] | 3576 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 3577 | table_message.appendChild(tbody_message); |
---|
| 3578 | content.appendChild(table_message); |
---|
[3035] | 3579 | resizeWindow(); |
---|
[2] | 3580 | var msg_number = document.createElement('INPUT'); |
---|
| 3581 | msg_number.id = "msg_number_" + ID; |
---|
| 3582 | msg_number.type = "hidden"; |
---|
| 3583 | msg_number.value = info_msg.msg_number; |
---|
| 3584 | content.appendChild(msg_number); |
---|
| 3585 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[3165] | 3586 | |
---|
| 3587 | //Exibe o cabecalho da mensagem totalmente aberto caso esteja setado nas preferencias do usuario |
---|
| 3588 | if (preferences.show_head_msg_full == 1) |
---|
| 3589 | { |
---|
| 3590 | option_hide_more.onclick(); |
---|
[3168] | 3591 | if (Element('div_toaddress_'+ID) != null) |
---|
| 3592 | show_div_address_full(ID,'to'); |
---|
| 3593 | if (Element('div_ccaddress_'+ID) != null) |
---|
| 3594 | show_div_address_full(ID,'cc'); |
---|
[3165] | 3595 | } |
---|
[4820] | 3596 | |
---|
[4493] | 3597 | /* |
---|
| 3598 | * TODO: implementar o controle como preferência do usuário |
---|
| 3599 | * |
---|
| 3600 | */ |
---|
| 3601 | var jcarousel = false; |
---|
| 3602 | if (jcarousel) { |
---|
[5134] | 3603 | //carousel |
---|
[4493] | 3604 | jQuery(document).ready(function() { |
---|
[5134] | 3605 | jQuery('.expressomail-thumbs-list').attr('id', 'expressomail-thumbs-list'+ID) |
---|
| 3606 | .addClass('jcarousel-skin-default').jcarousel(); |
---|
| 3607 | |
---|
| 3608 | jQuery('.expressomail-thumbs-link img').attr('style', ''); |
---|
[4493] | 3609 | |
---|
| 3610 | //fancybox |
---|
| 3611 | jQuery(".expressomail-thumbs-list li a").attr('onclick', 'return true;'); |
---|
| 3612 | jQuery(".expressomail-thumbs-list li a").fancybox({ |
---|
| 3613 | 'hideOnContentClick': true, |
---|
[5134] | 3614 | 'type': 'image', |
---|
| 3615 | 'titlePosition': 'over', |
---|
| 3616 | 'titleFormat' : function(name, currentArray, currentIndex, currentOpts) { |
---|
| 3617 | var image_info = $('#thumb_'+ID+'_'+currentIndex).val(); |
---|
| 3618 | |
---|
| 3619 | return '<div id="fancybox-title" class="fancybox-title-over" style="width: 100%; display: block;">' + |
---|
| 3620 | '<div id="fancybox-title-over">' + |
---|
| 3621 | '<a title="Anterior" onclick="javascript:$.fancybox.prev();" style="float:left;">' + |
---|
| 3622 | '<img src="./templates/'+template+'/images/left_arrow_white.png" width="30" height="30" />' + |
---|
| 3623 | '</a>'+ |
---|
| 3624 | '<a title="Baixar imagem" onclick="javascript:save_image2(\''+image_info+'\');" style="padding:0 5px;">' + |
---|
| 3625 | '<img src="./templates/'+template+'/images/image_down.png" width="22" height="22" />' + |
---|
| 3626 | '</a>'+ |
---|
| 3627 | '<a title="Baixar todas de uma vez" onclick="javascript:download_all_attachments(\''+info_msg.msg_folder+"','"+info_msg.msg_number+'\')" style="padding:0 5px;">'+ |
---|
| 3628 | '<img src="./templates/'+template+'/images/package_down.png" width="26" height="26" />' + |
---|
| 3629 | '</a>'+ |
---|
| 3630 | '<span style="margin-left:5px; margin-top:7px; position:absolute;">'+name+'</span>'+ |
---|
| 3631 | '<a title="Próxima" onclick="javascript:$.fancybox.next();" style="float:right;">' + |
---|
| 3632 | '<img src="./templates/'+template+'/images/right_arrow_white.png" width="30" height="30" />' + |
---|
| 3633 | '</a>' + |
---|
| 3634 | '</div>' + |
---|
| 3635 | '</div>'; |
---|
| 3636 | } |
---|
[4493] | 3637 | }); |
---|
| 3638 | }); |
---|
[5967] | 3639 | } |
---|
| 3640 | if ( is_webkit ){ //Corrige o bug de foco no Chrome |
---|
[5370] | 3641 | var ev = document.createEvent('MouseEvents'); |
---|
| 3642 | ev.initEvent( |
---|
| 3643 | 'click' |
---|
| 3644 | ,false |
---|
| 3645 | ,true |
---|
| 3646 | ); |
---|
| 3647 | var divScroll = Element('div_message_scroll_'+ID); |
---|
| 3648 | if (divScroll) { |
---|
| 3649 | divScroll.setAttribute('tabindex','-1'); |
---|
| 3650 | divScroll.onclick = function() {setTimeout(function(){$("#div_message_scroll_"+ID).focus();},0);}; |
---|
| 3651 | divScroll.dispatchEvent(ev); |
---|
| 3652 | } |
---|
| 3653 | } |
---|
[5967] | 3654 | else $("#div_message_scroll_"+ID).focus(); |
---|
| 3655 | update_labeleds_msg(); |
---|
[6463] | 3656 | |
---|
[5967] | 3657 | resizeWindow(); |
---|
[6463] | 3658 | |
---|
| 3659 | $("#div_message_scroll_"+ID).scrollTo( 0, 400, {queue:true} ); |
---|
[4820] | 3660 | } |
---|
[4493] | 3661 | |
---|
[3035] | 3662 | function changeLinkState(el,state){ |
---|
| 3663 | el.innerHTML = get_lang(state); |
---|
| 3664 | switch (state){ |
---|
| 3665 | case 'important': |
---|
| 3666 | { |
---|
[4826] | 3667 | el.onclick = function(){changeLinkState(el,'normal');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'flagged');write_msg(get_lang('Message marked as ')+get_lang("Important"))} |
---|
[3035] | 3668 | break; |
---|
| 3669 | } |
---|
| 3670 | case 'normal': |
---|
| 3671 | { |
---|
[4072] | 3672 | el.onclick = function(){ |
---|
[3806] | 3673 | var _this = this; |
---|
| 3674 | proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'unflagged', function(success){ |
---|
| 3675 | if (success) { |
---|
| 3676 | changeLinkState(_this, 'important'); |
---|
| 3677 | write_msg(get_lang('Message marked as ') + get_lang("Normal")); |
---|
| 3678 | } |
---|
| 3679 | } ); |
---|
| 3680 | } |
---|
[3035] | 3681 | break; |
---|
| 3682 | } |
---|
| 3683 | case 'unseen': |
---|
| 3684 | { |
---|
[4826] | 3685 | el.onclick = function(){changeLinkState(el,'seen');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'unseen');write_msg(get_lang('Message marked as ')+get_lang("unseen"))} |
---|
[3035] | 3686 | break; |
---|
[790] | 3687 | |
---|
[3035] | 3688 | } |
---|
| 3689 | case 'seen': |
---|
| 3690 | { |
---|
[4826] | 3691 | el.onclick = function(){changeLinkState(el,'unseen');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'seen');write_msg(get_lang('Message marked as ')+get_lang("seen"))} |
---|
[3035] | 3692 | break; |
---|
[3021] | 3693 | |
---|
[3035] | 3694 | } |
---|
| 3695 | default: |
---|
| 3696 | { |
---|
| 3697 | break; |
---|
| 3698 | } |
---|
| 3699 | } |
---|
| 3700 | } |
---|
[4493] | 3701 | |
---|
[5911] | 3702 | function mySplit( val ) { |
---|
| 3703 | return val.split( /,\s*/ ); |
---|
| 3704 | } |
---|
| 3705 | |
---|
| 3706 | function extractLast( term ) { |
---|
| 3707 | return mySplit( term ).pop(); |
---|
| 3708 | } |
---|
[6109] | 3709 | |
---|
[6528] | 3710 | //DESENHO DAS CAIXA DE EMAIL |
---|
[6592] | 3711 | function draw_email_box(input_data, location, personal, shared){ |
---|
[6528] | 3712 | if($.trim(input_data) != ""){ |
---|
| 3713 | var box_data = valid_emails(input_data); |
---|
| 3714 | DataLayer.render("../prototype/modules/mail/templates/emailBox.ejs", box_data, function(html){ |
---|
| 3715 | var newBox = location.before(html).prev(); |
---|
| 3716 | box_actions(newBox); |
---|
| 3717 | if((preferences.expressoMail_ldap_identifier_recipient || personal)&& $(newBox).hasClass("invalid-email-box")){ |
---|
| 3718 | //$(newBox).find(".loading").css("background-image", "../prototype/modules/mail/img/ajax-loader.gif"); |
---|
[6592] | 3719 | show_detais(newBox, input_data, personal, shared); |
---|
[6528] | 3720 | }else{ |
---|
| 3721 | $(newBox).find(".box-loading").remove(); |
---|
| 3722 | } |
---|
| 3723 | }); |
---|
[6109] | 3724 | } |
---|
[6528] | 3725 | } |
---|
| 3726 | |
---|
| 3727 | function valid_emails(email){ |
---|
| 3728 | var ContactBox = {name:"", email:"", valid : false}; |
---|
| 3729 | var reSimpleEmail = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[_a-z0-9-]+(\.[_a-z0-9-]+)+$/; |
---|
| 3730 | var reComplexEmail = /<([^<]*)>[\s]*$/; |
---|
| 3731 | var validation = email.split('"'); |
---|
| 3732 | |
---|
| 3733 | //FUNÇÃO QUE VALIDA OS DADOS QUANDO O EMAIL É DIGITADO COM ("NOME SOBRENOME" <Email@dominio.com>) |
---|
| 3734 | var complexValidation = function(complexMail){ |
---|
| 3735 | var Objct = {}; |
---|
| 3736 | if($.trim(complexMail[1]).match(reComplexEmail)){ |
---|
| 3737 | if($.trim(complexMail[1]).match(reComplexEmail).length){ |
---|
| 3738 | Objct['email'] = $.trim(complexMail[1]).match(reComplexEmail)[1]; |
---|
| 3739 | } |
---|
| 3740 | }else{ |
---|
| 3741 | Objct['email'] = $.trim(complexMail[1]); |
---|
[6109] | 3742 | } |
---|
[6528] | 3743 | Objct['name'] = complexMail[0]; |
---|
| 3744 | Objct['valid'] = reSimpleEmail.test(Objct['email'].toLowerCase()); |
---|
| 3745 | return Objct; |
---|
| 3746 | } |
---|
| 3747 | switch (validation.length) { |
---|
| 3748 | //PEGA TODO O CONTEUDO E SETA COMO SE FOSSE O EMAIL |
---|
| 3749 | case 1: |
---|
| 3750 | validation.unshift(""); |
---|
| 3751 | ContactBox = complexValidation(validation); |
---|
| 3752 | break; |
---|
| 3753 | //CORRIGI ERRO DE DIGITAÇÃO COMO ( huahua"<huhau@hauhau.com>) ou (hahahaha"huahua@email.com) ou ainda (hahahaha"huahua@ema il.com) |
---|
| 3754 | case 2: |
---|
| 3755 | ContactBox = complexValidation(validation); |
---|
| 3756 | break; |
---|
| 3757 | //RECEBE O EMAIL CORRETAMENTE SÓ VALIDA POSSIVEIS ERROS COMO O DE CIMA E OS CORRIGI CASO ACONTEÇAM |
---|
| 3758 | case 3: |
---|
| 3759 | //RETIRA O PRIMEIRO INDICE QUE FICOU "INUTIL" |
---|
| 3760 | validation.shift(); |
---|
| 3761 | ContactBox = complexValidation(validation); |
---|
| 3762 | break; |
---|
| 3763 | //SE EXISTIREM MAIS DO QUE 2 (") |
---|
| 3764 | default: |
---|
| 3765 | if($.trim(validation[validation.length-1]).match(reComplexEmail)){ |
---|
| 3766 | if($.trim(validation[validation.length-1]).match(reComplexEmail).length){ |
---|
| 3767 | ContactBox.mail = $.trim(validation[validation.length-1]).match(reComplexEmail)[1]; |
---|
| 3768 | } |
---|
| 3769 | }else{ |
---|
| 3770 | ContactBox.mail = $.trim(complexMail[1]); |
---|
| 3771 | } |
---|
| 3772 | ContactBox.valid = reSimpleEmail.test(ContactBox.mail.toLowerCase()); |
---|
| 3773 | } |
---|
| 3774 | return ContactBox; |
---|
| 3775 | } |
---|
| 3776 | |
---|
| 3777 | //EVENTO DOS INPUTS PARA - CC - CCO |
---|
| 3778 | function input_keydowns(input, ID){ |
---|
| 3779 | var f9 = false; |
---|
| 3780 | input.keydown(function(e){ |
---|
| 3781 | f9 = false; |
---|
[6667] | 3782 | focusIn = input; |
---|
[6528] | 3783 | var focusing = input.parent().find(".email-text"); |
---|
| 3784 | //SE OS CONTATOS DINAMICOS ESTAO ATIVOS |
---|
| 3785 | if(parseInt(preferences.use_dynamic_contacts) && !input.hasClass("box-input")){ |
---|
| 3786 | //SELECIONA O CONTATO E EVITA OUTROS COMANDOS |
---|
| 3787 | if ( e.keyCode === $.ui.keyCode.TAB && $( this ).data( "catcomplete" ).menu.active ) { |
---|
| 3788 | e.preventDefault(); |
---|
| 3789 | return false; |
---|
| 3790 | } |
---|
| 3791 | |
---|
| 3792 | //FECHA OS CONTATOS DINÂMICOS |
---|
| 3793 | if( (e.keyCode == 27) && $( this ).data( "catcomplete" ).menu.active ){ |
---|
| 3794 | e.stopPropagation(); |
---|
| 3795 | e.preventDefault(); |
---|
| 3796 | } |
---|
| 3797 | |
---|
| 3798 | //SELECIONA O CONTATO E EVITA OUTROS COMANDOS |
---|
| 3799 | if(e.keyCode == $.ui.keyCode.ENTER && $( this ).data( "catcomplete" ).menu.active){ |
---|
| 3800 | e.preventDefault(); |
---|
| 3801 | return false; |
---|
| 3802 | } |
---|
| 3803 | |
---|
| 3804 | if(e.keyCode == $.ui.keyCode.DELETE && $( this ).data( "catcomplete" ).menu.active){ |
---|
| 3805 | if($($( this ).data( "catcomplete" ).menu.element).find(".ui-state-hover").parents("li:first").hasClass("dynamic-recent")) |
---|
| 3806 | $($( this ).data( "catcomplete" ).menu.element).find(".ui-state-hover").next().trigger("click"); |
---|
| 3807 | return false; |
---|
| 3808 | } |
---|
| 3809 | } |
---|
| 3810 | //BUSCA COM A TECLA F9 |
---|
| 3811 | if((e.keyCode) == 120){ |
---|
| 3812 | f9 = true; |
---|
[6109] | 3813 | emQuickSearch($(this).val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true); |
---|
[6528] | 3814 | e.preventDefault(); |
---|
| 3815 | return false; |
---|
[6109] | 3816 | } |
---|
[6528] | 3817 | |
---|
| 3818 | //AO DIGITAR ENTER, ";", "," " " |
---|
| 3819 | if(e.keyCode == 13 || e.keyCode == 9 || (e.keyCode == 188 && !e.shiftKey) || (e.keyCode == 191 && !e.shiftKey) ){ |
---|
| 3820 | if(e.keyCode == 13){ |
---|
| 3821 | e.preventDefault(); |
---|
| 3822 | } |
---|
| 3823 | if(input.val() != ""){ |
---|
| 3824 | if(e.keyCode != 9) |
---|
| 3825 | e.preventDefault(); |
---|
| 3826 | draw_email_box(input.val(), input); |
---|
| 3827 | if(input.hasClass("box-input")){ |
---|
| 3828 | input.remove(); |
---|
| 3829 | focusing.focus(); |
---|
| 3830 | return; |
---|
| 3831 | } |
---|
| 3832 | } |
---|
| 3833 | if(input.length) |
---|
| 3834 | input.val(""); |
---|
| 3835 | } |
---|
| 3836 | if((e.keyCode == 8 || e.keyCode == 37) && input.val() == "" && input.prev().hasClass("box")){ |
---|
| 3837 | e.preventDefault(); |
---|
| 3838 | input.prev().focus(); |
---|
[6109] | 3839 | return; |
---|
| 3840 | } |
---|
[6528] | 3841 | //AO DIGITAR " " |
---|
| 3842 | if(e.keyCode == 32){ |
---|
| 3843 | if(!input.val().length){ |
---|
| 3844 | e.preventDefault(); |
---|
| 3845 | return; |
---|
| 3846 | }else{ |
---|
| 3847 | var texto = input.val(); |
---|
| 3848 | texto = texto.substring(0, getPosition(input[0])); |
---|
| 3849 | if(texto.split('"').length-1 == 0){ |
---|
| 3850 | if(input.val().split('"').length-1 == 0){ |
---|
| 3851 | e.preventDefault(); |
---|
| 3852 | e.stopPropagation(); |
---|
| 3853 | draw_email_box(input.val(), input); |
---|
| 3854 | input.val(""); |
---|
| 3855 | if(input.hasClass("box-input")){ |
---|
| 3856 | input.remove(); |
---|
| 3857 | focusing.focus(); |
---|
| 3858 | return; |
---|
| 3859 | } |
---|
| 3860 | return; |
---|
| 3861 | } |
---|
| 3862 | } |
---|
| 3863 | } |
---|
| 3864 | } |
---|
| 3865 | //AO DIGITAR ">" |
---|
| 3866 | if(e.keyCode == 190 && e.shiftKey && input.val().length == getPosition(input[0])){ |
---|
| 3867 | input.val(input.val()+">"); |
---|
| 3868 | draw_email_box(input.val(), input); |
---|
| 3869 | e.preventDefault(); |
---|
| 3870 | input.val(""); |
---|
| 3871 | if(input.hasClass("box-input")){ |
---|
| 3872 | input.remove(); |
---|
| 3873 | focusing.focus(); |
---|
| 3874 | return; |
---|
| 3875 | } |
---|
| 3876 | } |
---|
[6547] | 3877 | setTimeout(function(){ |
---|
| 3878 | if(input.val()[input.val().length-1] == ";"){ |
---|
| 3879 | draw_email_box(input.val().substring(0, input.val().length-1), input); |
---|
| 3880 | input.val(""); |
---|
| 3881 | } |
---|
| 3882 | }, 100); |
---|
[6528] | 3883 | //INPUT AUTO RESIZE |
---|
| 3884 | setTimeout(function(){ |
---|
[6562] | 3885 | input_search = $(input).val(); |
---|
[6654] | 3886 | var char = input.val().charAt(input.val().length-1); |
---|
| 3887 | var maiusculas = RegExp("[A-Z]"); |
---|
| 3888 | /*Se o ultimo caracter for ">" é porque o campo está sendo editado (a partir de duplo clique)*/ |
---|
| 3889 | var tamanho = 0; |
---|
| 3890 | if(char == ">"){ |
---|
| 3891 | /*Faz um calculo prévio do tamanho do campo de acordo com o tamanho de cada caracter da string*/ |
---|
| 3892 | for(i=0; i<input.val().length; i++){ |
---|
| 3893 | /*Se o caracter for maiúsculo, o valor de pixel é maior*/ |
---|
| 3894 | if(maiusculas.test(input.val().substr(i, 1)) == true){ |
---|
| 3895 | tamanho += 9; |
---|
| 3896 | } |
---|
| 3897 | else{ |
---|
| 3898 | tamanho += 7.1; |
---|
| 3899 | } |
---|
| 3900 | } |
---|
| 3901 | input.css("width", tamanho); |
---|
| 3902 | } |
---|
| 3903 | /*Ao inserir novo contato, não existe a necessidade de calcular tamanho do campo*/ |
---|
| 3904 | else{ |
---|
| 3905 | input.css("width", 15+(input.val().length * 9)); |
---|
| 3906 | } |
---|
[6528] | 3907 | input.parent().scrollTo(":last"); |
---|
| 3908 | }, 100); |
---|
| 3909 | }) |
---|
| 3910 | //AO SAIR DO FOCO MONTAGEM DA CAIXA DE EMAIL |
---|
[6562] | 3911 | .focusout(function(e){ |
---|
| 3912 | var these = $(this); |
---|
[6663] | 3913 | |
---|
| 3914 | // Função para monstar a caixinha de e-mail. |
---|
| 3915 | function makeBoxMail(){ |
---|
[6670] | 3916 | if(canMakeBox && !fastSearch){ |
---|
[6663] | 3917 | if(!( f9 || click || $(this).parents("tr:first").find("button").hasClass("ui-state-active") )){ |
---|
| 3918 | if($(input).val() != "") |
---|
| 3919 | draw_email_box(input.val(), input); |
---|
| 3920 | if(input.hasClass("box-input")) |
---|
| 3921 | input.remove(); |
---|
| 3922 | $(input).val(""); |
---|
| 3923 | input_search = ""; |
---|
| 3924 | } |
---|
| 3925 | f9 = false; |
---|
| 3926 | click = false; |
---|
[6528] | 3927 | } |
---|
[6670] | 3928 | canMakeBox = true; |
---|
| 3929 | fastSearch = false; |
---|
[6528] | 3930 | } |
---|
[6663] | 3931 | |
---|
| 3932 | /* |
---|
| 3933 | ** Verifica se o dynamic contact esta aberto ou fechado, caso esteja aberto, |
---|
| 3934 | ** demora 250 millisegundos para executar a função makeBoxMail. |
---|
| 3935 | */ |
---|
| 3936 | these.data('is_open') ? setTimeout(makeBoxMail,250) : makeBoxMail(); |
---|
[6528] | 3937 | }) |
---|
| 3938 | //AO COLAR UM TEXTO NO CAMPO |
---|
| 3939 | .bind("paste", function(e){ |
---|
| 3940 | $(this).trigger("keydown"); |
---|
| 3941 | var pthis = $(this); |
---|
| 3942 | setTimeout(function() { |
---|
| 3943 | var str = pthis.val().replace(/[,;\t\n]/gi, ","); |
---|
| 3944 | str = str.split(","); |
---|
| 3945 | $.each(str, function(index, value){ |
---|
| 3946 | draw_email_box(value, pthis); |
---|
| 3947 | }); |
---|
| 3948 | pthis.val(""); |
---|
| 3949 | }, 50); |
---|
[6109] | 3950 | }); |
---|
[6528] | 3951 | //SE FOR EDIÇÃO DE EMAILS RECALCULA O INPUT E SETA O FOCO |
---|
| 3952 | if(input.hasClass("box-input")){ |
---|
| 3953 | input.trigger("keydown"); |
---|
| 3954 | input.focus(); |
---|
| 3955 | } |
---|
[6109] | 3956 | } |
---|
[6528] | 3957 | var input_search = ""; |
---|
[6562] | 3958 | var click = false; |
---|
[6528] | 3959 | //EVENTOS DA CAIXA |
---|
| 3960 | function box_actions(box){ |
---|
| 3961 | //AO PRESSIONAR UMA TECLA COM A CAIXA SELECIONADA |
---|
| 3962 | box.keydown(function(e){ |
---|
| 3963 | switch (e.keyCode) { |
---|
| 3964 | case $.ui.keyCode.LEFT: |
---|
| 3965 | //VERIFICA SE EXISTE ALGUMA CAIXA A ESQUERDA |
---|
| 3966 | if($(this).prev().hasClass("box")) |
---|
| 3967 | $(this).removeClass("box-selected").prev().focus(); |
---|
| 3968 | break; |
---|
| 3969 | case $.ui.keyCode.RIGHT: |
---|
| 3970 | //VERIFICA SE EXISTE ALGUMA CAIXA A DIREITA |
---|
| 3971 | if($(this).next().hasClass("box")) |
---|
| 3972 | $(this).removeClass("box-selected").next().focus(); |
---|
| 3973 | //SENAO FOCO O INPUT DO EMAIL |
---|
| 3974 | else |
---|
| 3975 | $(this).removeClass("box-selected").next().focus(); |
---|
| 3976 | break; |
---|
| 3977 | case $.ui.keyCode.HOME: |
---|
| 3978 | //SELECIONO A PRIMEIRA CAIXA |
---|
| 3979 | e.preventDefault(); |
---|
| 3980 | $(this).parents(".email-area").find("div:first").focus(); |
---|
| 3981 | break; |
---|
| 3982 | case $.ui.keyCode.END: |
---|
| 3983 | //SELECIONO A ULTIMA CAIXA |
---|
| 3984 | e.preventDefault(); |
---|
| 3985 | $(this).parents(".email-area").find("div:last").focus(); |
---|
| 3986 | break; |
---|
| 3987 | case $.ui.keyCode.DELETE: |
---|
| 3988 | //VERIFICA SE EXISTE ALGUMA CAIXA A DIREITA |
---|
| 3989 | if($(this).next().hasClass("box")) |
---|
| 3990 | $(this).next().focus(); |
---|
| 3991 | //SENAO FOCO O INPUT DO EMAIL |
---|
| 3992 | else |
---|
| 3993 | $(this).next().focus(); |
---|
| 3994 | //REMOVO ESTA CAIXA |
---|
| 3995 | $(this).remove(); |
---|
| 3996 | break; |
---|
| 3997 | case $.ui.keyCode.BACKSPACE: |
---|
| 3998 | //VERIFICA SE EXISTE ALGUMA CAIXA A ESQUERDA |
---|
| 3999 | if($(this).prev().hasClass("box")) |
---|
| 4000 | $(this).removeClass("box-selected").prev().focus(); |
---|
| 4001 | //SENAO HOUVER VERIFICA SE EXISTE ALGUMA CAIXA A DIREITA |
---|
| 4002 | else if($(this).next().hasClass("box")) |
---|
| 4003 | $(this).next().focus(); |
---|
| 4004 | //SENAO HOUVER NEM A DIREITA NEM A ESQUERDA SETO O FOCO NO INPUT DO EMAIL |
---|
| 4005 | else |
---|
| 4006 | $(this).next().focus(); |
---|
| 4007 | //REMOVO ESTA CAIXA |
---|
| 4008 | $(this).remove(); |
---|
| 4009 | e.preventDefault(); |
---|
| 4010 | break; |
---|
| 4011 | case $.ui.keyCode.ENTER: |
---|
| 4012 | e.preventDefault(); |
---|
| 4013 | $(this).trigger("dblclick"); |
---|
| 4014 | break; |
---|
| 4015 | } |
---|
| 4016 | }) |
---|
| 4017 | //AO FAZER UM DUPLO CLICK NA CAIXA |
---|
| 4018 | .dblclick(function(e){ |
---|
| 4019 | var input = $(this).find("input").clone(); |
---|
| 4020 | input.css("display" , "inline-block"); |
---|
| 4021 | $(this).before(input); |
---|
| 4022 | input_keydowns(input, currentTab); |
---|
| 4023 | $(this).remove(); |
---|
| 4024 | //CLICK SIMPLES NA CAIXA |
---|
| 4025 | }).click(function(){ |
---|
| 4026 | $(this).focus(); |
---|
| 4027 | //AO DAR O FOCO NA CAIXA |
---|
| 4028 | }).focus(function(){ |
---|
| 4029 | $(this).parent().find("div").removeClass("box-selected"); |
---|
| 4030 | $(this).addClass("box-selected"); |
---|
| 4031 | }).focusout(function(){ |
---|
| 4032 | $(this).removeClass("box-selected"); |
---|
| 4033 | }).draggable({ |
---|
| 4034 | revert: 'invalid', |
---|
| 4035 | helper : 'clone', |
---|
| 4036 | stack: "body", |
---|
| 4037 | containment : ".new-msg-head-data", |
---|
| 4038 | start: function(e, ui){ |
---|
| 4039 | $(this).parent().droppable( "disable" ); |
---|
| 4040 | }, |
---|
| 4041 | stop : function(e, ui){ |
---|
| 4042 | $(this).parent().droppable( "enable" ); |
---|
| 4043 | } |
---|
| 4044 | }); |
---|
| 4045 | } |
---|
| 4046 | |
---|
| 4047 | //MOSTRA OS DETALHES DAS CAIXA DE EMAIL NOS CAMPOS PARA - CC - CCO |
---|
[6592] | 4048 | function show_detais(box, value, personal, shared){ |
---|
[6528] | 4049 | var ldap_id = preferences.expressoMail_ldap_identifier_recipient; |
---|
| 4050 | var group = (personal != undefined ? (personal == "G" ? true : false) : false); |
---|
[6592] | 4051 | shared = shared ? shared : false; |
---|
[6528] | 4052 | if(group){ |
---|
[6592] | 4053 | REST.get("/"+ (shared ? "shared" : "") +"group/"+value, {}, function(data){ |
---|
[6528] | 4054 | if(!data.error){ |
---|
| 4055 | if(data.collection.error) |
---|
| 4056 | box.find(".box-loading").remove(); |
---|
| 4057 | else{ |
---|
| 4058 | box.find(".box-loading").removeClass("box-loading").addClass("box-info"); |
---|
| 4059 | box.addClass("box-"+value).removeClass("invalid-email-box"); |
---|
| 4060 | loadGroupBox(data.collection, ".box-"+value); |
---|
| 4061 | box.unbind("dblclick").bind("dblclick", function(e){ |
---|
[6531] | 4062 | new $.Zebra_Dialog(get_lang("Impossible editing this contact, but it's possible to remove it"), { |
---|
[6528] | 4063 | 'buttons': false, |
---|
| 4064 | 'modal': false, |
---|
| 4065 | 'position': ['right - 20', 'top + 20'], |
---|
| 4066 | 'auto_close': 3000 |
---|
| 4067 | }); |
---|
| 4068 | }).find(".box-input").val("\""+data.collection.data[1].value+"\" <"+data.collection.data[1].value+">"); |
---|
| 4069 | box.find(".email-box-value").html( (data.collection.data[1].value.length > 18 ? data.collection.data[1].value.substring(0, 15)+"...": data.collection.data[1].value)) |
---|
| 4070 | } |
---|
| 4071 | }else{ |
---|
| 4072 | box.find(".box-loading").remove(); |
---|
| 4073 | } |
---|
| 4074 | }); |
---|
| 4075 | return; |
---|
| 4076 | } |
---|
| 4077 | |
---|
| 4078 | if(personal){ |
---|
[6592] | 4079 | REST.get("/"+ (shared ? "shared" : "") +"contact/"+value, {}, function(data){ |
---|
[6528] | 4080 | if(!data.error){ |
---|
| 4081 | if(data.collection.error) |
---|
| 4082 | box.find(".box-loading").remove(); |
---|
| 4083 | else{ |
---|
| 4084 | box.find(".box-loading").removeClass("box-loading").addClass("box-info"); |
---|
| 4085 | box.addClass("box-"+value).removeClass("invalid-email-box"); |
---|
| 4086 | loadExtraLDAPBox(data.collection.data, ".box-"+value); |
---|
| 4087 | box.unbind("dblclick").bind("dblclick", function(e){ |
---|
[6531] | 4088 | new $.Zebra_Dialog(get_lang("Impossible editing this contact, but it's possible to remove it"), { |
---|
[6528] | 4089 | 'buttons': false, |
---|
| 4090 | 'modal': false, |
---|
| 4091 | 'position': ['right - 20', 'top + 20'], |
---|
| 4092 | 'auto_close': 3000 |
---|
| 4093 | }); |
---|
| 4094 | }).find(".box-input").val("\""+data.collection.data[0].value+"\" <"+data.collection.data[1].value+">"); |
---|
| 4095 | box.find(".email-box-value").html( (data.collection.data[0].value.length > 18 ? data.collection.data[0].value.substring(0, 15)+"...": data.collection.data[0].value)) |
---|
| 4096 | } |
---|
| 4097 | }else{ |
---|
| 4098 | box.find(".box-loading").remove(); |
---|
| 4099 | } |
---|
| 4100 | }); |
---|
| 4101 | return; |
---|
| 4102 | } |
---|
| 4103 | |
---|
| 4104 | REST.get("/usersldap", {field : ldap_id,value: value}, function(data){ |
---|
| 4105 | if(!data.error){ |
---|
| 4106 | if(data.collection.error) |
---|
| 4107 | box.find(".box-loading").remove(); |
---|
| 4108 | else{ |
---|
| 4109 | box.find(".box-loading").removeClass("box-loading").addClass("box-info"); |
---|
| 4110 | box.addClass("box-"+value).removeClass("invalid-email-box"); |
---|
| 4111 | loadExtraLDAPBox(data.collection.itens[0].data, ".box-"+value); |
---|
| 4112 | box.unbind("dblclick").bind("dblclick", function(e){ |
---|
[6531] | 4113 | new $.Zebra_Dialog(get_lang("Impossible editing this contact, but it's possible to remove it"), { |
---|
[6528] | 4114 | 'buttons': false, |
---|
| 4115 | 'modal': false, |
---|
| 4116 | 'position': ['right - 20', 'top + 20'], |
---|
| 4117 | 'auto_close': 3000 |
---|
| 4118 | }); |
---|
| 4119 | }).find(".box-input").val("\""+data.collection.itens[0].data[0].value+"\" <"+data.collection.itens[0].data[1].value+">"); |
---|
| 4120 | box.find(".email-box-value").html( (data.collection.itens[0].data[0].value.length > 18 ? data.collection.itens[0].data[0].value.substring(0, 15)+"...": data.collection.itens[0].data[0].value)) |
---|
[6541] | 4121 | if(data.collection.itens[0].data[3].value == "TRUE"){ |
---|
| 4122 | box.removeClass("invalid-email-box").addClass("out-office-box"); |
---|
| 4123 | } |
---|
[6528] | 4124 | } |
---|
| 4125 | }else{ |
---|
| 4126 | box.find(".box-loading").remove(); |
---|
| 4127 | } |
---|
| 4128 | }); |
---|
| 4129 | } |
---|
| 4130 | |
---|
| 4131 | //FUNÇÃO QUE "SETA" OS BINDS DOS CAMPOS PARA - CC - CCO |
---|
| 4132 | function input_binds(div, ID){ |
---|
| 4133 | |
---|
| 4134 | //AO CLICAR NA DIV SETA O FOCO NO INPUT |
---|
| 4135 | div.click(function(e){ |
---|
| 4136 | if(e.target == $(this)[0]){ |
---|
| 4137 | $(this).find("input:last").focus(); |
---|
| 4138 | $(this).find("div").removeClass("box-selected"); |
---|
| 4139 | } |
---|
| 4140 | }) |
---|
| 4141 | |
---|
| 4142 | //AO SAIR DO FOCO DA DIV ELE RETIRA TODAS AS CLASSES DE CAIXAS SELECIONADAS |
---|
| 4143 | .focusout(function(e){ |
---|
| 4144 | if(!$(e.target).parents(".email-area:first").length) |
---|
| 4145 | $(this).find("div").removeClass("box-selected"); |
---|
| 4146 | }).droppable({ |
---|
| 4147 | hoverClass: "box-draggable-hover", |
---|
| 4148 | accept : ".box", |
---|
| 4149 | drop : function(e, ui){ |
---|
| 4150 | ui.draggable.parent().droppable( "enable" ); |
---|
| 4151 | var box = ui.draggable.clone(); |
---|
| 4152 | box_actions(box); |
---|
| 4153 | if(box.find(".box-info").length){ |
---|
| 4154 | box.unbind("dblclick").bind("dblclick", function(e){ |
---|
| 4155 | new $.Zebra_Dialog('<strong>Impossivel editar</strong> um contato do ldap\n' + |
---|
| 4156 | '<strong>Porém</strong>é possivel remove-lo', { |
---|
| 4157 | 'buttons': false, |
---|
| 4158 | 'modal': false, |
---|
| 4159 | 'position': ['right - 20', 'top + 20'], |
---|
| 4160 | 'auto_close': 3000 |
---|
| 4161 | }); |
---|
| 4162 | }); |
---|
| 4163 | } |
---|
| 4164 | $(this).prepend(box); |
---|
| 4165 | ui.draggable.remove(); |
---|
| 4166 | } |
---|
| 4167 | }); |
---|
| 4168 | |
---|
| 4169 | //MAKE KEYDOWN |
---|
| 4170 | input_keydowns(div.find("input"), ID); |
---|
| 4171 | |
---|
| 4172 | |
---|
| 4173 | //VERIFICA PREFERENCIA DE CONTATOS DINÂMICOS ESTA ATIVA |
---|
| 4174 | if(parseInt(preferences.use_dynamic_contacts)){ |
---|
| 4175 | //PREPARAÇÃO DA ARRAY DOS CONTATOS DINÂMICOS |
---|
| 4176 | |
---|
| 4177 | $.widget( "custom.catcomplete", $.ui.autocomplete, { |
---|
| 4178 | _renderMenu: function( ul, items ) { |
---|
| 4179 | var self = this, |
---|
| 4180 | currentType = ""; |
---|
| 4181 | $.each( items, function( index, item ) { |
---|
[6592] | 4182 | if ( item.typel != currentType) { |
---|
| 4183 | if(item.typel == "/groups" && $(ul).find(".dynamic-recent").length) |
---|
[6528] | 4184 | self._renderItem( ul, {name:"", value:"", type:"linha"} ); |
---|
[6592] | 4185 | if(item.typel == "/contacts" && ($(ul).find(".dynamic-group").length || $(ul).find(".dynamic-recent").length)) |
---|
[6528] | 4186 | self._renderItem( ul, {name:"", value:"", type:"linha"} ); |
---|
[6592] | 4187 | currentType = item.typel; |
---|
[6528] | 4188 | } |
---|
| 4189 | self._renderItem( ul, item ); |
---|
| 4190 | $(ul).find("li:last").find(".dynamic-stars").raty({ |
---|
| 4191 | readOnly : true, |
---|
| 4192 | half : true, |
---|
| 4193 | hints : ['','','','',''], |
---|
[6652] | 4194 | score : ((item.number_of_messages*5)/topContact) > 0.5 ? ((item.number_of_messages*5)/topContact) : 0.5, |
---|
[6528] | 4195 | starOn : '../../prototype/plugins/jq-raty/img/star-on.png', |
---|
| 4196 | starOff : '../../prototype/plugins/jq-raty/img/star-off.png', |
---|
| 4197 | starHalf : '../../prototype/plugins/jq-raty/img/star-half.png' |
---|
| 4198 | }); |
---|
| 4199 | }); |
---|
[6592] | 4200 | if($(ul).find("li:last").hasClass("dynamic-separator")){ |
---|
| 4201 | $(ul).find("li:last").remove(); |
---|
| 4202 | } |
---|
[6528] | 4203 | } |
---|
| 4204 | }); |
---|
| 4205 | //INSERÇÃO DO AUTO COMPLETE AO INPUT |
---|
| 4206 | div.find("input").catcomplete({ |
---|
| 4207 | minLength: 1, |
---|
| 4208 | source: function(request, response){ |
---|
[6592] | 4209 | if ( request.term in cache ) { |
---|
| 4210 | response( cache[ request.term ] ); |
---|
| 4211 | return; |
---|
| 4212 | } |
---|
[6678] | 4213 | dynamicContactsList = new Array(); |
---|
[6592] | 4214 | REST.get("/usercontacts", false, function(data){ |
---|
| 4215 | dynamicData = data.collection.itens; |
---|
| 4216 | if(dynamicData){ |
---|
| 4217 | $.each(dynamicData, function(index, value){ |
---|
| 4218 | dynamic = {}; |
---|
| 4219 | $.each(value.data, function(index, value){ |
---|
| 4220 | dynamic[value.name] = value.value; |
---|
| 4221 | }); |
---|
| 4222 | dynamic['value'] = (dynamic.name ? dynamic.name +' - ': '') + dynamic.mail; |
---|
| 4223 | dynamic['type'] = value.dataType; |
---|
| 4224 | dynamic['typel'] = (value.dataType.substring(0,7) == "/shared" ? "/"+value.dataType.substring(7,value.dataType.length)+"s" : value.dataType) ; |
---|
[6678] | 4225 | dynamicContactsList.push(dynamic); |
---|
[6592] | 4226 | }); |
---|
| 4227 | } |
---|
[6678] | 4228 | var data = $.ui.autocomplete.filter(dynamicContactsList, request.term ); |
---|
[6592] | 4229 | cache[ request.term ] = data; |
---|
| 4230 | response( data ); |
---|
| 4231 | }); |
---|
[6528] | 4232 | }, |
---|
| 4233 | focus: function() { |
---|
| 4234 | return false; |
---|
| 4235 | }, |
---|
| 4236 | |
---|
| 4237 | //EVENTO AO SELECIONAR UM CONTATO DINÂMICO |
---|
| 4238 | select: function( event, ui ) { |
---|
[6667] | 4239 | canMakeBox = false; |
---|
[6528] | 4240 | event.preventDefault(); |
---|
| 4241 | $(this).val(""); |
---|
[6592] | 4242 | if(ui.item.typel == "/contacts") |
---|
| 4243 | draw_email_box(""+ui.item.id, $(this), true, (ui.item.type.substring(0,7) == "/shared" ? true : false)); |
---|
| 4244 | else if(ui.item.typel == "/groups") |
---|
| 4245 | draw_email_box(""+ui.item.id, $(this), "G", (ui.item.type.substring(0,7) == "/shared" ? true : false)); |
---|
[6528] | 4246 | else |
---|
[6592] | 4247 | draw_email_box(ui.item.name ? "\""+ui.item.name+"\" <"+ui.item.mail+">" : ui.item.mail, $(this)); |
---|
[6528] | 4248 | return false; |
---|
| 4249 | }, |
---|
| 4250 | autoFocus: true, |
---|
| 4251 | position : { my: "left top", at: "left bottom", collision: "fit" } |
---|
| 4252 | }).bind('catcompleteopen', function(event, ui) { |
---|
| 4253 | $(this).data('is_open',true); |
---|
| 4254 | }).bind('catcompleteclose', function(event, ui) { |
---|
[6667] | 4255 | canMakeBox = true; |
---|
[6528] | 4256 | $(this).data('is_open',false); |
---|
| 4257 | }) |
---|
[5911] | 4258 | |
---|
[6528] | 4259 | //MONTAGEM DA LISTA DE CONTATOS DINÂMICOS DO AUTO COMPLETE |
---|
| 4260 | .data( "catcomplete" )._renderItem = function( ul, item ) { |
---|
[6592] | 4261 | if($(ul).find("li").length < 50){ |
---|
| 4262 | var autocomplete = $(this)[0].element; |
---|
[6648] | 4263 | //cálculo dinâmico da largura da lista |
---|
| 4264 | var width = (item.label ? item.label.length : (item.value ? item.value.length : (item.email ? item.email.length : 20 ))); |
---|
| 4265 | width = width*5 + (is_ie ? 170 : 200) + 16; |
---|
| 4266 | if (width < $(ul).width()) |
---|
| 4267 | width = $(ul).width(); |
---|
| 4268 | ul.css({"min-width":width,"max-height" : "180px", "overflow-y" : "auto", "min-height": "30px"}); |
---|
[6592] | 4269 | var listContacts = DataLayer.render("../prototype/modules/mail/templates/listContacts.ejs", item); |
---|
| 4270 | return $(listContacts).data( "item.autocomplete", item ).appendTo( ul ).find("span:last").button({ |
---|
| 4271 | icons : { |
---|
| 4272 | primary : "ui-icon-close" |
---|
| 4273 | }, |
---|
| 4274 | text: false |
---|
| 4275 | }).click(function(event){ |
---|
| 4276 | var removeLi = $(this).parents("li:first"); |
---|
| 4277 | if(!event.keyCode) |
---|
| 4278 | autocomplete.catcomplete( "close" ); |
---|
[6667] | 4279 | canMakeBox = false; |
---|
[6614] | 4280 | $.Zebra_Dialog('Deseja remover <b>'+(item.name ? item.name+" - " : "")+ item.mail+'</b>?', { |
---|
[6592] | 4281 | 'type': 'question', |
---|
| 4282 | 'custom_class': (is_ie ? 'configure-zebra-dialog' : ''), |
---|
| 4283 | 'title': 'Atenção', |
---|
| 4284 | 'buttons': ['Sim','Não'], |
---|
| 4285 | 'overlay_opacity': '0.5', |
---|
| 4286 | 'onClose': function(caption) { |
---|
| 4287 | if(caption == 'Sim'){ |
---|
| 4288 | $(removeLi).remove(); |
---|
| 4289 | REST.delete("/dynamiccontact/"+item.id); |
---|
| 4290 | updateDynamicContact(); |
---|
| 4291 | cache = new Array(); |
---|
[6667] | 4292 | }else if(caption == 'Não'){ |
---|
| 4293 | $(focusIn).focus(); |
---|
[6592] | 4294 | } |
---|
[6528] | 4295 | } |
---|
[6592] | 4296 | }); |
---|
[6528] | 4297 | }); |
---|
[6592] | 4298 | } |
---|
| 4299 | return; |
---|
[6528] | 4300 | }; |
---|
| 4301 | } |
---|
| 4302 | |
---|
| 4303 | //FUNÇÃO DOS BOTÕES PARA - CC - CCO |
---|
| 4304 | div.parents("tr:first").find("button").button().click(function(){ |
---|
[6562] | 4305 | click = true; |
---|
[6670] | 4306 | fastSearch = true; |
---|
[6528] | 4307 | if(!$(":focus").hasClass("new-message-input")) |
---|
| 4308 | emQuickSearch(($(this).parents("tr:first").find("input").val() ? $(this).parents("tr:first").find("input").val() : input_search), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true); |
---|
| 4309 | }); |
---|
| 4310 | } |
---|
| 4311 | |
---|
[271] | 4312 | function draw_new_message(border_ID){ |
---|
[3105] | 4313 | connector.loadScript("color_palette"); |
---|
| 4314 | connector.loadScript('wfolders'); |
---|
[6528] | 4315 | connector.loadScript("ccQuickAdd"); |
---|
[5911] | 4316 | |
---|
[3105] | 4317 | if(typeof(RichTextEditor) == 'undefined' || typeof(ColorPalette) == 'undefined' || typeof(wfolders) == 'undefined') |
---|
[3068] | 4318 | return false; |
---|
| 4319 | |
---|
[5911] | 4320 | if(typeof($.fn.elastic) == "undefined"){ |
---|
| 4321 | $.lazy({ |
---|
| 4322 | src: '../prototype/plugins/jquery-elastic/jquery.elastic.source.js', |
---|
| 4323 | name: 'elastic' |
---|
| 4324 | }); |
---|
| 4325 | } |
---|
[271] | 4326 | var ID = create_border("",border_ID); |
---|
[5911] | 4327 | |
---|
[4139] | 4328 | if (ID == 0) |
---|
| 4329 | return 0; |
---|
[5134] | 4330 | else if(ID == 'maximo') |
---|
| 4331 | return 'maximo'; |
---|
[5911] | 4332 | |
---|
[2] | 4333 | hold_session = true; |
---|
[3035] | 4334 | |
---|
[5911] | 4335 | if ($("#footer_menu").length){ |
---|
| 4336 | $("#footer_menu").css('display','none'); |
---|
[1701] | 4337 | } |
---|
[5911] | 4338 | var content = $("#content_id_"+ID).html(DataLayer.render("../prototype/modules/mail/templates/new_message.ejs", {id: ID})); |
---|
| 4339 | RichTextEditor.loadEditor2(ID); |
---|
[5417] | 4340 | |
---|
[5911] | 4341 | //if(!expresso_offline) |
---|
| 4342 | // draw_from_field(sel_from,tr1_1); |
---|
[5417] | 4343 | |
---|
[5911] | 4344 | //content.find('name="input_to"').elastic().elastic("destroy"); |
---|
| 4345 | draw_from_field(content.find(".from-select")[0], content.find(".from-tr")[0]); |
---|
[5417] | 4346 | |
---|
[5911] | 4347 | var check_input = function(field){ |
---|
| 4348 | var check = field.attr("checked"); |
---|
| 4349 | field.attr("checked", (!check ? true : false)); |
---|
| 4350 | return (!check ? true : false); |
---|
[5417] | 4351 | } |
---|
| 4352 | |
---|
[5911] | 4353 | //AÇÃO GENERICA PARA ADICIONAR/REMOVER |
---|
| 4354 | var change_text = function(field, text, to_text){ |
---|
| 4355 | var text = (field.html() == text ? to_text : text); |
---|
| 4356 | field.html(text); |
---|
[3035] | 4357 | } |
---|
[4832] | 4358 | |
---|
[5911] | 4359 | //AÇÃO GENERICA PARA ADICIONAR/REMOVER CC & CCO |
---|
| 4360 | var show_hide = function(field, button){ |
---|
| 4361 | button.toggleClass("expressomail-button-icon-ative"); |
---|
| 4362 | field.toggle(); |
---|
[6528] | 4363 | field.find("textarea").val("").parent().find("input").focus(); |
---|
| 4364 | field.find(".email-area div").remove(); |
---|
| 4365 | if(!field.find("textarea").hasClass("track")){ |
---|
| 4366 | field.find("textarea").css({"max-height" : "115px", "overflow-y" : "auto"}).addClass("track"); |
---|
| 4367 | input_binds(field.find(".email-area"), ID); |
---|
[4934] | 4368 | } |
---|
[5417] | 4369 | } |
---|
[4832] | 4370 | |
---|
[6547] | 4371 | input_binds(content.find('[name="input_aux_to"]').css("max-width" , parseInt(content.find(".email-area").css("width"))-5).focus().parent().css({"max-height" : "115px", "overflow-y" : "auto"}), ID); |
---|
[4291] | 4372 | |
---|
[5911] | 4373 | //Botão TextoRico/TextoSimples |
---|
| 4374 | content.find(".new-msg-head-right-buttons").find(".button").button().filter(".rich-button").click(function(){ |
---|
[6698] | 4375 | /*Se o texto do botão for "Texto simples" exibirá a mensagem antes de alterar para texto simples*/ |
---|
| 4376 | if($(".rich-button").find("span").text() == get_lang("Simple Text")){ |
---|
| 4377 | $.Zebra_Dialog(get_lang("Convert this message into plain text can make parts of it are removed. Continue?"), { |
---|
| 4378 | 'type': 'warning', |
---|
| 4379 | 'overlay_opacity': '0.5', |
---|
| 4380 | 'buttons': ['OK','Cancelar'], |
---|
| 4381 | 'width' : 380, |
---|
| 4382 | 'onClose': function(clicked) { |
---|
| 4383 | if(clicked == 'OK'){ |
---|
| 4384 | RichTextEditor.setPlain(check_input(content.find('[name="textplain_rt_checkbox"]')), ID); |
---|
| 4385 | $(".rich-button").find("span").text(get_lang("Rich Text")); |
---|
| 4386 | } |
---|
| 4387 | } |
---|
| 4388 | }) |
---|
| 4389 | } |
---|
| 4390 | /*Se o texto do botão for "Texto rico" simplesmente altera para texto rico*/ |
---|
| 4391 | else{ |
---|
| 4392 | RichTextEditor.setPlain(check_input(content.find('[name="textplain_rt_checkbox"]')), ID); |
---|
| 4393 | $(".rich-button").find("span").text(get_lang("Simple Text")); |
---|
| 4394 | } |
---|
[5911] | 4395 | }) |
---|
[5417] | 4396 | |
---|
[5911] | 4397 | //Botão Adicionar/Remover CCO |
---|
| 4398 | .end().filter(".cco-button").click(function(){ |
---|
| 4399 | show_hide(content.find(".cco-tr"), $(this)); |
---|
| 4400 | change_text($(this).find(".ui-button-text"), get_lang("Add BCC"), get_lang('Remove CCo')); |
---|
| 4401 | }) |
---|
| 4402 | //Botão Adicionar/Remover CC |
---|
| 4403 | .end().filter(".cc-button").click(function(){ |
---|
| 4404 | show_hide(content.find(".cc-tr"), $(this)); |
---|
| 4405 | change_text($(this).find(".ui-button-text"), get_lang("Add CC"), get_lang('Remove CC')); |
---|
[5417] | 4406 | }); |
---|
| 4407 | |
---|
[5911] | 4408 | //BOTAO ENVIAR |
---|
| 4409 | content.find(".send").button({ |
---|
[5417] | 4410 | icons : { |
---|
| 4411 | primary : "expressomail-icon-send" |
---|
| 4412 | } |
---|
[5911] | 4413 | }).click(function(){ |
---|
| 4414 | send_message(ID,preferences.save_in_folder,null); |
---|
| 4415 | }) |
---|
| 4416 | //BOTAO SALVAR E ENVIAR |
---|
| 4417 | .end().find(".save-and-send").button({ |
---|
[5417] | 4418 | icons : { |
---|
[5911] | 4419 | primary : "expressomail-icon-send" |
---|
| 4420 | } |
---|
| 4421 | }).click(function(){ |
---|
| 4422 | wfolders.makeWindow(ID,"send_and_file"); |
---|
| 4423 | }) |
---|
| 4424 | //BOTAO SALVAR |
---|
| 4425 | .end().find(".save").button({ |
---|
| 4426 | icons : { |
---|
[5417] | 4427 | primary : "expressomail-icon-save" |
---|
| 4428 | } |
---|
[5911] | 4429 | }).click(function(){ |
---|
| 4430 | save_msg(ID); |
---|
| 4431 | }) |
---|
| 4432 | //BOTAO CONF. LEITURA |
---|
| 4433 | .end().find(".return-recept").button({ |
---|
[5417] | 4434 | icons : { |
---|
| 4435 | primary : "expressomail-icon-read-confirmation" |
---|
| 4436 | } |
---|
[5911] | 4437 | }).click(function(){ |
---|
| 4438 | check_input(content.find('[name="input_return_receipt"]')); |
---|
| 4439 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 4440 | }) |
---|
| 4441 | //BOTAO IMPORTANTE |
---|
| 4442 | .end().find(".important").button({ |
---|
[5417] | 4443 | icons : { |
---|
| 4444 | primary : "expressomail-icon-important" |
---|
| 4445 | } |
---|
[5911] | 4446 | }).click(function(){ |
---|
| 4447 | check_input(content.find('[name="input_important_message"]')); |
---|
| 4448 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 4449 | }) |
---|
| 4450 | //BOTAO ASS. DIGITAL |
---|
| 4451 | .end().find(".return_digital").button({ |
---|
[5417] | 4452 | icons : { |
---|
| 4453 | primary : "expressomail-icon-signature" |
---|
| 4454 | } |
---|
[5911] | 4455 | }).click(function(){ |
---|
| 4456 | check_input(content.find('[name="input_return_digital"]')); |
---|
| 4457 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 4458 | }) |
---|
| 4459 | //BOTAO EMAIL CRYPT |
---|
| 4460 | .end().find(".return_cripto").button({ |
---|
[5417] | 4461 | icons : { |
---|
| 4462 | primary : "expressomail-icon-encryption" |
---|
| 4463 | } |
---|
[5911] | 4464 | }).click(function(){ |
---|
| 4465 | check_input(content.find('[name="input_return_cripto"]')); |
---|
[5417] | 4466 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 4467 | }); |
---|
[5911] | 4468 | |
---|
| 4469 | content.find(".attachment td").filter(".value").prepend(DataLayer.render("../prototype/modules/mail/templates/attachment.ejs", {ID:ID})); |
---|
| 4470 | var fileUploadMSG = $('#fileupload_msg'+ID); |
---|
[6071] | 4471 | var maxAttachmentSize = (preferences.max_attachment_size !== "" && preferences.max_attachment_size != 0) ? (parseInt(preferences.max_attachment_size.replace('M', '')) * 1048576 ) : false; |
---|
[6107] | 4472 | |
---|
[6752] | 4473 | content.find(".new-msg-head-data").scroll(function(){ |
---|
| 4474 | $.each(fileUploadMSG.find(".attachments-list .att-box"), function(index, value){ |
---|
| 4475 | $(this).qtip("api").updatePosition(); |
---|
| 4476 | }); |
---|
| 4477 | }); |
---|
| 4478 | $("#fileupload_msg"+ID+"_droopzone").click(function(){ |
---|
| 4479 | $(this).removeClass('in hover'); |
---|
| 4480 | $(this).hide(); |
---|
| 4481 | $(this).prev().show(); |
---|
| 4482 | }); |
---|
[6174] | 4483 | fileUploadMSG.find(".button").button().filter(".fileinput-button").find(".ui-button-text").css("margin-top", "2px").find("input:file").fileupload({ |
---|
[6752] | 4484 | //singleFileUploads : true,fileUploadMSG |
---|
[6107] | 4485 | sequentialUploads: true, |
---|
[6071] | 4486 | type: 'post', |
---|
| 4487 | dataType : 'json', |
---|
| 4488 | url: "../prototype/post.php", |
---|
[6107] | 4489 | forceIframeTransport: false, |
---|
[6752] | 4490 | dropZone : $("#fileupload_msg"+ID+"_droopzone"), |
---|
[6071] | 4491 | formData: function(form) { |
---|
| 4492 | return [ |
---|
| 4493 | { |
---|
| 4494 | name : "mailAttachment[0][source]", |
---|
| 4495 | value : "files0" |
---|
| 4496 | }, |
---|
| 4497 | { |
---|
| 4498 | name : "mailAttachment[0][disposition]", |
---|
| 4499 | value : $(form[0]['attDisposition'+$(form[0]['abaID']).val()]).val() |
---|
| 4500 | }, |
---|
| 4501 | { |
---|
| 4502 | name: "MAX_FILE_SIZE", |
---|
| 4503 | value : maxAttachmentSize |
---|
| 4504 | } |
---|
| 4505 | ]; |
---|
[6107] | 4506 | }, |
---|
[5604] | 4507 | add: function (e, data) { |
---|
[6071] | 4508 | if(!maxAttachmentSize || data.files[0].size < maxAttachmentSize || is_ie) { |
---|
[5604] | 4509 | setTimeout(function() { |
---|
[6071] | 4510 | $('#attDisposition'+ID).val('attachment'); |
---|
[5604] | 4511 | data.submit(); |
---|
[6071] | 4512 | }, 3000); |
---|
[6107] | 4513 | } |
---|
[6752] | 4514 | fileUploadMSG.find(' .attachments-list').show(); |
---|
[6107] | 4515 | $.each(data.files, function (index, file) { |
---|
| 4516 | var attach = {}; |
---|
| 4517 | attach.fullFileName = file.name; |
---|
| 4518 | attach.fileName = file.name; |
---|
[6752] | 4519 | if(file.name.length > 20) |
---|
| 4520 | attach.fileName = file.name.substr(0, 17) + " ... " + file.name.substr(file.name.length-6, file.name.length); |
---|
[6107] | 4521 | attach.fileSize = formatBytes(file.size); |
---|
| 4522 | if(maxAttachmentSize && file.size > maxAttachmentSize) |
---|
[6760] | 4523 | attach.error = 'Tamanho de arquivo nao permitido' |
---|
[6752] | 4524 | else |
---|
[6760] | 4525 | attach.error = true; |
---|
[6752] | 4526 | var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); |
---|
| 4527 | upload.find('.att-box-delete').click(function(){ |
---|
[6107] | 4528 | var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); |
---|
| 4529 | fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); |
---|
[6752] | 4530 | delAttachment(ID, idAttach); |
---|
| 4531 | $(this).parent().qtip("destroy"); |
---|
[6107] | 4532 | $(this).parent().remove(); |
---|
[6752] | 4533 | if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){ |
---|
| 4534 | fileUploadMSG.find(' .attachments-list').hide(); |
---|
| 4535 | } |
---|
[6107] | 4536 | }); |
---|
[6752] | 4537 | |
---|
| 4538 | fileUploadMSG.find('.attachments-list').append(upload); |
---|
[5604] | 4539 | |
---|
[6752] | 4540 | fileUploadMSG.find('.attachments-list .att-box:last').qtip({ |
---|
| 4541 | content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), |
---|
| 4542 | position: { |
---|
| 4543 | corner: { |
---|
| 4544 | tooltip: 'bottomMiddle', |
---|
| 4545 | target: 'topMiddle' |
---|
| 4546 | }, |
---|
| 4547 | adjust: { |
---|
| 4548 | resize: true, |
---|
| 4549 | scroll: true |
---|
| 4550 | } |
---|
| 4551 | }, |
---|
| 4552 | show: { |
---|
| 4553 | when: 'mouseover', // Don't specify a show event |
---|
| 4554 | ready: false // Show the tooltip when ready |
---|
| 4555 | }, |
---|
| 4556 | hide: 'mouseout', // Don't specify a hide event |
---|
| 4557 | style: { |
---|
| 4558 | border: { |
---|
| 4559 | width: 1, |
---|
| 4560 | radius: 5 |
---|
| 4561 | }, |
---|
[6760] | 4562 | padding: 3, |
---|
| 4563 | textAlign: 'left', |
---|
[6752] | 4564 | tip: true, // Give it a speech bubble tip with automatic corner detection |
---|
[6760] | 4565 | name: (typeof(attach.error) == 'boolean' ? 'light' : 'red') // Style it according to the preset 'cream' style |
---|
[6752] | 4566 | } |
---|
| 4567 | }); |
---|
| 4568 | |
---|
[6107] | 4569 | if(!maxAttachmentSize || file.size < maxAttachmentSize){ |
---|
| 4570 | if(data.fileInput){ |
---|
| 4571 | fileUploadMSG.find('.fileinput-button.new').append(data.fileInput[0]).removeClass('new'); |
---|
| 4572 | fileUploadMSG.find('.attachments-list').find('[type=file]').addClass('hidden'); |
---|
| 4573 | } |
---|
| 4574 | }else |
---|
| 4575 | fileUploadMSG.find(' .fileinput-button.new').removeClass('new'); |
---|
[6045] | 4576 | }); |
---|
| 4577 | }, |
---|
[5604] | 4578 | done: function(e, data){ |
---|
[6760] | 4579 | var attach_box = fileUploadMSG.find('.att-box-loading:first').parents('.att-box'); |
---|
| 4580 | var attach = { |
---|
| 4581 | fullFileName : attach_box.find(".att-box-fullfilename").text(), |
---|
| 4582 | fileSize : attach_box.find(".att-box-filesize").text(), |
---|
| 4583 | OK : true, |
---|
| 4584 | error : false |
---|
| 4585 | }; |
---|
[5702] | 4586 | if(!!data.result && data.result != "[]" ){ |
---|
[6071] | 4587 | var newAttach = data.result; |
---|
[6760] | 4588 | if(!newAttach.mailAttachment.error || newAttach.rollback !== false){ |
---|
| 4589 | attach_box.append('<input type="hidden" name="fileId[]" value="'+newAttach['mailAttachment'][0][0].id+'"/>'); |
---|
| 4590 | addAttachment(ID,newAttach['mailAttachment'][0][0].id); |
---|
| 4591 | }else { |
---|
| 4592 | attach_box.addClass('invalid-email-box'); |
---|
| 4593 | attach.error = newAttach.mailAttachment.error ? newAttach.mailAttachment.error : 'Erro ao anexar...';//.append(newAttach.mailAttachment.error).addClass('message-attach-error'); |
---|
| 4594 | } |
---|
[5604] | 4595 | }else { |
---|
[6760] | 4596 | attach_box.addClass('invalid-email-box');//.qtip("api").updateContent("oi", true); |
---|
| 4597 | attach.error = 'Erro ao anexar...'; |
---|
[5604] | 4598 | } |
---|
[6760] | 4599 | attach_box.qtip("destroy").qtip({ |
---|
| 4600 | content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), |
---|
| 4601 | position: { |
---|
| 4602 | corner: { |
---|
| 4603 | tooltip: 'bottomMiddle', |
---|
| 4604 | target: 'topMiddle' |
---|
| 4605 | }, |
---|
| 4606 | adjust: { |
---|
| 4607 | resize: true, |
---|
| 4608 | scroll: true |
---|
| 4609 | } |
---|
| 4610 | }, |
---|
| 4611 | show: { |
---|
| 4612 | when: 'mouseover', // Don't specify a show event |
---|
| 4613 | ready: false // Show the tooltip when ready |
---|
| 4614 | }, |
---|
| 4615 | hide: 'mouseout', // Don't specify a hide event |
---|
| 4616 | style: { |
---|
| 4617 | border: { |
---|
| 4618 | width: 1, |
---|
| 4619 | radius: 5 |
---|
| 4620 | }, |
---|
| 4621 | padding: 3, |
---|
| 4622 | textAlign: 'left', |
---|
| 4623 | tip: true, // Give it a speech bubble tip with automatic corner detection |
---|
| 4624 | name: (attach.error == false ? 'blue' : 'red')// Style it according to the preset 'cream' style |
---|
| 4625 | } |
---|
| 4626 | }); |
---|
[6752] | 4627 | fileUploadMSG.find(' .att-box-loading:first').remove(); |
---|
[5604] | 4628 | } |
---|
[6124] | 4629 | }).css({ |
---|
| 4630 | "height" : "20px", |
---|
| 4631 | "width": (is_webkit ? "205px" : "100px"), |
---|
| 4632 | "border-width": "0 0 0px 0px", |
---|
| 4633 | "-moz-transform" : "rotate(-180deg) translate(-147px, -0.5px) scale(1.1)", |
---|
| 4634 | "-webkit-transform" : "rotate(-180deg) translate(-104px, 0px)" |
---|
[6189] | 4635 | }).end().end().end().filter(".message-attach-link").click(function(){ |
---|
[6107] | 4636 | jQuery('#message-attach-dialog').html(DataLayer.render("../prototype/modules/attach_message/attach_message.ejs", {})); |
---|
| 4637 | $( "#mailpreview_container span.ui-icon-close" ).click(); |
---|
| 4638 | jQuery('#message-attach-dialog').dialog({ |
---|
| 4639 | width:920, |
---|
| 4640 | height:550, |
---|
| 4641 | resizable:false, |
---|
| 4642 | modal: true, |
---|
| 4643 | closeOnEscape:true, |
---|
[6265] | 4644 | close:function(event, ui) {event.stopPropagation();}, |
---|
[6107] | 4645 | autoOpen:false |
---|
| 4646 | }); |
---|
| 4647 | |
---|
| 4648 | |
---|
| 4649 | jQuery.getScript("../prototype/modules/attach_message/attach_message.js", function(){ |
---|
| 4650 | jQuery('#message-attach-dialog').dialog('open'); |
---|
| 4651 | jQuery('#message-attach-attach-btn').unbind('click'); |
---|
| 4652 | jQuery('#message-attach-attach-btn').click(function(event){ |
---|
| 4653 | jQuery.each(selectedMessages, function(folder_name, messages) { |
---|
| 4654 | jQuery.each(selectedMessages[folder_name], function(message_number, message) { |
---|
| 4655 | if (message) { |
---|
[6752] | 4656 | fileUploadMSG.find(' .attachments-list').show(); |
---|
[6107] | 4657 | var att = new Object(); |
---|
| 4658 | att.folder = folder_name; |
---|
| 4659 | att.uid = message_number; |
---|
| 4660 | att.type = 'imapMSG'; |
---|
[6265] | 4661 | att.name = Base64.encode(onceOpenedMessages[folder_name][message_number].subject + '.eml'); |
---|
[6107] | 4662 | var idATT = JSON.stringify(att); |
---|
| 4663 | addAttachment( ID , idATT); |
---|
| 4664 | var attach = {}; |
---|
[6265] | 4665 | attach.fileName = onceOpenedMessages[folder_name][message_number].subject + '.eml'; |
---|
[6752] | 4666 | attach.fullFileName = onceOpenedMessages[folder_name][message_number].subject + '.eml'; |
---|
| 4667 | if(attach.fileName.length > 20) |
---|
| 4668 | attach.fileName = attach.fileName.substr(0, 17) + "... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length); |
---|
[5911] | 4669 | |
---|
[6752] | 4670 | attach.error = ""; |
---|
[6107] | 4671 | attach.fileSize = formatBytes(onceOpenedMessages[folder_name][message_number].size); |
---|
| 4672 | var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); |
---|
[6752] | 4673 | upload.find('.att-box-loading').remove(); |
---|
[6107] | 4674 | upload.append('<input type="hidden" name="fileId[]" value=\''+idATT+'\'/>'); |
---|
| 4675 | |
---|
[6752] | 4676 | upload.find('.att-box-delete').click(function(){ |
---|
| 4677 | var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); |
---|
| 4678 | fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); |
---|
| 4679 | delAttachment(ID,idAttach); |
---|
| 4680 | $(this).parent().qtip("destroy"); |
---|
| 4681 | $(this).parent().remove(); |
---|
| 4682 | if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){ |
---|
| 4683 | fileUploadMSG.find(' .attachments-list').hide(); |
---|
| 4684 | } |
---|
[6107] | 4685 | }); |
---|
| 4686 | |
---|
[6752] | 4687 | fileUploadMSG.find('.attachments-list').append(upload); |
---|
| 4688 | |
---|
| 4689 | upload.find('.att-box-loading').remove(); |
---|
| 4690 | |
---|
| 4691 | fileUploadMSG.find('.attachments-list .att-box:last').qtip({ |
---|
| 4692 | content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), |
---|
| 4693 | position: { |
---|
| 4694 | corner: { |
---|
| 4695 | tooltip: 'bottomMiddle', |
---|
| 4696 | target: 'topMiddle' |
---|
| 4697 | }, |
---|
| 4698 | adjust: { |
---|
| 4699 | resize: true, |
---|
| 4700 | scroll: true |
---|
| 4701 | } |
---|
| 4702 | }, |
---|
| 4703 | show: { |
---|
| 4704 | when: 'mouseover', // Don't specify a show event |
---|
| 4705 | ready: false // Show the tooltip when ready |
---|
| 4706 | }, |
---|
| 4707 | hide: 'mouseout', // Don't specify a hide event |
---|
| 4708 | style: { |
---|
| 4709 | border: { |
---|
| 4710 | width: 1, |
---|
| 4711 | radius: 5 |
---|
| 4712 | }, |
---|
| 4713 | padding: 5, |
---|
| 4714 | textAlign: 'center', |
---|
| 4715 | tip: true, // Give it a speech bubble tip with automatic corner detection |
---|
| 4716 | name: 'blue' // Style it according to the preset 'cream' style |
---|
| 4717 | } |
---|
| 4718 | }); |
---|
[6107] | 4719 | } |
---|
| 4720 | }); |
---|
| 4721 | }); |
---|
| 4722 | |
---|
| 4723 | jQuery('#message-attach-dialog').dialog('close'); |
---|
| 4724 | |
---|
| 4725 | }); |
---|
| 4726 | jQuery('#message-attach-cancel-btn').click(function(event){ |
---|
| 4727 | jQuery('#message-attach-dialog').dialog('close'); |
---|
| 4728 | }); |
---|
| 4729 | }); |
---|
| 4730 | }); |
---|
[6752] | 4731 | $(document).bind('drop dragover', function (e) { |
---|
| 4732 | e.preventDefault(); |
---|
| 4733 | }); |
---|
| 4734 | //DRAG and DROP DE ARQUIVOS NÃO FUNCIONA NO IE |
---|
| 4735 | if(!is_ie){ |
---|
| 4736 | $("body").bind('dragenter', function (e) { |
---|
| 4737 | var dropZone = $("#fileupload_msg"+ID+"_droopzone"); |
---|
| 4738 | var timeout = window.dropZoneTimeout; |
---|
| 4739 | dropZone.show(); |
---|
| 4740 | dropZone.prev().hide(); |
---|
| 4741 | if (!timeout) { |
---|
| 4742 | dropZone.addClass('in'); |
---|
| 4743 | } else { |
---|
| 4744 | clearTimeout(timeout); |
---|
| 4745 | } |
---|
| 4746 | if (e.target === dropZone[0]) { |
---|
| 4747 | dropZone.addClass('hover'); |
---|
| 4748 | } else { |
---|
| 4749 | dropZone.removeClass('hover'); |
---|
| 4750 | } |
---|
| 4751 | $(window).unbind('dragleave'); |
---|
| 4752 | window.dropZoneTimeout = setTimeout(function () { |
---|
| 4753 | $(window).bind('dragleave', function (e) { |
---|
| 4754 | window.dropZoneTimeout = null; |
---|
| 4755 | dropZone.removeClass('in hover'); |
---|
| 4756 | dropZone.hide(); |
---|
| 4757 | dropZone.prev().show(); |
---|
| 4758 | }); |
---|
| 4759 | }, 1); |
---|
| 4760 | }).bind('dragleave', function (e) { |
---|
| 4761 | var dropZone = $("#fileupload_msg"+ID+"_droopzone"); |
---|
| 4762 | window.dropZoneTimeout = setTimeout(function () { |
---|
| 4763 | $(window).bind('dragleave', function (e) { |
---|
| 4764 | window.dropZoneTimeout = null; |
---|
| 4765 | dropZone.removeClass('in hover'); |
---|
| 4766 | dropZone.hide(); |
---|
| 4767 | dropZone.prev().show(); |
---|
| 4768 | }); |
---|
| 4769 | }, 1); |
---|
| 4770 | }).bind('drop', function(e){ |
---|
| 4771 | var dropZone = $("#fileupload_msg"+ID+"_droopzone"); |
---|
| 4772 | window.dropZoneTimeout = null; |
---|
| 4773 | dropZone.removeClass('in hover'); |
---|
| 4774 | dropZone.hide(); |
---|
| 4775 | dropZone.prev().show(); |
---|
| 4776 | }); |
---|
| 4777 | } |
---|
[1701] | 4778 | return ID; |
---|
[2] | 4779 | } |
---|
| 4780 | |
---|
| 4781 | // Verify if any user is sharing his name/email address |
---|
| 4782 | // for use in the new messages's "From " field. |
---|
| 4783 | function draw_from_field(sel_from,tr1_1){ |
---|
| 4784 | |
---|
| 4785 | var el_shared_users = Element("el_shared_users"); |
---|
[6447] | 4786 | /* Recupera a pasta atual do usuário (selecionada) */ |
---|
| 4787 | var user_shared = folder.split(cyrus_delimiter); |
---|
| 4788 | /* Verifica se está nas próprias pastas */ |
---|
| 4789 | if(user_shared[0] == "INBOX"){ |
---|
| 4790 | user_shared = User.me.uid; |
---|
| 4791 | }else{ |
---|
| 4792 | user_shared = user_shared[1]; |
---|
| 4793 | } |
---|
[2] | 4794 | // The element was loaded and populated...so return. |
---|
[3035] | 4795 | if(el_shared_users){ |
---|
[371] | 4796 | // Nothing to work...so return. |
---|
| 4797 | if(el_shared_users.options.length == 0) |
---|
| 4798 | return; |
---|
[2] | 4799 | tr1_1.style.display = ''; |
---|
| 4800 | for (var x = 0; x < el_shared_users.options.length; x++) { |
---|
| 4801 | var _option = document.createElement("OPTION"); |
---|
| 4802 | _option.text = el_shared_users.options[x].text; |
---|
| 4803 | _option.value = el_shared_users.options[x].value; |
---|
[6447] | 4804 | /* Faz o tratamento do nome da pasta para fazer a verificação e selecionar o valor no select */ |
---|
| 4805 | var str_begin_name = _option.text.indexOf('<') + 1; |
---|
| 4806 | var str_end_name = _option.text.indexOf('@'); |
---|
| 4807 | var user_selected_name = _option.text.substring(str_begin_name, str_end_name); |
---|
| 4808 | /* Verifica se é o usuário da pasta selecionada */ |
---|
| 4809 | if(user_selected_name == user_shared){ |
---|
| 4810 | _option.selected = 'selected'; |
---|
| 4811 | } |
---|
[2] | 4812 | sel_from.options[sel_from.options.length] = _option ; |
---|
| 4813 | } |
---|
| 4814 | return; |
---|
| 4815 | } |
---|
| 4816 | // Get the shared folders..... |
---|
| 4817 | var sharedFolders = new Array(); |
---|
| 4818 | for(var i = 0; i < folders.length; i++) { |
---|
| 4819 | var x = folders[i].folder_id; |
---|
[3035] | 4820 | if (folders[i].folder_parent == 'user'){ |
---|
| 4821 | sharedFolders[sharedFolders.length] = x; |
---|
| 4822 | } |
---|
| 4823 | } |
---|
[2] | 4824 | |
---|
[3035] | 4825 | var matchUser = '#'; |
---|
| 4826 | var sharedUsers = new Array(); |
---|
[2] | 4827 | // Filter the shared folders (only root folders) ..... |
---|
| 4828 | for(var i = 0; i < sharedFolders.length; i++) { |
---|
| 4829 | matchUser = sharedFolders[i]; |
---|
| 4830 | sharedUsers[sharedUsers.length] = matchUser.substring(("user"+cyrus_delimiter).length,matchUser.length); |
---|
[3035] | 4831 | } |
---|
[2] | 4832 | |
---|
| 4833 | // Handler function for cExecute |
---|
| 4834 | var h_user = function(data) { |
---|
[371] | 4835 | if(data.length > 0) { |
---|
| 4836 | tr1_1.style.display = ''; |
---|
[6447] | 4837 | var mycn = typeof(data.myname != 'undefined') ? data.myname : ''; |
---|
[2] | 4838 | var _option = document.createElement("OPTION"); |
---|
[5134] | 4839 | _option.text = '"'+mycn+'" <'+Element("user_email").value+'>'; |
---|
| 4840 | _option.value = mycn+";"+Element("user_email").value; |
---|
[6447] | 4841 | /* Verifica se é o usuário logado */ |
---|
| 4842 | if(user_shared == User.me.uid) |
---|
| 4843 | _option.selected = 'selected'; |
---|
[371] | 4844 | sel_from.options[sel_from.options.length] = _option; |
---|
[3035] | 4845 | |
---|
[371] | 4846 | var options = ''; |
---|
[6447] | 4847 | var cn = ''; |
---|
[6263] | 4848 | for (var x = 0; x < data.length; x++) { |
---|
[5134] | 4849 | cn = typeof(data[x].cn[0] != 'undefined') ? data[x].cn[0] : ''; |
---|
[371] | 4850 | var _option = document.createElement("OPTION"); |
---|
[5134] | 4851 | _option.text = '"'+cn+'" <'+data[x].mail[0]+'>'; |
---|
| 4852 | _option.value = cn+';'+data[x].mail[0]+';'+data[x].save_shared[0]+';'+data[x].uid[0]; |
---|
[6447] | 4853 | /* Faz o tratamento do nome da pasta para fazer a verificação e selecionar o valor no select */ |
---|
| 4854 | var str_begin_name = _option.text.indexOf('<') + 1; |
---|
| 4855 | var str_end_name = _option.text.indexOf('@'); |
---|
| 4856 | var user_selected_name = _option.text.substring(str_begin_name, str_end_name); |
---|
| 4857 | /* Verifica se é o usuário da pasta selecionada */ |
---|
| 4858 | if(user_selected_name == user_shared){ |
---|
| 4859 | _option.selected = 'selected'; |
---|
| 4860 | } |
---|
[371] | 4861 | sel_from.options[sel_from.options.length] = _option ; |
---|
[6263] | 4862 | } |
---|
[2] | 4863 | } |
---|
| 4864 | var shared_users_from = Element("el_shared_users"); |
---|
| 4865 | if(!shared_users_from) { |
---|
| 4866 | shared_users_from = sel_from.cloneNode(true); |
---|
| 4867 | shared_users_from.id = "el_shared_users"; |
---|
| 4868 | shared_users_from.style.display = 'none'; |
---|
| 4869 | document.body.appendChild(shared_users_from); |
---|
| 4870 | } |
---|
| 4871 | } |
---|
| 4872 | // First time, so execute..... |
---|
| 4873 | cExecute ("$this.ldap_functions.getSharedUsersFrom&uids="+sharedUsers.join(';'), h_user); |
---|
| 4874 | } |
---|
| 4875 | |
---|
| 4876 | function changeBgColorToON(all_messages, begin, end){ |
---|
[5134] | 4877 | var _tab_prefix = getTabPrefix(); |
---|
| 4878 | var _msg_id; |
---|
[163] | 4879 | for (begin; begin<=end; begin++) |
---|
| 4880 | { |
---|
[5134] | 4881 | _msg_id = getMessageIdFromRowId(all_messages[begin].id); |
---|
[163] | 4882 | add_className(all_messages[begin], 'selected_msg'); |
---|
[5134] | 4883 | Element(_tab_prefix + "check_box_message_" + _msg_id).checked = true; |
---|
[2] | 4884 | } |
---|
| 4885 | } |
---|
[4493] | 4886 | |
---|
[976] | 4887 | function updateBoxBgColor(box){ |
---|
| 4888 | // Set first TR Class |
---|
| 4889 | var _className = 'tr_msg_read2'; |
---|
[3035] | 4890 | for(var i = 0; i < box.length;i++){ |
---|
[976] | 4891 | if(exist_className(box[i],_className)) |
---|
| 4892 | remove_className(box[i], _className); |
---|
| 4893 | _className = (_className == 'tr_msg_read2' ? 'tr_msg_read' : 'tr_msg_read2'); |
---|
| 4894 | if(!exist_className(box[i],_className)) |
---|
| 4895 | add_className( box[i], _className); |
---|
| 4896 | } |
---|
| 4897 | } |
---|
[4802] | 4898 | function changeBgColor(event, msg_number) { |
---|
| 4899 | var _element_id = msg_number.toString(); |
---|
| 4900 | var first_order, last_order; |
---|
[2] | 4901 | |
---|
[4802] | 4902 | if (typeof(currentTab)!='number') { |
---|
| 4903 | _element_id = _element_id+'_s'+numBox; |
---|
| 4904 | } |
---|
| 4905 | actual_tr = Element(_element_id); |
---|
[2] | 4906 | |
---|
[163] | 4907 | if (event.shiftKey) |
---|
| 4908 | { |
---|
[4802] | 4909 | var last_tr = Element(last_message_selected); |
---|
[2] | 4910 | if(!last_tr) |
---|
| 4911 | last_tr = actual_tr; |
---|
| 4912 | |
---|
[4802] | 4913 | var all_messages = actual_tr.parentNode.childNodes; |
---|
[3035] | 4914 | |
---|
[163] | 4915 | for (var i=0; i < all_messages.length; i++) |
---|
| 4916 | { |
---|
| 4917 | if (actual_tr.id == all_messages[i].id) |
---|
[2] | 4918 | first_order = i; |
---|
[163] | 4919 | if (last_tr.id == all_messages[i].id) |
---|
[2] | 4920 | last_order = i; |
---|
| 4921 | } |
---|
[3035] | 4922 | |
---|
[163] | 4923 | if (parseInt(first_order) > parseInt(last_order)) |
---|
| 4924 | changeBgColorToON(all_messages, last_order, first_order); |
---|
| 4925 | else |
---|
| 4926 | changeBgColorToON(all_messages, first_order, last_order); |
---|
[5588] | 4927 | }else if(event.target != document.getElementById(getTabPrefix()+'check_box_message_' + msg_number)){ |
---|
| 4928 | if($(event.target).attr("checked") == "checked"){ |
---|
| 4929 | $(event.target).parents("tr:first").addClass("selected_msg"); |
---|
| 4930 | }else{ |
---|
| 4931 | $(event.target).parents("tr:first").removeClass("selected_msg"); |
---|
| 4932 | } |
---|
[2] | 4933 | } |
---|
| 4934 | else{ |
---|
[163] | 4935 | //if ( exist_className(actual_tr, 'selected_msg') ) |
---|
[5134] | 4936 | if ( document.getElementById(getTabPrefix()+'check_box_message_' + msg_number).checked ){ |
---|
| 4937 | if( document.getElementById("chk_box_select_all_messages").checked) { |
---|
| 4938 | add_className(actual_tr, 'selected_msg selected_shortcut_msg'); |
---|
| 4939 | }else |
---|
[163] | 4940 | add_className(actual_tr, 'selected_msg'); |
---|
[5134] | 4941 | }else{ |
---|
| 4942 | if( document.getElementById("chk_box_select_all_messages").checked){ |
---|
| 4943 | remove_className(actual_tr, 'selected_msg selected_shortcut_msg'); |
---|
| 4944 | remove_className(actual_tr, 'selected_msg'); |
---|
| 4945 | remove_chk_box_select_all_messages(); |
---|
| 4946 | if(actual_tr.className == 'selected_msg') |
---|
[163] | 4947 | remove_className(actual_tr, 'selected_msg'); |
---|
[5134] | 4948 | }else |
---|
| 4949 | remove_className(actual_tr, 'selected_msg'); |
---|
| 4950 | } |
---|
[2] | 4951 | } |
---|
[4802] | 4952 | last_message_selected = _element_id; |
---|
[2] | 4953 | } |
---|
| 4954 | |
---|
| 4955 | function build_quota(data){ |
---|
| 4956 | id = "content_quota"; |
---|
| 4957 | q_limit = data['quota_limit']; |
---|
| 4958 | var div = document.getElementById(id); |
---|
| 4959 | if(!q_limit){ |
---|
[3035] | 4960 | div.innerHTML = '<span><font size="2" style="color:red"><strong>'+get_lang("Without Quota")+'</strong></font></span>'; |
---|
[2] | 4961 | } |
---|
| 4962 | else{ |
---|
[5754] | 4963 | if(div) |
---|
| 4964 | div.innerHTML = ''; |
---|
| 4965 | value = data['quota_percent']; |
---|
| 4966 | q_used = data['quota_used']; |
---|
| 4967 | table = document.getElementById("table_quota"); |
---|
| 4968 | if(table) |
---|
| 4969 | table.parentNode.removeChild(table); |
---|
| 4970 | table = document.createElement("TABLE"); |
---|
| 4971 | tbody = document.createElement("TBODY"); |
---|
| 4972 | table.appendChild(tbody); |
---|
| 4973 | table.id = "table_quota"; |
---|
| 4974 | table.width="102"; |
---|
| 4975 | table.border="0"; |
---|
| 4976 | table.cellSpacing = 0; |
---|
| 4977 | table.cellPadding = 0; |
---|
[3035] | 4978 | |
---|
[5754] | 4979 | //tr1 = document.createElement("TR"); |
---|
| 4980 | td11 = document.createElement("TD"); |
---|
| 4981 | td11.align="center"; |
---|
| 4982 | td11.setAttribute("noWrap","true"); |
---|
| 4983 | td11.innerHTML += '<div id="quota_progressbar" class="boxHeaderText" style="display: block; float: left; height: 13px; width: 121px;"></div> <span class="boxHeaderText" style="line-height : 0px;">' + value+"% ("+borkb(q_used*1024)+"/"+borkb(q_limit*1024)+")</span>"; |
---|
| 4984 | //tr1.appendChild(td11); |
---|
[3035] | 4985 | |
---|
[5754] | 4986 | tr2 = document.createElement("TR"); |
---|
| 4987 | td22 = document.createElement("TD"); |
---|
[3035] | 4988 | |
---|
[5754] | 4989 | //td21.appendChild(table221); |
---|
| 4990 | //tr2.appendChild(td21); |
---|
| 4991 | tr2.appendChild(td11); |
---|
| 4992 | //tr2.appendChild(td1); |
---|
[4934] | 4993 | |
---|
[5754] | 4994 | tbody.appendChild(tr2); //Desenho |
---|
| 4995 | //tbody.appendChild(tr1); //Letras |
---|
| 4996 | div.appendChild(table); |
---|
| 4997 | $("#quota_progressbar").progressbar({ |
---|
| 4998 | value: value |
---|
| 4999 | }); |
---|
| 5000 | if(value > 90) { |
---|
| 5001 | if(value >= 100) |
---|
| 5002 | write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages.")); |
---|
| 5003 | else |
---|
| 5004 | write_msg(get_lang("Warning: Your Mailbox is almost full!")); |
---|
| 5005 | $("#quota_progressbar").find(".ui-progressbar-value").css({"background-image": "url(templates/default/images/dsalert.gif)", "border-color" : "red"}); |
---|
| 5006 | } |
---|
| 5007 | else if(value > 80) |
---|
| 5008 | $("#quota_progressbar").find(".ui-progressbar-value").css({"background-image": "url(templates/default/images/dswarn.gif)", "border-color" : "yellow"}); |
---|
[2] | 5009 | } |
---|
| 5010 | } |
---|
| 5011 | |
---|
| 5012 | function draw_quota(data){ |
---|
[5754] | 5013 | this.build_quota(data); |
---|
[2] | 5014 | } |
---|
| 5015 | |
---|
[345] | 5016 | function update_quota(folder_id){ |
---|
[5754] | 5017 | cExecute ("$this.imap_functions.get_quota&folder_id="+folder_id,this.build_quota); |
---|
[2] | 5018 | } |
---|
| 5019 | |
---|
| 5020 | function draw_search(headers_msgs){ |
---|
| 5021 | Element("border_id_0").innerHTML = " " + get_lang('Search Result') + " "; |
---|
| 5022 | |
---|
| 5023 | var tbody = Element('tbody_box'); |
---|
| 5024 | for (var i=0; i<(headers_msgs.length); i++){ |
---|
[3493] | 5025 | // passa parâmetro offset |
---|
[2] | 5026 | var tr = this.make_tr_message(headers_msgs[i], headers_msgs[i].msg_folder); |
---|
[790] | 5027 | if (tr) |
---|
| 5028 | tbody.appendChild(tr); |
---|
[2] | 5029 | } |
---|
| 5030 | } |
---|
| 5031 | |
---|
| 5032 | function draw_search_header_box(){ |
---|
| 5033 | var table_message_header_box = Element("table_message_header_box"); |
---|
| 5034 | table_message_header_box.parentNode.removeChild(table_message_header_box); |
---|
| 5035 | |
---|
| 5036 | var content_id_0 = Element("content_id_0"); |
---|
| 5037 | var table_element = document.createElement("TABLE"); |
---|
| 5038 | var tbody_element = document.createElement("TBODY"); |
---|
| 5039 | table_element.setAttribute("id", "table_message_header_box"); |
---|
| 5040 | table_element.className = "table_message_header_box"; |
---|
| 5041 | tr_element = document.createElement("TR"); |
---|
| 5042 | tr_element.className = "message_header"; |
---|
| 5043 | td_element1 = document.createElement("TD"); |
---|
| 5044 | td_element1.setAttribute("width", "1%"); |
---|
| 5045 | chk_box_element = document.createElement("INPUT"); |
---|
| 5046 | chk_box_element.id = "chk_box_select_all_messages"; |
---|
| 5047 | chk_box_element.setAttribute("type", "checkbox"); |
---|
| 5048 | chk_box_element.className = "checkbox"; |
---|
| 5049 | chk_box_element.onclick = function(){select_all_messages(this.checked);}; |
---|
| 5050 | chk_box_element.onmouseover = function () {this.title=get_lang('Select all messages.')}; |
---|
| 5051 | chk_box_element.onkeydown = function (e){ |
---|
| 5052 | if (is_ie) |
---|
| 5053 | { |
---|
| 5054 | if ((window.event.keyCode) == 46) |
---|
| 5055 | { |
---|
| 5056 | //delete_all_selected_msgs_imap(); |
---|
[689] | 5057 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 5058 | } |
---|
| 5059 | } |
---|
| 5060 | else |
---|
| 5061 | { |
---|
| 5062 | if ((e.keyCode) == 46) |
---|
| 5063 | { |
---|
| 5064 | //delete_all_selected_msgs_imap(); |
---|
[689] | 5065 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 5066 | } |
---|
| 5067 | } |
---|
| 5068 | }; |
---|
[3035] | 5069 | |
---|
[2] | 5070 | td_element1.appendChild(chk_box_element); |
---|
| 5071 | td_element2 = document.createElement("TD"); |
---|
| 5072 | td_element2.setAttribute("width", "3%"); |
---|
| 5073 | td_element3 = document.createElement("TD"); |
---|
| 5074 | td_element3.setAttribute("width", "30%"); |
---|
| 5075 | td_element3.id = "message_header_SORTFROM"; |
---|
| 5076 | td_element3.align = "left"; |
---|
| 5077 | td_element3.innerHTML = get_lang("From"); |
---|
| 5078 | td_element4 = document.createElement("TD"); |
---|
| 5079 | td_element4.setAttribute("width", "49%"); |
---|
| 5080 | td_element4.id = "message_header_SORTSUBJECT"; |
---|
| 5081 | td_element4.align = "left"; |
---|
[3035] | 5082 | td_element4.innerHTML = get_lang("Subject"); |
---|
[2] | 5083 | td_element5 = document.createElement("TD"); |
---|
| 5084 | td_element5.setAttribute("width", "10%"); |
---|
| 5085 | td_element5.id = "message_header_SORTARRIVAL"; |
---|
| 5086 | td_element5.align = "center"; |
---|
[3035] | 5087 | td_element5.innerHTML = "<B>"+get_lang("Date")+"</B>"; |
---|
[790] | 5088 | td_element5.innerHTML += "<img src ='templates/"+template+"/images/arrow_descendant.gif'>"; |
---|
[2] | 5089 | td_element6 = document.createElement("TD"); |
---|
| 5090 | td_element6.setAttribute("width", "10%"); |
---|
| 5091 | td_element6.id = "message_header_SORTSIZE"; |
---|
| 5092 | td_element6.align = "right"; |
---|
| 5093 | td_element6.innerHTML = get_lang("Size"); |
---|
| 5094 | tr_element.appendChild(td_element1); |
---|
| 5095 | tr_element.appendChild(td_element2); |
---|
| 5096 | tr_element.appendChild(td_element3); |
---|
| 5097 | tr_element.appendChild(td_element4); |
---|
| 5098 | tr_element.appendChild(td_element5); |
---|
| 5099 | tr_element.appendChild(td_element6); |
---|
[3035] | 5100 | |
---|
[2] | 5101 | tbody_element.appendChild(tr_element); |
---|
| 5102 | table_element.appendChild(tbody_element); |
---|
| 5103 | content_id_0.appendChild(table_element); |
---|
| 5104 | } |
---|
| 5105 | |
---|
| 5106 | function draw_search_division(msg){ |
---|
| 5107 | var tbody = Element('tbody_box'); |
---|
| 5108 | var tr = document.createElement("TR"); |
---|
| 5109 | var td = document.createElement("TD"); |
---|
| 5110 | td.colSpan = '7'; |
---|
| 5111 | td.width = '100%'; |
---|
| 5112 | |
---|
| 5113 | var action_info_table = document.createElement("TABLE"); |
---|
| 5114 | var action_info_tbody = document.createElement("TBODY"); |
---|
[3035] | 5115 | |
---|
[2] | 5116 | action_info_table.className = "action_info_table"; |
---|
| 5117 | action_info_table.width = "100%"; |
---|
[3035] | 5118 | |
---|
[2] | 5119 | var action_info_tr = document.createElement("TR"); |
---|
[3035] | 5120 | |
---|
[2] | 5121 | var action_info_th1 = document.createElement("TH"); |
---|
| 5122 | action_info_th1.width = "40%"; |
---|
| 5123 | action_info_th1.innerHTML = " "; |
---|
| 5124 | |
---|
| 5125 | var action_info_th2 = document.createElement("TH"); |
---|
[3035] | 5126 | |
---|
[2] | 5127 | action_info_th2.innerHTML = msg; |
---|
| 5128 | action_info_th2.className = "action_info_th"; |
---|
| 5129 | action_info_th2.setAttribute("noWrap", "true"); |
---|
[3035] | 5130 | |
---|
[2] | 5131 | var action_info_th3 = document.createElement("TH"); |
---|
| 5132 | action_info_th3.width = "40%"; |
---|
| 5133 | action_info_th3.innerHTML = " "; |
---|
[3035] | 5134 | |
---|
[2] | 5135 | action_info_tr.appendChild(action_info_th1); |
---|
| 5136 | action_info_tr.appendChild(action_info_th2); |
---|
| 5137 | action_info_tr.appendChild(action_info_th3); |
---|
| 5138 | action_info_tbody.appendChild(action_info_tr); |
---|
| 5139 | action_info_table.appendChild(action_info_tbody); |
---|
| 5140 | |
---|
| 5141 | td.appendChild(action_info_table); |
---|
| 5142 | tr.appendChild(td); |
---|
| 5143 | tbody.appendChild(tr); |
---|
| 5144 | } |
---|
| 5145 | |
---|
| 5146 | function draw_search_box(){ |
---|
| 5147 | var content_id_0 = Element("content_id_0"); |
---|
| 5148 | var table = document.createElement("TABLE"); |
---|
| 5149 | table.id = "table_box"; |
---|
| 5150 | table.width = 'auto'; |
---|
| 5151 | var tbody = document.createElement("TBODY"); |
---|
| 5152 | tbody.id = "tbody_box"; |
---|
| 5153 | |
---|
| 5154 | table.className = "table_box"; |
---|
| 5155 | table.setAttribute("frame", "below"); |
---|
| 5156 | table.setAttribute("rules", "none"); |
---|
| 5157 | table.setAttribute("cellpadding", "0"); |
---|
| 5158 | table.onkeydown = function (e){ |
---|
| 5159 | if (is_ie) |
---|
| 5160 | { |
---|
| 5161 | if ((window.event.keyCode) == 46) |
---|
| 5162 | { |
---|
| 5163 | //delete_all_selected_msgs_imap(); |
---|
[689] | 5164 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 5165 | } |
---|
| 5166 | } |
---|
| 5167 | else |
---|
| 5168 | { |
---|
| 5169 | if ((e.keyCode) == 46) |
---|
| 5170 | { |
---|
| 5171 | //delete_all_selected_msgs_imap(); |
---|
[689] | 5172 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 5173 | } |
---|
| 5174 | } |
---|
| 5175 | }; |
---|
| 5176 | if (is_ie) |
---|
| 5177 | table.style.cursor = "hand"; |
---|
[3035] | 5178 | |
---|
[2] | 5179 | table.appendChild(tbody); |
---|
| 5180 | content_id_0.appendChild(table); |
---|
| 5181 | } |
---|
[4820] | 5182 | var idx_cc = 0; |
---|
[4493] | 5183 | |
---|
| 5184 | function draw_plugin_cc(ID, addrs){ |
---|
[2] | 5185 | connector.loadScript("ccQuickAdd"); |
---|
| 5186 | |
---|
| 5187 | var array_addrs = ''; |
---|
[3035] | 5188 | var array_name = ''; |
---|
[2] | 5189 | var cc_data = new Array(); |
---|
[3035] | 5190 | if(typeof(addrs.name) != 'undefined') { |
---|
[2] | 5191 | array_name = LTrim(addrs.name).split(" "); |
---|
[3035] | 5192 | array_addrs = new Array(addrs.email); |
---|
[2] | 5193 | } |
---|
| 5194 | else { |
---|
| 5195 | array_addrs = (typeof addrs == 'object' ? addrs.toString().split("\" ") : addrs.split("\" ")); |
---|
[3035] | 5196 | array_name = LTrim(array_addrs[0]).replace('"','').split(" "); |
---|
[2] | 5197 | } |
---|
| 5198 | |
---|
| 5199 | var _split = array_name[0].split('@'); |
---|
| 5200 | cc_data[0] = _split[0]; |
---|
| 5201 | cc_data[1] = _split[0]; |
---|
| 5202 | cc_data[2] = ''; |
---|
| 5203 | |
---|
| 5204 | for (i=1; i < array_name.length; i++) |
---|
[3035] | 5205 | cc_data[2] += array_name[i] + " "; |
---|
[2] | 5206 | |
---|
[3035] | 5207 | |
---|
| 5208 | if(array_addrs.length > 1) |
---|
| 5209 | cc_data[3] = array_addrs[1] ? array_addrs[1].replace("<",'').replace(">",'') : ''; |
---|
[2] | 5210 | else |
---|
| 5211 | cc_data[3] = array_addrs[0]; |
---|
[3035] | 5212 | |
---|
[6678] | 5213 | var onclick = ''; |
---|
| 5214 | $.each(cc_data, function(index, value){ |
---|
| 5215 | onclick += "'"+value+"',"; |
---|
| 5216 | }); |
---|
| 5217 | onclick = onclick.substr(0, onclick.length-1); |
---|
[106] | 5218 | var sm_envelope_img1 = '<img style="cursor:'+ (is_ie ? 'hand' : 'pointer') +'" title="' + get_lang("Add Contact") + |
---|
[6678] | 5219 | '" onclick="ccQuickAddOne.showList(['+onclick+'])" src="./templates/'+template+'/images/user_card.png">'; |
---|
[2] | 5220 | var to_addybook_add = "<SPAN id='insert_plugin_"+idx_cc+"_"+ID+"'>"; |
---|
| 5221 | to_addybook_add += addrs; |
---|
| 5222 | to_addybook_add += sm_envelope_img1; |
---|
| 5223 | idx_cc++; |
---|
| 5224 | to_addybook_add += "</SPAN>"; |
---|
| 5225 | return to_addybook_add; |
---|
| 5226 | } |
---|
[4493] | 5227 | |
---|
[2] | 5228 | function deny_email(email){ |
---|
| 5229 | connector.loadScript("filter"); |
---|
[375] | 5230 | connector.loadScript("filters"); |
---|
[2] | 5231 | var dn_em = document.createElement("SPAN"); |
---|
| 5232 | dn_em.id = "tt_d"; |
---|
[6265] | 5233 | dn_em.onclick = function(){block_user_email(email); /*filter.new_rule(email);*/}; |
---|
[106] | 5234 | dn_em.setAttribute("title",get_lang("Block Sender")); |
---|
[3035] | 5235 | dn_em.style.cursor = "pointer"; |
---|
[5630] | 5236 | dn_em.innerHTML = "<script src='../prototype/modules/filters/filters.js'></script><img align='top' src='./templates/"+template+"/images/deny.gif'>"; |
---|
[2] | 5237 | return dn_em; |
---|
[3035] | 5238 | |
---|
[2] | 5239 | } |
---|
[4493] | 5240 | |
---|
[13] | 5241 | function show_div_address_full(id, type) { |
---|
| 5242 | var div_address_full = Element("div_"+type+"address_full_"+id); |
---|
| 5243 | if(!div_address_full) { |
---|
| 5244 | div_address_full = document.createElement("SPAN"); |
---|
[3035] | 5245 | div_address_full.id = "div_"+type+"address_full_"+id; |
---|
| 5246 | div_address_full.style.display="none"; |
---|
[13] | 5247 | var _address = eval(type+"address_array['"+id+"']"); |
---|
| 5248 | var isOverLimit = (_address.length > 100); |
---|
[3035] | 5249 | |
---|
[2] | 5250 | if(isOverLimit) { |
---|
[446] | 5251 | alert("Esse campo possui muitos endereços ("+_address.length+" destinatários).\r\n"+ |
---|
| 5252 | "Para evitar o travamento do navegador, o botão 'Adicionar Contato' foi desabilitado!"); |
---|
[2] | 5253 | } |
---|
[13] | 5254 | |
---|
| 5255 | for(var idx = 1 ; idx < _address.length;idx++) { |
---|
| 5256 | div_address_full.innerHTML += isOverLimit ? '<br>'+_address[idx] : ','+draw_plugin_cc(id,_address[idx]); |
---|
[3035] | 5257 | } |
---|
[13] | 5258 | 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>)"; |
---|
| 5259 | Element(type+"_"+id).appendChild(div_address_full); |
---|
[2] | 5260 | } |
---|
[13] | 5261 | Element('div_'+type+'address_'+id).style.display='none'; |
---|
| 5262 | div_address_full.style.display=''; |
---|
[46] | 5263 | } |
---|
[4493] | 5264 | |
---|
[46] | 5265 | function draw_footer_box(num_msgs){ |
---|
[689] | 5266 | folder = get_current_folder(); |
---|
[3287] | 5267 | connector.loadScript('wfolders'); |
---|
[3035] | 5268 | var span_R = Element("table_message"); |
---|
| 5269 | var span_options = Element("span_options"); |
---|
[58] | 5270 | if(!span_options) { |
---|
[3035] | 5271 | span_options = document.createElement("TD"); |
---|
[58] | 5272 | span_options.style.fontSize = "12"; |
---|
| 5273 | span_options.id = "span_options"; |
---|
[59] | 5274 | span_R.appendChild(span_options); |
---|
| 5275 | } |
---|
[69] | 5276 | |
---|
[790] | 5277 | var change_font_color = 'onmouseover="var last_class = this.className;'+ |
---|
[848] | 5278 | 'if (this.className != \'message_options_over\')'+ |
---|
| 5279 | 'this.className=\'message_options_active\'; '+ |
---|
[790] | 5280 | 'this.onmouseout=function(){this.className=last_class;}"'; |
---|
| 5281 | |
---|
| 5282 | span_options.innerHTML = |
---|
| 5283 | '<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>'+ |
---|
| 5284 | '<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] | 5285 | ((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] | 5286 | // '<span class="message_options_print"><span ' + change_font_color + ' title="'+get_lang("Print")+'" class="message_options" onclick=print_all()>'+get_lang("Print")+'</span></span>'+ |
---|
[3035] | 5287 | ((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>') + |
---|
[1141] | 5288 | ((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>'); |
---|
[3035] | 5289 | if(preferences.use_local_messages==1 && !expresso_offline) |
---|
[1000] | 5290 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
[5215] | 5291 | span_options.innerHTML += ' <span id="localOption" ' + change_font_color + ' title="'+get_lang("Unarchive")+'" class="message_options" onclick="expresso_local_messages.unarchive_msgs(\''+folder+'\',null)">'+get_lang("Unarchive")+'</span>'; |
---|
[1000] | 5292 | else |
---|
[5215] | 5293 | span_options.innerHTML += ' <span id="localOption" ' + change_font_color + ' title="'+get_lang("Archive")+'" class="message_options" onclick="archive_msgs(\''+folder+'\',null)">'+get_lang("Archive")+'</span>'; |
---|
[69] | 5294 | if (use_spam_filter) { |
---|
[790] | 5295 | if ( current_folder == 'INBOX'+cyrus_delimiter+'Spam' ) { |
---|
| 5296 | 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] | 5297 | } |
---|
| 5298 | else { |
---|
[790] | 5299 | 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] | 5300 | } |
---|
| 5301 | } |
---|
[3035] | 5302 | var span_D = Element("span_D"); |
---|
[58] | 5303 | if(!span_D){ |
---|
[3035] | 5304 | span_D = document.createElement("TD"); |
---|
[58] | 5305 | span_D.align = "right"; |
---|
| 5306 | span_D.style.fontSize = "12"; |
---|
| 5307 | span_D.id = "span_D"; |
---|
| 5308 | span_R.appendChild(span_D); |
---|
| 5309 | } |
---|
[3035] | 5310 | span_D.innerHTML = |
---|
[58] | 5311 | get_lang("List")+': '+ |
---|
[790] | 5312 | '<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>, '+ |
---|
| 5313 | '<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>, '+ |
---|
| 5314 | '<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>, '+ |
---|
[3819] | 5315 | '<span ' + change_font_color + ' id="span_flag_ANSWERED" class="'+(search_box_type == 'ANSWERED' ? 'message_options_over' : 'message_options')+'" title="'+get_lang("title_answered")+'" onclick="if(\'ANSWERED\' == \''+search_box_type+'\') return false;sort_box(\'ANSWERED\',\''+sort_box_type+'\')">'+get_lang("l_answered")+'</span>, '+ |
---|
[790] | 5316 | '<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] | 5317 | draw_paging(num_msgs); |
---|
[3035] | 5318 | Element("tot_m").innerHTML = num_msgs; |
---|
[1247] | 5319 | } |
---|