[LON-CAPA-cvs] cvs: loncom /auth loncacc.pm londatecheck.pm lonroles.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 23 Aug 2004 18:57:16 -0000


albertel		Mon Aug 23 14:57:16 2004 EDT

  Modified files:              
    /loncom/auth	loncacc.pm londatecheck.pm lonroles.pm 
  Log:
  - don't tell student 'Go Away' when an html page is closed
  - allow CC to see closed content
     (BUG#3357)
  
  
Index: loncom/auth/loncacc.pm
diff -u loncom/auth/loncacc.pm:1.34 loncom/auth/loncacc.pm:1.35
--- loncom/auth/loncacc.pm:1.34	Mon Feb  2 13:50:21 2004
+++ loncom/auth/loncacc.pm	Mon Aug 23 14:57:16 2004
@@ -2,7 +2,7 @@
 # Cookie Based Access Handler for Construction Area
 # (lonacc: 5/21/99,5/22,5/29,5/31 Gerd Kortemeyer)
 #
-# $Id: loncacc.pm,v 1.34 2004/02/02 18:50:21 albertel Exp $
+# $Id: loncacc.pm,v 1.35 2004/08/23 18:57:16 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -79,7 +79,9 @@
     my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
     my $lonid=$cookies{'lonID'};
     my $cookie;
+    &Apache::lonnet::logthis("Wha? cookie");
     if ($lonid) {
+	&Apache::lonnet::logthis("Valid cookie");
 	my $handle=$lonid->value;
         $handle=~s/\W//g;
         my $lonidsdir=$r->dir_config('lonIDsDir');
@@ -118,6 +120,7 @@
 
             return OK; 
         } else { 
+	    &Apache::lonnet::logthis("Invalid cookie");
             $r->log_reason("Cookie $handle not valid", $r->filename) 
         };
     }
Index: loncom/auth/londatecheck.pm
diff -u loncom/auth/londatecheck.pm:1.3 loncom/auth/londatecheck.pm:1.4
--- loncom/auth/londatecheck.pm:1.3	Mon Jun 28 12:26:55 2004
+++ loncom/auth/londatecheck.pm	Mon Aug 23 14:57:16 2004
@@ -1,5 +1,5 @@
 # Checks contentopen/close settings disable subsequent PerlHandlers if not open
-# $Id: londatecheck.pm,v 1.3 2004/06/28 16:26:55 albertel Exp $
+# $Id: londatecheck.pm,v 1.4 2004/08/23 18:57:16 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -27,22 +27,32 @@
 use strict;
 package Apache::londatecheck;
 use Apache::lonnet();
+use Apache::lonlocal;
 use Apache::Constants qw(:common :http :methods);
 
 sub content_date_check {
     my $symb=$ENV{'request.symb'};
     my $open=&Apache::lonnet::EXT('resource.0.contentopen',$symb);
     my $close=&Apache::lonnet::EXT('resource.0.contentclose',$symb);
-    if ( (defined($open)  && $open  ne '' && time < $open) ||
-	 (defined($close) && $close ne '' && time > $close)) {
-	return ('CLOSED',$open,$close);
+    if ( (defined($open)  && $open  ne '' && time < $open) ) {
+	return ('CLOSED',$open,$close,
+		&mt("This resource currently isn't open. ".
+		    "It will be available at [_1].",
+		    &Apache::lonlocal::locallocaltime($open)));
+    }
+    if ( (defined($close) && $close ne '' && time > $close) ) {
+	return ('CLOSED',$open,$close,
+		&mt("This resource is no longer available to be viewed."));
     }
     return ('OPEN',$open,$close);
 }
 
 sub handler {
     my ($r)=@_;
-    my ($status)=&content_date_check();
+    if (&Apache::lonnet::allowed('bre',$ENV{'request.filename'}) eq 'F') {
+	return OK;
+    }
+    my ($status,$open,$close,$msg)=&content_date_check();
     if ($status ne 'OPEN') {
 	$r->set_handlers('PerlHandler'=>undef);
 	&Apache::loncommon::content_type($r,'text/html');
@@ -53,10 +63,11 @@
 	    '" onUnload="'.&Apache::lonmenu::unloadevents().'"';
 	$r->print(&Apache::lonmenu::registerurl(1));
 	$r->print('</head>'.
-		  &Apache::loncommon::bodytag('Go Away!','',$addentries,'','',
+		  &Apache::loncommon::bodytag('','',$addentries,'','',
 					      undef));
+
+	$r->print($msg);
 	$r->print('</body></html>');
-	$r->print("Go Away!");
     }
     return OK;
 }
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.97 loncom/auth/lonroles.pm:1.98
--- loncom/auth/lonroles.pm:1.97	Tue Aug  3 14:53:27 2004
+++ loncom/auth/lonroles.pm	Mon Aug 23 14:57:16 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.97 2004/08/03 18:53:27 albertel Exp $
+# $Id: lonroles.pm,v 1.98 2004/08/23 18:57:16 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -84,7 +84,6 @@
 
 
 # ================================================================== Roles Init
-
     if ($ENV{'form.selectrole'}) {
 	if ($ENV{'request.course.id'}) {
 	    my %temp=('logout_'.$ENV{'request.course.id'} => time);