Foundry support for the ContentItem portlet

git-svn-id: https://svn.libreccm.org/ccm/trunk@2985 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-11-22 15:25:55 +00:00
parent aa4e8be107
commit 3c678af21f
4 changed files with 215 additions and 7 deletions

View File

@ -24,5 +24,6 @@
version="2.0">
<xsl:import href="portlets/freeform-html.xsl"/>
<xsl:import href="portlets/content-item.xsl"/>
</xsl:stylesheet>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE stylesheet [<!ENTITY nbsp '&#160;'>]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:foundry="http://foundry.libreccm.org"
xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
xmlns:cms="http://www.arsdigita.com/cms/1.0"
xmlns:nav="http://ccm.redhat.com/navigation"
xmlns:portal="http://www.uk.arsdigita.com/portal/1.0"
xmlns:portlet="http://www.uk.arsdigita.com/portlet/1.0"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="xsl xs bebop cms foundry nav portal portlet"
version="2.0">
<xsl:template match="bebop:portlet[@bebop:classname = 'com.arsdigita.cms.ui.portlet.ContentItemPortletRenderer']">
<xsl:call-template name="process-content-item-detail">
<xsl:with-param name="contentitem-tree">
<xsl:copy-of select="./portlet:contentItem/cms:item/*"/>
</xsl:with-param>
</xsl:call-template>
<!--<div>
<pre>
Content Item Portlet
</pre>
</div>-->
</xsl:template>
</xsl:stylesheet>

View File

@ -1,3 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE stylesheet [<!ENTITY nbsp '&#160;'>]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:foundry="http://foundry.libreccm.org"

View File

@ -107,7 +107,8 @@
</foundry:doc>
<xsl:template match="content-item[@mode = 'detail' or not(@mode)]">
<xsl:if test="$data-tree/cms:contentPanel or $data-tree/nav:greetingItem">
<xsl:variable name="contentitem-tree">
<xsl:call-template name="process-content-item-detail">
<xsl:with-param name="contentitem-tree">
<xsl:choose>
<xsl:when test="$data-tree/nav:greetingItem">
<xsl:copy-of select="$data-tree/nav:greetingItem/cms:item/*"/>
@ -116,11 +117,8 @@
<xsl:copy-of select="$data-tree/cms:contentPanel/cms:item/*"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="oid" select="$contentitem-tree/masterVersion/@oid"/>
<xsl:variable name="content-section">
</xsl:with-param>
<xsl:with-param name="content-section">
<xsl:choose>
<xsl:when test="$data-tree/nav:greetingItem">
<xsl:value-of select="$data-tree/nav:greetingItem/cms:pathInfo/cms:sectionPath"/>
@ -129,8 +127,185 @@
<xsl:value-of select="$data-tree/cms:contentPanel/cms:pathInfo/cms:sectionPath"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<!--<xsl:variable name="contentitem-tree">
<xsl:choose>
<xsl:when test="$data-tree/nav:greetingItem">
<xsl:copy-of select="$data-tree/nav:greetingItem/cms:item/*"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$data-tree/cms:contentPanel/cms:item/*"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>-->
<!--<xsl:variable name="oid" select="$contentitem-tree/masterVersion/@oid"/>-->
<!--<xsl:variable name="content-section">
<xsl:choose>
<xsl:when test="$data-tree/nav:greetingItem">
<xsl:value-of select="$data-tree/nav:greetingItem/cms:pathInfo/cms:sectionPath"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$data-tree/cms:contentPanel/cms:pathInfo/cms:sectionPath"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>-->
<!--<xsl:variable name="category" select="foundry:read-current-category()"/>
<xsl:variable name="content-type" select="$contentitem-tree/objectType"/>
<xsl:variable name="template-map">
<xsl:copy-of select="document(foundry:gen-path('conf/templates.xml'))/templates/content-items/detail/*"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$template-map/content-item[@oid = $oid]">
<xsl:message>
<xsl:value-of select="foundry:message-info('Found template for this special item.')"/>
</xsl:message>
<xsl:call-template name="foundry:process-contentitem-template">
<xsl:with-param name="template-file"
select="$template-map/content-item[@oid = $oid]"/>
<xsl:with-param name="contentitem-tree"
select="$contentitem-tree"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$template-map/content-item[@content-section = $content-section
and @category = $category
and @content-type = $content-type]">
<xsl:call-template name="foundry:process-contentitem-template">
<xsl:with-param name="template-file"
select="$template-map/content-item[@content-section = $content-section
and @category = $category
and @content-type = $content-type]"/>
<xsl:with-param name="contentitem-tree"
select="$contentitem-tree"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$template-map/content-item[@content-section = $content-section
and @category = $category
and not(@content-type)]">
<xsl:call-template name="foundry:process-contentitem-template">
<xsl:with-param name="template-file"
select="$template-map/content-item[@content-section = $content-section
and @category = $category
and not(@content-type)]"/>
<xsl:with-param name="contentitem-tree"
select="$contentitem-tree"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$template-map/content-item[@content-section = $content-section
and not(@category)
and @content-type = $content-type]">
<xsl:call-template name="foundry:process-contentitem-template">
<xsl:with-param name="template-file"
select="$template-map/content-item[@content-section = $content-section
and not(@category)
and @content-type = $content-type]"/>
<xsl:with-param name="contentitem-tree"
select="$contentitem-tree"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$template-map/content-item[@content-section = $content-section
and not(@category)
and not(@content-type)]">
<xsl:call-template name="foundry:process-contentitem-template">
<xsl:with-param name="template-file"
select="$template-map/content-item[@content-section = $content-section
and not(@category)
and not(@content-type)]"/>
<xsl:with-param name="contentitem-tree"
select="$contentitem-tree"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$template-map/content-item[not(@content-section)
and @category = $category
and @content-type = $content-type]">
<xsl:call-template name="foundry:process-contentitem-template">
<xsl:with-param name="template-file"
select="$template-map/content-item[not(@content-section)
and @category = $category
and @content-type = $content-type]"/>
<xsl:with-param name="contentitem-tree"
select="$contentitem-tree"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$template-map/content-item[not(@content-section)
and @category = $category
and not(@content-type)]">
<xsl:call-template name="foundry:process-contentitem-template">
<xsl:with-param name="template-file"
select="$template-map/content-item[not(@content-section)
and @category = $category
and not(@content-type)]"/>
<xsl:with-param name="contentitem-tree"
select="$contentitem-tree"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$template-map/content-item[not(@content-section)
and not(@category)
and @content-type = $content-type]">
<xsl:call-template name="foundry:process-contentitem-template">
<xsl:with-param name="template-file"
select="$template-map/content-item[not(@content-section)
and not(@category)
and @content-type = $content-type]"/>
<xsl:with-param name="contentitem-tree"
select="$contentitem-tree"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$template-map/default">
<xsl:message>
<xsl:value-of select="foundry:message-info('No template for item found. Using default')"/>
</xsl:message>
<xsl:call-template name="foundry:process-contentitem-template">
<xsl:with-param name="template-file"
select="$template-map/default"/>
<xsl:with-param name="contentitem-tree"
select="$contentitem-tree"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:value-of select="foundry:message-info('No template for item found and not default configured. Using internal default')"/>
</xsl:message>
<xsl:call-template name="foundry:process-contentitem-template">
<xsl:with-param name="template-file"
select="'contentitem-default-detail.xml'"/>
<xsl:with-param name="contentitem-tree"
select="$contentitem-tree"/>
<xsl:with-param name="internal"
select="true()"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>-->
</xsl:if>
</xsl:template>
<xsl:template name="process-content-item-detail">
<xsl:param name="contentitem-tree"/>
<xsl:param name="content-section" select="''"/>
<xsl:variable name="oid" select="$contentitem-tree/masterVersion/@oid"/>
<xsl:variable name="category" select="foundry:read-current-category()"/>
<xsl:variable name="content-type" select="$contentitem-tree/objectType"/>
@ -272,7 +447,6 @@
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<foundry:doc section="user" type="template-tag">