--- loncom/interface/domainprefs.pm 2017/08/03 16:51:53 1.306
+++ loncom/interface/domainprefs.pm 2017/08/25 00:33:14 1.313
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.306 2017/08/03 16:51:53 raeburn Exp $
+# $Id: domainprefs.pm,v 1.313 2017/08/25 00:33:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6402,7 +6402,7 @@ sub user_formats_row {
}
$output .= '
'.
''.$rolename.' | '.
'';
@@ -9270,17 +9269,21 @@ sub modify_quotas {
#FIXME need to obsolete item in RES space
} elsif ($env{'form.'.$type.'_image_'.$i.'.filename'}) {
my ($cdom,$cnum) = split(/_/,$key);
- my ($imgurl,$error) = &process_textbook_image($r,$dom,$confname,$type.'_image_'.$i,
- $cdom,$cnum,$type,$configuserok,
- $switchserver,$author_ok);
- if ($imgurl) {
- $confhash{$type}{$key}{'image'} = $imgurl;
- $changes{$type}{$key} = 1;
+ if (&Apache::lonnet::homeserver($cnum,$cdom) eq 'no_host') {
+ $errors .= ''.&mt('Image not saved: could not find textbook course').'';
+ } else {
+ my ($imgurl,$error) = &process_textbook_image($r,$dom,$confname,$type.'_image_'.$i,
+ $cdom,$cnum,$type,$configuserok,
+ $switchserver,$author_ok);
+ if ($imgurl) {
+ $confhash{$type}{$key}{'image'} = $imgurl;
+ $changes{$type}{$key} = 1;
+ }
+ if ($error) {
+ &Apache::lonnet::logthis($error);
+ $errors .= ''.$error.'';
+ }
}
- if ($error) {
- &Apache::lonnet::logthis($error);
- $errors .= ''.$error.'';
- }
} elsif ($domconfig{$action}{$type}{$key}{'image'}) {
$confhash{$type}{$key}{'image'} =
$domconfig{$action}{$type}{$key}{'image'};
@@ -9313,15 +9316,19 @@ sub modify_quotas {
if ($type eq 'textbooks') {
if ($env{'form.'.$type.'_addbook_image.filename'} ne '') {
my ($cdom,$cnum) = split(/_/,$newbook{$type});
- my ($imageurl,$error) =
- &process_textbook_image($r,$dom,$confname,$type.'_addbook_image',$cdom,$cnum,$type,
- $configuserok,$switchserver,$author_ok);
- if ($imageurl) {
- $confhash{$type}{$newbook{$type}}{'image'} = $imageurl;
- }
- if ($error) {
- &Apache::lonnet::logthis($error);
- $errors .= ''.$error.'';
+ if (&Apache::lonnet::homeserver($cnum,$cdom) eq 'no_host') {
+ $errors .= ''.&mt('Image not saved: could not find textbook course').'';
+ } else {
+ my ($imageurl,$error) =
+ &process_textbook_image($r,$dom,$confname,$type.'_addbook_image',$cdom,$cnum,$type,
+ $configuserok,$switchserver,$author_ok);
+ if ($imageurl) {
+ $confhash{$type}{$newbook{$type}}{'image'} = $imageurl;
+ }
+ if ($error) {
+ &Apache::lonnet::logthis($error);
+ $errors .= ''.$error.'';
+ }
}
}
}
@@ -9813,7 +9820,7 @@ sub process_textbook_image {
} elsif ($author_ok eq 'ok') {
my ($result,$imageurl) =
&publishlogo($r,'upload',$caller,$dom,$confname,
- "$type/$dom/$cnum/cover",$width,$height);
+ "$type/$cdom/$cnum/cover",$width,$height);
if ($result eq 'ok') {
$url = $imageurl;
} else {
@@ -9896,7 +9903,7 @@ sub modify_ltitools {
}
if ($env{'form.ltitools_add_image.filename'} ne '') {
my ($imageurl,$error) =
- &process_ltitools_image($r,$dom,$confname,'ltitools_add_image',$dom,
+ &process_ltitools_image($r,$dom,$confname,'ltitools_add_image',$newid,
$configuserok,$switchserver,$author_ok);
if ($imageurl) {
$confhash{$newid}{'image'} = $imageurl;
@@ -9959,6 +9966,7 @@ sub modify_ltitools {
my $maxnum = $env{'form.ltitools_maxnum'};
for (my $i=0; $i<=$maxnum; $i++) {
my $itemid = $env{'form.ltitools_id_'.$i};
+ $itemid =~ s/\D+//g;
if (ref($domconfig{$action}{$itemid}) eq 'HASH') {
if ($deletions{$itemid}) {
if ($domconfig{$action}{$itemid}{'image'}) {
@@ -12072,7 +12080,7 @@ sub modify_selfcreation {
if (@types) {
if (@statuses) {
$chgtext .= &mt('Processing of requests to create account with e-mail verification set as follows:').
- '';
+ '';
foreach my $status (@statuses) {
if ($status eq 'default') {
$chgtext .= '- '.$othertitle.' -- '.$choices{$cancreate{'selfcreateprocessing'}{$status}}.'
';
@@ -12273,8 +12281,8 @@ sub modify_selfcreation {
}
}
$chgtext .= ' ';
+ my $typename;
if (@types) {
- my $typename;
if ($type eq 'default') {
$typename = $othertitle;
} else {
@@ -12290,10 +12298,9 @@ sub modify_selfcreation {
'';
} else {
$resulttext .= '- '.
- &mt('There are now no restrictions on e-mail addresses which may be used for verification when a user requests an account.',
- $usertypes{$type}).
+ &mt('There are now no restrictions on e-mail addresses which may be used for verification when a user requests an account.').
'
'.
- &mt('(Affiliation: [_1])',$type);
+ &mt('(Affiliation: [_1])',$typename);
}
}
}
|