Index: trunk/expressoCalendar/setup/default_records.inc.php
===================================================================
--- trunk/expressoCalendar/setup/default_records.inc.php	(revision 5804)
+++ trunk/expressoCalendar/setup/default_records.inc.php	(revision 6996)
@@ -38,5 +38,6 @@
 		$oProc->query("ALTER TABLE calendar ALTER COLUMN dtstamp SET DEFAULT (date_part('epoch'::text, ('now'::text)::timestamp(3) with time zone) * (1000)::double precision);");
 	
-		$oProc->query("INSERT INTO calendar_object_type( \"id\", \"name\") VALUES ('1','VEVENT');");
+        $oProc->query("INSERT INTO calendar_object_type( \"id\", \"name\") VALUES ('1','VEVENT');");
+		$oProc->query("INSERT INTO calendar_object_type( \"id\", \"name\") VALUES ('2','TODO');");
                 $oProc->query("INSERT INTO calendar_class( \"id\", \"name\") VALUES ('1','Public'),('2','Private'),('3','Confidential');");
                 $oProc->query("INSERT INTO calendar_participant_status( \"id\", \"name\") VALUES ('1','CONFIRMED'),('2','TENTATIVE'),('3','CANCELLED'),('4','UNANSWERED'),('5', 'DELEGATED');");
Index: trunk/expressoCalendar/setup/tables_current.inc.php
===================================================================
--- trunk/expressoCalendar/setup/tables_current.inc.php	(revision 6114)
+++ trunk/expressoCalendar/setup/tables_current.inc.php	(revision 6996)
@@ -48,4 +48,5 @@
                 'duration' => array('type' => 'int', 'precision' => '8' ,'nullable' => True),
                 'tzid' => array('type' => 'varchar', 'precision' => '50' ,'nullable' => True),
+                'type' => array('type' => 'int', 'precision' => '2' ,'nullable' => false, 'default' => 0),
                 'dtstamp' => array('type' => 'int', 'precision' => '8' ,'nullable' => True)
             ),
@@ -100,4 +101,17 @@
             'uc' => array()
                 ),
+
+       'calendar_task_to_activity_object' => array(
+            'fd' => array(
+                'id' => array( 'type' => 'auto', 'nullable' => False),
+                'calendar_object_activity_id' => array(  'type' => 'int', 'precision' => '8', 'nullable' => False),
+                'calendar_object_task_id' => array(  'type' => 'int', 'precision' => '8', 'nullable' => False),
+                'owner' => array(  'type' => 'int', 'precision' => '8', 'nullable' => False),
+            ),
+            'pk' => array('id'),
+            'fk' => array(),
+            'ix' => array(),
+            'uc' => array()
+        ),
             
             
@@ -121,5 +135,9 @@
                 'tzid' => array('type' => 'varchar', 'precision' => '50' ,'nullable' => True),
                 'transp' => array( 'type' => 'int', 'precision' => '2', 'nullable' => FALSE , 'default' => 0 ),
-                'sequence' => array( 'type' => 'int', 'precision' => '8', 'nullable' => FALSE , 'default' => 0 )
+                'sequence' => array( 'type' => 'int', 'precision' => '8', 'nullable' => FALSE , 'default' => 0 ),
+                'due' => array( 'type' => 'int', 'precision' => '8', 'nullable' => FALSE , 'default' => 0 ),
+                'percentage' => array( 'type' => 'int', 'precision' => '8', 'nullable' => FALSE , 'default' => 0 ),
+                'status' => array( 'type' => 'int', 'precision' => '8', 'nullable' => FALSE , 'default' => 0 ),
+                'priority' => array( 'type' => 'int', 'precision' => '8', 'nullable' => FALSE , 'default' => 2 )
             ),
             'pk' => array('id'),
@@ -130,5 +148,5 @@
 		
             
-            'calendar_participant' => array(
+        'calendar_participant' => array(
             'fd' => array(
                 'id' => array( 'type' => 'auto', 'nullable' => False),
@@ -165,7 +183,22 @@
             'uc' => array()
 		),
-		
-		
-            'calendar_signature_alarm' => array(
+
+        'calendar_historic' => array(
+            'fd' => array(
+                'id' => array( 'type' => 'auto', 'nullable' => False),
+                'object_id' => array('type' => 'int', 'precision' => '8','nullable' => True),
+                'user_uidnumber' => array( 'type' => 'int', 'precision' => '8', 'nullable' => False),
+                'dtstamp' => array( 'type' => 'bigint', 'precision' => '16', 'nullable' => False),
+                'attribute' => array('type' => 'varchar','precision' => '50','nullable' => True),
+                'before_value' => array( 'type' => 'varchar', 'precision' => '255', 'nullable' => True),              
+                'after_value' => array( 'type' => 'varchar', 'precision' => '255', 'nullable' => True)            
+            ),
+            'pk' => array('id'),
+            'fk' => array(),
+            'ix' => array(),
+            'uc' => array()
+        ),	
+		
+        'calendar_signature_alarm' => array(
             'fd' => array(
                 'id' => array( 'type' => 'auto', 'nullable' => False),
@@ -277,7 +310,7 @@
 				'msg_alarms' => array( 'type' => 'text', 'nullable' => True),
 				'font_color' => array(  'type' => 'varchar','precision' => '6', 'nullable' => True),
-                                'background_color' => array(  'type' => 'varchar','precision' => '6', 'nullable' => True),
-                                'border_color' => array(  'type' => 'varchar','precision' => '6', 'nullable' => True)
-                                
+                'background_color' => array(  'type' => 'varchar','precision' => '6', 'nullable' => True),
+                'border_color' => array(  'type' => 'varchar','precision' => '6', 'nullable' => True),
+                'type' => array('type' => 'int', 'precision' => '2' ,'nullable' => false, 'default' => 0)
             ),
             'pk' => array('id'),
Index: trunk/expressoCalendar/setup/tables_update.inc.php
===================================================================
--- trunk/expressoCalendar/setup/tables_update.inc.php	(revision 6255)
+++ trunk/expressoCalendar/setup/tables_update.inc.php	(revision 6996)
@@ -57,15 +57,15 @@
 
 		$oProc->CreateTable('calendar_repeat_ranges', array(
-				'fd' => array(
-				    'id' => array( 'type' => 'auto', 'nullable' => False),
-				    'range_start' => array(  'type' => 'bigint','precision' => '16', 'nullable' => False),
-				    'range_end' => array(  'type' => 'bigint', 'precision' => '16', 'nullable' => False),
-				    'user_info_id' => array(  'type' => 'bigint', 'precision' => '16', 'nullable' => False)
-				),
-				'pk' => array('id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-				    )
+			'fd' => array(
+			    'id' => array( 'type' => 'auto', 'nullable' => False),
+			    'range_start' => array(  'type' => 'bigint','precision' => '16', 'nullable' => False),
+			    'range_end' => array(  'type' => 'bigint', 'precision' => '16', 'nullable' => False),
+			    'user_info_id' => array(  'type' => 'bigint', 'precision' => '16', 'nullable' => False)
+			),
+			'pk' => array('id'),
+			'fk' => array(),
+			'ix' => array(),
+			'uc' => array()
+			    )
 		);
 
@@ -79,36 +79,36 @@
 	function expressoCalendar_upgrade1_002() {
 
-            $oProc = $GLOBALS['phpgw_setup']->oProc;
+        $oProc = $GLOBALS['phpgw_setup']->oProc;
 
-            $oProc->query("ALTER TABLE calendar_repeat_occurrence ADD COLUMN exception smallint DEFAULT 0");
+        $oProc->query("ALTER TABLE calendar_repeat_occurrence ADD COLUMN exception smallint DEFAULT 0");
 
-            $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.003';
-            return $GLOBALS['setup_info']['expressoCalendar']['currentver'];
+        $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.003';
+        return $GLOBALS['setup_info']['expressoCalendar']['currentver'];
 	};
         
         $test[] = '1.003';
 	function expressoCalendar_upgrade1_003() {
-            $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.004';
-            return $GLOBALS['setup_info']['expressoCalendar']['currentver'];
+        $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.004';
+        return $GLOBALS['setup_info']['expressoCalendar']['currentver'];
 	};
 
 	$test[] = '1.004';
 	function expressoCalendar_upgrade1_004() {
-            $oProc = $GLOBALS['phpgw_setup']->oProc;
-            $oProc->query("ALTER TABLE calendar_repeat_occurrence  ALTER COLUMN exception SET default 0");
+        $oProc = $GLOBALS['phpgw_setup']->oProc;
+        $oProc->query("ALTER TABLE calendar_repeat_occurrence  ALTER COLUMN exception SET default 0");
 
-            $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.005';
-            return $GLOBALS['setup_info']['expressoCalendar']['currentver'];
+        $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.005';
+        return $GLOBALS['setup_info']['expressoCalendar']['currentver'];
 	};
         
         $test[] = '1.005';
 	function expressoCalendar_upgrade1_005() {
-            $oProc = $GLOBALS['phpgw_setup']->oProc;
-            $oProc->query("ALTER TABLE calendar_alarm ADD COLUMN alarm_offset bigint;");
+        $oProc = $GLOBALS['phpgw_setup']->oProc;
+        $oProc->query("ALTER TABLE calendar_alarm ADD COLUMN alarm_offset bigint;");
 	    $oProc->query("UPDATE calendar_alarm SET alarm_offset = obj.range_start - calendar_alarm.range_start FROM calendar_object as obj WHERE obj.id = object_id;");
 	    $oProc->query("ALTER TABLE calendar_alarm DROP COLUMN range_start;");
 	    $oProc->query("ALTER TABLE calendar_alarm DROP COLUMN range_end;");
-            $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.006';
-            return $GLOBALS['setup_info']['expressoCalendar']['currentver'];
+        $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.006';
+        return $GLOBALS['setup_info']['expressoCalendar']['currentver'];
 	};
 	
@@ -120,3 +120,55 @@
 	};
         
+	$test[] = '1.007';
+	function expressoCalendar_upgrade1_007() {
+	    $oProc = $GLOBALS['phpgw_setup']->oProc;
+
+	    $oProc->query("ALTER TABLE calendar_object ADD COLUMN priority smallint DEFAULT 0;");
+	    $oProc->query("ALTER TABLE calendar_object ADD COLUMN percentage smallint DEFAULT 0;");
+	    $oProc->query("ALTER TABLE calendar_object ADD COLUMN status smallint DEFAULT 0;");
+
+	    $oProc->query("ALTER TABLE calendar_object ADD COLUMN due bigint DEFAULT 0;");
+
+	    $oProc->query("ALTER TABLE calendar ADD COLUMN type smallint DEFAULT 0;");
+	    $oProc->query("ALTER TABLE calendar_signature ADD COLUMN type smallint DEFAULT 0;");
+
+	    $oProc->query("INSERT INTO calendar_object_type(id, name) VALUES ('2', 'TODO');");
+
+	    $oProc->query("CREATE TABLE calendar_task_to_activity_object(id serial not null, calendar_object_activity_id integer not null, calendar_object_task_id integer not null, owner integer not null);");
+
+	    $oProc->CreateTable('calendar_historic', array(
+		'fd' => array(
+		    'id' => array( 'type' => 'auto', 'nullable' => False),
+		    'object_id' => array('type' => 'int', 'precision' => '8','nullable' => True),
+		    'user_uidnumber' => array( 'type' => 'int', 'precision' => '8', 'nullable' => False),
+		    'dtstamp' => array( 'type' => 'bigint', 'precision' => '16', 'nullable' => False),
+		    'attribute' => array('type' => 'varchar','precision' => '50','nullable' => True),
+		    'before_value' => array( 'type' => 'varchar', 'precision' => '255', 'nullable' => True),              
+		    'after_value' => array( 'type' => 'varchar', 'precision' => '255', 'nullable' => True)            
+		),
+		'pk' => array('id'),
+		'fk' => array(),
+		'ix' => array(),
+		'uc' => array()
+		)
+	    );
+
+	    $oProc->CreateTable('calendar_task_to_activity_object', array(
+		'fd' => array(
+		    'id' => array( 'type' => 'auto', 'nullable' => False),
+		    'calendar_object_activity_id' => array(  'type' => 'int', 'precision' => '8', 'nullable' => False),
+		    'calendar_object_task_id' => array(  'type' => 'int', 'precision' => '8', 'nullable' => False),
+		    'owner' => array(  'type' => 'int', 'precision' => '8', 'nullable' => False),
+		),
+		'pk' => array('id'),
+		'fk' => array(),
+		'ix' => array(),
+		'uc' => array()
+		)
+	    );
+
+	    $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.008';
+	    return $GLOBALS['setup_info']['expressoCalendar']['currentver'];
+	};
+        
 ?>
Index: trunk/expressoCalendar/setup/setup.inc.php
===================================================================
--- trunk/expressoCalendar/setup/setup.inc.php	(revision 6255)
+++ trunk/expressoCalendar/setup/setup.inc.php	(revision 6996)
@@ -13,5 +13,5 @@
 	$setup_info['expressoCalendar']['title']     	= 'Expresso Calendar';
 	/* Ao incrementar versão, não esquecer de declarar função do tables_update.inc.php*/
-	$setup_info['expressoCalendar']['version']   	= '1.007';
+	$setup_info['expressoCalendar']['version']   	= '1.008';
 	$setup_info['expressoCalendar']['app_order']	= 10;
 
@@ -33,5 +33,7 @@
 	$setup_info['expressoCalendar']['tables'][]		=  'calendar_permission';
 	$setup_info['expressoCalendar']['tables'][]		=  'module_preference';
-	$setup_info['expressoCalendar']['tables'][]		=  'calendar_repeat_ranges';
+    $setup_info['expressoCalendar']['tables'][]     =  'calendar_repeat_ranges';
+    $setup_info['expressoCalendar']['tables'][]     =  'calendar_task_to_activity_object';
+	$setup_info['expressoCalendar']['tables'][]		=  'calendar_historic';
 
 	$setup_info['expressoCalendar']['enable']		= 1;
