@date_from = Date.civil(@year_from, @month_from, 1)
@date_to = (@date_from >> @months) - 1
+ @events = []
@project.issues_with_subprojects(params[:with_subprojects]) do
- @issues = Issue.find(:all,
+ @events += Issue.find(:all,
:order => "start_date, due_date",
:include => [:tracker, :status, :assigned_to, :priority],
:conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}))", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to]
) unless @selected_tracker_ids.empty?
end
- @issues ||=[]
+ @events += @project.versions.find(:all, :conditions => ["effective_date BETWEEN ? AND ?", @date_from, @date_to])
+ @events.sort! {|x,y| x.start_date <=> y.start_date }
if params[:output]=='pdf'
@options_for_rfpdf ||= {}
#\r
top = headers_heigth + y_start\r
pdf.SetFontStyle('B',7)\r
-@issues.each do |i|\r
+@events.each do |i|\r
pdf.SetY(top)\r
pdf.SetX(15)\r
- pdf.Cell(subject_width-15, 5, "#{i.tracker.name} #{i.id}: #{i.subject}".sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)'), "LR")\r
+ \r
+ if i.is_a? Issue\r
+ pdf.Cell(subject_width-15, 5, "#{i.tracker.name} #{i.id}: #{i.subject}".sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)'), "LR")\r
+ else\r
+ pdf.Cell(subject_width-15, 5, "#{l(:label_version)}: #{i.name}", "LR")\r
+ end\r
\r
pdf.SetY(top)\r
pdf.SetX(subject_width)\r
pdf.Cell(g_width, 5, "", "LR")\r
+\r
+ pdf.SetY(top+1.5)\r
\r
- i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from )\r
- i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to )\r
- \r
- i_done_date = i.start_date + ((i.due_date - i.start_date+1)*i.done_ratio/100).floor\r
- i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date )\r
- i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date )\r
+ if i.is_a? Issue\r
+ i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from )\r
+ i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to )\r
+ \r
+ i_done_date = i.start_date + ((i.due_date - i.start_date+1)*i.done_ratio/100).floor\r
+ i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date )\r
+ i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date )\r
+ \r
+ i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today\r
+ \r
+ i_left = ((i_start_date - @date_from)*zoom) \r
+ i_width = ((i_end_date - i_start_date + 1)*zoom)\r
+ d_width = ((i_done_date - i_start_date)*zoom)\r
+ l_width = ((i_late_date - i_start_date+1)*zoom) if i_late_date\r
+ l_width ||= 0\r
\r
- i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today\r
+ pdf.SetX(subject_width + i_left)\r
+ pdf.SetFillColor(200,200,200)\r
+ pdf.Cell(i_width, 2, "", 0, 0, "", 1)\r
\r
- i_left = ((i_start_date - @date_from)*zoom) \r
- i_width = ((i_end_date - i_start_date + 1)*zoom)\r
- d_width = ((i_done_date - i_start_date)*zoom)\r
- l_width = ((i_late_date - i_start_date+1)*zoom) if i_late_date\r
- l_width ||= 0\r
-\r
- pdf.SetY(top+1.5)\r
- pdf.SetX(subject_width + i_left)\r
- pdf.SetFillColor(200,200,200)\r
- pdf.Cell(i_width, 2, "", 0, 0, "", 1)\r
-\r
- if l_width > 0\r
+ if l_width > 0\r
+ pdf.SetY(top+1.5)\r
+ pdf.SetX(subject_width + i_left)\r
+ pdf.SetFillColor(255,100,100)\r
+ pdf.Cell(l_width, 2, "", 0, 0, "", 1)\r
+ end \r
+ if d_width > 0\r
+ pdf.SetY(top+1.5)\r
+ pdf.SetX(subject_width + i_left)\r
+ pdf.SetFillColor(100,100,255)\r
+ pdf.Cell(d_width, 2, "", 0, 0, "", 1)\r
+ end\r
+ \r
pdf.SetY(top+1.5)\r
+ pdf.SetX(subject_width + i_left + i_width)\r
+ pdf.Cell(30, 2, "#{i.status.name} #{i.done_ratio}%")\r
+ else\r
+ i_left = ((i.start_date - @date_from)*zoom) \r
+ \r
pdf.SetX(subject_width + i_left)\r
- pdf.SetFillColor(255,100,100)\r
- pdf.Cell(l_width, 2, "", 0, 0, "", 1)\r
- end \r
- if d_width > 0\r
+ pdf.SetFillColor(50,200,50)\r
+ pdf.Cell(2, 2, "", 0, 0, "", 1) \r
+\r
pdf.SetY(top+1.5)\r
- pdf.SetX(subject_width + i_left)\r
- pdf.SetFillColor(100,100,255)\r
- pdf.Cell(d_width, 2, "", 0, 0, "", 1)\r
+ pdf.SetX(subject_width + i_left + 3)\r
+ pdf.Cell(30, 2, "#{i.name}")\r
end\r
\r
- pdf.SetY(top+1.5)\r
- pdf.SetX(subject_width + i_left + i_width)\r
- pdf.Cell(30, 2, "#{i.status.name} #{i.done_ratio}%")\r
\r
top = top + 5\r
pdf.SetDrawColor(200, 200, 200)\r
end
g_width = (@date_to - @date_from + 1)*zoom
-g_height = [(20 * @issues.length + 6)+150, 206].max
+g_height = [(20 * @events.length + 6)+150, 206].max
t_height = g_height + headers_height
%>
# Tasks subjects
#
top = headers_height + 8
-@issues.each do |i| %>
- <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;">
- <small><%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i }, :title => "#{i.subject}" %>:
- <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small>
- </div>
+@events.each do |i| %>
+ <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small>
+ <% if i.is_a? Issue %>
+ <%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i }, :title => "#{i.subject}" %>:
+ <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %>
+ <% else %>
+ <strong><%= "#{l(:label_version)}: #{i.name}" %></strong>
+ <% end %>
+ </small></div>
<% top = top + 20
end %>
</div>
# Tasks
#
top = headers_height + 10
-@issues.each do |i| %>
- <%
+@events.each do |i|
+ if i.is_a? Issue
i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from )
i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to )
<span class="tip">
<%= render :partial => "issues/tooltip", :locals => { :issue => i }%>
</span></div>
+<% else
+ i_left = ((i.start_date - @date_from)*zoom).floor
+ %>
+ <div style="top:<%= top %>px;left:<%= i_left %>px;width:15px;" class="task milestone"> </div>
+ <div style="top:<%= top %>px;left:<%= i_left + 12 %>px;background:#fff;" class="task">
+ <strong><%= i.name %></strong>
+ </div>
+<% end %>
<% top = top + 20
end %>
</div>