[LON-CAPA-cvs] cvs: loncom(version_2_12_X) /interface domainprefs.pm

raeburn raeburn at source.lon-capa.org
Sun Aug 23 17:35:34 EDT 2026


raeburn		Sun Aug 23 21:35:34 2026 EDT

  Modified files:              (Branch: version_2_12_X)
    /loncom/interface	domainprefs.pm 
  Log:
  - For 2.12
    Backport 1.462, 1.463, 1.464, 1.465.
  
  
-------------- next part --------------
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.447.2.9 loncom/interface/domainprefs.pm:1.447.2.10
--- loncom/interface/domainprefs.pm:1.447.2.9	Sun Jun 28 18:31:05 2026
+++ loncom/interface/domainprefs.pm	Sun Aug 23 21:35:34 2026
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.447.2.9 2026/06/28 18:31:05 raeburn Exp $
+# $Id: domainprefs.pm,v 1.447.2.10 2026/08/23 21:35:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7115,6 +7115,7 @@
         exttool              => 'External Tools can be defined and configured in courses/communities (by type)',
         crsauthor            => 'Standard LON-CAPA problems can be created within a course/community (by type)',
         crseditors           => 'Available editors for web pages and/or problems created in a course/community',
+        axeuse               => 'Availability of Accessibility Checker in Content Utilities',
     );
     my %staticdefaults = (
                            anonsurvey_threshold => 10,
@@ -7295,10 +7296,20 @@
         my %crsauthor;
         my %crseditors;
         my @types = ('official','unofficial','community','textbook','placement');
+        my %checkedaxe = (
+            none => ' checked="checked"',
+        );
         if (ref($settings) eq 'HASH') {
             if ($settings->{'ltiauth'}) {
                 $ltiauth = 1;
             }
+            if ($settings->{'axeuse'} =~ /^dom|instdom|all$/) {
+                my $curraxe = $settings->{'axeuse'};
+                delete($checkedaxe{'none'});
+                %checkedaxe = (
+                                $curraxe => ' checked="checked"',
+                              );
+            }
             if (ref($settings->{'domexttool'}) eq 'HASH') {
                 foreach my $type (@types) {
                     if ($settings->{'domexttool'}->{$type}) {
@@ -7611,6 +7622,40 @@
                           $editornames{$editor}.'</label></span></div>'."\n";
         }
         $datatable .= '</div></div></fieldset></td></tr>'."\n";
+        $itemcount ++;
+        $css_class = $itemcount%2?' class="LC_odd_row"':'';
+        my %axetext = &Apache::lonlocal::texthash (
+                        none    => 'Not available in any courses/communities',
+                        dom     => "Available in domain's own courses/communities only",
+                        instdom => "Available in institution's own courses/communities only",
+                        all     => 'Available in courses/communities from any domain',
+        );
+        $datatable .=
+                '<tr'.$css_class.'><td><span class="LC_nobreak">'.
+                $choices{'axeuse'}.
+                '</span></td>'.
+                '<td class="LC_left_item">'.
+                '<fieldset class="LC_borderless" style="line-height: 185%;">'.
+                '<legend class="LC_visually_hidden">'.$choices{'axeuse'}.'</legend>'.
+                '<span class="LC_nobreak">';
+        my @possoptions = ('none');
+        my @alldoms = &Apache::lonnet::all_domains();
+        if (@alldoms > 1) {
+            push(@possoptions,'dom');
+            my (%by_ip,%by_location, at intdoms, at instdoms);
+            &build_location_hashes(\@intdoms,\%by_ip,\%by_location,\@instdoms);
+            if (@instdoms > 1) {
+                push(@possoptions,'instdom');
+            }
+        }
+        push(@possoptions,'all');
+        foreach my $option (@possoptions) {
+            $datatable .= '<label><input type="radio" name="axeuse"'.
+                          ' value="'.$option.'"'.$checkedaxe{$option}.' />'.
+                          $axetext{$option}.'</label>'.($option? '<br />' : '');
+        }
+        $datatable .= '</span></fieldset></td></tr>'."\n";
+        $itemcount ++;
     }
     $$rowtotal += $itemcount;
     return $datatable;
@@ -7795,15 +7840,14 @@
         }
         $datatable .= '</fieldset></td></tr>';
         $itemcount ++;
-        my %defchecked = (
-                                'archive' => 'off',
-                             );
-        my @toggles = ('archive');
         (my $archive,$itemcount) = &radiobutton_prefs($settings,['archive'],
                                                       {'archive' => 'off'},
                                                       \%titles,$itemcount);
         $datatable .= $archive."\n";
-        $itemcount ++;
+        (my $axecheck,$itemcount) = &radiobutton_prefs($settings,['axecheck'],
+                                                       {'axecheck' => 'off'},
+                                                       \%titles,$itemcount);
+        $datatable .= $axecheck."\n";
     }
     $$rowtotal += $itemcount;
     return $datatable;
@@ -7827,7 +7871,8 @@
                none => 'No override set',
                overon => 'Override -- webDAV on',
                overoff => 'Override -- webDAV off',
-               archive => 'Authors can download tar.gz file of Authoring Space',
+               archive => 'Authors and co-author managers can download tar.gz file of Authoring Space',
+               axecheck => 'Accessibility checking available',
     );
 }
 
@@ -13864,9 +13909,10 @@
                            'authorquota'  => 500,
                            'webdav'       => 0,
                            'archive'      => 'off',
+                           'axecheck'     => 'off',
                          );
     my %titles = &authordefaults_titles();
-    foreach my $item ('nocodemirror','daxecollapse','domcoordacc','archive') {
+    foreach my $item ('nocodemirror','daxecollapse','domcoordacc','archive','axecheck') {
         if ($env{'form.'.$item} =~ /^(0|1)$/) {
             $confhash{$item} = $env{'form.'.$item};
         }
@@ -13895,6 +13941,7 @@
     my @webdavon = &Apache::loncommon::get_env_multiple('form.webdav');
     my %webdav;
     map { $webdav{$_} = 1; } @webdavon;
+    my @offon = ('off','on');
     foreach my $type (@insttypes,'default') {
         my $possquota = $env{'form.authorquota_'.$type};
         if ($possquota =~ /^\d+$/) {
@@ -13910,10 +13957,20 @@
         $save_quotas{'webdav'}{'_LC_adv'} = $env{'form.webdav_LC_adv'};
     }
     if (ref($domconfig{'authordefaults'}) eq 'HASH') {
-        foreach my $item ('nocodemirror','daxecollapse','domcoordacc','copyright','sourceavail','archive') {
-            if ($domconfig{'authordefaults'}{$item} ne $confhash{$item}) {
-                $changes{$item} = 1;
-             }
+        foreach my $item ('nocodemirror','daxecollapse','domcoordacc','copyright','sourceavail','archive','axecheck') {
+            if (exists($domconfig{'authordefaults'}{$item})) {
+                if ($domconfig{'authordefaults'}{$item} ne $confhash{$item}) {
+                    $changes{$item} = 1;
+                }
+            } else {
+                if (($item eq 'copyright') || ($item eq 'sourceavail')) {
+                    if ($confhash{$item} ne $staticdefaults{$item}) {
+                        $changes{$item} = 1;
+                    }
+                } elsif ($offon[$confhash{$item}] ne $staticdefaults{$item}) {
+                    $changes{$item} = 1;
+                }
+            }
         }
         if (ref($domconfig{'authordefaults'}{'editors'}) eq 'ARRAY') {
             my @diffs =
@@ -13931,10 +13988,9 @@
             }
         }
     } else {
-        my @offon = ('off','on');
-        foreach my $item ('nocodemirror','daxecollapse','domcoordacc','archive') {
+        foreach my $item ('nocodemirror','daxecollapse','domcoordacc','archive','axecheck') {
             if ($offon[$confhash{$item}] ne $staticdefaults{$item}) {
-                $changes{$item} = 1; 
+                $changes{$item} = 1;
             }
         }
         foreach my $item ('copyright','sourceavail') {
@@ -14029,7 +14085,7 @@
                 $resulttext .= '</ul></li>';
             }
             my $domcoordoverride;
-            foreach my $key ('editors','authorquota','webdav','webdav_LC_adv','archive') {
+            foreach my $key ('editors','authorquota','webdav','webdav_LC_adv','archive','axecheck') {
                 if (exists($changes{$key})) {
                     my $shown;
                     unless ($domcoordoverride) {
@@ -14061,7 +14117,7 @@
                         } else {
                             $shown = $titles{'none'};
                         }
-                    } elsif ($key eq 'archive') {
+                    } elsif (($key eq 'archive') || ($key eq 'axecheck')) {
                         $domdefaults{$key} = $confhash{$key};
                         $shown = ($confhash{$key} ? &mt('Yes') : &mt('No'));
                     }
@@ -21741,6 +21797,7 @@
                            'usejsme'         => 'on',
                            'inline_chem'     => 'on',
                            'ltiauth'         => 'off',
+                           'axeuse'          => 'none',
                          );
     my @toggles = ('uselcmath','usejsme','inline_chem','ltiauth');
     my @numbers = ('anonsurvey_threshold','uploadquota_official','uploadquota_unofficial',
@@ -21766,11 +21823,6 @@
                         mimetex  => &mt('Convert to Images'),
                         tth      => &mt('TeX to HTML'),
                      );
-    my %pdftext = &Apache::lonlocal::texthash (
-                        2 => 'Yes, including checkboxes',
-                        1 => 'Yes, excluding checkboxes',
-                        0 => 'No',
-    );
 
     my @editors = ('edit','xml','daxe');
     my %editornames = &crseditor_titles();
@@ -22067,6 +22119,29 @@
         $defaultshash{'coursedefaults'}{'exttool'} = \%newexttool;
         $defaultshash{'coursedefaults'}{'crsauthor'} = \%newcrsauthor;
         $defaultshash{'coursedefaults'}{'crseditors'} = \@newcrseditors;
+
+        my @possoptions = ('none');
+        my @alldoms = &Apache::lonnet::all_domains();
+        if (@alldoms > 1) {
+            push(@possoptions,'dom');
+            my (%by_ip,%by_location, at intdoms, at instdoms);
+            &build_location_hashes(\@intdoms,\%by_ip,\%by_location,\@instdoms);
+            if (@instdoms > 1) {
+                push(@possoptions,'instdom');
+            }
+        }
+        push(@possoptions,'all');
+        if (grep(/^\Q$env{'form.axeuse'}\E$/, at possoptions)) {
+            my $curr = $domconfig{'coursedefaults'}{'axeuse'};
+            if ($curr eq '') {
+                unless ($curr eq $defaultchecked{'axeuse'}) {
+                    $changes{'axeuse'} = 1;
+                }
+            } elsif ($curr ne $env{'form.axeuse'}) {
+                $changes{'axeuse'} = 1;
+            }
+            $defaultshash{'coursedefaults'}{'axeuse'} = $env{'form.axeuse'};
+        }
     }
     my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,
                                              $dom);
@@ -22078,13 +22153,18 @@
                 ($changes{'canclone'}) || ($changes{'mysqltables'}) || ($changes{'texengine'}) ||
                 ($changes{'inline_chem'}) || ($changes{'ltiauth'}) || ($changes{'domexttool'}) ||
                 ($changes{'exttool'}) || ($changes{'coursequota'}) || ($changes{'crsauthor'}) ||
-                ($changes{'maxsizepdfform'})) {
+                ($changes{'maxsizepdfform'}) || ($changes{'axeuse'})) {
                 foreach my $item ('canuse_pdfforms','uselcmath','usejsme','inline_chem','texengine',
-                                  'ltiauth','maxsizepdfform') {
+                                  'maxsizepdfform') {
                     if ($changes{$item}) {
                         $domdefaults{$item}=$defaultshash{'coursedefaults'}{$item};
                     }
                 }
+                foreach my $item ('ltiauth','axeuse') {
+                    if ($changes{$item}) {
+                        $domdefaults{'crs'.$item}=$defaultshash{'coursedefaults'}{$item};
+                    }
+                }
                 if ($changes{'coursecredits'}) {
                     if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') {
                         foreach my $type (keys(%{$defaultshash{'coursedefaults'}{'coursecredits'}})) {
@@ -22349,6 +22429,16 @@
                         }
                         $resulttext .= '<li>'.&mt('Available editors for course/community resources: [_1]',$shown).'</li>';
                     }
+                } elsif ($item eq 'axeuse') {
+                    if ($env{'form.'.$item} eq 'none') {
+                        $resulttext .= '<li>'.&mt('Accessibility Checking unavailable').'</li>';
+                    } elsif ($env{'form.'.$item} eq 'dom') {
+                        $resulttext .= '<li>'.&mt("Accessibility Checking available for domain's own courses/communities").'</li>';
+                    } elsif ($env{'form.'.$item} eq 'instdom') {
+                        $resulttext .= '<li>'.&mt("Accessibility Checking available for institution's own courses/communities").'</li>';
+                    } else {
+                        $resulttext .= '<li>'.&mt('Accessibility Checking available for courses/communities from any domain').'</li>';
+                    }
                 }
             }
             $resulttext .= '</ul>';


More information about the LON-CAPA-cvs mailing list