Index: /trunk/prototype/services/iCal.php
===================================================================
--- /trunk/prototype/services/iCal.php	(revision 7660)
+++ /trunk/prototype/services/iCal.php	(revision 7680)
@@ -1857,7 +1857,7 @@
             $tzid = self::nomalizeTZID($tzid);
 
-        if (isset($due['params']['VALUE']) && $due['params']['VALUE'] === 'DATE')
+        if (isset($due['params']['VALUE']) && $due['params']['VALUE'] === 'DATE' && isset($params['calendar_timezone']))
             $schedulable['due'] = self::date2timestamp($due['value']) - self::_getTzOffset('UTC', $schedulable['timezone'], '@' . self::date2timestamp($due['value'])) . '000';
-        else if ($tzid && !isset($endTime['value']['tz'])) /* Caso não tenha um tz na data mais exista um parametro TZID deve ser aplicado o timezone do TZID a data */
+        else if ($tzid && !isset($due['value']['tz'])) /* Caso não tenha um tz na data mais exista um parametro TZID deve ser aplicado o timezone do TZID a data */
             $schedulable['due'] = self::date2timestamp($due['value']) - self::_getTzOffset('UTC', $tzid, '@' . self::date2timestamp($due['value'])) . '000';
         else {
Index: /trunk/prototype/modules/calendar/interceptors/DBMapping.php
===================================================================
--- /trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 7660)
+++ /trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 7680)
@@ -82,6 +82,11 @@
     	
 
-        if (isset($params['due']) && $params['due'] != '' && !is_numeric($params['due']))
+        if (isset($params['due']) && $params['due'] != '' && !is_numeric($params['due'])){
             $params['due'] = self::parseTimeDate($params['due'], $params['timezone']);
+
+            if ($params['allDay'])
+                $params['due'] = $params['due'] + 86400000;
+        }
+
 
     	///////////////////////////////////////////////////////////////////
@@ -535,9 +540,19 @@
     	    }
     	    $params['rangeEnd'] = $params['endTime'];
+
+            if($event['type'] == '2'){
+
+                if(!isset($params['due']) && $params['endTime'] != $event['endTime'])
+                    $params['due'] = $params['endTime'];
+
+            }
     	}
 
-
-        if (isset($params['due']) && $params['due'] != '' && !is_numeric($params['due']))
+        if (isset($params['due']) && $params['due'] != '' && !is_numeric($params['due'])){
             $params['due'] = self::parseTimeDate($params['due'], $event['timezone']);
+
+            if ((isset($params['allDay']) && $params['allDay']) || ( !isset($params['allDay']) && $event['allDay']))
+                $params['due'] = $params['due'] + 86400000;
+        }
 
         if($event['type'] == '2'){
@@ -550,51 +565,51 @@
                 unset($criteria['historic']['due']);
 
-		//necessário para atulizar a atividade de composta pela tarefa aqui sendo atualizada
-		if(isset($criteria['historic']['startTime']) || isset($criteria['historic']['endTime'])){
-			$taskToActivity = Controller::find(array('concept' => 'taskToActivity'), false, array('filter' => array('AND', array('=', 'task', $uri['id']), array('=', 'owner', Config::me('uidNumber'))), 'deepness' => 2));
-			if(!empty($taskToActivity)){
-				$activity = Controller::read(array('concept' => 'schedulable', 'id' => $taskToActivity[0]['activity']), array('startTime', 'endTime', 'rangeStart', 'rangeEnd', 'allDay'));
-				$isAllDay = 1;
-
-				if(!empty($activity)){
-					$start = $params['startTime'];
-					$end = $params['endTime'];
-					foreach($taskToActivity as $t){
-					 if($t['task']['id'] != $params['id']){
-						$start = $t['task']['startTime'] < $start ? $t['task']['startTime'] : $start;
-						$end = $t['task']['endTime'] > $end ? $t['task']['endTime'] : $end;
-						$isAllDay = (($isAllDay == 1) && ($t['task']['allDay'] == '1')) ? 1 : 0; 
-					 }
-					}
-
-					if($event['allDay'] == '0' || (isset($params['allDay']) && $params['allDay'] == '0'))
-						$isAllDay = 0;
-
-					$toUpdate = array();
-
-					if($start != $activity['startTime'])
-						$toUpdate['startTime'] = $start;
-
-					if($end != $activity['endTime']){
-						$toUpdate['endTime'] = $end;
-						$toUpdate['due'] = $end;
-					}
-
-					if($isAllDay != $activity['allDay'])
-						$toUpdate['allDay'] = $isAllDay;
-
-					if(!empty($toUpdate))
-						Controller::update(array('concept' => 'schedulable', 'id' => $taskToActivity[0]['activity']), $toUpdate);
-				}
-			}
-		}
-
-		unset($criteria['historic']['endTime']);
-		unset($criteria['historic']['rangeEnd']);
-		unset($criteria['historic']['rangeStart']);
-		unset($criteria['historic']['class']);
-		unset($criteria['historic']['type']);
-		unset($criteria['historic']['allDay']);
-		unset($criteria['historic']['id']);            
+            //necessário para atulizar a atividade de composta pela tarefa aqui sendo atualizada
+            if(isset($criteria['historic']['startTime']) || isset($criteria['historic']['endTime'])){
+                $taskToActivity = Controller::find(array('concept' => 'taskToActivity'), false, array('filter' => array('AND', array('=', 'task', $uri['id']), array('=', 'owner', Config::me('uidNumber'))), 'deepness' => 2));
+                if(!empty($taskToActivity)){
+                    $activity = Controller::read(array('concept' => 'schedulable', 'id' => $taskToActivity[0]['activity']), array('startTime', 'endTime', 'rangeStart', 'rangeEnd', 'allDay'));
+                    $isAllDay = 1;
+
+                    if(!empty($activity)){
+                        $start = $params['startTime'];
+                        $end = $params['endTime'];
+                        foreach($taskToActivity as $t){
+                         if($t['task']['id'] != $params['id']){
+                            $start = $t['task']['startTime'] < $start ? $t['task']['startTime'] : $start;
+                            $end = $t['task']['endTime'] > $end ? $t['task']['endTime'] : $end;
+                            $isAllDay = (($isAllDay == 1) && ($t['task']['allDay'] == '1')) ? 1 : 0;
+                         }
+                        }
+
+                        if($event['allDay'] == '0' || (isset($params['allDay']) && $params['allDay'] == '0'))
+                            $isAllDay = 0;
+
+                        $toUpdate = array();
+
+                        if($start != $activity['startTime'])
+                            $toUpdate['startTime'] = $start;
+
+                        if($end != $activity['endTime']){
+                            $toUpdate['endTime'] = $end;
+                            $toUpdate['due'] = $end;
+                        }
+
+                        if($isAllDay != $activity['allDay'])
+                            $toUpdate['allDay'] = $isAllDay;
+
+                        if(!empty($toUpdate))
+                            Controller::update(array('concept' => 'schedulable', 'id' => $taskToActivity[0]['activity']), $toUpdate);
+                    }
+                }
+            }
+
+            unset($criteria['historic']['endTime']);
+            unset($criteria['historic']['rangeEnd']);
+            unset($criteria['historic']['rangeStart']);
+            unset($criteria['historic']['class']);
+            unset($criteria['historic']['type']);
+            unset($criteria['historic']['allDay']);
+            unset($criteria['historic']['id']);
         }
     }
@@ -847,4 +862,12 @@
                 $date->setTimezone( new DateTimeZone($currentTimezone));
                 $DayLigth['event']['endTime'] = ($date->getTimestamp() + $date->getOffset()).'000';
+
+                if(isset($v['due']) && $v['due'] != '0'){
+                    $date->setTimestamp((int) ($v['due'] / 1000));
+                    $DayLigth['event']['due'] = ($date->getTimestamp() + $date->getOffset()).'000';
+                }else{
+                    $DayLigth['event']['due'] = $v['due'];
+                }
+
 
                 $date->setTimezone( new DateTimeZone($currentTimezone));
Index: /trunk/prototype/modules/calendar/assetic_css.php
===================================================================
--- /trunk/prototype/modules/calendar/assetic_css.php	(revision 7664)
+++ /trunk/prototype/modules/calendar/assetic_css.php	(revision 7680)
@@ -38,6 +38,6 @@
 $css = new AssetCollection(array(
         //new FileAsset(MODULESURL.'/css/reset.css'),
-        //new FileAsset(PLUGINSURL.'/fullcalendar/fullcalendar.css'), 
-        new FileAsset(PLUGINSURL.'/fullcalendar/fullcalendar.print.css'),
+        //new FileAsset(PLUGINSURL.'/fullcalendar/fullcalendar.css'),
+        //new FileAsset(PLUGINSURL.'/fullcalendar/fullcalendar.print.css'),
         //new FileAsset(PLUGINSURL.'/jquery/jquery-ui.css'),
         new FileAsset(PLUGINSURL.'/icalendar/jquery.icalendar.css'),
@@ -57,9 +57,9 @@
 
 if (strpos($javaVersion,"java version") !== false){
-    $filterManager->set('yui_css', $compressor);    
-    $css->ensureFilter($filterManager->get('yui_css'));    
+    $filterManager->set('yui_css', $compressor);
+    $css->ensureFilter($filterManager->get('yui_css'));
 }
 
-$cssCache = new AssetCache($css,new FilesystemCache('/tmp'));
+$cssCache = new AssetCache($css, new FilesystemCache('/tmp'));
 echo $cssCache->dump();
 
Index: /trunk/prototype/modules/calendar/js/calendar.codecs.js
===================================================================
--- /trunk/prototype/modules/calendar/js/calendar.codecs.js	(revision 7604)
+++ /trunk/prototype/modules/calendar/js/calendar.codecs.js	(revision 7680)
@@ -826,10 +826,12 @@
         percentage: (objEvent.percentage) ? objEvent.percentage : '0',
         priority: objEvent.priority,
-        startDate: new Date( parseInt(objEvent.startTime) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ),
-        startHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(objEvent.startTime)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'startTime'), User.preferences.hourFormat),
-        endDate: new Date( parseInt(objEvent.endTime) - (!!parseInt(objEvent.allDay) ? 86400000 : 0)  ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ),
-        endHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date(parseInt(objEvent.endTime)),  objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'endTime'), User.preferences.hourFormat),
-        dueDate: (!objEvent.due || objEvent.due == '' || objEvent.due == '0') ? '' : new Date( parseInt(objEvent.due) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ),
-        dueTime: (!objEvent.due || objEvent.due == '' || objEvent.due == '0') ? '' : dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(objEvent.due)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'startTime'), User.preferences.hourFormat),
+
+        startDate: Timezone.getDate( (objEvent.DayLigth ? objEvent.DayLigth.event.startTime : objEvent.startTime), 'start', objEvent.allDay ),
+        startHour: objEvent.DayLigth ? Timezone.getHour( objEvent.DayLigth.event.startTime) : Timezone.formateHour( objEvent.startTime ),
+        endDate: Timezone.getDate( (objEvent.DayLigth ? objEvent.DayLigth.event.endTime : objEvent.endTime), 'end', objEvent.allDay ),
+        endHour: objEvent.DayLigth ? Timezone.getHour( objEvent.DayLigth.event.endTime) : Timezone.formateHour( objEvent.endTime ),
+        dueDate: objEvent.DayLigth ? (objEvent.DayLigth.event.due != '0' ? Timezone.getDate( objEvent.DayLigth.event.due , 'end', objEvent.allDay ) : '') : (objEvent.due && objEvent.due != '' ? Timezone.getDate( objEvent.due , 'end', objEvent.allDay ) : ''),
+        dueTime: objEvent.DayLigth ? (objEvent.DayLigth.event.due != '0' ? Timezone.getHour( objEvent.DayLigth.event.due) : '') : (objEvent.due && objEvent.due != '' ? Timezone.formateHour( objEvent.due ) : ''),
+
         allDay: !!parseInt( objEvent.allDay ),
 	    historic: !!objEvent.historic ? decodeHistoric(objEvent) : [] ,
@@ -1030,10 +1032,13 @@
             summary: objEvent.summary,
             description: !!objEvent.summary ? objEvent.summary : objEvent.description,
-            startDate: new Date( parseInt(objEvent.startTime) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ),
-            startHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(objEvent.startTime)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'startTime'), User.preferences.hourFormat),
-            endDate: new Date( parseInt(objEvent.endTime) - (!!parseInt(objEvent.allDay) ? 86400000 : 0)  ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ),
-            endHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date(parseInt(objEvent.endTime)),  objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'endTime'), User.preferences.hourFormat),
-            dueDate: (!objEvent.due || objEvent.due == '' || objEvent.due == '0') ? '' : new Date( parseInt(objEvent.due) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ),
-            dueTime: (!objEvent.due || objEvent.due == '' || objEvent.due == '0') ? '' : dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(objEvent.due)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'startTime'), User.preferences.hourFormat),
+
+
+            startDate: Timezone.getDate( (objEvent.DayLigth ? objEvent.DayLigth.event.startTime : objEvent.startTime), 'start', objEvent.allDay ),
+            startHour: objEvent.DayLigth ? Timezone.getHour( objEvent.DayLigth.event.startTime) : Timezone.formateHour( objEvent.startTime ),
+            endDate: Timezone.getDate( (objEvent.DayLigth ? objEvent.DayLigth.event.endTime : objEvent.endTime), 'end', objEvent.allDay ),
+            endHour: objEvent.DayLigth ? Timezone.getHour( objEvent.DayLigth.event.endTime) : Timezone.formateHour( objEvent.endTime ),
+            dueDate: objEvent.DayLigth ? (objEvent.DayLigth.event.due != '0' ? Timezone.getDate( objEvent.DayLigth.event.due , 'end', objEvent.allDay ) : '') : (objEvent.due && objEvent.due != '' ? Timezone.getDate( objEvent.due , 'end', objEvent.allDay ) : ''),
+            dueTime: objEvent.DayLigth ? (objEvent.DayLigth.event.due != '0' ? Timezone.getHour( objEvent.DayLigth.event.due) : '') : (objEvent.due && objEvent.due != '' ? Timezone.formateHour( objEvent.due ) : ''),
+
             allDay: !!parseInt( objEvent.allDay ),
             percentage: (objEvent.percentage) ? objEvent.percentage : '0',
@@ -1156,10 +1161,11 @@
                     taskToActivity: taskToActivity.id,
                     allDay: !!parseInt(task.allDay),
-                    dueDate: (!task.due || task.due == '' || task.due == '0') ? '' : new Date( parseInt(task.due) ).setTimezoneOffset( Timezone.timezone( task.timezone ) ).toString( User.preferences.dateFormat ),
-                    dueTime: (!task.due || task.due == '' || task.due == '0') ? '' : dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(task.due)), task.timezone, obj.calendar, obj.DayLigth, 'startTime'), User.preferences.hourFormat),
-                    startDate: new Date( parseInt(task.startTime) ).setTimezoneOffset( Timezone.timezone( task.timezone ) ).toString( User.preferences.dateFormat ),
-                    startHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(task.startTime)), task.timezone, task.calendar, obj.DayLigth, 'startTime'), User.preferences.hourFormat),
-                    endDate: new Date( parseInt(task.endTime) - (!!parseInt(task.allDay) ? 86400000 : 0)  ).setTimezoneOffset( Timezone.timezone( task.timezone ) ).toString( User.preferences.dateFormat ),
-                    endHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date(parseInt(task.endTime)),  task.timezone, obj.calendar, obj.DayLigth, 'endTime'), User.preferences.hourFormat),
+
+                    startDate: Timezone.getDate( (task.DayLigth ? task.DayLigth.event.startTime : task.startTime), 'start', task.allDay ),
+                    startHour: task.DayLigth ? Timezone.getHour( task.DayLigth.event.startTime) : Timezone.formateHour( task.startTime ),
+                    endDate: Timezone.getDate( (task.DayLigth ? task.DayLigth.event.endTime : task.endTime), 'end', task.allDay ),
+                    endHour: task.DayLigth ? Timezone.getHour( task.DayLigth.event.endTime) : Timezone.formateHour( task.endTime ),
+                    dueDate: Timezone.getDate( (task.DayLigth ? task.DayLigth.event.due : task.due), 'end', task.allDay ),
+                    dueTime: task.DayLigth ? Timezone.getHour( task.DayLigth.event.due) : Timezone.formateHour( task.due ),
 					status: task.status,
 					percentage: task.percentage,
Index: /trunk/prototype/modules/calendar/js/timezone.js
===================================================================
--- /trunk/prototype/modules/calendar/js/timezone.js	(revision 7635)
+++ /trunk/prototype/modules/calendar/js/timezone.js	(revision 7680)
@@ -80,5 +80,5 @@
     getDate: function( time, rang, isAllDay){
 
-        return (new Date( parseInt( time ) - ((rang == 'end' && isAllDay && parseInt(isAllDay) == 1) ? 86400000 : 0) )).toString( User.preferences.dateFormat );
+        return  Timezone.normalizeDate(new Date( parseInt( time ) - ((rang == 'end' && isAllDay && parseInt(isAllDay) == 1) ? 86400000 : 0)), false, true).toString( User.preferences.dateFormat );
 
     },
Index: /trunk/prototype/modules/calendar/js/activity.helpers.js
===================================================================
--- /trunk/prototype/modules/calendar/js/activity.helpers.js	(revision 7518)
+++ /trunk/prototype/modules/calendar/js/activity.helpers.js	(revision 7680)
@@ -262,5 +262,5 @@
                         [$('div.new-activity-win.active select[name="groupFilter"]').val()]
                     ]
-                ], criteria: {'filterTasks': true}
+                ], criteria: {filterTasks: true, deepness: 2}
         };
     if($(this).val() != ''){
@@ -270,5 +270,4 @@
                            ]);
     }
-
     var result = DataLayer.get('schedulable:taskSearch', filter, true)
 	/**
Index: /trunk/prototype/modules/calendar/templates/index.ejs
===================================================================
--- /trunk/prototype/modules/calendar/templates/index.ejs	(revision 7646)
+++ /trunk/prototype/modules/calendar/templates/index.ejs	(revision 7680)
@@ -12,5 +12,5 @@
 <link rel="stylesheet" type="text/css" href="<?= MODULESURL ?>/css/reset.css" />
 <link rel='stylesheet' type='text/css' href='<?= PLUGINSURL ?>/fullcalendar/fullcalendar.css' />
-<!-- <link rel='stylesheet' type='text/css' href='<?= PLUGINSURL ?>/fullcalendar/fullcalendar.print.css' media='print' /> -->
+<link rel='stylesheet' type='text/css' href='<?= PLUGINSURL ?>/fullcalendar/fullcalendar.print.css' media='print' />
 <link rel='stylesheet' type='text/css' href='<?= PLUGINSURL ?>/jquery/jquery-ui.css'/>
 <!--<link rel='stylesheet' type='text/css' href='<?= PLUGINSURL ?>/icalendar/jquery.icalendar.css'/>-->
