Commit cd64d11e authored by Eric Davis's avatar Eric Davis

Merge branch 'master' into unstable

Conflicts:
	app/controllers/watchers_controller.rb
	app/views/issues/_action_menu.rhtml
	config/locales/pt-BR.yml
	doc/CHANGELOG.rdoc
	lib/redmine/export/pdf.rb
	lib/redmine/wiki_formatting/textile/helper.rb
parents 46f66add 44b1bcfa
......@@ -4,17 +4,18 @@ class AutoCompletesController < ApplicationController
def issues
@issues = []
q = params[:q].to_s
query = (params[:scope] == "all" && Setting.cross_project_issue_relations?) ? Issue : @project.issues
if q.match(/^\d+$/)
@issues << query.visible.find_by_id(q.to_i)
end
unless q.blank?
@issues += query.visible.find(:all,
if q.present?
query = (params[:scope] == "all" && Setting.cross_project_issue_relations?) ? Issue : @project.issues
@issues |= query.visible.find_all_by_id(q.to_i) if q =~ /^\d+$/
@issues |= query.visible.find(:all,
:limit => 10,
:order => "#{Issue.table_name}.id ASC",
:conditions => ["LOWER(#{Issue.table_name}.subject) LIKE :q OR CAST(#{Issue.table_name}.id AS CHAR(13)) LIKE :q", {:q => "%#{q.downcase}%" }])
end
@issues.compact!
render :layout => false
end
......
class HelpController < ApplicationController
def wiki_syntax
end
def wiki_syntax_detailed
end
end
......@@ -60,6 +60,11 @@ module ApplicationHelper
h(user.to_s)
end
end
# Show a sorted linkified (if active) comma-joined list of users
def list_users(users, options={})
users.sort.collect{|u| link_to_user(u, options)}.join(", ")
end
# Displays a link to +issue+ with its subject.
# Examples:
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>Wiki formatting</title>
<style type="text/css">
h1 { font-family: Verdana, sans-serif; font-size: 14px; text-align: center; color: #444; }
body { font-family: Verdana, sans-serif; font-size: 12px; color: #444; }
table th { padding-top: 1em; }
table td { vertical-align: top; background-color: #f5f5f5; height: 2em; vertical-align: middle;}
table td code { font-size: 1.2em; }
table td h1 { font-size: 1.8em; text-align: left; }
table td h2 { font-size: 1.4em; text-align: left; }
table td h3 { font-size: 1.2em; text-align: left; }
</style>
</head>
<body>
<% content_for :styles do %>
h1 { font-family: Verdana, sans-serif; font-size: 14px; text-align: center; color: #444; }
body { font-family: Verdana, sans-serif; font-size: 12px; color: #444; }
table th { padding-top: 1em; }
table td { vertical-align: top; background-color: #f5f5f5; height: 2em; vertical-align: middle;}
table td code { font-size: 1.2em; }
table td h1 { font-size: 1.8em; text-align: left; }
table td h2 { font-size: 1.4em; text-align: left; }
table td h3 { font-size: 1.2em; text-align: left; }
<% end %>
<% html_title "Wiki Syntax Quick Reference" %>
<h1>Wiki Syntax Quick Reference</h1>
<table width="100%">
......@@ -48,8 +40,9 @@ table td h3 { font-size: 1.2em; text-align: left; }
<tr><th></th><td>http://foo.bar</td><td><a href="#">http://foo.bar</a></td></tr>
<tr><th></th><td>"Foo":http://foo.bar</td><td><a href="#">Foo</a></td></tr>
<tr><th colspan="3">Redmine links</th></tr>
<tr><th colspan="3">ChiliProject links</th></tr>
<tr><th><img src="../images/jstoolbar/bt_link.png" style="border: 1px solid #bbb;" alt="Link to a Wiki page" /></th><td>[[Wiki page]]</td><td><a href="#">Wiki page</a></td></tr>
<tr><th><img src="../images/jstoolbar/bt_link.png" style="border: 1px solid #bbb;" alt="Link to a Wiki page" /></th><td>[[Sandbox:Wiki page]]</td><td><a href="#">Wiki page</a> (On the Sandbox project)</td></tr>
<tr><th></th><td>Issue #12</td><td>Issue <a href="#">#12</a></td></tr>
<tr><th></th><td>Revision r43</td><td>Revision <a href="#">r43</a></td></tr>
<tr><th></th><td>commit:f30e13e43</td><td><a href="#">f30e13e4</a></td></tr>
......@@ -60,7 +53,4 @@ table td h3 { font-size: 1.2em; text-align: left; }
<tr><th></th><td>!<em>attached_image</em>!</td><td></td></tr>
</table>
<p><a href="wiki_syntax_detailed.html" onclick="window.open('wiki_syntax_detailed.html', '', ''); return false;">More Information</a></p>
</body>
</html>
<p><a href="wiki_syntax_detailed" onclick="window.open('wiki_syntax_detailed', '', ''); return false;">More Information</a></p>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>RedmineWikiFormatting</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
<% content_for :styles do %>
body { font:80% Verdana,Tahoma,Arial,sans-serif; }
h1, h2, h3, h4 { font-family: Trebuchet MS,Georgia,"Times New Roman",serif; }
pre, code { font-size:120%; }
......@@ -19,35 +14,34 @@
a.new { color: #b73535; }
.CodeRay .c { color:#666; }
.CodeRay .cl { color:#B06; font-weight:bold }
.CodeRay .dl { color:black }
.CodeRay .fu { color:#06B; font-weight:bold }
.CodeRay .il { background: #eee }
.CodeRay .il .idl { font-weight: bold; color: #888 }
.CodeRay .iv { color:#33B }
.CodeRay .r { color:#080; font-weight:bold }
.CodeRay .s { background-color:#fff0f0 }
.CodeRay .s .dl { color:#710 }
</style>
</head>
<% end %>
<body>
<h1><a name="1" class="wiki-page"></a>Wiki formatting</h1>
<% html_title "Wiki Formatting" %>
<h1><a name="1" class="wiki-page"></a>Wiki Formatting</h1>
<h2><a name="2" class="wiki-page"></a>Links</h2>
<h3><a name="3" class="wiki-page"></a>Redmine links</h3>
<h3><a name="3" class="wiki-page"></a>ChiliProject links</h3>
<p>Redmine allows hyperlinking between issues, changesets and wiki pages from anywhere wiki formatting is used.</p>
<p>ChiliProject allows hyperlinking between issues, changesets and wiki pages from anywhere wiki formatting is used.</p>
<ul>
<li>Link to an issue: <strong>#124</strong> (displays <del><a href="#" class="issue" title="bulk edit doesn't change the category or fixed version properties (Closed)">#124</a></del>, link is striked-through if the issue is closed)</li>
<li>Link to a changeset: <strong>r758</strong> (displays <a href="#" class="changeset" title="Search engine now only searches objects the user is allowed to view.">r758</a>)</li>
<li>Link to a changeset with a non-numeric hash: <strong>commit:c6f4d0fd</strong> (displays <a href="#" class="changeset">c6f4d0fd</a>).</li>
<li>Link to a changeset of another project: <strong>sandbox:r758</strong> (displays <a href="#" class="changeset" title="Search engine now only searches objects the user is allowed to view.">sanbox:r758</a>)</li>
<li>Link to a changeset of another project: <strong>sandbox:r758</strong> (displays <a href="#" class="changeset" title="Search engine now only searches objects the user is allowed to view.">sandbox:r758</a>)</li>
<li>Link to a changeset with a non-numeric hash: <strong>sandbox:c6f4d0fd</strong> (displays <a href="#" class="changeset">sandbox:c6f4d0fd</a>).</li>
</ul>
......@@ -130,8 +124,8 @@
<p>Escaping:</p>
<ul>
<li>You can prevent Redmine links from being parsed by preceding them with an exclamation mark: !</li>
<ul>
<li>You can prevent ChiliProject links from being parsed by preceding them with an exclamation mark: !</li>
</ul>
......@@ -140,24 +134,24 @@
<p>HTTP URLs and email addresses are automatically turned into clickable links:</p>
<pre>
http://www.redmine.org, someone@foo.bar
https://www.chiliproject.org, someone@foo.bar
</pre>
<p>displays: <a class="external" href="http://www.redmine.org">http://www.redmine.org</a>, <a href="mailto:someone@foo.bar" class="email">someone@foo.bar</a></p>
<p>displays: <a class="external" href="https://www.chiliproject.org">https://www.chiliproject.org</a>, <a href="mailto:someone@foo.bar" class="email">someone@foo.bar</a></p>
<p>If you want to display a specific text instead of the URL, you can use the standard textile syntax:</p>
<pre>
"Redmine web site":http://www.redmine.org
"ChiliProject web site":https://www.chiliproject.org
</pre>
<p>displays: <a href="http://www.redmine.org" class="external">Redmine web site</a></p>
<p>displays: <a href="https://www.chiliproject.org" class="external">ChiliProject web site</a></p>
<h2><a name="5" class="wiki-page"></a>Text formatting</h2>
<p>For things such as headlines, bold, tables, lists, Redmine supports Textile syntax. See <a class="external" href="http://www.textism.com/tools/textile/">http://www.textism.com/tools/textile/</a> for information on using any of these features. A few samples are included below, but the engine is capable of much more of that.</p>
<p>For things such as headlines, bold, tables, lists, ChiliProject supports Textile syntax. See <a class="external" href="http://www.textism.com/tools/textile/">http://www.textism.com/tools/textile/</a> for information on using any of these features. A few samples are included below, but the engine is capable of much more of that.</p>
<h3><a name="6" class="wiki-page"></a>Font style</h3>
......@@ -195,7 +189,7 @@ h2. Subheading
h3. Subsubheading
</pre>
<p>Redmine assigns an anchor to each of those headings thus you can link to them with "#Heading", "#Subheading" and so forth.</p>
<p>ChiliProject assigns an anchor to each of those headings thus you can link to them with "#Heading", "#Subheading" and so forth.</p>
<h3><a name="9" class="wiki-page"></a>Paragraphs</h3>
......@@ -205,7 +199,7 @@ p>. right aligned
p=. centered
</pre>
<p style="text-align:center;">This is centered paragraph.</p>
<p style="text-align:center;">This is a centered paragraph.</p>
<h3><a name="10" class="wiki-page"></a>Blockquotes</h3>
......@@ -233,7 +227,7 @@ To go live, all you need to add is a database and a web server.
<h2><a name="12" class="wiki-page"></a>Macros</h2>
<p>Redmine has the following builtin macros:</p>
<p>ChiliProject has the following builtin macros:</p>
<p><dl><dt><code>hello_world</code></dt><dd><p>Sample macro.</p></dd><dt><code>include</code></dt><dd><p>Include a wiki page. Example:</p>
......@@ -266,5 +260,3 @@ To go live, all you need to add is a database and a web server.
<span class="no"><strong>10</strong></span> <span class="r">end</span>
</code>
</pre>
</body>
</html>
......@@ -3,7 +3,7 @@
<p><%= f.select :relation_type, collection_for_relation_type_select, {}, :onchange => "setPredecessorFieldsVisibility();" %>
<%= l(:label_issue) %> #<%= f.text_field :issue_to_id, :size => 10 %>
<div id="related_issue_candidates" class="autocomplete"></div>
<%= javascript_tag "observeRelatedIssueField('#{auto_complete_issues_path(:id => @issue, :project_id => @project) }')" %>
<%= javascript_tag "observeRelatedIssueField('#{auto_complete_issues_path(:id => @issue, :project_id => @project, :escape => false) }')" %>
<span id="predecessor_fields" style="display:none;">
<%= l(:field_delay) %>: <%= f.text_field :delay, :size => 3 %> <%= l(:label_day_plural) %>
</span>
......
......@@ -11,7 +11,7 @@
<% if User.current.allowed_to?(:manage_subtasks, @project) %>
<p id="parent_issue"><%= f.text_field :parent_issue_id, :size => 10 %></p>
<div id="parent_issue_candidates" class="autocomplete"></div>
<%= javascript_tag "observeParentIssueField('#{auto_complete_issues_path(:id => @issue, :project_id => @project) }')" %>
<%= javascript_tag "observeParentIssueField('#{auto_complete_issues_path(:id => @issue, :project_id => @project, :escape => false) }')" %>
<% end %>
<p><%= f.text_area :description,
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title><%= h html_title %></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
<%= yield(:styles) %>
</style>
</head>
<body>
<%= yield %>
</body>
</html>
......@@ -18,6 +18,12 @@ hr {
background: #ccc;
border: 0;
}
blockquote {
border-left: 3px solid #E0E0E0;
font-style: italic;
margin-left: 2.4em;
padding-left: 0.6em;
}
.footer {
font-size: 0.8em;
font-style: italic;
......
......@@ -25,9 +25,9 @@
<p><%= f.select :auth_source_id, ([[l(:label_internal), ""]] + @auth_sources.collect { |a| [a.name, a.id] }), {}, :onchange => "if (this.value=='') {Element.show('password_fields');} else {Element.hide('password_fields');}" %></p>
<% end %>
<div id="password_fields" style="<%= 'display:none;' if @user.auth_source %>">
<p><%= f.password_field :password, :required => true, :size => 25 %><br />
<p><%= f.password_field :password, :required => true, :size => 25, :autocomplete => :off %><br />
<em><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em></p>
<p><%= f.password_field :password_confirmation, :required => true, :size => 25 %></p>
<p><%= f.password_field :password_confirmation, :required => true, :size => 25, :autocomplete => :off %></p>
</div>
</div>
......
......@@ -972,17 +972,18 @@ pt-BR:
button_collapse_all: Collapse all
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee
label_additional_workflow_transitions_for_author: Additional transitions allowed when the user is the author
label_cvs_module: Module
label_filesystem_path: Root directory
label_darcs_path: Root directory
field_effective_date: Due date
label_bazaar_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
text_powered_by: Powered by %{link}
label_mercurial_path: Root directory
text_default_encoding: "Default: UTF-8"
text_git_repo_example: a bare and local repository (e.g. /gitrepo, c:\gitrepo)
label_notify_member_plural: Email issue updates
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_cvs_module: Módulo
label_filesystem_path: Diretório raiz
label_darcs_path: Diretório raiz
label_bazaar_path: Diretório raiz
label_git_path: Caminho para o diretório .git
label_mercurial_path: Diretório raiz
......@@ -19,6 +19,25 @@
* Patch #7598: Extensible MailHandler
* Patch #7795: Internal server error at journals#index with custom fields
== 2011-05-27 v1.4.0
* Bug #81: Replace favicon
* Bug #311: Update the watcher list on "watch"-link click
* Bug #322: reposman.rb doesn't work with Rubygems >= 1.6.0
* Bug #340: Properly format blockquotes in HTML mails
* Bug #357: Wrap long text fields properly in PDF exports
* Bug #360: Set autocomplete=off for some fields in user form
* Bug #373: Issue auto completion returns duplicates
* Bug #374: HTML-escaped URLs in JavaScript
* Bug #379: Help controller headings rendered differently in Ruby 1.9
* Bug #380: Wiki-Help Page
* Bug #424: Loading issue context menu causes two identical AJAX requests
* Bug #425: Deprecation warning when using ChiliProject with Rake 0.9
* Feature #202: Adding the theme used on chiliproject.org to the repository
* Feature #304: Add a helper to format user lists
* Feature #361: [Cleanup] Removing code comment, by answering the implied question in wikitoolbar_for helper
* Feature #362: Introduce Help controller to dynamically generate wiki help pages
== 2011-05-01 v1.3.0
* Bug #309: The login screen after lost_password redirects back to lost_password after you login
......
......@@ -482,6 +482,7 @@ sub get_project_identifier {
my $location = $r->location;
my ($identifier) = $r->uri =~ m{$location/*([^/]+)};
$identifier =~ s/\.git$// if (defined $cfg->{RedmineGitSmartHttp} and $cfg->{RedmineGitSmartHttp});
$identifier;
}
......
......@@ -66,6 +66,10 @@ require 'rdoc/usage'
require 'find'
require 'etc'
# working around deprecation in RubyGems 1.6
# needed for rails <2.3.9 only, don't merge to unstable!
require 'thread'
Version = "1.3"
SUPPORTED_SCM = %w( Subversion Darcs Mercurial Bazaar Git Filesystem )
......
Description:
The plugin generator creates stubs for a new ChiliProject plugin.
Example:
./script/generate chliproject_plugin meetings
create vendor/plugins/chiliproject_meetings/app/controllers
create vendor/plugins/chiliproject_meetings/app/helpers
create vendor/plugins/chiliproject_meetings/app/models
create vendor/plugins/chiliproject_meetings/app/views
create vendor/plugins/chiliproject_meetings/db/migrate
create vendor/plugins/chiliproject_meetings/lib/tasks
create vendor/plugins/chiliproject_meetings/assets/images
create vendor/plugins/chiliproject_meetings/assets/javascripts
create vendor/plugins/chiliproject_meetings/assets/stylesheets
create vendor/plugins/chiliproject_meetings/lang
create vendor/plugins/chiliproject_meetings/README
create vendor/plugins/chiliproject_meetings/init.rb
create vendor/plugins/chiliproject_meetings/lang/en.yml
create vendor/plugins/chiliproject_meetings/config/locales/en.yml
create vendor/plugins/chiliproject_meetings/test/test_helper.rb
class RedminePluginGenerator < Rails::Generator::NamedBase
class ChiliprojectPluginGenerator < Rails::Generator::NamedBase
attr_reader :plugin_path, :plugin_name, :plugin_pretty_name
def initialize(runtime_args, runtime_options = {})
super
@plugin_name = "redmine_#{file_name.underscore}"
@plugin_name = "chiliproject_#{file_name.underscore}"
@plugin_pretty_name = plugin_name.titleize
@plugin_path = "vendor/plugins/#{plugin_name}"
end
......
......@@ -3,7 +3,7 @@ require 'redmine'
Redmine::Plugin.register :<%= plugin_name %> do
name '<%= plugin_pretty_name %> plugin'
author 'Author name'
description 'This is a plugin for Redmine'
description 'This is a plugin for ChiliProject'
version '0.0.1'
url 'http://example.com/path/to/plugin'
author_url 'http://example.com/about'
......
......@@ -2,4 +2,4 @@ Description:
Generates a plugin controller.
Example:
./script/generate redmine_plugin_controller MyPlugin Pools index show vote
./script/generate chiliproject_plugin_controller MyPlugin Pools index show vote
require 'rails_generator/base'
require 'rails_generator/generators/components/controller/controller_generator'
class RedminePluginControllerGenerator < ControllerGenerator
class ChiliprojectPluginControllerGenerator < ControllerGenerator
attr_reader :plugin_path, :plugin_name, :plugin_pretty_name
def initialize(runtime_args, runtime_options = {})
runtime_args = runtime_args.dup
usage if runtime_args.empty?
@plugin_name = "redmine_" + runtime_args.shift.underscore
@plugin_name = "chiliproject_" + runtime_args.shift.underscore
@plugin_pretty_name = plugin_name.titleize
@plugin_path = "vendor/plugins/#{plugin_name}"
super(runtime_args, runtime_options)
......
......@@ -2,4 +2,4 @@ Description:
Generates a plugin model.
Examples:
./script/generate redmine_plugin_model MyPlugin pool title:string question:text
./script/generate chiliproject_plugin_model MyPlugin pool title:string question:text
require 'rails_generator/base'
require 'rails_generator/generators/components/model/model_generator'
class RedminePluginModelGenerator < ModelGenerator
class ChiliprojectPluginModelGenerator < ModelGenerator
attr_accessor :plugin_path, :plugin_name, :plugin_pretty_name
def initialize(runtime_args, runtime_options = {})
runtime_args = runtime_args.dup
usage if runtime_args.empty?
@plugin_name = "redmine_" + runtime_args.shift.underscore
@plugin_name = "chiliproject_" + runtime_args.shift.underscore
@plugin_pretty_name = plugin_name.titleize
@plugin_path = "vendor/plugins/#{plugin_name}"
super(runtime_args, runtime_options)
......
Description:
The plugin generator creates stubs for a new Redmine plugin.
Example:
./script/generate redmine_plugin meetings
create vendor/plugins/redmine_meetings/app/controllers
create vendor/plugins/redmine_meetings/app/helpers
create vendor/plugins/redmine_meetings/app/models
create vendor/plugins/redmine_meetings/app/views
create vendor/plugins/redmine_meetings/db/migrate
create vendor/plugins/redmine_meetings/lib/tasks
create vendor/plugins/redmine_meetings/assets/images
create vendor/plugins/redmine_meetings/assets/javascripts
create vendor/plugins/redmine_meetings/assets/stylesheets
create vendor/plugins/redmine_meetings/lang
create vendor/plugins/redmine_meetings/README
create vendor/plugins/redmine_meetings/init.rb
create vendor/plugins/redmine_meetings/lang/en.yml
create vendor/plugins/redmine_meetings/config/locales/en.yml
create vendor/plugins/redmine_meetings/test/test_helper.rb
......@@ -156,7 +156,7 @@ module Redmine
end || ''
return txt
end
def RDMCell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='')
Cell(w,h,fix_text_encoding(txt),border,ln,align,fill,link)
end
......@@ -193,13 +193,25 @@ module Redmine
pdf.SetTitle(title)
pdf.alias_nb_pages
pdf.footer_date = format_date(Date.today)
pdf.SetAutoPageBreak(false)
pdf.AddPage("L")
row_height = 6
# Landscape A4 = 210 x 297 mm
page_height = 210
page_width = 297
right_margin = 10
bottom_margin = 20
col_id_width = 10
row_height = 5
# column widths
table_width = page_width - right_margin - 10 # fixed left margin
col_width = []
unless query.columns.empty?
col_width = query.columns.collect {|column| column.name == :subject ? 4.0 : 1.0 }
ratio = 262.0 / col_width.inject(0) {|s,w| s += w}
col_width = query.columns.collect do |c|
(c.name == :subject || (c.is_a?(QueryCustomFieldColumn) && ['string', 'text'].include?(c.custom_field.field_format)))? 4.0 : 1.0
end
ratio = (table_width - col_id_width) / col_width.inject(0) {|s,w| s += w}
col_width = col_width.collect {|w| w * ratio}
end
......@@ -211,7 +223,7 @@ module Redmine
# headers
pdf.SetFontStyle('B',8)
pdf.SetFillColor(230, 230, 230)
pdf.RDMCell(15, row_height, "#", 1, 0, 'L', 1)
pdf.RDMCell(col_id_width, row_height, "#", 1, 0, 'L', 1)
query.columns.each_with_index do |column, i|
pdf.RDMCell(col_width[i], row_height, column.caption, 1, 0, 'L', 1)
end
......@@ -230,8 +242,9 @@ module Redmine
pdf.SetFontStyle('',8)
previous_group = group
end
pdf.RDMCell(15, row_height, issue.id.to_s, 1, 0, 'L', 1)
query.columns.each_with_index do |column, i|
# fetch all the row values
col_values = query.columns.collect do |column|
s = if column.is_a?(QueryCustomFieldColumn)
cv = issue.custom_values.detect {|v| v.custom_field_id == column.custom_field.id}
show_value(cv)
......@@ -244,18 +257,64 @@ module Redmine
else
value
end
end
pdf.RDMCell(col_width[i], row_height, s.to_s, 1, 0, 'L', 1)
end
s.to_s
end
pdf.Ln
# render it off-page to find the max height used
base_x = pdf.GetX
base_y = pdf.GetY
pdf.SetY(2 * page_height)
max_height = issues_to_pdf_write_cells(pdf, col_values, col_width, row_height)
pdf.SetXY(base_x, base_y)
# make new page if it doesn't fit on the current one
space_left = page_height - base_y - bottom_margin
if max_height > space_left
pdf.AddPage("L")
base_x = pdf.GetX
base_y = pdf.GetY
end
# write the cells on page
pdf.Cell(col_id_width, row_height, issue.id.to_s, "T", 0, 'C', 1)
issues_to_pdf_write_cells(pdf, col_values, col_width, row_height)
issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_id_width, col_width)
pdf.SetY(base_y + max_height);
end
if issues.size == Setting.issues_export_limit.to_i
pdf.SetFontStyle('B',10)
pdf.RDMCell(0, row_height, '...')
end
pdf.Output
end
# Renders MultiCells and returns the maximum height used
def issues_to_pdf_write_cells(pdf, col_values, col_widths, row_height)
base_y = pdf.GetY
max_height = row_height
col_values.each_with_index do |column, i|
col_x = pdf.GetX
pdf.RDMMultiCell(col_widths[i], row_height, col_values[i], "T", 'L', 1)
max_height = (pdf.GetY - base_y) if (pdf.GetY - base_y) > max_height
pdf.SetXY(col_x + col_widths[i], base_y);
end
return max_height
end
# Draw lines to close the row (MultiCell border drawing in not uniform)
def issues_to_pdf_draw_borders(pdf, top_x, top_y, lower_y, id_width, col_widths)
col_x = top_x + id_width
pdf.Line(col_x, top_y, col_x, lower_y) # id right border
col_widths.each do |width|
col_x += width
pdf.Line(col_x, top_y, col_x, lower_y) # columns right border
end
pdf.Line(top_x, top_y, top_x, lower_y) # left border
pdf.Line(top_x, lower_y, col_x, lower_y) # bottom border
end
# Returns a PDF string of a single issue
def issue_to_pdf(issue)
if ( current_language.to_s.downcase == 'ko' ||
......@@ -273,7 +332,7 @@ module Redmine
pdf.AddPage
pdf.SetFontStyle('B',11)
pdf.RDMCell(190,10, "#{issue.project} - #{issue.tracker} # #{issue.id}: #{issue.subject}")
pdf.RDMMultiCell(190,5, "#{issue.project} - #{issue.tracker} # #{issue.id}: #{issue.subject}")
pdf.Ln
y0 = pdf.GetY
......@@ -325,19 +384,13 @@ module Redmine
pdf.RDMMultiCell(155,5, (show_value custom_value),"R")
end
pdf.SetFontStyle('B',9)
pdf.RDMCell(35,5, l(:field_subject) + ":","LTB")
pdf.SetFontStyle('',9)
pdf.RDMCell(155,5, issue.subject,"RTB")
pdf.Ln
pdf.SetFontStyle('B',9)
pdf.RDMCell(35,5, l(:field_description) + ":")
pdf.SetFontStyle('',9)
pdf.RDMMultiCell(155,5, issue.description.to_s,"BR")
pdf.Line(pdf.GetX, y0, pdf.GetX, pdf.GetY)
pdf.Line(pdf.GetX, pdf.GetY, 170, pdf.GetY)
pdf.Line(pdf.GetX, pdf.GetY, pdf.GetX + 190, pdf.GetY)
pdf.Ln
if issue.changesets.any? && User.current.allowed_to?(:view_changesets, issue.project)
......@@ -359,16 +412,17 @@ module Redmine
pdf.SetFontStyle('B',9)
pdf.RDMCell(190,5, l(:label_history), "B")
pdf.Ln
for journal in issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_at ASC")
for journal in issue.journals.find(:all, :include => [:user], :order => "#{Journal.table_name}.created_at ASC")
pdf.SetFontStyle('B',8)