Index: /branches/2.4/expressoAdmin1_2/index.php
===================================================================
--- /branches/2.4/expressoAdmin1_2/index.php	(revision 5804)
+++ /branches/2.4/expressoAdmin1_2/index.php	(revision 6453)
@@ -34,4 +34,5 @@
             
             <script type="text/javascript" src="../prototype/modules/calendar/js/calendar.codecs.js"></script>
+            <script type="text/javascript" src="../prototype/modules/calendar/js/load.js"></script>
             
             <script type="text/javascript" src="js/jscode/assing_calendar.js"></script>
Index: /branches/2.4/prototype/modules/calendar/js/calendar.date.js
===================================================================
--- /branches/2.4/prototype/modules/calendar/js/calendar.date.js	(revision 5510)
+++ /branches/2.4/prototype/modules/calendar/js/calendar.date.js	(revision 6453)
@@ -143,7 +143,13 @@
 		return dateFormat( date, format.replace(/m/g, 'M') );
 
+	}, 
+ 		 
+        toString: function(date, format){ 
+                        return dateFormat( date, format.replace(/M/g, 'm') ); 
+        }, 
+         
+        decodeRange: function(date, range){ 
+                        return (parseInt(date.getTime()) + (range * 60000)); 
 	}
-	
-	
 		
 }
Index: /branches/2.4/prototype/modules/calendar/js/calendar.codecs.js
===================================================================
--- /branches/2.4/prototype/modules/calendar/js/calendar.codecs.js	(revision 6420)
+++ /branches/2.4/prototype/modules/calendar/js/calendar.codecs.js	(revision 6453)
@@ -144,127 +144,4 @@
 });
 
-Refresh = {
-    //Tempo em que após a ultima sincronização será verificado atualizações
-    timeRefresh : 180,
-    clookRefresh: false,
-
-    init: function(){
-
-	delete DataLayer.tasks[this.clookRefresh];
-	
-	//Realiza agendamentos de atualização de view somente se o módulo aberto for expressoCalendar
-	if(User.moduleName == "expressoCalendar"){
-	    this.clookRefresh = (parseInt(($.now()) / 1000) + this.timeRefresh);
-
-	    DataLayer.task( this.clookRefresh , function(){
-		Calendar.rerenderView(true);
-	    });
-	}
-    }
-}
-
-Calendar = {
-  
-    load: function(){
-	this.lastView = 0;
-	var filter = ['=', 'user', User.me.id];
-	if(!!User.me.gidNumber){
-	    if(!$.isArray(User.me.gidNumber))
-		User.me.gidNumber = [User.me.gidNumber];
-
-	    filter = ['OR', filter, ['IN', 'user', User.me.gidNumber]];
-	}
-
-	//var descart = DataLayer.get("calendarSignature", {filter: filter, criteria: {deepness: 2}});
-	this.signatures  = DataLayer.get("calendarSignature", {
-	    filter: filter, 
-	    criteria: {
-		deepness: 2
-	    }
-	});
-	  
-    var prevSources = this.sources;
-    
-    this.sources = DataLayer.encode( "calendarSignature:calendar", this.signatures );
-
-     if( prevSources )
-    {
-	var newSources = this.sources.slice();
-
-	for( var i = 0; i < newSources.length; i++ )
-	    $('#calendar').fullCalendar( 'addEventSource', newSources[i] );
-
-	for( var i = 0; i < prevSources.length; i++ )
-	    $('#calendar').fullCalendar( 'removeEventSource', prevSources[i] );
-    }
-
-    this.calendarIds = [], this.signatureOf = {}, this.calendars = [], this.calendarOf= {};
-
-    for( var i = 0; i < this.signatures.length; i++ ){
-	if(this.signatures[i].isOwner == "0")
-	    this.signatures[i].permission =  DataLayer.encode('calendarToPermission:detail', this.signatures[i].permission);
-	this.signatureOf[ this.calendarIds[i] = ( this.calendars[ this.calendars.length ] = this.calendarOf[ this.signatures[i].id ] = this.signatures[i].calendar ).id ] = this.signatures[i];
-    }
-
-    delete Calendar.currentViewKey;
-    Refresh.init();
-    },
-
-    rerenderView: function(force){
-        //TODO - Remover if quando centralizar o objeto User que contem as informações do usuário logado em um local acessível a todos módulos
-        if(User.moduleName == "expressoCalendar"){
-            if((typeof($tabs) != "undefined") && $tabs.tabs('option' ,'selected') == 0){
-                if(force){
-                    delete Calendar.currentViewKey;
-                    $('#calendar').fullCalendar( 'refetchEvents' );
-
-                    //Recarrega os alarmes de eventos    
-                    Alarms.load();
-
-                    Refresh.init();
-                }
-
-                var calendarNotSelected = getSelectedCalendars( true );
-                for(var i = 0; i < calendarNotSelected.length; i++)
-                        if(!!Calendar.currentView[ calendarNotSelected[i] ])
-                        Calendar.currentView[ calendarNotSelected[i] ].hidden = true;
-
-                $('#calendar').fullCalendar( 'refetchEvents' );	
-
-                contentMenu();
-            }else if((typeof($tabs) != "undefined") && $tabs.tabs('option' ,'selected') != 0)
-                pageselectCallback($('.events-list-win.active [name=keyword]').val(), 0);
-        }
-    }
-}
-
-Alarms = {
-    load: function(){
-	var eventsDay = DataLayer.get('alarm:schedulable',['=', 'date', Date.today().getTime()]);
-	if(eventsDay)
-	for(var i = 0; i < eventsDay.length; i++){
-	    this.addAlarm( eventsDay[i] );
-	}
-    },
-	
-    addAlarm: function( eventDay ){            
-	if(!DataLayer.tasks[parseInt(eventDay.sendTime)]){
-	    DataLayer.task( parseInt(eventDay.sendTime) , function( timestamp ){
-		var path = User.moduleName == 'expressoCalendar' ? '' : '../prototype/modules/calendar/';
-		DataLayer.render(path+'templates/alarm.ejs',{
-		    event: eventDay
-		}, function( html ){                                
-		    $.Zebra_Dialog(html , {
-			'type':     'question',
-			'overlay_opacity': '0.5',
-			'buttons':  ['Fechar'],
-			'onClose':  function(clicked) {}
-		    });
-		});
-	    });
-	}
-    }
-}
-
 DataLayer.codec( "modulePreference", "detail", {
     decoder: function( evtObj ){
@@ -309,7 +186,4 @@
     }
 });
-
-User.init();
-Calendar.load();
 
 /*Todo Melhorias serão feitas na API*/
@@ -475,6 +349,6 @@
 	    return {
 		participant : meAttendee(form.attendee), 
-		startTime: Date.parseExact(form.startDate + (!!form.allDay ? " 00:00": " "+$.trim(form.startHour)) , formatString ).toString('yyyy-MM-dd HH:mm:00'),
-		endTime:  Date.parseExact(form.endDate + ( !!form.allDay ? " 00:00": " "+$.trim(form.endHour)), formatString ).toString('yyyy-MM-dd HH:mm:00'),
+		startTime: Date.parseExact(form.startDate + " "+$.trim(form.startHour) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), 
+ 		endTime:  Date.parseExact(form.endDate + " "+$.trim(form.endHour), formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), 
 		allDay: ( !!form.allDay ? 1 : 0 ),
 		schedulable: form.idEvent
@@ -569,5 +443,5 @@
 			    if(form.startDate){
 				var tzId =  DataLayer.get('schedulable', form.idEvent).timezone || User.preferences.timezone,
-				formatString = ( typeof form.allDay !== "undefined" && !!form.allDay )? pref.dateFormat+" HH:mm" : pref.dateFormat + " " + pref.hourFormat;
+				formatString = pref.dateFormat + " " + pref.hourFormat;
 								
 				DataLayer.put('notification', {
@@ -766,9 +640,7 @@
     patati['byday'] = day.join(',');
 
-    var formatString = ( typeof form.allDay !== "undefined" && !!form.allDay )? User.preferences.dateFormat+" HH:mm" : User.preferences.dateFormat + " " + User.preferences.hourFormat;
-
-    var date = Date.parseExact( form.startDate + (!!form.allDay ? " 00:00": " "+$.trim(form.startHour)) , formatString );
-	
-    patati['startTime'] = date.toString('yyyy-MM-dd HH:mm:00');
+    var formatString = User.preferences.dateFormat + " " + User.preferences.hourFormat; 
+  
+    patati['startTime'] = Date.parseExact( form.startDate + " "+$.trim(form.startHour) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'); 
 	
     if( !patati['byday'] )
@@ -782,5 +654,5 @@
 		break;
 	    case 'yearly':
-		patati['byyearday'] = (1 + date.getDayOfYear());
+		patati['byyearday'] = (1 + date.getDayOfYear()); 
 		break;
 	    default :
@@ -792,7 +664,7 @@
 	
     if (($(".endRepeat").val() == 'customDate'))
-	patati['endTime'] = Date.parseExact( $(".customDateEnd").val() + (!!form.allDay ? " 00:00": " "+$.trim(form.endHour)) , formatString ).toString('yyyy-MM-dd HH:mm:00');
-	
-    patati['interval']  = $(".eventInterval").val();
+    	patati['endTime'] = Date.parseExact( $(".customDateEnd").val() + (" "+$.trim(form.endHour)) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'); 
+   
+ patati['interval']  = $(".eventInterval").val();
 
     /**
@@ -841,5 +713,5 @@
 	    var tzId =  form.timezone || Calendar.signatureOf[form.calendar].calendar.timezone || User.preferences.timezone,
 
-	    formatString = ( typeof form.allDay !== "undefined" && !!form.allDay )? pref.dateFormat+" HH:mm" : pref.dateFormat + " " + pref.hourFormat;
+	    formatString = pref.dateFormat + " " + pref.hourFormat;
 
 	    var Owner = decodeOwnerCalendar(form.calendar);
@@ -847,6 +719,6 @@
 	    return DataLayer.merge({
 		"class": form["class"],
-		startTime: Date.parseExact(form.startDate + (!!form.allDay ? " 00:00": " "+$.trim(form.startHour)) , formatString ).toString('yyyy-MM-dd HH:mm:00'),
-		endTime:  Date.parseExact(form.endDate + ( !!form.allDay ? " 00:00": " "+$.trim(form.endHour)), formatString ).toString('yyyy-MM-dd HH:mm:00'),  //+ (!!form.allDay ? 86400000 : 0) ,
+		startTime: Date.parseExact(form.startDate + " "+$.trim(form.startHour) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), 
+ 	        endTime:  Date.parseExact(form.endDate + " "+$.trim(form.endHour), formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'),  //+ (!!form.allDay ? 86400000 : 0) , 
 		allDay: ( !!form.allDay ? 1 : 0 ),       
 		id: form.idEvent,
@@ -1239,5 +1111,5 @@
 });
 
-Alarms.load();
+User.init();
 
 // DataLayer.decoder( "participant", "detail", function( form ){
Index: /branches/2.4/prototype/modules/calendar/js/map.disponibility.js
===================================================================
--- /branches/2.4/prototype/modules/calendar/js/map.disponibility.js	(revision 6327)
+++ /branches/2.4/prototype/modules/calendar/js/map.disponibility.js	(revision 6453)
@@ -15,8 +15,8 @@
 	var isAllDay   = $('.new-event-win.active input[name="allDay"]').is(':checked');
 	
-	var formatString = (isAllDay)? User.preferences.dateFormat+" HH:mm" : User.preferences.dateFormat + " " + User.preferences.hourFormat;
+	var formatString = User.preferences.dateFormat + " " + User.preferences.hourFormat;
 	
-	var startDate = Date.parseExact( isAllDay ? start_date+ " 00:00": start_date + " " + $.trim(start_time) , formatString );
-	var endDate = Date.parseExact( isAllDay ? end_date+ " 00:00": end_date + " " + $.trim(end_time) , formatString );
+	var startDate = Date.parseExact(  start_date + " " + $.trim(start_time) , formatString );
+	var endDate = Date.parseExact(  end_date + " " + $.trim(end_time) , formatString );
 	
 	
@@ -36,7 +36,7 @@
 
 function disponibily(objEvent, path, attendees){
-	var formatString = (objEvent.allDay)? User.preferences.dateFormat+" HH:mm" : User.preferences.dateFormat + " " + User.preferences.hourFormat;
-	var startDate = Date.parseExact( objEvent.allDay ? objEvent.startDate+ " 00:00": objEvent.startDate + " " + $.trim(objEvent.startHour) , formatString );
-	var endDate = Date.parseExact( objEvent.allDay ? objEvent.endDate+ " 00:00": objEvent.endDate + " " + $.trim(objEvent.endHour) , formatString );
+	var formatString = User.preferences.dateFormat + " " + User.preferences.hourFormat;
+	var startDate = Date.parseExact( objEvent.startDate + " " + $.trim(objEvent.startHour) , formatString );
+	var endDate = Date.parseExact( objEvent.endDate + " " + $.trim(objEvent.endHour) , formatString );
 	 
 	var mapHtml = DataLayer.render( path+'templates/availability_map.ejs', {});
@@ -44,8 +44,5 @@
 	$("#new_event_map").fullCalendar(DataLayer.merge({
 		height : 300,
-		timeFormat: {
-			agenda: 'HH:mm{ - HH:mm}',
-			'': 'HH:mm{ - HH:mm} }'
-		},
+		timeFormat: User.preferences.hourFormat,
 		axisFormat: User.preferences.hourFormat,
 		firstDay: dateCalendar.dayOfWeek[User.preferences.weekStart],
@@ -76,13 +73,13 @@
 			$("#new_event_map").fullCalendar( 'updateEvent', event2 );
 			
-			$('[name="startDate"]').val(start.toString("dd/MM/yyyy"));
-			$('[name="endDate"]').val(end.toString("dd/MM/yyyy"));
+			$('[name="startDate"]').val(start.toString(User.preferences.dateFormat));
+			$('[name="endDate"]').val(end.toString(User.preferences.dateFormat));
 			if(!allDay){
 				$('[name="allDay"]').attr("checked", false); 
 				UI.dialogs.addEvent.find('.start-time, .end-time').removeClass('hidden');
 				
-				$('[name="startHour"]').val(start.toString("HH:mm"));
+				$('[name="startHour"]').val(start.toString(User.preferences.hourFormat));
 				if(end){
-					$('[name="endHour"]').val(end.toString("HH:mm"));
+					$('[name="endHour"]').val(end.toString(User.preferences.hourFormat));
 				}
 			}else{
@@ -108,31 +105,28 @@
 				$('[name="allDay"]').attr("checked", true); 
 				UI.dialogs.addEvent.find('.start-time, .end-time').addClass('hidden');
-				$('[name="startDate"]').val(event.start.toString("dd/MM/yyyy"));
-				if(event.end)
-					$('[name="endDate"]').val(event.end.toString("dd/MM/yyyy"));
-				else
-					$('[name="endDate"]').val(event.start.toString("dd/MM/yyyy"));
-				return;
+				
+				$('[name="startDate"]').val(dateCalendar.toString(event.start, User.preferences.dateFormat));				
+				$('[name="endDate"]').val(dateCalendar.toString((event.end ? event.end : event.start), User.preferences.dateFormat));
+
 			}else{
 				$('[name="allDay"]').attr("checked", false); 
 				UI.dialogs.addEvent.find('.start-time, .end-time').removeClass('hidden');
+			
+				$('[name="startHour"]').val(dateCalendar.formatDate(event.start, User.preferences.hourFormat));
+				$('[name="startDate"]').val(dateCalendar.toString(event.start, User.preferences.dateFormat));
+				
+				$('[name="endHour"]').val(dateCalendar.formatDate((event.end ? event.end : new Date(dateCalendar.decodeRange(event.start, 120))), User.preferences.hourFormat));
+
+				$('[name="endDate"]').val(dateCalendar.toString(event.end ? event.end : event.start , User.preferences.dateFormat));
 			}
-			$('[name="startHour"]').val(event.start.toString("HH:mm"));
-			$('[name="startDate"]').val(event.start.toString("dd/MM/yyyy"));
-			if(event.end){
-				$('[name="endHour"]').val(event.end.toString("HH:mm"));
-				$('[name="endDate"]').val(event.end.toString("dd/MM/yyyy"));
-			}else
-				$('[name="endDate"]').val(event.start.toString("dd/MM/yyyy"));
 		},
 		eventResize: function(event,dayDelta,minuteDelta,revertFunc) {
-			if(event.end){
-				$('[name="endHour"]').val(event.end.toString("HH:mm"));
-				$('[name="endDate"]').val(event.end.toString("dd/MM/yyyy"));
-			}else
-				$('[name="endDate"]').val(event.start.toString("dd/MM/yyyy"));
+			if(event.end)
+				$('[name="endHour"]').val(dateCalendar.formatDate(event.end, User.preferences.hourFormat));
+			
+			$('[name="endDate"]').val(dateCalendar.toString(event.end ? event.end : event.start , User.preferences.dateFormat));
 				
 		},
-		defaultView : "agendaWeek"
+	defaultView : "agendaWeek"
 	}, dateCalendar));
 	var eventSource = new Array();
Index: /branches/2.4/prototype/modules/calendar/js/helpers.js
===================================================================
--- /branches/2.4/prototype/modules/calendar/js/helpers.js	(revision 6412)
+++ /branches/2.4/prototype/modules/calendar/js/helpers.js	(revision 6453)
@@ -13,4 +13,24 @@
 
 function validDateEvent(){
+   
+    var errors = { 
+            'emptyInitData': 'Por favor, informe uma data inicial', 
+            'emptyEndData': 'Por favor, informe uma data final', 
+            'emptyInitHour': 'Por favor, informe uma hora inicial', 
+            'emptyEndHour': 'Por favor, informe uma hora final', 
+             
+            'invalidInitData' : 'Data inicial inválida', 
+            'invalidEndData' : 'Data final inválida', 
+             
+            'equalData' : 'Hora inicial igual a final', 
+            'theirData' : 'Hora final menor que a inicial', 
+             
+            'emptyOcurrence' : 'Por favor, informe o número de ocorrências', 
+            'invalidOcurrence' : 'Por favor, informe um valor válido para a quantidade de ocorrências', 
+              
+            'emptyInterval' : 'Por favor, informe o intervalo', 
+            'invalidInterval' : 'Por favor informe um valor válido para o intervalo' 
+    }; 
+
     var start_date = $(".new-event-win.active .start-date").val();
     var end_date   = $(".new-event-win.active .end-date").val();
@@ -23,45 +43,49 @@
     
     if(start_date == "")
-	return 'Por favor, informe uma data inicial';
+	return errors['emptyInitData']; 
     else if(end_date == "")
-	return 'Por favor, informe uma data final';
+	return errors['emptyEndData']; 
     else if(!isAllDay && start_time == "")
-	return 'Por favor, informe uma hora inicial';
+	return errors['emptyInitHour']; 
     else if(!isAllDay && end_time == "")
-	return 'Por favor, informe uma hora final';
-	
-    var formatString = (isAllDay)? User.preferences.dateFormat+" HH:mm" : User.preferences.dateFormat + " " + User.preferences.hourFormat;
-		
-    var startDate = Date.parseExact( isAllDay ? start_date+ " 00:00": start_date + " " + $.trim(start_time) , formatString );
-    var endDate = Date.parseExact( isAllDay ? end_date+ " 00:00": end_date + " " + $.trim(end_time) , formatString );
+	return errors['emptyEndHour']; 
+ 	      
+ 	var formatString = User.preferences.dateFormat + " " + User.preferences.hourFormat; 
+ 	             
+ 	var startDate = Date.parseExact( start_date + " " + $.trim(start_time) , formatString ); 
+ 	var endDate = Date.parseExact( end_date + " " + $.trim(end_time) , formatString ); 
 
     if(startDate == null || startDate.getTime() < 0 )
-	return 'Data inicial inválida';
+	return errors['invalidInitData'];
     if(endDate == null || endDate.getTime() < 0)
-	return 'Data final inválida';
-	
-    if((endDate.compareTo(startDate) != 1) && !((endDate.compareTo(startDate) == 0) && (isAllDay))){
-	return (start_date == end_date) ? 
-	((end_time == start_time) ? 'Hora inicial igual a final' : 'Hora final menor que a inicial') :
-	'Data final menor que a inicial';
-    }
+	return errors['invalidEndData']; 
+ 	     
+ 	if(isAllDay){ 
+ 	        startDate.clearTime(); 
+ 	        endDate.clearTime(); 
+ 	        if(endDate.compareTo(startDate) == -1) 
+ 	                return errors['theirData']; 
+ 	}else{ 
+ 	        var conditon = endDate.compareTo(startDate); 
+ 	        if(conditon != 1)  
+ 	                return errors[conditon == 0 ? 'equalData' : 'theirData']; 
+ 	} 
     
-    if (customDate){     
-	if ( !($('.new-event-win.active .customDateEnd').val().length) )
-           return 'Por favor, informe uma data final';     
-    }
-    
-    if (occurrences){
-	if ( !($('.occurrencesEnd').val().length) ) 
-           return 'Por favor, informe o número de ocorrências';
-       else if (parseInt($('.occurrencesEnd').val(),10) <= 0 || parseInt($('.occurrencesEnd').val(),10).toString() == "NaN")
-           return 'Por favor, informe um valor válido para a quantidade de ocorrências';
-    }
+   if (customDate)     
+ 	      if ( !($('.new-event-win.active .customDateEnd').val().length) ) 
+ 	         return errors['emptyEndData']; 
+ 	   
+   if (occurrences){
+       if ( !($('.occurrencesEnd').val().length) )  
+ 	  return errors['emptyOcurrence']; 
+       else if (parseInt($('.occurrencesEnd').val(),10) <= 0 || parseInt($('.occurrencesEnd').val(),10).toString() == "NaN") 
+          return errors['invalidOcurrence']; 
+   } 
 
     if (!($('.new-event-win.active p.input-group.finish_event.repeat-in').hasClass('hidden'))){
         if (!eventInterval.length)
-            return 'Por favor, informe o intervalo';
+           return errors['emptyInterval']; 
         else if (parseInt(eventInterval,10) < 1 || parseInt(eventInterval,10).toString() == "NaN")
-            return 'Por favor informe um valor válido para o intervalo';
+           return errors['invalidInterval']; 
     }    
     return false;
@@ -453,5 +477,7 @@
 
     UI.dialogs.addEvent.find('#calendar_addevent_details3').html(repeatHtml);
-    $(".date").datepicker();
+    $(".date").datepicker({ 
+ 	        dateFormat: User.preferences.dateFormat.replace(/M/g, 'm').replace(/yyyy/g, 'yy') 
+ 	        }); 
 		  
     if(objEvent.repeat) 
@@ -821,5 +847,5 @@
 
 var dates = UI.dialogs.addEvent.find('input.date').datepicker({
-    dateFormat: 'dd/mm/yy',
+    dateFormat: User.preferences.dateFormat.replace(/M/g, 'm').replace(/yyyy/g, 'yy'),
     onSelect : function( selectedDate ){
 	updateMap();
@@ -2470,50 +2496,52 @@
 }
 // não há resultados	
+
+var currentView = '#tab_events_list_' + ((Base64.encode(keyword)).replace(/[^\w\s]/gi, "") || ''); 
+
 if ((((typeof(results) == 'undefined') || (!results.events_list )) && selecteds) &&(keyword != '' && keyword != null)) {
-    jQuery('#tab_events_list_' + ((Base64.encode(keyword)).replace(/[^\w\s]/gi, "")|| '')).html(
-	'<div title="Lista de eventos" class="events-list events-list-win active empty">' +
-	'<label>Não foi encontrado nenhum evento correspondente à sua pesquisa.</label>' +
-	'</div>'
+    $(currentView).html( 
+                '<div title="Lista de eventos" class="events-list events-list-win active empty">' + 
+                '<label>Não foi encontrado nenhum evento correspondente à sua pesquisa.</label>' + 
+                '</div>' 
 	);
 // há resultados e Agendas Selecionadas
 } else{ 
     if(typeof(results) != 'undefined'){
-	results['page_index'] = page_index;
-	results['keyword'] = keyword;
-			
-	DataLayer.render( 'templates/event_list.ejs', results, function( html ){
-	    var currentView = '#tab_events_list_' + ((Base64.encode(keyword)).replace(/[^\w\s]/gi, "") || '');
-	    jQuery(currentView).html( html );
-	    jQuery('.events-list-win .menu-container .button').button();
-														
-	    $(".event-details-item").parent().click(function(){
-
-		$(this).siblings("div.details-event-list").toggleClass("hidden")
-		.find('.button.delete').click(function(){
-		    var eventId = $(this).siblings('[name="eventid"]').val();
-                    var calendarId = $(this).siblings('[name="calendarid"]').val();
-
-                    remove_event(eventId, calendarId);
-		})
-		.end().find('.button.edit').click(function(){				
-		    eventDetails( DataLayer.get( "schedulable", $(this).siblings('[name="eventid"]').val() ), true );					
+		results['page_index'] = page_index; 
+	 	results['keyword'] = keyword; 
+	 	                                 
+	 	DataLayer.render( 'templates/event_list.ejs', results, function( html ){ 
+	 		                         
+	 	        $(currentView).html( html ); 
+	 	        $('.events-list-win .menu-container .button').button(); 
+	 	                                                                                                              
+	 	        $(".event-details-item").parent().click(function(){ 
+	 	
+	 	        $(this).siblings("div.details-event-list").toggleClass("hidden") 
+	 	        .find('.button.delete').click(function(){ 
+	 	                var eventId = $(this).siblings('[name="eventid"]').val(); 
+	 	                var calendarId = $(this).siblings('[name="calendarid"]').val(); 
+	 	
+	 	                remove_event(eventId, calendarId); 
+	 	        }) 
+	 	        .end().find('.button.edit').click(function(){                            
+	 	                eventDetails( DataLayer.get( "schedulable", $(this).siblings('[name="eventid"]').val() ), true );                                        
+	 	        }); 
+	 		 
+	 	        }); 
+	 	        paginatorListEvent(currentView, (keyword == '' || keyword == null) ? 'list' : 'search',  !!view ? view : User.preferences.defaultCalView); 					
 		});
-
-	    });
-	    paginatorListEvent(currentView, (keyword == '' || keyword == null) ? 'list' : 'search',  !!view ? view : User.preferences.defaultCalView);
-	});
     }else{
-	var currentView = '#tab_events_list_' + ((Base64.encode(keyword)).replace(/[^\w\s]/gi, "") || '');
-	jQuery('#tab_events_list_' + ((Base64.encode(keyword)).replace(/[^\w\s]/gi, "")|| '')).html(
-	    '<div title="Lista de eventos" class="events-list events-list-win active empty">' +
-	    '<input type="hidden" name="page_index" value="'+page_index+'"></inpunt>'+
-	    '<input type="hidden" name="keyword" value="'+keyword+'"></inpunt>'+
-	    '<label class="empty-result">Não foram encontrados eventos neste intervalo.</label>' +
-	    '</div>'
-	    );
-	paginatorListEvent(currentView, 'list', !!view ? view : User.preferences.defaultCalView);
-    }
-		
-}
+	$(currentView).html( 
+ 	        '<div title="Lista de eventos" class="events-list events-list-win active empty">' + 
+ 	        '<input type="hidden" name="page_index" value="'+page_index+'"></inpunt>'+ 
+ 	        '<input type="hidden" name="keyword" value="'+keyword+'"></inpunt>'+ 
+ 	        '<label class="empty-result">Não foram encontrados eventos neste intervalo.</label>' + 
+ 	        '</div>' 
+ 	        ); 
+ 	paginatorListEvent(currentView, 'list', !!view ? view : User.preferences.defaultCalView); 
+    } 
+} 
+      $tabs.tabs("select", currentView); 
 	
 }
Index: /branches/2.4/prototype/modules/calendar/js/init.js
===================================================================
--- /branches/2.4/prototype/modules/calendar/js/init.js	(revision 5947)
+++ /branches/2.4/prototype/modules/calendar/js/init.js	(revision 6453)
@@ -137,23 +137,12 @@
       -----------------------------------------------------------------*/
 		$(".button.add.add-event").click(function(event){
-			var startEvent = new Date();  
-			if(startEvent.toString('mm') < 30) 
-					startEvent.add({minutes: (30 - parseInt(startEvent.toString('mm')))}); 
-			else 
-					startEvent.add({hours: 1, minutes: '-'+startEvent.toString('mm')}); 
-			var endEvent = function(date){ 
-					if(!!User.preferences.defaultCalendar){ 
-							return  parseInt(date.getTime()) + 
-								(	!!Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration ?  
-									(Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration * 60000) :
-									(User.preferences.defaultDuration * 60000)
-								);
-					}else 
-							return parseInt(date.getTime()) + (User.preferences.defaultDuration * 60000); 
-			};       
-			
+			var startEvent = new Date();
+			var configData = (startEvent.toString('mm') < 30)  ? {minutes: (30 - parseInt(startEvent.toString('mm')))} : {hours: 1, minutes: '-'+startEvent.toString('mm')};
+			startEvent.add(configData); 
+
 			eventDetails({ 
 				startTime: startEvent.getTime(),
-				endTime: endEvent(startEvent)
+				endTime: dateCalendar.decodeRange(startEvent, (!!User.preferences.defaultCalendar ? (	!!Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration ?  
+						(Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration) : (User.preferences.defaultDuration)) : (User.preferences.defaultDuration)))
 			}, true );
 		});
Index: /branches/2.4/prototype/modules/calendar/templates/index.ejs
===================================================================
--- /branches/2.4/prototype/modules/calendar/templates/index.ejs	(revision 5957)
+++ /branches/2.4/prototype/modules/calendar/templates/index.ejs	(revision 6453)
@@ -91,4 +91,5 @@
 <script type='text/javascript' src='<?= MODULESURL ?>/js/timezone.js'></script>
 <script type='text/javascript' src='<?= MODULESURL ?>/js/calendar.codecs.js'></script>
+<script type='text/javascript' src='<?= MODULESURL ?>/js/load.js'></script>	
 
 <script type='text/javascript' src='<?= MODULESURL ?>/js/I18n.js'></script>
Index: /branches/2.4/prototype/api/datalayer.js
===================================================================
--- /branches/2.4/prototype/api/datalayer.js	(revision 6412)
+++ /branches/2.4/prototype/api/datalayer.js	(revision 6453)
@@ -625,4 +625,6 @@
     rollback: function( concept, ids ){
       
+    if(!DataLayer.storage.cache[':diff']) 
+                return false; 
 	if(concept){
 		if(ids){
Index: /branches/2.4/expressoMail1_2/js/main.js
===================================================================
--- /branches/2.4/expressoMail1_2/js/main.js	(revision 6436)
+++ /branches/2.4/expressoMail1_2/js/main.js	(revision 6453)
@@ -3533,4 +3533,5 @@
 		//$.ajax({ url: "../expressoCalendar/index.php", async: false});
 		//$.ajax({url: "../prototype/modules/calendar/js/calendar.date.js", async: false, beforeSend: function( xhr ) { xhr.overrideMimeType('text/javascript; charset=ISO-8859-1')}});
+		$.ajax({url: "../prototype/modules/calendar/js/load.js", async: false, beforeSend: function( xhr ) {xhr.overrideMimeType('text/javascript; charset=ISO-8859-1')}});
 		$.ajax({url: "../prototype/modules/calendar/js/map.disponibility.js", async: false, beforeSend: function( xhr ) {xhr.overrideMimeType('text/javascript; charset=ISO-8859-1')}});
 		$.ajax({url: "../prototype/modules/calendar/js/helpers.js", async: false, beforeSend: function( xhr ) {xhr.overrideMimeType('text/javascript; charset=ISO-8859-1')}});
