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

raeburn raeburn at source.lon-capa.org
Wed Apr 4 17:05:05 EDT 2012


raeburn		Wed Apr  4 21:05:05 2012 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonblockingmenu.pm 
                     	lonblockingstatus.pm lonprintout.pm 
    /loncom/misc	releaseslist.xml 
  Log:
  - Bug 3462.
    - Blocking of printout generation added to available exam blocks for
      a course.
    - Course personnel (with evb priv) will be unaffected unless currently
      using a student role (e.g., an ad hoc role). 
  
  
-------------- next part --------------
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1062 loncom/interface/loncommon.pm:1.1063
--- loncom/interface/loncommon.pm:1.1062	Sat Mar 31 23:10:39 2012
+++ loncom/interface/loncommon.pm	Wed Apr  4 21:04:55 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1062 2012/03/31 23:10:39 raeburn Exp $
+# $Id: loncommon.pm,v 1.1063 2012/04/04 21:04:55 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4406,8 +4406,9 @@
     my $text = &mt('Communication Blocked');
     if ($activity eq 'docs') {
         $text = &mt('Content Access Blocked');
+    } elsif ($activity eq 'printout') {
+        $text = &mt('Printing Blocked');
     }
-
     $output .= <<"END_BLOCK";
 <div class='LC_comblock'>
   <a onclick='openWindow("$popupUrl","Blocking Table",600,300,"no","no");return false;' href='/adm/blockingstatus/$querystring'
Index: loncom/interface/lonblockingmenu.pm
diff -u loncom/interface/lonblockingmenu.pm:1.4 loncom/interface/lonblockingmenu.pm:1.5
--- loncom/interface/lonblockingmenu.pm:1.4	Sat Mar 31 14:15:24 2012
+++ loncom/interface/lonblockingmenu.pm	Wed Apr  4 21:04:56 2012
@@ -2,7 +2,7 @@
 # Routines for configuring blocking of access to collaborative functions, 
 # and specific resources during an exam
 #
-# $Id: lonblockingmenu.pm,v 1.4 2012/03/31 14:15:24 raeburn Exp $
+# $Id: lonblockingmenu.pm,v 1.5 2012/04/04 21:04:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -754,6 +754,11 @@
                 if ($blockdocs) {
                     &check_release_required('docs');
                 }
+                if (ref($blocktypes) eq 'HASH') {
+                    if ($blocktypes->{'printout'} eq 'on') {
+                        &check_release_required('printout');
+                    }
+                }
                 if (exists($removals{$key})) {
                     $modtotal ++;
                 } else {
@@ -1471,9 +1476,10 @@
         'port' => 'Portfolio',
         'groups' => 'Groups',
         'blogs' => 'Blogs',
-        'docs' => 'Content', 
+        'docs' => 'Content',
+        'printout' => 'Printouts',
     );
-    my $typeorder = ['com','chat','boards','port','groups','blogs','docs'];
+    my $typeorder = ['com','chat','boards','port','groups','blogs','printout','docs'];
     return ($typeorder,\%types);
 }
 
Index: loncom/interface/lonblockingstatus.pm
diff -u loncom/interface/lonblockingstatus.pm:1.10 loncom/interface/lonblockingstatus.pm:1.11
--- loncom/interface/lonblockingstatus.pm:1.10	Sat Mar 31 19:24:02 2012
+++ loncom/interface/lonblockingstatus.pm	Wed Apr  4 21:04:56 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # displays the blocking status table
 #
-# $Id: lonblockingstatus.pm,v 1.10 2012/03/31 19:24:02 raeburn Exp $
+# $Id: lonblockingstatus.pm,v 1.11 2012/04/04 21:04:56 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','msgdisplay','blogs','groups','port','docs');
+    map { $activities{$_} = 1; } ('boards','chat','msgdisplay','blogs','groups','port','printout','docs');
 
     # determine what kind of blocking we want details for
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['activity','url']);
@@ -52,7 +52,7 @@
 
     my $title = 'Communication Blocking Status Information';
 
-    if ($activity eq 'docs') {
+    if (($activity eq 'docs') || ($activity eq 'printout')) {
         $title = 'Blocking Status Information';
         $origurl = $env{'form.url'};
     }
@@ -108,6 +108,7 @@
                    msgdisplay => 'This message',
                    blogs      => 'Blogs',
                    groups     => 'Groups in this course',
+                   printout   => 'Printout generation', 
                    docs       => 'Course Content',
                 );
 
@@ -139,6 +140,11 @@
                          . ' view will be unavailable between [_1] and [_2] because'
                          . ' access to selected '.$description.' is being blocked.'
                          ,$showstart, $showend);
+        } elsif ($activity eq 'printout') {
+            $output = mt( $description
+                          . ' will be unavailable between [_1] and [_2] because'
+                          . ' this functionality is being blocked.'
+                          ,$showstart, $showend);
         } else {
             $output = mt( $description
                           . ' will be inaccessible between [_1] and [_2] because'
@@ -173,7 +179,7 @@
 sub build_block_table {
     my ($setters) = @_;
     my %lt = &Apache::lonlocal::texthash(
-        'cacb' => 'Currently active communication blocks',
+        'cacb' => 'Currently active communication/content blocks',
         'cour' => 'Course',
         'dura' => 'Duration',
         'blse' => 'Block set by'
@@ -196,7 +202,7 @@
             {
                 $fullname = Apache::loncommon::aboutmewrapper($fullname,$uname,$udom);
             }
-            my $triggertype = $$setters{$course}{times}[$i];
+            my $triggertype = $$setters{$course}{triggers}[$i];
             if ($triggertype) {
                 $fullname .= &mt(' (triggered by you when starting timer)'); 
             }
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.613 loncom/interface/lonprintout.pm:1.614
--- loncom/interface/lonprintout.pm:1.613	Wed Mar 28 21:15:41 2012
+++ loncom/interface/lonprintout.pm	Wed Apr  4 21:04:56 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.613 2012/03/28 21:15:41 ramirez Exp $
+# $Id: lonprintout.pm,v 1.614 2012/04/04 21:04:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3475,9 +3475,44 @@
 
 }
 
+sub printing_blocked {
+    my ($r,$blocktext) = @_;
+    my $title = &mt('Preparing Printout');
+    &Apache::lonhtmlcommon::clear_breadcrumbs();
+    &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/printout',
+                                            text=> $title});
+    my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs($title);
+    &Apache::loncommon::content_type($r,'text/html');
+    &Apache::loncommon::no_cache($r);
+    $r->send_http_header;
+    $r->print(&Apache::loncommon::start_page('Preparing Printout').
+              $breadcrumbs.
+              $blocktext.
+              &Apache::loncommon::end_page());
+    return;
+}
+
 sub handler {
 
     my $r = shift;
+
+    if ($env{'request.course.id'}) {
+        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('printout',$cnum,$cdom);
+        if ($blocked) {
+            my $checkrole = "cm./$cdom/$cnum";
+            if ($env{'request.course.sec'} ne '') {
+                $checkrole .= "/$env{'request.course.sec'}";
+            }
+            unless ((&Apache::lonnet::allowed('evb',undef,undef,$checkrole)) && 
+                    ($env{'request.role'} !~ m{^st\./$cdom/$cnum})) {
+                &printing_blocked($r,$blocktext);
+                return OK;
+            }
+        }
+    }
     
     &init_perm();
 
@@ -3504,7 +3539,7 @@
 
     &output_data($r,$helper,\%parmhash);
     return OK;
-} 
+}
 
 use Apache::lonhelper;
 
@@ -4928,7 +4963,5 @@
     }
 }
 
-
-
 __END__
 
Index: loncom/misc/releaseslist.xml
diff -u loncom/misc/releaseslist.xml:1.7 loncom/misc/releaseslist.xml:1.8
--- loncom/misc/releaseslist.xml:1.7	Sat Mar 31 22:10:16 2012
+++ loncom/misc/releaseslist.xml	Wed Apr  4 21:05:04 2012
@@ -1,6 +1,7 @@
 <course name="crstype" value="Community">2.9</course>
 <course name="commblock" value="timer">2.11</course>
 <course name="commblock" value="docs">2.11</course>
+<course name="commblock" value="printout">2.11</course>
 <parameter name="type" value="anonsurvey">2.10</parameter>
 <parameter name="type" value="anonsurveycred">2.10</parameter>
 <parameter name="type" value="surveycred">2.10</parameter>


More information about the LON-CAPA-cvs mailing list