Schedule & Results

Thu Aug 22
There was a problem with a Velocity script
Pagescoreboard-slider-template
ErrorInvocation of method 'substring' in class java.lang.String threw exception java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at scoreboard-slider-template[line 205, column 29]
Page source:
1: #set ($id = "scoreboard-slider")
2: #if ($request.getParameter("id"))
3:   #set ($idParam = $request.getParameter("id"))
4:   #set ($id = "${id} ${idParam}")
5: #end
6: 
7: ## PICK UP OPTIONS
8: $website.include("options")
9: #set ($options = $request.getAttribute("options"))
10: 
11: #set ($hideExhibition = false)
12: #if ($options.get("schedule_hide_exhibition_events") == true)
13:   #set ($hideExhibition = true)
14: #end
15: 
16: #if ($request.getParameter("hideExhibition"))
17:   #set ($hideExhibition = $request.getParameter("hideExhibition"))
18: #end
19: 
20: #set ($linksOrder = ["RC", "BS", "RE", "GA", "AU", "VI", "LS", "DI", "TI", "PR"])
21: #set ($excludeLinksWhenEventIsFinished = ["LS", "DI", "TI", "PR"])
22: #set ($excludeLinksWhenEventIsLive = ["DI", "TI", "PR"])
23: 
24: #set ($showVsAt = true)
25: #if ($options.get("schedule_hide_vs_at") == true)
26:   #set ($showVsAt = false)
27: #end
28: 
29: #set ($includeTimeZone = false)
30: #if ($options.get("calendarIncludeTimeZone"))
31:   #set ($includeTimeZone = $options.get("calendarIncludeTimeZone").toLowerCase())
32: #end
33: 
34: #set ($showTeamLogo = false)
35: #if ($request.getParameter("showTeamLogo") == true)
36:   #set ($showTeamLogo = true)
37: #end
38: 
39: #set ($showJustOpponent = false)
40: #if ($request.getParameter("showJustOpponent") == true)
41:   #set ($showJustOpponent = true)
42: #end
43: 
44: #set ($resultFormat = "AP1")
45: #if ($options.get("schedule_result_format").equals("L, 1-2"))
46:   #set ($resultFormat = "AP2")
47: #end
48: 
49: #set ($dateFormat = "'<span>'EEE'</span> <span>'MMM'</span> <span>'dd'</span>'")
50: #if ($request.getParameter("dateFormat"))
51:   #set ($dateFormat = $request.getParameter("dateFormat"))
52: #end
53: 
54: #set ($restrictLinks = true)
55: #if ($options.get("schedule_restrict_links") == false)
56:   #set ($restrictLinks = false)
57: #end
58: 
59: #set ($linksAbbreviations = { "Preview": "PR", "Box Score": "BX", "Results": "R", "Recap": "RC", "Live stats": "LS", "Video": "V", "Audio": "A", "Photos": "PH", "Tickets": "T", "Directions": "DR" })
60: 
61: #set ($showLinkIcons = false)
62: #if ($request.getParameter("showLinkIcons") == true)
63:   #set ($showLinkIcons = true)
64: #end
65: 
66: #set ($abbreviatedLinks = false)
67: #if ($request.getParameter("abbreviatedLinks") == true)
68:   #set ($abbreviatedLinks = true)
69: #end
70: 
71: #set ($autoScroll = false)
72: #if ($request.getParameter("autoScroll") == true)
73:   #set ($autoScroll = true)
74: #end
75: 
76: #set ($showNavi = false)
77: #if ($request.getParameter("showNavi") == true)
78:   #set ($showNavi = true)
79: #end
80: 
81: #set ($autoInterval = 4000)
82: #if ($tool.math.toInteger($request.getParameter("autoInterval")) > 0)
83:   #set ($autoInterval = $tool.math.mul($request.getParameter("autoInterval", 1000)))
84: #end
85: 
86: #set ($circularScroll = false)
87: #if ($request.getParameter("circularScroll") == true)
88:   #set ($circularScroll = true)
89: #end
90: 
91: #set ($colLimit = 5)
92: #if ($tool.math.toInteger($request.getParameter("colLimit")))
93:   #set ($colLimit = $tool.math.toInteger($request.getParameter("colLimit")))
94: #end
95: 
96: #set ($showPlayPause = false)
97: #if ($request.getParameter("showPlayPause") == true)
98: 	#set ($showPlayPause = true)
99: #end
100: 
101: #set ($fullSchedulePos = "bottom")
102: #set ($fullSchedulePos = $request.getParameter("fullSchedulePos"))
103: 
104: #set ($today = $now)
105: 
106: #set ($slickSlider = false)
107: #if ($request.getParameter("slickSlider") == true)
108:   #set ($slickSlider = true)
109: #end
110: 
111: ################################ MACROS #####################################
112: #macro (printTeamLogo $team)
113:   #if ($showTeamLogo)
114:     #if ($team.teamId)
115:       <span class="team-logo"><img src="${website.teamLogo($team.teamId)}" alt="" /></span>
116:     #end
117:   #end
118: #end
119: 
120: #macro (printVa $event $count)
121:     #if ($event.teams.size() == 1)
122:         #if ($showVsAt && ($event.neutralSite.length() > 0 || !$event.home))
123:             <span class="va">at</span>
124: 		#end
125:     #else
126:         #if ($count == 2 || $count.length() == 0)
127:             #if ($event.neutralSite.length() > 0 || $event.home)
128: 				<span class="va">vs.</span>
129:             #else
130: 				<span class="va">at</span>
131:             #end
132: 		#end
133: 	#end
134: #end
135: 
136: #macro (printEventLinks $event $useContainer $useList)
137: 	#set ($eventLinks = [])
138: 
139: 	#set ($isFinished = false)
140:     #if ($event.statusCode >= 0 || ($event.statusCode == -3 && $now.time >= ($event.date.time + (1000*60*60*24)))) ## -3 is reported for event sports
141:         #set ($isFinished = true)
142:     #end
143: 
144:     #if ($restrictLinks && ($event.inProgress || $isFinished))
145:         #foreach ($link in $event.links)
146:             #if ($event.inProgress && !$excludeLinksWhenEventIsLive.contains($link.mapType))
147:                 #set ($ignoreme = $eventLinks.add($link))
148:             #elseif ($isFinished && !$excludeLinksWhenEventIsFinished.contains($link.mapType))
149:                 #set ($ignoreme = $eventLinks.add($link))
150:             #end
151:         #end
152:     #else
153:         #set ($eventLinks = $event.links)
154: 	#end
155: 
156: 	#if ($useContainer == true)
157: 		<div #if ($eventLinks.size() > 0) class="links" #else class="links empty" #end>
158: 	#end
159: 		#if ($useList == true)<ul>#end
160: 			#set ($linksCounter = 0)
161: 			#foreach ($mapType in $linksOrder)
162: 				#foreach ($link in $eventLinks)
163: 					#if ($mapType == $link.mapType)
164: 						#set ($linksCounter = $linksCounter + 1)
165: 						#if ($linksCounter > 1)
166: 							<span class="sep"> | </span>
167: 						#end
168: 						#set ($linkText = $link.name)
169: 						#if ($abbreviatedLinks)
170: 							#foreach ($l in $linksAbbreviations.entrySet())
171: 								#if ($link.name.equalsIgnoreCase($l.key))
172: 									#set ($linkText = $l.value)
173: 								#end
174: 							#end
175: 						#end
176: 						#if ($useList == true)<li>#end
177: 							<a #printLinkAriaLabel($event, $link) href="$link.url" #if ($website.isExternalLink($link.url)) target="_blank" #end>
178: 							#if ($showLinkIcons)
179: 								<i class="icon gicon-${link.mapType.toLowerCase()}" title="$link.name"></i>
180: 							#end
181: 								<span class="text">$linkText</span>
182: 							</a>
183: 						#if ($useList == true)</li>#end
184: 					#end
185: 				#end
186: 			#end
187: 		#if ($useList == true)</ul>#end
188: 	#if ($useContainer == true)
189: 		</div>
190: 	#end
191: #end ## printEventLinks
192: 
193: #macro (printSport $event)
194:   #set ($feedURL = $event.feedURL)
195: 
196:   #set ($feedURL = $event.feedURL) ## in the form http://www.somedomain.com/sports/mbkb/2014-15/schedule?tmpl=sfs-template
197:   #if ($feedURL.indexOf("://") >= 0)
198:     #set ($feedURL = $feedURL.split("//").get(1)) ## remove the http:// bit from the URL
199:   #end
200:   #set ($startIndex = $feedURL.indexOf("/"))
201:   #set ($endIndex = $feedURL.length())
202:   #if ($feedURL.lastIndexOf("?") >= 0)
203:     #set ($endIndex = $feedURL.lastIndexOf("?"))
204:   #end
205:   #set ($feedURL = $feedURL.substring($startIndex, $endIndex)) ## remove the domain and tmpl parts
206: 
207:   #if ($website.exists($feedURL))
208: 	#set ($ariaLabel = "${event.sport}: schedule")
209:     #if ($feedURL.matches("/sports/.*/\d{4}-\d{2}/.*"))
210:       #set ($seasonStr = $feedURL.split("/").get(3))
211:       #set ($ariaLabel = "${event.sport}: ${seasonStr} schedule") ## aria-label would be something like Men's Basketball 2017-18 schedule
212:     #end
213: 
214:     <a href="${feedURL}" aria-label="$ariaLabel">$event.sport</a>
215:   #else
216:     <span>$event.sport</span>
217:   #end
218: #end
219: 
220: #macro (printLinkAriaLabel $event $link)
221: 	#set ($ariaLabel = "${event.sport} event: ${formatter.formatDate($event.date, 'MMMM d hh:mm a:')}")
222: 	#if ($event.neutralSite.length() > 0 || $event.home)
223: 		#set ($vsOrAt = "vs.")
224: 	#else
225: 		#set ($vsOrAt = "at")
226: 	#end
227: 	#if ($event.teams.size() > 1)
228: 		#set ($ariaLabel = "${ariaLabel} ${event.teams.get(0).name} ${vsOrAt} ${event.teams.get(1).name}:")
229: 	#elseif ($event.teams.size() == 1)
230: 		#set ($ariaLabel = "${ariaLabel} ${event.teams.get(0).name}:")
231: 	#end
232: 	#if ($event.neutralSite.length() > 0)
233: 		#set ($ariaLabel = "${ariaLabel} @ ${event.neutralSite}:")
234: 	#end
235: 	#set ($ariaLabel = "${ariaLabel} ${link.name}")
236: 	aria-label="$ariaLabel"
237: #end
238: 
239: #macro (printEvent $event)
240: 
241: #set ($eventClass = "event")
242: #if ($event.inProgress)
243:   #set ($eventClass = "event in-progress")
244: #end
245: 
246: #if ($event.scheduleTeamId.length() > 0)
247:   #set ($teamSchedule = true)
248: #else
249:   #set ($teamSchedule = false)
250: #end
251: 
252: <div class="${eventClass}">
253: 
254:   <div class="date clearfix">$formatter.formatDate($event.date, $dateFormat)</div>
255: 
256:   #if ($event.sport)
257:     <div class="sport">
258: 		#printSport($event)
259:     </div>
260:   #end
261: 
262:   <div class="status clearfix">
263:   #if ($includeTimeZone)
264:     #if ($includeTimeZone.contains("local"))
265:       <span>$formatter.formatStatus($event).setTimeFormat("h:mm a z").useEventTimeZone()</span>
266:     #elseif ($includeTimeZone.contains("site"))
267:       <span>$formatter.formatStatus($event).setTimeFormat("h:mm a z")</span>
268:     #end
269:   #else
270:     <span>$formatter.formatStatus($event)</span>
271:   #end
272:   </div>
273: 
274:   #if ($showJustOpponent && $teamSchedule)
275:     <div class="opponent clearfix">
276:       #printTeamLogo($event.opponent)
277:       #printVa($event "")
278:       <span class="name">$event.opponent.name</span>
279: 
280:       #set ($APResult = "")
281:       #if ($resultFormat.equals("AP1"))
282:         #set ($APResult = $event.APResult)
283:       #elseif ($resultFormat.equals("AP2"))
284:         #set ($APResult = $event.AP2Result)
285:       #end
286: 
287:       #if (!$event.inProgress && $APResult.length() > 0)
288:         <span class="result">$APResult</span>
289:       #else
290:         #if ($event.result.toString().length() > 0)
291:             <span class="result">$event.result</span>
292:         #end
293:       #end
294:     </div>
295:   #else
296:     #foreach ($team in $event.teams)
297:   	  #set ($teamClass = "team")
298:   	  #if ($event.winner.name.length() > 0)
299:     	#if ($event.winner.name == $team.name)
300:       		#set ($teamClass = "${teamClass} winner")
301:     	#else
302:       		#set ($teamClass = "${teamClass} loser")
303:     	#end
304:   	  #end
305:   	  #if ($event.teams.size() == 2 && $teamSchedule)
306:   	  	#if ($team.teamId == $event.scheduleTeamId)
307:   	  		#set ($teamClass = "${teamClass} site-team")
308:   	  	#end
309:   	  #end
310:       <div class="$teamClass clearfix">
311:         #if ($team.result.length() > 0 && $event.teams.size() > 1) ## ideally this should check if the event is associated to a schedule with numeric results
312:           <span class="score">$team.result</span>
313:         #end
314: 
315:         #printTeamLogo($team)
316:         #printVa($event $velocityCount)
317:         <span class="name">$team.name</span>
318: 
319:         #if ($event.teams.size() == 1 && $event.result.toString().length() > 0)
320:           <span class="result">$event.result</span>
321:         #end
322:       </div>
323:     #end
324:   #end
325: 
326:   #if ($event.neutralSite.length() > 0 || $event.notes.length() > 0)
327:     <div class="neutralsite-notes">
328:       #if ($event.neutralSite.length() > 0)
329:         <span class="neutral-site">@ $event.neutralSite</span>
330:       #end
331:       #if ($event.notes.length() > 0)
332:         <span class="notes">$event.notes</span>
333:       #end
334:     </div>
335:   #end
336: 
337:   #printEventLinks($event, true, false)
338: </div>
339: #end ## printEvent
340: 
341: #macro (printEventBox $event)
342:   #set ($eventServerDate = $tool.timeZone.shift($event.date, $event.localTimeZone, $tool.timeZone.systemTimeZone))
343:   #set ($eventBoxClass = "event-box")
344:   #if ($eventServerDate.before($today))
345:     #set ($eventBoxClass = "${eventBoxClass} result")
346:   #else
347:     #set ($eventBoxClass = "${eventBoxClass} upcoming")
348:   #end
349:   #if ($event.inProgress)
350:     #set ($eventBoxClass = "${eventBoxClass} inprogress")
351:   #end
352:   #if ($event.neutralSite.length() > 0)
353:     #set ($eventBoxClass = "${eventBoxClass} neutral")
354:   #elseif ($event.home)
355:     #set ($eventBoxClass = "${eventBoxClass} home")
356:   #else
357:     #set ($eventBoxClass = "${eventBoxClass} away")
358:   #end
359:   #if ($event.teams.size() == 2)
360:     #set ($eventBoxClass = "${eventBoxClass} h2h")
361:   #else
362:     #set ($eventBoxClass = "${eventBoxClass} meet")
363:   #end
364: 
365:   ## CODE TO EXTRACT SPORT SECTION FROM $event.feedURL
366:   #set ($feedURL = $event.feedURL)
367:   #if ($feedURL.startsWith("http://"))
368:     #set ($feedURL = $feedURL.substring(7, $feedURL.length())) ## remove http://
369:   #elseif ($feedURL.startsWith("https://"))
370:     #set ($feedURL = $feedURL.substring(8, $feedURL.length())) ## remove https://
371:   #end
372:   #set ($startIndex = $feedURL.indexOf("/"))
373:   #set ($endIndex = $feedURL.length())
374:   #set ($feedURL = $feedURL.substring($startIndex, $endIndex))
375:   #set ($feedURL = $feedURL.split("/"))
376:   #if ($feedURL.size() >= 3)
377:     #set ($eventBoxClass = "${eventBoxClass} ${feedURL.get(2)}")
378:   #end
379: 
380:   <div class="${eventBoxClass}">
381:     #printEvent($event)
382:   </div>
383: #end ## printEventBox
384: 
385: #macro (printEmptyEventBox)
386: <div class="event-box empty">
387:   <div class="event">
388:     <span class="no-event">No Event</span>
389:   </div>
390: </div>
391: #end
392: 
393: ############################### END MACROS #############################################
394: 
395: #set ($events = [])
396: #set ($prevCount = 0)
397: #set ($upcomingCount = 0)
398: #set ($eventCount = 0)
399: 
400: ## filter out exhibition events and count the number of previous and upcoming events
401: #foreach ($event in $schedule.events)
402:   #if ($event.date && ($event.overall || !$hideExhibition))
403:     #set ($eventServerDate = $tool.timeZone.shift($event.date, $event.localTimeZone, $tool.timeZone.systemTimeZone))
404:     #if ($eventServerDate.before($today))
405:       #if ($events.add($event))
406:         #set ($prevCount = $prevCount + 1)
407:       #end
408:     #else
409:       #if ($events.add($event)) ## upcoming events include events for today
410:         #set ($upcomingCount = $upcomingCount + 1)
411:       #end
412:     #end
413:   #end
414: #end
415: 
416: #set ($eventCount = $events.size())
417: #if ($eventCount > 0)
418:   #set ($events = $tool.sorter.sort($events, "date")) ## sort dates chronologically
419: #end
420: 
421: ## print event boxes for slick slider
422: #if ($slickSlider)
423: 
424:     #if ($eventCount == 0)
425:       <div class="no-events">No events to show.</div>
426:     #else
427:       #foreach ($event in $events)
428:         #printEventBox($event)
429:       #end
430:     #end
431: 
432: #else
433: 
434:     #set ($slideCount = $tool.math.ceil($tool.math.div($eventCount, $colLimit))) ## total number of slides based on the available number of events
435:     #set ($emptyCount = $tool.math.sub($tool.math.mul($slideCount, $colLimit), $eventCount)) ## total number of items possible - total number of events available
436:     #set ($emptyCountStart = 0)
437:     #set ($emptyCountEnd = 0)
438: 
439:     #if ($prevCount > 0 && $upcomingCount > 0) ## when both previous and upcoming events are available, the layout should preferably show a default slide that contains both previous and upcoming events
440:       #set ($desiredPrevEventsInFocusedSlide = $colLimit / 2)
441:       #set ($availablePrevEventsInFocusedSlide = $prevCount % $colLimit)
442: 
443:       #if ($availablePrevEventsInFocusedSlide < $desiredPrevEventsInFocusedSlide)
444:         #set ($emptyCountStart = $desiredPrevEventsInFocusedSlide - $availablePrevEventsInFocusedSlide)
445:       #elseif ($availablePrevEventsInFocusedSlide > $desiredPrevEventsInFocusedSlide)
446:         #set ($emptyCountStart = ($colLimit - $availablePrevEventsInFocusedSlide) + $desiredPrevEventsInFocusedSlide)
447:       #end
448: 
449:       #if ($emptyCountStart > 0) ## re-count the number of slides
450:         #set ($slideCount = $tool.math.ceil($tool.math.div($tool.math.add($eventCount, $emptyCountStart), $colLimit)))
451:       #end
452: 
453:       #set ($emptyCountEnd = $tool.math.sub($tool.math.mul($slideCount, $colLimit), $tool.math.add($eventCount, $emptyCountStart)))
454:       #set ($focusedIndex = $tool.math.ceil($tool.math.div($tool.math.add($prevCount, $emptyCountStart), $colLimit)))
455: 
456:     #elseif ($prevCount > 0) ## only previous events are available
457:       #set ($focusedIndex = $slideCount) ## focused slide is the last slide in the list that have most recent past events
458:       #set ($emptyCountStart = $emptyCount)
459:     #elseif ($upcomingCount > 0) ## only upcoming events are available
460:       #set ($focusedIndex = 1)
461:       #set ($emptyCountEnd = $emptyCount)
462:     #end
463: 
464:     #if ($slideCount <= 1)
465:         #set ($autoScroll = false)
466:         #set ($circularScroll = false)
467:     #end
468: 
469:     <div class="${id}"  data-module="jslider" data-focus="$tool.math.sub($focusedIndex, 1)" data-auto="$autoScroll" data-interval="${autoInterval}" data-circular="$circularScroll" data-navi="${showNavi}" data-items=".slides">
470: 
471:     #if ($eventCount == 0)
472:       <div class="no-events">No events to show.</div>
473:     #else
474: 
475:     #if ($fullSchedulePos == "top")
476:         <a href="$page.url" class="full-schedule-btn">View Full Schedule</a>
477:     #end
478: 
479:     <a href="javascript:void(0)" role="button" aria-label="move to previous slide" class="prev">Previous</a>
480:     <a href="javascript:void(0)" role="button" aria-label="move to next slide" class="next">Next</a>
481:     #if ($showPlayPause)
482:     	#set ($ppClass = "pp play")
483:     	#if ($autoScroll)
484:     		#set ($ppClass = "pp pause")
485:     	#end
486:     	<a href="javascript:void(0)" role="button" class="${ppClass}">pp</a>
487:     #end
488: 
489:     <div class="slider">
490:     <div class="slides clearfix">
491: 
492:     ## #set ($slideIndex = 1)
493:     #set ($colIndex = 0)
494: 
495:     <div class="slide">
496:     <div class="slide-content clearfix">
497: 
498:     #if ($emptyCountStart > 0)
499:       #foreach ($i in [1..$emptyCountStart])
500:         #set ($colIndex = $colIndex + 1)
501:         #printEmptyEventBox
502:       #end
503:     #end
504: 
505:     #foreach ($event in $events)
506:       #set ($colIndex = $colIndex + 1)
507:       #if ($colIndex > $colLimit)
508:         ## #set ($slideIndex = $slideIndex + 1)
509:         #set ($colIndex = 1)
510:         </div></div>
511:         <div class="slide">
512:         <div class="slide-content clearfix">
513:       #end
514:       #printEventBox($event)
515:     #end
516: 
517:     #if ($emptyCountEnd > 0)
518:       #foreach ($i in [1..$emptyCountEnd])
519:         #set ($colIndex = $colIndex + 1)
520:         #printEmptyEventBox
521:       #end
522:     #end
523: 
524:     </div> ## slide-content
525:     </div> ## slide
526: 
527: 
528:     </div> ## slides
529:     </div> ## slider
530: 
531:     #if ($showNavi)
532:     	<div class="navi"></div>
533:     #end
534:     #if ($fullSchedulePos == "bottom")
535:         <a href="$page.url" class="full-schedule-btn">View Full Schedule</a>
536:     #end
537: 
538:     #end ## total events check
539:     </div> ## scoreboard-slider
540: 
541:     $wiki
542: 
543: #end ## slick parameter check
544: 
545: #if ($request.getParameter("ajax") == true)
546:   $website.decorate("")
547: #end

Cougar of The Week

Auburn Collake Advanced softball with a two-run, walk-off home run in elimination game vs. Columbia State.