Diff for /loncom/interface/lonrequestcourse.pm between versions 1.35 and 1.36.2.1

version 1.35, 2009/09/11 12:53:10 version 1.36.2.1, 2009/09/23 15:58:26
Line 178  sub handler { Line 178  sub handler {
         $trail{'enrollment'} = 'Enrollment';          $trail{'enrollment'} = 'Enrollment';
     }      }
   
     my ($page,$crumb,$newinstcode,$codechk,$checkedcode) =       my ($page,$crumb,$newinstcode,$codechk,$checkedcode,$description) = 
         &get_breadcrumbs($dom,$action,\$state,\%states,\%trail);          &get_breadcrumbs($dom,$action,\$state,\%states,\%trail);
     if ($action eq 'display') {      if ($action eq 'display') {
         if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) {          if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) {
Line 238  sub handler { Line 238  sub handler {
                                     foreach my $item (@code_order) {                                      foreach my $item (@code_order) {
                                         $crosslistcode .= $env{'form.crosslist_'.$i.'_'.$item};                                           $crosslistcode .= $env{'form.crosslist_'.$i.'_'.$item}; 
                                     }                                      }
                                     if ($crosslistcode ne '') {                                       if ($crosslistcode ne '') {
                                          $codechk{$i} =                                           ($codechk{$i}, my $rest) =
                                             &Apache::lonnet::auto_validate_instcode('',$dom,$crosslistcode);                                              &Apache::lonnet::auto_validate_instcode('',$dom,$crosslistcode);
                                     }                                      }
                                     unless ($codechk{$i} eq 'valid') {                                      unless ($codechk{$i} eq 'valid') {
Line 286  sub handler { Line 286  sub handler {
             } else {              } else {
                 &request_administration($r,$action,$state,$page,\%states,$dom,                  &request_administration($r,$action,$state,$page,\%states,$dom,
                                         $jscript,$loaditems,$crumb,$newinstcode,                                          $jscript,$loaditems,$crumb,$newinstcode,
                                         $codechk,$checkedcode,\@invalidcrosslist);                                          $codechk,$checkedcode,$description,
                                           \@invalidcrosslist);
             }              }
         } else {          } else {
             $r->print(&header('Course Requests').$crumb.              $r->print(&header('Course Requests').$crumb.
Line 310  sub handler { Line 311  sub handler {
                       &close_popup_form());                        &close_popup_form());
         } else {          } else {
             &request_administration($r,$action,$state,$page,\%states,$dom,$jscript,              &request_administration($r,$action,$state,$page,\%states,$dom,$jscript,
                                     $loaditems,$crumb,'','','','',$uname,$udom);                                      $loaditems,$crumb,'','','','','',$uname,$udom);
         }          }
     } elsif ($action eq 'log') {      } elsif ($action eq 'log') {
         &print_request_logs($jscript,$loaditems,$crumb);          &print_request_logs($jscript,$loaditems,$crumb);
Line 346  END Line 347  END
   
 sub get_breadcrumbs {  sub get_breadcrumbs {
     my ($dom,$action,$state,$states,$trail) = @_;      my ($dom,$action,$state,$states,$trail) = @_;
     my ($crumb,$newinstcode,$codechk,$checkedcode,$numtitles);      my ($crumb,$newinstcode,$codechk,$checkedcode,$numtitles,$description);
     my $page = 0;      my $page = 0;
     if ((ref($states) eq 'HASH') && (ref($trail) eq 'HASH') && (ref($state))) {      if ((ref($states) eq 'HASH') && (ref($trail) eq 'HASH') && (ref($state))) {
         if (defined($action)) {          if (defined($action)) {
Line 371  sub get_breadcrumbs { Line 372  sub get_breadcrumbs {
                                     $$state = 'codepick';                                      $$state = 'codepick';
                                     $page --;                                      $page --;
                                 } else {                                  } else {
                                     $codechk =                                       ($codechk,$description) = 
                                         &Apache::lonnet::auto_validate_instcode('',                                          &Apache::lonnet::auto_validate_instcode('',
                                             $dom,$newinstcode);                                              $dom,$newinstcode);
                                     if ($codechk ne 'valid') {                                      if ($codechk ne 'valid') {
Line 416  sub get_breadcrumbs { Line 417  sub get_breadcrumbs {
                 {text=>'Pick Action'});                  {text=>'Pick Action'});
         $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests');          $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests');
     }      }
     return ($page,$crumb,$newinstcode,$codechk,$checkedcode);      return ($page,$crumb,$newinstcode,$codechk,$checkedcode,$description);
 }  }
   
 sub header {  sub header {
Line 626  sub check_can_request { Line 627  sub check_can_request {
 }  }
   
 sub course_types {  sub course_types {
     my @types = ('official','unofficial','community');      my @types = ('unofficial'); 
     my %typename = (      my %typename = (
                          official   => 'Official course',                           official   => 'Official course',
                          unofficial => 'Unofficial course',                           unofficial => 'Unofficial course',
Line 729  END Line 730  END
              '<div>'.               '<div>'.
               &Apache::lonhtmlcommon::start_pick_box().                &Apache::lonhtmlcommon::start_pick_box().
               &Apache::lonhtmlcommon::row_title(&mt('Course Domain')).                &Apache::lonhtmlcommon::row_title(&mt('Course Domain')).
               '<form name="domforcourse" method="post" action="/adm/requestcourse">'.                '<form name="domforcourse" method="post" action="/adm/requestcourse">');
               &Apache::loncommon::select_dom_form($dom,'showdom','',1,$onchange));      $r->print('GCI Web Center Concept Test Delivery (gcitest)'."\n".
     if (!$onchange) {                '<input type="hidden" value="gcitest" name="showdom" />');
         $r->print('&nbsp;<input type="submit" name="godom" value="'.  
                    &mt('Change').'" />');  
     }  
     $r->print('</form>'.&Apache::lonhtmlcommon::row_closure());      $r->print('</form>'.&Apache::lonhtmlcommon::row_closure());
   
     my $formname = 'requestcrs';      my $formname = 'requestcrs';
Line 744  END Line 742  END
 <select size="1" name="action" >  <select size="1" name="action" >
  <option value="new">'.&mt('New request').'</option>   <option value="new">'.&mt('New request').'</option>
  <option value="view">'.&mt('View/Modify/Cancel pending requests').'</option>   <option value="view">'.&mt('View/Modify/Cancel pending requests').'</option>
  <option value="log">'.&mt('View request history').'</option>  
 </select></form>'.  </select></form>'.
               &Apache::lonhtmlcommon::row_closure(1).                &Apache::lonhtmlcommon::row_closure(1).
               &Apache::lonhtmlcommon::row_title(&mt('Course Type')).'                &Apache::lonhtmlcommon::row_title(&mt('Course Type')).
 <form name="mainmenu_coursetype" method="post" action="">                &mt($typename->{'unofficial'})."\n".
 <select size="1" name="crstype">                '<form name="mainmenu_coursetype" method="post" action="">'."\n".
  <option value="any">'.&mt('All types').'</option>');                '<input type="hidden" name="crstype" value="unofficial" ></form>'."\n".
     if ((ref($types) eq 'ARRAY') && (ref($typename) eq 'HASH')) {  
         foreach my $type (@{$types}) {  
             my $selected = '';  
             if ($type eq 'official') {  
                 $selected = ' selected="selected"';  
             }  
             $r->print('<option value="'.$type.'"'.$selected.'>'.&mt($typename->{$type}).  
                       '</option>'."\n");  
         }  
     }  
     $r->print('</select></form>'."\n".  
               &Apache::lonhtmlcommon::row_closure(1)."\n".                &Apache::lonhtmlcommon::row_closure(1)."\n".
               &Apache::lonhtmlcommon::end_pick_box().'</div>'."\n".                &Apache::lonhtmlcommon::end_pick_box().'</div>'."\n".
               '<div><form name="'.$formname.'" method="post" action="">'."\n".                '<div><form name="'.$formname.'" method="post" action="">'."\n".
Line 778  END Line 764  END
   
 sub request_administration {  sub request_administration {
     my ($r,$action,$state,$page,$states,$dom,$jscript,$loaditems,$crumb,      my ($r,$action,$state,$page,$states,$dom,$jscript,$loaditems,$crumb,
         $newinstcode,$codechk,$checkedcode,$invalidcrosslist,$uname,$udom) = @_;          $newinstcode,$codechk,$checkedcode,$description,$invalidcrosslist,
           $uname,$udom) = @_;
     my $js;      my $js;
     if (($action eq 'new') || (($action eq 'view') && ($state eq 'pick_request'))) {      if (($action eq 'new') || (($action eq 'view') && ($state eq 'pick_request'))) {
         $js =  <<END;          $js =  <<END;
Line 814  END Line 801  END
         }          }
         $r->print(&header('Request a course',$js.$jscript,$loaditems,$jsextra).$crumb);          $r->print(&header('Request a course',$js.$jscript,$loaditems,$jsextra).$crumb);
         &print_request_form($r,$action,$state,$page,$states,$dom,$newinstcode,          &print_request_form($r,$action,$state,$page,$states,$dom,$newinstcode,
                             $codechk,$checkedcode,$invalidcrosslist);                              $codechk,$checkedcode,$description,$invalidcrosslist);
     } elsif ($action eq 'view') {      } elsif ($action eq 'view') {
         my $jsextra;          my $jsextra;
         my $formname = 'requestcrs';          my $formname = 'requestcrs';
Line 1126  sub get_instcode { Line 1113  sub get_instcode {
   
 sub print_request_form {  sub print_request_form {
     my ($r,$action,$state,$page,$states,$dom,$newinstcode,$codechk,$checkedcode,      my ($r,$action,$state,$page,$states,$dom,$newinstcode,$codechk,$checkedcode,
         $invalidcrosslist) = @_;          $description,$invalidcrosslist) = @_;
     my $formname = 'requestcrs';      my $formname = 'requestcrs';
     my ($next,$prev,$message,$output,$codepicker,$crstype);      my ($next,$prev,$message,$output,$codepicker,$crstype);
     $prev = $states->{$action}[$page-1];      $prev = $states->{$action}[$page-1];
Line 1191  sub print_request_form { Line 1178  sub print_request_form {
         if ($instcode eq '') {          if ($instcode eq '') {
             $prev = $states->{$action}[$page-2];              $prev = $states->{$action}[$page-2];
         }          }
         $r->print(&courseinfo_form($dom,$formname,$crstype,$next));          $r->print(&courseinfo_form($dom,$formname,$crstype,$next,$description));
     } elsif ($state eq 'enrollment') {      } elsif ($state eq 'enrollment') {
         if ($crstype eq 'official') {          if ($crstype eq 'official') {
             &Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles,              &Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles,
Line 2238  sub dates_from_form { Line 2225  sub dates_from_form {
 }  }
   
 sub courseinfo_form {  sub courseinfo_form {
     my ($dom,$formname,$crstype,$next) = @_;      my ($dom,$formname,$crstype,$next,$description) = @_;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                 official => 'You must provide a (brief) course description.',                  official => 'You must provide a (brief) course description.',
                 community => 'You must provide a (brief) community description.'                  community => 'You must provide a (brief) community description.'
Line 2268  ENDJS Line 2255  ENDJS
                   '<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Description').'&nbsp;'.$title.'</h3>'.                    '<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Description').'&nbsp;'.$title.'</h3>'.
                   &Apache::lonhtmlcommon::row_closure(1).                    &Apache::lonhtmlcommon::row_closure(1).
                   &Apache::lonhtmlcommon::row_title(&mt('Description')).                    &Apache::lonhtmlcommon::row_title(&mt('Description')).
                  '<input type="text" size="40" name="cdescr" />';                   '<input type="text" size="60" name="cdescr" value="'.$description.'" />';
     my ($home_server_pick,$numlib) =      my ($home_server_pick,$numlib) =
         &Apache::loncommon::home_server_form_item($dom,'chome',          &Apache::loncommon::home_server_form_item($dom,'chome',
                                                   'default','hide');                                                    'default','hide');

Removed from v.1.35  
changed lines
  Added in v.1.36.2.1


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