--- loncom/interface/lonparmset.pm 2003/09/05 03:47:47 1.124 +++ loncom/interface/lonparmset.pm 2003/10/09 16:21:20 1.131 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.124 2003/09/05 03:47:47 www Exp $ +# $Id: lonparmset.pm,v 1.131 2003/10/09 16:21:20 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -61,7 +61,7 @@ use Apache::loncommon; use GDBM_File; use Apache::lonhomework; use Apache::lonxml; - +use Apache::lonlocal; my %courseopt; my %useropt; @@ -653,9 +653,9 @@ sub assessparms { my $r=shift; # -------------------------------------------------------- Variable declaration - my %allkeys; - my %allmaps; - my %alllevs; + my %allkeys=(); + my %allmaps=(); + my %alllevs=(); $alllevs{'Resource Level'}='full'; # $alllevs{'Resource Level [BRIEF]'}='brief'; @@ -864,7 +864,7 @@ sub assessparms { $message.="Write Error: $1"; } # ---------------------------------------------------------------- Done storing - $message.='

Changes can take up to 10 minutes before being active for all students.'.&Apache::loncommon::help_open_topic('Caching').'

'; + $message.='

'.&mt('Changes can take up to 10 minutes before being active for all students.').&Apache::loncommon::help_open_topic('Caching').'

'; } # --------------------------------------------- Devalidate cache for this child &Apache::lonnet::devalidatecourseresdata( @@ -923,9 +923,9 @@ sub assessparms { $r->print('

'.$message.'

'); - my $submitmessage = 'Update Section or Specific User'; + my $submitmessage = &mt('Update Section or Specific User'); if (!$pssymb) { - $r->print('\n"); $r->print(''); - - $r->print(''); - $r->print('\n"); + if ($parmlev ne 'general') { + $r->print(''); + $r->print('\n"); + } } else { - my ($map,$id,$resource)=split(/___/,$pssymb); - $r->print(""); + my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); + $r->print(""); $r->print(''); $r->print(''); $r->print(''); @@ -957,7 +958,7 @@ sub assessparms { $r->print(''); + $r->print(' name="showoptions" value="show">'.&mt('Show More Options').'
'); # $r->print(""); # $r->print(""); # $r->print(""); @@ -966,12 +967,12 @@ sub assessparms { if ($showoptions eq 'show') { my $tempkey; - $r->print(''); + $r->print(''); $r->print('
Select Parameter Level'); + $r->print('
'.&mt('Select Parameter Level').''); $r->print('
Select Enclosing Map or Folder
'.&mt('Select Enclosing Map or Folder').'
Specific Resource$resource
".&mt('Specific Resource')."$resource

print(" checked ");} - $r->print(' name="showoptions" value="show">Show More Options
Show: $showoptions
pscat: @pscat
psprt: @psprt
Select Parameters to View
'.&mt('Select Parameters to View').'
'); $r->print(''); + $r->print('>'.&mt('All Parameters').''); my $cnt=0; foreach $tempkey (sort { $allparms{$a} cmp $allparms{$b} } @@ -991,7 +992,7 @@ sub assessparms { $r->print(''); - $r->print('
print(' checked') unless (@pscat); - $r->print('>All Parameters

Sort list by'); + $r->print('
'.&mt('Sort list by').''); $r->print('

'); if (($prevvisit) || ($pschp) || ($pssymb)) { - $submitmessage = "Update Course Assessment Parameter Display"; + $submitmessage = &mt("Update Course Assessment Parameter Display"); } else { - $submitmessage = "Set/Modify Course Assessment Parameters"; + $submitmessage = &mt("Set/Modify Course Assessment Parameters"); } $r->print(''); @@ -1075,10 +1076,10 @@ sub assessparms { my $coursespan=$csec?8:5; $r->print('

'); $r->print(''); - $r->print(''); + $r->print(''); if ($uname) { $r->print(""); + $r->print(&mt("User")." $uname ".&mt('at Domain')." $udom"); } $r->print(<Parameter in Effect @@ -1097,11 +1098,11 @@ ENDTABLETWO ENDTABLEHEADFOUR if ($csec) { - $r->print(''); + $r->print(''); } if ($uname) { - $r->print(''); + $r->print(''); } $r->print(''); @@ -1152,7 +1153,8 @@ ENDTABLEHEADFOUR my $totalparms=scalar keys %name; if ($totalparms>0) { my $firstrow=1; - + my $title=$bighash{'title_'.$rid}; + $title=~s/\:/:/g; $r->print('
Any User'.&mt('Any User').'"); - $r->print("User $uname at Domain $udomgeneralfor Enclosing Map or Folderfor Resource'.&mt('general').''.&mt('for Enclosing Map or Folder').''.&mt('for Resource').'generalfor Enclosing Map or Folderfor Resource'.&mt('general').''.&mt('for Enclosing Map or Folder').''.&mt('for Resource').'
'. @@ -1160,7 +1162,7 @@ ENDTABLEHEADFOUR '

'. "$bighash{'title_'.$rid}"); + " TARGET=_self>$title"); if ($thistitle) { $r->print(' ('.$thistitle.')'); @@ -1275,20 +1277,22 @@ ENDMAPONE ('firstname','middlename','lastname','generation', 'id')); my $person=$name{'firstname'}.' '.$name{'middlename'}.' ' .$name{'lastname'}.' '.$name{'generation'}; - $r->print("User $uname \($person\) in \n"); + $r->print(&mt("User")." $uname \($person\) ". + &mt('in')." \n"); } else { - $r->print("all users in \n"); + $r->print("".&mt('all').' '.&mt('users in')." \n"); } - if ($csec) {$r->print("Section $csec of \n")}; + if ($csec) {$r->print(&mt("Section")." $csec ". + &mt('of')." \n")}; $r->print("$coursename
"); $r->print("\n"); #---------------------------------------------------------------- print table $r->print('

'); - $r->print(''); - $r->print(''); - $r->print(''); + $r->print(''); + $r->print(''); + $r->print(''); foreach (sort keys %name) { &print_row($r,$_,\%part,\%name,$mapid,\%default, @@ -1354,18 +1358,18 @@ ENDMAPONE ('firstname','middlename','lastname','generation', 'id')); my $person=$name{'firstname'}.' '.$name{'middlename'}.' ' .$name{'lastname'}.' '.$name{'generation'}; - $r->print(" User $uname \($person\) \n"); + $r->print(" ".&mt("User")." $uname \($person\) \n"); } else { - $r->print("ALL USERS \n"); + $r->print("".&mt("ALL")." ".&mt("USERS")." \n"); } - if ($csec) {$r->print("Section $csec\n")}; + if ($csec) {$r->print(&mt("Section")." $csec\n")}; $r->print("\n"); #---------------------------------------------------------------- print table $r->print('

Parameter NameDefault ValueParameter in Effect
'.&mt('Parameter Name').''.&mt('Default Value').''.&mt('Parameter in Effect').'
'); - $r->print(''); - $r->print(''); - $r->print(''); + $r->print(''); + $r->print(''); + $r->print(''); foreach (sort keys %name) { &print_row($r,$_,\%part,\%name,$mapid,\%default, @@ -1421,7 +1425,7 @@ sub crsenv { my $bkuptime=time; my @tmp = &Apache::lonnet::get ('environment',['url'],$dom,$crs); - $setoutput.='Backing up previous URL: '. + $setoutput.=&mt('Backing up previous URL').': '. &Apache::lonnet::put ('environment', {'top level map backup '.$bkuptime => $tmp[1] }, @@ -1460,10 +1464,10 @@ sub crsenv { my $put_result = &Apache::lonnet::put('environment', {$name=>$value},$dom,$crs); if ($put_result eq 'ok') { - $setoutput.='Set '.$name.' to '.$value.'.
'; + $setoutput.=&mt('Set').' '.$name.' '.&mt('to').' '.$value.'.
'; } else { - $setoutput.='Unable to set '.$name.' to '. - ''.$value.' due to '.$put_result.'.
'; + $setoutput.=&mt('Unable to set').' '.$name.' '.&mt('to'). + ' '.$value.' '.&mt('due to').' '.$put_result.'.
'; } } } @@ -1614,7 +1618,7 @@ sub crsenv { my $onchange = 'onFocus="javascript:window.document.forms'. '[\'envform\'].elements[\'newp_setparmval\']'. '.checked=true;"'; - $output.='
'; + return '
Parameter NameDefault ValueParameter in Effect
'.&mt('Parameter Name').''.&mt('Default Value').''.&mt('Parameter in Effect').'
Create New Environment Variable
'. + $output.='
'.&mt('Create New Environment Variable').'
'. '
'. '
ParameterDeleteSet to ...
'; } } @@ -1736,17 +1741,17 @@ ENDOVER if ($resourcedata{$thiskey.'.type'}) { my ($course,$middle,$part,$name)= ($thiskey=~/^(\w+)\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); - my $section='All Students'; + my $section=&mt('All Students'); if ($middle=~/^\[(.*)\]\./) { - $section='Group/Section: '.$1; + $section=&mt('Group/Section').': '.$1; $middle=~s/^\[(.*)\]\.//; } $middle=~s/\.$//; - my $realm='All Resources'; + my $realm=''.&mt('All Resources').''; if ($middle=~/^(.+)\_\_\_\(all\)$/) { - $realm='Folder/Map: '.&Apache::lonnet::gettitle($1).''; + $realm=''.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).''; } elsif ($middle) { - $realm='Resource: '.&Apache::lonnet::gettitle($middle).''; + $realm=''.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).''; } if ($section ne $oldsection) { $r->print(&tableend()."\n

$section

"); @@ -1760,7 +1765,7 @@ ENDOVER } if ($part ne $oldpart) { $r->print(&tableend(). - "\n

Part: $part

"); + "\n

".&mt('Part').": $part

"); $oldpart=$part; } # @@ -1788,7 +1793,7 @@ ENDOVER } $r->print(&tableend(). - '

'); + '

'); } ################################################## @@ -1809,18 +1814,33 @@ sub handler { my $r=shift; if ($r->header_only) { - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; return OK; } &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); +# ----------------------------------------------------------- Clear out garbage + +%courseopt=(); +%useropt=(); +%parmhash=(); + +@ids=(); +%symbp=(); +%mapp=(); +%typep=(); +%keyp=(); + +%maptitles=(); + + # ----------------------------------------------------- Needs to be in a course if (($ENV{'request.course.id'}) && (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}))) { - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; $coursename=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};
'.&mt('Parameter').''. + &mt('Delete').''.&mt('Set to ...').'