--- loncom/homework/lonsimpleproblemedit.pm 2004/11/30 22:57:16 1.11 +++ loncom/homework/lonsimpleproblemedit.pm 2005/03/17 13:56:32 1.14 @@ -1,7 +1,7 @@ # The LearningOnline Network # Simple Problem Parameter Setting "Editor" # -# $Id: lonsimpleproblemedit.pm,v 1.11 2004/11/30 22:57:16 albertel Exp $ +# $Id: lonsimpleproblemedit.pm,v 1.14 2005/03/17 13:56:32 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -33,6 +33,7 @@ use Apache::Constants qw(:common :http); use Apache::loncommon; use Apache::lonnet; use Apache::lonlocal; +use Apache::lonnavmaps; my %qparms; my $prefix; @@ -52,6 +53,7 @@ sub evaloptionhash { sub rawrendering { 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'}, @@ -64,7 +66,7 @@ sub questiontext { return (< $qt
- +
@@ -77,7 +79,7 @@ sub hint { return (< $ht
- +
@@ -119,13 +121,25 @@ sub foil { $lt{'foil'} $lt{'value'}: $selectvalue$lt{'pos'}: $selectposition $lt{'text'}:
- +
ENDFOIL } +sub get_parent_uri { + my ($cur_symb)=@_; + my $navmap = Apache::lonnavmaps::navmap->new(); + my $it = $navmap->getIterator(undef, undef, undef, 1); + while ( my $res=$it->next()) { + if (ref($res) && $res->symb() eq $cur_symb) { last; } + } + my ($src,$symb,$anchor)=&Apache::lonnavmaps::getLinkForResource($it->getStack()); + if (defined($anchor)) { $anchor='#'.$anchor; } + return $src.'?symb='.&Apache::lonnet::escape($symb).$anchor; +} + sub handler { my $r = shift; @@ -145,7 +159,7 @@ sub handler { # ----------------------------------------------------- Figure out where we are my $uri=$r->uri; $uri=~s/\/smpedit$//; - my $symb=&Apache::lonnet::symbread($uri); + my $symb=&Apache::lonnet::symbread(); # ------------------------------------------------ Prefix for everything stored $prefix=$ENV{'request.course.id'}.'.'.$symb.'.0.'; @@ -196,6 +210,9 @@ 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($symb). '

'); @@ -212,7 +229,7 @@ ENDDOCUMENT $r->print(''.&mt('Question Type'). ': '.&Apache::loncommon::select_form ($qtype,'questiontype',%questiontypes). - '

 

'); # Question Text $r->print(&questiontext()); @@ -284,7 +301,7 @@ ENDDOCUMENT } # Store Button $r->print( - ''); + ''); } else { $r->print(&mt('Could not identify problem.')); }