Error formatting macro: groovy: java.lang.NoClassDefFoundError: com/opensymphony/webwork/ServletActionContext

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

def index = 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) }

def totalStars = ["","*","**","***"]
def totalGrades = ["6","7","8","9","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 totalSorts = ["grade,stars,name","name","none"]

def sortBy = "grade,stars,name"
def grades = totalGrades //["17","18"]
def stars = ["***"]
def pages = ["Far North","Northern Buttress","Rockaway and Amphitheatre","The Columns","Flange Buttress","Central Buttress","Great Tier","Step Tier","Teardrop Gully","Avalanche Couloir","University Buttress","Bulging Buttress","Broken Buttress","Lost World Area","Sphinx Rock","Ferntree","Other Crags"]

def nameStartsWith = ""
def nameContains = ""
def faContains = ""

if (request.getParameter("climb.search") != null )

Unknown macro: { stars = toList( request.getParameterValues("climb.stars") ) grades = toList( request.getParameterValues("climb.grades") ) sortBy = request.getParameter("climb.sortBy") nameStartsWith = request.getParameter("climb.nameStartsWith") nameContains = request.getParameter("climb.nameContains") pages = toList( request.getParameterValues("climb.pages") ) }

if (nameContains != null && nameContains.startsWith("fa "))

Unknown macro: { faContains = nameContains.replace("fa ", "") nameContains = "" }

out.println '''

Search Criteria

Climb Search

This page lets you search the thesarvo guides by stars, grade, area etc. The criteria below all have to be satisfied, so you probably want to widen the criteria. The default search below shows the tick list of all the 3 star climbs on Mt Wellington. Use a Ctrl-click to select multiple values for stars, grade and area.

Stars

Name Starts With

Name Contains

Grade

Area

Sort By

\\\\
'''

def filtered = new ArrayList();
for (c in index.climbs)
{
if ( pages.contains(c.page) && grades.contains(c.grade==null ? "" : c.grade.trim() ) && stars.contains(c.stars) )
{
if (nameContains==null || nameContains.length()==0 || c.name.toLowerCase().contains(nameContains.toLowerCase()) )
{

def fa = c.fa ?: ""
if (faContains==null || faContains.length()==0 || fa.toLowerCase().contains(faContains.toLowerCase()) )
{

if (nameStartsWith==null || nameStartsWith.length()==0 || c.name.toLowerCase().startsWith(nameStartsWith.toLowerCase()) )
{
if (grades==null || grades.size()==0)
filtered.add c
else
for (g in grades)
if (c.grade!=null && c.grade.trim().startsWith(g) )

Unknown macro: { filtered.add c break; }

}
}
}

}
}

if (sortBy!=null && !sortBy.equals("none"))
{
def compare = [ compare:

Unknown macro: {a,b-> a.name.toLowerCase().trim().compareTo(b.name.toLowerCase().trim()) }

] as Comparator

if (sortBy.equals(totalSorts[0]))
{
compare = [ compare:

Unknown macro: {a,b-> a.getGradeSort().compareTo(b.getGradeSort() ) }

] as Comparator
}
//out.println "sorting"
filtered.sort compare
}

out.println "h2. Results"
out.print filtered.size + " results"
if (filtered.size > 600)

Unknown macro: { out.println ", 600 shown" filtered = filtered.subList(0,600) }

else
out.println ""

out.println "|| || Stars || Name || Length || Grade || Area ||"
for (c in filtered)

Unknown macro: { def s = c.stars if (s.length() > 0) s = "\" + s out.print "| !check.jpg! | " // !http}

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

Unknown macro: { doPage(child, index) }

}

def doPage (Page page, Index index)
{
out.println "Processing " + page.title

int index1 = page.bodyAsString.indexOf("<guide")

if (index1 > -1)
{
int index2 = page.bodyAsString.indexOf("</guide>",index1+1)
String xml = page.bodyAsString.substring(index1, index2+8)
//out.println ("Page:" + page )

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

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

for (climb in climbs)

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

}
addChildren(page, index)

}

def List toList

Unknown macro: { def ret = [] for (c in x) ret.add c return ret }

class Index

Unknown macro: { List climbs = [] List pages = [] }

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

public String getGradeSort()

Unknown macro: { return grade.trim() + stars.trim() + name.toLowerCase().trim() }

String toString()

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

}

  • No labels