--- loncom/interface/lonhelper.pm 2006/04/24 23:20:37 1.138
+++ loncom/interface/lonhelper.pm 2006/05/11 21:10:21 1.148
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# .helper XML handler to implement the LON-CAPA helper
#
-# $Id: lonhelper.pm,v 1.138 2006/04/24 23:20:37 albertel Exp $
+# $Id: lonhelper.pm,v 1.148 2006/05/11 21:10:21 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -183,6 +183,7 @@ use Apache::File;
use Apache::lonxml;
use Apache::lonlocal;
use Apache::lonnet;
+use Apache::lonselstudent;
# Register all the tags with the helper, so the helper can
# push and pop them
@@ -2318,113 +2319,6 @@ sub render {
my $buttons = '';
my $var = $self->{'variable'};
- if ($self->{'multichoice'}) {
- $result = <
-SCRIPT
-
- my %lt=&Apache::lonlocal::texthash(
- 'ocs' => "Select Only Current Students",
- 'ues' => "Unselect Expired Students",
- 'sas' => "Select All Students",
- 'uas' => "Unselect All Students",
- 'sfsg' => "Select Current Students for Section/Group",
- 'ufsg' => "Unselect for Section/Group");
-
- $buttons = <
-
';
@@ -2442,203 +2336,52 @@ BUTTONS
%defaultUsers = map { if ($_) {($_,1) } } @defaultUsers;
delete($defaultUsers{''});
}
- my $choices = [];
- my $expired_students = []; # Will hold expired students.
- # Load up the non-students, if necessary
- if ($self->{'coursepersonnel'}) {
- my %coursepersonnel = Apache::lonnet::get_course_adv_roles();
- for (sort keys %coursepersonnel) {
- for my $role (split /,/, $coursepersonnel{$_}) {
- # extract the names so we can sort them
- my @people;
-
- for (split /,/, $role) {
- push @people, [split /:/, $role];
- }
-
- @people = sort { $a->[0] cmp $b->[0] } @people;
-
- for my $person (@people) {
- push @$choices, [join(':', @$person), $person->[0], '', $_];
- }
- }
- }
- }
- # Constants
- my $section = Apache::loncoursedata::CL_SECTION();
- my $fullname = Apache::loncoursedata::CL_FULLNAME();
- my $status = Apache::loncoursedata::CL_STATUS();
+ my ($course_personnel,
+ $current_members,
+ $expired_members,
+ $future_members) = &Apache::lonselstudent::get_people_in_class();
- # Load up the students
- my $classlist = &Apache::loncoursedata::get_classlist();
- my @keys = keys %{$classlist};
- # Sort by: Section, name
- @keys = sort {
- if ($classlist->{$a}->[$section] ne $classlist->{$b}->[$section]) {
- return $classlist->{$a}->[$section] cmp $classlist->{$b}->[$section];
- }
- return $classlist->{$a}->[$fullname] cmp $classlist->{$b}->[$fullname];
- } @keys;
- #
- # now add the fancy section choice... first enumerate the sections:
- if ($self->{'multichoice'}) {
- my %sections;
- for my $key (@keys) {
- my $section_name = $classlist->{$key}->[$section];
- if ($section_name ne "") {
- $sections{$section_name} = 1;
- }
- }
- # The variable $choice_widget will have the html to make the choice
- # selector.
- my $size=5;
- if (scalar(keys(%sections)) < 5) {
- $size=scalar(keys(%sections));
- }
- my $choice_widget = '\n";
- # Build a table without any borders to contain the section based
- # selection:
- my $section_selectors =<
-