Diff for /loncom/interface/lonrequestcourse.pm between versions 1.95 and 1.102

version 1.95, 2015/09/01 16:40:20 version 1.102, 2017/08/11 15:26:38
Line 760  function check_can_request(crschoice,act Line 760  function check_can_request(crschoice,act
     var unofficial = '';      var unofficial = '';
     var community = '';      var community = '';
     var textbook = '';      var textbook = '';
       var placement = '';
 END  END
     if (ref($can_request) eq 'HASH') {      if (ref($can_request) eq 'HASH') {
         foreach my $item (keys(%{$can_request})) {          foreach my $item (keys(%{$can_request})) {
Line 773  END Line 774  END
         unofficial => 'You are not permitted to request creation of an unofficial course in this domain.',          unofficial => 'You are not permitted to request creation of an unofficial course in this domain.',
         community => 'You are not permitted to request creation of a community in this domain.',          community => 'You are not permitted to request creation of a community in this domain.',
         textbook => 'You are not permitted to request creation of a textbook course in this domain',          textbook => 'You are not permitted to request creation of a textbook course in this domain',
           placement => 'You are not permitted to request creation of a placement test in this domain',
         all => 'You must choose a specific course type when making a new course request.',          all => 'You must choose a specific course type when making a new course request.',
         allt => '"All types" is not allowed.',          allt => '"All types" is not allowed.',
     );       ); 
Line 802  END Line 804  END
                         return false;                          return false;
                     }                      }
                 } else {                  } else {
                     if (actionchoice == 'new') {                      if (crschoice == 'placement') {
                         alert('$js_lt{'all'}'+'\\n'+'$js_lt{'allt'}');                          if (placement != 1) {
                         return false;                              alert("$js_lt{'placement'}");
                               return false;
                           }
                       } else {
                           if (actionchoice == 'new') {
                               alert('$js_lt{'all'}'+'\\n'+'$js_lt{'allt'}');
                               return false;
                           }
                     }                      }
                 }                  }
             }              }
Line 815  END Line 824  END
 END  END
     my ($pagetitle,$pageinfo,$domaintitle,$earlyout);      my ($pagetitle,$pageinfo,$domaintitle,$earlyout);
     if (ref($can_request) eq 'HASH') {      if (ref($can_request) eq 'HASH') {
         if (($can_request->{'official'}) || ($can_request->{'unofficial'}) || $can_request->{'textbook'}) {          if (($can_request->{'official'}) || ($can_request->{'unofficial'}) || ($can_request->{'textbook'}) || ($can_request->{'placement'})) {
             if ($can_request->{'community'}) {              if ($can_request->{'community'}) {
                 $pagetitle = 'Course/Community Requests';                  $pagetitle = 'Course/Community Requests';
                 $pageinfo = &mt('Request creation of a new course or community, or review your pending requests.');                  $pageinfo = &mt('Request creation of a new course or community, or review your pending requests.');
Line 992  END Line 1001  END
                 $title = &mt('Pending requests for unofficial courses');                  $title = &mt('Pending requests for unofficial courses');
             } elsif ($env{'form.crstype'} eq 'textbook') {              } elsif ($env{'form.crstype'} eq 'textbook') {
                 $title = &mt('Pending requests for textbook courses');                  $title = &mt('Pending requests for textbook courses');
               } elsif ($env{'form.crstype'} eq 'textbook') {
                   $title = &mt('Pending requests for placement tests'); 
             } else {              } else {
                 $title = &mt('Pending course/community requests');                   $title = &mt('Pending course/community requests'); 
             }              }
Line 2093  sub print_personnel_menu { Line 2104  sub print_personnel_menu {
             official => 'Requestor is automatically assigned Course Coordinator role.',              official => 'Requestor is automatically assigned Course Coordinator role.',
         );          );
         $lt{'unofficial'} = $lt{'official'};          $lt{'unofficial'} = $lt{'official'};
         $lt{'textbook'} = $lt{'textbook'};          $lt{'textbook'} = $lt{'official'};
           $lt{'placement'} = $lt{'official'};
         $output .= &Apache::lonhtmlcommon::row_headline().          $output .= &Apache::lonhtmlcommon::row_headline().
                   '<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Personnel').'&nbsp;'.$lt{$crstype}.' '.&mt('Include other personnel?').'</h3>';                    '<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Personnel').'&nbsp;'.$lt{$crstype}.' '.&mt('Include other personnel?').'</h3>';
     }      }
     for (my $i=0; $i<$persontotal; $i++) {       my $cansearch = 1;
       my @alldoms = &Apache::lonnet::all_domains();
       if (@alldoms == 1) {
           my %domsrch = &Apache::lonnet::get_dom('configuration',
                                                  ['directorysrch'],$alldoms[0]);
           if (ref($domsrch{'directorysrch'}) eq 'HASH') {
               if ((!$domsrch{'directorysrch'}{'available'}) &&
                   ($domsrch{'directorysrch'}{'lcavailable'} eq '0')) {
                   $cansearch = 0;
               }
           }
       }
       my ($trusted,$untrusted) = &Apache::lonnet::trusted_domains('enroll',$dom);
       for (my $i=0; $i<$persontotal; $i++) {
         my @linkargs = map { 'person_'.$i.'_'.$_ } (@items);          my @linkargs = map { 'person_'.$i.'_'.$_ } (@items);
         my $linkargstr = join("','",@linkargs);          my $linkargstr = join("','",@linkargs);
         my $uname_form = '<input type="text" name="person_'.$i.'_uname" value="" size="20" />';          my $uname_form = '<input type="text" name="person_'.$i.'_uname" value="" size="20" />';
         my $onchange = 'javascript:fix_domain('."'$formname','person_".$i."_dom',".          my $onchange = 'javascript:fix_domain('."'$formname','person_".$i."_dom',".
                        "'person_".$i."_hidedom','person_".$i."_uname'".');';                         "'person_".$i."_hidedom','person_".$i."_uname'".');';
         my $udom_form = &Apache::loncommon::select_dom_form($dom,'person_'.$i.'_dom','',          my $udom_form = &Apache::loncommon::select_dom_form($dom,'person_'.$i.'_dom','',
                                                             1,$onchange).                                                              1,$onchange,undef,$trusted,$untrusted).
                         '<input type="hidden" name="person_'.$i.'_hidedom" value="" />';                          '<input type="hidden" name="person_'.$i.'_hidedom" value="" />';
         my %form_elems;          my %form_elems;
         foreach my $item (@items) {          foreach my $item (@items) {
Line 2121  sub print_personnel_menu { Line 2146  sub print_personnel_menu {
         }          }
         $sectionselector .= $newtitle.          $sectionselector .= $newtitle.
             '<input type="text" name="person_'.$i.'_newsec" size="15" value="" />'."\n";              '<input type="text" name="person_'.$i.'_newsec" size="15" value="" />'."\n";
         my $usersrchlinktxt = &mt('Search for user');          my $usersrchlink;
         my $usersrchlink =  &Apache::loncommon::selectuser_link($formname,@linkargs,$dom,          if ($cansearch) {
                             $usersrchlinktxt);              my $usersrchlinktxt = &mt('Search for user');
               $usersrchlink = &Apache::loncommon::selectuser_link($formname,@linkargs,$dom,
                                                                   $usersrchlinktxt);
           } else {
               $usersrchlink = '&nbsp;';
           }
         my $userchklinktxt = &mt('Check username');          my $userchklinktxt = &mt('Check username');
         my $userchklink = &Apache::loncommon::selectuser_link($formname,@linkargs,$dom,          my $userchklink = &Apache::loncommon::selectuser_link($formname,@linkargs,$dom,
                             $userchklinktxt,'checkusername');                              $userchklinktxt,'checkusername');
Line 2504  sub print_request_logs { Line 2534  sub print_request_logs {
         if (ref($domconfig{'requestcourses'}) eq 'HASH') {          if (ref($domconfig{'requestcourses'}) eq 'HASH') {
             if (ref($domconfig{'requestcourses'}{'uniquecode'}) eq 'HASH') {              if (ref($domconfig{'requestcourses'}{'uniquecode'}) eq 'HASH') {
                 if ($curr{'crstype'} eq 'any') {                  if ($curr{'crstype'} eq 'any') {
                     my @types = qw(official unofficial community textbook);                      my @types = qw(official unofficial community textbook placement);
                     foreach my $type (@types) {                      foreach my $type (@types) {
                         if ($domconfig{'requestcourses'}{'uniquecode'}{$type}) {                          if ($domconfig{'requestcourses'}{'uniquecode'}{$type}) {
                             $showuniquecode = 1;                              $showuniquecode = 1;
Line 2672  sub reqstatus_names { Line 2702  sub reqstatus_names {
                         rejected  => 'Request rejected',                          rejected  => 'Request rejected',
                         cancelled => 'Request cancelled',                          cancelled => 'Request cancelled',
             );              );
     if (($crstype eq 'official') || ($crstype eq 'unofficial') || ($crstype eq 'textbook')) {      if (($crstype eq 'official') || ($crstype eq 'unofficial') || ($crstype eq 'textbook') || ($crstype eq 'placement')) {
         $statusnames{'created'} = &mt('Course created');          $statusnames{'created'} = &mt('Course created');
     } elsif ($crstype eq 'community') {      } elsif ($crstype eq 'community') {
         $statusnames{'created'} = &mt('Community created');          $statusnames{'created'} = &mt('Community created');
Line 3076  sub courseinfo_form { Line 3106  sub courseinfo_form {
     &js_escape(\%js_lt);      &js_escape(\%js_lt);
     $js_lt{'unofficial'} = $js_lt{'official'};      $js_lt{'unofficial'} = $js_lt{'official'};
     $js_lt{'textbook'} = $js_lt{'official'};      $js_lt{'textbook'} = $js_lt{'official'};
       $js_lt{'placement'} = $js_lt{'official'};
     my $js_validate = <<"ENDJS";      my $js_validate = <<"ENDJS";
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA['  // <![CDATA['
Line 3155  sub clone_form { Line 3186  sub clone_form {
     my $type = 'Course';      my $type = 'Course';
     if ($crstype eq 'community') {      if ($crstype eq 'community') {
         $type = 'Community';          $type = 'Community';
       } elsif ($crstype eq 'placement') {
           $type = 'Placement'; 
     }      }
     my %lt = &clone_text();      my %lt = &clone_text();
     my $output .=       my $output .= 
Line 3162  sub clone_form { Line 3195  sub clone_form {
         &Apache::loncommon::select_dom_form($dom,'clonedom').'</label>'.          &Apache::loncommon::select_dom_form($dom,'clonedom').'</label>'.
         &Apache::lonhtmlcommon::row_closure(1).          &Apache::lonhtmlcommon::row_closure(1).
         &Apache::lonhtmlcommon::row_title($lt{'cid'}).'<label>'.          &Apache::lonhtmlcommon::row_title($lt{'cid'}).'<label>'.
         '<input type="text" size="25" name="clonecrs" value="" onfocus="this.blur();opencrsbrowser('."'$formname','clonecrs','clonedom','','','','','$type'".')" />'.          '<input type="text" size="25" name="clonecrs" value="" onfocus="this.blur();opencrsbrowser('."'$formname','clonecrs','clonedom','','','','$type'".')" />'.
         '</label>&nbsp;'.          '</label>&nbsp;'.
         &Apache::loncommon::selectcourse_link($formname,'clonecrs','clonedom','','','',$type).          &Apache::loncommon::selectcourse_link($formname,'clonecrs','clonedom','','','',$type).
         &Apache::lonhtmlcommon::row_closure(1).          &Apache::lonhtmlcommon::row_closure(1).
Line 3320  sub get_course_dom { Line 3353  sub get_course_dom {
                     return $env{'user.domain'};                      return $env{'user.domain'};
                 }                  }
             }              }
             my @possible_doms;              my (@possible_doms,%willtrust,%trustchecked);
             foreach my $type (@{$types}) {              foreach my $type (@{$types}) {
                 my $dom_str = $env{'environment.reqcrsotherdom.'.$type};                  my $dom_str = $env{'environment.reqcrsotherdom.'.$type};
                 if ($dom_str ne '') {                  if ($dom_str ne '') {
                     my @domains = split(',',$dom_str);                      my @domains = split(',',$dom_str);
                     foreach my $entry (@domains) {                      foreach my $entry (@domains) {
                         my ($extdom,$extopt) = split(':',$entry);                          my ($extdom,$extopt) = split(':',$entry);
                         if ($extdom eq $env{'request.role.domain'}) {                          unless ($trustchecked{$extdom}) {
                             return $extdom;                              $willtrust{$extdom} = &Apache::lonnet::will_trust('reqcrs',$env{'user.domain'},$extdom);
                         }                           }
                         unless(grep(/^\Q$extdom\E$/,@possible_doms)) {                          if ($willtrust{$extdom}) {
                             push(@possible_doms,$extdom);                              if ($extdom eq $env{'request.role.domain'}) {
                                   return $extdom;
                               }
                               unless(grep(/^\Q$extdom\E$/,@possible_doms)) {
                                   push(@possible_doms,$extdom);
                               }
                         }                          }
                     }                      }
                 }                  }
Line 3644  sub print_request_outcome { Line 3682  sub print_request_outcome {
                                                         $instcode,$req_notifylist,\@instsections,\%domconfig);                                                          $instcode,$req_notifylist,\@instsections,\%domconfig);
     return ($result,$output,$customized);      return ($result,$output,$customized);
 }  }
       
 sub process_request {  sub process_request {
     my ($r,$lonhost,$dom,$cnum,$crstype,$now,$details,$instcode,$req_notifylist,$instsections,      my ($r,$lonhost,$dom,$cnum,$crstype,$now,$details,$instcode,$req_notifylist,$instsections,
         $domconfig) = @_;           $domconfig) = @_; 
Line 3662  sub process_request { Line 3700  sub process_request {
             $output = &mt('You are not permitted to request creation of communities');              $output = &mt('You are not permitted to request creation of communities');
         } elsif ($crstype eq 'textbook') {          } elsif ($crstype eq 'textbook') {
             $output = &mt('You are not permitted to request creation of textbook courses');              $output = &mt('You are not permitted to request creation of textbook courses');
           } elsif ($crstype eq 'placement') {
               $output = &mt('You are not permitted to request creation of placement tests');
         } else {          } else {
             $output = &mt('Unrecognized course type: [_1]',$crstype);              $output = &mt('Unrecognized course type: [_1]',$crstype);
         }          }
Line 4299  sub check_autolimit { Line 4339  sub check_autolimit {
             if (($crstype eq 'community') &&               if (($crstype eq 'community') && 
                 (exists($crsroles{$cnum.':'.$cdom.':co'}))) {                  (exists($crsroles{$cnum.':'.$cdom.':co'}))) {
                 $count ++;                  $count ++;
             } elsif ((($crstype eq 'official') || ($crstype eq 'unofficial') || ($crstype eq 'textbook')) &&              } elsif ((($crstype eq 'official') || ($crstype eq 'unofficial') || ($crstype eq 'textbook') || ($crstype eq 'placement')) &&
                      (exists($crsroles{$cnum.':'.$cdom.':cc'}))) {                       (exists($crsroles{$cnum.':'.$cdom.':cc'}))) {
                 $count ++;                  $count ++;
             }              }
Line 4563  sub print_textbook_form { Line 4603  sub print_textbook_form {
                                                owner => $courseinfo{'internal.courseowner'},                                                 owner => $courseinfo{'internal.courseowner'},
                                                releaserequired => $courseinfo{'internal.releaserequired'},                                                 releaserequired => $courseinfo{'internal.releaserequired'},
                                                type  => $courseinfo{'type'},                                                 type  => $courseinfo{'type'},
                                            };                                            };
         }          }
     }      }
   

Removed from v.1.95  
changed lines
  Added in v.1.102


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