boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Calendar Problem
Goto page 1, 2  Next
 
Post new topic   Reply to topic    boardom Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
mikelittle



Joined: 11 May 2002
Posts: 376
Location: UK

PostPosted: Sun Dec 01, 2002 1:14 am    Post subject: Calendar Problem Reply with quote

Hmmm, it looks like there is still a calendar problem.
I've just posted to my blog. The date recorded was 1st December (time 00:08 ). This shows on my blog.

However the calendar is still showing the month of November. However it is NOT highlighting the 30th as today's date. And it IS showing a next month link.
If I click on the next month link it correctly displays the month of December with the 1st highlighted.

I suspect this problem will dissappear at 1am. I'll try to look into it before then.
_________________
Mike Little
http://zed1.com/journalized/
"Share what you know. Learn what you don't."
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
mikelittle



Joined: 11 May 2002
Posts: 376
Location: UK

PostPosted: Sun Dec 01, 2002 1:23 am    Post subject: Reply with quote

Even more strange, testing on my server at home (which is in the same time zone as my blog) when I first load my page, the next month link points to January 2003!
Investigating.
_________________
Mike Little
http://zed1.com/journalized/
"Share what you know. Learn what you don't."
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
mikelittle



Joined: 11 May 2002
Posts: 376
Location: UK

PostPosted: Sun Dec 01, 2002 2:11 am    Post subject: Reply with quote

OK, the strangeness at home was because I didn't have a posting on the 1st December!

I think I've fixed the problem (and it wasn't DST it was timezone) but found another one.
At line 52, the calculation of this month and year does not take into account the timezone difference.
So the code:
Code:
    } else {
        $thisyear = date('Y');
        $thismonth = date('m');
    }

becomes
Code:
    } else {
        $thisyear = date('Y', time()+($time_difference * 3600));
        $thismonth = date('m', time()+($time_difference * 3600));
    }


This fixes up the displaying of the wrong month.

However you still end up with a next month link which points to the correct next month but the wrong year (January 2002 ) and shouldn't be there at all.

The problem comes in Alex King's mod around line 59:

Code:
$ak_date = mktime(0,0,0,$thismonth,1,$thisyear);
$ak_previous_month = date("m", $ak_date - ((date("t", $ak_date) * 86400) + 86400));
$ak_next_month = date("m", $ak_date + ((date("t", $ak_date) * 86400) + 86400));

Because this starts with the 1st of the month, the time difference change doesn't help.

Maybe now that the calculation of $thismonth and $thisyear is correct then this next/prev calculation could simplified.

But in attempting to do this I noticed that Alex's mod doesn't handle the current month being January or December, it doesn't change the year appropriately.

I'll work on that next.


Mike
_________________
Mike Little
http://zed1.com/journalized/
"Share what you know. Learn what you don't."


Last edited by mikelittle on Sun Dec 01, 2002 2:32 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
mikelittle



Joined: 11 May 2002
Posts: 376
Location: UK

PostPosted: Sun Dec 01, 2002 2:29 am    Post subject: Reply with quote

OK, I think I've fixed alex's hack too.
the code:
Code:

// original arrow hack by Alex King
$archive_link_m = $siteurl.'/'.$blogfilename.$querystring_start.'m'.$querystring_equal;
$ak_date = mktime(0,0,0,$thismonth,1,$thisyear);
$ak_previous_month = date("m", $ak_date - ((date("t", $ak_date) * 86400) + 86400));
$ak_next_month = date("m", $ak_date + ((date("t", $ak_date) * 86400) + 86400));
$ak_first_post = mysql_query("SELECT MONTH(MIN(post_date)), YEAR(MIN(post_date)) FROM $tableposts");
$ak_first_post = mysql_fetch_array($ak_first_post);
// using text links by default
$ak_previous_month_dim = '<span><</span>  ';
$ak_previous_month_active = '<a href="'.$archive_link_m.$thisyear.$ak_previous_month.$querystring_separator.$month[zeroise($ak_previous_month,2)].'-'.$thisyear.'" style="text-decoration: none;"><</a>  ';
$ak_next_month_dim = '  <span>></span>';
$ak_next_month_active = '  <a href="'.$archive_link_m.$thisyear.$ak_next_month.$querystring_separator.$month[zeroise($ak_next_month,2)].'-'.$thisyear.'" style="text-decoration: none;">></a>';
$ak_previous_month_link = (mktime(0,0,0,$ak_previous_month,0,$thisyear) < mktime(0,0,0,$ak_first_post[0],0,$ak_first_post[1])) ? $ak_previous_month_dim : $ak_previous_month_active;
$ak_next_month_link = (mktime(0,0,0,$ak_next_month,0,$thisyear)> mktime()) ? $ak_next_month_dim : $ak_next_month_active;

becomes:
Code:

// original arrow hack by Alex King
$archive_link_m = $siteurl.'/'.$blogfilename.$querystring_start.'m'.$querystring_equal;
$ak_previous_year = $thisyear;
$ak_next_year = $thisyear;
$ak_previous_month = $thismonth - 1;
$ak_next_month = $thismonth + 1;
if ($ak_previous_month == 0) {
    $ak_previous_month = 12;
    --$ak_previous_year;
}
if ($ak_next_month == 13) {
    $ak_next_month = 1;
    ++$ak_next_year;
}

$ak_first_post = mysql_query("SELECT MONTH(MIN(post_date)), YEAR(MIN(post_date)) FROM $tableposts");
$ak_first_post = mysql_fetch_array($ak_first_post);
// using text links by default
$ak_previous_month_dim = '<span><</span>  ';
$ak_previous_month_active = '<a href="'.$archive_link_m.$ak_previous_year.zeroise($ak_previous_month,2).'"  style="text-decoration: none;"><</a>  ';
$ak_next_month_dim = '  <span>></span>';
$ak_next_month_active = '  <a href="'.$archive_link_m.$ak_next_year.zeroise($ak_next_month,2).'" style="text-decoration: none;">></a>';
$ak_previous_month_link = (mktime(0,0,0,$ak_previous_month,1,$ak_previous_year) < mktime(0,0,0,$ak_first_post[0],1,$ak_first_post[1])) ? $ak_previous_month_dim : $ak_previous_month_active;
$ak_next_month_link = (mktime(0,0,0,$ak_next_month,1,$ak_next_year)> mktime()) ? $ak_next_month_dim : $ak_next_month_active;


Edit After IM-ing with Alex I've added another fix (and I've removed a couple of my extras)

Hope this helps,
Mike
_________________
Mike Little
http://zed1.com/journalized/
"Share what you know. Learn what you don't."
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
alex_t_king



Joined: 09 Oct 2002
Posts: 194

PostPosted: Sun Dec 01, 2002 4:19 am    Post subject: Reply with quote

Mike, thanks for all your help fixing this. I've updated the zip file on my site with the bug fixes.
_________________
Yahoo! Messenger ID: alex_t_king
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
alex_t_king



Joined: 09 Oct 2002
Posts: 194

PostPosted: Sun Dec 01, 2002 10:18 am    Post subject: Reply with quote

Bad news, it is after 1am on Dec 1st and my calendar isn't showing December... must still be a bug in there somewhere.
_________________
Yahoo! Messenger ID: alex_t_king
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
mikelittle



Joined: 11 May 2002
Posts: 376
Location: UK

PostPosted: Sun Dec 01, 2002 4:50 pm    Post subject: Reply with quote

No, I think it's designed to only show months in which there are postings.
That is, it will not show months beyond the first or last posting date.
Although, if you pass in m=200301 it will display that calendar.


Mike
_________________
Mike Little
http://zed1.com/journalized/
"Share what you know. Learn what you don't."
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
alex_t_king



Joined: 09 Oct 2002
Posts: 194

PostPosted: Sun Dec 01, 2002 5:16 pm    Post subject: Reply with quote

ahh, so it's a feature then
_________________
Yahoo! Messenger ID: alex_t_king
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Anavy



Joined: 29 May 2002
Posts: 58

PostPosted: Tue Dec 03, 2002 10:35 pm    Post subject: Reply with quote

I'm using b2calendar.php Rev. 1.12 (CVS) that includes alex_t_king's hack. I've posted today & the calendar changed to Dec. 2002 properly - but now it shows the Next_Month as 1/2002 instead of 1/2003 (none should be allowed as both has no posts).

Did anyone noticed this behavior?
Back to top
View user's profile Send private message
alex_t_king



Joined: 09 Oct 2002
Posts: 194

PostPosted: Tue Dec 03, 2002 10:55 pm    Post subject: Reply with quote

Yes, there was a bug in my code - grab the latest version from my site.
_________________
Yahoo! Messenger ID: alex_t_king
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
GamerZ



Joined: 15 May 2002
Posts: 537
Location: Singapore

PostPosted: Wed Dec 04, 2002 6:20 am    Post subject: Reply with quote

i used the fixded code by mike little and it is solved
_________________

++ GamerZ.Per.Sg - Complex Simplicity
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
alex_t_king



Joined: 09 Oct 2002
Posts: 194

PostPosted: Wed Dec 04, 2002 8:57 am    Post subject: Reply with quote

Good deal, the zip on my site includes his fixes as well for those who'd rather not edit the code directly. Thanks again Mike.
_________________
Yahoo! Messenger ID: alex_t_king
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Anavy



Joined: 29 May 2002
Posts: 58

PostPosted: Wed Dec 04, 2002 2:21 pm    Post subject: Reply with quote

Thanks Alex. The new version fixed the problem.
Back to top
View user's profile Send private message
Mister44



Joined: 31 Oct 2002
Posts: 237
Location: Philadelphia, PA, USA

PostPosted: Fri Dec 06, 2002 9:20 pm    Post subject: Reply with quote

Just a couple minor changes - fix a querystring bug and improve the XHTML compatability.

first the querystring bugfix - lines 278 to 281 - should be
Code:

echo '<a href="'.$siteurl.'/'.$blogfilename.$querystring_start.'m'.$querystring_equal.$thisyear.$thismonth.date('d',$i).'" class="b2calendarlinkpost" title="'.$ak_day_titles.'">';
}
else {
echo '<a href="'.$siteurl.'/'.$blogfilename.$querystring_start.'m'.$querystring_equal.$thisyear.$thismonth.date('d',$i).'" class="b2calendarlinkpost">';


For XHTML -- its basically adding the thead and tbody elements - you can grab the fully patched file from here.

Alex, feel free to add these changes back into your distro.

(And can I just say how much I hate the code tags in phpBB? the echo lines shouldnt wrap.)
Back to top
View user's profile Send private message Visit poster's website
Mister44



Joined: 31 Oct 2002
Posts: 237
Location: Philadelphia, PA, USA

PostPosted: Fri Dec 06, 2002 11:06 pm    Post subject: Reply with quote

I really am not having a good code day. If you grabbed a copy in the last hour and a half, there's a glitch in the thead. Pick up a new copy - same location.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Bugs All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group