Diff for /loncom/interface/lonmodifycourse.pm between versions 1.74 and 1.83

version 1.74, 2014/07/31 15:45:27 version 1.83, 2016/04/06 17:41:52
Line 71  sub catalog_settable { Line 71  sub catalog_settable {
             if ($confhash->{'categorizecomm'} ne 'comm') {              if ($confhash->{'categorizecomm'} ne 'comm') {
                 push(@settable,'categorize');                  push(@settable,'categorize');
             }              }
           } elsif ($type eq 'Placement') {
               if ($confhash->{'togglecatsplace'} ne 'place') {
                   push(@settable,'togglecats');
               }
               if ($confhash->{'categorizeplace'} ne 'place') {
                   push(@settable,'categorize');
               }
         } else {          } else {
             if ($confhash->{'togglecats'} ne 'crs') {              if ($confhash->{'togglecats'} ne 'crs') {
                 push(@settable,'togglecats');                  push(@settable,'togglecats');
Line 167  sub print_course_search_page { Line 174  sub print_course_search_page {
     $r->print(&Apache::loncommon::js_changer());      $r->print(&Apache::loncommon::js_changer());
     if ($type eq 'Community') {      if ($type eq 'Community') {
         $r->print('<h3>'.&mt('Search for a community in the [_1] domain',$domdesc).'</h3>');          $r->print('<h3>'.&mt('Search for a community in the [_1] domain',$domdesc).'</h3>');
       } elsif ($type eq 'Placement') {
           $r->print('<h3>'.&mt('Search for a placement test in the [_1] domain',$domdesc).'</h3>');
     } else {      } else {
         $r->print('<h3>'.&mt('Search for a course in the [_1] domain',$domdesc).'</h3>');          $r->print('<h3>'.&mt('Search for a course in the [_1] domain',$domdesc).'</h3>');
     }      }
Line 178  sub print_course_search_page { Line 187  sub print_course_search_page {
                   '<li>'.&mt('Enter the community with the role of [_1]',$cctitle).'</li>'."\n".                    '<li>'.&mt('Enter the community with the role of [_1]',$cctitle).'</li>'."\n".
                   '<li>'.&mt('View or modify community settings which only a [_1] may modify.',$dctitle).                    '<li>'.&mt('View or modify community settings which only a [_1] may modify.',$dctitle).
                   '</li>'."\n".'</ul>');                    '</li>'."\n".'</ul>');
       } elsif ($type eq 'Placement') {
           $r->print(&mt('Actions available after searching for a placement test:').'<ul>'.
                     '<li>'.&mt('Enter the placement test with the role of [_1]',$cctitle).'</li>'."\n".
                     '<li>'.&mt('View or modify placement test settings which only a [_1] may modify.',$dctitle).
                     '</li>'."\n".'</ul>');
     } else {      } else {
         $r->print(&mt('Actions available after searching for a course:').'<ul>'.          $r->print(&mt('Actions available after searching for a course:').'<ul>'.
                   '<li>'.&mt('Enter the course with the role of [_1]',$cctitle).'</li>'."\n".                    '<li>'.&mt('Enter the course with the role of [_1]',$cctitle).'</li>'."\n".
Line 208  sub print_course_selection_page { Line 222  sub print_course_selection_page {
     my %courses = &Apache::loncommon::search_courses($dom,$type,$filter,$numtitles,      my %courses = &Apache::loncommon::search_courses($dom,$type,$filter,$numtitles,
                                                      undef,undef,undef,\@codetitles);                                                       undef,undef,undef,\@codetitles);
     &Apache::lonpickcourse::display_matched_courses($r,$type,0,$action,undef,undef,undef,      &Apache::lonpickcourse::display_matched_courses($r,$type,0,$action,undef,undef,undef,
                                                     %courses);                                                      undef,undef,%courses);
     return;      return;
 }  }
   
Line 254  sub print_modification_menu { Line 268  sub print_modification_menu {
         $categorytitle = 'View/Modify Course Settings';          $categorytitle = 'View/Modify Course Settings';
         $setquota_text = &mt('Total disk space allocated for storage of portfolio files in all groups in a course.');          $setquota_text = &mt('Total disk space allocated for storage of portfolio files in all groups in a course.');
         $setuploadquota_text = &mt('Disk space allocated for storage of content uploaded directly to a course via Content Editor.');          $setuploadquota_text = &mt('Disk space allocated for storage of content uploaded directly to a course via Content Editor.');
         if (&showcredits($dom)) {          if (($type ne 'Placement') && (&showcredits($dom))) {
             $setparams_text = 'View/Modify course owner, institutional code, default authentication, credits, and self-enrollment';              $setparams_text = 'View/Modify course owner, institutional code, default authentication, credits, and self-enrollment';
         } else {          } else {
             $setparams_text = 'View/Modify course owner, institutional code, default authentication, and self-enrollment';              $setparams_text = 'View/Modify course owner, institutional code, default authentication, and self-enrollment';
         }          }
         $cat_text = 'View/Modify catalog settings for course';          $cat_text = 'View/Modify catalog settings for course';
     }      }
     my $anon_text = 'Responder threshold required to display anonymous survey submissions';      my $anon_text = &mt('Responder threshold required to display anonymous survey submissions.');
       my $postsubmit_text = &mt('Override defaults for submit button behavior post-submission for this specific course.'); 
   
     my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom);      my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom);
     my @additional_params = &catalog_settable($domconf{'coursecategories'},$type);      my @additional_params = &catalog_settable($domconf{'coursecategories'},$type);
Line 319  sub print_modification_menu { Line 334  sub print_modification_menu {
             {              {
                 linktext => 'Display current settings for automated enrollment',                  linktext => 'Display current settings for automated enrollment',
                 url => &phaseurl('viewparms'),                  url => &phaseurl('viewparms'),
                 permission => ($type ne 'Community'),                  permission => (($type ne 'Community') && ($type ne 'Placement')),
                 #help => '',                  #help => '',
                 icon => 'roles.png',                  icon => 'roles.png',
                 linktitle => ''                  linktitle => ''
Line 332  sub print_modification_menu { Line 347  sub print_modification_menu {
                 permission => &manage_selfenrollment($cdom,$cnum,$type,$coursehash),                  permission => &manage_selfenrollment($cdom,$cnum,$type,$coursehash),
                 linktitle => 'Configure user self-enrollment.',                  linktitle => 'Configure user self-enrollment.',
             },              },
               {
                   linktext => 'View/Modify submit button behavior, post-submission',
                   icon => 'emblem-readonly.png',
                   #help => '',
                   url => &phaseurl('setpostsubmit'),
                   permission => 1,
                   linktitle => '',
               },
         ]          ]
         },          },
         );          );
Line 353  sub print_modification_menu { Line 376  sub print_modification_menu {
     } else {      } else {
         $menu_html .=  '<li>'.&mt('Course owner (permitted to assign Course Coordinator roles in the course).').'</li>'."\n".          $menu_html .=  '<li>'.&mt('Course owner (permitted to assign Course Coordinator roles in the course).').'</li>'."\n".
                        '<li>'.&mt("Institutional code and default authentication (both required for auto-enrollment of students from institutional datafeeds).").'</li>'."\n";                         '<li>'.&mt("Institutional code and default authentication (both required for auto-enrollment of students from institutional datafeeds).").'</li>'."\n";
         if (&showcredits($dom)) {          if (($type ne 'Placement') && &showcredits($dom)) {
             $menu_html .= '<li>'.&mt('Default credits earned by student on course completion.').'</li>'."\n";              $menu_html .= '<li>'.&mt('Default credits earned by student on course completion.').'</li>'."\n";
         }          }
         $menu_html .= ' <li>'.&mt('Override defaults for who configures self-enrollment for this specific course.').'</li>'."\n";          $menu_html .= ' <li>'.&mt('Override defaults for who configures self-enrollment for this specific course.').'</li>'."\n";
     }      }
     $menu_html .= '<li>'.$setquota_text.'</li>'."\n".      $menu_html .= '<li>'.$setquota_text.'</li>'."\n".
                   '<li>'.$setuploadquota_text.'</li>'."\n".                    '<li>'.$setuploadquota_text.'</li>'."\n".
                   '<li>'.$anon_text.'</li>'."\n";                    '<li>'.$anon_text.'</li>'."\n".
                     '<li>'.$postsubmit_text.'</li>'."\n";
     foreach my $item (@additional_params) {      foreach my $item (@additional_params) {
         if ($type eq 'Community') {          if ($type eq 'Community') {
             if ($item eq 'togglecats') {              if ($item eq 'togglecats') {
Line 555  ENDDOCUMENT Line 579  ENDDOCUMENT
     return;      return;
 }  }
   
   sub print_postsubmit_config {
       my ($r,$cdom,$cnum,$cdesc,$type) = @_;
       my %lt = &Apache::lonlocal::texthash (
                   'conf' => 'Configure submit button behavior after student makes a submission',
                   'disa' => 'Disable submit button/keypress following student submission',
                   'nums' => 'Number of seconds submit is disabled',
                   'modi' => 'Save',
                   'back' => 'Pick another action',
                   'yes'  => 'Yes',
                   'no'   => 'No',
       );
       my %settings = &Apache::lonnet::get('environment',['internal.postsubmit','internal.postsubtimeout',
                                                          'internal.coursecode','internal.textbook'],$cdom,$cnum);
       my $postsubmit = $settings{'internal.postsubmit'};
       if ($postsubmit eq '') {
           my %domconfig =
               &Apache::lonnet::get_dom('configuration',['coursedefaults'],$cdom);
           $postsubmit = 1; 
           if (ref($domconfig{'coursedefaults'}) eq 'HASH') {
               if (ref($domconfig{'coursedefaults'}{'postsubmit'}) eq 'HASH') {
                   if ($domconfig{'coursedefaults'}{'postsubmit'}{'client'} eq 'off') {
                       $postsubmit = 0; 
                   }
               }
           }
       }
       my ($checkedon,$checkedoff,$display);
       if ($postsubmit) {
           $checkedon = 'checked="checked"';
           $display = 'block';
       } else {
           $checkedoff = 'checked="checked"';
           $display = 'none';
       }
       my $postsubtimeout = $settings{'internal.postsubtimeout'};
       my $default = &domain_postsubtimeout($cdom,$type,\%settings);
       my $zero = &mt('(Enter 0 to disable until next page reload, or leave blank to use the domain default: [_1])',$default);
       if ($postsubtimeout eq '') {
           $postsubtimeout = $default;
       }
       &print_header($r,$type);
       my $hidden_elements = &hidden_form_elements();
       my $helpitem = &Apache::loncommon::help_open_topic('Modify_Postsubmit_Config');
       $r->print(<<ENDDOCUMENT);
   <form action="/adm/modifycourse" method="post" name="setpostsubmit" onsubmit="return verify_postsubmit();">
   <h3>$lt{'conf'} <span class="LC_nobreak">($cdesc)</span></h3>
   <p>
   $helpitem $lt{'disa'}: 
   <label><input type="radio" name="postsubmit" $checkedon onclick="togglePostsubmit('studentsubmission');" value="1" />
   $lt{'yes'}</label>&nbsp;&nbsp;
   <label><input type="radio" name="postsubmit" $checkedoff onclick="togglePostsubmit('studentsubmission');" value="0" />
   $lt{'no'}</label>
   <div id="studentsubmission" style="display: $display">
   $lt{'nums'} <input type="text" name="postsubtimeout" value="$postsubtimeout" /><br />
   $zero</div>
   <br />     
   <input type="submit" value="$lt{'modi'}" />
   </p>
   $hidden_elements
   <a href="javascript:changePage(document.setpostsubmit,'menu')">$lt{'back'}</a>
   </form>
   ENDDOCUMENT
       return;
   }
   
   sub domain_postsubtimeout {
       my ($cdom,$type,$settings) = @_;
       return unless (ref($settings) eq 'HASH'); 
       my $lctype = lc($type);
       unless (($type eq 'Community') || ($type eq 'Placement')) {
           $lctype = 'unofficial';
           if ($settings->{'internal.coursecode'}) {
               $lctype = 'official';
           } elsif ($settings->{'internal.textbook'}) {
               $lctype = 'textbook';
           }
       }
       my %domconfig =
           &Apache::lonnet::get_dom('configuration',['coursedefaults'],$cdom);
       my $postsubtimeout = 60;
       if (ref($domconfig{'coursedefaults'}) eq 'HASH') {
           if (ref($domconfig{'coursedefaults'}{'postsubmit'}) eq 'HASH') {
               if (ref($domconfig{'coursedefaults'}{'postsubmit'}{'timeout'}) eq 'HASH') {
                   if ($domconfig{'coursedefaults'}{'postsubmit'}{'timeout'}{$lctype} ne '') {
                       $postsubtimeout = $domconfig{'coursedefaults'}{'postsubmit'}{'timeout'}{$lctype};
                   }
               }
           }
       }
       return $postsubtimeout;
   }
   
 sub print_catsettings {  sub print_catsettings {
     my ($r,$cdom,$cnum,$cdesc,$type) = @_;      my ($r,$cdom,$cnum,$cdesc,$type) = @_;
     &print_header($r,$type);      &print_header($r,$type);
Line 591  sub print_catsettings { Line 707  sub print_catsettings {
                       '&nbsp;<label><input name="hidefromcat" type="radio" value="yes" '.$excludeon.' />'.&mt('Yes').'</label>&nbsp;&nbsp;&nbsp;<label><input name="hidefromcat" type="radio" value="" '.$excludeoff.' />'.&mt('No').'</label><br /><p>');                        '&nbsp;<label><input name="hidefromcat" type="radio" value="yes" '.$excludeon.' />'.&mt('Yes').'</label>&nbsp;&nbsp;&nbsp;<label><input name="hidefromcat" type="radio" value="" '.$excludeoff.' />'.&mt('No').'</label><br /><p>');
             if ($type eq 'Community') {              if ($type eq 'Community') {
                 $r->print(&mt("If a community has been categorized using at least one of the categories defined for communities in the domain, it will be listed in the domain's publicly accessible Course/Community Catalog, unless excluded."));                  $r->print(&mt("If a community has been categorized using at least one of the categories defined for communities in the domain, it will be listed in the domain's publicly accessible Course/Community Catalog, unless excluded."));
               } elsif ($type eq 'Placement') {
                   $r->print(&mt("If a placement test has been categorized using at least one of the categories defined for placement tests in the domain, it will be listed in the domain's publicly accessible Course/Community Catalog, unless excluded."));
             } else {              } else {
                 $r->print(&mt("Unless excluded, a course will be listed in the domain's publicly accessible Course/Community Catalog, if at least one of the following applies").':<ul>'.                  $r->print(&mt("Unless excluded, a course will be listed in the domain's publicly accessible Course/Community Catalog, if at least one of the following applies").':<ul>'.
                           '<li>'.&mt('Auto-cataloging is enabled and the course is assigned an institutional code.').'</li>'.                            '<li>'.&mt('Auto-cataloging is enabled and the course is assigned an institutional code.').'</li>'.
Line 612  sub print_catsettings { Line 730  sub print_catsettings {
             } else {              } else {
                 $r->print(&mt('No categories defined for this domain'));                  $r->print(&mt('No categories defined for this domain'));
             }              }
             unless ($type eq 'Community') {               unless (($type eq 'Community') || ($type eq 'Placement')) { 
                 $r->print('<p>'.&mt('If auto-cataloging based on institutional code is enabled in the domain, a course will continue to be listed in the catalog of official courses, in addition to receiving a listing under any manually assigned categor(ies).').'</p>');                  $r->print('<p>'.&mt('If auto-cataloging based on institutional code is enabled in the domain, a course will continue to be listed in the catalog of official courses, in addition to receiving a listing under any manually assigned categor(ies).').'</p>');
             }              }
         }          }
Line 735  sub print_course_modification_page { Line 853  sub print_course_modification_page {
                       '&nbsp;'.&mt('Course Code'))."\n".                        '&nbsp;'.&mt('Course Code'))."\n".
                   '<input type="text" size="15" name="coursecode" value="'.$enrollvar{'coursecode'}.'" />'.                    '<input type="text" size="15" name="coursecode" value="'.$enrollvar{'coursecode'}.'" />'.
                   &Apache::lonhtmlcommon::row_closure());                    &Apache::lonhtmlcommon::row_closure());
         if (&showcredits($cdom)) {          if (($crstype eq 'Course') && (&showcredits($cdom))) {
             $r->print(&Apache::lonhtmlcommon::row_title(              $r->print(&Apache::lonhtmlcommon::row_title(
                           &Apache::loncommon::help_open_topic('Modify_Course_Credithours').                            &Apache::loncommon::help_open_topic('Modify_Course_Credithours').
                       '&nbsp;'.&mt('Credits (students)'))."\n".                        '&nbsp;'.&mt('Credits (students)'))."\n".
                       '<input type="text" size="3" name="defaultcredits" value="'.$enrollvar{'defaultcredits'}.'" />'.                        '<input type="text" size="3" name="defaultcredits" value="'.$enrollvar{'defaultcredits'}.'" />'.
                       &Apache::lonhtmlcommon::row_closure());                        &Apache::lonhtmlcommon::row_closure());
          }          }
          $r->print(&Apache::lonhtmlcommon::row_title(          $r->print(&Apache::lonhtmlcommon::row_title(
                        &Apache::loncommon::help_open_topic('Modify_Course_Defaultauth').                        &Apache::loncommon::help_open_topic('Modify_Course_Defaultauth').
                        '&nbsp;'.&mt('Default Authentication method'))."\n".                        '&nbsp;'.&mt('Default Authentication method'))."\n".
                    $authenitems."\n".                    $authenitems."\n".
                    &Apache::lonhtmlcommon::row_closure().                    &Apache::lonhtmlcommon::row_closure().
                    &Apache::lonhtmlcommon::row_title(                    &Apache::lonhtmlcommon::row_title(
                    &Apache::loncommon::help_open_topic('Modify_Course_Owner').                    &Apache::loncommon::help_open_topic('Modify_Course_Owner').
                       '&nbsp;'.&mt('Course Owner'))."\n");                       '&nbsp;'.&mt('Course Owner'))."\n");
     }      }
     my ($cctitle,$rolename,$currmanages,$ccchecked,$dcchecked,$defaultchecked);      my ($cctitle,$rolename,$currmanages,$ccchecked,$dcchecked,$defaultchecked);
     my ($selfenrollrows,$selfenrolltitles) = &Apache::lonuserutils::get_selfenroll_titles();      my ($selfenrollrows,$selfenrolltitles) = &Apache::lonuserutils::get_selfenroll_titles();
Line 924  sub modify_course { Line 1042  sub modify_course {
                  'internal.pendingco-owners','internal.selfenrollmgrdc',                   'internal.pendingco-owners','internal.selfenrollmgrdc',
                  'internal.selfenrollmgrcc');                   'internal.selfenrollmgrcc');
     my ($selfenrollrows,$selfenrolltitles) = &Apache::lonuserutils::get_selfenroll_titles();      my ($selfenrollrows,$selfenrolltitles) = &Apache::lonuserutils::get_selfenroll_titles();
     unless ($type eq 'Community') {      unless (($type eq 'Community') || ($type eq 'Placement')) {
         push(@items,('internal.coursecode','internal.authtype','internal.autharg',          push(@items,('internal.coursecode','internal.authtype','internal.autharg',
                      'internal.sectionnums','internal.crosslistings'));                       'internal.sectionnums','internal.crosslistings'));
         if (&showcredits($cdom)) {            if (&showcredits($cdom)) {  
Line 994  sub modify_course { Line 1112  sub modify_course {
             }              }
         }          }
   
         if (&showcredits($cdom) && exists($env{'form.defaultcredits'})) {          if (($type ne 'Placement') && (&showcredits($cdom) && exists($env{'form.defaultcredits'}))) {
             $newattr{'defaultcredits'} =~ s/[^\d\.]//g;              $newattr{'defaultcredits'} =~ s/[^\d\.]//g;
             $newattr{'defaultcredits'}=$env{'form.defaultcredits'};              $newattr{'defaultcredits'}=$env{'form.defaultcredits'};
         }          }
Line 1102  sub modify_course { Line 1220  sub modify_course {
                     $nochgresponse .= '<li>'.&mt('[_1] still set to: [_2]',$longtype{$attr},$shown).'</li>';                      $nochgresponse .= '<li>'.&mt('[_1] still set to: [_2]',$longtype{$attr},$shown).'</li>';
                 }                  }
             }              }
             if (($type ne 'Community') && ($changed{'code'} || $changed{'owner'})) {              if (($type ne 'Community') && ($type ne 'Placement') && ($changed{'code'} || $changed{'owner'})) {
                 if ( $newattr{'courseowner'} eq '') {                  if ( $newattr{'courseowner'} eq '') {
             push(@warnings,&mt('There is no owner associated with this LON-CAPA course.').              push(@warnings,&mt('There is no owner associated with this LON-CAPA course.').
                                    '<br />'.&mt('If automated enrollment at your institution requires validation of course owners, automated enrollment will fail.'));                                     '<br />'.&mt('If automated enrollment at your institution requires validation of course owners, automated enrollment will fail.'));
Line 1543  sub modify_anonsurvey_threshold { Line 1661  sub modify_anonsurvey_threshold {
     }      }
     $r->print('<p>'.      $r->print('<p>'.
               '<a href="javascript:changePage(document.processthreshold,'."'menu'".')">'.                '<a href="javascript:changePage(document.processthreshold,'."'menu'".')">'.
               &mt('Pick another action').'</a>');                &mt('Pick another action').'</a></p>');
       $r->print(&hidden_form_elements().'</form>');
       return;
   }
   
   sub modify_postsubmit_config {
       my ($r,$cdom,$cnum,$cdesc,$domdesc,$type) = @_;
       &print_header($r,$type);
       my %lt = &Apache::lonlocal::texthash(
                   subb => 'Submit button behavior after student makes a submission:',
                   unch => 'Post submission behavior of the Submit button is unchanged.',
                   erro => 'An error occurred when saving your proposed changes.',
                   inva => 'An invalid response was recorded.',
                   pick => 'Pick another action',
                );
       $r->print('<form action="/adm/modifycourse" method="post" name="processpostsubmit">'."\n".
                 '<h3>'.$lt{'subb'}.' <span class="LC_nobreak">('.$cdesc.')</span></h3><br />');
       my %oldsettings = 
           &Apache::lonnet::get('environment',['internal.postsubmit','internal.postsubtimeout','internal.coursecode','internal.textbook'],$cdom,$cnum);
       my $postsubmit = $env{'form.postsubmit'};
       if ($postsubmit eq '1') {
           my $postsubtimeout = $env{'form.postsubtimeout'};
           $postsubtimeout =~ s/[^\d\.]+//g;
           if (($oldsettings{'internal.postsubmit'} eq $postsubmit) && ($oldsettings{'internal.postsubtimeout'} eq $postsubtimeout)) {
               $r->print($lt{'unch'}); 
           } else {
               my %cenv = (
                            'internal.postsubmit' => $postsubmit,
                          );
               if ($postsubtimeout eq '') {
                   my $putreply = &Apache::lonnet::put('environment',\%cenv,$cdom,$cnum);
                   if ($putreply eq 'ok') {
                       my $defaulttimeout = &domain_postsubtimeout($cdom,$type,\%oldsettings);
                       $r->print(&mt('The proposed duration for disabling the Submit button post-submission was blank, so the domain default of [quant,_1,second] will be used.',$defaulttimeout));
                       if (exists($oldsettings{'internal.postsubtimeout'})) {
                           &Apache::lonnet::del('environment',['internal.postsubtimeout'],$cdom,$cnum);
                       }
                   } else {
                       $r->print($lt{'erro'});
                   }
               } else { 
                   $cenv{'internal.postsubtimeout'} = $postsubtimeout;
                   my $putreply = &Apache::lonnet::put('environment',\%cenv,$cdom,$cnum);
                   if ($putreply eq 'ok') {
                       if ($postsubtimeout eq '0') {
                           $r->print(&mt('Submit button will be disabled after student submission until page is reloaded.')); 
                       } else {
                           $r->print(&mt('Submit button will be disabled after student submission for [quant,_1,second].',$postsubtimeout));
                       }
                   } else {
                       $r->print($lt{'erro'});
                   }
               }
           }
       } elsif ($postsubmit eq '0') {
           if ($oldsettings{'internal.postsubmit'} eq $postsubmit) {
               $r->print($lt{'unch'});
           } else {
               if (exists($oldsettings{'internal.postsubtimeout'})) {
                   &Apache::lonnet::del('environment',['internal.postsubtimeout'],$cdom,$cnum);  
               }
               my %cenv = (
                            'internal.postsubmit' => $postsubmit,
                          );
               my $putreply = &Apache::lonnet::put('environment',\%cenv,$cdom,$cnum);
               if ($putreply eq 'ok') {
                   $r->print(&mt('Submit button will not be disabled after student submission'));
               } else {
                   $r->print($lt{'erro'});
               }
           }
       } else {
           $r->print($lt{'inva'}.' '.$lt{'unch'});
       }
       $r->print('<p>'.
                 '<a href="javascript:changePage(document.processpostsubmit,'."'menu'".')">'.
                 &mt('Pick another action').'</a></p>');
     $r->print(&hidden_form_elements().'</form>');      $r->print(&hidden_form_elements().'</form>');
     return;      return;
 }  }
Line 1723  function hide_searching() { Line 1917  function hide_searching() {
     } elsif ($phase eq 'setquota') {      } elsif ($phase eq 'setquota') {
         my $invalid = &mt('The quota you entered contained invalid characters.');          my $invalid = &mt('The quota you entered contained invalid characters.');
         my $alert = &mt('You must enter a number');          my $alert = &mt('You must enter a number');
           &js_escape(\$invalid);
           &js_escape(\$alert);
         my $regexp = '/^\s*(\d+\.?\d*|\.\d+)\s*$/';          my $regexp = '/^\s*(\d+\.?\d*|\.\d+)\s*$/';
         $js .= <<"ENDSCRIPT";          $js .= <<"ENDSCRIPT";
   
Line 1742  ENDSCRIPT Line 1938  ENDSCRIPT
     } elsif ($phase eq 'setanon') {      } elsif ($phase eq 'setanon') {
         my $invalid = &mt('The responder threshold you entered is invalid.');          my $invalid = &mt('The responder threshold you entered is invalid.');
         my $alert = &mt('You must enter a positive integer.');          my $alert = &mt('You must enter a positive integer.');
           &js_escape(\$invalid);
           &js_escape(\$alert);
         my $regexp = ' /^\s*\d+\s*$/';          my $regexp = ' /^\s*\d+\s*$/';
         $js .= <<"ENDSCRIPT";          $js .= <<"ENDSCRIPT";
   
Line 1763  function verify_anon_threshold() { Line 1961  function verify_anon_threshold() {
 }  }
   
 ENDSCRIPT  ENDSCRIPT
       } elsif ($phase eq 'setpostsubmit') {
           my $invalid = &mt('The choice entered for disabling the submit button is invalid.');
           my $invalidtimeout = &mt('The timeout you entered for disabling the submit button is invalid.');
           my $alert = &mt('Enter one of: a positive integer, 0 (for no timeout), or leave blank to use domain default');
           &js_escape(\$invalid);
           &js_escape(\$invalidtimeout);
           &js_escape(\$alert);
           my $regexp = ' /^\s*\d+\s*$/';
   
           $js .= <<"ENDSCRIPT"; 
   
   function verify_postsubmit() {
       var optionsElement = document.setpostsubmit.postsubmit;
       var verified = '';
       if (optionsElement.length) {
           var currval;
           for (var i=0; i<optionsElement.length; i++) {
               if (optionsElement[i].checked) {
                  currval = optionsElement[i].value;
               }
           }
           if (currval == 1) {
               var newtimeout = document.setpostsubmit.postsubtimeout.value;
               if (newtimeout == '') {
                   verified = 'ok';
               } else {
                   var num_reg = $regexp;
                   if (num_reg.test(newtimeout)) {
                       if (newtimeout>= 0) {
                           verified = 'ok';
                       } else {
                           alert("$invalidtimeout\\n$alert");
                           return false;
                       }
                   } else {
                       alert("$invalid\\n$alert");
                       return false;
                   }
               }
           } else {
               if (currval == 0) {
                  verified = 'ok'; 
               } else {
                  alert('$invalid');
                  return false;
               }
           }
           if (verified == 'ok') {
               changePage(document.setpostsubmit,'processpostsubmit');
               return true;
           }
     }      }
       return false;
   }
   
   function togglePostsubmit(caller) {
       var optionsElement = document.setpostsubmit.postsubmit;
       if (document.getElementById(caller)) {
           var divitem = document.getElementById(caller);
           var optionsElement = document.setpostsubmit.postsubmit; 
           if (optionsElement.length) {
               var currval;
               for (var i=0; i<optionsElement.length; i++) {
                   if (optionsElement[i].checked) {
                      currval = optionsElement[i].value;
                   }
               }
               if (currval == 1) {
                   divitem.style.display = 'block';
               } else {
                   divitem.style.display = 'none';
               }
           }
       }
       return;
   }
   
   ENDSCRIPT
   
       }
     my $starthash;      my $starthash;
     if ($env{'form.phase'} eq 'ccrole') {      if ($env{'form.phase'} eq 'ccrole') {
         $starthash = {          $starthash = {
Line 1781  ENDSCRIPT Line 2057  ENDSCRIPT
     my $bread_text = "View/Modify Courses/Communities";      my $bread_text = "View/Modify Courses/Communities";
     if ($type eq 'Community') {      if ($type eq 'Community') {
         $bread_text = 'Community Settings';          $bread_text = 'Community Settings';
       } elsif ($type eq 'Placement') {
           $bread_text = 'Placement Test Settings';
     } else {      } else {
         $bread_text = 'Course Settings';          $bread_text = 'Course Settings';
     }      }
Line 1866  sub hidden_form_elements { Line 2144  sub hidden_form_elements {
       &Apache::lonhtmlcommon::echo_form_input(['gosearch','updater','coursecode',        &Apache::lonhtmlcommon::echo_form_input(['gosearch','updater','coursecode',
           'prevphase','numlocalcc','courseowner','login','coursequota','intarg',            'prevphase','numlocalcc','courseowner','login','coursequota','intarg',
           'locarg','krbarg','krbver','counter','hidefromcat','usecategory',            'locarg','krbarg','krbver','counter','hidefromcat','usecategory',
           'threshold','defaultcredits','uploadquota','selfenrollmgrdc','selfenrollmgrcc',            'threshold','postsubmit','postsubtimeout','defaultcredits','uploadquota',
           'action','state','currsec_st','sections','newsec'],['^selfenrollmgr_'])."\n".            'selfenrollmgrdc','selfenrollmgrcc','action','state','currsec_st',
             'sections','newsec'],['^selfenrollmgr_'])."\n".
           '<input type="hidden" name="prevphase" value="'.$env{'form.phase'}.'" />';            '<input type="hidden" name="prevphase" value="'.$env{'form.phase'}.'" />';
     return $hidden_elements;      return $hidden_elements;
 }  }
Line 1875  sub hidden_form_elements { Line 2154  sub hidden_form_elements {
 sub showcredits {  sub showcredits {
     my ($dom) = @_;      my ($dom) = @_;
     my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);      my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
     if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'} || $domdefaults{'textbokcredits'}) {      if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'} || $domdefaults{'textbookcredits'}) {
         return 1;          return 1;
     }      }
 }  }
Line 1918  sub handler { Line 2197  sub handler {
             }              }
             if ($type eq 'Community') {              if ($type eq 'Community') {
                 $choose_text = "Choose a community";                  $choose_text = "Choose a community";
               } elsif ($type eq 'Placement') {
                   $choose_text = "Choose a placement test";
             } else {              } else {
                 $choose_text = "Choose a course";                  $choose_text = "Choose a course";
             }               } 
Line 1934  sub handler { Line 2215  sub handler {
                     my $enter_text;                      my $enter_text;
                     if ($type eq 'Community') {                      if ($type eq 'Community') {
                         $enter_text = 'Enter community';                          $enter_text = 'Enter community';
                       } elsif ($type eq 'Placement') {
                           $enter_text = 'Enter placement test'; 
                     } else {                      } else {
                         $enter_text = 'Enter course';                          $enter_text = 'Enter course';
                     }                      }
Line 1971  sub handler { Line 2254  sub handler {
                             ({href=>"javascript:changePage(document.$phase,'$phase')",                              ({href=>"javascript:changePage(document.$phase,'$phase')",
                               text=>"Threshold for anonymous submissions display"});                                text=>"Threshold for anonymous submissions display"});
                             &print_set_anonsurvey_threshold($r,$cdom,$cnum,$cdesc,$type);                              &print_set_anonsurvey_threshold($r,$cdom,$cnum,$cdesc,$type);
   
                         } elsif ($phase eq 'processthreshold') {                          } elsif ($phase eq 'processthreshold') {
                             &Apache::lonhtmlcommon::add_breadcrumb                              &Apache::lonhtmlcommon::add_breadcrumb
                             ({href=>"javascript:changePage(document.$phase,'setanon')",                              ({href=>"javascript:changePage(document.$phase,'setanon')",
Line 1980  sub handler { Line 2262  sub handler {
                             ({href=>"javascript:changePage(document.$phase,'$phase')",                              ({href=>"javascript:changePage(document.$phase,'$phase')",
                               text=>"Result"});                                text=>"Result"});
                             &modify_anonsurvey_threshold($r,$cdom,$cnum,$cdesc,$domdesc,$type);                              &modify_anonsurvey_threshold($r,$cdom,$cnum,$cdesc,$domdesc,$type);
                           } elsif ($phase eq 'setpostsubmit') {
                               &Apache::lonhtmlcommon::add_breadcrumb
                               ({href=>"javascript:changePage(document.$phase,'$phase')",
                                 text=>"Configure submit button behavior post-submission"});
                               &print_postsubmit_config($r,$cdom,$cnum,$cdesc,$type);
                           } elsif ($phase eq 'processpostsubmit') {
                               &Apache::lonhtmlcommon::add_breadcrumb
                               ({href=>"javascript:changePage(document.$phase,'$phase')",
                                 text=>"Result"});
                               &modify_postsubmit_config($r,$cdom,$cnum,$cdesc,$domdesc,$type);
                         } elsif ($phase eq 'viewparms') {                          } elsif ($phase eq 'viewparms') {
                             &Apache::lonhtmlcommon::add_breadcrumb                              &Apache::lonhtmlcommon::add_breadcrumb
                             ({href=>"javascript:changePage(document.$phase,'viewparms')",                              ({href=>"javascript:changePage(document.$phase,'viewparms')",
Line 2029  sub handler { Line 2321  sub handler {
                     $r->print('<span class="LC_error">');                      $r->print('<span class="LC_error">');
                     if ($type eq 'Community') {                      if ($type eq 'Community') {
                         $r->print(&mt('The community you selected is not a valid community in this domain'));                          $r->print(&mt('The community you selected is not a valid community in this domain'));
                       } elsif ($type eq 'Placement') {
                           $r->print(&mt('The course you selected is not a valid placement test in this domain'));
                     } else {                      } else {
                         $r->print(&mt('The course you selected is not a valid course in this domain'));                          $r->print(&mt('The course you selected is not a valid course in this domain'));
                     }                      }

Removed from v.1.74  
changed lines
  Added in v.1.83


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