--- loncom/interface/lonparmset.pm 2003/12/04 21:45:18 1.141 +++ loncom/interface/lonparmset.pm 2004/04/28 18:10:54 1.158 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.141 2003/12/04 21:45:18 sakharuk Exp $ +# $Id: lonparmset.pm,v 1.158 2004/04/28 18:10:54 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -306,6 +306,11 @@ sub startpage { 'oi' => "or ID", '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'); + my $assessparmhelp=&Apache::loncommon::help_open_topic("Cascading_Parameters","Assessment Parameters"); $r->print(< @@ -354,6 +359,7 @@ sub startpage { $selscript $bodytag + ENDHEAD unless ($trimheader) {$r->print(<
+$assessparmhelp

$lt{'caphm'}

@@ -432,7 +439,7 @@ sub print_row { $parm=~s|\[.*\]\s||g; } - $r->print(''.$parm.''); + $r->print(''.&mt($parm).''); my $thismarker=$which; $thismarker=~s/^parameter\_//; @@ -580,7 +587,8 @@ sub extractResourceInformation { my $resid=$2; my $id=$mapid.'.'.$resid; my $srcf=$$bighash{$_}; - if ($srcf=~/\.(problem|exam|quiz|assess|survey|form)$/) { +# if ($srcf=~/\.(problem|exam|quiz|assess|survey|form)$/) { + if (1) { $$ids[$#$ids+1]=$id; $$typep{$id}=$1; $$keyp{$id}=''; @@ -1099,9 +1107,9 @@ sub assessparms { 'rl' => "Resource Level", 'ic' => 'in Course', 'aut' => "Assessment URL and Title", - 'type' => &mt('Type'), + 'type' => 'Type', 'emof' => "Enclosing Map or Folder", - 'part' => &mt('Part'), + 'part' => 'Part', 'pn' => 'Parameter Name', 'def' => 'default', 'femof' => 'from Enclosing Map or Folder', @@ -1144,8 +1152,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"'; @@ -1189,7 +1199,8 @@ ENDTABLEHEADFOUR '>'. join(' / ',split(/\//,$uri)). '

'. - "$title"); @@ -1489,7 +1500,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') { @@ -1519,14 +1530,11 @@ 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').''. - ' "'.&mt('standard').'", "'.&mt('external').'", '. - &mt('or any other value').'.'. - ' '.&mt('Default for new courses is').' "'. - &mt('standard').'".', + 'grading' => ''.&mt('Grading').'
'. + '"standard", "external", or "spreadsheet" '.&Apache::loncommon::help_open_topic('GradingOptions'), 'default_xml_style' => ''.&mt('Default XML Style File').' '. '
''.&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').')', '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').'
'. @@ -1580,23 +1588,30 @@ 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").')', 'rndseed' => ''.&mt('Randomization algorithm used').'
'. ''.&mt('Modifying this will make problems').' '. &mt('have different numbers and answers').'', + 'receiptalg' + => ''.&mt('Receipt algorithm used').'
'. + &mt('This controls how receipt numbers are generated.'), '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').')', 'anonymous_quiz' - => ''.&mt('Anonimous quiz/exam').'
'. + => ''.&mt('Anonymous quiz/exam').'
'. ' ('.&mt('yes').' '.&mt('to avoid print students names').' )', 'default_enrollment_start_date' => ''.&mt('Default beginning date when enrolling students').'', 'default_enrollment_end_date' => ''.&mt('Default ending date when enrolling students').'', + 'nothideprivileged' => ''.&mt('Privileged users that should not be hidden on staff listings').''. + '
(user:domain,user:domain,...)', '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').')', + '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', @@ -1605,7 +1620,9 @@ sub crsenv { 'pch.roles.denied','pch.users.denied', 'allow_limited_html_in_feedback', 'languages', + 'nothideprivileged', 'rndseed', + 'receiptalg', 'problem_stream_switch', 'disable_receipt_display', 'spreadsheet_default_classcalc', @@ -1614,12 +1631,15 @@ sub crsenv { 'hideemptyrows', 'default_enrollment_start_date', 'default_enrollment_end_date', + 'tthoptions' ); foreach my $parameter (sort(keys(%values))) { - if (! $descriptions{$parameter}) { - $descriptions{$parameter}=$parameter; - push(@Display_Order,$parameter); - } + unless ($parameter =~ m/^internal\./) { + if (! $descriptions{$parameter}) { + $descriptions{$parameter}=$parameter; + push(@Display_Order,$parameter); + } + } } foreach my $parameter (@Display_Order) { my $description = $descriptions{$parameter}; @@ -1656,34 +1676,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(); $r->print(< LON-CAPA Course Environment @@ -1693,10 +1700,10 @@ $bodytag $setoutput

- + $output
$Parameter$Value$Set?
$lt{'par'}$lt{'val'}$lt{'set'}?
- + @@ -1757,13 +1764,30 @@ 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; } } } } # Store - &Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs); - &Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs); + my $delentries=$#deldata+1; + my @newdatakeys=keys %newdata; + my $putentries=$#newdatakeys+1; + if ($delentries) { + if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { + $r->print('

'.&mt('Deleted [_1] parameter(s)

',$delentries)); + } else { + $r->print('

'. + &mt('Error deleting parameters').'

'); + } + } + if ($putentries) { + if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { + $r->print('

'.&mt('Stored [_1] parameter(s)

',$putentries)); + } else { + $r->print('

'. + &mt('Error storing parameters').'

'); + } + } # Read and display my %resourcedata=&Apache::lonnet::dump('resourcedata',$dom,$crs); my $oldsection=''; @@ -1771,6 +1795,7 @@ ENDOVER my $oldpart=''; my $pointer=0; $tableopen=0; + my $foundkeys=0; foreach my $thiskey (sort keys %resourcedata) { if ($resourcedata{$thiskey.'.type'}) { my ($course,$middle,$part,$name)= @@ -1808,6 +1833,7 @@ ENDOVER $r->print(&tablestart().''.$name. ':'); + $foundkeys++; if ($resourcedata{$thiskey.'.type'}=~/^date/) { my $jskey='key_'.$pointer; $pointer++; @@ -1826,8 +1852,8 @@ ENDOVER } } - $r->print(&tableend(). - '

'); + $r->print(&tableend().'

'. + ($foundkeys?'':&mt('There are no course or section parameters.')).'

'); } ##################################################