--- loncom/interface/lonparmset.pm 2004/02/24 23:22:27 1.151 +++ loncom/interface/lonparmset.pm 2004/10/15 22:29:31 1.176 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.151 2004/02/24 23:22:27 albertel Exp $ +# $Id: lonparmset.pm,v 1.176 2004/10/15 22:29:31 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -307,9 +307,7 @@ sub startpage { 'ad' => "at Domain" ); my $overallhelp= - &Apache::loncommon::help_open_topic("Course_Setting_Parameters"). - &Apache::loncommon::help_open_faq(10). - &Apache::loncommon::help_open_bug('Instructor Interface'); + &Apache::loncommon::help_open_menu('','Setting Parameters','Course_Setting_Parameters','',10,'Instructor Interface'); my $assessparmhelp=&Apache::loncommon::help_open_topic("Cascading_Parameters","Assessment Parameters"); $r->print(< @@ -544,7 +542,7 @@ Input: See list below: =item B: hash, id->type, where "type" contains the extension of the file, thus, I. -=item B: hash, id->key list, will contain a comma seperated list of the meta-data keys available for the given id +=item B: hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id =item B: hash, name of parameter->display value (what is the display value?) @@ -583,11 +581,14 @@ sub extractResourceInformation { foreach (keys %$bighash) { if ($_=~/^src\_(\d+)\.(\d+)$/) { + # there are no resources in the 0 level + if ($1 eq '0') { next; } my $mapid=$1; my $resid=$2; my $id=$mapid.'.'.$resid; my $srcf=$$bighash{$_}; - if ($srcf=~/\.(problem|exam|quiz|assess|survey|form)$/) { + if (1) { + $srcf=~/\.(\w+)$/; $$ids[$#$ids+1]=$id; $$typep{$id}=$1; $$keyp{$id}=''; @@ -596,6 +597,10 @@ sub extractResourceInformation { my $key=$_; my $allkey=$1; $allkey=~s/\_/\./g; + if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq + 'parm') { + next; #hide hidden things + } my $display= &Apache::lonnet::metadata($srcf,$key.'.display'); my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); @@ -620,8 +625,12 @@ sub extractResourceInformation { &Apache::lonnet::declutter($$bighash{'map_id_'.$mapid}); $$mapp{$mapid}=$$mapp{$id}; $$allmaps{$mapid}=$$mapp{$id}; - $$maptitles{$mapid}= - $$bighash{'title_'.$$bighash{'ids_'.&Apache::lonnet::clutter($$mapp{$id})}}; + if ($mapid eq '1') { + $$maptitles{$mapid}='Main Course Documents'; + } else { + $$maptitles{$mapid}= + $$bighash{'title_'.$$bighash{'ids_'.&Apache::lonnet::clutter($$mapp{$id})}}; + } $$maptitles{$$mapp{$id}}=$$maptitles{$mapid}; $$symbp{$id}=$$mapp{$id}. '___'.$resid.'___'. @@ -690,8 +699,12 @@ sub assessparms { my $message=''; $csec=$ENV{'form.csec'}; - $udom=$ENV{'form.udom'}; - unless ($udom) { $udom=$r->dir_config('lonDefDomain'); } + if ($udom=$ENV{'form.udom'}) { + } elsif ($udom=$ENV{'request.role.domain'}) { + } elsif ($udom=$ENV{'user.domain'}) { + } else { + $udom=$r->dir_config('lonDefDomain'); + } my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); my $pschp=$ENV{'form.pschp'}; @@ -943,7 +956,9 @@ sub assessparms { my $submitmessage = &mt('Update Section or Specific User'); if (!$pssymb) { - $r->print(''.&mt('Select Parameter Level').''); + $r->print(''.&mt('Select Parameter Level'). + &Apache::loncommon::help_open_topic('Course_Parameter_Levels'). + ''); $r->print('print(' checked') unless (@pscat); - $r->print('>'.&mt('All Parameters').''); - + $r->print(''); my $cnt=0; foreach $tempkey (sort { $allparms{$a} cmp $allparms{$b} } keys %allparms ) { ++$cnt; - $r->print('') unless ($cnt%2); + $r->print('') if ($cnt%2); $r->print(''); + $r->print('>'.$allparms{$tempkey}.''); + } + $r->print(' + +'); $r->print('
print('value="'.$tempkey.'"'); if ($pscat[0] eq "all" || grep $_ eq $tempkey, @pscat) { $r->print(' checked'); } - $r->print('>'.$allparms{$tempkey}.'
+ + + + +
'); # $r->print('Select Parts'); @@ -1151,8 +1179,10 @@ ENDTABLEHEADFOUR my $rid=$_; my ($inmapid)=($rid=~/\.(\d+)$/); - if (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid}) || - ($pssymb eq $symbp{$rid})) { + if ((!$pssymb && + (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid}))) + || + ($pssymb && $pssymb eq $symbp{$rid})) { # ------------------------------------------------------ Entry for one resource if ($defbgone eq '"E0E099"') { $defbgone='"E0E0DD"'; @@ -1196,7 +1226,8 @@ ENDTABLEHEADFOUR '>'. join(' / ',split(/\//,$uri)). '

'. - "$title"); @@ -1331,6 +1362,7 @@ ENDMAPONE $r->print(''.&mt('Parameter in Effect').''); foreach (sort keys %name) { + $r->print(''); &print_row($r,$_,\%part,\%name,$mapid,\%default, \%type,\%display,$defbgone,$defbgtwo, $parmlev); @@ -1408,6 +1440,7 @@ ENDMAPONE $r->print(''.&mt('Parameter in Effect').''); foreach (sort keys %name) { + $r->print(''); &print_row($r,$_,\%part,\%name,$mapid,\%default, \%type,\%display,$defbgone,$defbgtwo,$parmlev); # $r->print("resource.$part{$_}.$name{$_},$symbp{$mapid}\n"); @@ -1496,7 +1529,7 @@ sub crsenv { } # # Let the user know we made the changes - if ($name) { + if ($name && defined($value)) { my $put_result = &Apache::lonnet::put('environment', {$name=>$value},$dom,$crs); if ($put_result eq 'ok') { @@ -1526,7 +1559,7 @@ sub crsenv { &mt('Modification may make assessment data inaccessible'). '', 'description' => ''.&mt('Course Description').'', - 'courseid' => ''.&mt('Course ID').' '.&mt('or').' '.&mt('number'). + 'courseid' => ''.&mt('Course ID or number'). '
'. '('.&mt('internal').', '.&mt('optional').')', 'grading' => ''.&mt('Grading').'
'. @@ -1543,16 +1576,17 @@ sub crsenv { 'policy.email' => ''.&mt('Feedback Addresses for Course Policy').''. '
(user:domain,user:domain(section;section;...;*;...),...)', 'hideemptyrows' => ''.&mt('Hide Empty Rows in Spreadsheets').'
'. - '("yes" for default hiding)', + '('.&mt('"[_1]" for default hiding','yes').')', 'pageseparators' => ''.&mt('Visibly Separate Items on Pages').'
'. - '("'.&mt('yes').'" '.&mt('for visible separation').', '. + '('.&mt('"[_1]" for visible separation','yes').', '. &mt('changes will not show until next login').')', + 'student_classlist_view' => ''.&mt('Allow students to view classlist.').''.&mt('("all":students can view all sections,"section":students can only view their own section.blank or "disabled" prevents student view.'), 'plc.roles.denied'=> ''.&mt('Disallow live chatroom use for Roles'). '
"st": '. - 'student, "ta": '. + &mt('student').', "ta": '. 'TA, "in": '. - 'instructor;
role,role,...) '. + &mt('instructor').';
'.&mt('role,role,...').') '. Apache::loncommon::help_open_topic("Course_Disable_Discussion"), 'plc.users.denied' => ''.&mt('Disallow live chatroom use for Users').'
'. @@ -1584,7 +1618,10 @@ sub crsenv { ",'spreadsheet')\">$SelectSpreadsheetFile

", 'allow_limited_html_in_feedback' => ''.&mt('Allow limited HTML in discussion posts').'
'. - '('.&mt('Set value to').' "'.&mt('yes').'" '.&mt('to allow').')', + '('.&mt('Set value to "[_1]" to allow',"yes").')', + 'allow_discussion_post_editing' + => ''.&mt('Allow users to edit/delete their own discussion posts').'
'. + '('.&mt('Set value to "[_1]" to allow',"yes").')', 'rndseed' => ''.&mt('Randomization algorithm used').'
'. ''.&mt('Modifying this will make problems').' '. @@ -1592,9 +1629,17 @@ sub crsenv { 'receiptalg' => ''.&mt('Receipt algorithm used').'
'. &mt('This controls how receipt numbers are generated.'), + 'suppress_tries' + => ''.&mt('Suppress number of tries in printing').'('. + &mt('yes if supress').')', 'problem_stream_switch' => ''.&mt('Allow problems to be split over pages').'
'. - ' ("'.&mt('yes').'" '.&mt('if allowed, anything else if not').')', + ' ('.&mt('"[_1]" if allowed, anything else if not','yes').')', + 'default_paper_size' + => ''.&mt('Default paper type').'
'. + ' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'. + ' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'. + ' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])', 'anonymous_quiz' => ''.&mt('Anonymous quiz/exam').'
'. ' ('.&mt('yes').' '.&mt('to avoid print students names').' )', @@ -1605,21 +1650,28 @@ sub crsenv { 'languages' => ''.&mt('Languages used').'', 'disable_receipt_display' => ''.&mt('Disable display of problem receipts').'
'. - ' ("'.&mt('yes').'" '.&mt('to disable, anything else if not').')', + ' ('.&mt('"[_1]" to disable, anything else if not','yes').')', + 'disablesigfigs' + => ''.&mt('Disable checking of Significant Figures').'
'. + ' ('.&mt('"[_1]" to disable, anything else if not','yes').')', 'tthoptions' => ''.&mt('Default set of options to pass to tth/m when converting tex').'' ); my @Display_Order = ('url','description','courseid','grading', 'default_xml_style','pageseparators', 'question.email','comment.email','policy.email', + 'student_classlist_view', 'plc.roles.denied','plc.users.denied', 'pch.roles.denied','pch.users.denied', 'allow_limited_html_in_feedback', + 'allow_discussion_post_editing', 'languages', 'nothideprivileged', 'rndseed', 'receiptalg', 'problem_stream_switch', + 'suppress_tries', + 'default_paper_size', 'disable_receipt_display', 'spreadsheet_default_classcalc', 'spreadsheet_default_studentcalc', @@ -1627,7 +1679,8 @@ sub crsenv { 'hideemptyrows', 'default_enrollment_start_date', 'default_enrollment_end_date', - 'tthoptions' + 'tthoptions', + 'disablesigfigs' ); foreach my $parameter (sort(keys(%values))) { unless ($parameter =~ m/^internal\./) { @@ -1672,34 +1725,21 @@ sub crsenv { $onchange.' />'. ''; } + my %lt=&Apache::lonlocal::texthash( + 'par' => 'Parameter', + 'val' => 'Value', + 'set' => 'Set', + 'sce' => 'Set Course Environment' + ); + my $Parameter=&mt('Parameter'); my $Value=&mt('Value'); my $Set=&mt('Set'); + my $browse_js=&Apache::loncommon::browser_and_searcher_javascript('parmset'); $r->print(< LON-CAPA Course Environment @@ -1709,10 +1749,10 @@ $bodytag $setoutput

- + $output
$Parameter$Value$Set?
$lt{'par'}$lt{'val'}$lt{'set'}?
- + @@ -1773,7 +1813,7 @@ ENDOVER push (@deldata,$thiskey); } elsif ($cmd eq 'datepointer') { my $data=&Apache::lonhtmlcommon::get_date_from_form($ENV{$_}); - if ($olddata{$thiskey} ne $data) { $newdata{$thiskey}=$data; } + if (defined($data) and $olddata{$thiskey} ne $data) { $newdata{$thiskey}=$data; } } } } @@ -1817,9 +1857,10 @@ ENDOVER $middle=~s/\.$//; my $realm=''.&mt('All Resources').''; if ($middle=~/^(.+)\_\_\_\(all\)$/) { - $realm=''.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).''; + $realm=''.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).'
('.$1.')
'; } elsif ($middle) { - $realm=''.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).''; + my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); + $realm=''.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).'
('.$url.' in '.$map.' id: '.$id.')
'; } if ($section ne $oldsection) { $r->print(&tableend()."\n


$section

"); @@ -1906,7 +1947,10 @@ sub handler { # ----------------------------------------------------- Needs to be in a course if (($ENV{'request.course.id'}) && - (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}))) { + (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}) || + &Apache::lonnet::allowed('opa',$ENV{'request.course.id'}.'/'. + $ENV{'request.course.sec'}) + )) { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header;