Hi Karen, I'm working with Ted and Scott on mothersclick.com and was in charge of most of our upgrade of Calendar module to the 2.x version. I must say it was very easy and seamless, so thank you ever so much!

One adjustment that I made and just wanted to mention, was to the jcalendar.js where the positioning is set to use a.pageX and a.pageY. This makes the popup appear relative to the link, which is fine, however with the X _and_ Y coordinate being so variable, it appears very random to a user as to where the box is going to pop up. Having just one of these set to a more standard position, I think, is a bit more user friendly. Therefor I used window.innerWidth for x and divided that by three to get a more standard x coordinate, which really seems to do the trick.

Attached is the changes in a patch for your consideration. Again, thanks for all of your hard work here. You've really made this easy for us.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sirkitree’s picture

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

Oops, sorry, had wrong version tagged.

KarenS’s picture

Status: Active » Needs review

will_in_wi has been handling the jcalendar code. Are you around to look at this will?

will_in_wi’s picture

This is related to #273894: jCalendar Popup improvements: keep popup inside visible screen.

I think I agree with the patch in theory, but I don't understand what you mean by it appears to be random. Is the problem that it appears relative to the link? Or is the problem that it appears relative to the cursor?

In the d6 version, I took advantage of the newer jquery and made the popup appear relative to the link, but in d5 jquery I don't have that ability. My solution was to write a hack that approximated the link location by using the location of the cursor at the time of click.

What do you think is the best way to do this? I would prefer that the behavior is consistent between the d5 and 6 versions. I was trying to approximate the behavior of google calendar.

Thanks for the patch!

sirkitree’s picture

I see how you are trying to replicate the way Google Calendar works, and this does work well in a full screen calendar. In our situation the calendar is smaller and has content on either side. The date event popping up over that content is what makes it seem so random and inconsistent I think.

Since I can see a use for either, maybe we can make this a configurable setting? If you agree I'll work something up and resubmit a patch.

will_in_wi’s picture

My personal preference is to avoid config settings when a smarter algorithm will work better. However, this may well be a good time for one. Can you post a link to the site so I can see what you are doing? I might be able to have the javascript code be smarter, avoiding the whole problem. If that is not an option, then I think a config setting would work.

Thanks!

sirkitree’s picture

This feature has not been pushed to the live site just yet, however here is a screenshot, though it is with the js using a static verticle position:
http://img.skitch.com/20081016-juj5w5pmmbrgwaubsbg192tiki.jpg

With a calendar that is in the middle of two columns, this becomes an issue when the popup is all over the other columns. If it were a somewhat full-page layout like Google Calendars, it's wouldn't be such a big deal. I'd suggest a setting just because some people will want it either/or I think.

However a smarter algorithm may be to just not allow the popup to be outside of the calendar's viewable area.

will_in_wi’s picture

I see the issue and agree. I personally think that the best option atm would be to add an option that said "allow popup outside calendar". If you are willing to code this it would be great, otherwise I will see what I can do. It would be vastly easier in d6 due to the newer version of jquery. A compromise would be to check for the more recent version of jquery and offer the option in that case.

sirkitree’s picture

Status: Needs review » Closed (works as designed)

The fixed horizontal option works well for my purposes, and unless a bunch of other people find this to be a problem, I'm not sure it's worth diverting a lot of attention to solving, for either of us. ;) But it'll hopefully be useful information to someone who does run into it at some point.

skilip’s picture

Version: 5.x-2.x-dev » 6.x-2.4
Status: Closed (works as designed) » Needs review
FileSize
860 bytes

When the users scrolls, the popup sometimes opens outside the users viewport. With a simple check this can be avoided.

Neslee Canil Pinto’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

The D6 branch is no longer supported so we're closing this issue. If you think this issue still exists in D7 you can open a new one.