Some changes for the CategorisedObjectList: Now the the items are sorted according to the sorting in the secondary category system.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2851 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-09-12 12:01:08 +00:00
parent c235738e2e
commit b4cd75d64f
3 changed files with 251 additions and 216 deletions

View File

@ -168,8 +168,8 @@ public class CategorisedDataCollectionRenderer extends CMSDataCollectionRenderer
object = (ACSObject) DomainObjectFactory.newInstance(dobj);
if (object == null) {
s_log.error(String.format(
"Failed to specialize object with with id %s. Skiping object.",
dobj.getOID().toString()));
"Failed to specialize object with with id %s. Skiping object.",
dobj.getOID().toString()));
continue;
} else {
s_log.debug("Specializing successful.");
@ -200,9 +200,9 @@ public class CategorisedDataCollectionRenderer extends CMSDataCollectionRenderer
section.addAttribute("id", cat.getID().toString());
section.addAttribute("url", cat.getURL());
section.addAttribute("title", cat.getName(GlobalizationHelper.
getNegotiatedLocale().getLanguage()));
getNegotiatedLocale().getLanguage()));
final DataAssociationCursor childCats = domain.getModel().getRelatedCategories(
Category.CHILD);
Category.CHILD);
childCats.addEqualsFilter("id", cat.getID());
if (childCats.next()) {
section.addAttribute("sortKey", childCats.get("link.sortKey").toString());
@ -220,14 +220,14 @@ public class CategorisedDataCollectionRenderer extends CMSDataCollectionRenderer
section.addAttribute("id", cat.getID().toString());
section.addAttribute("url", cat.getURL());
section.addAttribute("title", cat.getName(GlobalizationHelper.
getNegotiatedLocale().
getLanguage()));
getNegotiatedLocale().
getLanguage()));
final DataAssociationCursor childCats = domain.getModel().
getRelatedCategories(Category.CHILD);
getRelatedCategories(Category.CHILD);
childCats.addEqualsFilter("id", cat.getID());
if (childCats.next()) {
section.
addAttribute("sortKey", childCats.get("link.sortKey").toString());
addAttribute("sortKey", childCats.get("link.sortKey").toString());
}
childCats.close();
currentSection = section;
@ -253,14 +253,19 @@ public class CategorisedDataCollectionRenderer extends CMSDataCollectionRenderer
final Iterator properties = getProperties().iterator();
while (properties.hasNext()) {
final DataCollectionPropertyRenderer property = (DataCollectionPropertyRenderer) properties.
next();
final DataCollectionPropertyRenderer property
= (DataCollectionPropertyRenderer) properties.
next();
property.render(objects, item);
}
final Element path = Navigation.newElement(item, "path");
path.setText(getStableURL(dobj, object));
//item.addContent(path);
if (currentCat != null
&& currentCat.getSortKey(categorisedObj) != null) {
item.addAttribute("sortKey", currentCat.getSortKey(categorisedObj).toString());
}
generateItemXML(item, dobj, object, index);

View File

@ -26,18 +26,45 @@
xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
version="1.0">
<xsl:output method="html"
indent="yes"
encoding="utf-8"/>
<xsl:import href="lib.xsl"/>
<xsl:output method="html"
indent="yes"
encoding="utf-8"/>
<xsl:template match="bebop:page">
<div>
<xsl:variable name="application">
<xsl:choose>
<xsl:when test="./@application">
<xsl:value-of select="./@application"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'none'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="class" select="@class" />
<xsl:choose>
<xsl:when test="document(concat($theme-prefix, '/settings/templates.xml'))/applications/application[@name=$application and @class=$class]">
<xsl:call-template name="foundry:parse-template">
<xsl:with-param name="template-file"
select="document(concat($theme-prefix, '/settings/templates.xml'))/applications/application[@name=$application and @class=$class]"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="foundry:process-template">
<xsl:with-param name="template-file"
select="document(concat($theme-prefix, '/settings/templates.xml'))/applications/default"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<!--<div>
<h1>Hello from Foundry</h1>
</div>
</div>-->
</xsl:template>

View File

@ -31,208 +31,211 @@
<!-- Autor: Sören Bernstein -->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
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:mandalay="http://mandalay.quasiweb.de"
exclude-result-prefixes="xsl bebop cms nav mandalay"
version="1.0">
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
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:mandalay="http://mandalay.quasiweb.de"
exclude-result-prefixes="xsl bebop cms nav mandalay"
version="1.0">
<xsl:template match="nav:simpleObjectList | nav:complexObjectList | nav:customizableObjectList" name="mandalay:objectList">
<xsl:param name="layoutTree"/>
<xsl:template match="nav:simpleObjectList | nav:complexObjectList | nav:customizableObjectList" name="mandalay:objectList">
<xsl:param name="layoutTree"/>
<!-- DE Hole alle benötigten Einstellungen-->
<!-- EN Getting all needed setting-->
<xsl:variable name="setHeading">
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="node" select="$layoutTree/setHeading"/>
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="setting" select="concat(@id, '/setHeading')"/>
<xsl:with-param name="default" select="'true'"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="nav:objectList/nav:item and $setHeading='true'">
<h2>
<xsl:call-template name="mandalay:getStaticText">
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="id" select="concat(@id, '/heading')"/>
</xsl:call-template>
</h2>
</xsl:if>
<xsl:if test="name() = 'nav:customizableObjectList'">
<!-- <xsl:call-template name="mandalay:customizableObjectList"/>-->
<xsl:for-each select="./filterControls">
<xsl:call-template name="mandalay:filterControls"/>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template match="nav:atozObjectList" name="mandalay:atozObjectList">
<xsl:param name="layoutTree"/>
<!-- DE Hole alle benötigten Einstellungen-->
<!-- EN Getting all needed setting-->
<xsl:variable name="setHeading">
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="node" select="$layoutTree/setHeading"/>
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="setting" select="concat(@id, '/setHeading')"/>
<xsl:with-param name="default" select="'true'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="separator">
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="node" select="$layoutTree/separator"/>
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="setting" select="concat(@id, '/separator')"/>
<xsl:with-param name="default" select="' | '"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="setInfoLine">
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="node" select="$layoutTree/setInfoLine"/>
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="setting" select="concat(@id, '/atoz/setInfoLine')"/>
<xsl:with-param name="default" select="'true'"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$setHeading='true'">
<h2>
<xsl:call-template name="mandalay:getStaticText">
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="id" select="concat(@id, '/atoz/heading')"/>
</xsl:call-template>
</h2>
</xsl:if>
<!-- Die Auswahlliste erzeugen -->
<div id="atozArea">
<div id="atozSelector">
<xsl:for-each select="nav:letters/nav:letter">
<xsl:choose>
<xsl:when test="@selected='1'">
<span class="letterSelected">
<xsl:choose>
<xsl:when test="@letter = 'any'">
<xsl:call-template name="mandalay:getStaticText">
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="id" select="concat(../../@id, '/atoz/any')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@letter" />
</xsl:otherwise>
</xsl:choose>
</span>
</xsl:when>
<xsl:otherwise>
<a>
<xsl:attribute name="href">
<xsl:value-of select="@url"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="@letter = 'any'">
<xsl:call-template name="mandalay:getStaticText">
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="id" select="concat(../../@id, '/atoz/any')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@letter" />
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:otherwise>
</xsl:choose>
<!-- Separator -->
<xsl:if test="not(position()=last())">
<xsl:value-of select="$separator"/>
</xsl:if>
</xsl:for-each>
</div>
<xsl:if test="$setInfoLine='true'">
<div id="atozInfo">
<xsl:call-template name="mandalay:getStaticText">
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="id" select="concat(@id, '/atoz/infoLine')"/>
</xsl:call-template>
<span class="letterSelected">
<xsl:choose>
<xsl:when test="nav:letters/nav:letter[@selected='1']/@letter = 'any'">
<xsl:call-template name="mandalay:getStaticText">
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="id" select="concat(@id, '/atoz/any')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="nav:letters/nav:letter[@selected='1']/@letter" />
</xsl:otherwise>
</xsl:choose>
</span>
</div>
</xsl:if>
</div>
</xsl:template>
<!-- DE Verarbeite die ObjectList -->
<xsl:template match="nav:objectList">
<xsl:variable name="useEditLinks">
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="setting" select="'useEditLinks'"/>
<xsl:with-param name="default" select="'true'"/>
</xsl:call-template>
</xsl:variable>
<ul>
<xsl:if test="../@customName">
<xsl:attribute name="class">
<xsl:value-of select="../@customName"/>
</xsl:attribute>
</xsl:if>
<xsl:for-each select="nav:section">
<xsl:sort select="./@sortKey" data-type="number"/>
<li>
<h2><xsl:value-of select="./@title"/></h2>
<ul>
<xsl:for-each select="nav:item">
<li>
<xsl:apply-templates select="." mode="list_view" />
<div class="endFloat"/>
</li>
</xsl:for-each>
</ul>
</li>
</xsl:for-each>
<xsl:for-each select="nav:item">
<li>
<!-- DE Ruft die Templates aus den ContentTypen auf (Listenansicht) -->
<!-- EN Calling template from contenttype (listview) -->
<xsl:apply-templates select="." mode="list_view"/>
<xsl:if test="($useEditLinks = 'true') and ./editLink">
<xsl:call-template name="mandalay:itemEditLink">
<xsl:with-param name="editUrl" select="./editLink"/>
<xsl:with-param name="itemTitle" select="./title"/>
<!-- DE Hole alle benötigten Einstellungen-->
<!-- EN Getting all needed setting-->
<xsl:variable name="setHeading">
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="node" select="$layoutTree/setHeading"/>
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="setting" select="concat(@id, '/setHeading')"/>
<xsl:with-param name="default" select="'true'"/>
</xsl:call-template>
</xsl:if>
<div class="endFloat"/>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:variable>
<xsl:if test="nav:objectList/nav:item and $setHeading='true'">
<h2>
<xsl:call-template name="mandalay:getStaticText">
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="id" select="concat(@id, '/heading')"/>
</xsl:call-template>
</h2>
</xsl:if>
<xsl:if test="name() = 'nav:customizableObjectList'">
<!-- <xsl:call-template name="mandalay:customizableObjectList"/>-->
<xsl:for-each select="./filterControls">
<xsl:call-template name="mandalay:filterControls"/>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template match="nav:atozObjectList" name="mandalay:atozObjectList">
<xsl:param name="layoutTree"/>
<!-- DE Hole alle benötigten Einstellungen-->
<!-- EN Getting all needed setting-->
<xsl:variable name="setHeading">
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="node" select="$layoutTree/setHeading"/>
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="setting" select="concat(@id, '/setHeading')"/>
<xsl:with-param name="default" select="'true'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="separator">
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="node" select="$layoutTree/separator"/>
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="setting" select="concat(@id, '/separator')"/>
<xsl:with-param name="default" select="' | '"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="setInfoLine">
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="node" select="$layoutTree/setInfoLine"/>
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="setting" select="concat(@id, '/atoz/setInfoLine')"/>
<xsl:with-param name="default" select="'true'"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$setHeading='true'">
<h2>
<xsl:call-template name="mandalay:getStaticText">
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="id" select="concat(@id, '/atoz/heading')"/>
</xsl:call-template>
</h2>
</xsl:if>
<!-- Die Auswahlliste erzeugen -->
<div id="atozArea">
<div id="atozSelector">
<xsl:for-each select="nav:letters/nav:letter">
<xsl:choose>
<xsl:when test="@selected='1'">
<span class="letterSelected">
<xsl:choose>
<xsl:when test="@letter = 'any'">
<xsl:call-template name="mandalay:getStaticText">
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="id" select="concat(../../@id, '/atoz/any')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@letter" />
</xsl:otherwise>
</xsl:choose>
</span>
</xsl:when>
<xsl:otherwise>
<a>
<xsl:attribute name="href">
<xsl:value-of select="@url"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="@letter = 'any'">
<xsl:call-template name="mandalay:getStaticText">
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="id" select="concat(../../@id, '/atoz/any')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@letter" />
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:otherwise>
</xsl:choose>
<!-- Separator -->
<xsl:if test="not(position()=last())">
<xsl:value-of select="$separator"/>
</xsl:if>
</xsl:for-each>
</div>
<xsl:if test="$setInfoLine='true'">
<div id="atozInfo">
<xsl:call-template name="mandalay:getStaticText">
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="id" select="concat(@id, '/atoz/infoLine')"/>
</xsl:call-template>
<span class="letterSelected">
<xsl:choose>
<xsl:when test="nav:letters/nav:letter[@selected='1']/@letter = 'any'">
<xsl:call-template name="mandalay:getStaticText">
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="id" select="concat(@id, '/atoz/any')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="nav:letters/nav:letter[@selected='1']/@letter" />
</xsl:otherwise>
</xsl:choose>
</span>
</div>
</xsl:if>
</div>
</xsl:template>
<!-- DE Verarbeite die ObjectList -->
<xsl:template match="nav:objectList">
<xsl:variable name="useEditLinks">
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="module" select="'objectList'"/>
<xsl:with-param name="setting" select="'useEditLinks'"/>
<xsl:with-param name="default" select="'true'"/>
</xsl:call-template>
</xsl:variable>
<ul>
<xsl:if test="../@customName">
<xsl:attribute name="class">
<xsl:value-of select="../@customName"/>
</xsl:attribute>
</xsl:if>
<xsl:for-each select="nav:section">
<xsl:sort select="./@sortKey" data-type="number"/>
<li>
<h2>
<xsl:value-of select="./@title"/>
</h2>
<ul>
<xsl:for-each select="nav:item">
<xsl:sort select="./@sortKey"/>
<li>
<xsl:apply-templates select="." mode="list_view" />
<div class="endFloat"/>
</li>
</xsl:for-each>
</ul>
</li>
</xsl:for-each>
<xsl:for-each select="nav:item">
<li>
<!-- DE Ruft die Templates aus den ContentTypen auf (Listenansicht) -->
<!-- EN Calling template from contenttype (listview) -->
<xsl:apply-templates select="." mode="list_view"/>
<xsl:if test="($useEditLinks = 'true') and ./editLink">
<xsl:call-template name="mandalay:itemEditLink">
<xsl:with-param name="editUrl" select="./editLink"/>
<xsl:with-param name="itemTitle" select="./title"/>
</xsl:call-template>
</xsl:if>
<div class="endFloat"/>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>