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
This commit is contained in:
parent
9e75dca295
commit
aa0b4fdaa2
6
pom.xml
6
pom.xml
|
@ -87,6 +87,12 @@
|
||||||
<artifactId>aslcore</artifactId>
|
<artifactId>aslcore</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>com.google</groupId>
|
<groupId>com.google</groupId>
|
||||||
<artifactId>gwt-jsonmaker</artifactId>
|
<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 org.gcube.portlets.user.notifications.shared.NotificationPreference;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
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.Position;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.user.client.Timer;
|
import com.google.gwt.user.client.Timer;
|
||||||
import com.google.gwt.user.client.Window;
|
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.ScrollEvent;
|
||||||
import com.google.gwt.user.client.Window.ScrollHandler;
|
import com.google.gwt.user.client.Window.ScrollHandler;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
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() {
|
private void showUserNotifications() {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package org.gcube.portlets.user.notifications.client.view.templates;
|
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.GCubeSocialNetworking;
|
||||||
import org.gcube.portal.databook.client.util.Encoder;
|
import org.gcube.portal.databook.client.util.Encoder;
|
||||||
import org.gcube.portal.databook.shared.Notification;
|
import org.gcube.portal.databook.shared.Notification;
|
||||||
import org.gcube.portal.databook.shared.NotificationType;
|
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.gcubewidgets.client.elements.Span;
|
||||||
import org.gcube.portlets.user.notifications.client.view.templates.images.NotificationImages;
|
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.resources.client.ImageResource;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
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.Composite;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
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
|
//shorten the notification text if greather than 200 chars
|
||||||
actualHTML = actualHTML.length() > 200 ? actualHTML.substring(0, 200) + " ..." : actualHTML;
|
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(
|
notificationText.setHTML(
|
||||||
"<a class=\"link\" href=\""+GCubeSocialNetworking.USER_PROFILE_LINK+"?"+
|
"<a class=\"link\" href=\""+profilePageURL+"?"+
|
||||||
Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID)+"="+
|
Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID)+"="+
|
||||||
Encoder.encode(toShow.getSenderid())+"\">"+
|
Encoder.encode(toShow.getSenderid())+"\">"+
|
||||||
toShow.getSenderFullName()+"</a> " + actualHTML);
|
toShow.getSenderFullName()+"</a> " + actualHTML);
|
||||||
|
|
Loading…
Reference in New Issue