Subversion Repositories VORC

Rev

Rev 71 | Rev 88 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 71 Rev 86
Line 22... Line 22...
22
my $depts = getDepartments (); # HashRef of the department TLAs -> Display Names...
22
my $depts = getDepartments (); # HashRef of the department TLAs -> Display Names...
23
my $deptDesc = getDepartmentDescriptions ();
23
my $deptDesc = getDepartmentDescriptions ();
24
my $deptLink = getDepartmentLinks ();
24
my $deptLink = getDepartmentLinks ();
25
my $AccessLevel = getAccessLevels;
25
my $AccessLevel = getAccessLevels;
26
my @tshirtOptions = ("", "MS", "MM", "ML", "MXL", "M2X", "M3X");
26
my @tshirtOptions = ("", "MS", "MM", "ML", "MXL", "M2X", "M3X");
-
 
27
my @AUTODEPTS = map { $_->[0] } @{$dbh->selectall_arrayref ("select TLA from department where autoapprove = true")};
Line 27... Line 28...
27
 
28
 
28
# The page's form might be submitted as a POST or a GET (or both?)
29
# The page's form might be submitted as a POST or a GET (or both?)
29
#  The initial _view_ likely comes as a GET request (making it easier to embed in an HREF as a URL)
30
#  The initial _view_ likely comes as a GET request (making it easier to embed in an HREF as a URL)
30
#  Unpack any values sent in the GET and add them to the FORM hash
31
#  Unpack any values sent in the GET and add them to the FORM hash
Line 83... Line 84...
83
#	$F->{type}        = param ('type')       // '';
84
#	$F->{type}        = param ('type')       // '';
84
	$F->{RCid}        = param ('RCid')       // '';
85
	$F->{RCid}        = param ('RCid')       // '';
85
	$F->{access}      = param ('access')     // 0;
86
	$F->{access}      = param ('access')     // 0;
86
#	$F->{mvp_pass}    = defined param ('mvp_pass') ? 1 : 0;
87
#	$F->{mvp_pass}    = defined param ('mvp_pass') ? 1 : 0;
87
	$F->{department}  = join ":", map { "$_-".param ("DEPT-".$_) } map { s/^DEPT-//; $_ } grep { param ($_) ne "" } grep { /^DEPT-/ } param ;
88
	$F->{department}  = join ":", map { "$_-".param ("DEPT-".$_) } map { s/^DEPT-//; $_ } grep { param ($_) ne "" } grep { /^DEPT-/ } param ;
88
  my @AUTODEPTS = map { $_->[0] } @{$dbh->selectall_arrayref ("select TLA from department where autoapprove = true")};
-
 
Line 89... Line 89...
89
  
89
  
90
  if ($F->{RCid} eq "New") {
90
  if ($F->{RCid} eq "New") {
91
  # Saving a new User...
91
  # Saving a new User...
92
    # But first let's do some error checking...0
92
    # But first let's do some error checking...0
Line 289... Line 289...
289
    	    # Department Leads and above can change someone's level within the dept (up to their own level -1)
289
    	    # Department Leads and above can change someone's level within the dept (up to their own level -1)
290
    	    $F->{department}->{$k} = $h->select ({ name=>"DEPT-".$k }, [ $h->option ({ value=>"" }, ""), map { $_ eq $F->{department}->{$k} ? $h->option ({ value=>$_, selected=>[] }, $AccessLevel->{$_}) : $h->option ({ value=>$_ }, $AccessLevel->{$_}) } (0..$currentuser->{department}->{$k}-1) ]);
290
    	    $F->{department}->{$k} = $h->select ({ name=>"DEPT-".$k }, [ $h->option ({ value=>"" }, ""), map { $_ eq $F->{department}->{$k} ? $h->option ({ value=>$_, selected=>[] }, $AccessLevel->{$_}) : $h->option ({ value=>$_ }, $AccessLevel->{$_}) } (0..$currentuser->{department}->{$k}-1) ]);
291
    	  } else {
291
    	  } else {
292
    	    # Or it's your own record, you can still submit a request to be added to the dept.
292
    	    # Or it's your own record, you can still submit a request to be added to the dept.
293
    	    if (!defined $F->{department}->{$k}) {
293
    	    if (!defined $F->{department}->{$k}) {
294
            $F->{department}->{$k} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"DEPT-$k", value=>0 }), $h->span ({ class=>"slider round" })]);
294
            $F->{department}->{$k} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"DEPT-$k", value=>0 }), $h->span ({ class=>"slider round" })]) unless !inArray ($k, \@AUTODEPTS);
295
          } elsif ($F->{department}->{$k} == 0) {
295
          } elsif ($F->{department}->{$k} == 0) {
296
            $F->{department}->{$k} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"DEPT-$k", value=>0, checked=>[] }), $h->span ({ class=>"slider round" })]);          	
296
            $F->{department}->{$k} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"DEPT-$k", value=>0, checked=>[] }), $h->span ({ class=>"slider round" })]);          	
297
          }
297
          }
298
    	  }
298
    	  }
299
    	}
299
    	}
Line 319... Line 319...
319
#  	$F->{mvp_pass}	 = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"mvp_pass", value=>0, readonly=>[], disabled=>[] }), $h->span ({ class=>"slider round" })]);
319
#  	$F->{mvp_pass}	 = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"mvp_pass", value=>0, readonly=>[], disabled=>[] }), $h->span ({ class=>"slider round" })]);
Line 320... Line 320...
320
    
320
    
321
    $F->{department} = convertDepartments ($F->{department});
321
    $F->{department} = convertDepartments ($F->{department});
322
  	foreach (sort keys %{$depts}) {
322
  	foreach (sort keys %{$depts}) {
-
 
323
  	  next if $_ eq "CMP";
323
  	  next if $_ eq "CMP";
324
  	  next unless inArray($_, \@AUTODEPTS);
324
  	  if (defined param ("DEPT-$_")) {
325
  	  if (defined param ("DEPT-$_")) {
325
  	    $F->{department}->{$_} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"DEPT-$_", value=>0, checked=>[] }), $h->span ({ class=>"slider round" })]);
326
  	    $F->{department}->{$_} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"DEPT-$_", value=>0, checked=>[] }), $h->span ({ class=>"slider round" })]);
326
  	  } else {
327
  	  } else {
327
  	    $F->{department}->{$_} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"DEPT-$_", value=>0 }), $h->span ({ class=>"slider round" })]);
328
  	    $F->{department}->{$_} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"DEPT-$_", value=>0 }), $h->span ({ class=>"slider round" })]);