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

raeburn raeburn@source.lon-capa.org
Thu, 19 Mar 2009 17:05:52 -0000


This is a MIME encoded message

--raeburn1237482352
Content-Type: text/plain

raeburn		Thu Mar 19 17:05:52 2009 EDT

  Modified files:              (Branch: version_2_8_X)
    /loncom/interface	lonparmset.pm 
  Log:
  - Backport 1.420, 1.421, 1.422, 1.423, 1.424, 1.428, 1.429, 1.431, 1.432, 1.433.
  
  
--raeburn1237482352
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20090319170552.txt"

Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.413.2.1 loncom/interface/lonparmset.pm:1.413.2.2
--- loncom/interface/lonparmset.pm:1.413.2.1	Fri Dec 12 20:22:33 2008
+++ loncom/interface/lonparmset.pm	Thu Mar 19 17:05:52 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.413.2.1 2008/12/12 20:22:33 raeburn Exp $
+# $Id: lonparmset.pm,v 1.413.2.2 2009/03/19 17:05:52 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -643,12 +643,13 @@
     my ($hour,$min,$sec,$val)=&preset_defaults($parmname);
     unless (defined($winvalue)) { $winvalue=$val; }
     my $valout = &valout($value,$type,1);
+    my $unencmarker = $marker;
     foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call,
 		      \$hour, \$min, \$sec) {
 	$$item = &HTML::Entities::encode($$item,'"<>&');
 	$$item =~ s/\'/\\\'/g;
     }
-    return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$marker.'" /></td></tr><tr><td align="center">'.
+    return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$unencmarker.'" /></td></tr><tr><td align="center">'.
 	'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','"
 	    .$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'.
 	    $valout.'</a></td></tr></table>';
@@ -999,9 +1000,15 @@
 #
 	    my $name=&Apache::lonnet::metadata($srcf,$key.'.name');
 	    if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) {
-		my $display= &Apache::lonnet::metadata($srcf,$key.'.display');
-		my $parmdis = $display;
-		$parmdis =~ s/\s*\[Part.*$//g;
+		my ($display,$parmdis);
+		$display = &standard_parameter_names($name);
+		if ($display eq '') {
+		    $display= &Apache::lonnet::metadata($srcf,$key.'.display');
+		    $parmdis = $display;
+		    $parmdis =~ s/\s*\[Part.*$//g;
+		} else {
+		    $parmdis = $display;
+		}
 		$$allparms{$name}=$parmdis;
 		if (ref($defkeytype)) {
 		    $$defkeytype{$name}=
@@ -1127,16 +1134,16 @@
 </script>
 ENDSCRIPT
     $r->print();
-    $r->print("\n<table id=\"LC_parm_overview_parm_menu\"><tr>");
+    $r->print("\n".'<table id="LC_parm_overview_parm_menu"><tr>');
     my $cnt=0;
     foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) {
 	$r->print("\n<td><label><input type='checkbox' name='pscat' ");
 	$r->print('value="'.$tempkey.'"');
 	if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {
-	    $r->print(' checked');
+	    $r->print(' checked="checked"');
 	}
-	$r->print('>'.($$allparms{$tempkey}=~/\S/ ? &mt($$allparms{$tempkey})
-		                                  : &mt($tempkey))
+	$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey}
+		                                  : $tempkey)
 		  .'</label></td>');
  	$cnt++;
         if ($cnt==3) {
@@ -1145,7 +1152,7 @@
 	}
     }
     $r->print('</tr>'
-             .'<tr id=\"LC_parm_overview_parm_menu_selectors\">'
+             .'<tr id="LC_parm_overview_parm_menu_selectors">'
              .'<td valign="top">'
              .'<fieldset><legend><b>'.&mt('Parameter Selection').'</b></legend>'
              .'<span class="LC_nobreak">'
@@ -1188,7 +1195,7 @@
 
 sub partmenu {
     my ($r,$allparts,$psprt)=@_;
-    $r->print('<select multiple name="psprt" size="8">');
+    $r->print('<select multiple="multiple" name="psprt" size="8">');
     $r->print('<option value="all"');
     $r->print(' selected="selected"') unless (@{$psprt});
     $r->print('>'.&mt('All Parts').'</option>');
@@ -1352,7 +1359,7 @@
     my %sectionhash = &Apache::loncommon::get_sections();
     return if (!%sectionhash);
 
-    $r->print('<select name="Section" multiple="true" size="8" >');
+    $r->print('<select name="Section" multiple="multiple" size="8">');
     foreach my $s ('all',sort keys %sectionhash) {
 	$r->print('    <option value="'.$s.'"');
 	foreach (@{$selectedsections}) {
@@ -1371,7 +1378,7 @@
     my %grouphash = &Apache::longroup::coursegroups();
     return if (!%grouphash);
 
-    $r->print('<select name="Group" multiple="true" size="8" >');
+    $r->print('<select name="Group" multiple="multiple" size="8">');
     foreach my $group (sort(keys(%grouphash))) {
 	$r->print('    <option value="'.$group.'"');
 	foreach (@{$selectedgroups}) {
@@ -1426,7 +1433,7 @@
     $r->print(' />'.&mt('Sort by realm first, then student (group/section)'));
     $r->print('</label><br /><label><input type="radio" name="sortorder" value="studentrealm"');
     if ($sortorder eq 'studentrealm') {
-       $r->print(' checked="on"');
+       $r->print(' checked="checked"');
     }
     $r->print(' />'.&mt('Sort by student (group/section) first, then realm').
 	      '</label>');
@@ -1665,12 +1672,13 @@
     if (!$pssymb) {
         $r->print('<table border="1"><tr><td>');
         &levelmenu($r,\%alllevs,$parmlev);
+        $r->print('</td>');
 	if ($parmlev ne 'general') {
             $r->print('<td>');
 	    &mapmenu($r,\%allmaps,$pschp,\%maptitles);
 	    $r->print('</td>');
 	}
-        $r->print('</td></tr></table>');
+        $r->print('</tr></table>');
 	&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder);
     } else {
         my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb);
@@ -1817,7 +1825,16 @@
                         if (grep $_ eq $tempkeyp, @catmarker) {
                           $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part');
                           $name{$_}=&Apache::lonnet::metadata($uri,$_.'.name');
-                          $display{$_}=&Apache::lonnet::metadata($uri,$_.'.display');
+                          my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display');
+                          if ($allparms{$name{$_}} ne '') {
+                              my $identifier;
+                              if ($parmdis =~ /(\s*\[Part.*)$/) {
+                                  $identifier = $1;
+                              }
+                              $display{$_} = $allparms{$name{$_}}.$identifier;
+                          } else {
+                              $display{$_} = $parmdis;
+                          }
                           unless ($display{$_}) { $display{$_}=''; }
                           $display{$_}.=' ('.$name{$_}.')';
                           $default{$_}=&Apache::lonnet::metadata($uri,$_);
@@ -1924,7 +1941,16 @@
                       if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
                         $part{$tempkeyp}="0";
                         $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
-                        $display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
+                        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_/;
@@ -2012,7 +2038,16 @@
                   if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
                     $part{$tempkeyp}="0";
                     $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
-                    $display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
+                    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_/;
@@ -2314,7 +2349,7 @@
              'student_classlist_view' => '<b>'.&mt('Allow students to view classlist.').'</b><br />'
                                         .'('.&mt('[_1]: students can view all sections. [_2]: students can only view their own section. blank or [_3] prevents student view.','"<tt>all</tt>"','"<tt>section</tt>"','"<tt>disabled</tt>"').')',
              'student_classlist_portfiles' => '<b>'.&mt('Include link to accessible portfolio files').'</b><br />'
-                                             .'('.&mt('[_1] for link to each a listing of each student\'s files.','"<tt>yes</tt>"').')',
+                                             .'('.&mt("[_1] for link to each a listing of each student's files.",'"<tt>yes</tt>"').')',
              'student_classlist_opt_in' => '<b>'.&mt("Student's agreement needed for listing in student-viewable roster").'</b><br />'
                                            .'('.&mt('[_1] to require students to opt-in to listing in the roster (on the roster page).','"<tt>yes</tt>"').')',
              'plc.roles.denied'=> '<b>'.&mt('Disallow live chatroom use for Roles').'</b><br />'
@@ -2401,7 +2436,7 @@
 
 	     'texengine'
 	         => '<b>'.&mt('Force all students in the course to use a specific math rendering engine.').'</b><br />'
-                   .'('.&mt('[_1], [_2] (Convert to Images), [_3] (TeX to HTML), or blank for student\'s preference','"<tt>jsMath</tt>"','"<tt>mimetex</tt>"','"<tt>tth</tt>"').')',
+                   .'('.&mt("[_1], [_2] (Convert to Images), [_3] (TeX to HTML), or blank for student's preference",'"<tt>jsMath</tt>"','"<tt>mimetex</tt>"','"<tt>tth</tt>"').')',
              'timezone'
                  => '<b>'.&mt('Timezone in which the course takes place').'</b>',
 
@@ -2957,7 +2992,7 @@
 	    }
 	    if ($part ne $oldpart) {
 		$r->print(&tableend().
-			  "\n<span class=\"LC_parm_part\">".&mt('Part').": $part</span>");
+			  "\n".'<span class="LC_parm_part">'.&mt('Part').": $part</span>");
 		$oldpart=$part;
 	    }
 #
@@ -2992,7 +3027,7 @@
 		$r->print(&default_selector($thiskey,$$resourcedata{$thiskey}));
 	    }
 	    $r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'.
-		      $thistype.'">');
+		      $thistype.'" />');
 	    $r->print('</td>'.&Apache::loncommon::end_data_table_row());
 	}
     }
@@ -3768,21 +3803,21 @@
         my $multiple_checked;
         my $single_checked;
         if ($options =~ m/onlyone/) {
-            $multiple_checked = "";
-            $single_checked = " CHECKED ";
+            $multiple_checked = '';
+            $single_checked = ' checked="checked"';
         } else {
-            $multiple_checked = " CHECKED ";
-            $single_checked = "";
+            $multiple_checked = ' checked="checked"';
+            $single_checked = '';
         }
 	$output .= &Apache::loncommon::continue_data_table_row();
 	$output .= '<td>'.('&nbsp;' x 10).'<span class="LC_metadata">
-	            <input type="radio" name="'.$field_name.'_onlyone" value="multiple" '.$multiple_checked .'/>
-	            Student may select multiple choices from list</span></td>';
+	            <input type="radio" name="'.$field_name.'_onlyone" value="multiple"'.$multiple_checked .' />
+	            '.&mt('Student may select multiple choices from list').'</span></td>';
 	$output .= &Apache::loncommon::end_data_table_row();
 	$output .= &Apache::loncommon::continue_data_table_row();
 	$output .= '<td>'.('&nbsp;' x 10).'<span class="LC_metadata">
 	            <input type="radio" name="'.$field_name.'_onlyone"  value="single" '.$single_checked.'/>
-	            Student may select only one choice from list</span></td>';
+	            '.&mt('Student may select only one choice from list').'</span></td>';
 	$output .= &Apache::loncommon::end_data_table_row();
     }
     return ($output);

--raeburn1237482352--