Index: /sandbox/2.4.2-expresso1/prototype/modules/mail/js/followupflag.js
===================================================================
--- /sandbox/2.4.2-expresso1/prototype/modules/mail/js/followupflag.js	(revision 6641)
+++ /sandbox/2.4.2-expresso1/prototype/modules/mail/js/followupflag.js	(revision 6751)
@@ -178,4 +178,11 @@
 	 * #END: Implementação do widget de input-combobox
 	 */
+	 winElement.find('input[name="alarmDate"]').change(function(event){
+	 	winElement.find('input[name="alarmTime"]').attr('disabled', ( $(this).val() == "" ? 'disabled' : false));
+	 });
+
+	 winElement.find('input[name="alarmDate"]').keyup(function(event){
+	 	winElement.find('input[name="alarmTime"]').attr('disabled', ( $(this).val() == "" ? 'disabled' : false)).val('');
+	 });
 
 	winElement.find('.button').button()
@@ -217,4 +224,5 @@
 							messageNumber : messageNumber,
 							isDone: isDone,
+							isSent: 0,
 							backgroundColor : backgroundColor
 						}, !!idFollowupflagged[i] ? {id: idFollowupflagged[i]} : {});
@@ -414,12 +422,14 @@
 	winElement.find('[name="alarm"]').click(function(){
 		if($(this).is(":checked")){
-			winElement.find('[name="alarmDate"],[name="alarmTime"]').removeAttr("disabled");			
+			winElement.find('[name="alarmDate"]').removeAttr("disabled");			
 		}else{
-			winElement.find('[name="alarmDate"],[name="alarmTime"]').attr("disabled","disabled");
+			winElement.find('[name="alarmDate"],[name="alarmTime"]').attr("disabled","disabled").val('');
 		}
 	});
+
 	if(winElement.find('[name="alarm"]').is(":checked")){
 		winElement.find('[name="alarmDate"],[name="alarmTime"]').removeAttr("disabled");
 	}
+	
 	winElement.find('[name="done"]').click(function(){
 		if($(this).is(":checked")){
@@ -492,218 +502,158 @@
  */
 function alarmFollowupflagged(alert_type, filter_list){
+	var currentDate = new Date().toString("dd/MM/yyyy");
+
+// ==========================================REFAZENDO TODO CODIGO===================================================
+	var data = {alarmDeadline: false, doneDeadline: false, filtersAlarms: false};
+
 	switch(alert_type){
-		// carregar modais de sinalizadores
 		case 'followupflagAlarms':
 			$('.doneDeadline').remove();
 			$('.alarmDeadline').remove();
-			var toIterate = [
-				{
-					attrDeadline: 'doneDeadline', 
-					caption: {singular:'You have one undone message today:', 
-					plural:"You have %1 undone messages today:"
-					},
-					title: get_lang('Done'),
-					enable: ($.cookie("fadeCompleted") != (new Date).toString("dd/MM/yyyy"))
-				},
-				{
-					attrDeadline: 'alarmDeadline',
-					caption: {
-						singular:'You have a follow up due for today:', 
-						plural:'You have %1 follow ups due for today:'
-					},
-					title: get_lang('Follow ups'),
-					enable: ($.cookie("fadeAlarm") != (new Date).toString("dd/MM/yyyy"))
-				}
-			];
-			break;
-		// carregar modal de filtros
+			data.alarmDeadline = $.cookie("fadeAlarm") != currentDate ? true : false;
+			data.doneDeadline = $.cookie("fadeCompleted") != currentDate ? true : false;
+		break;
 		case 'filtersAlarms':
 			$('.filtersDeadline').remove();
-			var toIterate = [
-				{
-					attrDeadline: 'filtersDeadline',
-					caption: {
-						singular:'You have an archived message:', 
-						plural:'You have %1 messages archived:'
-					},
-					title: get_lang('Filter by sender'),
-					enable: ($.cookie("fadeFilterAlarm") != (new Date).toString("dd/MM/yyyy"))
-				}
-			];
-			break;
-		// carregar todas as modais
+			data.filtersAlarms = $.cookie("fadeFilterAlarm") != currentDate ? true : false;
+		break;
 		default:
 			$('.gray').remove();
-			var toIterate = [
-				{
-					attrDeadline: 'filtersDeadline',
-					caption: {
-						singular:'You have an archived message:', 
-						plural:'You have %1 messages archived:'
-					},
+			data.alarmDeadline = $.cookie("fadeAlarm") != currentDate ? true : false;
+			data.doneDeadline = $.cookie("fadeCompleted") != currentDate ? true : false;
+			data.filtersAlarms = $.cookie("fadeFilterAlarm") != currentDate ? true : false;
+		break;
+	};
+
+	var startDate = (new Date()).set({hour:0, minute:0, second:0}).toString('yyyy-MM-dd 00:00:00');
+	var endDate = (new Date()).set({hour:0, minute:0, second:0}).addHours(24).toString('yyyy-MM-dd 00:00:00');
+
+	if(data.alarmDeadline){
+		var decodeAlarms = {'sent': [], 'task':[]};	
+		alarms = DataLayer.get('followupflagged', 
+			{
+				filter: ['AND', ['<', 'alarmDeadline', endDate], ['=','isSent','0'], ['=','isDone','0']], 
+				criteria: {deepness: 1}
+			});
+
+		if(alarms.length > 0){
+			var itens = [];
+			for(var i = 0; i < alarms.length; i++){
+
+				var date = Date.parseExact(alarms[i]['alarmDeadline'], 'yyyy-MM-dd HH:mm:ss');
+           		alarms[i]['alarmDeadline'] = date.toString('dd/MM HH:mm');
+
+				var nameFollowupflag = alarms[i]['followupflag']['id'] < 7 ? get_lang(alarms[i]['followupflag']['name']) : alarms[i]['followupflag']['name'];
+				var li_alarm = alarms[i]['alarmDeadline'] + ' - ' + nameFollowupflag + ' - ' + alarms[i]['message']['headers']['subject'];
+
+				if(alarms[i]['doneDeadline'] != ''){
+					var dateDone = Date.parseExact(alarms[i]['doneDeadline'], 'yyyy-MM-dd HH:mm:ss');
+					if(dateDone.getTime() < $.now())
+						continue;
+				}
+
+				if(date.getTime() <= $.now())
+					decodeAlarms.sent.push({
+						"msg_number" : alarms[i]['messageNumber'],
+						"msg_folder" : alarms[i]['folderName'],
+						"a"			 : truncate(li_alarm, 34),
+						'id' : alarms[i].id
+					});
+           		else
+           			decodeAlarms.task.push({
+						a: truncate(li_alarm, 34),
+						sentTime:  date.getTime() / 1000,
+						id: alarms[i].id,
+						'msg_folder': alarms[i].folderName,
+						'msg_number': alarms[i].messageNumber
+					});
+			}
+
+			if(decodeAlarms.task.length)
+				alarmDeadline.load(decodeAlarms.task);
+
+			if(decodeAlarms.sent.length)
+				data.alarmDeadline = {
+						alarms: decodeAlarms.sent,
+						title: get_lang('Follow ups'),
+						caption: (itens.length == 1) ? get_lang('You have one undone message today:') : get_lang('You have %1 follow ups due for today:', decodeAlarms.sent.length),
+						type: 'alarmDeadline'
+					};
+			else
+				data.alarmDeadline = false;
+		}else
+			data.alarmDeadline = false;
+	}
+
+	if(data.doneDeadline){
+		alarms = DataLayer.get('followupflagged', {filter: ['AND', ['>', 'doneDeadline', startDate], ['<', 'doneDeadline', endDate]], criteria: {deepness: 1}});
+
+		if(alarms.length > 0){
+			var itens = [];
+			for(var i = 0; i < alarms.length; i++){
+
+				var date = Date.parseExact(alarms[i]['doneDeadline'], 'yyyy-MM-dd HH:mm:ss');
+           		alarms[i]['doneDeadline'] = date.toString('dd/MM HH:mm');
+
+				var nameFollowupflag = alarms[i]['followupflag']['id'] < 7 ? get_lang(alarms[i]['followupflag']['name']) : alarms[i]['followupflag']['name'];
+				var li_alarm = alarms[i]['doneDeadline'] + ' - ' + nameFollowupflag + ' - ' + truncate(alarms[i]['message']['headers']['subject'], 15);
+
+				itens.push({
+					a: truncate(li_alarm, 34),
+					id: alarms[i].id,
+					'msg_folder': alarms[i].folderName,
+					'msg_number': alarms[i].messageNumber
+				});
+			}
+
+			data.doneDeadline = {
+					alarms: itens,
+					title: get_lang('Done'),
+					caption: (itens.length == 1) ? get_lang('You have one undone message today:') : get_lang('You have %1 follow ups due for today:', itens.length),
+					type: 'doneDeadline'
+				};
+		}else
+			data.doneDeadline = false;
+	}
+
+	if(data.filtersAlarms){
+
+		alarms = filter_list;
+
+		if(alarms.length > 0){
+			var itens = [];
+
+			for(var i=0; i<alarms.length; i++){
+				
+				alarms[i]['udate'] =  new Date(alarms[i]['udate']*1000).toString('dd/MM HH:mm');
+				var li_alarm = alarms[i]['udate'] + ' - ' + alarms[i]['from'] + ' - ' + alarms[i]['subject'];
+
+				itens.push({
+					'msg_number' : alarms[i]['msg_number'],
+					'msg_folder' : alarms[i]['msg_folder'],
+					a			 : truncate(html_entities(li_alarm), 34),
+					id : alarms[i].id
+				}); 				
+			}
+
+			data.filtersAlarms = {
+					alarms: itens,
 					title: get_lang('Filter by sender'),
-					enable: ($.cookie("fadeFilterAlarm") != (new Date).toString("dd/MM/yyyy"))
-				},
-				{
-					attrDeadline: 'doneDeadline', 
-					caption: {singular:'You have one undone message today:', 
-					plural:"You have %1 undone messages today:"
-					},
-					title: get_lang('Done'),
-					enable: ($.cookie("fadeCompleted") != (new Date).toString("dd/MM/yyyy"))
-				},				
-				{
-					attrDeadline: 'alarmDeadline',
-					caption: {
-						singular:'You have a follow up due for today:', 
-						plural:'You have %1 follow ups due for today:'
-					},
-					title: get_lang('Follow ups'),
-					enable: ($.cookie("fadeAlarm") != (new Date).toString("dd/MM/yyyy"))
-				}
-			];
-			break;
-	}
-	var i = 0;
-	// recupera e monta os dados para serem exibidos nas modais de alarmes
-	while (it = toIterate.pop()){
-		if (!it.enable) continue;
-		
-		var alarmInRange = {};
-		// caso for alarme de sinalizadores
-		if(it.attrDeadline == 'doneDeadline' || it.attrDeadline == 'alarmDeadline'){
-			alarmInRange = DataLayer.get('followupflagged', {filter: ['AND', ['>', it.attrDeadline, (new Date()).set({hour:0, minute:0, second:0}).toString('yyyy-MM-dd 00:00:00')], ['<', it.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++){
-					if(alarmInRange[i].isDone == 1){
-						 alarmInRange.splice(i,1);
-						 i--;
-					}
-				}
-			}
-			
-			if(alarmInRange.length > 0){
-				var messages_alarm = [];
-				for(var i=0; i<alarmInRange.length; i++){
-					var date = Date.parseExact(alarmInRange[i][it.attrDeadline], 'yyyy-MM-dd HH:mm:ss');
-					if(date)
-						alarmInRange[i][it.attrDeadline] = date.toString('HH:mm');
-					
-					if(alarmInRange[i]['followupflag']['id'] < 7){
-						var nameFollowupflag = get_lang(alarmInRange[i]['followupflag']['name']);
-					}else{
-						var nameFollowupflag = alarmInRange[i]['followupflag']['name'];
-					}
-					var li_alarm = alarmInRange[i][it.attrDeadline] + ' - ' + nameFollowupflag + ' - ' + truncate(alarmInRange[i]['message']['headers']['subject'], 15);
-					messages_alarm.push({
-						"msg_number" : alarmInRange[i]['messageNumber'],
-						"msg_folder" : alarmInRange[i]['folderName'],
-						"a"			 : li_alarm
-					}); 				
-				}
-			}
-		} 
-		// caso for alarme de filtros
-		else if(filter_list){
-			alarmInRange = filter_list;
-			if(alarmInRange.length > 0){
-				var messages_alarm = [];
-				for(var i=0; i<alarmInRange.length; i++){
-					var d = new Date(alarmInRange[i]['udate']*1000);
-					var dia = d.getDate();
-					if(dia < 10){
-						dia = "0" + dia;
-					}
-					var mes = (d.getMonth()) + 1;
-					if(mes < 10){
-						mes = "0" + mes;
-					}
-					var ano = d.getFullYear();
-					var dtFormatada = dia + '/' + mes + '/' + ano;
-					alarmInRange[i]['udate'] = dtFormatada;
-						
-					var li_alarm = alarmInRange[i]['udate'] + ' ' + alarmInRange[i]['smalldate'] + ' - ' + alarmInRange[i]['from'] + ' - ' + truncate(alarmInRange[i]['subject'], 15);
-					messages_alarm.push({
-						"msg_number" : alarmInRange[i]['msg_number'],
-						"msg_folder" : alarmInRange[i]['msg_folder'],
-						"a"			 : li_alarm
-					}); 				
-				}
-			}
-		}
-				
-		if(alarmInRange.length > 0){
-			// monta o subtitulo da modal
-			var caption = (alarmInRange.length == 1) ?
-				get_lang(it.caption.singular):
-				get_lang(it.caption.plural, alarmInRange.length);
-			// monta o array de dados a ser passado para o template	
-			var data = {
-				alarmInRange : messages_alarm, 
-				caption: caption, 
-				type: it.attrDeadline,
-				captions: it.caption
-			};
-			// tipo de modal a ser exibida
-			var type_alarm = it.attrDeadline;
-			//função chamada ao clicar no botão Ok da modal
-			var ok_function = function(event, type, type_cookie){
-				if($(event.target).parents('.'+type).find('[name="stopAlert"]').is(':checked')){
-					$.cookie(type_cookie, (new Date).toString("dd/MM/yyyy"), { 
-						expires: 1 
-					});
-				}
-			}
-			// carrega o template dos alarmes e cria a modal utilizando o plugin freeow
-			var dialogText = DataLayer.render("../prototype/modules/mail/templates/followupflag_alarm_list.ejs", data);
-			var titulo = '<div class="header-alarm"><span class="img_title"></span><span class="title-alarm"><strong>'+it.title+'</strong></span><span name="header-icon" class="maximize-alarm"></span></div>';
-			$("#freeow").freeow(titulo, dialogText, {
-				classes: ["gray", type_alarm],
-				autoHide: false, 
-				startStyle: null,
-				onClick: function(event){
-					var type = '';
-					var type_cookie = '';
-					if($(this).hasClass('alarmDeadline')){
-						type = 'alarmDeadline';
-						type_cookie = 'fadeAlarm';
-					}else if($(this).hasClass('doneDeadline')){
-						type = 'doneDeadline';
-						type_cookie = 'fadeCompleted';
-					}else if($(this).hasClass('filtersDeadline')){
-						type = 'filtersDeadline';
-						type_cookie = 'fadeFilterAlarm';
-					}
-					if($(event.target).hasClass('stop-alert-alarm')){
-						return;
-					}
-					if($(event.target).hasClass('minimize-alarm')){
-						$('.'+type).find('.content-alarm').hide();
-						$(event.target).removeClass('minimize-alarm').addClass('maximize-alarm');
-						return;
-					}
-					if($(event.target).hasClass('maximize-alarm')){
-						$('.'+type).find('.content-alarm').show();
-						$(event.target).removeClass('maximize-alarm').addClass('minimize-alarm');
-						return;
-					}
-					if($(event.target).hasClass('confirm-alarm')){
-						ok_function(event, type, type_cookie);
-						$('.'+type).remove();
-						return;
-					}
-					return false;
-				}
-			});
-			// elementos do freeow desnecessários
-			$('.gray .background .content p').remove();
-			$('.gray .icon').remove();
-			$('.gray .close').remove();
-			
-			// botão ok da modal com jquery button
-			$('.content-alarm button').button();
-		}		
-	}
-	
+					caption: (itens.length == 1) ? get_lang('You have an archived message:') : get_lang('You have %1 messages archived:', itens.length),
+					type: 'filtersDeadline',
+					captions: {
+						singular:'You have one undone message today:', 
+						plural:"You have %1 undone messages today:"
+					}
+				};
+
+		}else
+			data.filtersAlarms = false;
+	}
+
+	for (var i in data)
+		if(data[i] != false)
+			showAlarmsModal(data[i]);
+
 	// controle de qual janela de alarme estará maximizada
 	$('.gray').find('.content-alarm').hide();
@@ -724,4 +674,160 @@
 	
 }
+
+
+function showAlarmsModal(alarm){
+	
+	var ok_function = function(event, type, type_cookie){
+		if($(event.target).parents('.'+type).find('[name="stopAlert"]').is(':checked')){
+			$.cookie(type_cookie, (new Date).toString("dd/MM/yyyy"), { 
+				expires: 1 
+			});
+		}
+	}
+
+	// carrega o template dos alarmes e cria a modal utilizando o plugin freeow
+	var dialogText = DataLayer.render("../prototype/modules/mail/templates/followupflag_alarm_list.ejs", alarm);
+	var titulo = '<div class="header-alarm"><span class="img_title"></span><span class="title-alarm"><strong>'+alarm.title+'</strong></span><span name="header-icon" class="maximize-alarm"></span></div>';
+	
+	$("#freeow").freeow(titulo, dialogText, {
+		classes: ["gray", alarm.type],
+		autoHide: false, 
+		startStyle: null,
+		onClick: function(event){
+			var type = '';
+			var type_cookie = '';
+			if($(this).hasClass('alarmDeadline')){
+				type = 'alarmDeadline';
+				type_cookie = 'fadeAlarm';
+			}else if($(this).hasClass('doneDeadline')){
+				type = 'doneDeadline';
+				type_cookie = 'fadeCompleted';
+			}else if($(this).hasClass('filtersDeadline')){
+				type = 'filtersDeadline';
+				type_cookie = 'fadeFilterAlarm';
+			}
+			if($(event.target).hasClass('stop-alert-alarm')){
+				return;
+			}
+			if($(event.target).hasClass('minimize-alarm')){
+				$('.'+type).find('.content-alarm').hide();
+				$(event.target).removeClass('minimize-alarm').addClass('maximize-alarm');
+				return;
+			}
+			if($(event.target).hasClass('maximize-alarm')){
+				$('.'+type).find('.content-alarm').show();
+				$(event.target).removeClass('maximize-alarm').addClass('minimize-alarm');
+				return;
+			}
+			if($(event.target).hasClass('confirm-alarm')){
+				ok_function(event, type, type_cookie);
+				$('.'+type).remove();
+				return;
+			}
+			return false;
+		}
+	});
+	// elementos do freeow desnecessários
+	$('.gray .background .content p').remove();
+	$('.gray .icon').remove();
+	$('.gray .close').remove();
+
+	$('div.gray.alarmDeadline .button.delete').button({
+		text: false,
+		icons:{
+			primary: 'ui-icon-close'
+		}
+	})
+	
+	// botão ok da modal com jquery button
+	$('.content-alarm button').button();
+}
+
+function cancelAlarm(element, idAlarm, messageNumber, folderName){
+
+	$(element).parents('li').remove();
+
+	var view = 'div.gray.alarmDeadline';
+	var length = $(view).find('ul.message-list li').length;
+
+	if(length > 0){
+		var msg = '';
+		if(length == 1)
+			msg = get_lang( 'You have a follow up due for today:');
+		else
+			msg = get_lang('You have %1 follow ups due for today:', length);
+
+		$(view).find('span.subtitle-alarm strong').html(msg);
+	}else
+		$(view).remove();
+
+	DataLayer.put('followupflagged', 
+		{
+			id: idAlarm , 
+			isSent: '1',
+			folderName: folderName,
+			messageNumber: messageNumber,
+			uid: User.me.uid
+		});
+
+	DataLayer.commit();
+
+}
+
+alarmDeadline = {
+
+
+	load: function(alarm){
+		var currentDate = new Date().toString("dd/MM/yyyy")
+		if($.cookie("fadeAlarm") != currentDate)
+			for(var i = 0; i < alarm.length; i++)
+			    	this.addAlarm( alarm[i] );
+	},
+
+	addAlarm: function(alarm){
+
+		    DataLayer.task( parseInt(alarm['sentTime']) , function( timestamp ){
+		    	var view = 'div.gray.alarmDeadline';
+
+		    	if(!$(view+' li.message-item.'+alarm.id).length){
+
+			    	var currentDate = new Date().toString("dd/MM/yyyy")
+					if($.cookie("fadeAlarm") != currentDate)
+				    	
+				    	if($('div.gray.alarmDeadline').length){
+				    		
+				    		$(view).find('ul.message-list').append(DataLayer.render("../prototype/modules/mail/templates/followupflag_alarmDeadline_add_item_list.ejs", alarm))
+
+				    		var length = $(view).find('ul.message-list li').length;
+				    		var msg = '';
+				    		if(length == 1)
+				    			msg = get_lang( 'You have a follow up due for today:');
+				    		else
+				    			msg = get_lang('You have %1 follow ups due for today:', length);
+
+				    		$(view).find('span.subtitle-alarm strong').html(msg);
+
+				    		$(view+' .button.delete').button({
+								text: false,
+								icons:{
+									primary: 'ui-icon-close'
+								}
+							});
+
+				    	}else{
+				    		var item = {
+								alarms: [alarm],
+								title: get_lang('Follow ups'),
+								caption: get_lang('You have one undone message today:'),
+								type: 'alarmDeadline'
+							};
+							showAlarmsModal(item);
+				    	}
+				    }
+				
+		    });
+	}
+
+}
 		
 $('#main_table').ready(function(){
Index: /sandbox/2.4.2-expresso1/prototype/modules/mail/templates/followupflag_configure.ejs
===================================================================
--- /sandbox/2.4.2-expresso1/prototype/modules/mail/templates/followupflag_configure.ejs	(revision 6294)
+++ /sandbox/2.4.2-expresso1/prototype/modules/mail/templates/followupflag_configure.ejs	(revision 6751)
@@ -70,5 +70,5 @@
 				<input type="checkbox" name="alarm" <%=(followupflagged.alarmDeadline) ? 'checked="checked"' : '' %> /><label><%= get_lang("Alarm")%>: </label>
 				<input type="text" name="alarmDate" class="date" size="12" value="<%=(followupflagged.alarmDeadline) ? followupflagged.alarmDeadline.toString('dd/MM/yyyy') : '' %>" /> 
-				<input type="hidden" name="alarmTime" class="time" size="8" value="00:01" />
+				<input type="text" name="alarmTime" class="time" size="8" disabled="disabled" value="<%=(followupflagged.alarmDeadline) ? followupflagged.alarmDeadline.toString('HH:mm') : '' %>" />
 			</div>		
 		   <div class="completed-followup">
Index: /sandbox/2.4.2-expresso1/prototype/modules/mail/templates/followupflag_alarm_list.ejs
===================================================================
--- /sandbox/2.4.2-expresso1/prototype/modules/mail/templates/followupflag_alarm_list.ejs	(revision 6487)
+++ /sandbox/2.4.2-expresso1/prototype/modules/mail/templates/followupflag_alarm_list.ejs	(revision 6751)
@@ -3,16 +3,19 @@
 		<strong><%=data.caption %></strong>
 	</span>
-	<ul class="message-list">
+	<ul class="message-list" style="float: left;">
 	<%
-	for(var i=0; i<data.alarmInRange.length; i++){
+	for(var i=0; i<data.alarms.length; i++){
 		if(data.type == 'filtersDeadline')
-			var openMessageScript = "$(this).parent().remove(); var msgs_count = $('.filtersDeadline').find('.message-item').length; if(msgs_count == 0){ $('.filtersDeadline').remove(); } $('.subtitle-alarm').find('strong').html((msgs_count == 1)?get_lang('"+data.captions.singular+"'):get_lang('"+data.captions.plural+"', msgs_count)); cExecute('$this.imap_functions.open_flagged_msg&msg_number="+data.alarmInRange[i].msg_number+"&msg_folder="+data.alarmInRange[i].msg_folder+"&alarm=true', show_msg);";
+			var openMessageScript = "$(this).parent().remove(); var msgs_count = $('.filtersDeadline').find('li.message-item').length; if(msgs_count == 0){ $('.filtersDeadline').remove(); } $('.subtitle-alarm').find('strong').html((msgs_count == 1)?get_lang('"+data.captions.singular+"'):get_lang('"+data.captions.plural+"', msgs_count)); cExecute('$this.imap_functions.open_flagged_msg&msg_number="+data.alarms[i].msg_number+"&msg_folder="+data.alarms[i].msg_folder+"&alarm=true', show_msg);";
 		else	
-			var openMessageScript = "cExecute('$this.imap_functions.get_info_msg&msg_number="+data.alarmInRange[i].msg_number+"&msg_folder="+data.alarmInRange[i].msg_folder+"&alarm=true', show_msg);";
+			var openMessageScript = "cExecute('$this.imap_functions.get_info_msg&msg_number="+data.alarms[i].msg_number+"&msg_folder="+data.alarms[i].msg_folder+"&alarm=true', show_msg);";
 	%>
-		<li class="message-item">
+		<li class="message-item <%= data.alarms[i].id %>">
 			<a onclick="<%=openMessageScript%>">
-				<%= data.alarmInRange[i].a %>
+				<%= data.alarms[i].a %>
 			</a>
+			<%if( data.type == 'alarmDeadline'){%>
+				<a onclick='cancelAlarm(this, "<%= data.alarms[i].id %>", "<%= data.alarms[i].msg_number %>", "<%= data.alarms[i].msg_folder %>");' class="tiny button delete">close</a>
+			<%}%>
 		</li>
 	<%
Index: /sandbox/2.4.2-expresso1/prototype/modules/mail/templates/followupflag_alarmDeadline_add_item_list.ejs
===================================================================
--- /sandbox/2.4.2-expresso1/prototype/modules/mail/templates/followupflag_alarmDeadline_add_item_list.ejs	(revision 6751)
+++ /sandbox/2.4.2-expresso1/prototype/modules/mail/templates/followupflag_alarmDeadline_add_item_list.ejs	(revision 6751)
@@ -0,0 +1,6 @@
+<li class="message-item <%= data.id %>">
+	<a onclick="cExecute('$this.imap_functions.get_info_msg&msg_number=<%= data.messageNumber %>&msg_folder=<%= data.folderName %>&alarm=true', show_msg);">
+		<%= data.a %>
+	</a>
+	<a onclick='cancelAlarm(this, "<%= data.id %>", "<%= data.messageNumber %>", "<%= data.folderName %>");' class="tiny button delete">close</a>
+</li>
Index: /sandbox/2.4.2-expresso1/expressoMail1_2/templates/default/main.css
===================================================================
--- /sandbox/2.4.2-expresso1/expressoMail1_2/templates/default/main.css	(revision 6718)
+++ /sandbox/2.4.2-expresso1/expressoMail1_2/templates/default/main.css	(revision 6751)
@@ -1399,2 +1399,22 @@
 	border-color : red;
 }
+
+/*freeow*/
+div.gray.alarmDeadline .button.delete
+{
+/*
+	display: block;
+	position: absolute;
+	right: 19px;
+	top: 50px;
+	*/
+}
+
+/*div.gray.alarmDeadline ul.message-list{overflow: hidden;}*/
+
+/*div.gray.alarmDeadline ul.message-list li{ margin: 5px 0;}*/
+
+div.gray li{float: left; width: 253px;}
+
+div.gray li a.button.delete{float: right;}
+
