[LON-CAPA-cvs] cvs: loncom /homework essayresponse.pm inputtags.pm /interface loncommon.pm
raeburn
raeburn at source.lon-capa.org
Sun Mar 2 00:22:45 EST 2025
raeburn Sun Mar 2 05:22:45 2025 EDT
Modified files:
/loncom/homework essayresponse.pm inputtags.pm
/loncom/interface loncommon.pm
Log:
- WCAG 2 compliance.
Index: loncom/homework/essayresponse.pm
diff -u loncom/homework/essayresponse.pm:1.127 loncom/homework/essayresponse.pm:1.128
--- loncom/homework/essayresponse.pm:1.127 Wed Feb 26 00:11:38 2025
+++ loncom/homework/essayresponse.pm Sun Mar 2 05:22:43 2025
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# essay (ungraded) style responses
#
-# $Id: essayresponse.pm,v 1.127 2025/02/26 00:11:38 raeburn Exp $
+# $Id: essayresponse.pm,v 1.128 2025/03/02 05:22:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -149,16 +149,43 @@
my ($part,$id,$coll) = @_;
my $output;
if ($coll) {
- $output = '<td><i>'.&mt('Collaborated with [_1]',$coll).'</i></td>';
+ my $udom = $env{'user.domain'};
+ my $uname = $env{'user.name'};
+ my @collaborators;
+ foreach my $possible_collaborator
+ (split(/[,;\s]+/,$coll)) {
+ $possible_collaborator =~ s/[\$\^\(\)]//g;
+ next if ($possible_collaborator eq '');
+ my ($co_name,$co_dom) = split(/:/,$possible_collaborator);
+ $co_dom = $udom if (! defined($co_dom) || $co_dom =~ /^domain$/i);
+ next if ($co_name eq $uname && $co_dom eq $udom);
+ push(@collaborators,$possible_collaborator);
+ }
+ if (@collaborators) {
+ $output = '<div style="display: inline-block; float: left">'."\n".
+ &Apache::loncommon::start_data_table().
+ &Apache::loncommon::data_table_caption(&mt('Collaborators'),'LC_filesub_status').
+ &Apache::loncommon::start_data_table_header_row().
+ '<th>'.&mt('Username').'</th>'.
+ &Apache::loncommon::end_data_table_header_row()."\n";
+ foreach my $user (@collaborators) {
+ $output .= &Apache::loncommon::start_data_table_row().
+ '<td>'.$user.'</td>'.
+ &Apache::loncommon::end_data_table_row()."\n";
+ }
+ $output .= &Apache::loncommon::end_data_table().'</div>';
+ }
}
- my $current_files_display = &Apache::inputtags::current_file_submissions($part,$id);
+ my $current_files_display =
+ &Apache::inputtags::current_file_submissions($part,$id,'',&mt('Submitted files'));
if ($current_files_display) {
- $output .= '<td><b>'.&mt('Submitted files:').'</b><br />'.
- $current_files_display.'</td>';
+ $output .= '<div style="display: inline-block; float:left;">'.
+ $current_files_display.'</div>';
}
if ($output ne '') {
- return '<table class="LC_pastsubmission"><tr>'.$output.
- '</tr></table>';
+ return '<div style="padding:0;clear:both;margin:0;border:0"></div>'.
+ $output.
+ '<div style="padding:0;clear:both;margin:0;border:0"></div>';
}
return;
}
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.365 loncom/homework/inputtags.pm:1.366
--- loncom/homework/inputtags.pm:1.365 Sun Mar 2 01:42:04 2025
+++ loncom/homework/inputtags.pm Sun Mar 2 05:22:43 2025
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.365 2025/03/02 01:42:04 raeburn Exp $
+# $Id: inputtags.pm,v 1.366 2025/03/02 05:22:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -262,9 +262,9 @@
if ($oldresponse =~ /\S/
&& &Apache::londefdef::is_inside_of($tagstack,
'essayresponse') ) {
- $result='<table class="LC_pastsubmission"><tr><td>'.
+ $result='<div class="LC_pastsubmission">'.
&HTML::Entities::encode($oldresponse,'"<>&').
- '</td></tr></table>';
+ '</div>';
}
#get rid of any startup text
&Apache::lonxml::get_all_text("/textfield",$parser,$style);
@@ -722,7 +722,7 @@
}
sub current_file_submissions {
- my ($part,$id,$filetype) = @_;
+ my ($part,$id,$filetype,$caption) = @_;
my $jspart=$part;
$jspart=~s/\./_/g;
my $uploadedfile=$Apache::lonhomework::history{"resource.$part.$id.uploadedfile"};
@@ -741,8 +741,11 @@
}
}
return unless ((@files_to_show) || ($uploadedfile));
+ if ($caption ne '') {
+ $caption = &Apache::loncommon::data_table_caption($caption,'LC_filesub_status');
+ }
my $header = &portpath_popup_js().
- &Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table().$caption.
&Apache::loncommon::start_data_table_header_row();
if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
$header .= '<th>'.&mt('Delete?').'</th>';
@@ -803,9 +806,11 @@
$result.=
&Apache::loncommon::start_data_table_row()."\n";
if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
+ my $labeltext = &HTML::Entities::encode(&mt('Delete [_1]',$rows{$url}{name}));
$result .=
'<td valign="bottom"><input type="checkbox" name="HWFILE'.$jspart.'_'.$id.'_delete"'.
- ' value="'.$portfile.'" id="HWFILE'.$jspart.'_'.$id.'_'.$num.'_delete" /></td>'."\n";
+ ' value="'.$portfile.'" id="HWFILE'.$jspart.'_'.$id.'_'.$num.'_delete"'.
+ ' aria-label="'.$labeltext.'" /></td>'."\n";
$num ++;
}
my $pathid = 'HWFILE'.$jspart.'_'.$id.'_'.$num.'_path';
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1467 loncom/interface/loncommon.pm:1.1468
--- loncom/interface/loncommon.pm:1.1467 Sat Mar 1 17:20:16 2025
+++ loncom/interface/loncommon.pm Sun Mar 2 05:22:45 2025
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1467 2025/03/01 17:20:16 raeburn Exp $
+# $Id: loncommon.pm,v 1.1468 2025/03/02 05:22:45 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -7506,9 +7506,10 @@
padding: 4px;
}
-table.LC_pastsubmission {
+.LC_pastsubmission {
border: 1px solid black;
margin: 2px;
+ padding: 2px;
}
table#LC_menubuttons {
@@ -8314,6 +8315,11 @@
padding: 5px;
}
+caption.LC_filesub_status {
+ text-align: left;
+ font-weight: bold;
+}
+
.LC_mail_actions {
float: left;
padding: 0;
@@ -10963,8 +10969,8 @@
}
sub data_table_caption {
- my $caption = shift;
- return "<caption class=\"LC_caption\">$caption</caption>";
+ my ($caption,$css_class) = @_;
+ return "<caption class=\"LC_caption $css_class\">$caption</caption>";
}
}
More information about the LON-CAPA-cvs
mailing list