First of all: AWESOME work! :) If you join Gittip, I'll send something your way: https://www.gittip.com/on/twitter/coredumperror/


BEGIN:VEVENT
UID:calendar.1099.field_date@ttkherckenrode.be
DTSTAMP:20130802T181831Z
DESCRIPTION:Seizoen: 2011-2012 Zie http://ttkherckenrode.be/nieuws/2011/okt
 /dag-van-jeugd-zaterdag-29-oktober.
DTSTART;TZID=Europe/Brussels:20111029T090000
DTEND;TZID=Europe/Brussels:20111029T190000
LAST-MODIFIED:20120229T145242Z
SUMMARY:Dag van de Jeugd
URL;TYPE=URI:http://ttkherckenrode.be/evenement/2011-2012/dag-van-jeugd
END:VEVENT
BEGIN:VEVENT
UID:calendar.1099.field_date@ttkherckenrode.be
DTSTAMP:20130802T181820Z
DESCRIPTION:.... Seizoen:\n\n * 2011-2012\n\nZie http://ttkherckenrode.be/n
 ieuws/2011/okt/dag-van-jeugd-zaterdag-29-oktober.
DTSTART;TZID=Europe/Brussels:20111029T090000
DTEND;TZID=Europe/Brussels:20111029T190000
LAST-MODIFIED:20120229T145242Z
SUMMARY:Dag van de Jeugd
URL;TYPE=URI:http://ttkherckenrode.be/evenement/2011-2012/dag-van-jeugd
END:VEVENT

Note how the description is different!

Context: I've upgraded from date_ical 1.1 to 2.9, and am leveraging the new "iCal Fields" row style.
Setup: I'm using the "Content: Rendered node" views field in its iCal view mode as recommended. The "Seizoen" string is a taxonomy field label, the "2011-2012" part is a taxonomy field value. The remainder is a (body) text field.


Possibly related to this: the (body) text field uses Markdown. But it seems filters are not being run. When using the "Body" views field, I can understand how that could happen: date_ical might be doing something wrong. But even after switching to the "Content: Rendered node" views field, this happens. How the hell is that possible? Is date_ical doing something special for the "iCal" view mode perhaps? If that's not the case, then I'm completely puzzled.

Your latest commit seems to be somewhat related: http://drupalcode.org/project/date_ical.git/commitdiff/a0ce67d.

Happy to open a new issue for this if you judge it to be unrelated.

Comments

coredumperror’s picture

Wow, that's really strange. Is the top one the preview, or the bottom one?

Date iCal shouldn't be doing anything different between Preview and actual output, besides adding a few headers. In fact, here's the exact code that adds things to the output, which don't appear in the preview:

    // These steps shouldn't be run when doing a Preview on the View config page.
    if (empty($this->view->live_preview)) {
      // Prevent devel module from appending queries to ical export.
      $GLOBALS['devel_shutdown'] = FALSE;
      
      drupal_add_http_header('Content-Type', 'text/calendar; charset=utf-8');
      
      // For sites with Clean URLs disabled, the "path" value in the view Display
      // doesn't actually get applied to the URL of the calendar feed. So, we
      // need to manually instruct browsers to download a .ics file.
      if (!variable_get('clean_url', FALSE)) {
        $path_array = explode('/', $this->display->display_options['path']);
        $filename = array_pop($path_array);
        drupal_add_http_header('Content-Disposition', "attachment; filename=\"$filename\"");
      }
    }

It's just two headers, and a flag for the devel module.

Is it possible that you're seeing this difference between preview and output due to a caching issue? I'd suggest clearing your cache and trying again.

It may be possible that something from the 1.x version of Date iCal got left behind when you upgraded. Uninstalling and deleting your date_ical folder, and then re-installing could potentially help.

coredumperror’s picture

As for the problem with the body field, please do open another issue.

Wim Leers’s picture

The top one is the one from the preview.
Caches were cleared.
I'm 100% certain no old code is left behind: it's a git checkout that I'm using and it does indicate nothing has been changed.

I'll open another issue for the body field problem.

coredumperror’s picture

Hmmm, is there any chance that you've got a module installed that outputs different text (maybe alternate labels?) depending on which user is logged in? The only thing I can think of that might be causing this discrepancy is that the preview is created using an administrative account (with all the permissions that entails), and the regular output is created by the anonymous user.

Wim Leers’s picture

Nope, this is a very, very simple site. From my .mrconfig file:

#
# Modules.
#

# Essential for Drupal to know versions of modules; no update info otherwise!
[www/sites/all/modules/git_deploy]
project = git_deploy
version = 7.x-2.2

[www/sites/all/modules/calendar]
project = calendar
version = 7.x-3.4

[www/sites/all/modules/comment_notify]
project = comment_notify
version = 7.x-1.2

# Only necessary because it is a dependency of Views.
[www/sites/all/modules/ctools]
project = ctools
version = 7.x-1.3

[www/sites/all/modules/date]
project = date
version = 7.x-2.6

[www/sites/all/modules/date_ical]
project = date_ical
version = 7.x-2.9

[www/sites/all/modules/diff]
project = diff
version = 7.x-3.2

# Only necessary because it is a dependency of date_ical.
[www/sites/all/modules/entity]
project = entity
version = 7.x-1.1

[www/sites/all/modules/field_group]
project = field_group
version = 7.x-1.1

[www/sites/all/modules/globalredirect]
project = globalredirect
version = 7.x-1.5

[www/sites/all/modules/google_analytics]
project = google_analytics
version = 7.x-1.3

[www/sites/all/modules/image_resize_filter]
project = image_resize_filter
version = 7.x-1.13

[www/sites/all/modules/insert]
project = insert
version = 7.x-1.3

[www/sites/all/modules/libraries]
project = libraries
version = 7.x-2.1

[www/sites/all/modules/markdown]
project = markdown
version = 7.x-1.1

[www/sites/all/modules/module_filter]
project = module_filter
version = 7.x-1.7

[www/sites/all/modules/mollom]
project = mollom
version = 7.x-2.7

[www/sites/all/modules/pathauto]
project = pathauto
version = 7.x-1.2

[www/sites/all/modules/pfff]
project = pfff
version = 7.x-1.0-alpha1

[www/sites/all/modules/TabT]
project = TabT
version = 7.x-1.0

[www/sites/all/modules/token]
project = token
version = 7.x-1.5

[www/sites/all/modules/typogrify]
project = typogrify
version = 7.x-1.0-rc6

[www/sites/all/modules/views]
project = views
version = 7.x-3.7

[www/sites/all/modules/webform]
project = webform
version = 7.x-3.19

[www/sites/all/modules/webform_validation]
project = webform_validation
version = 7.x-1.2

[www/sites/all/modules/xmlsitemap]
project = xmlsitemap
version = 7.x-2.0-rc2




#
# Libraries.
#

[www/sites/all/libraries/iCalcreator]
checkout = git clone https://github.com/iCalcreator/iCalcreator.git
# Only keep the PHP file.
fixups = find $MR_REPO/ -maxdepth 1 ! -name iCalcreator.class.php -type f -delete
Wim Leers’s picture

Oh and I'm now sending $0.25/week your way on https://www.gittip.com/coredumperror/, but you should really join the Drupal community! :) ;)

coredumperror’s picture

Wow, thanks! I don't really know anything at all about GitTip, though. How do I join the Drupal community?

coredumperror’s picture

OK, let's dig into some serious debugging here. I think your best bet is to implement a few of the alter hooks that Date iCal offers, and see where the discrepancy is occurring in the rendering process.

First, install the Devel module. Then, add this function to a module on your site:

function MODULENAME_date_ical_post_render_alter(&$rendered_calendar, $view) {
  dd($rendered_calendar);
}

Like all hooks, replace MODULENAME with the name of the module, and then clear your cache to let Drupal pick up the new hook.

That dd() call will output the final rendered text of the calendar to the file /tmp/drupal_debug.txt. So run the preview once, then download the feed normally, and check to see if the two copies of output in that file are different.

If they're the same, then the discrepancy can't be Date iCal's fault, because that hook is run just before it sends the final data to Views. Something else must be messing with the output afterwards. Because of the nature of this discrepancy, though, I find this unlikely. But we need to test it first to rule it out.

If they're different then something earlier in the process is messing things up. In that case, replace the first hook with this function:

function MODULENAME_date_ical_fields_html_alter(&$text_fields, $view, $context) {
  dd($text_fields);
  dd($context);
}

Then clear your cache again, and delete /tmp/drupal_debug.txt to make room for the new output. Then run the Preview and then normal output again, and inspect the file. You should see two arrays printed out for each of the events, once for each each of the two test runs. If the first set of arrays differs from the second, then something in the render process that comes before Date iCal is messing with the output. This seems like the most likely scenario to me.

Now, if the outputs from these debugging steps are still the same for both Preview and normal output, then there's one more hook to try:

function MODULENAME_date_ical_feed_event_render_alter(&$event, $view, $context) {
  dd($event);
  dd($context);
}

Once again, clear your cache and delete /tmp/drupal_debug.txt. Then run both Preview and normal output. This output will look similar to the previous test.

If this test shows a difference, then this is a bug in the way the Date iCal Fields plugin converts text to iCal compliance. Though I have no clue at all how it could be different between Preview and normal output, unless the previous test is also showing different output.

coredumperror’s picture

Did you find/solve the problem? I'm going to be out of town for the next week, so I'd like to close this ticket now, if your issue has been resolved.

Wim Leers’s picture

I very much appreciate #8, but I still need to find the time to actually test it :)

coredumperror’s picture

OK. Then please know that once you do have a chance to test it, I won't be able to respond until at least Wednesday or Thursday of next week.

coredumperror’s picture

Did you ever get a chance to test this?

coredumperror’s picture

Status: Active » Closed (cannot reproduce)

I'm closing this ticket due to several weeks of inactivity. If you're still having an issue, please feel free to re-open it.

coredumperror’s picture