@Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {

    addSolutionLink = uifactory.addFormLink("add.solution", formLayout, Link.BUTTON);
    addSolutionLink.setElementCssClass("o_sel_course_gta_add_solution");
    addSolutionLink.setIconLeftCSS("o_icon o_icon_upload");
    createSolutionLink = uifactory.addFormLink("create.solution", formLayout, Link.BUTTON);
    createSolutionLink.setElementCssClass("o_sel_course_gta_create_solution");
    createSolutionLink.setIconLeftCSS("o_icon o_icon_edit");

    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(
        new DefaultFlexiColumnModel(SolCols.title.i18nKey(), SolCols.title.ordinal()));
    columnsModel.addFlexiColumnModel(
        new DefaultFlexiColumnModel(SolCols.file.i18nKey(), SolCols.file.ordinal()));
    columnsModel.addFlexiColumnModel(
        new DefaultFlexiColumnModel(SolCols.author.i18nKey(), SolCols.author.ordinal()));
    columnsModel.addFlexiColumnModel(
        new StaticFlexiColumnModel(
            "table.header.edit",
            SolCols.edit.ordinal(),
            "edit",
            new BooleanCellRenderer(
                new StaticFlexiCellRenderer(translate("edit"), "edit"),
                new StaticFlexiCellRenderer(translate("replace"), "edit"))));
    columnsModel.addFlexiColumnModel(
        new StaticFlexiColumnModel("table.header.edit", translate("delete"), "delete"));

    solutionModel = new SolutionTableModel(columnsModel);
    solutionTable =
        uifactory.addTableElement(
            getWindowControl(), "table", solutionModel, getTranslator(), formLayout);
    solutionTable.setExportEnabled(true);
    updateModel();
  }
  /**
   * @see
   *     org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer,
   *     org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
   */
  @Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormDescription("group.search.description");

    search = uifactory.addTextElement("search.field", "search.field", 100, "", formLayout);

    if (isUsedInStepWizzard()) {
      searchLink = uifactory.addFormLink("search", formLayout, Link.BUTTON);
    } else {
      searchButton = uifactory.addFormSubmitButton("search", formLayout);
      uifactory.addSpacerElement("space", formLayout, false);
    }

    errorComp = uifactory.createSimpleErrorText("error", "");
    formLayout.add(errorComp);

    tableCont =
        FormLayoutContainer.createCustomFormLayout(
            "", getTranslator(), velocity_root + "/resulttable.html");
    tableCont.setRootForm(mainForm);
    formLayout.add(tableCont);

    // group rights
    FlexiTableColumnModel tableColumnModel =
        FlexiTableDataModelFactory.createFlexiTableColumnModel();
    tableColumnModel.addFlexiColumnModel(
        new DefaultFlexiColumnModel(Cols.groupName.i18n(), Cols.groupName.ordinal()));
    tableColumnModel.addFlexiColumnModel(
        new DefaultFlexiColumnModel(
            true,
            Cols.description.i18n(),
            Cols.description.ordinal(),
            false,
            null,
            FlexiColumnModel.ALIGNMENT_LEFT,
            new TextFlexiCellRenderer(EscapeMode.antisamy)));
    tableColumnModel.addFlexiColumnModel(
        new DefaultFlexiColumnModel(Cols.courses.i18n(), Cols.courses.ordinal()));
    tableColumnModel.addFlexiColumnModel(
        new DefaultFlexiColumnModel(Cols.tutor.i18n(), Cols.tutor.ordinal()));
    tableColumnModel.addFlexiColumnModel(
        new DefaultFlexiColumnModel(Cols.participant.i18n(), Cols.participant.ordinal()));

    tableDataModel =
        new GroupTableDataModel(Collections.<GroupWrapper>emptyList(), tableColumnModel);
    table =
        uifactory.addTableElement(ureq, getWindowControl(), "groupList", tableDataModel, tableCont);
    tableCont.add("groupList", table);

    if (!isUsedInStepWizzard()) {
      saveLink = uifactory.addFormLink("save", formLayout, Link.BUTTON);
    }
  }
Ejemplo n.º 3
0
    @Override
    protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
      Boolean hasIdentitesToDelete = (Boolean) getFromRunContext("hasIdentitiesToDelete");
      FormLayoutContainer textContainer =
          FormLayoutContainer.createCustomFormLayout(
              "index", getTranslator(), velocity_root + "/delet_step01.html");
      formLayout.add(textContainer);
      textContainer.contextPut("hasIdentitesToDelete", hasIdentitesToDelete);
      if (hasIdentitesToDelete != null && !hasIdentitesToDelete.booleanValue()) {
        setNextStep(Step.NOSTEP);
        return;
      }

      Map<String, String> reqProbertyMap =
          new HashMap<String, String>(syncConfiguration.getUserAttributeMap());
      Collection<String> reqProberty = reqProbertyMap.values();
      reqProberty.remove(LDAPConstants.LDAP_USER_IDENTIFYER);

      @SuppressWarnings("unchecked")
      List<Identity> identitiesToDelete = (List<Identity>) getFromRunContext("identitiesToDelete");
      for (Identity identityToDelete : identitiesToDelete) {
        List<String> rowData = new ArrayList<>();
        rowData.add(identityToDelete.getName());
        for (String property : reqProberty) {
          rowData.add(identityToDelete.getUser().getProperty(property, null));
        }
      }

      FlexiTableColumnModel tableColumnModel =
          FlexiTableDataModelFactory.createFlexiTableColumnModel();
      int colPos = 0;
      tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("username", 10000));
      List<UserPropertyHandler> handlers = new ArrayList<>();
      for (String property : reqProberty) {
        List<UserPropertyHandler> properHandlerList =
            UserManager.getInstance().getAllUserPropertyHandlers();
        for (UserPropertyHandler userProperty : properHandlerList) {
          if (userProperty.getName().equals(property)) {
            tableColumnModel.addFlexiColumnModel(
                new DefaultFlexiColumnModel(userProperty.i18nColumnDescriptorLabelKey(), colPos++));
            handlers.add(userProperty);
          }
        }
      }

      FlexiTableDataModel<Identity> tableDataModel =
          new IdentityFlexiTableModel(identitiesToDelete, tableColumnModel, handlers, getLocale());
      uifactory.addTableElement(
          getWindowControl(), "newUsers", tableDataModel, getTranslator(), formLayout);
    }
  @Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CTCols.course, "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CTCols.courseNode, "select"));
    columnsModel.addFlexiColumnModel(
        new DefaultFlexiColumnModel("select", translate("select"), "select"));

    model = new CourseTemplateSearchDataModel(columnsModel);
    tableEl =
        uifactory.addTableElement(
            getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
    tableEl.setCustomizeColumns(false);
    tableEl.setEmtpyTableMessageKey("no.binders.template.available");
  }
  @Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormTitle("manage.transcodings.title");
    setFormDescription("manage.transcodings.description");
    setFormContextHelp("Portfolio template: Administration and editing#configuration");

    FlexiTableColumnModel transcodingModel =
        FlexiTableDataModelFactory.createFlexiTableColumnModel();
    transcodingModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TranscodingCols.resolutions));
    transcodingModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TranscodingCols.sumVideos));
    transcodingModel.addFlexiColumnModel(
        new DefaultFlexiColumnModel(TranscodingCols.numberTranscodings));
    transcodingModel.addFlexiColumnModel(
        new DefaultFlexiColumnModel(TranscodingCols.missingTranscodings));
    transcodingModel.addFlexiColumnModel(
        new DefaultFlexiColumnModel(
            TranscodingCols.transcode,
            "quality.transcode",
            new BooleanCellRenderer(
                new StaticFlexiCellRenderer(translate("quality.transcode"), "quality.transcode"),
                null)));
    transcodingModel.addFlexiColumnModel(
        new DefaultFlexiColumnModel(
            TranscodingCols.delete,
            "quality.delete",
            new BooleanCellRenderer(
                new StaticFlexiCellRenderer(translate("quality.delete"), "quality.delete"), null)));
    tableModel = new TranscodingTableModel(transcodingModel, getTranslator());

    transcodingTable =
        uifactory.addTableElement(
            getWindowControl(), "table", tableModel, getTranslator(), formLayout);
    transcodingTable.setCustomizeColumns(false);
    transcodingTable.setNumOfRowsEnabled(false);

    setChecks();
  }
  @Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {

    FormLayoutContainer groupGradingCont =
        FormLayoutContainer.createDefaultFormLayout("groupGrading", getTranslator());
    groupGradingCont.setRootForm(mainForm);
    formLayout.add(groupGradingCont);

    applyToAllEl =
        uifactory.addCheckboxesHorizontal(
            "applytoall", "group.apply.toall", groupGradingCont, onKeys, onValues);
    applyToAllEl.addActionListener(FormEvent.ONCHANGE);
    applyToAllEl.setElementCssClass("o_sel_course_gta_apply_to_all");

    if (withPassed && cutValue == null) {
      groupPassedEl =
          uifactory.addCheckboxesHorizontal(
              "checkgroup", "group.passed", groupGradingCont, onKeys, onValues);
      groupPassedEl.setElementCssClass("o_sel_course_gta_group_passed");
    }

    if (withScore) {
      String pointVal = "";
      groupScoreEl =
          uifactory.addTextElement("pointgroup", "group.score", 5, pointVal, groupGradingCont);
      groupScoreEl.setElementCssClass("o_sel_course_gta_group_score");
    }

    if (withComment) {
      String comment = "";
      groupCommentEl =
          uifactory.addTextAreaElement(
              "usercomment", "group.comment", 2500, 5, 40, true, comment, groupGradingCont);
      groupCommentEl.setElementCssClass("o_sel_course_gta_group_comment");
    }

    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (isAdministrativeUser) {
      columnsModel.addFlexiColumnModel(
          new DefaultFlexiColumnModel(Cols.username.i18nKey(), Cols.username.ordinal()));
    }

    int i = 0;
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
      int colIndex = GTACoachedGroupGradingController.USER_PROPS_OFFSET + i++;
      if (userPropertyHandler == null) continue;

      String propName = userPropertyHandler.getName();
      boolean visible =
          userManager.isMandatoryUserProperty(
              GTACoachedGroupGradingController.USER_PROPS_ID, userPropertyHandler);
      if (visible) {
        FlexiColumnModel col;
        if (UserConstants.FIRSTNAME.equals(propName) || UserConstants.LASTNAME.equals(propName)) {
          col =
              new DefaultFlexiColumnModel(
                  userPropertyHandler.i18nColumnDescriptorLabelKey(),
                  colIndex,
                  userPropertyHandler.getName(),
                  true,
                  propName,
                  new StaticFlexiCellRenderer(
                      userPropertyHandler.getName(), new TextFlexiCellRenderer()));
        } else {
          col =
              new DefaultFlexiColumnModel(
                  true,
                  userPropertyHandler.i18nColumnDescriptorLabelKey(),
                  colIndex,
                  true,
                  propName);
        }
        columnsModel.addFlexiColumnModel(col);
      }
    }

    if (withPassed && cutValue == null) {
      columnsModel.addFlexiColumnModel(
          new DefaultFlexiColumnModel(Cols.passedEl.i18nKey(), Cols.passedEl.ordinal()));
    }

    if (withScore) {
      columnsModel.addFlexiColumnModel(
          new DefaultFlexiColumnModel(Cols.scoreEl.i18nKey(), Cols.scoreEl.ordinal()));
    }

    if (withComment) {
      columnsModel.addFlexiColumnModel(
          new DefaultFlexiColumnModel(Cols.commentEl.i18nKey(), Cols.commentEl.ordinal()));
    }

    model = new GroupAssessmentModel(gtaNode, userPropertyHandlers, getLocale(), columnsModel);
    table =
        uifactory.addTableElement(
            getWindowControl(), "group-list", model, getTranslator(), formLayout);
    table.setCustomizeColumns(true);
    table.setEditMode(true);
    table.setAndLoadPersistedPreferences(ureq, "gtagroup-assessment");

    FormLayoutContainer buttonsCont =
        FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    formLayout.add(buttonsCont);
    uifactory.addFormSubmitButton("save", buttonsCont);
    saveAndDoneButton = uifactory.addFormLink("save.done", buttonsCont, Link.BUTTON);
    uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
  }