--- loncom/homework/lonsimpleproblemedit.pm	2009/08/12 21:22:40	1.20.2.1
+++ loncom/homework/lonsimpleproblemedit.pm	2009/08/17 18:18:35	1.24
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Problem Parameter Setting "Editor"
 #
-# $Id: lonsimpleproblemedit.pm,v 1.20.2.1 2009/08/12 21:22:40 raeburn Exp $
+# $Id: lonsimpleproblemedit.pm,v 1.24 2009/08/17 18:18:35 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -95,6 +95,19 @@ sub hint {
 ENDHINT
 }
 
+sub script {
+    my $text=$qparms{$prefix.'numericalscript'};
+    my $ht=&mt('Scripting (optional)');
+    return (<<ENDSCRIPT);
+<table bgcolor="#ccccaa" cellspacing="4" cellpadding="2">
+<tr><td><b>$ht</b><br />
+<textarea style="width:100%" name="numericalscript" cols="80" rows="4">$text</textarea>
+</td></tr>
+</table>
+<br />
+ENDSCRIPT
+}
+
 sub foil {
     my $number=shift;
     my %values='';
@@ -222,15 +235,29 @@ sub handler {
 					     $spell_header));
     if ($symb) {
 	$r->print('<h1>'.&Apache::lonnet::gettitle($symb).'</h1>');
-	$r->print('<table width="100%" bgcolor="#FFFFAA" border="2"><tr><td>');
         my $displaylink = &get_parent_uri($symb);
-        if ($displaylink ne '') {      
-            $r->print('<a href="'.$displaylink.'">'.&mt('Student View').'</a> - ');
+        if ($displaylink ne '') {
+            my $functions=&Apache::lonhtmlcommon::start_funclist()
+                         .&Apache::lonhtmlcommon::add_item_funclist(
+                              '<a href="'.$displaylink.'">'
+                             .&mt('Student View').'</a>')
+                             .&Apache::lonhtmlcommon::end_funclist();
+            $r->print(&Apache::loncommon::head_subbox($functions));
         } else {
-            $r->print('<span class="LC_error">'.&mt('An error occurred retrieving the link to this problem').'<br />'.&mt('You may need to [_1]re-select the course[_2] and then return to this resource to view it.','<a href="/adm/roles">','</a>').'</span><br />'); 
+            $r->print('<p class="LC_error">'
+                     .&mt('An error occurred retrieving the link to this problem.')
+                     .'<br />'
+                     .&mt('You may need to [_1]re-select the course[_2] and then return to this resource to view it.'
+                         ,'<a href="/adm/roles">','</a>')
+                     .'</p>'
+            );
         }
-        $r->print(&mt('Note: it can take up to 10 minutes for changes to take effect for all users.').
-		  &Apache::loncommon::help_open_topic('Caching').'</td></tr></table>');
+        $r->print('<p class="LC_warning">'
+                 .&mt('Note: it can take up to 10 minutes for changes to take effect for all users.')
+                 .&Apache::loncommon::help_open_topic('Caching')
+                 .'</p>'
+        );
+
 	$r->print('<table border="2" bgcolor="#FFFFFF" width="100%"><tr><td>'.
                   &rawrendering($symb).
                   '</td></tr></table><br />');
@@ -240,7 +267,8 @@ sub handler {
                                '1 out of N multiple choice (radio button)',
 			   'option' => 'Option response',
                            'string' => 'Short string response',
-                           'essay'  => 'Essay, open end');
+                           'essay'  => 'Essay, open end',
+                           'numerical' => 'Numerical response');
         $qtype=$qparms{$prefix.'questiontype'};
         unless (defined($qtype)) { $qtype='radio'; }
         unless ($questiontypes{$qtype}) { $qtype='radio'; }
@@ -249,6 +277,10 @@ sub handler {
 	                               ($qtype,'questiontype',%questiontypes).
   '</b><br /><input type="submit" value="'.&mt('Save and Edit').
   '" /><p>&nbsp;</p>');
+# Script
+        if ($qtype eq 'numerical') {
+           $r->print(&script());
+        }
 # Question Text
         $r->print(&questiontext());
 # Radio, Option ===
@@ -317,6 +349,16 @@ sub handler {
 # Hint
 	    $r->print(&hint());
 	}
+        if ($qtype eq 'numerical') {
+           my $numericalanswer=$qparms{$prefix.'numericalanswer'};
+           unless (defined($numericalanswer)) { $numericalanswer=''; }
+
+           $r->print(
+                  '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2">'.
+                  '<tr><td>'.&mt('Correct answer').': <input type="text" size="20" name="numericalanswer" value="'.$numericalanswer.'" />'.
+                  '</td></tr></table><br />');
+           $r->print(&hint());
+        }
 # Store Button
 	$r->print(
   '<input type="submit" value="'.&mt('Save and Edit').'" /></form>');