Uploaded image for project: 'Olio'
  1. Olio
  2. OLIO-18

Calendar widgit is broken when wrapping years

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.2
    • php-app
    • None

    Description

      If a user clicks the next_month or prev_month arrows and the year is wrapping (i.e. going from December to January or vice versa) then the links for the particular days in that month will be wrong. For example, if it's December 2008 and a user clicks the next month and then clicks the link for the 4th the url will be "http://[host]/index.php?month=13&day=04&year=2008", which is wrong in both the month and year fields. The same holds for prev_month except the month will go to 0 (or lower) and the year will not change.

      Here are patches that will fix the problem:

      — webapp/php/trunk/public_html/calendar.php
      +++ webapp/php/trunk/public_html/calendar.php
      @@ -57,8 57,8 @@ $prevMonthDay+;
      }
      $prev_year= $year-1;
      $next_year= $year+1;
      -$prev_month = $month-1;
      -$next_month = $month+1;
      +$prev_month = $month==1?12:$month-1;
      +$next_month = $month==12?1:$month+1;

      ob_start();
      require("../views/calendar.php");

      — webapp/php/trunk/views/calendar.php
      +++ webapp/php/trunk/views/calendar.php
      @@ -46,9 +46,9 @@ var updateMYLink = "calendar.php?mon=";
      <caption class="monthName"></caption><thead>
      <tr><th id="calheader" colspan="7">
      <a href="#prev_year" class="prev_year" onclick="updateCalendar(<?echo $month;?>,<? echo $prev_year;?>)"><</a>

      • <a href="#prev_month" class="prev_month" onclick="updateCalendar(<? echo $prev_month;?>,<? echo $year;?>)"><</a>
        + <a href="#prev_month" class="prev_month" onclick="updateCalendar(<? echo $prev_month;?>,<? echo ($prev_month==12?($year-1):$year);?>)"><</a>
        <?=$monthName." ".$year?>
      • <a href="#next_month" class="next_month" onclick="updateCalendar(<?echo $next_month;?>,<? echo $year;?>)">></a>
        + <a href="#next_month" class="next_month" onclick="updateCalendar(<?echo $next_month;?>,<? echo ($next_month==1?($year+1):$year);?>)">></a>
        <a href="#next_year" class="next_year" onclick="updateCalendar(<?echo $month;?>,<? echo $next_year;?>)">></a>
        </th></tr>

      Attachments

        1. OLIO18.zip
          2 kB
          Damien Cooke

        Activity

          People

            dgcooke Damien Cooke
            nick1 Nick Lanham
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified