예제 #1
0
  /**
   * Because this class has a default constructor, it can be used as a binder template. In other
   * words, it can be used in other *.ui.xml files as follows: <ui:UiBinder
   * xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:**user's package**">
   * <g:**UserClassName**>Hello!</g:**UserClassName> </ui:UiBinder> Note that depending on the
   * widget that is used, it may be necessary to implement HasHTML instead of HasText.
   */
  public CollaboratorsUc(CollectionDo collectionDo) {
    initWidget(uiBinder.createAndBindUi(this));
    teamContainer.getElement().setId("fpnlTeamContainer");
    AppClientFactory.getInjector()
        .getCollaboratorsService()
        .getAssociatedCollaborators(
            collectionDo.getGooruOid(),
            "active",
            new SimpleAsyncCallback<Map<String, ArrayList<CollaboratorsDo>>>() {

              @Override
              public void onSuccess(Map<String, ArrayList<CollaboratorsDo>> result) {
                renderTeamNames(teamContainer, getTeamMembersNames(result.get("active")));
              }
            });
  }
예제 #2
0
  /**
   * create delete confirmation pop and delete the collection if user wants
   *
   * @param clickEvent instance of {@link ClickEvent}
   */
  @UiHandler("folderDeleteLabel")
  public void deleteCollectionPopup(ClickEvent clickEvent) {
    folderDeleteConfirmationPopUp =
        new FolderDeleteConfirmationPopUp(
            "Are you sure?", "\"" + collectionDo.getTitle() + "\"" + " Folder.") {

          @Override
          public void onTextConfirmed() {
            getUiHandlers().deleteMyFolder(collectionDo.getGooruOid(), collectionDo);
            folderDeleteConfirmationPopUp.hide();
            Window.enableScrolling(true);
            AppClientFactory.fireEvent(new SetHeaderZIndexEvent(0, true));

            //					AppClientFactory.fireEvent(new RefreshCollectionInShelfListEvent(collectionDo,
            // RefreshType.DELETE));
          }
        };
  }
예제 #3
0
  public void collection(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    String id = request.getParameter("id");
    StringBuffer htmlOutput = new StringBuffer();
    PrintWriter out = response.getWriter();
    response.setContentType("text/html");
    if (id != null) {
      String protocolRequest = request.getScheme();
      String homeEndPoint = resourceService.getHomeEndPointForEmbed();
      String restEndPoint = resourceService.getRestEndPointForEmbed();
      String cssEndPoint =
          homeEndPoint
              .replaceAll(MessageProperties.HTTP + ":", "")
              .replaceAll(MessageProperties.HTTPS + ":", "");

      if (protocolRequest.equalsIgnoreCase(MessageProperties.HTTPS)) {
        homeEndPoint = homeEndPoint.replaceAll(MessageProperties.HTTP, MessageProperties.HTTPS);
        restEndPoint = restEndPoint.replaceAll(MessageProperties.HTTP, MessageProperties.HTTPS);
      }

      CollectionDo collectionDo = resourceService.getCollectionFromEmbed(id, restEndPoint);
      if (collectionDo != null && collectionDo.getGooruOid() != null) {
        int resourceCount = 0;
        int questoionResourceCount = 0;
        for (CollectionItemDo collectionItemDo : collectionDo.getCollectionItems()) {
          if (collectionItemDo.getResource().getCategory().equalsIgnoreCase("Question")) {
            questoionResourceCount++;
          } else {
            resourceCount++;
          }
        }
        String resourcesString = resourceCount == 1 ? "1 resource," : resourceCount + " resources,";
        String questoionResourceCountString =
            questoionResourceCount == 1 ? "1 question" : questoionResourceCount + " questions";
        String collectionItems = resourcesString + " " + questoionResourceCountString;
        htmlOutput
            .append(" <!DOCTYPE html>")
            .append("<html><head>")
            .append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />")
            .append(
                "<link rel=\"stylesheet\" type=\"text/css\" href=\""
                    + cssEndPoint
                    + "/css/embed.css\">")
            .append("</head>")
            .append(
                "<body><div class=\"embed-container\"><div class=\"collection-image\"><a href=\""
                    + homeEndPoint
                    + "/#collection-play&id="
                    + collectionDo.getGooruOid()
                    + "\"target=\"_blank\" class=\"collectionImage\"><image onerror=\"this.src='"
                    + homeEndPoint
                    + "/images/collection-default-image.png'\" src="
                    + collectionDo.getThumbnails().getUrl()
                    + " width=\"310px\" height=\"208px\"><div class=\"button\">Study</div></a></div>")
            .append("<div class=\"metadata\">")
            .append(
                "<h1 class=\"title\"><a href=\""
                    + homeEndPoint
                    + "/#collection-play&id="
                    + collectionDo.getGooruOid()
                    + "\"target=\"_blank\">"
                    + collectionDo.getTitle()
                    + "</a></h1>")
            .append(
                "<div class=\"description\"><span class=\"label\">Description: </span>"
                    + collectionDo.getGoals()
                    + "</div>")
            .append(
                "<div class=\"resources\">"
                    + collectionItems
                    + "</div></div></div></div> </body></html>");
      }
    }
    out.println(htmlOutput.toString());
  }
예제 #4
0
 @Override
 public void setFolderMetaData(CollectionDo collectionDo) {
   folderTitle.setText(collectionDo.getTitle());
   folderDescription.setText(collectionDo.getGoals());
   foldersBreadCrumps.setText("Folders > " + collectionDo.getTitle());
 }