Example #1
0
 public void onEvent(Event<UICategoryForm> event, UICategoryForm uiForm, String id)
     throws Exception {
   uiForm.id = Integer.parseInt(id);
   UIPopupWindow popupWindow = uiForm.getAncestorOfType(UIPopupWindow.class);
   if (uiForm.id == 1) {
     popupWindow.setWindowSize(550, 440);
   } else {
     popupWindow.setWindowSize(550, 380);
   }
   Util.getPortalRequestContext().setResponseComplete(true);
 }
Example #2
0
 /**
  * Initializes search form fields.
  *
  * @throws Exception
  */
 public UISpaceSearch() throws Exception {
   addUIFormInput(new UIFormStringInput(SPACE_SEARCH, null, DEFAULT_SPACE_NAME_SEARCH));
   UIPopupWindow uiPopup = createUIComponent(UIPopupWindow.class, null, POPUP_ADD_SPACE);
   uiPopup.setShow(false);
   uiPopup.setWindowSize(400, 0);
   addChild(uiPopup);
 }
 public void execute(Event<UIModeratorManagementForm> event) throws Exception {
   UIModeratorManagementForm uiForm = event.getSource();
   uiForm.isEdit = false;
   UIPopupWindow popupWindow = uiForm.getAncestorOfType(UIPopupWindow.class);
   popupWindow.setWindowSize(760, 350);
   event.getRequestContext().addUIComponentToUpdateByAjax(popupWindow.getParent());
 }
 public UIUserInGroup() throws Exception {
   UIGrid uiGrid = addChild(UIGridUser.class, "UIGridUser", null);
   uiGrid.configure("id", USER_BEAN_FIELD, USER_ACTION);
   uiGrid.getUIPageIterator().setId("UIUserInGroupIterator");
   addChild(UIGroupMembershipForm.class, null, null);
   UIPopupWindow editMemberPopup = addChild(UIPopupWindow.class, null, "EditMembership");
   editMemberPopup.setWindowSize(400, 0);
 }
 public void initPopup(UIComponent uiComponent, String popupId) throws Exception {
   removeChildById(popupId);
   UIPopupWindow uiPopup = addChild(UIPopupWindow.class, null, popupId);
   uiPopup.setShowMask(true);
   uiPopup.setWindowSize(600, 300);
   uiPopup.setUIComponent(uiComponent);
   uiPopup.setShow(true);
   uiPopup.setResizable(true);
 }
  public UISpaceNavigationManagement() throws Exception {
    UIPopupWindow uiPopup = createUIComponent(UIPopupWindow.class, "AddNode", null);
    uiPopup.setWindowSize(800, 445);
    uiPopup.setShow(false);
    addChild(uiPopup);

    addChild(UISpaceNavigationNodeSelector.class, null, null);
    reloadTreeData();
  }
Example #7
0
 @Override
 public void execute(Event<UISpaceSearch> event) throws Exception {
   UISpaceSearch uiSpaceSearch = event.getSource();
   UIPopupWindow uiPopup = uiSpaceSearch.getChild(UIPopupWindow.class);
   UISpaceAddForm uiAddSpaceForm =
       uiSpaceSearch.createUIComponent(UISpaceAddForm.class, null, null);
   uiPopup.setUIComponent(uiAddSpaceForm);
   uiPopup.setWindowSize(500, 0);
   uiPopup.setShow(true);
 }
 public void initPopupPermission(UIComponent uiSelector) throws Exception {
   removeChildById(UIPermissionForm.POPUP_SELECT);
   UIPopupWindow uiPopup = addChild(UIPopupWindow.class, null, UIPermissionForm.POPUP_SELECT);
   uiPopup.setShowMask(true);
   uiPopup.setWindowSize(560, 300);
   uiPopup.setRendered(true);
   uiPopup.setUIComponent(uiSelector);
   uiPopup.setShow(true);
   uiPopup.setResizable(true);
 }
Example #9
0
 private void initTaggingFormPopup(Node selectedTag) throws Exception {
   removeChildById("TagPopup");
   UIPopupWindow uiPopup = addChild(UIPopupWindow.class, null, "TagPopup");
   uiPopup.setShowMask(true);
   uiPopup.setWindowSize(600, 200);
   UITagForm uiForm = createUIComponent(UITagForm.class, null, null);
   uiForm.setTag(selectedTag);
   uiPopup.setUIComponent(uiForm);
   uiPopup.setRendered(true);
   uiPopup.setShow(true);
   uiPopup.setResizable(true);
 }
 public void initUserSelector() throws Exception {
   UIPopupWindow uiPopup = getChildById("PopupUserSelector");
   if (uiPopup == null) {
     uiPopup = addChild(UIPopupWindow.class, null, "PopupUserSelector");
   }
   uiPopup.setWindowSize(790, 400);
   UIUserContainer uiUserContainer = this.createUIComponent(UIUserContainer.class, null, null);
   uiPopup.setUIComponent(uiUserContainer);
   uiPopup.setShow(true);
   uiPopup.setShowMask(true);
   uiPopup.setResizable(true);
 }
 public void initPopupPermission(UIComponent uiSelector) throws Exception {
   UIPopupWindow uiPopup = getChildById(UIPermissionFormBase.POPUP_SELECT);
   if (uiPopup == null) {
     uiPopup = addChild(UIPopupWindow.class, null, UIPermissionFormBase.POPUP_SELECT);
     uiPopup.setWindowSize(560, 345);
     uiPopup.setShowMask(true);
   } else {
     uiPopup.setShowMask(true);
     uiPopup.setRendered(true);
   }
   uiPopup.setUIComponent(uiSelector);
   uiPopup.setShow(true);
   uiPopup.setResizable(true);
 }
 public void onEvent(
     Event<UIModeratorManagementForm> event, UIModeratorManagementForm uiForm, String userId)
     throws Exception {
   uiForm.editUserProfile =
       uiForm.getForumService().updateUserProfileSetting(uiForm.getUserProfile(userId));
   uiForm.removeChildById("ForumUserProfile");
   uiForm.removeChildById("ForumUserOption");
   uiForm.removeChildById("ForumUserBan");
   uiForm.removeChild(UIPageListTopicByUser.class);
   uiForm.removeChild(UIPageListPostByUser.class);
   uiForm.initUserProfileForm();
   uiForm.isEdit = true;
   UIPopupWindow popupWindow = uiForm.getAncestorOfType(UIPopupWindow.class);
   popupWindow.setWindowSize(950, 540);
   event.getRequestContext().addUIComponentToUpdateByAjax(popupWindow.getParent());
 }
Example #13
0
  public UIUserSelector() throws Exception {
    addUIFormInput(new UIFormStringInput(FIELD_KEYWORD, FIELD_KEYWORD, null));
    addUIFormInput(new UIFormSelectBox(FIELD_FILTER, FIELD_FILTER, getFilters()));
    addUIFormInput(new UIFormStringInput(FIELD_GROUP, FIELD_GROUP, null));
    isShowSearch_ = true;
    OrganizationService service = getApplicationComponent(OrganizationService.class);
    ObjectPageList objPageList =
        new ObjectPageList(service.getUserHandler().findUsers(new Query()).getAll(), 10);
    uiIterator_ = new UIPageIterator();
    uiIterator_.setPageList(objPageList);
    uiIterator_.setId("UISelectUserPage");

    // create group selector
    UIPopupWindow uiPopup = addChild(UIPopupWindow.class, null, "UIPopupGroupSelector");
    uiPopup.setWindowSize(540, 0);
    UIGroupSelector uiGroup = createUIComponent(UIGroupSelector.class, null, null);
    uiPopup.setUIComponent(uiGroup);
    uiGroup.setId("GroupSelector");
    uiGroup.getChild(UITree.class).setId("TreeGroupSelector");
    uiGroup.getChild(UIBreadcumbs.class).setId("BreadcumbsGroupSelector");
  }
    public void onEvent(
        Event<UIModeratorManagementForm> event, UIModeratorManagementForm uiForm, String userId)
        throws Exception {
      UserProfile userProfile = uiForm.editUserProfile;
      UIFormInputWithActions inputSetProfile = uiForm.getChildById(FIELD_USERPROFILE_FORM);
      String userTitle = inputSetProfile.getUIStringInput(FIELD_USERTITLE_INPUT).getValue();
      String screenName = inputSetProfile.getUIStringInput(FIELD_SCREENNAME_INPUT).getValue();
      screenName = CommonUtils.encodeSpecialCharInTitle(screenName);
      long userRole = 2;
      boolean isAdmin = inputSetProfile.getUICheckBoxInput(FIELD_USERROLE_CHECKBOX).isChecked();
      if (isAdmin || uiForm.isAdmin(userProfile.getUserId())) {
        isAdmin = true;
        userRole = 0;
      }
      //
      if (ForumUtils.isEmpty(userTitle)) {
        if (isAdmin) {
          userTitle = Utils.ADMIN;
        } else {
          userTitle = userProfile.getUserTitle();
        }
      } else {
        userTitle = CommonUtils.encodeSpecialCharInTitle(userTitle);
      }
      // -----------------
      List<String> oldModerateForum =
          uiForm.getModerateList(Arrays.asList(userProfile.getModerateForums()));
      List<String> newModeratorsForum = new ArrayList<String>();
      List<String> removeModerateForum = new ArrayList<String>();
      List<String> forumIdsMod = new ArrayList<String>();
      //
      newModeratorsForum = uiForm.getModerateList(uiForm.listModerate);
      forumIdsMod.addAll(newModeratorsForum);
      if (newModeratorsForum.isEmpty()) {
        removeModerateForum = oldModerateForum;
      } else {
        for (String string : oldModerateForum) {
          if (newModeratorsForum.contains(string)) {
            newModeratorsForum.remove(string);
          } else {
            removeModerateForum.add(string);
          }
        }
        if (!newModeratorsForum.isEmpty())
          uiForm
              .getForumService()
              .saveModerateOfForums(newModeratorsForum, userProfile.getUserId(), false);
      }
      if (!removeModerateForum.isEmpty()) {
        uiForm
            .getForumService()
            .saveModerateOfForums(removeModerateForum, userProfile.getUserId(), true);
      }

      uiForm
          .getForumService()
          .saveUserModerator(userProfile.getUserId(), uiForm.listModerate, false);

      List<String> moderateCates = new ArrayList<String>();
      moderateCates.addAll(uiForm.listModCate);
      List<String> newModeratorsCate = new ArrayList<String>();
      List<String> categoryIdsMod = new ArrayList<String>();
      List<String> oldModerateCate =
          uiForm.getModerateList(Arrays.asList(userProfile.getModerateCategory()));
      List<String> removeModerateCate = new ArrayList<String>();
      // set moderator category
      newModeratorsCate = uiForm.getModerateList(moderateCates);
      categoryIdsMod.addAll(newModeratorsCate);
      if (newModeratorsCate.isEmpty()) {
        removeModerateCate = oldModerateCate;
      } else {
        for (String string : oldModerateCate) {
          if (newModeratorsCate.contains(string)) {
            newModeratorsCate.remove(string);
          } else {
            removeModerateCate.add(string);
          }
        }
        if (!newModeratorsCate.isEmpty()) {
          uiForm
              .getForumService()
              .saveModOfCategory(newModeratorsCate, userProfile.getUserId(), true);
          if (userRole > 1) userRole = 1;
        }
      }
      if (removeModerateCate.size() > 0) {
        uiForm
            .getForumService()
            .saveModOfCategory(removeModerateCate, userProfile.getUserId(), false);
      }

      if (userRole > 1) {
        uiForm.listModerate =
            uiForm.getForumService().getUserModerator(userProfile.getUserId(), false);
        if (uiForm.listModerate.size() >= 1 && !uiForm.listModerate.get(0).equals(" "))
          userRole = 1;
      }

      if (userTitle == null || userTitle.trim().length() < 1) {
        userTitle = userProfile.getUserTitle();
      } else if (!isAdmin) {
        int newPos = Arrays.asList(uiForm.permissionUser).indexOf(userTitle.toLowerCase());
        if (newPos >= 0 && newPos < userRole) {
          if (Arrays.asList(uiForm.permissionUser).indexOf(userProfile.getUserTitle().toLowerCase())
              < 0) userTitle = userProfile.getUserTitle();
          else userTitle = uiForm.titleUser[(int) userRole];
        }
      } else {
        if (userTitle.equalsIgnoreCase(uiForm.titleUser[1])
            || userTitle.equalsIgnoreCase(uiForm.titleUser[2])) userTitle = uiForm.titleUser[0];
      }
      if (userRole == 1 && userTitle.equalsIgnoreCase(uiForm.titleUser[2])) {
        userTitle = uiForm.titleUser[1];
      }

      String signature =
          inputSetProfile.getUIFormTextAreaInput(FIELD_SIGNATURE_TEXTAREA).getValue();
      signature = CommonUtils.encodeSpecialCharInTitle(signature);
      boolean isDisplaySignature =
          inputSetProfile.getUICheckBoxInput(FIELD_ISDISPLAYSIGNATURE_CHECKBOX).isChecked();
      Boolean isDisplayAvatar =
          inputSetProfile.getUICheckBoxInput(FIELD_ISDISPLAYAVATAR_CHECKBOX).isChecked();

      UIFormInputWithActions inputSetOption = uiForm.getChildById(FIELD_USEROPTION_FORM);
      double timeZone =
          Double.parseDouble(
              inputSetOption.getUIFormSelectBox(FIELD_TIMEZONE_SELECTBOX).getValue());
      String shortDateFormat =
          inputSetOption.getUIFormSelectBox(FIELD_SHORTDATEFORMAT_SELECTBOX).getValue();
      String longDateFormat =
          inputSetOption.getUIFormSelectBox(FIELD_LONGDATEFORMAT_SELECTBOX).getValue();
      String timeFormat = inputSetOption.getUIFormSelectBox(FIELD_TIMEFORMAT_SELECTBOX).getValue();
      long maxTopic =
          Long.parseLong(
              inputSetOption.getUIFormSelectBox(FIELD_MAXTOPICS_SELECTBOX).getValue().substring(2));
      long maxPost =
          Long.parseLong(
              inputSetOption.getUIFormSelectBox(FIELD_MAXPOSTS_SELECTBOX).getValue().substring(2));

      UIFormInputWithActions inputSetBan = uiForm.getChildById(FIELD_USERBAN_FORM);
      boolean wasBanned = userProfile.getIsBanned();
      boolean isBanned = inputSetBan.getUICheckBoxInput(FIELD_ISBANNED_CHECKBOX).isChecked();
      String until = inputSetBan.getUIFormSelectBox(FIELD_BANUNTIL_SELECTBOX).getValue();
      long banUntil = 0;
      if (!ForumUtils.isEmpty(until)) {
        banUntil = Long.parseLong(until.substring(6));
      }
      String banReason = inputSetBan.getUIFormTextAreaInput(FIELD_BANREASON_TEXTAREA).getValue();
      String[] banReasonSummaries = userProfile.getBanReasonSummary();
      Date date = CommonUtils.getGreenwichMeanTime().getTime();
      int banCounter = userProfile.getBanCounter();
      date.setTime(banUntil);
      StringBuffer stringBuffer = new StringBuffer();
      if (!ForumUtils.isEmpty(banReason)) {
        stringBuffer.append("Ban Reason: ").append(banReason).append(" ");
      }
      stringBuffer
          .append("From Date: ")
          .append(
              TimeConvertUtils.getFormatDate(
                  "MM-dd-yyyy hh:mm a", CommonUtils.getGreenwichMeanTime().getTime()))
          .append(" GMT+0 To Date: ")
          .append(TimeConvertUtils.getFormatDate("MM-dd-yyyy hh:mm a", date))
          .append(" GMT+0");
      if (isBanned) {
        if (banReasonSummaries != null && banReasonSummaries.length > 0) {
          if (wasBanned) {
            banReasonSummaries[0] = stringBuffer.toString();
          } else {
            String[] temp = new String[banReasonSummaries.length + 1];
            int i = 1;
            for (String string : banReasonSummaries) {
              temp[i++] = string;
            }
            temp[0] = stringBuffer.toString();
            banReasonSummaries = temp;
            banCounter = banCounter + 1;
          }
        } else {
          banReasonSummaries = new String[] {stringBuffer.toString()};
          banCounter = 1;
        }
      }
      userProfile.setUserTitle(userTitle);
      userProfile.setScreenName(screenName);
      userProfile.setUserRole(userRole);
      userProfile.setSignature(signature);
      userProfile.setIsDisplaySignature(isDisplaySignature);
      userProfile.setModerateCategory(moderateCates.toArray(new String[] {}));
      userProfile.setIsDisplayAvatar(isDisplayAvatar);

      userProfile.setTimeZone(-timeZone);
      userProfile.setShortDateFormat(shortDateFormat);
      userProfile.setLongDateFormat(longDateFormat.replace('=', ' '));
      userProfile.setTimeFormat(timeFormat.replace('=', ' '));
      userProfile.setMaxPostInPage(maxPost);
      userProfile.setMaxTopicInPage(maxTopic);
      userProfile.setIsBanned(isBanned);
      userProfile.setBanUntil(banUntil);
      userProfile.setBanReason(banReason);
      userProfile.setBanCounter(banCounter);
      userProfile.setBanReasonSummary(banReasonSummaries);
      try {
        uiForm.getForumService().saveUserProfile(userProfile, true, true);
      } catch (Exception e) {
        uiForm.log.trace("\nSave user profile fail: " + e.getMessage() + "\n" + e.getCause());
      }
      uiForm.isEdit = false;
      if (ForumUtils.isEmpty(uiForm.valueSearch)) {
        uiForm.isViewSearchUser = false;
      } else {
        uiForm.searchUserProfileByKey(uiForm.valueSearch);
      }
      UIPopupWindow popupWindow = uiForm.getAncestorOfType(UIPopupWindow.class);
      popupWindow.setWindowSize(760, 350);
      event.getRequestContext().addUIComponentToUpdateByAjax(popupWindow.getParent());
    }