[LON-CAPA-cvs] cvs: loncom(version_2_2_X) /interface lonpickcourse.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 11 Aug 2006 22:14:11 -0000


albertel		Fri Aug 11 18:14:11 2006 EDT

  Modified files:              (Branch: version_2_2_X)
    /loncom/interface	lonpickcourse.pm 
  Log:
  - backport 1.51 1.52
  
  
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.50.2.1 loncom/interface/lonpickcourse.pm:1.50.2.2
--- loncom/interface/lonpickcourse.pm:1.50.2.1	Thu Jun 29 13:44:03 2006
+++ loncom/interface/lonpickcourse.pm	Fri Aug 11 18:14:10 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a course
 #
-# $Id: lonpickcourse.pm,v 1.50.2.1 2006/06/29 17:44:03 albertel Exp $
+# $Id: lonpickcourse.pm,v 1.50.2.2 2006/08/11 22:14:10 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -53,7 +53,7 @@
 			       'cdomelement','cnameelement','roleelement',
                                'pickedcourse','instcodefilter',
                                'ownerfilter','coursefilter','multiple',
-                               'type']);
+                               'type','ownerdomfilter']);
 # domain filter and selection
     my $domainfilter=$env{'form.domainfilter'};
     $domainfilter=~s/\W//g;
@@ -70,8 +70,13 @@
     my $listinstcode=&HTML::Entities::encode($instcodefilter,'<>&"');
 # course owner filter
     my $ownerfilter=$env{'form.ownerfilter'};
-    unless ($ownerfilter) { $ownerfilter=''; }
+    $ownerfilter=~s/\W//g;
     my $listowner=&HTML::Entities::encode($ownerfilter,'<>&"');
+# course ownerdomain filter
+    my $ownerdomfilter=$env{'form.ownerdomfilter'};
+    $ownerdomfilter=~s/\W//g;
+    my $ownerdomselectform=
+       &Apache::loncommon::select_dom_form($ownerdomfilter,'ownerdomfilter',1);
 # course ID filter for DCs only
     my ($courseidtag,$coursefilter);
     if ($env{'user.adv'} && $domainfilter && exists($env{'user.role.dc./'.
@@ -243,6 +248,7 @@
 	      'cdo' => &mt('[_1] Domain',$type),
               'cin' => &mt('Course Institutional Code'),
               'cow' => &mt("[_1] Owner's Username",$type),
+              'cod' => &mt("[_1] Owner's Domain", $type),
               'cog' => &mt('Course or Group')
              );
    
@@ -272,10 +278,9 @@
     }
     my $instcodeform;
     if ($type eq 'Course') {
-        $instcodeform = $lt{'cin'}.':<input type="text" name="instcodefilter" 
+        $instcodeform = $lt{'cin'}.': <input type="text" name="instcodefilter" 
  size="10" value="'.$listinstcode.'" /><br />';
     }
-
     my %elements = (
                      Course => {
                                  name  => 'coursepick',
@@ -403,6 +408,8 @@
 $lt{'cow'}:
 <input type="text" name="ownerfilter" size="10" value="$listowner" />
 <br />
+$lt{'cod'}: $ownerdomselectform
+<br />
 $courseidtag
 $lt{'cde'}:
 <input type="text" name="descriptfilter" size="40" value="$listdescript" />
@@ -416,13 +423,17 @@
         $r->rflush();
 	unless ($descriptfilter) { $descriptfilter='.'; }
         unless ($instcodefilter) { $instcodefilter='.'; }
-        unless ($ownerfilter) { $ownerfilter='.'; }
-        unless ($coursefilter) { $coursefilter='.'; }
-        unless ($type) { $type = '.'; }
+        my $combownerfilter;
+        if (($ownerfilter ne '') || ($ownerdomfilter ne '')) {
+            $combownerfilter = $ownerfilter.':'.$ownerdomfilter;
+        }
+        if ($combownerfilter eq '') { $combownerfilter='.'; }
+        if ($coursefilter eq '') { $coursefilter='.'; }
+        if ($type eq '') { $type = '.'; }
         my $timefilter=($sincefilter==-1?1:time-$sincefilter);
-	my %courses=
-	    &Apache::lonnet::courseiddump
-	    ($domainfilter,$descriptfilter,$timefilter,$instcodefilter,$ownerfilter,$coursefilter,undef,undef,$type);
+	my %courses = &Apache::lonnet::courseiddump($domainfilter,$descriptfilter,
+                                     $timefilter,$instcodefilter,$combownerfilter,
+                                     $coursefilter,undef,undef,$type);
 	$r->print('<form name="courselist" method="post" action="/adm/pickcourse">');
 	my %by_descrip;
         my $numcourses = keys(%courses);