[LON-CAPA-cvs] cvs: loncom /interface lonrequestcourse.pm

raeburn raeburn@source.lon-capa.org
Wed, 12 Aug 2009 14:24:35 -0000


raeburn		Wed Aug 12 14:24:35 2009 EDT

  Modified files:              
    /loncom/interface	lonrequestcourse.pm 
  Log:
  - Moving call to &print_request_status() inside &request_administration().
  - Wording change in message displayed if there are no pending requests.
  
  
Index: loncom/interface/lonrequestcourse.pm
diff -u loncom/interface/lonrequestcourse.pm:1.10 loncom/interface/lonrequestcourse.pm:1.11
--- loncom/interface/lonrequestcourse.pm:1.10	Wed Aug 12 12:40:33 2009
+++ loncom/interface/lonrequestcourse.pm	Wed Aug 12 14:24:35 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Request a course
 #
-# $Id: lonrequestcourse.pm,v 1.10 2009/08/12 12:40:33 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.11 2009/08/12 14:24:35 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -181,9 +181,10 @@
         }
     } elsif ($action eq 'view') {
         if ($state eq 'crstype') {
-            &print_main_menu($r,\%can_request,\%states,$dom,$jscript,'',$crumb);
-        } elsif ($state eq 'pick_request') {
-            $r->print(&print_request_status($dom,$crumb));
+           &print_main_menu($r,\%can_request,\%states,$dom,$jscript,'',$crumb);
+        } else {
+           &request_administration($r,$action,$state,$page,\%states,$dom,$jscript,
+                                   $loaditems,$crumb);
         }
     } elsif ($action eq 'log') {
         &print_request_logs($jscript,$loaditems,$crumb);
@@ -545,8 +546,11 @@
         &print_request_form($r,$action,$state,$page,$states,$dom);
     } elsif ($action eq 'view') {
         $r->print(&header('Manage course requests',$js.$jscript,$loaditems).$crumb);
+        if ($state eq 'pick_request') {
+            $r->print(&print_request_status($dom));
+        }
     } elsif ($action eq 'log') {
-        $r->print(&coursereq_log('View request log',$jscript,$loaditems).$crumb);       
+        $r->print(&coursereq_log('View request log',$jscript,$loaditems).$crumb);
     }
     $r->print(&Apache::loncommon::end_page());
     return;
@@ -920,19 +924,10 @@
 }
 
 sub print_request_status {
-    my ($dom,$crumb) = @_;
-    my $js =  <<END;
-
-function backPage(formname,prevstate) {
-    formname.state.value = prevstate;
-    formname.submit();
-}
-
-END
-    my $output = &header('Course Requests',$js).$crumb;
+    my ($dom) = @_;
     my %requests = &Apache::lonnet::dumpstore('courserequests',$env{'user.domain'},
                                               $env{'user.name'});
-    my %queue_by_date;
+    my ($output,$formname,%queue_by_date);
     foreach my $key (keys(%requests)) {
         if (ref($requests{$key}) eq 'HASH') {
             my ($cdom,$cnum) = split('_',$key);
@@ -961,9 +956,9 @@
             }
         }
     }
-    my $formname = 'requestcrs';
+    $formname = 'requestcrs';
     my @sortedtimes = sort {$a <=> $b} (keys(%queue_by_date));
-    $output .= '<form method="post" name="'.$formname.'" action="/adm/requestcourse" />'."\n".
+    $output = '<form method="post" name="'.$formname.'" action="/adm/requestcourse" />'."\n".
               '<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'."\n".
               '<input type="hidden" name="state" value="'.$env{'form.state'}.'" />'."\n".
               '<input type="hidden" name="crstype" value="'.$env{'form.crstype'}.'" />'."\n";
@@ -1004,12 +999,11 @@
         }
         $output .= &Apache::loncommon::end_data_table();
     } else {
-        $output .= '<div class="LC_info">'.&mt('You have no course requests pending approval by a Domain Coordinator or held in a queue pending administrative action at your institution.').'</div>';
+        $output .= '<div>'.&mt('You have no matching course requests awaiting approval by a Domain Coordinator or held in a queue pending administrative action at your institution.').'</div>';
     }
     $output .= '
 <input type="button" name="prev" value="'.&mt('Back').'" onclick="javascript:backPage(document.'.$formname.",'crstype'".')" />
-</form>'.
-    &Apache::loncommon::end_page();
+</form>';
     return $output;
 }
 
@@ -1426,6 +1420,7 @@
         $output = &mt('Invalid LON-CAPA course number for the new course')."\n"; 
         return $output;
     }
+
     %domconfig = &Apache::lonnet::get_dom('configuration',['requestcourses'],$dom);
     if (ref($domconfig{'requestcourses'}) eq 'HASH') {
         if (ref($domconfig{'requestcourses'}{'notify'}) eq 'HASH') {
@@ -1486,7 +1481,7 @@
                     owner          => $env{'user.name'},
                     domain         => $env{'user.domain'}, 
                     cdom           => $dom,
-                    cnum           => $cnum, 
+                    cnum           => $cnum,
                     cdesc          => $env{'form.cdesc'},
                     crstype        => $env{'form.crstype'},
                     instcode       => $env{'form.instcode'},