[LON-CAPA-cvs] cvs: loncom /interface loncss.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 05 Jun 2006 22:01:47 -0000


albertel		Mon Jun  5 18:01:47 2006 EDT

  Modified files:              
    /loncom/interface	loncss.pm 
  Log:
  - need to load env before generate css output
  
  
Index: loncom/interface/loncss.pm
diff -u loncom/interface/loncss.pm:1.1 loncom/interface/loncss.pm:1.2
--- loncom/interface/loncss.pm:1.1	Mon May  8 14:54:00 2006
+++ loncom/interface/loncss.pm	Mon Jun  5 18:01:46 2006
@@ -1,7 +1,7 @@
 # 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 $
+# $Id: loncss.pm,v 1.2 2006/06/05 22:01:46 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -32,6 +32,7 @@
 use Apache::loncommon;
 use Apache::Constants qw(:common);
 use POSIX qw(strftime);
+use CGI::Cookie();
 
 sub handler {
     my ($r) = @_;
@@ -46,7 +47,22 @@
     $r->content_type('text/css');
     my $date=strftime("%a, %d %b %Y %H:%M:%S GMT",gmtime(time+600));
     $r->header_out("Expires" => $date);
-    
+
+    my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
+    my $lonidsdir=$r->dir_config('lonIDsDir');
+
+    my $handle;
+    if ($cookies{'lonID'}) {
+	$handle=$cookies{'lonID'}->value;
+        $handle=~s/\W//g;
+    }
+
+    if ($handle ne '' 
+	&& -e $r->dir_config('lonIDsDir')."/$handle.id") {
+	&Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'),
+						 $handle);
+    }
+
     $r->print(&Apache::loncommon::standard_css($function,$domain,$bgcolor));
 
     return OK;