Subversion Repositories VORC

Rev

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

Rev 122 Rev 134
Line 66... Line 66...
66
} elsif ($FORM->{'SUB'} eq "Make Current") {
66
} elsif ($FORM->{'SUB'} eq "Make Current") {
67
  $dbh->do ("update official set last_login = now() where RCid = ?", undef, $FORM->{'RCid'}) unless $FORM->{'RCid'} !~ /^\d+$/;
67
  $dbh->do ("update official set last_login = now() where RCid = ?", undef, $FORM->{'RCid'}) unless $FORM->{'RCid'} !~ /^\d+$/;
68
  logit ($FORM->{'RCid'}, "An Admin updated last_login time to current.");
68
  logit ($FORM->{'RCid'}, "An Admin updated last_login time to current.");
69
#  logit ($ORCUSER->{'RCid'}, "Updated user ($FORM->{'RCid'}) last_login time to current.");
69
#  logit ($ORCUSER->{'RCid'}, "Updated user ($FORM->{'RCid'}) last_login time to current.");
70
  display_form ($FORM->{'RCid'}, "View");
70
  display_form ($FORM->{'RCid'}, "View");
-
 
71
} elsif ($FORM->{'SUB'} eq "Verify") {
-
 
72
  $cookie_string = authenticate (RollerCon::USER);
-
 
73
	validate_emt ($FORM->{RCid}, "add");
-
 
74
  display_form ($FORM->{'RCid'}, "View");
-
 
75
} elsif ($FORM->{'SUB'} eq "Remove") {
-
 
76
  $cookie_string = authenticate (RollerCon::USER);
-
 
77
	validate_emt ($FORM->{RCid}, "del");
-
 
78
  display_form ($FORM->{'RCid'}, "View");
71
} elsif ($FORM->{'RCid'}) {
79
} elsif ($FORM->{'RCid'}) {
72
  display_form ($FORM->{'RCid'}, $FORM->{'SUB'});
80
  display_form ($FORM->{'RCid'}, $FORM->{'SUB'});
73
} else {
81
} else {
74
  $cookie_string = authenticate (1);
82
  $cookie_string = authenticate (1);
75
  my ($EM, $PWD, $AL) = split /&/, $cookie_string;
83
  my ($EM, $PWD, $AL) = split /&/, $cookie_string;
Line 88... Line 96...
88
  $F->{pronouns}    = WebDB::trim param ('pronouns')   // '';
96
  $F->{pronouns}    = WebDB::trim param ('pronouns')   // '';
89
  $F->{tshirt}      = WebDB::trim param ('tshirt')     // '';
97
  $F->{tshirt}      = WebDB::trim param ('tshirt')     // '';
90
  $F->{phone}       = WebDB::trim param ('phone')      // '';
98
  $F->{phone}       = WebDB::trim param ('phone')      // '';
91
  $F->{timeformat}  = WebDB::trim param ('timeformat') // '24hr';
99
  $F->{timeformat}  = WebDB::trim param ('timeformat') // '24hr';
92
  $F->{showme}      = WebDB::trim param ('showme') ? 1 : 0;
100
  $F->{showme}      = WebDB::trim param ('showme') ? 1 : 0;
-
 
101
  $F->{EMTVerified} = WebDB::trim param ('EMTVerified') ? 1 : 0;
93
  $F->{RCid}        = param ('RCid')       // '';
102
  $F->{RCid}        = param ('RCid')       // '';
94
  $F->{access}      = param ('access')     // 0;
103
  $F->{access}      = param ('access')     // 0;
95
  $F->{department}  = join ":", map { "$_-".param ("DEPT-".$_) } map { s/^DEPT-//; $_ } grep { param ($_) ne "" } grep { /^DEPT-/ } param ;
104
  $F->{department}  = join ":", map { "$_-".param ("DEPT-".$_) } map { s/^DEPT-//; $_ } grep { param ($_) ne "" } grep { /^DEPT-/ } param ;
Line 96... Line 105...
96
  
105
  
Line 146... Line 155...
146
      $ERRMSG = join $h->br, @ERRORS;
155
      $ERRMSG = join $h->br, @ERRORS;
147
      display_form ($F->{RCid}, "Edit", $ERRMSG, $F);
156
      display_form ($F->{RCid}, "Edit", $ERRMSG, $F);
148
    }
157
    }
Line -... Line 158...
-
 
158
    
-
 
159
    
-
 
160
    if ($ORCUSER->{department}->{EMT} >= RollerCon::LEAD or $AL >= RollerCon::SYSADMIN) {
-
 
161
      # Check for changes to the emt_verified field...
-
 
162
      if ($F->{EMTVerified} != $OG->{emt_verified}) {
-
 
163
        warn "Updating emt_verified for $OG->{derby_name} - $F->{EMTVerified} vs $OG->{emt_verified}";
-
 
164
        validate_emt ($F->{RCid}, $F->{EMTVerified} ? "add" : "del");
Line 149... Line 165...
149
    
165
      }
150
    
166
    }
Line 151... Line 167...
151
    
167
    
Line 182... Line 198...
182
        if (my $err = changeUser ($F->{RCid}, $field, $F->{$field})) {
198
        if (my $err = changeUser ($F->{RCid}, $field, $F->{$field})) {
183
          push @ERRORS, $err;
199
          push @ERRORS, $err;
184
          logit ($F->{RCid}, "DB ERROR: Updating User Details: $err");
200
          logit ($F->{RCid}, "DB ERROR: Updating User Details: $err");
185
        }
201
        }
186
      }
202
      }
187
 
-
 
188
 
-
 
189
    } else {
203
    } else {
190
      push @ERRORS, "Attempting to update someone else's record, and you don't have permission to do that.";
204
      push @ERRORS, "Attempting to update someone else's record, and you don't have permission to do that.";
191
      logit ($ORCUSER->{RCid}, "FAIL: You don't have access to update other people's user record");
205
      logit ($ORCUSER->{RCid}, "FAIL: You don't have access to update other people's user record");
192
    }
206
    }
193
  }
207
  }
Line 252... Line 266...
252
      }
266
      }
253
      $F->{RCid}       = $h->input ({ type=>"hidden", name=>"RCid", value=>$F->{RCid} })."$F->{RCid} ";
267
      $F->{RCid}       = $h->input ({ type=>"hidden", name=>"RCid", value=>$F->{RCid} })."$F->{RCid} ";
254
      $F->{buttons}    = join " ", $h->input ({ type=>"submit", name=>"submit", value=>"Save" }), $h->input ({ type=>"reset", value=>"Reset" }), $h->input ({ type=>"submit", name=>"submit", value=>"Cancel" });
268
      $F->{buttons}    = join " ", $h->input ({ type=>"submit", name=>"submit", value=>"Save" }), $h->input ({ type=>"reset", value=>"Reset" }), $h->input ({ type=>"submit", name=>"submit", value=>"Cancel" });
Line 255... Line 269...
255
            
269
            
-
 
270
      $F->{department} = convertDepartments ($F->{department});
-
 
271
      if (exists $F->{department}->{EMT} and ($ORCUSER->{department}->{EMT} >= RollerCon::LEAD or $ORCUSER->{access} >= RollerCon::SYSADMIN)) {
-
 
272
        if ($F->{emt_verified}) {
-
 
273
          $F->{EMTVerified} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"EMTVerified", value=>1, checked=>[] }), $h->span ({ class=>"slider round" })]);
-
 
274
        } else {
-
 
275
          $F->{EMTVerified} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"EMTVerified", value=>1 }), $h->span ({ class=>"slider round" })]);
-
 
276
        }
-
 
277
      }
256
      $F->{department} = convertDepartments ($F->{department});
278
      
257
      foreach my $k (keys %{$depts}) {
279
      foreach my $k (keys %{$depts}) {
258
        next if $k eq "CMP";
280
        next if $k eq "CMP";
259
        if ($ORCUSER->{access} > 4) {
281
        if ($ORCUSER->{access} > 4) {
260
          # SysAdmin can change anyone's department level
282
          # SysAdmin can change anyone's department level
Line 265... Line 287...
265
        } else {
287
        } else {
266
          # Or it's your own record, you can still submit a request to be added to the dept.
288
          # Or it's your own record, you can still submit a request to be added to the dept.
267
          if (!defined $F->{department}->{$k}) {
289
          if (!defined $F->{department}->{$k}) {
268
            $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);
290
            $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);
269
          } elsif ($F->{department}->{$k} == 0) {
291
          } elsif ($F->{department}->{$k} == 0) {
270
            $F->{department}->{$k} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"DEPT-$k", value=>0, checked=>[] }), $h->span ({ class=>"slider round" })]);           
292
            $F->{department}->{$k} = $h->label ({ class=>"switch" }, [$h->input ({ type=>"checkbox", name=>"DEPT-$k", value=>0, checked=>[] }), $h->span ({ class=>"slider round" })]);
271
          }
293
          }
272
        }
294
        }
273
      }
295
      }
274
    } else {
296
    } else {
275
      $ERRMSG = "Attempting to update someone else's record, and you don't have permission to do that.";
297
      $ERRMSG = "Attempting to update someone else's record, and you don't have permission to do that.";
Line 318... Line 340...
318
    my  $targetuser = getUser ($RCID);
340
    my  $targetuser = getUser ($RCID);
Line 319... Line 341...
319
 
341
 
320
    if (canView ($ORCUSER, $targetuser)) {
342
    if (canView ($ORCUSER, $targetuser)) {
321
      $F = $targetuser;
343
      $F = $targetuser;
-
 
344
      $F->{department} = convertDepartments ($F->{department});
-
 
345
      if (exists $F->{department}->{EMT}) {
-
 
346
        $F->{EMTVerified} = $F->{emt_verified} ? "True" : "False";
-
 
347
        if ($ORCUSER->{department}->{EMT} >= RollerCon::LEAD or $AL >= RollerCon::SYSADMIN) {
-
 
348
					if ($F->{emt_verified}) {
-
 
349
						$F->{EMTVerified} = "True"."  ".$h->input ({ type=>"submit", name=>"submit", value=>"Remove" });
-
 
350
					} else {
-
 
351
						$F->{EMTVerified} = "False"."  ".$h->input ({ type=>"submit", name=>"submit", value=>"Verify" });
-
 
352
	      	}
-
 
353
        }
322
      $F->{department} = convertDepartments ($F->{department});
354
      }
323
      $F->{access} = $AccessLevel->{$F->{access}};
355
      $F->{access} = $AccessLevel->{$F->{access}};
324
      $F->{showme} = $F->{showme} ? "True" : "False";
356
      $F->{showme} = $F->{showme} ? "True" : "False";
325
      $F->{'password'} = "*******";
357
      $F->{'password'} = "*******";
Line 412... Line 444...
412
        $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "Database ID: ",             $F->{RCid}) ]),
444
        $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "Database ID: ",             $F->{RCid}) ]),
413
        $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "User Added: ",              $F->{added}) ]),
445
        $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "User Added: ",              $F->{added}) ]),
414
        $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "Last Login: ",              $F->{last_login}) ]),
446
        $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "Last Login: ",              $F->{last_login}) ]),
415
        $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "vORC Access Level: ",       $F->{access}) ]),
447
        $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "vORC Access Level: ",       $F->{access}) ]),
416
        $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "MVP Pass: ",                $F->{MVPid}) ]),
448
        $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "MVP Pass: ",                $F->{MVPid}) ]),
-
 
449
        exists $F->{EMTVerified} ? $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "EMT Verified: ",                $F->{EMTVerified}) ]) : "",
417
        @printDepartments,
450
        @printDepartments,
418
        $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCell" }, " ") ]),
451
        $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCell" }, " ") ]),
419
        $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, $h->a ({ href=>$goback }, "[go back]"), $F->{buttons}) ])
452
        $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, $h->a ({ href=>$goback }, "[go back]"), $F->{buttons}) ])
420
      ])
453
      ])
421
    ])
454
    ])