cancel
Showing results for 
Search instead for 
Did you mean: 

Template-scoped header errors in utilities.js

cybertoast
Champ in-the-making
Champ in-the-making
I'm trying to create site-scoped headers so that the header bar has different components based on which site you're on. But I'm starting with a simple common header for all sites, which would be different from the global header visible for other pages (user primarily).

I figured I could create  <@region id="header" scope="template"> and create a template for this header. I'm calling it collaboration-header in keeping with the documentlibrary components being called collaboration-*. This works well, but when I navigate to the documentlibrary I get nothing in the pane that displays the folders and files, the Library block has nothing in it, and the links in the Documents block all go nowhere.

I looked further into this and the error I'm getting is in utilities.js. Firebug console gives me:

this._events is undefined at utilities.js (line 37)

utilities.js is /share/yui/utilities/utilities.js

The steps I followed to create a template-scoped header (which I'm assuming to be what I need to do to have the header be localized to sites only):
  • Modify web-extension/templates/org/alfresco/documentlibrary.ftl to have <%region id="header" scope="template" protected=true />

  • Create web-extension/site-webscripts/org/alfresco/components/header/collaboration-header.get.[desc.xml, head.ftl, html.ftl, js] all copied from header.*

  • Modify collaboration-header.desc.xml's url to point to /components/header/collaboration-header

  • Leave collaboration-header.get.head.ftl the same as header.get.head.ftl, and collaboration-header.get.js the same as header.get.js

  • Customize collaboration-header.get.html.ftl as I need
I feel like I'm missing something that should be included (like a javascript file that ensures that this._events is not undefined) but I can't figure out what the global scoped header is doing that is different from the template-scoped collaboration-header.

Is my understanding of scope and customization incorrect? What am I doing wrong?
2 REPLIES 2

cybertoast
Champ in-the-making
Champ in-the-making
Forgot to add that I also modified web-extension/site-data/components/template.header.documentlibrary.xml:

<?xml version='1.0' encoding='UTF-8'?>
<component>
  <scope>template</scope>
  <region-id>header</regien-id>
  <source-id>documentlibrary</source-id>
  <url>/components/header/collaboration-header</url>
</component>

cybertoast
Champ in-the-making
Champ in-the-making
The problem turned out to be because I had removed the sites menu from the header, and the client-side code was blowing up when it tried to execute anything related to the *sites-menu element, which of course was missing!

The lesson here is to keep in mind that there is so much client-side link to the back-end that things will break if UI elements are changed in any way without looking in great detail at the events that are defined in the back-end. Freemarker (HTML), YUI and alfresco are tied very closely together, so always do things with great attention to detail!
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.