Ejemplo n.º 1
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);
        }
      }
    }
Ejemplo n.º 2
0
    @Override
    public void execute(Event<UIWikiPermalinkForm> event) throws Exception {
      UIWikiPermalinkForm uiWikiPermalinkForm = event.getSource();
      UIWikiPortlet uiWikiPortlet = uiWikiPermalinkForm.getAncestorOfType(UIWikiPortlet.class);

      if (uiWikiPermalinkForm.canModifyPagePermission()) {
        UIPopupContainer uiPopupContainer = uiWikiPortlet.getPopupContainer(PopupLevel.L1);
        uiPopupContainer.cancelPopupAction();

        UIWikiPermissionForm uiWikiPermissionForm =
            uiPopupContainer.createUIComponent(
                UIWikiPermissionForm.class, null, "UIWikiPagePermissionForm");
        uiPopupContainer.activate(uiWikiPermissionForm, 800, 0);
        uiWikiPermissionForm.setPopupLevel(PopupLevel.L1);
        uiWikiPermissionForm.setScope(Scope.PAGE);
        PageImpl page = (PageImpl) Utils.getCurrentWikiPage();
        HashMap<String, String[]> permissionMap = page.getPermission();
        List<PermissionEntry> permissionEntries =
            uiWikiPermissionForm.convertToPermissionEntryList(permissionMap);
        uiWikiPermissionForm.setPermission(permissionEntries);
        event.getRequestContext().addUIComponentToUpdateByAjax(uiPopupContainer);
      }
    }
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.put(
            IdentityConstants.ANY,
            new String[] {
              org.exoplatform.services.jcr.access.PermissionType.READ,
              org.exoplatform.services.jcr.access.PermissionType.ADD_NODE,
              org.exoplatform.services.jcr.access.PermissionType.REMOVE,
              org.exoplatform.services.jcr.access.PermissionType.SET_PROPERTY
            });
        currentPage.setPermission(permissions);

        UIWikiPortlet uiWikiPortlet = uiWikiPermalinkForm.getAncestorOfType(UIWikiPortlet.class);
        UIWikiPageInfoArea uiWikiPageInfoArea =
            uiWikiPortlet.findFirstComponentOfType(UIWikiPageInfoArea.class);
        event.getRequestContext().addUIComponentToUpdateByAjax(uiWikiPermalinkForm);
        event.getRequestContext().addUIComponentToUpdateByAjax(uiWikiPageInfoArea);
      }
    }