aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-07-26 14:25:57 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-07-26 18:23:56 +0400
commitb508728dc8d993a5b4ad5839b9553228b3ef4b47 (patch)
tree3582bdc3962c5c10438cadde42849610e42214e3 /sonar-server/src/main
parentfea2ef37ed0a1dfa73ebdd87799f5caa298aa2f2 (diff)
downloadsonarqube-b508728dc8d993a5b4ad5839b9553228b3ef4b47.tar.gz
sonarqube-b508728dc8d993a5b4ad5839b9553228b3ef4b47.zip
SONAR-2596,SONAR-2601 UI for email notifications
* Add email configuration to sidebar menu * I18n for email and notifications settings * Email configuration properties must be secured * Rename sonar-email-plugin to sonar-email-notifications-plugin
Diffstat (limited to 'sonar-server/src/main')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/email_configuration_controller.rb7
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb26
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/email_configuration/index.html.erb36
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb1
4 files changed, 38 insertions, 32 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/email_configuration_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/email_configuration_controller.rb
index 163ece76c50..3d877da0921 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/email_configuration_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/email_configuration_controller.rb
@@ -48,10 +48,11 @@ class EmailConfigurationController < ApplicationController
subject = params[:subject]
message = params[:message]
if to_address.blank?
- flash[:notice] = 'You must provide address where to send test email'
+ flash[:notice] = message('email_configuration.test.to_address_required')
else
begin
- java_facade.getComponentByClassname('email', 'org.sonar.plugins.email.EmailNotificationChannel').sendTestEmail(to_address, subject, message)
+ java_facade.getComponentByClassname('emailnotifications', 'org.sonar.plugins.emailnotifications.EmailNotificationChannel').sendTestEmail(to_address, subject, message)
+ flash[:notice] = message('email_configuration.test.email_was_sent_to_x', :params => [to_address])
rescue Exception => e
flash[:error] = e.message
end
@@ -62,7 +63,7 @@ class EmailConfigurationController < ApplicationController
private
def configuration
- java_facade.getComponentByClassname('email', 'org.sonar.plugins.email.EmailConfiguration').class
+ java_facade.getComponentByClassname('emailnotifications', 'org.sonar.plugins.emailnotifications.EmailConfiguration').class
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb
index 1bf9a705b24..f91269107bf 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb
@@ -29,9 +29,9 @@
<h1>Change password</h1>
<br/>
<% form_tag( {:action => 'change_password' }, :id => 'pass_form_tag', :name => 'pass_form_tag') do -%>
- <table>
- <tr>
- <td nowrap>
+ <table>
+ <tr>
+ <td nowrap>
<label for="old_password"><b>Old value:</b></label>
</td>
<td class="sep"> </td>
@@ -40,7 +40,7 @@
</td>
</tr>
<tr>
- <td nowrap>
+ <td nowrap>
<label for="password"><b>New value:</b></label>
</td>
<td class="sep"> </td>
@@ -49,7 +49,7 @@
</td>
</tr>
<tr>
- <td nowrap>
+ <td nowrap>
<label for="password_confirmation"><b>Confirm new value:</b></label>
</td>
<td class="sep"> </td>
@@ -58,15 +58,15 @@
</td>
</tr>
- </table>
- <br/>
- <%= submit_tag 'Change password' %>
+ </table>
+ <br/>
+ <%= submit_tag 'Change password' %>
<% end %>
- <script type="text/javascript">
- //<![CDATA[
+ <script type="text/javascript">
+ //<![CDATA[
$('pass_form_tag').focusFirstElement();
//]]>
- </script>
+ </script>
<% end -%>
<br/>
@@ -77,12 +77,12 @@
<tr>
<td></td>
<% for channel in @channels %>
- <td><%= channel.getKey() %></td>
+ <td><%= message('notification.channel.' + channel.getKey()) -%></td>
<% end %>
</tr>
<% for dispatcher in @dispatchers %>
<tr>
- <td><%= dispatcher.getKey() %></td>
+ <td><%= message('notification.dispatcher.' + dispatcher.getKey()) -%></td>
<td>
<%
for channel in @channels
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/email_configuration/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/email_configuration/index.html.erb
index d59ec3a089b..a0f53d63264 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/email_configuration/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/email_configuration/index.html.erb
@@ -1,9 +1,10 @@
-<h1>Email configuration</h1>
+<h1><%= message('email_configuration.page') -%></h1>
+<br/>
<% form_tag({:action => 'save'}) do -%>
<table>
<tr>
<td nowrap>
- <label for="smtp_host"><b>SMTP Host:</b></label>
+ <label for="smtp_host"><b><%= message('email_configuration.smtp_host') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -13,7 +14,7 @@
<tr>
<td nowrap>
- <label for="smtp_port"><b>SMTP Port:</b></label>
+ <label for="smtp_port"><b><%= message('email_configuration.smtp_port') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -23,7 +24,7 @@
<tr>
<td nowrap>
- <label for="smtp_port"><b>Use TLS:</b></label>
+ <label for="smtp_port"><b><%= message('email_configuration.use_tls') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -33,7 +34,7 @@
<tr>
<td nowrap>
- <label for="smtp_username"><b>SMTP Username:</b></label>
+ <label for="smtp_username"><b><%= message('email_configuration.smtp_username') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -43,7 +44,7 @@
<tr>
<td nowrap>
- <label for="smtp_password"><b>SMTP Password:</b></label>
+ <label for="smtp_password"><b><%= message('email_configuration.smtp_password') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -53,7 +54,7 @@
<tr>
<td nowrap>
- <label for="email_from"><b>From address:</b></label>
+ <label for="email_from"><b><%= message('email_configuration.from_address') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -63,7 +64,7 @@
<tr>
<td nowrap>
- <label for="email_prefix"><b>Email prefix:</b></label>
+ <label for="email_prefix"><b><%= message('email_configuration.email_prefix') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -71,16 +72,18 @@
</td>
</tr>
</table>
- <%= submit_tag %>
+ <br/>
+ <%= submit_tag message('save') %>
<% end -%>
<br/>
-<h1>Send Test Email</h1>
+<h1><%= message('email_configuration.test.title') -%></h1>
+<br/>
<% form_tag({:action => 'send_test_email'}) do -%>
<table>
<tr>
<td nowrap>
- <label for="to_address"><b>To:</b></label>
+ <label for="to_address"><b><%= message('email_configuration.test.to_address') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -89,22 +92,23 @@
</tr>
<tr>
<td nowrap>
- <label for="subject"><b>Subject:</b></label>
+ <label for="subject"><b><%= message('email_configuration.test.subject') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
- <%= text_field_tag 'subject', 'Test Message from Sonar' %>
+ <%= text_field_tag 'subject', message('email_configuration.test.subject_text') %>
</td>
</tr>
<tr>
<td nowrap>
- <label for="message"><b>Message:</b></label>
+ <label for="message"><b><%= message('email_configuration.test.message') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
- <%= text_area_tag 'message', 'This is a test message from Sonar.' %>
+ <%= text_area_tag 'message', message('email_configuration.test.message_text') %>
</td>
</tr>
<table>
- <%= submit_tag 'Send' %>
+ <br/>
+ <%= submit_tag message('email_configuration.test.send') %>
<% end -%>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
index 1ac79bf85d8..fbc097c14a6 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
@@ -86,6 +86,7 @@
if update_center_activated=='true' %>
<li class="<%= 'selected' if controller.controller_path=='updatecenter' -%>"><a href="<%= ApplicationController.root_context -%>/updatecenter"><%= message('update_center.page') -%></a></li>
<% end %>
+ <li class="<%= 'selected' if controller.controller_path=='email_configuration' -%>"><a href="<%= ApplicationController.root_context -%>/email_configuration"><%= message('email_configuration.page') -%></a></li>
<% end %>
<% end %>