[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Mon, 14 Jul 2008 10:21:53 -0000


raeburn		Mon Jul 14 06:21:53 2008 EDT

  Modified files:              
    /loncom/auth	lonroles.pm 
  Log:
  - use showdom in coursecatalog query string to default to display of the course catalog for an appropriate domain.
  - eliminate duplicate declaration ($cdom, $cnum).     
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.200 loncom/auth/lonroles.pm:1.201
--- loncom/auth/lonroles.pm:1.200	Tue Jul  8 16:16:16 2008
+++ loncom/auth/lonroles.pm	Mon Jul 14 06:21:52 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.200 2008/07/08 20:16:16 raeburn Exp $
+# $Id: lonroles.pm,v 1.201 2008/07/14 10:21:52 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -43,6 +43,7 @@
 use Apache::lonnavdisplay();
 use GDBM_File;
 use LONCAPA qw(:DEFAULT :match);
+use HTML::Entities;
  
 
 sub redirect_user {
@@ -675,7 +676,8 @@
     } else {
         if ($countactive > 0) {
             my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
-            $r->print('<p>'.&mt('[_1]Visit the [_2]Course Catalog[_3] to view all [_4] LON-CAPA courses.','<b>','<a href="/adm/coursecatalog">','</a></b>',$domdesc).'<br />'.&mt('If a course is [_1]not[_2] in your list of current courses below, you may be able to enroll if self-enrollment is permitted.','<b>','</b>').'</p>');
+            my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); 
+            $r->print('<p>'.&mt('[_1]Visit the [_2]Course Catalog[_3] to view all [_4] LON-CAPA courses.','<b>','<a href="/adm/coursecatalog?showdom='.$esc_dom.'">','</a></b>',$domdesc).'<br />'.&mt('If a course is [_1]not[_2] in your list of current courses below, you may be able to enroll if self-enrollment is permitted.','<b>','</b>').'</p>');
         }
     }
 
@@ -791,11 +793,13 @@
     }
     $r->print(&Apache::lonnet::getannounce());
     if ($advanced) {
+        my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');
 	$r->print('<p><small><i>'
                  .&mt('This is LON-CAPA [_1]',$r->dir_config('lonVersion'))
 		 .'</i><br />'
 		 .'<a href="/adm/logout">'.&mt('Logout').'</a>&nbsp;&nbsp;'
-                 .'<a href="/adm/coursecatalog">'.&mt('Course Catalog')
+                 .'<a href="/adm/coursecatalog?showdom='.$esc_dom.'">'
+                 .&mt('Course Catalog')
                  .'</small></p>');
     }
     $r->print(&Apache::loncommon::end_page());
@@ -866,6 +870,7 @@
 sub findcourse_advice {
     my ($r) = @_;
     my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
+    my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');
     if (&Apache::lonnet::auto_run(undef,$env{'user.domain'})) {
         $r->print(&mt('If you were expecting to see an active role listed for a particular course in the [_1] domain, it may be missing for one of the following reasons:',$domdesc).'
 <ul>
@@ -878,7 +883,7 @@
     } else {
         $r->print(&mt('If you were expecting to see an active role listed for a particular course, that course may not have been created yet.').'<br />');
     }
-    $r->print('<p>'.&mt('The [_1]Course Catalog[_2] provides information about all [_3] classes for which LON-CAPA courses have been created.','<a href="/adm/coursecatalog">','</a>',$domdesc).'<br />');
+    $r->print('<p>'.&mt('The [_1]Course Catalog[_2] provides information about all [_3] classes for which LON-CAPA courses have been created.','<a href="/adm/coursecatalog?showdom='.$esc_dom.'">','</a>',$domdesc).'<br />');
     $r->print(&mt('You can search the course catalog for courses which permit self-enrollment, if you would like to enroll in a course.').'</p>');
     return;
 }
@@ -1069,8 +1074,8 @@
 sub adhoc_course_role {
     my ($then) = @_; 
     my ($cdom,$cnum);
-    my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
-    my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+    $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+    $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
     if (&check_forcc($cdom,$cnum,$then)) {
         my $setprivs;
         if (!defined($env{'user.role.'.$env{'form.switchrole'}})) {