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

amueller amueller@source.lon-capa.org
Tue, 20 Oct 2009 10:19:27 -0000


This is a MIME encoded message

--amueller1256033967
Content-Type: text/plain

amueller		Tue Oct 20 10:19:27 2009 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  --lonparmset: Codestyling for subroutine assessparms, before I commit my effective code changes for lonparmset
  
  
--amueller1256033967
Content-Type: text/plain
Content-Disposition: attachment; filename="amueller-20091020101927.txt"

Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.471 loncom/interface/lonparmset.pm:1.472
--- loncom/interface/lonparmset.pm:1.471	Thu Sep  3 16:58:17 2009
+++ loncom/interface/lonparmset.pm	Tue Oct 20 10:19:26 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.471 2009/09/03 16:58:17 raeburn Exp $
+# $Id: lonparmset.pm,v 1.472 2009/10/20 10:19:26 amueller Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2010,7 +2010,7 @@
     } elsif ($udom=$env{'request.role.domain'}) {
     } elsif ($udom=$env{'user.domain'}) {
     } else {
-	$udom=$r->dir_config('lonDefDomain');
+		$udom=$r->dir_config('lonDefDomain');
     }
     
 
@@ -2032,62 +2032,61 @@
 
     if (($env{'form.command'} eq 'set') && ($env{'form.url'})
 	&& (!$env{'form.dis'})) {
-	my $url=$env{'form.url'};
-	$url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
-	$pssymb=&Apache::lonnet::symbread($url);
-	if (!@pscat) { @pscat=('all'); }
-	$pschp='';
+		my $url=$env{'form.url'};
+		$url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
+		$pssymb=&Apache::lonnet::symbread($url);
+		if (!@pscat) { @pscat=('all'); }
+		$pschp='';
         $parmlev = 'full';
     } elsif ($env{'form.symb'}) {
-	$pssymb=$env{'form.symb'};
-	if (!@pscat) { @pscat=('all'); }
-	$pschp='';
+		$pssymb=$env{'form.symb'};
+		if (!@pscat) { @pscat=('all'); }
+		$pschp='';
         $parmlev = 'full';
     } else {
-	$env{'form.url'}='';
+		$env{'form.url'}='';
     }
 
     my $id=$env{'form.id'};
     if (($id) && ($udom)) {
-	$uname=(&Apache::lonnet::idget($udom,$id))[1];
-	if ($uname) {
-	    $id='';
-	} else {
-	    $message=
-		'<span class="LC_error">'.&mt("Unknown ID")." '$id' ".
-		&mt('at domain')." '$udom'</span>";
-	}
+		$uname=(&Apache::lonnet::idget($udom,$id))[1];
+		if ($uname) {
+	    	$id='';
+		} else {
+	    	$message=
+			'<span class="LC_error">'.&mt("Unknown ID")." '$id' ".
+			&mt('at domain')." '$udom'</span>";
+		}
     } else {
-	$uname=$env{'form.uname'};
+		$uname=$env{'form.uname'};
     }
     unless ($udom) { $uname=''; }
     $uhome='';
     if ($uname) {
-	$uhome=&Apache::lonnet::homeserver($uname,$udom);
+		$uhome=&Apache::lonnet::homeserver($uname,$udom);
         if ($uhome eq 'no_host') {
-	    $message=
-		'<span class="LC_error">'.&mt("Unknown user")." '$uname' ".
-		&mt("at domain")." '$udom'</span>";
-	    $uname='';
+	    	$message=
+			'<span class="LC_error">'.&mt("Unknown user")." '$uname' ".
+			&mt("at domain")." '$udom'</span>";
+	    	$uname='';
         } else {
-	    $csec=&Apache::lonnet::getsection($udom,$uname,
+	    	$csec=&Apache::lonnet::getsection($udom,$uname,
 					      $env{'request.course.id'});
-
-	    if ($csec eq '-1') {
-		$message='<span class="LC_error">'.
-		    &mt("User")." '$uname' ".&mt("at domain")." '$udom' ".
-		    &mt("not in this course")."</span>";
-		$uname='';
-		$csec=$env{'form.csec'};
+	    	if ($csec eq '-1') {
+				$message='<span class="LC_error">'.
+		    	&mt("User")." '$uname' ".&mt("at domain")." '$udom' ".
+		    	&mt("not in this course")."</span>";
+				$uname='';
+				$csec=$env{'form.csec'};
                 $cgroup=$env{'form.cgroup'};
-	    } else {
-		my %name=&Apache::lonnet::userenvironment($udom,$uname,
-		      ('firstname','middlename','lastname','generation','id'));
-		$message="\n<p>\n".&mt("Full Name").": ".
-		    $name{'firstname'}.' '.$name{'middlename'}.' '
-			.$name{'lastname'}.' '.$name{'generation'}.
+	    	} else {
+				my %name=&Apache::lonnet::userenvironment($udom,$uname,
+		      	('firstname','middlename','lastname','generation','id'));
+				$message="\n<p>\n".&mt("Full Name").": ".
+		    	$name{'firstname'}.' '.$name{'middlename'}.' '
+				.$name{'lastname'}.' '.$name{'generation'}.
 			    "<br />\n".&mt('ID').": ".$name{'id'}.'<p>';
-	    }
+	    	}
             @usersgroups = &Apache::lonnet::get_users_groups(
                                        $udom,$uname,$env{'request.course.id'});
             if (@usersgroups > 0) {
@@ -2114,7 +2113,7 @@
         my @markers=split(/\&\&\&/,$env{'form.pres_marker'});
         my @values=split(/\&\&\&/,$env{'form.pres_value'});
         my @types=split(/\&\&\&/,$env{'form.pres_type'});
-	for (my $i=0;$i<=$#markers;$i++) {
+		for (my $i=0;$i<=$#markers;$i++) {
             if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) {
                 my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
                 my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
@@ -2148,13 +2147,13 @@
                     }
                 }
             }
-	    $message.=&storeparm(split(/\&/,$markers[$i]),
+	    	$message.=&storeparm(split(/\&/,$markers[$i]),
 				 $values[$i],
 				 $types[$i],
 				 $uname,$udom,$csec,$cgroup);
-	}
+		}
 # ---------------------------------------------------------------- Done storing
-        $message.='<p class="LC_warning">'
+    	$message.='<p class="LC_warning">'
                  .&mt('Changes can take up to 10 minutes before being active for all students.')
                  .&Apache::loncommon::help_open_topic('Caching')
                  .'</p>';
@@ -2168,8 +2167,8 @@
     &startpage($r);
 
     foreach ('tolerance','date_default','date_start','date_end',
-	     'date_interval','int','float','string') {
-	$r->print('<input type="hidden" value="'.
+	    'date_interval','int','float','string') {
+		$r->print('<input type="hidden" value="'.
 		  &HTML::Entities::encode($env{'form.recent_'.$_},'"&<>').
 		  '" name="recent_'.$_.'" />');
     }
@@ -2201,22 +2200,22 @@
 
         &levelmenu($r,\%alllevs,$parmlev);
 
-	if ($parmlev ne 'general') {
-            $r->print(&Apache::lonhtmlcommon::row_closure());
-	    &mapmenu($r,\%allmaps,$pschp,\%maptitles, \%symbp);
-	}
+		if ($parmlev ne 'general') {
+        	$r->print(&Apache::lonhtmlcommon::row_closure());
+	    	&mapmenu($r,\%allmaps,$pschp,\%maptitles, \%symbp);
+		}
 
-        $r->print(&Apache::lonhtmlcommon::row_closure(1));
-        $r->print(&Apache::lonhtmlcommon::end_pick_box());
-    #Display Unit 2 "Select Parameter"   
-	&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder);
+    	$r->print(&Apache::lonhtmlcommon::row_closure(1));
+    	$r->print(&Apache::lonhtmlcommon::end_pick_box());
+    	#Display Unit 2 "Select Parameter"   
+		&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder);
     } else {
         my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb);
-	my $title = &Apache::lonnet::gettitle($pssymb);
+		my $title = &Apache::lonnet::gettitle($pssymb);
         $r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource).
-                  '<input type="hidden" value="'.$pssymb.'" name="symb" />'.
-		  '<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'.
-		  ($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />');
+                '<input type="hidden" value="'.$pssymb.'" name="symb" />'.
+		  		'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'.
+		  		($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />');
     }
     $r->print(&Apache::lonhtmlcommon::topic_bar (3,&mt('User Selection')));
     $r->print(&Apache::lonhtmlcommon::start_pick_box());
@@ -2244,7 +2243,8 @@
              .'<a href="javascript:parmsel_show()">'
              .&mt('Change Parameter Selection')
              .'</a>'
-             .'</p>');
+             .'</p>'
+	);
 
     # Display Messages
     $r->print('<div>'.$message.'</div>');
@@ -2265,101 +2265,101 @@
         my $csudom=$env{'user.domain'};
 
         if ($parmlev eq 'full') {
-           my $coursespan=$csec?8:5;
-           my $userspan=3;
-           if ($cgroup ne '') {
-              $coursespan += 3;
-           }
-
-           $r->print('<p><table border="2">');
-           $r->print('<tr><td colspan="5"></td>');
-           $r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>');
-           if ($uname) {
-               if (@usersgroups > 1) {
-                   $userspan ++;
-               }
-               $r->print('<th colspan="'.$userspan.'" rowspan="2">');
-               $r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>");
-           }
-	   my %lt=&Apache::lonlocal::texthash(
-				  'pie'    => "Parameter in Effect",
-				  'csv'    => "Current Session Value",
-                                  'at'     => 'at',
-                                  'rl'     => "Resource Level",
-				  'ic'     => 'in Course',
-				  'aut'    => "Assessment URL and Title",
-				  'type'   => 'Type',
-				  'emof'   => "Enclosing Map or Folder",
-				  'part'   => 'Part',
-                                  'pn'     => 'Parameter Name',
-				  'def'    => 'default',
-				  'femof'  => 'from Enclosing Map or Folder',
-				  'gen'    => 'general',
-				  'foremf' => 'for Enclosing Map or Folder',
-				  'fr'     => 'for Resource'
-					      );
-           $r->print(<<ENDTABLETWO);
+       		my $coursespan=$csec?8:5;
+           	my $userspan=3;
+           	if ($cgroup ne '') {
+            	  $coursespan += 3;
+           	}
+
+           	$r->print('<p><table border="2">');
+           	$r->print('<tr><td colspan="5"></td>');
+           	$r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>');
+           	if ($uname) {
+            	if (@usersgroups > 1) {
+                   	$userspan ++;
+               	}
+               	$r->print('<th colspan="'.$userspan.'" rowspan="2">');
+               	$r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>");
+           	}
+	   		my %lt=&Apache::lonlocal::texthash(
+				'pie'    => "Parameter in Effect",
+				'csv'    => "Current Session Value",
+                'at'     => 'at',
+                'rl'     => "Resource Level",
+				'ic'     => 'in Course',
+				'aut'    => "Assessment URL and Title",
+				'type'   => 'Type',
+				'emof'   => "Enclosing Map or Folder",
+				'part'   => 'Part',
+                'pn'     => 'Parameter Name',
+				'def'    => 'default',
+				'femof'  => 'from Enclosing Map or Folder',
+				'gen'    => 'general',
+				'foremf' => 'for Enclosing Map or Folder',
+				'fr'     => 'for Resource'
+			);
+           	$r->print(<<ENDTABLETWO);
 <th rowspan="3">$lt{'pie'}</th>
 <th rowspan="3">$lt{'csv'}<br />($csuname $lt{'at'} $csudom)</th>
 </tr><tr><td colspan="5"></td><th colspan="2">$lt{'ic'}</th><th colspan="2">$lt{'rl'}</th>
 <th colspan="1">$lt{'ic'}</th>
 
 ENDTABLETWO
-           if ($csec) {
-                $r->print('<th colspan="3">'.
-			  &mt("in Section")." $csec</th>");
-           }
-           if ($cgroup) {
+           	if ($csec) {
+           		$r->print('<th colspan="3">'.
+			  	&mt("in Section")." $csec</th>");
+           	}
+           	if ($cgroup) {
                 $r->print('<th colspan="3">'.
-                          &mt("in Group")." $cgroup</th>");
-           }
-           $r->print(<<ENDTABLEHEADFOUR);
+                &mt("in Group")." $cgroup</th>");
+           	}
+           	$r->print(<<ENDTABLEHEADFOUR);
 </tr><tr><th>$lt{'aut'}</th><th>$lt{'type'}</th>
 <th>$lt{'emof'}</th><th>$lt{'part'}</th><th>$lt{'pn'}</th>
 <th>$lt{'gen'}</th><th>$lt{'foremf'}</th>
 <th>$lt{'def'}</th><th>$lt{'femof'}</th><th>$lt{'fr'}</th>
 ENDTABLEHEADFOUR
 
-           if ($csec) {
-               $r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>');
-           }
-
-           if ($cgroup) {
-               $r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>');
-           }
-
-           if ($uname) {
-               if (@usersgroups > 1) {
-                   $r->print('<th>'.&mt('Control by other group?').'</th>');
-               }
-               $r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>');
-           }
-
-           $r->print('</tr>');
-
-           my $defbgone='';
-           my $defbgtwo='';
-           my $defbgthree = '';
+           	if ($csec) {
+           		$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>');
+           	}
+
+           	if ($cgroup) {
+            	$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>');
+           	}
+
+           	if ($uname) {
+            	if (@usersgroups > 1) {
+                	$r->print('<th>'.&mt('Control by other group?').'</th>');
+               	}
+               	$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>');
+           	}
+
+           	$r->print('</tr>');
+
+           	my $defbgone='';
+           	my $defbgtwo='';
+           	my $defbgthree = '';
 
-           foreach (@ids) {
+           	foreach (@ids) {
 
-                my $rid=$_;
+            	my $rid=$_;
                 my ($inmapid)=($rid=~/\.(\d+)$/);
 
                 if ((!$pssymb &&
-		     (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid})))
-		    ||
-		    ($pssymb && $pssymb eq $symbp{$rid})) {
+		     	(($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid})))
+		    	||
+		    	($pssymb && $pssymb eq $symbp{$rid})) {
 # ------------------------------------------------------ Entry for one resource
-                    if ($defbgone eq '#E0E099') {
-                        $defbgone='#E0E0DD';
+                	if ($defbgone eq '#E0E099') {
+                    	$defbgone='#E0E0DD';
                     } else {
                         $defbgone='#E0E099';
                     }
                     if ($defbgtwo eq '#FFFF99') {
-                        $defbgtwo='#FFFFDD';
+                    	$defbgtwo='#FFFFDD';
                     } else {
-                        $defbgtwo='#FFFF99';
+                    	$defbgtwo='#FFFF99';
                     }
                     if ($defbgthree eq '#FFBB99') {
                         $defbgthree='#FFBBDD';
@@ -2400,21 +2400,21 @@
                     }
                     my $totalparms=scalar keys %name;
                     if ($totalparms>0) {
-                        my $firstrow=1;
-			my $title=&Apache::lonnet::gettitle($symbp{$rid});
+                   		my $firstrow=1;
+						my $title=&Apache::lonnet::gettitle($symbp{$rid});
                         $r->print('<tr><td style="background-color:'.$defbgone.';"'.
                              ' rowspan='.$totalparms.
                              '><tt><font size="-1">'.
                              join(' / ',split(/\//,$uri)).
                              '</font></tt><p><b>'.
                              "<a href=\"javascript:openWindow('".
-				  &Apache::lonnet::clutter($uri).'?symb='.
-				  &escape($symbp{$rid}).
+				  		&Apache::lonnet::clutter($uri).'?symb='.
+				  		&escape($symbp{$rid}).
                              "', 'metadatafile', '450', '500', 'no', 'yes');\"".
                              " target=\"_self\">$title");
 
                         if ($thistitle) {
-                            $r->print(' ('.$thistitle.')');
+                        	$r->print(' ('.$thistitle.')');
                         }
                         $r->print('</a></b></td>');
                         $r->print('<td style="background-color:'.$defbgtwo.';"'.
@@ -2458,7 +2458,7 @@
 
 #-------------------------------------------- for each map, gather information
             my $mapid;
-	    foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) {
+	   		foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) {
                 my $maptitle = $maplist{$mapid};
 
 #-----------------------  loop through ids and get all parameter types for map
@@ -2473,13 +2473,13 @@
 #		$r->print("Catmarker: @catmarker<br />\n");
 
                 foreach (@ids) {
-                  ($map)=(/([\d]*?)\./);
-                  my $rid = $_;
+                	($map)=(/([\d]*?)\./);
+                  	my $rid = $_;
 
 #                  $r->print("$mapid:$map:   $rid <br /> \n");
 
-                  if ($map eq $mapid) {
-                    my $uri=&Apache::lonnet::declutter($uris{$rid});
+                 	if ($map eq $mapid) {
+	                    my $uri=&Apache::lonnet::declutter($uris{$rid});
 #                    $r->print("Keys: $keyp{$rid} <br />\n");
 
 #--------------------------------------------------------------------
@@ -2489,32 +2489,32 @@
 # When storing information, store as part 0
 # When requesting information, request from full part
 #-------------------------------------------------------------------
-                    foreach (&keysplit($keyp{$rid})) {
-                      my $tempkeyp = $_;
-                      my $fullkeyp = $tempkeyp;
-                      $tempkeyp =~ s/_\w+_/_0_/;
-
-                      if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
-                        $part{$tempkeyp}="0";
-                        $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
-                        my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
-                        if ($allparms{$name{$tempkeyp}} ne '') {
-                            my $identifier;
-                            if ($parmdis =~ /(\s*\[Part.*)$/) {
-                                $identifier = $1;
-                            }
-                            $display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier;
-                        } else {
-                            $display{$tempkeyp} = $parmdis;
-                        }
-                        unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
-                        $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
-                        $display{$tempkeyp} =~ s/_\w+_/_0_/;
-                        $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);
-                        $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');
-                      }
-                    } # end loop through keys
-                  }
+    	                foreach (&keysplit($keyp{$rid})) {
+        	             	my $tempkeyp = $_;
+            	          	my $fullkeyp = $tempkeyp;
+                	      	$tempkeyp =~ s/_\w+_/_0_/;
+
+                    	  	if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
+                        		$part{$tempkeyp}="0";
+                        		$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
+                        		my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
+                        		if ($allparms{$name{$tempkeyp}} ne '') {
+                            		my $identifier;
+                            		if ($parmdis =~ /(\s*\[Part.*)$/) {
+                                		$identifier = $1;
+                            		}
+                            		$display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier;
+                        		} else {
+                            		$display{$tempkeyp} = $parmdis;
+                        		}
+                        		unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
+                        		$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
+                        		$display{$tempkeyp} =~ s/_\w+_/_0_/;
+                        		$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);
+                        		$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');
+                      		}
+                    	} # end loop through keys
+                  	}
                 } # end loop through ids
 
 #---------------------------------------------------- print header information
@@ -2522,7 +2522,7 @@
                 my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':'');
                 my $tmp="";
                 if ($uname) {
-		    my $person=&Apache::loncommon::plainname($uname,$udom);
+		    		my $person=&Apache::loncommon::plainname($uname,$udom);
                     $tmp.=&mt("User")." <font color=\"red\"><i>$uname \($person\) </i></font> ".
                         &mt('in')." \n";
                 } else {
@@ -2553,8 +2553,8 @@
                          .&Apache::loncommon::end_data_table_header_row()
                 );
 
-	        foreach (&keysinorder(\%name,\%keyorder)) {
-                    $r->print(&Apache::loncommon::start_data_table_row());
+	        	foreach (&keysinorder(\%name,\%keyorder)) {
+                	$r->print(&Apache::loncommon::start_data_table_row());
                     &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default,
                            \%type,\%display,$defbgone,$defbgtwo,$defbgthree,
                            $parmlev,$uname,$udom,$csec,$cgroup);
@@ -2566,7 +2566,7 @@
         } # end of $parmlev eq map
 #--------------------------------- Entry for parm level general (Course level)
         if ($parmlev eq 'general') {
-            my $defbgone = '#E0E099';
+        	my $defbgone = '#E0E099';
             my $defbgtwo = '#FFFF99';
             my $defbgthree = '#FFBB99';
 
@@ -2592,41 +2592,41 @@
 # When storing information, store as part 0
 # When requesting information, request from full part
 #-------------------------------------------------------------------
-                foreach (&keysplit($keyp{$rid})) {
-                  my $tempkeyp = $_;
-                  my $fullkeyp = $tempkeyp;
-                  $tempkeyp =~ s/_\w+_/_0_/;
-                  if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
-                    $part{$tempkeyp}="0";
-                    $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
-                    my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
-                    if ($allparms{$name{$tempkeyp}} ne '') {
-                        my $identifier;
-                        if ($parmdis =~ /(\s*\[Part.*)$/) {
-                            $identifier = $1;
-                        }
-                        $display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier;
-                    } else {
-                        $display{$tempkeyp} = $parmdis;
-                    }
-                    unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
-                    $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
-                    $display{$tempkeyp} =~ s/_\w+_/_0_/;
-                    $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);
-                    $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');
-                  }
+            	foreach (&keysplit($keyp{$rid})) {
+                	my $tempkeyp = $_;
+                  	my $fullkeyp = $tempkeyp;
+                  	$tempkeyp =~ s/_\w+_/_0_/;
+                  	if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
+                    	$part{$tempkeyp}="0";
+                    	$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
+                    	my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
+                    	if ($allparms{$name{$tempkeyp}} ne '') {
+                        	my $identifier;
+                        	if ($parmdis =~ /(\s*\[Part.*)$/) {
+                            	$identifier = $1;
+                        	}
+                        	$display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier;
+                    	} else {
+                        	$display{$tempkeyp} = $parmdis;
+                    	}
+                    	unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
+                    	$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
+                    	$display{$tempkeyp} =~ s/_\w+_/_0_/;
+                    	$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);
+                    	$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');
+                  	}
                 } # end loop through keys
             } # end loop through ids
 
 #---------------------------------------------------- print header information
-	    my $setdef=&mt("Set Defaults for All Resources in Course");
+	    	my $setdef=&mt("Set Defaults for All Resources in Course");
             $r->print(<<ENDMAPONE);
 <center>
 <h4>$setdef
 <font color="red"><i>$coursename</i></font><br />
 ENDMAPONE
             if ($uname) {
-		my $person=&Apache::loncommon::plainname($uname,$udom);
+				my $person=&Apache::loncommon::plainname($uname,$udom);
                 $r->print(" ".&mt("User")."<font color=\"red\"> <i>$uname \($person\) </i></font> \n");
             } else {
                 $r->print("<i><font color=\"red\"> ".&mt("ALL")."</i> ".&mt("USERS")."</font> \n");
@@ -2644,7 +2644,7 @@
                      .&Apache::loncommon::end_data_table_header_row()
             );
 
-	    foreach (&keysinorder(\%name,\%keyorder)) {
+	    	foreach (&keysinorder(\%name,\%keyorder)) {
                 $r->print(&Apache::loncommon::start_data_table_row());
                 &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default,
                        \%type,\%display,$defbgone,$defbgtwo,$defbgthree,

--amueller1256033967--