version 1.26, 2002/05/17 21:16:55
|
version 1.28, 2002/05/20 20:35:13
|
Line 184 sub start_labelgroup {
|
Line 184 sub start_labelgroup {
|
} |
} |
|
|
sub add_vars { |
sub add_vars { |
my ($name,$order,$label,$labelorder,$value,$safeeval) = @_; |
my ($name,$order,$label,$labelorder,$value,$image,$safeeval) = @_; |
my $code = '${'.$name."}{'".($order+1)."'}='".$label."';"; |
my $code = '${'.$name."}{'".($order+1)."'}='".$label."';"; |
my $out=Apache::run::run($code,$safeeval); |
my $out=Apache::run::run($code,$safeeval); |
if ($value) { |
if ($value) { |
Line 193 sub add_vars {
|
Line 193 sub add_vars {
|
$code = '${'.$name."}{'labelvalue_".($labelorder+1)."'}='".$value."';"; |
$code = '${'.$name."}{'labelvalue_".($labelorder+1)."'}='".$value."';"; |
$out=Apache::run::run($code,$safeeval); |
$out=Apache::run::run($code,$safeeval); |
} |
} |
|
if ($image) { |
|
my $code = '${'.$name."}{'image_".($order+1)."'}='".$image."';"; |
|
my $out=Apache::run::run($code,$safeeval); |
|
} |
$code = '${'.$name."}{'numlocations'}='".($order+1)."';"; |
$code = '${'.$name."}{'numlocations'}='".($order+1)."';"; |
$out=Apache::run::run($code,$safeeval); |
$out=Apache::run::run($code,$safeeval); |
} |
} |
Line 215 sub end_labelgroup {
|
Line 219 sub end_labelgroup {
|
my $y = $Apache::randomlabel::ycoord[$_]; |
my $y = $Apache::randomlabel::ycoord[$_]; |
my $value = $Apache::randomlabel::value[$_]; |
my $value = $Apache::randomlabel::value[$_]; |
if( $type eq 'text') { |
if( $type eq 'text') { |
&add_vars($gname,$_,$label,$idx_arr[$_],$value,$safeeval); |
&add_vars($gname,$_,$label,$idx_arr[$_],$value,'',$safeeval); |
$str = 'LB'.$Apache::randomlabel::tlabel_cnt; |
$str = 'LB'.$Apache::randomlabel::tlabel_cnt; |
$xstr = 'X'.$Apache::randomlabel::tlabel_cnt; |
$xstr = 'X'.$Apache::randomlabel::tlabel_cnt; |
$ystr = 'Y'.$Apache::randomlabel::tlabel_cnt; |
$ystr = 'Y'.$Apache::randomlabel::tlabel_cnt; |
$Apache::randomlabel::tlabel_cnt += 1; |
$Apache::randomlabel::tlabel_cnt += 1; |
} elsif ( $type eq 'image') { |
} elsif ( $type eq 'image') { |
&add_vars($gname,$_,$idx_arr[$_],$idx_arr[$_],$value,$safeeval); |
&add_vars($gname,$_, |
|
$Apache::randomlabel::description[$idx_arr[$_]], |
|
$idx_arr[$_],$value,$label,$safeeval); |
$str = 'IMG'.$Apache::randomlabel::ilabel_cnt; |
$str = 'IMG'.$Apache::randomlabel::ilabel_cnt; |
$xstr = 'IX'.$Apache::randomlabel::ilabel_cnt; |
$xstr = 'IX'.$Apache::randomlabel::ilabel_cnt; |
$ystr = 'IY'.$Apache::randomlabel::ilabel_cnt; |
$ystr = 'IY'.$Apache::randomlabel::ilabel_cnt; |
Line 270 sub end_labelgroup {
|
Line 276 sub end_labelgroup {
|
$tcY=sprintf('%.2f',$tcY); |
$tcY=sprintf('%.2f',$tcY); |
$result.='\put('.$tcX.','.$tcY.'){\normalsize \bf '.$label.'}'."\n"; |
$result.='\put('.$tcX.','.$tcY.'){\normalsize \bf '.$label.'}'."\n"; |
if( $type eq 'text') { |
if( $type eq 'text') { |
&add_vars($gname,$i,$label,$idx_arr[$i],$value,$safeeval); |
&add_vars($gname,$i,$label,$idx_arr[$i],$value,'',$safeeval); |
} elsif ( $type eq 'image') { |
} elsif ( $type eq 'image') { |
&add_vars($gname,$i,$idx_arr[$i],$idx_arr[$i],$value,$safeeval); |
&add_vars($gname,$i, |
|
$Apache::randomlabel::description[$idx_arr[$i]], |
|
$idx_arr[$i],$value,$label,$safeeval); |
} else { |
} else { |
&Apache::lonxml::error('Unknown type of label :'.$type.':'); |
&Apache::lonxml::error('Unknown type of label :'.$type.':'); |
} |
} |
Line 339 sub start_label {
|
Line 347 sub start_label {
|
push(@Apache::randomlabel::label_arr,$ltext); |
push(@Apache::randomlabel::label_arr,$ltext); |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
$result.=&Apache::edit::tag_start($target,$token,"$type Label"); |
$result.=&Apache::edit::tag_start($target,$token,"$type Label"); |
$result.=&Apache::edit::text_arg('Description:','description',$token); |
|
my $text=&Apache::lonxml::get_all_text("/label",$$parser[-1]); |
my $text=&Apache::lonxml::get_all_text("/label",$$parser[-1]); |
$result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row(); |
if ($type eq 'image') { |
|
$result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row(); |
|
$result.=&Apache::edit::text_arg('Description:','description',$token); |
|
} |
if ($type eq 'text') { $result.="Label Text:"; } |
if ($type eq 'text') { $result.="Label Text:"; } |
if ($type eq 'image') { $result.="Path to image:"; } |
if ($type eq 'image') { $result.="Path to image:"; } |
$result.=&Apache::edit::editline('',$text,'',20). |
$result.=&Apache::edit::editline('',$text,'',20). |