Project

General

Profile

Feature #1077 » ICS_Support__2.patch

Florian L, 2008-05-05 19:35

View differences:

app/controllers/application.rb Locally Modified (Based On LOCAL)
include Redmine::MenuManager::MenuController
helper Redmine::MenuManager::MenuHelper
require 'icalendar'
REDMINE_SUPPORTED_SCM.each do |scm|
require_dependency "repository/#{scm.underscore}"
end
......
render :template => "common/feed.atom.rxml", :layout => false, :content_type => 'application/atom+xml'
end
def render_ics(items, options={})
cal = Icalendar::Calendar.new
items.each { |i|
event = Icalendar::Event.new
event.dtstart = i.start_date
event.dtend = i.due_date
if i.is_a? Issue
event.summary = i.subject
else
event.summary = "V. " + i.name
end
if !i.description.nil?
event.description = i.description
end
cal.add_event(event)
}
@cal_string = cal.to_ical
render :template => "common/calendar.ics.erb", :layout => false , :content_type => Mime::ICS
end
def self.accept_key_auth(*actions)
actions = actions.flatten.map(&:to_s)
write_inheritable_attribute('accept_key_auth_actions', actions)
app/controllers/projects_controller.rb Locally Modified (Based On LOCAL)
@calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), current_language, :month)
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
events = []
if (request.format == Mime::ICS)
@calendar.startdt = @project.created_on.to_s(:db)
end
@project.issues_with_subprojects(@with_subprojects) do
events += Issue.find(:all,
:include => [:tracker, :status, :assigned_to, :priority, :project],
......
end
@calendar.events = events
render :layout => false if request.xhr?
respond_to do |format|
format.html { render :layout => false if request.xhr? }
format.ics { render_ics(events) }
end
end
def gantt
@trackers = @project.rolled_up_trackers
app/views/common/calendar.ics.erb Locally New
<%= @cal_string %>
lib/redmine/helpers/calendar.rb Locally Modified (Based On LOCAL)
end
end
def startdt=(dt)
@startdt = dt
end
# Sets calendar events
def events=(events)
@events = events
(2-2/12)