--- loncom/xml/lonxml.pm 2010/08/07 19:23:56 1.512
+++ loncom/xml/lonxml.pm 2011/11/14 00:20:42 1.523
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.512 2010/08/07 19:23:56 raeburn Exp $
+# $Id: lonxml.pm,v 1.523 2011/11/14 00:20:42 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -112,6 +112,7 @@ use Apache::lonmaxima();
use Apache::lonr();
use Apache::lonlocal;
use Apache::lonhtmlcommon();
+use Apache::functionplotresponse();
#==================================== Main subroutine: xmlparse
@@ -787,6 +788,11 @@ sub init_safespace {
$safehole->wrap(\&Apache::lonnet::logthis,$safeeval,'&LONCAPA_INTERNAL_LOGTHIS');
$safehole->wrap(\&Apache::inputtags::finalizeawards,$safeeval,'&LONCAPA_INTERNAL_FINALIZEAWARDS');
$safehole->wrap(\&Apache::caparesponse::get_sigrange,$safeeval,'&LONCAPA_INTERNAL_get_sigrange');
+ $safehole->wrap(\&Apache::functionplotresponse::fpr_val,$safeeval,'&fpr_val');
+ $safehole->wrap(\&Apache::functionplotresponse::fpr_f,$safeeval,'&fpr_f');
+ $safehole->wrap(\&Apache::functionplotresponse::fpr_dfdx,$safeeval,'&fpr_dfdx');
+ $safehole->wrap(\&Apache::functionplotresponse::fpr_d2fdx2,$safeeval,'&fpr_d2fdx2');
+
# use Data::Dumper;
# $safehole->wrap(\&Data::Dumper::Dumper,$safeeval,'&LONCAPA_INTERNAL_Dumper');
#need to inspect this class of ops
@@ -838,7 +844,8 @@ sub initialize_rndseed {
sub default_homework_load {
my ($safeeval)=@_;
&Apache::lonxml::debug('Loading default_homework');
- my $default=&Apache::lonnet::getfile('/home/httpd/html/res/adm/includes/default_homework.lcpm');
+ my $default=&Apache::lonnet::getfile($Apache::lonnet::perlvar{'lonIncludes'}.
+ '/default_homework.lcpm');
if ($default eq -1) {
&Apache::lonxml::error("Unable to find default_homework.lcpm");
} else {
@@ -1008,7 +1015,7 @@ the current 'bubble line number' is stor
The value of it is stored in $Apache:lonxml::counter when live and
stored back to env after done.
-=item &increment_counter($increment);
+=item &increment_counter($increment, $part_response);
Increments the internal counter environment variable a specified amount
@@ -1434,17 +1441,25 @@ SIMPLECONTENT
sub verify_html {
my ($filecontents)=@_;
- if ($filecontents!~/(?:\<|\<\;)(?:html|xml)[^\<]*(?:\>|\>\;)/is) {
- return &mt('File does not have [_1] or [_2] starting tag','<html>','<xml>');
- }
- if ($filecontents!~/(?:\<|\<\;)\/(?:html|xml)(?:\>|\>\;)/is) {
- return &mt('File does not have [_1] or [_2] ending tag','<html>','<xml>');
- }
- if ($filecontents!~/(?:\<|\<\;)(?:body|frameset)[^\<]*(?:\>|\>\;)/is) {
- return &mt('File does not have [_1] or [_2] starting tag','<body>','<frameset>');
- }
- if ($filecontents!~/(?:\<|\<\;)\/(?:body|frameset)[^\<]*(?:\>|\>\;)/is) {
- return &mt('File does not have [_1] or [_2] ending tag','<body>','<frameset>');
+ my ($is_html,$is_xml);
+ if ($filecontents =~/(?:\<|\<\;)\?xml[^\<]*\?(?:\>|\>\;)/is) {
+ $is_xml = 1;
+ } elsif ($filecontents =~/(?:\<|\<\;)html(?:\s+[^\<]+|\s*)(?:\>|\>\;)/is) {
+ $is_html = 1;
+ }
+ unless ($is_xml || $is_html) {
+ return &mt('File does not have [_1] or [_2] starting tag','<html>','<?xml ?>');
+ }
+ if ($is_html) {
+ if ($filecontents!~/(?:\<|\<\;)\/html(?:\>|\>\;)/is) {
+ return &mt('File does not have [_1] ending tag','<html>');
+ }
+ if ($filecontents!~/(?:\<|\<\;)(?:body|frameset)[^\<]*(?:\>|\>\;)/is) {
+ return &mt('File does not have [_1] or [_2] starting tag','<body>','<frameset>');
+ }
+ if ($filecontents!~/(?:\<|\<\;)\/(?:body|frameset)[^\<]*(?:\>|\>\;)/is) {
+ return &mt('File does not have [_1] or [_2] ending tag','<body>','<frameset>');
+ }
}
return '';
}
@@ -1492,27 +1507,27 @@ sub inserteditinfo {
my $dragmath_button;
my ($add_to_onload, $add_to_onresize);
$initialize=&Apache::lonhtmlcommon::spellheader();
- if (($filetype eq 'html') && (&Apache::lonhtmlcommon::htmlareabrowser())) {
+ if (($filetype eq 'html') && (&Apache::lonhtmlcommon::htmlareabrowser())) {
my $lang = &Apache::lonhtmlcommon::htmlarea_lang();
my %textarea_args = (
fullpage => 'true',
dragmath => 'math',
);
- $initialize .=
- &Apache::lonhtmlcommon::htmlareaselectactive(\%textarea_args).
- (<
+//
FULLPAGE
+ if ($filetype eq 'html') {
+ $dragmath_button = ''.&Apache::lonhtmlcommon::dragmath_button('filecont',1).'';
+ $initialize .= "\n".&Apache::lonhtmlcommon::dragmath_js('EditMathPopup');
}
- if ($filetype eq 'html' || $filetype eq 'tex') {
- $dragmath_button = '