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

raeburn raeburn at source.lon-capa.org
Sat Feb 22 13:12:10 EST 2014


raeburn		Sat Feb 22 18:12:10 2014 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm lonsearchcat.pm 
  Log:
  - Consistent behavior for Content Library items on Main Menu page and 
    Content Library Search page when no role selected.
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.426 loncom/interface/lonmenu.pm:1.427
--- loncom/interface/lonmenu.pm:1.426	Mon Jan  6 17:31:09 2014
+++ loncom/interface/lonmenu.pm	Sat Feb 22 18:12:09 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.426 2014/01/06 17:31:09 raeburn Exp $
+# $Id: lonmenu.pm,v 1.427 2014/02/22 18:12:09 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1229,7 +1229,10 @@
     my $pub=($env{'request.state'} eq 'published');
     my $con=($env{'request.state'} eq 'construct');
     my $rol=$env{'request.role'};
-    my $requested_domain = $env{'request.role.domain'};
+    my $requested_domain;
+    if ($rol) {
+       $requested_domain = $env{'request.role.domain'};
+    }
     foreach my $line (@desklines) {
         my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc,$cat)=split(/\:/,$line);
         $prt=~s/\$uname/$uname/g;
@@ -1243,7 +1246,13 @@
             next if ($crstype ne 'Community');
             $prt=~s/\$cmty/$crs/g;
         }
-        $prt=~s/\$requested_domain/$requested_domain/g;
+        if ($prt =~ m/\$requested_domain/) {
+            if ((!$requested_domain) && ($pro eq 'pbre') && ($env{'user.adv'})) {
+                $prt=~s/\$requested_domain/$env{'user.domain'}/g;
+            } else {
+                $prt=~s/\$requested_domain/$requested_domain/g;
+            }
+        }
         if ($category_names{$cat}!~/\w/) { $cat='oth'; }
         if ($pro eq 'clear') {
 	    $output.=&clear($row,$col);
@@ -1279,8 +1288,9 @@
                     next;
                 }
             }
-	    if (&Apache::lonnet::allowed($priv,$prt)) {
-               $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
+            if ((($priv eq 'bre') && (&Apache::lonnet::allowed($priv,$prt) eq 'F')) ||
+                (($priv ne 'bre') && (&Apache::lonnet::allowed($priv,$prt)))) {
+                $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
             }
         } elsif ($pro eq 'course')  {
             if (($env{'request.course.fn'}) && ($crstype ne 'Community')) {
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.341 loncom/interface/lonsearchcat.pm:1.342
--- loncom/interface/lonsearchcat.pm:1.341	Tue Jan 14 18:54:56 2014
+++ loncom/interface/lonsearchcat.pm	Sat Feb 22 18:12:09 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.341 2014/01/14 18:54:56 bisitz Exp $
+# $Id: lonsearchcat.pm,v 1.342 2014/02/22 18:12:09 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -170,7 +170,7 @@
     &Apache::lonhtmlcommon::clear_breadcrumbs();
 
     my @allowed_searches = ('portfolio');
-    if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'})) {
+    if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'}) eq 'F') {
         push(@allowed_searches,'res');
     } 
     my $crumb_text = 'Portfolio Search';
@@ -449,7 +449,7 @@
 					    $env{'form.catalogmode'} ne 'import');
     my $scrout = &Apache::loncommon::start_page('Content Library').$bread_crumb;
 # Search form for resource space 
-    if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'})) {
+    if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'}) eq 'F') {
         $scrout .= &setup_basic_search($r,'res',$hidden_fields,$closebutton);
         $scrout .= '<hr /><br />';
     }




More information about the LON-CAPA-cvs mailing list