Index: trunk/prototype/modules/calendar/interceptors/Notifications.php
===================================================================
--- trunk/prototype/modules/calendar/interceptors/Notifications.php	(revision 6184)
+++ trunk/prototype/modules/calendar/interceptors/Notifications.php	(revision 6190)
@@ -498,10 +498,8 @@
      * @access     public
      */
-    public function updateEvent(&$uri, &$params, &$criteria, $original) {
+    public function updateEvent(&$uri, $params, &$criteria, $original) {
 	$schedulableOld = Controller::read(array('concept' => 'schedulable', 'id' => $uri['id']), null, array('deepness' => '2'));
 	$schedulable = $schedulableOld;
 	$alt = false;
-
-	DBMapping::encodeSchedulable($params);
 
 	foreach ($params as $i => $v) //Verifica se ouve alteração no evento
@@ -510,5 +508,5 @@
 		$alt = true;
 	    }
-self::lg( $schedulable, '$schedulable' );
+
 	if (($alt === true) && (Config::regGet('noAlarm') === false) && (self::futureEvent($schedulable['startTime'], $schedulable['rangeEnd'], $schedulable['id']))) {
 	    $method = 'REQUEST';
Index: trunk/prototype/modules/calendar/interceptors/DBMapping.php
===================================================================
--- trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 6183)
+++ trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 6190)
@@ -8,9 +8,5 @@
 class DBMapping extends Helpers {
 
-    public function encodeCreateSchedulable(&$uri, &$params, &$criteria, $original) {
-	self::encodeSchedulable($params);
-    }
-
-    static function encodeSchedulable(&$params) {
+    static function encodeCreateSchedulable(&$uri, &$params, &$criteria, $original) {
 	$params['type_id'] = EVENT_ID;
 
@@ -24,7 +20,5 @@
 		$params['endTime'] = $params['endTime'] + 86400000;
 	}
-	//        if( !isset( $new['repeat'] ))
-	//            $new['range_end'] = '7287926400'; // 12/12/2200
-	//        else
+
 	$params['rangeEnd'] = $params['endTime'];
 	$params['rangeStart'] = $params['startTime'];
@@ -116,20 +110,5 @@
     public function findSchedulable(&$uri, &$params, &$criteria, $original) {
 	if (isset($criteria['filter'][2][1]) && $criteria['filter'][2][1] == 'calendar') {
-	    $start = array( $criteria['filter'][1][1][1][2] , $criteria['filter'][1][2][1][2], $criteria['filter'][1][3][1][2] );
-	    $end = array( $criteria['filter'][1][1][2][2] , $criteria['filter'][1][2][2][2], $criteria['filter'][1][3][2][2] );
-
-	    $ids = array();
-	    $occ = array();
-
-	    if ($occurrences = self::checkOccurrences($start[0], $end[0], $criteria['filter'][2][2]))
-		foreach ($occurrences as $id => $occurrence) {
-		    $ids[] = $id;
-		    $occ[] = $occurrence;
-		}	
-	
-	    $queryRange = '((range_end >= \'' . $start[0] . '\' AND range_end <= \'' . $end[0] . '\') OR '
-		    .'(range_start >= \'' . $start[1] . '\' AND range_start <= \'' . $end[1] . '\') OR '
-		    .'(range_start <= \'' . $start[2] . '\' AND range_end >= \'' . $end[2] . '\')) ';
-		
+
 	    $sql = ' SELECT calendar_object.id as id ,calendar_object.cal_uid as "uid", calendar_object.type_id as "type", '
 		.'calendar_object.dtstart as "startTime", calendar_object.summary as "summary", '
@@ -142,15 +121,33 @@
 		.'calendar_object.tzid as "timezone" ,calendar_to_calendar_object.calendar_id as '
 		.'calendar FROM calendar_to_calendar_object , calendar_object '
-		.'WHERE ( '. $queryRange .' '
-		.'AND calendar_to_calendar_object.calendar_id IN (\'' . implode('\',\'', $criteria['filter'][2][2]) . '\')) '
+		.'WHERE ( calendar_to_calendar_object.calendar_id IN (\'' . implode('\',\'', $criteria['filter'][2][2]) . '\')) '
 		.'AND calendar_to_calendar_object.calendar_object_id = calendar_object.id' . (!empty($ids) ? ' '
-		.'AND calendar_object.id NOT IN (\'' . implode('\',\'', $ids) . '\')' : '');
-
-
-	    $params = Controller::service('PostgreSQL')->execResultSql($sql);
-
-	    $params = array_merge($params, $occ);
+		.'AND calendar_object.id NOT IN (\'' . implode('\',\'', $ids) . '\') ' : ' ');	
+	    
+	    if(isset($criteria['searchEvent']) && $criteria['searchEvent']){
+		$where = 'AND (((upper("summary") like upper(\'%'.$criteria['filter'][1][1][2].'%\') OR upper("description") like upper(\'%'.$criteria['filter'][1][2][2].'%\')))) ORDER BY dtstart LIMIT '.$criteria['limit'].'  OFFSET '.$criteria['offset'].' ';
+		$params = Controller::service('PostgreSQL')->execResultSql($sql.$where);
+
+	    }else{
+		$start = array( $criteria['filter'][1][1][1][2] , $criteria['filter'][1][2][1][2], $criteria['filter'][1][3][1][2] );
+		$end = array( $criteria['filter'][1][1][2][2] , $criteria['filter'][1][2][2][2], $criteria['filter'][1][3][2][2] );
+
+		$ids = array();
+		$occ = array();
+
+		if ($occurrences = self::checkOccurrences($start[0], $end[0], $criteria['filter'][2][2]))
+		    foreach ($occurrences as $id => $occurrence) {
+			$ids[] = $id;
+			$occ[] = $occurrence;
+		    }	
+
+		$where = 'AND ((range_end >= \'' . $start[0] . '\' AND range_end <= \'' . $end[0] . '\') OR '
+			.'(range_start >= \'' . $start[1] . '\' AND range_start <= \'' . $end[1] . '\') OR '
+			.'(range_start <= \'' . $start[2] . '\' AND range_end >= \'' . $end[2] . '\')) ';
+
+		$params = Controller::service('PostgreSQL')->execResultSql($sql.$where);
+		$params = array_merge($params, $occ);
+	    }
 	    $params = self::deepnessFindEvent($uri, $params, $criteria, $original);
-
 	    return false;
 	}
@@ -391,10 +388,10 @@
     public function encodeUpdateSchedulable(&$uri, &$params, &$criteria, $original) {
 
-	$event = Controller::find(array('concept' => 'schedulable', array('timezone', 'allDay'), 'id' => $params['id']));
-
+	$event = Controller::read(array('concept' => 'schedulable', 'id' => $params['id']));
+	
 	if (isset($params['startTime'])) {
 
 	    if (!is_numeric($params['startTime']))
-		$params['startTime'] = strtotime($params['startTime'] . ' ' . $event['timezone']) . '000';
+		$params['startTime'] = self::parseTimeDate($params['startTime'], $event['timezone']);
 
 	    $params['rangeStart'] = $params['startTime'];
@@ -402,8 +399,8 @@
 
 	    if (!is_numeric($params['endTime'])) {
-		$params['endTime'] = strtotime($params['endTime'] . ' ' . $event['timezone']) . '000';
-
-		if ($event['allDay'])
-		    $params['endTime'] = $params['endTime'] + 86400000;
+		$params['endTime'] = self::parseTimeDate($params['endTime'], $event['timezone']);
+
+	    if ((isset($params['allDay']) && $params['allDay']) || ( !isset($params['allDay']) && $event['allDay']))
+		$params['endTime'] = $params['endTime'] + 86400000;
 	    }
 	    $params['rangeEnd'] = $params['endTime'];
@@ -688,5 +685,4 @@
 
 	    $params = array();
-	    $notC = array();
 
 	    $al = Controller::service('PostgreSQL')->execSql("SELECT distinct co.id as \"id\", co.cal_uid as \"uid\", co.type_id as \"type\", co.dtstart as \"startTime\", co.summary as \"summary\", co.description as \"description\", co.dtend as \"endTime\", co.location as \"location\", co.allday as \"allDay\", co.transp as transparent, co.class_id as class, ".
@@ -699,11 +695,7 @@
 	    
 	    if(is_array($al))
-	      foreach( $al as $v ){
-		if($notC[$v['id']])
-		    continue;
-
-		$notC[$v['id']] = true;
+	      foreach( $al as $v )
 		$params[] = array('schedulable' =>  $v);
-	      }
+	      
 	    else
 	      $params = false;
Index: trunk/prototype/modules/calendar/js/helpers.js
===================================================================
--- trunk/prototype/modules/calendar/js/helpers.js	(revision 6151)
+++ trunk/prototype/modules/calendar/js/helpers.js	(revision 6190)
@@ -2324,5 +2324,5 @@
     if(!!$(currentView).find('.fc-calendar').length)
 	return;
-    $(currentView+' .events-list.events-list-win.active').prepend($('.fc-header').clone());
+    $(currentView+' .events-list.events-list-win.active').prepend($('.fc-header:first').clone());
     //Remove contudo nao utilizado
     $(currentView+' .events-list.events-list-win.active .fc-header .fc-button-today').remove();
@@ -2439,4 +2439,5 @@
 		filter: ['AND', ['OR', ["i*", "summary", keyword], ["i*", "description", keyword]], ['IN', 'calendar',  selecteds]], 
 		criteria: {
+		    searchEvent: true,
 		    order: 'startTime', 
 		    offset: (25 * page_index), 
