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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Fri, 27 Jun 2008 00:02:56 -0000


raeburn		Thu Jun 26 20:02:56 2008 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  - "hidefromcat" available as a course environament parameter settable by CC, if so configuraed from domain.
  - update nohist_courseids.db when this parameter is changed.
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.401 loncom/interface/lonparmset.pm:1.402
--- loncom/interface/lonparmset.pm:1.401	Fri Jun 20 13:38:51 2008
+++ loncom/interface/lonparmset.pm	Thu Jun 26 20:02:55 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.401 2008/06/20 17:38:51 bisitz Exp $
+# $Id: lonparmset.pm,v 1.402 2008/06/27 00:02:55 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2134,7 +2134,8 @@
                     &change_clone($value,\@oldcloner);
                 }
                 # Update environment and nohist_courseids.db
-                if ($name eq 'description' || $name eq 'cloners') {
+                if (($name eq 'description') || ($name eq 'cloners') || 
+                    ($name eq 'hidefromcat')) {
                     if ($chome eq '') {
                         %crsinfo =
                             &Apache::lonnet::courseiddump($dom,'.',1,'.','.',
@@ -2159,6 +2160,14 @@
                                                          $chome,'notime');
                     }
                 }
+                if ($name eq 'hidefromcat') {
+                    if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') {
+                        $crsinfo{$env{'request.course.id'}}{'hidefromcat'} = $value;
+                        my $putresult =
+                            &Apache::lonnet::courseidput($dom,\%crsinfo,
+                                                         $chome,'notime');
+                    }
+                }
             } else {
                 $setoutput.=&mt('Unable to set').' <b>'.$name.'</b> '.&mt('to').
 		    ' <b>'.$value.'</b> '.&mt('due to').' '.$put_result.'.<br />';
@@ -2345,12 +2354,20 @@
 
              'suppress_embed_prompt'
                  => '<b>'.&mt('Suppress prompt to upload items referenced in a web page being uploaded to portfolio, when current role is student.').'</b><br />'.
-                    ' ('.&mt('[_1] to suppress, anything else to not suppress','"<tt>yes</tt>"').')',  
-             ); 
-        my @Display_Order = ('url','description','courseid','cloners','grading',
+                    ' ('.&mt('[_1] to suppress, anything else to not suppress','"<tt>yes</tt>"').')',
+              'hidefromcat'
+                 => '<b>'.&mt('Exclude from course catalog').'</b><br />'.
+                    ' ('.&mt('[_1] to exclude, anything else to include - included if assigned an institutional code, or manually catagorized','"<tt>yes</tt>"').')',
+             );
+        my @Display_Order = ('url','description','courseid','cloners');
+        if (&can_toggle_cat($dom)) {
+            push(@Display_Order,'hidefromcat');
+        }
+        push (@Display_Order,('grading',
                              'externalsyllabus',
                              'default_xml_style','pageseparators',
-                             'question.email','question.email.text','comment.email','comment.email.text','policy.email','policy.email.text',
+                             'question.email','question.email.text','comment.email',
+                             'comment.email.text','policy.email','policy.email.text',
                              'student_classlist_view',
                              'student_classlist_opt_in',
                              'student_classlist_portfiles',
@@ -2379,8 +2396,7 @@
 			     'texengine',
 			     'disablesigfigs',
 			     'disableexampointprint',
-			     'task_messages','task_grading',
-                             );
+			     'task_messages','task_grading'));
 	foreach my $parameter (sort(keys(%values))) {
             unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) {
                 if (! $descriptions{$parameter}) {
@@ -2473,6 +2489,19 @@
 $end_page
 ENDENV
 }
+
+sub can_toggle_cat {
+    my ($dom) = @_;
+    my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom);
+    my $can_toggle_cat = '';
+    if (ref($domconf{'coursecategories'}) eq 'HASH') {
+        if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') {
+            $can_toggle_cat = 1;
+        }
+    }
+    return $can_toggle_cat;
+}
+
 ##################################################
 # Overview mode
 ##################################################