--- loncom/xml/lonxml.pm 2003/08/21 15:51:41 1.273 +++ loncom/xml/lonxml.pm 2003/09/08 19:00:09 1.274 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.273 2003/08/21 15:51:41 sakharuk Exp $ +# $Id: lonxml.pm,v 1.274 2003/09/08 19:00:09 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1164,16 +1164,35 @@ SIMPLECONTENT return $filecontents; } +sub createnewsty { + my $filecontents=(< + + + + + +SIMPLECONTENT + return $filecontents; +} + sub inserteditinfo { - my ($result,$filecontents)=@_; + my ($result,$filecontents,$filetype)=@_; $filecontents = &HTML::Entities::encode($filecontents); # my $editheader='Edit below
'; - my $xml_help = Apache::loncommon::helpLatexCheatsheet(); + my $xml_help = ''; + if ($filetype eq 'html') { + $xml_help=Apache::loncommon::helpLatexCheatsheet(); + } + my $cleanbut = ''; + if ($filetype eq 'html') { + $cleanbut=''; + } my $titledisplay=&display_title(); my $buttons=(< +$cleanbut BUTTONS @@ -1241,6 +1260,12 @@ sub handler { my $file=&Apache::lonnet::filelocation("",$request->uri); + my $filetype; + if ($file =~ /\.sty$/) { + $filetype='sty'; + } else { + $filetype='html'; + } # # Edit action? Save file. # @@ -1267,7 +1292,11 @@ sub handler { ENDNOTFOUND $filecontents=''; if ($ENV{'request.state'} ne 'published') { - $filecontents=&createnewhtml(); + if ($filetype eq 'sty') { + $filecontents=&createnewsty(); + } else { + $filecontents=&createnewhtml(); + } $ENV{'form.editmode'}='Edit'; #force edit mode } } else { @@ -1295,11 +1324,11 @@ ENDNOTFOUND $displayfile=~s/^\/[^\/]*//; $result='

'.$displayfile. '

'; - $result=&inserteditinfo($result,$filecontents); + $result=&inserteditinfo($result,$filecontents,$filetype); } } - - writeallows($request->uri); + if ($filetype eq 'html') { writeallows($request->uri); } + $request->print($result);