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

raeburn raeburn at source.lon-capa.org
Tue Jan 1 14:58:12 EST 2013


raeburn		Tue Jan  1 19:58:12 2013 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	loncommon.pm 
  Log:
  - For 2.11
    - Backport 1.1108
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1075.2.24 loncom/interface/loncommon.pm:1.1075.2.25
--- loncom/interface/loncommon.pm:1.1075.2.24	Fri Dec 28 02:03:13 2012
+++ loncom/interface/loncommon.pm	Tue Jan  1 19:58:11 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1075.2.24 2012/12/28 02:03:13 raeburn Exp $
+# $Id: loncommon.pm,v 1.1075.2.25 2013/01/01 19:58:11 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -67,6 +67,7 @@
 use Apache::loncoursedata();
 use Apache::lontexconvert();
 use Apache::lonclonecourse();
+use Apache::lonuserutils();
 use LONCAPA qw(:DEFAULT :match);
 use DateTime::TimeZone;
 use DateTime::Locale::Catalog;
@@ -13296,6 +13297,26 @@
     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/, at courseroles))) {
+        $scope =~ s{/}{_};
+        return '<span class="LC_cusr_emph">'.$env{'course.'.$scope.'.description'}.'</span>';
+    } elsif (($context eq 'author') || (grep(/^\Q$role\E/, at authorroles))) {
+        my ($audom,$auname) = split(/\//,$scope);
+        return &mt('[_1] Author Space','<span class="LC_cusr_emph">'.
+                   &Apache::loncommon::plainname($auname,$audom).'</span>');
+    } else {
+        $scope =~ s{/$}{};
+        return &mt('Domain: [_1]','<span class="LC_cusr_emph">'.
+                   &Apache::lonnet::domain($scope,'description').'</span>');
+    }
+}
+
 ############################################################
 ############################################################
 




More information about the LON-CAPA-cvs mailing list