[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonmenu.pm
raeburn
raeburn@source.lon-capa.org
Mon, 18 May 2009 16:29:56 -0000
raeburn Mon May 18 16:29:56 2009 EDT
Modified files:
/loncom/interface lonmenu.pm loncommon.pm
Log:
- Moved &show_course() from lonmenu.pm to loncommon.pm to permit reuse.
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.265 loncom/interface/lonmenu.pm:1.266
--- loncom/interface/lonmenu.pm:1.265 Sat May 16 18:06:41 2009
+++ loncom/interface/lonmenu.pm Mon May 18 16:29:55 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.265 2009/05/16 18:06:41 tempelho Exp $
+# $Id: lonmenu.pm,v 1.266 2009/05/18 16:29:55 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -51,8 +51,6 @@
=over
-=item show_course()
-
Little texts
=item initlittle()
@@ -150,27 +148,11 @@
my @inlineremote;
-
-
-sub show_course {
- my $course = !$env{'user.adv'};
- if (!$env{'user.adv'}) {
- foreach my $env (keys(%env)) {
- next if ($env !~ m/^user\.priv\./);
- if ($env !~ m/^user\.priv\.(?:st|cm)/) {
- $course = 0;
- last;
- }
- }
- }
- return $course;
-}
-
sub initlittle {
return &Apache::lonlocal::texthash('ret' => 'Return to Last Location',
'nav' => 'Navigate Contents',
'main' => 'Main Menu',
- 'roles' => (&show_course()?
+ 'roles' => (&Apache::loncommon::show_course()?
'Courses':'Roles'),
'other' => 'Other Roles',
'docs' => 'Edit Course',
@@ -1206,7 +1188,7 @@
my $uname=$env{'user.name'};
my $udom=$env{'user.domain'};
my $adv=$env{'user.adv'};
- my $show_course=&show_course();
+ my $show_course=&Apache::loncommon::show_course();
my $author=$env{'user.author'};
my $crs='';
if ($env{'request.course.id'}) {
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.820 loncom/interface/loncommon.pm:1.821
--- loncom/interface/loncommon.pm:1.820 Mon May 18 16:08:07 2009
+++ loncom/interface/loncommon.pm Mon May 18 16:29:55 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.820 2009/05/18 16:08:07 raeburn Exp $
+# $Id: loncommon.pm,v 1.821 2009/05/18 16:29:55 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6794,6 +6794,38 @@
=pod
+=item * &show_course()
+
+Used by lonmenu.pm and lonroles.pm to determine whether to use the word
+'Courses' or 'Roles' in inline navigation and on screen displaying user's roles.
+
+Inputs:
+None
+
+Outputs:
+Scalar: 1 if 'Course' to be used, 0 otherwise.
+
+=cut
+
+###############################################
+sub show_course {
+ my $course = !$env{'user.adv'};
+ if (!$env{'user.adv'}) {
+ foreach my $env (keys(%env)) {
+ next if ($env !~ m/^user\.priv\./);
+ if ($env !~ m/^user\.priv\.(?:st|cm)/) {
+ $course = 0;
+ last;
+ }
+ }
+ }
+ return $course;
+}
+
+###############################################
+
+=pod
+
=item * &check_user_status()
Determines current status of supplied role for a