--- loncom/interface/lonparmset.pm 2006/05/18 01:08:51 1.307 +++ loncom/interface/lonparmset.pm 2006/06/26 22:22:48 1.318 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.307 2006/05/18 01:08:51 raeburn Exp $ +# $Id: lonparmset.pm,v 1.318 2006/06/26 22:22:48 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -65,6 +65,7 @@ use Apache::lonlocal; use Apache::lonnavmaps; use Apache::longroup; use Apache::lonrss; +use LONCAPA; # --- Caches local to lonparmset @@ -493,7 +494,7 @@ sub storeparm_by_symb_inner { } if ($reply=~/^error\:(.*)/) { - return "Write Error: $1"; + return "Write Error: $1"; } return ''; } @@ -701,7 +702,7 @@ sub print_row { } my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); if ($automatic) { - $parm.='
'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'
'; + $parm.='
'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'
'; } $r->print(''.$parm.''); @@ -1056,15 +1057,15 @@ sub parmmenu { ENDSCRIPT $r->print(); - $r->print("\n"); + $r->print("\n
"); my $cnt=0; foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { - $r->print("\n'); + $r->print('>'.$$allparms{$tempkey}.''); $cnt++; if ($cnt==3) { $r->print("\n"); @@ -1072,7 +1073,7 @@ ENDSCRIPT } } $r->print(' -'; + $output .= &Apache::loncommon::start_data_table_row(). + ''; if ($parameter =~ /^default_enrollment_(start|end)_date$/) { $output .= ''; - $output .= "\n"; + $output .= &Apache::loncommon::end_data_table_row()."\n"; } my $onchange = 'onFocus="javascript:window.document.forms'. '[\'envform\'].elements[\'newp_setparmval\']'. '.checked=true;"'; - $output.=''; + ''. + &Apache::loncommon::end_data_table_row()."\n"; } my %lt=&Apache::lonlocal::texthash( 'par' => 'Parameter', @@ -2293,16 +2306,18 @@ sub crsenv { $browse_js); my $end_page = &Apache::loncommon::end_page(); + my $end_table=&Apache::loncommon::end_data_table(); $r->print(< $setoutput -

-

+
Select All
Select Common Only
@@ -1476,8 +1477,8 @@ sub assessparms { $id=''; } else { $message= - "".&mt("Unknown ID")." '$id' ". - &mt('at domain')." '$udom'"; + ''.&mt("Unknown ID")." '$id' ". + &mt('at domain')." '$udom'"; } } else { $uname=$env{'form.uname'}; @@ -1488,17 +1489,17 @@ sub assessparms { $uhome=&Apache::lonnet::homeserver($uname,$udom); if ($uhome eq 'no_host') { $message= - "".&mt("Unknown user")." '$uname' ". - &mt("at domain")." '$udom'"; + ''.&mt("Unknown user")." '$uname' ". + &mt("at domain")." '$udom'"; $uname=''; } else { $csec=&Apache::lonnet::getsection($udom,$uname, $env{'request.course.id'}); if ($csec eq '-1') { - $message="". + $message=''. &mt("User")." '$uname' ".&mt("at domain")." '$udom' ". - &mt("not in this course").""; + &mt("not in this course").""; $uname=''; $csec=$env{'form.csec'}; $cgroup=$env{'form.cgroup'}; @@ -1571,8 +1572,9 @@ sub assessparms { &displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); } else { my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); - $r->print(&mt('Specific Resource').": ".$resource. - ''. + my $title = &Apache::lonnet::gettitle($pssymb); + $r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource). + ''. '

'); } @@ -1732,7 +1734,7 @@ ENDTABLEHEADFOUR '

'. "$title"); @@ -2076,6 +2078,10 @@ sub crsenv { } } } + + my $start_table =&Apache::loncommon::start_data_table(); + my $start_header_row=&Apache::loncommon::start_data_table_header_row(); + my $end_header_row =&Apache::loncommon::end_data_table_header_row(); # ------------------------- Re-init course environment entries for this session &Apache::lonnet::coursedescription($env{'request.course.id'}, @@ -2092,9 +2098,9 @@ sub crsenv { ('url' => ''.&mt('Top Level Map').' '. '". - &mt('Select Map').'
'. + &mt('Select Map').'
'. &mt('Modification may make assessment data inaccessible'). - '
', + '', 'description' => ''.&mt('Course Description').'', 'courseid' => ''.&mt('Course ID or number'). '
'. @@ -2165,8 +2171,8 @@ sub crsenv { '('.&mt('or set value to "[_1]" to allow all roles',"yes").')', 'rndseed' => ''.&mt('Randomization algorithm used').'
'. - ''.&mt('Modifying this will make problems').' '. - &mt('have different numbers and answers').'', + ''.&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.'), @@ -2192,6 +2198,8 @@ sub crsenv { 'disable_receipt_display' => ''.&mt('Disable display of problem receipts').'
'. ' ('.&mt('"[_1]" to disable, anything else if not','yes').')', + 'task_messages' + => ''.&mt('Send message to student when clicking Done on Tasks. [_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','only_student','student_and_user_notes_screen').'', 'disablesigfigs' => ''.&mt('Disable checking of Significant Figures').'
'. ' ('.&mt('"[_1]" to disable, anything else if not','yes').')', @@ -2228,7 +2236,8 @@ sub crsenv { 'default_enrollment_end_date', 'tthoptions', 'disablesigfigs', - 'disableexampointprint' + 'disableexampointprint', + 'task_messages' ); foreach my $parameter (sort(keys(%values))) { unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) { @@ -2238,13 +2247,15 @@ sub crsenv { } } } + foreach my $parameter (@Display_Order) { my $description = $descriptions{$parameter}; # onchange is javascript to automatically check the 'Set' button. my $onchange = 'onFocus="javascript:window.document.forms'. "['envform'].elements['".$parameter."_setparmval']". '.checked=true;"'; - $output .= '

'.$description.''.$description.''. &Apache::lonhtmlcommon::date_setter('envform', @@ -2261,17 +2272,19 @@ sub crsenv { $output .= ''. &Apache::lonhtmlcommon::checkbox($parameter.'_setparmval'). '
'.&mt('Create New Environment Variable').'
'. + $output.=&Apache::loncommon::start_data_table_row(). + '
'.&mt('Create New Environment Variable').'
'. '
'. ''. - '
- +$start_table +$start_header_row + +$end_header_row $output -
$lt{'par'}$lt{'val'}$lt{'set'}?
$lt{'par'}$lt{'val'}$lt{'set'}?
+$end_table $end_page @@ -2389,8 +2404,8 @@ sub storedata { $r->print('
'.&mt('Stored modified parameter for').' '. &Apache::loncommon::plainname($tuname,$tudom)); } else { - $r->print('

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

'); + $r->print('
'. + &mt('Error storing parameters').'
'); } &Apache::lonnet::devalidateuserresdata($tuname,$tudom); } else { @@ -2404,8 +2419,8 @@ sub storedata { &log_parmset({$tkey=>''},1,$tuname,$tudom); $r->print('
'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom)); } else { - $r->print('

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

'); + $r->print('
'. + &mt('Error deleting parameters').'
'); } &Apache::lonnet::devalidateuserresdata($tuname,$tudom); } else { @@ -2422,8 +2437,8 @@ sub storedata { &log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); $r->print('
'.&mt('Stored modified date for').' '.&Apache::loncommon::plainname($tuname,$tudom)); } else { - $r->print('

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

'); + $r->print('
'. + &mt('Error storing parameters').'
'); } &Apache::lonnet::devalidateuserresdata($tuname,$tudom); } else { @@ -2444,8 +2459,8 @@ sub storedata { &log_parmset(\%loghash,1); $r->print('

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

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

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

'); + $r->print('
'. + &mt('Error deleting parameters').'
'); } &Apache::lonnet::devalidatecourseresdata($crs,$dom); } @@ -2454,8 +2469,8 @@ sub storedata { &log_parmset(\%newdata,0); $r->print('

'.&mt('Stored [_1] parameter(s)',$putentries/2).'

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

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

'); + $r->print('
'. + &mt('Error storing parameters').'
'); } &Apache::lonnet::devalidatecourseresdata($crs,$dom); } @@ -2530,12 +2545,12 @@ sub listdata { } $middle=~s/\.+$//; $middle=~s/^\.+//; - my $realm=''.&mt('All Resources').''; + my $realm=''.&mt('All Resources').''; if ($middle=~/^(.+)\_\_\_\(all\)$/) { - $realm=''.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).'
('.$1.')
'; + $realm=''.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).'
('.$1.')
'; } elsif ($middle) { my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); - $realm=''.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).'
('.$url.' in '.$map.' id: '.$id.')
'; + $realm=''.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).'
('.$url.' in '.$map.' id: '.$id.')
'; } if ($sortorder eq 'realmstudent') { if ($realm ne $oldrealm) { @@ -2562,7 +2577,7 @@ sub listdata { } if ($part ne $oldpart) { $r->print(&tableend(). - "\n".&mt('Part').": $part"); + "\n".&mt('Part').": $part"); $oldpart=$part; } # @@ -2695,24 +2710,27 @@ ENDOVER # Menu to select levels, etc - $r->print('
'); + $r->print(' + '); } $r->print('
'); &levelmenu($r,\%alllevs,$parmlev); if ($parmlev ne 'general') { - $r->print(''); + $r->print(''); &mapmenu($r,\%allmaps,$pschp,\%maptitles); $r->print('
'); - $r->print('
'); + $r->print(' + '. &Apache::loncommon::end_data_table_header_row()); + my $shown=0; foreach my $id (sort { $parmlog{$b}{'exe_time'}<=>$parmlog{$a}{'exe_time'} } (keys(%parmlog))) { my @changes=keys(%{$parmlog{$id}{'logentry'}}); my $count=$#changes+1; @@ -3409,7 +3467,7 @@ sub parm_change_log { $r->print($value); } if ($value ne $all[$level]) { - $r->print('
'.&mt('Not active anymore').''); + $r->print('
'.&mt('Not active anymore').''); } else { $stillactive=1; } @@ -3434,8 +3492,12 @@ sub parm_change_log { } $r->print(&Apache::loncommon::end_data_table_row()); } + $shown++; + if (!($env{'form.show'} eq &mt('all') + || $shown<=$env{'form.show'})) { last; } } $r->print(&Apache::loncommon::end_data_table()); + $r->print(''); $r->print(&Apache::loncommon::end_page()); }
'); &parmmenu($r,\%allparms,\@pscat,\%keyorder); - $r->print(''. - '
'.&mt('Parts').''.&mt('Section(s)'). - ''.&mt('Group(s)').'
'); + $r->print(' + '. + '
'.&mt('Parts').''.&mt('Section(s)'). + ''.&mt('Group(s)').'
'); &partmenu($r,\%allparts,\@psprt); - $r->print(' '); + $r->print(''); §ionmenu($r,\@selected_sections); - $r->print(' '); + $r->print(''); &groupmenu($r,\@selected_groups); $r->print('
'); $r->print('
'); @@ -3031,14 +3049,14 @@ ENDMAINFORMHEAD } next if (! $menu_item->{'permission'}); $menu_html.='

'; - $menu_html.=''; + $menu_html.=''; if (exists($menu_item->{'url'})) { $menu_html.=qq{}; } else { $menu_html.= qq{}; } - $menu_html.= &mt($menu_item->{'text'}).''; + $menu_html.= &mt($menu_item->{'text'}).''; if (exists($menu_item->{'help'})) { $menu_html.= &Apache::loncommon::help_open_topic($menu_item->{'help'}); @@ -3227,11 +3245,15 @@ ENDDEFHEAD } $r->print(&mt('Manual setting rules apply to all interfaces.').'
'. &mt('Automatic setting rules apply to table mode interfaces only.')); - $r->print("\n'); + $r->print("\n".&Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row(). + "'. + &Apache::loncommon::end_data_table_header_row()); foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) { unless ($tempkey) { next; } - $r->print("\n'); + $r->print(''.&Apache::loncommon::end_data_table_row()); } - $r->print("
".&mt('Rule for parameter').''. - &mt('Action').''.&mt('Value').'
".&mt('Rule for parameter').''. + &mt('Action').''.&mt('Value').'
".$allparms{$tempkey}."\n
(".$tempkey.')
'); + $r->print("\n".&Apache::loncommon::start_data_table_row(). + "".$allparms{$tempkey}."\n
(".$tempkey.')
'); my $action=&rulescache($tempkey.'_action'); $r->print(''); } - $r->print('
\n\n". &Apache::loncommon::end_page()); return; @@ -3309,14 +3332,14 @@ sub components { $section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom); $issection=''; } - my $realm=''.&mt('All Resources').''; + my $realm=''.&mt('All Resources').''; my $realmdescription=&mt('all resources'); if ($middle=~/^(.+)\_\_\_\(all\)$/) { - $realm=''.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).'
('.$1.')
'; + $realm=''.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).'
('.$1.')
'; $realmdescription=&mt('folder').' '.&Apache::lonnet::gettitle($1); } elsif ($middle) { my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); - $realm=''.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).'
('.$url.' in '.$map.' id: '.$id.')
'; + $realm=''.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).'
('.$url.' in '.$map.' id: '.$id.')
'; $realmdescription=&mt('resource').' '.&Apache::lonnet::gettitle($middle); } my $what=$part.'.'.$name; @@ -3333,9 +3356,18 @@ sub standard_parameter_names { 'weight' => 'Weight', 'date_start' => 'Starting Date', 'date_end' => 'Ending Date', + 'interval' => 'Time Interval Length', + 'tol' => 'Numerical Tolerance', + 'sig' => 'Significant Digits', + 'contentopen' => 'Content Opening Date', + 'contentclose' => 'Content Closing Date', + 'discussend' => 'End of Discussion Time', + 'discusshide' => 'Discussion Hidden', + 'problemstatus' => 'Problem Status Visible', 'int_pos' => 'Positive Integer', 'int_zero_pos' => 'Positive Integer or Zero', - 'hinttries' => 'Number of Tries till Hints appear'); + 'hinttries' => 'Number of Tries till Hints appear', + 'numbubbles' => 'Number of Bubbles in Exam Mode'); if ($standard_parms{$name}) { return $standard_parms{$name}; } else { @@ -3343,20 +3375,46 @@ sub standard_parameter_names { } } +# +# Parameter Change Log +# + + sub parm_change_log { my ($r)=@_; &startpage($r); my %parmlog=&Apache::lonnet::dump('nohist_parameterlog', $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}); + if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); } + $r->print('

+ '); + + my %saveable_parameters = ('show' => 'scalar',); + &Apache::loncommon::store_course_settings('parameter_log', + \%saveable_parameters); + &Apache::loncommon::restore_course_settings('parameter_log', + \%saveable_parameters); + if (!$env{'form.show'}) { $env{'form.show'}=10; } + + my $countselect = + &Apache::lonmeta::selectbox('show',$env{'form.show'},undef, + (&mt('all'),10,20,50,100,1000,10000)); + + $r->print(''.&mt('[_1] Records',$countselect).''. + ''); + my $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'}, $env{'course.'.$env{'request.course.id'}.'.domain'}); $r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). '
'.&mt('Time').''.&mt('User').''.&mt('Extent').''.&mt('Users').''. &mt('Parameter').''.&mt('Part').''.&mt('New Value').''.&mt('Announce').'