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

Compare with Current View Page History

« Previous Version 28 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 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>
</td>
<td>
</td>
<td><select multiple='true' size='20' name='climb.area' >'''

for (a in index.pages)

Unknown macro: { out.println "<option value='" + a + "'>" + a + "</option>"} out.println '''</select></td></tr></table>{html}

'''

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
}
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 = []
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