Calendar 0.7 alpha problems

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
pishkus

Calendar 0.7 alpha problems

Post by pishkus »

hi,
i downloaded Calendar 0.7 alpha from wiki, everything seemed to work fine, but i noticed that the last day of every month is missing, i.e. months who usualy have 30 show only 29, and the one who have 31 show only thirty. there were also some mistakes left in templates e.g. the year was set to 2005 not to {$year} but i managed to work it out by myself :)
so, does any of you get the same problem of the short months? :)

thanks.
pishkus

Re: Calendar 0.7 alpha problems

Post by pishkus »

btw the last day shows up, if there is an event on this day. if there are no events on the last day, it's just not there :(
pishkus

Re: Calendar 0.7 alpha problems

Post by pishkus »

well, i found the problem:

on line 1243 there should be:

Code: Select all

for($i = 1; $i <= $number_of_days_in_month; $i++)
instead of

Code: Select all

for($i = 1; $i < $number_of_days_in_month; $i++)
so the mistake was that the '=' was missing. sorry for disturbing :)
Akrabat

Re: Calendar 0.7 alpha problems

Post by Akrabat »

doh! good spotting there!
Akrabat

Re: Calendar 0.7 alpha problems

Post by Akrabat »

Thanks for those. I've udated the SVN code with the fixes.
iNSiPiD

Re: Calendar 0.7 alpha problems

Post by iNSiPiD »

Does anyone have any nice examples of this module being used on their site?

I used earlier versions but wasn't happy with the calendar layout itself. Now I'm really keen to see what's changed without having to install and populate it myself at this stage. Call me lazy... ;)
pishkus

Re: Calendar 0.7 alpha problems

Post by pishkus »

well, i'm currently working on some reservation system, and this calendar module fits my requirements. of cource, i've made some edits to output days class, because i need to show if day is in past, or in future, so i've added some code like

Code: Select all

    if($year > date('Y') || $year == date('Y') && $month > date('m'))
      {
        for($i = 1; $i <= $number_of_days_in_month; $i++)
    		  {
            $days[$i]['class'] .= 'calendar-future-day';
          }
		  } 
i'm too lazy to go through the rest of the code and seek if i can do it in a more simple way, so i added this code as shown above to put a class to a past day, or future day. Maybe there is a more simple way that someone can tell? :)

i also attach one picture of how the reservation system will show in front page. (a little bit of  show off :D )

[attachment deleted by admin]
iNSiPiD

Re: Calendar 0.7 alpha problems

Post by iNSiPiD »

pishkus, that's really farking lovely! And a nice piece of code, too. I will borrow it if you don't mind. ;)

Perhaps it should be added to SVN?
iNSiPiD

Re: Calendar 0.7 alpha problems

Post by iNSiPiD »

Akrabat, should I install 0.7 alpha on my site at this stage?

I'm still using 0.6.1 and I'm not sure what's changed.

I want the day to highlight when there is an event, instead of the bullet list and title. Is there a way to change this?

pishkus seems to have done a very good job.
pishkus

Re: Calendar 0.7 alpha problems

Post by pishkus »

some peace of my code (not all of it, just a fragment) to set the css if a day has events to one class, and if it does not set to another css class.

Code: Select all

		if ($year == date('Y') && $month == date('m'))
  	  {
        for($i = 1; $i < date('j'); $i++)
      	  {
            $days[$i]['class'] = 'calendar-past-day';
            if (count($days[$i]['events']))
              $days[$i]['class'] = 'calendar-past-day-events';            
          }          
      }
i have also modified the calendar template because i did not like the bullet list either:

Code: Select all

<table class="calendar" id="{$table_id}" align="center">
<caption class="calendar-month"><span class="calendar-prev"><a href="{$navigation.prev}">«</a></span> {$year} {$month_names[$month]} <span class="calendar-next"><a href="{$navigation.next}">»</a></span></caption>
<tbody><tr>
{foreach from=$day_names item=day key=key}
<th abbr="{$day}">{$day_short_names[$key]}</th>
{/foreach}</tr>

<tr>
{* initial empty days *}
{if $first_of_month_weekday_number > 0}
<td colspan="{$first_of_month_weekday_number}"> </td>
{/if}

{* iterate over the days of this month *}
{assign var=weekday value=$first_of_month_weekday_number}
{foreach from=$days item=day key=key}
{if $weekday == 7}
    {assign var=weekday value=0}
</tr>
<tr>
{/if}
<td class="{$day.class}" {$day.rezinfo}>
<a href="{$day.url}">{$key}</a>
</td>
{math assign=weekday equation="x + 1" x=$weekday}
{/foreach}

{* remaining empty days *}
{if $weekday != 7}
<td colspan="{math equation="7-x" x=$weekday}"> </td>
{/if}


</tr>
</table>
P.S. sorry for answering a question not for me :)
Akrabat

Re: Calendar 0.7 alpha problems

Post by Akrabat »

iNSiPiD wrote: Akrabat, should I install 0.7 alpha on my site at this stage?

I'm still using 0.6.1 and I'm not sure what's changed.

I want the day to highlight when there is an event, instead of the bullet list and title. Is there a way to change this?

pishkus seems to have done a very good job.
Biggest changes to 0.7 are that all the output is controlled via the templates so you can get the html todo what you want. I think you should certainly test it on a test site!

I like the idea of adding a css class so that you know if a date has events, though to be honest, that could be done in the template.
iNSiPiD

Re: Calendar 0.7 alpha problems

Post by iNSiPiD »

Sweet. I didn't even realise there were templates. [blush]

I'll look into it now.

Thank you, too, pishkus. Can I ask to see a live example of your calendar?

Mine is currently at http://d81314.i50.quadrahosting.com.au/.

The biggest problem I have now is that when you click a date in the calendar it is returning the detail view in the {content} AND also from the place I call the module. So it's in two places.

Can I just make it show in {content}? Can I set a template or page like with the News module?
iNSiPiD

Re: Calendar 0.7 alpha problems

Post by iNSiPiD »

Akrabat, I'm running in XHTML transitional. I did have a strict doctype there for a while but it all became too bluddy hard.

Anyway, I've run my homepage through the W3C's online validator and there are dozens of errors associated with the Calendar module.

You can see them here:

http://validator.w3.org/check?uri=http% ... .com.au%2F

The majority occur as a result of the generated URL. The good news is that most of them can be fixed by simply replacing & with &.

There are others which are due to deprecated or unsupported tag elements. Do you think you will revise these in the next release, or should I hack at them now?
iNSiPiD

Re: Calendar 0.7 alpha problems

Post by iNSiPiD »

Here's a screenshot of what I've managed to do with styling 0.6.1 with no hacks to the codebase.

Not as pretty as pishkus' site but OK for now. :)

[attachment deleted by admin]
Akrabat

Re: Calendar 0.7 alpha problems

Post by Akrabat »

iNSiPiD wrote: Anyway, I've run my homepage through the W3C's online validator and there are dozens of errors associated with the Calendar module.
oops!
I'll ensure that the default templates pass the validator before I release 0.7!
Locked

Return to “Modules/Add-Ons”