| … | |
… | |
| 720 | return 1 if $howManyCan eq "one" && $forOneUser; |
720 | return 1 if $howManyCan eq "one" && $forOneUser; |
| 721 | return 0 if $howManyCan eq "all" && $forUsers; |
721 | return 0 if $howManyCan eq "all" && $forUsers; |
| 722 | return 0; # FIXME: maybe it should default to 1? |
722 | return 0; # FIXME: maybe it should default to 1? |
| 723 | } |
723 | } |
| 724 | |
724 | |
| 725 | # overrides regular "Set Detail" title with "Set Detail for set 15" |
|
|
| 726 | sub title { |
|
|
| 727 | my ($self) = @_; |
|
|
| 728 | my $r = $self->r; |
|
|
| 729 | my $setName = $r->urlpath->arg("setID"); |
|
|
| 730 | |
|
|
| 731 | print $r->urlpath->name . " for set $setName "; |
|
|
| 732 | |
|
|
| 733 | return ""; |
|
|
| 734 | } |
|
|
| 735 | |
|
|
| 736 | # Creates two separate tables, first of the headers, and the of the problems in a given set |
725 | # Creates two separate tables, first of the headers, and the of the problems in a given set |
| 737 | # If one or more users are specified in the "editForUser" param, only the data for those users |
726 | # If one or more users are specified in the "editForUser" param, only the data for those users |
| 738 | # becomes editable, not all the data |
727 | # becomes editable, not all the data |
| 739 | sub body { |
728 | sub body { |
| 740 | |
729 | |
| … | |
… | |
| 767 | return CGI::div({class=>"ResultsWithError"}, "You are not authorized to modify problems.") |
756 | return CGI::div({class=>"ResultsWithError"}, "You are not authorized to modify problems.") |
| 768 | unless $authz->hasPermissions($r->param("user"), "modify_problem_sets"); |
757 | unless $authz->hasPermissions($r->param("user"), "modify_problem_sets"); |
| 769 | |
758 | |
| 770 | |
759 | |
| 771 | my $userCount = $db->listUsers(); |
760 | my $userCount = $db->listUsers(); |
|
|
761 | my $setCount = $db->listGlobalSets() if $forOneUser; |
| 772 | my $setUserCount = $db->countSetUsers($setName); |
762 | my $setUserCount = $db->countSetUsers($setName); |
|
|
763 | my $userSetCount = $db->countUserSets($editForUser[0]) if $forOneUser; |
| 773 | my $editUsersAssignedToSetURL = $self->systemLink( |
764 | my $editUsersAssignedToSetURL = $self->systemLink( |
| 774 | $urlpath->newFromModule( |
765 | $urlpath->newFromModule( |
| 775 | "WeBWorK::ContentGenerator::Instructor::UsersAssignedToSet", |
766 | "WeBWorK::ContentGenerator::Instructor::UsersAssignedToSet", |
| 776 | courseID => $courseName, setID => $setName)); |
767 | courseID => $courseName, setID => $setName)); |
|
|
768 | my $editSetsAssignedToUserURL = $self->systemLink( |
|
|
769 | $urlpath->newFromModule( |
|
|
770 | "WeBWorK::ContentGenerator::Instructor::SetsAssignedToUser", |
|
|
771 | courseID => $courseName, userID => $editForUser[0])) if $forOneUser; |
|
|
772 | |
| 777 | |
773 | |
| 778 | my $setDetailPage = $urlpath -> newFromModule($urlpath->module, courseID => $courseName, setID => $setName); |
774 | my $setDetailPage = $urlpath -> newFromModule($urlpath->module, courseID => $courseName, setID => $setName); |
| 779 | my $setDetailURL = $self->systemLink($setDetailPage,authen=>0); |
775 | my $setDetailURL = $self->systemLink($setDetailPage,authen=>0); |
| 780 | |
776 | |
| 781 | |
777 | |
| 782 | my $userCountMessage = CGI::a({href=>$editUsersAssignedToSetURL}, |
778 | my $userCountMessage = CGI::a({href=>$editUsersAssignedToSetURL}, $self->userCountMessage($setUserCount, $userCount)); |
| 783 | $self->userCountMessage($setUserCount, $userCount)); |
779 | my $setCountMessage = CGI::a({href=>$editSetsAssignedToUserURL}, $self->setCountMessage($userSetCount, $setCount)) if $forOneUser; |
| 784 | |
780 | |
| 785 | $userCountMessage = "The set $setName is assigned to " . $userCountMessage . "."; |
781 | $userCountMessage = "The set $setName is assigned to " . $userCountMessage . "."; |
|
|
782 | $setCountMessage = "The user $editForUser[0] has been assigned " . $setCountMessage . "." if $forOneUser; |
| 786 | |
783 | |
| 787 | |
|
|
| 788 | if (@editForUser) { |
784 | if ($forUsers) { |
| 789 | print CGI::p("$userCountMessage Editing user-specific overrides for ". CGI::b(join ", ", @editForUser)); |
785 | print CGI::p("$userCountMessage Editing user-specific overrides for ". CGI::b(join ", ", @editForUser)); |
|
|
786 | if ($forOneUser) { |
|
|
787 | print CGI::p($setCountMessage); |
|
|
788 | } |
| 790 | } else { |
789 | } else { |
| 791 | print CGI::p($userCountMessage); |
790 | print CGI::p($userCountMessage); |
| 792 | } |
791 | } |
|
|
792 | |
| 793 | |
793 | |
| 794 | |
794 | |
| 795 | my %properties = %{ FIELD_PROPERTIES() }; |
795 | my %properties = %{ FIELD_PROPERTIES() }; |
| 796 | |
796 | |
| 797 | my %display_modes = %{WeBWorK::PG::DISPLAY_MODES()}; |
797 | my %display_modes = %{WeBWorK::PG::DISPLAY_MODES()}; |