Annotation of loncom/homework/randomlabel.pm, revision 1.57
1.1 tsai 1: # The LearningOnline Network with CAPA
2: # random labelling tool
1.8 albertel 3: #
1.57 ! albertel 4: # $Id: randomlabel.pm,v 1.56 2004/01/09 00:53:19 www Exp $
1.8 albertel 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: #
1.3 tsai 28: # 7/20/2001 Isaac Tsai, initial syntax
29: # 8/10/2001 Isaac Tsai,
30: # 8/30/2001 Isaac Tsai,
1.1 tsai 31: # SYNTAX:
1.4 albertel 32: # <randomlabel bgimg="URL" width="12" height="45" texwidth="50">
33: # <labelgroup name="GroupOne" type="image">
34: # <location x="123" y="456" />
35: # <location x="321" y="654" />
36: # <location x="213" y="546" />
37: # <label description="TEXT-1">IMG-URL</label>
38: # <label description="TEXT-2">IMG-URL</label>
39: # <label description="TEXT-3">IMG-URL</label>
1.1 tsai 40: # </labelgroup>
1.4 albertel 41: # <labelgroup name="GroupTwo" type="text">
42: # <location x="12" y="45" />
43: # <location x="32" y="65" />
44: # <location x="21" y="54" />
1.3 tsai 45: # <label>TEXT-1</label>
46: # <label>TEXT-2</label>
47: # <label>TEXT-3</label>
1.1 tsai 48: # </labelgroup>
49: # </randomlabel>
50: # ===========================================
1.3 tsai 51: # side effect:
52: # location (123,456): $GroupOne[0] = 2 # images give out indexes
53: # (321,654): $GroupOne[1] = 1
54: # (213,546): $GroupOne[2] = 0
55: # location (12,45) : $GroupTwo[0] = "TEXT-3"
56: # (32,65) : $GroupTwo[1] = "TEXT-1"
57: # (21,54) : $GroupTwo[2] = "TEXT-2"
1.1 tsai 58: # ===========================================
59: package Apache::randomlabel;
1.24 sakharuk 60: use Apache::lonnet;
1.1 tsai 61: use strict;
1.13 sakharuk 62: use Apache::edit;
1.36 sakharuk 63: use Apache::File();
1.38 sakharuk 64: use Apache::Constants qw(:common :http);
1.1 tsai 65:
1.53 albertel 66: my %args;
67: my $cgi_id;
68:
1.13 sakharuk 69: BEGIN {
1.57 ! albertel 70: &Apache::lonxml::register('Apache::randomlabel',('randomlabel','labelgroup','location','label','bgimg'));
1.1 tsai 71: }
72:
1.23 matthew 73: sub check_int {
74: # utility function to do error checking on a integer.
75: my ($num,$default) = @_;
76: $default = 100 if (! defined($default));
77: $num =~ s/\s+//g; # We dont need no stinkin white space!
78: # If it is a real, just grab the integer part.
79: ($num,undef) = split (/\./,$num) if ($num =~ /\./);
80: # set to default if what we have left doesn't match anything...
81: $num = $default unless ($num =~/^\d+$/);
82: return $num;
83: }
84:
1.1 tsai 85: sub start_randomlabel {
1.47 albertel 86: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
87: my $result='';
88: push (@Apache::lonxml::namespace,'randomlabel');
89: my $bgimg= &Apache::lonxml::get_param('bgimg',$parstack,$safeeval);
90: if ( $bgimg !~ /^http:/ ) {
91: $bgimg=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$bgimg);
92: if (&Apache::lonnet::repcopy($bgimg) ne OK) {
93: $bgimg='/home/httpd/html/adm/lonKaputt/lonlogo_broken.gif';
94: }
1.42 www 95: }
1.47 albertel 96: $Apache::randomlabel::tlabel_cnt=0;
97: $Apache::randomlabel::ilabel_cnt=0;
98: if ($target eq 'web') {
1.53 albertel 99: $cgi_id=&Apache::loncommon::get_cgi_id();
100: %args=();
101: $args{"cgi.$cgi_id.BGIMG"}=&Apache::lonnet::escape($bgimg);
1.47 albertel 102: } elsif ($target eq 'tex') {
1.57 ! albertel 103: my $w= &check_int(&Apache::lonxml::get_param('width',$parstack,$safeeval));
! 104: my $h= &check_int(&Apache::lonxml::get_param('height',$parstack,$safeeval));
! 105: my $texwidth=&adjust_textwidth(&Apache::lonxml::get_param('texwidth',$parstack,$safeeval,undef,1));
! 106: if (!$texwidth) { $texwidth=90; }
! 107: $result.=&make_eps_image($bgimg,$texwidth,$h,$w);
1.47 albertel 108: } elsif ($target eq 'edit') {
109: $result.=&Apache::edit::tag_start($target,$token);
110: $Apache::edit::bgimgsrc=
111: &Apache::lonxml::get_param('bgimg',$parstack,$safeeval);
112: $Apache::edit::bgimgsrccurdepth=$Apache::lonxml::curdepth;
113: $result.=&Apache::edit::text_arg('Image:','bgimg',$token,75).' ';
114: $result.=&Apache::edit::browse('bgimg').' ';
115: $result.=&Apache::edit::search('bgimg').'<br />'.
116: &Apache::edit::text_arg('Width(pixel):' ,'width' ,$token,6).
117: &Apache::edit::text_arg('Height(pixel):','height' ,$token,6).
118: &Apache::edit::text_arg('TeXWidth(mm):' ,'texwidth',$token,6).
119: &Apache::edit::end_row().&Apache::edit::start_spanning_row();
120: } elsif ($target eq 'modified') {
121: my $constructtag=&Apache::edit::get_new_args($token,$parstack,
122: $safeeval,'bgimg','width',
123: 'height','texwidth');
124: if ($constructtag) {
125: $result = &Apache::edit::rebuild_tag($token);
126: $result.=&Apache::edit::handle_insert();
127: }
1.31 sakharuk 128: }
1.47 albertel 129: return $result;
1.1 tsai 130: }
131:
132: sub end_randomlabel {
1.47 albertel 133: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
134: my $result='';
135: my $count;
136: pop @Apache::lonxml::namespace;
137: if ($target eq 'web') {
138: $count = $Apache::randomlabel::tlabel_cnt;
1.53 albertel 139: if( $count != 0) { $args{"cgi.$cgi_id.COUNT"}=$count; }
1.47 albertel 140: $count = $Apache::randomlabel::ilabel_cnt;
1.53 albertel 141: if( $count != 0) { $args{"cgi.$cgi_id.ICOUNT"}=$count; }
142: $result.='<img src="/adm/randomlabel.png?token='.$cgi_id.'" /><br />'."\n";
143: &Apache::lonnet::appenv(%args);
1.47 albertel 144: } elsif ($target eq 'tex') {
145: $result='\end{picture}\\\\';
146: my $height=&Apache::lonxml::get_param('height',$parstack,$safeeval);
147: my $width=&Apache::lonxml::get_param('width',$parstack,$safeeval);
1.50 sakharuk 148: my $texwidth=&adjust_textwidth(&Apache::lonxml::get_param('texwidth',$parstack,$safeeval,undef,1));
1.49 albertel 149: if (!$texwidth) { $texwidth=90; }
1.47 albertel 150: my $howtoskipback = $texwidth*$height/$width;
151: $result.= ' \vskip -'.$howtoskipback.' mm } \\\\ ';
152: } elsif ($target eq 'edit') {
153: $result.=&Apache::edit::end_table;
154: }
155: return $result;
1.1 tsai 156: }
157:
1.57 ! albertel 158: sub start_bgimg {
! 159: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
! 160: my $result='';
! 161: if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') {
! 162: &Apache::lonxml::startredirection;
! 163: }
! 164: return $result;
! 165: }
! 166:
! 167: sub end_bgimg {
! 168: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
! 169: my $result='';
! 170: if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') {
! 171: my $bgimg=&Apache::lonxml::endredirection;
! 172: &Apache::lonnet::logthis("bgimg is -$bgimg-");
! 173: if ($target eq 'web') {
! 174: $bgimg=&Apache::imageresponse::clean_up_image($bgimg);
! 175: $args{"cgi.$cgi_id.BGIMG"}=&Apache::lonnet::escape($bgimg);
! 176: } elsif ($target eq 'tex') {
! 177: my $w=&check_int(&Apache::lonxml::get_param('width',$parstack,$safeeval,-2));
! 178: my $h=&check_int(&Apache::lonxml::get_param('height',$parstack,$safeeval,-2));
! 179: my $texwidth=&adjust_textwidth(&Apache::lonxml::get_param('texwidth',$parstack,$safeeval,undef,-2));
! 180: if (!$texwidth) { $texwidth=90; }
! 181: $result.=&make_eps_image($bgimg,$texwidth,$h,$w);
! 182: }
! 183: }
! 184: return $result;
! 185: }
! 186:
! 187: sub make_eps_image {
! 188: my ($bgimg,$texwidth,$h,$w)=@_;
! 189: my $newbgimg = $bgimg;
! 190: $bgimg=~s/\.(gif|jpg|png|jpeg)$/\.eps/i;
! 191: $bgimg= &Apache::lonnet::filelocation($bgimg);
! 192: $bgimg=~s|http:/[^/]*|/home/httpd/html|;
! 193: $bgimg=~s|/$||;
! 194: #if no eps file try to replicate it
! 195: if (not-e $bgimg) {
! 196: if (&Apache::lonnet::repcopy($bgimg) ne OK ) {
! 197: #if replication failed try to find ps file
! 198: $bgimg=~s/\.eps$/\.ps/;
! 199: #if no ps file try to replicate it
! 200: if (not -e $bgimg &&
! 201: &Apache::lonnet::repcopy($bgimg) ne OK) {
! 202: #if replication failed try to produce eps file dynamically
! 203: $bgimg=~s/\.ps$/\.eps/;
! 204: my $temp_file;
! 205: my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat";
! 206: $temp_file = Apache::File->new('>>'.$filename);
! 207: $newbgimg =~ s|(.*)/res/|/home/httpd/html/res/|;
! 208: print $temp_file "$newbgimg\n";
! 209: $bgimg=~s|/home/httpd/html/res|/home/httpd/prtspool|;
! 210: $bgimg=~s|/home/([^/]*)/public_html/|/home/httpd/prtspool/$1/|;
! 211: }
! 212: }
! 213: }
! 214: $bgimg=~s|/$||;
! 215: my $dirtywidth=$texwidth+5;
! 216: my $result.='\vspace*{2mm}\noindent \parbox{'.$dirtywidth.
! 217: ' mm}{ \noindent \epsfxsize='.$texwidth.' mm \epsffile{'.$bgimg.
! 218: '}\setlength{\unitlength}{1mm} \begin{picture}('.
! 219: $texwidth.','.$texwidth*$h/$w.')(0,-'.$texwidth*$h/$w.')';
! 220: return $result;
! 221: }
! 222:
1.50 sakharuk 223: sub adjust_textwidth {
224: my $texwidth=shift;
225: my $pagewidth=$ENV{'form.textwidth'};
226: $pagewidth=~s/\s*mm\s*$//;
227: if ($texwidth>$pagewidth) {$texwidth=$pagewidth;}
228: return $texwidth;
229: }
230:
1.1 tsai 231: sub start_labelgroup {
1.47 albertel 232: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
233: my $result='';
234: my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
235: my $type = &Apache::lonxml::get_param('type',$parstack,$safeeval);
236: $type =~tr/A-Z/a-z/;
1.48 albertel 237: if ($target ne 'modified' && ($name =~ /\W/ || $name =~ /^[0-9]/)) {
238: &Apache::lonxml::error("Only _ a-z A-Z and 0-9 are allowed in the name to a labelgroup, and the first character can not be a number.<br />");
239: }
1.47 albertel 240: if ($target eq 'web' || $target eq 'tex' ||
241: $target eq 'grade' || $target eq 'answer' || $target eq 'analyze') {
242: $Apache::randomlabel::groupname=$name;
243: $Apache::randomlabel::type=$type;
244: @Apache::randomlabel::xcoord = ();
245: @Apache::randomlabel::ycoord = ();
246: @Apache::randomlabel::value = ();
247: @Apache::randomlabel::label_arr = ();
248: @Apache::randomlabel::decription = ();
249: } elsif ($target eq 'edit') {
250: $result.=&Apache::edit::tag_start($target,$token);
251: $result.=&Apache::edit::text_arg('Name:','name',$token).
252: &Apache::edit::select_arg('Type:','type',['text','image'],$token).
253: &Apache::edit::end_row().&Apache::edit::start_spanning_row();
254: } elsif ($target eq 'modified') {
255: my $constructtag=&Apache::edit::get_new_args($token,$parstack,
256: $safeeval,'name','type');
257: if ($constructtag) {
258: $result = &Apache::edit::rebuild_tag($token);
259: $result.=&Apache::edit::handle_insert();
260: }
1.4 albertel 261: }
1.47 albertel 262: return $result;
1.1 tsai 263: }
264:
1.5 albertel 265: sub add_vars {
1.47 albertel 266: my ($name,$order,$label,$labelorder,$value,$image,$safeeval) = @_;
267: my $code = '${'.$name."}{'".($order+1)."'}='".$label."';";
268: my $out=Apache::run::run($code,$safeeval);
269: if ($value) {
270: $code = '${'.$name."}{'value_".($order+1)."'}='".$value."';";
271: $out=Apache::run::run($code,$safeeval);
272: $code = '${'.$name."}{'labelvalue_".($labelorder+1)."'}='".$value."';";
273: $out=Apache::run::run($code,$safeeval);
274: }
275: if ($image) {
276: my $code = '${'.$name."}{'image_".($order+1)."'}='".$image."';";
277: my $out=Apache::run::run($code,$safeeval);
278: }
279: $code = '${'.$name."}{'numlocations'}='".($order+1)."';";
1.5 albertel 280: $out=Apache::run::run($code,$safeeval);
1.4 albertel 281: }
1.5 albertel 282:
1.1 tsai 283: # begin to assign labels to locations
284: sub end_labelgroup {
1.47 albertel 285: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
286: my $gname = $Apache::randomlabel::groupname;
287: my $type = $Apache::randomlabel::type;
288: my $result='';
289: if ($target eq 'web' || $target eq 'answer' || $target eq 'grade' ||
290: $target eq 'analyze') {
291: my @idx_arr = (0 .. $#Apache::randomlabel::label_arr);
292: &Apache::structuretags::shuffle(\@idx_arr);
293: for(0 .. $#Apache::randomlabel::label_arr) {
294: my $str;
295: my $xstr;
296: my $ystr;
297: my $label = "$Apache::randomlabel::label_arr[ $idx_arr[$_] ]";
298: my $x = $Apache::randomlabel::xcoord[$_];
299: my $y = $Apache::randomlabel::ycoord[$_];
300: my $value = $Apache::randomlabel::value[$_];
301: if( $type eq 'text') {
302: &add_vars($gname,$_,$label,$idx_arr[$_],$value,'',$safeeval);
303: $str = 'LB'.$Apache::randomlabel::tlabel_cnt;
304: $xstr = 'X'.$Apache::randomlabel::tlabel_cnt;
305: $ystr = 'Y'.$Apache::randomlabel::tlabel_cnt;
306: $Apache::randomlabel::tlabel_cnt += 1;
307: } elsif ( $type eq 'image') {
308: &add_vars($gname,$_,
309: $Apache::randomlabel::description[$idx_arr[$_]],
310: $idx_arr[$_],$value,$label,$safeeval);
311: $str = 'IMG'.$Apache::randomlabel::ilabel_cnt;
312: $xstr = 'IX'.$Apache::randomlabel::ilabel_cnt;
313: $ystr = 'IY'.$Apache::randomlabel::ilabel_cnt;
314: $Apache::randomlabel::ilabel_cnt += 1;
315: } else {
316: &Apache::lonxml::error('Unknown type of label :'.$type.':');
317: }
318: if ($target eq 'web') {
1.53 albertel 319: $args{"cgi.$cgi_id.$str"} =&Apache::lonnet::escape($label);
320: $args{"cgi.$cgi_id.$xstr"}=$x;
321: $args{"cgi.$cgi_id.$ystr"}=$y;
1.47 albertel 322: }
323: }
324: } elsif ($target eq 'tex') {
325: my $WX1=0; # Web x-coord. of upper left corner (ULC)
326: my $WY1=0; # Web y-coord. of (ULC)
327: my $wwidth=&Apache::lonxml::get_param('width',$parstack,$safeeval,-2);
328: my $wheight=&Apache::lonxml::get_param('height',$parstack,$safeeval,-2);
1.50 sakharuk 329: my $texwidth=&adjust_textwidth(&Apache::lonxml::get_param('texwidth',$parstack,$safeeval,-2,1));
1.49 albertel 330: if (!$texwidth) { $texwidth=90; }
1.47 albertel 331: my $TX1=0;
332: my $TY1=$texwidth*($wheight/$wwidth);
333: my $TX2=$texwidth;
334: my $TY2=0;
335:
336:
337: my $slopex=($wwidth-$WX1)/($TX2-$TX1);
338: my $slopey=($wheight-$WY1)/($TY2-($TY1-1.0));
339: my $cstx=$wwidth-$slopex*($TX2);
340: my $csty=$wheight-$slopey*($TY2);
341:
342: my @idx_arr = (0 .. $#Apache::randomlabel::label_arr);
343: &Apache::structuretags::shuffle(\@idx_arr);
344:
345: &Apache::lonxml::debug("Array is:".$#Apache::randomlabel::label_arr.":");
346: for(my $i=0;$i <= $#Apache::randomlabel::label_arr; $i++) {
347: my $label = "$Apache::randomlabel::label_arr[ $idx_arr[$i] ]";
348: my $x = $Apache::randomlabel::xcoord[$i];
349: my $y = $Apache::randomlabel::ycoord[$i];
350: my $value = $Apache::randomlabel::value[$i];
351: #x latex coordinate
352: my $tcX=($x)*($texwidth/$wwidth);
353: #y latex coordinate
354: # my $ratio=($wwidth > 0 ? $wheight/$wwidth : 1 );
355: my $tcY=$TY1-$y*($TY1/$wheight);
356: $tcX=sprintf('%.2f',$tcX);
357: $tcY=sprintf('%.2f',$tcY);
358: $result.='\put('.$tcX.','.$tcY.'){\normalsize \bf '.$label.'}'."\n";
359: if( $type eq 'text') {
360: &add_vars($gname,$i,$label,$idx_arr[$i],$value,'',$safeeval);
361: } elsif ( $type eq 'image') {
362: &add_vars($gname,$i,
363: $Apache::randomlabel::description[$idx_arr[$i]],
364: $idx_arr[$i],$value,$label,$safeeval);
365: } else {
366: &Apache::lonxml::error('Unknown type of label :'.$type.':');
367: }
368: }
369: } elsif ($target eq 'edit') {
370: $result.=&Apache::edit::end_table;
1.3 tsai 371: }
1.47 albertel 372: return $result;
1.1 tsai 373: }
374:
1.5 albertel 375: # <location x="123" y="456" value="some value"/>
1.1 tsai 376: sub start_location {
1.47 albertel 377: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
378: my $x= &check_int(&Apache::lonxml::get_param('x',$parstack,$safeeval),50);
379: my $y= &check_int(&Apache::lonxml::get_param('y',$parstack,$safeeval),50);
380: my $value= &Apache::lonxml::get_param('value',$parstack,$safeeval);
381: my $result='';
382: push(@Apache::randomlabel::xcoord,$x);
383: push(@Apache::randomlabel::ycoord,$y);
384: push(@Apache::randomlabel::value,$value);
385: if ($target eq 'edit') {
386: $result.=&Apache::edit::tag_start($target,$token);
387: $result.=&Apache::edit::text_arg('X:','x',$token,4).
388: &Apache::edit::text_arg('Y:','y',$token,4).
389: &Apache::edit::entercoords('x','y','attribute','width','height').' '.
390: &Apache::edit::text_arg('Value:','value',$token).
391: &Apache::edit::end_row();
392: $result.=&Apache::edit::end_table;
393: } elsif ($target eq 'modified') {
394: my $constructtag=&Apache::edit::get_new_args($token,$parstack,
395: $safeeval,'x','y','value');
396: if ($constructtag) {
397: $result = &Apache::edit::rebuild_tag($token);
398: $result.=&Apache::edit::handle_insert();
399: }
1.4 albertel 400: }
1.47 albertel 401: return $result;
1.1 tsai 402: }
403:
404: sub end_location {
1.47 albertel 405: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
406: my @result;
407: if ($target eq 'edit') { @result=('','no') }
408: return @result;
1.1 tsai 409: }
410:
1.2 tsai 411: # <label>$var_abc</label>
1.1 tsai 412: sub start_label {
1.47 albertel 413: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
414: my $result='';
415: my $type = &Apache::lonxml::get_param('type',$parstack,$safeeval,-2);
416: if ($target eq 'web' || $target eq 'tex' ||
417: $target eq 'grade' || $target eq 'answer' || $target eq 'analyze') {
1.57 ! albertel 418: &Apache::lonxml::startredirection;
1.47 albertel 419: } elsif ($target eq 'edit') {
420: $result.=&Apache::edit::tag_start($target,$token,"$type Label");
421: my $text=&Apache::lonxml::get_all_text("/label",$parser);
422: if ($type eq 'image') {
423: $result.=&Apache::edit::end_row().
424: &Apache::edit::start_spanning_row();
425: $result.=&Apache::edit::text_arg('Description:','description',
426: $token);
427: }
428: if ($type eq 'text') { $result.="Label Text:"; }
429: if ($type eq 'image') { $result.="Path to image: "; }
430: $result.=&Apache::edit::editline('',$text,'',50).
431: &Apache::edit::end_table();
432: } elsif ($target eq 'modified') {
433: $result = '<label>';
434: if ($type eq 'image') {
435: my $constructtag=&Apache::edit::get_new_args($token,$parstack,
436: $safeeval,
437: 'description');
438: if ($constructtag) {
439: $result = &Apache::edit::rebuild_tag($token);
440: } else {
441: $result = $token->[4];
442: }
443: }
1.52 albertel 444: $result.=&Apache::edit::modifiedfield("/label",$parser);
1.26 albertel 445: }
1.47 albertel 446: return $result;
1.1 tsai 447: }
448:
449: sub end_label {
1.47 albertel 450: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
451: my @result;
1.57 ! albertel 452: if ($target eq 'edit') {
! 453: @result=('','no') ;
! 454: } elsif ($target eq 'web' || $target eq 'tex' || $target eq 'grade' ||
! 455: $target eq 'answer' || $target eq 'analyze') {
! 456: my $type = &Apache::lonxml::get_param('type',$parstack,$safeeval,-2);
! 457: my $ltext=&Apache::lonxml::endredirection;
! 458: if ($type eq 'image') {
! 459: &Apache::lonxml::debug("Turning $ltext, $Apache::lonxml::pwd[-1]");
! 460: $ltext=&Apache::imageresponse::clean_up_image($ltext);
! 461: # $ltext=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],
! 462: # $ltext);
! 463: &Apache::lonxml::debug("into $ltext");
! 464: my $description = &Apache::lonxml::get_param('description',
! 465: $parstack,$safeeval);
! 466: push(@Apache::randomlabel::description,$description);
! 467: }
! 468: push(@Apache::randomlabel::label_arr,$ltext);
! 469: }
1.47 albertel 470: return @result;
1.1 tsai 471: }
472:
473: 1;
474: __END__
475:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>