--- loncom/xml/lonxml.pm 2004/06/03 14:28:39 1.320 +++ loncom/xml/lonxml.pm 2004/06/12 01:09:31 1.325 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.320 2004/06/03 14:28:39 www Exp $ +# $Id: lonxml.pm,v 1.325 2004/06/12 01:09:31 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -150,6 +150,7 @@ $Apache::lonxml::warnings_error_header=' sub xmlbegin { my $output=''; + @htmlareafields=(); if ($ENV{'browser.mathml'}) { $output='<?xml version="1.0"?>' .'<?xml-stylesheet type="text/css" href="/adm/MathML/mathml.css"?>' @@ -604,6 +605,7 @@ sub setup_globals { my ($request,$target)=@_; $Apache::lonxml::request=$request; $Apache::lonxml::registered = 0; + @Apache::lonxml::htmlareafields=(); $errorcount=0; $warningcount=0; $Apache::lonxml::default_homework_loaded=0; @@ -662,7 +664,9 @@ sub init_safespace { $safehole->wrap(\&Apache::scripttag::xmlparse,$safeeval,'&xmlparse'); $safehole->wrap(\&Apache::outputtags::multipart,$safeeval,'&multipart'); $safehole->wrap(\&Apache::lonnet::EXT,$safeeval,'&EXT'); - + $safehole->wrap(\&Apache::chemresponse::chem_standard_order,$safeeval, + '&chem_standard_order'); + $safehole->wrap(\&Math::Cephes::asin,$safeeval,'&asin'); $safehole->wrap(\&Math::Cephes::acos,$safeeval,'&acos'); $safehole->wrap(\&Math::Cephes::atan,$safeeval,'&atan'); @@ -736,6 +740,7 @@ sub init_safespace { $safehole->wrap(\&Math::Random::random_set_seed,$safeeval,'&random_set_seed'); $safehole->wrap(\&Apache::lonxml::error,$safeeval,'&LONCAPA_INTERNAL_ERROR'); $safehole->wrap(\&Apache::lonxml::debug,$safeeval,'&LONCAPA_INTERNAL_DEBUG'); + $safehole->wrap(\&Apache::caparesponse::get_sigrange,$safeeval,'&LONCAPA_INTERNAL_get_sigrange'); #need to inspect this class of ops # $safeeval->deny(":base_orig"); @@ -1094,21 +1099,20 @@ sub storefile { } sub createnewhtml { - my $filecontents=(<<SIMPLECONTENT); + my $title=&mt('Title of document goes here'); + my $body=&mt('Body of document goes here'); + my $filecontents=(<<SIMPLECONTENT); +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml/11/DTD/xhtml11.dtd"> <html> <head> -<title> - Title of Document Goes Here -</title> +<title>$title</title> </head> <body bgcolor="#FFFFFF"> - - Body of Document Goes Here - +$body </body> </html> SIMPLECONTENT - return $filecontents; + return $filecontents; } sub createnewsty { @@ -1129,8 +1133,24 @@ sub inserteditinfo { $filecontents = &HTML::Entities::encode($filecontents,'<>&"'); # my $editheader='<a href="#editsection">Edit below</a><hr />'; my $xml_help = ''; + my $initialize=''; if ($filetype eq 'html') { - $xml_help=Apache::loncommon::helpLatexCheatsheet(); + my $addbuttons=&Apache::lonhtmlcommon::htmlareaaddbuttons(); + $initialize=&Apache::lonhtmlcommon::htmlareaheaders().(<<FULLPAGE); +<script type="text/javascript"> +$addbuttons + + HTMLArea.loadPlugin("FullPage"); + + function initDocument() { + var editor=new HTMLArea("filecont",config); + editor.registerPlugin(FullPage); + editor.generate(); + } +</script> +FULLPAGE + $result=~s/\<body([^\>]*)\>/\<body onload="initDocument()" $1\>/i; + $xml_help=&Apache::loncommon::helpLatexCheatsheet(); } my $cleanbut = ''; if ($filetype eq 'html') { @@ -1147,17 +1167,19 @@ $cleanbut <input type="submit" name="viewmode" accesskey="v" value="$lt{'vi'}" /> BUTTONS my $editfooter=(<<ENDFOOTER); +$initialize <hr /> <a name="editsection" /> <form method="post"> $xml_help <input type="hidden" name="editmode" value="$lt{'ed'}" /> $buttons<br /> -<textarea cols="80" rows="40" name="filecont">$filecontents</textarea> +<textarea cols="80" rows="44" name="filecont" id="filecont">$filecontents</textarea> <br />$buttons <br /> </form> $titledisplay +</body> ENDFOOTER # $result=~s/(\<body[^\>]*\>)/$1$editheader/is; $result=~s/(\<\/body\>)/$editfooter/is;