--- loncom/homework/structuretags.pm 2007/07/17 18:18:54 1.383
+++ loncom/homework/structuretags.pm 2008/10/24 16:22:54 1.433
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.383 2007/07/17 18:18:54 albertel Exp $
+# $Id: structuretags.pm,v 1.433 2008/10/24 16:22:54 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -42,7 +42,7 @@ use lib '/home/httpd/lib/perl/';
use LONCAPA;
BEGIN {
- &Apache::lonxml::register('Apache::structuretags',('block','languageblock','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','problemtype','startouttext','endouttext','simpleeditbutton','definetag'));
+ &Apache::lonxml::register('Apache::structuretags',('block','languageblock','translated','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','problemtype','startouttext','endouttext','simpleeditbutton','definetag'));
}
sub start_web {
@@ -74,7 +74,7 @@ sub start_tex {
if ($target ne 'edit' && $target ne 'modified') {
my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser,$style);
if ($target eq 'tex') {
- return $bodytext.' ';
+ return $bodytext.'{}';
}
} elsif ($target eq "edit" ) {
my $bodytext =
@@ -92,6 +92,44 @@ sub end_tex {
return '';
}
+sub homework_js {
+ return &Apache::loncommon::resize_textarea_js().
+ &setmode_javascript().
+ <<'JS';
+
+JS
+}
+
+sub setmode_javascript {
+ return <<"ENDSCRIPT";
+
+ENDSCRIPT
+}
+
sub page_start {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$name,
$extra_head)=@_;
@@ -108,13 +146,11 @@ sub page_start {
$parstack,$parser,$safeeval);
}
- $extra_head.= '
-
-';
+ $extra_head .= &homework_js();
+
+ unless ($env{'environment.wysiwygeditor'} eq 'on') {
+ $extra_head .= &Apache::lonhtmlcommon::dragmath_js();
+ }
my %body_args;
if (defined($found{'html'})) {
@@ -125,7 +161,7 @@ function setSubmittedPart (part) {
$extra_head .= &Apache::londefdef::generate_css_links();
- if ($target eq 'edit') {
+ if ($env{'request.state'} eq 'construct') {
$extra_head.=&Apache::edit::js_change_detection().
"