[LON-CAPA-cvs] cvs: loncom / loncapa_apache.conf /interface loncommon.pm loncss.pm doc/loncapafiles loncapafiles.lpml

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 08 May 2006 18:54:27 -0000


albertel		Mon May  8 14:54:27 2006 EDT

  Added files:                 
    /loncom/interface	loncss.pm 

  Modified files:              
    /doc/loncapafiles	loncapafiles.lpml 
    /loncom/interface	loncommon.pm 
    /loncom	loncapa_apache.conf 
  Log:
  - move css into a <link>ed file
  
  
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.479 doc/loncapafiles/loncapafiles.lpml:1.480
--- doc/loncapafiles/loncapafiles.lpml:1.479	Sat Apr  8 03:04:42 2006
+++ doc/loncapafiles/loncapafiles.lpml	Mon May  8 14:53:54 2006
@@ -2,7 +2,7 @@
  "http://lpml.sourceforge.net/DTD/lpml.dtd">
 <!-- loncapafiles.lpml -->
 
-<!-- $Id: loncapafiles.lpml,v 1.479 2006/04/08 07:04:42 albertel Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.480 2006/05/08 18:53:54 albertel Exp $ -->
 
 <!--
 
@@ -6337,6 +6337,14 @@
 </description>
 </file>
 <file>
+  <source>loncom/interface/loncss.pm</source>
+  <target dist='default'>home/httpd/lib/perl/Apache/loncss.pm</target>
+  <categoryname>handler</categoryname>
+  <description>
+    Generates standard LON-CAPA CSS
+  </description>
+</file>
+<file>
   <source>loncom/interface/lonnotify.pm</source>
   <target dist='default'>home/httpd/lib/perl/Apache/lonnotify.pm</target>
   <categoryname>handler</categoryname>
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.362 loncom/interface/loncommon.pm:1.363
--- loncom/interface/loncommon.pm:1.362	Fri May  5 14:04:27 2006
+++ loncom/interface/loncommon.pm	Mon May  8 14:54:00 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.362 2006/05/05 18:04:27 albertel Exp $
+# $Id: loncommon.pm,v 1.363 2006/05/08 18:54:00 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3089,7 +3089,6 @@
     my $mail_other_hover     = '#669999';
 
     return <<END;
-<style type="text/css">
 h1, h2, h3, th { font-family: $sans }
 a:focus { color: red; background: yellow } 
 table.thinborder { border-collapse: collapse; }
@@ -3261,7 +3260,6 @@
 table.LC_mail_list tr.LC_mail_other:hover {
   background-color: $mail_other_hover;
 }
-</style>
 END
 }
 
@@ -3295,10 +3293,18 @@
 sub headtag {
     my ($title,$head_extra,$args) = @_;
     
+    my $function = $args->{'function'} || &get_users_function();
+    my $domain   = $args->{'domain'}   || &determinedomain();
+    my $bgcolor  = $args->{'bgcolor'}  || &designparm($function.'.pgbg',$domain);
+    my $url = join(':',$env{'user.name'},$env{'user.domain'},
+		   $env{'environment.color.timestamp'},
+		   $function,$domain,$bgcolor);
+
+    $url = '/adm/css/'.&Apache::lonnet::escape($url).'.css';
+
     my $result =
 	'<head>'.
-	&standard_css($args->{'function'},$args->{'domain'},
-		      $args->{'bgcolor'}).
+	'<link rel="stylesheet" type="text/css" href="'.$url.'" />'.
 	&font_settings().
 	&Apache::lonhtmlcommon::htmlareaheaders();
 
Index: loncom/loncapa_apache.conf
diff -u loncom/loncapa_apache.conf:1.132 loncom/loncapa_apache.conf:1.133
--- loncom/loncapa_apache.conf:1.132	Fri Apr 21 16:28:36 2006
+++ loncom/loncapa_apache.conf	Mon May  8 14:54:27 2006
@@ -1,7 +1,7 @@
 ##
 ## loncapa_apache.conf -- Apache HTTP LON-CAPA configuration file
 ##
-## $Id: loncapa_apache.conf,v 1.132 2006/04/21 20:28:36 albertel Exp $
+## $Id: loncapa_apache.conf,v 1.133 2006/05/08 18:54:27 albertel Exp $
 ##
 
 #
@@ -1080,6 +1080,14 @@
 PerlHandler Apache::lonsupportreq
 </LocationMatch>
 
+<LocationMatch "^/adm/css">
+AuthType Basic
+Require valid-user
+PerlAuthzHandler       Apache::lonacc
+SetHandler perl-script
+PerlHandler Apache::loncss
+</LocationMatch>
+
 # ------------------------------------------------- Backdoor Adm Tests/Programs
 
 <Location /cgi-bin/loncron.pl>

Index: loncom/interface/loncss.pm
+++ loncom/interface/loncss.pm
# The LearningOnline Network with CAPA
# gerenates a lon-capa CSS response
#
# $Id: loncss.pm,v 1.1 2006/05/08 18:54:00 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
#
package Apache::loncss;

use strict;
use Apache::lonnet;
use Apache::loncommon;
use Apache::Constants qw(:common);
use POSIX qw(strftime);

sub handler {
    my ($r) = @_;

    my $url = $r->uri;
    $url =~ s{^/adm/css/}{};
    $url =~ s{ \.css $ }{}xms; 
	      
    my ($uname,$domain,$timestamp,$function,$domain,$bgcolor) = 
	split(':',$url);

    $r->content_type('text/css');
    my $date=strftime("%a, %d %b %Y %H:%M:%S GMT",gmtime(time+600));
    $r->header_out("Expires" => $date);
    
    $r->print(&Apache::loncommon::standard_css($function,$domain,$bgcolor));

    return OK;
}

1;
__END__