Added a setting to configure the day that week start on (Monday or Sunday). (#4363)

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3166 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis 2009-12-13 04:06:55 +00:00
parent 4fb554e95d
commit c31a671973
39 changed files with 58 additions and 1 deletions

View File

@ -659,8 +659,18 @@ module ApplicationHelper
unless @calendar_headers_tags_included
@calendar_headers_tags_included = true
content_for :header_tags do
start_of_week = case Setting.start_of_week.to_i
when 1
'Calendar._FD = 1;' # Monday
when 7
'Calendar._FD = 0;' # Sunday
else
'' # use language
end
javascript_include_tag('calendar/calendar') +
javascript_include_tag("calendar/lang/calendar-#{current_language.to_s.downcase}.js") +
javascript_tag(start_of_week) +
javascript_include_tag('calendar/calendar-setup') +
stylesheet_link_tag('calendar')
end

View File

@ -7,6 +7,9 @@
<p><label><%= l(:setting_default_language) %></label>
<%= select_tag 'settings[default_language]', options_for_select( lang_options_for_select(false), Setting.default_language) %></p>
<p><label><%= l(:setting_start_of_week) %></label>
<%= select_tag 'settings[start_of_week]', options_for_select( [[l(:label_language_based), ''], [day_name(1),'1'], [day_name(7),'7']] , Setting.start_of_week) %></p>
<p><label><%= l(:setting_date_format) %></label>
<%= select_tag 'settings[date_format]', options_for_select( [[l(:label_language_based), '']] + Setting::DATE_FORMATS.collect {|f| [Date.today.strftime(f), f]}, Setting.date_format) %></p>

View File

@ -853,3 +853,4 @@ bg:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -877,3 +877,4 @@ bs:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -856,3 +856,4 @@ ca:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -859,3 +859,4 @@ cs:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -879,3 +879,4 @@ da:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -879,3 +879,4 @@ de:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -859,3 +859,4 @@ el:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -322,6 +322,7 @@ en:
setting_issue_done_ratio: Calculate the issue done ratio with
setting_issue_done_ratio_issue_field: Use the issue field
setting_issue_done_ratio_issue_status: Use the issue status
setting_start_of_week: Start calendars on
permission_add_project: Create project
permission_edit_project: Edit project

View File

@ -900,3 +900,4 @@ es:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -889,3 +889,4 @@ fi:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -882,3 +882,4 @@ fr:
field_active: Actif
enumeration_system_activity: Activité système
setting_gravatar_default: Default Gravatar image
setting_start_of_week: Start calendars on

View File

@ -879,3 +879,4 @@ gl:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -863,3 +863,4 @@ he:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -884,3 +884,4 @@
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -866,3 +866,4 @@ it:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -888,3 +888,4 @@ ja:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -919,3 +919,4 @@ ko:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -889,3 +889,4 @@ lt:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -841,3 +841,4 @@ nl:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -854,3 +854,4 @@
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -882,3 +882,4 @@ pl:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -885,3 +885,4 @@ pt-BR:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -871,3 +871,4 @@ pt:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -856,3 +856,4 @@ ro:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -967,3 +967,4 @@ ru:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -858,3 +858,4 @@ sk:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -855,3 +855,4 @@ sl:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -874,3 +874,4 @@
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -908,3 +908,4 @@ sv:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -856,3 +856,4 @@ th:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -886,3 +886,4 @@ tr:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -855,3 +855,4 @@ uk:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -918,3 +918,4 @@ vi:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -950,3 +950,4 @@
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -883,3 +883,4 @@ zh:
notice_issue_done_ratios_updated: Issue done ratios updated.
error_workflow_copy_source: Please select a source tracker or role
label_update_issue_done_ratios: Update issue done ratios
setting_start_of_week: Start calendars on

View File

@ -172,3 +172,5 @@ openid:
default: 0
gravatar_default:
default: ''
start_of_week:
default: ''

View File

@ -65,8 +65,15 @@ module Redmine
# Return the first day of week
# 1 = Monday ... 7 = Sunday
def first_wday
case Setting.start_of_week.to_i
when 1
@first_dow ||= (1 - 1)%7 + 1
when 7
@first_dow ||= (7 - 1)%7 + 1
else
@first_dow ||= (l(:general_first_day_of_week).to_i - 1)%7 + 1
end
end
def last_wday
@last_dow ||= (first_wday + 5)%7 + 1