Patch #10869 » redmine-1.4.1-fullpdf.patch
| redmine/app/controllers/issues_controller.rb 2012-05-09 21:08:17.213716451 -0400 | ||
|---|---|---|
|
}
|
||
|
format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") }
|
||
|
format.csv { send_data(issues_to_csv(@issues, @project, @query, params), :type => 'text/csv; header=present', :filename => 'export.csv') }
|
||
|
format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'export.pdf') }
|
||
|
format.pdf { send_data(issues_to_pdf_dispatch(@issues, @project, @query), :type => 'application/pdf', :filename => 'export.pdf') }
|
||
|
end
|
||
|
else
|
||
|
respond_to do |format|
|
||
| redmine/app/views/issues/index.html.erb 2012-05-09 22:14:42.338706985 -0400 | ||
|---|---|---|
|
<% other_formats_links do |f| %>
|
||
|
<%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %>
|
||
|
<%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
|
||
|
<%= f.link_to 'PDF', :url => params %>
|
||
|
<%= f.link_to 'PDF', :url => params.merge(:outputType => 'summary') %>
|
||
|
<%= f.link_to_alias 'PDF', 'Full PDF', :url => params.merge(:outputType => 'full') %>
|
||
|
<% end %>
|
||
|
<div id="csv-export-options" style="display:none;">
|
||
| redmine/lib/redmine/export/pdf.rb 2012-05-09 21:08:17.214702078 -0400 | ||
|---|---|---|
|
pdf.SetFillColor(255, 255, 255)
|
||
|
end
|
||
|
def issues_to_pdf_dispatch(issues, project, query)
|
||
|
# export_type is filled by view template thanks to spec_format_link_to
|
||
|
(params['outputType'] == 'full') ? issues_to_pdf_full(issues, project, query) : issues_to_pdf(issues, project, query)
|
||
|
end
|
||
|
def issues_to_pdf_full(issues, project, query)
|
||
|
pdf = ITCPDF.new(current_language)
|
||
|
## pdf = IFPDF.new(current_language)
|
||
|
title = query.new_record? ? l(:label_issue_plural) : query.name
|
||
|
title = "#{project} - #{title}" if project
|
||
|
issues_to_pdf_header(pdf, title, issues, project, query)
|
||
|
issues_to_pdf_content(pdf, title, issues, project, query)
|
||
|
issues.each do |issue|
|
||
|
issue_to_pdf_content(pdf, issue)
|
||
|
end
|
||
|
pdf.Output
|
||
|
end
|
||
|
# Returns a PDF string of a list of issues
|
||
|
def issues_to_pdf(issues, project, query)
|
||
|
pdf = ITCPDF.new(current_language)
|
||
|
title = query.new_record? ? l(:label_issue_plural) : query.name
|
||
|
title = "#{project} - #{title}" if project
|
||
|
issues_to_pdf_header(pdf, title, issues, project, query)
|
||
|
issues_to_pdf_content(pdf, title, issues, project, query)
|
||
|
pdf.Output
|
||
|
end
|
||
|
def issues_to_pdf_header(pdf, title, issues, project, query)
|
||
|
pdf.SetTitle(title)
|
||
|
pdf.alias_nb_pages
|
||
|
pdf.footer_date = format_date(Date.today)
|
||
|
pdf.SetAutoPageBreak(false)
|
||
|
end
|
||
|
def issues_to_pdf_content(pdf, title, issues, project, query)
|
||
|
pdf.AddPage("L")
|
||
|
# Landscape A4 = 210 x 297 mm
|
||
| ... | ... | |
|
pdf.SetFontStyle('B',10)
|
||
|
pdf.RDMCell(0, row_height, '...')
|
||
|
end
|
||
|
pdf.Output
|
||
|
end
|
||
|
# Renders MultiCells and returns the maximum height used
|
||
| ... | ... | |
|
# Returns a PDF string of a single issue
|
||
|
def issue_to_pdf(issue)
|
||
|
pdf = ITCPDF.new(current_language)
|
||
|
issue_to_pdf_header(pdf, issue)
|
||
|
issue_to_pdf_content(pdf, issue)
|
||
|
pdf.Output
|
||
|
end
|
||
|
def issue_to_pdf_header(pdf, issue)
|
||
|
pdf.SetTitle("#{issue.project} - ##{issue.tracker} #{issue.id}")
|
||
|
pdf.alias_nb_pages
|
||
|
pdf.footer_date = format_date(Date.today)
|
||
|
end
|
||
|
def issue_to_pdf_content(pdf,issue)
|
||
|
pdf.AddPage
|
||
|
pdf.SetFontStyle('B',11)
|
||
|
buf = "#{issue.project} - #{issue.tracker} # #{issue.id}"
|
||
| ... | ... | |
|
pdf.Ln
|
||
|
end
|
||
|
end
|
||
|
pdf.Output
|
||
|
end
|
||
|
# Returns a PDF string of a set of wiki pages
|
||
| redmine/lib/redmine/views/other_formats_builder.rb 2012-05-09 22:05:15.210806887 -0400 | ||
|---|---|---|
|
html_options = { :class => name.to_s.downcase, :rel => 'nofollow' }.merge(options)
|
||
|
@view.content_tag('span', @view.link_to(caption, url, html_options))
|
||
|
end
|
||
|
def link_to_alias(name, urlText, options={})
|
||
|
url = { :format => name.to_s.downcase }.merge(options.delete(:url) || {}).except('page')
|
||
|
# caption = options.delete(:caption) || name
|
||
|
caption = urlText
|
||
|
html_options = { :class => name.to_s.downcase, :rel => 'nofollow' }.merge(options)
|
||
|
@view.content_tag('span', @view.link_to(caption, url, html_options))
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||