[LON-CAPA-cvs] cvs: loncom /interface lonblockingmenu.pm lonblockingstatus.pm loncommon.pm lonsearchcourse.pm /misc releaseslist.xml

raeburn raeburn at source.lon-capa.org
Tue Sep 22 08:19:16 EDT 2020


raeburn		Tue Sep 22 12:19:16 2020 EDT

  Modified files:              
    /loncom/interface	lonsearchcourse.pm lonblockingstatus.pm 
                     	lonblockingmenu.pm loncommon.pm 
    /loncom/misc	releaseslist.xml 
  Log:
  - Blocking of user actions in a course during an exam can include Content 
    Search (course personnel with evb priv are exempt).
  
  
-------------- next part --------------
Index: loncom/interface/lonsearchcourse.pm
diff -u loncom/interface/lonsearchcourse.pm:1.5 loncom/interface/lonsearchcourse.pm:1.6
--- loncom/interface/lonsearchcourse.pm:1.5	Tue Sep 22 11:23:08 2020
+++ loncom/interface/lonsearchcourse.pm	Tue Sep 22 12:19:15 2020
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Course
 #
-# $Id: lonsearchcourse.pm,v 1.5 2020/09/22 11:23:08 raeburn Exp $
+# $Id: lonsearchcourse.pm,v 1.6 2020/09/22 12:19:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -329,10 +329,26 @@
     }
     $r->print(&Apache::lonhtmlcommon::breadcrumbs("$crstype Search"));
     &Apache::lonnavdisplay::startContentScreen($r,'coursesearch');
-    if ($env{'form.phase'} eq 'results') {
-       &course_search($r);
+    my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+    my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+    my ($blocked,$blocktext) =
+        &Apache::loncommon::blocking_status('search',$cnum,$cdom);
+    if ($blocked) {
+        my $checkrole = "cm./$cdom/$cnum";
+        if ($env{'request.course.sec'} ne '') {
+            $checkrole .= "/$env{'request.course.sec'}";
+        }
+        if ((&Apache::lonnet::allowed('evb',undef,undef,$checkrole)) &&
+            ($env{'request.role'} !~ m{^st\./$cdom/$cnum})) {
+            undef($blocked);
+        }
+    }
+    if ($blocked) {
+        $r->print($blocktext);
+    } elsif ($env{'form.phase'} eq 'results') {
+        &course_search($r);
     } else {
-       $r->print(&menu());
+        $r->print(&menu());
     }
     &Apache::lonnavdisplay::endContentScreen($r);
     $r->print(&Apache::loncommon::end_page());
Index: loncom/interface/lonblockingstatus.pm
diff -u loncom/interface/lonblockingstatus.pm:1.15 loncom/interface/lonblockingstatus.pm:1.16
--- loncom/interface/lonblockingstatus.pm:1.15	Mon Aug 10 19:28:21 2020
+++ loncom/interface/lonblockingstatus.pm	Tue Sep 22 12:19:15 2020
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # displays the blocking status table
 #
-# $Id: lonblockingstatus.pm,v 1.15 2020/08/10 19:28:21 raeburn Exp $
+# $Id: lonblockingstatus.pm,v 1.16 2020/09/22 12:19:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -44,7 +44,7 @@
     return OK if $r->header_only;
 
     my (%activities,$activity,$origurl);
-    map { $activities{$_} = 1; } ('boards','chat','com','blogs','groups','port','printout','docs','grades','passwd');
+    map { $activities{$_} = 1; } ('boards','chat','com','blogs','groups','port','printout','docs','grades','passwd','search');
 
     # determine what kind of blocking we want details for
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['activity','url']);
@@ -52,9 +52,13 @@
 
     my $title = 'Communication Blocking Status Information';
 
-    if (($activity eq 'docs') || ($activity eq 'printout')) {
+    if (($activity eq 'docs') || ($activity eq 'printout') ||
+        ($activity eq 'grades') || ($activity eq 'passwd') ||
+        ($activity eq 'search')) {
         $title = 'Blocking Status Information';
-        $origurl = $env{'form.url'};
+        if ($activity eq 'docs') {
+            $origurl = $env{'form.url'};
+        }
     }
     $r->print(&Apache::loncommon::start_page($title,undef,
                                             {'only_body' => 1}));
@@ -120,6 +124,7 @@
                    docs       => 'Course Content',
                    passwd     => 'Changing of passwords',
                    grades     => 'Course Gradebook',
+                   search     => 'Content Search',
                 );
 
     if ($activity eq 'groups' || $activity eq 'boards') {
@@ -127,7 +132,7 @@
             $descs{'boards'} = 'Discussion posts in this community';
             $descs{'groups'} = 'Groups in this community';
             $descs{'docs'} = 'Community Content';
-            $descs{'grades'} = 'Community Gradebook'; 
+            $descs{'grades'} = 'Community Gradebook';
         }
     }
 
@@ -143,7 +148,7 @@
     my $showend   = Apache::lonlocal::locallocaltime($endblock);
 
     my $output;
-    
+
     if ( ref($description) ne 'ARRAY' ) {
         #default: $description is one of the above descriptions
         if ($activity eq 'docs') {
@@ -151,7 +156,8 @@
                          . ' view will be unavailable between [_1] and [_2] because'
                          . ' access to selected '.$description.' is being blocked.'
                          ,$showstart, $showend);
-        } elsif (($activity eq 'printout') || ($activity eq 'passwd') || ($activity eq 'grades')) {
+        } elsif (($activity eq 'printout') || ($activity eq 'passwd') ||
+                 ($activity eq 'grades') || ($activity eq 'search')) {
             $output = mt( $description
                           . ' will be unavailable between [_1] and [_2] because'
                           . ' this functionality is being blocked.'
Index: loncom/interface/lonblockingmenu.pm
diff -u loncom/interface/lonblockingmenu.pm:1.27 loncom/interface/lonblockingmenu.pm:1.28
--- loncom/interface/lonblockingmenu.pm:1.27	Mon Aug 10 19:28:21 2020
+++ loncom/interface/lonblockingmenu.pm	Tue Sep 22 12:19:15 2020
@@ -2,7 +2,7 @@
 # Routines for configuring blocking of access to collaborative functions, 
 # and specific resources during an exam
 #
-# $Id: lonblockingmenu.pm,v 1.27 2020/08/10 19:28:21 raeburn Exp $
+# $Id: lonblockingmenu.pm,v 1.28 2020/09/22 12:19:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -621,6 +621,7 @@
             '<li>'.&mt('accessing content in LON-CAPA portfolios or blogs').'</li>'."\n".
             '<li>'.&mt("generating printouts of $lctype content").'</li>'.
             '<li>'.&mt("displaying the LON-CAPA gradebook in the $lctype").'</li>'.
+            '<li>'.&mt("searching $lctype content by keyword").'</li>'.  
             '<li>'.&mt("accessing $lctype content in specified folders or resources").'</li>'.
             '<li>'.&mt("changing user's own password").'</li>'.
             '</ul>'.
@@ -1658,10 +1659,11 @@
         'printout' => 'Printouts',
         'passwd' => 'Change Password',
         'grades' => 'Gradebook',
+        'search' => 'Content Search',
         'alert'  => 'Critical Alert',
         'reinit' => 'Course Re-init',
     );
-    my $typeorder = ['com','chat','boards','port','groups','blogs','printout','docs','grades','alert','reinit','passwd'];
+    my $typeorder = ['com','chat','boards','port','groups','blogs','printout','docs','grades','search','alert','reinit','passwd'];
     return ($typeorder,\%types);
 }
 
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1345 loncom/interface/loncommon.pm:1.1346
--- loncom/interface/loncommon.pm:1.1345	Mon Aug 10 19:28:21 2020
+++ loncom/interface/loncommon.pm	Tue Sep 22 12:19:15 2020
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1345 2020/08/10 19:28:21 raeburn Exp $
+# $Id: loncommon.pm,v 1.1346 2020/09/22 12:19:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5172,7 +5172,8 @@
 
     if (($activity eq 'boards' || $activity eq 'chat' ||
          $activity eq 'groups' || $activity eq 'printout' ||
-         $activity eq 'reinit' || $activity eq 'alert') &&
+         $activity eq 'search' || $activity eq 'reinit' ||
+         $activity eq 'alert') &&
         ($env{'request.course.id'})) {
         foreach my $key (keys(%live_courses)) {
             if ($key ne $env{'request.course.id'}) {
@@ -5491,6 +5492,8 @@
         $text = &mt('Password Changing Blocked');
     } elsif ($activity eq 'grades') {
         $text = &mt('Gradebook Blocked');
+    } elsif ($activity eq 'search') {
+        $text = &mt('Search Blocked');
     } elsif ($activity eq 'alert') {
         $text = &mt('Checking Critical Messages Blocked');
     } elsif ($activity eq 'reinit') {
Index: loncom/misc/releaseslist.xml
diff -u loncom/misc/releaseslist.xml:1.20 loncom/misc/releaseslist.xml:1.21
--- loncom/misc/releaseslist.xml:1.20	Mon Aug 10 19:28:22 2020
+++ loncom/misc/releaseslist.xml	Tue Sep 22 12:19:16 2020
@@ -7,6 +7,7 @@
 <course name="commblock" value="reinit">2.12</course>
 <course name="commblock" value="alert">2.12</course>
 <course name="commblock" value="grades">2.12</course>
+<course name="commblock" value="search">2.12</course>
 <course name="courserestype" value="exttool">2.12</course>
 <parameter name="type" value="anonsurvey">2.10</parameter>
 <parameter name="type" value="anonsurveycred">2.10</parameter>


More information about the LON-CAPA-cvs mailing list