Index: trunk/prototype/modules/mail/css/followupflag.css
===================================================================
--- trunk/prototype/modules/mail/css/followupflag.css	(revision 5533)
+++ trunk/prototype/modules/mail/css/followupflag.css	(revision 5571)
@@ -1,7 +1,2 @@
-.ZebraDialog_Body .footerMais,.footerMenos {cursor: pointer; color: #0f1dff;}
-.ZebraDialog_Body .footerMais2,.footerMenos2 {cursor: pointer; color: #0f1dff;}
-.ZebraDialog_Body .alert-flags a{ cursor: pointer;}
-.ZebraDialog_Body .alert-flags li:hover{ text-decoration: underline;}
-
 .followupflag-configure-win { width:543px; height:412px !important;  } 
 .followupflag-container { 
@@ -71,2 +66,12 @@
 	padding:0;
 }
+
+
+
+.ZebraDialog.followupflag-alarm {}
+.ZebraDialog.followupflag-alarm  fieldset{border:none; margin:0; padding:3px 0;}
+.ZebraDialog.followupflag-alarm  fieldset input{margin-left:0; padding-left:3px 0;}
+.ZebraDialog.followupflag-alarm .message-list{overflow: hidden; height: 50px; list-style:none; padding-left:10px;}
+.ZebraDialog.followupflag-alarm .message-list li{width: 270px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis; cursor: pointer;}
+.ZebraDialog.followupflag-alarm .message-list li:hover{ text-decoration: underline;}
+.ZebraDialog.followupflag-alarm  .display-option { color:#2363a4; cursor: pointer;}
Index: trunk/prototype/modules/mail/js/followupflag.js
===================================================================
--- trunk/prototype/modules/mail/js/followupflag.js	(revision 5564)
+++ trunk/prototype/modules/mail/js/followupflag.js	(revision 5571)
@@ -1,5 +1,32 @@
-//se  caso não existir nenhuma mensagem concluida para o dia atual, ele não mostra a modal.
- if($.cookie("fadeAlarm") != (new Date).toString("dd/MM/yyyy")){
-	var alarmInRange = DataLayer.get('followupflagged', {filter: ['AND', ['>', 'alarmDeadline', (new Date()).set({hour:0, minute:0, second:0}).toString('yyyy-MM-dd 00:00:00')], ['<', 'alarmDeadline', (new Date()).set({hour:0, minute:0, second:0}).addHours(24).toString('yyyy-MM-dd 00:00:00')]], criteria: {deepness: 1}});
+/**
+ * constrói as duas possíveis janela de alerta, utilizando o mesmo template
+ */
+var toIterate = [
+	{
+		attrDeadline: 'doneDeadline', 
+		caption: {singular:'Você tem uma mensagem concluindo hoje:', plural:"Você tem %1 mensagens concluindo hoje:"},
+		onOk: function(event){
+			if($(event.target).parents('.followupflag-alarm').find('[name="stopAlert"]').is(':checked')){
+				$.cookie("fadeCompleted", (new Date).toString("dd/MM/yyyy"), { expires: 1 });
+			}
+		},
+		enable: ($.cookie("fadeCompleted") != (new Date).toString("dd/MM/yyyy"))
+	},
+	{
+		attrDeadline: 'alarmDeadline', 
+		caption: {singular:'Você tem uma mensagem sinalizada para hoje:', plural:'Você tem %1 mensagens sinalizadas para hoje:'},
+		onOk: function(event){
+			if($(event.target).parents('.followupflag-alarm').find('[name="stopAlert"]').is(':checked')){
+				$.cookie("fadeAlarm", (new Date).toString("dd/MM/yyyy"), { expires: 1 });
+			}
+		},
+		enable: ($.cookie("fadeAlarm") != (new Date).toString("dd/MM/yyyy"))
+	}
+];
+
+while (it = toIterate.pop()){
+	if (!it.enable) continue;
+	
+	var alarmInRange = DataLayer.get('followupflagged', {filter: ['AND', ['>', it.attrDeadline, (new Date()).set({hour:0, minute:0, second:0}).toString('yyyy-MM-dd 00:00:00')], ['<', toIterate.attrDeadline, (new Date()).set({hour:0, minute:0, second:0}).addHours(24).toString('yyyy-MM-dd 00:00:00')]], criteria: {deepness: 1}});
 	if(alarmInRange.length > 0){
 		for(var i=0; i<alarmInRange.length; i++){
@@ -7,146 +34,39 @@
 			alarmInRange[i].alarmDeadline = date.toString('hh:mm');
 		}
-		var data = {alarmInRange : alarmInRange};
-		var valueZebra = DataLayer.render("../prototype/modules/mail/templates/followupflag_alarm_list.ejs", data);
-		
-		new $.Zebra_Dialog(valueZebra, {
-		'buttons':  ['Ok'],
-		'modal': false,
-		'position': ['right - 20', 'bottom - 30'],
-		'custom_class': 'zebraClass2',
-		});	
-		
-	$(".ZebraDialog_Body .footerMenos").hide()
-
-		$(".ZebraDialog_Body .footerMais").click(function(){
-			$('.ZebraDialog').css('visibility','hidden');
-			$(this).parents('.ZebraDialog').css("visibility","visible");
-			$(this).parents('.ZebraDialog').animate( { top: '-=300px' } , 280)
-			.find("ul.alert-flags").animate( { height: 375 } , 300);
-			$(".ZebraDialog_Body .footerMais").hide();
-			$(".ZebraDialog_Body .footerMenos").show();
+		var caption = (alarmInRange.length == 1) ?
+			get_lang(it.caption.singular):
+			get_lang(it.caption.plural, alarmInRange.length);
+			
+		var data = {alarmInRange : alarmInRange, caption: caption};
+		var dialogText = DataLayer.render("../prototype/modules/mail/templates/followupflag_alarm_list.ejs", data);
+		
+		/**
+		 * A última dialog criada é a dialog mais ao alto
+		 */
+		var offsetHeight = $('.ZebraDialog.right-bottom:last').length ? 
+			$(window).height() - $('.ZebraDialog.right-bottom:last').position().top : 0;
+
+		/**
+		 * Se for a primeira, desloca para cima do rodapé do grid
+		 * caso contrário desloca para um pouco acima da última dialog criada
+		 */
+		offsetHeight = !offsetHeight ? 35 : offsetHeight + 20 ;
+		var dialog = new $.Zebra_Dialog(dialogText, {
+			'buttons':  ['Ok'],
+			'modal': false,
+			'vcenter_short_message': false,
+			'position': ['right - 20', 'bottom - ' + offsetHeight.toString() ],
+			'custom_class': 'right-bottom followupflag-alarm',
+		}).dialog;
+
+		$(".ZebraDialog.followupflag-alarm .ZebraDialog_Button0").click(it.onOk);
+		
+		$(".ZebraDialog.followupflag-alarm .display-options .more").click(function(event) {
+			$(event.target).parents('.followupflag-alarm').find('.message-list').css('height', 'auto');
 		});
-		$(".ZebraDialog_Body .footermenos").click(function(){
-			$('.ZebraDialog').css('visibility','visible');
-			$(this).parents('.ZebraDialog').animate( { top: '+=300px' } , 280)
-			.find("ul.alert-flags").animate( { height: 70 } , 300);
-			
-			$(this).parents('.ZebraDialog').css({
-			});
-			$(".ZebraDialog_Body .footerMenos").hide();
-			$(".ZebraDialog_Body .footerMais").show();
-		});
-		
-		
-		$("ul.alert-flags li").css({
-			'width': '270px',
-			'white-space': 'nowrap',
-			'overflow': 'hidden',
-			'text-overflow': 'ellipsis'
-		});
-		
-		$("span.exc-ocul").css({
-			'float' : 'right',
-			'margin-right' : '0',
-			'color' : '#2363a4',
-			'cursor' : 'pointer'
-		}).parent("ul").css();
-		
-		$(".zebraClass2 .ZebraDialog_Buttons .ZebraDialog_Button0").click(function(){
-			var countCheckbox2 = $("input:checked").length;
-
-			if(countCheckbox2 == 1){
-				date2 = (new Date).toString("dd/MM/yyyy");
-				$.cookie("fadeAlarm", date2 , { expires: 1 });
-			}
-		});
+		
 	}		
 }
 
-if($.cookie("fadeCompleted") != (new Date).toString("dd/MM/yyyy")){	
-	var doneInRange = DataLayer.get('followupflagged', {filter: ['AND', ['>', 'doneDeadline', (new Date()).set({hour:0, minute:0, second:0}).toString('yyyy-MM-dd 00:00:00')], ['<', 'doneDeadline', (new Date()).set({hour:0, minute:0, second:0}).addHours(24).toString('yyyy-MM-dd 00:00:00')]], criteria: {deepness: 1}});
-	if(doneInRange.length > 0){
-		for(var i=0; i<doneInRange.length; i++){
-			var date = Date.parseExact(doneInRange[i].doneDeadline, 'yyyy-MM-dd hh:mm:ss');
-			doneInRange[i].doneDeadline = date.toString('hh:mm');
-		}
-		var data = {doneInRange : doneInRange};
-		var valueZebra = DataLayer.render("../prototype/modules/mail/templates/followupflag_completed_list.ejs", data);
-		
-		//verificando se a primeira "model de alarme" está oculta ou não..
-		//caso ela esteja caira nesse primeiro if, que coloca a model de "concluidos" no lugar da model de alarme.
-		if($(".zebraClass2").length == 0){
-			new $.Zebra_Dialog(valueZebra, {
-				'buttons':  ['Ok'],
-				'modal': false,
-				'position': ['right - 20', 'bottom - 30' ],
-				'custom_class': 'zebraClass',
-				});	 	 
-		}else{
-			new $.Zebra_Dialog(valueZebra, {
-				'buttons':  ['Ok'],
-				'modal': false,
-				'position': ['right - 20', 'bottom - 275' ],
-				'custom_class': 'zebraClass',
-				});	
-		}
-		
-	$(".ZebraDialog_Body .footerMenos2").hide()
-
-		$(".ZebraDialog_Body .footerMais2").click(function(){
-			$('.ZebraDialog').css('visibility','hidden');
-			$(this).parents('.ZebraDialog').css("visibility","visible");
-			if($.cookie("fadeAlarm") != (new Date).toString("dd/MM/yyyy")){
-				$(this).parents('.ZebraDialog').animate( { top: '-=60px' } , 280)
-				.find("ul.alert-flags").animate( { height: 360 } , 300);
-			} else {
-				$(this).parents('.ZebraDialog').animate( { top: '-=300px' } , 280)
-				.find("ul.alert-flags").animate( { height: 360 } , 300);
-			}
-			
-			$(".ZebraDialog_Body .footerMais2").hide();
-			$(".ZebraDialog_Body .footerMenos2").show();
-		});
-		$(".ZebraDialog_Body .footermenos2").click(function(){
-			$('.ZebraDialog').css('visibility','visible');
-			if($.cookie("fadeAlarm") != (new Date).toString("dd/MM/yyyy")){
-				$(this).parents('.ZebraDialog').animate( { top: '+=60px' } , 280)
-				.find("ul.alert-flags").animate( { height: 70 } , 300);
-			} else {
-				$(this).parents('.ZebraDialog').animate( { top: '+=300px' } , 280)
-				.find("ul.alert-flags").animate( { height: 70 } , 300);
-			}
-			$(this).parents('.ZebraDialog').css({
-			});
-			$(".ZebraDialog_Body .footerMenos2").hide();
-			$(".ZebraDialog_Body .footerMais2").show();
-		});
-		
-		
-		$("ul.alert-flags li").css({
-			'width': '270px',
-			'white-space': 'nowrap',
-			'overflow': 'hidden',
-			'text-overflow': 'ellipsis'
-		});
-		
-		$("span.exc-ocul").css({
-			'float' : 'right',
-			'margin-right' : '0',
-			'color' : '#2363a4',
-			'cursor' : 'pointer'
-		}).parent("ul").css();
-		
-		$(".zebraClass .ZebraDialog_Buttons .ZebraDialog_Button0").click(function(){
-		
-			var countCheckbox1 = $("input:checked").length;
-
-			if(countCheckbox1 == 1){
-				date1 = (new Date).toString("dd/MM/yyyy");
-				$.cookie("fadeCompleted", date1 , { expires: 1 });
-			}
-		});
-	}		
-}
 function init_followup(data){
 
@@ -423,6 +343,6 @@
 	});
 	
-	if(winElement.find("#selectCor option:selected").val() == "custom"){
-		winElement.find("#selectCor").trigger("change");
+	if(winElement.find('[name="setColor"] option:selected').val() == "custom"){
+		winElement.find('[name="setColor"]').trigger("change");
 	}
 
@@ -445,5 +365,5 @@
 		
 	});
-	if(winElement.find("#selectCor option:selected").val() == "custom"){
+	if(winElement.find('[name="setColor"] option:selected').val() == "custom"){
 		winElement.find(".colorwell").focus();
 	}
Index: trunk/prototype/modules/mail/templates/followupflag_configure.ejs
===================================================================
--- trunk/prototype/modules/mail/templates/followupflag_configure.ejs	(revision 5567)
+++ trunk/prototype/modules/mail/templates/followupflag_configure.ejs	(revision 5571)
@@ -40,6 +40,4 @@
 		}
 	}
-typeFlag = DataLayer.get("followupflag", id = data.messages[0].followupflagged.followupflagId ).name;
-//followupflagged.followupflag.name
 %>
 <div class="followupflag-container">
@@ -52,5 +50,5 @@
 				<% for(var i=0; i<data.followupflags.length; i++) {  %>
 					
-					<% var selected = (data.followupflags[i].name == typeFlag ) ? 'selected="selected"' : '' %> 
+					<% var selected = (data.followupflags[i].id == followupflagged.followupflagId ) ? 'selected="selected"' : '' %> 
 					<option value="<%= data.followupflags[i].id %>" <%= selected %>><%= data.followupflags[i].name %></option>
 				<% } %>
@@ -87,7 +85,7 @@
 				}
 			%>
-			<select id="selectCor" name="setColor">
-				<option value="default" <%= (defaultColor) ? 'selected="selected"' : ''%> ><%= get_lang("Default")%></option>
-				<option value="custom" <%= (!defaultColor) ? 'selected="selected"' : ''%> ><%= get_lang("Custom")%></option>
+			<select name="setColor">
+				<option value="default" <%= (defaultColor && !followupflagged.backgroundColor) ? 'selected="selected"' : ''%> ><%= get_lang("Default")%></option>
+				<option value="custom" <%= (!defaultColor && followupflagged.backgroundColor) ? 'selected="selected"' : ''%> ><%= get_lang("Custom")%></option>
 			</select>
 		</div>
@@ -116,7 +114,2 @@
 	</div>
 </div> 
-
-<!--
-	TODO
-	** Vai ter que ser arrumado a parte de buscar o tipo do sinalizador atual.
--->
Index: trunk/prototype/modules/mail/templates/followupflag_alarm_list.ejs
===================================================================
--- trunk/prototype/modules/mail/templates/followupflag_alarm_list.ejs	(revision 5533)
+++ trunk/prototype/modules/mail/templates/followupflag_alarm_list.ejs	(revision 5571)
@@ -1,17 +1,25 @@
-<p class="title"><strong>Você tem <%= data.alarmInRange.length %> <%= (data.alarmInRange.length == 1) ? 'mensagem sinalizada para hoje.' : 'mensagens sinalizadas para hoje.'%> </p></strong>
-					<ul class="alert-flags" style="overflow: hidden; height: 70px;">
-	
+<p class="title"><strong><%= data.caption %> </strong></p>
+
+<ul class="message-list">
 <%
 for(var i=0; i<data.alarmInRange.length; i++){
+
+	var openMessageScript = "cExecute('$this.imap_functions.get_info_msg&msg_number="+data.alarmInRange[i].messageNumber+"&msg_folder="+data.alarmInRange[i].folderName+"', show_msg);";
 %>
-
-	<li><a onclick="cExecute('$this.imap_functions.get_info_msg&msg_number=<%=data.alarmInRange[i].messageNumber %>&msg_folder=<%= data.alarmInRange[i].folderName %>', show_msg);"><%= data.alarmInRange[i].alarmDeadline %> - <%= data.alarmInRange[i].followupflag.name %> - <%= data.alarmInRange[i].message.headers.subject %></a></li>
+	<li class="message-item">
+		<a onclick="<%=openMessageScript%>">
+			<%= data.alarmInRange[i].alarmDeadline %> - <%= data.alarmInRange[i].followupflag.name %> - <%= data.alarmInRange[i].message.headers.subject %>
+		</a>
+	</li>
 <%
 }
 %>
-					</ul> 
-					
-<br>
-<a class="footerMais">ver mais</a><a class="footerMenos">ver menos</a>
-<br><br>
-	<input type="checkbox" name="fadeModel2"> Não mostrar essa janela por hoje.
+</ul> 
+
+<div class="display-options">
+	<a class="display-option more">ver mais</a>
+	<a class="display-option less" style="display:none;">ver menos</a>
+</div>
+<fieldset class="alert-options">
+	<input type="checkbox" name="stopAlert"> <label>Não mostrar essa janela por hoje.</label>
+</fieldset>
