Bug 850880 - Add "how to include groovy snippet into templates in EPP" to the developer guide.
Summary: Add "how to include groovy snippet into templates in EPP" to the developer gu...
Keywords:
Status: ON_QA
Alias: None
Product: JBoss Enterprise Portal Platform 5
Classification: JBoss
Component: Documentation
Version: 5.2.2.GA
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: ---
Assignee: JPP Docs Team
QA Contact: Tomas Kyjovsky
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-08-22 15:46 UTC by Gary Hu
Modified: 2023-06-23 14:12 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: A release note is required for this issue. Only relating to EPP 5.2 Consequence: Fix: Result:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Gary Hu 2012-08-22 15:46:13 UTC
One customer has raised such question "Currently all our dialog templates we have similar code repeated over and over. For example we have added a wysiwyg field in all our template for which we have written same groovy code in all our dialog templates. Is it possible to externalize the code in a separate groovy template and refer it in all the dialog templates so that we can centrally change our dialog templates if needed."


We've got the answer from eXo.

*********************************************************************************
To include groovy snippets in the dialog template you can use :
_ctx.include(TemplatePath);

To get the path of the templae :
import org.exoplatform.services.cms.templates.TemplateService;
  
  public String getTemplatePath(boolean isDialog, String nodeTypeName, String templateName) throws Exception {
   TemplateService tempService = uicomponent.getApplicationComponent(TemplateService.class);
   String path = tempService.getTemplatePath(isDialog, nodeTypeName, templateName) ;
    return path;
  }
For example

Example 1 : to embed the template of vote & comment for view template
<div><% _ctx.include(uicomponent.getViewTemplate("mix:votable", "view1")); %></div>
<div><% _ctx.include(uicomponent.getViewTemplate("exo:comments", "view1")); %></div>

Example 2 : to embed the dialog template of exo:podcast for an other dialog template
<% 
   import org.exoplatform.services.cms.templates.TemplateService;
   TemplateService tempService = uicomponent.getApplicationComponent(TemplateService.class);
   String path = tempService.getTemplatePath(true, "exo:podcast", "dialog1") ;

 %>
 
  <%
  _ctx.include(path);
  %>
*********************************************************************************

Can we add this info to the developer guide so that the other customers could benefit from it?

Comment 1 Jared MORGAN 2012-09-25 05:07:37 UTC
TRIAGE INFORMATION

Relevance: EPP 5.2 and EPP 6

Task:

Include the information provided by Gary in the Developer Guide for both versions.

Add as a new section to the Portal Development section, under the heading "Groovy"

http://documentation-devel.engineering.redhat.com/docs/en-US/JBoss_Enterprise_Portal_Platform/5.2/html-single/Developer_Guide/index.html#sid-8094155

Ensure you have access to:

http://svn.jboss.org/repos/gatein/epp/docs/branches/5.2 

and

http://svn.jboss.org/repos/gatein/epp/docs/branches/6.0/

to make changes to these guides.

Comment 2 Jared MORGAN 2012-09-25 05:09:17 UTC
Release Note required.

Comment 3 Petr Penicka 2012-11-15 15:52:25 UTC
The final fix is a bit different than what was proposed.

The info has been added to the Site Publisher User Guide [1]. This is because the information is specific to Site Publisher.

The info has been put generally as embedding of templates within one another rather than just about embedding of Groovy snippers. This is because the Groovy embedding is just one particular use case and the embedding itself had not been described anywhere in the docs.

The info has been added only to EPP 5.2 docs. It was not included in JPP6 docs as JPP6 will not be shipped with the Site Publisher extension.

[1] http://documentation-devel.engineering.redhat.com/docs/en-US/JBoss_Enterprise_Portal_Platform/5.2/html/Site_Publisher_User_Guide/sect-User_Guide-Content_Presentation_Manager-Manage_a_Template-Embedding.html


Note You need to log in before you can comment on or make changes to this bug.