--- loncom/interface/loncommon.pm 2012/12/27 00:00:23 1.1107
+++ loncom/interface/loncommon.pm 2013/01/03 20:08:59 1.1109
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1107 2012/12/27 00:00:23 raeburn Exp $
+# $Id: loncommon.pm,v 1.1109 2013/01/03 20:08:59 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -67,6 +67,7 @@ use Apache::lonhtmlcommon();
use Apache::loncoursedata();
use Apache::lontexconvert();
use Apache::lonclonecourse();
+use Apache::lonuserutils();
use LONCAPA qw(:DEFAULT :match);
use DateTime::TimeZone;
use DateTime::Locale::Catalog;
@@ -13317,6 +13318,26 @@ sub commit_studentrole {
return $result;
}
+sub show_role_extent {
+ my ($scope,$context,$role) = @_;
+ $scope =~ s{^/}{};
+ my @courseroles = &Apache::lonuserutils::roles_by_context('course',1);
+ push(@courseroles,'co');
+ my @authorroles = &Apache::lonuserutils::roles_by_context('author');
+ if (($context eq 'course') || (grep(/^\Q$role\E/,@courseroles))) {
+ $scope =~ s{/}{_};
+ return ''.$env{'course.'.$scope.'.description'}.'';
+ } elsif (($context eq 'author') || (grep(/^\Q$role\E/,@authorroles))) {
+ my ($audom,$auname) = split(/\//,$scope);
+ return &mt('[_1] Author Space',''.
+ &Apache::loncommon::plainname($auname,$audom).'');
+ } else {
+ $scope =~ s{/$}{};
+ return &mt('Domain: [_1]',''.
+ &Apache::lonnet::domain($scope,'description').'');
+ }
+}
+
############################################################
############################################################
@@ -14332,7 +14353,7 @@ sub check_captcha {
output_folder => $captcha_params{'output_dir'},
data_folder => $captcha_params{'db_dir'},
);
- my $captcha_chk = $captcha->check_code($code,$md5sum);
+ $captcha_chk = $captcha->check_code($code,$md5sum);
my %captcha_hash = (
0 => 'Code not checked (file error)',
-1 => 'Failed: code expired',