Adds a dialog box for CSV export options (#4742).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7874 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2011-11-20 13:23:20 +00:00
parent 617cb8d270
commit ca300ccdea
50 changed files with 253 additions and 64 deletions

View File

@ -94,7 +94,7 @@ class IssuesController < ApplicationController
Issue.load_relations(@issues) if include_in_api_response?('relations') Issue.load_relations(@issues) if include_in_api_response?('relations')
} }
format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") } format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") }
format.csv { send_data(issues_to_csv(@issues, @project), :type => 'text/csv; header=present', :filename => 'export.csv') } 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(@issues, @project, @query), :type => 'application/pdf', :filename => 'export.pdf') }
end end
else else

View File

@ -263,62 +263,39 @@ module IssuesHelper
end end
end end
def issues_to_csv(issues, project = nil) def issues_to_csv(issues, project, query, options={})
ic = Iconv.new(l(:general_csv_encoding), 'UTF-8')
decimal_separator = l(:general_csv_decimal_separator) decimal_separator = l(:general_csv_decimal_separator)
encoding = l(:general_csv_encoding)
columns = (options[:columns] == 'all' ? query.available_columns : query.columns)
export = FCSV.generate(:col_sep => l(:general_csv_separator)) do |csv| export = FCSV.generate(:col_sep => l(:general_csv_separator)) do |csv|
# csv header fields # csv header fields
headers = [ "#", csv << [ "#" ] + columns.collect {|c| Redmine::CodesetUtil.from_utf8(c.caption.to_s, encoding) } +
l(:field_status), (options[:description] ? [Redmine::CodesetUtil.from_utf8(l(:field_description), encoding)] : [])
l(:field_project),
l(:field_tracker),
l(:field_priority),
l(:field_subject),
l(:field_assigned_to),
l(:field_category),
l(:field_fixed_version),
l(:field_author),
l(:field_start_date),
l(:field_due_date),
l(:field_done_ratio),
l(:field_estimated_hours),
l(:field_parent_issue),
l(:field_created_on),
l(:field_updated_on)
]
# Export project custom fields if project is given
# otherwise export custom fields marked as "For all projects"
custom_fields = project.nil? ? IssueCustomField.for_all : project.all_issue_custom_fields
custom_fields.each {|f| headers << f.name}
# Description in the last column
headers << l(:field_description)
csv << headers.collect {|c| Redmine::CodesetUtil.from_utf8(
c.to_s,
l(:general_csv_encoding) ) }
# csv lines # csv lines
issues.each do |issue| issues.each do |issue|
fields = [issue.id, col_values = columns.collect do |column|
issue.status.name, s = if column.is_a?(QueryCustomFieldColumn)
issue.project.name, cv = issue.custom_values.detect {|v| v.custom_field_id == column.custom_field.id}
issue.tracker.name, show_value(cv)
issue.priority.name, else
issue.subject, value = issue.send(column.name)
issue.assigned_to, if value.is_a?(Date)
issue.category, format_date(value)
issue.fixed_version, elsif value.is_a?(Time)
issue.author.name, format_time(value)
format_date(issue.start_date), elsif value.is_a?(Float)
format_date(issue.due_date), value.to_s.gsub('.', decimal_separator)
issue.done_ratio, else
issue.estimated_hours.to_s.gsub('.', decimal_separator), value
issue.parent_id, end
format_time(issue.created_on), end
format_time(issue.updated_on) s.to_s
] end
custom_fields.each {|f| fields << show_value(issue.custom_value_for(f)) } csv << [ issue.id.to_s ] + col_values.collect {|c| Redmine::CodesetUtil.from_utf8(c.to_s, encoding) } +
fields << issue.description (options[:description] ? [Redmine::CodesetUtil.from_utf8(issue.description, encoding)] : [])
csv << fields.collect {|c| Redmine::CodesetUtil.from_utf8(
c.to_s,
l(:general_csv_encoding) ) }
end end
end end
export export

View File

@ -54,10 +54,27 @@
<% other_formats_links do |f| %> <% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %>
<%= f.link_to 'CSV', :url => params %> <%= 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 %>
<% end %> <% end %>
<div id="csv-export-options" style="display:none;">
<h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
<% form_tag(params.merge({:format => 'csv',:page=>nil}), :method => :get, :id => 'csv-export-form') do %>
<p>
<label><%= radio_button_tag 'columns', '', true %> <%= l(:description_selected_columns) %></label><br />
<label><%= radio_button_tag 'columns', 'all' %> <%= l(:description_all_columns) %></label>
</p>
<p>
<label><%= check_box_tag 'description', '1' %> <%= l(:field_description) %></label>
</p>
<p style="text-align:right; margin-bottom:0">
<%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %>
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
</p>
<% end %>
</div>
<% end %> <% end %>
<%= call_hook(:view_issues_index_bottom, { :issues => @issues, :project => @project, :query => @query }) %> <%= call_hook(:view_issues_index_bottom, { :issues => @issues, :project => @project, :query => @query }) %>

View File

@ -1000,3 +1000,6 @@ bg:
description_date_from: Въведете начална дата description_date_from: Въведете начална дата
description_date_to: Въведете крайна дата description_date_to: Въведете крайна дата
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1016,3 +1016,6 @@ bs:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1005,3 +1005,6 @@ ca:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1006,3 +1006,6 @@ cs:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1019,3 +1019,6 @@ da:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1023,3 +1023,6 @@ de:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1002,3 +1002,6 @@ el:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1005,3 +1005,6 @@ en-GB:
label_child_revision: Child label_child_revision: Child
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -827,6 +827,7 @@ en:
label_git_report_last_commit: Report last commit for files and directories label_git_report_last_commit: Report last commit for files and directories
label_parent_revision: Parent label_parent_revision: Parent
label_child_revision: Child label_child_revision: Child
label_export_options: %{export_format} export options
button_login: Login button_login: Login
button_submit: Submit button_submit: Submit
@ -875,6 +876,7 @@ en:
button_duplicate: Duplicate button_duplicate: Duplicate
button_show: Show button_show: Show
button_edit_section: Edit this section button_edit_section: Edit this section
button_export: Export
status_active: active status_active: active
status_registered: registered status_registered: registered
@ -994,6 +996,7 @@ en:
description_user_mail_notification: Mail notification settings description_user_mail_notification: Mail notification settings
description_available_columns: Available Columns description_available_columns: Available Columns
description_selected_columns: Selected Columns description_selected_columns: Selected Columns
description_all_columns: All Columns
description_issue_category_reassign: Choose issue category description_issue_category_reassign: Choose issue category
description_wiki_subpages_reassign: Choose new parent page description_wiki_subpages_reassign: Choose new parent page
description_date_range_list: Choose range from list description_date_range_list: Choose range from list

View File

@ -1039,3 +1039,6 @@ es:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1006,3 +1006,6 @@ eu:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1005,3 +1005,6 @@ fa:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1023,3 +1023,6 @@ fi:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -803,6 +803,7 @@ fr:
label_issues_visibility_all: Toutes les demandes label_issues_visibility_all: Toutes les demandes
label_issues_visibility_public: Toutes les demandes non privées label_issues_visibility_public: Toutes les demandes non privées
label_issues_visibility_own: Demandes créées par ou assignées à l'utilisateur label_issues_visibility_own: Demandes créées par ou assignées à l'utilisateur
label_export_options: Options d'exportation %{export_format}
button_login: Connexion button_login: Connexion
button_submit: Soumettre button_submit: Soumettre
@ -850,6 +851,7 @@ fr:
button_duplicate: Dupliquer button_duplicate: Dupliquer
button_show: Afficher button_show: Afficher
button_edit_section: Modifier cette section button_edit_section: Modifier cette section
button_export: Exporter
status_active: actif status_active: actif
status_registered: enregistré status_registered: enregistré
@ -1002,7 +1004,8 @@ fr:
description_user_mail_notification: Mail notification settings description_user_mail_notification: Mail notification settings
description_date_from: Enter start date description_date_from: Enter start date
description_message_content: Message content description_message_content: Message content
description_available_columns: Available Columns description_available_columns: Colonnes disponibles
description_all_columns: Toutes les colonnes
description_date_range_interval: Choose range by selecting start and end date description_date_range_interval: Choose range by selecting start and end date
description_issue_category_reassign: Choose issue category description_issue_category_reassign: Choose issue category
description_search: Searchfield description_search: Searchfield
@ -1012,7 +1015,7 @@ fr:
description_date_to: Enter end date description_date_to: Enter end date
description_query_sort_criteria_attribute: Sort attribute description_query_sort_criteria_attribute: Sort attribute
description_wiki_subpages_reassign: Choose new parent page description_wiki_subpages_reassign: Choose new parent page
description_selected_columns: Selected Columns description_selected_columns: Colonnes sélectionnées
label_parent_revision: Parent label_parent_revision: Parent
label_child_revision: Child label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size. error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.

View File

@ -1014,3 +1014,6 @@ gl:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1007,3 +1007,6 @@ he:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1009,3 +1009,6 @@ hr:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1021,3 +1021,6 @@
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1010,3 +1010,6 @@ id:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1003,3 +1003,6 @@ it:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1032,3 +1032,6 @@ ja:
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size. error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1054,3 +1054,6 @@ ko:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1062,3 +1062,6 @@ lt:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -997,3 +997,6 @@ lv:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1002,3 +1002,6 @@ mk:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1003,3 +1003,6 @@ mn:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -984,3 +984,6 @@ nl:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -992,3 +992,6 @@
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1019,3 +1019,6 @@ pl:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1023,3 +1023,6 @@ pt-BR:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1007,3 +1007,6 @@ pt:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -995,3 +995,6 @@ ro:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1115,3 +1115,6 @@ ru:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -997,3 +997,6 @@ sk:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1002,3 +1002,6 @@ sl:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1002,3 +1002,6 @@ sr-YU:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1003,3 +1003,6 @@ sr:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1043,3 +1043,6 @@ sv:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -999,3 +999,6 @@ th:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1021,3 +1021,6 @@ tr:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -998,3 +998,6 @@ uk:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1053,3 +1053,6 @@ vi:
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1082,3 +1082,6 @@
description_date_to: 輸入結束日期 description_date_to: 輸入結束日期
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -1004,3 +1004,6 @@ zh:
setting_default_issue_start_date_to_creation_date: 使用当前日期作为新问题的开始日期 setting_default_issue_start_date_to_creation_date: 使用当前日期作为新问题的开始日期
button_edit_section: Edit this section button_edit_section: Edit this section
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: All Columns
button_export: Export
label_export_options: "%{export_format} export options"

View File

@ -186,6 +186,39 @@ function promptToRemote(text, param, url) {
} }
} }
function showModal(id, width) {
el = $(id);
if (el == undefined || el.visible()) {return;}
var h = $$('body')[0].getHeight();
var d = document.createElement("div");
d.id = 'modalbg';
$('main').appendChild(d);
$('modalbg').setStyle({ width: '100%', height: h + 'px' });
$('modalbg').show();
var pageWidth = document.viewport.getWidth();
el.setStyle({'width': width});
el.setStyle({'left': (((pageWidth - el.getWidth())/2 *100) / pageWidth) + '%'});
el.addClassName('modal');
el.show();
var submit = el.down("input[type=submit]");
if (submit) {
submit.focus();
}
}
function hideModal(el) {
var modal = Element.up(el, 'div.modal');
if (modal) {
modal.hide();
}
var bg = $('modalbg');
if (bg) {
bg.remove();
}
}
function collapseScmEntry(id) { function collapseScmEntry(id) {
var els = document.getElementsByClassName(id, 'browser'); var els = document.getElementsByClassName(id, 'browser');
for (var i = 0; i < els.length; i++) { for (var i = 0; i < els.length; i++) {

View File

@ -91,6 +91,12 @@ html>body #content { min-height: 600px; }
#login-form label {font-weight: bold;} #login-form label {font-weight: bold;}
#login-form input#username, #login-form input#password { width: 300px; } #login-form input#username, #login-form input#password { width: 300px; }
#modalbg {position:absolute; top:0; left:0; width:100%; height:100%; background:#ccc; z-index:49; opacity:0.5;}
html>body #modalbg {position:fixed;}
div.modal { border-radius:5px; position:absolute; top:25%; background:#fff; border:2px solid #759FCF; z-index:50; padding:0px; padding:8px;}
div.modal h3.title {background:#759FCF; color:#fff; border:0; padding-left:8px; margin:-8px; margin-bottom: 1em; border-top-left-radius:2px;border-top-right-radius:2px;}
html>body div.modal {position:fixed;}
input#openid_url { background: url(../images/openid-bg.gif) no-repeat; background-color: #fff; background-position: 0 50%; padding-left: 18px; } input#openid_url { background: url(../images/openid-bg.gif) no-repeat; background-color: #fff; background-position: 0 50%; padding-left: 18px; }
.clear:after{ content: "."; display: block; height: 0; clear: both; visibility: hidden; } .clear:after{ content: "."; display: block; height: 0; clear: both; visibility: hidden; }

View File

@ -281,21 +281,43 @@ class IssuesControllerTest < ActionController::TestCase
get :index, :sort => 'tracker' get :index, :sort => 'tracker'
end end
def test_index_csv_with_project def test_index_csv
Setting.default_language = 'en'
get :index, :format => 'csv' get :index, :format => 'csv'
assert_response :success assert_response :success
assert_not_nil assigns(:issues) assert_not_nil assigns(:issues)
assert_equal 'text/csv', @response.content_type assert_equal 'text/csv', @response.content_type
assert @response.body.starts_with?("#,") assert @response.body.starts_with?("#,")
lines = @response.body.chomp.split("\n")
assert_equal assigns(:query).columns.size + 1, lines[0].split(',').size
end
def test_index_csv_with_project
get :index, :project_id => 1, :format => 'csv' get :index, :project_id => 1, :format => 'csv'
assert_response :success assert_response :success
assert_not_nil assigns(:issues) assert_not_nil assigns(:issues)
assert_equal 'text/csv', @response.content_type assert_equal 'text/csv', @response.content_type
end end
def test_index_csv_with_description
get :index, :format => 'csv', :description => '1'
assert_response :success
assert_not_nil assigns(:issues)
assert_equal 'text/csv', @response.content_type
assert @response.body.starts_with?("#,")
lines = @response.body.chomp.split("\n")
assert_equal assigns(:query).columns.size + 2, lines[0].split(',').size
end
def test_index_csv_with_all_columns
get :index, :format => 'csv', :columns => 'all'
assert_response :success
assert_not_nil assigns(:issues)
assert_equal 'text/csv', @response.content_type
assert @response.body.starts_with?("#,")
lines = @response.body.chomp.split("\n")
assert_equal assigns(:query).available_columns.size + 1, lines[0].split(',').size
end
def test_index_csv_big_5 def test_index_csv_big_5
with_settings :default_language => "zh-TW" do with_settings :default_language => "zh-TW" do
str_utf8 = "\xe4\xb8\x80\xe6\x9c\x88" str_utf8 = "\xe4\xb8\x80\xe6\x9c\x88"
@ -338,17 +360,19 @@ class IssuesControllerTest < ActionController::TestCase
get :index, :project_id => 1, get :index, :project_id => 1,
:f => ['subject'], :f => ['subject'],
:op => '=', :values => [str_utf8], :op => '=', :values => [str_utf8],
:format => 'csv' :c => ['status', 'subject'],
:format => 'csv',
:set_filter => 1
assert_equal 'text/csv', @response.content_type assert_equal 'text/csv', @response.content_type
lines = @response.body.chomp.split("\n") lines = @response.body.chomp.split("\n")
s1 = "\xaa\xac\xbaA" s1 = "\xaa\xac\xbaA" # status
if str_utf8.respond_to?(:force_encoding) if str_utf8.respond_to?(:force_encoding)
s1.force_encoding('Big5') s1.force_encoding('Big5')
end end
assert lines[0].include?(s1) assert lines[0].include?(s1)
s2 = lines[1].split(",")[5] s2 = lines[1].split(",")[2]
if s1.respond_to?(:force_encoding) if s1.respond_to?(:force_encoding)
s3 = "\xa5H?" s3 = "\xa5H?" # subject
s3.force_encoding('Big5') s3.force_encoding('Big5')
assert_equal s3, s2 assert_equal s3, s2
elsif RUBY_PLATFORM == 'java' elsif RUBY_PLATFORM == 'java'