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