コード例 #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);
        }
      }
    }
コード例 #2
0
 public static List<JsonRelatedData> pageToJson(List<Page> pages) {
   List<JsonRelatedData> jsonObjs = new ArrayList<>();
   for (Page page : pages) {
     String name = page.getName();
     String title = page.getTitle();
     String path = TreeUtils.getPathFromPageParams(Utils.getWikiPageParams(page));
     JsonRelatedData dataObj = new JsonRelatedData(name, title, path);
     jsonObjs.add(dataObj);
   }
   return jsonObjs;
 }
コード例 #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);
      }
    }