From 17559921835f036a50330476176ea29c598ba84c Mon Sep 17 00:00:00 2001 From: "jocuri%softhome.net" <> Date: Wed, 17 Mar 2004 05:18:40 +0000 Subject: Patch for bug 235459: add icalendar output format in buglist; patch by William Jon McCann ; r=vlad; a=justdave. --- Bugzilla/Constants.pm | 1 + Bugzilla/Template.pm | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'Bugzilla') diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index a1bf74ba0..a61cb4620 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -103,6 +103,7 @@ use constant contenttypes => "js" => "application/x-javascript" , "csv" => "text/plain" , "png" => "image/png" , + "ics" => "text/calendar" , }; 1; diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index c123154bb..310a18161 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -293,6 +293,31 @@ sub create { return $var; }, + # iCalendar contentline filter + ics => [ sub { + my ($context, @args) = @_; + return sub { + my ($var) = shift; + my ($par) = shift @args; + my ($output) = ""; + + $var =~ s/[\r\n]/ /g; + $var =~ s/([;\\\"])/\\$1/g; + + if ($par) { + $output = sprintf("%s:%s", $par, $var); + } else { + $output = $var; + } + + $output =~ s/(.{75,75})/$1\n /g; + + return $output; + }; + }, + 1 + ], + # We force filtering of every variable in key security-critical # places; we have a none filter for people to use when they # really, really don't want a variable to be changed. -- cgit v1.2.3-24-g4f1b