@attachment = @document.attachments.find(params[:attachment_id])\r
@attachment.increment_download\r
send_file @attachment.diskfile, :filename => @attachment.filename\r
+ rescue\r
+ flash.now[:notice] = l(:notice_file_not_found)\r
+ render :text => "", :layout => true, :status => 404\r
end \r
\r
def add_attachment\r
def download\r
@attachment = @issue.attachments.find(params[:attachment_id])\r
send_file @attachment.diskfile, :filename => @attachment.filename\r
+ rescue\r
+ flash.now[:notice] = l(:notice_file_not_found)\r
+ render :text => "", :layout => true, :status => 404\r
end\r
\r
private\r
@show_files = 1 \r
end\r
\r
- unless params[:show_documentss] == "0"\r
+ unless params[:show_documents] == "0"\r
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|\r
@events_by_day[i.created_on.to_date] ||= []\r
@events_by_day[i.created_on.to_date] << i\r
end\r
end \r
\r
+ def delays\r
+ @trackers = Tracker.find(:all)\r
+ if request.get?\r
+ @selected_tracker_ids = @trackers.collect {|t| t.id.to_s }\r
+ else\r
+ @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array\r
+ end\r
+ @selected_tracker_ids ||= [] \r
+ @raw = \r
+ ActiveRecord::Base.connection.select_all("SELECT datediff( a.created_on, b.created_on ) as delay, count(a.id) as total\r
+ FROM issue_histories a, issue_histories b, issues i\r
+ WHERE a.status_id =5\r
+ AND a.issue_id = b.issue_id\r
+ AND a.issue_id = i.id\r
+ AND i.tracker_id in (#{@selected_tracker_ids.join(',')})\r
+ AND b.id = (\r
+ SELECT min( c.id )\r
+ FROM issue_histories c\r
+ WHERE b.issue_id = c.issue_id ) \r
+ GROUP BY delay") unless @selected_tracker_ids.empty? \r
+ @raw ||=[]\r
+ \r
+ @x_from = 0\r
+ @x_to = 0\r
+ @y_from = 0\r
+ @y_to = 0\r
+ @sum_total = 0\r
+ @sum_delay = 0\r
+ @raw.each do |r|\r
+ @x_to = [r['delay'].to_i, @x_to].max\r
+ @y_to = [r['total'].to_i, @y_to].max\r
+ @sum_total = @sum_total + r['total'].to_i\r
+ @sum_delay = @sum_delay + r['total'].to_i * r['delay'].to_i\r
+ end \r
+ end\r
+ \r
private\r
# Find project of id params[:id]\r
def find_project\r
@attachment.increment_download\r
send_file @attachment.diskfile, :filename => @attachment.filename\r
rescue\r
- flash[:notice] = l(:notice_file_not_found)\r
- redirect_to :controller => 'projects', :action => 'list_files', :id => @project\r
+ flash.now[:notice] = l(:notice_file_not_found)\r
+ render :text => "", :layout => true, :status => 404\r
end \r
\r
def destroy_file\r
module IfpdfHelper\r
\r
class IFPDF < FPDF\r
- \r
+\r
+ attr_accessor :footer_date\r
+ \r
def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='')\r
@ic ||= Iconv.new('ISO-8859-1', 'UTF-8')\r
super w,h,@ic.iconv(txt),border,ln,align,fill,link\r
end\r
\r
def Footer\r
+ SetFont('Helvetica', 'I', 8)\r
+ SetY(-15)\r
+ SetX(15)\r
+ Cell(0, 5, @footer_date, 0, 0, 'L')\r
SetY(-15)\r
SetX(-30)\r
- SetFont('Helvetica', 'I', 8)\r
Cell(0, 5, PageNo().to_s + '/{nb}', 0, 0, 'C')\r
end\r
\r
<% pdf=IfpdfHelper::IFPDF.new\r
pdf.AliasNbPages\r
+ pdf.footer_date = format_date(Date.today)\r
pdf.AddPage\r
\r
render :partial => 'issues/pdf', :locals => { :pdf => pdf, :issue => @issue }\r
<%= end_form_tag %>\r
</div>\r
<% @events_by_day.keys.sort {|x,y| y <=> x }.each do |day| %>\r
- <h3><%= format_date(day) %></h3>\r
+ <h3><%= day_name(day.cwday) %> <%= format_date(day) %></h3>\r
<ul>\r
<% @events_by_day[day].sort {|x,y| y.created_on <=> x.created_on }.each do |e| %>\r
<li><p>\r
@fixed_issues.each do |issue| %> \r
<% unless ver_id == issue.fixed_version_id %>\r
<% if ver_id %></ul><% end %>\r
- <p><strong><%= issue.fixed_version.name %></strong> - <%= format_date(issue.fixed_version.effective_date) %><br />\r
+ <h3><%= l(:label_version) %>: <%= issue.fixed_version.name %></h3>\r
+ <p><%= format_date(issue.fixed_version.effective_date) %><br />\r
<%=h issue.fixed_version.description %></p>\r
<ul>\r
<% ver_id = issue.fixed_version_id\r
<% pdf=IfpdfHelper::IFPDF.new\r
pdf.AliasNbPages\r
+ pdf.footer_date = format_date(Date.today)\r
pdf.AddPage\r
@issues.each {|i| \r
render :partial => 'issues/pdf', :locals => { :pdf => pdf, :issue => i }\r
<%\r
pdf=IfpdfHelper::IFPDF.new\r
pdf.AliasNbPages\r
+pdf.footer_date = format_date(Date.today)\r
pdf.AddPage("L")\r
+pdf.SetFont('Arial','B',12)\r
+pdf.SetX(15)\r
+pdf.Cell(70, 20, @project.name)\r
+pdf.Ln\r
pdf.SetFont('Arial','B',9)\r
\r
subject_width = 70\r
g_height = 120\r
t_height = g_height + headers_heigth\r
\r
+y_start = pdf.GetY\r
+\r
\r
#\r
# Months headers\r
height = header_heigth\r
@months.times do \r
width = ((month_f >> 1) - month_f) * zoom \r
- pdf.SetY(20)\r
+ pdf.SetY(y_start)\r
pdf.SetX(left)\r
pdf.Cell(width, height, "#{month_f.year}-#{month_f.month}", "LTR", 0, "C")\r
left = left + width\r
# find next monday after @date_from\r
week_f = @date_from + (7 - @date_from.cwday + 1)\r
width = (7 - @date_from.cwday + 1) * zoom-1\r
- pdf.SetY(25)\r
+ pdf.SetY(y_start + header_heigth)\r
pdf.SetX(left)\r
pdf.Cell(width + 1, height, "", "LTR")\r
left = left + width+1\r
end\r
while week_f < @date_to\r
width = (week_f + 6 <= @date_to) ? 7 * zoom : (@date_to - week_f + 1) * zoom\r
- pdf.SetY(25)\r
+ pdf.SetY(y_start + header_heigth)\r
pdf.SetX(left)\r
pdf.Cell(width, height, week_f.cweek.to_s, "LTR", 0, "C")\r
left = left + width\r
pdf.SetFont('Arial','B',7)\r
(@date_to - @date_from + 1).to_i.times do \r
width = zoom\r
- pdf.SetY(30)\r
+ pdf.SetY(y_start + 2 * header_heigth)\r
pdf.SetX(left)\r
pdf.Cell(width, height, day_name(wday)[0,1], "LTR", 0, "C")\r
left = left + width\r
end\r
end\r
\r
-pdf.SetY(20)\r
+pdf.SetY(y_start)\r
pdf.SetX(15)\r
pdf.Cell(subject_width+g_width-15, headers_heigth, "", 1)\r
\r
#\r
# Tasks\r
#\r
-top = headers_heigth + 20\r
+top = headers_heigth + y_start\r
pdf.SetFont('Arial','B',7)\r
@issues.each do |i|\r
pdf.SetY(top)\r
</small>\r
</div>\r
\r
-<form method="post" class="noborder">\r
+<%= start_form_tag :action => 'list_issues' %>\r
<table cellpadding=2>\r
<tr>\r
- <td><small><%=l(:field_status)%>:</small><br /><%= search_filter_tag 'status_id', :class => 'select-small' %></td>\r
- <td><small><%=l(:field_tracker)%>:</small><br /><%= search_filter_tag 'tracker_id', :class => 'select-small' %></td>\r
- <td><small><%=l(:field_priority)%>:</small><br /><%= search_filter_tag 'priority_id', :class => 'select-small' %></td>\r
- <td><small><%=l(:field_category)%>:</small><br /><%= search_filter_tag 'category_id', :class => 'select-small' %></td>\r
- <td><small><%=l(:field_fixed_version)%>:</small><br /><%= search_filter_tag 'fixed_version_id', :class => 'select-small' %></td>\r
- <td><small><%=l(:field_author)%>:</small><br /><%= search_filter_tag 'author_id', :class => 'select-small' %></td>\r
- <td><small><%=l(:field_assigned_to)%>:</small><br /><%= search_filter_tag 'assigned_to_id', :class => 'select-small' %></td>\r
- <td><small><%=l(:label_subproject_plural)%>:</small><br /><%= search_filter_tag 'subproject_id', :class => 'select-small' %></td>\r
+ <td valign="bottom"><small><%=l(:field_status)%>:</small><br /><%= search_filter_tag 'status_id', :class => 'select-small' %></td>\r
+ <td valign="bottom"><small><%=l(:field_tracker)%>:</small><br /><%= search_filter_tag 'tracker_id', :class => 'select-small' %></td>\r
+ <td valign="bottom"><small><%=l(:field_priority)%>:</small><br /><%= search_filter_tag 'priority_id', :class => 'select-small' %></td>\r
+ <td valign="bottom"><small><%=l(:field_category)%>:</small><br /><%= search_filter_tag 'category_id', :class => 'select-small' %></td>\r
+ <td valign="bottom"><small><%=l(:field_fixed_version)%>:</small><br /><%= search_filter_tag 'fixed_version_id', :class => 'select-small' %></td>\r
+ <td valign="bottom"><small><%=l(:field_author)%>:</small><br /><%= search_filter_tag 'author_id', :class => 'select-small' %></td>\r
+ <td valign="bottom"><small><%=l(:field_assigned_to)%>:</small><br /><%= search_filter_tag 'assigned_to_id', :class => 'select-small' %></td>\r
+ <td valign="bottom"><small><%=l(:label_subproject_plural)%>:</small><br /><%= search_filter_tag 'subproject_id', :class => 'select-small' %></td>\r
<td valign="bottom">\r
<%= hidden_field_tag 'set_filter', 1 %>\r
<%= submit_tag l(:button_apply), :class => 'button-small' %>\r
<h2><%=l(:label_report_plural)%></h2>\r
\r
-<strong><%=@report_title%></strong>\r
+<h3><%=@report_title%></h3>\r
<%= render :partial => 'details', :locals => { :data => @data, :field_name => @field, :rows => @rows } %>\r
<br />\r
<%= link_to l(:button_back), :action => 'issue_report' %>\r
<% for news in @news %>\r
<p>\r
<b><%= news.title %></b> (<%= link_to_user news.author %> <%= format_time(news.created_on) %> - <%= news.project.name %>)<br />\r
- <%= news.summary %><br />\r
+ <% unless news.summary.empty? %><%= news.summary %><br /><% end %>\r
[<%= link_to l(:label_read), :controller => 'news', :action => 'show', :id => news %>]\r
</p>\r
<hr />\r