[LON-CAPA-cvs] cvs: loncom /interface loncoursequeueadmin.pm /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Sat Jun 18 20:19:32 EDT 2016


raeburn		Sun Jun 19 00:19:32 2016 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
    /loncom/interface	loncoursequeueadmin.pm 
  Log:
  - &course_portal_url() routine moved to facilitate re-use.
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1310 loncom/lonnet/perl/lonnet.pm:1.1311
--- loncom/lonnet/perl/lonnet.pm:1.1310	Mon May 30 04:48:23 2016
+++ loncom/lonnet/perl/lonnet.pm	Sun Jun 19 00:19:24 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1310 2016/05/30 04:48:23 raeburn Exp $
+# $Id: lonnet.pm,v 1.1311 2016/06/19 00:19:24 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2332,6 +2332,22 @@
     return %domdefaults;
 }
 
+sub course_portal_url {
+    my ($cnum,$cdom) = @_;
+    my $chome = &homeserver($cnum,$cdom);
+    my $hostname = &hostname($chome);
+    my $protocol = $protocol{$chome};
+    $protocol = 'http' if ($protocol ne 'https');
+    my %domdefaults = &get_domain_defaults($cdom);
+    my $firsturl;
+    if ($domdefaults{'portal_def'}) {
+        $firsturl = $domdefaults{'portal_def'};
+    } else {
+        $firsturl = $protocol.'://'.$hostname;
+    }
+    return $firsturl;
+}
+
 # --------------------------------------------------- Assign a key to a student
 
 sub assign_access_key {
@@ -10354,7 +10370,7 @@
 #  Parameters:
 #     $name      - Course/user name.
 #     $domain    - Name of the domain the user/course is registered on.
-#     $type      - Type of thing $name is (must be 'course' or 'user'
+#     $type      - Type of thing $name is (must be 'course' or 'user')
 #     $mapp      - decluttered URL of enclosing map  
 #     $recursed  - Ref to scalar -- set to 1, if nested maps have been recursed.
 #     $recurseup - Ref to array of map URLs, starting with map containing
Index: loncom/interface/loncoursequeueadmin.pm
diff -u loncom/interface/loncoursequeueadmin.pm:1.53 loncom/interface/loncoursequeueadmin.pm:1.54
--- loncom/interface/loncoursequeueadmin.pm:1.53	Mon Apr  4 01:09:48 2016
+++ loncom/interface/loncoursequeueadmin.pm	Sun Jun 19 00:19:31 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Utilities to administer domain course requests and course self-enroll requests
 #
-# $Id: loncoursequeueadmin.pm,v 1.53 2016/04/04 01:09:48 raeburn Exp $
+# $Id: loncoursequeueadmin.pm,v 1.54 2016/06/19 00:19:31 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -652,7 +652,7 @@
         $beneficiary = 'enroller';
         $cid = $env{'request.course.id'};
         $crstype = lc(&Apache::loncommon::course_type());
-        $firsturl = &course_portal_url($cnum,$cdom);
+        $firsturl = &Apache::lonnet::course_portal_url($cnum,$cdom);
         %requesthash = &Apache::lonnet::dump($namespace,$cdom,$cnum);
         $access_start =  $env{'course.'.$cid.'.internal.selfenroll_start_access'};
         $access_end =  $env{'course.'.$cid.'.internal.selfenroll_end_access'};
@@ -681,7 +681,7 @@
             }
         }
         my $domconfiguser = &Apache::lonnet::get_domainconfiguser($cdom);
-        $firsturl = &course_portal_url($domconfiguser,$cdom);
+        $firsturl = &Apache::lonnet::course_portal_url($domconfiguser,$cdom);
         $approvedmsg = [{
                             mt => 'Your request for Authoring Space has been approved.',
                         },
@@ -706,7 +706,7 @@
             }
         }
         my $domconfiguser = &Apache::lonnet::get_domainconfiguser($cdom);
-        $firsturl = &course_portal_url($domconfiguser,$cdom);
+        $firsturl = &Apache::lonnet::course_portal_url($domconfiguser,$cdom);
         $approvedmsg = [{
                             mt => 'Your request for a LON-CAPA account has been approved.',
                         },
@@ -981,7 +981,7 @@
                                 } else {
                                     $approvedmsg = $approvalmsg{'course'};
                                 }
-                                my $firsturl = &course_portal_url($cnum,$cdom);
+                                my $firsturl = &Apache::lonnet::course_portal_url($cnum,$cdom);
                                 if (ref($approvedmsg) eq 'ARRAY') {
                                     if (ref($approvedmsg->[1]) eq 'HASH') {
                                         $approvedmsg->[1]->{'args'} = [$firsturl];
@@ -1565,22 +1565,6 @@
     return $output;
 }
 
-sub course_portal_url {
-    my ($cnum,$cdom) = @_;
-    my $chome = &Apache::lonnet::homeserver($cnum,$cdom);
-    my $hostname = &Apache::lonnet::hostname($chome);
-    my $protocol = $Apache::lonnet::protocol{$chome};
-    $protocol = 'http' if ($protocol ne 'https');
-    my %domdefaults = &Apache::lonnet::get_domain_defaults($cdom);
-    my $firsturl;
-    if ($domdefaults{'portal_def'}) {
-        $firsturl = $domdefaults{'portal_def'};
-    } else {
-        $firsturl = $protocol.'://'.$hostname;
-    }
-    return $firsturl;
-}
-
 sub get_student_counts {
     my ($cdom,$cnum) = @_;
     my (%idx,%stucounts);
@@ -2095,7 +2079,7 @@
                         my $cid = $dom.'_'.$cnum;
                         push(@{$newcids{$instcode}},$cid);
                         if ($dcname && $dcdom) {
-                            my $firsturl = &course_portal_url($cnum,$dom);
+                            my $firsturl = &Apache::lonnet::course_portal_url($cnum,$dom);
                             my $beneficiary = 'pendingrequestor';
                             my $now = time;
                             my $owner = $ownername.':'.$ownerdom;




More information about the LON-CAPA-cvs mailing list