<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Custom methods. in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/custom-methods/m-p/22468#M10779</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, that did the trick&amp;nbsp; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Mar 2006 05:42:41 GMT</pubDate>
    <dc:creator>spazzm</dc:creator>
    <dc:date>2006-03-27T05:42:41Z</dc:date>
    <item>
      <title>Custom methods.</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/custom-methods/m-p/22466#M10777</link>
      <description>Hi, I'm new to Alfresco and this forum, please be gentle.I'm trying to add a custom method to Alfresco so that I can do the following in my templates:${doSomething(document.some.property)}If I've understood the explanation of custom methods in the Wiki correctly, this is done through FreeMarker cust</description>
      <pubDate>Fri, 24 Mar 2006 05:13:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/custom-methods/m-p/22466#M10777</guid>
      <dc:creator>spazzm</dc:creator>
      <dc:date>2006-03-24T05:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: Custom methods.</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/custom-methods/m-p/22467#M10778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At the moment adding your own custom freemarker template method requires you to change the following code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;org.alfresco.web.ui.repo.component.template.DefaultModelHelper&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;In this class we generate the model (a Map of named objects) that the template is executed against. Any custom methods need to be part of that map. The method is made available to your template code using the name of the object in the Map. If you look for these lines:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // add custom method objects&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; root.put("hasAspect", new HasAspectMethod());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; root.put("message", new I18NMessageMethod());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; root.put("dateCompare", new DateCompareMethod());&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;you'll see that we add our custom methods here. So if you add your own class to the source tree and then add it to the objects added at this point then your method will be made available to templates executing through the web-client. You will need to build Alfresco from source to do this at present. I think will we add a task to allow custom method to be added via config at a later date.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are writing your own code to call the underlying repository template service directly, then you will be building the model Map yourself anyway, in which case you will do exactly the same as above to add your custom method impl class to the map with the desired name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Mar 2006 11:20:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/custom-methods/m-p/22467#M10778</guid>
      <dc:creator>kevinr</dc:creator>
      <dc:date>2006-03-24T11:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: Custom methods.</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/custom-methods/m-p/22468#M10779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, that did the trick&amp;nbsp; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Mar 2006 05:42:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/custom-methods/m-p/22468#M10779</guid>
      <dc:creator>spazzm</dc:creator>
      <dc:date>2006-03-27T05:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: Custom methods.</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/custom-methods/m-p/22469#M10780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, kevin&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i seen that code was moved to buildDefaultModel in FreeMarkerProcessor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to create my own freemarker method, is there a way now to do it without modify your code ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jan 2007 11:41:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/custom-methods/m-p/22469#M10780</guid>
      <dc:creator>ribz33</dc:creator>
      <dc:date>2007-01-26T11:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Custom methods.</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/custom-methods/m-p/22470#M10781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Unfortunately not - it's on my TODO list &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; but other stuff been higher priority for this release - like the WCM UI! &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://connect.hyland.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In 2.0 we have a nice extension mechanism in place for adding new Java bean objects with new methods etc. to the JavaScript API - and I'd like to follow the same pattern for the FreeMarker API. This would allow you to add both helper objects (containing new functional units) and new method objects to FreeMarker via configuration only - let's hope it stays on the list for Alfresco 2.1…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jan 2007 17:48:32 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/custom-methods/m-p/22470#M10781</guid>
      <dc:creator>kevinr</dc:creator>
      <dc:date>2007-01-26T17:48:32Z</dc:date>
    </item>
  </channel>
</rss>

