version 1.13, 2008/11/04 03:25:53
|
version 1.16, 2016/10/22 01:53:27
|
Line 61 use HTML::Entities();
|
Line 61 use HTML::Entities();
|
# Course personnel elements include: |
# Course personnel elements include: |
# [0] Last, First of the user. |
# [0] Last, First of the user. |
# [1] Role held by the user. |
# [1] Role held by the user. |
# [2] Empty. |
# [2] Section associated with role. |
# [3] Empty |
# [3] Empty |
# [4] username:domain of the user. |
# [4] username:domain of the user. |
# |
# |
Line 74 use HTML::Entities();
|
Line 74 use HTML::Entities();
|
# [4] username:domain of the user. |
# [4] username:domain of the user. |
# |
# |
sub get_people_in_class { |
sub get_people_in_class { |
my ($section_restriction) = @_; |
my ($section_restriction,$personnel_section) = @_; |
my %coursepersonnel = &Apache::lonnet::get_course_adv_roles(); |
my %coursepersonnel = &Apache::lonnet::get_course_adv_roles($env{'request.course.id'},1); |
|
my $crstype = &Apache::loncommon::course_type(); |
# |
# |
# Enumerate the course_personnel. |
# Enumerate the course_personnel. |
# |
# |
my @course_personnel; |
my @course_personnel; |
for my $role (sort(keys(%coursepersonnel))) { |
foreach my $key (sort(keys(%coursepersonnel))) { |
|
my ($role,$section) = split(/:/,$key); |
# extract the names so we can sort them |
# extract the names so we can sort them |
|
next if (($personnel_section ne '') && ($personnel_section ne $section)); |
my @people; |
my @people; |
for my $person (split(/,/, $coursepersonnel{$role})) { |
|
|
foreach my $person (split(/,/, $coursepersonnel{$key})) { |
my ($uname,$domain) = split(/:/, $person); |
my ($uname,$domain) = split(/:/, $person); |
push(@people, [&Apache::loncommon::plainname($uname,$domain), |
push(@people, [&Apache::loncommon::plainname($uname,$domain), |
$uname,$domain]); |
$uname,$domain]); |
} |
} |
@people = sort { $a->[0] cmp $b->[0] } (@people); |
@people = sort { $a->[0] cmp $b->[0] } (@people); |
|
|
for my $person (@people) { |
foreach my $person (@people) { |
push(@course_personnel, [join(':', $person->[1],$person->[2]), |
push(@course_personnel, [join(':', $person->[1],$person->[2]), |
$person->[0], '', '', $role]); |
$person->[0], $section, 'Active', |
|
&Apache::lonnet::plaintext($role)]); |
} |
} |
} |
} |
# Students must be split into the three categories: |
# Students must be split into the three categories: |
Line 179 sub get_people_in_class {
|
Line 184 sub get_people_in_class {
|
# and false for all other calls... only matters if |
# and false for all other calls... only matters if |
# multiselect is true. |
# multiselect is true. |
# $context - If email, do not include <br /><hr /> tags at the end |
# $context - If email, do not include <br /><hr /> tags at the end |
# of the data table. |
# of the data table. |
# Returns: |
# Returns: |
# HTML text to add to the rendering of the helper. |
# HTML text to add to the rendering of the helper. |
# |
# |
Line 197 sub render_student_list {
|
Line 202 sub render_student_list {
|
<script type="text/javascript"> |
<script type="text/javascript"> |
// <!-- |
// <!-- |
|
|
function findElement(name) { |
function findElement(name,formname) { |
var i; |
var i; |
var ele; |
var ele; |
for(i =0; i < document.forms.$formname.elements.length; i++) { |
for(i =0; i < formname.elements.length; i++) { |
ele = document.forms.$formname.elements[i]; |
ele = formname.elements[i]; |
if(ele.name == name) { |
if(ele.name == name) { |
return ele; |
return ele; |
} |
} |
Line 232 sub render_student_list {
|
Line 237 sub render_student_list {
|
} |
} |
} |
} |
|
|
function setAllStudents(value, which) { |
function setAllStudents(value, which, formname) { |
var i; |
var i; |
var ele; |
var ele; |
for (i =0; i < document.forms.$formname.elements.length; i++) { |
for (i =0; i < formname.elements.length; i++) { |
ele = document.forms.$formname.elements[i]; |
ele = formname.elements[i]; |
if(isStudent(ele) && rightSubForm(ele, which)) { |
if(isStudent(ele) && rightSubForm(ele, which)) { |
ele.checked=value; |
ele.checked=value; |
} |
} |
} |
} |
} |
} |
function setAllCoursePersonnel(value, which) { |
function setAllCoursePersonnel(value, which, formname) { |
var i; |
var i; |
var ele; |
var ele; |
for (i =0; i < document.forms.$formname.elements.length; i++) { |
for (i =0; i < formname.elements.length; i++) { |
ele = document.forms.$formname.elements[i]; |
ele = formname.elements[i]; |
if(!isStudent(ele) && rightSubForm(ele, which)) { |
if(!isStudent(ele) && rightSubForm(ele, which)) { |
ele.checked = value; |
ele.checked = value; |
} |
} |
} |
} |
} |
} |
function setSection(which, value, subform) { |
function setSection(which, value, subform, formname) { |
var i; |
var i; |
var ele; |
var ele; |
for (i =0; i < document.forms.$formname.elements.length; i++) { |
for (i =0; i < formname.elements.length; i++) { |
ele = document.forms.$formname.elements[i]; |
ele = formname.elements[i]; |
if (ele.value.indexOf(':') != -1) { |
if (ele.value.indexOf(':') != -1) { |
if ((section(ele) == which) && rightSubForm(ele, subform)) { |
if ((section(ele) == which) && rightSubForm(ele, subform)) { |
ele.checked = value; |
ele.checked = value; |
Line 265 sub render_student_list {
|
Line 270 sub render_student_list {
|
} |
} |
} |
} |
|
|
function setCheckboxes(listbox, which, value) { |
function setCheckboxes(listbox, which, value, formname) { |
var k; |
var k; |
var elem; |
var elem; |
var what; |
var what; |
elem = findElement(listbox); |
elem = findElement(listbox, formname); |
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].value; |
what = elem.options[k].value; |
if (what == 'allstudents') { |
if (what == 'allstudents') { |
setAllStudents(value, which); |
setAllStudents(value, which, formname); |
} else if (what == 'allpersonnel') { |
} else if (what == 'allpersonnel') { |
setAllCoursePersonnel(value, which); |
setAllCoursePersonnel(value, which, formname); |
} else if (what == 'nosection') { |
} else if (what == 'nosection') { |
setSection('',value, which); |
setSection('',value, which, formname); |
} else { |
} else { |
setSection(what, value, which); |
setSection(what, value, which, formname); |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
function selectSections(listbox, which) { |
function selectSections(listbox, which, formname) { |
setCheckboxes(listbox, which, true); |
setCheckboxes(listbox, which, true, formname); |
|
|
} |
} |
function unselectSections(listbox, which) { |
function unselectSections(listbox, which, formname) { |
setCheckboxes(listbox, which, false); |
setCheckboxes(listbox, which, false, formname); |
} |
} |
|
|
// --> |
// --> |
Line 323 SCRIPT
|
Line 328 SCRIPT
|
if ($size > 5) { |
if ($size > 5) { |
$size = 5; |
$size = 5; |
} |
} |
$result .= '<select multiple name="'.$formprefix |
$result .= '<select multiple="multiple" name="'.$formprefix |
.'.chosensections" size="'.$size.'">'."\n"; |
.'.chosensections" size="'.$size.'">'."\n"; |
$result .= '<option value="allstudents">'.&mt('All Students').'</option>'; |
$result .= '<option value="allstudents">'.&mt('All Students').'</option>'; |
$result .= '<option value="allpersonnel">'.&mt('All Course Personnel').'</option>'; |
$result .= '<option value="allpersonnel">'.&mt('All Course Personnel').'</option>'; |
$result .= '<option value="nosection">'.&mt('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 value="'.$sec.'">'.$sec.'</option>'."\n"; |
} |
} |
$result .= '</select></td><td valign="top">'; |
$result .= '</select></td><td valign="top">'; |
$result .= '<input type="button" name="'.$formprefix.'.select" value="'.&mt('Select').'" onclick=' |
$result .= '<input type="button" name="'.$formprefix.'.select" value="'.&mt('Select').'" onclick=' |
."'selectSections(\"$formprefix.chosensections\", \"$formprefix\")'".' /></td>'; |
."'selectSections(\"$formprefix.chosensections\", \"$formprefix\", document.forms.$formname)'".' /></td>'; |
$result .= '<td valign="top"><input type="button" name="'.$formprefix |
$result .= '<td valign="top"><input type="button" name="'.$formprefix |
.'.unselect" value="'.&mt('Unselect').'" onclick='. |
.'.unselect" value="'.&mt('Unselect').'" onclick='. |
"'unselectSections(\"$formprefix.chosensections\", \"$formprefix\")' ".' /></td></tr></table>'; |
"'unselectSections(\"$formprefix.chosensections\", \"$formprefix\", document.forms.$formname)' ".' /></td></tr></table>'; |
} |
} |
|
|
# Now we list the students, but the form element type |
# Now we list the students, but the form element type |