[LON-CAPA-cvs] cvs: loncom /interface lonaboutme.pm
raeburn
raeburn@source.lon-capa.org
Mon, 08 Dec 2008 23:13:52 -0000
raeburn Mon Dec 8 23:13:52 2008 EDT
Modified files:
/loncom/interface lonaboutme.pm
Log:
- Bug 5839. DCs can set availability of User Tools.
- Display appropriate message if "About Me" page is unavailable for the user.
- Users with srm and/or dff privilege, will override this, if trying to display the page for a user in a course, when in course context
- preserves access to records of messages, face-to-face discussions etc.
- preserves acces to activity log.
Index: loncom/interface/lonaboutme.pm
diff -u loncom/interface/lonaboutme.pm:1.76 loncom/interface/lonaboutme.pm:1.77
--- loncom/interface/lonaboutme.pm:1.76 Tue Dec 2 23:35:21 2008
+++ loncom/interface/lonaboutme.pm Mon Dec 8 23:13:52 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network
# "About Me" Personal Information
#
-# $Id: lonaboutme.pm,v 1.76 2008/12/02 23:35:21 harmsja Exp $
+# $Id: lonaboutme.pm,v 1.77 2008/12/08 23:13:52 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -108,6 +108,28 @@
$is_course = &Apache::lonnet::is_course($cdom,$cnum);
}
+ my $candisplay = 1;
+ if (!$is_course) {
+ $candisplay = &Apache::lonnet::usertools_access($cnum,$cdom,'aboutme');
+ if ((!$candisplay) && ($env{'request.course.id'})) {
+ $candisplay = &aboutme_access($cnum,$cdom);
+ }
+ if (!$candisplay) {
+ if ($target eq 'tex') {
+ $r->print('\noindent{\large\textbf{'.&mt('No user home page available').'}}\\\\\\\\');
+ } else {
+ $r->print(&Apache::loncommon::start_page("Personal Information"));
+ $r->print('<h2>'.&mt('No user home page available') .'</h2>'.
+ &mt('This is a result of one of the following:').'<ul>'.
+ '<li>'.&mt('The administrator of this domain has disabled home page functionality for this specific user.').'</li>'.
+ '<li>'.&mt('The domain has been configured to disable, by default, home page functionality for all users in the domain.').'</li>'.
+ '</ul>');
+ $r->print(&Apache::loncommon::end_page());
+ }
+ return OK;
+ }
+ }
+
# --------------------------------------------------------- The syllabus fields
my %syllabusfields=&Apache::lonlocal::texthash(
'aaa_contactinfo' => 'Contact Information',
@@ -728,5 +750,28 @@
return $output;
}
+sub aboutme_access {
+ my ($uname,$udom) = @_;
+ my $privcheck = $env{'request.course.id'};
+ my $sec;
+ if ($env{'request.course.sec'} ne '') {
+ $sec = $env{'request.course.sec'};
+ $privcheck .= '/'.$sec;
+ }
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ if (($cdom eq '') || ($cnum eq '')) {
+ my %coursehash = &coursedescription($env{'request.course.id'});
+ $cdom = $coursehash{'domain'};
+ $cnum = $coursehash{'cnum'};
+ }
+ if ((&allowed('srm',$privcheck)) || (&allowed('dff',$privcheck))) {
+ if (&in_course($uname,$udom,$cnum,$cdom)) {
+ return 1;
+ }
+ }
+ return;
+}
+
1;
__END__