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

raeburn raeburn at source.lon-capa.org
Wed May 14 14:20:09 EDT 2014


raeburn		Wed May 14 18:20:09 2014 EDT

  Modified files:              
    /loncom/interface	lonrequestcourse.pm 
  Log:
  - Support display of queued "textbook" requests awaiting approval by DC.
  
  
Index: loncom/interface/lonrequestcourse.pm
diff -u loncom/interface/lonrequestcourse.pm:1.82 loncom/interface/lonrequestcourse.pm:1.83
--- loncom/interface/lonrequestcourse.pm:1.82	Fri May  9 17:43:13 2014
+++ loncom/interface/lonrequestcourse.pm	Wed May 14 18:20:09 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Request a course
 #
-# $Id: lonrequestcourse.pm,v 1.82 2014/05/09 17:43:13 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.83 2014/05/14 18:20:09 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -174,6 +174,22 @@
                 } else {
                     &textbook_request_disabled($r,$dom,\%can_request);
                 }
+            } elsif ($action eq 'display') {
+               my ($uname,$udom,$result,$warning) = &domcoord_display($dom);
+               if ($warning ne '') {
+                   my $args = { only_body => 1 };
+                   $r->print(&header('Course/Community Requests','','' ,'',$args).
+                             '<h3>'.&mt('Course/Community Request Details').'</h3>'.
+                             '<div class="LC_warning">'.$warning.'</div>'.
+                             &close_popup_form());
+                } else {
+                    $states{'display'} = ['details'];
+                    my $loaditems = &onload_action($action,$state);
+                    my $page = 0;
+                    &request_administration($r,$action,$state,$page,\%states,$dom,$jscript,
+                                            $loaditems,'','','','','',$showcredits,'','',
+                                            $uname,$udom);
+                }
             } else {
                 if ($can_request{'textbook'}) {
                     &print_textbook_form($r,$dom,\@incdoms,\%domdefs,$domconfig{'requestcourses'},\%can_request);
@@ -232,46 +248,7 @@
     my ($page,$crumb,$newinstcode,$codechk,$checkedcode,$description) =
         &get_breadcrumbs($dom,$action,\$state,\%states,\%trail);
     if ($action eq 'display') {
-        if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) {
-            if ($env{'form.cnum'} ne '') {
-                my $cnum = $env{'form.cnum'};
-                my $queue = $env{'form.queue'};
-                my $reqkey = $cnum.'_'.$queue;
-                my $namespace = 'courserequestqueue';
-                my $domconfig = &Apache::lonnet::get_domainconfiguser($dom);
-                my %queued =
-                    &Apache::lonnet::get($namespace,[$reqkey],$dom,$domconfig);
-                if (ref($queued{$reqkey}) eq 'HASH') {
-                    $uname = $queued{$reqkey}{'ownername'};
-                    $udom  = $queued{$reqkey}{'ownerdom'};
-                    if (($udom =~ /^$match_domain$/) && ($uname =~ /^$match_username$/)) {
-                        $result = &retrieve_settings($dom,$cnum,$udom,$uname);
-                    } else {
-                        if ($env{'form.crstype'} eq 'community') {
-                            $warning = &mt('Invalid username or domain for community requestor');
-                        } else {
-                            $warning = &mt('Invalid username or domain for course requestor');
-                        }
-                    }
-                } else {
-                    if ($env{'form.crstype'} eq 'community') {
-                        $warning = &mt('No information was found for this community request.');
-                    } else {
-                        $warning = &mt('No information was found for this course request.');
-                    }
-                }
-            } else {
-                $warning = &mt('No course request ID provided.');
-            }
-        } else {
-            if ($env{'form.crstype'} eq 'any') {
-               $warning = &mt('You do not have rights to view course or community request information.');
-            } elsif ($env{'form.crstype'} eq 'community') {
-                $warning = &mt('You do not have rights to view community request information.');
-            } else {
-                $warning = &mt('You do not have rights to view course request information.');
-            }
-        }
+        ($uname,$udom,$result,$warning) = &domcoord_display($dom);
     } elsif ((defined($state)) && (defined($action))) {
         if (($action eq 'view') && ($state eq 'details')) {
             if ((defined($env{'form.showdom'})) && (defined($env{'form.cnum'}))) {
@@ -1129,6 +1106,52 @@
     return;
 }
 
+sub domcoord_display {
+    my ($dom) = @_;
+    my ($uname,$udom,$result,$warning);
+    if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) {
+        if ($env{'form.cnum'} ne '') {
+            my $cnum = $env{'form.cnum'};
+            my $queue = $env{'form.queue'};
+            my $reqkey = $cnum.'_'.$queue;
+            my $namespace = 'courserequestqueue';
+            my $domconfig = &Apache::lonnet::get_domainconfiguser($dom);
+            my %queued =
+                &Apache::lonnet::get($namespace,[$reqkey],$dom,$domconfig);
+            if (ref($queued{$reqkey}) eq 'HASH') {
+                $uname = $queued{$reqkey}{'ownername'};
+                $udom  = $queued{$reqkey}{'ownerdom'};
+                if (($udom =~ /^$match_domain$/) && ($uname =~ /^$match_username$/)) {
+                    $result = &retrieve_settings($dom,$cnum,$udom,$uname);
+                } else {
+                    if ($env{'form.crstype'} eq 'community') {
+                        $warning = &mt('Invalid username or domain for community requestor');
+                    } else {
+                        $warning = &mt('Invalid username or domain for course requestor');
+                    }
+                }
+            } else {
+                if ($env{'form.crstype'} eq 'community') {
+                    $warning = &mt('No information was found for this community request.');
+                } else {
+                    $warning = &mt('No information was found for this course request.');
+                }
+            }
+        } else {
+            $warning = &mt('No course request ID provided.');
+        }
+    } else {
+        if ($env{'form.crstype'} eq 'any') {
+            $warning = &mt('You do not have rights to view course or community request information.');
+        } elsif ($env{'form.crstype'} eq 'community') {
+            $warning = &mt('You do not have rights to view community request information.');
+        } else {
+            $warning = &mt('You do not have rights to view course request information.');
+        }
+    }
+    return ($uname,$udom,$result,$warning);
+}
+
 sub enrollment_lcsec_js {
     my %alerts = &section_check_alerts();
     my $secname = $alerts{'badsec'};
@@ -4507,7 +4530,7 @@
             if (ref($ordered{'templates'}) eq 'HASH') {
                 $r->print('<span class="LC_nobreak"><label>'.
                           '<input type="radio" name="cloning" value="template" onclick="javascript:cloneChoice();" />'.
-                          &mt('Load template content').'</span>'.(' 'x2).' ');
+                          &mt('Load pre-existing template').'</span>'.(' 'x2).' ');
             }
         }
         if (keys(%cloneable)) {




More information about the LON-CAPA-cvs mailing list