Index: trunk/prototype/modules/filters/filters.js
===================================================================
--- trunk/prototype/modules/filters/filters.js	(revision 5601)
+++ trunk/prototype/modules/filters/filters.js	(revision 5627)
@@ -137,6 +137,7 @@
 		id: "vacation",
 		name: "vacation",
-		isExact: false
-
+		isExact: false,
+		applyMessages : "",
+		enabled : false
       }
 
@@ -185,5 +186,5 @@
 
 		}),
-		enabled : true,
+		enabled : false,
 		applyMessages: allMessages? !$.isEmptyObject( selectedMessages ) ?
 		keys( selectedMessages ) : allMessages : ""
@@ -643,4 +644,21 @@
 */ 
 function list_filters(html){
+	var filters = DataLayer.get("filter", true);
+	var outoffice_active = false;
+	var outoffice = false;
+	for(var index in filters){
+		DataLayer.put( 'filter', filters[index].id, { enabled: (filters[index].enabled == "true" ? true: false)});
+		if(filters[index].id == "vacation")
+			outoffice = true;
+		if(filters[index].id == "vacation" && filters[index].enabled == "true"){
+			write_msg(get_lang("Attention, you are in out of office mode."), true);	
+			outoffice_active = true;
+			break;
+		}
+	}
+	DataLayer.commit( 'filter' );
+	if(!outoffice_active){
+		clean_msg();
+	}
 	if(html){
 		if( ! $(".filters-windows").length )
@@ -656,5 +674,6 @@
 		    event.stopPropagation();
 			if(list_container.find(".cancel").length)
-				list_container.find(".cancel").trigger('click');		    
+				list_container.find(".cancel").trigger('click');	
+			$(".dialog-head-buttonpane").hide();
 	    },
 		open: function () {
@@ -665,4 +684,5 @@
 				$(".ui-icon-minusthick, .ui-icon-newwin").toggleClass('ui-icon-minusthick').toggleClass('ui-icon-newwin');
 			});
+			$(".dialog-head-buttonpane").show();
 		},
 	    autoOpen: false,
@@ -676,5 +696,5 @@
 	$(".ui-dialog-titlebar").after("<div class='dialog-head-buttonpane ui-dialog-buttonpane ui-widget-content ui-helper-clearfix' style='background-color: rgb(224, 238, 238); '><div class='ui-dialog-buttonset header-buttonpane'></div></div>");
 	$(".dialog-head-buttonpane").css("padding", "5px").
-	find(".header-buttonpane").html("<a href='#' class='button add' title='Adicionar nova regra'>Nova regra</a><!--<a href='#' class='button add vacation' title='Adicionar regra 'Fora do escritorio''>Fora do escritorio</a>-->").find(".button").button();
+	find(".header-buttonpane").html("<a href='#' class='button add' title='Adicionar nova regra'>Nova regra</a>"+(!outoffice ? "<a href='#' class='button add vacation' title='Adicionar regra 'Fora do escritorio''>Fora do escritorio</a>" : "")).find(".button").button();
 	
 	$(".ui-dialog-buttonpane.ui-widget-content").css("background-color", "#E0EEEE");
@@ -697,5 +717,5 @@
 		text: false
 	}).click(function(){
-		var id = $(this).parents("li.rule").find('.title').html();
+		var id = $(this).parents("li.rule").find('.id').val();
 		var filters = DataLayer.get( 'filter', true);
 		for(var i =0; i < filters.length; i++){
@@ -751,8 +771,9 @@
 		text: false
 	}).click(function(){
-		var id = $(this).parents("li.rule").find('.title').html();
+		var id = $(this).parents("li.rule").find('.id').val();
 		DataLayer.put( 'filter', id, { enabled: false  });
-		DataLayer.commit("filter");
-		DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters);
+		DataLayer.commit("filter", false,function(){
+			DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters);
+		});
 	}).end()
 
@@ -763,8 +784,9 @@
 		text: false
 	}).click(function(){
-		var id = $(this).parents("li.rule").find('.title').html();
+		var id = $(this).parents("li.rule").find('.id').val();
 		DataLayer.put( 'filter', id, { enabled: true });
-		DataLayer.commit("filter");
-		DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters);
+		DataLayer.commit("filter", false,function(){
+			DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters);
+		});
 	}).end()
 	
@@ -776,10 +798,11 @@
 	}).click(function(){
 		$(event.target)
-		.parents("li.rule").find('.title')
+		.parents("li.rule").find('.id')
 		.each( function(){
-			DataLayer.remove( 'filter', $(this).html() );
+			DataLayer.remove( 'filter', $(this).val() );
 		});
-		DataLayer.commit("filter");
-		DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters);
+		DataLayer.commit("filter", false,function(){
+			DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters);
+		});
 	}).end().removeClass("ui-button-icon-only");
 	
@@ -800,6 +823,7 @@
 				else
 					return;
-				DataLayer.commit( 'filter' );
-				DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters);
+				DataLayer.commit( 'filter',false,function(){
+					DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters);
+				});
 			});
 		});	
@@ -815,6 +839,7 @@
 			}).end().filter(".submit").click(function(){
 				$(this).submit();
-				DataLayer.commit( 'filter' );
-				DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters);
+				DataLayer.commit( 'filter',false,function(){
+					DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters);
+				});
 			});
 		});	
Index: trunk/prototype/modules/filters/filters.ejs
===================================================================
--- trunk/prototype/modules/filters/filters.ejs	(revision 5341)
+++ trunk/prototype/modules/filters/filters.ejs	(revision 5627)
@@ -2,12 +2,13 @@
 
 
-<div class="expresso-window-container filter-manager-window" title="<%=get_lang('Regras de classificação de mensagem')%>">
+<div class="expresso-window-container filter-manager-window" title="Regras de classificação de mensagem">
 
 	<div class="rule-list-container">
-	    <%= view( { url: '../prototype/modules/filters/filter-list.ejs' }, 	{ data: data } ) %>
+	    <!-- Aqui embaixo colocar < % para fazer a compilação do template. Na verdade, o ideal é que não seja compilado aqui dentro. Ver o que fazer. -->
+		<!-- //view( { url: '../prototype/modules/filters/filter-list.ejs' }, 	{ data: data } ) %> -->
 	</div>
 
 <form action="filter:detail">
-	<div class="rule-details-container hidden">
+	<div class="rule-details-container">
 		<h3><a href="#">Critérios</a></h3>
 		<div>
