[LON-CAPA-cvs] cvs: loncom(version_2_8_X) /interface lonaboutme.pm
raeburn
raeburn@source.lon-capa.org
Thu, 11 Dec 2008 16:46:50 -0000
raeburn Thu Dec 11 16:46:50 2008 EDT
Modified files: (Branch: version_2_8_X)
/loncom/interface lonaboutme.pm
Log:
Backport 1.77, 1.80.
Index: loncom/interface/lonaboutme.pm
diff -u loncom/interface/lonaboutme.pm:1.70 loncom/interface/lonaboutme.pm:1.70.2.1
--- loncom/interface/lonaboutme.pm:1.70 Thu Sep 11 02:07:27 2008
+++ loncom/interface/lonaboutme.pm Thu Dec 11 16:46:50 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network
# "About Me" Personal Information
#
-# $Id: lonaboutme.pm,v 1.70 2008/09/11 02:07:27 raeburn Exp $
+# $Id: lonaboutme.pm,v 1.70.2.1 2008/12/11 16:46:50 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -60,6 +60,30 @@
$is_course = &Apache::lonnet::is_course($cdom,$cnum);
}
+ my $candisplay = 1;
+ if (!$is_course) {
+ if ($action ne 'portfolio') {
+ $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',
@@ -74,15 +98,23 @@
# ----------------------------------------------- Available Portfolio file display
if (($target ne 'tex') && ($action eq 'portfolio')) {
&display_portfolio_header($r,$is_course);
- my ($blocked,$blocktext) =
- &Apache::loncommon::blocking_status('port',$cnum,$cdom);
- if (!$blocked) {
- &display_portfolio_files($r,$is_course);
+ if ((!$is_course) && (!&Apache::lonnet::usertools_access($cnum,$cdom,'portfolio'))) {
+ $r->print('<h2>'.&mt('No user portfolio available') .'</h2>'.
+ &mt('This is a result of one of the following:').'<ul>'.
+ '<li>'.&mt('The administrator of this domain has disabled portfolio functionality for this specific user.').'</li>'.
+ '<li>'.&mt('The domain has been configured to disable, by default, portfolio functionality for all users in the domain.').'</li>'.
+ '</ul>');
} else {
- $r->print($blocktext);
+ my ($blocked,$blocktext) =
+ &Apache::loncommon::blocking_status('port',$cnum,$cdom);
+ if (!$blocked) {
+ &display_portfolio_files($r,$is_course);
+ } else {
+ $r->print($blocktext);
+ }
+ $r->print(&Apache::loncommon::end_page());
+ return OK;
}
- $r->print(&Apache::loncommon::end_page());
- return OK;
}
if ($is_course) {
@@ -675,5 +707,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__