Subversion Repositories ORC

Rev

Rev 7 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#!/usr/bin/perl -w
2
 
3
use strict;
4
use lib "/home/rollerco/perl5/lib/perl5";
5
use RollerCon;
6
use scanFunctions;
7
use CGI;
8
use CGI::Cookie;
9
 
10
my $cookie_string = authenticate(1) || die;
11
my ($EML, $PWD, $LVL) = split /&/, $cookie_string;
12
my $user = getUser($EML);
13
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
14
 
15
print CGI::header(-cookie=>$RCAUTH_cookie);
16
 
17
#foreach (sort keys %ENV) {
18
#	print "$_: $ENV{$_}\n<br>";
19
#}
20
my $query = new CGI;
21
my $change = $query->param('change');
22
my $RCid = $query->param('RCid');
23
my $id = $query->param('id');
24
my $role = $query->param('role');
25
my $noshow = $query->param('noshow');
26
 
27
	print<<page1;
28
	<html><head><title>RollerCon Officials Schedule Manager - Shift Change</title>
29
	<link rel="stylesheet" type="text/css" href="/rollercon.css">
30
	</head>
31
	<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000" onload="reloadParent()">
32
	<TABLE>
33
page1
34
 
35
 
36
if ($change eq "lookup") {
37
	if ($LVL < 2) {
38
		print<<errorout;
39
		<TR>
40
			<TD valign=top><font color=red><b>ERROR: </b></font>You're not allowed to change other people's schedules.</td>
41
			<TD valign=top></TD>
42
		</TR>
43
 
44
	</TABLE>
45
errorout
46
	die;
47
	} else {
48
 
49
	}
50
	my $options = fetchDerbyNameWithRCid();
51
 
52
	print<<page2;
53
<FORM action=make_shift_change.pl>
54
<INPUT type=hidden name=change value=add>
55
<INPUT type=hidden name=id value=$id>
56
<INPUT type=hidden name=role value=$role>
57
		<TR>
58
			<TD valign=top>Add User to Shift (Game $id / Role $role):</td>
59
		</tr><tr>
60
			<TD valign=top><SELECT name=RCid>$options</SELECT> </TD>
61
		</TR><tr>
62
		  <td><input type=submit name=Save> <input type=reset name=Cancel onClick=window.close();></td>
63
		  </tr>
64
</FORM>
65
	</TABLE>
66
 
67
page2
68
 
69
} else {
70
	print<<page1;
71
		<TR>
72
			<TD valign=top>Making a shift change...</td>
73
			<TD valign=top></TD>
74
		</TR>
75
 
76
	</TABLE>
77
page1
78
 
79
if ($noshow eq "true") {
80
  logit($RCid, "NO SHOW: Game ($id): $role");
81
  logit($user->{RCid}, "Logged a No Show for ($RCid): Game ($id): $role");
82
  print "Logged a No Show and removing the official from the shift...";
83
  #logit
84
} elsif ($RCid eq $user->{RCid}) {
85
  print "So, <b>$user->{derby_name}</b>, you\'d like to <b>$change</b> a shift where you are <b>$role</b> for game <b>$id</b>...";
86
} else {
87
  my $target = getUserDerbyName($RCid);
88
  print "So, <b>$user->{derby_name}</b>, you\'d like to <b>$change</b> a shift where <b>$target</b> is <b>$role</b> for game <b>$id</b>...";
89
}
90
 
91
	my $change_err = changeShift($change, $id, $role, $RCid);
92
 
93
 
94
	print<<tail;
95
	<SCRIPT language="JavaScript">
96
	<!--
97
			function sleep(milliseconds) {
98
			  var start = new Date().getTime();
99
			  for (var i = 0; i < 1e7; i++) {
100
			    if ((new Date().getTime() - start) > milliseconds){
101
			      break;
102
			    }
103
			  }
104
			}
105
 
106
			function reloadParent() {
107
	      window.opener.document.Req.submit();
108
	      sleep(5000);
109
	      //window.close();
110
			}
111
	//-->
112
	</SCRIPT>
113
 
114
	</body></html>
115
 
116
tail
117
}