ported to liferay 6.2

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/join-vre@126439 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-03-31 10:33:44 +00:00
parent 2be571f652
commit c3d2f0d456
4 changed files with 31 additions and 6 deletions

View File

@ -1,4 +1,7 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="org.gcube.portlets-user.join-vre.3.0.0" date="2016-03-28">
<Change>Ported to Liferay 6.2</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.join-vre.2.0.0" <Changeset component="org.gcube.portlets-user.join-vre.2.0.0"
date="2015-10-22"> date="2015-10-22">
<Change>Refactored to support virtual groups and related descriptions <Change>Refactored to support virtual groups and related descriptions

View File

@ -26,7 +26,7 @@ public class ResponsivePanel extends Composite {
public static final String loading = GWT.getModuleBaseURL() + "../images/vre-loader.gif"; public static final String loading = GWT.getModuleBaseURL() + "../images/vre-loader.gif";
private VerticalPanel mainPanel = new VerticalPanel(); private VerticalPanel mainPanel = new VerticalPanel();
private ArrayList<VreThumbnail> myThumbnails = new ArrayList<VreThumbnail>();
public ResponsivePanel() { public ResponsivePanel() {
GWT.log("ResponsivePanel()"); GWT.log("ResponsivePanel()");
joinService.getVREs(new AsyncCallback<LinkedHashMap<VRECategory, ArrayList<VRE>>>() { joinService.getVREs(new AsyncCallback<LinkedHashMap<VRECategory, ArrayList<VRE>>>() {
@ -64,6 +64,7 @@ public class ResponsivePanel extends Composite {
Thumbnails toReturn = new Thumbnails(); Thumbnails toReturn = new Thumbnails();
for (VRE vre : vres) { for (VRE vre : vres) {
VreThumbnail thumb = new VreThumbnail(vre); VreThumbnail thumb = new VreThumbnail(vre);
myThumbnails.add(thumb);
toReturn.add(thumb); toReturn.add(thumb);
} }
return toReturn; return toReturn;
@ -76,7 +77,7 @@ public class ResponsivePanel extends Composite {
public void requestMembership(VRE vre) { public void requestMembership(VRE vre) {
if (vre.isUponRequest()) { if (vre.isUponRequest()) {
RequestMembershipDialog modal = new RequestMembershipDialog(vre); RequestMembershipDialog modal = new RequestMembershipDialog(this, vre);
modal.show(); modal.show();
} else { } else {
AccessVREDialog modal = new AccessVREDialog(vre); AccessVREDialog modal = new AccessVREDialog(vre);
@ -88,6 +89,14 @@ public class ResponsivePanel extends Composite {
AccessViaInviteDialog modal = new AccessViaInviteDialog(vre, inviteId); AccessViaInviteDialog modal = new AccessViaInviteDialog(vre, inviteId);
modal.show(); modal.show();
} }
public void setPending(VRE toSet) {
for (VreThumbnail thumb : myThumbnails) {
if (thumb.getMyVre().getinfraScope().compareTo(toSet.getinfraScope()) == 0) {
thumb.setPending();
}
}
}
} }

View File

@ -2,6 +2,7 @@ package org.gcube.portlets.user.joinvre.client.ui;
import org.gcube.portlets.user.joinvre.client.JoinService; import org.gcube.portlets.user.joinvre.client.JoinService;
import org.gcube.portlets.user.joinvre.client.JoinServiceAsync; import org.gcube.portlets.user.joinvre.client.JoinServiceAsync;
import org.gcube.portlets.user.joinvre.client.responsive.ResponsivePanel;
import org.gcube.portlets.user.joinvre.shared.VRE; import org.gcube.portlets.user.joinvre.shared.VRE;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;
@ -31,11 +32,13 @@ public class RequestMembershipDialog extends Composite {
@UiField Button confirmRequest; @UiField Button confirmRequest;
@UiField TextArea optionalText; @UiField TextArea optionalText;
@UiField HelpBlock helpBlock; @UiField HelpBlock helpBlock;
VRE myVRE = null; private VRE myVRE = null;
private ResponsivePanel responsivePanel;
public RequestMembershipDialog(VRE myVRE) { public RequestMembershipDialog(ResponsivePanel responsivePanel, VRE myVRE) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
this.myVRE = myVRE; this.myVRE = myVRE;
this.responsivePanel = responsivePanel;
optionalText.setWidth("95%"); optionalText.setWidth("95%");
optionalText.setPlaceholder("You can add an optional comment here"); optionalText.setPlaceholder("You can add an optional comment here");
} }
@ -59,6 +62,8 @@ public class RequestMembershipDialog extends Composite {
optionalText.removeFromParent(); optionalText.removeFromParent();
m.setTitle("Thank you, your request has been sent successfully"); m.setTitle("Thank you, your request has been sent successfully");
helpBlock.setText("You will receive an email as soon as your request will be processed."); helpBlock.setText("You will receive an email as soon as your request will be processed.");
responsivePanel.setPending(myVRE);
confirmRequest.setEnabled(false);
} }
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {

View File

@ -82,8 +82,6 @@ public class VreThumbnail extends Composite {
@Override @Override
public void onSuccess(String currentGroupName) { public void onSuccess(String currentGroupName) {
Location.assign("/group/" +currentGroupName +"/explore?"+JoinVRE.GET_OID_PARAMETER+"="+myVre.getId()); Location.assign("/group/" +currentGroupName +"/explore?"+JoinVRE.GET_OID_PARAMETER+"="+myVre.getId());
//RequestMembershipDialog modal = new RequestMembershipDialog(currentGroupName);
//modal.show();
} }
}); });
} }
@ -96,5 +94,15 @@ public class VreThumbnail extends Composite {
InfoPanel modal = new InfoPanel(myVre); InfoPanel modal = new InfoPanel(myVre);
modal.show(); modal.show();
} }
public void setPending() {
joinButton.setText("Waiting approval");
joinButton.setType(ButtonType.WARNING);
joinButton.setEnabled(false);
}
public VRE getMyVre() {
return myVre;
}
} }