[LON-CAPA-cvs] cvs: loncom /interface lonmodifycourse.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Tue, 30 Dec 2003 15:46:18 -0000


raeburn		Tue Dec 30 10:46:18 2003 EDT

  Modified files:              
    /loncom/interface	lonmodifycourse.pm 
  Log:
  Eliminate senseless array stuffing in &check_course().  Correct indents.
  
  
Index: loncom/interface/lonmodifycourse.pm
diff -u loncom/interface/lonmodifycourse.pm:1.4 loncom/interface/lonmodifycourse.pm:1.5
--- loncom/interface/lonmodifycourse.pm:1.4	Mon Dec 29 09:38:44 2003
+++ loncom/interface/lonmodifycourse.pm	Tue Dec 30 10:46:18 2003
@@ -418,6 +418,7 @@
 <br/>
 ENDDOCUMENT
     &print_footer($r);
+    return;
 }
 
 sub modify_course {
@@ -671,32 +672,30 @@
  </tr>
 </table>
 ENDTHIS
+    return;
 }
 
 sub print_footer {
-  my $r = shift;
-  $r->print(<<ENDBASE);
+    my $r = shift;
+    $r->print(<<ENDBASE);
 <br/>
 </body>
 </html>
 ENDBASE
+    return;
 }
 
 sub check_course {
     my ($dom,$course) = @_;
     my %courseIDs = &Apache::lonnet::courseiddump($dom,'.',1);
-    my @courses = ();
     foreach my $key (sort keys %courseIDs) {
         if ($key =~ m/^($dom)_(\w+)$/) {
-            push @courses, $2;
+            if ($2 eq $course) {
+                return 'ok';
+            }
         }
     }
-    if (grep/^$course$/,@courses) {
-        return 'ok';
-    }
-    else {
-        return 'invalid course';
-    }
+    return 'invalid course';
 }