Annotation of loncom/homework/randomlabel.pm, revision 1.67

1.1       tsai        1: # The LearningOnline Network with CAPA
                      2: # random labelling tool
1.8       albertel    3: #
1.67    ! albertel    4: # $Id: randomlabel.pm,v 1.66 2005/03/16 21:35:17 raeburn 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.1       tsai       28: # SYNTAX:
1.4       albertel   29: # <randomlabel bgimg="URL" width="12" height="45" texwidth="50">
                     30: #    <labelgroup name="GroupOne" type="image">
                     31: #      <location x="123" y="456" />
                     32: #      <location x="321" y="654" />
                     33: #      <location x="213" y="546" />
                     34: #      <label description="TEXT-1">IMG-URL</label>
                     35: #      <label description="TEXT-2">IMG-URL</label>
                     36: #      <label description="TEXT-3">IMG-URL</label>
1.1       tsai       37: #    </labelgroup>
1.4       albertel   38: #    <labelgroup name="GroupTwo" type="text">
                     39: #      <location x="12" y="45" />
                     40: #      <location x="32" y="65" />
                     41: #      <location x="21" y="54" />
1.3       tsai       42: #      <label>TEXT-1</label>
                     43: #      <label>TEXT-2</label>
                     44: #      <label>TEXT-3</label>
1.1       tsai       45: #    </labelgroup>
                     46: #   </randomlabel>
                     47: #  ===========================================
1.3       tsai       48: #  side effect:
                     49: #    location (123,456): $GroupOne[0] = 2  # images give out indexes
                     50: #             (321,654): $GroupOne[1] = 1
                     51: #             (213,546): $GroupOne[2] = 0
                     52: #    location (12,45)  : $GroupTwo[0] = "TEXT-3"
                     53: #             (32,65)  : $GroupTwo[1] = "TEXT-1"
                     54: #             (21,54)  : $GroupTwo[2] = "TEXT-2"
1.1       tsai       55: #  ===========================================
                     56: package Apache::randomlabel;
1.24      sakharuk   57: use Apache::lonnet;
1.1       tsai       58: use strict;
1.13      sakharuk   59: use Apache::edit;
1.36      sakharuk   60: use Apache::File();
1.38      sakharuk   61: use Apache::Constants qw(:common :http);
1.1       tsai       62: 
1.53      albertel   63: my %args;
                     64: my $cgi_id;
                     65: 
1.13      sakharuk   66: BEGIN {
1.57      albertel   67:     &Apache::lonxml::register('Apache::randomlabel',('randomlabel','labelgroup','location','label','bgimg'));
1.1       tsai       68: }
                     69: 
1.23      matthew    70: sub check_int {
                     71:     # utility function to do error checking on a integer.
                     72:     my ($num,$default) = @_;
                     73:     $default = 100 if (! defined($default));
                     74:     $num =~ s/\s+//g;  # We dont need no stinkin white space!
                     75:     # If it is a real, just grab the integer part.
                     76:     ($num,undef) = split (/\./,$num) if ($num =~ /\./); 
                     77:     # set to default if what we have left doesn't match anything...
                     78:     $num = $default unless ($num =~/^\d+$/);
                     79:     return $num;
                     80: }
                     81: 
1.64      albertel   82: my ($height_param,$width_param);
1.1       tsai       83: sub start_randomlabel {
1.47      albertel   84:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                     85:     my $result='';
                     86:     push (@Apache::lonxml::namespace,'randomlabel');
1.64      albertel   87:     ($height_param,$width_param)=(0,0);
1.47      albertel   88:     my $bgimg= &Apache::lonxml::get_param('bgimg',$parstack,$safeeval);
1.60      albertel   89:     if ( defined($bgimg) && $bgimg !~ /^http:/ ) {
1.47      albertel   90: 	$bgimg=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$bgimg);
1.66      raeburn    91: 	if (&Apache::lonnet::repcopy($bgimg) ne 'ok') {
1.47      albertel   92: 	    $bgimg='/home/httpd/html/adm/lonKaputt/lonlogo_broken.gif';
                     93: 	}
1.42      www        94:     }
1.59      albertel   95:     $Apache::randomlabel::obj_cnt=0;
1.47      albertel   96:     if ($target eq 'web') {
1.53      albertel   97: 	$cgi_id=&Apache::loncommon::get_cgi_id();
                     98: 	%args=();
                     99: 	$args{"cgi.$cgi_id.BGIMG"}=&Apache::lonnet::escape($bgimg);
1.64      albertel  100:     } elsif ($target eq 'tex' && defined($bgimg)) {
                    101: 	$result.=&make_eps_image($bgimg,$parstack,$safeeval);
1.47      albertel  102:     } elsif ($target eq 'edit') {
                    103: 	$result.=&Apache::edit::tag_start($target,$token);
                    104: 	$Apache::edit::bgimgsrc=
                    105: 	    &Apache::lonxml::get_param('bgimg',$parstack,$safeeval);
                    106: 	$Apache::edit::bgimgsrccurdepth=$Apache::lonxml::curdepth;
                    107: 	$result.=&Apache::edit::text_arg('Image:','bgimg',$token,75).' ';
                    108: 	$result.=&Apache::edit::browse('bgimg').' ';
                    109: 	$result.=&Apache::edit::search('bgimg').'<br />'.
                    110: 	    &Apache::edit::text_arg('Width(pixel):' ,'width'   ,$token,6).
                    111: 	    &Apache::edit::text_arg('Height(pixel):','height'  ,$token,6).
                    112: 	    &Apache::edit::text_arg('TeXWidth(mm):' ,'texwidth',$token,6).
                    113: 	    &Apache::edit::end_row().&Apache::edit::start_spanning_row();     
                    114:     } elsif ($target eq 'modified') {
                    115: 	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
                    116: 						     $safeeval,'bgimg','width',
                    117: 						     'height','texwidth');
                    118: 	if ($constructtag) {
                    119: 	    $result = &Apache::edit::rebuild_tag($token);
                    120: 	    $result.=&Apache::edit::handle_insert();
                    121: 	}
1.31      sakharuk  122:     }
1.47      albertel  123:     return $result;
1.1       tsai      124: }
                    125: 
                    126: sub end_randomlabel {
1.47      albertel  127:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                    128:     my $result='';
                    129:     my $count;
                    130:     pop @Apache::lonxml::namespace;
                    131:     if ($target eq 'web') {
1.59      albertel  132: 	$count = $Apache::randomlabel::obj_cnt;
                    133: 	if( $count != 0) { $args{"cgi.$cgi_id.OBJCOUNT"}=$count; }
1.53      albertel  134: 	$result.='<img src="/adm/randomlabel.png?token='.$cgi_id.'" /><br />'."\n";
                    135: 	&Apache::lonnet::appenv(%args);
1.47      albertel  136:     } elsif ($target eq 'tex') {
                    137: 	$result='\end{picture}\\\\';
1.64      albertel  138: 	$result.= ' \vskip -'.$height_param.' mm }  \\\\ ';
1.47      albertel  139:     } elsif ($target eq 'edit') {
                    140: 	$result.=&Apache::edit::end_table;
                    141:     }
                    142:     return $result;
1.1       tsai      143: }
                    144: 
1.57      albertel  145: sub start_bgimg {
                    146:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                    147:     my $result='';
                    148:     if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') { 
1.64      albertel  149: 	&Apache::lonxml::startredirection(); 
1.57      albertel  150:     }
                    151:     return $result;
                    152: }
                    153: 
                    154: sub end_bgimg {
                    155:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                    156:     my $result='';
                    157:     if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') { 
1.64      albertel  158: 	my $bgimg=&Apache::lonxml::endredirection(); 
1.57      albertel  159: 	if ($target eq 'web') {
                    160: 	    $bgimg=&Apache::imageresponse::clean_up_image($bgimg);
                    161: 	    $args{"cgi.$cgi_id.BGIMG"}=&Apache::lonnet::escape($bgimg);
                    162: 	} elsif ($target eq 'tex') {
1.64      albertel  163: 	    $result.=&make_eps_image($bgimg,$parstack,$safeeval,-2);
1.57      albertel  164: 	}
                    165:     }
                    166:     return $result;
                    167: }
                    168: 
                    169: sub make_eps_image {
1.64      albertel  170:     my ($bgimg,$parstack,$safeeval,$depth)=@_;
                    171:     my ($path,$file) = &Apache::londefdef::get_eps_image($bgimg);
                    172:     ($height_param,$width_param)=
                    173: 	&Apache::londefdef::image_size($bgimg,0.3,$parstack,$safeeval,
                    174: 				       $depth,1);
                    175:     my $dirtywidth=$width_param+5;
1.57      albertel  176:     my $result.='\vspace*{2mm}\noindent \parbox{'.$dirtywidth.
1.64      albertel  177: 	' mm}{  \noindent \epsfxsize='.$width_param.
                    178: 	' mm \epsffile{'.$path.$file.
1.57      albertel  179: 	'}\setlength{\unitlength}{1mm}  \begin{picture}('.
1.64      albertel  180: 	$width_param.','.$height_param.')(0,-'.$height_param.')';
1.57      albertel  181:     return $result;
                    182: }
                    183: 
1.1       tsai      184: sub start_labelgroup {
1.47      albertel  185:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                    186:     my $result='';
                    187:     my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
                    188:     my $type = &Apache::lonxml::get_param('type',$parstack,$safeeval);
                    189:     $type =~tr/A-Z/a-z/;
1.48      albertel  190:     if ($target ne 'modified' && ($name =~ /\W/ || $name =~ /^[0-9]/)) {
                    191: 	&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 />");
                    192:     }
1.47      albertel  193:     if ($target eq 'web' || $target eq 'tex' ||
                    194: 	$target eq 'grade' || $target eq 'answer' || $target eq 'analyze') {
                    195: 	$Apache::randomlabel::groupname=$name;
                    196: 	$Apache::randomlabel::type=$type;
                    197: 	@Apache::randomlabel::xcoord = ();
                    198: 	@Apache::randomlabel::ycoord = ();
                    199: 	@Apache::randomlabel::value = ();
                    200: 	@Apache::randomlabel::label_arr  = ();
                    201: 	@Apache::randomlabel::decription  = ();
                    202:     } elsif ($target eq 'edit') {
                    203: 	$result.=&Apache::edit::tag_start($target,$token);
                    204: 	$result.=&Apache::edit::text_arg('Name:','name',$token).
1.63      albertel  205: 	    &Apache::edit::select_arg('Type:','type',['text','image'],$token);
                    206: 	if (!defined($token->[2]{'TeXsize'})) {
                    207: 	    $token->[2]{'TeXsize'}='\normalsize';
                    208: 	}
                    209: 	$result.=&Apache::edit::select_arg('TeX font size:','TeXsize',
                    210: 					   ['\tiny','\scriptsize',
                    211: 					    '\footnotesize','\small',
                    212: 					    '\normalsize','\large','\Large',
                    213: 					    '\LARGE','\huge','\Huge'],
                    214: 					   $token);
                    215: 	$result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
1.47      albertel  216:     } elsif ($target eq 'modified') {
                    217: 	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
1.63      albertel  218: 						     $safeeval,'name','type',
                    219: 						     'TeXsize');
1.47      albertel  220: 	if ($constructtag) {
                    221: 	    $result = &Apache::edit::rebuild_tag($token);
                    222: 	    $result.=&Apache::edit::handle_insert();
                    223: 	}
1.4       albertel  224:     }
1.47      albertel  225:     return $result;
1.1       tsai      226: }
                    227: 
1.5       albertel  228: sub add_vars {
1.47      albertel  229:     my ($name,$order,$label,$labelorder,$value,$image,$safeeval) = @_;
1.61      albertel  230:     if (!defined($name) || $name eq '') { return; }
1.47      albertel  231:     my $code = '${'.$name."}{'".($order+1)."'}='".$label."';";
                    232:     my $out=Apache::run::run($code,$safeeval);
                    233:     if ($value) {
                    234: 	$code = '${'.$name."}{'value_".($order+1)."'}='".$value."';";
                    235: 	$out=Apache::run::run($code,$safeeval);
                    236: 	$code = '${'.$name."}{'labelvalue_".($labelorder+1)."'}='".$value."';";
                    237: 	$out=Apache::run::run($code,$safeeval);
                    238:     }
                    239:     if ($image) {
                    240: 	my $code = '${'.$name."}{'image_".($order+1)."'}='".$image."';";
                    241: 	my $out=Apache::run::run($code,$safeeval);
                    242:     }
                    243:     $code = '${'.$name."}{'numlocations'}='".($order+1)."';";
1.5       albertel  244:     $out=Apache::run::run($code,$safeeval);
1.4       albertel  245: }
1.5       albertel  246: 
1.1       tsai      247: # begin to assign labels to locations
                    248: sub end_labelgroup {
1.47      albertel  249:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                    250:     my $gname = $Apache::randomlabel::groupname;
                    251:     my $type  = $Apache::randomlabel::type;
                    252:     my $result='';
                    253:     if ($target eq 'web' || $target eq 'answer' || $target eq 'grade' ||
                    254: 	$target eq 'analyze') {
                    255: 	my @idx_arr = (0 .. $#Apache::randomlabel::label_arr);
                    256: 	&Apache::structuretags::shuffle(\@idx_arr);
                    257: 	for(0 .. $#Apache::randomlabel::label_arr) {
                    258: 	    my $str;
                    259: 	    my $label = "$Apache::randomlabel::label_arr[ $idx_arr[$_] ]";
                    260: 	    my $x = $Apache::randomlabel::xcoord[$_];
                    261: 	    my $y = $Apache::randomlabel::ycoord[$_];
                    262: 	    my $value = $Apache::randomlabel::value[$_];
1.59      albertel  263: 	    my $i=$Apache::randomlabel::obj_cnt++;
1.47      albertel  264: 	    if( $type eq 'text') {
                    265: 		&add_vars($gname,$_,$label,$idx_arr[$_],$value,'',$safeeval);
1.59      albertel  266: 		$str = join(':',$x,$y,&Apache::lonnet::escape($label));
                    267: 		$args{"cgi.$cgi_id.OBJTYPE"}.='LABEL:';
1.47      albertel  268: 	    } elsif ( $type eq 'image') {
                    269: 		&add_vars($gname,$_,
                    270: 			  $Apache::randomlabel::description[$idx_arr[$_]],
                    271: 			  $idx_arr[$_],$value,$label,$safeeval);
1.59      albertel  272: 		$str = join(':',$x,$y,&Apache::lonnet::escape($label));
                    273: 		$args{"cgi.$cgi_id.OBJTYPE"}.='IMAGE:';
1.47      albertel  274: 	    } else {
                    275: 		&Apache::lonxml::error('Unknown type of label :'.$type.':');
                    276: 	    }
1.59      albertel  277: 	    if ($target eq 'web') { $args{"cgi.$cgi_id.OBJ$i"} =$str; }
1.47      albertel  278: 	}
                    279:     } elsif ($target eq 'tex') {
                    280: 	my $WX1=0; #  Web x-coord. of upper left corner (ULC)
                    281: 	my $WY1=0; #  Web y-coord. of (ULC)
                    282: 	my $wwidth=&Apache::lonxml::get_param('width',$parstack,$safeeval,-2);
                    283: 	my $wheight=&Apache::lonxml::get_param('height',$parstack,$safeeval,-2);
1.63      albertel  284: 	my $TeXsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval);
                    285: 	if (!defined($TeXsize)) { $TeXsize='\\normalsize'; }
1.62      albertel  286: 	
1.47      albertel  287: 	my @idx_arr = (0 .. $#Apache::randomlabel::label_arr);
                    288: 	&Apache::structuretags::shuffle(\@idx_arr);
                    289: 
                    290: 	&Apache::lonxml::debug("Array is:".$#Apache::randomlabel::label_arr.":");
                    291: 	for(my $i=0;$i <= $#Apache::randomlabel::label_arr; $i++) {
                    292: 	    my $label = "$Apache::randomlabel::label_arr[ $idx_arr[$i] ]";
                    293: 	    my $x = $Apache::randomlabel::xcoord[$i];
1.62      albertel  294: 	    # FIXME the 3.5 here is the 'height' of the letter in TeX
                    295: 	    my $y = $Apache::randomlabel::ycoord[$i]-3.5;
1.47      albertel  296: 	    my $value = $Apache::randomlabel::value[$i];
                    297: 	    #x latex coordinate
1.64      albertel  298: 	    my $tcX=($x)*($width_param/$wwidth);
1.47      albertel  299: 	    #y latex coordinate
                    300:             #      my $ratio=($wwidth > 0 ? $wheight/$wwidth : 1 );
1.64      albertel  301: 	    my $tcY=$height_param-$y*($height_param/$wheight);
1.47      albertel  302: 	    $tcX=sprintf('%.2f',$tcX);
                    303: 	    $tcY=sprintf('%.2f',$tcY);
1.63      albertel  304: 	    $result.='\put('.$tcX.','.$tcY.'){'.$TeXsize.' \bf '.$label.'}'."\n";
1.47      albertel  305: 	    if( $type eq 'text') {
                    306: 		&add_vars($gname,$i,$label,$idx_arr[$i],$value,'',$safeeval);
                    307: 	    } elsif ( $type eq 'image') {
                    308: 		&add_vars($gname,$i,
                    309: 			  $Apache::randomlabel::description[$idx_arr[$i]],
                    310: 			  $idx_arr[$i],$value,$label,$safeeval);
                    311: 	    } else {
                    312: 		&Apache::lonxml::error('Unknown type of label :'.$type.':');
                    313: 	    }
                    314: 	}
                    315:     } elsif ($target eq 'edit') {
                    316: 	$result.=&Apache::edit::end_table;
1.3       tsai      317:     }
1.47      albertel  318:     return $result;
1.1       tsai      319: }
                    320: 
1.5       albertel  321: # <location x="123" y="456" value="some value"/>
1.1       tsai      322: sub start_location {
1.47      albertel  323:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                    324:     my $x= &check_int(&Apache::lonxml::get_param('x',$parstack,$safeeval),50);
                    325:     my $y= &check_int(&Apache::lonxml::get_param('y',$parstack,$safeeval),50);
                    326:     my $value= &Apache::lonxml::get_param('value',$parstack,$safeeval);
                    327:     my $result='';
                    328:     push(@Apache::randomlabel::xcoord,$x);
                    329:     push(@Apache::randomlabel::ycoord,$y);
                    330:     push(@Apache::randomlabel::value,$value);
                    331:     if ($target eq 'edit') {
                    332: 	$result.=&Apache::edit::tag_start($target,$token);
                    333: 	$result.=&Apache::edit::text_arg('X:','x',$token,4).
                    334: 	    &Apache::edit::text_arg('Y:','y',$token,4).
                    335: 	    &Apache::edit::entercoords('x','y','attribute','width','height').'&nbsp;&nbsp;&nbsp;'.
                    336: 	    &Apache::edit::text_arg('Value:','value',$token).
                    337: 	    &Apache::edit::end_row();
                    338: 	$result.=&Apache::edit::end_table;
                    339:     } elsif ($target eq 'modified') {
                    340: 	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
                    341: 						    $safeeval,'x','y','value');
                    342: 	if ($constructtag) {
                    343: 	    $result = &Apache::edit::rebuild_tag($token);
                    344: 	    $result.=&Apache::edit::handle_insert();
                    345: 	}
1.4       albertel  346:     }
1.47      albertel  347:     return $result;
1.1       tsai      348: }
                    349: 
                    350: sub end_location {
1.47      albertel  351:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                    352:     my @result;
                    353:     if ($target eq 'edit') { @result=('','no') }
                    354:     return @result;
1.1       tsai      355: }
                    356: 
1.2       tsai      357: # <label>$var_abc</label>
1.1       tsai      358: sub start_label {
1.47      albertel  359:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                    360:     my $result='';
                    361:     my $type = &Apache::lonxml::get_param('type',$parstack,$safeeval,-2);
                    362:     if ($target eq 'web' || $target eq 'tex' ||
                    363: 	$target eq 'grade' || $target eq 'answer' || $target eq 'analyze') {
1.57      albertel  364: 	&Apache::lonxml::startredirection; 
1.47      albertel  365:     } elsif ($target eq 'edit') {
                    366: 	$result.=&Apache::edit::tag_start($target,$token,"$type Label");
                    367: 	my $text=&Apache::lonxml::get_all_text("/label",$parser);
                    368: 	if ($type eq 'image') {
                    369: 	    $result.=&Apache::edit::end_row().
                    370: 		&Apache::edit::start_spanning_row();
                    371: 	    $result.=&Apache::edit::text_arg('Description:','description',
                    372: 					     $token);
                    373: 	}
                    374: 	if ($type eq 'text') { $result.="Label Text:"; }
                    375: 	if ($type eq 'image') { $result.="Path to image:&nbsp;"; }
                    376: 	$result.=&Apache::edit::editline('',$text,'',50).
                    377: 	    &Apache::edit::end_table();
                    378:     } elsif ($target eq 'modified') {
                    379: 	$result = '<label>';
                    380: 	if ($type eq 'image') {
                    381: 	    my $constructtag=&Apache::edit::get_new_args($token,$parstack,
                    382: 							 $safeeval,
                    383: 							 'description');
                    384: 	    if ($constructtag) {
                    385: 		$result = &Apache::edit::rebuild_tag($token);
                    386: 	    } else {
                    387: 		$result = $token->[4];
                    388: 	    }
                    389: 	}
1.52      albertel  390: 	$result.=&Apache::edit::modifiedfield("/label",$parser);
1.26      albertel  391:     }
1.47      albertel  392:     return $result;
1.1       tsai      393: }
                    394: 
                    395: sub end_label {
1.47      albertel  396:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                    397:     my @result;
1.57      albertel  398:     if ($target eq 'edit') {
                    399: 	@result=('','no') ;
                    400:     } elsif ($target eq 'web' || $target eq 'tex' || $target eq 'grade' ||
                    401: 	     $target eq 'answer' || $target eq 'analyze') {
                    402: 	my $type = &Apache::lonxml::get_param('type',$parstack,$safeeval,-2);
                    403: 	my $ltext=&Apache::lonxml::endredirection; 
                    404: 	if ($type eq 'image') {
                    405: 	    &Apache::lonxml::debug("Turning $ltext, $Apache::lonxml::pwd[-1]");
                    406: 	    $ltext=&Apache::imageresponse::clean_up_image($ltext);
                    407: #	    $ltext=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],
                    408: #						 $ltext);
                    409: 	    &Apache::lonxml::debug("into $ltext");
                    410: 	    my $description = &Apache::lonxml::get_param('description',
                    411: 							 $parstack,$safeeval);
                    412: 	    push(@Apache::randomlabel::description,$description);
1.61      albertel  413: 	} else {
                    414: 	    $ltext=~s/[\r\n]*//gs
1.57      albertel  415: 	}
                    416: 	push(@Apache::randomlabel::label_arr,$ltext);
                    417:     }
1.47      albertel  418:     return @result;
1.1       tsai      419: }
                    420: 
                    421: 1;
                    422: __END__
                    423:  

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>