Diff for /loncom/interface/lonrequestcourse.pm between versions 1.66 and 1.71

version 1.66, 2013/03/01 04:48:59 version 1.71, 2013/12/25 20:43:46
Line 136  sub handler { Line 136  sub handler {
     my (%states,%stored);      my (%states,%stored);
     my ($jscript,$uname,$udom,$result,$warning,$showcredits,$instcredits);      my ($jscript,$uname,$udom,$result,$warning,$showcredits,$instcredits);
     my %domdefs = &Apache::lonnet::get_domain_defaults($dom);      my %domdefs = &Apache::lonnet::get_domain_defaults($dom);
     if ($domdefs{'officialcredits'} || $domdefs{'unofficialcredits'}) {      if ($domdefs{'officialcredits'} || $domdefs{'unofficialcredits'} || $domdefs{'textbookcredits'}) {
         $showcredits = 1;          $showcredits = 1;
     }      }
   
Line 614  sub form_elements { Line 614  sub form_elements {
             if ($showcredits && $instcredits eq '') {              if ($showcredits && $instcredits eq '') {
                 $extras{'coursecredits'} = 'text';                  $extras{'coursecredits'} = 'text';
             }              }
         } elsif ($env{'form.crstype'} eq 'unofficial') {          } elsif (($env{'form.crstype'} eq 'unofficial') || ($env{'form.crstype'} eq 'textbook')) {
             if ($showcredits) {              if ($showcredits) {
                 $extras{'coursecredits'} = 'text';                  $extras{'coursecredits'} = 'text';
             }              }
Line 721  $nextstate_setter Line 721  $nextstate_setter
 function check_can_request(crschoice,actionchoice) {  function check_can_request(crschoice,actionchoice) {
     var official = '';      var official = '';
     var unofficial = '';      var unofficial = '';
     var community = '';          var community = '';
       var textbook = '';
 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 733  END Line 734  END
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
         official => 'You are not permitted to request creation of an official course in this domain.',          official => 'You are not permitted to request creation of an official course in this domain.',
         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 this domain.',          community => 'You are not permitted to request creation of a community in this domain.',
         all => 'You must choose a specific course type when making a new course request.\\n\"All types\" is not allowed.',          textbook => 'You are not permitted to request creation of a textbook course in this domain',
           all => 'You must choose a specific course type when making a new course request.',
           allt => '"All types" is not allowed.',
     );       ); 
     $js .= <<END;      $js .= <<END;
     if (crschoice == 'official') {      if (crschoice == 'official') {
Line 755  END Line 758  END
                     return false;                      return false;
                 }                  }
             } else {              } else {
                 if (actionchoice == 'new') {                  if (crschoice == 'textbook') {
                     alert("$lt{'all'}");                      if (textbook != 1) {
                     return false;                          alert("$lt{'community'}");
                 }                                         return false;
                       }
                   } else {
                       if (actionchoice == 'new') {
                           alert('$lt{'all'}'+'\\n'+'$lt{'allt'}');
                           return false;
                       }
                   }
             }              }
         }          }
     }      }
Line 767  END Line 777  END
 END  END
     my ($pagetitle,$pageinfo,$domaintitle);      my ($pagetitle,$pageinfo,$domaintitle);
     if (ref($can_request) eq 'HASH') {      if (ref($can_request) eq 'HASH') {
         if (($can_request->{'official'}) || ($can_request->{'unofficial'})) {          if (($can_request->{'official'}) || ($can_request->{'unofficial'}) || $can_request->{'textbook'}) {
             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 944  END Line 954  END
                 $title = &mt('Pending requests for official courses');                  $title = &mt('Pending requests for official courses');
             } elsif ($env{'form.crstype'} eq 'unofficial') {              } elsif ($env{'form.crstype'} eq 'unofficial') {
                 $title = &mt('Pending requests for unofficial courses');                  $title = &mt('Pending requests for unofficial courses');
               } elsif ($env{'form.crstype'} eq 'textbook') {
                   $title = &mt('Pending requests for textbook courses');
             } else {              } else {
                 $title = &mt('Pending course/community requests');                   $title = &mt('Pending course/community requests'); 
             }              }
Line 1770  sub print_enrollment_menu { Line 1782  sub print_enrollment_menu {
                 $hascredits = 1;                  $hascredits = 1;
             }              }
         }          }
     } elsif ($env{'form.crstype'} eq 'unofficial') {      } elsif (($env{'form.crstype'} eq 'unofficial') || ($env{'form.crstype'} eq 'textbook')) {
         if ($showcredits) {          if ($showcredits) {
             $creditsrow = '<span class="LC_nobreak">'.              $creditsrow = '<span class="LC_nobreak">'.
                           '<input type="text" size="3" name="coursecredits"'.                            '<input type="text" size="3" name="coursecredits"'.
Line 1975  sub print_personnel_menu { Line 1987  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'};
         $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>';
     }      }
Line 2305  ENDJS Line 2318  ENDJS
 }  }
   
 sub viewcancel_javascript {  sub viewcancel_javascript {
     my $alert = &mt('Are you sure you want to cancel this request?\\n'.      my $alert = &mt('Are you sure you want to cancel this request?').'\\n'.
                     'Your request will be removed.');                  &mt('Your request will be removed.');
     return << "ENDJS";      return << "ENDJS";
 function nextPage(formname,nextstate) {  function nextPage(formname,nextstate) {
     if (confirm('$alert')) {      if (confirm('$alert')) {
Line 2513  sub reqstatus_names { Line 2526  sub reqstatus_names {
                         rejected  => 'Request rejected',                          rejected  => 'Request rejected',
                         cancelled => 'Request cancelled',                          cancelled => 'Request cancelled',
             );              );
     if (($crstype eq 'official') || ($crstype eq 'unofficial')) {      if (($crstype eq 'official') || ($crstype eq 'unofficial') || ($crstype eq 'textbook')) {
         $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 2730  sub print_review { Line 2743  sub print_review {
             $section_values .= $xlistinfo;              $section_values .= $xlistinfo;
         }          }
         $section_values .= '</table></td>';          $section_values .= '</table></td>';
     } elsif ($env{'form.crstype'} eq 'unofficial') {      } elsif (($env{'form.crstype'} eq 'unofficial') || ($env{'form.crstype'} eq 'textbook')) {
         $inst_headers .= '<th>'.&mt('Credits').'</th>';          $inst_headers .= '<th>'.&mt('Credits').'</th>';
         $inst_values .= '<td>'.$env{'form.coursecredits'}.'</td>';          $inst_values .= '<td>'.$env{'form.coursecredits'}.'</td>';
     }      }
Line 2909  sub courseinfo_form { Line 2922  sub courseinfo_form {
                 community => 'You must provide a (brief) community description.'                  community => 'You must provide a (brief) community description.'
              );               );
     $lt{'unofficial'} = $lt{'official'};      $lt{'unofficial'} = $lt{'official'};
       $lt{'textbook'} = $lt{'official'};
     my $js_validate = <<"ENDJS";      my $js_validate = <<"ENDJS";
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA['  // <![CDATA['
Line 3230  sub display_navbuttons { Line 3244  sub display_navbuttons {
 sub print_request_outcome {  sub print_request_outcome {
     my ($dom,$codetitles,$code_order,$instcredits) = @_;      my ($dom,$codetitles,$code_order,$instcredits) = @_;
     my ($output,$cnum,$now,$req_notifylist,$crstype,$enrollstart,$enrollend,      my ($output,$cnum,$now,$req_notifylist,$crstype,$enrollstart,$enrollend,
         %sections,%crosslistings,%personnel,@baduname,@missingdom,%domconfig);          %sections,%crosslistings,%personnel,@baduname,@missingdom,%domconfig,
           $uniquecode);
     my $sectotal = $env{'form.sectotal'};      my $sectotal = $env{'form.sectotal'};
     my $crosslisttotal = 0;      my $crosslisttotal = 0;
     $cnum = $env{'form.cnum'};      $cnum = $env{'form.cnum'};
Line 3244  sub print_request_outcome { Line 3259  sub print_request_outcome {
         if (ref($domconfig{'requestcourses'}{'notify'}) eq 'HASH') {          if (ref($domconfig{'requestcourses'}{'notify'}) eq 'HASH') {
             $req_notifylist = $domconfig{'requestcourses'}{'notify'}{'approval'};              $req_notifylist = $domconfig{'requestcourses'}{'notify'}{'approval'};
         }          }
           $uniquecode = $domconfig{'requestcourses'}{'uniquecode'};
     }      }
     $now = time;      $now = time;
     $crstype = $env{'form.crstype'};      $crstype = $env{'form.crstype'};
Line 3453  sub print_request_outcome { Line 3469  sub print_request_outcome {
                     crstype        => $env{'form.crstype'},                      crstype        => $env{'form.crstype'},
                     instcode       => $instcode,                      instcode       => $instcode,
                     defaultcredits => $credits,                       defaultcredits => $credits, 
                       uniquecode     => $uniquecode,
                     clonedom       => $clonedom,                      clonedom       => $clonedom,
                     clonecrs       => $clonecrs,                      clonecrs       => $clonecrs,
                     datemode       => $env{'form.datemode'},                      datemode       => $env{'form.datemode'},
Line 3481  sub print_request_outcome { Line 3498  sub print_request_outcome {
             $output = &mt('You are not permitted to request creation of unofficial courses.');              $output = &mt('You are not permitted to request creation of unofficial courses.');
         } elsif ($crstype eq 'community') {          } elsif ($crstype eq 'community') {
             $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') {
               $output = &mt('You are not permitted to request creation of textbook courses');
         } else {          } else {
             $output = &mt('Unrecognized course type: [_1]',$crstype);              $output = &mt('Unrecognized course type: [_1]',$crstype);
         }          }
Line 3542  sub print_request_outcome { Line 3561  sub print_request_outcome {
             $storeresult = 'rejected';              $storeresult = 'rejected';
         } elsif ($disposition eq 'process') {          } elsif ($disposition eq 'process') {
             my %domdefs = &Apache::lonnet::get_domain_defaults($dom);              my %domdefs = &Apache::lonnet::get_domain_defaults($dom);
             my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg,%longroles);              my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg,%longroles,$code);
             my $type = 'Course';              my $type = 'Course';
             if ($crstype eq 'community') {              if ($crstype eq 'community') {
                 $type = 'Community';                  $type = 'Community';
Line 3553  sub print_request_outcome { Line 3572  sub print_request_outcome {
             }              }
             my $result = &Apache::loncoursequeueadmin::course_creation($dom,$cnum,              my $result = &Apache::loncoursequeueadmin::course_creation($dom,$cnum,
                                    'autocreate',$details,\$logmsg,\$newusermsg,\$addresult,                                     'autocreate',$details,\$logmsg,\$newusermsg,\$addresult,
                                    \$enrollcount,\$response,\$keysmsg,\%domdefs,\%longroles);                                     \$enrollcount,\$response,\$keysmsg,\%domdefs,\%longroles,\$code);
             if ($result eq 'created') {              if ($result eq 'created') {
                 $disposition = 'created';                  $disposition = 'created';
                 $reqstatus = 'created';                  $reqstatus = 'created';
Line 3564  sub print_request_outcome { Line 3583  sub print_request_outcome {
                 } else {                  } else {
                     $output = '<p>'.&mt('Your course request has been processed and the course has been created.');                      $output = '<p>'.&mt('Your course request has been processed and the course has been created.');
                 }                  }
                   if ($code) {
                       $output .= &notification_information($disposition,$env{'user.name'}.':'.$env{'user.domain'},
                                                            $cnum,$now,$code);
                   }
                 $output .= '<br />'.$role_result.'</p>';                  $output .= '<br />'.$role_result.'</p>';
                 $creationresult = 'created';                  $creationresult = 'created';
             } else {              } else {
Line 3787  sub update_requestors_roles { Line 3810  sub update_requestors_roles {
 }  }
   
 sub notification_information {  sub notification_information {
     my ($disposition,$req_notifylist,$cnum,$now) = @_;      my ($disposition,$req_notifylist,$cnum,$now,$code) = @_;
     my %emails = &Apache::loncommon::getemails();      my %emails = &Apache::loncommon::getemails();
     my $address;      my $address;
     if (($emails{'permanentemail'} ne '') || ($emails{'notification'} ne '')) {      if (($emails{'permanentemail'} ne '') || ($emails{'notification'} ne '')) {
Line 3815  sub notification_information { Line 3838  sub notification_information {
 &mt("Usually this means that your institution's information systems do not list you among the instructional personnel for this course.").'<br />'.  &mt("Usually this means that your institution's information systems do not list you among the instructional personnel for this course.").'<br />'.
 &mt('The list of instructional personnel for the course will be automatically checked daily, and once you are listed the request will be processed.').  &mt('The list of instructional personnel for the course will be automatically checked daily, and once you are listed the request will be processed.').
                    '</div>';                     '</div>';
       } elsif (($disposition eq 'created') && ($code)) {
           my $codemsg = [{
                            mt   => 'Students can automatically select your course by entering this code: [_1]',
                            args => [$code],
                        }];
           $output .= '<p>'.
                      &mt('Students can automatically select your course by entering this code: [_1].','<b>'.$code.'</b>').
                      '<br />'.
                      &mt('A message has been sent to your LON-CAPA account with this information.');
           if ($address ne '') {
               $output.= '<br />'.&mt('And an e-mail has also been sent to: [_1] with this code.',$address);
           }
           $output .= '</p>';
           my $sender = $env{'user.name'}.':'.$env{'user.domain'};
           if ($code) {
               &Apache::loncoursequeueadmin::send_selfserve_notification($req_notifylist,$codemsg,$cnum,$env{'form.cdescr'},
                                                                         $now,'uniquecode',$sender);
           }
     } else {      } else {
         $output .= '<div class="LC_warning">'.          $output .= '<div class="LC_warning">'.
                    &mt('Your request status is: [_1].',$disposition).                     &mt('Your request status is: [_1].',$disposition).
Line 3837  sub check_autolimit { Line 3878  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')) &&              } elsif ((($crstype eq 'official') || ($crstype eq 'unofficial') || ($crstype eq 'textbook')) &&
                      (exists($crsroles{$cnum.':'.$cdom.':cc'}))) {                       (exists($crsroles{$cnum.':'.$cdom.':cc'}))) {
                 $count ++;                  $count ++;
             }              }
Line 3906  sub retrieve_settings { Line 3947  sub retrieve_settings {
                         $env{'form.coursecredits'} = $reqinfo{'defaultcredits'};                          $env{'form.coursecredits'} = $reqinfo{'defaultcredits'};
                     }                      }
                 }                  }
             } elsif ($reqinfo{'crstype'} eq 'unofficial') {              } elsif (($reqinfo{'crstype'} eq 'unofficial') || ($reqinfo{'crstype'} eq 'textbook')) {
                 $env{'form.coursecredits'} = $reqinfo{'defaultcredits'};                  $env{'form.coursecredits'} = $reqinfo{'defaultcredits'};
             }              }
             my @currsec;              my @currsec;

Removed from v.1.66  
changed lines
  Added in v.1.71


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