--- loncom/homework/lonsimpleproblemedit.pm 2012/11/08 21:55:11 1.33 +++ loncom/homework/lonsimpleproblemedit.pm 2012/11/09 03:28:01 1.34 @@ -1,7 +1,7 @@ # The LearningOnline Network # Simple Problem Parameter Setting "Editor" # -# $Id: lonsimpleproblemedit.pm,v 1.33 2012/11/08 21:55:11 raeburn Exp $ +# $Id: lonsimpleproblemedit.pm,v 1.34 2012/11/09 03:28:01 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -205,7 +205,7 @@ sub handler { my $weightprefix=$env{'request.course.id'}.'.'.$symb.'.'; # ---------------------------------------------------------- Anything to store? - + my $storeresult; if (($symb) && (defined($env{'form.questiontype'}))) { my %storecontent=(); undef %storecontent; @@ -247,7 +247,16 @@ sub handler { &Apache::lonnet::devalidatecourseresdata( $env{'course.'.$env{'request.course.id'}.'.num'}, $env{'course.'.$env{'request.course.id'}.'.domain'}); - + if ($reply eq 'ok') { + if ($env{'form.forceview'}) { + my $dest = &get_parent_uri($symb); + if ($dest) { + $r->internal_redirect($dest); + } + } + } else { + $storeresult = $reply; + } } # ------------------------------------------------------------------- Read Data @@ -256,14 +265,34 @@ sub handler { $env{'course.'.$env{'request.course.id'}.'.num'}, $env{'request.course.id'}.'.'.$symb); + my $js = <<"ENDJS"; + + + +ENDJS + # ------------------------------------------------------------ Print the screen my $spell_header=&Apache::lonhtmlcommon::spellheader(); $r->print(&Apache::loncommon::start_page('Simple Problem Editor', - $spell_header)); + $spell_header.$js)); if ($symb) { my $title='

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

'; if (&get_parent_uri($symb)) { $r->print($title); + if ($storeresult) { + $r->print('

'.&mt('An error: [_1] occurred saving your changes',$storeresult).'

'); + } } else { $r->print($title .'

' @@ -307,7 +336,10 @@ sub handler { ); $r->print( '

' + .'' .'' + .(' ' x3) + .'' .'

' ); # Script @@ -407,7 +439,10 @@ sub handler { } # Store Button $r->print( - ''); + ''. + (' ' x3). + ''. + ''); } else { $r->print(&mt('Could not identify problem.')); }