@Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormTitle("settings.title");
    formLayout.setElementCssClass("o_sel_course_forum_settings");

    if (forumModule.isAnonymousPostingWithPseudonymEnabled()) {
      String[] allowPseudonymValues = new String[] {translate("allow.pseudonym.post")};
      allowPseudonymEl =
          uifactory.addCheckboxesHorizontal(
              "allow.pseudonym", formLayout, allowKeys, allowPseudonymValues);
      allowPseudonymEl.setElementCssClass("o_sel_course_forum_allow_pseudo");
      allowPseudonymEl.setLabel(null, null);
      allowPseudonymEl.addActionListener(FormEvent.ONCHANGE);

      if ("true"
          .equals(
              foNode
                  .getModuleConfiguration()
                  .getStringValue(FOCourseNodeEditController.PSEUDONYM_POST_ALLOWED))) {
        allowPseudonymEl.select(allowKeys[0], true);
      }
    }

    String[] allowGuestValues = new String[] {translate("allow.guest.post")};
    allowGuestEl =
        uifactory.addCheckboxesHorizontal("allow.guest", formLayout, allowKeys, allowGuestValues);
    allowGuestEl.setElementCssClass("o_sel_course_forum_allow_guest");
    allowGuestEl.setLabel(null, null);
    allowGuestEl.addActionListener(FormEvent.ONCHANGE);
    if ("true"
        .equals(
            foNode
                .getModuleConfiguration()
                .getStringValue(FOCourseNodeEditController.GUEST_POST_ALLOWED))) {
      allowGuestEl.select(allowKeys[0], true);
    }
  }
  /**
   * @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) {
    // Create the business group name input text element
    if (bulkMode) {
      businessGroupName =
          uifactory.addTextElement(
              "create.form.title.bgnames",
              "create.form.title.bgnames",
              10 * BusinessGroup.MAX_GROUP_NAME_LENGTH,
              "",
              formLayout);
      businessGroupName.setExampleKey("create.form.message.example.group", null);
    } else {
      businessGroupName =
          uifactory.addTextElement(
              "create.form.title.bgname",
              "create.form.title.bgname",
              BusinessGroup.MAX_GROUP_NAME_LENGTH,
              "",
              formLayout);
      businessGroupName.setNotLongerThanCheck(
          BusinessGroup.MAX_GROUP_NAME_LENGTH, "create.form.error.nameTooLong");
      businessGroupName.setRegexMatchCheck(
          BusinessGroup.VALID_GROUPNAME_REGEXP, "create.form.error.illegalName");
    }
    businessGroupName.setElementCssClass("o_sel_group_edit_title");
    businessGroupName.setMandatory(true);
    businessGroupName.setEnabled(
        !BusinessGroupManagedFlag.isManaged(businessGroup, BusinessGroupManagedFlag.title));

    formLayout.setElementCssClass("o_sel_group_edit_group_form");

    // Create the business group description input rich text element
    businessGroupDescription =
        uifactory.addRichTextElementForStringDataMinimalistic(
            "create.form.title.description",
            "create.form.title.description",
            "",
            10,
            -1,
            formLayout,
            getWindowControl());
    businessGroupDescription.setEnabled(
        !BusinessGroupManagedFlag.isManaged(businessGroup, BusinessGroupManagedFlag.description));

    if (businessGroup != null && !bulkMode) {
      // link to group direct jump in business path
      BusinessControlFactory bcf = BusinessControlFactory.getInstance();
      List<ContextEntry> entries =
          bcf.createCEListFromString("[BusinessGroup:" + businessGroup.getKey() + "]");
      String url = bcf.getAsURIString(entries, true);
      StaticTextElement urlEl =
          uifactory.addStaticTextElement("create.form.businesspath", url, formLayout);
      urlEl.setElementCssClass("o_sel_group_url");
      // link to group visiting card
      bcf = BusinessControlFactory.getInstance();
      entries = bcf.createCEListFromString("[GroupCard:" + businessGroup.getKey() + "]");
      url = bcf.getAsURIString(entries, true);
      StaticTextElement cardEl =
          uifactory.addStaticTextElement("create.form.groupcard", url, formLayout);
      cardEl.setElementCssClass("o_sel_group_card_url");
    }

    uifactory.addSpacerElement("myspacer", formLayout, true);

    // Minimum members input
    businessGroupMinimumMembers =
        uifactory.addTextElement(
            "create.form.title.min", "create.form.title.min", 5, "", formLayout);
    businessGroupMinimumMembers.setDisplaySize(6);
    businessGroupMinimumMembers.setVisible(false); // currently the minimum feature is not enabled
    businessGroupMinimumMembers.setElementCssClass("o_sel_group_edit_min_members");

    // Maximum members input
    businessGroupMaximumMembers =
        uifactory.addTextElement(
            "create.form.title.max", "create.form.title.max", 5, "", formLayout);
    businessGroupMaximumMembers.setDisplaySize(6);
    businessGroupMaximumMembers.setElementCssClass("o_sel_group_edit_max_members");

    // Checkboxes
    enableWaitingList =
        uifactory.addCheckboxesHorizontal(
            "create.form.enableWaitinglist", null, formLayout, waitingListKeys, waitingListValues);
    enableWaitingList.setElementCssClass("o_sel_group_edit_waiting_list");
    enableAutoCloseRanks =
        uifactory.addCheckboxesHorizontal(
            "create.form.enableAutoCloseRanks", null, formLayout, autoCloseKeys, autoCloseValues);
    enableAutoCloseRanks.setElementCssClass("o_sel_group_edit_auto_close_ranks");

    // Enable only if specification of min and max members is possible
    businessGroupMinimumMembers.setVisible(false); // currently the minimum feature is not enabled
    businessGroupMaximumMembers.setVisible(true);
    enableWaitingList.setVisible(true);
    enableAutoCloseRanks.setVisible(true);

    boolean managedSettings =
        BusinessGroupManagedFlag.isManaged(businessGroup, BusinessGroupManagedFlag.settings);
    businessGroupMinimumMembers.setEnabled(!managedSettings);
    businessGroupMaximumMembers.setEnabled(!managedSettings);
    enableWaitingList.setEnabled(!managedSettings);
    enableAutoCloseRanks.setEnabled(!managedSettings);

    if ((businessGroup != null) && (!bulkMode)) {
      businessGroupName.setValue(businessGroup.getName());
      businessGroupDescription.setValue(businessGroup.getDescription());
      Integer minimumMembers = businessGroup.getMinParticipants();
      Integer maximumMembers = businessGroup.getMaxParticipants();
      businessGroupMinimumMembers.setValue(
          minimumMembers == null || minimumMembers.intValue() <= 0
              ? ""
              : minimumMembers.toString());
      businessGroupMaximumMembers.setValue(
          maximumMembers == null || maximumMembers.intValue() < 0 ? "" : maximumMembers.toString());
      if (businessGroup.getWaitingListEnabled() != null) {
        enableWaitingList.select(
            "create.form.enableWaitinglist", businessGroup.getWaitingListEnabled());
      }
      if (businessGroup.getAutoCloseRanksEnabled() != null) {
        enableAutoCloseRanks.select(
            "create.form.enableAutoCloseRanks", businessGroup.getAutoCloseRanksEnabled());
      }
    }

    if (!embbeded) {
      // Create submit and cancel buttons
      final FormLayoutContainer buttonLayout =
          FormLayoutContainer.createButtonLayout("buttonLayout", getTranslator());
      formLayout.add(buttonLayout);
      FormSubmit submit = uifactory.addFormSubmitButton("finish", buttonLayout);
      submit.setEnabled(
          !BusinessGroupManagedFlag.isManaged(businessGroup, BusinessGroupManagedFlag.details));
      uifactory.addFormCancelButton("cancel", buttonLayout, ureq, getWindowControl());
    }

    if ((businessGroup != null) && (!bulkMode)) {
      // managed group information
      boolean managed =
          StringHelper.containsNonWhitespace(businessGroup.getExternalId())
              || businessGroup.getManagedFlags().length > 0;
      if (managed) {
        uifactory.addSpacerElement("managedspacer", formLayout, false);

        String extId = businessGroup.getExternalId() == null ? "" : businessGroup.getExternalId();
        StaticTextElement externalIdEl =
            uifactory.addStaticTextElement("create.form.externalid", extId, formLayout);
        externalIdEl.setElementCssClass("o_sel_group_external_id");

        FormLayoutContainer flagsFlc =
            FormLayoutContainer.createHorizontalFormLayout("flc_flags", getTranslator());
        flagsFlc.setLabel("create.form.managedflags", null);
        formLayout.add(flagsFlc);

        String flags =
            businessGroup.getManagedFlagsString() == null
                ? ""
                : businessGroup.getManagedFlagsString().trim();
        String flagsFormatted = null;
        if (flags.length() > 0) {
          // use translator from REST admin package to import managed flags context help strings
          Translator managedTrans =
              Util.createPackageTranslator(RestapiAdminController.class, ureq.getLocale());
          StringBuffer flagList = new StringBuffer();
          flagList.append("<p class=\"o_important\">");
          flagList.append(translate("create.form.managedflags.intro"));
          flagList.append("</div>");
          flagList.append("<ul>");
          for (String flag : flags.split(",")) {
            flagList.append("<li>");
            flagList.append(managedTrans.translate("managed.flags.group." + flag));
            flagList.append("</li>");
          }

          flagsFormatted = flagList.toString();

        } else {
          flagsFormatted = flags;
        }

        StaticTextElement flagsEl =
            uifactory.addStaticTextElement("create.form.managedflags", flagsFormatted, flagsFlc);
        flagsEl.showLabel(false);
        flagsEl.setElementCssClass("o_sel_group_managed_flags");
      }
    }
  }
  @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());
  }