[LON-CAPA-cvs] cvs: loncom /auth londatecheck.pm /homework structuretags.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 25 Apr 2005 21:40:33 -0000


albertel		Mon Apr 25 17:40:33 2005 EDT

  Modified files:              
    /loncom/auth	londatecheck.pm 
    /loncom/homework	structuretags.pm 
  Log:
  - modifying the html access restriction code to produce normal headers and footers for a resource page
  
  
Index: loncom/auth/londatecheck.pm
diff -u loncom/auth/londatecheck.pm:1.9 loncom/auth/londatecheck.pm:1.10
--- loncom/auth/londatecheck.pm:1.9	Mon Apr 25 17:21:17 2005
+++ loncom/auth/londatecheck.pm	Mon Apr 25 17:40:33 2005
@@ -1,5 +1,5 @@
 # Checks contentopen/close settings disable subsequent PerlHandlers if not open
-# $Id: londatecheck.pm,v 1.9 2005/04/25 21:21:17 albertel Exp $
+# $Id: londatecheck.pm,v 1.10 2005/04/25 21:40:33 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -36,12 +36,14 @@
     my $close=&Apache::lonnet::EXT('resource.0.contentclose',$symb);
     if ( (defined($open)  && $open  ne '' && time < $open) ) {
 	return ('CLOSED',$open,$close,
+		'<h1>'.&mt('Not open to be viewed').'</h1>'.
 		&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,
+		'<h1>'.&mt('Not open to be viewed').'</h1>'.
 		&mt("This resource is no longer available to be viewed."));
     }
     return ('OPEN',$open,$close);
@@ -58,16 +60,14 @@
 	&Apache::loncommon::content_type($r,'text/html');
 	$r->send_http_header;
 	return OK if $r->header_only;
-	$r->print('<html><head><title>'.&mt("Not Open").'</title>');
+	my $html=&Apache::lonxml::xmlbegin();
+	$r->print($html.'<head><title>'.&mt("Not Open").'</title>');
 	my $addentries=' onLoad="'.&Apache::lonmenu::loadevents().
 	    '" onUnload="'.&Apache::lonmenu::unloadevents().'"';
 	$r->print(&Apache::lonmenu::registerurl(1));
-	$r->print('</head>'.
-		  &Apache::loncommon::bodytag('','',$addentries,'','',
-					      undef));
-
+	$r->print('</head>'.&Apache::structuretags::body_tag_start('web'));
 	$r->print($msg);
-	$r->print('</body></html>');
+	$r->print(&Apache::lonxml::xmlend().'</html>');
 	return OK;
     }
     return DECLINED;
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.289 loncom/homework/structuretags.pm:1.290
--- loncom/homework/structuretags.pm:1.289	Fri Apr 22 13:15:33 2005
+++ loncom/homework/structuretags.pm	Mon Apr 25 17:40:33 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.289 2005/04/22 17:15:33 albertel Exp $
+# $Id: structuretags.pm,v 1.290 2005/04/25 21:40:33 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -68,6 +68,34 @@
     return '';
 }
 
+sub body_tag_start {
+    my ($target,$background,$bgcolor)=@_;
+    my $body_tag_start='<body onload="'.&Apache::lonmenu::loadevents().'" '.
+	'onunload="'.&Apache::lonmenu::unloadevents().'" ';
+    if ($env{'browser.imagesuppress'} eq 'on') { $background=''; }
+    if ($background) {
+	$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
+	    $background;
+	$body_tag_start.='background="'.$background.'" ';
+    } else {
+	if (($bgcolor) && ($env{'browser.blackwhite'} ne 'on')) {
+	    $body_tag_start.='bgcolor="'.$bgcolor.'" ';
+	} else {
+	    $body_tag_start.='bgcolor="#ffffff"';
+	}
+    }
+    if ($env{'browser.fontenhance'} eq 'on') {
+	$body_tag_start.=' style="font-size: x-large;" ';
+    }
+    $body_tag_start.='>'.&Apache::lonmenu::menubuttons(undef,$target,1);
+    if ($env{'environment.texengine'} eq 'jsMath') {
+	$body_tag_start.='<script type="text/javascript">
+                     function NoFontMessage () {}
+                   </script>'."\n".
+		       '<script src="/adm/jsMath/jsMath.js"></script>'."\n";
+    }
+    return $body_tag_start;
+}
 sub page_start {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     my %found;
@@ -93,34 +121,11 @@
 	$body_tag_start=&Apache::loncommon::bodytag();
 	$body_tag_start.=&Apache::lonxml::message_location();
     } elsif (!defined($found{'body'})) {
-	$body_tag_start='<body onload="'.&Apache::lonmenu::loadevents().'" '.
-	    'onunload="'.&Apache::lonmenu::unloadevents().'" ';
 	my $background=&Apache::lonxml::get_param('background',$parstack,
 						  $safeeval);
-	if ($env{'browser.imagesuppress'} eq 'on') { $background=''; }
-	if ($background) {
-	    $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
-		$background;
-	    $body_tag_start.='background="'.$background.'" ';
-	} else {
-	    my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack,
-						   $safeeval);
-	    if (($bgcolor) && ($env{'browser.blackwhite'} ne 'on')) {
-		$body_tag_start.='bgcolor="'.$bgcolor.'" ';
-	    } else {
-		$body_tag_start.='bgcolor="#ffffff"';
-	    }
-	}
-	if ($env{'browser.fontenhance'} eq 'on') {
-	    $body_tag_start.=' style="font-size: x-large;" ';
-	}
-	$body_tag_start.='>'.&Apache::lonmenu::menubuttons(undef,$target,1);
-	if ($env{'environment.texengine'} eq 'jsMath') {
-	    $body_tag_start.='<script type="text/javascript">
-                     function NoFontMessage () {}
-                   </script>'."\n".
-		       '<script src="/adm/jsMath/jsMath.js"></script>'."\n";
-	}
+	my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack,
+					       $safeeval);
+	$body_tag_start=&body_tag_start($background,$bgcolor);
 	if ($target eq 'web' && $env{'request.state'} ne 'construct') {
 	    my ($symb,undef,undef,undef,$publicuser)=
 		&Apache::lonxml::whichuser();