Diff for /loncom/interface/lonrequestcourse.pm between versions 1.61 and 1.65

version 1.61, 2011/01/11 04:28:52 version 1.65, 2012/08/15 14:37:13
Line 147  sub handler { Line 147  sub handler {
         }          }
     }      }
   
       if (($action eq 'new') && (&Apache::loncoursequeueadmin::author_prompt())) {
           if (ref($states{$action}) eq 'ARRAY') {
               push(@{$states{$action}},'reqauthor');
           }
       }
   
     foreach my $key (keys(%states)) {      foreach my $key (keys(%states)) {
         if (ref($states{$key}) eq 'ARRAY') {          if (ref($states{$key}) eq 'ARRAY') {
             unshift (@{$states{$key}},'crstype');              unshift (@{$states{$key}},'crstype');
Line 162  sub handler { Line 168  sub handler {
                  personnel     => 'Personnel',                   personnel     => 'Personnel',
                  review        => 'Review',                   review        => 'Review',
                  process       => 'Result',                   process       => 'Result',
                    reqauthor     => 'Authoring Space Result',
                  pick_request  => 'Display Summary',                   pick_request  => 'Display Summary',
                  details       => 'Request Details',                   details       => 'Request Details',
                  cancel        => 'Cancel Request',                   cancel        => 'Cancel Request',
Line 439  sub get_breadcrumbs { Line 446  sub get_breadcrumbs {
                     $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course/Community Requests','Course_Requests');                      $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course/Community Requests','Course_Requests');
                     last;                      last;
                 } else {                  } else {
                     if (($$state eq 'process') || ($$state eq 'removal')) {                      if (($$state eq 'process') || ($$state eq 'removal') || ($$state eq 'reqauthor')) {
                         &Apache::lonhtmlcommon::add_breadcrumb(                          &Apache::lonhtmlcommon::add_breadcrumb(
                             { href => '/adm/requestcourse',                              { href => '/adm/requestcourse',
                               text => "$trail->{$states->{$action}[$i]}",                                text => "$trail->{$states->{$action}[$i]}",
Line 1444  sub print_request_form { Line 1451  sub print_request_form {
                                                            \@code_order);                                                             \@code_order);
         $r->print($result);          $r->print($result);
         if (($storeresult eq 'ok') || ($storeresult eq 'created')) {          if (($storeresult eq 'ok') || ($storeresult eq 'created')) {
             $r->print('<p>');  
             if ($storeresult eq 'ok') {              if ($storeresult eq 'ok') {
                 $r->print('<a href="/adm/requestcourse?action=view&state=details&showdom='.$dom.'&cnum='. $env{'form.cnum'}.'">'.                  $r->print('<p><a href="/adm/requestcourse?action=view&state=details&showdom='.$dom.'&cnum='. $env{'form.cnum'}.'">'.
                           &mt('Modify this request').'</a>'.('&nbsp;'x4));                            &mt('Modify this request').'</a>'.('&nbsp;'x4).
                             '<a href="/adm/requestcourse">'.&mt('Make another request').'</a></p>');
               }
               if (&Apache::loncoursequeueadmin::author_prompt()) {
                   $r->print('<h3>'.&mt('Access to authoring space').'</h3>'.
                             '<p>'.
                             &mt('Although assessment items can be created directly inside a course, such items only use part of the assessment capabilities of LON-CAPA.').
                             '<br />'.
                             &mt('By contrast, items created in authoring space, then imported into a course, can use all of the features of the assessment engine.').'</p>'.
                             '<p>'.&mt('Request authoring space access now?').
                             '<span class="LC_nobreak">&nbsp;'.
                             '<label><input type="radio" name="requestauthor" value="1" />'.&mt('Yes').'</label>'.
                             ('&nbsp;'x2).
                             '<label><input type="radio" name="requestauthor" value="0" checked="checked"/>'.&mt('No').'</label>'.
                             '</span></p>'.
                             '<input type="submit" name="newauthor" value="'.&mt('Submit authoring request').'" />'.
                             '<input type="hidden" name="state" value="reqauthor" />'.
                             '<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'.
                             '<input type="hidden" name="cnum" value="'.$env{'form.cnum'}.'" />'.
                             '<input type="hidden" name="showdom" value="'.$env{'form.showdom'}.'" />'.
                             '<input type="hidden" name="crstype" value="'.$env{'form.crstype'}.'" />'.
                             '<input type="hidden" name="disposition" value="'.$storeresult.'" />'.
                             '<br />');
               } elsif ($storeresult eq 'created') {
                   $r->print('<p><a href="/adm/requestcourse">'.&mt('Make another request').'</a></p>');
               }
           }
       } elsif ($state eq 'reqauthor') {
           my ($result,@links); 
           if ($env{'form.requestauthor'}) {
               $r->print(&Apache::loncoursequeueadmin::process_reqauthor(\$result));
               if ($result eq 'created') {
                   my $role = 'au';
                   my $spec = "$role./$env{'form.showdom'}/";
                   push(@links,&mt('Enter your authoring space with role: [_1]',
                                   '<a href="/adm/roles?selectrole=1&amp;'.$spec.'=1">'.
                                   &Apache::lonnet::plaintext($role).'</a>'));
               }
           }
           if (($env{'form.disposition'} eq 'created') &&
               ($env{'form.cnum'} =~ /^$match_courseid$/) &&
               ($env{'form.showdom'} =~ /^$match_domain$/)) {
               my ($spec,$area,$role,$type);
               my $role = 'cc';
               my $spec = "$role./$env{'form.showdom'}/$env{'form.cnum'}";
               my $type = 'Course';
               if ($env{'form.crstype'} eq 'community') {
                   $type = 'Community';
             }              }
             $r->print('<a href="/adm/requestcourse">'.&mt('Make another request').'</a></p>');              my $showrole = &Apache::lonnet::plaintext($role,$type);
             return;              unshift(@links,&mt('Enter new course with role: [_1]',
                                  '<a href="/adm/roles?selectrole=1&amp;'.$spec.'=1">'.$showrole.'</a>'));
           }
           if (@links > 1) {
               $r->print(&mt('New roles will be listed on your [_1]Roles[_2] page.',
                             '<a href="/adm/roles">','</a>').'&nbsp'.&mt('Choose a role:').
                          '<ul>');
               foreach my $link (@links) {
                   $r->print('<li>'.$link.'</li>');
               }
               $r->print('</ul>');
           } elsif (@links == 1) {
               $r->print('<p>'.$links[0].'</p>');
         }          }
     }      }
     my @excluded = &get_excluded_elements($dom,$states,$action,$state);      my @excluded = &get_excluded_elements($dom,$states,$action,$state);
Line 1480  sub print_request_form { Line 1545  sub print_request_form {
                 $count ++;                  $count ++;
             }              }
             $env{'form.persontotal'} = $count;              $env{'form.persontotal'} = $count;
                
         }          }
     }      }
     if ($state eq 'enrollment') {      if ($state eq 'enrollment') {
         push(@excluded,('sectotal','crosslisttotal'));          push(@excluded,('sectotal','crosslisttotal'));
     }      }
     $r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'</form>');      if (($state eq 'process') || ($state eq 'reqauthor')) {
     &display_navbuttons($r,$dom,$formname,$prev,$navtxt{'prev'},$next,          $r->print('</form>');
                         $navtxt{'next'},$state);      } else {
           $r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'</form>');
           &display_navbuttons($r,$dom,$formname,$prev,$navtxt{'prev'},$next,
                               $navtxt{'next'},$state);
       }
     return;      return;
 }  }
   
Line 3163  sub print_request_outcome { Line 3231  sub print_request_outcome {
         $enrollstart = '';          $enrollstart = '';
         $enrollend = '';          $enrollend = '';
     }      }
     my (%alerts,%rulematch,%inst_results,%curr_rules,%got_rules,%disallowmsg);      my (%alerts,%rulematch,%inst_results,%curr_rules,%got_rules,%disallowmsg,%skipped);
     for (my $i=0; $i<$env{'form.persontotal'}; $i++) {      for (my $i=0; $i<$env{'form.persontotal'}; $i++) {
         my $uname = $env{'form.person_'.$i.'_uname'};          my $uname = $env{'form.person_'.$i.'_uname'};
         my $udom = $env{'form.person_'.$i.'_dom'};          my $udom = $env{'form.person_'.$i.'_dom'};
Line 3175  sub print_request_outcome { Line 3243  sub print_request_outcome {
                              lastname     => $env{'form.person_'.$i.'_lastname'},                               lastname     => $env{'form.person_'.$i.'_lastname'},
                              emailaddr    => $env{'form.person_'.$i.'_emailaddr'},                               emailaddr    => $env{'form.person_'.$i.'_emailaddr'},
                                                    };                                                     };
                     my $usertype = &get_usertype($udom,$uname,\%curr_rules,\%got_rules);                      if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') {
                     if (&Apache::lonuserutils::can_create_user($udom,'requestcrs',$usertype)) {                          my $usertype = &get_usertype($udom,$uname,\%curr_rules,\%got_rules);
                         my ($allowed,$msg,$authtype,$authparam) =                          if (&Apache::lonuserutils::can_create_user($udom,'requestcrs',$usertype)) {
                             &check_newuser_rules($udom,$uname,\%alerts,\%rulematch,                              my ($allowed,$msg,$authtype,$authparam) =
                                                  \%inst_results,\%curr_rules,\%got_rules);                                  &check_newuser_rules($udom,$uname,\%alerts,\%rulematch,
                         if ($allowed) {                                                       \%inst_results,\%curr_rules,\%got_rules);
                             my %domdefaults = &Apache::lonnet::get_domain_defaults($udom);                              if ($allowed) {
                             if ($usertype eq 'official') {                                  my %domdefaults = &Apache::lonnet::get_domain_defaults($udom);
                                 if ($authtype eq '') {                                  if ($usertype eq 'official') {
                                     $authtype = $domdefaults{'auth_def'};                                      if ($authtype eq '') {
                                     $authparam = $domdefaults{'auth_arg_def'};  
                                 } else {  
                                     if ($authtype eq 'loc') {  
                                         $authtype = 'localauth';  
                                     } elsif ($authtype eq 'int') {  
                                         $authtype = 'internal';  
                                     }  
                                     if ($authtype !~ /^(krb4|krb5|internal|localauth)$/) {  
                                         $authtype = $domdefaults{'auth_def'};                                          $authtype = $domdefaults{'auth_def'};
                                         $authparam = $domdefaults{'auth_arg_def'};                                          $authparam = $domdefaults{'auth_arg_def'};
                                       } else {
                                           if ($authtype eq 'loc') {
                                               $authtype = 'localauth';
                                           } elsif ($authtype eq 'int') {
                                               $authtype = 'internal';
                                           }
                                           if ($authtype !~ /^(krb4|krb5|internal|localauth)$/) {
                                               $authtype = $domdefaults{'auth_def'};
                                               $authparam = $domdefaults{'auth_arg_def'};
                                           }
                                     }                                      }
                                   } elsif ($usertype eq 'unofficial') {
                                       if ($authtype eq '') {
                                           $authtype = 'internal';
                                           $authparam = '';
                                       }
                                   } else {
                                       $authtype = $domdefaults{'auth_def'};
                                       $authparam = $domdefaults{'auth_arg_def'};
                                 }                                  }
                             } elsif ($usertype eq 'unofficial') {                                  if (($authtype eq '') ||
                                 if ($authtype eq '') {                                      (($authtype =~/^krb(4|5)$/) && ($authparam eq '')) ||
                                     $authtype = 'internal';                                      ($authtype !~ /^(krb4|krb5|internal|localauth)$/)) {
                                     $authparam = '';                                      $skipped{$uname.':'.$udom} = 1;
                                       next;
                                   } else {
                                       $personnel{$uname.':'.$udom}{'authtype'} = $authtype;
                                       $personnel{$uname.':'.$udom}{'autharg'} = $authparam;
                                 }                                  }
                             } else {                              } else {
                                 $authtype = $domdefaults{'auth_def'};                                  $skipped{$uname.':'.$udom} = 1;
                                 $authparam = $domdefaults{'auth_arg_def'};  
                             }  
                             if (($authtype eq '') ||  
                                 (($authtype =~/^krb(4|5)$/) && ($authparam eq '')) ||  
                                 ($authtype !~ /^(krb4|krb5|internal|localauth)$/)) {  
                                 next;                                  next;
                             } else {  
                                 $personnel{$uname.':'.$udom}{'authtype'} = $authtype;  
                                 $personnel{$uname.':'.$udom}{'autharg'} = $authparam;  
                             }                              }
                         } else {                          } else {
                               $skipped{$uname.':'.$udom} = 1;
                             next;                              next;
                         }                          }
                     } else {  
                         next;  
                     }                      }
                 }                  }
                 my $role = $env{'form.person_'.$i.'_role'};                  my $role = $env{'form.person_'.$i.'_role'};
Line 3265  sub print_request_outcome { Line 3338  sub print_request_outcome {
             push(@baduname,$uname.':'.$udom);              push(@baduname,$uname.':'.$udom);
         }          }
     }      }
       if (keys(%skipped)) {
           foreach my $key (keys(%skipped)) {
               delete($personnel{$key}); 
           }
       }
     my ($accessstart,$accessend) = &dates_from_form('accessstart','accessend');      my ($accessstart,$accessend) = &dates_from_form('accessstart','accessend');
     my $autodrops = 0;      my $autodrops = 0;
     if ($env{'form.autodrops'}) {      if ($env{'form.autodrops'}) {
Line 3323  sub print_request_outcome { Line 3401  sub print_request_outcome {
                   };                    };
     my (@inststatuses,$storeresult,$creationresult);      my (@inststatuses,$storeresult,$creationresult);
     my $val =       my $val = 
         &Apache::loncoursequeueadmin::get_processtype($env{'user.name'},$env{'user.domain'},          &Apache::loncoursequeueadmin::get_processtype('course',$env{'user.name'},
             $env{'user.adv'},$dom,$crstype,\@inststatuses,\%domconfig);                                                        $env{'user.domain'},$env{'user.adv'},
                                                         $dom,$crstype,\@inststatuses,\%domconfig);
     if ($val eq '') {      if ($val eq '') {
         if ($crstype eq 'official') {          if ($crstype eq 'official') {
             $output = &mt('You are not permitted to request creation of official courses.');              $output = &mt('You are not permitted to request creation of official courses.');
Line 3479  sub print_request_outcome { Line 3558  sub print_request_outcome {
         }          }
         ($storeresult,my $updateresult) =           ($storeresult,my $updateresult) = 
             &Apache::loncoursequeueadmin::update_coursereq_status(\%reqhash,$dom,              &Apache::loncoursequeueadmin::update_coursereq_status(\%reqhash,$dom,
                 $cnum,$reqstatus,'request');                  $cnum,$reqstatus,'request',$env{'user.domain'},$env{'user.name'});
         if ($modified && $queued && $storeresult eq 'ok') {          if ($modified && $queued && $storeresult eq 'ok') {
             if ($crstype eq 'community') {              if ($crstype eq 'community') {
                 $output .= '<p>'.&mt('Your community request has been updated').'</p>';                  $output .= '<p>'.&mt('Your community request has been updated').'</p>';

Removed from v.1.61  
changed lines
  Added in v.1.65


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