Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4708 closed enhancement (fixed)

[patch][cla] Calendar date labels colored by Saturdays, Sundays and holidays

Reported by: Hiroaki Nakamura Owned by: Adam Peller
Priority: high Milestone: 1.2
Component: Dijit Version: 0.9
Keywords: Cc: hnakamur@…, tk
Blocked By: Blocking:

Description (last modified by Adam Peller)

Currently, the foreground color of date labels in dijit._Calendar are all black.

In Japan, the very common way is:

  • red for Sundays and national holidays (defined by Japanese law)
  • blue for Saturdays
  • black for other days

Also it is desirable that names of holidays are displayed in tooltips.

This request for enhancement is to accomplish such a feature in an internationalized way.

We are discussing about this enhancement at http://dojotoolkit.org/forum/dijit-dijit-0-9/dijit-development-discussion/patch-rfe-colored-date-labels-saturdays-sundays-a

To keep dijit._Calendar simple, just stub functions are added to it, and the enhanced version will be created as dojox.widget.Calendar.

Attachments (2)

dojo-release-0.9.0-dojox.widget.Calendar.diff (44.3 KB) - added by guest 12 years ago.
Attaching a patch
dijit._Calendar.patch (1.1 KB) - added by guest 12 years ago.
A patch to add getClassForDate() to dijit._Calendar

Download all attachments as: .zip

Change History (12)

Changed 12 years ago by guest

Attaching a patch

comment:1 Changed 12 years ago by Adam Peller

Milestone: 2.0

I'll take a look. I like the idea of tagging days with enough class info so that this can be accomplished via CSS. nls files, however, cannot have function methods (at least I don't think it will work)

Please attach an e-mail to this ticket and indicate whether you've signed a CLA. Thanks.

comment:2 Changed 12 years ago by tk

Cc: hnakamur@… tk added
Reporter: changed from guest to Hiroaki Nakamura

Just updating with the users info (and adding them to the CC list) from their dtk.org acct. And adding my own tag to get updates on this as they come ;)

comment:3 in reply to:  1 Changed 12 years ago by guest

I am glad you like tagging days with CSS. As for nls, it does work. Please run dojox/widget/tests/test_Calendar.html to see it working yourself. I put those functions in nls files because the ways of calculating and displaying holiday labels are different from locale to locale. (Though, in my patch, only functions for Japanese are implemented and functions for other countries are stubs.)

I don't think it is desirable, but is there a better way to accomplish these locale dependent function logics?

I tried to attach my mail signing CLA, but failed due to the uploadable file size limit. The compressed (by bzip -9) size is 491KB. Please loosen the limit.

Thanks. Hiroaki Nakamura

Changed 12 years ago by guest

Attachment: dijit._Calendar.patch added

A patch to add getClassForDate() to dijit._Calendar

comment:4 Changed 12 years ago by guest

After the discussion at the forum, my request becomes just adding getClassForDate() to dijit._Calendar and no dojox.widget.Calendar. I will include a Calendar widget which extends dijit._Calendar in JapaneseHolidays. So Please include dijit._Calendar.patch to the dojo subversion.

Thank you.
Hiroaki Nakamura

comment:5 Changed 12 years ago by bill

Milestone: 2.01.1
Owner: set to Adam Peller

comment:6 Changed 12 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [11573]) Thanks, Nakamura-san, for the patch. Just had to flip the concat order for clazz2. Fixes #4708.

comment:7 Changed 12 years ago by guest

Resolution: fixed
Status: closedreopened

Hi,

I know you will all hate me for this.... but I am reopening this defect! :'(

I think there is a logical mistake in the code that is preventing getClassForDate override to take effect!

var clazz2 = this.getClassForDate(date, this.lang); if(clazz2){

clazz += clazz2 + " " + clazz; Line 119 _Calendar.js Dojo 1.1 release

}

please replace the line

clazz += clazz2 + " " + clazz;

to

clazz = clazz2 + " " + clazz;

else the custom format never takes effect!

Please take this up at high priority... it seems to be a small logical error.

Also, when such an important feature was released in Dojo 1.1 (which we all appreciate) don't you think it would be humble to have it tested along with the isDisabledDate feature...

Thank you.

Regards, Yazad Khambata yazad3@…

comment:8 Changed 12 years ago by Adam Peller

Resolution: fixed
Status: reopenedclosed

(In [13391]) Fixes #4708 - getClassForDate was broken

comment:9 Changed 12 years ago by Adam Peller

Description: modified (diff)
Milestone: 1.11.2

comment:10 Changed 12 years ago by guest

Hi Peller,

  1. One more thing, is it possible to change the backgrounded color of the cells? Since I tried and was not successful...
  2. More importantly there is a style applied when you disable a cell, so when you want holidays to be disabled and color that seems to be an issue. I hope the current fix takes care of such scenarios too.
  3. Also I request to include a complex test case for the same at least for the English calendar. Thank you.

Regards, Yazad Khambata yazad3@…

Note: See TracTickets for help on using tickets.