[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 | */ |
---|
| 10 | onceOpenedHeadersMessages = {}; |
---|
| 11 | |
---|
| 12 | var openTab = { |
---|
[607] | 13 | 'type' : [], // 8 types of tabs, further info. see expressolivre.org/dev/wiki/mail/Documentacao |
---|
[320] | 14 | 'content_id' : [], |
---|
[607] | 15 | 'imapUid' : [], // Stores the imap email number of current tab |
---|
| 16 | 'countFile' : [0,0,0,0,0,0,0,0,0,0], // Stores the number of files attached in current tab |
---|
| 17 | 'imapBox' : [], // Stores the folder name |
---|
[646] | 18 | 'toPreserve' : [], // Check if the message should be removed from draft after send |
---|
[4821] | 19 | 'condition' : [] // Will store the search condition if the tab is the result of a search |
---|
[607] | 20 | }; |
---|
[5459] | 21 | |
---|
| 22 | var autoSaveControl = { |
---|
| 23 | 'timer' : [], // The timeout timer for autosave function |
---|
| 24 | 'status' : [] // The status autosave |
---|
| 25 | }; |
---|
| 26 | |
---|
[607] | 27 | var tabTypes = { |
---|
| 28 | 'new':4, |
---|
| 29 | 'forward':6, |
---|
| 30 | 'reply_with_history':7, |
---|
[3143] | 31 | 'reply_to_all_with_history':8, |
---|
| 32 | 'reply_without_history':9, |
---|
| 33 | 'reply_to_all_without_history':10, |
---|
[607] | 34 | 'edit':5 |
---|
[5459] | 35 | }; |
---|
[5302] | 36 | |
---|
[607] | 37 | var currentTab,numBox = 0; // Open Tab and num of mailboxes opened at context |
---|
[1747] | 38 | // Objeto Map, talvez o ideal fosse adicionar este objeto à Api do egroupware, e carregá-lo |
---|
| 39 | // aqui no expressoMail. |
---|
| 40 | |
---|
[2] | 41 | function draw_tree_folders(folders){ |
---|
| 42 | // Check if the tree folders alredy exist. |
---|
[51] | 43 | if (Element('dftree_tree_folders')){ |
---|
[1121] | 44 | if (!expresso_offline) { |
---|
| 45 | var update_tree_folders = function(data){ |
---|
[5754] | 46 | draw_quota(data); |
---|
[1121] | 47 | var unseen_in_mailbox = 0; |
---|
| 48 | var unseen_in_shared_folders = 0; |
---|
| 49 | for (var i=0; i<data.length; i++){ |
---|
| 50 | if ( data[i].folder_unseen > 0 ) |
---|
| 51 | { |
---|
| 52 | unseen_in_mailbox = parseInt( unseen_in_mailbox + data[ i ].folder_unseen ); |
---|
| 53 | if ( data[i].folder_id.indexOf( 'INBOX' ) !== 0 ) |
---|
| 54 | unseen_in_shared_folders = parseInt( unseen_in_shared_folders + data[ i ].folder_unseen ); |
---|
| 55 | } |
---|
[3035] | 56 | |
---|
[1121] | 57 | var folder_unseen = Element('dftree_'+data[i].folder_id+'_unseen'); |
---|
[3035] | 58 | |
---|
[1121] | 59 | if ((folder_unseen) && (data[i].folder_unseen > 0)) |
---|
| 60 | { |
---|
| 61 | folder_unseen.innerHTML = data[i].folder_unseen; |
---|
| 62 | } |
---|
| 63 | else if (data[i].folder_unseen > 0) |
---|
| 64 | { |
---|
| 65 | 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>'}); |
---|
| 66 | tree_folders.getNodeById(data[i].folder_id)._refresh(); |
---|
| 67 | } |
---|
| 68 | else if (data[i].folder_unseen <= 0) |
---|
| 69 | { |
---|
[5134] | 70 | if(tree_folders.getNodeById(data[i].folder_id)){ |
---|
[1121] | 71 | tree_folders.getNodeById(data[i].folder_id).alter({caption:lang_folder(data[i].folder_name)}); |
---|
| 72 | tree_folders.getNodeById(data[i].folder_id)._refresh(); |
---|
| 73 | } |
---|
[5134] | 74 | } |
---|
[1121] | 75 | |
---|
[3035] | 76 | if(data[i].folder_id == current_folder){ |
---|
[1121] | 77 | var old_new_m = isNaN(parseInt(Element('new_m').innerHTML)) ? parseInt(Element('new_m').firstChild.innerHTML) : parseInt(Element('new_m').innerHTML); |
---|
| 78 | Element('new_m').innerHTML = data[i].folder_unseen ? '<font color="RED">'+data[i].folder_unseen+'</font>' : 0; |
---|
| 79 | draw_paging(Element('tot_m').innerHTML); |
---|
| 80 | } |
---|
[790] | 81 | } |
---|
| 82 | |
---|
[1121] | 83 | var display_unseen_in_mailbox = tree_folders.getNodeById( 'root' ); |
---|
[3035] | 84 | display_unseen_in_mailbox.alter({caption:get_lang("My Folders")}); |
---|
[1121] | 85 | display_unseen_in_mailbox._refresh(); |
---|
[3035] | 86 | |
---|
[1121] | 87 | var display_unseen_in_shared_folders = tree_folders.getNodeById( 'user' ); |
---|
| 88 | if ( display_unseen_in_shared_folders ) |
---|
[2] | 89 | { |
---|
[1121] | 90 | if ( unseen_in_shared_folders ) |
---|
| 91 | 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")}); |
---|
| 92 | else |
---|
| 93 | display_unseen_in_shared_folders.alter({caption:get_lang("Shared folders")}); |
---|
| 94 | display_unseen_in_shared_folders._refresh(); |
---|
[2] | 95 | } |
---|
| 96 | } |
---|
[1121] | 97 | cExecute ("$this.imap_functions.get_folders_list&folder="+current_folder, update_tree_folders); |
---|
[2] | 98 | } |
---|
[3035] | 99 | |
---|
[2] | 100 | return; |
---|
| 101 | } |
---|
| 102 | else{ |
---|
[1121] | 103 | if (!expresso_offline) { |
---|
| 104 | tree_folders = new dFTree({name: 'tree_folders'}); |
---|
[3035] | 105 | |
---|
[1121] | 106 | var n_root = new dNode({id:'root', caption: get_lang("My Folders")}); |
---|
| 107 | tree_folders.add(n_root,'anything'); //Places the root; second argument can be anything. |
---|
[3035] | 108 | |
---|
[1121] | 109 | var unseen_in_mailbox = 0; |
---|
| 110 | var unseen_in_shared_folders = 0; |
---|
| 111 | for (var i=0; i<folders.length; i++){ |
---|
| 112 | if (folders[i].folder_unseen > 0) |
---|
| 113 | { |
---|
| 114 | unseen_in_mailbox = parseInt( unseen_in_mailbox + folders[ i ].folder_unseen ); |
---|
| 115 | if ( folders[i].folder_id.indexOf( 'INBOX' ) !== 0 ) |
---|
| 116 | unseen_in_shared_folders = parseInt( unseen_in_shared_folders + folders[ i ].folder_unseen ); |
---|
[790] | 117 | |
---|
[3035] | 118 | 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}); |
---|
| 119 | |
---|
[1121] | 120 | if( folders[i].folder_name.toLowerCase() == 'inbox' ) |
---|
| 121 | Element('new_m').innerHTML = '<font style="color:red">' + folders[i].folder_unseen + '</font>'; |
---|
[2] | 122 | } |
---|
[1121] | 123 | else |
---|
[3035] | 124 | 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}); |
---|
| 125 | |
---|
[1121] | 126 | if (folders[i].folder_parent == '') |
---|
| 127 | folders[i].folder_parent = 'root'; |
---|
[3035] | 128 | else if (folders[i].folder_parent == 'user'){ |
---|
| 129 | |
---|
[1121] | 130 | if (!tree_folders.getNodeById('user')){ |
---|
[4738] | 131 | tmpFolderId = folders[i].folder_id.split(cyrus_delimiter).pop(); |
---|
[3035] | 132 | var n_root_shared_folders = new dNode({id:'user', caption:get_lang("Shared folders"), plusSign:true}); |
---|
[1121] | 133 | tree_folders.add(n_root_shared_folders,'root'); |
---|
| 134 | } |
---|
| 135 | } |
---|
| 136 | tree_folders.add(nn,folders[i].folder_parent); |
---|
[2] | 137 | } |
---|
| 138 | } |
---|
[3178] | 139 | |
---|
| 140 | |
---|
| 141 | |
---|
| 142 | var handlerChannel = function(data){ |
---|
[3183] | 143 | if (data == null || typeof(data) == 'string') |
---|
[3178] | 144 | return; |
---|
| 145 | /* |
---|
| 146 | * RSS NEWS |
---|
| 147 | */ |
---|
| 148 | var root_rss = new dNode({ |
---|
| 149 | id: "news_root", |
---|
| 150 | caption: get_lang('News') |
---|
| 151 | }); |
---|
| 152 | tree_folders.add(root_rss, "root"); |
---|
| 153 | for(i=0; i < data.length; i++) |
---|
| 154 | { |
---|
| 155 | var nodeNews = new dNode({ |
---|
| 156 | id: "NEWS/"+data[i].name, |
---|
| 157 | caption: data[i].name, |
---|
| 158 | onClick: "open_rss('"+data[i].rss_url+"')", |
---|
| 159 | plusSign: 0 |
---|
| 160 | }); |
---|
| 161 | tree_folders.add(nodeNews,"news_root"); |
---|
| 162 | } |
---|
| 163 | var noden=document.getElementById('lnews_roottree_folders'); |
---|
| 164 | noden.style.backgroundImage="url(templates/"+template+"/images/menu/rss.png)"; |
---|
[5533] | 165 | |
---|
| 166 | |
---|
| 167 | |
---|
[3178] | 168 | } |
---|
[3267] | 169 | // cExecute('$this.rss.getChannels',handlerChannel); |
---|
[3178] | 170 | |
---|
| 171 | |
---|
[689] | 172 | /** |
---|
| 173 | * Pastas locais |
---|
| 174 | */ |
---|
[1121] | 175 | if (preferences.use_local_messages==1 || expresso_offline) { |
---|
[5134] | 176 | //verifica se gears esta installado ou o offline |
---|
| 177 | if( (!window.google || !google.gears) && |
---|
| 178 | !expresso_local_messages.installGears() ){ |
---|
| 179 | preferences.use_local_messages = 0; |
---|
[689] | 180 | } |
---|
[5134] | 181 | else if( !expresso_local_messages.is_offline_installed() ) |
---|
| 182 | preferences.use_local_messages = 0; |
---|
[689] | 183 | else{ |
---|
[3035] | 184 | if (expresso_offline) |
---|
[1701] | 185 | tree_folders = new dFTree({ |
---|
| 186 | name: 'tree_folders' |
---|
| 187 | }); |
---|
| 188 | var root_local = new dNode({ |
---|
| 189 | id: "local_root", |
---|
| 190 | caption: get_lang('local folders') |
---|
| 191 | }); |
---|
| 192 | tree_folders.add(root_local, "root"); //coloca root local |
---|
| 193 | var local_folders = expresso_local_messages.list_local_folders(); |
---|
| 194 | for (var i in local_folders) { //Coloca as pastas locais. |
---|
| 195 | var node_root = "local_root"; |
---|
| 196 | var new_caption = local_folders[i][0]; |
---|
| 197 | if (local_folders[i][0].indexOf("/") != "-1") { |
---|
| 198 | final_pos = local_folders[i][0].lastIndexOf("/"); |
---|
| 199 | node_root = "local_" + local_folders[i][0].substr(0, final_pos); |
---|
| 200 | new_caption = local_folders[i][0].substr(final_pos + 1); |
---|
| 201 | } |
---|
[3035] | 202 | if (local_folders[i][1] > 0) |
---|
[1701] | 203 | var nodeLocal = new dNode({ |
---|
| 204 | id: "local_" + local_folders[i][0], |
---|
| 205 | 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>', |
---|
| 206 | onClick: "change_folder('local_" + local_folders[i][0] + "','" + new_caption + "')", |
---|
| 207 | plusSign: local_folders[i][2] |
---|
[689] | 208 | }); |
---|
[3035] | 209 | else |
---|
[1701] | 210 | var nodeLocal = new dNode({ |
---|
| 211 | id: "local_" + local_folders[i][0], |
---|
| 212 | caption: lang_folder(new_caption), |
---|
| 213 | onClick: "change_folder('local_" + local_folders[i][0] + "','" + new_caption + "')", |
---|
| 214 | plusSign: local_folders[i][2] |
---|
| 215 | }); |
---|
[1518] | 216 | tree_folders.add(nodeLocal, node_root); |
---|
| 217 | } |
---|
[689] | 218 | } |
---|
[3035] | 219 | } |
---|
[5584] | 220 | |
---|
| 221 | /*tree_folders.draw(Element('content_folders')); |
---|
[1121] | 222 | if (!expresso_offline) { |
---|
[5134] | 223 | n_root.changeState(); |
---|
| 224 | tree_folders.getNodeById('INBOX')._select(); |
---|
[1121] | 225 | } |
---|
| 226 | else { |
---|
| 227 | root_local.changeState(); |
---|
| 228 | tree_folders.getNodeById('local_Inbox')._select(); |
---|
[5584] | 229 | }*/ |
---|
| 230 | |
---|
[5306] | 231 | var trash_span = document.getElementById(mount_url_folder(["lINBOX",special_folders["Trash"]]) + 'tree_folders'); |
---|
[5533] | 232 | var draft_span = document.getElementById(mount_url_folder(["lINBOX",special_folders["Drafts"]]) + 'tree_folders'); |
---|
| 233 | var sent_span = document.getElementById(mount_url_folder(["lINBOX",special_folders["Sent"]]) + 'tree_folders'); |
---|
| 234 | var spam_span = document.getElementById(mount_url_folder(["lINBOX",special_folders["Spam"]]) + 'tree_folders'); |
---|
[3287] | 235 | //local folders |
---|
[5306] | 236 | var sent_local_conf = this.preferences.save_in_folder.replace(mount_url_folder(["INBOX",""]),"local_"); |
---|
[3287] | 237 | var sent_local_conf_span=document.getElementById('l'+sent_local_conf+'tree_folders'); |
---|
[5211] | 238 | var trash_local_span=document.getElementById('llocal_'+special_folders['Trash']+'tree_folders'); |
---|
| 239 | var draft_local_span=document.getElementById('llocal_'+special_folders['Drafts']+'tree_folders'); |
---|
| 240 | var sent_span_default=document.getElementById('llocal_'+special_folders['Sent']+'tree_folders'); |
---|
[790] | 241 | |
---|
[3287] | 242 | |
---|
[790] | 243 | if (trash_span) |
---|
| 244 | trash_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_trash.png)"; |
---|
| 245 | |
---|
| 246 | if (draft_span) |
---|
| 247 | draft_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_draft.png)" |
---|
| 248 | |
---|
| 249 | if (sent_span) |
---|
| 250 | sent_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_sent.png)"; |
---|
| 251 | if (spam_span) |
---|
| 252 | spam_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_spam.png)"; |
---|
| 253 | |
---|
[3287] | 254 | if (sent_span_default) |
---|
| 255 | sent_span_default.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_sent.png)"; |
---|
| 256 | //Local folders |
---|
[1121] | 257 | |
---|
[3287] | 258 | if (sent_local_conf_span) |
---|
| 259 | sent_local_conf_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_sent.png)"; |
---|
| 260 | if (trash_local_span) |
---|
| 261 | trash_local_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_trash.png)"; |
---|
| 262 | if (draft_local_span) |
---|
| 263 | draft_local_span.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_draft.png)" |
---|
| 264 | if (sent_span_default) |
---|
| 265 | sent_span_default.style.backgroundImage="url(../phpgwapi/templates/"+template+"/images/foldertree_sent.png)"; |
---|
| 266 | |
---|
| 267 | |
---|
[2] | 268 | draw_paging(Element('tot_m').innerHTML); |
---|
[5306] | 269 | if(document.getElementById(mount_url_folder(["nINBOX",special_folders["Trash"]])+"tree_folders")) |
---|
[1752] | 270 | { |
---|
| 271 | var trash = document.createElement("SPAN"); |
---|
| 272 | trash.id = 'empty_trash'; |
---|
[1965] | 273 | trash.className = 'clean_folder'; |
---|
[1752] | 274 | trash.style.cursor = 'pointer'; |
---|
| 275 | trash.onclick = function () {empty_trash_imap();}; |
---|
| 276 | trash.innerHTML = "["+get_lang("Clean")+"]"; |
---|
[1965] | 277 | trash.title=get_lang("Empty trash"); |
---|
[1752] | 278 | trash.onmouseover = function() {trash.style.color="red";}; |
---|
[1965] | 279 | trash.onmouseout= function() {trash.style.color="#666666";}; |
---|
[5306] | 280 | document.getElementById(mount_url_folder(["nINBOX",special_folders["Trash"]])+"tree_folders").appendChild(trash); |
---|
[1752] | 281 | } |
---|
[5306] | 282 | if(document.getElementById(mount_url_folder(["nINBOX",special_folders["Spam"]])+"tree_folders")) |
---|
[1965] | 283 | { |
---|
[3035] | 284 | var spam = document.createElement("SPAN"); |
---|
| 285 | spam.id = 'empty_spam'; |
---|
| 286 | spam.className = 'clean_folder'; |
---|
| 287 | spam.style.cursor = 'pointer'; |
---|
| 288 | spam.style.padding = '0 0 0 6px'; |
---|
| 289 | spam.onclick = function () {empty_spam_imap();}; |
---|
| 290 | spam.innerHTML = "["+get_lang("Clean")+"]"; |
---|
| 291 | spam.title=get_lang("Empty Spam Folder"); |
---|
| 292 | spam.onmouseover = function() {spam.style.color="red";}; |
---|
| 293 | spam.onmouseout= function() {spam.style.color="#666666";}; |
---|
[5306] | 294 | document.getElementById(mount_url_folder(["nINBOX",special_folders["Spam"]])+"tree_folders").appendChild(spam); |
---|
[3035] | 295 | } |
---|
[1752] | 296 | |
---|
[1121] | 297 | if(!expresso_offline) |
---|
| 298 | var display_unseen_in_mailbox = tree_folders.getNodeById( 'root' ); |
---|
| 299 | else |
---|
| 300 | var display_unseen_in_mailbox = tree_folders.getNodeById( 'local_root' ); |
---|
[3035] | 301 | display_unseen_in_mailbox.alter({caption:get_lang("My Folders")}); |
---|
[790] | 302 | display_unseen_in_mailbox._refresh(); |
---|
| 303 | |
---|
| 304 | var display_unseen_in_shared_folders = tree_folders.getNodeById( 'user' ); |
---|
| 305 | if ( display_unseen_in_shared_folders ) |
---|
| 306 | { |
---|
| 307 | if ( unseen_in_shared_folders ) |
---|
| 308 | 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")}); |
---|
| 309 | else |
---|
| 310 | display_unseen_in_shared_folders.alter({caption:get_lang("Shared folders")}); |
---|
| 311 | display_unseen_in_shared_folders._refresh(); |
---|
| 312 | } |
---|
[2] | 313 | } |
---|
[790] | 314 | |
---|
[1121] | 315 | if (!expresso_offline) { |
---|
| 316 | var folder_create = ""; |
---|
| 317 | var nm1 = ""; |
---|
| 318 | if(tree_folders._folderPr.length > 0){ |
---|
| 319 | var nm_folder = ""; |
---|
| 320 | for(var i=0; i < tree_folders._folderPr.length; i++){ |
---|
| 321 | nm_folder = tree_folders._folderPr[i].split(cyrus_delimiter); |
---|
| 322 | if(nm_folder[0] == "INBOX"){ |
---|
| 323 | if(nm1 == ""){ |
---|
[2] | 324 | nm1 = nm_folder[1]; |
---|
[1121] | 325 | folder_create = "INBOX" + cyrus_delimiter + nm_folder[1] + ";"; |
---|
| 326 | }else{ |
---|
| 327 | if( nm1 != nm_folder[1]){ |
---|
| 328 | folder_create += "INBOX" + cyrus_delimiter + nm_folder[1] + ";"; |
---|
| 329 | nm1 = nm_folder[1]; |
---|
| 330 | } |
---|
[2] | 331 | } |
---|
| 332 | } |
---|
| 333 | } |
---|
| 334 | } |
---|
| 335 | } |
---|
[5950] | 336 | |
---|
| 337 | outOfficeVerify(); |
---|
[5533] | 338 | } |
---|
[3178] | 339 | |
---|
[5533] | 340 | function draw_tree_labels(){ |
---|
| 341 | labels = DataLayer.get('label',{criteria:{order: 'name'}}); |
---|
[5566] | 342 | if(!$("#MyMarckersList").length) |
---|
| 343 | var myLabels = $('#content_folders').append("<div id='MyMarckersList' class='acc-list list-label' ></div>").find("#MyMarckersList"); |
---|
| 344 | else |
---|
| 345 | var myLabels = $("#MyMarckersList"); |
---|
| 346 | myLabels.html("<div class='my-labels'>" + |
---|
[5533] | 347 | "<img src='../prototype/modules/mail/img/tag.png'/>" + |
---|
[5584] | 348 | "<a class='title-my-labels' tabindex='0' role='button' aria-expanded='false' title='"+get_lang("My Labels")+"'>"+get_lang("My Labels")+"</a>" + |
---|
[5533] | 349 | |
---|
| 350 | "<span class='status-list-labels ui-icon ui-icon-triangle-1-s'></span>" + |
---|
| 351 | "</div>" |
---|
| 352 | ) |
---|
| 353 | .append(DataLayer.render("../prototype/modules/mail/templates/label_list.ejs", {labels: labels} )) |
---|
[5612] | 354 | .find("li.label-item").css({"background-color":"#ffffff", "border-color":"#CCCCCC", "color":"#444444"}).click(function(event,ui){ |
---|
[5623] | 355 | if($(event.target).is('.square-color')){ |
---|
| 356 | $(this).each(function(){ |
---|
| 357 | configureLabels({selectedItem: $(this).attr('class').match(/label-item-([\d]+[()a-zA-Z]*)/)[1]}); |
---|
| 358 | var id_label_item = $(this).attr('class').match(/label-item-([\d]+[()a-zA-Z]*)/)[1]; |
---|
| 359 | $(".label-list-container .label-list").find(".label-item-"+id_label_item).trigger("click"); |
---|
| 360 | }); |
---|
| 361 | } else { |
---|
| 362 | var labelId = $(this).attr('class').match(/label-item-([\d]+[()a-zA-Z]*)/)[1]; |
---|
| 363 | search_emails("UNDELETED KEYWORD \"$Label"+labelId+"\""); |
---|
[5612] | 364 | } |
---|
[5624] | 365 | }).find(".square-color").css("display",""); |
---|
| 366 | |
---|
[5713] | 367 | $("#MyMarckersList a.title-my-labels").click(function() { |
---|
| 368 | if($("#MyMarckersList ul.label-list").css("display") == "none"){ |
---|
| 369 | $("#MyMarckersList ul.label-list").show(); |
---|
| 370 | }else{ |
---|
| 371 | $("#MyMarckersList ul.label-list").hide(); |
---|
| 372 | } |
---|
[5533] | 373 | $('#MyMarckersList .status-list-labels').toggleClass("ui-icon-triangle-1-s"); |
---|
[5713] | 374 | $('#MyMarckersList .status-list-labels').toggleClass("ui-icon-triangle-1-n"); |
---|
[5533] | 375 | }); |
---|
[5713] | 376 | |
---|
[5533] | 377 | if (!labels){ |
---|
[5713] | 378 | $(".my-labels").hide(); |
---|
[5533] | 379 | } |
---|
[2] | 380 | } |
---|
| 381 | |
---|
[1938] | 382 | function draw_tree_local_folders() { |
---|
| 383 | /** |
---|
| 384 | * Pastas locais |
---|
| 385 | */ |
---|
[4826] | 386 | if(preferences.use_local_messages==1 || expresso_offline) { |
---|
| 387 | var local_folders = expresso_local_messages.list_local_folders(); |
---|
| 388 | var has_changes = false; |
---|
| 389 | for (var i in local_folders) { //Coloca as pastas locais. |
---|
[3035] | 390 | |
---|
[4826] | 391 | var new_caption = local_folders[i][0]; |
---|
| 392 | if(local_folders[i][0].indexOf("/")!="-1") { |
---|
| 393 | final_pos = local_folders[i][0].lastIndexOf("/"); |
---|
| 394 | new_caption = local_folders[i][0].substr(final_pos+1); |
---|
| 395 | } |
---|
[3035] | 396 | |
---|
[4826] | 397 | var folder_unseen = Element('dftree_local_'+local_folders[i][0]+'_unseen'); |
---|
[3035] | 398 | |
---|
[4826] | 399 | if ((folder_unseen) && (local_folders[i][1] > 0)) |
---|
| 400 | { |
---|
| 401 | folder_unseen.innerHTML = local_folders[i][1]; |
---|
| 402 | has_changes = true; |
---|
| 403 | } |
---|
| 404 | else if (local_folders[i][1] > 0) |
---|
| 405 | { |
---|
| 406 | 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>'}); |
---|
| 407 | tree_folders.getNodeById("local_"+local_folders[i][0])._refresh(); |
---|
| 408 | has_changes = true; |
---|
| 409 | } |
---|
| 410 | else if (local_folders[i][1] <= 0) |
---|
| 411 | { |
---|
| 412 | tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(new_caption)}); |
---|
| 413 | tree_folders.getNodeById("local_"+local_folders[i][0])._refresh(); |
---|
| 414 | has_changes = true; |
---|
| 415 | } |
---|
[1938] | 416 | |
---|
[3035] | 417 | if("local_"+local_folders[i][0] == get_current_folder()){ |
---|
[4826] | 418 | var old_new_m = isNaN(parseInt(Element('new_m').innerHTML)) ? parseInt(Element('new_m').firstChild.innerHTML) : parseInt(Element('new_m').innerHTML); |
---|
| 419 | if(!isNaN(old_new_m) && old_new_m < local_folders[i][1]){ |
---|
| 420 | Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) + (parseInt(local_folders[i][1])-old_new_m); |
---|
| 421 | } |
---|
| 422 | Element('new_m').innerHTML = local_folders[i][1] ? '<font color="RED">'+local_folders[i][1]+'</font>' : 0; |
---|
| 423 | draw_paging(Element('tot_m').innerHTML); |
---|
| 424 | has_changes = true; |
---|
[1938] | 425 | } |
---|
| 426 | } |
---|
[4826] | 427 | if(has_changes) |
---|
| 428 | tree_folders.getNodeById("local_root").open(); |
---|
| 429 | } |
---|
| 430 | } |
---|
[1938] | 431 | |
---|
[4826] | 432 | |
---|
| 433 | function update_local_box(){ |
---|
| 434 | msg_range_end = (current_page*preferences.max_email_per_page); |
---|
| 435 | msg_range_begin = (msg_range_end-(preferences.max_email_per_page)+1); |
---|
| 436 | folder=get_current_folder(); |
---|
| 437 | 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); |
---|
| 438 | alternate_border(0); |
---|
| 439 | draw_box(msgs, folder, true); |
---|
| 440 | draw_paging(msgs.num_msgs); |
---|
| 441 | Element("tot_m").innerHTML = msgs.num_msgs; |
---|
| 442 | update_menu(); |
---|
[1938] | 443 | } |
---|
| 444 | |
---|
[2] | 445 | function update_menu(data){ |
---|
[446] | 446 | /* |
---|
| 447 | * @AUTHOR Rodrigo Souza dos Santos |
---|
| 448 | * @DATE 2008/09/15 |
---|
| 449 | * @BRIEF When occurs a error in imap server show the message that is in file "error.html". |
---|
| 450 | */ |
---|
| 451 | if ( data && data.imap_error ) |
---|
| 452 | { |
---|
[1964] | 453 | if(preferences.use_local_messages==1 && expresso_local_messages.is_offline_installed){ |
---|
| 454 | 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?")); |
---|
| 455 | if(conf) { |
---|
| 456 | window.onresize = function() { |
---|
| 457 | var target = document.getElementById('divAppbox'); |
---|
| 458 | target.style.height= document.body.clientHeight - 83; |
---|
| 459 | } |
---|
| 460 | var target = document.getElementById('divAppbox'); |
---|
| 461 | document.getElementById("divAppboxHeader").innerHTML=""; |
---|
| 462 | target.style.height= document.body.clientHeight - 83; |
---|
| 463 | expresso_local_messages.set_as_logged(account_id,0,true); |
---|
| 464 | target.innerHTML = "<iframe src='offline.php?inside=1' width='100%' height='100%' frameBorder='0'></iframe>"; |
---|
| 465 | return false; |
---|
| 466 | } |
---|
| 467 | } |
---|
[790] | 468 | connector.newRequest('error.html', 'templates/'+template+'/error.html', 'GET', |
---|
[446] | 469 | function(data) |
---|
| 470 | { |
---|
| 471 | var target = document.getElementById('divAppbox'); |
---|
| 472 | if ( target ) |
---|
| 473 | target.innerHTML = data; |
---|
| 474 | } |
---|
| 475 | ); |
---|
| 476 | return false; |
---|
| 477 | } |
---|
[5486] | 478 | |
---|
| 479 | |
---|
[2] | 480 | if(data) { |
---|
[5486] | 481 | draw_tree_folders(data); |
---|
[5754] | 482 | draw_quota(data); |
---|
[790] | 483 | var f_unseen = Element('dftree_'+current_folder+'_unseen'); |
---|
[2] | 484 | if(f_unseen && f_unseen.innerHTML) |
---|
| 485 | Element('new_m').innerHTML = '<font face="Verdana" size="1" color="RED">'+f_unseen.innerHTML+'</font>'; |
---|
| 486 | else |
---|
[320] | 487 | { |
---|
| 488 | if( parseInt(Element('new_m').innerHTML) == 0 ) |
---|
[3035] | 489 | Element('new_m').innerHTML = 0; |
---|
[320] | 490 | } |
---|
[2] | 491 | folders = data; |
---|
| 492 | } |
---|
[5486] | 493 | draw_new_tree_folder(); |
---|
[5533] | 494 | draw_tree_labels(); |
---|
[5754] | 495 | if(Element("table_quota")) |
---|
| 496 | connector.loadScript("InfoQuota"); |
---|
[5821] | 497 | |
---|
| 498 | if(preferences.enable_quickadd_telephonenumber) |
---|
| 499 | connector.loadScript("QuickAddTelephone"); |
---|
[2] | 500 | } |
---|
| 501 | |
---|
| 502 | var handler_draw_box = function(data){ |
---|
[320] | 503 | draw_box(data, 'INBOX', true); |
---|
| 504 | //alternate_border(0); |
---|
[2] | 505 | } |
---|
| 506 | |
---|
| 507 | // Action on change folders. |
---|
| 508 | function change_folder(folder, folder_name){ |
---|
[607] | 509 | if (openTab.imapBox[0] != folder) |
---|
[2] | 510 | { |
---|
| 511 | current_folder = folder; |
---|
| 512 | var handler_draw_box = function(data) |
---|
| 513 | { |
---|
| 514 | if(!verify_session(data)) |
---|
| 515 | return; |
---|
[320] | 516 | alternate_border(0); |
---|
[5431] | 517 | var title = lang_folder(folder_name); |
---|
[5443] | 518 | if (title.length > 18) title = title.substring(0,18) + "..."; |
---|
[5431] | 519 | 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] | 520 | draw_box(data, folder, true); |
---|
[2] | 521 | draw_paging(data.num_msgs); |
---|
| 522 | Element("tot_m").innerHTML = data.num_msgs; |
---|
[5486] | 523 | $("#new_m").html(($(".selected").find(".folder_unseen").html() != "0" && $(".selected").find(".folder_unseen").html() != null)? $(".selected").find(".folder_unseen").html() : "0").css("color", "red"); |
---|
| 524 | //update_menu(); |
---|
[5754] | 525 | $(".folders-loading").removeClass("folders-loading"); |
---|
[320] | 526 | return true; |
---|
[2] | 527 | } |
---|
[1752] | 528 | 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] | 529 | } |
---|
[5516] | 530 | else{ |
---|
[5754] | 531 | $(".folders-loading").removeClass("folders-loading"); |
---|
[320] | 532 | alternate_border(0); |
---|
[5516] | 533 | } |
---|
[320] | 534 | } |
---|
| 535 | |
---|
| 536 | function open_folder(folder, folder_name){ |
---|
[790] | 537 | if (current_folder!= folder) { |
---|
[320] | 538 | current_folder = folder; |
---|
[325] | 539 | var handler_draw_box = function(data){ |
---|
[345] | 540 | if(!verify_session(data)) |
---|
| 541 | return false; |
---|
| 542 | numBox++; |
---|
| 543 | create_border(folder_name,numBox.toString()); |
---|
| 544 | draw_box(data, current_folder, false); |
---|
| 545 | alternate_border(numBox); |
---|
| 546 | return true; |
---|
[320] | 547 | } |
---|
[345] | 548 | 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] | 549 | } |
---|
| 550 | else |
---|
[345] | 551 | alternate_border(numBox); |
---|
| 552 | return true; |
---|
[2] | 553 | } |
---|
| 554 | |
---|
| 555 | var lastPage = 1; |
---|
| 556 | var numPages = 5; |
---|
| 557 | var last_folder = 'INBOX'; |
---|
[3035] | 558 | function draw_paging(num_msgs){ |
---|
[2] | 559 | num_msgs = parseInt(num_msgs); |
---|
| 560 | total_pages = 1; |
---|
| 561 | |
---|
[790] | 562 | if(last_folder != current_folder){ |
---|
[2] | 563 | lastPage = 1; |
---|
| 564 | current_page = 1; |
---|
[790] | 565 | last_folder = current_folder; |
---|
[2] | 566 | } |
---|
| 567 | |
---|
[3035] | 568 | if(num_msgs > parseInt(preferences.max_email_per_page)) { |
---|
[2] | 569 | total_pages = parseInt(num_msgs/preferences.max_email_per_page); |
---|
| 570 | if((num_msgs/preferences.max_email_per_page) > total_pages) |
---|
[3035] | 571 | total_pages++; |
---|
[2] | 572 | } |
---|
| 573 | |
---|
| 574 | if(total_pages == 1) { |
---|
[3393] | 575 | if(span_paging = document.getElementById("span_paging")) { |
---|
[2] | 576 | span_paging.parentNode.removeChild(span_paging); |
---|
| 577 | } |
---|
| 578 | return; |
---|
| 579 | } |
---|
[3393] | 580 | span_paging = document.getElementById("span_paging"); |
---|
[2] | 581 | if(!span_paging){ |
---|
| 582 | span_paging = document.createElement("DIV"); |
---|
[3393] | 583 | span_paging.id = "span_paging"; |
---|
[1247] | 584 | span_paging.className = "boxHeaderText"; |
---|
[2] | 585 | span_paging.align="right"; |
---|
[3035] | 586 | document.getElementById("div_menu_c3").appendChild(span_paging); |
---|
[2] | 587 | } |
---|
[3035] | 588 | span_paging.style.width="100%"; |
---|
[2] | 589 | span_paging.innerHTML=""; |
---|
| 590 | msg_range_begin = 1; |
---|
| 591 | msg_range_end = preferences.max_email_per_page; |
---|
| 592 | if(current_page != 1) { |
---|
| 593 | lnk_page = document.createElement("A"); |
---|
[5134] | 594 | //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());});"); |
---|
| 595 | 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] | 596 | } |
---|
| 597 | else { |
---|
| 598 | lnk_page = document.createElement("SPAN"); |
---|
| 599 | } |
---|
| 600 | span_paging.appendChild(lnk_page); |
---|
| 601 | |
---|
| 602 | lnk_page.innerHTML = "<<"; |
---|
| 603 | lnk_page.title = get_lang("First"); |
---|
| 604 | span_paging.innerHTML += " "; |
---|
[3369] | 605 | |
---|
[2] | 606 | if(current_page == lastPage + numPages) |
---|
[3369] | 607 | lastPage = current_page - 1; |
---|
| 608 | else if((lastPage != 1 && lastPage == current_page) || current_page == total_pages) |
---|
[2] | 609 | lastPage = current_page - (numPages - 1); |
---|
| 610 | else if(current_page == 1) |
---|
| 611 | lastPage = 1; |
---|
| 612 | |
---|
| 613 | if(lastPage < 1) |
---|
| 614 | lastPage = 1; |
---|
| 615 | else if(lastPage > 1 && (lastPage > (total_pages -(numPages - 1)))) |
---|
| 616 | lastPage = total_pages -(numPages - 1); |
---|
| 617 | |
---|
| 618 | var hasMarked = false; |
---|
| 619 | |
---|
| 620 | for(i = lastPage; i <= total_pages; i++) { |
---|
[3369] | 621 | |
---|
| 622 | if(current_page == i || (i == total_pages && !hasMarked)) { |
---|
[5285] | 623 | lnk_page = document.createElement("SPAN"); |
---|
[2] | 624 | span_paging.appendChild(lnk_page); |
---|
[5285] | 625 | lnk_page.style.color = "red"; |
---|
[2] | 626 | lnk_page.innerHTML = " <b>"+i+"</b> "; |
---|
| 627 | hasMarked = true; |
---|
| 628 | continue; |
---|
| 629 | } |
---|
[3369] | 630 | else{ |
---|
[2] | 631 | lnk_page = document.createElement("A"); |
---|
| 632 | span_paging.appendChild(lnk_page); |
---|
| 633 | msg_range_begin = ((i*preferences.max_email_per_page)-(preferences.max_email_per_page-1)); |
---|
| 634 | msg_range_end = (i*preferences.max_email_per_page); |
---|
[5134] | 635 | //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());});"); |
---|
| 636 | 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] | 637 | } |
---|
| 638 | lnk_page.innerHTML = " ... "; |
---|
| 639 | if(i == (lastPage + numPages)) |
---|
[3035] | 640 | break; |
---|
| 641 | else if(lastPage == 1 || i != lastPage) |
---|
[2] | 642 | lnk_page.innerHTML = " "+i+" "; |
---|
[3369] | 643 | span_paging.innerHTML += " "; |
---|
[2] | 644 | } |
---|
[3035] | 645 | |
---|
[2] | 646 | if(current_page != total_pages) { |
---|
| 647 | lnk_page = document.createElement("A"); |
---|
| 648 | msg_range_begin = ((total_pages*preferences.max_email_per_page)-(preferences.max_email_per_page-1)); |
---|
[3369] | 649 | msg_range_end = (total_pages*preferences.max_email_per_page); |
---|
[5134] | 650 | //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());});"); |
---|
| 651 | 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] | 652 | } |
---|
| 653 | else { |
---|
| 654 | lnk_page = document.createElement("SPAN"); |
---|
| 655 | } |
---|
| 656 | span_paging.innerHTML += " "; |
---|
| 657 | span_paging.appendChild(lnk_page); |
---|
| 658 | |
---|
| 659 | lnk_page.title = get_lang("Last"); |
---|
| 660 | lnk_page.innerHTML = ">>"; |
---|
| 661 | } |
---|
| 662 | |
---|
[4062] | 663 | // stores the percentages of the cells |
---|
[5410] | 664 | //var colSizes = [ ["24","24","12","12","12","16","16","20%","58%","11%","11%"], ["16","16","12","12","12","20%","20%","*","10%","10%"] ]; |
---|
[5533] | 665 | //var colSizes = [ ["2%","2%","1%","1%","1%","1%","2%","2%","20%","46%","11%","11%"], ["16","16","12","12","12","20%","20%","*","10%","10%"] ]; |
---|
[5753] | 666 | 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] | 667 | // stores the alignments of the cells |
---|
| 668 | var colAligns = [ ['','','','','','','','left','left','center','center'], ['','','','','','left','left','left','center','center'] ]; |
---|
| 669 | var objCell = null; |
---|
| 670 | var adjCell = null; |
---|
| 671 | var cellClick = null; |
---|
| 672 | var cellResized = false; |
---|
| 673 | var maxWidth=0; |
---|
[4080] | 674 | var minWidth=0; |
---|
[4062] | 675 | var bodyWidth=0; |
---|
[4072] | 676 | var cssForResizing=false; |
---|
[2] | 677 | |
---|
[4062] | 678 | function changeCursorState(ev) { |
---|
| 679 | if (cellResized) |
---|
| 680 | cellResized = false; |
---|
| 681 | var el = ev.target||ev.srcElement; |
---|
| 682 | if (el.tagName != "TD") |
---|
| 683 | el=getFirstParentOfType(el, "TD") |
---|
| 684 | el.style.cursor ="hand"; |
---|
| 685 | el.style.cursor ="pointer"; |
---|
[4072] | 686 | if (!cssForResizing) |
---|
| 687 | return; |
---|
[4062] | 688 | var cellMouseX = (ev.clientX-parseInt(getColumnPosition(el, ev))); |
---|
| 689 | var cellWidth = el.offsetWidth; |
---|
| 690 | var tbl = getFirstParentOfType(el,"TABLE"); |
---|
| 691 | if (tbl.emptyBody) |
---|
| 692 | return; |
---|
[4461] | 693 | if ((((cellWidth-cellMouseX)<15)||((el.style.cursor=="col-resize")&&(detectLeftButton())))&&((el.className=="th_resizable")&&(el.cellIndex+1<el.parentNode.cells.length))){ |
---|
| 694 | if (tbl) tbl.style.cursor = "col-resize"; |
---|
| 695 | el.style.cursor ="col-resize"; |
---|
[4062] | 696 | } |
---|
| 697 | else{ |
---|
| 698 | if (tbl) tbl.style.cursor = "pointer"; |
---|
| 699 | el.style.cursor ="hand"; |
---|
| 700 | el.style.cursor ="pointer"; |
---|
| 701 | } |
---|
| 702 | } |
---|
| 703 | |
---|
[4493] | 704 | function getStyle(el,styleProp) { |
---|
[4072] | 705 | var x = document.getElementById(el); |
---|
| 706 | if (x.currentStyle) |
---|
| 707 | var y = x.currentStyle[styleProp]; |
---|
| 708 | else if (window.getComputedStyle) |
---|
| 709 | var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp); |
---|
| 710 | return y; |
---|
| 711 | } |
---|
| 712 | |
---|
[4062] | 713 | function resizeColumn(ev) { |
---|
| 714 | if (!objCell || !adjCell) { |
---|
| 715 | stopColResize(ev); |
---|
| 716 | return; |
---|
| 717 | } |
---|
| 718 | if (document.getElementById("table_message_header_box_"+numBox).emptyBody) |
---|
| 719 | return; |
---|
[4461] | 720 | if (objCell.style.cursor == "col-resize" && detectLeftButton(ev)) { |
---|
[4062] | 721 | var cellIndex = objCell.cellIndex; |
---|
| 722 | var adjIndex = adjCell.cellIndex; |
---|
[4080] | 723 | var cellOffset = parseInt(getColumnPosition(objCell, ev)); |
---|
| 724 | var cellWidth = (ev.clientX-cellOffset); |
---|
[4062] | 725 | |
---|
| 726 | var tbl = getMessagesTable(objCell); |
---|
| 727 | var trM = tbl.rows; |
---|
| 728 | var tblType = ( (tbl.id=="table_box") ? 0 : 1); |
---|
| 729 | |
---|
[4080] | 730 | if (cellWidth < minWidth) |
---|
| 731 | cellWidth = minWidth; |
---|
[4062] | 732 | var adjWidth = maxWidth - cellWidth; |
---|
[4080] | 733 | if (adjWidth < minWidth) { |
---|
| 734 | cellWidth = (cellWidth+adjWidth)-minWidth; |
---|
| 735 | adjWidth = minWidth; |
---|
[4062] | 736 | } |
---|
| 737 | |
---|
| 738 | colSizes[tblType][adjIndex] = (colSizes[tblType][adjIndex]=="*" ? "*" : getPct(is_ie ? adjWidth : adjWidth-2)); |
---|
| 739 | colSizes[tblType][cellIndex] = (colSizes[tblType][cellIndex]=="*" ? "*" : getPct(cellWidth)); |
---|
| 740 | |
---|
[4080] | 741 | document.getElementById("table_message_ruler").style.left = cellOffset+cellWidth; |
---|
[4062] | 742 | } |
---|
| 743 | ev.returnValue = false; |
---|
| 744 | return (false); |
---|
| 745 | } |
---|
| 746 | |
---|
| 747 | function getPct(tdWidth) { |
---|
| 748 | var suf = tdWidth.toString().substr(tdWidth.length-1,1); |
---|
| 749 | if ( suf != "%" && suf != "*") |
---|
| 750 | return (Math.round((tdWidth/bodyWidth)*10000)/100).toString()+"%"; |
---|
| 751 | else |
---|
| 752 | return tdWidth; |
---|
| 753 | } |
---|
| 754 | |
---|
| 755 | function detectLeftButton(ev) { |
---|
| 756 | ev = ev || window.event; |
---|
| 757 | var button = ev.which || ev.button; |
---|
| 758 | return (button == 1); |
---|
| 759 | } |
---|
| 760 | |
---|
| 761 | function startColResize(ev) { |
---|
| 762 | var el = ev.target||ev.srcElement; |
---|
| 763 | if (el.tagName != "TD") |
---|
| 764 | el=getFirstParentOfType(el, "TD") |
---|
| 765 | if (is_ie) |
---|
| 766 | ev.cancelBubble = true; |
---|
| 767 | else |
---|
| 768 | ev.stopPropagation(); |
---|
| 769 | if (!el) return; |
---|
| 770 | if (!is_ie) ev.preventDefault(); |
---|
| 771 | if (document.getElementById("table_message_header_box_"+numBox).emptyBody) |
---|
| 772 | return; |
---|
[4461] | 773 | if (el.style.cursor == "col-resize" && detectLeftButton(ev)) { |
---|
[4062] | 774 | var incIndex = ( (el.parentNode.cells.length > el.cellIndex + 1) ? 1 : -1 ); |
---|
| 775 | var msgTable = getMessagesTable(el); |
---|
| 776 | var bodyRows = msgTable.rows; |
---|
| 777 | objCell = el; |
---|
| 778 | adjCell = el.parentNode.cells[el.cellIndex+incIndex]; |
---|
| 779 | var tbl = getFirstParentOfType(el, "TABLE"); |
---|
| 780 | if (is_ie) { |
---|
| 781 | tbl.detachEvent("onmousemove",changeCursorState); |
---|
| 782 | document.attachEvent("onmousemove",resizeColumn); |
---|
| 783 | document.attachEvent("onmouseup",stopColResize); |
---|
| 784 | document.attachEvent("onselect",selectCancel); |
---|
| 785 | tbl.attachEvent("onselectstart",selectCancel); |
---|
| 786 | } |
---|
| 787 | else { |
---|
| 788 | tbl.removeEventListener("mousemove",changeCursorState,false); |
---|
| 789 | document.addEventListener("mousemove",resizeColumn,false); |
---|
| 790 | document.addEventListener("mouseup",stopColResize,false); |
---|
| 791 | document.addEventListener("select",selectCancel,false); |
---|
| 792 | tbl.addEventListener("selectstart",selectCancel,false); |
---|
| 793 | } |
---|
| 794 | cellClick = objCell.onclick; |
---|
| 795 | objCell.onclick = ""; |
---|
| 796 | maxWidth = objCell.offsetWidth+adjCell.offsetWidth; |
---|
| 797 | bodyWidth = msgTable.offsetWidth; |
---|
[4080] | 798 | minWidth = Math.round(bodyWidth/80); |
---|
[4062] | 799 | document.getElementById("table_message_ruler").style.display = "block"; |
---|
| 800 | document.getElementById("table_message_ruler").style.left = ev.clientX; |
---|
| 801 | if (document.getElementById("content_id_"+numBox)==null) |
---|
[4807] | 802 | document.getElementById("table_message_ruler").style.height = document.getElementById("content_id_"+currentTab).offsetHeight; |
---|
[4062] | 803 | else |
---|
| 804 | document.getElementById("table_message_ruler").style.height = document.getElementById("content_id_"+numBox).offsetHeight; |
---|
| 805 | } |
---|
| 806 | } |
---|
| 807 | |
---|
| 808 | function stopColResize(ev) { |
---|
| 809 | if (!objCell) |
---|
| 810 | return; |
---|
| 811 | if (is_ie) |
---|
| 812 | ev.cancelBubble = true; |
---|
| 813 | else |
---|
| 814 | ev.stopPropagation(); |
---|
| 815 | var tbl = getFirstParentOfType(objCell, "TABLE"); |
---|
| 816 | if (is_ie) { |
---|
| 817 | tbl.detachEvent("onselectstart",selectCancel); |
---|
| 818 | document.detachEvent("onselect",selectCancel); |
---|
| 819 | document.detachEvent("onmousemove",resizeColumn); |
---|
| 820 | document.detachEvent("onmouseup",stopColResize); |
---|
| 821 | tbl.attachEvent("onmousemove",changeCursorState); |
---|
| 822 | } |
---|
| 823 | else { |
---|
| 824 | tbl.removeEventListener("selectstart",selectCancel,false); |
---|
| 825 | document.removeEventListener("select",selectCancel,false); |
---|
| 826 | document.removeEventListener("mousemove",resizeColumn,false); |
---|
| 827 | document.removeEventListener("mouseup",stopColResize,false); |
---|
| 828 | tbl.addEventListener("mousemove",changeCursorState,false); |
---|
| 829 | } |
---|
| 830 | var trM = getMessagesTable(objCell).rows; |
---|
| 831 | var adjIndex = adjCell.cellIndex; |
---|
| 832 | document.getElementById("table_message_ruler").style.display = "none"; |
---|
| 833 | maxWidth = 0; |
---|
| 834 | objCell.onclick = cellClick; |
---|
| 835 | objCell = null; |
---|
| 836 | adjCell = null; |
---|
| 837 | cellResized = true; |
---|
[4072] | 838 | setColSizesCookie(); |
---|
| 839 | syncColumns(); |
---|
[4062] | 840 | } |
---|
| 841 | |
---|
| 842 | function getMessagesTable(el) { |
---|
| 843 | var hT; |
---|
| 844 | if (el.tagName == "TABLE") |
---|
| 845 | hT = el; |
---|
| 846 | else |
---|
| 847 | hT = getFirstParentOfType(el,"TABLE"); |
---|
[5134] | 848 | return (hT.parentNode.nextSibling.childNodes[0].className !== "local-messages-search-warning"? |
---|
| 849 | hT.parentNode.nextSibling.childNodes[0] : hT.parentNode.nextSibling.childNodes[1]); |
---|
[4062] | 850 | } |
---|
| 851 | |
---|
| 852 | function getColumnPosition(oNode, pNode){ |
---|
| 853 | if (!pNode && !is_webkit){ |
---|
| 854 | var pos = getOffset(oNode); |
---|
| 855 | return [pos.left, pos.top]; |
---|
| 856 | } |
---|
| 857 | pNode = pNode||document.body; |
---|
| 858 | |
---|
| 859 | var oCurrentNode = oNode; |
---|
| 860 | var iLeft = 0; |
---|
| 861 | var iTop = 0; |
---|
| 862 | |
---|
| 863 | while ((oCurrentNode)&&(oCurrentNode != pNode)){ |
---|
| 864 | iLeft+=oCurrentNode.offsetLeft-oCurrentNode.scrollLeft; |
---|
| 865 | iTop+=oCurrentNode.offsetTop-oCurrentNode.scrollTop; |
---|
| 866 | oCurrentNode=oCurrentNode.offsetParent; |
---|
| 867 | } |
---|
| 868 | |
---|
| 869 | return [iLeft, iTop]; |
---|
| 870 | } |
---|
| 871 | |
---|
| 872 | function getFirstParentOfType(obj, tag){ |
---|
| 873 | while (obj&&obj.tagName != tag&&obj.tagName != "BODY"){ |
---|
| 874 | obj=obj.parentNode; |
---|
| 875 | } |
---|
| 876 | return obj; |
---|
| 877 | } |
---|
| 878 | |
---|
| 879 | function syncColumns() { |
---|
| 880 | var thisCell; |
---|
| 881 | var tbl = (document.getElementById("content_id_"+numBox)==null ? 1 : 0); |
---|
| 882 | if (objCell) |
---|
| 883 | thisCell = objCell; |
---|
| 884 | else |
---|
| 885 | thisCell = document.getElementById("table_message_header_box_"+numBox).rows[0].cells[0]; |
---|
[4189] | 886 | var emptyBody = document.getElementById("table_message_header_box_"+numBox).emptyBody; |
---|
[4062] | 887 | var tbH = getFirstParentOfType(thisCell,"TABLE"); |
---|
| 888 | var tbM = getMessagesTable(thisCell); |
---|
| 889 | var trM = tbM.rows; |
---|
[4813] | 890 | var _mouse_over; |
---|
| 891 | var _mouse_out; |
---|
| 892 | var _cell; |
---|
[4062] | 893 | for (var r=0;r<trM.length;r++) { |
---|
| 894 | for (var c=0;c<trM[r].cells.length;c++) { |
---|
[4813] | 895 | _cell = trM[r].cells[c]; |
---|
| 896 | _cell.setAttribute("width",colSizes[tbl][c]); |
---|
[4062] | 897 | if (is_mozilla && !is_webkit) { |
---|
[4810] | 898 | if (!emptyBody) { |
---|
[4813] | 899 | document.getElementById("colgroup_main_"+numBox).childNodes[c].setAttribute("width",colSizes[tbl][c]); |
---|
[4810] | 900 | } |
---|
[4080] | 901 | document.getElementById("colgroup_head_"+numBox).childNodes[c].setAttribute("width",colSizes[tbl][c]); |
---|
[4810] | 902 | if (tbH.rows[0].cells[c].className=="th_resizable") { |
---|
[4813] | 903 | // lots of stupid fixes for FF to redraw cell content |
---|
[4814] | 904 | if (_cell.childNodes && _cell.childNodes.length>1) { |
---|
[4813] | 905 | _mouse_over = _cell.childNodes[1].onmouseover; |
---|
| 906 | _mouse_out = _cell.childNodes[1].onmouseout; |
---|
| 907 | } |
---|
| 908 | _cell.innerHTML = trM[r].cells[c].innerHTML; |
---|
[4814] | 909 | if (_cell.childNodes && _cell.childNodes.length>1) { |
---|
[4813] | 910 | _cell.childNodes[1].onmouseover = _mouse_over; |
---|
| 911 | _cell.childNodes[1].onmouseout = _mouse_out; |
---|
| 912 | } |
---|
| 913 | tbH.rows[0].cells[c].innerHTML = tbH.rows[0].cells[c].innerHTML; |
---|
| 914 | } |
---|
[4062] | 915 | } |
---|
[4080] | 916 | else { |
---|
[4813] | 917 | tbH.rows[0].cells[c].setAttribute("width",_cell.offsetWidth); |
---|
[4062] | 918 | } |
---|
| 919 | } |
---|
| 920 | } |
---|
[6232] | 921 | |
---|
[5280] | 922 | //bug do firefox ao redefinir os tamanhos das colunas |
---|
[6232] | 923 | if (is_mozilla && !is_webkit){ |
---|
| 924 | if(trM[r]) |
---|
| 925 | for (var c=0;c<trM[r].cells.length;c++) |
---|
| 926 | document.getElementById("colgroup_main_"+numBox).childNodes[c].setAttribute("width",colSizes[tbl][c]); |
---|
| 927 | |
---|
| 928 | } |
---|
[4062] | 929 | } |
---|
| 930 | |
---|
| 931 | function resizeMailList() { |
---|
[4143] | 932 | if (document.getElementById("table_message_header_box_"+numBox)==null) |
---|
| 933 | return false; |
---|
[4062] | 934 | var innerWidth = (window.innerWidth?window.innerWidth:document.body.clientWidth); |
---|
| 935 | var scrollWidth = (innerWidth - 20 - getColumnPosition(Element("exmail_main_body"),"BODY")[0]); |
---|
| 936 | document.getElementById("table_message_header_box_"+numBox).style.width = (scrollWidth-2)+'px'; |
---|
| 937 | if (document.getElementById("table_resultsearch_"+numBox)==null) |
---|
| 938 | document.getElementById("table_box").style.width = scrollWidth+'px'; |
---|
| 939 | else |
---|
| 940 | document.getElementById("table_resultsearch_"+numBox).style.width = scrollWidth+'px'; |
---|
| 941 | syncColumns(); |
---|
[5725] | 942 | //Alinhamento das colunas data e tamanho na pesquisa |
---|
| 943 | if ( numBox > 0){ |
---|
| 944 | if (is_mozilla && !is_webkit){ |
---|
| 945 | $('#table_message_header_box_'+numBox).attr('style','width:99.5%'); |
---|
| 946 | } |
---|
| 947 | else if (is_webkit){ |
---|
| 948 | $('#table_message_header_box_'+numBox).removeAttr('style'); |
---|
| 949 | $('#table_message_header_box_'+numBox).css('table-layout','auto'); |
---|
| 950 | } |
---|
| 951 | else{ |
---|
| 952 | $('#table_message_header_box_'+numBox).css('table-layout','auto'); |
---|
| 953 | } |
---|
| 954 | } |
---|
| 955 | $('#table_resultsearch_'+numBox).removeAttr('style'); |
---|
[4062] | 956 | } |
---|
| 957 | |
---|
| 958 | function selectCancel(ev) { |
---|
| 959 | return (false); |
---|
| 960 | } |
---|
| 961 | |
---|
| 962 | function buildColGroup(tbl) { |
---|
| 963 | var col_element; |
---|
| 964 | var colgr_element = document.createElement("COLGROUP"); |
---|
| 965 | if (tbl==null) tbl = 0; |
---|
| 966 | for (i=0;i<colSizes[tbl].length;i++) { |
---|
| 967 | col_element = document.createElement("COL"); |
---|
| 968 | col_element.setAttribute("align", colAligns[tbl][i]); |
---|
| 969 | colgr_element.appendChild(col_element); |
---|
| 970 | } |
---|
| 971 | return (colgr_element); |
---|
| 972 | } |
---|
| 973 | |
---|
| 974 | function createTDElement(table_list,col_index,class_name,td_align,td_id) { |
---|
| 975 | var td_element = document.createElement("TD"); |
---|
| 976 | td_element.setAttribute("width",colSizes[table_list][col_index]); |
---|
| 977 | if (class_name) td_element.className = class_name; |
---|
| 978 | if (td_align) td_element.align = td_align; |
---|
| 979 | if (td_id) td_element.id = td_id; |
---|
| 980 | return (td_element); |
---|
| 981 | } |
---|
| 982 | |
---|
[4072] | 983 | function prepareColSizesArray() { |
---|
| 984 | var colSizesCookie = getColSizesCookie(); |
---|
| 985 | if (colSizesCookie) { |
---|
| 986 | try { |
---|
| 987 | var colSizesA = colSizesCookie.split(":"); |
---|
| 988 | colSizes = [colSizesA[0].split(","),colSizesA[1].split(",")]; |
---|
| 989 | } |
---|
| 990 | catch(e) {} |
---|
| 991 | } |
---|
| 992 | } |
---|
[4493] | 993 | |
---|
[4072] | 994 | function setColSizesCookie() { |
---|
| 995 | var str = "maillist_colsizes=" + colSizes[0].join() + ":" + colSizes[1].join(); |
---|
| 996 | var date = new Date(); |
---|
| 997 | date.setTime(date.getTime()+(365*24*60*60*1000)); |
---|
| 998 | str += ("; expires="+date.toGMTString()); |
---|
| 999 | document.cookie = str; |
---|
| 1000 | } |
---|
[4493] | 1001 | |
---|
[4072] | 1002 | function getColSizesCookie() { |
---|
| 1003 | var search = "maillist_colsizes="; |
---|
| 1004 | if (document.cookie.length > 0) { |
---|
| 1005 | var offset = document.cookie.indexOf(search); |
---|
| 1006 | if (offset != -1) { |
---|
| 1007 | offset += search.length; |
---|
| 1008 | var end = document.cookie.indexOf(";", offset); |
---|
| 1009 | if (end == -1) |
---|
| 1010 | end = document.cookie.length; |
---|
| 1011 | return document.cookie.substring(offset, end); |
---|
| 1012 | } |
---|
| 1013 | } |
---|
| 1014 | return null; |
---|
| 1015 | } |
---|
| 1016 | |
---|
[2] | 1017 | // Draw the inbox and another folders |
---|
[320] | 1018 | function draw_box(headers_msgs, msg_folder, alternate){ |
---|
[5533] | 1019 | /* |
---|
[4087] | 1020 | * When the paging response is not in the correct folder you need to change folder |
---|
| 1021 | * This occurs when the Ajax response is not fast enough and the user click in outher |
---|
| 1022 | * folder before finishing the Ajax request |
---|
| 1023 | */ |
---|
| 1024 | if (msg_folder != headers_msgs['folder']) { |
---|
| 1025 | |
---|
| 1026 | if (headers_msgs['folder']) { |
---|
| 1027 | array_folder = headers_msgs['folder'].split('/'); |
---|
| 1028 | |
---|
| 1029 | if (array_folder.length > 1) { |
---|
| 1030 | name_folder = array_folder[1]; |
---|
| 1031 | } |
---|
| 1032 | else { |
---|
| 1033 | name_folder = headers_msgs['folder']; |
---|
| 1034 | } |
---|
| 1035 | current_folder = headers_msgs['folder']; |
---|
| 1036 | 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>'; |
---|
| 1037 | |
---|
| 1038 | Element('new_m').innerHTML = headers_msgs['tot_unseen'] ? '<font color="RED">'+headers_msgs['tot_unseen']+'</font>' : 0; |
---|
| 1039 | Element("tot_m").innerHTML = headers_msgs['num_msgs']; |
---|
| 1040 | |
---|
| 1041 | tree_folders.getNodeById(headers_msgs['folder'])._select(); |
---|
| 1042 | } |
---|
| 1043 | } |
---|
[5533] | 1044 | /** |
---|
| 1045 | * Preenche a estrutura de cache de mensagens para posterior consulta de |
---|
| 1046 | * informações sobre as mensagens no escopo global. |
---|
| 1047 | */ |
---|
| 1048 | for (var i=0; i<headers_msgs.length; i++) { |
---|
| 1049 | if (!onceOpenedHeadersMessages[current_folder]) |
---|
| 1050 | onceOpenedHeadersMessages[current_folder] = {}; |
---|
| 1051 | onceOpenedHeadersMessages[current_folder][headers_msgs[i].msg_number] = headers_msgs[i]; |
---|
| 1052 | } |
---|
| 1053 | |
---|
[320] | 1054 | if (alternate) |
---|
| 1055 | kill_current_box(); |
---|
[3035] | 1056 | |
---|
[2] | 1057 | if(is_ie) |
---|
| 1058 | document.getElementById("border_table").width = "99.5%"; |
---|
| 1059 | |
---|
[5134] | 1060 | numBox = 0; //As pastas sempre estarão na aba 0 |
---|
| 1061 | |
---|
[3035] | 1062 | openTab.content_id[numBox] = document.getElementById("content_id_"+numBox); |
---|
[3178] | 1063 | openTab.content_id[numBox].innerHTML = ""; |
---|
[607] | 1064 | openTab.imapBox[numBox] = msg_folder; |
---|
[790] | 1065 | openTab.type[numBox] = 0; |
---|
[3035] | 1066 | |
---|
[320] | 1067 | table_message_header_box = document.getElementById("table_message_header_box_"+numBox); |
---|
[4072] | 1068 | if (table_message_header_box == null) { |
---|
[2] | 1069 | var table_element = document.createElement("TABLE"); |
---|
[4062] | 1070 | var colgr_element = buildColGroup(); |
---|
| 1071 | colgr_element.setAttribute("id","colgroup_head_"+numBox); |
---|
[2] | 1072 | var tbody_element = document.createElement("TBODY"); |
---|
[4062] | 1073 | //add events for column resizing |
---|
| 1074 | if (is_ie) { |
---|
| 1075 | table_element.attachEvent("onmousemove",changeCursorState); |
---|
| 1076 | table_element.attachEvent("onmousedown",startColResize); |
---|
| 1077 | } |
---|
| 1078 | else { |
---|
| 1079 | table_element.addEventListener("mousemove",changeCursorState,false); |
---|
| 1080 | table_element.addEventListener("mousedown",startColResize,false); |
---|
| 1081 | } |
---|
[320] | 1082 | table_element.setAttribute("id", "table_message_header_box_"+numBox); |
---|
[2] | 1083 | table_element.className = "table_message_header_box"; |
---|
[4062] | 1084 | if (!is_ie) |
---|
| 1085 | table_element.style.width = "98.8%"; |
---|
| 1086 | //if table is empty |
---|
| 1087 | table_element.emptyBody = false; |
---|
[3035] | 1088 | |
---|
[2] | 1089 | tr_element = document.createElement("TR"); |
---|
| 1090 | tr_element.className = "message_header"; |
---|
[4062] | 1091 | |
---|
| 1092 | td_element1 = createTDElement(0,0); |
---|
[2] | 1093 | chk_box_element = document.createElement("INPUT"); |
---|
| 1094 | chk_box_element.id = "chk_box_select_all_messages"; |
---|
| 1095 | chk_box_element.setAttribute("type", "checkbox"); |
---|
| 1096 | chk_box_element.className = "checkbox"; |
---|
| 1097 | chk_box_element.onclick = function(){select_all_messages(this.checked);}; |
---|
[5587] | 1098 | chk_box_element.onmouseover = function () {this.title=get_lang('Select all messages from this page.')}; |
---|
[2] | 1099 | chk_box_element.onkeydown = function (e){ |
---|
| 1100 | if (is_ie) |
---|
| 1101 | { |
---|
| 1102 | if ((window.event.keyCode) == 46) |
---|
[689] | 1103 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1104 | } |
---|
| 1105 | else |
---|
| 1106 | { |
---|
| 1107 | if ((e.keyCode) == 46) |
---|
[689] | 1108 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1109 | } |
---|
| 1110 | }; |
---|
[3035] | 1111 | |
---|
[2] | 1112 | td_element1.appendChild(chk_box_element); |
---|
[3035] | 1113 | |
---|
[4062] | 1114 | td_element2 = createTDElement(0,1); |
---|
[5533] | 1115 | td_element3 = createTDElement(0,8,"th_resizable","left","message_header_SORTFROM_"+numBox); |
---|
[51] | 1116 | td_element3.onclick = function () {sort_box(search_box_type,'SORTFROM');}; |
---|
[4771] | 1117 | td_element3.innerHTML = get_lang("From"); |
---|
[3035] | 1118 | |
---|
[5533] | 1119 | td_element4 = createTDElement(0,9,"th_resizable","left","message_header_SORTSUBJECT_"+numBox); |
---|
[51] | 1120 | td_element4.onclick = function () {sort_box(search_box_type,'SORTSUBJECT');}; |
---|
[2] | 1121 | td_element4.innerHTML = get_lang("Subject"); |
---|
[3035] | 1122 | |
---|
[5533] | 1123 | td_element5 = createTDElement(0,10,"th_resizable","center","message_header_SORTARRIVAL_"+numBox); |
---|
[51] | 1124 | td_element5.onclick = function () {sort_box(search_box_type,'SORTARRIVAL');}; |
---|
[2] | 1125 | td_element5.innerHTML = get_lang("Date"); |
---|
[4062] | 1126 | |
---|
[5533] | 1127 | td_element6 = createTDElement(0,11,"th_resizable","left","message_header_SORTSIZE_"+numBox); |
---|
[51] | 1128 | td_element6.onclick = function () {sort_box(search_box_type,'SORTSIZE');} |
---|
[2] | 1129 | td_element6.innerHTML = get_lang("Size"); |
---|
[3035] | 1130 | |
---|
[2] | 1131 | tr_element.appendChild(td_element1); |
---|
[3035] | 1132 | tr_element.appendChild(td_element2); |
---|
[4062] | 1133 | |
---|
| 1134 | var td_element21 = createTDElement(0,2); |
---|
| 1135 | td_element21.innerHTML = " "; |
---|
| 1136 | |
---|
| 1137 | var td_element22 = createTDElement(0,3); |
---|
| 1138 | td_element22.innerHTML = " "; |
---|
| 1139 | |
---|
| 1140 | var td_element23 = createTDElement(0,4); |
---|
| 1141 | td_element23.innerHTML = " "; |
---|
| 1142 | |
---|
| 1143 | var td_element24 = createTDElement(0,5); |
---|
| 1144 | td_element24.innerHTML = " "; |
---|
[5533] | 1145 | |
---|
| 1146 | |
---|
| 1147 | var td_element25 = createTDElement(0,7); |
---|
[4062] | 1148 | td_element25.innerHTML = " "; |
---|
[5533] | 1149 | |
---|
| 1150 | var td_element27 = createTDElement(0,8); |
---|
| 1151 | td_element25.innerHTML = " "; |
---|
| 1152 | |
---|
| 1153 | var td_element26 = createTDElement(0,6); |
---|
| 1154 | td_element26.innerHTML = " "; |
---|
| 1155 | |
---|
[4062] | 1156 | |
---|
[998] | 1157 | tr_element.appendChild(td_element21); |
---|
| 1158 | tr_element.appendChild(td_element22); |
---|
| 1159 | tr_element.appendChild(td_element23); |
---|
[4062] | 1160 | tr_element.appendChild(td_element24); |
---|
[5533] | 1161 | tr_element.appendChild(td_element26); |
---|
| 1162 | tr_element.appendChild(td_element27); |
---|
[4062] | 1163 | tr_element.appendChild(td_element25); |
---|
[5533] | 1164 | |
---|
[2] | 1165 | tr_element.appendChild(td_element3); |
---|
| 1166 | tr_element.appendChild(td_element4); |
---|
| 1167 | tr_element.appendChild(td_element5); |
---|
| 1168 | tr_element.appendChild(td_element6); |
---|
[4062] | 1169 | |
---|
[2] | 1170 | tbody_element.appendChild(tr_element); |
---|
| 1171 | table_element.appendChild(tbody_element); |
---|
[4062] | 1172 | table_element.appendChild(colgr_element); |
---|
| 1173 | |
---|
| 1174 | var _divScroll = document.getElementById("divScrollHead_"+numBox); |
---|
| 1175 | |
---|
| 1176 | if(!_divScroll){ |
---|
| 1177 | _divScroll = document.createElement("DIV"); |
---|
| 1178 | _divScroll.id = "divScrollHead_"+numBox; |
---|
[4072] | 1179 | } |
---|
[4062] | 1180 | |
---|
| 1181 | _divScroll.style.overflowY = "hidden"; |
---|
| 1182 | _divScroll.style.overflowX = "hidden"; |
---|
| 1183 | _divScroll.style.width ="100%"; |
---|
| 1184 | |
---|
| 1185 | if (is_mozilla){ |
---|
| 1186 | _divScroll.style.width ="99.3%"; |
---|
| 1187 | } |
---|
| 1188 | |
---|
| 1189 | _divScroll.appendChild(table_element); |
---|
| 1190 | openTab.content_id[numBox].appendChild(_divScroll); |
---|
| 1191 | |
---|
[4109] | 1192 | var table_layout = (getStyle("table_message_header_box_"+numBox,"table-layout") || getStyle("table_message_header_box_"+numBox,"tableLayout")); |
---|
[4072] | 1193 | cssForResizing = (table_layout=="fixed"); |
---|
| 1194 | if (cssForResizing) |
---|
| 1195 | prepareColSizesArray(); |
---|
[4062] | 1196 | } |
---|
[2] | 1197 | draw_header_box(); |
---|
| 1198 | var table_element = document.createElement("TABLE"); |
---|
[4062] | 1199 | var colgr_element = buildColGroup(); |
---|
| 1200 | colgr_element.setAttribute("id","colgroup_main_"+numBox); |
---|
| 1201 | |
---|
[3035] | 1202 | var tbody_element = document.createElement("TBODY"); |
---|
[2] | 1203 | table_element.id = "table_box"; |
---|
| 1204 | table_element.className = "table_box"; |
---|
| 1205 | table_element.borderColorDark = "#bbbbbb"; |
---|
| 1206 | table_element.frame = "void"; |
---|
| 1207 | table_element.rules = "rows"; |
---|
| 1208 | table_element.cellPadding = "0"; |
---|
| 1209 | table_element.cellSpacing = "0"; |
---|
[3035] | 1210 | |
---|
[2] | 1211 | table_element.onkeydown = function (e){ |
---|
| 1212 | if (is_ie) |
---|
| 1213 | { |
---|
| 1214 | if ((window.event.keyCode) == 46) |
---|
| 1215 | { |
---|
| 1216 | //delete_all_selected_msgs_imap(); |
---|
[689] | 1217 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1218 | } |
---|
| 1219 | } |
---|
| 1220 | else |
---|
| 1221 | { |
---|
| 1222 | if ((e.keyCode) == 46) |
---|
| 1223 | { |
---|
| 1224 | //delete_all_selected_msgs_imap(); |
---|
[689] | 1225 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 1226 | } |
---|
| 1227 | } |
---|
| 1228 | }; |
---|
| 1229 | if (is_ie) |
---|
| 1230 | table_element.style.cursor = "hand"; |
---|
[3035] | 1231 | |
---|
[2] | 1232 | tbody_element.setAttribute("id", "tbody_box"); |
---|
| 1233 | table_element.appendChild(tbody_element); |
---|
[4062] | 1234 | table_element.appendChild(colgr_element); |
---|
[3035] | 1235 | |
---|
[320] | 1236 | var _divScroll = document.getElementById("divScrollMain_"+numBox); |
---|
| 1237 | |
---|
[3035] | 1238 | if(!_divScroll){ |
---|
[2] | 1239 | _divScroll = document.createElement("DIV"); |
---|
[320] | 1240 | _divScroll.id = "divScrollMain_"+numBox; |
---|
[2] | 1241 | } |
---|
[3035] | 1242 | |
---|
[4062] | 1243 | _divScroll.style.overflowY = "scroll"; |
---|
[790] | 1244 | _divScroll.style.overflowX = "hidden"; |
---|
| 1245 | _divScroll.style.width ="100%"; |
---|
[3035] | 1246 | |
---|
[790] | 1247 | if (is_mozilla){ |
---|
[2] | 1248 | _divScroll.style.overflow = "-moz-scrollbars-vertical"; |
---|
[4062] | 1249 | _divScroll.style.width ="100%"; |
---|
[2] | 1250 | } |
---|
| 1251 | _divScroll.appendChild(table_element); |
---|
[607] | 1252 | openTab.content_id[numBox].appendChild(_divScroll); |
---|
[3035] | 1253 | |
---|
[2] | 1254 | var f_unseen = 0; |
---|
[139] | 1255 | |
---|
[4062] | 1256 | document.getElementById("table_message_header_box_"+numBox).emptyBody = false; |
---|
[4189] | 1257 | |
---|
| 1258 | if (headers_msgs.num_msgs == 0) |
---|
| 1259 | showEmptyBoxMsg(tbody_element); |
---|
| 1260 | |
---|
[2] | 1261 | for (var i=0; i < headers_msgs.length; i++){ |
---|
| 1262 | if ((headers_msgs[i].Unseen == 'U') || (headers_msgs[i].Recent == 'N')) |
---|
[3035] | 1263 | f_unseen++; |
---|
[3493] | 1264 | tr_element = make_tr_message(headers_msgs[i], msg_folder, headers_msgs.offsetToGMT); |
---|
[976] | 1265 | if (tr_element){ |
---|
[790] | 1266 | tbody_element.appendChild(tr_element); |
---|
[3035] | 1267 | add_className(tr_element, i%2 != 0 ? 'tr_msg_read2' : 'tr_msg_read'); |
---|
[976] | 1268 | } |
---|
[5486] | 1269 | //_dragArea.makeDragged(tr_element, headers_msgs[i].msg_number, headers_msgs[i].subject, true); |
---|
| 1270 | $(tr_element).draggable({ |
---|
[5499] | 1271 | start : function(){ |
---|
| 1272 | if($(".shared-folders").length){ |
---|
| 1273 | $(".shared-folders").parent().find('.folder:not(".shared-folders")').droppable({ |
---|
| 1274 | over : function(a, b){ |
---|
| 1275 | //SETA BORDA EM VOLTA DA PASTA |
---|
[5765] | 1276 | over = $(this); |
---|
| 1277 | $(this).addClass("folder-over"); |
---|
| 1278 | if(($(this)[0] != $(this).parent().find(".head_folder")[0])) |
---|
| 1279 | if($(this).prev()[0]) |
---|
| 1280 | if($(this).parent().find(".expandable-hitarea")[0] == $(this).prev()[0]){ |
---|
| 1281 | setTimeout(function(){ |
---|
| 1282 | if(over.hasClass("folder-over")) |
---|
| 1283 | over.prev().trigger("click"); |
---|
| 1284 | }, 500); |
---|
| 1285 | |
---|
| 1286 | } |
---|
[5499] | 1287 | }, |
---|
| 1288 | out : function(){ |
---|
| 1289 | //RETIRA BORDA EM VOLTA DA PASTA |
---|
[5765] | 1290 | $(this).removeClass("folder-over"); |
---|
[5499] | 1291 | }, |
---|
| 1292 | //accept: ".draggin_mail", |
---|
| 1293 | drop : function(event, ui){ |
---|
| 1294 | $(this).css("border", ""); |
---|
| 1295 | if($(this).parent().attr('id') == undefined){ |
---|
| 1296 | var folder_to = 'INBOX'; |
---|
| 1297 | var to_folder_title = get_lang("Inbox"); |
---|
| 1298 | }else{ |
---|
| 1299 | var folder_to = $(this).parent().attr('id'); |
---|
| 1300 | var to_folder_title = $(this).attr('title'); |
---|
| 1301 | } |
---|
| 1302 | var folder_to_move = ui.draggable.parent().attr('id'); |
---|
| 1303 | var border_id = ui.draggable.find("input[type=hidden]").attr("name"); |
---|
| 1304 | // Mensagens : SE O DROP VIER DA LISTA DE MENSAGENS : |
---|
| 1305 | if(folder_to_move == "tbody_box"){ |
---|
| 1306 | move_msgs2(get_current_folder(), 'selected', 0, folder_to, to_folder_title,true); |
---|
| 1307 | return refresh(); |
---|
| 1308 | } |
---|
| 1309 | } |
---|
| 1310 | }); |
---|
| 1311 | } |
---|
| 1312 | }, |
---|
| 1313 | stop :function(){ |
---|
| 1314 | $(".shared-folders").parent().find(".folder").droppable("destroy"); |
---|
| 1315 | }, |
---|
[5754] | 1316 | //helper: 'clone', |
---|
| 1317 | helper: function(event){ |
---|
[5533] | 1318 | $(this).find("input:checkbox").attr("checked", true); |
---|
[6223] | 1319 | if ( $("#tbody_box .selected_shortcut_msg").length > 1) { |
---|
| 1320 | $("#tbody_box .selected_shortcut_msg").find('.checkbox').attr('checked',true); |
---|
| 1321 | } |
---|
| 1322 | if($("#table_box").find("tr input:checked").length > 1 ) |
---|
| 1323 | return $("<tr><td>"+DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : (($("#table_box").find("tr input:checked")).length+" mensagens selecionadas"), type: "messages"})+"</td></tr>"); |
---|
[5486] | 1324 | if( $(this).find(".td_msg_subject").text().length > 18 ) |
---|
[5754] | 1325 | 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] | 1326 | else |
---|
[5754] | 1327 | return $("<tr><td>"+DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : $(this).find(".td_msg_subject").text(), type: "messages"})+"</td></tr>"); |
---|
| 1328 | }, |
---|
| 1329 | iframeFix: true, |
---|
| 1330 | delay: 150, |
---|
[6265] | 1331 | cursorAt: {top: 5, left: 56}, |
---|
[5754] | 1332 | refreshPositions: true, |
---|
[5486] | 1333 | containment: "#divAppbox" |
---|
[5718] | 1334 | }).bind('contextmenu',function(event){ |
---|
[5841] | 1335 | if (!(($(event.target).find('img').length > 0) && ($(event.target).hasClass('td-label')))){ |
---|
| 1336 | if($(this).find("input:checkbox").attr("checked") != "checked"){ |
---|
| 1337 | $(this).find("input:checkbox").trigger('click'); |
---|
| 1338 | $(this).addClass("selected_msg"); |
---|
| 1339 | } |
---|
[5718] | 1340 | } |
---|
[5486] | 1341 | }); |
---|
[2] | 1342 | } |
---|
[3035] | 1343 | |
---|
[128] | 1344 | if ((preferences.use_shortcuts == '1') && (headers_msgs[0])) |
---|
[320] | 1345 | select_msg(headers_msgs[0].msg_number, 'null', true); |
---|
[5302] | 1346 | |
---|
[128] | 1347 | |
---|
[2] | 1348 | var tdFolders = Element("folderscol"); |
---|
| 1349 | tdFolders.style.display = preferences.hide_folders == '1' ? "none" : ""; |
---|
[790] | 1350 | if ( !currentTab ) |
---|
| 1351 | alternate_border(numBox); |
---|
[3035] | 1352 | draw_footer_box(headers_msgs.num_msgs); |
---|
[2] | 1353 | Element('main_table').style.display = ''; |
---|
[3035] | 1354 | if(is_ie6) // Stupid Fixing on IE6. |
---|
| 1355 | setTimeout("resizeWindow()",1); |
---|
| 1356 | else |
---|
| 1357 | resizeWindow(); |
---|
[2] | 1358 | if(debug) { |
---|
| 1359 | var _eTime = new Date(); |
---|
| 1360 | _eTime = _eTime.getTime(); |
---|
| 1361 | alert("Carregou em "+(_eTime - _bTime)+" ms"); |
---|
| 1362 | } |
---|
[5533] | 1363 | |
---|
[2] | 1364 | var msg_folder = Element('msg_folder').value; |
---|
[3035] | 1365 | var msg_number = Element('msg_number').value; |
---|
[2] | 1366 | if(!msg_folder && msg_number) { |
---|
| 1367 | new_message('new','null'); |
---|
| 1368 | } |
---|
| 1369 | else if(msg_folder && msg_number){ |
---|
[6275] | 1370 | $.ajax({ |
---|
| 1371 | url: 'controller.php?' + $.param( {action: '$this.imap_functions.get_info_msg', |
---|
| 1372 | msg_number: msg_number, |
---|
| 1373 | msg_folder: msg_folder, |
---|
| 1374 | decoded: true } ), |
---|
| 1375 | success: function( data ){ |
---|
| 1376 | data = connector.unserialize( data ); |
---|
| 1377 | |
---|
| 1378 | if( data ) |
---|
| 1379 | show_msg( data ); |
---|
[6469] | 1380 | }, |
---|
| 1381 | beforeSend: function( jqXHR, settings ){ |
---|
| 1382 | connector.showProgressBar(); |
---|
| 1383 | }, |
---|
| 1384 | complete: function( jqXHR, settings ){ |
---|
| 1385 | connector.hideProgressBar(); |
---|
[6275] | 1386 | } |
---|
| 1387 | |
---|
| 1388 | }); |
---|
[2] | 1389 | Element('msg_folder').value = ''; |
---|
| 1390 | Element('msg_number').value = ''; |
---|
| 1391 | } |
---|
[3068] | 1392 | var scripts = new Array("InfoContact", |
---|
[3220] | 1393 | "TreeShow"); |
---|
[3068] | 1394 | connector.loadAllScripts(scripts); |
---|
[3369] | 1395 | // Loading Quota View Folder Component (if exists...) |
---|
[3157] | 1396 | if(Element("table_quota")) |
---|
[3158] | 1397 | connector.loadScript("InfoQuota"); |
---|
[5533] | 1398 | |
---|
[4062] | 1399 | // creates the dotted ruler which helps user to visualize resizing of columns |
---|
| 1400 | var ruler_element = document.getElementById("table_message_ruler"); |
---|
| 1401 | if (ruler_element == null) { |
---|
| 1402 | ruler_element = document.createElement("DIV"); |
---|
| 1403 | ruler_element.setAttribute("id", "table_message_ruler"); |
---|
| 1404 | ruler_element.className = "table_message_ruler"; |
---|
| 1405 | ruler_element.style.top = getColumnPosition(document.getElementById("content_id_0"),"BODY")[1]; |
---|
| 1406 | document.getElementById("exmail_main_body").appendChild(ruler_element); |
---|
| 1407 | } |
---|
[5533] | 1408 | |
---|
[2] | 1409 | } |
---|
[790] | 1410 | |
---|
[4189] | 1411 | function showEmptyBoxMsg(tbody_element) { |
---|
| 1412 | document.getElementById("table_message_header_box_"+numBox).emptyBody = true; |
---|
[4752] | 1413 | var div_pasta = document.getElementById("div_msg_info"); |
---|
[4934] | 1414 | if (!div_pasta){ |
---|
[4752] | 1415 | div_info = document.createElement("div"); |
---|
| 1416 | div_info.setAttribute("id", "div_msg_info"); |
---|
| 1417 | div_info.setAttribute("background", "#FFF"); |
---|
| 1418 | h3_info = document.createElement("h3"); |
---|
| 1419 | h3_info.style.padding = "10px"; |
---|
| 1420 | h3_info.setAttribute("id", "msg_info"); |
---|
| 1421 | h3_info.align = "center"; |
---|
| 1422 | h3_info.innerHTML = get_lang("This mail box is empty"); |
---|
| 1423 | div_info.appendChild(h3_info); |
---|
| 1424 | tbody_element.parentNode.parentNode.appendChild(div_info); |
---|
| 1425 | } |
---|
[4189] | 1426 | } |
---|
| 1427 | |
---|
[6109] | 1428 | function html_entities(string) { |
---|
[6213] | 1429 | return String(string).replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); |
---|
[6109] | 1430 | } |
---|
| 1431 | |
---|
[3493] | 1432 | // Passar o parâmetro offset para esta função |
---|
| 1433 | function make_tr_message(headers_msgs, msg_folder, offsetToGMT){ |
---|
[6109] | 1434 | headers_msgs.subject = html_entities(headers_msgs.subject); |
---|
[5533] | 1435 | if (typeof offsetToGMT == 'undefined') |
---|
| 1436 | { |
---|
| 1437 | // In older local messages headers_msgs.offsetToGMT is undefined. |
---|
| 1438 | offsetToGMT = typeof headers_msgs.offsetToGMT != 'undefined'?headers_msgs.offsetToGMT:0; |
---|
| 1439 | } |
---|
[320] | 1440 | var tr_element = document.createElement('tr'); |
---|
[3069] | 1441 | if(typeof(preferences.line_height) != 'undefined') |
---|
| 1442 | tr_element.style.height = preferences.line_height; |
---|
[2] | 1443 | tr_element.id = headers_msgs.msg_number; |
---|
[163] | 1444 | |
---|
[1752] | 1445 | tr_element.msg_sample = ""; |
---|
| 1446 | //if(headers_msgs.msg_sample && headers_msgs.msg_sample.preview_msg_subject != "") |
---|
[5134] | 1447 | if(headers_msgs.msg_sample && preferences.preview_msg_subject == "1" && headers_msgs.msg_sample.body !== "") |
---|
[1752] | 1448 | { |
---|
[4820] | 1449 | if (cssForResizing) //Colunas redimensionaveis - nao trunca |
---|
[5134] | 1450 | tr_element.msg_sample = Base64.decode(headers_msgs.msg_sample.body).substr(0,180) + "..."; //trecho do body que sera exibido com o assunto; |
---|
[4820] | 1451 | else |
---|
[5134] | 1452 | tr_element.msg_sample = Base64.decode(headers_msgs.msg_sample.body).substr(0,120) + "..."; //trecho do body que sera exibido com o assunto; |
---|
[1752] | 1453 | } |
---|
| 1454 | |
---|
| 1455 | tr_element.tip = ""; |
---|
[5134] | 1456 | if(headers_msgs.msg_sample && preferences.preview_msg_tip == "1" && headers_msgs.msg_sample.body !== "") |
---|
[1752] | 1457 | { |
---|
[5134] | 1458 | tr_element.tip = Base64.decode(headers_msgs.msg_sample.body).substr(3,300) + "..."; //trecho do body que sera exibido no tool-tip; |
---|
[1752] | 1459 | } |
---|
| 1460 | |
---|
[614] | 1461 | if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')){ |
---|
[4839] | 1462 | if ((headers_msgs.Flagged == 'F') || headers_msgs.Importance.toLowerCase().indexOf("high")!=-1 ) |
---|
[614] | 1463 | add_className(tr_element, 'flagged_msg'); |
---|
[163] | 1464 | add_className(tr_element, 'tr_msg_unread'); |
---|
[614] | 1465 | } |
---|
| 1466 | else{ |
---|
[5134] | 1467 | if ((headers_msgs.Flagged == 'F') || ( headers_msgs.Importance !== undefined && headers_msgs.Importance.toLowerCase().indexOf("high")!=-1 ) ) |
---|
[614] | 1468 | add_className(tr_element,'flagged_msg'); |
---|
| 1469 | } |
---|
[2] | 1470 | |
---|
[790] | 1471 | if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')) |
---|
| 1472 | add_className(tr_element, 'tr_msg_unread'); |
---|
[3035] | 1473 | |
---|
[790] | 1474 | if (headers_msgs.Flagged == 'F') |
---|
| 1475 | add_className(tr_element,'flagged_msg'); |
---|
| 1476 | |
---|
[4062] | 1477 | td_element1 = createTDElement(0,0,"td_msg"); |
---|
[2] | 1478 | chk_box_element = document.createElement("INPUT"); |
---|
| 1479 | chk_box_element.setAttribute("type", "checkbox"); |
---|
| 1480 | chk_box_element.className = "checkbox"; |
---|
| 1481 | chk_box_element.setAttribute("id", "check_box_message_"+headers_msgs.msg_number); |
---|
[6153] | 1482 | |
---|
| 1483 | $(chk_box_element).click(function(e){ |
---|
[2] | 1484 | changeBgColor(e,headers_msgs.msg_number); |
---|
[6153] | 1485 | }); |
---|
| 1486 | |
---|
[2] | 1487 | td_element1.appendChild(chk_box_element); |
---|
[3035] | 1488 | |
---|
[4062] | 1489 | td_element2 = createTDElement(0,1,"td_msg"); |
---|
[5359] | 1490 | if (headers_msgs.attachment == 1) |
---|
| 1491 | td_element2.innerHTML = "<img src ='templates/"+template+"/images/clip.gif' >"; |
---|
[3035] | 1492 | |
---|
[4062] | 1493 | td_element21 = createTDElement(0,2,"td_msg",null,"td_message_answered_"+headers_msgs.msg_number); |
---|
[2] | 1494 | |
---|
| 1495 | if ((headers_msgs.Forwarded == 'F') || (headers_msgs.Draft == 'X' && headers_msgs.Answered == 'A')){ |
---|
[3993] | 1496 | td_element21.onclick=function(){search_emails(headers_msgs.subject.replace(/^(re: ?|fw: ?|enc: ?|res: ?|fwd: ?)*/gi,''),true);}; |
---|
| 1497 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/forwarded.gif' title='"+get_lang('Forwarded')+"'>"; |
---|
[3035] | 1498 | headers_msgs.Draft = '' |
---|
[2] | 1499 | headers_msgs.Answered = ''; |
---|
[1035] | 1500 | headers_msgs.Forwarded = 'F'; |
---|
[2] | 1501 | } |
---|
| 1502 | else if (headers_msgs.Draft == 'X') |
---|
[994] | 1503 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/draft.gif' title='"+get_lang('Draft')+"'>"; |
---|
[3993] | 1504 | else if (headers_msgs.Answered == 'A'){ |
---|
| 1505 | td_element21.onclick=function(){search_emails(headers_msgs.subject.replace(/^(re: ?|fw: ?|enc: ?|res: ?|fwd: ?)*/gi,''),true);}; |
---|
[994] | 1506 | td_element21.innerHTML = "<img src ='templates/"+template+"/images/answered.gif' title='"+get_lang('Answered')+"'>"; |
---|
[3993] | 1507 | }else |
---|
[998] | 1508 | td_element21.innerHTML = " "; |
---|
[2] | 1509 | |
---|
[4062] | 1510 | td_element22 = createTDElement(0,1,"td_msg",null,"td_message_signed_"+headers_msgs.msg_number); |
---|
[3035] | 1511 | switch(headers_msgs.ContentType) |
---|
[1035] | 1512 | { |
---|
[3035] | 1513 | case "signature": |
---|
[1035] | 1514 | { |
---|
| 1515 | td_element22.innerHTML = "<img src ='templates/"+template+"/images/signed_msg.gif' title='" + get_lang('Signed message') + "'>"; |
---|
| 1516 | break; |
---|
| 1517 | } |
---|
[3035] | 1518 | case "cipher": |
---|
[1035] | 1519 | { |
---|
| 1520 | td_element22.innerHTML = "<img src ='templates/"+template+"/images/lock.gif' title='" + get_lang('Crypted message') + "'>"; |
---|
| 1521 | break; |
---|
| 1522 | } |
---|
[3035] | 1523 | default: |
---|
[1035] | 1524 | { |
---|
| 1525 | break; |
---|
| 1526 | } |
---|
| 1527 | } |
---|
| 1528 | |
---|
[4062] | 1529 | td_element23 = createTDElement(0,4,"td_msg",null,"td_message_important_"+headers_msgs.msg_number); |
---|
[1035] | 1530 | |
---|
[5134] | 1531 | if ( (headers_msgs.Flagged == 'F') || ( headers_msgs.Importance !== undefined && headers_msgs.Importance.toLowerCase().indexOf("high") != -1 )) |
---|
[790] | 1532 | { |
---|
[5569] | 1533 | td_element23.innerHTML = "<img src ='templates/"+template+"/images/important.png' title='"+get_lang('Important')+"'>"; |
---|
[790] | 1534 | } |
---|
[2] | 1535 | else |
---|
[1035] | 1536 | td_element23.innerHTML = " "; |
---|
[790] | 1537 | |
---|
[4062] | 1538 | td_element24 = createTDElement(0,5,"td_msg",null,"td_message_sent_"+headers_msgs.msg_number); |
---|
[1035] | 1539 | td_element24.innerHTML = " "; |
---|
[2] | 1540 | // preload image |
---|
| 1541 | var _img_sent = new Image(); |
---|
[790] | 1542 | _img_sent.src = "templates/"+template+"/images/sent.gif"; |
---|
[2] | 1543 | |
---|
[3018] | 1544 | |
---|
| 1545 | |
---|
[5533] | 1546 | td_element25 = createTDElement(0,7,"td_msg",null,"td_message_unseen_"+headers_msgs.msg_number); |
---|
[3035] | 1547 | if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N')) |
---|
| 1548 | td_element25.innerHTML = "<img src ='templates/"+template+"/images/unseen.gif' title='"+get_lang('Unseen')+"'>"; |
---|
| 1549 | else |
---|
| 1550 | td_element25.innerHTML = "<img src ='templates/"+template+"/images/seen.gif' title='"+get_lang('Seen')+"'>"; |
---|
[3018] | 1551 | |
---|
| 1552 | |
---|
[5533] | 1553 | td_element3 = createTDElement(0,8,"td_msg td_resizable","left","td_from_"+ headers_msgs.msg_number); |
---|
[689] | 1554 | var _onclick = function(){InfoContact.hide();proxy_mensagens.get_msg(headers_msgs.msg_number, msg_folder,true, show_msg);}; |
---|
[2] | 1555 | td_element3.onclick = _onclick; |
---|
| 1556 | td_element3.innerHTML = ' '; |
---|
[3035] | 1557 | |
---|
[3245] | 1558 | test = true; |
---|
[5211] | 1559 | 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] | 1560 | test = false; |
---|
[5240] | 1561 | |
---|
| 1562 | 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] | 1563 | { |
---|
[6211] | 1564 | td_element3.onmouseover = function () { |
---|
| 1565 | var title_to = ''; |
---|
| 1566 | $.each(headers_msgs.to, function(index, value) { |
---|
| 1567 | if(index == (headers_msgs.to.length - 1)){ |
---|
| 1568 | title_to = title_to + value.email; |
---|
| 1569 | } |
---|
| 1570 | else { |
---|
| 1571 | title_to = title_to + value.email + ', '; |
---|
| 1572 | } |
---|
| 1573 | }); |
---|
| 1574 | this.title = title_to; |
---|
| 1575 | }; |
---|
[5790] | 1576 | |
---|
[2] | 1577 | if (headers_msgs.Draft == 'X') |
---|
| 1578 | td_element3.innerHTML += "<span style=\"color:red\">("+get_lang("Draft")+") </span>"; |
---|
[3035] | 1579 | else{ |
---|
[6211] | 1580 | if(headers_msgs.to[0].email != null && headers_msgs.to[0].email.toLowerCase() != Element("user_email").value) |
---|
[6123] | 1581 | td_element24.innerHTML = "<img align='center' src ='templates/"+template+"/images/sent.gif' title='"+get_lang('Sent')+"'>"; |
---|
[4072] | 1582 | |
---|
[3831] | 1583 | if (headers_msgs.to) { |
---|
[6211] | 1584 | if (headers_msgs.to[0].name != null) |
---|
| 1585 | td_element3.innerHTML += headers_msgs.to[0].name; |
---|
| 1586 | else if(headers_msgs.to[0].email != null) { |
---|
| 1587 | td_element3.innerHTML += headers_msgs.to[0].email; |
---|
[3831] | 1588 | } |
---|
| 1589 | else { |
---|
| 1590 | td_element3.innerHTML += get_lang("without destination"); |
---|
| 1591 | } |
---|
[2] | 1592 | } |
---|
| 1593 | } |
---|
| 1594 | } |
---|
| 1595 | else{ |
---|
| 1596 | if (headers_msgs.Draft == 'X'){ |
---|
| 1597 | td_element3.innerHTML = "<span style=\"color:red\">("+get_lang("Draft")+") </span>"; |
---|
| 1598 | } |
---|
[3035] | 1599 | else{ |
---|
[1247] | 1600 | var spanSender = document.createElement("SPAN"); |
---|
[6138] | 1601 | spanSender.setAttribute('class','span-sender'); |
---|
[6265] | 1602 | spanSender.onmouseover = function (event) {/*this.style.textDecoration = "underline";*/try {InfoContact.begin(this,headers_msgs.reply_toaddress)} catch(e){};}; |
---|
| 1603 | spanSender.onmouseout = function (){try {/*this.style.textDecoration = "none";*/clearTimeout(InfoContact.timeout);} catch(e){}}; |
---|
[5158] | 1604 | folder = special_folders['Sent']; |
---|
| 1605 | current = get_current_folder(); |
---|
| 1606 | if ((preferences.from_to_sent == "1") && (current.substr(current.length - folder.length, folder.length) == folder)){ |
---|
[6218] | 1607 | spanSender.onmouseover = function () { |
---|
| 1608 | var title_to = ''; |
---|
| 1609 | $.each(headers_msgs.to, function(index, value) { |
---|
| 1610 | if(index == (headers_msgs.to.length - 1)){ |
---|
| 1611 | title_to = title_to + value.email; |
---|
| 1612 | } |
---|
| 1613 | else { |
---|
| 1614 | title_to = title_to + value.email + ', '; |
---|
| 1615 | } |
---|
| 1616 | }); |
---|
| 1617 | this.title = title_to; |
---|
| 1618 | }; |
---|
[5158] | 1619 | if (headers_msgs.to) { |
---|
[6218] | 1620 | if (headers_msgs.to[0].name != null){ |
---|
| 1621 | spanSender.innerHTML += headers_msgs.to[0].name; |
---|
| 1622 | }else if(headers_msgs.to[0].email != null) { |
---|
| 1623 | spanSender.innerHTML += headers_msgs.to[0].email; |
---|
[5158] | 1624 | } |
---|
| 1625 | } |
---|
| 1626 | }else if(headers_msgs.from !== undefined){ |
---|
[1247] | 1627 | spanSender.innerHTML = headers_msgs.from.name != null ? headers_msgs.from.name : headers_msgs.from.email; |
---|
[5158] | 1628 | } |
---|
[1247] | 1629 | if (spanSender.innerHTML.indexOf(" ") == '-1' && spanSender.innerHTML.length > 25){ |
---|
| 1630 | spanSender.innerHTML = spanSender.innerHTML.substring(0,25) + "..."; |
---|
| 1631 | } |
---|
| 1632 | else if (spanSender.innerHTML.length > 40 ){ |
---|
| 1633 | spanSender.innerHTML = spanSender.innerHTML.substring(0,40) + "..."; |
---|
[3035] | 1634 | } |
---|
| 1635 | td_element3.appendChild(spanSender); |
---|
[2] | 1636 | } |
---|
[3035] | 1637 | } |
---|
[4062] | 1638 | |
---|
[5533] | 1639 | td_element4 = createTDElement(0,9,"td_msg td_resizable","left"); |
---|
[5486] | 1640 | td_element4.className += " td_msg_subject"; |
---|
[2] | 1641 | td_element4.onclick = _onclick; |
---|
[1752] | 1642 | td_element4.innerHTML = !is_ie ? "<a nowrap id='a_message_"+tr_element.id+"'> " : " "; |
---|
[3035] | 1643 | |
---|
[2] | 1644 | if ((headers_msgs.subject)&&(headers_msgs.subject.length > 50)) |
---|
[1752] | 1645 | { |
---|
[4820] | 1646 | if (cssForResizing) |
---|
| 1647 | //Colunas redimensionaveis - nao trunca |
---|
| 1648 | td_element4.innerHTML += headers_msgs.subject + "<span style=\"color:#b3b3b3;\"> " + tr_element.msg_sample +"</span>"; |
---|
| 1649 | else { |
---|
| 1650 | //Modificacao para evitar que o truncamento do assunto quebre uma NCR - #1189 |
---|
| 1651 | pos = headers_msgs.subject.indexOf("&",45); |
---|
| 1652 | if ((pos > 0) && (pos <= 50) && ((headers_msgs.subject.charAt(pos+5) == ";") || (headers_msgs.subject.charAt(pos+6) == ";"))) |
---|
| 1653 | td_element4.innerHTML += headers_msgs.subject.substring(0,pos+6) + "..." + "<span style=\"color:#b3b3b3;\"> " + tr_element.msg_sample +"</span>"; |
---|
| 1654 | else |
---|
| 1655 | 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; |
---|
| 1656 | } |
---|
[1752] | 1657 | } |
---|
[2] | 1658 | else |
---|
[1752] | 1659 | { |
---|
| 1660 | 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; |
---|
| 1661 | } |
---|
[3035] | 1662 | |
---|
[1752] | 1663 | td_element4.title=tr_element.tip; |
---|
[2] | 1664 | if(!is_ie){ |
---|
| 1665 | td_element4.innerHTML += "</a>"; |
---|
| 1666 | } |
---|
[5533] | 1667 | |
---|
| 1668 | td_element5 = createTDElement(0,10,"td_msg td_resizable","center"); |
---|
| 1669 | td_element5.onclick = _onclick; |
---|
| 1670 | |
---|
| 1671 | td_element27 = createTDElement(0,7,"td_msg",null,"td_message_labels_"+headers_msgs.msg_number); |
---|
| 1672 | $(td_element27).addClass("td-label"); |
---|
[2] | 1673 | |
---|
[5533] | 1674 | if (headers_msgs.labels) { |
---|
| 1675 | td_element27.innerHTML = '<img src="../prototype/modules/mail/img/tag.png">'; |
---|
[5586] | 1676 | updateLabelsColumn(headers_msgs); |
---|
[5533] | 1677 | } |
---|
| 1678 | |
---|
[6123] | 1679 | td_element26 = createTDElement(0,6,"td_msg","center","td_message_followup_"+headers_msgs.msg_number); |
---|
[5533] | 1680 | $(td_element26).addClass("td-followup-flag"); |
---|
[5717] | 1681 | td_element26.innerHTML = '<div class="flag-edited" style="width:8px;height:6px;"><img src="../prototype/modules/mail/img/flagEditor.png"></div>'; |
---|
[5533] | 1682 | |
---|
| 1683 | if (headers_msgs.followupflagged) { |
---|
[5738] | 1684 | if(headers_msgs.followupflagged.followupflag.id < 7){ |
---|
| 1685 | var nameFollowupflag = get_lang(headers_msgs.followupflagged.followupflag.name); |
---|
| 1686 | }else{ |
---|
| 1687 | var nameFollowupflag = headers_msgs.followupflagged.followupflag.name; |
---|
| 1688 | } |
---|
| 1689 | $(td_element26).attr('title', nameFollowupflag) |
---|
[5533] | 1690 | .find(".flag-edited").css("background",headers_msgs.followupflagged.backgroundColor); |
---|
| 1691 | if(headers_msgs.followupflagged.isDone == "1"){ |
---|
| 1692 | $(td_element26).find(".flag-edited").find("img") |
---|
| 1693 | .attr("src", "../prototype/modules/mail/img/flagChecked.png") |
---|
| 1694 | .css("margin-left","-3px"); |
---|
| 1695 | } |
---|
| 1696 | } else { |
---|
| 1697 | $(td_element26).find(".flag-edited").css("background","#cccccc"); |
---|
| 1698 | } |
---|
| 1699 | |
---|
| 1700 | /** |
---|
| 1701 | * Clique para aplicar sinalizador |
---|
| 1702 | */ |
---|
| 1703 | $(td_element26).click(function() { |
---|
| 1704 | var messageClickedId = $(this).attr('id').match(/td_message_followup_([\d]+)/)[1]; |
---|
[5861] | 1705 | |
---|
[5882] | 1706 | var followupColor = $('#td_message_followup_' + messageClickedId).find(".flag-edited").css('backgroundColor'); |
---|
| 1707 | |
---|
[5861] | 1708 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1709 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
[5867] | 1710 | .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" />'); |
---|
| 1711 | |
---|
| 1712 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1713 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "transparent"); |
---|
[5882] | 1714 | |
---|
| 1715 | |
---|
[5867] | 1716 | /** |
---|
[5533] | 1717 | * Hack: |
---|
| 1718 | * headers_msgs.followupflagged.id não vai funcionar porque já foi feito DataLayer.commit() |
---|
| 1719 | * por isso o id deve ser obtido do banco |
---|
| 1720 | * também para verificar se há ou não sinalizador nesta mensagem |
---|
| 1721 | */ |
---|
[5605] | 1722 | |
---|
| 1723 | DataLayer.remove('followupflagged', false); |
---|
[5533] | 1724 | var flagged = DataLayer.get('followupflagged', {filter: [ |
---|
| 1725 | 'AND', |
---|
| 1726 | ['=', 'messageNumber', messageClickedId], |
---|
| 1727 | ['=', 'folderName', msg_folder] |
---|
| 1728 | ]}); |
---|
[5540] | 1729 | |
---|
| 1730 | if (!flagged) { |
---|
[5533] | 1731 | /** |
---|
| 1732 | * Aplica followupflag de Acompanhamento |
---|
| 1733 | */ |
---|
| 1734 | headers_msgs.followupflagged = { |
---|
| 1735 | uid : User.me.id, |
---|
| 1736 | folderName : msg_folder, |
---|
| 1737 | messageNumber : messageClickedId, |
---|
| 1738 | alarmTime : false, |
---|
| 1739 | backgroundColor : '#FF2016', |
---|
[6152] | 1740 | followupflagId: '1' |
---|
[5533] | 1741 | }; |
---|
| 1742 | headers_msgs.followupflagged.id = DataLayer.put('followupflagged', headers_msgs.followupflagged); |
---|
[6047] | 1743 | DataLayer.commit(false, false, function(data){ |
---|
[6384] | 1744 | var fail = 'success'; |
---|
[6047] | 1745 | $.each(data, function(index, value) { |
---|
[6384] | 1746 | if(typeof value === 'string'){ |
---|
| 1747 | fail = value; |
---|
[6047] | 1748 | } |
---|
| 1749 | }); |
---|
| 1750 | |
---|
[5861] | 1751 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1752 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1753 | .html('<img src="../prototype/modules/mail/img/flagEditor.png">'); |
---|
[6384] | 1754 | |
---|
| 1755 | switch( fail ) |
---|
| 1756 | { |
---|
| 1757 | case '#FollowupflagMessageIdError': { |
---|
| 1758 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1759 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "#CCCCCC"); |
---|
| 1760 | alert("Não foi possível sinalizar esta mensagem. \nDetalhes do erro: mensagem não contém o atributo message-id."); break; |
---|
| 1761 | } |
---|
| 1762 | case '#FollowupflagParamsError': { |
---|
| 1763 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1764 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "#CCCCCC"); |
---|
| 1765 | alert("Não foi possível sinalizar esta mensagem. \nDetalhes do erro: mensagem não contém todos os atributos necessários."); break; |
---|
| 1766 | } |
---|
| 1767 | default : { |
---|
| 1768 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1769 | '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); |
---|
| 1770 | updateCacheFollowupflag(messageClickedId, msg_folder, true); |
---|
| 1771 | } |
---|
[6047] | 1772 | } |
---|
[5625] | 1773 | }); |
---|
[5533] | 1774 | |
---|
[6463] | 1775 | |
---|
[5625] | 1776 | } else if (onceOpenedHeadersMessages[msg_folder][messageClickedId]['followupflagged'].followupflag.name == 'Follow up') { |
---|
[5533] | 1777 | /** |
---|
[5540] | 1778 | * Remove followupflag de Acompanhamento |
---|
[5533] | 1779 | */ |
---|
| 1780 | $(this).find(".flag-edited").css("background", "#cccccc"); |
---|
[5708] | 1781 | DataLayer.remove('followupflagged', flagged[0].id ); |
---|
[5649] | 1782 | DataLayer.commit(false, false, function(){ |
---|
| 1783 | updateCacheFollowupflag(messageClickedId, msg_folder, false); |
---|
| 1784 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
[5861] | 1785 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1786 | .html('<img src="../prototype/modules/mail/img/flagEditor.png">'); |
---|
| 1787 | |
---|
| 1788 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
[5929] | 1789 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).attr('title', '').find(".flag-edited").css("background", '#CCC'); |
---|
[5861] | 1790 | |
---|
[5649] | 1791 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1792 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1793 | .find("img").attr("src", "../prototype/modules/mail/img/flagEditor.png").css("margin-left","0"); |
---|
| 1794 | }); |
---|
| 1795 | |
---|
[5533] | 1796 | } else { |
---|
[5882] | 1797 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1798 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited") |
---|
| 1799 | .html('<img src="../prototype/modules/mail/img/flagEditor.png">'); |
---|
| 1800 | $('#td_message_followup_' + messageClickedId + ', ' + |
---|
| 1801 | 'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", followupColor); |
---|
[5533] | 1802 | $(tr_element).addClass('selected_msg').find(':checkbox').trigger('click'); |
---|
| 1803 | configureFollowupflag(); |
---|
| 1804 | } |
---|
| 1805 | |
---|
[5540] | 1806 | |
---|
[5533] | 1807 | }); |
---|
| 1808 | |
---|
[3057] | 1809 | var norm = function (arg) {return (arg < 10 ? '0'+arg : arg);}; |
---|
| 1810 | var weekDays = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; |
---|
[3493] | 1811 | |
---|
| 1812 | var today = new Date(); |
---|
[3927] | 1813 | today.setHours(23); |
---|
| 1814 | today.setMinutes(59); |
---|
| 1815 | today.setSeconds(59); |
---|
| 1816 | today.setMilliseconds(999) |
---|
[3493] | 1817 | |
---|
[3512] | 1818 | var udate_local = null; |
---|
| 1819 | var date_msg = null; |
---|
[3493] | 1820 | |
---|
[3512] | 1821 | // old local messages can capture headers_msgs.udate as "hh:mm" or "dd/mm/yyyy" |
---|
[5134] | 1822 | 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] | 1823 | { |
---|
| 1824 | temp_msg_day = headers_msgs.msg_day.split('/'); |
---|
| 1825 | temp_msg_hour = headers_msgs.msg_hour.split(':'); |
---|
| 1826 | 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]); |
---|
| 1827 | } |
---|
| 1828 | else |
---|
| 1829 | { |
---|
| 1830 | // The new date implementation |
---|
| 1831 | // Using offset between user defined timezone and GMT |
---|
| 1832 | // Date object converts time to local timezone, so we have to adjust it |
---|
| 1833 | udate_local = headers_msgs.udate*1000 + offsetToGMT*1000 + today.getTimezoneOffset()*60*1000; |
---|
| 1834 | date_msg = new Date(udate_local); |
---|
| 1835 | } |
---|
| 1836 | |
---|
[5808] | 1837 | if (preferences.show_date_numerical == 0 || typeof(preferences.show_date_numerical) == 'undefined') { |
---|
| 1838 | if (today.getTime() - date_msg.getTime() < 86400000) |
---|
| 1839 | td_element5.innerHTML = norm(date_msg.getHours()) + ':' + norm(date_msg.getMinutes()); |
---|
[3057] | 1840 | else |
---|
[5808] | 1841 | if (today.getTime() - date_msg.getTime() < 172800000) |
---|
| 1842 | td_element5.innerHTML = get_lang('Yesterday'); |
---|
| 1843 | else if (today.getTime() - date_msg.getTime() < 259200000) |
---|
[3057] | 1844 | td_element5.innerHTML = get_lang(weekDays[date_msg.getDay()]); |
---|
[5808] | 1845 | else{ |
---|
| 1846 | td_element5.innerHTML = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 1847 | td_element5.title = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 1848 | td_element5.alt = td_element5.title; |
---|
| 1849 | } |
---|
| 1850 | }else{ |
---|
| 1851 | td_element5.innerHTML = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 1852 | td_element5.title = norm(date_msg.getDate()) + '/' + norm(date_msg.getMonth()+1) + '/' +date_msg.getFullYear(); |
---|
| 1853 | td_element5.alt = td_element5.title; |
---|
| 1854 | } |
---|
[5533] | 1855 | td_element6 = createTDElement(0,11,"td_msg td_resizable","center"); |
---|
[2] | 1856 | td_element6.onclick = _onclick; |
---|
| 1857 | td_element6.setAttribute("noWrap","true"); |
---|
[3028] | 1858 | td_element6.innerHTML = borkb(headers_msgs.Size); |
---|
| 1859 | |
---|
[2] | 1860 | tr_element.appendChild(td_element1); |
---|
| 1861 | tr_element.appendChild(td_element2); |
---|
| 1862 | tr_element.appendChild(td_element21); |
---|
| 1863 | tr_element.appendChild(td_element22); |
---|
| 1864 | tr_element.appendChild(td_element23); |
---|
[5533] | 1865 | tr_element.appendChild(td_element24); |
---|
| 1866 | tr_element.appendChild(td_element26); |
---|
| 1867 | tr_element.appendChild(td_element27); |
---|
[3035] | 1868 | tr_element.appendChild(td_element25); |
---|
[5533] | 1869 | |
---|
[2] | 1870 | tr_element.appendChild(td_element3); |
---|
| 1871 | tr_element.appendChild(td_element4); |
---|
| 1872 | tr_element.appendChild(td_element5); |
---|
| 1873 | tr_element.appendChild(td_element6); |
---|
| 1874 | return tr_element; |
---|
| 1875 | } |
---|
| 1876 | |
---|
[51] | 1877 | function sort_box(search, sort){ |
---|
[4062] | 1878 | if (cellResized) |
---|
| 1879 | return; |
---|
[51] | 1880 | var message_header = Element("message_header_"+search); |
---|
[2] | 1881 | var handler_draw_box = function(data){ |
---|
[790] | 1882 | draw_box(data, current_folder,true); |
---|
[406] | 1883 | //Mostrar as msgs nao lidas de acordo com o filtro de relevancia |
---|
[3392] | 1884 | var msgs_unseen = 0; |
---|
| 1885 | draw_paging(data.num_msgs); |
---|
| 1886 | Element("new_m").innerHTML = '<font style="color:'+(data.tot_unseen == 0 ? '': 'red')+'">' + data.tot_unseen + '</font>'; |
---|
| 1887 | Element("tot_m").innerHTML = data.num_msgs; |
---|
[427] | 1888 | } |
---|
[2] | 1889 | |
---|
[51] | 1890 | if(sort_box_type == sort && search_box_type == search){ |
---|
[46] | 1891 | sort_box_reverse = sort_box_reverse ? 0 : 1; |
---|
[51] | 1892 | } |
---|
| 1893 | else if(sort_box_type != sort){ |
---|
[163] | 1894 | if ( (sort == 'SORTFROM') || (sort == 'SORTSUBJECT') ) |
---|
| 1895 | sort_box_reverse = 0; |
---|
| 1896 | else |
---|
| 1897 | sort_box_reverse = 1; |
---|
[51] | 1898 | } |
---|
[3035] | 1899 | |
---|
[46] | 1900 | // Global variable. |
---|
[51] | 1901 | sort_box_type = sort; |
---|
| 1902 | search_box_type = search; |
---|
[46] | 1903 | |
---|
[1752] | 1904 | 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] | 1905 | current_page = 1; |
---|
[406] | 1906 | //Comentado para nao sobrepor o numero de msgs nao lidas ao utilizar os filtros |
---|
| 1907 | //update_menu(); |
---|
[2] | 1908 | } |
---|
[4493] | 1909 | |
---|
[2] | 1910 | function draw_header_box(){ |
---|
| 1911 | switch(sort_box_type){ |
---|
| 1912 | case 'SORTFROM': |
---|
[4771] | 1913 | type_name = get_lang("From"); |
---|
[2] | 1914 | break; |
---|
| 1915 | case 'SORTSUBJECT': |
---|
| 1916 | type_name = get_lang("Subject"); |
---|
| 1917 | break; |
---|
| 1918 | case 'SORTARRIVAL': |
---|
| 1919 | type_name = get_lang("Date"); |
---|
| 1920 | break; |
---|
| 1921 | case 'SORTSIZE': |
---|
| 1922 | type_name = get_lang("Size"); |
---|
[3035] | 1923 | break; |
---|
[2] | 1924 | default: |
---|
| 1925 | type_name = get_lang("Date"); |
---|
[72] | 1926 | break; |
---|
[2] | 1927 | } |
---|
[5158] | 1928 | folder = special_folders['Sent']; |
---|
| 1929 | current = get_current_folder(); |
---|
| 1930 | if ((preferences.from_to_sent == "1") && (current.substr(current.length - folder.length, folder.length) == folder)) { |
---|
| 1931 | document.getElementById("message_header_SORTFROM_"+numBox).innerHTML = get_lang("To"); |
---|
| 1932 | }else{ |
---|
[4771] | 1933 | document.getElementById("message_header_SORTFROM_"+numBox).innerHTML = get_lang("From"); |
---|
[5158] | 1934 | } |
---|
[320] | 1935 | document.getElementById("message_header_SORTSUBJECT_"+numBox).innerHTML = get_lang("Subject"); |
---|
| 1936 | document.getElementById("message_header_SORTARRIVAL_"+numBox).innerHTML = get_lang("Date"); |
---|
[3035] | 1937 | document.getElementById("message_header_SORTSIZE_"+numBox).innerHTML = get_lang("Size"); |
---|
[790] | 1938 | 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] | 1939 | } |
---|
[5134] | 1940 | function verifyOption(name, id){ |
---|
| 1941 | var str = name + '' + id; |
---|
| 1942 | if(!Element(str).style.display == ""){ |
---|
| 1943 | var option_reply_options = document.getElementById('msg_opt_reply_options_'+id); |
---|
| 1944 | option_reply_options.value = 'show'; |
---|
| 1945 | option_reply_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 1946 | Element('tr_other_options_'+id).style.display = 'none'; |
---|
| 1947 | var option_more_options = document.getElementById('msg_opt_more_options_'+id); |
---|
| 1948 | option_more_options.value = 'show'; |
---|
| 1949 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 1950 | Element('tr_other_more_options_'+id).style.display = 'none'; |
---|
| 1951 | var option_mark_as_options = document.getElementById('msg_opt_mark_options_'+id); |
---|
| 1952 | option_mark_as_options.value = 'show'; |
---|
| 1953 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 1954 | Element('tr_other_mark_options_'+id).style.display = 'none'; |
---|
| 1955 | } |
---|
| 1956 | } |
---|
[5308] | 1957 | |
---|
| 1958 | /*Busca a primeira mensagem na pagina*/ |
---|
| 1959 | function firstRow(){ |
---|
| 1960 | var thisCell; |
---|
| 1961 | if (objCell) |
---|
| 1962 | thisCell = objCell; |
---|
| 1963 | else |
---|
| 1964 | thisCell = document.getElementById("table_message_header_box_0").rows[0].cells[0]; |
---|
| 1965 | var tbM = getMessagesTable(thisCell); |
---|
| 1966 | proxy_mensagens.get_msg(tbM.rows[0].getAttribute('id'),get_current_folder(),true,show_msg); |
---|
| 1967 | } |
---|
| 1968 | |
---|
| 1969 | /*Busca a ultima mensagem na pagina*/ |
---|
| 1970 | function lastRow(){ |
---|
| 1971 | var thisCell; |
---|
| 1972 | if (objCell) |
---|
| 1973 | thisCell = objCell; |
---|
| 1974 | else |
---|
| 1975 | thisCell = document.getElementById("table_message_header_box_0").rows[0].cells[0]; |
---|
| 1976 | var tbM = getMessagesTable(thisCell); |
---|
| 1977 | proxy_mensagens.get_msg(tbM.rows[tbM.rows.length - 1].getAttribute('id'),get_current_folder(),true,show_msg); |
---|
| 1978 | } |
---|
| 1979 | |
---|
[5367] | 1980 | var msg_selected; |
---|
[2] | 1981 | function draw_message(info_msg, ID){ |
---|
[6487] | 1982 | // remove a flag $FilteredMessage da mensagem ao ser lida |
---|
| 1983 | if(info_msg.Unseen == "U"){ |
---|
| 1984 | $.each(fromRules, function(index, value) { |
---|
| 1985 | if(value == info_msg.msg_folder){ |
---|
| 1986 | cExecute ("$this.imap_functions.removeFlagMessagesFilter&folder="+info_msg.msg_folder+"&msg_number="+info_msg.msg_number, function(){}); |
---|
| 1987 | return false; |
---|
| 1988 | } |
---|
| 1989 | }); |
---|
| 1990 | } |
---|
[2] | 1991 | var content = document.getElementById('content_id_' + ID); |
---|
[3035] | 1992 | |
---|
[2] | 1993 | var menuHidden = Element("folderscol").style.display == 'none' ? true : false; |
---|
| 1994 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1995 | //Make the next/previous buttom. |
---|
| 1996 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 1997 | var next_previous_msg_td = document.createElement("TD"); |
---|
| 1998 | next_previous_msg_td.setAttribute("noWrap","true"); |
---|
| 1999 | next_previous_msg_td.align = "right"; |
---|
[5735] | 2000 | next_previous_msg_td.style.fontSize = "10px"; |
---|
[2] | 2001 | next_previous_msg_td.width = "40px"; |
---|
| 2002 | var img_next_msg = document.createElement("IMG"); |
---|
[128] | 2003 | img_next_msg.id = 'msg_opt_next_' + ID; |
---|
[790] | 2004 | img_next_msg.src = './templates/'+template+'/images/down.button.png'; |
---|
[5249] | 2005 | if(preferences.use_shortcuts == '1') |
---|
| 2006 | img_next_msg.title = get_lang('Next Shortcut:Control + Down'); |
---|
| 2007 | else |
---|
| 2008 | img_next_msg.title = get_lang('Next'); |
---|
[2] | 2009 | img_next_msg.style.cursor = 'pointer'; |
---|
[569] | 2010 | |
---|
[4820] | 2011 | var folder_id = ID.match(/\d+/)[0]; |
---|
| 2012 | var folder; |
---|
[3394] | 2013 | |
---|
[4820] | 2014 | //Correção para fazer funcionar e-mails assinados no formato encapsulado. |
---|
| 2015 | // folder_id = info_msg.original_ID ? info_msg.original_ID: info_msg.msg_number; |
---|
| 2016 | //if ((folder = document.getElementById(info_msg.msg_number)) == null) |
---|
[4493] | 2017 | if ((folder = Element(info_msg.original_ID)) == null) |
---|
| 2018 | folder = Element(info_msg.msg_number); |
---|
| 2019 | |
---|
[5134] | 2020 | |
---|
[3035] | 2021 | if (folder){ // mensagem local criptografada nao tem ID da pasta local |
---|
| 2022 | if (folder.nextSibling){ |
---|
| 2023 | var nextMsgBox = folder.nextSibling.name?folder.nextSibling.name:info_msg.msg_folder; |
---|
[1035] | 2024 | |
---|
[5134] | 2025 | if (nextMsgBox == "INBOX" + cyrus_delimiter + "decifradas")// teste para ver se a mensagem vem da pasta oculta decifradas |
---|
[3035] | 2026 | nextMsgBox = get_current_folder(); |
---|
[1035] | 2027 | |
---|
[3035] | 2028 | img_next_msg.onclick = function() |
---|
| 2029 | { |
---|
| 2030 | currentTab = ID; |
---|
| 2031 | openTab.type[ID] = 2; |
---|
| 2032 | proxy_mensagens.get_msg(folder.nextSibling.id,nextMsgBox,true,show_msg); |
---|
[5308] | 2033 | //select_msg('null', 'down', true); |
---|
[5367] | 2034 | if (!msg_selected){ |
---|
| 2035 | select_msg('null', 'down', true); |
---|
| 2036 | msg_selected = true; |
---|
| 2037 | } |
---|
[3035] | 2038 | }; |
---|
| 2039 | } |
---|
[5308] | 2040 | /*Ultima mensagem de cada página, exceto a ultima*/ |
---|
| 2041 | else if( (current_page < total_pages) ){ |
---|
| 2042 | |
---|
| 2043 | img_next_msg.onclick = function() |
---|
| 2044 | { |
---|
| 2045 | |
---|
| 2046 | current_page++; |
---|
| 2047 | var tot_msgs = parseInt(Element("tot_m").innerHTML); |
---|
| 2048 | var range_begin = preferences.max_email_per_page*( current_page - 1 ) + 1; |
---|
| 2049 | var range_end; |
---|
| 2050 | if ( range_begin + parseInt(preferences.max_email_per_page - 1) > tot_msgs ) |
---|
| 2051 | range_end = tot_msgs; |
---|
| 2052 | else |
---|
| 2053 | range_end = range_begin + parseInt(preferences.max_email_per_page - 1); |
---|
| 2054 | var creatBoxProximo = function (data){ |
---|
| 2055 | draw_box(data, get_current_folder()); |
---|
| 2056 | firstRow(); |
---|
| 2057 | }; |
---|
[5321] | 2058 | proxy_mensagens.messages_list(get_current_folder(),range_begin,range_end,sort_box_type,search_box_type,sort_box_reverse,'','', creatBoxProximo); |
---|
[5308] | 2059 | |
---|
| 2060 | }; |
---|
| 2061 | } |
---|
[3035] | 2062 | else |
---|
| 2063 | { |
---|
| 2064 | img_next_msg.src = "./templates/"+template+"/images/down.gray.button.png"; |
---|
| 2065 | img_next_msg.style.cursor = 'default'; |
---|
[1035] | 2066 | |
---|
[3035] | 2067 | } |
---|
| 2068 | } |
---|
| 2069 | else |
---|
| 2070 | { |
---|
| 2071 | img_next_msg.src = "./templates/"+template+"/images/down.gray.button.png"; |
---|
[1035] | 2072 | img_next_msg.style.cursor = 'default'; |
---|
[4726] | 2073 | // testa se a mensagem e local |
---|
| 2074 | if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(info_msg.msg_folder == "INBOX" + cyrus_delimiter + "decifradas")) // testa se a mensagem e local |
---|
[569] | 2075 | { |
---|
[3035] | 2076 | img_next_msg.onclick = function() |
---|
| 2077 | { |
---|
| 2078 | delete_border(ID); |
---|
| 2079 | }; |
---|
| 2080 | } |
---|
| 2081 | } |
---|
[2] | 2082 | var img_space = document.createElement("SPAN"); |
---|
| 2083 | img_space.innerHTML = " "; |
---|
| 2084 | var img_previous_msg = document.createElement("IMG"); |
---|
[128] | 2085 | img_previous_msg.id = 'msg_opt_previous_' + ID; |
---|
[790] | 2086 | img_previous_msg.src = './templates/'+template+'/images/up.button.png'; |
---|
[5249] | 2087 | if(preferences.use_shortcuts == '1') |
---|
| 2088 | img_previous_msg.title = get_lang('Previous Shortcut:Control + Up'); |
---|
| 2089 | else |
---|
| 2090 | img_previous_msg.title = get_lang('Previous'); |
---|
[2] | 2091 | img_previous_msg.style.cursor = 'pointer'; |
---|
[569] | 2092 | |
---|
[5134] | 2093 | |
---|
[3035] | 2094 | if (folder){ // mensagem local criptografada nao tem ID da pasta local |
---|
| 2095 | if (folder.previousSibling) |
---|
| 2096 | { |
---|
| 2097 | var previousMsgBox = folder.previousSibling.name?folder.previousSibling.name:info_msg.msg_folder; |
---|
[1035] | 2098 | |
---|
[4726] | 2099 | if (previousMsgBox == "INBOX" + cyrus_delimiter + "decifradas") // teste para ver se a mensagem vem da pasta oculta decifradas |
---|
[3035] | 2100 | previousMsgBox = get_current_folder(); |
---|
[1035] | 2101 | |
---|
[3035] | 2102 | img_previous_msg.onclick = function() |
---|
| 2103 | { |
---|
| 2104 | currentTab = ID; |
---|
| 2105 | openTab.type[ID] = 2; |
---|
| 2106 | proxy_mensagens.get_msg(folder.previousSibling.id,previousMsgBox,true,show_msg); |
---|
[5308] | 2107 | //select_msg('null', 'up', false); |
---|
[5367] | 2108 | if (!msg_selected){ |
---|
| 2109 | select_msg('null', 'up', true); |
---|
| 2110 | msg_selected = true; |
---|
| 2111 | } |
---|
[3035] | 2112 | }; |
---|
| 2113 | } |
---|
[5308] | 2114 | //primeira mensagem de cada página, exceto a primeira |
---|
| 2115 | else if(current_page > 1){ |
---|
| 2116 | |
---|
| 2117 | img_previous_msg.onclick = function() |
---|
| 2118 | { |
---|
| 2119 | |
---|
| 2120 | current_page--; |
---|
| 2121 | var range_begin = (current_page - 1)*preferences.max_email_per_page + 1; |
---|
| 2122 | var range_end = current_page*preferences.max_email_per_page; |
---|
| 2123 | var creatBoxAnterior = function (data){ |
---|
| 2124 | draw_box(data, get_current_folder()); |
---|
| 2125 | lastRow(); |
---|
| 2126 | }; |
---|
| 2127 | proxy_mensagens.messages_list(get_current_folder(),range_begin,range_end,sort_box_type,search_box_type,sort_box_reverse,'','', creatBoxAnterior); |
---|
| 2128 | }; |
---|
| 2129 | } |
---|
[3035] | 2130 | else |
---|
| 2131 | { |
---|
| 2132 | img_previous_msg.src = "./templates/"+template+"/images/up.gray.button.png"; |
---|
| 2133 | img_previous_msg.style.cursor = 'default'; |
---|
| 2134 | } |
---|
[569] | 2135 | } |
---|
| 2136 | else |
---|
[1035] | 2137 | { |
---|
| 2138 | img_previous_msg.src = "./templates/"+template+"/images/up.gray.button.png"; |
---|
| 2139 | img_previous_msg.style.cursor = 'default'; |
---|
[4726] | 2140 | // testa se a mensagem e local |
---|
| 2141 | if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(info_msg.msg_folder == "INBOX" + cyrus_delimiter + "decifradas")) // testa se a mensagem e local |
---|
[3035] | 2142 | { |
---|
| 2143 | img_previous_msg.onclick = function() |
---|
| 2144 | { |
---|
| 2145 | delete_border(ID); |
---|
| 2146 | }; |
---|
| 2147 | } |
---|
| 2148 | } |
---|
[2] | 2149 | next_previous_msg_td.appendChild(img_previous_msg); |
---|
| 2150 | next_previous_msg_td.appendChild(img_space); |
---|
| 2151 | next_previous_msg_td.appendChild(img_next_msg); |
---|
| 2152 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2153 | //Make the header message. |
---|
| 2154 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2155 | var table_message = document.createElement("TABLE"); |
---|
| 2156 | var tbody_message = document.createElement("TBODY"); |
---|
| 2157 | table_message.border = "0"; |
---|
[4493] | 2158 | //table_message.width = "100%"; |
---|
| 2159 | //k! |
---|
| 2160 | table_message.setAttribute("class", "expressomail-message-body"); |
---|
| 2161 | table_message.setAttribute("className", "expressomail-message-body"); |
---|
[2] | 2162 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2163 | //Make the options message. |
---|
| 2164 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2165 | var tr0 = document.createElement("TR"); |
---|
| 2166 | tr0.className = "tr_message_header"; |
---|
| 2167 | var td0 = document.createElement("TD"); |
---|
| 2168 | var table_message_options = document.createElement("TABLE"); |
---|
| 2169 | table_message_options.width = "100%"; |
---|
| 2170 | table_message_options.border = '0'; |
---|
| 2171 | table_message_options.className = 'table_message'; |
---|
| 2172 | var tbody_message_options = document.createElement("TBODY"); |
---|
| 2173 | var tr = document.createElement("TR"); |
---|
| 2174 | var td = document.createElement("TD"); |
---|
| 2175 | td.setAttribute("noWrap","true"); |
---|
[5735] | 2176 | td.style.fontSize = "10px"; |
---|
[2] | 2177 | var _name = ''; |
---|
| 2178 | var _maxChar = menuHidden ? 40 : 15; |
---|
[3035] | 2179 | |
---|
[2] | 2180 | if (info_msg.from.name) |
---|
[1416] | 2181 | { |
---|
| 2182 | var spanName = document.createElement("SPAN"); |
---|
| 2183 | spanName.innerHTML = info_msg.from.name; |
---|
| 2184 | _name = spanName.innerHTML.length > _maxChar ? spanName.innerHTML.substring(0,_maxChar) + "..." : spanName.innerHTML; |
---|
| 2185 | } |
---|
| 2186 | else |
---|
[2] | 2187 | _name = info_msg.from.email.length > _maxChar ? info_msg.from.email.substring(0,_maxChar) + "..." : info_msg.from.email; |
---|
| 2188 | |
---|
| 2189 | td.innerHTML = _name.bold() + ', ' + info_msg.smalldate; |
---|
[4493] | 2190 | //k! |
---|
[3035] | 2191 | if (info_msg.attachments && info_msg.attachments.length > 0) |
---|
[3369] | 2192 | 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] | 2193 | |
---|
[91] | 2194 | if (typeof(info_msg.signature) == 'string') |
---|
[3035] | 2195 | { |
---|
[109] | 2196 | if (info_msg.signature != "void") |
---|
[790] | 2197 | 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] | 2198 | else |
---|
[790] | 2199 | 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] | 2200 | } |
---|
[4072] | 2201 | |
---|
[320] | 2202 | if (info_msg.DispositionNotificationTo) |
---|
| 2203 | { |
---|
[3798] | 2204 | 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] | 2205 | } |
---|
[3035] | 2206 | |
---|
[5134] | 2207 | if (info_msg.Flagged == 'F') |
---|
| 2208 | { |
---|
[5569] | 2209 | 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] | 2210 | } |
---|
[2] | 2211 | // NORMAL MSG |
---|
| 2212 | if(info_msg.Draft != 'X') |
---|
| 2213 | { |
---|
| 2214 | var options = document.createElement("TD"); |
---|
[790] | 2215 | options.width = "30%"; |
---|
[2] | 2216 | options.setAttribute("noWrap","true"); |
---|
[5735] | 2217 | options.style.fontSize = "10px"; |
---|
[5134] | 2218 | |
---|
| 2219 | //BEGIN: DESENHA MOSTRA DETALHES, OCULTAR DETALHES |
---|
[2] | 2220 | var option_hide_more = document.createElement("SPAN"); |
---|
| 2221 | option_hide_more.className = 'message_options'; |
---|
[4826] | 2222 | option_hide_more.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2223 | option_hide_more.onmouseout=function () {this.className='message_options'}; |
---|
[24] | 2224 | options.align = 'right'; |
---|
[2] | 2225 | option_hide_more.value = 'more_options'; |
---|
| 2226 | option_hide_more.id = 'option_hide_more_'+ID; |
---|
| 2227 | option_hide_more.onclick = function(){ |
---|
| 2228 | if (this.value == 'more_options'){ |
---|
[3021] | 2229 | this.innerHTML = "<b><u>"+get_lang('Hide details')+"</u></b>"; |
---|
[2] | 2230 | this.value = 'hide_options'; |
---|
| 2231 | Element('table_message_others_options_'+ID).style.display = ''; |
---|
| 2232 | } |
---|
| 2233 | else{ |
---|
[3021] | 2234 | this.innerHTML = get_lang('Show details'); |
---|
[2] | 2235 | this.value = 'more_options'; |
---|
| 2236 | Element('table_message_others_options_'+ID).style.display = 'none'; |
---|
| 2237 | } |
---|
[3018] | 2238 | resizeWindow(); |
---|
[2] | 2239 | }; |
---|
[5134] | 2240 | //END: DESENHA MOSTRA DETALHES, OCULTAR DETALHES |
---|
| 2241 | |
---|
| 2242 | //OPCAO PARA MARCAR COMO |
---|
| 2243 | var option_mark_as = document.createElement("SPAN"); |
---|
| 2244 | option_mark_as.innerHTML = "<b>"+get_lang('Mark as')+"</b>"; |
---|
| 2245 | option_mark_as.className = 'message_options'; |
---|
| 2246 | option_mark_as.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2247 | option_mark_as.onmouseout=function () {this.className='message_options'}; |
---|
| 2248 | option_mark_as.onclick = function(){ |
---|
| 2249 | verifyOption('tr_other_mark_options_', ID); |
---|
| 2250 | var thi = document.getElementById('msg_opt_mark_options_'+ID); |
---|
| 2251 | if (thi.value != 'hide'){ |
---|
| 2252 | thi.value = 'hide'; |
---|
| 2253 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2254 | Element('tr_other_mark_options_'+ID).style.display = ''; |
---|
| 2255 | |
---|
| 2256 | } |
---|
| 2257 | else{ |
---|
| 2258 | thi.value = 'show'; |
---|
| 2259 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2260 | Element('tr_other_mark_options_'+ID).style.display = 'none'; |
---|
| 2261 | } |
---|
| 2262 | }; |
---|
| 2263 | //DESENHA OPCOES DO MARCAR COMO |
---|
[3036] | 2264 | var option_mark_as_unseen = document.createElement("SPAN"); |
---|
[5134] | 2265 | option_mark_as_unseen.className = "reply_options"; |
---|
[4826] | 2266 | option_mark_as_unseen.onclick = function () {changeLinkState(this,'seen'); |
---|
[3716] | 2267 | proxy_mensagens.proxy_set_message_flag(folder_id,'unseen'); |
---|
[3036] | 2268 | write_msg(get_lang('Message marked as ')+get_lang("Unseen")); |
---|
| 2269 | }; |
---|
[5134] | 2270 | option_mark_as_unseen.onmouseover=function () {this.className='reply_options_active'}; |
---|
| 2271 | option_mark_as_unseen.onmouseout=function () {this.className='reply_options'}; |
---|
[3036] | 2272 | option_mark_as_unseen.innerHTML = get_lang("Unseen"); |
---|
[3021] | 2273 | |
---|
[3036] | 2274 | var option_mark_important = document.createElement("SPAN"); |
---|
[5134] | 2275 | option_mark_important.className = 'reply_options'; |
---|
| 2276 | option_mark_important.onmouseover=function () {this.className='reply_options_active';}; |
---|
| 2277 | option_mark_important.onmouseout=function () {this.className='reply_options'}; |
---|
[3036] | 2278 | |
---|
| 2279 | if (info_msg.Flagged == "F"){ |
---|
[4072] | 2280 | option_mark_important.onclick = function() { |
---|
[3806] | 2281 | var _this = this; |
---|
| 2282 | proxy_mensagens.proxy_set_message_flag(folder_id,'unflagged', function(success){ |
---|
| 2283 | if (success) { |
---|
| 2284 | changeLinkState(_this, 'important'); |
---|
| 2285 | write_msg(get_lang('Message marked as ') + get_lang("Normal")); |
---|
| 2286 | } |
---|
| 2287 | } ); |
---|
[4072] | 2288 | |
---|
[3036] | 2289 | }; |
---|
| 2290 | option_mark_important.innerHTML = get_lang("Normal"); |
---|
| 2291 | } |
---|
| 2292 | else{ |
---|
[4826] | 2293 | option_mark_important.onclick = function() {changeLinkState(this,'normal'); |
---|
[3716] | 2294 | proxy_mensagens.proxy_set_message_flag(folder_id,'flagged'); |
---|
[3036] | 2295 | write_msg(get_lang('Message marked as ')+get_lang("Important")); |
---|
| 2296 | }; |
---|
| 2297 | option_mark_important.innerHTML = get_lang("Important"); |
---|
| 2298 | } |
---|
[5134] | 2299 | //option_mark.appendChild(option_mark_as_unseen); |
---|
| 2300 | //option_mark.appendChild(option_mark_important); |
---|
| 2301 | |
---|
| 2302 | |
---|
[3021] | 2303 | option_hide_more.innerHTML = get_lang('Show details'); |
---|
[5134] | 2304 | option_hide_more.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'O') : get_lang('Show details'); |
---|
| 2305 | |
---|
| 2306 | var space3 = document.createElement("SPAN"); |
---|
| 2307 | space3.innerHTML = ' | '; |
---|
| 2308 | |
---|
| 2309 | var option_mark_as_options = document.createElement('IMG'); |
---|
| 2310 | option_mark_as_options.id = 'msg_opt_mark_options_'+ID; |
---|
| 2311 | option_mark_as_options.src = '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2312 | option_mark_as_options.value = 'show'; |
---|
| 2313 | |
---|
| 2314 | option_mark_as_options.onmouseover = function(){ |
---|
| 2315 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/over.png'; |
---|
| 2316 | option_mark_as.className = 'message_options_active'; |
---|
| 2317 | }; |
---|
| 2318 | option_mark_as_options.onmouseout = function(){ |
---|
| 2319 | option_mark_as.className = 'message_options'; |
---|
| 2320 | if (this.value == 'show') |
---|
| 2321 | { |
---|
| 2322 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2323 | } |
---|
| 2324 | else |
---|
| 2325 | { |
---|
| 2326 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2327 | } |
---|
| 2328 | }; |
---|
| 2329 | option_mark_as_options.onclick = function(){ |
---|
| 2330 | verifyOption('tr_other_mark_options_', ID); |
---|
| 2331 | if (this.value != 'hide'){ |
---|
| 2332 | this.value = 'hide'; |
---|
| 2333 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2334 | Element('tr_other_mark_options_'+ID).style.display = ''; |
---|
| 2335 | |
---|
| 2336 | } |
---|
| 2337 | else{ |
---|
| 2338 | this.value = 'show'; |
---|
| 2339 | option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2340 | Element('tr_other_mark_options_'+ID).style.display = 'none'; |
---|
| 2341 | } |
---|
| 2342 | }; |
---|
| 2343 | |
---|
[2] | 2344 | options.appendChild(option_hide_more); |
---|
[5134] | 2345 | options.appendChild(space3); |
---|
| 2346 | options.appendChild(option_mark_as_options); |
---|
| 2347 | options.appendChild(option_mark_as); |
---|
| 2348 | //FIM OPCAO PARA MARCAR COMO |
---|
[3021] | 2349 | |
---|
[24] | 2350 | var space0 = document.createElement("SPAN"); |
---|
[790] | 2351 | space0.innerHTML = ' | '; |
---|
[2] | 2352 | var space1 = document.createElement("SPAN"); |
---|
[790] | 2353 | space1.innerHTML = ' | '; |
---|
[2] | 2354 | var space2 = document.createElement("SPAN"); |
---|
[790] | 2355 | space2.innerHTML = ' | '; |
---|
[2] | 2356 | |
---|
[5134] | 2357 | //OPCAO PARA MAIS ACOES |
---|
| 2358 | var option_more = document.createElement("SPAN"); |
---|
| 2359 | option_more.id = 'msg_opt_more_actions_'+ID; |
---|
| 2360 | option_more.className = 'message_options'; |
---|
| 2361 | //option_more.onclick = function(){new_message('forward', ID);}; |
---|
| 2362 | option_more.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2363 | option_more.onmouseout=function () {this.className='message_options'}; |
---|
| 2364 | option_more.onclick = function(){ |
---|
| 2365 | verifyOption('tr_other_more_options_', ID); |
---|
| 2366 | if (option_more_options.value != 'hide'){ |
---|
| 2367 | option_more_options.value = 'hide'; |
---|
| 2368 | option_more_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2369 | Element('tr_other_more_options_'+ID).style.display = ''; |
---|
| 2370 | |
---|
| 2371 | } |
---|
| 2372 | else{ |
---|
| 2373 | option_more_options.value = 'show'; |
---|
| 2374 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2375 | Element('tr_other_more_options_'+ID).style.display = 'none'; |
---|
| 2376 | } |
---|
| 2377 | }; |
---|
| 2378 | option_more.innerHTML = get_lang('More Actions'); |
---|
| 2379 | |
---|
| 2380 | //CRIA IMG DE MAIS ACOES |
---|
| 2381 | var option_more_options = document.createElement('IMG'); |
---|
| 2382 | option_more_options.id = 'msg_opt_more_options_'+ID; |
---|
| 2383 | option_more_options.src = '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2384 | option_more_options.value = 'show'; |
---|
| 2385 | |
---|
| 2386 | option_more_options.onmouseover = function(){ |
---|
| 2387 | option_more.className = 'message_options_active'; |
---|
| 2388 | option_more_options.src= '../expressoMail1_2/templates/default/images/over.png'; |
---|
| 2389 | }; |
---|
| 2390 | option_more_options.onmouseout = function(){ |
---|
| 2391 | option_more.className = 'message_options'; |
---|
| 2392 | if (this.value == 'show') |
---|
| 2393 | { |
---|
| 2394 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2395 | } |
---|
| 2396 | else |
---|
| 2397 | { |
---|
| 2398 | option_more_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2399 | } |
---|
| 2400 | }; |
---|
| 2401 | option_more_options.onclick = function(){ |
---|
| 2402 | verifyOption('tr_other_more_options_',ID); |
---|
| 2403 | |
---|
| 2404 | if (this.value != 'hide'){ |
---|
| 2405 | this.value = 'hide'; |
---|
| 2406 | option_more_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2407 | Element('tr_other_more_options_'+ID).style.display = ''; |
---|
| 2408 | |
---|
| 2409 | } |
---|
| 2410 | else{ |
---|
| 2411 | this.value = 'show'; |
---|
| 2412 | option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2413 | Element('tr_other_more_options_'+ID).style.display = 'none'; |
---|
| 2414 | } |
---|
| 2415 | }; |
---|
[2] | 2416 | options.appendChild(space1); |
---|
[5134] | 2417 | options.appendChild(option_more_options); |
---|
| 2418 | options.appendChild(option_more); |
---|
| 2419 | //FIM OPCAO PARA MAIS ACOES |
---|
| 2420 | |
---|
| 2421 | //OPCAO PARA RESPONDER |
---|
[2] | 2422 | var option_reply = document.createElement("SPAN"); |
---|
[128] | 2423 | option_reply.id = 'msg_opt_reply_'+ID; |
---|
[2] | 2424 | option_reply.className = 'message_options'; |
---|
| 2425 | option_reply.onclick = function(){new_message('reply_with_history', ID);}; |
---|
[197] | 2426 | option_reply.innerHTML = get_lang('Reply'); |
---|
[4826] | 2427 | option_reply.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2428 | option_reply.onmouseout=function () {this.className='message_options'}; |
---|
[5134] | 2429 | option_reply.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'R') : get_lang('Reply'); |
---|
[3036] | 2430 | |
---|
[2] | 2431 | options.appendChild(space2); |
---|
[3021] | 2432 | |
---|
| 2433 | var option_reply_options = document.createElement('IMG'); |
---|
| 2434 | option_reply_options.id = 'msg_opt_reply_options_'+ID; |
---|
| 2435 | option_reply_options.src = '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2436 | option_reply_options.value = 'show'; |
---|
| 2437 | |
---|
| 2438 | option_reply_options.onmouseover = function(){ |
---|
| 2439 | option_reply_options.src= '../expressoMail1_2/templates/default/images/over.png'; |
---|
| 2440 | }; |
---|
| 2441 | option_reply_options.onmouseout = function(){ |
---|
| 2442 | if (this.value == 'show') |
---|
| 2443 | { |
---|
| 2444 | option_reply_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2445 | } |
---|
| 2446 | else |
---|
| 2447 | { |
---|
| 2448 | option_reply_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2449 | } |
---|
| 2450 | }; |
---|
| 2451 | option_reply_options.onclick = function(){ |
---|
[5134] | 2452 | verifyOption('tr_other_options_', ID); |
---|
[3021] | 2453 | if (this.value != 'hide'){ |
---|
| 2454 | this.value = 'hide'; |
---|
| 2455 | option_reply_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; |
---|
| 2456 | Element('tr_other_options_'+ID).style.display = ''; |
---|
| 2457 | |
---|
| 2458 | } |
---|
| 2459 | else{ |
---|
| 2460 | this.value = 'show'; |
---|
| 2461 | option_reply_options.src= '../expressoMail1_2/templates/default/images/down.png'; |
---|
| 2462 | Element('tr_other_options_'+ID).style.display = 'none'; |
---|
| 2463 | } |
---|
| 2464 | }; |
---|
| 2465 | options.appendChild(option_reply_options); |
---|
[2] | 2466 | options.appendChild(option_reply); |
---|
[5134] | 2467 | //FIM OPCAO PARA RESPONDER |
---|
| 2468 | |
---|
| 2469 | //OPCAO PARA ENCAMINHAR |
---|
| 2470 | var option_forward = document.createElement("SPAN"); |
---|
| 2471 | option_forward.id = 'msg_opt_forward_'+ID; |
---|
| 2472 | option_forward.className = 'message_options'; |
---|
| 2473 | option_forward.innerHTML = get_lang('Forward'); |
---|
| 2474 | option_forward.onclick = function(){new_message('forward', ID);}; |
---|
| 2475 | option_forward.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2476 | option_forward.onmouseout=function () {this.className='message_options'}; |
---|
| 2477 | option_forward.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'E') : get_lang('Forward'); |
---|
| 2478 | |
---|
| 2479 | var space9 = document.createElement("SPAN"); |
---|
| 2480 | space9.innerHTML = ' | '; |
---|
| 2481 | |
---|
| 2482 | options.appendChild(space9); |
---|
| 2483 | options.appendChild(option_forward); |
---|
| 2484 | //FIM DA OPCAO PARA ENCAMINHAR |
---|
| 2485 | |
---|
| 2486 | //OPCAO PARA DELETAR |
---|
| 2487 | var option_delete = document.createElement("SPAN"); |
---|
| 2488 | option_delete.id = 'msg_opt_delete_'+ID; |
---|
| 2489 | option_delete.className = 'message_options'; |
---|
| 2490 | option_delete.onclick = function(){proxy_mensagens.delete_msgs('null','selected','null');}; |
---|
| 2491 | option_delete.innerHTML = get_lang('Delete'); |
---|
| 2492 | option_delete.onmouseover=function () {this.className='message_options_active';}; |
---|
| 2493 | option_delete.onmouseout=function () {this.className='message_options'}; |
---|
| 2494 | option_delete.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'Delete') : get_lang('Delete'); |
---|
[3035] | 2495 | |
---|
[5134] | 2496 | var space6 = document.createElement("SPAN"); |
---|
| 2497 | space6.innerHTML = ' | '; |
---|
| 2498 | |
---|
| 2499 | options.appendChild(space6); |
---|
| 2500 | options.appendChild(option_delete); |
---|
| 2501 | //FIM OPCAO PARA DELETAR |
---|
| 2502 | |
---|
[2] | 2503 | tr.appendChild(td); |
---|
[5134] | 2504 | //tr.appendChild(option_mark); |
---|
[2] | 2505 | tr.appendChild(options); |
---|
| 2506 | tr.appendChild(next_previous_msg_td); |
---|
| 2507 | tbody_message_options.appendChild(tr); |
---|
[3035] | 2508 | |
---|
[2] | 2509 | ////////// OTHER OPTIONS //////////////////// |
---|
| 2510 | var tr_other_options = document.createElement("TR"); |
---|
[5134] | 2511 | var tr_other_mark_options = document.createElement("TR"); |
---|
| 2512 | var tr_other_more_options = document.createElement("TR"); |
---|
| 2513 | |
---|
| 2514 | tr_other_mark_options.id = 'tr_other_mark_options_' + ID; |
---|
| 2515 | tr_other_mark_options.style.display = 'none'; |
---|
| 2516 | tr_other_mark_options.style.backgroundColor = '#205C8E'; |
---|
[2] | 2517 | tr_other_options.id = 'tr_other_options_' + ID; |
---|
| 2518 | tr_other_options.style.display = 'none'; |
---|
[5134] | 2519 | tr_other_options.style.backgroundColor = '#205C8E'; |
---|
| 2520 | tr_other_more_options.id = 'tr_other_more_options_' + ID; |
---|
| 2521 | tr_other_more_options.style.display = 'none'; |
---|
| 2522 | tr_other_more_options.style.backgroundColor = '#205C8E'; |
---|
[3035] | 2523 | |
---|
[2] | 2524 | var td_other_options = document.createElement("TD"); |
---|
[5134] | 2525 | var td_other_mark_options = document.createElement("TD"); |
---|
| 2526 | var td_other_more_options = document.createElement("TD"); |
---|
| 2527 | |
---|
[2] | 2528 | td_other_options.colSpan = '3'; |
---|
[5134] | 2529 | td_other_mark_options.colSpan = '3'; |
---|
| 2530 | td_other_more_options.colSpan = '3'; |
---|
| 2531 | |
---|
[2] | 2532 | var div_other_options = document.createElement("DIV"); |
---|
[5134] | 2533 | var div_other_mark_options = document.createElement("DIV"); |
---|
| 2534 | var div_other_more_options = document.createElement("DIV"); |
---|
[2] | 2535 | |
---|
[5134] | 2536 | //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>, '; |
---|
| 2537 | //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>, '; |
---|
| 2538 | //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] | 2539 | 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] | 2540 | //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> | '; |
---|
| 2541 | 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> | '; |
---|
| 2542 | 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> | '; |
---|
| 2543 | 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] | 2544 | |
---|
[5134] | 2545 | option_reply_to_all__title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'T') : ''; |
---|
| 2546 | 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] | 2547 | 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] | 2548 | 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] | 2549 | |
---|
[5134] | 2550 | 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> | '; |
---|
| 2551 | |
---|
[5754] | 2552 | div_other_more_options.innerHTML += option_move + option_print + option_export + block_user + report_error; |
---|
[5134] | 2553 | |
---|
| 2554 | div_other_options.innerHTML += option_reply_without_history + option_reply_to_all_without_history + option_reply_to_all; |
---|
[69] | 2555 | if (use_spam_filter) { |
---|
[5134] | 2556 | if(info_msg.msg_folder == 'INBOX'+cyrus_delimiter+'Spam' || (info_msg.msg_folder.match(/^user/) && info_msg.msg_folder.match(/Spam$/))){ |
---|
| 2557 | 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] | 2558 | } |
---|
[5134] | 2559 | else{ |
---|
| 2560 | 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> | '; |
---|
| 2561 | } |
---|
| 2562 | } |
---|
| 2563 | var space5 = document.createElement("SPAN"); |
---|
| 2564 | space5.innerHTML = ' | '; |
---|
[4830] | 2565 | |
---|
[5134] | 2566 | div_other_mark_options.appendChild(option_mark_as_unseen); |
---|
| 2567 | var space4 = document.createElement("SPAN"); |
---|
| 2568 | space4.innerHTML = ' | '; |
---|
| 2569 | div_other_mark_options.appendChild(space4); |
---|
| 2570 | div_other_mark_options.appendChild(option_mark_important); |
---|
| 2571 | var space7 = document.createElement("SPAN"); |
---|
| 2572 | space7.innerHTML = ' | '; |
---|
| 2573 | div_other_mark_options.appendChild(space7); |
---|
[4830] | 2574 | |
---|
[3021] | 2575 | td_other_options.align = 'right'; |
---|
| 2576 | td_other_options.style.paddingTop = '3px'; |
---|
[2] | 2577 | td_other_options.appendChild(div_other_options); |
---|
[3021] | 2578 | |
---|
[5134] | 2579 | td_other_mark_options.align = 'right'; |
---|
| 2580 | td_other_mark_options.style.paddingTop = '3px'; |
---|
| 2581 | td_other_mark_options.appendChild(div_other_mark_options); |
---|
| 2582 | |
---|
| 2583 | td_other_more_options.align = 'right'; |
---|
| 2584 | td_other_more_options.style.paddingTop = '3px'; |
---|
| 2585 | td_other_more_options.appendChild(div_other_more_options); |
---|
[3021] | 2586 | |
---|
[5134] | 2587 | |
---|
[2] | 2588 | tr_other_options.appendChild(td_other_options); |
---|
| 2589 | tbody_message_options.appendChild(tr_other_options); |
---|
[5134] | 2590 | |
---|
| 2591 | tr_other_more_options.appendChild(td_other_more_options); |
---|
| 2592 | tbody_message_options.appendChild(tr_other_more_options); |
---|
| 2593 | |
---|
| 2594 | tr_other_mark_options.appendChild(td_other_mark_options); |
---|
| 2595 | tbody_message_options.appendChild(tr_other_mark_options); |
---|
[2] | 2596 | ////////// END OTHER OPTIONS //////////////// |
---|
[1035] | 2597 | |
---|
[3035] | 2598 | ////////// BEGIN SIGNATURE ////////////////// |
---|
[1035] | 2599 | if (info_msg.signature && info_msg.signature.length > 0) |
---|
| 2600 | { |
---|
[3352] | 2601 | var tr_signature = document.createElement("TR"); |
---|
| 2602 | var td_signature = document.createElement("TD"); |
---|
| 2603 | td_signature.className = 'tr_message_header'; |
---|
| 2604 | tr_signature.id = 'tr_signature_'+ID; |
---|
| 2605 | td_signature.colSpan = "5"; |
---|
| 2606 | tr_signature.style.display = 'none'; |
---|
| 2607 | for (i in info_msg.signature) |
---|
| 2608 | { |
---|
| 2609 | if(typeof(info_msg.signature[i]) == 'object') |
---|
| 2610 | { |
---|
| 2611 | var aux = ''; |
---|
| 2612 | for (ii in info_msg.signature[i]) |
---|
| 2613 | { |
---|
| 2614 | if(info_msg.signature[i][ii].indexOf("###") > -1) |
---|
| 2615 | { |
---|
| 2616 | 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); |
---|
| 2617 | } |
---|
| 2618 | else |
---|
| 2619 | { |
---|
| 2620 | aux += info_msg.signature[i][ii]; |
---|
| 2621 | } |
---|
| 2622 | } |
---|
| 2623 | td_signature.innerHTML += "<a onclick=\"javascript:alert('" + aux + "')\"><b><font color=\"#0000FF\">" + get_lang("More") + "...</font></b></a>"; |
---|
| 2624 | continue; |
---|
| 2625 | } |
---|
| 2626 | if(info_msg.signature[i].indexOf("#@#") > -1) |
---|
| 2627 | { |
---|
| 2628 | 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 /> '; |
---|
| 2629 | } |
---|
[4934] | 2630 | if(info_msg.signature[i].indexOf("###") > -1) |
---|
| 2631 | { |
---|
| 2632 | 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 /> '; |
---|
| 2633 | } |
---|
[3352] | 2634 | } |
---|
| 2635 | var signature_status_pos = info_msg.signature[0].indexOf('Message untouched'); |
---|
| 2636 | td_signature.id = "td_signature_"+ID; |
---|
| 2637 | if(signature_status_pos < 0 ) |
---|
| 2638 | { |
---|
| 2639 | td.innerHTML += ' <img style="cursor:pointer" src="templates/'+template+'/images/signed_error.gif" title="'+get_lang("Details")+'">'; |
---|
| 2640 | tr_signature.style.display = ''; |
---|
| 2641 | } |
---|
| 2642 | else |
---|
| 2643 | { |
---|
| 2644 | td.innerHTML += ' <img style="cursor:pointer" src="templates/'+template+'/images/signed_table.gif" title="'+get_lang("Details")+'">'; |
---|
| 2645 | } |
---|
| 2646 | td.onclick = function(){ |
---|
| 2647 | var _height = Element("div_message_scroll_"+ID).style.height; |
---|
| 2648 | _height = parseInt(_height.replace("px","")); |
---|
| 2649 | var _offset = 130; |
---|
| 2650 | if (this.value == 'more_cert'){ |
---|
| 2651 | this.value = 'hide_cert'; |
---|
| 2652 | Element("div_message_scroll_"+ID).style.height = (_height + _offset)+"px"; |
---|
| 2653 | Element('tr_signature_'+ID).style.display = 'none'; |
---|
| 2654 | Element('td_signature_'+ID).style.display = 'none'; |
---|
[1035] | 2655 | |
---|
[3352] | 2656 | } |
---|
| 2657 | else{ |
---|
| 2658 | this.value = 'more_cert'; |
---|
| 2659 | Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px"; |
---|
| 2660 | Element('tr_signature_'+ID).style.display = ''; |
---|
| 2661 | Element('td_signature_'+ID).style.display = ''; |
---|
| 2662 | } |
---|
[1035] | 2663 | }; |
---|
| 2664 | |
---|
[3352] | 2665 | tr_signature.appendChild(td_signature); |
---|
| 2666 | tbody_message_options.appendChild(tr_signature); |
---|
[1035] | 2667 | } |
---|
| 2668 | //////////// END SIGNATURE //////////////// |
---|
| 2669 | |
---|
[2] | 2670 | table_message_options.appendChild(tbody_message_options); |
---|
| 2671 | td0.appendChild(table_message_options); |
---|
| 2672 | tr0.appendChild(td0); |
---|
| 2673 | tbody_message.appendChild(tr0); |
---|
| 2674 | } |
---|
| 2675 | // IF DRAFT |
---|
| 2676 | else |
---|
| 2677 | { |
---|
| 2678 | var options = document.createElement("TD"); |
---|
[5417] | 2679 | //options.width = "1%"; |
---|
[2] | 2680 | options.setAttribute("noWrap","true"); |
---|
[3021] | 2681 | var option_edit = ' | <span class="message_options" onclick="new_message(\'edit\',\''+ID+'\');">'+get_lang('Edit')+'</span>'; |
---|
| 2682 | var option_print = ' | <span class="message_options" onclick="print_msg(\''+info_msg.msg_folder+'\',\''+info_msg.msg_number+'\',\''+ID+'\');">'+get_lang('Print')+'</span>'; |
---|
[271] | 2683 | var option_hide_more = document.createElement("SPAN"); |
---|
| 2684 | option_hide_more.className = 'message_options'; |
---|
| 2685 | options.align = 'right'; |
---|
| 2686 | option_hide_more.value = 'more_options'; |
---|
| 2687 | option_hide_more.id = 'option_hide_more_'+ID; |
---|
[3021] | 2688 | option_hide_more.innerHTML = get_lang('Show details'); |
---|
[271] | 2689 | option_hide_more.onclick = function(){ |
---|
| 2690 | var _height = Element("div_message_scroll_"+ID).style.height; |
---|
| 2691 | _height = parseInt(_height.replace("px","")); |
---|
| 2692 | var _offset = 35; |
---|
| 2693 | if (this.value == 'more_options'){ |
---|
[3021] | 2694 | this.innerHTML = "<b><u>"+get_lang('Hide details')+"</u></b>"; |
---|
[271] | 2695 | this.value = 'hide_options'; |
---|
| 2696 | Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px"; |
---|
| 2697 | Element('table_message_others_options_'+ID).style.display = ''; |
---|
| 2698 | } |
---|
| 2699 | else{ |
---|
[3021] | 2700 | this.innerHTML = get_lang('Show details'); |
---|
[271] | 2701 | this.value = 'more_options'; |
---|
| 2702 | Element("div_message_scroll_"+ID).style.height = (_height + _offset)+"px"; |
---|
| 2703 | Element('table_message_others_options_'+ID).style.display = 'none'; |
---|
| 2704 | } |
---|
| 2705 | }; |
---|
| 2706 | options.appendChild(option_hide_more); |
---|
[3021] | 2707 | options_actions = document.createElement('SPAN'); |
---|
| 2708 | options_actions.innerHTML = option_edit + option_print; |
---|
| 2709 | options.appendChild(options_actions); |
---|
[2] | 2710 | tr.appendChild(td); |
---|
| 2711 | tr.appendChild(options); |
---|
| 2712 | tr.appendChild(next_previous_msg_td); |
---|
| 2713 | tbody_message_options.appendChild(tr); |
---|
| 2714 | table_message_options.appendChild(tbody_message_options); |
---|
| 2715 | td0.appendChild(table_message_options); |
---|
| 2716 | tr0.appendChild(td0); |
---|
| 2717 | tbody_message.appendChild(tr0); |
---|
[4072] | 2718 | |
---|
[3798] | 2719 | var important_message = document.createElement("INPUT"); |
---|
| 2720 | important_message.id = "is_important_"+ID; |
---|
| 2721 | important_message.name = "is_important"; |
---|
| 2722 | important_message.type = "HIDDEN"; |
---|
| 2723 | important_message.value = (info_msg.Importance == "" || info_msg.Importance == "Normal") ? "0": "1"; |
---|
[4072] | 2724 | |
---|
[3798] | 2725 | options.appendChild(important_message); |
---|
[2] | 2726 | } |
---|
| 2727 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2728 | // END options message. |
---|
| 2729 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2730 | |
---|
| 2731 | var table_message_others_options = document.createElement("TABLE"); |
---|
| 2732 | table_message_others_options.id = 'table_message_others_options_' + ID; |
---|
[3018] | 2733 | table_message_others_options.width = "100%"; |
---|
[2] | 2734 | table_message_others_options.style.display = 'none'; |
---|
[5134] | 2735 | if(navigator.appName.indexOf('Internet Explorer')>0){ |
---|
| 2736 | table_message_others_options.className = "table_message_options_ie"; |
---|
| 2737 | }else{ |
---|
| 2738 | table_message_others_options.className = "table_message_options"; |
---|
| 2739 | } |
---|
| 2740 | |
---|
[2] | 2741 | var tbody_message_others_options = document.createElement("TBODY"); |
---|
| 2742 | var tr1 = document.createElement("TR"); |
---|
| 2743 | tr1.className = "tr_message_header"; |
---|
| 2744 | var td1 = document.createElement("TD"); |
---|
[83] | 2745 | td1.innerHTML = get_lang("From: "); |
---|
[271] | 2746 | td1.appendChild(deny_email(info_msg.from.email)); |
---|
[2] | 2747 | td1.width = "7%"; |
---|
[3035] | 2748 | |
---|
[2] | 2749 | if (info_msg.sender){ |
---|
| 2750 | var tr111 = document.createElement("TR"); |
---|
| 2751 | tr111.className = "tr_message_header"; |
---|
| 2752 | var td111 = document.createElement("TD"); |
---|
| 2753 | td111.innerHTML = get_lang("Sent by")+": "; |
---|
[271] | 2754 | td111.appendChild(deny_email(info_msg.sender.email)); |
---|
[2] | 2755 | td111.setAttribute("noWrap","true"); |
---|
| 2756 | var sender = document.createElement("TD"); |
---|
| 2757 | sender.id = "sender_"+ID; |
---|
| 2758 | var sender_values = document.createElement("INPUT"); |
---|
| 2759 | sender_values.id = "sender_values_"+ID; |
---|
| 2760 | sender_values.type = "HIDDEN"; |
---|
| 2761 | sender_values.value = info_msg.sender.full; //Veio do IMAP, sem images nem links. |
---|
| 2762 | sender.innerHTML += draw_plugin_cc(ID, info_msg.sender.full); |
---|
| 2763 | sender.className = "header_message_field"; |
---|
| 2764 | tr111.appendChild(td111); |
---|
| 2765 | tr111.appendChild(sender); |
---|
| 2766 | tr111.appendChild(sender_values); |
---|
| 2767 | tbody_message_others_options.appendChild(tr111); |
---|
| 2768 | } |
---|
[3035] | 2769 | |
---|
[2] | 2770 | var from = document.createElement("TD"); |
---|
| 2771 | from.id = "from_"+ID; |
---|
| 2772 | from.innerHTML = info_msg.from.full; |
---|
| 2773 | if (info_msg.Draft != "X"){ |
---|
| 2774 | from.innerHTML += draw_plugin_cc(ID, info_msg.from); |
---|
| 2775 | tbody_message_others_options.appendChild(tr1); |
---|
| 2776 | } |
---|
| 2777 | from.className = "header_message_field"; |
---|
| 2778 | var from_values = document.createElement("INPUT"); |
---|
| 2779 | from_values.id = "from_values_"+ID; |
---|
| 2780 | from_values.type = "HIDDEN"; |
---|
| 2781 | from_values.value = info_msg.from.full; //Veio do IMAP, sem images nem links. |
---|
[790] | 2782 | |
---|
[689] | 2783 | var local_message = document.createElement("INPUT"); |
---|
| 2784 | local_message.id = "is_local_"+ID; |
---|
| 2785 | local_message.name = "is_local"; |
---|
| 2786 | local_message.type = "HIDDEN"; |
---|
| 2787 | local_message.value = (info_msg.local_message)?"1":"0"; |
---|
[790] | 2788 | |
---|
[2] | 2789 | tr1.appendChild(td1); |
---|
| 2790 | tr1.appendChild(from); |
---|
| 2791 | tr1.appendChild(from_values); |
---|
[689] | 2792 | tr1.appendChild(local_message); |
---|
| 2793 | |
---|
[2] | 2794 | if (info_msg.reply_to){ |
---|
| 2795 | var tr11 = document.createElement("TR"); |
---|
| 2796 | tr11.className = "tr_message_header"; |
---|
| 2797 | var td11 = document.createElement("TD"); |
---|
| 2798 | td11.innerHTML = get_lang("Reply to")+": "; |
---|
| 2799 | td11.setAttribute("noWrap","true"); |
---|
| 2800 | var reply_to = document.createElement("TD"); |
---|
| 2801 | reply_to.id = "reply_to_"+ID; |
---|
[3035] | 2802 | |
---|
[2] | 2803 | var reply_to_values = document.createElement("INPUT"); |
---|
| 2804 | reply_to_values.id = "reply_to_values_"+ID; |
---|
| 2805 | reply_to_values.type = "HIDDEN"; |
---|
| 2806 | reply_to_values.value = info_msg.reply_to; //Veio do IMAP, sem images nem links. |
---|
| 2807 | reply_to.innerHTML = draw_plugin_cc(ID, info_msg.reply_to); |
---|
| 2808 | reply_to.className = "header_message_field"; |
---|
| 2809 | tr11.appendChild(td11); |
---|
| 2810 | tr11.appendChild(reply_to); |
---|
| 2811 | tr11.appendChild(reply_to_values); |
---|
| 2812 | tbody_message_others_options.appendChild(tr11); |
---|
| 2813 | } |
---|
| 2814 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2815 | var tr2 = document.createElement("TR"); |
---|
| 2816 | tr2.className = "tr_message_header"; |
---|
| 2817 | var td2 = document.createElement("TD"); |
---|
[5134] | 2818 | td2.width = "7%"; |
---|
[83] | 2819 | td2.innerHTML = get_lang("To: "); |
---|
[2] | 2820 | var to = document.createElement("TD"); |
---|
| 2821 | to.id = "to_"+ID; |
---|
| 2822 | |
---|
| 2823 | var to_values = document.createElement("INPUT"); |
---|
| 2824 | to_values.id = "to_values_"+ID; |
---|
| 2825 | to_values.type = "HIDDEN"; |
---|
[3035] | 2826 | to_values.value = info_msg.toaddress2; //Veio do IMAP, sem images nem links. |
---|
[63] | 2827 | // Salva a pasta da mensagem |
---|
[3035] | 2828 | var input_current_folder = document.createElement('input'); |
---|
[63] | 2829 | input_current_folder.id = "input_folder_"+ID; |
---|
| 2830 | input_current_folder.name = "input_folder"; |
---|
| 2831 | input_current_folder.type = "hidden"; |
---|
| 2832 | input_current_folder.value = info_msg.msg_folder; |
---|
[3035] | 2833 | td2.appendChild(input_current_folder); |
---|
[63] | 2834 | // fim |
---|
[3847] | 2835 | // ALEXANDRE LUIZ CORREIA |
---|
| 2836 | if(info_msg.toaddress2 != null ) |
---|
| 2837 | { |
---|
| 2838 | toaddress_array[ID] = info_msg.toaddress2.split(","); |
---|
[4072] | 2839 | |
---|
[3847] | 2840 | if (toaddress_array[ID].length > 1) |
---|
| 2841 | { |
---|
| 2842 | to.innerHTML += draw_plugin_cc(ID, toaddress_array[ID][0]); |
---|
| 2843 | var div_toaddress = document.createElement("SPAN"); |
---|
| 2844 | div_toaddress.id = "div_toaddress_"+ID; |
---|
| 2845 | div_toaddress.style.display=""; |
---|
| 2846 | div_toaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','to');>"+get_lang('more')+"</a>)"; |
---|
| 2847 | to.appendChild(div_toaddress); |
---|
[4072] | 2848 | } |
---|
[3847] | 2849 | else |
---|
| 2850 | { |
---|
| 2851 | toAdd = toaddress_array[ID].toString() |
---|
| 2852 | if( trim(toAdd) != "" ) { |
---|
| 2853 | toAdd = toAdd.replace("<","<").replace(">",">"); |
---|
| 2854 | } else { |
---|
| 2855 | toAdd = get_lang("without destination"); |
---|
| 2856 | } |
---|
[4072] | 2857 | |
---|
[3847] | 2858 | to.innerHTML += draw_plugin_cc(ID,toAdd); |
---|
[3770] | 2859 | } |
---|
[4072] | 2860 | |
---|
[3847] | 2861 | to.className = "header_message_field"; |
---|
| 2862 | tr2.appendChild(td2); |
---|
| 2863 | tr2.appendChild(to); |
---|
| 2864 | tr2.appendChild(to_values); |
---|
[2] | 2865 | } |
---|
[4072] | 2866 | |
---|
[2] | 2867 | tbody_message_others_options.appendChild(tr2); |
---|
| 2868 | |
---|
| 2869 | if (info_msg.cc){ |
---|
| 2870 | var tr3 = document.createElement("TR"); |
---|
| 2871 | tr3.className = "tr_message_header"; |
---|
| 2872 | var td3 = document.createElement("TD"); |
---|
| 2873 | td3.innerHTML = "CC: "; |
---|
| 2874 | var cc = document.createElement("TD"); |
---|
| 2875 | cc.id = "cc_"+ID; |
---|
| 2876 | |
---|
| 2877 | var cc_values = document.createElement("INPUT"); |
---|
| 2878 | cc_values.id = "cc_values_"+ID; |
---|
| 2879 | cc_values.type = "HIDDEN"; |
---|
| 2880 | cc_values.value = info_msg.cc; |
---|
[3035] | 2881 | |
---|
| 2882 | ccaddress_array[ID] = info_msg.cc.split(","); |
---|
[13] | 2883 | if (ccaddress_array[ID].length > 1){ |
---|
[2] | 2884 | var div_ccaddress = document.createElement("SPAN"); |
---|
| 2885 | div_ccaddress.id = "div_ccaddress_"+ID; |
---|
| 2886 | var div_ccaddress_full = document.createElement("SPAN"); |
---|
[3035] | 2887 | div_ccaddress_full.id = "div_ccaddress_full_"+ID; |
---|
[2] | 2888 | div_ccaddress.style.display=""; |
---|
[13] | 2889 | cc.innerHTML = draw_plugin_cc(ID, ccaddress_array[ID][0]); |
---|
| 2890 | div_ccaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','cc');>"+get_lang('more')+"</a>)"; |
---|
| 2891 | cc.appendChild(div_ccaddress); |
---|
[2] | 2892 | } |
---|
| 2893 | else{ |
---|
| 2894 | cc.innerHTML = draw_plugin_cc(ID, info_msg.cc); |
---|
| 2895 | } |
---|
| 2896 | cc.className = "header_message_field"; |
---|
| 2897 | tr3.appendChild(td3); |
---|
| 2898 | tr3.appendChild(cc); |
---|
| 2899 | tr3.appendChild(cc_values); |
---|
| 2900 | tbody_message_others_options.appendChild(tr3); |
---|
| 2901 | } |
---|
[427] | 2902 | |
---|
| 2903 | /* |
---|
| 2904 | * @AUTHOR Rodrigo Souza dos Santos |
---|
| 2905 | * @MODIFY-DATE 2008/09/11 |
---|
| 2906 | * @BRIEF Adding routine to create bcc field if there is one. |
---|
| 2907 | */ |
---|
| 2908 | if (info_msg.bcc) |
---|
| 2909 | { |
---|
| 2910 | var tr3 = document.createElement("tr"); |
---|
| 2911 | tr3.className = "tr_message_header"; |
---|
| 2912 | var td3 = document.createElement("td"); |
---|
| 2913 | td3.innerHTML = get_lang("BCC") + " : "; |
---|
| 2914 | var cco = document.createElement("td"); |
---|
| 2915 | cco.id = "cco_"+ID; |
---|
| 2916 | |
---|
| 2917 | var cco_values = document.createElement("input"); |
---|
| 2918 | cco_values.id = "cco_values_"+ID; |
---|
| 2919 | cco_values.type = "hidden"; |
---|
[1638] | 2920 | cco_values.value = info_msg.bcc; |
---|
[427] | 2921 | |
---|
[3035] | 2922 | ccoaddress_array[ID] = info_msg.bcc.split(","); |
---|
[427] | 2923 | if (ccoaddress_array[ID].length > 1){ |
---|
| 2924 | var div_ccoaddress = document.createElement("SPAN"); |
---|
| 2925 | div_ccoaddress.id = "div_ccoaddress_"+ID; |
---|
| 2926 | var div_ccoaddress_full = document.createElement("SPAN"); |
---|
[3035] | 2927 | div_ccoaddress_full.id = "div_ccoaddress_full_"+ID; |
---|
[427] | 2928 | div_ccoaddress.style.display=""; |
---|
| 2929 | |
---|
| 2930 | //cco.innerHTML = draw_plugin_cc(ID, ccoaddress_array[ID][0]); |
---|
| 2931 | cco.innerHTML = ccoaddress_array[ID][0]; |
---|
| 2932 | div_ccoaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','cco');>"+get_lang('more')+"</a>)"; |
---|
| 2933 | cco.appendChild(div_ccoaddress); |
---|
| 2934 | } |
---|
| 2935 | else{ |
---|
| 2936 | //cco.innerHTML = draw_plugin_cc(ID, info_msg.cco); |
---|
| 2937 | cco.innerHTML = info_msg.bcc; |
---|
| 2938 | } |
---|
| 2939 | cco.className = "header_message_field"; |
---|
| 2940 | tr3.appendChild(td3); |
---|
| 2941 | tr3.appendChild(cco); |
---|
| 2942 | tr3.appendChild(cco_values); |
---|
| 2943 | tbody_message_others_options.appendChild(tr3); |
---|
| 2944 | } |
---|
| 2945 | |
---|
[2] | 2946 | var tr4 = document.createElement("TR"); |
---|
| 2947 | tr4.className = "tr_message_header"; |
---|
| 2948 | var td4 = document.createElement("TD"); |
---|
[83] | 2949 | td4.innerHTML = get_lang("Date: "); |
---|
[2] | 2950 | var date = document.createElement("TD"); |
---|
| 2951 | date.id = "date_"+ID; |
---|
| 2952 | date.innerHTML = info_msg.fulldate; |
---|
| 2953 | var date_day = document.createElement("INPUT"); |
---|
| 2954 | date_day.id = "date_day_"+ID; |
---|
| 2955 | date_day.type = "HIDDEN"; |
---|
| 2956 | date_day.value = info_msg.msg_day; |
---|
| 2957 | var date_hour = document.createElement("INPUT"); |
---|
| 2958 | date_hour.id = "date_hour_"+ID; |
---|
| 2959 | date_hour.type = "HIDDEN"; |
---|
| 2960 | date_hour.value = info_msg.msg_hour |
---|
| 2961 | date.className = "header_message_field"; |
---|
| 2962 | tr4.appendChild(td4); |
---|
| 2963 | tr4.appendChild(date); |
---|
| 2964 | tr4.appendChild(date_day); |
---|
| 2965 | tr4.appendChild(date_hour); |
---|
| 2966 | tbody_message_others_options.appendChild(tr4); |
---|
[3035] | 2967 | |
---|
[2] | 2968 | var tr5 = document.createElement("TR"); |
---|
| 2969 | tr5.className = "tr_message_header"; |
---|
| 2970 | var td5 = document.createElement("TD"); |
---|
[83] | 2971 | td5.innerHTML = get_lang("Subject"); |
---|
[2] | 2972 | var subject = document.createElement("TD"); |
---|
| 2973 | subject.id = "subject_"+ID; |
---|
[6109] | 2974 | subject.innerHTML = html_entities(info_msg.subject); |
---|
[2] | 2975 | subject.className = "header_message_field"; |
---|
[5804] | 2976 | if(defaultCalendar == "expressoCalendar" && $("#expressoCalendarid")[0]){ |
---|
[5392] | 2977 | var new_event_logo = document.createElement("IMG"); |
---|
| 2978 | new_event_logo.title = "Criar evento a partir deste email"; |
---|
| 2979 | new_event_logo.alt = "Criar evento a partir deste email"; |
---|
| 2980 | new_event_logo.src = "./templates/default/images/calendar_add.png"; |
---|
| 2981 | new_event_logo.style.cursor = "pointer"; |
---|
| 2982 | new_event_logo.style.marginLeft = "5px"; |
---|
| 2983 | new_event_logo.onclick = function(){ |
---|
[5619] | 2984 | import_implements_calendar(); |
---|
| 2985 | |
---|
| 2986 | |
---|
[5392] | 2987 | DataLayer.dispatchPath = "../prototype/"; |
---|
| 2988 | var path = "../prototype/modules/calendar/"; |
---|
[5409] | 2989 | |
---|
| 2990 | var startEvent = new Date(); |
---|
| 2991 | if(startEvent.toString('mm') < 30) |
---|
| 2992 | startEvent.add({minutes: (30 - parseInt(startEvent.toString('mm')))}); |
---|
| 2993 | else |
---|
| 2994 | startEvent.add({hours: 1, minutes: '-'+startEvent.toString('mm')}); |
---|
| 2995 | var endEvent = function(date){ |
---|
| 2996 | if(!!User.preferences.defaultCalendar){ |
---|
[5592] | 2997 | return new Date(parseInt(date.getTime()) + |
---|
| 2998 | (!!Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration ? |
---|
[5409] | 2999 | (Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration * 60000) : |
---|
| 3000 | (User.preferences.defaultDuration * 60000) |
---|
[5592] | 3001 | )); |
---|
[5409] | 3002 | }else |
---|
[5592] | 3003 | return new Date(parseInt(date.getTime()) + (User.preferences.defaultDuration * 60000)); |
---|
[5409] | 3004 | }; |
---|
[5592] | 3005 | |
---|
| 3006 | var emails = $("#to_values_"+ID).val().split(','); |
---|
| 3007 | |
---|
| 3008 | |
---|
| 3009 | //Normalização dos dados evita ter que reemplementar toda as funcionalidades do calendar |
---|
[5392] | 3010 | eventDetails({ |
---|
[5592] | 3011 | |
---|
| 3012 | acl: {inviteGuests: true, organization: true ,participationRequired: false, read: true, write: true}, |
---|
| 3013 | alarms: [], |
---|
| 3014 | allDay: false, |
---|
| 3015 | attachments: [], |
---|
[6332] | 3016 | isAttendee: true, |
---|
[6393] | 3017 | attendee: '',//TODOOOOOO, |
---|
[5592] | 3018 | calendar: User.preferences.defaultCalendar ? User.preferences.defaultCalendar : Calendar.calendars[0], |
---|
| 3019 | calendars: Calendar.calendars, |
---|
| 3020 | category: '', |
---|
[5658] | 3021 | 'class': '1', |
---|
[5592] | 3022 | delegatedFrom: {}, |
---|
| 3023 | endDate: startEvent.toString(User.preferences.dateFormat), |
---|
| 3024 | startDate: endEvent(startEvent).toString(User.preferences.dateFormat), |
---|
| 3025 | startHour: startEvent.toString(User.preferences.hourFormat), |
---|
| 3026 | endHour: endEvent(startEvent).toString(User.preferences.hourFormat), |
---|
[6393] | 3027 | timezone: User.preferences.defaultCalendar ? Calendar.signatureOf[User.preferences.defaultCalendar].calendar.timezone : User.preferences.timezone, |
---|
[5392] | 3028 | summary : $("#subject_"+ID).text(), |
---|
| 3029 | description : $("#body_" + ID).text(), |
---|
[5409] | 3030 | startTime: startEvent.getTime(), |
---|
[5592] | 3031 | endTime: endEvent(startEvent), |
---|
| 3032 | timezones: Timezone.timezones, |
---|
| 3033 | me: {name: User.me.name, mail: User.me.mail, acl: 'rowi', status: '1', delegatedFrom: '0', id: User.me.id}, |
---|
| 3034 | organizer: {name: User.me.name, mail: User.me.mail, acl: 'rowi', status: '1', delegatedFrom: '0' , id: User.me.id}, |
---|
| 3035 | statusParticipants: {accepted: 0, cancelled: 0, tentative: 0, unanswered:emails.length}, |
---|
| 3036 | location: '', |
---|
| 3037 | attendee: $.map(emails, function( mail ){ |
---|
| 3038 | |
---|
| 3039 | var decoded = Encoder.htmlDecode(mail); |
---|
| 3040 | var newAttendeeName = ""; |
---|
[5389] | 3041 | |
---|
[5592] | 3042 | var user = DataLayer.get('user', ["=", "mail", decoded.match(/<([^<]*)>[\s]*$/) ? decoded.match(/<([^<]*)>[\s]*$/)[1].toLowerCase() : decoded], true); |
---|
| 3043 | |
---|
| 3044 | if( $.type(user) == "array") |
---|
| 3045 | user = user[0]; |
---|
[5392] | 3046 | |
---|
[5592] | 3047 | if(!user) |
---|
| 3048 | user = {name : decoded.match(/"([^"]*)"/)[1] , mail : decoded.match(/[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])/)[1]}; |
---|
| 3049 | |
---|
| 3050 | if(User.me.mail == user.mail) |
---|
| 3051 | return(null); |
---|
| 3052 | |
---|
| 3053 | user.isExternal = (!!user && !(!!user.isExternal)) ? 0 : 1; |
---|
| 3054 | |
---|
| 3055 | return DataLayer.merge({ |
---|
| 3056 | name: user.name, |
---|
| 3057 | mail: user.mail, |
---|
| 3058 | acl: 'r', |
---|
| 3059 | delegatedFrom: '0', |
---|
| 3060 | status: '4' |
---|
[6265] | 3061 | }, !!user.id ? {id : DataLayer.put('participant', {user: user.id, isExternal: user.isExternal})} : {id: DataLayer.put('participant', {user: user})}); |
---|
[5592] | 3062 | |
---|
| 3063 | }) |
---|
[5392] | 3064 | |
---|
[5592] | 3065 | }, true, path, true); |
---|
[5392] | 3066 | } |
---|
| 3067 | subject.appendChild(new_event_logo); |
---|
[5389] | 3068 | } |
---|
[2] | 3069 | tr5.appendChild(td5); |
---|
| 3070 | tr5.appendChild(subject); |
---|
| 3071 | tbody_message_others_options.appendChild(tr5); |
---|
[4493] | 3072 | //k! |
---|
[5535] | 3073 | |
---|
| 3074 | |
---|
[5866] | 3075 | var update_labeleds_msg = function(){ |
---|
| 3076 | //TODO Mudar quando API abstrair atualizações no cache |
---|
| 3077 | DataLayer.remove('labeled', false); |
---|
[6109] | 3078 | //DataLayer.get('labeled'); |
---|
[5866] | 3079 | var labels = DataLayer.get("labeled", {filter: [ |
---|
| 3080 | 'AND', |
---|
| 3081 | ['=', 'folderName', current_folder], |
---|
| 3082 | ['=','messageNumber',folder_id]], |
---|
| 3083 | criteria : {deepness: 2}} ); |
---|
[5535] | 3084 | |
---|
[5866] | 3085 | if(labels.length != 0){ |
---|
| 3086 | var tr8 = document.createElement("TR"); |
---|
| 3087 | tr8.className = "tr_message_header"; |
---|
| 3088 | var td8 = document.createElement("TD"); |
---|
| 3089 | td8.innerHTML = get_lang("Labels: "); |
---|
| 3090 | var markers = document.createElement("TD"); |
---|
| 3091 | markers.id = "markers_"+ID; |
---|
[5535] | 3092 | |
---|
[5866] | 3093 | for(var i=0; i<labels.length; i++){ |
---|
| 3094 | fontColor = labels[i].label.fontColor; |
---|
| 3095 | borderColor = labels[i].label.borderColor; |
---|
| 3096 | backgroundColor = labels[i].label.backgroundColor; |
---|
| 3097 | nameLabel = labels[i].label.name; |
---|
| 3098 | id = labels[i].id; |
---|
| 3099 | 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>"; |
---|
| 3100 | |
---|
| 3101 | } |
---|
| 3102 | $(markers).find('span.removeLabeledMsg').click(function(event){ |
---|
| 3103 | var id_labeled = $(event.target).attr("id"); |
---|
| 3104 | //TODO Mudar quando API abstrair atualizações no cache |
---|
[6109] | 3105 | //DataLayer.remove('labeled', false); |
---|
| 3106 | //DataLayer.get('labeled'); |
---|
[5866] | 3107 | DataLayer.remove('labeled', id_labeled); |
---|
| 3108 | DataLayer.commit(false, false, function(){ |
---|
| 3109 | var index_folder = id_labeled.lastIndexOf('/'); |
---|
| 3110 | var folder_name = id_labeled.slice(0,index_folder); |
---|
| 3111 | var index_number = id_labeled.lastIndexOf('#'); |
---|
| 3112 | var msg_number = id_labeled.slice(index_folder + 1,index_number); |
---|
| 3113 | updateLabelsColumn({msg_number:msg_number, boxname:folder_name, labels:false}); |
---|
| 3114 | update_labeleds_msg(); |
---|
| 3115 | tbody_message_others_options.removeChild(tr8); |
---|
| 3116 | }); |
---|
| 3117 | |
---|
| 3118 | }); |
---|
| 3119 | markers.className = "header_message_field"; |
---|
| 3120 | tr8.appendChild(td8); |
---|
| 3121 | tr8.appendChild(markers); |
---|
| 3122 | tbody_message_others_options.appendChild(tr8); |
---|
[5535] | 3123 | } |
---|
| 3124 | } |
---|
[5967] | 3125 | |
---|
[4493] | 3126 | if ( info_msg.attachments && info_msg.attachments.length > 0 ) |
---|
| 3127 | { |
---|
[5134] | 3128 | //Código no padrão expresso 2.2 |
---|
| 3129 | var tr6 = document.createElement("TR"); |
---|
| 3130 | tr6.className = "tr_message_header"; |
---|
| 3131 | var td6 = document.createElement("TD"); |
---|
| 3132 | td6.innerHTML = get_lang("Attachments: "); |
---|
[4493] | 3133 | |
---|
| 3134 | |
---|
[5134] | 3135 | var attachments = document.createElement("TD"); |
---|
| 3136 | td6.valign = "top"; |
---|
| 3137 | attachments.align = 'left'; |
---|
| 3138 | if(info_msg.attachments.length >= 1){ |
---|
[4820] | 3139 | if(info_msg.attachments.length > 1) { |
---|
| 3140 | var link_attachment = document.createElement("A"); |
---|
| 3141 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
| 3142 | link_attachment.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3143 | else |
---|
| 3144 | link_attachment.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3145 | link_attachment.innerHTML = " "+info_msg.attachments.length+' '+get_lang('files')+' :: '+get_lang('Download all atachments'); |
---|
[5134] | 3146 | attachments.appendChild(link_attachment); |
---|
[4820] | 3147 | } |
---|
| 3148 | if(parseInt(preferences.remove_attachments_function)) |
---|
| 3149 | { |
---|
[5134] | 3150 | attachments.appendChild(document.createTextNode(' ')); |
---|
| 3151 | var del_attachments = document.createElement("A"); |
---|
| 3152 | del_attachments.setAttribute("href", "javascript:remove_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3153 | del_attachments.innerHTML = get_lang('remove all attachments'); |
---|
| 3154 | attachments.appendChild(del_attachments); |
---|
[4820] | 3155 | } |
---|
[5134] | 3156 | attachments.appendChild(document.createElement('BR')); |
---|
| 3157 | } |
---|
| 3158 | attachments.id = "attachments_" + ID; |
---|
[4493] | 3159 | for (var i=0; i<info_msg.attachments.length; i++) |
---|
| 3160 | { |
---|
[5134] | 3161 | var link_attachment = document.createElement("a"); |
---|
[689] | 3162 | link_attachment.setAttribute("href", proxy_mensagens.link_anexo(info_msg,i)); |
---|
[4493] | 3163 | link_attachment.innerHTML = url_decode(info_msg.attachments[i].name) + " ("+borkb(info_msg.attachments[i].fsize)+")"; |
---|
[5134] | 3164 | //link_attachment.innerHTML += " ("+borkb(info_msg.attachments[i].fsize)+")"; |
---|
[4072] | 3165 | |
---|
[4493] | 3166 | //k trocar por match??? |
---|
| 3167 | if((url_decode(info_msg.attachments[i].name).indexOf(".ics")!=-1) || (url_decode(info_msg.attachments[i].name).indexOf(".vcard")!=-1)) |
---|
[3519] | 3168 | { |
---|
[620] | 3169 | //Link para importar calendário |
---|
[673] | 3170 | var link_import_attachment = new Image(); |
---|
[790] | 3171 | link_import_attachment.src = "templates/"+template+"/images/new.png"; |
---|
[3519] | 3172 | 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] | 3173 | link_import_attachment.title = get_lang("Import to calendar"); |
---|
[3035] | 3174 | link_import_attachment.align = "top"; |
---|
[3519] | 3175 | link_import_attachment.style.marginLeft = "5px"; |
---|
[673] | 3176 | link_import_attachment.style.cursor = "pointer"; |
---|
[3519] | 3177 | link_attachment.appendChild(link_import_attachment); |
---|
[620] | 3178 | } |
---|
[4820] | 3179 | |
---|
[5134] | 3180 | if((url_decode(info_msg.attachments[i].name).indexOf(".eml") != -1)) |
---|
| 3181 | { |
---|
| 3182 | //Link para importar calendário |
---|
| 3183 | var link_open_msg = new Image(); |
---|
| 3184 | link_open_msg.src = "templates/"+template+"/images/email.png"; |
---|
| 3185 | //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;"); |
---|
| 3186 | 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;"); |
---|
| 3187 | link_open_msg.title = get_lang("Open message"); |
---|
| 3188 | link_open_msg.align = "top"; |
---|
| 3189 | link_open_msg.style.marginLeft = "5px"; |
---|
| 3190 | link_open_msg.style.cursor = "pointer"; |
---|
| 3191 | link_attachment.appendChild(link_open_msg); |
---|
[2] | 3192 | } |
---|
[4493] | 3193 | |
---|
[5134] | 3194 | link_attachment.innerHTML += '<br/>'; |
---|
| 3195 | attachments.appendChild(link_attachment); |
---|
| 3196 | } |
---|
[2] | 3197 | tr6.appendChild(td6); |
---|
[5134] | 3198 | tr6.appendChild(attachments); |
---|
[2] | 3199 | tbody_message_others_options.appendChild(tr6); |
---|
[4820] | 3200 | } |
---|
[5134] | 3201 | |
---|
[4493] | 3202 | //k!! |
---|
[6463] | 3203 | |
---|
[2] | 3204 | var div = document.createElement("DIV"); |
---|
| 3205 | div.id = "div_message_scroll_"+ID; |
---|
[5134] | 3206 | div.style.background = 'WHITE'; |
---|
| 3207 | div.style.overflow = "auto"; |
---|
[2] | 3208 | table_message_others_options.appendChild(tbody_message_others_options); |
---|
| 3209 | var tr = document.createElement("TR"); |
---|
[5134] | 3210 | tr.className = "tr_message_header"; |
---|
[2] | 3211 | var td = document.createElement("TD"); |
---|
[5134] | 3212 | td.colspan = '2'; |
---|
[5083] | 3213 | td.style.fontSize = '10pt'; |
---|
| 3214 | td.style.fontFamily = 'Arial,Verdana'; |
---|
| 3215 | td.style.verticalAlign = 'top'; |
---|
| 3216 | td.style.height = '100%'; |
---|
[2] | 3217 | div.appendChild(table_message_others_options); |
---|
[3018] | 3218 | var imgTag = info_msg.body.match(/(<img[^>]*src[^>=]*=['"]?[^'">]*["']?[^>]*>)|(<[^>]*(style[^=>]*=['"][^>]*background(-image)?:[^:;>]*url\()[^>]*>)/gi); |
---|
[790] | 3219 | var newBody = info_msg.body; |
---|
| 3220 | if(!info_msg.showImg && imgTag) |
---|
| 3221 | { |
---|
| 3222 | var domains = ''; |
---|
| 3223 | var blocked = false; |
---|
| 3224 | var forbidden = true; |
---|
[1637] | 3225 | |
---|
| 3226 | if (preferences.notification_domains != null && typeof(preferences.notification_domains) != 'undefined') |
---|
| 3227 | { |
---|
[790] | 3228 | domains = preferences.notification_domains.split(','); |
---|
[1637] | 3229 | for(var j = 0; j < imgTag.length; j++) |
---|
[790] | 3230 | { |
---|
[1637] | 3231 | for (var i = 0; i < domains.length; i++) |
---|
| 3232 | { |
---|
[5134] | 3233 | if (imgTag[j].match(/cid:([\w\d]){5,}/) || imgTag[j].match(/src=\"\.\/inc\/get_archive\.php/g)) |
---|
[3018] | 3234 | { |
---|
| 3235 | forbidden = false; |
---|
| 3236 | continue; |
---|
| 3237 | } |
---|
[1637] | 3238 | imgSource = imgTag[j].match(/=['"](http:\/\/)+[^'"\/]*/); |
---|
| 3239 | if (imgSource && imgSource.toString().substr(5).match(domains[i])) |
---|
| 3240 | forbidden = false; |
---|
| 3241 | } |
---|
| 3242 | if (forbidden) |
---|
| 3243 | { |
---|
[5134] | 3244 | newBody = newBody.replace(imgTag[j],"<img src='templates/"+template+"/images/forbidden.png'>"); |
---|
[1637] | 3245 | blocked=true; |
---|
| 3246 | } |
---|
[790] | 3247 | } |
---|
[1637] | 3248 | if (blocked) |
---|
[790] | 3249 | { |
---|
[1637] | 3250 | var showImgLink = document.createElement('DIV'); |
---|
[1711] | 3251 | showImgLink.id="show_img_link_"+ID; |
---|
[1637] | 3252 | showImgLink.onclick = function(){show_msg_img(info_msg.msg_number,info_msg.msg_folder)}; |
---|
| 3253 | showImgLink.className="show_img_link"; |
---|
| 3254 | showImgLink.innerHTML = get_lang("Show images from")+": "+info_msg.from.email; |
---|
| 3255 | td.appendChild(showImgLink); |
---|
[790] | 3256 | } |
---|
| 3257 | } |
---|
| 3258 | } |
---|
[2] | 3259 | td.appendChild(div); |
---|
| 3260 | tr.appendChild(td) |
---|
| 3261 | tbody_message.appendChild(tr); |
---|
| 3262 | |
---|
| 3263 | |
---|
[3035] | 3264 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[2] | 3265 | //Make the body message. |
---|
[790] | 3266 | /////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[2] | 3267 | var tr = document.createElement("TR"); |
---|
| 3268 | tr.className = "tr_message_body"; |
---|
| 3269 | var td = document.createElement("TD"); |
---|
| 3270 | //td.setAttribute("colSpan","2"); |
---|
[5301] | 3271 | |
---|
| 3272 | //Comentado pois estes replaces e a tentativa de remover as tags <span> vazias faz com que seja |
---|
| 3273 | //eliminado os estilos aplicados no corpo do texto quando utilizado o Firefox. |
---|
| 3274 | //newBody = newBody.replace("<body","<span"); |
---|
| 3275 | //newBody = newBody.replace("<BODY","<span"); |
---|
| 3276 | //while ( ( /<span[^>]*><span[^>]*>/ig ).test( newBody ) ) |
---|
| 3277 | // newBody = newBody.replace( /(<span[^>]*>)<span[^>]*>/ig, '$1' ); |
---|
[3018] | 3278 | |
---|
[3035] | 3279 | var _body = document.createElement( 'div' ); |
---|
| 3280 | _body.id = 'body_' + ID; |
---|
| 3281 | _body.innerHTML = newBody; |
---|
[5476] | 3282 | _body.style.marginLeft = '5px'; |
---|
[3018] | 3283 | |
---|
[3035] | 3284 | var _elements = _body.getElementsByTagName( '*' ); |
---|
| 3285 | for( var i = 0; i < _elements.length; i++ ) |
---|
| 3286 | if ( _elements[ i ].attributes && _elements[ i ].attributes.getNamedItem( 'id' ) ) |
---|
[5369] | 3287 | _elements[ i ].attributes.removeNamedItem( 'id' ); |
---|
| 3288 | |
---|
[3035] | 3289 | div.appendChild( _body ); |
---|
[5370] | 3290 | |
---|
| 3291 | //window.setTimeout(function() { $("#div_message_scroll_"+ID).focus() },250); |
---|
[3018] | 3292 | |
---|
[3035] | 3293 | function mailto( link ) |
---|
| 3294 | { |
---|
| 3295 | var mail = link.href.substr( 7 ); |
---|
| 3296 | link.onclick = function( ) |
---|
| 3297 | { |
---|
| 3298 | new_message_to( mail ); |
---|
| 3299 | return false; |
---|
| 3300 | }; |
---|
| 3301 | } |
---|
| 3302 | var links = div.getElementsByTagName( 'a' ); |
---|
| 3303 | for ( var i = 0; i < links.length; i++ ){ |
---|
| 3304 | try{ |
---|
| 3305 | if ( links.item( i ).href.indexOf( 'mailto:' ) === 0 ){ |
---|
| 3306 | mailto( links.item( i ) ); |
---|
| 3307 | } |
---|
| 3308 | else{ |
---|
[4072] | 3309 | var anchor_pattern = "http://"+location.host+location.pathname+"#"; |
---|
| 3310 | |
---|
| 3311 | if ( ( links.item( i ).href.indexOf( 'javascript:' ) !== 0 ) && |
---|
[3393] | 3312 | (links.item( i ).href.indexOf(anchor_pattern) !== 0) ) //se não for âncora |
---|
| 3313 | links.item( i ).setAttribute( 'target', '_blank' ); |
---|
[3035] | 3314 | } |
---|
| 3315 | }catch(e){ |
---|
| 3316 | } |
---|
[3369] | 3317 | } |
---|
[3035] | 3318 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[2] | 3319 | //Make the thumbs of the message. |
---|
| 3320 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[4493] | 3321 | //k |
---|
| 3322 | |
---|
[4820] | 3323 | if ((info_msg.thumbs)&&(info_msg.thumbs.length > 0)){ |
---|
[5134] | 3324 | var thumbs = jQuery.parseJSON(info_msg.thumbs); |
---|
| 3325 | var div_thumbs = document.createElement("div"); |
---|
| 3326 | |
---|
[4493] | 3327 | div_thumbs.setAttribute("class", "expressomail-thumbs"); |
---|
| 3328 | div_thumbs.setAttribute("className", "expressomail-thumbs"); //for IE |
---|
| 3329 | |
---|
| 3330 | var div_thumbs_lbl = document.createElement("DIV"); |
---|
| 3331 | div_thumbs_lbl.setAttribute("class", "expressomail-thumbs-label"); |
---|
| 3332 | div_thumbs_lbl.setAttribute("className", "expressomail-thumbs-label"); //for IE |
---|
| 3333 | |
---|
| 3334 | var div_thumbs_lbl_sp = document.createElement("SPAN"); |
---|
| 3335 | div_thumbs_lbl_sp.setAttribute("class", "message_options"); |
---|
| 3336 | div_thumbs_lbl_sp.setAttribute("className", "message_options"); //for IE |
---|
| 3337 | var div_thumbs_lbl_st = document.createElement("STRONG"); |
---|
| 3338 | div_thumbs_lbl_st.innerHTML = info_msg.attachments.length+" "+get_lang("attachment")+(info_msg.attachments.length > 1 ? "s" : "")+" "+get_lang("in this message"); |
---|
| 3339 | var div_thumbs_lbl_a = document.createElement("A"); |
---|
| 3340 | |
---|
[4820] | 3341 | if(info_msg.thumbs.length > 1){ |
---|
| 3342 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
[4493] | 3343 | div_thumbs_lbl_a.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
[3035] | 3344 | else |
---|
[4493] | 3345 | div_thumbs_lbl_a.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); |
---|
| 3346 | div_thumbs_lbl_a.innerHTML = get_lang('Download all atachments'); |
---|
| 3347 | } else { |
---|
| 3348 | div_thumbs_lbl_a.setAttribute("style", "display:none; visibility:hidden;"); |
---|
[2] | 3349 | } |
---|
[3035] | 3350 | |
---|
[4493] | 3351 | div_thumbs_lbl_sp.appendChild(div_thumbs_lbl_st); |
---|
| 3352 | div_thumbs_lbl_sp.appendChild(document.createTextNode(' :: ')); |
---|
| 3353 | div_thumbs_lbl_sp.appendChild(div_thumbs_lbl_a); |
---|
| 3354 | div_thumbs_lbl.appendChild(div_thumbs_lbl_sp); |
---|
[4820] | 3355 | |
---|
[4493] | 3356 | var div_thumbs_lbl_sp2 = document.createElement("SPAN"); |
---|
| 3357 | div_thumbs_lbl_sp2.setAttribute("class", "message_tips"); |
---|
| 3358 | div_thumbs_lbl_sp2.setAttribute("className", "message_tips"); //for IE |
---|
| 3359 | 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] | 3360 | |
---|
[4493] | 3361 | var ul_thumbs_list = document.createElement("UL"); |
---|
| 3362 | ul_thumbs_list.setAttribute("class", "expressomail-thumbs-list"); |
---|
| 3363 | ul_thumbs_list.setAttribute("className", "expressomail-thumbs-list"); //for IE |
---|
[3035] | 3364 | |
---|
[5134] | 3365 | var msg = info_msg.msg_number; |
---|
| 3366 | var fdr = info_msg.msg_folder; |
---|
| 3367 | var i = 0; |
---|
| 3368 | //verifica se está no novo padrão de montagem das mensagens ou no antigo, necessário |
---|
| 3369 | //para exibir as imagens no arquivamento local arquivamento local. |
---|
| 3370 | if(thumbs){ |
---|
| 3371 | jQuery.each(thumbs, function(i, thumb) { |
---|
| 3372 | if(fdr.indexOf("local_") >= 0){ |
---|
| 3373 | var href = info_msg.array_attach[i].url + '&image=true'; |
---|
| 3374 | var src = info_msg.array_attach[i].url+ '&image=thumbnail'; |
---|
| 3375 | i++; |
---|
| 3376 | }else{ |
---|
| 3377 | var href = './inc/get_archive.php?msgFolder=' + fdr + '&msgNumber=' + msg + '&indexPart=' + thumb.pid + '&image=true'; |
---|
| 3378 | //var href = thumb.url; |
---|
| 3379 | var src = 'inc/get_archive.php?msgFolder=' + fdr + '&msgNumber=' + msg + '&indexPart=' + thumb.pid + '&image=thumbnail'; |
---|
| 3380 | } |
---|
| 3381 | var msgid= fdr+";;"+msg+";;"+i+";;"+thumb.pid+";;"+thumb.encoding; |
---|
| 3382 | var image_info = '{"folder":"'+fdr+'","message":"'+msg+'","thumbIndex":"'+i+'","pid":"'+thumb.pid+'","encoding":"'+thumb.encoding+'","type":"'+thumb.type+'"}'; |
---|
| 3383 | |
---|
| 3384 | var image= '<img id="' + msgid + '" title="' + |
---|
| 3385 | get_lang('Click here do view (+)') + '" src="' + src + '" style="width:auto;height:100%;" />'; |
---|
| 3386 | |
---|
| 3387 | 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>'; |
---|
| 3388 | content += '<input id="thumb_'+ID+'_'+i+'" type="hidden" value="' +escape(image_info) +'" />'; |
---|
| 3389 | jQuery(ul_thumbs_list).append('<li>'+content+'</li>'); |
---|
| 3390 | |
---|
| 3391 | }); |
---|
[4493] | 3392 | |
---|
| 3393 | div_thumbs.appendChild(div_thumbs_lbl); |
---|
| 3394 | div_thumbs.appendChild(div_thumbs_lbl_sp2); |
---|
| 3395 | div_thumbs.appendChild(ul_thumbs_list); |
---|
| 3396 | |
---|
[5134] | 3397 | }else{ |
---|
| 3398 | div_thumbs.appendChild(div_thumbs_lbl); |
---|
| 3399 | div_thumbs.appendChild(div_thumbs_lbl_sp2); |
---|
| 3400 | div_thumbs.innerHTML = div_thumbs.innerHTML + info_msg.thumbs; |
---|
| 3401 | |
---|
| 3402 | |
---|
| 3403 | } |
---|
| 3404 | |
---|
[4493] | 3405 | div.appendChild(div_thumbs); |
---|
[2] | 3406 | } |
---|
[4493] | 3407 | //k!! |
---|
[2] | 3408 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
| 3409 | table_message.appendChild(tbody_message); |
---|
| 3410 | content.appendChild(table_message); |
---|
[3035] | 3411 | resizeWindow(); |
---|
[2] | 3412 | var msg_number = document.createElement('INPUT'); |
---|
| 3413 | msg_number.id = "msg_number_" + ID; |
---|
| 3414 | msg_number.type = "hidden"; |
---|
| 3415 | msg_number.value = info_msg.msg_number; |
---|
| 3416 | content.appendChild(msg_number); |
---|
| 3417 | ////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
[3165] | 3418 | |
---|
| 3419 | //Exibe o cabecalho da mensagem totalmente aberto caso esteja setado nas preferencias do usuario |
---|
| 3420 | if (preferences.show_head_msg_full == 1) |
---|
| 3421 | { |
---|
| 3422 | option_hide_more.onclick(); |
---|
[3168] | 3423 | if (Element('div_toaddress_'+ID) != null) |
---|
| 3424 | show_div_address_full(ID,'to'); |
---|
| 3425 | if (Element('div_ccaddress_'+ID) != null) |
---|
| 3426 | show_div_address_full(ID,'cc'); |
---|
[3165] | 3427 | } |
---|
[4820] | 3428 | |
---|
[4493] | 3429 | /* |
---|
| 3430 | * TODO: implementar o controle como preferência do usuário |
---|
| 3431 | * |
---|
| 3432 | */ |
---|
| 3433 | var jcarousel = false; |
---|
| 3434 | if (jcarousel) { |
---|
[5134] | 3435 | //carousel |
---|
[4493] | 3436 | jQuery(document).ready(function() { |
---|
[5134] | 3437 | jQuery('.expressomail-thumbs-list').attr('id', 'expressomail-thumbs-list'+ID) |
---|
| 3438 | .addClass('jcarousel-skin-default').jcarousel(); |
---|
| 3439 | |
---|
| 3440 | jQuery('.expressomail-thumbs-link img').attr('style', ''); |
---|
[4493] | 3441 | |
---|
| 3442 | //fancybox |
---|
| 3443 | jQuery(".expressomail-thumbs-list li a").attr('onclick', 'return true;'); |
---|
| 3444 | jQuery(".expressomail-thumbs-list li a").fancybox({ |
---|
| 3445 | 'hideOnContentClick': true, |
---|
[5134] | 3446 | 'type': 'image', |
---|
| 3447 | 'titlePosition': 'over', |
---|
| 3448 | 'titleFormat' : function(name, currentArray, currentIndex, currentOpts) { |
---|
| 3449 | var image_info = $('#thumb_'+ID+'_'+currentIndex).val(); |
---|
| 3450 | |
---|
| 3451 | return '<div id="fancybox-title" class="fancybox-title-over" style="width: 100%; display: block;">' + |
---|
| 3452 | '<div id="fancybox-title-over">' + |
---|
| 3453 | '<a title="Anterior" onclick="javascript:$.fancybox.prev();" style="float:left;">' + |
---|
| 3454 | '<img src="./templates/'+template+'/images/left_arrow_white.png" width="30" height="30" />' + |
---|
| 3455 | '</a>'+ |
---|
| 3456 | '<a title="Baixar imagem" onclick="javascript:save_image2(\''+image_info+'\');" style="padding:0 5px;">' + |
---|
| 3457 | '<img src="./templates/'+template+'/images/image_down.png" width="22" height="22" />' + |
---|
| 3458 | '</a>'+ |
---|
| 3459 | '<a title="Baixar todas de uma vez" onclick="javascript:download_all_attachments(\''+info_msg.msg_folder+"','"+info_msg.msg_number+'\')" style="padding:0 5px;">'+ |
---|
| 3460 | '<img src="./templates/'+template+'/images/package_down.png" width="26" height="26" />' + |
---|
| 3461 | '</a>'+ |
---|
| 3462 | '<span style="margin-left:5px; margin-top:7px; position:absolute;">'+name+'</span>'+ |
---|
| 3463 | '<a title="Próxima" onclick="javascript:$.fancybox.next();" style="float:right;">' + |
---|
| 3464 | '<img src="./templates/'+template+'/images/right_arrow_white.png" width="30" height="30" />' + |
---|
| 3465 | '</a>' + |
---|
| 3466 | '</div>' + |
---|
| 3467 | '</div>'; |
---|
| 3468 | } |
---|
[4493] | 3469 | }); |
---|
| 3470 | }); |
---|
[5967] | 3471 | } |
---|
| 3472 | if ( is_webkit ){ //Corrige o bug de foco no Chrome |
---|
[5370] | 3473 | var ev = document.createEvent('MouseEvents'); |
---|
| 3474 | ev.initEvent( |
---|
| 3475 | 'click' |
---|
| 3476 | ,false |
---|
| 3477 | ,true |
---|
| 3478 | ); |
---|
| 3479 | var divScroll = Element('div_message_scroll_'+ID); |
---|
| 3480 | if (divScroll) { |
---|
| 3481 | divScroll.setAttribute('tabindex','-1'); |
---|
| 3482 | divScroll.onclick = function() {setTimeout(function(){$("#div_message_scroll_"+ID).focus();},0);}; |
---|
| 3483 | divScroll.dispatchEvent(ev); |
---|
| 3484 | } |
---|
| 3485 | } |
---|
[5967] | 3486 | else $("#div_message_scroll_"+ID).focus(); |
---|
| 3487 | update_labeleds_msg(); |
---|
[6463] | 3488 | |
---|
[5967] | 3489 | resizeWindow(); |
---|
[6463] | 3490 | |
---|
| 3491 | $("#div_message_scroll_"+ID).scrollTo( 0, 400, {queue:true} ); |
---|
[4820] | 3492 | } |
---|
[4493] | 3493 | |
---|
[3035] | 3494 | function changeLinkState(el,state){ |
---|
| 3495 | el.innerHTML = get_lang(state); |
---|
| 3496 | switch (state){ |
---|
| 3497 | case 'important': |
---|
| 3498 | { |
---|
[4826] | 3499 | 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] | 3500 | break; |
---|
| 3501 | } |
---|
| 3502 | case 'normal': |
---|
| 3503 | { |
---|
[4072] | 3504 | el.onclick = function(){ |
---|
[3806] | 3505 | var _this = this; |
---|
| 3506 | proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'unflagged', function(success){ |
---|
| 3507 | if (success) { |
---|
| 3508 | changeLinkState(_this, 'important'); |
---|
| 3509 | write_msg(get_lang('Message marked as ') + get_lang("Normal")); |
---|
| 3510 | } |
---|
| 3511 | } ); |
---|
| 3512 | } |
---|
[3035] | 3513 | break; |
---|
| 3514 | } |
---|
| 3515 | case 'unseen': |
---|
| 3516 | { |
---|
[4826] | 3517 | 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] | 3518 | break; |
---|
[790] | 3519 | |
---|
[3035] | 3520 | } |
---|
| 3521 | case 'seen': |
---|
| 3522 | { |
---|
[4826] | 3523 | 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] | 3524 | break; |
---|
[3021] | 3525 | |
---|
[3035] | 3526 | } |
---|
| 3527 | default: |
---|
| 3528 | { |
---|
| 3529 | break; |
---|
| 3530 | } |
---|
| 3531 | } |
---|
| 3532 | } |
---|
[4493] | 3533 | |
---|
[5911] | 3534 | function mySplit( val ) { |
---|
| 3535 | return val.split( /,\s*/ ); |
---|
| 3536 | } |
---|
| 3537 | |
---|
| 3538 | function extractLast( term ) { |
---|
| 3539 | return mySplit( term ).pop(); |
---|
| 3540 | } |
---|
[6109] | 3541 | |
---|
| 3542 | function input_binds(input, ID){ |
---|
| 3543 | var mySource = new Array(); |
---|
| 3544 | var myArray = contacts.split(","); |
---|
| 3545 | for(var i in myArray){ |
---|
| 3546 | var teste = myArray[i].split(";"); |
---|
| 3547 | if(teste.length > 1) |
---|
| 3548 | mySource.push({name : teste[0], email: teste[1], value : (teste[0] +" - "+teste[1])}); |
---|
| 3549 | else |
---|
| 3550 | mySource.push({name : "", email: teste[0], value :teste[0]}); |
---|
| 3551 | } |
---|
| 3552 | input.bind( "keydown", function( event ) { |
---|
| 3553 | if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) { |
---|
| 3554 | event.preventDefault(); |
---|
| 3555 | } |
---|
| 3556 | if((event.keyCode) == 120){ |
---|
| 3557 | emQuickSearch($(this).val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true); |
---|
[6117] | 3558 | }else if( (event.keyCode == 27) && $( this ).data( "autocomplete" ).menu.active ){ |
---|
| 3559 | event.stopPropagation(); |
---|
| 3560 | event.preventDefault(); |
---|
[6109] | 3561 | } |
---|
| 3562 | }).autocomplete({ |
---|
| 3563 | minLength: 0, |
---|
| 3564 | source: function( request, response ) { |
---|
| 3565 | response( $.ui.autocomplete.filter( |
---|
| 3566 | mySource, extractLast( request.term ) ) ); |
---|
| 3567 | }, |
---|
| 3568 | focus: function() { |
---|
| 3569 | return false; |
---|
| 3570 | }, |
---|
| 3571 | select: function( event, ui ) { |
---|
| 3572 | var terms = mySplit( this.value ); |
---|
| 3573 | terms.pop(); |
---|
| 3574 | terms.push( (ui.item.name != "" ? "\""+ui.item.name+"\" " : "") + (ui.item.email ? "<"+ui.item.email+">" : "")); |
---|
| 3575 | terms.push( "" ); |
---|
| 3576 | this.value = terms.join( ", " ); |
---|
| 3577 | return false; |
---|
[6117] | 3578 | }, |
---|
[6172] | 3579 | autoFocus: true |
---|
[6109] | 3580 | }).data( "autocomplete" )._renderItem = function( ul, item ) { |
---|
| 3581 | ul.css({"max-height" : "115px", "overflow-y" : "auto"}); |
---|
| 3582 | if( $(ul).find("li").length > 10 ){ |
---|
| 3583 | return; |
---|
| 3584 | } |
---|
| 3585 | return $( "<li></li>" ) |
---|
| 3586 | .data( "item.autocomplete", item ) |
---|
| 3587 | .append( "<a>" + item.name + " - " + item.email + "</a>" ) |
---|
| 3588 | .appendTo( ul ); |
---|
| 3589 | }; |
---|
| 3590 | input.parents("tr:first").find("button").button().click(function(){ |
---|
| 3591 | emQuickSearch($(this).parents("tr:first").find("textarea").val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true); |
---|
| 3592 | }); |
---|
| 3593 | } |
---|
[5911] | 3594 | |
---|
[271] | 3595 | function draw_new_message(border_ID){ |
---|
[3105] | 3596 | connector.loadScript("color_palette"); |
---|
| 3597 | connector.loadScript('wfolders'); |
---|
[5911] | 3598 | |
---|
[3105] | 3599 | if(typeof(RichTextEditor) == 'undefined' || typeof(ColorPalette) == 'undefined' || typeof(wfolders) == 'undefined') |
---|
[3068] | 3600 | return false; |
---|
| 3601 | |
---|
[5911] | 3602 | if(typeof($.fn.elastic) == "undefined"){ |
---|
| 3603 | $.lazy({ |
---|
| 3604 | src: '../prototype/plugins/jquery-elastic/jquery.elastic.source.js', |
---|
| 3605 | name: 'elastic' |
---|
| 3606 | }); |
---|
| 3607 | } |
---|
[271] | 3608 | var ID = create_border("",border_ID); |
---|
[5911] | 3609 | |
---|
[4139] | 3610 | if (ID == 0) |
---|
| 3611 | return 0; |
---|
[5134] | 3612 | else if(ID == 'maximo') |
---|
| 3613 | return 'maximo'; |
---|
[5911] | 3614 | |
---|
[2] | 3615 | hold_session = true; |
---|
[3035] | 3616 | |
---|
[5911] | 3617 | if ($("#footer_menu").length){ |
---|
| 3618 | $("#footer_menu").css('display','none'); |
---|
[1701] | 3619 | } |
---|
[5911] | 3620 | var content = $("#content_id_"+ID).html(DataLayer.render("../prototype/modules/mail/templates/new_message.ejs", {id: ID})); |
---|
| 3621 | RichTextEditor.loadEditor2(ID); |
---|
[5417] | 3622 | |
---|
[5911] | 3623 | //if(!expresso_offline) |
---|
| 3624 | // draw_from_field(sel_from,tr1_1); |
---|
[5417] | 3625 | |
---|
[5911] | 3626 | //content.find('name="input_to"').elastic().elastic("destroy"); |
---|
| 3627 | draw_from_field(content.find(".from-select")[0], content.find(".from-tr")[0]); |
---|
[5417] | 3628 | |
---|
[5911] | 3629 | var check_input = function(field){ |
---|
| 3630 | var check = field.attr("checked"); |
---|
| 3631 | field.attr("checked", (!check ? true : false)); |
---|
| 3632 | return (!check ? true : false); |
---|
[5417] | 3633 | } |
---|
| 3634 | |
---|
[5911] | 3635 | //AÇÃO GENERICA PARA ADICIONAR/REMOVER |
---|
| 3636 | var change_text = function(field, text, to_text){ |
---|
| 3637 | var text = (field.html() == text ? to_text : text); |
---|
| 3638 | field.html(text); |
---|
[3035] | 3639 | } |
---|
[4832] | 3640 | |
---|
[5911] | 3641 | //AÇÃO GENERICA PARA ADICIONAR/REMOVER CC & CCO |
---|
| 3642 | var show_hide = function(field, button){ |
---|
| 3643 | button.toggleClass("expressomail-button-icon-ative"); |
---|
| 3644 | field.toggle(); |
---|
[5976] | 3645 | field.find("textarea").val("").focus(); |
---|
[5911] | 3646 | if(!field.find("textarea").hasClass("elastic")){ |
---|
[5976] | 3647 | field.find("textarea").css({"max-height" : "115px", "overflow-y" : "auto"}).addClass("elastic").elastic().unbind('blur'); |
---|
[6129] | 3648 | input_binds(field.find("textarea"), ID); |
---|
[4934] | 3649 | } |
---|
[5417] | 3650 | } |
---|
[4832] | 3651 | |
---|
[6109] | 3652 | input_binds(content.find('[name="input_to"]').css({"max-height" : "115px", "overflow-y" : "auto"}).addClass("elastic").elastic().unbind('blur').focus(), ID); |
---|
[4291] | 3653 | |
---|
[5911] | 3654 | //Botão TextoRico/TextoSimples |
---|
| 3655 | content.find(".new-msg-head-right-buttons").find(".button").button().filter(".rich-button").click(function(){ |
---|
[5992] | 3656 | //RichTextEditor.loadEditor2(ID); |
---|
[6014] | 3657 | RichTextEditor.setPlain(check_input(content.find('[name="textplain_rt_checkbox"]')), ID); |
---|
[5911] | 3658 | change_text($(this).find(".ui-button-text"), get_lang("Rich Text"), get_lang("Simple Text")); |
---|
| 3659 | }) |
---|
[5417] | 3660 | |
---|
[5911] | 3661 | //Botão Adicionar/Remover CCO |
---|
| 3662 | .end().filter(".cco-button").click(function(){ |
---|
| 3663 | show_hide(content.find(".cco-tr"), $(this)); |
---|
| 3664 | change_text($(this).find(".ui-button-text"), get_lang("Add BCC"), get_lang('Remove CCo')); |
---|
| 3665 | }) |
---|
| 3666 | //Botão Adicionar/Remover CC |
---|
| 3667 | .end().filter(".cc-button").click(function(){ |
---|
| 3668 | show_hide(content.find(".cc-tr"), $(this)); |
---|
| 3669 | change_text($(this).find(".ui-button-text"), get_lang("Add CC"), get_lang('Remove CC')); |
---|
[5417] | 3670 | }); |
---|
| 3671 | |
---|
[5911] | 3672 | //BOTAO ENVIAR |
---|
| 3673 | content.find(".send").button({ |
---|
[5417] | 3674 | icons : { |
---|
| 3675 | primary : "expressomail-icon-send" |
---|
| 3676 | } |
---|
[5911] | 3677 | }).click(function(){ |
---|
| 3678 | send_message(ID,preferences.save_in_folder,null); |
---|
| 3679 | }) |
---|
| 3680 | //BOTAO SALVAR E ENVIAR |
---|
| 3681 | .end().find(".save-and-send").button({ |
---|
[5417] | 3682 | icons : { |
---|
[5911] | 3683 | primary : "expressomail-icon-send" |
---|
| 3684 | } |
---|
| 3685 | }).click(function(){ |
---|
| 3686 | wfolders.makeWindow(ID,"send_and_file"); |
---|
| 3687 | }) |
---|
| 3688 | //BOTAO SALVAR |
---|
| 3689 | .end().find(".save").button({ |
---|
| 3690 | icons : { |
---|
[5417] | 3691 | primary : "expressomail-icon-save" |
---|
| 3692 | } |
---|
[5911] | 3693 | }).click(function(){ |
---|
| 3694 | save_msg(ID); |
---|
| 3695 | }) |
---|
| 3696 | //BOTAO CONF. LEITURA |
---|
| 3697 | .end().find(".return-recept").button({ |
---|
[5417] | 3698 | icons : { |
---|
| 3699 | primary : "expressomail-icon-read-confirmation" |
---|
| 3700 | } |
---|
[5911] | 3701 | }).click(function(){ |
---|
| 3702 | check_input(content.find('[name="input_return_receipt"]')); |
---|
| 3703 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 3704 | }) |
---|
| 3705 | //BOTAO IMPORTANTE |
---|
| 3706 | .end().find(".important").button({ |
---|
[5417] | 3707 | icons : { |
---|
| 3708 | primary : "expressomail-icon-important" |
---|
| 3709 | } |
---|
[5911] | 3710 | }).click(function(){ |
---|
| 3711 | check_input(content.find('[name="input_important_message"]')); |
---|
| 3712 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 3713 | }) |
---|
| 3714 | //BOTAO ASS. DIGITAL |
---|
| 3715 | .end().find(".return_digital").button({ |
---|
[5417] | 3716 | icons : { |
---|
| 3717 | primary : "expressomail-icon-signature" |
---|
| 3718 | } |
---|
[5911] | 3719 | }).click(function(){ |
---|
| 3720 | check_input(content.find('[name="input_return_digital"]')); |
---|
| 3721 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 3722 | }) |
---|
| 3723 | //BOTAO EMAIL CRYPT |
---|
| 3724 | .end().find(".return_cripto").button({ |
---|
[5417] | 3725 | icons : { |
---|
| 3726 | primary : "expressomail-icon-encryption" |
---|
| 3727 | } |
---|
[5911] | 3728 | }).click(function(){ |
---|
| 3729 | check_input(content.find('[name="input_return_cripto"]')); |
---|
[5417] | 3730 | $(this).toggleClass("expressomail-button-icon-ative"); |
---|
| 3731 | }); |
---|
[5911] | 3732 | |
---|
| 3733 | content.find(".attachment td").filter(".value").prepend(DataLayer.render("../prototype/modules/mail/templates/attachment.ejs", {ID:ID})); |
---|
| 3734 | var fileUploadMSG = $('#fileupload_msg'+ID); |
---|
[6071] | 3735 | var maxAttachmentSize = (preferences.max_attachment_size !== "" && preferences.max_attachment_size != 0) ? (parseInt(preferences.max_attachment_size.replace('M', '')) * 1048576 ) : false; |
---|
[6107] | 3736 | |
---|
[6174] | 3737 | fileUploadMSG.find(".button").button().filter(".fileinput-button").find(".ui-button-text").css("margin-top", "2px").find("input:file").fileupload({ |
---|
[6107] | 3738 | //singleFileUploads : true, |
---|
| 3739 | sequentialUploads: true, |
---|
[6071] | 3740 | type: 'post', |
---|
| 3741 | dataType : 'json', |
---|
| 3742 | url: "../prototype/post.php", |
---|
[6107] | 3743 | forceIframeTransport: false, |
---|
| 3744 | dropZone : fileUploadMSG, |
---|
[6071] | 3745 | formData: function(form) { |
---|
| 3746 | return [ |
---|
| 3747 | { |
---|
| 3748 | name : "mailAttachment[0][source]", |
---|
| 3749 | value : "files0" |
---|
| 3750 | }, |
---|
| 3751 | { |
---|
| 3752 | name : "mailAttachment[0][disposition]", |
---|
| 3753 | value : $(form[0]['attDisposition'+$(form[0]['abaID']).val()]).val() |
---|
| 3754 | }, |
---|
| 3755 | { |
---|
| 3756 | name: "MAX_FILE_SIZE", |
---|
| 3757 | value : maxAttachmentSize |
---|
| 3758 | } |
---|
| 3759 | ]; |
---|
[6107] | 3760 | }, |
---|
[5604] | 3761 | add: function (e, data) { |
---|
[6071] | 3762 | if(!maxAttachmentSize || data.files[0].size < maxAttachmentSize || is_ie) { |
---|
[5604] | 3763 | setTimeout(function() { |
---|
[6071] | 3764 | $('#attDisposition'+ID).val('attachment'); |
---|
[5604] | 3765 | data.submit(); |
---|
[6071] | 3766 | }, 3000); |
---|
[6107] | 3767 | } |
---|
| 3768 | $.each(data.files, function (index, file) { |
---|
| 3769 | var attach = {}; |
---|
| 3770 | attach.fullFileName = file.name; |
---|
| 3771 | attach.fileName = file.name; |
---|
| 3772 | if(file.name.length > 50) |
---|
| 3773 | attach.fileName = file.name.substr(0, 32) + " ... " + file.name.substr(file.name.length-9, file.name.length); |
---|
| 3774 | attach.fileSize = formatBytes(file.size); |
---|
| 3775 | if(maxAttachmentSize && file.size > maxAttachmentSize) |
---|
| 3776 | attach.error = 'Tamanho de arquivo nao permitido!!' |
---|
| 3777 | |
---|
| 3778 | var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); |
---|
| 3779 | upload.find('.button.close').button({ |
---|
| 3780 | icons: { |
---|
| 3781 | primary: "ui-icon-close" |
---|
| 3782 | }, |
---|
| 3783 | text: false |
---|
| 3784 | }).click(function(){ |
---|
| 3785 | var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); |
---|
| 3786 | fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); |
---|
| 3787 | delAttachment(ID, idAttach) |
---|
| 3788 | $(this).parent().remove(); |
---|
| 3789 | }); |
---|
| 3790 | |
---|
| 3791 | fileUploadMSG.find('.attachments-list').append(upload); |
---|
[5604] | 3792 | |
---|
[6107] | 3793 | if(!maxAttachmentSize || file.size < maxAttachmentSize){ |
---|
| 3794 | if(data.fileInput){ |
---|
| 3795 | fileUploadMSG.find('.fileinput-button.new').append(data.fileInput[0]).removeClass('new'); |
---|
| 3796 | fileUploadMSG.find('.attachments-list').find('[type=file]').addClass('hidden'); |
---|
| 3797 | } |
---|
| 3798 | }else |
---|
| 3799 | fileUploadMSG.find(' .fileinput-button.new').removeClass('new'); |
---|
[6045] | 3800 | }); |
---|
| 3801 | }, |
---|
[5604] | 3802 | done: function(e, data){ |
---|
[5702] | 3803 | if(!!data.result && data.result != "[]" ){ |
---|
[6071] | 3804 | var newAttach = data.result; |
---|
| 3805 | if(!newAttach.mailAttachment.error){ |
---|
| 3806 | if(newAttach.rollback !== false) |
---|
| 3807 | { |
---|
| 3808 | fileUploadMSG.find('.in-progress:first').parents('p').append('<input type="hidden" name="fileId[]" value="'+newAttach['mailAttachment'][0][0].id+'"/>').find('.status-upload').addClass('ui-icon ui-icon-check'); |
---|
| 3809 | addAttachment(ID,newAttach['mailAttachment'][0][0].id); |
---|
| 3810 | } |
---|
| 3811 | else |
---|
| 3812 | fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error'); |
---|
| 3813 | }else{ |
---|
| 3814 | fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append(newAttach.mailAttachment.error).addClass('message-attach-error'); |
---|
| 3815 | } |
---|
[5604] | 3816 | |
---|
| 3817 | }else { |
---|
[5702] | 3818 | fileUploadMSG.find(' .progress.on-complete:first').parents('p').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error'); |
---|
[5604] | 3819 | } |
---|
[6071] | 3820 | fileUploadMSG.find(' .in-progress:first').remove(); |
---|
[5604] | 3821 | } |
---|
[6124] | 3822 | }).css({ |
---|
| 3823 | "height" : "20px", |
---|
| 3824 | "width": (is_webkit ? "205px" : "100px"), |
---|
| 3825 | "border-width": "0 0 0px 0px", |
---|
| 3826 | "-moz-transform" : "rotate(-180deg) translate(-147px, -0.5px) scale(1.1)", |
---|
| 3827 | "-webkit-transform" : "rotate(-180deg) translate(-104px, 0px)" |
---|
[6189] | 3828 | }).end().end().end().filter(".message-attach-link").click(function(){ |
---|
[6107] | 3829 | jQuery('#message-attach-dialog').html(DataLayer.render("../prototype/modules/attach_message/attach_message.ejs", {})); |
---|
| 3830 | $( "#mailpreview_container span.ui-icon-close" ).click(); |
---|
| 3831 | jQuery('#message-attach-dialog').dialog({ |
---|
| 3832 | width:920, |
---|
| 3833 | height:550, |
---|
| 3834 | resizable:false, |
---|
| 3835 | modal: true, |
---|
| 3836 | closeOnEscape:true, |
---|
[6265] | 3837 | close:function(event, ui) {event.stopPropagation();}, |
---|
[6107] | 3838 | autoOpen:false |
---|
| 3839 | }); |
---|
| 3840 | |
---|
| 3841 | |
---|
| 3842 | jQuery.getScript("../prototype/modules/attach_message/attach_message.js", function(){ |
---|
| 3843 | jQuery('#message-attach-dialog').dialog('open'); |
---|
| 3844 | jQuery('#message-attach-attach-btn').unbind('click'); |
---|
| 3845 | jQuery('#message-attach-attach-btn').click(function(event){ |
---|
| 3846 | jQuery.each(selectedMessages, function(folder_name, messages) { |
---|
| 3847 | jQuery.each(selectedMessages[folder_name], function(message_number, message) { |
---|
| 3848 | if (message) { |
---|
| 3849 | var att = new Object(); |
---|
| 3850 | att.folder = folder_name; |
---|
| 3851 | att.uid = message_number; |
---|
| 3852 | att.type = 'imapMSG'; |
---|
[6265] | 3853 | att.name = Base64.encode(onceOpenedMessages[folder_name][message_number].subject + '.eml'); |
---|
[6107] | 3854 | var idATT = JSON.stringify(att); |
---|
| 3855 | addAttachment( ID , idATT); |
---|
| 3856 | var attach = {}; |
---|
[6265] | 3857 | attach.fileName = onceOpenedMessages[folder_name][message_number].subject + '.eml'; |
---|
[6107] | 3858 | if(attach.fileName.length > 45) |
---|
| 3859 | attach.fileName = attach.fileName.substr(0, 32) + " ... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length); |
---|
[5911] | 3860 | |
---|
[6107] | 3861 | attach.fileSize = formatBytes(onceOpenedMessages[folder_name][message_number].size); |
---|
| 3862 | var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); |
---|
| 3863 | upload.find('.status-upload').addClass('ui-icon ui-icon-check'); |
---|
| 3864 | upload.find('.in-progress').remove(); |
---|
| 3865 | upload.append('<input type="hidden" name="fileId[]" value=\''+idATT+'\'/>'); |
---|
| 3866 | |
---|
| 3867 | upload.find('.button.close').button({ |
---|
| 3868 | icons: { |
---|
| 3869 | primary: "ui-icon-close" |
---|
| 3870 | }, |
---|
| 3871 | text: false |
---|
| 3872 | }).click(function(){ |
---|
[6252] | 3873 | var idAttach = $(this).parents("li:first").find('input[name="fileId[]"]').val(); |
---|
[6107] | 3874 | fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]'); |
---|
| 3875 | delAttachment(ID,idAttach); |
---|
| 3876 | $(this).parent().remove(); |
---|
| 3877 | }); |
---|
| 3878 | |
---|
| 3879 | fileUploadMSG.find('.attachments-list').append(upload); |
---|
| 3880 | } |
---|
| 3881 | }); |
---|
| 3882 | }); |
---|
| 3883 | |
---|
| 3884 | jQuery('#message-attach-dialog').dialog('close'); |
---|
| 3885 | |
---|
| 3886 | }); |
---|
| 3887 | jQuery('#message-attach-cancel-btn').click(function(event){ |
---|
| 3888 | jQuery('#message-attach-dialog').dialog('close'); |
---|
| 3889 | }); |
---|
| 3890 | }); |
---|
| 3891 | }); |
---|
[1701] | 3892 | return ID; |
---|
[2] | 3893 | } |
---|
| 3894 | |
---|
| 3895 | // Verify if any user is sharing his name/email address |
---|
| 3896 | // for use in the new messages's "From " field. |
---|
| 3897 | function draw_from_field(sel_from,tr1_1){ |
---|
| 3898 | |
---|
| 3899 | var el_shared_users = Element("el_shared_users"); |
---|
[6447] | 3900 | /* Recupera a pasta atual do usuário (selecionada) */ |
---|
| 3901 | var user_shared = folder.split(cyrus_delimiter); |
---|
| 3902 | /* Verifica se está nas próprias pastas */ |
---|
| 3903 | if(user_shared[0] == "INBOX"){ |
---|
| 3904 | user_shared = User.me.uid; |
---|
| 3905 | }else{ |
---|
| 3906 | user_shared = user_shared[1]; |
---|
| 3907 | } |
---|
[2] | 3908 | // The element was loaded and populated...so return. |
---|
[3035] | 3909 | if(el_shared_users){ |
---|
[371] | 3910 | // Nothing to work...so return. |
---|
| 3911 | if(el_shared_users.options.length == 0) |
---|
| 3912 | return; |
---|
[2] | 3913 | tr1_1.style.display = ''; |
---|
| 3914 | for (var x = 0; x < el_shared_users.options.length; x++) { |
---|
| 3915 | var _option = document.createElement("OPTION"); |
---|
| 3916 | _option.text = el_shared_users.options[x].text; |
---|
| 3917 | _option.value = el_shared_users.options[x].value; |
---|
[6447] | 3918 | /* Faz o tratamento do nome da pasta para fazer a verificação e selecionar o valor no select */ |
---|
| 3919 | var str_begin_name = _option.text.indexOf('<') + 1; |
---|
| 3920 | var str_end_name = _option.text.indexOf('@'); |
---|
| 3921 | var user_selected_name = _option.text.substring(str_begin_name, str_end_name); |
---|
| 3922 | /* Verifica se é o usuário da pasta selecionada */ |
---|
| 3923 | if(user_selected_name == user_shared){ |
---|
| 3924 | _option.selected = 'selected'; |
---|
| 3925 | } |
---|
[2] | 3926 | sel_from.options[sel_from.options.length] = _option ; |
---|
| 3927 | } |
---|
| 3928 | return; |
---|
| 3929 | } |
---|
| 3930 | // Get the shared folders..... |
---|
| 3931 | var sharedFolders = new Array(); |
---|
| 3932 | for(var i = 0; i < folders.length; i++) { |
---|
| 3933 | var x = folders[i].folder_id; |
---|
[3035] | 3934 | if (folders[i].folder_parent == 'user'){ |
---|
| 3935 | sharedFolders[sharedFolders.length] = x; |
---|
| 3936 | } |
---|
| 3937 | } |
---|
[2] | 3938 | |
---|
[3035] | 3939 | var matchUser = '#'; |
---|
| 3940 | var sharedUsers = new Array(); |
---|
[2] | 3941 | // Filter the shared folders (only root folders) ..... |
---|
| 3942 | for(var i = 0; i < sharedFolders.length; i++) { |
---|
| 3943 | matchUser = sharedFolders[i]; |
---|
| 3944 | sharedUsers[sharedUsers.length] = matchUser.substring(("user"+cyrus_delimiter).length,matchUser.length); |
---|
[3035] | 3945 | } |
---|
[2] | 3946 | |
---|
| 3947 | // Handler function for cExecute |
---|
| 3948 | var h_user = function(data) { |
---|
[371] | 3949 | if(data.length > 0) { |
---|
| 3950 | tr1_1.style.display = ''; |
---|
[6447] | 3951 | var mycn = typeof(data.myname != 'undefined') ? data.myname : ''; |
---|
[2] | 3952 | var _option = document.createElement("OPTION"); |
---|
[5134] | 3953 | _option.text = '"'+mycn+'" <'+Element("user_email").value+'>'; |
---|
| 3954 | _option.value = mycn+";"+Element("user_email").value; |
---|
[6447] | 3955 | /* Verifica se é o usuário logado */ |
---|
| 3956 | if(user_shared == User.me.uid) |
---|
| 3957 | _option.selected = 'selected'; |
---|
[371] | 3958 | sel_from.options[sel_from.options.length] = _option; |
---|
[3035] | 3959 | |
---|
[371] | 3960 | var options = ''; |
---|
[6447] | 3961 | var cn = ''; |
---|
[6263] | 3962 | for (var x = 0; x < data.length; x++) { |
---|
[5134] | 3963 | cn = typeof(data[x].cn[0] != 'undefined') ? data[x].cn[0] : ''; |
---|
[371] | 3964 | var _option = document.createElement("OPTION"); |
---|
[5134] | 3965 | _option.text = '"'+cn+'" <'+data[x].mail[0]+'>'; |
---|
| 3966 | _option.value = cn+';'+data[x].mail[0]+';'+data[x].save_shared[0]+';'+data[x].uid[0]; |
---|
[6447] | 3967 | /* Faz o tratamento do nome da pasta para fazer a verificação e selecionar o valor no select */ |
---|
| 3968 | var str_begin_name = _option.text.indexOf('<') + 1; |
---|
| 3969 | var str_end_name = _option.text.indexOf('@'); |
---|
| 3970 | var user_selected_name = _option.text.substring(str_begin_name, str_end_name); |
---|
| 3971 | /* Verifica se é o usuário da pasta selecionada */ |
---|
| 3972 | if(user_selected_name == user_shared){ |
---|
| 3973 | _option.selected = 'selected'; |
---|
| 3974 | } |
---|
[371] | 3975 | sel_from.options[sel_from.options.length] = _option ; |
---|
[6263] | 3976 | } |
---|
[2] | 3977 | } |
---|
| 3978 | var shared_users_from = Element("el_shared_users"); |
---|
| 3979 | if(!shared_users_from) { |
---|
| 3980 | shared_users_from = sel_from.cloneNode(true); |
---|
| 3981 | shared_users_from.id = "el_shared_users"; |
---|
| 3982 | shared_users_from.style.display = 'none'; |
---|
| 3983 | document.body.appendChild(shared_users_from); |
---|
| 3984 | } |
---|
| 3985 | } |
---|
| 3986 | // First time, so execute..... |
---|
| 3987 | cExecute ("$this.ldap_functions.getSharedUsersFrom&uids="+sharedUsers.join(';'), h_user); |
---|
| 3988 | } |
---|
| 3989 | |
---|
| 3990 | function changeBgColorToON(all_messages, begin, end){ |
---|
[5134] | 3991 | var _tab_prefix = getTabPrefix(); |
---|
| 3992 | var _msg_id; |
---|
[163] | 3993 | for (begin; begin<=end; begin++) |
---|
| 3994 | { |
---|
[5134] | 3995 | _msg_id = getMessageIdFromRowId(all_messages[begin].id); |
---|
[163] | 3996 | add_className(all_messages[begin], 'selected_msg'); |
---|
[5134] | 3997 | Element(_tab_prefix + "check_box_message_" + _msg_id).checked = true; |
---|
[2] | 3998 | } |
---|
| 3999 | } |
---|
[4493] | 4000 | |
---|
[976] | 4001 | function updateBoxBgColor(box){ |
---|
| 4002 | // Set first TR Class |
---|
| 4003 | var _className = 'tr_msg_read2'; |
---|
[3035] | 4004 | for(var i = 0; i < box.length;i++){ |
---|
[976] | 4005 | if(exist_className(box[i],_className)) |
---|
| 4006 | remove_className(box[i], _className); |
---|
| 4007 | _className = (_className == 'tr_msg_read2' ? 'tr_msg_read' : 'tr_msg_read2'); |
---|
| 4008 | if(!exist_className(box[i],_className)) |
---|
| 4009 | add_className( box[i], _className); |
---|
| 4010 | } |
---|
| 4011 | } |
---|
[4802] | 4012 | function changeBgColor(event, msg_number) { |
---|
| 4013 | var _element_id = msg_number.toString(); |
---|
| 4014 | var first_order, last_order; |
---|
[2] | 4015 | |
---|
[4802] | 4016 | if (typeof(currentTab)!='number') { |
---|
| 4017 | _element_id = _element_id+'_s'+numBox; |
---|
| 4018 | } |
---|
| 4019 | actual_tr = Element(_element_id); |
---|
[2] | 4020 | |
---|
[163] | 4021 | if (event.shiftKey) |
---|
| 4022 | { |
---|
[4802] | 4023 | var last_tr = Element(last_message_selected); |
---|
[2] | 4024 | if(!last_tr) |
---|
| 4025 | last_tr = actual_tr; |
---|
| 4026 | |
---|
[4802] | 4027 | var all_messages = actual_tr.parentNode.childNodes; |
---|
[3035] | 4028 | |
---|
[163] | 4029 | for (var i=0; i < all_messages.length; i++) |
---|
| 4030 | { |
---|
| 4031 | if (actual_tr.id == all_messages[i].id) |
---|
[2] | 4032 | first_order = i; |
---|
[163] | 4033 | if (last_tr.id == all_messages[i].id) |
---|
[2] | 4034 | last_order = i; |
---|
| 4035 | } |
---|
[3035] | 4036 | |
---|
[163] | 4037 | if (parseInt(first_order) > parseInt(last_order)) |
---|
| 4038 | changeBgColorToON(all_messages, last_order, first_order); |
---|
| 4039 | else |
---|
| 4040 | changeBgColorToON(all_messages, first_order, last_order); |
---|
[5588] | 4041 | }else if(event.target != document.getElementById(getTabPrefix()+'check_box_message_' + msg_number)){ |
---|
| 4042 | if($(event.target).attr("checked") == "checked"){ |
---|
| 4043 | $(event.target).parents("tr:first").addClass("selected_msg"); |
---|
| 4044 | }else{ |
---|
| 4045 | $(event.target).parents("tr:first").removeClass("selected_msg"); |
---|
| 4046 | } |
---|
[2] | 4047 | } |
---|
| 4048 | else{ |
---|
[163] | 4049 | //if ( exist_className(actual_tr, 'selected_msg') ) |
---|
[5134] | 4050 | if ( document.getElementById(getTabPrefix()+'check_box_message_' + msg_number).checked ){ |
---|
| 4051 | if( document.getElementById("chk_box_select_all_messages").checked) { |
---|
| 4052 | add_className(actual_tr, 'selected_msg selected_shortcut_msg'); |
---|
| 4053 | }else |
---|
[163] | 4054 | add_className(actual_tr, 'selected_msg'); |
---|
[5134] | 4055 | }else{ |
---|
| 4056 | if( document.getElementById("chk_box_select_all_messages").checked){ |
---|
| 4057 | remove_className(actual_tr, 'selected_msg selected_shortcut_msg'); |
---|
| 4058 | remove_className(actual_tr, 'selected_msg'); |
---|
| 4059 | remove_chk_box_select_all_messages(); |
---|
| 4060 | if(actual_tr.className == 'selected_msg') |
---|
[163] | 4061 | remove_className(actual_tr, 'selected_msg'); |
---|
[5134] | 4062 | }else |
---|
| 4063 | remove_className(actual_tr, 'selected_msg'); |
---|
| 4064 | } |
---|
[2] | 4065 | } |
---|
[4802] | 4066 | last_message_selected = _element_id; |
---|
[2] | 4067 | } |
---|
| 4068 | |
---|
| 4069 | function build_quota(data){ |
---|
| 4070 | id = "content_quota"; |
---|
| 4071 | q_limit = data['quota_limit']; |
---|
| 4072 | var div = document.getElementById(id); |
---|
| 4073 | if(!q_limit){ |
---|
[3035] | 4074 | div.innerHTML = '<span><font size="2" style="color:red"><strong>'+get_lang("Without Quota")+'</strong></font></span>'; |
---|
[2] | 4075 | } |
---|
| 4076 | else{ |
---|
[5754] | 4077 | if(div) |
---|
| 4078 | div.innerHTML = ''; |
---|
| 4079 | value = data['quota_percent']; |
---|
| 4080 | q_used = data['quota_used']; |
---|
| 4081 | table = document.getElementById("table_quota"); |
---|
| 4082 | if(table) |
---|
| 4083 | table.parentNode.removeChild(table); |
---|
| 4084 | table = document.createElement("TABLE"); |
---|
| 4085 | tbody = document.createElement("TBODY"); |
---|
| 4086 | table.appendChild(tbody); |
---|
| 4087 | table.id = "table_quota"; |
---|
| 4088 | table.width="102"; |
---|
| 4089 | table.border="0"; |
---|
| 4090 | table.cellSpacing = 0; |
---|
| 4091 | table.cellPadding = 0; |
---|
[3035] | 4092 | |
---|
[5754] | 4093 | //tr1 = document.createElement("TR"); |
---|
| 4094 | td11 = document.createElement("TD"); |
---|
| 4095 | td11.align="center"; |
---|
| 4096 | td11.setAttribute("noWrap","true"); |
---|
| 4097 | 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>"; |
---|
| 4098 | //tr1.appendChild(td11); |
---|
[3035] | 4099 | |
---|
[5754] | 4100 | tr2 = document.createElement("TR"); |
---|
| 4101 | td22 = document.createElement("TD"); |
---|
[3035] | 4102 | |
---|
[5754] | 4103 | //td21.appendChild(table221); |
---|
| 4104 | //tr2.appendChild(td21); |
---|
| 4105 | tr2.appendChild(td11); |
---|
| 4106 | //tr2.appendChild(td1); |
---|
[4934] | 4107 | |
---|
[5754] | 4108 | tbody.appendChild(tr2); //Desenho |
---|
| 4109 | //tbody.appendChild(tr1); //Letras |
---|
| 4110 | div.appendChild(table); |
---|
| 4111 | $("#quota_progressbar").progressbar({ |
---|
| 4112 | value: value |
---|
| 4113 | }); |
---|
| 4114 | if(value > 90) { |
---|
| 4115 | if(value >= 100) |
---|
| 4116 | write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages.")); |
---|
| 4117 | else |
---|
| 4118 | write_msg(get_lang("Warning: Your Mailbox is almost full!")); |
---|
| 4119 | $("#quota_progressbar").find(".ui-progressbar-value").css({"background-image": "url(templates/default/images/dsalert.gif)", "border-color" : "red"}); |
---|
| 4120 | } |
---|
| 4121 | else if(value > 80) |
---|
| 4122 | $("#quota_progressbar").find(".ui-progressbar-value").css({"background-image": "url(templates/default/images/dswarn.gif)", "border-color" : "yellow"}); |
---|
[2] | 4123 | } |
---|
| 4124 | } |
---|
| 4125 | |
---|
| 4126 | function draw_quota(data){ |
---|
[5754] | 4127 | this.build_quota(data); |
---|
[2] | 4128 | } |
---|
| 4129 | |
---|
[345] | 4130 | function update_quota(folder_id){ |
---|
[5754] | 4131 | cExecute ("$this.imap_functions.get_quota&folder_id="+folder_id,this.build_quota); |
---|
[2] | 4132 | } |
---|
| 4133 | |
---|
| 4134 | function draw_search(headers_msgs){ |
---|
| 4135 | Element("border_id_0").innerHTML = " " + get_lang('Search Result') + " "; |
---|
| 4136 | |
---|
| 4137 | var tbody = Element('tbody_box'); |
---|
| 4138 | for (var i=0; i<(headers_msgs.length); i++){ |
---|
[3493] | 4139 | // passa parâmetro offset |
---|
[2] | 4140 | var tr = this.make_tr_message(headers_msgs[i], headers_msgs[i].msg_folder); |
---|
[790] | 4141 | if (tr) |
---|
| 4142 | tbody.appendChild(tr); |
---|
[2] | 4143 | } |
---|
| 4144 | } |
---|
| 4145 | |
---|
| 4146 | function draw_search_header_box(){ |
---|
| 4147 | var table_message_header_box = Element("table_message_header_box"); |
---|
| 4148 | table_message_header_box.parentNode.removeChild(table_message_header_box); |
---|
| 4149 | |
---|
| 4150 | var content_id_0 = Element("content_id_0"); |
---|
| 4151 | var table_element = document.createElement("TABLE"); |
---|
| 4152 | var tbody_element = document.createElement("TBODY"); |
---|
| 4153 | table_element.setAttribute("id", "table_message_header_box"); |
---|
| 4154 | table_element.className = "table_message_header_box"; |
---|
| 4155 | tr_element = document.createElement("TR"); |
---|
| 4156 | tr_element.className = "message_header"; |
---|
| 4157 | td_element1 = document.createElement("TD"); |
---|
| 4158 | td_element1.setAttribute("width", "1%"); |
---|
| 4159 | chk_box_element = document.createElement("INPUT"); |
---|
| 4160 | chk_box_element.id = "chk_box_select_all_messages"; |
---|
| 4161 | chk_box_element.setAttribute("type", "checkbox"); |
---|
| 4162 | chk_box_element.className = "checkbox"; |
---|
| 4163 | chk_box_element.onclick = function(){select_all_messages(this.checked);}; |
---|
| 4164 | chk_box_element.onmouseover = function () {this.title=get_lang('Select all messages.')}; |
---|
| 4165 | chk_box_element.onkeydown = function (e){ |
---|
| 4166 | if (is_ie) |
---|
| 4167 | { |
---|
| 4168 | if ((window.event.keyCode) == 46) |
---|
| 4169 | { |
---|
| 4170 | //delete_all_selected_msgs_imap(); |
---|
[689] | 4171 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 4172 | } |
---|
| 4173 | } |
---|
| 4174 | else |
---|
| 4175 | { |
---|
| 4176 | if ((e.keyCode) == 46) |
---|
| 4177 | { |
---|
| 4178 | //delete_all_selected_msgs_imap(); |
---|
[689] | 4179 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 4180 | } |
---|
| 4181 | } |
---|
| 4182 | }; |
---|
[3035] | 4183 | |
---|
[2] | 4184 | td_element1.appendChild(chk_box_element); |
---|
| 4185 | td_element2 = document.createElement("TD"); |
---|
| 4186 | td_element2.setAttribute("width", "3%"); |
---|
| 4187 | td_element3 = document.createElement("TD"); |
---|
| 4188 | td_element3.setAttribute("width", "30%"); |
---|
| 4189 | td_element3.id = "message_header_SORTFROM"; |
---|
| 4190 | td_element3.align = "left"; |
---|
| 4191 | td_element3.innerHTML = get_lang("From"); |
---|
| 4192 | td_element4 = document.createElement("TD"); |
---|
| 4193 | td_element4.setAttribute("width", "49%"); |
---|
| 4194 | td_element4.id = "message_header_SORTSUBJECT"; |
---|
| 4195 | td_element4.align = "left"; |
---|
[3035] | 4196 | td_element4.innerHTML = get_lang("Subject"); |
---|
[2] | 4197 | td_element5 = document.createElement("TD"); |
---|
| 4198 | td_element5.setAttribute("width", "10%"); |
---|
| 4199 | td_element5.id = "message_header_SORTARRIVAL"; |
---|
| 4200 | td_element5.align = "center"; |
---|
[3035] | 4201 | td_element5.innerHTML = "<B>"+get_lang("Date")+"</B>"; |
---|
[790] | 4202 | td_element5.innerHTML += "<img src ='templates/"+template+"/images/arrow_descendant.gif'>"; |
---|
[2] | 4203 | td_element6 = document.createElement("TD"); |
---|
| 4204 | td_element6.setAttribute("width", "10%"); |
---|
| 4205 | td_element6.id = "message_header_SORTSIZE"; |
---|
| 4206 | td_element6.align = "right"; |
---|
| 4207 | td_element6.innerHTML = get_lang("Size"); |
---|
| 4208 | tr_element.appendChild(td_element1); |
---|
| 4209 | tr_element.appendChild(td_element2); |
---|
| 4210 | tr_element.appendChild(td_element3); |
---|
| 4211 | tr_element.appendChild(td_element4); |
---|
| 4212 | tr_element.appendChild(td_element5); |
---|
| 4213 | tr_element.appendChild(td_element6); |
---|
[3035] | 4214 | |
---|
[2] | 4215 | tbody_element.appendChild(tr_element); |
---|
| 4216 | table_element.appendChild(tbody_element); |
---|
| 4217 | content_id_0.appendChild(table_element); |
---|
| 4218 | } |
---|
| 4219 | |
---|
| 4220 | function draw_search_division(msg){ |
---|
| 4221 | var tbody = Element('tbody_box'); |
---|
| 4222 | var tr = document.createElement("TR"); |
---|
| 4223 | var td = document.createElement("TD"); |
---|
| 4224 | td.colSpan = '7'; |
---|
| 4225 | td.width = '100%'; |
---|
| 4226 | |
---|
| 4227 | var action_info_table = document.createElement("TABLE"); |
---|
| 4228 | var action_info_tbody = document.createElement("TBODY"); |
---|
[3035] | 4229 | |
---|
[2] | 4230 | action_info_table.className = "action_info_table"; |
---|
| 4231 | action_info_table.width = "100%"; |
---|
[3035] | 4232 | |
---|
[2] | 4233 | var action_info_tr = document.createElement("TR"); |
---|
[3035] | 4234 | |
---|
[2] | 4235 | var action_info_th1 = document.createElement("TH"); |
---|
| 4236 | action_info_th1.width = "40%"; |
---|
| 4237 | action_info_th1.innerHTML = " "; |
---|
| 4238 | |
---|
| 4239 | var action_info_th2 = document.createElement("TH"); |
---|
[3035] | 4240 | |
---|
[2] | 4241 | action_info_th2.innerHTML = msg; |
---|
| 4242 | action_info_th2.className = "action_info_th"; |
---|
| 4243 | action_info_th2.setAttribute("noWrap", "true"); |
---|
[3035] | 4244 | |
---|
[2] | 4245 | var action_info_th3 = document.createElement("TH"); |
---|
| 4246 | action_info_th3.width = "40%"; |
---|
| 4247 | action_info_th3.innerHTML = " "; |
---|
[3035] | 4248 | |
---|
[2] | 4249 | action_info_tr.appendChild(action_info_th1); |
---|
| 4250 | action_info_tr.appendChild(action_info_th2); |
---|
| 4251 | action_info_tr.appendChild(action_info_th3); |
---|
| 4252 | action_info_tbody.appendChild(action_info_tr); |
---|
| 4253 | action_info_table.appendChild(action_info_tbody); |
---|
| 4254 | |
---|
| 4255 | td.appendChild(action_info_table); |
---|
| 4256 | tr.appendChild(td); |
---|
| 4257 | tbody.appendChild(tr); |
---|
| 4258 | } |
---|
| 4259 | |
---|
| 4260 | function draw_search_box(){ |
---|
| 4261 | var content_id_0 = Element("content_id_0"); |
---|
| 4262 | var table = document.createElement("TABLE"); |
---|
| 4263 | table.id = "table_box"; |
---|
| 4264 | table.width = 'auto'; |
---|
| 4265 | var tbody = document.createElement("TBODY"); |
---|
| 4266 | tbody.id = "tbody_box"; |
---|
| 4267 | |
---|
| 4268 | table.className = "table_box"; |
---|
| 4269 | table.setAttribute("frame", "below"); |
---|
| 4270 | table.setAttribute("rules", "none"); |
---|
| 4271 | table.setAttribute("cellpadding", "0"); |
---|
| 4272 | table.onkeydown = function (e){ |
---|
| 4273 | if (is_ie) |
---|
| 4274 | { |
---|
| 4275 | if ((window.event.keyCode) == 46) |
---|
| 4276 | { |
---|
| 4277 | //delete_all_selected_msgs_imap(); |
---|
[689] | 4278 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 4279 | } |
---|
| 4280 | } |
---|
| 4281 | else |
---|
| 4282 | { |
---|
| 4283 | if ((e.keyCode) == 46) |
---|
| 4284 | { |
---|
| 4285 | //delete_all_selected_msgs_imap(); |
---|
[689] | 4286 | proxy_mensagens.delete_msgs(get_current_folder(),'selected','null'); |
---|
[2] | 4287 | } |
---|
| 4288 | } |
---|
| 4289 | }; |
---|
| 4290 | if (is_ie) |
---|
| 4291 | table.style.cursor = "hand"; |
---|
[3035] | 4292 | |
---|
[2] | 4293 | table.appendChild(tbody); |
---|
| 4294 | content_id_0.appendChild(table); |
---|
| 4295 | } |
---|
[4820] | 4296 | var idx_cc = 0; |
---|
[4493] | 4297 | |
---|
| 4298 | function draw_plugin_cc(ID, addrs){ |
---|
[2] | 4299 | connector.loadScript("ccQuickAdd"); |
---|
| 4300 | |
---|
| 4301 | var array_addrs = ''; |
---|
[3035] | 4302 | var array_name = ''; |
---|
[2] | 4303 | var cc_data = new Array(); |
---|
[3035] | 4304 | if(typeof(addrs.name) != 'undefined') { |
---|
[2] | 4305 | array_name = LTrim(addrs.name).split(" "); |
---|
[3035] | 4306 | array_addrs = new Array(addrs.email); |
---|
[2] | 4307 | } |
---|
| 4308 | else { |
---|
| 4309 | array_addrs = (typeof addrs == 'object' ? addrs.toString().split("\" ") : addrs.split("\" ")); |
---|
[3035] | 4310 | array_name = LTrim(array_addrs[0]).replace('"','').split(" "); |
---|
[2] | 4311 | } |
---|
| 4312 | |
---|
| 4313 | var _split = array_name[0].split('@'); |
---|
| 4314 | cc_data[0] = _split[0]; |
---|
| 4315 | cc_data[1] = _split[0]; |
---|
| 4316 | cc_data[2] = ''; |
---|
| 4317 | |
---|
| 4318 | for (i=1; i < array_name.length; i++) |
---|
[3035] | 4319 | cc_data[2] += array_name[i] + " "; |
---|
[2] | 4320 | |
---|
[3035] | 4321 | |
---|
| 4322 | if(array_addrs.length > 1) |
---|
| 4323 | cc_data[3] = array_addrs[1] ? array_addrs[1].replace("<",'').replace(">",'') : ''; |
---|
[2] | 4324 | else |
---|
| 4325 | cc_data[3] = array_addrs[0]; |
---|
[3035] | 4326 | |
---|
[106] | 4327 | var sm_envelope_img1 = '<img style="cursor:'+ (is_ie ? 'hand' : 'pointer') +'" title="' + get_lang("Add Contact") + |
---|
[790] | 4328 | '" onclick="ccQuickAddOne.showList(\''+cc_data+'\')" src="./templates/'+template+'/images/user_card.png">'; |
---|
[2] | 4329 | var to_addybook_add = "<SPAN id='insert_plugin_"+idx_cc+"_"+ID+"'>"; |
---|
| 4330 | to_addybook_add += addrs; |
---|
| 4331 | to_addybook_add += sm_envelope_img1; |
---|
| 4332 | idx_cc++; |
---|
| 4333 | to_addybook_add += "</SPAN>"; |
---|
| 4334 | return to_addybook_add; |
---|
| 4335 | } |
---|
[4493] | 4336 | |
---|
[2] | 4337 | function deny_email(email){ |
---|
| 4338 | connector.loadScript("filter"); |
---|
[375] | 4339 | connector.loadScript("filters"); |
---|
[2] | 4340 | var dn_em = document.createElement("SPAN"); |
---|
| 4341 | dn_em.id = "tt_d"; |
---|
[6265] | 4342 | dn_em.onclick = function(){block_user_email(email); /*filter.new_rule(email);*/}; |
---|
[106] | 4343 | dn_em.setAttribute("title",get_lang("Block Sender")); |
---|
[3035] | 4344 | dn_em.style.cursor = "pointer"; |
---|
[5630] | 4345 | dn_em.innerHTML = "<script src='../prototype/modules/filters/filters.js'></script><img align='top' src='./templates/"+template+"/images/deny.gif'>"; |
---|
[2] | 4346 | return dn_em; |
---|
[3035] | 4347 | |
---|
[2] | 4348 | } |
---|
[4493] | 4349 | |
---|
[13] | 4350 | function show_div_address_full(id, type) { |
---|
| 4351 | var div_address_full = Element("div_"+type+"address_full_"+id); |
---|
| 4352 | if(!div_address_full) { |
---|
| 4353 | div_address_full = document.createElement("SPAN"); |
---|
[3035] | 4354 | div_address_full.id = "div_"+type+"address_full_"+id; |
---|
| 4355 | div_address_full.style.display="none"; |
---|
[13] | 4356 | var _address = eval(type+"address_array['"+id+"']"); |
---|
| 4357 | var isOverLimit = (_address.length > 100); |
---|
[3035] | 4358 | |
---|
[2] | 4359 | if(isOverLimit) { |
---|
[446] | 4360 | alert("Esse campo possui muitos endereços ("+_address.length+" destinatários).\r\n"+ |
---|
| 4361 | "Para evitar o travamento do navegador, o botão 'Adicionar Contato' foi desabilitado!"); |
---|
[2] | 4362 | } |
---|
[13] | 4363 | |
---|
| 4364 | for(var idx = 1 ; idx < _address.length;idx++) { |
---|
| 4365 | div_address_full.innerHTML += isOverLimit ? '<br>'+_address[idx] : ','+draw_plugin_cc(id,_address[idx]); |
---|
[3035] | 4366 | } |
---|
[13] | 4367 | 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>)"; |
---|
| 4368 | Element(type+"_"+id).appendChild(div_address_full); |
---|
[2] | 4369 | } |
---|
[13] | 4370 | Element('div_'+type+'address_'+id).style.display='none'; |
---|
| 4371 | div_address_full.style.display=''; |
---|
[46] | 4372 | } |
---|
[4493] | 4373 | |
---|
[46] | 4374 | function draw_footer_box(num_msgs){ |
---|
[689] | 4375 | folder = get_current_folder(); |
---|
[3287] | 4376 | connector.loadScript('wfolders'); |
---|
[3035] | 4377 | var span_R = Element("table_message"); |
---|
| 4378 | var span_options = Element("span_options"); |
---|
[58] | 4379 | if(!span_options) { |
---|
[3035] | 4380 | span_options = document.createElement("TD"); |
---|
[58] | 4381 | span_options.style.fontSize = "12"; |
---|
| 4382 | span_options.id = "span_options"; |
---|
[59] | 4383 | span_R.appendChild(span_options); |
---|
| 4384 | } |
---|
[69] | 4385 | |
---|
[790] | 4386 | var change_font_color = 'onmouseover="var last_class = this.className;'+ |
---|
[848] | 4387 | 'if (this.className != \'message_options_over\')'+ |
---|
| 4388 | 'this.className=\'message_options_active\'; '+ |
---|
[790] | 4389 | 'this.onmouseout=function(){this.className=last_class;}"'; |
---|
| 4390 | |
---|
| 4391 | span_options.innerHTML = |
---|
| 4392 | '<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>'+ |
---|
| 4393 | '<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] | 4394 | ((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] | 4395 | // '<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] | 4396 | ((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] | 4397 | ((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] | 4398 | if(preferences.use_local_messages==1 && !expresso_offline) |
---|
[1000] | 4399 | if(proxy_mensagens.is_local_folder(current_folder)) |
---|
[5215] | 4400 | 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] | 4401 | else |
---|
[5215] | 4402 | 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] | 4403 | if (use_spam_filter) { |
---|
[790] | 4404 | if ( current_folder == 'INBOX'+cyrus_delimiter+'Spam' ) { |
---|
| 4405 | 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] | 4406 | } |
---|
| 4407 | else { |
---|
[790] | 4408 | 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] | 4409 | } |
---|
| 4410 | } |
---|
[3035] | 4411 | var span_D = Element("span_D"); |
---|
[58] | 4412 | if(!span_D){ |
---|
[3035] | 4413 | span_D = document.createElement("TD"); |
---|
[58] | 4414 | span_D.align = "right"; |
---|
| 4415 | span_D.style.fontSize = "12"; |
---|
| 4416 | span_D.id = "span_D"; |
---|
| 4417 | span_R.appendChild(span_D); |
---|
| 4418 | } |
---|
[3035] | 4419 | span_D.innerHTML = |
---|
[58] | 4420 | get_lang("List")+': '+ |
---|
[790] | 4421 | '<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>, '+ |
---|
| 4422 | '<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>, '+ |
---|
| 4423 | '<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] | 4424 | '<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] | 4425 | '<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] | 4426 | draw_paging(num_msgs); |
---|
[3035] | 4427 | Element("tot_m").innerHTML = num_msgs; |
---|
[1247] | 4428 | } |
---|