Index: trunk/prototype/modules/calendar/interceptors/DBMapping.php
===================================================================
--- trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 6849)
+++ trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 6996)
@@ -10,27 +10,29 @@
 class DBMapping extends Helpers {
 
-    static function encodeCreateSchedulable(&$uri, &$params, &$criteria, $original) {
-	$params['type_id'] = EVENT_ID;
-
-	if (!is_numeric($params['startTime']))
-	    $params['startTime'] = self::parseTimeDate($params['startTime'], $params['timezone']);
-
-	if (!is_numeric($params['endTime'])) {
-	    $params['endTime'] = self::parseTimeDate($params['endTime'], $params['timezone']);
-
-	    if ($params['allDay'])
-		$params['endTime'] = $params['endTime'] + 86400000;
-	}
-
-	$params['rangeEnd'] = $params['endTime'];
-	$params['rangeStart'] = $params['startTime'];
-
-	///////////////////////////////////////////////////////////////////
-
-	$params['dtstamp'] = (isset($params['dtstamp'])) ? $params['dtstamp'] : time() . '000';
-	$params['lastUpdate'] = (isset($params['lastUpdate'])) ? $params['lastUpdate'] : time() . '000';
-	$params['type'] = EVENT_ID;
-	$params['uid'] = isset($params['uid']) ? $params['uid'] : self::_makeUid();
-    }
+    static function encodeCreateSchedulable(&$uri, &$params, &$criteria, $original) 
+    {
+
+    	if (isset($params['startTime']) && !is_numeric($params['startTime'])){
+    	    $params['startTime'] = self::parseTimeDate($params['startTime'], $params['timezone']);
+	    $params['rangeStart'] = $params['startTime'];
+	}
+    	if (isset($params['endTime']) && !is_numeric($params['endTime'])) {
+    	    $params['endTime'] = self::parseTimeDate($params['endTime'], $params['timezone']);
+
+    	    if ($params['allDay'])
+    		$params['endTime'] = $params['endTime'] + 86400000;
+	    
+	    $params['rangeEnd'] = $params['endTime'];
+    	}
+
+        if (isset($params['due']) && $params['due'] != '' && !is_numeric($params['due']))
+            $params['due'] = self::parseTimeDate($params['due'], $params['timezone']);
+
+    	///////////////////////////////////////////////////////////////////
+
+    	$params['dtstamp'] = (isset($params['dtstamp'])) ? $params['dtstamp'] : time() . '000';
+    	$params['lastUpdate'] = (isset($params['lastUpdate'])) ? $params['lastUpdate'] : time() . '000';
+    	$params['uid'] = isset($params['uid']) ? $params['uid'] : self::_makeUid();
+        }
 
     static function parseTimeDate($time, $timezone) {
@@ -66,4 +68,19 @@
 	if (isset($params['type']))
 	    $params['type'] = self::codeAlarmType($params['type']);
+	else{
+	    $alarm = Controller::read( array('concept' => 'alarm' , 'id' => $params['id'] ));
+
+	    $params['unit'] = $alarm['unit'];
+	}
+	$params['offset'] = $params['time'] * 1000;
+
+
+	switch( strtolower($params['unit']) )
+	{
+	    case 'd': $params['offset'] *= 24;
+	    case 'h': $params['offset'] *= 60;
+	    case 'm': $params['offset'] *= 60;
+	}
+	
     }
 
@@ -119,4 +136,6 @@
 		.'calendar_object.dtstart as "startTime", calendar_object.summary as "summary", '
 		.'calendar_object.description as "description", calendar_object.dtend as "endTime" , '
+        .'calendar_object.priority as "priority", calendar_object.due as "due", '
+        .'calendar_object.percentage as "percentage", calendar_object.status as "status", '
 		.'calendar_object.location as "location", calendar_object.allday as "allDay", '
 		.'calendar_object.transp as "transparent", calendar_object.class_id as "class", '
@@ -127,5 +146,6 @@
 		.'calendar FROM calendar_to_calendar_object , calendar_object '
 		.'WHERE ( calendar_to_calendar_object.calendar_id IN (\'' . implode('\',\'', $criteria['filter'][2][2]) . '\')) '
-		.'AND calendar_to_calendar_object.calendar_object_id = calendar_object.id ';	
+		.'AND calendar_to_calendar_object.calendar_object_id = calendar_object.id '
+        .'AND calendar_object.id NOT IN(select calendar_object_task_id from calendar_task_to_activity_object where owner = \'' . Config::me('uidNumber') . '\') ';	
 	    
 	    if(isset($criteria['searchEvent']) && $criteria['searchEvent']){
@@ -157,4 +177,36 @@
 		$params = array_merge($params, $occ);		
 	    }
+	    $params = self::deepnessFindEvent($uri, $params, $criteria, $original);
+	    return false;
+	}
+    }
+
+    public function findTask(&$uri, &$params, &$criteria, $original) {
+
+	if (isset($criteria['filterTasks']) && $criteria['filterTasks']) {
+
+	    $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", '
+	    .'calendar_object.description as "description", calendar_object.dtend as "endTime" , '
+	    .'calendar_object.priority as "priority", calendar_object.due as "due", '
+	    .'calendar_object.percentage as "percentage", calendar_object.status as "status", '
+	    .'calendar_object.location as "location", calendar_object.allday as "allDay", '
+	    .'calendar_object.transp as "transparent", calendar_object.class_id as "class", '
+	    .'calendar_object.repeat as "repeat", calendar_object.range_start as "rangeStart", '
+	    .'calendar_object.range_end as "rangeEnd", calendar_object.last_update as "lastUpdate", '
+	    .'calendar_object.dtstamp as "dtstamp", calendar_object.sequence as "sequence", '
+	    .'calendar_object.tzid as "timezone" ,calendar_to_calendar_object.calendar_id as '
+	    .'calendar FROM calendar_to_calendar_object , calendar_object '
+	    .'WHERE ( calendar_to_calendar_object.calendar_id IN (\'' . implode('\',\'', $criteria['filter'][3][2]) . '\')) '
+	    .'AND calendar_to_calendar_object.calendar_object_id = calendar_object.id '
+        .'AND calendar_to_calendar_object.calendar_object_id NOT IN (select calendar_object_activity_id from calendar_task_to_activity_object where owner =  \'' . Config::me("uidNumber") . '\' ) '    
+        .'AND calendar_to_calendar_object.calendar_object_id NOT IN (select calendar_object_task_id from calendar_task_to_activity_object where owner =  \'' . Config::me("uidNumber") . '\' ) ';    
+
+        if(isset($criteria['filter'][4]))
+            $sql .= 'AND (((upper("summary") like upper(\'%'.$criteria['filter'][4][1][2].'%\') OR upper("description") like upper(\'%'.$criteria['filter'][4][1][2].'%\'))))';
+
+	    $sql .= 'AND (range_start >= \'' . $criteria['filter'][2][2] . '\' AND type_id <= \'' .  $criteria['filter'][1][2] . '\')';
+
+	    $params = Controller::service('PostgreSQL')->execResultSql($sql);
 	    $params = self::deepnessFindEvent($uri, $params, $criteria, $original);
 	    return false;
@@ -405,22 +457,79 @@
     public function encodeUpdateSchedulable(&$uri, &$params, &$criteria, $original) {
 
-	$event = Controller::read(array('concept' => 'schedulable', 'id' => $params['id']));
-	
-	if (isset($params['startTime'])) {
-
-	    if (!is_numeric($params['startTime']))
-		$params['startTime'] = self::parseTimeDate($params['startTime'], $event['timezone']);
-
-	    $params['rangeStart'] = $params['startTime'];
-	}if (isset($params['endTime'])) {
-
-	    if (!is_numeric($params['endTime'])) {
-		$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'];
-	}
+    	$event = Controller::read(array('concept' => 'schedulable', 'id' => $params['id']));
+    	            
+    	if (isset($params['startTime'])) {
+
+    	    if (!is_numeric($params['startTime']))
+    		$params['startTime'] = self::parseTimeDate($params['startTime'], $event['timezone']);
+
+    	    $params['rangeStart'] = $params['startTime'];
+    	}
+
+        if (isset($params['endTime'])) {
+
+    	    if (!is_numeric($params['endTime'])) {
+        		$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'];
+    	}
+
+
+        if (isset($params['due']) && $params['due'] != '' && !is_numeric($params['due']))
+            $params['due'] = self::parseTimeDate($params['due'], $event['timezone']);
+
+
+        if($event['type'] == '2'){
+
+            $criteria['historic'] = $params;
+            $criteria['beforeValue'] = $event;
+
+            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);		  
+		}
+	    }
+
+            unset($criteria['historic']['rangeEnd']);
+            unset($criteria['historic']['rangeStart']);
+	    unset($criteria['historic']['class']);
+	    unset($criteria['historic']['type']);
+	    unset($criteria['historic']['allDay']);
+            unset($criteria['historic']['id']);            
+        }
     }
 
@@ -453,4 +562,75 @@
     }
 
+
+    static function prepareParticipantHistoric(&$uri, &$params, &$criteria, $original){
+       $participant = Controller::read(array('concept' => 'participant', 'id' => $uri['id']));
+       $schedulable = Controller::read(array('concept' => 'schedulable', 'id' => $participant['schedulable']));
+
+
+       if($schedulable['type'] == '2')
+            $criteria['historic']['participant']  = $participant;
+    } 
+
+    static function removeParticipantHistoric(&$uri, &$params, &$criteria, $original){
+        if(isset($criteria['historic'])){
+
+            $participant = $criteria['historic']['participant'];
+
+             Controller::create(array('concept' => 'calendarHistoric'), 
+                array('schedulable' => $participant['schedulable'], 
+                    'user' => Config::me('uidNumber'),
+                    'time' => time() . '000',
+                    'attribute' => 'participant',
+                    'beforeValue' => $participant['user'],
+                    'afterValue' => ''
+                    )
+                );
+
+        }
+
+    }
+
+    static function createParticipantHistoric(&$uri, &$params, &$criteria, $original){
+
+	if(isset($original['properties']) && $original['properties']['isOrganizer'] != '1'){
+	    if(!isset($criteria['event'])){
+		$event = Controller::read(array('concept' => 'schedulable', 'id' => $original['properties']['schedulable']));
+		$criteria['event'] = $event;
+	    }else
+		$event = $criteria['event'];
+
+	    if($event['type'] == '2'){
+		Controller::create(array('concept' => 'calendarHistoric'), 
+		    array('schedulable' => $original['properties']['schedulable'], 
+			'user' => Config::me('uidNumber'),
+			'time' => time() . '000',
+			'attribute' => 'participant',
+			'beforeValue' => '',
+			'afterValue' => $original['properties']['user']
+			)
+		    );
+	    }
+	}
+    }
+
+    static function createHistoric(&$uri, &$result, &$criteria, $original) {
+
+        if(isset($criteria['historic']) && count($criteria['historic'])){
+            $time =  time() . '000';
+
+            foreach($criteria['historic'] as $k => $v){
+                Controller::create(array('concept' => 'calendarHistoric'), 
+                    array('schedulable' => $uri['id'], 
+                        'user' => Config::me('uidNumber'),
+                        'time' => $time,
+                        'attribute' => $k,
+                        'beforeValue' => $criteria['beforeValue'][$k],
+                        'afterValue' => $v
+                        )
+                    );
+            }
+        }    
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -466,10 +646,53 @@
     }
 
-    public function createCreateSchedulableToAttachment(&$uri, &$params, &$criteria, $original) {
-	if (array_key_exists('attachments', $original['properties']))
-	    foreach ($original['properties']['attachments'] as $key => $value) {
-		if (isset($params['id']))
-		    Controller::create(array('concept' => 'schedulableToAttachment'), array('attachment' => $value['attachment'], 'schedulable' => $params['id']));
-	    }
+    //TODO: Remover apos suporte a ManytoMany na api 
+    public function createTasksToActivity(&$uri, &$result, &$criteria, $original) {
+
+        if(isset($original['properties']['taskToActivity']) && $original['properties']['taskToActivity']){
+
+            foreach($original['properties']['taskToActivity'] as $relational)
+
+                Controller::create(array('concept' => 'taskToActivity'), array('task' => $relational['task'], 'owner' => $relational['owner'], 'activity' => $result['id']));
+
+        }
+    }
+
+    public function removeAttachmentHistoric(&$uri, &$params, &$criteria, $original) {
+
+        if(isset($criteria['historic'])){
+            $attachment = $criteria['historic']['attachment'];
+
+            $attachment['attachment'] = Controller::read(array('concept' => 'attachment', 'id' => $attachment['attachment']), array('name'));
+            Controller::create(array('concept' => 'calendarHistoric'), 
+                    array('schedulable' => $attachment['schedulable'], 
+                        'user' => Config::me('uidNumber'),
+                        'time' => time() . '000',
+                        'attribute' => 'attachment',
+                        'beforeValue' => $attachment['attachment']['name'],
+                        'afterValue' => ''
+                        )
+                    );
+
+        }
+    
+    }
+
+    public function createAttachmentHistoric(&$uri, &$params, &$criteria, $original) {
+        $event = Controller::read(array('concept' => 'schedulable', 'id' => $original['properties']['schedulable']));
+
+        if($event['type'] == '2'){
+            $attachment = Controller::read(array('concept' => 'attachment', 'id' => $original['properties']['attachment']), array('name'));
+
+            Controller::create(array('concept' => 'calendarHistoric'), 
+                array('schedulable' => $original['properties']['schedulable'], 
+                    'user' => Config::me('uidNumber'),
+                    'time' => time() . '000',
+                    'attribute' => 'attachment',
+                    'beforeValue' => '',
+                    'afterValue' => $attachment['name']
+                    )
+                );
+
+        }
     }
 
@@ -512,4 +735,31 @@
 
     //TODO: Remover apos suporte a deepness na api 
+    public function deepnessFindTask(&$uri, &$result, &$criteria, $original) {
+        if (isset($original['criteria']['deepness']) && $original['criteria']['deepness'] != 0) 
+           foreach($result as &$value)
+                $value['task'] = Controller::read(array('concept' => 'schedulable', 'id' => $value['task']));
+           
+        
+        return $result;
+    }
+
+    //TODO: Remover apos suporte a deepness na api 
+    public function deepnessFindHistoric(&$uri, &$result, &$criteria, $original) {
+        if (isset($original['criteria']['deepness']) && $original['criteria']['deepness'] != 0) {
+            foreach($result as &$v){
+                $v['user'] = Controller::read(array('concept' => 'user', 'id' => $v['user']));
+
+                if($v['attribute'] == 'participant'){
+                    if($v['beforeValue'] != '')
+                        $v['beforeValue'] = Controller::read(array('concept' => 'user', 'id' => $v['beforeValue']));
+
+                    if($v['afterValue'] != '')
+                        $v['afterValue'] = Controller::read(array('concept' => 'user', 'id' => $v['afterValue']));
+                }
+            }
+        }
+    }
+
+    //TODO: Remover apos suporte a deepness na api 
     public function deepnessFindEvent(&$uri, &$result, &$criteria, $original) {
 	if (isset($original['criteria']['deepness']) && $original['criteria']['deepness'] != 0) {
@@ -543,4 +793,15 @@
 
 		$result[$i]['DayLigth'] = $DayLigth;
+
+        if(((int)$v['type']) == 2){
+
+            $taskToActivity = Controller::find(array('concept' => 'taskToActivity'), false, array('filter' => array('AND', array('=', 'activity', $v['id']), array('=','owner', Config::me('uidNumber'))) , 'deepness' => 2));
+
+            if($taskToActivity)
+                $result[$i]['taskToActivity'] = $taskToActivity;
+
+            $result[$i]['historic'] = Controller::find(array('concept' => 'calendarHistoric'), false, array('filter' => array('=', 'schedulable', $v['id']) , 'deepness' => 2));
+
+        }
 
 		if (isset($v['id'])) {
@@ -608,4 +869,8 @@
 	    } 
 	    
+       }
+       
+       if(isset($result['id']) && $result['type'] == '2'){
+	   $result['historic'] =  Controller::find( array( 'concept' => 'calendarHistoric' ), false, array( 'filter' => array( '=', 'schedulable', $result['id'] ) ) );
        }
    } 
@@ -791,5 +1056,5 @@
     
     static private function countMyCalendarsEvent($id, $owner) {
-		$sig = Controller::find(array('concept' => 'calendarSignature'), array('user', 'calendar', 'isOwner'), array('filter' => array('AND', array('=', 'user', $owner), array('=', 'isOwner', '1'))));
+		$sig = Controller::find(array('concept' => 'calendarSignature'), array('user', 'calendar', 'isOwner'), array('filter' => array('AND', array('=', 'isOwner', '1'), array('=', 'user', $owner))));
 		$calendars = array();
 		foreach ($sig as $val)
@@ -807,5 +1072,5 @@
         if(isset($criteria['filter']) && $criteria['filter'] && isset($criteria['filter'][1][2])){
             $idSchedulable = $criteria['filter'][1][2];
-			$idCalendar = $criteria['filter'][2][2];
+	    $idCalendar = $criteria['filter'][2][2];
             $owner = $criteria['filter'][3][2];
 
@@ -844,4 +1109,8 @@
 
             $uri['id'] = $idSchedulable;
+	    
+	    if(isset($criteria['filter']) && isset($criteria['filter'][4]) && isset($criteria['filter'][4][2])){
+		Controller::deleteALL(array('concept' => 'taskToActivity'), null, array('filter' => array('=', 'activity', $idSchedulable)));
+	    }
         }
         
@@ -894,9 +1163,16 @@
             $schedulableAttachment = Controller::read(array('concept' => 'schedulableToAttachment'), false, array('filter' => array( '=', 'attachment' , $original['URI']['id'] )));
             $uri['id'] = $schedulableAttachment[0]['id'];
+
+            $params = $schedulableAttachment[0];
+
+            $event = Controller::read(array('concept' => 'schedulable', 'id' => $params['schedulable']));
+            if($event['type'] == '2')
+                $criteria['historic']['attachment'] = $schedulableAttachment[0];
+
         }
     }
 
     public function deleteAttachmentDependences(&$uri, &$params, &$criteria, $original) {
-        Controller::delete(array('concept' => 'attachment', 'id' => $original['URI']['id']));
+        Controller::delete(array('concept' => 'attachment', 'id' => (isset($params['attachment']) ? $params['attachment'] : $original['URI']['id'])));
     }
     
@@ -908,5 +1184,54 @@
     }
 
+
+     public function createDefaultGroup(&$uri, &$result, &$criteria, $original) {
+        if( $original['criteria']['filter'][1][0] == '=' &&
+        $original['criteria']['filter'][1][1] == 'user' &&
+        $original['criteria']['filter'][1][2] == $_SESSION['phpgw_session']['account_id']){
+
+            $existDefaultGroup = false;
+
+            foreach($result as $v){
+                if($v['type'] == 1 && $v['calendar']['type'] == 1)
+                    $existDefaultGroup = true;
+            }
+
+            if(!$existDefaultGroup){
+
+                $cal = array('name' => 'Sem grupo',
+                    'description' => 'Sem grupo',
+                    'timezone' => (date_default_timezone_get()) ? date_default_timezone_get() : 'America/Sao_Paulo',
+                    'dtstamp' => time() . '000',
+                    'type' => '1'
+                );
+
+                $calCreated = Controller::create(array('concept' => 'calendar'), $cal);
+
+                $sig = array('user' => $_SESSION['wallet']['user']['uidNumber'],
+                    'calendar' => $calCreated['id'],
+                    'isOwner' => '1',
+                    'dtstamp' => time() . '000',
+                    'fontColor' => 'FFFFFF',
+                    'backgroundColor' => '3366CC',
+                    'borderColor' => '3366CC',
+                    'type' => '1'
+                );
+
+                $sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig);
+                $sigCreated = Controller::read(array('concept' => 'calendarSignature', 'id' => $sigCreated['id']), false, array('deepness' => 2 ));
+
+                array_push($result, $sigCreated);
+            }
+
+        }
+
+     }
+
     public function createDefaultSignature(&$uri, &$result, &$criteria, $original) {
+
+    if(count($result) == 0 && isset($criteria['filter'][3]) && isset($criteria['filter'][3]['isRecursion'])){
+        throw new Exception('It was not possible to find to calendar!');
+        return false;
+    }
 
 	//Caso uma busca não retorne nenhum resultado e foi buscado pelas assinaturas do usuario logado apenas
@@ -916,6 +1241,6 @@
 	if (count($result) > 0) {
 	    foreach ($result as $value) {
-		if (isset($value['isOwner']) && $value['isOwner'] != 0)
-		    $isValidSignature = true;
+    		if (isset($value['isOwner']) && $value['isOwner'] != 0 && isset($value['type']) && $value['type'] == 0)
+    		    $isValidSignature = true;
 	    }
 	}
@@ -928,64 +1253,71 @@
 
 	    if (Config::module('useCaldav', 'expressoCalendar')) {
-		require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php';
-
-		$calendario = DAViCalAdapter::findCalendars();
+    		require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php';
+    		$calendario = DAViCalAdapter::findCalendars();
 	    }
 
 	    if (Config::module('useCaldav', 'expressoCalendar') && is_array($calendario) && count($calendario) > 0) {
-		foreach ($calendario as $i => $v) {
-
-		    $urlA = explode('/', $v->url);
-		    $name = isset($v->displayname) ? $v->displayname : $urlA[(count($urlA) - 2)];
-		    $cal = array('name' => $name,
-			'description' => isset($v->description) ? $v->description : $name,
-			'timezone' => isset($v->timezone) ? $v->timezone : (date_default_timezone_get()) ? date_default_timezone_get() : 'America/Sao_Paulo',
-			'dtstamp' => time() . '000',
-			'location' => $urlA[(count($urlA) - 3)] . '/' . $urlA[(count($urlA) - 2)]
-		    );
-
-		    $calCreated = Controller::create(array('concept' => 'calendar'), $cal);
-
-
-
-		    $sig = array('user' => $_SESSION['wallet']['user']['uidNumber'],
-			'calendar' => $calCreated['id'],
-			'isOwner' => '1',
-			'dtstamp' => time() . '000',
-			'fontColor' => 'FFFFFF',
-			'backgroundColor' => '3366CC',
-			'borderColor' => '3366CC',
-		    );
-
-		    $sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig);
-
-
-		    DAViCalAdapter::importCollection($v->url, $calCreated['id']);
-		}
+    		foreach ($calendario as $i => $v) {
+
+    		    $urlA = explode('/', $v->url);
+    		    $name = isset($v->displayname) ? $v->displayname : $urlA[(count($urlA) - 2)];
+    		    $cal = array('name' => $name,
+    			'description' => isset($v->description) ? $v->description : $name,
+    			'timezone' => isset($v->timezone) ? $v->timezone : (date_default_timezone_get()) ? date_default_timezone_get() : 'America/Sao_Paulo',
+    			'dtstamp' => time() . '000',
+    			'location' => $urlA[(count($urlA) - 3)] . '/' . $urlA[(count($urlA) - 2)]
+    		    );
+
+    		    $calCreated = Controller::create(array('concept' => 'calendar'), $cal);
+
+                if(!$calCreated){
+                    throw new Exception('Error to create calendar');
+                    return false;
+                }
+
+    		    $sig = array('user' => $_SESSION['wallet']['user']['uidNumber'],
+    			'calendar' => $calCreated['id'],
+    			'isOwner' => '1',
+    			'dtstamp' => time() . '000',
+    			'fontColor' => 'FFFFFF',
+    			'backgroundColor' => '3366CC',
+    			'borderColor' => '3366CC',
+    		    );
+
+    		    $sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig);
+
+                if(!$sigCreated){
+                    throw new Exception('Error to create signature');
+                    return false;
+                }
+
+    		    DAViCalAdapter::importCollection($v->url, $calCreated['id']);
+    		}
 	    } else {
-		//Criaremos uma agenda padrão
-		$cal = array('name' => 'Calendario',
-		    'description' => 'Calendario Padrão',
-		    'timezone' => (date_default_timezone_get()) ? date_default_timezone_get() : 'America/Sao_Paulo',
-		    'dtstamp' => time() . '000'
-		);
-
-		$calCreated = Controller::create(array('concept' => 'calendar'), $cal);
-
-		$sig = array('user' => $_SESSION['wallet']['user']['uidNumber'],
-		    'calendar' => $calCreated['id'],
-		    'isOwner' => '1',
-		    'dtstamp' => time() . '000',
-		    'fontColor' => 'FFFFFF',
-		    'backgroundColor' => '3366CC',
-		    'borderColor' => '3366CC',
-		);
-
-		$sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig);
-	    }
-
-	    $result = Controller::find($original['URI'], $original['properties'] ? $original['properties'] : null, $original['criteria']);
+    		//Criaremos uma agenda padrão
+    		$cal = array('name' => 'Calendario',
+    		    'description' => 'Calendario Padrão',
+    		    'timezone' => (date_default_timezone_get()) ? date_default_timezone_get() : 'America/Sao_Paulo',
+    		    'dtstamp' => time() . '000'
+    		);
+
+    		$calCreated = Controller::create(array('concept' => 'calendar'), $cal);
+
+    		$sig = array('user' => $_SESSION['wallet']['user']['uidNumber'],
+    		    'calendar' => $calCreated['id'],
+    		    'isOwner' => '1',
+    		    'dtstamp' => time() . '000',
+    		    'fontColor' => 'FFFFFF',
+    		    'backgroundColor' => '3366CC',
+    		    'borderColor' => '3366CC',
+    		);
+
+    		$sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig);
+        }
+    
+        $original['criteria']['filter'][] = array('isRecursion' => true);
+        $result = Controller::find($original['URI'], $original['properties'] ? $original['properties'] : null, $original['criteria']);
 	    return false;
-	}
+    	}
     }
 
@@ -1017,27 +1349,27 @@
 
     public function davcalCreateCollection(&$uri, &$params, &$criteria, $original) {
-	if (Config::module('useCaldav', 'expressoCalendar')) {
-	    require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php';
-	    DAViCalAdapter::mkcalendar($params['location'], $params['name'], isset($params['description']) ? $params['description'] : '' );
-	}
+    	if (Config::module('useCaldav', 'expressoCalendar')) {
+    	    require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php';
+    	    DAViCalAdapter::mkcalendar($params['location'], $params['name'], isset($params['description']) ? $params['description'] : '' );
+	   }
     }
 
     public function davcalDeleteCollection(&$uri, &$params, &$criteria, $original) {
-	if (Config::module('useCaldav', 'expressoCalendar') && Config::module('onRemoveCascadeCalDav')) {
-	    require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php';
-	    $calendar = Controller::read($uri);
-	    DAViCalAdapter::rmCalendar($calendar['location']);
-	}
+    	if (Config::module('useCaldav', 'expressoCalendar') && Config::module('onRemoveCascadeCalDav')) {
+    	    require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php';
+    	    $calendar = Controller::read($uri);
+    	    DAViCalAdapter::rmCalendar($calendar['location']);
+    	}
     }
 
     public function davcalUpdateCollection(&$uri, &$params, &$criteria, $original) {
-	if (Config::module('useCaldav', 'expressoCalendar')) {
-	    require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php';
-	    if (isset($params['location'])) {
-		$calendar = Controller::read($uri);
-		if ($calendar['location'] !== $params['location'])
-		    DAViCalAdapter::mvcalendar($calendar['location'], $params['location']);
-	    }
-	}
+    	if (Config::module('useCaldav', 'expressoCalendar')) {
+    	    require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php';
+    	    if (isset($params['location'])) {
+    		$calendar = Controller::read($uri);
+    		if ($calendar['location'] !== $params['location'])
+    		    DAViCalAdapter::mvcalendar($calendar['location'], $params['location']);
+    	    }
+    	}
     }
 
Index: trunk/prototype/modules/calendar/constants.php
===================================================================
--- trunk/prototype/modules/calendar/constants.php	(revision 6861)
+++ trunk/prototype/modules/calendar/constants.php	(revision 6996)
@@ -2,4 +2,11 @@
 
 define('EVENT_ID', 1);
+define('TASK_ID', 2);
+
+define('SIGNATURE_TYPE_NORMAL', 0);
+define('SIGNATURE_TYPE_DEFAULT', 1);
+
+define('CALENDAR_TYPE_EVENT', 0);
+define('CALENDAR_TYPE_TASK_GROUP', 1);
 
 define('STATUS_CONFIRMED', 1);
@@ -50,3 +57,12 @@
 define('CALENDAR_ACL_SHARED', 's');
 define('CALENDAR_ACL_REQUIRED', 'p');
+
+define('PRIORITY_HIGH', 1);
+define('PRIORITY_NORMAL', 2);
+define('PRIORITY_LOW', 3);
+
+define('STATUS_TODO_NEED_ACTION', 1);
+define('STATUS_TODO_IN_PROGRESS', 2);
+define('STATUS_TODO_COMPLETED', 3);
+define('STATUS_TODO_CANCELLED', 4);
 ?>
Index: trunk/prototype/modules/calendar/export.php
===================================================================
--- trunk/prototype/modules/calendar/export.php	(revision 5863)
+++ trunk/prototype/modules/calendar/export.php	(revision 6996)
@@ -46,13 +46,13 @@
 {    
     $event = Controller::read(array('concept' => 'schedulable' , 'id' => $params['event']));
-	$attachmentRelation = Controller::find( array( 'concept' => 'schedulableToAttachment' ) , false ,array( 'filter' => array('=', 'schedulable'  ,  $event['id']) )); 
-	if(is_array($attachmentRelation)){
-		$attachments = array();
-		foreach($attachmentRelation as $key => $value)
-			if(isset($value['attachment']) || !!$value['attachment'])
-				$attachments[$key]  = $value['attachment'];
-		//Pega os anexos sem source
-		$event['attachments'] = Controller::find( array( 'concept' => 'attachment' ) , false ,array( 'filter' => array('IN', 'id' , $attachments) )); 
-	}
+    $attachmentRelation = Controller::find( array( 'concept' => 'schedulableToAttachment' ) , false ,array( 'filter' => array('=', 'schedulable'  ,  $event['id']) )); 
+    if(is_array($attachmentRelation)){
+	    $attachments = array();
+	    foreach($attachmentRelation as $key => $value)
+		    if(isset($value['attachment']) || !!$value['attachment'])
+			    $attachments[$key]  = $value['attachment'];
+	    //Pega os anexos sem source
+	    $event['attachments'] = Controller::find( array( 'concept' => 'attachment' ) , false ,array( 'filter' => array('IN', 'id' , $attachments) )); 
+    }
         
     $repeat = Controller::find( array( 'concept' => 'repeat' ) , false ,array( 'filter' => array('=', 'schedulable'  ,  $event['id']) ));    
Index: trunk/prototype/modules/calendar/css/print.css
===================================================================
--- trunk/prototype/modules/calendar/css/print.css	(revision 6996)
+++ trunk/prototype/modules/calendar/css/print.css	(revision 6996)
@@ -0,0 +1,132 @@
+.title_print {
+	font: 20px arial;
+	color: #8EB2FF;
+	margin: 0 0 15px 0;
+	text-align: center;
+}
+.title_print img {
+	margin: 3px 0 0 0;
+	width: 20px;
+	height: 20px;
+}
+.month_day_print {
+	font: bold 14px arial;
+	margin-left: 10px;
+	display: block;
+
+}
+.calendar_list_print {
+	border-left: 1px solid #CCC;
+	list-style: none;
+	margin-left: 110px;
+}
+.calendar_item_print{
+	position: relative;
+	left: 6px;
+	top: 3px;	
+}
+.calendar_item_print span{
+	font: 12px arial;
+	margin-left: 4px;
+}
+.allDay_list{
+	margin-left: 10px;
+	list-style: none;
+}
+.content_month_print{
+	border-top: 1px solid #CCC;
+	border-bottom: 1px solid #CCC;
+}
+.calendar_day_item_print{
+	margin-left: 110px;
+	border-left: 1px solid #CCC;
+}
+.calendar_day_item_print img {
+	margin-left : 5px;
+}
+.calendar_day_item_print span {
+	margin-left : 5px;
+}
+.allDay_list_label {
+	position: absolute;
+	margin-left: 14px;
+	font-weight: bold;
+}
+.allDay_list li.allDay_item{
+	margin-left: 10px;
+}
+body.detail{	
+	margin-top: 30px;
+}
+.details-event-list {
+	margin-top: 10px;
+}
+body.detail a.title {
+	font-weight: bold;
+	color: #30487E !important;
+}
+.events-list-win td{
+	padding: 0px;
+}
+.week  .event-on-day{
+	font: 10px arial;
+	margin: 5px 0;
+	word-wrap: break-word;
+}
+.week {
+	min-width: 600px;
+	min-height: 400px;
+	text-align: center;
+	float: left;
+}
+.week .name-month {
+	font: 20px arial;
+	color: #8EB2FF;
+	margin: 0 0 15px 0;
+}
+.week .name-month img {
+	margin: 3px 0 0 0;
+	width: 20px;
+	height: 20px;
+}
+.week span {
+	font: 14px arial;
+	display: block;
+}
+.week .days ul {
+	list-style: none;
+	display: block;
+}
+.week ul li{
+	float: left;
+	display: inline;
+	border: 1px solid;
+	width: 100px;
+}
+.week .all-day-line{
+	border: 0;
+}
+.week .event-all-day{
+	margin: 3px 0;
+	font: 10px arial;
+}
+.week .all-day-line .write{
+	margin:-3px 0 0 0;
+	font-weight: bold;
+	border-left: 1px solid;
+	border-top: 1px solid;
+	border-bottom: 1px solid;	
+}
+.week .all-day{
+	border-top: 1px solid;
+	border-bottom: 1px solid;
+}
+.fc-year-have-event{
+		border:2px solid #9cf !important;
+}
+.year_print_header {
+	width: 100%;
+}
+.year_print_header h2{
+	text-align: center
+}
Index: trunk/prototype/modules/calendar/css/layout.css
===================================================================
--- trunk/prototype/modules/calendar/css/layout.css	(revision 6944)
+++ trunk/prototype/modules/calendar/css/layout.css	(revision 6996)
@@ -217,13 +217,21 @@
 /* -- event details styles -- */
 
-.new-event-win.active {
+.new-event-win.active, .new-task-win.active {
 	 width:700px;height:510px;text-align:left;
 }
 
-.new-event-win > .content.ui-tabs.ui-widget-content {
+.new-event-win > .content.ui-tabs.ui-widget-content, .new-task-win > .content.ui-tabs.ui-widget-content {
 	border: none;
 }
 
-.new-event-win ul.attendee-permissions-list, li.attendee-permissions-list{text-align: left;}
+.new-event-win ul.attendee-permissions-list, li.attendee-permissions-list, .new-task-win ul.attendee-permissions-list{text-align: left;}
+.new-activity-win.active {
+	 width:700px;height:510px;text-align:left;
+}
+
+.new-activity-win > .content.ui-tabs.ui-widget-content {
+	border: none;
+}
+.new-activity-win ul.attendee-permissions-list, li.attendee-permissions-list{text-align: left;}
 
 li.attendee-permissions-list input{width: 20px !important; margin: 3px 0 0 0 !important;}
@@ -234,38 +242,93 @@
 p.request-update label{width: 150px !important;}
 
-.new-event-win .menu-addevent {
+.new-event-win .menu-addevent, .new-task-win .menu-addevent {
 	text-align: right;
 }
 
-fieldset.block-add-attendee .add-attendee-search { max-width: 250px; margin: 5px;}
-fieldset.block-add-attendee .add-attendee-search input { max-width: 220px; width: 220px; padding: 0 0 0 7px;}
-fieldset.block-add-attendee .search-result-list { width: 255px; max-height: 215px; overflow: auto;}
-fieldset.block-add-attendee .search-result-list .ui-widget-content { border: none;}
-fieldset.block-add-attendee .search-result-list .empty { margin-left: 5px; }
+.new-event-win fieldset.block-add-attendee .add-attendee-search { max-width: 250px; margin: 5px;}
+.new-task-win fieldset.block-add-attendee .add-attendee-search { max-width: 323px; margin: 5px;}
+
+.new-event-win fieldset.block-add-attendee .add-attendee-search input { max-width: 220px; width: 220px; padding: 0 0 0 7px;}
+.new-task-win fieldset.block-add-attendee .add-attendee-search input { max-width: 290px; width: 290px; padding: 0 0 0 7px;}
+
+.new-activity-win .menu-addevent { 	text-align: right; }
+fieldset.block-add-attendee .add-attendee-search, fieldset.block-add-activity .add-activity-search { max-width: 250px; margin: 5px;}
+fieldset.block-add-attendee .add-attendee-search input, fieldset.block-add-activity .add-activity-search input { max-width: 220px; width: 220px; padding: 0 0 0 7px;}
+fieldset.block-add-attendee .search-result-list, fieldset.block-add-activity .search-result-list { width: 255px; max-height: 215px; overflow: auto;}
+fieldset.block-add-attendee .search-result-list .ui-widget-content, fieldset.block-add-activity .search-result-list .ui-widget-content { border: none;}
+fieldset.block-add-attendee .search-result-list .empty, fieldset.block-add-activity .search-result-list .empty { margin-left: 5px; }
 fieldset.block-add-user .add-user-search {max-width: 235px;}
 fieldset.block-add-user .search-result-list {max-width: 245px;} 
-fieldset.block-add-user .search-result-list .ui-widget-content {/*max-width: 245px;*/}
-
-.block-attendee-list, .block-add-attendee { float:left;}
+
+fieldset.block-add-user .search-result-list .ui-widget-content, fieldset.block-add-user .search-result-list .ui-widget-content {max-width: 245px;}
+
+#calendar_addactivity_details8 .block-attendee-list, #calendar_addactivity_details8 .block-activity-list { width:430px; margin-right: 5px; }
+
+.block-activity-list, .block-activity-group-select{width: 405px}
+.block-add-activity.search{width: 298px}
+
+.block-attendee-list, .block-activity-list, .block-add-activity, .block-activity-group-select { float:left;}
 .block-attendee-list { width:400px; margin-right: 5px; }
-.block-add-attendee { width:260px; margin-right: 5px; }
-.block-attendee-list dd, .block-add-attendee dd { border: 1px solid #BFBFBF; }
-.block-attendee-list dt, .block-add-attendee dt { background-color:#FFF; margin: 5px 0 -6px 5px; font-weight: bold; display: table;  position: relative;}
+.new-event-win .block-add-attendee { width:260px; margin-right: 5px; }
+.new-task-win .block-add-attendee { width:335px; margin-right: 5px; }
+.block-attendee-list dd, .block-add-attendee dd, .block-activity-list dd, .block-add-activity dd, .block-activity-group-select dd { border: 1px solid #BFBFBF; }
+.block-attendee-list dt, .block-add-attendee dt,.block-activity-list dt, .block-add-activity dt, .block-activity-group-select dt { background-color:#FFF; margin: 5px 0 -6px 5px; font-weight: bold; display: table;  position: relative; display: table;}
 .block-attendee-list dd.attendee-list { height: 196px; }
-.block-attendee-list dd.attendee-list ul { max-height: 186px; overflow: auto; margin-top: 10px;}
-.block-attendee-list dd.attendee-list-add {border-top:none !important; border:1px solid #BFBFBF;}
-.block-attendee-list dd.attendee-list-add fieldset.add-attendee-input { border:none !important; margin: 0; padding: 0 }
-.block-attendee-list dd.attendee-list-brief { border:none !important; margin: 5px 0; color:#777; }
-
-dl.block-add-attendee {
+.block-attendee-list dd.attendee-list ul, .block-activity-list dd.task-activity-list ul { max-height: 186px; overflow: auto; margin-top: 10px;}
+.block-attendee-list dd.attendee-list-add, .block-activity-list dd.activity-list-add {border-top:none !important; border:1px solid #BFBFBF;}
+.block-attendee-list dd.attendee-list-add fieldset.add-attendee-input, .block-activity-list dd.activity-list-add fieldset.add-activity-input { border:none !important; margin: 0; padding: 0 }
+.block-attendee-list dd.attendee-list-brief, .block-activity-list dd.activity-list-brief { border:none !important; margin: 5px 0; color:#777; }
+#calendar_addactivity_details8 .block-attendee-list, #calendar_addactivity_details8 .block-activity-list { width:430px; margin-right: 5px; }
+
+/* Pesquisa de tarefas */
+.block-activity-group-select dd.task-activity-list { height: 181px; }
+.block-activity-group-select dd.group-select { height: 40px; }
+
+fieldset.block-add-activity ul.search-result-list li{ width: 9999px; }
+fieldset.block-add-activity ul.search-result-list{width: 290px;}
+
+fieldset.block-add-activity fieldset.add-activity-search{max-width: 320px; width: 282px}
+fieldset.block-add-activity fieldset.add-activity-search input{max-width: 260px; width: 245px;}
+
+.block-activity-group-select dd.group-select select{margin: 12px 8px;}
+.block-activity-group-select dd.task-activity-list{padding: 10px 5px}
+
+/** Pesquisa de tarefas **/
+
+select.group-addactivity-details-txt-timezone{width: 175px;}
+
+
+dl.block-add-attendee, dl.block-add-activity {
 	float: right;
 	display: block;
 }
 
-dl.block-add-attendee dd.add-attendee {
+dl.block-add-activity dd.add-activity{
+    width: 295px;
+    min-height: 254px;
+    display: block;
+}
+
+.new-event-win dl.block-add-attendee dd.add-attendee{
 	width: 260px;
 	min-height: 260px;
 	display: block;
 }
+
+.new-task-win dl.block-add-attendee dd.add-attendee {
+	width: 343px;
+	min-height: 260px;
+	display: block;
+}
+
+.new-activity-win dl.block-activity-group-select li.task{overflow: hidden; position: relative;}
+.new-activity-win dl.block-activity-group-select ul{overflow: hidden;}
+
+#calendar_addactivity_details8 dl.block-add-attendee dd.add-attendee ,#calendar_addactivity_details8 dl.block-add-activity dd.add-activity {
+	width: 260px;
+	min-height: 292px;
+	display: block;
+}
+
 
 ul.attendees-count {clear:left; float:left;}
@@ -280,6 +343,7 @@
 .attendees-list .me .add-attendee-options-read { max-height: 16px; height:16px;  max-width: 16px; width:16px; display: inline; padding: 0; margin: 0 0 5px 0;}
 
-.attendees-list .me .add-attendee-options-button {position: absolute; top: 171px;}
+.attendees-list .me .add-attendee-options-button {top: 4px;}
 .attendees-list .hover-attendee { background-color: #DFEFFC;}
+.task-activity-list .hover-activity { background: #DFEFFC;}
 /*
 .attendees-list .attendee-options-button-edit { position: absolute; top:0; right:25px;}
@@ -288,6 +352,6 @@
 */
 
-.attendee-options{ position: absolute; top: 0; left: 287px; background-color: white; z-index: 100; width: 90px; background-color: #FFF;	padding: 0 20px 0 3px; text-align: right;}
-.attendees-list .not-attendee { height:16px; }
+.attendee-options, .activity-options{ position: absolute; top: 0; left: 287px; background-color: white; z-index: 100; width: 90px; background-color: #FFF;	padding: 0 20px 0 3px; text-align: right;}
+.attendees-list .not-attendee, .activitys-list .not-activity { height:16px; }
 
 .list-delegates{margin: 0 0 0 25px;}
@@ -296,5 +360,5 @@
 
 .attendees-list .me .add-attendee-search input { max-width: 125px; }
-.attendees-list li.organizer, .attendees-list li.me-delegated  {margin-bottom: 3px;}
+.attendees-list li.organizer, .attendees-list li.me-delegated, .activitys-list li.organizer {margin-bottom: 3px;}
 .attendees-list .organizer .button.swap {
 	float: right;
@@ -338,4 +402,19 @@
 }
 dd.attendee-list ul.attendee-list li label[title=''] { display:none }
+dd.task-activity-list ul.task-activity-list li {
+    overflow: hidden;
+	position: relative;
+}
+
+
+dd.task-activity-list ul.task-activity-list li label.name,
+dd.task-activity-list ul.task-activity-list li label.mail {
+	width: 99999px;
+	min-width: 99999px;
+}
+
+ ul.task-activity-list li label.name{display: table-cell;}
+
+dd.task-activity-list ul.task-activity-list li label[title=''] { display:none }
 /*
 dd.attendee-list ul.attendee-list li .button.close {
@@ -404,5 +483,5 @@
 /* -- calendar list styles -- */
 
-.my-calendars .button.new {
+.my-calendars .button.new, .my-groups-task .button.new{
   float:right;
   width: 15px;
@@ -410,5 +489,5 @@
 }
 
-.my-calendars .status-list {
+.my-calendars .status-list, .my-groups-task  .status-list {
 	display: inline-block;
 	margin: 0px 0pc -4px -5px;
@@ -416,9 +495,9 @@
 }
 
-.my-calendars .list-calendars-item, .signed-calendars .list-calendars-item{
+.my-calendars .list-calendars-item, .signed-calendars .list-calendars-item, .my-groups-task .list-calendars-item{
 	position: relative; 
 	overflow: hidden;
 }
-.my-calendars .list-calendars-item div, .signed-calendars .list-calendars-item div{
+.my-calendars .list-calendars-item div, .signed-calendars .list-calendars-item div, .my-groups-task .list-calendars-item div{
 	overflow:hidden; 
 	width:6000px; 
@@ -426,5 +505,5 @@
 }
 
-.my-calendars .cal-list-options-btn, .signed-calendars .cal-list-options-btn {
+.my-calendars .cal-list-options-btn, .signed-calendars .cal-list-options-btn, .my-groups-task .cal-list-options-btn {
 	position: absolute;
 	top: 2px;
@@ -714,5 +793,6 @@
 
 .button.add.button-add-attachment{margin: -9px 0 0 8px;}
-.button.btn-danger.delete{margin: 0 0 0 0;}
+.button.btn-success.fileinput-button{width: 85px;}
+.button.btn-danger.delete{margin: 0 0 0 0; min-width: 143px;}
 
 .button.upload{top: 4px;}
@@ -729,4 +809,5 @@
 .lbl-archive-nome{width:40px !important;}
 .row.fileupload-buttonbar{margin-top: -14px; padding: 0.2em 0.7em;}
+.row.fileupload-buttonbar-task{margin-top: 0; padding: 0.2em 0.7em;}
 
 .archive-nome{width: 73px;}
@@ -745,18 +826,18 @@
 /* -- alarm dysplay -- */
 
-.new-event-alarm{
+.new-event-alarm, .new-task-alarm{
 	margin: 5px;	
 	font: bold;
 }
 
-.title-event-alarm{
+.title-event-alarm, .title-task-alarm{
 	margin: 5px;
 }
 
-.description-event-alarm{
+.description-event-alarm, .description-task-alarm{
 	margin: 5px;
 }
 
-.inicialize-event-alarm{
+.inicialize-event-alarm, .inicialize-task-alarm{
 	margin: 5px;
 }
@@ -861,7 +942,12 @@
 .ui-dialog .ui-button-text-only .ui-button-text { padding: 0.4em 1em; }
 
-.new-event-win fieldset { border: none;	margin: 0; padding: 0; }
-.new-event-win fieldset.tab-level2 { padding: 0px 5px; }
-.new-event-win fieldset fieldset, .new-event-win fieldset.tab-level2 fieldset { padding: 5px 0; }
+.new-event-win fieldset, .new-task-win fieldset { border: none;	margin: 0; padding: 0; }
+.new-event-win fieldset.tab-level2, .new-task-win fieldset.tab-level2 { padding: 0px 5px; }
+.new-event-win fieldset fieldset, .new-task-win fieldset.tab-level2 fieldset,
+.new-task-win fieldset fieldset, .new-task-win fieldset.tab-level2 fieldset{ padding: 5px 0; }
+
+.new-activity-win fieldset { border: none;	margin: 0; padding: 0; }
+.new-activity-win fieldset.tab-level2 { padding: 0px 5px; }
+.new-activity-win fieldset fieldset, .new-activity-win fieldset.tab-level2 fieldset { padding: 5px 0; }
 
 .hidden {
@@ -904,7 +990,15 @@
 }
 
+.new-event-win form.form-addevent { padding: 9px; }
+
+.new-activity-win div.div-addtask { padding: 0; width: 774px; border: 0;}
+.new-activity-win div.div-addactivity { padding: 0; width: 734px; border: 0;}
+.new-activity-win form.form-addevent { padding: 9px; }
 .ui-dialog .ui-dialog-content { padding: 0; }
-.new-event-win div.div-addevent { padding: 0; width: 700px; border: 0;}
-.new-event-win form.form-addevent { padding: 9px; }
+.new-event-win div.div-addevent{ padding: 0; width: 700px; border: 0;}
+.new-task-win div.div-addtask { padding: 0; width: 774px; border: 0;}
+.new-event-win form.form-addevent, .new-task-win form.form-addtask { padding: 9px; }
+.new-activity-win div.div-addevent { padding: 0; width: 700px; border: 0;}
+.new-activity-win form.form-addevent { padding: 9px; }
 
 .expresso-calendar-container input[type="text"] { height: 18px; }
@@ -929,5 +1023,5 @@
 
 .expresso-calendar-container input.h1,
-.new-event-win input.h1 {
+.new-event-win input.h1, .new-task-win input.h1, .new-activity-win input.h1 {
 	font-size: 150%;
 	font-weight: bold;
@@ -936,5 +1030,5 @@
 }
 
-.new-event-win textarea {
+.new-event-win textarea, .new-task-win textarea, .new-activity-win textarea {
 	width:600px;
 	height: 210px;
@@ -945,6 +1039,8 @@
 span.input-group { display: block; }
 /*p.input-group label { vertical-align: top; }*/
-.new-event-win p.input-group label { display: inline-block; width: 65px;}
-.new-event-win p.input-group label.input-group { display: inline-block; width: 110px; font-weight: bold;}
+.new-event-win p.input-group label, .new-task-win p.input-group label { display: inline-block; width: 65px;}
+.new-event-win p.input-group label.input-group, .new-task-win p.input-group label.input-group { display: inline-block; width: 110px; font-weight: bold;}
+.new-activity-win p.input-group label { display: inline-block; width: 65px;}
+.new-activity-win p.input-group label.input-group { display: inline-block; width: 110px; font-weight: bold;}
 
 input.number {text-align: right}
@@ -966,5 +1062,9 @@
 .new-event-win fieldset.event-repeat-container label, 
 .new-event-win p.input-group.event-repeat-weekly label, 
-.new-event-win p.input-group.event-repeat-monthly label {
+.new-event-win p.input-group.event-repeat-monthly label,
+.new-task-win fieldset.task-repeat-container label, 
+.new-task-win p.input-group.task-repeat-weekly label, 
+.new-task-win p.input-group.task-repeat-monthly label
+{
 	width: auto; 
 }
@@ -973,10 +1073,31 @@
 .new-event-win fieldset.search-field,
 .new-event-win fieldset.block-add-attendee-permissions,
-.new-event-win fieldset.block-attendee-list {
+.new-event-win fieldset.block-attendee-list,
+.new-task-win fieldset.input-field-rounded,
+.new-task-win fieldset.search-field,
+.new-task-win fieldset.block-add-attendee-permissions,
+.new-task-win fieldset.block-attendee-list
+{
 	border:1px solid #CFCFCF;
 }
 
-.new-event-win fieldset.block-attendee-list { width: 300px; max-height:180px; padding: 5px; float: left;}
-.new-event-win fieldset.block-attendee-list ul {  height:160px; overflow: auto;}
+.new-event-win fieldset.block-attendee-list, .new-task-win fieldset.block-attendee-list { width: 300px; max-height:180px; padding: 5px; float: left;}
+.new-event-win fieldset.block-attendee-list ul, .new-task-win fieldset.block-attendee-list ul {  height:160px; overflow: auto;}
+/**/
+.new-activity-win fieldset.event-repeat-container label, 
+.new-activity-win p.input-group.event-repeat-weekly label, 
+.new-activity-win p.input-group.event-repeat-monthly label {
+	width: auto; 
+}
+
+.new-activity-win fieldset.input-field-rounded,
+.new-activity-win fieldset.search-field,
+.new-activity-win fieldset.block-add-attendee-permissions,
+.new-activity-win fieldset.block-attendee-list {
+	border:1px solid #CFCFCF;
+}
+
+.new-activity-win fieldset.block-attendee-list { width: 300px; max-height:180px; padding: 5px; float: left;}
+.new-activity-win fieldset.block-attendee-list ul {  height:160px; overflow: auto;}
 
 
@@ -1148,9 +1269,4 @@
 }
 
-.events-list-win table img {
-  width: 12px;
-  height: 12px;
-  padding: 0 2px;
-}
 
 .events-list-win table span { font-size:12px; }
Index: trunk/prototype/modules/calendar/css/style.css
===================================================================
--- trunk/prototype/modules/calendar/css/style.css	(revision 6921)
+++ trunk/prototype/modules/calendar/css/style.css	(revision 6996)
@@ -45,10 +45,18 @@
 .ui-dialog .ui-button-text-only .ui-button-text { padding: 0.4em 1em; }
 
-.new-event-win fieldset { border: none;	margin: 0; padding: 0; }
-.new-event-win fieldset.tab-level2 { padding: 0px 5px; min-height: 310px; max-height: 310px; overflow: auto;}
-.new-event-win .overflow_add_calender { overflow: auto; max-height: 320px; }
-.new-event-win fieldset#calendar_addevent_details7 { overflow: hidden}
-.new-event-win fieldset#calendar_addevent_details5 .button-files-upload{margin: 15px 0 0 0}
-.new-event-win fieldset fieldset, .new-event-win fieldset.tab-level2 fieldset { padding: 5px 0; }
+.new-event-win fieldset, .new-task-win fieldset  { border: none;	margin: 0; padding: 0; }
+.new-event-win fieldset.tab-level2, .new-task-win fieldset.tab-level2 { padding: 0px 5px; min-height: 110px; max-height: 310px; overflow: hidden;}
+.new-event-win .overflow_add_calender, .new-task-win .overflow_add_calender { overflow: auto; max-height: 320px; }
+.new-event-win fieldset#calendar_addevent_details7, .new-task-win fieldset#calendar_addevent_details7 { overflow: hidden}
+.new-event-win fieldset#calendar_addevent_details5 .button-files-upload, .new-task-win fieldset#calendar_addevent_details5 .button-files-upload{margin: 15px 0 0 0}
+.new-event-win fieldset fieldset, .new-event-win fieldset.tab-level2 fieldset, .new-task-win fieldset fieldset, .new-event-win fieldset.tab-level2 fieldset { padding: 5px 0; }
+
+.new-activity-win fieldset { border: none; margin: 0; padding: 0; }
+.new-activity-win fieldset.tab-level2 { padding: 0px 5px; min-height: 250px; max-height: 310px; overflow: auto;}
+
+.new-activity-win .overflow_add_calender { overflow: auto; max-height: 320px; }
+.new-activity-win fieldset#calendar_addevent_details7 { overflow: hidden}
+.new-activity-win fieldset#calendar_addevent_details5 .button-files-upload{margin: 15px 0 0 0}
+.new-activity-win fieldset fieldset, .new-activity-win fieldset.tab-level2 fieldset { padding: 5px 0; }
 
 .hidden {
@@ -92,6 +100,16 @@
 
 .ui-dialog .ui-dialog-content { padding: 0; }
-.new-event-win div.div-addevent { padding: 0; width: 700px; border: 0;}
-.new-event-win form.form-addevent { padding: 9px; }
+.new-event-win div.div-addevent{ padding: 0; width: 700px; border: 0;}
+.new-task-win div.div-addtask { padding: 0; width: 774px; border: 0;}
+
+.new-event-win form.form-addevent, 
+.new-task-win form.form-addtask,
+.new-activity-win form.form-addactivity { padding: 9px; }
+
+.new-activity-win input.time{width: 45px;}
+.new-activity-win input.date{width: 80px;}
+
+.new-activity-win div.div-addactivity { padding: 0; width: 734px; border: 0;}
+.new-activity-win form.form-addactivity { padding: 9px; }
 
 .expresso-calendar-container input[type="text"] { height: 18px; }
@@ -116,5 +134,6 @@
 
 .expresso-calendar-container input.h1,
-.new-event-win input.h1 {
+.new-event-win input.h1,
+.new-task-win input.h1{
 	font-size: 150%;
 	font-weight: bold;
@@ -122,6 +141,20 @@
 	height: 150%;
 }
-
-.new-event-win textarea {
+.new-activity-win input.h1 {
+  font-size: 150%;
+  font-weight: bold;
+  width: 100%;
+  height: 150%;
+}
+
+.expresso-calendar-container input.h1,
+.new-task-win input.h1 {
+	font-size: 150%;
+	font-weight: bold;
+	width: 64%;
+	height: 150%;
+}
+
+.new-event-win textarea, .new-task-win textarea {
 	width:600px;
 	height: 210px;
@@ -130,8 +163,16 @@
 }
 
+.new-activity-win textarea {
+  width:600px;
+  height: 210px;
+  border: 1px solid #CFCFCF;
+  padding: 0px;
+}
 span.input-group { display: block; }
 /*p.input-group label { vertical-align: top; }*/
-.new-event-win p.input-group label { display: inline-block; width: 65px;}
-.new-event-win p.input-group label.input-group { display: inline-block; width: 110px; font-weight: bold;}
+.new-event-win p.input-group label, .new-task-win p.input-group label { display: inline-block; width: 65px;}
+.new-event-win p.input-group label.input-group, .new-task-win p.input-group label.input-group { display: inline-block; width: 110px; font-weight: bold;}
+.new-activity-win p.input-group label { display: inline-block; width: 65px;}
+.new-activity-win p.input-group label.input-group { display: inline-block; width: 110px; font-weight: bold;}
 
 input.number {text-align: right}
@@ -153,6 +194,16 @@
 .new-event-win fieldset.event-repeat-container label, 
 .new-event-win p.input-group.event-repeat-weekly label, 
-.new-event-win p.input-group.event-repeat-monthly label {
+.new-event-win p.input-group.event-repeat-monthly label,
+.new-task-win fieldset.task-repeat-container label, 
+.new-task-win p.input-group.task-repeat-weekly label, 
+.new-task-win p.input-group.task-repeat-monthly label
+{
 	width: auto; 
+}
+
+.new-activity-win fieldset.event-repeat-container label, 
+.new-activity-win p.input-group.event-repeat-weekly label, 
+.new-activity-win p.input-group.event-repeat-monthly label {
+  width: auto; 
 }
 
@@ -160,10 +211,27 @@
 .new-event-win fieldset.search-field,
 .new-event-win fieldset.block-add-attendee-permissions,
-.new-event-win fieldset.block-attendee-list {
+.new-event-win fieldset.block-attendee-list,
+.new-task-win fieldset.input-field-rounded,
+.new-task-win fieldset.search-field,
+.new-task-win fieldset.block-add-attendee-permissions,
+.new-task-win fieldset.block-attendee-list{
 	border:1px solid #CFCFCF;
 }
 
+.new-event-win fieldset.block-attendee-list, .new-task-win fieldset.block-attendee-list { width: 300px; max-height:180px; padding: 5px; float: left;}
+.new-event-win fieldset.block-attendee-list ul, .new-task-win fieldset.block-attendee-list ul {  height:160px; overflow: auto;}
+
+.new-activity-win fieldset.input-field-rounded,
+.new-activity-win fieldset.search-field,
+.new-activity-win fieldset.block-add-attendee-permissions,
+.new-activity-win fieldset.block-attendee-list {
+  border:1px solid #CFCFCF;
+}
+/*Duvida*/
 .new-event-win fieldset.block-attendee-list { width: 300px; max-height:180px; padding: 5px; float: left;}
 .new-event-win fieldset.block-attendee-list ul {  height:160px; overflow: auto;}
+
+.new-activity-win fieldset.block-attendee-list { width: 300px; max-height:180px; padding: 5px; float: left;}
+.new-activity-win fieldset.block-attendee-list ul {  height:160px; overflow: auto;}
 
 
@@ -223,5 +291,10 @@
 .block-vertical-toolbox .button.add {
     width:190px;
-}
+    margin-bottom: 5px;
+}
+
+div.qtip div.add-simple-task input{width: 188px}
+div.qtip div.add-simple-task textarea{width: 184px}
+
 
 .fc-header .fc-state-active, .fc-header .ui-state-active {
@@ -335,10 +408,4 @@
 }
 
-.events-list-win table img {
-  width: 12px;
-  height: 12px;
-  padding: 0 2px;
-}
-
 .events-list-win table span { font-size:12px; }
 .events-list-win table .same-start-date * { border: 0; }
@@ -348,4 +415,6 @@
 .events-list-win table th.start-date-multiple-events { border-bottom: 1px solid #ccc; }
 
+.events-list-win .fc-header-right.list-right{width: 26%}
+
 .events-list-win table .title {
     font-size: 150%;
@@ -361,5 +430,5 @@
 .expresso-calendar-container .search-field input { border:none;}
 
-.ui-tabs .ui-tabs-panel { padding: 0; margin-top: 10px;}
+.ui-tabs .ui-tabs-panel { padding: 0; margin-top: 11px;}
 
 .ui-tabs .ui-tabs-nav li .ui-icon-close {
@@ -459,2 +528,136 @@
 
 input.inputNumber {width:80px; text-align: left;}
+
+.div-addtask #calendar_addtask_details1 .h1{
+  width: 100%;
+}
+
+.div-addtask #calendar_addtask_details2 textarea {
+  width: 670px;
+}
+
+.div-addtask{
+  width: 760px;
+}
+
+.calendar-addevent-details-txt-timezone, .calendar-addtask-details-txt-timezone{width: 217px;} 
+
+.div-addtask #calendar_addtask_details1 .time-previsao { width: 40px; }
+
+.div-addtask #calendar_addtask_details1 .date-previsao{ width: 80px; }
+
+.div-addtask #calendar_addtask_details1 .start-time{ width: 40px; }
+.div-addtask #calendar_addtask_details1 .start-date{ width: 80px; }
+.div-addtask #calendar_addtask_details1 .end-time{ width: 40px; }
+.div-addtask #calendar_addtask_details1 .end-date{ width: 80px; }
+.div-addtask #calendar_addtask_details1 .previsao-termino { margin: 0 0 0 30px; }
+.div-addtask #calendar_addtask_details1 .subitem { margin: 5px; display: block;}
+.div-addtask #calendar_addtask_details1 .subitem .span_done{ margin: 0 30px;}
+.div-addtask #calendar_addtask_details1 .subitem .span_done img{position: relative; top:4px; width:16px; height:16px;}
+.div-addtask #calendar_addtask_details1 .calendar_addevent_details_lnk_timezone { margin: 0 0 0 20px;}
+.div-addtask #calendar_addtask_details1 .subitem .done { width: 45px;}
+
+@-moz-document url-prefix() {.div-addtask #calendar_addtask_details1 .ui-spinner-buttons{ top: -14px !important;}}
+
+@media screen and (-webkit-min-device-pixel-ratio:0){.div-addtask #calendar_addtask_details1 .ui-spinner-buttons{ top: -2px !important;}}
+
+.div-addtask #calendar_addtask_details1 .ui-spinner-buttons .ui-spinner-up{height: 7px !important;}
+.div-addtask #calendar_addtask_details1 .ui-spinner-buttons .ui-spinner-down{height: 8px !important;}
+
+.div-addtask #calendar_addtask_details1 .subitem .span_done.noAction{background-image: url("../img/gray.png"); background-repeat: no-repeat; }
+.div-addtask #calendar_addtask_details1 .subitem .span_done.inProcess{background-image: url("../img/yellow.png"); background-repeat: no-repeat;}
+.div-addtask #calendar_addtask_details1 .subitem .span_done.finished{background-image: url("../img/green.png"); background-repeat: no-repeat;}
+.div-addtask #calendar_addtask_details1 .subitem .span_done.canceled{background-image: url("../img/red.png"); background-repeat: no-repeat;}
+.div-addtask #calendar_addtask_details1 .subitem .span_done label{position: relative; left: 28px;}
+
+.div-addtask fieldset#calendar_addtask_details5.tab-level2{margin: 0}
+
+.div-addtask  #calendar_addtask_details8 .parent {width: 746px; min-height: 208px; float: left;}
+/*.div-addtask  #calendar_addtask_details8 .parent .child-top {width: 745px; height: 20px; background: #E8F4FD; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC;}*/
+.div-addtask  #calendar_addtask_details8 .parent .child-top {width: 745px; height: 25px; background: #E8F4FD; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC; border-top: 1px solid #CCC;}
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom {width: 745px; height: 208px; overflow: auto;  float: left; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC;}
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each { height: 20px; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each:hover { background: #FFF2F2; cursor: pointer;}
+
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .date-hour {overflow: hidden; width: 140px; float: left; height: 20px}
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .date-hour span { margin: 8px; float: left; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .user{overflow: hidden; width: 150px; float: left;  height: 20px; border-left: 1px solid #CCC; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .user span{ margin: 8px; float: left; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .attribute{overflow: hidden; width: 130px; float: left;  height: 20px; border-left: 1px solid #CCC; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .attribute span{ margin: 8px; float: left; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .beforeValue{overflow: hidden; width: 150px; float: left;  height: 20px; border-left: 1px solid #CCC; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .beforeValue span{ margin: 8px; float: left; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .afterValue{overflow: hidden; width: 150px; float: left;  height: 20px; border-left: 1px solid #CCC; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .afterValue span{ margin: 8px; float: left; }
+
+.div-addtask  #calendar_addtask_details8 .parent .child-top .date-hour { width: 140px; float: left; background: #E8F4FD; height: 20px; text-align: center; }
+.div-addtask  #calendar_addtask_details8 .parent .child-top .date-hour span{ display: block; padding: 6px; font-weight: bold; color: #2E6E9E; }
+.div-addtask  #calendar_addtask_details8 .parent .child-top .user { width: 150px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E; text-align: center;}
+.div-addtask  #calendar_addtask_details8 .parent .child-top .user span{display: block; padding: 6px;}
+.div-addtask  #calendar_addtask_details8 .parent .child-top .attribute { width: 130px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E;  text-align: center;}
+.div-addtask  #calendar_addtask_details8 .parent .child-top .attribute span{display: block; padding: 6px;}
+.div-addtask  #calendar_addtask_details8 .parent .child-top .beforeValue { width: 150px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E;  text-align: center;}
+.div-addtask  #calendar_addtask_details8 .parent .child-top .beforeValue span{display: block; padding: 6px; }
+.div-addtask  #calendar_addtask_details8 .parent .child-top .afterValue { width: 150px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E;  text-align: center;}
+.div-addtask  #calendar_addtask_details8 .parent .child-top .afterValue span{display: block; padding: 6px; }
+
+/*Atividades*/
+
+.div-addactivity{ width: 734px;}
+.div-addactivity #group_addactivity_details1 .h1{ width: 100%;}
+.div-addactivity #group_addactivity_details2 textarea { width: 635px; }
+.div-addactivity #group_addactivity_details1 .time-due { width: 40px; }
+.div-addactivity #group_addactivity_details1 .date-due{ width: 80px; }
+
+.div-addactivity #group_addactivity_details1 .start-time{ width: 40px; }
+.div-addactivity #group_addactivity_details1 .start-date{ width: 80px; }
+.div-addactivity #group_addactivity_details1 .end-time{ width: 40px; }
+.div-addactivity #group_addactivity_details1 .end-date{ width: 80px; }
+.div-addactivity #group_addactivity_details1 .previsao-termino { margin: 0 0 0 30px; }
+.div-addactivity #group_addactivity_details1 .subitem { margin: 5px; display: block;}
+.div-addactivity #group_addactivity_details1 .subitem .span_done{ margin: 0 30px;}
+.div-addactivity #group_addactivity_details1 .calendar_addevent_details_lnk_timezone { margin: 0 0 0 20px;}
+.div-addactivity #group_addactivity_details1 .subitem .done { width: 45px;} 
+
+.div-addactivity #group_addactivity_details1 .subitem .span_done.noAction{background-image: url("../img/gray.png"); background-repeat: no-repeat; }
+.div-addactivity #group_addactivity_details1 .subitem .span_done.inProcess{background-image: url("../img/yellow.png"); background-repeat: no-repeat;}
+.div-addactivity #group_addactivity_details1 .subitem .span_done.finished{background-image: url("../img/green.png"); background-repeat: no-repeat;}
+.div-addactivity #group_addactivity_details1 .subitem .span_done.canceled{background-image: url("../img/red.png"); background-repeat: no-repeat;}
+.div-addactivity #group_addactivity_details1 .subitem .span_done label{position: relative; left: 28px;}
+
+.div-addactivity #group_addactivity_details5.tab-level2{margin-top: 2px;}
+.div-addactivity #group_addactivity_details5 .button-files-upload { margin: 0 0 0 5px; }
+
+/**********************************************************************************************************/
+.div-addactivity  #group_addactivity_details6  .parent {width: 695px; min-height: 208px; float: left;}
+/*.div-addactivity  #group_addactivity_details6  .parent .child-top {width: 745px; height: 20px; background: #E8F4FD; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC;}*/
+.div-addactivity  #group_addactivity_details6  .parent .child-top {width: 695px; height: 25px; background: #E8F4FD; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC; border-top: 1px solid #CCC;}
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom {width: 695px; height: 208px; overflow: auto;  float: left; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC;}
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom .child-bottom-each { height: 20px; }
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom .child-bottom-each:hover { background: #FFF2F2; cursor: pointer;}
+
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom .task { height: 25px; text-align: center; background: #FEFEAD; border-bottom: 1px solid #CCC;}
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom .task.left {border-top: 1px solid #CCC;}
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom .task span{padding: 5px; display: block;}
+
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom .child-bottom-each .date-hour {overflow: hidden; width: 140px; float: left; height: 20px}
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom .child-bottom-each .date-hour span { margin: 8px; float: left; }
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom .child-bottom-each .user{overflow: hidden; width: 145px; float: left;  height: 20px; border-left: 1px solid #CCC; }
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom .child-bottom-each .user span{ margin: 8px; float: left; }
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom .child-bottom-each .attribute{overflow: hidden; width: 130px; float: left;  height: 20px; border-left: 1px solid #CCC; }
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom .child-bottom-each .attribute span{ margin: 8px; float: left; }
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom .child-bottom-each .beforeValue{overflow: hidden; width: 130px; float: left;  height: 20px; border-left: 1px solid #CCC; }
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom .child-bottom-each .beforeValue span{ margin: 8px; float: left; }
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom .child-bottom-each .afterValue{overflow: hidden; width: 129px; float: left;  height: 20px; border-left: 1px solid #CCC; }
+.div-addactivity  #group_addactivity_details6  .parent .child-bottom .child-bottom-each .afterValue span{ margin: 8px; float: left; }
+
+.div-addactivity  #group_addactivity_details6  .parent .child-top .date-hour { width: 140px; float: left; background: #E8F4FD; height: 20px; text-align: center; }
+.div-addactivity  #group_addactivity_details6  .parent .child-top .date-hour span{ display: block; padding: 6px; font-weight: bold; color: #2E6E9E; }
+.div-addactivity  #group_addactivity_details6  .parent .child-top .user { width: 145px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E; text-align: center;}
+.div-addactivity  #group_addactivity_details6  .parent .child-top .user span{display: block; padding: 6px; }
+.div-addactivity  #group_addactivity_details6  .parent .child-top .attribute { width: 130px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E;  text-align: center;}
+.div-addactivity  #group_addactivity_details6  .parent .child-top .attribute span{display: block; padding: 6px; }
+.div-addactivity  #group_addactivity_details6  .parent .child-top .beforeValue { width: 130px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E;  text-align: center;}
+.div-addactivity  #group_addactivity_details6  .parent .child-top .beforeValue span{display: block; padding: 6px; }
+.div-addactivity  #group_addactivity_details6  .parent .child-top .afterValue { width: 129px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E;  text-align: center;}
+.div-addactivity  #group_addactivity_details6  .parent .child-top .afterValue span{display: block; padding: 6px; }
Index: trunk/prototype/modules/calendar/css/calendar_print.css
===================================================================
--- trunk/prototype/modules/calendar/css/calendar_print.css	(revision 6996)
+++ trunk/prototype/modules/calendar/css/calendar_print.css	(revision 6996)
@@ -0,0 +1,25 @@
+
+		.title_print {
+			font: 20px arial;
+			color: #8EB2FF;
+			margin: 0 0 15px 0;
+			text-align: center;
+		}
+		.title_print img {
+			margin: 3	px 0 0 0;
+			width: 20px;
+			height: 20px;
+		}
+		.month_day_print {
+			font: 14px arial;
+			display: block;
+
+		}
+		.calendar_list_print {
+			list-style: none;
+
+		}
+		.calendar_item_print {
+			font: 12px arial;
+			margin: 3px;
+		}
Index: trunk/prototype/modules/calendar/js/calendar.codecs.js
===================================================================
--- trunk/prototype/modules/calendar/js/calendar.codecs.js	(revision 6533)
+++ trunk/prototype/modules/calendar/js/calendar.codecs.js	(revision 6996)
@@ -22,5 +22,6 @@
 	    fontColor: "fff",
 	    timezone: 'America/Sao_Paulo',
-	    weekStart: 'SUN'
+	    weekStart: 'SUN',
+	    useDesktopNotification: 0
 	};
 
@@ -31,4 +32,6 @@
     }
 }
+
+updateActivity = false;
 
 constantsParticipant = {
@@ -195,4 +198,6 @@
 	DataLayer.commit( false, false, function(){	
             Calendar.rerenderView(true);
+	    if(updateActivity)
+		refreshTaskActivity();
 	});
     }
@@ -262,5 +267,5 @@
 		user: User.me.id,	
 		calendar: {
-		    id: Calendar.calendarOf[form.signature].id,
+		    id: !!!parseInt(form.type) ? Calendar.calendarOf[form.signature].id : Calendar.groupOf[form.signature].id,
 		    name: Encoder.htmlEncode(form.name),
 		    description: Encoder.htmlEncode(form.description),
@@ -384,4 +389,87 @@
 
       
+});
+
+DataLayer.codec( "schedulable", "taskEdit", {
+
+    decoder: function( evtObj ){
+	Encoder.EncodeType = "entity";
+	
+	if( notArray = $.type(evtObj) !== "array" )
+	    evtObj = [ evtObj ];
+
+	var pref = User.preferences;
+		
+	var res = $.map(evtObj, function( form ){
+			
+	    return DataLayer.merge({
+		id: form.idTask,
+		percentage: form.percentage,
+		type: '2', 
+		status: form.taskStatus,
+		participants : $.map(form.attendee, function( attendee, i ){
+		    if(isNaN(attendee)){
+			return{
+			    id: attendee,
+			    acl: form.attendeeAcl[i],
+			    delegatedFrom: !!form.delegatedFrom[i] ? form.delegatedFrom[i] : 0,
+			    isOrganizer: (form.attendee_organizer == attendee ? 1 : 0 ),
+			    isExternal: !!parseInt(form.attendeeType[i]) ? 1 : 0,
+			    acl: form.attendeeAcl[i].replace('o', '')
+			};
+		    }else{
+			if(DataLayer.get('participant', attendee).user == User.me.id){
+			    var me = {
+				user: User.me.id,
+				status: form.status,
+				id: attendee,
+				isOrganizer: 0,
+				receiveNotification : (!!form.receiveNotification ? 1 : 0),
+				alarms: typeof(form.alarmTime) != 'undefined' ? 
+				$.map( form.alarmTime || [], function( alarmTime, i ){
+
+				    if( alarmTime === "" )
+					return( null );
+
+				    return !!form.alarmId[i] ?
+				    {
+					type: form.alarmType[i], 
+					unit: form.alarmUnit[i], 
+					time: form.alarmTime[i], 
+					id: form.alarmId[i]
+					} : 
+{
+					type: form.alarmType[i],
+					unit: form.alarmUnit[i], 
+					time: form.alarmTime[i]
+					};
+				}) : []
+			    };
+							
+			    if(form.startDate){
+				var tzId =  DataLayer.get('schedulable', form.idEvent).timezone || User.preferences.timezone,
+				formatString = pref.dateFormat + " " + pref.hourFormat;
+								
+				DataLayer.put('notification', {
+				    participant: me.id,
+				    type: 'suggestion',
+				    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'),
+				    allDay: ( !!form.allDay ? 1 : 0 ),
+				    schedulable: form.idEvent
+				});
+							
+			    }
+			    return me;
+			}else return(null);
+		    };
+		})
+	    }, (form.group != form.lastGroup? {calendar: form.group, lastCalendar: form.lastGroup} : {}))
+	});
+	return notArray ? res[0] : res;
+    },
+
+    encoder: function( evtObj ){}
+
 });
 
@@ -510,4 +598,5 @@
 		calendar: objEvent.calendar,
 		summary: objEvent.summary,
+        type: !!objEvent.type ? objEvent.type : 1,
 		description: objEvent.description,
 		timezone: objEvent.timezone,
@@ -595,4 +684,517 @@
 });
 
+DataLayer.codec( "schedulable", "task", {
+
+    decoder: function( evtObj ){
+    Encoder.EncodeType = "entity";
+    
+    if( notArray = $.type(evtObj) !== "array" )
+        evtObj = [ evtObj ];
+
+    var pref = User.preferences;
+
+    var res = $.map(evtObj, function( form ){
+    
+        var tzId =  form.timezone || Calendar.signatureOf[form.group].calendar.timezone || User.preferences.timezone,
+
+        formatString = pref.dateFormat + " " + pref.hourFormat;
+
+        return DataLayer.merge({
+        "class": form["class"],
+        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) ,
+        due: (form.dueDate == '' )? 0 : Date.parseExact(form.dueDate + " "+$.trim(form.dueTime) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'),
+        allDay: ( !!form.allDay ? 1 : 0 ),      
+        status: form.taskStatus,      
+        id: form.idTask,
+        location: form.location,
+        type: !!form.type ?  form.type : 2,
+        percentage: form.percentage,
+        priority: form.priority,
+        category: form.category,
+        summary: form.summary == '' ? 'Tarefa sem título' : form.summary,
+        description: form.description,
+        timezone: tzId,
+        attachments: $.map(form.attachment || [], function( attachment, i ){
+            return {
+            attachment: attachment
+            }
+        }),
+        participants: $.map( form.attendee || [], function( attendee, i ){
+
+            if( !attendee || attendee === "" )
+            return( null );
+
+            var participant = {};
+            participant.user = (attendee!= User.me.id) ? DataLayer.get('participant', attendee).user : attendee ;
+
+            if( participant.user === User.me.id ){
+            return DataLayer.merge({
+                id: attendee,
+                isOrganizer: (form.attendee_organizer == attendee ? 1 : 0 ),
+                alarms: participant.alarms = $.map( form.alarmTime || [], function( alarmTime, i ){
+                if( alarmTime === "" )
+                    return( null );
+                return !!form.alarmId[i] ? {
+                    type: form.alarmType[i], 
+                    unit: form.alarmUnit[i], 
+                    time: form.alarmTime[i], 
+                    id: form.alarmId[i]
+                    }:
+
+                    {
+                    type: form.alarmType[i],
+                    unit: form.alarmUnit[i], 
+                    time: form.alarmTime[i]
+                    };
+                }),
+                status: !!form.status ? form.status : 3
+            }, (form.delegatedFrom[i] != '0' && form.delegatedFrom[i] != '')  ? {
+                delegatedFrom: form.delegatedFrom[i]
+                } : {});
+            }else{
+                return {
+                    id: attendee,
+                    isOrganizer: (form.attendee_organizer == attendee ? 1 : 0 ),
+                    isExternal: !!parseInt(form.attendeeType[i]) ? 1 : 0
+                    };
+            };
+        })
+        }, form.lastGroup ? (( form.lastGroup == form.group ) ? {} : {calendar: form.group, lastGroup: form.lastGroup}) : {calendar: form.group});
+    });
+
+    return notArray ? res[0] : res;
+    },
+
+    encoder: function( evtObj ){
+
+    var notArray = false;
+      
+    if( notArray = $.type(evtObj) !== "array" )
+        evtObj = [ evtObj ];
+
+    var statusParticipants = {},  isAttendee = false,
+   
+    statusLabels = [ '', 'accepted', 'tentative', 'cancelled', 'unanswered', 'delegated' ],
+
+    participantInfo = {}, delegatedFrom = {}, me = DataLayer.copy( User.me );
+    
+    var delegateAttendee = {};
+    
+    for( var i = 0; i < statusLabels.length; i++ )
+        statusParticipants[ statusLabels[i] ] = 0;
+    
+    var res = $.map(evtObj, function( objEvent ){           
+            
+        if(!(typeof(objEvent) == 'object'))
+            return (null);
+
+        var limitAttendee = false;
+
+        return {
+        "class": objEvent["class"],
+        id: objEvent.id,
+        location: objEvent.location,
+        category: objEvent.category,
+        taskStatus: objEvent.status,
+        groups: Calendar.groups,
+        group: objEvent.group ? objEvent.group : objEvent.calendar,
+        summary: objEvent.summary,
+        type: !!objEvent.type ? objEvent.type : 2,
+        description: objEvent.description,
+        timezone: objEvent.timezone,
+        timezones: Timezone.timezones,
+        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),
+        allDay: !!parseInt( objEvent.allDay ),
+	    historic: !!objEvent.historic ? decodeHistoric(objEvent) : [] ,
+        attachments: $.map(objEvent.attachments || [], function( attachment, i ){
+            var attach = DataLayer.get('schedulableToAttachment', attachment, false);
+            //TODO - Verificar na API retorno de id sobre os conceitos em que s?o utilizados tabelas de liga??o
+            if(!attach.name) return(null); 
+            
+            var ext = attach.name.split('.');
+            attach.name = attach.name.length < 10 ?  attach.name : ( ext.length == 1 ? attach.name.substr(0, 10) : (attach.name.substr(0, 6) + '.' +  ext[ext.length -1]));
+            attach.size = formatBytes(attach.size);
+            return attach;
+        }),                     
+        attendee: $.map(objEvent.participants || [], function( participant, i ){                        
+
+            if(delegateAttendee[participant])
+                return(null);
+
+            var attend = DataLayer.get('participant', (participant.id || participant));
+            attend.user = DataLayer.get('user', attend.user);
+
+            statusParticipants[ statusLabels[attend.status] ]++;    
+
+            if(attend.user.mail == User.me.mail)
+                isAttendee = true;
+
+            if( attend.user.id ===  me.id ){
+                participantInfo.user = {
+                    id: attend.id,
+                    status : attend.status,
+                    delegatedFrom: attend.delegatedFrom || '0',
+                    acl: attend.acl,
+                    receiveNotification : attend.receiveNotification,
+                    alarms : $.map(attend.alarms || [], function( alarm ){
+                    var alarm = DataLayer.get('alarm', alarm);
+                    return (alarm == "" ? (null) : alarm);
+                    })
+                };
+                me = attend;
+                return(null);
+            };
+
+            var person = {
+                id: attend.id,
+                name: attend.user.name != 'false' ? attend.user.name : '',
+                mail: attend.user.mail,
+                status : attend.status,
+                isExternal: attend.isExternal,
+                acl: attend.acl,
+                delegatedFrom: attend.delegatedFrom
+            };
+
+            if(!!parseInt(attend.delegatedFrom)){
+                delegatedFrom[attend.delegatedFrom] = DataLayer.copy(person);
+                return(null);
+            }
+
+            if( !!parseInt(attend.isOrganizer)){
+                participantInfo.organizer = DataLayer.copy(person);
+                return(null);
+            };                  
+
+            return (person);
+        }),
+        organizer: participantInfo.organizer || me,
+	isOrganizer: (participantInfo.organizer || me).id == me.id,
+        alarms: !!participantInfo.user ? participantInfo.user.alarms : [],
+        status: !!participantInfo.user ? participantInfo.user.status : 1,
+        isAttendee: isAttendee,
+        me: me,
+        delegatedFrom: delegatedFrom,
+        statusParticipants: (objEvent.sizeAttendees != "") ? objEvent.statusAttendees : statusParticipants,
+        sizeAttendeeLimit: (objEvent.sizeAttendees != "") ? objEvent.sizeAttendees : false
+        };
+    });
+    return (notArray ? res[0] : res);
+    }
+});
+
+function decodeHistoric ( evt ) {
+    var historic = evt.historic;
+    var decoded = [];
+    var attributeDecoded = {
+        'startTime': 'Data de inicio',
+        'endTime' : 'Data de fim',
+        'summary' : 'Título',
+        'description': 'Descrição',
+        'status': 'Status',
+        'percentage': 'Porcentagem',
+        'priority': 'Priorudade',
+        'due' : 'Previsão de término'
+    }
+    
+    var statusDecoded = {
+	1: 'Sem ações',
+	2: 'Em processo',
+	3: 'Finalzada',
+	4: 'Cancelada',
+    }
+
+    var decodeDate = function(time){
+        return new Date( parseInt( time) ).setTimezoneOffset( Timezone.timezone( evt.timezone ) ).toString( User.preferences.dateFormat+' - '+User.preferences.hourFormat );
+    };
+
+    var decodeItem = function(historic){
+        switch(historic.attribute){
+            case 'startTime':
+            case 'endTime' :
+            case 'due':
+                return {
+                    user :$.type(historic.user) == 'object' ? historic.user : DataLayer.get('user', historic.user),
+                    attribute : attributeDecoded[historic.attribute],
+                    beforeValue : decodeDate(historic.beforeValue),
+                    afterValue : decodeDate(historic.afterValue),
+                    time: decodeDate(historic.time)
+                }
+            break;
+            case 'participant':
+                return{
+                    user :$.type(historic.user) == 'object' ? historic.user : DataLayer.get('user', historic.user),
+                    attribute : historic.beforeValue == '' ? ('Novo participante') : ('Rem. participante'),
+                    beforeValue : historic.beforeValue == '' ? '' : historic.beforeValue.mail,
+                    afterValue : historic.afterValue == '' ? '' : historic.afterValue.mail,
+                    time: decodeDate(historic.time)
+                }
+            break;
+            case 'attachment':
+                return{
+                    user : $.type(historic.user) == 'object' ? historic.user : DataLayer.get('user', historic.user),
+                    attribute : historic.beforeValue == '' ? ('Novo anexo') : ('Rem. anexo'),
+                    beforeValue : historic.beforeValue,
+                    afterValue : historic.afterValue,
+                    time: decodeDate(historic.time)
+                }
+            case 'percentage':
+                    return{
+                    user :$.type(historic.user) == 'object' ? historic.user : DataLayer.get('user', historic.user),
+                    attribute :attributeDecoded[historic.attribute],
+                    beforeValue : historic.beforeValue+' %',
+                    afterValue : historic.afterValue+' %',
+                    time: decodeDate(historic.time)
+                }
+	    case 'status':
+                    return{
+                    user :$.type(historic.user) == 'object' ? historic.user : DataLayer.get('user', historic.user),
+                    attribute :attributeDecoded[historic.attribute],
+                    beforeValue : statusDecoded[historic.beforeValue],
+                    afterValue : statusDecoded[historic.afterValue],
+                    time: decodeDate(historic.time)
+                }
+            break;
+            default:
+                return {
+                    user : $.type(historic.user) == 'object' ? historic.user : DataLayer.get('user', historic.user),
+                    attribute : attributeDecoded[historic.attribute],
+                    beforeValue : historic.beforeValue,
+                    afterValue : historic.afterValue,
+                    time: decodeDate(historic.time)
+                }
+            break;
+
+        }
+    }
+
+    for(var i = 0; i < historic.length; i++)
+        decoded.push(decodeItem(historic[i]));
+
+    return decoded;
+
+}
+
+DataLayer.codec( "schedulable", "taskSearch", {
+
+    decoder: function( evtObj ){
+
+    },
+
+    encoder: function( evtObj ){
+
+    var notArray = false;
+      
+    if( notArray = $.type(evtObj) !== "array" )
+        evtObj = [ evtObj ];
+
+    var res = $.map(evtObj, function( objEvent ){           
+            
+        if(!(typeof(objEvent) == 'object'))
+            return (null);
+
+        return {
+            id: objEvent.id,
+            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),
+            allDay: !!parseInt( objEvent.allDay ),
+            percentage: (objEvent.percentage) ? objEvent.percentage : '0',
+			status: objEvent.status
+        }
+    });
+    return (notArray ? res[0] : res);
+    }
+});
+
+DataLayer.codec( "schedulable", "activity", {
+
+    decoder: function( evtObj ){
+    Encoder.EncodeType = "entity";
+    
+    if( notArray = $.type(evtObj) !== "array" )
+        evtObj = [ evtObj ];
+
+    var pref = User.preferences;
+
+    var res = $.map(evtObj, function( form ){
+    
+        var tzId =  form.timezone || Calendar.signatureOf[form.group].calendar.timezone || User.preferences.timezone,
+        formatString = pref.dateFormat + " " + pref.hourFormat;
+
+	var decodeParticipants = function(attend){
+	    return [DataLayer.merge(
+		{  
+		    user: User.me.id, 
+		    isOrganizer: 1,
+		    acl: 'row',
+		    alarms: $.map( form.alarmTime || [], function( alarmTime, i ){
+			if( alarmTime === "" )
+			    return( null );
+			return !!form.alarmId[i] ? {
+			    type: form.alarmType[i], 
+			    unit: form.alarmUnit[i], 
+			    time: form.alarmTime[i], 
+			    id: form.alarmId[i]
+			    }:
+
+			    {
+			    type: form.alarmType[i],
+			    unit: form.alarmUnit[i], 
+			    time: form.alarmTime[i]
+			    };
+		    })
+		}, attend != '0' ? {id: attend} : {})];
+	};
+
+        return DataLayer.merge({
+        "class": form["class"],
+        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) ,
+        due: (form.dueDate == '' )? 0 : Date.parseExact(form.dueDate + " "+$.trim(form.dueHour) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'),
+        allDay: ( !!form.allDay ? 1 : 0 ),      
+        status: form.activityStatus,      
+        id: form.idActivity,
+        type: !!form.type ?  form.type : 2,
+        percentage: form.percentage,
+        priority: form.priority,
+        category: form.category,
+        summary: form.summary == '' ? 'Atividade sem título' : form.summary,
+        description: form.description,
+        timezone: tzId,
+        attachments: $.map(form.attachment || [], function( attachment, i ){
+            return {
+            attachment: attachment
+            }
+        }),
+        participants: decodeParticipants(form.idAttendee),
+        taskToActivity:$.map( form.idtask || [], function( task, i ){
+
+            return DataLayer.merge({
+                task: task,
+                owner: User.me.id
+            }, form.idTaskToActivity[i] != '' ? {id: form.idTaskToActivity[i]} : {});
+
+        })
+        }, form.lastGroup ? (( form.lastGroup == form.group ) ? {} : {calendar: form.group, lastGroup: form.lastGroup}) : {calendar: form.group});
+    });
+
+    return notArray ? res[0] : res;
+    },
+
+    encoder: function( evtObj ){
+
+    var notArray = false;
+      
+    if( notArray = $.type(evtObj) !== "array" )
+        evtObj = [ evtObj ];
+    
+    var res = $.map(evtObj, function( objEvent ){           
+            
+        if(!(typeof(objEvent) == 'object'))
+            return (null);
+	
+	var historic = [];
+
+        var decodeTasks = function(obj){
+
+            var tasks = {}, task = {};
+
+            for(var i =0; i < obj.taskToActivity.length; i++){
+
+                taskToActivity = DataLayer.get('taskToActivity', obj.taskToActivity[i]); 
+                task = taskToActivity.task;
+
+                if($.type(task) != 'object')
+                    task = DataLayer.get('schedulable', task);
+
+                tasks[task.id] = {
+                    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),
+		    status: task.status,
+		    percentage: task.percentage
+                }
+
+                tasks[task.id].description = tasks[task.id].startDate + ' - ' + (!!task.summary ? task.summary : task.description);
+
+		historic.push({'task': (!!task.summary ? task.summary : task.description) , 'historic': decodeHistoric(task)});
+            }
+
+            tasks.length = obj.taskToActivity.length;
+            return tasks;
+
+        };
+
+        return {
+        "class": objEvent["class"],
+        id: objEvent.id,
+        location: objEvent.location,
+        category: objEvent.category,
+        activityStatus: objEvent.status,
+        groups: Calendar.groups,
+        group: objEvent.group ? objEvent.group : objEvent.calendar,
+        summary: objEvent.summary,
+        type: !!objEvent.type ? objEvent.type : 2,
+        description: objEvent.description,
+        timezone: objEvent.timezone,
+        timezones: Timezone.timezones,
+        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),
+        allDay: !!parseInt( objEvent.allDay ),
+        historic: historic,
+        tasks: objEvent.taskToActivity ? decodeTasks(objEvent) : {},
+        attachments: $.map(objEvent.attachments || [], function( attachment, i ){
+            var attach = DataLayer.get('schedulableToAttachment', attachment, false);
+            //TODO - Verificar na API retorno de id sobre os conceitos em que s?o utilizados tabelas de liga??o
+            if(!attach.name) return(null); 
+            
+            var ext = attach.name.split('.');
+            attach.name = attach.name.length < 10 ?  attach.name : ( ext.length == 1 ? attach.name.substr(0, 10) : (attach.name.substr(0, 6) + '.' +  ext[ext.length -1]));
+            attach.size = formatBytes(attach.size);
+            return attach;
+        }),
+        me : User.me,
+        attendee: $.map(objEvent.participants || [], function( participant, i ){                        
+
+            var attend = DataLayer.get('participant', (participant.id || participant));
+            attend.user = DataLayer.get('user', attend.user);
+
+            return {
+                id: attend.id,
+                alarms : $.map(attend.alarms || [], function( alarm ){
+                    var alarm = DataLayer.get('alarm', alarm);
+                    return (alarm == "" ? (null) : alarm);
+                })
+            };
+        })
+
+        };
+    });
+    return (notArray ? res[0] : res);
+    }
+});
 
 function decodeOwnerCalendar(calendar){
@@ -727,6 +1329,7 @@
 		id: form.idEvent,
 		location: form.location,
+		type: 1,
 		category: form.category,
-		summary: form.summary,
+		summary: form.summary == '' ? 'Evento sem título' : form.summary,
 		description: form.description,
 		timezone: tzId,
@@ -800,6 +1403,9 @@
 
 	var pref = User.preferences;
-
-	var res =  DataLayer.encode('schedulable:preview', evtObj);
+    var res = [];
+
+    for(var i = 0; i < evtObj.length; i++){
+	   res.push(DataLayer.encode('schedulable:' + (evtObj[i].type == '1' ?  'preview' : ( !!evtObj[i].taskToActivity ? 'activity': 'task')) , evtObj[i]));
+    }
 
 	if( !notArray ){
@@ -814,4 +1420,6 @@
 
 	    for (var i=0; i < res.length; i++) {
+
+        res[i].type = (res[i].type == '2' && !!res[i].tasks) ? '3' : res[i].type;
 			  
 		var startDate = Date.parseExact( res[i]['startDate'], User.preferences.dateFormat );
@@ -836,9 +1444,7 @@
 			'endDate': new Date( occurrences[ii] + duration ).toString( User.preferences.dateFormat )
 			} );
-				  
-				  
-				  
-				  
-		    res2.repeat = typeRepeat[res[i].repeat.frequency];
+
+		    if(res[i].repeat)
+                res2.repeat = typeRepeat[res[i].repeat.frequency];
 				  
 		    while (counter.compareTo( currentDate ) == 0) {
@@ -864,4 +1470,101 @@
 
 	return notArray ? res[0] : res;
+    }
+
+});
+
+
+DataLayer.codec( "schedulable", "print", {
+
+    decoder: function( evtObj ){
+
+    },
+
+
+    encoder: function( evtObj ){
+    
+    if(!(!!evtObj))
+        evtObj = [];
+
+    var notArray = false;
+          
+    if( notArray = $.type(evtObj) !== "array" )
+        evtObj = [ evtObj ];
+
+    var pref = User.preferences;
+    var res = [];
+
+    for(var i = 0; i < evtObj.length; i++){
+       res.push(DataLayer.encode('schedulable:' + (evtObj[i].type == '1' ?  'preview' : 'task'), evtObj[i]));
+    }
+
+    if( !notArray ){
+        var dates = {};
+
+        var typeRepeat = {
+        'none': false, 
+        'daily': 'Repetição diária',
+        'weekly': 'Repetição semanal',
+        'monthly': 'Repetição mensal',
+        'yearly': 'repetição anual'
+        }
+
+        for (var i=0; i < res.length; i++) {
+            var startDate = Date.parseExact( res[i]['startDate'], User.preferences.dateFormat );
+            var endDate   = Date.parseExact( res[i]['endDate'], User.preferences.dateFormat );
+                  
+            var duration = parseInt( endDate.getTime() ) - parseInt( startDate.getTime() );
+            
+            var occurrences = [ startDate.getTime() ];
+                    
+            if( res[i].occurrences )
+            {
+                occurrences = res[i].occurrences;
+            }
+
+            for( var ii = 0; ii < occurrences.length; ii++ )
+            {
+                var currentDate = new Date( occurrences[ii] );
+                var counter = currentDate.clone();
+                        
+                var res2 = $.extend( {}, res[i], {
+                    'startDate': currentDate.toString( User.preferences.dateFormat ), 
+                    'endDate': new Date( occurrences[ii] + duration ).toString( User.preferences.dateFormat )
+                });
+
+                if(res[i].repeat)
+                    res2.repeat = typeRepeat[res[i].repeat.frequency];
+                      
+                var index = dateCalendar.dayNames[counter.getDay()] +' '+counter.toString('dd/MM');
+
+                if(!dates[index] || !$.isArray(dates[index].events))
+                    dates[index] = {events:  []};                    
+
+				res2['isOneDay'] = res2.startDate == res2.endDate ? true : false;
+
+                dates[index].events.push(res2);
+                  
+            }
+        }
+
+        var calendarView = $('#calendar').fullCalendar('getView');
+        var start = calendarView.start.getTime();
+        var end = (calendarView.end.getTime() - (calendarView.name == 'month' ? 86400000 : 0 ));
+        var next = start;
+        var response = [];
+
+        while (next){
+            var index = dateCalendar.dayNames[new Date(next).getDay()] +' '+ new Date(next).toString('dd/MM');
+            
+            var event = {};
+            event[index] = {events: dates[index] ? dates[index].events : false};
+
+            response[response.length] = event;
+            next = (next + 86400000) > end ? false : (next + 86400000);
+        }
+        res = {events: response};
+    }
+
+    return notArray ? res[0] : res;
     }
 
@@ -952,5 +1655,6 @@
 			attendee = DataLayer.get('participant', evt.participants[i]);
 			if(attendee.user == User.me.id)
-			    return (attendee.acl.indexOf('w') >= 0 || attendee.acl.indexOf('o') >= 0 ) ? {
+					    return (attendee.acl.indexOf('w') >= 0 || attendee.acl.indexOf('o') >= 0 ) ? 
+						{
 				selectable: true, 
 				className: 'fullcalendar-context-menu  event-id-'+idEvent+' calendar-id-'+calendar.id+ (isRecurrence ? ' isRecurrence Recurrence-id-'+Recurrence : '')
@@ -978,17 +1682,18 @@
 			return returns;
 		    }				
-		    return DataLayer.merge({
+		    return DataLayer.merge(
+			{
 			editable: aclSignature.acl['write'] && !isRecurrence,
 			disableResizing : (((aclSignature.acl['busy'] && !aclSignature.acl['write']) || (!aclSignature.acl['write'] && aclSignature.acl['read'])) ? true : false),
 			disableDragging  : (((aclSignature.acl['busy'] && !aclSignature.acl['write']) || (!aclSignature.acl['write'] && aclSignature.acl['read'])) ? true: false),
 			className: mountClass(aclSignature.acl)
-		    }, aclSignature.acl['busy'] ? {
-			title: 'Ocupado', 
-			selectable: false
-		    } : {
-			selectable: true
-		    });
+			}, aclSignature.acl['busy'] ? 
+			{
+			    title: 'Ocupado', 
+			    selectable: false
+			} : {
+			    selectable: true
+			});	
 		}
-			
 	    }
 		
@@ -1005,16 +1710,21 @@
 
 	    //occurrences = DataLayer.unique( occurrences ).sort();
-		  
-	    for( var i = 0; i < occurrences.length; i++ )
-		grouped[ evt.calendar ].push( DataLayer.merge({
-		    id: evt.URI || evt.id+ '-' + i,
-		    title: Encoder.htmlDecode(evt.summary),
-		    start: Timezone.getDateCalendar(new Date( parseInt( occurrences[i] ) ), calendar.timezone,  !!evt.DayLigth ? evt.DayLigth.calendar.startTime : Timezone.daylightSaving),
-		    end:   Timezone.getDateCalendar(new Date( parseInt( occurrences[i] ) + duration - (!!parseInt(evt.allDay) ? 86400000 : 0)), calendar.timezone, !!evt.DayLigth ? evt.DayLigth.calendar.startTime : Timezone.daylightSaving),
-		    allDay: parseInt( evt.allDay ),
-		    isRepeat: isRepeat,
-		    occurrence: i,
-		    calendar: evt.calendar
-		    }, eventEditable(evt.id, isRepeat, i ) ) );
+		var typeEvent;  
+	    for( var i = 0; i < occurrences.length; i++ ){
+
+            typeEvent = (evt.type == 2 && evt.taskToActivity ? 3 : evt.type)
+    		grouped[ evt.calendar ].push( DataLayer.merge(
+    		{
+    		    id: evt.URI || evt.id+ '-' + i,
+    		    title: Encoder.htmlDecode(evt.summary),
+    		    start: Timezone.getDateCalendar(new Date( parseInt( occurrences[i] ) ), calendar.timezone,  !!evt.DayLigth ? evt.DayLigth.calendar.startTime : Timezone.daylightSaving),
+    		    end:   Timezone.getDateCalendar(new Date( parseInt( occurrences[i] ) + duration - (!!parseInt(evt.allDay) ? 86400000 : 0)), calendar.timezone, !!evt.DayLigth ? evt.DayLigth.calendar.startTime : Timezone.daylightSaving),
+    		    allDay: parseInt( evt.allDay ),
+    		    isRepeat: isRepeat,
+    		    occurrence: i,
+    		    type: typeEvent,
+    		    calendar: evt.calendar
+    		    }, (parseInt(typeEvent) == 1 ? eventEditable(evt.id, isRepeat, i ) : (parseInt(typeEvent) == 2 ? {editable: true, disableResizing: false, disableDragging: false} : {editable: false, disableResizing: true, disableDragging: true}) )) );
+        }
 	});
 
@@ -1049,5 +1759,5 @@
 			    ]
 			],
-			['IN', 'calendar',  Calendar.calendarIds]
+			['IN', 'calendar',  $.merge( Calendar.calendarIds, Calendar.groupIds )]
 		], 
 	    criteria: {
Index: trunk/prototype/modules/calendar/js/calendar.shared.js
===================================================================
--- trunk/prototype/modules/calendar/js/calendar.shared.js	(revision 6992)
+++ trunk/prototype/modules/calendar/js/calendar.shared.js	(revision 6996)
@@ -1,5 +1,6 @@
 function show_modal_shared(calendarId){
-
-	var html = DataLayer.render('templates/shared_calendar.ejs', {
+    $('.qtip.qtip-blue').remove();
+
+    var html = DataLayer.render('templates/shared_calendar.ejs', {
 	calendar: Calendar.calendars,
 	signature : Calendar.signatures
@@ -337,4 +338,5 @@
 
 function show_modal_search_shared(){
+    $('.qtip.qtip-blue').remove();
 
     var html = DataLayer.render('templates/shared_calendar.ejs', {});	
Index: trunk/prototype/modules/calendar/js/load.js
===================================================================
--- trunk/prototype/modules/calendar/js/load.js	(revision 6444)
+++ trunk/prototype/modules/calendar/js/load.js	(revision 6996)
@@ -1,4 +1,4 @@
 Refresh = {
-    //Tempo em que apÃ³s a ultima sincronizaÃ§Ã£o serÃ¡ verificado atualizaÃ§Ãµes
+    //Tempo em que após a ultima sincronização será verificado atualizações
     timeRefresh : 180,
     clookRefresh: false,
@@ -8,5 +8,5 @@
 	delete DataLayer.tasks[this.clookRefresh];
 	
-	//Realiza agendamentos de atualizaÃ§Ã£o de view somente se o mÃ³dulo aberto for expressoCalendar
+	//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);
@@ -54,10 +54,14 @@
     }
 
-    this.calendarIds = [], this.signatureOf = {}, this.calendars = [], this.calendarOf= {};
+    this.calendarIds = [], this.groupIds = [], this.signatureOf = {}, this.calendars = [], this.groups = [], this.calendarOf = {}, this.groupOf= {};
 
     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];
+
+        if(this.signatures[i].calendar.type == '1')
+           this.signatureOf[ this.groupIds[this.groupIds.length] = ( this.groups[ this.groups.length ] = this.groupOf[ this.signatures[i].id ] = this.signatures[i].calendar ).id ] = this.signatures[i];
+        else
+    	   this.signatureOf[ this.calendarIds[ this.calendarIds.length] = ( this.calendars[ this.calendars.length ] = this.calendarOf[ this.signatures[i].id ] = this.signatures[i].calendar ).id ] = this.signatures[i];
     }
 
@@ -67,5 +71,5 @@
 
     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
+        //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){
@@ -89,37 +93,9 @@
                 contentMenu();
             }else if((typeof($tabs) != "undefined") && $tabs.tabs('option' ,'selected') != 0)
-                pageselectCallback($('.events-list-win.active [name=keyword]').val(), 0);
+				
+                pageselectCallback($('.events-list-win.active [name=keyword]').val(), 0, false, ($tabs.tabs('option' ,'selected') > 2) ? 2 : ($tabs.tabs('option' ,'selected') == 1) ? 0 : 1);
         }
     }
 }
 
-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) {}
-		    });
-		});
-	    });
-	}
-    }
-}
-
 Calendar.load();
-Alarms.load();
Index: trunk/prototype/modules/calendar/js/calendar.alarms.js
===================================================================
--- trunk/prototype/modules/calendar/js/calendar.alarms.js	(revision 6996)
+++ trunk/prototype/modules/calendar/js/calendar.alarms.js	(revision 6996)
@@ -0,0 +1,52 @@
+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 ){
+
+		if(!activePage && useDesktopNotification() && desktopNotification.verifyComplement()){
+
+		    desktopNotification.sentNotification(
+			'../expressoCalendar/templates/default/images/navbar.png',
+			'Você possui um compromisso agendado:', 
+			eventDay.event_start + ' ' + eventDay.schedulable.startTime + ' - ' + eventDay.schedulable.summary
+			);
+
+		/* TODO
+		    var onClose = function(){
+			if(window.location.pathname.indexoOf('expressoCalendar') >= 0)
+			    window.location = url_host + '/expressoCalendar';
+		    };
+		*/
+		    desktopNotification.showNotification(false, function(){
+				window.focus();
+				this.cancel();
+			});
+
+		}else{
+
+		    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) {}
+			});
+		    });
+		}
+
+	    });
+	}
+    }
+}
+Alarms.load();
Index: trunk/prototype/modules/calendar/js/activity.helpers.js
===================================================================
--- trunk/prototype/modules/calendar/js/activity.helpers.js	(revision 6996)
+++ trunk/prototype/modules/calendar/js/activity.helpers.js	(revision 6996)
@@ -0,0 +1,654 @@
+function activityDetails( objActivity, decoded, path, isMail, repeat){
+
+    tasks = {length: 0};
+	
+    if(path == undefined)
+	path = "";
+		
+    if( !decoded )
+	objActivity = DataLayer.decode( "schedulable:group", objActivity );
+
+    if(!isMail)
+	objActivity = DataLayer.encode( "schedulable:activity", objActivity );
+
+    /**
+    * canDiscardActivityDialog deve ser true se não houver alterações no evento
+    */
+    canDiscardActivityDialog = true;
+    /**
+	 * zebraDiscardActivityDialog é uma flag indicando que uma janela de confirmação (Zebra_Dialog)
+	 * já está aberta na tela, uma vez que não é possivel acessar o evento ESC utilizado para fechá-la
+	 */
+    zebraDiscardActivityDialog = false;
+	
+	var html = DataLayer.render( path+'templates/activity_add.ejs', {
+	    activity:objActivity
+	});	
+			
+	if (!UI.dialogs.addActivity) {
+
+	    UI.dialogs.addActivity = jQuery('#sandbox').append('<div title="Criar Atividade" class="new-activity-win active"> <div>').find('.new-activity-win.active').html(html).dialog({
+    		resizable: false, 
+    		modal:true, 
+    		autoOpen: false,
+    		width:735, 
+    		position: 'center', 
+    		close: function(event, ui) {
+    			/**
+    			 * Remove tooltip possivelmente existente
+    			 */
+    			if ($('.qtip.qtip-blue.qtip-active').length)
+    				$('.qtip.qtip-blue.qtip-active').qtip('destroy');						
+    			
+                attendees  = {};
+    		},
+    		beforeClose: function(event, ui) {
+    		
+    		    if (!canDiscardActivityDialog && !zebraDiscardActivityDialog) {
+        			zebraDiscardActivityDialog = true;
+        			window.setTimeout(function() {
+        			    $.Zebra_Dialog('Suas alterações na atividade não foram salvas. Deseja descartar as alterações?', {
+        				'type':     'question',
+        				'overlay_opacity': '0.5',
+        				'buttons':  ['Descartar alterações', 'Continuar editando'],
+        				'onClose':  function(clicked) {
+        				    if(clicked == 'Descartar alterações') {
+            					canDiscardActivityDialog = true;
+            					/**
+            					*Remoção dos anexos do eventos caso seja cancelado a edição
+            					*/
+            					DataLayer.rollback();
+
+            					var ids = false;
+            					$.each($('.attachment-list input'), function (i, input) {
+            					    DataLayer.put('attachment', {id: ''+input.value});
+            					    DataLayer.remove('attachment', ''+input.value);
+            						ids = true;
+            					});
+            					if(ids)
+            						DataLayer.commit();
+
+            					UI.dialogs.addActivity.dialog('close');
+        				    }else{
+        					   zebraDiscardActivityDialog = false;
+        				    }
+        										
+        				    /**
+        				    * Uma vez aberta uma janela de confirmação (Zebra_Dialog), ao fechá-la
+        				    * com ESC, para que o evento ESC não seja propagado para fechamento da
+        				    * janela de edição de eventos, deve ser setada uma flag indicando que
+        				    * já existe uma janela de confirmação aberta.
+        				    */
+        				    if (!clicked) {
+            					window.setTimeout(function() {
+            					    zebraDiscardActivityDialog = false;
+            					}, 200);
+        				    }
+        				}
+        		    });
+        								
+        		}, 300);
+    	    }
+    	    //DataLayer.rollback();
+    	    return canDiscardActivityDialog;
+    	},
+    	dragStart: function(event, ui) {
+	    if ($('.qtip.qtip-blue.qtip-active').length)
+		$('.qtip.qtip-blue.qtip-active').qtip('destroy');
+       }
+    });
+				
+	} else {
+	    UI.dialogs.addActivity.html(html);
+	}
+
+/* Checkbox allday */
+UI.dialogs.addActivity.find('input[name="allDay"]').click(function(){
+    $(this).attr("checked") ? 
+    UI.dialogs.addActivity.find('.start-time, .end-time').addClass('hidden') :
+    UI.dialogs.addActivity.find('.start-time, .end-time').removeClass('hidden'); 
+});
+		
+var tabs = UI.dialogs.addActivity.children('.content').tabs({
+	select: function(event, ui) { 
+		if ($('.qtip.qtip-blue.qtip-active').length)
+			$('.qtip.qtip-blue.qtip-active').qtip('destroy');
+	}	
+	});
+
+var group = DataLayer.get('calendar', objActivity.group);
+				
+if (group.timezone != objActivity.timezone){
+    UI.dialogs.addActivity.find('.group_addactivity_details_lnk_timezone').find('option[value="'+objActivity.timezone+'"]').attr('selected','selected').trigger('change');
+    UI.dialogs.addActivity.find('.group_addactivity_details_lnk_timezone').addClass('hidden');
+    $('.group-addevent-details-txt-timezone').removeClass('hidden');
+			
+}
+
+UI.dialogs.addActivity.find('.group_addactivity_details_lnk_timezone').click(function(e){
+    $(this).addClass('hidden');
+    $('.group-addactivity-details-txt-timezone').removeClass('hidden');
+    e.preventDefault();
+});
+
+UI.dialogs.addActivity.find('.button.remove').button({
+    text:false, 
+    icons:{
+	primary:'ui-icon-close'
+    }
+}).click(function(el){
+    var id;
+    if( id = $(this).parent().find('input[name="alarmId[]"]').val())
+	DataLayer.remove('alarm', id);
+    $(this).parent().remove().find('li').is(':empty');
+});
+
+UI.dialogs.addActivity.find('.button-add-alarms').click(function(){
+            DataLayer.render( 'templates/alarms_add_itemlist.ejs', {type: 0}, function( template ){                     
+            jQuery('.activity-alarms-list').append(template)
+            .find('li:last label:eq(0)').remove().end()
+            .find('.number').numeric().end()
+            .find('.button.remove').button({
+                text:false, 
+                icons:{
+                    primary:'ui-icon-close'
+                }
+            }).click(function(el) {
+                $(this).parent().remove();
+            });    
+            });
+        });
+
+/*Seleciona a agenda padrão para visualização/edição de um evento*/
+if(objActivity.id)
+    UI.dialogs.addActivity.find('select[name="group"] option[value="'+objActivity.group+'"]').attr('selected','selected').trigger('change');
+
+UI.dialogs.addActivity.find('.button').button();
+    UI.dialogs.addActivity.find('.button.add').button({
+        icons: {
+    	   secondary: "ui-icon-plus"
+        }
+});
+
+todoStatus('addActivity', (objActivity.activityStatus != undefined) ? objActivity.activityStatus : 1);
+
+UI.dialogs.addActivity.find('select[name="activityStatus"]').attr('disabled', 'disabled');
+
+// ==== validation events ====
+UI.dialogs.addActivity.find(".input-group .h1").Watermark("Atividade sem título");
+
+UI.dialogs.addActivity.find(".number").numeric();
+
+User.preferences.dateFormat.indexOf('-') > 0 ? 
+UI.dialogs.addActivity.find(".date").mask("99-99-9999", {
+    completed:function(){
+	updateMap();
+    }
+}) : 
+
+UI.dialogs.addActivity.find(".date").mask("99/99/9999", {
+    completed:function(){
+	updateMap();
+    }
+});
+
+UI.dialogs.addActivity.find(".menu-addactivity")
+.children(".delete").click(function(){
+    $.Zebra_Dialog('Tem certeza que deseja excluir a atividade?', {
+	'type':     'question',
+	'overlay_opacity': '0.5',
+	'buttons':  ['Sim', 'Não'],
+	'onClose':  function(clicked) {
+	    if(clicked == 'Sim'){
+		canDiscardActivityDialog = true;
+		/* Remove por filtro */
+		DataLayer.removeFilter('schedulable', {filter: ['AND', ['=', 'id', objActivity.id], ['=', 'calendar', objActivity.group], ['=','user',(objActivity.me.user ? objActivity.me.user.id : objActivity.me.id)], ['=', 'type', '2']]});
+		Calendar.rerenderView(true);
+		/********************/
+		UI.dialogs.addActivity.dialog("close");
+	    }
+	}
+    });
+}).end()
+	    
+.children(".cancel").click(function(){
+    UI.dialogs.addActivity.dialog("close");
+}).end()
+	    
+.children(".save").click(function(){
+    /* Validação 
+    var msg = false;			
+    if(msg = validDateEvent()){
+    	$(".new-activity-win.active").find('.messages-validation').removeClass('hidden').find('.message label').html(msg); 
+    	return false;
+    }
+    */
+	UI.dialogs.addActivity.find('select[name="activityStatus"]').removeAttr('disabled');
+    canDiscardActivityDialog = true;
+			
+	UI.dialogs.addActivity.children().find('form.form-addactivity').submit();
+	UI.dialogs.addActivity.dialog("close");
+
+}).end()
+		
+.children(".export").click(function(){
+    UI.dialogs.addActivity.children().find(".form-export").submit();
+});
+
+var task_activityHtml = DataLayer.render( path+'templates/task_activity_add.ejs', {	activity: objActivity});
+var blkAddTask = UI.dialogs.addActivity.find('#group_addactivity_details8').append(task_activityHtml);
+
+var dates = UI.dialogs.addActivity.find('input.date').datepicker({
+    dateFormat: User.preferences.dateFormat.replace(/M/g, 'm').replace(/yyyy/g, 'yy'),
+    onSelect : function( selectedDate ){
+	updateMap();
+    }
+});
+
+blkAddTask.find('.add-activity-search .ui-icon-search').click(function(event) {
+    blkAddTask.find('.add-activity-search input').keydown();
+});
+			
+			
+blkAddTask.find('.add-activity-search input').keydown(function(event) {
+
+    if(event.keyCode == '13' || typeof(event.keyCode) == 'undefined') {	
+    // Fazer get das tarefas	
+	var filter = 
+        {
+            filter: 
+                ['AND',
+                    ['=', 'type', '2'], 
+                    ['>=','startTime', $.now()], 
+                    ['in', 'calendar', 
+                        [$('div.new-activity-win.active select[name="groupFilter"]').val()]
+                    ]
+                ], criteria: {'filterTasks': true}
+        };
+    if($(this).val() != ''){
+        filter['filter'].push(['OR',
+                            ["i*", "summary", $(this).val()], 
+                            ["i*", "description", $(this).val()]
+                           ]);
+    }
+
+    var result = DataLayer.get('schedulable:taskSearch', filter, true)
+	/**
+	* TODO: trocar por template
+	*/
+	blkAddTask.find('ul.search-result-list').empty().css('overflow', 'hidden');
+	if (!result) {
+	    blkAddTask.find('ul.search-result-list').append('<li><label class="empty">Nenhum resultado encontrado.</label></li>');
+	}else{
+    	for(i=0; i<result.length; i++)
+    	    result[i].enabled = (blkAddTask.find('dd.task-activity-list ul.task-activity-list input[value="' +  result[i].id + '"]').length) ? false : true;
+    											
+    	blkAddTask.find('ul.search-result-list').append(DataLayer.render( path+'templates/task_search_itemlist.ejs', result));
+
+        /* TODO - Verificar id da aitividade*/
+    	blkAddTask.find('ul.search-result-list li').click(function(event, ui){
+    	    if ($(event.target).is('input')) {
+                old_item = $(event.target).parents('li');
+
+                tasks[old_item.find('[name="id"]').val()] = {
+                    startDate: old_item.find('[name="taskStartDate"]').val(),
+                    startHour: old_item.find('[name="taskStartHour"]').val(),
+                    endDate: old_item.find('[name="taskEndDate"]').val(),
+                    endHour: old_item.find('[name="taskEndHour"]').val(),
+                    dueDate: old_item.find('[name="taskDueDate"]').val(),
+                    dueTime: old_item.find('[name="taskDueTime"]').val(),
+                    allDay: old_item.find('[name="taskAllDay"]').val(),
+                    percentage: old_item.find('[name="taskPercentage"]').val(),
+                    status: old_item.find('[name="taskStatus"]').val()
+                };
+
+                tasks.length += 1;
+        							
+		blkAddTask.find('dd.task-activity-list ul.task-activity-list')
+		    .append(DataLayer.render(path+'templates/task_add_itemlist.ejs', [{
+			idTask: old_item.find('[name="id"]').val(),
+        		    description: old_item.find('.description').html(),
+			    isWrite: false
+			}]))
+        		.scrollTo('max');
+		callbackTask();
+                registerStatus();
+                blkAddTask.find('.not-activity').addClass('hidden');
+                old_item.remove();
+    	    }
+    	});
+    }
+    event.preventDefault();
+    }
+});
+
+/*Carrega as tarefas já existentes em uma atividade*/
+if(objActivity.tasks.length){
+    tasks = objActivity.tasks;
+
+    for(var i in objActivity.tasks){
+        if(i != 'length')
+            blkAddTask.find('dd.task-activity-list ul.task-activity-list')
+                .append(DataLayer.render(path+'templates/task_add_itemlist.ejs', [{
+                    idTask: i,
+                    description: tasks[i].description,
+                    idTaskToActivity: tasks[i].taskToActivity,
+		    isWrite: true
+                 }]))
+            .scrollTo('max');
+    }
+
+    callbackTask();
+    registerStatus();
+    blkAddTask.find('.not-activity').addClass('hidden');
+}
+
+UI.dialogs.addActivity.find('.row.fileupload-buttonbar-activity .button').filter('.delete').button({
+    icons: {
+	   primary: "ui-icon-close"
+    },
+    text: 'Excluir'
+}).click(function () {
+    $.Zebra_Dialog('Tem certeza que deseja excluir todos anexos?', {
+	'type':     'question',
+	'overlay_opacity': '0.5',
+	'buttons':  ['Sim', 'Não'],
+	'onClose':  function(clicked) {
+	    if(clicked == 'Sim'){
+		
+                var ids = [];
+                $.each($('.attachment-list input'), function (i, input) {
+                     DataLayer.remove('schedulableToAttachment', {
+                        filter: ['=', 'id', ''+input.value]
+                        });
+                });
+                $('div.new-activity-win .attachment-list input').remove();
+                $('div.new-activity-win .row.fileupload-buttonbar-activity .attachments-list p').remove();
+		$('div.new-activity-win .btn-danger.delete').addClass('hidden');
+            }
+        }});
+}).end()
+.filter('.close').button({
+    icons: {
+	   primary: "ui-icon-close"
+    },
+    text: false
+}).click(function () {
+    DataLayer.remove('schedulableToAttachment', $(this).parents('p').find('input[name="fileId[]"]').val());
+    $(this).parents('p').remove();
+}).end()
+.filter('.downlaod-archive').button({
+    icons: {
+	   primary: "ui-icon-arrowthickstop-1-s"
+    },
+    text: false
+});
+
+extendsFileupload('activity', path);
+
+UI.dialogs.addActivity.find(':input').change(function(event){
+    if (event.keyCode != '27' && event.keyCode != '13')
+	canDiscardActivityDialog = false;
+}).keydown(function(event){
+    if (event.keyCode != '27' && event.keyCode != '13')
+	canDiscardActivityDialog = false;
+});
+
+UI.dialogs.addActivity.dialog('open');
+}
+
+function refreshTaskActivity(){
+    updateActivity = false;
+
+    var objActivity = DataLayer.get('schedulable:activity', UI.dialogs.addActivity.find('input[name="idActivity"]').val());
+    var blkAddTask = UI.dialogs.addActivity.find('#group_addactivity_details8');
+    var blkAuto = UI.dialogs.addActivity.find('#group_addactivity_details1');
+    
+   tasks = objActivity.tasks;
+   blkAddTask.find('dd.task-activity-list ul.task-activity-list').html('');
+   
+   for(var i in tasks)
+       DataLayer.remove('schedulable', i, false);
+
+    for(var i in objActivity.tasks){
+        if(i != 'length')
+            blkAddTask.find('dd.task-activity-list ul.task-activity-list')
+                .append(DataLayer.render('templates/task_add_itemlist.ejs', [{
+                    idTask: i,
+                    description: tasks[i].description,
+                    idTaskToActivity: tasks[i].taskToActivity,
+		    isWrite: true
+                 }]))
+            .scrollTo('max');
+    }
+
+    callbackTask(blkAddTask);
+    registerStatus(blkAuto);
+}
+
+function registerStatus(blkAuto){
+    if(!blkAuto)
+	blkAuto = UI.dialogs.addActivity.find('#group_addactivity_details1');
+
+    var startDate = false;
+    var endDate = new Date;
+    var dueDate = new Date;
+    var percentage = 0;		
+	    var statusTasks = {1: 0, 2: 0, 3: 0, 4: 0};
+	    var allDay = true;
+
+    var formatString =  User.preferences.dateFormat + " " +  User.preferences.hourFormat;
+
+    if(tasks.length == 0){
+
+	startDate = new Date();
+	var configData = (startDate.toString('mm') < 30)  ? {minutes: (30 - parseInt(startDate.toString('mm')))} : {hours: 1, minutes: '-'+startDate.toString('mm')};
+	startDate.add(configData); 
+
+	endDate = new Date(dateCalendar.decodeRange(startDate, (!!User.preferences.defaultCalendar ? (   !!Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration ?  (Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration) : (User.preferences.defaultDuration)) : (User.preferences.defaultDuration))));
+
+	blkAuto.find('input[name="startDate"]').val(startDate.toString(User.preferences.dateFormat ));
+	blkAuto.find('input[name="startHour"]').val(startDate.toString(User.preferences.hourFormat ));
+
+	blkAuto.find('input[name="endDate"]').val(endDate.toString(User.preferences.dateFormat ));
+	blkAuto.find('input[name="endHour"]').val(endDate.toString(User.preferences.hourFormat ));
+
+	blkAuto.find('input[name="dueDate"]').val('');
+	blkAuto.find('input[name="dueHour"]').val('');
+
+	blkAuto.find('input[name="percentage"]').val(percentage);
+
+	todoStatus('addActivity', 1);
+
+	UI.dialogs.addActivity.find('select[name="activityStatus"] option[value="'+1+'"]').attr('selected','selected');
+
+	blkAuto.find('input[name="allDay"]').attr('checked', false);
+
+	return true;
+    }
+
+    for (var i in tasks){
+
+	if(i == 'length')
+	    continue;
+
+	statusTasks[tasks[i].status]++;
+
+	var stTime = Date.parseExact( tasks[i].startDate + " "+$.trim( tasks[i].startHour) , formatString);
+	var enTime = Date.parseExact( tasks[i].endDate + " "+$.trim( tasks[i].endHour), formatString );
+
+	startDate = (startDate && startDate.compareTo(stTime) == -1) ? startDate : stTime;
+	endDate = endDate.compareTo(enTime) == -1 ? enTime : endDate;
+
+	if(tasks[i].dueDate != ''){
+	    var pvTime = Date.parseExact( tasks[i].dueDate + " "+$.trim( tasks[i].dueTime), formatString );
+	    dueDate = dueDate.compareTo(pvTime) == -1 ? pvTime : dueDate;
+	}
+
+	if(parseInt(tasks[i].percentage) > 0)
+	    percentage += parseInt(parseInt((100 / tasks.length)) * ( parseInt(tasks[i].percentage) / 100));
+    }
+    var statusActivity = 1;
+
+    if(statusTasks[4] != 0)
+	statusActivity = 4;
+    else if(statusTasks[2] != 0)
+	statusActivity = 2;
+    else if(statusTasks[3] == tasks.length)
+	statusActivity = 3;
+    else if(statusTasks[1] == tasks.length)
+	statusActivity = 1;
+    else
+	statusActivity = 2;			
+
+    todoStatus('addActivity', statusActivity);
+
+    UI.dialogs.addActivity.find('select[name="activityStatus"] option[value="'+statusActivity+'"]').attr('selected','selected');
+
+    dueDate = dueDate.compareTo(endDate) == -1 ? endDate : dueDate;
+
+    blkAuto.find('input[name="startDate"]').val(startDate.toString(User.preferences.dateFormat ));
+    blkAuto.find('input[name="startHour"]').val(startDate.toString(User.preferences.hourFormat ));
+
+    blkAuto.find('input[name="endDate"]').val(endDate.toString(User.preferences.dateFormat ));
+    blkAuto.find('input[name="endHour"]').val(endDate.toString(User.preferences.hourFormat ));
+
+    blkAuto.find('input[name="dueDate"]').val(dueDate.toString(User.preferences.dateFormat ));
+    blkAuto.find('input[name="dueHour"]').val(dueDate.toString(User.preferences.hourFormat ));
+
+    blkAuto.find('input[name="percentage"]').val(percentage);
+
+    blkAuto.find('input[name="allDay"]').attr('checked', (!!(startDate.compareTo(endDate) == 0) || (startDate.toString('HH:mm') == endDate.toString('HH:mm')) ? true : false));
+}
+
+function callbackTask(blkAddTask){
+	if(!blkAddTask)
+	    blkAddTask = UI.dialogs.addActivity.find('#group_addactivity_details8');
+
+        blkAddTask.find("li .button").filter(".close.new").button({
+            icons: {
+            primary: "ui-icon-close"
+            },
+            text: false
+        }).click(function () {
+
+            delete tasks[$(this).parents('li').find('input[name="idtask[]"]').val()]
+            tasks.length +=  -1;
+
+            idTaskToActivity = $(this).parents('li').find('input[name="idTaskToActivity[]"]').val()
+
+            if(idTaskToActivity != '')
+                DataLayer.remove('taskToActivity', idTaskToActivity);
+            
+            $(this).parents('li').remove();
+                
+            if(blkAddTask.find(".task-activity-list li").length == 1)
+                blkAddTask.find("li.not-activity    ").removeClass('hidden');
+
+            registerStatus();
+        })
+        .addClass('tiny disable ui-button-disabled ui-state-disabled')
+        .removeClass('new').end()
+
+        .filter(".info.new").button({
+            icons: {
+                primary:  "ui-icon-notice"
+            },
+            text: false
+        }).click(function () {
+            var positionY = $(this).parents("li").offset().top;
+             
+            var name = $(this).parents('li').find("div").find(".name").text();
+            var email = $(this).parents('li').find("div").find(".mail").text()
+                        
+            if( $('.qtip.qtip-blue.qtip-active').val() !== ''){
+                $(this).qtip({
+                    show: {
+                        ready: true,
+                        solo: true,
+                        when: {
+                            event: 'click'
+                        }
+                    },
+                    hide: false,
+                    content: {
+                        text: $('<div></div>').html( DataLayer.render( path + 'templates/activity_information_task.ejs', {
+                            'name' : name
+                        } ) ),
+                        title: {
+                            text:'Informações',
+                            button: '<a class="button close" href="#">close</a>'
+                        }
+                    },
+                style: {
+                    name: 'blue',
+                        tip: {
+                             },
+                        border: {
+                            width: 4,
+                            radius: 8
+                        },
+                        width: {
+                            min: 230,
+                            max:230
+                        }
+                },
+                position: {
+                    corner: {
+                        target: 'rightMiddle',
+                        tooltip: 'leftMiddle'
+                    },
+                    adjust: {
+                        x: 30,
+                        y: 0
+                    }
+                }
+            })
+            .qtip("api").onShow = function(arg0) {
+                $('.qtip-active .button.close').button({
+                    icons: {
+                        primary: "ui-icon-close"
+                    },
+                    text: false
+                })
+                .click(function(){
+                    blkAddAtendee.find('dd.task-activity-list').qtip('destroy');
+                });
+                                        
+                $('.qtip-active .button.cancel').button().click(function(){
+                    blkAddAtendee.find('dd.activity-list [type=checkbox]').attr('checked', false);
+                    blkAddAtendee.find('dd.activity-list').qtip('destroy');
+                });
+
+                $('.qtip .button').button();
+                                        
+            };
+         }             
+     })
+ .addClass('tiny disable ui-button-disabled ui-state-disabled')
+ .removeClass('new').end()
+ .filter(".edit.new").button({
+            icons: {
+            primary: "ui-icon-pencil"
+            },
+            text: false
+        }).click(function () {
+	    var task = DataLayer.get('schedulable:task', $(this).parents('li').find('input[name="idtask[]"]').val());
+	    taskDetails(task, true, '',true, null, true);           
+        })
+        .addClass('tiny disable ui-button-disabled ui-state-disabled')
+        .removeClass('new').end()
+
+        UI.dialogs.addActivity.find('.task-activity-list li').hover(
+            function () {
+                $(this).addClass("hover-attendee");
+                $(this).find('.button').removeClass('disable ui-button-disabled ui-state-disabled').end()
+                .find('.activity-options').addClass('hover-attendee');
+            },
+            function () {
+                $(this).removeClass("hover-attendee");
+                $(this).find('.button').addClass('disable ui-button-disabled ui-state-disabled').end()
+                .find('.activity-options').removeClass('hover-attendee');
+            }
+        );        
+    }
Index: trunk/prototype/modules/calendar/js/desktop.notification.js
===================================================================
--- trunk/prototype/modules/calendar/js/desktop.notification.js	(revision 6996)
+++ trunk/prototype/modules/calendar/js/desktop.notification.js	(revision 6996)
@@ -0,0 +1,104 @@
+desktopNotification = {
+    
+    notification: [],
+
+    initDesktopNotificationAddon: function(){
+		if(useDesktopNotification()){
+
+			if (!window.webkitNotifications && $.browser.mozilla)
+			this.installDektopNotificationAddon();
+
+			if(window.webkitNotifications && window.webkitNotifications.checkPermission()){
+			     if($.browser.safari){
+                     $.Zebra_Dialog('Deseja instalar o plugin de notificação desktop?', {
+                        'custom_class': 'request-notification-permission',
+                        'type':     'question',
+                        'overlay_opacity': '0.5',
+                        'buttons':  ['Não', 'Sim']
+                    });
+
+                    $('div.ZebraDialog.request-notification-permission a').click(function() {
+                        if($(this).html() == 'Sim')
+                            window.webkitNotifications.requestPermission();       
+                    });
+                }else
+                    window.webkitNotifications.requestPermission();
+            }
+		}
+    },
+
+    installDektopNotificationAddon: function(){
+
+    	var params = {
+    	    "Foo": { 
+    			URL: '../prototype/plugins/desktop.notification/html_desktop_notifications-1.0.7-fx.xpi' ,
+    			IconURL:'../prototype/plugins/desktop.notification/desktop-notification.png',
+    			//Hash:'sha1:28857e60d043447c5f4550853f2d40770b326a13',
+    			toString: function () {
+    				return this.URL;
+    			}
+    	    }
+    	};
+
+	   InstallTrigger.install(params);
+
+	   return false;
+    },
+
+    verifyComplement: function(){
+
+		if(!window.webkitNotifications)
+			return false;
+
+		if(window.webkitNotifications.checkPermission())
+			return false;
+
+		return true;
+    },
+
+    sentNotification: function(icon, title, body){
+		var reference = this.notification.length;
+		this.notification[reference] = window.webkitNotifications.createNotification( icon, title, body);
+		return reference;
+	},
+
+	cancelByReference: function(index){
+		if(this.notification[index])
+			this.notification[index].cancel();
+	},
+	
+	
+    showNotification: function(onClose, onClick, onDisplay, onError){
+		var length = this.notification.length -1; 
+
+		this.notification[length].ondisplay = onDisplay;
+		this.notification[length].onclose = onClose;
+		this.notification[length].onclick = onClick;
+		this.notification[length].onerror = onError;
+
+		this.notification[length].show();
+    }
+}
+
+$(document).ready(function() {
+    activePage = true;
+    $(window)
+	.focus(function() { 
+	    activePage = true;  
+	    if(desktopNotification.verifyComplement()){
+			setTimeout(function(){		    
+				
+				for(var i = 0; i < desktopNotification.notification.length; i++){
+				desktopNotification.notification[i].cancel();
+				}		    
+				desktopNotification.notification = [];
+				
+			}, 60000);
+	    }
+	})
+	.blur(function() {
+	    activePage = false;
+	});
+
+    desktopNotification.initDesktopNotificationAddon();
+});
Index: trunk/prototype/modules/calendar/js/map.disponibility.js
===================================================================
--- trunk/prototype/modules/calendar/js/map.disponibility.js	(revision 6444)
+++ trunk/prototype/modules/calendar/js/map.disponibility.js	(revision 6996)
@@ -8,10 +8,10 @@
 
 
-function updateMap(data){
-	var start_date = $(".new-event-win.active .start-date").val();
-	var end_date   = $(".new-event-win.active .end-date").val();
-	var start_time = $(".new-event-win.active .start-time").val();
-	var end_time   = $(".new-event-win.active .end-time").val();
-	var isAllDay   = $('.new-event-win.active input[name="allDay"]').is(':checked');
+function updateMap(viewName){
+	var start_date = $(".new-"+viewName+"-win.active .start-date").val();
+	var end_date   = $(".new-"+viewName+"-win.active .end-date").val();
+	var start_time = $(".new-"+viewName+"-win.active .start-time").val();
+	var end_time   = $(".new-"+viewName+"-win.active .end-time").val();
+	var isAllDay   = $('.new-'+viewName+'-win.active input[name="allDay"]').is(':checked');
 	
 	var formatString = User.preferences.dateFormat + " " + User.preferences.hourFormat;
@@ -21,5 +21,5 @@
 	
 	
-	var event = $("#new_event_map").fullCalendar('clientEvents', 'map')[0];
+	var event = $('.new-'+viewName+'-win .map_disponibility').fullCalendar('clientEvents', 'map')[0];
 	
 	
@@ -28,5 +28,5 @@
 			event.end = endDate;
 			event.allDay = isAllDay;
-			$("#new_event_map").fullCalendar( 'updateEvent', event )
+			$('.new-'+viewName+'-win .map_disponibility').fullCalendar( 'updateEvent', event )
 		}
 		
@@ -35,12 +35,14 @@
 
 
-function disponibily(objEvent, path, attendees){
+function disponibily(objEvent, path, attendees, viewName){
 	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 dialogName = {event: 'addEvent', task: 'addTask', activity: 'addActivity'}
 	 
 	var mapHtml = DataLayer.render( path+'templates/availability_map.ejs', {});
-	$("#calendar_addevent_details7").html(mapHtml);
-	$("#new_event_map").fullCalendar(DataLayer.merge({
+	$('#calendar_add'+viewName+'_details7').html(mapHtml);
+	$('.new-'+viewName+'-win .map_disponibility').fullCalendar(DataLayer.merge({
 		height : 300,
 		timeFormat: User.preferences.hourFormat,
@@ -77,5 +79,5 @@
 			if(!allDay){
 				$('[name="allDay"]').attr("checked", false); 
-				UI.dialogs.addEvent.find('.start-time, .end-time').removeClass('hidden');
+				UI.dialogs[dialogName[viewName]].find('.start-time, .end-time').removeClass('hidden');
 				
 				$('[name="startHour"]').val(start.toString(User.preferences.hourFormat));
@@ -85,5 +87,5 @@
 			}else{
 				$('[name="allDay"]').attr("checked", true); 
-				UI.dialogs.addEvent.find('.start-time, .end-time').addClass('hidden');
+				UI.dialogs[dialogName[viewName]].find('.start-time, .end-time').addClass('hidden');
 			}
 		},
@@ -98,5 +100,5 @@
 				className : "map-event",
 				backgroundColor : "transparent !important",
-				editable : objEvent.acl.write || objEvent.acl.organization
+				editable : objEvent.acl ? (objEvent.acl.write || objEvent.acl.organization) : true
 			}
 		],
@@ -104,5 +106,5 @@
 			if(event.allDay){
 				$('[name="allDay"]').attr("checked", true); 
-				UI.dialogs.addEvent.find('.start-time, .end-time').addClass('hidden');
+				UI.dialogs[dialogName[viewName]].find('.start-time, .end-time').addClass('hidden');
 				
 				$('[name="startDate"]').val(dateCalendar.toString(event.start, User.preferences.dateFormat));				
@@ -111,5 +113,5 @@
 			}else{
 				$('[name="allDay"]').attr("checked", false); 
-				UI.dialogs.addEvent.find('.start-time, .end-time').removeClass('hidden');
+				UI.dialogs[dialogName[viewName]].find('.start-time, .end-time').removeClass('hidden');
 			
 				$('[name="startHour"]').val(dateCalendar.formatDate(event.start, User.preferences.hourFormat));
@@ -132,8 +134,8 @@
 	var eventSource = new Array();
 	var updateMapView = function(){
-		updateMap();
-		var view = $("#new_event_map").fullCalendar('getView');
+		updateMap(viewName);
+		var view = $('.new-'+viewName+'-win .map_disponibility').fullCalendar('getView');
 		var map = {};
-		$("#new_event_map").fullCalendar( 'removeEventSource', eventSource );
+		$('.new-'+viewName+'-win .map_disponibility').fullCalendar( 'removeEventSource', eventSource );
 		eventSource = new Array();	
 		map = {startTime : view.start.getTime(), endTime : view.end.getTime(), attendees: {}, timezone: (objEvent.timezone || User.preferences.timezone)};
@@ -167,12 +169,11 @@
 		}
 		if(eventSource.length)
-			$("#new_event_map").fullCalendar( 'addEventSource', eventSource );
+			$('.new-'+viewName+'-win .map_disponibility').fullCalendar( 'addEventSource', eventSource );
 	}; 
-	$('[href="#calendar_addevent_details7"]').click(function(eventData, eventObject){
-		$("#new_event_map").fullCalendar( 'gotoDate', Date.parseExact($('[name="startDate"]').val() + " " + $.trim($('[name="startHour"]').val()), formatString) , formatString);
-		//if(eventObject == undefined)
-			updateMapView();
+	$('[href="#calendar_add'+viewName+'_details7"]').click(function(eventData, eventObject){
+		$('.new-'+viewName+'-win .map_disponibility').fullCalendar( 'gotoDate', Date.parseExact($('[name="startDate"]').val() + " " + $.trim($('[name="startHour"]').val()), formatString) , formatString);
+		  updateMapView();
 	});	
-	$("#new_event_map").find(".fc-button-prev, .fc-button-next, .fc-button-today").click(function(){
+	$('.new-'+viewName+'-win .map_disponibility').find(".fc-button-prev, .fc-button-next, .fc-button-today").click(function(){
 		updateMapView();
 	});
Index: trunk/prototype/modules/calendar/js/helpers.js
===================================================================
--- trunk/prototype/modules/calendar/js/helpers.js	(revision 6956)
+++ trunk/prototype/modules/calendar/js/helpers.js	(revision 6996)
@@ -101,16 +101,71 @@
 }
 
-/*
-function listEvents(){
-	var list = $('.fc-header-right').find('.fc-button.fc-button-agendaDay').clone();
+function printNow(){
+
+	var window_print = window.open('','ExpressoCalendar','width=800,height=600,scrollbars=yes');        
+	window_print.document.open();
+
+	var start = $("#calendar").fullCalendar('getView').visStart.getTime()/1000;
+	var end = $("#calendar").fullCalendar('getView').visEnd.getTime()/1000;
+	var criteria = DataLayer.criteria("schedulable:calendar", {'start':start, 'end':end} );
+	
+	var data = DataLayer.get("schedulable:print", criteria);	
+
+	if($("#calendar").fullCalendar('getView').name == "month"){				
+		window_print.document.write(DataLayer.render('templates/calendar_month_print.ejs', {
+			'InfoPage' : $("#calendar").fullCalendar('getView').title,
+			'days' : data
+		} ));
+	}
+	if($("#calendar").fullCalendar('getView').name == "agendaDay"){				
+		window_print.document.write(DataLayer.render('templates/calendar_day_print.ejs', {
+			'InfoPage' : $("#calendar").fullCalendar('getView').title,
+			'days' : data
+		} ));
+	}
+	if($("#calendar").fullCalendar('getView').name == "agendaWeek"){
+		window_print.document.write(DataLayer.render('templates/calendar_week_print.ejs', {
+			'InfoPage' : $("#calendar").fullCalendar('getView').title,
+			'days' : data
+		}));
+		
+		var aux = 0;
+		setTimeout(function(){$(window_print.document).find(".all-day").each(function(){
+			if($(this).height() > aux)
+				aux = $(this).height();
+		});
+		$(window_print.document).find(".all-day").each(function(){
+			$(this).height(aux);
+		});
+		$(window_print.document).find(".all-day-line .write").height(aux);
+		aux = 0;
+		},20);
+	}
+	if($("#calendar").fullCalendar('getView').name == "year"){	
+		window_print.document.write(DataLayer.render('templates/calendar_year_print.ejs', {
+			'html' : $('#calendar .fc-content').html(),
+			'header': $('#calendar').find('.fc-header-center h2').text()
+		} ));
+	}		
+	window_print.document.close();
+	setTimeout(window_print.print(), 300);
+}
+
+function printEvents(){
+	//var html = DataLayer.render( path + 'templates/attendee_permissions.ejs', {} );
+	var print = $('.fc-header-right').find('.fc-button.fc-button-agendaDay').clone();
+
 	$('.fc-header-right').find('.fc-button-year').toggleClass('fc-corner-right');
-	list.addClass('fc-corner-right');
-	list.addClass('fc-button-listagem');
-	list.removeClass('fc-button-agendaDay');
-	list.removeClass('fc-corner-left');
-	list.find('.fc-button-content').html('Listagem');
-	$('.fc-header-right').append(list);
-}
-*/
+	print.addClass('fc-corner-right');
+	print.addClass('fc-button-print');
+	print.removeClass('fc-button-agendaDay');
+	print.removeClass('fc-corner-left');
+	print.find('.fc-button-content').html('Imprimir');
+	$('.fc-header-right').append(print);
+	$('.fc-button-print').click(function(){
+	    alert('A tela de impressão será melhor visualizada com a preferência "Paisagem" do seu browser selecionada.');
+	    printNow();
+	});
+}
 
 /*
@@ -122,4 +177,7 @@
 function eventDetails( objEvent, decoded, path, isMail, repeat)
 {
+
+    $('.qtip.qtip-blue').remove();
+
     attendees = {};
 	
@@ -399,5 +457,5 @@
 	modal:true, 
 	autoOpen: false,
-	width:702, 
+	width:701, 
 	position: 'center', 
 	close: function(event, ui) {
@@ -936,9 +994,9 @@
 // load template of attendees
 var blkAddAtendee = UI.dialogs.addEvent.find('#calendar_addevent_details6').append(attendeeHtml);
-if(objEvent.attendee.length)
-    callbackAttendee();
+if(objEvent.attendee.length) 
+	 	callbackAttendee(); 
 /**
-				Opções de delegação do participante/organizer
-			*/		
+Opções de delegação do participante/organizer
+*/		
 blkAddAtendee.find(".button.participant-delegate").button({
     icons: {
@@ -968,7 +1026,7 @@
 
 UI.dialogs.addEvent.find(".attendee-list-add .add-attendee-input input").Watermark("digite um email para convidar");
-/* Trata a edição de um novo participante adicionado
-			* 
-			*/
+/* 
+ * Trata a edição de um novo participante adicionado
+ */
 var hasNewAttendee = false;
 			
@@ -978,5 +1036,4 @@
 			
 blkAddAtendee.find('.attendee-list-add .add-attendee-input input').keydown(function(event) {
-				
     if (event.keyCode == '13' && $(this).val() != '' || (event.keyCode == undefined && $(this).val() != '')) {
 	Encoder.EncodeType = "entity";
@@ -990,18 +1047,18 @@
 
 	/**
-					 * email válido?
-					 */
+	* email válido?
+	*/
 	info.match(/^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/) ? 
 	newAttendeeEmail = info : newAttendeeName = info;
 
 	/**
-					 * 1) busca no banco para saber se o usuário já existe
-					 *		1.1) se existe, atualiza as info na lista de participantes e nao abre o tooltip
-					 *		1.2) se não existe
-					 *			a) salva como novo usuario externo no banco (apenas com email)
-					 *			b) exibe tooltip pedindo o nome
-					 *			c) se o usuário preenche tooltip e salva, atualiza com o nome o usuário recém criado
-					 *			d) se o usuário cancela o tooltip, fica o usuário salvo apenas com email e sem nome
-					 */
+	* 1) busca no banco para saber se o usuário já existe
+	*		1.1) se existe, atualiza as info na lista de participantes e nao abre o tooltip
+	*		1.2) se não existe
+	*			a) salva como novo usuario externo no banco (apenas com email)
+	*			b) exibe tooltip pedindo o nome
+	*			c) se o usuário preenche tooltip e salva, atualiza com o nome o usuário recém criado
+	*			d) se o usuário cancela o tooltip, fica o usuário salvo apenas com email e sem nome
+	*/
 
 	var user = DataLayer.get('user', ["=", "mail", $(this).val()]);
@@ -1012,11 +1069,11 @@
 					
 	/**
-					 * guarda o último tooltip aberto referente à lista de participantes 
-					 */
+	* guarda o último tooltip aberto referente à lista de participantes 
+	*/
 	lastEditAttendeeToolTip = [];
 
 	/**
-					 * Valida email e salva um participante externo 
-					 */
+	* Valida email e salva um participante externo 
+	*/
 	var saveContact = function() {
 	    Encoder.EncodeType = "entity";
@@ -1192,9 +1249,9 @@
     $(this).val('');
 
-} else if (!skipAddNewLine) {		
+} else if (!skipAddNewLine) {
     /**
-						 * a) salva como novo usuario externo no banco (apenas com email) e...
-						 * adiciona novo contato externo à lista de convidados
-						 */
+     * a) salva como novo usuario externo no banco (apenas com email) e...
+     * adiciona novo contato externo à lista de convidados
+     */
 
     userId = DataLayer.put('user', {
@@ -1285,6 +1342,6 @@
 
 /** 
-			* Trata a busca de usuários para adição de participantes
-			*/
+* Trata a busca de usuários para adição de participantes
+*/
 blkAddAtendee.find('.add-attendee-search .ui-icon-search').click(function(event) {
     blkAddAtendee.find('.add-attendee-search input').keydown();
@@ -1374,4 +1431,5 @@
     }
 });
+
 //$('.block-add-attendee .search-result-list').selectable();
 
@@ -1395,6 +1453,7 @@
                         });
                 });
-                $('.attachment-list input').remove();
-                $('.row.fileupload-buttonbar .attachments-list p').remove();
+                $('div.new-event-win .attachment-list input').remove();
+                $('div.new-event-win .row.fileupload-buttonbar .attachments-list p').remove();
+		$('div.new-event-win .btn-danger.delete').addClass('hidden');
             }
         }});
@@ -1415,130 +1474,6 @@
     text: false
 });
-var maxSizeFile = 2000000;
-$('#fileupload').fileupload({
-    sequentialUploads: true,
-    add: function (e, data) {
-	if(data.files[0].size < maxSizeFile)
-	    data.submit();
-    },
-    change: function (e, data) {
-	$.each(data.files, function (index, file) {
-	    var attach = {};
-	    attach.fileName = file.name;
-	    var ext = file.name.split('.');
-	    if(file.name.length > 10)
-		attach.fileName = ext.length == 1 ? file.name.substr(0, 10) :  file.name.substr(0, 6) + '.' + ext[ext.length -1];
-	    attach.fileSize = formatBytes(file.size);
-	    if(file.size > maxSizeFile)
-		attach.error = 'Tamanho de arquivo nao permitido!!'
-				
-	    $('.attachments-list').append(DataLayer.render(path+'templates/attachment_add_itemlist.ejs', {
-		file : attach
-	    }));
-				
-	    if(file.size < maxSizeFile){
-		$('.fileinput-button.new').append(data.fileInput[0]).removeClass('new');
-		$('.attachments-list').find('[type=file]').addClass('hidden');
-					
-	    }else
-		$('.fileinput-button.new').removeClass('new');
-				
-				
-	    $('.attachments-list').find('.button.close').button({
-		icons: {
-		    primary: "ui-icon-close"
-		},
-		text: false
-	    }).click(function(){
-		var idAttach = $(this).parent().find('input[name="fileId[]"]').val();
-		$('.attachment-list').find('input[value="'+idAttach+'"]')
-		$(this).parent().remove();
-	    });	
-				
-	})
-	},
-    done: function(e, data){
-	var currentUpload = $('.progress.after-upload:first').removeClass('after-upload').addClass('on-complete').hide();
-
-	if(!!data.result && data.result != "[]"){
-	    var newAttach = (attch = jQuery.parseJSON(data.result)) ? attch : jQuery.parseJSON(data.result[0].activeElement.childNodes[0].data);
-	    $('.attachment-list').append('<input tyepe="hidden" name="attachment[]" value="'+newAttach['attachment'][0][0].id+'"/>');
-	    currentUpload.removeClass('on-complete').parents('p')
-	    .append('<input type="hidden" name="fileId[]" value="'+newAttach['attachment'][0][0].id+'"/>')
-	    .find('.status-upload').addClass('ui-icon ui-icon-check');
-	}else
-	    currentUpload.removeClass('on-complete').parents('p').find('.status-upload').addClass('ui-icon ui-icon-cancel');
-    }
-});
-$('.attachments-list .button').button();
-
-if(!!window.FormData)			
-$('#fileupload').bind('fileuploadstart', function () {
-    var widget = $(this),
-    progressElement = $('#fileupload-progress').fadeIn(),
-    interval = 500,
-    total = 0,
-    loaded = 0,
-    loadedBefore = 0,
-    progressTimer,
-    progressHandler = function (e, data) {
-	loaded = data.loaded;
-	total = data.total;
-    },
-    stopHandler = function () {
-	widget
-	.unbind('fileuploadprogressall', progressHandler)
-	.unbind('fileuploadstop', stopHandler);
-	window.clearInterval(progressTimer);
-	progressElement.fadeOut(function () {
-	    progressElement.html('');
-	});
-    },
-    formatTime = function (seconds) {
-	var date = new Date(seconds * 1000);
-	return ('0' + date.getUTCHours()).slice(-2) + ':' +
-	('0' + date.getUTCMinutes()).slice(-2) + ':' +
-	('0' + date.getUTCSeconds()).slice(-2);
-    },
-    /* formatBytes = function (bytes) {
-            if (bytes >= 1000000000) {
-                return (bytes / 1000000000).toFixed(2) + ' GB';
-            }
-            if (bytes >= 1000000) {
-                return (bytes / 1000000).toFixed(2) + ' MB';
-            }
-            if (bytes >= 1000) {
-                return (bytes / 1000).toFixed(2) + ' KB';
-            }
-            return bytes + ' B';
-        },*/
-    formatPercentage = function (floatValue) {
-	return (floatValue * 100).toFixed(2) + ' %';
-    },
-    updateProgressElement = function (loaded, total, bps) {
-	progressElement.html(
-	    formatBytes(bps) + 'ps | ' +
-	    formatTime((total - loaded) / bps) + ' | ' +
-	    formatPercentage(loaded / total) + ' | ' +
-	    formatBytes(loaded) + ' / ' + formatBytes(total)
-	    );
-    },
-    intervalHandler = function () {
-	var diff = loaded - loadedBefore;
-	if (!diff) {
-	    return;
-	}
-	loadedBefore = loaded;
-	updateProgressElement(
-	    loaded,
-	    total,
-	    diff * (1000 / interval)
-	    );
-    };
-    widget
-    .bind('fileuploadprogressall', progressHandler)
-    .bind('fileuploadstop', stopHandler);
-    progressTimer = window.setInterval(intervalHandler, interval);
-});
+
+extendsFileupload('event', path);
 	
 if(objEvent.isShared){
@@ -1557,5 +1492,5 @@
 }
 
-disponibily(objEvent, path, attendees);
+disponibily(objEvent, path, attendees, 'event');
 
 /*Seleciona a agenda padrão para criação de um evento*/
@@ -1573,6 +1508,5 @@
 
 UI.dialogs.addEvent.dialog('open');
-//$('[href="#calendar_addevent_details7"]').trigger('click');
-//$('[href="#calendar_addevent_details2"]').trigger('click');
+
 }
 
@@ -1691,6 +1625,8 @@
 
 
-function add_tab_configure_calendar(calendar) 
+function add_tab_configure_calendar(calendar, type) 
 {
+    $('.qtip.qtip-blue').remove();
+
     var calendars = [];
     var signatures = [];
@@ -1698,18 +1634,25 @@
 	var calendarAlarms = [];
 	
-    for (var i=0; i<Calendar.signatures.length; i++) {
-	calendars[i]  = Calendar.signatures[i].calendar;
-	signatures[i] = Calendar.signatures[i];
-	signatures[i].numberDefaultAlarm = signatures[i].defaultAlarms != '' ?  signatures[i].defaultAlarms.length: 0;
-	if (calendar && calendars[i].id == calendar)
-	    previewActiveCalendarConf = i;
-    }
-		
-    if(!(document.getElementById('configure_tab')))
+	for (var i=0; i<Calendar.signatures.length; i++) {
+		if(parseInt(Calendar.signatures[i].calendar.type) == type){
+		   calendars.push(Calendar.signatures[i].calendar);
+		   signatures.push(Calendar.signatures[i]);
+		   length = signatures.length - 1;
+		   signatures[length].numberDefaultAlarm = signatures[length].defaultAlarms != '' ?  signatures[length].defaultAlarms.length: 0;
+		   if (calendar && calendars[length].id == calendar)
+			   previewActiveCalendarConf = length;
+		}
+   }
+	var tab_selector = ['configure_tab', 'configure_tab_group'];	
+    if(!(document.getElementById(tab_selector[type])))
     {
 	$('.positionHelper').css('display', 'none');
 	$('.cal-list-options-btn').removeClass('fg-menu-open ui-state-active');
-	var tab_title = "Configurações de agendas";
-	$tabs.tabs( "add", "#configure_tab", tab_title );
+	if(type == 0){
+		var tab_title = "Configurações de agendas";
+	}else{
+		var tab_title = "Configurações de Grupos";
+	}
+	$tabs.tabs( "add", "#"+tab_selector[type], tab_title );
 		
 	var dataColorPicker = {
@@ -1734,8 +1677,9 @@
 	    DataLayer.render( 'templates/configure_calendars_itemlist.ejs', {
 		user:User, 
+		type:0,
 		calendar:calendars[nowActive], 
 		signature:signatures[nowActive]
 		}, function( form_template ){
-		var form_content = jQuery('.accordion-user-calendars .ui-accordion-content').eq(nowActive).html( form_template ).find('form');
+		var form_content = jQuery('#'+tab_selector[type]+' .accordion-user-calendars .ui-accordion-content').eq(nowActive).html( form_template ).find('form');
 		form_content.find('.preferences-alarms-list .button').button({
 		    text:false, 
@@ -1756,5 +1700,5 @@
 
 		form_content.find('.button-add-alarms').click(function(){
-		    DataLayer.render( 'templates/alarms_add_itemlist.ejs', {}, function( template ){						
+		    DataLayer.render( 'templates/alarms_add_itemlist.ejs', {type: 0}, function( template ){						
 			jQuery('.preferences-alarms-list').append(template)
 			.find('li:last label:eq(0)').remove().end()
@@ -1862,13 +1806,14 @@
 DataLayer.render( 'templates/configure_calendars.ejs', {
     user:User, 
+	type: 0,
     calendars:calendars, 
     signatures:signatures
 }, function( template ){
-    var template_content = jQuery('#configure_tab').html( template ).find('.configure-calendars-win');
+    var template_content = jQuery('#'+tab_selector[type]).html( template ).find('.configure-calendars-win');
     template_content.find('.button').button().filter('.save').click(function(evt){
 	if(calendarAlarms.length)
 		DataLayer.removeFilter('calendarSignatureAlarm', {filter: ['IN','id', calendarAlarms]});	
 	template_content.find('form').submit();
-	$tabs.tabs( "remove", "#configure_tab");
+	$tabs.tabs( "remove", "#"+tab_selector[type]);
 	DataLayer.commit( false, false, function( received ){
 	    delete Calendar.currentViewKey;
@@ -1879,5 +1824,5 @@
 		Calendar.load();
     }).end().filter('.cancel').click(function(evt){
-	$tabs.tabs( "remove", "#configure_tab");
+	$tabs.tabs( "remove", "#"+tab_selector[type]);
     });
 
@@ -1905,5 +1850,5 @@
 	$('.positionHelper').css('display','none');
     $('.cal-list-options-btn').removeClass('fg-menu-open ui-state-active');
-    $tabs.tabs("select", "#configure_tab");
+    $tabs.tabs("select", "#"+tab_selector[type]);
     $('.accordion-user-calendars').accordion( "activate" , previewActiveCalendarConf );
 		
@@ -1913,9 +1858,14 @@
 }
 
-function getSelectedCalendars( reverse ){
+function getSelectedCalendars( reverse, type ){
+	var selector = "";
+	if(type == 0)
+		selector = ".my-calendars";
+	if(type == 1)
+		selector = ".my-groups-task";
     var selecteds = {};
     var cont = 0; 
     jQuery(function() {
-	jQuery(".my-calendars .calendar-view").each(function(i, obj) { 
+	jQuery(selector+" .calendar-view").each(function(i, obj) { 
 	    var check_box = obj;
 	    if( reverse ? !check_box.checked : check_box.checked ) {
@@ -1975,5 +1925,5 @@
 
 function remove_event(eventId, idCalendar){
-    $.Zebra_Dialog('Tem certeza que deseja excluir o evento?', {
+    $.Zebra_Dialog('Tem certeza que deseja excluir?', {
 	'type':     'question',
 	'overlay_opacity': '0.5',
@@ -2029,7 +1979,11 @@
 
 
-function remove_calendar(){
+function remove_calendar(type){
     /* Pode ser assim $('.cal-list-options-btn.ui-state-active').attr('class').replace(/[a-zA-Z-]+/g, ''); */
-    $.Zebra_Dialog('Todos os eventos desta agenda serão removidos. Deseja prosseguir com a operação?', {
+	if(!!parseInt(type))
+		var title = 'Todas as tarefas deste grupo serão removidas. Deseja prosseguir com a operação?';
+	else
+		var title = 'Todos os eventos desta agenda serão removidos. Deseja prosseguir com a operação?';
+    $.Zebra_Dialog(title, {
 	'type':     'question',
 	'overlay_opacity': '0.5',
@@ -2047,5 +2001,5 @@
 		    delete Calendar.currentViewKey;
 		    Calendar.load();
-		    refresh_calendars();
+		    refresh_calendars(type);
 		});
 	    }
@@ -2056,5 +2010,5 @@
 }
 
-function refresh_calendars(){
+function refresh_calendars(type){
 
     var colorsSuggestions = colors_suggestions();
@@ -2091,19 +2045,30 @@
 		});
 	}
+	
 	doMenu();
+	var currentToolTip = null;
 	$('#divAppbox').on('scroll',function(){
 		if ($('.cal-list-options-btn.fg-menu-open.ui-state-active')){			
 			var offset = $('.cal-list-options-btn.fg-menu-open.ui-state-active').offset();
 			if (offset)
-				$('.positionHelper').css('top',offset.top);
+			    $('.positionHelper').css('top',offset.top);
 		}
+
 		if ($('.button.config-menu.fg-menu-open')){
 			var offset = $('.button.config-menu.fg-menu-open').offset();
 			if (offset)
-				$('.positionHelper').css('top',offset.top);
+			    $('.positionHelper').css('top',offset.top);
 		}		
+
+		
+		if ($(".new-group.qtip-active").length || $(".new-calendar.qtip-active").length)			
+		    $('.qtip-active').css('top',currentToolTip.offset().top - 50);
+		
 	});
+	
 	$('ul.list-calendars .cal-list-options-btn').on('click',function(){doMenu();});         
 	
+
+    /***************************************New Calendar***************************************/
 	meu_container.find(".button.new-calendar").button({
 	    icons: {
@@ -2112,131 +2077,149 @@
 	    text: false
 	}).click(function () {
-		
-	    if( $('.qtip.qtip-blue.qtip-active').val() !== ''){
-		$(this).qtip({
-		    show: {
-		    ready: true, 
-	    solo: true, 
-	    when: {
-		    event: 'click'
-		    }
-		},
-		hide: false,
-		content: {
-		text: $('<div></div>').html( DataLayer.render( 'templates/calendar_quick_add.ejs', {} ) ), 
-		title: {
-		text:'Nova Agenda', 
-		button: '<a class="button close" href="#">close</a>'
-		}
-		},
-		style: {
-		name: 'blue', 
-	    tip: {
-		corner: 'leftMiddle'
-		}, 
-	    border: {
-		width: 4, 
-	    radius: 8
-		}, 
-	    width: {
-		min: 230, 
-	    max:230
-		}
-	    },
-	    position: {
-	    corner: {
-	    target: 'rightMiddle',
-	    tooltip: 'leftMiddle'
-	    },
-	    adjust: {
-	    x:0, 
-	    y:-12
-	    }
-	    }
-	    })
-	.qtip("api").onShow = function(arg0) {
-	    $('.qtip-active .button.close').button({
-		icons: {
-		    primary: "ui-icon-close"
-		},
-		text: false
-	    })
-	    .click(function(){
-		meu_container.find(".button.new-calendar").qtip('destroy');
-	    });
-	    //TODO emplementar tratamento de duplicação de valores no location
-	    $('.qtip-active .button.save').button().click(function(){
-		for(var i = 0; i < Calendar.calendars.length; i++){
-		    if(Calendar.calendars[i].location == ( User.me.uid + '/' + $('.qtip-active input').val())){	
-			$.Zebra_Dialog('O nome desta agenda já está sendo utilizada em uma Url de outra agenda. Por favor, informe outro nome para agenda.',{
-			    'overlay_opacity': '0.5',
-			    'type': 'warning'
-			});
-			meu_container.find(".button.new").qtip('destroy');
-			return;
-		    }
-		}
+		currentToolTip = $(this);
+        var typeCalendar = !!parseInt($(this).attr('class').match(/[0-9]+/g)) ? 
+            {type: 'new-group', title: 'Novo Grupo', typeValue: 1, prompt: 'Nome do grupo'} : 
+            {type: 'new-calendar', title: 'Nova Agenda', typeValue: 0, prompt: 'Nome da agenda'}
+		
+	    if(!$('.qtip.qtip-blue.qtip-active.'+typeCalendar.type).length){
+
+            $('.qtip.qtip-blue').remove();
+
+    		$(this).qtip({
+				show: {
+    		       ready: true, 
+    	           solo: true, 
+    	           when: {
+    		          event: 'click'
+    		       }
+    		    },
+    		  hide: false,
+    		  content: {
+        		  text: $('<div></div>').html( DataLayer.render( 'templates/calendar_quick_add.ejs', {} ) ), 
+        		  title: {
+        		      text: typeCalendar.title, 
+        		      button: '<a class="button close" href="#">close</a>'
+        		  }
+        		},
+    		  style: {
+        		  name: 'blue', 
+        	      tip: {
+        		      corner: 'leftMiddle'
+        		  }, 
+            	   border: {
+                	   width: 4, 
+                	   radius: 8
+        		  }, 
+        	      width: {
+        		      min: 230, 
+        	          max:230
+        		  }
+        	    },
+    	       position: {
+        	       corner: {
+        	           target: 'rightMiddle',
+        	           tooltip: 'leftMiddle'
+        	       },
+        	       adjust: {
+                	    x:0, 
+                	    y: -12
+						
+        	       }
+        	    }
+    	    })
+        	.qtip("api").onShow = function(arg0) {
 				
-		var selected;
-		var color = $('.cal-colors-options-btn').each(function(index){
-		    if ($(this).is('.color-selected'))
-			selected = index;
-		});
-		DataLayer.put( "calendarSignature", {
-		    user: User.me.id,
-		    calendar: {
-			name: Encoder.htmlEncode($('.qtip-active input').val()),
-			timezone: User.preferences.timezone				
-		    },
-		    isOwner: 1,
-		    fontColor: colorsSuggestions[selected]['font'].substring(1) ,
-		    backgroundColor: colorsSuggestions[selected]['background'].substring(1) ,
-		    borderColor: colorsSuggestions[selected]['border'].substring(1)
-		});
-		DataLayer.commit( false, false, function( received ){
-		    delete Calendar.currentViewKey;
-		    Calendar.load();
-		    refresh_calendars();
-		});
-		meu_container.find(".button.new").qtip('destroy');
-	    });
-			
-	    $('.qtip-active .button.cancel').button().click(function(){
-		meu_container.find(".button.new").qtip('destroy');
-	    });
-			
-	    $(".qtip-active input").Watermark("Nome da agenda");
-			
-	    $('.qtip-active').keydown(function(event) {
-		if (event.keyCode == '27') {
-		    meu_container.find(".button.new").qtip('destroy');
-		}
-	    });
-			
-	    $('.colors-options').prepend(buttons_colors);
-	    $('.colors-options .signed-cal-colors-options-btn-0').addClass('color-selected');
-					
-	    var buttons = $('.cal-colors-options-btn').button();
-			
-	    buttons.click(function(){
-		buttons.removeClass('color-selected');
-		$(this).addClass('color-selected');
-	    });
-	}				
-	}
+        	    $('.qtip-active .button.close').button({
+        		  icons: {
+        		      primary: "ui-icon-close"
+        		  },
+        		  text: false
+        	    })
+        	    .click(function(){
+        		      $('.qtip.qtip-blue').remove();
+        	    });
+        	    
+                 $('.qtip-active').addClass(typeCalendar.type);
+
+        	    $('.qtip-active .button.save').button().click(function(){
+                    if(!typeCalendar.typeValue)
+                		for(var i = 0; i < Calendar.calendars.length; i++){
+                		    if(Calendar.calendars[i].location == ( User.me.uid + '/' + $('.qtip-active input').val())){	
+                    			$.Zebra_Dialog('O nome desta agenda já está sendo utilizada em uma Url de outra agenda. Por favor, informe outro nome para agenda.',{
+                    			    'overlay_opacity': '0.5',
+                    			    'type': 'warning'
+                    			});
+                    			$('.qtip.qtip-blue').remove();
+                    			return;
+                		    }
+                		}
+        				
+            		var selected;
+            		var color = $('.cal-colors-options-btn').each(function(index){
+            		    if ($(this).is('.color-selected'))
+            			 selected = index;
+            		});
+            		DataLayer.put( "calendarSignature", {
+            		    user: User.me.id,
+            		    calendar: {
+            			name: Encoder.htmlEncode($('.qtip-active input').val()),
+            			timezone: User.preferences.timezone,
+                        type: typeCalendar.typeValue			
+            		    },
+            		    isOwner: 1,
+            		    fontColor: colorsSuggestions[selected]['font'].substring(1) ,
+            		    backgroundColor: colorsSuggestions[selected]['background'].substring(1) ,
+            		    borderColor: colorsSuggestions[selected]['border'].substring(1)
+            		});
+            		DataLayer.commit( false, false, function( received ){
+            		    delete Calendar.currentViewKey;
+            		    Calendar.load();
+            		    refresh_calendars();
+            		});
+            		$('.qtip.qtip-blue').remove();
+        	    });
+        			
+        	    $('.qtip-active .button.cancel').button().click(function(){
+        		meu_container.find(".button.new").qtip('destroy');
+        	    });
+        			
+        	    $(".qtip-active input").Watermark(typeCalendar.prompt);
+        			
+        	    $('.qtip-active').keydown(function(event) {
+        		    if (event.keyCode == '27') 
+        		      meu_container.find(".button.new").qtip('destroy');
+        	    });
+        			
+        	    $('.colors-options').prepend(buttons_colors);
+        	    $('.colors-options .signed-cal-colors-options-btn-0').addClass('color-selected');
+        					
+        	    var buttons = $('.cal-colors-options-btn').button();
+        			
+        	    buttons.click(function(){
+            		buttons.removeClass('color-selected');
+            		$(this).addClass('color-selected');
+        	    });
+        	}				
+	   }
     });
-	
+
     $("img.cal-list-img").click(function(evt) {
-	$(".cal-list-options_1").toggleClass( "hidden" );
+	   $(".cal-list-options_1").toggleClass( "hidden" );
     });
 
+    $(".my-groups-task a.title-my-calendars").click(function() {
+        $(".my-groups-task ul.my-list-calendars").toggleClass("hidden")
+        $('.my-groups-task .status-list').toggleClass("ui-icon-triangle-1-s");
+        $('.my-groups-task .status-list').toggleClass("ui-icon-triangle-1-e");
+    });
+
     $(".my-calendars a.title-my-calendars").click(function() {
-	$(".my-calendars ul.my-list-calendars").toggleClass("hidden")
-	$('.my-calendars .status-list').toggleClass("ui-icon-triangle-1-s");
-	$('.my-calendars .status-list').toggleClass("ui-icon-triangle-1-e");
+    	$(".my-calendars ul.my-list-calendars").toggleClass("hidden")
+    	$('.my-calendars .status-list').toggleClass("ui-icon-triangle-1-s");
+    	$('.my-calendars .status-list').toggleClass("ui-icon-triangle-1-e");
     });
 		
     $(".signed-calendars a.title-signed-calendars").click(function() {
-	$(".signed-calendars ul.signed-list-calendars").toggleClass( "hidden");
+	   $(".signed-calendars ul.signed-list-calendars").toggleClass( "hidden");
     });
 
@@ -2270,6 +2253,6 @@
 		
     $('.calendar-view').click(function(evt){
-	if($tabs.tabs('option' ,'selected') == 1){
-	    pageselectCallback('', 0);
+	if($tabs.tabs('option' ,'selected') != 0){
+	    pageselectCallback('', 0, false, type);
 	}
 			
@@ -2285,28 +2268,35 @@
 }
 
-function add_events_list(keyword)
+function add_events_list(keyword, type)
 {
     var tab_title = "";	
     if (keyword){
-	if(keyword.length < 10)
-	    tab_title = keyword; 
-	else
-	    tab_title = keyword.substr(0,10) + '..."'; 
+		type = 2;
+		if(keyword.length < 10)
+			tab_title = keyword; 
+		else
+			tab_title = keyword.substr(0,10) + '..."'; 
     }else{
-	tab_title = "Lista de eventos";
-    }
+		if(type){
+			if(!!parseInt(type))
+				tab_title = "Lista de tarefas";
+			else
+				tab_title = "Lista de eventos";
+		}
+    }
+	var tab_selector = ['tab_events_list_', 'tab_tasks_list_', 'tab_all_list_'];
     keyword = ( keyword || '' ).replace( /\s+/g, "_" );
 	
-    if(!(document.getElementById('tab_events_list_' + (Base64.encode(keyword)).replace(/[^\w\s]/gi, "") )))	
+    if(!(document.getElementById(tab_selector[type] + (Base64.encode(keyword)).replace(/[^\w\s]/gi, "") )))	
     {
 	Encoder.EncodeType = "entity";
-	$tabs.tabs( "add", "#tab_events_list_" + (Base64.encode(keyword)).replace(/[^\w\s]/gi, ""), Encoder.htmlEncode(tab_title) );
+	$tabs.tabs( "add", "#"+tab_selector[type] + (Base64.encode(keyword)).replace(/[^\w\s]/gi, ""), Encoder.htmlEncode(tab_title) );
     }
     else /* Tab already opened */
     {
-	$tabs.tabs("option", "selected", 2);
-    }
-	
-    pageselectCallback(keyword, 0); // load page 1 and insert data on event_list.ejs
+		//$tabs.tabs("option", "selected", 2);
+	}
+	
+    pageselectCallback(keyword, 0, false, type); // load page 1 and insert data on event_list.ejs
 	
     $('.preferences-win.active .button.save, .preferences-win.active .button.cancel, .preferences-win.active .button.import, .preferences-win.active .button.export').button();
@@ -2328,8 +2318,8 @@
 	if(paginator.indexOf('next') > 0){
 	    if(parseInt($(currentView+' [name = results]').val()) > 25)
-		pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($(currentView+' [name = page_index]').val())) +1));
+		pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($(currentView+' [name = page_index]').val())) +1), false,  2);
 	}else{
 	    if(parseInt($(currentView+' [name = page_index]').val()) > 0)
-		pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($(currentView+' [name = page_index]').val())) -1));
+		pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($(currentView+' [name = page_index]').val())) -1), false, 2);
 	}
     });
@@ -2369,6 +2359,6 @@
 }
 
-function paginatorList(currentView, view){
-    $(currentView+' .events-list.events-list-win.active .list-events-paginator .fc-header-title').html('<h2>'+mountTitleList( parseInt($('[name = page_index]').val()),view)+'</h2>');
+function paginatorList(currentView, view, type){
+    $(currentView+' .events-list.events-list-win.active .list-events-paginator .fc-header-title').html('<h2>'+mountTitleList( parseInt($(currentView+' [name = page_index]').val()),view)+'</h2>');
     $(currentView+' .events-list.events-list-win.active .header-paginator .fc-header-right .fc-button').removeClass('fc-state-active')
     if(view == 'basicDay')
@@ -2390,11 +2380,11 @@
 	var goView = $(this).attr('class');
 	if(goView.indexOf('agendaDay') > 0)
-	    pageselectCallback($(currentView+' [name = keyword]').val(), 0, '', 'agendaDay');
+	    pageselectCallback($(currentView+' [name = keyword]').val(), 0, 'agendaDay', type);
 	else if(goView.indexOf('month') > 0)
-	    pageselectCallback($(currentView+' [name = keyword]').val(), 0, '', 'month');
+	    pageselectCallback($(currentView+' [name = keyword]').val(), 0, 'month', type);
 	else if(goView.indexOf('year') > 0)
-	    pageselectCallback($(currentView+' [name = keyword]').val(), 0, '', 'year');
+	    pageselectCallback($(currentView+' [name = keyword]').val(), 0, 'year', type);
 	else if(goView.indexOf('agendaWeek') > 0)
-	    pageselectCallback($(currentView+' [name = keyword]').val(), 0, '', 'agendaWeek');
+	    pageselectCallback($(currentView+' [name = keyword]').val(), 0, 'agendaWeek', type);
 
     });
@@ -2412,11 +2402,31 @@
 	var paginator = $(this).attr('class');
 	if(paginator.indexOf('next') > 0)
-	    pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($('[name = page_index]').val())) +1), '', view);
+	    pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($(currentView+' [name = page_index]').val())) +1), view, type);
 	else
-	    pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($('[name = page_index]').val())) -1), '', view);
+	    pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($(currentView+' [name = page_index]').val())) -1), view, type);
     });	
 }
 
-function paginatorListEvent(currentView, typeView, view){
+function printEventList(view){
+	$('.fc-button-print.print-list-events').click(function(){
+		var window_print = window.open('','ExpressoCalendar','width=800,height=600,scrollbars=yes');
+		var listEvents = $(view).clone();
+		listEvents.find('.fc-button').remove();
+		listEvents.find('.details-event-list').remove();
+		listEvents.find('.list-events-paginator').attr( "align" , "center"  );
+		listEvents = listEvents.html();
+		type = $(this).parents('.ui-tabs-panel').attr("id").split("_")[1];
+		var data = {
+			type : type == "tasks" ? "task-list" : ( type == "events" ? "event-list" : "search"),
+			html : listEvents
+		}
+		window_print.document.open();		
+		window_print.document.write(DataLayer.render('templates/calendar_list_print.ejs', data));
+		window_print.document.close();
+		window_print.print();
+	});
+}
+
+function paginatorListEvent(currentView, typeView, view, type){
     if(!!$(currentView).find('.fc-calendar').length)
 	return;
@@ -2430,11 +2440,14 @@
     $(currentView+' .events-list.events-list-win.active .fc-header .fc-header-center').addClass('list-events-paginator');
     $(currentView+' .events-list.events-list-win.active .fc-header .list-events-paginator').removeClass('fc-header-center');		
-		
+    		
     //Adicionar class no header padronizar com a tela principal
-    $(currentView+' .events-list.events-list-win.active .fc-header').addClass('header-paginator');
-    $(currentView+' .events-list.events-list-win.active .header-paginator').removeClass('fc-header');
-				
+	$(currentView+' .events-list.events-list-win.active .fc-header .fc-button-print').addClass('print-list-events');		
+	$(currentView+' .events-list.events-list-win.active .fc-header').addClass('header-paginator');
+    $(currentView+' .events-list.events-list-win.active .header-paginator').removeClass('fc-header');	
+	
+	printEventList(currentView);
+	
     if(typeView == 'search'){
-	$(currentView+' .events-list.events-list-win.active .header-paginator .fc-header-right').remove()
+	$(currentView+' .events-list.events-list-win.active .header-paginator .fc-header-right span.fc-button:not(.fc-button-print)').remove();
 	$(currentView+' .events-list.events-list-win.active .list-events-paginator .fc-header-title').html('<h2>Resultados para: '+$(currentView+' [name = keyword]').val()+'</h2>');
 	if((parseInt($(currentView+' [name = page_index]').val()) == 0) && (parseInt($(currentView+' [name = results]').val()) <= 25))
@@ -2442,5 +2455,5 @@
 	paginatorSearch(currentView);
     }else
-	paginatorList(currentView, view);
+	paginatorList(currentView, view, type);
 }
 
@@ -2450,8 +2463,8 @@
 	case 'basicDay':
 	case 'agendaDay':
-	    rangeStart = new Date().add({
+	    rangeStart = new Date.today().add({
 		days: page_index
 	    }).getTime();
-	    rangeEnd = rangeStart;
+	    rangeEnd = rangeStart + 86400000;
 	    break;
 	case 'agendaWeek':
@@ -2519,11 +2532,17 @@
 }
 
-function pageselectCallback(keyword, page_index, jq, view){
-	
-    var selecteds = getSelectedCalendars();
-    if(!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>Por favor selecione ao menos uma agenda.</label>' +
+function pageselectCallback(keyword, page_index, view, type){
+    $('.qtip.qtip-blue').remove();
+	var tab_selector = ['tab_events_list_', 'tab_tasks_list_', 'tab_all_list_'];
+	var tab_title = ['Lista de eventos', 'Lista de tarefas'];
+	var label_noselect_calendar = ['Por favor selecione ao menos uma agenda.', 'Por favor selecione ao menos um grupo.', 'Por favor selecione ao menos uma agenda ou grupo.'];
+	var label_nofound_search = ['Não foi encontrado nenhum evento correspondente à sua pesquisa.', 'Não foi encontrado nenhuma tarefa ou atividade correspondente à sua pesquisa.', 'Não foi encontrado nenhum evento ou tarefa ou atividade correspondente à sua pesquisa.'];
+	var label_nofound = ['Não foram encontrados eventos neste intervalo.', 'Não foram encontradas tarefas ou atividades neste intervalo.', 'Não foram encontrados eventos ou tarefas ou atividades neste intervalo.'];
+	var selecteds = getSelectedCalendars(false, type);
+    
+	if(!selecteds && (keyword != '' && keyword != null)){	
+	jQuery('#'+tab_selector[type] + ((Base64.encode(keyword)).replace(/[^\w\s]/gi, "")|| '')).html(
+	    '<div title="'+tab_title[type]+'" class="events-list events-list-win active empty">' +
+	    '<label>'+label_noselect_calendar[type]+'</label>' +
 	    '</div>'
 	    );
@@ -2545,13 +2564,13 @@
     var results = DataLayer.get('schedulable:detail', criteria);
     keyword = ( keyword || '' ).replace( /\s+/g, "_" );	
-}
+	}
 // não há resultados	
 
-var currentView = '#tab_events_list_' + ((Base64.encode(keyword)).replace(/[^\w\s]/gi, "") || '');
+var currentView = '#'+tab_selector[type] + ((Base64.encode(keyword)).replace(/[^\w\s]/gi, "") || '');
 
 if ((((typeof(results) == 'undefined') || (!results.events_list )) && selecteds) &&(keyword != '' && keyword != null)) {
     $(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 title="'+title+'" class="events-list events-list-win active empty">' +
+		'<label>'+label_nofound_search[type]+'</label>' +
 		'</div>'
 	);
@@ -2561,5 +2580,5 @@
 		results['page_index'] = page_index;
 		results['keyword'] = keyword;
-				
+		results['tab_title'] = tab_title[type];	
 		DataLayer.render( 'templates/event_list.ejs', results, function( html ){
 			
@@ -2567,44 +2586,67 @@
 			$('.events-list-win .menu-container .button').button();
 															
-			$(".event-details-item").parent().click(function(){
-
+			$(".event-details-item").parent().click(function(event){
+			event.stopImmediatePropagation();
 			$(this).siblings("div.details-event-list").toggleClass("hidden")
-			.find('.button.delete').click(function(){
+			.find('.button.delete').click(function(event){
 				var eventId = $(this).siblings('[name="eventid"]').val();
 				var calendarId = $(this).siblings('[name="calendarid"]').val();
-
 				remove_event(eventId, calendarId);
+				event.stopImmediatePropagation()
 			})
-			.end().find('.button.edit').click(function(){				
-				eventDetails( DataLayer.get( "schedulable", $(this).siblings('[name="eventid"]').val() ), true );					
+			.end().find('.button.edit').click(function(event){	
+				if($(this).siblings('[name="eventtype"]').val() == 1)
+					eventDetails( DataLayer.get( "schedulable", $(this).siblings('[name="eventid"]').val() ), true );		
+				else
+					taskDetails( DataLayer.get( "schedulable", $(this).siblings('[name="eventid"]').val() ), true );
+					
+				event.stopImmediatePropagation()
+			})
+			.end().find('.button.print').click(function(event){	
+				var window_print = window.open('','ExpressoCalendar','width=800,height=600,scrollbars=yes');
+				var html = $(this).parents("td:first").clone();
+				html.find(".menu-container.footer-container").remove();
+				var html = html.html();
+				var data = {
+					type : $(this).parents('.details-event-list').hasClass("details-event") ? "event-detail" : "task-detail",
+					html : html
+				}
+				window_print.document.open();		
+				window_print.document.write(DataLayer.render('templates/calendar_list_print.ejs', data));
+				window_print.document.close();
+				window_print.print();
+				
+				event.stopImmediatePropagation()
 			});
 
 			});
-			paginatorListEvent(currentView, (keyword == '' || keyword == null) ? 'list' : 'search',  !!view ? view : User.preferences.defaultCalView);
+			paginatorListEvent(currentView, (keyword == '' || keyword == null) ? 'list' : 'search',  !!view ? view : User.preferences.defaultCalView, type);
 		});
     }else{
 		$(currentView).html(
-			'<div title="Lista de eventos" class="events-list events-list-win active empty">' +
+			'<div title="'+title+'" 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>' +
+			'<label class="empty-result">'+label_nofound[type]+'</label>' +
 			'</div>'
 			);
-		paginatorListEvent(currentView, 'list', !!view ? view : User.preferences.defaultCalView);
-    }
-}
-	if(currentView != '#tab_events_list_')
+		paginatorListEvent(currentView, 'list', !!view ? view : User.preferences.defaultCalView, type);
+    }
+}
+	if(currentView != '#'+tab_selector[type])
 	    $tabs.tabs("select", currentView);
 }
 
-function show_modal_import_export(tab, calendarId) {
+function show_modal_import_export(tab, calendarId, typeView){
+    $('.qtip.qtip-blue').remove();
     DataLayer.render( 'templates/import_export.ejs', {
-	calendars: Calendar.calendars, 
-	owner: User.me.id
+	calendars: typeView == 0 ? Calendar.calendars : Calendar.groups, 
+	owner: User.me.id,
+	typeView: typeView
 	}, function( html ){
 
 	if (!UI.dialogs.importCalendar) {
 	    UI.dialogs.importCalendar = jQuery('#div-import-export-calendar')
-	    .append('<div title="Importar e Exportar Eventos" class="import-export import-export-win active"> <div>')
+	    .append('<div title="Importar e Exportar "' + (typeView == 0 ? 'Eventos' : 'Tarefas') + '" class="import-export import-export-win active"> <div>')
 	    .find('.import-export-win.active').html(html).dialog({
 		resizable: false, 
@@ -2831,2 +2873,141 @@
     }
 }
+
+function extendsFileupload(view, path){
+    var viewName = 'div.new-'+view+'-win';
+    
+    path = !!path ? path : '';
+    
+    var maxSizeFile = 2000000;
+    $('#fileupload'+view).fileupload({
+	sequentialUploads: true,
+	add: function (e, data) {
+	    if(data.files[0].size < maxSizeFile)
+		data.submit();
+	},
+	change: function (e, data) {
+	    $.each(data.files, function (index, file) {
+		var attach = {};
+		attach.fileName = file.name;
+		var ext = file.name.split('.');
+		if(file.name.length > 10)
+		    attach.fileName = ext.length == 1 ? file.name.substr(0, 10) :  file.name.substr(0, 6) + '.' + ext[ext.length -1];
+		attach.fileSize = formatBytes(file.size);
+		if(file.size > maxSizeFile)
+		    attach.error = 'Tamanho de arquivo nao permitido!!'
+				
+		$(viewName+' .attachments-list').append(DataLayer.render(path+'templates/attachment_add_itemlist.ejs', {
+		    file : attach
+		}));
+				
+		if(file.size < maxSizeFile){
+		    $(viewName+' .fileinput-button.new').append(data.fileInput[0]).removeClass('new');
+		    $(viewName+' .attachments-list').find('[type=file]').addClass('hidden');
+					
+		}else
+		    $(viewName+' .fileinput-button.new').removeClass('new');
+				
+				
+		$(viewName+' .attachments-list').find('.button.close').button({
+		    icons: {
+			primary: "ui-icon-close"
+		    },
+		    text: false
+		}).click(function(){
+		    var idAttach = $(this).parent().find('input[name="fileId[]"]').val();
+		    $(viewName+' .attachment-list').find('input[value="'+idAttach+'"]').remove();
+		    $(this).parent().remove();
+		
+		    if(!$(viewName+' .attachment-list input').length)
+			$(viewName+' .btn-danger.delete').addClass('hidden');
+		
+		});	
+				
+	    })
+	},
+	done: function(e, data){
+	    var currentUpload = $(viewName+' .progress.after-upload:first').removeClass('after-upload').addClass('on-complete').hide();
+
+	    if(!!data.result && data.result != "[]"){
+		$(viewName+' .btn-danger.delete').removeClass('hidden');
+		var newAttach = (attch = jQuery.parseJSON(data.result)) ? attch : jQuery.parseJSON(data.result[0].activeElement.childNodes[0].data);
+		$(viewName+' .attachment-list').append('<input tyepe="hidden" name="attachment[]" value="'+newAttach['attachment'][0][0].id+'"/>');
+		currentUpload.removeClass('on-complete').parents('p')
+		.append('<input type="hidden" name="fileId[]" value="'+newAttach['attachment'][0][0].id+'"/>')
+		.find('.status-upload').addClass('ui-icon ui-icon-check');
+	    }else
+		currentUpload.removeClass('on-complete').parents('p').find('.status-upload').addClass('ui-icon ui-icon-cancel');
+	}
+    });
+    $('.attachments-list .button').button();    
+
+    if(!!window.FormData)			
+	$('#fileupload'+view).bind('fileuploadstart', function () {
+	    var widget = $(this),
+	    progressElement = $('#fileupload-progress-'+view).fadeIn(),
+	    interval = 500,
+	    total = 0,
+	    loaded = 0,
+	    loadedBefore = 0,
+	    progressTimer,
+	    progressHandler = function (e, data) {
+		loaded = data.loaded;
+		total = data.total;
+	    },
+	    stopHandler = function () {
+		widget
+		.unbind('fileuploadprogressall', progressHandler)
+		.unbind('fileuploadstop', stopHandler);
+		window.clearInterval(progressTimer);
+		progressElement.fadeOut(function () {
+		    progressElement.html('');
+		});
+	    },
+	    formatTime = function (seconds) {
+		var date = new Date(seconds * 1000);
+		return ('0' + date.getUTCHours()).slice(-2) + ':' +
+		('0' + date.getUTCMinutes()).slice(-2) + ':' +
+		('0' + date.getUTCSeconds()).slice(-2);
+	    },
+	    /* formatBytes = function (bytes) {
+            if (bytes >= 1000000000) {
+                return (bytes / 1000000000).toFixed(2) + ' GB';
+            }
+            if (bytes >= 1000000) {
+                return (bytes / 1000000).toFixed(2) + ' MB';
+            }
+            if (bytes >= 1000) {
+                return (bytes / 1000).toFixed(2) + ' KB';
+            }
+            return bytes + ' B';
+        },*/
+	    formatPercentage = function (floatValue) {
+		return (floatValue * 100).toFixed(2) + ' %';
+	    },
+	    updateProgressElement = function (loaded, total, bps) {
+		progressElement.html(
+		    formatBytes(bps) + 'ps | ' +
+		    formatTime((total - loaded) / bps) + ' | ' +
+		    formatPercentage(loaded / total) + ' | ' +
+		    formatBytes(loaded) + ' / ' + formatBytes(total)
+		    );
+	    },
+	    intervalHandler = function () {
+		var diff = loaded - loadedBefore;
+		if (!diff) {
+		    return;
+		}
+		loadedBefore = loaded;
+		updateProgressElement(
+		    loaded,
+		    total,
+		    diff * (1000 / interval)
+		    );
+	    };
+	    widget
+	    .bind('fileuploadprogressall', progressHandler)
+	    .bind('fileuploadstop', stopHandler);
+	    progressTimer = window.setInterval(intervalHandler, interval);
+	});
+    
+}
Index: trunk/prototype/modules/calendar/js/init.js
===================================================================
--- trunk/prototype/modules/calendar/js/init.js	(revision 6444)
+++ trunk/prototype/modules/calendar/js/init.js	(revision 6996)
@@ -147,4 +147,161 @@
 			}, true );
 		});
+		
+		var currentToolTip = null;
+		$('#divAppbox').on('scroll',function(){
+			if ($(".new-task").length)			
+				currentToolTip.qtip('destroy');
+		});
+		
+		/* Quick add task
+      	-----------------------------------------------------------------*/
+		$(".button.add.add-task").click(function(event){
+			currentToolTip = $(this);
+			var componente = $(this);
+			
+            if(!$('div.qtip.qtip-blue.new-task').length){
+
+                $('div.qtip.qtip-blue').remove();
+
+    			$(componente).qtip({
+    			    show: {
+    			    	ready: true, 
+    		    		solo: true, 
+    		    		when: {
+    			    		event: 'click'
+    			    	}
+    				},
+    				hide: false,
+    				content: {
+    					text: $('<div></div>').html( DataLayer.render( 'templates/task_quick_add.ejs', {"componente" : componente} ) ),
+    					title: {
+    						text:'Nova tarefa', 
+    						button: '<a class="button close" href="#">close</a>'
+    					}
+    				},
+    				style: {
+    					name: 'blue', 
+    			    	tip: {
+    						corner: 'leftMiddle'
+    					}, 
+    		    		border: {
+    					    width: 4, 
+    					    radius: 8
+    					}, 
+    			    	width: {
+    						min: 225, 
+    					    max:225
+    					}
+    		   		},
+    		    	position: {
+    		    		corner: {
+    					    target: 'rightMiddle',
+    					    tooltip: 'leftMiddle'
+    		    		},
+    		    		adjust: {
+    					    x:0, 
+    					    y:0
+    		    		}
+    		    	}
+    		    })
+    	    	.qtip("api").onShow = function(arg0) {
+
+	    		/*------------------------------------------------------------------------*/
+	    		/*               Seta os valores padrões nos inputs do qtip               */
+	    		 $('div.qtip div.add-simple-task input.task').Watermark("Tarefa sem título");
+			     $('div.qtip div.add-simple-task textarea').Watermark("Descrição");
+    			/*------------------------------------------------------------------------*/
+
+    			    $('.qtip-active .button.close').button({
+    				icons: {
+    				    primary: "ui-icon-close"
+    				},
+    				text: false
+    			    })
+    			    .click(function(){
+    					$(componente).qtip('destroy');
+    			    });
+    							
+    			    $('.qtip-active .button.save').button().click(function(){
+    			    	
+    			    	var title = $('div.qtip div.add-simple-task input.task').val();
+    					var description = $('div.qtip div.add-simple-task textarea').val();
+
+    					var calendar, timezone = '';
+
+    					for (var i = 0; i < Calendar.signatures.length; i++){
+    						if(Calendar.signatures[i].type == 1 && Calendar.signatures[i].calendar.type == 1){
+    							calendar = Calendar.signatures[i].calendar.id;
+    							timezone = Calendar.signatures[i].calendar.timezone;
+    							break;
+    						}
+    					}
+
+    			    	DataLayer.put('schedulable', 
+    		    		{
+    		    			summary: title, 
+    		    			description: description, 
+    		    			type: '2', 
+    		    			calendar: calendar, 
+    		    			timezone: timezone,
+							status: '1',
+    		    			startTime: new Date().toString('yyyy-MM-dd 00:00:00'),
+    		    			endTime: new Date().toString('yyyy-MM-dd 00:00:00'),
+    		    			allDay: '1',
+					participants: 
+					[{  
+					    user: User.me.id, 
+					    isOrganizer: 1,
+					    acl: 'row'
+					}]
+    		    		});
+    			    	
+                        $(componente).qtip('destroy');
+
+                    });
+
+    			    $('.qtip-active .button.advanced').button().click(function(){
+
+    			    	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);
+    			
+						var componente = $(this);
+                        var description = $('div.qtip div.add-simple-task textarea[name="description"]').val();
+
+    					taskDetails({
+                            summary: $('div.qtip div.add-simple-task input[name="summary"]').val(),
+                            description: description == 'Descrição' ? '' : description,
+    						startTime: startEvent.getTime(),
+    						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 );
+
+                        $(componente).qtip('destroy');
+    			    });
+    								
+    				$('.qtip-active .button.cancel').button().click(function(){
+    					$(componente).qtip('destroy');
+    			    });
+    							
+    			    $('.qtip-active .button').button();
+    			
+    			$('div.qtip.qtip-blue.qtip-active').addClass('new-task');
+            }
+	}
+		});
+
+	$(".button.add.add-activity").click(function(event){
+			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); 
+			
+			activityDetails({ 
+				startTime: startEvent.getTime(),
+				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 );
+
+	});
 
 	var calendar = $('#calendar').fullCalendar(DataLayer.merge({ 
@@ -189,9 +346,21 @@
 			year: 'ano'
 		},
+		
+		eventRender: function( event, element, view ){
 		/*
-		eventRender: function( event, element, view ){
-			$(element).attr( 'event-id', event.id );
-		},
-		*/
+			 * TODO - Encontrar icones mais filé
+			 */
+			var img_icon = "";
+			if(event.type == 1)
+				img_icon = "mini-event.png";
+			if(event.type == 2)
+				img_icon = "mini-task.png";
+			if(event.type == 3)
+				img_icon = "activity_icon.jpg";
+
+			
+    	    element.find(".fc-event-inner.fc-event-skin").prepend($('<img style="width: 11px; height: 13px;" class="" src="../prototype/modules/calendar/img/' + img_icon + '"></img>'));
+		},
+		
 		select: function( start, end, allDay, event, view ){
 			if (view.name == "month") {
@@ -285,36 +454,48 @@
 		eventClick: function( evt, event, view ){
 			evt.id = evt.id.split('-')[0];
-                        if(evt.selectable){
-                            if(evt.isRepeat){
-                                $.Zebra_Dialog(evt.title + ' é um evento com repetição.', {
-                                        'type':     'question',
-                                        'overlay_opacity': '0.5',
-                                        'buttons':  ['Editar todas ocorrências', 'Editar essa ocorrência'],
-                                        'onClose':  function(clicked) {
-                                                if(clicked == 'Editar todas ocorrências') {
-                                                    eventDetails( DataLayer.get( "schedulable", evt.id), true);
-                                                }else{
-                                                    /*
-                                                    * TODO - repeat foi adicionado pois melhorias devem ser feitas no rollback do
-                                                    *DataLayer, repeat somente é usado quando se trata da criação de um evento
-                                                    *pela edição de uma ocorrência.
-                                                    */      
-                                                    var repeat = mount_exception(evt.id, evt.occurrence);
-                                                                                                  
-                                                    $('.calendar-copy-move input[name="typeEvent"]').val("3");
-                                                    
-                                                    eventDetails(copyAndMoveTo(false , evt.id , false, "3", evt), true, '', false, repeat);
-                                                }       
-                                        }
-                                });
-                                
-                            }else{
-				var schedulable = DataLayer.get( "schedulable", evt.id);
-				schedulable.calendar = evt.calendar;
-				eventDetails( schedulable, true);
-				
-			    }
-                                
+            
+            switch (parseInt(evt.type)){
+                case 1:
+                    if(evt.selectable){
+                        if(evt.isRepeat){
+                            $.Zebra_Dialog(evt.title + ' é um evento com repetição.', {
+                                'type':     'question',
+                                'overlay_opacity': '0.5',
+                                'buttons':  ['Editar todas ocorrências', 'Editar essa ocorrência'],
+                                'onClose':  function(clicked) {
+                                    if(clicked == 'Editar todas ocorrências') {
+                                        eventDetails( DataLayer.get( "schedulable", evt.id), true);
+                                    }else{
+                                        /*
+                                        * TODO - repeat foi adicionado pois melhorias devem ser feitas no rollback do
+                                        *DataLayer, repeat somente é usado quando se trata da criação de um evento
+                                        *pela edição de uma ocorrência.
+                                        */      
+                                        var repeat = mount_exception(evt.id, evt.occurrence);
+                                                                                          
+                                        $('.calendar-copy-move input[name="typeEvent"]').val("3");
+                                        
+                                        eventDetails(copyAndMoveTo(false , evt.id , false, "3", evt), true, '', false, repeat);
+                                    }       
+                                }
+                            });
+                        }else{
+                            var schedulable = DataLayer.get( "schedulable", evt.id);
+                            schedulable.group = evt.calendar;
+                            eventDetails( schedulable, true);
+                            }
                         }
+                        break;
+                    case 2:
+                        var task = DataLayer.get( "schedulable", evt.id);
+                        task.group = evt.calendar;
+                        taskDetails( task, true);
+                        break;
+                    case 3:
+                        var activity = DataLayer.get( "schedulable", evt.id);
+                        activity.group = evt.calendar;
+                        activityDetails( activity, true);
+                        break;
+            }
 		},
 		
@@ -322,6 +503,7 @@
 			contentMenu();
 		}
-	}, dateCalendar));
- 
+	}, dateCalendar));	
+		
+		
 	contentMenu();
 	 
@@ -346,4 +528,9 @@
 	});	  
 	//Todo chamada do metodo que adiciona ao full calendar o botao de listagem de eventos  
-	//listEvents();
+	printEvents();
 });
+
+
+function useDesktopNotification(){
+	return !!parseInt(User.preferences.useDesktopNotification);
+}
Index: trunk/prototype/modules/calendar/js/task.helpers.js
===================================================================
--- trunk/prototype/modules/calendar/js/task.helpers.js	(revision 6996)
+++ trunk/prototype/modules/calendar/js/task.helpers.js	(revision 6996)
@@ -0,0 +1,1034 @@
+function validDateTask(){
+	
+	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' : 'Data final menor que a inicial',		
+		'theirHour' : 'Hora final menor que a inicial',
+		
+		'dueInitDate' : 'Previsão de término menor que a data inicial', 
+		'dueEndDate'  : 'Previsão de término menor que a data final',
+		'dueTime'	  : 'Deve ser definido a hora da Previsão de Término',
+		'dueDate'  	  : 'Deve ser definido a Previsão de Término',
+		'invalidDueData' : 'Data de Previsão de Término inválida'
+	};
+
+    var start_date = $(".new-task-win.active .start-date").val();
+    var end_date   = $(".new-task-win.active .end-date").val();
+    var start_time = $(".new-task-win.active .start-time").val();
+    var end_time   = $(".new-task-win.active .end-time").val();
+	var due_date   = $(".new-task-win.active .date-previsao").val();
+	var due_time   =  $.trim($(".new-task-win.active .time-previsao").val());
+    var isAllDay   = $('.new-task-win.active input[name="allDay"]').is(':checked');
+    var customDate = $(".endRepeat").val() == "customDate";
+    var occurrences = $(".endRepeat").val() == "occurrences";
+    var taskInterval = $('.taskInterval').val();
+    
+    if(start_date == "")
+		return errors['emptyInitData'];
+    else if(end_date == "")
+		return errors['emptyEndData'];
+    else if(!isAllDay && start_time == "")
+		return errors['emptyInitHour'];
+    else if(!isAllDay && end_time == "")
+		return errors['emptyEndHour'];
+	else if(due_date != "" && due_time == "")
+		return errors['dueTime'];
+	else if(due_date == "" && due_time != "")
+		return errors['dueDate'];
+	
+    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 );
+	var dueDate = Date.parseExact( due_date + " " + $.trim(due_time) , formatString );
+
+    if(startDate == null || startDate.getTime() < 0 )
+		return errors['invalidInitData'];
+    if(endDate == null || endDate.getTime() < 0)
+		return errors['invalidEndData'];
+	if(dueDate == null &&  due_time != "")
+		return errors['invalidDueData'];
+		
+	if(isAllDay){
+		startDate.clearTime();
+		endDate.clearTime();
+		if(endDate.compareTo(startDate) == -1)
+			return errors['theirData'];
+	}else{
+		var condition = endDate.compareTo(startDate);
+		if(condition != 1){
+			if(condition < 0){
+				startDate.clearTime();
+				endDate.clearTime();
+				condition = endDate.compareTo(startDate);				
+				return (errors[ condition == 0 ? 'theirHour' : 'theirData'] );
+			}
+			else
+				return errors['equalData'];
+		}
+		
+		if (dueDate != null && dueDate.compareTo(startDate) == -1)
+			return errors['dueInitDate'];		
+	}
+    
+    if (customDate)    
+		if ( !($('.new-task-win.active .customDateEnd').val().length) )
+		   return errors['emptyEndData'];
+
+    return false;
+}
+
+function todoStatus(view, status){
+	if (status == "1"){
+		UI.dialogs[view].find('.subitem .span_done').removeClass('finished noAction inProcess canceled').addClass('noAction');
+	}else if (status == "2"){
+		UI.dialogs[view].find('.subitem .span_done').removeClass('finished noAction inProcess canceled').addClass('inProcess');
+	}else if (status == "3"){
+		UI.dialogs[view].find('.subitem .span_done').removeClass('finished noAction inProcess canceled').addClass('finished');
+	}else if (status == "4"){
+		UI.dialogs[view].find('.subitem .span_done').removeClass('finished noAction inProcess canceled').addClass('canceled');
+	}
+}
+
+function taskDetails(objTask, decoded, path, isMail, repeat, isActivityView) {
+
+    $('.qtip.qtip-blue').remove();
+
+    attendees = {};
+
+    if (path == undefined) path = "";
+
+    if (!decoded) objTask = DataLayer.decode("task:calendar", objTask);
+
+    if (!isMail) objTask = DataLayer.encode("schedulable:task", objTask);
+
+    if (typeof (objTask.id) == 'undefined') {
+        objTask.alarms = Calendar.signatureOf[User.preferences.defaultCalendar || Calendar.calendarIds[0]].defaultAlarms || false;
+        objTask.useAlarmDefault = 1;
+    }
+
+
+    if(objTask.me.id == User.me.id){
+        objTask.me.id = DataLayer.put('participant', {
+            user: objTask.me.id, 
+            mail: objTask.me.mail
+        });
+        objTask.organizer.id = objTask.me.id;
+    }
+
+    var dependsDelegate = function(reference, inverse){
+        if(inverse){
+            if(reference.find('input[name="attendee[]"]').val() == blkAddAtendee.find('li.organizer input[name="attendee_organizer"]').val())
+                blkAddAtendee.find('li.organizer input[name="attendee_organizer"]').val(blkAddAtendee.find('.me input[name="attendee[]"]').val());
+        }else{
+            if(blkAddAtendee.find('.me input[name="attendee[]"]').val() == blkAddAtendee.find('li.organizer input[name="attendee_organizer"]').val())
+                blkAddAtendee.find('li.organizer input[name="attendee_organizer"]').val(reference.find('input[name="attendee[]"]').val());
+        }
+    };
+
+    var removeOthers = function(){
+        var other = blkAddAtendee.find('.delegate.attendee-permissions-change-button');
+        if(other.lenght)
+            dependsDelegate(other.parents('li'), true);
+
+        blkAddAtendee.find('.delegate').removeClass('attendee-permissions-change-button');
+        blkAddAtendee.find('.ui-icon-transferthick-e-w').removeClass('attendee-permissions-change');
+    
+    };
+
+    var callbackAttendee = function(){
+        var checked = false;
+        blkAddAtendee.find("li.not-attendee").addClass('hidden');
+        
+        blkAddAtendee.find("li .button").filter(".close.new").button({
+            icons: {
+            primary: "ui-icon-close"
+            },
+            text: false
+        }).click(function () {
+            DataLayer.remove('participant', $(this).parents('li').find('[type=checkbox]').val());
+            if($(this).parent().find('.button.delegate').hasClass('attendee-permissions-change-button')){
+                removeOthers();
+                blkAddAtendee.find('.request-update').addClass('hidden');
+                blkAddAtendee.find('.status option').toggleClass('hidden');
+                        
+                blkAddAtendee.find('option[value=1]').attr('selected','selected').trigger('change');
+            }
+                
+            $(this).parents('li').remove();
+                
+            if(blkAddAtendee.find(".attendee-list li").length == 1)
+                blkAddAtendee.find("li.not-attendee").removeClass('hidden');
+        })
+        .addClass('tiny disable ui-button-disabled ui-state-disabled')
+        .removeClass('new').end()
+        
+        .filter(".delegate.new").button({
+            icons: {
+                primary: "ui-icon-transferthick-e-w"
+            },
+            text: false
+        }).click(function () {
+            var me = $(this).parents('li');
+            if($(this).hasClass('attendee-permissions-change-button')){
+                $(this).removeClass('attendee-permissions-change-button')   
+                .find('.ui-icon-transferthick-e-w').removeClass('attendee-permissions-change').end();               
+            
+                me.find('input[name="delegatedFrom[]"]').val('');
+                dependsDelegate(me, true);
+                        
+                blkAddAtendee.find('.request-update').addClass('hidden');
+                blkAddAtendee.find('.status option').toggleClass('hidden');
+
+                blkAddAtendee.find('option[value=1]').attr('selected','selected').trigger('change');
+                    
+            }else{
+                removeOthers();
+                
+                $(this).addClass('attendee-permissions-change-button')   
+                .find('.ui-icon-transferthick-e-w').addClass('attendee-permissions-change').end();               
+                
+                me.find('input[name="delegatedFrom[]"]').val(blkAddAtendee.find('.me input[name="attendee[]"]').val());
+                
+                dependsDelegate(me, false);
+                    
+                blkAddAtendee.find('.request-update').removeClass('hidden');
+                if(blkAddAtendee.find('.status option.hidden').length == 1)
+                    blkAddAtendee.find('.status option').toggleClass('hidden');
+                    
+                blkAddAtendee.find('option[value=5]').attr('selected','selected').trigger('change');
+            }
+        })
+        .addClass('tiny disable ui-button-disabled ui-state-disabled')
+        .removeClass('new').end()            
+            
+        .filter(".open-delegate.new").click(function(){
+            if($(this).hasClass('ui-icon-triangle-1-e')){
+                $(this).removeClass('ui-icon-triangle-1-e').addClass('ui-icon-triangle-1-s');
+                $(this).parents('li').find('.list-delegates').removeClass('hidden');
+            }else{
+                $(this).removeClass('ui-icon-triangle-1-s').addClass('ui-icon-triangle-1-e');
+                $(this).parents('li').find('.list-delegates').addClass('hidden');
+            }
+            
+        }).removeClass('new');
+
+        UI.dialogs.addTask.find('.attendees-list li').hover(
+            function () {
+                $(this).addClass("hover-attendee");
+                $(this).find('.button').removeClass('disable ui-button-disabled ui-state-disabled').end()
+                .find('.attendee-options').addClass('hover-attendee');
+            },
+            function () {
+                $(this).removeClass("hover-attendee");
+                $(this).find('.button').addClass('disable ui-button-disabled ui-state-disabled').end()
+                .find('.attendee-options').removeClass('hover-attendee');
+            }
+        );        
+    }
+
+    /**
+     * canDiscardTaskDialog deve ser true se não houver alterações no task
+     */
+    canDiscardTaskDialog = true;
+    /**
+     * zebraDiscardTaskDialog é uma flag indicando que uma janela de confirmação (Zebra_Dialog)
+     * já estão aberta na tela, uma vez que não é possivel acessar o task ESC utilizado para fechá-la
+     */
+    zebraDiscardTaskDialog = false;
+
+    var html = DataLayer.render(path + 'templates/task_add.ejs', {
+        task: objTask
+    });
+
+    if (!UI.dialogs.addTask) {
+
+        UI.dialogs.addTask = jQuery('#sandbox').append('<div title="Criar tarefa" class="new-task-win active"> <div>').find('.new-task-win.active').html(html).dialog({
+            resizable: false,
+            modal: true,
+            autoOpen: false,
+            width: 775,
+            position: 'center',
+            close: function (event, ui) {
+                /**
+                 * Remove tooltip possivelmente existente
+                 */
+                if ($('.qtip.qtip-blue.qtip-active').length) $('.qtip.qtip-blue.qtip-active').qtip('destroy');
+                attendees = {};
+            },
+            beforeClose: function (event, ui) {
+
+                if (!canDiscardTaskDialog && !zebraDiscardTaskDialog) {
+                    zebraDiscardTaskDialog = true;
+                    window.setTimeout(function () {
+                        $.Zebra_Dialog('Suas alterações na tarefa não foram salvas. Deseja descartar as alterações?', {
+                            'type': 'question',
+                            'overlay_opacity': '0.5',
+                            'buttons': ['Descartar alterações', 'Continuar editando'],
+                            'onClose': function (clicked) {
+                                if (clicked == 'Descartar alterações') {
+                                    canDiscardTaskDialog = true;
+                                    /**
+                                     *Remoção dos anexos da task caso seja cancelado a edição
+                                     */
+                                    DataLayer.rollback();
+
+                                    var ids = false;
+                                    $.each($('.attachment-list input'), function (i, input) {
+                                        DataLayer.put('attachment', {
+                                            id: '' + input.value
+                                        });
+                                        DataLayer.remove('attachment', '' + input.value);
+                                        ids = true;
+                                    });
+                                    if (ids) DataLayer.commit();
+
+                                    UI.dialogs.addTask.dialog('close');
+                                } else {
+                                    zebraDiscardTaskDialog = false;
+                                }
+
+                                /**
+                                 * Uma vez aberta uma janela de confirmação (Zebra_Dialog), ao fechá-la
+                                 * com ESC, para que o task ESC nÃo seja propagado para fechamento da
+                                 * janela de edição de tasks, deve ser setada uma flag indicando que
+                                 * já existe uma janela de confirmação aberta.
+                                 */
+                                if (!clicked) {
+                                    window.setTimeout(function () {
+                                        zebraDiscardTaskDialog = false;
+                                    }, 200);
+                                }
+                            }
+                        });
+
+                    }, 300);
+
+                }
+                //DataLayer.rollback();
+                return canDiscardTaskDialog;
+            },
+            dragStart: function (task, ui) {
+                if ($('.qtip.qtip-blue.qtip-active').length) $('.qtip.qtip-blue.qtip-active').qtip('destroy');
+            }
+        });
+
+    } else {
+        UI.dialogs.addTask.html(html);
+    }
+
+    var tabs = UI.dialogs.addTask.children('.content').tabs({
+        select: function (task, ui) {
+            if ($('.qtip.qtip-blue.qtip-active').length) $('.qtip.qtip-blue.qtip-active').qtip('destroy');
+        }
+    });
+    var group = DataLayer.get('calendar', objTask.group);
+
+    if (group.timezone != objTask.timezone) {
+        UI.dialogs.addTask.find('.calendar-addtask-details-txt-timezone').find('option[value="' + objTask.timezone + '"]').attr('selected', 'selected').trigger('change');
+        UI.dialogs.addTask.find('.calendar_addtask_details_lnk_timezone').addClass('hidden');
+        $('.calendar-addtask-details-txt-timezone').removeClass('hidden');
+
+    }
+
+    UI.dialogs.addTask.find('.calendar_addtask_details_lnk_timezone').click(function (e) {
+        $(this).addClass('hidden');
+        $('.calendar-addtask-details-txt-timezone').removeClass('hidden');
+        e.prtaskDefault();
+    });
+
+    UI.dialogs.addTask.find('.button.remove').button({
+    text:false, 
+    icons:{
+        primary:'ui-icon-close'
+    }
+    }).click(function(el){
+        var id;
+        if( id = $(this).parent().find('input[name="alarmId[]"]').val())
+        DataLayer.remove('alarm', id);
+        $(this).parent().remove().find('li').is(':empty');
+    });
+
+    /*Seleciona a agenda padrão para visualização edição de um task*/
+    if (objTask.id) UI.dialogs.addTask.find('select[name="group"] option[value="' + objTask.group + '"]').attr('selected', 'selected').trigger('change');
+	
+	UI.dialogs.addTask.find(':input').change(function(event){
+    if (event.keyCode != '27' && event.keyCode != '13')
+	canDiscardTaskDialog = false;
+	}).keydown(function(event){
+		if (event.keyCode != '27' && event.keyCode != '13')
+		canDiscardTaskDialog = false;
+	});
+
+    /* Checkbox allday */
+    UI.dialogs.addTask.find('input[name="allDay"]').click(function () {
+        $(this).attr("checked") ? UI.dialogs.addTask.find('.start-time, .end-time').addClass('hidden') : UI.dialogs.addTask.find('.start-time, .end-time').removeClass('hidden');
+        updateMap(true);
+    });
+	
+	todoStatus('addTask', (objTask.taskStatus  != undefined) ? objTask.taskStatus  : 1);
+	
+	//Conclusão das Tarefas
+	var conclusionTask = function(e){
+		var percentageTask = UI.dialogs.addTask.find('input[name="percentage"]');
+		if( percentageTask.val() == "")
+			percentageTask.val(0);
+		percentageTask.blur().focus();
+		
+		var percentageValue = parseInt(percentageTask.val());
+		var statusTask = UI.dialogs.addTask.find('select[name=taskStatus]');
+		
+		if(percentageValue <= 0){
+			statusTask.find('option.taskStatus-noAction').attr('selected', 'selected');
+			todoStatus('addTask', 1);		
+		}else if(percentageValue == 100){
+			statusTask.find('option.taskStatus-finished').attr('selected', 'selected');
+			todoStatus('addTask', 3);
+		}else{
+			statusTask.find('option.taskStatus-inProcess').attr('selected', 'selected');
+			todoStatus('addTask', 2);
+		}		
+		setTimeout(function(){
+			percentageTask[0].selectionStart = percentageTask.val().length;
+			percentageTask[0].selectionEnd = percentageTask.val().length;
+		}, 10)
+	}
+	UI.dialogs.addTask.find('input[name="percentage"]').spinner({ min: 0, max: 100 }).keyup(conclusionTask).next().find(".ui-spinner-button").click(conclusionTask);	
+
+	//Status das Tarefas
+	UI.dialogs.addTask.find('select[name=taskStatus]').change(function(){
+		var statusSelected = $('select[name=taskStatus] option:selected').val();
+		var percentageTask = UI.dialogs.addTask.find('input[name="percentage"]');
+		
+		if (statusSelected == "1"){
+			percentageTask.val(0);
+		}else if(statusSelected == "2"){
+			percentageTask.val(percentageTask.val() != 0 ? (percentageTask.val() == 100 ? 99: percentageTask.val()) : 1);
+		}else if(statusSelected == "3"){
+			percentageTask.val(100);
+		}else if(statusSelected == "4"){
+			percentageTask.val(percentageTask.val() != 100 ? percentageTask.val() : 99);
+		}
+		todoStatus('addTask', statusSelected);
+	});
+	
+    UI.dialogs.addTask.find('.button').button();
+    UI.dialogs.addTask.find('.button.add').button({
+        icons: {
+            secondary: "ui-icon-plus"
+        }
+    });
+
+    // ==== validation tasks ====
+    UI.dialogs.addTask.find(".input-group .h1").Watermark("Tarefa sem título");
+    if (User.preferences.hourFormat.length == 5) {
+        UI.dialogs.addTask.find(".end-time, .start-time, .time-previsao").mask("99:99", {
+            completed: function () {
+                updateMap();
+            }
+        });
+    } else {
+        $.mask.definitions['{'] = '[ap]';
+        $.mask.definitions['}'] = '[m]';
+        UI.dialogs.addTask.find(".end-time, .start-time").mask("99:99 {}", {
+            completed: function () {
+                $(this).val(date.Calendar.defaultToAmPm($(this).val()));
+                $(this).timepicker("refresh");
+                $(this).val($(this).val().replace(/[\.]/gi, ""));
+                updateMap();
+            }
+        });
+    }
+    UI.dialogs.addTask.find(".number").numeric();
+    User.preferences.dateFormat.indexOf('-') > 0 ? UI.dialogs.addTask.find(".date").mask("99-99-9999", {
+        completed: function () {
+            updateMap();
+        }
+    }) : UI.dialogs.addTask.find(".date").mask("99/99/9999", {
+        completed: function () {
+            updateMap();
+        }
+    });
+
+    UI.dialogs.addTask.find(".menu-addtask").children(".delete").click(function () {
+        $.Zebra_Dialog('Tem certeza que deseja excluir esta tarefa?', {
+            'type': 'question',
+            'overlay_opacity': '0.5',
+            'buttons': ['Sim', 'Não'],
+            'onClose': function (clicked) {
+                if (clicked == 'Sim') {
+                    canDiscardTaskDialog = true; /* Remove por filtro */
+                    DataLayer.removeFilter('schedulable', {
+                        filter: ['AND', ['=', 'id', objTask.id],
+                            ['=', 'calendar', objTask.group],
+                            ['=', 'user', (objTask.me.user ? objTask.me.user.id : objTask.me.id)]
+                        ]
+                    });
+                    Calendar.rerenderView(true); /********************/
+                    UI.dialogs.addTask.dialog("close");
+                }
+            }
+        });
+    }).end()
+
+    .children(".cancel").click(function () {
+        UI.dialogs.addTask.dialog("close");
+    }).end()
+
+    .children(".save").click(function () { /* Validação */
+        UI.dialogs.addTask.find('input[name="summary"]').focus();
+		
+	if (msg = validDateTask()) {
+            $(".new-task-win.active").find('.messages-validation').removeClass('hidden').find('.message label').html(msg);
+            return false;
+        }
+	canDiscardTaskDialog = true;
+	
+	if(isActivityView)
+	    updateActivity = true;
+
+        UI.dialogs.addTask.children().find('form.form-addtask').submit();
+        UI.dialogs.addTask.dialog("close");
+
+    }).end()
+
+    .children(".export").click(function () {
+        UI.dialogs.addTask.children().find(".form-export").submit();
+    });
+
+    var attendeeHtml = DataLayer.render(path + 'templates/attendees_task.ejs', {
+        task: objTask
+    });
+
+    // load template of attendees
+    var blkAddAtendee = UI.dialogs.addTask.find('#calendar_addtask_details6').append(attendeeHtml);
+
+    if(objTask.attendee.length)
+        callbackAttendee();
+
+    /*
+     *   Opções de delegação do participante/organizer
+     */      
+    blkAddAtendee.find(".button.participant-delegate").button({
+        icons: {
+        primary: "ui-icon-transferthick-e-w"
+        },
+        text: false
+    }).click(function () {
+        if($(this).hasClass('attendee-permissions-change-button')){
+        if(!$(this).hasClass('disable')){
+            $(this).removeClass('attendee-permissions-change-button')   
+            .find('.ui-icon-transferthick-e-w').removeClass('attendee-permissions-change').end();               
+            blkAddAtendee.find('.block-add-attendee.search').addClass('hidden');
+            blkAddAtendee.find('.block-add-attendee.search dt').html('Adicionar outros contatos');
+        }
+        }else{                                  
+        $(this).addClass('attendee-permissions-change-button')   
+        .find('.ui-icon-transferthick-e-w').addClass('attendee-permissions-change').end();               
+        blkAddAtendee.find('.block-add-attendee.search dt').html('Delegar participação para');
+        blkAddAtendee.find('.block-add-attendee.search').removeClass('hidden');
+        blkAddAtendee.find('.block-add-attendee.search input.search').focus();
+        }
+    })
+    .addClass('tiny');
+
+    var dates = UI.dialogs.addTask.find('input.date').datepicker({
+        dateFormat: User.preferences.dateFormat.replace(/M/g, 'm').replace(/yyyy/g, 'yy'),
+        onSelect: function (selectedDate) {
+            updateMap();
+        }
+    });
+
+    UI.dialogs.addTask.find('input.time').timepicker({
+        closeText: 'Ok',
+        hourGrid: 4,
+        minuteGrid: 10,
+        ampm: ((User.preferences.hourFormat.length > 5) ? true : false),
+        timeFormat: "hh:mm tt",
+        onSelect: function (selectedDateTime) {
+            if (!(User.preferences.hourFormat.length == 5)) $(this).val(selectedDateTime.replace(/[\.]/gi, ""));
+            updateMap();
+        },
+        onClose: function (selectedDateTime) {
+            if (!(User.preferences.hourFormat.length == 5)) $(this).val(selectedDateTime.replace(/[\.]/gi, ""));
+        }
+    });
+    
+    UI.dialogs.addTask.find(".attendee-list-add .add-attendee-input input").Watermark("digite um email para convidar");
+    /* 
+    * Trata a edição de um novo participante adicionado
+    */
+    var hasNewAttendee = false;
+
+    blkAddAtendee.find('.attendee-list-add .add-attendee-input span').click(function(data){
+	blkAddAtendee.find('.attendee-list-add .add-attendee-input input').keydown();
+    });
+
+    blkAddAtendee.find('.attendee-list-add .add-attendee-input input').keydown(function(event) {
+	if (event.keyCode == '13' && $(this).val() != '' || (event.keyCode == undefined && $(this).val() != '')) {
+	    Encoder.EncodeType = "entity";
+	    $(this).val(Encoder.htmlEncode($(this).val()));
+
+	    newAttendeeEmail = false;
+	    newAttendeeName  = false;
+	    skipAddNewLine   = false;
+
+	    var info = $(this).val();
+
+	    /**
+	    * email válido?
+	    */
+	    info.match(/^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/) ? 
+	    newAttendeeEmail = info : newAttendeeName = info;
+
+	    /**
+	    * 1) busca no banco para saber se o usuário já existe
+	    *		1.1) se existe, atualiza as info na lista de participantes e nao abre o tooltip
+	    *		1.2) se não existe
+	    *			a) salva como novo usuario externo no banco (apenas com email)
+	    *			b) exibe tooltip pedindo o nome
+	    *			c) se o usuário preenche tooltip e salva, atualiza com o nome o usuário recém criado
+	    *			d) se o usuário cancela o tooltip, fica o usuário salvo apenas com email e sem nome
+	    */
+
+	    var user = DataLayer.get('user', ["=", "mail", $(this).val()]);
+	    if(!!user && user[0].id)
+		attendees[user[0].id] = {
+		    name: user[0].name
+		    };
+
+	    /**
+	    * guarda o último tooltip aberto referente à lista de participantes 
+	    */
+	    lastEditAttendeeToolTip = [];
+
+	    /**
+	    * Valida email e salva um participante externo 
+	    */
+	    var saveContact = function() {
+		Encoder.EncodeType = "entity";
+
+		var currentTip = $('.qtip-active');
+		newAttendeeName  = currentTip.find('input[name="name"]').val();
+		newAttendeeEmail = currentTip.find('input[name="mail"]').val();
+
+		if (!(!!newAttendeeEmail.match(/^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/))) {
+		    currentTip.find('.messages').removeClass('hidden').find('.message label').html('Email inválido.');
+		    return false;
+		}
+
+		DataLayer.put('user', {
+		    id:userId, 
+		    name:newAttendeeName, 
+		    mail:newAttendeeEmail, 
+		    isExternal:isExternal
+		});
+
+		lastEditAttendeeToolTip.find('label')
+		.filter('.name').html(Encoder.htmlEncode(newAttendeeName)).attr('title', Encoder.htmlEncode(newAttendeeName)).end()
+		.filter('.mail').html(Encoder.htmlEncode(newAttendeeEmail)).attr('title', Encoder.htmlEncode(newAttendeeEmail));
+
+		blkAddAtendee.find('.attendee-list-add .add-attendee-input input').val('');
+		return true;
+	    }
+
+	    /**
+	    * Formata e adequa um tootip abert para edição de um participante na lista
+	    */
+	    var onShowToolTip = function(arg0) {
+		$('.qtip-active .button.close').button({
+		    icons: {
+			primary: "ui-icon-close"
+		    },
+		    text: false
+		});
+		$('.qtip-active .button').button()
+		.filter('.save').click(function(event, ui) {
+		    if(saveContact())
+			lastEditAttendeeToolTip.qtip("destroy");
+		    else
+			return false;
+		}).end()
+		.filter('.cancel').click(function(event, ui) {
+		    lastEditAttendeeToolTip.qtip("destroy");
+		})
+
+		/** 
+		* Trata o ENTER no campo da tooltip, equivalente a salvar 
+		* o novo convidado.
+		*/
+		$('.qtip-active input').keydown(function(event) {
+		    if (event.keyCode == '13') {						
+			if (saveContact())						
+			    lastEditAttendeeToolTip.qtip("destroy");
+
+			lastEditAttendeeToolTip.qtip("destroy");
+			event.preventDefault();
+		    }
+		})
+		.filter('[name="name"]').Watermark("informe o nome do contato").end()
+		.filter('[name="mail"]').Watermark("informe o email do contato");
+	    }
+
+	    /**
+	    * Se o email digitado já foi adicionado na lista,
+	    * o usuário deve ser avisado e um botão de edição deve ser exibido
+	    */
+	    if(blkAddAtendee.find('label.mail[title="' + newAttendeeEmail + '"]').length) {
+		hasNewAttendee  = false;
+		newAttendeeName = blkAddAtendee.find('label.mail[title="' + newAttendeeEmail + '"]').parents('li').find('label.name').attr('title');
+
+		blkAddAtendee.find('.email-validation').removeClass('hidden')
+		.find('.message label').html("O usuário acima já foi adicionado! <a class=\"small button\">Editar</a>")
+		.find(".button").button().click(function () { 
+		    /**
+		    * Se o usuário optar por editar o participante anteriormente adicionado,
+		    * uma tooltip deve ser aberta para este participante, viabilizando a edição
+		    */
+		    blkAddAtendee.find("ul.attendee-list").scrollTo('label.mail[title="' + newAttendeeEmail + '"]');
+		    /**
+		    * Remove tooltip possivelmente existente
+		    */
+		    if (lastEditAttendeeToolTip.length && lastEditAttendeeToolTip.data('qtip'))
+			lastEditAttendeeToolTip.qtip('destroy');
+
+		    lastEditAttendeeToolTip = blkAddAtendee.find('label.mail[title="' + newAttendeeEmail + '"]').parents('li');
+		    lastEditAttendeeToolTip.qtip({
+			show: {
+			    ready: true, 
+			    solo: true, 
+			    when: {
+				event: 'click'
+			    }
+			},
+		    hide: false,
+		    content: {
+			text: $('<div></div>').html( DataLayer.render( path+'templates/attendee_quick_edit.ejs', {
+			    attendee:{
+				name:newAttendeeName, 
+				mail:newAttendeeEmail
+			    }
+			} ) ), 
+		    title: {
+			text:'Detalhes do participante', 
+			button: '<a class="button close" href="#">close</a>'
+		    }
+		    },
+		    style: {
+			name: 'blue', 
+			tip: {
+			    corner: 'leftMiddle'
+			}, 
+			border: {
+			    width: 4, 
+			    radius: 8
+			}, 
+			width: {
+			    min: 230, 
+			    max:230
+			}
+		    },
+		position: {
+		    corner: {
+			target: 'rightMiddle',
+			tooltip: 'leftMiddle'
+		    },
+		    adjust: {
+			x:0, 
+			y:0
+		    }
+		}
+		});
+	    lastEditAttendeeToolTip.qtip("api").onShow = onShowToolTip;
+	});
+    skipAddNewLine = true;
+    } else {
+	hasNewAttendee  = true;
+	blkAddAtendee.find('.email-validation').addClass('hidden');
+    }
+
+
+    var isExternal = (!!user && !(!!user.isExternal)) ? 0 : 1;
+
+    /**
+    * Remove tooltip possivelmente existente
+    */
+    if (lastEditAttendeeToolTip.length && lastEditAttendeeToolTip.data('qtip'))
+	lastEditAttendeeToolTip.qtip('destroy');
+
+    userId = '';
+    var newAttendeeId = '';
+
+    if (user){
+	if (!skipAddNewLine) {
+	    user[0].id =  DataLayer.put('participant', {
+		user: user[0].id, 
+		isExternal: isExternal, 
+		acl: 'r'
+	    });
+	    user[0].acl = 'r';
+	    user[0].isDirty = !!!objTask.id;
+
+	    blkAddAtendee.find('dd.attendee-list ul.attendee-list').append(
+		DataLayer.render(path+'templates/participants_add_itemlist.ejs', user)
+		)
+	    .scrollTo('max');
+	    callbackAttendee();
+	}
+
+	$(this).val('');
+
+    } else if (!skipAddNewLine) {
+	/**
+	* a) salva como novo usuario externo no banco (apenas com email) e...
+	* adiciona novo contato externo à lista de convidados
+	*/
+
+	userId = DataLayer.put('user', {
+	    name: newAttendeeName, 
+	    mail: newAttendeeEmail, 
+	    isExternal: isExternal
+	});
+	newAttendeeId = DataLayer.put('participant', {
+	    user: userId, 
+	    isExternal: isExternal
+	});
+
+
+	blkAddAtendee.find('dd.attendee-list ul.attendee-list').append(
+	    DataLayer.render(path+'templates/participants_add_itemlist.ejs', [{
+		id:newAttendeeId, 
+		name: newAttendeeName, 
+		mail: newAttendeeEmail, 
+		isExternal: 1, 
+		isDirty: !!!objTask.id
+		}])
+	    ).scrollTo('max');
+	callbackAttendee();
+
+	/** 
+	* Adiciona tootip para atualização dos dados do contato externo
+	* recém adicionado.
+	*/
+	lastEditAttendeeToolTip = blkAddAtendee.find('dd.attendee-list li:last');
+	lastEditAttendeeToolTip.qtip({
+	    show: {
+		ready: true, 
+		solo: true, 
+		when: {
+		    event: 'click'
+		}
+	    },
+	hide: false,
+	content: {
+	    text: $('<div></div>').html( DataLayer.render( path+'templates/attendee_quick_edit.ejs', {
+		attendee:{
+		    name:newAttendeeName, 
+		    mail:newAttendeeEmail
+		}
+	    } ) ), 
+	title: {
+	    text:'Detalhes do participante', 
+	    button: '<a class="button close" href="#">close</a>'
+	}
+	},
+	style: {
+	    name: 'blue', 
+	    tip: {
+		corner: 'leftMiddle'
+	    }, 
+	    border: {
+		width: 4, 
+		radius: 8
+	    }, 
+	    width: {
+		min: 230, 
+		max:230
+	    }
+	},
+    position: {
+	corner: {
+	    target: 'rightMiddle',
+	    tooltip: 'leftMiddle'
+	},
+	adjust: {
+	    x:0, 
+	    y:0
+	}
+    }
+    });
+
+    lastEditAttendeeToolTip.qtip("api").onShow = onShowToolTip;
+
+    $(this).val('');
+
+
+    }
+    event.preventDefault();
+    }
+
+    });
+
+    blkAddAtendee.find('.add-attendee-search .ui-icon-search').click(function (task) {
+        blkAddAtendee.find('.add-attendee-search input').keydown();
+    });
+
+    blkAddAtendee.find('.add-attendee-search input').keydown(function (task) {
+
+        if (task.keyCode == '13' || typeof (task.keyCode) == 'undefined') {
+            var result = DataLayer.get('user', ["*", "name", $(this).val()], true);
+
+            /**
+             * TODO: trocar por template
+             */
+            blkAddAtendee.find('ul.search-result-list').empty().css('overflow', 'hidden');
+            if (!result) {
+                blkAddAtendee.find('ul.search-result-list').append('<li><label class="empty">Nenhum resultado encontrado.</label></li>');
+            }
+
+            for (i = 0; i < result.length; i++)
+            result[i].enabled = (blkAddAtendee.find('dd.attendee-list ul.attendee-list label.mail[title="' + result[i].mail + '"]').length) ? false : true;
+
+            blkAddAtendee.find('ul.search-result-list').append(DataLayer.render(path + 'templates/participants_search_itemlist.ejs', result));
+
+            blkAddAtendee.find('ul.search-result-list li').click(function (task, ui) {
+                if ($(task.target).is('input')) {
+                    old_item = $(task.target).parents('li');
+                    newAttendeeId = DataLayer.put('participant', {
+                        user: old_item.find('.id').html(),
+                        isExternal: old_item.find('.isExternal').html()
+                    });
+
+                    attendees[old_item.find('.id').html()] = old_item.find('.name').html();
+
+                    blkAddAtendee.find('dd.attendee-list ul.attendee-list').append(DataLayer.render(path + 'templates/participants_add_itemlist.ejs', [{
+                        id: newAttendeeId,
+                        name: old_item.find('.name').html(),
+                        mail: old_item.find('.mail').html(),
+                        isExternal: old_item.find('.isExternal').html(),
+                        notEvent: true,
+                        isDirty: !! !objTask.id,
+						isDelegate: !!(objTask.me.id != objTask.organizer.id)
+                    }])).scrollTo('max');
+                    /**
+                     * Delegação de participação de um participante com permissão apenas de leitura
+                     *
+                     */
+                    if (objTask.me.id != objTask.organizer.id) {
+
+                        blkAddAtendee.find('.block-add-attendee.search').addClass('hidden');
+                        blkAddAtendee.find('.block-add-attendee.search dt').html('Adicionar outros contatos');
+
+                        blkAddAtendee.find('.status option').toggleClass('hidden');
+                        blkAddAtendee.find('option[value=5]').attr('selected', 'selected').trigger('change');
+                        blkAddAtendee.find('.request-update').removeClass('hidden');
+
+                        blkAddAtendee.find('dd.attendee-list ul.attendee-list li .button.close').parents('li').find('input[name="delegatedFrom[]"]').val(blkAddAtendee.find('.me input[name="attendee[]"]').val());
+
+                        blkAddAtendee.find('.me .participant-delegate').addClass('disable ui-button-disabled ui-state-disabled');
+                        blkAddAtendee.find(".button.close").button({
+                            icons: {
+                                primary: "ui-icon-close"
+                            },
+                            text: false
+                        }).click(function () {
+
+                            $(this).parents('li').find('input[name="delegatedFrom[]"]').val('');
+                            blkAddAtendee.find('.request-update').addClass('hidden');
+                            blkAddAtendee.find('.status option').toggleClass('hidden');
+                            blkAddAtendee.find('option[value=1]').attr('selected', 'selected').trigger('change');
+                            blkAddAtendee.find('.me .participant-delegate').removeClass('disable ui-button-disabled ui-state-disabled attendee-permissions-change-button').find('.ui-icon-person').removeClass('attendee-permissions-change').end();
+
+                            DataLayer.remove('participant', $(this).parents('li').find('[type=checkbox]').val());
+                            $(this).parents('li').remove();
+                        }).addClass('tiny');
+                    } else {
+                        callbackAttendee();
+                        old_item.remove();
+                    }
+                }
+            });
+
+            event.preventDefault();
+        }
+    });
+
+    UI.dialogs.addTask.find('.row.fileupload-buttonbar-task .button').filter('.delete').button({
+        icons: {
+            primary: "ui-icon-close"
+        },
+        text: 'Excluir'
+    }).click(function () {
+        $.Zebra_Dialog('Tem certeza que deseja excluir todos anexos?', {
+            'type': 'question',
+            'overlay_opacity': '0.5',
+            'buttons': ['Sim', 'Não'],
+            'onClose': function (clicked) {
+                if (clicked == 'Sim') {
+
+                    var ids = [];
+                    $.each($('.attachment-list input'), function (i, input) {
+                        DataLayer.remove('schedulableToAttachment', {
+                            filter: ['=', 'id', '' + input.value]
+                        });
+                    });
+                    $('div.new-task-win .attachment-list input').remove();
+                    $('div.new-task-win .row.fileupload-buttonbar .attachments-list p').remove();
+		    $('div.new-task-win .btn-danger.delete').addClass('hidden');
+                }
+            }
+        });
+    }).end().filter('.close').button({
+        icons: {
+            primary: "ui-icon-close"
+        },
+        text: false
+    }).click(function () {
+        DataLayer.remove('schedulableToAttachment', $(this).parents('p').find('input[name="fileId[]"]').val());
+        $(this).parents('p').remove();
+    }).end().filter('.downlaod-archive').button({
+        icons: {
+            primary: "ui-icon-arrowthickstop-1-s"
+        },
+        text: false
+    });
+
+    extendsFileupload('task', path);
+
+    disponibily(objTask, path, attendees, 'task');
+
+    UI.dialogs.addTask.find('.button-add-alarms').click(function () {
+        var li_attach = DataLayer.render(path + 'templates/alarms_add_itemlist.ejs', {
+            type: 1
+        });
+
+        jQuery('.task-alarms-list').append(li_attach).find('.button.remove').button({
+            text: false,
+            icons: {
+                primary: 'ui-icon-close'
+            }
+        }).click(function (el) {
+            $(this).parent().remove().find('li').is(':empty')
+        });
+        // valicacao de campos numericos
+        $('.number').numeric();
+    });
+
+    UI.dialogs.addTask.find(':input').change(function(event){
+	if (event.keyCode != '27' && event.keyCode != '13')
+	    canDiscardTaskDialog = false;
+    }).keydown(function(event){
+	if (event.keyCode != '27' && event.keyCode != '13')
+	    canDiscardTaskDialog = false;
+    });
+
+    UI.dialogs.addTask.dialog('open');
+}
Index: trunk/prototype/modules/calendar/templates/task_search_itemlist.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/task_search_itemlist.ejs	(revision 6996)
+++ trunk/prototype/modules/calendar/templates/task_search_itemlist.ejs	(revision 6996)
@@ -0,0 +1,16 @@
+<% for (var i=0; i < data.length; i++) { %>
+<li class="ui-widget-content" title="<%=data[i]['name']%>" style="border: 0;">
+	<input type="checkbox" name="option" <%= (data[i].enabled) ?  '' : 'disabled="disabled"' %> value="<%= data[i].id %>" />
+    <input type="hidden" name="id" value="<%=data[i]['id']%>" />
+    <input type="hidden" name="taskStartDate" value="<%=data[i]['startDate']%>" />
+    <input type="hidden" name="taskStartHour" value="<%=data[i]['startHour']%>" />
+    <input type="hidden" name="taskEndDate" value="<%=data[i]['endDate']%>" />
+    <input type="hidden" name="taskEndHour" value="<%=data[i]['endHour']%>" />
+    <input type="hidden" name="taskDueDate" value="<%=data[i]['dueDate']%>" />
+    <input type="hidden" name="taskDueTime" value="<%=data[i]['dueTime']%>" />
+    <input type="hidden" name="taskAllDay" value="<%=data[i]['allDay']%>" />
+    <input type="hidden" name="taskStatus" value="<%=data[i]['status']%>" />
+    <input type="hidden" name="taskPercentage" value="<%=data[i]['percentage']%>" />
+    <label class="description"><%=data[i]['startDate']%> - <%=data[i]['description']%></label>
+</li>
+<% } %>
Index: trunk/prototype/modules/calendar/templates/task_quick_add.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/task_quick_add.ejs	(revision 6996)
+++ trunk/prototype/modules/calendar/templates/task_quick_add.ejs	(revision 6996)
@@ -0,0 +1,12 @@
+<div class="add-simple-task">
+
+	<input type="text" class="task" name="summary" value=""/>
+	<textarea name="description" class="task"></textarea>
+
+	<fieldset class="menu-container footer-container menu-addevent">
+		<a class="button advanced" href="#">Avançado</a>
+		<a class="button cancel" href="#">Cancelar</a>
+	    <a class="button save" href="#">Salvar</a>
+    </fieldset>
+
+</div>
Index: trunk/prototype/modules/calendar/templates/configure_calendars_itemlist.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/configure_calendars_itemlist.ejs	(revision 6498)
+++ trunk/prototype/modules/calendar/templates/configure_calendars_itemlist.ejs	(revision 6996)
@@ -1,5 +1,7 @@
-		<%var isOwner = parseInt(data.signature.isOwner) ? '' : 'readonly="readonly"'%>
+		<%var isOwner = parseInt(data.signature.isOwner) ? '' : 'readonly="readonly"';
+		var isGroup = !!parseInt(data.signature.calendar.type);%>
 		<form method="POST" action="calendarSignature:configure">
 			<input type="hidden" name="signature" value="<%=data.signature.id%>" />
+			<input type="hidden" name="type" value="<%=data.signature.calendar.type%>" />
 			
 			<fieldset class="configurations-basic">
@@ -7,5 +9,9 @@
 
 				<p class="input-group">
+				<%if(!isGroup){%>	
 					<label for="name">Nome da agenda:</label>
+				<%}else{%>
+					<label for="name">Nome do grupo:</label>
+				<%}%>
 					<input name="name" value="<%=data.calendar.name%>" <%= isOwner %> type="text" class=""/>
 				</p>
@@ -15,13 +21,16 @@
 					<input name="description" value="<%=data.calendar.description%>" <%= isOwner %> type="text" class=""/>
 				</p>
-
+			<%if(!isGroup){%>	
 				<p class="input-group">
 					<label for="duration">Duração padrão de evento:</label>
 					<input name="duration" value="<%=data.calendar.defaultDuration%>" <%= isOwner %> type="text" class="number"/>
 				</p>
-				
+			<%}%>	
 				<p class="input-group">
+				<%if(!isGroup){%>
 					<label for="timezone">Fuso horário da agenda:</label>
-					<%if(data.signature.isOwner == 0){%>
+				<%}else{%>
+					<label for="timezone">Fuso horário do grupo:</label>
+				<%} if(data.signature.isOwner == 0){%>
 					<input name="timezone" value="<%=data.calendar.timezone%>" size="50" readonly="readonly" type="text" class=""/>
 					<%}else{%>
@@ -29,15 +38,18 @@
 					<%}%>
 				</p>
-
+			<%if(!isGroup){%>		
 				<p class="input-group">
 					<label for="location">URL:</label>
 					<input name="location" value="<%=data.calendar.location%>" <%= isOwner %> type="text" class=""/>
 				</p>
-				
+			<%}%>
 			</fieldset>     
 
 			<fieldset class="configurations-colors">
+			<%if(!isGroup){%>
 				<legend class="">Cores dos eventos desta agenda</legend>
-
+			<%} else{%>	
+				<legend class="">Cores das tarefas deste grupo</legend>
+			<%}%>
 				<div class="calendar-colorpicker"></div>
 			</fieldset>
@@ -86,5 +98,9 @@
 							</select>
 							<input type="hidden" name="alarmId[]" value="<%=data.signature.defaultAlarms[i].id%>" />
+						<%if(!isGroup){%>
 							<label>antes de cada evento.</label>
+						<%}else{%>
+							<label>antes de cada tarefa.</label>
+						<%}%>
 							<a class="button remove tiny">Excluir</a>
 						</li>
Index: trunk/prototype/modules/calendar/templates/availability_map.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/availability_map.ejs	(revision 5636)
+++ trunk/prototype/modules/calendar/templates/availability_map.ejs	(revision 6996)
@@ -1,4 +1,4 @@
-<fieldset id="availability_map" class="tab-level2">
-	<div id="new_event_map" class="map" style="width : 100%;">
+<fieldset class="tab-level2">
+	<div class="map_disponibility" style="width : 100%;">
 	</div>
 </fieldset>
Index: trunk/prototype/modules/calendar/templates/event_list.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/event_list.ejs	(revision 6525)
+++ trunk/prototype/modules/calendar/templates/event_list.ejs	(revision 6996)
@@ -1,3 +1,9 @@
-<div title="Lista de eventos" class="events-list events-list-win active">
+<%
+
+    var decoder = {status: {1: 'Sem ações', 2: 'Em processo', 3: 'Completo', 4: 'Cancelado'}, priority: {1: 'Alta', 2: 'Normal', 3: 'Baixa'}}
+
+%>
+
+<div title="<%=data.tab_title%>" class="events-list events-list-win active">
 	
 	
@@ -43,4 +49,19 @@
 					<td>
 						<span>
+							<%
+							var img_type = "";
+							var title_type = "";
+							if(_event.type == '1'){
+								img_type = "../prototype/modules/calendar/img/big-event.png";
+								title_type = "Evento";
+							}if(_event.type == '2'){
+								img_type = "../prototype/modules/calendar/img/big-task.png"; 
+								title_type = "Tarefa";
+							}if(_event.type == '3'){
+								img_type = "../prototype/modules/calendar/img/activity_icon.jpg"; 
+								title_type = "Atividade";
+							}
+							%>
+							<img title="<%= title_type %>" src="<%= img_type %>"> 
 							<a class="title event-details-item" title='<%= _event.summary %>' aria-expanded='false' role='button' tabindex='0'><%= _event.summary %></a>
 							<!-- TODO: FAZER FUNCIONAR DESTA FORMA -->
@@ -86,9 +107,9 @@
 							%>
 						</span>	
-						<div class="details-event-list hidden">
+						<div class="details-event-list hidden <%= (title_type == "Evento" ? "details-event" : "details-task")  %>">
 							<fieldset class="fields-details-event-list">							
 								<%if(_event.allDay){%>
 									<p class="input-group date-info">
-										<label>Duração</label>
+										<label>Duração:</label>
 										<span class="">Dia inteiro</span>
 									</p>
@@ -108,38 +129,66 @@
 									</p>
 								<%}%>
-								<%if(_event.repeat ){%>
+								<%if(_event.type == '1'){
+									if(_event.repeat ){%>
 								    <p class="input-group">
 									<label>Repetição</label>
 									<span><%= _event.repeat %></span>
 								    </p>
-								<%}%>
-								<p class="input-group">
-									<label>Lembretes</label>
-									<% if(_event.alarms) { %>
+								<%}}%>
+								<p class="input-group">
+									<label>Lembretes:</label>
+									<% if(_event.alarms) { 
+											var string_alarm = "";
+											if(_event.type == '1')
+												string_alarm = 'do evento'; 
+											if(_event.type == '2')
+												string_alarm = 'da tarefa';
+											if(_event.type == '3')
+												string_alarm = 'da atividade';
+											%>
 										<span class="large" >
 											<% for (var l=0; l < _event.alarms.length; l++) { %>
-												<span class="large" >Você será notificado por um <%=dateCalendar.alarmtype[_event.alarms[l].type]%> <%= _event.alarms[l].time %> <%= dateCalendar.timeunit[_event.alarms[l].unit]%><%=_event.alarms[l].time > 1 ? 's' : '' %> antes do evento</span>
+												<span class="large" >Você será notificado por um <%=dateCalendar.alarmtype[_event.alarms[l].type]%> <%= _event.alarms[l].time %> <%= dateCalendar.timeunit[_event.alarms[l].unit]%><%=_event.alarms[l].time > 1 ? 's' : '' %> antes <%=string_alarm%></span>
 											<% } %>
 										</span>
 									<% } %>
 								</p>
-								<p class="input-group">
-									<label>Local</label>
+								<%if(_event.type == '1'){%>
+								<p class="input-group">
+									<label>Local:</label>
 									<span><%= _event.location %></span>
 								</p>
-								<p class="input-group">
-									<label>Descrição </label>
+								<%}%>
+								<p class="input-group">
+									<label>Descrição:</label>
 									<span class="large" ><%= _event.description %></span>
 								</p>
-								<!--<p class="input-group">
+								<%if(_event.type != '1'){%>
+								<p class="input-group">
+									<label>Prioridade:</label>
+									<span><%= decoder['priority'][_event.priority] %></span>
+								</p>
+								<p class="input-group">
+									<label>% Conlusão:</label>
+									<span><%= _event.percentage %>%</span>
+								</p>
+								<p class="input-group">
+									<label>Status:</label>
+									<span><%= decoder['status'][_event.status] %></span>
+								</p>
+								<% } %>
+								<!-- <p class="input-group">
 									<label>Privacidade</label>
 									<span><%= _event.privacy %></span>
-								</p>-->
-								<p class="input-group">
-									<label>Organizador</label>
-									<span class="large"><%= _event.organizer.user ? _event.organizer.user.name : _event.organizer.name %>  (<%= _event.organizer.user ? _event.organizer.user.mail : _event.organizer.mail %>)</span>
-								</p>
-								<p class="input-group">
-									<label>Participantes</label>
+								</p> -->
+								<%if(_event.organizer && _event.organizer.user){%>
+    								<p class="input-group">
+    									<label>Organizador:</label>
+    									<span class="large"><%= _event.organizer.user ? _event.organizer.user.name : _event.organizer.name %>  (<%= _event.organizer.user ? _event.organizer.user.mail : _event.organizer.mail %>)</span>
+    								</p>
+                                <%}%>
+								<%if(_event.type != '3'){%>
+								<p class="input-group">
+									<label>Participantes:</label>
 									<% if(_event.attendee) { %>
 										<span class="large" >
@@ -150,22 +199,39 @@
 									<% } %>
 								</p>
-								<p class="input-group">
-									<label>Presença</label>
+								<%}
+								if(_event.type == '3'){%>
+								<p class="input-group">
+									<label>Tarefas</label>
+									<% if(_event.tasks) { %>
+										<span class="large" >
+											<% for (var m in _event.tasks) { %>
+												<span class="large"><%=_event.tasks[m].description%></span>
+											<%}%>
+										</span>
+									<% } %>
+								</p>
+								<%}%>
+								
+								<p class="input-group">
+									<label>Presença:</label>
 									<span>
-                                                                            <% var status_name;
-                                                                                if (_event.status == 1)
-                                                                                    status_name = "Eu vou";
-                                                                                else if (_event.status == 2)
-                                                                                    status_name = "Talvez";
-                                                                                else if (_event.status == 3)
-                                                                                    status_name = "Eu não vou";
-                                                                            %>
-                                                                            <%= status_name %>
-                                                                        </span> <!-- Ta hardcodificado isso aqui? -->
-								</p>
+                                        <% var status_name;
+                                            if (_event.status == 1)
+                                                status_name = "Eu vou";
+                                            else if (_event.status == 2)
+                                                status_name = "Talvez";
+                                            else if (_event.status == 3)
+                                                status_name = "Eu não vou";
+                                        %>
+                                        <%= status_name %>
+                                    </span> <!-- Ta hardcodificado isso aqui? -->
+								</p>
+
 							</fieldset>
 							<div class="menu-container footer-container">
 								<input name="eventid" type="hidden" value="<%=_event.id%>"></input>
-                                                                <input name="calendarid" type="hidden" value="<%=_event.calendar%>"></input>
+								<input name="eventtype" type="hidden" value="<%=_event.type%>"></input>
+                                <input name="calendarid" type="hidden" value="<%=_event.calendar ? _event.calendar : _event.group%>"></input>
+								<a title="Imprimir" class="button print" href="#">Imprimir</a>
 								<a title="Excluir" class="button delete" href="#">Excluir</a>
 								<a title="Editar" class="button edit" href="#">Editar</a>
Index: trunk/prototype/modules/calendar/templates/calendar_list_print.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/calendar_list_print.ejs	(revision 6996)
+++ trunk/prototype/modules/calendar/templates/calendar_list_print.ejs	(revision 6996)
@@ -0,0 +1,41 @@
+<% //CASE
+	var valid = {
+		title : "Sem titulo",
+		class : "sem-classe"
+	};
+	switch (data.type){
+		case 'event-detail':
+			valid.title = "Detalhes do Evento";
+			valid.class = "detail";
+			break;
+		case 'task-detail':
+			valid.title = "Detalhes da Tarefa";
+			valid.class = "detail";
+			break;
+		case 'event-list':
+			valid.title = "Lista de Eventos";
+			valid.class = "list";
+			break;
+		case 'task-list':
+			valid.title = "Lista de Tarefas";
+			valid.class = "list";
+			break;
+		case 'search':
+			valid.title = "Resultados da Lista";
+			valid.class = "list";
+			break;
+	}
+%>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+	<head>
+		<title><%= valid.title %></title>
+		<link rel="stylesheet" type="text/css" href="../prototype/modules/calendar/css/reset.css">
+		<link rel="stylesheet" type="text/css" href="../prototype/modules/calendar/css/style.css">
+		<link rel="stylesheet" type="text/css" href="../prototype/modules/calendar/css/layout.css">
+		<link rel="stylesheet" type="text/css" href="../prototype/modules/calendar/css/print.css">
+	</head>
+	<body class="<%= valid.class %>">
+		<%= data.html %>
+	</body>
+</html>
Index: trunk/prototype/modules/calendar/templates/calendar_month_print.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/calendar_month_print.ejs	(revision 6996)
+++ trunk/prototype/modules/calendar/templates/calendar_month_print.ejs	(revision 6996)
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+	<head>
+		<link rel="stylesheet" type="text/css" href="../prototype/modules/calendar/css/print.css">
+		<title>Visualização Mensal</title>
+
+	<body>	
+	<div class="month">
+		<div class="title_print"> <img src="../prototype/modules/calendar/img/navbar.png"> <%= data.InfoPage %> </div>
+		<% if(data.days){%>
+		<div class="content_month_print">	
+			<%	
+			
+				for(var i=0; i < data.days.events.length; i++){
+					for(var jj in data.days.events[i]){
+			%>
+				<span class="month_day_print"><%= jj %></span>
+				<ul class="calendar_list_print">
+				<% for(var ii=0; ii<data.days.events[i][jj].events.length; ii++){ 
+				
+					var hora, currentEvent = data.days.events[i][jj].events[ii];
+					
+					hora = (!currentEvent.isOneDay) ? (currentEvent.startDate +" - "+ currentEvent.startHour +" | "+ currentEvent.endDate +" - "+ currentEvent.endHour) : 
+						   (currentEvent.allDay ? "Dia todo" : currentEvent.startHour + " - " + currentEvent.endHour);
+					
+				%>
+					<%
+							var img_type = "";
+							var title_type = "";
+							if(data.days.events[i][jj].events[ii].type == '1'){
+								img_type = "../prototype/modules/calendar/img/mini-event.png";
+								title_type = "Evento";
+							}if(data.days.events[i][jj].events[ii].type == '2'){
+								img_type = "../prototype/modules/calendar/img/mini-task.png"; 
+								title_type = "Tarefa";
+							}if(data.days.events[i][jj].events[ii].type == '3'){
+								img_type = "../prototype/modules/calendar/img/activity_icon.jpg"; 
+								title_type = "Atividade";
+							}
+							%>
+							<li class="calendar_item_print"><img title="<%= title_type %>" src="<%= img_type %>"><span><%= hora %> | <%= data.days.events[i][jj].events[ii].summary %></span></li>
+				<% } %>
+				</ul>
+				<br>
+			<%	
+					}
+				}
+			%>
+		</div><!--days-->
+		<%}%>
+	</div><!--mounth-->
+	</body>
+</html>
Index: trunk/prototype/modules/calendar/templates/configure_calendars.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/configure_calendars.ejs	(revision 5341)
+++ trunk/prototype/modules/calendar/templates/configure_calendars.ejs	(revision 6996)
@@ -1,4 +1,9 @@
+<%if(!!parseInt(data.type)){%>
+<div class="configure-calendars-win active" title="Configurações do Grupo de Tarefas">
+	<h3>Preferências do Grupo de Tarefas</h3>
+<%}else{%>
 <div class="configure-calendars-win active" title="Configurações da Agenda">
 	<h3>Preferências da Agenda</h3>
+<%}%>
 	<div  class="header-menu-container">
 		<a class="button cancel" href="#">Cancelar</a>
@@ -6,8 +11,7 @@
 	</div>
 	<% for (var i=0; i<data.signatures.length; i++) { %>
-	<fieldset class="user-calendar" title="<%= data.calendars[i].name%>" >
-		<legend><%= data.calendars[i].name%></legend>
-		
-	</fieldset>
+		<fieldset class="user-calendar" title="<%= data.calendars[i].name%>" >
+			<legend><%= data.calendars[i].name%></legend>
+		</fieldset>
 	<%} //for each signatures %>
 <!--	
Index: trunk/prototype/modules/calendar/templates/calendar_week_print.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/calendar_week_print.ejs	(revision 6996)
+++ trunk/prototype/modules/calendar/templates/calendar_week_print.ejs	(revision 6996)
@@ -0,0 +1,89 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+	<head>
+		<link rel="stylesheet" type="text/css" href="../prototype/modules/calendar/css/print.css">
+		<title>Visualização Semanal</title>
+	</head>
+	<body>	
+
+	<div class="week">
+		<div class="name-month"> <img src="../prototype/modules/calendar/img/navbar.png"> <%= data.InfoPage %></div>	
+		<% if(data.days){
+		delete data.days.events[7]; %>
+		<div class="first-week">
+			<div class="days">
+					<ul>
+						<li class="all-day-line">
+								<div>&nbsp;</div>
+								<div class="write">
+									<!-- Aqui dia todo -->
+									Dia todo
+								</div>
+						</li>
+						<%
+							for(var i=0; i<data.days.events.length-1; i++){
+								for(var eachInd in data.days.events[i]){
+									
+						%>
+						<li class="li-day">
+							<div class="day-name">
+								<span><strong><%= eachInd.split(" ")[0] %></strong></span>
+							</div>
+							
+							<div class="all-day">
+							<%
+								var aux = false;
+								if(data.days.events[i][eachInd].events){
+									for(var ii=0; ii<data.days.events[i][eachInd].events.length; ii++){
+										if(data.days.events[i][eachInd].events[ii].allDay == true){
+										aux = true;
+							%>	
+									<!-- Aqui dia todo -->
+									<div class="event-all-day"> &nbsp; <%= data.days.events[i][eachInd].events[ii].summary %></div>
+							<%		
+										}
+									}
+								}
+									
+							%>
+							
+							<% if(!aux){ %>
+								<div class="event-all-day"> &nbsp; </div>
+							<% } %>
+							</div>
+							
+							
+							<div>
+							<%	
+									
+								if(data.days.events[i][eachInd].events){
+									for(var ii=0; ii<data.days.events[i][eachInd].events.length; ii++){
+								
+										if(data.days.events[i][eachInd].events[ii].allDay == false){
+									var startHour =  data.days.events[i][eachInd].events[ii].startHour;
+									var endHour =  data.days.events[i][eachInd].events[ii].endHour;
+							%>
+									<!-- Aqui o restante -->
+
+									<div class="event-on-day"><%= data.days.events[i][eachInd].events[ii].summary %> | <%= startHour %> - <%= endHour %> </div>						
+							<%	
+										}
+									}
+								}
+							%>
+							</div>
+						</li>
+						<%		
+								}
+							}
+						%>
+	
+						
+					</ul>
+
+			</div><!--days-->
+		</div><!--first-week-->
+		<%}%>
+	</div><!--week-->
+	</body>
+</html>
Index: trunk/prototype/modules/calendar/templates/alarms_add_itemlist.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/alarms_add_itemlist.ejs	(revision 6393)
+++ trunk/prototype/modules/calendar/templates/alarms_add_itemlist.ejs	(revision 6996)
@@ -1,3 +1,3 @@
-<% if(data.alarm){
+<%if(data.alarm){
 	for(var i = 0; i < data.alarm.defaultAlarms.length; i++){%>
 		<li class="input-group">
@@ -16,5 +16,9 @@
 			<input type="hidden" name="alarmId[]" value="" />
 			<input type="hidden" name="isDefaultAlarm[]" value="<%=data.alarm.useAlarmDefault ? 1 : 0%>" />
-			<label> antes de cada evento.</label>
+			<%if(!!!parseInt(data.type)){%>
+				<label>antes de cada evento.</label>
+			<%}else{%>
+				<label>antes de cada tarefa.</label>
+			<%}%>
 			<a class="button remove tiny"></a>
 		</li>
@@ -35,5 +39,9 @@
 		</select>
 		<input type="hidden" name="alarmId[]" value="" />
-		<label> antes de cada evento.</label>
+		<%if(!!!parseInt(data.type)){%>
+			<label>antes de cada evento.</label>
+		<%}else{%>
+			<label>antes de cada tarefa.</label>
+		<%}%>
 		<a class="button remove tiny"></a>
 	</li>
Index: trunk/prototype/modules/calendar/templates/activity_add.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/activity_add.ejs	(revision 6996)
+++ trunk/prototype/modules/calendar/templates/activity_add.ejs	(revision 6996)
@@ -0,0 +1,265 @@
+<div title="Criar Atividade" class="div-addactivity content">
+    <form method="POST" action="schedulable:activity" class="form-addactivity content">
+
+	<fieldset id="group_addactivity_details1">
+	    <legend class="hidden">Detalhes da atividade</legend>
+	    <p class="input-group">
+		<input type="text" class="h1" name="summary" value="<%= (data.activity.summary) ? data.activity.summary : '' %>"/>
+		<% if( data.activity.id ){ %>
+                <input type="hidden" class="id-activity" name="idActivity" value="<%= data.activity.id %>"/>
+		<% } %>
+		<% if( data.activity.id && data.activity.group ){ %>
+		<input type="hidden" class="last-group" name="lastCalendar" value="<%= data.activity.group %>"/>
+		<% } %>
+		<input type="hidden" class="id-attendee" name="idAttendee" value="<%= data.activity.attendee[0] ? data.activity.attendee[0].id : '0'%>"/>
+	    </p>
+	    <p class="input-group date-info">
+		<input type="text" class="start-date" readonly="readonly" value="<%= (data.activity.startDate) ? data.activity.startDate : '' %>" name="startDate" />
+		<input type="text" class="time start-time<%= (data.activity.allDay) ? ' hidden' : '' %>" readonly="readonly" value="<%= (data.activity.startHour) ? data.activity.startHour : '' %>" name="startHour" /> 
+		<span>até</span>
+		<input type="text" class="end-date" readonly="readonly" value="<%= (data.activity.endDate) ? data.activity.endDate : '' %>" name="endDate" />
+		<input type="text" class="time end-time<%= (data.activity.allDay) ? ' hidden' : '' %>" readonly="readonly" value="<%= (data.activity.endHour) ? data.activity.endHour : '' %>" name="endHour" />
+
+		<span class="previsao-termino">Previsão término:</span>
+		<input type="text" class="date-due" name="dueDate" readonly="readonly">
+		<input type="text" class="time time-due" name="dueHour" readonly="readonly">
+
+		<a href="#" class="group_addactivity_details_lnk_timezone">Fuso horário</a>
+
+		<select name="timezone" class="hidden group-addactivity-details-txt-timezone">
+		    <option value="">- None selected -</option>
+		    <% for( var tzId in data.activity.timezones ){ %>
+		    <option value="<%= tzId %>" <%= data.timezone === tzId ? 'selected="selected"' : '' %>><%= tzId + ' (' + data.activity.timezones[ tzId ] + ')' %></option>
+		    <% } %>
+		</select>
+
+	    </p>
+
+	    <div class="ui-widget messages-validation hidden">
+		<div style="padding: 0.2em 0.7em;" class="ui-state-error ui-corner-all"> 
+		    <p class="message">
+			<span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-alert"></span> 
+			<label></label>
+		    </p>
+		</div>
+	    </div>
+
+	    <p class="input-group activity-type">
+		<input type="checkbox" name="allDay" value="true" <%= (data.activity.allDay) ? 'checked="checked"' : '' %>/>
+		       <label for="allDay">Dia inteiro</label>
+	    </p>
+	    <div class="subitem">
+                % Conclusão: <input type="text" name="percentage" class="done" readonly="readonly" value="<%= data.activity.percentage %>"> 
+                <span style="margin:0 0 0 5px;">Status:<span> 
+			<select name="activityStatus" >
+			    <option <%= (data.activity.activityStatus == '1') ? 'selected="selected"' : '' %> value="1">Sem ações</option>
+			    <option <%= (data.activity.activityStatus == '2') ? 'selected="selected"' : '' %> value="2">Em Processo</option>
+			    <option <%= (data.activity.activityStatus == '3') ? 'selected="selected"' : '' %> value="3">Finalizada</option>
+			    <option <%= (data.activity.activityStatus == '4') ? 'selected="selected"' : '' %> value="4">Cancelada</option>
+			</select>
+			<span style="margin:0 0 0 5px;">Prioridade:<span> 
+				<select name="priority">
+				    <option <%= (data.activity.priority == '1') ? 'selected="selected"' : '' %> value="1">Alta</option>
+				    <option <%= (data.activity.priority == '2') ? 'selected="selected"' : '' %> value="2">Normal</option>
+				    <option <%= (data.activity.priority == '3') ? 'selected="selected"' : '' %> value="3">Baixa</option>
+				</select>
+				<span class="span_done"><label>Completo</label></span>
+				</div>
+				</fieldset>
+				<ul style="width: 710px">
+				    <li><a href="#group_addactivity_details2">Detalhes da atividade</a></li>
+				    <li><a href="#group_addactivity_details8">Tarefas</a></li>
+				    <li><a href="#group_addactivity_details4">Lembretes</a></li>
+				    <li><a href="#group_addactivity_details5">Anexos</a></li>
+				    <li><a href="#group_addactivity_details6">Histórico</a></li>
+				</ul>
+				<fieldset id="group_addactivity_details2" class="tab-level2">
+				    <legend class="hidden">Detalhes da atividade</legend>
+
+				    <p class="input-group">
+					<label for="group_addactivity_details_txtarea_description" class="for-textarea" >Descrição</label>
+					<textarea name="description"><%=(data.activity) ? data.activity.description : '' %></textarea>
+				    </p>
+
+				    <p class="input-group">
+					<label for="group_addactivity_details_slt_cal">Grupo</label>
+					<select name="group">
+					    <% for (var i=0; i< data.activity.groups.length; i++) {	%>
+					    <option value="<%= data.activity.groups[i].id %>" <%= data.activity.groups[i].id == data.activity.group ? 'selected="selected"':'' %>>
+						    <%= data.activity.groups[i].name %>
+					</option>
+					<% } %>
+				    </select>
+				</p>
+
+				<fieldset class="hidden">
+				    <legend class="hidden">Publicidade</legend>
+				    <!--
+				    <p class="input-group">
+					    <label class="input-group">Mostrar-me como</label>
+					    <input type="radio" checked="checked"/>
+					    <label for="group_addactivity_details_rdo_status1">Dispon?vel</label>
+					    <input type="radio"/>
+					    <label for="group_addactivity_details_rdo_status2">Ocupado</label>
+				    </p>
+				    -->
+				    <p class="input-group">
+					<label class="input-group">Privacidade</label>
+					<input type="radio" name="class" value="1" checked="checked"/>
+					<label for="group_addactivity_details_rdo_class1">Padrão</label>
+					<input type="radio" name="class" value="2" />
+					<label for="group_addactivity_details_rdo_class2">Público</label>
+					<input type="radio" name="class" value="3" />
+					<label for="group_addactivity_details_rdo_class3">Privado</label>
+				    </p>
+
+				</fieldset>
+
+			    </fieldset>
+
+			    <div class="overflow_add_calender">
+				<fieldset id="group_addactivity_details4" class="tab-level2">
+				    <legend class="hidden">Lembretes</legend>
+
+				    <p class="default-alarm-activity <%= (!data.activity.id && data.activity.alarms) ? '' : 'hidden'%>">
+					<input type="checkbox" name="defaultAlarm" value="true" checked="checked"/>
+					<label class="input-default-alarm" for="defautAlarm">Usar alarmes padrões</label>
+				    </p>
+
+				    <ul class="activity-alarms-list">
+					<% if (data.activity && data.activity.attendee && !!data.activity.attendee.length && data.activity.attendee[0].alarms) {
+					var alarms = data.activity.attendee[0].alarms;
+					for (var i=0; i< alarms.length; i++) {
+					%>
+					<li class="input-group">
+					    <label>Avisar-me por </label>
+					    <select name="alarmType[]">
+						<option value="alert" <%= alarms[i].type=='alert' ? 'selected="selected"':'' %>>Alerta</option>
+						<option value="mail" <%= alarms[i].type=='mail' ? 'selected="selected"':'' %>>E-mail</option>
+						<!--<option value="sms" <%= alarms[i].type=='sms' ? 'selected="selected"':'' %>>SMS</option>-->
+					    </select>
+					    <input type="text" name="alarmTime[]" class="number input-small" value="<%= alarms[i].time %>"/>
+					    <select name="alarmUnit[]">
+						<option value="m" <%= alarms[i].unit=='m' ? 'selected="selected"':'' %>>Minutos</option>
+						<option value="h" <%= alarms[i].unit=='h' ? 'selected="selected"':'' %>>Horas</option>
+						<option value="d" <%= alarms[i].unit=='d' ? 'selected="selected"':'' %>>Dias</option>
+					    </select>
+					    <input type="hidden" name="alarmId[]" value="<%=data.activity.useAlarmDefault ? '' : alarms[i].id%>" />
+					    <input type="hidden" name="isDefaultAlarm[]" value="<%=data.activity.useAlarmDefault ? 1 : 0%>" />
+					    <label> antes de cada activityo.</label>
+					    <a class="button remove tiny"></a>
+					</li>
+					<%}
+					}
+					%>
+				    </ul>
+				    <span class="button add button-add-alarms">Adicionar lembrete</span>
+
+				</fieldset>
+			    </div>
+
+			    <fieldset id="group_addactivity_details6" class="tab-level2" title="Histórico">
+				<div class="parent">
+				    <div class="child-top">
+					<div class="date-hour"><span>Data-Hora</span></div>
+					<div class="user"><span>Participante</span></div>
+					<div class="attribute"><span>Alterou</span></div>
+					<div class="beforeValue"><span>De</span></div>
+					<div class="afterValue"><span>Para</span></div>
+				    </div>
+
+				    <div class="child-bottom">
+					<% if(data.activity.historic.length){
+					    for(var i=0; i< data.activity.historic.length; i++){ %>
+					    <div class="task <%= i != 0 ? 'left' : ''%>"><span><%= data.activity.historic[i].task %></span></div>
+					    <%for(var j=0; j< data.activity.historic[i].historic.length; j++){ 
+						var historic = data.activity.historic[i].historic[j];%>
+						<div class="child-bottom-each">
+						    <div class="date-hour"><span><%= historic.time %></span></div>
+						    <div class="user"><span><%= historic.user.name %></span></div>
+						    <div class="attribute"><span><%= historic.attribute %></span></div>
+						    <div class="beforeValue"><span><%= historic.beforeValue %></span></div>
+						    <div class="afterValue"><span><%= historic.afterValue %></span></div>
+						</div>
+						
+					    <%}
+					    }	
+					}%>
+				    </div>
+			      </div>
+			    </fieldset>	
+
+			    <fieldset id="group_addactivity_details8" class="tab-level2" title="Tarefas">
+
+			    </fieldset>
+
+			    <fieldset class="attachment-list hidden">
+				<%if(data.activity && data.activity.attachments){
+				for (var i=0; i< data.activity.attachments.length; i++) {%>
+				    <input type="hidden" name="fileId[]" value="<%=data.activity.attachments[i].id%>"/>
+				<%}
+				}%>
+			    </fieldset>
+			    </form>
+
+			    <div class="overflow_add_calender">
+				<fieldset id="group_addactivity_details5" class="tab-level2">
+				    <form id="fileuploadactivity" action="attachment:detail" method="POST">
+					<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
+					<div class="row fileupload-buttonbar-activity">
+					    <div class="button-files-upload">
+						<!-- The fileinput-button span is used to style the file input field as button -->
+
+						<span class="button btn-success fileinput-button">
+						    <span><i class="icon-plus icon-white"></i> Adicionar</span>
+						    <input type="file" name="files[]" multiple>
+						</span>
+
+						<button type="button" class="button btn-danger delete <%= data.activity && data.activity.attachments && data.activity.attachments.length ? '' : 'hidden' %>">
+						    <i class="icon-trash icon-white"></i> Remover Todos
+						</button>
+
+					    </div>
+					    <div id="fileupload-progress-activity"></div>
+					    <div class="files-list">
+						<ul class="attachments-list">
+						    <%if(data.activity && data.activity.attachments){
+						    for (var i=0; i< data.activity.attachments.length; i++) {
+						    %>
+						    <p class="input-group arquive-info">
+							<label class="lbl-archive-nome">Nome:</label>
+							<span class="archive-nome"><%=data.activity.attachments[i].name%></span>
+
+							<label class="lbl-archive-size">Tamanho:</label>
+							<span class="archive-size"><%=data.activity.attachments[i].size%></span>
+							<a href="../prototype/getArchive.php?attachment=<%=data.activity.attachments[i].id%>" class="button tiny upload downlaod-archive">Download</a>
+
+							<span class="button close tiny upload edit delete-upload" title="Deletar">Deletar</span>
+
+							<input type="hidden" name="fileId[]" value="<%=data.activity.attachments[i].id%>"/>
+						    </p>
+						    <%}
+						    }%>
+
+
+						</ul>
+					    </div>
+					</div>
+					<br>
+
+				    </form>
+				</fieldset>
+			    </div>
+			    <form action="../prototype/modules/group/export.php" method="GET" class="form-export content">
+				<input type="hidden" class="id-activity" name="activity" value="<%= data.activity.id %>"/>
+			    </form>
+
+			    <div title="" class="menu-container footer-container menu-addactivity">
+				<% if (data.activity.id) { %>
+				<!--<a title="Exportar" class="button export" href="#">Exportar</a>-->
+				<a title="Excluir" class="button delete" href="#">Excluir</a>
+				<% } %>
+				<a title="Cancelar" class="button cancel" href="#">Cancelar</a>
+				<a title="Salvar" class="button save" href="#">Salvar</a>
+			    </div>
+			    </div>
Index: trunk/prototype/modules/calendar/templates/calendar_list.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/calendar_list.ejs	(revision 5927)
+++ trunk/prototype/modules/calendar/templates/calendar_list.ejs	(revision 6996)
@@ -1,41 +1,81 @@
+<%
+    var signatures = {'calendar': [], 'taskGroup': [], 'sharedCalendar': []};
+    for(var i = 0; i < data.signatures.length; i++)
+    {
+        if(data.signatures[i].calendar.type == 1){
+            signatures['taskGroup'].push(data.signatures[i]);
+        }else{
+            signatures[data.signatures[i].isOwner == 1 ? 'calendar' : 'sharedCalendar'].push(data.signatures[i]); 	
+        }
+    }
+%>
+
 <div class="all-list-calendars">
-    <% var signature = data.signatures %>
-    <% var external = false %>
-    <div class="my-calendars">
-        <a title='Minhas agendas' class="title-my-calendars" aria-expanded='false' role='button' tabindex='0'>Minhas agendas</a>
+
+    <div class="my-groups-task">
+        <a title='Grupos de tarefas' class="title-my-calendars" aria-expanded='false' role='button' tabindex='0'>Grupos de tarefas</a>
         <span class="status-list ui-icon ui-icon-triangle-1-s"></span>
-        <a href="#" class="button new new-calendar">Nova Agenda</a>
+        <a href="#" class="button new new-calendar 1">Novo Grupo</a>
         <ul class="list-calendars my-list-calendars">
-            <% for (var i=0; i < signature.length; i++) {
-            if(signature[i].isOwner == 1){
-            %>
-            <li class="list-calendars-item list-calendars-item-<%= signature[i].calendar.id %>" title="<%= signature[i].calendar.name %>">
+            <% for (var i=0; i < signatures['taskGroup'].length; i++) {%>
+            <li class="list-calendars-item list-calendars-item-<%= signatures['taskGroup'][i].calendar.id %>" title="<%= signatures['taskGroup'][i].calendar.name %>">
 
                 <div>
-                    <input class="calendar-view" type="checkbox" name="" value="<%= signature[i].calendar.id %>" checked="checked"/>
-                    <label><%= signature[i].calendar.name %></label>
+                    <input class="calendar-view" type="checkbox" name="" value="<%= signatures['taskGroup'][i].calendar.id %>" checked="checked"/>
+                    <label><%= signatures['taskGroup'][i].calendar.name %></label>
 
                 </div> 
-                <a class="cal-list-options-btn my-cal-list-options-btn-<%= signature[i].calendar.id %>" style="background-color:#<%=signature[i].backgroundColor%>; border-color:#<%= signature[i].borderColor%>;">
+                <a class="cal-list-options-btn my-cal-list-options-btn-<%= signatures['taskGroup'][i].calendar.id %>" style="background-color:#<%=signatures['taskGroup'][i].backgroundColor%>; border-color:#<%= signatures['taskGroup'][i].borderColor%>;">
                     <img src="../prototype/modules/calendar/img/arrow_down.png" width="10" height="10" class="cal-list-img"/>
                 </a>
 
 
-                <div class="cal-list-options my-cal-list-options-<%= signature[i].calendar.id %> hidden">
+                <div class="cal-list-options my-cal-list-options-<%= signatures['taskGroup'][i].calendar.id %> hidden">
                     <ul>
-                        <li><a href="#" onclick="add_tab_configure_calendar(<%= signature[i].calendar.id%>);">Configurações</a></li>
-                        <li><a href="#" onclick="show_modal_import_export(0, <%= signature[i].calendar.id%>);">Importar</a></li>
-                        <li><a href="#" onclick="show_modal_import_export(1, <%= signature[i].calendar.id%>);">Exportar</a></li>
-                        <li><a href="#" onclick="show_modal_shared(<%= signature[i].calendar.id%>);">Compartilhar agenda</a></li>
-                        <li><a href="#" onclick="remove_calendar();">Remover agenda</a></li>
+                        <li><a href="#" onclick="add_tab_configure_calendar(<%= signatures['taskGroup'][i].calendar.id%>, 1);">Configurações</a></li>
+			<li><a href="#" onclick="show_modal_import_export(0,<%= signatures['taskGroup'][i].calendar.id%>, 1);">Importar</a></li>
+                        <li><a href="#" onclick="show_modal_import_export(1,<%= signatures['taskGroup'][i].calendar.id%>, 1);">Exportar</a></li>
+                        <%if(signatures['taskGroup'][i].type == '0'){%>
+			    <li><a href="#" onclick="remove_calendar(1);">Remover Grupo</a></li>
+			<%}%>
                     </ul>
 
                 </div>
             </li>
-            <% 		
-            }else
-            external = true;
-            }
-            %>
+            <%}%>
+
+        </ul>
+    </div>
+
+    <div class="my-calendars">
+        <a title='Minhas agendas' class="title-my-calendars" aria-expanded='false' role='button' tabindex='0'>Minhas agendas</a>
+        <span class="status-list ui-icon ui-icon-triangle-1-s"></span>
+        <a href="#" class="button new new-calendar 0">Nova Agenda</a>
+        <ul class="list-calendars my-list-calendars">
+            <% for (var i=0; i < signatures.calendar.length; i++) {%>
+            <li class="list-calendars-item list-calendars-item-<%= signatures['calendar'][i].calendar.id %>" title="<%= signatures['calendar'][i].calendar.name %>">
+
+                <div>
+                    <input class="calendar-view" type="checkbox" name="" value="<%= signatures['calendar'][i].calendar.id %>" checked="checked"/>
+                    <label><%= signatures['calendar'][i].calendar.name %></label>
+
+                </div> 
+                <a class="cal-list-options-btn my-cal-list-options-btn-<%= signatures['calendar'][i].calendar.id %>" style="background-color:#<%=signatures['calendar'][i].backgroundColor%>; border-color:#<%= signatures['calendar'][i].borderColor%>;">
+                    <img src="../prototype/modules/calendar/img/arrow_down.png" width="10" height="10" class="cal-list-img"/>
+                </a>
+
+
+                <div class="cal-list-options my-cal-list-options-<%= signatures['calendar'][i].calendar.id %> hidden">
+                    <ul>
+                        <li><a href="#" onclick="add_tab_configure_calendar(<%= signatures['calendar'][i].calendar.id%>, 0);">Configurações</a></li>
+                        <li><a href="#" onclick="show_modal_import_export(0, <%= signatures['calendar'][i].calendar.id%>, 0);">Importar</a></li>
+                        <li><a href="#" onclick="show_modal_import_export(1, <%= signatures['calendar'][i].calendar.id%>, 0);">Exportar</a></li>
+                        <li><a href="#" onclick="show_modal_shared(<%= signatures['calendar'][i].calendar.id%>);">Compartilhar agenda</a></li>
+                        <li><a href="#" onclick="remove_calendar(0);">Remover agenda</a></li>
+                    </ul>
+
+                </div>
+            </li>
+            <%}%>
 
         </ul>
@@ -47,23 +87,20 @@
         <a href="#" class="button new new-calendar-shared tiny">Nova Agenda</a>
 
-        <% if (external) { %>	
         <ul class="list-calendars signed-list-calendars">
-            <% for (var i=0; i < signature.length; i++) {
-            if(signature[i].isOwner == 0){
-            %>
-            <li class="list-calendars-item list-calendars-item-<%= signature[i].calendar.id %>" title="<%= signature[i].calendar.name %>">
+            <% for (var i=0; i < signatures['sharedCalendar'].length; i++) {%>
+                <li class="list-calendars-item list-calendars-item-<%= signatures['sharedCalendar'][i].calendar.id %>" title="<%= signatures['sharedCalendar'][i].calendar.name %>">
                  <div>
-		    <input class="calendar-view" type="checkbox" name="" value="<%= signature[i].calendar.id %>" checked="checked"/>
-		    <label><%= signature[i].calendar.name %></label>
-		 </div>
-                <a class="cal-list-options-btn my-cal-list-options-btn-<%= signature[i].calendar.id %>" style="background-color:#<%=signature[i].backgroundColor%>; border-color:#<%= signature[i].borderColor%>;">
+        		    <input class="calendar-view" type="checkbox" name="" value="<%= signatures['sharedCalendar'][i].calendar.id %>" checked="checked"/>
+        		    <label><%= signatures['sharedCalendar'][i].calendar.name %></label>
+        		 </div>
+                <a class="cal-list-options-btn my-cal-list-options-btn-<%= signatures['sharedCalendar'][i].calendar.id %>" style="background-color:#<%=signatures['sharedCalendar'][i].backgroundColor%>; border-color:#<%= signatures['sharedCalendar'][i].borderColor%>;">
                     <img src="../prototype/modules/calendar/img/arrow_down.png" width="10" height="10" class="cal-list-img"/></a>
-                <div class="cal-list-options my-cal-list-options-<%= signature[i].calendar.id  %> hidden">
+                <div class="cal-list-options my-cal-list-options-<%= signatures['sharedCalendar'][i].calendar.id  %> hidden">
                     <ul>
-                        <li><a href="#" onclick="add_tab_configure_calendar(<%= signature[i].calendar.id %>);">Configurações</a></li>
-                        <li><a href="#" onclick="show_modal_import_export(0, <%= signature[i].calendar.id %>);">Importar</a></li>
-                        <li><a href="#" onclick="show_modal_import_export(1, <%= signature[i].calendar.id %>);">Exportar</a></li>
-                        <%if(!signature[i].permission.acl['required']){%>
-                            <li><a href="#" onclick="cancel_signature(<%= signature[i].id %>);">Cancelar assinatura</a></li>
+                        <li><a href="#" onclick="add_tab_configure_calendar(<%= signatures['sharedCalendar'][i].calendar.id %>, 0);">Configurações</a></li>
+                        <li><a href="#" onclick="show_modal_import_export(0, <%= signatures['sharedCalendar'][i].calendar.id%>, 0);">Importar</a></li>
+                        <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>
                         <%}%>
                     </ul>
@@ -72,10 +109,6 @@
 
             </li>
-            <% 		
-            }
-            }
-            %>
+            <%}%>
         </ul>
-        <% } %>
     </div>
 </div>
Index: trunk/prototype/modules/calendar/templates/calendar_year_print.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/calendar_year_print.ejs	(revision 6996)
+++ trunk/prototype/modules/calendar/templates/calendar_year_print.ejs	(revision 6996)
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+	<head>
+		<title>Visualização Anual</title>
+		<link rel="stylesheet" type="text/css" href="../prototype/plugins/fullcalendar/fullcalendar.css">
+		<link rel="stylesheet" type="text/css" href="../prototype/modules/calendar/css/print.css">
+	</head>
+	<body>
+		<div class="year_print">
+			<div class="year_print_header"><h2><%= data.header %></h2></div>
+			<div class="year_print_content">
+				<%= data.html %>
+			</div>
+		</div>
+	</body>
+</html>
Index: trunk/prototype/modules/calendar/templates/index.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/index.ejs	(revision 6525)
+++ trunk/prototype/modules/calendar/templates/index.ejs	(revision 6996)
@@ -27,4 +27,5 @@
 <link rel="Stylesheet" type="text/css" href="<?= PLUGINSURL ?>/timepicker/jquery-ui-timepicker-addon.css" />
 <link rel="stylesheet" type="text/css" href='<?= PLUGINSURL ?>/zebradialog/css/zebra_dialog.css'></link>
+<link rel="stylesheet" type="text/css" href='<?= PLUGINSURL ?>/jquery.spinner/jquery.spinner.css'></link>
 
 <link rel="stylesheet" type="text/css" href="<?= MODULESURL ?>/css/layout.css" />
@@ -71,4 +72,5 @@
 <script type="text/javascript" src="<?= PLUGINSURL ?>/qtip/jquery.qtip-1.0.0-rc3.min.js"></script>
 <script type="text/javascript" src="<?= PLUGINSURL ?>/contextmenu/jquery.contextMenu.js"></script>
+<script type='text/javascript' src='<?= PLUGINSURL ?>/jquery.spinner/jquery.spinner.min.js'></script>
 
 <!-- JPicker -->
@@ -87,4 +89,7 @@
 
 <script type='text/javascript' src='<?= MODULESURL ?>/js/map.disponibility.js'></script>
+
+<script type='text/javascript' src='<?= MODULESURL ?>/js/activity.helpers.js'></script>
+<script type='text/javascript' src='<?= MODULESURL ?>/js/task.helpers.js'></script>
 <script type='text/javascript' src='<?= MODULESURL ?>/js/helpers.js'></script>
 <script type='text/javascript' src='<?= MODULESURL ?>/js/calendar.shared.js'></script>
@@ -92,4 +97,5 @@
 <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/calendar.alarms.js'></script>	
 
 <script type='text/javascript' src='<?= MODULESURL ?>/js/I18n.js'></script>
@@ -97,4 +103,5 @@
 <script type="text/javascript" src="<?= MODULESURL ?>/js/init.js"></script>
 <script type="text/javascript" src="<?= MODULESURL ?>/js/drag_area.js"></script>
+<script type="text/javascript" src="<?= MODULESURL ?>/js/desktop.notification.js"></script>
 
 </head>
@@ -107,5 +114,6 @@
 				<ul>
 					<li><a href="#" onclick="add_tab_preferences();" class="menu-command configurations">Prefer&ecirc;ncias</a></li>
-					<li><a href="#" onclick="add_tab_configure_calendar();" class="menu-command configurations">Configura&ccedil;&atilde;o de agendas</a></li>
+					<li><a href="#" onclick="add_tab_configure_calendar(false, 0);" class="menu-command configurations">Configura&ccedil;&atilde;o de agendas</a></li>
+					<li><a href="#" onclick="add_tab_configure_calendar(false, 1);" class="menu-command configurations">Configura&ccedil;&atilde;o de grupos</a></li>
 					<li><a href="#" onclick="show_modal_import_export(0);" class="menu-pass-through">Importar</a></li>
 					<li><a href="#" onclick="show_modal_import_export(1);" class="menu-pass-through">Exportar</a></li>
@@ -120,4 +128,6 @@
 		<div class="block-vertical-toolbox">
 			<a class="button add add-event" href="#">Adicionar evento</a>
+			<a class="button add add-task" href="#">Adicionar tarefa</a>
+			<a class="button add add-activity" href="#">Adicionar atividade</a>
 			<!--<a class="button add" href="#" onclick="add_events_list();">Lista de Eventos</a>-->
 			<div class="mini-calendar"></div>
@@ -131,9 +141,11 @@
 			<ul>
 				<li><a href="#calendar">Agenda</a></li>
-				<li><a href="#tab_events_list_" onclick="add_events_list();">Lista de Eventos</a></li>
+				<li><a href="#tab_events_list_" onclick="add_events_list(false, 0);">Lista de Eventos</a></li>
+				<li><a href="#tab_tasks_list_" onclick="add_events_list(false, 1);">Lista de Tarefas</a></li>
 				<!--<li><a href="#sandbox2">Sandbox</a></li>-->
 			</ul>
 			<div id="calendar"> </div>
 			<div id="tab_events_list_"> </div>
+			<div id="tab_tasks_list_"> </div>
 			<div id="sandbox2">	</div>
 			<div id="calendarShared">	</div>
@@ -147,5 +159,3 @@
 	</div>
 </body>
-
 </html>
-
Index: trunk/prototype/modules/calendar/templates/task_add.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/task_add.ejs	(revision 6996)
+++ trunk/prototype/modules/calendar/templates/task_add.ejs	(revision 6996)
@@ -0,0 +1,265 @@
+<div title="Criar Tarefa" class="div-addtask content">
+    <form method="POST" action="<%= data.task.isOrganizer ? 'schedulable:task' : 'schedulable:taskEdit' %>" class="form-addtask content">
+
+	<fieldset id="calendar_addtask_details1">
+		<legend class="hidden">Detalhes da tarefa</legend>
+		<p class="input-group">
+		    <input type="text" class="h1" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%> name="summary" value="<%= (data.task.summary) ? data.task.summary : '' %>"/>
+		    <% if( data.task.id ){ %>
+			    <input type="hidden" class="id-task" name="idTask" value="<%= data.task.id %>"/>
+		    <% } %>
+		    <% if( data.task.id && data.task.group ){ %>
+    			<input type="hidden" class="last-group" name="lastGroup" value="<%= data.task.group %>"/>
+		    <% } %>
+		</p>
+		<p class="input-group date-info">
+			<input type="text" class="date start-date" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%> value="<%= (data.task.startDate) ? data.task.startDate : '' %>" name="startDate" />
+			<input type="text" class="time start-time<%= (data.task.allDay) ? ' hidden' : '' %>" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%> value="<%= (data.task.startHour) ? data.task.startHour : '' %>" name="startHour" /> 
+			<span>até</span>
+			<input type="text" class="date end-date" value="<%= (data.task.endDate) ? data.task.endDate : '' %>" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%> name="endDate" />
+			<input type="text" class="time end-time<%= (data.task.allDay) ? ' hidden' : '' %>" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%> value="<%= (data.task.endHour) ? data.task.endHour : '' %>" name="endHour" />
+
+				<span class="previsao-termino">Previsão término:</span>
+				<input type="text" name="dueDate" class="date date-previsao" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%> value="<%= data.task.dueDate %>">
+				<input type="text" name="dueTime" class="time time-previsao" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%> value="<%= data.task.dueTime %>">
+
+				<a href="#" class="calendar_addtask_details_lnk_timezone" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%>>Fuso horário</a>
+			
+			
+<!--			<input type="text" name="timezone" style="display: none;" />-->
+			<select name="timezone" class="hidden calendar-addtask-details-txt-timezone" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%>>
+				<option value="">- None selected -</option>
+				<% for( var tzId in data.task.timezones ){ %>
+				  <option value="<%= tzId %>" <%= data.timezone === tzId ? 'selected="selected"' : '' %>><%= tzId + ' (' + data.task.timezones[ tzId ] + ')' %></option>
+				<% } %>
+			</select>
+
+			<a class="button suggestion-hours small hidden" href="#">Sugerir horário</a>
+
+
+		</p>
+				
+		<div class="ui-widget messages-validation hidden">
+			<div style="padding: 0.2em 0.7em;" class="ui-state-error ui-corner-all"> 
+				<p class="message">
+					<span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-alert"></span> 
+					<label></label>
+				</p>
+			</div>
+		</div>
+		
+		<p class="input-group task-type">
+			<input type="checkbox" name="allDay" value="true" <%= (data.task.allDay) ? 'checked="checked"' : '' %> <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%>/>
+			<label for="allDay">Dia inteiro</label>
+<!--
+			<input type="checkbox" class="button-repeat" />
+			<label for="calendar_addtask_details_chk_repeat">Repetir</label>-->
+		</p>
+		<div class="subitem">
+				% Conclusão: <input type="text" name="percentage" class="done" value="<%= data.task.percentage %>">
+				<span style="margin:0 0 0 5px;">Status:</span> 
+		    <select name="taskStatus" style="margin: 0 0 0 5px;">
+                    <option class="taskStatus-noAction"<%= (data.task.taskStatus == '1') ? 'selected="selected"' : '' %> value="1">Sem ações</option>
+                    <option class="taskStatus-inProcess"<%= (data.task.taskStatus == '2') ? 'selected="selected"' : '' %> value="2">Em Processo</option>
+                    <option class="taskStatus-finished"<%= (data.task.taskStatus == '3') ? 'selected="selected"' : '' %> value="3">Finalizada</option>
+					<option class="taskStatus-canceled"<%= (data.task.taskStatus == '4') ? 'selected="selected"' : '' %> value="4">Cancelada</option>
+				</select>
+				<span style="margin:0 0 0 5px;">Prioridade:</span> 
+				<select name="priority" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%>>
+					<option <%= (data.task.priority == '1') ? 'selected="selected"' : '' %> value="1">Alta</option>
+					<option <%= (data.task.priority == '2') ? 'selected="selected"' : '' %> value="2">Normal</option>
+					<option <%= (data.task.priority == '3') ? 'selected="selected"' : '' %> value="3">Baixa</option>
+				</select>
+                <span class="span_done"><label>Completo</label></span>
+		</div>
+	</fieldset>
+	<ul style="width: 752px">
+		<li><a href="#calendar_addtask_details2">Detalhes da tarefa</a></li>
+		<li><a href="#calendar_addtask_details4">Lembretes</a></li>
+		<li><a href="#calendar_addtask_details5">Anexos</a></li>
+		<li><a href="#calendar_addtask_details6">Participantes</a></li>
+		<li><a href="#calendar_addtask_details7">Disponibilidade</a></li>
+		<li><a href="#calendar_addtask_details8">Histórico</a></li>
+	</ul>
+	<fieldset id="calendar_addtask_details2" class="tab-level2">
+		<legend class="hidden">Detalhes da tarefa</legend>
+
+		<p class="input-group">
+			<label for="calendar_addtask_details_txtarea_description" class="for-textarea" >Descrição</label>
+			<textarea name="description" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%>><%=(data.task) ? data.task.description : '' %></textarea>
+		</p>
+
+		<p class="input-group">
+			<label for="calendar_addtask_details_slt_cal">Grupo</label>
+				<select  name="group" >
+					<% 
+					  if(data.task.groups){
+					    for (var i=0; i< data.task.groups.length; i++) {
+					%>
+					      <option value="<%= data.task.groups[i].id %>" <%= data.task.groups[i].id == data.task.group ? 'selected="selected"':'' %>>
+					      <%= data.task.groups[i].name %>
+					      </option>
+					<%  }
+					  } %>
+				</select>
+		</p>
+		
+		<fieldset class="hidden">
+			<legend class="hidden">Publicidade</legend>
+
+			<p class="input-group">
+				<label class="input-group">Privacidade</label>
+				<input type="radio" name="class" value="1" checked="checked"/>
+				<label for="calendar_addtask_details_rdo_class1">Padrão</label>
+				<input type="radio" name="class" value="2" />
+				<label for="calendar_addtask_details_rdo_class2">Público</label>
+				<input type="radio" name="class" value="3" />
+				<label for="calendar_addtask_details_rdo_class3">Privado</label>
+			</p>
+			
+		</fieldset>
+		
+	</fieldset>
+	
+	<div class="overflow_add_calender">
+	<fieldset id="calendar_addtask_details4" class="tab-level2">
+		<legend class="hidden">Lembretes</legend>
+		
+		<p class="default-alarm-task <%= (!data.task.id && data.task.alarms) ? '' : 'hidden'%>">
+			<input type="checkbox" name="defaultAlarm" value="true" checked="checked"/>
+			<label class="input-default-alarm" for="defautAlarm">Usar alarmes padrões</label>
+		</p>
+	
+		<ul class="task-alarms-list">
+			<% if (data.task && data.task.alarms) {
+				for (var i=0; i< data.task.alarms.length; i++) {
+			%>
+			<li class="input-group">
+				<label>Avisar-me por </label>
+				<select name="alarmType[]">
+                    <option value="alert" <%= data.task.alarms[i].type=='alert' ? 'selected="selected"':'' %>>Alerta</option>
+                    <option value="mail" <%= data.task.alarms[i].type=='mail' ? 'selected="selected"':'' %>>E-mail</option>
+                    <!--<option value="sms" <%= data.task.alarms[i].type=='sms' ? 'selected="selected"':'' %>>SMS</option>-->
+				</select>
+				<input type="text" name="alarmTime[]" class="number input-small" value="<%= data.task.alarms[i].time %>"/>
+				<select name="alarmUnit[]">
+					<option value="m" <%= data.task.alarms[i].unit=='m' ? 'selected="selected"':'' %>>Minutos</option>
+					<option value="h" <%= data.task.alarms[i].unit=='h' ? 'selected="selected"':'' %>>Horas</option>
+					<option value="d" <%= data.task.alarms[i].unit=='d' ? 'selected="selected"':'' %>>Dias</option>
+				</select>
+				<input type="hidden" name="alarmId[]" value="<%=data.task.useAlarmDefault ? '' : data.task.alarms[i].id%>" />
+				<input type="hidden" name="isDefaultAlarm[]" value="<%=data.task.useAlarmDefault ? 1 : 0%>" />
+				<label> antes de cada tarefa.</label>
+				<a class="button remove tiny"></a>
+			</li>
+			<%	}
+			   }
+			%>
+		</ul>
+		<span class="button add button-add-alarms">Adicionar lembrete</span>
+	
+	</fieldset>
+	</div>
+	
+	<fieldset id="calendar_addtask_details6" class="tab-level2" title="Participantes">
+	</fieldset>	
+	
+	<fieldset id="calendar_addtask_details7" class="tab-level2" title="Disponibilidade">
+	</fieldset>
+	
+	<fieldset id="calendar_addtask_details8" class="tab-level2" title="Histórico">
+	    <div class="parent">
+		<div class="child-top">
+		    <div class="date-hour"><span>Data-Hora</span></div>
+		    <div class="user"><span>Participante</span></div>
+		    <div class="attribute"><span>Alterou</span></div>
+		    <div class="beforeValue"><span>De</span></div>
+		    <div class="afterValue"><span>Para</span></div>
+		</div>
+
+		<div class="child-bottom">
+		    <% if(data.task.historic){
+			for(var i=0; i< data.task.historic.length; i++){ %>
+			    <div class="child-bottom-each">
+				<div class="date-hour"><span><%= data.task.historic[i].time %></span></div>
+				<div class="user"><span><%= data.task.historic[i].user.name %></span></div>
+				<div class="attribute"><span><%= data.task.historic[i].attribute %></span></div>
+				<div class="beforeValue"><span><%= data.task.historic[i].beforeValue %></span></div>
+				<div class="afterValue"><span><%= data.task.historic[i].afterValue %></span></div>
+			    </div>
+		    <% 	}	
+		    }%>
+		</div>
+
+	    </div>
+	</fieldset>
+
+	<fieldset class="attachment-list hidden">
+             <%if(data.task && data.task.attachments){
+                for (var i=0; i< data.task.attachments.length; i++) {%>
+                    <input type="hidden" name="fileId[]" value="<%=data.task.attachments[i].id%>"/>
+                <%}
+            }%>
+	</fieldset>
+    </form>
+    
+<div class="overflow_add_calender">
+	<fieldset id="calendar_addtask_details5" class="tab-level2">
+        <form id="fileuploadtask" action="attachment:detail" method="POST">
+        <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
+        <div class="row fileupload-buttonbar-task">
+            <div class="button-files-upload">
+                <!-- The fileinput-button span is used to style the file input field as button --> 
+		      <span class="button btn-success fileinput-button" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%>>
+                    <span><i class="icon-plus icon-white"></i> Adicionar</span>
+                    <input type="file" name="files[]" multiple <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%>>
+                </span>
+		<button type="button" class="button btn-danger delete <%= data.task && data.task.attachments && data.task.attachments.length ? '' : 'hidden' %>" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%>>
+			<i class="icon-trash icon-white"></i> Remover Todos
+		</button>
+            </div>
+            <div id="fileupload-progress-task"></div>
+            <div class="files-list">
+               <ul class="attachments-list">
+				<%
+                    for (var i=0; i< data.task.attachments.length; i++) {
+				%>
+					<p class="input-group arquive-info">
+						<label class="lbl-archive-nome">Nome:</label>
+						<span class="archive-nome"><%=data.task.attachments[i].name%></span>
+						
+						<label class="lbl-archive-size">Tamanho:</label>
+						<span class="archive-size"><%=data.task.attachments[i].size%></span>
+						<a href="../prototype/getArchive.php?attachment=<%=data.task.attachments[i].id%>" class="button tiny upload downlaod-archive">Download</a>
+						
+						<span class="button close tiny upload edit delete-upload" title="Deletar">Deletar</span>
+						
+						<input type="hidden" name="fileId[]" value="<%=data.task.attachments[i].id%>"/>
+					</p>
+				<%}%>
+			   
+			   
+			   </ul>
+            </div>
+        </div>
+        <br>
+        
+    </form>
+	</fieldset>
+</div>
+	<form action="../prototype/modules/calendar/export.php" method="GET" class="form-export content">
+		<input type="hidden" class="id-task" name="event" value="<%= data.task.id %>"/>
+	</form>
+<!--	<div id="calendar_addtask_addattendee"></div>-->
+
+    <div title="" class="menu-container footer-container menu-addtask">
+	    <% if (data.task.id) { %>
+			<a title="Exportar" class="button export" href="#">Exportar</a>
+			<a title="Excluir" class="button delete" href="#">Excluir</a>
+	    <% } %>
+		<a title="Cancelar" class="button cancel" href="#">Cancelar</a>
+	    <a title="Salvar" class="button save" href="#">Salvar</a>
+    </div>
+</div>
+<!--<script src="application.js"></script>-->
+<!--<script src="application.js"></script>-->
Index: trunk/prototype/modules/calendar/templates/import_export.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/import_export.ejs	(revision 5901)
+++ trunk/prototype/modules/calendar/templates/import_export.ejs	(revision 6996)
@@ -15,5 +15,5 @@
 		<input type="hidden" name="type" value="iCal">
 		<input type="hidden" name="params[owner]" value="<%= data.owner %>">
-                <legend class="hidden">Importar agenda</legend>
+                <legend class="hidden">Importar <%=data.typeView == 0 ? 'eventos' : 'tarefas'%></legend>
                 <p class="input-group">
                         <label for="data">Arquivo:</label>
@@ -21,5 +21,5 @@
                         <input type="file" name="data" value=""/>
                         <span class="tip">Escolha o arquivo que contenha um ou vários eventos. A Agenda do Expresso pode importar informações de evento no formato iCal.</span>
-                        <label for="calendar">Agenda:</label>
+                        <label for="calendar"><%=data.typeView == 0 ? 'Agenda:' : 'Grupo:'%></label>
                         <select name="params[calendar]">
 			<% for( var i = 0; i < data.calendars.length; i++ ){ %>
@@ -27,5 +27,5 @@
 			<% } %>
                         </select>
-                        <span class="tip">Agenda da qual os eventos serão importados</span>
+                        <span class="tip"><%=data.typeView == 0 ? 'Agenda da' : 'Grupo do'%> qual os eventos serão importados</span>
                 </p>
         </fieldset>
@@ -42,5 +42,5 @@
                 <legend class="hidden">Exportar agenda</legend>
                 <p class="input-group">
-                        <label for="calendar">Agenda:</label>
+                        <label for="calendar"><%=data.typeView == 0 ? 'Agenda:' : 'Grupo:'%></label>
                         <select name="calendar">
                             <!--<option value="cal_all">Todas agendas</option>-->
@@ -49,5 +49,5 @@
 			    <% } %>
                         </select>
-                        <span class="tip">Escolha a agenda que deseja exportar. A Agenda do Expresso pode exportar informações de evento no formato iCal.</span>
+                        <span class="tip">Escolha <%=data.typeView == 0 ? 'a agenda' : 'o grupo'%> que deseja exportar. <%=data.typeView == 0 ? 'A Agenda' : 'O Grupo'%> do Expresso pode exportar informações de <%=data.typeView == 0 ? 'eventos' : 'tarefas'%> no formato iCal.</span>
                 </p>
         </fieldset>
Index: trunk/prototype/modules/calendar/templates/calendar_day_print.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/calendar_day_print.ejs	(revision 6996)
+++ trunk/prototype/modules/calendar/templates/calendar_day_print.ejs	(revision 6996)
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+	<head>
+		<link rel="stylesheet" type="text/css" href="../prototype/modules/calendar/css/print.css">
+		<title>Visualização Diária</title>
+	</head>
+	<body>	
+	<div class="day">
+		<div class="title_print"> <img src="../prototype/modules/calendar/img/navbar.png"> <%= data.InfoPage %> </div>			
+		<%
+		if(data.days){
+			for(var jj in data.days.events[0]){
+		%>
+			<div class="content_month_print">	
+				<div class="allDay_list_label"><span>Dia Todo</span></div>
+				<% for(var ii=0; ii<data.days.events[0][jj].events.length; ii++){ 
+					if(!data.days.events[0][jj].events[ii].allDay)
+						continue;
+				%>
+					<%
+						var img_type = "";
+						var title_type = "";
+						if(data.days.events[0][jj].events[ii].type == '1'){
+							img_type = "../prototype/modules/calendar/img/event.png";
+							title_type = "Evento";
+						}if(data.days.events[0][jj].events[ii].type == '2'){
+							img_type = "../prototype/modules/calendar/img/task.png"; 
+							title_type = "Tarefa";
+						}if(data.days.events[0][jj].events[ii].type == '3'){
+							img_type = "../prototype/modules/calendar/img/activity_icon.jpg"; 
+							title_type = "Atividade";
+						}
+					%>
+					<div class="calendar_day_item_print"><img title="<%= title_type %>" src="<%= img_type %>"><span><%= data.days.events[0][jj].events[ii].summary %></span></div>
+				<% } %>
+			</div>
+			<div>
+				
+			<div class="calendar_list_print">
+			<% for(var ii=0; ii<data.days.events[0][jj].events.length; ii++){ 
+				if(data.days.events[0][jj].events[ii].allDay)
+					continue;
+			%>
+				<%
+					var img_type = "";
+					var title_type = "";
+					if(data.days.events[0][jj].events[ii].type == '1'){
+						img_type = "../prototype/modules/calendar/img/mini-event.png";
+						title_type = "Evento";
+					}if(data.days.events[0][jj].events[ii].type == '2'){
+						img_type = "../prototype/modules/calendar/img/mini-task.png"; 
+						title_type = "Tarefa";
+					}if(data.days.events[0][jj].events[ii].type == '3'){
+						img_type = "../prototype/modules/calendar/img/activity_icon.jpg"; 
+						title_type = "Atividade";
+					}
+				%>
+				<div class="calendar_item_print"><img title="<%= title_type %>" src="<%= img_type %>"><span><%= data.days.events[0][jj].events[ii].startHour %> - <%= data.days.events[0][jj].events[ii].endHour %> | <%= data.days.events[0][jj].events[ii].summary %></span></div>
+			<% } %>
+			</div>
+			<br>			
+			</div><!--days-->
+		<%	
+			}
+		}%>
+	</div><!--mounth-->
+	</body>
+</html>
Index: trunk/prototype/modules/calendar/templates/activity_information_task.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/activity_information_task.ejs	(revision 6996)
+++ trunk/prototype/modules/calendar/templates/activity_information_task.ejs	(revision 6996)
@@ -0,0 +1,3 @@
+<% if(data){ %>
+	Nome: <%= data.name %><br>
+<% } %>
Index: trunk/prototype/modules/calendar/templates/participants_add_itemlist.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/participants_add_itemlist.ejs	(revision 6203)
+++ trunk/prototype/modules/calendar/templates/participants_add_itemlist.ejs	(revision 6996)
@@ -2,8 +2,8 @@
 	<div style="overflow:hidden; width:100%; display:table;">
 		<div class="attendee-options">
-			<%if( !data[0].isDirty && (data[0].acl.organization || data[0].acl.write || data[0].acl.inviteGuests) ){%>
+			<%if( !data[0].isDelegate && (!data[0].isDirty && data[0].notEvent) || (!data[0].isDirty && data[0].acl && (data[0].acl.organization || data[0].acl.write || data[0].acl.inviteGuests))){%>
 				<a href="#" class="button delegate attendee-options-button-delegate new">Delegar participação a este participante</a>
 			<%}%>
-			<%if(data[0].acl.organization || data[0].acl.write){%>
+			<%if(!data[0].noEvent && data[0].acl && (data[0].acl.organization || data[0].acl.write)){%>
 				<a class="button edit attendee-options-button-edit new">Editar permissões</a>
 			<%}%>
@@ -14,5 +14,7 @@
 		<input type="hidden" name="attendee[]" value="<%= data[0].id %>">
 		<input type="hidden" name="attendeeType[]" value="<%=data[0].isExternal%>">
-		<input type="hidden" name="attendeeAcl[]" value="r">
+		<%if(!data[0].noEvent){%>
+            <input type="hidden" name="attendeeAcl[]" value="r">
+        <%}%>
 		<input type="hidden" name="delegatedFrom[]" value="0">
 		<label title="<%= data[0].name ? data[0].name : '' %>" class="name"><%= data[0].name ? data[0].name : '' %></label>
@@ -20,4 +22,3 @@
 
 	</div>
-	
 </li>
Index: trunk/prototype/modules/calendar/templates/task_add_itemlist.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/task_add_itemlist.ejs	(revision 6996)
+++ trunk/prototype/modules/calendar/templates/task_add_itemlist.ejs	(revision 6996)
@@ -0,0 +1,14 @@
+<li class="task"> 
+    <div style="overflow:hidden; width:100%; display:table;">	
+	<div class="activity-options" style="float: right; margin: 0 10px 0 0;">
+	    <%if(data[0].isWrite){%>
+		<a class="button edit activity-options-button-edit new ui-icon-pencil">Editar</a>
+	    <%}%>
+	    <a class="button info activity-options-button-notice new ui-icon-notice">Informações</a>
+	    <a class="button close new">Remover</a>
+	</div>	
+	<input class="new" type="checkbox" value="<%= data[0].idTask %>">
+        <input type="hidden" name="idtask[]" value="<%= data[0].idTask %>">
+	<input type="hidden" name="idTaskToActivity[]" value="<%= data[0].idTaskToActivity %>">
+	<label title="<%= data[0].description %>" class="name"><%= data[0].description %></label>
+</li>
Index: trunk/prototype/modules/calendar/templates/task_activity_add.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/task_activity_add.ejs	(revision 6996)
+++ trunk/prototype/modules/calendar/templates/task_activity_add.ejs	(revision 6996)
@@ -0,0 +1,40 @@
+    <dl class="block-activity-group-select activitys-list">
+        <dt class="activity-group-select">Grupo de tarefas</dt>
+        <dd class="group-select">
+            <ul class="activity-group-select">
+                <select name="groupFilter">
+                    <%for(var i = 0; i < Calendar.groups.length; i++){%>
+                        <option value="<%= Calendar.groups[i].id  %>"><%= Calendar.groups[i].name %></option>
+                    <%}%>
+                </select>
+            </ul>
+        </dd>
+    
+	<dt class="activity-list">Tarefas</dt>
+		<dd class="task-activity-list">
+			<ul class="task-activity-list">
+
+	<% if(data.activity.tasks.length <= 0) { %>
+		<li class="not-activity">Não há outras tarefas.</li>
+	<% } %>
+		
+			</ul>
+		</dd>
+	</dl>
+
+<dl class="block-add-activity search" style="">
+	<dt class="add-activity search">Pesquisar tarefa</dt>
+	<dd class="add-activity">
+		<fieldset class="block-add-activity" title="Participantes">
+			<fieldset class="add-activity-search search-field ui-corner-all">
+				<input class="search" type="text" />
+				<span class="ui-icon ui-icon-search"></span>
+			</fieldset>
+			<ul class="search-result-list ui-corner-all">
+
+			</ul>
+
+		</fieldset>
+	</dd>
+</dl>
+
Index: trunk/prototype/modules/calendar/templates/event_add.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/event_add.ejs	(revision 6525)
+++ trunk/prototype/modules/calendar/templates/event_add.ejs	(revision 6996)
@@ -171,5 +171,5 @@
 <div class="overflow_add_calender">
 	<fieldset id="calendar_addevent_details5" class="tab-level2">
-        <form id="fileupload" action="attachment:detail" method="POST">
+        <form id="fileuploadevent" action="attachment:detail" method="POST">
         <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
         <div class="row fileupload-buttonbar">
@@ -183,10 +183,10 @@
 				<%}%>
 				<%if(data.event.acl.organization || data.event.acl.write){%>
-					<button type="button" class="button btn-danger delete">
+					<button type="button" class="button btn-danger delete <%= data.event && data.event.attachments && data.event.attachments.length ? '' : 'hidden' %>">
 						<i class="icon-trash icon-white"></i> Remover Todos
 					</button>
 				<%}%>
             </div>
-            <div id="fileupload-progress"></div>
+            <div id="fileupload-progress-event"></div>
             <div class="files-list">
                <ul class="attachments-list">
Index: trunk/prototype/modules/calendar/templates/preferences_calendar.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/preferences_calendar.ejs	(revision 6921)
+++ trunk/prototype/modules/calendar/templates/preferences_calendar.ejs	(revision 6996)
@@ -71,10 +71,18 @@
 			</p>
 
+			<p class="input-group"> 
+                <label for="defaultCalendar">Agenda padrão:</label> 
+                <select name="defaultCalendar" > 
+                    <%for(var i = 0; i < data.calendars.length; i++){%> 
+                        <option value="<%=data.calendars[i].id%>"> <%= data.calendars[i].name %></option> 
+                    <%}%> 
+                </select>
+			</p>
+
 			<p class="input-group">
-				<label for="defaultCalendar">Agenda padrão:</label>
-				<select name="defaultCalendar" >
-					<%for(var i = 0; i < data.calendars.length; i++){%>
-						<option value="<%=data.calendars[i].id%>"> <%= data.calendars[i].name %></option>
-					<%}%>
+				<label for="useDesktopNotification">Usar alarme desktop:</label>
+				<select name="useDesktopNotification" >
+					<option value="1" <%= data.preferences.useDesktopNotification == '1' ? 'selected="selected"' : '' %>>Sim</option>
+					<option value="0" <%= data.preferences.useDesktopNotification != '1' ? 'selected="selected"' : '' %>>Não</option>
 				</select>
 			</p>
Index: trunk/prototype/modules/calendar/templates/attendees_task.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/attendees_task.ejs	(revision 6996)
+++ trunk/prototype/modules/calendar/templates/attendees_task.ejs	(revision 6996)
@@ -0,0 +1,169 @@
+    <%var iconStatus = ['','ui-icon-check', 'ui-icon-radio-off', 'ui-icon-close', 'ui-icon-help', 'ui-icon-transferthick-e-w', 'ui-icon-contact']
+      var legendStatus = ['','Confirmado','Tentativa','Cancelado','Sem Resposta','Delegado', 'Participante']
+    %>
+    <dl class="block-attendee-list attendees-list">
+        <dt class="me"><%= data.task.me.user ? data.task.me.user.name : data.task.me.name %></dt>
+        <dd class="me">
+            <select class="status" name="status">
+                <%if(!data.task.delegatedFrom[data.task.me.id]){%>
+                    <option value="1" <%= data.task.status=='1' ? 'selected="selected"':'' %>>Eu vou</option>
+                        <option value="3" <%= data.task.status=='3' ? 'selected="selected"':'' %>>Eu não vou</option>
+                        <option value="2" <%= data.task.status=='2' ? 'selected="selected"':'' %>>Talvez</option>
+                        <option class="hidden" value="5">Delegado</option>
+                <%}else{%>
+                    <option value="5" 'selected="selected"'>Delegado</option>
+                <%}%>
+            </select>
+	    <% if (data.task.id && !data.task.delegatedFrom[data.task.me.id]) { %>
+		    <fieldset class="add-attendee-options-read">
+			    <a href="#" class="button participant-delegate add-attendee-options-button">Delegar participação a um novo participante</a>
+		    </fieldset>
+	    <%}%>
+            <p class="input-group request-update <%=data.task.delegatedFrom[data.task.me.id] ? '' : "hidden"%>">
+                <input type="checkbox" name="receiveNotification" value="true" <%=data.task.me.receiveNotification =='1' ? 'checked="checked"' : ''%>/>
+                <label for="request-update">Receber atualizações</label>
+            </p>
+            
+            <input type="hidden" name="delegatedFrom[]" value="<%=data.task.me.delegatedFrom%>">
+            <input type="hidden" name="attendee[]" value="<%=data.task.me.id%>">
+            <input type="hidden" name="attendeeType[]" value="0">            
+        </dd>
+
+        <dt class="attendee-list">Convidados</dt>
+        <dd class="attendee-list">
+            <ul class="attendee-list">
+                <label for="attendee" title="<%=  data.task.me.user ? data.task.me.user.mail : data.task.me.mail %>" class="mail hidden"></label>
+                
+                <li class="organizer <%= data.task.isOrganizer ? "hidden" : "" %>"> 
+                    <div style="overflow:hidden; width:100%; display:table;">
+                        <span class="space-status ui-icon <%=iconStatus[data.task.organizer.status]%>" title="<%=legendStatus[data.task.organizer.status]%>"></span>
+                        <span class="space-special ui-icon ui-icon-person" title="Organizador"></span>
+                        
+                        <% if(data.task.me.id != data.task.organizer.id){%> 
+                            <input type="checkbox" value="<%= data.task.organizer.id %>" disabled="disabled">
+                            <input type="hidden" name="attendee[]" value="<%=data.task.organizer.id%>">
+                            <input type="hidden" name="attendeeType[]" value="0">
+                            <input type="hidden" name="delegatedFrom[]" value="<%=data.task.organizer.delegatedFrom%>">
+                        <%}%>
+                        <input type="hidden" name="attendee_organizer" value="<%=data.task.organizer.id%>">
+                        <label for="attendee_organizer" title="<%= data.task.organizer.name ? data.task.organizer.name: '' %>" class="name name-special"><%= data.task.organizer.name ? data.task.organizer.name : '' %></label>
+                        <label for="attendee_organizer" title="<%= data.task.organizer.mail ? data.task.organizer.mail: '' %>" class="mail name-special"><%= data.task.organizer.mail ? data.task.organizer.mail : '' %></label>
+                    </div>
+                </li>
+            <%if(!!data.task.delegatedFrom[data.task.me.id]){
+                var delegated_me = data.task.delegatedFrom[data.task.me.id]%>
+                <li class="me-delegated">
+                    <div style="overflow:hidden; width:100%; display:table;">
+                        <span class="space-status ui-icon <%=iconStatus[delegated_me.status]%>" title="<%=legendStatus[delegated_me.status]%>"></span>
+                        <span class="space-special ui-icon <%=iconStatus[5]%>" title="Delegado para"></span>
+                        <input type="checkbox" value="<%= delegated_me.id%>" disabled="disabled">
+                        <label for="me-delegated" title="<%= delegated_me.name ? delegated_me.name: '' %>" class="name name-special"><%= delegated_me.name ? delegated_me.name : '' %></label>
+                        <label for="me-delegated" title="<%= delegated_me.mail ? delegated_me.mail: '' %>" class="mail name-special"><%= delegated_me.mail ? delegated_me.mail : '' %></label>
+                    </div>
+                </li>
+            <%}%>
+            <% if (data.task && data.task.attendee.length > 0) {
+                for (var i=0; i< data.task.attendee.length; i++) {%>
+                    <li class="attendee"> 
+                        <div style="overflow:hidden; width:100%; display:table;">
+                            <%if(data.task.delegatedFrom[data.task.attendee[i].id]){%>
+                                <span class="open-delegate new ui-icon ui-icon-triangle-1-e"></span>
+                            <%}else{%>
+                                <span class="space-status ui-icon <%=iconStatus[data.task.attendee[i].status]%>" title="<%=legendStatus[data.task.attendee[i].status]%>"></span>
+                            <%}%>
+                            <span class="space-special ui-icon <%= !!data.task.delegatedFrom[data.task.attendee[i].id] ? iconStatus[5] : iconStatus[6]%>" title="<%=!!data.task.delegatedFrom[data.task.attendee[i].id] ? legendStatus[5] : legendStatus[6]%>"></span>
+
+                            <input type="checkbox" class="new" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%> value="<%= data.task.attendee[i].id %>">
+
+                            <input type="hidden" name="attendee[]" value="<%=data.task.attendee[i].id%>">
+                            <input type="hidden" name="attendeeType[]" value="<%=data.task.attendee[i].isExternal%>">
+                            <input type="hidden" name="attendeeAcl[]" value="<%=data.task.attendee[i].acl%>">
+                            <input type="hidden" name="delegatedFrom[]" value="<%=data.task.attendee[i].delegatedFrom%>">
+                            <label title="<%= data.task.attendee[i].name ? data.task.attendee[i].name: '' %>" class="name <%= !!data.task.delegatedFrom[data.task.attendee[i].id] ? "name-special-delegated" : "name-special" %>"><%= data.task.attendee[i].name ? data.task.attendee[i].name : '' %></label>
+                            <label title="<%= data.task.attendee[i].mail ? data.task.attendee[i].mail : ''%>" class="mail <%= !!data.task.delegatedFrom[data.task.attendee[i].id] ? "name-special-delegated" : "name-special"%>"><%= data.task.attendee[i].mail ? data.task.attendee[i].mail : '' %></label>
+                            <span class="ui-icon ui-icon-close ui-corner-all ui-icon-float-right"></span>
+                        </div>
+			<%if(data.task.isOrganizer){%>
+			    <div class="attendee-options">
+				<a class="button close new">Remover</a>
+			    </div>
+			<%}%>
+
+                        <%if(!!data.task.delegatedFrom[data.task.attendee[i].id]){%>
+                            <%var attendee = data.task.delegatedFrom[data.task.attendee[i].id]%>
+                            <% while(attendee != 0){%>
+                                <div class="list-delegates hidden">
+                                    <div style="overflow:hidden; width:100%; display:table;">
+                                        <span class="status-delegate ui-icon <%=iconStatus[attendee.status]%>" title="<%=legendStatus[attendee.status]%>"></span>
+                                        <span class="space-special-delegated ui-icon <%= !!data.task.delegatedFrom[attendee.id] ? iconStatus[5] : iconStatus[6]%>" title="<%=!!data.task.delegatedFrom[attendee.id] ? legendStatus[5] : legendStatus[6]%>"></span>
+                                        <input type="hidden" name="attendee[]" value="<%=attendee.id%>">
+                                        <input type="hidden" name="attendeeType[]" value="<%=attendee.isExternal%>">
+                                        <input type="hidden" name="attendeeAcl[]" value="<%=attendee.acl%>">
+                                        <input type="hidden" name="delegatedFrom[]" value="<%=attendee.delegatedFrom%>">
+                                        <label title="<%= attendee.name ? attendee.name : '' %>" class="name <%=attendee.status == 5 ? "name-status-delegated-delegated" : "name-status-delegated-none"%>"><%= attendee.name ? attendee.name : '' %></label>
+                                        <label title="<%= attendee.mail ? attendee.mail : '' %>" class="mail <%=attendee.status == 5 ? "name-status-delegated-none" : "name-status-delegated-none"%>"><%= attendee.mail ? attendee.mail : '' %></label>
+                                        <span class="ui-icon ui-icon-close ui-corner-all ui-icon-float-right"></span>
+                                    </div> 
+                                </div>
+                                <%attendee = !!data.task.delegatedFrom[attendee.id] ? data.task.delegatedFrom[attendee.id] : 0%>
+                            <%}%>
+                        <%}%>
+                        
+
+                    </li>   
+                <%} 
+            } else if(data.task.me.id == data.task.organizer.id && !(data.task.attendee.length > 0) ) { %>
+                <li class="not-attendee">Não há outros participantes.</li>
+            <% } %>
+            </ul>
+        </dd>
+        <dd class="attendee-list-add" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%>>
+            <fieldset class="add-attendee-input input-field-rounded ui-corner-all">
+                <span class="ui-icon ui-icon-plus" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%>></span>
+                <input class="plus" <%= data.task.isOrganizer ? '' : 'disabled="disabled"'%> type="text" />
+            </fieldset>
+        </dd>
+        
+        <div class="ui-widget email-validation hidden">
+            <div style="padding: 0.2em 0.7em; margin-top: 5px;" class="ui-state-highlight ui-corner-all"> 
+                <p class="message">
+                    <span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-info"></span> 
+                    <label></label>
+                </p>
+            </div>
+        </div>
+        
+        <dd class="attendee-list-brief">
+        <% if (data.task && data.task.attendee.length > 0) { %>
+          <ul class="attendees-count">
+            <li><label>Sim:</label><%=data.task.statusParticipants.accepted%></li>
+            <li><label>Não:</label><%=data.task.statusParticipants.cancelled%></li>
+            <li><label>Talvez:</label><%=data.task.statusParticipants.tentative%></li>
+            <li><label>Aguardando:</label><%=data.task.statusParticipants.unanswered%></li>
+          </ul>     
+        <% } %>
+        <% if (data.task && data.task.sizeAttendeeLimit){%>
+        <ul class="attendees-count">
+            <li>Evento com muitos participantes, exibindo os 100 primeiros!</li>
+        </ul>
+        <% } %>
+        </dd>
+        
+    </dl>
+
+    <dl class="block-add-attendee search <%= data.task.isOrganizer ? '' : 'hidden'%>">
+    <dt class="add-attendee search">Adicionar outros convidados</dt>
+    <dd class="add-attendee">
+        <fieldset class="block-add-attendee" title="Participantes">
+            <fieldset class="add-attendee-search search-field ui-corner-all">
+                <input class="search" type="text" />
+                <span class="ui-icon ui-icon-search"></span>
+            </fieldset>
+            <ul class="search-result-list ui-corner-all">
+
+            </ul>
+
+        </fieldset>
+    </dd>
+</dl>
+
