redmine-upgrade-to-rails-2.3.4.patch

Upgrade patch as of 2009-09-06 - Eric Davis, 2009-09-06 22:43

Download (189 KB)

View differences:

app/controllers/application.rb
1
# redMine - project management software
2
# Copyright (C) 2006-2007  Jean-Philippe Lang
3
#
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 2
7
# of the License, or (at your option) any later version.
8
# 
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
# 
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17

  
18
require 'uri'
19
require 'cgi'
20

  
21
class ApplicationController < ActionController::Base
22
  include Redmine::I18n
23
  
24
  # In case the cookie store secret changes
25
  rescue_from CGI::Session::CookieStore::TamperedWithCookie do |exception|
26
    render :text => 'Your session was invalid and has been reset. Please, reload this page.', :status => 500
27
  end
28
  
29
  layout 'base'
30
  
31
  before_filter :user_setup, :check_if_login_required, :set_localization
32
  filter_parameter_logging :password
33
  
34
  include Redmine::MenuManager::MenuController
35
  helper Redmine::MenuManager::MenuHelper
36
  
37
  REDMINE_SUPPORTED_SCM.each do |scm|
38
    require_dependency "repository/#{scm.underscore}"
39
  end
40
  
41
  def user_setup
42
    # Check the settings cache for each request
43
    Setting.check_cache
44
    # Find the current user
45
    User.current = find_current_user
46
  end
47
  
48
  # Returns the current user or nil if no user is logged in
49
  # and starts a session if needed
50
  def find_current_user
51
    if session[:user_id]
52
      # existing session
53
      (User.active.find(session[:user_id]) rescue nil)
54
    elsif cookies[:autologin] && Setting.autologin?
55
      # auto-login feature starts a new session
56
      user = User.try_to_autologin(cookies[:autologin])
57
      session[:user_id] = user.id if user
58
      user
59
    elsif params[:format] == 'atom' && params[:key] && accept_key_auth_actions.include?(params[:action])
60
      # RSS key authentication does not start a session
61
      User.find_by_rss_key(params[:key])
62
    end
63
  end
64
  
65
  # Sets the logged in user
66
  def logged_user=(user)
67
    if user && user.is_a?(User)
68
      User.current = user
69
      session[:user_id] = user.id
70
    else
71
      User.current = User.anonymous
72
      session[:user_id] = nil
73
    end
74
  end
75
  
76
  # check if login is globally required to access the application
77
  def check_if_login_required
78
    # no check needed if user is already logged in
79
    return true if User.current.logged?
80
    require_login if Setting.login_required?
81
  end 
82
  
83
  def set_localization
84
    lang = nil
85
    if User.current.logged?
86
      lang = find_language(User.current.language)
87
    end
88
    if lang.nil? && request.env['HTTP_ACCEPT_LANGUAGE']
89
      accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.downcase
90
      if !accept_lang.blank?
91
        lang = find_language(accept_lang) || find_language(accept_lang.split('-').first)
92
      end
93
    end
94
    lang ||= Setting.default_language
95
    set_language_if_valid(lang)
96
  end
97
  
98
  def require_login
99
    if !User.current.logged?
100
      redirect_to :controller => "account", :action => "login", :back_url => url_for(params)
101
      return false
102
    end
103
    true
104
  end
105

  
106
  def require_admin
107
    return unless require_login
108
    if !User.current.admin?
109
      render_403
110
      return false
111
    end
112
    true
113
  end
114
  
115
  def deny_access
116
    User.current.logged? ? render_403 : require_login
117
  end
118

  
119
  # Authorize the user for the requested action
120
  def authorize(ctrl = params[:controller], action = params[:action], global = false)
121
    allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project, :global => global)
122
    allowed ? true : deny_access
123
  end
124

  
125
  # Authorize the user for the requested action outside a project
126
  def authorize_global(ctrl = params[:controller], action = params[:action], global = true)
127
    authorize(ctrl, action, global)
128
  end
129
  
130
  # make sure that the user is a member of the project (or admin) if project is private
131
  # used as a before_filter for actions that do not require any particular permission on the project
132
  def check_project_privacy
133
    if @project && @project.active?
134
      if @project.is_public? || User.current.member_of?(@project) || User.current.admin?
135
        true
136
      else
137
        User.current.logged? ? render_403 : require_login
138
      end
139
    else
140
      @project = nil
141
      render_404
142
      false
143
    end
144
  end
145

  
146
  def redirect_back_or_default(default)
147
    back_url = CGI.unescape(params[:back_url].to_s)
148
    if !back_url.blank?
149
      begin
150
        uri = URI.parse(back_url)
151
        # do not redirect user to another host or to the login or register page
152
        if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
153
          redirect_to(back_url) and return
154
        end
155
      rescue URI::InvalidURIError
156
        # redirect to default
157
      end
158
    end
159
    redirect_to default
160
  end
161
  
162
  def render_403
163
    @project = nil
164
    render :template => "common/403", :layout => !request.xhr?, :status => 403
165
    return false
166
  end
167
    
168
  def render_404
169
    render :template => "common/404", :layout => !request.xhr?, :status => 404
170
    return false
171
  end
172
  
173
  def render_error(msg)
174
    flash.now[:error] = msg
175
    render :text => '', :layout => !request.xhr?, :status => 500
176
  end
177
  
178
  def render_feed(items, options={})    
179
    @items = items || []
180
    @items.sort! {|x,y| y.event_datetime <=> x.event_datetime }
181
    @items = @items.slice(0, Setting.feeds_limit.to_i)
182
    @title = options[:title] || Setting.app_title
183
    render :template => "common/feed.atom.rxml", :layout => false, :content_type => 'application/atom+xml'
184
  end
185
  
186
  def self.accept_key_auth(*actions)
187
    actions = actions.flatten.map(&:to_s)
188
    write_inheritable_attribute('accept_key_auth_actions', actions)
189
  end
190
  
191
  def accept_key_auth_actions
192
    self.class.read_inheritable_attribute('accept_key_auth_actions') || []
193
  end
194
  
195
  # TODO: move to model
196
  def attach_files(obj, attachments)
197
    attached = []
198
    unsaved = []
199
    if attachments && attachments.is_a?(Hash)
200
      attachments.each_value do |attachment|
201
        file = attachment['file']
202
        next unless file && file.size > 0
203
        a = Attachment.create(:container => obj, 
204
                              :file => file,
205
                              :description => attachment['description'].to_s.strip,
206
                              :author => User.current)
207
        a.new_record? ? (unsaved << a) : (attached << a)
208
      end
209
      if unsaved.any?
210
        flash[:warning] = l(:warning_attachments_not_saved, unsaved.size)
211
      end
212
    end
213
    attached
214
  end
215

  
216
  # Returns the number of objects that should be displayed
217
  # on the paginated list
218
  def per_page_option
219
    per_page = nil
220
    if params[:per_page] && Setting.per_page_options_array.include?(params[:per_page].to_s.to_i)
221
      per_page = params[:per_page].to_s.to_i
222
      session[:per_page] = per_page
223
    elsif session[:per_page]
224
      per_page = session[:per_page]
225
    else
226
      per_page = Setting.per_page_options_array.first || 25
227
    end
228
    per_page
229
  end
230

  
231
  # qvalues http header parser
232
  # code taken from webrick
233
  def parse_qvalues(value)
234
    tmp = []
235
    if value
236
      parts = value.split(/,\s*/)
237
      parts.each {|part|
238
        if m = %r{^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$}.match(part)
239
          val = m[1]
240
          q = (m[2] or 1).to_f
241
          tmp.push([val, q])
242
        end
243
      }
244
      tmp = tmp.sort_by{|val, q| -q}
245
      tmp.collect!{|val, q| val}
246
    end
247
    return tmp
248
  rescue
249
    nil
250
  end
251
  
252
  # Returns a string that can be used as filename value in Content-Disposition header
253
  def filename_for_content_disposition(name)
254
    request.env['HTTP_USER_AGENT'] =~ %r{MSIE} ? ERB::Util.url_encode(name) : name
255
  end
256
end
app/controllers/application_controller.rb
1
# redMine - project management software
2
# Copyright (C) 2006-2007  Jean-Philippe Lang
3
#
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 2
7
# of the License, or (at your option) any later version.
8
# 
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
# 
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17

  
18
require 'uri'
19
require 'cgi'
20

  
21
class ApplicationController < ActionController::Base
22
  include Redmine::I18n
23

  
24
  layout 'base'
25
  
26
  before_filter :user_setup, :check_if_login_required, :set_localization
27
  filter_parameter_logging :password
28
  
29
  include Redmine::MenuManager::MenuController
30
  helper Redmine::MenuManager::MenuHelper
31
  
32
  REDMINE_SUPPORTED_SCM.each do |scm|
33
    require_dependency "repository/#{scm.underscore}"
34
  end
35
  
36
  def user_setup
37
    # Check the settings cache for each request
38
    Setting.check_cache
39
    # Find the current user
40
    User.current = find_current_user
41
  end
42
  
43
  # Returns the current user or nil if no user is logged in
44
  # and starts a session if needed
45
  def find_current_user
46
    if session[:user_id]
47
      # existing session
48
      (User.active.find(session[:user_id]) rescue nil)
49
    elsif cookies[:autologin] && Setting.autologin?
50
      # auto-login feature starts a new session
51
      user = User.try_to_autologin(cookies[:autologin])
52
      session[:user_id] = user.id if user
53
      user
54
    elsif params[:format] == 'atom' && params[:key] && accept_key_auth_actions.include?(params[:action])
55
      # RSS key authentication does not start a session
56
      User.find_by_rss_key(params[:key])
57
    end
58
  end
59
  
60
  # Sets the logged in user
61
  def logged_user=(user)
62
    if user && user.is_a?(User)
63
      User.current = user
64
      session[:user_id] = user.id
65
    else
66
      User.current = User.anonymous
67
      session[:user_id] = nil
68
    end
69
  end
70
  
71
  # check if login is globally required to access the application
72
  def check_if_login_required
73
    # no check needed if user is already logged in
74
    return true if User.current.logged?
75
    require_login if Setting.login_required?
76
  end 
77
  
78
  def set_localization
79
    lang = nil
80
    if User.current.logged?
81
      lang = find_language(User.current.language)
82
    end
83
    if lang.nil? && request.env['HTTP_ACCEPT_LANGUAGE']
84
      accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.downcase
85
      if !accept_lang.blank?
86
        lang = find_language(accept_lang) || find_language(accept_lang.split('-').first)
87
      end
88
    end
89
    lang ||= Setting.default_language
90
    set_language_if_valid(lang)
91
  end
92
  
93
  def require_login
94
    if !User.current.logged?
95
      redirect_to :controller => "account", :action => "login", :back_url => url_for(params)
96
      return false
97
    end
98
    true
99
  end
100

  
101
  def require_admin
102
    return unless require_login
103
    if !User.current.admin?
104
      render_403
105
      return false
106
    end
107
    true
108
  end
109
  
110
  def deny_access
111
    User.current.logged? ? render_403 : require_login
112
  end
113

  
114
  # Authorize the user for the requested action
115
  def authorize(ctrl = params[:controller], action = params[:action], global = false)
116
    allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project, :global => global)
117
    allowed ? true : deny_access
118
  end
119

  
120
  # Authorize the user for the requested action outside a project
121
  def authorize_global(ctrl = params[:controller], action = params[:action], global = true)
122
    authorize(ctrl, action, global)
123
  end
124
  
125
  # make sure that the user is a member of the project (or admin) if project is private
126
  # used as a before_filter for actions that do not require any particular permission on the project
127
  def check_project_privacy
128
    if @project && @project.active?
129
      if @project.is_public? || User.current.member_of?(@project) || User.current.admin?
130
        true
131
      else
132
        User.current.logged? ? render_403 : require_login
133
      end
134
    else
135
      @project = nil
136
      render_404
137
      false
138
    end
139
  end
140

  
141
  def redirect_back_or_default(default)
142
    back_url = CGI.unescape(params[:back_url].to_s)
143
    if !back_url.blank?
144
      begin
145
        uri = URI.parse(back_url)
146
        # do not redirect user to another host or to the login or register page
147
        if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
148
          redirect_to(back_url) and return
149
        end
150
      rescue URI::InvalidURIError
151
        # redirect to default
152
      end
153
    end
154
    redirect_to default
155
  end
156
  
157
  def render_403
158
    @project = nil
159
    render :template => "common/403", :layout => !request.xhr?, :status => 403
160
    return false
161
  end
162
    
163
  def render_404
164
    render :template => "common/404", :layout => !request.xhr?, :status => 404
165
    return false
166
  end
167
  
168
  def render_error(msg)
169
    flash.now[:error] = msg
170
    render :text => '', :layout => !request.xhr?, :status => 500
171
  end
172
  
173
  def render_feed(items, options={})    
174
    @items = items || []
175
    @items.sort! {|x,y| y.event_datetime <=> x.event_datetime }
176
    @items = @items.slice(0, Setting.feeds_limit.to_i)
177
    @title = options[:title] || Setting.app_title
178
    render :template => "common/feed.atom.rxml", :layout => false, :content_type => 'application/atom+xml'
179
  end
180
  
181
  def self.accept_key_auth(*actions)
182
    actions = actions.flatten.map(&:to_s)
183
    write_inheritable_attribute('accept_key_auth_actions', actions)
184
  end
185
  
186
  def accept_key_auth_actions
187
    self.class.read_inheritable_attribute('accept_key_auth_actions') || []
188
  end
189
  
190
  # TODO: move to model
191
  def attach_files(obj, attachments)
192
    attached = []
193
    unsaved = []
194
    if attachments && attachments.is_a?(Hash)
195
      attachments.each_value do |attachment|
196
        file = attachment['file']
197
        next unless file && file.size > 0
198
        a = Attachment.create(:container => obj, 
199
                              :file => file,
200
                              :description => attachment['description'].to_s.strip,
201
                              :author => User.current)
202
        a.new_record? ? (unsaved << a) : (attached << a)
203
      end
204
      if unsaved.any?
205
        flash[:warning] = l(:warning_attachments_not_saved, unsaved.size)
206
      end
207
    end
208
    attached
209
  end
210

  
211
  # Returns the number of objects that should be displayed
212
  # on the paginated list
213
  def per_page_option
214
    per_page = nil
215
    if params[:per_page] && Setting.per_page_options_array.include?(params[:per_page].to_s.to_i)
216
      per_page = params[:per_page].to_s.to_i
217
      session[:per_page] = per_page
218
    elsif session[:per_page]
219
      per_page = session[:per_page]
220
    else
221
      per_page = Setting.per_page_options_array.first || 25
222
    end
223
    per_page
224
  end
225

  
226
  # qvalues http header parser
227
  # code taken from webrick
228
  def parse_qvalues(value)
229
    tmp = []
230
    if value
231
      parts = value.split(/,\s*/)
232
      parts.each {|part|
233
        if m = %r{^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$}.match(part)
234
          val = m[1]
235
          q = (m[2] or 1).to_f
236
          tmp.push([val, q])
237
        end
238
      }
239
      tmp = tmp.sort_by{|val, q| -q}
240
      tmp.collect!{|val, q| val}
241
    end
242
    return tmp
243
  rescue
244
    nil
245
  end
246
  
247
  # Returns a string that can be used as filename value in Content-Disposition header
248
  def filename_for_content_disposition(name)
249
    request.env['HTTP_USER_AGENT'] =~ %r{MSIE} ? ERB::Util.url_encode(name) : name
250
  end
251
end
app/controllers/repositories_controller.rb
259 259

  
260 260
  def graph_commits_per_author(repository)
261 261
    commits_by_author = repository.changesets.count(:all, :group => :committer)
262
    commits_by_author.sort! {|x, y| x.last <=> y.last}
262
    commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}
263 263

  
264 264
    changes_by_author = repository.changes.count(:all, :group => :committer)
265 265
    h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o}
app/views/settings/_authentication.rhtml
2 2

  
3 3
<div class="box tabular settings">
4 4
<p><label><%= l(:setting_login_required) %></label>
5
<%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %><%= hidden_field_tag 'settings[login_required]', 0 %></p>
5
<%= hidden_field_tag 'settings[login_required]', 0 %>
6
<%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %>
7
</p>
6 8

  
7 9
<p><label><%= l(:setting_autologin) %></label>
8 10
<%= select_tag 'settings[autologin]', options_for_select( [[l(:label_disabled), "0"]] + [1, 7, 30, 365].collect{|days| [l('datetime.distance_in_words.x_days', :count => days), days.to_s]}, Setting.autologin) %></p>
......
19 21
<%= text_field_tag 'settings[password_min_length]', Setting.password_min_length, :size => 6 %></p>
20 22

  
21 23
<p><label><%= l(:label_password_lost) %></label>
22
<%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %></p>
24
<%= hidden_field_tag 'settings[lost_password]', 0 %>
25
<%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %>
26
</p>
23 27

  
24 28
<p><label><%= l(:setting_openid) %></label>
25
<%= check_box_tag 'settings[openid]', 1, Setting.openid?, :disabled => !Object.const_defined?(:OpenID) %><%= hidden_field_tag 'settings[openid]', 0 %></p>
29
<%= hidden_field_tag 'settings[openid]', 0 %>
30
<%= check_box_tag 'settings[openid]', 1, Setting.openid?, :disabled => !Object.const_defined?(:OpenID) %>
31
</p>
26 32
</div>
27 33

  
28 34
<div style="float:right;">
app/views/settings/_display.rhtml
17 17
<%= select_tag 'settings[user_format]', options_for_select( @options[:user_format], Setting.user_format.to_s ) %></p>
18 18

  
19 19
<p><label><%= l(:setting_gravatar_enabled) %></label>
20
<%= check_box_tag 'settings[gravatar_enabled]', 1, Setting.gravatar_enabled? %><%= hidden_field_tag 'settings[gravatar_enabled]', 0 %></p>
20
<%= hidden_field_tag 'settings[gravatar_enabled]', 0 %>
21
<%= check_box_tag 'settings[gravatar_enabled]', 1, Setting.gravatar_enabled? %>
22
</p>
21 23
</div>
22 24

  
23 25
<%= submit_tag l(:button_save) %>
app/views/settings/_issues.rhtml
2 2

  
3 3
<div class="box tabular settings">
4 4
<p><label><%= l(:setting_cross_project_issue_relations) %></label>
5
<%= check_box_tag 'settings[cross_project_issue_relations]', 1, Setting.cross_project_issue_relations? %><%= hidden_field_tag 'settings[cross_project_issue_relations]', 0 %></p>
5
<%= hidden_field_tag 'settings[cross_project_issue_relations]', 0 %>
6
<%= check_box_tag 'settings[cross_project_issue_relations]', 1, Setting.cross_project_issue_relations? %>
7
</p>
6 8

  
7 9
<p><label><%= l(:setting_display_subprojects_issues) %></label>
8
<%= check_box_tag 'settings[display_subprojects_issues]', 1, Setting.display_subprojects_issues? %><%= hidden_field_tag 'settings[display_subprojects_issues]', 0 %></p>
10
<%= hidden_field_tag 'settings[display_subprojects_issues]', 0 %>
11
<%= check_box_tag 'settings[display_subprojects_issues]', 1, Setting.display_subprojects_issues? %>
12
</p>
9 13

  
10 14
<p><label><%= l(:setting_issues_export_limit) %></label>
11 15
<%= text_field_tag 'settings[issues_export_limit]', Setting.issues_export_limit, :size => 6 %></p>
app/views/settings/_mail_handler.rhtml
2 2

  
3 3
<div class="box tabular settings">
4 4
<p><label><%= l(:setting_mail_handler_api_enabled) %></label>
5
<%= hidden_field_tag 'settings[mail_handler_api_enabled]', 0 %>
5 6
<%= check_box_tag 'settings[mail_handler_api_enabled]', 1, Setting.mail_handler_api_enabled?,
6 7
                  :onclick => "if (this.checked) { Form.Element.enable('settings_mail_handler_api_key'); } else { Form.Element.disable('settings_mail_handler_api_key'); }" %>
7
<%= hidden_field_tag 'settings[mail_handler_api_enabled]', 0 %></p>
8
</p>
8 9

  
9 10
<p><label><%= l(:setting_mail_handler_api_key) %></label>
10 11
<%= text_field_tag 'settings[mail_handler_api_key]', Setting.mail_handler_api_key, 
app/views/settings/_notifications.rhtml
6 6
<%= text_field_tag 'settings[mail_from]', Setting.mail_from, :size => 60 %></p>
7 7

  
8 8
<p><label><%= l(:setting_bcc_recipients) %></label>
9
<%= hidden_field_tag 'settings[bcc_recipients]', 0 %>
9 10
<%= check_box_tag 'settings[bcc_recipients]', 1, Setting.bcc_recipients? %>
10
<%= hidden_field_tag 'settings[bcc_recipients]', 0 %></p>
11
</p>
11 12

  
12 13
<p><label><%= l(:setting_plain_text_mail) %></label>
14
<%= hidden_field_tag 'settings[plain_text_mail]', 0 %>
13 15
<%= check_box_tag 'settings[plain_text_mail]', 1, Setting.plain_text_mail? %>
14
<%= hidden_field_tag 'settings[plain_text_mail]', 0 %></p>
16
</p>
15 17
</div>
16 18

  
17 19
<fieldset class="box" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend>
app/views/settings/_projects.rhtml
2 2

  
3 3
<div class="box tabular settings">
4 4
<p><label><%= l(:setting_default_projects_public) %></label>
5
<%= check_box_tag 'settings[default_projects_public]', 1, Setting.default_projects_public? %><%= hidden_field_tag 'settings[default_projects_public]', 0 %></p>
5
<%= hidden_field_tag 'settings[default_projects_public]', 0 %>
6
<%= check_box_tag 'settings[default_projects_public]', 1, Setting.default_projects_public? %>
7
</p>
6 8

  
7 9
<p><label><%= l(:setting_sequential_project_identifiers) %></label>
8
<%= check_box_tag 'settings[sequential_project_identifiers]', 1, Setting.sequential_project_identifiers? %><%= hidden_field_tag 'settings[sequential_project_identifiers]', 0 %></p>
10
<%= hidden_field_tag 'settings[sequential_project_identifiers]', 0 %>
11
<%= check_box_tag 'settings[sequential_project_identifiers]', 1, Setting.sequential_project_identifiers? %>
12
</p>
9 13

  
10 14
<p><label><%= l(:setting_new_project_user_role_id) %></label>
11 15
<%= select_tag('settings[new_project_user_role_id]', options_for_select([["--- #{l(:actionview_instancetag_blank_option)} ---", '']] + Role.find_all_givable.collect {|r| [r.name, r.id]}, Setting.new_project_user_role_id.to_i)) %></p>
app/views/settings/_repositories.rhtml
2 2

  
3 3
<div class="box tabular settings">
4 4
<p><label><%= l(:setting_autofetch_changesets) %></label>
5
<%= check_box_tag 'settings[autofetch_changesets]', 1, Setting.autofetch_changesets? %><%= hidden_field_tag 'settings[autofetch_changesets]', 0 %></p>
5
<%= hidden_field_tag 'settings[autofetch_changesets]', 0 %>
6
<%= check_box_tag 'settings[autofetch_changesets]', 1, Setting.autofetch_changesets? %>
7
</p>
6 8

  
7 9
<p><label><%= l(:setting_sys_api_enabled) %></label>
8
<%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %><%= hidden_field_tag 'settings[sys_api_enabled]', 0 %></p>
10
<%= hidden_field_tag 'settings[sys_api_enabled]', 0 %>
11
<%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %>
12
</p>
9 13

  
10 14
<p><label><%= l(:setting_enabled_scm) %></label>
11 15
<% REDMINE_SUPPORTED_SCM.each do |scm| -%>
config/boot.rb
1 1
# Don't change this file!
2 2
# Configure your app in config/environment.rb and config/environments/*.rb
3 3

  
4
RAILS_ROOT = File.expand_path("#{File.dirname(__FILE__)}/..") unless defined?(RAILS_ROOT)
4
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
5 5

  
6 6
module Rails
7 7
  class << self
......
44 44
    def load_initializer
45 45
      require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46 46
      Rails::Initializer.run(:install_gem_spec_stubs)
47
      Rails::GemDependency.add_frozen_gem_path
47 48
    end
48 49
  end
49 50

  
......
81 82
      end
82 83

  
83 84
      def load_rubygems
85
        min_version = '1.3.2'
84 86
        require 'rubygems'
85
        min_version = '1.3.1'
86 87
        unless rubygems_version >= min_version
87 88
          $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
88 89
          exit 1
config/environment.rb
5 5
# ENV['RAILS_ENV'] ||= 'production'
6 6

  
7 7
# Specifies gem version of Rails to use when vendor/rails is not present
8
RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
8
RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
9 9

  
10 10
# Bootstrap the Rails environment, frameworks, and default configuration
11 11
require File.join(File.dirname(__FILE__), 'boot')
config/initializers/10-patches.rb
33 33
            end
34 34
          else
35 35
            attr_name = @base.class.human_attribute_name(attr)
36
            full_messages << attr_name + ' ' + message
36
            full_messages << attr_name + ' ' + message.to_s
37 37
          end
38 38
        end
39 39
      end
config/initializers/backtrace_silencers.rb
1
# Be sure to restart your server when you modify this file.
2

  
3
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5

  
6
# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
7
# Rails.backtrace_cleaner.remove_silencers!
config/initializers/inflections.rb
1
# Be sure to restart your server when you modify this file.
2

  
3
# Add new inflection rules using the following format 
4
# (all these examples are active by default):
5
# ActiveSupport::Inflector.inflections do |inflect|
6
#   inflect.plural /^(ox)$/i, '\1en'
7
#   inflect.singular /^(ox)en/i, '\1'
8
#   inflect.irregular 'person', 'people'
9
#   inflect.uncountable %w( fish sheep )
10
# end
config/locales/bg.yml
59 59
      over_x_years:
60 60
        one:   "over 1 year"
61 61
        other: "over {{count}} years"
62

  
63
  number: 
64
    human: 
65
      format: 
66
        precision: 1
67
        delimiter: ""
68
      storage_units: 
69
        format: "%n %u"
70
        units: 
71
          kb: KB
72
          tb: TB
73
          gb: GB
74
          byte: 
75
            one: Byte
76
            other: Bytes
77
          mb: 'MB'
62 78
      
63 79
# Used in array.to_sentence.
64 80
  support:
......
803 819
  text_journal_changed: "{{label}} changed from {{old}} to {{new}}"
804 820
  text_journal_set_to: "{{label}} set to {{value}}"
805 821
  text_journal_deleted: "{{label}} deleted"
822

  
config/locales/bs.yml
83 83
      format:
84 84
        delimiter: ""
85 85
        precision: 1
86

  
87

  
88

  
86
      storage_units:
87
        format: "%n %u"
88
        units:
89
          byte:
90
            one: "Byte"
91
            other: "Bytes"
92
          kb: "KB"
93
          mb: "MB"
94
          gb: "GB"
95
          tb: "TB"
89 96
        
90 97
# Used in array.to_sentence.
91 98
  support:
config/locales/ca.yml
59 59
      over_x_years:
60 60
        one:   "més d'un any"
61 61
        other: "més de {{count}} anys"
62

  
63
  number:
64
    human:
65
      format:
66
        delimiter: ""
67
        precision: 1
68
      storage_units:
69
        format: "%n %u"
70
        units:
71
          byte:
72
            one: "Byte"
73
            other: "Bytes"
74
          kb: "KB"
75
          mb: "MB"
76
          gb: "GB"
77
          tb: "TB"
62 78
        
63 79
# Used in array.to_sentence.
64 80
  support:
config/locales/cs.yml
59 59
      over_x_years:
60 60
        one:   "více než 1 rok"
61 61
        other: "více než {{count}} roky"
62

  
63
  number: 
64
    human: 
65
      format: 
66
        precision: 1
67
        delimiter: ""
68
      storage_units: 
69
        format: "%n %u"
70
        units: 
71
          kb: KB
72
          tb: TB
73
          gb: GB
74
          byte: 
75
            one: Byte
76
            other: Bytes
77
          mb: MB
62 78
        
63 79
# Used in array.to_sentence.
64 80
  support:
config/locales/da.yml
85 85
        # separator: 
86 86
        delimiter: ""
87 87
        precision: 1
88
      storage_units: [Bytes, KB, MB, GB, TB]
88
      storage_units:
89
        format: "%n %u"
90
        units:
91
          byte:
92
            one: "Byte"
93
            other: "Bytes"
94
          kb: "KB"
95
          mb: "MB"
96
          gb: "GB"
97
          tb: "TB"
89 98
    percentage:
90 99
      format:
91 100
        # separator:
config/locales/de.yml
83 83
      format:
84 84
        delimiter: ""
85 85
        precision: 1
86
      storage_units:
87
        format: "%n %u"
88
        units:
89
          byte:
90
            one: "Byte"
91
            other: "Bytes"
92
          kb: "KB"
93
          mb: "MB"
94
          gb: "GB"
95
          tb: "TB"
86 96

  
87 97
  support:
88 98
    array:
config/locales/el.yml
63 63
        one:   "πάνω από 1 χρόνο"
64 64
        other: "πάνω από {{count}} χρόνια"
65 65
        
66
  number: 
67
    human: 
68
      format: 
69
        precision: 1
70
        delimiter: ""
71
      storage_units: 
72
        format: "%n %u"
73
        units: 
74
          kb: KB
75
          tb: TB
76
          gb: GB
77
          byte: 
78
            one: Byte
79
            other: Bytes
80
          mb: MB
81

  
66 82
# Used in array.to_sentence.
67 83
  support:
68 84
    array:
config/locales/en.yml
59 59
      over_x_years:
60 60
        one:   "over 1 year"
61 61
        other: "over {{count}} years"
62

  
63
  number:
64
    human:
65
      format:
66
        delimiter: ""
67
        precision: 1
68
      storage_units:
69
        format: "%n %u"
70
        units:
71
          byte:
72
            one: "Byte"
73
            other: "Bytes"
74
          kb: "KB"
75
          mb: "MB"
76
          gb: "GB"
77
          tb: "TB"
78

  
62 79
        
63 80
# Used in array.to_sentence.
64 81
  support:
config/locales/es.yml
47 47
        # separator: 
48 48
        delimiter: "" 
49 49
        precision: 1
50
      storage_units:
51
        format: "%n %u"
52
        units:
53
          byte:
54
            one: "Byte"
55
            other: "Bytes"
56
          kb: "KB"
57
          mb: "MB"
58
          gb: "GB"
59
          tb: "TB"
50 60

  
51 61
  # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
52 62
  datetime:
config/locales/fi.yml
61 61
      format:
62 62
        delimiter: ""
63 63
        precision: 1
64
      storage_units: [Tavua, KB, MB, GB, TB]
64
      storage_units:
65
        format: "%n %u"
66
        units:
67
          byte:
68
            one: "Tavua"
69
            other: "Tavua"
70
          kb: "KB"
71
          mb: "MB"
72
          gb: "GB"
73
          tb: "TB"
65 74
 
66 75
  datetime:
67 76
    distance_in_words:
config/locales/fr.yml
84 84
    human:
85 85
      format:
86 86
        precision: 2
87
      storage_units: [ Octet, ko, Mo, Go, To ]
87
      storage_units:
88
        format: "%n %u"
89
        units:
90
          byte:
91
            one: "Octet"
92
            other: "Octet"
93
          kb: "ko"
94
          mb: "Mo"
95
          gb: "Go"
96
          tb: "To"
88 97
  
89 98
  support:
90 99
    array:
config/locales/gl.yml
33 33
        # separator: 
34 34
        delimiter: "" 
35 35
        precision: 1
36
      storage_units:
37
        format: "%n %u"
38
        units:
39
          byte:
40
            one: "Byte"
41
            other: "Bytes"
42
          kb: "KB"
43
          mb: "MB"
44
          gb: "GB"
45
          tb: "TB"
36 46
  
37 47
  
38 48
  date:
config/locales/he.yml
76 76
        unit: 'שח'
77 77
        precision: 2
78 78
        format: '%u %n'
79
    human:
80
      storage_units:
81
        format: "%n %u"
82
        units:
83
          byte:
84
            one: "Byte"
85
            other: "Bytes"
86
          kb: "KB"
87
          mb: "MB"
88
          gb: "GB"
89
          tb: "TB"
79 90
        
80 91
  support:
81 92
    array:
config/locales/hu.yml
90 90
      format:
91 91
        delimiter: ""
92 92
        precision: 1
93
      storage_units: [bájt, KB, MB, GB, TB]
93
      storage_units:
94
        format: "%n %u"
95
        units:
96
          byte:
97
            one: "bájt"
98
            other: "bájt"
99
          kb: "KB"
100
          mb: "MB"
101
          gb: "GB"
102
          tb: "TB"
94 103

  
95 104
  support:
96 105
    array:
config/locales/it.yml
74 74
        unit: '€'
75 75
        precision: 2
76 76
        format: '%n %u'
77
    human:
78
      storage_units:
79
        format: "%n %u"
80
        units:
81
          byte:
82
            one: "Byte"
83
            other: "Bytes"
84
          kb: "KB"
85
          mb: "MB"
86
          gb: "GB"
87
          tb: "TB"
77 88
        
78 89
  support:
79 90
    array:
config/locales/ja.yml
96 96
      format:
97 97
        delimiter: ""
98 98
        precision: 1
99
      storage_units:
100
        format: "%n %u"
101
        units:
102
          byte:
103
            one: "Byte"
104
            other: "Bytes"
105
          kb: "KB"
106
          mb: "MB"
107
          gb: "GB"
108
          tb: "TB"
99 109

  
100 110
  activerecord:
101 111
    errors:
config/locales/ko.yml
112 112
        # separator: 
113 113
        delimiter: ""
114 114
        precision: 1
115
      storage_units: [Bytes, KB, MB, GB, TB]
115
      storage_units:
116
        format: "%n %u"
117
        units:
118
          byte:
119
            one: "Byte"
120
            other: "Bytes"
121
          kb: "KB"
122
          mb: "MB"
123
          gb: "GB"
124
          tb: "TB"
116 125

  
117 126
# Used in array.to_sentence.
118 127
  support:
config/locales/lt.yml
28 28
      format:
29 29
        delimiter: ""
30 30
        precision: 1
31
      storage_units: [baitai, KB, MB, GB, TB]
31
      storage_units:
32
        format: "%n %u"
33
        units:
34
          byte:
35
            one: "baitai"
36
            other: "baitai"
37
          kb: "KB"
38
          mb: "MB"
39
          gb: "GB"
40
          tb: "TB"
32 41

  
33 42
  datetime:
34 43
    distance_in_words:
config/locales/nl.yml
59 59
      over_x_years:
60 60
        one:   "over 1 jaar"
61 61
        other: "over {{count}} jaren"
62

  
63
  number: 
64
    human: 
65
      format: 
66
        precision: 1
67
        delimiter: ""
68
      storage_units: 
69
        format: "%n %u"
70
        units: 
71
          kb: KB
72
          tb: TB
73
          gb: GB
74
          byte: 
75
            one: Byte
76
            other: Bytes
77
          mb: MB
62 78
        
63 79
# Used in array.to_sentence.
64 80
  support:
config/locales/no.yml
67 67
      format:
68 68
        delimiter: ""
69 69
        precision: 4
70
    human:
71
      storage_units:
72
        format: "%n %u"
73
        units:
74
          byte:
75
            one: "Byte"
76
            other: "Bytes"
77
          kb: "KB"
78
          mb: "MB"
79
          gb: "GB"
80
          tb: "TB"
81

  
70 82
  activerecord:
71 83
    errors:
72 84
      template:
config/locales/pl.yml
21 21
      format:
22 22
        delimiter: ""
23 23
        precision: 1
24
      storage_units: [B, KB, MB, GB, TB]
24
      storage_units:
25
        format: "%n %u"
26
        units:
27
          byte:
28
            one: "B"
29
            other: "B"
30
          kb: "KB"
31
          mb: "MB"
32
          gb: "GB"
33
          tb: "TB"
25 34

  
26 35
  date:
27 36
    formats:
config/locales/pt-BR.yml
93 93
      format:
94 94
        precision: 1
95 95
        delimiter: '.'
96
      storage_units:
97
        format: "%n %u"
98
        units:
99
          byte:
100
            one: "Byte"
101
            other: "Bytes"
102
          kb: "KB"
103
          mb: "MB"
104
          gb: "GB"
105
          tb: "TB"
96 106
  support:
97 107
    array:
98 108
      sentence_connector: "e"
config/locales/pt.yml
83 83
      format:
84 84
        precision: 1
85 85
        delimiter: ''
86
      storage_units:
87
        format: "%n %u"
88
        units:
89
          byte:
90
            one: "Byte"
91
            other: "Bytes"
92
          kb: "KB"
93
          mb: "MB"
94
          gb: "GB"
95
          tb: "TB"
86 96

  
87 97
  activerecord:
88 98
    errors:
config/locales/ro.yml
57 57
      over_x_years:
58 58
        one:   "peste un an"
59 59
        other: "peste {{count}} ani"
60

  
61
  number: 
62
    human: 
63
      format: 
64
        precision: 1
65
        delimiter: ""
66
      storage_units: 
67
        format: "%n %u"
68
        units: 
69
          kb: KB
70
          tb: TB
71
          gb: GB
72
          byte: 
73
            one: Byte
74
            other: Bytes
75
          mb: MB
60 76
        
61 77
# Used in array.to_sentence.
62 78
  support:
config/locales/sk.yml
808 808
  text_journal_changed: "{{label}} changed from {{old}} to {{new}}"
809 809
  text_journal_set_to: "{{label}} set to {{value}}"
810 810
  text_journal_deleted: "{{label}} deleted"
811
  number: 
812
    human: 
813
      format: 
814
        precision: 1
815
        delimiter: ""
816
      storage_units: 
817
        format: "%n %u"
818
        units: 
819
          kb: KB
820
          tb: TB
821
          gb: GB
822
          byte: 
823
            one: Byte
824
            other: Bytes
825
          mb: MB
config/locales/sl.yml
59 59
      over_x_years:
60 60
        one:   "over 1 year"
61 61
        other: "over {{count}} years"
62

  
63
  number: 
64
    human: 
65
      format: 
66
        precision: 1
67
        delimiter: ""
68
      storage_units: 
69
        format: "%n %u"
70
        units: 
71
          kb: KB
72
          tb: TB
73
          gb: GB
74
          byte: 
75
            one: Byte
76
            other: Bytes
77
          mb: MB
62 78
        
63 79
# Used in array.to_sentence.
64 80
  support:
config/locales/sr.yml
81 81
        unit: 'ДИН'
82 82
        precision: 2
83 83
        format: '%n %u'
84
    human:
85
      storage_units:
86
        format: "%n %u"
87
        units:
88
          byte:
89
            one: "Byte"
90
            other: "Bytes"
91
          kb: "KB"
92
          mb: "MB"
93
          gb: "GB"
94
          tb: "TB"
84 95

  
85 96
  support:
86 97
    array:
config/locales/sv.yml
47 47
        # separator: 
48 48
        delimiter: ""
49 49
        # precision: 1
50
      storage_units: [Byte, KB, MB, GB, TB]
50
      storage_units:
51
        format: "%n %u"
52
        units:
53
          byte:
54
            one: "Byte"
55
            other: "Bytes"
56
          kb: "KB"
57
          mb: "MB"
58
          gb: "GB"
59
          tb: "TB"
51 60

  
52 61
  # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
53 62
  datetime:
config/locales/th.yml
59 59
      over_x_years:
60 60
        one:   "over 1 year"
61 61
        other: "over {{count}} years"
62

  
63
  number: 
64
    human: 
65
      format: 
66
        precision: 1
67
        delimiter: ""
68
      storage_units: 
69
        format: "%n %u"
70
        units: 
71
          kb: KB
72
          tb: TB
73
          gb: GB
74
          byte: 
75
            one: Byte
76
            other: Bytes
77
          mb: MB
62 78
        
63 79
# Used in array.to_sentence.
64 80
  support:
config/locales/tr.yml
92 92
        delimiter: '.'
93 93
        separator: ','
94 94
        precision: 2
95
      storage_units:
96
        format: "%n %u"
97
        units:
98
          byte:
99
            one: "Byte"
100
            other: "Bytes"
101
          kb: "KB"
102
          mb: "MB"
103
          gb: "GB"
104
          tb: "TB"
95 105

  
96 106
  support:
97 107
    array:
config/locales/uk.yml
59 59
      over_x_years:
60 60
        one:   "over 1 year"
61 61
        other: "over {{count}} years"
62

  
63
  number: 
64
    human: 
65
      format: 
66
        precision: 1
67
        delimiter: ""
68
      storage_units: 
69
        format: "%n %u"
70
        units: 
71
          kb: KB
72
          tb: TB
73
          gb: GB
74
          byte: 
75
            one: Byte
76
            other: Bytes
77
          mb: MB
62 78
        
63 79
# Used in array.to_sentence.
64 80
  support:
... This diff was truncated because it exceeds the maximum size that can be displayed.