[LON-CAPA-cvs] cvs: loncom /interface lonindexer.pm

raeburn raeburn at source.lon-capa.org
Tue Dec 23 15:45:39 EST 2025


raeburn		Tue Dec 23 20:45:39 2025 EDT

  Modified files:              
    /loncom/interface	lonindexer.pm 
  Log:
  - WCAG 2 compliance
  
  
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.232 loncom/interface/lonindexer.pm:1.233
--- loncom/interface/lonindexer.pm:1.232	Tue Mar 18 19:36:59 2025
+++ loncom/interface/lonindexer.pm	Tue Dec 23 20:45:39 2025
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.232 2025/03/18 19:36:59 raeburn Exp $
+# $Id: lonindexer.pm,v 1.233 2025/12/23 20:45:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -54,6 +54,7 @@
 use Apache::lonsource();
 use Apache::groupsort();
 use GDBM_File;
+use HTML::Entities;
 use LONCAPA qw(:match);
 
 # ---------------------------------------- variables used throughout the module
@@ -423,6 +424,7 @@
                      .&Apache::lonhtmlcommon::breadcrumbs()
             );
         }
+        $r->print("\n".'<div class="LC_landmark" role="main" id="LC_main_content">'."\n");
 
 # ---------------------------------- get state of file types to be showing
 	if ($env{'form.only'}) {
@@ -497,43 +499,45 @@
                            );
         my $cell = 0;
         my $numinrow = 4;
+        if ($env{'form.catalogmode'}) {
+            $r->print('<h1 class="LC_visually_hidden">'.&mt('Browse published resources').'</h1>');
+        }
 	$r->print('
 <form method="post" name="fileattr" action="'.$uri.'" enctype="application/x-www-form-urlencoded">
-<fieldset>
+<fieldset style="display: inline;">
 <legend>'.$lt{'hd'}.'</legend>
-<table style=" border-collapse: collapse; border-style: none;">'."\n");
+<div role="grid" class="LC_grid">'."\n");
         foreach my $item (@disp_order) {
             my $style = 'padding-left: 12px; padding-right: 8px;';
             if ($cell%$numinrow == 0) {
-                $r->print('<tr>');
+                $r->print('<div role="row" class="LC_grid_row">');
             }
             $cell ++;
-            if ($cell > 3 * $numinrow) {
-                $style .= ' padding-bottom: 6px;'; 
-            }
             if (defined($disp_options{$item})) {
-                $r->print('<td style="'.$style.'"><span class="LC_nobreak">'.
+                $r->print('<div role="gridcell" class="LC_grid_cell" style="'.$style.'"><span class="LC_nobreak">'.
                           '<label><input type="checkbox" name="attr'.$item.'" value="1" '.
                           $attrchk[$item].' onclick="this.form.submit();" /> '.$disp_options{$item}.
-                          '</label></span></td>'."\n");
+                          '</label></span></div>'."\n");
             }
             if ($cell > 1 && $cell%$numinrow == 0) {
-                $r->print('</tr>');
+                $r->print('</div>');
             }
         }
         $r->print(<<END);
-<tr>
-<td style="font-style: italic; border-top: 1px solid black; padding-top: 6px"> 
+</div>
+<div class="LC_floatleft" style="border-top: 1px solid black; padding: 4px 60px 0 0; margin:0;">
 <label><input type="checkbox" name="attr9" value="1" $attrchk[9] onclick="this.form.submit();" /> $lt{'av'}</label>
-</td>
-<td colspan="3" style="padding-left:8px; padding-top: 4px; font-style: italic; border-top: 1px solid black; padding-top: 8px">$type_selector</td>
-</tr>
-</table>
+</div>
+<div class="LC_floatleft" style="width: 70%; padding: 4px 0 0 0; font-style: italic; border-top: 1px solid black; margin: 0;">$type_selector
+</div>
+<div style="padding:0;clear:both;margin:0;border:0"></div>
 <input type="hidden" name="attrs" value="1" />
 </fieldset>
+<div style="margin: 0;">
 <input type="submit" name="updatedisplay" value="$lt{'ud'}" />
 <input type="hidden" name="acts" value="" />
 $closebutton $groupimportbutton
+</div>
 END
         $r->print(&Apache::loncommon::inhibit_menu_check('input'));
    
@@ -554,7 +558,8 @@
            .&Apache::lonhtmlcommon::select_recent(
                 'residx',
                 'resrecent',
-                'window.status=this.form.resrecent.options[this.form.resrecent.selectedIndex].value;this.form.action=this.form.resrecent.options[this.form.resrecent.selectedIndex].value;this.form.submit();')
+                'window.status=this.form.resrecent.options[this.form.resrecent.selectedIndex].value;this.form.action=this.form.resrecent.options[this.form.resrecent.selectedIndex].value;this.form.submit();',
+                &mt('Select recently visited directory'))
            .'</p>'
         );
 # -------------------------------------------------------- Resource Home Button
@@ -680,7 +685,7 @@
 	$r->print("<input type='hidden' name='fnum' value='$fnum' /></form>");
 
 # --------------------------------------------------- end the output and return
-	$r->print(&Apache::loncommon::end_page()."\n");
+	$r->print('</div>'.&Apache::loncommon::end_page()."\n");
     }
     if(! $c->aborted()) {
 # write back into the temporary file
@@ -1068,20 +1073,21 @@
 	
         if ($env{'form.catalogmode'} eq 'interactive') {
 	    my $quotable_filelink = &Apache::loncommon::escape_single($filelink);
-            $r->print("<a href=\"javascript:select_data(\'",
-                      $quotable_filelink,"')\">");
-	    $r->print("<img alt=\"\" src='",$iconpath,"select.gif' class='LC_icon' /></a>".
-		      "\n");
+            my $alttext = &mt('Select resource');
+            $r->print("<button style=\"border: none; outline: none;\" onclick=\"javascript:select_data('".
+                      $quotable_filelink."');\"><img alt=\"$alttext\" src=\"$iconpath".
+                      "select.gif\" class=\"LC_icon\" border=\"0\" /></button>"."\n");
 	    $r->print('</td><td class="LC_middle">');
 	} elsif ($env{'form.catalogmode'} eq 'import') {
+            my $labeltext = &mt('Select [_1]',&HTML::Entities::encode($title,'<>&"\''));
 	    $r->print("<form name='form$fnum' action=''>\n");
 	    $r->print("<input type='checkbox' name='filelink"."' ".
 		      "value='$filelink' onclick='".
 		      "javascript:queue(\"form$fnum\")' ");
 	    if ($hash{'store_'.$filelink}) {
-		$r->print("checked");
+		$r->print('checked="checked"');
 	    }
-	    $r->print(" />\n");
+	    $r->print(" aria-label=\"$labeltext\" />\n");
 	    $r->print('</form></td><td class="LC_middle">');
 	    $hash{"pre_${fnum}_link"}=$filelink;
 	    $hash{"pre_${fnum}_title"}=$title;




More information about the LON-CAPA-cvs mailing list