Diff for /loncom/interface/domainprefs.pm between versions 1.160.6.46 and 1.160.6.50

version 1.160.6.46, 2014/05/09 15:23:28 version 1.160.6.50, 2014/05/31 04:32:12
Line 412  sub handler { Line 412  sub handler {
         'coursedefaults' =>           'coursedefaults' => 
                  {text => 'Course/Community defaults',                   {text => 'Course/Community defaults',
                   help => 'Domain_Configuration_Course_Defaults',                    help => 'Domain_Configuration_Course_Defaults',
                   header => [{col1 => 'Defaults which can be overridden in each course by a CC',                    header => [{col1 => 'Defaults which can be overridden for each course by a DC',
                               col2 => 'Value',},  
                              {col1 => 'Defaults which can be overridden for each course by a DC',  
                               col2 => 'Value',},],                                col2 => 'Value',},],
                   print => \&print_coursedefaults,                    print => \&print_coursedefaults,
                   modify => \&modify_coursedefaults,                    modify => \&modify_coursedefaults,
Line 723  sub print_config_box { Line 721  sub print_config_box {
                 $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);                  $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
             }              }
             $rowtotal ++;              $rowtotal ++;
         } elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||          } elsif (($action eq 'usermodification') || ($action eq 'defaults')) {
                   ($action eq 'defaults')) {  
             $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);              $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
         } elsif ($action eq 'login') {          } elsif ($action eq 'login') {
             if ($numheaders == 3) {              if ($numheaders == 3) {
Line 744  sub print_config_box { Line 741  sub print_config_box {
                 $output .= &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal);                  $output .= &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal);
             }              }
         } elsif ($action eq 'requestcourses') {          } elsif ($action eq 'requestcourses') {
             $output .= &print_requestmail($dom,$action,$settings,\$rowtotal).              $output .= &print_requestmail($dom,$action,$settings,\$rowtotal);
                        &print_studentcode($settings,\$rowtotal).'              $rowtotal ++;
               $output .= &print_studentcode($settings,\$rowtotal).'
            </table>             </table>
           </td>            </td>
          </tr>           </tr>
Line 780  sub print_config_box { Line 778  sub print_config_box {
             &print_validation_rows('requestcourses',$dom,$settings,\$rowtotal);              &print_validation_rows('requestcourses',$dom,$settings,\$rowtotal);
         } elsif ($action eq 'requestauthor') {          } elsif ($action eq 'requestauthor') {
             $output .= &print_requestmail($dom,$action,$settings,\$rowtotal);              $output .= &print_requestmail($dom,$action,$settings,\$rowtotal);
               $rowtotal ++;
         } elsif ($action eq 'rolecolors') {          } elsif ($action eq 'rolecolors') {
             $output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).'              $output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).'
            </table>             </table>
Line 865  sub print_config_box { Line 864  sub print_config_box {
             $output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);              $output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);
         } elsif ($action eq 'helpsettings') {          } elsif ($action eq 'helpsettings') {
             $output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal);              $output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal);
           } elsif ($action eq 'coursedefaults') {
               $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
         }          }
     }      }
     $output .= '      $output .= '
Line 2056  sub print_requestmail { Line 2057  sub print_requestmail {
         $datatable .= &mt('There are no active Domain Coordinators');          $datatable .= &mt('There are no active Domain Coordinators');
     }      }
     $datatable .='</td></tr>';      $datatable .='</td></tr>';
     $$rowtotal += $rows;  
     return $datatable;      return $datatable;
 }  }
   
Line 2117  sub print_textbookcourses { Line 2117  sub print_textbookcourses {
             my $key = $ordered{$items[$i]};              my $key = $ordered{$items[$i]};
             my %coursehash=&Apache::lonnet::coursedescription($key);              my %coursehash=&Apache::lonnet::coursedescription($key);
             my $coursetitle = $coursehash{'description'};              my $coursetitle = $coursehash{'description'};
             my ($subject,$title,$author,$image,$imgsrc,$cdom,$cnum);              my ($subject,$title,$author,$publisher,$image,$imgsrc,$cdom,$cnum);
             if (ref($bookshash->{$key}) eq 'HASH') {              if (ref($bookshash->{$key}) eq 'HASH') {
                 $subject = $bookshash->{$key}->{'subject'};                  $subject = $bookshash->{$key}->{'subject'};
                 $title = $bookshash->{$key}->{'title'};                  $title = $bookshash->{$key}->{'title'};
                 if ($type eq 'textbooks') {                  if ($type eq 'textbooks') {
                       $publisher = $bookshash->{$key}->{'publisher'};
                     $author = $bookshash->{$key}->{'author'};                      $author = $bookshash->{$key}->{'author'};
                     $image = $bookshash->{$key}->{'image'};                      $image = $bookshash->{$key}->{'image'};
                     if ($image ne '') {                      if ($image ne '') {
Line 2151  sub print_textbookcourses { Line 2152  sub print_textbookcourses {
                 '<span class="LC_nobreak">'.&mt('Title:').'<input type="text" size="30" name="'.$type.'_title_'.$i.'" value="'.$title.'" /></span> ';                  '<span class="LC_nobreak">'.&mt('Title:').'<input type="text" size="30" name="'.$type.'_title_'.$i.'" value="'.$title.'" /></span> ';
             if ($type eq 'textbooks') {              if ($type eq 'textbooks') {
                 $datatable .= ('&nbsp;'x2).                  $datatable .= ('&nbsp;'x2).
                                 '<span class="LC_nobreak">'.&mt('Publisher:').'<input type="text" size="10" name="'.$type.'_publisher_'.$i.'" value="'.$publisher.'" /></span> '.
                                 ('&nbsp;'x2).
                               '<span class="LC_nobreak">'.&mt('Author(s):').'<input type="text" size="25" name="'.$type.'_author_'.$i.'" value="'.$author.'" /></span> '.                                '<span class="LC_nobreak">'.&mt('Author(s):').'<input type="text" size="25" name="'.$type.'_author_'.$i.'" value="'.$author.'" /></span> '.
                               ('&nbsp;'x2).                                ('&nbsp;'x2).
                               '<span class="LC_nobreak">'.&mt('Thumbnail:');                                '<span class="LC_nobreak">'.&mt('Thumbnail:');
Line 2194  sub print_textbookcourses { Line 2197  sub print_textbookcourses {
                   '<span class="LC_nobreak">'.&mt('Title:').'<input type="text" size="30" name="'.$type.'_addbook_title" value="" /></span> '."\n".                    '<span class="LC_nobreak">'.&mt('Title:').'<input type="text" size="30" name="'.$type.'_addbook_title" value="" /></span> '."\n".
                   ('&nbsp;'x2);                    ('&nbsp;'x2);
     if ($type eq 'textbooks') {      if ($type eq 'textbooks') {
         $datatable .= '<span class="LC_nobreak">'.&mt('Author(s):').'<input type="text" size="25" name="'.$type.'_addbook_author" value="" /></span> '."\n".          $datatable .= '<span class="LC_nobreak">'.&mt('Publisher:').'<input type="text" size="10" name="'.$type.'_addbook_publisher" value="" /></span> '."\n".
                         ('&nbsp;'x2).
                         '<span class="LC_nobreak">'.&mt('Author(s):').'<input type="text" size="25" name="'.$type.'_addbook_author" value="" /></span> '."\n".
                       ('&nbsp;'x2).                        ('&nbsp;'x2).
                       '<span class="LC_nobreak">'.&mt('Image:').'&nbsp;';                        '<span class="LC_nobreak">'.&mt('Image:').'&nbsp;';
         if ($switchserver) {          if ($switchserver) {
Line 2496  sub print_autocreate { Line 2501  sub print_autocreate {
                   $createoff{'req'}.' value="0" />'.&mt('No').'</label></span>';                    $createoff{'req'}.' value="0" />'.&mt('No').'</label></span>';
     my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio',      my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio',
                                                    'autocreate_xmldc',%currhash);                                                     'autocreate_xmldc',%currhash);
       $datatable .= '</td></tr><tr class="LC_odd_row"><td>';
     if ($numdc > 1) {      if ($numdc > 1) {
         $datatable .= '</td></tr><tr class="LC_odd_row"><td>'.          $datatable .= &mt('Course creation processed as: (choose Dom. Coord.)').
                       &mt('Course creation processed as: (choose Dom. Coord.)').                        '</td><td class="LC_left_item">';
                       '</td><td class="LC_left_item">'.$dctable.'</td></tr>';  
     } else {      } else {
         $datatable .= $dctable.'</td></tr>';          $datatable .= &mt('Course creation processed as:').
                         '</td><td class="LC_right_item">';
     }      }
       $datatable .= $dctable.'</td></tr>';
     $$rowtotal += $rows;      $$rowtotal += $rows;
     return $datatable;      return $datatable;
 }  }
Line 3102  sub print_validation_rows { Line 3109  sub print_validation_rows {
         my $numinrow = 2;          my $numinrow = 2;
         my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio',          my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio',
                                                        'validationdc',%currhash);                                                         'validationdc',%currhash);
           my $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
           $datatable .= '</td></tr><tr'.$css_class.'><td>';
         if ($numdc > 1) {          if ($numdc > 1) {
             $datatable .= '</td></tr><tr class="LC_odd_row"><td>'.              $datatable .= &mt('Course creation processed as: (choose Dom. Coord.)');
                           &mt('Course creation processed as: (choose Dom. Coord.)').  
                           '</td><td class="LC_left_item">'.$dctable.'</td></tr>';  
         } else {          } else {
             $datatable .= $dctable.'</td></tr>';              $datatable .=  &mt('Course creation processed as: ');
         }          }
           $datatable .= '</td><td class="LC_left_item">'.$dctable.'</td></tr>';
         $itemcount ++;          $itemcount ++;
     }      }
     if (ref($rowtotal)) {      if (ref($rowtotal)) {
Line 6950  sub modify_quotas { Line 6958  sub modify_quotas {
                                 } else {                                  } else {
                                     my $newpos = $env{'form.'.$itemid};                                      my $newpos = $env{'form.'.$itemid};
                                     $newpos =~ s/\D+//g;                                      $newpos =~ s/\D+//g;
                                     foreach my $item ('subject','title','author') {                                      foreach my $item ('subject','title','publisher','author') {
                                         next if (($item eq 'author') && ($type eq 'templates'));                                          next if ((($item eq 'author') || ($item eq 'publisher')) &&
                                                    ($type eq 'templates'));
                                         $confhash{$type}{$key}{$item} = $env{'form.'.$type.'_'.$item.'_'.$i};                                          $confhash{$type}{$key}{$item} = $env{'form.'.$type.'_'.$item.'_'.$i};
                                         if ($domconfig{$action}{$type}{$key}{$item} ne $confhash{$type}{$key}{$item}) {                                          if ($domconfig{$action}{$type}{$key}{$item} ne $confhash{$type}{$key}{$item}) {
                                             $changes{$type}{$key} = 1;                                              $changes{$type}{$key} = 1;
Line 6996  sub modify_quotas { Line 7005  sub modify_quotas {
             foreach my $type ('textbooks','templates') {              foreach my $type ('textbooks','templates') {
                 if ($newbook{$type}) {                  if ($newbook{$type}) {
                     $changes{$type}{$newbook{$type}} = 1;                      $changes{$type}{$newbook{$type}} = 1;
                     foreach my $item ('subject','title','author') {                      foreach my $item ('subject','title','publisher','author') {
                         next if (($item eq 'author') && ($type eq 'template'));                          next if ((($item eq 'author') || ($item eq 'publisher')) &&
                                    ($type eq 'template'));
                         $env{'form.'.$type.'_addbook_'.$item} =~ s/(`)/'/g;                          $env{'form.'.$type.'_addbook_'.$item} =~ s/(`)/'/g;
                         if ($env{'form.'.$type.'_addbook_'.$item}) {                          if ($env{'form.'.$type.'_addbook_'.$item}) {
                             $confhash{$type}{$newbook{$type}}{$item} = $env{'form.'.$type.'_addbook_'.$item};                              $confhash{$type}{$newbook{$type}}{$item} = $env{'form.'.$type.'_addbook_'.$item};
Line 7411  sub modify_quotas { Line 7421  sub modify_quotas {
                             my $coursetitle = $coursehash{'description'};                              my $coursetitle = $coursehash{'description'};
                             my $position = $confhash{$type}{$key}{'order'} + 1;                              my $position = $confhash{$type}{$key}{'order'} + 1;
                             $resulttext .= '<li>';                              $resulttext .= '<li>';
                             foreach my $item ('subject','title','author') {                              foreach my $item ('subject','title','publisher','author') {
                                 next if (($item eq 'author') && ($type eq 'templates'));                                  next if ((($item eq 'author') || ($item eq 'publisher')) &&
                                            ($type eq 'templates'));
                                 my $name = $item.':';                                  my $name = $item.':';
                                 $name =~ s/^(\w)/\U$1/;                                  $name =~ s/^(\w)/\U$1/;
                                 $resulttext .= &mt($name).' '.$confhash{$type}{$key}{$item}.'<br />';                                  $resulttext .= &mt($name).' '.$confhash{$type}{$key}{$item}.'<br />';
Line 8504  sub modify_selfcreation { Line 8515  sub modify_selfcreation {
 # value set to one), if self-creation with e-mail address permitted, where $type is user type: faculty, staff, student etc.  # value set to one), if self-creation with e-mail address permitted, where $type is user type: faculty, staff, student etc.
 #  #
   
     if ($env{'form.cancreate_email'} eq 'email') {      if ($env{'form.cancreate_email'}) {
         push(@contexts,'emailusername');          push(@contexts,'emailusername');
         if (ref($types) eq 'ARRAY') {          if (ref($types) eq 'ARRAY') {
             foreach my $type (@{$types}) {              foreach my $type (@{$types}) {
Line 8922  sub modify_selfcreation { Line 8933  sub modify_selfcreation {
                                 foreach my $type (@{$types}) {                                  foreach my $type (@{$types}) {
                                     if (ref($cancreate{'emailusername'}{$type}) eq 'HASH') {                                      if (ref($cancreate{'emailusername'}{$type}) eq 'HASH') {
                                         if (keys(%{$cancreate{'emailusername'}{$type}}) > 0) {                                          if (keys(%{$cancreate{'emailusername'}{$type}}) > 0) {
                                             $chgtext .= &mt('When self-creating account with e-mail as username, the following information will be provided by [_1]:',$usertypes->{$type}).                                              $chgtext .= &mt('When self-creating account with e-mail as username, the following information will be provided by [_1]:',"'$usertypes->{$type}'").
                                                     '<ul>';                                                      '<ul>';
                                             foreach my $field (@{$infofields}) {                                              foreach my $field (@{$infofields}) {
                                                 if ($cancreate{'emailusername'}{$type}{$field}) {                                                  if ($cancreate{'emailusername'}{$type}{$field}) {
                                                     $chgtext .= '<li>'.$infotitles->{$field}.'</li>';                                                      $chgtext .= '<li>'.$infotitles->{$field}.'</li>';
                                                 }                                                  }
                                             }                                              }
                                               $chgtext .= '</ul>';
                                           } else {
                                               $chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',"'$usertypes->{$type}'").'<br />';
                                         }                                          }
                                         $chgtext .= '</ul>';  
                                     } else {                                      } else {
                                         $chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',$usertypes->{$type}).'<br />';                                          $chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',"'$usertypes->{$type}'").'<br />';
                                     }                                      }
                                 }                                  }
                             }                              }
Line 9739  sub modify_coursecategories { Line 9752  sub modify_coursecategories {
             }              }
             $resulttext .= '</ul>';              $resulttext .= '</ul>';
             if ($changes{'unauth'} || $changes{'auth'}) {              if ($changes{'unauth'} || $changes{'auth'}) {
                 &Apache::loncommon::devalidate_domconfig_cache($dom);                  my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
                   if ($changes{'auth'}) {
                       $domdefaults{'catauth'} = $domconfig{'coursecategories'}{'auth'};
                   }
                   if ($changes{'unauth'}) {
                       $domdefaults{'catunauth'} = $domconfig{'coursecategories'}{'unauth'};
                   }
                   my $cachetime = 24*60*60;
                   &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
                 if (ref($lastactref) eq 'HASH') {                  if (ref($lastactref) eq 'HASH') {
                     $lastactref->{'domainconfig'} = 1;                      $lastactref->{'domdefaults'} = 1;
                 }                  }
             }              }
         } else {          } else {
Line 10949  sub active_dc_picker { Line 10970  sub active_dc_picker {
         my ($dcname,$dcdom) = split(':',$domcoord[0]);          my ($dcname,$dcdom) = split(':',$domcoord[0]);
         my $user = &Apache::loncommon::plainname($dcname,$dcdom);          my $user = &Apache::loncommon::plainname($dcname,$dcdom);
         if ($inputtype eq 'radio') {          if ($inputtype eq 'radio') {
             $table .= '<input type="hidden" name="'.$name.'" value="'.$domcoord[0].'" />'.$user;              $table = '<input type="hidden" name="'.$name.'" value="'.$domcoord[0].'" />'.$user;
             if ($user ne $dcname.':'.$dcdom) {              if ($user ne $dcname.':'.$dcdom) {
                 $table .=  ' ('.$dcname.':'.$dcdom.')';                  $table .=  ' ('.$dcname.':'.$dcdom.')';
             }              }
Line 10958  sub active_dc_picker { Line 10979  sub active_dc_picker {
             if (exists($currhash{$domcoord[0]})) {              if (exists($currhash{$domcoord[0]})) {
                 $check = ' checked="checked"';                  $check = ' checked="checked"';
             }              }
             $table .= '<span class="LC_nobreak"><label>'.              $table = '<span class="LC_nobreak"><label>'.
                       '<input type="checkbox" name="'.$name.'" '.                       '<input type="checkbox" name="'.$name.'" '.
                       'value="'.$domcoord[0].'"'.$check.' />'.$user;                       'value="'.$domcoord[0].'"'.$check.' />'.$user;
             if ($user ne $dcname.':'.$dcdom) {              if ($user ne $dcname.':'.$dcdom) {
                 $table .=  ' ('.$dcname.':'.$dcdom.')';                  $table .=  ' ('.$dcname.':'.$dcdom.')';
             }              }

Removed from v.1.160.6.46  
changed lines
  Added in v.1.160.6.50


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