[LON-CAPA-cvs] cvs: loncom /interface lonrss.pm

raeburn raeburn@source.lon-capa.org
Mon, 08 Dec 2008 23:16:46 -0000


raeburn		Mon Dec  8 23:16:46 2008 EDT

  Modified files:              
    /loncom/interface	lonrss.pm 
  Log:
    - Bug 5839. DCs can set availability of User Tools.
      Display appropriate message if Blog is unavailable for the user.
  
  
Index: loncom/interface/lonrss.pm
diff -u loncom/interface/lonrss.pm:1.38 loncom/interface/lonrss.pm:1.39
--- loncom/interface/lonrss.pm:1.38	Tue Nov 11 10:45:22 2008
+++ loncom/interface/lonrss.pm	Mon Dec  8 23:16:46 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # RSS Feeder
 #
-# $Id: lonrss.pm,v 1.38 2008/11/11 10:45:22 amueller Exp $
+# $Id: lonrss.pm,v 1.39 2008/12/08 23:16:46 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -303,9 +303,21 @@
     my $filterfeedname=&filterfeedname($filename);
     my $feedname=&feedname($filename);
     my ($displayfeedname,$displayoption)=&displayfeedname($filename,$uname,$udom);
-    my ($blocked,$blocktext);
+    my ($blocked,$blocktext,$disabled,$disabletext);
     if (!&Apache::lonnet::is_course($udom,$uname)) {
         ($blocked,$blocktext) = &blocking_blogdisplay($uname,$udom,$html,$filterfeedname);
+        $disabled = &Apache::lonnet::usertools_access($uname,$udom,'blog');
+        if ($disabled) {
+            if ($html) {
+                $disabletext = '<h2>'.&mt('No user blog available') .'</h2>'.
+                               &mt('This is a result of one of the following:').'<ul>'.
+                               '<li>'.&mt('The administrator of this domain has disabled blog functionality for this specific user.').'</li>'.
+                               '<li>'.&mt('The domain has been configured to disable, by default, blog functionality for all users in the domain.').'</li>'.
+                               '</ul>';
+            } else {
+                $disabletext = &mt('No user blog available');
+            }
+        }
     }
     if ($html) {
 	my $title = $displayfeedname?$displayfeedname
@@ -329,7 +341,7 @@
     my $newid = &get_new_feed_id();
 # Is this user for real?
     my $homeserver=&Apache::lonnet::homeserver($uname,$udom);
-    if ($html && !$blocked) {
+    if ($html && !$blocked && !&disabled) {
 # Any new feeds or renaming of feeds?
 	if ($edit) {
 # Hide a feed?
@@ -361,6 +373,9 @@
     } elsif ($blocked) {
         $r->print($blocktext);
         $r->print(($html?&Apache::loncommon::end_page():'</channel></rss>'."\n"));
+    } elsif ($disabled) {
+        $r->print($disabletext);
+        $r->print(($html?&Apache::loncommon::end_page():'</channel></rss>'."\n"));
     } else { # is indeed a user
 # Course or user?
 	my $name='';