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

raeburn raeburn at source.lon-capa.org
Wed Mar 19 11:18:59 EDT 2025


raeburn		Wed Mar 19 15:18:59 2025 EDT

  Modified files:              
    /loncom/interface	lonsearchcat.pm loncommon.pm 
  Log:
  - WCAG 2 compliance.
  
  
-------------- next part --------------
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.361 loncom/interface/lonsearchcat.pm:1.362
--- loncom/interface/lonsearchcat.pm:1.361	Tue Mar 18 18:57:28 2025
+++ loncom/interface/lonsearchcat.pm	Wed Mar 19 15:18:59 2025
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.361 2025/03/18 18:57:28 raeburn Exp $
+# $Id: lonsearchcat.pm,v 1.362 2025/03/19 15:18:59 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -717,7 +717,7 @@
                                                      &titlefield(&mt('Copyright/Distribution')).'</label>')
                   .&Apache::lonmeta::selectbox('copyright',
                                              $env{'form.copyright'},'',
-                                             'copyright', 
+                                             'copyright',
                                 \&Apache::loncommon::copyrightdescription,
                                        ( undef,
                                         &Apache::loncommon::copyrightids)
@@ -726,7 +726,7 @@
     }
 
     $scrout .= &Apache::lonhtmlcommon::row_title('<label for="language">'.
-                                                 &titlefield(&mt('Language'))'</label>')
+                                                 &titlefield(&mt('Language')).'</label>')
               .&Apache::lonmeta::selectbox('language',
                                     $env{'form.language'},'','language',
                                     \&Apache::loncommon::languagedescription,
@@ -764,7 +764,7 @@
                       .' value="'.$env{'form.addedvalues_'.$j}.'" aria-label="'.$valuelabel.'" />'
                       .&Apache::lonhtmlcommon::row_closure();
         }
-        my $addcustomlabel = &mt('Add metadata field option'); 
+        my $addcustomlabel = &mt('Add metadata field option');
         $scrout .= &Apache::lonhtmlcommon::row_title('<span class="LC_visually_hidden">'.$addcustomlabel.'</span>',
                                                      '','','',1)
                   .'<label>'
@@ -1302,7 +1302,7 @@
     if (! $fillflag) {
 	&output_blank_field_error($r,$closebutton,
                                   'phase=disp_adv',$hidden_fields);
-	return ;
+	return;
     }
     # Turn the form input into a SQL-based query
     my $query='';
@@ -2144,10 +2144,10 @@
         &Apache::lonhtmlcommon::breadcrumbs('Searching','Searching',
 					    $env{'form.catalogmode'} ne 'import',
                                             '','','','','','',$target);
-
     my $result = <<END;
 $start_page
 $breadcrumbs
+<div class="LC_landmark" role="main">
 <form name="statusform" action="" method="post" target="$target">
 <input type="hidden" name="catalogmode" value="import" />
 <input type="hidden" name="acts" value="" />
@@ -2170,7 +2170,7 @@
             .' '.$revise.'</p>'
             .'<p>'.&mt('Search: ').$pretty_query_string
             .'</p></form>';
-    $r->print($result.&Apache::loncommon::end_page());
+    $r->print($result.'</div>'.&Apache::loncommon::end_page());
     return;
 }
 
@@ -2420,6 +2420,7 @@
     $r->print(<<END);
 $start_page
 $breadcrumbs
+<div class="LC_landmark" role="main">
 END
     # Remove leading and trailing <br />
     $pretty_string =~ s:^\s*<br />::i;
@@ -2647,7 +2648,7 @@
     # We have run out of time or run out of servers to talk to and
     # results to get, so let the client know the top frame needs to be
     # loaded from /adm/searchcat
-    $r->print(&Apache::loncommon::end_page());
+    $r->print('</div>'.&Apache::loncommon::end_page());
 #    if ($env{'form.catalogmode'} ne 'import') {
          $r->print(<<SCRIPT);
 <script>
@@ -2711,7 +2712,8 @@
     if (!defined($viewfunction)) {
         $r->print('<p class="LC_error">'
                  .&mt('Internal Error - Bad view selected.')
-                 .'</p>'."\n");
+                 .'</p>'."\n"
+                 .'</form></div>'.&Apache::loncommon::end_page());
         $r->rflush();
         return;
     }
@@ -2733,7 +2735,7 @@
             $r->print('<p class="LC_error">'.
               &mt('Unable to save import results.').
               '</p>'.
-              '</form>'.
+              '</form></div>'.
 		      &Apache::loncommon::end_page());
             $r->rflush();
             return;
@@ -2754,7 +2756,7 @@
         $r->print('<p class="LC_error">'.
           &mt('A MySQL error has occurred.').
           '</p>'.
-          '</form>'.
+          '</form></div>'.
 		  &Apache::loncommon::end_page());
         &Apache::lonnet::logthis("lonmysql was unable to determine the number".
                                  " of rows in table ".$table);
@@ -2859,17 +2861,18 @@
 	    $env{'form.sortorder'}='asc';
 	}
     }
-    my $sortform = '<span class="LC_nobreak">'
-                  .&mt('Sort by:').' '
+    my $sortform = '<span class="LC_nobreak"><span id="LC_sortby">'
+                  .&mt('Sort by:').'</span> '
                   .&Apache::loncommon::select_form($env{'form.sortfield'},
-                                                      'sortfield',
-                                                      \%sort_fields)
+                                                   'sortfield',
+                                                   \%sort_fields,'','','',
+                                                   'LC_sortby')
                   .' '
                   .&Apache::loncommon::select_form($env{'form.sortorder'},
-                                                      'sortorder',
-                                                      {asc =>&mt('Ascending'),
-                                                       desc=>&mt('Descending')
-                                                       })
+                                                   'sortorder',
+                                                   {asc =>&mt('Ascending'),
+                                                    desc=>&mt('Descending')
+                                                   },'','','','LC_sortby')
                   .'</span>';
     ##
     ## Display links for 'prev' and 'next' pages (if necessary) and Display Options
@@ -2883,15 +2886,15 @@
     );
 
     if ($total_results == 0) {
-        $r->print('<p class="LC_info">'.&mt('There are currently no results.').'</p>'.
-                  "</form>".
+        $r->print('<h1 class="LC_search_results">'.&mt('There are currently no results.').'</h1>'.
+                  '</form></div>'.
 		  &Apache::loncommon::end_page());
         return;
     } else {
-        $r->print('<div>'.
+        $r->print('<h1 class="LC_search_results">'.
                   mt('Results [_1] to [_2] out of [_3]',
                      $min,$max,$total_results).
-                  "</div>\n");
+                  "</h1>\n");
     }
     ##
     ## Get results from MySQL table
@@ -2921,7 +2924,14 @@
     if ($area eq 'portfolio') {
         $tabletype = 'portfolio_search';
     }
-    $r->print(&Apache::loncommon::start_data_table());
+    $r->print(&Apache::loncommon::start_data_table().
+              &Apache::loncommon::start_data_table_header_row().
+              '<th>'.&mt('Data').'</th>');
+    if (($env{'form.viewselect'} eq 'detailedpreview') ||
+        ($env{'form.viewselect'} eq 'summarypreview')) {
+        $r->print('<th>'.&mt('Preview').'</th>');
+    }
+    $r->print(&Apache::loncommon::end_data_table_header_row());
     foreach my $row (@Results) {
         if ($connection->aborted()) {
             &cleanup();
@@ -2959,7 +2969,7 @@
                                 $env{'form.persistent_db_id'})
         );
     }
-    $r->print("</form>".&Apache::loncommon::end_page());
+    $r->print('</form></div>'.&Apache::loncommon::end_page());
     $r->rflush();
     untie %groupsearch_db if (tied(%groupsearch_db));
     return;
@@ -3270,6 +3280,7 @@
                                                       'add_modal' =>1});
     my $result=<<END;
 $start_page
+<div class="LC_landmark" role="main">
 <form name="results" method="post" action="/adm/searchcat">
 $importbutton
 END
@@ -3294,6 +3305,7 @@
     my $results_link = &results_link();
     my $js = <<JS;
 <script type="text/javascript">
+// <![CDATA[
 var targetwin = opener;
 var queue = '';
 
@@ -3316,6 +3328,7 @@
         update_results(new_location);
     }
 }
+// ]]>
 </script>
 JS
 
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1471 loncom/interface/loncommon.pm:1.1472
--- loncom/interface/loncommon.pm:1.1471	Tue Mar 18 18:57:28 2025
+++ loncom/interface/loncommon.pm	Wed Mar 19 15:18:59 2025
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1471 2025/03/18 18:57:28 raeburn Exp $
+# $Id: loncommon.pm,v 1.1472 2025/03/19 15:18:59 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2848,7 +2848,7 @@
   $hash - the elements should be 'option' => 'shown text'
           (shown text should already have been &mt())
   $order - (optional) array ref of the order to show the elements in
-  $id = (optional) id for <select> element 
+  $id = (optional) id for <select> element
 
 =cut
 
@@ -2890,7 +2890,7 @@
 
 =pod
 
-=item * &select_form($defdom,$name,$hashref,$onchange,$readonly,$id)
+=item * &select_form($defdom,$name,$hashref,$onchange,$readonly,$id,$aria_labelledby)
 
 Returns a string containing a <select name='$name' size='1'> form to 
 allow a user to select options from a ref to a hash containing:
@@ -2899,7 +2899,9 @@
 An optional arg -- $readonly -- if true will cause the select form
 to be disabled, e.g., for the case where an instructor has a section-
 specific role, and is viewing/modifying parameters. An optional arg
--- $id -- will be used as the id attribute of the select element. 
+-- $id -- will be used as the id attribute of the select element. An
+optional arg -- $aria_labelledby -- will be included as the aria-labelledby
+attribute of the select element.
 
 See lonrights.pm for an example invocation and use.
 
@@ -2907,7 +2909,7 @@
 
 #-------------------------------------------
 sub select_form {
-    my ($def,$name,$hashref,$onchange,$readonly,$id) = @_;
+    my ($def,$name,$hashref,$onchange,$readonly,$id,$aria_labelledby) = @_;
     return unless (ref($hashref) eq 'HASH');
     if ($onchange) {
         $onchange = ' onchange="'.$onchange.'"';
@@ -2919,7 +2921,10 @@
     if ($id ne '') {
         $id = ' id="'.$id.'"';
     }
-    my $selectform = "<select name=\"$name\" size=\"1\"$onchange$disabled$id>\n";
+    if ($aria_labelledby ne '') {
+        $aria_labelledby = ' aria-labelledby="'.$aria_labelledby.'"';
+    }
+    my $selectform = "<select name=\"$name\" size=\"1\"$onchange$disabled$id$aria_labelledby>\n";
     my @keys;
     if (exists($hashref->{'select_form_order'})) {
 	@keys=@{$hashref->{'select_form_order'}};
@@ -7361,6 +7366,11 @@
   font-size: 1.0em;
 }
 
+h1.LC_search_results {
+  font-size: 1.0em;
+  font-weight: normal;
+}
+
 .LC_menus_content.shown{
   display: block;
 }


More information about the LON-CAPA-cvs mailing list