incorporating:
r1619 | chrisg23 | 2007-09-13 14:17:59 +0200 (Do, 13 Sep 2007) | 1 line Sourceforge patch 1793743 changes for aplaws users with config parameter com.arsdigita.cms.category_authoring_add_form=com.arsdigita.aplaws.ui.ItemCategoryPicker to allow categories to be sorted by sortkey or alphabetically - note if you have your own version of category-step.xsl in your theme you need to apply these changes to your theme file in order that tree nodes populated via Ajax are sorted as you expect git-svn-id: https://svn.libreccm.org/ccm/trunk@4 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
30e0ace8ee
commit
b11efee09a
|
|
@ -37,6 +37,7 @@ import com.arsdigita.xml.Element;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
|
|
||||||
import com.arsdigita.cms.CMS;
|
import com.arsdigita.cms.CMS;
|
||||||
|
import com.arsdigita.cms.ContentSection;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -159,6 +160,9 @@ public class TermWidget extends Widget {
|
||||||
if (sortKey != null) {
|
if (sortKey != null) {
|
||||||
el.addAttribute("sortKey", sortKey.toString());
|
el.addAttribute("sortKey", sortKey.toString());
|
||||||
}
|
}
|
||||||
|
// sort order attribute added to every node so that we can
|
||||||
|
// correctly transform xml fragments returned by ajax
|
||||||
|
el.addAttribute("order", ContentSection.getConfig().getCategoryTreeOrder());
|
||||||
|
|
||||||
StringBuffer path = new StringBuffer(parent.getAttribute("fullname"));
|
StringBuffer path = new StringBuffer(parent.getAttribute("fullname"));
|
||||||
if (path.length() > 0) path.append(" > ");
|
if (path.length() > 0) path.append(" > ");
|
||||||
|
|
@ -224,12 +228,13 @@ public class TermWidget extends Widget {
|
||||||
Element el = generateCategory(parent, root, ids, null);
|
Element el = generateCategory(parent, root, ids, null);
|
||||||
el.addAttribute("fullname", root.getName());
|
el.addAttribute("fullname", root.getName());
|
||||||
el.addAttribute("node-id", root.getID().toString());
|
el.addAttribute("node-id", root.getID().toString());
|
||||||
|
el.addAttribute("order", ContentSection.getConfig().getCategoryTreeOrder());
|
||||||
if (Aplaws.getAplawsConfig().ajaxExpandAllBranches()) {
|
if (Aplaws.getAplawsConfig().ajaxExpandAllBranches()) {
|
||||||
// recognisable attribute has to be in the XML for each snippet that is transformed,
|
// recognisable attribute has to be in the XML for each snippet that is transformed,
|
||||||
// hence add it to the parent
|
// hence add it to the parent
|
||||||
el.addAttribute("expand", "all" );
|
el.addAttribute("expand", "all" );
|
||||||
}
|
}
|
||||||
|
|
||||||
List roots = (List) children.get(root.getID());
|
List roots = (List) children.get(root.getID());
|
||||||
if (null != roots) {
|
if (null != roots) {
|
||||||
Iterator i = roots.iterator();
|
Iterator i = roots.iterator();
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,39 @@
|
||||||
<xsl:param name="theme-prefix" />
|
<xsl:param name="theme-prefix" />
|
||||||
|
|
||||||
<xsl:template match="cms:emptyPage[@title='childCategories']">
|
<xsl:template match="cms:emptyPage[@title='childCategories']">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="cms:category/@order='sortKey'">
|
||||||
<xsl:apply-templates select="cms:category/cms:category" mode="cms:javascriptCat">
|
<xsl:apply-templates select="cms:category/cms:category" mode="cms:javascriptCat">
|
||||||
<xsl:with-param name="expand" select="'none'"/>
|
<xsl:with-param name="expand" select="'none'"/>
|
||||||
|
<xsl:sort data-type="number" select="@sortKey"/>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:apply-templates select="cms:category/cms:category" mode="cms:javascriptCat">
|
||||||
|
<xsl:sort data-type="text" select="@name"/>
|
||||||
|
<xsl:with-param name="expand" select="'none'"/>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="cms:emptyPage[@title='autoCategories']">
|
<xsl:template match="cms:emptyPage[@title='autoCategories']">
|
||||||
<xsl:apply-templates select="cms:category" mode="cms:javascriptCat" />
|
<xsl:choose>
|
||||||
|
<xsl:when test="cms:category/@order='sortKey'">
|
||||||
|
<xsl:apply-templates select="cms:category" mode="cms:javascriptCat" >
|
||||||
|
<xsl:with-param name="expand" select="'none'"/>
|
||||||
|
<xsl:sort data-type="number" select="@sortKey"/>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:apply-templates select="cms:category" mode="cms:javascriptCat" >
|
||||||
|
<xsl:sort data-type="text" select="@name"/>
|
||||||
|
<xsl:with-param name="expand" select="'none'"/>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue