@Override public void updateSocialShareMetaData(String title, String description1, String imageUrl) { socialDo.setTitle(title); socialDo.setDescription(description1); description = socialDo.getDescription(); if (description == null) { description = ""; } else { description = description.replaceAll("\\<.*?\\>", ""); } if (!imageUrl.equalsIgnoreCase("")) { socialDo.setThumbnailurl(imageUrl); } }
/** * Call Twitter share event * * @param clickEvent instance of {@link ClickEvent} */ @UiHandler("twitterPanel") public void onTwitterClickEvent(ClickEvent event) { if (!(socialDo.getShareType().equalsIgnoreCase("private"))) { if (AppClientFactory.getCurrentPlaceToken().equals(PlaceTokens.RESOURCE_SEARCH)) { MixpanelUtil.Click_Twitter_FromResource(); } else if (AppClientFactory.getCurrentPlaceToken().equals(PlaceTokens.COLLECTION_SEARCH)) { MixpanelUtil.Click_Twitter_FromCollection(); } else if (AppClientFactory.getCurrentPlaceToken().equals(PlaceTokens.COLLECTION_PLAY) || AppClientFactory.getCurrentPlaceToken().equals(PlaceTokens.PREVIEW_PLAY)) { if (socialShareContainer.getElement().getId().equalsIgnoreCase("collectionShareViewPage")) { MixpanelUtil.ClickTwitterFromShareInCollectionplayer(); } else if (socialShareContainer .getElement() .getId() .equalsIgnoreCase("collectionShareSummaryPage")) { MixpanelUtil.ClickTwitterFromSummaryPageInCollectionplayer(); } } onTwisterShareEvent(); } }
/** Share the data by using FB. */ private void onFbShareEvent() { MixpanelUtil.Click_On_FaceBook(); if (AppClientFactory.getCurrentPlaceToken().equals(PlaceTokens.PROFILE_PAGE)) { if (socialDo.getIsSearchShare()) { triggerShareDataEvent(PlayerDataLogEvents.FACEBOOK, false); SocialShareView.postOnFacebook( socialDo.getTitle(), socialDo.getRawUrl(), description, categoryImage.getUrl()); // Window.open( // "http://www.facebook.com/sharer/sharer.php?s=100&p[url]=" // + socialDo.getRawUrl() + "&p[images][0]=" // + socialDo.getThumbnailurl() + "&p[title]=" // + socialDo.getTitle().replaceAll("\\+", "%2B") + "&p[summary]=" + description, // "_blank", "width=626,height=436"); } else { triggerShareDataEvent(PlayerDataLogEvents.FACEBOOK, false); String title = i18n.GL1995() + " " + i18n.GL1433(); String token = Window.Location.getHref(); SocialShareView.postOnFacebook( title, socialDo.getRawUrl(), getAsHtml(description) + " " + token, categoryImage.getUrl()); // Window.open( // "http://www.facebook.com/sharer/sharer.php?s=100&p[url]=" // +socialDo.getRawUrl() + "&p[images][0]=" // + socialDo.getThumbnailurl() + "&p[title]=" // + "Check out "+socialDo.getTitle().replaceAll("\\+", "%2B")+" on Gooru" + // "&p[summary]=" + description, // "_blank", "width=626,height=436"); } } else { triggerShareDataEvent(PlayerDataLogEvents.FACEBOOK, false); SocialShareView.postOnFacebook( socialDo.getTitle(), socialDo.getRawUrl(), description, categoryImage.getUrl()); // Window.open( // "http://www.facebook.com/sharer/sharer.php?s=100&p[url]=" // + socialDo.getRawUrl() + "&p[images][0]=" // + socialDo.getThumbnailurl() + "&p[title]=" // + socialDo.getTitle().replaceAll("\\+", "%2B") + "&p[summary]=" + description, // "_blank", "width=626,height=436"); } }
/** Share the data by using Twister. */ private void onTwisterShareEvent() { MixpanelUtil.Click_On_Twitter(); if (AppClientFactory.getCurrentPlaceToken().equals(PlaceTokens.PROFILE_PAGE)) { if (socialDo.getIsSearchShare()) { triggerShareDataEvent(PlayerDataLogEvents.TWITTER, false); Window.open( "http://twitter.com/intent/tweet?text=" + "Gooru - " + socialDo.getTitle().replaceAll("\\+", "%2B") + ": " + socialDo.getBitlylink(), "_blank", "width=600,height=300"); } else { triggerShareDataEvent(PlayerDataLogEvents.TWITTER, false); // Window.open("http://twitter.com/intent/tweet?text=" + "Check out // "+socialDo.getTitle().replaceAll("\\+", "%2B")+ "'s Gooru Profile Page - " + // socialDo.getBitlylink(), "_blank", "width=600,height=300"); Window.open( "http://twitter.com/intent/tweet?text=" + getEncodedUrl(i18n.GL1085_1()) + socialDo.getBitlylink(), "_blank", "width=600,height=300"); } } else { triggerShareDataEvent(PlayerDataLogEvents.TWITTER, false); Window.open( "http://twitter.com/intent/tweet?text=" + "Gooru - " + socialDo.getTitle().replaceAll("\\+", "%2B") + ": " + socialDo.getBitlylink(), "_blank", "width=600,height=300"); } }
public void setShareDo(SocialShareDo shareDo) { this.socialDo = shareDo; setUrl(socialDo.getThumbnailurl()); }
@Override public void onLoad() { setUrl(socialDo.getThumbnailurl()); }
/** @param url of the image */ public void setUrl(String url) { categoryImage.setUrl(StringUtil.formThumbnailName(url, ".")); categoryImage.setAltText(socialDo.getTitle()); categoryImage.setTitle(socialDo.getTitle()); }
/** * Class constructor * * @param collectionDo instance of {@link CollectionDo} */ public SocialShareView(SocialShareDo shareDo) { this.socialDo = shareDo; initWidget(uiBinder.createAndBindUi(this)); shareTextPanel.getElement().setId("pnlShareTextPanel"); fbPanel.getElement().setId("epnlFbPanel"); twitterPanel.getElement().setId("epnlTwitterPanel"); emailPanel.getElement().setId("epnlEmailPanel"); panelTwitter.getElement().setId("pnlPanelTwitter"); panelEmail.getElement().setId("pnlPanelEmail"); emailText.getElement().setInnerHTML(i18n.GL0212()); emailText.getElement().setId("pnlEmailText"); emailText.getElement().setAttribute("alt", i18n.GL0212()); emailText.getElement().setAttribute("title", i18n.GL0212()); twitterText.getElement().setInnerHTML(i18n.GL0647()); twitterText.getElement().setId("pnlTwitterText"); twitterText.getElement().setAttribute("alt", i18n.GL0647()); twitterText.getElement().setAttribute("title", i18n.GL0647()); facbookText.getElement().setInnerHTML(i18n.GL0646()); facbookText.getElement().setId("pnlFacbookText"); facbookText.getElement().setAttribute("alt", i18n.GL0646()); facbookText.getElement().setAttribute("title", i18n.GL0646()); shareIconPanel.getElement().setId("pnlShareIconPanel"); fbIconPanel.getElement().setId("epnlFbIconPanel"); panelfbIcon.getElement().setId("pnlPanelfbIcon"); twIconPanel.getElement().setId("epnlTwIconPanel"); panelTwIcon.getElement().setId("pnlPanelTwIcon"); emailIconPanel.getElement().setId("epnlEmailIconPanel"); panelEmailIcon.getElement().setId("pnlPanelEmailIcon"); categoryImage.getElement().setId("imgCategoryImage"); category = socialDo.getCategoryType() != null ? socialDo.getCategoryType() : "collection"; description = socialDo.getDescription(); String title = socialDo.getTitle(); if (description == null) { description = ""; } else { description = description.replaceAll("\\<.*?\\>", ""); } if (title == null) { title = ""; } setPresenter(new SocialSharePresenter(this)); // shareTextPanel.getElement().getStyle().setCursor(Cursor.POINTER); try { if (socialDo.getIsSearchShare()) { socialShareContainer.getElement().getStyle().setWidth(100, Unit.PX); } } catch (Exception e) { } if (socialDo.isOnlyIcon()) { shareTextPanel.setVisible(false); shareIconPanel.setVisible(true); } else { shareIconPanel.setVisible(false); shareTextPanel.setVisible(true); } if (title.contains("img")) { socialDo.setTitle(i18n.GL0308()); } else { if (title.length() > 50) { title = title.substring(0, 50) + "..."; socialDo.setTitle(title.replaceAll("<p>", "").replaceAll("</p>", "")); } else { socialDo.setTitle(title.replaceAll("<p>", "").replaceAll("</p>", "")); } } // if(AppClientFactory.getCurrentPlaceToken().equals(PlaceTokens.SHELF)){ if ((socialDo.getShareType().equalsIgnoreCase("private"))) { panelfbIcon.setStyleName(socialShareStyle.classPageShareButtonsFTEBgDisable()); panelTwIcon.setStyleName(socialShareStyle.classPageShareButtonsFTEBgDisable()); panelEmailIcon.setStyleName(socialShareStyle.classPageShareButtonsFTEBgDisable()); fbPanel.setStyleName(socialShareStyle.classPageShareButtonsBgDisable()); panelTwitter.setStyleName(socialShareStyle.classPageShareButtonsBgDisable()); panelEmail.setStyleName(socialShareStyle.classPageShareButtonsBgDisable()); // shareTextPanel.getElement().getStyle().setCursor(Cursor.DEFAULT); // shareIconPanel.getElement().getStyle().setCursor(Cursor.DEFAULT); } else { panelfbIcon.setStyleName(socialShareStyle.fbPageShareIconButtonsBg()); panelTwIcon.setStyleName(socialShareStyle.twitterPageShareIconButtonsBg()); panelEmailIcon.setStyleName(socialShareStyle.classPageShareButtonsFTEBg()); fbPanel.setStyleName(socialShareStyle.fbPageShareButtonsBg()); panelTwitter.setStyleName(socialShareStyle.twitterPageShareButtonsBg()); panelEmail.setStyleName(socialShareStyle.classPageShareButtonsBg()); // shareTextPanel.getElement().getStyle().setCursor(Cursor.POINTER); // shareIconPanel.getElement().getStyle().setCursor(Cursor.POINTER); } // } // categoryImage.addErrorHandler(new ErrorHandler() { // // @Override // public void onError(ErrorEvent event) { // String url = socialDo.getThumbnailurl(); // if (url == null || url.endsWith("null") || url.contains("null") || url.endsWith("/")){ // if(category==null){ // categoryImage.setUrl(DEFULT_IMAGE); // } // else if (category.equalsIgnoreCase("collection")) { // categoryImage.setUrl(DEFULT_IMAGE); // } else if (category.equalsIgnoreCase("video")) { // categoryImage.setUrl(DEFULT_VIMAGE); // } else if (category.equalsIgnoreCase("question")) { // categoryImage.setUrl(DEFULT_QIMAGE); // } else if (category.equalsIgnoreCase("interactive")) { // categoryImage.setUrl(DEFULT_IIMAGE); // } else if // (category.equalsIgnoreCase("website")||category.equalsIgnoreCase("exam")||category.equalsIgnoreCase("webpage")) { // categoryImage.setUrl(DEFULT_WIMAGE); // } else if (category.equalsIgnoreCase("slide")||category.equalsIgnoreCase("image")){ // categoryImage.setUrl(DEFULT_ITYPEIMAGE); // } else if // (category.equalsIgnoreCase("textbook")||category.equalsIgnoreCase("handout")||category.equalsIgnoreCase("lesson")||category.equalsIgnoreCase("text")) { // categoryImage.setUrl(DEFULT_TEXTIMAGE); // } else if (category.equalsIgnoreCase("audio")) { // categoryImage.setUrl(DEFULT_AIMAGE); // } else if (category.equalsIgnoreCase("other")) { // categoryImage.setUrl(DEFULT_OIMAGE); // } else if (category.equalsIgnoreCase("profile")){ // categoryImage.setUrl(DEFAULT_PROFILEIMAGE); // } // } // socialDo.setThumbnailurl(categoryImage.getUrl()); // } // }); // setUrl(socialDo.getThumbnailurl()); if (AppClientFactory.getCurrentPlaceToken().equalsIgnoreCase(PlaceTokens.PROFILE_PAGE)) { isProfilePageView = true; } /** * Adding Event Handler. * * @param UpdateSocialShareMetaDataEvent.TYPE is type of event. * @param setHeader is Object of Handler. */ AppClientFactory.getEventBus().addHandler(UpdateSocialShareMetaDataEvent.TYPE, setHeader); }