@@ -40,6 +40,9 class DocumentsController < ApplicationController | |||
|
40 | 40 | @attachment = @document.attachments.find(params[:attachment_id]) |
|
41 | 41 | @attachment.increment_download |
|
42 | 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 | 46 | end |
|
44 | 47 | |
|
45 | 48 | def add_attachment |
@@ -119,6 +119,9 class IssuesController < ApplicationController | |||
|
119 | 119 | def download |
|
120 | 120 | @attachment = @issue.attachments.find(params[:attachment_id]) |
|
121 | 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 | 125 | end |
|
123 | 126 | |
|
124 | 127 | private |
@@ -395,7 +395,7 class ProjectsController < ApplicationController | |||
|
395 | 395 | @show_files = 1 |
|
396 | 396 | end |
|
397 | 397 | |
|
398 |
unless params[:show_documents |
|
|
398 | unless params[:show_documents] == "0" | |
|
399 | 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 | 400 | @events_by_day[i.created_on.to_date] ||= [] |
|
401 | 401 | @events_by_day[i.created_on.to_date] << i |
@@ -60,6 +60,42 class ReportsController < ApplicationController | |||
|
60 | 60 | end |
|
61 | 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 | 99 | private |
|
64 | 100 | # Find project of id params[:id] |
|
65 | 101 | def find_project |
@@ -39,8 +39,8 class VersionsController < ApplicationController | |||
|
39 | 39 | @attachment.increment_download |
|
40 | 40 | send_file @attachment.diskfile, :filename => @attachment.filename |
|
41 | 41 | rescue |
|
42 | flash[:notice] = l(:notice_file_not_found) | |
|
43 | redirect_to :controller => 'projects', :action => 'list_files', :id => @project | |
|
42 | flash.now[:notice] = l(:notice_file_not_found) | |
|
43 | render :text => "", :layout => true, :status => 404 | |
|
44 | 44 | end |
|
45 | 45 | |
|
46 | 46 | def destroy_file |
@@ -20,7 +20,9 require 'iconv' | |||
|
20 | 20 | module IfpdfHelper |
|
21 | 21 | |
|
22 | 22 | class IFPDF < FPDF |
|
23 | ||
|
23 | ||
|
24 | attr_accessor :footer_date | |
|
25 | ||
|
24 | 26 | def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='') |
|
25 | 27 | @ic ||= Iconv.new('ISO-8859-1', 'UTF-8') |
|
26 | 28 | super w,h,@ic.iconv(txt),border,ln,align,fill,link |
@@ -32,9 +34,12 module IfpdfHelper | |||
|
32 | 34 | end |
|
33 | 35 | |
|
34 | 36 | def Footer |
|
37 | SetFont('Helvetica', 'I', 8) | |
|
38 | SetY(-15) | |
|
39 | SetX(15) | |
|
40 | Cell(0, 5, @footer_date, 0, 0, 'L') | |
|
35 | 41 | SetY(-15) |
|
36 | 42 | SetX(-30) |
|
37 | SetFont('Helvetica', 'I', 8) | |
|
38 | 43 | Cell(0, 5, PageNo().to_s + '/{nb}', 0, 0, 'C') |
|
39 | 44 | end |
|
40 | 45 |
@@ -1,5 +1,6 | |||
|
1 | 1 | <% pdf=IfpdfHelper::IFPDF.new |
|
2 | 2 | pdf.AliasNbPages |
|
3 | pdf.footer_date = format_date(Date.today) | |
|
3 | 4 | pdf.AddPage |
|
4 | 5 | |
|
5 | 6 | render :partial => 'issues/pdf', :locals => { :pdf => pdf, :issue => @issue } |
@@ -13,7 +13,7 | |||
|
13 | 13 | <%= end_form_tag %> |
|
14 | 14 | </div> |
|
15 | 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 | 17 | <ul> |
|
18 | 18 | <% @events_by_day[day].sort {|x,y| y.created_on <=> x.created_on }.each do |e| %> |
|
19 | 19 | <li><p> |
@@ -17,7 +17,8 | |||
|
17 | 17 | @fixed_issues.each do |issue| %> |
|
18 | 18 | <% unless ver_id == issue.fixed_version_id %> |
|
19 | 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 | 22 | <%=h issue.fixed_version.description %></p> |
|
22 | 23 | <ul> |
|
23 | 24 | <% ver_id = issue.fixed_version_id |
@@ -1,5 +1,6 | |||
|
1 | 1 | <% pdf=IfpdfHelper::IFPDF.new |
|
2 | 2 | pdf.AliasNbPages |
|
3 | pdf.footer_date = format_date(Date.today) | |
|
3 | 4 | pdf.AddPage |
|
4 | 5 | @issues.each {|i| |
|
5 | 6 | render :partial => 'issues/pdf', :locals => { :pdf => pdf, :issue => i } |
@@ -1,7 +1,12 | |||
|
1 | 1 | <% |
|
2 | 2 | pdf=IfpdfHelper::IFPDF.new |
|
3 | 3 | pdf.AliasNbPages |
|
4 | pdf.footer_date = format_date(Date.today) | |
|
4 | 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 | 10 | pdf.SetFont('Arial','B',9) |
|
6 | 11 | |
|
7 | 12 | subject_width = 70 |
@@ -25,6 +30,8 zoom = (g_width) / (@date_to - @date_from + 1) | |||
|
25 | 30 | g_height = 120 |
|
26 | 31 | t_height = g_height + headers_heigth |
|
27 | 32 | |
|
33 | y_start = pdf.GetY | |
|
34 | ||
|
28 | 35 | |
|
29 | 36 | # |
|
30 | 37 | # Months headers |
@@ -34,7 +41,7 left = subject_width | |||
|
34 | 41 | height = header_heigth |
|
35 | 42 | @months.times do |
|
36 | 43 | width = ((month_f >> 1) - month_f) * zoom |
|
37 |
pdf.SetY( |
|
|
44 | pdf.SetY(y_start) | |
|
38 | 45 | pdf.SetX(left) |
|
39 | 46 | pdf.Cell(width, height, "#{month_f.year}-#{month_f.month}", "LTR", 0, "C") |
|
40 | 47 | left = left + width |
@@ -54,14 +61,14 if show_weeks | |||
|
54 | 61 | # find next monday after @date_from |
|
55 | 62 | week_f = @date_from + (7 - @date_from.cwday + 1) |
|
56 | 63 | width = (7 - @date_from.cwday + 1) * zoom-1 |
|
57 | pdf.SetY(25) | |
|
64 | pdf.SetY(y_start + header_heigth) | |
|
58 | 65 | pdf.SetX(left) |
|
59 | 66 | pdf.Cell(width + 1, height, "", "LTR") |
|
60 | 67 | left = left + width+1 |
|
61 | 68 | end |
|
62 | 69 | while week_f < @date_to |
|
63 | 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 | 72 | pdf.SetX(left) |
|
66 | 73 | pdf.Cell(width, height, week_f.cweek.to_s, "LTR", 0, "C") |
|
67 | 74 | left = left + width |
@@ -79,7 +86,7 if show_days | |||
|
79 | 86 | pdf.SetFont('Arial','B',7) |
|
80 | 87 | (@date_to - @date_from + 1).to_i.times do |
|
81 | 88 | width = zoom |
|
82 | pdf.SetY(30) | |
|
89 | pdf.SetY(y_start + 2 * header_heigth) | |
|
83 | 90 | pdf.SetX(left) |
|
84 | 91 | pdf.Cell(width, height, day_name(wday)[0,1], "LTR", 0, "C") |
|
85 | 92 | left = left + width |
@@ -88,7 +95,7 if show_days | |||
|
88 | 95 | end |
|
89 | 96 | end |
|
90 | 97 | |
|
91 |
pdf.SetY( |
|
|
98 | pdf.SetY(y_start) | |
|
92 | 99 | pdf.SetX(15) |
|
93 | 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 | 104 | # Tasks |
|
98 | 105 | # |
|
99 |
top = headers_heigth + |
|
|
106 | top = headers_heigth + y_start | |
|
100 | 107 | pdf.SetFont('Arial','B',7) |
|
101 | 108 | @issues.each do |i| |
|
102 | 109 | pdf.SetY(top) |
@@ -6,17 +6,17 | |||
|
6 | 6 | </small> |
|
7 | 7 | </div> |
|
8 | 8 | |
|
9 | <form method="post" class="noborder"> | |
|
9 | <%= start_form_tag :action => 'list_issues' %> | |
|
10 | 10 | <table cellpadding=2> |
|
11 | 11 | <tr> |
|
12 | <td><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> | |
|
14 | <td><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> | |
|
16 | <td><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> | |
|
18 | <td><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> | |
|
12 | <td valign="bottom"><small><%=l(:field_status)%>:</small><br /><%= search_filter_tag 'status_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 valign="bottom"><small><%=l(:field_priority)%>:</small><br /><%= search_filter_tag 'priority_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 valign="bottom"><small><%=l(:field_fixed_version)%>:</small><br /><%= search_filter_tag 'fixed_version_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 valign="bottom"><small><%=l(:field_assigned_to)%>:</small><br /><%= search_filter_tag 'assigned_to_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 | 20 | <td valign="bottom"> |
|
21 | 21 | <%= hidden_field_tag 'set_filter', 1 %> |
|
22 | 22 | <%= submit_tag l(:button_apply), :class => 'button-small' %> |
@@ -1,6 +1,6 | |||
|
1 | 1 | <h2><%=l(:label_report_plural)%></h2> |
|
2 | 2 | |
|
3 |
< |
|
|
3 | <h3><%=@report_title%></h3> | |
|
4 | 4 | <%= render :partial => 'details', :locals => { :data => @data, :field_name => @field, :rows => @rows } %> |
|
5 | 5 | <br /> |
|
6 | 6 | <%= link_to l(:button_back), :action => 'issue_report' %> |
@@ -7,7 +7,7 | |||
|
7 | 7 | <% for news in @news %> |
|
8 | 8 | <p> |
|
9 | 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 | 11 | [<%= link_to l(:label_read), :controller => 'news', :action => 'show', :id => news %>] |
|
12 | 12 | </p> |
|
13 | 13 | <hr /> |
General Comments 0
You need to be logged in to leave comments.
Login now