Download & Extend

jcalendar popup is empty when clicking on an event

Project:Calendar
Version:6.x-2.x-dev
Component:jCalendar popup
Category:bug report
Priority:major
Assigned:Unassigned
Status:reviewed & tested by the community
Issue tags:Commit

Issue Summary

Displaying a month-view calendar, I click on an event and the popup from jcalendar displays but is empty.

The issue appears to be here:

// Get NodeID and ItemID
      var ids = $(this).parent().parent().attr('class');

In my out-of-the-box calendar view, the node and item ids are in the id attribute and not the class.

<div class="calendar monthview" id="calendar.2688.field_event_date.13.13">

Solution: Modified jcalendar.js to use the id attribute instead of the class.

Patch attached (mostly because I wanted to learn how to make a patch...)

AttachmentSize
jcalendar.patch434 bytes

Comments

#1

I don't understand why one site on a multisite install, using the same copy of the module, would have the string with the nid and ids in the class and another site has it in the id. Further modified the jcalendar.js (starting at line 48) to check for either a class or id.

      // Get NodeID and ItemID
      var classStr = $(this).parent().parent().attr('class');
      var ids = (classStr.indexOf('.') != -1) ? classStr :  $(this).parent().parent().attr('id');
      var arrs = ids.split(" ");
      var arr = arrs[0].split(".");
      var nid = arr[1];
      var id = arr[4];

#2

Status:needs review» reviewed & tested by the community

Confirmed: I also have this problem, and the supplied patch (either version, on my site) fixes it. Thanks very much mgriffith, for supplying the fix.

#3

Version:6.x-2.4» 6.x-2.x-dev

I can also confirm, manually changing line 48 in current dev version:

old: var ids = $(this).parent().parent().attr('class');
new: var ids = $(this).parent().parent().attr('id');

This works perfectly.

#4

I would like to confirm that this works, as well... Can this get a commit?

#5

The JS in the patch (and the module, initially) is brittle and depends on a certain markup structure. I'm attaching a patch that searches the DOM tree a bit more thoroughly, so that extra divs will not break it.

AttachmentSize
wrong_parent_id-1113666-5.patch 1.49 KB

#6

Status:reviewed & tested by the community» needs review

Could someone review #5?

#7

I applied the patch in #5 against Calendar 6.x-2.4, which applied cleanly and resolved the problem.

Thanks for the patch!

#8

Priority:normal» major
Status:needs review» reviewed & tested by the community

didn't apply clean to 2.x dev version for me

attached is re-rolled version that's drush make friendly :)

AttachmentSize
calendar-1113666-jcalendarpopup-1.patch 1.18 KB
nobody click here