--- loncom/interface/lonparmset.pm 2009/01/15 18:31:11 1.420 +++ loncom/interface/lonparmset.pm 2009/03/01 01:12:20 1.436 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.420 2009/01/15 18:31:11 bisitz Exp $ +# $Id: lonparmset.pm,v 1.436 2009/03/01 01:12:20 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -848,12 +848,13 @@ sub plink { 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 '
'.
+ return '
| ' .$$part{$which}.' | '); - } else { + } else { $parm=~s|\[.*\]\s||g; } my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); if ($automatic) { $parm.=''.$parm.' | '); + $r->print(''.$parm.' | '); my $thismarker=$which; $thismarker=~s/^parameter\_//; @@ -1181,9 +1182,15 @@ sub extractResourceInformation { # 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}= @@ -1307,17 +1314,17 @@ sub parmmenu { ENDSCRIPT $r->print(); - $r->print("\n
'); + $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} + : $tempkey) + .''); $cnt++; if ($cnt==3) { $r->print(" |
' .' |
'.&Apache::loncommon::start_data_table() .&Apache::loncommon::start_data_table_header_row() @@ -2128,7 +2154,9 @@ ENDTABLEHEADFOUR \%type,\%display,$defbgone,$defbgtwo,$defbgthree, $parmlev,$uname,$udom,$csec,$cgroup); } - $r->print(&Apache::loncommon::end_data_table().'
'); + $r->print(&Apache::loncommon::end_data_table().'' + .'' + ); } # end each map } # end of $parmlev eq map #--------------------------------- Entry for parm level general (Course level) @@ -2166,7 +2194,16 @@ ENDTABLEHEADFOUR 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_/; @@ -2231,6 +2268,7 @@ sub crsenv { my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; my (%crsinfo,$chome); + my $crstype = &Apache::loncommon::course_type(); # # Go through list of changes @@ -2241,6 +2279,23 @@ sub crsenv { if ($name eq 'newp') { $name = $env{'form.newp_name'}; } + if ($name =~ /^rolenames_([^_]+)$/) { + $name = $1.'.plaintext'; + my $standardtitle = + &Apache::lonnet::plaintext($1,$crstype,$env{'request.course.id'},1); + my %adv_roles = + &Apache::lonnet::get_course_adv_roles($env{'request.course.id'},1); + if ($value ne '') { + foreach my $role (keys(%adv_roles)) { + if ($role =~ m{^cr/$match_domain/$match_name/\Q$value\E$}) { + $setoutput.= ''. + &mt('Requested replacement title for [_1] role is already used as the name of a custom role ([_2]).',$standardtitle,$value). + ''.&Apache::lonnet::plaintext($role,$crstype,undef,1). + ' | '. + &Apache::lonhtmlcommon::textbox($parameter.'_'.$role.'_value', + $values{$role.'.plaintext'}, + 15,$onchange). + ' |
'.&Apache::lonhtmlcommon::checkbox($parameter.'_'.$role.'_setparmval'). + ' |
'. - ($foundkeys?'':&mt('There are no parameters.')).'
'. + ($foundkeys?'':&mt('There are no parameters.')).''. &Apache::loncommon::end_page()); } @@ -3882,20 +3964,20 @@ sub output_row { 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 .= '