[LON-CAPA-cvs] cvs: loncom /homework edit.pm hint.pm inputtags.pm randomlabel.pm structuretags.pm /xml londefdef.pm lonplot.pm scripttag.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 07 Feb 2003 22:03:21 -0000
This is a MIME encoded message
--albertel1044655401
Content-Type: text/plain
albertel Fri Feb 7 17:03:21 2003 EDT
Modified files:
/loncom/homework edit.pm hint.pm inputtags.pm randomlabel.pm
structuretags.pm
/loncom/xml londefdef.pm lonplot.pm scripttag.pm
Log:
- get_all_text() really wants to see the entire stack of parsers now, that way style redefinitons of tags can do a get_all_text across styl def boundaries.
--albertel1044655401
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20030207170321.txt"
Index: loncom/homework/edit.pm
diff -u loncom/homework/edit.pm:1.44 loncom/homework/edit.pm:1.45
--- loncom/homework/edit.pm:1.44 Mon Jan 27 19:14:17 2003
+++ loncom/homework/edit.pm Fri Feb 7 17:03:21 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# edit mode helpers
#
-# $Id: edit.pm,v 1.44 2003/01/28 00:14:17 albertel Exp $
+# $Id: edit.pm,v 1.45 2003/02/07 22:03:21 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -159,7 +159,7 @@
}
if (!$result) {
my $endtag='/'.$token->[1];
- my $bodytext=&Apache::lonxml::get_all_text($endtag,$$parser[$#$parser]);
+ my $bodytext=&Apache::lonxml::get_all_text($endtag,$parser);
$$parser['-1']->get_token();
&Apache::lonxml::debug("Deleting :$bodytext: for $token->[1]");
&Apache::lonxml::end_tag($tagstack,$parstack,$token);
Index: loncom/homework/hint.pm
diff -u loncom/homework/hint.pm:1.33 loncom/homework/hint.pm:1.34
--- loncom/homework/hint.pm:1.33 Mon Nov 25 16:36:42 2002
+++ loncom/homework/hint.pm Fri Feb 7 17:03:21 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# implements the tags that control the hints
#
-# $Id: hint.pm,v 1.33 2002/11/25 21:36:42 albertel Exp $
+# $Id: hint.pm,v 1.34 2003/02/07 22:03:21 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -56,7 +56,7 @@
if ($target eq 'web') {$result='<table bgcolor="#dddddd"><tr><td>';}
}
if ($skiptoend) {
- &Apache::lonxml::get_all_text("/hintgroup",$$parser[$#$parser]);
+ &Apache::lonxml::get_all_text("/hintgroup",$parser);
}
} elsif ($target eq 'tex') {
$result .= '\keephidden{';
@@ -216,10 +216,10 @@
foreach $which (@Apache::hint::which) { if ($which eq $on) { $show = 1; last } }
}
if (!$show) {
- &Apache::lonxml::get_all_text("/hintpart",$$parser[$#$parser]);
+ &Apache::lonxml::get_all_text("/hintpart",$parser);
}
} elsif ($target eq 'grade') {
- &Apache::lonxml::get_all_text("/hintpart",$$parser[$#$parser]);
+ &Apache::lonxml::get_all_text("/hintpart",$parser);
} elsif ($target eq 'edit') {
$result.= &Apache::edit::tag_start($target,$token);
$result.= &Apache::edit::text_arg('On:','on',$token);
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.83 loncom/homework/inputtags.pm:1.84
--- loncom/homework/inputtags.pm:1.83 Mon Jan 27 12:30:27 2003
+++ loncom/homework/inputtags.pm Fri Feb 7 17:03:21 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.83 2003/01/27 17:30:27 sakharuk Exp $
+# $Id: inputtags.pm,v 1.84 2003/02/07 22:03:21 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -93,17 +93,17 @@
"rows=\"$rows\" cols=\"$cols\">".$oldresponse;
if ($oldresponse ne '') {
#get rid of any startup text if the user has already responded
- &Apache::lonxml::get_all_text("/textfield",$$parser[-1]);
+ &Apache::lonxml::get_all_text("/textfield",$parser);
}
} else {
#right or wrong don't show it
#$result='<table border="1"><tr><td><i>'.$oldresponse.'</i></td></tr></table>';
$result='';
#get rid of any startup text
- &Apache::lonxml::get_all_text("/textfield",$$parser[-1]);
+ &Apache::lonxml::get_all_text("/textfield",$parser);
}
} elsif ($target eq 'grade') {
- my $seedtext=&Apache::lonxml::get_all_text("/textfield",$$parser[-1]);
+ my $seedtext=&Apache::lonxml::get_all_text("/textfield",$parser);
if ($seedtext eq $ENV{'form.HWVAL'.$resid}) {
# if the seed text is still there it wasn't a real submission
$ENV{'form.HWVAL'.$resid}='';
@@ -112,7 +112,7 @@
$result.=&Apache::edit::tag_start($target,$token);
$result.=&Apache::edit::text_arg('Rows:','rows',$token,4);
$result.=&Apache::edit::text_arg('Columns:','cols',$token,4);
- my $bodytext=&Apache::lonxml::get_all_text("/textfield",$$parser[-1]);
+ my $bodytext=&Apache::lonxml::get_all_text("/textfield",$parser);
$result.=&Apache::edit::editfield($token->[1],$bodytext,'Text you want to appear by default:',80,2);
} elsif ($target eq 'modified') {
my $constructtag=&Apache::edit::get_new_args($token,$parstack,
Index: loncom/homework/randomlabel.pm
diff -u loncom/homework/randomlabel.pm:1.42 loncom/homework/randomlabel.pm:1.43
--- loncom/homework/randomlabel.pm:1.42 Thu Jan 23 13:26:10 2003
+++ loncom/homework/randomlabel.pm Fri Feb 7 17:03:21 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# random labelling tool
#
-# $Id: randomlabel.pm,v 1.42 2003/01/23 18:26:10 www Exp $
+# $Id: randomlabel.pm,v 1.43 2003/02/07 22:03:21 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -373,7 +373,7 @@
my $type = &Apache::lonxml::get_param('type',$parstack,$safeeval,-2);
if ($target eq 'web' || $target eq 'tex' ||
$target eq 'grade' || $target eq 'answer' || $target eq 'analyze') {
- my $ltext=&Apache::lonxml::get_all_text("/label",$$parser[-1]);
+ my $ltext=&Apache::lonxml::get_all_text("/label",$parser);
$ltext=&Apache::run::evaluate($ltext,$safeeval,$$parstack[-1]);
if ($type eq 'image') {
&Apache::lonxml::debug("Turning $ltext and $Apache::lonxml::pwd[-1]");
@@ -387,7 +387,7 @@
push(@Apache::randomlabel::label_arr,$ltext);
} elsif ($target eq 'edit') {
$result.=&Apache::edit::tag_start($target,$token,"$type Label");
- my $text=&Apache::lonxml::get_all_text("/label",$$parser[-1]);
+ my $text=&Apache::lonxml::get_all_text("/label",$parser);
if ($type eq 'image') {
$result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
$result.=&Apache::edit::text_arg('Description:','description',$token);
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.145 loncom/homework/structuretags.pm:1.146
--- loncom/homework/structuretags.pm:1.145 Fri Feb 7 16:50:12 2003
+++ loncom/homework/structuretags.pm Fri Feb 7 17:03:21 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.145 2003/02/07 21:50:12 albertel Exp $
+# $Id: structuretags.pm,v 1.146 2003/02/07 22:03:21 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -43,7 +43,7 @@
sub start_web {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- my $bodytext=&Apache::lonxml::get_all_text("/web",$$parser[$#$parser]);
+ my $bodytext=&Apache::lonxml::get_all_text("/web",$parser);
if ($target eq 'web') {
return $bodytext;
}
@@ -56,7 +56,7 @@
sub start_tex {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- my $bodytext=&Apache::lonxml::get_all_text("/tex",$$parser[$#$parser]);
+ my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser);
if ($target eq 'tex') {
return $bodytext.' ';
}
@@ -245,7 +245,7 @@
# won't get reset
if ( $Apache::inputtags::part ne '' && $target != 'meta' ) {
&Apache::lonxml::error('Only one problem allowed in a .problem file');
- my $bodytext=&Apache::lonxml::get_all_text("/problem",$$parser[-1]);
+ my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser);
return '';
}
#intialize globals
@@ -526,7 +526,7 @@
$result='1';
}
if ( ! $result ) {
- my $skip=&Apache::lonxml::get_all_text("/block",$$parser[-1]);
+ my $skip=&Apache::lonxml::get_all_text("/block",$parser);
&Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]");
}
$result='';
@@ -589,7 +589,7 @@
my $result;
if ($target eq 'answer' || $target eq 'grade' || $target eq 'web' ||
$target eq 'tex' || $target eq 'analyze') {
- my $body= &Apache::lonxml::get_all_text("/randomlist",$$parser[$#$parser]);
+ my $body= &Apache::lonxml::get_all_text("/randomlist",$parser);
my $b_parser= HTML::TokeParser->new(\$body);
my $b_tok;
my @randomlist;
@@ -674,7 +674,7 @@
$expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$id.solved"}.'";';
&Apache::run::run($expression,$safeeval);
if ( $status eq 'CLOSED' ) {
- my $bodytext=&Apache::lonxml::get_all_text("/part",$$parser[$#$parser]);
+ my $bodytext=&Apache::lonxml::get_all_text("/part",$parser);
if ( $target eq "web" ) {
$result="<br />Part is not open to be viewed. It $accessmsg<br />";
} elsif ( $target eq 'tex' ) {
@@ -729,7 +729,7 @@
if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' &&
$Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER' &&
$Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') {
- &Apache::lonxml::get_all_text("/preduedate",$$parser[$#$parser]);
+ &Apache::lonxml::get_all_text("/preduedate",$parser);
}
}
return '';
@@ -743,7 +743,7 @@
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
if ($target eq 'web' || $target eq 'grade' || $target eq 'tex') {
if ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') {
- &Apache::lonxml::get_all_text("/postanswerdate",$$parser[$#$parser]);
+ &Apache::lonxml::get_all_text("/postanswerdate",$parser);
}
} elsif ($target eq 'tex') {
return '\vskip 0 mm \noindent';
@@ -762,7 +762,7 @@
&Apache::lonxml::debug("not solved has :$gradestatus:");
if ($gradestatus =~ /^correct/) {
&Apache::lonxml::debug("skipping");
- &Apache::lonxml::get_all_text("/notsolved",$$parser[$#$parser]);
+ &Apache::lonxml::get_all_text("/notsolved",$parser);
}
}
return '';
@@ -777,7 +777,7 @@
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') {
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
if ($gradestatus !~ /^correct/) {
- &Apache::lonxml::get_all_text("/solved",$$parser[$#$parser]);
+ &Apache::lonxml::get_all_text("/solved",$parser);
}
}
return '';
@@ -799,7 +799,7 @@
my $text='';
if ($target eq 'edit') {
- $text=&Apache::lonxml::get_all_text("endouttext",$$parser[-1]);
+ $text=&Apache::lonxml::get_all_text("endouttext",$parser);
$result.=&Apache::edit::start_table($token)."<tr><td>Text Block</td>
<td>Delete:".
&Apache::edit::deletelist($target,$token)
@@ -810,7 +810,7 @@
&Apache::edit::editfield($token->[1],$text,"",80,4);
}
if ($target eq 'modified') {
- $text=&Apache::lonxml::get_all_text("endouttext",$$parser['-1']);
+ $text=&Apache::lonxml::get_all_text("endouttext",$parser);
$result='<startouttext />'.&Apache::edit::modifiedfield();
}
if ($target eq 'tex') {
@@ -835,7 +835,7 @@
}
sub delete_startouttext {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
-# my $text=&Apache::lonxml::get_all_text("endouttext",$$parser['-1']);
+# my $text=&Apache::lonxml::get_all_text("endouttext",$parser);
my $text=$$parser['-1']->get_text("/endouttext");
my $ntoken=$$parser['-1']->get_token();
&Apache::lonxml::debug("Deleting :$text: and :$ntoken->[0]:$ntoken->[1]:$ntoken->[2]: for startouttext");
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.111 loncom/xml/londefdef.pm:1.112
--- loncom/xml/londefdef.pm:1.111 Wed Feb 5 18:17:32 2003
+++ loncom/xml/londefdef.pm Fri Feb 7 17:03:21 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.111 2003/02/05 23:17:32 albertel Exp $
+# $Id: londefdef.pm,v 1.112 2003/02/07 22:03:21 albertel Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -327,7 +327,7 @@
my $args='';
if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
if ($args eq '') {
- &Apache::lonxml::get_all_text("/meta",$$parser[$#$parser]);
+ &Apache::lonxml::get_all_text("/meta",$parser);
} else {
$currentstring = $token->[4];
}
Index: loncom/xml/lonplot.pm
diff -u loncom/xml/lonplot.pm:1.80 loncom/xml/lonplot.pm:1.81
--- loncom/xml/lonplot.pm:1.80 Wed Jan 15 21:55:05 2003
+++ loncom/xml/lonplot.pm Fri Feb 7 17:03:21 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Dynamic plot
#
-# $Id: lonplot.pm,v 1.80 2003/01/16 02:55:05 albertel Exp $
+# $Id: lonplot.pm,v 1.81 2003/02/07 22:03:21 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -613,7 +613,7 @@
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result='';
if ($target eq 'web' || $target eq 'tex') {
- $title = &Apache::lonxml::get_all_text("/title",$$parser[-1]);
+ $title = &Apache::lonxml::get_all_text("/title",$parser);
$title=&Apache::run::evaluate($title,$safeeval,$$parstack[-1]);
$title =~ s/\n/ /g;
if (length($title) > $max_str_len) {
@@ -621,7 +621,7 @@
}
} elsif ($target eq 'edit') {
$result.=&Apache::edit::tag_start($target,$token,'Plot Title');
- my $text=&Apache::lonxml::get_all_text("/title",$$parser[-1]);
+ my $text=&Apache::lonxml::get_all_text("/title",$parser);
$result.=&Apache::edit::end_row().
&Apache::edit::start_spanning_row().
&Apache::edit::editline('',$text,'',60);
@@ -647,7 +647,7 @@
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result='';
if ($target eq 'web' || $target eq 'tex') {
- $xlabel = &Apache::lonxml::get_all_text("/xlabel",$$parser[-1]);
+ $xlabel = &Apache::lonxml::get_all_text("/xlabel",$parser);
$xlabel=&Apache::run::evaluate($xlabel,$safeeval,$$parstack[-1]);
$xlabel =~ s/\n/ /g;
if (length($xlabel) > $max_str_len) {
@@ -655,7 +655,7 @@
}
} elsif ($target eq 'edit') {
$result.=&Apache::edit::tag_start($target,$token,'Plot Xlabel');
- my $text=&Apache::lonxml::get_all_text("/xlabel",$$parser[-1]);
+ my $text=&Apache::lonxml::get_all_text("/xlabel",$parser);
$result.=&Apache::edit::end_row().
&Apache::edit::start_spanning_row().
&Apache::edit::editline('',$text,'',60);
@@ -682,7 +682,7 @@
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result='';
if ($target eq 'web' || $target eq 'tex') {
- $ylabel = &Apache::lonxml::get_all_text("/ylabel",$$parser[-1]);
+ $ylabel = &Apache::lonxml::get_all_text("/ylabel",$parser);
$ylabel = &Apache::run::evaluate($ylabel,$safeeval,$$parstack[-1]);
$ylabel =~ s/\n/ /g;
if (length($ylabel) > $max_str_len) {
@@ -690,7 +690,7 @@
}
} elsif ($target eq 'edit') {
$result .= &Apache::edit::tag_start($target,$token,'Plot Ylabel');
- my $text = &Apache::lonxml::get_all_text("/ylabel",$$parser[-1]);
+ my $text = &Apache::lonxml::get_all_text("/ylabel",$parser);
$result .= &Apache::edit::end_row().
&Apache::edit::start_spanning_row().
&Apache::edit::editline('',$text,'',60);
@@ -720,7 +720,7 @@
my %label;
&get_attributes(\%label,\%label_defaults,$parstack,$safeeval,
$tagstack->[-1]);
- my $text = &Apache::lonxml::get_all_text("/label",$$parser[-1]);
+ my $text = &Apache::lonxml::get_all_text("/label",$parser);
$text = &Apache::run::evaluate($text,$safeeval,$$parstack[-1]);
$text =~ s/\n/ /g;
$text = substr($text,0,$max_str_len) if (length($text) > $max_str_len);
@@ -729,7 +729,7 @@
} elsif ($target eq 'edit') {
$result .= &Apache::edit::tag_start($target,$token,'Plot Label');
$result .= &edit_attributes($target,$token,\%label_defaults);
- my $text = &Apache::lonxml::get_all_text("/label",$$parser[-1]);
+ my $text = &Apache::lonxml::get_all_text("/label",$parser);
$result .= &Apache::edit::end_row().
&Apache::edit::start_spanning_row().
&Apache::edit::editline('',$text,'',60);
@@ -801,12 +801,12 @@
&Apache::lonxml::warning('Use of <function> precludes use of <data>. The <data> will be omitted in favor of the <function> declaration.');
delete $curves[-1]->{'data'} ;
}
- my $function = &Apache::lonxml::get_all_text("/function",$$parser[-1]);
+ my $function = &Apache::lonxml::get_all_text("/function",$parser);
$function = &Apache::run::evaluate($function,$safeeval,$$parstack[-1]);
$curves[-1]->{'function'} = $function;
} elsif ($target eq 'edit') {
$result .= &Apache::edit::tag_start($target,$token,'Gnuplot compatible curve function');
- my $text = &Apache::lonxml::get_all_text("/function",$$parser[-1]);
+ my $text = &Apache::lonxml::get_all_text("/function",$parser);
$result .= &Apache::edit::end_row().
&Apache::edit::start_spanning_row().
&Apache::edit::editline('',$text,'',60);
@@ -839,7 +839,7 @@
'the <data> declaration.');
delete($curves[-1]->{'function'});
}
- my $datatext = &Apache::lonxml::get_all_text("/data",$$parser[-1]);
+ my $datatext = &Apache::lonxml::get_all_text("/data",$parser);
$datatext=&Apache::run::evaluate($datatext,$safeeval,$$parstack[-1]);
# Deal with cases where we're given an array...
if ($datatext =~ /^\@/) {
@@ -882,7 +882,7 @@
push @{$curves[-1]->{'data'}},\@data;
} elsif ($target eq 'edit') {
$result .= &Apache::edit::tag_start($target,$token,'Comma or space deliminated curve data');
- my $text = &Apache::lonxml::get_all_text("/data",$$parser[-1]);
+ my $text = &Apache::lonxml::get_all_text("/data",$parser);
$result .= &Apache::edit::end_row().
&Apache::edit::start_spanning_row().
&Apache::edit::editline('',$text,'',60);
Index: loncom/xml/scripttag.pm
diff -u loncom/xml/scripttag.pm:1.84 loncom/xml/scripttag.pm:1.85
--- loncom/xml/scripttag.pm:1.84 Mon Jan 13 17:18:34 2003
+++ loncom/xml/scripttag.pm Fri Feb 7 17:03:21 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# <script> definiton
#
-# $Id: scripttag.pm,v 1.84 2003/01/13 22:18:34 albertel Exp $
+# $Id: scripttag.pm,v 1.85 2003/02/07 22:03:21 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -90,7 +90,7 @@
} else {
if ($target ne "meta") {
$result = $token->[4];
- my $bodytext=&Apache::lonxml::get_all_text("/script",$$parser[$#$parser]);
+ my $bodytext=&Apache::lonxml::get_all_text("/script",$parser);
$result.=$bodytext;
}
}
@@ -365,7 +365,7 @@
my $result='';
if ($target eq 'web' ) {
if ( $ENV{'request.course.id'} ) {
- my $inside = &Apache::lonxml::get_all_text("/standalone",$$parser[-1]);
+ my $inside = &Apache::lonxml::get_all_text("/standalone",$parser);
} else {
$result='<table bgcolor="#E1E1E1" border="2"><tr><td>';
}
@@ -390,14 +390,14 @@
my $result='';
if ($target eq 'edit') {
$result=&Apache::edit::tag_start($target,$token);
- my $bodytext=&Apache::lonxml::get_all_text("/comment",$$parser[$#$parser]);
+ my $bodytext=&Apache::lonxml::get_all_text("/comment",$parser);
$result.=&Apache::edit::editfield($token->[1],$bodytext,'',80,4)
} elsif ( $target eq 'modified') {
$result=$token->[4].&Apache::edit::modifiedfield($token);
} elsif ( $target eq 'web' || $target eq 'tex' || $target eq 'grade' ||
$target eq 'answer' || $target eq 'meta' || $target eq 'analyze') {
#normally throw away comments
- my $bodytext=&Apache::lonxml::get_all_text("/comment",$$parser[$#$parser]);
+ my $bodytext=&Apache::lonxml::get_all_text("/comment",$parser);
}
return $result;
}
--albertel1044655401--