##// END OF EJS Templates
git-svn-id: http://redmine.rubyforge.org/svn/trunk@51 e93f8b46-1217-0410-a6f0-8f06a7374b81
Jean-Philippe Lang -
r49:c83e79487171
parent child
Show More
@@ -40,6 +40,9 class DocumentsController < ApplicationController
40 @attachment = @document.attachments.find(params[:attachment_id])
40 @attachment = @document.attachments.find(params[:attachment_id])
41 @attachment.increment_download
41 @attachment.increment_download
42 send_file @attachment.diskfile, :filename => @attachment.filename
42 send_file @attachment.diskfile, :filename => @attachment.filename
43 rescue
44 flash.now[:notice] = l(:notice_file_not_found)
45 render :text => "", :layout => true, :status => 404
43 end
46 end
44
47
45 def add_attachment
48 def add_attachment
@@ -119,6 +119,9 class IssuesController < ApplicationController
119 def download
119 def download
120 @attachment = @issue.attachments.find(params[:attachment_id])
120 @attachment = @issue.attachments.find(params[:attachment_id])
121 send_file @attachment.diskfile, :filename => @attachment.filename
121 send_file @attachment.diskfile, :filename => @attachment.filename
122 rescue
123 flash.now[:notice] = l(:notice_file_not_found)
124 render :text => "", :layout => true, :status => 404
122 end
125 end
123
126
124 private
127 private
@@ -395,7 +395,7 class ProjectsController < ApplicationController
395 @show_files = 1
395 @show_files = 1
396 end
396 end
397
397
398 unless params[:show_documentss] == "0"
398 unless params[:show_documents] == "0"
399 Attachment.find(:all, :joins => "LEFT JOIN documents ON documents.id = attachments.container_id", :conditions => ["attachments.container_type='Document' and documents.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to] ).each { |i|
399 Attachment.find(:all, :joins => "LEFT JOIN documents ON documents.id = attachments.container_id", :conditions => ["attachments.container_type='Document' and documents.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to] ).each { |i|
400 @events_by_day[i.created_on.to_date] ||= []
400 @events_by_day[i.created_on.to_date] ||= []
401 @events_by_day[i.created_on.to_date] << i
401 @events_by_day[i.created_on.to_date] << i
@@ -60,6 +60,42 class ReportsController < ApplicationController
60 end
60 end
61 end
61 end
62
62
63 def delays
64 @trackers = Tracker.find(:all)
65 if request.get?
66 @selected_tracker_ids = @trackers.collect {|t| t.id.to_s }
67 else
68 @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array
69 end
70 @selected_tracker_ids ||= []
71 @raw =
72 ActiveRecord::Base.connection.select_all("SELECT datediff( a.created_on, b.created_on ) as delay, count(a.id) as total
73 FROM issue_histories a, issue_histories b, issues i
74 WHERE a.status_id =5
75 AND a.issue_id = b.issue_id
76 AND a.issue_id = i.id
77 AND i.tracker_id in (#{@selected_tracker_ids.join(',')})
78 AND b.id = (
79 SELECT min( c.id )
80 FROM issue_histories c
81 WHERE b.issue_id = c.issue_id )
82 GROUP BY delay") unless @selected_tracker_ids.empty?
83 @raw ||=[]
84
85 @x_from = 0
86 @x_to = 0
87 @y_from = 0
88 @y_to = 0
89 @sum_total = 0
90 @sum_delay = 0
91 @raw.each do |r|
92 @x_to = [r['delay'].to_i, @x_to].max
93 @y_to = [r['total'].to_i, @y_to].max
94 @sum_total = @sum_total + r['total'].to_i
95 @sum_delay = @sum_delay + r['total'].to_i * r['delay'].to_i
96 end
97 end
98
63 private
99 private
64 # Find project of id params[:id]
100 # Find project of id params[:id]
65 def find_project
101 def find_project
@@ -39,8 +39,8 class VersionsController < ApplicationController
39 @attachment.increment_download
39 @attachment.increment_download
40 send_file @attachment.diskfile, :filename => @attachment.filename
40 send_file @attachment.diskfile, :filename => @attachment.filename
41 rescue
41 rescue
42 flash[:notice] = l(:notice_file_not_found)
42 flash.now[:notice] = l(:notice_file_not_found)
43 redirect_to :controller => 'projects', :action => 'list_files', :id => @project
43 render :text => "", :layout => true, :status => 404
44 end
44 end
45
45
46 def destroy_file
46 def destroy_file
@@ -20,7 +20,9 require 'iconv'
20 module IfpdfHelper
20 module IfpdfHelper
21
21
22 class IFPDF < FPDF
22 class IFPDF < FPDF
23
23
24 attr_accessor :footer_date
25
24 def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='')
26 def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='')
25 @ic ||= Iconv.new('ISO-8859-1', 'UTF-8')
27 @ic ||= Iconv.new('ISO-8859-1', 'UTF-8')
26 super w,h,@ic.iconv(txt),border,ln,align,fill,link
28 super w,h,@ic.iconv(txt),border,ln,align,fill,link
@@ -32,9 +34,12 module IfpdfHelper
32 end
34 end
33
35
34 def Footer
36 def Footer
37 SetFont('Helvetica', 'I', 8)
38 SetY(-15)
39 SetX(15)
40 Cell(0, 5, @footer_date, 0, 0, 'L')
35 SetY(-15)
41 SetY(-15)
36 SetX(-30)
42 SetX(-30)
37 SetFont('Helvetica', 'I', 8)
38 Cell(0, 5, PageNo().to_s + '/{nb}', 0, 0, 'C')
43 Cell(0, 5, PageNo().to_s + '/{nb}', 0, 0, 'C')
39 end
44 end
40
45
@@ -1,5 +1,6
1 <% pdf=IfpdfHelper::IFPDF.new
1 <% pdf=IfpdfHelper::IFPDF.new
2 pdf.AliasNbPages
2 pdf.AliasNbPages
3 pdf.footer_date = format_date(Date.today)
3 pdf.AddPage
4 pdf.AddPage
4
5
5 render :partial => 'issues/pdf', :locals => { :pdf => pdf, :issue => @issue }
6 render :partial => 'issues/pdf', :locals => { :pdf => pdf, :issue => @issue }
@@ -13,7 +13,7
13 <%= end_form_tag %>
13 <%= end_form_tag %>
14 </div>
14 </div>
15 <% @events_by_day.keys.sort {|x,y| y <=> x }.each do |day| %>
15 <% @events_by_day.keys.sort {|x,y| y <=> x }.each do |day| %>
16 <h3><%= format_date(day) %></h3>
16 <h3><%= day_name(day.cwday) %> <%= format_date(day) %></h3>
17 <ul>
17 <ul>
18 <% @events_by_day[day].sort {|x,y| y.created_on <=> x.created_on }.each do |e| %>
18 <% @events_by_day[day].sort {|x,y| y.created_on <=> x.created_on }.each do |e| %>
19 <li><p>
19 <li><p>
@@ -17,7 +17,8
17 @fixed_issues.each do |issue| %>
17 @fixed_issues.each do |issue| %>
18 <% unless ver_id == issue.fixed_version_id %>
18 <% unless ver_id == issue.fixed_version_id %>
19 <% if ver_id %></ul><% end %>
19 <% if ver_id %></ul><% end %>
20 <p><strong><%= issue.fixed_version.name %></strong> - <%= format_date(issue.fixed_version.effective_date) %><br />
20 <h3><%= l(:label_version) %>: <%= issue.fixed_version.name %></h3>
21 <p><%= format_date(issue.fixed_version.effective_date) %><br />
21 <%=h issue.fixed_version.description %></p>
22 <%=h issue.fixed_version.description %></p>
22 <ul>
23 <ul>
23 <% ver_id = issue.fixed_version_id
24 <% ver_id = issue.fixed_version_id
@@ -1,5 +1,6
1 <% pdf=IfpdfHelper::IFPDF.new
1 <% pdf=IfpdfHelper::IFPDF.new
2 pdf.AliasNbPages
2 pdf.AliasNbPages
3 pdf.footer_date = format_date(Date.today)
3 pdf.AddPage
4 pdf.AddPage
4 @issues.each {|i|
5 @issues.each {|i|
5 render :partial => 'issues/pdf', :locals => { :pdf => pdf, :issue => i }
6 render :partial => 'issues/pdf', :locals => { :pdf => pdf, :issue => i }
@@ -1,7 +1,12
1 <%
1 <%
2 pdf=IfpdfHelper::IFPDF.new
2 pdf=IfpdfHelper::IFPDF.new
3 pdf.AliasNbPages
3 pdf.AliasNbPages
4 pdf.footer_date = format_date(Date.today)
4 pdf.AddPage("L")
5 pdf.AddPage("L")
6 pdf.SetFont('Arial','B',12)
7 pdf.SetX(15)
8 pdf.Cell(70, 20, @project.name)
9 pdf.Ln
5 pdf.SetFont('Arial','B',9)
10 pdf.SetFont('Arial','B',9)
6
11
7 subject_width = 70
12 subject_width = 70
@@ -25,6 +30,8 zoom = (g_width) / (@date_to - @date_from + 1)
25 g_height = 120
30 g_height = 120
26 t_height = g_height + headers_heigth
31 t_height = g_height + headers_heigth
27
32
33 y_start = pdf.GetY
34
28
35
29 #
36 #
30 # Months headers
37 # Months headers
@@ -34,7 +41,7 left = subject_width
34 height = header_heigth
41 height = header_heigth
35 @months.times do
42 @months.times do
36 width = ((month_f >> 1) - month_f) * zoom
43 width = ((month_f >> 1) - month_f) * zoom
37 pdf.SetY(20)
44 pdf.SetY(y_start)
38 pdf.SetX(left)
45 pdf.SetX(left)
39 pdf.Cell(width, height, "#{month_f.year}-#{month_f.month}", "LTR", 0, "C")
46 pdf.Cell(width, height, "#{month_f.year}-#{month_f.month}", "LTR", 0, "C")
40 left = left + width
47 left = left + width
@@ -54,14 +61,14 if show_weeks
54 # find next monday after @date_from
61 # find next monday after @date_from
55 week_f = @date_from + (7 - @date_from.cwday + 1)
62 week_f = @date_from + (7 - @date_from.cwday + 1)
56 width = (7 - @date_from.cwday + 1) * zoom-1
63 width = (7 - @date_from.cwday + 1) * zoom-1
57 pdf.SetY(25)
64 pdf.SetY(y_start + header_heigth)
58 pdf.SetX(left)
65 pdf.SetX(left)
59 pdf.Cell(width + 1, height, "", "LTR")
66 pdf.Cell(width + 1, height, "", "LTR")
60 left = left + width+1
67 left = left + width+1
61 end
68 end
62 while week_f < @date_to
69 while week_f < @date_to
63 width = (week_f + 6 <= @date_to) ? 7 * zoom : (@date_to - week_f + 1) * zoom
70 width = (week_f + 6 <= @date_to) ? 7 * zoom : (@date_to - week_f + 1) * zoom
64 pdf.SetY(25)
71 pdf.SetY(y_start + header_heigth)
65 pdf.SetX(left)
72 pdf.SetX(left)
66 pdf.Cell(width, height, week_f.cweek.to_s, "LTR", 0, "C")
73 pdf.Cell(width, height, week_f.cweek.to_s, "LTR", 0, "C")
67 left = left + width
74 left = left + width
@@ -79,7 +86,7 if show_days
79 pdf.SetFont('Arial','B',7)
86 pdf.SetFont('Arial','B',7)
80 (@date_to - @date_from + 1).to_i.times do
87 (@date_to - @date_from + 1).to_i.times do
81 width = zoom
88 width = zoom
82 pdf.SetY(30)
89 pdf.SetY(y_start + 2 * header_heigth)
83 pdf.SetX(left)
90 pdf.SetX(left)
84 pdf.Cell(width, height, day_name(wday)[0,1], "LTR", 0, "C")
91 pdf.Cell(width, height, day_name(wday)[0,1], "LTR", 0, "C")
85 left = left + width
92 left = left + width
@@ -88,7 +95,7 if show_days
88 end
95 end
89 end
96 end
90
97
91 pdf.SetY(20)
98 pdf.SetY(y_start)
92 pdf.SetX(15)
99 pdf.SetX(15)
93 pdf.Cell(subject_width+g_width-15, headers_heigth, "", 1)
100 pdf.Cell(subject_width+g_width-15, headers_heigth, "", 1)
94
101
@@ -96,7 +103,7 pdf.Cell(subject_width+g_width-15, headers_heigth, "", 1)
96 #
103 #
97 # Tasks
104 # Tasks
98 #
105 #
99 top = headers_heigth + 20
106 top = headers_heigth + y_start
100 pdf.SetFont('Arial','B',7)
107 pdf.SetFont('Arial','B',7)
101 @issues.each do |i|
108 @issues.each do |i|
102 pdf.SetY(top)
109 pdf.SetY(top)
@@ -6,17 +6,17
6 </small>
6 </small>
7 </div>
7 </div>
8
8
9 <form method="post" class="noborder">
9 <%= start_form_tag :action => 'list_issues' %>
10 <table cellpadding=2>
10 <table cellpadding=2>
11 <tr>
11 <tr>
12 <td><small><%=l(:field_status)%>:</small><br /><%= search_filter_tag 'status_id', :class => 'select-small' %></td>
12 <td valign="bottom"><small><%=l(:field_status)%>:</small><br /><%= search_filter_tag 'status_id', :class => 'select-small' %></td>
13 <td><small><%=l(:field_tracker)%>:</small><br /><%= search_filter_tag 'tracker_id', :class => 'select-small' %></td>
13 <td valign="bottom"><small><%=l(:field_tracker)%>:</small><br /><%= search_filter_tag 'tracker_id', :class => 'select-small' %></td>
14 <td><small><%=l(:field_priority)%>:</small><br /><%= search_filter_tag 'priority_id', :class => 'select-small' %></td>
14 <td valign="bottom"><small><%=l(:field_priority)%>:</small><br /><%= search_filter_tag 'priority_id', :class => 'select-small' %></td>
15 <td><small><%=l(:field_category)%>:</small><br /><%= search_filter_tag 'category_id', :class => 'select-small' %></td>
15 <td valign="bottom"><small><%=l(:field_category)%>:</small><br /><%= search_filter_tag 'category_id', :class => 'select-small' %></td>
16 <td><small><%=l(:field_fixed_version)%>:</small><br /><%= search_filter_tag 'fixed_version_id', :class => 'select-small' %></td>
16 <td valign="bottom"><small><%=l(:field_fixed_version)%>:</small><br /><%= search_filter_tag 'fixed_version_id', :class => 'select-small' %></td>
17 <td><small><%=l(:field_author)%>:</small><br /><%= search_filter_tag 'author_id', :class => 'select-small' %></td>
17 <td valign="bottom"><small><%=l(:field_author)%>:</small><br /><%= search_filter_tag 'author_id', :class => 'select-small' %></td>
18 <td><small><%=l(:field_assigned_to)%>:</small><br /><%= search_filter_tag 'assigned_to_id', :class => 'select-small' %></td>
18 <td valign="bottom"><small><%=l(:field_assigned_to)%>:</small><br /><%= search_filter_tag 'assigned_to_id', :class => 'select-small' %></td>
19 <td><small><%=l(:label_subproject_plural)%>:</small><br /><%= search_filter_tag 'subproject_id', :class => 'select-small' %></td>
19 <td valign="bottom"><small><%=l(:label_subproject_plural)%>:</small><br /><%= search_filter_tag 'subproject_id', :class => 'select-small' %></td>
20 <td valign="bottom">
20 <td valign="bottom">
21 <%= hidden_field_tag 'set_filter', 1 %>
21 <%= hidden_field_tag 'set_filter', 1 %>
22 <%= submit_tag l(:button_apply), :class => 'button-small' %>
22 <%= submit_tag l(:button_apply), :class => 'button-small' %>
@@ -1,6 +1,6
1 <h2><%=l(:label_report_plural)%></h2>
1 <h2><%=l(:label_report_plural)%></h2>
2
2
3 <strong><%=@report_title%></strong>
3 <h3><%=@report_title%></h3>
4 <%= render :partial => 'details', :locals => { :data => @data, :field_name => @field, :rows => @rows } %>
4 <%= render :partial => 'details', :locals => { :data => @data, :field_name => @field, :rows => @rows } %>
5 <br />
5 <br />
6 <%= link_to l(:button_back), :action => 'issue_report' %>
6 <%= link_to l(:button_back), :action => 'issue_report' %>
@@ -7,7 +7,7
7 <% for news in @news %>
7 <% for news in @news %>
8 <p>
8 <p>
9 <b><%= news.title %></b> (<%= link_to_user news.author %> <%= format_time(news.created_on) %> - <%= news.project.name %>)<br />
9 <b><%= news.title %></b> (<%= link_to_user news.author %> <%= format_time(news.created_on) %> - <%= news.project.name %>)<br />
10 <%= news.summary %><br />
10 <% unless news.summary.empty? %><%= news.summary %><br /><% end %>
11 [<%= link_to l(:label_read), :controller => 'news', :action => 'show', :id => news %>]
11 [<%= link_to l(:label_read), :controller => 'news', :action => 'show', :id => news %>]
12 </p>
12 </p>
13 <hr />
13 <hr />
General Comments 0
You need to be logged in to leave comments. Login now