You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by md...@apache.org on 2014/05/16 16:56:51 UTC
svn commit: r1595224 - in /syncope/trunk/console/src:
main/java/org/apache/syncope/console/pages/
main/resources/org/apache/syncope/console/pages/
test/java/org/apache/syncope/console/
Author: mdisabatino
Date: Fri May 16 14:56:51 2014
New Revision: 1595224
URL: http://svn.apache.org/r1595224
Log:
[SYNCOPE-444] Improved handling of notification recipients
Modified:
syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/NotificationModalPage.java
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage.html
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage.properties
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage_it.properties
syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage_pt_BR.properties
syncope/trunk/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/NotificationModalPage.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/NotificationModalPage.java?rev=1595224&r1=1595223&r2=1595224&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/NotificationModalPage.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/NotificationModalPage.java Fri May 16 14:56:51 2014
@@ -172,44 +172,60 @@ class NotificationModalPage extends Base
form.add(recipientsContainer);
+ final AjaxCheckBoxPanel checkStaticRecipients = new AjaxCheckBoxPanel("checkStaticRecipients",
+ "recipients", new Model<Boolean>(!notificationTO.getStaticRecipients().isEmpty()));
+ form.add(checkStaticRecipients);
+
+ if (createFlag) {
+ checkStaticRecipients.getField().setDefaultModelObject(Boolean.FALSE);
+ }
+
final AjaxTextFieldPanel staticRecipientsFieldPanel
= new AjaxTextFieldPanel("panel", "staticRecipients", new Model<String>(null));
staticRecipientsFieldPanel.addValidator(EmailAddressValidator.getInstance());
+ staticRecipientsFieldPanel.setRequired(checkStaticRecipients.getModelObject());
if (notificationTO.getStaticRecipients().isEmpty()) {
notificationTO.getStaticRecipients().add(null);
}
-
+
final MultiFieldPanel staticRecipients = new MultiFieldPanel("staticRecipients",
new PropertyModel<List<String>>(notificationTO, "staticRecipients"), staticRecipientsFieldPanel);
-
+ staticRecipients.setEnabled(checkStaticRecipients.getModelObject());
form.add(staticRecipients);
- final AjaxCheckBoxPanel selfAsRecipient = new AjaxCheckBoxPanel("selfAsRecipient",
- getString("selfAsRecipient"), new PropertyModel<Boolean>(notificationTO, "selfAsRecipient"));
- form.add(selfAsRecipient);
+ final AjaxCheckBoxPanel checkRecipients
+ = new AjaxCheckBoxPanel("checkRecipients", "checkRecipients",
+ new Model<Boolean>(notificationTO.getRecipients() == null ? false : true));
+ recipientsContainer.add(checkRecipients);
if (createFlag) {
- selfAsRecipient.getField().setDefaultModelObject(Boolean.TRUE);
+ checkRecipients.getField().setDefaultModelObject(Boolean.TRUE);
}
- final AjaxCheckBoxPanel checkRecipients =
- new AjaxCheckBoxPanel("checkRecipients", "checkRecipients",
- new Model<Boolean>(notificationTO.getRecipients() == null ? false : true));
- recipientsContainer.add(checkRecipients);
-
- final UserSearchPanel recipients =
- new UserSearchPanel.Builder("recipients").fiql(notificationTO.getRecipients()).build();
- recipientsContainer.add(recipients);
+ final UserSearchPanel recipients
+ = new UserSearchPanel.Builder("recipients").fiql(notificationTO.getRecipients()).build();
+
recipients.setEnabled(checkRecipients.getModelObject());
+ recipientsContainer.add(recipients);
+ final AjaxCheckBoxPanel selfAsRecipient = new AjaxCheckBoxPanel("selfAsRecipient",
+ getString("selfAsRecipient"), new PropertyModel<Boolean>(notificationTO, "selfAsRecipient"));
+ form.add(selfAsRecipient);
+
+ if (createFlag) {
+ selfAsRecipient.getField().setDefaultModelObject(Boolean.FALSE);
+ }
+
selfAsRecipient.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
- if (!Boolean.valueOf(selfAsRecipient.getField().getValue())) {
+ if (!selfAsRecipient.getModelObject()
+ && !checkRecipients.getModelObject()
+ && !checkStaticRecipients.getModelObject()) {
checkRecipients.getField().setDefaultModelObject(Boolean.TRUE);
target.add(checkRecipients);
recipients.setEnabled(checkRecipients.getModelObject());
@@ -225,9 +241,15 @@ class NotificationModalPage extends Base
@Override
protected void onUpdate(final AjaxRequestTarget target) {
- if (!checkRecipients.getModelObject()) {
- selfAsRecipient.getField().setDefaultModelObject(Boolean.TRUE);
- target.add(selfAsRecipient);
+ if (!checkRecipients.getModelObject()
+ && !selfAsRecipient.getModelObject()
+ && !checkStaticRecipients.getModelObject()) {
+ checkStaticRecipients.getField().setDefaultModelObject(Boolean.TRUE);
+ target.add(checkStaticRecipients);
+ staticRecipients.setEnabled(Boolean.TRUE);
+ target.add(staticRecipients);
+ staticRecipientsFieldPanel.setRequired(Boolean.TRUE);
+ target.add(staticRecipientsFieldPanel);
}
recipients.setEnabled(checkRecipients.getModelObject());
target.add(recipients);
@@ -235,6 +257,29 @@ class NotificationModalPage extends Base
}
});
+ checkStaticRecipients.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ if (!checkStaticRecipients.getModelObject()
+ && !selfAsRecipient.getModelObject()
+ && !checkRecipients.getModelObject()) {
+ checkRecipients.getField().setDefaultModelObject(Boolean.TRUE);
+ checkRecipients.setEnabled(Boolean.TRUE);
+ target.add(checkRecipients);
+ }
+ staticRecipients.setEnabled(checkStaticRecipients.getModelObject());
+ staticRecipientsFieldPanel.setRequired(checkStaticRecipients.getModelObject());
+ recipients.setEnabled(checkRecipients.getModelObject());
+ target.add(staticRecipientsFieldPanel);
+ target.add(staticRecipients);
+ target.add(recipients);
+ target.add(recipientsContainer);
+ }
+ });
+
AjaxButton submit = new IndicatingAjaxButton(APPLY, new Model<String>(getString(SUBMIT))) {
private static final long serialVersionUID = -958724007591692537L;
@@ -244,7 +289,7 @@ class NotificationModalPage extends Base
notificationTO.setAbout(checkAbout.getModelObject() ? null : about.buildFIQL());
notificationTO.setRecipients(checkRecipients.getModelObject() ? recipients.buildFIQL() : null);
notificationTO.getStaticRecipients().removeAll(Collections.singleton(null));
-
+
try {
if (createFlag) {
restClient.createNotification(notificationTO);
Modified: syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage.html
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage.html?rev=1595224&r1=1595223&r2=1595224&view=diff
==============================================================================
--- syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage.html (original)
+++ syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage.html Fri May 16 14:56:51 2014
@@ -146,21 +146,15 @@ under the License.
<div id="recipients">
<div class="tablerow alt">
- <div class="tablecolumn_label medium_fixedsize">
+ <div class="tablecolumn_label medium_dynamicsize">
+ <span wicket:id="checkStaticRecipients">[checkStaticRecipients]</span>
<label for="recipients"><wicket:message key="recipients"/></label>
</div>
<div class="tablecolumn_field medium_dynamicsize">
<span wicket:id="staticRecipients">[staticRecipients]</span>
</div>
</div>
- <div class="tablerow" style="width: auto; display: block;">
- <div class="tablecolumn_field" style="width: auto; padding-right: 5px;">
- <span wicket:id="selfAsRecipient">[selfAsRecipient]</span>
- </div>
- <div class="tablecolumn_label" style="width: auto;">
- <label for="selfAsRecipient"><wicket:message key="selfAsRecipient"/></label>
- </div>
- </div>
+
<span wicket:id="recipientsContainer">
<div class="tablerow" style="width: auto;">
<div class="tablecolumn_field" style="width: auto; padding-right: 5px;">
@@ -172,6 +166,22 @@ under the License.
</div>
<span wicket:id="recipients"/>
</span>
+ <div id="userFilter">
+ <div id="title">
+ <label for="userNotifications"><wicket:message key="userNotifications"/></label>
+ </div>
+ <div id="warning">
+ <label for="userNotificationsWarning"><wicket:message key="userNotificationsWarning"/></label>
+ </div>
+ <div class="tablerow" style="width: auto;">
+ <div class="tablecolumn_field" style="width: auto; padding-right: 5px;">
+ <span wicket:id="selfAsRecipient">[selfAsRecipient]</span>
+ </div>
+ <div class="tablecolumn_label" style="width: auto;">
+ <label for="selfAsRecipient"><wicket:message key="selfAsRecipient"/></label>
+ </div>
+ </div>
+ </div>
</div>
</div>
Modified: syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage.properties
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage.properties?rev=1595224&r1=1595223&r2=1595224&view=diff
==============================================================================
--- syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage.properties (original)
+++ syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage.properties Fri May 16 14:56:51 2014
@@ -31,3 +31,5 @@ checkRecipients=Search recipients
checkAbout=All
userFilter=User filter
userFilterWarning=Do not use this filter unless events are not targeted at users
+userNotifications=User notifications
+userNotificationsWarning=Do not select this checkbox unless events are not targeted at users
Modified: syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage_it.properties
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage_it.properties?rev=1595224&r1=1595223&r2=1595224&view=diff
==============================================================================
--- syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage_it.properties (original)
+++ syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage_it.properties Fri May 16 14:56:51 2014
@@ -26,8 +26,10 @@ events=Eventi
recipients=Destinatari
selfAsRecipient=Includi i soggetti
recipientAttrType=Tipo attributo e-mail destinatari
-recipientAttrName=Shcema attributo e-mail destinatari
+recipientAttrName=Schema attributo e-mail destinatari
checkRecipients=Cerca i destinatari
checkAbout=Tutto
userFilter=Filtro utenti
-userFilterWarning=Non usare questo filtro se gli eventi catturati non riguardano espressamente utenti
\ No newline at end of file
+userFilterWarning=Non usare questo filtro se gli eventi catturati non riguardano espressamente utenti
+userNotifications=Notifiche utente
+userNotificationsWarning=Non selezionare questa checkbox se gli eventi catturati non riguardano espressamente utenti
Modified: syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage_pt_BR.properties
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage_pt_BR.properties?rev=1595224&r1=1595223&r2=1595224&view=diff
==============================================================================
--- syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage_pt_BR.properties (original)
+++ syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage_pt_BR.properties Fri May 16 14:56:51 2014
@@ -30,4 +30,6 @@ recipientAttrName=Destinat\u00e1rios de
checkRecipients=Buscar Destinat\u00e1rios
checkAbout=Todos
userFilter=User filter
-userFilterWarning=Do not use this filter unless events are not targeted at users
\ No newline at end of file
+userFilterWarning=N\u00e3o use este filtro n\u00e3o ser que os eventos n\u00e3o s\u00e3o direcionados a usu\u00e1rios
+userNotifications=Notifica\u00e7\u00f5es do usu\u00e1rio
+userNotificationsWarning=N\u00e3o selecione esta op\u00e7\u00e3o a menos que os eventos n\u00e3o s\u00e3o direcionados a usu\u00e1rios
\ No newline at end of file
Modified: syncope/trunk/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java?rev=1595224&r1=1595223&r2=1595224&view=diff
==============================================================================
--- syncope/trunk/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java (original)
+++ syncope/trunk/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java Fri May 16 14:56:51 2014
@@ -168,7 +168,7 @@ public class ConfigurationTestITCase ext
+ "//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']"
+ "/option[text()='role']\");",
"30000");
-
+
selenium.select(
"//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']",
"label=role");
@@ -189,6 +189,8 @@ public class ConfigurationTestITCase ext
selenium.click("//div[@class='eventSelectionWidzard']/div[2]/div[3]/span/div/input");
selenium.click("//div[2]/form/div[3]/ul/li[4]/a/span");
+
+ selenium.click("//div[2]/form/div[3]/div[4]/div/div/span/input");
selenium.type(
"name=staticRecipients:multiValueContainer:view:0:panel:textField", "syncope445@syncope.apache.org");