The event content is not showing up (div class content description seems to be empty as shown by firebug).
There should be 2 events in this day view (see screen_shot.png).
I am using Drupal Rel. 6.0 and event 6x-2. and the Garland Theme.
It worked under Drupal 6RC2

CommentFileSizeAuthor
#3 Capture.JPG43.18 KBpobster
screen_shot.png47.46 KBMorn

Comments

cjeanson’s picture

I can confirm this, I just tried to check out my own day view and it doesn't retrieve the proper data.

I did some testing (limited due to my lack of knowledge) but it seems to revolve around the relevant code if statement:

<div class="event dayview vevent <?php print $zebra ?> ">
  <?php if ($show_calendar_link) { ?>
    <div class="type"> <?php print l("($node_type)", $calendar_link, array('attributes' => array('title' => t('limit view to events of this type')))) ?> </div>;
  <?php } ?>

Now, the if statement comes up false, and so it runs the latter of the two. I edited the latter to print out a test statement and sure enough it printed it out.

So, $show_calendar_link (If a link to all the events of this type should be shown) is not being set or is set to false.

So, I took out the if statements and I just ran the code. Guess what comes up? The labels come up, but nothing event-related comes up. Hmmm...

lnknpk04’s picture

I noticed the same problem and found this thread. Definitely an issue.

pobster’s picture

StatusFileSize
new43.18 KB

Did no-one else notice the error messages thrown up in the log? See attached...

(As they appear in the logs - so chronologically they're backwards)

All from Location: http://www.xxxxx.com/event/2008/03/02/feed/all/all/

preg_match() expects parameter 2 to be string, object given in /var/www/drupal/htdocs/includes/bootstrap.inc on line 718.
Object of class stdClass could not be converted to string in /var/www/drupal/htdocs/includes/bootstrap.inc on line 715.
mysqli_real_escape_string() expects parameter 2 to be string, array given in /var/www/drupal/htdocs/includes/database.mysqli.inc on line 323.
date_parse() expects parameter 1 to be string, array given in /var/www/drupal/htdocs/sites/all/modules/event/event.module on line 2793.
date_parse() expects parameter 1 to be string, array given in /var/www/drupal/htdocs/sites/all/modules/event/event.module on line 2793.

Pobster

killes@www.drop.org’s picture

Status: Active » Fixed
cjeanson’s picture

Status: Fixed » Active

Fixed? As of the latest update, it still doesn't display events other than a >

Am I doing something wrong? Still seems broken to me.

killefiz’s picture

I can confirm that it still doesn't show content on the day view.

Example: http://www.ssv-niederkruechten.de/event/2008/03/16/day/

Morn’s picture

Status: Active » Fixed

Seems to be fixed in the march 30 Version (don't forget to run update.php after uploading the new version)

cjeanson’s picture

Does the latest version fix the issue in http://drupal.org/node/220855 without errors?

pobster’s picture

Title: template_preprocess_event_node_* has no effect for any tpl variables » No Content on the day view of events
Priority: Critical » Normal

It's not fixed, in fact it's worse than ever - all my views; month, week and day show unclickable... just showing the stripe lines rather than event titles, I've rolled back to the Feb 11th release, it's the only one which appears to be working (probably because it's pre-tpl files...) In the current release the only thing which does work is the table view and that's probably because it references $node in the function callback rather than $variable (which the rest expect) - $variable is always NULL as far as I can tell.

And BTW, there is nothing to update in update.php - in fact it's pretty clear in http://drupal.org/project/cvs/3238 that no update has been made to the .install file in ages (two months).

Pobster

pobster’s picture

Okay on closer inspection it seems that hook_template_preprocess is NOT called for any of the tpl files resulting in blank entries. This is why some views work and some don't as not all the views actually use this hook, only day, week and month according to the event.theme file. There doesn't appear to be any hook_theme_registry_alter call to register the preprocess callbacks? I'm not sure if this is necessary but advanced_forum uses it and that works fine?

edit: okay so it IS called... As Drupal recognizes a duplicate function if you make one - but for some reason it's not calling/ registering it?

Pobster

pobster’s picture

Title: No Content on the day view of events » template_preprocess_event_node_* has no effect for any tpl variables
Priority: Normal » Critical
Status: Fixed » Active

Okay I've narrowed the bug down to the template_preprocess_event_node_day/week/month functions. NONE of the variables are having any effect, hence they're NULL in the tpl files. I did notice that a couple of variables look to $node for values, when $node isn't defined at all - but that shouldn't cause ALL the variables to be empty?

Pobster

pobster’s picture

Title: No Content on the day view of events » template_preprocess_event_node_* has no effect for any tpl variables
Priority: Normal » Critical
Status: Active » Needs review

Okay... The problem *is* how Drupal registers the template_preprocess hooks and is probably to do with them being in an include file which isn't always included.

SOLUTION: Cut and paste ALL the hook_template_preprocess_event_node_* callbacks from event.theme to event.module and everything works fine. Well... Nearly everything... For the functions which look for a $node variable which doesn't exist (edit: all of them...) add this line to the top of the function;

$node = $variables['node'];

I *know* this isn't a patch, but setting the status differently shows at least there is a solution for people having the same issue (which will be everyone who uses this module)... Note that if you return everything back to where it was and clear the cache/ enable a module/ anything which forces Drupal into re-evaluating its hooks then the problem *will* reappear, for now I'd suggest leaving all those functions in the .module file.

Pobster
edit: IMPORTANT!!! Don't forget to clear your cache after you've made the change else Drupal will look to the old cache for its information rather than build you a new and working events calendar.

JohnT’s picture

The fix in #12 worked at my site - thanks!

I have a separate thread going on this topic, I'll go post a link to this discussion over there.

Clemens’s picture

Thank you pobster... I am having some difficulties interpreting your instructions. It would be great if you could be somewhat more specific for the non-coders out there.

JohnT’s picture

Paste these three functions into event.module, and remove them from event.theme:

/**
 * Format an event node for display in an expanded calendar, like a calendar page
 *
 * @param node
 *   The node being displayed
 */
function template_preprocess_event_node_day(&$variables) {
  $node = $variables['node'];
  static $zebra;
  $variables['zebra'] = $zebra++%2? ' odd' : '';
  $variables['links'] = theme('links', $variables['node']->event['links']);
  $variables['teaser'] = check_markup($variables['node']->teaser);
  $variables['node_type'] = check_plain($variables['node']->type);
  $variables['show_calendar_link'] = (variable_get('event_type_control', 'all') != 'never') && ((count(event_get_types('all')) + count(event_get_types('solo'))) > 1);
  $variables['calendar_link'] = 'event/'. _event_format_url($variables['node']->event['start_exploded']) .'/day/'. check_plain($variables['node']->type);
  $variables['node_title_unsafe'] = $variables['node']->title;
  $variables['node_title_safe'] = check_plain($variables['node']->title);
  $variables['node_link'] = 'node/'. $variables['node']->nid;
  $variables['show_details'] = ($node->event['state'] != 'allday' && $node->event['state'] != 'ongoing');
  $variables['show_end'] = $node->event['start'] != $node->event['end'];
  $variables['ongoing'] = ($node->event['state'] == 'ongoing' || $node->event['state'] == 'allday');
  $variables['start_date'] = $variables['node']->event['start'];
  $variables['end_date'] = $variables['node']->event['end'];
  $variables['start_date_formatted'] = $variables['node']->event['start_format'];
  $variables['end_date_formatted'] = $variables['node']->event['end_format'];
}

/**
 * Format an event node for display in an expanded calendar, like a calendar page
 *
 * @param node
 *   The node being displayed
 */
function template_preprocess_event_node_week(&$variables) {
  $node = $variables['node'];
  static $stripe, $stripe_map;

  if (empty($stripe_map[$node->nid])) {
    if ($stripe >= 10) {
      $stripe = 1;
    }
    else {
      $stripe++;
    }
    $stripe_map[$node->nid] = $stripe;
  }
  $variables['stripe'] = $stripe_map[$node->nid];
  $variables['links'] = theme('links', $variables['node']->event['links']);
  $variables['teaser'] = check_markup($variables['node']->teaser);
  $variables['node_type'] = check_plain($variables['node']->type);
  $variables['state'] = check_plain($variables['node']->event['state']);
  $variables['show_calendar_link'] = (variable_get('event_type_control', 'all') != 'never') && ((count(event_get_types('all')) + count(event_get_types('solo'))) > 1);
  $variables['calendar_link'] = 'event/'. _event_format_url($variables['node']->event['start_exploded']) .'/week/'. check_plain($variables['node']->type);
  $variables['node_title_unsafe'] = $variables['node']->title;
  $variables['node_title_safe'] = check_plain($variables['node']->title);
  $variables['node_link'] = 'node/'. $variables['node']->nid;
  $variables['show_details'] = ($node->event['state'] != 'allday' && $node->event['state'] != 'ongoing');
  $variables['show_end'] = $node->event['start'] != $node->event['end'];
  $variables['ongoing'] = ($node->event['state'] == 'ongoing' || $node->event['state'] == 'allday');
  $variables['start_date'] = $variables['node']->event['start'];
  $variables['end_date'] = $variables['node']->event['end'];
  $variables['start_date_formatted'] = $variables['node']->event['start_format'];
  $variables['end_date_formatted'] = $variables['node']->event['end_format'];
}

/**
 * Format an event node for display in an expanded calendar, like a calendar page
 *
 * @param node
 *   The node being displayed
 */
function template_preprocess_event_node_month(&$variables) {
  $node = $variables['node'];
  static $stripe, $stripe_map;

  if (empty($stripe_map[$node->nid])) {
    if ($stripe >= 10) {
      $stripe = 1;
    }
    else {
      $stripe++;
    }
    $stripe_map[$node->nid] = $stripe;
  }

  $variables['stripe'] = $stripe_map[$node->nid];
  $variables['links'] = theme('links', $variables['node']->event['links']);
  $variables['teaser'] = check_markup($variables['node']->teaser);
  $variables['node_type'] = check_plain($variables['node']->type);
  $variables['state'] = check_plain($variables['node']->event['state']);
  $variables['show_calendar_link'] = (variable_get('event_type_control', 'all') != 'never') && ((count(event_get_types('all')) + count(event_get_types('solo'))) > 1);
  $variables['calendar_link'] = 'event/'. _event_format_url($variables['node']->event['start_exploded']) .'/month/'. check_plain($variables['node']->type);
  $variables['node_title_unsafe'] = $variables['node']->title;
  $variables['node_title_safe'] = check_plain($variables['node']->title);
  $variables['node_link'] = 'node/'. $variables['node']->nid;
  $variables['show_details'] = ($node->event['state'] != 'allday' && $node->event['state'] != 'ongoing');
  $variables['show_end'] = $node->event['start'] != $node->event['end'];
  $variables['start_date'] = $variables['node']->event['start'];
  $variables['end_date'] = $variables['node']->event['end'];
  $variables['start_date_formatted'] = $variables['node']->event['start_format'];
  $variables['end_date_formatted'] = $variables['node']->event['end_format'];
}

Note - I've already made the change mentioned in pobster's post ($node = $variables['node'];)

Upload both of those modules, and delete the rows from your cache table in the database - that should fix it!

Clemens’s picture

Perfect JohnT... You must have been sitting there waiting for me. Talk about excellent service. Thank you. Worked perfectly.

JohnT’s picture

No problem - and just a coincidence on the timeing, I had this site open in a tab that I was going to close, just thought I should take a look at it first, so you got lucky! Time to go buy a lottery ticket? And oh, yeah - I never did close the window...

One more note - this isn't an approved patch, they're likely to issue a real fix sometime soon, so keep an eye on your available updates.

Morn’s picture

Until yesterday I didn't need the patch, everything looked ok.

Today it happened (although there was nothing added/changed):
an "include file which isn't always included" wasn't include.

So I patched as in #15, cleared the DB Cache, and.... IT Works!!.
Thx to pobster and JohnT.

gerhard killesreiter’s picture

Component: Event Views » Code
Status: Needs review » Active

No patch here. I believe I fixed it anyway with today's commits. You'll need to clear your cache for it to be effective.

pobster’s picture

Again with the "there isn't a status for 'change these few lines' to make it work", it's pointless rolling any patches with dev versions such as this as my module code differs from the original hugely - I'm not messing around with patch files for the sake of being able to use a status message... Having instructions on what to patch is warrant enough for changing the status in my opinion...

...but anyways rant over, that isn't really a discussion for this thread! And cheers for fixing it! ;o)

edit: I've just noticed that you're still trying to reference the $node variable when you've not defined it anywhere in the template_preprocess hooks. Obviously all that's needed is only a simple;

$node = $variable['node'];

Pobster

pobster’s picture

...and nope todays release doesn't fix this issue. Mind you, I can't see where you thought you'd fixed it from the revision logs anyway? The issue is the placement of the template_preprocess_hooks when the cache is rebuilt, meaning the event.theme file isn't always included and so neither are the hooks... Wouldn't it be better to just simply put these hooks into the module file to be *sure* that they're always called...?

Pobster

gerhard killesreiter’s picture

Ah, I got the problem now, I'll see how others handle this

ggroger’s picture

Can you upload these files patched???

Thanks!!

gerhard killesreiter’s picture

Status: Active » Fixed

this is now fixed.

dorgeo1’s picture

It does seem to work for me. The month view shows the teasers or full body which makes for a large calendar. Any way to make the month view like the week view showing only the title, date, and time?

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.