Index: trunk/prototype/config/participant.ini
===================================================================
--- trunk/prototype/config/participant.ini	(revision 7377)
+++ trunk/prototype/config/participant.ini	(revision 7980)
@@ -21,4 +21,5 @@
 [after.create]
 createParticipantHistoric = modules/calendar/interceptors/DBMapping.php
+autoImportCalendar = modules/calendar/interceptors/DBMapping.php
 
 [before.create]
Index: trunk/prototype/modules/calendar/interceptors/DBMapping.php
===================================================================
--- trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 7973)
+++ trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 7980)
@@ -169,4 +169,5 @@
     public function schedulableSecurity(&$uri, &$params, &$criteria, $original)
     {
+
         if( !isset($criteria['filter'][1]) || !$criteria['filter'][1] == 'uid')
         {
@@ -763,4 +764,25 @@
 	    }
 	}
+    }
+
+    static function autoImportCalendar(&$uri, &$params, &$criteria, $original){
+        $autoCommit = Controller::service('PostgreSQL')->execResultSql('Select config_value FROM phpgw_config WHERE config_app = \'expressoCalendar\' AND config_name = \'expressoCalendar_autoImportCalendars\'');
+
+
+        if(isset($autoCommit[0]) && $autoCommit[0]['config_value'] == 'true')
+        {
+            if(isset($original['properties']) && isset($original['properties']['user'])  && isset($original['properties']['isOrganizer']) &&  $original['properties']['isOrganizer'] != '1')
+            {
+                $defaultCalendar = Controller::find(array('concept' => 'modulePreference'), array('value') , array('filter' => array( 'and' , array('=' , 'name' , 'dafaultImportCalendar') , array('=' , 'module' , 'expressoCalendar') , array('=' , 'user' , $original['properties']['user'])  )) );
+                if(isset($defaultCalendar[0]) && $defaultCalendar[0]['value'] > 0)
+                {
+                    Controller::create(array('concept' => 'calendarToSchedulable'),
+                        array('schedulable' => $original['properties']['schedulable'],
+                            'calendar' => $defaultCalendar[0]['value']
+                        )
+                    );
+                }
+            }
+        }
     }
 
@@ -1392,9 +1414,17 @@
 
 	    Controller::delete(array('concept' => 'calendar', 'id' => $signature['calendar']));
-		
-		$permissions = Controller::find(array('concept' => 'calendarToPermission'), array('id'), array('filter' => array('=', 'calendar', $signature['calendar'])));
-
-		
-		
+
+        $autoCommit = Controller::service('PostgreSQL')->execResultSql('Select config_value FROM phpgw_config WHERE config_app = \'expressoCalendar\' AND config_name = \'expressoCalendar_autoImportCalendars\'');
+        if(isset($autoCommit[0]) && $autoCommit[0]['config_value'] == 'true')
+        {
+            $defaultCalendar = Controller::find(array('concept' => 'modulePreference'), array('value','id') , array('filter' => array( 'and' , array('=' , 'name' , 'dafaultImportCalendar') , array('=' , 'module' , 'expressoCalendar') , array('=' , 'user' , $original['properties']['user'])  )) );
+            if(isset($defaultCalendar[0])  && $defaultCalendar[0]['value'] == $signature['calendar'] )
+            {
+                Controller::delete(array('concept' => 'modulePreference', 'id' => $defaultCalendar[0]['id']));
+            }
+        }
+
+        $permissions = Controller::find(array('concept' => 'calendarToPermission'), array('id'), array('filter' => array('=', 'calendar', $signature['calendar'])));
+
 		if($permissions && count($permissions) > 0){
 			$ids = array();
@@ -1543,5 +1573,14 @@
                 }
 
-    		    DAViCalAdapter::importCollection($v->url, $calCreated['id']);
+                if($i == 0)
+                {
+                    $pref = array();
+                    $pref['user'] = $_SESSION['wallet']['user']['uidNumber'];
+                    $pref['value'] = $calCreated['id'];
+                    $pref['name'] = 'dafaultImportCalendar' ;
+                    $pref['module'] = 'expressoCalendar';
+                    Controller::create(array('concept' => 'modulePreference'), $pref);
+                }
+
     		}
 	    } else {
@@ -1565,4 +1604,14 @@
 
     		$sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig);
+
+
+            $pref = array();
+            $pref['user'] = $_SESSION['wallet']['user']['uidNumber'];
+            $pref['value'] = $calCreated['id'];
+            $pref['name'] = 'dafaultImportCalendar' ;
+            $pref['module'] = 'expressoCalendar';
+            Controller::create(array('concept' => 'modulePreference'), $pref);
+
+
         }
     
Index: trunk/prototype/modules/calendar/schedules.php
===================================================================
--- trunk/prototype/modules/calendar/schedules.php	(revision 7956)
+++ trunk/prototype/modules/calendar/schedules.php	(revision 7980)
@@ -161,10 +161,14 @@
             $attend = Controller::read(array('concept' => 'participant'), null, array('filter' => array('AND', array('=','schedulable',$v['id']), array('=','user', Config::me('uidNumber'))  )));
 
+            $result[$i]['unanswered'] = 0;
+
             if(count($attend) > 0 && !empty($attend)){
-
                 if(array_key_exists(0, $attend))
                     $attend = $attend[0];
 
                 $result[$i]['editable'] = (strstr($attend['acl'],"w") || strstr($attend['acl'],"o") || $attend['isOrganizer'] == '1') ? 1 : 0;
+
+                if($attend['status'] == STATUS_UNANSWERED)
+                    $result[$i]['unanswered'] = 1;
 
             }else{
Index: trunk/prototype/modules/calendar/js/calendar.codecs.js
===================================================================
--- trunk/prototype/modules/calendar/js/calendar.codecs.js	(revision 7959)
+++ trunk/prototype/modules/calendar/js/calendar.codecs.js	(revision 7980)
@@ -1858,5 +1858,6 @@
 				occurrence: occurrences[i],
 				type: typeEvent,
-				calendar: evt.calendar, 
+				calendar: evt.calendar,
+                unanswered: evt.unanswered,
 				status: evt.status
 				}, (parseInt(typeEvent) == 1 ? eventEditable(evt.id, isRepeat, i ) : (parseInt(typeEvent) == 2 ? taskEditable(evt.id) : {editable: false, disableResizing: true, disableDragging: true}))));
Index: trunk/prototype/modules/calendar/js/helpers.js
===================================================================
--- trunk/prototype/modules/calendar/js/helpers.js	(revision 7964)
+++ trunk/prototype/modules/calendar/js/helpers.js	(revision 7980)
@@ -1559,11 +1559,13 @@
 	DataLayer.render( 'templates/preferences_calendar.ejs', {
 	    preferences:User.preferences, 
-	    calendars: Calendar.calendars
+	    calendars: Calendar.calendars,
+        signatureOf : Calendar.signatureOf
 	    }, function( template ){
 	    var tabPrefCalendar = jQuery('#preference_tab').html( template ).find('.preferences-win');
 		
-	    tabPrefCalendar.find('option[value="'+User.preferences.defaultCalendar+'"]').attr('selected','selected').trigger('change');
-		
-	    DataLayer.render( 'templates/timezone_list.ejs', {}, function( timezones_options ){
+	    tabPrefCalendar.find('select[name="defaultCalendar"] option[value="'+User.preferences.defaultCalendar+'"]').attr('selected','selected').trigger('change');
+        tabPrefCalendar.find('select[name="dafaultImportCalendar"] option[value="'+User.preferences.dafaultImportCalendar+'"]').attr('selected','selected').trigger('change');
+
+        DataLayer.render( 'templates/timezone_list.ejs', {}, function( timezones_options ){
 		tabPrefCalendar.find('select[name="timezone"]').html(timezones_options).find('option[value="'+User.preferences.timezone+'"]').attr('selected','selected').trigger('change');
 	    });
Index: trunk/prototype/modules/calendar/js/init.js
===================================================================
--- trunk/prototype/modules/calendar/js/init.js	(revision 7957)
+++ trunk/prototype/modules/calendar/js/init.js	(revision 7980)
@@ -359,25 +359,36 @@
 			var status_ball = ""; //nome da imagem a ser inserida
 			var status_img = "";
-			if(event.type == 1)
-				img_icon = "mini-event.png";
-			if(event.type == 2)
-				img_icon = "mini-task.png";
-			if(event.type == 3)
-				img_icon = "mini-activity.png";
-
-			//se for diferente de evento(type 1).
-			if(event.type != 1){
-				if(event.status == "1"){
-					status_ball = "gray.png";
-				}else if(event.status == "2"){
-					status_ball = "yellow.png";
-				}else if(event.status == "3"){
-					status_ball = "green.png";
-				}else if(event.status == "4"){
-					status_ball = "red.png";
-				}
-
-				status_img = '<img style="width: 8px; height: 8px; margin-bottom: 2px;" src="../prototype/modules/calendar/img/' + status_ball + '"></img>';
-			}
+
+            if( !!parseInt(event.unanswered)  ){
+
+                img_icon = "mini-attention.png";
+
+            }else{
+
+                if(event.type == 1)
+                    img_icon = "mini-event.png";
+                if(event.type == 2)
+                    img_icon = "mini-task.png";
+                if(event.type == 3)
+                    img_icon = "mini-activity.png";
+
+                //se for diferente de evento(type 1).
+                if(event.type != 1){
+                    if(event.status == "1"){
+                        status_ball = "gray.png";
+                    }else if(event.status == "2"){
+                        status_ball = "yellow.png";
+                    }else if(event.status == "3"){
+                        status_ball = "green.png";
+                    }else if(event.status == "4"){
+                        status_ball = "red.png";
+                    }
+
+                    status_img = '<img style="width: 8px; height: 8px; margin-bottom: 2px;" src="../prototype/modules/calendar/img/' + status_ball + '"></img>';
+                }
+
+            }
+
+
 			//html que exibe a imagem do type e do status
     	    element.find(".fc-event-inner.fc-event-skin").prepend($('<img style="width: 11px; height: 13px;" class="" src="../prototype/modules/calendar/img/' + img_icon + '"></img>' + status_img));
Index: trunk/prototype/modules/calendar/templates/attendee_add.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/attendee_add.ejs	(revision 7388)
+++ trunk/prototype/modules/calendar/templates/attendee_add.ejs	(revision 7980)
@@ -11,5 +11,6 @@
 						<option value="3" <%= data.event.status=='3' ? 'selected="selected"':'' %>>Eu não vou</option>
 						<option value="2" <%= data.event.status=='2' ? 'selected="selected"':'' %>>Talvez</option>
-						<option class="hidden" value="5">Delegado</option>
+                        <option value="4" <%= data.event.status=='4' ? 'selected="selected"':'' %>>Sem resposta </option>
+					    <option class="hidden" value="5" >Delegado</option>
 					<%}%>
 				<%}else{%>
Index: trunk/prototype/modules/calendar/templates/preferences_calendar.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/preferences_calendar.ejs	(revision 7143)
+++ trunk/prototype/modules/calendar/templates/preferences_calendar.ejs	(revision 7980)
@@ -72,5 +72,5 @@
 
 			<p class="input-group"> 
-                <label for="defaultCalendar">Agenda padrão:</label> 
+                <label for="defaultCalendar">Agenda padrão para Criação de Eventos:</label>
                 <select name="defaultCalendar" > 
                     <%for(var i = 0; i < data.calendars.length; i++){%> 
@@ -79,4 +79,16 @@
                 </select>
 			</p>
+
+            <p class="input-group">
+                <label for="dafaultImportCalendar">Agenda padrão para Importação de Eventos :</label>
+                <select name="dafaultImportCalendar" >
+                    <option value=""> </option>
+                    <%for(var i = 0; i < data.calendars.length; i++){
+                     if(data.signatureOf[data.calendars[i].id].isOwner == '1'){
+                    %>
+                    <option value="<%=data.calendars[i].id%>"> <%= data.calendars[i].name %></option>
+                    <%}}%>
+                </select>
+            </p>
 
 			<p class="input-group">
Index: trunk/prototype/modules/calendar/templates/event_detail_list.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/event_detail_list.ejs	(revision 7702)
+++ trunk/prototype/modules/calendar/templates/event_detail_list.ejs	(revision 7980)
@@ -3,5 +3,5 @@
     var encoder = {};
     encoder.alarm = {'1':'do evento','2':'da tarefa','3':'da atividade'};
-    encoder.status = {'1':'Eu vou', '2':'Talvez', '3':'Eu não vou'};
+    encoder.status = {'1':'Eu vou', '2':'Talvez', '3':'Eu não vou' , '4':'Sem resposta'};
     encoder.statusEvent = {1: 'Sem ações', 2: 'Em processo', 3: 'Completo', 4: 'Cancelado'};
     encoder.priority = {1: 'Alta', 2: 'Normal', 3: 'Baixa'};
