Using the date module version 5.x-1.2 with a "from" and "to" date which spans 10 days. On the monthly and weekly calendar, the first day displays properly. However the second day has the field name listed twice. The third day, three times. Fourth day 4 times. Etc. So the fourth day reads like this, "Here is the great title to the node (date field name:) (date field name:) (date field name:) (date field name:) All Day"

The day view is also strange. It lists the single node twice for each day (except the last day). It lists it once for the day you are viewing and then once for the following day. The second listing for the following day has the field name listed twice. Like this:

Day being viewed: Tuesday, February 6 2007

02 / 6
Here is the great title to the node (date field name:)
Start: 02/01/2007 - 1:00am
End: 02/10/2007 - 10:00am

02 / 7
Here is the great title to the node (date field name:) (date field name:)
Start: 02/01/2007 - 1:00am
End: 02/10/2007 - 10:00am

Comments

KarenS’s picture

This is very odd. Can you export your view and paste it here. Thanks!

bradwade’s picture

Hi Karen - Here is the export.

  $view = new stdClass();
  $view->name = 'calendar';
  $view->description = 'Calendar view of any date field';
  $view->access = array (
);
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = 'Calendar';
  $view->page_header = '';
  $view->page_header_format = '1';
  $view->page_footer = '';
  $view->page_footer_format = '1';
  $view->page_empty = '';
  $view->page_empty_format = '1';
  $view->page_type = 'calendar';
  $view->url = 'calendar';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '99';
  $view->block = TRUE;
  $view->block_title = '';
  $view->block_header = '';
  $view->block_header_format = '1';
  $view->block_footer = '';
  $view->block_footer_format = '1';
  $view->block_empty = '';
  $view->block_empty_format = '1';
  $view->block_type = 'calendar';
  $view->nodes_per_block = '99';
  $view->block_more = TRUE;
  $view->block_use_page_header = FALSE;
  $view->block_use_page_footer = FALSE;
  $view->block_use_page_empty = FALSE;
  $view->sort = array (
    array (
      'tablename' => 'node_data_field_event_date',
      'field' => 'field_event_date_value',
      'sortorder' => 'ASC',
      'options' => '',
    ),
  );
  $view->argument = array (
    array (
      'type' => 'calendar_year',
      'argdefault' => '2',
      'title' => 'Year',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
    array (
      'type' => 'calendar_month',
      'argdefault' => '2',
      'title' => 'Month',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
    array (
      'type' => 'calendar_day',
      'argdefault' => '2',
      'title' => 'Day',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
  );
  $view->field = array (
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => 'Title:',
      'handler' => 'views_handler_field_nodelink',
      'options' => 'link',
    ),
    array (
      'tablename' => 'node_data_field_event_date',
      'field' => 'field_event_date_value',
      'label' => 'Event Date:',
      'handler' => 'content_views_field_handler_ungroup',
      'options' => 'short',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
  );
  $view->exposed_filter = array (
  );
  $view->requires = array(node_data_field_event_date, node);
  $views[$view->name] = $view;

Thanks for looking into this,
Brad

KarenS’s picture

Thanks. I need one more thing. Tell me what node_data_field_event_date looks like? If you're using 5.x you can install the content_copy module and export the content type that field is in and paste it here so I can see the details.

bradwade’s picture

Unfortunately I made some changes so the system wouldn't use any features that seemed to be causing the problems (no from and to dates for example). Here is the export how things are now. I will also try to change the settings back, recreate the problem and paste those settings. For now:

$content[type]  = array (
  'name' => 'News or event',
  'type' => 'news',
  'description' => 'Custom created content type for adding ACC news and calendar events to the website.',
  'title_label' => 'Title',
  'body_label' => 'Body',
  'min_word_count' => '0',
  'help' => '',
  'node_options' => 
  array (
    'status' => true,
    'promote' => true,
    'sticky' => false,
    'revision' => false,
  ),
  'comment' => '2',
  'upload' => '1',
  'image_attach' => '1',
  'old_type' => 'news',
  'orig_type' => '',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
);
$content[fields]  = array (
  0 => 
  array (
    'widget_type' => 'date_select',
    'label' => 'Event Date',
    'weight' => '0',
    'select_day' => '1',
    'select_month' => '1',
    'select_year' => '1',
    'years_back' => '3',
    'years_forward' => '3',
    'increment' => '1',
    'description' => '',
    'group' => false,
    'required' => '0',
    'multiple' => '0',
    'granularity' => 
    array (
      'Y' => 'Y',
      'M' => 'M',
      'D' => 'D',
    ),
    'todate' => '',
    'input_format' => 'site-wide',
    'input_format_custom' => '',
    'output_format_date' => 'm/d/Y',
    'output_format_zone' => '',
    'output_format_custom' => '',
    'output_format_date_long' => 'l, F j, Y - g:ia',
    'output_format_zone_long' => '',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'D, m/d/Y - g:ia',
    'output_format_zone_medium' => '',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'm/d/Y',
    'output_format_zone_short' => '',
    'output_format_custom_short' => '',
    'tz_handling' => 'site',
    'field_timezone' => 'EST',
    'field_name' => 'field_event_date',
    'field_type' => 'date',
    'module' => 'date',
  ),
);

bradwade’s picture

Here is the export with the settings that cause the problem. I changed the settings back, reentered a calendar item that spans multiple days and observed the same behavior.

$content[type]  = array (
  'name' => 'News or event',
  'type' => 'news',
  'description' => 'Custom created content type for adding ACC news and calendar events to the website.',
  'title_label' => 'Title',
  'body_label' => 'Body',
  'min_word_count' => '0',
  'help' => '',
  'node_options' => 
  array (
    'status' => true,
    'promote' => true,
    'sticky' => false,
    'revision' => false,
  ),
  'comment' => '2',
  'upload' => '1',
  'image_attach' => '1',
  'old_type' => 'news',
  'orig_type' => '',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
);
$content[fields]  = array (
  0 => 
  array (
    'widget_type' => 'date_js',
    'label' => 'Event Date',
    'weight' => '0',
    'description' => '',
    'group' => false,
    'required' => '0',
    'multiple' => '0',
    'granularity' => 
    array (
      'Y' => 'Y',
      'M' => 'M',
      'D' => 'D',
      'H' => 'H',
      'N' => 'N',
      'S' => 'S',
    ),
    'todate' => 'optional',
    'input_format' => 'Y-m-d H:i:s',
    'input_format_custom' => '',
    'output_format_date' => 'm/d/Y - g:ia',
    'output_format_zone' => '',
    'output_format_custom' => '',
    'output_format_date_long' => 'l, F j, Y - g:ia',
    'output_format_zone_long' => '',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'D, m/d/Y - g:ia',
    'output_format_zone_medium' => '',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'm/d/Y',
    'output_format_zone_short' => '',
    'output_format_custom_short' => '',
    'tz_handling' => 'site',
    'field_timezone' => 'EST',
    'field_name' => 'field_event_date',
    'field_type' => 'date',
    'module' => 'date',
  ),
);

ashtonium’s picture

confirming this bug in both of the v1.2 releases (4.7.x & 5.x)

Also, when other fields are added to the view, the field values are replicated in the same manner as the date field labels. So if I add on the "Node: Author Name" and "Node: ID" fields I get the following on the event's third day in the "month" view:

17
Key 1
Test Event 02 (Event Date Label) (Event Date Label) (Event Date Label)
all day
ashtonkd
1614
ashtonkd
1614
ashtonkd
1614

It appears to replicate based on the number of times the same item is displayed in the view. For instance, looking at the same day in the "day" view I get:

02 / 17
Key 1
Test Event 02 (Event Date Label)
Start: 02/15/2007 - 4:20pm
End: 02/18/2007 - 4:00pm
ashtonkd
1614

02 / 18
Key 1
Test Event 02 (Event Date Label) (Event Date Label)
Start: 02/15/2007 - 4:20pm
End: 02/18/2007 - 4:00pm
ashtonkd
1614
ashtonkd
1614
KarenS’s picture

OK, I can replicate this now. Working on a fix...

KarenS’s picture

Status: Active » Fixed

Found the problem and committed fix to all branches.

Tomette’s picture

Seems not to be fixed!
Using Calendar HEAD (or also 5.x-1.x-dev) from today (20 feb 07), Date 5.x-1.x-dev with CCK 1.3, and view 1.5, with the following type and view...

$content[type]  = array (
  'name' => 'Conférence ou Ecole',
  'type' => 'conference',
  'description' => 'Ajoute une fiche pour une conférence ou une école.',
  'title_label' => 'Titre',
  'body_label' => '',
  'min_word_count' => '0',
  'help' => '',
  'node_options' => 
  array (
    'status' => true,
    'promote' => false,
    'sticky' => false,
    'revision' => false,
  ),
  'nodefamily_max' => 0,
  'nodeprofile' => 0,
  'upload' => '1',
  'old_type' => 'conference',
  'orig_type' => '',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
  'ant' => 0,
  'ant_pattern' => '',
  'ant_php' => 0,
  'taxonomy_context_inline' => '0',
  'taxonomy_context_breadcrumb' => '0',
);
$content[fields]  = array (
  0 => 
  array (
    'widget_type' => 'date_select',
    'label' => 'Début et fin de l\'école ou de la conférence',
    'weight' => '0',
    'select_day' => '1',
    'select_month' => '1',
    'select_year' => '1',
    'years_back' => '3',
    'years_forward' => '4',
    'increment' => '30',
    'description' => '',
    'group' => false,
    'required' => '0',
    'multiple' => '0',
    'granularity' => 
    array (
      'Y' => 'Y',
      'M' => 'M',
      'D' => 'D',
      'H' => 'H',
      'N' => 'N',
    ),
    'todate' => 'required',
    'input_format' => 'site-wide',
    'input_format_custom' => '',
    'output_format_date' => 'd/m/Y - H:i',
    'output_format_zone' => '',
    'output_format_custom' => 'l j F Y',
    'output_format_date_long' => 'l, j F, Y - H:i',
    'output_format_zone_long' => '',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'D, d/m/Y - H:i',
    'output_format_zone_medium' => '',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'd/m/Y - H:i',
    'output_format_zone_short' => '',
    'output_format_custom_short' => '',
    'tz_handling' => 'none',
    'field_timezone' => 'Europe/Paris',
    'field_name' => 'field_debut_et_fin_conf',
    'field_type' => 'date',
    'module' => 'date',
  ),
  1 => 
  array (
    'widget_type' => 'text',
    'label' => 'Lieu',
    'weight' => '0',
    'rows' => '1',
    'description' => '',
    'field_lieu' => 
    array (
      0 => 
      array (
        'value' => '',
      ),
    ),
    'default_value_php' => '',
    'group' => false,
    'required' => '0',
    'multiple' => '0',
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'field_name' => 'field_lieu',
    'field_type' => 'text',
    'module' => 'text',
  ),
  2 => 
  array (
    'widget_type' => 'link',
    'label' => 'Homepage',
    'weight' => '2',
    'description' => '',
    'field_homepage' => 
    array (
      0 => 
      array (
        'url' => 'www.cpt.univ-mrs.fr/',
      ),
    ),
    'default_value_php' => '',
    'group' => false,
    'required' => '0',
    'multiple' => '0',
    'title' => 'none',
    'attributes' => 
    array (
      'target' => '_blank',
      'rel' => 0,
    ),
    'field_name' => 'field_homepage',
    'field_type' => 'link',
    'module' => 'link',
  ),
  3 => 
  array (
    'widget_type' => 'text',
    'label' => 'Résumé',
    'weight' => '4',
    'rows' => '15',
    'description' => '',
    'field_resume' => 
    array (
      0 => 
      array (
        'value' => '',
        'format' => '4',
      ),
    ),
    'default_value_php' => '',
    'group' => false,
    'required' => '0',
    'multiple' => '0',
    'text_processing' => '1',
    'max_length' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'field_name' => 'field_resume',
    'field_type' => 'text',
    'module' => 'text',
  ),
);

And the view (field_date_et_heure belongs to another type of content):

  $view = new stdClass();
  $view->name = 'calendar';
  $view->description = 'Calendar view of any date field';
  $view->access = array (
);
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = 'Calendar';
  $view->page_header = '';
  $view->page_header_format = '1';
  $view->page_footer = '';
  $view->page_footer_format = '1';
  $view->page_empty = '';
  $view->page_empty_format = '1';
  $view->page_type = 'calendar';
  $view->url = 'cal_sem';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '99';
  $view->block = TRUE;
  $view->block_title = 'Calendrier';
  $view->block_header = '';
  $view->block_header_format = '1';
  $view->block_footer = '';
  $view->block_footer_format = '1';
  $view->block_empty = '';
  $view->block_empty_format = '1';
  $view->block_type = 'calendar';
  $view->nodes_per_block = '99';
  $view->block_more = TRUE;
  $view->block_use_page_header = FALSE;
  $view->block_use_page_footer = FALSE;
  $view->block_use_page_empty = FALSE;
  $view->sort = array (
  );
  $view->argument = array (
    array (
      'type' => 'calendar_year',
      'argdefault' => '2',
      'title' => 'Année',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
    array (
      'type' => 'calendar_month',
      'argdefault' => '2',
      'title' => 'Mois',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
    array (
      'type' => 'calendar_day',
      'argdefault' => '2',
      'title' => 'Jour',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
    array (
      'type' => 'content: field_date_et_heure',
      'argdefault' => '2',
      'title' => '',
      'options' => 'day',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
    array (
      'type' => 'content: field_debut_et_fin_conf',
      'argdefault' => '2',
      'title' => '',
      'options' => 'day',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
  );
  $view->field = array (
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => '',
      'handler' => 'views_handler_field_nodelink',
      'options' => 'link',
    ),
    array (
      'tablename' => 'term_data',
      'field' => 'name',
      'label' => '',
      'handler' => 'views_handler_field_tid_link',
    ),
    array (
      'tablename' => 'node_data_field_lieu',
      'field' => 'field_lieu_value',
      'label' => '',
      'handler' => 'content_views_field_handler_group',
      'options' => 'default',
    ),
    array (
      'tablename' => 'node_data_field_date_et_heure',
      'field' => 'field_date_et_heure_value',
      'label' => '',
      'handler' => 'content_views_field_handler_ungroup',
      'options' => 'default',
    ),
    array (
      'tablename' => 'node_data_field_debut_et_fin_conf',
      'field' => 'field_debut_et_fin_conf_value',
      'label' => '',
      'handler' => 'content_views_field_handler_ungroup',
      'options' => 'default',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'conference',
  1 => 'seminaire',
),
    ),
  );
  $view->exposed_filter = array (
  );
  $view->requires = array(node, term_data, node_data_field_lieu, node_data_field_date_et_heure, node_data_field_debut_et_fin_conf);
  $views[$view->name] = $view;

There is also a problem of displaying such a type in week view (does not appear if week is set to start on monday), but this is a another issue...

Anonymous’s picture

Status: Fixed » Closed (fixed)
jimdunntx’s picture

Version: 7.x-1.x-dev » 5.x-1.4
Assigned: Unassigned » jimdunntx
Status: Closed (fixed) » Active

I am having the same problem. with a slight difference. I am using the javascript pop-up for selection of a from and to date, with the to date optional.

On my day view, the first day of the event does not show up. On the last day of the event, it shows up properly in the day view, but each of the days in between has the event listed twice (but no more than twice), for the prior and current day). In the month and week views, the events seem to show up ok, except I have noticed that when I switch between the the month and week view several times, all the events disappear.

jimdunntx’s picture

Component: Code » Documentation

I am having a similar problem. Using the Javacode module to pick a from and to date, with the to date optional, any event that I enter for one day does not show up at all on that day. If I enter a multiple-day event, it does not show up at all on the first day, it does show up properly on the last day, but the days in between have multiple copies of the event listed in day view (but only two each so far, with the current and next day's date).

Though at first everything shows up fine on the month and week views, if I switch back and forth between these two views several times, everything disappears.

ashtonium’s picture

Component: Documentation » Code

jimdunntx: please be careful in setting the project and issue information. This is a code issue not a documentation issue, and you also seem to have inadvertently assigned the project to yourself.

The issue does not appear to be fully resolved in 5.x-1.4 (also using the 5.x-1.4 release of the date module and no jscalendar) - the day view is still showing both the current day and the following day for the event, but the rest of it appears to be functioning properly for me as well.

To fix the issue for now, you can download the latest development snapshots for both the calendar module and the date module. You may also need to upgrade to the latest official releases of cck and views if you haven't already.

Also, be aware that the week view has been hidden in the development version of calendar as there are apparently some other issues with it.

ashtonium’s picture

Version: 5.x-1.4 » 5.x-1.x-dev

argh, scratch that, I just noticed a posting on the forums from someone else experiencing this issue (http://drupal.org/node/137704) that reminded me to test out additional fields. I'm testing this using the latest development snapshots of both calendar and date modules.

The bug as originally reported appears to be fixed (event date field labels no longer display multiple times), however, the additional fields are still being replicated for the number of times the item has been displayed in the view. For example, If I add on the "Node: Author Name" and "Node: ID" fields I get the following on the event's third day in the "month" view:

Second Test Event (Event Date Label)
all day
webguy
3
webguy
3
webguy
3
mfredrickson’s picture

Status: Active » Needs review

The problem is in calendar.theme,. the theme_calendar_calendar_node function().

Basically, a node get's passed in to the function once for each time it is displayed on the calendar. In the case of multi-day events, it gets passed in multiple times. In PHP5, objects are passed by reference, whether you like it or not. Usually that's not a problem. In this case, it is.

The $node->teaser gets appended to in each successive call to this function, therefore the teaser grows and grows. The solution is to reset the title and teaser to an empty string each time.

Here's a fixed version of the function. I'm lazy and I'm not going to bother rolling a patch. But you get the idea.


function theme_calendar_calendar_node($node, $type) {
   // Display the regular teaser view for local events.
   if (!$node->remote && $type == 'calendar_node_day') {
     $node = node_load($node->nid);
     $node->teaser = node_view($node, TRUE, FALSE);
     $node->title = '';
   }
   // For other views, construct a teaser out of the provided fields.
   else {
     // reset the title and teaser
     $node->title = '';
     $node->teaser = '';
     
     if ($node->label && !strstr($node->title, $node->label)) {
       $node->title .= ' ('. $node->label .')';
     }
     if ($node->fields) {
       foreach ($node->fields as $field) {
         $node->teaser .= '<div>'. $field .'</div>';
       }
     }
     if (!$node->url && !$node->remote) {
       $node->url = "node/$node->nid";
     }
   }
   // Remote nodes may come in with lengthy descriptions that won't fit
   // in small boxes of year, month, and week calendars.
   if ($type != 'calendar_node_day' && $node->remote) {
     $node->teaser = '';
   }
   return theme($type, $node);
}

Cheers,
-M

KarenS’s picture

Status: Needs review » Fixed

I'm committing something that I hope will work. Thanks to mark fredrickson for the key to the solution, but it needs a different solution than he proposes because unsetting the title and teaser creates other problems (for instance in ical feeds).

So instead I'm going to change the theme function to this:

/**
 *  Themeable node display
 *
 *  Constructs a teaser out of any non-date fields in the view
 */
function theme_calendar_calendar_node($node, $type) {
  static $set_nodes;

  // Make sure the same node does not get its content altered more than
  // once if it has multiple instances in the calendar.
  if (in_array($node->nid, $set_nodes)) {
    return theme($type, $node);
  }

  // Display the regular teaser view for local events.
  if (!$node->remote && $type == 'calendar_node_day') {
    $node = node_load($node->nid);
    $node->teaser = node_view($node, TRUE, FALSE);
    $node->title = '';
  }
  // For other views, construct a teaser out of the provided fields.
  else {
    if (isset($node->fields) && !isset($node->teaser)) {
      foreach ($node->fields as $field) {
     	 // Locally-created nodes already have output themed, so it was run through check_markup, etc.
       // Remote nodes need some cleanup.
        if ($node->remote) {
          $field = str_replace('\n', "\n", $field);
          // Remove escaping added by ical.
          $field = stripslashes($field);
          // Run through check_markup.
          $field = check_markup($field);
        }
        $node->teaser .= '<div>'. $field .'</div>';
      }
    }
    if (!$node->url && !$node->remote) {
      $node->url = "node/$node->nid";
    }
  }
  // Remote nodes may come in with lengthy descriptions that won't fit
  // in small boxes of year, month, and week calendars.
  if ($type != 'calendar_node_day' && $node->remote) {
    $node->teaser = '';
  }
  $set_nodes[] = $node->nid;
  return theme($type, $node);
}

The idea is to keep from reconstructing the title and teaser after the first time through. This needs testing to be sure it works in all cases, but I think it will.

Reopen if it does not fix the problem.

Anonymous’s picture

Status: Fixed » Closed (fixed)