[LON-CAPA-cvs] cvs: loncom /homework structuretags.pm

sakharuk lon-capa-cvs@mail.lon-capa.org
Tue, 04 Nov 2003 14:46:28 -0000


sakharuk		Tue Nov  4 09:46:28 2003 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  Bug 2333 is fixed.
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.221 loncom/homework/structuretags.pm:1.222
--- loncom/homework/structuretags.pm:1.221	Mon Nov  3 16:47:21 2003
+++ loncom/homework/structuretags.pm	Tue Nov  4 09:46:28 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.221 2003/11/03 21:47:21 albertel Exp $
+# $Id: structuretags.pm,v 1.222 2003/11/04 14:46:28 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -459,10 +459,10 @@
 	    my $weight = &Apache::lonnet::EXT("resource.$id.weight");
 	    my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'keys');
 	    my @allkeys = split /,/,$allkeys;
-	    my $allow_print_points = 0;
+	    my $allow_print_points = 1;
 	    foreach my $partial_key (@allkeys) {
-		if ($partial_key=~m/weight/) {
-		    $allow_print_points++;
+		if ($partial_key=~m/\_(\d*)\_weight/) {
+		    if ($1 ne '0') {$allow_print_points=0;}
 		}
 	    }
 	    my $duedate = &Apache::lonnet::EXT("resource.$id.duedate"); 
@@ -980,7 +980,15 @@
 			$result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent';
 		    }
 		    my $weight = &Apache::lonnet::EXT("resource.$id.weight");
-		    if ($Apache::lonhomework::type eq 'exam') { $result .= '\fbox{\textit{'.$weight.' pt}}';}
+		    my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'keys');
+		    my @allkeys = split /,/,$allkeys;
+		    my $allow_print_points = 0;
+		    foreach my $partial_key (@allkeys) {
+			if ($partial_key=~m/\_(\d*)\_weight/) {
+			    if ($1 ne '0') {$allow_print_points=1;}
+			}
+		    }
+		    if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
 		}
 	    }
 	}