--- loncom/homework/chemresponse.pm 2023/06/26 14:24:15 1.102
+++ loncom/homework/chemresponse.pm 2025/01/27 18:43:23 1.103
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# chemical equation style response
#
-# $Id: chemresponse.pm,v 1.102 2023/06/26 14:24:15 raeburn Exp $
+# $Id: chemresponse.pm,v 1.103 2025/01/27 18:43:23 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -558,10 +558,15 @@ sub start_organicstructure {
my $width=&Apache::lonxml::get_param('width',$parstack,$safeeval);
my $molecule=&Apache::lonxml::get_param('molecule',$parstack,$safeeval);
my $options=&Apache::lonxml::get_param('options',$parstack,$safeeval);
+ my $alttext=&Apache::lonxml::get_param('alt',$parstack,$safeeval);
+ if ($alttext eq '') {
+ $alttext = &mt('Organic structure');
+ }
+ $alttext = &HTML::Entities::encode($alttext,'<>&"');
my $id=&Apache::loncommon::get_cgi_id();
$result="
';
+ $result.=' alt="'.$alttext.'" />';
&Apache::lonnet::appenv(
{'cgi.'.$id.'.JME' => &escape($molecule),
'cgi.'.$id.'.PNG' => 1,
@@ -610,12 +615,14 @@ sub start_organicstructure {
[ ['reaction','Is a reaction'],
['border','Draw a border'] ],
$token);
+ $result .= '
'.&Apache::edit::text_arg('Alt text in JME img tag:','alt',$token,30).
+ ' ('.&mt('student-viewable in HTML source').')';
$result .=&Apache::edit::end_row();
} elsif ($target eq 'modified') {
my $constructtag=&Apache::edit::get_new_args($token,$parstack,
$safeeval,'molecule',
'width','texwidth',
- 'options');
+ 'options','alt');
if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
}
return $result;