Index: /trunk/prototype/modules/calendar/interceptors/DBMapping.php
===================================================================
--- /trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 7405)
+++ /trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 7518)
@@ -1131,4 +1131,10 @@
     
     public function deleteSchedulable(&$uri, &$params, &$criteria, $original) {
+
+        ob_start();
+        print_r( $criteria );
+        $output = ob_get_clean();
+        file_put_contents( "/tmp/log-douglasz.log", $output , FILE_APPEND);
+
         if (Config::module('useCaldav', 'expressoCalendar'))
 	    require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php';
@@ -1136,5 +1142,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];
 
@@ -1173,8 +1179,26 @@
 
             $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)));
-	    }
+
+
+            if(isset($criteria['type']) && $criteria['type'] == '2'){
+
+                $tasks = Controller::find(array('concept' => 'taskToActivity'), array('task'), array('filter' => array('=', 'activity', $idSchedulable)));
+
+                if(is_array( $tasks ) and count( $tasks ) > 0){
+                    Controller::delete(array('concept' => 'taskToActivity'), null, array('filter' => array('=', 'activity', $idSchedulable)));
+                }
+
+                if(isset($criteria['removeTaskToActivity']) && $criteria['removeTaskToActivity']){
+                    if(is_array( $tasks ) and count( $tasks ) > 0){
+
+                        $ids = array();
+                        foreach($tasks as $v){
+                            $ids[] = $v['task'];
+                        }
+
+                        Controller::delete(array('concept' => 'schedulable'), false, array('filter' => array('IN','id', $ids )));
+                    }
+                }
+            }
         }
         
Index: /trunk/prototype/modules/calendar/js/activity.helpers.js
===================================================================
--- /trunk/prototype/modules/calendar/js/activity.helpers.js	(revision 7405)
+++ /trunk/prototype/modules/calendar/js/activity.helpers.js	(revision 7518)
@@ -187,17 +187,23 @@
 UI.dialogs.addActivity.find(".menu-addactivity")
 .children(".delete").click(function(){
-    $.Zebra_Dialog('Tem certeza que deseja excluir a atividade?', {
+    $.Zebra_Dialog('A exclusão desta atividade também traz a opção de excluir suas tarefas adicionadas. O que deseja excluir?', {
 	'type':     'question',
+    'width': '400',
 	'overlay_opacity': '0.5',
-	'buttons':  ['Sim', 'Não'],
+	'buttons':  ['Atividade e Tarefas', 'Apenas Atividade', 'Cancelar'],
 	'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");
-	    }
+	    if(clicked == 'Apenas Atividade'){
+            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']],criteria:{type:2}});
+            Calendar.rerenderView(true);
+            /********************/
+            UI.dialogs.addActivity.dialog("close");
+	    }else if(clicked == 'Atividade e Tarefas'){
+            canDiscardActivityDialog = true;
+            DataLayer.removeFilter('schedulable', {filter: ['AND', ['=', 'id', objActivity.id], ['=', 'calendar', objActivity.group], ['=','user',(objActivity.me.user ? objActivity.me.user.id : objActivity.me.id)], ['=', 'type', '2']],criteria:{removeTaskToActivity: true, type:2}});
+            Calendar.rerenderView(true);
+            UI.dialogs.addActivity.dialog("close");
+        }
 	}
     });
