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

raeburn raeburn at source.lon-capa.org
Mon Aug 24 10:50:23 EDT 2015


raeburn		Mon Aug 24 14:50:23 2015 EDT

  Modified files:              
    /loncom/interface	lonrequestcourse.pm 
  Log:
  - Textbook/Template course requests
    - Additional items can be sent to localenroll::crsreq_updates():
      _LC_coursedescription, _LC_coursestartdate, _LC_courseenddate.
    - clone options: datemode and dateshift use different element names
      in "colleagues' courses" tab and "own courses" tab.
  
  
Index: loncom/interface/lonrequestcourse.pm
diff -u loncom/interface/lonrequestcourse.pm:1.92 loncom/interface/lonrequestcourse.pm:1.93
--- loncom/interface/lonrequestcourse.pm:1.92	Tue Jul 14 00:11:48 2015
+++ loncom/interface/lonrequestcourse.pm	Mon Aug 24 14:50:22 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Request a course
 #
-# $Id: lonrequestcourse.pm,v 1.92 2015/07/14 00:11:48 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.93 2015/08/24 14:50:22 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3667,7 +3667,7 @@
         }
         $storeresult = 'notpermitted'; 
     } else {
-        my ($disposition,$message,$reqstatus,$coursedesc,%customvalidation);
+        my ($disposition,$message,$reqstatus,$coursedesc,$accessstart,$accessend,%customvalidation);
         my %reqhash = (
                         reqtime   => $now,
                         crstype   => $crstype,
@@ -3679,6 +3679,8 @@
                                                      $env{'user.domain'});
         if (ref($details) eq 'HASH') {
             $coursedesc = $details->{'cdescr'};
+            $accessstart = $details->{'accessstart'};
+            $accessend = $details->{'accessend'};
         }
         if ($val eq 'autolimit=') {
             $disposition = 'process';
@@ -3786,6 +3788,9 @@
                 $customitems{'_LC_owneremail'} = $owneremail;
             }
             $customitems{'_LC_coursedomainname'} = &Apache::lonnet::domain($dom,'description');
+            $customitems{'_LC_coursedescription'} = $coursedesc;
+            $customitems{'_LC_coursestartdate'} = $accessstart;
+            $customitems{'_LC_courseenddate'} = $accessend;
             my ($result,$postprocess) = &Apache::loncoursequeueadmin::course_creation($dom,$cnum,
                                           'autocreate',$details,\$logmsg,\$newusermsg,\$addresult,
                                           \$enrollcount,\$response,\$keysmsg,\%domdefs,\%longroles,
@@ -4742,13 +4747,13 @@
     if (keys(%cloneable)) {
         $r->print('<div id="showexisting" style="display:none">'.
                   &clone_selection_table($dom,'owned',\%cloneable).
-                  '<p><input type="radio" name="datemode" value="delete" /> '.$lt{'ncd'}.
+                  '<p><input type="radio" name="owndatemode" value="delete" /> '.$lt{'ncd'}.
                   '</label><br /><label>'.
-                  '<input type="radio" name="datemode" value="preserve" /> '.$lt{'prd'}.
+                  '<input type="radio" name="owndatemode" value="preserve" /> '.$lt{'prd'}.
                   '</label><br /><label>'.
-                  '<input type="radio" name="datemode" value="shift" checked="checked" /> '.
+                  '<input type="radio" name="owndatemode" value="shift" checked="checked" /> '.
                   $lt{'shd'}.'</label>'.
-                  '<input type="text" size="5" name="dateshift" value="365" />'.
+                  '<input type="text" size="5" name="owndateshift" value="365" />'.
                   '</div>');
     }
 #
@@ -4757,13 +4762,13 @@
     if (keys(%domcloneable)) {
         $r->print('<div id="showcolleague" style="display:none">'.
                   &clone_selection_table($dom,'colleague',\%domcloneable).
-                  '<p><input type="radio" name="datemode" value="delete" /> '.$lt{'ncd'}.
+                  '<p><input type="radio" name="colldatemode" value="delete" /> '.$lt{'ncd'}.
                   '</label><br /><label>'.
-                  '<input type="radio" name="datemode" value="preserve" /> '.$lt{'prd'}.
+                  '<input type="radio" name="colldatemode" value="preserve" /> '.$lt{'prd'}.
                   '</label><br /><label>'.
-                  '<input type="radio" name="datemode" value="shift" checked="checked" /> '.
+                  '<input type="radio" name="colldatemode" value="shift" checked="checked" /> '.
                   $lt{'shd'}.'</label>'.
-                  '<input type="text" size="5" name="dateshift" value="365" />'.
+                  '<input type="text" size="5" name="colldateshift" value="365" />'.
                   '</div>');
     }
 
@@ -4983,9 +4988,28 @@
                     accessend      => $accessend,
                     personnel      => {},
                   };
-    if ($reqtype eq 'existing') {
-        $details->{datemode} = $env{'form.datemode'};
-        $details->{dateshift} = $env{'form.dateshift'};
+    if (($clonecrs ne '') && ($clonedom ne '')) {
+        if ($reqtype eq 'existing') {
+            $details->{datemode} = $env{'form.owndatemode'};
+            if ($details->{datemode} eq 'shift') {
+                $details->{dateshift} = $env{'form.owndateshift'};
+            } else {
+                $details->{dateshift} = '';
+            }
+        } elsif ($reqtype eq 'colleague') {
+            $details->{datemode} = $env{'form.colldatemode'};
+            if ($details->{datemode} eq 'shift') {
+                $details->{dateshift} = $env{'form.colldateshift'};
+            } else {
+                $details->{dateshift} = '';
+            }
+        }
+        if ($details->{dateshift} ne '') {
+            $details->{dateshift} =~ s/[^\d\.]+//g;
+        }
+    } else {
+        $details->{datemode} = '';
+        $details->{dateshift} = '';
     }
     my $lonhost = $r->dir_config('lonHostID');
     $r->rflush();




More information about the LON-CAPA-cvs mailing list