Modify

Opened 8 years ago

Closed 21 months ago

#562 closed enhancement (duplicate)

[Patch] Allow multiple navigation-synced instances on same page

Reported by: taa Owned by: hasienda
Priority: normal Component: WikiCalendarMacro
Severity: normal Keywords: multiple instances navigation-sync
Cc: taa@…, rjollos Trac Release: 0.9

Description

It would be useful to display two instances of the calendar on the same page; e.g., current month and next month, or current month and previous month, or a combination of both.

Attachments (2)

WikiCalendar_inc_dec_month_and_year.patch (2.2 KB) - added by taa 8 years ago.
Patch
WikiCalendar.py (7.4 KB) - added by taa 8 years ago.
New patched version of WikiCalendar with year and month increment/decrement support

Download all attachments as: .zip

Change History (11)

comment:1 Changed 8 years ago by taa

  • Owner changed from mgood to anonymous
  • Status changed from new to assigned

Proposed solution: allow the year and month parameters to have a sign. If a sign is explicitly specified, then treat the parameters and an increment or decrement according to the sign. If the sign is not used, then the parameter is used as the month or year value.

Support is also added for month > 12 by incrementing the year, and month < 0 by decrementing the year and adding 12 to the month value.

A patch is included below

  • .py

    old new  
    1010#
    1111# Author: Matthew Good <trac@matt-good.net>
    1212# Month/Year navigation by: Jan Finell <finell@cenix-bioscience.com>
     13# Month/Year increment/decrement parameters by: Tony Abou-Assaleh <taa@acm.org>
    1314
    1415import time
    1516import calendar
     
    5152    # find out whether use http param, current or macro param year/month
    5253   
    5354    if http_param_year == "":
    54         # not clicked on a prev or next button
    55         if len(args) >= 1 and args[0] <> "*":
    56             # year given in macro parameters
    57             year = int(args[0])
    58         else:
    59             # use current year
    60             year = today.tm_year
     55        # use current year
     56        year = today.tm_year
    6157    else:
    6258        # year in http params (clicked by user) overrides everything
    6359        year = int(http_param_year)
    64    
     60
     61    # not clicked on a prev or next button
     62    if len(args) >= 1:
     63    if args[0][0] == "*":
     64        pass
     65    elif args[0][0] in ("-", "+"):
     66        year += int(args[0])
     67    else:
     68            # year given in macro parameters
     69            year = int(args[0])
     70
    6571    if http_param_month == "":
    66         # not clicked on a prev or next button
    67         if len(args) >= 2 and args[1] <> "*":
    68             # month given in macro parameters
    69             month = int(args[1])
    70         else:
    71             # use current month
    72             month = today.tm_mon
     72        # use current month
     73        month = today.tm_mon
    7374    else:
    7475        # month in http params (clicked by user) overrides everything
    7576        month = int(http_param_month)
    76    
     77
     78    # not clicked on a prev or next button
     79    if len(args) >= 2:
     80    if args[1][1] == "*":
     81        pass
     82    elif args[1][1] in ("-", "+"):
     83        month += int(args[1])
     84    else:
     85            # month given in macro parameters
     86            month = int(args[1])
     87
     88    # handle month > 12 and month < 1, must shift to month
     89    # range from [1,12] to [0,11] and back
     90    year += (month-1) / 12
     91    month = (month+11) % 12 + 1
     92
    7793    showbuttons = 1
    7894    if len(args) >= 3:
    7995        showbuttons = bool(args[2]=="True" or args[2]=="true" or args[2]=="no" or args[2]=="0")

Changed 8 years ago by taa

Patch

Changed 8 years ago by taa

New patched version of WikiCalendar with year and month increment/decrement support

comment:2 Changed 5 years ago by rjollos

  • Summary changed from Allow increments and decrements in year and month views. to [Patch] Allow increments and decrements in year and month views.

comment:3 Changed 5 years ago by rjollos

  • Owner changed from anonymous to rjollos
  • Status changed from assigned to new

comment:4 Changed 5 years ago by rjollos

  • Status changed from new to assigned

comment:5 Changed 5 years ago by rjollos

  • Summary changed from [Patch] Allow increments and decrements in year and month views. to [Patch] Allow two instances of the calendar on the same page

comment:6 Changed 4 years ago by hasienda

  • Keywords multiple instances navigation-sync added
  • Summary changed from [Patch] Allow two instances of the calendar on the same page to [Patch] Allow multiple navigation-synced instances on same page

Well, this is a nice suggestion indeed.

However, there exists a 'sister' plugin, WikiTicketCalendarMacro, that has been received considerable efforts to improve it for production, and I'm here to evaluate the possibility for incorporating key features of WikiCalendarMacro into it, even making it obsolete in the future.

With regards to #7564 I'd appreciate, if you could test the current version of WikiTicketCalendarMacro in your application as well and report back here. I can't make promises, but this might be a step towards finally solving this issue. Thanks for your patience and for still taking care.

comment:7 Changed 4 years ago by rjollos

  • Cc rjollos added
  • Owner changed from rjollos to hasienda
  • Status changed from assigned to new

comment:8 Changed 4 years ago by hasienda

#8295 suggests a syntax for a calendar instance with offset to current time. I feel like this ticket is related, even more as I expect to have one hybrid Wiki(Ticket)CalendarMacro soon.

comment:9 Changed 21 months ago by hasienda

  • Resolution set to duplicate
  • Status changed from new to closed

Sorry for not pushing this further on.

Please follow-up on #8295, that I'd like to keep open instead of this one, because I feel discussion on the feature has advanced a bit more over there. And certainly the development target is 0.11 these days, that is already rather aged on its own, because Trac 1.0 is out for many months now.

Add Comment

Modify Ticket

Action
as closed The owner will remain hasienda.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.