diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 95cc14f..737c457 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -5,8 +5,6 @@ - - diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index 7895606..fefc63a 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,7 +1,7 @@ - + diff --git a/pom.xml b/pom.xml index 8f4828d..725c1a3 100644 --- a/pom.xml +++ b/pom.xml @@ -82,6 +82,18 @@ [3.2.0-SNAPSHOT, 4.0.0-SNAPSHOT) provided + + org.gcube.portal + social-networking-library + [1.3.0-SNAPSHOT, 2.0.0-SNAPSHOT) + provided + + + org.gcube.portlets.user + wsmail-widget + [1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT) + provided + com.liferay.portal portal-service @@ -94,12 +106,6 @@ 2.0 provided - - org.gcube.portal - social-networking-library - 1.0.0-SNAPSHOT - provided - org.slf4j slf4j-log4j12 diff --git a/src/main/gwt-unitCache/gwt-unitCache-0000013FF1ABCB9C b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1ABCB9C new file mode 100644 index 0000000..4328ec8 Binary files /dev/null and b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1ABCB9C differ diff --git a/src/main/gwt-unitCache/gwt-unitCache-0000013FF1AD2AD9 b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1AD2AD9 new file mode 100644 index 0000000..0b2fa4f Binary files /dev/null and b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1AD2AD9 differ diff --git a/src/main/gwt-unitCache/gwt-unitCache-0000013FF1AE025B b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1AE025B new file mode 100644 index 0000000..c27dc6f Binary files /dev/null and b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1AE025B differ diff --git a/src/main/gwt-unitCache/gwt-unitCache-0000013FF1AF379F b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1AF379F new file mode 100644 index 0000000..c1c6c84 Binary files /dev/null and b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1AF379F differ diff --git a/src/main/gwt-unitCache/gwt-unitCache-0000013FF1C07D7D b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1C07D7D new file mode 100644 index 0000000..c6049b8 Binary files /dev/null and b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1C07D7D differ diff --git a/src/main/gwt-unitCache/gwt-unitCache-0000013FF1C17F4D b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1C17F4D new file mode 100644 index 0000000..806fb2b Binary files /dev/null and b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1C17F4D differ diff --git a/src/main/gwt-unitCache/gwt-unitCache-0000013FF1C66245 b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1C66245 new file mode 100644 index 0000000..907d023 Binary files /dev/null and b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1C66245 differ diff --git a/src/main/gwt-unitCache/gwt-unitCache-0000013FF1C7CCC9 b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1C7CCC9 new file mode 100644 index 0000000..dad8353 Binary files /dev/null and b/src/main/gwt-unitCache/gwt-unitCache-0000013FF1C7CCC9 differ diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplayProfile.java b/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplayProfile.java index 0a98333..48d30e1 100644 --- a/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplayProfile.java +++ b/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplayProfile.java @@ -1,16 +1,23 @@ package org.gcube.portlets.user.socialprofile.client.ui; +import java.util.ArrayList; +import java.util.List; + + +import org.gcube.portal.databook.client.GCubeSocialNetworking; +import org.gcube.portal.databook.client.util.Encoder; import org.gcube.portal.databook.shared.UserInfo; import org.gcube.portlets.user.socialprofile.client.SocialService; import org.gcube.portlets.user.socialprofile.client.SocialServiceAsync; import org.gcube.portlets.user.socialprofile.shared.UserContext; +import org.gcube.portlets.user.wsmail.client.forms.MailForm; import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Style.Unit; +import com.google.gwt.core.client.RunAsyncCallback; import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Button; @@ -25,6 +32,7 @@ public class DisplayProfile extends Composite { protected final static String HEADLINE_TEXT = "Professional Headline"; protected final static String HEADLINE_ERROR = "Your Headline please"; protected final static String ISTI_TEXT = "Company"; + protected final static String ISTI_ERROR = "Your Company please"; private static DisplayProfileUiBinder uiBinder = GWT .create(DisplayProfileUiBinder.class); @@ -40,18 +48,26 @@ public class DisplayProfile extends Composite { @UiField HTMLPanel mainPanel; @UiField Image avatarImage; @UiField HTML userFullName; - @UiField TextBox headline; - @UiField TextBox institution; + @UiField TextBox headlineBox; + @UiField TextBox institutionBox; @UiField HTML editHeadline; @UiField HTML editIsti; + @UiField HTML headlineLabel; + @UiField HTML institutionLabel; + @UiField Image savingHeadline; @UiField Button saveHead; @UiField Button cancelHead; + + @UiField Button saveIsti; + @UiField Button cancelIsti; + @UiField Button messageButton; private String currHeadLine; + private String currInstitution; private UserInfo myUserInfo; @@ -73,29 +89,29 @@ public class DisplayProfile extends Composite { String head = (result.getHeadline() == null || result.getHeadline().compareTo("") == 0) ? HEADLINE_TEXT : result.getHeadline(); String isti = (result.getInstitution() == null ||result.getInstitution().compareTo("") == 0) ? ISTI_TEXT : result.getInstitution(); - headline.setText(head); - institution.setText(isti); + headlineLabel.setText(head); + institutionLabel.setText(isti); editHeadline.setStyleName("editImage"); editHeadline.setTitle("Edit your Professional Headline"); - headline.setMaxLength(35); - + editIsti.setStyleName("editImage"); editIsti.setTitle("Edit your Company"); + headlineBox.setMaxLength(70); + institutionBox.setMaxLength(70); + messageButton.removeFromParent(); currHeadLine = head; if (result.getHeadline() == null || result.getHeadline().compareTo("") == 0) { - headline.getElement().getStyle().setOpacity(0.5); - institution.getElement().getStyle().setOpacity(0.5); - headline.getElement().getStyle().setWidth(270, Unit.PX); - institution.getElement().getStyle().setWidth(270, Unit.PX); + headlineLabel.getElement().getStyle().setOpacity(0.5); + institutionLabel.getElement().getStyle().setOpacity(0.5); } } else { //its someone else String head = (result.getHeadline() == null || result.getHeadline().compareTo("") == 0) ? "" : result.getHeadline(); String isti = (result.getInstitution() == null || result.getInstitution().compareTo("") == 0) ? "" : result.getInstitution(); - headline.setText(head); - institution.setText(isti); + headlineLabel.setText(head); + institutionLabel.setText(isti); avatarImage.getElement().getParentElement().setAttribute("href", ""); avatarImage.setTitle(myUserInfo.getFullName()); @@ -112,74 +128,153 @@ public class DisplayProfile extends Composite { avatarImage.setUrl(avatar_default); } }); - - editHeadline.addClickHandler(new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - headline.addStyleName("edit"); - headline.setReadOnly(false); - headline.setFocus(true); - headline.selectAll(); - editHeadline.setVisible(false); - saveHead.setVisible(true); - cancelHead.setVisible(true); - } - }); - - saveHead.addClickHandler(new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - String toShare = escapeHtml(headline.getText()); - if (toShare.equals("") || toShare.equals(HEADLINE_TEXT) || toShare.equals(HEADLINE_ERROR)) { - headline.setText(HEADLINE_ERROR); - } else { - currHeadLine = toShare; - saveHead.setVisible(false); - cancelHead.setVisible(false); - savingHeadline.setVisible(true); - headline.setReadOnly(true); - socialService.saveHeadline(currHeadLine, new AsyncCallback() { + } + + @UiHandler("editHeadline") + void onEditHeadlineClick(ClickEvent e) { + headlineLabel.setVisible(false); + headlineBox.setText(headlineLabel.getText()); + headlineBox.addStyleName("edit"); + headlineBox.setVisible(true); + headlineBox.setFocus(true); + headlineBox.selectAll(); - @Override - public void onFailure(Throwable caught) { - Window.alert("Sorry, an error occurred"); - cancelHeadline(); - } + editHeadline.setVisible(false); + saveHead.setVisible(true); + cancelHead.setVisible(true); + } + + @UiHandler("editIsti") + void onEditInstitutionClick(ClickEvent e) { + institutionLabel.setVisible(false); + institutionBox.setText(institutionLabel.getText()); + institutionBox.addStyleName("edit"); + institutionBox.setVisible(true); + institutionBox.setFocus(true); + institutionBox.selectAll(); - @Override - public void onSuccess(Boolean result) { - headline.removeStyleName("edit"); - editHeadline.setVisible(true); - headline.getElement().getStyle().setOpacity(1.0); - } - }); - + editIsti.setVisible(false); + saveIsti.setVisible(true); + cancelIsti.setVisible(true); + } + + @UiHandler("cancelHead") + void onCancelHeadlineClick(ClickEvent e) { + cancelHeadline(); + } + + @UiHandler("cancelIsti") + void onCancelIstiClick(ClickEvent e) { + cancelInsti(); + } + + + @UiHandler("saveHead") + void onSaveHeadlineClick(ClickEvent e) { + String toShare = escapeHtml(headlineBox.getText()); + if (toShare.equals("") || toShare.equals(HEADLINE_TEXT) || toShare.equals(HEADLINE_ERROR)) { + headlineBox.setText(HEADLINE_ERROR); + } else { + currHeadLine = toShare; + saveHead.setVisible(false); + cancelHead.setVisible(false); + savingHeadline.setVisible(true); + socialService.saveHeadline(currHeadLine, new AsyncCallback() { + + @Override + public void onFailure(Throwable caught) { + Window.alert("Sorry, an error occurred"); + cancelHeadline(); + savingHeadline.setVisible(false); } - } - }); - - cancelHead.addClickHandler(new ClickHandler() { + + @Override + public void onSuccess(Boolean result) { + headlineLabel.setText(currHeadLine); + editHeadline.setVisible(true); + headlineLabel.getElement().getStyle().setOpacity(1.0); + headlineBox.setVisible(false); + headlineLabel.setVisible(true); + savingHeadline.setVisible(false); + } + }); + + } + } + + @UiHandler("saveIsti") + void onSaveInstitutionClick(ClickEvent e) { + String toShare = escapeHtml(institutionBox.getText()); + if (toShare.equals("") || toShare.equals(ISTI_TEXT) || toShare.equals(ISTI_ERROR)) { + institutionBox.setText(ISTI_ERROR); + } else { + currInstitution = toShare; + saveIsti.setVisible(false); + cancelIsti.setVisible(false); + savingHeadline.setVisible(true); + socialService.saveIsti(currInstitution, new AsyncCallback() { + + @Override + public void onFailure(Throwable caught) { + Window.alert("Sorry, an error occurred"); + cancelHeadline(); + savingHeadline.setVisible(false); + } + + @Override + public void onSuccess(Boolean result) { + institutionLabel.setText(currInstitution); + editIsti.setVisible(true); + institutionLabel.getElement().getStyle().setOpacity(1.0); + institutionBox.setVisible(false); + institutionLabel.setVisible(true); + savingHeadline.setVisible(false); + } + }); + + } + } + + @UiHandler("messageButton") + void onSendPrivateMessageClick(ClickEvent e) { + final List listToLogin = new ArrayList(); + listToLogin.add(getUserToShowId() ); + GWT.runAsync(new RunAsyncCallback() { @Override - public void onClick(ClickEvent event) { - cancelHeadline(); + public void onSuccess() { + new MailForm(listToLogin); } + public void onFailure(Throwable reason) { + Window.alert("Could not load this component: " + reason.getMessage()); + } }); } private void cancelHeadline() { - headline.removeStyleName("edit"); - headline.setReadOnly(true); editHeadline.setVisible(true); saveHead.setVisible(false); cancelHead.setVisible(false); - headline.setText(currHeadLine); + headlineBox.setVisible(false); + headlineLabel.setVisible(true); } + + private void cancelInsti() { + editIsti.setVisible(true); + saveIsti.setVisible(false); + cancelIsti.setVisible(false); + institutionBox.setVisible(false); + institutionLabel.setVisible(true); + } + + /** * check if it has to show just one feed * @return */ private String getUserToShowId() { - return Window.Location.getParameter(GET_OID_PARAMETER); + String encodedOid = Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID); + String encodedUserId = Window.Location.getParameter(encodedOid); + return Encoder.decode(encodedUserId); } /** diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplayProfile.ui.xml b/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplayProfile.ui.xml index 5de82e0..7b57e6d 100644 --- a/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplayProfile.ui.xml +++ b/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplayProfile.ui.xml @@ -4,40 +4,57 @@ - -
+ +
- - + + + + + + - -
- - Save - Cancel - - + +
- + - - + + +
+ Save + Cancel +
+
+ +
+ + + + +
+ Save + Cancel +
+
+
diff --git a/src/main/resources/org/gcube/portlets/user/socialprofile/SocialProfile.gwt.xml b/src/main/resources/org/gcube/portlets/user/socialprofile/SocialProfile.gwt.xml index d645b22..ab3f781 100644 --- a/src/main/resources/org/gcube/portlets/user/socialprofile/SocialProfile.gwt.xml +++ b/src/main/resources/org/gcube/portlets/user/socialprofile/SocialProfile.gwt.xml @@ -3,10 +3,11 @@ - + + - + - + + + socialService + org.gcube.portlets.user.socialprofile.server.SocialServiceImpl + - - - socialService - org.gcube.portlets.user.socialprofile.server.SocialServiceImpl - + + socialService + /socialprofile/socialService + - - socialService - /socialprofile/socialService - + + mailWisdgetServlet + org.gcube.portlets.user.wsmail.server.WsMailServiceImpl + - - - SocialProfile.html - + + mailWisdgetServlet + /socialprofile/mailWisdgetServlet + + + workspaceServiceImpl + org.gcube.portlets.user.workspace.lighttree.server.WorkspaceServiceImpl + + + workspaceServiceImpl + /socialprofile/WorkspaceLightService + + + + SocialProfile.html +