--- capa/capa51/Discuss/Ver1.3/Attic/capadiscuss 1999/09/28 21:27:46 1.1.1.1 +++ capa/capa51/Discuss/Ver1.3/Attic/capadiscuss 1999/10/13 18:45:28 1.2 @@ -54,7 +54,7 @@ if ($debug) {print "GetTeacherInfo
"; &GetTeacherInfo; if($debug) {$BenchmarkTb = new Benchmark;print "
",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
";$BenchmarkTa = new Benchmark;} &ValidateUser; if($debug) {$BenchmarkTb = new Benchmark;print "
",timestr(timediff($BenchmarkTb,$BenchmarkTa)),"\n";} @@ -100,6 +100,21 @@ exit; ####################### ## Begin Subroutines ## ####################### +sub GetSetList { + opendir(DDIR,"$capadir/$class/discussion"); + @sets = grep(/[0-9]/,sort(readdir(DDIR))); + closedir(DDIR); +} + +sub SetListHeader { + $pdset = "\n"; +} sub NewSet { &Log("NewSet"); @@ -116,18 +131,8 @@ if($debug) {$BenchmarkTb = new Benchmark return; } - opendir(DDIR,"$capadir/$class/discussion"); - @sets = grep(/[0-9]/,sort(readdir(DDIR))); - closedir(DDIR); - - $pdset = "\n"; - + &GetSetList; + &SetListHeader; &NewSetHTML; #exit; } @@ -653,16 +658,29 @@ sub ValidateUser { if($valid eq "no") { &InvalidVarsHTML; } # 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]; + if ($debug) {print "capaid:" . $allcapaid[2] . "
\n";} if($allcapaid[2] ne $capaid) { - if($action ne "newset") { &BadPassHTML; } + if ($allcapaid[2] =~ /Open/) { &NotOpen; exit; } + if($action ne "newset") { &BadPassHTML; exit; } #&NewSet; } } +sub NotOpen { + &GetSetList; + &SetListHeader; + &ViewSetTitleHTML; +print < + +NotOpen2 +} + sub UserInfo { local($line,@classl,$last,$first,$middle);