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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 22 Jun 2007 17:42:46 -0000


albertel		Fri Jun 22 13:42:46 2007 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  - need to repcopy subscribale images (lonhttpd doesn't know how so need
    to do it before shipping out the img)
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.537 loncom/interface/loncommon.pm:1.538
--- loncom/interface/loncommon.pm:1.537	Mon Jun 18 19:19:12 2007
+++ loncom/interface/loncommon.pm	Fri Jun 22 13:42:46 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.537 2007/06/18 23:19:12 albertel Exp $
+# $Id: loncommon.pm,v 1.538 2007/06/22 17:42:46 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -378,7 +378,7 @@
     my ($domainfilter,$sec_element,$formname)=@_;
     my $crs_or_grp_alert = &mt('Please select the type of LON-CAPA entity - Course or Group - for which you wish to add/modify a user role');
    my $output = '
-<script type="text/javascript" language="Javascript" >
+<script type="text/javascript">
     var stdeditbrowser;'."\n";
    $output .= <<"ENDSTDBRW";
     function opencrsbrowser(formname,uname,udom,desc,extra_element,multflag,crstype) {
@@ -3253,8 +3253,12 @@
     # See if there is a logo
     if ($designhash{$domain.'.login.domlogo'} ne '') {
         my $imgsrc = $designhash{$domain.'.login.domlogo'};
-        if ($imgsrc =~ /^\/(adm|res)/) {
-            $imgsrc = &lonhttpdurl($imgsrc);
+        if ($imgsrc =~ m{^/(adm|res)/}) {
+	    if ($imgsrc =~ m{^/res/}) {
+		my $local_name = &Apache::lonnet::filelocation('',$imgsrc);
+		&Apache::lonnet::repcopy($local_name);
+	    }
+	   $imgsrc = &lonhttpdurl($imgsrc);
         } 
         return '<img src="'.$imgsrc.'" alt="'.$domain.'" />';
     } elsif (defined(&Apache::lonnet::domain($domain,'description'))) {
@@ -3303,7 +3307,11 @@
     }
     if (($which =~ /^(student|coordinator|author|admin)\.img$/) ||
         ($which =~ /login\.(img|logo|domlogo)/)) {
-        if ($output =~ /^\/(adm|res)\//) {
+        if ($output =~ m{^/(adm|res)/}) {
+	    if ($output =~ m{^/res/}) {
+		my $local_name = &Apache::lonnet::filelocation('',$output);
+		&Apache::lonnet::repcopy($local_name);
+	    }
             $output = &lonhttpdurl($output);
         }
     }