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
This commit is contained in:
Evgeny Mandrikov 2011-07-26 14:25:57 +04:00
parent fea2ef37ed
commit b508728dc8
23 changed files with 114 additions and 77 deletions

View File

@ -10,10 +10,11 @@
</parent> </parent>
<groupId>org.codehaus.sonar.plugins</groupId> <groupId>org.codehaus.sonar.plugins</groupId>
<artifactId>sonar-email-plugin</artifactId> <artifactId>sonar-email-notifications-plugin</artifactId>
<packaging>sonar-plugin</packaging> <packaging>sonar-plugin</packaging>
<name>Sonar :: Plugins :: Email</name> <name>Sonar :: Plugins :: Email Notifications</name>
<description>Email Notifications</description>
<dependencies> <dependencies>
<dependency> <dependency>
@ -53,9 +54,8 @@
<artifactId>sonar-packaging-maven-plugin</artifactId> <artifactId>sonar-packaging-maven-plugin</artifactId>
<extensions>true</extensions> <extensions>true</extensions>
<configuration> <configuration>
<pluginName>Email</pluginName> <pluginName>Email notifications</pluginName>
<pluginClass>org.sonar.plugins.email.EmailPlugin</pluginClass> <pluginClass>org.sonar.plugins.emailnotifications.EmailNotificationsPlugin</pluginClass>
<pluginDescription><![CDATA[TODO]]></pluginDescription>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software * License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/ */
package org.sonar.plugins.email; package org.sonar.plugins.emailnotifications;
import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.Configuration;
import org.sonar.api.CoreProperties; import org.sonar.api.CoreProperties;
@ -30,15 +30,15 @@ import org.sonar.api.ServerExtension;
*/ */
public class EmailConfiguration implements ServerExtension { public class EmailConfiguration implements ServerExtension {
public static final String SMTP_HOST = "email.smtp_host"; public static final String SMTP_HOST = "email.smtp_host.secured";
public static final String SMTP_HOST_DEFAULT = ""; public static final String SMTP_HOST_DEFAULT = "";
public static final String SMTP_PORT = "email.smtp_port"; public static final String SMTP_PORT = "email.smtp_port.secured";
public static final String SMTP_PORT_DEFAULT = "25"; public static final String SMTP_PORT_DEFAULT = "25";
public static final String SMTP_USE_TLS = "email.smtp_use_tls"; public static final String SMTP_USE_TLS = "email.smtp_use_tls.secured";
public static final boolean SMTP_USE_TLS_DEFAULT = false; public static final boolean SMTP_USE_TLS_DEFAULT = false;
public static final String SMTP_USERNAME = "email.smtp_username"; public static final String SMTP_USERNAME = "email.smtp_username.secured";
public static final String SMTP_USERNAME_DEFAULT = ""; public static final String SMTP_USERNAME_DEFAULT = "";
public static final String SMTP_PASSWORD = "email.smtp_password"; public static final String SMTP_PASSWORD = "email.smtp_password.secured";
public static final String SMTP_PASSWORD_DEFAULT = ""; public static final String SMTP_PASSWORD_DEFAULT = "";
public static final String FROM = "email.from"; public static final String FROM = "email.from";
public static final String FROM_DEFAULT = "noreply@nowhere"; public static final String FROM_DEFAULT = "noreply@nowhere";

View File

@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software * License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/ */
package org.sonar.plugins.email; package org.sonar.plugins.emailnotifications;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
@ -31,8 +31,8 @@ import org.sonar.api.database.model.User;
import org.sonar.api.notifications.Notification; import org.sonar.api.notifications.Notification;
import org.sonar.api.notifications.NotificationChannel; import org.sonar.api.notifications.NotificationChannel;
import org.sonar.api.security.UserFinder; import org.sonar.api.security.UserFinder;
import org.sonar.plugins.email.api.EmailMessage; import org.sonar.plugins.emailnotifications.api.EmailMessage;
import org.sonar.plugins.email.api.EmailTemplate; import org.sonar.plugins.emailnotifications.api.EmailTemplate;
/** /**
* References: * References:
@ -98,14 +98,14 @@ public class EmailNotificationChannel extends NotificationChannel {
LOG.warn("Email not defined for user: " + username); LOG.warn("Email not defined for user: " + username);
return; return;
} }
EmailMessage emailMessage = format(notification, username); EmailMessage emailMessage = format(notification);
if (emailMessage != null) { if (emailMessage != null) {
emailMessage.setTo(user.getEmail()); emailMessage.setTo(user.getEmail());
deliver(emailMessage); deliver(emailMessage);
} }
} }
private EmailMessage format(Notification notification, String username) { private EmailMessage format(Notification notification) {
for (EmailTemplate template : templates) { for (EmailTemplate template : templates) {
EmailMessage email = template.format(notification); EmailMessage email = template.format(notification);
if (email != null) { if (email != null) {

View File

@ -17,17 +17,17 @@
* License along with Sonar; if not, write to the Free Software * License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/ */
package org.sonar.plugins.email; package org.sonar.plugins.emailnotifications;
import org.sonar.api.SonarPlugin; import org.sonar.api.SonarPlugin;
import org.sonar.plugins.email.reviews.ChangesInReviewAssignedToMe; import org.sonar.plugins.emailnotifications.reviews.ChangesInReviewAssignedToMe;
import org.sonar.plugins.email.reviews.ChangesInReviewCreatedByMe; import org.sonar.plugins.emailnotifications.reviews.ChangesInReviewCreatedByMe;
import org.sonar.plugins.email.reviews.ReviewEmailTemplate; import org.sonar.plugins.emailnotifications.reviews.ReviewEmailTemplate;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class EmailPlugin extends SonarPlugin { public class EmailNotificationsPlugin extends SonarPlugin {
public List getExtensions() { public List getExtensions() {
return Arrays.asList( return Arrays.asList(

View File

@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software * License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/ */
package org.sonar.plugins.email.api; package org.sonar.plugins.emailnotifications.api;
import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringBuilder;

View File

@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software * License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/ */
package org.sonar.plugins.email.api; package org.sonar.plugins.emailnotifications.api;
import org.sonar.api.ServerExtension; import org.sonar.api.ServerExtension;
import org.sonar.api.notifications.Notification; import org.sonar.api.notifications.Notification;

View File

@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software * License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/ */
package org.sonar.plugins.email.reviews; package org.sonar.plugins.emailnotifications.reviews;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.sonar.api.notifications.Notification; import org.sonar.api.notifications.Notification;

View File

@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software * License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/ */
package org.sonar.plugins.email.reviews; package org.sonar.plugins.emailnotifications.reviews;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.sonar.api.notifications.Notification; import org.sonar.api.notifications.Notification;

View File

@ -17,15 +17,15 @@
* License along with Sonar; if not, write to the Free Software * License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/ */
package org.sonar.plugins.email.reviews; package org.sonar.plugins.emailnotifications.reviews;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.sonar.api.database.model.User; import org.sonar.api.database.model.User;
import org.sonar.api.notifications.Notification; import org.sonar.api.notifications.Notification;
import org.sonar.api.security.UserFinder; import org.sonar.api.security.UserFinder;
import org.sonar.plugins.email.EmailConfiguration; import org.sonar.plugins.emailnotifications.EmailConfiguration;
import org.sonar.plugins.email.api.EmailMessage; import org.sonar.plugins.emailnotifications.api.EmailMessage;
import org.sonar.plugins.email.api.EmailTemplate; import org.sonar.plugins.emailnotifications.api.EmailTemplate;
/** /**
* Creates email message for notification "review-changed". * Creates email message for notification "review-changed".

View File

@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software * License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/ */
package org.sonar.plugins.email; package org.sonar.plugins.emailnotifications;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;

View File

@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software * License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/ */
package org.sonar.plugins.email; package org.sonar.plugins.emailnotifications;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
@ -33,7 +33,7 @@ import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.sonar.plugins.email.api.EmailMessage; import org.sonar.plugins.emailnotifications.api.EmailMessage;
import com.dumbster.smtp.SimpleSmtpServer; import com.dumbster.smtp.SimpleSmtpServer;
import com.dumbster.smtp.SmtpMessage; import com.dumbster.smtp.SmtpMessage;

View File

@ -17,18 +17,18 @@
* License along with Sonar; if not, write to the Free Software * License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/ */
package org.sonar.plugins.email; package org.sonar.plugins.emailnotifications;
import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.greaterThan;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import org.junit.Test; import org.junit.Test;
public class EmailPluginTest { public class EmailNotificationsPluginTest {
@Test @Test
public void testGetExtensions() { public void testGetExtensions() {
assertThat(new EmailPlugin().getExtensions().size(), greaterThan(1)); assertThat(new EmailNotificationsPlugin().getExtensions().size(), greaterThan(1));
} }
} }

View File

@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software * License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/ */
package org.sonar.plugins.email.reviews; package org.sonar.plugins.emailnotifications.reviews;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;

View File

@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software * License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/ */
package org.sonar.plugins.email.reviews; package org.sonar.plugins.emailnotifications.reviews;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;

View File

@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software * License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/ */
package org.sonar.plugins.email.reviews; package org.sonar.plugins.emailnotifications.reviews;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
@ -31,8 +31,8 @@ import org.junit.Test;
import org.sonar.api.database.model.User; import org.sonar.api.database.model.User;
import org.sonar.api.notifications.Notification; import org.sonar.api.notifications.Notification;
import org.sonar.api.security.UserFinder; import org.sonar.api.security.UserFinder;
import org.sonar.plugins.email.EmailConfiguration; import org.sonar.plugins.emailnotifications.EmailConfiguration;
import org.sonar.plugins.email.api.EmailMessage; import org.sonar.plugins.emailnotifications.api.EmailMessage;
public class ReviewEmailTemplateTest { public class ReviewEmailTemplateTest {
@ -290,6 +290,8 @@ public class ReviewEmailTemplateTest {
* *
* Status: RESOLVED (was REOPENED) * Status: RESOLVED (was REOPENED)
* Resolution: FALSE-POSITIVE * Resolution: FALSE-POSITIVE
* Comment:
* Because!
* *
* -- * --
* See it in Sonar: http://nemo.sonarsource.org/review/view/1 * See it in Sonar: http://nemo.sonarsource.org/review/view/1
@ -303,12 +305,13 @@ public class ReviewEmailTemplateTest {
.setFieldValue("old.status", "REOPENED") .setFieldValue("old.status", "REOPENED")
.setFieldValue("old.resolution", null) .setFieldValue("old.resolution", null)
.setFieldValue("new.status", "RESOLVED") .setFieldValue("new.status", "RESOLVED")
.setFieldValue("new.resolution", "FALSE-POSITIVE"); .setFieldValue("new.resolution", "FALSE-POSITIVE")
.setFieldValue("new.comment", "Because!");
EmailMessage message = template.format(notification); EmailMessage message = template.format(notification);
assertThat(message.getMessageId(), is("review/1")); assertThat(message.getMessageId(), is("review/1"));
assertThat(message.getSubject(), is("Review #1")); assertThat(message.getSubject(), is("Review #1"));
assertThat(message.getFrom(), is("Freddy Mallet")); assertThat(message.getFrom(), is("Freddy Mallet"));
assertThat(message.getMessage(), is("Status: RESOLVED (was REOPENED)\nResolution: FALSE-POSITIVE\n\n--\nSee it in Sonar: http://nemo.sonarsource.org/review/view/1\n")); assertThat(message.getMessage(), is("Status: RESOLVED (was REOPENED)\nResolution: FALSE-POSITIVE\nComment:\n Because!\n\n--\nSee it in Sonar: http://nemo.sonarsource.org/review/view/1\n"));
} }
@Test @Test

View File

@ -291,6 +291,7 @@ users.page=Users
violations.page=Violations violations.page=Violations
violations_drilldown.page=Violations drilldown violations_drilldown.page=Violations drilldown
update_center.page=Update Center update_center.page=Update Center
email_configuration.page=Email configuration
org.sonar.plugins.core.hotspots.GwtHotspots.page=Hotspots org.sonar.plugins.core.hotspots.GwtHotspots.page=Hotspots
org.sonar.plugins.core.duplicationsviewer.DuplicationsViewer.page=Duplications org.sonar.plugins.core.duplicationsviewer.DuplicationsViewer.page=Duplications
@ -635,6 +636,33 @@ rules_configuration.x_rules_have_been_activated={0} rules have been activated.
rules_configuration.x_rules_have_been_deactivated={0} rules have been deactivated. rules_configuration.x_rules_have_been_deactivated={0} rules have been deactivated.
#------------------------------------------------------------------------------
#
# EMAIL CONFIGURATION
#
#------------------------------------------------------------------------------
email_configuration.smtp_host=SMTP host
email_configuration.smtp_port=SMTP port
email_configuration.use_tls=Use TLS
email_configuration.smtp_username=SMTP username
email_configuration.smtp_password=SMTP password
email_configuration.from_address=From address
email_configuration.email_prefix=Email prefix
email_configuration.test.title=Send Test Email
email_configuration.test.to_address=To
email_configuration.test.to_address_required=You must provide address where to send test email
email_configuration.test.subject=Subject
email_configuration.test.subject_text=Test Message from Sonar
email_configuration.test.message=Message
email_configuration.test.message_text=This is a test message from Sonar
email_configuration.test.send=Send
email_configuration.test.email_was_sent_to_x=Email was sent to {0}
notification.channel.EmailNotificationChannel=Email
notification.dispatcher.ChangesInReviewAssignedToMe=Changes in review assigned to me
notification.dispatcher.ChangesInReviewCreatedByMe=Changes in review created by me
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# ALERTS # ALERTS

View File

@ -49,7 +49,7 @@
<module>plugins/sonar-squid-java-plugin</module> <module>plugins/sonar-squid-java-plugin</module>
<module>plugins/sonar-design-plugin</module> <module>plugins/sonar-design-plugin</module>
<module>plugins/sonar-i18n-en-plugin</module> <module>plugins/sonar-i18n-en-plugin</module>
<module>plugins/sonar-email-plugin</module> <module>plugins/sonar-email-notifications-plugin</module>
</modules> </modules>
<organization> <organization>

View File

@ -210,7 +210,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.codehaus.sonar.plugins</groupId> <groupId>org.codehaus.sonar.plugins</groupId>
<artifactId>sonar-email-plugin</artifactId> <artifactId>sonar-email-notifications-plugin</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>

View File

@ -456,7 +456,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.codehaus.sonar.plugins</groupId> <groupId>org.codehaus.sonar.plugins</groupId>
<artifactId>sonar-email-plugin</artifactId> <artifactId>sonar-email-notifications-plugin</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>

View File

@ -48,10 +48,11 @@ class EmailConfigurationController < ApplicationController
subject = params[:subject] subject = params[:subject]
message = params[:message] message = params[:message]
if to_address.blank? 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 else
begin 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 rescue Exception => e
flash[:error] = e.message flash[:error] = e.message
end end
@ -62,7 +63,7 @@ class EmailConfigurationController < ApplicationController
private private
def configuration def configuration
java_facade.getComponentByClassname('email', 'org.sonar.plugins.email.EmailConfiguration').class java_facade.getComponentByClassname('emailnotifications', 'org.sonar.plugins.emailnotifications.EmailConfiguration').class
end end
end end

View File

@ -29,9 +29,9 @@
<h1>Change password</h1> <h1>Change password</h1>
<br/> <br/>
<% form_tag( {:action => 'change_password' }, :id => 'pass_form_tag', :name => 'pass_form_tag') do -%> <% form_tag( {:action => 'change_password' }, :id => 'pass_form_tag', :name => 'pass_form_tag') do -%>
<table> <table>
<tr> <tr>
<td nowrap> <td nowrap>
<label for="old_password"><b>Old value:</b></label> <label for="old_password"><b>Old value:</b></label>
</td> </td>
<td class="sep"> </td> <td class="sep"> </td>
@ -40,7 +40,7 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td nowrap> <td nowrap>
<label for="password"><b>New value:</b></label> <label for="password"><b>New value:</b></label>
</td> </td>
<td class="sep"> </td> <td class="sep"> </td>
@ -49,7 +49,7 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td nowrap> <td nowrap>
<label for="password_confirmation"><b>Confirm new value:</b></label> <label for="password_confirmation"><b>Confirm new value:</b></label>
</td> </td>
<td class="sep"> </td> <td class="sep"> </td>
@ -58,15 +58,15 @@
</td> </td>
</tr> </tr>
</table> </table>
<br/> <br/>
<%= submit_tag 'Change password' %> <%= submit_tag 'Change password' %>
<% end %> <% end %>
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
$('pass_form_tag').focusFirstElement(); $('pass_form_tag').focusFirstElement();
//]]> //]]>
</script> </script>
<% end -%> <% end -%>
<br/> <br/>
@ -77,12 +77,12 @@
<tr> <tr>
<td></td> <td></td>
<% for channel in @channels %> <% for channel in @channels %>
<td><%= channel.getKey() %></td> <td><%= message('notification.channel.' + channel.getKey()) -%></td>
<% end %> <% end %>
</tr> </tr>
<% for dispatcher in @dispatchers %> <% for dispatcher in @dispatchers %>
<tr> <tr>
<td><%= dispatcher.getKey() %></td> <td><%= message('notification.dispatcher.' + dispatcher.getKey()) -%></td>
<td> <td>
<% <%
for channel in @channels for channel in @channels

View File

@ -1,9 +1,10 @@
<h1>Email configuration</h1> <h1><%= message('email_configuration.page') -%></h1>
<br/>
<% form_tag({:action => 'save'}) do -%> <% form_tag({:action => 'save'}) do -%>
<table> <table>
<tr> <tr>
<td nowrap> <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>
<td class="sep"> </td> <td class="sep"> </td>
<td align="left"> <td align="left">
@ -13,7 +14,7 @@
<tr> <tr>
<td nowrap> <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>
<td class="sep"> </td> <td class="sep"> </td>
<td align="left"> <td align="left">
@ -23,7 +24,7 @@
<tr> <tr>
<td nowrap> <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>
<td class="sep"> </td> <td class="sep"> </td>
<td align="left"> <td align="left">
@ -33,7 +34,7 @@
<tr> <tr>
<td nowrap> <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>
<td class="sep"> </td> <td class="sep"> </td>
<td align="left"> <td align="left">
@ -43,7 +44,7 @@
<tr> <tr>
<td nowrap> <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>
<td class="sep"> </td> <td class="sep"> </td>
<td align="left"> <td align="left">
@ -53,7 +54,7 @@
<tr> <tr>
<td nowrap> <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>
<td class="sep"> </td> <td class="sep"> </td>
<td align="left"> <td align="left">
@ -63,7 +64,7 @@
<tr> <tr>
<td nowrap> <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>
<td class="sep"> </td> <td class="sep"> </td>
<td align="left"> <td align="left">
@ -71,16 +72,18 @@
</td> </td>
</tr> </tr>
</table> </table>
<%= submit_tag %> <br/>
<%= submit_tag message('save') %>
<% end -%> <% end -%>
<br/> <br/>
<h1>Send Test Email</h1> <h1><%= message('email_configuration.test.title') -%></h1>
<br/>
<% form_tag({:action => 'send_test_email'}) do -%> <% form_tag({:action => 'send_test_email'}) do -%>
<table> <table>
<tr> <tr>
<td nowrap> <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>
<td class="sep"> </td> <td class="sep"> </td>
<td align="left"> <td align="left">
@ -89,22 +92,23 @@
</tr> </tr>
<tr> <tr>
<td nowrap> <td nowrap>
<label for="subject"><b>Subject:</b></label> <label for="subject"><b><%= message('email_configuration.test.subject') -%></b></label>
</td> </td>
<td class="sep"> </td> <td class="sep"> </td>
<td align="left"> <td align="left">
<%= text_field_tag 'subject', 'Test Message from Sonar' %> <%= text_field_tag 'subject', message('email_configuration.test.subject_text') %>
</td> </td>
</tr> </tr>
<tr> <tr>
<td nowrap> <td nowrap>
<label for="message"><b>Message:</b></label> <label for="message"><b><%= message('email_configuration.test.message') -%></b></label>
</td> </td>
<td class="sep"> </td> <td class="sep"> </td>
<td align="left"> <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> </td>
</tr> </tr>
<table> <table>
<%= submit_tag 'Send' %> <br/>
<%= submit_tag message('email_configuration.test.send') %>
<% end -%> <% end -%>

View File

@ -86,6 +86,7 @@
if update_center_activated=='true' %> 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> <li class="<%= 'selected' if controller.controller_path=='updatecenter' -%>"><a href="<%= ApplicationController.root_context -%>/updatecenter"><%= message('update_center.page') -%></a></li>
<% end %> <% 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 %>
<% end %> <% end %>