When conveying "viewpage.action" everything works as expected, besides when viewing a page now I no longer get the "Edit" button in the upper right corner, but instead a "View Page" button only. I noticed in page.vm and page.vmd files that a "mode" decides what is rendered there, but couldn't figure out why it changed due to my conveyed action.
The conveyor-config.xml contains the following:
<conveyor-config> <package-override name="pages" namespace="/pages"> <action-override name="viewpage" class="my.package.actions.ViewPageOverrideAction" inherit="true"> </action-override> </package-override> </conveyor-config>
My ViewPageOverrideAction only adds text to the content of the page:
@Override public String execute() throws Exception { return super.execute(); } @Override @HtmlSafe public String getPageXHtmlContent() { String pageXHtmlContent = super.getPageXHtmlContent(); return pageXHtmlContent + "I was added"; }
Why is it that I get the "View Page" button instead of the "Edit" button. How can I fix it? Any help would be appreciated.
Problem was that a method in ViewPageAction checks for the ViewPageClass.class. Solution is to override that method and exchange the class.
@Override public WebInterfaceContext getWebInterfaceContext() { DefaultWebInterfaceContext result = new DefaultWebInterfaceContext(super.getWebInterfaceContext()); List<Label> labels = getPage() == null ? Collections.<Label> emptyList() : getPage().getLabelsForDisplay( getRemoteUser()); result.setParameter("labels", labels); if (getClass().equals(ViewPageOverrideAction.class)) result.setParameter(ViewingContentCondition.CONTEXT_KEY, Boolean.TRUE); return result; }
Problem was that the WebInterfaceContext checks for the ViewPageAction.class. Overriding the following method and entering the ViewPageOverrideAction.class solves the problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.