@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);
        }
      }
    }
Beispiel #2
0
 private WikiPageParams getCurrentWikiPageParams() {
   WikiPageParams wikiPageParams = null;
   try {
     wikiPageParams = Utils.getCurrentWikiPageParams();
   } catch (Exception e) {
     log.warn("Can't get current wiki page params", e);
   }
   UIWikiPortlet wikiPortlet = this.getAncestorOfType(UIWikiPortlet.class);
   if (wikiPortlet.getWikiMode() == WikiMode.ADDPAGE) {
     String sessionId = Util.getPortalRequestContext().getRequest().getSession(false).getId();
     wikiPageParams.setPageId(sessionId);
   }
   return wikiPageParams;
 }
    @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);
      }
    }
    @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);
      }
    }