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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 17 Feb 2005 23:19:44 -0000


albertel		Thu Feb 17 18:19:44 2005 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm lonhelper.pm 
  Log:
  - BUG#3940, throw an error when they don't specify what to print
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.361 loncom/interface/lonprintout.pm:1.362
--- loncom/interface/lonprintout.pm:1.361	Thu Feb 17 03:29:43 2005
+++ loncom/interface/lonprintout.pm	Thu Feb 17 18:19:44 2005
@@ -1,7 +1,7 @@
 #  The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.361 2005/02/17 08:29:43 albertel Exp $
+# $Id: lonprintout.pm,v 1.362 2005/02/17 23:19:44 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1837,10 +1837,22 @@
         &Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_ANON1);
   <state name="CHOOSE_ANON1" title="Select Students and Resources">
     <nextstate>PAGESIZE</nextstate>
-    <message><hr width='33%' /><b>Number of anonymous assignments to print?</b></message>
-    <string variable="NUMBER_TO_PRINT_TOTAL" maxlength="5" size="5"></string>
-    <message><br /><b>Names to store the CODEs under for later:</b></message>
+    <message><hr width='33%' /></message>
+    <message><table><tr><td><b>Number of anonymous assignments to print?</b></td><td></message>
+    <string variable="NUMBER_TO_PRINT_TOTAL" maxlength="5" size="5">
+       <validator>
+	if (((\$helper->{'VARS'}{'NUMBER_TO_PRINT_TOTAL'}+0) < 1) &&
+	    !\$helper->{'VARS'}{'REUSE_OLD_CODES'}) {
+	    return "You need to specify the number of assignments to print";
+	}
+	return undef;
+       </validator>
+    </string>
+    <message></td></tr><tr><td></message>
+    <message><b>Names to store the CODEs under for later:</b></message>
+    <message></td><td></message>
     <string variable="ANON_CODE_STORAGE_NAME" maxlength="50" size="20" />
+    <message></td></tr></table></message>
     <message><hr width='33%' /></message>
     <message><b>Reprint a set of saved CODEs:</b></message>
     <dropdown variable="REUSE_OLD_CODES">
@@ -1893,10 +1905,21 @@
 	&Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_ANON2);
   <state name="CHOOSE_ANON2" title="Select Students and Resources">
     <nextstate>PAGESIZE</nextstate>
-    <message><hr width='33%' /><b>Number of anonymous assignments to print?</b></message>
-    <string variable="NUMBER_TO_PRINT_TOTAL" maxlength="5" size="5"></string>
-    <message><br /><b>Names to store the CODEs under for later:</b></message>
+    <message><table><tr><td><b>Number of anonymous assignments to print?</b></td><td></message>
+    <string variable="NUMBER_TO_PRINT_TOTAL" maxlength="5" size="5">
+       <validator>
+	if (((\$helper->{'VARS'}{'NUMBER_TO_PRINT_TOTAL'}+0) < 1) &&
+	    !\$helper->{'VARS'}{'REUSE_OLD_CODES'}) {
+	    return "You need to specify the number of assignments to print";
+	}
+	return undef;
+       </validator>
+    </string>
+    <message></td></tr><tr><td></message>
+    <message><b>Names to store the CODEs under for later:</b></message>
+    <message></td><td></message>
     <string variable="ANON_CODE_STORAGE_NAME" maxlength="50" size="20" />
+    <message></td></tr></table></message>
     <message><hr width='33%' /></message>
     <message><b>Reprint a set of saved CODEs:</b></message>
     <dropdown variable="REUSE_OLD_CODES">
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.96 loncom/interface/lonhelper.pm:1.97
--- loncom/interface/lonhelper.pm:1.96	Thu Feb 17 03:29:42 2005
+++ loncom/interface/lonhelper.pm	Thu Feb 17 18:19:44 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # .helper XML handler to implement the LON-CAPA helper
 #
-# $Id: lonhelper.pm,v 1.96 2005/02/17 08:29:42 albertel Exp $
+# $Id: lonhelper.pm,v 1.97 2005/02/17 23:19:44 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2870,7 +2870,7 @@
     my $result = '';
 
     if (defined $self->{ERROR_MSG}) {
-        $result .= '<br /><font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br /><br />';
+        $result .= '<p><font color="#FF0000">' . $self->{ERROR_MSG} . '</font></p>';
     }
 
     $result .= '<input type="string" name="' . $self->{'variable'} . '.forminput"';