stk: improve templates (MGNLSTK-919)

[MGNLSTK-924] stk: improve templates: teaser's link list should be optional areas having their own title Created: 27/Feb/12  Updated: 22/Mar/12  Resolved: 27/Feb/12

Status: Closed
Project: Magnolia Standard Templating Kit (closed)
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0

Type: Sub-task Priority: Major
Reporter: Philipp Bärfuss Assignee: Philipp Bärfuss
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:

 Comments   
Comment by Philipp Bärfuss [ 27/Feb/12 ]

Script for the content migration:

import java.beans.PropertyChangeEvent;

import javax.jcr.Property
import javax.jcr.Session;
import javax.jcr.Node;


import info.magnolia.context.MgnlContext;
import info.magnolia.jcr.util.NodeUtil;


class LinkList {

    static main(args) {
        Session session = MgnlContext.getJCRSession("website");
        NodeUtil.getNodes(session.rootNode, "mgnl:page").each{process(it)}
        session.save()
    }

    static process(Node node){
        println (node.path)
        if(node.hasProperty("hasLinkList")){
            node.getProperty("hasLinkList").remove()
        }
        if(node.hasProperty("linkListTitle")){
            Property property = node.getProperty("linkListTitle")
            Node area;
            if(!node.hasNode("linkList"))
                area = node.addNode("linkList", "mgnl:area")
            else
                area = node.getNode("linkList")
            area.setProperty("title", property.getString())
            property.remove()
        }
        node.getNodes().each{process(it)}
    }

}
Generated at Mon Feb 12 07:31:42 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.