[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 | /*Cria a div que permite a seleção de todas as mensagens*/ |
---|
| 1040 | function drawSelectMsgsTable(){ |
---|
| 1041 | var div = $('<div>'); |
---|
| 1042 | div.attr('class','select-all-messages'); |
---|
| 1043 | $('#content_id_'+currentTab).first().prepend(div); |
---|
[6769] | 1044 | div.css('display','none'); |
---|
[6762] | 1045 | } |
---|
| 1046 | |
---|
| 1047 | /*Atualiza o array de mensagens selecionadas*/ |
---|
| 1048 | function updateSelectedMsgs(selected,msg_number){ |
---|
| 1049 | var folder = get_current_folder().split(cyrus_delimiter); |
---|
| 1050 | folder = folder.indexOf('INBOX') != -1 ? get_lang(folder[folder.length - 1]) : folder ; |
---|
| 1051 | var div = $('.select-all-messages'); |
---|
| 1052 | var totalSelected = function(){ |
---|
| 1053 | var total = 0; |
---|
| 1054 | for(var obj in selectedMessages) |
---|
| 1055 | if (selectedMessages[obj] == true) |
---|
| 1056 | total++; |
---|
| 1057 | return total; |
---|
| 1058 | }; |
---|
| 1059 | /*Seleciona as mensagens ao navegar pelas páginas*/ |
---|
| 1060 | if (allMsgsSelected && msg_number == undefined){ |
---|
| 1061 | $('.checkbox').each(function(){ |
---|
| 1062 | $(this).attr('checked', true); |
---|
| 1063 | $(this).parent().parent().addClass('selected_msg'); |
---|
| 1064 | }); |
---|
| 1065 | } |
---|
| 1066 | else if (msg_number == undefined){ |
---|
| 1067 | for(var obj in selectedMessages){ |
---|
| 1068 | if (selectedMessages[obj] == true){ |
---|
| 1069 | $('#check_box_message_'+obj).attr('checked', true); |
---|
| 1070 | $('#check_box_message_'+obj).parent().parent().addClass('selected_msg'); |
---|
| 1071 | } |
---|
| 1072 | } |
---|
| 1073 | } |
---|
| 1074 | if (selected && msg_number != undefined){ |
---|
| 1075 | selectedMessages[msg_number] = true; |
---|
| 1076 | $(this).parent().parent().addClass('selected_msg'); |
---|
| 1077 | } |
---|
| 1078 | else if(!selected && msg_number != undefined){ |
---|
| 1079 | selectedMessages[msg_number] = false; |
---|
| 1080 | $(this).parent().parent().removeClass('selected_msg'); |
---|
| 1081 | allMsgsSelected = false; |
---|
| 1082 | } |
---|
[6772] | 1083 | /*Todas as mensagens selecionadas uma a uma*/ |
---|
| 1084 | if (totalSelected() == parseInt($('#tot_m').text())){ |
---|
| 1085 | allMsgsSelected = true; |
---|
| 1086 | div.html(""); |
---|
| 1087 | var link = "<a class='select-link'>Limpar seleção?</a>"; |
---|
| 1088 | var info = "Todas as "+$('#tot_m').text()+" mensagens em "+folder+" foram selecionadas. "+link; |
---|
| 1089 | div.html("<span>"+info+"<span>"); |
---|
| 1090 | div.show(); |
---|
| 1091 | $('.select-link').bind('click',function(){selectAllFolderMsgs();$('.select-link').unbind('click');}); |
---|
| 1092 | } |
---|
[6762] | 1093 | /*Se foram selecionadas algumas mensagens*/ |
---|
[6772] | 1094 | else if (totalSelected() > 0 && !allMsgsSelected){ |
---|
[6762] | 1095 | var link = "<a class='select-link'>Limpar seleção?</a>"; |
---|
| 1096 | var info = "Foram selecionadas "+totalSelected()+" mensagens em "+folder+". "+link; |
---|
| 1097 | div.html("<span>"+info+"<span>"); |
---|
| 1098 | div.show(); |
---|
[6769] | 1099 | $('.select-link').bind('click',function(){ |
---|
| 1100 | selectAllFolderMsgs(); |
---|
| 1101 | $('.select-link').unbind('click'); |
---|
| 1102 | }); |
---|
[6762] | 1103 | } |
---|
| 1104 | else if (allMsgsSelected){ |
---|
| 1105 | var link = "<a class='select-link'>Limpar seleção?</a>"; |
---|
| 1106 | var info = "Todas as "+$('#tot_m').text()+" mensagens em "+folder+" foram selecionadas. "+link; |
---|
| 1107 | div.html("<span>"+info+"<span>"); |
---|
| 1108 | div.show(); |
---|
[6769] | 1109 | $('.select-link').bind('click',function(){ |
---|
| 1110 | selectAllFolderMsgs(); |
---|
| 1111 | $('.select-link').unbind('click'); |
---|
| 1112 | }); |
---|
[6762] | 1113 | } |
---|
[6769] | 1114 | resizeWindow(); |
---|
[6762] | 1115 | } |
---|
| 1116 | |
---|
| 1117 | /*Seleciona ou desseleciona todas as mensagens da pasta*/ |
---|
| 1118 | function selectAllFolderMsgs(select){ |
---|
| 1119 | var folder = get_current_folder().split(cyrus_delimiter); |
---|
| 1120 | folder = folder.indexOf('INBOX') != -1 ? get_lang(folder[folder.length - 1]) : folder ; |
---|
| 1121 | var div = $('.select-all-messages'); |
---|
| 1122 | if (select){ |
---|
| 1123 | allMsgsSelected = true; |
---|
| 1124 | var link = "<a class='select-link'>Limpar seleção?</a>"; |
---|
| 1125 | var info = "Todas as "+$('#tot_m').text()+" mensagens em "+folder+" foram selecionadas. "+link; |
---|
| 1126 | div.html("<span>"+info+"<span>"); |
---|
| 1127 | div.show(); |
---|
[6769] | 1128 | $('.select-link').bind('click',function(){ |
---|
| 1129 | selectAllFolderMsgs(); |
---|
| 1130 | $('.select-link').unbind('click'); |
---|
| 1131 | }); |
---|
[6762] | 1132 | for(var obj in selectedMessages){ |
---|
| 1133 | selectedMessages[obj] = true; |
---|
| 1134 | } |
---|
| 1135 | |
---|
| 1136 | }else{ |
---|
| 1137 | allMsgsSelected = false; |
---|
| 1138 | for(var obj in selectedMessages){ |
---|
[6769] | 1139 | $("#content_id_0").find('input[type="checkbox"]').removeAttr("checked"); |
---|
[6762] | 1140 | selectedMessages[obj] = false; |
---|
[6772] | 1141 | $('#check_box_message_'+obj).parent().parent().removeClass('selected_msg selected_shortcut_msg'); |
---|
[6762] | 1142 | } |
---|
| 1143 | div.hide(); |
---|
| 1144 | } |
---|
[6769] | 1145 | resizeWindow(); |
---|
[6762] | 1146 | } |
---|
| 1147 | /*Carrega o array de mensagens da pasta*/ |
---|
| 1148 | function populateSelectedMsgs(data){ |
---|
| 1149 | for(obj in selectedMessages){ |
---|
| 1150 | delete selectedMessages[obj]; |
---|
| 1151 | } |
---|
| 1152 | $.each(data, function(index, value){ |
---|
| 1153 | if(value != undefined){ |
---|
| 1154 | selectedMessages[value] = false; |
---|
| 1155 | } |
---|
| 1156 | }); |
---|
| 1157 | delete selectedMessages[undefined]; |
---|
| 1158 | } |
---|
| 1159 | |
---|
| 1160 | |
---|
[2] | 1161 | // Draw the inbox and another folders |
---|
[320] | 1162 | function draw_box(headers_msgs, msg_folder, alternate){ |
---|
[5533] | 1163 | /* |
---|
[4087] | 1164 | * When the paging response is not in the correct folder you need to change folder |
---|
| 1165 | * This occurs when the Ajax response is not fast enough and the user click in outher |
---|
| 1166 | * folder before finishing the Ajax request |
---|
| 1167 | */ |
---|
| 1168 | if (msg_folder != headers_msgs['folder']) { |
---|
| 1169 | |
---|
| 1170 | if (headers_msgs['folder']) { |
---|
| 1171 | array_folder = headers_msgs['folder'].split('/'); |
---|
| 1172 | |
---|
| 1173 | if (array_folder.length > 1) { |
---|
| 1174 | name_folder = array_folder[1]; |
---|
| 1175 | } |
---|
| 1176 | else { |
---|
| 1177 | name_folder = headers_msgs['folder']; |
---|
| 1178 | } |
---|
| 1179 | current_folder = headers_msgs['folder']; |
---|
| 1180 | 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>'; |
---|
| 1181 | |
---|
| 1182 | Element('new_m').innerHTML = headers_msgs['tot_unseen'] ? '<font color="RED">'+headers_msgs['tot_unseen']+'</font>' : 0; |
---|
| 1183 | Element("tot_m").innerHTML = headers_msgs['num_msgs']; |
---|
| 1184 | |
---|
| 1185 | tree_folders.getNodeById(headers_msgs['folder'])._select(); |
---|
| 1186 | } |
---|
| 1187 | } |
---|
[5533] | 1188 | /** |
---|
| 1189 | * Preenche a estrutura de cache de mensagens para posterior consulta de |
---|
| 1190 | * informações sobre as mensagens no escopo global. |
---|
| 1191 | */ |
---|
| 1192 | for (var i=0; i<headers_msgs.length; i++) { |
---|
| 1193 | if (!onceOpenedHeadersMessages[current_folder]) |
---|
| 1194 | onceOpenedHeadersMessages[current_folder] = {}; |
---|
| 1195 | onceOpenedHeadersMessages[current_folder][headers_msgs[i].msg_number] = headers_msgs[i]; |
---|
| 1196 | } |
---|
| 1197 | |
---|
[320] | 1198 | if (alternate) |
---|
| 1199 | kill_current_box(); |
---|
[3035] | 1200 | |
---|
[2] | 1201 | if(is_ie) |
---|
| 1202 | document.getElementById("border_table").width = "99.5%"; |
---|
| 1203 | |
---|
[5134] | 1204 | numBox = 0; //As pastas sempre estarão na aba 0 |
---|
| 1205 | |
---|
[3035] | 1206 | openTab.content_id[numBox] = document.getElementById("content_id_"+numBox); |
---|
[3178] | 1207 | openTab.content_id[numBox].innerHTML = ""; |
---|
[607] | 1208 | openTab.imapBox[numBox] = msg_folder; |
---|
[790] | 1209 | openTab.type[numBox] = 0; |
---|
[3035] | 1210 | |
---|
[320] | 1211 | table_message_header_box = document.getElementById("table_message_header_box_"+numBox); |
---|
[4072] | 1212 | if (table_message_header_box == null) { |
---|
[2] | 1213 | var table_element = document.createElement("TABLE"); |
---|
[4062] | 1214 | var colgr_element = buildColGroup(); |
---|
| 1215 | colgr_element.setAttribute("id","colgroup_head_"+numBox); |
---|
[2] | 1216 | var tbody_element = document.createElement("TBODY"); |
---|
[4062] | 1217 | //add events for column resizing |
---|
| 1218 | if (is_ie) { |
---|
| 1219 | table_element.attachEvent("onmousemove",changeCursorState); |
---|
| 1220 | table_element.attachEvent("onmousedown",startColResize); |
---|
| 1221 | } |
---|
| 1222 | else { |
---|
| 1223 | table_element.addEventListener("mousemove",changeCursorState,false); |
---|
| 1224 | table_element.addEventListener("mousedown",startColResize,false); |
---|
| 1225 | } |
---|
[320] | 1226 | table_element.setAttribute("id", "table_message_header_box_"+numBox); |
---|
[2] | 1227 | table_element.className = "table_message_header_box"; |
---|
[4062] | 1228 | if (!is_ie) |
---|
| 1229 | table_element.style.width = "98.8%"; |
---|
| 1230 | //if table is empty |
---|
| 1231 | table_element.emptyBody = false; |
---|
[3035] | 1232 | |
---|
[2] | 1233 | tr_element = document.createElement("TR"); |
---|
| 1234 | tr_element.className = "message_header"; |
---|
[4062] | 1235 | |
---|
| 1236 | td_element1 = createTDElement(0,0); |
---|
[2] | 1237 | chk_box_element = document.createElement("INPUT"); |
---|
| 1238 | chk_box_element.id = "chk_box_select_all_messages"; |
---|
| 1239 | chk_box_element.setAttribute("type", "checkbox"); |
---|
| 1240 | chk_box_element.className = "checkbox"; |
---|
| 1241 | chk_box_element.onclick = function(){select_all_messages(this.checked);}; |
---|
[6762] | 1242 | chk_box_element.onmouseover = function () {this.title=get_lang('Select all messages from this page.'); }; |
---|
[2] | 1243 | chk_box_element.onkeydown = function (e){ |
---|
| 1244 | if (is_ie) |
---|
| 1245 | { |
---|
| 1246 | if ((window.event.keyCode) == 46) |
---|
[689] | 1247 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1248 | } |
---|
| 1249 | else |
---|
| 1250 | { |
---|
| 1251 | if ((e.keyCode) == 46) |
---|
[689] | 1252 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1253 | } |
---|
| 1254 | }; |
---|
[3035] | 1255 | |
---|
[2] | 1256 | td_element1.appendChild(chk_box_element); |
---|
[3035] | 1257 | |
---|
[4062] | 1258 | td_element2 = createTDElement(0,1); |
---|
[5533] | 1259 | td_element3 = createTDElement(0,8,"th_resizable","left","message_header_SORTFROM_"+numBox); |
---|
[51] | 1260 | td_element3.onclick = function () {sort_box(search_box_type,'SORTFROM');}; |
---|
[4771] | 1261 | td_element3.innerHTML = get_lang("From"); |
---|
[3035] | 1262 | |
---|
[5533] | 1263 | td_element4 = createTDElement(0,9,"th_resizable","left","message_header_SORTSUBJECT_"+numBox); |
---|
[51] | 1264 | td_element4.onclick = function () {sort_box(search_box_type,'SORTSUBJECT');}; |
---|
[2] | 1265 | td_element4.innerHTML = get_lang("Subject"); |
---|
[3035] | 1266 | |
---|
[5533] | 1267 | td_element5 = createTDElement(0,10,"th_resizable","center","message_header_SORTARRIVAL_"+numBox); |
---|
[51] | 1268 | td_element5.onclick = function () {sort_box(search_box_type,'SORTARRIVAL');}; |
---|
[2] | 1269 | td_element5.innerHTML = get_lang("Date"); |
---|
[4062] | 1270 | |
---|
[6542] | 1271 | td_element6 = createTDElement(0,11,"th_resizable","center","message_header_SORTSIZE_"+numBox); |
---|
[51] | 1272 | td_element6.onclick = function () {sort_box(search_box_type,'SORTSIZE');} |
---|
[2] | 1273 | td_element6.innerHTML = get_lang("Size"); |
---|
[3035] | 1274 | |
---|
[2] | 1275 | tr_element.appendChild(td_element1); |
---|
[3035] | 1276 | tr_element.appendChild(td_element2); |
---|
[4062] | 1277 | |
---|
| 1278 | var td_element21 = createTDElement(0,2); |
---|
| 1279 | td_element21.innerHTML = " "; |
---|
| 1280 | |
---|
| 1281 | var td_element22 = createTDElement(0,3); |
---|
| 1282 | td_element22.innerHTML = " "; |
---|
| 1283 | |
---|
| 1284 | var td_element23 = createTDElement(0,4); |
---|
| 1285 | td_element23.innerHTML = " "; |
---|
| 1286 | |
---|
| 1287 | var td_element24 = createTDElement(0,5); |
---|
| 1288 | td_element24.innerHTML = " "; |
---|
[5533] | 1289 | |
---|
| 1290 | |
---|
| 1291 | var td_element25 = createTDElement(0,7); |
---|
[4062] | 1292 | td_element25.innerHTML = " "; |
---|
[5533] | 1293 | |
---|
| 1294 | var td_element27 = createTDElement(0,8); |
---|
| 1295 | td_element25.innerHTML = " "; |
---|
| 1296 | |
---|
| 1297 | var td_element26 = createTDElement(0,6); |
---|
| 1298 | td_element26.innerHTML = " "; |
---|
| 1299 | |
---|
[4062] | 1300 | |
---|
[998] | 1301 | tr_element.appendChild(td_element21); |
---|
| 1302 | tr_element.appendChild(td_element22); |
---|
| 1303 | tr_element.appendChild(td_element23); |
---|
[4062] | 1304 | tr_element.appendChild(td_element24); |
---|
[5533] | 1305 | tr_element.appendChild(td_element26); |
---|
| 1306 | tr_element.appendChild(td_element27); |
---|
[4062] | 1307 | tr_element.appendChild(td_element25); |
---|
[5533] | 1308 | |
---|
[2] | 1309 | tr_element.appendChild(td_element3); |
---|
| 1310 | tr_element.appendChild(td_element4); |
---|
| 1311 | tr_element.appendChild(td_element5); |
---|
| 1312 | tr_element.appendChild(td_element6); |
---|
[4062] | 1313 | |
---|
[2] | 1314 | tbody_element.appendChild(tr_element); |
---|
| 1315 | table_element.appendChild(tbody_element); |
---|
[4062] | 1316 | table_element.appendChild(colgr_element); |
---|
| 1317 | |
---|
| 1318 | var _divScroll = document.getElementById("divScrollHead_"+numBox); |
---|
| 1319 | |
---|
| 1320 | if(!_divScroll){ |
---|
| 1321 | _divScroll = document.createElement("DIV"); |
---|
| 1322 | _divScroll.id = "divScrollHead_"+numBox; |
---|
[4072] | 1323 | } |
---|
[4062] | 1324 | |
---|
| 1325 | _divScroll.style.overflowY = "hidden"; |
---|
| 1326 | _divScroll.style.overflowX = "hidden"; |
---|
| 1327 | _divScroll.style.width ="100%"; |
---|
| 1328 | |
---|
| 1329 | if (is_mozilla){ |
---|
| 1330 | _divScroll.style.width ="99.3%"; |
---|
| 1331 | } |
---|
| 1332 | |
---|
| 1333 | _divScroll.appendChild(table_element); |
---|
| 1334 | openTab.content_id[numBox].appendChild(_divScroll); |
---|
| 1335 | |
---|
[4109] | 1336 | var table_layout = (getStyle("table_message_header_box_"+numBox,"table-layout") || getStyle("table_message_header_box_"+numBox,"tableLayout")); |
---|
[4072] | 1337 | cssForResizing = (table_layout=="fixed"); |
---|
| 1338 | if (cssForResizing) |
---|
| 1339 | prepareColSizesArray(); |
---|
[4062] | 1340 | } |
---|
[2] | 1341 | draw_header_box(); |
---|
| 1342 | var table_element = document.createElement("TABLE"); |
---|
[4062] | 1343 | var colgr_element = buildColGroup(); |
---|
| 1344 | colgr_element.setAttribute("id","colgroup_main_"+numBox); |
---|
| 1345 | |
---|
[3035] | 1346 | var tbody_element = document.createElement("TBODY"); |
---|
[2] | 1347 | table_element.id = "table_box"; |
---|
| 1348 | table_element.className = "table_box"; |
---|
| 1349 | table_element.borderColorDark = "#bbbbbb"; |
---|
| 1350 | table_element.frame = "void"; |
---|
| 1351 | table_element.rules = "rows"; |
---|
| 1352 | table_element.cellPadding = "0"; |
---|
| 1353 | table_element.cellSpacing = "0"; |
---|
[3035] | 1354 | |
---|
[2] | 1355 | table_element.onkeydown = function (e){ |
---|
| 1356 | if (is_ie) |
---|
| 1357 | { |
---|
| 1358 | if ((window.event.keyCode) == 46) |
---|
| 1359 | { |
---|
| 1360 | //delete_all_selected_msgs_imap(); |
---|
[689] | 1361 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1362 | } |
---|
| 1363 | } |
---|
| 1364 | else |
---|
| 1365 | { |
---|
| 1366 | if ((e.keyCode) == 46) |
---|
| 1367 | { |
---|
| 1368 | //delete_all_selected_msgs_imap(); |
---|
[689] | 1369 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1370 | } |
---|
| 1371 | } |
---|
| 1372 | }; |
---|
| 1373 | if (is_ie) |
---|
| 1374 | table_element.style.cursor = "hand"; |
---|
[3035] | 1375 | |
---|
[2] | 1376 | tbody_element.setAttribute("id", "tbody_box"); |
---|
| 1377 | table_element.appendChild(tbody_element); |
---|
[4062] | 1378 | table_element.appendChild(colgr_element); |
---|
[3035] | 1379 | |
---|
[320] | 1380 | var _divScroll = document.getElementById("divScrollMain_"+numBox); |
---|
| 1381 | |
---|
[3035] | 1382 | if(!_divScroll){ |
---|
[2] | 1383 | _divScroll = document.createElement("DIV"); |
---|
[320] | 1384 | _divScroll.id = "divScrollMain_"+numBox; |
---|
[2] | 1385 | } |
---|
[3035] | 1386 | |
---|
[4062] | 1387 | _divScroll.style.overflowY = "scroll"; |
---|
[790] | 1388 | _divScroll.style.overflowX = "hidden"; |
---|
| 1389 | _divScroll.style.width ="100%"; |
---|
[3035] | 1390 | |
---|
[790] | 1391 | if (is_mozilla){ |
---|
[2] | 1392 | _divScroll.style.overflow = "-moz-scrollbars-vertical"; |
---|
[4062] | 1393 | _divScroll.style.width ="100%"; |
---|
[2] | 1394 | } |
---|
| 1395 | _divScroll.appendChild(table_element); |
---|
[607] | 1396 | openTab.content_id[numBox].appendChild(_divScroll); |
---|
[6762] | 1397 | |
---|
[2] | 1398 | var f_unseen = 0; |
---|
[139] | 1399 | |
---|
[4062] | 1400 | document.getElementById("table_message_header_box_"+numBox).emptyBody = false; |
---|
[6762] | 1401 | |
---|
[4189] | 1402 | if (headers_msgs.num_msgs == 0) |
---|
| 1403 | showEmptyBoxMsg(tbody_element); |
---|
| 1404 | |
---|
[2] | 1405 | for (var i=0; i < headers_msgs.length; i++){ |
---|
| 1406 | if ((headers_msgs[i].Unseen == 'U') || (headers_msgs[i].Recent == 'N')) |
---|
[3035] | 1407 | f_unseen++; |
---|
[3493] | 1408 | tr_element = make_tr_message(headers_msgs[i], msg_folder, headers_msgs.offsetToGMT); |
---|
[976] | 1409 | if (tr_element){ |
---|
[790] | 1410 | tbody_element.appendChild(tr_element); |
---|
[3035] | 1411 | add_className(tr_element, i%2 != 0 ? 'tr_msg_read2' : 'tr_msg_read'); |
---|
[976] | 1412 | } |
---|
[5486] | 1413 | //_dragArea.makeDragged(tr_element, headers_msgs[i].msg_number, headers_msgs[i].subject, true); |
---|
| 1414 | $(tr_element).draggable({ |
---|
[5499] | 1415 | start : function(){ |
---|
| 1416 | if($(".shared-folders").length){ |
---|
| 1417 | $(".shared-folders").parent().find('.folder:not(".shared-folders")').droppable({ |
---|
| 1418 | over : function(a, b){ |
---|
| 1419 | //SETA BORDA EM VOLTA DA PASTA |
---|
[5765] | 1420 | over = $(this); |
---|
| 1421 | $(this).addClass("folder-over"); |
---|
| 1422 | if(($(this)[0] != $(this).parent().find(".head_folder")[0])) |
---|
| 1423 | if($(this).prev()[0]) |
---|
| 1424 | if($(this).parent().find(".expandable-hitarea")[0] == $(this).prev()[0]){ |
---|
| 1425 | setTimeout(function(){ |
---|
| 1426 | if(over.hasClass("folder-over")) |
---|
| 1427 | over.prev().trigger("click"); |
---|
| 1428 | }, 500); |
---|
| 1429 | |
---|
| 1430 | } |
---|
[5499] | 1431 | }, |
---|
| 1432 | out : function(){ |
---|
| 1433 | //RETIRA BORDA EM VOLTA DA PASTA |
---|
[5765] | 1434 | $(this).removeClass("folder-over"); |
---|
[5499] | 1435 | }, |
---|
| 1436 | //accept: ".draggin_mail", |
---|
| 1437 | drop : function(event, ui){ |
---|
| 1438 | $(this).css("border", ""); |
---|
| 1439 | if($(this).parent().attr('id') == undefined){ |
---|
| 1440 | var folder_to = 'INBOX'; |
---|
| 1441 | var to_folder_title = get_lang("Inbox"); |
---|
| 1442 | }else{ |
---|
| 1443 | var folder_to = $(this).parent().attr('id'); |
---|
| 1444 | var to_folder_title = $(this).attr('title'); |
---|
| 1445 | } |
---|
| 1446 | var folder_to_move = ui.draggable.parent().attr('id'); |
---|
| 1447 | var border_id = ui.draggable.find("input[type=hidden]").attr("name"); |
---|
| 1448 | // Mensagens : SE O DROP VIER DA LISTA DE MENSAGENS : |
---|
| 1449 | if(folder_to_move == "tbody_box"){ |
---|
| 1450 | move_msgs2(get_current_folder(), 'selected', 0, folder_to, to_folder_title,true); |
---|
| 1451 | return refresh(); |
---|
| 1452 | } |
---|
| 1453 | } |
---|
| 1454 | }); |
---|
| 1455 | } |
---|
| 1456 | }, |
---|
| 1457 | stop :function(){ |
---|
| 1458 | $(".shared-folders").parent().find(".folder").droppable("destroy"); |
---|
| 1459 | }, |
---|
[5754] | 1460 | //helper: 'clone', |
---|
| 1461 | helper: function(event){ |
---|
[5533] | 1462 | $(this).find("input:checkbox").attr("checked", true); |
---|
[6223] | 1463 | if ( $("#tbody_box .selected_shortcut_msg").length > 1) { |
---|
| 1464 | $("#tbody_box .selected_shortcut_msg").find('.checkbox').attr('checked',true); |
---|
| 1465 | } |
---|
| 1466 | if($("#table_box").find("tr input:checked").length > 1 ) |
---|
| 1467 | 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] | 1468 | if( $(this).find(".td_msg_subject").text().length > 18 ) |
---|
[5754] | 1469 | 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] | 1470 | else |
---|
[5754] | 1471 | return $("<tr><td>"+DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : $(this).find(".td_msg_subject").text(), type: "messages"})+"</td></tr>"); |
---|
| 1472 | }, |
---|
| 1473 | iframeFix: true, |
---|
| 1474 | delay: 150, |
---|
[6265] | 1475 | cursorAt: {top: 5, left: 56}, |
---|
[5754] | 1476 | refreshPositions: true, |
---|
[5486] | 1477 | containment: "#divAppbox" |
---|
[5718] | 1478 | }).bind('contextmenu',function(event){ |
---|
[5841] | 1479 | if (!(($(event.target).find('img').length > 0) && ($(event.target).hasClass('td-label')))){ |
---|
| 1480 | if($(this).find("input:checkbox").attr("checked") != "checked"){ |
---|
| 1481 | $(this).find("input:checkbox").trigger('click'); |
---|
| 1482 | $(this).addClass("selected_msg"); |
---|
| 1483 | } |
---|
[5718] | 1484 | } |
---|
[5486] | 1485 | }); |
---|
[2] | 1486 | } |
---|
[3035] | 1487 | |
---|
[128] | 1488 | if ((preferences.use_shortcuts == '1') && (headers_msgs[0])) |
---|
[320] | 1489 | select_msg(headers_msgs[0].msg_number, 'null', true); |
---|
[5302] | 1490 | |
---|
[6762] | 1491 | |
---|
[2] | 1492 | var tdFolders = Element("folderscol"); |
---|
| 1493 | tdFolders.style.display = preferences.hide_folders == '1' ? "none" : ""; |
---|
[790] | 1494 | if ( !currentTab ) |
---|
| 1495 | alternate_border(numBox); |
---|
[3035] | 1496 | draw_footer_box(headers_msgs.num_msgs); |
---|
[2] | 1497 | Element('main_table').style.display = ''; |
---|
[3035] | 1498 | if(is_ie6) // Stupid Fixing on IE6. |
---|
| 1499 | setTimeout("resizeWindow()",1); |
---|
| 1500 | else |
---|
| 1501 | resizeWindow(); |
---|
[2] | 1502 | if(debug) { |
---|
| 1503 | var _eTime = new Date(); |
---|
| 1504 | _eTime = _eTime.getTime(); |
---|
| 1505 | alert("Carregou em "+(_eTime - _bTime)+" ms"); |
---|
| 1506 | } |
---|
[5533] | 1507 | |
---|
[2] | 1508 | var msg_folder = Element('msg_folder').value; |
---|
[3035] | 1509 | var msg_number = Element('msg_number').value; |
---|
[2] | 1510 | if(!msg_folder && msg_number) { |
---|
| 1511 | new_message('new','null'); |
---|
| 1512 | } |
---|
| 1513 | else if(msg_folder && msg_number){ |
---|
[6275] | 1514 | $.ajax({ |
---|
| 1515 | url: 'controller.php?' + $.param( {action: '$this.imap_functions.get_info_msg', |
---|
| 1516 | msg_number: msg_number, |
---|
| 1517 | msg_folder: msg_folder, |
---|
| 1518 | decoded: true } ), |
---|
| 1519 | success: function( data ){ |
---|
| 1520 | data = connector.unserialize( data ); |
---|
| 1521 | |
---|
| 1522 | if( data ) |
---|
| 1523 | show_msg( data ); |
---|
[6469] | 1524 | }, |
---|
| 1525 | beforeSend: function( jqXHR, settings ){ |
---|
| 1526 | connector.showProgressBar(); |
---|
| 1527 | }, |
---|
| 1528 | complete: function( jqXHR, settings ){ |
---|
| 1529 | connector.hideProgressBar(); |
---|
[6275] | 1530 | } |
---|
| 1531 | |
---|
| 1532 | }); |
---|
[2] | 1533 | Element('msg_folder').value = ''; |
---|
| 1534 | Element('msg_number').value = ''; |
---|
| 1535 | } |
---|
[3068] | 1536 | var scripts = new Array("InfoContact", |
---|
[3220] | 1537 | "TreeShow"); |
---|
[3068] | 1538 | connector.loadAllScripts(scripts); |
---|
[3369] | 1539 | // Loading Quota View Folder Component (if exists...) |
---|
[3157] | 1540 | if(Element("table_quota")) |
---|
[3158] | 1541 | connector.loadScript("InfoQuota"); |
---|
[5533] | 1542 | |
---|
[4062] | 1543 | // creates the dotted ruler which helps user to visualize resizing of columns |
---|
| 1544 | var ruler_element = document.getElementById("table_message_ruler"); |
---|
| 1545 | if (ruler_element == null) { |
---|
| 1546 | ruler_element = document.createElement("DIV"); |
---|
| 1547 | ruler_element.setAttribute("id", "table_message_ruler"); |
---|
| 1548 | ruler_element.className = "table_message_ruler"; |
---|
| 1549 | ruler_element.style.top = getColumnPosition(document.getElementById("content_id_0"),"BODY")[1]; |
---|
| 1550 | document.getElementById("exmail_main_body").appendChild(ruler_element); |
---|
| 1551 | } |
---|
[6762] | 1552 | drawSelectMsgsTable(); |
---|
| 1553 | updateSelectedMsgs(); |
---|
[6769] | 1554 | resizeWindow(); |
---|
[2] | 1555 | } |
---|
[790] | 1556 | |
---|
[4189] | 1557 | function showEmptyBoxMsg(tbody_element) { |
---|
| 1558 | document.getElementById("table_message_header_box_"+numBox).emptyBody = true; |
---|
[4752] | 1559 | var div_pasta = document.getElementById("div_msg_info"); |
---|
[4934] | 1560 | if (!div_pasta){ |
---|
[4752] | 1561 | div_info = document.createElement("div"); |
---|
| 1562 | div_info.setAttribute("id", "div_msg_info"); |
---|
| 1563 | div_info.setAttribute("background", "#FFF"); |
---|
| 1564 | h3_info = document.createElement("h3"); |
---|
| 1565 | h3_info.style.padding = "10px"; |
---|
| 1566 | h3_info.setAttribute("id", "msg_info"); |
---|
| 1567 | h3_info.align = "center"; |
---|
| 1568 | h3_info.innerHTML = get_lang("This mail box is empty"); |
---|
| 1569 | div_info.appendChild(h3_info); |
---|
| 1570 | tbody_element.parentNode.parentNode.appendChild(div_info); |
---|
| 1571 | } |
---|
[4189] | 1572 | } |
---|
| 1573 | |
---|
[6109] | 1574 | function html_entities(string) { |
---|
[6213] | 1575 | return String(string).replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); |
---|
[6109] | 1576 | } |
---|
| 1577 | |
---|
[3493] | 1578 | // Passar o parâmetro offset para esta função |
---|
| 1579 | function make_tr_message(headers_msgs, msg_folder, offsetToGMT){ |
---|
[6109] | 1580 | headers_msgs.subject = html_entities(headers_msgs.subject); |
---|
[5533] | 1581 | if (typeof offsetToGMT == 'undefined') |
---|
| 1582 | { |
---|
| 1583 | // In older local messages headers_msgs.offsetToGMT is undefined. |
---|
| 1584 | offsetToGMT = typeof headers_msgs.offsetToGMT != 'undefined'?headers_msgs.offsetToGMT:0; |
---|
| 1585 | } |
---|
[320] | 1586 | var tr_element = document.createElement('tr'); |
---|
[3069] | 1587 | if(typeof(preferences.line_height) != 'undefined') |
---|
| 1588 | tr_element.style.height = preferences.line_height; |
---|
[2] | 1589 | tr_element.id = headers_msgs.msg_number; |
---|
[163] | 1590 | |
---|
[1752] | 1591 | tr_element.msg_sample = ""; |
---|
| 1592 | //if(headers_msgs.msg_sample && headers_msgs.msg_sample.preview_msg_subject != "") |
---|
[5134] | 1593 | if(headers_msgs.msg_sample && preferences.preview_msg_subject == "1" && headers_msgs.msg_sample.body !== "") |
---|
[1752] | 1594 | { |
---|
[4820] | 1595 | if (cssForResizing) //Colunas redimensionaveis - nao trunca |
---|
[5134] | 1596 | tr_element.msg_sample = Base64.decode(headers_msgs.msg_sample.body).substr(0,180) + "..."; //trecho do body que sera exibido com o assunto; |
---|
[4820] | 1597 | else |
---|
[5134] | 1598 | tr_element.msg_sample = Base64.decode(headers_msgs.msg_sample.body).substr(0,120) + "..."; //trecho do body que sera exibido com o assunto; |
---|
[1752] | 1599 | } |
---|
| 1600 | |
---|
| 1601 | tr_element.tip = ""; |
---|
[5134] | 1602 | if(headers_msgs.msg_sample && preferences.preview_msg_tip == "1" && headers_msgs.msg_sample.body !== "") |
---|
[1752] | 1603 | { |
---|
[5134] | 1604 | tr_element.tip = Base64.decode(headers_msgs.msg_sample.body).substr(3,300) + "..."; //trecho do body que sera exibido no tool-tip; |
---|
[1752] | 1605 | } |
---|
| 1606 | |
---|
[614] | 1607 | if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')){ |
---|
[4839] | 1608 | if ((headers_msgs.Flagged == 'F') || headers_msgs.Importance.toLowerCase().indexOf("high")!=-1 ) |
---|
[614] | 1609 | add_className(tr_element, 'flagged_msg'); |
---|
[163] | 1610 | add_className(tr_element, 'tr_msg_unread'); |
---|
[614] | 1611 | } |
---|
| 1612 | else{ |
---|
[5134] | 1613 | if ((headers_msgs.Flagged == 'F') || ( headers_msgs.Importance !== undefined && headers_msgs.Importance.toLowerCase().indexOf("high")!=-1 ) ) |
---|
[614] | 1614 | add_className(tr_element,'flagged_msg'); |
---|
| 1615 | } |
---|
[2] | 1616 | |
---|
[790] | 1617 | if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')) |
---|
| 1618 | add_className(tr_element, 'tr_msg_unread'); |
---|
[3035] | 1619 | |
---|
[790] | 1620 | if (headers_msgs.Flagged == 'F') |
---|
| 1621 | add_className(tr_element,'flagged_msg'); |
---|
| 1622 | |
---|
[4062] | 1623 | td_element1 = createTDElement(0,0,"td_msg"); |
---|
[2] | 1624 | chk_box_element = document.createElement("INPUT"); |
---|
| 1625 | chk_box_element.setAttribute("type", "checkbox"); |
---|
| 1626 | chk_box_element.className = "checkbox"; |
---|
| 1627 | chk_box_element.setAttribute("id", "check_box_message_"+headers_msgs.msg_number); |
---|
[6153] | 1628 | |
---|
| 1629 | $(chk_box_element).click(function(e){ |
---|
[6762] | 1630 | updateSelectedMsgs($(this).is(':checked'),headers_msgs.msg_number); |
---|
[2] | 1631 | changeBgColor(e,headers_msgs.msg_number); |
---|
[6153] | 1632 | }); |
---|
| 1633 | |
---|
[2] | 1634 | td_element1.appendChild(chk_box_element); |
---|
[3035] | 1635 | |
---|
[4062] | 1636 | td_element2 = createTDElement(0,1,"td_msg"); |
---|
[5359] | 1637 | if (headers_msgs.attachment == 1) |
---|
| 1638 | td_element2.innerHTML = "<img src ='templates/"+template+"/images/clip.gif' >"; |
---|
[3035] | 1639 | |
---|
[4062] | 1640 | td_element21 = createTDElement(0,2,"td_msg",null,"td_message_answered_"+headers_msgs.msg_number); |
---|
[2] | 1641 | |
---|
| 1642 | if ((headers_msgs.Forwarded == 'F') || (headers_msgs.Draft == 'X' && headers_msgs.Answered == 'A')){ |
---|
[3993] | 1643 | td_element21.onclick=function(){search_emails(headers_msgs.subject.replace(/^(re: ?|fw: ?|enc: ?|res: ?|fwd: ?)*/gi,''),true);}; |
---|
[6528] | 1644 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/forwarded.png' title='"+get_lang('Forwarded')+"'>"; |
---|
[3035] | 1645 | headers_msgs.Draft = '' |
---|
[2] | 1646 | headers_msgs.Answered = ''; |
---|
[1035] | 1647 | headers_msgs.Forwarded = 'F'; |
---|
[2] | 1648 | } |
---|
| 1649 | else if (headers_msgs.Draft == 'X') |
---|
[6528] | 1650 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/draft.png' title='"+get_lang('Draft')+"'>"; |
---|
[3993] | 1651 | else if (headers_msgs.Answered == 'A'){ |
---|
| 1652 | td_element21.onclick=function(){search_emails(headers_msgs.subject.replace(/^(re: ?|fw: ?|enc: ?|res: ?|fwd: ?)*/gi,''),true);}; |
---|
[6528] | 1653 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/answered.png' title='"+get_lang('Answered')+"'>"; |
---|
[3993] | 1654 | }else |
---|
[998] | 1655 | td_element21.innerHTML = " "; |
---|
[2] | 1656 | |
---|
[4062] | 1657 | td_element22 = createTDElement(0,1,"td_msg",null,"td_message_signed_"+headers_msgs.msg_number); |
---|
[3035] | 1658 | switch(headers_msgs.ContentType) |
---|
[1035] | 1659 | { |
---|
[3035] | 1660 | case "signature": |
---|
[1035] | 1661 | { |
---|
| 1662 | td_element22.innerHTML = "<img src ='templates/"+template+"/images/signed_msg.gif' title='" + get_lang('Signed message') + "'>"; |
---|
| 1663 | break; |
---|
| 1664 | } |
---|
[3035] | 1665 | case "cipher": |
---|
[1035] | 1666 | { |
---|
| 1667 | td_element22.innerHTML = "<img src ='templates/"+template+"/images/lock.gif' title='" + get_lang('Crypted message') + "'>"; |
---|
| 1668 | break; |
---|
| 1669 | } |
---|
[3035] | 1670 | default: |
---|
[1035] | 1671 | { |
---|
| 1672 | break; |
---|
| 1673 | } |
---|
| 1674 | } |
---|
| 1675 | |
---|
[4062] | 1676 | td_element23 = createTDElement(0,4,"td_msg",null,"td_message_important_"+headers_msgs.msg_number); |
---|
[1035] | 1677 | |
---|
[5134] | 1678 | if ( (headers_msgs.Flagged == 'F') || ( headers_msgs.Importance !== undefined && headers_msgs.Importance.toLowerCase().indexOf("high") != -1 )) |
---|
[790] | 1679 | { |
---|
[5569] | 1680 | td_element23.innerHTML = "<img src ='templates/"+template+"/images/important.png' title='"+get_lang('Important')+"'>"; |
---|
[790] | 1681 | } |
---|
[2] | 1682 | else |
---|
[1035] | 1683 | td_element23.innerHTML = " "; |
---|
[790] | 1684 | |
---|
[4062] | 1685 | td_element24 = createTDElement(0,5,"td_msg",null,"td_message_sent_"+headers_msgs.msg_number); |
---|
[1035] | 1686 | td_element24.innerHTML = " "; |
---|
[2] | 1687 | // preload image |
---|
| 1688 | var _img_sent = new Image(); |
---|
[790] | 1689 | _img_sent.src = "templates/"+template+"/images/sent.gif"; |
---|
[2] | 1690 | |
---|
[3018] | 1691 | |
---|
| 1692 | |
---|
[5533] | 1693 | td_element25 = createTDElement(0,7,"td_msg",null,"td_message_unseen_"+headers_msgs.msg_number); |
---|
[3035] | 1694 | if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')) |
---|
| 1695 | td_element25.innerHTML = "<img src ='templates/"+template+"/images/unseen.gif' title='"+get_lang('Unseen')+"'>"; |
---|
| 1696 | else |
---|
| 1697 | td_element25.innerHTML = "<img src ='templates/"+template+"/images/seen.gif' title='"+get_lang('Seen')+"'>"; |
---|
[3018] | 1698 | |
---|
| 1699 | |
---|
[5533] | 1700 | td_element3 = createTDElement(0,8,"td_msg td_resizable","left","td_from_"+ headers_msgs.msg_number); |
---|
[689] | 1701 | var _onclick = function(){InfoContact.hide();proxy_mensagens.get_msg(headers_msgs.msg_number, msg_folder,true, show_msg);}; |
---|
[2] | 1702 | td_element3.onclick = _onclick; |
---|
| 1703 | td_element3.innerHTML = ' '; |
---|
[3035] | 1704 | |
---|
[3245] | 1705 | test = true; |
---|
[5211] | 1706 | 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] | 1707 | test = false; |
---|
[5240] | 1708 | |
---|
| 1709 | 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] | 1710 | { |
---|
[6211] | 1711 | td_element3.onmouseover = function () { |
---|
| 1712 | var title_to = ''; |
---|
| 1713 | $.each(headers_msgs.to, function(index, value) { |
---|
| 1714 | if(index == (headers_msgs.to.length - 1)){ |
---|
| 1715 | title_to = title_to + value.email; |
---|
| 1716 | } |
---|
| 1717 | else { |
---|
| 1718 | title_to = title_to + value.email + ', '; |
---|
| 1719 | } |
---|
| 1720 | }); |
---|
| 1721 | this.title = title_to; |
---|
| 1722 | }; |
---|
[5790] | 1723 | |
---|
[2] | 1724 | if (headers_msgs.Draft == 'X') |
---|
| 1725 | td_element3.innerHTML += "<span style=\"color:red\">("+get_lang("Draft")+") </span>"; |
---|
[3035] | 1726 | else{ |
---|
[6211] | 1727 | if(headers_msgs.to[0].email != null && headers_msgs.to[0].email.toLowerCase() != Element("user_email").value) |
---|
[6123] | 1728 | td_element24.innerHTML = "<img align='center' src ='templates/"+template+"/images/sent.gif' title='"+get_lang('Sent')+"'>"; |
---|
[4072] | 1729 | |
---|
[3831] | 1730 | if (headers_msgs.to) { |
---|
[6211] | 1731 | if (headers_msgs.to[0].name != null) |
---|
| 1732 | td_element3.innerHTML += headers_msgs.to[0].name; |
---|
| 1733 | else if(headers_msgs.to[0].email != null) { |
---|
| 1734 | td_element3.innerHTML += headers_msgs.to[0].email; |
---|
[3831] | 1735 | } |
---|
| 1736 | else { |
---|
| 1737 | td_element3.innerHTML += get_lang("without destination"); |
---|
| 1738 | } |
---|
[2] | 1739 | } |
---|
| 1740 | } |
---|
| 1741 | } |
---|
| 1742 | else{ |
---|
| 1743 | if (headers_msgs.Draft == 'X'){ |
---|
| 1744 | td_element3.innerHTML = "<span style=\"color:red\">("+get_lang("Draft")+") </span>"; |
---|
| 1745 | } |
---|
[3035] | 1746 | else{ |
---|
[1247] | 1747 | var spanSender = document.createElement("SPAN"); |
---|
[6138] | 1748 | spanSender.setAttribute('class','span-sender'); |
---|
[6265] | 1749 | spanSender.onmouseover = function (event) {/*this.style.textDecoration = "underline";*/try {InfoContact.begin(this,headers_msgs.reply_toaddress)} catch(e){};}; |
---|
| 1750 | spanSender.onmouseout = function (){try {/*this.style.textDecoration = "none";*/clearTimeout(InfoContact.timeout);} catch(e){}}; |
---|
[5158] | 1751 | folder = special_folders['Sent']; |
---|
| 1752 | current = get_current_folder(); |
---|
| 1753 | if ((preferences.from_to_sent == "1") && (current.substr(current.length - folder.length, folder.length) == folder)){ |
---|
[6218] | 1754 | spanSender.onmouseover = function () { |
---|
| 1755 | var title_to = ''; |
---|
| 1756 | $.each(headers_msgs.to, function(index, value) { |
---|
| 1757 | if(index == (headers_msgs.to.length - 1)){ |
---|
| 1758 | title_to = title_to + value.email; |
---|
| 1759 | } |
---|
| 1760 | else { |
---|
| 1761 | title_to = title_to + value.email + ', '; |
---|
| 1762 | } |
---|
| 1763 | }); |
---|
| 1764 | this.title = title_to; |
---|
| 1765 | }; |
---|
[5158] | 1766 | if (headers_msgs.to) { |
---|
[6218] | 1767 | if (headers_msgs.to[0].name != null){ |
---|
| 1768 | spanSender.innerHTML += headers_msgs.to[0].name; |
---|
| 1769 | }else if(headers_msgs.to[0].email != null) { |
---|
| 1770 | spanSender.innerHTML += headers_msgs.to[0].email; |
---|
[5158] | 1771 | } |
---|
| 1772 | } |
---|
| 1773 | }else if(headers_msgs.from !== undefined){ |
---|
[1247] | 1774 | spanSender.innerHTML = headers_msgs.from.name != null ? headers_msgs.from.name : headers_msgs.from.email; |
---|
[5158] | 1775 | } |
---|
[1247] | 1776 | if (spanSender.innerHTML.indexOf(" ") == '-1' && spanSender.innerHTML.length > 25){ |
---|
| 1777 | spanSender.innerHTML = spanSender.innerHTML.substring(0,25) + "..."; |
---|
| 1778 | } |
---|
| 1779 | else if (spanSender.innerHTML.length > 40 ){ |
---|
| 1780 | spanSender.innerHTML = spanSender.innerHTML.substring(0,40) + "..."; |
---|
[3035] | 1781 | } |
---|
| 1782 | td_element3.appendChild(spanSender); |
---|
[2] | 1783 | } |
---|
[3035] | 1784 | } |
---|
[4062] | 1785 | |
---|
[5533] | 1786 | td_element4 = createTDElement(0,9,"td_msg td_resizable","left"); |
---|
[5486] | 1787 | td_element4.className += " td_msg_subject"; |
---|
[2] | 1788 | td_element4.onclick = _onclick; |
---|
[1752] | 1789 | td_element4.innerHTML = !is_ie ? "<a nowrap id='a_message_"+tr_element.id+"'> " : " "; |
---|
[3035] | 1790 | |
---|
[2] | 1791 | if ((headers_msgs.subject)&&(headers_msgs.subject.length > 50)) |
---|
[1752] | 1792 | { |
---|
[4820] | 1793 | if (cssForResizing) |
---|
| 1794 | //Colunas redimensionaveis - nao trunca |
---|
| 1795 | td_element4.innerHTML += headers_msgs.subject + "<span style=\"color:#b3b3b3;\"> " + tr_element.msg_sample +"</span>"; |
---|
| 1796 | else { |
---|
| 1797 | //Modificacao para evitar que o truncamento do assunto quebre uma NCR - #1189 |
---|
| 1798 | pos = headers_msgs.subject.indexOf("&",45); |
---|
| 1799 | if ((pos > 0) && (pos <= 50) && ((headers_msgs.subject.charAt(pos+5) == ";") || (headers_msgs.subject.charAt(pos+6) == ";"))) |
---|
| 1800 | td_element4.innerHTML += headers_msgs.subject.substring(0,pos+6) + "..." + "<span style=\"color:#b3b3b3;\"> " + tr_element.msg_sample +"</span>"; |
---|
| 1801 | else |
---|
| 1802 | 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; |
---|
| 1803 | } |
---|
[1752] | 1804 | } |
---|
[2] | 1805 | else |
---|
[1752] | 1806 | { |
---|
| 1807 | 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; |
---|
| 1808 | } |
---|
[3035] | 1809 | |
---|
[1752] | 1810 | td_element4.title=tr_element.tip; |
---|
[2] | 1811 | if(!is_ie){ |
---|
| 1812 | td_element4.innerHTML += "</a>"; |
---|
| 1813 | } |
---|
[5533] | 1814 | |
---|
| 1815 | td_element5 = createTDElement(0,10,"td_msg td_resizable","center"); |
---|
| 1816 | td_element5.onclick = _onclick; |
---|
| 1817 | |
---|
| 1818 | td_element27 = createTDElement(0,7,"td_msg",null,"td_message_labels_"+headers_msgs.msg_number); |
---|
| 1819 | $(td_element27).addClass("td-label"); |
---|
[2] | 1820 | |
---|
[5533] | 1821 | if (headers_msgs.labels) { |
---|
| 1822 | td_element27.innerHTML = '<img src="../prototype/modules/mail/img/tag.png">'; |
---|
[5586] | 1823 | updateLabelsColumn(headers_msgs); |
---|
[5533] | 1824 | } |
---|
| 1825 | |
---|
[6123] | 1826 | td_element26 = createTDElement(0,6,"td_msg","center","td_message_followup_"+headers_msgs.msg_number); |
---|
[5533] | 1827 | $(td_element26).addClass("td-followup-flag"); |
---|
[5717] | 1828 | td_element26.innerHTML = '<div class="flag-edited" style="width:8px;height:6px;"><img src="../prototype/modules/mail/img/flagEditor.png"></div>'; |
---|
[5533] | 1829 | |
---|
| 1830 | if (headers_msgs.followupflagged) { |
---|
[5738] | 1831 | if(headers_msgs.followupflagged.followupflag.id < 7){ |
---|
| 1832 | var nameFollowupflag = get_lang(headers_msgs.followupflagged.followupflag.name); |
---|
| 1833 | }else{ |
---|
| 1834 | var nameFollowupflag = headers_msgs.followupflagged.followupflag.name; |
---|
| 1835 | } |
---|
| 1836 | $(td_element26).attr('title', nameFollowupflag) |
---|
[5533] | 1837 | .find(".flag-edited").css("background",headers_msgs.followupflagged.backgroundColor); |
---|
| 1838 | if(headers_msgs.followupflagged.isDone == "1"){ |
---|
| 1839 | $(td_element26).find(".flag-edited").find("img") |
---|
| 1840 | .attr("src", "../prototype/modules/mail/img/flagChecked.png") |
---|
| 1841 | .css("margin-left","-3px"); |
---|
| 1842 | } |
---|
| 1843 | } else { |
---|
| 1844 | $(td_element26).find(".flag-edited").css("background","#cccccc"); |
---|
| 1845 | } |
---|
| 1846 | |
---|
| 1847 | /** |
---|
| 1848 | * Clique para aplicar sinalizador |
---|
| 1849 | */ |
---|
| 1850 | $(td_element26).click(function() { |
---|
| 1851 | var messageClickedId = $(this).attr('id').match(/td_message_followup_([\d]+)/)[1]; |
---|
[5861] | 1852 | |
---|
[5882] | 1853 | var followupColor = $('#td_message_followup_' + messageClickedId).find(".flag-edited").css('backgroundColor'); |
---|
| 1854 | |
---|
[5861] | 1855 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1856 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
[5867] | 1857 | .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" />'); |
---|
| 1858 | |
---|
| 1859 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1860 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "transparent"); |
---|
[5882] | 1861 | |
---|
| 1862 | |
---|
[5867] | 1863 | /** |
---|
[5533] | 1864 | * Hack: |
---|
| 1865 | * headers_msgs.followupflagged.id não vai funcionar porque já foi feito DataLayer.commit() |
---|
| 1866 | * por isso o id deve ser obtido do banco |
---|
| 1867 | * também para verificar se há ou não sinalizador nesta mensagem |
---|
| 1868 | */ |
---|
[5605] | 1869 | |
---|
| 1870 | DataLayer.remove('followupflagged', false); |
---|
[5533] | 1871 | var flagged = DataLayer.get('followupflagged', {filter: [ |
---|
| 1872 | 'AND', |
---|
| 1873 | ['=', 'messageNumber', messageClickedId], |
---|
| 1874 | ['=', 'folderName', msg_folder] |
---|
| 1875 | ]}); |
---|
[5540] | 1876 | |
---|
| 1877 | if (!flagged) { |
---|
[5533] | 1878 | /** |
---|
| 1879 | * Aplica followupflag de Acompanhamento |
---|
| 1880 | */ |
---|
| 1881 | headers_msgs.followupflagged = { |
---|
| 1882 | uid : User.me.id, |
---|
| 1883 | folderName : msg_folder, |
---|
| 1884 | messageNumber : messageClickedId, |
---|
| 1885 | alarmTime : false, |
---|
| 1886 | backgroundColor : '#FF2016', |
---|
[6152] | 1887 | followupflagId: '1' |
---|
[5533] | 1888 | }; |
---|
| 1889 | headers_msgs.followupflagged.id = DataLayer.put('followupflagged', headers_msgs.followupflagged); |
---|
[6047] | 1890 | DataLayer.commit(false, false, function(data){ |
---|
[6384] | 1891 | var fail = 'success'; |
---|
[6047] | 1892 | $.each(data, function(index, value) { |
---|
[6384] | 1893 | if(typeof value === 'string'){ |
---|
| 1894 | fail = value; |
---|
[6047] | 1895 | } |
---|
| 1896 | }); |
---|
| 1897 | |
---|
[5861] | 1898 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1899 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1900 | .html('<img src="../prototype/modules/mail/img/flagEditor.png">'); |
---|
[6384] | 1901 | |
---|
[6641] | 1902 | |
---|
| 1903 | if(fail != 'success'){ |
---|
| 1904 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1905 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "#CCCCCC"); |
---|
| 1906 | MsgsCallbackFollowupflag[fail](); |
---|
| 1907 | }else{ |
---|
| 1908 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1909 | '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); |
---|
| 1910 | updateCacheFollowupflag(messageClickedId, msg_folder, true); |
---|
| 1911 | } |
---|
[5625] | 1912 | }); |
---|
[5533] | 1913 | |
---|
[6463] | 1914 | |
---|
[5625] | 1915 | } else if (onceOpenedHeadersMessages[msg_folder][messageClickedId]['followupflagged'].followupflag.name == 'Follow up') { |
---|
[5533] | 1916 | /** |
---|
[5540] | 1917 | * Remove followupflag de Acompanhamento |
---|
[5533] | 1918 | */ |
---|
| 1919 | $(this).find(".flag-edited").css("background", "#cccccc"); |
---|
[5708] | 1920 | DataLayer.remove('followupflagged', flagged[0].id ); |
---|
[5649] | 1921 | DataLayer.commit(false, false, function(){ |
---|
| 1922 | updateCacheFollowupflag(messageClickedId, msg_folder, false); |
---|
| 1923 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
[5861] | 1924 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1925 | .html('<img src="../prototype/modules/mail/img/flagEditor.png">'); |
---|
| 1926 | |
---|
| 1927 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
[5929] | 1928 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).attr('title', '').find(".flag-edited").css("background", '#CCC'); |
---|
[5861] | 1929 | |
---|
[5649] | 1930 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1931 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1932 | .find("img").attr("src", "../prototype/modules/mail/img/flagEditor.png").css("margin-left","0"); |
---|
| 1933 | }); |
---|
| 1934 | |
---|
[5533] | 1935 | } else { |
---|
[5882] | 1936 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1937 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1938 | .html('<img src="../prototype/modules/mail/img/flagEditor.png">'); |
---|
| 1939 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1940 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", followupColor); |
---|
[5533] | 1941 | $(tr_element).addClass('selected_msg').find(':checkbox').trigger('click'); |
---|
| 1942 | configureFollowupflag(); |
---|
| 1943 | } |
---|
| 1944 | |
---|
[5540] | 1945 | |
---|
[5533] | 1946 | }); |
---|
| 1947 | |
---|
[3057] | 1948 | var norm = function (arg) {return (arg < 10 ? '0'+arg : arg);}; |
---|
| 1949 | var weekDays = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; |
---|
[3493] | 1950 | |
---|
| 1951 | var today = new Date(); |
---|
[3927] | 1952 | today.setHours(23); |
---|
| 1953 | today.setMinutes(59); |
---|
| 1954 | today.setSeconds(59); |
---|
| 1955 | today.setMilliseconds(999) |
---|
[3493] | 1956 | |
---|
[3512] | 1957 | var udate_local = null; |
---|
| 1958 | var date_msg = null; |
---|
[3493] | 1959 | |
---|
[3512] | 1960 | // old local messages can capture headers_msgs.udate as "hh:mm" or "dd/mm/yyyy" |
---|
[5134] | 1961 | 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] | 1962 | { |
---|
| 1963 | temp_msg_day = headers_msgs.msg_day.split('/'); |
---|
| 1964 | temp_msg_hour = headers_msgs.msg_hour.split(':'); |
---|
| 1965 | 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]); |
---|
| 1966 | } |
---|
| 1967 | else |
---|
| 1968 | { |
---|
| 1969 | // The new date implementation |
---|
| 1970 | // Using offset between user defined timezone and GMT |
---|
| 1971 | // Date object converts time to local timezone, so we have to adjust it |
---|
| 1972 | udate_local = headers_msgs.udate*1000 + offsetToGMT*1000 + today.getTimezoneOffset()*60*1000; |
---|
| 1973 | date_msg = new Date(udate_local); |
---|
| 1974 | } |
---|
| 1975 | |
---|
[5808] | 1976 | if (preferences.show_date_numerical == 0 || typeof(preferences.show_date_numerical) == 'undefined') { |
---|
| 1977 | if (today.getTime() - date_msg.getTime() < 86400000) |
---|
| 1978 | td_element5.innerHTML = norm(date_msg.getHours()) + ':' + norm(date_msg.getMinutes()); |
---|
[3057] | 1979 | else |
---|
[5808] | 1980 | if (today.getTime() - date_msg.getTime() < 172800000) |
---|
| 1981 | td_element5.innerHTML = get_lang('Yesterday'); |
---|
| 1982 | else if (today.getTime() - date_msg.getTime() < 259200000) |
---|
[3057] | 1983 | td_element5.innerHTML = get_lang(weekDays[date_msg.getDay()]); |
---|
[5808] | 1984 | else{ |
---|
| 1985 | td_element5.innerHTML = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 1986 | td_element5.title = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 1987 | td_element5.alt = td_element5.title; |
---|
| 1988 | } |
---|
| 1989 | }else{ |
---|
| 1990 | td_element5.innerHTML = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 1991 | td_element5.title = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 1992 | td_element5.alt = td_element5.title; |
---|
| 1993 | } |
---|
[5533] | 1994 | td_element6 = createTDElement(0,11,"td_msg td_resizable","center"); |
---|
[2] | 1995 | td_element6.onclick = _onclick; |
---|
| 1996 | td_element6.setAttribute("noWrap","true"); |
---|
[3028] | 1997 | td_element6.innerHTML = borkb(headers_msgs.Size); |
---|
| 1998 | |
---|
[2] | 1999 | tr_element.appendChild(td_element1); |
---|
| 2000 | tr_element.appendChild(td_element2); |
---|
| 2001 | tr_element.appendChild(td_element21); |
---|
| 2002 | tr_element.appendChild(td_element22); |
---|
| 2003 | tr_element.appendChild(td_element23); |
---|
[5533] | 2004 | tr_element.appendChild(td_element24); |
---|
| 2005 | tr_element.appendChild(td_element26); |
---|
| 2006 | tr_element.appendChild(td_element27); |
---|
[3035] | 2007 | tr_element.appendChild(td_element25); |
---|
[5533] | 2008 | |
---|
[2] | 2009 | tr_element.appendChild(td_element3); |
---|
| 2010 | tr_element.appendChild(td_element4); |
---|
| 2011 | tr_element.appendChild(td_element5); |
---|
| 2012 | tr_element.appendChild(td_element6); |
---|
| 2013 | return tr_element; |
---|
| 2014 | } |
---|
| 2015 | |
---|
[51] | 2016 | function sort_box(search, sort){ |
---|
[4062] | 2017 | if (cellResized) |
---|
| 2018 | return; |
---|
[51] | 2019 | var message_header = Element("message_header_"+search); |
---|
[2] | 2020 | var handler_draw_box = function(data){ |
---|
[790] | 2021 | draw_box(data, current_folder,true); |
---|
[406] | 2022 | //Mostrar as msgs nao lidas de acordo com o filtro de relevancia |
---|
[3392] | 2023 | var msgs_unseen = 0; |
---|
| 2024 | draw_paging(data.num_msgs); |
---|
| 2025 | Element("new_m").innerHTML = '<font style="color:'+(data.tot_unseen == 0 ? '': 'red')+'">' + data.tot_unseen + '</font>'; |
---|
| 2026 | Element("tot_m").innerHTML = data.num_msgs; |
---|
[427] | 2027 | } |
---|
[2] | 2028 | |
---|
[51] | 2029 | if(sort_box_type == sort && search_box_type == search){ |
---|
[46] | 2030 | sort_box_reverse = sort_box_reverse ? 0 : 1; |
---|
[51] | 2031 | } |
---|
| 2032 | else if(sort_box_type != sort){ |
---|
[163] | 2033 | if ( (sort == 'SORTFROM') || (sort == 'SORTSUBJECT') ) |
---|
| 2034 | sort_box_reverse = 0; |
---|
| 2035 | else |
---|
| 2036 | sort_box_reverse = 1; |
---|
[51] | 2037 | } |
---|
[3035] | 2038 | |
---|
[46] | 2039 | // Global variable. |
---|
[51] | 2040 | sort_box_type = sort; |
---|
| 2041 | search_box_type = search; |
---|
[46] | 2042 | |
---|
[1752] | 2043 | 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] | 2044 | current_page = 1; |
---|
[406] | 2045 | //Comentado para nao sobrepor o numero de msgs nao lidas ao utilizar os filtros |
---|
| 2046 | //update_menu(); |
---|
[2] | 2047 | } |
---|
[4493] | 2048 | |
---|
[2] | 2049 | function draw_header_box(){ |
---|
| 2050 | switch(sort_box_type){ |
---|
| 2051 | case 'SORTFROM': |
---|
[4771] | 2052 | type_name = get_lang("From"); |
---|
[2] | 2053 | break; |
---|
| 2054 | case 'SORTSUBJECT': |
---|
| 2055 | type_name = get_lang("Subject"); |
---|
| 2056 | break; |
---|
| 2057 | case 'SORTARRIVAL': |
---|
| 2058 | type_name = get_lang("Date"); |
---|
| 2059 | break; |
---|
| 2060 | case 'SORTSIZE': |
---|
| 2061 | type_name = get_lang("Size"); |
---|
[3035] | 2062 | break; |
---|
[2] | 2063 | default: |
---|
| 2064 | type_name = get_lang("Date"); |
---|
[72] | 2065 | break; |
---|
[2] | 2066 | } |
---|
[5158] | 2067 | folder = special_folders['Sent']; |
---|
| 2068 | current = get_current_folder(); |
---|
| 2069 | if ((preferences.from_to_sent == "1") && (current.substr(current.length - folder.length, folder.length) == folder)) { |
---|
| 2070 | document.getElementById("message_header_SORTFROM_"+numBox).innerHTML = get_lang("To"); |
---|
| 2071 | }else{ |
---|
[4771] | 2072 | document.getElementById("message_header_SORTFROM_"+numBox).innerHTML = get_lang("From"); |
---|
[5158] | 2073 | } |
---|
[320] | 2074 | document.getElementById("message_header_SORTSUBJECT_"+numBox).innerHTML = get_lang("Subject"); |
---|
| 2075 | document.getElementById("message_header_SORTARRIVAL_"+numBox).innerHTML = get_lang("Date"); |
---|
[3035] | 2076 | document.getElementById("message_header_SORTSIZE_"+numBox).innerHTML = get_lang("Size"); |
---|
[790] | 2077 | 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] | 2078 | } |
---|
[5134] | 2079 | function verifyOption(name, id){ |
---|
| 2080 | var str = name + '' + id; |
---|
| 2081 | if(!Element(str).style.display == ""){ |
---|
| 2082 | var option_reply_options = document.getElementById('msg_opt_reply_options_'+id); |
---|
| 2083 | option_reply_options.value = 'show'; |
---|
| 2084 | option_reply_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2085 | Element('tr_other_options_'+id).style.display = 'none'; |
---|
| 2086 | var option_more_options = document.getElementById('msg_opt_more_options_'+id); |
---|
| 2087 | option_more_options.value = 'show'; |
---|
| 2088 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2089 | Element('tr_other_more_options_'+id).style.display = 'none'; |
---|
| 2090 | var option_mark_as_options = document.getElementById('msg_opt_mark_options_'+id); |
---|
| 2091 | option_mark_as_options.value = 'show'; |
---|
| 2092 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2093 | Element('tr_other_mark_options_'+id).style.display = 'none'; |
---|
| 2094 | } |
---|
| 2095 | } |
---|
[5308] | 2096 | |
---|
| 2097 | /*Busca a primeira mensagem na pagina*/ |
---|
| 2098 | function firstRow(){ |
---|
| 2099 | var thisCell; |
---|
| 2100 | if (objCell) |
---|
| 2101 | thisCell = objCell; |
---|
| 2102 | else |
---|
| 2103 | thisCell = document.getElementById("table_message_header_box_0").rows[0].cells[0]; |
---|
| 2104 | var tbM = getMessagesTable(thisCell); |
---|
| 2105 | proxy_mensagens.get_msg(tbM.rows[0].getAttribute('id'),get_current_folder(),true,show_msg); |
---|
| 2106 | } |
---|
| 2107 | |
---|
| 2108 | /*Busca a ultima mensagem na pagina*/ |
---|
| 2109 | function lastRow(){ |
---|
| 2110 | var thisCell; |
---|
| 2111 | if (objCell) |
---|
| 2112 | thisCell = objCell; |
---|
| 2113 | else |
---|
| 2114 | thisCell = document.getElementById("table_message_header_box_0").rows[0].cells[0]; |
---|
| 2115 | var tbM = getMessagesTable(thisCell); |
---|
| 2116 | proxy_mensagens.get_msg(tbM.rows[tbM.rows.length - 1].getAttribute('id'),get_current_folder(),true,show_msg); |
---|
| 2117 | } |
---|
| 2118 | |
---|
[5367] | 2119 | var msg_selected; |
---|
[2] | 2120 | function draw_message(info_msg, ID){ |
---|
[6487] | 2121 | // remove a flag $FilteredMessage da mensagem ao ser lida |
---|
| 2122 | if(info_msg.Unseen == "U"){ |
---|
| 2123 | $.each(fromRules, function(index, value) { |
---|
| 2124 | if(value == info_msg.msg_folder){ |
---|
| 2125 | cExecute ("$this.imap_functions.removeFlagMessagesFilter&folder="+info_msg.msg_folder+"&msg_number="+info_msg.msg_number, function(){}); |
---|
| 2126 | return false; |
---|
| 2127 | } |
---|
| 2128 | }); |
---|
| 2129 | } |
---|
[2] | 2130 | var content = document.getElementById('content_id_' + ID); |
---|
[3035] | 2131 | |
---|
[2] | 2132 | var menuHidden = Element("folderscol").style.display == 'none' ? true : false; |
---|
| 2133 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2134 | //Make the next/previous buttom. |
---|
| 2135 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2136 | var next_previous_msg_td = document.createElement("TD"); |
---|
| 2137 | next_previous_msg_td.setAttribute("noWrap","true"); |
---|
| 2138 | next_previous_msg_td.align = "right"; |
---|
[5735] | 2139 | next_previous_msg_td.style.fontSize = "10px"; |
---|
[2] | 2140 | next_previous_msg_td.width = "40px"; |
---|
| 2141 | var img_next_msg = document.createElement("IMG"); |
---|
[128] | 2142 | img_next_msg.id = 'msg_opt_next_' + ID; |
---|
[790] | 2143 | img_next_msg.src = './templates/'+template+'/images/down.button.png'; |
---|
[5249] | 2144 | if(preferences.use_shortcuts == '1') |
---|
| 2145 | img_next_msg.title = get_lang('Next Shortcut:Control + Down'); |
---|
| 2146 | else |
---|
| 2147 | img_next_msg.title = get_lang('Next'); |
---|
[2] | 2148 | img_next_msg.style.cursor = 'pointer'; |
---|
[569] | 2149 | |
---|
[4820] | 2150 | var folder_id = ID.match(/\d+/)[0]; |
---|
| 2151 | var folder; |
---|
[3394] | 2152 | |
---|
[4820] | 2153 | //Correção para fazer funcionar e-mails assinados no formato encapsulado. |
---|
| 2154 | // folder_id = info_msg.original_ID ? info_msg.original_ID: info_msg.msg_number; |
---|
| 2155 | //if ((folder = document.getElementById(info_msg.msg_number)) == null) |
---|
[4493] | 2156 | if ((folder = Element(info_msg.original_ID)) == null) |
---|
| 2157 | folder = Element(info_msg.msg_number); |
---|
| 2158 | |
---|
[5134] | 2159 | |
---|
[3035] | 2160 | if (folder){ // mensagem local criptografada nao tem ID da pasta local |
---|
| 2161 | if (folder.nextSibling){ |
---|
| 2162 | var nextMsgBox = folder.nextSibling.name?folder.nextSibling.name:info_msg.msg_folder; |
---|
[1035] | 2163 | |
---|
[5134] | 2164 | if (nextMsgBox == "INBOX" + cyrus_delimiter + "decifradas")// teste para ver se a mensagem vem da pasta oculta decifradas |
---|
[3035] | 2165 | nextMsgBox = get_current_folder(); |
---|
[1035] | 2166 | |
---|
[3035] | 2167 | img_next_msg.onclick = function() |
---|
| 2168 | { |
---|
| 2169 | currentTab = ID; |
---|
| 2170 | openTab.type[ID] = 2; |
---|
| 2171 | proxy_mensagens.get_msg(folder.nextSibling.id,nextMsgBox,true,show_msg); |
---|
[5308] | 2172 | //select_msg('null', 'down', true); |
---|
[5367] | 2173 | if (!msg_selected){ |
---|
| 2174 | select_msg('null', 'down', true); |
---|
| 2175 | msg_selected = true; |
---|
| 2176 | } |
---|
[3035] | 2177 | }; |
---|
| 2178 | } |
---|
[5308] | 2179 | /*Ultima mensagem de cada página, exceto a ultima*/ |
---|
| 2180 | else if( (current_page < total_pages) ){ |
---|
| 2181 | |
---|
| 2182 | img_next_msg.onclick = function() |
---|
| 2183 | { |
---|
| 2184 | |
---|
| 2185 | current_page++; |
---|
| 2186 | var tot_msgs = parseInt(Element("tot_m").innerHTML); |
---|
| 2187 | var range_begin = preferences.max_email_per_page*( current_page - 1 ) + 1; |
---|
| 2188 | var range_end; |
---|
| 2189 | if ( range_begin + parseInt(preferences.max_email_per_page - 1) > tot_msgs ) |
---|
| 2190 | range_end = tot_msgs; |
---|
| 2191 | else |
---|
| 2192 | range_end = range_begin + parseInt(preferences.max_email_per_page - 1); |
---|
| 2193 | var creatBoxProximo = function (data){ |
---|
| 2194 | draw_box(data, get_current_folder()); |
---|
| 2195 | firstRow(); |
---|
| 2196 | }; |
---|
[5321] | 2197 | proxy_mensagens.messages_list(get_current_folder(),range_begin,range_end,sort_box_type,search_box_type,sort_box_reverse,'','', creatBoxProximo); |
---|
[5308] | 2198 | |
---|
| 2199 | }; |
---|
| 2200 | } |
---|
[3035] | 2201 | else |
---|
| 2202 | { |
---|
| 2203 | img_next_msg.src = "./templates/"+template+"/images/down.gray.button.png"; |
---|
| 2204 | img_next_msg.style.cursor = 'default'; |
---|
[1035] | 2205 | |
---|
[3035] | 2206 | } |
---|
| 2207 | } |
---|
| 2208 | else |
---|
| 2209 | { |
---|
| 2210 | img_next_msg.src = "./templates/"+template+"/images/down.gray.button.png"; |
---|
[1035] | 2211 | img_next_msg.style.cursor = 'default'; |
---|
[4726] | 2212 | // testa se a mensagem e local |
---|
| 2213 | if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(info_msg.msg_folder == "INBOX" + cyrus_delimiter + "decifradas")) // testa se a mensagem e local |
---|
[569] | 2214 | { |
---|
[3035] | 2215 | img_next_msg.onclick = function() |
---|
| 2216 | { |
---|
| 2217 | delete_border(ID); |
---|
| 2218 | }; |
---|
| 2219 | } |
---|
| 2220 | } |
---|
[2] | 2221 | var img_space = document.createElement("SPAN"); |
---|
| 2222 | img_space.innerHTML = " "; |
---|
| 2223 | var img_previous_msg = document.createElement("IMG"); |
---|
[128] | 2224 | img_previous_msg.id = 'msg_opt_previous_' + ID; |
---|
[790] | 2225 | img_previous_msg.src = './templates/'+template+'/images/up.button.png'; |
---|
[5249] | 2226 | if(preferences.use_shortcuts == '1') |
---|
| 2227 | img_previous_msg.title = get_lang('Previous Shortcut:Control + Up'); |
---|
| 2228 | else |
---|
| 2229 | img_previous_msg.title = get_lang('Previous'); |
---|
[2] | 2230 | img_previous_msg.style.cursor = 'pointer'; |
---|
[569] | 2231 | |
---|
[5134] | 2232 | |
---|
[3035] | 2233 | if (folder){ // mensagem local criptografada nao tem ID da pasta local |
---|
| 2234 | if (folder.previousSibling) |
---|
| 2235 | { |
---|
| 2236 | var previousMsgBox = folder.previousSibling.name?folder.previousSibling.name:info_msg.msg_folder; |
---|
[1035] | 2237 | |
---|
[4726] | 2238 | if (previousMsgBox == "INBOX" + cyrus_delimiter + "decifradas") // teste para ver se a mensagem vem da pasta oculta decifradas |
---|
[3035] | 2239 | previousMsgBox = get_current_folder(); |
---|
[1035] | 2240 | |
---|
[3035] | 2241 | img_previous_msg.onclick = function() |
---|
| 2242 | { |
---|
| 2243 | currentTab = ID; |
---|
| 2244 | openTab.type[ID] = 2; |
---|
| 2245 | proxy_mensagens.get_msg(folder.previousSibling.id,previousMsgBox,true,show_msg); |
---|
[5308] | 2246 | //select_msg('null', 'up', false); |
---|
[5367] | 2247 | if (!msg_selected){ |
---|
| 2248 | select_msg('null', 'up', true); |
---|
| 2249 | msg_selected = true; |
---|
| 2250 | } |
---|
[3035] | 2251 | }; |
---|
| 2252 | } |
---|
[5308] | 2253 | //primeira mensagem de cada página, exceto a primeira |
---|
| 2254 | else if(current_page > 1){ |
---|
| 2255 | |
---|
| 2256 | img_previous_msg.onclick = function() |
---|
| 2257 | { |
---|
| 2258 | |
---|
| 2259 | current_page--; |
---|
| 2260 | var range_begin = (current_page - 1)*preferences.max_email_per_page + 1; |
---|
| 2261 | var range_end = current_page*preferences.max_email_per_page; |
---|
| 2262 | var creatBoxAnterior = function (data){ |
---|
| 2263 | draw_box(data, get_current_folder()); |
---|
| 2264 | lastRow(); |
---|
| 2265 | }; |
---|
| 2266 | proxy_mensagens.messages_list(get_current_folder(),range_begin,range_end,sort_box_type,search_box_type,sort_box_reverse,'','', creatBoxAnterior); |
---|
| 2267 | }; |
---|
| 2268 | } |
---|
[3035] | 2269 | else |
---|
| 2270 | { |
---|
| 2271 | img_previous_msg.src = "./templates/"+template+"/images/up.gray.button.png"; |
---|
| 2272 | img_previous_msg.style.cursor = 'default'; |
---|
| 2273 | } |
---|
[569] | 2274 | } |
---|
| 2275 | else |
---|
[1035] | 2276 | { |
---|
| 2277 | img_previous_msg.src = "./templates/"+template+"/images/up.gray.button.png"; |
---|
| 2278 | img_previous_msg.style.cursor = 'default'; |
---|
[4726] | 2279 | // testa se a mensagem e local |
---|
| 2280 | if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(info_msg.msg_folder == "INBOX" + cyrus_delimiter + "decifradas")) // testa se a mensagem e local |
---|
[3035] | 2281 | { |
---|
| 2282 | img_previous_msg.onclick = function() |
---|
| 2283 | { |
---|
| 2284 | delete_border(ID); |
---|
| 2285 | }; |
---|
| 2286 | } |
---|
| 2287 | } |
---|
[2] | 2288 | next_previous_msg_td.appendChild(img_previous_msg); |
---|
| 2289 | next_previous_msg_td.appendChild(img_space); |
---|
| 2290 | next_previous_msg_td.appendChild(img_next_msg); |
---|
| 2291 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2292 | //Make the header message. |
---|
| 2293 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2294 | var table_message = document.createElement("TABLE"); |
---|
| 2295 | var tbody_message = document.createElement("TBODY"); |
---|
| 2296 | table_message.border = "0"; |
---|
[4493] | 2297 | //table_message.width = "100%"; |
---|
| 2298 | //k! |
---|
| 2299 | table_message.setAttribute("class", "expressomail-message-body"); |
---|
| 2300 | table_message.setAttribute("className", "expressomail-message-body"); |
---|
[2] | 2301 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2302 | //Make the options message. |
---|
| 2303 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2304 | var tr0 = document.createElement("TR"); |
---|
| 2305 | tr0.className = "tr_message_header"; |
---|
| 2306 | var td0 = document.createElement("TD"); |
---|
| 2307 | var table_message_options = document.createElement("TABLE"); |
---|
| 2308 | table_message_options.width = "100%"; |
---|
| 2309 | table_message_options.border = '0'; |
---|
| 2310 | table_message_options.className = 'table_message'; |
---|
| 2311 | var tbody_message_options = document.createElement("TBODY"); |
---|
| 2312 | var tr = document.createElement("TR"); |
---|
| 2313 | var td = document.createElement("TD"); |
---|
| 2314 | td.setAttribute("noWrap","true"); |
---|
[5735] | 2315 | td.style.fontSize = "10px"; |
---|
[2] | 2316 | var _name = ''; |
---|
| 2317 | var _maxChar = menuHidden ? 40 : 15; |
---|
[3035] | 2318 | |
---|
[2] | 2319 | if (info_msg.from.name) |
---|
[1416] | 2320 | { |
---|
| 2321 | var spanName = document.createElement("SPAN"); |
---|
| 2322 | spanName.innerHTML = info_msg.from.name; |
---|
| 2323 | _name = spanName.innerHTML.length > _maxChar ? spanName.innerHTML.substring(0,_maxChar) + "..." : spanName.innerHTML; |
---|
| 2324 | } |
---|
| 2325 | else |
---|
[2] | 2326 | _name = info_msg.from.email.length > _maxChar ? info_msg.from.email.substring(0,_maxChar) + "..." : info_msg.from.email; |
---|
| 2327 | |
---|
| 2328 | td.innerHTML = _name.bold() + ', ' + info_msg.smalldate; |
---|
[4493] | 2329 | //k! |
---|
[3035] | 2330 | if (info_msg.attachments && info_msg.attachments.length > 0) |
---|
[3369] | 2331 | 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] | 2332 | |
---|
[91] | 2333 | if (typeof(info_msg.signature) == 'string') |
---|
[3035] | 2334 | { |
---|
[109] | 2335 | if (info_msg.signature != "void") |
---|
[790] | 2336 | 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] | 2337 | else |
---|
[790] | 2338 | 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] | 2339 | } |
---|
[4072] | 2340 | |
---|
[320] | 2341 | if (info_msg.DispositionNotificationTo) |
---|
| 2342 | { |
---|
[3798] | 2343 | 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] | 2344 | } |
---|
[3035] | 2345 | |
---|
[5134] | 2346 | if (info_msg.Flagged == 'F') |
---|
| 2347 | { |
---|
[5569] | 2348 | 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] | 2349 | } |
---|
[2] | 2350 | // NORMAL MSG |
---|
| 2351 | if(info_msg.Draft != 'X') |
---|
| 2352 | { |
---|
| 2353 | var options = document.createElement("TD"); |
---|
[790] | 2354 | options.width = "30%"; |
---|
[2] | 2355 | options.setAttribute("noWrap","true"); |
---|
[5735] | 2356 | options.style.fontSize = "10px"; |
---|
[5134] | 2357 | |
---|
| 2358 | //BEGIN: DESENHA MOSTRA DETALHES, OCULTAR DETALHES |
---|
[2] | 2359 | var option_hide_more = document.createElement("SPAN"); |
---|
| 2360 | option_hide_more.className = 'message_options'; |
---|
[4826] | 2361 | option_hide_more.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2362 | option_hide_more.onmouseout=function () {this.className='message_options'}; |
---|
[24] | 2363 | options.align = 'right'; |
---|
[2] | 2364 | option_hide_more.value = 'more_options'; |
---|
| 2365 | option_hide_more.id = 'option_hide_more_'+ID; |
---|
| 2366 | option_hide_more.onclick = function(){ |
---|
| 2367 | if (this.value == 'more_options'){ |
---|
[3021] | 2368 | this.innerHTML = "<b><u>"+get_lang('Hide details')+"</u></b>"; |
---|
[2] | 2369 | this.value = 'hide_options'; |
---|
| 2370 | Element('table_message_others_options_'+ID).style.display = ''; |
---|
| 2371 | } |
---|
| 2372 | else{ |
---|
[3021] | 2373 | this.innerHTML = get_lang('Show details'); |
---|
[2] | 2374 | this.value = 'more_options'; |
---|
| 2375 | Element('table_message_others_options_'+ID).style.display = 'none'; |
---|
| 2376 | } |
---|
[3018] | 2377 | resizeWindow(); |
---|
[2] | 2378 | }; |
---|
[5134] | 2379 | //END: DESENHA MOSTRA DETALHES, OCULTAR DETALHES |
---|
| 2380 | |
---|
| 2381 | //OPCAO PARA MARCAR COMO |
---|
| 2382 | var option_mark_as = document.createElement("SPAN"); |
---|
| 2383 | option_mark_as.innerHTML = "<b>"+get_lang('Mark as')+"</b>"; |
---|
| 2384 | option_mark_as.className = 'message_options'; |
---|
| 2385 | option_mark_as.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2386 | option_mark_as.onmouseout=function () {this.className='message_options'}; |
---|
| 2387 | option_mark_as.onclick = function(){ |
---|
| 2388 | verifyOption('tr_other_mark_options_', ID); |
---|
| 2389 | var thi = document.getElementById('msg_opt_mark_options_'+ID); |
---|
| 2390 | if (thi.value != 'hide'){ |
---|
| 2391 | thi.value = 'hide'; |
---|
| 2392 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2393 | Element('tr_other_mark_options_'+ID).style.display = ''; |
---|
| 2394 | |
---|
| 2395 | } |
---|
| 2396 | else{ |
---|
| 2397 | thi.value = 'show'; |
---|
| 2398 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2399 | Element('tr_other_mark_options_'+ID).style.display = 'none'; |
---|
| 2400 | } |
---|
| 2401 | }; |
---|
| 2402 | //DESENHA OPCOES DO MARCAR COMO |
---|
[3036] | 2403 | var option_mark_as_unseen = document.createElement("SPAN"); |
---|
[5134] | 2404 | option_mark_as_unseen.className = "reply_options"; |
---|
[4826] | 2405 | option_mark_as_unseen.onclick = function () {changeLinkState(this,'seen'); |
---|
[3716] | 2406 | proxy_mensagens.proxy_set_message_flag(folder_id,'unseen'); |
---|
[3036] | 2407 | write_msg(get_lang('Message marked as ')+get_lang("Unseen")); |
---|
| 2408 | }; |
---|
[5134] | 2409 | option_mark_as_unseen.onmouseover=function () {this.className='reply_options_active'}; |
---|
| 2410 | option_mark_as_unseen.onmouseout=function () {this.className='reply_options'}; |
---|
[3036] | 2411 | option_mark_as_unseen.innerHTML = get_lang("Unseen"); |
---|
[3021] | 2412 | |
---|
[3036] | 2413 | var option_mark_important = document.createElement("SPAN"); |
---|
[5134] | 2414 | option_mark_important.className = 'reply_options'; |
---|
| 2415 | option_mark_important.onmouseover=function () {this.className='reply_options_active';}; |
---|
| 2416 | option_mark_important.onmouseout=function () {this.className='reply_options'}; |
---|
[3036] | 2417 | |
---|
| 2418 | if (info_msg.Flagged == "F"){ |
---|
[4072] | 2419 | option_mark_important.onclick = function() { |
---|
[3806] | 2420 | var _this = this; |
---|
| 2421 | proxy_mensagens.proxy_set_message_flag(folder_id,'unflagged', function(success){ |
---|
| 2422 | if (success) { |
---|
| 2423 | changeLinkState(_this, 'important'); |
---|
| 2424 | write_msg(get_lang('Message marked as ') + get_lang("Normal")); |
---|
| 2425 | } |
---|
| 2426 | } ); |
---|
[4072] | 2427 | |
---|
[3036] | 2428 | }; |
---|
| 2429 | option_mark_important.innerHTML = get_lang("Normal"); |
---|
| 2430 | } |
---|
| 2431 | else{ |
---|
[4826] | 2432 | option_mark_important.onclick = function() {changeLinkState(this,'normal'); |
---|
[3716] | 2433 | proxy_mensagens.proxy_set_message_flag(folder_id,'flagged'); |
---|
[3036] | 2434 | write_msg(get_lang('Message marked as ')+get_lang("Important")); |
---|
| 2435 | }; |
---|
| 2436 | option_mark_important.innerHTML = get_lang("Important"); |
---|
| 2437 | } |
---|
[5134] | 2438 | //option_mark.appendChild(option_mark_as_unseen); |
---|
| 2439 | //option_mark.appendChild(option_mark_important); |
---|
| 2440 | |
---|
| 2441 | |
---|
[3021] | 2442 | option_hide_more.innerHTML = get_lang('Show details'); |
---|
[5134] | 2443 | option_hide_more.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'O') : get_lang('Show details'); |
---|
| 2444 | |
---|
| 2445 | var space3 = document.createElement("SPAN"); |
---|
| 2446 | space3.innerHTML = ' | '; |
---|
| 2447 | |
---|
| 2448 | var option_mark_as_options = document.createElement('IMG'); |
---|
| 2449 | option_mark_as_options.id = 'msg_opt_mark_options_'+ID; |
---|
| 2450 | option_mark_as_options.src = '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2451 | option_mark_as_options.value = 'show'; |
---|
| 2452 | |
---|
| 2453 | option_mark_as_options.onmouseover = function(){ |
---|
| 2454 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/over.png'; |
---|
| 2455 | option_mark_as.className = 'message_options_active'; |
---|
| 2456 | }; |
---|
| 2457 | option_mark_as_options.onmouseout = function(){ |
---|
| 2458 | option_mark_as.className = 'message_options'; |
---|
| 2459 | if (this.value == 'show') |
---|
| 2460 | { |
---|
| 2461 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2462 | } |
---|
| 2463 | else |
---|
| 2464 | { |
---|
| 2465 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2466 | } |
---|
| 2467 | }; |
---|
| 2468 | option_mark_as_options.onclick = function(){ |
---|
| 2469 | verifyOption('tr_other_mark_options_', ID); |
---|
| 2470 | if (this.value != 'hide'){ |
---|
| 2471 | this.value = 'hide'; |
---|
| 2472 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2473 | Element('tr_other_mark_options_'+ID).style.display = ''; |
---|
| 2474 | |
---|
| 2475 | } |
---|
| 2476 | else{ |
---|
| 2477 | this.value = 'show'; |
---|
| 2478 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2479 | Element('tr_other_mark_options_'+ID).style.display = 'none'; |
---|
| 2480 | } |
---|
| 2481 | }; |
---|
| 2482 | |
---|
[2] | 2483 | options.appendChild(option_hide_more); |
---|
[5134] | 2484 | options.appendChild(space3); |
---|
| 2485 | options.appendChild(option_mark_as_options); |
---|
| 2486 | options.appendChild(option_mark_as); |
---|
| 2487 | //FIM OPCAO PARA MARCAR COMO |
---|
[3021] | 2488 | |
---|
[24] | 2489 | var space0 = document.createElement("SPAN"); |
---|
[790] | 2490 | space0.innerHTML = ' | '; |
---|
[2] | 2491 | var space1 = document.createElement("SPAN"); |
---|
[790] | 2492 | space1.innerHTML = ' | '; |
---|
[2] | 2493 | var space2 = document.createElement("SPAN"); |
---|
[790] | 2494 | space2.innerHTML = ' | '; |
---|
[2] | 2495 | |
---|
[5134] | 2496 | //OPCAO PARA MAIS ACOES |
---|
| 2497 | var option_more = document.createElement("SPAN"); |
---|
| 2498 | option_more.id = 'msg_opt_more_actions_'+ID; |
---|
| 2499 | option_more.className = 'message_options'; |
---|
| 2500 | //option_more.onclick = function(){new_message('forward', ID);}; |
---|
| 2501 | option_more.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2502 | option_more.onmouseout=function () {this.className='message_options'}; |
---|
| 2503 | option_more.onclick = function(){ |
---|
| 2504 | verifyOption('tr_other_more_options_', ID); |
---|
| 2505 | if (option_more_options.value != 'hide'){ |
---|
| 2506 | option_more_options.value = 'hide'; |
---|
| 2507 | option_more_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2508 | Element('tr_other_more_options_'+ID).style.display = ''; |
---|
| 2509 | |
---|
| 2510 | } |
---|
| 2511 | else{ |
---|
| 2512 | option_more_options.value = 'show'; |
---|
| 2513 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2514 | Element('tr_other_more_options_'+ID).style.display = 'none'; |
---|
| 2515 | } |
---|
| 2516 | }; |
---|
| 2517 | option_more.innerHTML = get_lang('More Actions'); |
---|
| 2518 | |
---|
| 2519 | //CRIA IMG DE MAIS ACOES |
---|
| 2520 | var option_more_options = document.createElement('IMG'); |
---|
| 2521 | option_more_options.id = 'msg_opt_more_options_'+ID; |
---|
| 2522 | option_more_options.src = '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2523 | option_more_options.value = 'show'; |
---|
| 2524 | |
---|
| 2525 | option_more_options.onmouseover = function(){ |
---|
| 2526 | option_more.className = 'message_options_active'; |
---|
| 2527 | option_more_options.src= '../expressoMail1_2/templates/default/images/over.png'; |
---|
| 2528 | }; |
---|
| 2529 | option_more_options.onmouseout = function(){ |
---|
| 2530 | option_more.className = 'message_options'; |
---|
| 2531 | if (this.value == 'show') |
---|
| 2532 | { |
---|
| 2533 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2534 | } |
---|
| 2535 | else |
---|
| 2536 | { |
---|
| 2537 | option_more_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2538 | } |
---|
| 2539 | }; |
---|
| 2540 | option_more_options.onclick = function(){ |
---|
| 2541 | verifyOption('tr_other_more_options_',ID); |
---|
| 2542 | |
---|
| 2543 | if (this.value != 'hide'){ |
---|
| 2544 | this.value = 'hide'; |
---|
| 2545 | option_more_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2546 | Element('tr_other_more_options_'+ID).style.display = ''; |
---|
| 2547 | |
---|
| 2548 | } |
---|
| 2549 | else{ |
---|
| 2550 | this.value = 'show'; |
---|
| 2551 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2552 | Element('tr_other_more_options_'+ID).style.display = 'none'; |
---|
| 2553 | } |
---|
| 2554 | }; |
---|
[2] | 2555 | options.appendChild(space1); |
---|
[5134] | 2556 | options.appendChild(option_more_options); |
---|
| 2557 | options.appendChild(option_more); |
---|
| 2558 | //FIM OPCAO PARA MAIS ACOES |
---|
| 2559 | |
---|
| 2560 | //OPCAO PARA RESPONDER |
---|
[2] | 2561 | var option_reply = document.createElement("SPAN"); |
---|
[128] | 2562 | option_reply.id = 'msg_opt_reply_'+ID; |
---|
[2] | 2563 | option_reply.className = 'message_options'; |
---|
| 2564 | option_reply.onclick = function(){new_message('reply_with_history', ID);}; |
---|
[197] | 2565 | option_reply.innerHTML = get_lang('Reply'); |
---|
[4826] | 2566 | option_reply.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2567 | option_reply.onmouseout=function () {this.className='message_options'}; |
---|
[5134] | 2568 | option_reply.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'R') : get_lang('Reply'); |
---|
[3036] | 2569 | |
---|
[2] | 2570 | options.appendChild(space2); |
---|
[3021] | 2571 | |
---|
| 2572 | var option_reply_options = document.createElement('IMG'); |
---|
| 2573 | option_reply_options.id = 'msg_opt_reply_options_'+ID; |
---|
| 2574 | option_reply_options.src = '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2575 | option_reply_options.value = 'show'; |
---|
| 2576 | |
---|
| 2577 | option_reply_options.onmouseover = function(){ |
---|
| 2578 | option_reply_options.src= '../expressoMail1_2/templates/default/images/over.png'; |
---|
| 2579 | }; |
---|
| 2580 | option_reply_options.onmouseout = function(){ |
---|
| 2581 | if (this.value == 'show') |
---|
| 2582 | { |
---|
| 2583 | option_reply_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2584 | } |
---|
| 2585 | else |
---|
| 2586 | { |
---|
| 2587 | option_reply_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2588 | } |
---|
| 2589 | }; |
---|
| 2590 | option_reply_options.onclick = function(){ |
---|
[5134] | 2591 | verifyOption('tr_other_options_', ID); |
---|
[3021] | 2592 | if (this.value != 'hide'){ |
---|
| 2593 | this.value = 'hide'; |
---|
| 2594 | option_reply_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2595 | Element('tr_other_options_'+ID).style.display = ''; |
---|
| 2596 | |
---|
| 2597 | } |
---|
| 2598 | else{ |
---|
| 2599 | this.value = 'show'; |
---|
| 2600 | option_reply_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2601 | Element('tr_other_options_'+ID).style.display = 'none'; |
---|
| 2602 | } |
---|
| 2603 | }; |
---|
| 2604 | options.appendChild(option_reply_options); |
---|
[2] | 2605 | options.appendChild(option_reply); |
---|
[5134] | 2606 | //FIM OPCAO PARA RESPONDER |
---|
| 2607 | |
---|
| 2608 | //OPCAO PARA ENCAMINHAR |
---|
| 2609 | var option_forward = document.createElement("SPAN"); |
---|
| 2610 | option_forward.id = 'msg_opt_forward_'+ID; |
---|
| 2611 | option_forward.className = 'message_options'; |
---|
| 2612 | option_forward.innerHTML = get_lang('Forward'); |
---|
| 2613 | option_forward.onclick = function(){new_message('forward', ID);}; |
---|
| 2614 | option_forward.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2615 | option_forward.onmouseout=function () {this.className='message_options'}; |
---|
| 2616 | option_forward.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'E') : get_lang('Forward'); |
---|
| 2617 | |
---|
| 2618 | var space9 = document.createElement("SPAN"); |
---|
| 2619 | space9.innerHTML = ' | '; |
---|
| 2620 | |
---|
| 2621 | options.appendChild(space9); |
---|
| 2622 | options.appendChild(option_forward); |
---|
| 2623 | //FIM DA OPCAO PARA ENCAMINHAR |
---|
| 2624 | |
---|
| 2625 | //OPCAO PARA DELETAR |
---|
| 2626 | var option_delete = document.createElement("SPAN"); |
---|
| 2627 | option_delete.id = 'msg_opt_delete_'+ID; |
---|
| 2628 | option_delete.className = 'message_options'; |
---|
| 2629 | option_delete.onclick = function(){proxy_mensagens.delete_msgs('null','selected','null');}; |
---|
| 2630 | option_delete.innerHTML = get_lang('Delete'); |
---|
| 2631 | option_delete.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2632 | option_delete.onmouseout=function () {this.className='message_options'}; |
---|
| 2633 | option_delete.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'Delete') : get_lang('Delete'); |
---|
[3035] | 2634 | |
---|
[5134] | 2635 | var space6 = document.createElement("SPAN"); |
---|
| 2636 | space6.innerHTML = ' | '; |
---|
| 2637 | |
---|
| 2638 | options.appendChild(space6); |
---|
| 2639 | options.appendChild(option_delete); |
---|
| 2640 | //FIM OPCAO PARA DELETAR |
---|
| 2641 | |
---|
[2] | 2642 | tr.appendChild(td); |
---|
[5134] | 2643 | //tr.appendChild(option_mark); |
---|
[2] | 2644 | tr.appendChild(options); |
---|
| 2645 | tr.appendChild(next_previous_msg_td); |
---|
| 2646 | tbody_message_options.appendChild(tr); |
---|
[3035] | 2647 | |
---|
[2] | 2648 | ////////// OTHER OPTIONS //////////////////// |
---|
| 2649 | var tr_other_options = document.createElement("TR"); |
---|
[5134] | 2650 | var tr_other_mark_options = document.createElement("TR"); |
---|
| 2651 | var tr_other_more_options = document.createElement("TR"); |
---|
| 2652 | |
---|
| 2653 | tr_other_mark_options.id = 'tr_other_mark_options_' + ID; |
---|
| 2654 | tr_other_mark_options.style.display = 'none'; |
---|
| 2655 | tr_other_mark_options.style.backgroundColor = '#205C8E'; |
---|
[2] | 2656 | tr_other_options.id = 'tr_other_options_' + ID; |
---|
| 2657 | tr_other_options.style.display = 'none'; |
---|
[5134] | 2658 | tr_other_options.style.backgroundColor = '#205C8E'; |
---|
| 2659 | tr_other_more_options.id = 'tr_other_more_options_' + ID; |
---|
| 2660 | tr_other_more_options.style.display = 'none'; |
---|
| 2661 | tr_other_more_options.style.backgroundColor = '#205C8E'; |
---|
[3035] | 2662 | |
---|
[2] | 2663 | var td_other_options = document.createElement("TD"); |
---|
[5134] | 2664 | var td_other_mark_options = document.createElement("TD"); |
---|
| 2665 | var td_other_more_options = document.createElement("TD"); |
---|
| 2666 | |
---|
[2] | 2667 | td_other_options.colSpan = '3'; |
---|
[5134] | 2668 | td_other_mark_options.colSpan = '3'; |
---|
| 2669 | td_other_more_options.colSpan = '3'; |
---|
| 2670 | |
---|
[2] | 2671 | var div_other_options = document.createElement("DIV"); |
---|
[5134] | 2672 | var div_other_mark_options = document.createElement("DIV"); |
---|
| 2673 | var div_other_more_options = document.createElement("DIV"); |
---|
[2] | 2674 | |
---|
[5134] | 2675 | //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>, '; |
---|
| 2676 | //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>, '; |
---|
| 2677 | //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] | 2678 | 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] | 2679 | //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> | '; |
---|
| 2680 | 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> | '; |
---|
| 2681 | 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> | '; |
---|
| 2682 | 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] | 2683 | |
---|
[5134] | 2684 | option_reply_to_all__title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'T') : ''; |
---|
| 2685 | 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] | 2686 | 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] | 2687 | 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] | 2688 | |
---|
[5134] | 2689 | 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> | '; |
---|
| 2690 | |
---|
[5754] | 2691 | div_other_more_options.innerHTML += option_move + option_print + option_export + block_user + report_error; |
---|
[5134] | 2692 | |
---|
| 2693 | div_other_options.innerHTML += option_reply_without_history + option_reply_to_all_without_history + option_reply_to_all; |
---|
[69] | 2694 | if (use_spam_filter) { |
---|
[5134] | 2695 | if(info_msg.msg_folder == 'INBOX'+cyrus_delimiter+'Spam' || (info_msg.msg_folder.match(/^user/) && info_msg.msg_folder.match(/Spam$/))){ |
---|
| 2696 | 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] | 2697 | } |
---|
[5134] | 2698 | else{ |
---|
| 2699 | 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> | '; |
---|
| 2700 | } |
---|
| 2701 | } |
---|
| 2702 | var space5 = document.createElement("SPAN"); |
---|
| 2703 | space5.innerHTML = ' | '; |
---|
[4830] | 2704 | |
---|
[5134] | 2705 | div_other_mark_options.appendChild(option_mark_as_unseen); |
---|
| 2706 | var space4 = document.createElement("SPAN"); |
---|
| 2707 | space4.innerHTML = ' | '; |
---|
| 2708 | div_other_mark_options.appendChild(space4); |
---|
| 2709 | div_other_mark_options.appendChild(option_mark_important); |
---|
| 2710 | var space7 = document.createElement("SPAN"); |
---|
| 2711 | space7.innerHTML = ' | '; |
---|
| 2712 | div_other_mark_options.appendChild(space7); |
---|
[4830] | 2713 | |
---|
[3021] | 2714 | td_other_options.align = 'right'; |
---|
| 2715 | td_other_options.style.paddingTop = '3px'; |
---|
[2] | 2716 | td_other_options.appendChild(div_other_options); |
---|
[3021] | 2717 | |
---|
[5134] | 2718 | td_other_mark_options.align = 'right'; |
---|
| 2719 | td_other_mark_options.style.paddingTop = '3px'; |
---|
| 2720 | td_other_mark_options.appendChild(div_other_mark_options); |
---|
| 2721 | |
---|
| 2722 | td_other_more_options.align = 'right'; |
---|
| 2723 | td_other_more_options.style.paddingTop = '3px'; |
---|
| 2724 | td_other_more_options.appendChild(div_other_more_options); |
---|
[3021] | 2725 | |
---|
[5134] | 2726 | |
---|
[2] | 2727 | tr_other_options.appendChild(td_other_options); |
---|
| 2728 | tbody_message_options.appendChild(tr_other_options); |
---|
[5134] | 2729 | |
---|
| 2730 | tr_other_more_options.appendChild(td_other_more_options); |
---|
| 2731 | tbody_message_options.appendChild(tr_other_more_options); |
---|
| 2732 | |
---|
| 2733 | tr_other_mark_options.appendChild(td_other_mark_options); |
---|
| 2734 | tbody_message_options.appendChild(tr_other_mark_options); |
---|
[2] | 2735 | ////////// END OTHER OPTIONS //////////////// |
---|
[1035] | 2736 | |
---|
[3035] | 2737 | ////////// BEGIN SIGNATURE ////////////////// |
---|
[1035] | 2738 | if (info_msg.signature && info_msg.signature.length > 0) |
---|
| 2739 | { |
---|
[3352] | 2740 | var tr_signature = document.createElement("TR"); |
---|
| 2741 | var td_signature = document.createElement("TD"); |
---|
| 2742 | td_signature.className = 'tr_message_header'; |
---|
| 2743 | tr_signature.id = 'tr_signature_'+ID; |
---|
| 2744 | td_signature.colSpan = "5"; |
---|
| 2745 | tr_signature.style.display = 'none'; |
---|
| 2746 | for (i in info_msg.signature) |
---|
| 2747 | { |
---|
| 2748 | if(typeof(info_msg.signature[i]) == 'object') |
---|
| 2749 | { |
---|
| 2750 | var aux = ''; |
---|
| 2751 | for (ii in info_msg.signature[i]) |
---|
| 2752 | { |
---|
| 2753 | if(info_msg.signature[i][ii].indexOf("###") > -1) |
---|
| 2754 | { |
---|
| 2755 | 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); |
---|
| 2756 | } |
---|
| 2757 | else |
---|
| 2758 | { |
---|
| 2759 | aux += info_msg.signature[i][ii]; |
---|
| 2760 | } |
---|
| 2761 | } |
---|
| 2762 | td_signature.innerHTML += "<a onclick=\"javascript:alert('" + aux + "')\"><b><font color=\"#0000FF\">" + get_lang("More") + "...</font></b></a>"; |
---|
| 2763 | continue; |
---|
| 2764 | } |
---|
| 2765 | if(info_msg.signature[i].indexOf("#@#") > -1) |
---|
| 2766 | { |
---|
| 2767 | 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 /> '; |
---|
| 2768 | } |
---|
[4934] | 2769 | if(info_msg.signature[i].indexOf("###") > -1) |
---|
| 2770 | { |
---|
| 2771 | 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 /> '; |
---|
| 2772 | } |
---|
[3352] | 2773 | } |
---|
| 2774 | var signature_status_pos = info_msg.signature[0].indexOf('Message untouched'); |
---|
| 2775 | td_signature.id = "td_signature_"+ID; |
---|
| 2776 | if(signature_status_pos < 0 ) |
---|
| 2777 | { |
---|
| 2778 | td.innerHTML += ' <img style="cursor:pointer" src="templates/'+template+'/images/signed_error.gif" title="'+get_lang("Details")+'">'; |
---|
| 2779 | tr_signature.style.display = ''; |
---|
| 2780 | } |
---|
| 2781 | else |
---|
| 2782 | { |
---|
| 2783 | td.innerHTML += ' <img style="cursor:pointer" src="templates/'+template+'/images/signed_table.gif" title="'+get_lang("Details")+'">'; |
---|
| 2784 | } |
---|
| 2785 | td.onclick = function(){ |
---|
| 2786 | var _height = Element("div_message_scroll_"+ID).style.height; |
---|
| 2787 | _height = parseInt(_height.replace("px","")); |
---|
| 2788 | var _offset = 130; |
---|
| 2789 | if (this.value == 'more_cert'){ |
---|
| 2790 | this.value = 'hide_cert'; |
---|
| 2791 | Element("div_message_scroll_"+ID).style.height = (_height + _offset)+"px"; |
---|
| 2792 | Element('tr_signature_'+ID).style.display = 'none'; |
---|
| 2793 | Element('td_signature_'+ID).style.display = 'none'; |
---|
[1035] | 2794 | |
---|
[3352] | 2795 | } |
---|
| 2796 | else{ |
---|
| 2797 | this.value = 'more_cert'; |
---|
| 2798 | Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px"; |
---|
| 2799 | Element('tr_signature_'+ID).style.display = ''; |
---|
| 2800 | Element('td_signature_'+ID).style.display = ''; |
---|
| 2801 | } |
---|
[1035] | 2802 | }; |
---|
| 2803 | |
---|
[3352] | 2804 | tr_signature.appendChild(td_signature); |
---|
| 2805 | tbody_message_options.appendChild(tr_signature); |
---|
[1035] | 2806 | } |
---|
| 2807 | //////////// END SIGNATURE //////////////// |
---|
| 2808 | |
---|
[2] | 2809 | table_message_options.appendChild(tbody_message_options); |
---|
| 2810 | td0.appendChild(table_message_options); |
---|
| 2811 | tr0.appendChild(td0); |
---|
| 2812 | tbody_message.appendChild(tr0); |
---|
| 2813 | } |
---|
| 2814 | // IF DRAFT |
---|
| 2815 | else |
---|
| 2816 | { |
---|
| 2817 | var options = document.createElement("TD"); |
---|
[5417] | 2818 | //options.width = "1%"; |
---|
[2] | 2819 | options.setAttribute("noWrap","true"); |
---|
[3021] | 2820 | var option_edit = ' | <span class="message_options" onclick="new_message(\'edit\',\''+ID+'\');">'+get_lang('Edit')+'</span>'; |
---|
| 2821 | var option_print = ' | <span class="message_options" onclick="print_msg(\''+info_msg.msg_folder+'\',\''+info_msg.msg_number+'\',\''+ID+'\');">'+get_lang('Print')+'</span>'; |
---|
[271] | 2822 | var option_hide_more = document.createElement("SPAN"); |
---|
| 2823 | option_hide_more.className = 'message_options'; |
---|
| 2824 | options.align = 'right'; |
---|
| 2825 | option_hide_more.value = 'more_options'; |
---|
| 2826 | option_hide_more.id = 'option_hide_more_'+ID; |
---|
[3021] | 2827 | option_hide_more.innerHTML = get_lang('Show details'); |
---|
[271] | 2828 | option_hide_more.onclick = function(){ |
---|
| 2829 | var _height = Element("div_message_scroll_"+ID).style.height; |
---|
| 2830 | _height = parseInt(_height.replace("px","")); |
---|
| 2831 | var _offset = 35; |
---|
| 2832 | if (this.value == 'more_options'){ |
---|
[3021] | 2833 | this.innerHTML = "<b><u>"+get_lang('Hide details')+"</u></b>"; |
---|
[271] | 2834 | this.value = 'hide_options'; |
---|
| 2835 | Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px"; |
---|
| 2836 | Element('table_message_others_options_'+ID).style.display = ''; |
---|
| 2837 | } |
---|
| 2838 | else{ |
---|
[3021] | 2839 | this.innerHTML = get_lang('Show details'); |
---|
[271] | 2840 | this.value = 'more_options'; |
---|
| 2841 | Element("div_message_scroll_"+ID).style.height = (_height + _offset)+"px"; |
---|
| 2842 | Element('table_message_others_options_'+ID).style.display = 'none'; |
---|
| 2843 | } |
---|
| 2844 | }; |
---|
| 2845 | options.appendChild(option_hide_more); |
---|
[3021] | 2846 | options_actions = document.createElement('SPAN'); |
---|
| 2847 | options_actions.innerHTML = option_edit + option_print; |
---|
| 2848 | options.appendChild(options_actions); |
---|
[2] | 2849 | tr.appendChild(td); |
---|
| 2850 | tr.appendChild(options); |
---|
| 2851 | tr.appendChild(next_previous_msg_td); |
---|
| 2852 | tbody_message_options.appendChild(tr); |
---|
| 2853 | table_message_options.appendChild(tbody_message_options); |
---|
| 2854 | td0.appendChild(table_message_options); |
---|
| 2855 | tr0.appendChild(td0); |
---|
| 2856 | tbody_message.appendChild(tr0); |
---|
[4072] | 2857 | |
---|
[3798] | 2858 | var important_message = document.createElement("INPUT"); |
---|
| 2859 | important_message.id = "is_important_"+ID; |
---|
| 2860 | important_message.name = "is_important"; |
---|
| 2861 | important_message.type = "HIDDEN"; |
---|
| 2862 | important_message.value = (info_msg.Importance == "" || info_msg.Importance == "Normal") ? "0": "1"; |
---|
[4072] | 2863 | |
---|
[3798] | 2864 | options.appendChild(important_message); |
---|
[2] | 2865 | } |
---|
| 2866 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2867 | // END options message. |
---|
| 2868 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2869 | |
---|
| 2870 | var table_message_others_options = document.createElement("TABLE"); |
---|
| 2871 | table_message_others_options.id = 'table_message_others_options_' + ID; |
---|
[3018] | 2872 | table_message_others_options.width = "100%"; |
---|
[2] | 2873 | table_message_others_options.style.display = 'none'; |
---|
[5134] | 2874 | if(navigator.appName.indexOf('Internet Explorer')>0){ |
---|
| 2875 | table_message_others_options.className = "table_message_options_ie"; |
---|
| 2876 | }else{ |
---|
| 2877 | table_message_others_options.className = "table_message_options"; |
---|
| 2878 | } |
---|
| 2879 | |
---|
[2] | 2880 | var tbody_message_others_options = document.createElement("TBODY"); |
---|
| 2881 | var tr1 = document.createElement("TR"); |
---|
| 2882 | tr1.className = "tr_message_header"; |
---|
| 2883 | var td1 = document.createElement("TD"); |
---|
[83] | 2884 | td1.innerHTML = get_lang("From: "); |
---|
[271] | 2885 | td1.appendChild(deny_email(info_msg.from.email)); |
---|
[2] | 2886 | td1.width = "7%"; |
---|
[3035] | 2887 | |
---|
[2] | 2888 | if (info_msg.sender){ |
---|
| 2889 | var tr111 = document.createElement("TR"); |
---|
| 2890 | tr111.className = "tr_message_header"; |
---|
| 2891 | var td111 = document.createElement("TD"); |
---|
| 2892 | td111.innerHTML = get_lang("Sent by")+": "; |
---|
[271] | 2893 | td111.appendChild(deny_email(info_msg.sender.email)); |
---|
[2] | 2894 | td111.setAttribute("noWrap","true"); |
---|
| 2895 | var sender = document.createElement("TD"); |
---|
| 2896 | sender.id = "sender_"+ID; |
---|
| 2897 | var sender_values = document.createElement("INPUT"); |
---|
| 2898 | sender_values.id = "sender_values_"+ID; |
---|
| 2899 | sender_values.type = "HIDDEN"; |
---|
| 2900 | sender_values.value = info_msg.sender.full; //Veio do IMAP, sem images nem links. |
---|
| 2901 | sender.innerHTML += draw_plugin_cc(ID, info_msg.sender.full); |
---|
| 2902 | sender.className = "header_message_field"; |
---|
| 2903 | tr111.appendChild(td111); |
---|
| 2904 | tr111.appendChild(sender); |
---|
| 2905 | tr111.appendChild(sender_values); |
---|
| 2906 | tbody_message_others_options.appendChild(tr111); |
---|
| 2907 | } |
---|
[3035] | 2908 | |
---|
[2] | 2909 | var from = document.createElement("TD"); |
---|
| 2910 | from.id = "from_"+ID; |
---|
| 2911 | from.innerHTML = info_msg.from.full; |
---|
| 2912 | if (info_msg.Draft != "X"){ |
---|
| 2913 | from.innerHTML += draw_plugin_cc(ID, info_msg.from); |
---|
| 2914 | tbody_message_others_options.appendChild(tr1); |
---|
| 2915 | } |
---|
| 2916 | from.className = "header_message_field"; |
---|
| 2917 | var from_values = document.createElement("INPUT"); |
---|
| 2918 | from_values.id = "from_values_"+ID; |
---|
| 2919 | from_values.type = "HIDDEN"; |
---|
| 2920 | from_values.value = info_msg.from.full; //Veio do IMAP, sem images nem links. |
---|
[790] | 2921 | |
---|
[689] | 2922 | var local_message = document.createElement("INPUT"); |
---|
| 2923 | local_message.id = "is_local_"+ID; |
---|
| 2924 | local_message.name = "is_local"; |
---|
| 2925 | local_message.type = "HIDDEN"; |
---|
| 2926 | local_message.value = (info_msg.local_message)?"1":"0"; |
---|
[790] | 2927 | |
---|
[2] | 2928 | tr1.appendChild(td1); |
---|
| 2929 | tr1.appendChild(from); |
---|
| 2930 | tr1.appendChild(from_values); |
---|
[689] | 2931 | tr1.appendChild(local_message); |
---|
| 2932 | |
---|
[2] | 2933 | if (info_msg.reply_to){ |
---|
| 2934 | var tr11 = document.createElement("TR"); |
---|
| 2935 | tr11.className = "tr_message_header"; |
---|
| 2936 | var td11 = document.createElement("TD"); |
---|
| 2937 | td11.innerHTML = get_lang("Reply to")+": "; |
---|
| 2938 | td11.setAttribute("noWrap","true"); |
---|
| 2939 | var reply_to = document.createElement("TD"); |
---|
| 2940 | reply_to.id = "reply_to_"+ID; |
---|
[3035] | 2941 | |
---|
[2] | 2942 | var reply_to_values = document.createElement("INPUT"); |
---|
| 2943 | reply_to_values.id = "reply_to_values_"+ID; |
---|
| 2944 | reply_to_values.type = "HIDDEN"; |
---|
| 2945 | reply_to_values.value = info_msg.reply_to; //Veio do IMAP, sem images nem links. |
---|
| 2946 | reply_to.innerHTML = draw_plugin_cc(ID, info_msg.reply_to); |
---|
| 2947 | reply_to.className = "header_message_field"; |
---|
| 2948 | tr11.appendChild(td11); |
---|
| 2949 | tr11.appendChild(reply_to); |
---|
| 2950 | tr11.appendChild(reply_to_values); |
---|
| 2951 | tbody_message_others_options.appendChild(tr11); |
---|
| 2952 | } |
---|
| 2953 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2954 | var tr2 = document.createElement("TR"); |
---|
| 2955 | tr2.className = "tr_message_header"; |
---|
| 2956 | var td2 = document.createElement("TD"); |
---|
[5134] | 2957 | td2.width = "7%"; |
---|
[83] | 2958 | td2.innerHTML = get_lang("To: "); |
---|
[2] | 2959 | var to = document.createElement("TD"); |
---|
| 2960 | to.id = "to_"+ID; |
---|
| 2961 | |
---|
| 2962 | var to_values = document.createElement("INPUT"); |
---|
| 2963 | to_values.id = "to_values_"+ID; |
---|
| 2964 | to_values.type = "HIDDEN"; |
---|
[3035] | 2965 | to_values.value = info_msg.toaddress2; //Veio do IMAP, sem images nem links. |
---|
[63] | 2966 | // Salva a pasta da mensagem |
---|
[3035] | 2967 | var input_current_folder = document.createElement('input'); |
---|
[63] | 2968 | input_current_folder.id = "input_folder_"+ID; |
---|
| 2969 | input_current_folder.name = "input_folder"; |
---|
| 2970 | input_current_folder.type = "hidden"; |
---|
| 2971 | input_current_folder.value = info_msg.msg_folder; |
---|
[3035] | 2972 | td2.appendChild(input_current_folder); |
---|
[63] | 2973 | // fim |
---|
[3847] | 2974 | // ALEXANDRE LUIZ CORREIA |
---|
| 2975 | if(info_msg.toaddress2 != null ) |
---|
| 2976 | { |
---|
| 2977 | toaddress_array[ID] = info_msg.toaddress2.split(","); |
---|
[4072] | 2978 | |
---|
[3847] | 2979 | if (toaddress_array[ID].length > 1) |
---|
| 2980 | { |
---|
| 2981 | to.innerHTML += draw_plugin_cc(ID, toaddress_array[ID][0]); |
---|
| 2982 | var div_toaddress = document.createElement("SPAN"); |
---|
| 2983 | div_toaddress.id = "div_toaddress_"+ID; |
---|
| 2984 | div_toaddress.style.display=""; |
---|
| 2985 | div_toaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','to');>"+get_lang('more')+"</a>)"; |
---|
| 2986 | to.appendChild(div_toaddress); |
---|
[4072] | 2987 | } |
---|
[3847] | 2988 | else |
---|
| 2989 | { |
---|
| 2990 | toAdd = toaddress_array[ID].toString() |
---|
| 2991 | if( trim(toAdd) != "" ) { |
---|
| 2992 | toAdd = toAdd.replace("<","<").replace(">",">"); |
---|
| 2993 | } else { |
---|
| 2994 | toAdd = get_lang("without destination"); |
---|
| 2995 | } |
---|
[4072] | 2996 | |
---|
[3847] | 2997 | to.innerHTML += draw_plugin_cc(ID,toAdd); |
---|
[3770] | 2998 | } |
---|
[4072] | 2999 | |
---|
[3847] | 3000 | to.className = "header_message_field"; |
---|
| 3001 | tr2.appendChild(td2); |
---|
| 3002 | tr2.appendChild(to); |
---|
| 3003 | tr2.appendChild(to_values); |
---|
[2] | 3004 | } |
---|
[4072] | 3005 | |
---|
[2] | 3006 | tbody_message_others_options.appendChild(tr2); |
---|
| 3007 | |
---|
| 3008 | if (info_msg.cc){ |
---|
| 3009 | var tr3 = document.createElement("TR"); |
---|
| 3010 | tr3.className = "tr_message_header"; |
---|
| 3011 | var td3 = document.createElement("TD"); |
---|
| 3012 | td3.innerHTML = "CC: "; |
---|
| 3013 | var cc = document.createElement("TD"); |
---|
| 3014 | cc.id = "cc_"+ID; |
---|
| 3015 | |
---|
| 3016 | var cc_values = document.createElement("INPUT"); |
---|
| 3017 | cc_values.id = "cc_values_"+ID; |
---|
| 3018 | cc_values.type = "HIDDEN"; |
---|
| 3019 | cc_values.value = info_msg.cc; |
---|
[3035] | 3020 | |
---|
| 3021 | ccaddress_array[ID] = info_msg.cc.split(","); |
---|
[13] | 3022 | if (ccaddress_array[ID].length > 1){ |
---|
[2] | 3023 | var div_ccaddress = document.createElement("SPAN"); |
---|
| 3024 | div_ccaddress.id = "div_ccaddress_"+ID; |
---|
| 3025 | var div_ccaddress_full = document.createElement("SPAN"); |
---|
[3035] | 3026 | div_ccaddress_full.id = "div_ccaddress_full_"+ID; |
---|
[2] | 3027 | div_ccaddress.style.display=""; |
---|
[13] | 3028 | cc.innerHTML = draw_plugin_cc(ID, ccaddress_array[ID][0]); |
---|
| 3029 | div_ccaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','cc');>"+get_lang('more')+"</a>)"; |
---|
| 3030 | cc.appendChild(div_ccaddress); |
---|
[2] | 3031 | } |
---|
| 3032 | else{ |
---|
| 3033 | cc.innerHTML = draw_plugin_cc(ID, info_msg.cc); |
---|
| 3034 | } |
---|
| 3035 | cc.className = "header_message_field"; |
---|
| 3036 | tr3.appendChild(td3); |
---|
| 3037 | tr3.appendChild(cc); |
---|
| 3038 | tr3.appendChild(cc_values); |
---|
| 3039 | tbody_message_others_options.appendChild(tr3); |
---|
| 3040 | } |
---|
[427] | 3041 | |
---|
| 3042 | /* |
---|
| 3043 | * @AUTHOR Rodrigo Souza dos Santos |
---|
| 3044 | * @MODIFY-DATE 2008/09/11 |
---|
| 3045 | * @BRIEF Adding routine to create bcc field if there is one. |
---|
| 3046 | */ |
---|
| 3047 | if (info_msg.bcc) |
---|
| 3048 | { |
---|
| 3049 | var tr3 = document.createElement("tr"); |
---|
| 3050 | tr3.className = "tr_message_header"; |
---|
| 3051 | var td3 = document.createElement("td"); |
---|
| 3052 | td3.innerHTML = get_lang("BCC") + " : "; |
---|
| 3053 | var cco = document.createElement("td"); |
---|
| 3054 | cco.id = "cco_"+ID; |
---|
| 3055 | |
---|
| 3056 | var cco_values = document.createElement("input"); |
---|
| 3057 | cco_values.id = "cco_values_"+ID; |
---|
| 3058 | cco_values.type = "hidden"; |
---|
[1638] | 3059 | cco_values.value = info_msg.bcc; |
---|
[427] | 3060 | |
---|
[3035] | 3061 | ccoaddress_array[ID] = info_msg.bcc.split(","); |
---|
[427] | 3062 | if (ccoaddress_array[ID].length > 1){ |
---|
| 3063 | var div_ccoaddress = document.createElement("SPAN"); |
---|
| 3064 | div_ccoaddress.id = "div_ccoaddress_"+ID; |
---|
| 3065 | var div_ccoaddress_full = document.createElement("SPAN"); |
---|
[3035] | 3066 | div_ccoaddress_full.id = "div_ccoaddress_full_"+ID; |
---|
[427] | 3067 | div_ccoaddress.style.display=""; |
---|
| 3068 | |
---|
| 3069 | //cco.innerHTML = draw_plugin_cc(ID, ccoaddress_array[ID][0]); |
---|
| 3070 | cco.innerHTML = ccoaddress_array[ID][0]; |
---|
| 3071 | div_ccoaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','cco');>"+get_lang('more')+"</a>)"; |
---|
| 3072 | cco.appendChild(div_ccoaddress); |
---|
| 3073 | } |
---|
| 3074 | else{ |
---|
| 3075 | //cco.innerHTML = draw_plugin_cc(ID, info_msg.cco); |
---|
| 3076 | cco.innerHTML = info_msg.bcc; |
---|
| 3077 | } |
---|
| 3078 | cco.className = "header_message_field"; |
---|
| 3079 | tr3.appendChild(td3); |
---|
| 3080 | tr3.appendChild(cco); |
---|
| 3081 | tr3.appendChild(cco_values); |
---|
| 3082 | tbody_message_others_options.appendChild(tr3); |
---|
| 3083 | } |
---|
| 3084 | |
---|
[2] | 3085 | var tr4 = document.createElement("TR"); |
---|
| 3086 | tr4.className = "tr_message_header"; |
---|
| 3087 | var td4 = document.createElement("TD"); |
---|
[83] | 3088 | td4.innerHTML = get_lang("Date: "); |
---|
[2] | 3089 | var date = document.createElement("TD"); |
---|
| 3090 | date.id = "date_"+ID; |
---|
| 3091 | date.innerHTML = info_msg.fulldate; |
---|
| 3092 | var date_day = document.createElement("INPUT"); |
---|
| 3093 | date_day.id = "date_day_"+ID; |
---|
| 3094 | date_day.type = "HIDDEN"; |
---|
| 3095 | date_day.value = info_msg.msg_day; |
---|
| 3096 | var date_hour = document.createElement("INPUT"); |
---|
| 3097 | date_hour.id = "date_hour_"+ID; |
---|
| 3098 | date_hour.type = "HIDDEN"; |
---|
| 3099 | date_hour.value = info_msg.msg_hour |
---|
| 3100 | date.className = "header_message_field"; |
---|
| 3101 | tr4.appendChild(td4); |
---|
| 3102 | tr4.appendChild(date); |
---|
| 3103 | tr4.appendChild(date_day); |
---|
| 3104 | tr4.appendChild(date_hour); |
---|
| 3105 | tbody_message_others_options.appendChild(tr4); |
---|
[3035] | 3106 | |
---|
[2] | 3107 | var tr5 = document.createElement("TR"); |
---|
| 3108 | tr5.className = "tr_message_header"; |
---|
| 3109 | var td5 = document.createElement("TD"); |
---|
[83] | 3110 | td5.innerHTML = get_lang("Subject"); |
---|
[2] | 3111 | var subject = document.createElement("TD"); |
---|
| 3112 | subject.id = "subject_"+ID; |
---|
[6109] | 3113 | subject.innerHTML = html_entities(info_msg.subject); |
---|
[2] | 3114 | subject.className = "header_message_field"; |
---|
[5804] | 3115 | if(defaultCalendar == "expressoCalendar" && $("#expressoCalendarid")[0]){ |
---|
[5392] | 3116 | var new_event_logo = document.createElement("IMG"); |
---|
| 3117 | new_event_logo.title = "Criar evento a partir deste email"; |
---|
| 3118 | new_event_logo.alt = "Criar evento a partir deste email"; |
---|
| 3119 | new_event_logo.src = "./templates/default/images/calendar_add.png"; |
---|
| 3120 | new_event_logo.style.cursor = "pointer"; |
---|
| 3121 | new_event_logo.style.marginLeft = "5px"; |
---|
| 3122 | new_event_logo.onclick = function(){ |
---|
[5619] | 3123 | import_implements_calendar(); |
---|
| 3124 | |
---|
| 3125 | |
---|
[5392] | 3126 | DataLayer.dispatchPath = "../prototype/"; |
---|
| 3127 | var path = "../prototype/modules/calendar/"; |
---|
[5409] | 3128 | |
---|
| 3129 | var startEvent = new Date(); |
---|
| 3130 | if(startEvent.toString('mm') < 30) |
---|
| 3131 | startEvent.add({minutes: (30 - parseInt(startEvent.toString('mm')))}); |
---|
| 3132 | else |
---|
| 3133 | startEvent.add({hours: 1, minutes: '-'+startEvent.toString('mm')}); |
---|
| 3134 | var endEvent = function(date){ |
---|
| 3135 | if(!!User.preferences.defaultCalendar){ |
---|
[5592] | 3136 | return new Date(parseInt(date.getTime()) + |
---|
| 3137 | (!!Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration ? |
---|
[5409] | 3138 | (Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration * 60000) : |
---|
| 3139 | (User.preferences.defaultDuration * 60000) |
---|
[5592] | 3140 | )); |
---|
[5409] | 3141 | }else |
---|
[5592] | 3142 | return new Date(parseInt(date.getTime()) + (User.preferences.defaultDuration * 60000)); |
---|
[5409] | 3143 | }; |
---|
[5592] | 3144 | |
---|
| 3145 | var emails = $("#to_values_"+ID).val().split(','); |
---|
| 3146 | |
---|
| 3147 | |
---|
| 3148 | //Normalização dos dados evita ter que reemplementar toda as funcionalidades do calendar |
---|
[5392] | 3149 | eventDetails({ |
---|
[5592] | 3150 | |
---|
| 3151 | acl: {inviteGuests: true, organization: true ,participationRequired: false, read: true, write: true}, |
---|
| 3152 | alarms: [], |
---|
| 3153 | allDay: false, |
---|
| 3154 | attachments: [], |
---|
[6332] | 3155 | isAttendee: true, |
---|
[6393] | 3156 | attendee: '',//TODOOOOOO, |
---|
[5592] | 3157 | calendar: User.preferences.defaultCalendar ? User.preferences.defaultCalendar : Calendar.calendars[0], |
---|
| 3158 | calendars: Calendar.calendars, |
---|
| 3159 | category: '', |
---|
[5658] | 3160 | 'class': '1', |
---|
[5592] | 3161 | delegatedFrom: {}, |
---|
| 3162 | endDate: startEvent.toString(User.preferences.dateFormat), |
---|
| 3163 | startDate: endEvent(startEvent).toString(User.preferences.dateFormat), |
---|
| 3164 | startHour: startEvent.toString(User.preferences.hourFormat), |
---|
| 3165 | endHour: endEvent(startEvent).toString(User.preferences.hourFormat), |
---|
[6393] | 3166 | timezone: User.preferences.defaultCalendar ? Calendar.signatureOf[User.preferences.defaultCalendar].calendar.timezone : User.preferences.timezone, |
---|
[5392] | 3167 | summary : $("#subject_"+ID).text(), |
---|
| 3168 | description : $("#body_" + ID).text(), |
---|
[5409] | 3169 | startTime: startEvent.getTime(), |
---|
[5592] | 3170 | endTime: endEvent(startEvent), |
---|
| 3171 | timezones: Timezone.timezones, |
---|
| 3172 | me: {name: User.me.name, mail: User.me.mail, acl: 'rowi', status: '1', delegatedFrom: '0', id: User.me.id}, |
---|
| 3173 | organizer: {name: User.me.name, mail: User.me.mail, acl: 'rowi', status: '1', delegatedFrom: '0' , id: User.me.id}, |
---|
| 3174 | statusParticipants: {accepted: 0, cancelled: 0, tentative: 0, unanswered:emails.length}, |
---|
| 3175 | location: '', |
---|
| 3176 | attendee: $.map(emails, function( mail ){ |
---|
[6599] | 3177 | var contact = false; |
---|
[5592] | 3178 | var decoded = Encoder.htmlDecode(mail); |
---|
| 3179 | var newAttendeeName = ""; |
---|
[5389] | 3180 | |
---|
[6599] | 3181 | var name = decoded.match(/"([^"]*)"/) ? decoded.match(/"([^"]*)"/)[1] : ''; |
---|
| 3182 | var mail = decoded.match(/<([^<]*)>[\s]*$/) ? decoded.match(/<([^<]*)>[\s]*$/)[1].toLowerCase() : decoded; |
---|
| 3183 | |
---|
| 3184 | |
---|
| 3185 | var user = DataLayer.get('user', ["=", "mail", mail], true); |
---|
[5592] | 3186 | |
---|
| 3187 | if( $.type(user) == "array") |
---|
[6580] | 3188 | user = user[0]; |
---|
[5392] | 3189 | |
---|
[6599] | 3190 | if(user != ''){ |
---|
| 3191 | //user = {name : name , mail : mail}; |
---|
| 3192 | if(User.me.mail == user.mail) |
---|
| 3193 | return(null); |
---|
| 3194 | user.isExternal = (!!user && !(!!user.isExternal)) ? 0 : 1; |
---|
[6580] | 3195 | |
---|
[6599] | 3196 | return DataLayer.merge({ |
---|
| 3197 | name: user.name, |
---|
| 3198 | mail: user.mail, |
---|
| 3199 | acl: 'r', |
---|
| 3200 | delegatedFrom: '0', |
---|
| 3201 | status: '4', |
---|
| 3202 | isExternal: user.isExternal |
---|
| 3203 | }, !!user.id ? {id : DataLayer.put('participant', {user: user.id, isExternal: user.isExternal})} : {id: DataLayer.put('participant', {user: user})}); |
---|
| 3204 | }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}\])/)){ |
---|
| 3205 | |
---|
| 3206 | var userId = DataLayer.put('user', { |
---|
| 3207 | name: name, |
---|
| 3208 | mail: mail, |
---|
| 3209 | isExternal: '1' |
---|
| 3210 | }); |
---|
| 3211 | var newAttendeeId = DataLayer.put('participant', { |
---|
| 3212 | user: userId, |
---|
| 3213 | isExternal: '1' |
---|
| 3214 | }); |
---|
[5592] | 3215 | |
---|
[6599] | 3216 | return { |
---|
| 3217 | id: newAttendeeId, |
---|
| 3218 | name: name, |
---|
| 3219 | mail: mail, |
---|
| 3220 | acl: 'r', |
---|
| 3221 | delegatedFrom: '0', |
---|
| 3222 | status: '4', |
---|
| 3223 | isExternal: '1' |
---|
| 3224 | }; |
---|
| 3225 | |
---|
| 3226 | }else |
---|
| 3227 | return (null); |
---|
[5592] | 3228 | }) |
---|
[5392] | 3229 | |
---|
[5592] | 3230 | }, true, path, true); |
---|
[5392] | 3231 | } |
---|
| 3232 | subject.appendChild(new_event_logo); |
---|
[5389] | 3233 | } |
---|
[2] | 3234 | tr5.appendChild(td5); |
---|
| 3235 | tr5.appendChild(subject); |
---|
| 3236 | tbody_message_others_options.appendChild(tr5); |
---|
[4493] | 3237 | //k! |
---|
[5535] | 3238 | |
---|
| 3239 | |
---|
[5866] | 3240 | var update_labeleds_msg = function(){ |
---|
| 3241 | //TODO Mudar quando API abstrair atualizações no cache |
---|
| 3242 | DataLayer.remove('labeled', false); |
---|
[6109] | 3243 | //DataLayer.get('labeled'); |
---|
[5866] | 3244 | var labels = DataLayer.get("labeled", {filter: [ |
---|
| 3245 | 'AND', |
---|
| 3246 | ['=', 'folderName', current_folder], |
---|
| 3247 | ['=','messageNumber',folder_id]], |
---|
| 3248 | criteria : {deepness: 2}} ); |
---|
[5535] | 3249 | |
---|
[5866] | 3250 | if(labels.length != 0){ |
---|
| 3251 | var tr8 = document.createElement("TR"); |
---|
| 3252 | tr8.className = "tr_message_header"; |
---|
| 3253 | var td8 = document.createElement("TD"); |
---|
| 3254 | td8.innerHTML = get_lang("Labels: "); |
---|
| 3255 | var markers = document.createElement("TD"); |
---|
| 3256 | markers.id = "markers_"+ID; |
---|
[5535] | 3257 | |
---|
[5866] | 3258 | for(var i=0; i<labels.length; i++){ |
---|
| 3259 | fontColor = labels[i].label.fontColor; |
---|
| 3260 | borderColor = labels[i].label.borderColor; |
---|
| 3261 | backgroundColor = labels[i].label.backgroundColor; |
---|
| 3262 | nameLabel = labels[i].label.name; |
---|
| 3263 | id = labels[i].id; |
---|
| 3264 | 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>"; |
---|
| 3265 | |
---|
| 3266 | } |
---|
| 3267 | $(markers).find('span.removeLabeledMsg').click(function(event){ |
---|
| 3268 | var id_labeled = $(event.target).attr("id"); |
---|
| 3269 | //TODO Mudar quando API abstrair atualizações no cache |
---|
[6109] | 3270 | //DataLayer.remove('labeled', false); |
---|
| 3271 | //DataLayer.get('labeled'); |
---|
[5866] | 3272 | DataLayer.remove('labeled', id_labeled); |
---|
| 3273 | DataLayer.commit(false, false, function(){ |
---|
| 3274 | var index_folder = id_labeled.lastIndexOf('/'); |
---|
| 3275 | var folder_name = id_labeled.slice(0,index_folder); |
---|
| 3276 | var index_number = id_labeled.lastIndexOf('#'); |
---|
| 3277 | var msg_number = id_labeled.slice(index_folder + 1,index_number); |
---|
| 3278 | updateLabelsColumn({msg_number:msg_number, boxname:folder_name, labels:false}); |
---|
| 3279 | update_labeleds_msg(); |
---|
| 3280 | tbody_message_others_options.removeChild(tr8); |
---|
| 3281 | }); |
---|
| 3282 | |
---|
| 3283 | }); |
---|
| 3284 | markers.className = "header_message_field"; |
---|
| 3285 | tr8.appendChild(td8); |
---|
| 3286 | tr8.appendChild(markers); |
---|
| 3287 | tbody_message_others_options.appendChild(tr8); |
---|
[5535] | 3288 | } |
---|
| 3289 | } |
---|
[5967] | 3290 | |
---|
[4493] | 3291 | if ( info_msg.attachments && info_msg.attachments.length > 0 ) |
---|
| 3292 | { |
---|
[5134] | 3293 | //Código no padrão expresso 2.2 |
---|
| 3294 | var tr6 = document.createElement("TR"); |
---|
| 3295 | tr6.className = "tr_message_header"; |
---|
| 3296 | var td6 = document.createElement("TD"); |
---|
| 3297 | td6.innerHTML = get_lang("Attachments: "); |
---|
[4493] | 3298 | |
---|
| 3299 | |
---|
[5134] | 3300 | var attachments = document.createElement("TD"); |
---|
| 3301 | td6.valign = "top"; |
---|
| 3302 | attachments.align = 'left'; |
---|
| 3303 | if(info_msg.attachments.length >= 1){ |
---|
[4820] | 3304 | if(info_msg.attachments.length > 1) { |
---|
| 3305 | var link_attachment = document.createElement("A"); |
---|
| 3306 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
| 3307 | link_attachment.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3308 | else |
---|
| 3309 | link_attachment.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3310 | link_attachment.innerHTML = " "+info_msg.attachments.length+' '+get_lang('files')+' :: '+get_lang('Download all atachments'); |
---|
[5134] | 3311 | attachments.appendChild(link_attachment); |
---|
[4820] | 3312 | } |
---|
| 3313 | if(parseInt(preferences.remove_attachments_function)) |
---|
| 3314 | { |
---|
[5134] | 3315 | attachments.appendChild(document.createTextNode(' ')); |
---|
| 3316 | var del_attachments = document.createElement("A"); |
---|
| 3317 | del_attachments.setAttribute("href", "javascript:remove_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3318 | del_attachments.innerHTML = get_lang('remove all attachments'); |
---|
| 3319 | attachments.appendChild(del_attachments); |
---|
[4820] | 3320 | } |
---|
[5134] | 3321 | attachments.appendChild(document.createElement('BR')); |
---|
| 3322 | } |
---|
| 3323 | attachments.id = "attachments_" + ID; |
---|
[4493] | 3324 | for (var i=0; i<info_msg.attachments.length; i++) |
---|
| 3325 | { |
---|
[5134] | 3326 | var link_attachment = document.createElement("a"); |
---|
[689] | 3327 | link_attachment.setAttribute("href", proxy_mensagens.link_anexo(info_msg,i)); |
---|
[4493] | 3328 | link_attachment.innerHTML = url_decode(info_msg.attachments[i].name) + " ("+borkb(info_msg.attachments[i].fsize)+")"; |
---|
[5134] | 3329 | //link_attachment.innerHTML += " ("+borkb(info_msg.attachments[i].fsize)+")"; |
---|
[4072] | 3330 | |
---|
[4493] | 3331 | //k trocar por match??? |
---|
| 3332 | if((url_decode(info_msg.attachments[i].name).indexOf(".ics")!=-1) || (url_decode(info_msg.attachments[i].name).indexOf(".vcard")!=-1)) |
---|
[3519] | 3333 | { |
---|
[620] | 3334 | //Link para importar calendário |
---|
[673] | 3335 | var link_import_attachment = new Image(); |
---|
[790] | 3336 | link_import_attachment.src = "templates/"+template+"/images/new.png"; |
---|
[3519] | 3337 | 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] | 3338 | link_import_attachment.title = get_lang("Import to calendar"); |
---|
[3035] | 3339 | link_import_attachment.align = "top"; |
---|
[3519] | 3340 | link_import_attachment.style.marginLeft = "5px"; |
---|
[673] | 3341 | link_import_attachment.style.cursor = "pointer"; |
---|
[3519] | 3342 | link_attachment.appendChild(link_import_attachment); |
---|
[620] | 3343 | } |
---|
[4820] | 3344 | |
---|
[5134] | 3345 | if((url_decode(info_msg.attachments[i].name).indexOf(".eml") != -1)) |
---|
| 3346 | { |
---|
| 3347 | //Link para importar calendário |
---|
| 3348 | var link_open_msg = new Image(); |
---|
| 3349 | link_open_msg.src = "templates/"+template+"/images/email.png"; |
---|
| 3350 | //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;"); |
---|
| 3351 | 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;"); |
---|
| 3352 | link_open_msg.title = get_lang("Open message"); |
---|
| 3353 | link_open_msg.align = "top"; |
---|
| 3354 | link_open_msg.style.marginLeft = "5px"; |
---|
| 3355 | link_open_msg.style.cursor = "pointer"; |
---|
| 3356 | link_attachment.appendChild(link_open_msg); |
---|
[2] | 3357 | } |
---|
[4493] | 3358 | |
---|
[5134] | 3359 | link_attachment.innerHTML += '<br/>'; |
---|
| 3360 | attachments.appendChild(link_attachment); |
---|
| 3361 | } |
---|
[2] | 3362 | tr6.appendChild(td6); |
---|
[5134] | 3363 | tr6.appendChild(attachments); |
---|
[2] | 3364 | tbody_message_others_options.appendChild(tr6); |
---|
[4820] | 3365 | } |
---|
[5134] | 3366 | |
---|
[4493] | 3367 | //k!! |
---|
[6463] | 3368 | |
---|
[2] | 3369 | var div = document.createElement("DIV"); |
---|
| 3370 | div.id = "div_message_scroll_"+ID; |
---|
[5134] | 3371 | div.style.background = 'WHITE'; |
---|
| 3372 | div.style.overflow = "auto"; |
---|
[2] | 3373 | table_message_others_options.appendChild(tbody_message_others_options); |
---|
| 3374 | var tr = document.createElement("TR"); |
---|
[5134] | 3375 | tr.className = "tr_message_header"; |
---|
[2] | 3376 | var td = document.createElement("TD"); |
---|
[5134] | 3377 | td.colspan = '2'; |
---|
[5083] | 3378 | td.style.fontSize = '10pt'; |
---|
| 3379 | td.style.fontFamily = 'Arial,Verdana'; |
---|
| 3380 | td.style.verticalAlign = 'top'; |
---|
| 3381 | td.style.height = '100%'; |
---|
[2] | 3382 | div.appendChild(table_message_others_options); |
---|
[3018] | 3383 | var imgTag = info_msg.body.match(/(<img[^>]*src[^>=]*=['"]?[^'">]*["']?[^>]*>)|(<[^>]*(style[^=>]*=['"][^>]*background(-image)?:[^:;>]*url\()[^>]*>)/gi); |
---|
[790] | 3384 | var newBody = info_msg.body; |
---|
| 3385 | if(!info_msg.showImg && imgTag) |
---|
| 3386 | { |
---|
| 3387 | var domains = ''; |
---|
| 3388 | var blocked = false; |
---|
| 3389 | var forbidden = true; |
---|
[1637] | 3390 | |
---|
| 3391 | if (preferences.notification_domains != null && typeof(preferences.notification_domains) != 'undefined') |
---|
| 3392 | { |
---|
[790] | 3393 | domains = preferences.notification_domains.split(','); |
---|
[1637] | 3394 | for(var j = 0; j < imgTag.length; j++) |
---|
[790] | 3395 | { |
---|
[1637] | 3396 | for (var i = 0; i < domains.length; i++) |
---|
| 3397 | { |
---|
[5134] | 3398 | if (imgTag[j].match(/cid:([\w\d]){5,}/) || imgTag[j].match(/src=\"\.\/inc\/get_archive\.php/g)) |
---|
[3018] | 3399 | { |
---|
| 3400 | forbidden = false; |
---|
| 3401 | continue; |
---|
| 3402 | } |
---|
[1637] | 3403 | imgSource = imgTag[j].match(/=['"](http:\/\/)+[^'"\/]*/); |
---|
| 3404 | if (imgSource && imgSource.toString().substr(5).match(domains[i])) |
---|
| 3405 | forbidden = false; |
---|
| 3406 | } |
---|
| 3407 | if (forbidden) |
---|
| 3408 | { |
---|
[5134] | 3409 | newBody = newBody.replace(imgTag[j],"<img src='templates/"+template+"/images/forbidden.png'>"); |
---|
[1637] | 3410 | blocked=true; |
---|
| 3411 | } |
---|
[790] | 3412 | } |
---|
[1637] | 3413 | if (blocked) |
---|
[790] | 3414 | { |
---|
[1637] | 3415 | var showImgLink = document.createElement('DIV'); |
---|
[1711] | 3416 | showImgLink.id="show_img_link_"+ID; |
---|
[1637] | 3417 | showImgLink.onclick = function(){show_msg_img(info_msg.msg_number,info_msg.msg_folder)}; |
---|
| 3418 | showImgLink.className="show_img_link"; |
---|
| 3419 | showImgLink.innerHTML = get_lang("Show images from")+": "+info_msg.from.email; |
---|
| 3420 | td.appendChild(showImgLink); |
---|
[790] | 3421 | } |
---|
| 3422 | } |
---|
| 3423 | } |
---|
[2] | 3424 | td.appendChild(div); |
---|
| 3425 | tr.appendChild(td) |
---|
| 3426 | tbody_message.appendChild(tr); |
---|
| 3427 | |
---|
| 3428 | |
---|
[3035] | 3429 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[2] | 3430 | //Make the body message. |
---|
[790] | 3431 | /////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[2] | 3432 | var tr = document.createElement("TR"); |
---|
| 3433 | tr.className = "tr_message_body"; |
---|
| 3434 | var td = document.createElement("TD"); |
---|
| 3435 | //td.setAttribute("colSpan","2"); |
---|
[5301] | 3436 | |
---|
| 3437 | //Comentado pois estes replaces e a tentativa de remover as tags <span> vazias faz com que seja |
---|
| 3438 | //eliminado os estilos aplicados no corpo do texto quando utilizado o Firefox. |
---|
| 3439 | //newBody = newBody.replace("<body","<span"); |
---|
| 3440 | //newBody = newBody.replace("<BODY","<span"); |
---|
| 3441 | //while ( ( /<span[^>]*><span[^>]*>/ig ).test( newBody ) ) |
---|
| 3442 | // newBody = newBody.replace( /(<span[^>]*>)<span[^>]*>/ig, '$1' ); |
---|
[3018] | 3443 | |
---|
[3035] | 3444 | var _body = document.createElement( 'div' ); |
---|
| 3445 | _body.id = 'body_' + ID; |
---|
| 3446 | _body.innerHTML = newBody; |
---|
[5476] | 3447 | _body.style.marginLeft = '5px'; |
---|
[3018] | 3448 | |
---|
[3035] | 3449 | var _elements = _body.getElementsByTagName( '*' ); |
---|
| 3450 | for( var i = 0; i < _elements.length; i++ ) |
---|
| 3451 | if ( _elements[ i ].attributes && _elements[ i ].attributes.getNamedItem( 'id' ) ) |
---|
[5369] | 3452 | _elements[ i ].attributes.removeNamedItem( 'id' ); |
---|
| 3453 | |
---|
[3035] | 3454 | div.appendChild( _body ); |
---|
[5370] | 3455 | |
---|
| 3456 | //window.setTimeout(function() { $("#div_message_scroll_"+ID).focus() },250); |
---|
[3018] | 3457 | |
---|
[3035] | 3458 | function mailto( link ) |
---|
| 3459 | { |
---|
| 3460 | var mail = link.href.substr( 7 ); |
---|
| 3461 | link.onclick = function( ) |
---|
| 3462 | { |
---|
| 3463 | new_message_to( mail ); |
---|
| 3464 | return false; |
---|
| 3465 | }; |
---|
| 3466 | } |
---|
| 3467 | var links = div.getElementsByTagName( 'a' ); |
---|
| 3468 | for ( var i = 0; i < links.length; i++ ){ |
---|
| 3469 | try{ |
---|
| 3470 | if ( links.item( i ).href.indexOf( 'mailto:' ) === 0 ){ |
---|
| 3471 | mailto( links.item( i ) ); |
---|
| 3472 | } |
---|
| 3473 | else{ |
---|
[4072] | 3474 | var anchor_pattern = "http://"+location.host+location.pathname+"#"; |
---|
| 3475 | |
---|
| 3476 | if ( ( links.item( i ).href.indexOf( 'javascript:' ) !== 0 ) && |
---|
[3393] | 3477 | (links.item( i ).href.indexOf(anchor_pattern) !== 0) ) //se não for âncora |
---|
| 3478 | links.item( i ).setAttribute( 'target', '_blank' ); |
---|
[3035] | 3479 | } |
---|
| 3480 | }catch(e){ |
---|
| 3481 | } |
---|
[3369] | 3482 | } |
---|
[3035] | 3483 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[2] | 3484 | //Make the thumbs of the message. |
---|
| 3485 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[4493] | 3486 | //k |
---|
| 3487 | |
---|
[4820] | 3488 | if ((info_msg.thumbs)&&(info_msg.thumbs.length > 0)){ |
---|
[5134] | 3489 | var thumbs = jQuery.parseJSON(info_msg.thumbs); |
---|
| 3490 | var div_thumbs = document.createElement("div"); |
---|
| 3491 | |
---|
[4493] | 3492 | div_thumbs.setAttribute("class", "expressomail-thumbs"); |
---|
| 3493 | div_thumbs.setAttribute("className", "expressomail-thumbs"); //for IE |
---|
| 3494 | |
---|
| 3495 | var div_thumbs_lbl = document.createElement("DIV"); |
---|
| 3496 | div_thumbs_lbl.setAttribute("class", "expressomail-thumbs-label"); |
---|
| 3497 | div_thumbs_lbl.setAttribute("className", "expressomail-thumbs-label"); //for IE |
---|
| 3498 | |
---|
| 3499 | var div_thumbs_lbl_sp = document.createElement("SPAN"); |
---|
| 3500 | div_thumbs_lbl_sp.setAttribute("class", "message_options"); |
---|
| 3501 | div_thumbs_lbl_sp.setAttribute("className", "message_options"); //for IE |
---|
| 3502 | var div_thumbs_lbl_st = document.createElement("STRONG"); |
---|
| 3503 | div_thumbs_lbl_st.innerHTML = info_msg.attachments.length+" "+get_lang("attachment")+(info_msg.attachments.length > 1 ? "s" : "")+" "+get_lang("in this message"); |
---|
| 3504 | var div_thumbs_lbl_a = document.createElement("A"); |
---|
| 3505 | |
---|
[4820] | 3506 | if(info_msg.thumbs.length > 1){ |
---|
| 3507 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
[4493] | 3508 | div_thumbs_lbl_a.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
[3035] | 3509 | else |
---|
[4493] | 3510 | div_thumbs_lbl_a.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3511 | div_thumbs_lbl_a.innerHTML = get_lang('Download all atachments'); |
---|
| 3512 | } else { |
---|
| 3513 | div_thumbs_lbl_a.setAttribute("style", "display:none; visibility:hidden;"); |
---|
[2] | 3514 | } |
---|
[3035] | 3515 | |
---|
[4493] | 3516 | div_thumbs_lbl_sp.appendChild(div_thumbs_lbl_st); |
---|
| 3517 | div_thumbs_lbl_sp.appendChild(document.createTextNode(' :: ')); |
---|
| 3518 | div_thumbs_lbl_sp.appendChild(div_thumbs_lbl_a); |
---|
| 3519 | div_thumbs_lbl.appendChild(div_thumbs_lbl_sp); |
---|
[4820] | 3520 | |
---|
[4493] | 3521 | var div_thumbs_lbl_sp2 = document.createElement("SPAN"); |
---|
| 3522 | div_thumbs_lbl_sp2.setAttribute("class", "message_tips"); |
---|
| 3523 | div_thumbs_lbl_sp2.setAttribute("className", "message_tips"); //for IE |
---|
| 3524 | 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] | 3525 | |
---|
[4493] | 3526 | var ul_thumbs_list = document.createElement("UL"); |
---|
| 3527 | ul_thumbs_list.setAttribute("class", "expressomail-thumbs-list"); |
---|
| 3528 | ul_thumbs_list.setAttribute("className", "expressomail-thumbs-list"); //for IE |
---|
[3035] | 3529 | |
---|
[5134] | 3530 | var msg = info_msg.msg_number; |
---|
| 3531 | var fdr = info_msg.msg_folder; |
---|
| 3532 | var i = 0; |
---|
| 3533 | //verifica se está no novo padrão de montagem das mensagens ou no antigo, necessário |
---|
| 3534 | //para exibir as imagens no arquivamento local arquivamento local. |
---|
| 3535 | if(thumbs){ |
---|
| 3536 | jQuery.each(thumbs, function(i, thumb) { |
---|
| 3537 | if(fdr.indexOf("local_") >= 0){ |
---|
| 3538 | var href = info_msg.array_attach[i].url + '&image=true'; |
---|
| 3539 | var src = info_msg.array_attach[i].url+ '&image=thumbnail'; |
---|
| 3540 | i++; |
---|
| 3541 | }else{ |
---|
| 3542 | var href = './inc/get_archive.php?msgFolder=' + fdr + '&msgNumber=' + msg + '&indexPart=' + thumb.pid + '&image=true'; |
---|
| 3543 | //var href = thumb.url; |
---|
| 3544 | var src = 'inc/get_archive.php?msgFolder=' + fdr + '&msgNumber=' + msg + '&indexPart=' + thumb.pid + '&image=thumbnail'; |
---|
| 3545 | } |
---|
| 3546 | var msgid= fdr+";;"+msg+";;"+i+";;"+thumb.pid+";;"+thumb.encoding; |
---|
| 3547 | var image_info = '{"folder":"'+fdr+'","message":"'+msg+'","thumbIndex":"'+i+'","pid":"'+thumb.pid+'","encoding":"'+thumb.encoding+'","type":"'+thumb.type+'"}'; |
---|
| 3548 | |
---|
| 3549 | var image= '<img id="' + msgid + '" title="' + |
---|
| 3550 | get_lang('Click here do view (+)') + '" src="' + src + '" style="width:auto;height:100%;" />'; |
---|
| 3551 | |
---|
| 3552 | 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>'; |
---|
| 3553 | content += '<input id="thumb_'+ID+'_'+i+'" type="hidden" value="' +escape(image_info) +'" />'; |
---|
| 3554 | jQuery(ul_thumbs_list).append('<li>'+content+'</li>'); |
---|
| 3555 | |
---|
| 3556 | }); |
---|
[4493] | 3557 | |
---|
| 3558 | div_thumbs.appendChild(div_thumbs_lbl); |
---|
| 3559 | div_thumbs.appendChild(div_thumbs_lbl_sp2); |
---|
| 3560 | div_thumbs.appendChild(ul_thumbs_list); |
---|
| 3561 | |
---|
[5134] | 3562 | }else{ |
---|
| 3563 | div_thumbs.appendChild(div_thumbs_lbl); |
---|
| 3564 | div_thumbs.appendChild(div_thumbs_lbl_sp2); |
---|
| 3565 | div_thumbs.innerHTML = div_thumbs.innerHTML + info_msg.thumbs; |
---|
| 3566 | |
---|
| 3567 | |
---|
| 3568 | } |
---|
| 3569 | |
---|
[4493] | 3570 | div.appendChild(div_thumbs); |
---|
[2] | 3571 | } |
---|
[4493] | 3572 | //k!! |
---|
[2] | 3573 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 3574 | table_message.appendChild(tbody_message); |
---|
| 3575 | content.appendChild(table_message); |
---|
[3035] | 3576 | resizeWindow(); |
---|
[2] | 3577 | var msg_number = document.createElement('INPUT'); |
---|
| 3578 | msg_number.id = "msg_number_" + ID; |
---|
| 3579 | msg_number.type = "hidden"; |
---|
| 3580 | msg_number.value = info_msg.msg_number; |
---|
| 3581 | content.appendChild(msg_number); |
---|
| 3582 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[3165] | 3583 | |
---|
| 3584 | //Exibe o cabecalho da mensagem totalmente aberto caso esteja setado nas preferencias do usuario |
---|
| 3585 | if (preferences.show_head_msg_full == 1) |
---|
| 3586 | { |
---|
| 3587 | option_hide_more.onclick(); |
---|
[3168] | 3588 | if (Element('div_toaddress_'+ID) != null) |
---|
| 3589 | show_div_address_full(ID,'to'); |
---|
| 3590 | if (Element('div_ccaddress_'+ID) != null) |
---|
| 3591 | show_div_address_full(ID,'cc'); |
---|
[3165] | 3592 | } |
---|
[4820] | 3593 | |
---|
[4493] | 3594 | /* |
---|
| 3595 | * TODO: implementar o controle como preferência do usuário |
---|
| 3596 | * |
---|
| 3597 | */ |
---|
| 3598 | var jcarousel = false; |
---|
| 3599 | if (jcarousel) { |
---|
[5134] | 3600 | //carousel |
---|
[4493] | 3601 | jQuery(document).ready(function() { |
---|
[5134] | 3602 | jQuery('.expressomail-thumbs-list').attr('id', 'expressomail-thumbs-list'+ID) |
---|
| 3603 | .addClass('jcarousel-skin-default').jcarousel(); |
---|
| 3604 | |
---|
| 3605 | jQuery('.expressomail-thumbs-link img').attr('style', ''); |
---|
[4493] | 3606 | |
---|
| 3607 | //fancybox |
---|
| 3608 | jQuery(".expressomail-thumbs-list li a").attr('onclick', 'return true;'); |
---|
| 3609 | jQuery(".expressomail-thumbs-list li a").fancybox({ |
---|
| 3610 | 'hideOnContentClick': true, |
---|
[5134] | 3611 | 'type': 'image', |
---|
| 3612 | 'titlePosition': 'over', |
---|
| 3613 | 'titleFormat' : function(name, currentArray, currentIndex, currentOpts) { |
---|
| 3614 | var image_info = $('#thumb_'+ID+'_'+currentIndex).val(); |
---|
| 3615 | |
---|
| 3616 | return '<div id="fancybox-title" class="fancybox-title-over" style="width: 100%; display: block;">' + |
---|
| 3617 | '<div id="fancybox-title-over">' + |
---|
| 3618 | '<a title="Anterior" onclick="javascript:$.fancybox.prev();" style="float:left;">' + |
---|
| 3619 | '<img src="./templates/'+template+'/images/left_arrow_white.png" width="30" height="30" />' + |
---|
| 3620 | '</a>'+ |
---|
| 3621 | '<a title="Baixar imagem" onclick="javascript:save_image2(\''+image_info+'\');" style="padding:0 5px;">' + |
---|
| 3622 | '<img src="./templates/'+template+'/images/image_down.png" width="22" height="22" />' + |
---|
| 3623 | '</a>'+ |
---|
| 3624 | '<a title="Baixar todas de uma vez" onclick="javascript:download_all_attachments(\''+info_msg.msg_folder+"','"+info_msg.msg_number+'\')" style="padding:0 5px;">'+ |
---|
| 3625 | '<img src="./templates/'+template+'/images/package_down.png" width="26" height="26" />' + |
---|
| 3626 | '</a>'+ |
---|
| 3627 | '<span style="margin-left:5px; margin-top:7px; position:absolute;">'+name+'</span>'+ |
---|
| 3628 | '<a title="Próxima" onclick="javascript:$.fancybox.next();" style="float:right;">' + |
---|
| 3629 | '<img src="./templates/'+template+'/images/right_arrow_white.png" width="30" height="30" />' + |
---|
| 3630 | '</a>' + |
---|
| 3631 | '</div>' + |
---|
| 3632 | '</div>'; |
---|
| 3633 | } |
---|
[4493] | 3634 | }); |
---|
| 3635 | }); |
---|
[5967] | 3636 | } |
---|
| 3637 | if ( is_webkit ){ //Corrige o bug de foco no Chrome |
---|
[5370] | 3638 | var ev = document.createEvent('MouseEvents'); |
---|
| 3639 | ev.initEvent( |
---|
| 3640 | 'click' |
---|
| 3641 | ,false |
---|
| 3642 | ,true |
---|
| 3643 | ); |
---|
| 3644 | var divScroll = Element('div_message_scroll_'+ID); |
---|
| 3645 | if (divScroll) { |
---|
| 3646 | divScroll.setAttribute('tabindex','-1'); |
---|
| 3647 | divScroll.onclick = function() {setTimeout(function(){$("#div_message_scroll_"+ID).focus();},0);}; |
---|
| 3648 | divScroll.dispatchEvent(ev); |
---|
| 3649 | } |
---|
| 3650 | } |
---|
[5967] | 3651 | else $("#div_message_scroll_"+ID).focus(); |
---|
| 3652 | update_labeleds_msg(); |
---|
[6463] | 3653 | |
---|
[5967] | 3654 | resizeWindow(); |
---|
[6463] | 3655 | |
---|
| 3656 | $("#div_message_scroll_"+ID).scrollTo( 0, 400, {queue:true} ); |
---|
[4820] | 3657 | } |
---|
[4493] | 3658 | |
---|
[3035] | 3659 | function changeLinkState(el,state){ |
---|
| 3660 | el.innerHTML = get_lang(state); |
---|
| 3661 | switch (state){ |
---|
| 3662 | case 'important': |
---|
| 3663 | { |
---|
[4826] | 3664 | 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] | 3665 | break; |
---|
| 3666 | } |
---|
| 3667 | case 'normal': |
---|
| 3668 | { |
---|
[4072] | 3669 | el.onclick = function(){ |
---|
[3806] | 3670 | var _this = this; |
---|
| 3671 | proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'unflagged', function(success){ |
---|
| 3672 | if (success) { |
---|
| 3673 | changeLinkState(_this, 'important'); |
---|
| 3674 | write_msg(get_lang('Message marked as ') + get_lang("Normal")); |
---|
| 3675 | } |
---|
| 3676 | } ); |
---|
| 3677 | } |
---|
[3035] | 3678 | break; |
---|
| 3679 | } |
---|
| 3680 | case 'unseen': |
---|
| 3681 | { |
---|
[4826] | 3682 | 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] | 3683 | break; |
---|
[790] | 3684 | |
---|
[3035] | 3685 | } |
---|
| 3686 | case 'seen': |
---|
| 3687 | { |
---|
[4826] | 3688 | 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] | 3689 | break; |
---|
[3021] | 3690 | |
---|
[3035] | 3691 | } |
---|
| 3692 | default: |
---|
| 3693 | { |
---|
| 3694 | break; |
---|
| 3695 | } |
---|
| 3696 | } |
---|
| 3697 | } |
---|
[4493] | 3698 | |
---|
[5911] | 3699 | function mySplit( val ) { |
---|
| 3700 | return val.split( /,\s*/ ); |
---|
| 3701 | } |
---|
| 3702 | |
---|
| 3703 | function extractLast( term ) { |
---|
| 3704 | return mySplit( term ).pop(); |
---|
| 3705 | } |
---|
[6109] | 3706 | |
---|
[6528] | 3707 | //DESENHO DAS CAIXA DE EMAIL |
---|
[6592] | 3708 | function draw_email_box(input_data, location, personal, shared){ |
---|
[6528] | 3709 | if($.trim(input_data) != ""){ |
---|
| 3710 | var box_data = valid_emails(input_data); |
---|
| 3711 | DataLayer.render("../prototype/modules/mail/templates/emailBox.ejs", box_data, function(html){ |
---|
| 3712 | var newBox = location.before(html).prev(); |
---|
| 3713 | box_actions(newBox); |
---|
| 3714 | if((preferences.expressoMail_ldap_identifier_recipient || personal)&& $(newBox).hasClass("invalid-email-box")){ |
---|
| 3715 | //$(newBox).find(".loading").css("background-image", "../prototype/modules/mail/img/ajax-loader.gif"); |
---|
[6592] | 3716 | show_detais(newBox, input_data, personal, shared); |
---|
[6528] | 3717 | }else{ |
---|
| 3718 | $(newBox).find(".box-loading").remove(); |
---|
| 3719 | } |
---|
| 3720 | }); |
---|
[6109] | 3721 | } |
---|
[6528] | 3722 | } |
---|
| 3723 | |
---|
| 3724 | function valid_emails(email){ |
---|
| 3725 | var ContactBox = {name:"", email:"", valid : false}; |
---|
| 3726 | var reSimpleEmail = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[_a-z0-9-]+(\.[_a-z0-9-]+)+$/; |
---|
| 3727 | var reComplexEmail = /<([^<]*)>[\s]*$/; |
---|
| 3728 | var validation = email.split('"'); |
---|
| 3729 | |
---|
| 3730 | //FUNÇÃO QUE VALIDA OS DADOS QUANDO O EMAIL É DIGITADO COM ("NOME SOBRENOME" <Email@dominio.com>) |
---|
| 3731 | var complexValidation = function(complexMail){ |
---|
| 3732 | var Objct = {}; |
---|
| 3733 | if($.trim(complexMail[1]).match(reComplexEmail)){ |
---|
| 3734 | if($.trim(complexMail[1]).match(reComplexEmail).length){ |
---|
| 3735 | Objct['email'] = $.trim(complexMail[1]).match(reComplexEmail)[1]; |
---|
| 3736 | } |
---|
| 3737 | }else{ |
---|
| 3738 | Objct['email'] = $.trim(complexMail[1]); |
---|
[6109] | 3739 | } |
---|
[6528] | 3740 | Objct['name'] = complexMail[0]; |
---|
| 3741 | Objct['valid'] = reSimpleEmail.test(Objct['email'].toLowerCase()); |
---|
| 3742 | return Objct; |
---|
| 3743 | } |
---|
| 3744 | switch (validation.length) { |
---|
| 3745 | //PEGA TODO O CONTEUDO E SETA COMO SE FOSSE O EMAIL |
---|
| 3746 | case 1: |
---|
| 3747 | validation.unshift(""); |
---|
| 3748 | ContactBox = complexValidation(validation); |
---|
| 3749 | break; |
---|
| 3750 | //CORRIGI ERRO DE DIGITAÇÃO COMO ( huahua"<huhau@hauhau.com>) ou (hahahaha"huahua@email.com) ou ainda (hahahaha"huahua@ema il.com) |
---|
| 3751 | case 2: |
---|
| 3752 | ContactBox = complexValidation(validation); |
---|
| 3753 | break; |
---|
| 3754 | //RECEBE O EMAIL CORRETAMENTE SÓ VALIDA POSSIVEIS ERROS COMO O DE CIMA E OS CORRIGI CASO ACONTEÇAM |
---|
| 3755 | case 3: |
---|
| 3756 | //RETIRA O PRIMEIRO INDICE QUE FICOU "INUTIL" |
---|
| 3757 | validation.shift(); |
---|
| 3758 | ContactBox = complexValidation(validation); |
---|
| 3759 | break; |
---|
| 3760 | //SE EXISTIREM MAIS DO QUE 2 (") |
---|
| 3761 | default: |
---|
| 3762 | if($.trim(validation[validation.length-1]).match(reComplexEmail)){ |
---|
| 3763 | if($.trim(validation[validation.length-1]).match(reComplexEmail).length){ |
---|
| 3764 | ContactBox.mail = $.trim(validation[validation.length-1]).match(reComplexEmail)[1]; |
---|
| 3765 | } |
---|
| 3766 | }else{ |
---|
| 3767 | ContactBox.mail = $.trim(complexMail[1]); |
---|
| 3768 | } |
---|
| 3769 | ContactBox.valid = reSimpleEmail.test(ContactBox.mail.toLowerCase()); |
---|
| 3770 | } |
---|
| 3771 | return ContactBox; |
---|
| 3772 | } |
---|
| 3773 | |
---|
| 3774 | //EVENTO DOS INPUTS PARA - CC - CCO |
---|
| 3775 | function input_keydowns(input, ID){ |
---|
| 3776 | var f9 = false; |
---|
| 3777 | input.keydown(function(e){ |
---|
| 3778 | f9 = false; |
---|
[6667] | 3779 | focusIn = input; |
---|
[6528] | 3780 | var focusing = input.parent().find(".email-text"); |
---|
| 3781 | //SE OS CONTATOS DINAMICOS ESTAO ATIVOS |
---|
| 3782 | if(parseInt(preferences.use_dynamic_contacts) && !input.hasClass("box-input")){ |
---|
| 3783 | //SELECIONA O CONTATO E EVITA OUTROS COMANDOS |
---|
| 3784 | if ( e.keyCode === $.ui.keyCode.TAB && $( this ).data( "catcomplete" ).menu.active ) { |
---|
| 3785 | e.preventDefault(); |
---|
| 3786 | return false; |
---|
| 3787 | } |
---|
| 3788 | |
---|
| 3789 | //FECHA OS CONTATOS DINÂMICOS |
---|
| 3790 | if( (e.keyCode == 27) && $( this ).data( "catcomplete" ).menu.active ){ |
---|
| 3791 | e.stopPropagation(); |
---|
| 3792 | e.preventDefault(); |
---|
| 3793 | } |
---|
| 3794 | |
---|
| 3795 | //SELECIONA O CONTATO E EVITA OUTROS COMANDOS |
---|
| 3796 | if(e.keyCode == $.ui.keyCode.ENTER && $( this ).data( "catcomplete" ).menu.active){ |
---|
| 3797 | e.preventDefault(); |
---|
| 3798 | return false; |
---|
| 3799 | } |
---|
| 3800 | |
---|
| 3801 | if(e.keyCode == $.ui.keyCode.DELETE && $( this ).data( "catcomplete" ).menu.active){ |
---|
| 3802 | if($($( this ).data( "catcomplete" ).menu.element).find(".ui-state-hover").parents("li:first").hasClass("dynamic-recent")) |
---|
| 3803 | $($( this ).data( "catcomplete" ).menu.element).find(".ui-state-hover").next().trigger("click"); |
---|
| 3804 | return false; |
---|
| 3805 | } |
---|
| 3806 | } |
---|
| 3807 | //BUSCA COM A TECLA F9 |
---|
| 3808 | if((e.keyCode) == 120){ |
---|
| 3809 | f9 = true; |
---|
[6109] | 3810 | emQuickSearch($(this).val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true); |
---|
[6528] | 3811 | e.preventDefault(); |
---|
| 3812 | return false; |
---|
[6109] | 3813 | } |
---|
[6528] | 3814 | |
---|
| 3815 | //AO DIGITAR ENTER, ";", "," " " |
---|
| 3816 | if(e.keyCode == 13 || e.keyCode == 9 || (e.keyCode == 188 && !e.shiftKey) || (e.keyCode == 191 && !e.shiftKey) ){ |
---|
| 3817 | if(e.keyCode == 13){ |
---|
| 3818 | e.preventDefault(); |
---|
| 3819 | } |
---|
| 3820 | if(input.val() != ""){ |
---|
| 3821 | if(e.keyCode != 9) |
---|
| 3822 | e.preventDefault(); |
---|
| 3823 | draw_email_box(input.val(), input); |
---|
| 3824 | if(input.hasClass("box-input")){ |
---|
| 3825 | input.remove(); |
---|
| 3826 | focusing.focus(); |
---|
| 3827 | return; |
---|
| 3828 | } |
---|
| 3829 | } |
---|
| 3830 | if(input.length) |
---|
| 3831 | input.val(""); |
---|
| 3832 | } |
---|
| 3833 | if((e.keyCode == 8 || e.keyCode == 37) && input.val() == "" && input.prev().hasClass("box")){ |
---|
| 3834 | e.preventDefault(); |
---|
| 3835 | input.prev().focus(); |
---|
[6109] | 3836 | return; |
---|
| 3837 | } |
---|
[6528] | 3838 | //AO DIGITAR " " |
---|
| 3839 | if(e.keyCode == 32){ |
---|
| 3840 | if(!input.val().length){ |
---|
| 3841 | e.preventDefault(); |
---|
| 3842 | return; |
---|
| 3843 | }else{ |
---|
| 3844 | var texto = input.val(); |
---|
| 3845 | texto = texto.substring(0, getPosition(input[0])); |
---|
| 3846 | if(texto.split('"').length-1 == 0){ |
---|
| 3847 | if(input.val().split('"').length-1 == 0){ |
---|
| 3848 | e.preventDefault(); |
---|
| 3849 | e.stopPropagation(); |
---|
| 3850 | draw_email_box(input.val(), input); |
---|
| 3851 | input.val(""); |
---|
| 3852 | if(input.hasClass("box-input")){ |
---|
| 3853 | input.remove(); |
---|
| 3854 | focusing.focus(); |
---|
| 3855 | return; |
---|
| 3856 | } |
---|
| 3857 | return; |
---|
| 3858 | } |
---|
| 3859 | } |
---|
| 3860 | } |
---|
| 3861 | } |
---|
| 3862 | //AO DIGITAR ">" |
---|
| 3863 | if(e.keyCode == 190 && e.shiftKey && input.val().length == getPosition(input[0])){ |
---|
| 3864 | input.val(input.val()+">"); |
---|
| 3865 | draw_email_box(input.val(), input); |
---|
| 3866 | e.preventDefault(); |
---|
| 3867 | input.val(""); |
---|
| 3868 | if(input.hasClass("box-input")){ |
---|
| 3869 | input.remove(); |
---|
| 3870 | focusing.focus(); |
---|
| 3871 | return; |
---|
| 3872 | } |
---|
| 3873 | } |
---|
[6547] | 3874 | setTimeout(function(){ |
---|
| 3875 | if(input.val()[input.val().length-1] == ";"){ |
---|
| 3876 | draw_email_box(input.val().substring(0, input.val().length-1), input); |
---|
| 3877 | input.val(""); |
---|
| 3878 | } |
---|
| 3879 | }, 100); |
---|
[6528] | 3880 | //INPUT AUTO RESIZE |
---|
| 3881 | setTimeout(function(){ |
---|
[6562] | 3882 | input_search = $(input).val(); |
---|
[6654] | 3883 | var char = input.val().charAt(input.val().length-1); |
---|
| 3884 | var maiusculas = RegExp("[A-Z]"); |
---|
| 3885 | /*Se o ultimo caracter for ">" é porque o campo está sendo editado (a partir de duplo clique)*/ |
---|
| 3886 | var tamanho = 0; |
---|
| 3887 | if(char == ">"){ |
---|
| 3888 | /*Faz um calculo prévio do tamanho do campo de acordo com o tamanho de cada caracter da string*/ |
---|
| 3889 | for(i=0; i<input.val().length; i++){ |
---|
| 3890 | /*Se o caracter for maiúsculo, o valor de pixel é maior*/ |
---|
| 3891 | if(maiusculas.test(input.val().substr(i, 1)) == true){ |
---|
| 3892 | tamanho += 9; |
---|
| 3893 | } |
---|
| 3894 | else{ |
---|
| 3895 | tamanho += 7.1; |
---|
| 3896 | } |
---|
| 3897 | } |
---|
| 3898 | input.css("width", tamanho); |
---|
| 3899 | } |
---|
| 3900 | /*Ao inserir novo contato, não existe a necessidade de calcular tamanho do campo*/ |
---|
| 3901 | else{ |
---|
| 3902 | input.css("width", 15+(input.val().length * 9)); |
---|
| 3903 | } |
---|
[6528] | 3904 | input.parent().scrollTo(":last"); |
---|
| 3905 | }, 100); |
---|
| 3906 | }) |
---|
| 3907 | //AO SAIR DO FOCO MONTAGEM DA CAIXA DE EMAIL |
---|
[6562] | 3908 | .focusout(function(e){ |
---|
| 3909 | var these = $(this); |
---|
[6663] | 3910 | |
---|
| 3911 | // Função para monstar a caixinha de e-mail. |
---|
| 3912 | function makeBoxMail(){ |
---|
[6670] | 3913 | if(canMakeBox && !fastSearch){ |
---|
[6663] | 3914 | if(!( f9 || click || $(this).parents("tr:first").find("button").hasClass("ui-state-active") )){ |
---|
| 3915 | if($(input).val() != "") |
---|
| 3916 | draw_email_box(input.val(), input); |
---|
| 3917 | if(input.hasClass("box-input")) |
---|
| 3918 | input.remove(); |
---|
| 3919 | $(input).val(""); |
---|
| 3920 | input_search = ""; |
---|
| 3921 | } |
---|
| 3922 | f9 = false; |
---|
| 3923 | click = false; |
---|
[6528] | 3924 | } |
---|
[6670] | 3925 | canMakeBox = true; |
---|
| 3926 | fastSearch = false; |
---|
[6528] | 3927 | } |
---|
[6663] | 3928 | |
---|
| 3929 | /* |
---|
| 3930 | ** Verifica se o dynamic contact esta aberto ou fechado, caso esteja aberto, |
---|
| 3931 | ** demora 250 millisegundos para executar a função makeBoxMail. |
---|
| 3932 | */ |
---|
| 3933 | these.data('is_open') ? setTimeout(makeBoxMail,250) : makeBoxMail(); |
---|
[6528] | 3934 | }) |
---|
| 3935 | //AO COLAR UM TEXTO NO CAMPO |
---|
| 3936 | .bind("paste", function(e){ |
---|
| 3937 | $(this).trigger("keydown"); |
---|
| 3938 | var pthis = $(this); |
---|
| 3939 | setTimeout(function() { |
---|
| 3940 | var str = pthis.val().replace(/[,;\t\n]/gi, ","); |
---|
| 3941 | str = str.split(","); |
---|
| 3942 | $.each(str, function(index, value){ |
---|
| 3943 | draw_email_box(value, pthis); |
---|
| 3944 | }); |
---|
| 3945 | pthis.val(""); |
---|
| 3946 | }, 50); |
---|
[6109] | 3947 | }); |
---|
[6528] | 3948 | //SE FOR EDIÇÃO DE EMAILS RECALCULA O INPUT E SETA O FOCO |
---|
| 3949 | if(input.hasClass("box-input")){ |
---|
| 3950 | input.trigger("keydown"); |
---|
| 3951 | input.focus(); |
---|
| 3952 | } |
---|
[6109] | 3953 | } |
---|
[6528] | 3954 | var input_search = ""; |
---|
[6562] | 3955 | var click = false; |
---|
[6528] | 3956 | //EVENTOS DA CAIXA |
---|
| 3957 | function box_actions(box){ |
---|
| 3958 | //AO PRESSIONAR UMA TECLA COM A CAIXA SELECIONADA |
---|
| 3959 | box.keydown(function(e){ |
---|
| 3960 | switch (e.keyCode) { |
---|
| 3961 | case $.ui.keyCode.LEFT: |
---|
| 3962 | //VERIFICA SE EXISTE ALGUMA CAIXA A ESQUERDA |
---|
| 3963 | if($(this).prev().hasClass("box")) |
---|
| 3964 | $(this).removeClass("box-selected").prev().focus(); |
---|
| 3965 | break; |
---|
| 3966 | case $.ui.keyCode.RIGHT: |
---|
| 3967 | //VERIFICA SE EXISTE ALGUMA CAIXA A DIREITA |
---|
| 3968 | if($(this).next().hasClass("box")) |
---|
| 3969 | $(this).removeClass("box-selected").next().focus(); |
---|
| 3970 | //SENAO FOCO O INPUT DO EMAIL |
---|
| 3971 | else |
---|
| 3972 | $(this).removeClass("box-selected").next().focus(); |
---|
| 3973 | break; |
---|
| 3974 | case $.ui.keyCode.HOME: |
---|
| 3975 | //SELECIONO A PRIMEIRA CAIXA |
---|
| 3976 | e.preventDefault(); |
---|
| 3977 | $(this).parents(".email-area").find("div:first").focus(); |
---|
| 3978 | break; |
---|
| 3979 | case $.ui.keyCode.END: |
---|
| 3980 | //SELECIONO A ULTIMA CAIXA |
---|
| 3981 | e.preventDefault(); |
---|
| 3982 | $(this).parents(".email-area").find("div:last").focus(); |
---|
| 3983 | break; |
---|
| 3984 | case $.ui.keyCode.DELETE: |
---|
| 3985 | //VERIFICA SE EXISTE ALGUMA CAIXA A DIREITA |
---|
| 3986 | if($(this).next().hasClass("box")) |
---|
| 3987 | $(this).next().focus(); |
---|
| 3988 | //SENAO FOCO O INPUT DO EMAIL |
---|
| 3989 | else |
---|
| 3990 | $(this).next().focus(); |
---|
| 3991 | //REMOVO ESTA CAIXA |
---|
| 3992 | $(this).remove(); |
---|
| 3993 | break; |
---|
| 3994 | case $.ui.keyCode.BACKSPACE: |
---|
| 3995 | //VERIFICA SE EXISTE ALGUMA CAIXA A ESQUERDA |
---|
| 3996 | if($(this).prev().hasClass("box")) |
---|
| 3997 | $(this).removeClass("box-selected").prev().focus(); |
---|
| 3998 | //SENAO HOUVER VERIFICA SE EXISTE ALGUMA CAIXA A DIREITA |
---|
| 3999 | else if($(this).next().hasClass("box")) |
---|
| 4000 | $(this).next().focus(); |
---|
| 4001 | //SENAO HOUVER NEM A DIREITA NEM A ESQUERDA SETO O FOCO NO INPUT DO EMAIL |
---|
| 4002 | else |
---|
| 4003 | $(this).next().focus(); |
---|
| 4004 | //REMOVO ESTA CAIXA |
---|
| 4005 | $(this).remove(); |
---|
| 4006 | e.preventDefault(); |
---|
| 4007 | break; |
---|
| 4008 | case $.ui.keyCode.ENTER: |
---|
| 4009 | e.preventDefault(); |
---|
| 4010 | $(this).trigger("dblclick"); |
---|
| 4011 | break; |
---|
| 4012 | } |
---|
| 4013 | }) |
---|
| 4014 | //AO FAZER UM DUPLO CLICK NA CAIXA |
---|
| 4015 | .dblclick(function(e){ |
---|
| 4016 | var input = $(this).find("input").clone(); |
---|
| 4017 | input.css("display" , "inline-block"); |
---|
| 4018 | $(this).before(input); |
---|
| 4019 | input_keydowns(input, currentTab); |
---|
| 4020 | $(this).remove(); |
---|
| 4021 | //CLICK SIMPLES NA CAIXA |
---|
| 4022 | }).click(function(){ |
---|
| 4023 | $(this).focus(); |
---|
| 4024 | //AO DAR O FOCO NA CAIXA |
---|
| 4025 | }).focus(function(){ |
---|
| 4026 | $(this).parent().find("div").removeClass("box-selected"); |
---|
| 4027 | $(this).addClass("box-selected"); |
---|
| 4028 | }).focusout(function(){ |
---|
| 4029 | $(this).removeClass("box-selected"); |
---|
| 4030 | }).draggable({ |
---|
| 4031 | revert: 'invalid', |
---|
| 4032 | helper : 'clone', |
---|
| 4033 | stack: "body", |
---|
| 4034 | containment : ".new-msg-head-data", |
---|
| 4035 | start: function(e, ui){ |
---|
| 4036 | $(this).parent().droppable( "disable" ); |
---|
| 4037 | }, |
---|
| 4038 | stop : function(e, ui){ |
---|
| 4039 | $(this).parent().droppable( "enable" ); |
---|
| 4040 | } |
---|
| 4041 | }); |
---|
| 4042 | } |
---|
| 4043 | |
---|
| 4044 | //MOSTRA OS DETALHES DAS CAIXA DE EMAIL NOS CAMPOS PARA - CC - CCO |
---|
[6592] | 4045 | function show_detais(box, value, personal, shared){ |
---|
[6528] | 4046 | var ldap_id = preferences.expressoMail_ldap_identifier_recipient; |
---|
| 4047 | var group = (personal != undefined ? (personal == "G" ? true : false) : false); |
---|
[6592] | 4048 | shared = shared ? shared : false; |
---|
[6528] | 4049 | if(group){ |
---|
[6592] | 4050 | REST.get("/"+ (shared ? "shared" : "") +"group/"+value, {}, function(data){ |
---|
[6528] | 4051 | if(!data.error){ |
---|
| 4052 | if(data.collection.error) |
---|
| 4053 | box.find(".box-loading").remove(); |
---|
| 4054 | else{ |
---|
| 4055 | box.find(".box-loading").removeClass("box-loading").addClass("box-info"); |
---|
| 4056 | box.addClass("box-"+value).removeClass("invalid-email-box"); |
---|
| 4057 | loadGroupBox(data.collection, ".box-"+value); |
---|
| 4058 | box.unbind("dblclick").bind("dblclick", function(e){ |
---|
[6531] | 4059 | new $.Zebra_Dialog(get_lang("Impossible editing this contact, but it's possible to remove it"), { |
---|
[6528] | 4060 | 'buttons': false, |
---|
| 4061 | 'modal': false, |
---|
| 4062 | 'position': ['right - 20', 'top + 20'], |
---|
| 4063 | 'auto_close': 3000 |
---|
| 4064 | }); |
---|
| 4065 | }).find(".box-input").val("\""+data.collection.data[1].value+"\" <"+data.collection.data[1].value+">"); |
---|
| 4066 | 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)) |
---|
| 4067 | } |
---|
| 4068 | }else{ |
---|
| 4069 | box.find(".box-loading").remove(); |
---|
| 4070 | } |
---|
| 4071 | }); |
---|
| 4072 | return; |
---|
| 4073 | } |
---|
| 4074 | |
---|
| 4075 | if(personal){ |
---|
[6592] | 4076 | REST.get("/"+ (shared ? "shared" : "") +"contact/"+value, {}, function(data){ |
---|
[6528] | 4077 | if(!data.error){ |
---|
| 4078 | if(data.collection.error) |
---|
| 4079 | box.find(".box-loading").remove(); |
---|
| 4080 | else{ |
---|
| 4081 | box.find(".box-loading").removeClass("box-loading").addClass("box-info"); |
---|
| 4082 | box.addClass("box-"+value).removeClass("invalid-email-box"); |
---|
| 4083 | loadExtraLDAPBox(data.collection.data, ".box-"+value); |
---|
| 4084 | box.unbind("dblclick").bind("dblclick", function(e){ |
---|
[6531] | 4085 | new $.Zebra_Dialog(get_lang("Impossible editing this contact, but it's possible to remove it"), { |
---|
[6528] | 4086 | 'buttons': false, |
---|
| 4087 | 'modal': false, |
---|
| 4088 | 'position': ['right - 20', 'top + 20'], |
---|
| 4089 | 'auto_close': 3000 |
---|
| 4090 | }); |
---|
| 4091 | }).find(".box-input").val("\""+data.collection.data[0].value+"\" <"+data.collection.data[1].value+">"); |
---|
| 4092 | 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)) |
---|
| 4093 | } |
---|
| 4094 | }else{ |
---|
| 4095 | box.find(".box-loading").remove(); |
---|
| 4096 | } |
---|
| 4097 | }); |
---|
| 4098 | return; |
---|
| 4099 | } |
---|
| 4100 | |
---|
| 4101 | REST.get("/usersldap", {field : ldap_id,value: value}, function(data){ |
---|
| 4102 | if(!data.error){ |
---|
| 4103 | if(data.collection.error) |
---|
| 4104 | box.find(".box-loading").remove(); |
---|
| 4105 | else{ |
---|
| 4106 | box.find(".box-loading").removeClass("box-loading").addClass("box-info"); |
---|
| 4107 | box.addClass("box-"+value).removeClass("invalid-email-box"); |
---|
| 4108 | loadExtraLDAPBox(data.collection.itens[0].data, ".box-"+value); |
---|
| 4109 | box.unbind("dblclick").bind("dblclick", function(e){ |
---|
[6531] | 4110 | new $.Zebra_Dialog(get_lang("Impossible editing this contact, but it's possible to remove it"), { |
---|
[6528] | 4111 | 'buttons': false, |
---|
| 4112 | 'modal': false, |
---|
| 4113 | 'position': ['right - 20', 'top + 20'], |
---|
| 4114 | 'auto_close': 3000 |
---|
| 4115 | }); |
---|
| 4116 | }).find(".box-input").val("\""+data.collection.itens[0].data[0].value+"\" <"+data.collection.itens[0].data[1].value+">"); |
---|
| 4117 | 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] | 4118 | if(data.collection.itens[0].data[3].value == "TRUE"){ |
---|
| 4119 | box.removeClass("invalid-email-box").addClass("out-office-box"); |
---|
| 4120 | } |
---|
[6528] | 4121 | } |
---|
| 4122 | }else{ |
---|
| 4123 | box.find(".box-loading").remove(); |
---|
| 4124 | } |
---|
| 4125 | }); |
---|
| 4126 | } |
---|
| 4127 | |
---|
| 4128 | //FUNÇÃO QUE "SETA" OS BINDS DOS CAMPOS PARA - CC - CCO |
---|
| 4129 | function input_binds(div, ID){ |
---|
| 4130 | |
---|
| 4131 | //AO CLICAR NA DIV SETA O FOCO NO INPUT |
---|
| 4132 | div.click(function(e){ |
---|
| 4133 | if(e.target == $(this)[0]){ |
---|
| 4134 | $(this).find("input:last").focus(); |
---|
| 4135 | $(this).find("div").removeClass("box-selected"); |
---|
| 4136 | } |
---|
| 4137 | }) |
---|
| 4138 | |
---|
| 4139 | //AO SAIR DO FOCO DA DIV ELE RETIRA TODAS AS CLASSES DE CAIXAS SELECIONADAS |
---|
| 4140 | .focusout(function(e){ |
---|
| 4141 | if(!$(e.target).parents(".email-area:first").length) |
---|
| 4142 | $(this).find("div").removeClass("box-selected"); |
---|
| 4143 | }).droppable({ |
---|
| 4144 | hoverClass: "box-draggable-hover", |
---|
| 4145 | accept : ".box", |
---|
| 4146 | drop : function(e, ui){ |
---|
| 4147 | ui.draggable.parent().droppable( "enable" ); |
---|
| 4148 | var box = ui.draggable.clone(); |
---|
| 4149 | box_actions(box); |
---|
| 4150 | if(box.find(".box-info").length){ |
---|
| 4151 | box.unbind("dblclick").bind("dblclick", function(e){ |
---|
| 4152 | new $.Zebra_Dialog('<strong>Impossivel editar</strong> um contato do ldap\n' + |
---|
| 4153 | '<strong>Porém</strong>é possivel remove-lo', { |
---|
| 4154 | 'buttons': false, |
---|
| 4155 | 'modal': false, |
---|
| 4156 | 'position': ['right - 20', 'top + 20'], |
---|
| 4157 | 'auto_close': 3000 |
---|
| 4158 | }); |
---|
| 4159 | }); |
---|
| 4160 | } |
---|
| 4161 | $(this).prepend(box); |
---|
| 4162 | ui.draggable.remove(); |
---|
| 4163 | } |
---|
| 4164 | }); |
---|
| 4165 | |
---|
| 4166 | //MAKE KEYDOWN |
---|
| 4167 | input_keydowns(div.find("input"), ID); |
---|
| 4168 | |
---|
| 4169 | |
---|
| 4170 | //VERIFICA PREFERENCIA DE CONTATOS DINÂMICOS ESTA ATIVA |
---|
| 4171 | if(parseInt(preferences.use_dynamic_contacts)){ |
---|
| 4172 | //PREPARAÇÃO DA ARRAY DOS CONTATOS DINÂMICOS |
---|
| 4173 | |
---|
| 4174 | $.widget( "custom.catcomplete", $.ui.autocomplete, { |
---|
| 4175 | _renderMenu: function( ul, items ) { |
---|
| 4176 | var self = this, |
---|
| 4177 | currentType = ""; |
---|
| 4178 | $.each( items, function( index, item ) { |
---|
[6592] | 4179 | if ( item.typel != currentType) { |
---|
| 4180 | if(item.typel == "/groups" && $(ul).find(".dynamic-recent").length) |
---|
[6528] | 4181 | self._renderItem( ul, {name:"", value:"", type:"linha"} ); |
---|
[6592] | 4182 | if(item.typel == "/contacts" && ($(ul).find(".dynamic-group").length || $(ul).find(".dynamic-recent").length)) |
---|
[6528] | 4183 | self._renderItem( ul, {name:"", value:"", type:"linha"} ); |
---|
[6592] | 4184 | currentType = item.typel; |
---|
[6528] | 4185 | } |
---|
| 4186 | self._renderItem( ul, item ); |
---|
| 4187 | $(ul).find("li:last").find(".dynamic-stars").raty({ |
---|
| 4188 | readOnly : true, |
---|
| 4189 | half : true, |
---|
| 4190 | hints : ['','','','',''], |
---|
[6652] | 4191 | score : ((item.number_of_messages*5)/topContact) > 0.5 ? ((item.number_of_messages*5)/topContact) : 0.5, |
---|
[6528] | 4192 | starOn : '../../prototype/plugins/jq-raty/img/star-on.png', |
---|
| 4193 | starOff : '../../prototype/plugins/jq-raty/img/star-off.png', |
---|
| 4194 | starHalf : '../../prototype/plugins/jq-raty/img/star-half.png' |
---|
| 4195 | }); |
---|
| 4196 | }); |
---|
[6592] | 4197 | if($(ul).find("li:last").hasClass("dynamic-separator")){ |
---|
| 4198 | $(ul).find("li:last").remove(); |
---|
| 4199 | } |
---|
[6528] | 4200 | } |
---|
| 4201 | }); |
---|
| 4202 | //INSERÇÃO DO AUTO COMPLETE AO INPUT |
---|
| 4203 | div.find("input").catcomplete({ |
---|
| 4204 | minLength: 1, |
---|
| 4205 | source: function(request, response){ |
---|
[6592] | 4206 | if ( request.term in cache ) { |
---|
| 4207 | response( cache[ request.term ] ); |
---|
| 4208 | return; |
---|
| 4209 | } |
---|
[6678] | 4210 | dynamicContactsList = new Array(); |
---|
[6592] | 4211 | REST.get("/usercontacts", false, function(data){ |
---|
| 4212 | dynamicData = data.collection.itens; |
---|
| 4213 | if(dynamicData){ |
---|
| 4214 | $.each(dynamicData, function(index, value){ |
---|
| 4215 | dynamic = {}; |
---|
| 4216 | $.each(value.data, function(index, value){ |
---|
| 4217 | dynamic[value.name] = value.value; |
---|
| 4218 | }); |
---|
| 4219 | dynamic['value'] = (dynamic.name ? dynamic.name +' - ': '') + dynamic.mail; |
---|
| 4220 | dynamic['type'] = value.dataType; |
---|
| 4221 | dynamic['typel'] = (value.dataType.substring(0,7) == "/shared" ? "/"+value.dataType.substring(7,value.dataType.length)+"s" : value.dataType) ; |
---|
[6678] | 4222 | dynamicContactsList.push(dynamic); |
---|
[6592] | 4223 | }); |
---|
| 4224 | } |
---|
[6678] | 4225 | var data = $.ui.autocomplete.filter(dynamicContactsList, request.term ); |
---|
[6592] | 4226 | cache[ request.term ] = data; |
---|
| 4227 | response( data ); |
---|
| 4228 | }); |
---|
[6528] | 4229 | }, |
---|
| 4230 | focus: function() { |
---|
| 4231 | return false; |
---|
| 4232 | }, |
---|
| 4233 | |
---|
| 4234 | //EVENTO AO SELECIONAR UM CONTATO DINÂMICO |
---|
| 4235 | select: function( event, ui ) { |
---|
[6667] | 4236 | canMakeBox = false; |
---|
[6528] | 4237 | event.preventDefault(); |
---|
| 4238 | $(this).val(""); |
---|
[6592] | 4239 | if(ui.item.typel == "/contacts") |
---|
| 4240 | draw_email_box(""+ui.item.id, $(this), true, (ui.item.type.substring(0,7) == "/shared" ? true : false)); |
---|
| 4241 | else if(ui.item.typel == "/groups") |
---|
| 4242 | draw_email_box(""+ui.item.id, $(this), "G", (ui.item.type.substring(0,7) == "/shared" ? true : false)); |
---|
[6528] | 4243 | else |
---|
[6592] | 4244 | draw_email_box(ui.item.name ? "\""+ui.item.name+"\" <"+ui.item.mail+">" : ui.item.mail, $(this)); |
---|
[6528] | 4245 | return false; |
---|
| 4246 | }, |
---|
| 4247 | autoFocus: true, |
---|
| 4248 | position : { my: "left top", at: "left bottom", collision: "fit" } |
---|
| 4249 | }).bind('catcompleteopen', function(event, ui) { |
---|
| 4250 | $(this).data('is_open',true); |
---|
| 4251 | }).bind('catcompleteclose', function(event, ui) { |
---|
[6667] | 4252 | canMakeBox = true; |
---|
[6528] | 4253 | $(this).data('is_open',false); |
---|
| 4254 | }) |
---|
[5911] | 4255 | |
---|
[6528] | 4256 | //MONTAGEM DA LISTA DE CONTATOS DINÂMICOS DO AUTO COMPLETE |
---|
| 4257 | .data( "catcomplete" )._renderItem = function( ul, item ) { |
---|
[6592] | 4258 | if($(ul).find("li").length < 50){ |
---|
| 4259 | var autocomplete = $(this)[0].element; |
---|
[6648] | 4260 | //cálculo dinâmico da largura da lista |
---|
| 4261 | var width = (item.label ? item.label.length : (item.value ? item.value.length : (item.email ? item.email.length : 20 ))); |
---|
| 4262 | width = width*5 + (is_ie ? 170 : 200) + 16; |
---|
| 4263 | if (width < $(ul).width()) |
---|
| 4264 | width = $(ul).width(); |
---|
| 4265 | ul.css({"min-width":width,"max-height" : "180px", "overflow-y" : "auto", "min-height": "30px"}); |
---|
[6592] | 4266 | var listContacts = DataLayer.render("../prototype/modules/mail/templates/listContacts.ejs", item); |
---|
| 4267 | return $(listContacts).data( "item.autocomplete", item ).appendTo( ul ).find("span:last").button({ |
---|
| 4268 | icons : { |
---|
| 4269 | primary : "ui-icon-close" |
---|
| 4270 | }, |
---|
| 4271 | text: false |
---|
| 4272 | }).click(function(event){ |
---|
| 4273 | var removeLi = $(this).parents("li:first"); |
---|
| 4274 | if(!event.keyCode) |
---|
| 4275 | autocomplete.catcomplete( "close" ); |
---|
[6667] | 4276 | canMakeBox = false; |
---|
[6614] | 4277 | $.Zebra_Dialog('Deseja remover <b>'+(item.name ? item.name+" - " : "")+ item.mail+'</b>?', { |
---|
[6592] | 4278 | 'type': 'question', |
---|
| 4279 | 'custom_class': (is_ie ? 'configure-zebra-dialog' : ''), |
---|
| 4280 | 'title': 'Atenção', |
---|
| 4281 | 'buttons': ['Sim','Não'], |
---|
| 4282 | 'overlay_opacity': '0.5', |
---|
| 4283 | 'onClose': function(caption) { |
---|
| 4284 | if(caption == 'Sim'){ |
---|
| 4285 | $(removeLi).remove(); |
---|
| 4286 | REST.delete("/dynamiccontact/"+item.id); |
---|
| 4287 | updateDynamicContact(); |
---|
| 4288 | cache = new Array(); |
---|
[6667] | 4289 | }else if(caption == 'Não'){ |
---|
| 4290 | $(focusIn).focus(); |
---|
[6592] | 4291 | } |
---|
[6528] | 4292 | } |
---|
[6592] | 4293 | }); |
---|
[6528] | 4294 | }); |
---|
[6592] | 4295 | } |
---|
| 4296 | return; |
---|
[6528] | 4297 | }; |
---|
| 4298 | } |
---|
| 4299 | |
---|
| 4300 | //FUNÇÃO DOS BOTÕES PARA - CC - CCO |
---|
| 4301 | div.parents("tr:first").find("button").button().click(function(){ |
---|
[6562] | 4302 | click = true; |
---|
[6670] | 4303 | fastSearch = true; |
---|
[6528] | 4304 | if(!$(":focus").hasClass("new-message-input")) |
---|
| 4305 | 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); |
---|
| 4306 | }); |
---|
| 4307 | } |
---|
| 4308 | |
---|
[271] | 4309 | function draw_new_message(border_ID){ |
---|
[3105] | 4310 | connector.loadScript("color_palette"); |
---|
| 4311 | connector.loadScript('wfolders'); |
---|
[6528] | 4312 | connector.loadScript("ccQuickAdd"); |
---|
[5911] | 4313 | |
---|
[3105] | 4314 | if(typeof(RichTextEditor) == 'undefined' || typeof(ColorPalette) == 'undefined' || typeof(wfolders) == 'undefined') |
---|
[3068] | 4315 | return false; |
---|
| 4316 | |
---|
[5911] | 4317 | if(typeof($.fn.elastic) == "undefined"){ |
---|
| 4318 | $.lazy({ |
---|
| 4319 | src: '../prototype/plugins/jquery-elastic/jquery.elastic.source.js', |
---|
| 4320 | name: 'elastic' |
---|
| 4321 | }); |
---|
| 4322 | } |
---|
[271] | 4323 | var ID = create_border("",border_ID); |
---|
[5911] | 4324 | |
---|
[4139] | 4325 | if (ID == 0) |
---|
| 4326 | return 0; |
---|
[5134] | 4327 | else if(ID == 'maximo') |
---|
| 4328 | return 'maximo'; |
---|
[5911] | 4329 | |
---|
[2] | 4330 | hold_session = true; |
---|
[3035] | 4331 | |
---|
[5911] | 4332 | if ($("#footer_menu").length){ |
---|
| 4333 | $("#footer_menu").css('display','none'); |
---|
[1701] | 4334 | } |
---|
[5911] | 4335 | var content = $("#content_id_"+ID).html(DataLayer.render("../prototype/modules/mail/templates/new_message.ejs", {id: ID})); |
---|
| 4336 | RichTextEditor.loadEditor2(ID); |
---|
[5417] | 4337 | |
---|
[5911] | 4338 | //if(!expresso_offline) |
---|
| 4339 | // draw_from_field(sel_from,tr1_1); |
---|
[5417] | 4340 | |
---|
[5911] | 4341 | //content.find('name="input_to"').elastic().elastic("destroy"); |
---|
| 4342 | draw_from_field(content.find(".from-select")[0], content.find(".from-tr")[0]); |
---|
[5417] | 4343 | |
---|
[5911] | 4344 | var check_input = function(field){ |
---|
| 4345 | var check = field.attr("checked"); |
---|
| 4346 | field.attr("checked", (!check ? true : false)); |
---|
| 4347 | return (!check ? true : false); |
---|
[5417] | 4348 | } |
---|
| 4349 | |
---|
[5911] | 4350 | //AÇÃO GENERICA PARA ADICIONAR/REMOVER |
---|
| 4351 | var change_text = function(field, text, to_text){ |
---|
| 4352 | var text = (field.html() == text ? to_text : text); |
---|
| 4353 | field.html(text); |
---|
[3035] | 4354 | } |
---|
[4832] | 4355 | |
---|
[5911] | 4356 | //AÇÃO GENERICA PARA ADICIONAR/REMOVER CC & CCO |
---|
| 4357 | var show_hide = function(field, button){ |
---|
| 4358 | button.toggleClass("expressomail-button-icon-ative"); |
---|
| 4359 | field.toggle(); |
---|
[6528] | 4360 | field.find("textarea").val("").parent().find("input").focus(); |
---|
| 4361 | field.find(".email-area div").remove(); |
---|
| 4362 | if(!field.find("textarea").hasClass("track")){ |
---|
| 4363 | field.find("textarea").css({"max-height" : "115px", "overflow-y" : "auto"}).addClass("track"); |
---|
| 4364 | input_binds(field.find(".email-area"), ID); |
---|
[4934] | 4365 | } |
---|
[5417] | 4366 | } |
---|
[4832] | 4367 | |
---|
[6547] | 4368 | 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] | 4369 | |
---|
[5911] | 4370 | //Botão TextoRico/TextoSimples |
---|
| 4371 | content.find(".new-msg-head-right-buttons").find(".button").button().filter(".rich-button").click(function(){ |
---|
[6698] | 4372 | /*Se o texto do botão for "Texto simples" exibirá a mensagem antes de alterar para texto simples*/ |
---|
| 4373 | if($(".rich-button").find("span").text() == get_lang("Simple Text")){ |
---|
| 4374 | $.Zebra_Dialog(get_lang("Convert this message into plain text can make parts of it are removed. Continue?"), { |
---|
| 4375 | 'type': 'warning', |
---|
| 4376 | 'overlay_opacity': '0.5', |
---|
| 4377 | 'buttons': ['OK','Cancelar'], |
---|
| 4378 | 'width' : 380, |
---|
| 4379 | 'onClose': function(clicked) { |
---|
| 4380 | if(clicked == 'OK'){ |
---|
| 4381 | RichTextEditor.setPlain(check_input(content.find('[name="textplain_rt_checkbox"]')), ID); |
---|
| 4382 | $(".rich-button").find("span").text(get_lang("Rich Text")); |
---|
| 4383 | } |
---|
| 4384 | } |
---|
| 4385 | }) |
---|
| 4386 | } |
---|
| 4387 | /*Se o texto do botão for "Texto rico" simplesmente altera para texto rico*/ |
---|
| 4388 | else{ |
---|
| 4389 | RichTextEditor.setPlain(check_input(content.find('[name="textplain_rt_checkbox"]')), ID); |
---|
| 4390 | $(".rich-button").find("span").text(get_lang("Simple Text")); |
---|
| 4391 | } |
---|
[5911] | 4392 | }) |
---|
[5417] | 4393 | |
---|
[5911] | 4394 | //Botão Adicionar/Remover CCO |
---|
| 4395 | .end().filter(".cco-button").click(function(){ |
---|
| 4396 | show_hide(content.find(".cco-tr"), $(this)); |
---|
| 4397 | change_text($(this).find(".ui-button-text"), get_lang("Add BCC"), get_lang('Remove CCo')); |
---|
| 4398 | }) |
---|
| 4399 | //Botão Adicionar/Remover CC |
---|
| 4400 | .end().filter(".cc-button").click(function(){ |
---|
| 4401 | show_hide(content.find(".cc-tr"), $(this)); |
---|
| 4402 | change_text($(this).find(".ui-button-text"), get_lang("Add CC"), get_lang('Remove CC')); |
---|
[5417] | 4403 | }); |
---|
| 4404 | |
---|
[5911] | 4405 | //BOTAO ENVIAR |
---|
| 4406 | content.find(".send").button({ |
---|
[5417] | 4407 | icons : { |
---|
| 4408 | primary : "expressomail-icon-send" |
---|
| 4409 | } |
---|
[5911] | 4410 | }).click(function(){ |
---|
| 4411 | send_message(ID,preferences.save_in_folder,null); |
---|
| 4412 | }) |
---|
| 4413 | //BOTAO SALVAR E ENVIAR |
---|
| 4414 | .end().find(".save-and-send").button({ |
---|
[5417] | 4415 | icons : { |
---|
[5911] | 4416 | primary : "expressomail-icon-send" |
---|
| 4417 | } |
---|
| 4418 | }).click(function(){ |
---|
| 4419 | wfolders.makeWindow(ID,"send_and_file"); |
---|
| 4420 | }) |
---|
| 4421 | //BOTAO SALVAR |
---|
| 4422 | .end().find(".save").button({ |
---|
| 4423 | icons : { |
---|
[5417] | 4424 | primary : "expressomail-icon-save" |
---|
| 4425 | } |
---|
[5911] | 4426 | }).click(function(){ |
---|
| 4427 | save_msg(ID); |
---|
| 4428 | }) |
---|
| 4429 | //BOTAO CONF. LEITURA |
---|
| 4430 | .end().find(".return-recept").button({ |
---|
[5417] | 4431 | icons : { |
---|
| 4432 | primary : "expressomail-icon-read-confirmation" |
---|
| 4433 | } |
---|
[5911] | 4434 | }).click(function(){ |
---|
| 4435 | check_input(content.find('[name="input_return_receipt"]')); |
---|
| 4436 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 4437 | }) |
---|
| 4438 | //BOTAO IMPORTANTE |
---|
| 4439 | .end().find(".important").button({ |
---|
[5417] | 4440 | icons : { |
---|
| 4441 | primary : "expressomail-icon-important" |
---|
| 4442 | } |
---|
[5911] | 4443 | }).click(function(){ |
---|
| 4444 | check_input(content.find('[name="input_important_message"]')); |
---|
| 4445 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 4446 | }) |
---|
| 4447 | //BOTAO ASS. DIGITAL |
---|
| 4448 | .end().find(".return_digital").button({ |
---|
[5417] | 4449 | icons : { |
---|
| 4450 | primary : "expressomail-icon-signature" |
---|
| 4451 | } |
---|
[5911] | 4452 | }).click(function(){ |
---|
| 4453 | check_input(content.find('[name="input_return_digital"]')); |
---|
| 4454 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 4455 | }) |
---|
| 4456 | //BOTAO EMAIL CRYPT |
---|
| 4457 | .end().find(".return_cripto").button({ |
---|
[5417] | 4458 | icons : { |
---|
| 4459 | primary : "expressomail-icon-encryption" |
---|
| 4460 | } |
---|
[5911] | 4461 | }).click(function(){ |
---|
| 4462 | check_input(content.find('[name="input_return_cripto"]')); |
---|
[5417] | 4463 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 4464 | }); |
---|
[5911] | 4465 | |
---|
| 4466 | content.find(".attachment td").filter(".value").prepend(DataLayer.render("../prototype/modules/mail/templates/attachment.ejs", {ID:ID})); |
---|
| 4467 | var fileUploadMSG = $('#fileupload_msg'+ID); |
---|
[6071] | 4468 | var maxAttachmentSize = (preferences.max_attachment_size !== "" && preferences.max_attachment_size != 0) ? (parseInt(preferences.max_attachment_size.replace('M', '')) * 1048576 ) : false; |
---|
[6107] | 4469 | |
---|
[6752] | 4470 | content.find(".new-msg-head-data").scroll(function(){ |
---|
| 4471 | $.each(fileUploadMSG.find(".attachments-list .att-box"), function(index, value){ |
---|
| 4472 | $(this).qtip("api").updatePosition(); |
---|
| 4473 | }); |
---|
| 4474 | }); |
---|
| 4475 | $("#fileupload_msg"+ID+"_droopzone").click(function(){ |
---|
| 4476 | $(this).removeClass('in hover'); |
---|
| 4477 | $(this).hide(); |
---|
| 4478 | $(this).prev().show(); |
---|
| 4479 | }); |
---|
[6174] | 4480 | fileUploadMSG.find(".button").button().filter(".fileinput-button").find(".ui-button-text").css("margin-top", "2px").find("input:file").fileupload({ |
---|
[6752] | 4481 | //singleFileUploads : true,fileUploadMSG |
---|
[6107] | 4482 | sequentialUploads: true, |
---|
[6071] | 4483 | type: 'post', |
---|
| 4484 | dataType : 'json', |
---|
| 4485 | url: "../prototype/post.php", |
---|
[6107] | 4486 | forceIframeTransport: false, |
---|
[6752] | 4487 | dropZone : $("#fileupload_msg"+ID+"_droopzone"), |
---|
[6071] | 4488 | formData: function(form) { |
---|
| 4489 | return [ |
---|
| 4490 | { |
---|
| 4491 | name : "mailAttachment[0][source]", |
---|
| 4492 | value : "files0" |
---|
| 4493 | }, |
---|
| 4494 | { |
---|
| 4495 | name : "mailAttachment[0][disposition]", |
---|
| 4496 | value : $(form[0]['attDisposition'+$(form[0]['abaID']).val()]).val() |
---|
| 4497 | }, |
---|
| 4498 | { |
---|
| 4499 | name: "MAX_FILE_SIZE", |
---|
| 4500 | value : maxAttachmentSize |
---|
| 4501 | } |
---|
| 4502 | ]; |
---|
[6107] | 4503 | }, |
---|
[5604] | 4504 | add: function (e, data) { |
---|
[6071] | 4505 | if(!maxAttachmentSize || data.files[0].size < maxAttachmentSize || is_ie) { |
---|
[5604] | 4506 | setTimeout(function() { |
---|
[6071] | 4507 | $('#attDisposition'+ID).val('attachment'); |
---|
[5604] | 4508 | data.submit(); |
---|
[6071] | 4509 | }, 3000); |
---|
[6107] | 4510 | } |
---|
[6752] | 4511 | fileUploadMSG.find(' .attachments-list').show(); |
---|
[6107] | 4512 | $.each(data.files, function (index, file) { |
---|
| 4513 | var attach = {}; |
---|
| 4514 | attach.fullFileName = file.name; |
---|
| 4515 | attach.fileName = file.name; |
---|
[6752] | 4516 | if(file.name.length > 20) |
---|
| 4517 | attach.fileName = file.name.substr(0, 17) + " ... " + file.name.substr(file.name.length-6, file.name.length); |
---|
[6107] | 4518 | attach.fileSize = formatBytes(file.size); |
---|
| 4519 | if(maxAttachmentSize && file.size > maxAttachmentSize) |
---|
[6760] | 4520 | attach.error = 'Tamanho de arquivo nao permitido' |
---|
[6752] | 4521 | else |
---|
[6760] | 4522 | attach.error = true; |
---|
[6752] | 4523 | var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); |
---|
| 4524 | upload.find('.att-box-delete').click(function(){ |
---|
[6107] | 4525 | var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); |
---|
| 4526 | fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); |
---|
[6752] | 4527 | delAttachment(ID, idAttach); |
---|
| 4528 | $(this).parent().qtip("destroy"); |
---|
[6107] | 4529 | $(this).parent().remove(); |
---|
[6752] | 4530 | if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){ |
---|
| 4531 | fileUploadMSG.find(' .attachments-list').hide(); |
---|
| 4532 | } |
---|
[6107] | 4533 | }); |
---|
[6752] | 4534 | |
---|
| 4535 | fileUploadMSG.find('.attachments-list').append(upload); |
---|
[5604] | 4536 | |
---|
[6752] | 4537 | fileUploadMSG.find('.attachments-list .att-box:last').qtip({ |
---|
| 4538 | content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), |
---|
| 4539 | position: { |
---|
| 4540 | corner: { |
---|
| 4541 | tooltip: 'bottomMiddle', |
---|
| 4542 | target: 'topMiddle' |
---|
| 4543 | }, |
---|
| 4544 | adjust: { |
---|
| 4545 | resize: true, |
---|
| 4546 | scroll: true |
---|
| 4547 | } |
---|
| 4548 | }, |
---|
| 4549 | show: { |
---|
| 4550 | when: 'mouseover', // Don't specify a show event |
---|
| 4551 | ready: false // Show the tooltip when ready |
---|
| 4552 | }, |
---|
| 4553 | hide: 'mouseout', // Don't specify a hide event |
---|
| 4554 | style: { |
---|
| 4555 | border: { |
---|
| 4556 | width: 1, |
---|
| 4557 | radius: 5 |
---|
| 4558 | }, |
---|
[6760] | 4559 | padding: 3, |
---|
| 4560 | textAlign: 'left', |
---|
[6752] | 4561 | tip: true, // Give it a speech bubble tip with automatic corner detection |
---|
[6760] | 4562 | name: (typeof(attach.error) == 'boolean' ? 'light' : 'red') // Style it according to the preset 'cream' style |
---|
[6752] | 4563 | } |
---|
| 4564 | }); |
---|
| 4565 | |
---|
[6107] | 4566 | if(!maxAttachmentSize || file.size < maxAttachmentSize){ |
---|
| 4567 | if(data.fileInput){ |
---|
| 4568 | fileUploadMSG.find('.fileinput-button.new').append(data.fileInput[0]).removeClass('new'); |
---|
| 4569 | fileUploadMSG.find('.attachments-list').find('[type=file]').addClass('hidden'); |
---|
| 4570 | } |
---|
| 4571 | }else |
---|
| 4572 | fileUploadMSG.find(' .fileinput-button.new').removeClass('new'); |
---|
[6045] | 4573 | }); |
---|
| 4574 | }, |
---|
[5604] | 4575 | done: function(e, data){ |
---|
[6760] | 4576 | var attach_box = fileUploadMSG.find('.att-box-loading:first').parents('.att-box'); |
---|
| 4577 | var attach = { |
---|
| 4578 | fullFileName : attach_box.find(".att-box-fullfilename").text(), |
---|
| 4579 | fileSize : attach_box.find(".att-box-filesize").text(), |
---|
| 4580 | OK : true, |
---|
| 4581 | error : false |
---|
| 4582 | }; |
---|
[5702] | 4583 | if(!!data.result && data.result != "[]" ){ |
---|
[6071] | 4584 | var newAttach = data.result; |
---|
[6760] | 4585 | if(!newAttach.mailAttachment.error || newAttach.rollback !== false){ |
---|
| 4586 | attach_box.append('<input type="hidden" name="fileId[]" value="'+newAttach['mailAttachment'][0][0].id+'"/>'); |
---|
| 4587 | addAttachment(ID,newAttach['mailAttachment'][0][0].id); |
---|
| 4588 | }else { |
---|
| 4589 | attach_box.addClass('invalid-email-box'); |
---|
| 4590 | attach.error = newAttach.mailAttachment.error ? newAttach.mailAttachment.error : 'Erro ao anexar...';//.append(newAttach.mailAttachment.error).addClass('message-attach-error'); |
---|
| 4591 | } |
---|
[5604] | 4592 | }else { |
---|
[6760] | 4593 | attach_box.addClass('invalid-email-box');//.qtip("api").updateContent("oi", true); |
---|
| 4594 | attach.error = 'Erro ao anexar...'; |
---|
[5604] | 4595 | } |
---|
[6760] | 4596 | attach_box.qtip("destroy").qtip({ |
---|
| 4597 | content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), |
---|
| 4598 | position: { |
---|
| 4599 | corner: { |
---|
| 4600 | tooltip: 'bottomMiddle', |
---|
| 4601 | target: 'topMiddle' |
---|
| 4602 | }, |
---|
| 4603 | adjust: { |
---|
| 4604 | resize: true, |
---|
| 4605 | scroll: true |
---|
| 4606 | } |
---|
| 4607 | }, |
---|
| 4608 | show: { |
---|
| 4609 | when: 'mouseover', // Don't specify a show event |
---|
| 4610 | ready: false // Show the tooltip when ready |
---|
| 4611 | }, |
---|
| 4612 | hide: 'mouseout', // Don't specify a hide event |
---|
| 4613 | style: { |
---|
| 4614 | border: { |
---|
| 4615 | width: 1, |
---|
| 4616 | radius: 5 |
---|
| 4617 | }, |
---|
| 4618 | padding: 3, |
---|
| 4619 | textAlign: 'left', |
---|
| 4620 | tip: true, // Give it a speech bubble tip with automatic corner detection |
---|
| 4621 | name: (attach.error == false ? 'blue' : 'red')// Style it according to the preset 'cream' style |
---|
| 4622 | } |
---|
| 4623 | }); |
---|
[6752] | 4624 | fileUploadMSG.find(' .att-box-loading:first').remove(); |
---|
[5604] | 4625 | } |
---|
[6124] | 4626 | }).css({ |
---|
| 4627 | "height" : "20px", |
---|
| 4628 | "width": (is_webkit ? "205px" : "100px"), |
---|
| 4629 | "border-width": "0 0 0px 0px", |
---|
| 4630 | "-moz-transform" : "rotate(-180deg) translate(-147px, -0.5px) scale(1.1)", |
---|
| 4631 | "-webkit-transform" : "rotate(-180deg) translate(-104px, 0px)" |
---|
[6189] | 4632 | }).end().end().end().filter(".message-attach-link").click(function(){ |
---|
[6107] | 4633 | jQuery('#message-attach-dialog').html(DataLayer.render("../prototype/modules/attach_message/attach_message.ejs", {})); |
---|
| 4634 | $( "#mailpreview_container span.ui-icon-close" ).click(); |
---|
| 4635 | jQuery('#message-attach-dialog').dialog({ |
---|
| 4636 | width:920, |
---|
| 4637 | height:550, |
---|
| 4638 | resizable:false, |
---|
| 4639 | modal: true, |
---|
| 4640 | closeOnEscape:true, |
---|
[6265] | 4641 | close:function(event, ui) {event.stopPropagation();}, |
---|
[6107] | 4642 | autoOpen:false |
---|
| 4643 | }); |
---|
| 4644 | |
---|
| 4645 | |
---|
| 4646 | jQuery.getScript("../prototype/modules/attach_message/attach_message.js", function(){ |
---|
| 4647 | jQuery('#message-attach-dialog').dialog('open'); |
---|
| 4648 | jQuery('#message-attach-attach-btn').unbind('click'); |
---|
| 4649 | jQuery('#message-attach-attach-btn').click(function(event){ |
---|
| 4650 | jQuery.each(selectedMessages, function(folder_name, messages) { |
---|
| 4651 | jQuery.each(selectedMessages[folder_name], function(message_number, message) { |
---|
| 4652 | if (message) { |
---|
[6752] | 4653 | fileUploadMSG.find(' .attachments-list').show(); |
---|
[6107] | 4654 | var att = new Object(); |
---|
| 4655 | att.folder = folder_name; |
---|
| 4656 | att.uid = message_number; |
---|
| 4657 | att.type = 'imapMSG'; |
---|
[6265] | 4658 | att.name = Base64.encode(onceOpenedMessages[folder_name][message_number].subject + '.eml'); |
---|
[6107] | 4659 | var idATT = JSON.stringify(att); |
---|
| 4660 | addAttachment( ID , idATT); |
---|
| 4661 | var attach = {}; |
---|
[6265] | 4662 | attach.fileName = onceOpenedMessages[folder_name][message_number].subject + '.eml'; |
---|
[6752] | 4663 | attach.fullFileName = onceOpenedMessages[folder_name][message_number].subject + '.eml'; |
---|
| 4664 | if(attach.fileName.length > 20) |
---|
| 4665 | attach.fileName = attach.fileName.substr(0, 17) + "... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length); |
---|
[5911] | 4666 | |
---|
[6752] | 4667 | attach.error = ""; |
---|
[6107] | 4668 | attach.fileSize = formatBytes(onceOpenedMessages[folder_name][message_number].size); |
---|
| 4669 | var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); |
---|
[6752] | 4670 | upload.find('.att-box-loading').remove(); |
---|
[6107] | 4671 | upload.append('<input type="hidden" name="fileId[]" value=\''+idATT+'\'/>'); |
---|
| 4672 | |
---|
[6752] | 4673 | upload.find('.att-box-delete').click(function(){ |
---|
| 4674 | var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); |
---|
| 4675 | fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); |
---|
| 4676 | delAttachment(ID,idAttach); |
---|
| 4677 | $(this).parent().qtip("destroy"); |
---|
| 4678 | $(this).parent().remove(); |
---|
| 4679 | if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){ |
---|
| 4680 | fileUploadMSG.find(' .attachments-list').hide(); |
---|
| 4681 | } |
---|
[6107] | 4682 | }); |
---|
| 4683 | |
---|
[6752] | 4684 | fileUploadMSG.find('.attachments-list').append(upload); |
---|
| 4685 | |
---|
| 4686 | upload.find('.att-box-loading').remove(); |
---|
| 4687 | |
---|
| 4688 | fileUploadMSG.find('.attachments-list .att-box:last').qtip({ |
---|
| 4689 | content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), |
---|
| 4690 | position: { |
---|
| 4691 | corner: { |
---|
| 4692 | tooltip: 'bottomMiddle', |
---|
| 4693 | target: 'topMiddle' |
---|
| 4694 | }, |
---|
| 4695 | adjust: { |
---|
| 4696 | resize: true, |
---|
| 4697 | scroll: true |
---|
| 4698 | } |
---|
| 4699 | }, |
---|
| 4700 | show: { |
---|
| 4701 | when: 'mouseover', // Don't specify a show event |
---|
| 4702 | ready: false // Show the tooltip when ready |
---|
| 4703 | }, |
---|
| 4704 | hide: 'mouseout', // Don't specify a hide event |
---|
| 4705 | style: { |
---|
| 4706 | border: { |
---|
| 4707 | width: 1, |
---|
| 4708 | radius: 5 |
---|
| 4709 | }, |
---|
| 4710 | padding: 5, |
---|
| 4711 | textAlign: 'center', |
---|
| 4712 | tip: true, // Give it a speech bubble tip with automatic corner detection |
---|
| 4713 | name: 'blue' // Style it according to the preset 'cream' style |
---|
| 4714 | } |
---|
| 4715 | }); |
---|
[6107] | 4716 | } |
---|
| 4717 | }); |
---|
| 4718 | }); |
---|
| 4719 | |
---|
| 4720 | jQuery('#message-attach-dialog').dialog('close'); |
---|
| 4721 | |
---|
| 4722 | }); |
---|
| 4723 | jQuery('#message-attach-cancel-btn').click(function(event){ |
---|
| 4724 | jQuery('#message-attach-dialog').dialog('close'); |
---|
| 4725 | }); |
---|
| 4726 | }); |
---|
| 4727 | }); |
---|
[6752] | 4728 | $(document).bind('drop dragover', function (e) { |
---|
| 4729 | e.preventDefault(); |
---|
| 4730 | }); |
---|
| 4731 | //DRAG and DROP DE ARQUIVOS NÃO FUNCIONA NO IE |
---|
| 4732 | if(!is_ie){ |
---|
| 4733 | $("body").bind('dragenter', function (e) { |
---|
| 4734 | var dropZone = $("#fileupload_msg"+ID+"_droopzone"); |
---|
| 4735 | var timeout = window.dropZoneTimeout; |
---|
| 4736 | dropZone.show(); |
---|
| 4737 | dropZone.prev().hide(); |
---|
| 4738 | if (!timeout) { |
---|
| 4739 | dropZone.addClass('in'); |
---|
| 4740 | } else { |
---|
| 4741 | clearTimeout(timeout); |
---|
| 4742 | } |
---|
| 4743 | if (e.target === dropZone[0]) { |
---|
| 4744 | dropZone.addClass('hover'); |
---|
| 4745 | } else { |
---|
| 4746 | dropZone.removeClass('hover'); |
---|
| 4747 | } |
---|
| 4748 | $(window).unbind('dragleave'); |
---|
| 4749 | window.dropZoneTimeout = setTimeout(function () { |
---|
| 4750 | $(window).bind('dragleave', function (e) { |
---|
| 4751 | window.dropZoneTimeout = null; |
---|
| 4752 | dropZone.removeClass('in hover'); |
---|
| 4753 | dropZone.hide(); |
---|
| 4754 | dropZone.prev().show(); |
---|
| 4755 | }); |
---|
| 4756 | }, 1); |
---|
| 4757 | }).bind('dragleave', function (e) { |
---|
| 4758 | var dropZone = $("#fileupload_msg"+ID+"_droopzone"); |
---|
| 4759 | window.dropZoneTimeout = setTimeout(function () { |
---|
| 4760 | $(window).bind('dragleave', function (e) { |
---|
| 4761 | window.dropZoneTimeout = null; |
---|
| 4762 | dropZone.removeClass('in hover'); |
---|
| 4763 | dropZone.hide(); |
---|
| 4764 | dropZone.prev().show(); |
---|
| 4765 | }); |
---|
| 4766 | }, 1); |
---|
| 4767 | }).bind('drop', function(e){ |
---|
| 4768 | var dropZone = $("#fileupload_msg"+ID+"_droopzone"); |
---|
| 4769 | window.dropZoneTimeout = null; |
---|
| 4770 | dropZone.removeClass('in hover'); |
---|
| 4771 | dropZone.hide(); |
---|
| 4772 | dropZone.prev().show(); |
---|
| 4773 | }); |
---|
| 4774 | } |
---|
[1701] | 4775 | return ID; |
---|
[2] | 4776 | } |
---|
| 4777 | |
---|
| 4778 | // Verify if any user is sharing his name/email address |
---|
| 4779 | // for use in the new messages's "From " field. |
---|
| 4780 | function draw_from_field(sel_from,tr1_1){ |
---|
| 4781 | |
---|
| 4782 | var el_shared_users = Element("el_shared_users"); |
---|
[6447] | 4783 | /* Recupera a pasta atual do usuário (selecionada) */ |
---|
| 4784 | var user_shared = folder.split(cyrus_delimiter); |
---|
| 4785 | /* Verifica se está nas próprias pastas */ |
---|
| 4786 | if(user_shared[0] == "INBOX"){ |
---|
| 4787 | user_shared = User.me.uid; |
---|
| 4788 | }else{ |
---|
| 4789 | user_shared = user_shared[1]; |
---|
| 4790 | } |
---|
[2] | 4791 | // The element was loaded and populated...so return. |
---|
[3035] | 4792 | if(el_shared_users){ |
---|
[371] | 4793 | // Nothing to work...so return. |
---|
| 4794 | if(el_shared_users.options.length == 0) |
---|
| 4795 | return; |
---|
[2] | 4796 | tr1_1.style.display = ''; |
---|
| 4797 | for (var x = 0; x < el_shared_users.options.length; x++) { |
---|
| 4798 | var _option = document.createElement("OPTION"); |
---|
| 4799 | _option.text = el_shared_users.options[x].text; |
---|
| 4800 | _option.value = el_shared_users.options[x].value; |
---|
[6447] | 4801 | /* Faz o tratamento do nome da pasta para fazer a verificação e selecionar o valor no select */ |
---|
| 4802 | var str_begin_name = _option.text.indexOf('<') + 1; |
---|
| 4803 | var str_end_name = _option.text.indexOf('@'); |
---|
| 4804 | var user_selected_name = _option.text.substring(str_begin_name, str_end_name); |
---|
| 4805 | /* Verifica se é o usuário da pasta selecionada */ |
---|
| 4806 | if(user_selected_name == user_shared){ |
---|
| 4807 | _option.selected = 'selected'; |
---|
| 4808 | } |
---|
[2] | 4809 | sel_from.options[sel_from.options.length] = _option ; |
---|
| 4810 | } |
---|
| 4811 | return; |
---|
| 4812 | } |
---|
| 4813 | // Get the shared folders..... |
---|
| 4814 | var sharedFolders = new Array(); |
---|
| 4815 | for(var i = 0; i < folders.length; i++) { |
---|
| 4816 | var x = folders[i].folder_id; |
---|
[3035] | 4817 | if (folders[i].folder_parent == 'user'){ |
---|
| 4818 | sharedFolders[sharedFolders.length] = x; |
---|
| 4819 | } |
---|
| 4820 | } |
---|
[2] | 4821 | |
---|
[3035] | 4822 | var matchUser = '#'; |
---|
| 4823 | var sharedUsers = new Array(); |
---|
[2] | 4824 | // Filter the shared folders (only root folders) ..... |
---|
| 4825 | for(var i = 0; i < sharedFolders.length; i++) { |
---|
| 4826 | matchUser = sharedFolders[i]; |
---|
| 4827 | sharedUsers[sharedUsers.length] = matchUser.substring(("user"+cyrus_delimiter).length,matchUser.length); |
---|
[3035] | 4828 | } |
---|
[2] | 4829 | |
---|
| 4830 | // Handler function for cExecute |
---|
| 4831 | var h_user = function(data) { |
---|
[371] | 4832 | if(data.length > 0) { |
---|
| 4833 | tr1_1.style.display = ''; |
---|
[6447] | 4834 | var mycn = typeof(data.myname != 'undefined') ? data.myname : ''; |
---|
[2] | 4835 | var _option = document.createElement("OPTION"); |
---|
[5134] | 4836 | _option.text = '"'+mycn+'" <'+Element("user_email").value+'>'; |
---|
| 4837 | _option.value = mycn+";"+Element("user_email").value; |
---|
[6447] | 4838 | /* Verifica se é o usuário logado */ |
---|
| 4839 | if(user_shared == User.me.uid) |
---|
| 4840 | _option.selected = 'selected'; |
---|
[371] | 4841 | sel_from.options[sel_from.options.length] = _option; |
---|
[3035] | 4842 | |
---|
[371] | 4843 | var options = ''; |
---|
[6447] | 4844 | var cn = ''; |
---|
[6263] | 4845 | for (var x = 0; x < data.length; x++) { |
---|
[5134] | 4846 | cn = typeof(data[x].cn[0] != 'undefined') ? data[x].cn[0] : ''; |
---|
[371] | 4847 | var _option = document.createElement("OPTION"); |
---|
[5134] | 4848 | _option.text = '"'+cn+'" <'+data[x].mail[0]+'>'; |
---|
| 4849 | _option.value = cn+';'+data[x].mail[0]+';'+data[x].save_shared[0]+';'+data[x].uid[0]; |
---|
[6447] | 4850 | /* Faz o tratamento do nome da pasta para fazer a verificação e selecionar o valor no select */ |
---|
| 4851 | var str_begin_name = _option.text.indexOf('<') + 1; |
---|
| 4852 | var str_end_name = _option.text.indexOf('@'); |
---|
| 4853 | var user_selected_name = _option.text.substring(str_begin_name, str_end_name); |
---|
| 4854 | /* Verifica se é o usuário da pasta selecionada */ |
---|
| 4855 | if(user_selected_name == user_shared){ |
---|
| 4856 | _option.selected = 'selected'; |
---|
| 4857 | } |
---|
[371] | 4858 | sel_from.options[sel_from.options.length] = _option ; |
---|
[6263] | 4859 | } |
---|
[2] | 4860 | } |
---|
| 4861 | var shared_users_from = Element("el_shared_users"); |
---|
| 4862 | if(!shared_users_from) { |
---|
| 4863 | shared_users_from = sel_from.cloneNode(true); |
---|
| 4864 | shared_users_from.id = "el_shared_users"; |
---|
| 4865 | shared_users_from.style.display = 'none'; |
---|
| 4866 | document.body.appendChild(shared_users_from); |
---|
| 4867 | } |
---|
| 4868 | } |
---|
| 4869 | // First time, so execute..... |
---|
| 4870 | cExecute ("$this.ldap_functions.getSharedUsersFrom&uids="+sharedUsers.join(';'), h_user); |
---|
| 4871 | } |
---|
| 4872 | |
---|
| 4873 | function changeBgColorToON(all_messages, begin, end){ |
---|
[5134] | 4874 | var _tab_prefix = getTabPrefix(); |
---|
| 4875 | var _msg_id; |
---|
[163] | 4876 | for (begin; begin<=end; begin++) |
---|
| 4877 | { |
---|
[5134] | 4878 | _msg_id = getMessageIdFromRowId(all_messages[begin].id); |
---|
[163] | 4879 | add_className(all_messages[begin], 'selected_msg'); |
---|
[5134] | 4880 | Element(_tab_prefix + "check_box_message_" + _msg_id).checked = true; |
---|
[2] | 4881 | } |
---|
| 4882 | } |
---|
[4493] | 4883 | |
---|
[976] | 4884 | function updateBoxBgColor(box){ |
---|
| 4885 | // Set first TR Class |
---|
| 4886 | var _className = 'tr_msg_read2'; |
---|
[3035] | 4887 | for(var i = 0; i < box.length;i++){ |
---|
[976] | 4888 | if(exist_className(box[i],_className)) |
---|
| 4889 | remove_className(box[i], _className); |
---|
| 4890 | _className = (_className == 'tr_msg_read2' ? 'tr_msg_read' : 'tr_msg_read2'); |
---|
| 4891 | if(!exist_className(box[i],_className)) |
---|
| 4892 | add_className( box[i], _className); |
---|
| 4893 | } |
---|
| 4894 | } |
---|
[4802] | 4895 | function changeBgColor(event, msg_number) { |
---|
| 4896 | var _element_id = msg_number.toString(); |
---|
| 4897 | var first_order, last_order; |
---|
[2] | 4898 | |
---|
[4802] | 4899 | if (typeof(currentTab)!='number') { |
---|
| 4900 | _element_id = _element_id+'_s'+numBox; |
---|
| 4901 | } |
---|
| 4902 | actual_tr = Element(_element_id); |
---|
[2] | 4903 | |
---|
[163] | 4904 | if (event.shiftKey) |
---|
| 4905 | { |
---|
[4802] | 4906 | var last_tr = Element(last_message_selected); |
---|
[2] | 4907 | if(!last_tr) |
---|
| 4908 | last_tr = actual_tr; |
---|
| 4909 | |
---|
[4802] | 4910 | var all_messages = actual_tr.parentNode.childNodes; |
---|
[3035] | 4911 | |
---|
[163] | 4912 | for (var i=0; i < all_messages.length; i++) |
---|
| 4913 | { |
---|
| 4914 | if (actual_tr.id == all_messages[i].id) |
---|
[2] | 4915 | first_order = i; |
---|
[163] | 4916 | if (last_tr.id == all_messages[i].id) |
---|
[2] | 4917 | last_order = i; |
---|
| 4918 | } |
---|
[3035] | 4919 | |
---|
[163] | 4920 | if (parseInt(first_order) > parseInt(last_order)) |
---|
| 4921 | changeBgColorToON(all_messages, last_order, first_order); |
---|
| 4922 | else |
---|
| 4923 | changeBgColorToON(all_messages, first_order, last_order); |
---|
[5588] | 4924 | }else if(event.target != document.getElementById(getTabPrefix()+'check_box_message_' + msg_number)){ |
---|
| 4925 | if($(event.target).attr("checked") == "checked"){ |
---|
| 4926 | $(event.target).parents("tr:first").addClass("selected_msg"); |
---|
| 4927 | }else{ |
---|
| 4928 | $(event.target).parents("tr:first").removeClass("selected_msg"); |
---|
| 4929 | } |
---|
[2] | 4930 | } |
---|
| 4931 | else{ |
---|
[163] | 4932 | //if ( exist_className(actual_tr, 'selected_msg') ) |
---|
[5134] | 4933 | if ( document.getElementById(getTabPrefix()+'check_box_message_' + msg_number).checked ){ |
---|
| 4934 | if( document.getElementById("chk_box_select_all_messages").checked) { |
---|
| 4935 | add_className(actual_tr, 'selected_msg selected_shortcut_msg'); |
---|
| 4936 | }else |
---|
[163] | 4937 | add_className(actual_tr, 'selected_msg'); |
---|
[5134] | 4938 | }else{ |
---|
| 4939 | if( document.getElementById("chk_box_select_all_messages").checked){ |
---|
| 4940 | remove_className(actual_tr, 'selected_msg selected_shortcut_msg'); |
---|
| 4941 | remove_className(actual_tr, 'selected_msg'); |
---|
| 4942 | remove_chk_box_select_all_messages(); |
---|
| 4943 | if(actual_tr.className == 'selected_msg') |
---|
[163] | 4944 | remove_className(actual_tr, 'selected_msg'); |
---|
[5134] | 4945 | }else |
---|
| 4946 | remove_className(actual_tr, 'selected_msg'); |
---|
| 4947 | } |
---|
[2] | 4948 | } |
---|
[4802] | 4949 | last_message_selected = _element_id; |
---|
[2] | 4950 | } |
---|
| 4951 | |
---|
| 4952 | function build_quota(data){ |
---|
| 4953 | id = "content_quota"; |
---|
| 4954 | q_limit = data['quota_limit']; |
---|
| 4955 | var div = document.getElementById(id); |
---|
| 4956 | if(!q_limit){ |
---|
[3035] | 4957 | div.innerHTML = '<span><font size="2" style="color:red"><strong>'+get_lang("Without Quota")+'</strong></font></span>'; |
---|
[2] | 4958 | } |
---|
| 4959 | else{ |
---|
[5754] | 4960 | if(div) |
---|
| 4961 | div.innerHTML = ''; |
---|
| 4962 | value = data['quota_percent']; |
---|
| 4963 | q_used = data['quota_used']; |
---|
| 4964 | table = document.getElementById("table_quota"); |
---|
| 4965 | if(table) |
---|
| 4966 | table.parentNode.removeChild(table); |
---|
| 4967 | table = document.createElement("TABLE"); |
---|
| 4968 | tbody = document.createElement("TBODY"); |
---|
| 4969 | table.appendChild(tbody); |
---|
| 4970 | table.id = "table_quota"; |
---|
| 4971 | table.width="102"; |
---|
| 4972 | table.border="0"; |
---|
| 4973 | table.cellSpacing = 0; |
---|
| 4974 | table.cellPadding = 0; |
---|
[3035] | 4975 | |
---|
[5754] | 4976 | //tr1 = document.createElement("TR"); |
---|
| 4977 | td11 = document.createElement("TD"); |
---|
| 4978 | td11.align="center"; |
---|
| 4979 | td11.setAttribute("noWrap","true"); |
---|
| 4980 | 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>"; |
---|
| 4981 | //tr1.appendChild(td11); |
---|
[3035] | 4982 | |
---|
[5754] | 4983 | tr2 = document.createElement("TR"); |
---|
| 4984 | td22 = document.createElement("TD"); |
---|
[3035] | 4985 | |
---|
[5754] | 4986 | //td21.appendChild(table221); |
---|
| 4987 | //tr2.appendChild(td21); |
---|
| 4988 | tr2.appendChild(td11); |
---|
| 4989 | //tr2.appendChild(td1); |
---|
[4934] | 4990 | |
---|
[5754] | 4991 | tbody.appendChild(tr2); //Desenho |
---|
| 4992 | //tbody.appendChild(tr1); //Letras |
---|
| 4993 | div.appendChild(table); |
---|
| 4994 | $("#quota_progressbar").progressbar({ |
---|
| 4995 | value: value |
---|
| 4996 | }); |
---|
| 4997 | if(value > 90) { |
---|
| 4998 | if(value >= 100) |
---|
| 4999 | write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages.")); |
---|
| 5000 | else |
---|
| 5001 | write_msg(get_lang("Warning: Your Mailbox is almost full!")); |
---|
| 5002 | $("#quota_progressbar").find(".ui-progressbar-value").css({"background-image": "url(templates/default/images/dsalert.gif)", "border-color" : "red"}); |
---|
| 5003 | } |
---|
| 5004 | else if(value > 80) |
---|
| 5005 | $("#quota_progressbar").find(".ui-progressbar-value").css({"background-image": "url(templates/default/images/dswarn.gif)", "border-color" : "yellow"}); |
---|
[2] | 5006 | } |
---|
| 5007 | } |
---|
| 5008 | |
---|
| 5009 | function draw_quota(data){ |
---|
[5754] | 5010 | this.build_quota(data); |
---|
[2] | 5011 | } |
---|
| 5012 | |
---|
[345] | 5013 | function update_quota(folder_id){ |
---|
[5754] | 5014 | cExecute ("$this.imap_functions.get_quota&folder_id="+folder_id,this.build_quota); |
---|
[2] | 5015 | } |
---|
| 5016 | |
---|
| 5017 | function draw_search(headers_msgs){ |
---|
| 5018 | Element("border_id_0").innerHTML = " " + get_lang('Search Result') + " "; |
---|
| 5019 | |
---|
| 5020 | var tbody = Element('tbody_box'); |
---|
| 5021 | for (var i=0; i<(headers_msgs.length); i++){ |
---|
[3493] | 5022 | // passa parâmetro offset |
---|
[2] | 5023 | var tr = this.make_tr_message(headers_msgs[i], headers_msgs[i].msg_folder); |
---|
[790] | 5024 | if (tr) |
---|
| 5025 | tbody.appendChild(tr); |
---|
[2] | 5026 | } |
---|
| 5027 | } |
---|
| 5028 | |
---|
| 5029 | function draw_search_header_box(){ |
---|
| 5030 | var table_message_header_box = Element("table_message_header_box"); |
---|
| 5031 | table_message_header_box.parentNode.removeChild(table_message_header_box); |
---|
| 5032 | |
---|
| 5033 | var content_id_0 = Element("content_id_0"); |
---|
| 5034 | var table_element = document.createElement("TABLE"); |
---|
| 5035 | var tbody_element = document.createElement("TBODY"); |
---|
| 5036 | table_element.setAttribute("id", "table_message_header_box"); |
---|
| 5037 | table_element.className = "table_message_header_box"; |
---|
| 5038 | tr_element = document.createElement("TR"); |
---|
| 5039 | tr_element.className = "message_header"; |
---|
| 5040 | td_element1 = document.createElement("TD"); |
---|
| 5041 | td_element1.setAttribute("width", "1%"); |
---|
| 5042 | chk_box_element = document.createElement("INPUT"); |
---|
| 5043 | chk_box_element.id = "chk_box_select_all_messages"; |
---|
| 5044 | chk_box_element.setAttribute("type", "checkbox"); |
---|
| 5045 | chk_box_element.className = "checkbox"; |
---|
| 5046 | chk_box_element.onclick = function(){select_all_messages(this.checked);}; |
---|
| 5047 | chk_box_element.onmouseover = function () {this.title=get_lang('Select all messages.')}; |
---|
| 5048 | chk_box_element.onkeydown = function (e){ |
---|
| 5049 | if (is_ie) |
---|
| 5050 | { |
---|
| 5051 | if ((window.event.keyCode) == 46) |
---|
| 5052 | { |
---|
| 5053 | //delete_all_selected_msgs_imap(); |
---|
[689] | 5054 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 5055 | } |
---|
| 5056 | } |
---|
| 5057 | else |
---|
| 5058 | { |
---|
| 5059 | if ((e.keyCode) == 46) |
---|
| 5060 | { |
---|
| 5061 | //delete_all_selected_msgs_imap(); |
---|
[689] | 5062 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 5063 | } |
---|
| 5064 | } |
---|
| 5065 | }; |
---|
[3035] | 5066 | |
---|
[2] | 5067 | td_element1.appendChild(chk_box_element); |
---|
| 5068 | td_element2 = document.createElement("TD"); |
---|
| 5069 | td_element2.setAttribute("width", "3%"); |
---|
| 5070 | td_element3 = document.createElement("TD"); |
---|
| 5071 | td_element3.setAttribute("width", "30%"); |
---|
| 5072 | td_element3.id = "message_header_SORTFROM"; |
---|
| 5073 | td_element3.align = "left"; |
---|
| 5074 | td_element3.innerHTML = get_lang("From"); |
---|
| 5075 | td_element4 = document.createElement("TD"); |
---|
| 5076 | td_element4.setAttribute("width", "49%"); |
---|
| 5077 | td_element4.id = "message_header_SORTSUBJECT"; |
---|
| 5078 | td_element4.align = "left"; |
---|
[3035] | 5079 | td_element4.innerHTML = get_lang("Subject"); |
---|
[2] | 5080 | td_element5 = document.createElement("TD"); |
---|
| 5081 | td_element5.setAttribute("width", "10%"); |
---|
| 5082 | td_element5.id = "message_header_SORTARRIVAL"; |
---|
| 5083 | td_element5.align = "center"; |
---|
[3035] | 5084 | td_element5.innerHTML = "<B>"+get_lang("Date")+"</B>"; |
---|
[790] | 5085 | td_element5.innerHTML += "<img src ='templates/"+template+"/images/arrow_descendant.gif'>"; |
---|
[2] | 5086 | td_element6 = document.createElement("TD"); |
---|
| 5087 | td_element6.setAttribute("width", "10%"); |
---|
| 5088 | td_element6.id = "message_header_SORTSIZE"; |
---|
| 5089 | td_element6.align = "right"; |
---|
| 5090 | td_element6.innerHTML = get_lang("Size"); |
---|
| 5091 | tr_element.appendChild(td_element1); |
---|
| 5092 | tr_element.appendChild(td_element2); |
---|
| 5093 | tr_element.appendChild(td_element3); |
---|
| 5094 | tr_element.appendChild(td_element4); |
---|
| 5095 | tr_element.appendChild(td_element5); |
---|
| 5096 | tr_element.appendChild(td_element6); |
---|
[3035] | 5097 | |
---|
[2] | 5098 | tbody_element.appendChild(tr_element); |
---|
| 5099 | table_element.appendChild(tbody_element); |
---|
| 5100 | content_id_0.appendChild(table_element); |
---|
| 5101 | } |
---|
| 5102 | |
---|
| 5103 | function draw_search_division(msg){ |
---|
| 5104 | var tbody = Element('tbody_box'); |
---|
| 5105 | var tr = document.createElement("TR"); |
---|
| 5106 | var td = document.createElement("TD"); |
---|
| 5107 | td.colSpan = '7'; |
---|
| 5108 | td.width = '100%'; |
---|
| 5109 | |
---|
| 5110 | var action_info_table = document.createElement("TABLE"); |
---|
| 5111 | var action_info_tbody = document.createElement("TBODY"); |
---|
[3035] | 5112 | |
---|
[2] | 5113 | action_info_table.className = "action_info_table"; |
---|
| 5114 | action_info_table.width = "100%"; |
---|
[3035] | 5115 | |
---|
[2] | 5116 | var action_info_tr = document.createElement("TR"); |
---|
[3035] | 5117 | |
---|
[2] | 5118 | var action_info_th1 = document.createElement("TH"); |
---|
| 5119 | action_info_th1.width = "40%"; |
---|
| 5120 | action_info_th1.innerHTML = " "; |
---|
| 5121 | |
---|
| 5122 | var action_info_th2 = document.createElement("TH"); |
---|
[3035] | 5123 | |
---|
[2] | 5124 | action_info_th2.innerHTML = msg; |
---|
| 5125 | action_info_th2.className = "action_info_th"; |
---|
| 5126 | action_info_th2.setAttribute("noWrap", "true"); |
---|
[3035] | 5127 | |
---|
[2] | 5128 | var action_info_th3 = document.createElement("TH"); |
---|
| 5129 | action_info_th3.width = "40%"; |
---|
| 5130 | action_info_th3.innerHTML = " "; |
---|
[3035] | 5131 | |
---|
[2] | 5132 | action_info_tr.appendChild(action_info_th1); |
---|
| 5133 | action_info_tr.appendChild(action_info_th2); |
---|
| 5134 | action_info_tr.appendChild(action_info_th3); |
---|
| 5135 | action_info_tbody.appendChild(action_info_tr); |
---|
| 5136 | action_info_table.appendChild(action_info_tbody); |
---|
| 5137 | |
---|
| 5138 | td.appendChild(action_info_table); |
---|
| 5139 | tr.appendChild(td); |
---|
| 5140 | tbody.appendChild(tr); |
---|
| 5141 | } |
---|
| 5142 | |
---|
| 5143 | function draw_search_box(){ |
---|
| 5144 | var content_id_0 = Element("content_id_0"); |
---|
| 5145 | var table = document.createElement("TABLE"); |
---|
| 5146 | table.id = "table_box"; |
---|
| 5147 | table.width = 'auto'; |
---|
| 5148 | var tbody = document.createElement("TBODY"); |
---|
| 5149 | tbody.id = "tbody_box"; |
---|
| 5150 | |
---|
| 5151 | table.className = "table_box"; |
---|
| 5152 | table.setAttribute("frame", "below"); |
---|
| 5153 | table.setAttribute("rules", "none"); |
---|
| 5154 | table.setAttribute("cellpadding", "0"); |
---|
| 5155 | table.onkeydown = function (e){ |
---|
| 5156 | if (is_ie) |
---|
| 5157 | { |
---|
| 5158 | if ((window.event.keyCode) == 46) |
---|
| 5159 | { |
---|
| 5160 | //delete_all_selected_msgs_imap(); |
---|
[689] | 5161 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 5162 | } |
---|
| 5163 | } |
---|
| 5164 | else |
---|
| 5165 | { |
---|
| 5166 | if ((e.keyCode) == 46) |
---|
| 5167 | { |
---|
| 5168 | //delete_all_selected_msgs_imap(); |
---|
[689] | 5169 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 5170 | } |
---|
| 5171 | } |
---|
| 5172 | }; |
---|
| 5173 | if (is_ie) |
---|
| 5174 | table.style.cursor = "hand"; |
---|
[3035] | 5175 | |
---|
[2] | 5176 | table.appendChild(tbody); |
---|
| 5177 | content_id_0.appendChild(table); |
---|
| 5178 | } |
---|
[4820] | 5179 | var idx_cc = 0; |
---|
[4493] | 5180 | |
---|
| 5181 | function draw_plugin_cc(ID, addrs){ |
---|
[2] | 5182 | connector.loadScript("ccQuickAdd"); |
---|
| 5183 | |
---|
| 5184 | var array_addrs = ''; |
---|
[3035] | 5185 | var array_name = ''; |
---|
[2] | 5186 | var cc_data = new Array(); |
---|
[3035] | 5187 | if(typeof(addrs.name) != 'undefined') { |
---|
[2] | 5188 | array_name = LTrim(addrs.name).split(" "); |
---|
[3035] | 5189 | array_addrs = new Array(addrs.email); |
---|
[2] | 5190 | } |
---|
| 5191 | else { |
---|
| 5192 | array_addrs = (typeof addrs == 'object' ? addrs.toString().split("\" ") : addrs.split("\" ")); |
---|
[3035] | 5193 | array_name = LTrim(array_addrs[0]).replace('"','').split(" "); |
---|
[2] | 5194 | } |
---|
| 5195 | |
---|
| 5196 | var _split = array_name[0].split('@'); |
---|
| 5197 | cc_data[0] = _split[0]; |
---|
| 5198 | cc_data[1] = _split[0]; |
---|
| 5199 | cc_data[2] = ''; |
---|
| 5200 | |
---|
| 5201 | for (i=1; i < array_name.length; i++) |
---|
[3035] | 5202 | cc_data[2] += array_name[i] + " "; |
---|
[2] | 5203 | |
---|
[3035] | 5204 | |
---|
| 5205 | if(array_addrs.length > 1) |
---|
| 5206 | cc_data[3] = array_addrs[1] ? array_addrs[1].replace("<",'').replace(">",'') : ''; |
---|
[2] | 5207 | else |
---|
| 5208 | cc_data[3] = array_addrs[0]; |
---|
[3035] | 5209 | |
---|
[6678] | 5210 | var onclick = ''; |
---|
| 5211 | $.each(cc_data, function(index, value){ |
---|
| 5212 | onclick += "'"+value+"',"; |
---|
| 5213 | }); |
---|
| 5214 | onclick = onclick.substr(0, onclick.length-1); |
---|
[106] | 5215 | var sm_envelope_img1 = '<img style="cursor:'+ (is_ie ? 'hand' : 'pointer') +'" title="' + get_lang("Add Contact") + |
---|
[6678] | 5216 | '" onclick="ccQuickAddOne.showList(['+onclick+'])" src="./templates/'+template+'/images/user_card.png">'; |
---|
[2] | 5217 | var to_addybook_add = "<SPAN id='insert_plugin_"+idx_cc+"_"+ID+"'>"; |
---|
| 5218 | to_addybook_add += addrs; |
---|
| 5219 | to_addybook_add += sm_envelope_img1; |
---|
| 5220 | idx_cc++; |
---|
| 5221 | to_addybook_add += "</SPAN>"; |
---|
| 5222 | return to_addybook_add; |
---|
| 5223 | } |
---|
[4493] | 5224 | |
---|
[2] | 5225 | function deny_email(email){ |
---|
| 5226 | connector.loadScript("filter"); |
---|
[375] | 5227 | connector.loadScript("filters"); |
---|
[2] | 5228 | var dn_em = document.createElement("SPAN"); |
---|
| 5229 | dn_em.id = "tt_d"; |
---|
[6265] | 5230 | dn_em.onclick = function(){block_user_email(email); /*filter.new_rule(email);*/}; |
---|
[106] | 5231 | dn_em.setAttribute("title",get_lang("Block Sender")); |
---|
[3035] | 5232 | dn_em.style.cursor = "pointer"; |
---|
[5630] | 5233 | dn_em.innerHTML = "<script src='../prototype/modules/filters/filters.js'></script><img align='top' src='./templates/"+template+"/images/deny.gif'>"; |
---|
[2] | 5234 | return dn_em; |
---|
[3035] | 5235 | |
---|
[2] | 5236 | } |
---|
[4493] | 5237 | |
---|
[13] | 5238 | function show_div_address_full(id, type) { |
---|
| 5239 | var div_address_full = Element("div_"+type+"address_full_"+id); |
---|
| 5240 | if(!div_address_full) { |
---|
| 5241 | div_address_full = document.createElement("SPAN"); |
---|
[3035] | 5242 | div_address_full.id = "div_"+type+"address_full_"+id; |
---|
| 5243 | div_address_full.style.display="none"; |
---|
[13] | 5244 | var _address = eval(type+"address_array['"+id+"']"); |
---|
| 5245 | var isOverLimit = (_address.length > 100); |
---|
[3035] | 5246 | |
---|
[2] | 5247 | if(isOverLimit) { |
---|
[446] | 5248 | alert("Esse campo possui muitos endereços ("+_address.length+" destinatários).\r\n"+ |
---|
| 5249 | "Para evitar o travamento do navegador, o botão 'Adicionar Contato' foi desabilitado!"); |
---|
[2] | 5250 | } |
---|
[13] | 5251 | |
---|
| 5252 | for(var idx = 1 ; idx < _address.length;idx++) { |
---|
| 5253 | div_address_full.innerHTML += isOverLimit ? '<br>'+_address[idx] : ','+draw_plugin_cc(id,_address[idx]); |
---|
[3035] | 5254 | } |
---|
[13] | 5255 | 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>)"; |
---|
| 5256 | Element(type+"_"+id).appendChild(div_address_full); |
---|
[2] | 5257 | } |
---|
[13] | 5258 | Element('div_'+type+'address_'+id).style.display='none'; |
---|
| 5259 | div_address_full.style.display=''; |
---|
[46] | 5260 | } |
---|
[4493] | 5261 | |
---|
[46] | 5262 | function draw_footer_box(num_msgs){ |
---|
[689] | 5263 | folder = get_current_folder(); |
---|
[3287] | 5264 | connector.loadScript('wfolders'); |
---|
[3035] | 5265 | var span_R = Element("table_message"); |
---|
| 5266 | var span_options = Element("span_options"); |
---|
[58] | 5267 | if(!span_options) { |
---|
[3035] | 5268 | span_options = document.createElement("TD"); |
---|
[58] | 5269 | span_options.style.fontSize = "12"; |
---|
| 5270 | span_options.id = "span_options"; |
---|
[59] | 5271 | span_R.appendChild(span_options); |
---|
| 5272 | } |
---|
[69] | 5273 | |
---|
[790] | 5274 | var change_font_color = 'onmouseover="var last_class = this.className;'+ |
---|
[848] | 5275 | 'if (this.className != \'message_options_over\')'+ |
---|
| 5276 | 'this.className=\'message_options_active\'; '+ |
---|
[790] | 5277 | 'this.onmouseout=function(){this.className=last_class;}"'; |
---|
| 5278 | |
---|
| 5279 | span_options.innerHTML = |
---|
| 5280 | '<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>'+ |
---|
| 5281 | '<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] | 5282 | ((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] | 5283 | // '<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] | 5284 | ((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] | 5285 | ((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] | 5286 | if(preferences.use_local_messages==1 && !expresso_offline) |
---|
[1000] | 5287 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
[5215] | 5288 | 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] | 5289 | else |
---|
[5215] | 5290 | 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] | 5291 | if (use_spam_filter) { |
---|
[790] | 5292 | if ( current_folder == 'INBOX'+cyrus_delimiter+'Spam' ) { |
---|
| 5293 | 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] | 5294 | } |
---|
| 5295 | else { |
---|
[790] | 5296 | 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] | 5297 | } |
---|
| 5298 | } |
---|
[3035] | 5299 | var span_D = Element("span_D"); |
---|
[58] | 5300 | if(!span_D){ |
---|
[3035] | 5301 | span_D = document.createElement("TD"); |
---|
[58] | 5302 | span_D.align = "right"; |
---|
| 5303 | span_D.style.fontSize = "12"; |
---|
| 5304 | span_D.id = "span_D"; |
---|
| 5305 | span_R.appendChild(span_D); |
---|
| 5306 | } |
---|
[3035] | 5307 | span_D.innerHTML = |
---|
[58] | 5308 | get_lang("List")+': '+ |
---|
[790] | 5309 | '<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>, '+ |
---|
| 5310 | '<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>, '+ |
---|
| 5311 | '<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] | 5312 | '<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] | 5313 | '<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] | 5314 | draw_paging(num_msgs); |
---|
[3035] | 5315 | Element("tot_m").innerHTML = num_msgs; |
---|
[1247] | 5316 | } |
---|