version 1.1.1.1, 1999/09/28 21:27:46
|
version 1.4, 1999/10/18 20:58:33
|
Line 54 if ($debug) {print "GetTeacherInfo<BR>";
|
Line 54 if ($debug) {print "GetTeacherInfo<BR>";
|
&GetTeacherInfo; |
&GetTeacherInfo; |
if($debug) {$BenchmarkTb = new Benchmark;print "<BR>",timestr(timediff($BenchmarkTb,$BenchmarkTa)),"\n";} |
if($debug) {$BenchmarkTb = new Benchmark;print "<BR>",timestr(timediff($BenchmarkTb,$BenchmarkTa)),"\n";} |
|
|
# check for valid studentnumber/capaid |
# check for valid studentnumber/capaid, an exit will occur here if the set wasn't open |
if ($debug) {print "ValidateUser<BR>";$BenchmarkTa = new Benchmark;} |
if ($debug) {print "ValidateUser<BR>";$BenchmarkTa = new Benchmark;} |
&ValidateUser; |
&ValidateUser; |
if($debug) {$BenchmarkTb = new Benchmark;print "<BR>",timestr(timediff($BenchmarkTb,$BenchmarkTa)),"\n";} |
if($debug) {$BenchmarkTb = new Benchmark;print "<BR>",timestr(timediff($BenchmarkTb,$BenchmarkTa)),"\n";} |
Line 100 exit;
|
Line 100 exit;
|
####################### |
####################### |
## Begin Subroutines ## |
## Begin Subroutines ## |
####################### |
####################### |
|
sub GetSetList { |
|
opendir(DDIR,"$capadir/$class/discussion"); |
|
@sets = grep(/^[0-9]+$/,sort(readdir(DDIR))); |
|
closedir(DDIR); |
|
if ($debug) {print "<br> Sets:". @sets ."<BR>\n";} |
|
} |
|
|
|
sub SetListHeader { |
|
$pdset = "<select name=\"SETID\">\n"; |
|
foreach $setnum(@sets) { |
|
$selected = ""; |
|
if($setnum eq $setid) { $selected = "selected"; } |
|
$pdset .= "<option value=\"$setnum\" $selected>$setnum\n"; |
|
} |
|
$pdset .= "</select>\n"; |
|
} |
|
|
|
sub GetInfoList { |
|
local(@temp,@alldir,@setdir); |
|
# if ($debug) {print "<br> GetInfoList <br>";} |
|
opendir(DDIR,"$capadir/$class/discussion"); |
|
@alldir = sort(grep(/.info$/,readdir(DDIR))); |
|
closedir(DDIR); |
|
|
|
opendir(FORUM,"$capadir/$class/discussion/$setid"); |
|
@setdir = sort(grep(/.info$/,readdir(FORUM))); |
|
closedir(FORUM); |
|
|
|
foreach $file(@setdir) { @setdir2 = (@setdir2,"$setid/$file"); } |
|
@infofiles = (@alldir,@setdir2); |
|
$infostring = ""; |
|
# if ($debug) {print "<br> GetInfoList" . @infofiles."<br>";} |
|
foreach $infofile(@infofiles) { |
|
# if ($debug) {print "<br> GetInfoList" . $infofile."<br>";} |
|
@temp = reverse split /\//, $infofile; |
|
$infodesc = $temp[0]; |
|
$infodesc =~ s/.info//g; |
|
$infodesc =~ s/_/ /g; |
|
$infostring .= &InfoButtonHTML; |
|
} |
|
if ($infostring ne "") { |
|
# $infostring = "</tr><tr>" . $infostring; |
|
} |
|
# if ($debug) {print "<br> GetInfoList" . $infostring."<br>";} |
|
} |
|
|
sub NewSet { |
sub NewSet { |
&Log("NewSet"); |
&Log("NewSet"); |
|
|
if($setid <= $psetid) { #grab capaid |
if($setid <= $psetid) { #grab capaid |
if ($debug) {print "ViewSet<BR>";$BenchmarkTa = new Benchmark;} |
if ($debug) {print "NewSet<BR>";$BenchmarkTa = new Benchmark;} |
@allcapaid = `allcapaid -s $setid -e $setid -stu $snum -c $capadir/$class -i`; |
@allcapaid = `allcapaid -s $setid -e $setid -stu $snum -c $capadir/$class -i`; |
|
|
$capaid = $allcapaid[2]; |
$capaid = $allcapaid[2]; |
Line 116 if($debug) {$BenchmarkTb = new Benchmark
|
Line 161 if($debug) {$BenchmarkTb = new Benchmark
|
return; |
return; |
} |
} |
|
|
opendir(DDIR,"$capadir/$class/discussion"); |
if ($debug) { print "<br> GetSetList\n"; } |
@sets = grep(/[0-9]/,sort(readdir(DDIR))); |
&GetSetList; |
closedir(DDIR); |
if ($debug) { print "<br> EndGetSetList\n"; } |
|
&SetListHeader; |
$pdset = "<select name=\"SETID\">\n"; |
|
foreach $setnum(@sets) { |
|
$selected = ""; |
|
if($setnum eq $setid) { $selected = "selected"; } |
|
$pdset .= "<option value=\"$setnum\" $selected>$setnum\n"; |
|
} |
|
$pdset .= "</select>\n"; |
|
|
|
&NewSetHTML; |
&NewSetHTML; |
#exit; |
#exit; |
} |
} |
Line 143 sub ViewSet {
|
Line 180 sub ViewSet {
|
|
|
$capasbin = "$capasbin/$teachdir/capasbin"; |
$capasbin = "$capasbin/$teachdir/capasbin"; |
&SetJumpBox; |
&SetJumpBox; |
|
$backfunction="viewset"; |
|
&GetInfoList; |
|
|
opendir(FORUM,"$capadir/$class/discussion/$setid"); |
opendir(FORUM,"$capadir/$class/discussion/$setid"); |
@dir = sort(readdir(FORUM)); |
@dir = sort(readdir(FORUM)); |
closedir(FORUM); |
closedir(FORUM); |
|
|
@infofiles = grep(/.info/,@dir); |
|
$infostring = ""; |
|
$backfunction = "viewset"; |
|
foreach $infofile(@infofiles) { |
|
$infodesc = $infofile; |
|
$infodesc =~ s/.info//g; |
|
$infodesc =~ s/_/ /g; |
|
$infostring .= &InfoButtonHTML; |
|
} |
|
|
|
foreach $i(@dir) { |
foreach $i(@dir) { |
$probnum = &RemZero(substr($i,0,6)); |
$probnum = &RemZero(substr($i,0,6)); |
$found[$probnum]++; |
$found[$probnum]++; |
Line 263 sub ViewProblem {
|
Line 293 sub ViewProblem {
|
} |
} |
|
|
if($msgcount eq "1") { |
if($msgcount eq "1") { |
|
&GetInfoList; |
$postbutton = &ReplyButtonHTML; |
$postbutton = &ReplyButtonHTML; |
&ProblemJumpBox; |
&ProblemJumpBox; |
&ViewProblemTopHTML; |
&ViewProblemTopHTML; |
Line 304 sub ViewProblem {
|
Line 335 sub ViewProblem {
|
} |
} |
|
|
if($msgfind eq "no") { |
if($msgfind eq "no") { |
|
&GetInfoList; |
$postbutton = &PostNewButtonHTML; |
$postbutton = &PostNewButtonHTML; |
&ProblemJumpBox; |
&ProblemJumpBox; |
&ViewProblemTopHTML; |
&ViewProblemTopHTML; |
Line 317 sub ViewProblem {
|
Line 349 sub ViewProblem {
|
} |
} |
|
|
sub ViewInfoFile { |
sub ViewInfoFile { |
open(INFOFILE,"$capadir/$class/discussion/$setid/$file"); |
&Log("InfoFile"); |
|
open(INFOFILE,"$capadir/$class/discussion/$file"); |
@file = <INFOFILE>; |
@file = <INFOFILE>; |
closedir(INFOFILE); |
closedir(INFOFILE); |
|
|
Line 653 sub ValidateUser {
|
Line 686 sub ValidateUser {
|
if($valid eq "no") { &InvalidVarsHTML; } |
if($valid eq "no") { &InvalidVarsHTML; } |
|
|
# check w/ allcapaid program |
# check w/ allcapaid program |
@allcapaid = `allcapaid -s $setid -e $setid -stu $snum -c $capadir/$class -i`; |
@allcapaid = `allcapaid51 -s $setid -e $setid -stu $snum -c $capadir/$class -i -checkopen`; |
|
|
chop $allcapaid[2]; |
chop $allcapaid[2]; |
chop $allcapaid[2]; |
chop $allcapaid[2]; |
|
if ($debug) {print "capaid:" . $allcapaid[2] . "<BR>\n";} |
if($allcapaid[2] ne $capaid) { |
if($allcapaid[2] ne $capaid) { |
if($action ne "newset") { &BadPassHTML; } |
if ($allcapaid[2] =~ /Open/) { &NotOpen; exit; } |
|
if($action ne "newset") { &BadPassHTML; exit; } |
#&NewSet; |
#&NewSet; |
} |
} |
} |
} |
|
|
|
sub NotOpen { |
|
&GetSetList; |
|
&SetListHeader; |
|
&ViewSetTitleHTML; |
|
print <<NotOpen2; |
|
This set is not yet open. Please choose a different set. |
|
</body> |
|
</html> |
|
NotOpen2 |
|
} |
|
|
sub UserInfo { |
sub UserInfo { |
local($line,@classl,$last,$first,$middle); |
local($line,@classl,$last,$first,$middle); |
|
|
Line 703 sub ProblemJumpBox {
|
Line 749 sub ProblemJumpBox {
|
} |
} |
|
|
sub SetJumpBox { |
sub SetJumpBox { |
opendir(DDIR,"$capadir/$class/discussion"); |
&GetSetList; |
@sets = grep(/[0-9]/,sort(readdir(DDIR))); |
&SetListHeader; |
closedir(DDIR); |
|
|
|
$pdset = "<select name=\"SETID\">\n"; |
|
foreach $set(@sets) { |
|
$selected = ""; |
|
if($set eq $setid) { $selected = " selected"; } |
|
$pdset .= " <option value=\"$set\"$selected>$set\n"; |
|
} |
|
$pdset .= "</select>"; |
|
} |
} |
|
|
sub AddZero { |
sub AddZero { |
Line 811 sub Log {
|
Line 848 sub Log {
|
|
|
&Lock("lock.file"); |
&Lock("lock.file"); |
open(LOG,">>$capadir/$class/discussion/logs/access.log"); |
open(LOG,">>$capadir/$class/discussion/logs/access.log"); |
print LOG "$snum|$capaid|$username|$email|$logmsg|$setid|$probnum|$HyphenDate|$Time\n"; |
print LOG "$snum|$capaid|$username|$email|$logmsg|$setid|$probnum|$HyphenDate|$Time|$file\n"; |
close(LOG); |
close(LOG); |
&Unlock("lock.file"); |
&Unlock("lock.file"); |
} |
} |