AnsweredAssumed Answered

Chrome

Question asked by marco.altieri on Oct 18, 2011
Latest reply on Oct 21, 2011 by marco.altieri
I'm trying to modify the region chrome configured in Web Quick Start.
in the file WEB-INF/surf.xml is configured a default chrome:


<defaults>
   <region-chrome>vanilla</region-chrome>
      <!– Set up our sample login and logout pages –>
      <page-type>
            <id>login</id>
            <page-instance-id>sample/login</page-instance-id>
      </page-type>
      <page-type>
            <id>logout</id>
            <page-instance-id>sample/logout</page-instance-id>
      </page-type>
      <!– User factory for Alfresco 3.2 –>
      <!–
      <user-factory>webframework.factory.user.alfresco32</user-factory>
      –>
      <!– User factory for Alfresco 3.3 –>
      <!–
      <user-factory>webframework.factory.user.alfresco</user-factory>
      –>
</defaults>

The vanilla chrome writes the content of the region without any wrapping. Just as a test, I tried to change the ftl template: tomcat/webapps/wcmqs/WEB-INF/chrome/vanilla/chrome.ftl, adding a div:

<div class="standard-region-chrome">
<@regionInclude/>
</div>


The problem is that this template seems to be completely ignored.

I have also tried to use a the "titled" chrome that is defined in

Unfortunately the jsp ./tomcat/webapps/wcmqs/WEB-INF/chrome/titled/chrome.jsp

cannot be compiled because it uses the class RenderContext that is not available. I tried to use the class RequestContext instead of RenderContext:


<%@ page import="org.springframework.extensions.surf.*" %>
<%@ page import="org.springframework.extensions.surf.types.*"%>
<%@ page import="org.springframework.extensions.surf.render.*" %>
<%@ page buffer="0kb" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="surf" uri="http://www.springframework.org/tags/surf" %>
<%
        RequestContext context = (RequestContext) request.getAttribute(RenderContextRequest.ATTRIB_RENDER_CONTEXT);

        // get the component
        String componentId = (String) context.getValue(WebFrameworkConstants.RENDER_DATA_COMPONENT_ID);
        if (componentId != null) {
            System.out.println("componentId = " + componentId);
            System.out.println("context.getObjectService() = " + context.getObjectService());
            System.out.println("context.getObjectService().getComponent(componentId) = " + context.getObjectService().getComponent(componentId));
            Component component = context.getObjectService().getComponent(componentId);

            String title = null;
            if (component != null && component.getTitle() != null)
            {
                    title = component.getTitle();
            }

            if (title != null)
            {
%>
<h2><%=title%></h2>
<%
            }
        }
%>
<surf:componentInclude/>

but it seems that the context is not configured properly: componentId is null and there isn't any RenderService configured in the Spring container.

Could someone help me?

Thank you,
Marco

Outcomes