diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/client/SocialProfile.java b/src/main/java/org/gcube/portlets/user/socialprofile/client/SocialProfile.java index 8227d68..8a43f3c 100644 --- a/src/main/java/org/gcube/portlets/user/socialprofile/client/SocialProfile.java +++ b/src/main/java/org/gcube/portlets/user/socialprofile/client/SocialProfile.java @@ -35,10 +35,10 @@ public class SocialProfile implements EntryPoint { private DisplaySummary summary = new DisplaySummary(); public void onModuleLoad() { - + // set main panel width mainPanel.setWidth("80%"); - + if (isUserAuthZFromLinkedIn()) { String authorizationCode = checkLinkedInAuthZ(); if (authorizationCode != null) { 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 0538f31..a178b7c 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 @@ -95,11 +95,10 @@ public class DisplayProfile extends Composite { myUserInfo = result.getUserInfo(); avatarImage.getElement().getParentElement().setAttribute("href", myUserInfo.getAccountURL()); - avatarImage.setSize("100px", "100px"); avatarImage.setUrl(myUserInfo.getAvatarId()); userFullName.setText(myUserInfo.getFullName()); - if (SocialProfile.getUserToShowId() == null) { //its him seeing his profile + if (SocialProfile.getUserToShowId() == null || result.isOwner()) { //its him seeing his profile 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(); 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 c98db87..3c1d964 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 @@ -7,7 +7,7 @@ + url="" ui:field="avatarImage"/> diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplaySummary.java b/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplaySummary.java index 060a990..3ce034a 100644 --- a/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplaySummary.java +++ b/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplaySummary.java @@ -6,6 +6,7 @@ import org.gcube.portlets.user.socialprofile.client.SocialServiceAsync; import com.github.gwtbootstrap.client.ui.AlertBlock; import com.github.gwtbootstrap.client.ui.constants.AlertType; import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SimpleHtmlSanitizer; @@ -24,7 +25,7 @@ public class DisplaySummary extends Composite { private static DisplaySummaryUiBinder uiBinder = GWT .create(DisplaySummaryUiBinder.class); - + private final SocialServiceAsync socialService = GWT.create(SocialService.class); interface DisplaySummaryUiBinder extends UiBinder { @@ -33,10 +34,12 @@ public class DisplaySummary extends Composite { @UiField HTML summary; @UiField TextArea summaryEditingArea; @UiField Button saveSummary; + @UiField Button cancelEditSummary; @UiField AlertBlock alertBlock; public DisplaySummary() { initWidget(uiBinder.createAndBindUi(this)); + saveSummary.getElement().getStyle().setMarginRight(5, Unit.PX); } /** @@ -52,10 +55,10 @@ public class DisplaySummary extends Composite { * Hide the summary field and show the summaryEditingArea one */ public void enableEditing(){ - summary.setVisible(false); summaryEditingArea.setVisible(true); saveSummary.setVisible(true); + cancelEditSummary.setVisible(true); } @UiHandler("saveSummary") @@ -83,13 +86,14 @@ public class DisplaySummary extends Composite { summary.setVisible(true); summaryEditingArea.setVisible(false); saveSummary.setVisible(false); + cancelEditSummary.setVisible(false); alertBlock.setText("Background Summary successfully updated"); alertBlock.setType(AlertType.SUCCESS); }else{ alertBlock.setText("Background Summary not updated sorry"); alertBlock.setType(AlertType.ERROR); } - + alertBlock.setVisible(true); } @@ -103,6 +107,7 @@ public class DisplaySummary extends Composite { alertBlock.setText("Background Summary not updated sorry"); alertBlock.setType(AlertType.ERROR); alertBlock.setVisible(true); + cancelEditSummary.setVisible(false); } }); @@ -120,4 +125,15 @@ public class DisplaySummary extends Composite { // enable save button saveSummary.setEnabled(true); } + + @UiHandler("cancelEditSummary") + void onCancelClick(ClickEvent e){ + + // reset changes and exit + summaryEditingArea.setText(summary.getText()); + summary.setVisible(true); + summaryEditingArea.setVisible(false); + saveSummary.setVisible(false); + cancelEditSummary.setVisible(false); + } } diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplaySummary.ui.xml b/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplaySummary.ui.xml index 9b6e9b4..6c3b227 100644 --- a/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplaySummary.ui.xml +++ b/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplaySummary.ui.xml @@ -8,9 +8,12 @@
- +
+ Save + Cancel + \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/server/SocialServiceImpl.java b/src/main/java/org/gcube/portlets/user/socialprofile/server/SocialServiceImpl.java index 3825622..dda7110 100644 --- a/src/main/java/org/gcube/portlets/user/socialprofile/server/SocialServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/socialprofile/server/SocialServiceImpl.java @@ -90,7 +90,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer */ public String getDevelopmentUser() { String user = "test.user"; - //user = "massimiliano.assante"; + // user = "costantino.perciante"; return user; } /** @@ -109,7 +109,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer } @Override public UserContext getUserContext(String userid) { - if (userid == null || userid.equals("")) { + if (userid == null || userid.equals("") || userid.equals(getASLSession().getUsername())) { System.out.println("Own Profile"); _log.info("Own Profile"); return getOwnProfile(); @@ -159,7 +159,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer String company = user.getLocation_industry(); String summary = transformSummary(um.getUserProfessionalBackground(user.getUserId())); - return new UserContext(userInfo, headline, company, summary, session.getScopeName(), true, isInfrastructureScope()); + return new UserContext(userInfo, headline, company, summary, session.getScopeName(), false, isInfrastructureScope()); } catch (Exception e) { e.printStackTrace(); @@ -174,7 +174,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer UserInfo user = new UserInfo(username, username+ "FULL", thumbnailURL, email, "fakeAccountUrl", true, false, fakeVreNames); return new UserContext(user, "", "", "" + "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam." - + "", session.getScopeName(), true, isInfrastructureScope() ); + + "", session.getScopeName(), false, isInfrastructureScope()); } } diff --git a/src/main/webapp/SocialProfile.css b/src/main/webapp/SocialProfile.css index 1814a5e..407b2ec 100644 --- a/src/main/webapp/SocialProfile.css +++ b/src/main/webapp/SocialProfile.css @@ -17,9 +17,9 @@ .profile-section-title { padding: 1px 5px; - color: #333; - font-size: 18px; - font-weight: bold; + color: #333; + font-size: 18px; + font-weight: bold; } .summary { @@ -40,10 +40,15 @@ .user-details { padding: 5px; } + img.user-photo { display: block; padding: 2px; border: 1px solid #E6E6E6; + min-width: 30px; + min-height: 30px; + width: 100px; + height: auto; } .full-name { @@ -55,21 +60,21 @@ img.user-photo { .edit { border: 1px solid #999 !important; - cursor: text !important; - opacity: 1.0 !important; - width: 250px; + cursor: text !important; + opacity: 1.0 !important; + width: 250px; } .headline { font-family: 'Helvetica Neue', Arial, sans-serif; font-size: 16px; - color: #444444; + color: #444444; } .institution { font-family: 'Helvetica Neue', Arial, sans-serif; font-size: 13px; - color: #444444; + color: #444444; } .editImage { @@ -88,12 +93,11 @@ img.user-photo { background: url(images/edit.png) 0px -32px no-repeat; } - a.profile-link { font-weight: bold; } -a.profile-link,a.contact-link:visited { +a.profile-link, a.contact-link:visited { font-weight: bold; }