cancel
Showing results for 
Search instead for 
Did you mean: 

unable to override colleagues.html.ftl alfresco 4.2

ayubalfresco
Champ in-the-making
Champ in-the-making
Hi,

I am unable to over ride colleagues.get.html.ftl and colleagues.get.js in alfresco share 4.2. I am deploying the code using jar copied to share/web-inf/lib folder.

below is the approach I am using :

below is the xml code under alfresco/site-data folder

<module>

         <id>Site Members Extension</id>

         <auto-deploy>true</auto-deploy>

         <!– Enhance individual WebScripts when their paths match –>

         <customizations>

            <customization>

               <targetPackageRoot>org.alfresco.components.dashlets</targetPackageRoot>

               <sourcePackageRoot>mycustoms.components.dashlets</sourcePackageRoot>

            </customization>

         </customizations>

      </module>




ftl and js files are under alfresco/site-webscripts/mycustoms/components/dashlets/


Could some one suggest what might be the issue ?

If I copy the site-webscripts folder directly under web-extensions (without using the jar approach) it works. How to make it work using the jar file ?

I was able to use the above approach to override the css file. Please suggest any clues…
7 REPLIES 7

ddraper
World-Class Innovator
World-Class Innovator
Are you trying to override or extend the colleagues.get WebScript? It looks like you're trying to extend rather than override (based on the fact that you're using an extension module). Extending a JavaScript controller gives you the opportunity to modify the default model before it is passed to the template, and extending the template relies on the existence of <@markup> directives in the template that you can work with.

If you want to override the WebScript then you need to copy and paste the default to the matching path under the "web-extension" directory.

ayubalfresco
Champ in-the-making
Champ in-the-making
when I copy the folder structure to web-extensions directory the script and template gets overridden.

However if I use the extend approach why is that I am not seeing the change ?

I am using the same files with little modifications. Since the modified file already has the <@markup> directives that should be fine right ? or Should the colleagues.get.html.ftl file simply have <@markup> directtive tag which I updated and remove the other default content present in  it ?

Thank you for the clues !!

ddraper
World-Class Innovator
World-Class Innovator
I think you should read the following blog posts:
http://blogs.alfresco.com/wp/developer/2011/08/05/customizing-alfresco-share-javascript-controllers/
http://blogs.alfresco.com/wp/developer/2011/08/12/customizing-alfresco-share-freemarker-templates/

If you've already read those and understand the difference between extending/customizing then I'd suggest you provide the source for your extension controller and template to help us understand the issue.

ayubalfresco
Champ in-the-making
Champ in-the-making
Hi Dave,

Thank you for the links, I was able to extend the css for hiding quick share on documentlibrary section. not sure what mistake I am doing for site members dashlet.

Could you please verify the below code for site members dashlet I am extending. I am trying to add span element before profile link.

site-date/components/global.additional-content.xml

<component>
<region-id>component-1-1</region-id>
<source-id>site/${siteid}/dashboard</source-id>
<scope>page</scope>
<uri>/components/dashlets/colleagues</uri>
</component>
</components>


site-data/extensions/my-extensions.xml

<module>
         <id>Site Members Extension</id>
         <auto-deploy>true</auto-deploy>
         <!– Enhance individual WebScripts when their paths match –>
         <customizations>
         <customization>
      <targetPackageRoot>org.alfresco.components.dashlets</targetPackageRoot>
    <sourcePackageRoot>org.alfresco.components.dashlets</sourcePackageRoot>
</customization>
</customizations>
</module>


alfresco.templates.org.alfresco.components.dashlets/colleagues.get.html.ftl

<@markup id="list-item-person">
<h3><a href="${url.context}/page/user/${m.authority.userName?url}/profile" class="theme-color-1"><span sip=${m.email?html}></span>${m.authority.firstName?html} <#if m.authority.lastName??>${m.authority.lastName?html}</#if></a></h3>
</@markup>


web-scripts/org/alfresco/dashlets/colleagues.get.js

<import resource="classpath:/alfresco/templates/org/alfresco/import/alfresco-util.js">

//Prepare the model
model.memberships = memberships;
model.totalResults = totalResults;
model.maxResults = maxItems;
model.userMembership = AlfrescoUtil.getSiteMembership(page.url.templateArgs.site);

var memberships = model.memberships;

for (var i = 0; memberships.length > i; i++ ) {
   var membership = memberships;
   var profile = user.getUser(membership.authority.userName)
   membership.email = profile.email;
   membership.current = user.name == membership.authority.userName;

ddraper
World-Class Innovator
World-Class Innovator
In your .get.html file you're not actually saying what you want to do with the <@markup> directive … you need to specify an "action" attribute, in this case probably "replace" .

ayubalfresco
Champ in-the-making
Champ in-the-making
still no luck, I have updated the <@markup> directive.


<#– LIST - ITEM - PERSON –>
<@markup id="list-item-person" action="replace">
<h3><a href="${url.context}/page/user/${m.authority.userName?url}/profile" class="theme-color-1"><span sip=${m.email?html}></span>${m.authority.firstName?html} <#if m.authority.lastName??>${m.authority.lastName?html}</#if></a></h3>
                     </@markup>


Could you please confirm if the below directives are correct ?


<component>

<region-id>component-1-1</region-id>

<source-id>site/${siteid}/dashboard</source-id>

<scope>page</scope>

<uri>/components/dashlets/colleagues</uri>

</component>

</components>


One thing that is working for me is when I copy the folder structure under web-extensions/site-webscripts (complete file not just the markup I want to update). Everything is working fine. I was thinking it would be good if I could make the jar approach to work.

I was able to make the jar approach work to hide the quickshare link. Any other clues please…

ddraper
World-Class Innovator
World-Class Innovator
You need to be setting a "target" attribute to match the existing <@markup> directive that you want to replace.