[5533] | 1 | /** |
---|
| 2 | * Estrutura que guarda em cache as mensagens abertas, a exemplo da estrutura utilizada |
---|
| 3 | * na funcionalidade de anexar mensagens. |
---|
[7043] | 4 | * Isto reduz a necessidade de acessar estruturas da tela para obter informaᅵᅵes sobre |
---|
[5533] | 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 |
---|
[7043] | 8 | * formataᅵᅵo, etc.) |
---|
[5533] | 9 | */ |
---|
[6667] | 10 | |
---|
| 11 | focusIn = ""; |
---|
| 12 | canMakeBox = true; |
---|
[6670] | 13 | fastSearch = false; |
---|
[6930] | 14 | selectedPagingMsgs = {}; |
---|
| 15 | allMsgsSelected = false; |
---|
| 16 | totalFolderMsgs = 0; |
---|
| 17 | var jqXHR = new Array(); |
---|
| 18 | var idattachbycontent = 0; |
---|
[6667] | 19 | |
---|
[5533] | 20 | onceOpenedHeadersMessages = {}; |
---|
[6592] | 21 | var cache = new Array(); |
---|
[5533] | 22 | var openTab = { |
---|
[607] | 23 | 'type' : [], // 8 types of tabs, further info. see expressolivre.org/dev/wiki/mail/Documentacao |
---|
[320] | 24 | 'content_id' : [], |
---|
[607] | 25 | 'imapUid' : [], // Stores the imap email number of current tab |
---|
| 26 | 'countFile' : [0,0,0,0,0,0,0,0,0,0], // Stores the number of files attached in current tab |
---|
| 27 | 'imapBox' : [], // Stores the folder name |
---|
[646] | 28 | 'toPreserve' : [], // Check if the message should be removed from draft after send |
---|
[4821] | 29 | 'condition' : [] // Will store the search condition if the tab is the result of a search |
---|
[607] | 30 | }; |
---|
[5459] | 31 | |
---|
| 32 | var autoSaveControl = { |
---|
| 33 | 'timer' : [], // The timeout timer for autosave function |
---|
| 34 | 'status' : [] // The status autosave |
---|
| 35 | }; |
---|
| 36 | |
---|
[607] | 37 | var tabTypes = { |
---|
| 38 | 'new':4, |
---|
| 39 | 'forward':6, |
---|
| 40 | 'reply_with_history':7, |
---|
[3143] | 41 | 'reply_to_all_with_history':8, |
---|
| 42 | 'reply_without_history':9, |
---|
| 43 | 'reply_to_all_without_history':10, |
---|
[607] | 44 | 'edit':5 |
---|
[5459] | 45 | }; |
---|
[5302] | 46 | |
---|
[607] | 47 | var currentTab,numBox = 0; // Open Tab and num of mailboxes opened at context |
---|
[7043] | 48 | // Objeto Map, talvez o ideal fosse adicionar este objeto ᅵ Api do egroupware, e carregᅵ-lo |
---|
[1747] | 49 | // aqui no expressoMail. |
---|
| 50 | |
---|
[2] | 51 | function draw_tree_folders(folders){ |
---|
| 52 | // Check if the tree folders alredy exist. |
---|
[51] | 53 | if (Element('dftree_tree_folders')){ |
---|
[1121] | 54 | if (!expresso_offline) { |
---|
| 55 | var update_tree_folders = function(data){ |
---|
[5754] | 56 | draw_quota(data); |
---|
[1121] | 57 | var unseen_in_mailbox = 0; |
---|
| 58 | var unseen_in_shared_folders = 0; |
---|
| 59 | for (var i=0; i<data.length; i++){ |
---|
| 60 | if ( data[i].folder_unseen > 0 ) |
---|
| 61 | { |
---|
| 62 | unseen_in_mailbox = parseInt( unseen_in_mailbox + data[ i ].folder_unseen ); |
---|
| 63 | if ( data[i].folder_id.indexOf( 'INBOX' ) !== 0 ) |
---|
| 64 | unseen_in_shared_folders = parseInt( unseen_in_shared_folders + data[ i ].folder_unseen ); |
---|
| 65 | } |
---|
[3035] | 66 | |
---|
[1121] | 67 | var folder_unseen = Element('dftree_'+data[i].folder_id+'_unseen'); |
---|
[3035] | 68 | |
---|
[1121] | 69 | if ((folder_unseen) && (data[i].folder_unseen > 0)) |
---|
| 70 | { |
---|
| 71 | folder_unseen.innerHTML = data[i].folder_unseen; |
---|
| 72 | } |
---|
| 73 | else if (data[i].folder_unseen > 0) |
---|
| 74 | { |
---|
| 75 | 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>'}); |
---|
| 76 | tree_folders.getNodeById(data[i].folder_id)._refresh(); |
---|
| 77 | } |
---|
| 78 | else if (data[i].folder_unseen <= 0) |
---|
| 79 | { |
---|
[5134] | 80 | if(tree_folders.getNodeById(data[i].folder_id)){ |
---|
[1121] | 81 | tree_folders.getNodeById(data[i].folder_id).alter({caption:lang_folder(data[i].folder_name)}); |
---|
| 82 | tree_folders.getNodeById(data[i].folder_id)._refresh(); |
---|
| 83 | } |
---|
[5134] | 84 | } |
---|
[1121] | 85 | |
---|
[3035] | 86 | if(data[i].folder_id == current_folder){ |
---|
[1121] | 87 | var old_new_m = isNaN(parseInt(Element('new_m').innerHTML)) ? parseInt(Element('new_m').firstChild.innerHTML) : parseInt(Element('new_m').innerHTML); |
---|
| 88 | Element('new_m').innerHTML = data[i].folder_unseen ? '<font color="RED">'+data[i].folder_unseen+'</font>' : 0; |
---|
| 89 | draw_paging(Element('tot_m').innerHTML); |
---|
| 90 | } |
---|
[790] | 91 | } |
---|
| 92 | |
---|
[1121] | 93 | var display_unseen_in_mailbox = tree_folders.getNodeById( 'root' ); |
---|
[3035] | 94 | display_unseen_in_mailbox.alter({caption:get_lang("My Folders")}); |
---|
[1121] | 95 | display_unseen_in_mailbox._refresh(); |
---|
[3035] | 96 | |
---|
[1121] | 97 | var display_unseen_in_shared_folders = tree_folders.getNodeById( 'user' ); |
---|
| 98 | if ( display_unseen_in_shared_folders ) |
---|
[2] | 99 | { |
---|
[1121] | 100 | if ( unseen_in_shared_folders ) |
---|
| 101 | 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")}); |
---|
| 102 | else |
---|
| 103 | display_unseen_in_shared_folders.alter({caption:get_lang("Shared folders")}); |
---|
| 104 | display_unseen_in_shared_folders._refresh(); |
---|
[2] | 105 | } |
---|
| 106 | } |
---|
[1121] | 107 | cExecute ("$this.imap_functions.get_folders_list&folder="+current_folder, update_tree_folders); |
---|
[2] | 108 | } |
---|
[3035] | 109 | |
---|
[2] | 110 | return; |
---|
| 111 | } |
---|
| 112 | else{ |
---|
[1121] | 113 | if (!expresso_offline) { |
---|
| 114 | tree_folders = new dFTree({name: 'tree_folders'}); |
---|
[3035] | 115 | |
---|
[1121] | 116 | var n_root = new dNode({id:'root', caption: get_lang("My Folders")}); |
---|
| 117 | tree_folders.add(n_root,'anything'); //Places the root; second argument can be anything. |
---|
[3035] | 118 | |
---|
[1121] | 119 | var unseen_in_mailbox = 0; |
---|
| 120 | var unseen_in_shared_folders = 0; |
---|
| 121 | for (var i=0; i<folders.length; i++){ |
---|
| 122 | if (folders[i].folder_unseen > 0) |
---|
| 123 | { |
---|
| 124 | unseen_in_mailbox = parseInt( unseen_in_mailbox + folders[ i ].folder_unseen ); |
---|
| 125 | if ( folders[i].folder_id.indexOf( 'INBOX' ) !== 0 ) |
---|
| 126 | unseen_in_shared_folders = parseInt( unseen_in_shared_folders + folders[ i ].folder_unseen ); |
---|
[790] | 127 | |
---|
[3035] | 128 | 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}); |
---|
| 129 | |
---|
[1121] | 130 | if( folders[i].folder_name.toLowerCase() == 'inbox' ) |
---|
| 131 | Element('new_m').innerHTML = '<font style="color:red">' + folders[i].folder_unseen + '</font>'; |
---|
[2] | 132 | } |
---|
[1121] | 133 | else |
---|
[3035] | 134 | 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}); |
---|
| 135 | |
---|
[1121] | 136 | if (folders[i].folder_parent == '') |
---|
| 137 | folders[i].folder_parent = 'root'; |
---|
[3035] | 138 | else if (folders[i].folder_parent == 'user'){ |
---|
| 139 | |
---|
[1121] | 140 | if (!tree_folders.getNodeById('user')){ |
---|
[4738] | 141 | tmpFolderId = folders[i].folder_id.split(cyrus_delimiter).pop(); |
---|
[3035] | 142 | var n_root_shared_folders = new dNode({id:'user', caption:get_lang("Shared folders"), plusSign:true}); |
---|
[1121] | 143 | tree_folders.add(n_root_shared_folders,'root'); |
---|
| 144 | } |
---|
| 145 | } |
---|
| 146 | tree_folders.add(nn,folders[i].folder_parent); |
---|
[2] | 147 | } |
---|
| 148 | } |
---|
[3178] | 149 | |
---|
| 150 | |
---|
| 151 | |
---|
| 152 | var handlerChannel = function(data){ |
---|
[3183] | 153 | if (data == null || typeof(data) == 'string') |
---|
[3178] | 154 | return; |
---|
| 155 | /* |
---|
| 156 | * RSS NEWS |
---|
| 157 | */ |
---|
| 158 | var root_rss = new dNode({ |
---|
| 159 | id: "news_root", |
---|
| 160 | caption: get_lang('News') |
---|
| 161 | }); |
---|
| 162 | tree_folders.add(root_rss, "root"); |
---|
| 163 | for(i=0; i < data.length; i++) |
---|
| 164 | { |
---|
| 165 | var nodeNews = new dNode({ |
---|
| 166 | id: "NEWS/"+data[i].name, |
---|
| 167 | caption: data[i].name, |
---|
| 168 | onClick: "open_rss('"+data[i].rss_url+"')", |
---|
| 169 | plusSign: 0 |
---|
| 170 | }); |
---|
| 171 | tree_folders.add(nodeNews,"news_root"); |
---|
| 172 | } |
---|
| 173 | var noden=document.getElementById('lnews_roottree_folders'); |
---|
| 174 | noden.style.backgroundImage="url(templates/"+template+"/images/menu/rss.png)"; |
---|
[5533] | 175 | |
---|
| 176 | |
---|
| 177 | |
---|
[3178] | 178 | } |
---|
[3267] | 179 | // cExecute('$this.rss.getChannels',handlerChannel); |
---|
[3178] | 180 | |
---|
| 181 | |
---|
[689] | 182 | /** |
---|
| 183 | * Pastas locais |
---|
| 184 | */ |
---|
[1121] | 185 | if (preferences.use_local_messages==1 || expresso_offline) { |
---|
[5134] | 186 | //verifica se gears esta installado ou o offline |
---|
| 187 | if( (!window.google || !google.gears) && |
---|
| 188 | !expresso_local_messages.installGears() ){ |
---|
| 189 | preferences.use_local_messages = 0; |
---|
[689] | 190 | } |
---|
[5134] | 191 | else if( !expresso_local_messages.is_offline_installed() ) |
---|
| 192 | preferences.use_local_messages = 0; |
---|
[689] | 193 | else{ |
---|
[3035] | 194 | if (expresso_offline) |
---|
[1701] | 195 | tree_folders = new dFTree({ |
---|
| 196 | name: 'tree_folders' |
---|
| 197 | }); |
---|
| 198 | var root_local = new dNode({ |
---|
| 199 | id: "local_root", |
---|
| 200 | caption: get_lang('local folders') |
---|
| 201 | }); |
---|
| 202 | tree_folders.add(root_local, "root"); //coloca root local |
---|
| 203 | var local_folders = expresso_local_messages.list_local_folders(); |
---|
| 204 | for (var i in local_folders) { //Coloca as pastas locais. |
---|
| 205 | var node_root = "local_root"; |
---|
| 206 | var new_caption = local_folders[i][0]; |
---|
| 207 | if (local_folders[i][0].indexOf("/") != "-1") { |
---|
| 208 | final_pos = local_folders[i][0].lastIndexOf("/"); |
---|
| 209 | node_root = "local_" + local_folders[i][0].substr(0, final_pos); |
---|
| 210 | new_caption = local_folders[i][0].substr(final_pos + 1); |
---|
| 211 | } |
---|
[3035] | 212 | if (local_folders[i][1] > 0) |
---|
[1701] | 213 | var nodeLocal = new dNode({ |
---|
| 214 | id: "local_" + local_folders[i][0], |
---|
| 215 | 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>', |
---|
| 216 | onClick: "change_folder('local_" + local_folders[i][0] + "','" + new_caption + "')", |
---|
| 217 | plusSign: local_folders[i][2] |
---|
[689] | 218 | }); |
---|
[3035] | 219 | else |
---|
[1701] | 220 | var nodeLocal = new dNode({ |
---|
| 221 | id: "local_" + local_folders[i][0], |
---|
| 222 | caption: lang_folder(new_caption), |
---|
| 223 | onClick: "change_folder('local_" + local_folders[i][0] + "','" + new_caption + "')", |
---|
| 224 | plusSign: local_folders[i][2] |
---|
| 225 | }); |
---|
[1518] | 226 | tree_folders.add(nodeLocal, node_root); |
---|
| 227 | } |
---|
[689] | 228 | } |
---|
[3035] | 229 | } |
---|
[5584] | 230 | |
---|
| 231 | /*tree_folders.draw(Element('content_folders')); |
---|
[1121] | 232 | if (!expresso_offline) { |
---|
[5134] | 233 | n_root.changeState(); |
---|
| 234 | tree_folders.getNodeById('INBOX')._select(); |
---|
[1121] | 235 | } |
---|
| 236 | else { |
---|
| 237 | root_local.changeState(); |
---|
| 238 | tree_folders.getNodeById('local_Inbox')._select(); |
---|
[5584] | 239 | }*/ |
---|
| 240 | |
---|
[5306] | 241 | var trash_span = document.getElementById(mount_url_folder(["lINBOX",special_folders["Trash"]]) + 'tree_folders'); |
---|
[5533] | 242 | var draft_span = document.getElementById(mount_url_folder(["lINBOX",special_folders["Drafts"]]) + 'tree_folders'); |
---|
| 243 | var sent_span = document.getElementById(mount_url_folder(["lINBOX",special_folders["Sent"]]) + 'tree_folders'); |
---|
| 244 | var spam_span = document.getElementById(mount_url_folder(["lINBOX",special_folders["Spam"]]) + 'tree_folders'); |
---|
[3287] | 245 | //local folders |
---|
[5306] | 246 | var sent_local_conf = this.preferences.save_in_folder.replace(mount_url_folder(["INBOX",""]),"local_"); |
---|
[3287] | 247 | var sent_local_conf_span=document.getElementById('l'+sent_local_conf+'tree_folders'); |
---|
[5211] | 248 | var trash_local_span=document.getElementById('llocal_'+special_folders['Trash']+'tree_folders'); |
---|
| 249 | var draft_local_span=document.getElementById('llocal_'+special_folders['Drafts']+'tree_folders'); |
---|
| 250 | var sent_span_default=document.getElementById('llocal_'+special_folders['Sent']+'tree_folders'); |
---|
[790] | 251 | |
---|
[3287] | 252 | |
---|
[790] | 253 | if (trash_span) |
---|
| 254 | trash_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_trash.png)"; |
---|
| 255 | |
---|
| 256 | if (draft_span) |
---|
| 257 | draft_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_draft.png)" |
---|
| 258 | |
---|
| 259 | if (sent_span) |
---|
| 260 | sent_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_sent.png)"; |
---|
| 261 | if (spam_span) |
---|
| 262 | spam_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_spam.png)"; |
---|
| 263 | |
---|
[3287] | 264 | if (sent_span_default) |
---|
| 265 | sent_span_default.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_sent.png)"; |
---|
| 266 | //Local folders |
---|
[1121] | 267 | |
---|
[3287] | 268 | if (sent_local_conf_span) |
---|
| 269 | sent_local_conf_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_sent.png)"; |
---|
| 270 | if (trash_local_span) |
---|
| 271 | trash_local_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_trash.png)"; |
---|
| 272 | if (draft_local_span) |
---|
| 273 | draft_local_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_draft.png)" |
---|
| 274 | if (sent_span_default) |
---|
| 275 | sent_span_default.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_sent.png)"; |
---|
| 276 | |
---|
| 277 | |
---|
[2] | 278 | draw_paging(Element('tot_m').innerHTML); |
---|
[5306] | 279 | if(document.getElementById(mount_url_folder(["nINBOX",special_folders["Trash"]])+"tree_folders")) |
---|
[1752] | 280 | { |
---|
| 281 | var trash = document.createElement("SPAN"); |
---|
| 282 | trash.id = 'empty_trash'; |
---|
[1965] | 283 | trash.className = 'clean_folder'; |
---|
[1752] | 284 | trash.style.cursor = 'pointer'; |
---|
| 285 | trash.onclick = function () {empty_trash_imap();}; |
---|
| 286 | trash.innerHTML = "["+get_lang("Clean")+"]"; |
---|
[1965] | 287 | trash.title=get_lang("Empty trash"); |
---|
[1752] | 288 | trash.onmouseover = function() {trash.style.color="red";}; |
---|
[1965] | 289 | trash.onmouseout= function() {trash.style.color="#666666";}; |
---|
[5306] | 290 | document.getElementById(mount_url_folder(["nINBOX",special_folders["Trash"]])+"tree_folders").appendChild(trash); |
---|
[1752] | 291 | } |
---|
[5306] | 292 | if(document.getElementById(mount_url_folder(["nINBOX",special_folders["Spam"]])+"tree_folders")) |
---|
[1965] | 293 | { |
---|
[3035] | 294 | var spam = document.createElement("SPAN"); |
---|
| 295 | spam.id = 'empty_spam'; |
---|
| 296 | spam.className = 'clean_folder'; |
---|
| 297 | spam.style.cursor = 'pointer'; |
---|
| 298 | spam.style.padding = '0 0 0 6px'; |
---|
| 299 | spam.onclick = function () {empty_spam_imap();}; |
---|
| 300 | spam.innerHTML = "["+get_lang("Clean")+"]"; |
---|
| 301 | spam.title=get_lang("Empty Spam Folder"); |
---|
| 302 | spam.onmouseover = function() {spam.style.color="red";}; |
---|
| 303 | spam.onmouseout= function() {spam.style.color="#666666";}; |
---|
[5306] | 304 | document.getElementById(mount_url_folder(["nINBOX",special_folders["Spam"]])+"tree_folders").appendChild(spam); |
---|
[3035] | 305 | } |
---|
[1752] | 306 | |
---|
[1121] | 307 | if(!expresso_offline) |
---|
| 308 | var display_unseen_in_mailbox = tree_folders.getNodeById( 'root' ); |
---|
| 309 | else |
---|
| 310 | var display_unseen_in_mailbox = tree_folders.getNodeById( 'local_root' ); |
---|
[3035] | 311 | display_unseen_in_mailbox.alter({caption:get_lang("My Folders")}); |
---|
[790] | 312 | display_unseen_in_mailbox._refresh(); |
---|
| 313 | |
---|
| 314 | var display_unseen_in_shared_folders = tree_folders.getNodeById( 'user' ); |
---|
| 315 | if ( display_unseen_in_shared_folders ) |
---|
| 316 | { |
---|
| 317 | if ( unseen_in_shared_folders ) |
---|
| 318 | 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")}); |
---|
| 319 | else |
---|
| 320 | display_unseen_in_shared_folders.alter({caption:get_lang("Shared folders")}); |
---|
| 321 | display_unseen_in_shared_folders._refresh(); |
---|
| 322 | } |
---|
[2] | 323 | } |
---|
[790] | 324 | |
---|
[1121] | 325 | if (!expresso_offline) { |
---|
| 326 | var folder_create = ""; |
---|
| 327 | var nm1 = ""; |
---|
| 328 | if(tree_folders._folderPr.length > 0){ |
---|
| 329 | var nm_folder = ""; |
---|
| 330 | for(var i=0; i < tree_folders._folderPr.length; i++){ |
---|
| 331 | nm_folder = tree_folders._folderPr[i].split(cyrus_delimiter); |
---|
| 332 | if(nm_folder[0] == "INBOX"){ |
---|
| 333 | if(nm1 == ""){ |
---|
[2] | 334 | nm1 = nm_folder[1]; |
---|
[1121] | 335 | folder_create = "INBOX" + cyrus_delimiter + nm_folder[1] + ";"; |
---|
| 336 | }else{ |
---|
| 337 | if( nm1 != nm_folder[1]){ |
---|
| 338 | folder_create += "INBOX" + cyrus_delimiter + nm_folder[1] + ";"; |
---|
| 339 | nm1 = nm_folder[1]; |
---|
| 340 | } |
---|
[2] | 341 | } |
---|
| 342 | } |
---|
| 343 | } |
---|
| 344 | } |
---|
| 345 | } |
---|
[5950] | 346 | |
---|
| 347 | outOfficeVerify(); |
---|
[5533] | 348 | } |
---|
[3178] | 349 | |
---|
[5533] | 350 | function draw_tree_labels(){ |
---|
| 351 | labels = DataLayer.get('label',{criteria:{order: 'name'}}); |
---|
[5566] | 352 | if(!$("#MyMarckersList").length) |
---|
| 353 | var myLabels = $('#content_folders').append("<div id='MyMarckersList' class='acc-list list-label' ></div>").find("#MyMarckersList"); |
---|
| 354 | else |
---|
| 355 | var myLabels = $("#MyMarckersList"); |
---|
| 356 | myLabels.html("<div class='my-labels'>" + |
---|
[5533] | 357 | "<img src='../prototype/modules/mail/img/tag.png'/>" + |
---|
[5584] | 358 | "<a class='title-my-labels' tabindex='0' role='button' aria-expanded='false' title='"+get_lang("My Labels")+"'>"+get_lang("My Labels")+"</a>" + |
---|
[5533] | 359 | |
---|
| 360 | "<span class='status-list-labels ui-icon ui-icon-triangle-1-s'></span>" + |
---|
| 361 | "</div>" |
---|
| 362 | ) |
---|
| 363 | .append(DataLayer.render("../prototype/modules/mail/templates/label_list.ejs", {labels: labels} )) |
---|
[5612] | 364 | .find("li.label-item").css({"background-color":"#ffffff", "border-color":"#CCCCCC", "color":"#444444"}).click(function(event,ui){ |
---|
[5623] | 365 | if($(event.target).is('.square-color')){ |
---|
| 366 | $(this).each(function(){ |
---|
| 367 | configureLabels({selectedItem: $(this).attr('class').match(/label-item-([\d]+[()a-zA-Z]*)/)[1]}); |
---|
| 368 | var id_label_item = $(this).attr('class').match(/label-item-([\d]+[()a-zA-Z]*)/)[1]; |
---|
| 369 | $(".label-list-container .label-list").find(".label-item-"+id_label_item).trigger("click"); |
---|
| 370 | }); |
---|
| 371 | } else { |
---|
| 372 | var labelId = $(this).attr('class').match(/label-item-([\d]+[()a-zA-Z]*)/)[1]; |
---|
| 373 | search_emails("UNDELETED KEYWORD \"$Label"+labelId+"\""); |
---|
[5612] | 374 | } |
---|
[5624] | 375 | }).find(".square-color").css("display",""); |
---|
| 376 | |
---|
[5713] | 377 | $("#MyMarckersList a.title-my-labels").click(function() { |
---|
| 378 | if($("#MyMarckersList ul.label-list").css("display") == "none"){ |
---|
| 379 | $("#MyMarckersList ul.label-list").show(); |
---|
| 380 | }else{ |
---|
| 381 | $("#MyMarckersList ul.label-list").hide(); |
---|
| 382 | } |
---|
[5533] | 383 | $('#MyMarckersList .status-list-labels').toggleClass("ui-icon-triangle-1-s"); |
---|
[5713] | 384 | $('#MyMarckersList .status-list-labels').toggleClass("ui-icon-triangle-1-n"); |
---|
[5533] | 385 | }); |
---|
[5713] | 386 | |
---|
[5533] | 387 | if (!labels){ |
---|
[5713] | 388 | $(".my-labels").hide(); |
---|
[5533] | 389 | } |
---|
[2] | 390 | } |
---|
| 391 | |
---|
[1938] | 392 | function draw_tree_local_folders() { |
---|
| 393 | /** |
---|
| 394 | * Pastas locais |
---|
| 395 | */ |
---|
[4826] | 396 | if(preferences.use_local_messages==1 || expresso_offline) { |
---|
| 397 | var local_folders = expresso_local_messages.list_local_folders(); |
---|
| 398 | var has_changes = false; |
---|
| 399 | for (var i in local_folders) { //Coloca as pastas locais. |
---|
[3035] | 400 | |
---|
[4826] | 401 | var new_caption = local_folders[i][0]; |
---|
| 402 | if(local_folders[i][0].indexOf("/")!="-1") { |
---|
| 403 | final_pos = local_folders[i][0].lastIndexOf("/"); |
---|
| 404 | new_caption = local_folders[i][0].substr(final_pos+1); |
---|
| 405 | } |
---|
[3035] | 406 | |
---|
[4826] | 407 | var folder_unseen = Element('dftree_local_'+local_folders[i][0]+'_unseen'); |
---|
[3035] | 408 | |
---|
[4826] | 409 | if ((folder_unseen) && (local_folders[i][1] > 0)) |
---|
| 410 | { |
---|
| 411 | folder_unseen.innerHTML = local_folders[i][1]; |
---|
| 412 | has_changes = true; |
---|
| 413 | } |
---|
| 414 | else if (local_folders[i][1] > 0) |
---|
| 415 | { |
---|
| 416 | 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>'}); |
---|
| 417 | tree_folders.getNodeById("local_"+local_folders[i][0])._refresh(); |
---|
| 418 | has_changes = true; |
---|
| 419 | } |
---|
| 420 | else if (local_folders[i][1] <= 0) |
---|
| 421 | { |
---|
| 422 | tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(new_caption)}); |
---|
| 423 | tree_folders.getNodeById("local_"+local_folders[i][0])._refresh(); |
---|
| 424 | has_changes = true; |
---|
| 425 | } |
---|
[1938] | 426 | |
---|
[3035] | 427 | if("local_"+local_folders[i][0] == get_current_folder()){ |
---|
[4826] | 428 | var old_new_m = isNaN(parseInt(Element('new_m').innerHTML)) ? parseInt(Element('new_m').firstChild.innerHTML) : parseInt(Element('new_m').innerHTML); |
---|
| 429 | if(!isNaN(old_new_m) && old_new_m < local_folders[i][1]){ |
---|
| 430 | Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) + (parseInt(local_folders[i][1])-old_new_m); |
---|
| 431 | } |
---|
| 432 | Element('new_m').innerHTML = local_folders[i][1] ? '<font color="RED">'+local_folders[i][1]+'</font>' : 0; |
---|
| 433 | draw_paging(Element('tot_m').innerHTML); |
---|
| 434 | has_changes = true; |
---|
[1938] | 435 | } |
---|
| 436 | } |
---|
[4826] | 437 | if(has_changes) |
---|
| 438 | tree_folders.getNodeById("local_root").open(); |
---|
| 439 | } |
---|
| 440 | } |
---|
[1938] | 441 | |
---|
[4826] | 442 | |
---|
| 443 | function update_local_box(){ |
---|
| 444 | msg_range_end = (current_page*preferences.max_email_per_page); |
---|
| 445 | msg_range_begin = (msg_range_end-(preferences.max_email_per_page)+1); |
---|
| 446 | folder=get_current_folder(); |
---|
| 447 | 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); |
---|
[6997] | 448 | //alternate_border(0); |
---|
[4826] | 449 | draw_box(msgs, folder, true); |
---|
| 450 | draw_paging(msgs.num_msgs); |
---|
| 451 | Element("tot_m").innerHTML = msgs.num_msgs; |
---|
| 452 | update_menu(); |
---|
[1938] | 453 | } |
---|
| 454 | |
---|
[2] | 455 | function update_menu(data){ |
---|
[446] | 456 | /* |
---|
| 457 | * @AUTHOR Rodrigo Souza dos Santos |
---|
| 458 | * @DATE 2008/09/15 |
---|
| 459 | * @BRIEF When occurs a error in imap server show the message that is in file "error.html". |
---|
| 460 | */ |
---|
| 461 | if ( data && data.imap_error ) |
---|
| 462 | { |
---|
[1964] | 463 | if(preferences.use_local_messages==1 && expresso_local_messages.is_offline_installed){ |
---|
| 464 | 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?")); |
---|
| 465 | if(conf) { |
---|
| 466 | window.onresize = function() { |
---|
| 467 | var target = document.getElementById('divAppbox'); |
---|
| 468 | target.style.height= document.body.clientHeight - 83; |
---|
| 469 | } |
---|
| 470 | var target = document.getElementById('divAppbox'); |
---|
| 471 | document.getElementById("divAppboxHeader").innerHTML=""; |
---|
| 472 | target.style.height= document.body.clientHeight - 83; |
---|
| 473 | expresso_local_messages.set_as_logged(account_id,0,true); |
---|
| 474 | target.innerHTML = "<iframe src='offline.php?inside=1' width='100%' height='100%' frameBorder='0'></iframe>"; |
---|
| 475 | return false; |
---|
| 476 | } |
---|
| 477 | } |
---|
[790] | 478 | connector.newRequest('error.html', 'templates/'+template+'/error.html', 'GET', |
---|
[446] | 479 | function(data) |
---|
| 480 | { |
---|
| 481 | var target = document.getElementById('divAppbox'); |
---|
| 482 | if ( target ) |
---|
| 483 | target.innerHTML = data; |
---|
| 484 | } |
---|
| 485 | ); |
---|
| 486 | return false; |
---|
| 487 | } |
---|
[5486] | 488 | |
---|
| 489 | |
---|
[2] | 490 | if(data) { |
---|
[5486] | 491 | draw_tree_folders(data); |
---|
[5754] | 492 | draw_quota(data); |
---|
[790] | 493 | var f_unseen = Element('dftree_'+current_folder+'_unseen'); |
---|
[2] | 494 | if(f_unseen && f_unseen.innerHTML) |
---|
| 495 | Element('new_m').innerHTML = '<font face="Verdana" size="1" color="RED">'+f_unseen.innerHTML+'</font>'; |
---|
| 496 | else |
---|
[320] | 497 | { |
---|
| 498 | if( parseInt(Element('new_m').innerHTML) == 0 ) |
---|
[3035] | 499 | Element('new_m').innerHTML = 0; |
---|
[320] | 500 | } |
---|
[2] | 501 | folders = data; |
---|
| 502 | } |
---|
[5486] | 503 | draw_new_tree_folder(); |
---|
[5533] | 504 | draw_tree_labels(); |
---|
[5754] | 505 | if(Element("table_quota")) |
---|
| 506 | connector.loadScript("InfoQuota"); |
---|
[5821] | 507 | |
---|
| 508 | if(preferences.enable_quickadd_telephonenumber) |
---|
| 509 | connector.loadScript("QuickAddTelephone"); |
---|
[2] | 510 | } |
---|
| 511 | |
---|
| 512 | var handler_draw_box = function(data){ |
---|
[320] | 513 | draw_box(data, 'INBOX', true); |
---|
| 514 | //alternate_border(0); |
---|
[2] | 515 | } |
---|
| 516 | |
---|
| 517 | // Action on change folders. |
---|
| 518 | function change_folder(folder, folder_name){ |
---|
[607] | 519 | if (openTab.imapBox[0] != folder) |
---|
[2] | 520 | { |
---|
[6930] | 521 | selectAllFolderMsgs(false); |
---|
[2] | 522 | current_folder = folder; |
---|
| 523 | var handler_draw_box = function(data) |
---|
| 524 | { |
---|
[6930] | 525 | |
---|
[2] | 526 | if(!verify_session(data)) |
---|
| 527 | return; |
---|
[6997] | 528 | //alternate_border(0); |
---|
| 529 | |
---|
[5431] | 530 | var title = lang_folder(folder_name); |
---|
[5443] | 531 | if (title.length > 18) title = title.substring(0,18) + "..."; |
---|
[6997] | 532 | $("#ptabs li:first a").html(" " + title + ' <font face="Verdana" size="1" color="#505050">[<span id="new_m"> </span> / <span id="tot_m"></span>]</font>'); |
---|
| 533 | $(ptabs).tabs( "select", 0 ); |
---|
[320] | 534 | draw_box(data, folder, true); |
---|
[2] | 535 | draw_paging(data.num_msgs); |
---|
| 536 | Element("tot_m").innerHTML = data.num_msgs; |
---|
[6939] | 537 | $('#new_m').html(data.tot_unseen > 0 ? data.tot_unseen : "0").css("color","red"); |
---|
| 538 | //$("#new_m").html(($(".selected").find(".folder_unseen").html() != "0" && $(".selected").find(".folder_unseen").html() != null)? $(".selected").find(".folder_unseen").html() : "0").css("color", "red"); |
---|
[5486] | 539 | //update_menu(); |
---|
[5754] | 540 | $(".folders-loading").removeClass("folders-loading"); |
---|
[320] | 541 | return true; |
---|
[2] | 542 | } |
---|
[6930] | 543 | $.ajax({ |
---|
| 544 | url: "controller.php?" + $.param( {action: "$this.imap_functions.get_range_msgs3", |
---|
| 545 | folder: folder, |
---|
| 546 | msg_range_begin: "0", |
---|
| 547 | msg_range_end: "0", |
---|
| 548 | sort_box_type: "SORTARRIVAL", |
---|
| 549 | search_box_type: search_box_type, |
---|
| 550 | sort_box_reverse: "1" |
---|
| 551 | }), |
---|
| 552 | success: function(data){ |
---|
| 553 | data = connector.unserialize(data); |
---|
| 554 | if(data){ |
---|
| 555 | var _data = {}; |
---|
| 556 | $.each(data,function(index,value){ |
---|
| 557 | if (data[index] && data[index].msg_number){ |
---|
| 558 | _data[data[index].msg_number] = data[index].msg_number; |
---|
| 559 | } |
---|
| 560 | }); |
---|
| 561 | populateSelectedMsgs(_data); |
---|
| 562 | _data = {}; |
---|
| 563 | |
---|
| 564 | } |
---|
| 565 | }, |
---|
| 566 | beforeSend: function( jqXHR, settings ){ |
---|
| 567 | connector.showProgressBar(); |
---|
| 568 | }, |
---|
| 569 | complete: function( jqXHR, settings ){ |
---|
| 570 | connector.hideProgressBar(); |
---|
| 571 | } |
---|
| 572 | }); |
---|
[1752] | 573 | 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); |
---|
[689] | 574 | } |
---|
[5516] | 575 | else{ |
---|
[5754] | 576 | $(".folders-loading").removeClass("folders-loading"); |
---|
[320] | 577 | alternate_border(0); |
---|
[5516] | 578 | } |
---|
[320] | 579 | } |
---|
| 580 | |
---|
| 581 | function open_folder(folder, folder_name){ |
---|
[790] | 582 | if (current_folder!= folder) { |
---|
[320] | 583 | current_folder = folder; |
---|
[325] | 584 | var handler_draw_box = function(data){ |
---|
[345] | 585 | if(!verify_session(data)) |
---|
| 586 | return false; |
---|
| 587 | numBox++; |
---|
| 588 | create_border(folder_name,numBox.toString()); |
---|
| 589 | draw_box(data, current_folder, false); |
---|
| 590 | alternate_border(numBox); |
---|
| 591 | return true; |
---|
[320] | 592 | } |
---|
[345] | 593 | 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] | 594 | } |
---|
| 595 | else |
---|
[345] | 596 | alternate_border(numBox); |
---|
| 597 | return true; |
---|
[2] | 598 | } |
---|
| 599 | |
---|
| 600 | var lastPage = 1; |
---|
| 601 | var numPages = 5; |
---|
| 602 | var last_folder = 'INBOX'; |
---|
[3035] | 603 | function draw_paging(num_msgs){ |
---|
[2] | 604 | num_msgs = parseInt(num_msgs); |
---|
| 605 | total_pages = 1; |
---|
| 606 | |
---|
[790] | 607 | if(last_folder != current_folder){ |
---|
[2] | 608 | lastPage = 1; |
---|
| 609 | current_page = 1; |
---|
[790] | 610 | last_folder = current_folder; |
---|
[2] | 611 | } |
---|
| 612 | |
---|
[3035] | 613 | if(num_msgs > parseInt(preferences.max_email_per_page)) { |
---|
[2] | 614 | total_pages = parseInt(num_msgs/preferences.max_email_per_page); |
---|
| 615 | if((num_msgs/preferences.max_email_per_page) > total_pages) |
---|
[3035] | 616 | total_pages++; |
---|
[2] | 617 | } |
---|
| 618 | |
---|
| 619 | if(total_pages == 1) { |
---|
[3393] | 620 | if(span_paging = document.getElementById("span_paging")) { |
---|
[2] | 621 | span_paging.parentNode.removeChild(span_paging); |
---|
| 622 | } |
---|
| 623 | return; |
---|
| 624 | } |
---|
[3393] | 625 | span_paging = document.getElementById("span_paging"); |
---|
[2] | 626 | if(!span_paging){ |
---|
| 627 | span_paging = document.createElement("DIV"); |
---|
[3393] | 628 | span_paging.id = "span_paging"; |
---|
[1247] | 629 | span_paging.className = "boxHeaderText"; |
---|
[2] | 630 | span_paging.align="right"; |
---|
[3035] | 631 | document.getElementById("div_menu_c3").appendChild(span_paging); |
---|
[2] | 632 | } |
---|
[3035] | 633 | span_paging.style.width="100%"; |
---|
[2] | 634 | span_paging.innerHTML=""; |
---|
| 635 | msg_range_begin = 1; |
---|
| 636 | msg_range_end = preferences.max_email_per_page; |
---|
| 637 | if(current_page != 1) { |
---|
| 638 | lnk_page = document.createElement("A"); |
---|
[5134] | 639 | //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());});"); |
---|
| 640 | 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] | 641 | } |
---|
| 642 | else { |
---|
| 643 | lnk_page = document.createElement("SPAN"); |
---|
| 644 | } |
---|
| 645 | span_paging.appendChild(lnk_page); |
---|
| 646 | |
---|
| 647 | lnk_page.innerHTML = "<<"; |
---|
| 648 | lnk_page.title = get_lang("First"); |
---|
| 649 | span_paging.innerHTML += " "; |
---|
[3369] | 650 | |
---|
[2] | 651 | if(current_page == lastPage + numPages) |
---|
[3369] | 652 | lastPage = current_page - 1; |
---|
| 653 | else if((lastPage != 1 && lastPage == current_page) || current_page == total_pages) |
---|
[2] | 654 | lastPage = current_page - (numPages - 1); |
---|
| 655 | else if(current_page == 1) |
---|
| 656 | lastPage = 1; |
---|
| 657 | |
---|
| 658 | if(lastPage < 1) |
---|
| 659 | lastPage = 1; |
---|
| 660 | else if(lastPage > 1 && (lastPage > (total_pages -(numPages - 1)))) |
---|
| 661 | lastPage = total_pages -(numPages - 1); |
---|
| 662 | |
---|
| 663 | var hasMarked = false; |
---|
| 664 | |
---|
| 665 | for(i = lastPage; i <= total_pages; i++) { |
---|
[3369] | 666 | |
---|
| 667 | if(current_page == i || (i == total_pages && !hasMarked)) { |
---|
[5285] | 668 | lnk_page = document.createElement("SPAN"); |
---|
[2] | 669 | span_paging.appendChild(lnk_page); |
---|
[5285] | 670 | lnk_page.style.color = "red"; |
---|
[2] | 671 | lnk_page.innerHTML = " <b>"+i+"</b> "; |
---|
| 672 | hasMarked = true; |
---|
| 673 | continue; |
---|
| 674 | } |
---|
[3369] | 675 | else{ |
---|
[2] | 676 | lnk_page = document.createElement("A"); |
---|
| 677 | span_paging.appendChild(lnk_page); |
---|
| 678 | msg_range_begin = ((i*preferences.max_email_per_page)-(preferences.max_email_per_page-1)); |
---|
| 679 | msg_range_end = (i*preferences.max_email_per_page); |
---|
[5134] | 680 | //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());});"); |
---|
| 681 | 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] | 682 | } |
---|
| 683 | lnk_page.innerHTML = " ... "; |
---|
| 684 | if(i == (lastPage + numPages)) |
---|
[3035] | 685 | break; |
---|
| 686 | else if(lastPage == 1 || i != lastPage) |
---|
[2] | 687 | lnk_page.innerHTML = " "+i+" "; |
---|
[3369] | 688 | span_paging.innerHTML += " "; |
---|
[2] | 689 | } |
---|
[3035] | 690 | |
---|
[2] | 691 | if(current_page != total_pages) { |
---|
| 692 | lnk_page = document.createElement("A"); |
---|
| 693 | msg_range_begin = ((total_pages*preferences.max_email_per_page)-(preferences.max_email_per_page-1)); |
---|
[3369] | 694 | msg_range_end = (total_pages*preferences.max_email_per_page); |
---|
[5134] | 695 | //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());});"); |
---|
| 696 | 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] | 697 | } |
---|
| 698 | else { |
---|
| 699 | lnk_page = document.createElement("SPAN"); |
---|
| 700 | } |
---|
| 701 | span_paging.innerHTML += " "; |
---|
| 702 | span_paging.appendChild(lnk_page); |
---|
| 703 | |
---|
| 704 | lnk_page.title = get_lang("Last"); |
---|
| 705 | lnk_page.innerHTML = ">>"; |
---|
| 706 | } |
---|
| 707 | |
---|
[4062] | 708 | // stores the percentages of the cells |
---|
[5410] | 709 | //var colSizes = [ ["24","24","12","12","12","16","16","20%","58%","11%","11%"], ["16","16","12","12","12","20%","20%","*","10%","10%"] ]; |
---|
[5533] | 710 | //var colSizes = [ ["2%","2%","1%","1%","1%","1%","2%","2%","20%","46%","11%","11%"], ["16","16","12","12","12","20%","20%","*","10%","10%"] ]; |
---|
[5753] | 711 | 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] | 712 | // stores the alignments of the cells |
---|
| 713 | var colAligns = [ ['','','','','','','','left','left','center','center'], ['','','','','','left','left','left','center','center'] ]; |
---|
| 714 | var objCell = null; |
---|
| 715 | var adjCell = null; |
---|
| 716 | var cellClick = null; |
---|
| 717 | var cellResized = false; |
---|
| 718 | var maxWidth=0; |
---|
[4080] | 719 | var minWidth=0; |
---|
[4062] | 720 | var bodyWidth=0; |
---|
[4072] | 721 | var cssForResizing=false; |
---|
[2] | 722 | |
---|
[4062] | 723 | function changeCursorState(ev) { |
---|
| 724 | if (cellResized) |
---|
| 725 | cellResized = false; |
---|
| 726 | var el = ev.target||ev.srcElement; |
---|
| 727 | if (el.tagName != "TD") |
---|
| 728 | el=getFirstParentOfType(el, "TD") |
---|
| 729 | el.style.cursor ="hand"; |
---|
| 730 | el.style.cursor ="pointer"; |
---|
[4072] | 731 | if (!cssForResizing) |
---|
| 732 | return; |
---|
[4062] | 733 | var cellMouseX = (ev.clientX-parseInt(getColumnPosition(el, ev))); |
---|
| 734 | var cellWidth = el.offsetWidth; |
---|
| 735 | var tbl = getFirstParentOfType(el,"TABLE"); |
---|
| 736 | if (tbl.emptyBody) |
---|
| 737 | return; |
---|
[4461] | 738 | if ((((cellWidth-cellMouseX)<15)||((el.style.cursor=="col-resize")&&(detectLeftButton())))&&((el.className=="th_resizable")&&(el.cellIndex+1<el.parentNode.cells.length))){ |
---|
| 739 | if (tbl) tbl.style.cursor = "col-resize"; |
---|
| 740 | el.style.cursor ="col-resize"; |
---|
[4062] | 741 | } |
---|
| 742 | else{ |
---|
| 743 | if (tbl) tbl.style.cursor = "pointer"; |
---|
| 744 | el.style.cursor ="hand"; |
---|
| 745 | el.style.cursor ="pointer"; |
---|
| 746 | } |
---|
| 747 | } |
---|
| 748 | |
---|
[4493] | 749 | function getStyle(el,styleProp) { |
---|
[4072] | 750 | var x = document.getElementById(el); |
---|
| 751 | if (x.currentStyle) |
---|
| 752 | var y = x.currentStyle[styleProp]; |
---|
| 753 | else if (window.getComputedStyle) |
---|
| 754 | var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp); |
---|
| 755 | return y; |
---|
| 756 | } |
---|
| 757 | |
---|
[4062] | 758 | function resizeColumn(ev) { |
---|
| 759 | if (!objCell || !adjCell) { |
---|
| 760 | stopColResize(ev); |
---|
| 761 | return; |
---|
| 762 | } |
---|
| 763 | if (document.getElementById("table_message_header_box_"+numBox).emptyBody) |
---|
| 764 | return; |
---|
[4461] | 765 | if (objCell.style.cursor == "col-resize" && detectLeftButton(ev)) { |
---|
[4062] | 766 | var cellIndex = objCell.cellIndex; |
---|
| 767 | var adjIndex = adjCell.cellIndex; |
---|
[4080] | 768 | var cellOffset = parseInt(getColumnPosition(objCell, ev)); |
---|
| 769 | var cellWidth = (ev.clientX-cellOffset); |
---|
[4062] | 770 | |
---|
| 771 | var tbl = getMessagesTable(objCell); |
---|
| 772 | var trM = tbl.rows; |
---|
| 773 | var tblType = ( (tbl.id=="table_box") ? 0 : 1); |
---|
| 774 | |
---|
[4080] | 775 | if (cellWidth < minWidth) |
---|
| 776 | cellWidth = minWidth; |
---|
[4062] | 777 | var adjWidth = maxWidth - cellWidth; |
---|
[4080] | 778 | if (adjWidth < minWidth) { |
---|
| 779 | cellWidth = (cellWidth+adjWidth)-minWidth; |
---|
| 780 | adjWidth = minWidth; |
---|
[4062] | 781 | } |
---|
| 782 | |
---|
| 783 | colSizes[tblType][adjIndex] = (colSizes[tblType][adjIndex]=="*" ? "*" : getPct(is_ie ? adjWidth : adjWidth-2)); |
---|
| 784 | colSizes[tblType][cellIndex] = (colSizes[tblType][cellIndex]=="*" ? "*" : getPct(cellWidth)); |
---|
| 785 | |
---|
[4080] | 786 | document.getElementById("table_message_ruler").style.left = cellOffset+cellWidth; |
---|
[4062] | 787 | } |
---|
| 788 | ev.returnValue = false; |
---|
| 789 | return (false); |
---|
| 790 | } |
---|
| 791 | |
---|
| 792 | function getPct(tdWidth) { |
---|
| 793 | var suf = tdWidth.toString().substr(tdWidth.length-1,1); |
---|
| 794 | if ( suf != "%" && suf != "*") |
---|
| 795 | return (Math.round((tdWidth/bodyWidth)*10000)/100).toString()+"%"; |
---|
| 796 | else |
---|
| 797 | return tdWidth; |
---|
| 798 | } |
---|
| 799 | |
---|
| 800 | function detectLeftButton(ev) { |
---|
| 801 | ev = ev || window.event; |
---|
| 802 | var button = ev.which || ev.button; |
---|
| 803 | return (button == 1); |
---|
| 804 | } |
---|
| 805 | |
---|
| 806 | function startColResize(ev) { |
---|
| 807 | var el = ev.target||ev.srcElement; |
---|
| 808 | if (el.tagName != "TD") |
---|
| 809 | el=getFirstParentOfType(el, "TD") |
---|
| 810 | if (is_ie) |
---|
| 811 | ev.cancelBubble = true; |
---|
| 812 | else |
---|
| 813 | ev.stopPropagation(); |
---|
| 814 | if (!el) return; |
---|
| 815 | if (!is_ie) ev.preventDefault(); |
---|
| 816 | if (document.getElementById("table_message_header_box_"+numBox).emptyBody) |
---|
| 817 | return; |
---|
[4461] | 818 | if (el.style.cursor == "col-resize" && detectLeftButton(ev)) { |
---|
[4062] | 819 | var incIndex = ( (el.parentNode.cells.length > el.cellIndex + 1) ? 1 : -1 ); |
---|
| 820 | var msgTable = getMessagesTable(el); |
---|
| 821 | var bodyRows = msgTable.rows; |
---|
| 822 | objCell = el; |
---|
| 823 | adjCell = el.parentNode.cells[el.cellIndex+incIndex]; |
---|
| 824 | var tbl = getFirstParentOfType(el, "TABLE"); |
---|
| 825 | if (is_ie) { |
---|
| 826 | tbl.detachEvent("onmousemove",changeCursorState); |
---|
| 827 | document.attachEvent("onmousemove",resizeColumn); |
---|
| 828 | document.attachEvent("onmouseup",stopColResize); |
---|
| 829 | document.attachEvent("onselect",selectCancel); |
---|
| 830 | tbl.attachEvent("onselectstart",selectCancel); |
---|
| 831 | } |
---|
| 832 | else { |
---|
| 833 | tbl.removeEventListener("mousemove",changeCursorState,false); |
---|
| 834 | document.addEventListener("mousemove",resizeColumn,false); |
---|
| 835 | document.addEventListener("mouseup",stopColResize,false); |
---|
| 836 | document.addEventListener("select",selectCancel,false); |
---|
| 837 | tbl.addEventListener("selectstart",selectCancel,false); |
---|
| 838 | } |
---|
| 839 | cellClick = objCell.onclick; |
---|
| 840 | objCell.onclick = ""; |
---|
| 841 | maxWidth = objCell.offsetWidth+adjCell.offsetWidth; |
---|
| 842 | bodyWidth = msgTable.offsetWidth; |
---|
[4080] | 843 | minWidth = Math.round(bodyWidth/80); |
---|
[4062] | 844 | document.getElementById("table_message_ruler").style.display = "block"; |
---|
| 845 | document.getElementById("table_message_ruler").style.left = ev.clientX; |
---|
| 846 | if (document.getElementById("content_id_"+numBox)==null) |
---|
[4807] | 847 | document.getElementById("table_message_ruler").style.height = document.getElementById("content_id_"+currentTab).offsetHeight; |
---|
[4062] | 848 | else |
---|
| 849 | document.getElementById("table_message_ruler").style.height = document.getElementById("content_id_"+numBox).offsetHeight; |
---|
| 850 | } |
---|
| 851 | } |
---|
| 852 | |
---|
| 853 | function stopColResize(ev) { |
---|
| 854 | if (!objCell) |
---|
| 855 | return; |
---|
| 856 | if (is_ie) |
---|
| 857 | ev.cancelBubble = true; |
---|
| 858 | else |
---|
| 859 | ev.stopPropagation(); |
---|
| 860 | var tbl = getFirstParentOfType(objCell, "TABLE"); |
---|
| 861 | if (is_ie) { |
---|
| 862 | tbl.detachEvent("onselectstart",selectCancel); |
---|
| 863 | document.detachEvent("onselect",selectCancel); |
---|
| 864 | document.detachEvent("onmousemove",resizeColumn); |
---|
| 865 | document.detachEvent("onmouseup",stopColResize); |
---|
| 866 | tbl.attachEvent("onmousemove",changeCursorState); |
---|
| 867 | } |
---|
| 868 | else { |
---|
| 869 | tbl.removeEventListener("selectstart",selectCancel,false); |
---|
| 870 | document.removeEventListener("select",selectCancel,false); |
---|
| 871 | document.removeEventListener("mousemove",resizeColumn,false); |
---|
| 872 | document.removeEventListener("mouseup",stopColResize,false); |
---|
| 873 | tbl.addEventListener("mousemove",changeCursorState,false); |
---|
| 874 | } |
---|
| 875 | var trM = getMessagesTable(objCell).rows; |
---|
| 876 | var adjIndex = adjCell.cellIndex; |
---|
| 877 | document.getElementById("table_message_ruler").style.display = "none"; |
---|
| 878 | maxWidth = 0; |
---|
| 879 | objCell.onclick = cellClick; |
---|
| 880 | objCell = null; |
---|
| 881 | adjCell = null; |
---|
| 882 | cellResized = true; |
---|
[4072] | 883 | setColSizesCookie(); |
---|
| 884 | syncColumns(); |
---|
[4062] | 885 | } |
---|
| 886 | |
---|
| 887 | function getMessagesTable(el) { |
---|
| 888 | var hT; |
---|
| 889 | if (el.tagName == "TABLE") |
---|
| 890 | hT = el; |
---|
| 891 | else |
---|
| 892 | hT = getFirstParentOfType(el,"TABLE"); |
---|
[5134] | 893 | return (hT.parentNode.nextSibling.childNodes[0].className !== "local-messages-search-warning"? |
---|
| 894 | hT.parentNode.nextSibling.childNodes[0] : hT.parentNode.nextSibling.childNodes[1]); |
---|
[4062] | 895 | } |
---|
| 896 | |
---|
| 897 | function getColumnPosition(oNode, pNode){ |
---|
| 898 | if (!pNode && !is_webkit){ |
---|
| 899 | var pos = getOffset(oNode); |
---|
| 900 | return [pos.left, pos.top]; |
---|
| 901 | } |
---|
| 902 | pNode = pNode||document.body; |
---|
| 903 | |
---|
| 904 | var oCurrentNode = oNode; |
---|
| 905 | var iLeft = 0; |
---|
| 906 | var iTop = 0; |
---|
| 907 | |
---|
| 908 | while ((oCurrentNode)&&(oCurrentNode != pNode)){ |
---|
| 909 | iLeft+=oCurrentNode.offsetLeft-oCurrentNode.scrollLeft; |
---|
| 910 | iTop+=oCurrentNode.offsetTop-oCurrentNode.scrollTop; |
---|
| 911 | oCurrentNode=oCurrentNode.offsetParent; |
---|
| 912 | } |
---|
| 913 | |
---|
| 914 | return [iLeft, iTop]; |
---|
| 915 | } |
---|
| 916 | |
---|
| 917 | function getFirstParentOfType(obj, tag){ |
---|
| 918 | while (obj&&obj.tagName != tag&&obj.tagName != "BODY"){ |
---|
| 919 | obj=obj.parentNode; |
---|
| 920 | } |
---|
| 921 | return obj; |
---|
| 922 | } |
---|
| 923 | |
---|
| 924 | function syncColumns() { |
---|
| 925 | var thisCell; |
---|
| 926 | var tbl = (document.getElementById("content_id_"+numBox)==null ? 1 : 0); |
---|
| 927 | if (objCell) |
---|
| 928 | thisCell = objCell; |
---|
| 929 | else |
---|
| 930 | thisCell = document.getElementById("table_message_header_box_"+numBox).rows[0].cells[0]; |
---|
[4189] | 931 | var emptyBody = document.getElementById("table_message_header_box_"+numBox).emptyBody; |
---|
[4062] | 932 | var tbH = getFirstParentOfType(thisCell,"TABLE"); |
---|
| 933 | var tbM = getMessagesTable(thisCell); |
---|
| 934 | var trM = tbM.rows; |
---|
[4813] | 935 | var _mouse_over; |
---|
| 936 | var _mouse_out; |
---|
| 937 | var _cell; |
---|
[4062] | 938 | for (var r=0;r<trM.length;r++) { |
---|
| 939 | for (var c=0;c<trM[r].cells.length;c++) { |
---|
[4813] | 940 | _cell = trM[r].cells[c]; |
---|
| 941 | _cell.setAttribute("width",colSizes[tbl][c]); |
---|
[4062] | 942 | if (is_mozilla && !is_webkit) { |
---|
[4810] | 943 | if (!emptyBody) { |
---|
[6930] | 944 | document.getElementById("colgroup_main_"+numBox).childNodes[c].setAttribute("width",colSizes[tbl][c]); |
---|
[4810] | 945 | } |
---|
[6930] | 946 | document.getElementById("colgroup_head_"+numBox).childNodes[c].setAttribute("width",colSizes[tbl][c]); |
---|
[4810] | 947 | if (tbH.rows[0].cells[c].className=="th_resizable") { |
---|
[4813] | 948 | // lots of stupid fixes for FF to redraw cell content |
---|
[4814] | 949 | if (_cell.childNodes && _cell.childNodes.length>1) { |
---|
[4813] | 950 | _mouse_over = _cell.childNodes[1].onmouseover; |
---|
| 951 | _mouse_out = _cell.childNodes[1].onmouseout; |
---|
| 952 | } |
---|
| 953 | _cell.innerHTML = trM[r].cells[c].innerHTML; |
---|
[4814] | 954 | if (_cell.childNodes && _cell.childNodes.length>1) { |
---|
[4813] | 955 | _cell.childNodes[1].onmouseover = _mouse_over; |
---|
| 956 | _cell.childNodes[1].onmouseout = _mouse_out; |
---|
| 957 | } |
---|
| 958 | tbH.rows[0].cells[c].innerHTML = tbH.rows[0].cells[c].innerHTML; |
---|
| 959 | } |
---|
[4062] | 960 | } |
---|
[4080] | 961 | else { |
---|
[4813] | 962 | tbH.rows[0].cells[c].setAttribute("width",_cell.offsetWidth); |
---|
[6930] | 963 | } |
---|
[4062] | 964 | } |
---|
| 965 | } |
---|
[6232] | 966 | |
---|
[5280] | 967 | //bug do firefox ao redefinir os tamanhos das colunas |
---|
[6232] | 968 | if (is_mozilla && !is_webkit){ |
---|
| 969 | if(trM[r]) |
---|
| 970 | for (var c=0;c<trM[r].cells.length;c++) |
---|
| 971 | document.getElementById("colgroup_main_"+numBox).childNodes[c].setAttribute("width",colSizes[tbl][c]); |
---|
| 972 | |
---|
| 973 | } |
---|
[6549] | 974 | if (is_webkit || is_ie){ |
---|
| 975 | var arrHeader = $('.message_header td'); |
---|
| 976 | var arrBody = $('#tbody_box :first td'); |
---|
| 977 | for(i=0;i<arrHeader.length;i++){ |
---|
[6642] | 978 | if(arrBody[i] !== undefined && arrBody[i].width !== undefined) |
---|
[6549] | 979 | arrHeader[i].width = arrBody[i].width; |
---|
| 980 | } |
---|
| 981 | } |
---|
[4062] | 982 | } |
---|
| 983 | |
---|
| 984 | function selectCancel(ev) { |
---|
| 985 | return (false); |
---|
| 986 | } |
---|
| 987 | |
---|
| 988 | function buildColGroup(tbl) { |
---|
| 989 | var col_element; |
---|
| 990 | var colgr_element = document.createElement("COLGROUP"); |
---|
| 991 | if (tbl==null) tbl = 0; |
---|
| 992 | for (i=0;i<colSizes[tbl].length;i++) { |
---|
| 993 | col_element = document.createElement("COL"); |
---|
| 994 | col_element.setAttribute("align", colAligns[tbl][i]); |
---|
| 995 | colgr_element.appendChild(col_element); |
---|
| 996 | } |
---|
| 997 | return (colgr_element); |
---|
| 998 | } |
---|
| 999 | |
---|
| 1000 | function createTDElement(table_list,col_index,class_name,td_align,td_id) { |
---|
| 1001 | var td_element = document.createElement("TD"); |
---|
| 1002 | td_element.setAttribute("width",colSizes[table_list][col_index]); |
---|
| 1003 | if (class_name) td_element.className = class_name; |
---|
| 1004 | if (td_align) td_element.align = td_align; |
---|
| 1005 | if (td_id) td_element.id = td_id; |
---|
| 1006 | return (td_element); |
---|
| 1007 | } |
---|
| 1008 | |
---|
[4072] | 1009 | function prepareColSizesArray() { |
---|
| 1010 | var colSizesCookie = getColSizesCookie(); |
---|
| 1011 | if (colSizesCookie) { |
---|
| 1012 | try { |
---|
| 1013 | var colSizesA = colSizesCookie.split(":"); |
---|
| 1014 | colSizes = [colSizesA[0].split(","),colSizesA[1].split(",")]; |
---|
| 1015 | } |
---|
| 1016 | catch(e) {} |
---|
| 1017 | } |
---|
| 1018 | } |
---|
[4493] | 1019 | |
---|
[4072] | 1020 | function setColSizesCookie() { |
---|
| 1021 | var str = "maillist_colsizes=" + colSizes[0].join() + ":" + colSizes[1].join(); |
---|
| 1022 | var date = new Date(); |
---|
| 1023 | date.setTime(date.getTime()+(365*24*60*60*1000)); |
---|
| 1024 | str += ("; expires="+date.toGMTString()); |
---|
| 1025 | document.cookie = str; |
---|
| 1026 | } |
---|
[4493] | 1027 | |
---|
[4072] | 1028 | function getColSizesCookie() { |
---|
| 1029 | var search = "maillist_colsizes="; |
---|
| 1030 | if (document.cookie.length > 0) { |
---|
| 1031 | var offset = document.cookie.indexOf(search); |
---|
| 1032 | if (offset != -1) { |
---|
| 1033 | offset += search.length; |
---|
| 1034 | var end = document.cookie.indexOf(";", offset); |
---|
| 1035 | if (end == -1) |
---|
| 1036 | end = document.cookie.length; |
---|
| 1037 | return document.cookie.substring(offset, end); |
---|
| 1038 | } |
---|
| 1039 | } |
---|
| 1040 | return null; |
---|
| 1041 | } |
---|
| 1042 | |
---|
[6930] | 1043 | |
---|
[7043] | 1044 | /*Cria a div que permite a seleᅵᅵo de todas as mensagens*/ |
---|
[6930] | 1045 | function drawSelectMsgsTable(){ |
---|
| 1046 | var div = $('<div>'); |
---|
| 1047 | div.attr('class','select-all-messages'); |
---|
[6975] | 1048 | $('#content_id_0').first().prepend(div); |
---|
[6930] | 1049 | div.css('display','none'); |
---|
| 1050 | } |
---|
| 1051 | |
---|
| 1052 | function totalSelected(){ |
---|
| 1053 | var total = 0; |
---|
| 1054 | for(var obj in selectedPagingMsgs) |
---|
| 1055 | if (selectedPagingMsgs[obj] == true) |
---|
| 1056 | total++; |
---|
| 1057 | return total; |
---|
| 1058 | }; |
---|
| 1059 | |
---|
| 1060 | /*Atualiza o array de mensagens selecionadas*/ |
---|
| 1061 | function updateSelectedMsgs(selected,msg_number){ |
---|
| 1062 | var folder = $('#content_folders .folder.selected').attr('title'); |
---|
| 1063 | folder = folder ? folder : get_lang('INBOX'); |
---|
| 1064 | folder = folder.length > 70 ? '"'+folder.substr(0,70) + "..." +'"': '"'+folder+'"' ; |
---|
| 1065 | var div = $('.select-all-messages'); |
---|
| 1066 | var filterFlag = search_box_type != "ALL" ? '"' + get_lang(search_box_type) + "s" + '"': ""; |
---|
[7043] | 1067 | /*Seleciona as mensagens ao navegar pelas pï¿œginas*/ |
---|
[6930] | 1068 | if (allMsgsSelected && msg_number == undefined){ |
---|
| 1069 | $('.checkbox').each(function(){ |
---|
| 1070 | $(this).attr('checked', true); |
---|
| 1071 | $(this).parent().parent().addClass('selected_msg'); |
---|
| 1072 | }); |
---|
| 1073 | } |
---|
| 1074 | else if (msg_number == undefined){ |
---|
| 1075 | for(var obj in selectedPagingMsgs){ |
---|
| 1076 | if (selectedPagingMsgs[obj] == true){ |
---|
| 1077 | $('#check_box_message_'+obj).attr('checked', true); |
---|
| 1078 | $('#check_box_message_'+obj).parent().parent().addClass('selected_msg'); |
---|
| 1079 | } |
---|
| 1080 | } |
---|
| 1081 | } |
---|
| 1082 | if (selected && msg_number != undefined){ |
---|
| 1083 | selectedPagingMsgs[msg_number] = true; |
---|
| 1084 | $(this).parent().parent().addClass('selected_msg'); |
---|
| 1085 | } |
---|
| 1086 | else if(!selected && msg_number != undefined){ |
---|
| 1087 | selectedPagingMsgs[msg_number] = false; |
---|
| 1088 | $(this).parent().parent().removeClass('selected_msg'); |
---|
| 1089 | allMsgsSelected = false; |
---|
| 1090 | $('#chk_box_select_all_messages').attr('checked',false); |
---|
| 1091 | } |
---|
| 1092 | var tSelected = totalSelected(); |
---|
| 1093 | /*Todas as mensagens selecionadas uma a uma*/ |
---|
| 1094 | if (tSelected > 0 && tSelected == totalFolderMsgs){ |
---|
| 1095 | allMsgsSelected = true; |
---|
| 1096 | $('#chk_box_select_all_messages').attr('checked',true); |
---|
| 1097 | if (total_pages > 1){ |
---|
[7043] | 1098 | var link = "<a class='select-link' href='#'>Limpar seleᅵᅵo?</a>"; |
---|
[6930] | 1099 | var info = "Todas as <b>"+totalFolderMsgs+"</b> mensagens "+filterFlag+" em "+folder+" foram selecionadas. "+link; |
---|
| 1100 | div.html("<span>"+info+"<span>"); |
---|
| 1101 | div.show(); |
---|
| 1102 | $('.select-link').bind('click',function(){selectAllFolderMsgs();$('.select-link').unbind('click');}); |
---|
| 1103 | } |
---|
| 1104 | } |
---|
| 1105 | /*Se foram selecionadas algumas mensagens*/ |
---|
| 1106 | else if (tSelected > 0 && !allMsgsSelected && total_pages > 1){ |
---|
| 1107 | $('#chk_box_select_all_messages').attr('checked',false); |
---|
[7043] | 1108 | var link = "<a class='select-link' href='#'>Limpar seleᅵᅵo?</a>"; |
---|
[6930] | 1109 | if (tSelected == 1){ |
---|
| 1110 | var info = "Foi selecionada <b>"+tSelected+"</b> mensagem "+filterFlag+" em "+folder+". "+link; |
---|
| 1111 | } |
---|
| 1112 | else{ |
---|
| 1113 | var info = "Foram selecionadas <b>"+tSelected+"</b> mensagens "+filterFlag+" em "+folder+". "+link; |
---|
| 1114 | } |
---|
| 1115 | div.html("<span>"+info+"<span>"); |
---|
| 1116 | div.show(); |
---|
| 1117 | $('.select-link').bind('click',function(){ |
---|
| 1118 | selectAllFolderMsgs(); |
---|
| 1119 | $('.select-link').unbind('click'); |
---|
| 1120 | }); |
---|
| 1121 | } |
---|
| 1122 | else if (allMsgsSelected && total_pages > 1){ |
---|
[7043] | 1123 | var link = "<a class='select-link' href='#'>Limpar seleᅵᅵo?</a>"; |
---|
[6930] | 1124 | var info = "Todas as <b>"+totalFolderMsgs+"</b> mensagens "+filterFlag+" em "+folder+" foram selecionadas. "+link; |
---|
| 1125 | div.html("<span>"+info+"<span>"); |
---|
| 1126 | div.show(); |
---|
| 1127 | $('.select-link').bind('click',function(){ |
---|
| 1128 | selectAllFolderMsgs(); |
---|
| 1129 | $('.select-link').unbind('click'); |
---|
| 1130 | }); |
---|
| 1131 | } |
---|
| 1132 | else{ |
---|
| 1133 | div.hide(); |
---|
| 1134 | } |
---|
| 1135 | resizeWindow(); |
---|
| 1136 | } |
---|
| 1137 | |
---|
| 1138 | /*Seleciona ou desseleciona todas as mensagens da pasta*/ |
---|
| 1139 | function selectAllFolderMsgs(select){ |
---|
| 1140 | var folder = $('#content_folders .folder.selected').attr('title'); |
---|
| 1141 | folder = folder ? folder : get_lang('INBOX'); |
---|
| 1142 | folder = folder.length > 70 ? '"'+folder.substr(0,70) + "..." +'"': '"'+folder+'"' ; |
---|
| 1143 | var filterFlag = search_box_type != "ALL" ? get_lang(search_box_type) + "s": ""; |
---|
| 1144 | var div = $('.select-all-messages'); |
---|
| 1145 | if (select){ |
---|
| 1146 | allMsgsSelected = true; |
---|
[7043] | 1147 | var link = "<a class='select-link' href='#'>Limpar seleᅵᅵo?</a>"; |
---|
[6930] | 1148 | var info = "Todas as <b>"+totalFolderMsgs+"</b> mensagens "+filterFlag+" em "+folder+" foram selecionadas. "+link; |
---|
| 1149 | div.html("<span>"+info+"<span>"); |
---|
| 1150 | div.show(); |
---|
| 1151 | $('.select-link').bind('click',function(){ |
---|
| 1152 | selectAllFolderMsgs(); |
---|
| 1153 | $('.select-link').unbind('click'); |
---|
| 1154 | }); |
---|
| 1155 | for(var obj in selectedPagingMsgs){ |
---|
| 1156 | selectedPagingMsgs[obj] = true; |
---|
| 1157 | } |
---|
| 1158 | |
---|
| 1159 | }else{ |
---|
| 1160 | allMsgsSelected = false; |
---|
| 1161 | for(var obj in selectedPagingMsgs){ |
---|
| 1162 | $("#content_id_0").find('input[type="checkbox"]').removeAttr("checked"); |
---|
| 1163 | selectedPagingMsgs[obj] = false; |
---|
| 1164 | $('#check_box_message_'+obj).parent().parent().removeClass('selected_msg selected_shortcut_msg'); |
---|
| 1165 | } |
---|
| 1166 | div.hide(); |
---|
| 1167 | } |
---|
| 1168 | resizeWindow(); |
---|
| 1169 | } |
---|
| 1170 | |
---|
| 1171 | /*Carrega o array de mensagens da pasta*/ |
---|
| 1172 | function populateSelectedMsgs(data){ |
---|
| 1173 | this.selectedPagingMsgs = {}; |
---|
| 1174 | this.totalFolderMsgs = 0; |
---|
| 1175 | var total = 0; |
---|
| 1176 | $.each(data, function(index, value){ |
---|
| 1177 | if(value != undefined){ |
---|
| 1178 | selectedPagingMsgs[value] = false; |
---|
| 1179 | total++; |
---|
| 1180 | } |
---|
| 1181 | }); |
---|
| 1182 | delete selectedPagingMsgs[undefined]; |
---|
| 1183 | allMsgsSelected = false; |
---|
| 1184 | this.totalFolderMsgs = total; |
---|
| 1185 | } |
---|
| 1186 | |
---|
[2] | 1187 | // Draw the inbox and another folders |
---|
[320] | 1188 | function draw_box(headers_msgs, msg_folder, alternate){ |
---|
[5533] | 1189 | /* |
---|
[4087] | 1190 | * When the paging response is not in the correct folder you need to change folder |
---|
| 1191 | * This occurs when the Ajax response is not fast enough and the user click in outher |
---|
| 1192 | * folder before finishing the Ajax request |
---|
| 1193 | */ |
---|
| 1194 | if (msg_folder != headers_msgs['folder']) { |
---|
| 1195 | |
---|
| 1196 | if (headers_msgs['folder']) { |
---|
| 1197 | array_folder = headers_msgs['folder'].split('/'); |
---|
| 1198 | |
---|
| 1199 | if (array_folder.length > 1) { |
---|
| 1200 | name_folder = array_folder[1]; |
---|
| 1201 | } |
---|
| 1202 | else { |
---|
| 1203 | name_folder = headers_msgs['folder']; |
---|
| 1204 | } |
---|
| 1205 | current_folder = headers_msgs['folder']; |
---|
| 1206 | 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>'; |
---|
| 1207 | |
---|
| 1208 | Element('new_m').innerHTML = headers_msgs['tot_unseen'] ? '<font color="RED">'+headers_msgs['tot_unseen']+'</font>' : 0; |
---|
| 1209 | Element("tot_m").innerHTML = headers_msgs['num_msgs']; |
---|
| 1210 | |
---|
| 1211 | tree_folders.getNodeById(headers_msgs['folder'])._select(); |
---|
| 1212 | } |
---|
| 1213 | } |
---|
[5533] | 1214 | /** |
---|
| 1215 | * Preenche a estrutura de cache de mensagens para posterior consulta de |
---|
[7043] | 1216 | * informaᅵᅵes sobre as mensagens no escopo global. |
---|
[5533] | 1217 | */ |
---|
| 1218 | for (var i=0; i<headers_msgs.length; i++) { |
---|
| 1219 | if (!onceOpenedHeadersMessages[current_folder]) |
---|
| 1220 | onceOpenedHeadersMessages[current_folder] = {}; |
---|
| 1221 | onceOpenedHeadersMessages[current_folder][headers_msgs[i].msg_number] = headers_msgs[i]; |
---|
| 1222 | } |
---|
| 1223 | |
---|
[320] | 1224 | if (alternate) |
---|
| 1225 | kill_current_box(); |
---|
[3035] | 1226 | |
---|
[7043] | 1227 | //if(is_ie) |
---|
| 1228 | // document.getElementById("border_table").width = "99.5%"; |
---|
[2] | 1229 | |
---|
[7043] | 1230 | numBox = 0; //As pastas sempre estarï¿œo na aba 0 |
---|
[5134] | 1231 | |
---|
[6997] | 1232 | openTab.content_id[numBox] = document.getElementById("ui-tabs-"+numBox); |
---|
| 1233 | //openTab.content_id[numBox].innerHTML = ""; |
---|
[607] | 1234 | openTab.imapBox[numBox] = msg_folder; |
---|
[790] | 1235 | openTab.type[numBox] = 0; |
---|
[3035] | 1236 | |
---|
[320] | 1237 | table_message_header_box = document.getElementById("table_message_header_box_"+numBox); |
---|
[4072] | 1238 | if (table_message_header_box == null) { |
---|
[2] | 1239 | var table_element = document.createElement("TABLE"); |
---|
[4062] | 1240 | var colgr_element = buildColGroup(); |
---|
| 1241 | colgr_element.setAttribute("id","colgroup_head_"+numBox); |
---|
[2] | 1242 | var tbody_element = document.createElement("TBODY"); |
---|
[4062] | 1243 | //add events for column resizing |
---|
| 1244 | if (is_ie) { |
---|
| 1245 | table_element.attachEvent("onmousemove",changeCursorState); |
---|
| 1246 | table_element.attachEvent("onmousedown",startColResize); |
---|
| 1247 | } |
---|
| 1248 | else { |
---|
| 1249 | table_element.addEventListener("mousemove",changeCursorState,false); |
---|
| 1250 | table_element.addEventListener("mousedown",startColResize,false); |
---|
| 1251 | } |
---|
[320] | 1252 | table_element.setAttribute("id", "table_message_header_box_"+numBox); |
---|
[2] | 1253 | table_element.className = "table_message_header_box"; |
---|
[4062] | 1254 | if (!is_ie) |
---|
| 1255 | table_element.style.width = "98.8%"; |
---|
| 1256 | //if table is empty |
---|
| 1257 | table_element.emptyBody = false; |
---|
[3035] | 1258 | |
---|
[2] | 1259 | tr_element = document.createElement("TR"); |
---|
| 1260 | tr_element.className = "message_header"; |
---|
[4062] | 1261 | |
---|
| 1262 | td_element1 = createTDElement(0,0); |
---|
[2] | 1263 | chk_box_element = document.createElement("INPUT"); |
---|
| 1264 | chk_box_element.id = "chk_box_select_all_messages"; |
---|
| 1265 | chk_box_element.setAttribute("type", "checkbox"); |
---|
| 1266 | chk_box_element.className = "checkbox"; |
---|
| 1267 | chk_box_element.onclick = function(){select_all_messages(this.checked);}; |
---|
[6930] | 1268 | chk_box_element.onmouseover = function () {this.title=get_lang('Select all messages from this page.'); }; |
---|
[2] | 1269 | chk_box_element.onkeydown = function (e){ |
---|
| 1270 | if (is_ie) |
---|
| 1271 | { |
---|
| 1272 | if ((window.event.keyCode) == 46) |
---|
[689] | 1273 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1274 | } |
---|
| 1275 | else |
---|
| 1276 | { |
---|
| 1277 | if ((e.keyCode) == 46) |
---|
[689] | 1278 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1279 | } |
---|
| 1280 | }; |
---|
[3035] | 1281 | |
---|
[2] | 1282 | td_element1.appendChild(chk_box_element); |
---|
[3035] | 1283 | |
---|
[4062] | 1284 | td_element2 = createTDElement(0,1); |
---|
[5533] | 1285 | td_element3 = createTDElement(0,8,"th_resizable","left","message_header_SORTFROM_"+numBox); |
---|
[51] | 1286 | td_element3.onclick = function () {sort_box(search_box_type,'SORTFROM');}; |
---|
[4771] | 1287 | td_element3.innerHTML = get_lang("From"); |
---|
[3035] | 1288 | |
---|
[5533] | 1289 | td_element4 = createTDElement(0,9,"th_resizable","left","message_header_SORTSUBJECT_"+numBox); |
---|
[51] | 1290 | td_element4.onclick = function () {sort_box(search_box_type,'SORTSUBJECT');}; |
---|
[2] | 1291 | td_element4.innerHTML = get_lang("Subject"); |
---|
[3035] | 1292 | |
---|
[5533] | 1293 | td_element5 = createTDElement(0,10,"th_resizable","center","message_header_SORTARRIVAL_"+numBox); |
---|
[51] | 1294 | td_element5.onclick = function () {sort_box(search_box_type,'SORTARRIVAL');}; |
---|
[2] | 1295 | td_element5.innerHTML = get_lang("Date"); |
---|
[4062] | 1296 | |
---|
[6542] | 1297 | td_element6 = createTDElement(0,11,"th_resizable","center","message_header_SORTSIZE_"+numBox); |
---|
[51] | 1298 | td_element6.onclick = function () {sort_box(search_box_type,'SORTSIZE');} |
---|
[2] | 1299 | td_element6.innerHTML = get_lang("Size"); |
---|
[3035] | 1300 | |
---|
[2] | 1301 | tr_element.appendChild(td_element1); |
---|
[3035] | 1302 | tr_element.appendChild(td_element2); |
---|
[4062] | 1303 | |
---|
| 1304 | var td_element21 = createTDElement(0,2); |
---|
| 1305 | td_element21.innerHTML = " "; |
---|
| 1306 | |
---|
| 1307 | var td_element22 = createTDElement(0,3); |
---|
| 1308 | td_element22.innerHTML = " "; |
---|
| 1309 | |
---|
| 1310 | var td_element23 = createTDElement(0,4); |
---|
| 1311 | td_element23.innerHTML = " "; |
---|
| 1312 | |
---|
| 1313 | var td_element24 = createTDElement(0,5); |
---|
| 1314 | td_element24.innerHTML = " "; |
---|
[5533] | 1315 | |
---|
| 1316 | |
---|
| 1317 | var td_element25 = createTDElement(0,7); |
---|
[4062] | 1318 | td_element25.innerHTML = " "; |
---|
[5533] | 1319 | |
---|
| 1320 | var td_element27 = createTDElement(0,8); |
---|
| 1321 | td_element25.innerHTML = " "; |
---|
| 1322 | |
---|
| 1323 | var td_element26 = createTDElement(0,6); |
---|
| 1324 | td_element26.innerHTML = " "; |
---|
| 1325 | |
---|
[4062] | 1326 | |
---|
[998] | 1327 | tr_element.appendChild(td_element21); |
---|
| 1328 | tr_element.appendChild(td_element22); |
---|
| 1329 | tr_element.appendChild(td_element23); |
---|
[4062] | 1330 | tr_element.appendChild(td_element24); |
---|
[5533] | 1331 | tr_element.appendChild(td_element26); |
---|
| 1332 | tr_element.appendChild(td_element27); |
---|
[4062] | 1333 | tr_element.appendChild(td_element25); |
---|
[5533] | 1334 | |
---|
[2] | 1335 | tr_element.appendChild(td_element3); |
---|
| 1336 | tr_element.appendChild(td_element4); |
---|
| 1337 | tr_element.appendChild(td_element5); |
---|
| 1338 | tr_element.appendChild(td_element6); |
---|
[4062] | 1339 | |
---|
[2] | 1340 | tbody_element.appendChild(tr_element); |
---|
| 1341 | table_element.appendChild(tbody_element); |
---|
[4062] | 1342 | table_element.appendChild(colgr_element); |
---|
| 1343 | |
---|
| 1344 | var _divScroll = document.getElementById("divScrollHead_"+numBox); |
---|
| 1345 | |
---|
| 1346 | if(!_divScroll){ |
---|
| 1347 | _divScroll = document.createElement("DIV"); |
---|
| 1348 | _divScroll.id = "divScrollHead_"+numBox; |
---|
[4072] | 1349 | } |
---|
[4062] | 1350 | |
---|
| 1351 | _divScroll.style.overflowY = "hidden"; |
---|
| 1352 | _divScroll.style.overflowX = "hidden"; |
---|
| 1353 | _divScroll.style.width ="100%"; |
---|
| 1354 | |
---|
| 1355 | if (is_mozilla){ |
---|
| 1356 | _divScroll.style.width ="99.3%"; |
---|
| 1357 | } |
---|
| 1358 | |
---|
| 1359 | _divScroll.appendChild(table_element); |
---|
| 1360 | openTab.content_id[numBox].appendChild(_divScroll); |
---|
| 1361 | |
---|
[4109] | 1362 | var table_layout = (getStyle("table_message_header_box_"+numBox,"table-layout") || getStyle("table_message_header_box_"+numBox,"tableLayout")); |
---|
[4072] | 1363 | cssForResizing = (table_layout=="fixed"); |
---|
| 1364 | if (cssForResizing) |
---|
| 1365 | prepareColSizesArray(); |
---|
[4062] | 1366 | } |
---|
[2] | 1367 | draw_header_box(); |
---|
| 1368 | var table_element = document.createElement("TABLE"); |
---|
[4062] | 1369 | var colgr_element = buildColGroup(); |
---|
| 1370 | colgr_element.setAttribute("id","colgroup_main_"+numBox); |
---|
| 1371 | |
---|
[3035] | 1372 | var tbody_element = document.createElement("TBODY"); |
---|
[2] | 1373 | table_element.id = "table_box"; |
---|
| 1374 | table_element.className = "table_box"; |
---|
| 1375 | table_element.borderColorDark = "#bbbbbb"; |
---|
| 1376 | table_element.frame = "void"; |
---|
| 1377 | table_element.rules = "rows"; |
---|
| 1378 | table_element.cellPadding = "0"; |
---|
| 1379 | table_element.cellSpacing = "0"; |
---|
[3035] | 1380 | |
---|
[2] | 1381 | table_element.onkeydown = function (e){ |
---|
| 1382 | if (is_ie) |
---|
| 1383 | { |
---|
| 1384 | if ((window.event.keyCode) == 46) |
---|
| 1385 | { |
---|
| 1386 | //delete_all_selected_msgs_imap(); |
---|
[689] | 1387 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1388 | } |
---|
| 1389 | } |
---|
| 1390 | else |
---|
| 1391 | { |
---|
| 1392 | if ((e.keyCode) == 46) |
---|
| 1393 | { |
---|
| 1394 | //delete_all_selected_msgs_imap(); |
---|
[689] | 1395 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1396 | } |
---|
| 1397 | } |
---|
| 1398 | }; |
---|
| 1399 | if (is_ie) |
---|
| 1400 | table_element.style.cursor = "hand"; |
---|
[3035] | 1401 | |
---|
[2] | 1402 | tbody_element.setAttribute("id", "tbody_box"); |
---|
| 1403 | table_element.appendChild(tbody_element); |
---|
[4062] | 1404 | table_element.appendChild(colgr_element); |
---|
[3035] | 1405 | |
---|
[320] | 1406 | var _divScroll = document.getElementById("divScrollMain_"+numBox); |
---|
| 1407 | |
---|
[3035] | 1408 | if(!_divScroll){ |
---|
[2] | 1409 | _divScroll = document.createElement("DIV"); |
---|
[320] | 1410 | _divScroll.id = "divScrollMain_"+numBox; |
---|
[2] | 1411 | } |
---|
[3035] | 1412 | |
---|
[4062] | 1413 | _divScroll.style.overflowY = "scroll"; |
---|
[790] | 1414 | _divScroll.style.overflowX = "hidden"; |
---|
| 1415 | _divScroll.style.width ="100%"; |
---|
[3035] | 1416 | |
---|
[790] | 1417 | if (is_mozilla){ |
---|
[2] | 1418 | _divScroll.style.overflow = "-moz-scrollbars-vertical"; |
---|
[4062] | 1419 | _divScroll.style.width ="100%"; |
---|
[2] | 1420 | } |
---|
| 1421 | _divScroll.appendChild(table_element); |
---|
[607] | 1422 | openTab.content_id[numBox].appendChild(_divScroll); |
---|
[6930] | 1423 | |
---|
[2] | 1424 | var f_unseen = 0; |
---|
[139] | 1425 | |
---|
[4062] | 1426 | document.getElementById("table_message_header_box_"+numBox).emptyBody = false; |
---|
[6930] | 1427 | |
---|
[4189] | 1428 | if (headers_msgs.num_msgs == 0) |
---|
| 1429 | showEmptyBoxMsg(tbody_element); |
---|
| 1430 | |
---|
[2] | 1431 | for (var i=0; i < headers_msgs.length; i++){ |
---|
| 1432 | if ((headers_msgs[i].Unseen == 'U') || (headers_msgs[i].Recent == 'N')) |
---|
[3035] | 1433 | f_unseen++; |
---|
[3493] | 1434 | tr_element = make_tr_message(headers_msgs[i], msg_folder, headers_msgs.offsetToGMT); |
---|
[976] | 1435 | if (tr_element){ |
---|
[790] | 1436 | tbody_element.appendChild(tr_element); |
---|
[3035] | 1437 | add_className(tr_element, i%2 != 0 ? 'tr_msg_read2' : 'tr_msg_read'); |
---|
[976] | 1438 | } |
---|
[5486] | 1439 | //_dragArea.makeDragged(tr_element, headers_msgs[i].msg_number, headers_msgs[i].subject, true); |
---|
| 1440 | $(tr_element).draggable({ |
---|
[5499] | 1441 | start : function(){ |
---|
| 1442 | if($(".shared-folders").length){ |
---|
| 1443 | $(".shared-folders").parent().find('.folder:not(".shared-folders")').droppable({ |
---|
| 1444 | over : function(a, b){ |
---|
| 1445 | //SETA BORDA EM VOLTA DA PASTA |
---|
[5765] | 1446 | over = $(this); |
---|
| 1447 | $(this).addClass("folder-over"); |
---|
| 1448 | if(($(this)[0] != $(this).parent().find(".head_folder")[0])) |
---|
| 1449 | if($(this).prev()[0]) |
---|
| 1450 | if($(this).parent().find(".expandable-hitarea")[0] == $(this).prev()[0]){ |
---|
| 1451 | setTimeout(function(){ |
---|
| 1452 | if(over.hasClass("folder-over")) |
---|
| 1453 | over.prev().trigger("click"); |
---|
| 1454 | }, 500); |
---|
| 1455 | |
---|
| 1456 | } |
---|
[5499] | 1457 | }, |
---|
| 1458 | out : function(){ |
---|
| 1459 | //RETIRA BORDA EM VOLTA DA PASTA |
---|
[5765] | 1460 | $(this).removeClass("folder-over"); |
---|
[5499] | 1461 | }, |
---|
| 1462 | //accept: ".draggin_mail", |
---|
| 1463 | drop : function(event, ui){ |
---|
| 1464 | $(this).css("border", ""); |
---|
| 1465 | if($(this).parent().attr('id') == undefined){ |
---|
| 1466 | var folder_to = 'INBOX'; |
---|
| 1467 | var to_folder_title = get_lang("Inbox"); |
---|
| 1468 | }else{ |
---|
| 1469 | var folder_to = $(this).parent().attr('id'); |
---|
| 1470 | var to_folder_title = $(this).attr('title'); |
---|
| 1471 | } |
---|
| 1472 | var folder_to_move = ui.draggable.parent().attr('id'); |
---|
| 1473 | var border_id = ui.draggable.find("input[type=hidden]").attr("name"); |
---|
| 1474 | // Mensagens : SE O DROP VIER DA LISTA DE MENSAGENS : |
---|
| 1475 | if(folder_to_move == "tbody_box"){ |
---|
| 1476 | move_msgs2(get_current_folder(), 'selected', 0, folder_to, to_folder_title,true); |
---|
| 1477 | return refresh(); |
---|
| 1478 | } |
---|
| 1479 | } |
---|
| 1480 | }); |
---|
| 1481 | } |
---|
| 1482 | }, |
---|
| 1483 | stop :function(){ |
---|
| 1484 | $(".shared-folders").parent().find(".folder").droppable("destroy"); |
---|
| 1485 | }, |
---|
[5754] | 1486 | //helper: 'clone', |
---|
| 1487 | helper: function(event){ |
---|
[6930] | 1488 | $(this).addClass("selected_msg").find("input:checkbox").attr("checked", true); |
---|
| 1489 | updateSelectedMsgs($(this).find("input:checkbox").is(':checked'),$(this).attr("id")); |
---|
[6223] | 1490 | if ( $("#tbody_box .selected_shortcut_msg").length > 1) { |
---|
[6930] | 1491 | $("#tbody_box .selected_shortcut_msg").addClass("selected_msg").find('.checkbox').attr('checked',true); |
---|
| 1492 | $.each( $(".selected_shortcut_msg"), function(index, value){ |
---|
| 1493 | updateSelectedMsgs($(value).find(":checkbox").is(':checked'),$(value).attr("id")); |
---|
| 1494 | }); |
---|
[6223] | 1495 | } |
---|
[6930] | 1496 | |
---|
| 1497 | if(totalSelected() > 1 ) |
---|
| 1498 | return $("<tr><td>"+DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : (totalSelected()+" mensagens selecionadas"), type: "messages"})+"</td></tr>"); |
---|
[5486] | 1499 | if( $(this).find(".td_msg_subject").text().length > 18 ) |
---|
[5754] | 1500 | 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] | 1501 | else |
---|
[5754] | 1502 | return $("<tr><td>"+DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : $(this).find(".td_msg_subject").text(), type: "messages"})+"</td></tr>"); |
---|
| 1503 | }, |
---|
| 1504 | iframeFix: true, |
---|
| 1505 | delay: 150, |
---|
[6265] | 1506 | cursorAt: {top: 5, left: 56}, |
---|
[5754] | 1507 | refreshPositions: true, |
---|
[5486] | 1508 | containment: "#divAppbox" |
---|
[5718] | 1509 | }).bind('contextmenu',function(event){ |
---|
[6930] | 1510 | if (!(($(event.target).find('img').length > 0) && ($(event.target).hasClass('td-label')))){ |
---|
| 1511 | if($(this).find("input:checkbox").attr("checked") != "checked"){ |
---|
| 1512 | $(this).find("input:checkbox").trigger('click'); |
---|
| 1513 | $(this).addClass("selected_msg"); |
---|
[5718] | 1514 | } |
---|
[6930] | 1515 | updateSelectedMsgs($(this).find("input:checkbox").is(':checked'),$(this).attr("id")); |
---|
| 1516 | } |
---|
[5486] | 1517 | }); |
---|
[2] | 1518 | } |
---|
[3035] | 1519 | |
---|
[128] | 1520 | if ((preferences.use_shortcuts == '1') && (headers_msgs[0])) |
---|
[320] | 1521 | select_msg(headers_msgs[0].msg_number, 'null', true); |
---|
[5302] | 1522 | |
---|
[6930] | 1523 | |
---|
[2] | 1524 | var tdFolders = Element("folderscol"); |
---|
| 1525 | tdFolders.style.display = preferences.hide_folders == '1' ? "none" : ""; |
---|
[790] | 1526 | if ( !currentTab ) |
---|
[6997] | 1527 | // alternate_border(numBox); |
---|
[3035] | 1528 | draw_footer_box(headers_msgs.num_msgs); |
---|
[2] | 1529 | Element('main_table').style.display = ''; |
---|
[3035] | 1530 | if(is_ie6) // Stupid Fixing on IE6. |
---|
| 1531 | setTimeout("resizeWindow()",1); |
---|
| 1532 | else |
---|
[6997] | 1533 | //resizeWindow(); |
---|
[2] | 1534 | if(debug) { |
---|
| 1535 | var _eTime = new Date(); |
---|
| 1536 | _eTime = _eTime.getTime(); |
---|
| 1537 | alert("Carregou em "+(_eTime - _bTime)+" ms"); |
---|
| 1538 | } |
---|
[5533] | 1539 | |
---|
[2] | 1540 | var msg_folder = Element('msg_folder').value; |
---|
[3035] | 1541 | var msg_number = Element('msg_number').value; |
---|
[2] | 1542 | if(!msg_folder && msg_number) { |
---|
| 1543 | new_message('new','null'); |
---|
| 1544 | } |
---|
| 1545 | else if(msg_folder && msg_number){ |
---|
[6275] | 1546 | $.ajax({ |
---|
| 1547 | url: 'controller.php?' + $.param( {action: '$this.imap_functions.get_info_msg', |
---|
| 1548 | msg_number: msg_number, |
---|
| 1549 | msg_folder: msg_folder, |
---|
| 1550 | decoded: true } ), |
---|
| 1551 | success: function( data ){ |
---|
| 1552 | data = connector.unserialize( data ); |
---|
| 1553 | |
---|
| 1554 | if( data ) |
---|
| 1555 | show_msg( data ); |
---|
[6469] | 1556 | }, |
---|
| 1557 | beforeSend: function( jqXHR, settings ){ |
---|
| 1558 | connector.showProgressBar(); |
---|
| 1559 | }, |
---|
| 1560 | complete: function( jqXHR, settings ){ |
---|
| 1561 | connector.hideProgressBar(); |
---|
[6275] | 1562 | } |
---|
| 1563 | |
---|
| 1564 | }); |
---|
[2] | 1565 | Element('msg_folder').value = ''; |
---|
| 1566 | Element('msg_number').value = ''; |
---|
| 1567 | } |
---|
[6930] | 1568 | connector.loadScript("InfoContact"); |
---|
[3369] | 1569 | // Loading Quota View Folder Component (if exists...) |
---|
[3157] | 1570 | if(Element("table_quota")) |
---|
[3158] | 1571 | connector.loadScript("InfoQuota"); |
---|
[5533] | 1572 | |
---|
[4062] | 1573 | // creates the dotted ruler which helps user to visualize resizing of columns |
---|
| 1574 | var ruler_element = document.getElementById("table_message_ruler"); |
---|
| 1575 | if (ruler_element == null) { |
---|
| 1576 | ruler_element = document.createElement("DIV"); |
---|
| 1577 | ruler_element.setAttribute("id", "table_message_ruler"); |
---|
| 1578 | ruler_element.className = "table_message_ruler"; |
---|
| 1579 | ruler_element.style.top = getColumnPosition(document.getElementById("content_id_0"),"BODY")[1]; |
---|
| 1580 | document.getElementById("exmail_main_body").appendChild(ruler_element); |
---|
| 1581 | } |
---|
[6930] | 1582 | drawSelectMsgsTable(); |
---|
| 1583 | updateSelectedMsgs(); |
---|
| 1584 | resizeWindow(); |
---|
[2] | 1585 | } |
---|
[790] | 1586 | |
---|
[4189] | 1587 | function showEmptyBoxMsg(tbody_element) { |
---|
| 1588 | document.getElementById("table_message_header_box_"+numBox).emptyBody = true; |
---|
[4752] | 1589 | var div_pasta = document.getElementById("div_msg_info"); |
---|
[4934] | 1590 | if (!div_pasta){ |
---|
[4752] | 1591 | div_info = document.createElement("div"); |
---|
| 1592 | div_info.setAttribute("id", "div_msg_info"); |
---|
| 1593 | div_info.setAttribute("background", "#FFF"); |
---|
| 1594 | h3_info = document.createElement("h3"); |
---|
| 1595 | h3_info.style.padding = "10px"; |
---|
| 1596 | h3_info.setAttribute("id", "msg_info"); |
---|
| 1597 | h3_info.align = "center"; |
---|
| 1598 | h3_info.innerHTML = get_lang("This mail box is empty"); |
---|
| 1599 | div_info.appendChild(h3_info); |
---|
| 1600 | tbody_element.parentNode.parentNode.appendChild(div_info); |
---|
| 1601 | } |
---|
[4189] | 1602 | } |
---|
| 1603 | |
---|
[6109] | 1604 | function html_entities(string) { |
---|
[6213] | 1605 | return String(string).replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); |
---|
[6109] | 1606 | } |
---|
| 1607 | |
---|
[7043] | 1608 | // Passar o parᅵmetro offset para esta funᅵᅵo |
---|
[3493] | 1609 | function make_tr_message(headers_msgs, msg_folder, offsetToGMT){ |
---|
[6109] | 1610 | headers_msgs.subject = html_entities(headers_msgs.subject); |
---|
[5533] | 1611 | if (typeof offsetToGMT == 'undefined') |
---|
| 1612 | { |
---|
| 1613 | // In older local messages headers_msgs.offsetToGMT is undefined. |
---|
| 1614 | offsetToGMT = typeof headers_msgs.offsetToGMT != 'undefined'?headers_msgs.offsetToGMT:0; |
---|
| 1615 | } |
---|
[320] | 1616 | var tr_element = document.createElement('tr'); |
---|
[3069] | 1617 | if(typeof(preferences.line_height) != 'undefined') |
---|
| 1618 | tr_element.style.height = preferences.line_height; |
---|
[2] | 1619 | tr_element.id = headers_msgs.msg_number; |
---|
[163] | 1620 | |
---|
[1752] | 1621 | tr_element.msg_sample = ""; |
---|
| 1622 | //if(headers_msgs.msg_sample && headers_msgs.msg_sample.preview_msg_subject != "") |
---|
[5134] | 1623 | if(headers_msgs.msg_sample && preferences.preview_msg_subject == "1" && headers_msgs.msg_sample.body !== "") |
---|
[1752] | 1624 | { |
---|
[4820] | 1625 | if (cssForResizing) //Colunas redimensionaveis - nao trunca |
---|
[5134] | 1626 | tr_element.msg_sample = Base64.decode(headers_msgs.msg_sample.body).substr(0,180) + "..."; //trecho do body que sera exibido com o assunto; |
---|
[4820] | 1627 | else |
---|
[5134] | 1628 | tr_element.msg_sample = Base64.decode(headers_msgs.msg_sample.body).substr(0,120) + "..."; //trecho do body que sera exibido com o assunto; |
---|
[1752] | 1629 | } |
---|
| 1630 | |
---|
| 1631 | tr_element.tip = ""; |
---|
[5134] | 1632 | if(headers_msgs.msg_sample && preferences.preview_msg_tip == "1" && headers_msgs.msg_sample.body !== "") |
---|
[1752] | 1633 | { |
---|
[5134] | 1634 | tr_element.tip = Base64.decode(headers_msgs.msg_sample.body).substr(3,300) + "..."; //trecho do body que sera exibido no tool-tip; |
---|
[1752] | 1635 | } |
---|
| 1636 | |
---|
[614] | 1637 | if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')){ |
---|
[4839] | 1638 | if ((headers_msgs.Flagged == 'F') || headers_msgs.Importance.toLowerCase().indexOf("high")!=-1 ) |
---|
[614] | 1639 | add_className(tr_element, 'flagged_msg'); |
---|
[163] | 1640 | add_className(tr_element, 'tr_msg_unread'); |
---|
[614] | 1641 | } |
---|
| 1642 | else{ |
---|
[5134] | 1643 | if ((headers_msgs.Flagged == 'F') || ( headers_msgs.Importance !== undefined && headers_msgs.Importance.toLowerCase().indexOf("high")!=-1 ) ) |
---|
[614] | 1644 | add_className(tr_element,'flagged_msg'); |
---|
| 1645 | } |
---|
[2] | 1646 | |
---|
[790] | 1647 | if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')) |
---|
| 1648 | add_className(tr_element, 'tr_msg_unread'); |
---|
[3035] | 1649 | |
---|
[790] | 1650 | if (headers_msgs.Flagged == 'F') |
---|
| 1651 | add_className(tr_element,'flagged_msg'); |
---|
| 1652 | |
---|
[4062] | 1653 | td_element1 = createTDElement(0,0,"td_msg"); |
---|
[2] | 1654 | chk_box_element = document.createElement("INPUT"); |
---|
| 1655 | chk_box_element.setAttribute("type", "checkbox"); |
---|
| 1656 | chk_box_element.className = "checkbox"; |
---|
| 1657 | chk_box_element.setAttribute("id", "check_box_message_"+headers_msgs.msg_number); |
---|
[6153] | 1658 | |
---|
| 1659 | $(chk_box_element).click(function(e){ |
---|
[6930] | 1660 | updateSelectedMsgs($(this).is(':checked'),headers_msgs.msg_number); |
---|
| 1661 | $(".selected_shortcut_msg").removeClass("current_selected_shortcut_msg selected_shortcut_msg"); |
---|
| 1662 | $(".current_selected_shortcut_msg").removeClass("current_selected_shortcut_msg selected_shortcut_msg"); |
---|
| 1663 | if(preferences.use_shortcuts == '1') |
---|
| 1664 | $(this).parents("tr:first").addClass("current_selected_shortcut_msg selected_shortcut_msg"); |
---|
| 1665 | changeBgColor(e,headers_msgs.msg_number); |
---|
| 1666 | $(this).blur(); |
---|
[6153] | 1667 | }); |
---|
| 1668 | |
---|
[2] | 1669 | td_element1.appendChild(chk_box_element); |
---|
[3035] | 1670 | |
---|
[4062] | 1671 | td_element2 = createTDElement(0,1,"td_msg"); |
---|
[5359] | 1672 | if (headers_msgs.attachment == 1) |
---|
| 1673 | td_element2.innerHTML = "<img src ='templates/"+template+"/images/clip.gif' >"; |
---|
[3035] | 1674 | |
---|
[4062] | 1675 | td_element21 = createTDElement(0,2,"td_msg",null,"td_message_answered_"+headers_msgs.msg_number); |
---|
[2] | 1676 | |
---|
| 1677 | if ((headers_msgs.Forwarded == 'F') || (headers_msgs.Draft == 'X' && headers_msgs.Answered == 'A')){ |
---|
[3993] | 1678 | td_element21.onclick=function(){search_emails(headers_msgs.subject.replace(/^(re: ?|fw: ?|enc: ?|res: ?|fwd: ?)*/gi,''),true);}; |
---|
[6528] | 1679 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/forwarded.png' title='"+get_lang('Forwarded')+"'>"; |
---|
[3035] | 1680 | headers_msgs.Draft = '' |
---|
[2] | 1681 | headers_msgs.Answered = ''; |
---|
[1035] | 1682 | headers_msgs.Forwarded = 'F'; |
---|
[2] | 1683 | } |
---|
| 1684 | else if (headers_msgs.Draft == 'X') |
---|
[6528] | 1685 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/draft.png' title='"+get_lang('Draft')+"'>"; |
---|
[3993] | 1686 | else if (headers_msgs.Answered == 'A'){ |
---|
| 1687 | td_element21.onclick=function(){search_emails(headers_msgs.subject.replace(/^(re: ?|fw: ?|enc: ?|res: ?|fwd: ?)*/gi,''),true);}; |
---|
[6528] | 1688 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/answered.png' title='"+get_lang('Answered')+"'>"; |
---|
[3993] | 1689 | }else |
---|
[998] | 1690 | td_element21.innerHTML = " "; |
---|
[2] | 1691 | |
---|
[4062] | 1692 | td_element22 = createTDElement(0,1,"td_msg",null,"td_message_signed_"+headers_msgs.msg_number); |
---|
[3035] | 1693 | switch(headers_msgs.ContentType) |
---|
[1035] | 1694 | { |
---|
[3035] | 1695 | case "signature": |
---|
[1035] | 1696 | { |
---|
| 1697 | td_element22.innerHTML = "<img src ='templates/"+template+"/images/signed_msg.gif' title='" + get_lang('Signed message') + "'>"; |
---|
| 1698 | break; |
---|
| 1699 | } |
---|
[3035] | 1700 | case "cipher": |
---|
[1035] | 1701 | { |
---|
| 1702 | td_element22.innerHTML = "<img src ='templates/"+template+"/images/lock.gif' title='" + get_lang('Crypted message') + "'>"; |
---|
| 1703 | break; |
---|
| 1704 | } |
---|
[3035] | 1705 | default: |
---|
[1035] | 1706 | { |
---|
| 1707 | break; |
---|
| 1708 | } |
---|
| 1709 | } |
---|
| 1710 | |
---|
[4062] | 1711 | td_element23 = createTDElement(0,4,"td_msg",null,"td_message_important_"+headers_msgs.msg_number); |
---|
[1035] | 1712 | |
---|
[5134] | 1713 | if ( (headers_msgs.Flagged == 'F') || ( headers_msgs.Importance !== undefined && headers_msgs.Importance.toLowerCase().indexOf("high") != -1 )) |
---|
[790] | 1714 | { |
---|
[5569] | 1715 | td_element23.innerHTML = "<img src ='templates/"+template+"/images/important.png' title='"+get_lang('Important')+"'>"; |
---|
[790] | 1716 | } |
---|
[2] | 1717 | else |
---|
[1035] | 1718 | td_element23.innerHTML = " "; |
---|
[790] | 1719 | |
---|
[4062] | 1720 | td_element24 = createTDElement(0,5,"td_msg",null,"td_message_sent_"+headers_msgs.msg_number); |
---|
[1035] | 1721 | td_element24.innerHTML = " "; |
---|
[2] | 1722 | // preload image |
---|
| 1723 | var _img_sent = new Image(); |
---|
[790] | 1724 | _img_sent.src = "templates/"+template+"/images/sent.gif"; |
---|
[2] | 1725 | |
---|
[3018] | 1726 | |
---|
| 1727 | |
---|
[5533] | 1728 | td_element25 = createTDElement(0,7,"td_msg",null,"td_message_unseen_"+headers_msgs.msg_number); |
---|
[3035] | 1729 | if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')) |
---|
| 1730 | td_element25.innerHTML = "<img src ='templates/"+template+"/images/unseen.gif' title='"+get_lang('Unseen')+"'>"; |
---|
| 1731 | else |
---|
| 1732 | td_element25.innerHTML = "<img src ='templates/"+template+"/images/seen.gif' title='"+get_lang('Seen')+"'>"; |
---|
[3018] | 1733 | |
---|
| 1734 | |
---|
[5533] | 1735 | td_element3 = createTDElement(0,8,"td_msg td_resizable","left","td_from_"+ headers_msgs.msg_number); |
---|
[689] | 1736 | var _onclick = function(){InfoContact.hide();proxy_mensagens.get_msg(headers_msgs.msg_number, msg_folder,true, show_msg);}; |
---|
[2] | 1737 | td_element3.onclick = _onclick; |
---|
| 1738 | td_element3.innerHTML = ' '; |
---|
[3035] | 1739 | |
---|
[3245] | 1740 | test = true; |
---|
[5211] | 1741 | 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] | 1742 | test = false; |
---|
[5240] | 1743 | |
---|
| 1744 | 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] | 1745 | { |
---|
[6211] | 1746 | td_element3.onmouseover = function () { |
---|
| 1747 | var title_to = ''; |
---|
| 1748 | $.each(headers_msgs.to, function(index, value) { |
---|
| 1749 | if(index == (headers_msgs.to.length - 1)){ |
---|
| 1750 | title_to = title_to + value.email; |
---|
| 1751 | } |
---|
| 1752 | else { |
---|
| 1753 | title_to = title_to + value.email + ', '; |
---|
| 1754 | } |
---|
| 1755 | }); |
---|
| 1756 | this.title = title_to; |
---|
| 1757 | }; |
---|
[5790] | 1758 | |
---|
[2] | 1759 | if (headers_msgs.Draft == 'X') |
---|
| 1760 | td_element3.innerHTML += "<span style=\"color:red\">("+get_lang("Draft")+") </span>"; |
---|
[3035] | 1761 | else{ |
---|
[6211] | 1762 | if(headers_msgs.to[0].email != null && headers_msgs.to[0].email.toLowerCase() != Element("user_email").value) |
---|
[6123] | 1763 | td_element24.innerHTML = "<img align='center' src ='templates/"+template+"/images/sent.gif' title='"+get_lang('Sent')+"'>"; |
---|
[4072] | 1764 | |
---|
[3831] | 1765 | if (headers_msgs.to) { |
---|
[6211] | 1766 | if (headers_msgs.to[0].name != null) |
---|
| 1767 | td_element3.innerHTML += headers_msgs.to[0].name; |
---|
| 1768 | else if(headers_msgs.to[0].email != null) { |
---|
| 1769 | td_element3.innerHTML += headers_msgs.to[0].email; |
---|
[3831] | 1770 | } |
---|
| 1771 | else { |
---|
| 1772 | td_element3.innerHTML += get_lang("without destination"); |
---|
| 1773 | } |
---|
[2] | 1774 | } |
---|
| 1775 | } |
---|
| 1776 | } |
---|
| 1777 | else{ |
---|
| 1778 | if (headers_msgs.Draft == 'X'){ |
---|
| 1779 | td_element3.innerHTML = "<span style=\"color:red\">("+get_lang("Draft")+") </span>"; |
---|
| 1780 | } |
---|
[3035] | 1781 | else{ |
---|
[1247] | 1782 | var spanSender = document.createElement("SPAN"); |
---|
[6138] | 1783 | spanSender.setAttribute('class','span-sender'); |
---|
[6265] | 1784 | spanSender.onmouseover = function (event) {/*this.style.textDecoration = "underline";*/try {InfoContact.begin(this,headers_msgs.reply_toaddress)} catch(e){};}; |
---|
| 1785 | spanSender.onmouseout = function (){try {/*this.style.textDecoration = "none";*/clearTimeout(InfoContact.timeout);} catch(e){}}; |
---|
[5158] | 1786 | folder = special_folders['Sent']; |
---|
| 1787 | current = get_current_folder(); |
---|
| 1788 | if ((preferences.from_to_sent == "1") && (current.substr(current.length - folder.length, folder.length) == folder)){ |
---|
[6218] | 1789 | spanSender.onmouseover = function () { |
---|
| 1790 | var title_to = ''; |
---|
| 1791 | $.each(headers_msgs.to, function(index, value) { |
---|
| 1792 | if(index == (headers_msgs.to.length - 1)){ |
---|
| 1793 | title_to = title_to + value.email; |
---|
| 1794 | } |
---|
| 1795 | else { |
---|
| 1796 | title_to = title_to + value.email + ', '; |
---|
| 1797 | } |
---|
| 1798 | }); |
---|
| 1799 | this.title = title_to; |
---|
| 1800 | }; |
---|
[5158] | 1801 | if (headers_msgs.to) { |
---|
[6218] | 1802 | if (headers_msgs.to[0].name != null){ |
---|
| 1803 | spanSender.innerHTML += headers_msgs.to[0].name; |
---|
| 1804 | }else if(headers_msgs.to[0].email != null) { |
---|
| 1805 | spanSender.innerHTML += headers_msgs.to[0].email; |
---|
[5158] | 1806 | } |
---|
| 1807 | } |
---|
| 1808 | }else if(headers_msgs.from !== undefined){ |
---|
[1247] | 1809 | spanSender.innerHTML = headers_msgs.from.name != null ? headers_msgs.from.name : headers_msgs.from.email; |
---|
[5158] | 1810 | } |
---|
[1247] | 1811 | if (spanSender.innerHTML.indexOf(" ") == '-1' && spanSender.innerHTML.length > 25){ |
---|
| 1812 | spanSender.innerHTML = spanSender.innerHTML.substring(0,25) + "..."; |
---|
| 1813 | } |
---|
| 1814 | else if (spanSender.innerHTML.length > 40 ){ |
---|
| 1815 | spanSender.innerHTML = spanSender.innerHTML.substring(0,40) + "..."; |
---|
[3035] | 1816 | } |
---|
| 1817 | td_element3.appendChild(spanSender); |
---|
[2] | 1818 | } |
---|
[3035] | 1819 | } |
---|
[4062] | 1820 | |
---|
[5533] | 1821 | td_element4 = createTDElement(0,9,"td_msg td_resizable","left"); |
---|
[5486] | 1822 | td_element4.className += " td_msg_subject"; |
---|
[2] | 1823 | td_element4.onclick = _onclick; |
---|
[1752] | 1824 | td_element4.innerHTML = !is_ie ? "<a nowrap id='a_message_"+tr_element.id+"'> " : " "; |
---|
[3035] | 1825 | |
---|
[2] | 1826 | if ((headers_msgs.subject)&&(headers_msgs.subject.length > 50)) |
---|
[1752] | 1827 | { |
---|
[4820] | 1828 | if (cssForResizing) |
---|
| 1829 | //Colunas redimensionaveis - nao trunca |
---|
| 1830 | td_element4.innerHTML += headers_msgs.subject + "<span style=\"color:#b3b3b3;\"> " + tr_element.msg_sample +"</span>"; |
---|
| 1831 | else { |
---|
| 1832 | //Modificacao para evitar que o truncamento do assunto quebre uma NCR - #1189 |
---|
| 1833 | pos = headers_msgs.subject.indexOf("&",45); |
---|
| 1834 | if ((pos > 0) && (pos <= 50) && ((headers_msgs.subject.charAt(pos+5) == ";") || (headers_msgs.subject.charAt(pos+6) == ";"))) |
---|
| 1835 | td_element4.innerHTML += headers_msgs.subject.substring(0,pos+6) + "..." + "<span style=\"color:#b3b3b3;\"> " + tr_element.msg_sample +"</span>"; |
---|
| 1836 | else |
---|
| 1837 | 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; |
---|
| 1838 | } |
---|
[1752] | 1839 | } |
---|
[2] | 1840 | else |
---|
[1752] | 1841 | { |
---|
| 1842 | 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; |
---|
| 1843 | } |
---|
[3035] | 1844 | |
---|
[1752] | 1845 | td_element4.title=tr_element.tip; |
---|
[2] | 1846 | if(!is_ie){ |
---|
| 1847 | td_element4.innerHTML += "</a>"; |
---|
| 1848 | } |
---|
[5533] | 1849 | |
---|
| 1850 | td_element5 = createTDElement(0,10,"td_msg td_resizable","center"); |
---|
| 1851 | td_element5.onclick = _onclick; |
---|
| 1852 | |
---|
| 1853 | td_element27 = createTDElement(0,7,"td_msg",null,"td_message_labels_"+headers_msgs.msg_number); |
---|
| 1854 | $(td_element27).addClass("td-label"); |
---|
[2] | 1855 | |
---|
[5533] | 1856 | if (headers_msgs.labels) { |
---|
| 1857 | td_element27.innerHTML = '<img src="../prototype/modules/mail/img/tag.png">'; |
---|
[5586] | 1858 | updateLabelsColumn(headers_msgs); |
---|
[5533] | 1859 | } |
---|
| 1860 | |
---|
[6123] | 1861 | td_element26 = createTDElement(0,6,"td_msg","center","td_message_followup_"+headers_msgs.msg_number); |
---|
[5533] | 1862 | $(td_element26).addClass("td-followup-flag"); |
---|
[5717] | 1863 | td_element26.innerHTML = '<div class="flag-edited" style="width:8px;height:6px;"><img src="../prototype/modules/mail/img/flagEditor.png"></div>'; |
---|
[5533] | 1864 | |
---|
| 1865 | if (headers_msgs.followupflagged) { |
---|
[5738] | 1866 | if(headers_msgs.followupflagged.followupflag.id < 7){ |
---|
| 1867 | var nameFollowupflag = get_lang(headers_msgs.followupflagged.followupflag.name); |
---|
| 1868 | }else{ |
---|
| 1869 | var nameFollowupflag = headers_msgs.followupflagged.followupflag.name; |
---|
| 1870 | } |
---|
| 1871 | $(td_element26).attr('title', nameFollowupflag) |
---|
[5533] | 1872 | .find(".flag-edited").css("background",headers_msgs.followupflagged.backgroundColor); |
---|
| 1873 | if(headers_msgs.followupflagged.isDone == "1"){ |
---|
| 1874 | $(td_element26).find(".flag-edited").find("img") |
---|
| 1875 | .attr("src", "../prototype/modules/mail/img/flagChecked.png") |
---|
| 1876 | .css("margin-left","-3px"); |
---|
| 1877 | } |
---|
| 1878 | } else { |
---|
| 1879 | $(td_element26).find(".flag-edited").css("background","#cccccc"); |
---|
| 1880 | } |
---|
| 1881 | |
---|
| 1882 | /** |
---|
| 1883 | * Clique para aplicar sinalizador |
---|
| 1884 | */ |
---|
| 1885 | $(td_element26).click(function() { |
---|
| 1886 | var messageClickedId = $(this).attr('id').match(/td_message_followup_([\d]+)/)[1]; |
---|
[5861] | 1887 | |
---|
[5882] | 1888 | var followupColor = $('#td_message_followup_' + messageClickedId).find(".flag-edited").css('backgroundColor'); |
---|
| 1889 | |
---|
[5861] | 1890 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1891 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
[5867] | 1892 | .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" />'); |
---|
| 1893 | |
---|
| 1894 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1895 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "transparent"); |
---|
[5882] | 1896 | |
---|
| 1897 | |
---|
[5867] | 1898 | /** |
---|
[5533] | 1899 | * Hack: |
---|
[7043] | 1900 | * headers_msgs.followupflagged.id nᅵo vai funcionar porque jᅵ foi feito DataLayer.commit() |
---|
[5533] | 1901 | * por isso o id deve ser obtido do banco |
---|
[7043] | 1902 | * tambᅵm para verificar se hᅵ ou nᅵo sinalizador nesta mensagem |
---|
[5533] | 1903 | */ |
---|
[5605] | 1904 | |
---|
| 1905 | DataLayer.remove('followupflagged', false); |
---|
[5533] | 1906 | var flagged = DataLayer.get('followupflagged', {filter: [ |
---|
| 1907 | 'AND', |
---|
| 1908 | ['=', 'messageNumber', messageClickedId], |
---|
| 1909 | ['=', 'folderName', msg_folder] |
---|
| 1910 | ]}); |
---|
[5540] | 1911 | |
---|
| 1912 | if (!flagged) { |
---|
[5533] | 1913 | /** |
---|
| 1914 | * Aplica followupflag de Acompanhamento |
---|
| 1915 | */ |
---|
| 1916 | headers_msgs.followupflagged = { |
---|
| 1917 | uid : User.me.id, |
---|
| 1918 | folderName : msg_folder, |
---|
| 1919 | messageNumber : messageClickedId, |
---|
| 1920 | alarmTime : false, |
---|
| 1921 | backgroundColor : '#FF2016', |
---|
[6152] | 1922 | followupflagId: '1' |
---|
[5533] | 1923 | }; |
---|
| 1924 | headers_msgs.followupflagged.id = DataLayer.put('followupflagged', headers_msgs.followupflagged); |
---|
[6047] | 1925 | DataLayer.commit(false, false, function(data){ |
---|
[6384] | 1926 | var fail = 'success'; |
---|
[6047] | 1927 | $.each(data, function(index, value) { |
---|
[6384] | 1928 | if(typeof value === 'string'){ |
---|
| 1929 | fail = value; |
---|
[6047] | 1930 | } |
---|
| 1931 | }); |
---|
| 1932 | |
---|
[5861] | 1933 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1934 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1935 | .html('<img src="../prototype/modules/mail/img/flagEditor.png">'); |
---|
[6384] | 1936 | |
---|
[6641] | 1937 | |
---|
| 1938 | if(fail != 'success'){ |
---|
| 1939 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1940 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "#CCCCCC"); |
---|
| 1941 | MsgsCallbackFollowupflag[fail](); |
---|
| 1942 | }else{ |
---|
| 1943 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1944 | '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); |
---|
| 1945 | updateCacheFollowupflag(messageClickedId, msg_folder, true); |
---|
| 1946 | } |
---|
[5625] | 1947 | }); |
---|
[5533] | 1948 | |
---|
[6463] | 1949 | |
---|
[5625] | 1950 | } else if (onceOpenedHeadersMessages[msg_folder][messageClickedId]['followupflagged'].followupflag.name == 'Follow up') { |
---|
[5533] | 1951 | /** |
---|
[5540] | 1952 | * Remove followupflag de Acompanhamento |
---|
[5533] | 1953 | */ |
---|
| 1954 | $(this).find(".flag-edited").css("background", "#cccccc"); |
---|
[5708] | 1955 | DataLayer.remove('followupflagged', flagged[0].id ); |
---|
[5649] | 1956 | DataLayer.commit(false, false, function(){ |
---|
| 1957 | updateCacheFollowupflag(messageClickedId, msg_folder, false); |
---|
| 1958 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
[5861] | 1959 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1960 | .html('<img src="../prototype/modules/mail/img/flagEditor.png">'); |
---|
| 1961 | |
---|
| 1962 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
[5929] | 1963 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).attr('title', '').find(".flag-edited").css("background", '#CCC'); |
---|
[5861] | 1964 | |
---|
[5649] | 1965 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1966 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1967 | .find("img").attr("src", "../prototype/modules/mail/img/flagEditor.png").css("margin-left","0"); |
---|
| 1968 | }); |
---|
| 1969 | |
---|
[5533] | 1970 | } else { |
---|
[5882] | 1971 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1972 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1973 | .html('<img src="../prototype/modules/mail/img/flagEditor.png">'); |
---|
| 1974 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1975 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", followupColor); |
---|
[5533] | 1976 | $(tr_element).addClass('selected_msg').find(':checkbox').trigger('click'); |
---|
| 1977 | configureFollowupflag(); |
---|
| 1978 | } |
---|
| 1979 | |
---|
[5540] | 1980 | |
---|
[5533] | 1981 | }); |
---|
| 1982 | |
---|
[3057] | 1983 | var norm = function (arg) {return (arg < 10 ? '0'+arg : arg);}; |
---|
| 1984 | var weekDays = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; |
---|
[3493] | 1985 | |
---|
| 1986 | var today = new Date(); |
---|
[3927] | 1987 | today.setHours(23); |
---|
| 1988 | today.setMinutes(59); |
---|
| 1989 | today.setSeconds(59); |
---|
| 1990 | today.setMilliseconds(999) |
---|
[3493] | 1991 | |
---|
[3512] | 1992 | var udate_local = null; |
---|
| 1993 | var date_msg = null; |
---|
[3493] | 1994 | |
---|
[3512] | 1995 | // old local messages can capture headers_msgs.udate as "hh:mm" or "dd/mm/yyyy" |
---|
[5134] | 1996 | 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] | 1997 | { |
---|
| 1998 | temp_msg_day = headers_msgs.msg_day.split('/'); |
---|
| 1999 | temp_msg_hour = headers_msgs.msg_hour.split(':'); |
---|
| 2000 | 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]); |
---|
| 2001 | } |
---|
| 2002 | else |
---|
| 2003 | { |
---|
| 2004 | // The new date implementation |
---|
| 2005 | // Using offset between user defined timezone and GMT |
---|
| 2006 | // Date object converts time to local timezone, so we have to adjust it |
---|
| 2007 | udate_local = headers_msgs.udate*1000 + offsetToGMT*1000 + today.getTimezoneOffset()*60*1000; |
---|
| 2008 | date_msg = new Date(udate_local); |
---|
| 2009 | } |
---|
| 2010 | |
---|
[5808] | 2011 | if (preferences.show_date_numerical == 0 || typeof(preferences.show_date_numerical) == 'undefined') { |
---|
| 2012 | if (today.getTime() - date_msg.getTime() < 86400000) |
---|
| 2013 | td_element5.innerHTML = norm(date_msg.getHours()) + ':' + norm(date_msg.getMinutes()); |
---|
[3057] | 2014 | else |
---|
[5808] | 2015 | if (today.getTime() - date_msg.getTime() < 172800000) |
---|
| 2016 | td_element5.innerHTML = get_lang('Yesterday'); |
---|
| 2017 | else if (today.getTime() - date_msg.getTime() < 259200000) |
---|
[3057] | 2018 | td_element5.innerHTML = get_lang(weekDays[date_msg.getDay()]); |
---|
[5808] | 2019 | else{ |
---|
| 2020 | td_element5.innerHTML = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 2021 | td_element5.title = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 2022 | td_element5.alt = td_element5.title; |
---|
| 2023 | } |
---|
| 2024 | }else{ |
---|
| 2025 | td_element5.innerHTML = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 2026 | td_element5.title = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 2027 | td_element5.alt = td_element5.title; |
---|
| 2028 | } |
---|
[5533] | 2029 | td_element6 = createTDElement(0,11,"td_msg td_resizable","center"); |
---|
[2] | 2030 | td_element6.onclick = _onclick; |
---|
| 2031 | td_element6.setAttribute("noWrap","true"); |
---|
[3028] | 2032 | td_element6.innerHTML = borkb(headers_msgs.Size); |
---|
| 2033 | |
---|
[2] | 2034 | tr_element.appendChild(td_element1); |
---|
| 2035 | tr_element.appendChild(td_element2); |
---|
| 2036 | tr_element.appendChild(td_element21); |
---|
| 2037 | tr_element.appendChild(td_element22); |
---|
| 2038 | tr_element.appendChild(td_element23); |
---|
[5533] | 2039 | tr_element.appendChild(td_element24); |
---|
| 2040 | tr_element.appendChild(td_element26); |
---|
| 2041 | tr_element.appendChild(td_element27); |
---|
[3035] | 2042 | tr_element.appendChild(td_element25); |
---|
[5533] | 2043 | |
---|
[2] | 2044 | tr_element.appendChild(td_element3); |
---|
| 2045 | tr_element.appendChild(td_element4); |
---|
| 2046 | tr_element.appendChild(td_element5); |
---|
| 2047 | tr_element.appendChild(td_element6); |
---|
| 2048 | return tr_element; |
---|
| 2049 | } |
---|
| 2050 | |
---|
[6975] | 2051 | function sort_box(search, sort,clean_selected){ |
---|
| 2052 | if (typeof(clean_selected) == "undefined") |
---|
| 2053 | selectAllFolderMsgs(false); |
---|
[4062] | 2054 | if (cellResized) |
---|
| 2055 | return; |
---|
[51] | 2056 | var message_header = Element("message_header_"+search); |
---|
[2] | 2057 | var handler_draw_box = function(data){ |
---|
[790] | 2058 | draw_box(data, current_folder,true); |
---|
[406] | 2059 | //Mostrar as msgs nao lidas de acordo com o filtro de relevancia |
---|
[3392] | 2060 | var msgs_unseen = 0; |
---|
| 2061 | draw_paging(data.num_msgs); |
---|
| 2062 | Element("new_m").innerHTML = '<font style="color:'+(data.tot_unseen == 0 ? '': 'red')+'">' + data.tot_unseen + '</font>'; |
---|
| 2063 | Element("tot_m").innerHTML = data.num_msgs; |
---|
[427] | 2064 | } |
---|
[2] | 2065 | |
---|
[51] | 2066 | if(sort_box_type == sort && search_box_type == search){ |
---|
[46] | 2067 | sort_box_reverse = sort_box_reverse ? 0 : 1; |
---|
[51] | 2068 | } |
---|
| 2069 | else if(sort_box_type != sort){ |
---|
[163] | 2070 | if ( (sort == 'SORTFROM') || (sort == 'SORTSUBJECT') ) |
---|
| 2071 | sort_box_reverse = 0; |
---|
| 2072 | else |
---|
| 2073 | sort_box_reverse = 1; |
---|
[51] | 2074 | } |
---|
[3035] | 2075 | |
---|
[46] | 2076 | // Global variable. |
---|
[51] | 2077 | sort_box_type = sort; |
---|
| 2078 | search_box_type = search; |
---|
[6975] | 2079 | if (typeof(clean_selected) == "undefined"){ |
---|
[6930] | 2080 | $.ajax({ |
---|
| 2081 | url: "controller.php?" + $.param( {action: "$this.imap_functions.get_range_msgs3", |
---|
| 2082 | folder: get_current_folder(), |
---|
| 2083 | msg_range_begin: "0", |
---|
| 2084 | msg_range_end: "0", |
---|
| 2085 | sort_box_type: "SORTARRIVAL", |
---|
| 2086 | search_box_type: search_box_type, |
---|
| 2087 | sort_box_reverse: "1" |
---|
| 2088 | }), |
---|
| 2089 | success: function(data){ |
---|
| 2090 | data = connector.unserialize(data); |
---|
| 2091 | if(data){ |
---|
| 2092 | var _data = {}; |
---|
| 2093 | $.each(data,function(index,value){ |
---|
| 2094 | if (data[index] && data[index].msg_number){ |
---|
| 2095 | _data[data[index].msg_number] = data[index].msg_number; |
---|
| 2096 | } |
---|
| 2097 | }); |
---|
| 2098 | populateSelectedMsgs(_data); |
---|
| 2099 | _data = {}; |
---|
| 2100 | |
---|
| 2101 | } |
---|
| 2102 | }, |
---|
| 2103 | beforeSend: function( jqXHR, settings ){ |
---|
| 2104 | connector.showProgressBar(); |
---|
| 2105 | }, |
---|
| 2106 | complete: function( jqXHR, settings ){ |
---|
| 2107 | connector.hideProgressBar(); |
---|
| 2108 | } |
---|
| 2109 | }); |
---|
[6975] | 2110 | } |
---|
[1752] | 2111 | 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] | 2112 | current_page = 1; |
---|
[406] | 2113 | //Comentado para nao sobrepor o numero de msgs nao lidas ao utilizar os filtros |
---|
| 2114 | //update_menu(); |
---|
[2] | 2115 | } |
---|
[4493] | 2116 | |
---|
[2] | 2117 | function draw_header_box(){ |
---|
| 2118 | switch(sort_box_type){ |
---|
| 2119 | case 'SORTFROM': |
---|
[4771] | 2120 | type_name = get_lang("From"); |
---|
[2] | 2121 | break; |
---|
| 2122 | case 'SORTSUBJECT': |
---|
| 2123 | type_name = get_lang("Subject"); |
---|
| 2124 | break; |
---|
| 2125 | case 'SORTARRIVAL': |
---|
| 2126 | type_name = get_lang("Date"); |
---|
| 2127 | break; |
---|
| 2128 | case 'SORTSIZE': |
---|
| 2129 | type_name = get_lang("Size"); |
---|
[3035] | 2130 | break; |
---|
[2] | 2131 | default: |
---|
| 2132 | type_name = get_lang("Date"); |
---|
[72] | 2133 | break; |
---|
[2] | 2134 | } |
---|
[5158] | 2135 | folder = special_folders['Sent']; |
---|
| 2136 | current = get_current_folder(); |
---|
| 2137 | if ((preferences.from_to_sent == "1") && (current.substr(current.length - folder.length, folder.length) == folder)) { |
---|
| 2138 | document.getElementById("message_header_SORTFROM_"+numBox).innerHTML = get_lang("To"); |
---|
| 2139 | }else{ |
---|
[4771] | 2140 | document.getElementById("message_header_SORTFROM_"+numBox).innerHTML = get_lang("From"); |
---|
[5158] | 2141 | } |
---|
[320] | 2142 | document.getElementById("message_header_SORTSUBJECT_"+numBox).innerHTML = get_lang("Subject"); |
---|
| 2143 | document.getElementById("message_header_SORTARRIVAL_"+numBox).innerHTML = get_lang("Date"); |
---|
[3035] | 2144 | document.getElementById("message_header_SORTSIZE_"+numBox).innerHTML = get_lang("Size"); |
---|
[790] | 2145 | 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] | 2146 | } |
---|
[5134] | 2147 | function verifyOption(name, id){ |
---|
| 2148 | var str = name + '' + id; |
---|
| 2149 | if(!Element(str).style.display == ""){ |
---|
| 2150 | var option_reply_options = document.getElementById('msg_opt_reply_options_'+id); |
---|
| 2151 | option_reply_options.value = 'show'; |
---|
| 2152 | option_reply_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2153 | Element('tr_other_options_'+id).style.display = 'none'; |
---|
| 2154 | var option_more_options = document.getElementById('msg_opt_more_options_'+id); |
---|
| 2155 | option_more_options.value = 'show'; |
---|
| 2156 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2157 | Element('tr_other_more_options_'+id).style.display = 'none'; |
---|
| 2158 | var option_mark_as_options = document.getElementById('msg_opt_mark_options_'+id); |
---|
| 2159 | option_mark_as_options.value = 'show'; |
---|
| 2160 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2161 | Element('tr_other_mark_options_'+id).style.display = 'none'; |
---|
| 2162 | } |
---|
| 2163 | } |
---|
[5308] | 2164 | |
---|
| 2165 | /*Busca a primeira mensagem na pagina*/ |
---|
| 2166 | function firstRow(){ |
---|
| 2167 | var thisCell; |
---|
| 2168 | if (objCell) |
---|
| 2169 | thisCell = objCell; |
---|
| 2170 | else |
---|
| 2171 | thisCell = document.getElementById("table_message_header_box_0").rows[0].cells[0]; |
---|
| 2172 | var tbM = getMessagesTable(thisCell); |
---|
| 2173 | proxy_mensagens.get_msg(tbM.rows[0].getAttribute('id'),get_current_folder(),true,show_msg); |
---|
| 2174 | } |
---|
| 2175 | |
---|
| 2176 | /*Busca a ultima mensagem na pagina*/ |
---|
| 2177 | function lastRow(){ |
---|
| 2178 | var thisCell; |
---|
| 2179 | if (objCell) |
---|
| 2180 | thisCell = objCell; |
---|
| 2181 | else |
---|
| 2182 | thisCell = document.getElementById("table_message_header_box_0").rows[0].cells[0]; |
---|
| 2183 | var tbM = getMessagesTable(thisCell); |
---|
| 2184 | proxy_mensagens.get_msg(tbM.rows[tbM.rows.length - 1].getAttribute('id'),get_current_folder(),true,show_msg); |
---|
| 2185 | } |
---|
| 2186 | |
---|
[5367] | 2187 | var msg_selected; |
---|
[2] | 2188 | function draw_message(info_msg, ID){ |
---|
[6487] | 2189 | // remove a flag $FilteredMessage da mensagem ao ser lida |
---|
| 2190 | if(info_msg.Unseen == "U"){ |
---|
| 2191 | $.each(fromRules, function(index, value) { |
---|
| 2192 | if(value == info_msg.msg_folder){ |
---|
| 2193 | cExecute ("$this.imap_functions.removeFlagMessagesFilter&folder="+info_msg.msg_folder+"&msg_number="+info_msg.msg_number, function(){}); |
---|
| 2194 | return false; |
---|
| 2195 | } |
---|
| 2196 | }); |
---|
| 2197 | } |
---|
[2] | 2198 | var content = document.getElementById('content_id_' + ID); |
---|
[3035] | 2199 | |
---|
[2] | 2200 | var menuHidden = Element("folderscol").style.display == 'none' ? true : false; |
---|
| 2201 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2202 | //Make the next/previous buttom. |
---|
| 2203 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2204 | var next_previous_msg_td = document.createElement("TD"); |
---|
| 2205 | next_previous_msg_td.setAttribute("noWrap","true"); |
---|
| 2206 | next_previous_msg_td.align = "right"; |
---|
[5735] | 2207 | next_previous_msg_td.style.fontSize = "10px"; |
---|
[2] | 2208 | next_previous_msg_td.width = "40px"; |
---|
| 2209 | var img_next_msg = document.createElement("IMG"); |
---|
[128] | 2210 | img_next_msg.id = 'msg_opt_next_' + ID; |
---|
[790] | 2211 | img_next_msg.src = './templates/'+template+'/images/down.button.png'; |
---|
[5249] | 2212 | if(preferences.use_shortcuts == '1') |
---|
| 2213 | img_next_msg.title = get_lang('Next Shortcut:Control + Down'); |
---|
| 2214 | else |
---|
| 2215 | img_next_msg.title = get_lang('Next'); |
---|
[2] | 2216 | img_next_msg.style.cursor = 'pointer'; |
---|
[569] | 2217 | |
---|
[4820] | 2218 | var folder_id = ID.match(/\d+/)[0]; |
---|
| 2219 | var folder; |
---|
[3394] | 2220 | |
---|
[7043] | 2221 | //Correᅵᅵo para fazer funcionar e-mails assinados no formato encapsulado. |
---|
[4820] | 2222 | // folder_id = info_msg.original_ID ? info_msg.original_ID: info_msg.msg_number; |
---|
| 2223 | //if ((folder = document.getElementById(info_msg.msg_number)) == null) |
---|
[4493] | 2224 | if ((folder = Element(info_msg.original_ID)) == null) |
---|
| 2225 | folder = Element(info_msg.msg_number); |
---|
| 2226 | |
---|
[5134] | 2227 | |
---|
[3035] | 2228 | if (folder){ // mensagem local criptografada nao tem ID da pasta local |
---|
| 2229 | if (folder.nextSibling){ |
---|
| 2230 | var nextMsgBox = folder.nextSibling.name?folder.nextSibling.name:info_msg.msg_folder; |
---|
[1035] | 2231 | |
---|
[5134] | 2232 | if (nextMsgBox == "INBOX" + cyrus_delimiter + "decifradas")// teste para ver se a mensagem vem da pasta oculta decifradas |
---|
[3035] | 2233 | nextMsgBox = get_current_folder(); |
---|
[1035] | 2234 | |
---|
[3035] | 2235 | img_next_msg.onclick = function() |
---|
| 2236 | { |
---|
| 2237 | currentTab = ID; |
---|
| 2238 | openTab.type[ID] = 2; |
---|
| 2239 | proxy_mensagens.get_msg(folder.nextSibling.id,nextMsgBox,true,show_msg); |
---|
[5308] | 2240 | //select_msg('null', 'down', true); |
---|
[5367] | 2241 | if (!msg_selected){ |
---|
| 2242 | select_msg('null', 'down', true); |
---|
| 2243 | msg_selected = true; |
---|
| 2244 | } |
---|
[3035] | 2245 | }; |
---|
| 2246 | } |
---|
[7043] | 2247 | /*Ultima mensagem de cada pï¿œgina, exceto a ultima*/ |
---|
[5308] | 2248 | else if( (current_page < total_pages) ){ |
---|
| 2249 | |
---|
| 2250 | img_next_msg.onclick = function() |
---|
| 2251 | { |
---|
| 2252 | |
---|
| 2253 | current_page++; |
---|
| 2254 | var tot_msgs = parseInt(Element("tot_m").innerHTML); |
---|
| 2255 | var range_begin = preferences.max_email_per_page*( current_page - 1 ) + 1; |
---|
| 2256 | var range_end; |
---|
| 2257 | if ( range_begin + parseInt(preferences.max_email_per_page - 1) > tot_msgs ) |
---|
| 2258 | range_end = tot_msgs; |
---|
| 2259 | else |
---|
| 2260 | range_end = range_begin + parseInt(preferences.max_email_per_page - 1); |
---|
| 2261 | var creatBoxProximo = function (data){ |
---|
| 2262 | draw_box(data, get_current_folder()); |
---|
| 2263 | firstRow(); |
---|
| 2264 | }; |
---|
[5321] | 2265 | proxy_mensagens.messages_list(get_current_folder(),range_begin,range_end,sort_box_type,search_box_type,sort_box_reverse,'','', creatBoxProximo); |
---|
[5308] | 2266 | |
---|
| 2267 | }; |
---|
| 2268 | } |
---|
[3035] | 2269 | else |
---|
| 2270 | { |
---|
| 2271 | img_next_msg.src = "./templates/"+template+"/images/down.gray.button.png"; |
---|
| 2272 | img_next_msg.style.cursor = 'default'; |
---|
[1035] | 2273 | |
---|
[3035] | 2274 | } |
---|
| 2275 | } |
---|
| 2276 | else |
---|
| 2277 | { |
---|
| 2278 | img_next_msg.src = "./templates/"+template+"/images/down.gray.button.png"; |
---|
[1035] | 2279 | img_next_msg.style.cursor = 'default'; |
---|
[4726] | 2280 | // testa se a mensagem e local |
---|
| 2281 | if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(info_msg.msg_folder == "INBOX" + cyrus_delimiter + "decifradas")) // testa se a mensagem e local |
---|
[569] | 2282 | { |
---|
[3035] | 2283 | img_next_msg.onclick = function() |
---|
| 2284 | { |
---|
| 2285 | delete_border(ID); |
---|
| 2286 | }; |
---|
| 2287 | } |
---|
| 2288 | } |
---|
[2] | 2289 | var img_space = document.createElement("SPAN"); |
---|
| 2290 | img_space.innerHTML = " "; |
---|
| 2291 | var img_previous_msg = document.createElement("IMG"); |
---|
[128] | 2292 | img_previous_msg.id = 'msg_opt_previous_' + ID; |
---|
[790] | 2293 | img_previous_msg.src = './templates/'+template+'/images/up.button.png'; |
---|
[5249] | 2294 | if(preferences.use_shortcuts == '1') |
---|
| 2295 | img_previous_msg.title = get_lang('Previous Shortcut:Control + Up'); |
---|
| 2296 | else |
---|
| 2297 | img_previous_msg.title = get_lang('Previous'); |
---|
[2] | 2298 | img_previous_msg.style.cursor = 'pointer'; |
---|
[569] | 2299 | |
---|
[5134] | 2300 | |
---|
[3035] | 2301 | if (folder){ // mensagem local criptografada nao tem ID da pasta local |
---|
| 2302 | if (folder.previousSibling) |
---|
| 2303 | { |
---|
| 2304 | var previousMsgBox = folder.previousSibling.name?folder.previousSibling.name:info_msg.msg_folder; |
---|
[1035] | 2305 | |
---|
[4726] | 2306 | if (previousMsgBox == "INBOX" + cyrus_delimiter + "decifradas") // teste para ver se a mensagem vem da pasta oculta decifradas |
---|
[3035] | 2307 | previousMsgBox = get_current_folder(); |
---|
[1035] | 2308 | |
---|
[3035] | 2309 | img_previous_msg.onclick = function() |
---|
| 2310 | { |
---|
| 2311 | currentTab = ID; |
---|
| 2312 | openTab.type[ID] = 2; |
---|
| 2313 | proxy_mensagens.get_msg(folder.previousSibling.id,previousMsgBox,true,show_msg); |
---|
[5308] | 2314 | //select_msg('null', 'up', false); |
---|
[5367] | 2315 | if (!msg_selected){ |
---|
| 2316 | select_msg('null', 'up', true); |
---|
| 2317 | msg_selected = true; |
---|
| 2318 | } |
---|
[3035] | 2319 | }; |
---|
| 2320 | } |
---|
[7043] | 2321 | //primeira mensagem de cada pï¿œgina, exceto a primeira |
---|
[5308] | 2322 | else if(current_page > 1){ |
---|
| 2323 | |
---|
| 2324 | img_previous_msg.onclick = function() |
---|
| 2325 | { |
---|
| 2326 | |
---|
| 2327 | current_page--; |
---|
| 2328 | var range_begin = (current_page - 1)*preferences.max_email_per_page + 1; |
---|
| 2329 | var range_end = current_page*preferences.max_email_per_page; |
---|
| 2330 | var creatBoxAnterior = function (data){ |
---|
| 2331 | draw_box(data, get_current_folder()); |
---|
| 2332 | lastRow(); |
---|
| 2333 | }; |
---|
| 2334 | proxy_mensagens.messages_list(get_current_folder(),range_begin,range_end,sort_box_type,search_box_type,sort_box_reverse,'','', creatBoxAnterior); |
---|
| 2335 | }; |
---|
| 2336 | } |
---|
[3035] | 2337 | else |
---|
| 2338 | { |
---|
| 2339 | img_previous_msg.src = "./templates/"+template+"/images/up.gray.button.png"; |
---|
| 2340 | img_previous_msg.style.cursor = 'default'; |
---|
| 2341 | } |
---|
[569] | 2342 | } |
---|
| 2343 | else |
---|
[1035] | 2344 | { |
---|
| 2345 | img_previous_msg.src = "./templates/"+template+"/images/up.gray.button.png"; |
---|
| 2346 | img_previous_msg.style.cursor = 'default'; |
---|
[4726] | 2347 | // testa se a mensagem e local |
---|
| 2348 | if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(info_msg.msg_folder == "INBOX" + cyrus_delimiter + "decifradas")) // testa se a mensagem e local |
---|
[3035] | 2349 | { |
---|
| 2350 | img_previous_msg.onclick = function() |
---|
| 2351 | { |
---|
| 2352 | delete_border(ID); |
---|
| 2353 | }; |
---|
| 2354 | } |
---|
| 2355 | } |
---|
[2] | 2356 | next_previous_msg_td.appendChild(img_previous_msg); |
---|
| 2357 | next_previous_msg_td.appendChild(img_space); |
---|
| 2358 | next_previous_msg_td.appendChild(img_next_msg); |
---|
| 2359 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2360 | //Make the header message. |
---|
| 2361 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2362 | var table_message = document.createElement("TABLE"); |
---|
| 2363 | var tbody_message = document.createElement("TBODY"); |
---|
| 2364 | table_message.border = "0"; |
---|
[4493] | 2365 | //table_message.width = "100%"; |
---|
| 2366 | //k! |
---|
| 2367 | table_message.setAttribute("class", "expressomail-message-body"); |
---|
| 2368 | table_message.setAttribute("className", "expressomail-message-body"); |
---|
[2] | 2369 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2370 | //Make the options message. |
---|
| 2371 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2372 | var tr0 = document.createElement("TR"); |
---|
| 2373 | tr0.className = "tr_message_header"; |
---|
| 2374 | var td0 = document.createElement("TD"); |
---|
| 2375 | var table_message_options = document.createElement("TABLE"); |
---|
| 2376 | table_message_options.width = "100%"; |
---|
| 2377 | table_message_options.border = '0'; |
---|
| 2378 | table_message_options.className = 'table_message'; |
---|
| 2379 | var tbody_message_options = document.createElement("TBODY"); |
---|
| 2380 | var tr = document.createElement("TR"); |
---|
| 2381 | var td = document.createElement("TD"); |
---|
| 2382 | td.setAttribute("noWrap","true"); |
---|
[5735] | 2383 | td.style.fontSize = "10px"; |
---|
[2] | 2384 | var _name = ''; |
---|
| 2385 | var _maxChar = menuHidden ? 40 : 15; |
---|
[3035] | 2386 | |
---|
[2] | 2387 | if (info_msg.from.name) |
---|
[1416] | 2388 | { |
---|
| 2389 | var spanName = document.createElement("SPAN"); |
---|
| 2390 | spanName.innerHTML = info_msg.from.name; |
---|
| 2391 | _name = spanName.innerHTML.length > _maxChar ? spanName.innerHTML.substring(0,_maxChar) + "..." : spanName.innerHTML; |
---|
| 2392 | } |
---|
| 2393 | else |
---|
[2] | 2394 | _name = info_msg.from.email.length > _maxChar ? info_msg.from.email.substring(0,_maxChar) + "..." : info_msg.from.email; |
---|
| 2395 | |
---|
| 2396 | td.innerHTML = _name.bold() + ', ' + info_msg.smalldate; |
---|
[4493] | 2397 | //k! |
---|
[3035] | 2398 | if (info_msg.attachments && info_msg.attachments.length > 0) |
---|
[3369] | 2399 | 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] | 2400 | |
---|
[91] | 2401 | if (typeof(info_msg.signature) == 'string') |
---|
[3035] | 2402 | { |
---|
[109] | 2403 | if (info_msg.signature != "void") |
---|
[790] | 2404 | 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] | 2405 | else |
---|
[790] | 2406 | 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] | 2407 | } |
---|
[4072] | 2408 | |
---|
[320] | 2409 | if (info_msg.DispositionNotificationTo) |
---|
| 2410 | { |
---|
[3798] | 2411 | 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] | 2412 | } |
---|
[3035] | 2413 | |
---|
[5134] | 2414 | if (info_msg.Flagged == 'F') |
---|
| 2415 | { |
---|
[5569] | 2416 | 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] | 2417 | } |
---|
[2] | 2418 | // NORMAL MSG |
---|
| 2419 | if(info_msg.Draft != 'X') |
---|
| 2420 | { |
---|
| 2421 | var options = document.createElement("TD"); |
---|
[790] | 2422 | options.width = "30%"; |
---|
[2] | 2423 | options.setAttribute("noWrap","true"); |
---|
[5735] | 2424 | options.style.fontSize = "10px"; |
---|
[5134] | 2425 | |
---|
| 2426 | //BEGIN: DESENHA MOSTRA DETALHES, OCULTAR DETALHES |
---|
[2] | 2427 | var option_hide_more = document.createElement("SPAN"); |
---|
| 2428 | option_hide_more.className = 'message_options'; |
---|
[4826] | 2429 | option_hide_more.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2430 | option_hide_more.onmouseout=function () {this.className='message_options'}; |
---|
[24] | 2431 | options.align = 'right'; |
---|
[2] | 2432 | option_hide_more.value = 'more_options'; |
---|
| 2433 | option_hide_more.id = 'option_hide_more_'+ID; |
---|
| 2434 | option_hide_more.onclick = function(){ |
---|
| 2435 | if (this.value == 'more_options'){ |
---|
[3021] | 2436 | this.innerHTML = "<b><u>"+get_lang('Hide details')+"</u></b>"; |
---|
[2] | 2437 | this.value = 'hide_options'; |
---|
| 2438 | Element('table_message_others_options_'+ID).style.display = ''; |
---|
| 2439 | } |
---|
| 2440 | else{ |
---|
[3021] | 2441 | this.innerHTML = get_lang('Show details'); |
---|
[2] | 2442 | this.value = 'more_options'; |
---|
| 2443 | Element('table_message_others_options_'+ID).style.display = 'none'; |
---|
| 2444 | } |
---|
[3018] | 2445 | resizeWindow(); |
---|
[2] | 2446 | }; |
---|
[5134] | 2447 | //END: DESENHA MOSTRA DETALHES, OCULTAR DETALHES |
---|
| 2448 | |
---|
| 2449 | //OPCAO PARA MARCAR COMO |
---|
| 2450 | var option_mark_as = document.createElement("SPAN"); |
---|
| 2451 | option_mark_as.innerHTML = "<b>"+get_lang('Mark as')+"</b>"; |
---|
| 2452 | option_mark_as.className = 'message_options'; |
---|
| 2453 | option_mark_as.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2454 | option_mark_as.onmouseout=function () {this.className='message_options'}; |
---|
| 2455 | option_mark_as.onclick = function(){ |
---|
| 2456 | verifyOption('tr_other_mark_options_', ID); |
---|
| 2457 | var thi = document.getElementById('msg_opt_mark_options_'+ID); |
---|
| 2458 | if (thi.value != 'hide'){ |
---|
| 2459 | thi.value = 'hide'; |
---|
| 2460 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2461 | Element('tr_other_mark_options_'+ID).style.display = ''; |
---|
| 2462 | |
---|
| 2463 | } |
---|
| 2464 | else{ |
---|
| 2465 | thi.value = 'show'; |
---|
| 2466 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2467 | Element('tr_other_mark_options_'+ID).style.display = 'none'; |
---|
| 2468 | } |
---|
| 2469 | }; |
---|
| 2470 | //DESENHA OPCOES DO MARCAR COMO |
---|
[3036] | 2471 | var option_mark_as_unseen = document.createElement("SPAN"); |
---|
[5134] | 2472 | option_mark_as_unseen.className = "reply_options"; |
---|
[4826] | 2473 | option_mark_as_unseen.onclick = function () {changeLinkState(this,'seen'); |
---|
[3716] | 2474 | proxy_mensagens.proxy_set_message_flag(folder_id,'unseen'); |
---|
[3036] | 2475 | write_msg(get_lang('Message marked as ')+get_lang("Unseen")); |
---|
| 2476 | }; |
---|
[5134] | 2477 | option_mark_as_unseen.onmouseover=function () {this.className='reply_options_active'}; |
---|
| 2478 | option_mark_as_unseen.onmouseout=function () {this.className='reply_options'}; |
---|
[3036] | 2479 | option_mark_as_unseen.innerHTML = get_lang("Unseen"); |
---|
[3021] | 2480 | |
---|
[3036] | 2481 | var option_mark_important = document.createElement("SPAN"); |
---|
[5134] | 2482 | option_mark_important.className = 'reply_options'; |
---|
| 2483 | option_mark_important.onmouseover=function () {this.className='reply_options_active';}; |
---|
| 2484 | option_mark_important.onmouseout=function () {this.className='reply_options'}; |
---|
[3036] | 2485 | |
---|
| 2486 | if (info_msg.Flagged == "F"){ |
---|
[4072] | 2487 | option_mark_important.onclick = function() { |
---|
[3806] | 2488 | var _this = this; |
---|
| 2489 | proxy_mensagens.proxy_set_message_flag(folder_id,'unflagged', function(success){ |
---|
| 2490 | if (success) { |
---|
| 2491 | changeLinkState(_this, 'important'); |
---|
| 2492 | write_msg(get_lang('Message marked as ') + get_lang("Normal")); |
---|
| 2493 | } |
---|
| 2494 | } ); |
---|
[4072] | 2495 | |
---|
[3036] | 2496 | }; |
---|
| 2497 | option_mark_important.innerHTML = get_lang("Normal"); |
---|
| 2498 | } |
---|
| 2499 | else{ |
---|
[4826] | 2500 | option_mark_important.onclick = function() {changeLinkState(this,'normal'); |
---|
[3716] | 2501 | proxy_mensagens.proxy_set_message_flag(folder_id,'flagged'); |
---|
[3036] | 2502 | write_msg(get_lang('Message marked as ')+get_lang("Important")); |
---|
| 2503 | }; |
---|
| 2504 | option_mark_important.innerHTML = get_lang("Important"); |
---|
| 2505 | } |
---|
[5134] | 2506 | //option_mark.appendChild(option_mark_as_unseen); |
---|
| 2507 | //option_mark.appendChild(option_mark_important); |
---|
| 2508 | |
---|
| 2509 | |
---|
[3021] | 2510 | option_hide_more.innerHTML = get_lang('Show details'); |
---|
[5134] | 2511 | option_hide_more.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'O') : get_lang('Show details'); |
---|
| 2512 | |
---|
| 2513 | var space3 = document.createElement("SPAN"); |
---|
| 2514 | space3.innerHTML = ' | '; |
---|
| 2515 | |
---|
| 2516 | var option_mark_as_options = document.createElement('IMG'); |
---|
| 2517 | option_mark_as_options.id = 'msg_opt_mark_options_'+ID; |
---|
| 2518 | option_mark_as_options.src = '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2519 | option_mark_as_options.value = 'show'; |
---|
| 2520 | |
---|
| 2521 | option_mark_as_options.onmouseover = function(){ |
---|
| 2522 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/over.png'; |
---|
| 2523 | option_mark_as.className = 'message_options_active'; |
---|
| 2524 | }; |
---|
| 2525 | option_mark_as_options.onmouseout = function(){ |
---|
| 2526 | option_mark_as.className = 'message_options'; |
---|
| 2527 | if (this.value == 'show') |
---|
| 2528 | { |
---|
| 2529 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2530 | } |
---|
| 2531 | else |
---|
| 2532 | { |
---|
| 2533 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2534 | } |
---|
| 2535 | }; |
---|
| 2536 | option_mark_as_options.onclick = function(){ |
---|
| 2537 | verifyOption('tr_other_mark_options_', ID); |
---|
| 2538 | if (this.value != 'hide'){ |
---|
| 2539 | this.value = 'hide'; |
---|
| 2540 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2541 | Element('tr_other_mark_options_'+ID).style.display = ''; |
---|
| 2542 | |
---|
| 2543 | } |
---|
| 2544 | else{ |
---|
| 2545 | this.value = 'show'; |
---|
| 2546 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2547 | Element('tr_other_mark_options_'+ID).style.display = 'none'; |
---|
| 2548 | } |
---|
| 2549 | }; |
---|
| 2550 | |
---|
[2] | 2551 | options.appendChild(option_hide_more); |
---|
[5134] | 2552 | options.appendChild(space3); |
---|
| 2553 | options.appendChild(option_mark_as_options); |
---|
| 2554 | options.appendChild(option_mark_as); |
---|
| 2555 | //FIM OPCAO PARA MARCAR COMO |
---|
[3021] | 2556 | |
---|
[24] | 2557 | var space0 = document.createElement("SPAN"); |
---|
[790] | 2558 | space0.innerHTML = ' | '; |
---|
[2] | 2559 | var space1 = document.createElement("SPAN"); |
---|
[790] | 2560 | space1.innerHTML = ' | '; |
---|
[2] | 2561 | var space2 = document.createElement("SPAN"); |
---|
[790] | 2562 | space2.innerHTML = ' | '; |
---|
[2] | 2563 | |
---|
[5134] | 2564 | //OPCAO PARA MAIS ACOES |
---|
| 2565 | var option_more = document.createElement("SPAN"); |
---|
| 2566 | option_more.id = 'msg_opt_more_actions_'+ID; |
---|
| 2567 | option_more.className = 'message_options'; |
---|
| 2568 | //option_more.onclick = function(){new_message('forward', ID);}; |
---|
| 2569 | option_more.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2570 | option_more.onmouseout=function () {this.className='message_options'}; |
---|
| 2571 | option_more.onclick = function(){ |
---|
| 2572 | verifyOption('tr_other_more_options_', ID); |
---|
| 2573 | if (option_more_options.value != 'hide'){ |
---|
| 2574 | option_more_options.value = 'hide'; |
---|
| 2575 | option_more_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2576 | Element('tr_other_more_options_'+ID).style.display = ''; |
---|
| 2577 | |
---|
| 2578 | } |
---|
| 2579 | else{ |
---|
| 2580 | option_more_options.value = 'show'; |
---|
| 2581 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2582 | Element('tr_other_more_options_'+ID).style.display = 'none'; |
---|
| 2583 | } |
---|
| 2584 | }; |
---|
| 2585 | option_more.innerHTML = get_lang('More Actions'); |
---|
| 2586 | |
---|
| 2587 | //CRIA IMG DE MAIS ACOES |
---|
| 2588 | var option_more_options = document.createElement('IMG'); |
---|
| 2589 | option_more_options.id = 'msg_opt_more_options_'+ID; |
---|
| 2590 | option_more_options.src = '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2591 | option_more_options.value = 'show'; |
---|
| 2592 | |
---|
| 2593 | option_more_options.onmouseover = function(){ |
---|
| 2594 | option_more.className = 'message_options_active'; |
---|
| 2595 | option_more_options.src= '../expressoMail1_2/templates/default/images/over.png'; |
---|
| 2596 | }; |
---|
| 2597 | option_more_options.onmouseout = function(){ |
---|
| 2598 | option_more.className = 'message_options'; |
---|
| 2599 | if (this.value == 'show') |
---|
| 2600 | { |
---|
| 2601 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2602 | } |
---|
| 2603 | else |
---|
| 2604 | { |
---|
| 2605 | option_more_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2606 | } |
---|
| 2607 | }; |
---|
| 2608 | option_more_options.onclick = function(){ |
---|
| 2609 | verifyOption('tr_other_more_options_',ID); |
---|
| 2610 | |
---|
| 2611 | if (this.value != 'hide'){ |
---|
| 2612 | this.value = 'hide'; |
---|
| 2613 | option_more_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2614 | Element('tr_other_more_options_'+ID).style.display = ''; |
---|
| 2615 | |
---|
| 2616 | } |
---|
| 2617 | else{ |
---|
| 2618 | this.value = 'show'; |
---|
| 2619 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2620 | Element('tr_other_more_options_'+ID).style.display = 'none'; |
---|
| 2621 | } |
---|
| 2622 | }; |
---|
[2] | 2623 | options.appendChild(space1); |
---|
[5134] | 2624 | options.appendChild(option_more_options); |
---|
| 2625 | options.appendChild(option_more); |
---|
| 2626 | //FIM OPCAO PARA MAIS ACOES |
---|
| 2627 | |
---|
| 2628 | //OPCAO PARA RESPONDER |
---|
[2] | 2629 | var option_reply = document.createElement("SPAN"); |
---|
[128] | 2630 | option_reply.id = 'msg_opt_reply_'+ID; |
---|
[2] | 2631 | option_reply.className = 'message_options'; |
---|
| 2632 | option_reply.onclick = function(){new_message('reply_with_history', ID);}; |
---|
[197] | 2633 | option_reply.innerHTML = get_lang('Reply'); |
---|
[4826] | 2634 | option_reply.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2635 | option_reply.onmouseout=function () {this.className='message_options'}; |
---|
[5134] | 2636 | option_reply.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'R') : get_lang('Reply'); |
---|
[3036] | 2637 | |
---|
[2] | 2638 | options.appendChild(space2); |
---|
[3021] | 2639 | |
---|
| 2640 | var option_reply_options = document.createElement('IMG'); |
---|
| 2641 | option_reply_options.id = 'msg_opt_reply_options_'+ID; |
---|
| 2642 | option_reply_options.src = '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2643 | option_reply_options.value = 'show'; |
---|
| 2644 | |
---|
| 2645 | option_reply_options.onmouseover = function(){ |
---|
| 2646 | option_reply_options.src= '../expressoMail1_2/templates/default/images/over.png'; |
---|
| 2647 | }; |
---|
| 2648 | option_reply_options.onmouseout = function(){ |
---|
| 2649 | if (this.value == 'show') |
---|
| 2650 | { |
---|
| 2651 | option_reply_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2652 | } |
---|
| 2653 | else |
---|
| 2654 | { |
---|
| 2655 | option_reply_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2656 | } |
---|
| 2657 | }; |
---|
| 2658 | option_reply_options.onclick = function(){ |
---|
[5134] | 2659 | verifyOption('tr_other_options_', ID); |
---|
[3021] | 2660 | if (this.value != 'hide'){ |
---|
| 2661 | this.value = 'hide'; |
---|
| 2662 | option_reply_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2663 | Element('tr_other_options_'+ID).style.display = ''; |
---|
| 2664 | |
---|
| 2665 | } |
---|
| 2666 | else{ |
---|
| 2667 | this.value = 'show'; |
---|
| 2668 | option_reply_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2669 | Element('tr_other_options_'+ID).style.display = 'none'; |
---|
| 2670 | } |
---|
| 2671 | }; |
---|
| 2672 | options.appendChild(option_reply_options); |
---|
[2] | 2673 | options.appendChild(option_reply); |
---|
[5134] | 2674 | //FIM OPCAO PARA RESPONDER |
---|
| 2675 | |
---|
| 2676 | //OPCAO PARA ENCAMINHAR |
---|
| 2677 | var option_forward = document.createElement("SPAN"); |
---|
| 2678 | option_forward.id = 'msg_opt_forward_'+ID; |
---|
| 2679 | option_forward.className = 'message_options'; |
---|
| 2680 | option_forward.innerHTML = get_lang('Forward'); |
---|
| 2681 | option_forward.onclick = function(){new_message('forward', ID);}; |
---|
| 2682 | option_forward.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2683 | option_forward.onmouseout=function () {this.className='message_options'}; |
---|
| 2684 | option_forward.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'E') : get_lang('Forward'); |
---|
| 2685 | |
---|
| 2686 | var space9 = document.createElement("SPAN"); |
---|
| 2687 | space9.innerHTML = ' | '; |
---|
| 2688 | |
---|
| 2689 | options.appendChild(space9); |
---|
| 2690 | options.appendChild(option_forward); |
---|
| 2691 | //FIM DA OPCAO PARA ENCAMINHAR |
---|
| 2692 | |
---|
| 2693 | //OPCAO PARA DELETAR |
---|
| 2694 | var option_delete = document.createElement("SPAN"); |
---|
| 2695 | option_delete.id = 'msg_opt_delete_'+ID; |
---|
| 2696 | option_delete.className = 'message_options'; |
---|
| 2697 | option_delete.onclick = function(){proxy_mensagens.delete_msgs('null','selected','null');}; |
---|
| 2698 | option_delete.innerHTML = get_lang('Delete'); |
---|
| 2699 | option_delete.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2700 | option_delete.onmouseout=function () {this.className='message_options'}; |
---|
| 2701 | option_delete.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'Delete') : get_lang('Delete'); |
---|
[3035] | 2702 | |
---|
[5134] | 2703 | var space6 = document.createElement("SPAN"); |
---|
| 2704 | space6.innerHTML = ' | '; |
---|
| 2705 | |
---|
| 2706 | options.appendChild(space6); |
---|
| 2707 | options.appendChild(option_delete); |
---|
| 2708 | //FIM OPCAO PARA DELETAR |
---|
| 2709 | |
---|
[2] | 2710 | tr.appendChild(td); |
---|
[5134] | 2711 | //tr.appendChild(option_mark); |
---|
[2] | 2712 | tr.appendChild(options); |
---|
| 2713 | tr.appendChild(next_previous_msg_td); |
---|
| 2714 | tbody_message_options.appendChild(tr); |
---|
[3035] | 2715 | |
---|
[2] | 2716 | ////////// OTHER OPTIONS //////////////////// |
---|
| 2717 | var tr_other_options = document.createElement("TR"); |
---|
[5134] | 2718 | var tr_other_mark_options = document.createElement("TR"); |
---|
| 2719 | var tr_other_more_options = document.createElement("TR"); |
---|
| 2720 | |
---|
| 2721 | tr_other_mark_options.id = 'tr_other_mark_options_' + ID; |
---|
| 2722 | tr_other_mark_options.style.display = 'none'; |
---|
| 2723 | tr_other_mark_options.style.backgroundColor = '#205C8E'; |
---|
[2] | 2724 | tr_other_options.id = 'tr_other_options_' + ID; |
---|
| 2725 | tr_other_options.style.display = 'none'; |
---|
[5134] | 2726 | tr_other_options.style.backgroundColor = '#205C8E'; |
---|
| 2727 | tr_other_more_options.id = 'tr_other_more_options_' + ID; |
---|
| 2728 | tr_other_more_options.style.display = 'none'; |
---|
| 2729 | tr_other_more_options.style.backgroundColor = '#205C8E'; |
---|
[3035] | 2730 | |
---|
[2] | 2731 | var td_other_options = document.createElement("TD"); |
---|
[5134] | 2732 | var td_other_mark_options = document.createElement("TD"); |
---|
| 2733 | var td_other_more_options = document.createElement("TD"); |
---|
| 2734 | |
---|
[2] | 2735 | td_other_options.colSpan = '3'; |
---|
[5134] | 2736 | td_other_mark_options.colSpan = '3'; |
---|
| 2737 | td_other_more_options.colSpan = '3'; |
---|
| 2738 | |
---|
[2] | 2739 | var div_other_options = document.createElement("DIV"); |
---|
[5134] | 2740 | var div_other_mark_options = document.createElement("DIV"); |
---|
| 2741 | var div_other_more_options = document.createElement("DIV"); |
---|
[2] | 2742 | |
---|
[5134] | 2743 | //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>, '; |
---|
| 2744 | //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>, '; |
---|
| 2745 | //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] | 2746 | 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] | 2747 | //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> | '; |
---|
| 2748 | 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> | '; |
---|
| 2749 | 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> | '; |
---|
| 2750 | 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] | 2751 | |
---|
[5134] | 2752 | option_reply_to_all__title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'T') : ''; |
---|
| 2753 | 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] | 2754 | 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] | 2755 | 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] | 2756 | |
---|
[5134] | 2757 | 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> | '; |
---|
| 2758 | |
---|
[5754] | 2759 | div_other_more_options.innerHTML += option_move + option_print + option_export + block_user + report_error; |
---|
[5134] | 2760 | |
---|
| 2761 | div_other_options.innerHTML += option_reply_without_history + option_reply_to_all_without_history + option_reply_to_all; |
---|
[69] | 2762 | if (use_spam_filter) { |
---|
[5134] | 2763 | if(info_msg.msg_folder == 'INBOX'+cyrus_delimiter+'Spam' || (info_msg.msg_folder.match(/^user/) && info_msg.msg_folder.match(/Spam$/))){ |
---|
| 2764 | 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] | 2765 | } |
---|
[5134] | 2766 | else{ |
---|
| 2767 | 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> | '; |
---|
| 2768 | } |
---|
| 2769 | } |
---|
| 2770 | var space5 = document.createElement("SPAN"); |
---|
| 2771 | space5.innerHTML = ' | '; |
---|
[4830] | 2772 | |
---|
[5134] | 2773 | div_other_mark_options.appendChild(option_mark_as_unseen); |
---|
| 2774 | var space4 = document.createElement("SPAN"); |
---|
| 2775 | space4.innerHTML = ' | '; |
---|
| 2776 | div_other_mark_options.appendChild(space4); |
---|
| 2777 | div_other_mark_options.appendChild(option_mark_important); |
---|
| 2778 | var space7 = document.createElement("SPAN"); |
---|
| 2779 | space7.innerHTML = ' | '; |
---|
| 2780 | div_other_mark_options.appendChild(space7); |
---|
[4830] | 2781 | |
---|
[3021] | 2782 | td_other_options.align = 'right'; |
---|
| 2783 | td_other_options.style.paddingTop = '3px'; |
---|
[2] | 2784 | td_other_options.appendChild(div_other_options); |
---|
[3021] | 2785 | |
---|
[5134] | 2786 | td_other_mark_options.align = 'right'; |
---|
| 2787 | td_other_mark_options.style.paddingTop = '3px'; |
---|
| 2788 | td_other_mark_options.appendChild(div_other_mark_options); |
---|
| 2789 | |
---|
| 2790 | td_other_more_options.align = 'right'; |
---|
| 2791 | td_other_more_options.style.paddingTop = '3px'; |
---|
| 2792 | td_other_more_options.appendChild(div_other_more_options); |
---|
[3021] | 2793 | |
---|
[5134] | 2794 | |
---|
[2] | 2795 | tr_other_options.appendChild(td_other_options); |
---|
| 2796 | tbody_message_options.appendChild(tr_other_options); |
---|
[5134] | 2797 | |
---|
| 2798 | tr_other_more_options.appendChild(td_other_more_options); |
---|
| 2799 | tbody_message_options.appendChild(tr_other_more_options); |
---|
| 2800 | |
---|
| 2801 | tr_other_mark_options.appendChild(td_other_mark_options); |
---|
| 2802 | tbody_message_options.appendChild(tr_other_mark_options); |
---|
[2] | 2803 | ////////// END OTHER OPTIONS //////////////// |
---|
[1035] | 2804 | |
---|
[3035] | 2805 | ////////// BEGIN SIGNATURE ////////////////// |
---|
[1035] | 2806 | if (info_msg.signature && info_msg.signature.length > 0) |
---|
| 2807 | { |
---|
[3352] | 2808 | var tr_signature = document.createElement("TR"); |
---|
| 2809 | var td_signature = document.createElement("TD"); |
---|
| 2810 | td_signature.className = 'tr_message_header'; |
---|
| 2811 | tr_signature.id = 'tr_signature_'+ID; |
---|
| 2812 | td_signature.colSpan = "5"; |
---|
| 2813 | tr_signature.style.display = 'none'; |
---|
| 2814 | for (i in info_msg.signature) |
---|
| 2815 | { |
---|
| 2816 | if(typeof(info_msg.signature[i]) == 'object') |
---|
| 2817 | { |
---|
| 2818 | var aux = ''; |
---|
| 2819 | for (ii in info_msg.signature[i]) |
---|
| 2820 | { |
---|
| 2821 | if(info_msg.signature[i][ii].indexOf("###") > -1) |
---|
| 2822 | { |
---|
| 2823 | 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); |
---|
| 2824 | } |
---|
| 2825 | else |
---|
| 2826 | { |
---|
| 2827 | aux += info_msg.signature[i][ii]; |
---|
| 2828 | } |
---|
| 2829 | } |
---|
| 2830 | td_signature.innerHTML += "<a onclick=\"javascript:alert('" + aux + "')\"><b><font color=\"#0000FF\">" + get_lang("More") + "...</font></b></a>"; |
---|
| 2831 | continue; |
---|
| 2832 | } |
---|
| 2833 | if(info_msg.signature[i].indexOf("#@#") > -1) |
---|
| 2834 | { |
---|
| 2835 | 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 /> '; |
---|
| 2836 | } |
---|
[4934] | 2837 | if(info_msg.signature[i].indexOf("###") > -1) |
---|
| 2838 | { |
---|
| 2839 | 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 /> '; |
---|
| 2840 | } |
---|
[3352] | 2841 | } |
---|
| 2842 | var signature_status_pos = info_msg.signature[0].indexOf('Message untouched'); |
---|
| 2843 | td_signature.id = "td_signature_"+ID; |
---|
| 2844 | if(signature_status_pos < 0 ) |
---|
| 2845 | { |
---|
| 2846 | td.innerHTML += ' <img style="cursor:pointer" src="templates/'+template+'/images/signed_error.gif" title="'+get_lang("Details")+'">'; |
---|
| 2847 | tr_signature.style.display = ''; |
---|
| 2848 | } |
---|
| 2849 | else |
---|
| 2850 | { |
---|
| 2851 | td.innerHTML += ' <img style="cursor:pointer" src="templates/'+template+'/images/signed_table.gif" title="'+get_lang("Details")+'">'; |
---|
| 2852 | } |
---|
| 2853 | td.onclick = function(){ |
---|
| 2854 | var _height = Element("div_message_scroll_"+ID).style.height; |
---|
| 2855 | _height = parseInt(_height.replace("px","")); |
---|
| 2856 | var _offset = 130; |
---|
| 2857 | if (this.value == 'more_cert'){ |
---|
| 2858 | this.value = 'hide_cert'; |
---|
| 2859 | Element("div_message_scroll_"+ID).style.height = (_height + _offset)+"px"; |
---|
| 2860 | Element('tr_signature_'+ID).style.display = 'none'; |
---|
| 2861 | Element('td_signature_'+ID).style.display = 'none'; |
---|
[1035] | 2862 | |
---|
[3352] | 2863 | } |
---|
| 2864 | else{ |
---|
| 2865 | this.value = 'more_cert'; |
---|
| 2866 | Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px"; |
---|
| 2867 | Element('tr_signature_'+ID).style.display = ''; |
---|
| 2868 | Element('td_signature_'+ID).style.display = ''; |
---|
| 2869 | } |
---|
[1035] | 2870 | }; |
---|
| 2871 | |
---|
[3352] | 2872 | tr_signature.appendChild(td_signature); |
---|
| 2873 | tbody_message_options.appendChild(tr_signature); |
---|
[1035] | 2874 | } |
---|
| 2875 | //////////// END SIGNATURE //////////////// |
---|
| 2876 | |
---|
[2] | 2877 | table_message_options.appendChild(tbody_message_options); |
---|
| 2878 | td0.appendChild(table_message_options); |
---|
| 2879 | tr0.appendChild(td0); |
---|
| 2880 | tbody_message.appendChild(tr0); |
---|
| 2881 | } |
---|
| 2882 | // IF DRAFT |
---|
| 2883 | else |
---|
| 2884 | { |
---|
| 2885 | var options = document.createElement("TD"); |
---|
[5417] | 2886 | //options.width = "1%"; |
---|
[2] | 2887 | options.setAttribute("noWrap","true"); |
---|
[3021] | 2888 | var option_edit = ' | <span class="message_options" onclick="new_message(\'edit\',\''+ID+'\');">'+get_lang('Edit')+'</span>'; |
---|
| 2889 | var option_print = ' | <span class="message_options" onclick="print_msg(\''+info_msg.msg_folder+'\',\''+info_msg.msg_number+'\',\''+ID+'\');">'+get_lang('Print')+'</span>'; |
---|
[271] | 2890 | var option_hide_more = document.createElement("SPAN"); |
---|
| 2891 | option_hide_more.className = 'message_options'; |
---|
| 2892 | options.align = 'right'; |
---|
| 2893 | option_hide_more.value = 'more_options'; |
---|
| 2894 | option_hide_more.id = 'option_hide_more_'+ID; |
---|
[3021] | 2895 | option_hide_more.innerHTML = get_lang('Show details'); |
---|
[271] | 2896 | option_hide_more.onclick = function(){ |
---|
| 2897 | var _height = Element("div_message_scroll_"+ID).style.height; |
---|
| 2898 | _height = parseInt(_height.replace("px","")); |
---|
| 2899 | var _offset = 35; |
---|
| 2900 | if (this.value == 'more_options'){ |
---|
[3021] | 2901 | this.innerHTML = "<b><u>"+get_lang('Hide details')+"</u></b>"; |
---|
[271] | 2902 | this.value = 'hide_options'; |
---|
| 2903 | Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px"; |
---|
| 2904 | Element('table_message_others_options_'+ID).style.display = ''; |
---|
| 2905 | } |
---|
| 2906 | else{ |
---|
[3021] | 2907 | this.innerHTML = get_lang('Show details'); |
---|
[271] | 2908 | this.value = 'more_options'; |
---|
| 2909 | Element("div_message_scroll_"+ID).style.height = (_height + _offset)+"px"; |
---|
| 2910 | Element('table_message_others_options_'+ID).style.display = 'none'; |
---|
| 2911 | } |
---|
| 2912 | }; |
---|
| 2913 | options.appendChild(option_hide_more); |
---|
[3021] | 2914 | options_actions = document.createElement('SPAN'); |
---|
| 2915 | options_actions.innerHTML = option_edit + option_print; |
---|
| 2916 | options.appendChild(options_actions); |
---|
[2] | 2917 | tr.appendChild(td); |
---|
| 2918 | tr.appendChild(options); |
---|
| 2919 | tr.appendChild(next_previous_msg_td); |
---|
| 2920 | tbody_message_options.appendChild(tr); |
---|
| 2921 | table_message_options.appendChild(tbody_message_options); |
---|
| 2922 | td0.appendChild(table_message_options); |
---|
| 2923 | tr0.appendChild(td0); |
---|
| 2924 | tbody_message.appendChild(tr0); |
---|
[4072] | 2925 | |
---|
[3798] | 2926 | var important_message = document.createElement("INPUT"); |
---|
| 2927 | important_message.id = "is_important_"+ID; |
---|
| 2928 | important_message.name = "is_important"; |
---|
| 2929 | important_message.type = "HIDDEN"; |
---|
| 2930 | important_message.value = (info_msg.Importance == "" || info_msg.Importance == "Normal") ? "0": "1"; |
---|
[4072] | 2931 | |
---|
[3798] | 2932 | options.appendChild(important_message); |
---|
[2] | 2933 | } |
---|
| 2934 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2935 | // END options message. |
---|
| 2936 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2937 | |
---|
| 2938 | var table_message_others_options = document.createElement("TABLE"); |
---|
| 2939 | table_message_others_options.id = 'table_message_others_options_' + ID; |
---|
[3018] | 2940 | table_message_others_options.width = "100%"; |
---|
[2] | 2941 | table_message_others_options.style.display = 'none'; |
---|
[5134] | 2942 | if(navigator.appName.indexOf('Internet Explorer')>0){ |
---|
| 2943 | table_message_others_options.className = "table_message_options_ie"; |
---|
| 2944 | }else{ |
---|
| 2945 | table_message_others_options.className = "table_message_options"; |
---|
| 2946 | } |
---|
| 2947 | |
---|
[2] | 2948 | var tbody_message_others_options = document.createElement("TBODY"); |
---|
| 2949 | var tr1 = document.createElement("TR"); |
---|
| 2950 | tr1.className = "tr_message_header"; |
---|
| 2951 | var td1 = document.createElement("TD"); |
---|
[83] | 2952 | td1.innerHTML = get_lang("From: "); |
---|
[271] | 2953 | td1.appendChild(deny_email(info_msg.from.email)); |
---|
[2] | 2954 | td1.width = "7%"; |
---|
[3035] | 2955 | |
---|
[2] | 2956 | if (info_msg.sender){ |
---|
| 2957 | var tr111 = document.createElement("TR"); |
---|
| 2958 | tr111.className = "tr_message_header"; |
---|
| 2959 | var td111 = document.createElement("TD"); |
---|
| 2960 | td111.innerHTML = get_lang("Sent by")+": "; |
---|
[271] | 2961 | td111.appendChild(deny_email(info_msg.sender.email)); |
---|
[2] | 2962 | td111.setAttribute("noWrap","true"); |
---|
| 2963 | var sender = document.createElement("TD"); |
---|
| 2964 | sender.id = "sender_"+ID; |
---|
| 2965 | var sender_values = document.createElement("INPUT"); |
---|
| 2966 | sender_values.id = "sender_values_"+ID; |
---|
| 2967 | sender_values.type = "HIDDEN"; |
---|
| 2968 | sender_values.value = info_msg.sender.full; //Veio do IMAP, sem images nem links. |
---|
| 2969 | sender.innerHTML += draw_plugin_cc(ID, info_msg.sender.full); |
---|
| 2970 | sender.className = "header_message_field"; |
---|
| 2971 | tr111.appendChild(td111); |
---|
| 2972 | tr111.appendChild(sender); |
---|
| 2973 | tr111.appendChild(sender_values); |
---|
| 2974 | tbody_message_others_options.appendChild(tr111); |
---|
| 2975 | } |
---|
[3035] | 2976 | |
---|
[2] | 2977 | var from = document.createElement("TD"); |
---|
| 2978 | from.id = "from_"+ID; |
---|
| 2979 | from.innerHTML = info_msg.from.full; |
---|
| 2980 | if (info_msg.Draft != "X"){ |
---|
| 2981 | from.innerHTML += draw_plugin_cc(ID, info_msg.from); |
---|
| 2982 | tbody_message_others_options.appendChild(tr1); |
---|
| 2983 | } |
---|
| 2984 | from.className = "header_message_field"; |
---|
| 2985 | var from_values = document.createElement("INPUT"); |
---|
| 2986 | from_values.id = "from_values_"+ID; |
---|
| 2987 | from_values.type = "HIDDEN"; |
---|
| 2988 | from_values.value = info_msg.from.full; //Veio do IMAP, sem images nem links. |
---|
[790] | 2989 | |
---|
[689] | 2990 | var local_message = document.createElement("INPUT"); |
---|
| 2991 | local_message.id = "is_local_"+ID; |
---|
| 2992 | local_message.name = "is_local"; |
---|
| 2993 | local_message.type = "HIDDEN"; |
---|
| 2994 | local_message.value = (info_msg.local_message)?"1":"0"; |
---|
[790] | 2995 | |
---|
[2] | 2996 | tr1.appendChild(td1); |
---|
| 2997 | tr1.appendChild(from); |
---|
| 2998 | tr1.appendChild(from_values); |
---|
[689] | 2999 | tr1.appendChild(local_message); |
---|
| 3000 | |
---|
[2] | 3001 | if (info_msg.reply_to){ |
---|
| 3002 | var tr11 = document.createElement("TR"); |
---|
| 3003 | tr11.className = "tr_message_header"; |
---|
| 3004 | var td11 = document.createElement("TD"); |
---|
| 3005 | td11.innerHTML = get_lang("Reply to")+": "; |
---|
| 3006 | td11.setAttribute("noWrap","true"); |
---|
| 3007 | var reply_to = document.createElement("TD"); |
---|
| 3008 | reply_to.id = "reply_to_"+ID; |
---|
[3035] | 3009 | |
---|
[2] | 3010 | var reply_to_values = document.createElement("INPUT"); |
---|
| 3011 | reply_to_values.id = "reply_to_values_"+ID; |
---|
| 3012 | reply_to_values.type = "HIDDEN"; |
---|
| 3013 | reply_to_values.value = info_msg.reply_to; //Veio do IMAP, sem images nem links. |
---|
[6882] | 3014 | $.each(break_comma(info_msg.reply_to), function(index, value){ |
---|
| 3015 | reply_to.innerHTML += draw_plugin_cc(ID, value); |
---|
| 3016 | }) |
---|
[2] | 3017 | reply_to.className = "header_message_field"; |
---|
| 3018 | tr11.appendChild(td11); |
---|
| 3019 | tr11.appendChild(reply_to); |
---|
| 3020 | tr11.appendChild(reply_to_values); |
---|
| 3021 | tbody_message_others_options.appendChild(tr11); |
---|
| 3022 | } |
---|
| 3023 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 3024 | var tr2 = document.createElement("TR"); |
---|
| 3025 | tr2.className = "tr_message_header"; |
---|
| 3026 | var td2 = document.createElement("TD"); |
---|
[5134] | 3027 | td2.width = "7%"; |
---|
[83] | 3028 | td2.innerHTML = get_lang("To: "); |
---|
[2] | 3029 | var to = document.createElement("TD"); |
---|
| 3030 | to.id = "to_"+ID; |
---|
| 3031 | |
---|
| 3032 | var to_values = document.createElement("INPUT"); |
---|
| 3033 | to_values.id = "to_values_"+ID; |
---|
| 3034 | to_values.type = "HIDDEN"; |
---|
[3035] | 3035 | to_values.value = info_msg.toaddress2; //Veio do IMAP, sem images nem links. |
---|
[63] | 3036 | // Salva a pasta da mensagem |
---|
[3035] | 3037 | var input_current_folder = document.createElement('input'); |
---|
[63] | 3038 | input_current_folder.id = "input_folder_"+ID; |
---|
| 3039 | input_current_folder.name = "input_folder"; |
---|
| 3040 | input_current_folder.type = "hidden"; |
---|
| 3041 | input_current_folder.value = info_msg.msg_folder; |
---|
[3035] | 3042 | td2.appendChild(input_current_folder); |
---|
[63] | 3043 | // fim |
---|
[3847] | 3044 | // ALEXANDRE LUIZ CORREIA |
---|
[6806] | 3045 | if(info_msg.toaddress2 != null) |
---|
[3847] | 3046 | { |
---|
[6806] | 3047 | toaddress_array[ID] = break_comma(info_msg.toaddress2); |
---|
[3847] | 3048 | if (toaddress_array[ID].length > 1) |
---|
| 3049 | { |
---|
| 3050 | to.innerHTML += draw_plugin_cc(ID, toaddress_array[ID][0]); |
---|
| 3051 | var div_toaddress = document.createElement("SPAN"); |
---|
| 3052 | div_toaddress.id = "div_toaddress_"+ID; |
---|
| 3053 | div_toaddress.style.display=""; |
---|
| 3054 | div_toaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','to');>"+get_lang('more')+"</a>)"; |
---|
| 3055 | to.appendChild(div_toaddress); |
---|
[4072] | 3056 | } |
---|
[3847] | 3057 | else |
---|
| 3058 | { |
---|
| 3059 | toAdd = toaddress_array[ID].toString() |
---|
| 3060 | if( trim(toAdd) != "" ) { |
---|
| 3061 | toAdd = toAdd.replace("<","<").replace(">",">"); |
---|
| 3062 | } else { |
---|
| 3063 | toAdd = get_lang("without destination"); |
---|
| 3064 | } |
---|
[4072] | 3065 | |
---|
[3847] | 3066 | to.innerHTML += draw_plugin_cc(ID,toAdd); |
---|
[3770] | 3067 | } |
---|
[4072] | 3068 | |
---|
[3847] | 3069 | to.className = "header_message_field"; |
---|
| 3070 | tr2.appendChild(td2); |
---|
| 3071 | tr2.appendChild(to); |
---|
| 3072 | tr2.appendChild(to_values); |
---|
[2] | 3073 | } |
---|
[4072] | 3074 | |
---|
[2] | 3075 | tbody_message_others_options.appendChild(tr2); |
---|
| 3076 | |
---|
| 3077 | if (info_msg.cc){ |
---|
| 3078 | var tr3 = document.createElement("TR"); |
---|
| 3079 | tr3.className = "tr_message_header"; |
---|
| 3080 | var td3 = document.createElement("TD"); |
---|
| 3081 | td3.innerHTML = "CC: "; |
---|
| 3082 | var cc = document.createElement("TD"); |
---|
| 3083 | cc.id = "cc_"+ID; |
---|
| 3084 | |
---|
| 3085 | var cc_values = document.createElement("INPUT"); |
---|
| 3086 | cc_values.id = "cc_values_"+ID; |
---|
| 3087 | cc_values.type = "HIDDEN"; |
---|
| 3088 | cc_values.value = info_msg.cc; |
---|
[3035] | 3089 | |
---|
[6882] | 3090 | ccaddress_array[ID] = break_comma(info_msg.cc); |
---|
[13] | 3091 | if (ccaddress_array[ID].length > 1){ |
---|
[2] | 3092 | var div_ccaddress = document.createElement("SPAN"); |
---|
| 3093 | div_ccaddress.id = "div_ccaddress_"+ID; |
---|
| 3094 | var div_ccaddress_full = document.createElement("SPAN"); |
---|
[3035] | 3095 | div_ccaddress_full.id = "div_ccaddress_full_"+ID; |
---|
[2] | 3096 | div_ccaddress.style.display=""; |
---|
[13] | 3097 | cc.innerHTML = draw_plugin_cc(ID, ccaddress_array[ID][0]); |
---|
| 3098 | div_ccaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','cc');>"+get_lang('more')+"</a>)"; |
---|
| 3099 | cc.appendChild(div_ccaddress); |
---|
[2] | 3100 | } |
---|
| 3101 | else{ |
---|
| 3102 | cc.innerHTML = draw_plugin_cc(ID, info_msg.cc); |
---|
| 3103 | } |
---|
| 3104 | cc.className = "header_message_field"; |
---|
| 3105 | tr3.appendChild(td3); |
---|
| 3106 | tr3.appendChild(cc); |
---|
| 3107 | tr3.appendChild(cc_values); |
---|
| 3108 | tbody_message_others_options.appendChild(tr3); |
---|
| 3109 | } |
---|
[427] | 3110 | |
---|
| 3111 | /* |
---|
| 3112 | * @AUTHOR Rodrigo Souza dos Santos |
---|
| 3113 | * @MODIFY-DATE 2008/09/11 |
---|
| 3114 | * @BRIEF Adding routine to create bcc field if there is one. |
---|
| 3115 | */ |
---|
| 3116 | if (info_msg.bcc) |
---|
| 3117 | { |
---|
| 3118 | var tr3 = document.createElement("tr"); |
---|
| 3119 | tr3.className = "tr_message_header"; |
---|
| 3120 | var td3 = document.createElement("td"); |
---|
| 3121 | td3.innerHTML = get_lang("BCC") + " : "; |
---|
| 3122 | var cco = document.createElement("td"); |
---|
| 3123 | cco.id = "cco_"+ID; |
---|
| 3124 | |
---|
| 3125 | var cco_values = document.createElement("input"); |
---|
| 3126 | cco_values.id = "cco_values_"+ID; |
---|
| 3127 | cco_values.type = "hidden"; |
---|
[1638] | 3128 | cco_values.value = info_msg.bcc; |
---|
[427] | 3129 | |
---|
[3035] | 3130 | ccoaddress_array[ID] = info_msg.bcc.split(","); |
---|
[427] | 3131 | if (ccoaddress_array[ID].length > 1){ |
---|
| 3132 | var div_ccoaddress = document.createElement("SPAN"); |
---|
| 3133 | div_ccoaddress.id = "div_ccoaddress_"+ID; |
---|
| 3134 | var div_ccoaddress_full = document.createElement("SPAN"); |
---|
[3035] | 3135 | div_ccoaddress_full.id = "div_ccoaddress_full_"+ID; |
---|
[427] | 3136 | div_ccoaddress.style.display=""; |
---|
| 3137 | |
---|
| 3138 | //cco.innerHTML = draw_plugin_cc(ID, ccoaddress_array[ID][0]); |
---|
| 3139 | cco.innerHTML = ccoaddress_array[ID][0]; |
---|
| 3140 | div_ccoaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','cco');>"+get_lang('more')+"</a>)"; |
---|
| 3141 | cco.appendChild(div_ccoaddress); |
---|
| 3142 | } |
---|
| 3143 | else{ |
---|
| 3144 | //cco.innerHTML = draw_plugin_cc(ID, info_msg.cco); |
---|
| 3145 | cco.innerHTML = info_msg.bcc; |
---|
| 3146 | } |
---|
| 3147 | cco.className = "header_message_field"; |
---|
| 3148 | tr3.appendChild(td3); |
---|
| 3149 | tr3.appendChild(cco); |
---|
| 3150 | tr3.appendChild(cco_values); |
---|
| 3151 | tbody_message_others_options.appendChild(tr3); |
---|
| 3152 | } |
---|
| 3153 | |
---|
[2] | 3154 | var tr4 = document.createElement("TR"); |
---|
| 3155 | tr4.className = "tr_message_header"; |
---|
| 3156 | var td4 = document.createElement("TD"); |
---|
[83] | 3157 | td4.innerHTML = get_lang("Date: "); |
---|
[2] | 3158 | var date = document.createElement("TD"); |
---|
| 3159 | date.id = "date_"+ID; |
---|
| 3160 | date.innerHTML = info_msg.fulldate; |
---|
| 3161 | var date_day = document.createElement("INPUT"); |
---|
| 3162 | date_day.id = "date_day_"+ID; |
---|
| 3163 | date_day.type = "HIDDEN"; |
---|
| 3164 | date_day.value = info_msg.msg_day; |
---|
| 3165 | var date_hour = document.createElement("INPUT"); |
---|
| 3166 | date_hour.id = "date_hour_"+ID; |
---|
| 3167 | date_hour.type = "HIDDEN"; |
---|
| 3168 | date_hour.value = info_msg.msg_hour |
---|
| 3169 | date.className = "header_message_field"; |
---|
| 3170 | tr4.appendChild(td4); |
---|
| 3171 | tr4.appendChild(date); |
---|
| 3172 | tr4.appendChild(date_day); |
---|
| 3173 | tr4.appendChild(date_hour); |
---|
| 3174 | tbody_message_others_options.appendChild(tr4); |
---|
[3035] | 3175 | |
---|
[2] | 3176 | var tr5 = document.createElement("TR"); |
---|
| 3177 | tr5.className = "tr_message_header"; |
---|
| 3178 | var td5 = document.createElement("TD"); |
---|
[83] | 3179 | td5.innerHTML = get_lang("Subject"); |
---|
[2] | 3180 | var subject = document.createElement("TD"); |
---|
| 3181 | subject.id = "subject_"+ID; |
---|
[6109] | 3182 | subject.innerHTML = html_entities(info_msg.subject); |
---|
[2] | 3183 | subject.className = "header_message_field"; |
---|
[5804] | 3184 | if(defaultCalendar == "expressoCalendar" && $("#expressoCalendarid")[0]){ |
---|
[5392] | 3185 | var new_event_logo = document.createElement("IMG"); |
---|
| 3186 | new_event_logo.title = "Criar evento a partir deste email"; |
---|
| 3187 | new_event_logo.alt = "Criar evento a partir deste email"; |
---|
| 3188 | new_event_logo.src = "./templates/default/images/calendar_add.png"; |
---|
| 3189 | new_event_logo.style.cursor = "pointer"; |
---|
| 3190 | new_event_logo.style.marginLeft = "5px"; |
---|
| 3191 | new_event_logo.onclick = function(){ |
---|
[5619] | 3192 | import_implements_calendar(); |
---|
| 3193 | |
---|
| 3194 | |
---|
[5392] | 3195 | DataLayer.dispatchPath = "../prototype/"; |
---|
| 3196 | var path = "../prototype/modules/calendar/"; |
---|
[7043] | 3197 | |
---|
[5409] | 3198 | var startEvent = new Date(); |
---|
| 3199 | if(startEvent.toString('mm') < 30) |
---|
| 3200 | startEvent.add({minutes: (30 - parseInt(startEvent.toString('mm')))}); |
---|
| 3201 | else |
---|
| 3202 | startEvent.add({hours: 1, minutes: '-'+startEvent.toString('mm')}); |
---|
| 3203 | var endEvent = function(date){ |
---|
| 3204 | if(!!User.preferences.defaultCalendar){ |
---|
[5592] | 3205 | return new Date(parseInt(date.getTime()) + |
---|
| 3206 | (!!Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration ? |
---|
[5409] | 3207 | (Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration * 60000) : |
---|
| 3208 | (User.preferences.defaultDuration * 60000) |
---|
[5592] | 3209 | )); |
---|
[5409] | 3210 | }else |
---|
[5592] | 3211 | return new Date(parseInt(date.getTime()) + (User.preferences.defaultDuration * 60000)); |
---|
[5409] | 3212 | }; |
---|
[5592] | 3213 | |
---|
| 3214 | var emails = $("#to_values_"+ID).val().split(','); |
---|
| 3215 | |
---|
| 3216 | |
---|
[7043] | 3217 | //Normalizaᅵᅵo dos dados evita ter que reemplementar toda as funcionalidades do calendar |
---|
[5392] | 3218 | eventDetails({ |
---|
[5592] | 3219 | |
---|
| 3220 | acl: {inviteGuests: true, organization: true ,participationRequired: false, read: true, write: true}, |
---|
| 3221 | alarms: [], |
---|
| 3222 | allDay: false, |
---|
| 3223 | attachments: [], |
---|
[6332] | 3224 | isAttendee: true, |
---|
[6393] | 3225 | attendee: '',//TODOOOOOO, |
---|
[5592] | 3226 | calendar: User.preferences.defaultCalendar ? User.preferences.defaultCalendar : Calendar.calendars[0], |
---|
| 3227 | calendars: Calendar.calendars, |
---|
| 3228 | category: '', |
---|
[5658] | 3229 | 'class': '1', |
---|
[5592] | 3230 | delegatedFrom: {}, |
---|
| 3231 | endDate: startEvent.toString(User.preferences.dateFormat), |
---|
| 3232 | startDate: endEvent(startEvent).toString(User.preferences.dateFormat), |
---|
| 3233 | startHour: startEvent.toString(User.preferences.hourFormat), |
---|
| 3234 | endHour: endEvent(startEvent).toString(User.preferences.hourFormat), |
---|
[6393] | 3235 | timezone: User.preferences.defaultCalendar ? Calendar.signatureOf[User.preferences.defaultCalendar].calendar.timezone : User.preferences.timezone, |
---|
[5392] | 3236 | summary : $("#subject_"+ID).text(), |
---|
| 3237 | description : $("#body_" + ID).text(), |
---|
[5409] | 3238 | startTime: startEvent.getTime(), |
---|
[5592] | 3239 | endTime: endEvent(startEvent), |
---|
| 3240 | timezones: Timezone.timezones, |
---|
| 3241 | me: {name: User.me.name, mail: User.me.mail, acl: 'rowi', status: '1', delegatedFrom: '0', id: User.me.id}, |
---|
| 3242 | organizer: {name: User.me.name, mail: User.me.mail, acl: 'rowi', status: '1', delegatedFrom: '0' , id: User.me.id}, |
---|
| 3243 | statusParticipants: {accepted: 0, cancelled: 0, tentative: 0, unanswered:emails.length}, |
---|
| 3244 | location: '', |
---|
| 3245 | attendee: $.map(emails, function( mail ){ |
---|
[6599] | 3246 | var contact = false; |
---|
[5592] | 3247 | var decoded = Encoder.htmlDecode(mail); |
---|
| 3248 | var newAttendeeName = ""; |
---|
[5389] | 3249 | |
---|
[6599] | 3250 | var name = decoded.match(/"([^"]*)"/) ? decoded.match(/"([^"]*)"/)[1] : ''; |
---|
| 3251 | var mail = decoded.match(/<([^<]*)>[\s]*$/) ? decoded.match(/<([^<]*)>[\s]*$/)[1].toLowerCase() : decoded; |
---|
| 3252 | |
---|
| 3253 | |
---|
| 3254 | var user = DataLayer.get('user', ["=", "mail", mail], true); |
---|
[5592] | 3255 | |
---|
| 3256 | if( $.type(user) == "array") |
---|
[6580] | 3257 | user = user[0]; |
---|
[5392] | 3258 | |
---|
[6599] | 3259 | if(user != ''){ |
---|
| 3260 | //user = {name : name , mail : mail}; |
---|
| 3261 | if(User.me.mail == user.mail) |
---|
| 3262 | return(null); |
---|
| 3263 | user.isExternal = (!!user && !(!!user.isExternal)) ? 0 : 1; |
---|
[6580] | 3264 | |
---|
[6599] | 3265 | return DataLayer.merge({ |
---|
| 3266 | name: user.name, |
---|
| 3267 | mail: user.mail, |
---|
| 3268 | acl: 'r', |
---|
| 3269 | delegatedFrom: '0', |
---|
| 3270 | status: '4', |
---|
| 3271 | isExternal: user.isExternal |
---|
| 3272 | }, !!user.id ? {id : DataLayer.put('participant', {user: user.id, isExternal: user.isExternal})} : {id: DataLayer.put('participant', {user: user})}); |
---|
| 3273 | }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}\])/)){ |
---|
| 3274 | |
---|
| 3275 | var userId = DataLayer.put('user', { |
---|
| 3276 | name: name, |
---|
| 3277 | mail: mail, |
---|
| 3278 | isExternal: '1' |
---|
| 3279 | }); |
---|
| 3280 | var newAttendeeId = DataLayer.put('participant', { |
---|
| 3281 | user: userId, |
---|
| 3282 | isExternal: '1' |
---|
| 3283 | }); |
---|
[5592] | 3284 | |
---|
[6599] | 3285 | return { |
---|
| 3286 | id: newAttendeeId, |
---|
| 3287 | name: name, |
---|
| 3288 | mail: mail, |
---|
| 3289 | acl: 'r', |
---|
| 3290 | delegatedFrom: '0', |
---|
| 3291 | status: '4', |
---|
| 3292 | isExternal: '1' |
---|
| 3293 | }; |
---|
| 3294 | |
---|
| 3295 | }else |
---|
| 3296 | return (null); |
---|
[5592] | 3297 | }) |
---|
[5392] | 3298 | |
---|
[5592] | 3299 | }, true, path, true); |
---|
[5392] | 3300 | } |
---|
| 3301 | subject.appendChild(new_event_logo); |
---|
[5389] | 3302 | } |
---|
[2] | 3303 | tr5.appendChild(td5); |
---|
| 3304 | tr5.appendChild(subject); |
---|
| 3305 | tbody_message_others_options.appendChild(tr5); |
---|
[4493] | 3306 | //k! |
---|
[5535] | 3307 | |
---|
| 3308 | |
---|
[5866] | 3309 | var update_labeleds_msg = function(){ |
---|
[7043] | 3310 | //TODO Mudar quando API abstrair atualizaᅵᅵes no cache |
---|
[5866] | 3311 | DataLayer.remove('labeled', false); |
---|
[6109] | 3312 | //DataLayer.get('labeled'); |
---|
[5866] | 3313 | var labels = DataLayer.get("labeled", {filter: [ |
---|
| 3314 | 'AND', |
---|
| 3315 | ['=', 'folderName', current_folder], |
---|
| 3316 | ['=','messageNumber',folder_id]], |
---|
| 3317 | criteria : {deepness: 2}} ); |
---|
[5535] | 3318 | |
---|
[5866] | 3319 | if(labels.length != 0){ |
---|
| 3320 | var tr8 = document.createElement("TR"); |
---|
| 3321 | tr8.className = "tr_message_header"; |
---|
| 3322 | var td8 = document.createElement("TD"); |
---|
| 3323 | td8.innerHTML = get_lang("Labels: "); |
---|
| 3324 | var markers = document.createElement("TD"); |
---|
| 3325 | markers.id = "markers_"+ID; |
---|
[5535] | 3326 | |
---|
[5866] | 3327 | for(var i=0; i<labels.length; i++){ |
---|
| 3328 | fontColor = labels[i].label.fontColor; |
---|
| 3329 | borderColor = labels[i].label.borderColor; |
---|
| 3330 | backgroundColor = labels[i].label.backgroundColor; |
---|
| 3331 | nameLabel = labels[i].label.name; |
---|
| 3332 | id = labels[i].id; |
---|
| 3333 | 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>"; |
---|
| 3334 | |
---|
| 3335 | } |
---|
| 3336 | $(markers).find('span.removeLabeledMsg').click(function(event){ |
---|
| 3337 | var id_labeled = $(event.target).attr("id"); |
---|
[7043] | 3338 | //TODO Mudar quando API abstrair atualizaᅵᅵes no cache |
---|
[6109] | 3339 | //DataLayer.remove('labeled', false); |
---|
| 3340 | //DataLayer.get('labeled'); |
---|
[5866] | 3341 | DataLayer.remove('labeled', id_labeled); |
---|
| 3342 | DataLayer.commit(false, false, function(){ |
---|
| 3343 | var index_folder = id_labeled.lastIndexOf('/'); |
---|
| 3344 | var folder_name = id_labeled.slice(0,index_folder); |
---|
| 3345 | var index_number = id_labeled.lastIndexOf('#'); |
---|
| 3346 | var msg_number = id_labeled.slice(index_folder + 1,index_number); |
---|
| 3347 | updateLabelsColumn({msg_number:msg_number, boxname:folder_name, labels:false}); |
---|
| 3348 | update_labeleds_msg(); |
---|
| 3349 | tbody_message_others_options.removeChild(tr8); |
---|
| 3350 | }); |
---|
| 3351 | |
---|
| 3352 | }); |
---|
| 3353 | markers.className = "header_message_field"; |
---|
| 3354 | tr8.appendChild(td8); |
---|
| 3355 | tr8.appendChild(markers); |
---|
| 3356 | tbody_message_others_options.appendChild(tr8); |
---|
[5535] | 3357 | } |
---|
| 3358 | } |
---|
[5967] | 3359 | |
---|
[4493] | 3360 | if ( info_msg.attachments && info_msg.attachments.length > 0 ) |
---|
| 3361 | { |
---|
[7043] | 3362 | //Cï¿œdigo no padrï¿œo expresso 2.2 |
---|
[5134] | 3363 | var tr6 = document.createElement("TR"); |
---|
| 3364 | tr6.className = "tr_message_header"; |
---|
| 3365 | var td6 = document.createElement("TD"); |
---|
| 3366 | td6.innerHTML = get_lang("Attachments: "); |
---|
[4493] | 3367 | |
---|
| 3368 | |
---|
[5134] | 3369 | var attachments = document.createElement("TD"); |
---|
| 3370 | td6.valign = "top"; |
---|
| 3371 | attachments.align = 'left'; |
---|
| 3372 | if(info_msg.attachments.length >= 1){ |
---|
[4820] | 3373 | if(info_msg.attachments.length > 1) { |
---|
| 3374 | var link_attachment = document.createElement("A"); |
---|
| 3375 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
| 3376 | link_attachment.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3377 | else |
---|
| 3378 | link_attachment.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3379 | link_attachment.innerHTML = " "+info_msg.attachments.length+' '+get_lang('files')+' :: '+get_lang('Download all atachments'); |
---|
[5134] | 3380 | attachments.appendChild(link_attachment); |
---|
[4820] | 3381 | } |
---|
| 3382 | if(parseInt(preferences.remove_attachments_function)) |
---|
| 3383 | { |
---|
[5134] | 3384 | attachments.appendChild(document.createTextNode(' ')); |
---|
| 3385 | var del_attachments = document.createElement("A"); |
---|
| 3386 | del_attachments.setAttribute("href", "javascript:remove_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3387 | del_attachments.innerHTML = get_lang('remove all attachments'); |
---|
| 3388 | attachments.appendChild(del_attachments); |
---|
[4820] | 3389 | } |
---|
[5134] | 3390 | attachments.appendChild(document.createElement('BR')); |
---|
| 3391 | } |
---|
| 3392 | attachments.id = "attachments_" + ID; |
---|
[6861] | 3393 | var parserImport = false; |
---|
[4493] | 3394 | for (var i=0; i<info_msg.attachments.length; i++) |
---|
| 3395 | { |
---|
[6861] | 3396 | var import_url = '$this.db_functions.import_vcard&msg_folder='+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; |
---|
[5134] | 3397 | var link_attachment = document.createElement("a"); |
---|
[6861] | 3398 | link_attachment.setAttribute("class", "type_images"); |
---|
| 3399 | link_attachment.style.display = "block"; |
---|
[689] | 3400 | link_attachment.setAttribute("href", proxy_mensagens.link_anexo(info_msg,i)); |
---|
[4493] | 3401 | link_attachment.innerHTML = url_decode(info_msg.attachments[i].name) + " ("+borkb(info_msg.attachments[i].fsize)+")"; |
---|
[5134] | 3402 | //link_attachment.innerHTML += " ("+borkb(info_msg.attachments[i].fsize)+")"; |
---|
[4072] | 3403 | |
---|
[4493] | 3404 | //k trocar por match??? |
---|
| 3405 | if((url_decode(info_msg.attachments[i].name).indexOf(".ics")!=-1) || (url_decode(info_msg.attachments[i].name).indexOf(".vcard")!=-1)) |
---|
[3519] | 3406 | { |
---|
[7043] | 3407 | //Link para importar calendï¿œrio |
---|
[673] | 3408 | var link_import_attachment = new Image(); |
---|
[790] | 3409 | link_import_attachment.src = "templates/"+template+"/images/new.png"; |
---|
[3519] | 3410 | 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] | 3411 | link_import_attachment.title = get_lang("Import to calendar"); |
---|
[6861] | 3412 | link_import_attachment.style.display = "inline"; |
---|
[3035] | 3413 | link_import_attachment.align = "top"; |
---|
[3519] | 3414 | link_import_attachment.style.marginLeft = "5px"; |
---|
[673] | 3415 | link_import_attachment.style.cursor = "pointer"; |
---|
[3519] | 3416 | link_attachment.appendChild(link_import_attachment); |
---|
[6861] | 3417 | parserImport = true; |
---|
[620] | 3418 | } |
---|
[4820] | 3419 | |
---|
[6861] | 3420 | if((url_decode(info_msg.attachments[i].name).indexOf(".eml") != -1)) |
---|
[5134] | 3421 | { |
---|
[7043] | 3422 | //Link para importar calendï¿œrio |
---|
[5134] | 3423 | var link_open_msg = new Image(); |
---|
| 3424 | link_open_msg.src = "templates/"+template+"/images/email.png"; |
---|
| 3425 | //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;"); |
---|
| 3426 | 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;"); |
---|
| 3427 | link_open_msg.title = get_lang("Open message"); |
---|
| 3428 | link_open_msg.align = "top"; |
---|
| 3429 | link_open_msg.style.marginLeft = "5px"; |
---|
| 3430 | link_open_msg.style.cursor = "pointer"; |
---|
| 3431 | link_attachment.appendChild(link_open_msg); |
---|
[6861] | 3432 | } |
---|
[4493] | 3433 | |
---|
[6861] | 3434 | //link_attachment.innerHTML += '<br/>'; |
---|
[5134] | 3435 | attachments.appendChild(link_attachment); |
---|
| 3436 | } |
---|
[2] | 3437 | tr6.appendChild(td6); |
---|
[6861] | 3438 | tr6.appendChild(attachments); |
---|
[2] | 3439 | tbody_message_others_options.appendChild(tr6); |
---|
[4820] | 3440 | } |
---|
[5134] | 3441 | |
---|
[6861] | 3442 | if (parserImport){ |
---|
| 3443 | $.ajax({ |
---|
| 3444 | url: "controller.php?action="+import_url+'&from_ajax=true&id_user='+User.me.id+'&readable=true&cirus_delimiter='+cyrus_delimiter+'&analize=true&uidAccount='+decodeOwner(), |
---|
| 3445 | async: true, |
---|
| 3446 | success: function(data){ |
---|
| 3447 | data = connector.unserialize(data); |
---|
| 3448 | |
---|
| 3449 | if(typeof(data) == "object"){ |
---|
| 3450 | var calendarPermission = data.calendar; |
---|
| 3451 | data = data.action; |
---|
| 3452 | } |
---|
| 3453 | |
---|
| 3454 | switch(parseInt(data)){ |
---|
| 3455 | case 5: |
---|
| 3456 | $('.type_images').append('<img class="loader" src="templates/default/images/ajax-loader.gif" align="top" style="margin-left: 5px; cursor: pointer; display: inline">'); |
---|
| 3457 | $.ajax({ |
---|
| 3458 | url: "controller.php?action="+import_url+'&from_ajax=true&selected=true', |
---|
| 3459 | success: function(msg){ |
---|
| 3460 | $('.type_images').append('<img src="../prototype/modules/mail/img/flagDone.png" align="top" style="margin: 3px 0 0 5px; cursor: pointer; display: inline">').parent().find('.loader').remove(); |
---|
| 3461 | write_msg( ( ( connector.unserialize(msg)) == "ok") ? "Seu evento foi Atualizado com sucesso" : "Ocorreu um erro ao atualizar evento" ); |
---|
| 3462 | } |
---|
| 3463 | }); |
---|
| 3464 | return; |
---|
| 3465 | break; |
---|
| 3466 | case 4: |
---|
| 3467 | $('.type_images').append('<img src="../prototype/modules/mail/img/flagDone.png" align="top" style="margin: 3px 0 0 5px; cursor: pointer; ">'); |
---|
| 3468 | write_msg("Seu evento encontra-se atualizado."); |
---|
| 3469 | return; |
---|
| 3470 | break; |
---|
| 3471 | case 12: |
---|
[7043] | 3472 | write_msg('Este evento nï¿œo existe mais.'); |
---|
[6861] | 3473 | return; |
---|
| 3474 | break; |
---|
| 3475 | } |
---|
| 3476 | } |
---|
| 3477 | }); |
---|
| 3478 | } |
---|
[4493] | 3479 | //k!! |
---|
[6463] | 3480 | |
---|
[2] | 3481 | var div = document.createElement("DIV"); |
---|
| 3482 | div.id = "div_message_scroll_"+ID; |
---|
[5134] | 3483 | div.style.background = 'WHITE'; |
---|
| 3484 | div.style.overflow = "auto"; |
---|
[2] | 3485 | table_message_others_options.appendChild(tbody_message_others_options); |
---|
| 3486 | var tr = document.createElement("TR"); |
---|
[5134] | 3487 | tr.className = "tr_message_header"; |
---|
[2] | 3488 | var td = document.createElement("TD"); |
---|
[5134] | 3489 | td.colspan = '2'; |
---|
[5083] | 3490 | td.style.fontSize = '10pt'; |
---|
| 3491 | td.style.fontFamily = 'Arial,Verdana'; |
---|
| 3492 | td.style.verticalAlign = 'top'; |
---|
| 3493 | td.style.height = '100%'; |
---|
[2] | 3494 | div.appendChild(table_message_others_options); |
---|
[3018] | 3495 | var imgTag = info_msg.body.match(/(<img[^>]*src[^>=]*=['"]?[^'">]*["']?[^>]*>)|(<[^>]*(style[^=>]*=['"][^>]*background(-image)?:[^:;>]*url\()[^>]*>)/gi); |
---|
[790] | 3496 | var newBody = info_msg.body; |
---|
| 3497 | if(!info_msg.showImg && imgTag) |
---|
| 3498 | { |
---|
| 3499 | var domains = ''; |
---|
| 3500 | var blocked = false; |
---|
| 3501 | var forbidden = true; |
---|
[1637] | 3502 | |
---|
| 3503 | if (preferences.notification_domains != null && typeof(preferences.notification_domains) != 'undefined') |
---|
| 3504 | { |
---|
[790] | 3505 | domains = preferences.notification_domains.split(','); |
---|
[1637] | 3506 | for(var j = 0; j < imgTag.length; j++) |
---|
[790] | 3507 | { |
---|
[1637] | 3508 | for (var i = 0; i < domains.length; i++) |
---|
| 3509 | { |
---|
[5134] | 3510 | if (imgTag[j].match(/cid:([\w\d]){5,}/) || imgTag[j].match(/src=\"\.\/inc\/get_archive\.php/g)) |
---|
[3018] | 3511 | { |
---|
| 3512 | forbidden = false; |
---|
| 3513 | continue; |
---|
| 3514 | } |
---|
[1637] | 3515 | imgSource = imgTag[j].match(/=['"](http:\/\/)+[^'"\/]*/); |
---|
| 3516 | if (imgSource && imgSource.toString().substr(5).match(domains[i])) |
---|
| 3517 | forbidden = false; |
---|
| 3518 | } |
---|
| 3519 | if (forbidden) |
---|
| 3520 | { |
---|
[5134] | 3521 | newBody = newBody.replace(imgTag[j],"<img src='templates/"+template+"/images/forbidden.png'>"); |
---|
[1637] | 3522 | blocked=true; |
---|
| 3523 | } |
---|
[790] | 3524 | } |
---|
[1637] | 3525 | if (blocked) |
---|
[790] | 3526 | { |
---|
[1637] | 3527 | var showImgLink = document.createElement('DIV'); |
---|
[1711] | 3528 | showImgLink.id="show_img_link_"+ID; |
---|
[1637] | 3529 | showImgLink.onclick = function(){show_msg_img(info_msg.msg_number,info_msg.msg_folder)}; |
---|
| 3530 | showImgLink.className="show_img_link"; |
---|
| 3531 | showImgLink.innerHTML = get_lang("Show images from")+": "+info_msg.from.email; |
---|
| 3532 | td.appendChild(showImgLink); |
---|
[790] | 3533 | } |
---|
| 3534 | } |
---|
| 3535 | } |
---|
[2] | 3536 | td.appendChild(div); |
---|
| 3537 | tr.appendChild(td) |
---|
| 3538 | tbody_message.appendChild(tr); |
---|
| 3539 | |
---|
| 3540 | |
---|
[3035] | 3541 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[2] | 3542 | //Make the body message. |
---|
[790] | 3543 | /////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[2] | 3544 | var tr = document.createElement("TR"); |
---|
| 3545 | tr.className = "tr_message_body"; |
---|
| 3546 | var td = document.createElement("TD"); |
---|
| 3547 | //td.setAttribute("colSpan","2"); |
---|
[5301] | 3548 | |
---|
| 3549 | //Comentado pois estes replaces e a tentativa de remover as tags <span> vazias faz com que seja |
---|
| 3550 | //eliminado os estilos aplicados no corpo do texto quando utilizado o Firefox. |
---|
| 3551 | //newBody = newBody.replace("<body","<span"); |
---|
| 3552 | //newBody = newBody.replace("<BODY","<span"); |
---|
| 3553 | //while ( ( /<span[^>]*><span[^>]*>/ig ).test( newBody ) ) |
---|
| 3554 | // newBody = newBody.replace( /(<span[^>]*>)<span[^>]*>/ig, '$1' ); |
---|
[3018] | 3555 | |
---|
[3035] | 3556 | var _body = document.createElement( 'div' ); |
---|
| 3557 | _body.id = 'body_' + ID; |
---|
| 3558 | _body.innerHTML = newBody; |
---|
[5476] | 3559 | _body.style.marginLeft = '5px'; |
---|
[3018] | 3560 | |
---|
[3035] | 3561 | var _elements = _body.getElementsByTagName( '*' ); |
---|
| 3562 | for( var i = 0; i < _elements.length; i++ ) |
---|
| 3563 | if ( _elements[ i ].attributes && _elements[ i ].attributes.getNamedItem( 'id' ) ) |
---|
[5369] | 3564 | _elements[ i ].attributes.removeNamedItem( 'id' ); |
---|
| 3565 | |
---|
[3035] | 3566 | div.appendChild( _body ); |
---|
[5370] | 3567 | |
---|
| 3568 | //window.setTimeout(function() { $("#div_message_scroll_"+ID).focus() },250); |
---|
[6806] | 3569 | |
---|
[3035] | 3570 | function mailto( link ) |
---|
| 3571 | { |
---|
| 3572 | var mail = link.href.substr( 7 ); |
---|
| 3573 | link.onclick = function( ) |
---|
| 3574 | { |
---|
| 3575 | new_message_to( mail ); |
---|
| 3576 | return false; |
---|
| 3577 | }; |
---|
| 3578 | } |
---|
| 3579 | var links = div.getElementsByTagName( 'a' ); |
---|
| 3580 | for ( var i = 0; i < links.length; i++ ){ |
---|
| 3581 | try{ |
---|
| 3582 | if ( links.item( i ).href.indexOf( 'mailto:' ) === 0 ){ |
---|
| 3583 | mailto( links.item( i ) ); |
---|
| 3584 | } |
---|
| 3585 | else{ |
---|
[4072] | 3586 | var anchor_pattern = "http://"+location.host+location.pathname+"#"; |
---|
| 3587 | |
---|
| 3588 | if ( ( links.item( i ).href.indexOf( 'javascript:' ) !== 0 ) && |
---|
[7043] | 3589 | (links.item( i ).href.indexOf(anchor_pattern) !== 0) ) //se nï¿œo for ï¿œncora |
---|
[3393] | 3590 | links.item( i ).setAttribute( 'target', '_blank' ); |
---|
[3035] | 3591 | } |
---|
| 3592 | }catch(e){ |
---|
| 3593 | } |
---|
[3369] | 3594 | } |
---|
[3035] | 3595 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[2] | 3596 | //Make the thumbs of the message. |
---|
| 3597 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[4493] | 3598 | //k |
---|
| 3599 | |
---|
[4820] | 3600 | if ((info_msg.thumbs)&&(info_msg.thumbs.length > 0)){ |
---|
[5134] | 3601 | var thumbs = jQuery.parseJSON(info_msg.thumbs); |
---|
| 3602 | var div_thumbs = document.createElement("div"); |
---|
| 3603 | |
---|
[4493] | 3604 | div_thumbs.setAttribute("class", "expressomail-thumbs"); |
---|
| 3605 | div_thumbs.setAttribute("className", "expressomail-thumbs"); //for IE |
---|
| 3606 | |
---|
| 3607 | var div_thumbs_lbl = document.createElement("DIV"); |
---|
| 3608 | div_thumbs_lbl.setAttribute("class", "expressomail-thumbs-label"); |
---|
| 3609 | div_thumbs_lbl.setAttribute("className", "expressomail-thumbs-label"); //for IE |
---|
| 3610 | |
---|
| 3611 | var div_thumbs_lbl_sp = document.createElement("SPAN"); |
---|
| 3612 | div_thumbs_lbl_sp.setAttribute("class", "message_options"); |
---|
| 3613 | div_thumbs_lbl_sp.setAttribute("className", "message_options"); //for IE |
---|
| 3614 | var div_thumbs_lbl_st = document.createElement("STRONG"); |
---|
| 3615 | div_thumbs_lbl_st.innerHTML = info_msg.attachments.length+" "+get_lang("attachment")+(info_msg.attachments.length > 1 ? "s" : "")+" "+get_lang("in this message"); |
---|
| 3616 | var div_thumbs_lbl_a = document.createElement("A"); |
---|
| 3617 | |
---|
[4820] | 3618 | if(info_msg.thumbs.length > 1){ |
---|
| 3619 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
[4493] | 3620 | div_thumbs_lbl_a.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
[3035] | 3621 | else |
---|
[4493] | 3622 | div_thumbs_lbl_a.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3623 | div_thumbs_lbl_a.innerHTML = get_lang('Download all atachments'); |
---|
| 3624 | } else { |
---|
| 3625 | div_thumbs_lbl_a.setAttribute("style", "display:none; visibility:hidden;"); |
---|
[2] | 3626 | } |
---|
[3035] | 3627 | |
---|
[4493] | 3628 | div_thumbs_lbl_sp.appendChild(div_thumbs_lbl_st); |
---|
| 3629 | div_thumbs_lbl_sp.appendChild(document.createTextNode(' :: ')); |
---|
| 3630 | div_thumbs_lbl_sp.appendChild(div_thumbs_lbl_a); |
---|
| 3631 | div_thumbs_lbl.appendChild(div_thumbs_lbl_sp); |
---|
[4820] | 3632 | |
---|
[4493] | 3633 | var div_thumbs_lbl_sp2 = document.createElement("SPAN"); |
---|
| 3634 | div_thumbs_lbl_sp2.setAttribute("class", "message_tips"); |
---|
| 3635 | div_thumbs_lbl_sp2.setAttribute("className", "message_tips"); //for IE |
---|
| 3636 | 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] | 3637 | |
---|
[4493] | 3638 | var ul_thumbs_list = document.createElement("UL"); |
---|
| 3639 | ul_thumbs_list.setAttribute("class", "expressomail-thumbs-list"); |
---|
| 3640 | ul_thumbs_list.setAttribute("className", "expressomail-thumbs-list"); //for IE |
---|
[3035] | 3641 | |
---|
[5134] | 3642 | var msg = info_msg.msg_number; |
---|
| 3643 | var fdr = info_msg.msg_folder; |
---|
| 3644 | var i = 0; |
---|
[7043] | 3645 | //verifica se estᅵ no novo padrᅵo de montagem das mensagens ou no antigo, necessᅵrio |
---|
[5134] | 3646 | //para exibir as imagens no arquivamento local arquivamento local. |
---|
| 3647 | if(thumbs){ |
---|
| 3648 | jQuery.each(thumbs, function(i, thumb) { |
---|
| 3649 | if(fdr.indexOf("local_") >= 0){ |
---|
| 3650 | var href = info_msg.array_attach[i].url + '&image=true'; |
---|
| 3651 | var src = info_msg.array_attach[i].url+ '&image=thumbnail'; |
---|
| 3652 | i++; |
---|
| 3653 | }else{ |
---|
| 3654 | var href = './inc/get_archive.php?msgFolder=' + fdr + '&msgNumber=' + msg + '&indexPart=' + thumb.pid + '&image=true'; |
---|
| 3655 | //var href = thumb.url; |
---|
| 3656 | var src = 'inc/get_archive.php?msgFolder=' + fdr + '&msgNumber=' + msg + '&indexPart=' + thumb.pid + '&image=thumbnail'; |
---|
| 3657 | } |
---|
| 3658 | var msgid= fdr+";;"+msg+";;"+i+";;"+thumb.pid+";;"+thumb.encoding; |
---|
| 3659 | var image_info = '{"folder":"'+fdr+'","message":"'+msg+'","thumbIndex":"'+i+'","pid":"'+thumb.pid+'","encoding":"'+thumb.encoding+'","type":"'+thumb.type+'"}'; |
---|
| 3660 | |
---|
| 3661 | var image= '<img id="' + msgid + '" title="' + |
---|
| 3662 | get_lang('Click here do view (+)') + '" src="' + src + '" style="width:auto;height:100%;" />'; |
---|
| 3663 | |
---|
| 3664 | 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>'; |
---|
| 3665 | content += '<input id="thumb_'+ID+'_'+i+'" type="hidden" value="' +escape(image_info) +'" />'; |
---|
| 3666 | jQuery(ul_thumbs_list).append('<li>'+content+'</li>'); |
---|
| 3667 | |
---|
| 3668 | }); |
---|
[4493] | 3669 | |
---|
| 3670 | div_thumbs.appendChild(div_thumbs_lbl); |
---|
| 3671 | div_thumbs.appendChild(div_thumbs_lbl_sp2); |
---|
| 3672 | div_thumbs.appendChild(ul_thumbs_list); |
---|
| 3673 | |
---|
[5134] | 3674 | }else{ |
---|
| 3675 | div_thumbs.appendChild(div_thumbs_lbl); |
---|
| 3676 | div_thumbs.appendChild(div_thumbs_lbl_sp2); |
---|
| 3677 | div_thumbs.innerHTML = div_thumbs.innerHTML + info_msg.thumbs; |
---|
| 3678 | |
---|
| 3679 | |
---|
| 3680 | } |
---|
| 3681 | |
---|
[4493] | 3682 | div.appendChild(div_thumbs); |
---|
[2] | 3683 | } |
---|
[4493] | 3684 | //k!! |
---|
[2] | 3685 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 3686 | table_message.appendChild(tbody_message); |
---|
| 3687 | content.appendChild(table_message); |
---|
[3035] | 3688 | resizeWindow(); |
---|
[2] | 3689 | var msg_number = document.createElement('INPUT'); |
---|
| 3690 | msg_number.id = "msg_number_" + ID; |
---|
| 3691 | msg_number.type = "hidden"; |
---|
| 3692 | msg_number.value = info_msg.msg_number; |
---|
| 3693 | content.appendChild(msg_number); |
---|
| 3694 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[3165] | 3695 | |
---|
| 3696 | //Exibe o cabecalho da mensagem totalmente aberto caso esteja setado nas preferencias do usuario |
---|
| 3697 | if (preferences.show_head_msg_full == 1) |
---|
| 3698 | { |
---|
| 3699 | option_hide_more.onclick(); |
---|
[3168] | 3700 | if (Element('div_toaddress_'+ID) != null) |
---|
| 3701 | show_div_address_full(ID,'to'); |
---|
| 3702 | if (Element('div_ccaddress_'+ID) != null) |
---|
| 3703 | show_div_address_full(ID,'cc'); |
---|
[3165] | 3704 | } |
---|
[4820] | 3705 | |
---|
[4493] | 3706 | /* |
---|
[7043] | 3707 | * TODO: implementar o controle como preferï¿œncia do usuï¿œrio |
---|
[4493] | 3708 | * |
---|
| 3709 | */ |
---|
| 3710 | var jcarousel = false; |
---|
| 3711 | if (jcarousel) { |
---|
[5134] | 3712 | //carousel |
---|
[4493] | 3713 | jQuery(document).ready(function() { |
---|
[5134] | 3714 | jQuery('.expressomail-thumbs-list').attr('id', 'expressomail-thumbs-list'+ID) |
---|
| 3715 | .addClass('jcarousel-skin-default').jcarousel(); |
---|
| 3716 | |
---|
| 3717 | jQuery('.expressomail-thumbs-link img').attr('style', ''); |
---|
[4493] | 3718 | |
---|
| 3719 | //fancybox |
---|
| 3720 | jQuery(".expressomail-thumbs-list li a").attr('onclick', 'return true;'); |
---|
| 3721 | jQuery(".expressomail-thumbs-list li a").fancybox({ |
---|
| 3722 | 'hideOnContentClick': true, |
---|
[5134] | 3723 | 'type': 'image', |
---|
| 3724 | 'titlePosition': 'over', |
---|
| 3725 | 'titleFormat' : function(name, currentArray, currentIndex, currentOpts) { |
---|
| 3726 | var image_info = $('#thumb_'+ID+'_'+currentIndex).val(); |
---|
| 3727 | |
---|
| 3728 | return '<div id="fancybox-title" class="fancybox-title-over" style="width: 100%; display: block;">' + |
---|
| 3729 | '<div id="fancybox-title-over">' + |
---|
| 3730 | '<a title="Anterior" onclick="javascript:$.fancybox.prev();" style="float:left;">' + |
---|
| 3731 | '<img src="./templates/'+template+'/images/left_arrow_white.png" width="30" height="30" />' + |
---|
| 3732 | '</a>'+ |
---|
| 3733 | '<a title="Baixar imagem" onclick="javascript:save_image2(\''+image_info+'\');" style="padding:0 5px;">' + |
---|
| 3734 | '<img src="./templates/'+template+'/images/image_down.png" width="22" height="22" />' + |
---|
| 3735 | '</a>'+ |
---|
| 3736 | '<a title="Baixar todas de uma vez" onclick="javascript:download_all_attachments(\''+info_msg.msg_folder+"','"+info_msg.msg_number+'\')" style="padding:0 5px;">'+ |
---|
| 3737 | '<img src="./templates/'+template+'/images/package_down.png" width="26" height="26" />' + |
---|
| 3738 | '</a>'+ |
---|
| 3739 | '<span style="margin-left:5px; margin-top:7px; position:absolute;">'+name+'</span>'+ |
---|
[7043] | 3740 | '<a title="Prï¿œxima" onclick="javascript:$.fancybox.next();" style="float:right;">' + |
---|
[5134] | 3741 | '<img src="./templates/'+template+'/images/right_arrow_white.png" width="30" height="30" />' + |
---|
| 3742 | '</a>' + |
---|
| 3743 | '</div>' + |
---|
| 3744 | '</div>'; |
---|
| 3745 | } |
---|
[4493] | 3746 | }); |
---|
| 3747 | }); |
---|
[5967] | 3748 | } |
---|
| 3749 | if ( is_webkit ){ //Corrige o bug de foco no Chrome |
---|
[5370] | 3750 | var ev = document.createEvent('MouseEvents'); |
---|
| 3751 | ev.initEvent( |
---|
| 3752 | 'click' |
---|
| 3753 | ,false |
---|
| 3754 | ,true |
---|
| 3755 | ); |
---|
| 3756 | var divScroll = Element('div_message_scroll_'+ID); |
---|
| 3757 | if (divScroll) { |
---|
| 3758 | divScroll.setAttribute('tabindex','-1'); |
---|
| 3759 | divScroll.onclick = function() {setTimeout(function(){$("#div_message_scroll_"+ID).focus();},0);}; |
---|
| 3760 | divScroll.dispatchEvent(ev); |
---|
| 3761 | } |
---|
| 3762 | } |
---|
[5967] | 3763 | else $("#div_message_scroll_"+ID).focus(); |
---|
| 3764 | update_labeleds_msg(); |
---|
[6463] | 3765 | |
---|
[5967] | 3766 | resizeWindow(); |
---|
[6463] | 3767 | |
---|
| 3768 | $("#div_message_scroll_"+ID).scrollTo( 0, 400, {queue:true} ); |
---|
[4820] | 3769 | } |
---|
[4493] | 3770 | |
---|
[3035] | 3771 | function changeLinkState(el,state){ |
---|
| 3772 | el.innerHTML = get_lang(state); |
---|
| 3773 | switch (state){ |
---|
| 3774 | case 'important': |
---|
| 3775 | { |
---|
[4826] | 3776 | 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] | 3777 | break; |
---|
| 3778 | } |
---|
| 3779 | case 'normal': |
---|
| 3780 | { |
---|
[4072] | 3781 | el.onclick = function(){ |
---|
[3806] | 3782 | var _this = this; |
---|
| 3783 | proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'unflagged', function(success){ |
---|
| 3784 | if (success) { |
---|
| 3785 | changeLinkState(_this, 'important'); |
---|
| 3786 | write_msg(get_lang('Message marked as ') + get_lang("Normal")); |
---|
| 3787 | } |
---|
| 3788 | } ); |
---|
| 3789 | } |
---|
[3035] | 3790 | break; |
---|
| 3791 | } |
---|
| 3792 | case 'unseen': |
---|
| 3793 | { |
---|
[4826] | 3794 | 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] | 3795 | break; |
---|
[790] | 3796 | |
---|
[3035] | 3797 | } |
---|
| 3798 | case 'seen': |
---|
| 3799 | { |
---|
[4826] | 3800 | 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] | 3801 | break; |
---|
[3021] | 3802 | |
---|
[3035] | 3803 | } |
---|
| 3804 | default: |
---|
| 3805 | { |
---|
| 3806 | break; |
---|
| 3807 | } |
---|
| 3808 | } |
---|
| 3809 | } |
---|
[4493] | 3810 | |
---|
[5911] | 3811 | function mySplit( val ) { |
---|
| 3812 | return val.split( /,\s*/ ); |
---|
| 3813 | } |
---|
| 3814 | |
---|
| 3815 | function extractLast( term ) { |
---|
| 3816 | return mySplit( term ).pop(); |
---|
| 3817 | } |
---|
[6109] | 3818 | |
---|
[6528] | 3819 | //DESENHO DAS CAIXA DE EMAIL |
---|
[6592] | 3820 | function draw_email_box(input_data, location, personal, shared){ |
---|
[6528] | 3821 | if($.trim(input_data) != ""){ |
---|
| 3822 | var box_data = valid_emails(input_data); |
---|
| 3823 | DataLayer.render("../prototype/modules/mail/templates/emailBox.ejs", box_data, function(html){ |
---|
| 3824 | var newBox = location.before(html).prev(); |
---|
| 3825 | box_actions(newBox); |
---|
| 3826 | if((preferences.expressoMail_ldap_identifier_recipient || personal)&& $(newBox).hasClass("invalid-email-box")){ |
---|
| 3827 | //$(newBox).find(".loading").css("background-image", "../prototype/modules/mail/img/ajax-loader.gif"); |
---|
[6592] | 3828 | show_detais(newBox, input_data, personal, shared); |
---|
[6528] | 3829 | }else{ |
---|
| 3830 | $(newBox).find(".box-loading").remove(); |
---|
| 3831 | } |
---|
| 3832 | }); |
---|
[6109] | 3833 | } |
---|
[6528] | 3834 | } |
---|
| 3835 | |
---|
| 3836 | function valid_emails(email){ |
---|
| 3837 | var ContactBox = {name:"", email:"", valid : false}; |
---|
| 3838 | var reSimpleEmail = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[_a-z0-9-]+(\.[_a-z0-9-]+)+$/; |
---|
| 3839 | var reComplexEmail = /<([^<]*)>[\s]*$/; |
---|
| 3840 | var validation = email.split('"'); |
---|
| 3841 | |
---|
[7043] | 3842 | //FUNᅵᅵO QUE VALIDA OS DADOS QUANDO O EMAIL ᅵ DIGITADO COM ("NOME SOBRENOME" <Email@dominio.com>) |
---|
[6528] | 3843 | var complexValidation = function(complexMail){ |
---|
| 3844 | var Objct = {}; |
---|
| 3845 | if($.trim(complexMail[1]).match(reComplexEmail)){ |
---|
| 3846 | if($.trim(complexMail[1]).match(reComplexEmail).length){ |
---|
| 3847 | Objct['email'] = $.trim(complexMail[1]).match(reComplexEmail)[1]; |
---|
| 3848 | } |
---|
| 3849 | }else{ |
---|
| 3850 | Objct['email'] = $.trim(complexMail[1]); |
---|
[6109] | 3851 | } |
---|
[6528] | 3852 | Objct['name'] = complexMail[0]; |
---|
| 3853 | Objct['valid'] = reSimpleEmail.test(Objct['email'].toLowerCase()); |
---|
| 3854 | return Objct; |
---|
| 3855 | } |
---|
| 3856 | switch (validation.length) { |
---|
| 3857 | //PEGA TODO O CONTEUDO E SETA COMO SE FOSSE O EMAIL |
---|
| 3858 | case 1: |
---|
| 3859 | validation.unshift(""); |
---|
| 3860 | ContactBox = complexValidation(validation); |
---|
| 3861 | break; |
---|
[7043] | 3862 | //CORRIGI ERRO DE DIGITAᅵᅵO COMO ( huahua"<huhau@hauhau.com>) ou (hahahaha"huahua@email.com) ou ainda (hahahaha"huahua@ema il.com) |
---|
[6528] | 3863 | case 2: |
---|
| 3864 | ContactBox = complexValidation(validation); |
---|
| 3865 | break; |
---|
[7043] | 3866 | //RECEBE O EMAIL CORRETAMENTE Sᅵ VALIDA POSSIVEIS ERROS COMO O DE CIMA E OS CORRIGI CASO ACONTEᅵAM |
---|
[6528] | 3867 | case 3: |
---|
| 3868 | //RETIRA O PRIMEIRO INDICE QUE FICOU "INUTIL" |
---|
| 3869 | validation.shift(); |
---|
| 3870 | ContactBox = complexValidation(validation); |
---|
| 3871 | break; |
---|
| 3872 | //SE EXISTIREM MAIS DO QUE 2 (") |
---|
| 3873 | default: |
---|
| 3874 | if($.trim(validation[validation.length-1]).match(reComplexEmail)){ |
---|
| 3875 | if($.trim(validation[validation.length-1]).match(reComplexEmail).length){ |
---|
| 3876 | ContactBox.mail = $.trim(validation[validation.length-1]).match(reComplexEmail)[1]; |
---|
| 3877 | } |
---|
| 3878 | }else{ |
---|
| 3879 | ContactBox.mail = $.trim(complexMail[1]); |
---|
| 3880 | } |
---|
| 3881 | ContactBox.valid = reSimpleEmail.test(ContactBox.mail.toLowerCase()); |
---|
| 3882 | } |
---|
| 3883 | return ContactBox; |
---|
| 3884 | } |
---|
| 3885 | |
---|
| 3886 | //EVENTO DOS INPUTS PARA - CC - CCO |
---|
| 3887 | function input_keydowns(input, ID){ |
---|
| 3888 | var f9 = false; |
---|
| 3889 | input.keydown(function(e){ |
---|
| 3890 | f9 = false; |
---|
[6667] | 3891 | focusIn = input; |
---|
[6528] | 3892 | var focusing = input.parent().find(".email-text"); |
---|
| 3893 | //SE OS CONTATOS DINAMICOS ESTAO ATIVOS |
---|
| 3894 | if(parseInt(preferences.use_dynamic_contacts) && !input.hasClass("box-input")){ |
---|
| 3895 | //SELECIONA O CONTATO E EVITA OUTROS COMANDOS |
---|
| 3896 | if ( e.keyCode === $.ui.keyCode.TAB && $( this ).data( "catcomplete" ).menu.active ) { |
---|
| 3897 | e.preventDefault(); |
---|
| 3898 | return false; |
---|
| 3899 | } |
---|
| 3900 | |
---|
[7043] | 3901 | //FECHA OS CONTATOS DINï¿œMICOS |
---|
[6528] | 3902 | if( (e.keyCode == 27) && $( this ).data( "catcomplete" ).menu.active ){ |
---|
| 3903 | e.stopPropagation(); |
---|
| 3904 | e.preventDefault(); |
---|
| 3905 | } |
---|
| 3906 | |
---|
| 3907 | //SELECIONA O CONTATO E EVITA OUTROS COMANDOS |
---|
| 3908 | if(e.keyCode == $.ui.keyCode.ENTER && $( this ).data( "catcomplete" ).menu.active){ |
---|
| 3909 | e.preventDefault(); |
---|
| 3910 | return false; |
---|
| 3911 | } |
---|
| 3912 | |
---|
| 3913 | if(e.keyCode == $.ui.keyCode.DELETE && $( this ).data( "catcomplete" ).menu.active){ |
---|
| 3914 | if($($( this ).data( "catcomplete" ).menu.element).find(".ui-state-hover").parents("li:first").hasClass("dynamic-recent")) |
---|
| 3915 | $($( this ).data( "catcomplete" ).menu.element).find(".ui-state-hover").next().trigger("click"); |
---|
| 3916 | return false; |
---|
| 3917 | } |
---|
| 3918 | } |
---|
| 3919 | //BUSCA COM A TECLA F9 |
---|
| 3920 | if((e.keyCode) == 120){ |
---|
| 3921 | f9 = true; |
---|
[6109] | 3922 | emQuickSearch($(this).val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true); |
---|
[6528] | 3923 | e.preventDefault(); |
---|
| 3924 | return false; |
---|
[6109] | 3925 | } |
---|
[6528] | 3926 | |
---|
| 3927 | //AO DIGITAR ENTER, ";", "," " " |
---|
| 3928 | if(e.keyCode == 13 || e.keyCode == 9 || (e.keyCode == 188 && !e.shiftKey) || (e.keyCode == 191 && !e.shiftKey) ){ |
---|
| 3929 | if(e.keyCode == 13){ |
---|
| 3930 | e.preventDefault(); |
---|
| 3931 | } |
---|
| 3932 | if(input.val() != ""){ |
---|
[6806] | 3933 | if(e.keyCode == 188 && !e.shiftKey && input.val().split("\"").length > 1){ |
---|
| 3934 | return; |
---|
| 3935 | } |
---|
[6528] | 3936 | if(e.keyCode != 9) |
---|
| 3937 | e.preventDefault(); |
---|
| 3938 | draw_email_box(input.val(), input); |
---|
| 3939 | if(input.hasClass("box-input")){ |
---|
| 3940 | input.remove(); |
---|
| 3941 | focusing.focus(); |
---|
| 3942 | return; |
---|
| 3943 | } |
---|
| 3944 | } |
---|
| 3945 | if(input.length) |
---|
| 3946 | input.val(""); |
---|
| 3947 | } |
---|
| 3948 | if((e.keyCode == 8 || e.keyCode == 37) && input.val() == "" && input.prev().hasClass("box")){ |
---|
| 3949 | e.preventDefault(); |
---|
| 3950 | input.prev().focus(); |
---|
[6109] | 3951 | return; |
---|
| 3952 | } |
---|
[6528] | 3953 | //AO DIGITAR " " |
---|
| 3954 | if(e.keyCode == 32){ |
---|
| 3955 | if(!input.val().length){ |
---|
| 3956 | e.preventDefault(); |
---|
| 3957 | return; |
---|
| 3958 | }else{ |
---|
| 3959 | var texto = input.val(); |
---|
| 3960 | texto = texto.substring(0, getPosition(input[0])); |
---|
| 3961 | if(texto.split('"').length-1 == 0){ |
---|
| 3962 | if(input.val().split('"').length-1 == 0){ |
---|
| 3963 | e.preventDefault(); |
---|
| 3964 | e.stopPropagation(); |
---|
| 3965 | draw_email_box(input.val(), input); |
---|
| 3966 | input.val(""); |
---|
| 3967 | if(input.hasClass("box-input")){ |
---|
| 3968 | input.remove(); |
---|
| 3969 | focusing.focus(); |
---|
| 3970 | return; |
---|
| 3971 | } |
---|
| 3972 | return; |
---|
| 3973 | } |
---|
| 3974 | } |
---|
| 3975 | } |
---|
| 3976 | } |
---|
| 3977 | //AO DIGITAR ">" |
---|
| 3978 | if(e.keyCode == 190 && e.shiftKey && input.val().length == getPosition(input[0])){ |
---|
| 3979 | input.val(input.val()+">"); |
---|
| 3980 | draw_email_box(input.val(), input); |
---|
| 3981 | e.preventDefault(); |
---|
| 3982 | input.val(""); |
---|
| 3983 | if(input.hasClass("box-input")){ |
---|
| 3984 | input.remove(); |
---|
| 3985 | focusing.focus(); |
---|
| 3986 | return; |
---|
| 3987 | } |
---|
| 3988 | } |
---|
[6547] | 3989 | setTimeout(function(){ |
---|
| 3990 | if(input.val()[input.val().length-1] == ";"){ |
---|
| 3991 | draw_email_box(input.val().substring(0, input.val().length-1), input); |
---|
| 3992 | input.val(""); |
---|
| 3993 | } |
---|
| 3994 | }, 100); |
---|
[6528] | 3995 | //INPUT AUTO RESIZE |
---|
| 3996 | setTimeout(function(){ |
---|
[6562] | 3997 | input_search = $(input).val(); |
---|
[6654] | 3998 | var char = input.val().charAt(input.val().length-1); |
---|
| 3999 | var maiusculas = RegExp("[A-Z]"); |
---|
[7043] | 4000 | /*Se o ultimo caracter for ">" ᅵ porque o campo estᅵ sendo editado (a partir de duplo clique)*/ |
---|
[6654] | 4001 | var tamanho = 0; |
---|
| 4002 | if(char == ">"){ |
---|
[7043] | 4003 | /*Faz um calculo prï¿œvio do tamanho do campo de acordo com o tamanho de cada caracter da string*/ |
---|
[6654] | 4004 | for(i=0; i<input.val().length; i++){ |
---|
[7043] | 4005 | /*Se o caracter for maiᅵsculo, o valor de pixel ᅵ maior*/ |
---|
[6654] | 4006 | if(maiusculas.test(input.val().substr(i, 1)) == true){ |
---|
| 4007 | tamanho += 9; |
---|
| 4008 | } |
---|
| 4009 | else{ |
---|
| 4010 | tamanho += 7.1; |
---|
| 4011 | } |
---|
| 4012 | } |
---|
| 4013 | input.css("width", tamanho); |
---|
| 4014 | } |
---|
[7043] | 4015 | /*Ao inserir novo contato, nï¿œo existe a necessidade de calcular tamanho do campo*/ |
---|
[6654] | 4016 | else{ |
---|
| 4017 | input.css("width", 15+(input.val().length * 9)); |
---|
| 4018 | } |
---|
[6528] | 4019 | input.parent().scrollTo(":last"); |
---|
| 4020 | }, 100); |
---|
| 4021 | }) |
---|
| 4022 | //AO SAIR DO FOCO MONTAGEM DA CAIXA DE EMAIL |
---|
[6562] | 4023 | .focusout(function(e){ |
---|
| 4024 | var these = $(this); |
---|
[6663] | 4025 | |
---|
[7043] | 4026 | // Funᅵᅵo para monstar a caixinha de e-mail. |
---|
[6663] | 4027 | function makeBoxMail(){ |
---|
[6670] | 4028 | if(canMakeBox && !fastSearch){ |
---|
[6663] | 4029 | if(!( f9 || click || $(this).parents("tr:first").find("button").hasClass("ui-state-active") )){ |
---|
| 4030 | if($(input).val() != "") |
---|
| 4031 | draw_email_box(input.val(), input); |
---|
| 4032 | if(input.hasClass("box-input")) |
---|
| 4033 | input.remove(); |
---|
| 4034 | $(input).val(""); |
---|
| 4035 | input_search = ""; |
---|
| 4036 | } |
---|
| 4037 | f9 = false; |
---|
| 4038 | click = false; |
---|
[6528] | 4039 | } |
---|
[6670] | 4040 | canMakeBox = true; |
---|
| 4041 | fastSearch = false; |
---|
[6528] | 4042 | } |
---|
[6927] | 4043 | |
---|
| 4044 | setTimeout(makeBoxMail,250); |
---|
[6528] | 4045 | }) |
---|
| 4046 | //AO COLAR UM TEXTO NO CAMPO |
---|
| 4047 | .bind("paste", function(e){ |
---|
| 4048 | $(this).trigger("keydown"); |
---|
| 4049 | var pthis = $(this); |
---|
| 4050 | setTimeout(function() { |
---|
[6926] | 4051 | if(pthis.val().split('"') > 1) |
---|
| 4052 | var str = pthis.val().replace(/[,;\t]/gi, ","); |
---|
| 4053 | else |
---|
| 4054 | var str = pthis.val().replace(/[,;\t\n\s]/gi, ","); |
---|
[6528] | 4055 | str = str.split(","); |
---|
| 4056 | $.each(str, function(index, value){ |
---|
| 4057 | draw_email_box(value, pthis); |
---|
| 4058 | }); |
---|
| 4059 | pthis.val(""); |
---|
| 4060 | }, 50); |
---|
[6109] | 4061 | }); |
---|
[7043] | 4062 | //SE FOR EDIᅵᅵO DE EMAILS RECALCULA O INPUT E SETA O FOCO |
---|
[6528] | 4063 | if(input.hasClass("box-input")){ |
---|
| 4064 | input.trigger("keydown"); |
---|
| 4065 | input.focus(); |
---|
| 4066 | } |
---|
[6109] | 4067 | } |
---|
[6528] | 4068 | var input_search = ""; |
---|
[6562] | 4069 | var click = false; |
---|
[6528] | 4070 | //EVENTOS DA CAIXA |
---|
| 4071 | function box_actions(box){ |
---|
| 4072 | //AO PRESSIONAR UMA TECLA COM A CAIXA SELECIONADA |
---|
| 4073 | box.keydown(function(e){ |
---|
| 4074 | switch (e.keyCode) { |
---|
| 4075 | case $.ui.keyCode.LEFT: |
---|
| 4076 | //VERIFICA SE EXISTE ALGUMA CAIXA A ESQUERDA |
---|
| 4077 | if($(this).prev().hasClass("box")) |
---|
| 4078 | $(this).removeClass("box-selected").prev().focus(); |
---|
| 4079 | break; |
---|
| 4080 | case $.ui.keyCode.RIGHT: |
---|
| 4081 | //VERIFICA SE EXISTE ALGUMA CAIXA A DIREITA |
---|
| 4082 | if($(this).next().hasClass("box")) |
---|
| 4083 | $(this).removeClass("box-selected").next().focus(); |
---|
| 4084 | //SENAO FOCO O INPUT DO EMAIL |
---|
| 4085 | else |
---|
| 4086 | $(this).removeClass("box-selected").next().focus(); |
---|
| 4087 | break; |
---|
| 4088 | case $.ui.keyCode.HOME: |
---|
| 4089 | //SELECIONO A PRIMEIRA CAIXA |
---|
| 4090 | e.preventDefault(); |
---|
| 4091 | $(this).parents(".email-area").find("div:first").focus(); |
---|
| 4092 | break; |
---|
| 4093 | case $.ui.keyCode.END: |
---|
| 4094 | //SELECIONO A ULTIMA CAIXA |
---|
| 4095 | e.preventDefault(); |
---|
| 4096 | $(this).parents(".email-area").find("div:last").focus(); |
---|
| 4097 | break; |
---|
| 4098 | case $.ui.keyCode.DELETE: |
---|
| 4099 | //VERIFICA SE EXISTE ALGUMA CAIXA A DIREITA |
---|
| 4100 | if($(this).next().hasClass("box")) |
---|
| 4101 | $(this).next().focus(); |
---|
| 4102 | //SENAO FOCO O INPUT DO EMAIL |
---|
| 4103 | else |
---|
| 4104 | $(this).next().focus(); |
---|
| 4105 | //REMOVO ESTA CAIXA |
---|
| 4106 | $(this).remove(); |
---|
| 4107 | break; |
---|
| 4108 | case $.ui.keyCode.BACKSPACE: |
---|
| 4109 | //VERIFICA SE EXISTE ALGUMA CAIXA A ESQUERDA |
---|
| 4110 | if($(this).prev().hasClass("box")) |
---|
| 4111 | $(this).removeClass("box-selected").prev().focus(); |
---|
| 4112 | //SENAO HOUVER VERIFICA SE EXISTE ALGUMA CAIXA A DIREITA |
---|
| 4113 | else if($(this).next().hasClass("box")) |
---|
| 4114 | $(this).next().focus(); |
---|
| 4115 | //SENAO HOUVER NEM A DIREITA NEM A ESQUERDA SETO O FOCO NO INPUT DO EMAIL |
---|
| 4116 | else |
---|
| 4117 | $(this).next().focus(); |
---|
| 4118 | //REMOVO ESTA CAIXA |
---|
| 4119 | $(this).remove(); |
---|
| 4120 | e.preventDefault(); |
---|
| 4121 | break; |
---|
| 4122 | case $.ui.keyCode.ENTER: |
---|
| 4123 | e.preventDefault(); |
---|
| 4124 | $(this).trigger("dblclick"); |
---|
| 4125 | break; |
---|
| 4126 | } |
---|
| 4127 | }) |
---|
| 4128 | //AO FAZER UM DUPLO CLICK NA CAIXA |
---|
| 4129 | .dblclick(function(e){ |
---|
| 4130 | var input = $(this).find("input").clone(); |
---|
| 4131 | input.css("display" , "inline-block"); |
---|
| 4132 | $(this).before(input); |
---|
| 4133 | input_keydowns(input, currentTab); |
---|
| 4134 | $(this).remove(); |
---|
| 4135 | //CLICK SIMPLES NA CAIXA |
---|
| 4136 | }).click(function(){ |
---|
| 4137 | $(this).focus(); |
---|
| 4138 | //AO DAR O FOCO NA CAIXA |
---|
| 4139 | }).focus(function(){ |
---|
| 4140 | $(this).parent().find("div").removeClass("box-selected"); |
---|
| 4141 | $(this).addClass("box-selected"); |
---|
| 4142 | }).focusout(function(){ |
---|
| 4143 | $(this).removeClass("box-selected"); |
---|
| 4144 | }).draggable({ |
---|
| 4145 | revert: 'invalid', |
---|
| 4146 | helper : 'clone', |
---|
| 4147 | stack: "body", |
---|
| 4148 | containment : ".new-msg-head-data", |
---|
| 4149 | start: function(e, ui){ |
---|
| 4150 | $(this).parent().droppable( "disable" ); |
---|
| 4151 | }, |
---|
| 4152 | stop : function(e, ui){ |
---|
| 4153 | $(this).parent().droppable( "enable" ); |
---|
| 4154 | } |
---|
| 4155 | }); |
---|
| 4156 | } |
---|
| 4157 | |
---|
| 4158 | //MOSTRA OS DETALHES DAS CAIXA DE EMAIL NOS CAMPOS PARA - CC - CCO |
---|
[6592] | 4159 | function show_detais(box, value, personal, shared){ |
---|
[6528] | 4160 | var ldap_id = preferences.expressoMail_ldap_identifier_recipient; |
---|
| 4161 | var group = (personal != undefined ? (personal == "G" ? true : false) : false); |
---|
[6592] | 4162 | shared = shared ? shared : false; |
---|
[6528] | 4163 | if(group){ |
---|
[6592] | 4164 | REST.get("/"+ (shared ? "shared" : "") +"group/"+value, {}, function(data){ |
---|
[6528] | 4165 | if(!data.error){ |
---|
| 4166 | if(data.collection.error) |
---|
| 4167 | box.find(".box-loading").remove(); |
---|
| 4168 | else{ |
---|
| 4169 | box.find(".box-loading").removeClass("box-loading").addClass("box-info"); |
---|
| 4170 | box.addClass("box-"+value).removeClass("invalid-email-box"); |
---|
| 4171 | loadGroupBox(data.collection, ".box-"+value); |
---|
| 4172 | box.unbind("dblclick").bind("dblclick", function(e){ |
---|
[6531] | 4173 | new $.Zebra_Dialog(get_lang("Impossible editing this contact, but it's possible to remove it"), { |
---|
[6528] | 4174 | 'buttons': false, |
---|
| 4175 | 'modal': false, |
---|
| 4176 | 'position': ['right - 20', 'top + 20'], |
---|
| 4177 | 'auto_close': 3000 |
---|
| 4178 | }); |
---|
| 4179 | }).find(".box-input").val("\""+data.collection.data[1].value+"\" <"+data.collection.data[1].value+">"); |
---|
| 4180 | 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)) |
---|
| 4181 | } |
---|
| 4182 | }else{ |
---|
| 4183 | box.find(".box-loading").remove(); |
---|
| 4184 | } |
---|
| 4185 | }); |
---|
| 4186 | return; |
---|
| 4187 | } |
---|
| 4188 | |
---|
| 4189 | if(personal){ |
---|
[6592] | 4190 | REST.get("/"+ (shared ? "shared" : "") +"contact/"+value, {}, function(data){ |
---|
[6528] | 4191 | if(!data.error){ |
---|
| 4192 | if(data.collection.error) |
---|
| 4193 | box.find(".box-loading").remove(); |
---|
| 4194 | else{ |
---|
| 4195 | box.find(".box-loading").removeClass("box-loading").addClass("box-info"); |
---|
| 4196 | box.addClass("box-"+value).removeClass("invalid-email-box"); |
---|
| 4197 | loadExtraLDAPBox(data.collection.data, ".box-"+value); |
---|
| 4198 | box.unbind("dblclick").bind("dblclick", function(e){ |
---|
[6531] | 4199 | new $.Zebra_Dialog(get_lang("Impossible editing this contact, but it's possible to remove it"), { |
---|
[6528] | 4200 | 'buttons': false, |
---|
| 4201 | 'modal': false, |
---|
| 4202 | 'position': ['right - 20', 'top + 20'], |
---|
| 4203 | 'auto_close': 3000 |
---|
| 4204 | }); |
---|
| 4205 | }).find(".box-input").val("\""+data.collection.data[0].value+"\" <"+data.collection.data[1].value+">"); |
---|
| 4206 | 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)) |
---|
| 4207 | } |
---|
| 4208 | }else{ |
---|
| 4209 | box.find(".box-loading").remove(); |
---|
| 4210 | } |
---|
| 4211 | }); |
---|
| 4212 | return; |
---|
| 4213 | } |
---|
| 4214 | |
---|
| 4215 | REST.get("/usersldap", {field : ldap_id,value: value}, function(data){ |
---|
| 4216 | if(!data.error){ |
---|
| 4217 | if(data.collection.error) |
---|
| 4218 | box.find(".box-loading").remove(); |
---|
| 4219 | else{ |
---|
| 4220 | box.find(".box-loading").removeClass("box-loading").addClass("box-info"); |
---|
| 4221 | box.addClass("box-"+value).removeClass("invalid-email-box"); |
---|
| 4222 | loadExtraLDAPBox(data.collection.itens[0].data, ".box-"+value); |
---|
| 4223 | box.unbind("dblclick").bind("dblclick", function(e){ |
---|
[6531] | 4224 | new $.Zebra_Dialog(get_lang("Impossible editing this contact, but it's possible to remove it"), { |
---|
[6528] | 4225 | 'buttons': false, |
---|
| 4226 | 'modal': false, |
---|
| 4227 | 'position': ['right - 20', 'top + 20'], |
---|
| 4228 | 'auto_close': 3000 |
---|
| 4229 | }); |
---|
| 4230 | }).find(".box-input").val("\""+data.collection.itens[0].data[0].value+"\" <"+data.collection.itens[0].data[1].value+">"); |
---|
| 4231 | 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] | 4232 | if(data.collection.itens[0].data[3].value == "TRUE"){ |
---|
| 4233 | box.removeClass("invalid-email-box").addClass("out-office-box"); |
---|
| 4234 | } |
---|
[6528] | 4235 | } |
---|
| 4236 | }else{ |
---|
| 4237 | box.find(".box-loading").remove(); |
---|
| 4238 | } |
---|
| 4239 | }); |
---|
| 4240 | } |
---|
| 4241 | |
---|
[7043] | 4242 | //FUNᅵᅵO QUE "SETA" OS BINDS DOS CAMPOS PARA - CC - CCO |
---|
[6528] | 4243 | function input_binds(div, ID){ |
---|
| 4244 | |
---|
| 4245 | //AO CLICAR NA DIV SETA O FOCO NO INPUT |
---|
| 4246 | div.click(function(e){ |
---|
| 4247 | if(e.target == $(this)[0]){ |
---|
| 4248 | $(this).find("input:last").focus(); |
---|
| 4249 | $(this).find("div").removeClass("box-selected"); |
---|
| 4250 | } |
---|
| 4251 | }) |
---|
| 4252 | |
---|
| 4253 | //AO SAIR DO FOCO DA DIV ELE RETIRA TODAS AS CLASSES DE CAIXAS SELECIONADAS |
---|
| 4254 | .focusout(function(e){ |
---|
| 4255 | if(!$(e.target).parents(".email-area:first").length) |
---|
| 4256 | $(this).find("div").removeClass("box-selected"); |
---|
| 4257 | }).droppable({ |
---|
| 4258 | hoverClass: "box-draggable-hover", |
---|
| 4259 | accept : ".box", |
---|
| 4260 | drop : function(e, ui){ |
---|
| 4261 | ui.draggable.parent().droppable( "enable" ); |
---|
| 4262 | var box = ui.draggable.clone(); |
---|
| 4263 | box_actions(box); |
---|
| 4264 | if(box.find(".box-info").length){ |
---|
| 4265 | box.unbind("dblclick").bind("dblclick", function(e){ |
---|
| 4266 | new $.Zebra_Dialog('<strong>Impossivel editar</strong> um contato do ldap\n' + |
---|
[7043] | 4267 | '<strong>Porᅵm</strong>ᅵ possivel remove-lo', { |
---|
[6528] | 4268 | 'buttons': false, |
---|
| 4269 | 'modal': false, |
---|
| 4270 | 'position': ['right - 20', 'top + 20'], |
---|
| 4271 | 'auto_close': 3000 |
---|
| 4272 | }); |
---|
| 4273 | }); |
---|
| 4274 | } |
---|
| 4275 | $(this).prepend(box); |
---|
| 4276 | ui.draggable.remove(); |
---|
| 4277 | } |
---|
| 4278 | }); |
---|
| 4279 | |
---|
| 4280 | //MAKE KEYDOWN |
---|
| 4281 | input_keydowns(div.find("input"), ID); |
---|
| 4282 | |
---|
| 4283 | |
---|
[7043] | 4284 | //VERIFICA PREFERENCIA DE CONTATOS DINï¿œMICOS ESTA ATIVA |
---|
[6528] | 4285 | if(parseInt(preferences.use_dynamic_contacts)){ |
---|
[7043] | 4286 | //PREPARAᅵᅵO DA ARRAY DOS CONTATOS DINᅵMICOS |
---|
[6528] | 4287 | |
---|
| 4288 | $.widget( "custom.catcomplete", $.ui.autocomplete, { |
---|
| 4289 | _renderMenu: function( ul, items ) { |
---|
| 4290 | var self = this, |
---|
| 4291 | currentType = ""; |
---|
| 4292 | $.each( items, function( index, item ) { |
---|
[6592] | 4293 | if ( item.typel != currentType) { |
---|
| 4294 | if(item.typel == "/groups" && $(ul).find(".dynamic-recent").length) |
---|
[6528] | 4295 | self._renderItem( ul, {name:"", value:"", type:"linha"} ); |
---|
[6592] | 4296 | if(item.typel == "/contacts" && ($(ul).find(".dynamic-group").length || $(ul).find(".dynamic-recent").length)) |
---|
[6528] | 4297 | self._renderItem( ul, {name:"", value:"", type:"linha"} ); |
---|
[6592] | 4298 | currentType = item.typel; |
---|
[6528] | 4299 | } |
---|
| 4300 | self._renderItem( ul, item ); |
---|
| 4301 | $(ul).find("li:last").find(".dynamic-stars").raty({ |
---|
| 4302 | readOnly : true, |
---|
| 4303 | half : true, |
---|
| 4304 | hints : ['','','','',''], |
---|
[6652] | 4305 | score : ((item.number_of_messages*5)/topContact) > 0.5 ? ((item.number_of_messages*5)/topContact) : 0.5, |
---|
[6528] | 4306 | starOn : '../../prototype/plugins/jq-raty/img/star-on.png', |
---|
| 4307 | starOff : '../../prototype/plugins/jq-raty/img/star-off.png', |
---|
| 4308 | starHalf : '../../prototype/plugins/jq-raty/img/star-half.png' |
---|
| 4309 | }); |
---|
| 4310 | }); |
---|
[6592] | 4311 | if($(ul).find("li:last").hasClass("dynamic-separator")){ |
---|
| 4312 | $(ul).find("li:last").remove(); |
---|
| 4313 | } |
---|
[6927] | 4314 | $(ul).scroll(function(){ |
---|
| 4315 | canMakeBox = false; |
---|
| 4316 | }); |
---|
[6528] | 4317 | } |
---|
| 4318 | }); |
---|
[7043] | 4319 | //INSERᅵᅵO DO AUTO COMPLETE AO INPUT |
---|
[6528] | 4320 | div.find("input").catcomplete({ |
---|
| 4321 | minLength: 1, |
---|
| 4322 | source: function(request, response){ |
---|
[6592] | 4323 | if ( request.term in cache ) { |
---|
| 4324 | response( cache[ request.term ] ); |
---|
| 4325 | return; |
---|
| 4326 | } |
---|
[6678] | 4327 | dynamicContactsList = new Array(); |
---|
[6592] | 4328 | REST.get("/usercontacts", false, function(data){ |
---|
| 4329 | dynamicData = data.collection.itens; |
---|
| 4330 | if(dynamicData){ |
---|
| 4331 | $.each(dynamicData, function(index, value){ |
---|
| 4332 | dynamic = {}; |
---|
| 4333 | $.each(value.data, function(index, value){ |
---|
| 4334 | dynamic[value.name] = value.value; |
---|
| 4335 | }); |
---|
| 4336 | dynamic['value'] = (dynamic.name ? dynamic.name +' - ': '') + dynamic.mail; |
---|
| 4337 | dynamic['type'] = value.dataType; |
---|
| 4338 | dynamic['typel'] = (value.dataType.substring(0,7) == "/shared" ? "/"+value.dataType.substring(7,value.dataType.length)+"s" : value.dataType) ; |
---|
[6678] | 4339 | dynamicContactsList.push(dynamic); |
---|
[6592] | 4340 | }); |
---|
| 4341 | } |
---|
[6678] | 4342 | var data = $.ui.autocomplete.filter(dynamicContactsList, request.term ); |
---|
[6592] | 4343 | cache[ request.term ] = data; |
---|
| 4344 | response( data ); |
---|
| 4345 | }); |
---|
[6528] | 4346 | }, |
---|
| 4347 | focus: function() { |
---|
| 4348 | return false; |
---|
| 4349 | }, |
---|
| 4350 | |
---|
[7043] | 4351 | //EVENTO AO SELECIONAR UM CONTATO DINï¿œMICO |
---|
[6528] | 4352 | select: function( event, ui ) { |
---|
[6667] | 4353 | canMakeBox = false; |
---|
[6528] | 4354 | event.preventDefault(); |
---|
| 4355 | $(this).val(""); |
---|
[6592] | 4356 | if(ui.item.typel == "/contacts") |
---|
| 4357 | draw_email_box(""+ui.item.id, $(this), true, (ui.item.type.substring(0,7) == "/shared" ? true : false)); |
---|
| 4358 | else if(ui.item.typel == "/groups") |
---|
| 4359 | draw_email_box(""+ui.item.id, $(this), "G", (ui.item.type.substring(0,7) == "/shared" ? true : false)); |
---|
[6528] | 4360 | else |
---|
[6592] | 4361 | draw_email_box(ui.item.name ? "\""+ui.item.name+"\" <"+ui.item.mail+">" : ui.item.mail, $(this)); |
---|
[6528] | 4362 | return false; |
---|
| 4363 | }, |
---|
| 4364 | autoFocus: true, |
---|
| 4365 | position : { my: "left top", at: "left bottom", collision: "fit" } |
---|
| 4366 | }).bind('catcompleteopen', function(event, ui) { |
---|
| 4367 | $(this).data('is_open',true); |
---|
| 4368 | }).bind('catcompleteclose', function(event, ui) { |
---|
[6667] | 4369 | canMakeBox = true; |
---|
[6528] | 4370 | $(this).data('is_open',false); |
---|
| 4371 | }) |
---|
[5911] | 4372 | |
---|
[7043] | 4373 | //MONTAGEM DA LISTA DE CONTATOS DINï¿œMICOS DO AUTO COMPLETE |
---|
[6528] | 4374 | .data( "catcomplete" )._renderItem = function( ul, item ) { |
---|
[6592] | 4375 | if($(ul).find("li").length < 50){ |
---|
| 4376 | var autocomplete = $(this)[0].element; |
---|
[7043] | 4377 | //cï¿œlculo dinï¿œmico da largura da lista |
---|
[6648] | 4378 | var width = (item.label ? item.label.length : (item.value ? item.value.length : (item.email ? item.email.length : 20 ))); |
---|
| 4379 | width = width*5 + (is_ie ? 170 : 200) + 16; |
---|
| 4380 | if (width < $(ul).width()) |
---|
| 4381 | width = $(ul).width(); |
---|
| 4382 | ul.css({"min-width":width,"max-height" : "180px", "overflow-y" : "auto", "min-height": "30px"}); |
---|
[6592] | 4383 | var listContacts = DataLayer.render("../prototype/modules/mail/templates/listContacts.ejs", item); |
---|
| 4384 | return $(listContacts).data( "item.autocomplete", item ).appendTo( ul ).find("span:last").button({ |
---|
| 4385 | icons : { |
---|
| 4386 | primary : "ui-icon-close" |
---|
| 4387 | }, |
---|
| 4388 | text: false |
---|
| 4389 | }).click(function(event){ |
---|
| 4390 | var removeLi = $(this).parents("li:first"); |
---|
| 4391 | if(!event.keyCode) |
---|
| 4392 | autocomplete.catcomplete( "close" ); |
---|
[6667] | 4393 | canMakeBox = false; |
---|
[6614] | 4394 | $.Zebra_Dialog('Deseja remover <b>'+(item.name ? item.name+" - " : "")+ item.mail+'</b>?', { |
---|
[6592] | 4395 | 'type': 'question', |
---|
| 4396 | 'custom_class': (is_ie ? 'configure-zebra-dialog' : ''), |
---|
[7043] | 4397 | 'title': 'Atenᅵᅵo', |
---|
| 4398 | 'buttons': ['Sim','Nï¿œo'], |
---|
[6592] | 4399 | 'overlay_opacity': '0.5', |
---|
| 4400 | 'onClose': function(caption) { |
---|
| 4401 | if(caption == 'Sim'){ |
---|
| 4402 | $(removeLi).remove(); |
---|
[6851] | 4403 | REST['delete']("/dynamiccontact/"+item.id); |
---|
[6592] | 4404 | updateDynamicContact(); |
---|
| 4405 | cache = new Array(); |
---|
[7043] | 4406 | }else if(caption == 'Nï¿œo'){ |
---|
[6667] | 4407 | $(focusIn).focus(); |
---|
[6592] | 4408 | } |
---|
[6528] | 4409 | } |
---|
[6592] | 4410 | }); |
---|
[6528] | 4411 | }); |
---|
[6592] | 4412 | } |
---|
| 4413 | return; |
---|
[6528] | 4414 | }; |
---|
| 4415 | } |
---|
| 4416 | |
---|
[7043] | 4417 | //FUNᅵᅵO DOS BOTᅵES PARA - CC - CCO |
---|
[6528] | 4418 | div.parents("tr:first").find("button").button().click(function(){ |
---|
[6562] | 4419 | click = true; |
---|
[6670] | 4420 | fastSearch = true; |
---|
[6927] | 4421 | canMakeBox = false; |
---|
[6528] | 4422 | if(!$(":focus").hasClass("new-message-input")) |
---|
| 4423 | 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); |
---|
| 4424 | }); |
---|
| 4425 | } |
---|
| 4426 | |
---|
[271] | 4427 | function draw_new_message(border_ID){ |
---|
[3105] | 4428 | connector.loadScript("color_palette"); |
---|
| 4429 | connector.loadScript('wfolders'); |
---|
[6528] | 4430 | connector.loadScript("ccQuickAdd"); |
---|
[5911] | 4431 | |
---|
[3105] | 4432 | if(typeof(RichTextEditor) == 'undefined' || typeof(ColorPalette) == 'undefined' || typeof(wfolders) == 'undefined') |
---|
[3068] | 4433 | return false; |
---|
| 4434 | |
---|
[5911] | 4435 | if(typeof($.fn.elastic) == "undefined"){ |
---|
| 4436 | $.lazy({ |
---|
| 4437 | src: '../prototype/plugins/jquery-elastic/jquery.elastic.source.js', |
---|
| 4438 | name: 'elastic' |
---|
| 4439 | }); |
---|
| 4440 | } |
---|
[7043] | 4441 | //var ID = create_border("",border_ID); |
---|
| 4442 | var ID = countID; |
---|
| 4443 | |
---|
| 4444 | createTab("Nova Mensagem"); |
---|
| 4445 | |
---|
[4139] | 4446 | if (ID == 0) |
---|
| 4447 | return 0; |
---|
[5134] | 4448 | else if(ID == 'maximo') |
---|
| 4449 | return 'maximo'; |
---|
[5911] | 4450 | |
---|
[2] | 4451 | hold_session = true; |
---|
[3035] | 4452 | |
---|
[5911] | 4453 | if ($("#footer_menu").length){ |
---|
| 4454 | $("#footer_menu").css('display','none'); |
---|
[1701] | 4455 | } |
---|
[7043] | 4456 | var content = $("#ptabs_"+ID).html(DataLayer.render("../prototype/modules/mail/templates/new_message.ejs", {id: ID})); |
---|
[5911] | 4457 | RichTextEditor.loadEditor2(ID); |
---|
[5417] | 4458 | |
---|
[5911] | 4459 | //if(!expresso_offline) |
---|
| 4460 | // draw_from_field(sel_from,tr1_1); |
---|
[5417] | 4461 | |
---|
[5911] | 4462 | //content.find('name="input_to"').elastic().elastic("destroy"); |
---|
| 4463 | draw_from_field(content.find(".from-select")[0], content.find(".from-tr")[0]); |
---|
[5417] | 4464 | |
---|
[5911] | 4465 | var check_input = function(field){ |
---|
| 4466 | var check = field.attr("checked"); |
---|
| 4467 | field.attr("checked", (!check ? true : false)); |
---|
| 4468 | return (!check ? true : false); |
---|
[5417] | 4469 | } |
---|
| 4470 | |
---|
[7043] | 4471 | //AᅵᅵO GENERICA PARA ADICIONAR/REMOVER |
---|
[5911] | 4472 | var change_text = function(field, text, to_text){ |
---|
| 4473 | var text = (field.html() == text ? to_text : text); |
---|
| 4474 | field.html(text); |
---|
[3035] | 4475 | } |
---|
[4832] | 4476 | |
---|
[7043] | 4477 | //AᅵᅵO GENERICA PARA ADICIONAR/REMOVER CC & CCO |
---|
[5911] | 4478 | var show_hide = function(field, button){ |
---|
| 4479 | button.toggleClass("expressomail-button-icon-ative"); |
---|
| 4480 | field.toggle(); |
---|
[6528] | 4481 | field.find("textarea").val("").parent().find("input").focus(); |
---|
| 4482 | field.find(".email-area div").remove(); |
---|
| 4483 | if(!field.find("textarea").hasClass("track")){ |
---|
| 4484 | field.find("textarea").css({"max-height" : "115px", "overflow-y" : "auto"}).addClass("track"); |
---|
| 4485 | input_binds(field.find(".email-area"), ID); |
---|
[4934] | 4486 | } |
---|
[5417] | 4487 | } |
---|
[4832] | 4488 | |
---|
[6547] | 4489 | 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] | 4490 | |
---|
[7043] | 4491 | //Botï¿œo TextoRico/TextoSimples |
---|
[5911] | 4492 | content.find(".new-msg-head-right-buttons").find(".button").button().filter(".rich-button").click(function(){ |
---|
[7043] | 4493 | /*Se o texto do botᅵo for "Texto simples" exibirᅵ a mensagem antes de alterar para texto simples*/ |
---|
[6698] | 4494 | if($(".rich-button").find("span").text() == get_lang("Simple Text")){ |
---|
| 4495 | $.Zebra_Dialog(get_lang("Convert this message into plain text can make parts of it are removed. Continue?"), { |
---|
| 4496 | 'type': 'warning', |
---|
| 4497 | 'overlay_opacity': '0.5', |
---|
| 4498 | 'buttons': ['OK','Cancelar'], |
---|
| 4499 | 'width' : 380, |
---|
| 4500 | 'onClose': function(clicked) { |
---|
| 4501 | if(clicked == 'OK'){ |
---|
| 4502 | RichTextEditor.setPlain(check_input(content.find('[name="textplain_rt_checkbox"]')), ID); |
---|
| 4503 | $(".rich-button").find("span").text(get_lang("Rich Text")); |
---|
| 4504 | } |
---|
| 4505 | } |
---|
| 4506 | }) |
---|
| 4507 | } |
---|
[7043] | 4508 | /*Se o texto do botï¿œo for "Texto rico" simplesmente altera para texto rico*/ |
---|
[6698] | 4509 | else{ |
---|
| 4510 | RichTextEditor.setPlain(check_input(content.find('[name="textplain_rt_checkbox"]')), ID); |
---|
| 4511 | $(".rich-button").find("span").text(get_lang("Simple Text")); |
---|
| 4512 | } |
---|
[5911] | 4513 | }) |
---|
[5417] | 4514 | |
---|
[7043] | 4515 | //Botï¿œo Adicionar/Remover CCO |
---|
[5911] | 4516 | .end().filter(".cco-button").click(function(){ |
---|
| 4517 | show_hide(content.find(".cco-tr"), $(this)); |
---|
| 4518 | change_text($(this).find(".ui-button-text"), get_lang("Add BCC"), get_lang('Remove CCo')); |
---|
| 4519 | }) |
---|
[7043] | 4520 | //Botï¿œo Adicionar/Remover CC |
---|
[5911] | 4521 | .end().filter(".cc-button").click(function(){ |
---|
| 4522 | show_hide(content.find(".cc-tr"), $(this)); |
---|
| 4523 | change_text($(this).find(".ui-button-text"), get_lang("Add CC"), get_lang('Remove CC')); |
---|
[6861] | 4524 | }) |
---|
[7043] | 4525 | //Botï¿œo Responder a |
---|
[6882] | 4526 | .end().filter(".reply-to-button").click(function(){ |
---|
| 4527 | show_hide(content.find(".reply-to-tr"), $(this)); |
---|
| 4528 | }); |
---|
[5417] | 4529 | |
---|
[5911] | 4530 | //BOTAO ENVIAR |
---|
| 4531 | content.find(".send").button({ |
---|
[5417] | 4532 | icons : { |
---|
| 4533 | primary : "expressomail-icon-send" |
---|
| 4534 | } |
---|
[5911] | 4535 | }).click(function(){ |
---|
| 4536 | send_message(ID,preferences.save_in_folder,null); |
---|
| 4537 | }) |
---|
| 4538 | //BOTAO SALVAR E ENVIAR |
---|
| 4539 | .end().find(".save-and-send").button({ |
---|
[5417] | 4540 | icons : { |
---|
[5911] | 4541 | primary : "expressomail-icon-send" |
---|
| 4542 | } |
---|
| 4543 | }).click(function(){ |
---|
| 4544 | wfolders.makeWindow(ID,"send_and_file"); |
---|
| 4545 | }) |
---|
| 4546 | //BOTAO SALVAR |
---|
| 4547 | .end().find(".save").button({ |
---|
| 4548 | icons : { |
---|
[5417] | 4549 | primary : "expressomail-icon-save" |
---|
| 4550 | } |
---|
[5911] | 4551 | }).click(function(){ |
---|
| 4552 | save_msg(ID); |
---|
| 4553 | }) |
---|
| 4554 | //BOTAO CONF. LEITURA |
---|
| 4555 | .end().find(".return-recept").button({ |
---|
[5417] | 4556 | icons : { |
---|
| 4557 | primary : "expressomail-icon-read-confirmation" |
---|
| 4558 | } |
---|
[5911] | 4559 | }).click(function(){ |
---|
| 4560 | check_input(content.find('[name="input_return_receipt"]')); |
---|
| 4561 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 4562 | }) |
---|
| 4563 | //BOTAO IMPORTANTE |
---|
| 4564 | .end().find(".important").button({ |
---|
[5417] | 4565 | icons : { |
---|
| 4566 | primary : "expressomail-icon-important" |
---|
| 4567 | } |
---|
[5911] | 4568 | }).click(function(){ |
---|
| 4569 | check_input(content.find('[name="input_important_message"]')); |
---|
| 4570 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 4571 | }) |
---|
| 4572 | //BOTAO ASS. DIGITAL |
---|
| 4573 | .end().find(".return_digital").button({ |
---|
[5417] | 4574 | icons : { |
---|
| 4575 | primary : "expressomail-icon-signature" |
---|
| 4576 | } |
---|
[5911] | 4577 | }).click(function(){ |
---|
| 4578 | check_input(content.find('[name="input_return_digital"]')); |
---|
| 4579 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 4580 | }) |
---|
| 4581 | //BOTAO EMAIL CRYPT |
---|
| 4582 | .end().find(".return_cripto").button({ |
---|
[5417] | 4583 | icons : { |
---|
| 4584 | primary : "expressomail-icon-encryption" |
---|
| 4585 | } |
---|
[5911] | 4586 | }).click(function(){ |
---|
| 4587 | check_input(content.find('[name="input_return_cripto"]')); |
---|
[5417] | 4588 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 4589 | }); |
---|
[5911] | 4590 | |
---|
| 4591 | content.find(".attachment td").filter(".value").prepend(DataLayer.render("../prototype/modules/mail/templates/attachment.ejs", {ID:ID})); |
---|
| 4592 | var fileUploadMSG = $('#fileupload_msg'+ID); |
---|
[6071] | 4593 | var maxAttachmentSize = (preferences.max_attachment_size !== "" && preferences.max_attachment_size != 0) ? (parseInt(preferences.max_attachment_size.replace('M', '')) * 1048576 ) : false; |
---|
[6107] | 4594 | |
---|
[6930] | 4595 | content.find(".new-msg-head-data").scroll(function(){ |
---|
| 4596 | $.each(fileUploadMSG.find(".attachments-list .att-box"), function(index, value){ |
---|
| 4597 | $(this).qtip("api").updatePosition(); |
---|
| 4598 | $(this).qtip("api").updateWidth(); |
---|
| 4599 | }); |
---|
| 4600 | }); |
---|
| 4601 | $("#fileupload_msg"+ID+"_droopzone").click(function(){ |
---|
| 4602 | $(this).removeClass('in hover'); |
---|
| 4603 | $(this).hide(); |
---|
| 4604 | $(this).prev().show(); |
---|
| 4605 | }); |
---|
[6174] | 4606 | fileUploadMSG.find(".button").button().filter(".fileinput-button").find(".ui-button-text").css("margin-top", "2px").find("input:file").fileupload({ |
---|
[6930] | 4607 | //singleFileUploads : true,fileUploadMSG |
---|
[6107] | 4608 | sequentialUploads: true, |
---|
[6071] | 4609 | type: 'post', |
---|
| 4610 | dataType : 'json', |
---|
| 4611 | url: "../prototype/post.php", |
---|
[6107] | 4612 | forceIframeTransport: false, |
---|
[6930] | 4613 | dropZone : $("#fileupload_msg"+ID+"_droopzone"), |
---|
[6071] | 4614 | formData: function(form) { |
---|
| 4615 | return [ |
---|
| 4616 | { |
---|
| 4617 | name : "mailAttachment[0][source]", |
---|
| 4618 | value : "files0" |
---|
| 4619 | }, |
---|
| 4620 | { |
---|
| 4621 | name : "mailAttachment[0][disposition]", |
---|
| 4622 | value : $(form[0]['attDisposition'+$(form[0]['abaID']).val()]).val() |
---|
| 4623 | }, |
---|
| 4624 | { |
---|
| 4625 | name: "MAX_FILE_SIZE", |
---|
| 4626 | value : maxAttachmentSize |
---|
| 4627 | } |
---|
| 4628 | ]; |
---|
[6107] | 4629 | }, |
---|
[5604] | 4630 | add: function (e, data) { |
---|
[6930] | 4631 | var iterator = idattachbycontent; |
---|
[6071] | 4632 | if(!maxAttachmentSize || data.files[0].size < maxAttachmentSize || is_ie) { |
---|
[5604] | 4633 | setTimeout(function() { |
---|
[6071] | 4634 | $('#attDisposition'+ID).val('attachment'); |
---|
[6930] | 4635 | jqXHR[iterator] = data.submit(); |
---|
| 4636 | }, 100); |
---|
[6107] | 4637 | } |
---|
[6930] | 4638 | fileUploadMSG.find(' .attachments-list').show(); |
---|
[6107] | 4639 | $.each(data.files, function (index, file) { |
---|
| 4640 | var attach = {}; |
---|
| 4641 | attach.fullFileName = file.name; |
---|
| 4642 | attach.fileName = file.name; |
---|
[6930] | 4643 | if(file.name.length > 20) |
---|
| 4644 | attach.fileName = file.name.substr(0, 17) + " ... " + file.name.substr(file.name.length-6, file.name.length); |
---|
[6107] | 4645 | attach.fileSize = formatBytes(file.size); |
---|
| 4646 | if(maxAttachmentSize && file.size > maxAttachmentSize) |
---|
[6930] | 4647 | attach.error = 'Tamanho de arquivo nao permitido' |
---|
| 4648 | else |
---|
| 4649 | attach.error = true; |
---|
| 4650 | var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); |
---|
| 4651 | upload.find('.att-box-delete').click(function(){ |
---|
[6107] | 4652 | var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); |
---|
| 4653 | fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); |
---|
[6930] | 4654 | delAttachment(ID, idAttach); |
---|
| 4655 | $(this).parent().qtip("destroy"); |
---|
[6107] | 4656 | $(this).parent().remove(); |
---|
[6930] | 4657 | if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){ |
---|
| 4658 | fileUploadMSG.find(' .attachments-list').hide(); |
---|
| 4659 | } |
---|
| 4660 | if(jqXHR){ |
---|
| 4661 | jqXHR[iterator].abort(); |
---|
| 4662 | } |
---|
[6107] | 4663 | }); |
---|
[6930] | 4664 | |
---|
| 4665 | fileUploadMSG.find('.attachments-list').append(upload); |
---|
[5604] | 4666 | |
---|
[6930] | 4667 | fileUploadMSG.find('.attachments-list .att-box:last').qtip({ |
---|
| 4668 | content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), |
---|
| 4669 | position: { |
---|
| 4670 | corner: { |
---|
| 4671 | tooltip: 'bottomMiddle', |
---|
| 4672 | target: 'topMiddle' |
---|
| 4673 | }, |
---|
| 4674 | adjust: { |
---|
| 4675 | resize: true, |
---|
| 4676 | scroll: true, |
---|
| 4677 | screen: true |
---|
| 4678 | } |
---|
| 4679 | }, |
---|
| 4680 | show: { |
---|
| 4681 | when: 'mouseover', // Don't specify a show event |
---|
| 4682 | ready: false // Show the tooltip when ready |
---|
| 4683 | }, |
---|
| 4684 | hide: 'mouseout', // Don't specify a hide event |
---|
| 4685 | style: { |
---|
| 4686 | border: { |
---|
| 4687 | width: 1, |
---|
| 4688 | radius: 5 |
---|
| 4689 | }, |
---|
| 4690 | width: { |
---|
| 4691 | min: 75, |
---|
| 4692 | max : 1000 |
---|
| 4693 | }, |
---|
| 4694 | padding: 3, |
---|
| 4695 | textAlign: 'left', |
---|
| 4696 | tip: true, // Give it a speech bubble tip with automatic corner detection |
---|
| 4697 | name: (typeof(attach.error) == 'boolean' ? 'light' : 'red') // Style it according to the preset 'cream' style |
---|
| 4698 | } |
---|
| 4699 | })/*.progressbar({ |
---|
| 4700 | value : 1 |
---|
| 4701 | })*/; |
---|
| 4702 | |
---|
| 4703 | fileUploadMSG.find('.attachments-list .att-box:last').css('width', fileUploadMSG.find('.attachments-list .att-box:last div:first').css('width')); |
---|
| 4704 | |
---|
[6107] | 4705 | if(!maxAttachmentSize || file.size < maxAttachmentSize){ |
---|
| 4706 | if(data.fileInput){ |
---|
| 4707 | fileUploadMSG.find('.fileinput-button.new').append(data.fileInput[0]).removeClass('new'); |
---|
| 4708 | fileUploadMSG.find('.attachments-list').find('[type=file]').addClass('hidden'); |
---|
| 4709 | } |
---|
| 4710 | }else |
---|
| 4711 | fileUploadMSG.find(' .fileinput-button.new').removeClass('new'); |
---|
[6930] | 4712 | |
---|
| 4713 | idattachbycontent++ |
---|
[6045] | 4714 | }); |
---|
[6930] | 4715 | |
---|
[6045] | 4716 | }, |
---|
[5604] | 4717 | done: function(e, data){ |
---|
[6930] | 4718 | var attach_box = fileUploadMSG.find('.att-box-loading:first').parents('.att-box'); |
---|
| 4719 | var attach = { |
---|
| 4720 | fullFileName : attach_box.find(".att-box-fullfilename").text(), |
---|
| 4721 | fileSize : attach_box.find(".att-box-filesize").text(), |
---|
| 4722 | error : false |
---|
| 4723 | }; |
---|
[5702] | 4724 | if(!!data.result && data.result != "[]" ){ |
---|
[6071] | 4725 | var newAttach = data.result; |
---|
[6930] | 4726 | if(!newAttach.mailAttachment.error || newAttach.rollback !== false){ |
---|
| 4727 | attach_box.append('<input type="hidden" name="fileId[]" value="'+newAttach['mailAttachment'][0][0].id+'"/>'); |
---|
| 4728 | addAttachment(ID,newAttach['mailAttachment'][0][0].id); |
---|
| 4729 | }else { |
---|
| 4730 | attach_box.addClass('invalid-email-box'); |
---|
| 4731 | attach.error = newAttach.mailAttachment.error ? newAttach.mailAttachment.error : 'Erro ao anexar...';//.append(newAttach.mailAttachment.error).addClass('message-attach-error'); |
---|
| 4732 | } |
---|
[5604] | 4733 | }else { |
---|
[6930] | 4734 | attach_box.addClass('invalid-email-box');//.qtip("api").updateContent("oi", true); |
---|
| 4735 | attach.error = 'Erro ao anexar...'; |
---|
[5604] | 4736 | } |
---|
[6930] | 4737 | attach_box.qtip("destroy").qtip({ |
---|
| 4738 | content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), |
---|
| 4739 | position: { |
---|
| 4740 | corner: { |
---|
| 4741 | tooltip: 'bottomMiddle', |
---|
| 4742 | target: 'topMiddle' |
---|
| 4743 | }, |
---|
| 4744 | adjust: { |
---|
| 4745 | resize: true, |
---|
| 4746 | scroll: true, |
---|
| 4747 | screen: true |
---|
| 4748 | } |
---|
| 4749 | }, |
---|
| 4750 | show: { |
---|
| 4751 | when: 'mouseover', // Don't specify a show event |
---|
| 4752 | ready: false // Show the tooltip when ready |
---|
| 4753 | }, |
---|
| 4754 | hide: 'mouseout', // Don't specify a hide event |
---|
| 4755 | style: { |
---|
| 4756 | border: { |
---|
| 4757 | width: 1, |
---|
| 4758 | radius: 5 |
---|
| 4759 | }, |
---|
| 4760 | width: { |
---|
| 4761 | min: 75, |
---|
| 4762 | max : 1000 |
---|
| 4763 | }, |
---|
| 4764 | padding: 3, |
---|
| 4765 | textAlign: 'left', |
---|
| 4766 | tip: true, // Give it a speech bubble tip with automatic corner detection |
---|
| 4767 | name: (attach.error == false ? 'blue' : 'red')// Style it according to the preset 'cream' style |
---|
| 4768 | } |
---|
| 4769 | });/* |
---|
| 4770 | fileUploadMSG.find(".att-box-loading:first").parents(".att-box").removeAttr("style").progressbar("destroy").find("div:first").removeAttr("style"); |
---|
| 4771 | */ |
---|
| 4772 | fileUploadMSG.find('.att-box-loading:first').remove(); |
---|
| 4773 | }/*, |
---|
| 4774 | progress : function(e, data){ |
---|
| 4775 | var progress = parseInt(data.loaded / data.total * 100, 10); |
---|
| 4776 | fileUploadMSG.find('.att-box-loading:first').parents(".att-box:first").progressbar({ |
---|
| 4777 | value : progress |
---|
| 4778 | }); |
---|
| 4779 | }*/ |
---|
[6124] | 4780 | }).css({ |
---|
| 4781 | "height" : "20px", |
---|
| 4782 | "width": (is_webkit ? "205px" : "100px"), |
---|
| 4783 | "border-width": "0 0 0px 0px", |
---|
| 4784 | "-moz-transform" : "rotate(-180deg) translate(-147px, -0.5px) scale(1.1)", |
---|
| 4785 | "-webkit-transform" : "rotate(-180deg) translate(-104px, 0px)" |
---|
[6189] | 4786 | }).end().end().end().filter(".message-attach-link").click(function(){ |
---|
[6107] | 4787 | jQuery('#message-attach-dialog').html(DataLayer.render("../prototype/modules/attach_message/attach_message.ejs", {})); |
---|
| 4788 | $( "#mailpreview_container span.ui-icon-close" ).click(); |
---|
| 4789 | jQuery('#message-attach-dialog').dialog({ |
---|
| 4790 | width:920, |
---|
| 4791 | height:550, |
---|
| 4792 | resizable:false, |
---|
| 4793 | modal: true, |
---|
| 4794 | closeOnEscape:true, |
---|
[6910] | 4795 | close:function(event, ui) |
---|
| 4796 | { |
---|
| 4797 | event.stopPropagation(); |
---|
| 4798 | if(typeof(shortcut) != 'undefined') shortcut.disabled = false; |
---|
| 4799 | }, |
---|
| 4800 | open: function(event, ui) |
---|
| 4801 | { |
---|
| 4802 | if(typeof(shortcut) != 'undefined') shortcut.disabled = true; |
---|
| 4803 | }, |
---|
[6107] | 4804 | autoOpen:false |
---|
[6930] | 4805 | }); |
---|
| 4806 | jQuery.getScript("../prototype/modules/attach_message/attach_message.js", function(){ |
---|
| 4807 | jQuery('#message-attach-dialog').dialog('open'); |
---|
| 4808 | jQuery('#message-attach-attach-btn').unbind('click'); |
---|
| 4809 | jQuery('#message-attach-attach-btn').click(function(event){ |
---|
| 4810 | jQuery.each(selectedMessages, function(folder_name, messages) { |
---|
| 4811 | jQuery.each(selectedMessages[folder_name], function(message_number, message) { |
---|
| 4812 | if (message) { |
---|
| 4813 | fileUploadMSG.find(' .attachments-list').show(); |
---|
| 4814 | var att = new Object(); |
---|
| 4815 | att.folder = folder_name; |
---|
| 4816 | att.uid = message_number; |
---|
| 4817 | att.type = 'imapMSG'; |
---|
| 4818 | att.name = Base64.encode(onceOpenedMessages[folder_name][message_number].subject + '.eml'); |
---|
| 4819 | var idATT = JSON.stringify(att); |
---|
| 4820 | addAttachment( ID , idATT); |
---|
| 4821 | var attach = {}; |
---|
| 4822 | attach.fileName = onceOpenedMessages[folder_name][message_number].subject + '.eml'; |
---|
| 4823 | attach.fullFileName = onceOpenedMessages[folder_name][message_number].subject + '.eml'; |
---|
| 4824 | if(attach.fileName.length > 20) |
---|
| 4825 | attach.fileName = attach.fileName.substr(0, 17) + "... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length); |
---|
[5911] | 4826 | |
---|
[6930] | 4827 | attach.error = false; |
---|
| 4828 | attach.OK = true; |
---|
| 4829 | attach.fileSize = formatBytes(onceOpenedMessages[folder_name][message_number].size); |
---|
| 4830 | var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); |
---|
| 4831 | upload.find('.att-box-loading').remove(); |
---|
| 4832 | upload.append('<input type="hidden" name="fileId[]" value=\''+idATT+'\'/>'); |
---|
| 4833 | |
---|
| 4834 | upload.find('.att-box-delete').click(function(){ |
---|
| 4835 | var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); |
---|
| 4836 | fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); |
---|
| 4837 | delAttachment(ID,idAttach); |
---|
| 4838 | $(this).parent().qtip("destroy"); |
---|
| 4839 | $(this).parent().remove(); |
---|
| 4840 | if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){ |
---|
| 4841 | fileUploadMSG.find(' .attachments-list').hide(); |
---|
| 4842 | } |
---|
| 4843 | }); |
---|
[6107] | 4844 | |
---|
[6930] | 4845 | fileUploadMSG.find('.attachments-list').append(upload); |
---|
| 4846 | |
---|
| 4847 | upload.find('.att-box-loading').remove(); |
---|
| 4848 | |
---|
| 4849 | fileUploadMSG.find('.attachments-list .att-box:last').qtip({ |
---|
| 4850 | content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), |
---|
| 4851 | position: { |
---|
| 4852 | corner: { |
---|
| 4853 | tooltip: 'bottomMiddle', |
---|
| 4854 | target: 'topMiddle' |
---|
| 4855 | }, |
---|
| 4856 | adjust: { |
---|
| 4857 | resize: true, |
---|
| 4858 | scroll: true |
---|
| 4859 | } |
---|
| 4860 | }, |
---|
| 4861 | show: { |
---|
| 4862 | when: 'mouseover', // Don't specify a show event |
---|
| 4863 | ready: false // Show the tooltip when ready |
---|
| 4864 | }, |
---|
| 4865 | hide: 'mouseout', // Don't specify a hide event |
---|
| 4866 | style: { |
---|
| 4867 | border: { |
---|
| 4868 | width: 1, |
---|
| 4869 | radius: 5 |
---|
| 4870 | }, |
---|
| 4871 | width: { |
---|
| 4872 | min: 75, |
---|
| 4873 | max : 1000 |
---|
| 4874 | }, |
---|
| 4875 | padding: 5, |
---|
| 4876 | textAlign: 'center', |
---|
| 4877 | tip: true, // Give it a speech bubble tip with automatic corner detection |
---|
| 4878 | name: 'blue' // Style it according to the preset 'cream' style |
---|
| 4879 | } |
---|
| 4880 | }); |
---|
| 4881 | } |
---|
[6107] | 4882 | }); |
---|
| 4883 | }); |
---|
[6930] | 4884 | jQuery('#message-attach-dialog').dialog('close'); |
---|
[6107] | 4885 | }); |
---|
[6930] | 4886 | jQuery('#message-attach-cancel-btn').click(function(event){ |
---|
| 4887 | jQuery('#message-attach-dialog').dialog('close'); |
---|
| 4888 | }); |
---|
[6107] | 4889 | }); |
---|
[6930] | 4890 | }); |
---|
| 4891 | $(document).bind('drop dragover', function (e) { |
---|
| 4892 | e.preventDefault(); |
---|
| 4893 | }); |
---|
[7043] | 4894 | //DRAG and DROP DE ARQUIVOS Nï¿œO FUNCIONA NO IE |
---|
[6930] | 4895 | if(!is_ie){ |
---|
| 4896 | $("body").bind('dragenter', function (e) { |
---|
| 4897 | var dropZone = $("#fileupload_msg"+ID+"_droopzone"); |
---|
| 4898 | var timeout = window.dropZoneTimeout; |
---|
| 4899 | dropZone.show(); |
---|
| 4900 | dropZone.prev().hide(); |
---|
| 4901 | if (!timeout) { |
---|
| 4902 | dropZone.addClass('in'); |
---|
| 4903 | } else { |
---|
| 4904 | clearTimeout(timeout); |
---|
| 4905 | } |
---|
| 4906 | if (e.target === dropZone[0]) { |
---|
| 4907 | dropZone.addClass('hover'); |
---|
| 4908 | } else { |
---|
| 4909 | dropZone.removeClass('hover'); |
---|
| 4910 | } |
---|
| 4911 | $(window).unbind('dragleave'); |
---|
| 4912 | window.dropZoneTimeout = setTimeout(function () { |
---|
| 4913 | $(window).bind('dragleave', function (e) { |
---|
| 4914 | window.dropZoneTimeout = null; |
---|
| 4915 | dropZone.removeClass('in hover'); |
---|
| 4916 | dropZone.hide(); |
---|
| 4917 | dropZone.prev().show(); |
---|
| 4918 | }); |
---|
| 4919 | }, 1); |
---|
| 4920 | }).bind('dragleave', function (e) { |
---|
| 4921 | var dropZone = $("#fileupload_msg"+ID+"_droopzone"); |
---|
| 4922 | window.dropZoneTimeout = setTimeout(function () { |
---|
| 4923 | $(window).bind('dragleave', function (e) { |
---|
| 4924 | window.dropZoneTimeout = null; |
---|
| 4925 | dropZone.removeClass('in hover'); |
---|
| 4926 | dropZone.hide(); |
---|
| 4927 | dropZone.prev().show(); |
---|
| 4928 | }); |
---|
| 4929 | }, 1); |
---|
| 4930 | }).bind('drop', function(e){ |
---|
| 4931 | var dropZone = $("#fileupload_msg"+ID+"_droopzone"); |
---|
| 4932 | window.dropZoneTimeout = null; |
---|
| 4933 | dropZone.removeClass('in hover'); |
---|
| 4934 | dropZone.hide(); |
---|
| 4935 | dropZone.prev().show(); |
---|
| 4936 | }); |
---|
| 4937 | } |
---|
[1701] | 4938 | return ID; |
---|
[2] | 4939 | } |
---|
| 4940 | |
---|
| 4941 | // Verify if any user is sharing his name/email address |
---|
| 4942 | // for use in the new messages's "From " field. |
---|
| 4943 | function draw_from_field(sel_from,tr1_1){ |
---|
| 4944 | |
---|
| 4945 | var el_shared_users = Element("el_shared_users"); |
---|
[7043] | 4946 | /* Recupera a pasta atual do usuï¿œrio (selecionada) */ |
---|
[6447] | 4947 | var user_shared = folder.split(cyrus_delimiter); |
---|
[7043] | 4948 | /* Verifica se estᅵ nas prᅵprias pastas */ |
---|
[6447] | 4949 | if(user_shared[0] == "INBOX"){ |
---|
| 4950 | user_shared = User.me.uid; |
---|
| 4951 | }else{ |
---|
| 4952 | user_shared = user_shared[1]; |
---|
| 4953 | } |
---|
[2] | 4954 | // The element was loaded and populated...so return. |
---|
[3035] | 4955 | if(el_shared_users){ |
---|
[371] | 4956 | // Nothing to work...so return. |
---|
| 4957 | if(el_shared_users.options.length == 0) |
---|
| 4958 | return; |
---|
[2] | 4959 | tr1_1.style.display = ''; |
---|
| 4960 | for (var x = 0; x < el_shared_users.options.length; x++) { |
---|
| 4961 | var _option = document.createElement("OPTION"); |
---|
| 4962 | _option.text = el_shared_users.options[x].text; |
---|
| 4963 | _option.value = el_shared_users.options[x].value; |
---|
[7043] | 4964 | /* Faz o tratamento do nome da pasta para fazer a verificaᅵᅵo e selecionar o valor no select */ |
---|
[6447] | 4965 | var str_begin_name = _option.text.indexOf('<') + 1; |
---|
| 4966 | var str_end_name = _option.text.indexOf('@'); |
---|
| 4967 | var user_selected_name = _option.text.substring(str_begin_name, str_end_name); |
---|
[7043] | 4968 | /* Verifica se ᅵ o usuᅵrio da pasta selecionada */ |
---|
[6447] | 4969 | if(user_selected_name == user_shared){ |
---|
| 4970 | _option.selected = 'selected'; |
---|
| 4971 | } |
---|
[2] | 4972 | sel_from.options[sel_from.options.length] = _option ; |
---|
| 4973 | } |
---|
| 4974 | return; |
---|
| 4975 | } |
---|
| 4976 | // Get the shared folders..... |
---|
| 4977 | var sharedFolders = new Array(); |
---|
| 4978 | for(var i = 0; i < folders.length; i++) { |
---|
| 4979 | var x = folders[i].folder_id; |
---|
[3035] | 4980 | if (folders[i].folder_parent == 'user'){ |
---|
| 4981 | sharedFolders[sharedFolders.length] = x; |
---|
| 4982 | } |
---|
| 4983 | } |
---|
[2] | 4984 | |
---|
[3035] | 4985 | var matchUser = '#'; |
---|
| 4986 | var sharedUsers = new Array(); |
---|
[2] | 4987 | // Filter the shared folders (only root folders) ..... |
---|
| 4988 | for(var i = 0; i < sharedFolders.length; i++) { |
---|
| 4989 | matchUser = sharedFolders[i]; |
---|
| 4990 | sharedUsers[sharedUsers.length] = matchUser.substring(("user"+cyrus_delimiter).length,matchUser.length); |
---|
[3035] | 4991 | } |
---|
[2] | 4992 | |
---|
| 4993 | // Handler function for cExecute |
---|
| 4994 | var h_user = function(data) { |
---|
[371] | 4995 | if(data.length > 0) { |
---|
| 4996 | tr1_1.style.display = ''; |
---|
[6447] | 4997 | var mycn = typeof(data.myname != 'undefined') ? data.myname : ''; |
---|
[2] | 4998 | var _option = document.createElement("OPTION"); |
---|
[5134] | 4999 | _option.text = '"'+mycn+'" <'+Element("user_email").value+'>'; |
---|
| 5000 | _option.value = mycn+";"+Element("user_email").value; |
---|
[7043] | 5001 | /* Verifica se ᅵ o usuᅵrio logado */ |
---|
[6447] | 5002 | if(user_shared == User.me.uid) |
---|
| 5003 | _option.selected = 'selected'; |
---|
[371] | 5004 | sel_from.options[sel_from.options.length] = _option; |
---|
[3035] | 5005 | |
---|
[371] | 5006 | var options = ''; |
---|
[6447] | 5007 | var cn = ''; |
---|
[6263] | 5008 | for (var x = 0; x < data.length; x++) { |
---|
[5134] | 5009 | cn = typeof(data[x].cn[0] != 'undefined') ? data[x].cn[0] : ''; |
---|
[371] | 5010 | var _option = document.createElement("OPTION"); |
---|
[5134] | 5011 | _option.text = '"'+cn+'" <'+data[x].mail[0]+'>'; |
---|
| 5012 | _option.value = cn+';'+data[x].mail[0]+';'+data[x].save_shared[0]+';'+data[x].uid[0]; |
---|
[7043] | 5013 | /* Faz o tratamento do nome da pasta para fazer a verificaᅵᅵo e selecionar o valor no select */ |
---|
[6447] | 5014 | var str_begin_name = _option.text.indexOf('<') + 1; |
---|
| 5015 | var str_end_name = _option.text.indexOf('@'); |
---|
| 5016 | var user_selected_name = _option.text.substring(str_begin_name, str_end_name); |
---|
[7043] | 5017 | /* Verifica se ᅵ o usuᅵrio da pasta selecionada */ |
---|
[6447] | 5018 | if(user_selected_name == user_shared){ |
---|
| 5019 | _option.selected = 'selected'; |
---|
| 5020 | } |
---|
[371] | 5021 | sel_from.options[sel_from.options.length] = _option ; |
---|
[6263] | 5022 | } |
---|
[2] | 5023 | } |
---|
| 5024 | var shared_users_from = Element("el_shared_users"); |
---|
| 5025 | if(!shared_users_from) { |
---|
| 5026 | shared_users_from = sel_from.cloneNode(true); |
---|
| 5027 | shared_users_from.id = "el_shared_users"; |
---|
| 5028 | shared_users_from.style.display = 'none'; |
---|
| 5029 | document.body.appendChild(shared_users_from); |
---|
| 5030 | } |
---|
| 5031 | } |
---|
| 5032 | // First time, so execute..... |
---|
| 5033 | cExecute ("$this.ldap_functions.getSharedUsersFrom&uids="+sharedUsers.join(';'), h_user); |
---|
| 5034 | } |
---|
| 5035 | |
---|
| 5036 | function changeBgColorToON(all_messages, begin, end){ |
---|
[5134] | 5037 | var _tab_prefix = getTabPrefix(); |
---|
| 5038 | var _msg_id; |
---|
[163] | 5039 | for (begin; begin<=end; begin++) |
---|
| 5040 | { |
---|
[5134] | 5041 | _msg_id = getMessageIdFromRowId(all_messages[begin].id); |
---|
[163] | 5042 | add_className(all_messages[begin], 'selected_msg'); |
---|
[5134] | 5043 | Element(_tab_prefix + "check_box_message_" + _msg_id).checked = true; |
---|
[6930] | 5044 | updateSelectedMsgs(true,_msg_id); |
---|
[2] | 5045 | } |
---|
| 5046 | } |
---|
[4493] | 5047 | |
---|
[976] | 5048 | function updateBoxBgColor(box){ |
---|
| 5049 | // Set first TR Class |
---|
| 5050 | var _className = 'tr_msg_read2'; |
---|
[3035] | 5051 | for(var i = 0; i < box.length;i++){ |
---|
[976] | 5052 | if(exist_className(box[i],_className)) |
---|
| 5053 | remove_className(box[i], _className); |
---|
| 5054 | _className = (_className == 'tr_msg_read2' ? 'tr_msg_read' : 'tr_msg_read2'); |
---|
| 5055 | if(!exist_className(box[i],_className)) |
---|
| 5056 | add_className( box[i], _className); |
---|
| 5057 | } |
---|
| 5058 | } |
---|
[4802] | 5059 | function changeBgColor(event, msg_number) { |
---|
| 5060 | var _element_id = msg_number.toString(); |
---|
| 5061 | var first_order, last_order; |
---|
[2] | 5062 | |
---|
[4802] | 5063 | if (typeof(currentTab)!='number') { |
---|
| 5064 | _element_id = _element_id+'_s'+numBox; |
---|
| 5065 | } |
---|
| 5066 | actual_tr = Element(_element_id); |
---|
[2] | 5067 | |
---|
[163] | 5068 | if (event.shiftKey) |
---|
| 5069 | { |
---|
[4802] | 5070 | var last_tr = Element(last_message_selected); |
---|
[2] | 5071 | if(!last_tr) |
---|
| 5072 | last_tr = actual_tr; |
---|
| 5073 | |
---|
[4802] | 5074 | var all_messages = actual_tr.parentNode.childNodes; |
---|
[3035] | 5075 | |
---|
[163] | 5076 | for (var i=0; i < all_messages.length; i++) |
---|
| 5077 | { |
---|
| 5078 | if (actual_tr.id == all_messages[i].id) |
---|
[2] | 5079 | first_order = i; |
---|
[163] | 5080 | if (last_tr.id == all_messages[i].id) |
---|
[2] | 5081 | last_order = i; |
---|
| 5082 | } |
---|
[3035] | 5083 | |
---|
[163] | 5084 | if (parseInt(first_order) > parseInt(last_order)) |
---|
| 5085 | changeBgColorToON(all_messages, last_order, first_order); |
---|
| 5086 | else |
---|
| 5087 | changeBgColorToON(all_messages, first_order, last_order); |
---|
[5588] | 5088 | }else if(event.target != document.getElementById(getTabPrefix()+'check_box_message_' + msg_number)){ |
---|
| 5089 | if($(event.target).attr("checked") == "checked"){ |
---|
| 5090 | $(event.target).parents("tr:first").addClass("selected_msg"); |
---|
| 5091 | }else{ |
---|
| 5092 | $(event.target).parents("tr:first").removeClass("selected_msg"); |
---|
| 5093 | } |
---|
[2] | 5094 | } |
---|
| 5095 | else{ |
---|
[163] | 5096 | //if ( exist_className(actual_tr, 'selected_msg') ) |
---|
[5134] | 5097 | if ( document.getElementById(getTabPrefix()+'check_box_message_' + msg_number).checked ){ |
---|
| 5098 | if( document.getElementById("chk_box_select_all_messages").checked) { |
---|
| 5099 | add_className(actual_tr, 'selected_msg selected_shortcut_msg'); |
---|
| 5100 | }else |
---|
[163] | 5101 | add_className(actual_tr, 'selected_msg'); |
---|
[5134] | 5102 | }else{ |
---|
| 5103 | if( document.getElementById("chk_box_select_all_messages").checked){ |
---|
| 5104 | remove_className(actual_tr, 'selected_msg selected_shortcut_msg'); |
---|
| 5105 | remove_className(actual_tr, 'selected_msg'); |
---|
| 5106 | remove_chk_box_select_all_messages(); |
---|
| 5107 | if(actual_tr.className == 'selected_msg') |
---|
[163] | 5108 | remove_className(actual_tr, 'selected_msg'); |
---|
[5134] | 5109 | }else |
---|
| 5110 | remove_className(actual_tr, 'selected_msg'); |
---|
| 5111 | } |
---|
[2] | 5112 | } |
---|
[4802] | 5113 | last_message_selected = _element_id; |
---|
[2] | 5114 | } |
---|
| 5115 | |
---|
| 5116 | function build_quota(data){ |
---|
| 5117 | id = "content_quota"; |
---|
| 5118 | q_limit = data['quota_limit']; |
---|
| 5119 | var div = document.getElementById(id); |
---|
| 5120 | if(!q_limit){ |
---|
[3035] | 5121 | div.innerHTML = '<span><font size="2" style="color:red"><strong>'+get_lang("Without Quota")+'</strong></font></span>'; |
---|
[2] | 5122 | } |
---|
| 5123 | else{ |
---|
[5754] | 5124 | if(div) |
---|
| 5125 | div.innerHTML = ''; |
---|
| 5126 | value = data['quota_percent']; |
---|
| 5127 | q_used = data['quota_used']; |
---|
| 5128 | table = document.getElementById("table_quota"); |
---|
| 5129 | if(table) |
---|
| 5130 | table.parentNode.removeChild(table); |
---|
| 5131 | table = document.createElement("TABLE"); |
---|
| 5132 | tbody = document.createElement("TBODY"); |
---|
| 5133 | table.appendChild(tbody); |
---|
| 5134 | table.id = "table_quota"; |
---|
| 5135 | table.width="102"; |
---|
| 5136 | table.border="0"; |
---|
| 5137 | table.cellSpacing = 0; |
---|
| 5138 | table.cellPadding = 0; |
---|
[3035] | 5139 | |
---|
[5754] | 5140 | //tr1 = document.createElement("TR"); |
---|
| 5141 | td11 = document.createElement("TD"); |
---|
| 5142 | td11.align="center"; |
---|
| 5143 | td11.setAttribute("noWrap","true"); |
---|
| 5144 | 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>"; |
---|
| 5145 | //tr1.appendChild(td11); |
---|
[3035] | 5146 | |
---|
[5754] | 5147 | tr2 = document.createElement("TR"); |
---|
| 5148 | td22 = document.createElement("TD"); |
---|
[3035] | 5149 | |
---|
[5754] | 5150 | //td21.appendChild(table221); |
---|
| 5151 | //tr2.appendChild(td21); |
---|
| 5152 | tr2.appendChild(td11); |
---|
| 5153 | //tr2.appendChild(td1); |
---|
[4934] | 5154 | |
---|
[5754] | 5155 | tbody.appendChild(tr2); //Desenho |
---|
| 5156 | //tbody.appendChild(tr1); //Letras |
---|
| 5157 | div.appendChild(table); |
---|
| 5158 | $("#quota_progressbar").progressbar({ |
---|
| 5159 | value: value |
---|
| 5160 | }); |
---|
| 5161 | if(value > 90) { |
---|
| 5162 | if(value >= 100) |
---|
| 5163 | write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages.")); |
---|
| 5164 | else |
---|
| 5165 | write_msg(get_lang("Warning: Your Mailbox is almost full!")); |
---|
| 5166 | $("#quota_progressbar").find(".ui-progressbar-value").css({"background-image": "url(templates/default/images/dsalert.gif)", "border-color" : "red"}); |
---|
| 5167 | } |
---|
| 5168 | else if(value > 80) |
---|
| 5169 | $("#quota_progressbar").find(".ui-progressbar-value").css({"background-image": "url(templates/default/images/dswarn.gif)", "border-color" : "yellow"}); |
---|
[2] | 5170 | } |
---|
| 5171 | } |
---|
| 5172 | |
---|
| 5173 | function draw_quota(data){ |
---|
[5754] | 5174 | this.build_quota(data); |
---|
[2] | 5175 | } |
---|
| 5176 | |
---|
[345] | 5177 | function update_quota(folder_id){ |
---|
[5754] | 5178 | cExecute ("$this.imap_functions.get_quota&folder_id="+folder_id,this.build_quota); |
---|
[2] | 5179 | } |
---|
| 5180 | |
---|
| 5181 | function draw_search(headers_msgs){ |
---|
| 5182 | Element("border_id_0").innerHTML = " " + get_lang('Search Result') + " "; |
---|
| 5183 | |
---|
| 5184 | var tbody = Element('tbody_box'); |
---|
| 5185 | for (var i=0; i<(headers_msgs.length); i++){ |
---|
[7043] | 5186 | // passa parï¿œmetro offset |
---|
[2] | 5187 | var tr = this.make_tr_message(headers_msgs[i], headers_msgs[i].msg_folder); |
---|
[790] | 5188 | if (tr) |
---|
| 5189 | tbody.appendChild(tr); |
---|
[2] | 5190 | } |
---|
| 5191 | } |
---|
| 5192 | |
---|
| 5193 | function draw_search_header_box(){ |
---|
| 5194 | var table_message_header_box = Element("table_message_header_box"); |
---|
| 5195 | table_message_header_box.parentNode.removeChild(table_message_header_box); |
---|
| 5196 | |
---|
| 5197 | var content_id_0 = Element("content_id_0"); |
---|
| 5198 | var table_element = document.createElement("TABLE"); |
---|
| 5199 | var tbody_element = document.createElement("TBODY"); |
---|
| 5200 | table_element.setAttribute("id", "table_message_header_box"); |
---|
| 5201 | table_element.className = "table_message_header_box"; |
---|
| 5202 | tr_element = document.createElement("TR"); |
---|
| 5203 | tr_element.className = "message_header"; |
---|
| 5204 | td_element1 = document.createElement("TD"); |
---|
| 5205 | td_element1.setAttribute("width", "1%"); |
---|
| 5206 | chk_box_element = document.createElement("INPUT"); |
---|
| 5207 | chk_box_element.id = "chk_box_select_all_messages"; |
---|
| 5208 | chk_box_element.setAttribute("type", "checkbox"); |
---|
| 5209 | chk_box_element.className = "checkbox"; |
---|
| 5210 | chk_box_element.onclick = function(){select_all_messages(this.checked);}; |
---|
| 5211 | chk_box_element.onmouseover = function () {this.title=get_lang('Select all messages.')}; |
---|
| 5212 | chk_box_element.onkeydown = function (e){ |
---|
| 5213 | if (is_ie) |
---|
| 5214 | { |
---|
| 5215 | if ((window.event.keyCode) == 46) |
---|
| 5216 | { |
---|
| 5217 | //delete_all_selected_msgs_imap(); |
---|
[689] | 5218 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 5219 | } |
---|
| 5220 | } |
---|
| 5221 | else |
---|
| 5222 | { |
---|
| 5223 | if ((e.keyCode) == 46) |
---|
| 5224 | { |
---|
| 5225 | //delete_all_selected_msgs_imap(); |
---|
[689] | 5226 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 5227 | } |
---|
| 5228 | } |
---|
| 5229 | }; |
---|
[3035] | 5230 | |
---|
[2] | 5231 | td_element1.appendChild(chk_box_element); |
---|
| 5232 | td_element2 = document.createElement("TD"); |
---|
| 5233 | td_element2.setAttribute("width", "3%"); |
---|
| 5234 | td_element3 = document.createElement("TD"); |
---|
| 5235 | td_element3.setAttribute("width", "30%"); |
---|
| 5236 | td_element3.id = "message_header_SORTFROM"; |
---|
| 5237 | td_element3.align = "left"; |
---|
| 5238 | td_element3.innerHTML = get_lang("From"); |
---|
| 5239 | td_element4 = document.createElement("TD"); |
---|
| 5240 | td_element4.setAttribute("width", "49%"); |
---|
| 5241 | td_element4.id = "message_header_SORTSUBJECT"; |
---|
| 5242 | td_element4.align = "left"; |
---|
[3035] | 5243 | td_element4.innerHTML = get_lang("Subject"); |
---|
[2] | 5244 | td_element5 = document.createElement("TD"); |
---|
| 5245 | td_element5.setAttribute("width", "10%"); |
---|
| 5246 | td_element5.id = "message_header_SORTARRIVAL"; |
---|
| 5247 | td_element5.align = "center"; |
---|
[3035] | 5248 | td_element5.innerHTML = "<B>"+get_lang("Date")+"</B>"; |
---|
[790] | 5249 | td_element5.innerHTML += "<img src ='templates/"+template+"/images/arrow_descendant.gif'>"; |
---|
[2] | 5250 | td_element6 = document.createElement("TD"); |
---|
| 5251 | td_element6.setAttribute("width", "10%"); |
---|
| 5252 | td_element6.id = "message_header_SORTSIZE"; |
---|
| 5253 | td_element6.align = "right"; |
---|
| 5254 | td_element6.innerHTML = get_lang("Size"); |
---|
| 5255 | tr_element.appendChild(td_element1); |
---|
| 5256 | tr_element.appendChild(td_element2); |
---|
| 5257 | tr_element.appendChild(td_element3); |
---|
| 5258 | tr_element.appendChild(td_element4); |
---|
| 5259 | tr_element.appendChild(td_element5); |
---|
| 5260 | tr_element.appendChild(td_element6); |
---|
[3035] | 5261 | |
---|
[2] | 5262 | tbody_element.appendChild(tr_element); |
---|
| 5263 | table_element.appendChild(tbody_element); |
---|
| 5264 | content_id_0.appendChild(table_element); |
---|
| 5265 | } |
---|
| 5266 | |
---|
| 5267 | function draw_search_division(msg){ |
---|
| 5268 | var tbody = Element('tbody_box'); |
---|
| 5269 | var tr = document.createElement("TR"); |
---|
| 5270 | var td = document.createElement("TD"); |
---|
| 5271 | td.colSpan = '7'; |
---|
| 5272 | td.width = '100%'; |
---|
| 5273 | |
---|
| 5274 | var action_info_table = document.createElement("TABLE"); |
---|
| 5275 | var action_info_tbody = document.createElement("TBODY"); |
---|
[3035] | 5276 | |
---|
[2] | 5277 | action_info_table.className = "action_info_table"; |
---|
| 5278 | action_info_table.width = "100%"; |
---|
[3035] | 5279 | |
---|
[2] | 5280 | var action_info_tr = document.createElement("TR"); |
---|
[3035] | 5281 | |
---|
[2] | 5282 | var action_info_th1 = document.createElement("TH"); |
---|
| 5283 | action_info_th1.width = "40%"; |
---|
| 5284 | action_info_th1.innerHTML = " "; |
---|
| 5285 | |
---|
| 5286 | var action_info_th2 = document.createElement("TH"); |
---|
[3035] | 5287 | |
---|
[2] | 5288 | action_info_th2.innerHTML = msg; |
---|
| 5289 | action_info_th2.className = "action_info_th"; |
---|
| 5290 | action_info_th2.setAttribute("noWrap", "true"); |
---|
[3035] | 5291 | |
---|
[2] | 5292 | var action_info_th3 = document.createElement("TH"); |
---|
| 5293 | action_info_th3.width = "40%"; |
---|
| 5294 | action_info_th3.innerHTML = " "; |
---|
[3035] | 5295 | |
---|
[2] | 5296 | action_info_tr.appendChild(action_info_th1); |
---|
| 5297 | action_info_tr.appendChild(action_info_th2); |
---|
| 5298 | action_info_tr.appendChild(action_info_th3); |
---|
| 5299 | action_info_tbody.appendChild(action_info_tr); |
---|
| 5300 | action_info_table.appendChild(action_info_tbody); |
---|
| 5301 | |
---|
| 5302 | td.appendChild(action_info_table); |
---|
| 5303 | tr.appendChild(td); |
---|
| 5304 | tbody.appendChild(tr); |
---|
| 5305 | } |
---|
| 5306 | |
---|
| 5307 | function draw_search_box(){ |
---|
| 5308 | var content_id_0 = Element("content_id_0"); |
---|
| 5309 | var table = document.createElement("TABLE"); |
---|
| 5310 | table.id = "table_box"; |
---|
| 5311 | table.width = 'auto'; |
---|
| 5312 | var tbody = document.createElement("TBODY"); |
---|
| 5313 | tbody.id = "tbody_box"; |
---|
| 5314 | |
---|
| 5315 | table.className = "table_box"; |
---|
| 5316 | table.setAttribute("frame", "below"); |
---|
| 5317 | table.setAttribute("rules", "none"); |
---|
| 5318 | table.setAttribute("cellpadding", "0"); |
---|
| 5319 | table.onkeydown = function (e){ |
---|
| 5320 | if (is_ie) |
---|
| 5321 | { |
---|
| 5322 | if ((window.event.keyCode) == 46) |
---|
| 5323 | { |
---|
| 5324 | //delete_all_selected_msgs_imap(); |
---|
[689] | 5325 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 5326 | } |
---|
| 5327 | } |
---|
| 5328 | else |
---|
| 5329 | { |
---|
| 5330 | if ((e.keyCode) == 46) |
---|
| 5331 | { |
---|
| 5332 | //delete_all_selected_msgs_imap(); |
---|
[689] | 5333 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 5334 | } |
---|
| 5335 | } |
---|
| 5336 | }; |
---|
| 5337 | if (is_ie) |
---|
| 5338 | table.style.cursor = "hand"; |
---|
[3035] | 5339 | |
---|
[2] | 5340 | table.appendChild(tbody); |
---|
| 5341 | content_id_0.appendChild(table); |
---|
| 5342 | } |
---|
[4820] | 5343 | var idx_cc = 0; |
---|
[4493] | 5344 | |
---|
| 5345 | function draw_plugin_cc(ID, addrs){ |
---|
[2] | 5346 | connector.loadScript("ccQuickAdd"); |
---|
| 5347 | |
---|
| 5348 | var array_addrs = ''; |
---|
[3035] | 5349 | var array_name = ''; |
---|
[2] | 5350 | var cc_data = new Array(); |
---|
[3035] | 5351 | if(typeof(addrs.name) != 'undefined') { |
---|
[2] | 5352 | array_name = LTrim(addrs.name).split(" "); |
---|
[3035] | 5353 | array_addrs = new Array(addrs.email); |
---|
[2] | 5354 | } |
---|
| 5355 | else { |
---|
| 5356 | array_addrs = (typeof addrs == 'object' ? addrs.toString().split("\" ") : addrs.split("\" ")); |
---|
[3035] | 5357 | array_name = LTrim(array_addrs[0]).replace('"','').split(" "); |
---|
[2] | 5358 | } |
---|
| 5359 | |
---|
| 5360 | var _split = array_name[0].split('@'); |
---|
| 5361 | cc_data[0] = _split[0]; |
---|
| 5362 | cc_data[1] = _split[0]; |
---|
| 5363 | cc_data[2] = ''; |
---|
| 5364 | |
---|
| 5365 | for (i=1; i < array_name.length; i++) |
---|
[3035] | 5366 | cc_data[2] += array_name[i] + " "; |
---|
[2] | 5367 | |
---|
[3035] | 5368 | |
---|
| 5369 | if(array_addrs.length > 1) |
---|
| 5370 | cc_data[3] = array_addrs[1] ? array_addrs[1].replace("<",'').replace(">",'') : ''; |
---|
[2] | 5371 | else |
---|
| 5372 | cc_data[3] = array_addrs[0]; |
---|
[3035] | 5373 | |
---|
[6678] | 5374 | var onclick = ''; |
---|
| 5375 | $.each(cc_data, function(index, value){ |
---|
| 5376 | onclick += "'"+value+"',"; |
---|
| 5377 | }); |
---|
| 5378 | onclick = onclick.substr(0, onclick.length-1); |
---|
[106] | 5379 | var sm_envelope_img1 = '<img style="cursor:'+ (is_ie ? 'hand' : 'pointer') +'" title="' + get_lang("Add Contact") + |
---|
[6678] | 5380 | '" onclick="ccQuickAddOne.showList(['+onclick+'])" src="./templates/'+template+'/images/user_card.png">'; |
---|
[2] | 5381 | var to_addybook_add = "<SPAN id='insert_plugin_"+idx_cc+"_"+ID+"'>"; |
---|
| 5382 | to_addybook_add += addrs; |
---|
| 5383 | to_addybook_add += sm_envelope_img1; |
---|
| 5384 | idx_cc++; |
---|
| 5385 | to_addybook_add += "</SPAN>"; |
---|
| 5386 | return to_addybook_add; |
---|
| 5387 | } |
---|
[4493] | 5388 | |
---|
[2] | 5389 | function deny_email(email){ |
---|
| 5390 | connector.loadScript("filter"); |
---|
[375] | 5391 | connector.loadScript("filters"); |
---|
[2] | 5392 | var dn_em = document.createElement("SPAN"); |
---|
| 5393 | dn_em.id = "tt_d"; |
---|
[6265] | 5394 | dn_em.onclick = function(){block_user_email(email); /*filter.new_rule(email);*/}; |
---|
[106] | 5395 | dn_em.setAttribute("title",get_lang("Block Sender")); |
---|
[3035] | 5396 | dn_em.style.cursor = "pointer"; |
---|
[5630] | 5397 | dn_em.innerHTML = "<script src='../prototype/modules/filters/filters.js'></script><img align='top' src='./templates/"+template+"/images/deny.gif'>"; |
---|
[2] | 5398 | return dn_em; |
---|
[3035] | 5399 | |
---|
[2] | 5400 | } |
---|
[4493] | 5401 | |
---|
[13] | 5402 | function show_div_address_full(id, type) { |
---|
| 5403 | var div_address_full = Element("div_"+type+"address_full_"+id); |
---|
| 5404 | if(!div_address_full) { |
---|
| 5405 | div_address_full = document.createElement("SPAN"); |
---|
[3035] | 5406 | div_address_full.id = "div_"+type+"address_full_"+id; |
---|
| 5407 | div_address_full.style.display="none"; |
---|
[13] | 5408 | var _address = eval(type+"address_array['"+id+"']"); |
---|
| 5409 | var isOverLimit = (_address.length > 100); |
---|
[3035] | 5410 | |
---|
[2] | 5411 | if(isOverLimit) { |
---|
[7043] | 5412 | alert("Esse campo possui muitos endereï¿œos ("+_address.length+" destinatï¿œrios).\r\n"+ |
---|
| 5413 | "Para evitar o travamento do navegador, o botï¿œo 'Adicionar Contato' foi desabilitado!"); |
---|
[2] | 5414 | } |
---|
[13] | 5415 | |
---|
| 5416 | for(var idx = 1 ; idx < _address.length;idx++) { |
---|
| 5417 | div_address_full.innerHTML += isOverLimit ? '<br>'+_address[idx] : ','+draw_plugin_cc(id,_address[idx]); |
---|
[3035] | 5418 | } |
---|
[13] | 5419 | 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>)"; |
---|
| 5420 | Element(type+"_"+id).appendChild(div_address_full); |
---|
[2] | 5421 | } |
---|
[13] | 5422 | Element('div_'+type+'address_'+id).style.display='none'; |
---|
| 5423 | div_address_full.style.display=''; |
---|
[46] | 5424 | } |
---|
[4493] | 5425 | |
---|
[46] | 5426 | function draw_footer_box(num_msgs){ |
---|
[689] | 5427 | folder = get_current_folder(); |
---|
[3287] | 5428 | connector.loadScript('wfolders'); |
---|
[3035] | 5429 | var span_R = Element("table_message"); |
---|
| 5430 | var span_options = Element("span_options"); |
---|
[58] | 5431 | if(!span_options) { |
---|
[3035] | 5432 | span_options = document.createElement("TD"); |
---|
[58] | 5433 | span_options.style.fontSize = "12"; |
---|
| 5434 | span_options.id = "span_options"; |
---|
[59] | 5435 | span_R.appendChild(span_options); |
---|
| 5436 | } |
---|
[69] | 5437 | |
---|
[790] | 5438 | var change_font_color = 'onmouseover="var last_class = this.className;'+ |
---|
[848] | 5439 | 'if (this.className != \'message_options_over\')'+ |
---|
| 5440 | 'this.className=\'message_options_active\'; '+ |
---|
[790] | 5441 | 'this.onmouseout=function(){this.className=last_class;}"'; |
---|
| 5442 | |
---|
| 5443 | span_options.innerHTML = |
---|
| 5444 | '<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>'+ |
---|
| 5445 | '<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] | 5446 | ((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] | 5447 | // '<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] | 5448 | ((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] | 5449 | ((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] | 5450 | if(preferences.use_local_messages==1 && !expresso_offline) |
---|
[1000] | 5451 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
[5215] | 5452 | 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] | 5453 | else |
---|
[5215] | 5454 | 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] | 5455 | if (use_spam_filter) { |
---|
[790] | 5456 | if ( current_folder == 'INBOX'+cyrus_delimiter+'Spam' ) { |
---|
| 5457 | 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] | 5458 | } |
---|
| 5459 | else { |
---|
[790] | 5460 | 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] | 5461 | } |
---|
| 5462 | } |
---|
[3035] | 5463 | var span_D = Element("span_D"); |
---|
[58] | 5464 | if(!span_D){ |
---|
[3035] | 5465 | span_D = document.createElement("TD"); |
---|
[58] | 5466 | span_D.align = "right"; |
---|
| 5467 | span_D.style.fontSize = "12"; |
---|
| 5468 | span_D.id = "span_D"; |
---|
| 5469 | span_R.appendChild(span_D); |
---|
| 5470 | } |
---|
[3035] | 5471 | span_D.innerHTML = |
---|
[58] | 5472 | get_lang("List")+': '+ |
---|
[790] | 5473 | '<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>, '+ |
---|
| 5474 | '<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>, '+ |
---|
| 5475 | '<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] | 5476 | '<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] | 5477 | '<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] | 5478 | draw_paging(num_msgs); |
---|
[3035] | 5479 | Element("tot_m").innerHTML = num_msgs; |
---|
[1247] | 5480 | } |
---|