| Line 24... |
Line 24... |
| 24 |
my $username = $user->{derby_name};
|
24 |
my $username = $user->{derby_name};
|
| 25 |
my $RCid = $user->{RCid};
|
25 |
my $RCid = $user->{RCid};
|
| 26 |
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
|
26 |
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
|
| 27 |
my $YEAR = 1900 + (localtime)[5];
|
27 |
my $YEAR = 1900 + (localtime)[5];
|
| Line -... |
Line 28... |
| - |
|
28 |
|
| - |
|
29 |
if (!$ORCUSER->{MVPid} and $LVL < RollerCon::ADMIN and $ORCUSER->{department}->{MVP} < RollerCon::USER and $ORCUSER->{department}->{COA} < RollerCon::USER) {
|
| - |
|
30 |
print header(-cookie=>$RCAUTH_cookie);
|
| - |
|
31 |
printRCHeader("Unauthorized Page");
|
| - |
|
32 |
print $h->div ({ class=>"error" }, "No Access");
|
| - |
|
33 |
print $h->div ("Your user account is not registered to sign up for MVP Classes, so you can't see this page. It's possible that your access is still being reviewed. Please be patient.");
|
| - |
|
34 |
print $h->a ({ href=>"/schedule/" }, "[Go Home]");
|
| - |
|
35 |
print $h->close ("body");
|
| - |
|
36 |
print $h->close ("html");
|
| - |
|
37 |
exit;
|
| Line 28... |
Line 38... |
| 28 |
|
38 |
}
|
| 29 |
|
39 |
|
| 30 |
my $pageTitle = "View MVP Class";
|
40 |
my $pageTitle = "View MVP Class";
|
| 31 |
my $homeURL = "/schedule/";
|
41 |
my $homeURL = "/schedule/";
|
| Line 316... |
Line 326... |
| 316 |
$actionbutton = formField ("choice", "Save");
|
326 |
$actionbutton = formField ("choice", "Save");
|
| 317 |
$actionbutton .= formField ("Cancel");
|
327 |
$actionbutton .= formField ("Cancel");
|
| 318 |
} else {
|
328 |
} else {
|
| 319 |
# We're just looking at it...
|
329 |
# We're just looking at it...
|
| 320 |
print $h->p ("Viewing Class: $R->{$primary}...");
|
330 |
print $h->p ("Viewing Class: $R->{$primary}...");
|
| - |
|
331 |
|
| - |
|
332 |
if ($ORCUSER->{MVPid}) {
|
| - |
|
333 |
my $dbh = WebDB::connect ();
|
| - |
|
334 |
($F{available}) = $dbh->selectrow_array ("select available from v_class_new where id = ?", undef, $R->{id});
|
| - |
|
335 |
$dbh->disconnect;
|
| - |
|
336 |
$F{capacity} = $F{available} . " / " . modify_capacity (\%F);
|
| - |
|
337 |
}
|
| - |
|
338 |
|
| 321 |
$F{$DBFields[0]} .= $h->input ({ type=>"hidden", name=>$DBFields[0], value=> $F{$DBFields[0]} });
|
339 |
$F{$DBFields[0]} .= $h->input ({ type=>"hidden", name=>$DBFields[0], value=> $F{$DBFields[0]} });
|
| Line 322... |
Line 340... |
| 322 |
|
340 |
|
| 323 |
my $coachEditor = ($LVL >= RollerCon::ADMIN or $user->{department}->{MVP} >= RollerCon::MANAGER or $user->{department}->{VCI} >= RollerCon::MANAGER) ? 1 : 0;
|
341 |
my $coachEditor = ($LVL >= RollerCon::ADMIN or $user->{department}->{MVP} >= RollerCon::MANAGER or $user->{department}->{VCI} >= RollerCon::MANAGER) ? 1 : 0;
|
| 324 |
$coachRCid = $F{coach};
|
342 |
$coachRCid = $F{coach};
|
| 325 |
$F{coach} = "";
|
343 |
$F{coach} = "";
|
| 326 |
foreach (@CoachShifts) {
|
344 |
foreach (@CoachShifts) {
|
| 327 |
my $sr = getShiftRef ($_);
|
345 |
my $sr = getShiftRef ($_);
|
| 328 |
$F{coach} .= $h->a ({ href=>"/schedule/view_user.pl?RCid=$sr->{assignee_id}" }, getUserDerbyName ($sr->{assignee_id}));
|
346 |
$F{coach} .= $h->a ({ href=>"/schedule/view_coach.pl?RCid=$sr->{assignee_id}" }, getUserDerbyName ($sr->{assignee_id}));
|
| 329 |
$F{coach} .= ' ' . $h->button ({name => "coachchange", value => "delete_coach:$sr->{assignee_id}"}, "Remove") if $coachEditor;
|
347 |
$F{coach} .= ' ' . $h->button ({name => "coachchange", value => "delete_coach:$sr->{assignee_id}"}, "Remove") if $coachEditor;
|
| 330 |
$F{coach} .= $h->br;
|
348 |
$F{coach} .= $h->br;
|
| 331 |
push @CoachRCids, $sr->{assignee_id};
|
349 |
push @CoachRCids, $sr->{assignee_id};
|
| 332 |
}
|
350 |
}
|
| Line 340... |
Line 358... |
| 340 |
}
|
358 |
}
|
| Line 341... |
Line 359... |
| 341 |
|
359 |
|
| 342 |
$F{assistant} = "";
|
360 |
$F{assistant} = "";
|
| 343 |
foreach (@AsstCoachShifts) {
|
361 |
foreach (@AsstCoachShifts) {
|
| 344 |
my $sr = getShiftRef ($_);
|
362 |
my $sr = getShiftRef ($_);
|
| 345 |
$F{assistant} .= $h->a ({ href=>"/schedule/view_user.pl?RCid=$sr->{assignee_id}" }, getUserDerbyName $sr->{assignee_id});
|
363 |
$F{assistant} .= $h->a ({ href=>"/schedule/view_coach.pl?RCid=$sr->{assignee_id}" }, getUserDerbyName $sr->{assignee_id});
|
| 346 |
$F{assistant} .= ' ' . $h->button ({name => "coachchange", value => "delete_assistant:$sr->{assignee_id}"}, "Remove") if $coachEditor;
|
364 |
$F{assistant} .= ' ' . $h->button ({name => "coachchange", value => "delete_assistant:$sr->{assignee_id}"}, "Remove") if $coachEditor;
|
| 347 |
$F{assistant} .= $h->br;
|
365 |
$F{assistant} .= $h->br;
|
| 348 |
push @AsstCoachRCids, $sr->{assignee_id};
|
366 |
push @AsstCoachRCids, $sr->{assignee_id};
|
| 349 |
}
|
367 |
}
|
| Line 353... |
Line 371... |
| 353 |
$F{assistant} .= select_assistant () . $h->button ({name => "coachchange", value => "save_assistant"}, "Save");
|
371 |
$F{assistant} .= select_assistant () . $h->button ({name => "coachchange", value => "save_assistant"}, "Save");
|
| 354 |
} else {
|
372 |
} else {
|
| 355 |
$F{assistant} .= $h->button ({name => "coachchange", value => "add_assistant"}, "Add Assistant");
|
373 |
$F{assistant} .= $h->button ({name => "coachchange", value => "add_assistant"}, "Add Assistant");
|
| 356 |
}
|
374 |
}
|
| 357 |
}
|
375 |
}
|
| 358 |
|
376 |
|
| 359 |
$F{start_time} = convertTime $F{start_time};
|
377 |
$F{start_time} = convertTime $F{start_time};
|
| 360 |
$F{end_time} = convertTime $F{end_time};
|
378 |
$F{end_time} = convertTime $F{end_time};
|
| Line 361... |
Line 379... |
| 361 |
|
379 |
|
| 362 |
$actionbutton = formField ("choice", "Update") unless $LVL < RollerCon::ADMIN;
|
380 |
$actionbutton = formField ("choice", "Update") unless $LVL < RollerCon::ADMIN;
|
| Line 485... |
Line 503... |
| 485 |
print $h->p ({ class=>"success" }, "Class successfully saved.");
|
503 |
print $h->p ({ class=>"success" }, "Class successfully saved.");
|
| Line 486... |
Line 504... |
| 486 |
|
504 |
|
| 487 |
display_form ({ $primary=>$FORM{id} }, "POSTSAVE");
|
505 |
display_form ({ $primary=>$FORM{id} }, "POSTSAVE");
|
| Line -... |
Line 506... |
| - |
|
506 |
}
|
| - |
|
507 |
|
| - |
|
508 |
sub modify_capacity {
|
| - |
|
509 |
my $t = shift;
|
| - |
|
510 |
|
| - |
|
511 |
my $classid = $t->{id};
|
| - |
|
512 |
$classid =~ s/^(\d+).*/$1/;
|
| - |
|
513 |
|
| - |
|
514 |
use DateTime;
|
| - |
|
515 |
my $now = DateTime->now (time_zone => 'America/Los_Angeles');
|
| - |
|
516 |
my ($yyyy, $mm, $dd) = split /\-/, $t->{date};
|
| - |
|
517 |
my $cutoff = DateTime->new(
|
| - |
|
518 |
year => $yyyy,
|
| - |
|
519 |
month => $mm,
|
| - |
|
520 |
day => $dd,
|
| - |
|
521 |
hour => 5,
|
| - |
|
522 |
minute => 0,
|
| - |
|
523 |
second => 0,
|
| - |
|
524 |
time_zone => 'America/Los_Angeles'
|
| - |
|
525 |
);
|
| - |
|
526 |
|
| - |
|
527 |
return $t->{capacity} . " | CLOSED" unless $now < $cutoff;
|
| - |
|
528 |
|
| - |
|
529 |
my $classkey = join '|', $t->{date}, $t->{start_time}, $t->{location};
|
| - |
|
530 |
|
| - |
|
531 |
my $dbh = WebDB::connect;
|
| - |
|
532 |
($t->{signedup}) = $dbh->selectrow_array ("select role from v_class_signup_new where RCid = ? and id = ?", undef, $ORCUSER->{RCid}, $classid );
|
| - |
|
533 |
$dbh->disconnect;
|
| - |
|
534 |
my $droplink = $h->button ({ onClick=>"if (confirm('Really? You want to drop this class?')==true) { window.open('make_shift_change.pl?change=del&RCid=$ORCUSER->{RCid}&id=$classid&role=$t->{signedup}','Confirm Change','resizable,height=260,width=370'); return false; }" }, "DROP");
|
| - |
|
535 |
if (!$t->{available}) {
|
| - |
|
536 |
my $full = " | FULL";
|
| - |
|
537 |
$full .= ' '.$droplink unless !$t->{signedup};
|
| - |
|
538 |
return $t->{capacity} . $full;
|
| - |
|
539 |
}
|
| - |
|
540 |
|
| - |
|
541 |
# $t->{capacity} .= " | Open";
|
| - |
|
542 |
$t->{capacity} .= ' '.$droplink unless !$t->{signedup};
|
| - |
|
543 |
if (findConflict ($ORCUSER->{RCid}, $classid, "class")) {
|
| - |
|
544 |
$t->{capacity} .= " | *schedule conflict*" unless $t->{signedup};
|
| - |
|
545 |
} elsif (signUpEligible ($ORCUSER, $t, "class")) {
|
| - |
|
546 |
# SIGN UP
|
| - |
|
547 |
$t->{capacity} .= ' '.$h->button ({ onClick=>"event.stopPropagation(); window.open('make_shift_change.pl?change=add&RCid=$ORCUSER->{RCid}&id=$classkey','Confirm Class Change','resizable,height=260,width=370'); return false;" }, "SIGN UP");
|
| - |
|
548 |
}
|
| - |
|
549 |
|
| - |
|
550 |
return $t->{capacity};
|
| 488 |
}
|
551 |
}
|
| 489 |
|
552 |
|
| 490 |
sub error {
|
553 |
sub error {
|
| 491 |
my $msg = shift;
|
554 |
my $msg = shift;
|
| 492 |
print $h->p ({ class=>"error" }, "Error: $msg");
|
555 |
print $h->p ({ class=>"error" }, "Error: $msg");
|