The portlet now open the settings dialog automatically if the actual url ends with showsettings=true

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/notifications@126852 82a268e6-3cf1-43bd-a215-b396298e98cf
Feature/23194
costantino.perciante 8 years ago
parent 9e75dca295
commit aa0b4fdaa2

@ -87,6 +87,12 @@
<artifactId>aslcore</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google</groupId>
<artifactId>gwt-jsonmaker</artifactId>

@ -17,12 +17,14 @@ import org.gcube.portlets.user.notifications.shared.NotificationConstants;
import org.gcube.portlets.user.notifications.shared.NotificationPreference;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.Window.Location;
import com.google.gwt.user.client.Window.ScrollEvent;
import com.google.gwt.user.client.Window.ScrollHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -125,9 +127,30 @@ public class NotificationsPanel extends Composite {
}
}
});
}
// if the url ends with "showsettings=true" open the settings modal automatically
if(Location.getHref().endsWith("showsettings=true")){
Timer t = new Timer() {
@Override
public void run() {
clickElement(notificationSettings.getElement());
}
};
t.schedule(1000);
}
}
/**
* Simulate click event
* @param elem
*/
private static native void clickElement(Element elem) /*-{
elem.click();
}-*/;
private void showUserNotifications() {
showLoader();
@ -196,7 +219,7 @@ public class NotificationsPanel extends Composite {
int from = (fromStartingPoint == 0) ? NotificationConstants.NOTIFICATION_NUMBER_PRE+1 : fromStartingPoint;
fromStartingPoint = from;
final int quantity = NotificationConstants.NOTIFICATION_NUMBER_PER_REQUEST;
notificationService.getUserNotificationsByRange(from, quantity, new AsyncCallback<HashMap<Date,ArrayList<Notification>>>() {
@Override
public void onSuccess(HashMap<Date, ArrayList<Notification>> notificationsPerDay) {

@ -1,9 +1,11 @@
package org.gcube.portlets.user.notifications.client.view.templates;
import org.gcube.common.portal.GCubePortalConstants;
import org.gcube.portal.databook.client.GCubeSocialNetworking;
import org.gcube.portal.databook.client.util.Encoder;
import org.gcube.portal.databook.shared.Notification;
import org.gcube.portal.databook.shared.NotificationType;
import org.gcube.portlets.user.gcubewidgets.client.ClientScopeHelper;
import org.gcube.portlets.user.gcubewidgets.client.elements.Span;
import org.gcube.portlets.user.notifications.client.view.templates.images.NotificationImages;
@ -12,6 +14,7 @@ import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window.Location;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
@ -63,8 +66,11 @@ public class SingleNotificationView extends Composite {
//shorten the notification text if greather than 200 chars
actualHTML = actualHTML.length() > 200 ? actualHTML.substring(0, 200) + " ..." : actualHTML;
String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL +
ClientScopeHelper.extractOrgFriendlyURL(Location.getHref()) +"/"+GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
notificationText.setHTML(
"<a class=\"link\" href=\""+GCubeSocialNetworking.USER_PROFILE_LINK+"?"+
"<a class=\"link\" href=\""+profilePageURL+"?"+
Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID)+"="+
Encoder.encode(toShow.getSenderid())+"\">"+
toShow.getSenderFullName()+"</a> " + actualHTML);

Loading…
Cancel
Save