Banners

Upcoming Games

No Event
No Event
No Event
Thu May 30
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 236, 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", "LI"])
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 (printLinkAriaLabel $event $link $linkTypeCounter)
137: 	#set ($ariaLabel = "${event.sport} event: ${formatter.formatDate($event.date, 'MMMM d hh:mm a:')}")
138: 	#if ($event.neutralSite.length() > 0 || $event.home)
139: 		#set ($vsOrAt = "vs.")
140: 	#else
141: 		#set ($vsOrAt = "at")
142: 	#end
143: 	#if ($event.teams.size() > 1)
144: 		#set ($ariaLabel = "${ariaLabel} ${event.teams.get(0).name} ${vsOrAt} ${event.teams.get(1).name}:")
145: 	#elseif ($event.teams.size() == 1)
146: 		#set ($ariaLabel = "${ariaLabel} ${event.teams.get(0).name}:")
147: 	#end
148: 	#if ($event.neutralSite.length() > 0)
149: 		#set ($ariaLabel = "${ariaLabel} @ ${event.neutralSite}:")
150: 	#end
151: 	#set ($ariaLabel = "${ariaLabel} ${link.name}")
152: 	#if ($linkTypeCounter > 1)
153: 	    #set ($ariaLabel = "${ariaLabel} link ${linkTypeCounter}")
154: 	#end
155: 	aria-label="$ariaLabel"
156: #end
157: 
158: #macro (printEventLinks $event $useContainer $useList)
159: 	#set ($eventLinks = [])
160: 
161: 	#set ($isFinished = false)
162:     #if ($event.statusCode >= 0 || ($event.statusCode == -3 && $now.time >= ($event.date.time + (1000*60*60*24)))) ## -3 is reported for event sports
163:         #set ($isFinished = true)
164:     #end
165: 
166:     #if ($restrictLinks && ($event.inProgress || $isFinished))
167:         #foreach ($link in $event.links)
168:             #if ($event.inProgress && !$excludeLinksWhenEventIsLive.contains($link.mapType))
169:                 #set ($ignoreme = $eventLinks.add($link))
170:             #elseif ($isFinished && !$excludeLinksWhenEventIsFinished.contains($link.mapType))
171:                 #set ($ignoreme = $eventLinks.add($link))
172:             #end
173:         #end
174:     #else
175:         #set ($eventLinks = $event.links)
176: 	#end
177: 
178: 	#if ($useContainer == true)
179: 		<div #if ($eventLinks.size() > 0) class="links" #else class="links empty" #end>
180: 	#end
181: 		#if ($useList == true)<ul>#end
182: 			#set ($linksCounter = 0)
183: 			#foreach ($mapType in $linksOrder)
184: 				#set ($linkTypeCounter = 0)
185: 				#foreach ($link in $eventLinks)
186: 					#if ($mapType == $link.mapType)
187: 						#set ($linksCounter = $linksCounter + 1)
188: 						#set ($linkTypeCounter = $linkTypeCounter + 1)
189: 						#if ($linksCounter > 1)
190: 							<span class="sep"> | </span>
191: 						#end
192: 						#set ($linkText = $link.name)
193: 						#if ($abbreviatedLinks)
194: 							#if ($link.mapType == "LI" || "$!link.siteCustomSettings.abbreviatedTitle" != "")
195: 								#set ($linkText = "LI")
196: 								#if("$!link.siteCustomSettings.abbreviatedTitle" != "")
197: 									#set ($linkText = $link.siteCustomSettings.abbreviatedTitle)
198: 								#end
199: 							#else
200: 								#foreach ($l in $linksAbbreviations.entrySet())
201: 									#if ($link.name.equalsIgnoreCase($l.key))
202: 										#set ($linkText = $l.value)
203: 									#end
204: 								#end
205: 							#end
206: 						#end
207: 						#if ($useList == true)<li>#end
208: 							<a #printLinkAriaLabel($event, $link, $linkTypeCounter) href="$link.url" #if ($website.isExternalLink($link.url)) target="_blank" #end>
209: 							#if ($showLinkIcons)
210: 								<i class="icon gicon-${link.mapType.toLowerCase()}" title="$link.name"></i>
211: 							#end
212: 								<span class="text">$linkText</span>
213: 							</a>
214: 						#if ($useList == true)</li>#end
215: 					#end
216: 				#end
217: 			#end
218: 		#if ($useList == true)</ul>#end
219: 	#if ($useContainer == true)
220: 		</div>
221: 	#end
222: #end ## printEventLinks
223: 
224: #macro (printSport $event)
225:   #set ($feedURL = $event.feedURL)
226: 
227:   #set ($feedURL = $event.feedURL) ## in the form http://www.somedomain.com/sports/mbkb/2014-15/schedule?tmpl=sfs-template
228:   #if ($feedURL.indexOf("://") >= 0)
229:     #set ($feedURL = $feedURL.split("//").get(1)) ## remove the http:// bit from the URL
230:   #end
231:   #set ($startIndex = $feedURL.indexOf("/"))
232:   #set ($endIndex = $feedURL.length())
233:   #if ($feedURL.lastIndexOf("?") >= 0)
234:     #set ($endIndex = $feedURL.lastIndexOf("?"))
235:   #end
236:   #set ($feedURL = $feedURL.substring($startIndex, $endIndex)) ## remove the domain and tmpl parts
237: 
238:   #if ($website.exists($feedURL))
239: 	#set ($ariaLabel = "${event.sport}: schedule")
240:     #if ($feedURL.matches("/sports/.*/\d{4}-\d{2}/.*"))
241:       #set ($seasonStr = $feedURL.split("/").get(3))
242:       #set ($ariaLabel = "${event.sport}: ${seasonStr} schedule") ## aria-label would be something like Men's Basketball 2017-18 schedule
243:     #end
244: 
245:     <a href="${feedURL}" aria-label="$ariaLabel">$event.sport</a>
246:   #else
247:     <span>$event.sport</span>
248:   #end
249: #end
250: 
251: #macro (printEvent $event)
252: 
253: #set ($eventClass = "event")
254: #if ($event.inProgress)
255:   #set ($eventClass = "event in-progress")
256: #end
257: 
258: #if ($event.scheduleTeamId.length() > 0)
259:   #set ($teamSchedule = true)
260: #else
261:   #set ($teamSchedule = false)
262: #end
263: 
264: <div class="${eventClass}">
265: 
266:   <div class="date clearfix">$formatter.formatDate($event.date, $dateFormat)</div>
267: 
268:   #if ($event.sport)
269:     <div class="sport">
270: 		#printSport($event)
271:     </div>
272:   #end
273: 
274:   <div class="status clearfix">
275:   #if ($includeTimeZone)
276:     #if ($includeTimeZone.contains("local"))
277:       <span>$formatter.formatStatus($event).setTimeFormat("h:mm a z").useEventTimeZone()</span>
278:     #elseif ($includeTimeZone.contains("site"))
279:       <span>$formatter.formatStatus($event).setTimeFormat("h:mm a z")</span>
280:     #end
281:   #else
282:     <span>$formatter.formatStatus($event)</span>
283:   #end
284:   </div>
285: 
286:   #if ($showJustOpponent && $teamSchedule)
287:     <div class="opponent clearfix">
288:       #printTeamLogo($event.opponent)
289:       #printVa($event "")
290:       <span class="name">$event.opponent.name</span>
291: 
292:       #set ($APResult = "")
293:       #if ($resultFormat.equals("AP1"))
294:         #set ($APResult = $event.APResult)
295:       #elseif ($resultFormat.equals("AP2"))
296:         #set ($APResult = $event.AP2Result)
297:       #end
298: 
299:       #if (!$event.inProgress && $APResult.length() > 0)
300:         <span class="result">$APResult</span>
301:       #else
302:         #if ($event.result.toString().length() > 0)
303:             <span class="result">$event.result</span>
304:         #end
305:       #end
306:     </div>
307:   #else
308:     #foreach ($team in $event.teams)
309:   	  #set ($teamClass = "team")
310:   	  #if ($event.winner.name.length() > 0)
311:     	#if ($event.winner.name == $team.name)
312:       		#set ($teamClass = "${teamClass} winner")
313:     	#else
314:       		#set ($teamClass = "${teamClass} loser")
315:     	#end
316:   	  #end
317:   	  #if ($event.teams.size() == 2 && $teamSchedule)
318:   	  	#if ($team.teamId == $event.scheduleTeamId)
319:   	  		#set ($teamClass = "${teamClass} site-team")
320:   	  	#end
321:   	  #end
322:       <div class="$teamClass clearfix">
323:         #if ($team.result.length() > 0 && $event.teams.size() > 1) ## ideally this should check if the event is associated to a schedule with numeric results
324:           <span class="score">$team.result</span>
325:         #end
326: 
327:         #printTeamLogo($team)
328:         #printVa($event $velocityCount)
329:         <span class="name">$team.name</span>
330: 
331:         #if ($event.teams.size() == 1 && $event.result.toString().length() > 0)
332:           <span class="result">$event.result</span>
333:         #end
334:       </div>
335:     #end
336:   #end
337: 
338:   #if ($event.neutralSite.length() > 0 || $event.notes.length() > 0)
339:     <div class="neutralsite-notes">
340:       #if ($event.neutralSite.length() > 0)
341:         <span class="neutral-site">@ $event.neutralSite</span>
342:       #end
343:       #if ($event.notes.length() > 0)
344:         <span class="notes">$event.notes</span>
345:       #end
346:     </div>
347:   #end
348: 
349:   #printEventLinks($event, true, false)
350: </div>
351: #end ## printEvent
352: 
353: #macro (printEventBox $event)
354:   #set ($eventServerDate = $tool.timeZone.shift($event.date, $event.localTimeZone, $tool.timeZone.systemTimeZone))
355:   #set ($eventBoxClass = "event-box")
356:   #if ($eventServerDate.before($today))
357:     #set ($eventBoxClass = "${eventBoxClass} result")
358:   #else
359:     #set ($eventBoxClass = "${eventBoxClass} upcoming")
360:   #end
361:   #if ($event.inProgress)
362:     #set ($eventBoxClass = "${eventBoxClass} inprogress")
363:   #end
364:   #if ($event.neutralSite.length() > 0)
365:     #set ($eventBoxClass = "${eventBoxClass} neutral")
366:   #elseif ($event.home)
367:     #set ($eventBoxClass = "${eventBoxClass} home")
368:   #else
369:     #set ($eventBoxClass = "${eventBoxClass} away")
370:   #end
371:   #if ($event.teams.size() == 2)
372:     #set ($eventBoxClass = "${eventBoxClass} h2h")
373:   #else
374:     #set ($eventBoxClass = "${eventBoxClass} meet")
375:   #end
376: 
377:   ## CODE TO EXTRACT SPORT SECTION FROM $event.feedURL
378:   #set ($feedURL = $event.feedURL)
379:   #if ($feedURL.startsWith("http://"))
380:     #set ($feedURL = $feedURL.substring(7, $feedURL.length())) ## remove http://
381:   #elseif ($feedURL.startsWith("https://"))
382:     #set ($feedURL = $feedURL.substring(8, $feedURL.length())) ## remove https://
383:   #end
384:   #set ($startIndex = $feedURL.indexOf("/"))
385:   #set ($endIndex = $feedURL.length())
386:   #set ($feedURL = $feedURL.substring($startIndex, $endIndex))
387:   #set ($feedURL = $feedURL.split("/"))
388:   #if ($feedURL.size() >= 3)
389:     #set ($eventBoxClass = "${eventBoxClass} ${feedURL.get(2)}")
390:   #end
391: 
392:   <div class="${eventBoxClass}">
393:     #printEvent($event)
394:   </div>
395: #end ## printEventBox
396: 
397: #macro (printEmptyEventBox)
398: <div class="event-box empty">
399:   <div class="event">
400:     <span class="no-event">No Event</span>
401:   </div>
402: </div>
403: #end
404: 
405: ############################### END MACROS #############################################
406: 
407: #set ($events = [])
408: #set ($prevCount = 0)
409: #set ($upcomingCount = 0)
410: #set ($eventCount = 0)
411: 
412: ## filter out exhibition events and count the number of previous and upcoming events
413: #foreach ($event in $schedule.events)
414:   #if ($event.date && ($event.overall || !$hideExhibition))
415:     #set ($eventServerDate = $tool.timeZone.shift($event.date, $event.localTimeZone, $tool.timeZone.systemTimeZone))
416:     #if ($eventServerDate.before($today))
417:       #if ($events.add($event))
418:         #set ($prevCount = $prevCount + 1)
419:       #end
420:     #else
421:       #if ($events.add($event)) ## upcoming events include events for today
422:         #set ($upcomingCount = $upcomingCount + 1)
423:       #end
424:     #end
425:   #end
426: #end
427: 
428: #set ($eventCount = $events.size())
429: #if ($eventCount > 0)
430:   #set ($events = $tool.sorter.sort($events, "date")) ## sort dates chronologically
431: #end
432: 
433: ## print event boxes for slick slider
434: #if ($slickSlider)
435: 
436:     #if ($eventCount == 0)
437:       <div class="no-events">No events to show.</div>
438:     #else
439:       #foreach ($event in $events)
440:         #printEventBox($event)
441:       #end
442:     #end
443: 
444: #else
445: 
446:     #set ($slideCount = $tool.math.ceil($tool.math.div($eventCount, $colLimit))) ## total number of slides based on the available number of events
447:     #set ($emptyCount = $tool.math.sub($tool.math.mul($slideCount, $colLimit), $eventCount)) ## total number of items possible - total number of events available
448:     #set ($emptyCountStart = 0)
449:     #set ($emptyCountEnd = 0)
450: 
451:     #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
452:       #set ($desiredPrevEventsInFocusedSlide = $colLimit / 2)
453:       #set ($availablePrevEventsInFocusedSlide = $prevCount % $colLimit)
454: 
455:       #if ($availablePrevEventsInFocusedSlide < $desiredPrevEventsInFocusedSlide)
456:         #set ($emptyCountStart = $desiredPrevEventsInFocusedSlide - $availablePrevEventsInFocusedSlide)
457:       #elseif ($availablePrevEventsInFocusedSlide > $desiredPrevEventsInFocusedSlide)
458:         #set ($emptyCountStart = ($colLimit - $availablePrevEventsInFocusedSlide) + $desiredPrevEventsInFocusedSlide)
459:       #end
460: 
461:       #if ($emptyCountStart > 0) ## re-count the number of slides
462:         #set ($slideCount = $tool.math.ceil($tool.math.div($tool.math.add($eventCount, $emptyCountStart), $colLimit)))
463:       #end
464: 
465:       #set ($emptyCountEnd = $tool.math.sub($tool.math.mul($slideCount, $colLimit), $tool.math.add($eventCount, $emptyCountStart)))
466:       #set ($focusedIndex = $tool.math.ceil($tool.math.div($tool.math.add($prevCount, $emptyCountStart), $colLimit)))
467: 
468:     #elseif ($prevCount > 0) ## only previous events are available
469:       #set ($focusedIndex = $slideCount) ## focused slide is the last slide in the list that have most recent past events
470:       #set ($emptyCountStart = $emptyCount)
471:     #elseif ($upcomingCount > 0) ## only upcoming events are available
472:       #set ($focusedIndex = 1)
473:       #set ($emptyCountEnd = $emptyCount)
474:     #end
475: 
476:     #if ($slideCount <= 1)
477:         #set ($autoScroll = false)
478:         #set ($circularScroll = false)
479:     #end
480: 
481:     <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">
482: 
483:     #if ($eventCount == 0)
484:       <div class="no-events">No events to show.</div>
485:     #else
486: 
487:     #if ($fullSchedulePos == "top")
488:         <a href="$page.url" class="full-schedule-btn">View Full Schedule</a>
489:     #end
490: 
491:     <a href="javascript:void(0)" role="button" aria-label="move to previous slide" class="prev">Previous</a>
492:     <a href="javascript:void(0)" role="button" aria-label="move to next slide" class="next">Next</a>
493:     #if ($showPlayPause)
494:     	#set ($ppClass = "pp play")
495:     	#if ($autoScroll)
496:     		#set ($ppClass = "pp pause")
497:     	#end
498:     	<a href="javascript:void(0)" role="button" class="${ppClass}">pp</a>
499:     #end
500: 
501:     <div class="slider">
502:     <div class="slides clearfix">
503: 
504:     ## #set ($slideIndex = 1)
505:     #set ($colIndex = 0)
506: 
507:     <div class="slide">
508:     <div class="slide-content clearfix">
509: 
510:     #if ($emptyCountStart > 0)
511:       #foreach ($i in [1..$emptyCountStart])
512:         #set ($colIndex = $colIndex + 1)
513:         #printEmptyEventBox
514:       #end
515:     #end
516: 
517:     #foreach ($event in $events)
518:       #set ($colIndex = $colIndex + 1)
519:       #if ($colIndex > $colLimit)
520:         ## #set ($slideIndex = $slideIndex + 1)
521:         #set ($colIndex = 1)
522:         </div></div>
523:         <div class="slide">
524:         <div class="slide-content clearfix">
525:       #end
526:       #printEventBox($event)
527:     #end
528: 
529:     #if ($emptyCountEnd > 0)
530:       #foreach ($i in [1..$emptyCountEnd])
531:         #set ($colIndex = $colIndex + 1)
532:         #printEmptyEventBox
533:       #end
534:     #end
535: 
536:     </div> ## slide-content
537:     </div> ## slide
538: 
539: 
540:     </div> ## slides
541:     </div> ## slider
542: 
543:     #if ($showNavi)
544:     	<div class="navi"></div>
545:     #end
546:     #if ($fullSchedulePos == "bottom")
547:         <a href="$page.url" class="full-schedule-btn">View Full Schedule</a>
548:     #end
549: 
550:     #end ## total events check
551:     </div> ## scoreboard-slider
552: 
553:     $wiki
554: 
555: #end ## slick parameter check
556: 
557: #if ($request.getParameter("ajax") == true)
558:   $website.decorate("")
559: #end