diff options
author | jocuri%softhome.net <> | 2004-03-17 06:18:40 +0100 |
---|---|---|
committer | jocuri%softhome.net <> | 2004-03-17 06:18:40 +0100 |
commit | 17559921835f036a50330476176ea29c598ba84c (patch) | |
tree | 30a62af6791bd961aa5c6be328b9f07fd10a1ce4 /buglist.cgi | |
parent | 2e96788b00b440821b98d37d582392a51d79f1a3 (diff) | |
download | bugzilla-17559921835f036a50330476176ea29c598ba84c.tar.gz bugzilla-17559921835f036a50330476176ea29c598ba84c.tar.xz |
Patch for bug 235459: add icalendar output format in buglist; patch by William Jon McCann <mccannwj@pha.jhu.edu>; r=vlad; a=justdave.
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-x | buglist.cgi | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/buglist.cgi b/buglist.cgi index 0871a8c54..8a02ca490 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -172,6 +172,14 @@ sub DiffDate { return $date; } +sub iCalendarDateTime { + my ($datestr) = @_; + my $date = str2time($datestr); + my ($s,$m,$h,$d,$mo,$y,$wd)= gmtime $date; + $date = sprintf "%04d%02d%02dT%02d%02d%02dZ", 1900+$y,$mo+1,$d,$h,$m,$s; + return $date; +} + sub LookupNamedQuery { my ($name) = @_; confirm_login(); @@ -525,6 +533,9 @@ if ($dotweak) { push(@selectcolumns, "bug_status") if !grep($_ eq 'bug_status', @selectcolumns); } +if ($format->{'extension'} eq 'ics') { + push(@selectcolumns, "opendate") if !grep($_ eq 'opendate', @selectcolumns); +} ################################################################################ # Query Generation @@ -712,10 +723,23 @@ while (my @row = FetchSQLData()) { # Process certain values further (i.e. date format conversion). if ($bug->{'changeddate'}) { $bug->{'changeddate'} =~ - s/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/$1-$2-$3 $4:$5:$6/; - $bug->{'changeddate'} = DiffDate($bug->{'changeddate'}); + s/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/$1-$2-$3 $4:$5:$6/; + if ($format->{'extension'} eq 'ics') { + $bug->{'changeddate'} = iCalendarDateTime($bug->{'changeddate'}); + } + else { + $bug->{'changeddate'} = DiffDate($bug->{'changeddate'}); + } + } + + if ($bug->{'opendate'}) { + if ($format->{'extension'} eq 'ics') { + $bug->{'opendate'} = iCalendarDateTime($bug->{'opendate'}); + } + else { + $bug->{'opendate'} = DiffDate($bug->{'opendate'}); + } } - ($bug->{'opendate'} = DiffDate($bug->{'opendate'})) if $bug->{'opendate'}; # Record the owner, product, and status in the big hashes of those things. $bugowners->{$bug->{'assigned_to'}} = 1 if $bug->{'assigned_to'}; @@ -800,6 +824,9 @@ $vars->{'splitheader'} = $::COOKIE{'SPLITHEADER'} ? 1 : 0; $vars->{'quip'} = GetQuip(); $vars->{'currenttime'} = time(); +if ($format->{'extension'} eq 'ics') { + $vars->{'currenttime'} = iCalendarDateTime(scalar gmtime $vars->{'currenttime'}); +} # The following variables are used when the user is making changes to multiple bugs. if ($dotweak) { |