Diff for /loncom/interface/lonrequestcourse.pm between versions 1.48 and 1.53

version 1.48, 2010/03/19 13:23:05 version 1.53, 2010/06/20 01:39:08
Line 128  sub handler { Line 128  sub handler {
     }      }
   
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
         ['action','showdom','cnum','state','crstype']);          ['action','showdom','cnum','state','crstype','queue']);
     &Apache::lonhtmlcommon::clear_breadcrumbs();      &Apache::lonhtmlcommon::clear_breadcrumbs();
     my $dom = &get_course_dom();      my $dom = &get_course_dom();
     my $action = $env{'form.action'};      my $action = $env{'form.action'};
Line 179  sub handler { Line 179  sub handler {
         if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) {          if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) {
             if ($env{'form.cnum'} ne '') {              if ($env{'form.cnum'} ne '') {
                 my $cnum = $env{'form.cnum'};                  my $cnum = $env{'form.cnum'};
                 my $reqkey = $cnum.'_approval';                  my $queue = $env{'form.queue'};
                   my $reqkey = $cnum.'_'.$queue;
                 my $namespace = 'courserequestqueue';                  my $namespace = 'courserequestqueue';
                 my $domconfig = &Apache::lonnet::get_domainconfiguser($dom);                  my $domconfig = &Apache::lonnet::get_domainconfiguser($dom);
                 my %queued =                  my %queued =
Line 317  sub handler { Line 318  sub handler {
     } elsif ($action eq 'display') {      } elsif ($action eq 'display') {
         if ($warning ne '') {          if ($warning ne '') {
             my $args = { only_body => 1 };              my $args = { only_body => 1 };
             $r->print(&header('Course/Community Requests','','',$args).$crumb.              $r->print(&header('Course/Community Requests','','' ,'',$args).$crumb.
                       '<h3>'.&mt('Course/Community Request Details').'</h3>'.                        '<h3>'.&mt('Course/Community Request Details').'</h3>'.
                       '<div class="LC_warning">'.$warning.'</div>'.                        '<div class="LC_warning">'.$warning.'</div>'.
                       &close_popup_form());                        &close_popup_form());
Line 646  sub onload_action { Line 647  sub onload_action {
 sub print_main_menu {  sub print_main_menu {
     my ($r,$can_request,$states,$dom,$jscript,$loaditems,$crumb,$request_domains) = @_;      my ($r,$can_request,$states,$dom,$jscript,$loaditems,$crumb,$request_domains) = @_;
     my ($types,$typename) = &Apache::loncommon::course_types();      my ($types,$typename) = &Apache::loncommon::course_types();
     my $onchange;      my $onchange = 'this.form.submit()';
     unless ($env{'form.interface'} eq 'textual') {  
         $onchange = 'this.form.submit()';  
     }  
   
     my $nextstate_setter = "\n";      my $nextstate_setter = "\n";
     if (ref($states) eq 'HASH') {      if (ref($states) eq 'HASH') {
         foreach my $key (keys(%{$states})) {          foreach my $key (keys(%{$states})) {
Line 699  END Line 696  END
         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 this domain.',
         all => 'You must choose a specific course type when making a new course request.\\nAll types is not allowed.',          all => 'You must choose a specific course type when making a new course request.\\n\"All types\" is not allowed.',
     );       ); 
     $js .= <<END;      $js .= <<END;
     if (crschoice == 'official') {      if (crschoice == 'official') {
Line 1861  sub current_lc_sections { Line 1858  sub current_lc_sections {
 }  }
   
 sub sorted_request_history {  sub sorted_request_history {
     my ($dom,$action,$after,$before) = @_;      my ($dom,$action,$curr_req) = @_;
       my ($after,$before,$statusfilter,$crstypefilter);
       if ($env{'form.status'} ne '') {
           $statusfilter = $env{'form.status'};
       }
       if ($env{'form.crstype'} ne '') {
           $crstypefilter = $env{'form.crstype'};
       }
       if (ref($curr_req) eq 'HASH') {
           $after = $curr_req->{'requested_after_date'},
           $before = $curr_req->{'requested_before_date'};
           $statusfilter = $curr_req->{'status'};
           $crstypefilter = $curr_req->{'crstype'};
       }
     my %statusinfo = &Apache::lonnet::dump('courserequests',$env{'user.domain'},      my %statusinfo = &Apache::lonnet::dump('courserequests',$env{'user.domain'},
                                            $env{'user.name'},'^status:'.$dom);                                             $env{'user.name'},'^status:'.$dom);
     my %queue_by_date;      my %queue_by_date;
Line 1870  sub sorted_request_history { Line 1880  sub sorted_request_history {
         if ($action eq 'view') {          if ($action eq 'view') {
             next unless (($statusinfo{$key} eq 'approval') || ($statusinfo{$key} eq 'pending'));              next unless (($statusinfo{$key} eq 'approval') || ($statusinfo{$key} eq 'pending'));
         } else {          } else {
             next unless (($env{'form.status'} eq 'any') ||              next unless (($statusfilter eq 'any') ||
                           ($env{'form.status'} eq $statusinfo{$key}));                            ($statusfilter eq $statusinfo{$key}));
         }          }
         (undef,my($cdom,$cnum)) = split(':',$key);          (undef,my($cdom,$cnum)) = split(':',$key);
         next if ($cdom ne $dom);             next if ($cdom ne $dom);   
Line 1890  sub sorted_request_history { Line 1900  sub sorted_request_history {
             } else {              } else {
                 next if (($reqtime < $after) || ($reqtime > $before));                  next if (($reqtime < $after) || ($reqtime > $before));
             }              }
             next unless (($env{'form.crstype'} eq 'any') ||               next unless (($crstypefilter eq 'any') || 
                          ($env{'form.crstype'} eq $crstype));                           ($crstypefilter eq $crstype));
             if ($action eq 'view') {              if ($action eq 'view') {
                 next unless (($disposition eq 'approval') ||                   next unless (($disposition eq 'approval') || 
                              ($disposition eq 'pending'));                               ($disposition eq 'pending'));
Line 2154  sub print_request_logs { Line 2164  sub print_request_logs {
     my ($statuses,$statusnames) = &reqstatus_names($curr{'crstype'});      my ($statuses,$statusnames) = &reqstatus_names($curr{'crstype'});
     $r->print('<input type="hidden" name="page" value="'.$curr{'page'}.'" />'.      $r->print('<input type="hidden" name="page" value="'.$curr{'page'}.'" />'.
               &requestlog_display_filter($formname,\%curr));                &requestlog_display_filter($formname,\%curr));
     my %queue_by_date = &sorted_request_history($dom,$env{'form.action'},      my %queue_by_date = &sorted_request_history($dom,$env{'form.action'},\%curr);
                                                 $curr{'requested_after_date'},  
                                                 $curr{'requested_before_date'});  
     my @sortedtimes = sort {$a <=> $b} (keys(%queue_by_date));      my @sortedtimes = sort {$a <=> $b} (keys(%queue_by_date));
     my $showntablehdr = 0;      my $showntablehdr = 0;
     my $tablehdr = &Apache::loncommon::start_data_table().      my $tablehdr = &Apache::loncommon::start_data_table().
Line 2302  sub reqstatus_names { Line 2310  sub reqstatus_names {
     my @statuses = qw(created approval pending rejected cancelled);      my @statuses = qw(created approval pending rejected cancelled);
     my %statusnames =      my %statusnames =
             &Apache::lonlocal::texthash (              &Apache::lonlocal::texthash (
                         created   => 'Course/Community created',                          created   => 'Created',
                         approval  => 'Queued pending approval',                          approval  => 'Queued pending approval',
                         pending   => 'Queued pending validation',                          pending   => 'Queued pending validation',
                         rejected  => 'Request rejected',                          rejected  => 'Request rejected',
Line 2756  ENDJS Line 2764  ENDJS
                '<label><input type="radio" name="cloning" value="1" '.                 '<label><input type="radio" name="cloning" value="1" '.
                'onclick="javascript:toggleCloning()" />'.                 'onclick="javascript:toggleCloning()" />'.
                &mt('Yes').('&nbsp;'x2).'</label><label>'.                 &mt('Yes').('&nbsp;'x2).'</label><label>'.
                '<input type="radio" name="cloning" value="0" '.                 '<input type="radio" name="cloning" value="0" checked="checked" '.
                'onclick="javascript:toggleCloning()" />'.&mt('No').'</label>'.                 'onclick="javascript:toggleCloning()" />'.&mt('No').'</label>'.
                '</h3>'.                 '</h3>'.
                &Apache::lonhtmlcommon::row_closure(1).                 &Apache::lonhtmlcommon::row_closure(1).
Line 2775  sub clone_form { Line 2783  sub clone_form {
     if ($crstype eq 'community') {      if ($crstype eq 'community') {
         $type = 'Community';          $type = 'Community';
     }      }
     my $cloneform = &Apache::loncommon::select_dom_form($dom,'clonedom').'&nbsp;'.  
                     &Apache::loncommon::selectcourse_link($formname,'clonecrs','clonedom','','','',$type);  
     my %lt = &clone_text();      my %lt = &clone_text();
     my $output .=       my $output .= 
         &Apache::lonhtmlcommon::row_title($lt{'cid'}).'<label>'.  
         '<input type="text" size="25" name="clonecrs" value=""  />'.  
         '</label>'.&Apache::lonhtmlcommon::row_closure(1).  
         &Apache::lonhtmlcommon::row_title($lt{'dmn'}).'<label>'.          &Apache::lonhtmlcommon::row_title($lt{'dmn'}).'<label>'.
         $cloneform.'</label>'.&Apache::lonhtmlcommon::row_closure(1).          &Apache::loncommon::select_dom_form($dom,'clonedom').'</label>'.
           &Apache::lonhtmlcommon::row_closure(1).
           &Apache::lonhtmlcommon::row_title($lt{'cid'}).'<label>'.
           '<input type="text" size="25" name="clonecrs" value="" onfocus="this.blur();opencrsbrowser('."'$formname','clonecrs','clonedom','','','','','$type'".')" />'.
           '</label>&nbsp;'.
           &Apache::loncommon::selectcourse_link($formname,'clonecrs','clonedom','','','',$type).
           &Apache::lonhtmlcommon::row_closure(1).
         &Apache::lonhtmlcommon::row_title($lt{'dsh'}).'<label>'.          &Apache::lonhtmlcommon::row_title($lt{'dsh'}).'<label>'.
         '<input type="radio" name="datemode" value="delete" /> '.$lt{'ncd'}.          '<input type="radio" name="datemode" value="delete" /> '.$lt{'ncd'}.
         '</label><br /><label>'.          '</label><br /><label>'.
Line 3286  sub print_request_outcome { Line 3295  sub print_request_outcome {
                                             description => $env{'form.cdescr'},                                               description => $env{'form.cdescr'}, 
                                           },                                            },
                           };                            };
               if ($crstype eq 'official') {
                   $request->{$requestid}->{'instcode'} = $instcode;
               }
             my $statuskey = 'status:'.$dom.':'.$cnum;              my $statuskey = 'status:'.$dom.':'.$cnum;
             my %userreqhash = &Apache::lonnet::get('courserequests',[$statuskey],              my %userreqhash = &Apache::lonnet::get('courserequests',[$statuskey],
                                                    $env{'user.domain'},$env{'user.name'});                                                     $env{'user.domain'},$env{'user.name'});

Removed from v.1.48  
changed lines
  Added in v.1.53


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