Hi, I just noticed that dtml-calendar tag shows calendar wrong , if you set set weekdays to 15 in month mode. What it is supposed to do, is draw the calendar with only the weekdays present -- which it actually does -- but it just jumps over weekends. Meaning today is 2 nd of March saturday, but the calendar shows it as a monday. <dtml-calendar controls=no modes="month" bgcolor="#DDDDDD" lang=fi weekdays="15" tablewidth=200> ... </dtml-calendar> If you set weekdays to 17 everything works just fine. Has anyone else seen the same behaviour? -huima
At 08:20 PM 3/2/02 +0200, you wrote:
I just noticed that dtml-calendar tag shows calendar wrong , if you set set weekdays to 15 in month mode. What it is supposed to do, is draw the calendar with only the weekdays present -- which it actually does -- but it just jumps over weekends. Meaning today is 2 nd of March saturday, but the calendar shows it as a monday.
<dtml-calendar controls=no modes="month" bgcolor="#DDDDDD" lang=fi weekdays="15" tablewidth=200> ... </dtml-calendar>
Hi, I think if you open the calendar tag source in the products directory, go to line 946 in the render_dwm function and add the following line, it will give you what you want. Original code: d = bd month = bd.month() while d.month() == month: if c == self.week_ndays: s = s + '</tr><tr>' c = 0 s = s + self.render_day_(md, d, d == bd) d = d + 1 c = c + 1 if c < self.week_ndays: s = s + '<td bgcolor="%s" colspan="%s"> </td>' % ( self.bgcolor, self.week_ndays - c) s = s + '</tr>' After change: d = bd month = bd.month() while d.month() == month: if c == self.week_ndays: s = s + '</tr><tr>' c = 0 Add this line ===> d = d + 2 s = s + self.render_day_(md, d, d == bd) d = d + 1 c = c + 1 if c < self.week_ndays: s = s + '<td bgcolor="%s" colspan="%s"> </td>' % ( self.bgcolor, self.week_ndays - c) s = s + '</tr>' It looks like the original code wasn't incrementing the date to account for the skipped days. NOTE: This will only work for weekdays="15". You need to set up a variable that is subtracted from 7 to handle other weekdays parameters. I haven't figured that out yet! Harold Lutenbacher harold@lilac.ocn.ne.jp
I played around with my previous suggestion and found that it only works correctly if the mode is also set to "month". Any other setting causes incorrect dates to be displayed. Not a very helpful or flexible suggestion was it!! Harold Lutenbacher harold@lilac.ocn.ne.jp
participants (2)
-
Harold Lutenbacher -
Heimo Laukkanen