git-svn-id: http://redmine.rubyforge.org/svn/trunk@51 e93f8b46-1217-0410-a6f0-8f06a7374b81

This commit is contained in:
Jean-Philippe Lang 2006-11-21 22:27:47 +00:00
parent 26ec775854
commit c83e794871
14 changed files with 81 additions and 24 deletions

View File

@ -40,6 +40,9 @@ class DocumentsController < ApplicationController
@attachment = @document.attachments.find(params[:attachment_id])
@attachment.increment_download
send_file @attachment.diskfile, :filename => @attachment.filename
rescue
flash.now[:notice] = l(:notice_file_not_found)
render :text => "", :layout => true, :status => 404
end
def add_attachment

View File

@ -119,6 +119,9 @@ class IssuesController < ApplicationController
def download
@attachment = @issue.attachments.find(params[:attachment_id])
send_file @attachment.diskfile, :filename => @attachment.filename
rescue
flash.now[:notice] = l(:notice_file_not_found)
render :text => "", :layout => true, :status => 404
end
private

View File

@ -395,7 +395,7 @@ class ProjectsController < ApplicationController
@show_files = 1
end
unless params[:show_documentss] == "0"
unless params[:show_documents] == "0"
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|
@events_by_day[i.created_on.to_date] ||= []
@events_by_day[i.created_on.to_date] << i

View File

@ -60,6 +60,42 @@ class ReportsController < ApplicationController
end
end
def delays
@trackers = Tracker.find(:all)
if request.get?
@selected_tracker_ids = @trackers.collect {|t| t.id.to_s }
else
@selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array
end
@selected_tracker_ids ||= []
@raw =
ActiveRecord::Base.connection.select_all("SELECT datediff( a.created_on, b.created_on ) as delay, count(a.id) as total
FROM issue_histories a, issue_histories b, issues i
WHERE a.status_id =5
AND a.issue_id = b.issue_id
AND a.issue_id = i.id
AND i.tracker_id in (#{@selected_tracker_ids.join(',')})
AND b.id = (
SELECT min( c.id )
FROM issue_histories c
WHERE b.issue_id = c.issue_id )
GROUP BY delay") unless @selected_tracker_ids.empty?
@raw ||=[]
@x_from = 0
@x_to = 0
@y_from = 0
@y_to = 0
@sum_total = 0
@sum_delay = 0
@raw.each do |r|
@x_to = [r['delay'].to_i, @x_to].max
@y_to = [r['total'].to_i, @y_to].max
@sum_total = @sum_total + r['total'].to_i
@sum_delay = @sum_delay + r['total'].to_i * r['delay'].to_i
end
end
private
# Find project of id params[:id]
def find_project

View File

@ -39,8 +39,8 @@ class VersionsController < ApplicationController
@attachment.increment_download
send_file @attachment.diskfile, :filename => @attachment.filename
rescue
flash[:notice] = l(:notice_file_not_found)
redirect_to :controller => 'projects', :action => 'list_files', :id => @project
flash.now[:notice] = l(:notice_file_not_found)
render :text => "", :layout => true, :status => 404
end
def destroy_file

View File

@ -20,7 +20,9 @@ require 'iconv'
module IfpdfHelper
class IFPDF < FPDF
attr_accessor :footer_date
def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='')
@ic ||= Iconv.new('ISO-8859-1', 'UTF-8')
super w,h,@ic.iconv(txt),border,ln,align,fill,link
@ -32,9 +34,12 @@ module IfpdfHelper
end
def Footer
SetFont('Helvetica', 'I', 8)
SetY(-15)
SetX(15)
Cell(0, 5, @footer_date, 0, 0, 'L')
SetY(-15)
SetX(-30)
SetFont('Helvetica', 'I', 8)
Cell(0, 5, PageNo().to_s + '/{nb}', 0, 0, 'C')
end

View File

@ -1,5 +1,6 @@
<% pdf=IfpdfHelper::IFPDF.new
pdf.AliasNbPages
pdf.footer_date = format_date(Date.today)
pdf.AddPage
render :partial => 'issues/pdf', :locals => { :pdf => pdf, :issue => @issue }

View File

@ -13,7 +13,7 @@
<%= end_form_tag %>
</div>
<% @events_by_day.keys.sort {|x,y| y <=> x }.each do |day| %>
<h3><%= format_date(day) %></h3>
<h3><%= day_name(day.cwday) %> <%= format_date(day) %></h3>
<ul>
<% @events_by_day[day].sort {|x,y| y.created_on <=> x.created_on }.each do |e| %>
<li><p>

View File

@ -17,7 +17,8 @@
@fixed_issues.each do |issue| %>
<% unless ver_id == issue.fixed_version_id %>
<% if ver_id %></ul><% end %>
<p><strong><%= issue.fixed_version.name %></strong> - <%= format_date(issue.fixed_version.effective_date) %><br />
<h3><%= l(:label_version) %>: <%= issue.fixed_version.name %></h3>
<p><%= format_date(issue.fixed_version.effective_date) %><br />
<%=h issue.fixed_version.description %></p>
<ul>
<% ver_id = issue.fixed_version_id

View File

@ -1,5 +1,6 @@
<% pdf=IfpdfHelper::IFPDF.new
pdf.AliasNbPages
pdf.footer_date = format_date(Date.today)
pdf.AddPage
@issues.each {|i|
render :partial => 'issues/pdf', :locals => { :pdf => pdf, :issue => i }

View File

@ -1,7 +1,12 @@
<%
pdf=IfpdfHelper::IFPDF.new
pdf.AliasNbPages
pdf.footer_date = format_date(Date.today)
pdf.AddPage("L")
pdf.SetFont('Arial','B',12)
pdf.SetX(15)
pdf.Cell(70, 20, @project.name)
pdf.Ln
pdf.SetFont('Arial','B',9)
subject_width = 70
@ -25,6 +30,8 @@ zoom = (g_width) / (@date_to - @date_from + 1)
g_height = 120
t_height = g_height + headers_heigth
y_start = pdf.GetY
#
# Months headers
@ -34,7 +41,7 @@ left = subject_width
height = header_heigth
@months.times do
width = ((month_f >> 1) - month_f) * zoom
pdf.SetY(20)
pdf.SetY(y_start)
pdf.SetX(left)
pdf.Cell(width, height, "#{month_f.year}-#{month_f.month}", "LTR", 0, "C")
left = left + width
@ -54,14 +61,14 @@ if show_weeks
# find next monday after @date_from
week_f = @date_from + (7 - @date_from.cwday + 1)
width = (7 - @date_from.cwday + 1) * zoom-1
pdf.SetY(25)
pdf.SetY(y_start + header_heigth)
pdf.SetX(left)
pdf.Cell(width + 1, height, "", "LTR")
left = left + width+1
end
while week_f < @date_to
width = (week_f + 6 <= @date_to) ? 7 * zoom : (@date_to - week_f + 1) * zoom
pdf.SetY(25)
pdf.SetY(y_start + header_heigth)
pdf.SetX(left)
pdf.Cell(width, height, week_f.cweek.to_s, "LTR", 0, "C")
left = left + width
@ -79,7 +86,7 @@ if show_days
pdf.SetFont('Arial','B',7)
(@date_to - @date_from + 1).to_i.times do
width = zoom
pdf.SetY(30)
pdf.SetY(y_start + 2 * header_heigth)
pdf.SetX(left)
pdf.Cell(width, height, day_name(wday)[0,1], "LTR", 0, "C")
left = left + width
@ -88,7 +95,7 @@ if show_days
end
end
pdf.SetY(20)
pdf.SetY(y_start)
pdf.SetX(15)
pdf.Cell(subject_width+g_width-15, headers_heigth, "", 1)
@ -96,7 +103,7 @@ pdf.Cell(subject_width+g_width-15, headers_heigth, "", 1)
#
# Tasks
#
top = headers_heigth + 20
top = headers_heigth + y_start
pdf.SetFont('Arial','B',7)
@issues.each do |i|
pdf.SetY(top)

View File

@ -6,17 +6,17 @@
</small>
</div>
<form method="post" class="noborder">
<%= start_form_tag :action => 'list_issues' %>
<table cellpadding=2>
<tr>
<td><small><%=l(:field_status)%>:</small><br /><%= search_filter_tag 'status_id', :class => 'select-small' %></td>
<td><small><%=l(:field_tracker)%>:</small><br /><%= search_filter_tag 'tracker_id', :class => 'select-small' %></td>
<td><small><%=l(:field_priority)%>:</small><br /><%= search_filter_tag 'priority_id', :class => 'select-small' %></td>
<td><small><%=l(:field_category)%>:</small><br /><%= search_filter_tag 'category_id', :class => 'select-small' %></td>
<td><small><%=l(:field_fixed_version)%>:</small><br /><%= search_filter_tag 'fixed_version_id', :class => 'select-small' %></td>
<td><small><%=l(:field_author)%>:</small><br /><%= search_filter_tag 'author_id', :class => 'select-small' %></td>
<td><small><%=l(:field_assigned_to)%>:</small><br /><%= search_filter_tag 'assigned_to_id', :class => 'select-small' %></td>
<td><small><%=l(:label_subproject_plural)%>:</small><br /><%= search_filter_tag 'subproject_id', :class => 'select-small' %></td>
<td valign="bottom"><small><%=l(:field_status)%>:</small><br /><%= search_filter_tag 'status_id', :class => 'select-small' %></td>
<td valign="bottom"><small><%=l(:field_tracker)%>:</small><br /><%= search_filter_tag 'tracker_id', :class => 'select-small' %></td>
<td valign="bottom"><small><%=l(:field_priority)%>:</small><br /><%= search_filter_tag 'priority_id', :class => 'select-small' %></td>
<td valign="bottom"><small><%=l(:field_category)%>:</small><br /><%= search_filter_tag 'category_id', :class => 'select-small' %></td>
<td valign="bottom"><small><%=l(:field_fixed_version)%>:</small><br /><%= search_filter_tag 'fixed_version_id', :class => 'select-small' %></td>
<td valign="bottom"><small><%=l(:field_author)%>:</small><br /><%= search_filter_tag 'author_id', :class => 'select-small' %></td>
<td valign="bottom"><small><%=l(:field_assigned_to)%>:</small><br /><%= search_filter_tag 'assigned_to_id', :class => 'select-small' %></td>
<td valign="bottom"><small><%=l(:label_subproject_plural)%>:</small><br /><%= search_filter_tag 'subproject_id', :class => 'select-small' %></td>
<td valign="bottom">
<%= hidden_field_tag 'set_filter', 1 %>
<%= submit_tag l(:button_apply), :class => 'button-small' %>

View File

@ -1,6 +1,6 @@
<h2><%=l(:label_report_plural)%></h2>
<strong><%=@report_title%></strong>
<h3><%=@report_title%></h3>
<%= render :partial => 'details', :locals => { :data => @data, :field_name => @field, :rows => @rows } %>
<br />
<%= link_to l(:button_back), :action => 'issue_report' %>

View File

@ -7,7 +7,7 @@
<% for news in @news %>
<p>
<b><%= news.title %></b> (<%= link_to_user news.author %> <%= format_time(news.created_on) %> - <%= news.project.name %>)<br />
<%= news.summary %><br />
<% unless news.summary.empty? %><%= news.summary %><br /><% end %>
[<%= link_to l(:label_read), :controller => 'news', :action => 'show', :id => news %>]
</p>
<hr />