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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Thu, 21 Aug 2008 20:46:26 -0000


raeburn		Thu Aug 21 16:46:26 2008 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  Bug 5773.
  - "Practice Problem" added as a selectable problem type in Construction Space
  - "Practice Problem" added as an option in the problem type block in the colorful editor.
  - When rendering problems of type practice in Construction Space included the "New Problem Variation" and the header warning about the temporary nature of submissions. 
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.427 loncom/homework/structuretags.pm:1.428
--- loncom/homework/structuretags.pm:1.427	Wed Aug 13 12:56:15 2008
+++ loncom/homework/structuretags.pm	Thu Aug 21 16:46:23 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.427 2008/08/13 16:56:15 bisitz Exp $
+# $Id: structuretags.pm,v 1.428 2008/08/21 20:46:23 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -416,8 +416,9 @@
 <select name='problemtype'>
   <option value=''></option>
   ".&option('exam'   ,'problemtype').&mt("Exam Problem")."</option>
-  ".&option('problem','problemtype').&mt("Homework problem")."</option>
+  ".&option('problem','problemtype').&mt("Homework Problem")."</option>
   ".&option('survey' ,'problemtype').&mt("Survey Question")."</option>
+  ".&option('practice' ,'problemtype').&mt("Practice Problem")."</option>
 </select>
 </span>
 $show_all
@@ -865,8 +866,7 @@
 		    '</label>';
 	    }
             if ($Apache::lonhomework::type eq 'practice') {
-               $form_tag_start.='<span class="LC_info"><h3>'.&mt('Practice Problem').'</h3></span>'.
-                                '<span class="LC_info">'.&mt('Submissions are not permanently recorded').'</span>';
+                $form_tag_start.=&practice_problem_header();
             }
 	    $form_tag_start.='<hr />';
 	}
@@ -940,6 +940,11 @@
 	    # create a page header and exit
 	    if ($env{'request.state'} eq "construct") {
 		$result.= &problem_web_to_edit_header($env{'form.rndseed'});
+                if ($Apache::lonhomework::type eq 'practice') {
+                    $result.= '<input type="submit" name="resetdata" '.
+                              'value="'.&mt('New Problem Variation').'" />'.
+                              &practice_problem_header().'<hr />';
+                }
 	    }
 	    # if we are viewing someone else preserve that info
 	    if (defined $env{'form.grade_symb'}) {
@@ -1175,6 +1180,11 @@
 	$result.=" \n $form_tag_start".	
 		  '<input type="hidden" name="submitted" value="yes" />';
 	$result.=&problem_web_to_edit_header($rndseed);
+        if ($Apache::lonhomework::type eq 'practice') {
+            $result.= '<input type="submit" name="resetdata" '.
+                      'value="'.&mt('New Problem Variation').'" />'.
+                      &practice_problem_header().'<hr />';
+        }
     }
     return $result;
 }
@@ -1843,7 +1853,8 @@
 	$result .=&Apache::edit::checked_arg('When used as type(s):','for',
 					     [ ['exam','Exam/Quiz Problem'],
 					       ['survey','Survey'],
-					       ['problem','Homework Problem'] ]
+					       ['problem','Homework Problem'],
+                                               ['practice','Practice Problem'] ]
 					     ,$token);
 	$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
     } elsif ($target eq 'modified') {
@@ -1964,5 +1975,11 @@
     return '';
 }
 
+sub practice_problem_header {
+    return '<span class="LC_info"><h3>'.&mt('Practice Problem').'</h3></span>'.
+           '<span class="LC_info">'.&mt('Submissions are not permanently recorded').
+           '</span>';
+}
+
 1;
 __END__