Index: contributions/modules/gcal_events/gcal_events.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/gcal_events/gcal_events.module,v
retrieving revision 1.26
diff -u -p -r1.26 gcal_events.module
--- contributions/modules/gcal_events/gcal_events.module	20 Feb 2009 17:33:11 -0000	1.26
+++ contributions/modules/gcal_events/gcal_events.module	3 Mar 2009 20:04:09 -0000
@@ -435,6 +435,14 @@ private calendars will not work.'),
         '#description' => t('Use #DATE# to insert the date.'),
         '#default_value' => variable_get('gcal_events_template_date_'. $delta, GCAL_EVENTS_DEFAULT_TEMPLATE_DATE)
         );
+        
+      $form['template']['gcal_events_template_endtime'] = array(
+        '#type' => 'textfield',
+        '#title' => 'Endtime Template (#ENDTIME#)',
+        '#description' => t('Use #ENDTIME# to insert the date.'),
+        '#default_value' => variable_get('gcal_events_template_endtime_'. $delta, GCAL_EVENTS_DEFAULT_TEMPLATE_ENDTIME)
+        );
+        
       $form['template']['gcal_events_template_time'] = array(
         '#type' => 'textfield',
         '#title' => 'Time Template (#TIME#)',
@@ -512,7 +520,7 @@ private calendars will not work.'),
       variable_set('gcal_events_template_time_'. $delta, $edit['gcal_events_template_time']);
       variable_set('gcal_events_template_date_'. $delta, $edit['gcal_events_template_date']);
       variable_set('gcal_events_template_loc_'. $delta, $edit['gcal_events_template_loc']);
-
+      variable_set('gcal_events_template_endtime_'. $delta, $edit['gcal_events_template_endtime']);
       variable_set('gcal_events_timeformat_'. $delta, check_plain($edit['gcal_events_timeformat']));
       variable_set('gcal_events_dateformat_'. $delta, check_plain($edit['gcal_events_dateformat']));
 
@@ -744,11 +752,21 @@ function gcal_events_get_events($which_b
 
       if (!$allday) {
         $gcal_time = date($timeformat, $unixdate);
-	$gcal_endtime = date($timeformat, SimplePie_Misc::parse_date($enddate));
+	      $gcal_endtime = date($timeformat, SimplePie_Misc::parse_date($enddate));
       }
       else
       {
         $gcal_time="all day";
+        
+        // if the event spans multiple days then make $gcal_endtime the ending date
+        
+        $gcal_endtime = date($dateformat, SimplePie_Misc::parse_date($enddate));
+        
+        // don't display if it is only one day
+        if ($gcal_endtime == date($dateformat, $unixdate)) {
+          $gcal_endtime = "";
+        }
+        
         // $gcal_time=""; // to have no output for all-day events
         //$item['title'] = $item['title'] . " (all day)"; // to tag the title with "(all-day)"
       }
@@ -839,7 +857,7 @@ function template_events($events, $which
     }
 
     if ($item['endtime']) {
-      $temp_event=str_replace("#ENDTIME#", $item['endtime'], str_replace("#ENDTIME#", GCAL_EVENTS_DEFAULT_TEMPLATE_ENDTIME, $temp_event));
+      $temp_event = str_replace("#ENDTIME#", $item['endtime'], str_replace("#ENDTIME#", variable_get('gcal_events_template_endtime_' . $which_block, GCAL_EVENTS_DEFAULT_TEMPLATE_ENDTIME), $temp_event));
     }
     else {
       $temp_event=str_replace("#ENDTIME#", "", $temp_event);
