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 ){
