[LON-CAPA-cvs] cvs: loncom /xml londefdef.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 24 Oct 2003 21:11:46 -0000
albertel Fri Oct 24 17:11:46 2003 EDT
Modified files:
/loncom/xml londefdef.pm
Log:
- most of BUG#1473
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.185 loncom/xml/londefdef.pm:1.186
--- loncom/xml/londefdef.pm:1.185 Tue Oct 21 15:40:32 2003
+++ loncom/xml/londefdef.pm Fri Oct 24 17:11:46 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.185 2003/10/21 19:40:32 albertel Exp $
+# $Id: londefdef.pm,v 1.186 2003/10/24 21:11:46 albertel Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -159,7 +159,7 @@
&tth::tthoptions('-L -u0');
}
}
- if ($target eq 'web') {
+ if ($target eq 'web' || $target eq 'edit') {
$currentstring = &Apache::lonxml::xmlbegin().
&Apache::lonxml::fontsettings();
} elsif ($target eq 'tex') {
@@ -2178,6 +2178,44 @@
#<allow> tag will care about replication
}
}
+ } elsif ($target eq 'edit') {
+ $currentstring .=&Apache::edit::tag_start($target,$token);
+ $currentstring .=&Apache::edit::text_arg('Image Url:','src',$token,70).
+ &Apache::edit::browse('src',undef,'alt').' '.
+ &Apache::edit::search('src',undef,'alt').'<br />';
+ $currentstring .=&Apache::edit::text_arg('Description:','alt',$token,70).'<br />';
+ $currentstring .=&Apache::edit::text_arg('width (pixel):','width',$token,5);
+ $currentstring .=&Apache::edit::text_arg('height (pixel):','height',$token,5).'<br />';
+ $currentstring .=&Apache::edit::text_arg('TeXwidth (mm):','TeXwidth',$token,5);
+ $currentstring .=&Apache::edit::text_arg('TeXheight (mm):','TeXheight',$token,5);
+ $currentstring .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
+ my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval);
+ my $alt=&Apache::lonxml::get_param('alt',$parstack,$safeeval);
+ my $width=&Apache::lonxml::get_param('width',$parstack,$safeeval);
+ my $height=&Apache::lonxml::get_param('height',$parstack,$safeeval);
+ $currentstring .= '<img src="'.$src.'" alt="'.$alt.'" ';
+ if ($width) { $currentstring.=' width="'.$width.'" '; }
+ if ($height) { $currentstring.=' height="'.$height.'" '; }
+ $currentstring .= ' />';
+ } elsif ($target eq 'modified') {
+ my $constructtag=&Apache::edit::get_new_args($token,$parstack,
+ $safeeval,'src','alt',
+ 'TeXwidth','TeXheight',
+ 'width','height');
+ if (!$token->[2]{'width'} && !$token->[2]{'height'}) {
+ $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);
+ &image_replication($src);
+ if (-e $src) {
+ my $image = Image::Magick->new;
+ my ($width, $height, $size, $format) = $image->Ping($src);
+ if ($width && $height) {
+ $token->[2]{'width'} =$width;
+ $token->[2]{'height'}=$height;
+ $constructtag=1;
+ }
+ }
+ }
+ if ($constructtag) {$currentstring=&Apache::edit::rebuild_tag($token);}
}
return $currentstring;
}