Diff for /loncom/interface/lonparmset.pm between versions 1.387 and 1.398

version 1.387, 2007/11/17 02:50:49 version 1.398, 2008/05/29 15:39:16
Line 2026  sub crsenv { Line 2026  sub crsenv {
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};      my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};      my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
   
       my (%crsinfo,$chome);
   
     #      #
     # Go through list of changes      # Go through list of changes
     foreach (keys %env) {      foreach (keys %env) {
Line 2120  sub crsenv { Line 2122  sub crsenv {
             my $put_result = &Apache::lonnet::put('environment',              my $put_result = &Apache::lonnet::put('environment',
                                                   {$name=>$value},$dom,$crs);                                                    {$name=>$value},$dom,$crs);
             if ($put_result eq 'ok') {              if ($put_result eq 'ok') {
                 $setoutput.=&mt('Set').' <b>'.$name.'</b> '.&mt('to').' <b>'.$value.'</b>.<br />';                  $setoutput.=&mt('Set').' <b>'.$name.'</b> '.&mt('to').' <b>';
                   if ($name =~ /^default_enrollment_(start|end)_date$/) {
                       $setoutput .= &Apache::lonlocal::locallocaltime($value);
                   } else {
                       $setoutput .= $value;
                   }
                   $setoutput .= '</b>.<br />';
                 if ($name eq 'cloners') {                  if ($name eq 'cloners') {
                     &change_clone($value,\@oldcloner);                      &change_clone($value,\@oldcloner);
                 }                  }
                 # Update environment and nohist_courseids.db                  # Update environment and nohist_courseids.db
                 if ($name eq 'description' && defined($value)) {                  if ($name eq 'description' || $name eq 'cloners') {
                     my %crsinfo =                       if ($chome eq '') {
                         &Apache::lonnet::courseiddump($dom,'.',1,'.','.',                          %crsinfo =
                               &Apache::lonnet::courseiddump($dom,'.',1,'.','.',
                                                  $crs,undef,undef,'Course');                                                   $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') {                      if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') {
                         $crsinfo{$env{'request.course.id'}}{'description'} = $value;                           $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 =                          my $putresult =
                             &Apache::lonnet::courseidput($dom,\%crsinfo,                              &Apache::lonnet::courseidput($dom,\%crsinfo,
                                                          $chome,'notime');                                                           $chome,'notime');
Line 2190  sub crsenv { Line 2210  sub crsenv {
     my $output='';      my $output='';
     if (! exists($values{'con_lost'})) {      if (! exists($values{'con_lost'})) {
         my %descriptions=          my %descriptions=
     ('url'            => '<b>'.&mt('Top Level Map').'</b> '.      ('url'            => '<b>'.&mt('Top Level Map').'</b><br />'.
                                  '<a href="javascript:openbrowser'.                                   '<a href="javascript:openbrowser'.
                                  "('envform','url','sequence')\">".                                   "('envform','url','sequence')\">".
                                  &mt('Select Map').'</a><br /><span class="LC_warning"> '.                                   &mt('Select Map').'</a><br /><span class="LC_warning"> '.
                                  &mt('Modification may make assessment data inaccessible').                                   &mt('Modification may make assessment data inaccessible!').
                                  '</span>',                                   '</span>',
              'description'    => '<b>'.&mt('Course Description').'</b>',               'description'    => '<b>'.&mt('Course Description').'</b>',
              'courseid'       => '<b>'.&mt('Course ID or number').               'courseid'       => '<b>'.&mt('Course ID or number').
                                  '</b><br />'.                                   '</b><br />'.
                                  '('.&mt('internal').', '.&mt('optional').')',                                   '('.&mt('internal, optional').')',
              'cloners'        => '<b>'.&mt('Users allowed to clone course').'</b><br /><tt>(user:domain,user:domain,*:domain)</tt><br />'.&mt('Users with active Course Coordinator role in course are permitted to clone and need not be included.<br />               'cloners'        => '<b>'.&mt('Users allowed to clone course').'</b><br />'
 Use *:domain to allow course to be cloned by anyone in the specified domain.<br />                                  .'("<tt>'.&mt('user:domain,user:domain,*:domain').'</tt>")<br />'
 Use * to allow unrestricted cloning in all domains.'),                                  .&mt('Users with active Course Coordinator role in this course are permitted to clone and need not be included.').'<br />'
                                   .&mt('Use [_1] to allow course to be cloned by anyone in the specified domain.','"<tt>*:domain</tt>"').'<br />'
                                   .&mt('Use [_1] to allow unrestricted cloning in all domains.','"<tt>*</tt>"'),
              'grading'        => '<b>'.&mt('Grading').'</b><br />'.               'grading'        => '<b>'.&mt('Grading').'</b><br />'.
                                  '<tt>"standard", "external", or "spreadsheet"</tt> '.&Apache::loncommon::help_open_topic('GradingOptions'),                                   &mt('[_1], [_2], or [_3]','"<tt>standard</tt>"','"<tt>external</tt>"','"<tt>spreadsheet</tt>"').&Apache::loncommon::help_open_topic('GradingOptions'),
      'task_grading'   => '<b>'.&mt('Bridge Task Grading').'</b><br />'.       'task_grading'   => '<b>'.&mt('Bridge Task Grading').'</b><br />'
                                  &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','<tt>any</tt>','<tt>section</tt>'),                                  .&mt('Instructors and TAs in sections, when grading bridge tasks, should be allowed to grade other sections.').'<br />'
              'default_xml_style' => '<b>'.&mt('Default XML Style File').'</b> '.                                  .'('.&mt('[_1]: they are allowed (this is the default). [_2]: no, they can only grade their own section.','"<tt>any</tt>"','"<tt>section</tt>"').')',
                'default_xml_style' => '<b>'.&mt('Default XML Style File').'</b><br />'.
                     '<a href="javascript:openbrowser'.                      '<a href="javascript:openbrowser'.
                     "('envform','default_xml_style'".                      "('envform','default_xml_style'".
                     ",'sty')\">$SelectStyleFile</a><br />",                      ",'sty')\">$SelectStyleFile</a><br />",
              'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question').               'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question').'</b><br />'
                                  '</b><br />(<tt>user:domain,'.                                  .'("<tt>'.&mt('user:domain,user:domain(section;section;...;*;...),...').'</tt>")',
                                  'user:domain(section;section;...;*;...),...</tt>)',               'question.email.text' => '<b>'.&mt('Custom Text for Resource Content Question Option in Feedback').'</b>',
              'question.email.text' => '<b>'.&mt('Custom Text for Resource Content Question Option in Feedback').               'comment.email'  => '<b>'.&mt('Feedback Addresses for Course Content Comments').'</b><br />'
                                  '</b>',                                  .'("<tt>'.&mt('user:domain,user:domain(section;section;...;*;...),...').'</tt>")',
              'comment.email'  => '<b>'.&mt('Feedback Addresses for Course Content Comments').'</b><br />'.               'comment.email.text' => '<b>'.&mt('Custom Text for Course Content Option in Feedback').'</b>',
                                  '(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)',               'policy.email'   => '<b>'.&mt('Feedback Addresses for Course Policy').'</b><br />'
              'comment.email.text' => '<b>'.&mt('Custom Text for Course Content Option in Feedback').                                   .'("<tt>'.&mt('user:domain,user:domain(section;section;...;*;...),...').'</tt>")',
                                  '</b>',               'policy.email.text' => '<b>'.&mt('Custom Text for Course Policy Option in Feedback').'</b>',
              'policy.email'   => '<b>'.&mt('Feedback Addresses for Course Policy').'</b>'.               'hideemptyrows'  => '<b>'.&mt('Hide Empty Rows in Spreadsheets').'</b><br />'
                                  '<br />(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)',                                  .'('.&mt('[_1] for default hiding','"<tt>yes</tt>"').')',
              'policy.email.text' => '<b>'.&mt('Custom Text for Course Policy Option in Feedback').               'pageseparators'  => '<b>'.&mt('Visibly Separate Items on Pages').'</b><br />'
                                  '</b>',                                   .'('.&mt('[_1] for visible separation.','"<tt>yes</tt>"').' '
              'hideemptyrows'  => '<b>'.&mt('Hide Empty Rows in Spreadsheets').'</b><br />'.                                   .&mt('Changes will not show until next login.').')',
                                  '('.&mt('"[_1]" for default hiding','<tt>yes</tt>').')',               'student_classlist_view' => '<b>'.&mt('Allow students to view classlist.').'</b><br />'
              'pageseparators'  => '<b>'.&mt('Visibly Separate Items on Pages').'</b><br />'.                                          .'('.&mt('[_1]: students can view all sections. [_2]: students can only view their own section. blank or [_3] prevents student view.','"<tt>all</tt>"','"<tt>section</tt>"','"<tt>disabled</tt>"').')',
                                  '('.&mt('"[_1]" for visible separation','<tt>yes</tt>').', '.               'student_classlist_portfiles' => '<b>'.&mt('Include link to accessible portfolio files').'</b><br />'
                                  &mt('changes will not show until next login').')',                                               .'('.&mt('[_1] for link to each a listing of each student\'s files.','"<tt>yes</tt>"').')',
              'student_classlist_view' => '<b>'.&mt('Allow students to view classlist.').'</b><br />'.&mt('("all":students can view all sections,"section":students can only view their own section.blank or "disabled" prevents student view.)'),               'student_classlist_opt_in' => '<b>'.&mt("Student's agreement needed for listing in student-viewable roster").'</b><br />'
              'student_classlist_portfiles' => '<b>'.&mt('Include link to accessible portfolio files').'</b><br />'.&mt('"[_1]" for link to each a listing of each student\'s files.','<tt>yes</tt>'),                                             .'('.&mt('[_1] to require students to opt-in to listing in the roster (on the roster page).','"<tt>yes</tt>"').')',
              'student_classlist_opt_in' => '<b>'.&mt("Student's agreement needed for listing in student-viewable roster").'</b><br />'.&mt('"[_1]" to require students to opt-in to listing in the roster (on the roster page).','<tt>yes</tt>'),               'plc.roles.denied'=> '<b>'.&mt('Disallow live chatroom use for Roles').'</b><br />'
              'plc.roles.denied'=> '<b>'.&mt('Disallow live chatroom use for Roles').                                   .'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"').')<br />'
                                   '</b><br />("<tt>st</tt>": '.                                   .'("<tt>'.&mt('role,role,...').'</tt>") '
                                   &mt('student').', "<tt>ta</tt>": '.                           .Apache::loncommon::help_open_topic("Course_Disable_Discussion"),
                                   'TA, "<tt>in</tt>": '.  
                                   &mt('instructor').';<br /><tt>'.&mt('role,role,...').'</tt>) '.  
        Apache::loncommon::help_open_topic("Course_Disable_Discussion"),  
              'plc.users.denied' =>                'plc.users.denied' => 
                           '<b>'.&mt('Disallow live chatroom use for Users').'</b><br />'.                            '<b>'.&mt('Disallow live chatroom use for Users').'</b><br />'.
                                  '(<tt>user:domain,user:domain,...</tt>)',                                    '("<tt>'.&mt('user:domain,user:domain,...').'</tt>")',
   
              'pch.roles.denied'=> '<b>'.&mt('Disallow Resource Discussion for Roles').               'pch.roles.denied'=> '<b>'.&mt('Disallow Resource Discussion for Roles').'</b><br />'
                                   '</b><br />("<tt>st</tt>": '.                                   .'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"')
                                   'student, "<tt>ta</tt>": '.                                   .'("<tt>'.&mt('role,role,...').'</tt>") '
                                   'TA, "<tt>in</tt>": '.                                   .Apache::loncommon::help_open_topic("Course_Disable_Discussion"),
                                   'instructor;<br /><tt>role,role,...</tt>) '.  
        Apache::loncommon::help_open_topic("Course_Disable_Discussion"),  
              'pch.users.denied' =>                'pch.users.denied' => 
                           '<b>'.&mt('Disallow Resource Discussion for Users').'</b><br />'.                            '<b>'.&mt('Disallow Resource Discussion for Users').'</b><br />'.
                                  '(<tt>user:domain,user:domain,...</tt>)',                                   '("<tt>'.&mt('user:domain,user:domain,...').'</tt>")',
              'spreadsheet_default_classcalc'                'spreadsheet_default_classcalc' 
                  => '<b>'.&mt('Default Course Spreadsheet').'</b> '.                   => '<b>'.&mt('Default Course Spreadsheet').'</b> '.
                     '<a href="javascript:openbrowser'.                      '<a href="javascript:openbrowser'.
                     "('envform','spreadsheet_default_classcalc'".                      "('envform','spreadsheet_default_classcalc'".
                     ",'spreadsheet')\">$SelectSpreadsheetFile</a><br />",                      ",'spreadsheet')\">$SelectSpreadsheetFile</a><br />",
              'spreadsheet_default_studentcalc'                'spreadsheet_default_studentcalc' 
                  => '<b>'.&mt('Default Student Spreadsheet').'</b> '.                   => '<b>'.&mt('Default Student Spreadsheet').'</b><br />'.
                     '<a href="javascript:openbrowser'.                      '<a href="javascript:openbrowser'.
                     "('envform','spreadsheet_default_calc'".                      "('envform','spreadsheet_default_calc'".
                     ",'spreadsheet')\">$SelectSpreadsheetFile</a><br />",                      ",'spreadsheet')\">$SelectSpreadsheetFile</a><br />",
Line 2268  Use * to allow unrestricted cloning in a Line 2286  Use * to allow unrestricted cloning in a
                     ",'spreadsheet')\">$SelectSpreadsheetFile</a><br />",                      ",'spreadsheet')\">$SelectSpreadsheetFile</a><br />",
      'allow_limited_html_in_feedback'       'allow_limited_html_in_feedback'
          => '<b>'.&mt('Allow limited HTML in discussion posts').'</b><br />'.           => '<b>'.&mt('Allow limited HTML in discussion posts').'</b><br />'.
             '('.&mt('Set value to "[_1]" to allow',"<tt>yes</tt>").')',              '('.&mt('Set value to [_1] to allow.','"<tt>yes</tt>"').')',
              'allow_discussion_post_editing'               'allow_discussion_post_editing'
                  => '<b>'.&mt('Allow users with specified roles to edit/delete their own discussion posts').'</b><br />"<tt>st</tt>": '.                   => '<b>'.&mt('Allow users with specified roles to edit/delete their own discussion posts').'</b><br />'
                                   &mt('student').', "<tt>ta</tt>": '.                     .'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"').')<br />'
                                   'TA, "<tt>in</tt>": '.                     .'('.&mt('Set value to [_1] to allow all roles.','"<tt>yes</tt>"').')'
                                   &mt('instructor').';&nbsp;(<tt>'.&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.').'</tt>)<br />'.                     .'("<tt>'.&mt('role:section,role:section,...').'</tt>")<br />'
                     '('.&mt('or set value to "[_1]" to allow all roles',"<tt>yes</tt>").')',                     .'('.&mt('Example: "<tt>st:001,st:002,in,cc</tt>" would permit students in sections 001 and 002 and instructors in any section, and course coordinators to edit their own posts.').')',
      'rndseed'       'rndseed'
          => '<b>'.&mt('Randomization algorithm used').'</b> <br />'.           => '<b>'.&mt('Randomization algorithm used').'</b><br />'
                     '<span class="LC_error">'.&mt('Modifying this will make problems').' '.                     .'<span class="LC_error">'
                     &mt('have different numbers and answers').'</span>',                     .&mt('Modifying this will make problems have different numbers and answers!')
                      .'</span>',
      'receiptalg'       'receiptalg'
          => '<b>'.&mt('Receipt algorithm used').'</b> <br />'.           => '<b>'.&mt('Receipt algorithm used').'</b> <br />'.
                     &mt('This controls how receipt numbers are generated.'),                      &mt('This controls how receipt numbers are generated.'),
              'suppress_tries'               'suppress_tries'
                  => '<b>'.&mt('Suppress number of tries in printing').'</b><br />'.                   => '<b>'.&mt('Suppress number of tries in printing').'</b><br />'.
                     ' ('.&mt('"[_1]" to suppress, anything else to not suppress','<tt>yes</tt>').')',                      ' ('.&mt('[_1] to suppress, anything else to not suppress','"<tt>yes</tt>"').')',
              'problem_stream_switch'               'problem_stream_switch'
                  => '<b>'.&mt('Allow problems to be split over pages').'</b><br />'.                   => '<b>'.&mt('Allow problems to be split over pages').'</b><br />'.
                     ' ('.&mt('"[_1]" if allowed, anything else if not','<tt>yes</tt>').')',                      ' ('.&mt('[_1] if allowed, anything else if not','"<tt>yes</tt>"').')',
              'default_paper_size'                'default_paper_size' 
                  => '<b>'.&mt('Default paper type').'</b><br />'.                   => '<b>'.&mt('Default paper type').'</b><br />'.
                     ' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'.                       ' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'. 
                     ' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'.                       ' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'. 
                     ' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])',                      ' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])',
      'print_header_format'       'print_header_format'
          => &mtn('<b> Print header format; substitutions </b>:  %n student name %c course id %a assignment note, numbers after the % limit the field size.').'</b>',           => ' <b>'.&mt('Print header format').'</b><br />'
                      .&mt('Substitutions:<br />[_1]: student name, [_2]: course id, [_3]: assignment note. Numbers after the <tt>%</tt> limit the field size.','"<tt>%n</tt>"','"<tt>%c</tt>"','"<tt>%a</tt>"'),
              'default_enrollment_start_date' => '<b>'.&mt('Default beginning date for student access.').'</b>',               'default_enrollment_start_date' => '<b>'.&mt('Default beginning date for student access.').'</b>',
              'default_enrollment_end_date'   => '<b>'.&mt('Default ending date for student access.').'</b>',               'default_enrollment_end_date'   => '<b>'.&mt('Default ending date for student access.').'</b>',
              'nothideprivileged'   => '<b>'.&mt('Privileged users that should not be hidden on staff listings').'</b>'.               'nothideprivileged'   => '<b>'.&mt('Privileged users that should not be hidden on staff listings').'</b><br />'
                                  '<br />(<tt>user:domain,user:domain,...</tt>)',                                       .'("<tt>'.&mt('user:domain,user:domain,*:domain').'</tt>")',
              'languages' => '<b>'.&mt('Languages used').'</b>',               'languages' => '<b>'.&mt('Languages used').'</b>',
              'disable_receipt_display'               'disable_receipt_display'
                  => '<b>'.&mt('Disable display of problem receipts').'</b><br />'.                   => '<b>'.&mt('Disable display of problem receipts').'</b><br />'.
                     ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',                      ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',
      'task_messages'       'task_messages'
          => '<b>'.&mt('Send message to student when clicking Done on Tasks').'</b><br /> ('.&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.','<tt>only_student</tt>','<tt>student_and_user_notes_screen</tt>').')',           => '<b>'.&mt('Send message to student when clicking Done on Tasks').'</b><br /> ('.&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.','"<tt>only_student</tt>"','"<tt>student_and_user_notes_screen</tt>"').')',
      'disablesigfigs'       'disablesigfigs'
          => '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'.           => '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'.
                     ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',                      ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',
Line 2317  Use * to allow unrestricted cloning in a Line 2337  Use * to allow unrestricted cloning in a
          => '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>',           => '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>',
   
      'texengine'       'texengine'
          => '<b>'.&mt('Force all students in the course to use a specific math rendering engine.').'</b><br />'.&mt('(Valid options are [_1].)','"tth", "jsMath", "mimetex"').'</b>',           => '<b>'.&mt('Force all students in the course to use a specific math rendering engine.').'</b><br />'
                      .'('.&mt('[_1], [_2] (Convert to Images), [_3] (TeX to HTML), or blank for student\'s preference','"<tt>jsMath</tt>"','"<tt>mimetex</tt>"','"<tt>tth</tt>"').')',
                'timezone'
                    => '<b>'.&mt('Timezone in which the course takes place').'</b>'
   
              );                ); 
         my @Display_Order = ('url','description','courseid','cloners','grading',          my @Display_Order = ('url','description','courseid','cloners','grading',
                              'externalsyllabus',                               'externalsyllabus',
Line 2331  Use * to allow unrestricted cloning in a Line 2355  Use * to allow unrestricted cloning in a
                              'allow_limited_html_in_feedback',                               'allow_limited_html_in_feedback',
                              'allow_discussion_post_editing',                               'allow_discussion_post_editing',
                              'languages',                               'languages',
                                'timezone',
      'nothideprivileged',       'nothideprivileged',
                              'rndseed',                               'rndseed',
                              'receiptalg',                               'receiptalg',
Line 2375  Use * to allow unrestricted cloning in a Line 2400  Use * to allow unrestricted cloning in a
                                                         $values{$parameter},                                                          $values{$parameter},
                                                         $onchange).                                                          $onchange).
                                                         '</td>';                                                          '</td>';
               } elsif ($parameter eq 'timezone') {
                   $output .= '<td>'.
                       &Apache::loncommon::select_timezone($parameter.'_value',
                                                           $values{$parameter},
                                                           $onchange).'</td>';
             } else {              } else {
                 $output .= '<td>'.                  $output .= '<td>'.
                     &Apache::lonhtmlcommon::textbox($parameter.'_value',                      &Apache::lonhtmlcommon::textbox($parameter.'_value',
Line 2401  Use * to allow unrestricted cloning in a Line 2431  Use * to allow unrestricted cloning in a
     my %lt=&Apache::lonlocal::texthash(      my %lt=&Apache::lonlocal::texthash(
     'par'   => 'Parameter',      'par'   => 'Parameter',
     'val'   => 'Value',      'val'   => 'Value',
     'set'   => 'Set',      'set'   => 'Set?',
     'sce'   => 'Set Course Environment'      'sav'   => 'Save'
        );         );
   
     my $Parameter=&mt('Parameter');      my $Parameter=&mt('Parameter');
Line 2424  $start_page Line 2454  $start_page
 $breadcrumbs  $breadcrumbs
 <form method="post" action="/adm/parmset?action=crsenv" name="envform">  <form method="post" action="/adm/parmset?action=crsenv" name="envform">
 $setoutput  $setoutput
   <div><input type="submit" name="crsenv" value="$lt{'sav'}" /></div>
 $start_table  $start_table
 $start_header_row  $start_header_row
 <th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}?</th>  <th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}</th>
 $end_header_row  $end_header_row
 $output  $output
 $end_table  $end_table
 <input type="submit" name="crsenv" value="$lt{'sce'}" />  <input type="submit" name="crsenv" value="$lt{'sav'}" />
 </form>  </form>
 $end_page  $end_page
 ENDENV  ENDENV
Line 2599  sub parse_listdata_key { Line 2630  sub parse_listdata_key {
  $realm=~s/\.type//;   $realm=~s/\.type//;
     }      }
     # split into resource+part and parameter name      # split into resource+part and parameter name
     my ($res, $parm) = ($realm=~/^(.*)\.(.*)$/);      my ($res,    $parm) = ($realm=~/^(.*)\.(.*)$/);
     my ($res, $part) = ($res  =~/^(.*)\.(.*)$/);         ($res, my $part) = ($res  =~/^(.*)\.(.*)$/);
     return ($student,$res,$part,$parm);      return ($student,$res,$part,$parm);
 }  }
   
Line 2729  sub listdata { Line 2760  sub listdata {
       $$resourcedata{$thiskey},        $$resourcedata{$thiskey},
       '',1,'','').        '',1,'','').
 '<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'.  '<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'.
   (($$resourcedata{$thiskey}!=0)?'<a href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'.
   &mt('Shift all dates based on this date').'</a>':'').
 &date_sanity_info($$resourcedata{$thiskey})  &date_sanity_info($$resourcedata{$thiskey})
   );    );
     } elsif ($thistype eq 'date_interval') {      } elsif ($thistype eq 'date_interval') {
Line 2798  my %strings = Line 2831  my %strings =
  [ 'no', 'No' ]],   [ 'no', 'No' ]],
      'string_problemstatus'       'string_problemstatus'
              => [[ 'yes', 'Yes' ],               => [[ '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', 'No, don\'t show correct/incorrect feedback.' ],
  [ 'no_feedback_ever', 'No, show no feedback at all.' ]],   [ 'no_feedback_ever', 'No, show no feedback at all.' ]],
      );       );
Line 2824  sub string_selector { Line 2857  sub string_selector {
     return $result;      return $result;
 }  }
   
   #
   # Shift all start and end dates by $shift
   #
   
   sub dateshift {
       my ($shift)=@_;
       my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
       my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
       my %data=&Apache::lonnet::dump('resourcedata',$dom,$crs);
   # ugly retro fix for broken version of types
       foreach my $key (keys %data) {
           if ($key=~/\wtype$/) {
               my $newkey=$key;
               $newkey=~s/type$/\.type/;
               $data{$newkey}=$data{$key};
               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;
             $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 {  sub newoverview {
     my ($r) = @_;      my ($r) = @_;
   
Line 3101  ENDOVER Line 3169  ENDOVER
       &Apache::loncommon::end_page());        &Apache::loncommon::end_page());
 }  }
   
   sub date_shift_one {
       my ($r) = @_;
       my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
       my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
   
       my $start_page=&Apache::loncommon::start_page('Shift Dates');
       my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift');
       $r->print(<<ENDOVER);
   $start_page
   $breadcrumbs
   ENDOVER
       $r->print('<form name="shiftform" method="post">'.
                 '<table><tr><td>'.&mt('Currently set date:').'</td><td>'.
                 &Apache::lonlocal::locallocaltime($env{'form.timebase'}).'</td></tr>'.
                 '<tr><td>'.&mt('Shifted date:').'</td><td>'.
                       &Apache::lonhtmlcommon::date_setter('shiftform',
                                                           'timeshifted',
                                                           $env{'form.timebase'},,
                                                           '').
                 '</td></tr></table>'.
                 '<input type="hidden" name="action" value="dateshift2" />'.
                 '<input type="hidden" name="timebase" value="'.$env{'form.timebase'}.'" />'.
                 '<input type="submit" value="'.&mt('Shift all dates accordingly').'" /></form>');
       $r->print(&Apache::loncommon::end_page());
   }
   
   sub date_shift_two {
       my ($r) = @_;
       my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
       my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
       my $start_page=&Apache::loncommon::start_page('Shift Dates');
       my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift');
       $r->print(<<ENDOVER);
   $start_page
   $breadcrumbs
   ENDOVER
       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'}),
                 &Apache::lonlocal::locallocaltime($timeshifted)));
       my $delta=$timeshifted-$env{'form.timebase'};
       &dateshift($delta);
       $r->print(&Apache::loncommon::end_page());
   }
   
 sub parse_key {  sub parse_key {
     my ($key) = @_;      my ($key) = @_;
     my %data;      my %data;
Line 3501  sub order_meta_fields { Line 3614  sub order_meta_fields {
  my $ordered_fields = join ",", @neworder;   my $ordered_fields = join ",", @neworder;
         my $put_result = &Apache::lonnet::put('environment',          my $put_result = &Apache::lonnet::put('environment',
                            {'metadata.addedorder'=>$ordered_fields},$dom,$crs);                             {'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 $fields = &get_added_meta_fieldnames($env{'request.course.id'});
     my $ordered_fields;      my $ordered_fields;
Line 4126  sub handler { Line 4239  sub handler {
                                              'pres_marker',                                               'pres_marker',
                                              'pres_value',                                               'pres_value',
                                              'pres_type',                                               'pres_type',
                                              'udom','uname','symb','serial']);                                               'udom','uname','symb','serial','timebase']);
   
   
     &Apache::lonhtmlcommon::clear_breadcrumbs();      &Apache::lonhtmlcommon::clear_breadcrumbs();
Line 4206  sub handler { Line 4319  sub handler {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=cleanparameters',              &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=cleanparameters',
     text=>"Clean Parameters"});      text=>"Clean Parameters"});
     &clean_parameters($r);      &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 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 Dates"});
               &date_shift_two($r);
  }          }       
     } else {      } else {
 # ----------------------------- Not in a course, or not allowed to modify parms  # ----------------------------- Not in a course, or not allowed to modify parms

Removed from v.1.387  
changed lines
  Added in v.1.398


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>