Foundry: Refactored Portlet processing to fit better into the other parts of Foundry

git-svn-id: https://svn.libreccm.org/ccm/trunk@2988 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-11-24 10:09:27 +00:00
parent 4dbf93f31d
commit 4ac9cd2d85
13 changed files with 235 additions and 62 deletions

View File

@ -45,4 +45,19 @@
<default>content-items/list-default.xml</default> <default>content-items/list-default.xml</default>
</list> </list>
</content-items> </content-items>
<portlets>
<portlet class="com.arsdigita.cms.ui.portlet.ContentItemPortletRenderer">
portlets/contentitem.xml
</portlet>
<portlet class="com.arsdigita.navigation.ui.portlet.ItemListPortletRenderer">
portlets/item-list.xml
</portlet>
<portlet class="com.arsdigita.portalworkspace.ui.portlet.FreeformHTMLPortletRenderer">
portlets/freeform-html.xml
</portlet>
<!--<default>
</default>-->
</portlets>
</templates> </templates>

View File

@ -1,31 +0,0 @@
<?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,21 +0,0 @@
<?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: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 foundry nav portal portlet"
version="2.0">
<xsl:template match="bebop:portlet[@bebop:classname = 'com.arsdigita.portalworkspace.ui.portlet.FreeformHTMLPortletRenderer']">
<div class="portlet portlet-freeform-html">
<xsl:value-of disable-output-escaping="yes" select="./*"/>
</div>
</xsl:template>
</xsl:stylesheet>

View File

@ -34,6 +34,7 @@
<xsl:import href="template-tags/object-list.xsl"/> <xsl:import href="template-tags/object-list.xsl"/>
<xsl:import href="template-tags/portal-workspace.xsl"/> <xsl:import href="template-tags/portal-workspace.xsl"/>
<xsl:import href="template-tags/portal-workspace-grid.xsl"/> <xsl:import href="template-tags/portal-workspace-grid.xsl"/>
<xsl:import href="template-tags/portlets.xsl"/>
<xsl:import href="template-tags/subsite.xsl"/> <xsl:import href="template-tags/subsite.xsl"/>
</xsl:stylesheet> </xsl:stylesheet>

View File

@ -68,7 +68,7 @@
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
<xsl:template match="object-list//object-list-item"> <xsl:template match="object-list//object-list-item" name="object-list-items">
<xsl:param name="object-list-datatree" tunnel="yes"/> <xsl:param name="object-list-datatree" tunnel="yes"/>
<!--<pre>Object-list-item</pre> <!--<pre>Object-list-item</pre>
@ -81,7 +81,9 @@
<pre> <pre>
<xsl:value-of select="concat('name(object-list-datatree/*[1]) = ', name($object-list-datatree/*[1]))"/> <xsl:value-of select="concat('name(object-list-datatree/*[1]) = ', name($object-list-datatree/*[1]))"/>
</pre> </pre>
</xsl:template>--> <pre>
<xsl:value-of select="concat('count(object-list-datatree/nav:objectList/nav:item = ', count($object-list-datatree/nav:objectList/nav:item))"/>
</pre>-->
<xsl:variable name="object-list-item-layouttree" select="current()"/> <xsl:variable name="object-list-item-layouttree" select="current()"/>

View File

@ -148,7 +148,49 @@
<xsl:template match="portal-grid-workspace-columns//portal-grid-workspace-column//portal-grid-workspace-column-portlets"> <xsl:template match="portal-grid-workspace-columns//portal-grid-workspace-column//portal-grid-workspace-column-portlets">
<xsl:param name="column-portlets" tunnel="yes"/> <xsl:param name="column-portlets" tunnel="yes"/>
<xsl:apply-templates select="$column-portlets"/> <xsl:variable name="workspace"
select="$data-tree/portal:gridWorkspace/portal:workspaceDetails/primaryURL"/>
<xsl:variable name="template-map">
<xsl:copy-of select="document(foundry:gen-path('conf/templates.xml'))/templates/portlets/*"/>
</xsl:variable>
<!--<xsl:apply-templates select="$column-portlets"/>-->
<xsl:for-each select="$column-portlets">
<xsl:variable name="classname">
<xsl:value-of select="./@bebop:classname"/>
</xsl:variable>
<!--<pre>
<xsl:value-of select="concat('portlet-class = ', ./@bebop:classname)"/>
</pre>
<pre>
<xsl:value-of select="concat('in workspace = ', $workspace)"/>
</pre>
<pre>
<xsl:value-of select="count($template-map/portlet[@class=$classname])"/>
</pre>-->
<xsl:choose>
<xsl:when test="$template-map/portlet[@class=$classname and @workspace = $workspace]">
<xsl:apply-templates select="document(foundry:gen-path(concat('templates/', normalize-space($template-map/portlet[@class=$classname and @workspace=$workspace]))))/*">
<xsl:with-param name="portlet-data-tree" tunnel="yes" select="current()"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$template-map/portlet[@class=$classname]">
<xsl:apply-templates select="document(foundry:gen-path(concat('templates/', normalize-space($template-map/portlet[@class=$classname]))))/*">
<xsl:with-param name="portlet-data-tree" tunnel="yes" select="current()"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$template-map/default">
<xsl:apply-templates select="document(foundry:gen-path(concat('templates/', normalize-space($template-map/default))))/*">
<xsl:with-param name="portlet-data-tree" tunnel="yes" select="current()"/>
</xsl:apply-templates>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2014 Jens Pelzetter for the LibreCCM Foundation
This file is part of the Foundry Theme Engine for LibreCCM
Foundry is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Foundry is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foundry If not, see <http://www.gnu.org/licenses/>.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
xmlns:cms="http://www.arsdigita.com/cms/1.0"
xmlns:foundry="http://foundry.libreccm.org"
xmlns:nav="http://ccm.redhat.com/navigation"
xmlns:ui="http://www.arsdigita.com/ui/1.0"
exclude-result-prefixes="xsl xs bebop cms foundry nav ui"
version="2.0">
<xsl:import href="portlets/contentitem.xsl"/>
<xsl:import href="portlets/freeform-html.xsl"/>
<xsl:import href="portlets/item-list.xsl"/>
</xsl:stylesheet>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE stylesheet>
<!--
Copyright 2014 Jens Pelzetter for the LibreCCM Foundation
This file is part of the Foundry Theme Engine for LibreCCM
Foundry is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Foundry is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foundry If not, see <http://www.gnu.org/licenses/>.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cms="http://www.arsdigita.com/cms/1.0"
xmlns:portlet="http://www.uk.arsdigita.com/portlet/1.0"
exclude-result-prefixes="xsl cms portlet"
version="2.0">
<xsl:template match="portlet-layout//portlet-contentitem">
<xsl:param name="portlet-data-tree" tunnel="yes"/>
<xsl:call-template name="process-content-item-detail">
<xsl:with-param name="contentitem-tree">
<xsl:copy-of select="$portlet-data-tree/portlet:contentItem/cms:item/*"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

View File

@ -20,10 +20,14 @@
--> -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xsl" xmlns:portlet="http://www.uk.arsdigita.com/portlet/1.0"
exclude-result-prefixes="xsl portlet"
version="2.0"> version="2.0">
<xsl:import href="portlets/freeform-html.xsl"/> <xsl:template match="portlet-layout//portlet-freeform-html-content">
<xsl:import href="portlets/content-item.xsl"/> <xsl:param name="portlet-data-tree" tunnel="yes"/>
<xsl:value-of select="$portlet-data-tree" disable-output-escaping="yes"/>
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE stylesheet>
<!--
Copyright 2014 Jens Pelzetter for the LibreCCM Foundation
This file is part of the Foundry Theme Engine for LibreCCM
Foundry is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Foundry is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foundry If not, see <http://www.gnu.org/licenses/>.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cms="http://www.arsdigita.com/cms/1.0"
xmlns:nav="http://ccm.redhat.com/navigation"
exclude-result-prefixes="xsl cms nav"
version="2.0">
<xsl:template match="portlet-layout//portlet-item-list">
<!--<xsl:param name="portlet-data-tree" tunnel="yes"/>
<pre>
<xsl:value-of select="concat('count(*) = ', count($portlet-data-tree))"/>
</pre>
<pre>
<xsl:value-of select="concat('name[1] = ', name($portlet-data-tree))"/>
</pre>
<xsl:variable name="object-list-datatree">
<xsl:copy-of select="$portlet-data-tree"/>
</xsl:variable>
<xsl:apply-templates>
<xsl:with-param name="object-list-datatree" tunnel="yes" select="$portlet-data-tree"/>
</xsl:apply-templates>
-->
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="portlet-layout//portlet-item-list//object-list-item">
<xsl:param name="portlet-data-tree" tunnel="yes"/>
<xsl:call-template name="object-list-items">
<xsl:with-param name="object-list-datatree" select="$portlet-data-tree" tunnel="yes"/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<portlet-layout>
<portlet-contentitem/>
</portlet-layout>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<portlet-layout>
<div class="portlet portlet-freeform-html">
<portlet-freeform-html-content/>
</div>
</portlet-layout>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<portlet-layout>
<portlet-item-list>
<ul>
<object-list-item>
<li>
<content-item mode="list"/>
</li>
</object-list-item>
</ul>
</portlet-item-list>
</portlet-layout>