Exemplo n.º 1
0
        @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);
          }
        }
Exemplo n.º 2
0
  /**
   * 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);
  }