[LON-CAPA-cvs] cvs: loncom /interface coursecatalog.pm domainprefs.pm

raeburn raeburn at source.lon-capa.org
Sun Apr 27 21:48:04 EDT 2014


raeburn		Mon Apr 28 01:48:04 2014 EDT

  Modified files:              
    /loncom/interface	coursecatalog.pm domainprefs.pm 
  Log:
  - Domain configuration to determine course catalog style
    - Type of catalog can be different for authenticated and unauthenticated
      contexts.
    - Options are: No catalog, Look-up of six character code, Standard catalog
                   (with/without domain selector to switch to different domain 
                   in cluster).
    - Default is standard course catalog with domain domain selector.
  
  
-------------- next part --------------
Index: loncom/interface/coursecatalog.pm
diff -u loncom/interface/coursecatalog.pm:1.81 loncom/interface/coursecatalog.pm:1.82
--- loncom/interface/coursecatalog.pm:1.81	Tue Mar 18 02:03:16 2014
+++ loncom/interface/coursecatalog.pm	Mon Apr 28 01:48:04 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler for displaying the course catalog interface
 #
-# $Id: coursecatalog.pm,v 1.81 2014/03/18 02:03:16 raeburn Exp $
+# $Id: coursecatalog.pm,v 1.82 2014/04/28 01:48:04 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -76,26 +76,149 @@
     my $domdesc = &Apache::lonnet::domain($codedom,'description');
     &Apache::lonhtmlcommon::clear_breadcrumbs();
 
-    if ($env{'form.catalog_maxdepth'} ne '') {
-        $env{'form.catalog_maxdepth'} =~ s{\D}{}g;
-    }
-
     my %domconfig =
         &Apache::lonnet::get_dom('configuration',['coursecategories'],$codedom);
-    my (@cats, at trails,%allitems,%idx, at jsarray,%subcathash,$cathash);
+    my $knownuser = &user_is_known();
+
+    my ($cathash,$cattype);
     if (ref($domconfig{'coursecategories'}) eq 'HASH') {
         $cathash = $domconfig{'coursecategories'}{'cats'};
+        if ($knownuser) {
+            $cattype = $domconfig{'coursecategories'}{'auth'};
+        } else {
+            $cattype = $domconfig{'coursecategories'}{'unauth'};
+        }
     } else {
         $cathash = {};
+        $cattype eq 'std';
+    }
+    if ($cattype eq 'none') {
+        $r->print(&Apache::loncommon::start_page('Course/Community Catalog'));
+        &Apache::lonhtmlcommon::add_breadcrumb
+        ({href=>"/adm/coursecatalog",
+          text=>"Course/Community Catalog"});
+        $r->print(&Apache::lonhtmlcommon::breadcrumbs('Course/Community Catalog'));
+        if ($knownuser) {
+            $r->print('<div>'.&mt('No catalog of LON-CAPA courses/communities is provided for: [_1]',$domdesc).'</div>');
+        } else {
+            if ($domconfig{'coursecategories'}{'auth'} eq 'none') {
+                $r->print('<div>'.&mt('No catalog of LON-CAPA courses/communities is provided for: [_1]',$domdesc).'</div>');
+            } else {
+                $r->print('<div>'.&mt('The catalog of LON-CAPA courses/communities provided for: "[_1]" is only available to users who are logged in.',$domdesc).'</div>');
+            }
+        }      
+        $r->print(&Apache::loncommon::end_page());
+        return OK;
+    }
+
+    my $cnum; 
+    if ($cattype eq 'codesrch') {
+        my ($uniquecode,$codemsg,$brtext);
+        if ($env{'form.uniquecode'}) {
+            $uniquecode = $env{'form.uniquecode'};
+            $uniquecode =~ s/^\s+|\s+$//g;
+        }
+        my $js = '<script type="text/javascript">'."\n".
+                 '// <![CDATA['."\n".
+                 &courselink_javascript()."\n".
+                 '// ]]>'."\n".
+                 '</script>'."\n";
+        $r->print(&Apache::loncommon::start_page('Search for a Course/Community',$js));
+        if ($uniquecode =~ /^\w{6}$/) {
+            &Apache::lonhtmlcommon::add_breadcrumb
+            ({href=>"/adm/coursecatalog",
+              text=>"Course/Community Catalog"});
+            $brtext = 'Search Result';
+        } else {
+            $brtext = 'Course/Community Catalog';
+        }
+        &Apache::lonhtmlcommon::add_breadcrumb
+        ({href=>"/adm/coursecatalog",
+          text=>"$brtext"});
+        $r->print(&Apache::lonhtmlcommon::breadcrumbs('Course/Community Catalog'));
+        $r->print(&coursesearch($codedom,$domdesc,$uniquecode));
+        if ($uniquecode =~ /^\w{6}$/) {
+            $r->print('<hr />');
+            my $confname = $codedom.'-domainconfig';
+            my %codes = &Apache::lonnet::get('uniquecodes',[$uniquecode],$codedom,$confname);
+            if ($codes{$uniquecode}) {
+                $cnum = $codes{$uniquecode};
+                my %courses = &Apache::lonnet::courseiddump($codedom,'.',1,'.','.',
+                                                            $cnum,undef,undef,'.',1);
+                if (keys(%courses)) {
+                    $env{'form.coursenum'} = $cnum;  
+                    my %courseinfo = &build_courseinfo_hash(\%courses,$knownuser,$codedom);
+                    undef($env{'form.coursenum'});
+                    if (ref($courseinfo{$codedom.'_'.$cnum}) eq 'HASH') {
+                        $r->print(&Apache::lonhtmlcommon::start_pick_box());
+                        my @cols = ('title','ownerlastnames','seclist','access');
+                        my %lt = &Apache::lonlocal::texthash(
+                                     title          => 'Title',
+                                     ownerlastnames => 'Owner & Co-owner(s)',
+                                     seclist        => 'Sections',
+                                     access         => 'Default Access Dates for Students',
+                                 );
+                        my @shown;
+                        foreach my $item (@cols) {
+                            if ($courseinfo{$codedom.'_'.$cnum}{$item}) {
+                                push(@shown,$item);
+                            }
+                        }
+                        my $num = 0;
+                        foreach my $item (@shown) {
+                            $num ++;
+                            $r->print(&Apache::lonhtmlcommon::row_title($lt{$item}).
+                                      $courseinfo{$codedom.'_'.$cnum}{$item});
+                            if ($item eq 'title') {
+                                if ($courseinfo{$codedom.'_'.$cnum}{'showsyllabus'}) {
+                                    $r->print(' <font size="-2">'.
+                                              '<a href="javascript:ToSyllabus('."'$codedom','$cnum'".')">'.
+                                              &mt('Syllabus').'</a></font>');
+                                }
+                            }
+                            my $arg = ( $num == scalar(@shown) ? 1 : '' );
+                            $r->print(&Apache::lonhtmlcommon::row_closure($arg));
+                        }
+                        $r->print(&Apache::lonhtmlcommon::end_pick_box());
+                        my $selfenroll = &selfenroll_status($courseinfo{$codedom.'_'.$cnum},$codedom.'_'.$cnum);
+                        if ($selfenroll) {
+                            $r->print('<br />'.$selfenroll);
+                        }
+                        $r->print('<form name="linklaunch" method="post" action="">'."\n".
+                                  '<input type="hidden" name="backto" value="coursecatalog" />'."\n".
+                                  '<input type="hidden" name="courseid" value="" />'."\n".
+                                  '</form>'."\n");
+
+                    } else {
+                        $codemsg = &mt('Code matched, but course ID to which this mapped is invalid.');
+                    }
+                } else {
+                    $codemsg = &mt('Code matched, but course ID to which this mapped is invalid.');              
+                } 
+            } else {
+                $codemsg = &mt('No match');
+            }
+        }
+        $r->print('<br />'.&Apache::loncommon::end_page());
+        return OK;
+    } else {
+        if ($env{'form.coursenum'}) {
+            $cnum = $env{'form.coursenum'};
+        }
     }
-    my $subcats;
+
+    if ($env{'form.catalog_maxdepth'} ne '') {
+        $env{'form.catalog_maxdepth'} =~ s{\D}{}g;
+    }
+
+    my (@cats, at trails,%allitems,%idx, at jsarray,%subcathash,$subcats);
     if ($env{'form.withsubcats'}) {
         $subcats = \%subcathash;
     }
     &Apache::loncommon::extract_categories($cathash,\@cats,\@trails,\%allitems,
                                            \%idx,\@jsarray,$subcats);
     my ($numtitles, at codetitles);
-    if ($env{'form.coursenum'} ne '' && &user_is_known()) {
+    if (($env{'form.coursenum'} ne '') && ($knownuser)) {
         &course_details($r,$codedom,$formname,$domdesc,\@trails,\%allitems,\@codetitles);
     } else {
         my ($catlinks,$has_subcats,$selitem) = &category_breadcrumbs($codedom, at cats);
@@ -154,7 +277,7 @@
         }
         if ($env{'form.currcat_0'} eq 'instcode::0') {
             $numtitles = &instcode_course_selector($r,$codedom,$formname,$domdesc,
-                                                   $catlinks,$catjs,\@codetitles);
+                                                   $catlinks,$catjs,\@codetitles,$cattype);
             if ($env{'form.state'} eq 'listing') {
                 $r->print(&print_course_listing($codedom,$numtitles,undef,undef,undef,
                                                 \@codetitles));
@@ -177,7 +300,7 @@
 ENDJS
             }
             $catjs = '<script type="text/javascript">'."\n".$catjs."\n".'</script>';
-            &cat_header($r,$codedom,$catjs,\%add_entries,$catlinks);
+            &cat_header($r,$codedom,$catjs,\%add_entries,$catlinks,undef,$cattype);
             if ($env{'form.currcat_0'} ne '') {
                 $r->print('<form name="'.$formname.
                           '" method="post" action="/adm/coursecatalog">'.
@@ -258,6 +381,26 @@
     return;
 }
 
+sub coursesearch {
+    my ($codedom,$domdesc,$uniquecode) = @_;
+    my %lt = &Apache::lonlocal::texthash (
+                                           crlk => 'Course look-up',  
+                                           code => 'Code',
+                                           ifyo => 'Enter the character code (six letters and numbers)',
+                                           srch => 'Find course',
+                                         );
+    return <<"END";
+<h3>$lt{'crlk'} ($domdesc)</h3>
+$lt{'ifyo'}
+<form name="searchbycode" method="post" action="">
+<span class="LC_nobreak">
+<input type="text" value="$uniquecode" size="6" name="uniquecode" /> 
+<br />
+<input type="submit" value="$lt{'srch'}" name="srch" /></span>
+</form>
+END
+}
+
 sub courselink_javascript {
     return <<"END";
 
@@ -285,7 +428,7 @@
 }
 
 sub instcode_course_selector {
-    my ($r,$codedom,$formname,$domdesc,$catlinks,$catjs,$codetitles) = @_;
+    my ($r,$codedom,$formname,$domdesc,$catlinks,$catjs,$codetitles,$cattype) = @_;
     my %coursecodes = ();
     my %codes = ();
     my %cat_titles = ();
@@ -310,7 +453,7 @@
         if (&user_is_dc($codedom)) {
             $add_entries{'onLoad'} .= ' toggleStatuses();toggleWasActive();'
         }
-        &cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles);
+        &cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles,$cattype);
         my $cat_maxdepth = $env{'form.catalog_maxdepth'};
         $r->print('<form name="'.$formname.'" method="post" action="/adm/coursecatalog">'.
                   '<input type="hidden" name="catalog_maxdepth" value="'.$cat_maxdepth.'" />'."\n".
@@ -335,7 +478,7 @@
               "$catjs\n".
               '// ]]>'."\n".
               '</script>';
-        &cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles);
+        &cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles,$cattype);
         my $cat_maxdepth = $env{'form.catalog_maxdepth'};
         $r->print('<form name="'.$formname.'" method="post" action="/adm/coursecatalog">'.
                   '<input type="hidden" name="catalog_maxdepth" value="'.$cat_maxdepth.'" />'.
@@ -347,7 +490,7 @@
 }
 
 sub cat_header {
-    my ($r,$codedom,$js,$add_entries,$catlinks,$numtitles) = @_;
+    my ($r,$codedom,$js,$add_entries,$catlinks,$numtitles,$cattype) = @_;
     my $start_page =
         &Apache::loncommon::start_page('Course/Community Catalog',$js,
                                        { 'add_entries' => $add_entries, });
@@ -372,15 +515,17 @@
           text=>"Course/Community Catalog"});
     }
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Course/Community Catalog'));
-    my $onchange = 'this.form.submit()';
-    $r->print('<form name="coursecatdom" method="post" action="/adm/coursecatalog">'.
-              '<table border="0"><tr><td><b>'.&mt('Domain:').'</b></td><td>'.
-              &Apache::loncommon::select_dom_form($codedom,'showdom','',1,$onchange));
-    if (!$onchange) {
+    if ($cattype eq 'std') {
+        my $onchange = 'this.form.submit()';
+        $r->print('<form name="coursecatdom" method="post" action="/adm/coursecatalog">'.
+                  '<table border="0"><tr><td><b>'.&mt('Domain:').'</b></td><td>'.
+                  &Apache::loncommon::select_dom_form($codedom,'showdom','',1,$onchange));
+        if (!$onchange) {
 	   $r->print(' <input type="submit" name="godom" value="'.&mt('Change').'" />');
+        }
+        $r->print('</td></tr></table></form>');
     }
-    $r->print('</td></tr></table></form>'.
-	      '<form name="coursecats" method="post" action="/adm/coursecatalog"'.
+    $r->print('<form name="coursecats" method="post" action="/adm/coursecatalog"'.
               ' onsubmit="return check_selected();">'.
               '<table border="0"><tr>'.$catlinks.'</tr></table></form>');
     return;
@@ -860,10 +1005,8 @@
         }
     }
     my $now = time;
-    my %domconfig =
-        &Apache::lonnet::get_dom('configuration',['usercreation'],$domain);
     $output .= &construct_data_table($knownuser,$domain,\%courses,$details,undef,
-                                     $now,\%domconfig,$trails,$allitems);
+                                     $now,$trails,$allitems);
     $output .= "\n".'<form name="linklaunch" method="post" action="">'.
                '<input type="hidden" name="backto" value="coursecatalog" />'.
                '<input type="hidden" name="courseid" value="" />'.
@@ -872,8 +1015,7 @@
 }
 
 sub construct_data_table {
-    my ($knownuser,$domain,$courses,$details,$usersections,$now,$domconfig,
-        $trails,$allitems) = @_;
+    my ($knownuser,$domain,$courses,$details,$usersections,$now,$trails,$allitems) = @_;
     my %sortname;
     if (($details eq '') || ($env{'form.showdetails'})) {
         $sortname{'Code'} = 'code';
@@ -1378,29 +1520,39 @@
             $output .= "<td><a href=\"javascript:setCourseId('$cnum')\">".&mt('Show more details').'</a></td>';
         }
     }
-    my $selfenroll;
-    if ($info->{'selfenroll_types'}) {
-        my $showstart = &Apache::lonlocal::locallocaltime($info->{'selfenroll_start'});
-        my $showend = &Apache::lonlocal::locallocaltime($info->{'selfenroll_end'});
-        if (($info->{'selfenroll_end'} > 0) && ($info->{'selfenroll_end'} > $now)) {
-            if (($info->{'selfenroll_start'} > 0) && ($info->{'selfenroll_start'} > $now)) {
-                $output .= '<td>'.&mt('Starts: [_1]','<span class="LC_cusr_emph">'.$showstart.'</span>').'<br />'.&mt('Ends: [_1]','<span class="LC_cusr_emph">'.$showend.'</span>').'</td>';
-            } else { 
-                $output .= '<td><a href="javascript:ToSelfenroll('."'$course'".')">'.&mt('Enroll in course').'</a><br />';
-                if ($info->{'selfenroll_end'} == 0) {
-                    $output .= &mt('Available permanently');
-                } elsif ($info->{'selfenroll_end'} > $now) {
-                    $output .= &mt('Self-enrollment ends: [_1]','<span class="LC_cusr_emph">'.$showend.'</span>');
+    my $selfenroll = &selfenroll_status($info,$course);
+    if ($selfenroll) {
+        $output .= '<td>'.$selfenroll.'</td>';
+    } else {
+        $output .= '<td> </td>';
+    }
+    $$countref ++;
+    return $output;
+}
+
+sub selfenroll_status {
+    my ($info,$course) = @_;
+    my $now = time;
+    my $output;
+    if (ref($info) eq 'HASH') {
+        if ($info->{'selfenroll_types'}) {
+            my $showstart = &Apache::lonlocal::locallocaltime($info->{'selfenroll_start'});
+            my $showend = &Apache::lonlocal::locallocaltime($info->{'selfenroll_end'});
+            if (($info->{'selfenroll_end'} > 0) && ($info->{'selfenroll_end'} > $now)) {
+                if (($info->{'selfenroll_start'} > 0) && ($info->{'selfenroll_start'} > $now)) {
+                    $output = &mt('Starts: [_1]','<span class="LC_cusr_emph">'.$showstart.'</span>').'<br />'.&mt('Ends: [_1]','<span class="LC_cusr_emph">'.$showend.'</span>');
+                } else {
+                    $output = '<a href="javascript:ToSelfenroll('."'$course'".')">'.
+                              &mt('Enroll in course').'</a><br />';
+                    if ($info->{'selfenroll_end'} == 0) {
+                        $output .= &mt('Available permanently');
+                    } elsif ($info->{'selfenroll_end'} > $now) {
+                        $output .= &mt('Self-enrollment ends: [_1]','<span class="LC_cusr_emph">'.$showend.'</span>');
+                    }
                 }
-                $output .= '</td>';
             }
-            $selfenroll = 1;
         }
     }
-    if (!$selfenroll) {
-        $output .= '<td> </td>';
-    }
-    $$countref ++;
     return $output;
 }
 
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.237 loncom/interface/domainprefs.pm:1.238
--- loncom/interface/domainprefs.pm:1.237	Fri Apr 25 17:56:43 2014
+++ loncom/interface/domainprefs.pm	Mon Apr 28 01:48:04 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.237 2014/04/25 17:56:43 bisitz Exp $
+# $Id: domainprefs.pm,v 1.238 2014/04/28 01:48:04 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -387,7 +387,9 @@
         'coursecategories' =>
                   { text => 'Cataloging of courses/communities',
                     help => 'Domain_Configuration_Cataloging_Courses',
-                    header => [{col1 => 'Category settings',
+                    header => [{col1 => 'Catalog type/availability',
+                                col2 => '',},
+                               {col1 => 'Category settings for standard catalog',
                                 col2 => '',},
                                {col1 => 'Categories',
                                 col2 => '',
@@ -665,7 +667,7 @@
     if ($numheaders > 1) {
         my $colspan = '';
         my $rightcolspan = '';
-        if (($action eq 'rolecolors') || ($action eq 'coursecategories') || ($action eq 'defaults') ||
+        if (($action eq 'rolecolors') || ($action eq 'defaults') ||
             (($action eq 'login') && ($numheaders < 3))) {
             $colspan = ' colspan="2"';
         }
@@ -713,8 +715,14 @@
             $rowtotal ++;
         if (($action eq 'autoupdate') || ($action eq 'usercreation') ||
             ($action eq 'selfcreation') || ($action eq 'selfenrollment') ||
-            ($action eq 'usersessions')) {
-            $output .= $item->{'print'}->('middle',$dom,$settings,\$rowtotal).'
+            ($action eq 'usersessions') || ($action eq 'coursecategories')) {
+            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>
           </td>
          </tr>
@@ -724,14 +732,16 @@
              <tr class="LC_info_row">
               <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td>
               <td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td>
-             </tr>'."\n".
-            $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
+             </tr>'."\n";
+            if ($action eq 'coursecategories') {
+                $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
+            } else {
+                $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
+            }
             $rowtotal ++;
         } elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||
                   ($action eq 'defaults')) {
             $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
-        } elsif ($action eq 'coursecategories') {
-            $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
         } elsif ($action eq 'login') {
             if ($numheaders == 3) {
                 $output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'
@@ -4746,6 +4756,49 @@
     my ($position,$dom,$hdritem,$settings,$rowtotal) = @_;
     my $datatable;
     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> ';
+           }
+           $datatable .= '</td></tr>';
+           $itemcount ++;
+        }
+        $$rowtotal += $itemcount;
+    } elsif ($position eq 'middle') {
         my $toggle_cats_crs = ' ';
         my $toggle_cats_dom = ' checked="checked" ';
         my $can_cat_crs = ' ';
@@ -4952,7 +5005,7 @@
                 $datatable .= &initialize_categories($itemcount);
             }
         } 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);
         }
         $$rowtotal += $itemcount;
@@ -9315,6 +9368,8 @@
     my ($resulttext,%deletions,%reorderings,%needreordering,%adds,%changes,$errors,
         $cathash);
     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') {
         $cathash = $domconfig{'coursecategories'}{'cats'};
         if ($domconfig{'coursecategories'}{'togglecats'} ne $env{'form.togglecats'}) {
@@ -9333,6 +9388,14 @@
             $changes{'categorizecomm'} = 1;
             $domconfig{'coursecategories'}{'categorizecomm'} = $env{'form.categorizecomm'};
         }
+        foreach my $item (@catitems) {
+            if (grep(/^\Q$env{'form.coursecat_'.$item}\E$/, at cattypes)) {
+                if ($domconfig{'coursecategories'}{$item} ne $env{'form.coursecat_'.$item}) {
+                    $changes{$item} = 1;
+                    $domconfig{'coursecategories'}{$item} = $env{'form.coursecat_'.$item};
+                }
+            }
+        }
     } else {
         $changes{'togglecats'} = 1;
         $changes{'categorize'} = 1;
@@ -9344,6 +9407,14 @@
                                              togglecatscomm => $env{'form.togglecatscomm'},
                                              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$/, at cattypes)) {
+                $domconfig{'coursecategories'}{$item} = $env{'form.coursecat_'.$item};
+            }
+        }
     }
     if (ref($cathash) eq 'HASH') {
         if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '')  && ($env{'form.instcode'} == 0)) {
@@ -9466,6 +9537,10 @@
                          dom  => 'set in Domain ("Modify Course/Community")',
                          crs  => 'set in Course ("Course 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>';
             if ($changes{'togglecats'}) {
@@ -9480,6 +9555,12 @@
             if ($changes{'categorizecomm'}) {
                 $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)) {
                 my $cathash;
                 if (ref($domconfig{'coursecategories'}) eq 'HASH') {


More information about the LON-CAPA-cvs mailing list