Exemplo n.º 1
0
 /**
  * To update the folder details.
  *
  * @param folderId
  * @param currentItem
  */
 protected void updateFolder(String folderId, final TreeItem currentItem) {
   AppClientFactory.getInjector()
       .getfolderService()
       .updateFolder(
           folderId,
           folderTitleTxtBox.getText().trim(),
           null,
           null,
           null,
           new SimpleAsyncCallback<Void>() {
             @Override
             public void onSuccess(Void result) {
               folderObj.setTitle(folderTitleTxtBox.getText());
               folderObj.setType("folder");
               rightPresenter
                   .getShelfMainPresenter()
                   .updateTitleOfTreeWidget(folderObj, false, currentItem);
               rightPresenter
                   .getShelfMainPresenter()
                   .getView()
                   .getCollectionLabel()
                   .setText(folderTitleTxtBox.getText());
               rightPresenter.setTabItems(2, FOLDER, folderObj);
             }
           });
 }
Exemplo n.º 2
0
  @UiHandler("saveFolderBtn")
  public void clickSaveFolderBtn(ClickEvent clickEvent) {
    final TreeItem currentItem = rightPresenter.getCurrentTreeItem();
    if (!StringUtil.isEmpty(folderTitleTxtBox.getText())) {
      if (folderTitleTxtBox.getText().length() < 50) {
        Map<String, String> parms = new HashMap<String, String>();
        parms.put("text", folderTitleTxtBox.getText().trim());
        AppClientFactory.getInjector()
            .getResourceService()
            .checkProfanity(
                parms,
                new SimpleAsyncCallback<Boolean>() {
                  @Override
                  public void onSuccess(Boolean result) {
                    if (result) {
                      SetStyleForProfanity.SetStyleForProfanityForTextBox(
                          folderTitleTxtBox, lblErrorMessage, result);
                    } else {
                      lblErrorMessage.setVisible(false);
                      String o1 =
                          AppClientFactory.getPlaceManager().getRequestParameter("o1", null);
                      String o2 =
                          AppClientFactory.getPlaceManager().getRequestParameter("o2", null);
                      String o3 =
                          AppClientFactory.getPlaceManager().getRequestParameter("o3", null);
                      String gooruOid = folderObj.getGooruOid();
                      if (o3 != null) {
                        updateFolder(o3, currentItem);
                      } else if (o2 != null) {
                        updateFolder(o2, currentItem);
                      } else if (o1 != null) {
                        updateFolder(o1, currentItem);
                      }
                      /*if(o1!=null){
                      	updateFolder(o1);
                      }else if(o2!=null)*/

                      /*if(o2==null){
                      	createFolder(o1);
                      }else if(gooruOid==o2){
                      	updateFolder(o2);
                      }else if(o2!=null && o3==null){
                      	createFolder(o2);
                      }else if(gooruOid==o3){
                      	updateFolder(o3);
                      }*/
                    }
                  }
                });
      } else {
        lblErrorMessage.setVisible(true);
        lblErrorMessage.setText(i18n.GL1427());
      }
    } else {
      lblErrorMessage.setVisible(true);
      lblErrorMessage.setText(StringUtil.generateMessage(i18n.GL0067(), "Folder"));
    }
  }
Exemplo n.º 3
0
 /** To Create folder */
 protected void createFolder(String parentId) {
   AppClientFactory.getInjector()
       .getfolderService()
       .createFolder(
           folderTitleTxtBox.getText().trim(),
           parentId,
           false,
           new SimpleAsyncCallback<FolderDo>() {
             @Override
             public void onSuccess(FolderDo folderDo) {
               Map<String, String> params = new HashMap<String, String>();
               params.put("o1", AppClientFactory.getPlaceManager().getRequestParameter("o1"));
               params.put("o2", folderDo.getGooruOid());
               params.put("view", "Folder");
               //				rightPresenter.getShelfMainPresenter().updateTitleOfTreeWidget(folderDo,true);
               rightPresenter.setTabItems(2, FOLDER, folderDo);
             }
           });
 }
  public void setData() {
    String pageType =
        AppClientFactory.getPlaceManager()
            .getRequestParameter(
                UrlNavigationTokens.STUDENT_CLASSPAGE_PAGE_DIRECT,
                UrlNavigationTokens.STUDENT_CLASSPAGE_COURSE_VIEW);
    String classUId =
        AppClientFactory.getPlaceManager()
            .getRequestParameter(UrlNavigationTokens.STUDENT_CLASSPAGE_CLASS_ID, null);
    String classGooruOid =
        AppClientFactory.getPlaceManager()
            .getRequestParameter(UrlNavigationTokens.STUDENT_CLASSPAGE_COURSE_ID, null);
    String unitId =
        AppClientFactory.getPlaceManager()
            .getRequestParameter(UrlNavigationTokens.STUDENT_CLASSPAGE_UNIT_ID, null);
    String lessonId =
        AppClientFactory.getPlaceManager()
            .getRequestParameter(UrlNavigationTokens.STUDENT_CLASSPAGE_LESSON_ID, null);

    if (classGooruOid == null) {
      getView().setContent(new ArrayList<PlanProgressDo>(), "", "");
    } else if (pageType.equalsIgnoreCase(UrlNavigationTokens.STUDENT_CLASSPAGE_COURSE_VIEW)) {
      if (classGooruOid != null) {
        AppClientFactory.getInjector()
            .getClasspageService()
            .getStudentPlanProgressData(
                classUId,
                classGooruOid,
                null,
                null,
                "plan",
                null,
                new SimpleAsyncCallback<ArrayList<PlanProgressDo>>() {
                  @Override
                  public void onSuccess(ArrayList<PlanProgressDo> dataList) {
                    getView().setMetadataContent(dataList);
                    getView()
                        .setContent(
                            dataList,
                            getClasspageDo().getStatus(),
                            getClasspageDo().getUser().getGooruUId());
                  }

                  @Override
                  public void onFailure(Throwable caught) {
                    getView().setContentVisiblity(true);
                  }
                });
      }
    } else if (pageType.equalsIgnoreCase(UrlNavigationTokens.STUDENT_CLASSPAGE_UNIT_VIEW)) {
      if (classGooruOid != null) {
        AppClientFactory.getInjector()
            .getClasspageService()
            .getStudentPlanProgressData(
                classUId,
                classGooruOid,
                null,
                null,
                "plan",
                null,
                new SimpleAsyncCallback<ArrayList<PlanProgressDo>>() {
                  @Override
                  public void onSuccess(ArrayList<PlanProgressDo> dataList) {
                    getView().setMetadataContent(dataList);
                  }

                  @Override
                  public void onFailure(Throwable caught) {
                    getView().setContentVisiblity(true);
                  }
                });
      }
      if (classGooruOid != null && unitId != null) {
        AppClientFactory.getInjector()
            .getClasspageService()
            .getStudentPlanProgressData(
                classUId,
                classGooruOid,
                unitId,
                null,
                "plan",
                null,
                new SimpleAsyncCallback<ArrayList<PlanProgressDo>>() {
                  @Override
                  public void onSuccess(ArrayList<PlanProgressDo> dataList) {
                    getView()
                        .setContent(
                            dataList,
                            getClasspageDo().getStatus(),
                            getClasspageDo().getUser().getGooruUId());
                  }

                  @Override
                  public void onFailure(Throwable caught) {
                    getView().setContentVisiblity(true);
                  }
                });
      }
    } else if (pageType.equalsIgnoreCase(UrlNavigationTokens.STUDENT_CLASSPAGE_LESSON_VIEW)) {
      if (classGooruOid != null && unitId != null && lessonId != null) {
        AppClientFactory.getInjector()
            .getClasspageService()
            .getStudentPlanProgressData(
                classUId,
                classGooruOid,
                unitId,
                null,
                "plan",
                null,
                new SimpleAsyncCallback<ArrayList<PlanProgressDo>>() {
                  @Override
                  public void onSuccess(ArrayList<PlanProgressDo> dataList) {
                    getView().setMetadataContent(dataList);
                  }

                  @Override
                  public void onFailure(Throwable caught) {
                    getView().setContentVisiblity(true);
                  }
                });
      }
    }
  }
  @Override
  public void getLessonPlanData(String contentGooruIds) {
    final String classUId =
        AppClientFactory.getPlaceManager()
            .getRequestParameter(UrlNavigationTokens.STUDENT_CLASSPAGE_CLASS_ID, null);
    final String classGooruOid =
        AppClientFactory.getPlaceManager()
            .getRequestParameter(UrlNavigationTokens.STUDENT_CLASSPAGE_COURSE_ID, null);
    final String unitId =
        AppClientFactory.getPlaceManager()
            .getRequestParameter(UrlNavigationTokens.STUDENT_CLASSPAGE_UNIT_ID, null);
    final String lessonId =
        AppClientFactory.getPlaceManager()
            .getRequestParameter(UrlNavigationTokens.STUDENT_CLASSPAGE_LESSON_ID, null);
    final Map<String, String> queryParams = new HashMap<String, String>();
    queryParams.put("contentGooruIds", contentGooruIds);

    if (classGooruOid != null && unitId != null && lessonId != null) {
      AppClientFactory.getInjector()
          .getClasspageService()
          .getClasspageCollections(
              classUId,
              classGooruOid,
              unitId,
              lessonId,
              "assessment",
              new SimpleAsyncCallback<PlanContentDo>() {
                @Override
                public void onSuccess(final PlanContentDo collectionList) {
                  final Map<String, PlanProgressDo> data = new HashMap<String, PlanProgressDo>();
                  AppClientFactory.getInjector()
                      .getClasspageService()
                      .getStudentPlanProgressData(
                          classUId,
                          classGooruOid,
                          unitId,
                          lessonId,
                          "plan",
                          queryParams,
                          new SimpleAsyncCallback<ArrayList<PlanProgressDo>>() {
                            @Override
                            public void onSuccess(ArrayList<PlanProgressDo> dataList) {
                              for (int i = 0; i < dataList.size(); i++) {
                                data.put(dataList.get(i).getGooruOId(), dataList.get(i));
                              }
                              if (collectionList.getItems() != null
                                  && collectionList.getItems().size() > 0) {
                                ArrayList<PlanContentDo> contentList = collectionList.getItems();
                                for (int i = 0; i < contentList.size(); i++) {
                                  contentList
                                      .get(i)
                                      .setProgress(data.get(contentList.get(i).getGooruOid()));
                                }
                                collectionList.setItems(contentList);
                              }
                              getView()
                                  .setLessonContent(
                                      collectionList,
                                      getClasspageDo().getStatus(),
                                      getClasspageDo().getUser().getGooruUId(),
                                      getClasspageDo().getMinimumScore());
                            }

                            @Override
                            public void onFailure(Throwable caught) {
                              getView().setContentVisiblity(true);
                            }
                          });
                }

                @Override
                public void onFailure(Throwable caught) {
                  getView().setContentVisiblity(true);
                }
              });
    }
  }