[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm
raeburn
lon-capa-cvs-allow@mail.lon-capa.org
Fri, 04 Jan 2008 17:47:51 -0000
raeburn Fri Jan 4 12:47:51 2008 EDT
Modified files:
/loncom/interface domainprefs.pm
Log:
- need to repcopy domain logos (thumbnails and fullsize) in /res before serving via lonhttpd (lonhttpd doesn't know about repcopy itself).
- if $domainconfig->{'roles'} does not yet exist as a HASH, make it an anonymous hash to inhibit occasional ISEs.
- Keys for domain roles retrieved for a user by &lonnet::get_my_roles() are in the form :$domain:$role.
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.39 loncom/interface/domainprefs.pm:1.40
--- loncom/interface/domainprefs.pm:1.39 Fri Jan 4 05:17:13 2008
+++ loncom/interface/domainprefs.pm Fri Jan 4 12:47:51 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.39 2008/01/04 10:17:13 raeburn Exp $
+# $Id: domainprefs.pm,v 1.40 2008/01/04 17:47:51 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -836,8 +836,26 @@
}
}
if ($showfile) {
- $showfile = &Apache::loncommon::lonhttpdurl($showfile);
- $fullsize = &Apache::loncommon::lonhttpdurl($imgfile);
+ if ($showfile =~ m{^/(adm|res)/}) {
+ if ($showfile =~ m{^/res/}) {
+ my $local_showfile =
+ &Apache::lonnet::filelocation('',$showfile);
+ &Apache::lonnet::repcopy($local_showfile);
+ }
+ $showfile = &Apache::loncommon::lonhttpdurl($showfile);
+ }
+ if ($imgfile) {
+ if ($imgfile =~ m{^/(adm|res)/}) {
+ if ($imgfile =~ m{^/res/}) {
+ my $local_imgfile =
+ &Apache::lonnet::filelocation('',$imgfile);
+ &Apache::lonnet::repcopy($local_imgfile);
+ }
+ $fullsize = &Apache::loncommon::lonhttpdurl($imgfile);
+ } else {
+ $fullsize = $imgfile;
+ }
+ }
$datatable.= '<td>';
if (!$is_custom->{$img}) {
$datatable .= &mt('Default in use:').'<br />';
@@ -1904,6 +1922,9 @@
}
}
my ($width,$height) = &thumb_dimensions();
+ if (ref($domconfig->{$role}) ne 'HASH') {
+ $domconfig->{$role} = {};
+ }
foreach my $img (@images) {
if ( ! $env{'form.'.$role.'_'.$img.'.filename'}
&& !defined($domconfig->{$role}{$img})
@@ -2145,7 +2166,7 @@
sub check_authorstatus {
my ($dom,$confname,%currroles) = @_;
my $author_ok;
- if (!$currroles{$confname.':'.$dom.':au'}) {
+ if (!$currroles{':'.$dom.':au'}) {
my $start = time;
my $end = 0;
$author_ok =