Page 1 of 1

bug in the calendar plugin? No forward button if no posts

Posted: Mon Nov 27, 2006 9:10 pm
by periferral
Hi . I am using the calendar on my sidebar. It shows the calendar just fine with the current month and the left arrow to move to previous months. However, lets say in November, I have no blog entries, I can click on the left arrow to go back to October, but once in October, there is no right arrow to move back to November.

So basically I am an in a month and the next month has no entries, the right arrow is missing.

Ideally I would like the calendar to always show forward and back buttons. This way I can move to the next month if I want to see dates ahead.

Re: bug in the calendar plugin? No forward button if no post

Posted: Mon Nov 27, 2006 11:04 pm
by garvinhicking
Hi!

Hm, inside the include/plugins_internal.inc.php you should see code that tries to show the next/forward buttons depending on the first and last entry (chronological) in your blog. So it should be independent from which month you look at:

Code: Select all

        // Get first and last entry
        $minmax = serendipity_db_query("SELECT MAX(timestamp) AS max, MIN(timestamp) AS min FROM {$serendipity['dbPrefix']}entries");
        if (!is_array($minmax) || !is_array($minmax[0]) || $minmax[0]['min'] < 1 || $minmax[0]['max'] < 1) {
            // If no entry is available yet, allow scrolling a year back and forth
            $minmax = array(
                        '0' => array(
                                 'min' => mktime(0, 0, 0, 1, 1, date('Y', $now) - 1),
                                 'max' => mktime(0, 0, 0, 1, 1, date('Y', $now) + 1)
                               )
                            );
        }
Could you execute that SQL query on your blog to see if it returns two timestamps?

HTH,
Garvin

Posted: Mon Nov 27, 2006 11:53 pm
by periferral
garvin
here is what i did

mysql> SELECT MAX(timestamp) AS max, MIN(timestamp) AS min FROM serendipity_entries;
+------------+------------+
| max | min |
+------------+------------+
| 1139689035 | 1124131977 |
+------------+------------+
1 row in set (0.00 sec)

mysql>


hope this helps.

Posted: Tue Nov 28, 2006 12:06 am
by periferral
i guess the problem isnt quite as i said it was. So lets say, you dont have any posts for the last 3 months, nov, oct, sept.

now if i go from nov to oct, then i cant go back to nov since there wont be a forward button (since there are no posts in all of nov). however, since i had a post on august.. anything before that day will have a forward button.

this may not be considered as a bug. However, I think calendar should just always show forward and back buttons, independent of the posts.

Posted: Tue Nov 28, 2006 12:27 am
by garvinhicking
Hi!

Hm, in the past people appreciated the fact that the calendar only showed the range of available entry ranges...so when we fix it in your opinion, other people will dislike it. So the best thing would be to add a config option to the plugin.

Best regards,
Garvin