1: # The LearningOnline Network with CAPA
2: # definition of tags that give a structure to a document
3: #
4: # $Id: structuretags.pm,v 1.78 2002/01/24 04:18:54 harris41 Exp $
5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
28: # 2/19 Guy
29: # 6/26/2001 fixed extra web display at end of <web></web> tags
30: # 8/17,8/18,8/20 Gerd Kortemeyer
31:
32: package Apache::structuretags;
33:
34: use strict;
35: use Apache::lonnet;
36:
37: BEGIN {
38: &Apache::lonxml::register('Apache::structuretags',('block','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext'));
39: # &Apache::lonxml::register_insert('problem','',('part','postanswerdate','preduedate'))
40: }
41:
42: sub start_web {
43: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
44: my $bodytext=&Apache::lonxml::get_all_text("/web",$$parser[$#$parser]);
45: if ($target eq 'web') {
46: return $bodytext;
47: }
48: return '';
49: }
50:
51: sub end_web {
52: return '';
53: }
54:
55: sub start_tex {
56: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
57: my $bodytext=&Apache::lonxml::get_all_text("/tex",$$parser[$#$parser]);
58: if ($target eq 'tex') {
59: return $bodytext
60: }
61: return '';
62: }
63:
64: sub end_tex {
65: return '';
66: }
67:
68: sub page_start {
69: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
70: my $result=&Apache::londefdef::start_html($target,$token,$tagstack,$parstack,$parser,$safeeval);
71: my $head_tag_start='<head>'.&Apache::lonxml::registerurl();
72: my $body_tag_start='<body onLoad="'.&Apache::lonxml::loadevents().'" '.
73: 'onUnload="'.&Apache::lonxml::unloadevents().'" ';
74: my $background=&Apache::lonxml::get_param('background',$parstack,$safeeval);
75: if ($background) {
76: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
77: $background;
78: $body_tag_start.='background="'.$background.'" ';
79: } else {
80: my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack,$safeeval);
81: if ($bgcolor) {
82: $body_tag_start.='bgcolor="'.$bgcolor.'" ';
83: } else {
84: $body_tag_start.='bgcolor="#ffffff"';
85: }
86: }
87: $body_tag_start.='>';
88: return ($result,$head_tag_start,$body_tag_start);
89: }
90:
91: sub initialize_storage {
92: %Apache::lonhomework::results=();
93: my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();
94: if ($ENV{'request.state'} eq 'construct') {
95: %Apache::lonhomework::history=
96: &Apache::lonnet::tmprestore($ENV{'request.uri'},'',$domain,$name);
97: my ($temp)=keys %Apache::lonhomework::history ;
98: &Apache::lonxml::debug("Return message of $temp");
99: } else {
100: %Apache::lonhomework::history=
101: &Apache::lonnet::restore($symb,$courseid,$domain,$name);
102: }
103: #ignore error conditions
104: my ($temp)=keys %Apache::lonhomework::history ;
105: if ($temp =~ m/^error:.*/) { %Apache::lonhomework::history=(); }
106: }
107:
108: # -------------------------------------------------------------finalize_storage
109: # Stores away the result has to a student's environment
110: # checks form.grade_ for specific values, other wises stores
111: # to the running users environment
112: sub finalize_storage {
113: my $result;
114: my ($temp) = keys %Apache::lonhomework::results;
115: if ( $temp ne '' ) {
116: my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();
117: if ($ENV{'request.state'} eq 'construct') {
118: $result=&Apache::lonnet::tmpstore(\%Apache::lonhomework::results,
119: $ENV{'request.uri'},'',$domain,$name);
120: &Apache::lonxml::debug('Construct Store return message:'.$result);
121: } else {
122: $result=&Apache::lonnet::cstore(\%Apache::lonhomework::results,
123: $symb,$courseid,$domain,$name);
124: &Apache::lonxml::debug('Store return message:'.$result);
125: }
126: }
127: return $result;
128: }
129:
130: sub checkout_msg {
131: return (<<ENDCHECKOUT);
132: <h2>The resource needs to be checked out</h2>
133: As a resource gets checked out, a unique timestamped ID is given to it, and a
134: permanent record is left in the system.<p />
135: <font color=red>
136: Checking out resources is subject to course policies, and may exclude future
137: credit even if done erroneously.<p />
138: </font>
139: <form method=post>
140: <input type=button name="doescheckout"
141: value="Check out Exam for Viewing"
142: onClick="if (confirm('Check out Exam?')) { this.form.submit(); }" />
143: </form>
144: ENDCHECKOUT
145: }
146:
147: sub start_problem {
148: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
149:
150: #intialize globals
151: $Apache::inputtags::part='0';
152: @Apache::inputtags::responselist = ();
153: @Apache::inputtags::previous=();
154: &initialize_storage();
155: if ($target eq 'web') {
156: &Apache::lonhomework::showhash(%Apache::lonhomework::history);
157: }
158: $Apache::lonhomework::type=&Apache::lonnet::EXT('resource.0.type');
159: &Apache::lonxml::debug("Found this to be of type :$Apache::lonhomework::type:");
160: if ($Apache::lonhomework::type eq '') {
161: my $uri=$ENV{'request.uri'};
162: if ($uri=~/\.(\w+)$/) {
163: $Apache::lonhomework::type=$1;
164: &Apache::lonxml::debug("Using type of $1");
165: } else {
166: $Apache::lonhomework::type='problem';
167: &Apache::lonxml::debug("Using default type, problem, :$uri:");
168: }
169: }
170:
171: #added vars to the scripting enviroment
172: my $expression='$external::part='.$Apache::inputtags::part.';';
173: &Apache::run::run($expression,$safeeval);
174: my $status;
175: my $accessmsg;
176:
177: #should get back a <html> or the neccesary stuff to start XML/MathML
178: my ($result,$head_tag_start,$body_tag_start)=
179: &page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);
180:
181:
182: if ($target eq 'web' || $target eq 'grade' || $target eq 'answer') {
183: #handle exam checkout
184: if ($Apache::lonhomework::type eq 'exam') {
185: my $token=$Apache::lonhomework::history{"resource.0.outtoken"};
186: if (($ENV{'form.doescheckout'}) && (!$token)) {
187: $token=&Apache::lonxml::maketoken();
188: $Apache::lonhomework::history{"resource.0.outtoken"}=$token;
189: }
190: $body_tag_start.=&Apache::lonxml::printtokenheader($target,$token);
191: }
192:
193: #handle rand seed in construction space
194: my $rndseed;
195: if ($ENV{'request.state'} eq "construct") {
196: $rndseed=$ENV{'form.rndseed'};
197: if (!$rndseed) {
198: $rndseed=time;
199: $ENV{'form.rndseed'}=$rndseed;
200: }
201: &Apache::run::run('$external::randomseed='.$rndseed.';',$safeeval);
202: }
203: ($status,$accessmsg) = &Apache::lonhomework::check_access('0');
204: push (@Apache::inputtags::status,$status);
205: my $expression='$external::datestatus="'.$status.'";';
206: $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.0.solved"}.'";';
207: &Apache::run::run($expression,$safeeval);
208: if (( $status eq 'CLOSED' ) ||
209: ( $status eq 'UNCHECKEDOUT') ||
210: ( $status eq 'BANNED')) {
211: my $bodytext=&Apache::lonxml::get_all_text("/problem",$$parser[$#$parser]);
212: if ( $target eq "web" ) {
213: $result.= $head_tag_start.'</head>';
214: my $msg=$body_tag_start.
215: '<h1>Not open to be viewed</h1>';
216: if ($status eq 'CLOSED') {
217: $msg.='The problem '.$accessmsg;
218: } elsif ($status eq 'UNCHECKEDOUT') {
219: $msg.=&checkout_msg;
220: }
221: $result.=$msg.'<br />';
222: }
223: } elsif ($target eq 'web') {
224: my $name= &Apache::lonxml::get_param('name',$parstack,$safeeval);
225: if ($name eq '') {
226: $name=&Apache::lonnet::EXT('resource.title');
227: if ($name eq 'con_lost') { $name = ''; }
228: }
229: $Apache::lonhomework::name=$name;
230: if ($status eq 'CAN_ANSWER') {
231: # create a page header and exit
232: $result.="$head_tag_start<title>$name</title></head>\n
233: $body_tag_start\n
234: <form name=\"lonhomework\" method=\"POST\" action=\"".$ENV{'request.uri'}."\">".
235: '<input type="hidden" name="submitted" value="yes" />';
236: if ($ENV{'request.state'} eq "construct") {
237: $result.=
238: '<input type="hidden" name="problemmode" value="View" />
239: <input type="submit" name="problemmode" value="Edit" />
240: <input type="submit" name="problemmode" value="EditXML" />
241: Random Seed:<input type="text" name="rndseed" width="10" value="'.
242: $rndseed.'" />
243: <input type="submit" name="changerandseed" value="Change" />
244: <input type="submit" name="resetdata" value="Reset Submissions" />
245: <hr />';
246: }
247: # if we are viewing someone else preserve that info
248: if (defined $ENV{'form.grade_symb'}) {
249: foreach my $field ('symb','courseid','domain','username') {
250: $result .= '<input type="hidden" name="grade_'.$field.
251: '" value="'.$ENV{"form.grade_$field"}.'" />'."\n";
252: }
253: }
254: } elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER'
255: || $status eq 'CLOSED') {
256: $result.=$head_tag_start.
257: "<title>$name</title></head>\n$body_tag_start\n";
258: }
259: }
260: } elsif ($target eq 'edit') {
261: $result.=$head_tag_start."</head>".$body_tag_start.
262: '<form name="lonhomework" method="POST" action="'.
263: $ENV{'request.uri'}.'">
264: <input type="hidden" name="submitted" value="edit" />
265: <input type="hidden" name="problemmode" value="Edit" />
266: <input type="submit" name="problemmode" value="View" />
267: <input type="submit" name="problemmode" value="EditXML" />
268: <input type="submit" name="Undo" value="undo" /> <hr />
269: <input type="submit" name="submit" value="Submit Changes" /><br />
270: ';
271: my $temp=&Apache::edit::insertlist($target,$token);
272: $result.=$temp;
273: } elsif ($target eq 'modified') {
274: $result=$token->[4];
275: $result.=&Apache::edit::handle_insert();
276: } elsif ($target eq 'tex') {
277: $result .= '\begin{document}\noindent\textbf{Problem.}\newline';
278: } else {
279: # page_start returned a starting result, delete it if we don't need it
280: $result = '';
281: }
282: return $result;
283: }
284:
285: sub end_problem {
286: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
287: my $result='';
288: my $status=$Apache::inputtags::status['-1'];
289: if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ) {
290: if ( $target eq 'grade' && $Apache::inputtags::part eq '0' &&
291: $status eq 'CAN_ANSWER') {
292: # if part is zero, no <part>s existed, so we need to the grading
293: &Apache::inputtags::grade;
294: } elsif ( $target eq 'web' && $Apache::inputtags::part eq '0') {
295: # if part is zero, no <part>s existed, so we need show the current
296: # grading status
297: $result.= &Apache::inputtags::gradestatus($Apache::inputtags::part);
298: }
299: if (
300: ($target eq 'web' && ($ENV{'request.state'} ne 'construct')) ||
301: ($target eq 'answer')
302: ) {
303: if ($status eq 'CAN_ANSWER') {
304: $result.="</form></body>\n";
305: } elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER') {
306: $result.="</body>\n";
307: }
308: $result.=&Apache::lonxml::xmlend();
309: }
310: if ($target eq 'grade') {
311: &Apache::lonhomework::showhash(%Apache::lonhomework::results);
312: &finalize_storage();
313: }
314: } elsif ($target eq 'meta') {
315: if ($Apache::inputtags::part eq '0') {
316: $result=&Apache::response::mandatory_part_meta;
317: }
318: } elsif ($target eq 'edit') {
319: &Apache::lonxml::debug("in end_problem with $target, edit");
320: $result='<br /><input type="submit" name="submit" value="Submit Changes" />';
321: } elsif ($target eq 'tex') {
322: $result .= '\end{document}';
323: }
324: return $result;
325: }
326:
327: sub start_library {
328: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
329: my ($result,$head_tag_start,$body_tag_start)=
330: &page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);
331: if ($target eq 'edit') {
332: $result.=$head_tag_start."</head>".$body_tag_start.
333: '<form name="lonhomework" method="POST" action="'.$ENV{'request.uri'}.'">
334: <input type="hidden" name="submitted" value="edit" />
335: <input type="hidden" name="problemmode" value="Edit" />
336: <input type="submit" name="problemmode" value="View" />
337: <input type="submit" name="Undo" value="undo" /> <hr />
338: ';
339: my $temp=&Apache::edit::insertlist($target,$token);
340: $result.=$temp;
341: return $result;
342: }
343: if ($target eq 'modified') {
344: $result=$token->[4];
345: $result.=&Apache::edit::handle_insert();
346: return $result;
347: }
348: return '';
349: }
350:
351: sub end_library {
352: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
353: my $result='';
354: if ($target eq 'edit') {
355: $result='<br /><input type="submit" name="submit" value="Submit Changes" />';
356: }
357: return $result;
358: }
359:
360: sub start_block {
361: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
362:
363: if ($target eq 'web' || $target eq 'grade' || $target eq 'answer') {
364: my $code = @$parstack[$#$parstack];
365: $code =~ s/\"//g;
366: $code .=';return $condition;';
367: # print "<br />$code<br />";
368: my $result = &Apache::run::run($code,$safeeval);
369: &Apache::lonxml::debug("block :$code: returned :$result:");
370: if ( ! $result ) {
371: my $skip=&Apache::lonxml::get_all_text("/block",$$parser[$#$parser]);
372: &Apache::lonxml::debug("skipping ahead :$skip: $$parser[$#$parser]");
373: }
374: }
375: return "";
376: }
377:
378: sub end_block {
379: return '';
380: }
381:
382: sub start_while {
383: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
384:
385: my $code = @$parstack[$#$parstack];
386: $code =~ s/\"//g;
387: $code .=';return $condition;';
388:
389: push( @Apache::structuretags::whileconds, $code);
390: my $result = &Apache::run::run($code,$safeeval);
391: my $bodytext=$$parser[$#$parser]->get_text("/while");
392: push( @Apache::structuretags::whilebody, $bodytext);
393: if ( $result ) {
394: &Apache::lonxml::newparser($parser,\$bodytext);
395: }
396: return "";
397: }
398:
399: sub end_while {
400: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
401: my $code = pop @Apache::structuretags::whileconds;
402: my $bodytext = pop @Apache::structuretags::whilebody;
403: my $result = &Apache::run::run($code,$safeeval);
404: if ( $result ) {
405: &Apache::lonxml::newparser($parser,\$bodytext);
406: }
407: return "";
408: }
409:
410: # <randomlist>
411: # <tag1>..</tag1>
412: # <tag2>..</tag2>
413: # <tag3>..</tag3>
414: # ...
415: # </randomlist>
416: sub start_randomlist {
417: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
418: if ($target eq 'answer' || $target eq 'grade' || $target eq 'web') {
419: my $body= &Apache::lonxml::get_all_text("/randomlist",$$parser[$#$parser]);
420: my $b_parser= HTML::TokeParser->new(\$body);
421: my $b_tok;
422: my @randomlist;
423: my $list_item;
424: while($b_tok = $b_parser->get_token() ) {
425: if($b_tok->[0] eq 'S') { # start tag
426: # get content of the tag until matching end tag
427: # get all text upto the matching tag
428: # and push the content into @randomlist
429: $list_item = &Apache::lonxml::get_all_text('/'.$b_tok->[1],$b_parser);
430: $list_item = "$b_tok->[4]"."$list_item"."</$b_tok->[1]>";
431: push(@randomlist,$list_item);
432: # print "<br /><b>START-TAG $b_tok->[1], $b_tok->[4], $list_item</b>";
433: }
434: if($b_tok->[0] eq 'T') { # text
435: # what to do with text in between tags?
436: # print "<b>TEXT $b_tok->[1]</b><br />";
437: }
438: # if($b_tok->[0] eq 'E') { # end tag, should not happen
439: # print "<b>END-TAG $b_tok->[1]</b><br />";
440: # }
441: }
442:
443: my @idx_arr = (0 .. $#randomlist);
444: &Apache::structuretags::shuffle(\@idx_arr);
445: my $bodytext = '';
446: for(0 .. $#randomlist) {
447: $bodytext .= "$randomlist[ $idx_arr[$_] ]";
448: }
449: &Apache::lonxml::newparser($parser,\$bodytext);
450: }
451: return "";
452: }
453:
454: sub shuffle {
455: my $a=shift;
456: my $i;
457: if (defined(@$a)) {
458: &Apache::response::setrandomnumber();
459: for($i=@$a;--$i;) {
460: my $j=int rand($i+1);
461: next if $i == $j;
462: @$a[$i,$j] = @$a[$j,$i];
463: }
464: }
465: }
466:
467: sub end_randomlist {
468: return '';
469: }
470:
471: sub start_part {
472: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
473: my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval);
474: if ($id eq '') { $id = $Apache::lonxml::curdepth; }
475: $Apache::inputtags::part=$id;
476: @Apache::inputtags::responselist = ();
477: @Apache::inputtags::previous=();
478: if ($target eq 'meta') {
479: return &Apache::response::mandatory_part_meta;
480: } elsif ($target eq 'web' || $target eq 'grade' || $target eq 'answer') {
481: my ($status,$accessmsg) = &Apache::lonhomework::check_access($id);
482: push (@Apache::inputtags::status,$status);
483: my $expression='$external::datestatus="'.$status.'";';
484: $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$id.solved"}.'";';
485: &Apache::run::run($expression,$safeeval);
486: if ( $status eq 'CLOSED' ) {
487: my $bodytext=&Apache::lonxml::get_all_text("/part",$$parser[$#$parser]);
488: if ( $target eq "web" ) {
489: return "<br />Part is not open to be viewed. It $accessmsg<br />";
490: }
491: }
492: }
493: return '';
494: }
495:
496: sub end_part {
497: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
498: &Apache::lonxml::debug("in end_part $target ");
499: my $status=$Apache::inputtags::status['-1'];
500: pop @Apache::inputtags::status;
501: if ( $target eq 'meta' ) { return ''; }
502: if ( $target eq 'grade' && $status eq 'CAN_ANSWER') {
503: return &Apache::inputtags::grade;
504: }
505: if ($target eq 'web') {
506: return &Apache::inputtags::gradestatus($Apache::inputtags::part);
507: }
508: return '';
509: }
510:
511: sub start_preduedate {
512: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
513: if ($target eq 'web' || $target eq 'grade' || $target eq 'answer') {
514: if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' &&
515: $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER' ) {
516: &Apache::lonxml::get_all_text("/preduedate",$$parser[$#$parser]);
517: }
518: }
519: return '';
520: }
521:
522: sub end_preduedate {
523: return '';
524: }
525:
526: sub start_postanswerdate {
527: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
528: if ($target eq 'web' || $target eq 'grade') {
529: if ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') {
530: &Apache::lonxml::get_all_text("/postanswerdate",$$parser[$#$parser]);
531: }
532: }
533: return '';
534: }
535:
536: sub end_postanswerdate {
537: return '';
538: }
539:
540: sub start_notsolved {
541: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
542: if ($target eq 'web' || $target eq 'grade' || $target eq 'answer') {
543: my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
544: &Apache::lonxml::debug("not solved has :$gradestatus:");
545: if ($gradestatus =~ /^correct/) {
546: &Apache::lonxml::debug("skipping");
547: &Apache::lonxml::get_all_text("/notsolved",$$parser[$#$parser]);
548: }
549: }
550: return '';
551: }
552:
553: sub end_notsolved {
554: return '';
555: }
556:
557: sub start_solved {
558: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
559: if ($target eq 'web' || $target eq 'grade' || $target eq 'answer') {
560: my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
561: if ($gradestatus !~ /^correct/) {
562: &Apache::lonxml::get_all_text("/solved",$$parser[$#$parser]);
563: }
564: }
565: return '';
566: }
567:
568: sub end_solved {
569: return '';
570: }
571:
572: sub start_startouttext {
573: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
574: my @result=(''.'');
575: if ($target eq 'edit' || $target eq 'modified' ) { @result=('','no'); }
576: return (@result);
577: }
578: sub end_startouttext {
579: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
580: my $result='';
581: my $text='';
582:
583: if ($target eq 'edit') {
584: $text=&Apache::lonxml::get_all_text("endouttext",$$parser[-1]);
585: $result.=&Apache::edit::start_table($token)."<tr><td>Text Block</td>
586: <td>Delete:".
587: &Apache::edit::deletelist($target,$token)
588: ."</td>
589: <td>".
590: &Apache::edit::insertlist($target,$token).
591: "</td>
592: </tr><tr><td colspan=\"3\">\n".
593: &Apache::edit::editfield($token->[1],$text,"",50,4);
594: }
595: if ($target eq 'modified') {
596: $text=&Apache::lonxml::get_all_text("endouttext",$$parser['-1']);
597: $result='<startouttext />'.&Apache::edit::modifiedfield();
598: }
599: return $result;
600: }
601: sub start_endouttext {
602: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
603: my $result='';
604: if ($target eq "edit" ) { $result="</td></tr>".&Apache::edit::end_table()."\n"; }
605: if ($target eq "modified") { $result='<endouttext />'; }
606: return $result;
607: }
608: sub end_endouttext {
609: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
610: my @result=('','');
611: if ($target eq "edit" || $target eq 'modified') { @result=('','no'); }
612: return (@result);
613: }
614: sub delete_startouttext {
615: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
616: # my $text=&Apache::lonxml::get_all_text("endouttext",$$parser['-1']);
617: my $text=$$parser['-1']->get_text("/endouttext");
618: my $ntoken=$$parser['-1']->get_token();
619: &Apache::lonxml::debug("Deleting :$text: and :$ntoken->[0]:$ntoken->[1]:$ntoken->[2]: for startouttext");
620: &Apache::lonxml::end_tag($tagstack,$parstack,$ntoken);
621: # Deleting 2 parallel tag pairs, but we need the numbers later to look like
622: # they did the last time round
623: &Apache::lonxml::increasedepth($ntoken);
624: &Apache::lonxml::decreasedepth($ntoken);
625: return 1;
626: }
627:
628: 1;
629: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>