-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
55 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# redmics - redmine ics export plugin | ||
# Copyright (c) 2010-2012 Frank Schwarz, [email protected] | ||
# Copyright (c) 2010-2021 Frank Schwarz, [email protected] | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
|
@@ -73,11 +73,11 @@ def find_optional_query | |
end | ||
|
||
def decode_rendering_settings_from_url | ||
options = [:none, :vevent_full_span, :vevent_end_date, :vevent_start_and_end_date, :vtodo] | ||
options = [:none, :vevent_full_span, :vevent_end_date, :vevent_start_and_end_date, :vtodo, :mega_calendar] | ||
options_summary = [:plain, :status, :ticket_number_and_status] | ||
options_description = [:plain, :url_and_version, :full_no_url, :full] | ||
@rendering = {} | ||
if params[:render_issues] =~ /[0-4]/ | ||
if params[:render_issues] =~ /[0-5]/ | ||
@rendering[:redmics_icsrender_issues] = options[params[:render_issues].to_i] | ||
end | ||
if params[:render_versions] =~ /[0-3]/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
<%# redmics - redmine ics export plugin, Copyright (c) 2010-2011 Frank Schwarz, [email protected] %> | ||
<%# redmics - redmine ics export plugin, Copyright (c) 2010-2021 Frank Schwarz, [email protected] %> | ||
<% | ||
options = ActiveSupport::OrderedHash.new | ||
options[l(:option_settings_rendering_none)] = :none | ||
options[l(:option_settings_rendering_vevent_full_span)] = :vevent_full_span | ||
options[l(:option_settings_rendering_vevent_end_date)] = :vevent_end_date | ||
options[l(:option_settings_rendering_vevent_start_and_end_date)] = :vevent_start_and_end_date | ||
options[l(:option_settings_rendering_vtodo)] = :vtodo | ||
event_options = ActiveSupport::OrderedHash.new | ||
event_options[l(:option_settings_rendering_none)] = :none | ||
event_options[l(:option_settings_rendering_vevent_full_span)] = :vevent_full_span | ||
event_options[l(:option_settings_rendering_vevent_end_date)] = :vevent_end_date | ||
event_options[l(:option_settings_rendering_vevent_start_and_end_date)] = :vevent_start_and_end_date | ||
event_options[l(:option_settings_rendering_vtodo)] = :vtodo | ||
event_options[l(:option_settings_rendering_mega_calendar)] = :mega_calendar if defined?(TicketTime) == 'constant' && TicketTime.class == Class | ||
|
||
version_options = ActiveSupport::OrderedHash.new | ||
version_options[l(:option_settings_rendering_none)] = :none | ||
version_options[l(:option_settings_rendering_vevent_full_span)] = :vevent_full_span | ||
version_options[l(:option_settings_rendering_vevent_end_date)] = :vevent_end_date | ||
version_options[l(:option_settings_rendering_vevent_start_and_end_date)] = :vevent_start_and_end_date | ||
version_options[l(:option_settings_rendering_vtodo)] = :vtodo | ||
|
||
summary_options = ActiveSupport::OrderedHash.new | ||
summary_options[l(:option_settings_enhance_summary_plain)] = :plain | ||
|
@@ -21,11 +29,11 @@ | |
<h3><%= l(:label_settings_rendering_header) %></h3> | ||
<p> | ||
<%= content_tag :label, l(:label_settings_rendering_issues) + ':' %> | ||
<%= select_tag 'settings[redmics_icsrender_issues]', options_for_select(options, @settings[:redmics_icsrender_issues].to_sym) %> | ||
<%= select_tag 'settings[redmics_icsrender_issues]', options_for_select(event_options, @settings[:redmics_icsrender_issues].to_sym) %> | ||
</p> | ||
<p> | ||
<%= content_tag :label, l(:label_settings_rendering_versions) + ':' %> | ||
<%= select_tag 'settings[redmics_icsrender_versions]', options_for_select(options, @settings[:redmics_icsrender_versions].to_sym) %><br/> | ||
<%= select_tag 'settings[redmics_icsrender_versions]', options_for_select(version_options, @settings[:redmics_icsrender_versions].to_sym) %><br/> | ||
</p> | ||
<p> | ||
<%= content_tag :label, l(:label_settings_enhance_summary) + ':' %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# redmics - redmine ics export plugin | ||
# Copyright (c) 2011 Frank Schwarz, [email protected] | ||
# Copyright (c) 2011-2021 Frank Schwarz, [email protected] | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
|
@@ -182,6 +182,16 @@ def create_issues_renderer(type) | |
enhance_issue_description(issue, result) | ||
result | ||
} | ||
when :mega_calendar | ||
lambda { |issue| | ||
result = create_issue_vevent_mega_calendar(issue) | ||
apply_issue_common_properties(issue, result) | ||
apply_issue_event_properties(issue, result) | ||
apply_issue_alarm(issue, result) unless @alarm.nil? | ||
enhance_issue_summary(issue, result) | ||
enhance_issue_description(issue, result) | ||
result | ||
} | ||
end | ||
end | ||
|
||
|
@@ -292,6 +302,16 @@ def create_issue_vtodo(issue) | |
return [todo] | ||
end | ||
|
||
def create_issue_vevent_mega_calendar(issue) | ||
start_date_time, due_date_time = mega_calendar_issue_period(issue) | ||
return [] if start_date_time.nil? || due_date_time.nil? | ||
event = Icalendar::Event.new | ||
event.dtstart = Icalendar::Values::DateTime.new(start_date_time) | ||
event.dtend = Icalendar::Values::DateTime.new(due_date_time) | ||
event.uid = "id:redmics:project:#{issue.project_id}:issue:#{issue.id}@#{Setting.host_name}" | ||
return [event] | ||
end | ||
|
||
def apply_issue_common_properties(issue, result) | ||
result.each { |event| | ||
event.summary = "#{issue.subject}" unless event.summary | ||
|
@@ -553,6 +573,18 @@ def issue_period(issue) | |
return [start_date, due_date] | ||
end | ||
|
||
def mega_calendar_issue_period(issue) | ||
ticket_time = TicketTime.where(:issue_id => issue.id).first rescue nil | ||
ticket_time_begin = ticket_time.time_begin.strftime(" %H:%M") rescue ' 00:00' | ||
ticket_time_end = ticket_time.time_end.strftime(" %H:%M") rescue ' 24:00' | ||
start_date = issue.start_date | ||
due_date = issue.due_date | ||
return [ | ||
(Time.parse(start_date.to_s + ticket_time_begin) unless start_date.nil?), | ||
(Time.parse(due_date.to_s + ticket_time_end) unless due_date.nil?) | ||
] | ||
end | ||
|
||
def version_period(version) | ||
return [version.start_date, version.due_date] | ||
end | ||
|