version 1.7, 2006/05/23 21:41:26
|
version 1.10, 2007/11/01 19:56:39
|
Line 28
|
Line 28
|
|
|
package Apache::lonselstudent; |
package Apache::lonselstudent; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncoursedata; |
use Apache::lonlocal; |
use HTML::Entities; |
use Apache::loncoursedata(); |
|
use HTML::Entities(); |
|
|
# |
# |
# Utility function used when rendering <student> tags. |
# Utility function used when rendering <student> tags. |
Line 112 sub get_people_in_class {
|
Line 113 sub get_people_in_class {
|
my @keys = keys(%{$classlist}); |
my @keys = keys(%{$classlist}); |
# Sort by: Section, name |
# Sort by: Section, name |
@keys = sort { |
@keys = sort { |
if ($classlist->{$a}->[$section] ne $classlist->{$b}->[$section]) { |
lc($classlist->{$a}[$section]) cmp lc($classlist->{$b}[$section]) || |
return $classlist->{$a}->[$section] cmp $classlist->{$b}->[$section]; |
lc($classlist->{$a}[$fullname]) cmp lc($classlist->{$b}[$fullname]) || |
} |
lc($a) cmp lc($b) |
return $classlist->{$a}->[$fullname] cmp $classlist->{$b}->[$fullname]; |
|
} (@keys); |
} (@keys); |
|
|
|
|
Line 188 sub render_student_list {
|
Line 188 sub render_student_list {
|
|
|
my $result = ""; |
my $result = ""; |
|
|
|
# no students so no output |
|
return if (!@$students); |
|
|
if ($javascript && $multiselect) { |
if ($javascript && $multiselect) { |
$result .= <<SCRIPT; |
$result .= <<SCRIPT; |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 269 sub render_student_list {
|
Line 272 sub render_student_list {
|
if (elem != null) { |
if (elem != null) { |
for (k = 0; k < elem.length; k++) { |
for (k = 0; k < elem.length; k++) { |
if (elem.options[k].selected) { |
if (elem.options[k].selected) { |
what = elem.options[k].text; |
what = elem.options[k].value; |
if (what == 'All Students') { |
if (what == 'allstudents') { |
setAllStudents(value, which); |
setAllStudents(value, which); |
} else if (what == 'All Course Personnel') { |
} else if (what == 'allpersonnel') { |
setAllCoursePersonnel(value, which); |
setAllCoursePersonnel(value, which); |
} else if (what == 'No Section') { |
} else if (what == 'nosection') { |
setSection('',value, which); |
setSection('',value, which); |
} else { |
} else { |
setSection(what, value, which); |
setSection(what, value, which); |
Line 321 SCRIPT
|
Line 324 SCRIPT
|
} |
} |
$result .= '<select multiple name="'.$formprefix |
$result .= '<select multiple name="'.$formprefix |
.'.chosensections" size="'.$size.'">'."\n"; |
.'.chosensections" size="'.$size.'">'."\n"; |
$result .= '<option name="allstudents">All Students</option>'; |
$result .= '<option value="allstudents">'.&mt('All Students').'</option>'; |
$result .= '<option name="allpersonnel">All Course Personnel</option>'; |
$result .= '<option value="allpersonnel">'.&mt('All Course Personnel').'</option>'; |
$result .= '<option name="nosection">No Section</option>'; |
$result .= '<option value="nosection">'.&mt('No Section').'</option>'; |
$result .= "\n"; |
$result .= "\n"; |
foreach my $sec (sort {lc($a) cmp lc($b)} (keys(%sections))) { |
foreach my $sec (sort {lc($a) cmp lc($b)} (keys(%sections))) { |
$result .= '<option name="'.$sec.'">'.$sec.'</option>'."\n"; |
$result .= '<option name="'.$sec.'">'.$sec.'</option>'."\n"; |
} |
} |
$result .= '</td><td valign="top">'; |
$result .= '</td><td valign="top">'; |
$result .= '<input type="button" name="'.$formprefix.'.select" value="Select" onclick=' |
$result .= '<input type="button" name="'.$formprefix.'.select" value="'.'Select" onclick=' |
."'selectSections(\"$formprefix.chosensections\", \"$formprefix\")'".' /></td>'; |
."'selectSections(\"$formprefix.chosensections\", \"$formprefix\")'".' /></td>'; |
$result .= '<td valign="top"><input type="button" name="'.$formprefix |
$result .= '<td valign="top"><input type="button" name="'.$formprefix |
.'.unselect" value="Unselect" onclick='. |
.'.unselect" value="'.&mt('Unselect').'" onclick='. |
"'unselectSections(\"$formprefix.chosensections\", \"$formprefix\")' ".' /></td></tr></table>'; |
"'unselectSections(\"$formprefix.chosensections\", \"$formprefix\")' ".' /></td></tr></table>'; |
} |
} |
|
|
Line 343 SCRIPT
|
Line 346 SCRIPT
|
|
|
$result .= &Apache::loncommon::start_data_table(); |
$result .= &Apache::loncommon::start_data_table(); |
$result .= &Apache::loncommon::start_data_table_header_row(); |
$result .= &Apache::loncommon::start_data_table_header_row(); |
$result .= '<th></th><th>Name</th>'."\n"; |
$result .= '<th></th><th>'.&mt('Name').'</th>'."\n"; |
$result .= ' <th>Section</th>'."\n"; |
$result .= ' <th>'.&mt('Section').'</th>'."\n"; |
$result .= ' <th>Status</th>'."\n"; |
$result .= ' <th>'.&mt('Status').'</th>'."\n"; |
$result .= ' <th>Role</th>'."\n"; |
$result .= ' <th>'.&mt('Role').'</th>'."\n"; |
$result .= ' <th>Username : Domain</th>'."\n"; |
$result .= ' <th>'.&mt('Username : Domain').'</th>'."\n"; |
$result .= &Apache::loncommon::end_data_table_header_row(); |
$result .= &Apache::loncommon::end_data_table_header_row(); |
|
|
my $input_type; |
my $input_type; |
Line 361 SCRIPT
|
Line 364 SCRIPT
|
for my $student (@$students) { |
for my $student (@$students) { |
$result .= &Apache::loncommon::start_data_table_row(). |
$result .= &Apache::loncommon::start_data_table_row(). |
'<td><input type="'.$input_type.'" name="'. |
'<td><input type="'.$input_type.'" name="'. |
$resultname.".forminput".'"'; |
$resultname."_forminput".'"'; |
my $user = $student->[0]; |
my $user = $student->[0]; |
|
|
# Figure out which students are checked by default... |
# Figure out which students are checked by default... |