@@ -5,19 +5,19 | |||||
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 |
# |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 |
# |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
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 |
|
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. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class SettingsController < ApplicationController |
|
18 | class SettingsController < ApplicationController | |
19 | before_filter :require_admin |
|
19 | before_filter :require_admin | |
20 |
|
20 | |||
21 | def index |
|
21 | def index | |
22 | edit |
|
22 | edit | |
23 | render :action => 'edit' |
|
23 | render :action => 'edit' | |
@@ -39,8 +39,11 class SettingsController < ApplicationController | |||||
39 | @options = {} |
|
39 | @options = {} | |
40 | @options[:user_format] = User::USER_FORMATS.keys.collect {|f| [User.current.name(f), f.to_s] } |
|
40 | @options[:user_format] = User::USER_FORMATS.keys.collect {|f| [User.current.name(f), f.to_s] } | |
41 | @deliveries = ActionMailer::Base.perform_deliveries |
|
41 | @deliveries = ActionMailer::Base.perform_deliveries | |
|
42 | ||||
|
43 | @guessed_host_and_path = request.host_with_port | |||
|
44 | @guessed_host_and_path << ('/'+ request.relative_url_root.gsub(%r{^\/}, '')) unless request.relative_url_root.blank? | |||
42 | end |
|
45 | end | |
43 |
|
46 | |||
44 | def plugin |
|
47 | def plugin | |
45 | plugin_id = params[:id].to_sym |
|
48 | plugin_id = params[:id].to_sym | |
46 | @plugin = Redmine::Plugin.registered_plugins[plugin_id] |
|
49 | @plugin = Redmine::Plugin.registered_plugins[plugin_id] |
@@ -5,12 +5,12 | |||||
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 |
# |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 |
# |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
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 |
|
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. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
@@ -19,15 +19,15 class Mailer < ActionMailer::Base | |||||
19 | helper :application |
|
19 | helper :application | |
20 | helper :issues |
|
20 | helper :issues | |
21 | helper :custom_fields |
|
21 | helper :custom_fields | |
22 |
|
22 | |||
23 | include ActionController::UrlWriter |
|
23 | include ActionController::UrlWriter | |
24 |
|
24 | |||
25 |
def issue_add(issue) |
|
25 | def issue_add(issue) | |
26 | redmine_headers 'Project' => issue.project.identifier, |
|
26 | redmine_headers 'Project' => issue.project.identifier, | |
27 | 'Issue-Id' => issue.id, |
|
27 | 'Issue-Id' => issue.id, | |
28 | 'Issue-Author' => issue.author.login |
|
28 | 'Issue-Author' => issue.author.login | |
29 | redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to |
|
29 | redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to | |
30 |
recipients issue.recipients |
|
30 | recipients issue.recipients | |
31 | subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}" |
|
31 | subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}" | |
32 | body :issue => issue, |
|
32 | body :issue => issue, | |
33 | :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue) |
|
33 | :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue) | |
@@ -50,7 +50,7 class Mailer < ActionMailer::Base | |||||
50 | :journal => journal, |
|
50 | :journal => journal, | |
51 | :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue) |
|
51 | :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue) | |
52 | end |
|
52 | end | |
53 |
|
53 | |||
54 | def reminder(user, issues, days) |
|
54 | def reminder(user, issues, days) | |
55 | set_language_if_valid user.language |
|
55 | set_language_if_valid user.language | |
56 | recipients user.mail |
|
56 | recipients user.mail | |
@@ -59,7 +59,7 class Mailer < ActionMailer::Base | |||||
59 | :days => days, |
|
59 | :days => days, | |
60 | :issues_url => url_for(:controller => 'issues', :action => 'index', :set_filter => 1, :assigned_to_id => user.id, :sort_key => 'issues.due_date', :sort_order => 'asc') |
|
60 | :issues_url => url_for(:controller => 'issues', :action => 'index', :set_filter => 1, :assigned_to_id => user.id, :sort_key => 'issues.due_date', :sort_order => 'asc') | |
61 | end |
|
61 | end | |
62 |
|
62 | |||
63 | def document_added(document) |
|
63 | def document_added(document) | |
64 | redmine_headers 'Project' => document.project.identifier |
|
64 | redmine_headers 'Project' => document.project.identifier | |
65 | recipients document.project.recipients |
|
65 | recipients document.project.recipients | |
@@ -67,7 +67,7 class Mailer < ActionMailer::Base | |||||
67 | body :document => document, |
|
67 | body :document => document, | |
68 | :document_url => url_for(:controller => 'documents', :action => 'show', :id => document) |
|
68 | :document_url => url_for(:controller => 'documents', :action => 'show', :id => document) | |
69 | end |
|
69 | end | |
70 |
|
70 | |||
71 | def attachments_added(attachments) |
|
71 | def attachments_added(attachments) | |
72 | container = attachments.first.container |
|
72 | container = attachments.first.container | |
73 | added_to = '' |
|
73 | added_to = '' | |
@@ -104,7 +104,7 class Mailer < ActionMailer::Base | |||||
104 | body :message => message, |
|
104 | body :message => message, | |
105 | :message_url => url_for(:controller => 'messages', :action => 'show', :board_id => message.board_id, :id => message.root) |
|
105 | :message_url => url_for(:controller => 'messages', :action => 'show', :board_id => message.board_id, :id => message.root) | |
106 | end |
|
106 | end | |
107 |
|
107 | |||
108 | def account_information(user, password) |
|
108 | def account_information(user, password) | |
109 | set_language_if_valid user.language |
|
109 | set_language_if_valid user.language | |
110 | recipients user.mail |
|
110 | recipients user.mail | |
@@ -113,7 +113,7 class Mailer < ActionMailer::Base | |||||
113 | :password => password, |
|
113 | :password => password, | |
114 | :login_url => url_for(:controller => 'account', :action => 'login') |
|
114 | :login_url => url_for(:controller => 'account', :action => 'login') | |
115 | end |
|
115 | end | |
116 |
|
116 | |||
117 | def account_activation_request(user) |
|
117 | def account_activation_request(user) | |
118 | # Send the email to all active administrators |
|
118 | # Send the email to all active administrators | |
119 | recipients User.find_active(:all, :conditions => {:admin => true}).collect { |u| u.mail }.compact |
|
119 | recipients User.find_active(:all, :conditions => {:admin => true}).collect { |u| u.mail }.compact | |
@@ -128,7 +128,7 class Mailer < ActionMailer::Base | |||||
128 | subject l(:mail_subject_lost_password, Setting.app_title) |
|
128 | subject l(:mail_subject_lost_password, Setting.app_title) | |
129 | body :token => token, |
|
129 | body :token => token, | |
130 | :url => url_for(:controller => 'account', :action => 'lost_password', :token => token.value) |
|
130 | :url => url_for(:controller => 'account', :action => 'lost_password', :token => token.value) | |
131 |
end |
|
131 | end | |
132 |
|
132 | |||
133 | def register(token) |
|
133 | def register(token) | |
134 | set_language_if_valid(token.user.language) |
|
134 | set_language_if_valid(token.user.language) | |
@@ -137,7 +137,7 class Mailer < ActionMailer::Base | |||||
137 | body :token => token, |
|
137 | body :token => token, | |
138 | :url => url_for(:controller => 'account', :action => 'activate', :token => token.value) |
|
138 | :url => url_for(:controller => 'account', :action => 'activate', :token => token.value) | |
139 | end |
|
139 | end | |
140 |
|
140 | |||
141 | def test(user) |
|
141 | def test(user) | |
142 | set_language_if_valid(user.language) |
|
142 | set_language_if_valid(user.language) | |
143 | recipients user.mail |
|
143 | recipients user.mail | |
@@ -148,12 +148,12 class Mailer < ActionMailer::Base | |||||
148 | # Overrides default deliver! method to prevent from sending an email |
|
148 | # Overrides default deliver! method to prevent from sending an email | |
149 | # with no recipient, cc or bcc |
|
149 | # with no recipient, cc or bcc | |
150 | def deliver!(mail = @mail) |
|
150 | def deliver!(mail = @mail) | |
151 |
return false if (recipients.nil? || recipients.empty?) && |
|
151 | return false if (recipients.nil? || recipients.empty?) && | |
152 | (cc.nil? || cc.empty?) && |
|
152 | (cc.nil? || cc.empty?) && | |
153 | (bcc.nil? || bcc.empty?) |
|
153 | (bcc.nil? || bcc.empty?) | |
154 | super |
|
154 | super | |
155 | end |
|
155 | end | |
156 |
|
156 | |||
157 | # Sends reminders to issue assignees |
|
157 | # Sends reminders to issue assignees | |
158 | # Available options: |
|
158 | # Available options: | |
159 | # * :days => how many days in the future to remind about (defaults to 7) |
|
159 | # * :days => how many days in the future to remind about (defaults to 7) | |
@@ -163,13 +163,13 class Mailer < ActionMailer::Base | |||||
163 | days = options[:days] || 7 |
|
163 | days = options[:days] || 7 | |
164 | project = options[:project] ? Project.find(options[:project]) : nil |
|
164 | project = options[:project] ? Project.find(options[:project]) : nil | |
165 | tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil |
|
165 | tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil | |
166 |
|
166 | |||
167 | s = ARCondition.new ["#{IssueStatus.table_name}.is_closed = ? AND #{Issue.table_name}.due_date <= ?", false, days.day.from_now.to_date] |
|
167 | s = ARCondition.new ["#{IssueStatus.table_name}.is_closed = ? AND #{Issue.table_name}.due_date <= ?", false, days.day.from_now.to_date] | |
168 | s << "#{Issue.table_name}.assigned_to_id IS NOT NULL" |
|
168 | s << "#{Issue.table_name}.assigned_to_id IS NOT NULL" | |
169 | s << "#{Project.table_name}.status = #{Project::STATUS_ACTIVE}" |
|
169 | s << "#{Project.table_name}.status = #{Project::STATUS_ACTIVE}" | |
170 | s << "#{Issue.table_name}.project_id = #{project.id}" if project |
|
170 | s << "#{Issue.table_name}.project_id = #{project.id}" if project | |
171 | s << "#{Issue.table_name}.tracker_id = #{tracker.id}" if tracker |
|
171 | s << "#{Issue.table_name}.tracker_id = #{tracker.id}" if tracker | |
172 |
|
172 | |||
173 | issues_by_assignee = Issue.find(:all, :include => [:status, :assigned_to, :project, :tracker], |
|
173 | issues_by_assignee = Issue.find(:all, :include => [:status, :assigned_to, :project, :tracker], | |
174 | :conditions => s.conditions |
|
174 | :conditions => s.conditions | |
175 | ).group_by(&:assigned_to) |
|
175 | ).group_by(&:assigned_to) | |
@@ -185,17 +185,18 class Mailer < ActionMailer::Base | |||||
185 | from Setting.mail_from |
|
185 | from Setting.mail_from | |
186 | default_url_options[:host] = Setting.host_name |
|
186 | default_url_options[:host] = Setting.host_name | |
187 | default_url_options[:protocol] = Setting.protocol |
|
187 | default_url_options[:protocol] = Setting.protocol | |
|
188 | default_url_options[:skip_relative_url_root] = true | |||
188 | # Common headers |
|
189 | # Common headers | |
189 | headers 'X-Mailer' => 'Redmine', |
|
190 | headers 'X-Mailer' => 'Redmine', | |
190 | 'X-Redmine-Host' => Setting.host_name, |
|
191 | 'X-Redmine-Host' => Setting.host_name, | |
191 | 'X-Redmine-Site' => Setting.app_title |
|
192 | 'X-Redmine-Site' => Setting.app_title | |
192 | end |
|
193 | end | |
193 |
|
194 | |||
194 | # Appends a Redmine header field (name is prepended with 'X-Redmine-') |
|
195 | # Appends a Redmine header field (name is prepended with 'X-Redmine-') | |
195 | def redmine_headers(h) |
|
196 | def redmine_headers(h) | |
196 | h.each { |k,v| headers["X-Redmine-#{k}"] = v } |
|
197 | h.each { |k,v| headers["X-Redmine-#{k}"] = v } | |
197 | end |
|
198 | end | |
198 |
|
199 | |||
199 | # Overrides the create_mail method |
|
200 | # Overrides the create_mail method | |
200 | def create_mail |
|
201 | def create_mail | |
201 | # Removes the current user from the recipients and cc |
|
202 | # Removes the current user from the recipients and cc | |
@@ -209,10 +210,10 class Mailer < ActionMailer::Base | |||||
209 | bcc([recipients, cc].flatten.compact.uniq) |
|
210 | bcc([recipients, cc].flatten.compact.uniq) | |
210 | recipients [] |
|
211 | recipients [] | |
211 | cc [] |
|
212 | cc [] | |
212 |
end |
|
213 | end | |
213 | super |
|
214 | super | |
214 | end |
|
215 | end | |
215 |
|
216 | |||
216 | # Renders a message with the corresponding layout |
|
217 | # Renders a message with the corresponding layout | |
217 | def render_message(method_name, body) |
|
218 | def render_message(method_name, body) | |
218 | layout = method_name.match(%r{text\.html\.(rhtml|rxml)}) ? 'layout.text.html.rhtml' : 'layout.text.plain.rhtml' |
|
219 | layout = method_name.match(%r{text\.html\.(rhtml|rxml)}) ? 'layout.text.html.rhtml' : 'layout.text.plain.rhtml' | |
@@ -234,7 +235,7 class Mailer < ActionMailer::Base | |||||
234 | end |
|
235 | end | |
235 | return value |
|
236 | return value | |
236 | end |
|
237 | end | |
237 |
|
238 | |||
238 | # Makes partial rendering work with Rails 1.2 (retro-compatibility) |
|
239 | # Makes partial rendering work with Rails 1.2 (retro-compatibility) | |
239 | def self.controller_path |
|
240 | def self.controller_path | |
240 | '' |
|
241 | '' |
@@ -33,7 +33,8 | |||||
33 | <%= text_field_tag 'settings[activity_days_default]', Setting.activity_days_default, :size => 6 %> <%= l(:label_day_plural) %></p> |
|
33 | <%= text_field_tag 'settings[activity_days_default]', Setting.activity_days_default, :size => 6 %> <%= l(:label_day_plural) %></p> | |
34 |
|
34 | |||
35 | <p><label><%= l(:setting_host_name) %></label> |
|
35 | <p><label><%= l(:setting_host_name) %></label> | |
36 |
<%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %></ |
|
36 | <%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %><br /> | |
|
37 | <em><%= l(:label_example) %>: <%= @guessed_host_and_path %></em></p> | |||
37 |
|
38 | |||
38 | <p><label><%= l(:setting_protocol) %></label> |
|
39 | <p><label><%= l(:setting_protocol) %></label> | |
39 | <%= select_tag 'settings[protocol]', options_for_select(['http', 'https'], Setting.protocol) %></p> |
|
40 | <%= select_tag 'settings[protocol]', options_for_select(['http', 'https'], Setting.protocol) %></p> |
@@ -196,7 +196,7 setting_issues_export_limit: Issues export limit | |||||
196 | setting_mail_from: Emission email address |
|
196 | setting_mail_from: Emission email address | |
197 | setting_bcc_recipients: Blind carbon copy recipients (bcc) |
|
197 | setting_bcc_recipients: Blind carbon copy recipients (bcc) | |
198 | setting_plain_text_mail: plain text mail (no HTML) |
|
198 | setting_plain_text_mail: plain text mail (no HTML) | |
199 | setting_host_name: Host name |
|
199 | setting_host_name: Host name and path | |
200 | setting_text_formatting: Text formatting |
|
200 | setting_text_formatting: Text formatting | |
201 | setting_wiki_compression: Wiki history compression |
|
201 | setting_wiki_compression: Wiki history compression | |
202 | setting_feeds_limit: Feed content limit |
|
202 | setting_feeds_limit: Feed content limit | |
@@ -576,6 +576,7 label_planning: Planning | |||||
576 | label_incoming_emails: Incoming emails |
|
576 | label_incoming_emails: Incoming emails | |
577 | label_generate_key: Generate a key |
|
577 | label_generate_key: Generate a key | |
578 | label_issue_watchers: Watchers |
|
578 | label_issue_watchers: Watchers | |
|
579 | label_example: Example | |||
579 |
|
580 | |||
580 | button_login: Login |
|
581 | button_login: Login | |
581 | button_submit: Submit |
|
582 | button_submit: Submit |
@@ -197,7 +197,7 setting_issues_export_limit: Limite export demandes | |||||
197 | setting_mail_from: Adresse d'émission |
|
197 | setting_mail_from: Adresse d'émission | |
198 | setting_bcc_recipients: Destinataires en copie cachée (cci) |
|
198 | setting_bcc_recipients: Destinataires en copie cachée (cci) | |
199 | setting_plain_text_mail: Mail texte brut (non HTML) |
|
199 | setting_plain_text_mail: Mail texte brut (non HTML) | |
200 | setting_host_name: Nom d'hôte |
|
200 | setting_host_name: Nom d'hôte et chemin | |
201 | setting_text_formatting: Formatage du texte |
|
201 | setting_text_formatting: Formatage du texte | |
202 | setting_wiki_compression: Compression historique wiki |
|
202 | setting_wiki_compression: Compression historique wiki | |
203 | setting_feeds_limit: Limite du contenu des flux RSS |
|
203 | setting_feeds_limit: Limite du contenu des flux RSS | |
@@ -576,6 +576,7 label_planning: Planning | |||||
576 | label_incoming_emails: Emails entrants |
|
576 | label_incoming_emails: Emails entrants | |
577 | label_generate_key: Générer une clé |
|
577 | label_generate_key: Générer une clé | |
578 | label_issue_watchers: Utilisateurs surveillant cette demande |
|
578 | label_issue_watchers: Utilisateurs surveillant cette demande | |
|
579 | label_example: Exemple | |||
579 |
|
580 | |||
580 | button_login: Connexion |
|
581 | button_login: Connexion | |
581 | button_submit: Soumettre |
|
582 | button_submit: Soumettre |
General Comments 0
You need to be logged in to leave comments.
Login now