[LON-CAPA-cvs] cvs: loncom /interface lonpopulate.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 10 Aug 2006 22:05:19 -0000
albertel Thu Aug 10 18:05:19 2006 EDT
Modified files:
/loncom/interface lonpopulate.pm
Log:
- BUG#4962 - photo selection screen failed to work witha username:domain style course owner
Index: loncom/interface/lonpopulate.pm
diff -u loncom/interface/lonpopulate.pm:1.47 loncom/interface/lonpopulate.pm:1.48
--- loncom/interface/lonpopulate.pm:1.47 Thu Aug 10 17:46:40 2006
+++ loncom/interface/lonpopulate.pm Thu Aug 10 18:05:18 2006
@@ -1,5 +1,5 @@
# automated enrollment configuration handler
-# $Id: lonpopulate.pm,v 1.47 2006/08/10 21:46:40 albertel Exp $
+# $Id: lonpopulate.pm,v 1.48 2006/08/10 22:05:18 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -945,18 +945,12 @@
my ($result,$perm_reqd)=&Apache::lonnet::auto_photo_permission($crs,$dom);
my $can_enable = 1;
my $institution = $Apache::lonnet::domaindescription{$dom};
- my $user;
- if ($enrollvar{'courseowner'} =~ /^[^:]+:[^:]+$/) {
- $user = $env{'user.name'}.':'.$env{'user.domain'};
- } else {
- $user = $env{'user.name'};
- }
if ($result eq 'ok') {
if ($perm_reqd eq 'yes') {
if (!($enrollvar{'photopermission'} eq 'yes')) {
$can_enable = 0;
} else {
- if ($user eq $enrollvar{'courseowner'}) {
+ if (&user_is_courseowner($enrollvar{'courseowner'})) {
$r->print('
<tr>
<td>'.
@@ -989,7 +983,7 @@
</tr>
');
} else {
- if ($user eq $enrollvar{'courseowner'}) {
+ if (&user_is_courseowner($enrollvar{'courseowner'})) {
$r->print('
<tr>
<td>'.
@@ -2283,7 +2277,7 @@
$dom,$crs);
my ($showphotos,$response);
if (exists($env{'form.cancel_agreement'})) {
- if ($env{'user.name'} eq $settings{'internal.courseowner'}) {
+ if (&user_is_courseowner($settings{'internal.courseowner'})) {
my %cenv = (
'internal.photopermission' => 'no',
);
@@ -2353,7 +2347,7 @@
my ($r,$realm,$dom,$crs,$action,$tasktitleref,$conditions,$courseowner)=@_;
my $response;
my $institution = $Apache::lonnet::domaindescription{$dom};
- if ($env{'user.name'} eq $courseowner) {
+ if (&user_is_courseowner($courseowner)) {
$response = '
<script type="text/javascript">
function agreement_result(caller) {
@@ -2984,6 +2978,17 @@
return 'ok';
}
+sub user_is_courseowner {
+ my ($courseowner) = @_;
+ my $user;
+ if ($courseowner =~ /^[^:]+:[^:]+$/) {
+ $user = $env{'user.name'}.':'.$env{'user.domain'};
+ } else {
+ $user = $env{'user.name'};
+ }
+ return ($user eq $courseowner);
+}
+
###################################################################
sub handler {
my $r = shift;