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

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 18 Sep 2004 17:29:29 -0000


albertel		Sat Sep 18 13:29:29 2004 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm structuretags.pm 
  Log:
  - bug#3481, remeber we are in exam mode when going from view to edit and back
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.178 loncom/homework/lonhomework.pm:1.179
--- loncom/homework/lonhomework.pm:1.178	Sat Jul  3 16:23:20 2004
+++ loncom/homework/lonhomework.pm	Sat Sep 18 13:29:29 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.178 2004/07/03 20:23:20 albertel Exp $
+# $Id: lonhomework.pm,v 1.179 2004/09/18 17:29:29 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -52,7 +52,7 @@
 use HTML::Entities();
 use Apache::loncommon();
 use Apache::lonlocal;
-#use Time::HiRes qw( gettimeofday tv_interval );
+use Time::HiRes qw( gettimeofday tv_interval );
 
 BEGIN {
     &Apache::lonxml::register_insert();
@@ -453,7 +453,8 @@
             <head><title>'.&mt("Analyzing a problem").'</title></head>
             <body bgcolor="#FFFFFF">'.&Apache::lonxml::message_location().'
             <form name="lonhomework" method="POST" action="'.
-	    &HTML::Entities::encode($ENV{'request.uri'},'<>&"').'">
+	    &HTML::Entities::encode($ENV{'request.uri'},'<>&"').'">'.
+	    &Apache::structuretags::remember_problem_state().'
             <input type="submit" name="problemmode" value="'.&mt("EditXML").'" />
             <input type="submit" name="problemmode" value="'.&mt('Edit').'" />
             <hr />
@@ -573,7 +574,8 @@
 	$result.='<html><body bgcolor="#FFFFFF">'.
 	    &Apache::lonxml::message_location().'
             <form name="lonhomework" method="POST" action="'.
-	    &HTML::Entities::encode($ENV{'request.uri'},'<>&"').'">
+	    &HTML::Entities::encode($ENV{'request.uri'},'<>&"').'">'.
+	    &Apache::structuretags::remember_problem_state().'
             <input type="hidden" name="problemmode" value="'.&mt('EditXML').'" />
             <input type="submit" name="problemmode" accesskey="d" value="'.&mt('Discard Edits and View').'" />
             <input type="submit" name="problemmode" accesskey="e" value="'.&mt('Edit').'" />
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.267 loncom/homework/structuretags.pm:1.268
--- loncom/homework/structuretags.pm:1.267	Thu Sep  9 04:59:56 2004
+++ loncom/homework/structuretags.pm	Sat Sep 18 13:29:29 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.267 2004/09/09 08:59:56 albertel Exp $
+# $Id: structuretags.pm,v 1.268 2004/09/18 17:29:29 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -184,8 +184,16 @@
     return $rndseed;
 }
 
+sub remember_problem_state {
+    return '
+       <input type="hidden" name="problemstate" value="'.$ENV{'form.problemstate'}.'" />
+       <input type="hidden" name="problemtype" value="'.$ENV{'form.problemtype'}.'" />
+       <input type="hidden" name="problemstatus" value="'.$ENV{'form.problemstatus'}.'" />';
+}
+
 sub problem_edit_header {
-    return '<input type="hidden" name="submitted" value="edit" />
+    return '<input type="hidden" name="submitted" value="edit" />'.
+	&Apache::structuretags::remember_problem_state().'
        <input type="hidden" name="problemmode" value="'.&mt('Edit').'" />
        <input type="submit" name="problemmode" accesskey="d" value="'.&mt('Discard Edits and View').'" />
        <input type="submit" name="problemmode" accesskey="x" value="'.&mt('EditXML').'" />