public AssessedIdentityRepositoryEntryController(
      UserRequest ureq,
      WindowControl wControl,
      TooledStackedPanel stackPanel,
      RepositoryEntry assessableEntry,
      Identity assessedIdentity,
      AssessableResource element) {
    super(ureq, wControl);

    this.stackPanel = stackPanel;
    this.assessedIdentity = assessedIdentity;

    identityAssessmentVC = createVelocityContainer("identity_personal_infos");
    identityAssessmentVC.contextPut("user", assessedIdentity.getUser());

    infosController = new AssessedIdentityLargeInfosController(ureq, wControl, assessedIdentity);
    listenTo(infosController);
    identityAssessmentVC.put("identityInfos", infosController.getInitialComponent());

    RepositoryHandler handler = repositoryHandlerFactory.getRepositoryHandler(assessableEntry);
    if (handler.supportsAssessmentDetails()) {
      detailsCtrl =
          handler.createAssessmentDetailsController(
              assessableEntry, ureq, getWindowControl(), stackPanel, assessedIdentity);
      listenTo(detailsCtrl);
      identityAssessmentVC.put("details", detailsCtrl.getInitialComponent());
    }

    assessmentForm =
        new AssessmentForm(ureq, getWindowControl(), assessedIdentity, assessableEntry, element);
    listenTo(assessmentForm);
    identityAssessmentVC.put("assessmentForm", assessmentForm.getInitialComponent());

    putInitialPanel(identityAssessmentVC);
  }
  @Override
  public Object getValueAt(int row, int col) {
    Identity identity = objects.get(row);

    switch (col) {
      case 0:
        return identity.getUser().getProperty(UserConstants.FIRSTNAME, getLocale());
      case 1:
        return identity.getUser().getProperty(UserConstants.LASTNAME, getLocale());
      case 2:
        return identity.getUser().getProperty(UserConstants.EMAIL, getLocale());
      case 3:
        return Boolean.TRUE;
      case 4:
        return Boolean.TRUE;

      default:
        return "error";
    }
  }
Exemple #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);
    }
  private void sendFeedback(List<BulkAssessmentFeedback> feedbacks) {
    if (task == null) {
      log.error("Haven't a task to know creator and modifiers of the task", null);
      return;
    }

    Identity creator = task.getCreator();
    String language = creator.getUser().getPreferences().getLanguage();
    Locale locale = I18nManager.getInstance().getLocaleOrDefault(language);
    Translator translator =
        Util.createPackageTranslator(
            BulkAssessmentOverviewController.class,
            locale,
            Util.createPackageTranslator(AssessmentManager.class, locale));
    MailManager mailManager = CoreSpringFactory.getImpl(MailManager.class);
    TaskExecutorManager taskManager = CoreSpringFactory.getImpl(TaskExecutorManager.class);

    String feedbackStr = renderFeedback(feedbacks, translator);

    MailBundle mail = new MailBundle();
    mail.setToId(creator);
    mail.setFrom(WebappHelper.getMailConfig("mailReplyTo"));
    List<Identity> modifiers = taskManager.getModifiers(task);
    if (modifiers.size() > 0) {
      ContactList cc = new ContactList("CC");
      cc.addAllIdentites(modifiers);
      mail.setContactList(cc);
    }

    String businessPath = "";
    ICourse course = CourseFactory.loadCourse(courseRes);
    CourseNode node = course.getRunStructure().getNode(courseNodeIdent);
    String courseTitle = course.getCourseTitle();
    String nodeTitle = node.getShortTitle();
    String numOfAssessedIds = Integer.toString(datas == null ? 0 : datas.getRowsSize());
    String date = Formatter.getInstance(locale).formatDateAndTime(new Date());

    mail.setContext(new MailContextImpl(courseRes, courseNodeIdent, businessPath));
    String subject =
        translator.translate("confirmation.mail.subject", new String[] {courseTitle, nodeTitle});
    String body =
        translator.translate(
            "confirmation.mail.body",
            new String[] {courseTitle, nodeTitle, feedbackStr, numOfAssessedIds, date});
    mail.setContent(subject, body);
    mailManager.sendMessage(mail);
  }
Exemple #5
0
 /** @return The name of the modifier */
 public String getModifier() {
   String modifierName = null;
   if (modifierKey > 0) {
     Identity identity = BaseSecurityManager.getInstance().loadIdentityByKey(modifierKey, false);
     if (identity != null) {
       User user = identity.getUser();
       if (user == null) {
         modifierName = modifier = identity.getName();
       } else {
         modifierName =
             modifier = CoreSpringFactory.getImpl(UserManager.class).getUserDisplayName(identity);
       }
     }
   }
   if (modifierName == null && StringHelper.containsNonWhitespace(modifier)) {
     modifierName = modifier;
   }
   return modifierName;
 }
  private UserSession afterAuthorization(Identity identity, HttpServletRequest request) {
    UserSession usess = sessionManager.getUserSession(request);
    synchronized (usess) {
      // double check to prevent severals concurrent login
      if (usess.isAuthenticated()) {
        return usess;
      }

      sessionManager.signOffAndClear(usess);
      usess.setIdentity(identity);
      UserDeletionManager.getInstance().setIdentityAsActiv(identity);
      // set the roles (admin, author, guest)
      Roles roles = BaseSecurityManager.getInstance().getRoles(identity);
      usess.setRoles(roles);
      // set session info
      SessionInfo sinfo =
          new SessionInfo(identity.getKey(), identity.getName(), request.getSession());
      User usr = identity.getUser();
      sinfo.setFirstname(usr.getProperty(UserConstants.FIRSTNAME, null));
      sinfo.setLastname(usr.getProperty(UserConstants.LASTNAME, null));

      String remoteAddr = request.getRemoteAddr();
      sinfo.setFromIP(remoteAddr);
      sinfo.setFromFQN(remoteAddr);
      try {
        InetAddress[] iaddr = InetAddress.getAllByName(request.getRemoteAddr());
        if (iaddr.length > 0) sinfo.setFromFQN(iaddr[0].getHostName());
      } catch (UnknownHostException e) {
        // ok, already set IP as FQDN
      }
      sinfo.setAuthProvider(BaseSecurityModule.getDefaultAuthProviderIdentifier());
      sinfo.setUserAgent(request.getHeader("User-Agent"));
      sinfo.setSecure(request.isSecure());
      sinfo.setWebDAV(true);
      sinfo.setWebModeFromUreq(null);
      // set session info for this session
      usess.setSessionInfo(sinfo);
      //
      sessionManager.signOn(usess);
      return usess;
    }
  }
Exemple #7
0
 /** @return The name of the author */
 public String getAuthor() {
   String authorName = null;
   if (authorKey > 0) {
     Identity identity = BaseSecurityManager.getInstance().loadIdentityByKey(authorKey, false);
     if (identity != null) {
       User user = identity.getUser();
       if (user == null) {
         authorName = author = identity.getName();
       } else {
         authorName =
             author =
                 user.getProperty(UserConstants.FIRSTNAME, null)
                     + " "
                     + user.getProperty(UserConstants.LASTNAME, null);
       }
     }
   }
   if (authorName == null && StringHelper.containsNonWhitespace(author)) {
     authorName = author;
   }
   return authorName;
 }
  private void doIdentityAssessmentOverview(UserRequest ureq, boolean initTable) {
    if (identityOverviewVC == null) {
      identityOverviewVC = createVelocityContainer("identityoverview");

      if (headers) {
        backLink = LinkFactory.createLinkBack(identityOverviewVC, this);
        Identity assessedIdentity =
            assessedUserCourseEnvironment.getIdentityEnvironment().getIdentity();
        identityOverviewVC.contextPut("user", assessedIdentity.getUser());
      }
    }
    if (initTable) {
      assessedUserCourseEnvironment.getScoreAccounting().evaluateAll();
      assessmentOverviewCtr =
          new IdentityAssessmentOverviewController(
              ureq, getWindowControl(), assessedUserCourseEnvironment, mayEdit, false, true);
      listenTo(assessmentOverviewCtr);
      identityOverviewVC.put(
          "assessmentOverviewTable", assessmentOverviewCtr.getInitialComponent());
    }
    main.setContent(identityOverviewVC);
  }
 /** Return the last name of the user */
 @Override
 public String getTitle() {
   return identity.getUser().getProperty(UserConstants.LASTNAME, locale);
 }
  /** Initialize form. */
  @Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {

    // create form elements
    projectTitle =
        uifactory.addInlineTextElement(
            "detailsform.title.label", project.getTitle(), formLayout, this);
    projectTitle.setMaxLength(100);
    projectTitle.setLabel("detailsform.title.label", null);

    // account-Managers
    StringBuilder projectLeaderString = new StringBuilder();
    for (Iterator iterator = project.getProjectLeaders().iterator(); iterator.hasNext(); ) {
      Identity identity = (Identity) iterator.next();
      String last = identity.getUser().getProperty(UserConstants.LASTNAME, getLocale());
      String first = identity.getUser().getProperty(UserConstants.FIRSTNAME, getLocale());
      if (projectLeaderString.length() > 0) {
        projectLeaderString.append(",");
      }
      projectLeaderString.append(first);
      projectLeaderString.append(" ");
      projectLeaderString.append(last);
    }
    projectLeaders =
        uifactory.addTextElement(
            "projectleaders",
            "detailsform.projectleaders.label",
            100,
            projectLeaderString.toString(),
            formLayout);
    projectLeaders.setEnabled(false);

    // add the learning objectives rich text input element
    projectDescription =
        uifactory.addRichTextElementForStringData(
            "description",
            "detailsform.description.label",
            project.getDescription(),
            10,
            -1,
            false,
            null,
            null,
            formLayout,
            ureq.getUserSession(),
            getWindowControl());
    projectDescription.setMaxLength(2500);
    uifactory.addSpacerElement("spacer_1", formLayout, false);

    // customfields
    List<CustomField> customFields = projectBrokerModuleConfiguration.getCustomFields();
    int customFieldIndex = 0;
    for (Iterator<CustomField> iterator = customFields.iterator(); iterator.hasNext(); ) {
      CustomField customField = iterator.next();
      getLogger().info("customField: " + customField.getName() + "=" + customField.getValue());
      StringTokenizer tok =
          new StringTokenizer(
              customField.getValue(), ProjectBrokerManager.CUSTOMFIELD_LIST_DELIMITER);
      if (customField.getValue() == null
          || customField.getValue().equals("")
          || !tok.hasMoreTokens()) {
        // no value define => Text-input
        // Add StaticTextElement as workaroung for non translated label
        uifactory.addStaticTextElement(
            "customField_label" + customFieldIndex, customField.getName(), formLayout);
        TextElement textElement =
            uifactory.addTextElement(
                "customField_" + customFieldIndex,
                "",
                20,
                project.getCustomFieldValue(customFieldIndex),
                formLayout);
        //				textElement.setLabelComponent(null, null);
        textElement.showLabel(false);
        //				textElement.setTranslator(null);
        //				textElement.setLabel(customField.getName(), null);

        customfieldElementList.add(textElement);
      } else {
        // values define => dropdown selection
        List<String> valueList = new ArrayList<String>();
        while (tok.hasMoreTokens()) {
          valueList.add(tok.nextToken());
        }
        String[] theValues = new String[valueList.size() + 1];
        String[] theKeys = new String[valueList.size() + 1];
        int arrayIndex = 0;
        theValues[arrayIndex] = translate(DROPDOWN_NO_SELECETION);
        theKeys[arrayIndex] = DROPDOWN_NO_SELECETION;
        arrayIndex++;
        for (Iterator<String> iterator2 = valueList.iterator(); iterator2.hasNext(); ) {
          String value = iterator2.next();
          theValues[arrayIndex] = value;
          theKeys[arrayIndex] = value;
          arrayIndex++;
        }
        // Add StaticTextElement as workaround for non translated label
        uifactory.addStaticTextElement(
            "customField_label" + customFieldIndex, null, customField.getName(), formLayout);
        SingleSelection selectionElement =
            uifactory.addDropdownSingleselect(
                "customField_" + customFieldIndex, null, formLayout, theKeys, theValues, null);
        if (project.getCustomFieldValue(customFieldIndex) != null
            && !project.getCustomFieldValue(customFieldIndex).equals("")) {
          if (valueList.contains(project.getCustomFieldValue(customFieldIndex))) {
            selectionElement.select(project.getCustomFieldValue(customFieldIndex), true);
          } else {
            this.showInfo(
                "warn.customfield.key.does.not.exist",
                project.getCustomFieldValue(customFieldIndex));
          }
        }
        customfieldElementList.add(selectionElement);
      }
      uifactory.addSpacerElement("customField_spacer" + customFieldIndex, formLayout, false);
      customFieldIndex++;
    }

    // Events
    for (Project.EventType eventType : Project.EventType.values()) {
      if (projectBrokerModuleConfiguration.isProjectEventEnabled(eventType)) {
        ProjectEvent projectEvent = project.getProjectEvent(eventType);
        DateChooser dateChooserStart =
            uifactory.addDateChooser(eventType + "start", null, formLayout);
        dateChooserStart.setLabel(eventType.getI18nKey() + ".start.label", null);
        dateChooserStart.setDateChooserTimeEnabled(true);
        dateChooserStart.setDisplaySize(CUSTOM_DATE_FORMAT.length());
        getLogger().info("Event=" + eventType + ", startDate=" + projectEvent.getStartDate());
        dateChooserStart.setDate(projectEvent.getStartDate());
        eventStartElementList.put(eventType, dateChooserStart);
        DateChooser dateChooserEnd = uifactory.addDateChooser(eventType + "end", null, formLayout);
        dateChooserEnd.setLabel(eventType.getI18nKey() + ".end.label", null);
        dateChooserEnd.setDateChooserTimeEnabled(true);
        dateChooserEnd.setDisplaySize(CUSTOM_DATE_FORMAT.length());
        getLogger().info("Event=" + eventType + ", endDate=" + projectEvent.getEndDate());
        dateChooserEnd.setDate(projectEvent.getEndDate());
        eventEndElementList.put(eventType, dateChooserEnd);
        uifactory.addSpacerElement(eventType + "spacer", formLayout, false);
      }
    }

    projectState =
        uifactory.addDropdownSingleselect(
            "detailsform.state.label", formLayout, stateKeys, stateValues, null);
    projectState.select(project.getState(), true);

    maxMembers =
        uifactory.addInlineIntegerElement(
            "detailsform.max.members.label", project.getMaxMembers(), formLayout, this);
    maxMembers.setLabel("detailsform.max.members.label", null);
    maxMembers.setMinValueCheck(0, null);

    attachmentFileName =
        uifactory.addFileElement("detailsform.attachmentfilename.label", formLayout);
    attachmentFileName.setLabel("detailsform.attachmentfilename.label", null);
    if (project.getAttachmentFileName() != null && !project.getAttachmentFileName().equals("")) {
      attachmentFileName.setInitialFile(new File(project.getAttachmentFileName()));
    }
    attachmentFileName.addActionListener(this, FormEvent.ONCHANGE);

    uifactory.addFormSubmitButton("save", formLayout);
  }
 /**
  * executed after click the link in email
  *
  * @param ureq
  * @param wControl
  */
 public ChangeEMailController(final UserRequest ureq, final WindowControl wControl) {
   super(wControl);
   this.userRequest = ureq;
   pT = new PackageTranslator(PACKAGE, userRequest.getLocale());
   pT = UserManager.getInstance().getPropertyHandlerTranslator(pT);
   emKey = userRequest.getHttpReq().getParameter("key");
   if ((emKey == null) && (userRequest.getUserSession().getEntry(CHANGE_EMAIL_ENTRY) != null)) {
     emKey = userRequest.getIdentity().getUser().getProperty("emchangeKey", null);
   }
   if (emKey != null) {
     // key exist
     // we check if given key is a valid temporary key
     tempKey = rm.loadTemporaryKeyByRegistrationKey(emKey);
   }
   if (emKey != null) {
     // if key is not valid we redirect to first page
     if (tempKey == null) {
       // registration key not available
       userRequest
           .getUserSession()
           .putEntryInNonClearedStore("error.change.email", pT.translate("error.change.email"));
       DispatcherAction.redirectToDefaultDispatcher(userRequest.getHttpResp());
       return;
     } else {
       if (!isLinkTimeUp()) {
         try {
           if ((userRequest.getUserSession().getEntry(CHANGE_EMAIL_ENTRY) == null)
               || (!userRequest
                   .getUserSession()
                   .getEntry(CHANGE_EMAIL_ENTRY)
                   .equals(CHANGE_EMAIL_ENTRY))) {
             userRequest
                 .getUserSession()
                 .putEntryInNonClearedStore(CHANGE_EMAIL_ENTRY, CHANGE_EMAIL_ENTRY);
             DispatcherAction.redirectToDefaultDispatcher(userRequest.getHttpResp());
             return;
           } else {
             if (userRequest.getIdentity() == null) {
               DispatcherAction.redirectToDefaultDispatcher(userRequest.getHttpResp());
               return;
             }
           }
         } catch (final ClassCastException e) {
           DispatcherAction.redirectToDefaultDispatcher(userRequest.getHttpResp());
           return;
         }
       } else {
         // link time is up
         userRequest
             .getUserSession()
             .putEntryInNonClearedStore(
                 "error.change.email.time", pT.translate("error.change.email.time"));
         final XStream xml = new XStream();
         final HashMap<String, String> mails =
             (HashMap<String, String>) xml.fromXML(tempKey.getEmailAddress());
         final Identity ident =
             UserManager.getInstance().findIdentityByEmail(mails.get("currentEMail"));
         if (ident != null) {
           // remove keys
           ident.getUser().setProperty("emchangeKey", null);
         }
         // delete registration key
         rm.deleteTemporaryKeyWithId(tempKey.getRegistrationKey());
         DispatcherAction.redirectToDefaultDispatcher(userRequest.getHttpResp());
         return;
       }
     }
   }
 }
  /**
   * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
   *     org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
   */
  @Override
  public void event(UserRequest ureq, Controller source, Event event) {
    if (source == loginForm && event == Event.DONE_EVENT) {
      String login = loginForm.getLogin();
      String pass = loginForm.getPass();
      if (loginModule.isLoginBlocked(login)) {
        // do not proceed when blocked
        showError("login.blocked", loginModule.getAttackPreventionTimeoutMin().toString());
        getLogger()
            .audit(
                "Login attempt on already blocked login for "
                    + login
                    + ". IP::"
                    + ureq.getHttpReq().getRemoteAddr(),
                null);
        return;
      }
      authenticatedIdentity = olatAuthenticationSpi.authenticate(null, login, pass);
      if (authenticatedIdentity == null) {
        if (loginModule.registerFailedLoginAttempt(login)) {
          getLogger()
              .audit(
                  "Too many failed login attempts for "
                      + login
                      + ". Login blocked. IP::"
                      + ureq.getHttpReq().getRemoteAddr(),
                  null);
          showError("login.blocked", loginModule.getAttackPreventionTimeoutMin().toString());
          return;
        } else {
          showError("login.error", WebappHelper.getMailConfig("mailReplyTo"));
          return;
        }
      } else {
        try {
          String language = authenticatedIdentity.getUser().getPreferences().getLanguage();
          UserSession usess = ureq.getUserSession();
          if (StringHelper.containsNonWhitespace(language)) {
            usess.setLocale(I18nManager.getInstance().getLocaleOrDefault(language));
          }
        } catch (Exception e) {
          logError("Cannot set the user language", e);
        }
      }

      loginModule.clearFailedLoginAttempts(login);

      // Check if disclaimer has been accepted
      if (registrationManager.needsToConfirmDisclaimer(authenticatedIdentity)) {
        // accept disclaimer first

        removeAsListenerAndDispose(disclaimerCtr);
        disclaimerCtr = new DisclaimerController(ureq, getWindowControl());
        listenTo(disclaimerCtr);

        removeAsListenerAndDispose(cmc);
        cmc =
            new CloseableModalController(
                getWindowControl(), translate("close"), disclaimerCtr.getInitialComponent());
        listenTo(cmc);

        cmc.activate();

      } else {
        // disclaimer acceptance not required
        authenticated(ureq, authenticatedIdentity);
      }
    } else if (source == disclaimerCtr) {
      cmc.deactivate();
      if (event == Event.DONE_EVENT) {
        // disclaimer accepted
        registrationManager.setHasConfirmedDislaimer(authenticatedIdentity);
        authenticated(ureq, authenticatedIdentity);
      }
    } else if (cmc == source) {
      cleanUp();
    }
    if (source == subController) {
      if (event == Event.CANCELLED_EVENT) {
        cmc.deactivate();
        cleanUp();
      }
    }
  }
  /** Initialize form. */
  @Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {

    // create form elements
    projectTitle =
        uifactory.addTextElement(
            "title", "detailsform.title.label", 100, project.getTitle(), formLayout);

    // account-Managers
    StringBuilder projectLeaderString = new StringBuilder();
    for (Iterator iterator = project.getProjectLeaders().iterator(); iterator.hasNext(); ) {
      Identity identity = (Identity) iterator.next();
      String last = identity.getUser().getProperty(UserConstants.LASTNAME, getLocale());
      String first = identity.getUser().getProperty(UserConstants.FIRSTNAME, getLocale());
      if (projectLeaderString.length() > 0) {
        projectLeaderString.append(",");
      }
      projectLeaderString.append(first);
      projectLeaderString.append(" ");
      projectLeaderString.append(last);
    }
    projectLeaders =
        uifactory.addTextElement(
            "projectleaders",
            "detailsform.projectleaders.label",
            100,
            projectLeaderString.toString(),
            formLayout);
    projectLeaders.setEnabled(false);

    // add the learning objectives rich text input element
    projectDescription =
        uifactory.addRichTextElementForStringData(
            "description",
            "detailsform.description.label",
            project.getDescription(),
            10,
            -1,
            false,
            null,
            null,
            formLayout,
            ureq.getUserSession(),
            getWindowControl());
    projectDescription.setMaxLength(2500);

    stateLayout = FormLayoutContainer.createHorizontalFormLayout("stateLayout", getTranslator());
    stateLayout.setLabel("detailsform.state.label", null);
    formLayout.add(stateLayout);
    String stateValue =
        getTranslator()
            .translate(
                ProjectBrokerManagerFactory.getProjectBrokerManager()
                    .getStateFor(project, ureq.getIdentity(), projectBrokerModuleConfiguration));
    projectState =
        uifactory.addStaticTextElement(
            "detailsform.state", stateValue + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", stateLayout);
    projectState.setLabel(null, null);

    String keyDetailsformMax = null;
    if (projectBrokerModuleConfiguration.isAcceptSelectionManually()) {
      keyDetailsformMax = "detailsform.max.candidates.label";
    } else {
      keyDetailsformMax = "detailsform.max.members.label";
    }
    selectionMaxMembers =
        uifactory.addCheckboxesHorizontal(keyDetailsformMax, formLayout, keys, values, null);
    maxMembers =
        uifactory.addIntegerElement(
            "form.options.number.of.participants.per.topic_nbr",
            project.getMaxMembers(),
            formLayout);
    maxMembers.setMinValueCheck(0, null);
    maxMembers.setDisplaySize(3);
    if (project.getMaxMembers() == Project.MAX_MEMBERS_UNLIMITED) {
      maxMembers.setVisible(false);
      selectionMaxMembers.select(keys[0], false);
    } else {
      selectionMaxMembers.select(keys[0], true);
    }
    selectionMaxMembers.addActionListener(listener, FormEvent.ONCLICK);
    uifactory.addSpacerElement("spacer_1", formLayout, false);

    // customfields
    List<CustomField> customFields = projectBrokerModuleConfiguration.getCustomFields();
    int customFieldIndex = 0;
    for (Iterator<CustomField> iterator = customFields.iterator(); iterator.hasNext(); ) {
      CustomField customField = iterator.next();
      getLogger().debug("customField: " + customField.getName() + "=" + customField.getValue());
      StringTokenizer tok =
          new StringTokenizer(
              customField.getValue(), ProjectBrokerManager.CUSTOMFIELD_LIST_DELIMITER);
      if (customField.getValue() == null
          || customField.getValue().equals("")
          || !tok.hasMoreTokens()) {
        // no value define => Text-input
        // Add StaticTextElement as workaroung for non translated label
        uifactory.addStaticTextElement(
            "customField_label" + customFieldIndex,
            null,
            customField.getName(),
            formLayout); // null > no label
        TextElement textElement =
            uifactory.addTextElement(
                "customField_" + customFieldIndex,
                "",
                150,
                project.getCustomFieldValue(customFieldIndex),
                formLayout);
        textElement.setDisplaySize(60);
        //				textElement.setTranslator(null);
        //				textElement.setLabel(customField.getName(), null);
        textElement.showLabel(false);
        customfieldElementList.add(textElement);
      } else {
        // values define => dropdown selection
        List<String> valueList = new ArrayList<String>();
        while (tok.hasMoreTokens()) {
          String value = tok.nextToken();
          valueList.add(value);
          getLogger().debug("valueList add: " + value);
        }
        String[] theValues = new String[valueList.size() + 1];
        String[] theKeys = new String[valueList.size() + 1];
        int arrayIndex = 0;
        theValues[arrayIndex] = translate(DROPDOWN_NO_SELECETION);
        theKeys[arrayIndex] = DROPDOWN_NO_SELECETION;
        arrayIndex++;
        for (Iterator<String> iterator2 = valueList.iterator(); iterator2.hasNext(); ) {
          String value = iterator2.next();
          theValues[arrayIndex] = value;
          theKeys[arrayIndex] = Integer.toString(arrayIndex);
          arrayIndex++;
        }
        // Add StaticTextElement as workaround for non translated label
        uifactory.addStaticTextElement(
            "customField_label" + customFieldIndex,
            null,
            customField.getName(),
            formLayout); // null > no label
        SingleSelection selectionElement =
            uifactory.addDropdownSingleselect(
                "customField_" + customFieldIndex, null, formLayout, theKeys, theValues, null);
        if (project.getCustomFieldValue(customFieldIndex) != null
            && !project.getCustomFieldValue(customFieldIndex).equals("")) {
          if (valueList.contains(project.getCustomFieldValue(customFieldIndex))) {
            String key =
                Integer.toString(
                    valueList.indexOf(project.getCustomFieldValue(customFieldIndex))
                        + 1); // '+1' because no-selection at the beginning
            selectionElement.select(key, true);
          } else {
            this.showInfo(
                "warn.customfield.key.does.not.exist",
                project.getCustomFieldValue(customFieldIndex));
          }
        }
        customfieldElementList.add(selectionElement);
      }
      uifactory.addSpacerElement("customField_spacer" + customFieldIndex, formLayout, false);
      customFieldIndex++;
    }

    // Events
    for (Project.EventType eventType : Project.EventType.values()) {
      if (projectBrokerModuleConfiguration.isProjectEventEnabled(eventType)) {
        ProjectEvent projectEvent = project.getProjectEvent(eventType);
        DateChooser dateChooserStart =
            uifactory.addDateChooser(
                eventType + "start", eventType.getI18nKey() + ".start.label", null, formLayout);
        dateChooserStart.setDateChooserTimeEnabled(true);
        dateChooserStart.setDisplaySize(CUSTOM_DATE_FORMAT.length());
        getLogger().info("Event=" + eventType + ", startDate=" + projectEvent.getStartDate());
        dateChooserStart.setDate(projectEvent.getStartDate());
        eventStartElementList.put(eventType, dateChooserStart);
        DateChooser dateChooserEnd =
            uifactory.addDateChooser(
                eventType + "end", eventType.getI18nKey() + ".end.label", null, formLayout);
        dateChooserEnd.setDateChooserTimeEnabled(true);
        dateChooserEnd.setDisplaySize(CUSTOM_DATE_FORMAT.length());
        getLogger().debug("Event=" + eventType + ", endDate=" + projectEvent.getEndDate());
        dateChooserEnd.setDate(projectEvent.getEndDate());
        eventEndElementList.put(eventType, dateChooserEnd);
        uifactory.addSpacerElement(eventType + "spacer", formLayout, false);
      }
    }

    attachmentFileName =
        uifactory.addFileElement("detailsform.attachmentfilename.label", formLayout);
    attachmentFileName.setLabel("detailsform.attachmentfilename.label", null);
    if (project.getAttachmentFileName() != null && !project.getAttachmentFileName().equals("")) {
      attachmentFileName.setInitialFile(new File(project.getAttachmentFileName()));
      removeAttachmentLink =
          uifactory.addFormLink("detailsform.remove.attachment", formLayout, Link.BUTTON_XSMALL);
    }
    attachmentFileName.addActionListener(this, FormEvent.ONCHANGE);

    mailNotification =
        uifactory.addCheckboxesHorizontal(
            "detailsform.mail.notification.label", formLayout, keys, values, null);
    mailNotification.select(keys[0], project.isMailNotificationEnabled());

    FormLayoutContainer buttonGroupLayout =
        FormLayoutContainer.createButtonLayout("buttonGroupLayout", getTranslator());
    formLayout.add(buttonGroupLayout);
    uifactory.addFormSubmitButton("save", buttonGroupLayout);
    if (this.enableCancel) {
      uifactory.addFormCancelButton(
          "cancel",
          buttonGroupLayout,
          ureq,
          getWindowControl()); // TODO: Frage an PB: Warum flc hier noetig ???
    }
  }