Diff for /loncom/interface/domainprefs.pm between versions 1.237 and 1.238

version 1.237, 2014/04/25 17:56:43 version 1.238, 2014/04/28 01:48:04
Line 387  sub handler { Line 387  sub handler {
         'coursecategories' =>          'coursecategories' =>
                   { text => 'Cataloging of courses/communities',                    { text => 'Cataloging of courses/communities',
                     help => 'Domain_Configuration_Cataloging_Courses',                      help => 'Domain_Configuration_Cataloging_Courses',
                     header => [{col1 => 'Category settings',                      header => [{col1 => 'Catalog type/availability',
                                   col2 => '',},
                                  {col1 => 'Category settings for standard catalog',
                                 col2 => '',},                                  col2 => '',},
                                {col1 => 'Categories',                                 {col1 => 'Categories',
                                 col2 => '',                                  col2 => '',
Line 665  sub print_config_box { Line 667  sub print_config_box {
     if ($numheaders > 1) {      if ($numheaders > 1) {
         my $colspan = '';          my $colspan = '';
         my $rightcolspan = '';          my $rightcolspan = '';
         if (($action eq 'rolecolors') || ($action eq 'coursecategories') || ($action eq 'defaults') ||          if (($action eq 'rolecolors') || ($action eq 'defaults') ||
             (($action eq 'login') && ($numheaders < 3))) {              (($action eq 'login') && ($numheaders < 3))) {
             $colspan = ' colspan="2"';              $colspan = ' colspan="2"';
         }          }
Line 713  sub print_config_box { Line 715  sub print_config_box {
             $rowtotal ++;              $rowtotal ++;
         if (($action eq 'autoupdate') || ($action eq 'usercreation') ||          if (($action eq 'autoupdate') || ($action eq 'usercreation') ||
             ($action eq 'selfcreation') || ($action eq 'selfenrollment') ||              ($action eq 'selfcreation') || ($action eq 'selfenrollment') ||
             ($action eq 'usersessions')) {              ($action eq 'usersessions') || ($action eq 'coursecategories')) {
             $output .= $item->{'print'}->('middle',$dom,$settings,\$rowtotal).'              if ($action eq 'coursecategories') {
                   $output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal);
                   $colspan = ' colspan="2"';
               } else {
                   $output .= $item->{'print'}->('middle',$dom,$settings,\$rowtotal);
               }
               $output .= '
            </table>             </table>
           </td>            </td>
          </tr>           </tr>
Line 724  sub print_config_box { Line 732  sub print_config_box {
              <tr class="LC_info_row">               <tr class="LC_info_row">
               <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td>                <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td>
               <td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td>                <td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td>
              </tr>'."\n".               </tr>'."\n";
             $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);              if ($action eq 'coursecategories') {
                   $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
               } else {
                   $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
               }
             $rowtotal ++;              $rowtotal ++;
         } elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||          } elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||
                   ($action eq 'defaults')) {                    ($action eq 'defaults')) {
             $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);              $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
         } elsif ($action eq 'coursecategories') {  
             $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);  
         } elsif ($action eq 'login') {          } elsif ($action eq 'login') {
             if ($numheaders == 3) {              if ($numheaders == 3) {
                 $output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'                  $output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'
Line 4746  sub print_coursecategories { Line 4756  sub print_coursecategories {
     my ($position,$dom,$hdritem,$settings,$rowtotal) = @_;      my ($position,$dom,$hdritem,$settings,$rowtotal) = @_;
     my $datatable;      my $datatable;
     if ($position eq 'top') {      if ($position eq 'top') {
           my (%checked);
           my @catitems = ('unauth','auth');
           my @cattypes = ('std','domonly','codesrch','none');
           $checked{'unauth'} = 'std';
           $checked{'auth'} = 'std';
           if (ref($settings) eq 'HASH') {
               foreach my $type (@cattypes) {
                   if ($type eq $settings->{'unauth'}) {
                       $checked{'unauth'} = $type;
                   }
                   if ($type eq $settings->{'auth'}) {
                       $checked{'auth'} = $type;
                   }
               }
           }
           my %lt = &Apache::lonlocal::texthash (
                                                  unauth   => 'Catalog type for unauthenticated users',
                                                  auth     => 'Catalog type for authenticated users',
                                                  none     => 'No catalog',
                                                  std      => 'Standard catalog',
                                                  domonly  => 'Domain-only catalog',
                                                  codesrch => "Code search form",
                                                );
          my $itemcount = 0;
          foreach my $item (@catitems) {
              my $css_class = $itemcount%2? ' class="LC_odd_row"':'';
              $datatable .= '<tr '.$css_class.'>'.
                            '<td>'.$lt{$item}.'</td>'.
                            '<td class="LC_right_item"><span class="LC_nobreak">';
              foreach my $type (@cattypes) {
                  my $ischecked;
                  if ($checked{$item} eq $type) {
                      $ischecked=' checked="checked"';
                  }
                  $datatable .= '<label>'.
                                '<input type="radio" name="coursecat_'.$item.'" value="'.$type.'"'.$ischecked.
                                ' />'.$lt{$type}.'</label>&nbsp;';
              }
              $datatable .= '</td></tr>';
              $itemcount ++;
           }
           $$rowtotal += $itemcount;
       } elsif ($position eq 'middle') {
         my $toggle_cats_crs = ' ';          my $toggle_cats_crs = ' ';
         my $toggle_cats_dom = ' checked="checked" ';          my $toggle_cats_dom = ' checked="checked" ';
         my $can_cat_crs = ' ';          my $can_cat_crs = ' ';
Line 4952  sub print_coursecategories { Line 5005  sub print_coursecategories {
                 $datatable .= &initialize_categories($itemcount);                  $datatable .= &initialize_categories($itemcount);
             }              }
         } else {          } else {
             $datatable .= '<td class="LC_right_item">'.$hdritem->{'header'}->[0]->{'col2'}.'</td>'              $datatable .= '<td class="LC_right_item">'.$hdritem->{'header'}->[1]->{'col2'}.'</td>'
                           .&initialize_categories($itemcount);                            .&initialize_categories($itemcount);
         }          }
         $$rowtotal += $itemcount;          $$rowtotal += $itemcount;
Line 9315  sub modify_coursecategories { Line 9368  sub modify_coursecategories {
     my ($resulttext,%deletions,%reorderings,%needreordering,%adds,%changes,$errors,      my ($resulttext,%deletions,%reorderings,%needreordering,%adds,%changes,$errors,
         $cathash);          $cathash);
     my @deletecategory = &Apache::loncommon::get_env_multiple('form.deletecategory');      my @deletecategory = &Apache::loncommon::get_env_multiple('form.deletecategory');
       my @catitems = ('unauth','auth');
       my @cattypes = ('std','domonly','codesrch','none');
     if (ref($domconfig{'coursecategories'}) eq 'HASH') {      if (ref($domconfig{'coursecategories'}) eq 'HASH') {
         $cathash = $domconfig{'coursecategories'}{'cats'};          $cathash = $domconfig{'coursecategories'}{'cats'};
         if ($domconfig{'coursecategories'}{'togglecats'} ne $env{'form.togglecats'}) {          if ($domconfig{'coursecategories'}{'togglecats'} ne $env{'form.togglecats'}) {
Line 9333  sub modify_coursecategories { Line 9388  sub modify_coursecategories {
             $changes{'categorizecomm'} = 1;              $changes{'categorizecomm'} = 1;
             $domconfig{'coursecategories'}{'categorizecomm'} = $env{'form.categorizecomm'};              $domconfig{'coursecategories'}{'categorizecomm'} = $env{'form.categorizecomm'};
         }          }
           foreach my $item (@catitems) {
               if (grep(/^\Q$env{'form.coursecat_'.$item}\E$/,@cattypes)) {
                   if ($domconfig{'coursecategories'}{$item} ne $env{'form.coursecat_'.$item}) {
                       $changes{$item} = 1;
                       $domconfig{'coursecategories'}{$item} = $env{'form.coursecat_'.$item};
                   }
               }
           }
     } else {      } else {
         $changes{'togglecats'} = 1;          $changes{'togglecats'} = 1;
         $changes{'categorize'} = 1;          $changes{'categorize'} = 1;
Line 9344  sub modify_coursecategories { Line 9407  sub modify_coursecategories {
                                              togglecatscomm => $env{'form.togglecatscomm'},                                               togglecatscomm => $env{'form.togglecatscomm'},
                                              categorizecomm => $env{'form.categorizecomm'},                                               categorizecomm => $env{'form.categorizecomm'},
                                          };                                           };
           foreach my $item (@catitems) {
               if ($env{'form.coursecat_'.$item} ne 'std') {
                   $changes{$item} = 1;
               }
               if (grep(/^\Q$env{'form.coursecat_'.$item}\E$/,@cattypes)) {
                   $domconfig{'coursecategories'}{$item} = $env{'form.coursecat_'.$item};
               }
           }
     }      }
     if (ref($cathash) eq 'HASH') {      if (ref($cathash) eq 'HASH') {
         if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '')  && ($env{'form.instcode'} == 0)) {          if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '')  && ($env{'form.instcode'} == 0)) {
Line 9466  sub modify_coursecategories { Line 9537  sub modify_coursecategories {
                          dom  => 'set in Domain ("Modify Course/Community")',                           dom  => 'set in Domain ("Modify Course/Community")',
                          crs  => 'set in Course ("Course Configuration")',                           crs  => 'set in Course ("Course Configuration")',
                          comm => 'set in Community ("Community Configuration")',                           comm => 'set in Community ("Community Configuration")',
                            none     => 'No catalog',
                            std      => 'Standard catalog',
                            domonly  => 'Domain-only catalog',
                            codesrch => 'Code search form',
                         );                          );
             $resulttext = &mt('Changes made:').'<ul>';              $resulttext = &mt('Changes made:').'<ul>';
             if ($changes{'togglecats'}) {              if ($changes{'togglecats'}) {
Line 9480  sub modify_coursecategories { Line 9555  sub modify_coursecategories {
             if ($changes{'categorizecomm'}) {              if ($changes{'categorizecomm'}) {
                 $resulttext .= '<li>'.&mt("$title{'categorizecomm'} $level{$env{'form.categorizecomm'}}").'</li>';                  $resulttext .= '<li>'.&mt("$title{'categorizecomm'} $level{$env{'form.categorizecomm'}}").'</li>';
             }              }
               if ($changes{'unauth'}) {
                   $resulttext .= '<li>'.&mt('Catalog type for unauthenticated users set to "'.$level{$env{'form.coursecat_unauth'}}.'"').'</li>';
               }
               if ($changes{'auth'}) {
                   $resulttext .= '<li>'.&mt('Catalog type for authenticated users set to "'.$level{$env{'form.coursecat_auth'}}.'"').'</li>';
               }
             if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) {              if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) {
                 my $cathash;                  my $cathash;
                 if (ref($domconfig{'coursecategories'}) eq 'HASH') {                  if (ref($domconfig{'coursecategories'}) eq 'HASH') {

Removed from v.1.237  
changed lines
  Added in v.1.238


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