Closed Bug 366299 Opened 17 years ago Closed 17 years ago

Can't create new event, can't navigate week view, can't switch off Workweek days only (error: selectedDay has no properties)

Categories

(Calendar :: Calendar Frontend, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: luc.mousseau, Assigned: luc.mousseau)

References

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Build Identifier: Thunderbird version 1.5.0.9 (20061207) Lightning version 0.4a1 (build 2007010704)

For some reason currentView().selectedDay is null when a non-visible day is selected while "Workweek days only" is enabled while in Week View. I've identified at least 3 problems as a result. This doesn't appear to be a problem in Month View. This also appears to affect Sunbird (but I don't use).

Reproducible: Always

Steps to Reproduce:
1.While in Week View enable Workweek view.
2.Have a non workweek day selected prior to enabling, or select a non workweek day using the datepicker.
3-A.Disable Workweek view.
3-B.Try to create a new event using the "New Event" toolbar button.
3-C.Try to navigate using the arrows/Week# controls.

Actual Results:  
A: Nothing happens until you refresh the week view by either changing to another view and back again to the week view or by changing the date using the date picker. Also the controls at the top of the week view (the arrows and "Week #") don't work until the view is refreshed.

B: Nothing happens.

C: Nothing happens.

Expected Results:  
A: Disabling workweek view should immediately return the week view to the full week with the previously invisible day still selected. And the controls should work.

B: New event window should open with the non visible day as the Start/End date (as it would if it were visible).

C: Normal navigation should occur with the same non visible day selected

Before debate starts on the value of being able to create events on a day that's not currently visible in the view, or to even be able to select a non-visible day using the datepicker at all, my $0.02 is, why not?
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2pre) Gecko/20070112 Calendar/0.4a1

I got following error message for A:
Error: aDate has no properties
Source File: chrome://calendar/content/calendar-decorated-week-view.xml
Line: 156

When I try to navigate to another week:
Error: this.selectedDay has no properties
Source File: chrome://calendar/content/calendar-decorated-week-view.xml
Line: 183

I got following error message for B and C:
Error: currentView().selectedDay has no properties
Source File: chrome://calendar/content/calendar-item-editing.js
Line: 58
Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: unspecified → Trunk
I had made mistake in comment#1:

For case C:
Error: this.selectedDay has no properties
Source File: chrome://calendar/content/calendar-decorated-week-view.xml
Line: 183
It looks like the source of this error is here:

Chrome://calendar/content/calendar-multiday-view.xml
Line: 2133
Code: this.mSelectedDayCol = this.findColumnForDate(val);

findColumnForDate() returns null because the column isn't visible in the view.

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3pre) Gecko/20070306
Calendar/0.5pre

I encountered workweek day only problem.

Reproducible: Always

Steps to Reproduce:
1. Confirm 'View -> Workweek days only' is disabled (not checked)
2. Edit -> Preferences -> Views -> Workweek
3. Check Sun[X] Mon[ ] Tue[X] Wed[ ] Thu[ ] Fri[ ] Sat[X]
3. Enable 'View -> Workweek days only'
4. Disable 'View -> Workweek days only'

Expected Results:
When workweek days only enabled, only Sunday, Tuesday and Saturday should be in the calendar view.
When workweek days only disabled, all days should be displayed back.

Actual Results:
Enabling 'workweek days only' works fine.
But disabling 'workweek days only' doesn't displayed all days back. Only San, Tue and Sat are displayed.
Then refresh calendar view, all days is back.

Error Console says:
aData has no properties
chrome://calendar/content/calendar-decorated-week-view.xml

Note:
Sunbird0.3.1 works fine.
(In reply to comment #5)
> Created an attachment (id=254436) [details]
> Adds actual date to selectedDay property instead of depending on Col patch

Luc, is this patch ready for review? If yes you'll have to request review from the corresponding module owner or peer 
(http://wiki.mozilla.org/Calendar:Module_Ownership)
I tested the patch from Luc Mousseau and it works fine. I'm attaching the un-rotten version of this patch that applies to current source code.
Attachment #254436 - Attachment is obsolete: true
Attachment #259091 - Flags: first-review?(michael.buettner)
This errors are easy to hit once you start using 'Workweek days only' feature in week view. Requesting blocking-calendar0.5 because I think this should be fixed for 0.5.

mvl requested a more descriptive and less theoretical summary, therefore changing from "currentView().selectedDay is null in Week View when view is workweek and selected day is not visible" to "Can't create new event, can't navigate week view, can't switch off Workweek days only".
Flags: blocking-calendar0.5?
Summary: currentView().selectedDay is null in Week View when view is workweek and selected day is not visible → Can't create new event, can't navigate week view, can't switch off Workweek days only (error: selectedDay has no properties)
Comment on attachment 259091 [details] [diff] [review]
rev0 - add selectedDay property

Remembering the selected date in case it is missing from the mDateList is a feature that was painfully missing. I think we need to hold this off until 0.5 is out of the door or we decide to let it jump on the train. In any case, r=mickey.
Attachment #259091 - Flags: first-review?(michael.buettner) → first-review+
OS: Windows XP → All
Hardware: PC → All
Whiteboard: [patch in hand][no l10n impact]
Requesting approval to get this patch checked in for 0.5 release.
Assignee: nobody → luc.mousseau
This is good to take.

Patch checked in on MOZILLA_1_8_BRANCH and trunk.

-> FIXED
Status: NEW → RESOLVED
Closed: 17 years ago
Flags: blocking-calendar0.5? → blocking-calendar0.5+
Resolution: --- → FIXED
Whiteboard: [patch in hand][no l10n impact] → [no l10n impact]
Verified with Sunbird0.5pre/Linux (2007040104).
Verified with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4pre) Gecko/20070401 Calendar/0.5pre
Status: RESOLVED → VERIFIED
Flags: blocking-calendar0.5+
Whiteboard: [no l10n impact]
You need to log in before you can comment on or make changes to this bug.