--- loncom/homework/lonsimpleproblemedit.pm 2003/11/04 19:18:16 1.8 +++ loncom/homework/lonsimpleproblemedit.pm 2009/10/16 17:23:51 1.28 @@ -1,7 +1,7 @@ # The LearningOnline Network # Simple Problem Parameter Setting "Editor" # -# $Id: lonsimpleproblemedit.pm,v 1.8 2003/11/04 19:18:16 www Exp $ +# $Id: lonsimpleproblemedit.pm,v 1.28 2009/10/16 17:23:51 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -33,6 +33,10 @@ use Apache::Constants qw(:common :http); use Apache::loncommon; use Apache::lonnet; use Apache::lonlocal; +use Apache::lonnavmaps; +use lib '/home/httpd/lib/perl/'; +use LONCAPA; + my %qparms; my $prefix; @@ -50,31 +54,25 @@ sub evaloptionhash { } sub rawrendering { - my ($request,$uri)=@_; - my $problem=&Apache::lonnet::getfile - (&Apache::lonnet::filelocation('',$uri)); - &Apache::lonnet::devalidatecourseresdata( - $ENV{'course.'.$ENV{'request.course.id'}.'.num'}, - $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}); - my $uname=$ENV{'user.name'}; - my $udom=$ENV{'user.domain'}; - $ENV{'user.name'}=time; - $ENV{'user.domain'}=time; - my $result = &Apache::lonxml::xmlparse($request,'web', $problem); - undef($Apache::lonhomework::parsing_a_problem); - $ENV{'user.name'}=$uname; - $ENV{'user.domain'}=$udom; - $result=~s/^.*\
]*\>//si; - $result=~s/\<\/body[^\>]*\>.*$//si; - return $result; + my ($symb)=@_; + my %data=('show_errors'=>'on', + 'simple_edit_button' => 'off', + 'devalidatecourseresdata'=>'on'); + return &Apache::loncommon::get_student_view($symb,time,time, + $env{'request.course.id'}, + 'web',\%data); } sub questiontext { my $text=$qparms{$prefix.'questiontext'}; + my $qt=&mt('Question Text'); + my $spell_link= + &Apache::lonhtmlcommon::spelllink('simpleedit','questiontext'); return (<$qt + + $spell_link |
$lt{'foil'} | |
$lt{'value'}: $selectvalue | $lt{'pos'}: $selectposition |
$lt{'text'}: + + $spell_link |
'
+ .&mt('An error occurred retrieving the link to this problem.')
+ .'
'
+ .&mt('You may need to [_1]re-select the course[_2] and then return to this resource to view it.'
+ ,'','')
+ .'
' + .&mt('Note: it can take up to 10 minutes for changes to take effect for all users.') + .&Apache::loncommon::help_open_topic('Caching') + .'
' + ); + $r->print(''. - &rawrendering($r,$uri). + &rawrendering($symb). ' |
Add new option: '.
+ $options.'" />'.&mt('Add new option').': '.
''.
&mt('Delete an option').': '.
&Apache::loncommon::select_form('','delopt',('' => '',%optionshash)).
@@ -278,20 +359,38 @@ ENDDOCUMENT
unless ($stringtypes{$stringtype}) { $stringtype='cs'; }
$r->print(
'
'); # Hint $r->print(&hint()); } + if ($qtype eq 'numerical') { + my $numericalanswer=$qparms{$prefix.'numericalanswer'}; + unless (defined($numericalanswer)) { $numericalanswer=''; } + my $numericaltolerance=$qparms{$prefix.'numericaltolerance'}; + unless (defined($numericaltolerance)) { $numericaltolerance='5%'; } + my $numericalsigfigs=$qparms{$prefix.'numericalsigfigs'}; + unless (defined($numericalsigfigs)) { $numericalsigfigs='1,15'; } + + $r->print( + '
'); + $r->print(&hint()); + } # Store Button $r->print( - ''); + ''); } else { $r->print(&mt('Could not identify problem.')); } - $r->print(''); + $r->print(&Apache::loncommon::end_page()); return OK; } |