--- loncom/xml/lonxml.pm 2010/08/08 02:00:44 1.513
+++ loncom/xml/lonxml.pm 2011/11/21 21:45:36 1.524
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.513 2010/08/08 02:00:44 raeburn Exp $
+# $Id: lonxml.pm,v 1.524 2011/11/21 21:45:36 www 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,15 @@ 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');
+ $safehole->wrap(\&Apache::functionplotresponse::fpr_vectorcoords,$safeeval,'&fpr_vectorcoords');
+ $safehole->wrap(\&Apache::functionplotresponse::fpr_objectcoords,$safeeval,'&fpr_objectcoords');
+ $safehole->wrap(\&Apache::functionplotresponse::fpr_vectorlength,$safeeval,'&fpr_vectorlength');
+ $safehole->wrap(\&Apache::functionplotresponse::fpr_vectorangle,$safeeval,'&fpr_vectorangle');
+
# use Data::Dumper;
# $safehole->wrap(\&Data::Dumper::Dumper,$safeeval,'&LONCAPA_INTERNAL_Dumper');
#need to inspect this class of ops
@@ -838,7 +848,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 +1019,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 +1445,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 +1511,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 = ''.&Apache::lonhtmlcommon::dragmath_button('filecont',1).'';
- $initialize .= "\n".&Apache::lonhtmlcommon::dragmath_js('EditMathPopup');
- }
-
$add_to_onload = 'initDocument();';
$add_to_onresize = "resize_textarea('$textarea_id','LC_aftertextarea');";
@@ -1537,7 +1556,7 @@ FULLPAGE
$htmlerror=''.$htmlerror.'';
}
if (&Apache::lonhtmlcommon::htmlareabrowser()) {
- $textareaclass = 'class="LC_richDetectHtml"';
+ $textareaclass = 'class="LC_richDefaultOff"';
}
}
my $editfooter=(<'.$result.'