Author: ppenicka
Date: 2012-11-15 10:28:35 -0500 (Thu, 15 Nov 2012)
New Revision: 8963
Modified:
epp/docs/branches/5.2/Site_Publisher/User_Guide/en-US/Revision_History.xml
epp/docs/branches/5.2/Site_Publisher/User_Guide/en-US/images/manage_templates_form.png
epp/docs/branches/5.2/Site_Publisher/User_Guide/en-US/modules/Advanced/Administration/Presentation.xml
Log:
BZ#850880 - added information about embedding of view and dialog templates in Site
Publisher.
Modified: epp/docs/branches/5.2/Site_Publisher/User_Guide/en-US/Revision_History.xml
===================================================================
--- epp/docs/branches/5.2/Site_Publisher/User_Guide/en-US/Revision_History.xml 2012-11-15
01:10:18 UTC (rev 8962)
+++ epp/docs/branches/5.2/Site_Publisher/User_Guide/en-US/Revision_History.xml 2012-11-15
15:28:35 UTC (rev 8963)
@@ -7,6 +7,22 @@
<title>Revision History</title> <simpara>
<revhistory>
<revision>
+ <revnumber>5.2.2-101</revnumber>
+ <date>Wed Nov 15 2012</date>
+ <author>
+ <firstname>Petr</firstname>
+ <surname>Penicka</surname>
+ <email/>
+ </author>
+
+ <revdescription>
+ <simplelist>
+ <member>BZ#850880 - added information about embedding of view
and dialog templates in Site Publisher.</member>
+ </simplelist>
+ </revdescription>
+ </revision>
+
+ <revision>
<revnumber>5.2.2-100</revnumber> <date>Wed Sep 05
2012</date>
<author>
<firstname>Jared</firstname>
<surname>Morgan</surname> <email/>
@@ -18,7 +34,7 @@
</simplelist>
</revdescription>
</revision>
-
+
<revision>
<revnumber>5.2.1-101</revnumber> <date>Tue Apr 17
2012</date>
<author>
Modified:
epp/docs/branches/5.2/Site_Publisher/User_Guide/en-US/images/manage_templates_form.png
===================================================================
(Binary files differ)
Modified:
epp/docs/branches/5.2/Site_Publisher/User_Guide/en-US/modules/Advanced/Administration/Presentation.xml
===================================================================
---
epp/docs/branches/5.2/Site_Publisher/User_Guide/en-US/modules/Advanced/Administration/Presentation.xml 2012-11-15
01:10:18 UTC (rev 8962)
+++
epp/docs/branches/5.2/Site_Publisher/User_Guide/en-US/modules/Advanced/Administration/Presentation.xml 2012-11-15
15:28:35 UTC (rev 8963)
@@ -15,7 +15,7 @@
</para>
<para>
- The <emphasis>Template Management</emphasis> system allows users
to view, delete or modify the predefined templates or to add a new template.
+ The <guilabel>Manage Templates</guilabel> section allows users to
view, delete or modify the templates and create new templates.
</para>
<mediaobject>
@@ -63,7 +63,7 @@
<step
id="step-User_Guide-Add_a_New_Template-Assign_memberships_to_the_group">
<para>
- Select a group from the left panel and the membership from the right
panel. Alternatively you can set permission for everyone by clicking the icon next to
<guilabel>Any Permission</guilabel>
+ Select a group from the left panel and the membership from the right
panel. Alternatively you can set permission for everyone by clicking the icon next to
<guilabel>Any Permission</guilabel>.
</para>
<mediaobject>
@@ -171,7 +171,7 @@
<step>
<para>
- Click <guibutton>Save</guibutton> to accept all
changes in the Dialog tab.
+ Click <guibutton>Save</guibutton> to accept all
changes in the <guilabel>Dialog</guilabel> tab.
</para>
</step>
</substeps>
@@ -211,7 +211,7 @@
<substeps>
<step>
<para>
- Click the View tab and enter content into the content field.
+ Click the <guilabel>View</guilabel> tab and enter
content into the content field.
</para>
</step>
@@ -249,7 +249,7 @@
<step>
<para>
- Click <guibutton>Save</guibutton> to accept all
changes in the View tab.
+ Click <guibutton>Save</guibutton> to accept all
changes in the <guilabel>View</guilabel> tab.
</para>
</step>
</substeps>
@@ -266,20 +266,20 @@
</para>
<para>
- If the dialog has at least two versions, in the
<guilabel>View</guilabel> tab, it displays the
<guibutton>Restore</guibutton> button. You can use
<guibutton>Restore</guibutton> to roll back to the previous View.
+ If the dialog has at least two versions, in the
<guilabel>View</guilabel> tab, it displays the
<guibutton>Restore</guibutton> button. You can use
<guibutton>Restore</guibutton> to roll back to the previous
<guilabel>View</guilabel>.
</para>
</note>
</step>
<step performance="optional"
id="step-User_Guide-Edit_a_Template-Delete_an_existing_dialog_in_the_Dialog_tab">
<para>
- To delete an existing dialog, do the following:
+ To delete an existing view, do the following:
</para>
<substeps>
<step>
<para>
- Click the <guilabel>trash can</guilabel> icon in
the dialog row you want to edit.
+ Click the <guilabel>trash can</guilabel> icon in
the view row you want to delete.
</para>
</step>
@@ -297,7 +297,7 @@
</substeps>
</step>
</procedure>
-
+
<procedure
id="proc-User_Guide-Manage_a_Template-Delete_a_Template">
<title>Delete a Template</title>
@@ -313,7 +313,50 @@
</para>
</step>
</procedure>
+ <section id="portal_development-groovy">
+ <title>Embedding Template Code in Another Template</title>
+ <para>
+ The code of a template can be embedded in the code of another template. Using this
technique, you can avoid repetitive use of identical code in multiple templates. This
facilitates code maintenance as you only need to edit the code in one template for the
changes to be reflected in all templates where the code is embedded.
+ </para>
+ <para>
+ The embedding is performed by calling the
<literal>_ctx.include</literal> method in the code of a template. When the
template that contains the method call is displayed, the code of the embedded template is
inserted at the location of the method call.
+ </para>
+<programlisting language="Java">
+_ctx.include(TemplatePath);
+</programlisting>
+ <para>
+ The path to the template whose code shall be embedded must be provided in the
method's parameter. The value can be obtained dynamically as demonstrated in the
following code sample.
+ </para>
+<programlisting language="Java">
+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;
+}
+</programlisting>
+ <para>
+ To see practical examples of view template embedding, you can inspect some of the
default templates that come with your distribution of Site Publisher. For example, the
code extract below shows how the <systemitem>mix:votable</systemitem> and
<systemitem>exo:comments</systemitem> view templates are embedded at the
bottom of the <systemitem>exo:sample</systemitem> view template.
+ </para>
+<programlisting language="HTML">
+<![CDATA[<div><%
_ctx.include(uicomponent.getViewTemplate("mix:votable", "view1"));
%></div>
+<div><% _ctx.include(uicomponent.getViewTemplate("exo:comments",
"view1")); %></div>]]>
+</programlisting>
+ <para>
+ Embedding of dialog templates is not demonstrated in any of the default templates.
However, it can be achieved similarly to what is show above. For example, the following
code snippet can be copied and pasted into any dialog template to embed the
<systemitem>exo:podcast</systemitem> dialog template in its code.
+ </para>
+<programlisting language="HTML">
+<![CDATA[<%
+ import org.exoplatform.services.cms.templates.TemplateService;
+ TemplateService tempService =
uicomponent.getApplicationComponent(TemplateService.class);
+ String path = tempService.getTemplatePath(true, "exo:podcast",
"dialog1") ;
+%>
+
+<% _ctx.include(path); %>]]>
+</programlisting>
</section>
+ </section>
<section
id="sect-User_Guide-Content_Presentation_Manager-Metadata_Management">
<title>Metadata Management</title>
Show replies by date