--- capa/capa51/Discuss/Ver1.3/Attic/capadiscuss 1999/10/13 18:45:28 1.2
+++ capa/capa51/Discuss/Ver1.3/Attic/capadiscuss 2000/03/22 21:08:02 1.8
@@ -1,13 +1,15 @@
#!/usr/ucb/perl
#
# CAPA Discussion Forum
-# version 1.3
+# version 1.3.0
#
# Michigan State University
# Department of Physics and Astronomy
#
# Ryan J. Shaltry
# tech4@msue.msu.edu
+# Guy Albertelli
+# albertel@msu.edu
print "Content-type: text/html\n\n";
@@ -49,11 +51,17 @@ $validadmin = "unchecked";
$psetid = $form{'PSETID'};
if ($snum eq "A12345678") {$debug=1;}
if ($snum eq "a12345678") {$debug=1;}
+$debug=0;
if($psetid eq "") { $psetid = $setid; }
if ($debug) {print "GetTeacherInfo
";$BenchmarkTa = new Benchmark;}
&GetTeacherInfo;
if($debug) {$BenchmarkTb = new Benchmark;print "
",timestr(timediff($BenchmarkTb,$BenchmarkTa)),"\n";}
+ # check if student is banned from forum
+if ($debug) {print "BanUser
";$BenchmarkTa = new Benchmark;}
+if (&BanUser) {exit;}
+if($debug) {$BenchmarkTb = new Benchmark;print "
",timestr(timediff($BenchmarkTb,$BenchmarkTa)),"\n";}
+
# check for valid studentnumber/capaid, an exit will occur here if the set wasn't open
if ($debug) {print "ValidateUser
";$BenchmarkTa = new Benchmark;}
&ValidateUser;
@@ -102,8 +110,9 @@ exit;
#######################
sub GetSetList {
opendir(DDIR,"$capadir/$class/discussion");
- @sets = grep(/[0-9]/,sort(readdir(DDIR)));
+ @sets = grep(/^[0-9]+$/,sort(readdir(DDIR)));
closedir(DDIR);
+ if ($debug) {print "
Sets:". @sets ."
\n";}
}
sub SetListHeader {
@@ -116,11 +125,40 @@ sub SetListHeader {
$pdset .= "\n";
}
+sub GetInfoList {
+ local(@temp,@alldir,@setdir);
+# if ($debug) {print "
GetInfoList
";}
+ 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 "
GetInfoList" . @infofiles."
";}
+ foreach $infofile(@infofiles) {
+# if ($debug) {print "
GetInfoList" . $infofile."
";}
+ @temp = reverse split /\//, $infofile;
+ $infodesc = $temp[0];
+ $infodesc =~ s/.info//g;
+ $infodesc =~ s/_/ /g;
+ $infostring .= &InfoButtonHTML;
+ }
+ if ($infostring ne "") {
+ # $infostring = "