();
+ if (portalCheckbox.getValue())
+ toReturn.add(NotificationChannelType.PORTAL);
+ if (emailCheckbox.getValue())
+ toReturn.add(NotificationChannelType.EMAIL);
+ return toReturn.toArray(new NotificationChannelType[toReturn.size()]);
+ }
+ else
+ return new NotificationChannelType[0];
+ }
+
+ public void setPortalPrefValue(boolean value) {
+ setCheckBoxValue(portalCheckbox, value);
+ }
+ public void setEmailPrefValue(boolean value) {
+ setCheckBoxValue(emailCheckbox, value);
+ }
}
diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.ui.xml b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.ui.xml
index 0e475c3..cf979d3 100644
--- a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.ui.xml
+++ b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.ui.xml
@@ -10,9 +10,9 @@
-
- Portal
- Email
+ Portal
+ Email
+
|
diff --git a/src/main/java/org/gcube/portlets/user/notifications/server/NotificationsServiceImpl.java b/src/main/java/org/gcube/portlets/user/notifications/server/NotificationsServiceImpl.java
index 0f820e0..b33576e 100644
--- a/src/main/java/org/gcube/portlets/user/notifications/server/NotificationsServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/user/notifications/server/NotificationsServiceImpl.java
@@ -5,6 +5,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
+import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -34,6 +35,8 @@ import com.liferay.portal.model.UserModel;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.theme.ThemeDisplay;
+import edu.emory.mathcs.backport.java.util.Collections;
+
/**
* The server side implementation of the RPC service.
*/
@@ -183,19 +186,19 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
String typeDesc = descriptions.getProperty(type.toString());
if (category != null) {
if (treeMap.containsKey(category)) {
- treeMap.get(category).add(new NotificationPreference(type, typeLabel, typeDesc, storePreferences.get(type.toString())));
+ treeMap.get(category).add(new NotificationPreference(type, typeLabel, typeDesc, storePreferences.get(type)));
} else {
ArrayList toAdd = new ArrayList();
- toAdd.add(new NotificationPreference(type, typeLabel, typeDesc, storePreferences.get(type.toString())));
+ toAdd.add(new NotificationPreference(type, typeLabel, typeDesc, storePreferences.get(type)));
treeMap.put(category, toAdd);
}
}
}
} catch (Exception e) {
- _log.error("While trying to get getUser Notification Preferences");
+ _log.error("While trying to get getUser Notification Preferences for " + userid);
e.printStackTrace();
}
- _log.debug("Got Notification Preferences from Cassandra cluster, returning to the client for user: " + userid);
+ _log.debug("Got Notification Preferences, returning to the client for user: " + userid);
//need the key in revers order so that workspace appears first
LinkedHashMap> toReturn = new LinkedHashMap>();
for (String category : treeMap.descendingKeySet()) {
@@ -203,6 +206,7 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
for (NotificationPreference pref : treeMap.get(category)) {
toAdd.add(pref);
}
+ Collections.sort(toAdd); //sort the labels from the less length to the more length
toReturn.put(category, toAdd);
}
return toReturn;
diff --git a/src/main/java/org/gcube/portlets/user/notifications/shared/NotificationPreference.java b/src/main/java/org/gcube/portlets/user/notifications/shared/NotificationPreference.java
index 5981bd8..7252a42 100644
--- a/src/main/java/org/gcube/portlets/user/notifications/shared/NotificationPreference.java
+++ b/src/main/java/org/gcube/portlets/user/notifications/shared/NotificationPreference.java
@@ -11,7 +11,7 @@ import org.gcube.portal.databook.shared.NotificationType;
* and the channels selected by the user for this type
*/
@SuppressWarnings("serial")
-public class NotificationPreference implements Serializable {
+public class NotificationPreference implements Serializable, Comparable {
NotificationType type;
String typeLabel;
String typeDesc;
@@ -73,6 +73,15 @@ public class NotificationPreference implements Serializable {
+ Arrays.toString(selectedChannels) + "]";
}
+
+ @Override
+ public int compareTo(NotificationPreference o) {
+ if (this.typeLabel.length() <= o.getTypeLabel().length())
+ return -1;
+ else
+ return 1;
+ }
+
}
diff --git a/src/main/webapp/Notifications.css b/src/main/webapp/Notifications.css
index d610d11..3a2fee3 100644
--- a/src/main/webapp/Notifications.css
+++ b/src/main/webapp/Notifications.css
@@ -25,7 +25,7 @@ a.link:hover {
border-bottom-color: #DADADA;
border-bottom-style: solid;
border-bottom-width: 1px;
- padding: 5px 7px 3px;
+ padding: 15px 7px 3px;
}
.day-label {
@@ -108,3 +108,24 @@ a.link:hover {
.floatingLeft {
float:left;
}
+
+.floatingRight {
+ float:right;
+}
+
+.paddingRight {
+ padding-right: 15px;
+}
+
+.paddingLeft {
+ padding-left: 15px;
+}
+
+.labelOn {
+ color: #0088CC;
+}
+
+
+.labelOff {
+ color: #777;
+}
diff --git a/src/main/webapp/conf/descbytype.properties b/src/main/webapp/conf/descbytype.properties
index 5a2d930..56e997d 100644
--- a/src/main/webapp/conf/descbytype.properties
+++ b/src/main/webapp/conf/descbytype.properties
@@ -1,20 +1,20 @@
-WP_FOLDER_SHARE=sharing of workspace folders with you
-WP_FOLDER_ADDEDUSER=someone added users one to one of your workspace shared folder
-WP_FOLDER_REMOVEDUSER=someone removed users from one of your workspace shared folder
-WP_FOLDER_RENAMED=someone renamed one of your workspace shared folder
-WP_ITEM_DELETE=someone deleted an item in one of your workspace shared folder
-WP_ITEM_UPDATED=someone updated an item in one of your workspace shared folder
-WP_ITEM_RENAMED=someone renamed an item in one of your workspace shared folder
-WP_ITEM_NEW=someone added an item in one of your workspace shared folder
-OWN_COMMENT=someone replied to your post
-COMMENT=someone replied too to a post you replied
-MENTION=someone mentioned you in a post
-LIKE=someone set favorite your post
-MESSAGE=someone sent you a message
-DOCUMENT_WORKFLOW_EDIT=a document workflow you created was editeded
-DOCUMENT_WORKFLOW_VIEW=a document workflow you created was viewed
-DOCUMENT_WORKFLOW_STEP_REQUEST_TASK=someone requested you to perform a task on his document workflow
-DOCUMENT_WORKFLOW_FIRST_STEP_REQUEST_INVOLVMENT=someone involved you on his document workflow
-DOCUMENT_WORKFLOW_USER_FORWARD_TO_OWNER=a document workflow you created was forwarded to another step
-DOCUMENT_WORKFLOW_FORWARD_STEP_COMPLETED_OWNER=a document workflow you created was forwarded to the another step by all the users involved in the step
-DOCUMENT_WORKFLOW_STEP_FORWARD_PEER=someone completed his task on a document workflow where you still need to do yours
+WP_FOLDER_SHARE=Sharing of workspace folders with you
+WP_FOLDER_ADDEDUSER=Someone added users one to one of your workspace shared folder
+WP_FOLDER_REMOVEDUSER=Someone removed users from one of your workspace shared folder
+WP_FOLDER_RENAMED=Someone renamed one of your workspace shared folder
+WP_ITEM_DELETE=Someone deleted an item in one of your workspace shared folder
+WP_ITEM_UPDATED=Someone updated an item in one of your workspace shared folder
+WP_ITEM_RENAMED=Someone renamed an item in one of your workspace shared folder
+WP_ITEM_NEW=Someone added an item in one of your workspace shared folder
+OWN_COMMENT=Someone replied to your post
+COMMENT=Someone replied too to a post you replied
+MENTION=Someone mentioned you in a post
+LIKE=Someone set favorite your post
+MESSAGE=Someone sent you a message
+DOCUMENT_WORKFLOW_EDIT=A document workflow you created was editeded
+DOCUMENT_WORKFLOW_VIEW=A document workflow you created was viewed
+DOCUMENT_WORKFLOW_STEP_REQUEST_TASK=Someone requested you to perform a task on his document workflow
+DOCUMENT_WORKFLOW_FIRST_STEP_REQUEST_INVOLVMENT=Someone involved you on his document workflow
+DOCUMENT_WORKFLOW_USER_FORWARD_TO_OWNER=A document workflow you created was forwarded to another step
+DOCUMENT_WORKFLOW_FORWARD_STEP_COMPLETED_OWNER=A document workflow you created was forwarded to the another step by all the users involved in the step
+DOCUMENT_WORKFLOW_STEP_FORWARD_PEER=Someone completed his task on a document workflow where you still need to do yours
diff --git a/src/main/webapp/conf/labelbytype.properties b/src/main/webapp/conf/labelbytype.properties
index 55ff0ee..c6bc2db 100644
--- a/src/main/webapp/conf/labelbytype.properties
+++ b/src/main/webapp/conf/labelbytype.properties
@@ -1,20 +1,20 @@
-WP_FOLDER_SHARE=shared folder
-WP_FOLDER_ADDEDUSER=user added to shared folder
-WP_FOLDER_REMOVEDUSER=user removed from shared folder
-WP_FOLDER_RENAMED=shared folder renamed
-WP_ITEM_DELETE=shared item deleted
-WP_ITEM_UPDATED=shared item updated
-WP_ITEM_RENAMED=shared item renamed
-WP_ITEM_NEW=shared item added
-OWN_COMMENT=own replies
-COMMENT=replies
-MENTION=mentions
-LIKE=favorites
-MESSAGE=messages
-DOCUMENT_WORKFLOW_EDIT=edit
-DOCUMENT_WORKFLOW_VIEW=view
-DOCUMENT_WORKFLOW_STEP_REQUEST_TASK=task request
-DOCUMENT_WORKFLOW_FIRST_STEP_REQUEST_INVOLVMENT=involvement request
-DOCUMENT_WORKFLOW_USER_FORWARD_TO_OWNER=forward
-DOCUMENT_WORKFLOW_FORWARD_STEP_COMPLETED_OWNER=step completed
-DOCUMENT_WORKFLOW_STEP_FORWARD_PEER=forward from peer
+WP_FOLDER_SHARE=Shared folder
+WP_FOLDER_ADDEDUSER=User added to shared folder
+WP_FOLDER_REMOVEDUSER=User removed from shared folder
+WP_FOLDER_RENAMED=Shared folder renamed
+WP_ITEM_DELETE=Shared item deleted
+WP_ITEM_UPDATED=Shared item updated
+WP_ITEM_RENAMED=Shared item renamed
+WP_ITEM_NEW=Shared item added
+OWN_COMMENT=Own replies
+COMMENT=Replies
+MENTION=Mentions
+LIKE=Favorites
+MESSAGE=Messages
+DOCUMENT_WORKFLOW_EDIT=Edit
+DOCUMENT_WORKFLOW_VIEW=View
+DOCUMENT_WORKFLOW_STEP_REQUEST_TASK=Task request
+DOCUMENT_WORKFLOW_FIRST_STEP_REQUEST_INVOLVMENT=Involvement request
+DOCUMENT_WORKFLOW_USER_FORWARD_TO_OWNER=Forward
+DOCUMENT_WORKFLOW_FORWARD_STEP_COMPLETED_OWNER=Step completed
+DOCUMENT_WORKFLOW_STEP_FORWARD_PEER=Forward from peer
|