Modify

Opened 12 years ago

Last modified 12 years ago

#9679 new enhancement

Patch to add support for DTEND

Reported by: branson Owned by: Xavier Pechoultres
Priority: normal Component: IcalViewPlugin
Severity: normal Keywords: ical dtend
Cc: Trac Release: 0.12

Description

Created a patch to add support for a dtend field in icalview:

We don't use duration here.. but use ganttcalendar plugin and therefor use due_assign and due_close; So I added support for start/end vs start/duration. This works well for 'leave' type tickets and 'task' type tickets.

Attachments (1)

icalview.dtend.patch (4.0 KB) - added by branson 12 years ago.
Patch to add support for due_close/DTEND

Download all attachments as: .zip

Change History (2)

Changed 12 years ago by branson

Attachment: icalview.dtend.patch added

Patch to add support for due_close/DTEND

comment:1 Changed 12 years ago by branson

Weird .. can't see the patch in this version of trac... attaching as a comment

# diff -p icalviewplugin/0.11/icalview/icalview.py icalviewplugin.mod/0.11/icalview/icalview.py                            
*** icalviewplugin/0.11/icalview/icalview.py	2009-12-14 09:34:46.000000000 -0500
--- icalviewplugin.mod/0.11/icalview/icalview.py	2012-01-09 15:00:29.000000000 -0500
***************
*** 1,5 ****
! """
! plugin fro Trac 0.11 to provide iCalendar ouput for ticket's queries
  author : Xavier Pechoultes <x.pechoultres@clariprint.com>
  Licence: GPL
  """
--- 1,4 ----
! """ fro Trac 0.11 to provide iCalendar ouput for ticket's queries
  author : Xavier Pechoultes <x.pechoultres@clariprint.com>
  Licence: GPL
  """
*************** class iCalViewPlugin(QueryModule):
*** 108,113 ****
--- 107,113 ----
          """
          dtstart_key = self.config['icalendar'].get('dtstart','')
          duration_key = self.config['icalendar'].get('duration','')
+         dtend_key = self.config['icalendar'].get('dtend','')
          self.env.log.debug("dtstart_key=%s" % dtstart_key)
          self.env.log.debug("duration_key=%s" % duration_key)
  
*************** class iCalViewPlugin(QueryModule):
*** 115,120 ****
--- 115,124 ----
              self.env.log.debug("use dtstart_key=%s" % dtstart_key)
              if dtstart_key not in query.cols:
                  query.cols.append(dtstart_key)
+         if dtend_key != '':
+             self.env.log.debug("use dtend_key=%s" % dtend_key)
+             if dtend_key not in query.cols:
+                 query.cols.append(dtend_key)
          if duration_key != '':
              if duration_key not in query.cols:
                  query.cols.append(duration_key)
*************** class iCalViewPlugin(QueryModule):
*** 165,172 ****
--- 169,179 ----
              if 'TICKET_VIEW' in req.perm(ticket):
                  kind = "VEVENT"
                  dtstart = None
+                 dtend = None
                  if dtstart_key != '':
                      dtstart = self.parse_date(result[dtstart_key])
+                 if dtend_key != '':
+                     dtend = self.parse_date(result[dtend_key])
                  due = None
                  if dtstart == None :
                      kind = "VTODO"
*************** class iCalViewPlugin(QueryModule):
*** 182,195 ****
                  content.write("UID:<%s@%s>\r\n" % (get_resource_url(self.env,ticket,req.href),os.getenv('SERVER_NAME')))
                  if dtstart != None:
                      self.format_date(content,"DTSTART",dtstart)
!                     if duration_key != '':
                          duration = self.parse_duration(result[duration_key])
                          if type(duration) == datetime.timedelta :
                              content.write("DURATION:P%dDT%dS\r\n" % (duration.days, duration.seconds))
!                         else :
                              content.write("DURATION:%s\r\n" % duration)
                  elif due != None:
                      self.format_date(content,"DUE",due,False)
                  self.format_date(content,"CREATED",result["time"])
                  self.format_date(content,"DTSTAMP",result["changetime"])
                  protocol = "http"
--- 189,205 ----
                  content.write("UID:<%s@%s>\r\n" % (get_resource_url(self.env,ticket,req.href),os.getenv('SERVER_NAME')))
                  if dtstart != None:
                      self.format_date(content,"DTSTART",dtstart)
!                     if dtend != None:
!                        self.format_date(content,"DTEND",dtend+datetime.timedelta(days=1))
!                     elif duration_key != '':
                          duration = self.parse_duration(result[duration_key])
                          if type(duration) == datetime.timedelta :
                              content.write("DURATION:P%dDT%dS\r\n" % (duration.days, duration.seconds))
!                         else:
                              content.write("DURATION:%s\r\n" % duration)
                  elif due != None:
                      self.format_date(content,"DUE",due,False)
+ 
                  self.format_date(content,"CREATED",result["time"])
                  self.format_date(content,"DTSTAMP",result["changetime"])
                  protocol = "http"

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Xavier Pechoultres.

Add Comment


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

 
Note: See TracTickets for help on using tickets.