Esempio n. 1
0
  public void setValues(final UIPortlet uiPortlet) throws Exception {
    uiPortlet_ = uiPortlet;
    invokeGetBindingBean(uiPortlet_);
    String icon = uiPortlet.getIcon();

    if (icon == null || icon.length() < 0) {
      icon = "PortletIcon";
    }
    getChild(UIFormInputIconSelector.class).setSelectedIcon(icon);
    getChild(UIFormInputThemeSelector.class)
        .getChild(UIItemThemeSelector.class)
        .setSelectedTheme(uiPortlet.getSuitedTheme(null));
    if (hasEditMode()) {
      uiPortlet.setCurrentPortletMode(PortletMode.EDIT);
    } else {
      Map<String, String> portletPreferenceMaps = new HashMap<String, String>();
      org.gatein.pc.api.Portlet portlet = uiPortlet.getProducedOfferedPortlet();
      Set<String> keySet = portlet.getInfo().getPreferences().getKeys();

      for (String key : keySet) {
        PreferenceInfo preferenceInfo = portlet.getInfo().getPreferences().getPreference(key);
        if (!preferenceInfo.isReadOnly()) {
          String ppValue =
              (preferenceInfo.getDefaultValue().size() > 0)
                  ? preferenceInfo.getDefaultValue().get(0)
                  : "";
          portletPreferenceMaps.put(key, ppValue);
        }
      }

      Portlet pp = uiPortlet.getPreferences();
      if (pp != null) {
        for (Preference pref : pp) {
          if (!pref.isReadOnly()) {
            portletPreferenceMaps.put(
                pref.getName(), (pref.getValues().size() > 0) ? pref.getValues().get(0) : "");
          }
        }
      }

      if (portletPreferenceMaps.size() > 0) {
        Set<String> ppKeySet = portletPreferenceMaps.keySet();
        UIFormInputSet uiPortletPrefSet = getChildById(FIELD_PORTLET_PREF);
        uiPortletPrefSet.getChildren().clear();
        for (String ppKey : ppKeySet) {
          String ppValue = portletPreferenceMaps.get(ppKey);
          UIFormStringInput preferenceStringInput = new UIFormStringInput(ppKey, null, ppValue);
          preferenceStringInput.setLabel(ppKey);
          preferenceStringInput.addValidator(MandatoryValidator.class);
          uiPortletPrefSet.addUIFormInput(preferenceStringInput);
        }

        uiPortletPrefSet.setRendered(true);
        setSelectedTab(FIELD_PORTLET_PREF);
        return;
      }

      setSelectedTab("PortletSetting");
    }
  }
Esempio n. 2
0
  public UIPostForm() throws Exception {
    if (ForumUtils.isEmpty(getId())) setId("UIPostForm");
    isDoubleClickSubmit = false;
    UIFormStringInput postTitle =
        new UIFormStringInput(FIELD_POSTTITLE_INPUT, FIELD_POSTTITLE_INPUT, null);
    postTitle.addValidator(MandatoryValidator.class);
    UIFormStringInput editReason =
        new UIFormStringInput(FIELD_EDITREASON_INPUT, FIELD_EDITREASON_INPUT, null);
    editReason.setRendered(false);
    UIForumInputWithActions threadContent = new UIForumInputWithActions(FIELD_THREADCONTEN_TAB);
    UIFormWYSIWYGInput formWYSIWYGInput =
        new UIFormWYSIWYGInput(FIELD_MESSAGECONTENT, FIELD_MESSAGECONTENT, ForumUtils.EMPTY_STR);
    formWYSIWYGInput.addValidator(MandatoryValidator.class);
    formWYSIWYGInput.setToolBarName("Basic");
    formWYSIWYGInput.setWidth("92%");
    formWYSIWYGInput.setFCKConfig(WebUIUtils.getFCKConfig());
    threadContent.addChild(postTitle);
    threadContent.addChild(editReason);
    threadContent.addChild(formWYSIWYGInput);
    threadContent.addUIFormInput(new UIFormInputInfo(FIELD_ATTACHMENTS, FIELD_ATTACHMENTS, null));
    threadContent.setActionField(FIELD_THREADCONTEN_TAB, getUploadFileList());
    threadContent.setActionIdAddItem(FIELD_ATTACHMENTS);
    threadContent.setActionAddItem("Attachment");
    threadContent.setLabelActionAddItem(getLabel("Attachment"));

    addUIFormInput(threadContent);
    this.setActions(new String[] {"SubmitPost", "PreviewPost", "Cancel"});
    setAddColonInLabel(true);
  }
Esempio n. 3
0
  public UICategoryForm() throws Exception {
    isDoubleClickSubmit = false;
    UIFormInputWithActions detailTab = new UIFormInputWithActions(CATEGORY_DETAIL_TAB);

    UIFormStringInput categoryTitle =
        new UIFormStringInput(FIELD_CATEGORYTITLE_INPUT, FIELD_CATEGORYTITLE_INPUT, null);
    categoryTitle.addValidator(MandatoryValidator.class);
    UIFormStringInput categoryOrder =
        new UIFormStringInput(FIELD_CATEGORYORDER_INPUT, FIELD_CATEGORYORDER_INPUT, "0");
    categoryOrder.addValidator(PositiveNumberFormatValidator.class);
    UIFormTextAreaInput description =
        new UIFormTextAreaInput(FIELD_DESCRIPTION_INPUT, FIELD_DESCRIPTION_INPUT, null);

    UIFormTextAreaInput userPrivate =
        new UIFormTextAreaInput(FIELD_USERPRIVATE_MULTIVALUE, FIELD_USERPRIVATE_MULTIVALUE, null);

    detailTab.addUIFormInput(categoryTitle);
    detailTab.addUIFormInput(categoryOrder);
    detailTab.addUIFormInput(userPrivate);
    detailTab.addUIFormInput(description);

    String[] strings = new String[] {"SelectUser", "SelectMemberShip", "SelectGroup"};
    String[] icons = ForumUtils.getClassIconWithAction();
    List<ActionData> actions = new ArrayList<ActionData>();

    ActionData ad;
    int i = 0;
    for (String string : strings) {
      ad = new ActionData();
      if (i == 0) ad.setActionListener("AddValuesUser");
      else ad.setActionListener("AddPrivate");
      ad.setActionParameter(String.valueOf(i) + ForumUtils.COMMA + FIELD_USERPRIVATE_MULTIVALUE);
      ad.setCssIconClass(icons[i]);
      ad.setActionName(string);
      actions.add(ad);
      ++i;
    }
    detailTab.setActionField(FIELD_USERPRIVATE_MULTIVALUE, actions);
    addUIFormInput(detailTab);

    UIPermissionPanel permissionPanel =
        createUIComponent(UIPermissionPanel.class, null, PERMISSION_TAB);
    permissionPanel.setPermission(null, new String[] {MODERAROR, TOPICABLE, POSTABLE, VIEWER});
    addChild(permissionPanel);

    setActions(new String[] {"Save", "Cancel"});
    setAddColonInLabel(true);
  }
Esempio n. 4
0
  public void updatePost(String postId, boolean isQuote, boolean isPP, Post post) throws Exception {
    if (post != null) this.post_ = post;
    this.postId = postId;
    this.isQuote = isQuote;
    this.isMP = isPP;
    UIForumInputWithActions threadContent = this.getChildById(FIELD_THREADCONTEN_TAB);
    UIFormStringInput editReason = threadContent.getUIStringInput(FIELD_EDITREASON_INPUT);
    editReason.setRendered(false);
    if (!ForumUtils.isEmpty(this.postId) && post != null) {
      String message = CommonUtils.decodeSpecialCharToHTMLnumberIgnore(post.getMessage());
      if (isQuote) { // quote
        threadContent
            .getUIStringInput(FIELD_POSTTITLE_INPUT)
            .setValue(CommonUtils.decodeSpecialCharToHTMLnumber(getTitle(post.getName())));

        String value =
            "[QUOTE="
                + getForumService().getScreenName(post.getOwner())
                + "]"
                + message
                + "[/QUOTE]";
        threadContent.getChild(UIFormWYSIWYGInput.class).setValue(value);
      } else if (isPP) {
        threadContent
            .getUIStringInput(FIELD_POSTTITLE_INPUT)
            .setValue(CommonUtils.decodeSpecialCharToHTMLnumber(getTitle(topic.getTopicName())));
      } else { // edit
        this.attachments_.clear();
        editReason.setRendered(true);
        threadContent
            .getUIStringInput(FIELD_POSTTITLE_INPUT)
            .setValue(CommonUtils.decodeSpecialCharToHTMLnumber(post.getName()));
        if (post.getAttachments() != null && post.getAttachments().size() > 0) {
          this.attachments_.addAll(post.getAttachments());
          this.refreshUploadFileList();
        }
        threadContent.getChild(UIFormWYSIWYGInput.class).setValue(message);
      }
    } else {
      if (!isQuote) { // reply
        threadContent
            .getUIStringInput(FIELD_POSTTITLE_INPUT)
            .setValue(CommonUtils.decodeSpecialCharToHTMLnumber(getTitle(topic.getTopicName())));
      }
    }
  }
Esempio n. 5
0
  /**
   * constructor
   *
   * @param name
   * @throws Exception
   */
  public UISpaceSettings(String name) throws Exception {
    super(name);
    WebuiRequestContext requestContext = WebuiRequestContext.getCurrentInstance();
    ResourceBundle resourceBundle = requestContext.getApplicationResourceBundle();
    UIFormStringInput spaceDisplayName =
        new UIFormStringInput(SPACE_DISPLAY_NAME, SPACE_DISPLAY_NAME, null);
    spaceDisplayName.setHTMLAttribute(
        HTML_ATTRIBUTE_PLACEHOLDER,
        resourceBundle.getString("UISpaceSettings.label.spaceDisplayName"));
    addUIFormInput(
        spaceDisplayName
            .addValidator(MandatoryValidator.class)
            .addValidator(
                ExpressionValidator.class, "^([\\p{L}\\s\\d\']+[\\s]?)+$", MSG_INVALID_SPACE_NAME)
            .addValidator(StringLengthValidator.class, 3, 30));

    UIFormTextAreaInput description =
        new UIFormTextAreaInput(SPACE_DESCRIPTION, SPACE_DESCRIPTION, null);
    description.setHTMLAttribute(
        HTML_ATTRIBUTE_PLACEHOLDER,
        resourceBundle.getString("UISpaceSettings.label.spaceDescription"));
    addUIFormInput(description.addValidator(StringLengthValidator.class, 0, 255));
  }
  public UIDriveInputSet(String name) throws Exception {
    super(name);
    setComponentConfig(getClass(), null);

    addUIFormInput(
        new UIFormStringInput(FIELD_NAME, FIELD_NAME, null)
            .addValidator(MandatoryValidator.class)
            .addValidator(ECMNameValidator.class));
    addUIFormInput(new UIFormSelectBox(FIELD_WORKSPACE, FIELD_WORKSPACE, null));
    UIFormStringInput homePathField = new UIFormStringInput(FIELD_HOMEPATH, FIELD_HOMEPATH, null);
    homePathField.setValue("/");
    homePathField.setDisabled(true);
    addUIFormInput(homePathField);
    addUIFormInput(
        new UIFormStringInput(FIELD_WORKSPACEICON, FIELD_WORKSPACEICON, null).setDisabled(true));
    UIFormStringInput permissonSelectField =
        new UIFormStringInput(FIELD_PERMISSION, FIELD_PERMISSION, null);
    permissonSelectField.addValidator(MandatoryValidator.class);
    permissonSelectField.addValidator(DrivePermissionValidator.class);
    permissonSelectField.setDisabled(false);
    addUIFormInput(permissonSelectField);
    addUIFormInput(new UICheckBoxInput(FIELD_VIEWPREFERENCESDOC, FIELD_VIEWPREFERENCESDOC, null));
    addUIFormInput(new UICheckBoxInput(FIELD_VIEWNONDOC, FIELD_VIEWNONDOC, null));
    addUIFormInput(new UICheckBoxInput(FIELD_VIEWSIDEBAR, FIELD_VIEWSIDEBAR, null));
    addUIFormInput(new UICheckBoxInput(SHOW_HIDDEN_NODE, SHOW_HIDDEN_NODE, null));

    addUIFormInput(
        new UIFormSelectBox(FIELD_ALLOW_CREATE_FOLDERS, FIELD_ALLOW_CREATE_FOLDERS, null));
    UIFormStringInput filterNodeTypes =
        new UIFormStringInput(FIELD_ALLOW_NODETYPES_ON_TREE, FIELD_ALLOW_NODETYPES_ON_TREE, null);
    addUIFormInput(filterNodeTypes);
    setActionInfo(FIELD_ALLOW_NODETYPES_ON_TREE, new String[] {"ChooseNodeType", "RemoveNodeType"});
    setActionInfo(FIELD_PERMISSION, new String[] {"AddPermission", "RemovePermission"});
    setActionInfo(FIELD_HOMEPATH, new String[] {"AddPath"});
    setActionInfo(FIELD_WORKSPACEICON, new String[] {"AddIcon"});
    templateService = getApplicationComponent(TemplateService.class);
    setFoldertypes = templateService.getAllowanceFolderType();
  }
Esempio n. 7
0
  /**
   * constructor
   *
   * @throws Exception
   */
  public UISpaceInfo() throws Exception {
    WebuiRequestContext requestContext = WebuiRequestContext.getCurrentInstance();
    ResourceBundle resourceBundle = requestContext.getApplicationResourceBundle();
    UIFormStringInput spaceId = new UIFormStringInput(SPACE_ID, SPACE_ID, null).setRendered(false);
    spaceId.setHTMLAttribute(
        HTML_ATTRIBUTE_TITLE, resourceBundle.getString("UISpaceInfo.label.SpaceId"));
    addUIFormInput(spaceId);

    UIFormStringInput spaceDisplayName =
        new UIFormStringInput(SPACE_DISPLAY_NAME, SPACE_DISPLAY_NAME, null);
    spaceDisplayName.setHTMLAttribute(
        HTML_ATTRIBUTE_PLACEHOLDER,
        resourceBundle.getString("UISpaceSettings.label.spaceDisplayName"));
    addUIFormInput(
        spaceDisplayName
            .addValidator(MandatoryValidator.class)
            .addValidator(
                ExpressionValidator.class,
                "^([\\p{L}\\d\']+[\\s]?)+$",
                "UISpaceInfo.msg.name-invalid")
            .addValidator(StringLengthValidator.class, 3, 30));

    UIFormTextAreaInput description =
        new UIFormTextAreaInput(SPACE_DESCRIPTION, SPACE_DESCRIPTION, null);
    description.setHTMLAttribute(
        HTML_ATTRIBUTE_PLACEHOLDER,
        resourceBundle.getString("UISpaceSettings.label.spaceDescription"));
    addUIFormInput(description.addValidator(StringLengthValidator.class, 0, 255));

    // temporary disable tag
    UIFormStringInput tag = new UIFormStringInput(SPACE_TAG, SPACE_TAG, null).setRendered(false);
    tag.setHTMLAttribute(HTML_ATTRIBUTE_TITLE, resourceBundle.getString("UISpaceInfo.label.tag"));
    addUIFormInput(tag);

    PopupContainer popupContainer = createUIComponent(PopupContainer.class, null, null);
    addChild(popupContainer);
  }
Esempio n. 8
0
  @SuppressWarnings("unchecked")
  public UIPageForm(InitParams initParams) throws Exception {
    super("UIPageForm");
    PortalRequestContext pcontext = Util.getPortalRequestContext();
    UserPortalConfigService configService = getApplicationComponent(UserPortalConfigService.class);
    List<SelectItemOption<String>> ownerTypes = new ArrayList<SelectItemOption<String>>();
    ownerTypes.add(new SelectItemOption<String>(PortalConfig.USER_TYPE));

    UserPortalConfig userPortalConfig =
        configService.getUserPortalConfig(pcontext.getPortalOwner(), pcontext.getRemoteUser());
    ExoContainer container = ExoContainerContext.getCurrentContainer();
    UserACL acl = (UserACL) container.getComponentInstanceOfType(UserACL.class);
    if (acl.hasEditPermission(userPortalConfig.getPortalConfig())) {
      ownerTypes.add(new SelectItemOption<String>(PortalConfig.PORTAL_TYPE));
    }
    ownerIdInput = new UIFormStringInput(OWNER_ID, OWNER_ID, null);
    ownerIdInput.setEditable(false).setValue(pcontext.getRemoteUser());

    UIFormSelectBox uiSelectBoxOwnerType = new UIFormSelectBox(OWNER_TYPE, OWNER_TYPE, ownerTypes);
    uiSelectBoxOwnerType.setOnChange("ChangeOwnerType");

    UIFormInputSet uiSettingSet = new UIFormInputSet("PageSetting");
    uiSettingSet
        .addUIFormInput(new UIFormStringInput("pageId", "pageId", null).setEditable(false))
        .addUIFormInput(uiSelectBoxOwnerType)
        .addUIFormInput(ownerIdInput)
        .addUIFormInput(
            new UIFormStringInput("name", "name", null)
                .addValidator(StringLengthValidator.class, 3, 30)
                .addValidator(IdentifierValidator.class)
                .addValidator(MandatoryValidator.class))
        .addUIFormInput(
            new UIFormStringInput("title", "title", null)
                .addValidator(StringLengthValidator.class, 3, 120))
        .addUIFormInput(new UIFormCheckBoxInput("showMaxWindow", "showMaxWindow", false));
    addUIFormInput(uiSettingSet);
    setSelectedTab(uiSettingSet.getId());

    // WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
    // Param param = initParams.getParam("PageTemplate");
    // List<SelectItemCategory> itemCategories =
    // (List<SelectItemCategory>)param.getMapGroovyObject(context);
    // UIFormInputItemSelector uiTemplate = new UIFormInputItemSelector("Template", "template");
    // uiTemplate.setItemCategories(itemCategories);
    // addUIFormInput(uiTemplate);

    uiPermissionSetting = createUIComponent(UIFormInputSet.class, "PermissionSetting", null);
    UIListPermissionSelector uiListPermissionSelector =
        createUIComponent(UIListPermissionSelector.class, null, null);
    uiListPermissionSelector.configure("UIListPermissionSelector", "accessPermissions");
    uiListPermissionSelector.addValidator(EmptyIteratorValidator.class);
    uiPermissionSetting.addChild(uiListPermissionSelector);
    uiPermissionSetting.setSelectedComponent(uiListPermissionSelector.getId());
    UIPermissionSelector uiEditPermission =
        createUIComponent(UIPermissionSelector.class, null, null);
    uiEditPermission.setRendered(false);
    uiEditPermission.addValidator(
        org.exoplatform.webui.organization.UIPermissionSelector.MandatoryValidator.class);
    uiEditPermission.setEditable(false);
    uiEditPermission.configure("UIPermissionSelector", "editPermission");
    uiPermissionSetting.addChild(uiEditPermission);

    // TODO: This following line is fixed for bug PORTAL-2127
    uiListPermissionSelector
        .getChild(UIFormPopupWindow.class)
        .setId("UIPageFormPopupGroupMembershipSelector");

    List<String> groups = configService.getMakableNavigations(pcontext.getRemoteUser(), true);
    if (groups.size() > 0) {
      Collections.sort(groups);
      ownerTypes.add(new SelectItemOption<String>(PortalConfig.GROUP_TYPE));
      List<SelectItemOption<String>> groupsItem = new ArrayList<SelectItemOption<String>>();
      for (String group : groups) {
        groupsItem.add(new SelectItemOption<String>(group));
      }
      groupIdSelectBox = new UIFormSelectBox(OWNER_ID, OWNER_ID, groupsItem);
      groupIdSelectBox.setOnChange("ChangeOwnerId");
      groupIdSelectBox.setParent(uiSettingSet);
    }
    setActions(new String[] {"Save", "Close"});
  }
Esempio n. 9
0
  @Override
  public void activate() {
    UIJCRExplorer uiExplorer = getAncestorOfType(UIJCRExplorer.class);
    try {
      currentNode = uiExplorer.getCurrentNode();
      initParams();
    } catch (Exception E) {
      return;
    }

    /** node field */
    UIFormStringInput uiFormNameValueStringInput = new UIFormStringInput(NODE, NODE, nameValue_);
    uiFormNameValueStringInput.setEditable(false);

    /** visible field */
    UIFormCheckBoxInput<Boolean> uiFormVisibleValueCheckBoxInput =
        new UIFormCheckBoxInput<Boolean>(IS_VISIBLE, IS_VISIBLE, false);
    uiFormVisibleValueCheckBoxInput.setChecked(isVisible);

    /** navigation node field */
    UIFormStringInput uiFormNavigationNodeValueStringInput =
        new UIFormStringInput(
            NAVIGATION_NODE_STRING_INPUT, NAVIGATION_NODE_STRING_INPUT, navigationNode_);
    uiFormNavigationNodeValueStringInput.setEditable(false);

    UIFormInputSetWithAction navigationNodeInputSet =
        new UIFormInputSetWithAction(NAVIGATION_NODE_INPUT_SET);
    navigationNodeInputSet.setActionInfo(
        NAVIGATION_NODE_STRING_INPUT,
        new String[] {"SelectNavigationNode", "RemoveNavigationNode"});
    navigationNodeInputSet.addUIFormInput(uiFormNavigationNodeValueStringInput);

    /** index field */
    UIFormStringInput uiFormIndexValueStringInput =
        new UIFormStringInput(INDEX, INDEX, String.valueOf(index_));
    try {
      uiFormIndexValueStringInput.addValidator(NumberFormatValidator.class);
    } catch (Exception E) {
      // TODO : add log
    }

    /** clickable field */
    UIFormCheckBoxInput<Boolean> uiFormClickableValueCheckBoxInput =
        new UIFormCheckBoxInput<Boolean>(IS_CLICKABLE, IS_CLICKABLE, false);
    uiFormClickableValueCheckBoxInput.setChecked(isClickable);

    /** TARGET PAGE */
    UIFormStringInput uiFormTargetPageValueStringInput =
        new UIFormStringInput(
            LIST_TARGET_PAGE_STRING_INPUT, LIST_TARGET_PAGE_STRING_INPUT, listTargetPage_);
    uiFormTargetPageValueStringInput.setEditable(false);

    UIFormInputSetWithAction targetPageInputSet =
        new UIFormInputSetWithAction(LIST_TARGET_PAGE_INPUT_SET);

    targetPageInputSet.setActionInfo(
        LIST_TARGET_PAGE_STRING_INPUT,
        new String[] {"SelectListTargetPage", "RemoveListTargetPage"});
    targetPageInputSet.addUIFormInput(uiFormTargetPageValueStringInput);

    /** DETAIL_TARGET PAGE */
    UIFormStringInput uiFormDetailTargetPageValueStringInput =
        new UIFormStringInput(
            DETAIL_TARGET_PAGE_STRING_INPUT, DETAIL_TARGET_PAGE_STRING_INPUT, detailTargetPage_);
    uiFormDetailTargetPageValueStringInput.setEditable(false);
    UIFormInputSetWithAction detailTargetPageInputSet =
        new UIFormInputSetWithAction(DETAIL_TARGET_PAGE_INPUT_SET);
    detailTargetPageInputSet.setActionInfo(
        DETAIL_TARGET_PAGE_STRING_INPUT,
        new String[] {"SelectDetailTargetPage", "RemoveDetailTargetPage"});
    detailTargetPageInputSet.addUIFormInput(uiFormDetailTargetPageValueStringInput);

    /*
    if (!navigationNode_.equals("")) {
    	uiFormIndexValueStringInput.setEnable(false);
    	uiFormClickableValueRadioBoxInput.setEnable(false);
    }
    */
    addChild(uiFormNameValueStringInput);
    addChild(uiFormVisibleValueCheckBoxInput);
    addChild(navigationNodeInputSet);
    if (renderIndexField) {
      addChild(uiFormIndexValueStringInput);
    }
    addChild(uiFormClickableValueCheckBoxInput);
    addChild(targetPageInputSet);
    addChild(detailTargetPageInputSet);

    setActions(new String[] {"Save", "Cancel"});
  }
  private void initUserProfileForm() throws Exception {
    List<SelectItemOption<String>> list;
    UIFormStringInput userId = new UIFormStringInput(FIELD_USERID_INPUT, FIELD_USERID_INPUT, null);
    userId.setValue(this.editUserProfile.getUserId());
    userId.setReadOnly(true);
    userId.setDisabled(true);
    UIFormStringInput screenName =
        new UIFormStringInput(FIELD_SCREENNAME_INPUT, FIELD_SCREENNAME_INPUT, null);
    String screenN = editUserProfile.getScreenName();
    if (ForumUtils.isEmpty(screenN)) screenN = editUserProfile.getUserId();
    screenName.setValue(CommonUtils.decodeSpecialCharToHTMLnumber(screenN));
    UIFormStringInput userTitle =
        new UIFormStringInput(FIELD_USERTITLE_INPUT, FIELD_USERTITLE_INPUT, null);
    String title = this.editUserProfile.getUserTitle();
    boolean isAdmin = false;
    UICheckBoxInput userRole =
        new UICheckBoxInput(FIELD_USERROLE_CHECKBOX, FIELD_USERROLE_CHECKBOX, false);
    if (this.editUserProfile.getUserRole() == 0) isAdmin = true;
    if (isAdmin(this.editUserProfile.getUserId())) {
      userRole.setDisabled(true);
      isAdmin = true;
      if (this.editUserProfile.getUserRole() != 0) title = Utils.ADMIN;
    }
    userRole.setValue(isAdmin);
    userTitle.setValue(CommonUtils.decodeSpecialCharToHTMLnumber(title));

    UIFormTextAreaInput signature =
        new UIFormTextAreaInput(FIELD_SIGNATURE_TEXTAREA, FIELD_SIGNATURE_TEXTAREA, null);
    signature.setValue(CommonUtils.decodeSpecialCharToHTMLnumber(editUserProfile.getSignature()));
    UICheckBoxInput isDisplaySignature =
        new UICheckBoxInput(
            FIELD_ISDISPLAYSIGNATURE_CHECKBOX, FIELD_ISDISPLAYSIGNATURE_CHECKBOX, false);
    isDisplaySignature.setChecked(this.editUserProfile.getIsDisplaySignature());

    UIFormTextAreaInput moderateForums =
        new UIFormTextAreaInput(
            FIELD_MODERATEFORUMS_MULTIVALUE, FIELD_MODERATEFORUMS_MULTIVALUE, null);
    List<String> values = Arrays.asList(editUserProfile.getModerateForums());
    this.listModerate = new ArrayList<String>(values);
    moderateForums.setValue(stringForumProcess(values));
    moderateForums.setReadOnly(true);

    UIFormTextAreaInput moderateCategorys =
        new UIFormTextAreaInput(
            FIELD_MODERATECATEGORYS_MULTIVALUE, FIELD_MODERATECATEGORYS_MULTIVALUE, null);
    List<String> valuesCate = Arrays.asList(editUserProfile.getModerateCategory());
    this.listModCate = new ArrayList<String>(valuesCate);
    moderateCategorys.setValue(stringCategoryProcess(valuesCate));
    moderateCategorys.setReadOnly(true);

    UIAvatarContainer avatarContainer = createUIComponent(UIAvatarContainer.class, null, "Avatar");
    avatarContainer.setUserProfile(this.editUserProfile);
    avatarContainer.setForumService(getForumService());
    UICheckBoxInput isDisplayAvatar =
        new UICheckBoxInput(FIELD_ISDISPLAYAVATAR_CHECKBOX, FIELD_ISDISPLAYAVATAR_CHECKBOX, false);
    isDisplayAvatar.setChecked(this.editUserProfile.getIsDisplayAvatar());
    // Option
    String[] timeZone1 = getLabel(FIELD_TIMEZONE).split(ForumUtils.SLASH);
    list = new ArrayList<SelectItemOption<String>>();
    for (String string : timeZone1) {
      list.add(new SelectItemOption<String>(string, ForumUtils.getTimeZoneNumberInString(string)));
    }
    UIFormSelectBox timeZone =
        new UIFormSelectBox(FIELD_TIMEZONE_SELECTBOX, FIELD_TIMEZONE_SELECTBOX, list);
    double timeZoneOld = -editUserProfile.getTimeZone();
    Date date = getNewDate(timeZoneOld);
    String mark = "-";
    if (timeZoneOld < 0) {
      timeZoneOld = -timeZoneOld;
    } else if (timeZoneOld > 0) {
      mark = "+";
    } else {
      timeZoneOld = 0.0;
      mark = ForumUtils.EMPTY_STR;
    }
    timeZone.setValue(mark + timeZoneOld + "0");

    list = new ArrayList<SelectItemOption<String>>();
    String[] format =
        new String[] {
          "M-d-yyyy",
          "M-d-yy",
          "MM-dd-yy",
          "MM-dd-yyyy",
          "yyyy-MM-dd",
          "yy-MM-dd",
          "dd-MM-yyyy",
          "dd-MM-yy",
          "M/d/yyyy",
          "M/d/yy",
          "MM/dd/yy",
          "MM/dd/yyyy",
          "yyyy/MM/dd",
          "yy/MM/dd",
          "dd/MM/yyyy",
          "dd/MM/yy"
        };
    for (String frm : format) {
      list.add(
          new SelectItemOption<String>(
              (frm.toLowerCase() + " (" + TimeConvertUtils.getFormatDate(frm, date) + ")"), frm));
    }
    UIFormSelectBox shortdateFormat =
        new UIFormSelectBox(FIELD_SHORTDATEFORMAT_SELECTBOX, FIELD_SHORTDATEFORMAT_SELECTBOX, list);
    shortdateFormat.setValue(editUserProfile.getShortDateFormat());
    list = new ArrayList<SelectItemOption<String>>();
    format =
        new String[] {
          "EEE, MMMM dd, yyyy",
          "EEEE, MMMM dd, yyyy",
          "EEEE, dd MMMM, yyyy",
          "EEE, MMM dd, yyyy",
          "EEEE, MMM dd, yyyy",
          "EEEE, dd MMM, yyyy",
          "MMMM dd, yyyy",
          "dd MMMM, yyyy",
          "MMM dd, yyyy",
          "dd MMM, yyyy"
        };
    for (String idFrm : format) {
      list.add(
          new SelectItemOption<String>(
              (idFrm.toLowerCase() + " (" + TimeConvertUtils.getFormatDate(idFrm, date) + ")"),
              idFrm.replaceFirst(" ", "=")));
    }
    UIFormSelectBox longDateFormat =
        new UIFormSelectBox(FIELD_LONGDATEFORMAT_SELECTBOX, FIELD_LONGDATEFORMAT_SELECTBOX, list);
    longDateFormat.setValue(editUserProfile.getLongDateFormat().replaceFirst(" ", "="));
    list = new ArrayList<SelectItemOption<String>>();
    list.add(new SelectItemOption<String>("12-hour", "hh:mm=a"));
    list.add(new SelectItemOption<String>("24-hour", "HH:mm"));
    UIFormSelectBox timeFormat =
        new UIFormSelectBox(FIELD_TIMEFORMAT_SELECTBOX, FIELD_TIMEFORMAT_SELECTBOX, list);
    timeFormat.setValue(editUserProfile.getTimeFormat().replace(' ', '='));
    list = new ArrayList<SelectItemOption<String>>();
    for (int i = 5; i <= 45; i = i + 5) {
      list.add(new SelectItemOption<String>(String.valueOf(i), ("id" + i)));
    }
    UIFormSelectBox maximumThreads =
        new UIFormSelectBox(FIELD_MAXTOPICS_SELECTBOX, FIELD_MAXTOPICS_SELECTBOX, list);
    maximumThreads.setValue("id" + editUserProfile.getMaxTopicInPage());
    list = new ArrayList<SelectItemOption<String>>();
    for (int i = 5; i <= 35; i = i + 5) {
      list.add(new SelectItemOption<String>(String.valueOf(i), ("id" + i)));
    }
    UIFormSelectBox maximumPosts =
        new UIFormSelectBox(FIELD_MAXPOSTS_SELECTBOX, FIELD_MAXPOSTS_SELECTBOX, list);
    maximumPosts.setValue("id" + editUserProfile.getMaxPostInPage());
    // Ban
    UICheckBoxInput isBanned =
        new UICheckBoxInput(FIELD_ISBANNED_CHECKBOX, FIELD_ISBANNED_CHECKBOX, false);
    boolean isBan = editUserProfile.getIsBanned();
    isBanned.setChecked(isBan);
    list = new ArrayList<SelectItemOption<String>>();
    String dv = "Day";
    int i = 1;
    long oneDate = 86400000, until = 0;
    Calendar cal = CommonUtils.getGreenwichMeanTime();
    if (isBan) {
      until = editUserProfile.getBanUntil();
      cal.setTimeInMillis(until);
      list.add(
          new SelectItemOption<String>(
              getLabel("Banned until: ")
                  + TimeConvertUtils.getFormatDate(
                      editUserProfile.getShortDateFormat() + " hh:mm a", cal.getTime())
                  + " GMT+0",
              ("Until_" + until)));
    }
    while (true) {
      if (i == 2 && dv.equals("Day")) {
        dv = "Days";
      }
      if (i == 8 && dv.equals("Days")) i = 10;
      if (i == 11) {
        i = 2;
        dv = "Weeks";
      }
      if (i == 4 && dv.equals("Weeks")) {
        i = 1;
        dv = "Month";
      }
      if (i == 2 && dv.equals("Month")) {
        dv = "Months";
      }
      if (i == 7 && dv.equals("Months")) {
        i = 1;
        dv = "Year";
      }
      if (i == 2 && dv.equals("Year")) {
        dv = "Years";
      }
      if (i == 4 && dv.equals("Years")) {
        break;
      }
      if (dv.equals("Days") || dv.equals("Day")) {
        cal = CommonUtils.getGreenwichMeanTime();
        until = cal.getTimeInMillis() + i * oneDate;
        cal.setTimeInMillis(until);
      }
      if (dv.equals("Weeks")) {
        cal = CommonUtils.getGreenwichMeanTime();
        until = cal.getTimeInMillis() + i * oneDate * 7;
        cal.setTimeInMillis(until);
      }
      if (dv.equals("Month") || dv.equals("Months")) {
        cal = CommonUtils.getGreenwichMeanTime();
        cal.setLenient(true);
        int t = cal.get(Calendar.MONTH) + i;
        if (t >= 12) {
          cal.set(Calendar.YEAR, cal.get(Calendar.YEAR) + 1);
          t -= 12;
        }
        cal.set(Calendar.MONTH, t);
        until = cal.getTimeInMillis();
      }
      if (dv.equals("Years") || dv.equals("Year")) {
        cal = CommonUtils.getGreenwichMeanTime();
        cal.setLenient(true);
        cal.set(Calendar.YEAR, cal.get(Calendar.YEAR) + i);
        until = cal.getTimeInMillis();
      }
      list.add(
          new SelectItemOption<String>(
              i
                  + " "
                  + getLabel(dv)
                  + " ("
                  + TimeConvertUtils.getFormatDate(
                      editUserProfile.getShortDateFormat() + " hh:mm a", cal.getTime())
                  + " GMT+0)",
              ("Until_" + until)));
      ++i;
    }
    UIFormSelectBox banUntil =
        new UIFormSelectBox(FIELD_BANUNTIL_SELECTBOX, FIELD_BANUNTIL_SELECTBOX, list);
    if (isBan) {
      banUntil.setValue("Until_" + editUserProfile.getBanUntil());
    }
    UIFormTextAreaInput banReason =
        new UIFormTextAreaInput(FIELD_BANREASON_TEXTAREA, FIELD_BANREASON_TEXTAREA, null);
    UIFormStringInput banCounter =
        new UIFormStringInput(FIELD_BANCOUNTER_INPUT, FIELD_BANCOUNTER_INPUT, null);
    banCounter.setValue(editUserProfile.getBanCounter() + ForumUtils.EMPTY_STR);
    UIFormTextAreaInput banReasonSummary =
        new UIFormTextAreaInput(
            FIELD_BANREASONSUMMARY_MULTIVALUE, FIELD_BANREASONSUMMARY_MULTIVALUE, null);
    banReasonSummary.setValue(ForumUtils.unSplitForForum(editUserProfile.getBanReasonSummary()));
    banReasonSummary.setReadOnly(true);
    UIFormStringInput createdDateBan =
        new UIFormStringInput(FIELD_CREATEDDATEBAN_INPUT, FIELD_CREATEDDATEBAN_INPUT, null);
    if (isBan) {
      banReason.setValue(editUserProfile.getBanReason());
      createdDateBan.setValue(
          TimeConvertUtils.getFormatDate(
              "MM/dd/yyyy, hh:mm a", editUserProfile.getCreatedDateBan()));
    } else {
      banReason.setDisabled(false);
    }
    UIFormInputWithActions inputSetProfile = new UIFormInputWithActions(FIELD_USERPROFILE_FORM);
    inputSetProfile.addUIFormInput(userId);
    inputSetProfile.addUIFormInput(screenName);
    inputSetProfile.addUIFormInput(userTitle);
    inputSetProfile.addUIFormInput(userRole);
    inputSetProfile.addUIFormInput(moderateCategorys);
    inputSetProfile.addUIFormInput(moderateForums);
    inputSetProfile.addUIFormInput(signature);
    inputSetProfile.addUIFormInput(isDisplaySignature);

    inputSetProfile.addUIFormInput(avatarContainer);
    inputSetProfile.addUIFormInput(isDisplayAvatar);

    String[] fields =
        new String[] {FIELD_MODERATEFORUMS_MULTIVALUE, FIELD_MODERATECATEGORYS_MULTIVALUE};
    String[] actionNames = new String[] {"AddValuesModForum", "AddValuesModCategory"};
    List<ActionData> actions;
    ActionData actionData;
    for (int j = 0; j < fields.length; j++) {
      String string = fields[j];
      actionData = new ActionData();
      actionData.setActionListener(actionNames[j]);
      actionData.setActionParameter(string);
      actionData.setCssIconClass("uiIconAddIcon uiIconLightGray");
      actionData.setActionName(string);
      actions = new ArrayList<ActionData>();
      actions.add(actionData);
      inputSetProfile.setActionField(string, actions);
    }
    //
    addUIFormInput(inputSetProfile);

    UIFormInputWithActions inputSetOption = new UIFormInputWithActions(FIELD_USEROPTION_FORM);
    inputSetOption.addUIFormInput(timeZone);
    inputSetOption.addUIFormInput(shortdateFormat);
    inputSetOption.addUIFormInput(longDateFormat);
    inputSetOption.addUIFormInput(timeFormat);
    inputSetOption.addUIFormInput(maximumThreads);
    inputSetOption.addUIFormInput(maximumPosts);
    addUIFormInput(inputSetOption);

    UIFormInputWithActions inputSetBan = new UIFormInputWithActions(FIELD_USERBAN_FORM);
    inputSetBan.addUIFormInput(isBanned);
    inputSetBan.addUIFormInput(banUntil);
    inputSetBan.addUIFormInput(banReason);
    inputSetBan.addUIFormInput(banCounter);
    inputSetBan.addUIFormInput(banReasonSummary);
    inputSetBan.addUIFormInput(createdDateBan);
    //
    addUIFormInput(inputSetBan);

    UIPageListTopicByUser pageListTopicByUser = addChild(UIPageListTopicByUser.class, null, null);
    pageListTopicByUser.setUserName(this.editUserProfile.getUserId());
    UIPageListPostByUser listPostByUser = addChild(UIPageListPostByUser.class, null, null);
    listPostByUser.setUserName(this.editUserProfile.getUserId());
  }