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

Compare with Current View Page History

« Previous Version 38 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 = null //request.getSession(true).getServletContext().getAttribute("climb.index")

if (index == null )

Unknown macro: { 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 totalStars = ["","*","**","***"]def totalGrades = ["10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","VE","V0","V1","V2","V3","V4","V5","V6","V7","V8","V9","V10","V11","V12","V13","V14","V15"]def grades = ["17","18" ]def stars = ["***"]def pages = ["Northern Buttress"] out.println '''h2. Search Criteria}

<table><tr>
<th>Stars</th>
<th>Grades</th>
<th>Areas</th>
</tr>
<tr>
<td><select multiple='true' name='climb.stars' >'''
for (a in totalStars)

Unknown macro: { out.println "<option " + (stars.contains(a)?"selected"}

'''

def filtered = new ArrayList();
for (c in index.climbs)
{
if ( pages.contains(c.page) && grades.contains(c.grade) && stars.contains(c.stars) )
filtered.add c
}
out.println "h2. Results"
out.println "|| || Stars || Climb || Length || Grade || Area ||"
for (c in filtered)
{
out.println "| □ |" + c.stars + "|" + c.name + "|" + c.length + "|" + c.grade + "| [" + c.page + "]|"
}

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

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

if (climbs.size() > 0)
index.pages.add page.title

for (climb in climbs)

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

}
addChildren(page, index)

}

class Index
{
List climbs = []
List pages = []
}

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