--- loncom/interface/Attic/londropadd.pm 2004/06/17 18:31:24 1.114 +++ loncom/interface/Attic/londropadd.pm 2004/06/29 04:30:00 1.115 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to drop and add students in courses # -# $Id: londropadd.pm,v 1.114 2004/06/17 18:31:24 raeburn Exp $ +# $Id: londropadd.pm,v 1.115 2004/06/29 04:30:00 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1231,8 +1231,7 @@ END 'sec' => "section", 'start' => "start date", 'end' => "end date", - 'type' => "enroll type", - 'chan' => "change" + 'type' => "enroll type/action" ); unless ($mode eq 'autoenroll') { $r->print(<<END); @@ -1240,11 +1239,22 @@ END <input type="hidden" name="sdom" value="" /> END } - $r->print(<<END); + $r->print(" <p> <table border=2> -<tr><th>Count - </th><th> +<tr> + "); + if ($mode eq 'autoenroll') { + $r->print(" + <th><a href=\"javascript:document.studentform.sortby.value='type';document.studentform.submit();\">$lt{'type'}</a></th> + "); + } else { + $r->print(" +<th>Count</th> + "); + } + $r->print(<<END); + <th> <a href="javascript:document.studentform.sortby.value='username';document.studentform.submit();">$lt{'usrn'}</a> </th><th> <a href="javascript:document.studentform.sortby.value='domain';document.studentform.submit();">$lt{'dom'}</a> @@ -1259,16 +1269,8 @@ END </th><th> <a href="javascript:document.studentform.sortby.value='end';document.studentform.submit();">$lt{'end'}</a> </th> + </tr> END - if ($mode eq 'autoenroll') { - $r->print(" <th> - <a href=\"javascript:document.studentform.sortby.value='type';document.studentform.submit();\">$lt{'type'}</a> - </th><th> - $lt{'chan'}?</th>"); - } - $r->print(" - </tr> - "); } elsif ($mode eq 'csv') { # # Open a file @@ -1337,6 +1339,10 @@ END lc($classlist->{$a}->[$third]) cmp lc($classlist->{$b}->[$third]) } (keys(%$classlist)); my $studentcount = 0; + my $autocount = 0; + my $manualcount = 0; + my $unlockcount = 0; + my $lockcount = 0; foreach my $student (@Sorted_Students) { my $sdata = $classlist->{$student}; my $username = $sdata->[$index{'username'}]; @@ -1347,7 +1353,7 @@ END my $status = $sdata->[$index{'status'}]; my $start = $sdata->[$index{'start'}]; my $end = $sdata->[$index{'end'}]; - my $type = $sdata->[$index{'type'}]; + my $type = $sdata->[$index{'type'}]; next if (($statusmode ne 'Any') && ($status ne $statusmode)); if ($mode eq 'view' || $mode eq 'html' || $mode eq 'autoenroll') { if (! defined($start) || $start == 0) { @@ -1360,7 +1366,30 @@ END } else { $end = &Apache::lonlocal::locallocaltime($end); } - $r->print("<tr>\n <td>".(++$studentcount)."</td><td>\n "); + $r->print("<tr>\n "); + if ($mode eq 'autoenroll') { + my $lockedtype = $sdata->[$index{'lockedtype'}]; + $studentcount++; + my $cellentry; + if ($type eq 'auto') { + $cellentry = '<b>'.&mt('auto').'</b> <input type="checkbox" name="chgauto" value="'.$username.':'.$domain.'" /> Change'; + $autocount ++; + } else { + $cellentry = '<table border="0" cellspacing="0"><tr><td rowspan="2"><b>'.&mt('manual').'</b></td><td><input type="checkbox" name="chgmanual" value="'.$username.':'.$domain.'" /> Change</td></tr><tr><td>'; + $manualcount ++; + if ($lockedtype) { + $cellentry .= '<input type="checkbox" name="unlockchg" value="'.$username.':'.$domain.'" /> '.&mt('Unlock'); + $unlockcount ++; + } else { + $cellentry .= '<input type="checkbox" name="lockchg" value="'.$username.':'.$domain.'" /> '.&mt('Lock'); + $lockcount ++; + } + $cellentry .= '</td></tr></table>'; + } + $r->print("<td>$cellentry<td>\n "); + } else { + $r->print("<td>".(++$studentcount)."</td><td>\n "); + } if ($linkto eq 'nothing') { $r->print($username); } elsif ($linkto eq 'aboutme') { @@ -1384,17 +1413,8 @@ END <td>$section</td> <td>$start</td> <td>$end</td> + </tr> END - if ($mode eq 'autoenroll') { - my $longtype = &mt('manual').' '; - if ($type eq 'auto') { - $longtype = &mt('auto').' '; - } - $r->print("<td><b>$longtype</b></td><td><input type=\"checkbox\" name=\"switch:$username:$domain\" /></td>"); - } - $r->print(" -</tr> - "); } elsif ($mode eq 'csv') { next if (! defined($CSVfile)); # no need to bother with $linkto @@ -1443,8 +1463,9 @@ END $r->rflush(); } if ($mode eq 'autoenroll') { - return $studentcount; + return ($studentcount,$autocount,$manualcount,$lockcount,$unlockcount); } + return; }