You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 23 Next »

groovy: Security restricted macro is not allowed on this page. A page edit restriction is required that matches the macro authorization list.

import com.atlassian.confluence.pages.Page;
import bucket.container.ContainerManager;

def index = request.getSession(true).getServletContext().getAttribute("climb.index")

if (index == null )
{
out.println "Creating index..."

index = new Index()

String pageTitle="Climbing Guides"
//String pageTitle="Hobart Craglets"
Page page = ContainerManager.getComponent("pageManager").getPage(context.spaceKey,pageTitle);

addChildren(page, index)

request.getSession(true).getServletContext().setAttribute("climb.index", index)

// for (c in index.climbs)
// out.println c

}

def grades = ["17","18"]
def stars = ["***"]
def pages = ["Northern Buttress"]
def filtered = new ArrayList();
for (c in index.climbs)
{
if ( pages.contains(c.page) && grades.contains(c.grades) && stars(c.stars))
filtered.add c
}
for (c in filtered)
out.println c

def addChildren(Page page, Index index)
{
for (child in page.children)

Unknown macro: { doPage(child, index) }

}

def doPage (Page page, Index index)
{
int index1 = page.content.indexOf("

",index1+1)
String xml = page.content.substring(index1+7, index2)
out.println ("Page:" + page )

def x = new XmlParser().parseText(xml)
def climbs = x.climb

for (climb in climbs)

Unknown macro: { Climb c = new Climb( name}

}
addChildren(page, index)

}

class Index
{
List climbs = new ArrayList()
}

class Climb
{
String name
String grade
String stars
String length
//String extra
//String number
String page;

String toString()

Unknown macro: { return stars==null?""}

}

  • No labels