cancel
Showing results for 
Search instead for 
Did you mean: 

Scripts Tag in FTL File

nirvanvjain
Champ on-the-rise
Champ on-the-rise
Dear Folks,

I am working on Alfresco Share since last short time.

I observed that in each and every component's FTl file there is Javascript is added (except very few) which is some thing like this ::

<script>
   var mratings = new Metaversant.Ratings('${fieldHtmlId}').setOptions({
      targetUrl: "${url.context}/proxy/alfresco/api/node/workspace/SpacesStore/{id}/mratings",
      metadataRefresh: true
   });
</script>

<script type="text/javascript">//<![CDATA[
   new Alfresco.Search("${el}").setOptions(
   {
      siteId: "${siteId}",
      siteTitle: "${siteTitle?js_string}",
      initialSearchTerm: "${searchTerm?js_string}",
      initialSearchTag: "${searchTag?js_string}",
      initialSearchAllSites: ${searchAllSites?string},
      initialSearchRepository: ${searchRepo?string},
      initialSort: "${searchSort?js_string}",
      searchQuery: "${searchQuery?js_string}",
      minSearchTermLength: ${args.minSearchTermLength!searchconfig.getChildValue('min-search-term-length')},
      maxSearchResults: ${args.maxSearchResults!searchconfig.getChildValue('max-search-results')}
   }).setMessages(
      ${messages}
   );
//]]></script>

What is the significant of this script ?

In some of the wiki link I found <![CDATA[ ] ..> why it is there ? But still not clear to me.

What is this setOption() function significant ?

Is it some thing like calling,it is  webscript ? (In some of the cases I felt {don't know how much true} it is calling webscript to pass or fill values)

Please teach me.

Thanks!
-Nirvan
1 REPLY 1

jordiv
Champ on-the-rise
Champ on-the-rise
Hi,

If I'm not wrong, CDATA is used to pass XHTML validation. This article may help you: Javascript and XHTML

As far as I know, the setOptions() function is used to set configuration values. This article may help you: Making Alfresco Share Dashlets Configurable

Cheers,
Jordi.