Diff for /loncom/interface/domainprefs.pm between versions 1.435 and 1.448

version 1.435, 2024/02/27 15:46:42 version 1.448, 2025/01/12 16:10:23
Line 472  sub handler { Line 472  sub handler {
                     header => [{col1 => 'Target user has role',                      header => [{col1 => 'Target user has role',
                                 col2 => 'User information updatable in author context'},                                  col2 => 'User information updatable in author context'},
                                {col1 => 'Target user has role',                                 {col1 => 'Target user has role',
                                   col2 => 'User information updatable by co-author manager'},
                                  {col1 => 'Target user has role',
                                 col2 => 'User information updatable in course context'}],                                  col2 => 'User information updatable in course context'}],
                     print => \&print_usermodification,                      print => \&print_usermodification,
                     modify => \&modify_usermodification,                      modify => \&modify_usermodification,
Line 670  sub handler { Line 672  sub handler {
                              {col1 => 'Rules for shared secrets',                               {col1 => 'Rules for shared secrets',
                               col2 => 'Settings'},                                col2 => 'Settings'},
                              {col1 => 'Link Protectors in Courses',                               {col1 => 'Link Protectors in Courses',
                               col2 => 'Values'},                                 col2 => 'Values'},
                              {col1 => 'Link Protectors',                               {col1 => 'Link Protectors',
                               col2 => 'Settings'},                                col2 => 'Settings'},
                              {col1 => 'Consumers',                               {col1 => 'Consumers',
Line 686  sub handler { Line 688  sub handler {
                         print  => \&print_ipaccess,                          print  => \&print_ipaccess,
                         modify => \&modify_ipaccess,                          modify => \&modify_ipaccess,
                        },                         },
         'authordefaults' =>           'authordefaults' =>
                             {text => 'Authoring Space defaults',                              {text => 'Authoring Space defaults',
                              help => 'Domain_Configuration_Author_Defaults',                               help => 'Domain_Configuration_Author_Defaults',
                              header => [{col1 => 'Defaults which can be overridden by Author',                               header => [{col1 => 'Defaults which can be overridden by Author',
Line 1031  sub print_config_box { Line 1033  sub print_config_box {
             ($action eq 'usersessions') || ($action eq 'coursecategories') ||               ($action eq 'usersessions') || ($action eq 'coursecategories') || 
             ($action eq 'trust') || ($action eq 'contacts') || ($action eq 'defaults') ||              ($action eq 'trust') || ($action eq 'contacts') || ($action eq 'defaults') ||
             ($action eq 'privacy') || ($action eq 'passwords') || ($action eq 'lti') ||              ($action eq 'privacy') || ($action eq 'passwords') || ($action eq 'lti') ||
             ($action eq 'ltitools')) {              ($action eq 'ltitools') || ($action eq 'usermodification')) {
             if ($action eq 'coursecategories') {              if ($action eq 'coursecategories') {
                 $output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal);                  $output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal);
                 $colspan = ' colspan="2"';                  $colspan = ' colspan="2"';
Line 1135  sub print_config_box { Line 1137  sub print_config_box {
                 }                  }
             }              }
             $rowtotal ++;              $rowtotal ++;
         } elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||          } elsif (($action eq 'coursedefaults') || ($action eq 'authordefaults') ||
                  ($action eq 'directorysrch') || ($action eq 'helpsettings') ||                   ($action eq 'directorysrch') || ($action eq 'helpsettings') ||
                  ($action eq 'wafproxy') || ($action eq 'authordefaults')) {                   ($action eq 'wafproxy')) {
             $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);              $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
         } elsif ($action eq 'scantron') {          } elsif ($action eq 'scantron') {
             $output .= $item->{'print'}->($r,'bottom',$dom,$confname,$settings,\$rowtotal);              $output .= $item->{'print'}->($r,'bottom',$dom,$confname,$settings,\$rowtotal);
Line 2007  sub commblocktype_text { Line 2009  sub commblocktype_text {
         'passwd' => 'Change Password',          'passwd' => 'Change Password',
         'grades' => 'Gradebook',          'grades' => 'Gradebook',
         'search' => 'Course search',          'search' => 'Course search',
           'index'  => 'Course content index',
         'wishlist' => 'Stored links',          'wishlist' => 'Stored links',
         'annotate' => 'Annotations',          'annotate' => 'Annotations',
     );      );
     my $typeorder = ['com','chat','boards','port','groups','blogs','about','wishlist','printout','grades','search','annotate','passwd'];      my $typeorder = ['com','chat','boards','port','groups','blogs','about','wishlist','printout','grades','search','index','annotate','passwd'];
     return ($typeorder,\%types);      return ($typeorder,\%types);
 }  }
   
Line 2019  sub print_rolecolors { Line 2022  sub print_rolecolors {
     my %choices = &color_font_choices();      my %choices = &color_font_choices();
     my @bgs = ('pgbg','tabbg','sidebg');      my @bgs = ('pgbg','tabbg','sidebg');
     my @links = ('link','alink','vlink');      my @links = ('link','alink','vlink');
     my @images = ('img');      my @images = ();
     my %alt_text = &Apache::lonlocal::texthash(img => "Banner for $role role");      my %alt_text = &Apache::lonlocal::texthash(img => "Banner for $role role");
     my %designhash = &Apache::loncommon::get_domainconf($dom);      my %designhash = &Apache::loncommon::get_domainconf($dom);
     my %defaultdesign = %Apache::loncommon::defaultdesign;      my %defaultdesign = %Apache::loncommon::defaultdesign;
Line 2027  sub print_rolecolors { Line 2030  sub print_rolecolors {
     my %defaults = &role_defaults($role,\@bgs,\@links,\@images);      my %defaults = &role_defaults($role,\@bgs,\@links,\@images);
     if (ref($settings) eq 'HASH') {      if (ref($settings) eq 'HASH') {
         if (ref($settings->{$role}) eq 'HASH') {          if (ref($settings->{$role}) eq 'HASH') {
             if ($settings->{$role}->{'img'} ne '') {  
                 $designs{'img'} = $settings->{$role}->{'img'};  
                 $is_custom{'img'} = 1;  
             }  
             if ($settings->{$role}->{'font'} ne '') {              if ($settings->{$role}->{'font'} ne '') {
                 $designs{'font'} = $settings->{$role}->{'font'};                  $designs{'font'} = $settings->{$role}->{'font'};
                 $is_custom{'font'} = 1;                  $is_custom{'font'} = 1;
Line 2053  sub print_rolecolors { Line 2052  sub print_rolecolors {
             }              }
         }          }
     } else {      } else {
         if ($designhash{$dom.'.'.$role.'.img'} ne '') {  
             $designs{img} = $designhash{$dom.'.'.$role.'.img'};  
             $is_custom{'img'} = 1;  
         }  
         if ($designhash{$dom.'.'.$role.'.fontmenu'} ne '') {          if ($designhash{$dom.'.'.$role.'.fontmenu'} ne '') {
             $designs{fontmenu} = $designhash{$dom.'.'.$role.'.fontmenu'};              $designs{fontmenu} = $designhash{$dom.'.'.$role.'.fontmenu'};
             $is_custom{'fontmenu'} = 1;               $is_custom{'fontmenu'} = 1; 
Line 2106  sub role_defaults { Line 2101  sub role_defaults {
         }          }
     } else {      } else {
         %defaults = (          %defaults = (
                        img => $defaultdesign{$role.'.img'},  
                        font => $defaultdesign{$role.'.font'},                         font => $defaultdesign{$role.'.font'},
                        fontmenu => $defaultdesign{$role.'.fontmenu'},                         fontmenu => $defaultdesign{$role.'.fontmenu'},
                     );                      );
Line 6917  sub print_coursedefaults { Line 6911  sub print_coursedefaults {
         domexttool           => 'External Tools defined in the domain may be used in courses/communities (by type)',          domexttool           => 'External Tools defined in the domain may be used in courses/communities (by type)',
         exttool              => 'External Tools can be defined and configured in courses/communities (by type)',          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)',          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',
     );      );
     my %staticdefaults = (      my %staticdefaults = (
                            anonsurvey_threshold => 10,                             anonsurvey_threshold => 10,
Line 6927  sub print_coursedefaults { Line 6922  sub print_coursedefaults {
                            domexttool           => 1,                             domexttool           => 1,
                            exttool              => 0,                             exttool              => 0,
                            crsauthor            => 1,                             crsauthor            => 1,
                              crseditors           => ['edit','xml'],  
                          );                           );
     if ($position eq 'top') {      if ($position eq 'top') {
         %defaultchecked = (          %defaultchecked = (
Line 7048  sub print_coursedefaults { Line 7044  sub print_coursedefaults {
         my %domexttool;          my %domexttool;
         my %exttool;          my %exttool;
         my %crsauthor;          my %crsauthor;
           my %crseditors;
         my @types = ('official','unofficial','community','textbook','placement');          my @types = ('official','unofficial','community','textbook','placement');
         if (ref($settings) eq 'HASH') {          if (ref($settings) eq 'HASH') {
             if ($settings->{'ltiauth'}) {              if ($settings->{'ltiauth'}) {
Line 7086  sub print_coursedefaults { Line 7083  sub print_coursedefaults {
                     }                      }
                 }                  }
             }              }
               if (ref($settings->{'crseditors'}) eq 'ARRAY') {
                   foreach my $editor (@{$settings->{'crseditors'}}) {
                       $crseditors{$editor} = ' checked="checked"';
                   }
               } else {
                   foreach my $editor (@{$staticdefaults{'crseditors'}}) {
                       $crseditors{$editor} = ' checked="checked"';
                   }
               }
             $currdefresponder = $settings->{'anonsurvey_threshold'};              $currdefresponder = $settings->{'anonsurvey_threshold'};
             if (ref($settings->{'uploadquota'}) eq 'HASH') {              if (ref($settings->{'uploadquota'}) eq 'HASH') {
                 foreach my $type (keys(%{$settings->{'uploadquota'}})) {                  foreach my $type (keys(%{$settings->{'uploadquota'}})) {
Line 7149  sub print_coursedefaults { Line 7155  sub print_coursedefaults {
                     $crsauthor{$type} = ' checked="checked"';                      $crsauthor{$type} = ' checked="checked"';
                 }                  }
             }              }
               foreach my $editor (@{$staticdefaults{'crseditors'}}) {
                   $crseditors{$editor} = ' checked="checked"';
               }
         }          }
         if (!$currdefresponder) {          if (!$currdefresponder) {
             $currdefresponder = $staticdefaults{'anonsurvey_threshold'};              $currdefresponder = $staticdefaults{'anonsurvey_threshold'};
Line 7276  sub print_coursedefaults { Line 7285  sub print_coursedefaults {
         foreach my $type (@types) {          foreach my $type (@types) {
             $datatable .= '<td style="text-align: left">'.              $datatable .= '<td style="text-align: left">'.
                           '<span class="LC_nobreak">'.                            '<span class="LC_nobreak">'.
                           '<input type="checkbox" name="domexttool"'.                            '<label><input type="checkbox" name="domexttool"'.
                           ' value="'.$type.'"'.$domexttool{$type}.' />'.                            ' value="'.$type.'"'.$domexttool{$type}.' />'.
                           &mt($type).'</span></td>'."\n";                            &mt($type).'</label></span></td>'."\n";
         }          }
         $datatable .= '</tr></table></td></tr>'."\n";          $datatable .= '</tr></table></td></tr>'."\n";
         $itemcount ++;          $itemcount ++;
Line 7291  sub print_coursedefaults { Line 7300  sub print_coursedefaults {
         foreach my $type (@types) {          foreach my $type (@types) {
             $datatable .= '<td style="text-align: left">'.              $datatable .= '<td style="text-align: left">'.
                           '<span class="LC_nobreak">'.                            '<span class="LC_nobreak">'.
                           '<input type="checkbox" name="exttool"'.                            '<label><input type="checkbox" name="exttool"'.
                           ' value="'.$type.'"'.$exttool{$type}.' />'.                            ' value="'.$type.'"'.$exttool{$type}.' />'.
                           &mt($type).'</span></td>'."\n";                            &mt($type).'</label></span></td>'."\n";
         }          }
         $datatable .= '</tr></table></td></tr>'."\n";          $datatable .= '</tr></table></td></tr>'."\n";
         $itemcount ++;          $itemcount ++;
Line 7306  sub print_coursedefaults { Line 7315  sub print_coursedefaults {
         foreach my $type (@types) {          foreach my $type (@types) {
             $datatable .= '<td style="text-align: left">'.              $datatable .= '<td style="text-align: left">'.
                           '<span class="LC_nobreak">'.                            '<span class="LC_nobreak">'.
                           '<input type="checkbox" name="crsauthor"'.                            '<label><input type="checkbox" name="crsauthor"'.
                           ' value="'.$type.'"'.$crsauthor{$type}.' />'.                            ' value="'.$type.'"'.$crsauthor{$type}.' />'.
                           &mt($type).'</span></td>'."\n";                            &mt($type).'</label></span></td>'."\n";
           }
           $datatable .= '</tr></table></td></tr>'."\n";
           $itemcount ++;
           $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
           $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.
                         $choices{'crseditors'}.
                         '</span></td>'.
                         '<td style="text-align: right" class="LC_right_item">'.
                         '<table><tr>';
           my @editors = ('edit','xml','daxe');
           my %editornames = &crseditor_titles();
           foreach my $editor (@editors) {
               $datatable .= '<td style="text-align: left">'.
                             '<span class="LC_nobreak">'.
                             '<label><input type="checkbox" name="crseditors"'.
                             ' value="'.$editor.'"'.$crseditors{$editor}.' />'.
                             $editornames{$editor}.'</label></span></td>'."\n";
         }          }
         $datatable .= '</tr></table></td></tr>'."\n";          $datatable .= '</tr></table></td></tr>'."\n";
     }      }
Line 7316  sub print_coursedefaults { Line 7342  sub print_coursedefaults {
     return $datatable;      return $datatable;
 }  }
   
   sub crseditor_titles {
       return &Apache::lonlocal::texthash(
                  edit  => 'Standard editor (Edit)',
                  xml   => 'Text editor (EditXML)',
                  daxe  => 'Daxe editor (Daxe)',
              );
   }
   
 sub print_authordefaults {  sub print_authordefaults {
     my ($position,$dom,$settings,$rowtotal) = @_;      my ($position,$dom,$settings,$rowtotal) = @_;
     my ($css_class,$datatable,%checkedon,%checkedoff);      my ($css_class,$datatable,%checkedon,%checkedoff);
Line 7324  sub print_authordefaults { Line 7358  sub print_authordefaults {
     if ($position eq 'top') {      if ($position eq 'top') {
         my %defaultchecked = (          my %defaultchecked = (
                             'nocodemirror' => 'off',                              'nocodemirror' => 'off',
                               'daxecollapse' => 'off',
                             'domcoordacc'  => 'on',                              'domcoordacc'  => 'on',
                           );                            );
         my @toggles = ('nocodemirror','domcoordacc');          my @toggles = ('nocodemirror','daxecollapse','domcoordacc');
         ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,          ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
                                                      \%titles,$itemcount);                                                       \%titles,$itemcount);
         my %staticdefaults = (          my %staticdefaults = (
Line 7445  sub print_authordefaults { Line 7480  sub print_authordefaults {
         my $checkedno = ' checked="checked"';          my $checkedno = ' checked="checked"';
         my ($checkedon,$checkedoff);          my ($checkedon,$checkedoff);
         if (ref($quotas{'webdav'}) eq 'HASH') {          if (ref($quotas{'webdav'}) eq 'HASH') {
             if ($quotas{'webdav'}{'_LC_adv'} =~ /^0|1$/) {               if ($quotas{'webdav'}{'_LC_adv'} =~ /^0|1$/) {
                 if ($quotas{'webdav'}{'_LC_adv'}) {                  if ($quotas{'webdav'}{'_LC_adv'}) {
                     $checkedon = $checkedno;                      $checkedon = $checkedno;
                 } else {                  } else {
Line 7474  sub print_authordefaults { Line 7509  sub print_authordefaults {
                 $text = $titles{'overon'};                  $text = $titles{'overon'};
                 $val = 1;                  $val = 1;
                 $checked = $checkedon;                  $checked = $checkedon;
             }               }
             $datatable .= '<span class="LC_nobreak"><label>'.              $datatable .= '<span class="LC_nobreak"><label>'.
                           '<input type="radio" name="webdav_LC_adv"'.                            '<input type="radio" name="webdav_LC_adv"'.
                           ' value="'.$val.'"'.$checked.' />'.                            ' value="'.$val.'"'.$checked.' />'.
Line 7482  sub print_authordefaults { Line 7517  sub print_authordefaults {
         }          }
         $datatable .= '</td></tr>';          $datatable .= '</td></tr>';
         $itemcount ++;          $itemcount ++;
           my %defchecked = (
                                   'archive' => 'off',
                                );
           my @toggles = ('archive');
           (my $archive,$itemcount) = &radiobutton_prefs($settings,['archive'],
                                                         {'archive' => 'off'},
                                                         \%titles,$itemcount);
           $datatable .= $archive."\n";
           $itemcount ++;
     }      }
     $$rowtotal += $itemcount;      $$rowtotal += $itemcount;
     return $datatable;      return $datatable;
Line 7495  sub authordefaults_titles { Line 7539  sub authordefaults_titles {
                webdav => 'WebDAV',                 webdav => 'WebDAV',
                authorquota => 'Authoring Space quotas (MB)',                 authorquota => 'Authoring Space quotas (MB)',
                nocodemirror => 'Deactivate CodeMirror for EditXML editor',                 nocodemirror => 'Deactivate CodeMirror for EditXML editor',
                  daxecollapse => 'Daxe editor: LON-CAPA standard menus start collapsed',
                domcoordacc => 'Dom. Coords. can enter Authoring Spaces in domain',                 domcoordacc => 'Dom. Coords. can enter Authoring Spaces in domain',
                edit  => 'Standard editor (Edit)',                 edit  => 'Standard editor (Edit)',
                xml   => 'Text editor (EditXML)',                 xml   => 'Text editor (EditXML)',
Line 7503  sub authordefaults_titles { Line 7548  sub authordefaults_titles {
                webdav_LC_adv_over => '(overrides access based on affiliation, if set)',                 webdav_LC_adv_over => '(overrides access based on affiliation, if set)',
                none => 'No override set',                 none => 'No override set',
                overon => 'Override -- webDAV on',                 overon => 'Override -- webDAV on',
                overoff => 'Override -- webDAV off',                  overoff => 'Override -- webDAV off',
                  archive => 'Authors can download tar.gz file of Authoring Space',
     );      );
 }  }
   
Line 10672  sub print_usermodification { Line 10718  sub print_usermodification {
             $$rowtotal ++;              $$rowtotal ++;
             $rowcount ++;              $rowcount ++;
         }          }
       } elsif ($position eq 'middle') {
           $rowcount = 0;
           $context = 'coauthor';
           foreach my $role ('ca','aa') {
               $datatable .= &modifiable_userdata_row($context,$role,$settings,
                                                      $numinrow,$rowcount);
               $$rowtotal ++;
               $rowcount ++;
           }
     } elsif ($position eq 'bottom') {      } elsif ($position eq 'bottom') {
         $context = 'course';          $context = 'course';
         $rowcount = 0;          $rowcount = 0;
Line 12096  sub modifiable_userdata_row { Line 12151  sub modifiable_userdata_row {
             }              }
         } elsif (ref($settings->{$context}) eq 'HASH') {          } elsif (ref($settings->{$context}) eq 'HASH') {
             if (ref($settings->{$context}->{$role}) eq 'HASH') {              if (ref($settings->{$context}->{$role}) eq 'HASH') {
                 $hashref = $settings->{'lti_instdata'};                  $hashref = $settings->{$context}->{$role};
             }              }
             if ($role eq 'emailusername') {              if ($role eq 'emailusername') {
                 if ($statustype) {                  if ($statustype) {
Line 12177  sub modifiable_userdata_row { Line 12232  sub modifiable_userdata_row {
         } else {          } else {
             if ($context eq 'lti') {              if ($context eq 'lti') {
                 $prefix = 'lti';                  $prefix = 'lti';
               } elsif ($context eq 'coauthor') {
                   $prefix = 'cacanmodify';
             } elsif ($context eq 'privacy') {              } elsif ($context eq 'privacy') {
                 $prefix = 'privacy';                  $prefix = 'privacy';
             }              }
Line 13069  sub check_exempt_addresses { Line 13126  sub check_exempt_addresses {
 sub color_font_choices {  sub color_font_choices {
     my %choices =      my %choices =
         &Apache::lonlocal::texthash (          &Apache::lonlocal::texthash (
             img => "Header",  
             bgs => "Background colors",              bgs => "Background colors",
             links => "Link colors",              links => "Link colors",
             images => "Images",              images => "Images",
Line 13124  sub modify_ipaccess { Line 13180  sub modify_ipaccess {
     foreach my $idx (@items) {      foreach my $idx (@items) {
         my $itemid = $itemids{$idx};          my $itemid = $itemids{$idx};
         next unless ($itemid);          next unless ($itemid);
         my %current;          my ($position,%current);
         unless ($idx eq 'add') {          if ($idx eq 'add') {
               $position = $env{'form.ipaccess_pos_add'};
           } else {
               $position = $env{'form.ipaccess_pos_'.$itemid};
             if (ref($domconfig{'ipaccess'}{$itemid}) eq 'HASH') {              if (ref($domconfig{'ipaccess'}{$itemid}) eq 'HASH') {
                 %current = %{$domconfig{'ipaccess'}{$itemid}};                  %current = %{$domconfig{'ipaccess'}{$itemid}};
             }              }
         }          }
         my $position = $env{'form.ipaccess_pos_'.$itemid};  
         $position =~ s/\D+//g;          $position =~ s/\D+//g;
         if ($position ne '') {          if ($position ne '') {
             $allpos[$position] = $itemid;              $allpos[$position] = $itemid;
Line 13381  sub modify_authordefaults { Line 13439  sub modify_authordefaults {
                            'copyright'    => 'default',                             'copyright'    => 'default',
                            'sourceavail'  => 'closed',                             'sourceavail'  => 'closed',
                            'nocodemirror' => 'off',                             'nocodemirror' => 'off',
                              'daxecollapse' => 'off',
                            'domcoordacc'  => 'on',                             'domcoordacc'  => 'on',
                            'editors'      => ['edit','xml'].                             'editors'      => ['edit','xml'],
                            'authorquota'  => 500,                             'authorquota'  => 500,
                            'webdav'       => 0,                             'webdav'       => 0,
                              'archive'      => 'off',
                          );                           );
     my %titles = &authordefaults_titles();      my %titles = &authordefaults_titles();
     foreach my $item ('nocodemirror','domcoordacc') {      foreach my $item ('nocodemirror','daxecollapse','domcoordacc','archive') {
         if ($env{'form.'.$item} =~ /^(0|1)$/) {          if ($env{'form.'.$item} =~ /^(0|1)$/) {
             $confhash{$item} = $env{'form.'.$item};              $confhash{$item} = $env{'form.'.$item};
         }          }
Line 13407  sub modify_authordefaults { Line 13467  sub modify_authordefaults {
         }          }
     }      }
     $confhash{'editors'} = \@editors;      $confhash{'editors'} = \@editors;
      
     my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);      my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
     my @insttypes;      my @insttypes;
     if (ref($types) eq 'ARRAY') {      if (ref($types) eq 'ARRAY') {
Line 13431  sub modify_authordefaults { Line 13491  sub modify_authordefaults {
         $save_quotas{'webdav'}{'_LC_adv'} = $env{'form.webdav_LC_adv'};          $save_quotas{'webdav'}{'_LC_adv'} = $env{'form.webdav_LC_adv'};
     }      }
     if (ref($domconfig{'authordefaults'}) eq 'HASH') {      if (ref($domconfig{'authordefaults'}) eq 'HASH') {
         foreach my $item ('nocodemirror','domcoordacc','copyright','sourceavail') {          foreach my $item ('nocodemirror','daxecollapse','domcoordacc','copyright','sourceavail','archive') {
             if ($domconfig{'authordefaults'}{$item} ne $confhash{$item}) {              if ($domconfig{'authordefaults'}{$item} ne $confhash{$item}) {
                 $changes{$item} = 1;                  $changes{$item} = 1;
              }               }
         }          }
         if (ref($domconfig{'authordefaults'}{'editors'}) eq 'ARRAY') {          if (ref($domconfig{'authordefaults'}{'editors'}) eq 'ARRAY') {
             my @diffs =               my @diffs =
                 &Apache::loncommon::compare_arrays($confhash{'editors'},                  &Apache::loncommon::compare_arrays($confhash{'editors'},
                                                    $domconfig{'authordefaults'}{'editors'});                                                     $domconfig{'authordefaults'}{'editors'});
             unless (@diffs == 0) {              unless (@diffs == 0) {
Line 13453  sub modify_authordefaults { Line 13513  sub modify_authordefaults {
         }          }
     } else {      } else {
         my @offon = ('off','on');          my @offon = ('off','on');
         foreach my $item ('nocodemirror','domcoordacc') {          foreach my $item ('nocodemirror','daxecollapse','domcoordacc','archive') {
             if ($offon[$confhash{$item}] ne $staticdefaults{$item}) {               if ($offon[$confhash{$item}] ne $staticdefaults{$item}) {
                 $changes{$item} = 1;                   $changes{$item} = 1; 
             }              }
         }          }
Line 13463  sub modify_authordefaults { Line 13523  sub modify_authordefaults {
                 $changes{$item} = 1;                  $changes{$item} = 1;
             }              }
         }          }
           my @diffs =
               &Apache::loncommon::compare_arrays($confhash{'editors'},
                                                  $staticdefaults{'editors'});
           unless (@diffs == 0) {
               $changes{'editors'} = 1;
           }
     }      }
     foreach my $key ('authorquota','webdav') {      foreach my $key ('authorquota','webdav') {
         if (ref($curr_quotas{$key}) eq 'HASH') {          if (ref($curr_quotas{$key}) eq 'HASH') {
Line 13491  sub modify_authordefaults { Line 13557  sub modify_authordefaults {
     }      }
     if (ref($curr_quotas{'webdav'}) eq 'HASH') {      if (ref($curr_quotas{'webdav'}) eq 'HASH') {
         if (exists($save_quotas{'webdav'}{'_LC_adv'})) {          if (exists($save_quotas{'webdav'}{'_LC_adv'})) {
             if ($save_quotas{'webdav'}{'_LC_adv'} ne $curr_quotas{'webdav'}{'_LC_adv'}) {               if ($save_quotas{'webdav'}{'_LC_adv'} ne $curr_quotas{'webdav'}{'_LC_adv'}) {
                 $changes{'webdav_LC_adv'} = 1;                  $changes{'webdav_LC_adv'} = 1;
             }              }
         } elsif (exists($curr_quotas{'webdav'}{'_LC_adv'})) {          } elsif (exists($curr_quotas{'webdav'}{'_LC_adv'})) {
Line 13511  sub modify_authordefaults { Line 13577  sub modify_authordefaults {
         if (keys(%changes)) {          if (keys(%changes)) {
             my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);              my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
             if ((exists($changes{'authorquota'})) || (exists($changes{'webdav'})) ||              if ((exists($changes{'authorquota'})) || (exists($changes{'webdav'})) ||
                 ($changes{'webdav_LC_adv'})) {                   ($changes{'webdav_LC_adv'})) {
                 if ((exists($changes{'authorquota'})) && (ref($save_quotas{'authorquota'}) eq 'HASH')) {                  if ((exists($changes{'authorquota'})) && (ref($save_quotas{'authorquota'}) eq 'HASH')) {
                     $domdefaults{'authorquota'} = $save_quotas{'authorquota'};                      $domdefaults{'authorquota'} = $save_quotas{'authorquota'};
                 }                  }
Line 13522  sub modify_authordefaults { Line 13588  sub modify_authordefaults {
             }              }
             $resulttext = &mt('Changes made:').'<ul>';              $resulttext = &mt('Changes made:').'<ul>';
             my $authoroverride;              my $authoroverride;
             foreach my $key ('nocodemirror','domcoordacc','copyright','sourceavail') {              foreach my $key ('nocodemirror','daxecollapse','domcoordacc','copyright','sourceavail') {
                 if (exists($changes{$key})) {                  if (exists($changes{$key})) {
                     $domdefaults{$key} = $confhash{$key};                      $domdefaults{$key} = $confhash{$key};
                     my $shown;                      my $shown;
Line 13530  sub modify_authordefaults { Line 13596  sub modify_authordefaults {
                         $resulttext .= '<li>'.&mt('Defaults which can be overridden by Author').'<ul>';                          $resulttext .= '<li>'.&mt('Defaults which can be overridden by Author').'<ul>';
                         $authoroverride = 1;                          $authoroverride = 1;
                     }                      }
                     if (($key eq 'nocodemirror') || ($key eq 'domcoordacc')) {                       if (($key eq 'nocodemirror') || ($key eq 'daxecollapse') || ($key eq 'domcoordacc')) {
                         $shown = ($confhash{$key} ? &mt('Yes') : &mt('No'));                          $shown = ($confhash{$key} ? &mt('Yes') : &mt('No'));
                     } elsif ($key eq 'copyright') {                      } elsif ($key eq 'copyright') {
                         $shown = &Apache::loncommon::copyrightdescription($confhash{$key});                          $shown = &Apache::loncommon::copyrightdescription($confhash{$key});
                     } elsif ($key eq 'sourceavail') {                      } elsif ($key eq 'sourceavail') {
                         $shown = &Apache::loncommon::source_copyrightdescription($confhash{$key});                          $shown = &Apache::loncommon::source_copyrightdescription($confhash{$key});
                     }                      }
                     $resulttext .= '<li>'.&mt('[_1] set to: [_2]',$titles{$key},$shown).'</li>';                       $resulttext .= '<li>'.&mt('[_1] set to: [_2]',$titles{$key},$shown).'</li>';
                 }                  }
             }              }
             if ($authoroverride) {              if ($authoroverride) {
                 $resulttext .= '</ul></li>';                  $resulttext .= '</ul></li>';
             }              }
             my $domcoordoverride;              my $domcoordoverride;
             foreach my $key ('editors','authorquota','webdav','webdav_LC_adv') {              foreach my $key ('editors','authorquota','webdav','webdav_LC_adv','archive') {
                 if (exists($changes{$key})) {                  if (exists($changes{$key})) {
                     my $shown;                      my $shown;
                     unless ($domcoordoverride) {                      unless ($domcoordoverride) {
Line 13576  sub modify_authordefaults { Line 13642  sub modify_authordefaults {
                         } else {                          } else {
                             $shown = $titles{'none'};                              $shown = $titles{'none'};
                         }                          }
                       } elsif ($key eq 'archive') {
                           $domdefaults{$key} = $confhash{$key};
                           $shown = ($confhash{$key} ? &mt('Yes') : &mt('No'));
                     }                      }
                     $resulttext .= '<li>'.&mt('[_1] set to: [_2]',$titles{$key},$shown).'</li>';                      $resulttext .= '<li>'.&mt('[_1] set to: [_2]',$titles{$key},$shown).'</li>';
                 }                                                 }
             }              }
             if ($domcoordoverride) {              if ($domcoordoverride) {
                 $resulttext .= '</ul></li>';                  $resulttext .= '</ul></li>';
             }              }
               $resulttext .= '</ul>';
             my $cachetime = 24*60*60;              my $cachetime = 24*60*60;
             &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);              &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
             if (ref($lastactref) eq 'HASH') {              if (ref($lastactref) eq 'HASH') {
Line 13651  sub modify_colors { Line 13721  sub modify_colors {
             @images = ('img','logo','domlogo','login');              @images = ('img','logo','domlogo','login');
             @bgs = ('pgbg','mainbg','sidebg');              @bgs = ('pgbg','mainbg','sidebg');
         } else {          } else {
             @images = ('img');              @images = ();
             @bgs = ('pgbg','tabbg','sidebg');              @bgs = ('pgbg','tabbg','sidebg');
         }          }
         my %defaults = &role_defaults($role,\@bgs,\@links,\@images,\@logintext);          my %defaults = &role_defaults($role,\@bgs,\@links,\@images,\@logintext);
         unless ($env{'form.'.$role.'_font'} eq $defaults{'font'}) {          $env{'form.'.$role.'_font'} = lc($env{'form.'.$role.'_font'});
           if ($env{'form.'.$role.'_font'} =~ /^\w+/) {
               $env{'form.'.$role.'_font'} = '#'.$env{'form.'.$role.'_font'};
           }
           unless ($env{'form.'.$role.'_font'} eq lc($defaults{'font'})) {
             $confhash->{$role}{'font'} = $env{'form.'.$role.'_font'};              $confhash->{$role}{'font'} = $env{'form.'.$role.'_font'};
         }          }
         if ($role eq 'login') {          if ($role eq 'login') {
Line 13673  sub modify_colors { Line 13747  sub modify_colors {
             if ($env{'form.'.$role.'_fontmenu'} =~ /^\w+/) {              if ($env{'form.'.$role.'_fontmenu'} =~ /^\w+/) {
                 $env{'form.'.$role.'_fontmenu'} = '#'.$env{'form.'.$role.'_fontmenu'};                  $env{'form.'.$role.'_fontmenu'} = '#'.$env{'form.'.$role.'_fontmenu'};
             }              }
             unless($env{'form.'.$role.'_fontmenu'} eq lc($defaults{'fontmenu'})) {              unless ($env{'form.'.$role.'_fontmenu'} eq lc($defaults{'fontmenu'})) {
                 $confhash->{$role}{'fontmenu'} = $env{'form.'.$role.'_fontmenu'};                  $confhash->{$role}{'fontmenu'} = $env{'form.'.$role.'_fontmenu'};
             }              }
         }          }
Line 14786  sub modify_quotas { Line 14860  sub modify_quotas {
                             $resulttext .= '<li>'.&mt('Validated course requests identified as processed by: [_1]',                              $resulttext .= '<li>'.&mt('Validated course requests identified as processed by: [_1]',
                                                      '<b>'.$changes{'validation'}{'dc'}.'</b>').'</li>';                                                       '<b>'.$changes{'validation'}{'dc'}.'</b>').'</li>';
                         }                          }
                           $resulttext .= '</ul></li>';
                     }                      }
                 }                  }
             }              }
Line 19816  sub modify_usermodification { Line 19891  sub modify_usermodification {
             }              }
         }          }
     }      }
     my @contexts = ('author','course');      my @contexts = ('author','coauthor','course');
     my %context_title = (      my %context_title = (
                            author => 'In author context',                             author => 'In author context',
                              coauthor => 'As co-author manager',
                            course => 'In course context',                             course => 'In course context',
                         );                          );
     my @fields = ('lastname','firstname','middlename','generation',      my @fields = ('lastname','firstname','middlename','generation',
                   'permanentemail','id');                    'permanentemail','id');
     my %roles = (      my %roles = (
                   author => ['ca','aa'],                    author => ['ca','aa'],
                     coauthor => ['ca','aa'],
                   course => ['st','ep','ta','in','cr'],                    course => ['st','ep','ta','in','cr'],
                 );                  );
     my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles();      my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles();
     foreach my $context (@contexts) {      foreach my $context (@contexts) {
           my $prefix = 'canmodify';
           if ($context eq 'coauthor') {
               $prefix = 'cacanmodify';
           }
         foreach my $role (@{$roles{$context}}) {          foreach my $role (@{$roles{$context}}) {
             my @modifiable =  &Apache::loncommon::get_env_multiple('form.canmodify_'.$role);              my @modifiable =  &Apache::loncommon::get_env_multiple('form.'.$prefix.'_'.$role);
             foreach my $item (@fields) {              foreach my $item (@fields) {
                 if (grep(/^\Q$item\E$/,@modifiable)) {                  if (grep(/^\Q$item\E$/,@modifiable)) {
                     $modifyhash{$context}{$role}{$item} = 1;                      $modifyhash{$context}{$role}{$item} = 1;
Line 21210  sub modify_coursedefaults { Line 21291  sub modify_coursedefaults {
                            mysqltables          => 172800,                             mysqltables          => 172800,
                            domexttool           => 1,                             domexttool           => 1,
                            crsauthor            => 1,                             crsauthor            => 1,
                              crseditors           => ['edit','xml'],
                          );                           );
     my %texoptions = (      my %texoptions = (
                         MathJax  => 'MathJax',                          MathJax  => 'MathJax',
                         mimetex  => &mt('Convert to Images'),                          mimetex  => &mt('Convert to Images'),
                         tth      => &mt('TeX to HTML'),                          tth      => &mt('TeX to HTML'),
                      );                       );
   
       my @editors = ('edit','xml','daxe');
       my %editornames = &crseditor_titles();
   
     $defaultshash{'coursedefaults'} = {};      $defaultshash{'coursedefaults'} = {};
   
     if (ref($domconfig{'coursedefaults'}) ne 'HASH') {      if (ref($domconfig{'coursedefaults'}) ne 'HASH') {
Line 21401  sub modify_coursedefaults { Line 21487  sub modify_coursedefaults {
                 $changes{'postsubmit'} = 1;                  $changes{'postsubmit'} = 1;
             }              }
         }          }
         my (%newdomexttool,%newexttool,%newcrsauthor,%olddomexttool,%oldexttool,%oldcrsauthor);          my (%newdomexttool,%newexttool,%newcrsauthor,%olddomexttool,%oldexttool,%oldcrsauthor,
               %posscrseditors);
         map { $newdomexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.domexttool');          map { $newdomexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.domexttool');
         map { $newexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.exttool');          map { $newexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.exttool');
         map { $newcrsauthor{$_} = 1; } &Apache::loncommon::get_env_multiple('form.crsauthor');          map { $newcrsauthor{$_} = 1; } &Apache::loncommon::get_env_multiple('form.crsauthor');
           map { $posscrseditors{$_} = 1; } &Apache::loncommon::get_env_multiple('form.crseditors');
         if (ref($domconfig{'coursedefaults'}{'domexttool'}) eq 'HASH') {          if (ref($domconfig{'coursedefaults'}{'domexttool'}) eq 'HASH') {
             %olddomexttool = %{$domconfig{'coursedefaults'}{'domexttool'}};              %olddomexttool = %{$domconfig{'coursedefaults'}{'domexttool'}};
         } else {          } else {
Line 21438  sub modify_coursedefaults { Line 21526  sub modify_coursedefaults {
                }                 }
             }              }
         }          }
           my @newcrseditors = ();
           foreach my $editor (@editors) {
               if ($posscrseditors{$editor}) {
                   push(@newcrseditors,$editor);
               }
           }
           if (ref($domconfig{'coursedefaults'}{'crseditors'}) eq 'ARRAY') {
               my @diffs =
                   &Apache::loncommon::compare_arrays($domconfig{'coursedefaults'}{'crseditors'},
                                                      \@newcrseditors);
               if (@diffs) {
                   $changes{'crseditors'} = 1; 
               }
           } else {
               my @diffs =
                   &Apache::loncommon::compare_arrays($staticdefaults{'crseditors'},
                                                      \@newcrseditors);
               unless (@diffs == 0) {
                   $changes{'crseditors'} = 1;
               }       
           }
         foreach my $type (@types) {          foreach my $type (@types) {
             unless ($newdomexttool{$type}) {              unless ($newdomexttool{$type}) {
                 $newdomexttool{$type} = 0;                  $newdomexttool{$type} = 0;
Line 21461  sub modify_coursedefaults { Line 21570  sub modify_coursedefaults {
         $defaultshash{'coursedefaults'}{'domexttool'} = \%newdomexttool;          $defaultshash{'coursedefaults'}{'domexttool'} = \%newdomexttool;
         $defaultshash{'coursedefaults'}{'exttool'} = \%newexttool;          $defaultshash{'coursedefaults'}{'exttool'} = \%newexttool;
         $defaultshash{'coursedefaults'}{'crsauthor'} = \%newcrsauthor;          $defaultshash{'coursedefaults'}{'crsauthor'} = \%newcrsauthor;
           $defaultshash{'coursedefaults'}{'crseditors'} = \@newcrseditors;
     }      }
     my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,      my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,
                                              $dom);                                               $dom);
Line 21544  sub modify_coursedefaults { Line 21654  sub modify_coursedefaults {
                         }                          }
                     }                      }
                 }                  }
                   if ($changes{'crseditors'}) {
                       if (ref($defaultshash{'coursedefaults'}{'crseditors'}) eq 'ARRAY') {
                           $domdefaults{'crseditors'}=join(',',@{$defaultshash{'coursedefaults'}{'crseditors'}});
                       }
                   }
                 my $cachetime = 24*60*60;                  my $cachetime = 24*60*60;
                 &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);                  &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
                 if (ref($lastactref) eq 'HASH') {                  if (ref($lastactref) eq 'HASH') {
Line 21723  sub modify_coursedefaults { Line 21838  sub modify_coursedefaults {
                     } else {                      } else {
                         $resulttext .= '<li>'.$status{$item}{'default'}.'</li>';                          $resulttext .= '<li>'.$status{$item}{'default'}.'</li>';
                     }                      }
                   } elsif ($item eq 'crseditors') {
                       if (ref($defaultshash{'coursedefaults'}{$item}) eq 'ARRAY') {
                           my $shown;
                           if (@{$defaultshash{'coursedefaults'}{$item}}) {
                               $shown = join(', ', map { $editornames{$_} } @{$defaultshash{'coursedefaults'}{$item}});
                           } else {
                               $shown = &mt('None');
                           }
                           $resulttext .= '<li>'.&mt('Available editors for course/community resources: [_1]',$shown).'</li>';
                       }
                 }                  }
             }              }
             $resulttext .= '</ul>';              $resulttext .= '</ul>';

Removed from v.1.435  
changed lines
  Added in v.1.448


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>