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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 09 Sep 2004 08:59:56 -0000


albertel		Thu Sep  9 04:59:56 2004 EDT

  Modified files:              
    /loncom/homework	structuretags.pm response.pm 
  Log:
  - slight speed up for CSTR space
  - BUG#3431, turn on 'Show All Foils' when advanced users are browsing
  
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.266 loncom/homework/structuretags.pm:1.267
--- loncom/homework/structuretags.pm:1.266	Sun Aug 29 03:49:35 2004
+++ loncom/homework/structuretags.pm	Thu Sep  9 04:59:56 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.266 2004/08/29 07:49:35 albertel Exp $
+# $Id: structuretags.pm,v 1.267 2004/09/09 08:59:56 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -36,7 +36,7 @@
 use Apache::lonmenu;
 use Apache::lonlocal;
 use Apache::lonxml;
-
+use Time::HiRes qw( gettimeofday tv_interval );
 BEGIN {
     &Apache::lonxml::register('Apache::structuretags',('block','languageblock','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','problemtype','startouttext','endouttext','simpleeditbutton','definetag'));
 }
@@ -396,12 +396,14 @@
 
 sub get_problem_status {
     my ($part)=@_;
-    my $problem_status=&Apache::lonnet::EXT("resource.$part.problemstatus");
-    &Apache::lonxml::debug("problem status for $part is $problem_status");
-    &Apache::lonxml::debug("env probstat is ".$ENV{'form.problemstatus'});
+    my $problem_status;
     if ($ENV{'request.state'} eq 'construct' &&
 	defined($ENV{'form.problemstatus'})) {
 	$problem_status=$ENV{'form.problemstatus'};
+    } else {
+	$problem_status=&Apache::lonnet::EXT("resource.$part.problemstatus");
+	&Apache::lonxml::debug("problem status for $part is $problem_status");
+	&Apache::lonxml::debug("env probstat is ".$ENV{'form.problemstatus'});
     }
     return $problem_status;
 }
@@ -485,7 +487,16 @@
 		    '<input type="submit" name="resetdata"
                              value="'.&mt('New Problem Variation').'" />'.
 		    '<input type="hidden" name="username"
-                             value="'.$ENV{'form.username'}.'" /> <br />';
+                             value="'.$ENV{'form.username'}.'" />';
+	    if ($ENV{'user.adv'}) {
+		$form_tag_start.=
+		    ' <input type="checkbox" name="showallfoils" ';
+		if (defined($ENV{'form.showallfoils'})) {
+		    $form_tag_start.='checked="on"';
+		}
+		$form_tag_start.= ' />'.&mt('&nbsp;Show&nbsp;All&nbsp;Foils');
+	    }
+	    $form_tag_start.='<hr />';
 	}
 	($status,$accessmsg) = &Apache::lonhomework::check_access('0');
 	push (@Apache::inputtags::status,$status);
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.101 loncom/homework/response.pm:1.102
--- loncom/homework/response.pm:1.101	Sun Aug 29 03:49:35 2004
+++ loncom/homework/response.pm	Thu Sep  9 04:59:56 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.101 2004/08/29 07:49:35 albertel Exp $
+# $Id: response.pm,v 1.102 2004/09/09 08:59:56 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -500,12 +500,14 @@
 }
 
 sub showallfoils {
-    my $return=0;
-    if (defined($ENV{'form.showallfoils'}) &&
-	$ENV{'request.state'} eq 'construct') {
-	$return=1;
+    if (defined($ENV{'form.showallfoils'})) {
+	my ($symb)=&Apache::lonxml::whichuser();
+	if ($ENV{'request.state'} eq 'construct' || 
+	    ($ENV{'user.adv'} && $symb eq '')) {
+	    return 1;
+	}
     }
-    return $return;
+    return 0;
 }
 
 sub getresponse {