Index: /sandbox/2.5.0-expresso1/expressoMail1_2/js/main.js
===================================================================
--- /sandbox/2.5.0-expresso1/expressoMail1_2/js/main.js	(revision 7387)
+++ /sandbox/2.5.0-expresso1/expressoMail1_2/js/main.js	(revision 7389)
@@ -2410,8 +2410,13 @@
 {   
 	if (Element("attachments_" + old_id_border))
-        {
-                var fileUploadMSG = $('#fileupload_msg'+new_border_ID);         
-                var attachments = $("#attachments_" + old_id_border).find("a");	
-                var imagens = block_quoted_body.match(/<img[^>]*>/g);
+    {
+        var fileUploadMSG = $('#fileupload_msg'+new_border_ID);         
+        var attachments = $("#attachments_" + old_id_border).find("a");	
+		if(openTab.imapBox[new_border_ID].split("local").length > 1 && attachments.length > 0){
+			alert("Não é possivel utilizar os anexos das mensagens locais, favor desarquivar para ter acesso aos anexos");
+			return false;
+		}
+		
+        var imagens = block_quoted_body.match(/<img[^>]*>/g);
 		var arrayAttachments = [];
 		var arrayAttachmentsA = [];
@@ -2612,4 +2617,10 @@
     var fileUploadMSG = $('#fileupload_msg'+new_border_ID);
     var attachments = $("#attachments_" + old_id_border).find("a");			
+
+	if(openTab.imapBox[new_border_ID].split("local").length > 1 && attachments.length > 0){
+		alert("Não é possivel utilizar os anexos das mensagens locais, favor desarquivar para ter acesso aos anexos");
+		return false;
+	}
+
     for (var i = 0; i < attachments.length; i++){
             if((attachments[i].tagName=="SPAN") || (attachments[i].tagName=="IMG") || ((attachments[i].href.indexOf("javascript:download_local_attachment")==-1)&&(attachments[i].href.indexOf("javascript:download_attachments")==-1)))
Index: /sandbox/2.5.0-expresso1/expressoMail1_2/js/search.js
===================================================================
--- /sandbox/2.5.0-expresso1/expressoMail1_2/js/search.js	(revision 7353)
+++ /sandbox/2.5.0-expresso1/expressoMail1_2/js/search.js	(revision 7389)
@@ -559,120 +559,124 @@
 			if (j == 4)
 			{
-				td.setAttribute("width", colSizes[1][4]);
-				td.id = "td_message_followup_search_"+uid_msg;
-				td.setAttribute("class","search-result-item");
-				td1 = '<div class="flag-edited" style="width:8px;height:6px;"><img src="../prototype/modules/mail/img/flagEditor.png"></div>';
+				if(border_id.split("local").length == 1){
+					td.setAttribute("width", colSizes[1][4]);
+					td.id = "td_message_followup_search_"+uid_msg;
+					td.setAttribute("class","search-result-item");
+					td1 = '<div class="flag-edited" style="width:8px;height:6px;"><img src="../prototype/modules/mail/img/flagEditor.png"></div>';
+							
+					$(td).click(function(event, ui){	
+						var messageClickedId = $(this).attr('id').match(/td_message_followup_search_([\d]+)/)[1];
 						
-				$(td).click(function(event, ui){	
-					var messageClickedId = $(this).attr('id').match(/td_message_followup_search_([\d]+)/)[1];
+						var followupColor = $('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css('backgroundColor');
+						
+						$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
+						.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" />');	
+							
+						$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "transparent");
+			
+						/**TODO Alterar após melhorias no filtro da camada javascript*/
+						DataLayer.remove('followupflagged', false);
+						var flagged = DataLayer.get('followupflagged', {filter: [
+							'AND', 
+							['=', 'messageNumber', messageClickedId], 
+							['=', 'folderName', mailbox]
+						]});
+						if(flagged == '' || flagged == [] || flagged == 'undefined'){
+							/**
+							* Aplica followupflag de Acompanhamento
+							*/
+							aux.followupflagged = {
+								uid : User.me.id,
+								folderName : mailbox, 
+								messageNumber : messageClickedId, 
+								alarmTime : false, 
+								backgroundColor : '#FF2016',
+								followupflagId: '1'
+							};
 					
-					var followupColor = $('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css('backgroundColor');
-					
-					$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
-					.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" />');	
-						
-					$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "transparent");
-		
-					/**TODO Alterar após melhorias no filtro da camada javascript*/
-					DataLayer.remove('followupflagged', false);
-					var flagged = DataLayer.get('followupflagged', {filter: [
-						'AND', 
-						['=', 'messageNumber', messageClickedId], 
-						['=', 'folderName', mailbox]
-					]});
-					if(flagged == '' || flagged == [] || flagged == 'undefined'){
-						/**
-						* Aplica followupflag de Acompanhamento
-						*/
-						aux.followupflagged = {
-							uid : User.me.id,
-							folderName : mailbox, 
-							messageNumber : messageClickedId, 
-							alarmTime : false, 
-							backgroundColor : '#FF2016',
-							followupflagId: '1'
-						};
-				
-						aux.followupflagged.id = DataLayer.put('followupflagged', aux.followupflagged);
-						DataLayer.commit(false, false, function(data){
-							var fail = false;
-							$.each(data, function(index, value) {
-								fail = false;
-								if(typeof value === 'string'){
-									fail = value;
+							aux.followupflagged.id = DataLayer.put('followupflagged', aux.followupflagged);
+							DataLayer.commit(false, false, function(data){
+								var fail = false;
+								$.each(data, function(index, value) {
+									fail = false;
+									if(typeof value === 'string'){
+										fail = value;
+									}
+								});
+								
+								$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
+								.html('<img src="../prototype/modules/mail/img/flagEditor.png">');
+								
+								if (fail) {
+								    
+								    var isCurrentFolder = current_folder == mailbox ? '#td_message_followup_' + messageClickedId + ', ' : ''; 	
+								    $(isCurrentFolder + 'tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "#CCCCCC");
+								    MsgsCallbackFollowupflag[fail]();
+								    return false;
+								}
+								
+								if(current_folder == mailbox){
+									$('#td_message_followup_' + messageClickedId + ', ' + 
+									'tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).attr('title', get_lang('Follow up')).find(".flag-edited").css("background", aux.followupflagged.backgroundColor);	
+								}else{								
+									$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).attr('title', get_lang('Follow up')).find(".flag-edited").css("background", aux.followupflagged.backgroundColor);		
+								}								
+								updateCacheFollowupflag(messageClickedId, mailbox, true);
+							});
+
+							
+						}else if(onceOpenedHeadersMessages[mailbox][messageClickedId]['followupflagged'].followupflag.name == 'Follow up'){
+							/**
+							* Remover followupflag de Acompanhamento (DFD0078:RI25)
+							*/
+							$(this).find(".flag-edited").css("background", "#cccccc");
+							DataLayer.remove('followupflagged', flagged[0].id );
+							DataLayer.commit(false, false, function(){
+								$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
+								.html('<img src="../prototype/modules/mail/img/flagEditor.png">');
+								if(current_folder == mailbox){
+									updateCacheFollowupflag(messageClickedId, mailbox, false);
+								
+									$('#td_message_followup_' + messageClickedId + ', ' + 
+									  'tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).attr('title', '').find(".flag-edited").css("background", '#CCC');
+									
+									$('#td_message_followup_' + messageClickedId + ', ' + 
+										'tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
+										.find("img").attr("src", "../prototype/modules/mail/img/flagEditor.png").css("margin-left","0");			
+								}else{
+									updateCacheFollowupflag(messageClickedId, mailbox, false);
+									
+									$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).attr('title', '').find(".flag-edited").css("background", '#CCC');
+									
+									$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
+										.find("img").attr("src", "../prototype/modules/mail/img/flagEditor.png").css("margin-left","0");
 								}
 							});
-							
+
+						} else {
 							$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
 							.html('<img src="../prototype/modules/mail/img/flagEditor.png">');
-							
-							if (fail) {
-							    
-							    var isCurrentFolder = current_folder == mailbox ? '#td_message_followup_' + messageClickedId + ', ' : ''; 	
-							    $(isCurrentFolder + 'tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "#CCCCCC");
-							    MsgsCallbackFollowupflag[fail]();
-							    return false;
-							}
-							
-							if(current_folder == mailbox){
-								$('#td_message_followup_' + messageClickedId + ', ' + 
-								'tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).attr('title', get_lang('Follow up')).find(".flag-edited").css("background", aux.followupflagged.backgroundColor);	
-							}else{								
-								$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).attr('title', get_lang('Follow up')).find(".flag-edited").css("background", aux.followupflagged.backgroundColor);		
-							}								
-							updateCacheFollowupflag(messageClickedId, mailbox, true);
-						});
-
-						
-					}else if(onceOpenedHeadersMessages[mailbox][messageClickedId]['followupflagged'].followupflag.name == 'Follow up'){
-						/**
-						* Remover followupflag de Acompanhamento (DFD0078:RI25)
-						*/
-						$(this).find(".flag-edited").css("background", "#cccccc");
-						DataLayer.remove('followupflagged', flagged[0].id );
-						DataLayer.commit(false, false, function(){
-							$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
-							.html('<img src="../prototype/modules/mail/img/flagEditor.png">');
-							if(current_folder == mailbox){
-								updateCacheFollowupflag(messageClickedId, mailbox, false);
-							
-								$('#td_message_followup_' + messageClickedId + ', ' + 
-								  'tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).attr('title', '').find(".flag-edited").css("background", '#CCC');
-								
-								$('#td_message_followup_' + messageClickedId + ', ' + 
-									'tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
-									.find("img").attr("src", "../prototype/modules/mail/img/flagEditor.png").css("margin-left","0");			
-							}else{
-								updateCacheFollowupflag(messageClickedId, mailbox, false);
-								
-								$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).attr('title', '').find(".flag-edited").css("background", '#CCC');
-								
-								$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
-									.find("img").attr("src", "../prototype/modules/mail/img/flagEditor.png").css("margin-left","0");
-							}
-						});
-
+							$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", followupColor);
+							$(this).parents('[role="'+messageClickedId+'_'+mailbox+'"]').attr('class', 'selected_msg').find(':checkbox').trigger('click');
+							configureFollowupflag();
+						}
+						//if(!){}
+
+					});		
+				}		
+			}
+			if (j == 5)
+			{
+				if(border_id.split("local").length == 1){
+					td.setAttribute("width", colSizes[1][5]);
+					td.id = "td_message_labels_search_"+uid_msg;
+					td.setAttribute("class","td-label-search");				
+					
+					if (aux.labels) {
+						td1 = '<img src="../prototype/modules/mail/img/tag.png">';
+						updateLabelsColumn(aux)		
 					} else {
-						$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
-						.html('<img src="../prototype/modules/mail/img/flagEditor.png">');
-						$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", followupColor);
-						$(this).parents('[role="'+messageClickedId+'_'+mailbox+'"]').attr('class', 'selected_msg').find(':checkbox').trigger('click');
-						configureFollowupflag();
+						td1 = '';
 					}
-					//if(!){}
-
-				});				
-			}
-			if (j == 5)
-			{
-				td.setAttribute("width", colSizes[1][5]);
-				td.id = "td_message_labels_search_"+uid_msg;
-				td.setAttribute("class","td-label-search");				
-				
-				if (aux.labels) {
-					td1 = '<img src="../prototype/modules/mail/img/tag.png">';
-					updateLabelsColumn(aux)		
-				} else {
-					td1 = '';
 				}
 			}
Index: /sandbox/2.5.0-expresso1/expressoMail1_2/js/doiMenuData.js
===================================================================
--- /sandbox/2.5.0-expresso1/expressoMail1_2/js/doiMenuData.js	(revision 7348)
+++ /sandbox/2.5.0-expresso1/expressoMail1_2/js/doiMenuData.js	(revision 7389)
@@ -114,35 +114,59 @@
     	$.contextMenu({
     		selector: ".table_box tbody tr",
-    		callback: function(key, options) {
-    			//TODO - default actions
-    			
-    			/** 
-    			 * Apply labels to selected messages
-    			 */
-    			var isLabel = key.match(/label(.*)/);
-    			if (isLabel && isLabel.length > 1) {
-    				labeledMessages(isLabel[1]);
-    			}
-    			selectAllFolderMsgs(false);
-    		},
-    		items: {"flagSeen":      {"name": get_lang("Mark as") + " " + get_lang('seen'), "icon": "seen", callback: function(key, opt){ proxy_mensagens.proxy_set_messages_flag('seen','get_selected_messages'); }},
-                "flagUnseen":    {"name": get_lang("Mark as") + " " + get_lang('unseen'), "icon": "unseen", callback: function(key, opt){ proxy_mensagens.proxy_set_messages_flag('unseen','get_selected_messages'); }},
-                "flagFlagged":   {"name": get_lang("Mark as") + " " + get_lang('important'), "icon": "important", callback: function(key, opt){ proxy_mensagens.proxy_set_messages_flag('flagged','get_selected_messages'); }},
-                "flagUnflagged": {"name": get_lang("Mark as") + " " + get_lang('normal'), callback: function(key, opt){ proxy_mensagens.proxy_set_messages_flag('unflagged','get_selected_messages'); }},
-                
-                "sep1": "---------",
-                "label": { "name": get_lang("Labels"), "items": labelItems},
-                "follouwpflag":{"name": get_lang("Follow up"), callback: function(key, opt){ configureFollowupflag(); } },
-                
-                "sep2": "---------",
-                "move": {"name": get_lang("Move to")+"...", "icon": "move", callback: function(key, opt){ wfolders.makeWindow('', 'move_to'); }},
-                "remove": {"name": get_lang("Delete"),      "icon": "delete", callback: function(key, opt){ proxy_mensagens.delete_msgs('null','selected','null'); }},
-                "export": {"name": get_lang("Export"),      "icon": "export", callback: function(key, opt){ proxy_mensagens.export_all_messages(); }},
-                /* Airton
-                    TO-DO: Esse menu só deve aparecer quando a preferência de arquivamento local estiver ativada
-                    Como aqui dentro não dá pra fazer um if, fazer isso no início do método, passar toda essa linha para uma string e depois só colocar a variável aqui embaixo
-                */   
-                "archive": archive}
-
+            build: function($trigger, e) {
+
+                var itensNotLocal = {
+                    "label": { "name": get_lang("Labels"), "items": labelItems},
+                    "follouwpflag":{"name": get_lang("Follow up"), callback: function(key, opt){ configureFollowupflag(); } },
+                    "sep2": "---------"
+                }
+
+                var items= {
+                    "flagSeen":      {"name": get_lang("Mark as") + " " + get_lang('seen'), "icon": "seen", callback: function(key, opt){ proxy_mensagens.proxy_set_messages_flag('seen','get_selected_messages'); }},
+                    "flagUnseen":    {"name": get_lang("Mark as") + " " + get_lang('unseen'), "icon": "unseen", callback: function(key, opt){ proxy_mensagens.proxy_set_messages_flag('unseen','get_selected_messages'); }},
+                    "flagFlagged":   {"name": get_lang("Mark as") + " " + get_lang('important'), "icon": "important", callback: function(key, opt){ proxy_mensagens.proxy_set_messages_flag('flagged','get_selected_messages'); }},
+                    "flagUnflagged": {"name": get_lang("Mark as") + " " + get_lang('normal'), callback: function(key, opt){ proxy_mensagens.proxy_set_messages_flag('unflagged','get_selected_messages'); }},
+                    "sep1": "---------"
+                }
+
+                var lastItens = {
+                    "move": {"name": get_lang("Move to")+"...", "icon": "move", callback: function(key, opt){ wfolders.makeWindow('', 'move_to'); }},
+                    "remove": {"name": get_lang("Delete"),      "icon": "delete", callback: function(key, opt){ proxy_mensagens.delete_msgs('null','selected','null'); }},
+                    "export": {"name": get_lang("Export"),      "icon": "export", callback: function(key, opt){ proxy_mensagens.export_all_messages(); }},
+                    "archive": archive
+                }
+
+                var realItens = {};
+
+                if(currentTab == 0){
+                    if(get_current_folder().split("local").length > 1){
+                        realItens = $.extend(items, lastItens);
+                    }else{
+                        realItens = $.extend(items, itensNotLocal);
+                        realItens = $.extend(realItens, lastItens);
+                    }
+                }else if(currentTab.split("local").length > 1){
+                    realItens = $.extend(items, lastItens);
+                }else{
+                    realItens = $.extend(items, itensNotLocal);
+                    realItens = $.extend(realItens, lastItens);
+                }
+
+        		return { 
+                    callback: function(key, options) {
+        			//TODO - default actions
+        			
+        			/** 
+        			 * Apply labels to selected messages
+        			 */
+            			var isLabel = key.match(/label(.*)/);
+            			if (isLabel && isLabel.length > 1) {
+            				labeledMessages(isLabel[1]);
+            			}
+            			selectAllFolderMsgs(false);
+            		},
+            		items: realItens
+                }
+            }
     	});
     }
