--- loncom/xml/lonxml.pm 2002/05/24 20:51:55 1.174 +++ loncom/xml/lonxml.pm 2002/07/01 15:29:23 1.179 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.174 2002/05/24 20:51:55 www Exp $ +# $Id: lonxml.pm,v 1.179 2002/07/01 15:29:23 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -331,9 +331,15 @@ sub registerurl { my $forcereg=shift; my $target = shift; my $result = ''; - if (($ENV{'request.publicaccess'}) || - (!&Apache::lonnet::is_on_map($ENV{'REQUEST_URI'}))) { - return + if ($target eq 'edit') { + $result .="\n"; + } + if ((($ENV{'request.publicaccess'}) || + (!&Apache::lonnet::is_on_map($ENV{'REQUEST_URI'}))) && + (!$forcereg)) { + return $result. ''; } if ($Apache::lonxml::registered && !$forcereg) { return ''; } @@ -370,6 +376,7 @@ ENDPARM menu.clearTimeout(menu.menucltim); $timesync menu.currentURL=window.location.pathname; + menu.reloadURL=window.location.pathname; menu.currentStale=0; menu.clearbut(3,1); menu.switchbutton @@ -396,8 +403,10 @@ ENDPARM function LONCAPAstale() { menu=window.open("$nothing","LONCAPAmenu","",false); menu.currentStale=1; - menu.switchbutton - (3,1,'reload.gif','return','location','go(currentURL)'); + if (menu.reloadURL!='' && menu.reloadURL!= null) { + menu.switchbutton + (3,1,'reload.gif','return','location','go(reloadURL)'); + } menu.clearbut(7,1); menu.clearbut(7,2); menu.clearbut(7,3); @@ -442,61 +451,6 @@ ENDREGTHIS ENDDONOTREGTHIS } - if ($target eq 'edit') { - # Javascript routines for construction space: - # openbrowser and opensearcher will start the file browser - # (lonindexer) and searcher (lonsearchcat) respectively. - # Inputs are the name of the html form being used - # and the name of the element the selected URL should - # be placed in. - # openbrowser also takes arguments only and omit, which are - # comma deliminated lists of file extensions to (only) show - # or omit. - # Here we also set currentURL=null. - $result .=<<"ENDBROWSERSCRIPT"; - -ENDBROWSERSCRIPT - } return $result; } @@ -520,6 +474,23 @@ sub xmlparse { my ($request,$target,$content_file_string,$safeinit,%style_for_target) = @_; &setup_globals($request,$target); +# +# do we have a course style file? +# + + if ($ENV{'request.course.id'}) { + my $bodytext= + $ENV{'course.'.$ENV{'request.course.id'}.'.default_xml_style'}; + if ($bodytext) { + my $location=&Apache::lonnet::filelocation('',$bodytext); + my $styletext=&Apache::lonnet::getfile($location); + if ($styletext ne '-1') { + %style_for_target = (%style_for_target, + &Apache::style::styleparser($target,$styletext)); + } + } + } + #&printalltags(); my @pars = (); my $pwd=$ENV{'request.filename'}; @@ -1236,7 +1207,10 @@ ENDNOTFOUND # unless ($ENV{'request.state'} eq 'published') { if ($ENV{'form.editmode'} && (!($ENV{'form.viewmode'}))) { - $result=''; + my $displayfile=$request->uri; + $displayfile=~s/^\/[^\/]*//; + $result='

'.$displayfile. + '

'; $result=&inserteditinfo($result,$filecontents); } }