Index: /trunk/prototype/services/iCal.php
===================================================================
--- /trunk/prototype/services/iCal.php	(revision 7068)
+++ /trunk/prototype/services/iCal.php	(revision 7097)
@@ -135,12 +135,4 @@
                 }
 
-                ob_start();
-                print_r( "\n dtStart \n");
-                print_r($sTime->format(DATE_RFC822));
-                print_r( "\n dtEnd \n");
-                print_r( $eTime->format(DATE_RFC822));
-                $output = ob_get_clean();
-                file_put_contents( "/tmp/acoutinho.log",  $output , FILE_APPEND);
-
                 if(isset($v['due']) && $v['due'] != '' && (int)$v['due'] > 0){
                     $dueTime = new DateTime('@' . (int) ($v['due'] / 1000), $timezone);
@@ -189,11 +181,4 @@
 		    }
 		}
-
-        ob_start();
-        print_r( "\n Ical Gerado \n");
-        print_r( $ical->createCalendar());
-        $output = ob_get_clean();
-        file_put_contents( "/tmp/acoutinho.log",  $output , FILE_APPEND);
-
 		return $ical->createCalendar();
     }
Index: /trunk/prototype/modules/calendar/interceptors/DBMapping.php
===================================================================
--- /trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 7077)
+++ /trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 7097)
@@ -496,10 +496,7 @@
     }
 
-//Encode Update
-
+	//Encode Update
     public function encodeUpdateSchedulable(&$uri, &$params, &$criteria, $original) {
-
-    	$event = Controller::read(array('concept' => 'schedulable', 'id' => $params['id']));
-    	            
+    	$event = Controller::read(array('concept' => 'schedulable', 'id' => $uri['id']));
     	if (isset($params['startTime'])) {
 
@@ -525,7 +522,5 @@
             $params['due'] = self::parseTimeDate($params['due'], $event['timezone']);
 
-
         if($event['type'] == '2'){
-
             $criteria['historic'] = $params;
             $criteria['beforeValue'] = $event;
@@ -533,45 +528,54 @@
             if(isset($params['startTime']) && $params['startTime'] == $event['startTime'])
                 unset($criteria['historic']['startTime']);
-
-            if(isset($params['endTime']) && $params['endTime'] == $event['endTime'])
-                unset($criteria['historic']['endTime']);
-
             if(isset($params['due']) && $params['due'] == $event['due'])
                 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('=', 'schedulable', $event['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'));
-		    $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;
-			 }
-		    }
-
-		    $toUpdate = array();
-		    
-		    if($start != $activity['startTime'])
-			$toUpdate['starTime'] = $start;
-		    
-		    if($end != $activity['endTime'])
-			$toUpdate['endTime'] = $end;
-		     
-		    if(!empty($toUpdate))
-			Controller::update(array('concept' => 'schedulable', 'id' => $activity['id']), $toUpdate);		  
+		//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']['rangeEnd']);
-            unset($criteria['historic']['rangeStart']);
-	    unset($criteria['historic']['class']);
-	    unset($criteria['historic']['type']);
-	    unset($criteria['historic']['allDay']);
-            unset($criteria['historic']['id']);            
+
+		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']);            
         }
     }
Index: /trunk/prototype/modules/calendar/js/calendar.shared.js
===================================================================
--- /trunk/prototype/modules/calendar/js/calendar.shared.js	(revision 6996)
+++ /trunk/prototype/modules/calendar/js/calendar.shared.js	(revision 7097)
@@ -552,11 +552,11 @@
 	'buttons':  ['Sim', 'Não'],
 	'onClose':  function(clicked) {
-	    if(clicked == 'Sim'){
-		DataLayer.remove('calendarSignature', ''+signatureId);
-		DataLayer.commit( false, false, function( received ){
-		    delete Calendar.currentViewKey;
-		    Calendar.load();
-		    refresh_calendars();
-		});
+		if(clicked == 'Sim'){
+			DataLayer.remove('calendarSignature', ''+signatureId);
+			DataLayer.commit( false, false, function( received ){
+				delete Calendar.currentViewKey;
+				Calendar.load();
+				refresh_calendars();
+			});
 	    }
 	}
Index: /trunk/prototype/modules/calendar/templates/calendar_list.ejs
===================================================================
--- /trunk/prototype/modules/calendar/templates/calendar_list.ejs	(revision 6996)
+++ /trunk/prototype/modules/calendar/templates/calendar_list.ejs	(revision 7097)
@@ -102,5 +102,5 @@
                         <li><a href="#" onclick="show_modal_import_export(1, <%= signatures['sharedCalendar'][i].calendar.id%>, 0);">Exportar</a></li>
                         <%if(!signatures['sharedCalendar'][i].permission.acl['required']){%>
-                            <li><a href="#" onclick="cancel_signatures['sharedCalendar'](<%= signatures['sharedCalendar'][i].id %>);">Cancelar assinatura</a></li>
+                            <li><a href="#" onclick="cancel_signature(<%= signatures['sharedCalendar'][i].id %>);">Cancelar assinatura</a></li>
                         <%}%>
                     </ul>
