-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadminsetlineup.jsp
57 lines (54 loc) · 2.35 KB
/
adminsetlineup.jsp
1
2
3
4
5
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.eleichtenschlag.nascar.model.DatastoreManager" %>
<%@ page import="com.eleichtenschlag.nascar.model.Driver" %>
<%@ page import="com.eleichtenschlag.nascar.model.NascarConfig" %>
<%@ page import="com.eleichtenschlag.nascar.model.NascarConfigSingleton" %>
<%@ page import="com.eleichtenschlag.nascar.model.Team" %>
<%@ page import="com.eleichtenschlag.nascar.model.Race" %>
<HTML>
<HEAD>
<SCRIPT type="text/javascript" src="adminsetlineup.js"></SCRIPT>
<SCRIPT type="text/javascript" src="js/json2.js"></SCRIPT>
</HEAD>
<BODY ONLOAD="getUpdatedDrivers()">
<A HREF='/admin/advanced'>Back to Admin Advanced</A>
<A HREF='/'>Back to home</A><BR/>
<H1>This interface lets you remotely set a lineup.</H1>
<%
// Team select option.
String teamSelectHtml = "<select id='teamselect' name='teamname' onchange='requestUpdatedLineup()'>";
List<Team> teams = DatastoreManager.getAllObjects(Team.class);
for (Team team: teams) {
teamSelectHtml += String.format("<option value='%s'>%s</option>", team.getTeamName(), team.getTeamName());
}
teamSelectHtml += "</select>";
// Race select option.
NascarConfig configuration = NascarConfigSingleton.get();
Race currentRace = configuration.getRace();
Map<String, Object> filters = new HashMap<String, Object>();
filters.put("year", currentRace.getYear());
List<Race> races = DatastoreManager.getAllObjectsWithFilters(Race.class, filters);
String raceSelectHtml = "<select id='raceselect' name='raceid' onchange='getUpdatedDrivers()'>";
for (Race race: races) {
raceSelectHtml += String.format("<option value='%s'>%s - %s</option>", race.getId(), race.getWeek(), race.getRaceName());
}
raceSelectHtml += "</select>";
%>
<FORM ACTION='admin/lineup' STYLE='float: left;' METHOD='POST'>
Team: <%= teamSelectHtml %>
Week: <%= raceSelectHtml %>
<DIV ID='driverTable'>
</DIV>
<BUTTON ID='submit' TYPE='submit'>Enter Picks</BUTTON>
</FORM>
<DIV STYLE="float: left; padding-left: 20px; font-size: 24px;">
Current selections:
<BR/>
<DIV ID="currentDrivers"></DIV>
Current value = <DIV ID="totalValue" style="display: inline">0</DIV>
</DIV>
</BODY>
</HTML>