From: Sam H. v. a. <we...@ma...> - 2005-10-08 21:56:40
|
Log Message: ----------- modify usage of user status to take advantage of new status system. the=20 most extensive change is in UserList, where the names of statuses are=20 now shown in the status column along with the abbreviation that's=20 actually set in the database, and the edit popup shows the actual names=20 that are defined in global.conf. Modified Files: -------------- webwork2/lib/WeBWorK/ContentGenerator: Grades.pm webwork2/lib/WeBWorK/ContentGenerator/Instructor: AddUsers.pm SendMail.pm Stats.pm StudentProgress.pm UserList.pm Revision Data ------------- Index: Grades.pm =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Grade= s.pm,v retrieving revision 1.17 retrieving revision 1.18 diff -Llib/WeBWorK/ContentGenerator/Grades.pm -Llib/WeBWorK/ContentGenera= tor/Grades.pm -u -r1.17 -r1.18 --- lib/WeBWorK/ContentGenerator/Grades.pm +++ lib/WeBWorK/ContentGenerator/Grades.pm @@ -148,12 +148,15 @@ $text =3D join( '', <FILE>); close(FILE); =09 + my $status_name =3D $ce->status_abbrev_to_name($ur->status); + $status_name =3D $ur->status unless defined $status_name; +=09 my $SID =3D $ur->student_id; my $FN =3D $ur->first_name; my $LN =3D $ur->last_name; my $SECTION =3D $ur->section; my $RECITATION =3D $ur->recitation; - my $STATUS =3D $ur->status; + my $STATUS =3D $status_name; my $EMAIL =3D $ur->email_address; my $LOGIN =3D $ur->user_id; my @COL =3D defined($rh_merge_data->{$SID}) ? @{$rh_merge_dat= a->{$SID} } : (); @@ -161,6 +164,7 @@ =20 my $endCol =3D @COL; # for safety, only evaluate special variables + # FIXME /e is not required for simple variable interpolation my $msg =3D $text;=20 $msg =3D~ s/(\$PAR)/<p>/ge; $msg =3D~ s/(\$BR)/<br>/ge; Index: Stats.pm =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Instr= uctor/Stats.pm,v retrieving revision 1.58 retrieving revision 1.59 diff -Llib/WeBWorK/ContentGenerator/Instructor/Stats.pm -Llib/WeBWorK/Con= tentGenerator/Instructor/Stats.pm -u -r1.58 -r1.59 --- lib/WeBWorK/ContentGenerator/Instructor/Stats.pm +++ lib/WeBWorK/ContentGenerator/Instructor/Stats.pm @@ -324,7 +324,7 @@ next unless ref($studentRecord); my $student =3D $studentRecord->user_id; next if $studentRecord->last_name =3D~/^practice/i; # don't show prac= tice users - next if $studentRecord->status !~/C/; # don't show droppe= d students FIXME + next unless $ce->status_abbrev_has_behavior($studentRecord->status, "i= nclude_in_stats"); $number_of_active_students++; my $string =3D ''; my $twoString =3D ''; Index: SendMail.pm =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Instr= uctor/SendMail.pm,v retrieving revision 1.42 retrieving revision 1.43 diff -Llib/WeBWorK/ContentGenerator/Instructor/SendMail.pm -Llib/WeBWorK/= ContentGenerator/Instructor/SendMail.pm -u -r1.42 -r1.43 --- lib/WeBWorK/ContentGenerator/Instructor/SendMail.pm +++ lib/WeBWorK/ContentGenerator/Instructor/SendMail.pm @@ -165,7 +165,9 @@ # =20 foreach my $ur (@user_records) { - push(@send_to,$ur->user_id) if $ur->status eq 'C' and not($ur->user_i= d =3D~ /practice/); + push(@send_to,$ur->user_id) + if $ce->status_abbrev_has_behavior($ur->status, "include_in_email") + and not $ur->user_id =3D~ /practice/; } } elsif (defined($recipients) and $recipients eq 'studentID' ) { @send_to =3D $r->param('classList'); @@ -938,13 +940,17 @@ my $text =3D defined($self->{r_text}) ? ${ $self->{r_text} }: 'FIXME no text was produced by initialization!!= ';=09 my $merge_file =3D ( defined($self->{merge_file}) ) ? $self->{merg= e_file} : 'None'; =20 +=09 + my $status_name =3D $self->r->ce->status_abbrev_to_name($ur->status); + $status_name =3D $ur->status unless defined $status_name; +=09 #user macros that can be used in the email message my $SID =3D $ur->student_id; my $FN =3D $ur->first_name; my $LN =3D $ur->last_name; my $SECTION =3D $ur->section; my $RECITATION =3D $ur->recitation; - my $STATUS =3D $ur->status; + my $STATUS =3D $status_name; my $EMAIL =3D $ur->email_address; my $LOGIN =3D $ur->user_id; =09 @@ -984,9 +990,9 @@ } =20 =20 -# =CA sub data_format { +# =DD sub data_format { #=20 -# =CA =CA =CA =CA =CAmap {$_ =3D~s/\s/\./g;$_} =CA =CA map {sprintf('%-8= .8s',$_);} =CA@_; +# =DD =DD =DD =DD =DDmap {$_ =3D~s/\s/\./g;$_} =DD =DD map {sprintf('%-8= .8s',$_);} =DD@_; sub data_format { map {"COL[$_]".' 'x(3-length($_));} @_; # problems if $_ ha= s length bigger than 4 } Index: UserList.pm =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Instr= uctor/UserList.pm,v retrieving revision 1.72 retrieving revision 1.73 diff -Llib/WeBWorK/ContentGenerator/Instructor/UserList.pm -Llib/WeBWorK/= ContentGenerator/Instructor/UserList.pm -u -r1.72 -r1.73 --- lib/WeBWorK/ContentGenerator/Instructor/UserList.pm +++ lib/WeBWorK/ContentGenerator/Instructor/UserList.pm @@ -136,20 +136,21 @@ access =3D> "readwrite", }, status =3D> { - type =3D> "enumerable", + #type =3D> "enumerable", + type =3D> "status", size =3D> 4, access =3D> "readwrite", - items =3D> { - "C" =3D> "Enrolled", - "D" =3D> "Drop", - "A" =3D> "Audit", - }, - synonyms =3D> { - qr/^[ce]/i =3D> "C", - qr/^[dw]/i =3D> "D", - qr/^a/i =3D> "A", - "*" =3D> "C", - } + #items =3D> { + # "C" =3D> "Enrolled", + # "D" =3D> "Drop", + # "A" =3D> "Audit", + #}, + #synonyms =3D> { + # qr/^[ce]/i =3D> "C", + # qr/^[dw]/i =3D> "D", + # qr/^a/i =3D> "A", + # "*" =3D> "C", + #} }, section =3D> { type =3D> "text", @@ -1385,6 +1386,7 @@ =20 sub fieldEditHTML { my ($self, $fieldName, $value, $properties) =3D @_; + my $ce =3D $self->r->ce; my $size =3D $properties->{size}; my $type =3D $properties->{type}; my $access =3D $properties->{access}; @@ -1400,6 +1402,13 @@ } =09 if ($access eq "readonly") { + # hack for status + if ($type eq "status") { + my $status_name =3D $ce->status_abbrev_to_name($value); + if (defined $status_name) { + $value =3D "$status_name ($value)"; + } + } return $value; } =09 @@ -1429,6 +1438,31 @@ labels =3D> $items, }); } +=09 + if ($type eq "status") { + # we used to surreptitously map synonyms to a canonical value... + # so should we continue to do that? + my $status_name =3D $ce->status_abbrev_to_name($value); + if (defined $status_name) { + $value =3D ($ce->status_name_to_abbrevs($status_name))[0]; + } + =09 + my (@values, %labels); + while (my ($k, $v) =3D each %{$ce->{statuses}}) { + my @abbrevs =3D @{$v->{abbrevs}}; + push @values, $abbrevs[0]; + foreach my $abbrev (@abbrevs) { + $labels{$abbrev} =3D $k; + } + } + =09 + return CGI::popup_menu({ + name =3D> $fieldName,=20 + values =3D> \@values, + default =3D> $value, + labels =3D> \%labels, + }); + } } =20 sub recordEditHTML { Index: StudentProgress.pm =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Instr= uctor/StudentProgress.pm,v retrieving revision 1.20 retrieving revision 1.21 diff -Llib/WeBWorK/ContentGenerator/Instructor/StudentProgress.pm -Llib/W= eBWorK/ContentGenerator/Instructor/StudentProgress.pm -u -r1.20 -r1.21 --- lib/WeBWorK/ContentGenerator/Instructor/StudentProgress.pm +++ lib/WeBWorK/ContentGenerator/Instructor/StudentProgress.pm @@ -384,7 +384,7 @@ next unless ref($studentRecord); my $student =3D $studentRecord->user_id; next if $studentRecord->last_name =3D~/^practice/i; # don't show prac= tice users - next if $studentRecord->status !~/C/; # don't show droppe= d students FIXME + next unless $ce->status_abbrev_has_behavior($studentRecord->status, "i= nclude_in_stats"); $number_of_active_students++; =20 # build list of versioned sets for this student user Index: AddUsers.pm =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Instr= uctor/AddUsers.pm,v retrieving revision 1.18 retrieving revision 1.19 diff -Llib/WeBWorK/ContentGenerator/Instructor/AddUsers.pm -Llib/WeBWorK/= ContentGenerator/Instructor/AddUsers.pm -u -r1.18 -r1.19 --- lib/WeBWorK/ContentGenerator/Instructor/AddUsers.pm +++ lib/WeBWorK/ContentGenerator/Instructor/AddUsers.pm @@ -66,7 +66,7 @@ $newUser->section(trim_spaces($r->param("section_$i"))); $newUser->recitation(trim_spaces($r->param("recitation_$i"))); $newUser->comment(trim_spaces($r->param("comment_$i"))); - $newUser->status('C'); + $newUser->status($ce->status_name_to_abbrev($ce->{default_status})); $newPermissionLevel->permission(0); #FIXME handle errors if user exists already eval { $db->addUser($newUser) }; |