--- loncom/homework/lonsimpleproblemedit.pm 2003/11/04 16:44:50 1.7 +++ loncom/homework/lonsimpleproblemedit.pm 2004/11/30 23:28:57 1.12 @@ -1,7 +1,7 @@ # The LearningOnline Network # Simple Problem Parameter Setting "Editor" # -# $Id: lonsimpleproblemedit.pm,v 1.7 2003/11/04 16:44:50 www Exp $ +# $Id: lonsimpleproblemedit.pm,v 1.12 2004/11/30 23:28:57 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -50,29 +50,21 @@ 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); - $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'); return (< -Question Text
+$qt
@@ -82,9 +74,10 @@ ENDQUESTION sub hint { my $text=$qparms{$prefix.'hinttext'}; + my $ht=&mt('Hint Text'); return (< -Hint Text
+$ht
@@ -117,11 +110,16 @@ sub foil { my $selectposition=&Apache::loncommon::select_form ($position,'position'.$number,%positions); my $text=$qparms{$prefix.'text'.$number}; + my %lt=&Apache::lonlocal::texthash('foil' => 'Foil', + 'value' => 'Value', + 'pos' => 'Position', + 'text' => 'Text'); + return (< -Foil -Value: $selectvaluePosition: $selectposition -Text:
+$lt{'foil'} +$lt{'value'}: $selectvalue$lt{'pos'}: $selectposition +$lt{'text'}:
@@ -199,8 +197,11 @@ ENDDOCUMENT $r->print(&Apache::loncommon::bodytag('Simple Problem Editor')); if ($symb) { $r->print('

'.&Apache::lonnet::gettitle($symb).'

'); + $r->print('
'. + ''.&mt('Student View').' - '.&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). '

'); $r->print('
'); # Question Type @@ -212,9 +213,10 @@ ENDDOCUMENT $qtype=$qparms{$prefix.'questiontype'}; unless (defined($qtype)) { $qtype='radio'; } unless ($questiontypes{$qtype}) { $qtype='radio'; } - $r->print('Question Type: '.&Apache::loncommon::select_form + $r->print(''.&mt('Question Type'). + ': '.&Apache::loncommon::select_form ($qtype,'questiontype',%questiontypes). - '

 

'); # Question Text $r->print(&questiontext()); @@ -245,7 +247,7 @@ ENDDOCUMENT $r->print( ''. '
Add new option: '. + $options.'" />'.&mt('Add new option').': '. ''. &mt('Delete an option').': '. &Apache::loncommon::select_form('','delopt',('' => '',%optionshash)). @@ -286,7 +288,7 @@ ENDDOCUMENT } # Store Button $r->print( - ''); + ''); } else { $r->print(&mt('Could not identify problem.')); }