--- loncom/interface/lonparmset.pm 2008/01/24 23:23:55 1.390 +++ loncom/interface/lonparmset.pm 2008/06/16 23:35:58 1.400 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.390 2008/01/24 23:23:55 www Exp $ +# $Id: lonparmset.pm,v 1.400 2008/06/16 23:35:58 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2026,6 +2026,8 @@ sub crsenv { my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; + my (%crsinfo,$chome); + # # Go through list of changes foreach (keys %env) { @@ -2120,19 +2122,37 @@ sub crsenv { my $put_result = &Apache::lonnet::put('environment', {$name=>$value},$dom,$crs); if ($put_result eq 'ok') { - $setoutput.=&mt('Set').' '.$name.' '.&mt('to').' '.$value.'.
'; + $setoutput.=&mt('Set').' '.$name.' '.&mt('to').' '; + if ($name =~ /^default_enrollment_(start|end)_date$/) { + $setoutput .= &Apache::lonlocal::locallocaltime($value); + } else { + $setoutput .= $value; + } + $setoutput .= '.
'; if ($name eq 'cloners') { &change_clone($value,\@oldcloner); } # Update environment and nohist_courseids.db - if ($name eq 'description' && defined($value)) { - my %crsinfo = - &Apache::lonnet::courseiddump($dom,'.',1,'.','.', + if ($name eq 'description' || $name eq 'cloners') { + if ($chome eq '') { + %crsinfo = + &Apache::lonnet::courseiddump($dom,'.',1,'.','.', $crs,undef,undef,'Course'); - &Apache::lonnet::appenv('course.'.$env{'request.course.id'}.'.description' => $value); + $chome = &Apache::lonnet::homeserver($crs,$dom); + } + } + if ($name eq 'description' && defined($value)) { + &Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.description' => $value}); if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') { $crsinfo{$env{'request.course.id'}}{'description'} = $value; - my $chome = &Apache::lonnet::homeserver($crs,$dom); + my $putresult = + &Apache::lonnet::courseidput($dom,\%crsinfo, + $chome,'notime'); + } + } + if ($name eq 'cloners') { + if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') { + $crsinfo{$env{'request.course.id'}}{'cloners'} = $value; my $putresult = &Apache::lonnet::courseidput($dom,\%crsinfo, $chome,'notime'); @@ -2190,74 +2210,72 @@ sub crsenv { my $output=''; if (! exists($values{'con_lost'})) { my %descriptions= - ('url' => ''.&mt('Top Level Map').' '. + ('url' => ''.&mt('Top Level Map').'
'. '". &mt('Select Map').'
'. - &mt('Modification may make assessment data inaccessible'). + &mt('Modification may make assessment data inaccessible!'). '', 'description' => ''.&mt('Course Description').'', 'courseid' => ''.&mt('Course ID or number'). '
'. - '('.&mt('internal').', '.&mt('optional').')', - 'cloners' => ''.&mt('Users allowed to clone course').'
(user:domain,user:domain,*:domain)
'.&mt('Users with active Course Coordinator role in course are permitted to clone and need not be included.
-Use *:domain to allow course to be cloned by anyone in the specified domain.
-Use * to allow unrestricted cloning in all domains.'), + '('.&mt('internal, optional').')', + 'cloners' => ''.&mt('Users allowed to clone course').'
' + .'("'.&mt('user:domain,user:domain,*:domain').'")
' + .&mt('Users with active Course Coordinator role in this course are permitted to clone and need not be included.').'
' + .&mt('Use [_1] to allow course to be cloned by anyone in the specified domain.','"*:domain"').'
' + .&mt('Use [_1] to allow unrestricted cloning in all domains.','"*"'), 'grading' => ''.&mt('Grading').'
'. - '"standard", "external", or "spreadsheet" '.&Apache::loncommon::help_open_topic('GradingOptions'), - 'task_grading' => ''.&mt('Bridge Task Grading').'
'. - &mt('Instructors and TAs in sections, when grading bridge tasks, should be allowed to grade other sections, "[_1]" they are allowed (this is the default), "[_2]" no, they can only grade their own section','any','section'), - 'default_xml_style' => ''.&mt('Default XML Style File').' '. + &mt('[_1], [_2], or [_3]','"standard"','"external"','"spreadsheet"').&Apache::loncommon::help_open_topic('GradingOptions'), + 'task_grading' => ''.&mt('Bridge Task Grading').'
' + .&mt('Instructors and TAs in sections, when grading bridge tasks, should be allowed to grade other sections.').'
' + .'('.&mt('[_1]: they are allowed (this is the default). [_2]: no, they can only grade their own section.','"any"','"section"').')', + 'default_xml_style' => ''.&mt('Default XML Style File').'
'. '$SelectStyleFile
", - 'question.email' => ''.&mt('Feedback Addresses for Resource Content Question'). - '
(user:domain,'. - 'user:domain(section;section;...;*;...),...)', - 'question.email.text' => ''.&mt('Custom Text for Resource Content Question Option in Feedback'). - '', - 'comment.email' => ''.&mt('Feedback Addresses for Course Content Comments').'
'. - '(user:domain,user:domain(section;section;...;*;...),...)', - 'comment.email.text' => ''.&mt('Custom Text for Course Content Option in Feedback'). - '', - 'policy.email' => ''.&mt('Feedback Addresses for Course Policy').''. - '
(user:domain,user:domain(section;section;...;*;...),...)', - 'policy.email.text' => ''.&mt('Custom Text for Course Policy Option in Feedback'). - '', - 'hideemptyrows' => ''.&mt('Hide Empty Rows in Spreadsheets').'
'. - '('.&mt('"[_1]" for default hiding','yes').')', - 'pageseparators' => ''.&mt('Visibly Separate Items on Pages').'
'. - '('.&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.)'), - 'student_classlist_portfiles' => ''.&mt('Include link to accessible portfolio files').'
'.&mt('"[_1]" for link to each a listing of each student\'s files.','yes'), - 'student_classlist_opt_in' => ''.&mt("Student's agreement needed for listing in student-viewable roster").'
'.&mt('"[_1]" to require students to opt-in to listing in the roster (on the roster page).','yes'), - 'plc.roles.denied'=> ''.&mt('Disallow live chatroom use for Roles'). - '
("st": '. - &mt('student').', "ta": '. - 'TA, "in": '. - &mt('instructor').';
'.&mt('role,role,...').') '. - Apache::loncommon::help_open_topic("Course_Disable_Discussion"), + 'question.email' => ''.&mt('Feedback Addresses for Resource Content Question').'
' + .'("'.&mt('user:domain,user:domain(section;section;...;*;...),...').'")', + 'question.email.text' => ''.&mt('Custom Text for Resource Content Question Option in Feedback').'', + 'comment.email' => ''.&mt('Feedback Addresses for Course Content Comments').'
' + .'("'.&mt('user:domain,user:domain(section;section;...;*;...),...').'")', + 'comment.email.text' => ''.&mt('Custom Text for Course Content Option in Feedback').'', + 'policy.email' => ''.&mt('Feedback Addresses for Course Policy').'
' + .'("'.&mt('user:domain,user:domain(section;section;...;*;...),...').'")', + 'policy.email.text' => ''.&mt('Custom Text for Course Policy Option in Feedback').'', + 'hideemptyrows' => ''.&mt('Hide Empty Rows in Spreadsheets').'
' + .'('.&mt('[_1] for default hiding','"yes"').')', + 'pageseparators' => ''.&mt('Visibly Separate Items on Pages').'
' + .'('.&mt('[_1] for visible separation.','"yes"').' ' + .&mt('Changes will not show until next login.').')', + 'student_classlist_view' => ''.&mt('Allow students to view classlist.').'
' + .'('.&mt('[_1]: students can view all sections. [_2]: students can only view their own section. blank or [_3] prevents student view.','"all"','"section"','"disabled"').')', + 'student_classlist_portfiles' => ''.&mt('Include link to accessible portfolio files').'
' + .'('.&mt('[_1] for link to each a listing of each student\'s files.','"yes"').')', + 'student_classlist_opt_in' => ''.&mt("Student's agreement needed for listing in student-viewable roster").'
' + .'('.&mt('[_1] to require students to opt-in to listing in the roster (on the roster page).','"yes"').')', + 'plc.roles.denied'=> ''.&mt('Disallow live chatroom use for Roles').'
' + .'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"st"','"ta"','"in"').')
' + .'("'.&mt('role,role,...').'") ' + .Apache::loncommon::help_open_topic("Course_Disable_Discussion"), 'plc.users.denied' => ''.&mt('Disallow live chatroom use for Users').'
'. - '(user:domain,user:domain,...)', + '("'.&mt('user:domain,user:domain,...').'")', - 'pch.roles.denied'=> ''.&mt('Disallow Resource Discussion for Roles'). - '
("st": '. - 'student, "ta": '. - 'TA, "in": '. - 'instructor;
role,role,...) '. - Apache::loncommon::help_open_topic("Course_Disable_Discussion"), + 'pch.roles.denied'=> ''.&mt('Disallow Resource Discussion for Roles').'
' + .'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"st"','"ta"','"in"') + .'("'.&mt('role,role,...').'") ' + .Apache::loncommon::help_open_topic("Course_Disable_Discussion"), 'pch.users.denied' => ''.&mt('Disallow Resource Discussion for Users').'
'. - '(user:domain,user:domain,...)', + '("'.&mt('user:domain,user:domain,...').'")', 'spreadsheet_default_classcalc' => ''.&mt('Default Course Spreadsheet').' '. '$SelectSpreadsheetFile
", 'spreadsheet_default_studentcalc' - => ''.&mt('Default Student Spreadsheet').' '. + => ''.&mt('Default Student Spreadsheet').'
'. '$SelectSpreadsheetFile
", @@ -2268,43 +2286,45 @@ Use * to allow unrestricted cloning in a ",'spreadsheet')\">$SelectSpreadsheetFile
", 'allow_limited_html_in_feedback' => ''.&mt('Allow limited HTML in discussion posts').'
'. - '('.&mt('Set value to "[_1]" to allow',"yes").')', + '('.&mt('Set value to [_1] to allow.','"yes"').')', 'allow_discussion_post_editing' - => ''.&mt('Allow users with specified roles to edit/delete their own discussion posts').'
"st": '. - &mt('student').', "ta": '. - 'TA, "in": '. - &mt('instructor').'; ('.&mt('role:section,role:section,..., e.g., st:001,st:002,in,cc would permit students in sections 001 and 002 and instructors in any section, and course coordinators to edit their own posts.').')
'. - '('.&mt('or set value to "[_1]" to allow all roles',"yes").')', + => ''.&mt('Allow users with specified roles to edit/delete their own discussion posts').'
' + .'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"st"','"ta"','"in"').')
' + .'('.&mt('Set value to [_1] to allow all roles.','"yes"').')' + .'("'.&mt('role:section,role:section,...').'")
' + .'('.&mt('Example: "st:001,st:002,in,cc" would permit students in sections 001 and 002 and instructors in any section, and course coordinators to edit their own posts.').')', 'rndseed' - => ''.&mt('Randomization algorithm used').'
'. - ''.&mt('Modifying this will make problems').' '. - &mt('have different numbers and answers').'', + => ''.&mt('Randomization algorithm used').'
' + .'' + .&mt('Modifying this will make problems have different numbers and answers!') + .'', 'receiptalg' => ''.&mt('Receipt algorithm used').'
'. &mt('This controls how receipt numbers are generated.'), 'suppress_tries' => ''.&mt('Suppress number of tries in printing').'
'. - ' ('.&mt('"[_1]" to suppress, anything else to not suppress','yes').')', + ' ('.&mt('[_1] to suppress, anything else to not suppress','"yes"').')', 'problem_stream_switch' => ''.&mt('Allow problems to be split over pages').'
'. - ' ('.&mt('"[_1]" if allowed, anything else if not','yes').')', + ' ('.&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])', 'print_header_format' - => &mtn(' Print header format; substitutions : %n student name %c course id %a assignment note, numbers after the % limit the field size.').'', + => ' '.&mt('Print header format').'
' + .&mt('Substitutions:
[_1]: student name, [_2]: course id, [_3]: assignment note. Numbers after the % limit the field size.','"%n"','"%c"','"%a"'), 'default_enrollment_start_date' => ''.&mt('Default beginning date for student access.').'', 'default_enrollment_end_date' => ''.&mt('Default ending date for student access.').'', - 'nothideprivileged' => ''.&mt('Privileged users that should not be hidden on staff listings').''. - '
(user:domain,user:domain,...)', + 'nothideprivileged' => ''.&mt('Privileged users that should not be hidden on staff listings').'
' + .'("'.&mt('user:domain,user:domain,*:domain').'")', 'languages' => ''.&mt('Languages used').'', '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').'
('.&mt('[_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').')', + => ''.&mt('Send message to student when clicking Done on Tasks').'
('.&mt('[_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').')', @@ -2317,7 +2337,14 @@ Use * to allow unrestricted cloning in a => ''.&mt('Default set of options to pass to tth/m when converting tex').'', 'texengine' - => ''.&mt('Force all students in the course to use a specific math rendering engine.').'
'.&mt('(Valid options are [_1].)','"tth", "jsMath", "mimetex"').'', + => ''.&mt('Force all students in the course to use a specific math rendering engine.').'
' + .'('.&mt('[_1], [_2] (Convert to Images), [_3] (TeX to HTML), or blank for student\'s preference','"jsMath"','"mimetex"','"tth"').')', + 'timezone' + => ''.&mt('Timezone in which the course takes place').'', + + 'suppress_embed_prompt' + => ''.&mt('Suppress prompt to upload items referenced in a web page being uploaded to portfolio, when current role is student.').'
'. + ' ('.&mt('[_1] to suppress, anything else to not suppress','"yes"').')', ); my @Display_Order = ('url','description','courseid','cloners','grading', 'externalsyllabus', @@ -2331,11 +2358,13 @@ Use * to allow unrestricted cloning in a 'allow_limited_html_in_feedback', 'allow_discussion_post_editing', 'languages', + 'timezone', 'nothideprivileged', 'rndseed', 'receiptalg', 'problem_stream_switch', 'suppress_tries', + 'suppress_embed_prompt', 'default_paper_size', 'print_header_format', 'disable_receipt_display', @@ -2375,6 +2404,13 @@ Use * to allow unrestricted cloning in a $values{$parameter}, $onchange). ''; + } elsif ($parameter eq 'timezone') { + my $includeempty = 1; + my $timezone = &Apache::lonlocal::gettimezone(); + $output .= ''. + &Apache::loncommon::select_timezone($parameter.'_value', + $timezone, + $onchange,$includeempty).''; } else { $output .= ''. &Apache::lonhtmlcommon::textbox($parameter.'_value', @@ -2401,8 +2437,8 @@ Use * to allow unrestricted cloning in a my %lt=&Apache::lonlocal::texthash( 'par' => 'Parameter', 'val' => 'Value', - 'set' => 'Set', - 'sce' => 'Set Course Environment' + 'set' => 'Set?', + 'sav' => 'Save' ); my $Parameter=&mt('Parameter'); @@ -2424,13 +2460,14 @@ $start_page $breadcrumbs
$setoutput +
$start_table $start_header_row -$lt{'par'}$lt{'val'}$lt{'set'}? +$lt{'par'}$lt{'val'}$lt{'set'} $end_header_row $output $end_table - +
$end_page ENDENV @@ -2800,7 +2837,7 @@ my %strings = [ 'no', 'No' ]], 'string_problemstatus' => [[ 'yes', 'Yes' ], - [ 'answer', 'Yes, and show correct answer if they exceed the maxium number of tries.' ], + [ 'answer', 'Yes, and show correct answer if they exceed the maximum number of tries.' ], [ 'no', 'No, don\'t show correct/incorrect feedback.' ], [ 'no_feedback_ever', 'No, show no feedback at all.' ]], ); @@ -2844,13 +2881,21 @@ sub dateshift { delete $data{$key}; } } + my %storecontent=(); # go through all parameters and look for dates foreach my $key (keys %data) { if ($data{$key.'.type'}=~/^date_(start|end)$/) { my $newdate=$data{$key}+$shift; - &Apache::lonnet::put('resourcedata',{$key => $newdate},$dom,$crs); + $storecontent{$key}=$newdate; } } + my $reply=&Apache::lonnet::cput + ('resourcedata',\%storecontent,$dom,$crs); + if ($reply eq 'ok') { + &log_parmset(\%storecontent); + } + &Apache::lonnet::devalidatecourseresdata($crs,$dom); + return $reply; } sub newoverview { @@ -3166,8 +3211,6 @@ sub date_shift_two { $start_page $breadcrumbs ENDOVER - my $start_page=&Apache::loncommon::start_page('Shift Dates'); - my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted'); $r->print(&mt('Shifting all dates such that [_1] becomes [_2]', &Apache::lonlocal::locallocaltime($env{'form.timebase'}), @@ -3577,7 +3620,7 @@ sub order_meta_fields { my $ordered_fields = join ",", @neworder; my $put_result = &Apache::lonnet::put('environment', {'metadata.addedorder'=>$ordered_fields},$dom,$crs); - &Apache::lonnet::appenv('course.'.$env{'request.course.id'}.'.metadata.addedorder' => $ordered_fields); + &Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.metadata.addedorder' => $ordered_fields}); } my $fields = &get_added_meta_fieldnames($env{'request.course.id'}); my $ordered_fields; @@ -4284,11 +4327,11 @@ sub handler { &clean_parameters($r); } elsif ($env{'form.action'} eq 'dateshift1' && $parm_permission) { &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, - text=>"Shifting Grades"}); + text=>"Shifting Dates"}); &date_shift_one($r); } elsif ($env{'form.action'} eq 'dateshift2' && $parm_permission) { &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, - text=>"Shifting Grades"}); + text=>"Shifting Dates"}); &date_shift_two($r); } } else {