Ejemplo n.º 1
0
 public void execute(Event<UIGroupMemberSelector> event) throws Exception {
   UIGroupMemberSelector uiGroupMemberSelector = event.getSource();
   if (uiGroupMemberSelector.getCurrentGroup() == null) return;
   String groupId = uiGroupMemberSelector.getCurrentGroup().getId();
   String permission = event.getRequestContext().getRequestParameter(OBJECTID);
   String value = "";
   if (uiGroupMemberSelector.isSelectedUser()) {
     value = permission;
   } else {
     value = permission + ":" + groupId;
   }
   String returnField = uiGroupMemberSelector.getReturnField();
   ((UISelectable) uiGroupMemberSelector.getSourceComponent()).doSelect(returnField, value);
   if (uiGroupMemberSelector.isUsePopup) {
     UIPopupWindow uiPopup = uiGroupMemberSelector.getParent();
     uiPopup.setShow(false);
     UIComponent uicomp = uiGroupMemberSelector.getSourceComponent().getParent();
     event.getRequestContext().addUIComponentToUpdateByAjax(uicomp);
     if (!uiPopup.getId().equals("PopupComponent"))
       event.getRequestContext().addUIComponentToUpdateByAjax(uiPopup);
   } else {
     event
         .getRequestContext()
         .addUIComponentToUpdateByAjax(uiGroupMemberSelector.getSourceComponent());
   }
 }
Ejemplo n.º 2
0
 public void processEvent(Event<UIAddAttachment> event) throws Exception {
   UIAddAttachment component = event.getSource();
   event
       .getRequestContext()
       .setAttribute(SELECTEDFILE, component.getFileURL(getSelectedFile(event)));
   event.getRequestContext().setAttribute(ISATTACHFILE, false);
 }
Ejemplo n.º 3
0
    @Override
    public void execute(Event<UIWikiPermalinkForm> event) throws Exception {
      UIWikiPermalinkForm uiWikiPermalinkForm = event.getSource();
      if (uiWikiPermalinkForm.canPublicAndRetrictPage()) {
        Page currentPage = Utils.getCurrentWikiPage();
        HashMap<String, String[]> permissions = currentPage.getPermission();
        permissions.remove(IdentityConstants.ANY);
        currentPage.setPermission(permissions);

        UIWikiPortlet uiWikiPortlet = uiWikiPermalinkForm.getAncestorOfType(UIWikiPortlet.class);
        if (currentPage.hasPermission(PermissionType.VIEWPAGE)) {
          UIWikiPageInfoArea uiWikiPageInfoArea =
              uiWikiPortlet.findFirstComponentOfType(UIWikiPageInfoArea.class);
          UIWikiPageControlArea uiWikiPageControlArea =
              uiWikiPortlet.findFirstComponentOfType(UIWikiPageControlArea.class);
          event.getRequestContext().addUIComponentToUpdateByAjax(uiWikiPermalinkForm);
          event.getRequestContext().addUIComponentToUpdateByAjax(uiWikiPageInfoArea);
          event.getRequestContext().addUIComponentToUpdateByAjax(uiWikiPageControlArea);
        } else {
          uiWikiPortlet.changeMode(WikiMode.PAGE_NOT_FOUND);
          event
              .getRequestContext()
              .getJavascriptManager()
              .addCustomizedOnLoadScript("eXo.wiki.UIWikiPageNotFound.hidePopup();");
          Utils.ajaxRedirect(
              event, Utils.getCurrentWikiPageParams(), WikiMode.PAGE_NOT_FOUND, null);
        }
      }
    }
 public void execute(Event<UIPortal> event) throws Exception {
   UIPortal uiPortal = event.getSource();
   String portletId = event.getRequestContext().getRequestParameter("portletId");
   UIPortlet uiPortlet = uiPortal.findComponentById(portletId);
   WebuiRequestContext context = event.getRequestContext();
   uiPortlet.createEvent("ChangeWindowState", event.getExecutionPhase(), context).broadcast();
 }
Ejemplo n.º 5
0
    public void execute(Event<UIVoteQuestion> event) throws Exception {
      UIVoteQuestion voteQuestion = event.getSource();
      int number = Integer.parseInt(event.getRequestContext().getRequestParameter(OBJECTID));
      String currentUser = FAQUtils.getCurrentUser();
      List<String> listUsers = new ArrayList<String>();

      if (voteQuestion.question_.getUsersVote() != null) {
        listUsers.addAll(Arrays.asList(voteQuestion.question_.getUsersVote()));
      }
      long totalVote = listUsers.size();
      double markVote =
          (voteQuestion.question_.getMarkVote() * totalVote + number) / (totalVote + 1);

      listUsers.add(currentUser + "/" + number);
      voteQuestion.question_.setMarkVote(markVote);
      voteQuestion.question_.setUsersVote(listUsers.toArray(new String[] {}));
      FAQService faqService_ =
          (FAQService) PortalContainer.getInstance().getComponentInstanceOfType(FAQService.class);
      FAQUtils.getEmailSetting(voteQuestion.faqSetting_, false, false);
      faqService_.saveQuestion(voteQuestion.question_, false, voteQuestion.faqSetting_);
      UIAnswersPortlet portlet = voteQuestion.getAncestorOfType(UIAnswersPortlet.class);
      UIPopupAction popupAction = portlet.getChild(UIPopupAction.class);
      UIQuestions questions =
          portlet.getChild(UIAnswersContainer.class).getChild(UIQuestions.class);
      // questions.setIsNotChangeLanguage() ;
      event.getRequestContext().addUIComponentToUpdateByAjax(questions);
      popupAction.deActivate();
      event.getRequestContext().addUIComponentToUpdateByAjax(popupAction);
    }
Ejemplo n.º 6
0
 public void execute(Event<UISelectUserForm> event) throws Exception {
   UISelectUserForm uiForm = event.getSource();
   UIPopupContainer uiContainer = uiForm.getAncestorOfType(UIPopupContainer.class);
   UIEventForm uiEventForm = uiContainer.findFirstComponentOfType(UIEventForm.class);
   if (uiEventForm != null) {
     StringBuilder sb = new StringBuilder();
     for (Object o : uiForm.uiIterator_.getCurrentPageData()) {
       User u = (User) o;
       UIFormCheckBoxInput input = uiForm.getUIFormCheckBoxInput(u.getUserName());
       if (input != null && input.isChecked()) {
         if (sb != null && sb.length() > 0) sb.append(CalendarUtils.COMMA);
         sb.append(u.getUserName());
       }
     }
     if (CalendarUtils.isEmpty(sb.toString())) {
       event
           .getRequestContext()
           .getUIApplication()
           .addMessage(new ApplicationMessage("UISelectUserForm.msg.user-required", null));
       return;
     }
     uiEventForm.setSelectedTab(uiForm.tabId_);
     event.getRequestContext().addUIComponentToUpdateByAjax(uiEventForm.getParent());
   }
   UIPopupAction chilPopup = uiContainer.getChild(UIPopupAction.class);
   chilPopup.deActivate();
   event.getRequestContext().addUIComponentToUpdateByAjax(chilPopup);
 }
    public void execute(Event<UIPortlet> event) throws Exception {
      UIPortlet uiPortlet = event.getSource();

      String portletMode = null;

      Object changePortletModeAttribute =
          event.getRequestContext().getAttribute(CHANGE_PORTLET_MODE_EVENT);
      if (changePortletModeAttribute != null && changePortletModeAttribute instanceof String) {
        portletMode = (String) changePortletModeAttribute;
      }

      if (portletMode == null) {
        portletMode = event.getRequestContext().getRequestParameter(Constants.PORTAL_PORTLET_MODE);
      }
      if (portletMode == null) {
        portletMode = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
      }
      if (portletMode == null) {
        portletMode = uiPortlet.getCurrentPortletMode().toString();
      }

      log.trace(
          "Change portlet mode of " + uiPortlet.getPortletContext().getId() + " to " + portletMode);
      if (portletMode.equals(PortletMode.HELP.toString())) {
        uiPortlet.setCurrentPortletMode(PortletMode.HELP);
      } else if (portletMode.equals(PortletMode.EDIT.toString())) {
        uiPortlet.setCurrentPortletMode(PortletMode.EDIT);
      } else if (portletMode.equals(PortletMode.VIEW.toString())) {
        uiPortlet.setCurrentPortletMode(PortletMode.VIEW);
      } else {
        PortletMode customMode = new PortletMode(portletMode);
        uiPortlet.setCurrentPortletMode(customMode);
      }
      event.getRequestContext().addUIComponentToUpdateByAjax(uiPortlet);
    }
 public void execute(Event<UIFilterableTree> event) throws Exception {
   UISocialGroupSelector uiGroupSelector =
       event.getSource().getAncestorOfType(UISocialGroupSelector.class);
   String groupId = event.getRequestContext().getRequestParameter(OBJECTID);
   uiGroupSelector.changeGroup(groupId);
   event.getRequestContext().addUIComponentToUpdateByAjax(uiGroupSelector);
 }
Ejemplo n.º 9
0
 public void execute(Event<UIAddAttachment> event) throws Exception {
   UIAddAttachment component = event.getSource();
   EventUIComponent eventUIComponent = component.getTargetAttachEvent();
   UIPortletApplication portlet = component.getAncestorOfType(UIPortletApplication.class);
   UIComponent targerComponent = portlet.findComponentById(eventUIComponent.getId());
   Event<UIComponent> xEvent =
       targerComponent.createEvent(
           eventUIComponent.getEventName(), Event.Phase.PROCESS, event.getRequestContext());
   if (!StringUtils.isEmpty(getSelectedFile(event))) {
     processEvent(event);
   } else {
     event
         .getRequestContext()
         .getUIApplication()
         .addMessage(
             new ApplicationMessage(
                 "UIAddAttachment.msg.not-a-file", null, ApplicationMessage.WARNING));
     ((PortalRequestContext) event.getRequestContext().getParentAppRequestContext())
         .ignoreAJAXUpdateOnPortlets(true);
     return;
   }
   if (xEvent != null) {
     xEvent.broadcast();
   }
   UIPopupWindow uiPopupWindow = event.getSource().getParent();
   uiPopupWindow.setRendered(false);
   uiPopupWindow.setUIComponent(null);
   event.getRequestContext().addUIComponentToUpdateByAjax(uiPopupWindow.getParent());
 }
Ejemplo n.º 10
0
 public void execute(Event<UIVoteQuestion> event) throws Exception {
   UIVoteQuestion voteQuestion = event.getSource();
   double markVote = Double.parseDouble(event.getRequestContext().getRequestParameter(OBJECTID));
   FAQService faqService_ =
       (FAQService) PortalContainer.getInstance().getComponentInstanceOfType(FAQService.class);
   Answer answer = null;
   if (voteQuestion.language_ != null
       && voteQuestion.language_.trim().length() > 0
       && !voteQuestion.language_.equals(voteQuestion.question_.getLanguage())) {
     answer =
         faqService_.getAnswerById(
             voteQuestion.question_.getPath(), voteQuestion.answerId_, voteQuestion.language_);
     answer.setMarksVoteAnswer(markVote);
     faqService_.saveAnswer(voteQuestion.question_.getPath(), answer, voteQuestion.language_);
   } else {
     answer =
         faqService_.getAnswerById(voteQuestion.question_.getPath(), voteQuestion.answerId_);
     answer.setMarksVoteAnswer(markVote);
     faqService_.saveAnswer(voteQuestion.question_.getPath(), answer, false);
   }
   UIAnswersPortlet portlet = voteQuestion.getAncestorOfType(UIAnswersPortlet.class);
   UIPopupAction popupAction = portlet.getChild(UIPopupAction.class);
   UIQuestions questions =
       portlet.getChild(UIAnswersContainer.class).getChild(UIQuestions.class);
   // questions.setIsNotChangeLanguage() ;
   event.getRequestContext().addUIComponentToUpdateByAjax(questions);
   popupAction.deActivate();
   event.getRequestContext().addUIComponentToUpdateByAjax(popupAction);
 }
Ejemplo n.º 11
0
    public void execute(Event<UIMembersPortlet> event) throws Exception {
      UIMembersPortlet uiAllPeople = event.getSource();
      String userId = event.getRequestContext().getRequestParameter(OBJECTID);
      Identity inviIdentityIdentity = Utils.getIdentityManager().getIdentity(userId, true);
      Identity invitingIdentity = Utils.getViewerIdentity();

      Relationship relationship =
          Utils.getRelationshipManager().get(invitingIdentity, inviIdentityIdentity);

      uiAllPeople.setLoadAtEnd(false);
      if (relationship != null && relationship.getStatus() == Relationship.Type.CONFIRMED) {
        Utils.getRelationshipManager().delete(relationship);
        return;
      }

      if (relationship == null) {
        UIApplication uiApplication = event.getRequestContext().getUIApplication();
        uiApplication.addMessage(
            new ApplicationMessage(INVITATION_REVOKED_INFO, null, ApplicationMessage.INFO));
        return;
      }

      Utils.clearCacheOnUserPopup();
      Utils.getRelationshipManager().deny(inviIdentityIdentity, invitingIdentity);
    }
Ejemplo n.º 12
0
    public void execute(Event<UIUserSelector> event) throws Exception {
      UIUserSelector uiSelectUserForm = event.getSource();
      uiSelectUserForm.setSelectedItem();

      int page = Integer.parseInt(event.getRequestContext().getRequestParameter(OBJECTID));
      uiSelectUserForm.updateCurrentPage(page);
      event.getRequestContext().addUIComponentToUpdateByAjax(uiSelectUserForm);
    }
Ejemplo n.º 13
0
 public void execute(Event<UICategorySelector> event) throws Exception {
   UICategorySelector selector = event.getSource();
   int page = Integer.parseInt(event.getRequestContext().getRequestParameter(OBJECTID));
   UIFormTableIteratorInputSet inputSet = selector.getChild(UIFormTableIteratorInputSet.class);
   inputSet.getUIFormPageIterator().setCurrentPage(page);
   selector.init();
   event.getRequestContext().addUIComponentToUpdateByAjax(selector);
 }
    public void execute(Event<UIAccountChangePass> event) throws Exception {
      UIAccountChangePass uiForm = event.getSource();
      OrganizationService service = uiForm.getApplicationComponent(OrganizationService.class);
      WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
      UIApplication uiApp = context.getUIApplication();
      String username = Util.getPortalRequestContext().getRemoteUser();
      User user = service.getUserHandler().findUserByName(username);
      String currentPass = uiForm.getUIStringInput("currentpass").getValue();
      String newPass = uiForm.getUIStringInput("newpass").getValue();
      String confirmnewPass = uiForm.getUIStringInput("confirmnewpass").getValue();

      Authenticator authenticator = uiForm.getApplicationComponent(Authenticator.class);
      boolean authenticated;
      try {
        UsernameCredential usernameCred = new UsernameCredential(username);
        PasswordCredential passwordCred = new PasswordCredential(currentPass);
        authenticator.validateUser(new Credential[] {usernameCred, passwordCred});
        authenticated = true;
      } catch (Exception ex) {
        authenticated = false;
      }

      if (!authenticated) {
        uiApp.addMessage(
            new ApplicationMessage(
                "UIAccountChangePass.msg.currentpassword-is-not-match", null, 1));
        uiForm.reset();
        event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
        return;
      }

      if (!newPass.equals(confirmnewPass)) {
        uiApp.addMessage(
            new ApplicationMessage("UIAccountChangePass.msg.password-is-not-match", null, 1));
        uiForm.reset();
        event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
        return;
      }
      try {
        user.setPassword(newPass);
        service.getUserHandler().saveUser(user, true);
        uiApp.addMessage(
            new ApplicationMessage("UIAccountChangePass.msg.change.pass.success", null));
        UIAccountSetting ui = uiForm.getParent();
        ui.getChild(UIAccountProfiles.class).setRendered(true);
        ui.getChild(UIAccountChangePass.class).setRendered(false);
        event.getRequestContext().addUIComponentToUpdateByAjax(ui);
      } catch (Exception e) {
        uiApp.addMessage(
            new ApplicationMessage(
                "UIAccountChangePass.msg.change.pass.fail", null, ApplicationMessage.ERROR));
      }
      uiForm.reset();
      event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
      return;
    }
    public void execute(Event<UISpaceNavigationManagement> event) throws Exception {
      //
      UISpaceNavigationManagement uiSNM = event.getSource();
      UISpaceNavigationNodeSelector uiNodeSelector =
          uiSNM.getChild(UISpaceNavigationNodeSelector.class);

      String nodeID = event.getRequestContext().getRequestParameter(OBJECTID);
      TreeNode node = uiNodeSelector.findNode(nodeID);
      uiNodeSelector.selectNode(node);
      event.getRequestContext().addUIComponentToUpdateByAjax(uiNodeSelector.getParent());
    }
Ejemplo n.º 16
0
 public void execute(Event<UICategoryForm> event) throws Exception {
   UICategoryForm categoryForm = event.getSource();
   String id =
       event
           .getRequestContext()
           .getRequestParameter(OBJECTID)
           .replace("0,", ForumUtils.EMPTY_STR);
   UIPopupContainer uiPopupContainer = categoryForm.getAncestorOfType(UIPopupContainer.class);
   categoryForm.showUIUserSelect(uiPopupContainer, USER_SELECTOR_POPUPWINDOW, id);
   event.getRequestContext().addUIComponentToUpdateByAjax(uiPopupContainer);
 }
Ejemplo n.º 17
0
 public void execute(Event<UIUserInGroup> event) throws Exception {
   UIUserInGroup uiUserInGroup = event.getSource();
   String id = event.getRequestContext().getRequestParameter(OBJECTID);
   OrganizationService service =
       uiUserInGroup.getApplicationComponent(OrganizationService.class);
   MembershipHandler handler = service.getMembershipHandler();
   handler.removeMembership(id, true);
   uiUserInGroup.refresh();
   event
       .getRequestContext()
       .addUIComponentToUpdateByAjax(uiUserInGroup.getChild(UIGridUser.class));
 }
Ejemplo n.º 18
0
 /*
  * (non-Javadoc)
  * @see
  * org.exoplatform.webui.event.EventListener#execute(org.exoplatform
  * .webui.event.Event)
  */
 public void execute(Event<UIAdminToolbarContainer> event) throws Exception {
   PortalRequestContext context = Util.getPortalRequestContext();
   Boolean quickEdit =
       (Boolean) context.getRequest().getSession().getAttribute(Utils.TURN_ON_QUICK_EDIT);
   if (quickEdit == null || !quickEdit) {
     context.getRequest().getSession().setAttribute(Utils.TURN_ON_QUICK_EDIT, true);
     Utils.updatePortal((PortletRequestContext) event.getRequestContext());
   } else {
     context.getRequest().getSession().setAttribute(Utils.TURN_ON_QUICK_EDIT, false);
     Utils.updatePortal((PortletRequestContext) event.getRequestContext());
   }
 }
    public void execute(Event<UISpaceNavigationManagement> event) throws Exception {
      PortalRequestContext prContext = Util.getPortalRequestContext();
      UISpaceNavigationManagement uiManagement = event.getSource();
      UISpaceNavigationNodeSelector uiNodeSelector =
          uiManagement.getChild(UISpaceNavigationNodeSelector.class);
      UserPortalConfigService portalConfigService =
          uiManagement.getApplicationComponent(UserPortalConfigService.class);

      UIPortalApplication uiPortalApp = (UIPortalApplication) prContext.getUIApplication();
      UIWorkingWorkspace uiWorkingWS =
          uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
      prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
      prContext.ignoreAJAXUpdateOnPortlets(true);

      UserNavigation navigation = uiNodeSelector.getEdittedNavigation();
      SiteKey siteKey = navigation.getKey();
      String editedOwnerId = siteKey.getName();

      // Check existed
      UserPortalConfig userPortalConfig;
      if (SiteType.PORTAL.equals(siteKey.getType())) {
        userPortalConfig =
            portalConfigService.getUserPortalConfig(
                editedOwnerId, event.getRequestContext().getRemoteUser());
        if (userPortalConfig == null) {
          prContext
              .getUIApplication()
              .addMessage(
                  new ApplicationMessage(
                      "UIPortalForm.msg.notExistAnymore", null, ApplicationMessage.ERROR));
          return;
        }
      } else {
        userPortalConfig =
            portalConfigService.getUserPortalConfig(
                prContext.getPortalOwner(), event.getRequestContext().getRemoteUser());
      }

      UserNavigation persistNavigation = userPortalConfig.getUserPortal().getNavigation(siteKey);
      if (persistNavigation == null) {
        prContext
            .getUIApplication()
            .addMessage(
                new ApplicationMessage(
                    "UINavigationManagement.msg.NavigationNotExistAnymore",
                    null,
                    ApplicationMessage.ERROR));
        return;
      }

      uiNodeSelector.save();
    }
Ejemplo n.º 20
0
 public void execute(Event<UISearchBasisPortlet> event) throws Exception {
   UISearchBasisPortlet uiSearchBasisPortlet = event.getSource();
   String id = event.getRequestContext().getRequestParameter(OBJECTID);
   if (id == null) return;
   for (UIComponent uicomponent : uiSearchBasisPortlet.getChildren()) {
     if (!uicomponent.getId().equals(id)) {
       uicomponent.setRendered(false);
     } else {
       uicomponent.setRendered(true);
     }
   }
   event.getRequestContext().addUIComponentToUpdateByAjax(uiSearchBasisPortlet);
 }
Ejemplo n.º 21
0
 @Override
 public void execute(Event<UIMeetingDetail> event) throws Exception {
   UIMeetingSchedulePortlet portlet =
       event.getSource().getAncestorOfType(UIMeetingSchedulePortlet.class);
   portlet.getChild(UIListMeetingSchedule.class).setRendered(false);
   UINewMeetingSchedule uiNewMeetingSchedule = portlet.getChild(UINewMeetingSchedule.class);
   String jcrPath = event.getRequestContext().getRequestParameter(OBJECTID);
   MeetingService meetingService = portlet.getApplicationComponent(MeetingService.class);
   uiNewMeetingSchedule.setEditMeeting(meetingService.getMeeting(jcrPath));
   uiNewMeetingSchedule.init();
   uiNewMeetingSchedule.setRendered(true);
   event.getRequestContext().addUIComponentToUpdateByAjax(portlet);
 }
Ejemplo n.º 22
0
    public void execute(Event<UITaggingFormContainer> event) throws Exception {
      UITaggingFormContainer uiTaggingFormContainer = event.getSource();
      String selectedName = event.getRequestContext().getRequestParameter(OBJECTID);
      Node selectedTag = uiTaggingFormContainer.getSelectedTag(selectedName);
      uiTaggingFormContainer.initTaggingFormPopup(selectedTag);

      UIJCRExplorer uiExplorer = uiTaggingFormContainer.getAncestorOfType(UIJCRExplorer.class);
      Preference preferences = uiExplorer.getPreference();
      if (preferences.isShowSideBar()) {
        UISideBar uiSideBar = uiExplorer.findFirstComponentOfType(UISideBar.class);
        event.getRequestContext().addUIComponentToUpdateByAjax(uiSideBar);
      }
      event.getRequestContext().addUIComponentToUpdateByAjax(uiTaggingFormContainer);
    }
    public void execute(Event<UIPortlet> event) throws Exception {
      UIPortlet uiPortlet = event.getSource();

      UIPortalApplication uiPortalApp = uiPortlet.getAncestorOfType(UIPortalApplication.class);
      UIWorkingWorkspace uiWorkingWS =
          uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
      PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext();
      pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
      pcontext.ignoreAJAXUpdateOnPortlets(true);

      String windowState = null;

      Object changeWindowStateAttribute =
          event.getRequestContext().getAttribute(CHANGE_WINDOW_STATE_EVENT);
      if (changeWindowStateAttribute != null && changeWindowStateAttribute instanceof String) {
        windowState = (String) changeWindowStateAttribute;
      }

      if (windowState == null) {
        windowState = event.getRequestContext().getRequestParameter(Constants.PORTAL_WINDOW_STATE);
      }
      if (windowState == null) {
        if (event.getRequestContext().getRequestParameter(UIComponent.OBJECTID) != null) {
          windowState = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID).trim();
        }
      }

      if (windowState == null) {
        windowState = uiPortlet.getCurrentWindowState().toString();
      }

      UIPage uiPage = uiPortlet.getAncestorOfType(UIPage.class);
      if (windowState.equals(WindowState.MAXIMIZED.toString())) {
        if (uiPage != null) {
          uiPage.normalizePortletWindowStates();
          uiPage.setMaximizedUIPortlet(uiPortlet);
        }
        uiPortlet.setCurrentWindowState(WindowState.MAXIMIZED);
        return;
      } else {
        if (windowState.equals(WindowState.MINIMIZED.toString())) {
          uiPortlet.setCurrentWindowState(WindowState.MINIMIZED);
        } else {
          uiPortlet.setCurrentWindowState(WindowState.NORMAL);
        }
        if (uiPage != null) {
          clearMaximizedUIComponent(uiPage, uiPortlet);
        }
      }
    }
Ejemplo n.º 24
0
 public void execute(Event<UIGroupSelector> event) throws Exception {
   UIGroupSelector uiSelectGroupForm = event.getSource();
   UIUserSelector uiSelectUserForm = uiSelectGroupForm.<UIComponent>getParent().getParent();
   String groupId = event.getRequestContext().getRequestParameter(OBJECTID);
   uiSelectUserForm.setSelectedGroup(groupId);
   OrganizationService service =
       uiSelectGroupForm.getApplicationComponent(OrganizationService.class);
   PageList users =
       uiSelectUserForm.removeDuplicate(service.getUserHandler().findUsersByGroup(groupId));
   users.setPageSize(10);
   uiSelectUserForm.uiIterator_.setPageList(users);
   uiSelectUserForm.setKeyword(null);
   event.getRequestContext().addUIComponentToUpdateByAjax(uiSelectUserForm);
 }
Ejemplo n.º 25
0
 public void execute(Event<UIBreadcumbs> event) throws Exception {
   UIBreadcumbs uiBreadcumbs = event.getSource();
   UIGroupMemberSelector uiGroupMemberSelector = uiBreadcumbs.getParent();
   String objectId = event.getRequestContext().getRequestParameter(OBJECTID);
   uiBreadcumbs.setSelectPath(objectId);
   String selectGroupId = uiBreadcumbs.getSelectLocalPath().getId();
   uiGroupMemberSelector.changeGroup(selectGroupId);
   if (uiGroupMemberSelector.isUsePopup) {
     UIPopupWindow uiPopup = uiBreadcumbs.getAncestorOfType(UIPopupWindow.class);
     uiPopup.setShow(true);
     uiPopup.setShowMask(true);
   }
   event.getRequestContext().addUIComponentToUpdateByAjax(uiGroupMemberSelector);
 }
Ejemplo n.º 26
0
 public void doMove(Event<UITabContainer> event, boolean isToLeft) throws Exception {
   UITabContainer container = event.getSource();
   String objectId = event.getRequestContext().getRequestParameter(OBJECTID);
   if (container == null || objectId == null) {
     return;
   }
   container.moveTab(container, objectId, isToLeft);
   WebuiRequestContext context = event.getRequestContext();
   context.addUIComponentToUpdateByAjax(container);
   context
       .getJavascriptManager()
       .require("SHARED/portal", "portal")
       .addScripts("portal.PortalComposer.toggleSaveButton();");
 }
Ejemplo n.º 27
0
    public void execute(Event<UIDropDownControl> event) throws Exception {
      UIDropDownControl uiDropDown = event.getSource();
      UIUserActivitiesDisplay uiUserActivities = uiDropDown.getParent();
      WebuiRequestContext requestContext = event.getRequestContext();
      String selectedDisplayMode = requestContext.getRequestParameter(OBJECTID);

      if (selectedDisplayMode.equals(DisplayMode.ALL_ACTIVITIES.toString())) {
        uiUserActivities.setSelectedDisplayMode(DisplayMode.ALL_ACTIVITIES);
      } else if (selectedDisplayMode.equals(DisplayMode.MY_ACTIVITIES.toString())) {
        uiUserActivities.setSelectedDisplayMode(DisplayMode.MY_ACTIVITIES);
      } else if (selectedDisplayMode.equals(DisplayMode.MY_SPACE.toString())) {
        uiUserActivities.setSelectedDisplayMode(DisplayMode.MY_SPACE);
      } else {
        uiUserActivities.setSelectedDisplayMode(DisplayMode.CONNECTIONS);
      }

      if (selectedDisplayMode != null) {
        uiUserActivities.setSelectedDisplayMode(selectedDisplayMode);
        uiUserActivities.init();

        uiUserActivities.setChangedMode(false);

        // int numberOfUpdates = uiUserActivities.getNumberOfUpdatedActivities();

        //
        event
            .getRequestContext()
            .getJavascriptManager()
            .require("SHARED/social-ui-activity-updates", "activityUpdates")
            .addScripts(
                "activityUpdates.resetCookie('"
                    + String.format(
                        Utils.ACTIVITY_STREAM_TAB_SELECTED_COOKIED, Utils.getViewerRemoteId())
                    + "','"
                    + selectedDisplayMode
                    + "');");
        //
        //       event.getRequestContext().getJavascriptManager()
        //       .require("SHARED/social-ui-activity-updates",
        // "activityUpdates").addScripts("activityUpdates.resetCookie('" +
        // String.format(Utils.LAST_UPDATED_ACTIVITIES_NUM, selectedDisplayMode,
        // Utils.getViewerRemoteId()) + "','" + numberOfUpdates + "');");

      }

      requestContext.addUIComponentToUpdateByAjax(uiUserActivities);

      Utils.resizeHomePage();
    }
Ejemplo n.º 28
0
 public void execute(Event<UICategorySelector> event) throws Exception {
   UICategorySelector selector = event.getSource();
   selector.clearSelectedCategories();
   UIContainer appInfo = selector.getParent();
   appInfo.getChild(UICategorySelector.class).setRendered(false);
   event.getRequestContext().addUIComponentToUpdateByAjax(appInfo);
 }
Ejemplo n.º 29
0
    public void execute(Event<UICategorySelector> event) throws Exception {
      UICategorySelector selector = event.getSource();

      ApplicationRegistryService appRegService =
          selector.getApplicationComponent(ApplicationRegistryService.class);
      List<ApplicationCategory> categories = appRegService.getApplicationCategories();
      categories = categories != null ? categories : new ArrayList<ApplicationCategory>();
      for (ApplicationCategory category : categories) {
        if (selector.getSelectedCategories().contains("category_" + category.getName())) {
          Application newApp = cloneApplication(selector.getApplication());
          UIApplicationRegistryPortlet.setPermissionToAdminGroup(newApp);
          appRegService.save(category, newApp);
        }
      }
      selector.clearSelectedCategories();

      UIContainer appInfo = selector.getParent();
      appInfo.getChild(UICategorySelector.class).setRendered(false);
      UIApplicationRegistryPortlet uiPortlet =
          appInfo.getAncestorOfType(UIApplicationRegistryPortlet.class);
      UIApplicationOrganizer uiOrganizer = uiPortlet.getChild(UIApplicationOrganizer.class);
      UIGadgetManagement uiGadgetManagement = uiPortlet.getChild(UIGadgetManagement.class);

      uiOrganizer.reload();
      if (uiGadgetManagement != null) {
        uiGadgetManagement.setSelectedGadget(selector.getApplication().getApplicationName());
      }

      event.getRequestContext().addUIComponentToUpdateByAjax(appInfo);
    }
Ejemplo n.º 30
0
    public void execute(Event<UIWCMCacheManagerForm> event) throws Exception {
      UIWCMCacheManagerForm uiCacheForm = event.getSource();
      UIWCMCacheManagerPanel uiCachePanel =
          uiCacheForm.getAncestorOfType(UIWCMCacheManagerPanel.class);
      // droplist option choice
      // String cacheOpt = uiCacheForm.getUIFormSelectBox(FIELD_MODIFY).getValue();

      // get current cache
      // cache = WCMCoreUtils.getService(CacheService.class).getCacheInstance(cacheOpt);

      // check whether its allowed to change
      Boolean isChecked = uiCacheForm.getUIFormCheckBoxInput(CHECKBOX_ENABLE_CACHE).isChecked();
      if (isChecked) {
        String livetime = uiCacheForm.getUIStringInput(FIELD_LIVE_TIME).getValue();
        String maxsize = uiCacheForm.getUIStringInput(FIELD_MAX_SIZE).getValue();
        // update changes
        uiCacheForm.cache.setLiveTime(Long.parseLong(livetime));
        uiCacheForm.cache.setMaxSize(Integer.parseInt(maxsize));
        // update cache info
        uiCacheForm.update(cache);
      } else {
        throw new Exception("cache enable is not set");
      }

      event.getRequestContext().addUIComponentToUpdateByAjax(uiCachePanel);
    }